@pisell/private-materials 6.12.449 → 6.12.452

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +1 -1
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +1 -1
  9. package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +0 -1
  10. package/es/components/bigSale/components/ProductList/index.js +0 -1
  11. package/es/components/bigSale/components/TimeBar/index.js +0 -1
  12. package/es/components/bigSale/dialog.js +0 -1
  13. package/es/components/bigSale/hooks/useBigSaleContext.js +0 -1
  14. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +0 -1
  15. package/es/components/bigSale/index.js +0 -1
  16. package/es/components/bigSale/templates/Kiosk/index.js +0 -1
  17. package/es/components/kiosk/components/Shell/useKioskMemberAction.js +0 -1
  18. package/es/components/kiosk/sales/KioskSaleSession.js +0 -1
  19. package/es/components/kiosk/sales/useCheckout.js +0 -1
  20. package/es/components/kiosk/sales/useSaleSessionExit.js +0 -1
  21. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +0 -1
  22. package/es/components/venueBookingSales/checkout/VenueBookingHolderStep.js +0 -1
  23. package/es/components/venueBookingSales/checkout/useVenueBookingCheckout.js +0 -1
  24. package/es/components/venueBookingSales/checkout/useVenueCustomerAccess.js +0 -1
  25. package/es/components/venueBookingSales/checkout/useVenueKioskCheckout.js +0 -1
  26. package/es/components/venueBookingSales/extras/VenueExtraDetailModal.js +0 -1
  27. package/es/components/venueBookingSales/useDraftSession.js +17 -0
  28. package/es/components/venueBookingSales/useVenueBookingSession.js +1 -1
  29. package/es/index.js +0 -2
  30. package/es/plus/multiCurrencySettlement/index.js +1 -1
  31. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  32. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  33. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  34. package/es/plus/pisellReservation/utils/calendarBookingSelection.js +4 -4
  35. package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
  36. package/es/plus/saleDetail/Base.js +0 -1
  37. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +0 -1
  38. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +0 -1
  39. package/es/plus/saleDetail/components/DetailActions/index.js +0 -1
  40. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +0 -1
  41. package/es/plus/saleDetail/index.js +0 -1
  42. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +0 -1
  43. package/es/plus/saleDetail/tmpl/B/index.js +0 -1
  44. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  45. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  46. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  47. package/es/plus/venueBookingDesign/shared/booking-options.css +3 -3
  48. package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
  49. package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
  50. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  51. package/es/pro/Login2.0/index.d.ts +2 -2
  52. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  53. package/es/pro/skuDetailModal/flow/calendarEntry.js +2 -2
  54. package/lib/components/venueBookingSales/useDraftSession.js +17 -0
  55. package/lib/components/venueBookingSales/useVenueBookingSession.js +1 -0
  56. package/lib/plus/venueBookingDesign/shared/booking-options.css +3 -3
  57. package/package.json +4 -4
  58. package/es/plus/pisellReservation/index.js +0 -17
  59. package/es/plus/salesSdk/index.js +0 -54
@@ -53,7 +53,7 @@ ${i} {
53
53
  ${eJ0.filter(e=>"paired"===e.mode).map(e=>` --${e.id}: var(--${e.id}-h5);`).join("\n")}
54
54
  }
55
55
  }
56
- `:"")}(b,e)+t+l},[b,v,C,o]),T=(0,eC.useMemo)(()=>({...eJW(y.primaryColor),...p?{"--booking-font-family":p}:{},...S?{"--booking-viewport-height":S}:{}}),[y.primaryColor,p,S]),I=(0,eC.useMemo)(()=>({lang:l,layout:f,presentationPlatform:o,currency:a,timeZone:n,progress:N,root:x,portal:_,background:m??x,money:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AUD",i=new Intl.NumberFormat("en"===t?"en-AU":"zh-CN",{style:"currency",currency:l,currencyDisplay:"narrowSymbol"}),a=i.resolvedOptions().maximumFractionDigits??2,n=i.format(e/10**a);return"AUD"===l?n.replace("$","A$"):n}(e,t,a)},brand:y,design:b,fontFamily:p,brandTokens:T,scopeId:v}),[l,f,o,a,n,N,_,x,m,y,b,T,v,p]),P=(0,eH.jsxs)(eJR.Provider,{value:I,children:[(0,eH.jsx)("style",{children:M}),(0,eH.jsx)("div",{ref:k,className:`booking-ui${"compact"===f?" booking-ui-compact":""} ${h}`.trim(),"data-booking-scope":v,"data-booking-presentation":o,lang:"zh"===l?"zh-CN":"en-AU",style:"kiosk"===o?{...T,height:"var(--booking-viewport-height)",minHeight:0,overflowY:"auto"}:T,children:(0,eH.jsx)(eJG,{config:y,children:t})}),"u">typeof document&&(0,oT.createPortal)((0,eH.jsx)("div",{ref:w,className:`booking-ui booking-ui-portals${"compact"===f?" booking-ui-compact":""}`,lang:"zh"===l?"zh-CN":"en-AU","data-booking-scope":v,"data-booking-presentation":o,style:T}),g??document.body)]});return"kiosk"===o?(0,eH.jsx)(eT.ConfigProvider,{theme:eXs,wave:eXd,children:P}):P},eXu=e=>!!(e&&"object"==typeof e&&!Array.isArray(e));function eXp(e,t){if("string"==typeof e)return e;if(e&&"object"==typeof e&&!Array.isArray(e)){let l=e[t]??e["zh"===t?"zh-CN":"en"]??e.en;return"string"==typeof l?l:Object.values(e).find(e=>"string"==typeof e)||""}return""}function eXm(e,t){let l=eXp(e,t);if("u"<typeof DOMParser)return l.replace(/<br\s*\/?\s*>|<\/(?:p|div|li|h[1-6])>/gi,"\n").replace(/<[^>]*>/g,"").trim();if(!/[<&\r\0]/.test(l))return l.replace(/\n{3,}/g,"\n\n").trim();let i=new DOMParser().parseFromString(l,"text/html").body;return i.querySelectorAll("script, style, template").forEach(e=>e.remove()),i.querySelectorAll("br").forEach(e=>e.replaceWith("\n")),i.querySelectorAll("p, div, li, h1, h2, h3, h4, h5, h6, blockquote, tr").forEach(e=>e.append("\n")),(i.textContent||"").replace(/\n{3,}/g,"\n\n").trim()}function eXg(e){let t=new Map,l=0;return i=>{let a=eXp(i,e);if("u"<typeof DOMParser||!/[<&\r\0]/.test(a))return eXm(a,e);let n=t.get(a);if(void 0!==n)return n;let r=eXm(a,e),o=a.length+r.length;if(o>256e3)return r;for(;t.size>=64||l+o>256e3;){let e=t.keys().next().value;l-=e.length+t.get(e).length,t.delete(e)}return t.set(a,r),l+=o,r}}let eXh=e=>({skuValue:{product_id:e,product_variant_id:0,option:[],bundle:[]},variantDraft:null}),eXv=e=>{var t;return(null==e||null==(t=e._extend)?void 0:t.localId)||(null==e?void 0:e.external_sale_number)||(null==e?void 0:e.order_id)||e};function eXf(e){let t=new Intl.DateTimeFormat("en-CA",{timeZone:e||void 0,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date),l=e=>{var l;return null==(l=t.find(t=>t.type===e))?void 0:l.value};return`${l("year")}-${l("month")}-${l("day")}`}function eXy(e){if(!e||"object"!=typeof e)return!1;let t=e.otherParams;return!!t&&"object"==typeof t&&"kiosk"===String((null==t?void 0:t.platform)||"").trim().toLowerCase()&&((null==t?void 0:t.venueBookingMode)==="tickets"||(null==t?void 0:t.venueBookingMode)==="party")}function eXb(e){var t,l,i;let a=e.sales.bookingTicket,n=null==a||null==(t=a.getTempOrder)?void 0:t.call(a),r=null==a||null==(l=a.getOrderCustomerSnapshot)?void 0:l.call(a);return exS(null==n?void 0:n.customer_id,null==n||null==(i=n.customer)?void 0:i.id,null==r?void 0:r.customer_id,null==r?void 0:r.id)}function eXx(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!eXy(e.sales.bookingTicket)&&"promotion_code"!==t.reason)return null;let l=eXb(e);if(exw(l))return null;if("promotion_code"===t.reason)return{reason:"promotion_code",currentCustomerId:l};let i=t.products?t.products.map(e=>({cacheItem:e})):e_J(e.sales.bookingTicket),a=eUl({platform:"kiosk",currentCustomerIdCandidates:[l],unassignedHolderLines:i});return!a&&t.force&&i[0]?{reason:"holder_required",product:i[0].cacheItem,currentCustomerId:l}:a}async function eXk(e){if(!e.isCurrent())return!1;let t=eXx(e.context,e);if(!t)return!0;if(!e.openCustomerAuth)throw Error("Customer sign-in is unavailable. Please try again.");let l=e.context.sales.bookingTicket,i=String(eXb(e.context)||""),a=()=>e.isCurrent()&&String(eXb(e.context)||"")===i;return await eUi({request:t,openCustomerAuth:e.openCustomerAuth,setOrderCustomer:"function"==typeof(null==l?void 0:l.setOrderCustomer)?async t=>{if(!a())return;let n=l.setOrderCustomer(t);i=String(eXb(e.context)||""),await n}:void 0,loadDiscountConfig:async()=>{a()&&(await e.context.cart.loadDiscountConfig(),a()&&e.context.cart.refreshCartSnapshot())},isActive:a})&&a()&&exw(eXb(e.context))}let eX_=(0,eC.createContext)({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),eXw=eC.forwardRef((e,t)=>{let{alt:l,color:i,size:a,weight:n,mirrored:r,children:o,weights:s,...d}=e,{color:c="currentColor",size:u,weight:p="regular",mirrored:m=!1,...g}=eC.useContext(eX_);return eC.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:null!=a?a:u,height:null!=a?a:u,fill:null!=i?i:c,viewBox:"0 0 256 256",transform:r||m?"scale(-1, 1)":void 0,...g,...d},!!l&&eC.createElement("title",null,l),o,s.get(null!=n?n:p))});eXw.displayName="IconBase";let eXS=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,108a12,12,0,0,0,12-12V64a20,20,0,0,0-20-20H32A20,20,0,0,0,12,64V96a12,12,0,0,0,12,12,20,20,0,0,1,0,40,12,12,0,0,0-12,12v32a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V160a12,12,0,0,0-12-12,20,20,0,0,1,0-40ZM36,170.34a44,44,0,0,0,0-84.68V68H88V188H36Zm184,0V188H112V68H220V85.66a44,44,0,0,0,0,84.68Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M200,128a32,32,0,0,0,32,32v32a8,8,0,0,1-8,8H96V56H224a8,8,0,0,1,8,8V96A32,32,0,0,0,200,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Zm192,0V192H104V64H224V88.8a40,40,0,0,0,0,78.4Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,102a6,6,0,0,0,6-6V64a14,14,0,0,0-14-14H32A14,14,0,0,0,18,64V96a6,6,0,0,0,6,6,26,26,0,0,1,0,52,6,6,0,0,0-6,6v32a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V160a6,6,0,0,0-6-6,26,26,0,0,1,0-52ZM30,192V165.53a38,38,0,0,0,0-75.06V64a2,2,0,0,1,2-2H90V194H32A2,2,0,0,1,30,192Zm196-26.47V192a2,2,0,0,1-2,2H102V62H224a2,2,0,0,1,2,2V90.47a38,38,0,0,0,0,75.06Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Zm192,0V192H104V64H224V88.8a40,40,0,0,0,0,78.4Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,100a4,4,0,0,0,4-4V64a12,12,0,0,0-12-12H32A12,12,0,0,0,20,64V96a4,4,0,0,0,4,4,28,28,0,0,1,0,56,4,4,0,0,0-4,4v32a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V160a4,4,0,0,0-4-4,28,28,0,0,1,0-56ZM28,192V163.78a36,36,0,0,0,0-71.56V64a4,4,0,0,1,4-4H92V196H32A4,4,0,0,1,28,192Zm168-64a36.06,36.06,0,0,0,32,35.78V192a4,4,0,0,1-4,4H100V60H224a4,4,0,0,1,4,4V92.22A36.06,36.06,0,0,0,196,128Z"}))]]),eXj=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXS}));function eXN(){let{progress:e}=eJ$(),t=(0,eC.useRef)(void 0);return(0,eC.useEffect)(()=>()=>{var e;return null==(e=t.current)?void 0:e.call(t)},[]),(0,eC.useCallback)((l,i)=>{t.current=e.moveTo(l,i)},[e])}function eXC(e){var t;let{number:l,state:i,lang:a,className:n}=e,r=(null==(t=eJF())?void 0:t.presentationPlatform)==="kiosk",o=(0,eC.useRef)(null);(0,eC.useLayoutEffect)(()=>{if(r)return;let e=o.current;if(!e||!i.from||void 0===i.changedAt)return;let t=window.matchMedia("(prefers-reduced-motion: reduce)"),l=performance.now()-i.changedAt,a="complete"===i.status?320:240;if(t.matches||l>=a)return;let n=[],s=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a;if(!e||"function"!=typeof e.animate||l>=i)return;let r=e.animate(t,{duration:i,easing:"ease-out"});r.currentTime=l,n.push(r)},d=getComputedStyle(e);s(e,[{backgroundColor:d.getPropertyValue(`--step-${i.from}-background`).trim()},{backgroundColor:d.backgroundColor}],240),s(e,[{transform:"scale(0.8)"},..."complete"===i.status?[{opacity:1,transform:"scale(1.12)",offset:.65}]:[],{transform:"scale(1)"}]);let c=()=>n.forEach(e=>e.cancel()),u=()=>{t.matches&&c()};return t.addEventListener("change",u),()=>{c(),t.removeEventListener("change",u)}},[i,r]);let s={locked:"zh"===a?"不可填写":"Locked",available:"zh"===a?"可填写":"Ready to fill in",complete:"zh"===a?"已填写":"Completed"}[i.status];return(0,eH.jsx)("span",{ref:o,className:`${n} selection-step-indicator`,"data-step-status":i.status,role:"img","aria-label":"zh"===a?`第 ${l} 步:${s}`:`Step ${l}: ${s}`})}function eXM(e){let{navigation:t,title:l,description:i,children:a,summary:n,footer:r,className:o="",contentClassName:s="",stage:d,id:c}=e;return(0,eH.jsxs)("div",{id:c,className:`checkout-page booking-page ${o}`,children:[(0,eH.jsxs)("div",{className:`content checkout-grid ${s}`,children:[(0,eH.jsxs)("div",{className:"checkout-main","data-booking-scroll-root":!0,children:[t&&(0,eH.jsx)("div",{className:"booking-page-navigation","data-booking-sticky":!0,children:t}),(l||i)&&(0,eH.jsxs)("header",{className:"page-title","data-booking-stage":d,tabIndex:-1,children:[l&&(0,eH.jsx)("h1",{children:l}),i&&(0,eH.jsx)("p",{children:i})]}),!l&&!i&&d&&(0,eH.jsx)("div",{"data-booking-stage":d,tabIndex:-1}),a]}),n]}),r]})}function eXT(e){let{label:t,amount:l,formatAmount:i,total:a=!1,className:n=""}=e;return(0,eH.jsxs)("div",{className:`amount-row ${a?"total-row":"price-row"} ${n}`,children:[(0,eH.jsx)("span",{children:t}),(0,eH.jsx)("strong",{children:"number"==typeof l&&i?i(l):l})]})}eXj.displayName="TicketIcon";let eXI=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),eXP=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXI}));eXP.displayName="ArrowLeftIcon";let eXA=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z"}))]]),eXD=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXA}));function eXE(e){let{secondary:t,busy:l,children:i,disabled:a,type:n="button",className:r="",...o}=e;return(0,eH.jsxs)("button",{...o,type:n,disabled:a||l,"aria-busy":l||void 0,className:`button ${t?"secondary":""} ${r}`,children:[(0,eH.jsx)("span",{className:"booking-button-content",children:i}),l&&(0,eH.jsx)(eXD,{className:"booking-button-spinner",size:22,"aria-hidden":"true"})]})}function eXO(e){let{type:t="button",className:l="",...i}=e;return(0,eH.jsx)("button",{...i,type:t,className:`shared-icon-button ${l}`})}function eXz(e){var t;let{lang:l,children:i,className:a=""}=e,n=(null==(t=eJF())?void 0:t.presentationPlatform)==="kiosk",r=(0,eC.useRef)(null);return(0,eC.useLayoutEffect)(()=>{let e=r.current;if(e)return eJ5(e,"--mobile-action-bar-height",n)},[n]),(0,eH.jsx)("div",{ref:r,className:`mobile-action-bar ${a}`,role:"region","aria-label":"zh"===l?"订单操作":"Order actions",children:i})}function eXL(e){let{action:t,className:l="",id:i}=e;return(0,eH.jsx)(eXE,{id:i,className:`booking-primary-action ${l}`,disabled:t.disabled,busy:t.busy,onClick:()=>{t.onClick()},children:t.label})}function eXR(e){let{leading:t,amount:l,label:i,detail:a,action:n,actionId:r,secondaryAction:o,feedback:s}=e;return(0,eH.jsxs)("div",{className:"booking-config-footer",children:[a&&(0,eH.jsx)("div",{className:"booking-config-detail",children:a}),(0,eH.jsxs)("div",{className:"booking-config-main",children:[t&&(0,eH.jsx)("div",{className:"booking-config-leading",children:t}),(0,eH.jsxs)("div",{className:"booking-config-amount",children:[i&&(0,eH.jsx)("small",{children:i}),(0,eH.jsx)("strong",{children:l})]}),(0,eH.jsxs)("div",{className:"booking-config-actions",children:[o&&(0,eH.jsx)(eXE,{secondary:!0,disabled:o.disabled||n.busy,busy:o.busy,onClick:()=>{o.onClick()},children:o.label}),(0,eH.jsx)(eXL,{id:r,action:{...n,label:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("span",{className:"booking-config-action-full",children:n.label}),(0,eH.jsxs)("span",{className:"booking-config-action-compact",children:[n.compactLabel??n.label," ",(0,eH.jsx)("span",{"aria-hidden":"true",children:"\xb7"})," ",l]})]})}})]})]}),s&&(0,eH.jsx)("div",{className:"booking-config-feedback",children:s})]})}function eX$(e){let{lang:t,back:l,summary:i,action:a,feedback:n}=e;return(0,eH.jsxs)(eXz,{lang:t,className:`booking-footer mobile-action${n?" booking-footer--with-feedback":""}`,children:[n&&(0,eH.jsx)("div",{className:"booking-footer-feedback",children:n}),l&&(l.href?(0,eH.jsx)("a",{className:"mobile-action-back",href:l.href,"aria-label":l.label,"aria-disabled":a.busy||void 0,tabIndex:a.busy?-1:void 0,onClick:e=>{a.busy?e.preventDefault():0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||l.onClick&&(e.preventDefault(),l.onClick())},children:(0,eH.jsx)(eXP,{size:20,"aria-hidden":"true"})}):(0,eH.jsx)(eXO,{className:"mobile-action-back","aria-label":l.label,disabled:a.busy,onClick:l.onClick,children:(0,eH.jsx)(eXP,{size:20,"aria-hidden":"true"})})),i,(0,eH.jsx)(eXL,{action:a})]})}eXD.displayName="CircleNotchIcon";let eXF=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,76H180V56A52,52,0,0,0,76,56V76H48A20,20,0,0,0,28,96V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V96A20,20,0,0,0,208,76ZM100,56a28,28,0,0,1,56,0V76H100ZM204,204H52V100H204Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,96V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V96a8,8,0,0,1,8-8H208A8,8,0,0,1,216,96Z",opacity:"0.2"}),eC.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,82H174V56a46,46,0,0,0-92,0V82H48A14,14,0,0,0,34,96V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V96A14,14,0,0,0,208,82ZM94,56a34,34,0,0,1,68,0V82H94ZM210,208a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V96a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,84H172V56a44,44,0,0,0-88,0V84H48A12,12,0,0,0,36,96V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V96A12,12,0,0,0,208,84ZM92,56a36,36,0,0,1,72,0V84H92ZM212,208a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V96a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z"}))]]),eXq=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXF}));eXq.displayName="LockSimpleIcon";let eXB=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),eC.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),eXH=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXB}));eXH.displayName="CaretUpIcon";let eXV=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),eXU=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXV}));eXU.displayName="CheckCircleIcon";let eXY=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216.49,184.49l-32,32a12,12,0,0,1-17-17L179,188H48a12,12,0,0,1,0-24H179l-11.52-11.51a12,12,0,0,1,17-17l32,32A12,12,0,0,1,216.49,184.49Zm-145-64a12,12,0,0,0,17-17L77,92H208a12,12,0,0,0,0-24H77L88.49,56.49a12,12,0,0,0-17-17l-32,32a12,12,0,0,0,0,17Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,80v96H48V80Z",opacity:"0.2"}),eC.createElement("path",{d:"M213.66,181.66l-32,32a8,8,0,0,1-11.32-11.32L188.69,184H48a8,8,0,0,1,0-16H188.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,213.66,181.66Zm-139.32-64a8,8,0,0,0,11.32-11.32L67.31,88H208a8,8,0,0,0,0-16H67.31L85.66,53.66A8,8,0,0,0,74.34,42.34l-32,32a8,8,0,0,0,0,11.32Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M42.34,85.66a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,88,48V72H208a8,8,0,0,1,0,16H88v24a8,8,0,0,1-13.66,5.66Zm171.32,84.68-32-32A8,8,0,0,0,168,144v24H48a8,8,0,0,0,0,16H168v24a8,8,0,0,0,13.66,5.66l32-32A8,8,0,0,0,213.66,170.34Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M212.24,171.76a6,6,0,0,1,0,8.48l-32,32a6,6,0,0,1-8.48-8.48L193.51,182H48a6,6,0,0,1,0-12H193.51l-21.75-21.76a6,6,0,0,1,8.48-8.48ZM75.76,116.24a6,6,0,0,0,8.48-8.48L62.49,86H208a6,6,0,0,0,0-12H62.49L84.24,52.24a6,6,0,0,0-8.48-8.48l-32,32a6,6,0,0,0,0,8.48Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M213.66,181.66l-32,32a8,8,0,0,1-11.32-11.32L188.69,184H48a8,8,0,0,1,0-16H188.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,213.66,181.66Zm-139.32-64a8,8,0,0,0,11.32-11.32L67.31,88H208a8,8,0,0,0,0-16H67.31L85.66,53.66A8,8,0,0,0,74.34,42.34l-32,32a8,8,0,0,0,0,11.32Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M210.83,173.17a4,4,0,0,1,0,5.66l-32,32a4,4,0,0,1-5.66-5.66L198.34,180H48a4,4,0,0,1,0-8H198.34l-25.17-25.17a4,4,0,0,1,5.66-5.66ZM77.17,114.83a4,4,0,0,0,5.66-5.66L57.66,84H208a4,4,0,0,0,0-8H57.66L82.83,50.83a4,4,0,0,0-5.66-5.66l-32,32a4,4,0,0,0,0,5.66Z"}))]]),eXW=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXY}));function eXK(e){let{number:t,stepStatus:l,title:i,children:a,summary:n,open:r,onToggle:o,id:s,lang:d,locked:c=!1,completing:u=!1,className:p=""}=e,m=r||!n,g=m?"zh"===d?"收起":"Done":"zh"===d?"切换":"Change";return(0,eH.jsxs)("section",{className:`selection-section ${p}`,id:s,tabIndex:-1,"aria-labelledby":`${s}-title`,children:[(0,eH.jsxs)("div",{className:"selection-section-heading",children:[l?(0,eH.jsx)(eXC,{number:t,state:l,lang:d,className:"checkout-module-number"}):(0,eH.jsx)("span",{className:"checkout-module-number","aria-hidden":"true",children:t}),(0,eH.jsx)("h2",{id:`${s}-title`,children:i}),c&&!l&&(0,eH.jsx)(eXq,{size:18,"aria-label":"zh"===d?"已锁定":"Locked"}),m&&n&&(0,eH.jsx)(eXO,{className:"selection-section-toggle",onClick:o,disabled:c,"aria-label":`${g} \xb7 ${i}`,"aria-expanded":!0,"aria-controls":`${s}-content`,children:(0,eH.jsx)(eXH,{size:20,"aria-hidden":"true"})})]}),(0,eH.jsx)("div",{id:`${s}-content`,children:m?a:(0,eH.jsxs)("button",{type:"button",className:`selection-section-summary${u?" is-completing":""}`,onClick:o,disabled:c,"aria-label":`${g} \xb7 ${i}`,"aria-describedby":`${s}-summary-copy`,"aria-expanded":!1,"aria-controls":`${s}-content`,children:[(0,eH.jsx)("span",{className:"selection-section-summary-copy",id:`${s}-summary-copy`,children:n}),(0,eH.jsxs)("span",{className:"selection-summary-status","aria-hidden":"true",children:[(0,eH.jsx)(eXU,{className:"selection-summary-check",size:24,weight:"fill"}),(0,eH.jsx)(eXW,{className:"selection-summary-change",size:21,weight:"bold"})]})]})})]})}eXW.displayName="ArrowsLeftRightIcon";let eXG=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M233.21,56.31A12,12,0,0,0,224,52H66L60.53,21.85A12,12,0,0,0,48.73,12H24a12,12,0,0,0,0,24H38.71L63.62,173a28,28,0,0,0,4.07,10.21A32,32,0,1,0,123,196h34a32,32,0,1,0,31-24H91.17a4,4,0,0,1-3.93-3.28L84.92,156H196.1a28,28,0,0,0,27.55-23l12.16-66.86A12,12,0,0,0,233.21,56.31ZM100,204a8,8,0,1,1-8-8A8,8,0,0,1,100,204Zm88,8a8,8,0,1,1,8-8A8,8,0,0,1,188,212Zm12-83.28A4,4,0,0,1,196.1,132H80.56L70.38,76H209.62Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,64l-12.16,66.86A16,16,0,0,1,196.1,144H70.55L56,64Z",opacity:"0.2"}),eC.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Zm4-74.57A8,8,0,0,1,196.1,136H77.22L65.59,72H214.41Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228.61,60.16A6,6,0,0,0,224,58H61L54.63,22.93A6,6,0,0,0,48.73,18H24a6,6,0,0,0,0,12H43.72L69.53,171.94a21.93,21.93,0,0,0,6.24,11.77A26,26,0,1,0,113.89,190h52.22A26,26,0,1,0,188,178H91.17a10,10,0,0,1-9.84-8.21L77.73,150H196.1a22,22,0,0,0,21.65-18.06L229.9,65.07A6,6,0,0,0,228.61,60.16ZM106,204a14,14,0,1,1-14-14A14,14,0,0,1,106,204Zm96,0a14,14,0,1,1-14-14A14,14,0,0,1,202,204Zm3.94-74.21A10,10,0,0,1,196.1,138H75.55L63.19,70H216.81Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Zm4-74.57A8,8,0,0,1,196.1,136H77.22L65.59,72H214.41Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M227.07,61.44A4,4,0,0,0,224,60H59.34L52.66,23.28A4,4,0,0,0,48.73,20H24a4,4,0,0,0,0,8H45.39l6.69,36.8h0L71.49,171.58A20,20,0,0,0,79,183.85,24,24,0,1,0,109.87,188h60.26A24,24,0,1,0,188,180H91.17a12,12,0,0,1-11.8-9.85l-4-22.15H196.1a20,20,0,0,0,19.68-16.42l12.16-66.86A4,4,0,0,0,227.07,61.44ZM108,204a16,16,0,1,1-16-16A16,16,0,0,1,108,204Zm96,0a16,16,0,1,1-16-16A16,16,0,0,1,204,204Zm3.91-73.85A12,12,0,0,1,196.1,140H73.88L60.79,68H219.21Z"}))]]),eXQ=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXG}));eXQ.displayName="ShoppingCartIcon";let eXZ=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),eC.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),eXJ=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXZ}));eXJ.displayName="XIcon";let eXX=new Map,eX0="content-visibility",eX2="contain-intrinsic-block-size",eX1="important";function eX4(e,t){return{value:e.getPropertyValue(t),priority:e.getPropertyPriority(t)}}function eX3(e,t,l,i){e.getPropertyValue(t)===l&&e.getPropertyPriority(t)===eX1&&(i.value?e.setProperty(t,i.value,i.priority):e.removeProperty(t))}let eX8=[],eX6=new WeakMap,eX5="",eX7=new Map,eX9=".pisell-sku-options-modal[role='dialog'], .pisell-sku-options-modal [role='dialog'], .pisell-lookup-modal-container[role='dialog'], .pisell-lookup-modal-container [role='dialog'], .pisell-lookup-drawer-container[role='dialog'], .pisell-lookup-drawer-container [role='dialog'], .ant-modal-root [role='dialog'], .ant-drawer [role='dialog'], .pisell-pc-modal [role='dialog'], .pisell-mobile-modal [role='dialog'], .pisell-lowcode-floating-layer-root [role='dialog'], .sales-sdk-allergy-modal [role='dialog'], .numeric-stepper-keyboard-popover, .numeric-stepper-keyboard-modal";function e0e(){eX8.forEach((e,t)=>{e.inert=t!==eX8.length-1,e.style.zIndex=String((eX6.get(e)??1e3)+t)})}function e0t(e){let{title:t,children:l,onClose:i,closeLabel:a,wide:n=!1,className:r="",initialFocus:o,open:s=!0,footer:d,intro:c,bodyClassName:u="",footerClassName:p="",mobile:m="sheet",bodyRef:g,closeDisabled:h=!1,closeOnBackdrop:v=!0,closeOnEscape:f=!0,style:y,portal:b,zIndex:x,externalDialogSelector:k}=e,_=eJF(),w=dq("booking-dialog"),S=(0,eC.useRef)(null),j=(0,eC.useRef)(null),N=(0,eC.useRef)(i);N.current=()=>{h||i()};let C=(0,eC.useRef)(f);C.current=f;let M=!!d;if((0,eC.useEffect)(()=>{if(!s||!S.current||!j.current)return;let e=S.current,t=j.current,l=document.activeElement,i=(null==_?void 0:_.background)&&!_.background.contains(e)?_.background:null;if(eX8.length||(eX5=document.body.style.overflow,document.body.style.overflow="hidden"),i){let e=eX7.get(i)??{count:0,inert:i.inert};e.count++,eX7.set(i,e),i.inert=!0}let a=(null==_?void 0:_.presentationPlatform)==="kiosk"&&M&&"fullscreen"===m&&i&&i===_.root?function(e){var t,l;if("u"<typeof CSS||!(null==(t=(l=CSS).supports)?void 0:t.call(l,eX0,"hidden"))||!CSS.supports(eX2,"1px"))return()=>{};let i=Array.from(e.children).filter(e=>e.classList.contains("brand-scope"));if(1!==i.length||"http://www.w3.org/1999/xhtml"!==i[0].namespaceURI)return()=>{};let a=i[0],n=eXX.get(a);if(!n){let e=getComputedStyle(a);if("horizontal-tb"!==e.writingMode||"hidden"===e.contentVisibility||["paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"].some(t=>0!==parseFloat(e[t])))return()=>{};let t=a.offsetHeight;if(t<=0)return()=>{};n={count:0,height:`${t}px`,visibility:eX4(a.style,eX0),intrinsicSize:eX4(a.style,eX2)},eXX.set(a,n),a.style.setProperty(eX2,n.height,eX1),a.style.setProperty(eX0,"hidden",eX1)}n.count++;let r=n,o=!1;return()=>{o||(o=!0,0==--r.count&&(eX3(a.style,eX0,"hidden",r.visibility),eX3(a.style,eX2,r.height,r.intrinsicSize),eXX.delete(a)))}}(i):void 0;void 0!==x&&eX6.set(e,x),eX8.push(e),e0e();let n=e=>{if(!e.getClientRects().length||e.closest('[inert], [aria-hidden="true"]'))return!1;let t=window.getComputedStyle(e);return"hidden"!==t.visibility&&"none"!==t.display},r=e=>{let t=e,l=0;for(;t;){let e=parseInt(window.getComputedStyle(t).zIndex,10);Number.isFinite(e)&&(l=Math.max(l,e)),t=t.parentElement}return l},d=()=>{if(!k)return t;let l=Array.from(document.querySelectorAll(k)).filter(l=>!t.contains(l)&&n(l)&&r(l)>r(e)).sort((e,t)=>r(e)-r(t));return l[l.length-1]||t},c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d();return Array.from(e.querySelectorAll('button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), summary, a[href], [tabindex="0"]')).filter(e=>e.tabIndex>=0&&e.getClientRects().length>0&&!e.closest("[inert]"))},u=()=>{let e=d(),l=e===t&&o&&t.querySelector(o);e.hasAttribute("tabindex")||(e.tabIndex=-1),(l||c(e)[0]||e).focus({preventScroll:!0})},p=requestAnimationFrame(()=>{eX8[eX8.length-1]===e&&u()}),g=l=>{if(eX8[eX8.length-1]!==e)return;let i=d(),a=document.activeElement instanceof HTMLElement&&document.activeElement.closest(".ant-select-dropdown, .ant-picker-dropdown"),r="Escape"===l.key&&Array.from(document.querySelectorAll(".ant-select-dropdown, .ant-picker-dropdown")).some(e=>{if(!n(e))return!1;let t=e;for(;t;){let e=window.getComputedStyle(t);if("hidden"===e.visibility||"none"===e.display||"0"===e.opacity)return!1;t=t.parentElement}return!0});if(("Escape"!==l.key||!r)&&("Tab"!==l.key||!a)&&("Escape"===l.key&&i===t&&(l.preventDefault(),l.stopImmediatePropagation(),C.current&&N.current()),"Tab"===l.key)){let e=c(),t=e[0],a=e[e.length-1];if(!t){l.preventDefault(),i.focus();return}l.shiftKey&&(document.activeElement===t||!i.contains(document.activeElement))?(l.preventDefault(),null==a||a.focus()):l.shiftKey||document.activeElement!==a&&i.contains(document.activeElement)||(l.preventDefault(),t.focus())}},h=null,v=l=>{let i=l.target;i instanceof HTMLElement&&t.contains(i)&&(h=i),!(i instanceof HTMLElement&&i.closest(".ant-select-dropdown, .ant-picker-dropdown"))&&(eX8[eX8.length-1]!==e||d().contains(i)||u())},f=0,y=t,b=k?new MutationObserver(()=>{cancelAnimationFrame(f),f=requestAnimationFrame(()=>{if(eX8[eX8.length-1]!==e)return;let l=d();l===y||l.contains(document.activeElement)||(l===t&&(null==h?void 0:h.isConnected)&&n(h)?h.focus({preventScroll:!0}):u()),y=l})}):null;return null==b||b.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","aria-hidden"]}),document.addEventListener("keydown",g,!0),document.addEventListener("focusin",v),()=>{if(cancelAnimationFrame(p),cancelAnimationFrame(f),null==b||b.disconnect(),document.removeEventListener("keydown",g,!0),document.removeEventListener("focusin",v),eX8.splice(eX8.indexOf(e),1),eX6.delete(e),e0e(),eX8.length||(document.body.style.overflow=eX5),null==a||a(),i){let e=eX7.get(i);0==--e.count&&(i.inert=e.inert,eX7.delete(i))}(null==l?void 0:l.isConnected)&&!l.closest("[inert]")&&l.focus({preventScroll:!0})}},[s,null==_?void 0:_.portal,null==_?void 0:_.background,null==_?void 0:_.root,null==_?void 0:_.presentationPlatform,b,x,k,m,M]),"u"<typeof document||void 0===b&&_&&!_.portal)return null;let T=(0,eH.jsx)("div",{ref:S,hidden:!s,style:s?void 0:{display:"none"},className:`modal-backdrop ${"calendar-modal"===r?"calendar-backdrop":""}`,onMouseDown:e=>{v&&e.target===e.currentTarget&&eX8[eX8.length-1]===S.current&&N.current()},children:(0,eH.jsxs)("div",{ref:j,style:y,"data-booking-scroll-root":!0,className:`modal ${n?"wide":""} ${r} ${d?`dialog-framed dialog-${m}`:""}`,role:"dialog","aria-modal":"true","aria-labelledby":w,tabIndex:-1,children:[(0,eH.jsxs)("div",{className:"modal-heading",children:[(0,eH.jsx)("h2",{id:w,children:t}),(0,eH.jsx)(eXO,{type:"button",className:"icon-button","aria-label":a,disabled:h,onClick:()=>N.current(),children:(0,eH.jsx)(eXJ,{size:23})})]}),d?(0,eH.jsxs)(eH.Fragment,{children:[c&&(0,eH.jsx)("div",{className:"dialog-intro",children:c}),(0,eH.jsx)("div",{ref:g,className:`dialog-body ${u}`,tabIndex:0,role:"region","aria-labelledby":w,children:l}),(0,eH.jsx)("div",{className:`dialog-footer ${p}`,children:d})]}):l]})}),I=_&&(!1===b||null!=b&&b!==_.portal)?(0,eH.jsx)("div",{className:`booking-ui booking-ui-portals${"compact"===_.layout?" booking-ui-compact":""}`,"data-booking-scope":_.scopeId,"data-booking-presentation":_.presentationPlatform,lang:"zh"===_.lang?"zh-CN":"en-AU",style:_.brandTokens,children:T}):T;return!1===b?I:(0,oT.createPortal)(I,b??(null==_?void 0:_.portal)??document.body)}function e0l(e){let{current:t,steps:l,label:i,currentLabel:a,readOnly:n=!1}=e;return(0,eH.jsx)("nav",{"data-booking-sticky":!0,className:"booking-navigation","aria-label":i,children:(0,eH.jsx)("ol",{className:"steps interactive-steps",style:{"--step-count":Math.max(1,l.length),"--step-progress":l.length>1?Math.max(0,Math.min(t,l.length-1))/(l.length-1):0},children:l.map((e,l)=>{let i=l===t,r="skipped"===e.status&&!i,o="available"!==e.status;return(0,eH.jsx)("li",{className:`${i?"active":r?"skipped":l<t?"done":""} ${o&&!r?"locked":""}`,children:(0,eH.jsxs)("button",{type:"button","aria-label":e.ariaLabel??e.label,"aria-current":i?"step":void 0,disabled:n||o&&!i,title:i?a:e.hint,onClick:()=>{var t;i||o||null==(t=e.onClick)||t.call(e)},children:[(0,eH.jsx)("span",{className:"step-number","aria-hidden":"true",children:r?"–":l+1}),(0,eH.jsxs)("span",{className:"step-label",children:[o&&!r&&!i&&(0,eH.jsx)(eXq,{size:13,"aria-hidden":"true"}),(0,eH.jsx)("b",{className:"step-full-label",children:e.label}),(0,eH.jsx)("b",{className:"step-short-label",children:e.shortLabel??e.label})]})]})},e.id)})})})}function e0i(e){let{panel:t,title:l,closeLabel:i,header:a,body:n,footer:r,decoration:o}=e,s=eJF(),d=(0,eC.useRef)(null);(0,eC.useLayoutEffect)(()=>{let e=d.current;if(t.isMobile||!e)return;let l=0,i=()=>{let t=parseFloat(getComputedStyle(e).getPropertyValue("--summary-decoration-bleed"))||0,l=parseFloat(getComputedStyle(e).getPropertyValue("--summary-sticky-offset"))||22,i=Math.max(240,window.innerHeight-Math.max(l,e.getBoundingClientRect().top)-l-t),a=`${Math.floor(i)}px`;e.style.getPropertyValue("--summary-available-height")!==a&&e.style.setProperty("--summary-available-height",a)},a=()=>{cancelAnimationFrame(l),l=requestAnimationFrame(i)},n=new ResizeObserver(a);return n.observe(e),window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),i(),()=>{cancelAnimationFrame(l),n.disconnect(),window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[t.isMobile,null==s?void 0:s.design]);let c=(0,eH.jsxs)(eH.Fragment,{children:[a,(0,eH.jsx)("div",{className:"order-summary-scroll",tabIndex:0,role:"region","aria-label":l,children:n}),(0,eH.jsx)("div",{className:"order-summary-footer",children:r})]});return t.isMobile?(0,eH.jsx)(e0t,{title:l,open:t.open,onClose:t.close,closeLabel:i,className:"order-summary-sheet",zIndex:600,externalDialogSelector:eX9,children:c}):(0,eH.jsxs)("aside",{ref:d,className:"order-summary booking-order-summary",children:[(0,eH.jsx)("h2",{children:l}),c,o]})}function e0a(e){let{panel:t,title:l,label:i,total:a,count:n}=e;return(0,eH.jsx)("button",{type:"button",className:`order-panel-trigger ${void 0!==n?"has-count":""}`,"aria-label":`${l} \xb7 ${a}`,"aria-haspopup":"dialog","aria-expanded":t.open,onClick:t.show,children:void 0!==n?(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("span",{className:"summary-trigger-count","aria-hidden":"true",children:[(0,eH.jsx)(eXQ,{size:25}),(0,eH.jsx)("b",{children:n})]}),(0,eH.jsxs)("span",{className:"summary-trigger-content",children:[(0,eH.jsx)("strong",{children:a}),(0,eH.jsxs)("small",{children:[i,(0,eH.jsx)(eXH,{size:13,"aria-hidden":"true"})]})]})]}):(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("span",{children:[(0,eH.jsx)(eXQ,{size:16,"aria-hidden":"true"}),i,(0,eH.jsx)(eXH,{size:13,"aria-hidden":"true"})]}),(0,eH.jsx)("strong",{children:a})]})})}let e0n=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,28H188V24a12,12,0,0,0-24,0v4H92V24a12,12,0,0,0-24,0v4H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28ZM68,52a12,12,0,0,0,24,0h72a12,12,0,0,0,24,0h16V76H52V52ZM52,204V100H204V204Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,48V88H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z",opacity:"0.2"}),eC.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,48H48V48H72v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,34H182V24a6,6,0,0,0-12,0V34H86V24a6,6,0,0,0-12,0V34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H74V56a6,6,0,0,0,12,0V46h84V56a6,6,0,0,0,12,0V46h26a2,2,0,0,1,2,2V82H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V94H210V208A2,2,0,0,1,208,210Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,36H180V24a4,4,0,0,0-8,0V36H84V24a4,4,0,0,0-8,0V36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H76V56a4,4,0,0,0,8,0V44h88V56a4,4,0,0,0,8,0V44h28a4,4,0,0,1,4,4V84H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V92H212V208A4,4,0,0,1,208,212Z"}))]]),e0r=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e0n}));e0r.displayName="CalendarBlankIcon";let e0o=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M160,48V208L80,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z"}))]]),e0s=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e0o}));e0s.displayName="CaretLeftIcon";let e0d=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),eC.createElement("path",{d:"M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"}))]]),e0c=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e0d}));e0c.displayName="CaretRightIcon";let e0u="Australia/Sydney";function e0p(e){let t,l=Intl.Locale;try{var i,a;let n=l?new l(e):void 0;t=(null==n||null==(i=n.getWeekInfo)?void 0:i.call(n).firstDay)??(null==n||null==(a=n.weekInfo)?void 0:a.firstDay)}catch{}return void 0===t?+("en-US"!==e):t%7}function e0m(e){if("string"!=typeof e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T12:00:00Z`);return Number.isFinite(t.getTime())&&t.toISOString().slice(0,10)===e}function e0g(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e0u,l=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e);return["year","month","day"].map(e=>l.find(t=>t.type===e).value).join("-")}function e0h(e,t){let l=new Date(`${e}T12:00:00Z`);return l.setUTCDate(l.getUTCDate()+t),l.toISOString().slice(0,10)}function e0v(e,t){let l=new Date(`${e}T12:00:00Z`).getUTCDay();return e0h(e,-((l-t+7)%7))}function e0f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e0g(),l=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return e0m(e)&&e>=t&&(void 0===l||e<=l)&&!(null==i?void 0:i(e))}function e0y(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{weekday:"long",year:"numeric",month:"long",day:"numeric"};return new Intl.DateTimeFormat(t,{...l,timeZone:"UTC"}).format(new Date(`${e}T12:00:00Z`))}function e0b(e){let{locale:t,firstDay:l,today:i,month:a,selected:n,minDate:r,maxDate:o,viewEnd:s,disabled:d,allowed:c,onMonthChange:u,onSelect:p,t:m}=e,g=(0,eC.useRef)(null),h=(0,eC.useRef)(),[v,f]=(0,eC.useState)(n);(0,eC.useLayoutEffect)(()=>{var e;let t=null==(e=g.current)?void 0:e.querySelector(".venue-booking-picker-panel");t&&(t.tabIndex=-1)},[]);let y=(0,eC.useMemo)(()=>{let e=t.startsWith("zh"),i=e?ey4:ey3,a=`venue-booking-${e?"zh":"en"}-week-${l}`;return eS().locale({...e?QP():QD(),name:a,weekStart:l},void 0,!0),{...i,lang:{...i.lang,locale:a,shortWeekDays:Array.from({length:7},(e,l)=>e0y(e0h("2023-01-01",l),t,{weekday:"short"}))}}},[t,l]),b=eS()(a).locale(y.lang.locale),x=e=>e.slice(0,7)===a.slice(0,7),k=e=>x(e)&&c(e),_=r.slice(0,7),w=null==o?void 0:o.slice(0,7),S=e=>{d||e.slice(0,7)<_||w&&e.slice(0,7)>w||u(`${e.slice(0,7)}-01`)},j=e0v(a,l),N=Array.from({length:42},(e,t)=>e0h(j,t)).filter(x),C=N.includes(v)&&c(v)?v:N.includes(n)&&c(n)?n:N.find(c);(0,eC.useEffect)(()=>{var e,t;let l=h.current;if(!l||!N.includes(l))return;let i=c(l)?l:N.find(e=>e>=l&&c(e))||N.find(c);i&&(h.current=void 0,f(i),null==(t=g.current)||null==(e=t.querySelector(`[data-calendar-day="${i}"]`))||e.focus())});let M=Number(r.slice(0,4)),T=Array.from({length:Math.max(1,(o?Number(o.slice(0,4)):Math.max(M+10,Number(s.slice(0,4)),b.year()))-M+1)},(e,t)=>M+t);return(0,eH.jsx)("div",{ref:g,lang:t,onFocusCapture:e=>{var t,l;e.target.classList.contains("venue-booking-picker-panel")&&C&&(null==(l=g.current)||null==(t=l.querySelector(`[data-calendar-day="${C}"]`))||t.focus())},onKeyDownCapture:e=>{e.target.classList.contains("venue-booking-picker-panel")&&["Enter"," ","PageUp","PageDown","Home","End","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),e.stopPropagation())},children:(0,eH.jsx)(eT.ConfigProvider,{locale:{locale:t,Calendar:y},children:(0,eH.jsx)(eT.Calendar,{prefixCls:"venue-booking-picker",className:"venue-booking-calendar",fullscreen:!1,mode:"month",locale:y,value:b,disabledDate:e=>!k(e.format("YYYY-MM-DD")),onPanelChange:e=>S(e.format("YYYY-MM-DD")),onSelect:(e,t)=>{let l=e.format("YYYY-MM-DD");"date"===t.source&&k(l)&&p(l)},headerRender:()=>(0,eH.jsxs)("div",{className:"venue-booking-calendar-header",children:[(0,eH.jsx)("button",{type:"button",className:"icon-button","aria-label":m("previousMonth"),disabled:d||b.format("YYYY-MM")<=_,onClick:()=>S(b.subtract(1,"month").format("YYYY-MM-DD")),children:(0,eH.jsx)(e0s,{size:18,"aria-hidden":"true"})}),(0,eH.jsxs)("div",{className:"venue-booking-calendar-dropdowns",children:[(0,eH.jsx)("select",{"aria-label":m("calendarMonth"),value:b.month(),disabled:d,onChange:e=>S(b.month(Number(e.target.value)).format("YYYY-MM-DD")),children:Array.from({length:12},(e,l)=>{let i=b.month(l).format("YYYY-MM-DD");return(0,eH.jsx)("option",{value:l,disabled:i.slice(0,7)<_||!!(w&&i.slice(0,7)>w),children:e0y(i,t,{month:"long"})},l)})}),(0,eH.jsx)("select",{"aria-label":m("calendarYear"),value:b.year(),disabled:d,onChange:e=>{let t=b.year(Number(e.target.value)).format("YYYY-MM-DD");t.slice(0,7)<_&&(t=r),o&&t.slice(0,7)>w&&(t=o),S(t)},children:T.map(e=>(0,eH.jsx)("option",{value:e,children:e},e))})]}),(0,eH.jsx)("button",{type:"button",className:"icon-button","aria-label":m("nextMonth"),disabled:d||!!(w&&b.format("YYYY-MM")>=w),onClick:()=>S(b.add(1,"month").format("YYYY-MM-DD")),children:(0,eH.jsx)(e0c,{size:18,"aria-hidden":"true"})})]}),fullCellRender:e=>{let a=e.format("YYYY-MM-DD");if(!x(a))return null;let s=a===n;return(0,eH.jsx)("button",{type:"button","data-calendar-day":a,className:`venue-booking-calendar-day ${s?"is-selected":""} ${a===i?"is-today":""}`,disabled:!k(a),tabIndex:a===C?0:-1,"aria-label":e0y(a,t),"aria-pressed":s,"aria-current":a===i?"date":void 0,onFocus:()=>f(a),onKeyDown:t=>{if("Enter"===t.key||" "===t.key){t.preventDefault(),t.stopPropagation(),k(a)&&p(a);return}if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault(),t.stopPropagation();let l=e.add("PageUp"===t.key?-1:1,"month").format("YYYY-MM-DD");if(l<r||o&&l>o)return;h.current=l,f(l),S(l);return}let i={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,Home:-((e.day()-l+7)%7),End:6-(e.day()-l+7)%7};if(!(t.key in i))return;t.preventDefault(),t.stopPropagation();let n=e0h(a,i[t.key]),s=i[t.key]<0?-1:1;for(;N.includes(n)&&!c(n);)n=e0h(n,s);n===a||n<r||o&&n>o||(N.includes(n)||S(n),h.current=n,f(n))},children:e.date()})}})})})}function e0x(e){var t,l,i;let{value:a,onChange:n,locale:r,title:o,description:s,stepNumber:d,stepStatus:c,timeZone:u=e0u,todayMarker:p="venue",minDate:m,maxDate:g,isUnavailable:h,dateStates:v={},onVisibleDatesChange:f,onInteraction:y,disabled:b=!1,loading:x=!1,allowEmpty:k=!1,t:_}=e,w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e0u,t=()=>{let t=new Date;return{venue:e0g(t,e),device:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}},[l,i]=(0,eC.useState)(t);return(0,eC.useEffect)(()=>{let e=()=>{let e=t();i(t=>t.venue===e.venue&&t.device===e.device?t:e)};e();let l=window.setInterval(e,1e3);return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{clearInterval(l),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[e]),l}(u),S=w.venue,j="device"===p?w.device:S,N=m||S,C=e0h(e0m(a)&&a>N?a:N,180),[M,T]=(0,eC.useState)(C),I=g||(M>C?M:C),P=e=>{if(g)return;let t=e0h(e,180);T(e=>e>t?e:t)},A=e0p(r),D=(0,eC.useMemo)(()=>(function(e,t,l){let i=[];for(let a=e0v(e,l);a<=t;a=e0h(a,7))i.push(a);return i})(N,I,A),[N,I,A]),E=e0v(e0m(a)?a:S,A),O=Math.max(0,Math.min(D.length-1,D.findIndex(e=>e===E))),[z,L]=(0,eC.useState)(O),R=Math.max(0,Math.min(z,D.length-1)),$=(0,eC.useRef)(R);$.current=R;let[F,q]=(0,eC.useState)(!1),[B,H]=(0,eC.useState)(()=>(e0m(a)?a:S).slice(0,7)+"-01"),[V,U]=(0,eC.useState)(a),Y=(0,eC.useRef)(null),W=(0,eC.useRef)(void 0),K=(0,eC.useRef)(null),G=(0,eC.useRef)(0),Q=(0,eC.useRef)(),Z=dq("booking-date-title"),J=dq("booking-date-description"),X=dq("booking-date-error"),ee=D[R]||e0v(N,A);(0,eC.useEffect)(()=>{!g&&R>=D.length-4&&P(I)},[g,R,D.length,I]);let et=(0,eC.useMemo)(()=>{let e;if(F){let t=`${B.slice(0,7)}-01`;e=Array.from({length:31},(e,l)=>e0h(t,l)).filter(e=>e.slice(0,7)===B.slice(0,7))}else e=Array.from({length:7},(e,t)=>e0h(ee,t)),e0m(a)&&e.push(a);return Array.from(new Set(e)).filter(e=>e>=N&&(void 0===g||e<=g)).sort()},[ee,F,B,u,A,a,N,g]),el=et.join(","),ei=(0,eC.useRef)(f);ei.current=f,(0,eC.useEffect)(()=>{var e;null==(e=ei.current)||e.call(ei,et)},[el]);let ea=x||et.some(e=>!v[e]||"loading"===v[e].status),en=et.some(e=>{var t;return(null==(t=v[e])?void 0:t.status)==="error"}),er=new Map,eo=e=>{var t,l;return er.has(e)||er.set(e,!b&&!x&&((null==(t=v[e])?void 0:t.status)==="available"||(null==(l=v[e])?void 0:l.status)==="configuration")&&e0f(e,N,g,h)),er.get(e)};(0,eC.useEffect)(()=>{let e=Q.current;if(!e||b||x||!v[e]||"loading"===v[e].status)return;let t=Array.from({length:7},(e,t)=>e0h(ee,t));if(!t.includes(e)){Q.current=void 0;return}let l=eo(e)?e:t.find(eo);if(!(!l&&t.some(e=>e>=N&&(void 0===g||e<=g)&&(!v[e]||"loading"===v[e].status)))&&(Q.current=void 0,l)){var i,a;U(l),null==(a=Y.current)||null==(i=a.querySelector(`[data-booking-day="${l}"]`))||i.focus({preventScroll:!0})}},[v,ee,b,x,h,N,g]);let es=x||!v[a]||"loading"===v[a].status,ed=!x&&!(k&&!a)&&(!e0f(a,N,g)||!es&&((null==(t=v[a])?void 0:t.status)==="unavailable"||((null==(l=v[a])?void 0:l.status)==="available"||(null==(i=v[a])?void 0:i.status)==="configuration")&&(null==h?void 0:h(a)))),ec=e=>Math.floor((new Date(`${e}T12:00:00Z`).getTime()-new Date(`${D[0]||e0v(N,A)}T12:00:00Z`).getTime())/6048e5),eu=function(e){var t;let l=!(arguments.length>1)||void 0===arguments[1]||arguments[1];e=Math.max(0,g?Math.min(D.length-1,e):e),!g&&e>=D.length-4&&P(e0h(D[0]||e0v(N,A),7*e+6)),$.current=e,L(e),null==(t=Y.current)||t.scrollTo({left:e*Y.current.clientWidth,behavior:l&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches?"smooth":"instant"})};(0,eC.useLayoutEffect)(()=>{eu(O,!1),U(a)},[a,N,g,A]),(0,eC.useLayoutEffect)(()=>{var e;null==(e=Y.current)||e.scrollTo({left:$.current*Y.current.clientWidth,behavior:"instant"})},[D.length]),(0,eC.useEffect)(()=>{let e=Y.current;if(!e)return;let t=new ResizeObserver(()=>e.scrollTo({left:$.current*e.clientWidth,behavior:"instant"}));return t.observe(e),()=>t.disconnect()},[]),(0,eC.useEffect)(()=>()=>clearTimeout(W.current),[]);let ep=e=>{eo(e)&&(null==y||y(),Q.current=void 0,n(e),eu(ec(e),!1),U(e),q(!1))},em=e0m(a)?e0y(a,r,{day:"numeric",month:"short",year:"numeric"}):_("chooseDate"),eg=e=>e0y(ee,r,{month:e?"short":"long",year:"numeric"}),eh=()=>{let e=K.current,t=Y.current;if(K.current=null,!(null==e?void 0:e.dragging)||!t)return;G.current=Date.now()+300,t.style.scrollSnapType="",t.hasPointerCapture(e.id)&&t.releasePointerCapture(e.id);let l=t.scrollLeft-e.scroll;eu(Math.abs(l)>40?Math.round(e.scroll/t.clientWidth)+Math.sign(l):Math.round(t.scrollLeft/t.clientWidth))};return(0,eH.jsxs)("div",{className:"booking-date-picker",role:"group","aria-labelledby":Z,"aria-disabled":b||void 0,"aria-busy":ea||void 0,children:[(0,eH.jsxs)("div",{className:"booking-date-heading",children:[(0,eH.jsxs)("div",{className:"booking-date-copy",children:[void 0===d?(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("span",{className:"booking-date-icon","aria-hidden":"true",children:(0,eH.jsx)(e0r,{size:17,weight:"bold"})}),(0,eH.jsx)("strong",{id:Z,children:o})]}):(0,eH.jsxs)("h3",{className:"booking-substep-title",id:Z,children:[c?(0,eH.jsx)(eXC,{number:d,state:c,lang:r.startsWith("zh")?"zh":"en",className:"booking-substep-number"}):(0,eH.jsx)("span",{className:"booking-substep-number",children:d}),o]}),s&&(0,eH.jsx)("p",{className:"sr-only",id:J,children:s})]}),(0,eH.jsxs)("div",{className:"booking-date-controls",children:[(0,eH.jsxs)("button",{type:"button",className:"calendar-trigger","aria-haspopup":"dialog","aria-expanded":F,disabled:b,"aria-label":`${_("openCalendar")}: ${em}`,title:`${_("openCalendar")}: ${em}`,"aria-invalid":ed||void 0,"aria-describedby":ed?X:s?J:void 0,onClick:()=>{null==y||y();let e=e0m(a)&&a>=N&&(void 0===g||a<=g)?a:N;H(`${e.slice(0,7)}-01`),P(e),q(!0)},children:[(0,eH.jsx)("span",{className:"calendar-caption-full",children:eg(!1)}),(0,eH.jsx)("span",{className:"calendar-caption-short",children:eg(!0)}),(0,eH.jsx)(e0r,{size:16,"aria-hidden":"true"})]}),(0,eH.jsxs)("div",{className:"booking-week-arrows",children:[(0,eH.jsx)("button",{type:"button",className:"icon-button","aria-label":_("previousWeek"),disabled:b||0===R,onClick:()=>{null==y||y(),eu(R-1)},children:(0,eH.jsx)(e0s,{size:16})}),(0,eH.jsx)("button",{type:"button",className:"icon-button","aria-label":_("nextWeek"),disabled:b||void 0!==g&&R===D.length-1,onClick:()=>{null==y||y(),eu(R+1)},children:(0,eH.jsx)(e0c,{size:16})})]})]})]}),(0,eH.jsx)("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e0g(),i=e0h(e,6),a=new Intl.DateTimeFormat(t,{day:"numeric",month:"short",...e.slice(0,4)!==l.slice(0,4)||e.slice(0,4)!==i.slice(0,4)?{year:"numeric"}:{},timeZone:"UTC"}),n=new Date(`${e}T12:00:00Z`),r=new Date(`${i}T12:00:00Z`);return a.formatRange?a.formatRange(n,r):`${a.format(n)} – ${a.format(r)}`}(ee,r,S)}),(0,eH.jsx)("div",{ref:Y,className:"booking-week-track","aria-label":_("quickVisitDates"),onScroll:()=>{clearTimeout(W.current),W.current=setTimeout(()=>{var e;(null==(e=K.current)?void 0:e.dragging)||!Y.current||L(Math.round(Y.current.scrollLeft/Y.current.clientWidth))},120)},onPointerDown:e=>{b||("mouse"!==e.pointerType&&(null==y||y()),"mouse"===e.pointerType&&0===e.button&&(K.current={id:e.pointerId,x:e.clientX,scroll:e.currentTarget.scrollLeft,dragging:!1}))},onPointerMove:e=>{let t=K.current;t&&(!t.dragging&&Math.abs(e.clientX-t.x)>8&&(null==y||y(),t.dragging=!0,e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.style.scrollSnapType="none"),t.dragging&&(e.preventDefault(),e.currentTarget.scrollLeft=t.scroll-(e.clientX-t.x)))},onPointerUp:eh,onWheel:e=>{!b&&(0!==e.deltaX||e.shiftKey&&0!==e.deltaY)&&(null==y||y())},onPointerCancel:eh,onLostPointerCapture:eh,onPointerLeave:()=>{var e;(null==(e=K.current)?void 0:e.dragging)||(K.current=null)},onClickCapture:e=>{Date.now()<G.current&&(e.preventDefault(),e.stopPropagation())},children:D.map((e,t)=>{if(Math.abs(t-R)>1)return(0,eH.jsx)("div",{className:"booking-week",ref:e=>{null==e||e.setAttribute("inert","")},"aria-hidden":"true"},e);let l=Array.from({length:7},(t,l)=>e0h(e,l)),i=l.includes(V)&&eo(V)?V:l.includes(a)&&eo(a)?a:l.find(eo);return(0,eH.jsx)("div",{className:"booking-week",ref:e=>{null==e||e.toggleAttribute("inert",t!==R)},"aria-hidden":t!==R||void 0,children:l.map(e=>{var n;return(0,eH.jsxs)("button",{type:"button","data-booking-day":e,className:`booking-day ${e===a?"is-selected":""} ${e===j?"is-today":""}`,disabled:!eo(e),"aria-busy":x||!v[e]||"loading"===v[e].status||void 0,title:null==(n=v[e])?void 0:n.reason,"aria-label":e0y(e,r),"aria-pressed":e===a,"aria-current":e===j?"date":void 0,tabIndex:t===R&&e===i?0:-1,onClick:()=>ep(e),onFocus:()=>U(e),onKeyDown:t=>{let i={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,Home:-1*l.indexOf(e),End:6-l.indexOf(e)};if(!(t.key in i))return;t.preventDefault(),null==y||y();let a=e0h(e,i[t.key]),n=i[t.key]<0?-1:1;for(;a>=N&&(void 0===g||a<=g)&&!eo(a);){if(!v[a]||"loading"===v[a].status){Q.current=a,eu(ec(a),!1),U(a);return}a=e0h(a,n)}eo(a)&&(eu(ec(a),!1),U(a),requestAnimationFrame(()=>{var e,t;return null==(t=Y.current)||null==(e=t.querySelector(`[data-booking-day="${a}"]`))?void 0:e.focus({preventScroll:!0})}))},children:[(0,eH.jsx)("small",{children:e===j?_("calendarToday"):e0y(e,r,{weekday:"short"})}),(0,eH.jsxs)("span",{className:"booking-day-date",children:[(0,eH.jsx)("span",{className:"booking-day-date-full",children:e0y(e,r,{day:"numeric",month:"short"})}),(0,eH.jsx)("span",{className:"booking-day-date-short",children:r.startsWith("zh")?e.slice(0,7)===ee.slice(0,7)?e0y(e,r,{day:"numeric"}):`${Number(e.slice(5,7))}/${Number(e.slice(-2))}`:e0y(e,r,{day:"numeric",month:"short"})})]})]},e)})},e)})}),ee!==e0v(S,A)&&(0,eH.jsx)("div",{className:"booking-week-return",children:(0,eH.jsx)("button",{type:"button",className:"back-this-week",disabled:b,onClick:()=>{null==y||y(),eu(ec(S))},children:_("backThisWeek")})}),ed&&(0,eH.jsx)("p",{id:X,className:"booking-date-error",role:"alert",children:_("dateNeedsReselect")}),en&&(0,eH.jsx)("p",{className:"booking-date-error",role:"alert",children:_("calendarLoadFailed")}),F&&(0,eH.jsxs)(e0t,{title:_("chooseVisitDate"),closeLabel:_("closeCalendar"),className:"calendar-modal",initialFocus:'.venue-booking-calendar-day[tabindex="0"]',onClose:()=>q(!1),children:[(0,eH.jsx)(e0b,{locale:r,firstDay:A,today:j,month:B,onMonthChange:e=>{b||(null==y||y(),P(e),H(e))},selected:a,onSelect:ep,allowed:eo,disabled:b,minDate:N,maxDate:g,viewEnd:I,t:_}),(0,eH.jsxs)("div",{className:"calendar-panel-footer",children:[(0,eH.jsx)("span",{role:ea||en?"status":void 0,children:ea?_("calendarLoading"):en?_("calendarLoadFailed"):_("calendarVenueTime")}),(0,eH.jsx)("button",{type:"button",className:"text-link",disabled:b||S<N||void 0!==g&&S>g,onClick:()=>{null==y||y(),H(`${S.slice(0,7)}-01`)},children:_("calendarThisMonth")})]})]})]})}let e0k={unavailableProductAction:["Unavailable","不可预约"],timeMaximumCapacity:["Maximum capacity: {count}","最大容量:{count}"],timeRoomsLeft:["Rooms left: {count}","剩余房间:{count}"],timeSpacesLeft:["Spaces left: {count}","剩余名额:{count}"],capacityAvailable:["Available","可预约"],capacityLimited:["Limited availability","剩余量有限"],updatingQuote:["Updating price…","正在更新报价…"],selected:["Selected","已选"],extras:["Extras","附加商品"],navExtras:["Extras","附加商品"],nextExtras:["Continue: extras","继续:附加商品"],skipExtras:["Skip extras and continue","不加购,继续下一步"],editExtras:["Review extras","修改附加商品"],unavailableExtra:["Unavailable extra","已下架附加商品"],extraUnavailable:["Some extras are unavailable. Remove them or adjust their quantity to continue.","部分附加商品已不可购买,请移除或调整数量后继续。"],selectedTickets:["{count} tickets selected","已选 {count} 张"],selectedTicketCorner:["Selected {count}","已选 {count} 张"],fullProductInfo:["View details","查看详情"],walletPassTitle:["Wallet Pass","卡券/通票"],walletPassLogin:["Sign in to view your passes","登录查看可用卡券/通票"],walletPassUnsupported:["Wallet Pass is not available for this booking.","此预约暂不支持卡券/通票。"],walletPassLoading:["Loading your passes…","正在读取卡券/通票…"],walletPassLoadFailed:["Your passes could not be loaded. Please try again.","卡券/通票加载失败,请重试。"],walletPassEmpty:["You have no passes for this booking.","此预约暂无可用卡券/通票。"],walletPassUses:["{count} visits remaining","剩余 {count} 次"],walletPassUnavailable:["This pass cannot be used for the current booking. Remove it or choose another.","此卡券/通票不适用于当前预约,请移除或重新选择。"],walletPassRemove:["Remove selected pass","移除已选卡券/通票"],walletPassApplied:["Pass applied","已使用卡券/通票"],benefitsTitle:["Use offers","使用优惠"],benefitsSaved:["Saved {amount}","已优惠 {amount}"],benefitsUpdating:["Updating savings…","优惠计算中…"],benefitsAttention:["Review offers","优惠需处理"],benefitsDone:["Done","完成"],benefitsNoOffers:["You have no offers available. You can still enter a promo code.","暂无账号优惠券,你仍可输入优惠码。"],benefitsQuoteFailed:["We couldn’t update your total. Close this panel and retry the quote on the checkout page.","订单金额更新失败,请关闭弹窗,在结账页重试报价。"],redemptionCodes:["Admission codes","入场核销码"],redemptionCode:["Admission code","核销码"],redemptionUnavailable:["Your admission code is not available yet. Check your booking details or contact the venue.","暂未取得核销码,请查看订单详情或联系场馆。"],redemptionUsed:["Already redeemed","已核销"],redemptionExpired:["Expired","已过期"],redemptionVoid:["No longer valid","已失效"],showRedemption:["Show this code when you arrive.","到场时请出示此码。"],demoRedemption:["Demo code \xb7 not valid for real admission","演示核销码 \xb7 不可用于真实入场"],chooseResourceTitle:["Choose a play space","选择场地"],chooseResource:["Choose a play space to continue.","请选择场地后继续。"],resourceChanged:["Your saved play space is no longer offered. Confirm the available space to choose a new time.","原选场地已不再提供,请确认当前可用场地后重新选择时间。"],useResource:["Use {name}","使用{name}"],chooseResourceRights:["Your choice of play space","自选游玩场地"],resourceAdmission:["Play space admission","场地入场"],resourceAvailable:["Available times","有可预约时间"],resourceRemaining:["{count} places left","剩余 {count} 人名额"],resourcePeople:["Up to {count} people","最多 {count} 人"],resourceInsufficient:["Only {count} places left \xb7 reduce quantity","仅剩 {count} 人名额,请减少数量"],resourceFull:["Fully booked","已约满"],resourceNotOpen:["Not open for bookings","未开放预约"],resourceTimeUnavailable:["Unavailable at this time","该时间不可预约"],resourceLoadFailed:["Some play spaces could not be checked. Try again, or choose an available space.","部分场地查询失败,请重试或选择其他可预约场地。"],resourceCapacity:["There are not enough places for this group. Choose another space or time, or reduce the quantity.","该场地在此时间的名额不足,请更换场地、时间或减少数量。"],payNow:["Pay now","立即付款"],paymentRecoveryHint:["Your choices are saved. Check the payment status before trying again.","已保存您的选择,请查询付款状态后再操作。"],openCalendar:["Open calendar","打开日历"],closeCalendar:["Close calendar","关闭日历"],chooseVisitDate:["Choose your visit date","选择游玩日期"],chooseDate:["Choose a date","选择日期"],previousWeek:["Previous week","上一周"],nextWeek:["Next week","下一周"],backThisWeek:["This week","回到本周"],calendarToday:["Today","今天"],previousMonth:["Previous month","上个月"],nextMonth:["Next month","下个月"],calendarMonth:["Month","月份"],calendarYear:["Year","年份"],calendarThisMonth:["This month","回到本月"],calendarVenueTime:["Dates follow venue local time","日期按场馆当地时间"],dateNeedsReselect:["This date is no longer available. Please choose an available date.","此日期已不可预约,请重新选择可用日期。"],validPlayTime:["Your playtime","游玩有效时间"],playStartTime:["Start playing at","开始游玩时间"],timeNotSelected:["Not selected","待选择"],timeLoading:["Updating…","更新中…"],timeLoadFailed:["Load failed","加载失败"],timeUnavailable:["Unavailable","暂无时段"],timeNeedsDate:["Choose today","请选择今天"],immediateTimeHint:["Your start time is recorded when you add this ticket.","开始时间以加入订单时为准。"],closesAt:["Closes","闭馆"],startUnavailable:["This start time is unavailable. Choose a listed time or another date.","此开始时间不可预约,请选择可用时间或更换日期。"],noPlayTimes:["No available playtime","当日暂无可预约时间"],tryAnotherDate:["Try another date; available times depend on this ticket and its play areas.","请更换日期;可预约时间以本票及所含区域的安排为准。"],otherTimes:["View unavailable sessions","查看不可预约场次"],untilClosing:["Until closing","至闭馆"],duringOpening:["During opening hours","营业时间内有效"],todayOnlyTime:["This ticket starts now","本票从当前时间开始"],todayOnlyTimeHint:["Choose today to book immediate entry. Future dates need a ticket with a scheduled start.","即入门票仅支持当天,请选择今天;其他日期请选择可预约开始时间的门票。"],useToday:["Use today for this ticket","此门票改为今天"],timeRuleChanged:["The time rules have changed. Edit this ticket to review and confirm its new validity.","时间规则已变更,请修改此门票,重新核对并确认有效时间。"],timeUpdated:["The available time has changed. Check the time shown before adding.","可用时间已更新,请核对上方有效时间后添加。"],timeConfigTitle:["Ticket & resource time rules","门票与资源时间配置"],timeConfigHint:["Local demo settings. Ticket names do not determine validity; these rules do. Existing tickets keep their recorded time and may need editing after a rule change.","本地演示配置。商品标题不决定权益,实际有效时间由以下规则控制。修改规则后,已选票保留原时间,可能需要重新编辑确认。"],productTimeRules:["Ticket time rule","门票时间规则"],configureProduct:["Ticket product","配置门票"],timeMode:["Validity rule","有效时间规则"],modeFixed:["Fixed sessions","固定时间段"],modeDuration:["Fixed duration \xb7 flexible start","固定时长 \xb7 灵活开始"],modeAllDay:["Opening-hours window","全天 \xb7 营业时间范围"],modeUntilClose:["Choose a start \xb7 until closing","选择开始时间 \xb7 至闭馆"],customerChoosesStart:["Ask the guest to choose a start time","需要客人选择开始时间"],customerStartHint:["The selected time becomes the ticket’s actual validity start. With this off, opening-hours tickets use the full window; fixed-duration tickets start now and are today-only.","开启后,所选时间就是门票实际生效时间。关闭时,全天规则使用完整营业时间;固定时长规则从当前时间开始,仅支持当天。"],configuredDuration:["Play duration (minutes)","游玩时长(分钟)"],startInterval:["Start time increment","开始时间间隔"],fixedStarts:["Session starts (comma-separated)","固定场次开始时间(逗号分隔)"],resourceTimeRules:["Resource opening hours","资源营业时间"],configureResource:["Resource","配置资源"],venueResource:["Venue / lobby","场馆/大厅"],opensAt:["Opens","开门"],resourceInterval:["Resource start increment","资源开始时间间隔"],resourceTimeHint:["A ticket must fit within the venue and every included area’s hours. Time increments must also satisfy each resource.","门票时间需同时满足场馆及所有绑定区域的营业时间和开始间隔。"],applyTimeRules:["Save time rules","保存时间配置"],resetTimeRules:["Restore default time rules","恢复默认时间规则"],timeRulesSaved:["Time rules saved. Review any existing tickets before payment.","时间配置已保存;付款前请核对已有门票的有效时间。"],invalidTimeConfig:["Enter valid opening hours and session times.","请填写有效的营业时间和场次时间。"],book:["Book a play session","预约欢乐时光"],basket:["My order","我的订单"],plan:["Choose tickets","选择门票"],details:["Participants","参加者信息"],confirm:["Review & pay","确认并支付"],booked:["You’re booked","预约成功"],bookingNavigation:["Booking steps","预约步骤导航"],navPlan:["Tickets","选择门票"],navDetails:["Details","参加者"],navReview:["Review","确认支付"],currentStep:["Current step","当前步骤"],jumpToStep:["Click a step to go back or continue.","点击已解锁的步骤,可快捷切换或返回修改。"],addTicketsFirst:["Add tickets to unlock the next steps.","先添加门票,解锁后续步骤。"],previousStep:["Back","上一步"],nextStep:["Next","下一步"],nextDetails:["Next: participants","下一步:参加者信息"],nextReview:["Next: review & pay","下一步:确认与支付"],participantsNotRequired:["Not required for these tickets","所选门票无需填写参加者"],heroTitle:["A little play.\nA big day.","小小玩乐,\n大大快乐。"],heroSub:["Find their perfect ticket to a happy day.","选一张心仪的门票,开启孩子的快乐天地。"],homeEyebrow:["SYDNEY’S LITTLE HAPPY PLACE","悉尼的亲子欢乐天地"],homeTitle:["Big smiles.\nLittle adventures.","小小冒险,\n满满笑容。"],homeSub:["A world of bouncing, climbing and make-believe. Make a little time for a whole lot of happy.","蹦跳、攀爬、天马行空的想象。留一点时间,收获一整天的快乐。"],explore:["Find their happy place","发现孩子的快乐天地"],exploreSub:["Three ways to play. A thousand reasons to smile.","三种游玩方式,无数个开心的理由。"],viewArea:["Find tickets","查看相关门票"],safe:["Little people. Big peace of mind.","孩子玩得开心,家长更安心。"],timed:["Your time to play","专属游玩时间"],family:["Made for families","为亲子家庭设计"],ready:["Ready, set, happy.","准备好,一起快乐出发。"],readySub:["Arrive 15 minutes early. Bring comfy clothes and your biggest smile.","建议提前 15 分钟到场,穿上舒适衣服,带上开心的笑容。"],previous:["Previous","上一页"],next:["Next","下一页"],today:["Today","今天"],soldOut:["Sold out","已售罄"],notOpen:["Unavailable","不可预约"],minutes:["minutes of happy","分钟欢乐时光"],sydneyTime:["All times are venue local time","所有时间均为场馆当地时间"],updateBasket:["Save changes","保存修改"],total:["Total","合计"],subtotal:["Subtotal","小计"],discount:["Discount","优惠"],chooseSession:["Choose your session","选择场次"],selectTickets:["Choose at least one ticket.","请至少选择一张票。"],capacity:["There aren’t enough spots for these tickets. Choose another time or reduce the quantity.","本场次余位不足,请更换时段或减少票数。"],added:["A little happy, added to your basket.","欢乐已加入购物车。"],saved:["Your session has been updated.","场次已更新。"],edit:["Edit","修改"],remove:["Remove","删除"],undo:["Undo","撤销"],removed:["Ticket removed.","门票已删除。"],groupRemoved:["Tickets removed.","门票已删除。"],emptyTitle:["A little empty. For now.","还空着,等你添点快乐。"],emptySub:["Your next happy day starts with a ticket.","下一段欢乐时光,从选择一张门票开始。"],tickets:["tickets","张票"],ticket:["Ticket","门票"],childPending:["Child details to add","待补充儿童信息"],notes:["Anything we should know?","有什么需要我们留意?"],optional:["Optional","选填"],notesHint:["Add a note for our team…","给场馆团队留言…"],notesHelp:["Requests are subject to confirmation. Please don’t include sensitive information.","特殊需求以场馆确认为准,请勿填写敏感信息。"],promo:["A little treat?","让快乐再优惠一点"],promoHint:["Enter a promo code","输入优惠码"],apply:["Apply","使用"],couponApplied:["Promo code applied.","优惠码已使用。"],couponInvalid:["We couldn’t find that code. Try HAPPY10.","没有找到该优惠码,请试试 HAPPY10。"],couponExpired:["This offer has expired. Remove it or choose another.","该优惠已过期,请移除或更换。"],couponMinimum:["PLAY5 needs a ticket subtotal of A$50.","PLAY5 需门票小计达到 A$50。"],accountOffers:["Your offers","你的优惠券"],offer10:["10% off your play day","游玩订单享九折"],offer5:["A$5 off orders of A$50+","满 A$50 减 A$5"],offerLittle:["A$5 off the Little Explorers toddler ticket","小小探索家幼儿单区票减 A$5"],offerHint:["One offer per order. Rechecked when your basket changes.","每单限用一张优惠券,购物车变化后重新计算。"],loginOffers:["Sign in to see your offers","登录查看你的优惠券"],checkout:["Continue to checkout","前往结算"],loginTitle:["Welcome to the sunny side.","欢迎来到欢乐的一边。"],loginSub:["Sign in to keep your little explorers and bookings together.","登录后可管理儿童档案与预约。"],demoLogin:["Demo sign-in","演示登录"],demoLoginHint:["This prototype uses a demo account. No email is sent and no password is needed.","此原型使用演示账号,不会发送邮件,也无需真实密码。"],email:["Email address","电子邮箱"],signIn:["Continue with demo account","使用演示账号继续"],signingIn:["Signing in…","正在登录…"],close:["Close","关闭"],hello:["Hi, Alex","你好,Alex"],signOut:["Sign out","退出登录"],loginRequired:["Sign in to add participant details.","登录后即可填写参加者信息。"],detailsTitle:["Meet the little adventurers.","认识今天的小小冒险家。"],detailsSub:["Match each child ticket to its explorer. Adults don’t need a profile.","为每张儿童票选择参加者,成人票无需儿童档案。"],completed:["complete","已完成"],chooseChild:["Choose a child","选择儿童"],addChild:["Add a child","新增儿童"],newChild:["A new little explorer","新增小小探索家"],childName:["Child’s name","儿童姓名"],dob:["Date of birth","出生日期"],dobHelp:["Age on the visit date is used for guidance only. It will not prevent a booking.","游玩当日年龄仅用于建议提示,不影响购买。"],saveChild:["Save child","保存儿童信息"],childConsent:["Saved for reuse across your bookings.","保存到此演示账号,可在不同场次复用。"],invalidDob:["Enter a valid date of birth, no later than today.","请输入有效出生日期,不能晚于今天。"],nameRequired:["Please enter a name.","请填写姓名。"],emailInvalid:["Enter a valid email address.","请输入有效邮箱。"],childMissing:["Choose a child for this ticket.","请为这张票选择儿童。"],duplicateChild:["This child already has a ticket for this session.","该儿童已绑定此场次的另一张门票。"],invalidTicket:["This ticket is not available in this area.","此票种不适用于当前区域。"],contact:["Who can we get in touch with?","我们可以联系谁?"],phone:["Phone number","联系电话"],review:["Review your booking","确认预约信息"],checkDetails:["A few details need your attention.","还有一些信息需要处理。"],agreement:["Area agreement","区域协议"],confirmAgreement:["Confirm","确认"],accepted:["Agreed","已同意"],notAccepted:["Needs your agreement","待确认协议"],agreementRequired:["Please agree to this area’s current agreement.","请阅读并同意当前版本协议。"],version:["Version","版本"],demoAgreement:["Demo terms for this prototype. Not a legal waiver.","此为原型演示条款,不构成法律责任豁免。"],pay:["Pay","支付"],demoPay:["Simulate payment","模拟付款"],demoPayShort:["Demo pay","模拟付款"],demoPayHint:["Demo checkout \xb7 No real payment or reservation is made.","演示结算 \xb7 不会真实扣款或预订。"],processing:["Checking your booking…","正在检查预约…"],priceChanged:["The ticket price changed. We’ve updated your total. Review it and submit again to confirm.","票价发生变化,已更新总额。请确认新金额后再次提交。"],unavailable:["This session no longer has enough spots. Edit or remove it to continue.","该场次余位已不足,请修改或删除后继续。"],emptyCart:["Your basket is empty.","购物车为空。"],loadError:["We couldn’t load playtimes. Your choices are saved.","暂时无法加载时段,已保留你的选择。"],retry:["Try again","重试"],paymentFailed:["Payment was declined. Your basket is saved. You can try again.","付款未通过,购物车已保留,可以重试。"],paymentPending:["We’re checking your payment.","正在确认付款结果。"],pendingSub:["Your booking is not confirmed yet. Please don’t submit another payment.","预约尚未确认,请勿重复支付。"],checkPayment:["Check payment status","查询付款状态"],successTitle:["Here comes a happy day!","欢乐的一天,要来啦!"],successSub:["Your booking is confirmed. We can’t wait to see those smiles.","预约已确认,期待一起创造快乐回忆。"],bookingRef:["Booking reference","预约编号"],itinerary:["Your play-day plan","你的游玩行程"],download:["Download booking","下载预约凭证"],bookMore:["Plan another happy day","再安排一段欢乐"],bookingDetails:["Booking details","预约详情"],noBooking:["No booking to show yet.","暂时没有预约记录。"],arrival:["A little before you arrive","出发前的小提醒"],arrivalText:["Arrive 15 minutes early. Wear comfortable clothes. Check your area agreement for equipment requirements.","建议提前 15 分钟到场,穿着舒适衣物,装备要求请查看对应区域协议。"],confirmationEmail:["Booking contact","预约联系人"],orderNote:["Your note","订单备注"],date:["Date","日期"],time:["Time","时间"],area:["Play area","游玩区域"],payment:["Payment","付款"],confirmed:["Confirmed","已确认"],demo:["Prototype","交互原型"],demoControls:["Demo scenarios","演示场景"],demoTitle:["Test a different kind of day.","试试不同的预约情况。"],demoSub:["These controls only affect this local prototype. Your basket is kept when switching scenarios.","这些控制仅影响本地原型,切换场景会保留购物车。"],normal:["Normal booking","正常预约"],soldOutScenario:["11:30 sells out \xb7 selectable spaces fully booked","11:30 场次售罄 \xb7 可选场地全部满员"],priceChangeScenario:["Price rises A$2 per ticket at payment","提交时每张票涨价 A$2"],expiredCouponScenario:["Coupons expire","优惠券过期"],loadErrorScenario:["Playtime loading fails once","首次时段加载失败"],paymentFailScenario:["First payment fails","首次付款失败"],paymentPendingScenario:["Payment awaits confirmation","付款结果待确认"],singleAreaScenario:["Only one ticket available","只有一种可售门票"],reset:["Reset demo data","重置演示数据"],resetHint:["Clears this demo basket, profiles and booking.","清除演示购物车、档案与预约。"],backPlan:["Back to tickets","返回选票"],footerNote:["A little play goes a long way.","小小玩乐,收获满满。"],demoFooter:["Interactive prototype \xb7 Sydney \xb7 AUD","交互原型 \xb7 悉尼 \xb7 澳元"],loading:["Finding your happy time…","正在寻找欢乐时段…"],session:["session","个场次"],sessions:["sessions","个场次"],learnMore:["Plan your visit","到访须知"],age:["years old on visit date","岁(游玩当日)"],noChildNeeded:["No child details required","无需儿童信息"],allAccess:["All areas included","全区域通玩"],lobbyOnly:["Lobby admission","仅大厅入场"],singleAreaTicket:["One play area included","包含一个游玩区域"],noPlayAreas:["Lobby only \xb7 No play areas included","仅大厅入场,不含游玩区域"],suggestedAge:["Suggested ages","建议年龄"],minuteUnit:["minutes","分钟"],perPerson:["per person","/人"],visitDate:["Visit date","游玩日期"],quantity:["Number of tickets","门票数量"],chooseRemoval:["Choose the participant ticket to remove.","请选择要移除的参加者门票。"],addTickets:["Add tickets","添加门票"],addTicketsCompact:["Add","添加"],saveTicketsCompact:["Save","保存"],ticketAdded:["Tickets added to your day.","门票已加入本次订单。"],filterTickets:["Filter tickets by audience","按人群筛选门票"],quickVisitDates:["Choose a day this week","快捷选择游玩日期"],sharedVisitDate:["Your visit date","本次游玩日期"],sharedDateHint:["Used for new tickets.","新添加的门票自动沿用"],changeDate:["Change date","更改日期"],ticketDateHint:["Need a different day? Change this ticket only.","需要另一天游玩?可仅修改这张门票的日期。"],noMatchingTickets:["No tickets match these filters.","暂无符合筛选条件的门票。"],allTickets:["All tickets","全部门票"],childrenTickets:["Children","儿童"],adultTickets:["Adults","成人"],ticketsIncluding:["Tickets including","包含以下区域的门票:"],showAllTickets:["View all tickets","查看全部门票"],chooseTicket:["Choose ticket","选择门票"],pickTicketsHint:["Pick a ticket to start your family’s adventure.","选一张门票,开始安排全家的欢乐时光。"],childInvalid:["This child profile needs a valid name and date of birth. Select another profile or add corrected details.","儿童资料的姓名或生日无效,请选择其他档案或新增正确信息。"],couponProduct:["This offer applies only to the Little Explorers toddler ticket.","此优惠仅适用于小小探索家幼儿单区票。"],checkoutTitle:["Your happy day, all together.","确认门票,让快乐出发。"],contactSection:["Contact details","填写联系信息"],orderSection:["Review your tickets","确认订单信息"],agreementSection:["Confirm agreements","确认协议"],noteSection:["Leave a note","留言"],checkoutSub:["Review your tickets, add a little saving and get ready to play.","查看全家的门票,使用优惠,确认后即可出发。"],addMoreTickets:["Add more tickets","继续选购门票"],participantsIncomplete:["Some participant details still need attention. Your tickets are saved.","参加者信息尚未完成,已选门票均已保留。"],completeParticipants:["Add participant details","补充参加者信息"],completeContact:["Add contact details","补充联系人"],orderAgreementsHelp:["Open each agreement and confirm your consent in its details.","请点击协议查看详情,并在详情中确认同意。"],agreementsPending:["Agreements to confirm: {count}","还有 {count} 份协议待确认"],agreementsPaymentHelp:["Select “Read agreement” below, read the details and select “Confirm”. Confirm all agreements, then try payment again.","请点击下方“查看协议”,阅读后点击“确认”。全部确认后,再点击支付。"],readAgreement:["Read agreement","查看协议"],orderSummary:["Your order","订单明细"],orderDetailShort:["Details","明细"],checkOrder:["Check order","检查订单"],loginComplete:["Sign in & add your details","登录并补充信息"],availabilityFix:["Update the tickets marked unavailable.","请修改标记为不可预约的门票。"],confirmPrice:["Confirm new price & pay","确认新价格并付款"],confirmPriceShort:["Confirm & pay","确认并付款"],loginShort:["Sign in","登录并补充"],completeShort:["Add details","补充信息"],migrationNotice:["Some saved demo items could not be converted. The original draft is backed up in this browser; please choose those tickets again.","部分旧演示内容无法转换,原始草稿已备份在当前浏览器,请重新选择相关门票。"],timeRechoose:["That time is no longer available for this date. Please choose another time.","该时段在当前日期已不可预约,请重新选择。"],spotsLeft:["spots left","个余位"]},e0_=(e,t)=>{var l;return(null==(l=e0k[t])?void 0:l[+("en"!==e)])??t},e0w={en:{close:"Close",cancel:"Cancel",back:"Back",next:"Next",configuration:"Choose options",booking:"Choose time",confirmConfiguration:"Confirm options",confirmBooking:"Add tickets",working:"Please wait…",validationFailed:"Complete the required selections to continue.",confirmationFailed:"Unable to save your selection. Please try again.",configurationNotReady:"Options are not ready. Please close and try again.",invalidPlan:"Product details are not ready. Please close and try again."},zh:{close:"关闭",cancel:"取消",back:"上一步",next:"下一步",configuration:"选择商品选项",booking:"选择时间",confirmConfiguration:"确认选项",confirmBooking:"添加门票",working:"请稍候…",validationFailed:"请完成必选内容后继续。",confirmationFailed:"保存失败,请重试。",configurationNotReady:"商品选项尚未准备好,请关闭后重试。",invalidPlan:"商品详情尚未准备好,请关闭后重试。"}};function e0S(e){var t,l,i,a,n,r,o,s,d,c,u;let p=eJF(),m=null==p?void 0:p.brandTokens,[g]=(0,eC.useState)(()=>e.plan),[h,v]=(0,eC.useState)(g.hasConfiguration?"configuration":"booking"),[f,y]=(0,eC.useState)(!1),[b,x]=(0,eC.useState)(!1),[k,_]=(0,eC.useState)(!1),[w,S]=(0,eC.useState)(),[j,N]=(0,eC.useState)(null),[C,M]=(0,eC.useState)(!1),T=(0,eC.useRef)(null),I=(0,eC.useRef)(null),P=(0,eC.useRef)(0),A=(0,eC.useRef)(!0),D=(0,eC.useRef)(e);D.current=e;let E=(0,eC.useRef)(e.configuration);E.current=e.configuration;let O=(0,eC.useRef)(null);null===O.current&&(O.current=(0,no.cloneDeep)(e.configuration));let z=(0,eC.useRef)(null),L=(0,eC.useRef)(0);(0,no.isEqual)(O.current,e.configuration)||(z.current&&(0,no.isEqual)(z.current,e.configuration)||(L.current+=1),z.current=null,O.current=(0,no.cloneDeep)(e.configuration));let R=e.locale||"en",$="edit-draft"===g.intent,F={...e0w[R],...$?{confirmBooking:e0_(R,"updateBasket")}:{},...e.labels},q=!!e.busy||b||k,B=!g.openId||!g.scopeKey||!g.detailRevision||!g.productDetail||String(null==(t=e.configuration.skuValue)?void 0:t.product_id)!==String(g.productDetail.id)||"product-configuration"===g.mode&&(!g.hasConfiguration||!e.onConfigurationConfirm)||"ticket-booking"===g.mode&&(!e.renderBooking||!e.onConfirm),H="ticket-booking"===g.mode,V=H&&g.hasConfiguration;(0,eC.useEffect)(()=>(A.current=!0,()=>{var e;A.current=!1,P.current+=1,null==(e=I.current)||e.abort()}),[]);let U=(0,eC.useCallback)(e=>{T.current=e,M(!!e)},[]),Y=()=>{var t;q||(P.current+=1,null==(t=I.current)||t.abort(),e.onCancel())},W=()=>{!q&&V&&(S(void 0),y(!0),v("configuration"),null==j||j.scrollTo({top:0}))},K=async()=>{var e,t,l,i,a,n,r,o,s,d;if(q||B||I.current)return;let c=new AbortController,u=++P.current,p=D.current.selectionRevision,m=L.current;I.current=c;let f={openId:g.openId,scopeKey:g.scopeKey,detailRevision:g.detailRevision,signal:c.signal,isCurrent:()=>A.current&&!c.signal.aborted&&P.current===u&&L.current===m&&("booking"!==h||D.current.selectionRevision===p)};x(!0),S(void 0);let b="validation";try{let s=E.current;if("configuration"===h){let e=T.current;if(!C||!e)return void S(F.configurationNotReady);if(!1!==D.current.requiredOptionValidation&&await e.validate(),!f.isCurrent())return;let t=iC(g.productDetail,e.getTransformValues(),{requiredOptionValidation:D.current.requiredOptionValidation,overSold:(null==(i=D.current.skuOptions)||null==(l=i.config)?void 0:l.overSold)===1||(null==(n=D.current.skuOptions)||null==(a=n.config)?void 0:a.overSold)==null&&lZ(g.productDetail.over_sold)});if(!t)return void S(F.validationFailed);if(s={skuValue:t,variantDraft:E.current.variantDraft},E.current=s,z.current=(0,no.cloneDeep)(s),D.current.onConfigurationChange(s),H){if(await (null==(r=(o=D.current).onConfigurationContinue)?void 0:r.call(o,s,f)),!f.isCurrent())return;y(!0),v("booking"),null==j||j.scrollTo({top:0});return}}else if(!H||!D.current.bookingReady)return;b="confirmation";let d=H?await D.current.onConfirm(s,f):await (null==(e=(t=D.current).onConfigurationConfirm)?void 0:e.call(t,s,f));f.isCurrent()&&!1!==d&&_(!0)}catch(e){if(!f.isCurrent())return;S("validation"===b?F.validationFailed:F.confirmationFailed),null==(s=(d=D.current).onError)||s.call(d,e,b)}finally{A.current&&P.current===u&&x(!1),I.current===c&&(I.current=null)}},G=q||B||("configuration"===h?!C:!H||!e.bookingReady),Q={mode:g.mode,step:h,configuration:e.configuration,busy:q},Z="function"==typeof e.footerContent?e.footerContent(Q):e.footerContent,J="configuration"===h?e.configurationFooter:void 0,X="configuration"===h?H?F.next:F.confirmConfiguration:F.confirmBooking,ee=B?F.invalidPlan:w||e.error,et=H||!!J,el=H&&"booking"===h?e.bookingActionAmount??"—":(null==J?void 0:J.amount)??null,ei=H&&"booking"===h?e.bookingSubtotalLabel??e0_(R,"subtotal"):(null==J?void 0:J.label)??(H?void 0:e0_(R,"subtotal")),ea=(null==(l=e.skuOptions)?void 0:l.type)||"flat",en=null==(i=e.skuOptions)?void 0:i.presentation,er="function"==typeof e.getContainer?e.getContainer():"string"==typeof e.getContainer?document.querySelector(e.getContainer):e.getContainer,eo=V?(0,eH.jsx)("div",{className:"pisell-booking-product-detail-steps",children:(0,eH.jsx)(e0l,{current:+("configuration"!==h),label:"zh"===R?"商品选择步骤":"Product selection steps",currentLabel:"zh"===R?"当前步骤":"Current step",steps:[{id:"configuration",label:F.configuration,status:"configuration"!==h&&q?"locked":"available",onClick:W},{id:"booking",label:F.booking,status:"booking"===h?"available":"locked"}]})}):null;return(0,eH.jsx)(e0t,{title:e.title,onClose:Y,closeLabel:F.close,closeDisabled:q,wide:!0,className:`${H?"reservation-modal":"party-package-dialog"} pisell-booking-product-detail-modal ${e.className||""}`,bodyClassName:`${H?"reservation-content":"package-config-body"} pisell-booking-product-detail-body`,footerClassName:`${et?"booking-config-dialog-footer":"package-config-footer"} pisell-booking-product-detail-footer`,mobile:"fullscreen",bodyRef:N,portal:er,zIndex:600,externalDialogSelector:eX9,style:{...e.width?{width:e.width}:{},...e.style},footer:et?(0,eH.jsx)(eXR,{leading:!H||"booking"===h||J?Z:void 0,label:ei,amount:el,action:{label:k?F.working:X,disabled:G,busy:b||e.busy,onClick:K},feedback:ee&&(0,eH.jsx)("p",{className:"error-text pisell-booking-product-detail-error",role:"alert",children:ee})}):(0,eH.jsxs)(eH.Fragment,{children:[ee&&(0,eH.jsx)("div",{className:"error-text pisell-booking-product-detail-error",role:"alert",children:ee}),Z&&(0,eH.jsx)("div",{className:"pisell-booking-product-detail-footer-content",children:Z}),(0,eH.jsxs)("div",{className:"package-config-footer-actions pisell-booking-product-detail-actions",children:[(0,eH.jsx)(eXE,{secondary:!0,disabled:q,onClick:Y,children:F.cancel}),(0,eH.jsx)(eXE,{disabled:G,busy:b||e.busy,onClick:()=>void K(),children:(0,eH.jsx)("span",{children:k?F.working:X})})]})]}),children:(0,eH.jsxs)("div",{"aria-busy":q,children:[eo,e.summary&&(0,eH.jsx)("div",{className:"pisell-booking-product-detail-summary",children:e.summary}),!B&&"configuration"===h&&(0,eH.jsx)("div",{className:"pisell-booking-product-detail-sku-guard venue-booking-legacy-controls","aria-disabled":q,style:q?{pointerEvents:"none"}:void 0,onKeyDownCapture:e=>{q&&"Tab"!==e.key&&(e.preventDefault(),e.stopPropagation())},children:(0,eH.jsx)($$,{...e.skuOptions,ref:U,type:ea,presentation:"flat"===ea?{...en,modal:{...null==en?void 0:en.modal,style:{...null==en||null==(a=en.modal)?void 0:a.style,...(null==p?void 0:p.fontFamily)?{fontFamily:p.fontFamily}:{}},className:[null==(o=$I(ea))||null==(r=o.presentation)||null==(n=r.modal)?void 0:n.className,null==en||null==(s=en.modal)?void 0:s.className,"pisell-booking-product-detail-options-modal"].filter(Boolean).join(" ")}}:en,theme:(null==(d=e.skuOptions)?void 0:d.theme)||{token:{colorPrimary:null==m?void 0:m["--primary"],colorPrimaryBg:null==m?void 0:m["--primary-soft"]}},config:(null==(c=e.skuOptions)?void 0:c.config)||{overSold:+!!lZ(g.productDetail.over_sold)},dataSource:g.productDetail,value:e.configuration.skuValue,variantDraft:e.configuration.variantDraft,selectionKey:g.selectionKey,initializationPolicy:f||"edit-draft"===g.intent?"preserve":(null==(u=e.skuOptions)?void 0:u.initializationPolicy)||"auto-required-defaults",disabled:!!e.busy||k,customScrollParent:j||void 0,className:"pisell-booking-product-detail-sku",onChange:(t,l)=>{if(b||k||e.busy)return;let i={skuValue:t,variantDraft:void 0===l?E.current.variantDraft:l.variantDraft};E.current=i,e.onConfigurationChange(i),S(void 0)}})}),!B&&H&&"booking"===h&&e.renderBooking({plan:g,configuration:e.configuration,busy:q,scrollContainer:j,backToConfiguration:W})]})})}let e0j=function(e){let t,l=eJF();if(!e.plan)return null;let i=(0,eH.jsx)(e0S,{...e},JSON.stringify([(t=e.plan).openId,t.scopeKey,t.detailRevision,t.mode,t.selectionKey]));return l?i:(0,eH.jsx)(eXc,{lang:e.locale||"en",children:i})},e0N={en:{date:"Choose a date",time:"Choose a time",room:"Choose a room",resource:"Choose an area",selectTime:"Choose a time to see available areas.",selectRoom:"Choose a room for this time.",timeBeforeRoom:"Choose a time to see available rooms.",timeForRooms:"Choose available rooms for this time.",checking:"Checking availability…",noTimes:"No available times for this selection.",noResources:"No resources are available for this selection.",none:"No selection",optional:"Optional",retry:"Check again",reselect:"Choose again",unavailable:"Unavailable for this selection",selectedUnavailable:"Your previous selection is unavailable. Please choose again.",configuration:"This product’s booking configuration is incomplete. Please contact the venue.",resourceRequired:"Choose one option in each required group.",singleResource:"Choose one option in this group.",chooseTime:"Choose an available time.",quantity:"Choose a valid quantity.",changed:"Your selection has changed. Please review it before continuing.",requestFailed:"Availability could not be checked. Please try again.",reconciliation:"The booking result needs to be checked. Return to your order before trying again.",ready:"This selection is available.",dateFailed:"The date could not be changed. Please try again."},zh:{date:"选择日期",time:"选择时间",room:"选择房间",resource:"选择区域",selectTime:"请先选择时间,再查看可用区域。",selectRoom:"请选择该时段的房间。",timeBeforeRoom:"请先选择时间,再查看可用房间。",timeForRooms:"请先选择在该时段可用的房间。",checking:"正在查询可用性…",noTimes:"当前选择没有可用时段。",noResources:"当前选择没有可用资源。",none:"不选择",optional:"选填",retry:"重新查询",reselect:"重新选择",unavailable:"当前选择不可用",selectedUnavailable:"之前选择的时间或资源已不可用,请重新选择。",configuration:"该商品的预约配置不完整,请联系场馆。",resourceRequired:"请为每个必选组选择一项。",singleResource:"同一组只能选择一项。",chooseTime:"请选择可用时段。",quantity:"请选择有效数量。",changed:"选择已变更,请核对后继续。",requestFailed:"暂时无法查询可用性,请重试。",reconciliation:"本次预约写入结果需要核对,请返回订单查看后再试。",ready:"当前选择可用。",dateFailed:"日期变更失败,请重试。"}};function e0C(e,t){let l=e0N[t],i={past:["This time has passed.","该时段已结束。"],outside_operating_hours:["Outside venue opening hours.","不在场馆营业时间内。"],outside_resource_window:["This area is not open at this time.","该资源在此时段不开放。"],schedule_excluded_date:["Not offered on this date.","此日期未开放预订。"],capacity_full:["Not enough capacity for this selection.","剩余容量不足。"],resource_capacity_exceeded:["Not enough capacity for this selection.","剩余容量不足。"],resource_occupied:["Already booked at this time.","该时段已被预订。"],cart_occupied:["Reserved by another item in your order.","与订单内另一项预约冲突。"],selection_occupied:["Conflicts with the current selection.","与当前选择冲突。"],booking_cutoff_invalid:["Booking rules need to be checked by the venue.","预订截止配置有误,请联系场馆。"],booking_cutoff_future_day:["This date is not open for booking yet.","该日期暂未开放预订。"],booking_cutoff_after_start:["The booking deadline has passed.","已过预订截止时间。"],booking_cutoff_before_start:["The booking deadline has passed.","已过预订截止时间。"],booking_cutoff_advance:["The booking deadline has passed.","已过预订截止时间。"]};return i[e]?i[e][+("zh"===t)]:e.includes("CONFIGURATION")||"UNSUPPORTED_RESOURCE_GROUP"===e||"AVAILABILITY_UNSUPPORTED"===e?l.configuration:"RESOURCE_REQUIRED"===e?l.resourceRequired:"PARTY_ROOM_REQUIRED"===e?l.selectRoom:"RESOURCE_SINGLE_SELECTION_REQUIRED"===e?l.singleResource:"TIME_REQUIRED"===e?l.chooseTime:"QUANTITY_REQUIRED"===e||"SINGLE_BOOKING_REQUIRED"===e?l.quantity:"NO_AVAILABLE_TIME"===e?l.noTimes:"AUTOMATIC_RESOURCE_UNAVAILABLE"===e?l.noResources:"SELECTED_TIME_UNAVAILABLE"===e||"SELECTED_RESOURCE_UNAVAILABLE"===e?l.selectedUnavailable:e.endsWith("_CHANGED")||"BOOKING_SELECTION_NOT_READY"===e?l.changed:"AVAILABILITY_REQUEST_FAILED"===e?l.requestFailed:l.unavailable}function e0M(e,t){var l;return(null==t||null==(l=t[String(e.formId??e.groupId)])?void 0:l.resourceSelectionMode)==="automatic"}let e0T=e=>{var t;return(Array.isArray(null==e||null==(t=e.product_resource)?void 0:t.resources)?e.product_resource.resources:[]).filter(e=>0!==Number(e.status)).map(e=>({groupId:String(e.id??e.form_id??e.code),formId:e.id??e.form_id}))};function e0I(e,t){return!e||e0T(e).some(e=>!e0M(e,t))}let e0P=(e,t)=>null!=e.requirementGroupId?String(e.requirementGroupId)===String(t.groupId):null!=e.formId&&null!=t.formId&&String(e.formId)===String(t.formId),e0A=e=>{if(null==e||""===e)return;let t=Number(e);return Number.isSafeInteger(t)&&t>0?t:void 0},e0D=e=>{if(!(!e.length||e.some(e=>!Number.isSafeInteger(Number(null==e?void 0:e.value))||0>Number(null==e?void 0:e.value))))return e0A(e.reduce((e,t)=>e+Number(t.value),0))};function e0E(e,t){var l,i,a,n,r,o;let s,d,c=void 0===t?null==e||null==(l=e._extend)?void 0:l.other:Bo(null==e||null==(i=e._extend)?void 0:i.other,t),u={...e,id:(null==e?void 0:e.id)??(null==e?void 0:e.product_id),_extend:{...(null==e?void 0:e._extend)||{},other:c}},p=[],m=(null==e||null==(a=e._data)?void 0:a.capacitys)??(null==e?void 0:e.capacity),g=[];if((null==m?void 0:m.type)==="product")s=e0D(g=ng({capacitys:m,cacheItem:u}));else if((null==m?void 0:m.type)==="package")s=e0D(g=ng({capacitys:m,cacheItem:u}));else if((null==m?void 0:m.type)==="custom"){let t=Array.isArray(m.custom)?m.custom:[],l=Array.isArray(null==e||null==(n=e._extend)?void 0:n.capacity)?e._extend.capacity:[];t.length&&t.every(e=>{let t=l.find(t=>String(null==t?void 0:t.id)===String(e.id)),i=Number(null==t?void 0:t.value);return t&&Number.isSafeInteger(i)&&i>=Number(e.min)&&i<=Number(e.max)})?g=t.map(e=>l.find(t=>String(t.id)===String(e.id))):t.length&&t.every(e=>Number.isSafeInteger(Number(e.min))&&Number(e.min)>=0&&Number(e.min)<=Number(e.max))&&(g=ng({capacitys:m,cacheItem:u})),s=e0D(g)??e0A(m.default)}else{s=e0A((null==m?void 0:m.default)??m);let t=null==e||null==(r=e._extend)?void 0:r.capacity;if(!s&&Array.isArray(t)&&(s=e0D(t)),!s){let t=((null==e||null==(o=e.product_resource)?void 0:o.resources)||[]).filter(e=>(null==e?void 0:e.status)!==0).map(e=>e0A(e.capacity_required));t.length&&t.every(e=>e===t[0]&&void 0!==e)&&(s=t[0])}}s||p.push("CAPACITY_CONFIGURATION_REQUIRED"),g.length&&(u._extend.capacity=g);let h=(null==e?void 0:e.duration)??(null==e?void 0:e.service_duration),v=null==h?void 0:ol(h);if("flexible"===v);else if("number"==typeof v||"string"==typeof v){let e=Number(v);Number.isFinite(e)&&e>0?d=e:null!=v&&p.push("DURATION_CONFIGURATION_REQUIRED")}else null!=v&&p.push("UNSUPPORTED_DURATION_CONFIGURATION");let f=u.id;return null!=f&&""!==f&&Number.isFinite(Number(f))||p.push("PRODUCT_CONFIGURATION_REQUIRED"),{product:u,productId:f,partySize:s,durationMinutes:d,reasonCodes:p}}function e0O(e){var t;let l={},i=null==e||null==(t=e.product_resource)?void 0:t.resources;return Array.isArray(i)&&i.filter(e=>(null==e?void 0:e.status)!==0).forEach((e,t)=>{var i;let a=e.id??e.form_id??e.code??`requirement-${t}`,n=[...Array.isArray(e.default_resource)?e.default_resource:[],...Array.isArray(e.optional_resource)?e.optional_resource:[],...(null==(i=e.combined_resource)?void 0:i.status)===1&&Array.isArray(e.combined_resource.resource_ids)?e.combined_resource.resource_ids:[]].filter(e=>"string"==typeof e||"number"==typeof e);l[String(a)]=n.filter((e,t)=>n.findIndex(t=>String(t)===String(e))===t)}),l}function e0z(e){var t,l,i,a;let n=e.product||{};return JSON.stringify({mode:e.mode,date:e.date,quantity:e.quantity,edit:e.editingProductLineUid,disabled:e.disabled,resourcePolicy:(a=e.resourceSettings,JSON.stringify(e0T(n).map(e=>[String(e.formId??e.groupId),e0M(e,a)]).sort((e,t)=>String(e[0]).localeCompare(String(t[0]))))),resourceSettingsReady:!1!==e.resourceSettingsReady,resourceSettingsFailed:!!e.resourceSettingsFailed,id:n.id??n.product_id,updatedAt:n.updated_at,sku:By((null==(t=n._extend)?void 0:t.other)??n.product_sku),capacity:(null==(l=n._data)?void 0:l.capacitys)??n.capacity,capacityValue:null==(i=n._extend)?void 0:i.capacity,duration:n.duration,serviceDuration:n.service_duration,resources:n.product_resource,schedule:n.schedule,schedules:n.schedules,session:n.session})}class e0L extends Error{constructor(e,t=Array.from(new Set(e.map(e=>e0C(e,"en")))).join(" ")){super(t),e1(this,"reasonCodes",void 0),this.reasonCodes=e,this.name="BookingSelectionError"}}let e0R=(e,t)=>String(e)===String(t),e0$=(e,t)=>("available"===e.status||"limited"===e.status)&&(null==e.maxPartySize||e.maxPartySize>=t);function e0F(e,t){return!!e&&!!t&&e0R(e.productId,t.productId)&&e.key===t.key&&e.source===t.source&&e.date===t.date&&e.businessDate===t.businessDate&&e.startAt===t.startAt&&e.endAt===t.endAt&&e.bookingStartAt===t.bookingStartAt&&e.bookingEndAt===t.bookingEndAt&&e.timezone===t.timezone&&JSON.stringify(e.scheduleRefs)===JSON.stringify(t.scheduleRefs)&&JSON.stringify(e.primaryScheduleRef)===JSON.stringify(t.primaryScheduleRef)}let e0q=(e,t)=>e0F(e,t)&&(null==e?void 0:e.availabilityContextId)===(null==t?void 0:t.availabilityContextId)&&(null==e?void 0:e.availabilityContextVersion)===(null==t?void 0:t.availabilityContextVersion);function e0B(e){return JSON.stringify([String(e.productId),e.date,e.businessDate,e.startAt,e.endAt,e.bookingStartAt||e.startAt,e.bookingEndAt||e.endAt,e.timezone])}function e0H(e,t){let l=new Map;for(let i of e){let e=e0B(i),a=l.get(e);a?(a.candidates.push(i),!e0$(a.candidate,t)&&e0$(i,t)&&(a.candidate=i)):l.set(e,{id:e,candidate:i,candidates:[i]})}return Array.from(l.values())}function e0V(e,t){return null!=e.requirementGroupId?e0R(e.requirementGroupId,t.groupId):null!=e.formId&&null!=t.formId&&e0R(e.formId,t.formId)}function e0U(e){return JSON.stringify({candidate:e.candidate&&{productId:e.candidate.productId,key:e.candidate.key,startAt:e.candidate.startAt,endAt:e.candidate.endAt},selections:e.requirementSelections.map(e=>({group:e.requirementGroupId,form:e.formId,ids:e.resourceIds.map(String).sort()})).sort((e,t)=>String(e.group??e.form).localeCompare(String(t.group??t.form)))})}function e0Y(e,t,l){let i=[];for(let n of e){var a;let e=t.filter(e=>e0V(e,n)),r=(null==(a=e[0])?void 0:a.resourceIds)||[],o=Math.max(+!!n.required,n.min||0);(o>1||n.max<o)&&i.push("UNSUPPORTED_RESOURCE_GROUP"),(e.length>1||r.length>1||r.length>n.max)&&i.push("RESOURCE_SINGLE_SELECTION_REQUIRED"),r.length<o&&i.push("RESOURCE_REQUIRED"),r.some(e=>!n.options.some(t=>e0R(t.resourceId,e)&&e0$(t,l)))&&i.push("SELECTED_RESOURCE_UNAVAILABLE")}return t.some(t=>t.resourceIds.length&&!e.some(e=>e0V(t,e)))&&i.push("SELECTED_RESOURCE_UNAVAILABLE"),Array.from(new Set(i))}function e0W(e,t,l,i){let a=e0O(l),n=t.map(e=>({...e,resourceIds:[...e.resourceIds]}));for(let t of e){if(n.some(e=>e0V(e,t)&&e.resourceIds.length))continue;let e=a[t.groupId]||(null==t.formId?[]:a[String(t.formId)])||[];if((t.required||t.min>0)&&1===e.length&&t.max>=1&&t.options.some(t=>e0R(t.resourceId,e[0])&&e0$(t,i))){let l={requirementGroupId:t.groupId,formId:t.formId,resourceIds:[e[0]]},i=n.findIndex(e=>e0V(e,t));-1===i?n.push(l):n[i]=l}}return n}function e0K(e,t){var l;t&&(null==(l=e.releaseAvailabilityContext)||l.call(e,t.contextId))}function e0G(e,t){let l=Array.from(new Set(t.filter(e0m))).sort(),i=l.indexOf(e);if(i<0)return{startDate:e,endDate:e};let a=i,n=i;for(;a>0&&e0h(l[a],-1)===l[a-1];)a--;for(;n+1<l.length&&e0h(l[n],1)===l[n+1];)n++;return{startDate:l[a],endDate:l[n]}}async function e0Q(e,t){let l;var i,a=e.os;if(!a.prepareAvailabilityProjection||!a.getProductTimeRanges||!a.queryBookingAvailability||!a.releaseAvailabilityContext)throw new e0L(["AVAILABILITY_UNSUPPORTED"]);let n=(l=e0E(e.product).reasonCodes,/^\d{4}-\d{2}-\d{2}$/.test(e.date)&&!Number.isNaN(Date.parse(`${e.date}T00:00:00Z`))&&new Date(`${e.date}T00:00:00Z`).toISOString().slice(0,10)===e.date||l.push("DATE_REQUIRED"),e0A(e.quantity)||l.push("QUANTITY_REQUIRED"),("party"===e.mode||e.editingProductLineUid)&&1!==e.quantity&&l.push("SINGLE_BOOKING_REQUIRED"),l);if(n.length)throw new e0L(n);let r=e0E(e.product),o=r.partySize,s=o*e.quantity;if(!Number.isSafeInteger(s))throw new e0L(["CAPACITY_CONFIGURATION_REQUIRED"]);let d={startDate:e.date,endDate:e.date},c=null==t?void 0:t.projectionDateRange,u=c&&e0m(c.startDate)&&e0m(c.endDate)&&c.startDate<=e.date&&c.endDate>=e.date?c:d,p={productIds:[r.productId],rawProducts:[r.product],dateRange:u,editingProductLineUids:e.editingProductLineUid?[e.editingProductLineUid]:void 0,publishCatalog:!1,refreshOccupancies:!1,strictAvailability:!0,mode:"appointment",occupancyCachePolicy:"session"},m=await e.os.prepareAvailabilityProjection(p);try{let t=(await e.os.getProductTimeRanges(m.contextId,{productIds:[r.productId],dateRange:d,partySize:s,...r.durationMinutes?{durationMinutesByProductId:{[String(r.productId)]:r.durationMinutes}}:{},...e.editingProductLineUid&&(null==(i=e.initialSelection)?void 0:i.candidate)&&r.durationMinutes?{editingStartAtByProductId:{[String(r.productId)]:e.initialSelection.candidate.startAt}}:{}})).filter(e=>e0R(e.productId,r.productId)).flatMap(e=>e.ranges||[]),l=t.length?await e.os.queryBookingAvailability(m.contextId,{target:"time",productIds:[r.productId],candidates:t,partySize:s}):void 0,a=((null==l?void 0:l.data)||[]).filter(e=>e0R(e.productId,r.productId)).flatMap(e=>e.times||[]).filter(t=>t.availabilityContextId===m.contextId&&(t.businessDate||t.date)===e.date),n=e.os.getAvailabilityResources?Array.from(await e.os.getAvailabilityResources(m.contextId,"number"==typeof(null==l?void 0:l.contextVersion)?l.contextVersion:void 0)):[];return{contextId:m.contextId,productId:r.productId,partySize:o,bookingCount:e.quantity,queryPartySize:s,times:a,resources:n,product:r.product}}catch(t){throw e0K(e.os,m),t}}async function e0Z(e,t,l){var i;let a={target:"resource",productIds:[t.productId],selectedRanges:[l],partySize:t.queryPartySize,customerSelectionSnapshot:!0},n=(await e.queryBookingAvailability(t.contextId,a)).data.filter(e=>e0R(e.productId,t.productId)).flatMap(e=>e.ranges||[]).find(e=>e0q(e.range,l));if(!n||!e0$(n,t.queryPartySize))throw new e0L((null==n||null==(i=n.reasonCodes)?void 0:i.length)?n.reasonCodes:["SELECTED_TIME_UNAVAILABLE"]);return{candidate:n.range,groups:n.requirementGroups||[]}}async function e0J(e,t,l){let i=e0B(l),a=t.times.filter(e=>e0B(e)===i),n=[];for(let l=0;l<a.length;l+=2){let i=await Promise.all(a.slice(l,l+2).map(async l=>{try{return await e0Z(e,t,l)}catch(e){if(e instanceof e0L)return;throw e}}));n.push(...i.filter(e=>!!e))}if(!n.length)throw new e0L(["SELECTED_TIME_UNAVAILABLE"]);return n}function e0X(e,t,l){let i=new Map;for(let a of e)for(let e of a.groups){let n=i.get(e.groupId);n||(n={...e,options:[]},i.set(e.groupId,n));let r=t.filter(t=>!e0V(t,e)),o=e0Y(a.groups,r,l.queryPartySize).every(e=>"RESOURCE_REQUIRED"===e);for(let t of e.options){let e=o?t:{...t,status:"unavailable",reasonCodes:["SELECTED_RESOURCE_UNAVAILABLE"]},i=n.options.findIndex(t=>e0R(t.resourceId,e.resourceId));i<0?n.options.push(e):!e0$(n.options[i],l.queryPartySize)&&e0$(e,l.queryPartySize)&&(n.options[i]=e)}}return e00(Array.from(i.values()),l)}function e00(e,t){let l=e0O(t.product);return e.map(e=>{let i=[...e.options];for(let a of l[e.groupId]||[])if(!i.some(e=>e0R(e.resourceId,a))){let e=t.resources.find(e=>e0R(e.id,a));i.push({resourceId:a,resourceName:null==e?void 0:e.name,status:"unavailable",reasonCodes:["RESOURCE_NOT_AVAILABLE_IN_CONTEXT"]})}return{...e,options:i}})}function e02(e,t){return e.resources.filter(e=>t.some(t=>t.resourceIds.some(t=>e0R(t,e.id))))}let e01=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return{status:"idle",ready:!1,reasonCodes:[],bookingCount:e,times:[],resourceGroups:[],resources:[],selectedResourceDetails:[],requirementSelections:[],resourceScrollRevision:0}},e04=e=>e instanceof e0L?e.reasonCodes:["AVAILABILITY_REQUEST_FAILED"],e03=e=>e instanceof Error?e.message:String(e),e08=e=>(null==e?void 0:e.resourceSettingsReady)===!1||(null==e?void 0:e.resourceSettingsFailed)===!0,e06=e=>({candidate:null==e?void 0:e.candidate,requirementSelections:((null==e?void 0:e.requirementSelections)||[]).map(e=>({...e,resourceIds:[...e.resourceIds]}))});class e05{publish(e){this.disposed||(this.state={...this.state,...e},this.listeners.forEach(e=>e()))}releaseCurrent(){this.input&&e0K(this.input.os,this.projection),this.projection=void 0}async setInput(e){var t;let l=e0z(e);if(this.disposed)return;if(l===this.inputKey&&e.os===(null==(t=this.input)?void 0:t.os)){this.input=e;return}let i=this.input,a=this.intent.candidate;if(i&&this.projection&&a&&!this.committing&&!e.disabled&&!this.state.requiresOrderReconciliation&&e.os===i.os&&(e.quantity===i.quantity||"ticket"===e.mode&&!e.editingProductLineUid)&&Number.isSafeInteger(e.quantity)&&e.quantity>0&&Number.isSafeInteger(this.projection.partySize*e.quantity)&&e0z({...e,quantity:i.quantity,resourceSettings:i.resourceSettings,resourceSettingsReady:i.resourceSettingsReady,resourceSettingsFailed:i.resourceSettingsFailed})===this.inputKey)return(this.input=e,this.inputKey=l,this.generation++,this.queryRevision++,this.projection={...this.projection,bookingCount:e.quantity,queryPartySize:this.projection.partySize*e.quantity},this.publish({bookingCount:e.quantity}),e08(e))?void this.publish({status:e.resourceSettingsFailed?"error":"loading",ready:!1,reasonCodes:e.resourceSettingsFailed?["AVAILABILITY_REQUEST_FAILED"]:[],error:void 0}):void await this.resolveTime(a,!1);let n=i&&!e0R(i.product.id??i.product.product_id,e.product.id??e.product.product_id);(!i||n||i.editingProductLineUid!==e.editingProductLineUid?this.intent=e06(e.initialSelection):i.date!==e.date&&(this.intent={requirementSelections:[]}),this.releaseCurrent(),this.input=e,this.inputKey=l,this.generation++,this.queryRevision++,this.committing)?this.publish({ready:!1}):await this.load()}async load(){let e,t=this.input;if(!t||this.disposed)return;if(t.disabled)return void this.publish({...e01(t.quantity),status:"blocked",reasonCodes:["BOOKING_DISABLED"]});if(e08(t))return void this.publish({...e01(t.quantity),...e06(this.intent),status:t.resourceSettingsFailed?"error":"loading",reasonCodes:t.resourceSettingsFailed?["AVAILABILITY_REQUEST_FAILED"]:[]});let l=this.generation,i=this.queryRevision;this.publish({...e01(t.quantity),status:"loading",...e06(this.intent)});try{var a;let n=null==(a=this.beforeWork)?void 0:a.call(this);if(n&&(await n,this.disposed||l!==this.generation||i!==this.queryRevision))return;if(e=await e0Q({...t,initialSelection:this.intent}),this.disposed||l!==this.generation)return void e0K(t.os,e);this.projection=e;let r=e00(function(e){let t=new Map;for(let l of e.times)for(let i of l.requirementGroups||[]){let a=t.get(i.groupId);for(let n of(a||(a={...i,options:[]},t.set(i.groupId,a)),i.options||[])){let t=e0$(l,e.queryPartySize)?n:{...n,status:"unavailable"},i=a.options.findIndex(e=>e0R(e.resourceId,t.resourceId));i<0?a.options.push(t):!e0$(a.options[i],e.queryPartySize)&&e0$(t,e.queryPartySize)&&(a.options[i]=t)}}return Array.from(t.values())}(e),e);this.publish({contextId:e.contextId,productId:e.productId,partySize:e.partySize,bookingCount:e.bookingCount,times:e.times,resourceGroups:r,resources:e.resources});let o=e.times.find(t=>e0F(t,this.intent.candidate)&&e0$(t,e.queryPartySize));if(o)return void await this.resolveTime(o,!1);let s=e0H(e.times,e.queryPartySize).filter(t=>e0$(t.candidate,e.queryPartySize));if("ticket"===t.mode&&!this.intent.candidate&&1===s.length)return void await this.resolveTime(s[0].candidate,!1);let d=e.times.some(t=>e0$(t,e.queryPartySize))?[]:["NO_AVAILABLE_TIME"];this.intent.candidate&&d.push("SELECTED_TIME_UNAVAILABLE"),"party"!==t.mode||r.length||d.push("PARTY_ROOM_CONFIGURATION_REQUIRED"),this.publish({status:d.length?"blocked":"selecting",ready:!1,reasonCodes:d,...e06(this.intent),selectedResourceDetails:e02(e,this.intent.requirementSelections)})}catch(e){if(this.disposed||l!==this.generation)return;this.publish({status:"error",ready:!1,reasonCodes:e04(e),error:e03(e)})}}async resolveTime(e,t){let l=this.projection,i=this.input;if(!l||!i)return;let a=this.generation,n=++this.queryRevision;this.intent={...this.intent,candidate:e},this.publish({status:"loading",ready:!1,reasonCodes:[],error:void 0,...e06(this.intent)});try{var r;let o=null==(r=this.beforeWork)?void 0:r.call(this);if(o&&(await o,this.disposed||a!==this.generation||n!==this.queryRevision))return;let s=await e0J(i.os,l,e);if(this.disposed||a!==this.generation||n!==this.queryRevision)return;let d=[...s].sort((t,l)=>Number(e0F(l.candidate,e))-Number(e0F(t.candidate,e))),c=s.some(e=>e.groups.some(e=>e0M(e,i.resourceSettings)))?void 0:e0W(e0X(s,this.intent.requirementSelections,l),this.intent.requirementSelections,l.product,l.queryPartySize),u=d.map(e=>{let t=c||e0W(e.groups,this.intent.requirementSelections,l.product,l.queryPartySize),a=function(e,t,l,i){let a=t.map(e=>({...e,resourceIds:[...e.resourceIds]})),n=[];for(let t of e){if(!e0M(t,l))continue;let e=a.filter(e=>e0P(e,t)),r=VR({...t,options:t.options.filter(e=>null==e.maxPartySize||e.maxPartySize>=i)}),o=1===e.length&&1===e[0].resourceIds.length&&r.some(t=>String(t.resourceId)===String(e[0].resourceIds[0])),s=t.min>1||t.max<1,d=s?[]:o?e[0].resourceIds:VF({...t,options:r},{mode:"availability"});for(let e=a.length-1;e>=0;e--)e0P(a[e],t)&&a.splice(e,1);a.push({requirementGroupId:t.groupId,formId:t.formId,resourceIds:d}),s?n.push("UNSUPPORTED_RESOURCE_GROUP"):1!==d.length&&n.push("AUTOMATIC_RESOURCE_UNAVAILABLE")}return{selections:a,reasonCodes:n}}(e.groups,t,i.resourceSettings,l.queryPartySize);return{result:e,selections:a.selections,reasons:Array.from(new Set([...e0Y(e.groups,a.selections,l.queryPartySize),...a.reasonCodes]))}}),p=u.find(e=>!e.reasons.length)||u.find(e=>e.reasons.every(e=>"RESOURCE_REQUIRED"===e))||u[0],{result:m,selections:g}=p;this.intent={candidate:m.candidate,requirementSelections:g};let h=[...p.reasons];"party"!==i.mode||m.groups.length||h.push("PARTY_ROOM_CONFIGURATION_REQUIRED"),"party"!==i.mode||this.intent.requirementSelections.some(e=>e.resourceIds.length)||h.push("PARTY_ROOM_REQUIRED");let v=g.filter(e=>!s.some(t=>t.groups.some(t=>e0M(t,i.resourceSettings)&&e0V(e,t))));return this.publish({status:h.length?"selecting":"ready",ready:!h.length,reasonCodes:h,...e06(this.intent),resourceGroups:e0X(s,v,l),selectedResourceDetails:e02(l,this.intent.requirementSelections),resourceScrollRevision:this.state.resourceScrollRevision+(t&&m.groups.length?1:0)}),this.state}catch(e){if(this.disposed||a!==this.generation||n!==this.queryRevision)return;this.publish({status:"error",ready:!1,reasonCodes:e04(e),error:e03(e)})}}dispose(){this.disposed||(this.disposed=!0,this.generation++,this.queryRevision++,this.releaseCurrent(),this.listeners.clear())}constructor(e){var t=this;e1(this,"beforeWork",void 0),e1(this,"input",void 0),e1(this,"inputKey",void 0),e1(this,"projection",void 0),e1(this,"intent",void 0),e1(this,"generation",void 0),e1(this,"queryRevision",void 0),e1(this,"disposed",void 0),e1(this,"committing",void 0),e1(this,"listeners",void 0),e1(this,"state",void 0),e1(this,"getSnapshot",void 0),e1(this,"isInputKeyCurrent",void 0),e1(this,"isInputCurrent",void 0),e1(this,"subscribe",void 0),e1(this,"refresh",void 0),e1(this,"resetSelection",void 0),e1(this,"canSelectTime",void 0),e1(this,"selectTime",void 0),e1(this,"selectResource",void 0),e1(this,"commit",void 0),this.beforeWork=e,this.inputKey="",this.intent={requirementSelections:[]},this.generation=0,this.queryRevision=0,this.disposed=!1,this.committing=!1,this.listeners=new Set,this.state=e01(),this.getSnapshot=()=>this.state,this.isInputKeyCurrent=(e,t)=>{var l;return!this.disposed&&(null==(l=this.input)?void 0:l.os)===e&&this.inputKey===t},this.isInputCurrent=e=>{var t;return!this.disposed&&(null==(t=this.input)?void 0:t.os)===e.os&&this.inputKey===e0z(e)},this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.refresh=async()=>{this.disposed||!this.input||this.committing||this.state.requiresOrderReconciliation||(this.generation++,this.queryRevision++,this.releaseCurrent(),await this.load())},this.resetSelection=async()=>{this.committing||this.disposed||this.state.requiresOrderReconciliation||(this.intent={requirementSelections:[]},await this.refresh())},this.canSelectTime=e=>{var t;let l=this.projection;return!!l&&!this.committing&&!(null==(t=this.input)?void 0:t.disabled)&&!e08(this.input)&&!this.state.requiresOrderReconciliation&&"loading"!==this.state.status&&"committed"!==this.state.status&&e0$(e,l.queryPartySize)},this.selectTime=async e=>{var t;if(!this.canSelectTime(e))return;let l=null==(t=this.projection)?void 0:t.times.find(t=>e0F(t,e)&&t.availabilityContextId===e.availabilityContextId&&t.availabilityContextVersion===e.availabilityContextVersion);if(l)return this.resolveTime(l,!0)},this.selectResource=async(e,t)=>{let l=this.projection,i=this.input;if(!l||!i||i.disabled||e08(i)||this.committing||"loading"===this.state.status||"committed"===this.state.status||this.state.requiresOrderReconciliation)return;let a=this.state.resourceGroups,n=a.find(t=>e0R(t.groupId,e));if(!n||!this.intent.candidate||e0M(n,i.resourceSettings)||null==t&&(n.required||n.min>0)||null!=t&&!n.options.some(e=>e0R(e.resourceId,t)&&e0$(e,l.queryPartySize)))return;let r=this.intent.requirementSelections.filter(e=>!e0V(e,n));r.push({requirementGroupId:n.groupId,formId:n.formId,resourceIds:null==t?[]:[t]}),this.intent={...this.intent,requirementSelections:r},this.queryRevision++;let o=l.times.find(e=>e0F(e,this.intent.candidate));if(o&&e0$(o,l.queryPartySize))return this.resolveTime(o,!1);this.publish({status:"selecting",ready:!1,reasonCodes:this.intent.candidate?["SELECTED_TIME_UNAVAILABLE"]:[],...e06(this.intent),resourceGroups:a,selectedResourceDetails:e02(l,r)})},this.commit=async function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.input;if(!(null==i?void 0:i.os.commitAvailabilitySelection))throw new e0L(["AVAILABILITY_UNSUPPORTED"]);let a=t.projection;if(t.disposed||t.committing||!t.state.ready||!a||!t.intent.candidate||t.state.requiresOrderReconciliation)throw new e0L(["BOOKING_SELECTION_NOT_READY"]);if(!e0R(e.product_id??e.id,a.productId))throw new e0L(["PRODUCT_SELECTION_CHANGED"]);if(Number(e.num??e.quantity)!==i.quantity)throw new e0L(["QUANTITY_SELECTION_CHANGED"]);let n=l.mode||(i.editingProductLineUid?"edit":"add");if("add"!==n&&!i.editingProductLineUid||"add"===n&&i.editingProductLineUid)throw new e0L(["BOOKING_EDIT_IDENTITY_REQUIRED"]);if("replace"===n&&!Array.isArray(l.relatedRetailProducts))throw new e0L(["RELATED_PRODUCTS_REQUIRED"]);let r=t.generation,o=t.inputKey,s=e06(t.intent),d=e0U(s),c=()=>{var e,i;if(t.disposed||t.generation!==r||t.inputKey!==o||e0U(t.intent)!==d||(null==(e=t.input)?void 0:e.disabled)||e08(t.input))throw new e0L(["BOOKING_SELECTION_CHANGED"]);null==(i=l.availabilityCommitGuard)||i.call(l)};t.committing=!0,t.publish({status:"committing",ready:!1,reasonCodes:[],error:void 0});let u=!1;try{var p,m;c(),u=!0;let r=i.os.commitAvailabilitySelection,o=await r.call(i.os,a.contextId,{...l,mode:n,customerSelectionSnapshot:!0,productLineUid:i.editingProductLineUid,orderProduct:e,candidate:s.candidate,requirementSelections:s.requirementSelections,partySize:a.partySize,bookingCount:a.bookingCount,availabilityCommitGuard:c});if((null==(p=o.validation)?void 0:p.ok)===!1)throw new e0L((null==(m=o.validation.conflicts)?void 0:m.map(e=>e.code||"BOOKING_COMMIT_FAILED"))||["BOOKING_COMMIT_FAILED"]);return t.publish({status:"committed",ready:!1,reasonCodes:[],candidate:s.candidate,selectedResourceDetails:e02(a,s.requirementSelections)}),o}catch(l){let e=!!l&&"object"==typeof l&&"code"in l&&"BUSINESS_UNAVAILABLE"===l.code;throw t.publish({status:"error",ready:!1,reasonCodes:e04(l),error:e03(l),requiresOrderReconciliation:u&&!e}),l}finally{t.committing=!1}}}}function e07(){if("u">typeof window&&"u">typeof document&&"visible"===document.visibilityState&&"function"==typeof window.requestAnimationFrame&&"function"==typeof window.cancelAnimationFrame)return new Promise(e=>{let t,l,i=!1,a=()=>{i||(i=!0,void 0!==t&&window.cancelAnimationFrame(t),void 0!==l&&window.clearTimeout(l),e())};l=window.setTimeout(a,180);try{t=window.requestAnimationFrame(()=>{try{t=window.requestAnimationFrame(a)}catch{a()}})}catch{a()}})}function e09(e){let{label:t,value:l,options:i,onChange:a,onReselect:n,describedBy:r,invalid:o,busy:s=!1}=e,d=dq("booking-time");return(0,eH.jsx)("div",{className:"time-choices-grid","data-has-end":i.some(e=>!!e.end),role:"radiogroup","aria-label":t,"aria-describedby":r,"aria-invalid":o||void 0,"aria-busy":s||void 0,children:i.map(e=>(0,eH.jsxs)("label",{className:"time-choice","data-unavailable":e.unavailable||void 0,children:[(0,eH.jsx)("input",{className:"sr-only",type:"radio",name:d,value:e.id,checked:l===e.id,disabled:e.disabled,onChange:()=>a(e.id),onKeyDown:t=>{n&&l===e.id&&(" "===t.key||"Enter"===t.key)&&(t.preventDefault(),n())},onClick:()=>{l===e.id&&(null==n||n())}}),(0,eH.jsxs)("span",{className:"time-choice-card",children:[l===e.id&&(0,eH.jsx)(eXU,{className:"time-choice-check",size:12,weight:"fill","aria-hidden":"true"}),(0,eH.jsxs)("span",{children:[e.indicator&&(0,eH.jsx)("span",{className:"time-choice-availability","data-tone":e.indicator.tone,role:"img","aria-label":e.indicator.label,"aria-hidden":s||void 0}),e.start,e.end&&`–${e.end}`]}),e.description&&(0,eH.jsx)("small",{"aria-hidden":s||void 0,children:e.description})]})]},e.id))})}function e2e(e){let{label:t,value:l}=e;return(0,eH.jsxs)("div",{className:"time-choice-validity",role:"status","aria-live":"polite","aria-atomic":"true",children:[(0,eH.jsx)("strong",{children:t}),(0,eH.jsx)("span",{children:l})]})}let e2t=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M125.18,156.94a64,64,0,1,0-82.36,0,100.23,100.23,0,0,0-39.49,32,12,12,0,0,0,19.35,14.2,76,76,0,0,1,122.64,0,12,12,0,0,0,19.36-14.2A100.33,100.33,0,0,0,125.18,156.94ZM44,108a40,40,0,1,1,40,40A40,40,0,0,1,44,108Zm206.1,97.67a12,12,0,0,1-16.78-2.57A76.31,76.31,0,0,0,172,172a12,12,0,0,1,0-24,40,40,0,1,0-10.3-78.67,12,12,0,1,1-6.16-23.19,64,64,0,0,1,57.64,110.8,100.23,100.23,0,0,1,39.49,32A12,12,0,0,1,250.1,205.67Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M136,108A52,52,0,1,1,84,56,52,52,0,0,1,136,108Z",opacity:"0.2"}),eC.createElement("path",{d:"M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M164.47,195.63a8,8,0,0,1-6.7,12.37H10.23a8,8,0,0,1-6.7-12.37,95.83,95.83,0,0,1,47.22-37.71,60,60,0,1,1,66.5,0A95.83,95.83,0,0,1,164.47,195.63Zm87.91-.15a95.87,95.87,0,0,0-47.13-37.56A60,60,0,0,0,144.7,54.59a4,4,0,0,0-1.33,6A75.83,75.83,0,0,1,147,150.53a4,4,0,0,0,1.07,5.53,112.32,112.32,0,0,1,29.85,30.83,23.92,23.92,0,0,1,3.65,16.47,4,4,0,0,0,3.95,4.64h60.3a8,8,0,0,0,7.73-5.93A8.22,8.22,0,0,0,252.38,195.48Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M112.6,158.43a58,58,0,1,0-57.2,0A93.83,93.83,0,0,0,5.21,196.72a6,6,0,0,0,10.05,6.56,82,82,0,0,1,137.48,0,6,6,0,0,0,10-6.56A93.83,93.83,0,0,0,112.6,158.43ZM38,108a46,46,0,1,1,46,46A46.06,46.06,0,0,1,38,108Zm211,97a6,6,0,0,1-8.3-1.74A81.8,81.8,0,0,0,172,166a6,6,0,0,1,0-12,46,46,0,1,0-17.08-88.73,6,6,0,1,1-4.46-11.14,58,58,0,0,1,50.14,104.3,93.83,93.83,0,0,1,50.19,38.29A6,6,0,0,1,249,205Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M107.19,159a56,56,0,1,0-46.38,0A91.83,91.83,0,0,0,6.88,197.81a4,4,0,1,0,6.7,4.37,84,84,0,0,1,140.84,0,4,4,0,1,0,6.7-4.37A91.83,91.83,0,0,0,107.19,159ZM36,108a48,48,0,1,1,48,48A48.05,48.05,0,0,1,36,108Zm212,95.35a4,4,0,0,1-5.53-1.17A83.81,83.81,0,0,0,172,164a4,4,0,0,1,0-8,48,48,0,1,0-17.82-92.58,4,4,0,1,1-3-7.43,56,56,0,0,1,44,103,91.83,91.83,0,0,1,53.93,38.86A4,4,0,0,1,248,203.35Z"}))]]),e2l=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2t}));function e2i(e){let{label:t,value:l,options:i,onChange:a,disabled:n=!1}=e;return(0,eH.jsx)("div",{className:"resource-picker",role:"group","aria-label":t,children:i.map(e=>(0,eH.jsxs)("button",{type:"button",className:"resource-card","aria-pressed":l===e.id,disabled:n||e.disabled,onClick:()=>a(e.id),children:[e.image&&(0,eH.jsx)("img",{src:e.image,alt:""}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("h3",{children:e.name}),e.description&&(0,eH.jsx)("p",{children:e.description}),(e.capacity||e.price)&&(0,eH.jsxs)("div",{className:"resource-card-meta",children:[e.capacity&&(0,eH.jsxs)("span",{children:[(0,eH.jsx)(e2l,{size:15}),e.capacity]}),e.price&&(0,eH.jsx)("b",{children:e.price})]}),e.status&&(0,eH.jsx)("p",{children:e.status})]})]},e.id))})}e2l.displayName="UsersIcon";let e2a=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z"}))]]),e2n=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2a}));e2n.displayName="WarningCircleIcon";let e2r=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),e2o=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2r}));function e2s(e){let{children:t,tone:l="info",id:i,className:a="",icon:n}=e,r="error"===l||"warning"===l?e2n:"success"===l?eXU:e2o;return(0,eH.jsxs)("div",{id:i,className:`shared-notice ${l} ${a}`,role:"error"===l?"alert":"status",children:[n??(0,eH.jsx)(r,{size:20,"aria-hidden":"true"}),(0,eH.jsx)("div",{className:"shared-notice-content",children:t})]})}function e2d(e){let{title:t,description:l,icon:i,decoration:a,eyebrow:n,children:r,actions:o,className:s="",pending:d=!1,headingLevel:c=2}=e;return(0,eH.jsxs)("div",{className:`status-panel ${s}`,role:d?"status":void 0,children:[a,i&&(0,eH.jsx)("div",{className:"status-panel-icon","aria-hidden":"true",children:i}),n,t&&(0,eH.jsx)(1===c?"h1":3===c?"h3":"h2",{children:t}),l&&(0,eH.jsx)("p",{children:l}),r,o]})}e2o.displayName="InfoIcon";let e2c=e=>"number"==typeof e&&Number.isFinite(e)&&e>=0;function e2u(e,t){if(!Array.isArray(e.requirementGroups)||e.requirementGroups.some(e=>!e||"object"!=typeof e))return;let l=e.requirementGroups.filter(e=>!1!==e.required);if(!l.length)return;let i=l.map(e=>{let l=function(e){if(!(!Array.isArray(e.options)||e.options.some(e=>!e||!["available","limited","full","conflict","unavailable","past"].includes(e.status))))return e.options.filter(e=>"available"===e.status||"limited"===e.status)}(e);return void 0===l?void 0:t(l)});return i.every(e2c)?Math.min(...i):void 0}function e2p(e){if(!e.some(e=>!e2c(e.remainingCapacity)))return e.reduce((e,t)=>Math.max(e,t.remainingCapacity),0)}function e2m(e){if(!e.some(e=>!e2c(e.remainingCapacity)))return e.reduce((e,t)=>e+t.remainingCapacity,0)}function e2g(e){let{date:t,locale:l="en"}=e;return(0,eH.jsxs)("div",{className:"selection-section-summary",style:{justifyContent:"flex-start"},children:[(0,eH.jsx)(e0r,{size:21,"aria-hidden":"true"}),(0,eH.jsx)("b",{children:(0,eH.jsx)("time",{dateTime:t,children:e0y(t,l)})})]})}function e2h(e){let{id:t,date:l,today:i,locale:a="en",stepStatus:n}=e,r=l===i?"zh"===a?"当前日期":"Current date":"zh"===a?"游玩日期":"Visit date";return(0,eH.jsx)(eXK,{id:t,number:1,stepStatus:n,title:r,className:"visit-date-summary",lang:a,open:!0,onToggle:()=>{},children:(0,eH.jsx)(e2g,{date:l,locale:a})})}let e2v=(0,eC.forwardRef)((e,t)=>{var l;let{locale:i="en",resourcePresentation:a=[]}=e,n=(null==(l=eJF())?void 0:l.presentationPlatform)==="kiosk",r=e0N[i],o=function(e){var t,l;let i=null==(t=eJF())?void 0:t.presentationPlatform,a=(0,eC.useRef)(i);a.current=i;let n=(0,eC.useRef)(e);n.current=e;let r=(0,eC.useRef)(),o=(0,eC.useRef)(null),[s,d]=(0,eC.useState)(()=>new e05().getSnapshot()),c=e0z(e);r.current={os:e.os,key:c},(0,eC.useLayoutEffect)(()=>{let e=new e05(()=>"kiosk"===a.current?e07():void 0);o.current=e;let t=e.subscribe(()=>d(e.getSnapshot()));return e.setInput(n.current),()=>{t(),e.dispose(),o.current===e&&(o.current=null)}},[]),(0,eC.useLayoutEffect)(()=>{var e;null==(e=o.current)||e.setInput(n.current)},[c,e.os]);let u=(0,eC.useCallback)(async()=>{let e=o.current;e&&(await e.setInput(n.current),await e.refresh())},[]),p=(0,eC.useCallback)(async(e,t)=>{let l=o.current;if(!l)throw new e0L(["BOOKING_SELECTION_NOT_READY"]);if(!l.isInputCurrent(n.current))throw new e0L(["BOOKING_SELECTION_CHANGED"]);return l.commit(e,t)},[]),m=(0,eC.useCallback)(async e=>{let t=o.current;if(null==t?void 0:t.isInputCurrent(n.current)){let l=await t.selectTime(e);if(o.current===t&&t.isInputCurrent(n.current))return l}},[]),g=(0,eC.useCallback)(async(e,t)=>{let l=o.current;if(null==l?void 0:l.isInputCurrent(n.current)){let i=await l.selectResource(e,t);if(o.current===l&&l.isInputCurrent(n.current))return i}},[]),h=(0,eC.useCallback)(e=>{let t=o.current,l=r.current;return!!l&&!!(null==t?void 0:t.isInputKeyCurrent(l.os,l.key))&&t.canSelectTime(e)},[]),v=(0,eC.useCallback)(async()=>{var e;await (null==(e=o.current)?void 0:e.resetSelection())},[]);return{state:(null==(l=o.current)?void 0:l.isInputKeyCurrent(e.os,c))?s:{...s,status:"loading",ready:!1},refresh:u,commit:p,selectTime:m,selectResource:g,canSelectTime:h,resetSelection:v}}(e),{state:s}=o,d=(0,eC.useRef)(e.onSelectionChange);d.current=e.onSelectionChange;let c=(0,eC.useRef)(e);c.current=e;let[u,p]=(0,eC.useState)(!1),m=(0,eC.useRef)(!1),[g,h]=(0,eC.useState)(!1),v=(0,eC.useRef)(null),f=(0,eC.useRef)(null),y=(0,eC.useRef)(),b=(0,eC.useRef)(null),x=(0,eC.useRef)(null),k=(0,eC.useRef)(!0),_=eXN();(0,eC.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let w=(0,eC.useCallback)(async()=>{let e=c.current;if(e.resourceSettingsFailed&&e.onRetryResourceSettings){try{await e.onRetryResourceSettings()}catch{}return}await o.refresh()},[o.refresh]);(0,eC.useImperativeHandle)(t,()=>({refresh:w,commit:(e,t)=>o.commit(e,{...t,availabilityCommitGuard:()=>{var e;if(m.current)throw new e0L(["BOOKING_SELECTION_CHANGED"]);null==t||null==(e=t.availabilityCommitGuard)||e.call(t)}})}),[w,o.commit]),(0,eC.useEffect)(()=>{d.current(u?{...s,ready:!1}:s)},[s,u]);let S="loading"===s.status||"committing"===s.status||u,j=!!e.disabled||!!e.interactionDisabled||S||"committed"===s.status||!!s.requiresOrderReconciliation,N=e.reasonFormatter||(e=>e0C(e,i)),C=e0O(e.product),M=t=>t.resourceGroups.filter(l=>{if(!1===e.resourceSettingsReady||e.resourceSettingsFailed||e0M(l,e.resourceSettings))return!1;if("ticket"!==e.mode||!l.required&&0===l.min)return!0;let i=C[l.groupId]||(null==l.formId?[]:C[String(l.formId)])||[],a=t.requirementSelections.find(e=>e0V(e,l));return!(1===i.length&&(null==a?void 0:a.resourceIds.length)===1&&e0R(i[0],a.resourceIds[0])&&l.options.some(e=>e0R(e.resourceId,i[0])&&e0$(e,(t.partySize||0)*t.bookingCount)))}),T=(e,t)=>{var l,i;null==(l=(i=c.current).onExplicitSelection)||l.call(i,e,t),!c.current.renderContent&&("time"===e&&M(t).length?_(()=>f.current):t.ready&&_(c.current.actionTarget||(()=>{var e,t;return(null==(t=v.current)||null==(e=t.closest('[role="dialog"]'))?void 0:e.querySelector(".reservation-submit"))||null}),{focus:"control"}))},I=async t=>{var l;if(j)return;let i=null==(l=e.operationLog)?void 0:l.capture(),a=await o.selectTime(t);return a&&k.current&&(null==i||i("time_selected",{productId:a.productId,selectedDate:e.date,startAt:t.bookingStartAt||t.startAt,endAt:t.bookingEndAt||t.endAt}),T("time",a)),a},P=async(t,l)=>{var i;if(j)return;let a=null==(i=e.operationLog)?void 0:i.capture(),n=await o.selectResource(t,l);return n&&k.current&&(null==a||a("resource_selected",{productId:n.productId,selectedDate:e.date,groupId:t,resourceId:l}),T("resource",n)),n},A=async t=>{if((!c.current.dateReadOnly||t===c.current.date)&&!j){if(h(!1),t===e.date){x.current&&(x.current.open=!1),c.current.renderContent||_(()=>b.current);return}m.current=!0,p(!0);try{if(await e.onDateChange(t)===!1)return;k.current&&(x.current&&(x.current.open=!1),c.current.renderContent||_(()=>b.current))}catch{k.current&&h(!0)}finally{m.current=!1,k.current&&p(!1)}}},D=e0H(s.times,(s.partySize||0)*s.bookingCount),E=s.times.find(e=>e0F(e,s.candidate)),O=E&&e0$(E,(s.partySize||0)*s.bookingCount)?s.candidate:void 0,z=O?`${s.contextId||""}:${e0B(O)}`:void 0,L=!!z&&!u&&("selecting"===s.status||"ready"===s.status||y.current===z);(0,eC.useEffect)(()=>{!z||u?y.current=void 0:("selecting"===s.status||"ready"===s.status)&&(y.current=z)},[z,s.status,u]);let R="loading"===s.status||u?e0_(i,"timeLoading"):"error"===s.status?e0_(i,"timeLoadFailed"):O?`${e2f(O.bookingStartAt||O.startAt,O.startTime)}–${e2f(O.bookingEndAt||O.endAt,O.endTime)}`:e0_(i,D.some(e=>{let{candidate:t}=e;return e0$(t,(s.partySize||0)*s.bookingCount)})?"timeNotSelected":"timeUnavailable"),$="party"===e.mode&&!s.times.length&&("idle"===s.status||"loading"===s.status||u),F="party"===e.mode&&!s.times.length&&"error"===s.status&&!s.requiresOrderReconciliation,q=(0,eH.jsxs)("div",{ref:b,tabIndex:-1,children:["ticket"===e.mode&&(0,eH.jsx)(e2e,{label:e0_(i,"validPlayTime"),value:R}),$&&(0,eH.jsx)(e2d,{pending:!0,description:e0_(i,"timeLoading")}),F&&(0,eH.jsx)(e2d,{description:e0_(i,"timeLoadFailed"),actions:(0,eH.jsx)(eXE,{secondary:!0,disabled:j,onClick:()=>{w()},children:r.retry})}),(0,eH.jsx)(e09,{label:r.time,value:E?e0B(E):"",busy:n&&S,options:D.map(t=>{var l;let{id:a,candidate:d}=t,c=e0$(d,(s.partySize||0)*s.bookingCount),u=function(e){let{candidate:t,settings:l,mode:i}=e,a=Array.isArray(l)?Array.from(new Set(l.filter(e=>"maximum_capacity"===e||"available_quantity"===e||"colour_indicators"===e))):[],n={showColourIndicator:a.includes("colour_indicators")};return a.includes("maximum_capacity")&&(n.maximumCapacity=e2c(t.maxPartySize)?t.maxPartySize:e2u(t,e2p)),a.includes("available_quantity")&&(n.availableQuantity=e2u(t,"party"===i?e=>e.length:e2m)),n}({candidate:d,settings:e.capacityDisplayContent,mode:e.mode}),p=(!S||n)&&c&&(void 0!==u.maximumCapacity||void 0!==u.availableQuantity);return{id:a,start:d.startTime,end:d.endTime,disabled:j||!o.canSelectTime(d),unavailable:n?!c:void 0,indicator:(!S||n)&&u.showColourIndicator?{tone:c?"limited"===d.status?"limited":"available":"unavailable",label:c?"limited"===d.status?e0_(i,"capacityLimited"):e0_(i,"capacityAvailable"):r.unavailable}:void 0,description:c?p?(0,eH.jsxs)(eH.Fragment,{children:[void 0!==u.maximumCapacity&&(0,eH.jsx)("span",{className:"venue-booking-time-capacity",children:e0_(i,"timeMaximumCapacity").replace("{count}",String(u.maximumCapacity))}),void 0!==u.availableQuantity&&(0,eH.jsx)("span",{className:"venue-booking-time-capacity",children:e0_(i,"party"===e.mode?"timeRoomsLeft":"timeSpacesLeft").replace("{count}",String(u.availableQuantity))})]}):void 0:N((null==(l=d.reasonCodes)?void 0:l[0])||"UNAVAILABLE")}}),onChange:e=>{var t;let l=null==(t=D.find(t=>t.id===e))?void 0:t.candidate;l&&I(l)},onReselect:()=>{!j&&E&&I(E)}}),!S&&!s.times.length&&"idle"!==s.status&&"error"!==s.status&&(0,eH.jsx)("p",{children:r.noTimes})]}),B=(0,eH.jsxs)("div",{ref:f,tabIndex:-1,children:[!E&&(0,eH.jsx)("p",{children:"party"===e.mode?r.timeBeforeRoom:r.selectTime}),M(s).map(t=>{var l;let n=null==(l=e.resourceSettings)?void 0:l[String(t.formId??t.groupId)],o="zh"===i?"zh-CN":"en",d=Rz(null==n?void 0:n.name,void 0,o).trim()||Rz(t.title,void 0,o).trim()||("party"===e.mode?r.room:r.resource),c=s.requirementSelections.find(e=>e0V(e,t)),u=!j&&!!E,p=1===t.options.length?t.options:t.options.filter(e=>e0$(e,(s.partySize||0)*s.bookingCount)),m=p.map(t=>{var l,i,n;let o=a.find(e=>e0R(e.resourceId,t.resourceId)),d=s.resources.find(e=>e0R(e.id,t.resourceId)),c=e0$(t,(s.partySize||0)*s.bookingCount),u=null==d||null==(l=d.raw)?void 0:l.cover,p=Array.isArray(u)?null==(i=u.find(e=>"string"==typeof(null==e?void 0:e.url)&&e.url.trim()))?void 0:i.url:void 0,m=[null==o?void 0:o.image,p,null==d||null==(n=d.raw)?void 0:n.image].find(e=>"string"==typeof e&&e.trim()),g=[null==o?void 0:o.name,t.resourceName,null==d?void 0:d.name].find(e=>"string"==typeof e&&e.trim())||`${"party"===e.mode?r.room:r.resource} ${t.resourceId}`;return{id:String(t.resourceId),name:g,image:m,disabled:!c}});return t.required||0!==t.min||m.unshift({id:"",name:r.none,status:""}),(0,eH.jsxs)("fieldset",{className:"venue-booking-availability__group",disabled:!u,children:[(0,eH.jsxs)("legend",{children:[d,t.required||0!==t.min?"":` \xb7 ${r.optional}`]}),(0,eH.jsx)(e2i,{label:d,value:(null==c?void 0:c.resourceIds.length)?String(c.resourceIds[0]):"",options:m,disabled:!u,onChange:e=>{let l=t.options.find(t=>String(t.resourceId)===e);l?P(t.groupId,l.resourceId):""!==e||t.required||0!==t.min||P(t.groupId,null)}}),!p.length&&(0,eH.jsx)("p",{children:r.noResources})]},t.groupId)})]}),H=e.dateReadOnly?(0,eH.jsx)(e2g,{date:e.date,locale:i}):e.renderDatePicker?e.renderDatePicker({date:e.date,disabled:j,onChange:e=>{A(e)}}):(0,eH.jsx)("input",{type:"date","aria-label":r.date,value:e.date,disabled:j,onChange:e=>{A(e.target.value)}}),V=(e,t)=>(0,eH.jsxs)("section",{className:"reservation-section venue-booking-availability__section","aria-label":e,children:[(0,eH.jsx)("h3",{children:e}),t]}),U=e.dateReadOnly?H:"ticket"===e.mode?(0,eH.jsxs)("details",{ref:x,className:"reservation-date",children:[(0,eH.jsxs)("summary",{"aria-disabled":j,onClick:e=>{j&&e.preventDefault()},children:[(0,eH.jsx)(e0r,{size:21,"aria-hidden":"true"}),(0,eH.jsx)("span",{children:(0,eH.jsx)("b",{children:e0y(e.date,i)})}),(0,eH.jsx)("span",{className:"date-change-label",children:e0_(i,"changeDate")})]}),(0,eH.jsx)("div",{className:"reservation-date-picker",children:H})]}):e.renderDatePicker?H:V(r.date,H),Y="ticket"===e.mode?(0,eH.jsx)("section",{className:"reservation-section venue-booking-availability__section","aria-label":e0_(i,"validPlayTime"),children:q}):V(r.time,q),W=V("party"===e.mode?r.room:r.resource,B),K=s.reasonCodes.filter(e=>!["RESOURCE_REQUIRED","PARTY_ROOM_REQUIRED","TIME_REQUIRED"].includes(e)),G=!S&&("error"===s.status||"blocked"===s.status||s.requiresOrderReconciliation||K.length>0),Q=G?Array.from(new Set(K.map(N))):[],Z=M(s).length>0||!s.resourceGroups.length&&e0I(e.product,e.resourceSettings),J=!1!==e.resourceSettingsReady&&!e.resourceSettingsFailed&&("party"===e.mode||L)&&Z,X=(0,eH.jsxs)(eH.Fragment,{children:[(G||g)&&(0,eH.jsxs)("div",{className:"venue-booking-availability__status",role:"alert",children:[s.requiresOrderReconciliation?(0,eH.jsx)("p",{children:r.reconciliation}):Q.map(e=>(0,eH.jsx)("p",{children:e},e)),g&&(0,eH.jsx)("p",{children:r.dateFailed})]}),("error"===s.status||"blocked"===s.status)&&!s.requiresOrderReconciliation&&!F&&(0,eH.jsx)(eXE,{secondary:!0,className:"venue-booking-availability__retry",disabled:j,onClick:()=>{w()},children:r.retry}),s.reasonCodes.some(e=>"SELECTED_RESOURCE_UNAVAILABLE"===e||"SELECTED_TIME_UNAVAILABLE"===e)&&(0,eH.jsx)(eXE,{secondary:!0,className:"venue-booking-availability__retry",disabled:j,onClick:()=>{o.resetSelection()},children:r.reselect})]}),ee={state:s,busy:S,disabled:j,dateContent:H,timeContent:q,resourceContent:B,datePanel:U,timePanel:Y,resourcePanel:W,statusPanel:X,showResources:J,actions:{changeDate:A,selectTime:I,selectResource:P,refresh:w,resetSelection:o.resetSelection}};return(0,eH.jsx)("div",{ref:v,className:`venue-booking-availability ${e.className||""}`,"aria-busy":S,children:e.renderContent?e.renderContent(ee):(0,eH.jsxs)(eH.Fragment,{children:[U,Y,J&&W,X]})})});function e2f(e,t){let l=null==e?void 0:e.match(/[T ](\d{2}:\d{2})(?::(\d{2}))?/);return l?`${l[1]}${l[2]&&"00"!==l[2]?`:${l[2]}`:""}`:t}async function e2y(e){let t=iM(e.product,e.skuValue,{requiredOptionValidation:!1,overSold:1===Number(e.product.over_sold)});if(!t)throw Error("The selected product options are no longer available.");return ekh({productData:e.product,skuValue:t,quantity:e.quantity,selectedCandidate:e.candidate,duration:null,customerId:e.customerId,contextKey:e.scopeKey},{calculateProductBookingPrice:async t=>{let l=await e.os.calculateProductBookingPrice(t),i=t.product;if(Number(l.product_id)!==Number(i.product_id??i.id)||Number(l.product_variant_id||0)!==Number(i.product_variant_id||0)||null==l.unit_price||""===String(l.unit_price).trim()||!Number.isFinite(Number(l.unit_price))||0>Number(l.unit_price))throw Error("The booking price is unavailable or does not match the selected product.");return l},channel:"online_ordering"})}e2v.displayName="BookingSelectionPanel";let e2b=()=>{};function e2x(e){try{let t=e&&("object"==typeof e||"function"==typeof e)?e:void 0,l=null==t?void 0:t.name,i=null==t?void 0:t.code;return{errorName:"string"==typeof l&&l?l.slice(0,80):"unknown",..."string"==typeof i?{errorCode:i.slice(0,80)}:"number"==typeof i&&Number.isFinite(i)?{errorCode:i}:{}}}catch{return{errorName:"unknown"}}}let e2k=e=>"number"==typeof e?Number.isFinite(e)?e:void 0:"string"==typeof e&&e.trim()?e.trim():void 0,e2_=new Set(["cacheid","cache_id","scene","temp","ticketsmenulistids","partymenulistids","extrasmenulistids","menulistids","businesscode","business_code","channel","template","display_template_id","type","mode","lang","locale","date","schedule_date","resourceid","productid"]);function e2w(e){var t,l,i,a,n;let{mode:r,draft:o,context:s,date:d,scopeKey:c,locale:u,priceSource:p}=e,m=(e,t)=>"zh"===u?t:e,g=s.sales.bookingTicket,h=exR(),v=(0,eC.useRef)(null),[f,y]=(0,eC.useState)(o.configuration),[b,x]=(0,eC.useState)(()=>{let e=Number(o.quantity);return Number.isSafeInteger(e)&&e>0?e:1}),[k,_]=(0,eC.useState)(),w=(0,eC.useRef)(o.initialSelection),[S,j]=(0,eC.useState)(),[N,C]=(0,eC.useState)(),[M,T]=(0,eC.useState)(!1),I=(0,eC.useRef)(!1),P=(0,eC.useRef)(!0),A=(0,eC.useRef)(e.onBusyChange);A.current=e.onBusyChange;let D=(0,eC.useRef)(e.onDraftChange);D.current=e.onDraftChange,(0,eC.useEffect)(()=>(P.current=!0,()=>{var e;P.current=!1,null==(e=A.current)||e.call(A,!1)}),[]);let E=(0,eC.useMemo)(()=>e0E(o.detail,f.skuValue),[o.detail,f]);(0,eC.useEffect)(()=>{var e;k&&"idle"!==k.status&&!("blocked"===k.status&&k.reasonCodes.includes("BOOKING_DISABLED"))&&(w.current=k),null==(e=D.current)||e.call(D,{configuration:f,quantity:b,initialSelection:w.current})},[f,b,k,o]);let O=JSON.stringify([c,r,o.openId??(null==(t=o.plan)?void 0:t.openId),o.detail.product_id??o.detail.id,o.lineUid,d,b,f.skuValue,k&&e0U(k),e.customerId]),z=(0,eC.useRef)({revision:O,disabled:e.disabled,os:g,draft:o,priceSource:p});z.current={revision:O,disabled:e.disabled,os:g,draft:o,priceSource:p},(0,eC.useEffect)(()=>{let t=!0;if(j(void 0),(null==k?void 0:k.candidate)&&["selecting","ready"].includes(k.status)&&("tickets"===r||k.ready)&&!k.requiresOrderReconciliation&&k.candidate.date===d&&k.candidate.availabilityContextId===k.contextId&&k.times.some(e=>e0q(e,k.candidate)&&e0$(e,(k.partySize||0)*k.bookingCount)))return C(void 0),e2y({os:p,product:E.product,skuValue:f.skuValue,candidate:k.candidate,quantity:b,customerId:e.customerId,scopeKey:c}).then(e=>{t&&j(e)}).catch(e=>{t&&C(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[g,p,o,E.product,O,null==k?void 0:k.ready,null==k?void 0:k.status,null==k?void 0:k.contextId,null==k||null==(l=k.candidate)?void 0:l.availabilityContextVersion]);let L=async()=>{var t,l,i,a,n,y,x,_;if(I.current||e.disabled||!S||!(null==k?void 0:k.ready)||!k.candidate||!v.current)return!1;I.current=!0,T(!0),null==(t=A.current)||t.call(A,!0),C(void 0);let w=null==(l=g.getTempOrder)?void 0:l.call(g),N=e=>{var t;return JSON.stringify([null==e?void 0:e.order_id,null==e?void 0:e.external_sale_number,null==e||null==(t=e._extend)?void 0:t.localId])},M=N(w),D=null==(i=e.operationLog)?void 0:i.capture(),L=o.lineUid?"cart_update":"cart_add",R={productId:E.product.product_id??E.product.id,quantity:b,selectedDate:d,startAt:k.candidate.bookingStartAt||k.candidate.startAt,endAt:k.candidate.bookingEndAt||k.candidate.endAt,resourceIds:null==(a=k.requirementSelections)?void 0:a.flatMap(e=>e.resourceIds).slice(0,100)};null==D||D(`${L}_requested`,R);let $=()=>{var e,t;return P.current&&z.current.revision===O&&z.current.os===g&&z.current.draft===o&&z.current.priceSource===p&&(null==(e=g.getTempOrder)?void 0:e.call(g))===w&&N(null==(t=g.getTempOrder)?void 0:t.call(g))===M},F=()=>{if(!$()||z.current.disabled)throw Error(m("Your selection changed. Please review it again.","选择已变化,请重新确认。"))},q=!1;try{F();let t=eXy(g)?e07():void 0;t&&(await t,F()),await h.assertCanMutate(),F();let l=await e2y({os:p,product:E.product,skuValue:f.skuValue,candidate:k.candidate,quantity:b,customerId:e.customerId,scopeKey:c});if(F(),l.compositeLineTotal!==S.compositeLineTotal)throw j(l),Error(m("The price changed. Please review the new amount and confirm again.","价格已更新,请核对新金额后再次确认。"));let i=(_={product:E.product,skuValue:f.skuValue,quote:l,quantity:b,candidate:k.candidate,role:r,scopeKey:c},ekA({...HD({productData:_.product,skuValue:_.skuValue,quantity:_.quantity,booking:{startDate:eS()(_.candidate.startAt),endDate:eS()(_.candidate.endAt),startTime:_.candidate.startTime,endTime:_.candidate.endTime,resource:null,capacity:null,duration:null,holderIds:[]},bookingPrice:{status:"ready",requestKey:_.scopeKey,quote:_.quote}},{moduleTypes:["sku","bookingPrice"],requireBookingPrice:!0}),quantity:_.quantity,num:_.quantity,metadata:{..._.product.metadata,venue_booking_role:"tickets"===_.role?"tickets":"party_main",venue_booking_scope_key:_.scopeKey,venue_booking_service_datetime:_.candidate.startAt}})),a=await s.cart.prepareAllergyBeforeCommit({product:i,flowId:(null==(n=o.plan)?void 0:n.openId)||`${c}:${o.lineUid||o.detail.id}`,perFlow:!0});if(F(),!a.allowed)return null==D||D(`${L}_cancelled`,{...R,reason:"allergy_confirmation"}),!1;let d=e.prepareRelated?await e.prepareRelated(k):{};if(F(),await h.assertCanMutate(),F(),null==(y=d.availabilityCommitGuard)||y.call(d),await v.current.commit(i,{...d,availabilityCommitGuard:()=>{var e;F(),null==(e=d.availabilityCommitGuard)||e.call(d)},salesNotes:a.noteDraft?[a.noteDraft]:void 0,allowBookingReprice:!0}),q=!0,null==D||D(`${L}_succeeded`,R),!$())return!0;return s.cart.refreshCartSnapshot(),$()&&await e.onCommitted(),!0}catch(e){if(q)return null==D||D("cart_view_refresh_failed",{...R,...e2x(e)},"warning"),console.warn("[VenueBooking] Selection saved; view refresh failed",e),$()&&C(m("Your selection was saved, but the view could not refresh. Reopen your order to review it.","选择已保存,但页面刷新失败。请重新打开订单核对。")),!0;if(null==D||D(`${L}_failed`,{...R,writeOutcome:"unconfirmed",...e2x(e)},"warning"),$()){try{s.cart.refreshCartSnapshot()}catch(e){console.warn("[VenueBooking] Could not refresh the current selection",e)}C(e instanceof e0L?e.reasonCodes.map(e=>e0C(e,u)).join(" "):e instanceof Error?e.message:String(e))}return!1}finally{I.current=!1,P.current&&(T(!1),null==(x=A.current)||x.call(A,!1))}},R={operationLog:e.operationLog,os:g,mode:"tickets"===r?"ticket":"party",date:d,product:E.product,quantity:b,editingProductLineUid:o.lineUid,initialSelection:o.initialSelection,disabled:!!e.disabled,interactionDisabled:M,onDateChange:e.onDateChange,onSelectionChange:_,locale:u,capacityDisplayContent:null==(a=g.otherParams)||null==(i=a.openData)?void 0:i["interface.capacity_display_content"],resourceSettings:null==(n=s.sales.salesSettings)?void 0:n.reservation.resourceSettings,resourceSettingsReady:"picoding"!==s.sales.salesSettingsSource||!!(s.sales.salesSettings&&!s.sales.salesSettingsError),resourceSettingsFailed:!!s.sales.salesSettingsError,onRetryResourceSettings:s.sales.ensureSalesSettings},$=!!((null==k?void 0:k.ready)&&S&&!k.requiresOrderReconciliation);return{configuration:f,setConfiguration:y,quantity:b,setQuantity:x,prepared:E,selection:k,quote:S,error:N,working:M,revision:O,panelRef:v,bookingProps:R,bookingReady:$,canCommit:$&&!e.disabled&&!M,preview:{product:E.product,configuration:f,quantity:b,date:d,editingProductLineUid:o.lineUid,candidate:null==k?void 0:k.candidate,requirementSelections:(null==k?void 0:k.requirementSelections)??[],selectedResourceDetails:(null==k?void 0:k.selectedResourceDetails)??[],quote:S},commit:L,cancel:()=>{I.current||e.onCancel()}}}let e2S=new Set(["p","div","span","br","strong","b","em","i","u","s","del","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","pre","code","a","img","hr","sub","sup","table","thead","tbody","tfoot","tr","th","td"]),e2j=new Set(["script","style","iframe","object","embed","svg","math","template","input","button","select","textarea"]),e2N=["fontWeight","fontStyle","fontSize","textDecoration","textAlign","color","backgroundColor","whiteSpace"];function e2C(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=null==e?void 0:e.trim();if(l&&(/^https?:\/\//i.test(l)||/^\/(?!\/)/.test(l)||!t&&/^(?:mailto:|tel:|#)/i.test(l)))return l}function e2M(e,t){if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;let l=e.tagName.toLowerCase();if(e2j.has(l))return null;let i=Array.from(e.childNodes,e2M);if(!e2S.has(l))return(0,eH.jsx)(eM().Fragment,{children:i},t);let a={key:t},n={};if(e2N.forEach(t=>{let l=e.style[t];l&&(n[t]=l)}),a.style=n,"a"===l&&(a.href=e2C(e.getAttribute("href")),a.target="_blank",a.rel="noopener noreferrer"),"img"===l){if(a.src=e2C(e.getAttribute("src"),!0),!a.src)return null;a.alt=e.getAttribute("alt")||"",a.loading="lazy"}if("td"===l||"th"===l)for(let[t,l]of[["colspan","colSpan"],["rowspan","rowSpan"]]){let i=Number(e.getAttribute(t));Number.isInteger(i)&&i>0&&i<=1e3&&(a[l]=i)}if("ol"===l&&e.hasAttribute("start")){let t=Number(e.getAttribute("start"));Number.isInteger(t)&&(a.start=t)}return eM().createElement(l,a,...["br","img","hr"].includes(l)?[]:i)}function e2T(e){let{content:t}=e,l=(0,eC.useMemo)(()=>"u"<typeof DOMParser?t:Array.from(new DOMParser().parseFromString(t,"text/html").body.childNodes,e2M),[t]);return(0,eH.jsx)("div",{className:"venue-product-description",children:l})}let e2I=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),eC.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),e2P=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2I}));e2P.displayName="CheckIcon";let e2A=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z",opacity:"0.2"}),eC.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z"}))]]),e2D=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2A}));e2D.displayName="ArrowSquareOutIcon";let e2E=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,36H48A20,20,0,0,0,28,56v56c0,54.29,26.32,87.22,48.4,105.29,23.71,19.39,47.44,26,48.44,26.29a12.1,12.1,0,0,0,6.32,0c1-.28,24.73-6.9,48.44-26.29,22.08-18.07,48.4-51,48.4-105.29V56A20,20,0,0,0,208,36Zm-4,76c0,35.71-13.09,64.69-38.91,86.15A126.28,126.28,0,0,1,128,219.38a126.14,126.14,0,0,1-37.09-21.23C65.09,176.69,52,147.71,52,112V60H204ZM79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,56v56c0,96-88,120-88,120S40,208,40,112V56a8,8,0,0,1,8-8H208A8,8,0,0,1,216,56Z",opacity:"0.2"}),eC.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm-34.32,69.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,42H48A14,14,0,0,0,34,56v56c0,51.94,25.12,83.4,46.2,100.64,22.73,18.6,45.27,24.89,46.22,25.15a6,6,0,0,0,3.16,0c.95-.26,23.49-6.55,46.22-25.15C196.88,195.4,222,163.94,222,112V56A14,14,0,0,0,208,42Zm2,70c0,37.76-13.94,68.39-41.44,91.06A131.17,131.17,0,0,1,128,225.72a130.94,130.94,0,0,1-40.56-22.66C59.94,180.39,46,149.76,46,112V56a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2ZM172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,44H48A12,12,0,0,0,36,56v56c0,51.16,24.73,82.12,45.47,99.1,22.4,18.32,44.55,24.5,45.48,24.76a4,4,0,0,0,2.1,0c.93-.26,23.08-6.44,45.48-24.76,20.74-17,45.47-47.94,45.47-99.1V56A12,12,0,0,0,208,44Zm4,68c0,38.44-14.23,69.63-42.29,92.71A132.45,132.45,0,0,1,128,227.82a132.23,132.23,0,0,1-41.71-23.11C58.23,181.63,44,150.44,44,112V56a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-41.17-10.83a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17Z"}))]]),e2O=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2E}));function e2z(e){let{title:t,version:l,accepted:i,lang:a,onOpen:n,disabled:r=!1}=e;return(0,eH.jsxs)("button",{type:"button",className:`checkout-agreement ${i?"accepted":""}`,"data-accepted":i,"aria-haspopup":"dialog","aria-label":`${e0_(a,"readAgreement")} \xb7 ${t} \xb7 ${e0_(a,i?"accepted":"notAccepted")}`,onClick:n,disabled:r,children:[(0,eH.jsx)("span",{className:"agreement-state","aria-hidden":"true",children:i&&(0,eH.jsx)(e2P,{size:15,weight:"bold"})}),(0,eH.jsxs)("span",{className:"agreement-copy",children:[(0,eH.jsx)("b",{children:t}),(0,eH.jsxs)("small",{children:[l&&(0,eH.jsxs)(eH.Fragment,{children:[e0_(a,"version")," ",l," \xb7"," "]}),e0_(a,i?"accepted":"notAccepted")]})]}),(0,eH.jsxs)("span",{className:"agreement-open","aria-hidden":"true",children:[(0,eH.jsx)("span",{children:e0_(a,"readAgreement")}),(0,eH.jsx)(e2D,{size:15})]})]})}function e2L(e){let{title:t,version:l,lang:i,children:a,onConfirm:n,onClose:r}=e;return(0,eH.jsxs)(e0t,{wide:!0,className:"agreement-dialog",title:t,closeLabel:e0_(i,"close"),onClose:r,children:[(0,eH.jsxs)("div",{className:"agreement-dialog-content",tabIndex:0,role:"region","aria-label":t,children:[l&&(0,eH.jsxs)("div",{className:"agreement-label",children:[(0,eH.jsx)(e2O,{size:24,"aria-hidden":"true"}),(0,eH.jsxs)("span",{children:[e0_(i,"version")," ",l]})]}),a]}),(0,eH.jsx)("div",{className:"agreement-dialog-footer",children:(0,eH.jsx)(eXE,{type:"button",className:"button full",onClick:()=>{null==n||n(),r()},children:e0_(i,n?"confirmAgreement":"close")})})]})}function e2R(e){let{name:t,description:l,content:i,lang:a}=e,n=(0,eC.useRef)(null),[r,o]=(0,eC.useState)(!1),[s,d]=(0,eC.useState)(!1),c=e0_(a,"fullProductInfo");return(0,eC.useEffect)(()=>{var e;let t=n.current;if(!t)return;let l=!0,i=()=>{l&&o(t.scrollHeight>t.clientHeight+1)};i();let a="u"<typeof ResizeObserver?void 0:new ResizeObserver(i);return null==a||a.observe(t),window.addEventListener("resize",i),null==(e=document.fonts)||e.ready.then(i),()=>{l=!1,null==a||a.disconnect(),window.removeEventListener("resize",i)}},[l]),(0,eH.jsxs)("div",{className:"product-description",children:[(0,eH.jsx)("p",{className:"product-description-text",ref:n,children:l}),r&&(0,eH.jsx)("button",{type:"button",className:"text-link product-description-more","aria-haspopup":"dialog","aria-label":`${c}: ${t}`,onClick:()=>d(!0),children:c}),s&&(0,eH.jsx)(e2L,{title:t,lang:a,onClose:()=>d(!1),children:i??(0,eH.jsx)("div",{className:"agreement-body",children:(0,eH.jsx)("p",{className:"preserve-lines",children:l})})})]})}function e2$(e){let{detail:t,configuration:l,locale:i,catalogStartingAmount:a,catalogPriceQualifier:n,formatAmount:r}=e,{durationMinutes:o}=(0,eC.useMemo)(()=>e0E(t,{...l.skuValue}),[t,l.skuValue]),s=eXp(t.title,i)||eXp(t.name,i),d=eXp(t.description,i).trim(),c=(0,eC.useMemo)(()=>eXm(d,i),[d,i]),u="string"==typeof t.cover?t.cover.trim():"",p=("string"==typeof a||"number"==typeof a)&&""!==String(a).trim()&&Number.isFinite(Number(a))&&Number(a)>=0;return(0,eH.jsxs)("div",{className:"reservation-intro venue-product-intro",children:[(0,eH.jsx)("div",{className:"venue-product-intro__cover",children:(0,eH.jsx)(nY.PisellImageCard,{dataSource:{src:u||void 0,alt:s},width:"100%",height:"100%",aliWidth:220,fillMode:"cover"})}),(0,eH.jsxs)("div",{className:"venue-product-intro__copy",children:[d&&(0,eH.jsx)(e2R,{name:s,description:c,lang:i,content:(0,eH.jsx)(e2T,{content:d})}),null!=o&&(0,eH.jsxs)("span",{className:"small muted",children:[o," ","zh"===i?"分钟":"minutes"]}),p&&(0,eH.jsxs)("strong",{children:["from"===n&&"zh"!==i&&"From ",r(a),"from"===n&&"zh"===i&&" 起"]})]})]})}e2O.displayName="ShieldCheckIcon";let e2F=(e,t)=>null!=e&&null!=t&&String(e)===String(t),e2q=e=>Array.isArray(e)?e:[],e2B=e=>{if("string"!=typeof e&&"number"!=typeof e||""===String(e).trim())throw Error("The estimated price is unavailable.");let t=new lz(e);if(!t.isFinite())throw Error("The estimated price is unavailable.");return t},e2H=e=>{let t=Number(e);if(!Number.isSafeInteger(t)||t<=0)throw Error("The selected quantity is invalid.");return t},e2V=e=>(e||[]).map(e=>{var t;return{...e,required:0,min_quantity:0,max_quantity:0,metadata:{...e.metadata,option_types_config:{...null==(t=e.metadata)?void 0:t.option_types_config,min:0,max:0}},option_item:(e.option_item||[]).map(e=>({...e,min_quantity:0,max_quantity:0}))}});function e2U(e,t){return e2q(e).reduce((e,l)=>{let i=e2q(t).find(e=>e2F(e.id,l.option_group_id??l.group_id)),a=e2q(null==i?void 0:i.option_item).find(e=>e2F(e.id,l.product_option_item_id??l.option_group_item_id??l.id));if(!a)throw Error("The selected option is unavailable.");return e.add(e2B(a.add_price??a.price).mul(e2H(l.quantity??l.num)))},new lz(0))}async function e2Y(e){var t,l;let i=e2H(e.quantity),a=(t=e.productDetail,l=e.skuValue,{...t,variant_group:0===Number(l.product_variant_id||0)?[]:t.variant_group,option_group:e2V(t.option_group),bundle_group:(t.bundle_group||[]).map(e=>({...e,min_quantity:0,max_quantity:0,bundle_item:(e.bundle_item||[]).map(e=>({...e,min_quantity:0,max_quantity:0,option_group:e2V(e.option_group)}))}))}),n=iM(a,e.skuValue,{requiredOptionValidation:!1,overSold:e.overSold});if(!n)throw Error("The selected options cannot be priced.");let r=Number(n.product_variant_id)>0?e2q(a.variant).find(e=>e2F(e.id,n.product_variant_id)):void 0,o=e2B(r?r.price??r.selling_price??r.base_price:a.price??a.selling_price??a.base_price);if(o.isNegative())throw Error("The estimated price is unavailable.");let s=e2U(n.option,a.option_group),d=e2q(n.bundle).map(e=>{let t=e2q(a.bundle_group).find(t=>e2F(t.id,e.group_id??e.bundle_group_id)),l=e2q(null==t?void 0:t.bundle_item).find(t=>e2F(t.id,e.id??e.bundle_id));if(!l)throw Error("The selected package item is unavailable.");let i=e2B(l.price??l.custom_price??l.product_price??l.base_price),n=(l.price_type??l.custom_price_type)==="markdown"&&(l.price_type_ext??l.custom_price_type_ext)!=="product_price",r=n?i.abs().toString():i.toString();return{selected:e,markdown:n,base:e2B(r),options:e2U(e.option,l.option_group),quantity:e2H(e.quantity??e.num),query:ekr({...e,price:r,bundle_selling_price:r,original_price:r,custom_price:r,product_price:r,base_price:r})}}),c=t=>{let l=t.mul(i);if(l.isNegative()||!l.isFinite())throw Error("The estimated price is unavailable.");return{subtotal:l.toString(),pricedAt:e.datetime}};if("catalog"===e.priceBasis)return c(d.reduce((e,t)=>e.add((t.markdown?t.base.abs().negated():t.base).add(t.options).mul(t.quantity)),o.add(s)));let u=await e.calculateProductBookingPrice({product:{...e.productDetail,product_id:a.id,product_variant_id:n.product_variant_id,price:o.toString(),quantity:i,num:i,product_sku:{option:n.option},product_bundle:d.map(e=>e.query)},datetime:e.datetime,channel:"online_ordering",...null!=e.customerId?{customer_id:e.customerId}:{}});if(!u||!e2F(u.product_id,a.id)||!e2F(u.product_variant_id??0,n.product_variant_id??0)||e2H(u.quantity)!==i)throw Error("The returned estimate does not match the selected product.");let p=e2B(u.unit_price);if(p.isNegative())throw Error("The estimated price is unavailable.");let m=p.add(s);for(let e of d){let t=e2q(u.product_bundle).find(t=>e2F(t.bundle_id,e.selected.id??e.selected.bundle_id)&&e2F(t.bundle_group_id??t.group_id,e.selected.bundle_group_id??e.selected.group_id)&&e2F(t.bundle_product_id,e.query.bundle_product_id)&&e2F(t.bundle_variant_id??0,e.query.bundle_variant_id??0));if(!t)throw Error("The selected package item could not be priced.");let l=e2B(t.unit_price);m=m.add((e.markdown?l.abs().negated():l).add(e.options).mul(e.quantity))}return c(m)}function e2W(e){let{enabled:t,openId:l,scopeKey:i,sessionId:a,productDetail:n,skuValue:r,quantity:o=1,overSold:s,priceBasis:d="current-time",timeZone:c,customerId:u,os:p}=e,m=id(r),g=(0,eC.useMemo)(()=>t&&l&&n&&r?{openId:l,scopeKey:i,sessionId:a,productDetail:n,skuValue:r,quantity:o,overSold:s,priceBasis:d,timeZone:c,customerId:u,os:p}:void 0,[t,l,i,a,n,m,o,s,d,c,u,p]),h=(0,eC.useRef)(g);h.current=g;let[v,f]=(0,eC.useState)();return((0,eC.useEffect)(()=>{if(!g)return;let e=!0,t=()=>e&&h.current===g;return f({request:g,value:{status:"loading"}}),(async()=>{try{if("catalog"!==g.priceBasis&&"function"!=typeof g.os.calculateProductBookingPrice)throw Error("Pricing is unavailable.");let e=await e2Y({productDetail:g.productDetail,skuValue:g.skuValue,quantity:g.quantity,overSold:g.overSold,priceBasis:g.priceBasis,datetime:e_L(g.timeZone),customerId:g.customerId,calculateProductBookingPrice:e=>g.os.calculateProductBookingPrice(e)});t()&&f({request:g,value:{status:"ready",...e}})}catch{t()&&f({request:g,value:{status:"unavailable"}})}})(),()=>{e=!1}},[g]),g)?(null==v?void 0:v.request)===g?v.value:{status:"loading"}:{status:"idle"}}function e2K(e){var t,l,i,a,n;let{mode:r,draft:o,locale:s}=e,d=(e,t)=>"zh"===s?t:e,c=e2w(e),u=eJF(),{configuration:p,setConfiguration:m,quantity:g,setQuantity:h,quote:v,error:f,working:y,revision:b,commit:x}=c,k="tickets"===r&&(null==(t=o.plan)?void 0:t.hasConfiguration)?o.plan.productDetail:void 0,_=lZ((null==(i=e.skuOptions)||null==(l=i.config)?void 0:l.overSold)??o.detail.over_sold),w=(0,eC.useMemo)(()=>!!(k&&iC(k,p.skuValue,{requiredOptionValidation:e.requiredOptionValidation,overSold:_})),[k,p.skuValue,e.requiredOptionValidation,_]),S=e2W({enabled:w,openId:null==(a=o.plan)?void 0:a.openId,scopeKey:e.scopeKey,productDetail:k,skuValue:p.skuValue,quantity:g,overSold:_,priceBasis:"catalog",timeZone:null==u?void 0:u.timeZone,customerId:e.customerId,os:e.priceSource}),j=e.formatAmount||(t=>{var l,i;return YP((null==(i=e.context.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))??e.context.cart.tempOrder,t)}),N=o.catalogStartingAmount,C="tickets"===r&&null!=N&&""!==String(N).trim()&&Number.isFinite(Number(N))?j(new lz(N).times(g).toString()):void 0,M=void 0===C?"—":"zh"===s?`${C} 起`:`From ${C}`,T=M;w&&"ready"===S.status?T=j(S.subtotal):w&&"loading"===S.status&&(T="—");let I=v?j(v.compositeLineTotal):k?T:"from"===o.catalogPriceQualifier?M:C??"—",P=t=>(0,eH.jsx)(e2v,{ref:c.panelRef,...c.bookingProps,scrollContainer:t,renderDatePicker:e.renderDatePicker,dateReadOnly:e.dateReadOnly,actionTarget:()=>{var e;return(null==t||null==(e=t.closest('[role="dialog"]'))?void 0:e.querySelector(".booking-config-actions .booking-primary-action"))||null}}),A=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"tickets"!==r||o.lineUid?null:(0,eH.jsx)("div",{className:"reservation-quantity",role:"group","aria-label":d("Number","数量"),children:(0,eH.jsx)(z8,{className:"booking-ticket-quantity",variant:"capsule",min:1,step:1,value:g,disabled:t||y||e.disabled,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,onChange:l=>{!t&&!y&&!e.disabled&&Number.isSafeInteger(l)&&l>=1&&h(l)}})})},D=(0,eH.jsxs)("div",{className:"venue-booking-sales__booking-footer",children:[A(),(0,eH.jsxs)("div",{className:"tickets"===r?"reservation-subtotal":"party-total","aria-live":"polite",children:[(0,eH.jsx)("span",{children:d("Subtotal","小计")}),(0,eH.jsx)("strong",{children:I})]})]});return"tickets"===r&&o.plan?(0,eH.jsx)(e0j,{plan:o.plan,title:eXp(o.detail.title||o.detail.name,s)||d("Play admission","游玩门票"),summary:(0,eH.jsx)(e2$,{detail:o.detail,configuration:p,locale:s,catalogStartingAmount:o.catalogStartingAmount,catalogPriceQualifier:o.catalogPriceQualifier,formatAmount:j}),configuration:p,onConfigurationChange:m,skuOptions:{...e.skuOptions,priceFormatter:(null==(n=e.skuOptions)?void 0:n.priceFormatter)||(e=>String(j(e)))},requiredOptionValidation:e.requiredOptionValidation,onCancel:c.cancel,locale:s,busy:y||e.disabled,selectionRevision:b,error:f,renderBooking:e=>{let{scrollContainer:t}=e;return P(t)},footerContent:e=>{let{busy:t}=e;return A(t)},configurationFooter:{label:d("Estimated subtotal","预计小计"),amount:(0,eH.jsx)("span",{role:"status","aria-live":"polite",children:T})},bookingActionAmount:I,bookingSubtotalLabel:!v&&w?d("Estimated subtotal","预计小计"):void 0,bookingReady:c.bookingReady,onConfirm:x}):(0,eH.jsxs)("section",{className:"venue-booking-sales__party-selection","aria-label":d("Choose your room and time","选择房间和时间"),children:[P(),f&&(0,eH.jsx)(eT.Alert,{type:"error",message:f,showIcon:!0}),D,(0,eH.jsxs)("div",{className:"venue-booking-sales__actions",children:[(0,eH.jsx)(eXE,{secondary:!0,disabled:y||e.disabled,onClick:c.cancel,children:d("Cancel changes","取消更改")}),(0,eH.jsx)(eXE,{busy:y,disabled:e.disabled||!c.bookingReady,onClick:()=>void x(),children:d("Save Party selection","保存 Party 选择")})]})]})}let e2G=new Set,e2Q=0,e2Z=new WeakMap,e2J=e=>{var t,l,i,a;let n=e=>"string"==typeof e&&e.trim()?e.trim():void 0;if((null==(t=e.otherParams)?void 0:t.businessCode)==="venue_booking"){let t=n(e.otherParams.previousVenueCacheId);if(t)return t}try{return n(null==(l=e.getCacheId)?void 0:l.call(e))||n(null==(i=e.otherParams)?void 0:i.cacheId)}catch{return n(null==(a=e.otherParams)?void 0:a.cacheId)}},e2X=e=>null!=e&&""!==String(e).trim()&&"0"!==String(e).trim(),e20=e=>{var t;if(!e||"payment_pending"!==String(e.status||"").trim().toLowerCase()||!e2X(e.voucher_id)||e2X(e.order_payment_id))return!1;let l=null==(t=e.metadata)?void 0:t.transactions;return!Array.isArray(l)||!l.some(e=>e2X(null==e?void 0:e.number))},e22=e=>{var t,l;return e2X(null==e?void 0:e.order_id)||1===Number(null==e?void 0:e.need_sync)||[null==e?void 0:e.paid_amount,null==e||null==(t=e.summary)?void 0:t.order_paid_amount,null==e||null==(l=e.summary)?void 0:l.customer_paid_amount].some(e=>Number.isFinite(Number(e))&&Number(e)>0)||Array.isArray(null==e?void 0:e.payments)&&e.payments.some(e=>!e20(e))},e21=()=>"u"<typeof window?void 0:window.location.pathname+window.location.search+window.location.hash,e24=e=>e.listeners.forEach(e=>e()),e23=e=>{e.active=!1,e.value={...e.value,ready:!1},e24(e)},e28=function(e,t,l,i){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(e.retiring)return e.retiring;let n=()=>t.orderOwner===e&&t.orderSessionId===l,r=()=>null==t.orderOwner&&(!t.owner||t.owner===e);if(e.retired)return Promise.resolve((n()||r())&&i());if(!e.retireOrder)return Promise.resolve(!1);let o=t.tail.then(async()=>{var t,o;if(a&&e.refs>0||e.sessionId!==l||(await (null==(t=e.waitForRetire)?void 0:t.call(e)),a&&e.refs>0||!i()||e.sessionId!==l))return!1;if(!n())return!!r()&&(e.retired=!0,!0);if(e23(e),e.storageKey)try{(null==(o=JSON.parse(sessionStorage.getItem(e.storageKey)||"null"))?void 0:o.sessionId)===l&&sessionStorage.removeItem(e.storageKey)}catch{}return await e.retireOrder(),!!n()&&(e.order=e.source.getTempOrder(),e.discarded=!0,e.retired=!0,!0)});e.retiring=o;let s=()=>{e.retiring===o&&(e.retiring=void 0)};return t.tail=o.then(s,s),o};class e26 extends Error{constructor(e){super(e),e1(this,"code",void 0),this.code=e}}let e25=e=>{throw new e26(e)},e27=e=>Array.isArray(e)?e.filter(Boolean):[],e29=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(null==e||""===e)return t;let l=Number(e);return Number.isSafeInteger(l)&&l>=0?l:e25("PREVIEW_INVALID_SKU_BOUNDS")},e1e=e=>{++e.work>15e4&&e25("PREVIEW_COMPLEX_CONFIGURATION")};function e1t(e){let t,l;for(let i of e)0===i.capacity?(!t||i.quantity<t.quantity)&&(t=i):(!l||i.capacity<l.capacity||i.capacity===l.capacity&&i.quantity<l.quantity)&&(l=i);return[t,l].filter(e=>!!e)}function e1l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(l||!lZ(e.is_track)||lZ(e.over_sold))return 256;let i=Number(e.stock_quantity);return Number.isFinite(i)&&i>0?Math.max(0,Math.floor(i/t)):0}function e1i(e){var t,l,i,a,n,r;let{group:o,kind:s,policy:d,budget:c,multiplier:u}=e,p="bundle"===s||lZ(o.is_multiple),m="option"===s&&p&&lZ(null==(t=o.metadata)?void 0:t.advanced_settings_enabled),g=d.requiredOptionValidation,h=g&&m?e29(null==(i=o.metadata)||null==(l=i.option_types_config)?void 0:l.min):0,v=m?e29(null==(n=o.metadata)||null==(a=n.option_types_config)?void 0:a.max):0,f=g?p?e29(o.min_quantity):+!!lZ(o.required):0,y=p?e29(o.max_quantity):0;(y&&f>y||v&&h>v)&&e25("PREVIEW_INVALID_SKU_BOUNDS");let b=e.items.filter(e=>l3(e,{overSold:d.overSold})),x=b.map(e=>Math.max(1,e29(e.min_quantity)));if(!p){if(!f)return[{rows:[],capacity:0,quantity:0}];for(let t=0;t<b.length;t++){e1e(c);let l=x[t],i=e29(b[t].max_quantity);if(l>256&&e25("PREVIEW_COMPLEX_CONFIGURATION"),i&&l>i||l>e1l(b[t],u,d.overSold))continue;let a=e.makeRow(b[t],l);if(a)return[{rows:[a],capacity:(null==(r=e.counted)?void 0:r.call(e,b[t]))?l:0,quantity:l}]}return[]}if(0===f&&0===h&&!b.some(t=>{var l;return null==(l=e.counted)?void 0:l.call(e,t)}))return[{rows:[],capacity:0,quantity:0}];let k=Math.max(1,...x),_=Math.max(1,Math.min(f+x.reduce((e,t)=>e+t,0),Math.max(f,h*k)+2*k)),w=y?Math.min(_,y):_;(w>256||h>256)&&e25("PREVIEW_COMPLEX_CONFIGURATION");let S=!p||h>0||v>0,j=new Map([["0:0",[{rows:[],capacity:0,quantity:0}]]]);for(let t=0;t<b.length;t++){let l=b[t],i=x[t],a=Math.min(w,e29(l.max_quantity)||w,e1l(l,u,d.overSold)),n=new Map,r=new Map;for(let[t,o]of j){let[s,d]=t.split(":").map(Number),u=[0];if(p||0===d)for(let e=i;e<=a&&s+e<=w;e++)u.push(e);for(let t of u){let i;e1e(c);let a=d+(t&&S?1:0);if(v&&a>v||t&&(n.has(t)||n.set(t,e.makeRow(l,t)),!(i=n.get(t))))continue;let u=`${s+t}:${a}`,p=o.map(a=>{var n;return{rows:i?[...a.rows,i]:a.rows,quantity:s+t,capacity:a.capacity+((null==(n=e.counted)?void 0:n.call(e,l))?t:0)}});r.set(u,e1t([...r.get(u)||[],...p]))}}j=r}return e1t([...j.entries()].flatMap(e=>{let[t,l]=e,[i,a]=t.split(":").map(Number);return i>=f&&a>=h?l:[]}))}function e1a(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=[];for(let n of e27(e.option_group).filter(l1)){let r=e1i({group:n,items:e27(n.option_item),kind:"option",policy:t,budget:l,multiplier:i,makeRow:(t,l)=>({...t,id:t.id,product_option_item_id:t.id,option_group_id:n.id,product_id:e.id,quantity:l,num:l})});if(!r.length)return;a.push(...r[0].rows)}return a}function e1n(e,t,l){var i;let a=(null==(i=e._data)?void 0:i.capacitys)??e.capacity,n=(null==a?void 0:a.type)==="package"?e27(a.package).map(e=>e.product_id):[],r=[{rows:[],capacity:0,quantity:0}];for(let i of e27(e.bundle_group).filter(l1)){let e=e1i({group:i,items:e27(i.bundle_item),kind:"bundle",policy:t,budget:l,multiplier:1,counted:e=>n.includes(e.bundle_product_id),makeRow:(e,a)=>{let n=e1a(e,t,l,a);if(n)return{...e,id:e.id,group_id:i.id,_bundle_product_id:e.bundle_product_id,quantity:a,num:a,option:n}}});if(!e.length)return[];r=e1t(r.flatMap(t=>e.map(e=>({rows:[...t.rows,...e.rows],capacity:t.capacity+e.capacity,quantity:t.quantity+e.quantity}))))}return r}function e1r(e,t){if(t.overSold)return;let l=new Set;for(let t of e27(e.bundle_group).filter(l1))for(let e of e27(t.bundle_item).filter(l1)){if(lZ(e.is_track)&&!lZ(e.over_sold)){let t=Number(e.bundle_variant_id)>0?`variant:${e.bundle_variant_id}`:`product:${e.bundle_product_id}`;(null==e.bundle_product_id||l.has(t))&&e25("PREVIEW_SHARED_STOCK_CONFIGURATION"),l.add(t)}1!==e29(e.max_quantity)&&1!==e29(t.max_quantity)&&e27(e.option_group).filter(l1).some(e=>e27(e.option_item).some(e=>l1(e)&&lZ(e.is_track)&&!lZ(e.over_sold)))&&e25("PREVIEW_SPLIT_BUNDLE_STOCK_CONFIGURATION")}}let e1o=["duration","service_duration","product_resource","capacity","session","schedule","schedules"];function e1s(e){for(let t of[...e27(e.variant),...e27(e.option_group).flatMap(e=>e27(e.option_item))])for(let l of e1o)null!=t[l]&&JSON.stringify(t[l])!==JSON.stringify(e[l])&&e25("PREVIEW_SKU_BOOKING_OVERRIDE_UNSUPPORTED")}async function e1d(e,t){var l,i;let a={available:!1,availability:{}},n=!1,r=()=>{var e;return!n&&(null==(e=t.isCurrent)?void 0:e.call(t))!==!1},o=(null==(l=(i=t.resolvePolicy).createBatch)?void 0:l.call(i))??t.resolvePolicy,s=async l=>{if(!r())return;let i=l.id??l.product_id;if(!Number.isSafeInteger(Number(i))||0>=Number(i))return{id:String(i),state:{available:!1,reasons:["INVALID_PRODUCT_ID"]}};if(!t.catalogParams.menu_list_ids.length)throw new e26("PREVIEW_MENU_CONFIGURATION_REQUIRED");let a=t.productsFromSessionSnapshot?l:await t.queries.queryCatalogProductDetail({...t.catalogParams,product_id:Number(i),schedule_date:t.date,with_count:["bundleGroup","optionGroup"],with_schedule:1});if(!r())return;if(!a)return{id:String(i),state:{available:!1,reasons:["PRODUCT_NOT_IN_MENU"]}};if(String(a.id??a.product_id)!==String(i))return{id:String(i),state:{available:!1,reasons:["PRODUCT_MISMATCH"]}};let n=function(e,t){try{let l;t.runtimePolicy.settings||e25("PREVIEW_SALES_SETTINGS_REQUIRED");let i=iA({productDetail:e,requestedProductId:e.id??e.product_id,completeness:"complete"}),a=Number(e.variant_count);if(lZ(e.is_variant)&&(!e27(e.variant).length||Number.isSafeInteger(a)&&a>e27(e.variant).length)&&("ready"===i.status||i.issues.length&&i.issues.every(e=>"MISSING_VARIANTS"===e.code&&"variant"===e.path))){let l=function(e,t){if(!l1(e)||!Object.values(e0O(e)).some(e=>e.length>0))return[];e1s(e),e1r(e,t);let l={work:0},i=e1a(e,t,l),a=e1n(e,t,l);if(!i||!a.length)return[];let n=[];for(let t of a){let l=e0E(e,{option:i,bundle:t.rows}),a=e.duration??e.service_duration;!l.reasonCodes.length&&l.partySize&&(l.durationMinutes||(null==a?void 0:a.type)==="flexible")&&n.push({product:l.product,partySize:l.partySize,durationMinutes:l.durationMinutes})}return n}(e,{...t,overSold:t.overSold&&lZ(e.over_sold)});return l.length?{status:"requires-configuration",candidates:l,reasonCodes:[]}:{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE"]}}if("invalid"===i.status)return{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE",...new Set(i.issues.map(e=>e.code))]};let n=i.productDetail;t={...t,overSold:t.overSold&&lZ(n.over_sold)},e1s(n),e1r(n,t);let r={work:0},o=e1a(n,t,r),s=e1n(n,t,r);if(!o||!s.length)return{status:"unavailable",candidates:[],reasonCodes:["NO_SELLABLE_SKU"]};let d=e27(n.variant_group).some(l1)?e27(n.variant).filter(e=>l3(e,{overSold:t.overSold})):[void 0],c=new Set;for(let e of d)for(let i of s){if(e1e(r),1>e1l(e||n,1,t.overSold))continue;let a=iC(n,{product_id:Number(n.id),product_variant_id:Number((null==e?void 0:e.id)||0),option:o,bundle:i.rows},t);if(!a||iK({data:function(e,t){if(!t)return e;let l=e=>e27(e).map(e=>({...e,option_item:e27(e.option_item).map(e=>({...e,over_sold:1}))}));return{...e,over_sold:1,variant:e27(e.variant).map(e=>({...e,over_sold:1})),option_group:l(e.option_group),bundle_group:e27(e.bundle_group).map(e=>({...e,bundle_item:e27(e.bundle_item).map(e=>({...e,over_sold:1,option_group:l(e.option_group)}))}))}}(n,t.overSold),value:a,runtimePolicy:{...t.runtimePolicy,platform:"pc"}}).shouldBlock)continue;let s=e0E(n,a);if(s.reasonCodes.length||!s.partySize){s.reasonCodes.forEach(e=>c.add(e));continue}(!l||s.partySize<l.partySize)&&(l={product:s.product,skuValue:a,partySize:s.partySize,durationMinutes:s.durationMinutes})}if(l)return{status:"ready",candidates:[l],reasonCodes:[]};return{status:c.size?"configuration-error":"unavailable",candidates:[],reasonCodes:c.size?[...c]:["NO_SELLABLE_SKU"]}}catch(e){if(e instanceof e26)return{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE",e.code]};throw e}}(a,await o(a));if(!r())return;let s={available:!1,reasons:[...n.reasonCodes]};if("ready"!==n.status&&"requires-configuration"!==n.status)return{id:String(i),state:s};for(let l of n.candidates){let i;if(!r())break;try{if(i=await e0Q({os:e,mode:t.mode||"ticket",date:t.date,product:l.product,quantity:1},{projectionDateRange:t.projectionDateRange}),!r())break;let a=i.times.filter(e=>e0$(e,l.partySize));if(a.some(e=>{let i=e.requirementGroups||[];return i.every(e=>1>=Math.max(+!!e.required,e.min||0)&&(!(e.required||e.min>0)||e.max>=1&&e.options.some(e=>e0$(e,l.partySize))))&&("party"!==t.mode||i.some(e=>e.max>=1&&e.options.some(e=>e0$(e,l.partySize))))})){"requires-configuration"===n.status?s.requiresConfiguration=!0:s.available=!0,s.reasons=[];break}s.reasons.push(...i.times.flatMap(e=>e.reasonCodes||[])),s.reasons.length||s.reasons.push(a.length?"UNSUPPORTED_RESOURCE_GROUP":"NO_AVAILABLE_BOOKING")}catch(e){if(e instanceof e0L)s.reasons.push(...e.reasonCodes);else throw e}finally{e0K(e,i)}}return s.reasons=[...new Set(s.reasons)],{id:String(i),state:s,evaluated:!0}},d=Array(t.products.length),c=0,u=async()=>{for(;r()&&c<t.products.length;){let e=c++;try{let l=await s(t.products[e]);if(d[e]=l,t.stopAtFirstAvailable&&((null==l?void 0:l.state.available)||(null==l?void 0:l.state.requiresConfiguration)))return}catch(e){throw n=!0,e}}},p=t.stopAtFirstAvailable||2!==t.concurrency?1:2;for(let e of(await Promise.all(Array.from({length:Math.min(p,t.products.length)},()=>u())),d))e&&(a.availability[e.id]=e.state,e.evaluated&&(a.available||(a.available=e.state.available),a.requiresConfiguration||(a.requiresConfiguration=e.state.requiresConfiguration)));return a}let e1c=e=>{let t=e.id??e.product_id;return"number"==typeof t?Number.isFinite(t)?String(t):void 0:"string"==typeof t&&t.trim()?t:void 0};function e1u(e){let{os:t,ready:l,catalog:i,date:a,datetime:n,customerId:r,scopeKey:o,retail:s=!1,retailTimeZone:d,revision:c=0,resolvePolicy:u,mode:p="ticket",queries:m,onRetry:g,projectionDateRange:h,operationLog:v}=e,[f,y]=(0,eC.useState)(0),b=(0,eC.useRef)(0),x=(0,eC.useRef)(v);x.current=v;let k=(0,eC.useRef)(),_=JSON.stringify((null==i?void 0:i.menuListIds)||[]),w=s?void 0:a,S=s?void 0:n,j=s||null==h?void 0:h.startDate,N=s||null==h?void 0:h.endDate,C=(0,eC.useMemo)(()=>({}),[t,_,w,S,r,o,s,d,p]),M=(0,eC.useMemo)(()=>({identity:C,ready:l}),[C,l,f,c,u,m,j,N]),[T,I]=(0,eC.useState)(),P=e=>l&&(null==e?void 0:e.request.identity)===C?e.state.products:[];return(0,eC.useEffect)(()=>{let e,n,o=++b.current,c=!1;if(I(e=>({request:M,state:{products:P(e),loading:!0,availability:{}}})),!l){k.current=void 0;return}try{var g;e=null==(g=x.current)?void 0:g.capture()}catch{}return(async()=>{if(!(null==i?void 0:i.menuListIds.length))return void I({request:M,state:{products:[],availability:{},loading:!1}});if("function"!=typeof(null==m?void 0:m.queryCatalogSnapshot))throw Error("The booking catalog service is unavailable. Please update the booking service.");n=s?e_L(d):S;let l=await m.queryCatalogSnapshot({menu_list_ids:[...i.menuListIds],schedule_date:s?n.slice(0,10):w,...n?{schedule_datetime:n}:{},...r?{customer_id:Number(r)}:{}});if(c||b.current!==o)return;let g={};if(!s&&l.length){if(!u)throw Error("The booking sales settings are unavailable.");Object.assign(g,(await e1d(t,{products:l,productsFromSessionSnapshot:!0,concurrency:2,date:a,mode:p,resolvePolicy:u,queries:m,...j&&N?{projectionDateRange:{startDate:j,endDate:N}}:{},catalogParams:{menu_list_ids:i.menuListIds,...r?{customer_id:r}:{}},isCurrent:()=>!c&&b.current===o})).availability)}c||b.current!==o||(I({request:M,state:{products:l,availability:g,loading:!1,...s?{pricingDatetime:n}:{}}}),((t,l)=>{if(e)try{let r=function(e){let t=e.menuListIds.length>100,l=0,i=new Set,a=[],n={available:{count:0,ids:[]},unavailable:{count:0,ids:[]},requiresConfiguration:{count:0,ids:[]},unknown:{count:0,ids:[]}},r=[];for(let s of e.products){var o;let d=e1c(s);if(void 0===d){l++;continue}if(i.has(d))continue;i.add(d),a.length<100?a.push(d):t=!0;let c="main"===e.poolRole?null==(o=e.availability)?void 0:o[d]:void 0,u=(null==c?void 0:c.requiresConfiguration)?"requiresConfiguration":(null==c?void 0:c.available)===!0?"available":(null==c?void 0:c.available)===!1?"unavailable":"unknown",p=n[u];if(p.count++,p.ids.length<100?p.ids.push(d):t=!0,"unavailable"===u&&r.length<100){let e=(null==c?void 0:c.reasons)||[],l=[];for(let i of e){if(3===l.length){t=!0;break}if("string"==typeof i&&i){if(!/^[a-z][a-z0-9_:-]*$/i.test(i)){t=!0;continue}i.length>80&&(t=!0),l.push(i.slice(0,80))}}r.push({productId:d,reasonCodes:l})}}return{poolRole:e.poolRole,requestedDate:e.requestedDate,...e.pricingDatetime?{pricingDatetime:e.pricingDatetime}:{},menuCount:e.menuListIds.length,menuListIds:e.menuListIds.slice(0,100),productsCount:e.products.length,productIdCount:i.size,productIds:a,unidentifiedProductsCount:l,availabilityChecked:"main"===e.poolRole,availableCount:n.available.count,availableProductIds:n.available.ids,unavailableCount:n.unavailable.count,unavailableProductIds:n.unavailable.ids,requiresConfigurationCount:n.requiresConfiguration.count,requiresConfigurationProductIds:n.requiresConfiguration.ids,unknownCount:n.unknown.count,unknownProductIds:n.unknown.ids,unavailableReasons:r,truncated:t}}({poolRole:s?"extras":"main",requestedDate:s?n.slice(0,10):a,pricingDatetime:n,menuListIds:(null==i?void 0:i.menuListIds)||[],products:t,availability:l}),o=JSON.stringify(r),d=k.current;if(!r.truncated&&(null==d?void 0:d.identity)===C&&d.queries===m&&d.key===o)return;e("catalog_resolved",r),k.current={identity:C,queries:m,key:o}}catch{}})(l,g))})().catch(t=>{if(!c&&b.current===o){I(e=>({request:M,state:{products:P(e),availability:{},loading:!1,error:t instanceof Error?t.message:String(t)}})),k.current=void 0;try{null==e||e("catalog_failed",{poolRole:s?"extras":"main",requestedDate:s?null==n?void 0:n.slice(0,10):a,...n?{pricingDatetime:n}:{},menuListIds:((null==i?void 0:i.menuListIds)||[]).slice(0,100),errorCode:t&&"object"==typeof t&&"code"in t?String(t.code).slice(0,80):void 0,errorMessage:(t instanceof Error?t.message:String(t)).slice(0,300)},"error")}catch{}}}),()=>{c=!0}},[M]),{...(null==T?void 0:T.request)===M?T.state:{products:P(T),loading:!0,availability:{}},retry:g||(()=>{var e;null==(e=m.retry)||e.call(m),y(e=>e+1)})}}function e1p(e){var t;if(!l1(e)||lZ(e.is_grey)||["draft","pending","archived"].includes(e.status))return!1;let l=lJ(null==(t=e.item_rule_limit)?void 0:t.remainingMax);if(void 0!==l&&l<1)return!1;let i=lZ(e.over_sold),a=e=>{let t=lJ(e.stock_quantity)??lJ(e.sum_stock);return!lZ(e.is_track)||i||lZ(e.over_sold)||void 0===t||t>0},n=e.variant;return a(e)&&(!Array.isArray(n)||!n.length||n.some(e=>l1(e)&&a(e)))}let e1m=(e,t)=>e.length===t.length&&e.every((e,l)=>e===t[l]);function e1g(e){let t=e.menuListIds.join(","),l=(0,eC.useMemo)(()=>{if(!e.sessionId||!t||!e.os.createVenueCatalogSession){let e=async()=>{throw Error("The local booking catalog is unavailable. Please update the booking service.")};return{queryCatalogSnapshot:e,queryCatalogProductDetail:e,prepareProductDetail:e,calculateProductBookingPrice:e,dispose(){}}}return e.os.createVenueCatalogSession({menu_list_ids:[...e.menuListIds],poolRole:e.poolRole,sessionKey:e.sessionId})},[e.os,e.scopeKey,e.sessionId,t,e.poolRole]);return(0,eC.useEffect)(()=>()=>l.dispose(),[l]),l}function e1h(e){if(!e||!e0m(e.startDate)||!e0m(e.endDate))return[];let t=(Date.parse(`${e.endDate}T12:00:00Z`)-Date.parse(`${e.startDate}T12:00:00Z`))/864e5+1;return!Number.isSafeInteger(t)||t<1||t>32?[]:Array.from({length:t},(t,l)=>e0h(e.startDate,l))}let e1v=(e,t)=>Array.isArray(e)?e.find(e=>Number(null==e?void 0:e.id)===Number(t)):void 0;function e1f(e,t,l){let i=e||{...l,id:Number(null==l?void 0:l.product_id)},a=t&&e?e1v(e.variant,t):void 0,n=l&&Number(l.product_id)===Number(i.id)&&Number(l.product_variant_id)===Number(t),r=Hn(a);if(!a&&t&&n){var o,s;if(Number(null==(o=l.metadata)?void 0:o.venue_extra_holder_variant_id)===t)r=Hn(l);else{let e=(null==(s=l.metadata)?void 0:s.origin)??l._origin;r=Hn(e1v(null==e?void 0:e.variant,t))}}return r?{source:{...i,holder_config:r},overrideVariantId:t||null}:{source:i,overrideVariantId:null}}function e1y(e,t,l){return e1f(e,t,l).source}function e1b(e,t,l,i,a,n){let r=Ho(e1y(e,t,n)),o=i.filter(e=>"form"===e.holder_type);if(!r.enabled)return!o.length;let s=new Set(o.map(e=>Number(e.holder_id)));return o.every(e=>{var t,l;return"order_detail"===e.relation_model&&Number.isSafeInteger(Number(e.holder_id))&&Number(e.holder_id)>0&&((null==(t=e.metadata)?void 0:t.form_id)==null||String(e.metadata.form_id)===String(r.formId))&&((null==(l=e.metadata)?void 0:l.customer_id)==null||String(e.metadata.customer_id)===String(a))})&&s.size===o.length&&s.size<=l&&(!r.required||s.size===l)}class e1x extends Error{constructor(e,t){super(t),e1(this,"code",void 0),this.code=e,this.name="PartyExtraError"}}let e1k=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")};function e1_(e,t){if("tickets"!==t.mode){let l;return(l=t.parentLineUid)?e.filter(e=>{var t;return(null==(t=e.metadata)?void 0:t.venue_booking_role)==="party_extra"&&String(e.metadata.venue_booking_parent_uid??"")===l}):[]}return e.filter(e=>{var l;return(null==(l=e.metadata)?void 0:l.venue_booking_role)==="tickets_extra"&&e.metadata.venue_booking_scope_key===t.scopeKey})}function e1w(e){let{schedule_date:t,schedule_datetime:l,...i}=e.productLoadParams;return JSON.stringify([e.mode??"party",e.scopeKey,"tickets"===e.mode?null:e.parentLineUid,e.timeZone,e.customerId??null,i])}function e1S(e,t){return{mode:e.mode,timeZone:e.timeZone,parentLineUid:e.parentLineUid,serviceDatetime:e.serviceDatetime,scopeKey:e.scopeKey,customerId:e.customerId,productLoadParams:e.productLoadParams,...t}}function e1j(e,t){let l=e1S(e,t);return{...l,..."tickets"===l.mode?{parentLineUid:void 0}:{},serviceDatetime:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;try{return e_L(e,t)}catch(e){throw new e1x("TIMEZONE_REQUIRED",e instanceof Error?e.message:"The venue timezone is invalid.")}}(l.timeZone)}}function e1N(e,t,l){return{code:e instanceof e1x?e.code:"EXTRA_UNAVAILABLE",message:e instanceof Error?e.message:"Unable to prepare this extra. Please try again.",productId:l??((null==t?void 0:t.product_id)==null?void 0:Number(t.product_id)),...t?{lineUid:e1k(t),line:t}:{}}}function e1C(e){if(!Number.isSafeInteger(e)||e<=0)throw new e1x("INVALID_QUANTITY","Choose a valid quantity.");return e}function e1M(e){let t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>({product_option_item_id:e.product_option_item_id??e.option_group_item_id??e.id,option_group_id:e.option_group_id,num:e.num??e.quantity??1}))};return{product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id??0),product_option_string:e.product_option_string,option:t(e.option),bundle:(e.bundle||[]).map(e=>{var l;return{id:e.id??e.bundle_id??e.bundle_item_id,group_id:e.group_id??e.bundle_group_id,bundle_variant_id:e.bundle_variant_id??e.variant_id,num:e.num??e.quantity??1,option:t(e.option??(null==(l=e.product_sku)?void 0:l.option))}})}}function e1T(e){var t;return e1M({product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id??0),option:(null==(t=e.product_sku)?void 0:t.option)??[],bundle:e.product_bundle??[]})}let e1I=e=>JSON.stringify([String(e.group_id??e.bundle_group_id??""),String(e.id??e.bundle_id??e.bundle_item_id??""),String(e.bundle_variant_id??e.variant_id??0)]);function e1P(e){var t,l;let i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>[String(e.option_group_id??""),String(e.product_option_item_id??e.option_group_item_id??e.id??""),Number(e.num??e.quantity??1),Number(e.original_price??e.price??e.add_price??0)]).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t)))},a=(e.product_bundle??[]).map(e=>{var t;return[String(e.group_id??e.bundle_group_id??""),String(e.id??e.bundle_id??e.bundle_item_id??""),String(e.bundle_variant_id??e.variant_id??0),Number(e.num??e.quantity??1),String(e.price_type??e.custom_price_type??""),String(e.price_type_ext??""),Number(e.original_price??e.product_price??e.price??0),i(e.option??(null==(t=e.product_sku)?void 0:t.option))]}).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t)));return JSON.stringify([Number(e.num),Number((null==(t=e.metadata)?void 0:t.main_product_original_price)??e.original_price),i(null==(l=e.product_sku)?void 0:l.option),a])}function e1A(e){return{venue_booking_role:"tickets"===e.mode?"tickets_extra":"party_extra",..."tickets"===e.mode?{}:{venue_booking_parent_uid:e.parentLineUid},venue_booking_service_datetime:e.serviceDatetime,venue_booking_scope_key:e.scopeKey}}let e1D=function(e){var t;let l,i,a,n,r,o,s,d,c,u,p,m,g,h,v,f,y,b,x,k,_,w,S,j,N,C,M=(0,eC.useRef)(e);M.current=e;let T=(0,eC.useRef)(!0),I=(0,eC.useRef)();I.current||(t=()=>{if(!T.current)throw new e1x("CLOSED","The extras page is closed. Please open it again.");return M.current},l=0,i=0,a=!1,n=new Map,r=()=>{var e;return(null==(e=t().os.getTempOrder())?void 0:e.products)??[]},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e1S(t());return e1_(r(),e)},s=e=>{var l;return UO(e,null==(l=t().os.getTempOrder())?void 0:l.holder_relations)},d=e=>JSON.stringify([e,s(e)]),c=e=>JSON.stringify(o(e).map(d)),u=e=>{var t;return JSON.stringify([null==e?void 0:e.order_id,null==e?void 0:e.external_sale_number,null==e||null==(t=e._extend)?void 0:t.localId])},p=e=>{let l=t().os.getTempOrder();if(!l||Number(l.order_id||0)>0)throw new e1x("NEW_DRAFT_REQUIRED","Start a new booking order before adding extras.");if("tickets"===e.mode){if(!r().some(t=>{var l;return(null==(l=t.metadata)?void 0:l.venue_booking_role)==="tickets"&&t.metadata.venue_booking_scope_key===e.scopeKey}))throw new e1x("TICKETS_REQUIRED","Add a ticket before adding extras.")}else if(!e.parentLineUid||!r().some(t=>{var l;return e1k(t)===e.parentLineUid&&(null==(l=t.metadata)?void 0:l.venue_booking_role)==="party_main"&&t.metadata.venue_booking_scope_key===e.scopeKey}))throw new e1x("PARENT_REQUIRED","Choose and save the Party product before adding extras.")},m=e=>{if(p(e),!e.scopeKey||!e.serviceDatetime||!/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(e.serviceDatetime))throw new e1x("SERVICE_TIME_REQUIRED","The extras pricing date and time are unavailable.");let t=e.productLoadParams.menu_list_ids;if(!(null==t?void 0:t.length)||t.some(e=>!Number.isSafeInteger(e)||e<=0))throw new e1x("CATALOG_REQUIRED","This extras step needs its own menu configuration.")},g=(e,l)=>{if(t().os!==l.os||t().catalogSession!==l.catalogSession||e1w(e1S(t()))!==e1w(e))throw new e1x("STALE_CONTEXT","The booking or extras selection changed. Please choose this item again.");p(e)},h=(e,t)=>{let l=t.os.getTempOrder(),i=null==l?void 0:l.customer_id,a=u(l),n=c(e),r=()=>{if(g(e,t),!l||t.os.getTempOrder()!==l||u(l)!==a||l.customer_id!==i)throw new e1x("STALE_CART","The order or customer changed. Please check the extras again.")};return{beforeApply:()=>{var l,i;if("tickets"===e.mode&&(null==(l=(i=t.os).supportsVenueTicketExtras)?void 0:l.call(i))!==!0)throw new e1x("TICKETS_EXTRAS_SERVICE_UPGRADE_REQUIRED","Tickets extras need an updated booking service. Your selection is kept; update the service before adding or repricing extras.");if(r(),n!==c(e))throw new e1x("STALE_CART","The extras changed while checking the price. Please retry.")},isCurrentOrder:()=>{try{return r(),!0}catch{return!1}}}},v=async e=>{if(a)throw new e1x("BUSY","Please wait for the current cart update.");a=!0;try{return await e()}finally{a=!1}},f=async()=>{try{var e,l;t().cart.refreshCartSnapshot(),await (null==(e=(l=t()).onMutated)?void 0:e.call(l))}catch(e){console.warn("[PartyExtras] Saved extra; UI refresh failed",e)}},y=async function(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"local";m(t);let a=l.catalogSession;if(!(null==a?void 0:a.queryCatalogProductDetail)||!a.calculateProductBookingPrice||"prepare-configuration"===i&&!a.prepareProductDetail)throw new e1x("CATALOG_SESSION_REQUIRED","The extras catalog service is unavailable. Update the booking service and reload this page.");let n={...t.productLoadParams,product_id:e,schedule_date:t.serviceDatetime.slice(0,10),schedule_datetime:t.serviceDatetime,with_count:["bundleGroup","optionGroup"],with_schedule:1,...null!=t.customerId?{customer_id:Number(t.customerId)}:{}},r="prepare-configuration"===i?await a.prepareProductDetail({...n,retry:!0}):await a.queryCatalogProductDetail(n);if(!r||Number(r.id)!==e)throw new e1x("NOT_IN_CATALOG","This extra is no longer available in the selected menu at the current venue time.");for(let[e,t]of[["option_group_count","option_group"],["bundle_group_count","bundle_group"]])if(Number(r[e])>0&&!Array.isArray(r[t]))throw new e1x("INCOMPLETE_DETAIL","Product options are not ready. Please retry.");let o=iA({productDetail:r,requestedProductId:e,completeness:"complete",missingGroupPolicy:l.detailMissingGroupPolicy??"reject"});if("invalid"===o.status)throw new e1x("INCOMPLETE_DETAIL",o.issues.map(e=>e.message).join(" "));if(lZ(r.open_sold_weight))throw new e1x("WEIGHING_REQUIRED","This extra requires a measured weight and cannot be added from this booking page.");return o.productDetail},b=async(e,t,l,i,a,n,r,o)=>{var d,c,u,p,m,g,h;let v,f=a.catalogSession;if(!(null==f?void 0:f.calculateProductBookingPrice))throw new e1x("CATALOG_SESSION_REQUIRED","The extras catalog service is unavailable. Update the booking service and reload this page.");let y=(null==o?void 0:o.detail)===e?o.policy:await a.resolveSelectionPolicy(e),b=iC(e,e1M(t),y);if(!b)throw new e1x("INVALID_CONFIGURATION","An option or variant is no longer available. Please choose the options again.");!function(e,t,l,i){var a,n,r,o,s;e1C(l);let d=(t.product_variant_id?null==(a=e.variant)?void 0:a.find(e=>String(e.id)===String(t.product_variant_id)):void 0)??e;if(!l3(e,{overSold:i})||!l3(d,{overSold:i})||lZ(e.is_grey))throw new e1x("SOLD_OUT","This extra is currently unavailable. Choose another item or remove it.");if(lZ(d.is_track)&&!i&&l>Number(d.stock_quantity??0))throw new e1x("INSUFFICIENT_STOCK","The selected quantity is no longer available.");let c=null==(n=e.item_rule_limit)?void 0:n.remainingMax;if(l<Number((null==(r=e.item_rule_limit)?void 0:r.min)??0)||null!=c&&l>Number(c))throw new e1x("QUANTITY_LIMIT",(null==(o=e.item_rule_limit)?void 0:o.validationMessage)||"Update this extra to an available quantity.");let u=[...t.option,...t.bundle].map(e=>({row:e,multiplier:l}));for(let e of t.bundle)for(let t of e.option??(null==(s=e.product_sku)?void 0:s.option)??[])u.push({row:t,multiplier:l*Number(e.num??1)});for(let{row:e,multiplier:t}of u)if(lZ(e.is_track)&&!i&&t*Number(e.num??1)>Number(e.stock_quantity??0))throw new e1x("INSUFFICIENT_STOCK","An option or bundle item no longer has enough stock.")}(e,b,l,y.overSold);let x={...e,product_id:e.id,product_variant_id:b.product_variant_id,quantity:l,num:l,product_sku:{option:b.option},product_bundle:b.bundle.map(ekr)},k=await f.calculateProductBookingPrice({product:x,datetime:i.serviceDatetime,channel:"online_ordering",...null!=i.customerId?{customer_id:i.customerId}:{}});if(Number(k.product_id)!==Number(e.id)||Number(k.product_variant_id??0)!==Number(b.product_variant_id??0))throw new e1x("PRICE_MISMATCH","The returned price does not match the selected extra. Please retry.");if(null==k.unit_price||""===String(k.unit_price).trim()||!Number.isFinite(Number(k.unit_price))||0>Number(k.unit_price))throw new e1x("PRICE_UNAVAILABLE","The current price is unavailable. Please retry before adding this extra.");let _=eks(x.product_bundle,k)??[],w={...e.metadata||{},...e1A(i),quotation_shelf_id:k.quotation_shelf_id};delete w.unique_identification_number,delete w.booking_uid;let{source:S,overrideVariantId:j}=e1f(e,b.product_variant_id,n),N=Ho(S),C=n?s(n):[],M=r??C;if((N.required||N.enabled&&M.length>0)&&(null==(d=(c=a.os).supportsVenueExtraHolders)?void 0:d.call(c))!==!0)throw new e1x("HOLDER_SERVICE_REQUIRED","The booking service needs to be updated to save holder profiles.");if((N.required||void 0!==r)&&!e1b(e,b.product_variant_id,l,M,i.customerId,n))throw new e1x("HOLDER_REQUIRED","Review the holder profiles for this item.");let T=N.raw??{status:"disable",required:0};w.holder_config=T,w.venue_extra_holder_variant_id=j,"tickets"===i.mode&&delete w.venue_booking_parent_uid,n&&(w.unique_identification_number=e1k(n));let I={...x,price:k.unit_price,selling_price:k.unit_price,quotation_shelf_id:k.quotation_shelf_id,total:void 0,line_total:void 0,price_override:void 0,_extend:N.enabled||M.length?{holder_relations:M}:void 0,unique_identification_number:void 0,discount_list:[],metadata:w,option:b.option,bundle:_,product_bundle:_,holder_config:T,booking_uid:void 0},P=!1;if(n){(v=ekd({line:{...n,num:l,product_sku:x.product_sku,product_bundle:_},result:k,resetDiscountList:!0})).unique_identification_number=e1k(n),v.updates.metadata={...v.updates.metadata,...e1A(i)};let e={...n,...v.updates};if(P=e1P(n)!==e1P(e),e1P(n)===e1P(e)){let e=null==(m=n.product_bundle)?void 0:m.map(e=>{var t;return{...e,quotation_shelf_id:null==(t=_.find(t=>e1I(t)===e1I(e)))?void 0:t.quotation_shelf_id}}),t=[null==(g=n.metadata)?void 0:g.quotation_shelf_id,null==(h=n.product_bundle)?void 0:h.map(e=>e.quotation_shelf_id),Object.keys(e1A(i)).map(e=>{var t;return null==(t=n.metadata)?void 0:t[e]})],l=[k.quotation_shelf_id,null==e?void 0:e.map(e=>e.quotation_shelf_id),Object.values(e1A(i))];v=JSON.stringify(t)===JSON.stringify(l)?void 0:{product_id:n.product_id,product_variant_id:n.product_variant_id,unique_identification_number:e1k(n),updates:{metadata:{...n.metadata,...e1A(i),quotation_shelf_id:k.quotation_shelf_id},...e?{product_bundle:e}:{}}}}(void 0!==r||JSON.stringify(null==(u=n.metadata)?void 0:u.holder_config)!==JSON.stringify(T)||((null==(p=n.metadata)?void 0:p.venue_extra_holder_variant_id)??null)!==j)&&(v={...v||{product_id:n.product_id,product_variant_id:n.product_variant_id,unique_identification_number:e1k(n)},updates:{...null==v?void 0:v.updates,holder_config:T,metadata:{...(null==v?void 0:v.updates.metadata)||n.metadata,holder_config:T,venue_extra_holder_variant_id:j},...void 0!==r?{_extend:{holder_relations:M}}:{}}})}return{source:I,update:v,priceChanged:P}},x=async function(e,a,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"local",c=arguments.length>4?arguments[4]:void 0,p=++i;n.clear();try{let h=(null==r?void 0:r.options)??t(),v=(null==r?void 0:r.context)??e1j(h);if(e1C(a),m(v),h.catalog.loading||h.catalog.error||!h.catalog.products.some(t=>Number(t.id)===Number(e.id)))throw new e1x("CATALOG_NOT_READY","Wait for the current extras menu to load, then choose this item again.");let f=h.catalog.products,b=h.os.getTempOrder(),x=u(b),k=c?d(c):void 0,_=await y(Number(e.id),v,h,o),w=await h.resolveSelectionPolicy(_);if(g(v,h),h.os.getTempOrder()!==b||u(b)!==x)throw new e1x("STALE_CART","The order changed. Please choose this extra again.");if(p!==i)throw new e1x("STALE_SELECTION","A newer extra selection is already open.");if(t().catalog.products!==f)throw new e1x("STALE_CATALOG","The extras menu changed. Please choose this item again.");let S=`party-extra-${Date.now()}-${++l}`,j=iD({productDetail:_,requestedProductId:_.id,completeness:"complete",missingGroupPolicy:h.detailMissingGroupPolicy??"reject",mode:"product-configuration",openId:S,scopeKey:v.scopeKey,detailRevision:S,selectionKey:_.id});if("invalid"===j.status)throw new e1x("INCOMPLETE_DETAIL",j.issues.map(e=>e.message).join(" "));let N="ready"===j.status,C=c?e1T(c):{product_id:_.id,product_variant_id:0,option:[],bundle:[]},M=Ho(e1y(_,C.product_variant_id,c)).enabled,T={id:S,contextKey:e1w(v),productId:_.id,quantity:a,productDetail:_,hasSku:N,...c?{lineUid:e1k(c),editingLine:c,holderRelations:s(c)}:{}};!r||N||M||(r.prepared={detail:_,policy:w}),n.clear(),n.set(S,{session:T,catalog:f,catalogSession:h.catalogSession,os:h.os,order:b,orderIdentity:x,lineSnapshot:k,consumed:!1});let I={skuValue:C,variantDraft:null};if("ready"===j.status)return{status:"ready",session:T,configuration:I,plan:j.plan};if(!M&&!c)return{status:"direct",session:T,configuration:I};return{status:"ready",session:T,configuration:I,plan:{openId:S,scopeKey:v.scopeKey,detailRevision:S,selectionKey:S,productDetail:_,mode:"product-configuration",hasConfiguration:!0}}}catch(t){return{status:"invalid",issues:[e1N(t,void 0,Number(e.id))]}}},k=async(e,l)=>{let i=o().find(t=>e1k(t)===e),a=i&&t().catalog.products.find(e=>Number(e.id)===Number(i.product_id));return i&&a?x(a,l??Number(i.num),void 0,"prepare-configuration",i):{status:"invalid",issues:[e1N(new e1x("LINE_NOT_FOUND","This extra is no longer available. Review your order."),i)]}},_=async function(e,l,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.quantity,r=arguments.length>4?arguments[4]:void 0;return v(async()=>{var s,c,p;let m=(null==i?void 0:i.options)??t(),g=(null==i?void 0:i.context)??e1j(m),v=n.get(e.id);if(!v||v.session!==e||v.consumed||v.os!==m.os||v.catalogSession!==m.catalogSession||e.contextKey!==e1w(g)||v.catalog!==m.catalog.products||v.order!==m.os.getTempOrder()||v.orderIdentity!==u(m.os.getTempOrder()))throw new e1x("STALE_SESSION","The extra selection has expired. Please choose it again.");let x=e1C(a),k=(null==i?void 0:i.guard)??h(g,m);k.beforeApply(),await (null==(s=m.beforeMutate)?void 0:s.call(m)),k.beforeApply();let _=(null==i||null==(c=i.prepared)?void 0:c.detail)??await y(e.productId,g,m),w=e.lineUid?o().find(t=>e1k(t)===e.lineUid):void 0;if(e.lineUid&&(!w||d(w)!==v.lineSnapshot))throw new e1x("STALE_CART","This extra has changed. Please open it again.");let S=w?e1T(w):l.skuValue,j=await b(_,S,x,g,m,w,r,null==i?void 0:i.prepared);if(k.beforeApply(),v.catalog!==t().catalog.products)throw new e1x("STALE_CATALOG","The extras menu changed. Please choose this item again.");let N=w?{allowed:!0,noteDraft:void 0}:await m.cart.prepareAllergyBeforeCommit({product:j.source,flowId:e.id,perFlow:!0});if(k.beforeApply(),!N.allowed)return{status:"cancelled"};if(await (null==(p=m.beforeMutate)?void 0:p.call(m)),k.beforeApply(),v.catalog!==t().catalog.products)throw new e1x("STALE_CATALOG","The extras menu changed. Please choose this item again.");if(v.consumed=!0,w)return j.update&&await m.os.updateOrderProducts([j.update],k),await f(),{status:"updated"};let C=await m.os.addRetailProduct({product:j.source,quantity:x,salesNotes:N.noteDraft?[N.noteDraft]:void 0,availabilityCommitGuard:k.beforeApply});return await f(),{status:"added",products:C}})},w=async function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t(),i=e1S(l),a=l.os.getTempOrder(),n=u(a),r=null==a?void 0:a.customer_id,s=new Set(e),d=o(i).filter(e=>s.has(e1k(e)));if(!a||Number(a.order_id||0)>0||!s.size||s.size!==e.length||e.some(e=>!e)||d.length!==s.size||new Set(d.map(e1k)).size!==s.size||a.products.filter(e=>s.has(e1k(e))).length!==s.size||d.some(e=>{var t;return(null==(t=e.metadata)?void 0:t.venue_booking_scope_key)!==i.scopeKey}))throw new e1x("LINE_NOT_FOUND","These extras changed. Please review the cart.");let c=()=>t().os===l.os&&l.os.getTempOrder()===a&&u(a)===n&&a.customer_id===r&&e1w(e1S(t()))===e1w(i),p=JSON.stringify([a.products,a.bookings,a.notes]),m=()=>{if(!c()||p!==JSON.stringify([a.products,a.bookings,a.notes]))throw new e1x("STALE_CART","The extras changed. Please review the cart.")};if(!l.os.removeProductsFromOrder)throw new e1x("CART_SERVICE_REQUIRED","The booking cart service needs to be updated.");m();try{let e=await l.os.removeProductsFromOrder(d.map(e=>({product_id:e.product_id,product_variant_id:e.product_variant_id,unique_identification_number:e1k(e)})),{beforeApply:m,isCurrentOrder:c});if(!c())throw new e1x("STALE_CART","The order changed while removing extras.");return await f(),{status:"updated",products:e}}catch(e){throw c()&&await f(),e}},S=async(e,l,i)=>v(async()=>{var a,n,r;let s=(null==i?void 0:i.options)??t();if(!Number.isSafeInteger(l)||l<0)throw new e1x("INVALID_QUANTITY","Choose a valid quantity.");let d=o().find(t=>e1k(t)===e);if(!d||!e)throw new e1x("LINE_NOT_FOUND","This extra has changed. Please refresh the cart.");if(l===Number(d.num))return{status:"unchanged"};if(0===l)return w([e],s);let c=(null==i?void 0:i.context)??e1j(s),u=(null==i?void 0:i.guard)??h(c,s);u.beforeApply(),await (null==(a=s.beforeMutate)?void 0:a.call(s)),u.beforeApply();let p=(null==i||null==(n=i.prepared)?void 0:n.detail)??await y(Number(d.product_id),c,s);if(Ho(e1y(p,d.product_variant_id,d)).enabled)return k(e,l);let m=await b(p,e1T(d),l,c,s,d,void 0,null==i?void 0:i.prepared);u.beforeApply(),await (null==(r=s.beforeMutate)?void 0:r.call(s)),u.beforeApply();let g=await s.os.updateOrderProducts([m.update],u);return await f(),{status:"updated",products:g}}),j=(e,t)=>S(e,t),N=async e=>{let l=t(),i=e1j(l,e),a=l.os.getTempOrder(),n=u(a),r=o(e1S(l)),s=c(e1S(l)),d={context:i,contextKey:e1w(i),sourceRows:r,orderSignature:s,validRows:[],updates:[],invalidItems:[],priceChanged:!1};if(!r.length)return d;let p=new Map;for(let e of r)try{if(!e1k(e))throw new e1x("MISSING_LINE_UID","This extra has no line identity. Remove it and add it again.");let t=Number(e.product_id);p.has(t)||p.set(t,y(t,i,l));let a=await p.get(t),n=await b(a,e1T(e),Number(e.num),i,l,e);d.validRows.push(n.source),d.priceChanged||(d.priceChanged=n.priceChanged),n.update&&d.updates.push(n.update)}catch(t){d.invalidItems.push(e1N(t,e))}if(l.os!==t().os||l.catalogSession!==t().catalogSession||l.os.getTempOrder()!==a||u(a)!==n||s!==c(e1S(l))||e1w(e1S(l))!==e1w(e1S(t())))throw new e1x("STALE_CART","The Party or extras changed while checking availability. Please retry.");return d},C=async()=>v(async()=>{var e,l;let i=t(),a=h(e1S(i),i);a.beforeApply(),await (null==(e=i.beforeMutate)?void 0:e.call(i)),a.beforeApply();let n=await N();if(g(n.context,i),n.orderSignature!==c(n.context))throw new e1x("STALE_CART","The extras changed while checking availability. Please retry.");return a.beforeApply(),n.updates.length&&(await (null==(l=i.beforeMutate)?void 0:l.call(i)),a.beforeApply(),await i.os.updateOrderProducts(n.updates,a),await f()),n}),I.current={prepare:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return x(e,t,void 0,"prepare-configuration")},prepareEdit:k,commit:function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.quantity,i=arguments.length>3?arguments[3]:void 0;return _(e,t,void 0,l,i)},setProductQuantity:async(e,l)=>{let i;if(!Number.isSafeInteger(l)||l<0)throw new e1x("INVALID_QUANTITY","Choose a valid quantity.");let a=o().filter(t=>Number(t.product_id)===Number(e.id)),n=a.reduce((e,t)=>e+Number(t.num||0),0);if(n===l)return{status:"unchanged"};if(l<n){var r,s,d;if(1===a.length)return j(e1k(a[0]),l);if(!lZ(e.is_variant)&&!lZ(e.is_bundle)&&!lZ(e.open_sold_weight)&&!lZ(e.isOpenDetailModal)&&!["session_product","session_ticket"].includes(String(e.extension_type||""))&&!Number(e.option_group_count||0)&&!Number(e.bundle_group_count||0)&&!(null==(r=e.variant_group)?void 0:r.length)&&!(null==(s=e.option_group)?void 0:s.length)&&!(null==(d=e.bundle_group)?void 0:d.length)&&a.every(e=>{var t;return!Number(e.product_variant_id)&&!((null==(t=e.product_sku)?void 0:t.option)||[]).length&&!(e.product_bundle||[]).length})){let e=a[a.length-1];return j(e1k(e),Math.max(0,Number(e.num)-(n-l)))}return{status:"choose-line",rows:a,targetQuantity:l}}try{let e,l,a,n;e=t(),l=e1j(e),a=e.catalog.products,n=h(l,e),i={options:e,context:l,guard:{...n,beforeApply:()=>{if(n.beforeApply(),t().catalog.products!==a)throw new e1x("STALE_CATALOG","The extras menu changed. Please choose this item again.")}}}}catch(t){return{status:"invalid",issues:[e1N(t,void 0,Number(e.id))]}}let c=await x(e,l-n,i);if("direct"!==c.status)return c;if(o().filter(t=>Number(t.product_id)===Number(e.id)).reduce((e,t)=>e+Number(t.num||0),0)!==n)throw new e1x("STALE_CART","The extra quantity changed. Please retry.");return 1===a.length?S(e1k(a[0]),l,i):_(c.session,c.configuration,i)},setLineQuantity:j,removeLines:e=>v(()=>w(e)),prepareRevalidation:N,revalidate:C});let[P,A]=(0,eC.useState)(0),[D,E]=(0,eC.useState)([]),[O,z]=(0,eC.useState)(()=>e1w(e));(0,eC.useEffect)(()=>(T.current=!0,()=>{T.current=!1}),[]);let L=(0,eC.useMemo)(()=>{var t;return e1_((null==(t=e.cart.tempOrder)?void 0:t.products)??[],e)},[e.cart.tempOrder,e.parentLineUid,e.mode,e.scopeKey]),R=e1w(e);(0,eC.useEffect)(()=>{L.length||z(R)},[R,L.length]);let $=(0,eC.useMemo)(()=>{let t=new Set(L.map(e1k)),l=D.filter(e=>e.lineUid&&t.has(e.lineUid));for(let t of L){var i;let a=e1k(t);R===O&&(null==(i=t.metadata)?void 0:i.venue_booking_scope_key)===e.scopeKey||l.some(e=>e.lineUid===a)||l.push({code:"REVALIDATION_REQUIRED",message:"The booking context changed. Check this extra again before checkout.",lineUid:a,productId:Number(t.product_id),line:t})}return l},[L,D,R,O,e.scopeKey]),F=(0,eC.useMemo)(()=>{let e={};for(let t of L){let l=Number(t.num);if(Number.isFinite(l)&&l>0){let i=String(t.product_id);e[i]=(e[i]??0)+l}}return e},[L]);return{...(0,eC.useMemo)(()=>{let e=I.current,t=async e=>{T.current&&A(e=>e+1);try{return await e()}finally{T.current&&A(e=>Math.max(0,e-1))}};return{prepare:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepare(...i))},prepareEdit:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepareEdit(...i))},commit:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.commit(...i);return T.current&&i[0].lineUid&&"updated"===t.status&&E(e=>e.filter(e=>e.lineUid!==i[0].lineUid)),t})},setProductQuantity:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.setProductQuantity(...i))},setLineQuantity:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.setLineQuantity(...i);return T.current&&E(e=>e.filter(e=>e.lineUid!==i[0])),t})},removeLines:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.removeLines(...i);return T.current&&E(e=>e.filter(e=>!e.lineUid||!i[0].includes(e.lineUid))),t})},prepareRevalidation:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepareRevalidation(...i))},revalidate:()=>t(async()=>{let t=await e.revalidate();return T.current&&e1w(M.current)===t.contextKey&&(E(t.invalidItems),z(t.contextKey)),t})}},[]),rows:L,quantityByProductId:F,invalidItems:$,busy:P>0}},e1E=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")},e1O=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.booking_uid??"")},e1z=e=>"string"==typeof e&&""!==e.trim()||"number"==typeof e&&Number.isFinite(e),e1L=(e,t)=>{let l=String(e??"").slice(0,10),i=String(t??"");return/^\d{4}-\d{2}-\d{2}$/.test(l)&&/^\d{2}:\d{2}(:\d{2})?$/.test(i)?`${l} ${5===i.length?`${i}:00`:i}`:""},e1R=e=>{let t=String(e??"").replace("T"," ");return 16===t.length?`${t}:00`:t},e1$=e=>e1R(e).slice(0,16);function e1F(e,t){let l={bindings:[],extras:[],gifts:[],issues:[]},i=(e,t,i,a)=>l.issues.push({code:e,message:t,productLineUid:i,bookingUid:a});if(!e)return i("ORDER_REQUIRED","The booking draft is unavailable."),l;Number(e.order_id||0)>0&&i("NEW_DRAFT_REQUIRED","This entry supports new booking drafts only.");let a=Array.isArray(e.products)?e.products:[],n=Array.isArray(e.bookings)?e.bookings:[],r=new Set,o=new Set;for(let e of a){var s,d,c,u,p,m,g,h;let v=e1E(e),f=null==(s=e.metadata)?void 0:s.venue_booking_role;if(null==(d=e.metadata)?void 0:d._giftInfo){l.gifts.push(e);let t=String(e.booking_uid??(null==(u=e.metadata)?void 0:u.booking_uid)??"");n.filter(e=>t&&e1O(e)===t||String(e.product_uid??"")===v).forEach(e=>o.add(e1O(e)));continue}if("party_extra"===f||"tickets_extra"===f){f!==("tickets"===t.mode?"tickets_extra":"party_extra")&&i("UNEXPECTED_ORDER_LINE","The draft contains an extra from another booking entry.",v),(!v||r.has(v))&&i("INVALID_LINE_IDENTITY","The extra line identity is missing or duplicated.",v),r.add(v),Number(e.order_detail_id||0)>0&&i("NEW_DRAFT_REQUIRED","An existing extra cannot be edited here.",v),(!Number.isSafeInteger(Number(e.num))||0>=Number(e.num))&&i("EXTRA_QUANTITY_INVALID","Update this extra to a valid quantity.",v),(null==(p=e.metadata)?void 0:p.venue_booking_scope_key)&&(!t.scopeKey||e.metadata.venue_booking_scope_key===t.scopeKey)||i("EXTRA_SCOPE_INVALID","This extra belongs to another booking entry.",v);let o=String((null==(m=e.metadata)?void 0:m.venue_booking_parent_uid)||"");"tickets_extra"===f&&o&&i("EXTRA_PARENT_INVALID","Ticket extras belong to the order, not a booking line.",v),"party_extra"!==f||a.some(t=>{var l,i;return e1E(t)===o&&(null==(l=t.metadata)?void 0:l.venue_booking_role)==="party_main"&&t.metadata.venue_booking_scope_key===(null==(i=e.metadata)?void 0:i.venue_booking_scope_key)})||i("EXTRA_PARENT_INVALID","The Party product for this extra is missing.",v),(null==(g=e.metadata)?void 0:g.venue_booking_service_datetime)||i("EXTRA_PRICE_CONTEXT_MISSING","Recheck this extra before checkout.",v),(e.booking_uid||(null==(h=e.metadata)?void 0:h.booking_uid)||n.some(e=>String(e.product_uid||"")===v))&&i("EXTRA_BOOKING_INVALID","An extra must not create a booking.",v),l.extras.push(e);continue}if(f!==("tickets"===t.mode?"tickets":"party_main")){i("UNEXPECTED_ORDER_LINE","The draft contains a product from another booking entry.",v);continue}if(!v||r.has(v)){i("INVALID_LINE_IDENTITY","The product line identity is missing or duplicated.",v);continue}r.add(v),Number(e.order_detail_id||0)>0&&i("NEW_DRAFT_REQUIRED","An existing order line cannot be edited here.",v);let y=String(e.booking_uid??(null==(c=e.metadata)?void 0:c.booking_uid)??""),b=n.filter(e=>y&&e1O(e)===y||String(e.product_uid??"")===v);if(1!==b.length){i("BOOKING_LINK_INVALID","A booking product must have exactly one linked booking.",v);continue}let x=b[0],k=e1O(x);if(!k||o.has(k)||y&&y!==k||x.product_uid&&String(x.product_uid)!==v){i("BOOKING_LINK_INVALID","The booking and product line identities no longer match.",v,k);continue}o.add(k);let _=e1L(x.start_date,x.start_time),w=e1L(x.end_date,x.end_time),S=x.metadata||{},j=String(S.availability_business_date||t.date||_.slice(0,10)),N=Number(e.num);_&&w&&!(w<=_)||i("BOOKING_TIME_INVALID","The saved booking interval is incomplete.",v,k),Number.isSafeInteger(N)&&1===N||i("BOOKING_LINE_COUNT_INVALID","Each saved booking must map to one product line.",v,k),S.availability_candidate_key&&S.availability_source&&S.availability_slice_start_at&&S.availability_slice_end_at&&Array.isArray(S.availability_schedule_refs)||i("BOOKING_INTENT_MISSING","The saved booking is missing its original availability intent. Please reselect it.",v,k);let C=[];for(let e of Array.isArray(x.resources)?x.resources:[]){let t=e.relation_id??e.resource_id??e.id;if(!e1z(t)||0===Number(t)||!e1z(e.form_id)){i("BOOKING_RESOURCE_INVALID","The saved resource identity is incomplete.",v,k);continue}C.push({formId:e.form_id,resourceId:t,capacity:Number(e.capacity)})}l.bindings.push({productLineUid:v,bookingUid:k,identity:e_f(e),line:e,booking:x,quantity:N,date:j,intent:{date:j,startAt:_,endAt:w,sliceStartAt:String(S.availability_slice_start_at??""),sliceEndAt:String(S.availability_slice_end_at??""),candidateKey:String(S.availability_candidate_key??""),source:String(S.availability_source??""),scheduleRefs:S.availability_schedule_refs||[],timezone:S.availability_timezone,primaryScheduleRef:S.availability_primary_schedule_ref,resources:C}})}l.bindings.length||i("BOOKING_REQUIRED","Add a booking before continuing."),"party"===t.mode&&1!==l.bindings.length&&i("PARTY_SINGLE_MAIN_REQUIRED","A party order requires one main product, room and time.");let v=new Set(l.bindings.map(e=>e.date));for(let e of((v.size>1||t.date&&[...v].some(e=>e!==t.date))&&i("SINGLE_DATE_REQUIRED","All bookings must retain the selected booking date."),n))o.has(e1O(e))||i("ORPHAN_BOOKING","The draft contains an unlinked booking.",void 0,e1O(e));return l}let e1q=e=>{var t;return(0,no.cloneDeep)(e&&{orderId:e.order_id,externalSaleNumber:e.external_sale_number,localId:null==(t=e._extend)?void 0:t.localId,customerId:e.customer_id,products:e.products,bookings:e.bookings,holder:e.holder,holderRelations:e.holder_relations,notes:e.notes,orderDiscounts:e.discount_list,shopDiscount:e.shop_discount,payments:e.payments})};async function e1B(e){var t,l,i;let a=e.os.getTempOrder(),n=e1q(a),r=e1F(a,e),o={bindings:[],extras:r.extras,gifts:r.gifts,issues:[...r.issues]},s=void 0===e.customerId?null==a?void 0:a.customer_id:e.customerId;if(String(s??"")!==String((null==a?void 0:a.customer_id)??"")&&o.issues.push({code:"CUSTOMER_CHANGED",message:"The customer changed. Please review the booking again."}),r.issues.length)return o;let d=()=>{var t;let l;return(null==(t=e.isCurrent)?void 0:t.call(e))!==!1&&(l=e.os,(0,no.isEqual)(e1q(l.getTempOrder()),n))};if(!(null==(t=e.catalog)?void 0:t.menuListIds.length)||!(null==(l=e.queries)?void 0:l.queryCatalogProductDetail)||!e.os.buildCacheItemFromOrderLine)return o.issues.push({code:"BOOKING_SERVICE_UNAVAILABLE",message:"The configured booking menu or detail service is unavailable."}),o;for(let t of r.bindings){let l,a;try{if(!d())throw Error("ORDER_CHANGED");let n={menu_list_ids:[...e.catalog.menuListIds],schedule_date:t.date,schedule_datetime:t.intent.startAt,...null!=s?{customer_id:Number(s)}:{}},r=await e.queries.queryCatalogProductDetail({...n,product_id:Number(t.line.product_id)});if(!d())throw Error("ORDER_CHANGED");if(!r||String(r.id)!==String(t.line.product_id))throw Error("PRODUCT_DETAIL_UNAVAILABLE");let c=iA({productDetail:r,requestedProductId:Number(t.line.product_id),completeness:"complete"});if("invalid"===c.status)throw Error("PRODUCT_DETAIL_INCOMPLETE");let u=e.os.buildCacheItemFromOrderLine({product:t.line,booking:t.booking,sourceProduct:r}),p=ews({...u,product_resource:r.product_resource,duration:r.duration,capacity:r.capacity,_data:{...u._data,capacitys:null==(i=r._data)?void 0:i.capacitys}}),m=$W(p._extend);if(!m||String(m.product_id)!==String(t.line.product_id)||String(m.product_variant_id)!==String(t.line.product_variant_id))throw Error("ORDER_SKU_INVALID");let g=new Map;for(let e of t.intent.resources){let t=String(e.formId),l=g.get(t)||{formId:e.formId,resourceIds:[]};l.resourceIds.push(e.resourceId),g.set(t,l)}if(a={...t,product:p,skuValue:m,selection:{requirementSelections:[...g.values()]}},l=await e0Q({os:e.os,mode:"tickets"===e.mode?"ticket":"party",date:t.date,product:p,quantity:t.quantity,editingProductLineUid:t.productLineUid}),!d())throw Error("ORDER_CHANGED");let h=l.times.filter(e=>{var l;return l=t.intent,e.key===l.candidateKey&&e.source===l.source&&e1R(e.startAt)===e1R(l.sliceStartAt)&&e1R(e.endAt)===e1R(l.sliceEndAt)&&e1$(e.bookingStartAt||e.startAt)===e1$(l.startAt)&&e1$(e.bookingEndAt||e.endAt)===e1$(l.endAt)&&(0,no.isEqual)(e.scheduleRefs,l.scheduleRefs)&&(!l.timezone||e.timezone===l.timezone)&&(!l.primaryScheduleRef||(0,no.isEqual)(e.primaryScheduleRef,l.primaryScheduleRef))});if(1!==h.length)throw Error("SELECTED_TIME_UNAVAILABLE");let v=await e0Z(e.os,l,h[0]);if(!d())throw Error("ORDER_CHANGED");let f=[];for(let e of t.intent.resources){let t=v.groups.filter(t=>String(t.formId)===String(e.formId)&&t.options.some(t=>String(t.resourceId)===String(e.resourceId)));if(1!==t.length)throw Error("SAVED_RESOURCE_GROUP_AMBIGUOUS");if(e.capacity!==l.partySize)throw Error("BOOKING_CAPACITY_CHANGED");let i=t[0],a=f.find(e=>e.requirementGroupId===i.groupId);a||(a={requirementGroupId:i.groupId,formId:i.formId,resourceIds:[]},f.push(a)),a.resourceIds.push(e.resourceId)}o.bindings.push({...t,product:p,skuValue:m,selection:{candidate:v.candidate,requirementSelections:f}})}catch(i){let l=i instanceof Error?i.message:"BOOKING_VALIDATION_FAILED";!e.requireAvailable&&a&&d()&&o.bindings.push(a),o.issues.push({code:l,message:"ORDER_CHANGED"===l?"The booking draft changed. Please review it again.":"This saved booking is no longer available. Please reselect it.",productLineUid:t.productLineUid,bookingUid:t.bookingUid})}finally{e0K(e.os,l)}if(!d())break}return o}function e1H(e,t){var l,i,a,n,r,o,s,d;let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en",u=e.sales.bookingTicket,p=null==u||null==(l=u.getCart)?void 0:l.call(u),m=new Set(e_J(u).map(e=>{var t;return String((null==(t=e.orderLine.metadata)?void 0:t.unique_identification_number)||"")})),g=new Set;for(let e of(null==p?void 0:p.bookings)||[]){let t=e.product_uid??(null==(n=e._extend)||null==(a=n.product)||null==(i=a.metadata)?void 0:i.unique_identification_number);t&&g.add(String(t))}for(let e of(null==p?void 0:p.items)||[])!["tickets_extra","party_extra"].includes(null==(r=e.metadata)?void 0:r.venue_booking_role)&&(null==(o=e.metadata)?void 0:o.unique_identification_number)&&g.add(String(e.metadata.unique_identification_number));let h=[],v=[];if(u)for(let e of g){let t=e_X(u,e);if(!t)continue;let l=Ho(t.cacheItem),i=Number((null==(s=t.cacheItem._extend)?void 0:s.quantity)||1),a=Number.isSafeInteger(i)&&i>0?i:1,n={...t,uid:e,config:l,quantity:a,title:eXp(t.orderLine.product_title||t.cacheItem.title||t.cacheItem.name||t.cacheItem.product_name,c),ids:UR(null==(d=t.cacheItem._extend)?void 0:d.holder_id),missing:m.has(e)};(t.booking||l.enabled)&&v.push(n),l.enabled&&h.push(n)}let f=h.reduce((e,t)=>e+t.quantity,0),y=h.reduce((e,t)=>e+Math.min(t.quantity,t.ids.length),0),b=h.reduce((e,t)=>e+(t.config.required?t.quantity:0),0),x=h.reduce((e,t)=>e+(t.config.required?Math.min(t.quantity,t.ids.length):0),0),k=JSON.parse(e1V(e,t||"")),_=void 0!==t&&e1W(u,e1V(e,t))||!!u&&[...e1U.get(u)||[]].some(e=>{let l=JSON.parse(e);return(void 0===t||l[0]===t)&&l[1]===k[1]&&l[2]===k[2]});return{enabled:h.length>0,required:b>0,complete:!_&&x===b,total:f,completed:y,requiredCount:b,requiredCompleted:x,pending:!1,blocked:_,lines:h,displayLines:v}}function e1V(e,t){var l,i,a;let n=(null==(i=e.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))??e.sales.tempOrder;return JSON.stringify([t,(null==n||null==(a=n._extend)?void 0:a.localId)||(null==n?void 0:n.external_sale_number)||(null==n?void 0:n.order_id),null==n?void 0:n.customer_id])}let e1U=new WeakMap,e1Y=e=>`pisell:venue-booking:holder-unconfirmed:${e}`;function e1W(e,t){var l;if(!e)return!1;if(null==(l=e1U.get(e))?void 0:l.has(t))return!0;try{return"1"===sessionStorage.getItem(e1Y(t))}catch{return!1}}let e1K=new WeakMap;function e1G(e,t){var l;return!!e&&!!(null==(l=e1K.get(e))?void 0:l.has(t))}let e1Q=(0,eC.memo)(function(e){var t,l,i,a,n,r,o;let{balanceAmount:s="$15.1",customerEmail:d="customer@email.com",customerName:c="",onClose:u,sendPaymentLink:p,customerId:m}=e,g=env(),h=e$();s2(W9,(null==(n=h.appHelper.utils)||null==(a=n.getApp)||null==(i=a.call(n))||null==(l=i.locales)||null==(t=l.getLocale)?void 0:t.call(l))||(null==(o=h.appHelper.utils)||null==(r=o.storage)?void 0:r.get("umi_locale"))||"en");let v=qR(),f=(e,t)=>eL.getText(e)||t,[y,b]=(0,eC.useState)(d||"");(0,eC.useEffect)(()=>{b(d||"")},[d]);let x=(0,eH.jsx)("div",{className:aT()("send-payment-link-modal"),children:(0,eH.jsx)("div",{className:aT()("modal-content"),children:(0,eH.jsxs)("div",{className:aT()("main-content"),children:[(0,eH.jsx)("div",{className:aT()("illustration-container"),children:(0,eH.jsx)("img",{src:g+"/send_payment_link.png",className:aT()("illustration")})}),(0,eH.jsxs)("div",{className:aT()("form-container"),children:[(0,eH.jsx)("div",{className:aT()("email-options-container"),children:(0,eH.jsxs)("div",{className:aT()("email-section"),children:[(0,eH.jsxs)("div",{className:aT()("section-label"),children:[(e=>{if(oi(m))return"";let t=f("pisell2.checkout.send-payment-link.customer-name-format");return"function"==typeof t?t(e):`${e}'s `})(c),f("pisell2.checkout.send-payment-link.email-address","Email Address")]}),(0,eH.jsx)("div",{className:aT()("email-option"),children:(0,eH.jsx)("div",{className:aT()("email-input-container"),children:(0,eH.jsx)("div",{className:`${aT()("email-input")} ${aT()("email-input-selected")}`,children:(0,eH.jsx)("input",{type:"email",value:y,onChange:e=>b(e.target.value),placeholder:f("pisell2.checkout.send-payment-link.email-placeholder","Enter email address"),className:aT()("email-text-input")})})})})]})}),(0,eH.jsx)("div",{className:aT()("footer"),children:(0,eH.jsx)("button",{className:aT()("send-button"),onClick:()=>{var e;y&&""!==y.trim()?(e=y.trim(),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))?(p({emails:[y.trim()],amount:s}),null==u||u()):v.fail(f("pisell2.checkout.send-payment-link.email-invalid")):v.fail(f("pisell2.checkout.send-payment-link.email-required"))},children:f("pisell2.checkout.send-payment-link.send-button","Send Link")})})]})]})})});return(0,eH.jsx)(eT.Modal,{title:f("pisell2.checkout.send-payment-link.modal-title","Send Payment Link"),width:680,footer:null,centered:!0,wrapClassName:"send-payment-link-modal-wrapper",open:!0,onCancel:u,children:x})}),e1Z=e=>(0,eH.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"currentColor",viewBox:"0 0 24 24",...e,children:(0,eH.jsx)("path",{fillRule:"evenodd",d:"M11.293 8.293a1 1 0 0 1 1.414 0l6 6a1 1 0 0 1-1.414 1.414L12 10.414l-5.293 5.293a1 1 0 0 1-1.414-1.414z",clipRule:"evenodd"})}),e1J=e=>(0,eH.jsx)(na,ak(ak({},e),{},{viewBox:(null==e?void 0:e.viewBox)||"0 0 24 24",component:e1Z})),e1X=function(e){var t;let l,i,{amountSymbol:a,orderInfo:n,cartData:r,onClose:o,summaryData:s=[],labelMaps:d,paymentItems:c=[],customAmount:u,voidPayment:p,walletPassData:m,clientInfo:g}=e,[h,v]=(0,eC.useState)(!0),[f,y]=(0,eC.useState)(!0),[b,x]=(0,eC.useState)(!0),k=e$(),_=(e,t)=>{var l,i,a,n,r,o,s,d;let c=null==(d=W9[(null==(r=k.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=k.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:d[e];return c||eL.getText(e)||t},w=()=>{var e;let t=g||{},l=e=>null!=e&&""!==String(e).trim()?String(e).trim():null,i=l(null==t?void 0:t.display_name)||l(null==t?void 0:t.name)||_("pisell2.checkout.customer.default-name")||"Customer";return{nickname:(null==t?void 0:t.nickname)&&(null==t?void 0:t.nickname)!=="Select a customer"?null==t?void 0:t.nickname:eL.getText("pisell2.checkout.customer.default-name"),display_name:i,email:(null==t?void 0:t.email)||(null==t||null==(e=t.contacts)?void 0:e.email)||""}},S=e=>{let{expanded:t,color:l="black"}=e;return(0,eH.jsx)("div",{className:aT()("collapse-icon",{expanded:t}),children:(0,eH.jsx)(e1J,{style:{color:l,fontSize:"24px"}})})},j=e=>{let t=e.order_payment_id;return("cash"===e.code||"custom"===e.type)&&eP_(e)&&(null==t||""===t)},N=e=>eP_(e),C=()=>c.filter(N).reduce((e,t)=>{let l=new lz(Math.abs(t.amount)),i=new lz(Number(t.rounding_amount)>0?0:t.rounding_amount||0);return new lz(e).plus(l).plus(i).toNumber()},0),M=e=>{p&&p(e)},T=e=>e.label||d&&d[e.key]||e.key;return(0,eH.jsxs)("div",{className:aT()("payment-detail-modal"),children:[(0,eH.jsxs)("div",{className:aT()("main-content"),children:[(0,eH.jsxs)("div",{className:aT()("section-container"),children:[(0,eH.jsxs)("div",{className:aT()("section-header"),onClick:()=>v(!h),children:[(0,eH.jsx)("div",{className:aT()("section-title-container"),children:(0,eH.jsx)("div",{className:aT()("section-title"),children:_("order.total")||"Order Total"})}),(0,eH.jsxs)("div",{className:aT()("section-right"),children:[(0,eH.jsx)("div",{className:aT()("section-amount"),children:lQ((l=s.find(e=>"sub_total"===e.key))?l.value:0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})}),(0,eH.jsx)(S,{expanded:h})]})]}),h&&(0,eH.jsx)("div",{className:aT()("section-content"),children:(()=>{if(!s||0===s.length)return(0,eH.jsx)("div",{className:aT()("order-details-grid"),children:(0,eH.jsx)("div",{className:aT()("order-details-column"),children:(0,eH.jsxs)("div",{className:aT()("order-row"),children:[(0,eH.jsx)("div",{className:aT()("order-row-text"),children:_("no.items.found")||"No items found"}),(0,eH.jsx)("div",{className:aT()("order-row-amount"),children:lQ(0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})})});let e=s.slice(0,Math.ceil(s.length/2)),t=s.slice(Math.ceil(s.length/2));return(0,eH.jsxs)("div",{className:aT()("order-details-grid"),children:[(0,eH.jsx)("div",{className:aT()("order-details-column"),children:e.map(e=>{let t="";return(null==e?void 0:e.key)!=="discount"&&(t=e.value>=0?"+":""),(0,eH.jsxs)("div",{className:aT()("order-row"),children:[(0,eH.jsx)("div",{className:aT()("order-row-label"),children:T(e)}),(0,eH.jsxs)("div",{className:aT()("order-row-amount"),children:[t,lQ(e.value,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},e.key)})}),t.length>0&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("div",{className:aT()("divider-vertical")}),(0,eH.jsx)("div",{className:aT()("order-details-column"),children:t.map(e=>{let t="";return(null==e?void 0:e.key)!=="discount"&&(t=e.value>=0?"+":""),(0,eH.jsxs)("div",{className:aT()("order-row"),children:[(0,eH.jsx)("div",{className:aT()("order-row-label"),children:T(e)}),(0,eH.jsxs)("div",{className:aT()("order-row-amount"),children:[t,lQ(e.value,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},e.key)})})]})]})})()})]}),(0,eH.jsx)("div",{className:aT()("divider-horizontal")}),(0,eH.jsxs)("div",{className:aT()("section-container"),children:[(0,eH.jsxs)("div",{className:aT()("section-header"),onClick:()=>y(!f),role:"button",tabIndex:0,children:[(0,eH.jsx)("div",{className:aT()("section-title-container"),children:(0,eH.jsx)("div",{className:aT()("section-title"),children:_("order.paid")||"Order Paid"})}),(0,eH.jsxs)("div",{className:aT()("section-right"),children:[(0,eH.jsxs)("div",{className:aT()("section-amount"),children:["-",lQ(C(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),(0,eH.jsx)(S,{expanded:f})]})]}),f&&(()=>{let e=c.filter(N),t=e.filter(e=>"deposit"===e.type),l=e.filter(e=>"deposit"!==e.type);if(0===e.length||0===l.length&&0===t.length)return(0,eH.jsx)("div",{className:aT()("section-content"),children:(0,eH.jsx)("div",{className:aT()("no-payment-text"),children:_("no.payments.recorded")||"No payments recorded"})});let i=t.reduce((e,t)=>new lz(e).plus(new lz(t.amount)).plus(new lz(Number(t.rounding_amount)>0?0:t.rounding_amount||0)).toNumber(),0),n=l.reduce((e,t)=>new lz(e).plus(new lz(t.amount)).plus(new lz(Number(t.rounding_amount)>0?0:t.rounding_amount||0)).toNumber(),0);return(0,eH.jsx)("div",{className:aT()("section-content"),children:(0,eH.jsxs)("div",{className:aT()("payment-record-container"),children:[t.length>0&&(0,eH.jsxs)("div",{className:aT()("payment-item-header"),children:[(0,eH.jsx)("div",{children:_("pisell2.subtotal.deposit")||"Deposit"}),(0,eH.jsx)("div",{children:lQ(i,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),t.map(e=>(0,eH.jsxs)("div",{className:aT()("payment-item"),children:[(0,eH.jsx)("div",{className:aT()("payment-item-bullet")}),(0,eH.jsxs)("div",{className:aT()("payment-item-content"),children:[(0,eH.jsxs)("div",{className:aT()("payment-item-text"),children:[e.name," - ",e.created_at||new Date().toLocaleDateString()," ",_("pisell2.checkout.payment-detail.by")||"by"," ",w().nickname]}),(0,eH.jsxs)("div",{className:aT()("payment-item-actions"),children:[(0,eH.jsxs)("div",{className:aT()("payment-item-amount"),children:["-",lQ(new lz(Math.abs(e.amount)).plus(new lz(Number(e.rounding_amount)>0?0:e.rounding_amount||0)).toNumber(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),j(e)&&(0,eH.jsx)("button",{className:aT()("void-button"),onClick:()=>M(e),type:"button",children:_("void")||"Void"})]})]})]},e.uuid)),l.length>0&&(0,eH.jsxs)("div",{className:aT()("payment-item-header"),children:[(0,eH.jsx)("div",{children:_("payment.text")||"Payment"}),(0,eH.jsx)("div",{children:lQ(n,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),l.map(e=>(0,eH.jsxs)("div",{className:aT()("payment-item"),children:[(0,eH.jsx)("div",{className:aT()("payment-item-bullet")}),(0,eH.jsxs)("div",{className:aT()("payment-item-content"),children:[(0,eH.jsxs)("div",{className:aT()("payment-item-text"),children:[e.name," - ",e.created_at||new Date().toLocaleDateString()," ",_("pisell2.checkout.payment-detail.by")||"by"," ",w().nickname]}),(0,eH.jsxs)("div",{className:aT()("payment-item-actions"),children:[(0,eH.jsxs)("div",{className:aT()("payment-item-amount"),children:["-",lQ(new lz(Math.abs(e.amount)).plus(new lz(Number(e.rounding_amount)>0?0:e.rounding_amount||0)).toNumber(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),j(e)&&(0,eH.jsx)("button",{className:aT()("void-button"),onClick:()=>M(e),type:"button",children:_("void")||"Void"})]})]})]},e.uuid))]})})})()]})]}),(0,eH.jsxs)("div",{className:aT()("balance-to-pay-section"),children:[(0,eH.jsxs)("div",{className:aT()("balance-to-pay-header"),onClick:()=>x(!b),role:"button",tabIndex:0,children:[(0,eH.jsx)("div",{className:aT()("section-title-container"),children:(0,eH.jsx)("div",{className:aT()("balance-to-pay-title"),children:_("balance.to.pay")||"Balance to Pay"})}),(0,eH.jsxs)("div",{className:aT()("balance-to-pay-right"),children:[(0,eH.jsx)("div",{className:aT()("balance-to-pay-amount"),children:lQ(new lz(n.totalAmount||0).sub(new lz(C())).toNumber().toFixed(2),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})}),(0,eH.jsx)(S,{expanded:b,color:"#7F56DA"})]})]}),b&&(0,eH.jsx)("div",{className:aT()("balance-to-pay-content"),children:(i=[],((null==m||null==(t=m.selectedWallet)?void 0:t.length)&&m.selectedWallet.forEach(e=>{i.push((0,eH.jsxs)("div",{className:aT()("balance-item-row"),children:[(0,eH.jsx)("div",{className:aT()("balance-item-text"),children:e.name||e.product_name||_("wallet.pass")||"Wallet Pass"}),(0,eH.jsxs)("div",{className:aT()("balance-item-amount"),children:["-",e.redeem||lQ(Math.abs(e.savedAmount||0),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},`wallet-${e.id}`))}),0===i.length)?(0,eH.jsx)("div",{className:aT()("balance-item-row","empty-state"),children:(0,eH.jsx)("div",{className:aT()("balance-item-text","empty-text"),children:_("pisell2.checkout.payment-detail.no-wallet-pass-items")||"No WalletPass payment items"})}):(0,eH.jsx)(eH.Fragment,{children:i}))}),(0,eH.jsx)("div",{className:aT()("balance-due-section"),children:(0,eH.jsxs)("div",{className:aT()("balance-due-header"),children:[(0,eH.jsx)("div",{className:aT()("balance-due-title"),children:_("balance.due")||"Balance Due"}),(0,eH.jsx)("div",{className:aT()("balance-due-amount"),children:lQ(u||0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})})]})]})},e10=(0,eC.forwardRef)((e,t)=>{let{children:l,value:i="",onChange:a,onConfirm:n,onCancel:r,showCurrencySymbol:o=!0,useThousandsSeparator:s=!1,selectType:d="dark",disabled:c=!1,overlayClassName:u="",style:p}=e,[m,g]=(0,eC.useState)(!1),[h,v]=(0,eC.useState)(""),[f,y]=(0,eC.useState)(!0);(0,eC.useImperativeHandle)(t,()=>({open:()=>{g(!0),v(i),y(!0)},close:()=>g(!1),isOpen:()=>m}));let b=(0,eH.jsx)("div",{className:"pisell-price-keyboard-popover-content",children:(0,eH.jsx)(nY.PisellPriceKeyboard,{value:h,onChange:e=>{if((""===e||0===e||"0"===e)&&!f){y(!0),v(e),null==a||a(e);return}if(f&&""!==e&&0!==e&&"0"!==e){y(!1);let t=String(h||"").replace(/[^\d.]/g,""),l=String(e).replace(/[^\d.]/g,"");if(t&&"0"!==t&&l.length>t.length&&l.startsWith(t)){let e=l.slice(t.length);if(e){v(e),null==a||a(e);return}}}v(e),null==a||a(e)},onEnter:e=>{null==n||n(e),g(!1)},doneText:eL.getText("pisell2.customise-item.save"),resetText:eL.getText("pisell2.booking.info.text.clear"),amountProps:{showCurrencySymbol:o,useThousandsSeparator:s},selectType:d,backgroundColor:"transparent"})});return(0,eH.jsx)(eT.Popover,{open:m,content:b,trigger:c?[]:["click"],overlayInnerStyle:{padding:0},destroyTooltipOnHide:!0,arrow:!1,align:{offset:[0,0]},overlayClassName:`pisell-price-keyboard-popover ${u}`,onOpenChange:e=>{c||(g(e),e?(v(i),y(!0)):null==r||r())},overlayStyle:p,children:l})});e10.displayName="PisellPriceKeyboardPopover";let e12=e=>{let{style:t}=e;return(0,eH.jsx)("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,children:(0,eH.jsx)("path",{d:"M21 15L18 12L15 15M15 21L18 24L21 21",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},e11=(0,eC.memo)(function(e){var t;let{amountSymbol:l="$",orderInfo:i,open_deposit:a=!1,customAmount:n,balanceDueAmount:r,clientInfo:o,onAmountChange:s,onDepositStatusChange:d,onDepositAmountChange:c,onBalanceDueAmountClick:u,onConfirm:p,confirmLoading:m=!1,paymentItems:g,cartData:h,walletPassData:v,totalAmount:f=0,baseSales:y,shouldUseNormalPayment:b=!1,enablePriceAdjust:x=!0,showPaymentType:k=!0}=e,_=e$(),{action:w,token:S,store:j,getApp:N}=null==(t=_.appHelper)?void 0:t.utils,C=qR(),M=(e,t)=>{var l,i,a,n,r,o,s,d;let c=null==(d=W9[(null==(r=_.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=_.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:d[e];return c||eL.getText(e)||t},[T,I]=(0,eC.useState)("regular"),[P,A]=(0,eC.useState)(!1),[D,E]=(0,eC.useState)(!1),[O,z]=(0,eC.useState)([]),[L,R]=(0,eC.useState)("0"),[$,F]=(0,eC.useState)(!1),q={deposit:M("pisell2.subtotal.deposit")||"Deposit",total:M("pisell2.subtotal.total")||"Total",sub_total:M("pisell2.subtotal.subtotal")||"Subtotal",tax:M("pisell2.subtotal.tax")||"Tax",delivery_fee:M("pisell2.subtotal.delivery-fee")||"Delivery Fee",discount:M("pisell2.subtotal.discount")||"Discount",point_deduction:M("pisell2.subtotal.point-deduction")||"Point Deduction",member_deduction:M("pisell2.subtotal.member-deduction")||"Member Deduction",expect_amount:M("pisell2.subtotal.expect-amount")||"Expected Amount"},B=()=>"deposit"===T?(""===r?void 0:r)??(null==i?void 0:i.remainingAmount)??(null==i?void 0:i.depositAmount)??"0":(null==i?void 0:i.remainingAmount)??(null==i?void 0:i.totalAmount)??"0",H=e=>{if("number"==typeof e)return e;if("string"==typeof e){let t=e.replace(/[^-0-9.]/g,"");try{return new lz(t||"0").toNumber()}catch{}}return 0},[V,U]=(0,eC.useState)(n&&""!==n?n:H(B())),Y=(0,eC.useMemo)(()=>(null==g?void 0:g.reduce((e,t)=>{if(!ePS(t))return e;try{let l=new lz(t.amount||"0"),i=new lz(t.rounding_amount||"0");return e.plus(l).plus(i)}catch{return e}},new lz(0)))||new lz(0),[g]),W=(0,eC.useCallback)(e=>{try{return lz.max(new lz(e||0).minus(Y),0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}},[Y]),K=(0,eC.useMemo)(()=>W(r||B()),[W,r,i,T]),G=(0,eC.useMemo)(()=>W(V||0),[W,V]);(0,eC.useEffect)(()=>{n&&""!==n?U(n):r&&""!==r&&U(r)},[n,r]),(0,eC.useEffect)(()=>{if(y&&i)try{var e,t,l;let a=(null==(t=y.getOrderAmountSnapshot)||null==(e=t.call(y))?void 0:e.summary)||{},n=null==(l=_.appHelper.utils)?void 0:l.translationOriginal,r=Array.isArray(null==a?void 0:a.surcharges)?a.surcharges.filter(e=>null==e?void 0:e.name).map((e,t)=>({key:`custom_surcharge_${e.surcharge_id??t}`,value:e.amount||0,label:(null==n?void 0:n(e.name))||("string"==typeof e.name?e.name:M("service.charge","Service Charge"))})):[],o=[{key:"sub_total",value:a.product_amount||a.product_expect_amount||0},...r,{key:"tax",value:a.tax_fee||0},{key:"discount",value:a.discount_amount||0},{key:"expect_amount",value:a.expect_amount||a.total_amount||0}];Array.isArray(o)&&z(o),b?(I("regular"),A(!1)):P||(I(i.isDeposit?"deposit":"regular"),A(!1))}catch(e){console.warn("Failed to get cart summary:",e)}},[y,i,b,P]),(0,eC.useEffect)(()=>{O.length>0&&(!n||""===n)&&U(H(B()))},[O,n]),(0,eC.useEffect)(()=>{var e;R((null==g||null==(e=g.reduce((e,t)=>{if(!eP_(t))return e;let l=new lz(t.origin_amount??t.amount??"0");if(t.rounding_amount){let e=new lz(t.rounding_amount);e.isNegative()&&(l=l.plus(e.abs()),e.abs().toNumber())}return e.plus(l)},new lz(0)))?void 0:e.toNumber())||0)},[g]);let Q=[{key:"regular",label:(0,eH.jsxs)("div",{className:aT()("amount-summary-dropdown-option"),children:[(0,eH.jsx)(cG,{className:aT()("dropdown-icon")}),M("regular.payment")||"普通支付"]})},{key:"deposit",label:(0,eH.jsxs)("div",{className:aT()("amount-summary-dropdown-option"),children:[(0,eH.jsx)(C3,{className:aT()("dropdown-icon")}),M("deposit.payment")||"定金支付"]})}],Z=(0,eC.useCallback)(e=>(null==e?void 0:e.parentElement)||document.body,[]),J=async()=>{E(!0)},X=()=>{E(!1)},ee=()=>{let e="deposit"===T?"payment-button-deposit":"payment-button-regular";return aT()(a?"payment-button-with-dropdown":"payment-button-without-dropdown",e)},et=()=>{var e;let t=new lz(L||"0"),l=(null==g||null==(e=g.reduce((e,t)=>{if(ePS(t))try{let l=new lz(t.amount||"0"),i=new lz(t.rounding_amount||"0");return e.plus(l).plus(i)}catch{}return e},new lz(0)))?void 0:e.toNumber())||0,i=t.plus(l).toNumber(),a=(null==g?void 0:g.filter(e=>eP_(e)&&!ePk(e)))||[];return(null==a?void 0:a.length)>0&&i<f||!(i>=f)&&t.toNumber()>0},el=()=>{if(!O||0===O.length)return null;let e=et()?2:3;return(O.length>e?O.slice(0,e):O).map(e=>{let t=e.label||q[e.key]||e.key;return(0,eH.jsxs)("div",{className:aT()("payment-detail-row"),children:[(0,eH.jsx)("span",{className:aT()("payment-detail-label"),children:t}),(0,eH.jsx)("span",{className:aT()("payment-detail-amount"),children:lQ(e.value,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]},e.key)})},ei=()=>{if(!O)return!1;let e=et()?2:3;return O.length>e},ea=(0,eC.useMemo)(()=>{var e,t,l,i;return(null==(e=O.find(e=>"discount"===e.key))?void 0:e.value)??(null==y||null==(i=y.getOrderAmountSnapshot)||null==(l=i.call(y))||null==(t=l.summary)?void 0:t.discount_amount)},[y,O]),en=()=>{let e;if(!n&&!Y.gt(0)&&0>=Number(ea||0)&&f>0)return!1;try{e=new lz(G).toNumber()}catch{return!1}if(e<=0){var t;let e=(null==g?void 0:g.filter(ePS))||[];return e.length>0&&e.every(ePk)||((null==v||null==(t=v.selectedDiscountList)?void 0:t.length)??0)>0||Number(ea||0)>0||0===f}return!1},{run:er}=sc(()=>{p&&p()},{wait:500,leading:!0,trailing:!0}),eo=()=>{m||er()},es=async e=>{var t,l;await (null==y||null==(l=y.deleteOrderPayment)?void 0:l.call(y,(null==e?void 0:e.payment_number)||(null==e?void 0:e.order_payment_id)||(null==e||null==(t=e.metadata)?void 0:t.unique_payment_number)||(null==e?void 0:e.uuid)))},ed=(0,eC.useMemo)(()=>{let e=new lz(0),t=null==g?void 0:g.reduce((e,t)=>ePS(t)?e.plus(t.amount):e,new lz(0)).toNumber(),i=lQ((e=new lz(Math.abs(e.plus(new lz(0)).plus(t).toNumber()))).toNumber(),l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0});return(0,eH.jsx)("div",{className:aT()("confirm-payment-container"),children:(0,eH.jsxs)("div",{className:aT()("confirm-payment-content"),children:[(0,eH.jsxs)("div",{className:aT()("confirm-payment-text"),children:[M("will.be.paid.in.full")||"Will be paid in full"," ",(0,eH.jsx)("span",{className:aT()("amount-text"),children:i})," ",M("by.wallet")||"by Wallet"]}),(0,eH.jsx)(eT.Button,{className:aT()("confirm-button"),onClick:eo,type:"primary",loading:m,disabled:m,children:M("confirm")||"Confirm"})]})})},[JSON.stringify(g),T,l,r,n,f,y,m]),ec=(0,eC.useMemo)(()=>0!==Number(null==i?void 0:i.totalAmount)&&!(null==g?void 0:g.some(e=>!ePw(e)&&!!eP_(e)&&(null==e?void 0:e.order_payment_type)!=="deposit"&&(null==e?void 0:e.type)!=="deposit")),[g,null==i?void 0:i.totalAmount]);(0,eC.useMemo)(()=>r!==n&&Number(r)>0&&Number(n)>0,[n,r]);let eu=o3(async e=>{let t=String(e);await (null==c?void 0:c(t))}),ep=(0,eC.useMemo)(()=>null==g?void 0:g.some(e=>"deposit"===e.order_payment_type&&eP_(e)),[g]),em=()=>{null==C||C.fail(eL.getText("pisell2.checkout.can-not-change-deposit-amount"))},eg=(0,eC.useMemo)(()=>(0,eH.jsxs)("div",{onClick:x?em:void 0,children:[(0,eH.jsx)("div",{className:aT()("balance-due-label"),children:M("deposit.due")||"Deposit Due"}),(0,eH.jsxs)("div",{className:aT()("balance-due-amount"),children:[lQ(K,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),x&&(0,eH.jsx)(dG,{className:aT()("edit-icon"),style:{color:"#7F56DA"}})]})]}),[r,l,x]),eh=(0,eC.useMemo)(()=>(0,eH.jsx)(e10,{value:K||"0",onConfirm:eu,showCurrencySymbol:!0,useThousandsSeparator:!0,selectType:"dark",overlayClassName:"cash-payment-keyboard-popover pisell-modal-mask-pointer-events-auto",children:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("div",{className:aT()("balance-due-label"),children:M("deposit.due")||"Deposit Due"}),(0,eH.jsxs)("div",{className:aT()("balance-due-amount"),children:[lQ(K,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),(0,eH.jsx)(dG,{className:aT()("edit-icon"),style:{color:"#7F56DA"}})]})]})}),[r,l]);return(0,eH.jsxs)("div",{className:aT()("amount-summary-module","amount-summary-container"),children:[k&&(0,eH.jsxs)("div",{className:aT()("left-section"),children:[a&&ec?(0,eH.jsx)(eT.Dropdown,{menu:{items:Q,onClick:e=>{var t;let{key:l,domEvent:i}=e;i.preventDefault(),i.stopPropagation(),I(t=String(l)),A(!0),d&&d("deposit"===t)},style:{backgroundColor:"#7F56DA",border:"1px solid #C3B2E7",borderRadius:"8px",padding:"8px 16px"}},trigger:["click"],placement:"bottomLeft",overlayClassName:"amount-summary-dropdown",getPopupContainer:Z,children:(0,eH.jsx)(eT.Button,{className:ee(),children:(0,eH.jsxs)("div",{className:aT()("button-content"),children:[(0,eH.jsx)("span",{className:aT()("button-text"),children:"deposit"===T?M("deposit.payment.short")||"定金\n支付":M("regular.payment.short")||"普通\n支付"}),(0,eH.jsx)(e12,{style:{width:"36px",height:"36px"}})]})})}):(0,eH.jsxs)(eT.Button,{className:ee(),children:[(0,eH.jsx)("div",{children:"deposit"===T?M("deposit.text")||"定金":M("regular.text")||"普通"}),(0,eH.jsx)("div",{children:M("payment.text")||"支付"})]}),(0,eH.jsx)(nY.Iconfont,{type:"pisell2-arrow-right",style:{fontSize:"20px"}})]}),(0,eH.jsx)("div",{className:aT()("middle-section"),children:"deposit"===T?(0,eH.jsx)(eH.Fragment,{children:(0,eH.jsxs)("div",{className:aT()("payment-details"),children:[et()&&(0,eH.jsxs)("div",{className:aT()("partial-paid-card"),children:[(0,eH.jsx)("span",{className:aT()("partial-paid-label"),children:"deposit"===T?M("deposit.partial.paid")||"Deposit Paid":M("partial.paid")||"Partial Paid"}),(0,eH.jsx)("span",{className:aT()("partial-paid-amount"),children:lQ(L,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),el(),ei()&&(0,eH.jsxs)("div",{className:aT()("more-section"),onClick:J,style:{cursor:"pointer"},role:"button",children:[(0,eH.jsx)("span",{className:aT()("more-text"),children:M("more")||"更多"}),(0,eH.jsx)(nY.Iconfont,{type:"pisell2-TriangleFill",style:{fontSize:"12px"}})]})]})}):(0,eH.jsxs)("div",{className:aT()("payment-details"),children:[et()&&(0,eH.jsxs)("div",{className:aT()("partial-paid-card"),children:[(0,eH.jsx)("span",{className:aT()("partial-paid-label"),children:M("partial.paid")||"Partial Paid"}),(0,eH.jsx)("span",{className:aT()("partial-paid-amount"),children:lQ(L,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),el(),ei()&&(0,eH.jsxs)("div",{className:aT()("more-section"),onClick:J,style:{cursor:"pointer"},role:"button",children:[(0,eH.jsx)("span",{className:aT()("more-text"),children:M("more")||"更多"}),(0,eH.jsx)(nY.Iconfont,{type:"pisell2-TriangleFill",style:{fontSize:"24px",color:"#C3B2E7"}})]})]})}),(0,eH.jsxs)("div",{className:aT()("balance-due-card",{"confirm-mode":en()}),children:[en()?ed:(0,eH.jsx)("div",{className:aT()("balance-due-info"),children:"deposit"===T?ep||!x?eg:eh:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("div",{className:aT()("balance-due-label"),children:M("balance.due")||"Balance Due"}),(0,eH.jsxs)("div",{className:aT()("balance-due-amount"),onClick:x?()=>null==u?void 0:u("manual-discount"):void 0,children:[lQ(K,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),x&&(0,eH.jsx)(dG,{className:aT()("edit-icon"),style:{color:"#7F56DA"}})]})]})}),Number(G)>0&&(0,eH.jsxs)("div",{className:aT()("pay-section"),style:{cursor:"pointer"},role:"button",children:[(0,eH.jsx)("span",{className:aT()("pay-text"),children:M("pay")||"支付"}),(0,eH.jsx)("span",{className:aT()("pay-amount"),children:lQ((()=>{try{return new lz(G||"0").toNumber()}catch{return 0}})(),l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})]}),(0,eH.jsx)(nY.PisellModal,{open:D,onCancel:X,footer:null,closable:!0,mask:!0,maskClosable:!0,centered:!0,width:600,wrapClassName:"payment-detail-modal-wrapper",title:M("order.and.payment.summary")||"Order and Payment Summary",children:D&&(0,eH.jsx)(e1X,{amountSymbol:l,orderInfo:i,cartData:h,onClose:X,summaryData:O,labelMaps:q,paymentItems:g,customAmount:n,voidPayment:es,walletPassData:v,clientInfo:o})})]})}),e14=(0,eC.forwardRef)((e,t)=>{let{amountSymbol:l="$",walletPassData:i,onSavePayLater:a}=e,[n,r]=(0,eC.useState)(!1),[o,s]=(0,eC.useState)(""),d=e$(),c=(e,t)=>{var l,i,a,n,r,o,s,c;let u=null==(c=W9[(null==(r=d.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=d.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:c[e];return u||eL.getText(e)||t},u=()=>{(null==i?void 0:i.selectedWallet)&&i.selectedWallet.length>0?(s(lG((null==i?void 0:i.selectedWallet)&&Array.isArray(i.selectedWallet)?i.selectedWallet.reduce((e,t)=>{let l=new lz(parseFloat(t.redeem)||0);return e.plus(l)},new lz(0)).toNumber():0,2,l)),r(!0)):a()},p=e=>{r(!1),a(e)};return(0,eC.useImperativeHandle)(t,()=>({handleSavePayLaterClick:u})),(0,eH.jsx)(eH.Fragment,{children:(0,eH.jsx)(nY.PisellModal,{visible:n,onCancel:()=>p("cancel"),closable:!1,mask:!0,maskClosable:!1,centered:!0,width:530,title:c("pisell2.checkout.wallet-balance-confirm.title"),footer:null,className:"wallet-balance-confirm-modal",styles:{header:{textAlign:"center",borderBottom:"1px solid #EAECF0",paddingBottom:"16px"}},children:(0,eH.jsxs)("div",{style:{padding:"40px 0 0 0"},children:[(0,eH.jsxs)("div",{style:{textAlign:"center",marginBottom:"32px",lineHeight:"1.5"},children:[(0,eH.jsx)("span",{style:{color:"#533795",fontWeight:600,fontSize:"18px"},children:o}),(0,eH.jsx)("span",{style:{color:"#101828",fontSize:"16px"},children:c("pisell2.checkout.wallet-balance-confirm.description-before")}),(0,eH.jsx)("span",{style:{color:"#533795",fontWeight:600,fontSize:"16px"},children:c("pisell2.checkout.wallet-balance-confirm.description-after")})]}),(0,eH.jsxs)("div",{style:{display:"flex",gap:"12px",flexDirection:"row"},children:[(0,eH.jsx)(eT.Button,{onClick:()=>p("cancel"),style:{flex:"0 1 auto",minWidth:"fit-content",height:"48px",borderRadius:"12px",fontSize:"16px",fontWeight:500,border:"1px solid #D0D5DD",color:"#344054",padding:"0 16px",whiteSpace:"nowrap"},children:c("pisell2.checkout.wallet-balance-confirm.cancel")}),(0,eH.jsx)(eT.Button,{onClick:()=>p("save-without-deduct"),style:{flex:"1 1 auto",height:"48px",borderRadius:"12px",fontSize:"16px",fontWeight:500,border:"1px solid #D0D5DD",color:"#344054",padding:"0 16px",whiteSpace:"nowrap"},children:c("pisell2.checkout.wallet-balance-confirm.save-without-deduct")}),(0,eH.jsx)(eT.Button,{type:"primary",style:{flex:"1.2 1 auto",height:"48px",backgroundColor:"#533795",borderColor:"#533795",borderRadius:"12px",fontWeight:600,fontSize:"16px",border:"none",boxShadow:"0px 1px 2px rgba(16, 24, 40, 0.05)",padding:"0 16px",whiteSpace:"nowrap"},onClick:()=>p("apply-deduct-now"),children:c("pisell2.checkout.wallet-balance-confirm.apply-deduct-now")})]})]})})})});function e13(e){var t;return(null==e||null==(t=e.discount)?void 0:t.resource_id)||(null==e?void 0:e.id)}function e18(e){return!!(null==e?void 0:e.order_detail_id)}function e16(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new Set;return e.forEach(e=>{e18(e)&&(e.discount_list||[]).forEach(e=>{let l=e13(e);l&&["good_pass","discount_card"].includes(e.type)&&t.add(String(l))})}),t}function e15(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2?arguments[2]:void 0,i=e16(t),a=l||i;return e.map(e=>{let t=(null==e?void 0:e.id)||e13(e);return t&&a.has(String(t))?{...e,isEditMode:!0,isSelected:!0}:(null==e?void 0:e.isEditMode)?{...e,isEditMode:!1,isSelected:!1}:e}).map(e=>{let t;return"product_discount_card"!==(t=(null==e?void 0:e.tag)||(null==e?void 0:e.type))&&"discount_card"!==t&&"good_pass"!==t||void 0!==e.isAvailable?e:{...e,isAvailable:!0,isSelected:e.isSelected??!1}})}function e17(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e15((null==e||null==(t=e.getDiscountList)?void 0:t.call(e))||[],l,i)}function e19(e){return!!(null==e?void 0:e.expire_date)&&eS()(e.expire_date).endOf("day").isBefore(eS()())}function e4e(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=[];t.forEach(e=>{let t=e18(e);(e.discount_list||[]).forEach(i=>{var a,n,r,o,s;let d=e13(i);if(!d||!["good_pass","discount_card"].includes(i.type))return;let c=e.quantity||e.num||e.product_quantity||1,u=Number(i.amount||0)*Number(c||1)+Number((null==i||null==(a=i.metadata)?void 0:a.product_discount_difference)||0),p=l.findIndex(e=>e.id===d);if(-1!==p){l[p]={...l[p],amount:Number(l[p].amount||0)+Number(i.amount||0),savedAmount:Number(l[p].savedAmount||0)+u};return}l.push({...i,id:d,tag:i.tag||i.type,name:i.name||(null==(r=i.discount)||null==(n=r.title)?void 0:n.auto),format_title:(null==(o=i.discount)?void 0:o.title)||i.format_title,isEditMode:t,isAvailable:!0,isDisabled:!0,isSelected:!0,limited_relation_product_data:{},savedAmount:u,product_id:(null==(s=i.discount)?void 0:s.product_id)||i.product_id})})});let i=new Set(l.map(e=>e.id));return[...l,...e.filter(e=>!i.has(e.id))]}e14.displayName="SavePayLaterHandler";let e4t=e=>{var t,l,i;let{customerName:a,selectedCount:n,expiredCount:r,isCardMode:o,onExpiredClick:s,onBestSaving:d,onClearAll:c,onToggleDisplayMode:u}=e;return(0,eH.jsxs)("div",{className:"wallet-pass-header",children:[(0,eH.jsxs)("div",{className:"wallet-pass-header-left",children:[(0,eH.jsx)("span",{className:"wallet-pass-module-customer-container",dangerouslySetInnerHTML:{__html:(null==(t=eL.getText("wallet-pass-module-cards-vouchers-in-wallet"))?void 0:t(`<span class="theme-color wallet-pass-module-customer">${a}</span>`))||""}}),(0,eH.jsx)("span",{style:{color:"#475467"},children:null==(l=eL.getText("wallet-pass-module-applied"))?void 0:l(n)}),(0,eH.jsx)("span",{className:aT()("error-color","pointer","underline"),onClick:s,children:null==(i=eL.getText("wallet-pass-module-expired"))?void 0:i(r)})]}),(0,eH.jsxs)("div",{className:"wallet-pass-header-right",children:[(0,eH.jsx)("span",{className:aT()("theme-color","pointer","underline"),onClick:d,children:eL.getText("wallet-pass-module-best-saving")}),(0,eH.jsx)("span",{className:aT()("error-color","pointer","underline"),onClick:c,children:eL.getText("wallet-pass-module-clear-all")}),(0,eH.jsx)("div",{onClick:u,className:"wallet-pass-header-right-icon-container",children:(0,eH.jsx)(nY.Icon,{type:"pisell2-chevron-up",className:aT()("wallet-pass-header-right-icon","theme-color","pointer",{rotated:!o})})})]})]})},e4l=nY.PisellText.Amount,e4i=e=>{let{cardData:t,selectedWalletIds:l}=e;return(0,eH.jsx)("div",{className:"wallet-pass-text-mode",children:t&&t.length>0?t.filter(e=>l.includes(e.id)).map(e=>(0,eH.jsxs)("div",{className:"wallet-pass-text-item selected",children:[(0,eH.jsx)("span",{className:"wallet-pass-text-name",children:e.name}),(0,eH.jsxs)("span",{className:"wallet-pass-text-amount",children:["-",(0,eH.jsx)(e4l,{value:e.redeem,showCurrencySymbol:!0})]})]},e.id)):(0,eH.jsx)("div",{className:"wallet-pass-text-empty"})})},e4a=nY.PisellText.Amount,e4n=e=>{let{isCardMode:t,cardData:l,selectedWalletIds:i,onSelectWallet:a,onDetail:n,onConfirmEditAmount:r,onBeforeEditAmount:o}=e;return(0,eH.jsx)("div",{className:"wallet-pass-card-display-container",children:t?(0,eH.jsx)(nY.PisellCardList,{showActiveBackground:!0,showName:!0,showStoreName:!1,showRedeem:!0,showBalance:!0,showCode:!0,showValidDate:!0,showDetail:!0,showQrCode:!0,showCover:!0,showActions:!1,platform:"pc",mode:"multiple",direction:"horizontal",formatBalance:(e,t)=>{var l,i,a,n,r,o,s,d;if((null==t||null==(l=t.data)?void 0:l.originData.tag)==="point_card"){let l=(null==t?void 0:t.active)?(e||0)-((null==t||null==(a=t.data)||null==(i=a.originData)?void 0:i.recommended_usage_par_value)||0):e,o=(s=l||0,(d=null==t||null==(r=t.data)||null==(n=r.originData)?void 0:n.wallet_pass_usage_unit).points&&d.price?new lz(s).div(d.points).mul(d.price).toFixed(2,lz.ROUND_DOWN):new lz(s).toFixed(2));return(0,eH.jsxs)("div",{children:[(0,eH.jsx)(e4a,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:l,showCurrencySymbol:!1}),"(",(0,eH.jsx)(e4a,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:o,showCurrencySymbol:!1}),")"]})}return(null==t?void 0:t.active)?(0,eH.jsx)("div",{children:(0,eH.jsx)(e4a,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:e?e-((null==t||null==(o=t.data)?void 0:o.redeem)||0):0,showCurrencySymbol:!0})}):(0,eH.jsx)("div",{children:(0,eH.jsx)(e4a,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:e,showCurrencySymbol:!0})})},formatBalanceTitle:(e,t)=>(null==t?void 0:t.active)?(0,eH.jsx)("span",{children:eL.getText("wallet-pass-module-balance-after")}):(0,eH.jsx)("span",{children:eL.getText("wallet-pass-module-balance")}),formatRedeemTitle:(e,t)=>(null==t?void 0:t.active)?(0,eH.jsx)("span",{children:t.originDom}):(0,eH.jsx)("span",{children:eL.getText("wallet-pass-module-max.use")}),type:"mini",data:l,hasMore:!1,showEmpty:!1,fullWidth:!1,value:i,useExternalDetail:!0,onDetail:n,showStatus:!1,onChange:e=>{a(e)},actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}},enableEditAmount:!0,onConfirmEditAmount:r,onBeforeEditAmount:o}):(0,eH.jsx)(e4i,{cardData:l,selectedWalletIds:i})})},e4r=e=>{let{visible:t,walletData:l,onClose:i,title:a,emptyText:n}=e;return(0,eH.jsx)(nY.PisellModal,{title:(0,eH.jsx)("div",{className:"wallet-modal-title",children:a}),open:t,onCancel:i,width:680,footerDivider:!1,headerDivider:!1,cancelVisible:!1,onOk:i,okText:eL.getText("wallet-pass-module-expired-modal-close"),children:(0,eH.jsx)("div",{className:"wallet-modal-content",children:l&&l.length>0?(0,eH.jsx)(nY.PisellCardList,{showActiveBackground:!0,showName:!0,showStoreName:!1,showRedeem:!0,showBalance:!0,showCode:!0,showValidDate:!0,showDetail:!0,showQrCode:!0,showCover:!0,platform:"pc",mode:"single",direction:"horizontal",type:"mini",data:l,hasMore:!1,showEmpty:!1,fullWidth:!1,showStatus:!1,nameTitleStyle:{fontSize:20,fontWeight:600,color:"#f5a623"},actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}}}):(0,eH.jsx)(nY.PisellEmpty,{title:n||eL.getText("wallet-pass-module-expired-modal-empty")})})})},e4o=nY.PisellText.Amount,e4s=e=>{let{cardData:t,selectedWalletIds:l}=e;return(0,eH.jsx)("div",{className:"discount-text-mode",children:t&&t.length>0?t.filter(e=>l.includes(e.id)).map(e=>(0,eH.jsxs)("div",{className:"discount-text-item selected",children:[(0,eH.jsx)("span",{className:"discount-text-name",children:e.name}),(0,eH.jsxs)("span",{className:"discount-text-amount",children:["-",(0,eH.jsx)(e4o,{value:e.savedAmount,showCurrencySymbol:!0})]})]},e.id)):(0,eH.jsx)("div",{className:"discount-text-empty"})})},e4d=e=>{let{isCardMode:t,cardData:l,selectedWalletIds:i,onSelectWallet:a,onDetail:n,discountDisabled:r}=e,o=qR(),s=(0,eC.useMemo)(()=>r?l.map(e=>({...e,disabled:!0})):l,[r,l]);return(0,eH.jsx)("div",{className:"discount-wallet-list-container",children:t?(0,eH.jsx)(nY.PisellCardList,{className:"",showName:!0,showActiveBackground:!0,showStoreName:e=>{var t;return(null==e||null==(t=e.originData)?void 0:t.tag)!=="good_pass"||e.active},onItemClick:()=>{r&&o.info(eL.getText("wallet-pass-module-discount-partially-paid"))},disabled:r,showRedeem:!1,showBalance:!1,showCode:!1,showValidDate:!1,showDetail:!1,showQrCode:!1,showCover:!1,showActions:!1,platform:"pc",mode:"multiple",direction:"horizontal",type:"mini",data:s,hasMore:!1,showEmpty:!1,fullWidth:!1,value:i,useExternalDetail:!0,onDetail:n,showStatus:!1,nameTitleStyle:{fontSize:20,fontWeight:600,color:"#FF8A1E"},onChange:a,actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}},enableEditAmount:!1}):(0,eH.jsx)(e4s,{cardData:l,selectedWalletIds:i})})},e4c={status:"idle",items:[],selectedIds:[],selectedItems:[],committedIds:[],selectionSources:{},totalSelectedAmount:0,error:null,revision:0};function e4u(e){return(null==e?void 0:e.id)??(null==e?void 0:e.voucher_id)??(null==e?void 0:e.code)}function e4p(e){return["product_discount_card","discount_card","good_pass","entitlement_pass"].includes((null==e?void 0:e.tag)||(null==e?void 0:e.type))}let e4m=(0,eC.forwardRef)((e,t)=>{var l;let{orderInfo:i,onSelectChange:a,paymentItems:n,clientId:r,baseSales:o,onDiscountChange:s}=e,d=function(e){var t,l;let{baseSales:i,clientId:a,onSelectChange:n,onDiscountChange:r}=e,[o,s]=(0,eC.useState)(()=>{var e;return(null==i||null==(e=i.getWalletAssetsState)?void 0:e.call(i))||e4c}),[d,c]=(0,eC.useState)(()=>{var e;return((null==i||null==(e=i.getDiscountList)?void 0:e.call(i))||[]).filter(e4p)}),[u,p]=(0,eC.useState)(!1),m=(0,eC.useRef)(!1),g=(0,eC.useRef)(null),h=(0,eC.useRef)(null),v=(0,eC.useRef)(!1);(0,eC.useEffect)(()=>{var e,t;let l=null==i||null==(e=i.getWalletAssetsState)?void 0:e.call(i);if(l&&s(l),c(((null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(e4p)),!(null==i?void 0:i.effectsOn))return;let a=i.effectsOn("onWalletAssetsStateChanged",e=>{if(null==e?void 0:e.state){if(m.current){g.current=e.state;return}s(e.state)}}),n=i.effectsOn("onDiscountApplied",e=>{var t;c((Array.isArray(null==e?void 0:e.discountList)?e.discountList:(null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(e4p))});return()=>{[a,n].forEach(e=>{var t;"function"==typeof e?e():null==e||null==(t=e.remove)||t.call(e)})}},[i]),(0,eC.useEffect)(()=>{var e;let t;try{t=null==n?void 0:n(((null==o?void 0:o.selectedItems)||[]).flatMap(e=>{let t,l=(null==e?void 0:e.voucher_id)??(null==e?void 0:e.id),i=(t=Number(eDI(e)??(null==e?void 0:e.amount)??0),Number.isFinite(t)&&t>0?t:0);return void 0===l||i<=0?[]:[{voucher_id:l,amount:i,code:null==e?void 0:e.tag,wallet_pass_usage_unit:null==e?void 0:e.wallet_pass_usage_unit,wallet_pass_use_value:null==e?void 0:e.wallet_pass_use_value}]}))}catch(t){throw null==(e=h.current)||e.call(h),h.current=null,v.current=!1,t}let l=h.current;if(l&&!v.current){v.current=!0;let e=()=>{h.current===l&&(h.current=null,v.current=!1),l()};Promise.resolve(t).then(e,e)}},[n,o.revision]),(0,eC.useEffect)(()=>()=>{var e;null==(e=h.current)||e.call(h),h.current=null,v.current=!1},[]);let f=(0,eC.useMemo)(()=>[...o.selectedIds||[],...o.committedIds||[]],[o.committedIds,o.selectedIds]),y=(0,eC.useMemo)(()=>new Set((o.committedIds||[]).map(e=>String(e))),[o.committedIds]),b=(0,eC.useMemo)(()=>new Map((o.selectedItems||[]).map(e=>[String(e4u(e)??(null==e?void 0:e.code)??""),e])),[o.selectedItems]),x=(0,eC.useMemo)(()=>eDE((o.items||[]).map(e=>{let t={...e,...b.get(String(e4u(e)??(null==e?void 0:e.code)??""))||{}};return{...t,...(null==t?void 0:t.unified_available_status)!==void 0?{unified_available_status:Number(t.unified_available_status)}:{},...(null==t?void 0:t._unified_available_status)!==void 0?{_unified_available_status:Number(t._unified_available_status)}:{},...(null==t?void 0:t.available)===!1||(null==t?void 0:t.isDisabled)===!0?{unified_available_status:0,unified_messages:(null==t?void 0:t.unified_messages)||{title:(null==t?void 0:t.reason)||(null==t?void 0:t.disabledReason)}}:{}}}),f).map(e=>({...e,enableEditAmount:!y.has(String(e.id)),...y.has(String(e.id))?{disabled:!0,active:!0}:{}})),[y,b,f,o.items]),k=(0,eC.useMemo)(()=>x.filter(e=>{var t;let l=null==e||null==(t=e.originData)?void 0:t.expire_date;return!!l&&eS()(l).endOf("day").isBefore(eS()())}),[x]),_=(0,eC.useMemo)(()=>k.map(e=>e.id),[k]),w=(0,eC.useMemo)(()=>d.filter(e=>null==e?void 0:e.isSelected).map(e=>null==e?void 0:e.id),[d]),S=(0,eC.useMemo)(()=>eDO(d.filter(e=>(null==e?void 0:e.isAvailable)!==!1||(null==e?void 0:e.isSelected)),w),[d,w]),j=o3(e=>{var t,l,a;c(((null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(e4p)),null==r||r({...e,discountList:(null==i||null==(l=i.getDiscountList)?void 0:l.call(i))||[],productList:(null==i||null==(a=i.getOrderProducts)?void 0:a.call(i))||[]})}),N=o3(async e=>{if(!(null==i?void 0:i.selectWalletAsset)||u)return;let t=new Set((o.committedIds||[]).map(e=>String(e))),l=new Set((o.selectedIds||[]).map(e=>String(e))),a=new Set(e.map(e=>String(e)));p(!0);try{for(let e of o.items||[]){let n=e4u(e);if(void 0===n||t.has(String(n)))continue;let r=l.has(String(n)),o=a.has(String(n));r!==o&&await i.selectWalletAsset({assetId:n,selected:o,source:"manual"})}}finally{p(!1)}}),C=o3(async()=>{if(!u){p(!0);try{var e,t;for(let l of(await (null==i||null==(e=i.clearWalletAssetSelection)?void 0:e.call(i)),w))await (null==i||null==(t=i.setDiscountSelected)?void 0:t.call(i,{discountId:l,isSelected:!1}));j()}finally{p(!1)}}}),M=o3(async(e,t)=>{var l,a,n,r;if(!(null==i?void 0:i.scanWalletAsset))return null;p(!0),m.current=!0,g.current=null;let d=!1,c=o.revision;try{let t=await i.scanWalletAsset(e);d=!0;let n=null==t?void 0:t.asset;if((null==t?void 0:t.type)==="walletCode"){let e=(null==t?void 0:t.data)||n;if(!e)return t;if((null==e?void 0:e.is_cross_shop_wallet)!==!0&&1!==Number(null==e?void 0:e.is_cross_shop_wallet))return{...t,data:e,asset:e};let l=Number(null==e?void 0:e.customer_id);if(!Number.isInteger(l)||l<=1||"function"!=typeof(null==i?void 0:i.resolveCustomerById))throw Error("Customer resolve is unavailable");let a=await i.resolveCustomerById(l);if(!a)throw Error("Customer resolve failed");let r={...e,customer:a};return{...t,data:r,asset:r}}let r=Number((null==n?void 0:n.customer_id)??(null==n||null==(l=n.holder)?void 0:l.customer_id)),o=null==i||null==(a=i.getOrderCustomerSnapshot)?void 0:a.call(i),s=Number((null==o?void 0:o.id)??(null==o?void 0:o.customer_id)??1),c=!Number.isInteger(s)||s<=1,u=Number.isInteger(r)&&r>1;if(c&&u){if("function"!=typeof(null==i?void 0:i.resolveCustomerById)||"function"!=typeof(null==i?void 0:i.setOrderCustomer)||"function"!=typeof(null==i?void 0:i.refreshWalletAssets))throw Error("Customer resolve is unavailable");let l=await i.resolveCustomerById(r);if(!l)throw Error("Customer resolve failed");i.setOrderCustomer(l);let a=await i.refreshWalletAssets({preserveSelection:!1,retainSearchResultCodes:[e]});return{...t,state:a||(null==t?void 0:t.state)}}return t}finally{let e;m.current=!1;let l=(null==i||null==(n=i.getWalletAssetsState)?void 0:n.call(i))||g.current;g.current=null;try{l&&((null==t?void 0:t.waitForApply)&&d&&!Object.is(l.revision,c)&&(null==(r=h.current)||r.call(h),v.current=!1,e=new Promise(e=>{h.current=e})),s(l)),await e}finally{p(!1)}}}),T=o3(async e=>{if(u)return;let t=new Set(w.map(e=>String(e))),l=new Set(e.map(e=>String(e)));p(!0);try{for(let e of d){let n=null==e?void 0:e.id;if(void 0===n)continue;let r=t.has(String(n)),o=l.has(String(n));if(r!==o){var a;await (null==i||null==(a=i.setDiscountSelected)?void 0:a.call(i,{discountId:n,isSelected:o}))}}j()}finally{p(!1)}}),I=o3(async()=>{if(!u){p(!0);try{var e,t,l;let a=(o.items||[]).filter(e=>null==e?void 0:e._wallet_asset_recommended).map(e=>e4u(e)).filter(e=>void 0!==e);for(let l of(await (null==i||null==(e=i.clearWalletAssetSelection)?void 0:e.call(i)),a))await (null==i||null==(t=i.selectWalletAsset)?void 0:t.call(i,{assetId:l,selected:!0,source:"manual"}));if(S.length){let e=await (null==i||null==(l=i.bestDiscount)?void 0:l.call(i));j(e)}}finally{p(!1)}}}),P=o3(async(e,t,l)=>{if(!(null==i?void 0:i.updateWalletAssetAmount)||u)return;let a=e4u((null==l?void 0:l.originData)||l),n=Number(e);if(void 0!==a&&Number.isFinite(n)&&!(n<0)){p(!0);try{await i.updateWalletAssetAmount({assetId:a,amount:n})}finally{p(!1)}}});return{cardData:x,selectedWalletIds:f,expiredWalletIds:_,expiredWalletData:k,disabledWalletData:[],clearDisabledWalletData:()=>void 0,clearAllSelectedWallet:C,handleBestSaving:I,handleSearchIdentificationCode:M,handleSelectWallet:N,availableDiscountList:S,selectedDiscountList:w,handleSelectDiscount:T,customerName:(null==i||null==(l=i.getCustomer)||null==(t=l.call(i))?void 0:t.name)||(a?String(a):""),handleConfirmEditAmount:P,handleBeforeEditAmount:async()=>!0,loading:"loading"===o.status||u}}({baseSales:o,clientId:r,onSelectChange:a,onDiscountChange:s}),[c,u]=(0,eC.useState)(!0),[p,m]=(0,eC.useState)(!1);(0,eC.useImperativeHandle)(t,()=>({handleSearchIdentificationCode:d.handleSearchIdentificationCode,getWalletPassData:e=>({selectedWallet:e.length?d.cardData.filter(e=>d.selectedWalletIds.some(t=>String(t)===String(e.id))):[],availableDiscountList:d.availableDiscountList,selectedDiscountList:d.selectedDiscountList})}));let g=o3(()=>{u(e=>!e)}),h=(0,eC.useMemo)(()=>0===Number(null==i?void 0:i.totalAmount)||!!(null==n?void 0:n.some(e=>!ePw(e)&&!!eP_(e)&&!ePc.includes(e.code))),[null==i?void 0:i.totalAmount,n]),v=d.selectedWalletIds.length+d.selectedDiscountList.length;return 0===d.cardData.length&&0===d.availableDiscountList.length?null:(0,eH.jsx)("div",{className:"wallet-pass-module-container",children:(0,eH.jsx)(nY.PisellLoading,{delay:300,loading:d.loading,fullscreen:!1,mask:{backgroundColor:"rgba(255, 255, 255, 0.5)",width:"100%",height:"100%"},children:(0,eH.jsxs)("div",{className:"wallet-pass-module",children:[(0,eH.jsx)(e4t,{customerName:d.customerName,selectedCount:v,expiredCount:d.expiredWalletIds.length,isCardMode:c,onExpiredClick:()=>m(!0),onBestSaving:d.handleBestSaving,onClearAll:d.clearAllSelectedWallet,onToggleDisplayMode:g}),(0,eH.jsx)(e4n,{isCardMode:c,cardData:d.cardData,selectedWalletIds:d.selectedWalletIds,onSelectWallet:d.handleSelectWallet,onDetail:()=>void 0,onConfirmEditAmount:d.handleConfirmEditAmount,onBeforeEditAmount:d.handleBeforeEditAmount}),(0,eH.jsx)(e4d,{isCardMode:c,cardData:d.availableDiscountList,selectedWalletIds:d.selectedDiscountList,onSelectWallet:d.handleSelectDiscount,onDetail:()=>void 0,discountDisabled:h}),(0,eH.jsx)(e4r,{visible:p,walletData:d.expiredWalletData,onClose:()=>m(!1),title:null==(l=eL.getText("wallet-pass-module-expired-modal-title"))?void 0:l(d.expiredWalletData.length)})]})})})}),e4g=(0,eC.forwardRef)((e,t)=>{var l;let{orderInfo:i,onSelectChange:a,customAmount:n,paymentItems:r,clientId:o,baseSales:s,onDiscountChange:d}=e,{handleSelectWallet:c,cardData:u,selectedWalletIds:p,expiredWalletIds:m,expiredWalletData:g,disabledWalletData:h,clearAllSelectedWallet:v,clearDisabledWalletData:f,handleBestSaving:y,loading:b,handleSearchIdentificationCode:x,availableDiscountList:k,selectedDiscountList:_,handleSelectDiscount:w,customerName:S,handleConfirmEditAmount:j,handleBeforeEditAmount:N}=(e=>{let{onSelectChange:t,customAmount:l,clientId:i,totalAmount:a}=e,n=eWG(),[r,o]=(0,eC.useState)([]),[s,d]=(0,eC.useState)([]),[c,u]=(0,eC.useState)([]),[p,m]=(0,eC.useState)([]),g=(0,eC.useRef)([]),h=(0,eC.useRef)([]),v=(0,eC.useRef)([]),f=(0,eC.useRef)(""),y=(0,eC.useRef)(null),b=(0,eC.useRef)(""),x=(0,eC.useRef)(null),k=(0,eC.useRef)(new Set),_=(0,eC.useRef)(""),w=(0,eC.useRef)(""),S=(0,eC.useRef)(null),j=(0,eC.useRef)(!1),[N,C]=(0,eC.useState)([]),[M,T]=(0,eC.useState)({}),[I,P]=(0,eC.useState)([]),A=(0,eC.useRef)([]),[D,E]=(0,eC.useState)([]),[O,z]=(0,eC.useState)([]),L=(0,eC.useRef)(!1),R=(0,eC.useRef)(!1),$=(0,eC.useRef)(!1),[F,q]=(0,eC.useState)([]),B=(0,eC.useMemo)(()=>I.map(e=>e.id),[I]),H=(0,nY.useToast)(),[V,U]=(0,eC.useState)(!1),[Y,W]=(0,eC.useState)(null),[K,G]=(0,eC.useState)([]),Q=e.baseSales,Z=null==Q?void 0:Q.payment,J=null==Z?void 0:Z.wallet,X=o3(()=>i),ee=o3(()=>{var e,t,i;let n=(null==Q||null==(e=Q.getOrderAmountSnapshot)?void 0:e.call(Q))||(null==Q||null==(i=Q.getOrderSnapshot)||null==(t=i.call(Q))?void 0:t.amount)||{},r=n.amountGap??n.depositAmount??n.totalAmount??n.expectAmount;return Number(l??r??a??0)}),et=o3(()=>{var e,t,l,i,a,n;if(F.length>0)return F;let r=(null==Q||null==(e=Q.getOrderProducts)?void 0:e.call(Q))||[];return r.length>0?r:(null==Q||null==(l=Q.getTempOrder)||null==(t=l.call(Q))?void 0:t.products)||(null==Q||null==(n=Q.getOrderSnapshot)||null==(a=n.call(Q))||null==(i=a.tempOrder)?void 0:i.products)||[]}),el=o3(()=>{var e,t,l,i,a,n,r,o,s;if(!Q)return;let d=(null==Q||null==(e=Q.getTempOrder)?void 0:e.call(Q))||(null==Q||null==(l=Q.getOrderSnapshot)||null==(t=l.call(Q))?void 0:t.tempOrder),c=(null==Q||null==(i=Q.getOrderProducts)?void 0:i.call(Q))||(null==d?void 0:d.products)||[],u=e16(c),p=String((null==d?void 0:d.order_id)||(null==(n=Q.getOrderIdentity)||null==(a=n.call(Q))?void 0:a.orderId)||""),m=null==Q||null==(r=Q.store)?void 0:r.order,g=(null==Q||null==(o=Q.getDiscountList)?void 0:o.call(Q))||(null==m||null==(s=m.getDiscountList)?void 0:s.call(m))||[];_.current!==p&&(_.current=p,k.current=u);let v=em(e15(g,c,k.current));h.current=v,G(v)}),ei=o3(async()=>{var e,t,l,i,a,n,r,o;let s=(null==Q||null==(e=Q.getTempOrder)?void 0:e.call(Q))||(null==Q||null==(l=Q.getOrderSnapshot)||null==(t=l.call(Q))?void 0:t.tempOrder),d=(null==Q||null==(i=Q.getOrderProducts)?void 0:i.call(Q))||(null==s?void 0:s.products)||[],c=Number(X()||0);if(!Q)return;let u=e16(d),p=String((null==s?void 0:s.order_id)||(null==(n=Q.getOrderIdentity)||null==(a=n.call(Q))?void 0:a.orderId)||"");_.current!==p&&(_.current=p,k.current=u);let m=JSON.stringify({orderId:(null==s?void 0:s.order_id)||(null==(o=Q.getOrderIdentity)||null==(r=o.call(Q))?void 0:r.orderId),customerId:c,productDiscounts:d.map(e=>({productId:e.product_id||e.id,discounts:(e.discount_list||[]).map(e=>({id:e13(e),amount:e.amount,type:e.type}))}))});if(f.current===m&&K.length>0)return;if(y.current&&f.current===m)return y.current;f.current=m;let g=async()=>{var e,t,l,i,a,n,r,o,u,p;if("function"==typeof(null==Q?void 0:Q.loadDiscountConfig)){let e=await Q.loadDiscountConfig({customerId:c,action:(null==s?void 0:s.order_id)?"edit":"create"});return{...e,discountList:e15((null==e?void 0:e.discountList)||[],d,k.current)}}let m=null==Q||null==(e=Q.store)?void 0:e.order;if(!(null==m?void 0:m.loadDiscountConfig))return{productList:d,discountList:e4e((null==m||null==(u=m.getDiscountList)?void 0:u.call(m))||(null==Q||null==(p=Q.getDiscountList)?void 0:p.call(Q))||[],d)};let g=e4e(await m.loadDiscountConfig({customerId:c,action:(null==s?void 0:s.order_id)?"edit":"create",orderId:Number((null==s?void 0:s.order_id)||(null==Q||null==(l=Q.getOrderIdentity)||null==(t=l.call(Q))?void 0:t.orderId))||void 0,apply:!1})||(null==(i=m.getDiscountList)?void 0:i.call(m))||[],d);return await (null==m||null==(r=m.store)||null==(n=r.discount)||null==(a=n.setDiscountList)?void 0:a.call(n,g)),{productList:(null==(o=m.getOrderProducts)?void 0:o.call(m))||d,discountList:g}},v=(async()=>{let e=await g(),t=em((null==e?void 0:e.discountList)||e17(Q,d,k.current));h.current=t,G(t)})();y.current=v;try{return await v}finally{y.current===v&&(y.current=null)}}),ea=(0,eC.useMemo)(()=>{var e,t;return null==Z||null==(t=Z.window)||null==(e=t.getWalletPassEvaluator)?void 0:e.call(t)},[Z]),en=o3(e=>{P(e),A.current=e}),er=o3(()=>A.current.reduce((e,t)=>{let l=Number((null==t?void 0:t.actualDeduction)??(null==t?void 0:t._available_max_amount)??(null==t?void 0:t.available_max_amount)??(null==t?void 0:t.recommended_usage_amount)??(null==t?void 0:t.amount)??0);return e+(Number.isFinite(l)?l:0)},0)),eo=o3(()=>{let e=new Map,t=t=>{"number"==typeof(null==t?void 0:t.edit_current_amount)&&e.set(t.id,t.edit_current_amount)};return[A.current,I,c,r,s,N].forEach(e=>{(e||[]).forEach(t)}),e}),es=o3(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=eo();return t.size?e.map(e=>t.has(e.id)?{...e,edit_current_amount:t.get(e.id)}:e):e}),ed=o3(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new Map;return(A.current.forEach(e=>{D.includes(e.id)&&t.set(e.id,{actualDeduction:e.actualDeduction,_available_max_amount:e._available_max_amount,recommended_usage_amount:e.recommended_usage_amount,recommended_usage_par_value:e.recommended_usage_par_value,available_max_amount:e.available_max_amount})}),t.size)?e.map(e=>{let l=t.get(e.id);return l&&void 0===e.actualDeduction&&void 0===e._available_max_amount&&void 0===e.available_max_amount&&void 0===e.recommended_usage_amount?{...e,...l}:e}):e});(0,eC.useEffect)(()=>{oi(i)&&0===N.length&&!Q&&(d([]),o([]),G([]))},[i]);let ec=(0,eC.useMemo)(()=>eDO(K.filter(e=>!!e.isAvailable).map(e=>({...e,isDisabled:e.isDisabled||e.isDisabledForProductUsed,savedAmount:e.savedAmount||0}))),[K]),eu=(0,eC.useMemo)(()=>ec.filter(e=>e.isSelected&&!e.isEditMode).map(e=>e.id),[ec]),ep=o3(e=>{if(0===g.current.length)return e;let t=new Map(e.map(e=>[e.id,e])),l=[],i=new Set;if(N.length>0)for(let e of[...N].reverse()){let a=t.get(e.id);a&&!i.has(e.id)&&(l.push(a),i.add(e.id))}for(let t of e)g.current.some(e=>e.id===t.id)||i.has(t.id)||(l.push(t),i.add(t.id));for(let e of g.current)t.has(e.id)&&!i.has(e.id)&&(l.push(t.get(e.id)),i.add(e.id));return l}),em=o3(e=>{let t=e=>e.sort((e,t)=>e.isSelected&&!t.isSelected?-1:!e.isSelected&&t.isSelected?1:0);if(0===h.current.length||0===e.length)return[...e.filter(e=>e.isEditMode),...t(e.filter(e=>!e.isEditMode))];let l=new Map;for(let t of e){var i;l.has(t.id)||l.set(t.id,[]),null==(i=l.get(t.id))||i.push(t)}let a=e=>{let t=l.get(e.id);if(!(null==t?void 0:t.length))return null;let i=t.indexOf(e);return -1===i?null:t.splice(i,1)[0]},n=(e,t)=>{let i=l.get(e.id);if(!(null==i?void 0:i.length))return null;let a=i.findIndex(l=>t(l,e));return -1===a?null:i.splice(a,1)[0]},r=[],o=[],s=[];for(let e of h.current.filter(e=>e.isEditMode)){let t=n(e,e=>!!e.isEditMode);t&&r.push(t)}for(let t of e){if(!t.isEditMode)continue;let e=a(t);e&&r.push(e)}for(let e of h.current){if(e.isEditMode)continue;let t=n(e,e=>!e.isEditMode);t&&o.push(t)}for(let t of e){if(t.isEditMode)continue;let e=a(t);e&&s.push(e)}return[...r,...o,...t(s)]}),eg=(0,eC.useMemo)(()=>[...c||[],...N||[]],[c,N]),eh=(0,eC.useMemo)(()=>D.map(e=>eg.find(t=>t.id===e)).filter(Boolean),[D,eg]),{displayVouchers:ev,displayOtherVouchers:ef,selectedWithDetails:ey,totalDeduction:eb}=(0,eC.useMemo)(()=>{if(!ea||!eg.length||!a)return{displayVouchers:[...c||[],...p||[]],displayOtherVouchers:N||[],selectedWithDetails:[],totalDeduction:0};let e=et(),t=ea.recalculateVouchers(eg,eh,a,e),l=[],i=[];return t.allWithUpdatedStatus.forEach(e=>{N.some(t=>t.id===e.id)?i.push(e):l.push(e)}),{displayVouchers:[...l,...p||[]],displayOtherVouchers:i,selectedWithDetails:t.selectedWithDetails,totalDeduction:t.selectedWithDetails.reduce((e,t)=>e+(t.actualDeduction||0),0)}},[eh,eg,c,N,p,a,F,Q]);Fx(()=>{let e;try{e=eE(ey)}catch(e){var t;throw null==(t=S.current)||t.call(S),S.current=null,j.current=!1,e}en(ey),U(!1);let l=S.current;if(l&&!j.current){j.current=!0;let t=()=>{S.current===l&&(S.current=null,j.current=!1),l()};Promise.resolve(e).then(t,t)}},[ey],{wait:200}),(0,eC.useEffect)(()=>()=>{var e;null==(e=S.current)||e.call(S),S.current=null,j.current=!1},[]);let ex=(0,eC.useMemo)(()=>eDE(emy(ep([...ey,...ev,...ef]),"id"),D),[ev,ef,D,ey]),ek=o3(async e=>{U(!0),W(null);try{var t;let l=await (null==J||null==(t=J.getUserIdentificationCodeListAsync)?void 0:t.call(J,e));if(!l)return[];let i=emy([...l,...A.current],"id");return d(i),l}catch(e){throw W(e instanceof Error?e.message:"获取用户识别码列表失败"),e}finally{U(!1)}}),e_=o3(()=>{var e;return(null==J||null==(e=J.getWalletRecommendList)?void 0:e.call(J))||[]}),ew=o3(()=>{var e;return(null==J||null==(e=J.getUserIdentificationCodes)?void 0:e.call(J))||[]}),eS=o3(()=>{var e;null==J||null==(e=J.clearWalletRecommendList)||e.call(J),o([])}),ej=o3(()=>{var e;null==J||null==(e=J.clearUserIdentificationCodes)||e.call(J),d([])}),eN=o3(()=>{var e;null==J||null==(e=J.clearAllCache)||e.call(J),o([]),d([]),C([]),z([]),m([]),u([]),en([]),E([])}),eM=o3(l=>{var i,a;null==J||null==(i=J.clearAllCache)||i.call(J),o([]),d([]),C([]),z([]),m([]),u([]),en([]),E([]),G([]),q([]),T({}),W(null),U(!1),g.current=[],h.current=[],v.current=[],f.current="",y.current=null,b.current="",x.current=null,k.current=new Set,_.current="",L.current=!1,R.current=!1,$.current=!1,(null==l?void 0:l.notify)!==!1&&(null==t||t([]),null==(a=e.onDiscountChange)||a.call(e,{discountList:[]}))}),eT=o3(e=>{let{currentSearchResults:t,cachedSearchResults:l}=e,i=et(),n=t;ea&&t.length>0&&a&&(n=ea.searchVoucherFormat({vouchers:t,orderTotalAmount:a,products:i}));let r=l||[];ea&&l&&l.length>0&&a&&(r=ea.searchVoucherFormat({vouchers:l,orderTotalAmount:a,products:i}));let o=emy([...r||[],...n],"id"),s=[],d=[];n.length>0&&n.forEach(e=>{eDA(e)?s.push(e):d.push(e)});let c=o.filter(e=>eDA(e)),u=o.filter(e=>!eDA(e));z(u);let p=[...A.current];return 1===s.length&&(p=[...A.current,...s],R.current=!0),C(c),m(u),en(p),E(p.map(e=>e.id)),1===s.length}),eI=o3(e=>{var l,i,a,r;T((null==Q||null==(i=Q.getOrderSnapshot)||null==(l=i.call(Q))?void 0:l.tempOrder)||{});let s=(null==e?void 0:e.walletRecommendList)||e_(),c=(null==e?void 0:e.userIdentificationCodes)||ew(),p=(null==J||null==(a=J.getStoredWalletInitData)?void 0:a.call(J))||{},f=(null==e?void 0:e.transformList)||p.transformList||c,y=(null==e?void 0:e.noApplicableVoucher)||p.noApplicableVoucher||[],b=(null==e?void 0:e.products)||p.products||[];(R.current||v.current.length>0)&&(s=es(s),c=es(c),f=es(f)),D.length>0&&(s=ed(s),c=ed(c),f=ed(f));let x=[...s,...c],_=R.current||D.length>0;if(o(s),d(c),u(f),m(y),q(b),g.current=x,L.current||_)if(_){let e=new Set(D);en(emy([...f,...N,...A.current],"id").filter(t=>e.has(t.id)))}else en([]),E([]),L.current=!1,null==t||t([]);else{en(s),E(s.map(e=>e.id));let e=((null==J||null==(r=J.formatWalletPassList2PreparePayments)?void 0:r.call(J,s))||[]).map(e=>({code:e.tag,voucher_id:e.voucher_id,amount:e.amount||0,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:e.wallet_pass_use_value}));null==n||n.addLog({type:"info",title:"useWalletPass_onOrderCreated onSelectChange 开始调用",metadata:{}}),null==t||t(e)}let w=em(e17(Q,b.length?b:F,k.current));h.current=w,G(w),$.current&&(null==H||H.success(eL.getText("wallet-pass-module-best-combination-selected"))),$.current=!1}),eP=o3(async e=>{var t,l,i,a;if(!(null==Q?void 0:Q.initWalletData))return;let n=Number((null==e?void 0:e.order_wait_pay_amount)??ee()),o=er(),s=D.length>0?Number((n+o).toFixed(2)):n;if(s<=0)return;let d=JSON.stringify({orderId:(null==Q||null==(l=Q.getTempOrder)||null==(t=l.call(Q))?void 0:t.order_id)||(null==Q||null==(a=Q.getOrderIdentity)||null==(i=a.call(Q))?void 0:i.orderId),customerId:X(),orderWaitPayAmount:s});if(x.current&&b.current===d)return x.current;if(b.current===d&&r.length>0)return;b.current=d,U(!0);let c=(async()=>{let t=await Q.initWalletData({...e,order_wait_pay_amount:s});return b.current===d&&eI(t),t})();x.current=c;try{return await c}finally{x.current===c&&(x.current=null),U(!1)}}),eA=(0,eC.useMemo)(()=>{var e,t,l,i;let a=(null==M||null==(e=M._extend)?void 0:e.customerSnapshot)||(null==M?void 0:M.customer)||(null==M||null==(t=M.original_order_data)?void 0:t.customer)||{};return oi((null==M?void 0:M.customer_id)||(null==M||null==(l=M.original_order_data)?void 0:l.customer_id)||(null==a?void 0:a.id)||(null==a?void 0:a.customer_id))?eL.getText("wallet-pass-module-customer-name-walk-in"):(null==a?void 0:a.display_name)||(null==a?void 0:a.name)||(null==M?void 0:M.customer_name)||(null==M||null==(i=M.original_order_data)?void 0:i.customer_name)||""},[M]);(0,eC.useEffect)(()=>{let e=X(),t=null==e||""===e?"":String(e);if(Q){if(w.current!==t&&(eM(),w.current=t),!t||oi(e))return void el();(async()=>{await ei()})()}},[Q,i,l,a]),(0,eC.useEffect)(()=>{if(!Q)return;let e=ee();e<=0||eP({order_wait_pay_amount:e})},[Q,i,l,a]);let eD=(0,eC.useMemo)(()=>[...s,...r,...[...N].reverse()],[r,s,N]);o3(()=>N.filter(e=>!A.current.some(t=>t.id===e.id)).map(e=>e.code));let eE=o3(e=>{var l;let i=(null==J||null==(l=J.formatWalletPassList2PreparePayments)?void 0:l.call(J,e))||[],a=[];return i.forEach(e=>{e.amount&&a.every(t=>t.voucher_id!==e.voucher_id)&&a.push({voucher_id:e.voucher_id,amount:e.amount,code:e.tag,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:e.wallet_pass_use_value})}),null==n||n.addLog({type:"info",title:"useWalletPass_notifySelectChange 通知外部选择变化",metadata:{selectedDetails:e,select:a}}),null==t?void 0:t(a)}),eO=o3(async(e,t)=>{var l,i;if(!(null==J?void 0:J.searchIdentificationCodeAsync))return null;let a=await J.searchIdentificationCodeAsync({code:e,prepare_payments:(null==(l=J.formatWalletPassList2PreparePayments)?void 0:l.call(J,ey))||[]}),n=eT({currentSearchResults:(null==a?void 0:a.data)||[],cachedSearchResults:N});return(null==t?void 0:t.waitForApply)&&n&&(null==(i=S.current)||i.call(S),j.current=!1,await new Promise(e=>{S.current=e})),a}),ez=o3(e=>{U(!0),R.current=!0;let t=D.filter(t=>!e.includes(t));if(t.length>0){let e=t.filter(e=>{let t=eg.find(t=>t.id===e);return(null==t?void 0:t.edit_current_amount)!==void 0});e.length>0&&(eY(e,{edit_current_amount:void 0}),v.current=v.current.filter(t=>!e.includes(t)))}E(e),en(eg.filter(t=>e.includes(t.id)))}),eR=(0,eC.useMemo)(()=>emy(eD,"id").filter(e=>e19(e)),[eD,B]),e$=(0,eC.useMemo)(()=>eDE(emy(eD,"id").filter(e=>e19(e)),[],{error:!0,showStatus:!1}),[eD]),eF=o3(async()=>{if(v.current.length>0&&(eY(v.current,{edit_current_amount:void 0}),v.current=[]),0!==B.length||0!==eu.length){if(U(!0),eu.length){var l,i,a;for(let e of(L.current=!0,eu))await (null==Q||null==(a=Q.setDiscountSelected)?void 0:a.call(Q,{discountId:e,isSelected:!1}));let t=(null==Q||null==(l=Q.getOrderProducts)?void 0:l.call(Q))||[],n={productList:t,discountList:e17(Q,t,k.current)},r=em(n.discountList);G(r),null==(i=e.onDiscountChange)||i.call(e,{...n,discountList:r}),U(!1);return}R.current=!0,en([]),E([]),null==n||n.addLog({type:"info",title:"useWalletPass_clearAllSelectedWallet 立即通知外部清空",metadata:{}}),null==t||t([]),U(!1)}}),eq=o3(()=>{if(0===r.length)return!0;let e=r.map(e=>e.id).sort(),t=B.sort();return JSON.stringify(e)===JSON.stringify(t)}),eB=o3(async()=>{null==n||n.addLog({type:"info",title:"useWalletPass_handleBestSaving 开始调用",metadata:{}}),U(!0);let t=!1,l=!1;if(ec.length){var i,a,o,s;t=!0,$.current=!0;let n=await (null==Q||null==(i=Q.bestDiscount)?void 0:i.call(Q)),r=(null==n?void 0:n.productList)||(null==Q||null==(a=Q.getOrderProducts)?void 0:a.call(Q))||[],d=em(e15((null==n?void 0:n.discountList)||(null==Q||null==(o=Q.getDiscountList)?void 0:o.call(Q))||[],r,k.current));G(d),null==(s=e.onDiscountChange)||s.call(e,{...n,discountList:d}),eDz(d.filter(e=>e.isSelected).map(e=>e.id),eu)&&($.current=!1,l=!0,U(!1),null==H||H.info(eL.getText("wallet-pass-module-already-best-combination")))}if(0===r.length){if((!t||t&&l)&&U(!1),N.length)if(eDz(B,N.map(e=>e.id)))null==H||H.info(eL.getText("wallet-pass-module-already-best-combination"));else{let e=N.filter(e=>eDA(e));en(e),E(e.map(e=>e.id)),e.length&&(null==H||H.success(eL.getText("wallet-pass-module-best-combination-selected")))}return}let d=!1,c=r;if(v.current.length>0&&(d=!0,c=eY(v.current,{edit_current_amount:void 0}).newWalletRecommendList,v.current=[]),eq()&&!d)t||null==H||H.info(eL.getText("wallet-pass-module-already-best-combination"));else{if(t&&!l)return;en(c),E(c.map(e=>e.id)),null==H||H.success(eL.getText("wallet-pass-module-best-combination-selected"))}U(!1)}),eH=o3(async(t,l)=>{U(!0);try{var i,a,n;let r=t.includes(l.id);await (null==Q||null==(i=Q.setDiscountSelected)?void 0:i.call(Q,{discountId:l.id,isSelected:r}));let o=(null==Q||null==(a=Q.getOrderProducts)?void 0:a.call(Q))||[],s={productList:o,discountList:e17(Q,o,k.current)},d=em(s.discountList);G(d),null==(n=e.onDiscountChange)||n.call(e,{...s,discountList:d})}finally{U(!1)}}),eV=o3(()=>{z([])}),eU=o3((e,t,l)=>{let i=Array.isArray(t)?t:[t];return e.map(e=>i.includes(e.id)?{...e,...l}:e)}),eY=o3((e,t)=>{let l=eU(r,e,t);o(l);let i=eU(s,e,t);d(i);let a=eU(c,e,t);u(a);let n=eU(N,e,t);C(n);let p=eU(I,e,t);return en(p),{newWalletRecommendList:l,newUserIdentificationCodes:i,newTransformList:a,newSearchIdentificationCodeList:n,newSelectedWallet:p}}),eW=o3((e,t,l)=>{0===e?ez(D.filter(e=>e!==l.id)):(U(!0),v.current.includes(l.id)||v.current.push(l.id),eY(l.id,{edit_current_amount:e}))});return{walletRecommendList:r,userIdentificationCodes:s,loading:V,error:Y,cardData:ex,handleSelectWallet:ez,selectedWalletIds:B,expiredWalletIds:eR,expiredWalletData:e$,disabledWalletData:O,clearAllSelectedWallet:eF,clearDisabledWalletData:eV,handleBeforeEditAmount:o3(async(e,t,l)=>!0),handleBestSaving:eB,handleSearchIdentificationCode:eO,availableDiscountList:ec,selectedDiscountList:eu,handleSelectDiscount:eH,customerName:eA,fetchUserIdentificationCodes:ek,getCachedWalletRecommendList:e_,getCachedUserIdentificationCodes:ew,clearWalletRecommendList:eS,clearUserIdentificationCodes:ej,clearAllCache:eN,handleConfirmEditAmount:eW}})({onSelectChange:a,customAmount:n,totalAmount:Number(null==i?void 0:i.totalAmount)||0,clientId:o,baseSales:s,onDiscountChange:d}),[C,M]=(0,eC.useState)(!1),[T,I]=(0,eC.useState)(!1),[P,A]=(0,eC.useState)(!0),D=o3(()=>{M(!0)}),E=o3(()=>{M(!1)}),O=o3(()=>{I(!1),f()}),z=o3(()=>{A(!P)}),L=o3((e,t)=>{}),R=eM().useMemo(()=>eDE(h||[],[],{error:!0,showStatus:!1}),[h]);(0,eC.useEffect)(()=>{h&&h.length>0&&!T&&I(!0)},[h,T]),(0,eC.useImperativeHandle)(t,()=>({handleSearchIdentificationCode:x,getWalletPassData:e=>({selectedWallet:e.length?u.filter(e=>p.includes(e.id)):[],availableDiscountList:k,selectedDiscountList:_})}));let $=(0,eC.useMemo)(()=>{if(h&&1===h.length){var e,t;return(null==(t=h[0])||null==(e=t.unified_messages)?void 0:e.title)||""}return eL.getText("wallet-pass-module-disabled-modal-title")},[h]),F=(0,eC.useMemo)(()=>p.length+_.length,[p.length,_.length]),q=(0,eC.useMemo)(()=>0===Number(null==i?void 0:i.totalAmount)||!!(null==r?void 0:r.some(e=>!ePw(e)&&!!eP_(e)&&!ePc.includes(e.code))),[r,i]);return 0===u.length&&0===k.length&&0===h.length?null:(0,eH.jsx)("div",{className:"wallet-pass-module-container",children:(0,eH.jsx)(nY.PisellLoading,{delay:300,loading:b,fullscreen:!1,mask:{backgroundColor:"rgba(255, 255, 255, 0.5)",width:"100%",height:"100%"},children:(0,eH.jsxs)("div",{className:"wallet-pass-module",children:[(0,eH.jsx)(e4t,{customerName:S,selectedCount:F,expiredCount:m.length,isCardMode:P,onExpiredClick:D,onBestSaving:y,onClearAll:v,onToggleDisplayMode:z}),(0,eH.jsx)(e4n,{isCardMode:P,cardData:u,selectedWalletIds:p,onSelectWallet:c,onDetail:L,onConfirmEditAmount:j,onBeforeEditAmount:N}),(0,eH.jsx)(e4d,{isCardMode:P,cardData:k,selectedWalletIds:_,onSelectWallet:w,onDetail:L,discountDisabled:q}),(0,eH.jsx)(e4r,{visible:C,walletData:g,onClose:E,title:null==(l=eL.getText("wallet-pass-module-expired-modal-title"))?void 0:l((null==g?void 0:g.length)||0)}),(0,eH.jsx)(e4r,{visible:T,walletData:R,onClose:O,title:$})]})})})}),e4h=(0,eC.forwardRef)((e,t)=>"shared"===e.mode?(0,eH.jsx)(e4m,{...e,ref:t}):(0,eH.jsx)(e4g,{...e,ref:t})),e4v=(0,eC.memo)(e4h),e4f={en:{"pisell2.text.others":"Others","pisell2.text.order-note":"Order Note","pisell2.text.print-receipt":"Print Receipt","pisell2.text.save-pay-later":"Save & Pay Later","pisell2.text.send-link":"Send Link","pisell2.text.manual-order-discount":"Manual Order Discount","pisell2.text.order-no-payment-required":"Order requires no payment, cannot manually adjust price","pisell2.text.order-no-payment-cannot-send-link":"Order requires no payment, cannot send payment link.","pisell2.text.additional-module.order-discount":"Order Discount"},"zh-CN":{"pisell2.text.others":"其他","pisell2.text.order-note":"订单备注","pisell2.text.print-receipt":"打印收据","pisell2.text.save-pay-later":"保存稍后支付","pisell2.text.send-link":"发送链接","pisell2.text.manual-order-discount":"手动订单折扣","pisell2.text.order-no-payment-required":"订单已无需支付,不可手动改价","pisell2.text.order-no-payment-cannot-send-link":"订单已无需支付,不可发送支付链接","pisell2.text.additional-module.order-discount":"订单折扣"},"zh-HK":{"pisell2.text.others":"其他","pisell2.text.order-note":"訂單備註","pisell2.text.print-receipt":"打印收據","pisell2.text.save-pay-later":"保存稍後支付","pisell2.text.send-link":"發送鏈接","pisell2.text.manual-order-discount":"手動訂單折扣","pisell2.text.order-no-payment-required":"訂單已無需支付,不可手動改價","pisell2.text.order-no-payment-cannot-send-link":"訂單已無需支付,不可發送支付鏈接","pisell2.text.additional-module.order-discount":"订单折扣"},ja:{"pisell2.text.others":"その他","pisell2.text.order-note":"注文メモ","pisell2.text.print-receipt":"領収書を印刷","pisell2.text.save-pay-later":"保存して後で支払う","pisell2.text.send-link":"リンクを送信","pisell2.text.manual-order-discount":"手動注文割引","pisell2.text.order-no-payment-required":"注文は支払い不要のため、手動で価格を変更できません","pisell2.text.order-no-payment-cannot-send-link":"注文は支払い不要のため、支払いリンクを送信できません","pisell2.text.additional-module.order-discount":"注文割引"},pt:{"pisell2.text.others":"Outros","pisell2.text.order-note":"Nota do Pedido","pisell2.text.print-receipt":"Imprimir Recibo","pisell2.text.save-pay-later":"Salvar e Pagar Depois","pisell2.text.send-link":"Enviar Link","pisell2.text.manual-order-discount":"Desconto Manual do Pedido","pisell2.text.order-no-payment-required":"O pedido n\xe3o requer pagamento, n\xe3o \xe9 poss\xedvel ajustar o pre\xe7o manualmente","pisell2.text.order-no-payment-cannot-send-link":"O pedido n\xe3o requer pagamento, n\xe3o \xe9 poss\xedvel enviar o link de pagamento.","pisell2.text.additional-module.order-discount":"Desconto do Pedido"}},e4y=function(e){let{orderInfo:t,customAmount:l,handleButtonClick:i,hasOrderNote:a=!1,disabled:n=!1,showCashPayment:r=!1,isFullWidth:o=!1,showMore:s=!0}=e;s2(e4f,eJ());let d=[{key:"send-link",label:eL.getText("pisell2.text.send-link"),icon:(0,eH.jsx)(jv,{})},{key:"print-receipt",label:eL.getText("pisell2.text.print-receipt"),icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-printer"})}],c=qR();return(0,eH.jsxs)("div",{className:"additional-module",children:[r&&(0,eH.jsx)("div",{className:"additional-module-title",children:eL.getText("pisell2.text.others")}),(0,eH.jsx)("div",{className:"additional-module-buttons-container",children:r&&!o?(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("div",{className:"additional-module-button-row",children:[(0,eH.jsxs)(eT.Button,{className:`additional-module-button-base purple-theme ${a?"note-button":""}`,onClick:()=>{i("order-note")},icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-clipboard-minus",className:"additional-module-button-icon"}),size:"large",children:[eL.getText("pisell2.text.order-note"),a&&(0,eH.jsx)("span",{className:"note-indicator",children:(0,eH.jsx)(nY.Icon,{type:"pisell2-info-circle2"})})]}),(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("split-payment")},icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-coins-01",className:"additional-module-button-icon"}),size:"large",children:eL.getText("split.payment")})]}),(0,eH.jsxs)("div",{className:"additional-module-button-row",children:[(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("manual-discount")},icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-sale-01",className:"additional-module-button-icon"}),size:"large",children:eL.getText("pisell2.text.additional-module.order-discount")}),(0,eH.jsx)(eT.Button,{className:`additional-module-button-base ${n?"disabled-theme":"orange-theme"}`,onClick:()=>{i("save-pay-later")},disabled:n,size:"large",icon:(0,eH.jsx)(he,{className:"additional-module-button-icon"}),children:eL.getText("pisell2.text.save-pay-later")}),s&&(0,eH.jsx)(eT.Dropdown,{menu:{items:d,onClick:e=>{let{key:t}=e;"send-link"===t?n?c.fail(eL.getText("pisell2.text.order-no-payment-cannot-send-link")):i("send-link"):"print-receipt"===t?i("print-receipt"):"split-payment"===t?i("split-payment"):"print-receipt"===t&&i("print-receipt")}},trigger:["click"],placement:"bottomLeft",overlayStyle:{zIndex:9999,pointerEvents:"auto"},mouseEnterDelay:.1,mouseLeaveDelay:.1,onOpenChange:e=>{},children:(0,eH.jsx)(eT.Button,{size:"large",className:"additional-module-button-base more-button",icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-dots-vertical",size:20})})})]}),!s&&(0,eH.jsxs)("div",{className:"additional-module-button-row",children:[(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("send-link")},disabled:n,size:"large",icon:(0,eH.jsx)(jv,{}),children:eL.getText("pisell2.text.send-link")}),(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("print-receipt")},disabled:n,size:"large",icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-printer"}),children:eL.getText("pisell2.text.print-receipt")})]})]}):(0,eH.jsxs)("div",{className:"additional-module-button-row",children:[(0,eH.jsxs)(eT.Button,{className:`additional-module-button-base purple-theme ${a?"note-button":""}`,onClick:()=>{i("order-note")},size:"large",icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-clipboard-minus",className:"additional-module-button-icon"}),children:[eL.getText("pisell2.text.order-note"),a&&(0,eH.jsx)("span",{className:"note-indicator",children:(0,eH.jsx)(nY.Icon,{type:"pisell2-info-circle2"})})]}),(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("split-payment")},size:"large",icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-coins-01",className:"additional-module-button-icon"}),children:eL.getText("split.payment")}),(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("manual-discount")},icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-sale-01",className:"additional-module-button-icon"}),size:"large",children:eL.getText("pisell2.text.additional-module.order-discount")}),(0,eH.jsx)(eT.Button,{className:`additional-module-button-base ${n?"disabled-theme":"orange-theme"}`,onClick:()=>{i("save-pay-later")},disabled:n,size:"large",icon:(0,eH.jsx)(he,{className:"additional-module-button-icon"}),children:eL.getText("pisell2.text.save-pay-later")}),(0,eH.jsx)(eT.Dropdown,{menu:{items:d,onClick:e=>{let{key:t}=e;"send-link"===t?n?c.fail(eL.getText("pisell2.text.order-no-payment-cannot-send-link")):i("send-link"):"split-payment"===t?i("split-payment"):"print-receipt"===t&&i("print-receipt")}},trigger:["click"],placement:"bottomLeft",overlayStyle:{zIndex:9999,pointerEvents:"auto"},mouseEnterDelay:.1,mouseLeaveDelay:.1,onOpenChange:e=>{},children:(0,eH.jsx)(eT.Button,{className:"additional-module-button-base more-button",size:"large",icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-dots-vertical",size:20})})})]})})]})},e4b={paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"paid",colorClass:"paid",statusClassName:"success",autoClose:!0,maskClosable:!1},partially_paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"partial",colorClass:"partially-paid",statusClassName:"success",autoClose:!0,maskClosable:!1},deposit_paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"deposit",colorClass:"paid",statusClassName:"success",autoClose:!0,maskClosable:!1},failed:{titleKey:"payment.result.failed",fallbackTitle:"Payment Failed",subtitleMode:"amount_due",colorClass:"amount-due",statusClassName:"failed",autoClose:!1,maskClosable:!1},"wallet-pass-redemption-failed":{titleKey:"pisell2.checkout.wallet-pass.redemption-failed",fallbackTitle:"Wallet pass redeem failed",subtitleMode:"wallet_pass_partial",colorClass:"partially-paid",statusClassName:"wallet-pass-failed",autoClose:!1,maskClosable:!1}};function e4x(e,t){return t||(e?"error"===e?"failed":e in e4b?e:"paid":null)}function e4k(e){let{paymentStatus:t,resultKind:l,orderTotalAmount:i,gapAmount:a,depositAmount:n,changeGivenAmount:r,failureReason:o,isModalMode:s}=e,d=e4x(t,l);if(!d)return null;let c=e4b[d],u={autoClose:c.autoClose,autoCloseDelay:30,maskClosable:c.maskClosable};return s&&(u.autoClose=!1,u.autoCloseDelay=0,u.maskClosable=!1),{resultKind:d,statusClassName:c.statusClassName,paymentStatus:t||d,orderTotalAmount:Number(i||0),depositAmount:Number(n||0),changeGivenAmount:Number(r||0),gapAmount:"partially_paid"===d?Number(a||0):Number(r||0),failureReason:o,autoCloseConfig:u}}let e4_=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$";return lG(e,2,t)},e4w=async(e,t)=>{var l;let i,{paymentStatus:a,resultKind:n,orderTotalAmount:r,gapAmount:o,depositAmount:s,changeGivenAmount:d,failureReason:c,autoCloseConfig:u,actionButtons:p}=e,{getData:m,onToastClose:g}=t,h=eAk({status:"wallet-pass-redemption-failed"===e4x(a,n)?"wallet-pass-failed":eAx("deposit_paid"===n?"deposit_paid":a),paymentStatus:a,currencySymbol:(null==m?void 0:m("shop_symbol"))||"$",orderTotalAmount:r,changeGivenAmount:d,failureReason:c,summary:null,disableDetail:!0});return(null==(l=t.onResultViewModel)||l.call(t,h),"page"===t.paymentResultDisplayMode)?h:(i={...h,actionButtons:p||[],autoClose:(null==u?void 0:u.autoClose)||!1,autoCloseDelay:(null==u?void 0:u.autoCloseDelay)||10,showCountdownProgress:!!(null==u?void 0:u.autoClose),clickOutsideToClose:!!(null==u?void 0:u.autoClose),closable:!0,onClose:g||(()=>{})},Kl.addToast(i),h)},e4S=e=>(0,eH.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"currentColor",viewBox:"0 0 24 24",...e,children:(0,eH.jsx)("path",{fillRule:"evenodd",d:"M17.646 7.06A7.503 7.503 0 0 0 4.54 11.213 1 1 0 0 1 2.552 11 9.49 9.49 0 0 1 7.25 3.772c4.129-2.383 9.303-1.316 12.182 2.308l.109-.405a1 1 0 0 1 1.932.518l-.732 2.732a1 1 0 0 1-1.225.707L16.784 8.9a1 1 0 0 1 .518-1.932zm2.913 4.839a1 1 0 0 1 .889 1.1 9.49 9.49 0 0 1-4.698 7.228c-4.129 2.384-9.303 1.316-12.182-2.307l-.109.405a1 1 0 0 1-1.932-.518l.733-2.732a1 1 0 0 1 1.224-.707l2.732.732a1 1 0 0 1-.517 1.932l-.345-.093a7.502 7.502 0 0 0 13.105-4.152 1 1 0 0 1 1.1-.889",clipRule:"evenodd"})}),e4j=e=>(0,eH.jsx)(na,ak(ak({},e),{},{viewBox:(null==e?void 0:e.viewBox)||"0 0 24 24",component:e4S})),e4N={display:"flex",flexDirection:"column",minHeight:0,overflowY:"auto",maxHeight:"90%",padding:"0px 16px 16px"},e4C={list:[],pagination:{page:1,pageSize:20,total:0},hasMore:!1};function e4M(e){var t,l,i;if(!e)return e4C;let a=(null==(t=e.getCustomerState)?void 0:t.call(e))||{},n=(null==(l=e.getCustomers)?void 0:l.call(e))||[],r=a.customerList||a.list||a.customers||n,o=a.currentPage||a.page||1,s=a.pageSize||20,d=a.total??r.length;return{list:r,pagination:{page:o,pageSize:s,total:d},hasMore:"boolean"==typeof a.hasMore?a.hasMore:!!(null==(i=e.hasMoreCustomers)?void 0:i.call(e))}}let e4T=(0,eC.memo)(e=>{var t,l,i,a,n,r,o,s;let{disabledSwitch:d,clientInfo:c,onSearch:u,beginScanActivity:p,onClientChange:m,baseSales:g,baseSalesModuleName:h,enableScanner:v=!0,showCustomerSelect:f=!0}=e,[y,b]=(0,eC.useState)(!1),[x,k]=(0,eC.useState)(!1),[_,w]=(0,eC.useState)(!1),[S,j]=(0,eC.useState)(e4C),[N,C]=(0,eC.useState)(0),M=(0,eC.useRef)(null),T=(0,eC.useRef)(null),I=e$(),P=(0,nY.useToast)(),A=(0,eC.useMemo)(()=>{var e,t,l,i;return g||h&&(null==(i=I.appHelper)||null==(l=i.utils)||null==(t=l.pisellos)||null==(e=t.getModule)?void 0:e.call(t,h))||null},[h,null==(l=I.appHelper)||null==(t=l.utils)?void 0:t.pisellos,g]),D=(null==A||null==(i=A.getBookingConfig)?void 0:i.call(A))??null,E=null==D||null==(r=D.config)||null==(n=r.basic)||null==(a=n.appointment_subject)?void 0:a.form_id,O=(0,eC.useCallback)(e=>{var t;let l,i,a;j(e?(l=e4M(A),(a=Array.isArray(i=(null==e?void 0:e.data)??e)?i:Array.isArray(null==i?void 0:i.list)?i.list:Array.isArray(null==i?void 0:i.customerList)?i.customerList:Array.isArray(null==e?void 0:e.list)?e.list:Array.isArray(null==e?void 0:e.customerList)?e.customerList:[]).length?{...l,list:a,pagination:{...l.pagination,total:(null==e?void 0:e.total)??(null==e||null==(t=e.data)?void 0:t.total)??l.pagination.total}}:l):e4M(A))},[A]),z=(0,eC.useCallback)(()=>{C(e=>e+1)},[]),L=(0,eC.useMemo)(()=>{var e,t,l,i,a,n;return(null==c?void 0:c.id)||(null==c?void 0:c.customer_id)||(null==c?void 0:c.display_name)||(null==c?void 0:c.name)?c:(null==A||null==(e=A.getCustomer)?void 0:e.call(A))||(null==A||null==(t=A.getOrderCustomerSnapshot)?void 0:t.call(A))||(null==A||null==(n=A.getOrderSnapshot)||null==(a=n.call(A))||null==(i=a.tempOrder)||null==(l=i._extend)?void 0:l.customerSnapshot)||c||null},[A,c,N]),R=(0,eC.useCallback)(async e=>{var t,l,i,a,n,r,o,s;if(!(null==e?void 0:e.trim()))return;let c=null==p?void 0:p();if(p&&!c){null==(t=M.current)||t.setKeyword("");return}b(!0);try{let t=await (null==u?void 0:u(e));if(!((null==t?void 0:t.asset)||(Array.isArray(null==t?void 0:t.data)?t.data.length>0:!!(null==t?void 0:t.data)))){null==P||null==(i=P.info)||i.call(P,eL.getText("pisell2.checkout.wallet-pass-module.no-result"));return}if("type"in t&&"walletCode"==t.type){if(d){null==P||null==(r=P.info)||r.call(P,eL.getText("pisell2.checkout.client-card.tip.partially-paid"));return}let{customer:e,...l}=t.data;if(!e){null==P||null==(o=P.info)||o.call(P,eL.getText("pisell2.checkout.wallet-pass-module.no-result"));return}let i={...e,latest_wallet_detail:l};await (null==(n=T.current)||null==(a=n.handleSetClient)?void 0:a.call(n,i,{sameClientTip:eL.getText("pisell2.checkout.client-card.tip.same-client")}))}null==(l=M.current)||l.setKeyword("")}catch(t){let e=t instanceof Error?t.message:String(t||"");null==P||null==(s=P.error)||s.call(P,e||eL.getText("pisell2.checkout.wallet-pass-module.no-result"))}finally{b(!1),null==c||c()}},[P,p,d,u]);(0,eC.useEffect)(()=>{O(),z()},[O,z]),(0,eC.useEffect)(()=>{if(!(null==A?void 0:A.effectsOn))return;let e=A.effectsOn("onCustomerListUpdate",()=>{O()}),t=A.effectsOn("onCustomerListReset",()=>{O()}),l=A.effectsOn("onOrderCustomerChange",()=>{z()});return()=>{[e,t,l].forEach(e=>{var t;"function"==typeof e?e():null==e||null==(t=e.remove)||t.call(e)})}},[A,z,O]);let $=(0,eC.useMemo)(()=>{let e=(0,eH.jsx)(nY.Icon,{type:"pisell2-switch-horizontal-01",size:24,style:{color:"#667085"}}),t={buttonProps:{icon:e,size:"default"}};return!0===d&&(t={open:!1,buttonProps:{icon:e,size:"default",onClick:()=>{var e;null==P||null==(e=P.info)||e.call(P,eL.getText("pisell2.checkout.client-card.tip.partially-paid"))},style:{cursor:"not-allowed"}}}),t},[P,d]),F=(0,eC.useCallback)(async(e,t)=>{if(A){(null==t?void 0:t.showLoading)!==!1&&k(!0);try{var l;let i=A.resetAndLoadCustomers?await A.resetAndLoadCustomers({search:e||void 0,relation_form_id:(null==t?void 0:t.relation_form_id)??E??void 0}):await (null==(l=A.getCustomerList)?void 0:l.call(A,{search:e||void 0,relation_form_id:(null==t?void 0:t.relation_form_id)??E??void 0,skip:1,num:S.pagination.pageSize}));O(i)}finally{k(!1)}}},[A,S.pagination.pageSize,E,O]),q=(0,eC.useCallback)(async()=>{if(A&&!_){w(!0);try{var e;let t=await (null==(e=A.loadMoreCustomers)?void 0:e.call(A));O(t)}finally{w(!1)}}},[A,_,O]),B=(0,eC.useCallback)(async(e,t)=>{if(A){k(!0);try{var l;let i=await (null==(l=A.changeCustomerPage)?void 0:l.call(A,e,t));O(i)}finally{k(!1)}}},[A,O]),H=(0,eC.useCallback)(async e=>{var t,l,i,a,n;if(!A){null==m||m(e);return}e?(A.setOrderCustomer?A.setOrderCustomer(e):null==(a=A.updateTempOrderCustomer)||a.call(A,e),null==(i=A.setActiveCustomer)||i.call(A,e)):A.clearOrderCustomer?A.clearOrderCustomer():A.updateTempOrderCustomer?A.updateTempOrderCustomer({customer_id:null,customer_name:"",phone:"",email:""}):null==(n=A.setOrderCustomer)||n.call(A,null),e||null==(t=A.setActiveCustomer)||t.call(A,null),null==(l=A.updateTempOrderContactsInfo)||l.call(A,eCI(e)),z(),null==m||m(e)},[A,m,z]),V=(0,eC.useCallback)(e=>{var t;null==A||null==(t=A.addCustomerToFirst)||t.call(A,e),O()},[A,O]),U=(0,eC.useCallback)((e,t)=>{var l,i;let a=null==(i=I.appHelper)||null==(l=i.utils)?void 0:l.action,n=(null==e?void 0:e.id)??(null==e?void 0:e.customer_id);a&&n&&a({type:"pisell1.handleOpenCustomerModal",data:{id:n},callback:t})},[null==(s=I.appHelper)||null==(o=s.utils)?void 0:o.action]);return(0,eH.jsxs)("div",{className:"checkout-search-client-module",style:{display:"flex",gap:8},children:[(0,eH.jsx)(Zz,{ref:M,className:"checkout-search-client-module__find",displayType:"detached",triggerType:"input",searchMode:"confirm",showConfirmButton:!0,showHistory:!1,enableScanner:v,loading:y,placeholder:eL.getText("pisell2.checkout.search-section.placeholder"),onSearch:R,searchSectionProps:{style:{flex:1,minWidth:0},cameraButtonProps:{icon:["pisell2-camera-01","pisell2-qr-code-02"]},searchButtonProps:{placement:"inside",style:{height:36,padding:8,minWidth:76}}}}),f&&(0,eH.jsx)(eCR,{ref:T,value:L,list:S.list,loading:x,loadingMore:_,hasMore:S.hasMore,pagination:S.pagination,onSearch:F,onLoadMore:q,onChangePage:B,onSelect:H,onAddToFirst:V,onOpenCustomerDetail:U,readOnly:d,bookingConfig:D,clientCardProps:{style:{width:326,minHeight:48,height:48,padding:"4px 8px",borderColor:"#D0D5DD"},avatar:{size:"sm"},dropdown:$}})]})});function e4I(e,t){try{return{value:e(),error:null}}catch(e){return{value:t,error:e}}}let e4P=()=>void 0,e4A={display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto minmax(0, 1fr)",alignItems:"center",gap:12,width:"100%"},e4D={justifySelf:"start"},e4E={minWidth:0,textAlign:"center",fontSize:16,fontWeight:600,lineHeight:"24px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},e4O={justifySelf:"end",minWidth:0};function e4z(e){var t,l;let i=e4R(e.currencyAmount)??new lz(0),a=e4R(null==(t=e.walletPassUsageUnit)?void 0:t.points),n=e4R(null==(l=e.walletPassUsageUnit)?void 0:l.price);return!a||!n||a.eq(0)||n.eq(0)?lG(i.toNumber()):i.div(n).toDecimalPlaces(6,lz.ROUND_DOWN).mul(a).toFixed(2,lz.ROUND_DOWN)}function e4L(e){try{return new lz(e||0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}}function e4R(e){if(null==e)return null;try{return new lz(e)}catch{return null}}function e4$(e){let t=e4R(e);return(null==t?void 0:t.isFinite())?lz.max(t,0).toFixed(2):void 0}function e4F(e){let t=e4R(e);return!t||t.lte(0)?"":t.toDecimalPlaces(2).toFixed(2)}function e4q(e,t){return e4$((null==e?void 0:e.expectAmount)??(null==e?void 0:e.totalAmount)??(null==t?void 0:t.totalAmount))??"0.00"}function e4B(e,t){var l,i;let a=(null==e||null==(l=e.getOrderAmountSnapshot)?void 0:l.call(e))||{},n=(null==e||null==(i=e.getTempOrder)?void 0:i.call(e))||{};return e4$(a.depositAmount??n.deposit_amount??(null==t?void 0:t.depositAmount))??e4q(a,t)}function e4H(e){var t,l,i,a,n,r,o,s,d;let c=null==e||null==(t=e.getOrderSnapshot)?void 0:t.call(e),u=(null==e||null==(l=e.getOrderAmountSnapshot)?void 0:l.call(e))||(null==c?void 0:c.amount)||{},p=(null==c?void 0:c.identity)||{};if(!c&&!u)return null;let m=(null==c?void 0:c.tempOrder)||{},g=(null==m||null==(i=m._extend)?void 0:i.customerSnapshot)||(null==m?void 0:m.customer)||(null==c?void 0:c.customer)||null,h=m.customer_id??(null==g?void 0:g.id)??(null==g?void 0:g.customer_id)??(null==c||null==(a=c.customer)?void 0:a.customerId),v=(null==g?void 0:g.display_name)||(null==g?void 0:g.name)||m.customer_name||(null==c||null==(n=c.customer)?void 0:n.customerName)||"";return{orderId:p.orderId||p.externalSaleNumber||p.orderNumber,status:null==c?void 0:c.status,...eEZ(u,m),paymentStatus:null==c?void 0:c.paymentStatus,itemCount:(null==c?void 0:c.productCount)||(null==c||null==(o=c.tempOrder)||null==(r=o.products)?void 0:r.length)||0,hasLocalOrderData:!!(null==c?void 0:c.tempOrder),customerId:h,customerName:v,customerPhone:(null==g?void 0:g.phone)||m.phone||(null==c||null==(s=c.customer)?void 0:s.phone)||"",customerEmail:(null==g?void 0:g.email)||m.email||(null==c||null==(d=c.customer)?void 0:d.email)||"",customerSnapshot:g}}function e4V(e){let t=(null==e?void 0:e.submitResult)||e,l=e42(t);return(null==l?void 0:l.data)||(null==t?void 0:t.data)||l||{}}async function e4U(e){var t;await (null==e||null==(t=e.confirmPendingVoucherPayments)?void 0:t.call(e))}async function e4Y(e){var t;"function"==typeof(null==e?void 0:e.discardPendingVoucherPayments)?await e.discardPendingVoucherPayments():await (null==e||null==(t=e.updateVoucherOrderPayments)?void 0:t.call(e,[]))}async function e4W(e,t){var l;let i=(null==e?void 0:e.addOrderPaymentAsync)||(null==e?void 0:e.addOrderPayment);if("function"==typeof i)return null==(l=e.ensureOrderCreatedAt)||l.call(e),i.call(e,t)}async function e4K(e,t,l){let i=(null==e?void 0:e.updateVoucherOrderPaymentsAsync)||(null==e?void 0:e.updateVoucherOrderPayments);if("function"==typeof i)return i.call(e,t,l)}async function e4G(e,t){var l;return{success:!0,response:await (null==e||null==(l=e.submitSalesOrder)?void 0:l.call(e,{smallTicketDataFlag:1,...(null==t?void 0:t.confirmPendingVoucherPayments)!==void 0?{confirmPendingVoucherPayments:t.confirmPendingVoucherPayments}:{}}))}}async function e4Q(e){if("function"==typeof(null==e?void 0:e.confirmWalletPayment)){let t=await e.confirmWalletPayment();return{success:!0,response:null==t?void 0:t.submitResult,walletResult:t}}return await e4U(e),e4G(e,{confirmPendingVoucherPayments:!0})}async function e4Z(e,t){if("function"!=typeof(null==e?void 0:e.submitTempOrderAsync))return{success:!1,response:{status:!1,message:"当前订单提交能力不可用,请重启 APP 后再试"}};let l=await e.submitTempOrderAsync({smallTicketDataFlag:1,...(null==t?void 0:t.confirmPendingVoucherPayments)!==void 0?{confirmPendingVoucherPayments:t.confirmPendingVoucherPayments}:{}});return{success:!e4J(l),response:l}}function e4J(e){if(!(e=e42(e))||"object"!=typeof e)return!1;let t=void 0!==e.code&&200!==e.code&&"200"!==e.code,l=!1===e.status||"number"==typeof e.status&&e.status>=400,i=!1===e.success;return t||l||i}function e4X(e){var t,l,i,a,n,r,o;return(e=e42(e))&&"object"==typeof e?String(e.message||e.msg||e.error||(null==(t=e.data)?void 0:t.message)||(null==(l=e.data)?void 0:l.msg)||(null==(i=e.data)?void 0:i.error)||(null==(n=e.errors)||null==(a=n[0])?void 0:a.message)||(null==(o=e.errors)||null==(r=o[0])?void 0:r.msg)||""):""}function e40(e){var t,l,i,a,n;return(null==(e=e42(e))||null==(t=e.data)?void 0:t.order_id)||(null==e?void 0:e.order_id)||(null==e||null==(i=e.data)||null==(l=i.order)?void 0:l.order_id)||(null==e||null==(n=e.data)||null==(a=n.sales)?void 0:a.order_id)}function e42(e){return e&&"object"==typeof e&&e.data&&"object"==typeof e.data&&!e41(e)&&e41(e.data)?e.data:e}function e41(e){return!!e&&"object"==typeof e&&(void 0!==e.code||void 0!==e.status||void 0!==e.success||void 0!==e.message||void 0!==e.msg||void 0!==e.error||void 0!==e.errors)}function e44(e,t){let l=e42(e);return{code:null==l?void 0:l.code,status:null==l?void 0:l.status,success:null==l?void 0:l.success,message:e4X(l),response:l,rawResponse:e,payments:t}}async function e43(e,t,l){var i,a,n;let r=null==e||null==(i=e.getTempOrder)?void 0:i.call(e);await (null==e||null==(a=e.getSummary)?void 0:a.call(e));let o=t&&e4F(l)||"0.00";return"function"==typeof(null==e?void 0:e.updateTempOrderDepositAmount)&&await e.updateTempOrderDepositAmount(o),await (null==e||null==(n=e.saveDraft)?void 0:n.call(e)),r}async function e48(e,t){if("function"==typeof(null==e?void 0:e.updateTempOrderDepositAmount))return e.updateTempOrderDepositAmount(t)}let e46=(0,eC.forwardRef)((e,t)=>{var l,i,a,n,r,o;let{cartData:s,orderInfo:d,isModalOpen:c,onPaymentComplete:u,onPaymentCancel:p,onStatusChange:m,showingCashToastRef:g,onToastClose:h,orderNote:v,setOrderNote:f,setNoteModalSource:y,setNoteModalOpen:b,totalAmount:x=0,moduleConfig:k,onShowCashPaymentChange:_,showSuccessToast:w,dynamicMaxHeight:S="600px",onOrderSyncFailed:j,generateActionButtons:N,paymentResultToastConfig:C,updateOrderInfo:M,setCurrentEditOrderId:T,config:I,paymentResultDisplayMode:P,shopDiscount:A,client:D,currentTotalPrice:E,onChangeShopDiscount:O,onChangeOrderNote:z,onDeleteOrderNote:L,baseSales:R,walletPassMode:$="legacy",cardReaderDeviceNumber:F,cardReaders:q=[],setIsChangePaymentNotIncludeVoucher:B}=e,H=e$(),V=H.appHelper.utils||{},{getApp:U,pisellos:Y,getData:W,pisellosAllModule:K,interaction:G}=V,Q=(0,nY.useToast)(),Z=(0,eC.useRef)(null),J=(0,eC.useRef)(null),X=(0,eC.useRef)(null),[ee,et]=(0,eC.useState)(""),[el,ei]=(0,eC.useState)(""),[ea,en]=(0,eC.useState)(""),[er,eo]=(0,eC.useState)([]),[es,ed]=(0,eC.useState)(!1),ec=(0,eC.useRef)(null),[eu,ep]=(0,eC.useState)([]),[em,eg]=(0,eC.useState)(!1),[eh,ev]=(0,eC.useState)(!1),[ef,ey]=(0,eC.useState)(eL.getText("cards.and.digitals")||"Cards & Digitals"),eb=d2(),ex=(0,eC.useMemo)(()=>String((null==W?void 0:W("channel"))||"").trim().toLowerCase(),[W]),ek=function(e){let t=(0,eC.useRef)(),l=(0,eC.useRef)(!0),[i,a]=(0,eC.useState)(!1),[n,r]=(0,eC.useState)(!1),o=o3(i=>{if(!e)return e4P;if(t.current)return null;let n=Symbol(i);t.current={token:n,type:i},l.current&&(a("payment"===i),r("scan"===i));let o=!1;return()=>{var e;o||(o=!0,(null==(e=t.current)?void 0:e.token)===n&&(t.current=void 0,l.current&&(a(!1),r(!1))))}}),s=o3(()=>o("payment")),d=o3(()=>o("scan")),c=o3(()=>{var l;return e&&(null==(l=t.current)?void 0:l.type)==="payment"}),u=o3(()=>{var l;return e&&(null==(l=t.current)?void 0:l.type)==="scan"});return(0,eC.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]),(0,eC.useEffect)(()=>{e||(t.current=void 0,a(!1),r(!1))},[e]),(0,eC.useMemo)(()=>({tryBeginPayment:s,tryBeginScan:d,getIsPaymentProcessing:c,getIsScanProcessing:u,isPaymentProcessing:i,isScanProcessing:n}),[s,d,c,u,i,n])}("kiosk"===ex),e_=(0,eC.useRef)(),ew=eA0(null==(i=H.appHelper.utils)||null==(l=i.getApp)?void 0:l.call(i)),eS=(0,eC.useRef)(),ej=(0,eC.useMemo)(()=>eu.filter(e=>{var t;return("app"!==e.type||"EFTPOS_LINKLY"!==e.code)&&(null==(t=e.channel_application)?void 0:t.includes(ex))&&(["custom"].includes(e.type)||ePh.includes(e.code))}),[ex,eu]),eN=(0,eC.useMemo)(()=>ePT(eu,q,F||""),[F,q,eu]),eI=(0,eC.useRef)(!1),[eP,eA]=(0,eC.useState)(),eD=(0,eC.useRef)(null),eE=(0,eC.useRef)("0.00"),[eO,ez]=(0,eC.useState)([]),eR=(0,eC.useMemo)(()=>eO.reduce((e,t)=>{if(!ePS(t))return e;try{let l=new lz(t.amount||0),i=new lz(t.rounding_amount||0);return e.plus(l).plus(i)}catch{return e}},new lz(0)),[eO]),eF=(0,eC.useCallback)(e=>{try{return lz.max(new lz(e||0).minus(eR),0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}},[eR]),eq=(0,eC.useMemo)(()=>eF(ee||el||0),[el,ee,eF]),eB=(0,eC.useMemo)(()=>eF(el||0),[el,eF]),eV=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,eC.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.some(e=>!!e&&"voided"!==e.status&&((null==e?void 0:e.voucher_id)===void 0||0===Number(e.voucher_id)))})(e),[e]);return{isCustomerChangeLocked:t,canChangeCustomer:!t,shouldReloadWalletPassAfterCustomerChange:!t}}(eO),eU=(0,eC.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.some(e=>!!eP_(e)&&(null==e?void 0:e.order_payment_type)!=="deposit"&&(null==e?void 0:e.type)!=="deposit")})(eO),[eO]),[eY,eW]=(0,eC.useState)({}),[eK,eG]=(0,eC.useState)(!1),eZ=(0,eC.useMemo)(()=>!!eq&&0>=parseFloat(eq),[eq]),[eJ,eX]=(0,eC.useState)(!1),[e0,e2]=(0,eC.useState)(!1),e1=(null==I?void 0:I.enablePriceAdjust)!==!1,{runWithPermission:e4}=eQ({scopeKey:(null==d?void 0:d.orderId)??(null==d?void 0:d.uuid)??R,active:c,isAvailable:()=>e1}),[e3,e8]=(0,eC.useState)(),e6=eWG(),e5=o3(()=>{var e;null==Q||null==(e=Q.info)||e.call(Q,eL.getText("pisell2.checkout.scan-blocked-by-payment"))}),e7=o3(()=>{var e;null==Q||null==(e=Q.info)||e.call(Q,eL.getText("pisell2.checkout.payment-blocked-by-scan"))}),e9=o3(()=>{if(ek.getIsPaymentProcessing()||eK)return e5(),null;if(ek.getIsScanProcessing()){var e;return null==Q||null==(e=Q.info)||e.call(Q,eL.getText("pisell2.checkout.wallet-scan-processing")),null}return ek.tryBeginScan()}),te=o3((e,t)=>{var l;let i=e_.current;!i||t&&!i.source.startsWith(t)||i.deferRelease||(i.release(),null==e6||null==(l=e6.addLog)||l.call(e6,{type:"info",title:"Kiosk checkout payment activity finished",metadata:{reason:e,source:i.source}}))}),tt=o3(e=>{var t,l,i;if("kiosk"!==ex){let e=()=>void 0;return e.isActive=()=>!0,e}if(ek.getIsScanProcessing())return e7(),null;if(ek.getIsPaymentProcessing())return null==Q||null==(l=Q.info)||l.call(Q,eL.getText("payment.processing")),null;if(eK)return null==Q||null==(i=Q.info)||i.call(Q,eL.getText("payment.processing")),null;let a=ek.tryBeginPayment();if(!a)return null;let n=!1,r=()=>{var e;if(n)return;let t=e_.current;(null==t?void 0:t.release)===r&&t.deferRelease||(n=!0,(null==(e=e_.current)?void 0:e.release)===r&&(e_.current=void 0),a())};return r.isActive=()=>{var e;return!n&&(null==(e=e_.current)?void 0:e.release)===r},e_.current={release:r,source:e},null==e6||null==(t=e6.addLog)||t.call(e6,{type:"info",title:"Kiosk checkout payment activity started",metadata:{source:e}}),r});(0,eC.useEffect)(()=>{if(!c){var e;null==(e=eS.current)||e.release(),te("modal-closed")}},[c]),(0,eC.useEffect)(()=>()=>te("component-unmounted"),[]);let tl=W("shop_currency_code")||"USD",ti=W("bookingv2_deposit")||0,ta=null==R||null==(a=R.getOtherParams)?void 0:a.call(R),tn=exI({handle:R??null,scopeKey:JSON.stringify([(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),null==ta?void 0:ta.channel,null==ta?void 0:ta.shop_id,null==ta?void 0:ta.platform,null==ta?void 0:ta.cacheId]),active:!!c,ready:!!(null==R?void 0:R.getContactInfoConfig),order:(null==R||null==(n=R.getTempOrder)?void 0:n.call(R))??null,save:e=>R.updateTempOrderContactsInfo(e)}),tr=(0,eC.useRef)(!1),to=o3(async()=>{var e,t,l;if(tr.current)return!1;tr.current=!0;try{if((null==R?void 0:R.getContactInfoConfig)&&!await tn.runtime.ensureComplete())return!1;return await (null==R||null==(e=R.ensureSalesOrderReadyForPayment)?void 0:e.call(R)),await (null==R||null==(t=R.preparePickupTimingForCheckout)?void 0:t.call(R)),!0}catch(e){return null==Q||null==(l=Q.error)||l.call(Q,e instanceof Error?e.message:String(e)),!1}finally{tr.current=!1}}),ts=(0,eC.useCallback)(async()=>{"shared"===$&&(null==R?void 0:R.clearWalletAssetSelection)?await R.clearWalletAssetSelection():await e4Y(R)},[R,$]);(0,eC.useEffect)(()=>{c||(eI.current=!1,X.current=null,eE.current="0.00",eA(void 0))},[c]);let td=(0,eC.useMemo)(()=>{var e,t;if(eI.current)return eP??null;let l=(null==D?void 0:D.display_name)||(null==D?void 0:D.name)||(null==D?void 0:D.nickname);if((null==D?void 0:D.id)||(null==D?void 0:D.customer_id)||l)return D;let i=(null==d?void 0:d.customerSnapshot)||{},a=i.id??i.customer_id??(null==d?void 0:d.customerId),n=i.display_name||i.name||(null==d?void 0:d.customerName)||"",r=i.phone||(null==d?void 0:d.customerPhone)||"",o=i.email||(null==d?void 0:d.customerEmail)||"";return a||n||r||o?{...i,id:a,customer_id:a,display_name:n,name:i.name||n,phone:r,email:o,contacts:{...i.contacts||{},email:(null==(e=i.contacts)?void 0:e.email)||o,phone:(null==(t=i.contacts)?void 0:t.phone)||r}}:D},[D,null==d?void 0:d.customerEmail,null==d?void 0:d.customerId,null==d?void 0:d.customerName,null==d?void 0:d.customerPhone,null==d?void 0:d.customerSnapshot,eP]),tc=(0,eC.useMemo)(()=>({map:eu.reduce((e,t)=>(ePc.includes(t.code)&&(e[t.code]=t),e),{}),isShow:!0}),[eu]),tu=o3(()=>{let e=e4H(R);e&&(null==M||M(e),ei(e.remainingAmount||"0"),en(e.totalAmount||"0"),et(e.remainingAmount||"0"))}),tp=o3(async e=>{let t=e.payments??await th(),l=Array.isArray(t)?t.filter(e=>{let t=null==e?void 0:e.order_payment_id;return null==t||""===t||0===t}):t;return eA_({baseSales:R,status:e.status,payments:t,sessionPayments:l,currencySymbol:(null==W?void 0:W("shop_symbol"))||void 0,changeGivenAmount:e.changeGivenAmount,orderTotalAmount:e.orderTotalAmount,failureReason:e.failureReason,taxTitle:null==W?void 0:W("tax_title"),translationOriginal:null==V?void 0:V.translationOriginal,actionButtons:e.actionButtons,autoClose:e.autoClose,autoCloseDelay:60,displayMode:P,onClose:()=>{null==h||h()}})}),tm=o3(async e=>{var t,l,i,a,n,r,o,s;let d=null==R||null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),c=(null==(l=e.syncResult)?void 0:l.isOrderFullyPaid)??(null==(i=e.syncResult)?void 0:i.isFullyPaid),m="deposit_paid"===e.resultKind?"deposit_paid":c?"paid":"partially_paid",g=e4k({paymentStatus:m,resultKind:e.resultKind,orderTotalAmount:e.orderTotalAmount??((null==d?void 0:d.expectAmount)||x),depositAmount:e.depositAmount??(null==(a=e.syncResult)?void 0:a.depositAmount)??(null==d?void 0:d.depositAmount),gapAmount:null==d?void 0:d.amountGap,changeGivenAmount:e.changeGivenAmount,failureReason:e.failureReason,isModalMode:"modal"===P});if(!g)return;let h=e4H(R),v=null==h?void 0:h.orderId,f=await tp({status:eAx(m),changeGivenAmount:e.changeGivenAmount,payments:e.paymentItems,actionButtons:null==N?void 0:N(m,!1,v),autoClose:null==(n=g.autoCloseConfig)?void 0:n.autoClose,autoCloseDelay:null==(r=g.autoCloseConfig)?void 0:r.autoCloseDelay,orderTotalAmount:g.orderTotalAmount});u({response:null==(o=e.syncResult)?void 0:o.submitResult,paymentItems:e.paymentItems,orderPrintPayload:e.orderPrintPayload,paymentResultViewModel:f,toastInfo:{status:m,amount:g.orderTotalAmount,gapAmount:g.gapAmount,depositAmount:g.depositAmount,failureReason:e.failureReason}}),("paid"===m||"deposit_paid"===e.resultKind)&&(null==(s=e.syncResult)?void 0:s.submitResult)&&p(!0,!0)}),tg=o3(e=>{var t;let l=null==e?void 0:e[e.length-1],i=null==l||null==(t=l.metadata)?void 0:t.change_given_amount;if(null==i||""===i)return;let a=Number(i);return Number.isFinite(a)?a:void 0}),th=o3(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];try{var t;let e=await Promise.resolve(null==R||null==(t=R.getOrderPayments)?void 0:t.call(R));if(Array.isArray(e))return e}catch(e){console.warn("Failed to read latest baseSales payment items:",e)}return Array.isArray(e)?e:[]}),tv=o3(async e=>{var t,l,i;let a,n,r,o=(null==e?void 0:e.response)||e,s=e4V(o),d=(i=null==R||null==(l=R.getOrderIdentity)||null==(t=l.call(R))?void 0:t.orderId,n=(null==(a=e4V(o))?void 0:a.payment_info)||{},(r=(null==a?void 0:a.order_id)||(null==a?void 0:a.orderId)||i)?{type:"99",data:{order_id:r,machine_code_print_info:(null==n?void 0:n.machine_code_print_info)||(null==a?void 0:a.machine_code_print_info),small_ticket_data:(null==n?void 0:n.small_ticket_data)||(null==a?void 0:a.small_ticket_data),machine_code_print_info_v2:(null==n?void 0:n.machine_code_print_info_v2)||(null==a?void 0:a.machine_code_print_info_v2)}}:null);return u({response:o,paymentItems:await th(eO),orderPrintPayload:d,toastInfo:{status:null==s?void 0:s.payment_status,amount:Number((null==s?void 0:s.total_amount)||(null==s?void 0:s.expect_amount)||0),gapAmount:Number((null==s?void 0:s.amount_gap)||0)}}),d}),tf=o3(async e=>{var t,l,i,a,n,r,o,s,d,c;let p=e.forceUseParamsPayment&&Array.isArray(e.payments)?e.payments:await th(e.payments),m=null==(t=e.syncResult)?void 0:t.submitResult;if(e4J(m)){let t=e42(m),l=e4X(t)||eL.getText("pisell2.checkout.order-sync-failed");if(console.error(`[PaymentModal] Sales checkout backend rejected: ${l}`,e44(m,p)),Ki(),(null==I?void 0:I.keepOpenOnSyncFailure)===!0)return null==e6||null==(r=e6.addLog)||r.call(e6,{type:"error",title:"BaseSales payment sync rejected; waiting for kiosk retry",metadata:{error:l,response:t,payments:p}}),null==j||j(),null==Q||null==(o=Q.error)||o.call(Q,l),{ok:!1,syncResult:e.syncResult,response:t,message:l,kind:"backend-rejected"};if(e.rollbackPaymentIdentity&&(null==(s=R.deleteOrderPayment)||s.call(R,e.rollbackPaymentIdentity),ez(await th())),null==e6||null==(a=e6.addLog)||a.call(e6,{type:"error",title:"BaseSales payment sync rejected by backend",metadata:{error:l,response:t,payments:p}}),"page"===P){let e=await tp({status:"failed",failureReason:l,payments:p,orderTotalAmount:(null==(c=R.getOrderAmountSnapshot)||null==(d=c.call(R))?void 0:d.totalAmount)||x});u({paymentItems:p,paymentResultViewModel:e,response:t,toastInfo:{status:"failed",failureReason:l}})}return null==Q||null==(n=Q.error)||n.call(Q,l),{ok:!1,syncResult:e.syncResult,response:t,message:l,kind:"backend-rejected"}}let g=e4H(R);g&&(null==M||M(g),ei(g.remainingAmount||"0"),en(g.totalAmount||"0"),et(g.remainingAmount||"0"));let h=e.forceUseParamsPayment?p:await th(p);return ez(h),(null==(l=e.syncResult)?void 0:l.isDepositFullyPaid)&&!(null==(i=e.syncResult)?void 0:i.isOrderFullyPaid)||await tm({syncResult:e.syncResult,paymentItems:h,changeGivenAmount:e.changeGivenAmount??tg(h),orderPrintPayload:null,orderTotalAmount:e.orderTotalAmount}),{ok:!0,syncResult:e.syncResult}});(0,eC.useEffect)(()=>{let e;if("kiosk"===ex){try{let t=U(),l=t.applicationManager.get("global");e=null==l?void 0:l.runFunction("listenExternalCommand",{app:t,handler:async e=>{if("authorization_close"===e.command)return void te("authorization-closed","authorization:");if("payment_result"!==e.command)return;let t=e.params,i=e_.current;(null==i?void 0:i.source.startsWith("authorization:"))&&(i.deferRelease=!0);try{if((null==t?void 0:t.status)==="cancelled")return;let e=Array.isArray(null==t?void 0:t.payments)?t.payments:[];if(null==t?void 0:t.ok){var a,n,r;if((null==t||null==(a=t.syncResult)?void 0:a.isDepositFullyPaid)&&!(null==t||null==(n=t.syncResult)?void 0:n.isOrderFullyPaid))return;await tf({syncResult:t.syncResult,payments:e,changeGivenAmount:tg(e),forceUseParamsPayment:!0,orderTotalAmount:null==t||null==(r=t.syncResult)?void 0:r.orderExpectedAmount});return}await tb({error:(null==t?void 0:t.error)||Error(eL.getText("pisell2.checkout.order-sync-failed")),payments:e,changeGivenAmount:tg(e)})}finally{i&&e_.current===i&&(i.deferRelease=!1);try{l.runFunction("closeAuthorization")}finally{te("payment-result","authorization:")}}}})}catch(e){}return"function"==typeof e?e:void 0}},[]);let ty=o3(async e=>{var t;let l=await th(e.payments),i=e4H(R);i&&(null==M||M(i),ei(i.remainingAmount||"0"),en(i.totalAmount||"0"),et(i.remainingAmount||"0"));let a=await th(l);return ez(a),await tm({syncResult:e.syncResult,paymentItems:a,resultKind:"deposit_paid",depositAmount:e.depositAmount??(null==(t=e.syncResult)?void 0:t.depositAmount)??(null==i?void 0:i.depositAmount),changeGivenAmount:e.changeGivenAmount??tg(a),orderPrintPayload:null}),{ok:!0,syncResult:e.syncResult}}),tb=o3(async e=>{var t,l,i,a,n,r,o,s,d,c,p,m,g,h,v,f,y,b,k,_,w,S;let C,T,A,D,E=await th(e.payments),O=e42([null==(k=e.error)||null==(_=k.response)?void 0:_.data,null==k?void 0:k.data,null==k||null==(w=k.response)?void 0:w.body,null==k?void 0:k.body].find(e=>{let t=e42(e);return t&&"object"==typeof t&&(e4J(t)||e4X(t))})),z=!!O,L=!O&&(T=String((null==(S=e.error)?void 0:S.message)||S||"").toLowerCase(),A=String((null==S?void 0:S.code)||"").toLowerCase(),D=String((null==S?void 0:S.name)||"").toLowerCase(),["network","failed to fetch","load failed","timeout","timed out","请求超时","err_network","econnaborted","etimedout"].some(e=>T.includes(e)||A.includes(e)||D.includes(e))),$=z?e4X(O)||eL.getText("pisell2.checkout.order-sync-failed"):e.error instanceof Error?e.error.message:String(e.error);if((null==I?void 0:I.keepOpenOnSyncFailure)===!0)return Ki(),null==e6||null==(s=e6.addLog)||s.call(e6,{type:"error",title:"BaseSales payment sync failed; waiting for kiosk retry",metadata:{error:$,kind:z?"backend-rejected":null==(r=e.error)?void 0:r.kind,response:O||(null==(o=e.error)?void 0:o.response),payments:E}}),null==j||j(),null==Q||null==(d=Q.error)||d.call(Q,$),{ok:!1,error:e.error,message:$,response:O,kind:z?"backend-rejected":(null==(c=e.error)?void 0:c.kind)||"unknown"};if(z?(console.error(`[PaymentModal] Sales checkout backend rejected: ${$}`,e44(O,E)),Ki()):console.error("[PaymentModal] Sales checkout submit failed",e.error),L){let t=eL.getText("pisell2.checkout.order-saved-sync-later"),l=e4H(R);l&&(null==M||M(l),ei(l.remainingAmount||"0"),en(l.totalAmount||"0"),et(l.remainingAmount||"0"));let i=await th(E);ez(i),null==e6||null==(m=e6.addLog)||m.call(e6,{type:"info",title:"BaseSales payment saved locally, backend sync deferred",metadata:{error:e.error instanceof Error?e.error.message:String(e.error),kind:(null==(p=e.error)?void 0:p.kind)||"network-deferred",payments:i}}),null==Q||null==(g=Q.info)||g.call(Q,t);let a={isFullyPaid:!0,submitResult:{deferred_sync:!0,message:t}};return await tm({syncResult:a,paymentItems:i,changeGivenAmount:e.changeGivenAmount??tg(i),failureReason:t}),{ok:!0,syncResult:a,message:t,kind:"network-deferred"}}if(e.rollbackPaymentIdentity&&(null==(h=R.deleteOrderPayment)||h.call(R,e.rollbackPaymentIdentity),ez(await th())),null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"BaseSales payment sync failed",metadata:{error:$,kind:z?"backend-rejected":null==(t=e.error)?void 0:t.kind,response:O||(null==(l=e.error)?void 0:l.response),payments:E}}),!z||"page"===P){let e=e4k({paymentStatus:"failed",orderTotalAmount:(null==(f=R.getOrderAmountSnapshot)||null==(v=f.call(R))?void 0:v.totalAmount)||x,failureReason:$,isModalMode:"modal"===P});C=await tp({status:"failed",failureReason:$,actionButtons:(null==N?void 0:N("failed"))||[],autoClose:null==e||null==(y=e.autoCloseConfig)?void 0:y.autoClose,autoCloseDelay:null==e||null==(b=e.autoCloseConfig)?void 0:b.autoCloseDelay,orderTotalAmount:null==e?void 0:e.orderTotalAmount})}return"page"===P&&C&&u({error:e.error,paymentItems:E,paymentResultViewModel:C,toastInfo:{status:"failed",failureReason:$}}),null==Q||null==(a=Q.error)||a.call(Q,$),{ok:!1,error:e.error,message:$,response:O,kind:z?"backend-rejected":(null==(n=e.error)?void 0:n.kind)||"unknown"}});o3(async e=>{var t,l;if(!(null==R?void 0:R.syncPaymentsToOrder)){let e=Error("BaseSales syncPaymentsToOrder is not available");return console.error("[PaymentModal] Sales checkout submit failed",e),null==Q||null==(t=Q.error)||t.call(Q,e.message),{ok:!1,error:e,message:e.message,kind:"missing-api"}}let i=await th();try{let t=await (null==(l=R.syncPaymentsToOrder)?void 0:l.call(R,{payments:i,paymentStatus:"paid",submitWhenPaid:!0,smallTicketDataFlag:1}));if(!(null==e?void 0:e.handleResult))return{ok:!0,syncResult:t};return tf({syncResult:t,payments:i,changeGivenAmount:null==e?void 0:e.changeGivenAmount,rollbackPaymentIdentity:null==e?void 0:e.rollbackPaymentIdentity})}catch(t){if(!(null==e?void 0:e.handleResult))return{ok:!1,error:t,message:t instanceof Error?t.message:String(t),kind:(null==t?void 0:t.kind)||"unknown"};return tb({error:t,payments:i,changeGivenAmount:null==e?void 0:e.changeGivenAmount,rollbackPaymentIdentity:null==e?void 0:e.rollbackPaymentIdentity})}});let tx=o3(async()=>{var e;let t=await th();await (null==R||null==(e=R.syncPaymentsToOrder)?void 0:e.call(R,{payments:t,paymentStatus:"paid",submitWhenPaid:!0,smallTicketDataFlag:1}))});(0,eC.useEffect)(()=>{if(!(null==R?void 0:R.effectsOn)||!c)return;let e=R.effectsOn("onPaymentSyncStart",()=>{var e;eG(!0),null==Q||null==(e=Q.loading)||e.call(Q,"",0)}),t=R.effectsOn("onPaymentSyncEnd",async e=>{var t,l,i,a,n,r;try{null==(a=window)||null==(i=a.app)||i.applicationManager.get("global").runFunction("sendCommand",{app:null==(l=window)?void 0:l.app,command:"payment_result",params:e})}catch(e){}null==Q||null==(t=Q.hide)||t.call(Q),eG(!1);let o=Array.isArray(null==e?void 0:e.payments)?e.payments:[];if(null==e?void 0:e.ok){if((null==e||null==(n=e.syncResult)?void 0:n.isDepositFullyPaid)&&!(null==e||null==(r=e.syncResult)?void 0:r.isOrderFullyPaid))return;await tf({syncResult:e.syncResult,payments:o,changeGivenAmount:tg(o)});return}await tb({error:(null==e?void 0:e.error)||Error(eL.getText("pisell2.checkout.order-sync-failed")),payments:o,changeGivenAmount:tg(o)})}),l=R.effectsOn("onDepositPaymentSyncEnd",async e=>{var t;null==Q||null==(t=Q.hide)||t.call(Q),eG(!1);let l=Array.isArray(null==e?void 0:e.payments)?e.payments:[];(null==e?void 0:e.ok)&&await ty({syncResult:e.syncResult,payments:l,depositAmount:null==e?void 0:e.depositAmount,changeGivenAmount:tg(l)})});return()=>{var i;null==e||e(),null==t||t(),null==l||l(),null==Q||null==(i=Q.hide)||i.call(Q),eG(!1)}},[R,c,Q,tg,tf,ty,tb]);let tk=e=>{var t;let l,i=Number(e);return!!Number.isFinite(i)&&!!(i>0)||(l=eL.getText("pisell2.checkout.payment.invalid-positive-amount")||"Please pay an amount greater than 0",(null==Q?void 0:Q.fail)?Q.fail(l):null==Q||null==(t=Q.error)||t.call(Q,l),!1)},t_=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=e4H(R),i=new lz(eF((null==l?void 0:l.remainingAmount)??"0")),a=new lz(e||0).minus(t||0);return!(i.lte(0)||a.lte(0)||a.gt(i.plus("0.01")))||(tu(),!1)},tw=o3(async()=>{let e=await th();return ez(e),e}),tS=o3(async function(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof(null==R?void 0:R.deleteOrderPayment))throw Error("当前订单不支持删除 EFTPOS 待确认支付项,请重启 APP 后再试");if(R.deleteOrderPayment(e),await tw(),!1===l.persistDraft)return;let i=await (null==R||null==(t=R.saveSalesOrderDraft)?void 0:t.call(R));if(e4J(i))throw Error(e4X(i)||eL.getText("pisell2.checkout.order-sync-failed")||"EFTPOS 待确认支付项保存失败,请重试")}),tj=o3(async(e,t)=>{var l,i,a,n,r,o;if(!tk(t))return null;let s="",d=!1,c=[];null==Q||null==(l=Q.loading)||l.call(Q,"",0);try{if("function"!=typeof(null==R?void 0:R.addOrderPaymentAsync)&&"function"!=typeof(null==R?void 0:R.addOrderPayment)||"function"!=typeof(null==R?void 0:R.saveSalesOrderDraft))throw Error(eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");c=await th();let l=await e4W(R,{amount:t,code:e.code,custom_payment_id:e.id,name:e.name,custom_payment_type:e.type,voucher_id:"",service_charge:(null==e?void 0:e.is_surcharge)&&((null==e?void 0:e.fixed)!==void 0||(null==e?void 0:e.percentage)!==void 0)?{amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"}:{},status:"payment_pending",metadata:{transactions:[]}});d=!0,Array.isArray(l)&&ez(l);let n=Array.isArray(l)?l[l.length-1]:void 0;if(!(s=String((null==n?void 0:n.payment_number)||"").trim()))throw Error("EFTPOS 待确认支付项缺少 payment_number,请重启 APP 后再试");let r=await (null==R||null==(i=R.saveSalesOrderDraft)?void 0:i.call(R));if(e4J(r))throw Error(e4X(r)||eL.getText("pisell2.checkout.order-sync-failed")||"EFTPOS 待确认支付项保存失败,请重试");return null==Q||null==(a=Q.hide)||a.call(Q),{paymentNumber:s,draftResult:r}}catch(t){if(d)try{s?await tS(s,{persistDraft:!1}):"function"==typeof(null==R?void 0:R.setOrderPayments)&&(R.setOrderPayments(c),await tw())}catch(e){console.error("Failed to rollback pending EFTPOS payment:",e)}let e=t instanceof Error?t.message:String(t);return null==e6||null==(n=e6.addLog)||n.call(e6,{type:"error",title:"EFTPOS pending payment draft failed",metadata:{error:e,paymentNumber:s}}),null==Q||null==(r=Q.hide)||r.call(Q),null==Q||null==(o=Q.error)||o.call(Q,e),null}}),tN=o3(async e=>{var t,l;let i=null==(t=e.transactionNumber)?void 0:t.trim();if(!i)throw Error("EFTPOS 回调缺少交易号,支付项保持待确认状态");let a={...e.updates||{},status:"paid",metadata:{...(null==(l=e.updates)?void 0:l.metadata)||{},unique_payment_number:i,transactions:[{number:i,status:"success"}]}};if("function"!=typeof(null==R?void 0:R.updateOrderPayment))throw Error("当前订单不支持更新 EFTPOS 支付状态,请重启 APP 后再试");let n=await R.updateOrderPayment(e.paymentNumber,a,{persistDraft:!0,submitWhenPaid:!0});return Array.isArray(null==n?void 0:n.payments)?ez(n.payments):await tw(),null==B||B(!0),n}),tC=o3((e,t)=>{var l,i;let a=e instanceof Error?e.message:String(e);null==e6||null==(l=e6.addLog)||l.call(e6,{type:"error",title:"EFTPOS payment update failed",metadata:{error:a,paymentNumber:t}}),null==Q||null==(i=Q.error)||i.call(Q,a)}),tM=async e=>{var t,l,i,a;let n=tt("cash");if(n)try{if(!tk(e.amount)||!await to()||!n.isActive()||!t_(e.amount,e.roundingAmount))return;let i=(null==W?void 0:W("channel"))||"pos",a=`cash-${Date.now()}-${Math.random().toString(16).slice(2)}`,r=eu.find(e=>{var t,l;return((null==(t=e.name)?void 0:t.toLowerCase().includes("cash"))||/现金|現金/i.test(e.name))&&(null==(l=e.channel_application)?void 0:l.includes(i))});eWZ(e6,W,"cash-local-add",()=>({paymentChannel:ex,currentChannel:i,osKey:eb,...eWQ(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,paymentMethodId:null==r?void 0:r.id,paymentMethodCode:null==r?void 0:r.code,uniquePaymentNumber:a})),null==e6||e6.addLog({type:"info",title:"open_till",metadata:{}}),null==G||null==(l=G.utils)||null==(t=l.postMessageToApp)||t.call(l,{module:"till",key:"open_till",data:{type:"cash"}}),null==B||B(!0),await e4W(R,{amount:e.amount,code:null==r?void 0:r.code,custom_payment_id:null==r?void 0:r.id,name:null==r?void 0:r.name,custom_payment_type:null==r?void 0:r.type,voucher_id:0,rounding_amount:e.roundingAmount,metadata:{unique_payment_number:a,actual_paid_amount:e.actual_paid_amount??e.amount,change_given_amount:e.change||0}})}catch(l){let t=l instanceof Error?l.message:String(l);null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"Cash payment failed",metadata:{error:t,result:e}}),null==Q||null==(a=Q.error)||a.call(Q,t)}finally{n()}},tT=e=>{if("string"==typeof e){let t=e.match(/\d+(?:\.\d+)?/);return t?t[0]:void 0}return"number"==typeof e?String(e):e},tI=(null==(o=H.appHelper.utils)||null==(r=o.getApp)?void 0:r.call(o)).getPlugin("screenProtector"),tP=async e=>{var t,l,i,a,n,r,o,s,d,c,u,m,g,h,v,f,y,b,x,k,_,w,S,j,N,C,M,T,I;let P;if(eK)return;if(eA2()){null==Q||null==(t=Q.info)||t.call(Q,eL.getText("payment.processing"));return}let A=ePg.includes((null==e?void 0:e.code)||""),D=A?eA1():null;if(A&&!D)return;let E=tt(`payment:${(null==e?void 0:e.code)||"unknown"}`);if(!E){null==D||D.release();return}let O=()=>{try{E()}finally{null==D||D.release()}};O.isActive=()=>((null==D?void 0:D.isActive())??!0)&&E.isActive();let z=!1,L=!1,$=e=>{let t;return function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t??(t=Promise.resolve().then(async()=>{let t=null==P?void 0:P.hold();try{await e(...i)}finally{try{null==t||t(),await (null==P?void 0:P.release())}finally{O()}}})),t}};try{let{id:t,code:T,name:I,type:A}=e||{},D=e.totalAmount??eq;if(!await to()||!O.isActive()||!t_(eq))return;let E=ePm.includes(T||""),q=ePg.includes(T||"");if(E||q){if(eS.current=P=ew(),await P.pause(),!P.isActive()||!O.isActive())return;null==R||null==(l=R.ensureOrderCreatedAt)||l.call(R);let j=q?"mx51":"eftpos",N=null==(a=H.appHelper.utils)||null==(i=a.getApp)?void 0:i.call(a),C=!!(null==H||null==(s=H.appHelper)||null==(o=s.utils)||null==(r=o.businessUtils)||null==(n=r.isPiPaymentEnabled)?void 0:n.call(r)),M=ePy((null==e?void 0:e.code)||"",C),E=!!M;if(!E&&q){null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_start_spi",metadata:{timestamp:Date.now()}});let l=await tj(e,D);if(!l)return;let{paymentNumber:i,draftResult:a}=l;if(!P.isActive())return void await tS(i);let n=(null==R||null==(v=R.getOrderIdentity)||null==(h=v.call(R))?void 0:h.externalSaleNumber)||(null==(f=e4V(a))?void 0:f.external_sale_number),r=null==R||null==(b=R.getOrderIdentity)||null==(y=b.call(R))?void 0:y.orderId,o=ec.current;if(!o)return void await tS(i);let s=await o.onPay(j,{isActive:()=>O.isActive()&&!!(null==P?void 0:P.isActive()),source:"normal",data:{payMethod:{id:t,code:T,name:I,type:A},params:{salesId:n,orderId:r,paymentNumber:i,symbol:W("shop_symbol"),amount:D,surcharge:tT(e.surcharge)},mode:"pay"},callback:$(async l=>{let{status:a,data:n,msg:r}=l;if((null==n?void 0:n.action)==="cancel_order"){await tS(i),p(!0);return}if("success"!==a)return;let o={amount:Number(null==n?void 0:n.amount),code:T,custom_payment_id:t,name:I,custom_payment_type:A,voucher_id:"",service_charge:{},metadata:{unique_payment_number:null==n?void 0:n.uniquePaymentNumber}};Number((null==n?void 0:n.surcharge)||0)!==Number((null==e?void 0:e.surcharge)||0)?o.service_charge={amount:(null==n?void 0:n.surcharge)||"0",percentage:"0"}:o.service_charge={amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"},tk(o.amount)&&(null==B||B(!0),await tN({paymentNumber:i,transactionNumber:null==n?void 0:n.uniquePaymentNumber,updates:o}))})});s||await tS(i),z=s;return}if(!E){let l=JSON.parse((null==N||null==(k=N.storage)||null==(x=k.getStorage)?void 0:x.call(k,"account"))||"{}"),i=null==R||null==(w=R.getOrderIdentity)||null==(_=w.call(R))?void 0:_.orderId;if(!i||"string"==typeof i&&i.startsWith("LOCAL_")){let e;null==Q||null==(S=Q.loading)||S.call(Q,"",0);try{e=await e4Z(R)}catch(e){null==Q||Q.error(e instanceof Error?e.message:eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null==e?void 0:e.success)||e4J(null==e?void 0:e.response)){null==Q||Q.error(e4X(null==e?void 0:e.response)||eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(i=e40(null==e?void 0:e.response))){null==Q||Q.error(eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}}null==Q||Q.hide();let a=ec.current;if(!a||!P.isActive())return;z=await a.onPay(j,{isActive:()=>O.isActive()&&!!(null==P?void 0:P.isActive()),source:"normal",data:{payMethod:{id:t,code:T,name:I,type:A},params:{orderId:i,symbol:W("shop_symbol"),amount:D,surcharge:tT(e.surcharge),operator_id:null==l?void 0:l.id,operator_type:"shop",platform:ex||"pos"},mode:"pay"},callback:$(async e=>{let{status:l,data:i,msg:a}=e;if("success"!==l)return;let n={amount:D,code:T,custom_payment_id:t,name:I,custom_payment_type:A,voucher_id:"",service_charge:{percentage:null==i?void 0:i.surPercentRate,amount:null==i?void 0:i.surMoney},metadata:{unique_payment_number:null==i?void 0:i.uniquePaymentNumber,manual_marking_flag:null==i?void 0:i.manual_marking_flag}};tk(n.amount)&&(null==B||B(!0),await e4W(R,n))})});return}null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_start",metadata:{timestamp:Date.now()}});let L=await tj(e,D);if(!L)return;let{paymentNumber:V,draftResult:U}=L,Y=(null==R||null==(c=R.getOrderIdentity)||null==(d=c.call(R))?void 0:d.externalSaleNumber)||(null==(u=e4V(U))?void 0:u.external_sale_number),K=JSON.parse((null==N||null==(g=N.storage)||null==(m=g.getStorage)?void 0:m.call(g,"account"))||"{}"),G=eAW({baseSales:R,salesId:String(Y||""),paymentNumber:V});if(!Y||!ec.current){if(Y)await G.finalize();else throw Error("支付草稿缺少订单标识,请刷新订单后重试");return}if(!O.isActive()||!P.isActive())return void await G.finalize();null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_end",metadata:{timestamp:Date.now()}}),ec.current.openPi({provider:M,mode:"pay",amount:D,salesId:String(Y),paymentNumber:V,currency:W("shop_symbol"),deviceNumber:F,metadata:{payMethod:{id:t,code:T,name:I,type:A},symbol:W("shop_symbol"),payment_number:V},operator:{id:null==K?void 0:K.id,type:"shop"},..."kiosk"===ex?{slots:{failed:(0,eH.jsx)(eT.Button,{block:!0,type:"primary",className:"pi-payment-action-button",onClick:()=>p(!0,!1,"start-new-order"),style:{marginTop:"10px"},children:eL.getText("order.start-new-order")})}}:{},platform:ex||"pos",usageScene:ePp.includes(ex)?"merchant":"user",onChange:async e=>{if(!G.observe(e))return;let t=null==P?void 0:P.hold(),l="success"===e.type||"closed"===e.type||"printOnTimeout"===e.type;try{var i,a,n,r,o;let t=e.transactionNumber;if("printOnTimeout"===e.type){if(await e4G(R,{confirmPendingVoucherPayments:!0}),!(null==R?void 0:R.printLocalOrderReceipt))return;null==e6||null==(i=e6.addLog)||i.call(e6,{type:"info",title:"eftpos支付异常,请求本地打印小票"});try{let e=await R.printLocalOrderReceipt();null==e6||null==(a=e6.addLog)||a.call(e6,{type:"info",title:"eftpos支付异常,请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==e6||null==(n=e6.addLog)||n.call(e6,{type:"error",title:"eftpos支付异常,请求本地打印小票失败",metadata:{error:e instanceof Error?e.message:String(e)}})}p(!0),N.history.replace("/home")}if("success"===e.type||"failed"===e.type){if("success"!==e.type)return;let l=e.amount||D,i={percentage:(null==(r=e.surcharge)?void 0:r.ratePercent)?new lz(e.surcharge.ratePercent).div(100).toString():void 0,amount:null==(o=e.surcharge)?void 0:o.fixedAmount},a={amount:l,service_charge:i,service_fee:function(e,t){if(t)try{return new lz(e||0).times(t.percentage||0).plus(t.amount||0).toDecimalPlaces(2).toFixed(2)}catch{return}}(l,i),metadata:{manual_marking_flag:e.manuallyConfirmed?1:void 0,card_reader_snapshot:e.readerSnapshot}};await tN({paymentNumber:V,transactionNumber:t,updates:a});return}"closed"===e.type&&(await G.finalize(),await tw())}catch(e){tC(e,V)}finally{null==t||t(),l&&(await (null==P?void 0:P.release()),O())}}})?z=!0:(await G.finalize(),await tw())}else{await (null==tI||null==(j=tI.pauseIdleTimer)?void 0:j.call(tI)),L=!0;let t=null;if(((null==e?void 0:e.fixed)||(null==e?void 0:e.percentage))&&(t={amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"}),!tk(D))return;"custom"===e.type&&(null==(N=e.metadata)?void 0:N.order_open_cash_drawer)&&(null==e6||e6.addLog({type:"info",title:"open_till",metadata:{}}),null==G||null==(M=G.utils)||null==(C=M.postMessageToApp)||C.call(M,{module:"till",key:"open_till",data:{type:"cash"}})),null==B||B(!0),eWZ(e6,W,"method-local-add",()=>({paymentChannel:ex,osKey:eb,...eWQ(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,paymentMethodId:e.id,paymentMethodCode:e.code,paymentMethodType:e.type})),await e4W(R,{amount:D,code:e.code,custom_payment_id:e.id,name:e.name,custom_payment_type:e.type,voucher_id:0,service_charge:t,..."custom"===e.type?{metadata:{unique_payment_number:`custom-${Date.now()}-${Math.random().toString(16).slice(2)}`}}:{}})}}catch(e){null==Q||null==(T=Q.error)||T.call(Q,e instanceof Error?e.message:String(e))}finally{if(L)try{await (null==tI||null==(I=tI.resumeIdleTimer)?void 0:I.call(tI))}catch(e){console.warn("[Payment] resume screen protector failed",e)}if(!z)try{await (null==P?void 0:P.release())}finally{O()}}};(0,eC.useEffect)(()=>{var e,t,l,i,a;if(R&&d&&c)try{null===X.current&&(eE.current=e4B(R,d));let a=e4H(R),n=(null==a?void 0:a.remainingAmount)??(null==R||null==(t=R.getOrderAmountSnapshot)||null==(e=t.call(R))?void 0:e.amountGap)??ee??"0";if(n){et(n),ei(n),en(d.totalAmount||"0");let e=null==R||null==(l=R.getTempOrderNote)?void 0:l.call(R);e?f(e):(null==s||null==(i=s.order_info)?void 0:i.order_note)&&f(s.order_info.order_note)}}catch(e){console.warn("Failed to get initial custom amount:",e)}R&&c&&Promise.resolve((null==R||null==(a=R.getOrderPayments)?void 0:a.call(R))||[]).then(e=>{ez(e)})},[R,d,c]),(0,eC.useEffect)(()=>{if(!R||!c)return void eg(!1);let e=!1;return eg(!1),R.getPaymentMethodsAsync().then(async t=>{if(e)return;let l=await ePN(t,G);if(e)return;ep(l),eg(!0);let i=t.some(e=>{var t;return"CASHMANUAL"===e.code||/现金|現金/i.test(e.name)||/cash/i.test(e.name)&&(null==(t=e.channel_application)?void 0:t.includes(ex))});ev(i),null==_||_(i),i||ey(eL.getText("pisell2.checkout.payment.select-payment")||"Select Payment")}),()=>{e=!0}},[R,G,c,_,ex]),(0,eC.useEffect)(()=>{if(eq&&R&&tl&&d&&c)try{let e;eo([e=Number(eq||0),10*Math.ceil(e/10),20*Math.ceil(e/20)].filter((e,t,l)=>e>0&&l.indexOf(e)===t))}catch(e){console.warn("Failed to get recommended amounts:",e)}},[eq,R,tl,d]);let tA=(0,eC.useCallback)(async e=>{if(R)try{et(e)}catch(e){console.error("Failed to set custom amount:",e)}},[R]),tD=(0,eC.useCallback)(async e=>{if(R)try{if(e){var t;let e=e4F(eE.current)||e4F(e4B(R,d))||e4q(null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),d);eE.current=e}X.current=e,await e43(R,!!+!!e,eE.current),tu()}catch(e){console.error("Failed to update deposit status:",e)}},[R,tu]),tE=(0,eC.useCallback)(async e=>{if(R)try{await e48(R,e),eE.current=e,tu()}catch(e){console.error("Failed to update deposit amount:",e)}},[R]),[tO,tz]=(0,eC.useState)(!1),tL=async e=>{if("cancel"===e)return;let t=tt("wallet-confirm");if(!t)return;let l=!0;tz(!0);try{if(!await to()||!t.isActive())return;"save-without-deduct"===e&&(l=!1,await ts());let n=l?await e4Q(R):await e4G(R,{confirmPendingVoucherPayments:!1});if(n.success&&await tv(n),await (null==w?void 0:w({...n})),n.success){var i,a;let e=e4H(R),t=(null==n||null==(a=n.response)||null==(i=a.data)?void 0:i.order_id)||(null==n?void 0:n.orderId);if(null==T||T(t),(null==n?void 0:n.is_deposit)&&e&&Number(e.depositAmount)<Number(e.totalAmount)){null==M||M(e);return}p(!0)}}catch(e){console.error("Failed to submit base sales order:",e)}finally{tz(!1),t()}},tR=(0,eC.useCallback)(async e=>{if("cancel"===e||!await to())return;let t=!0;"apply-deduct-now"===e?await e4U(R):"save-without-deduct"===e&&(t=!1,await ts()),R&&(await e4G(R,{confirmPendingVoucherPayments:t}),p(!0))},[ts,R,p,to]),t$={showCustomerModule:(null==I?void 0:I.showCustomerModule)??!0,showCustomerSelect:(null==I?void 0:I.showCustomerSelect)??!0,showWalletPass:(null==I?void 0:I.showWalletPass)??tc.isShow,showCashPayment:(null==I?void 0:I.showCashPayment)??(null==k?void 0:k.showCashPayment)??!0,showAdditionalModule:(null==I?void 0:I.showAdditionalModule)??!0,showPaymentOptions:(null==I?void 0:I.showPaymentOptions)??!0},tF=t$.showCashPayment&&eh,tq=(0,eC.useRef)();(0,eC.useEffect)(()=>{if(!c){tq.current=void 0;return}if(em)try{let e={paymentChannel:ex,dataChannel:(null==W?void 0:W("channel"))??null,osKey:eb,...eWQ(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,showCashPayment:tF,showCustomerSelect:t$.showCustomerSelect,showPaymentType:(null==I?void 0:I.showPaymentType)!==!1,directCustomPayment:(null==I?void 0:I.directCustomPayment)===!0},t=JSON.stringify(e);if(tq.current===t)return;tq.current=t,eWZ(e6,W,"ui-ready",()=>e)}catch{}});let tB=(null==I?void 0:I.paymentOptionsColumnCount)??(tF?1:2),tH="kiosk"===ex&&(eK||ek.isScanProcessing||ek.isPaymentProcessing),tV=o3(async e=>{if(eD.current)return"kiosk"!==ex?eD.current.handleSearchIdentificationCode(e):eD.current.handleSearchIdentificationCode(e,{waitForApply:!0})});(0,eC.useEffect)(()=>{let e=!1;return(async()=>{var t,l,i,a;if(!R)return e8(void 0);let n=null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),r=null==n||null==(l=n.summary)?void 0:l.product_expect_amount;try{let e=await (null==(i=R.getSummary)?void 0:i.call(R));r=(null==e?void 0:e.product_expect_amount)??(null==e||null==(a=e.summary)?void 0:a.product_expect_amount)??r}catch(e){console.error("Failed to read BaseSales summary:",e)}e||e8(r)})(),()=>{e=!0}},[R,e0,null==d?void 0:d.totalAmount,ea]);let tU=(0,eC.useMemo)(()=>Number(e3??E??(null==d?void 0:d.totalAmount)??0),[e3,E,null==d?void 0:d.totalAmount]),tY=(0,eC.useMemo)(()=>new lz(tU).minus(A||0).toNumber(),[A,tU]),tW=o3(async e=>{var t,l,i,a,n,r,o;if("shared"===$){ez((null==R||null==(t=R.getOrderPayments)?void 0:t.call(R))||[]),tu(),eD.current&&eW(eD.current.getWalletPassData(e));return}if(tc.isShow){let t=[],s=(null==R||null==(l=R.getOrderPayments)?void 0:l.call(R))||[],d=(null==(n=eD.current)||null==(a=n.getWalletPassData)||null==(i=a.call(n,e))?void 0:i.selectedWallet)||[];if(e.forEach(e=>{let l=e.code?ePu[e.code]:null;if(l&&tc.map[l]){let i=tc.map[l],a="payment_pending",n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,l=arguments.length>2?arguments[2]:void 0;return e.find(e=>(null==e?void 0:e.voucher_id)!==void 0&&0!==Number(e.voucher_id||0)&&String(e.voucher_id)===String(t)&&String(e.status||"")===String(l||""))}(s,e.voucher_id,a),r=d.find(t=>{var l;return String((null==t?void 0:t.id)??(null==t||null==(l=t.originData)?void 0:l.id))===String(e.voucher_id)}),o=(null==r?void 0:r.originData)||r||e,c=e4z({currencyAmount:e.amount,walletPassUsageUnit:e.wallet_pass_usage_unit});t.push({...n,amount:e.amount,code:null==i?void 0:i.code,id:Number(null==i?void 0:i.id)||0,name:null==i?void 0:i.name,type:null==i?void 0:i.type,status:a,custom_payment_id:Number(null==i?void 0:i.id)||0,voucher_id:e.voucher_id,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:c,fund_record:function(e){var t,l;let{item:i,originData:a,paymentMethod:n}=e,r="point_card"===i.code||(null==a?void 0:a.tag)==="point_card"||(null==n?void 0:n.code)==="POINTCARD",o=(null==a?void 0:a.balance_par_value)??(null==a?void 0:a.balance)??(null==a?void 0:a.using_before_value)??0,s=i.wallet_pass_use_value??e4z({currencyAmount:i.amount,walletPassUsageUnit:i.wallet_pass_usage_unit}),d=r?s:i.amount,c=(()=>{try{return new lz(o||0).minus(d||0)}catch{return new lz(0)}})();return{voucher_id:i.voucher_id,wallet_pass_name:(t=(null==a?void 0:a.wallet_pass_name)||(null==a?void 0:a.format_title)||(null==a?void 0:a.product_name),l=null==n?void 0:n.name,t&&"object"==typeof t&&!eM().isValidElement(t)?t:{default:t||l||""}),code:(null==a?void 0:a.code)||i.code,encoded:null==a?void 0:a.encoded,using_before_value:e4L(o),using_after_value:e4L(c)}}({item:{...e,wallet_pass_use_value:c},originData:o,paymentMethod:i})})}}),null==e6||e6.addLog({type:"info",title:"handleSelectWalletChange BaseSales updateVoucherOrderPayments",metadata:{voucherItems:t,select:e}}),"function"!=typeof(null==R?void 0:R.updateVoucherOrderPaymentsAsync)&&"function"!=typeof(null==R?void 0:R.updateVoucherOrderPayments)){null==e6||null==(o=e6.addLog)||o.call(e6,{type:"error",title:"BaseSales updateVoucherOrderPayments is not available",metadata:{voucherItems:t,select:e}});return}await e4K(R,t,{status:"payment_pending"}),ez((null==(r=R.getOrderPayments)?void 0:r.call(R))||[]),tu(),eD.current&&eW(eD.current.getWalletPassData(e))}}),tK=o3(e=>{if(tu(),eD.current){let t=eD.current.getWalletPassData([]);eW(l=>{var i;return{...l,availableDiscountList:t.availableDiscountList,selectedDiscountList:(null==e||null==(i=e.discountList)?void 0:i.filter(e=>e.isSelected&&!e.isEditMode).map(e=>e.id))||t.selectedDiscountList}})}}),tG=async e=>{if(!e1)return void e2(!1);try{if(R&&(null==d?void 0:d.totalAmount)){var t;await (null==(t=R.updateTempOrderShopDiscount)?void 0:t.call(R,e)),null==O||O(e),await R.getSummary();let l=e4H(R);l&&(null==M||M(l),ei((null==l?void 0:l.remainingAmount)||"0"),en((null==l?void 0:l.totalAmount)||"0"),et((null==l?void 0:l.remainingAmount)||"0"))}}catch(e){console.error("Failed to adjust price:",e)}e2(!1)},tQ=o3(async()=>{var e;if(!e1)return;if(!(null==d?void 0:d.totalAmount)){null==Q||Q.fail(eL.getText("pisell2.checkout.manual-discount.no-amount"));return}let t=await Promise.resolve((null==R||null==(e=R.getOrderPayments)?void 0:e.call(R))||[]);if(null==t?void 0:t.length){null==Q||Q.fail(eL.getText("pisell2.checkout.manual-discount.has-payment-items"));return}if(0>=Number(eq)&&Number(null==d?void 0:d.totalAmount)>=0){null==Q||Q.fail(eL.getText("pisell2.checkout.manual-discount.no-amount"));return}e2(!0)}),tZ=async e=>{var t,l,i,a;switch(e){case"order-note":b(!0);break;case"send-link":eX(!0);break;case"split-payment":ed(!0);break;case"print-receipt":if(!(null==R?void 0:R.printLocalOrderReceipt))return;null==e6||null==(t=e6.addLog)||t.call(e6,{type:"info",title:"支付弹窗请求本地打印小票"});try{let e=await R.printLocalOrderReceipt();null==e6||null==(l=e6.addLog)||l.call(e6,{type:"info",title:"支付弹窗请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"支付弹窗请求本地打印小票失败",metadata:{error:e instanceof Error?e.message:String(e)}})}break;case"manual-discount":await e4("discount",tQ);break;case"save-pay-later":null==(a=J.current)||a.handleSavePayLaterClick()}};(0,eC.useImperativeHandle)(t,()=>({handleButtonClick:tZ,getSyncingLock:()=>eK,retryPaymentSync:tx}),[tZ,tx,eK]);let tJ=()=>{var e;let t=e=>null!=e&&""!==String(e).trim()?String(e).trim():null,l=t(null==td?void 0:td.display_name)||t(null==td?void 0:td.name)||eL.getText("pisell2.checkout.customer.default-name")||"Customer";return{id:(null==td?void 0:td.id)??(null==td?void 0:td.customer_id),nickname:(null==td?void 0:td.nickname)||eL.getText("pisell2.checkout.customer.default-name"),display_name:l,email:(null==td?void 0:td.email)||(null==td||null==(e=td.contacts)?void 0:e.email)||""}},tX=async e=>{var t,l,i,a,n,r,o;let s;if(!await to())return;let d=null==R||null==(l=R.getOrderIdentity)||null==(t=l.call(R))?void 0:t.orderId;await ts(),null==Q||null==(i=Q.loading)||i.call(Q,"",0);try{s=await e4Z(R,{confirmPendingVoucherPayments:!1})}catch(e){null==Q||Q.error(e instanceof Error?e.message:eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null==s?void 0:s.success)||e4J(null==s?void 0:s.response)){null==Q||Q.error(e4X(null==s?void 0:s.response)||eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null!=(o=d=e40(null==s?void 0:s.response)||(null==R||null==(n=R.getOrderIdentity)||null==(a=n.call(R))?void 0:a.orderId)||d)&&""!==String(o).trim()&&!("string"==typeof o&&/^LOCAL_/i.test(o.trim())))){null==Q||Q.error(eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}null==Q||null==(r=Q.hide)||r.call(Q);let c=await R.sendCustomerPayLink({emails:e.emails,order_ids:[d]});c.success||c.status?(null==Q||Q.success(eL.getText("pisell2.checkout.send-payment-link.success")),setTimeout(()=>{null==p||p(!0)},1e3)):null==Q||Q.error(c.message||eL.getText("pisell2.checkout.send-payment-link.error"))},t0=(0,eC.useCallback)(e=>{eI.current=!0,eA(e??null),eW({selectedWallet:[],availableDiscountList:[],selectedDiscountList:[]}),ts().then(async()=>{var e,t;"shared"===$&&await (null==R||null==(t=R.refreshWalletAssets)?void 0:t.call(R,{preserveSelection:!1})),ez((null==R||null==(e=R.getOrderPayments)?void 0:e.call(R))||[]),tu()}).catch(e=>{console.error("Failed to clear wallet pass payments:",e)});let t=e4H(R);t&&(null==M||M(t),ei(t.remainingAmount||"0"),en(t.totalAmount||"0"),et(t.remainingAmount||"0"))},[ts,R,tu,M,$]),t2=(0,eC.useMemo)(()=>({disabledSwitch:(null==I?void 0:I.disabledSwitchClient)||!!R&&eV.isCustomerChangeLocked}),[R,I,eV.isCustomerChangeLocked]),t1=(0,eC.useCallback)(async e=>{var t;return await (null==R||null==(t=R.roundAmount)?void 0:t.call(R,{amount:e}))},[R]),t4=(0,eC.useCallback)(e=>{"modal"!==P&&Kl.clearAll()},[]);return(0,eH.jsxs)("div",{ref:Z,...{onClick:t4},style:{...e4N,maxHeight:S},children:[(t$.showCustomerModule||t$.showCustomerSelect||t$.showWalletPass)&&(0,eH.jsxs)("div",{style:{padding:"12px 16px",border:"1px solid #d0d5dd",borderRadius:8},children:[(t$.showCustomerModule||t$.showCustomerSelect)&&(0,eH.jsx)(e4T,{onClientChange:t0,clientInfo:td,onSearch:tV,baseSales:R,showCustomerSelect:t$.showCustomerSelect,...t2,beginScanActivity:"kiosk"===ex?e9:void 0}),t$.showWalletPass&&(0,eH.jsx)(e4v,{clientId:(null==td?void 0:td.id)??(null==td?void 0:td.customer_id),customAmount:el,orderInfo:d||void 0,ref:eD,paymentItems:eO,onSelectChange:tW,baseSales:R,onDiscountChange:tK,mode:$})]}),(0,eH.jsx)(e11,{amountSymbol:W("shop_symbol"),orderInfo:d||void 0,cartData:s,open_deposit:!!ti&&(null==I?void 0:I.enableDepositSwitch)!==!1,customAmount:ee,balanceDueAmount:el,paymentItems:eO,walletPassData:eY,clientInfo:D,onAmountChange:tA,onDepositStatusChange:tD,onDepositAmountChange:tE,onBalanceDueAmountClick:tZ,onConfirm:tL,confirmLoading:tO,totalAmount:x,baseSales:R,shouldUseNormalPayment:eU,enablePriceAdjust:e1,showPaymentType:(null==I?void 0:I.showPaymentType)!==!1}),(0,eH.jsxs)("div",{className:tF?"payment-grid-layout":"payment-flex-layout",children:[tF&&(0,eH.jsx)("div",{"aria-disabled":tH,style:{...tF?{gridColumn:"1",gridRow:(null==ej?void 0:ej.length)===1?"span 2":"1"}:{},...tH?{opacity:.6,pointerEvents:"none"}:{}},children:(0,eH.jsx)(eD1,{disabled:eZ,isModalOpen:c,syncingLock:eK||tH,amountSymbol:W("shop_symbol"),orderInfo:d||void 0,onPaymentComplete:tM,amountButtons:er,customAmount:eq,roundingFunction:t1,balanceDueAmount:eB,balanceDueTotalAmount:ea,shortcutsSize:(null==ej?void 0:ej.length)===3||(null==ej?void 0:ej.length)===1?"large":"default"})}),t$.showPaymentOptions&&(null==ej?void 0:ej.length)>0&&(0,eH.jsx)("div",{className:tF?"":"payment-options-module-container",style:tF?{gridColumn:"2",gridRow:(null==ej?void 0:ej.length)>3?"1 / 3":"1"}:{},children:(0,eH.jsx)(eWX,{amountSymbol:W("shop_symbol"),orderInfo:d||void 0,onClick:tP,paymentMethods:eu,customAmount:eq,title:ef,disabled:eZ||tH,showCashPayment:tF,channel:ex,columnCount:tB,sciSurchargeDisplayMap:eN,directCustomPayment:(null==I?void 0:I.directCustomPayment)===!0,isModalOpen:c,paymentMethodsReady:em,beginKioskPaymentActivity:tt,currentBaseSales:R,autoTriggerSinglePaymentOption:(null==I?void 0:I.autoTriggerSinglePaymentOption)===!0})}),t$.showAdditionalModule&&(0,eH.jsx)("div",{className:tF?"":"additional-module-container",style:tF?{gridColumn:(null==ej?void 0:ej.length)>3?"1":(null==ej?void 0:ej.length)<=1?"2":"span 2",gridRow:(null==ej?void 0:ej.length)===0?"1":"2"}:{},children:(0,eH.jsx)(e4y,{orderInfo:d||void 0,customAmount:eq,handleButtonClick:tZ,hasOrderNote:!!v&&v.trim().length>0,disabled:eZ,showCashPayment:tF,isFullWidth:!((null==ej?void 0:ej.length)>3||(null==ej?void 0:ej.length)<=1),showMore:!(tF&&(null==ej?void 0:ej.length)===0)})})]}),(0,eH.jsx)(eAJ,{ref:ec,baseSales:R,dynamicMaxHeight:S,isWebPos:!0}),eJ&&(0,eH.jsx)(e1Q,{balanceAmount:ee,customerEmail:tJ().email,customerName:tJ().display_name||tJ().nickname,customerId:tJ().id,onClose:()=>eX(!1),sendPaymentLink:tX}),e1&&(0,eH.jsx)(dU,{containerProps:{wrapClassName:"pisell-modal-mask-pointer-events-auto",renderType:"modal",open:e0,onCancel:()=>e2(!1)},tips:eL.getText("pisell2.checkout.modal.price-adjustment-tips")||"Changing amount will update order total",selectType:"dark",originalValue:tU,defaultValue:tY,resetText:eL.getText("pisell2.checkout.modal.reset-price-adjustment"),onEnter:tG}),tn.editor,(0,eH.jsx)(e14,{ref:J,amountSymbol:W("shop_symbol"),walletPassData:eY,onSavePayLater:tR}),(0,eH.jsx)(ePJ,{containerProps:{wrapClassName:"pisell-modal-mask-pointer-events-auto",renderType:"modal",open:es,onCancel:()=>ed(!1)},paymentOriginalValue:eB,paymentDefaultValue:String(eq||0),enableExceedMaxAmount:!1,payment:{enable:!0},surcharge:{enable:!1},surchargeDefaultValue:{percent:"0",fixed:"0"},selectType:"light",onChange:e=>{},doneText:eL.getText("confirm")||"确认",onPay:e=>{ed(!1);let t=Number(e.amount);if(!Number.isFinite(t)||t<=0){var l;null==Q||null==(l=Q.error)||l.call(Q,eL.getText("pisell2.checkout.split-payment.invalid-positive-amount"));return}tA(String(t))}})]})}),e45=e=>{var t,l,i,a,n,r,o,s;let{open:d,baseSales:c,baseSalesModuleName:u,walletPassMode:p="legacy",data:m,callback:g,onClose:h,onSetLocalOrderId:v,setEditCartMode:f,editOrderId:y,paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,variant:N,config:C={showHeaderCenter:!0,showHeaderRightButton:!0}}=e,M=e$();s2(W9,(null==(n=M.appHelper.utils)||null==(a=n.getApp)||null==(i=a.call(n))||null==(l=i.locales)||null==(t=l.getLocale)?void 0:t.call(l))||(null==(o=M.appHelper.utils)||null==(r=o.storage)?void 0:r.get("umi_locale"))||"en");let{getApp:T,pisellos:I,getData:P,interaction:A,isWebPos:D}=(null==M||null==(s=M.appHelper)?void 0:s.utils)||{},E=function(e){let{baseSales:t,pisellos:l,baseSalesModuleName:i}=e,[a,n]=(0,eC.useState)(0),r=(0,eC.useMemo)(()=>{var e;return t||i&&(null==l||null==(e=l.getModule)?void 0:e.call(l,i))||null},[i,l,t,a]),o=(0,eC.useMemo)(()=>e4I(()=>{var e;return(null==r||null==(e=r.getOrderSnapshot)?void 0:e.call(r))||null},null),[r,a]),s=o.value,d=(0,eC.useMemo)(()=>e4I(()=>{var e;return(null==r||null==(e=r.getOrderAmountSnapshot)?void 0:e.call(r))||(null==s?void 0:s.amount)||null},null),[r,s,a]),c=d.value,u=(0,eC.useMemo)(()=>e4I(()=>{var e,t;return(null==r||null==(e=r.getOrderPayments)?void 0:e.call(r))||(null==s||null==(t=s.tempOrder)?void 0:t.payments)||[]},[]),[r,s,a]),p=u.value,m=(0,eC.useCallback)(()=>{n(e=>e+1)},[]),g=o.error||d.error||u.error||(i&&!r?Error(`BaseSales module not found: ${i}`):null),h=(0,eC.useMemo)(()=>(function(e,t){var l,i,a,n,r,o,s;if(!e&&!t)return null;let d=(null==e?void 0:e.identity)||{},c=t||(null==e?void 0:e.amount)||{},u=(null==e?void 0:e.tempOrder)||{},p=(null==u||null==(l=u._extend)?void 0:l.customerSnapshot)||(null==u?void 0:u.customer)||(null==e?void 0:e.customer)||null,m=u.customer_id??(null==p?void 0:p.id)??(null==p?void 0:p.customer_id)??(null==e||null==(i=e.customer)?void 0:i.customerId),g=(null==p?void 0:p.display_name)||(null==p?void 0:p.name)||u.customer_name||(null==e||null==(a=e.customer)?void 0:a.customerName)||"";return{orderId:d.orderId||d.externalSaleNumber||d.orderNumber,status:null==e?void 0:e.status,...eEZ(c,u),paymentStatus:null==e?void 0:e.paymentStatus,itemCount:(null==e?void 0:e.productCount)||(null==e||null==(r=e.tempOrder)||null==(n=r.products)?void 0:n.length)||0,hasLocalOrderData:!!(null==e?void 0:e.tempOrder),customerId:m,customerName:g,customerPhone:(null==p?void 0:p.phone)||u.phone||(null==e||null==(o=e.customer)?void 0:o.phone)||"",customerEmail:(null==p?void 0:p.email)||u.email||(null==e||null==(s=e.customer)?void 0:s.email)||"",customerSnapshot:p}})(s,c),[s,c]);return{baseSales:r,orderSnapshot:s,amountSnapshot:c,paymentItems:p,orderInfo:h,error:g,refresh:m}}({baseSales:c,pisellos:I,baseSalesModuleName:u}),O=E.baseSales,z=!!u,[L,R]=(0,eC.useState)(null);(0,eC.useRef)(!1);let[$,F]=(0,eC.useState)(""),[q,B]=(0,eC.useState)([]),H=(0,eC.useRef)(!1),V=(0,eC.useRef)(null),[U,Y]=(0,eC.useState)(0),W=(0,eC.useMemo)(()=>Number((null==L?void 0:L.totalAmount)??U??0),[null==L?void 0:L.totalAmount,U]),[K,G]=(0,eC.useState)(!0),[Q,Z]=(0,eC.useState)(0),[J,X]=(0,eC.useState)(!1),[ee,et]=(0,eC.useState)(!1),[el,ei]=(0,eC.useState)(!1),[ea,en]=(0,eC.useState)(y||0),er=(0,nY.useToast)(),eo=d1(),es=eM().useRef(null);(0,eC.useEffect)(()=>{if(z){if(E.error){var e;null==er||null==(e=er.error)||e.call(er,E.error.message);return}if(E.orderInfo){let e=Number(E.orderInfo.totalAmount||0);R(e=>{var t,l,i,a;return(null==e?void 0:e.orderId)===(null==(t=E.orderInfo)?void 0:t.orderId)&&(null==e?void 0:e.totalAmount)===(null==(l=E.orderInfo)?void 0:l.totalAmount)&&(null==e?void 0:e.remainingAmount)===(null==(i=E.orderInfo)?void 0:i.remainingAmount)&&(null==e?void 0:e.paymentStatus)===(null==(a=E.orderInfo)?void 0:a.paymentStatus)?e:E.orderInfo}),Y(t=>t===e?t:e)}}},[z,E.error,E.orderInfo,er]);let ed=async()=>{if(!ee){et(!0);try{var e,t;await (null==(t=eA.current)||null==(e=t.retryPaymentSync)?void 0:e.call(t))}catch(e){console.error("PaymentModal retry payment sync failed",e)}finally{et(!1)}}};(0,eC.useEffect)(()=>{let e=()=>{"u">typeof window&&Z(window.innerHeight)};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[]),(0,eC.useEffect)(()=>{var e;let t=async()=>{try{var e,t;let l=await (null==A||null==(t=A.utils)||null==(e=t.asyncDataManager)?void 0:e.call(t,{module:"get",key:"till_button"}));l&&Kl.setTillButton(l)}catch(e){console.error("PaymentModal: Failed to get till_button from asyncDataManager:",e)}};(null==A||null==(e=A.utils)?void 0:e.asyncDataManager)&&t()},[A]),(0,eC.useEffect)(()=>{!d||H.current||V.current||(V.current=(async()=>{try{let e=await ePC(A);if(F(e),!e)return;let t=await ePM();B(t),H.current=!0}catch(e){console.warn("Failed to load checkout card readers:",e)}finally{V.current=null}})())},[A,d]);let ec=(0,eC.useMemo)(()=>"smallTablet"===N||"tablet"===N?{width:"98%",heightRatio:.98}:{width:880,heightRatio:.9},[N]),[eu,ep]=(0,eC.useState)(!1),em=(0,eC.useMemo)(()=>{if(0===Q)return"600px";let e=getComputedStyle(document.body).transform,t=1;return"none"!==e&&(t=new DOMMatrix(e).d),`${Math.floor(Q*ec.heightRatio/t)}px`},[Q,ec.heightRatio]),eg="phone"===N,eh=(0,eC.useMemo)(()=>"unset",[Q]),ev={showCashPayment:!0},ef=(0,eC.useCallback)(e=>{G(e)},[]),[ey,eb]=(0,eC.useState)(!1),[ex,ek]=(0,eC.useState)(""),[e_,ew]=(0,eC.useState)("payment-content"),eS=async e=>{var t,l,i,a;if("payment-result-toast"===e_){null==O||null==(l=O.getOrderIdentity)||null==(t=l.call(O))||t.orderId,O&&(null==(i=O.updateTempOrderNote)||i.call(O,e),ek(e),null==er||er.success(eL.getText("pisell2.checkout.order-note.updated-successfully"))),eb(!1),ew("payment-content");return}try{O&&(await (null==(a=O.updateTempOrderNote)?void 0:a.call(O,e)),ek(e),null==er||er.success(eL.getText("pisell2.checkout.order-note.updated-successfully"))),null==S||S(e)}catch(e){console.error("Failed to update order note:",e),null==er||er.error(eL.getText("pisell2.checkout.order-note.update-failed"))}eb(!1),ew("payment-content")},ej=async()=>{try{if(O){var e;await (null==(e=O.updateTempOrderNote)?void 0:e.call(O,"")),ek(""),null==er||er.success(eL.getText("pisell2.checkout.order-note.deleted-successfully"))}null==j||j()}catch(e){console.error("Failed to delete order note:",e),null==er||er.error(eL.getText("pisell2.checkout.order-note.delete-failed"))}eb(!1),ew("payment-content")},eN=(0,eC.useRef)(!1),eI=eM().useRef(!1),eP=eM().useRef(null),eA=eM().useRef(null),eD=()=>{try{var e;let t=(null==O||null==(e=O.getTempOrderNote)?void 0:e.call(O))||"";ek(t)}catch(e){console.warn("Failed to get temp order note:",e)}ew("payment-result-toast"),eb(!0)},eE=(e,t)=>{let l=eJ(),i=eL.formatLocale(l);try{let t=W9[i],l=null==t?void 0:t[e];if(l)return l}catch(e){console.error("本地语言包访问错误:",e)}return eL.getText(e)||t},eO=e=>{var t,l,i;let a={...es.current||{},...e||{}};if(es.current=a,(null==e?void 0:e.orderPrintPayload)&&(eP.current=e.orderPrintPayload),"page"===b&&(null==a||null==(t=a.paymentResultViewModel)?void 0:t.status)==="failed"&&!eI.current){eI.current=!0;let e=null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId;null==h||h(!1,{order_id:e,event:{type:"modal-close",status:"failed",reason:"sync-failed",orderId:e,reset:!1,shouldRefreshOrder:!1,shouldCloseCaller:!1,payload:{order_id:e,paymentResult:a},isChangePaymentNotIncludeVoucher:eu}})}},ez=()=>{null==g||g({type:"toast-close",isCallbackFromToast:!0,shouldRefreshOrder:!1,shouldCloseCaller:!1,isChangePaymentNotIncludeVoucher:eu})},eR=async(e,t,l)=>{var i,a,n,r,o;let s=(null==(a=eA.current)||null==(i=a.getSyncingLock)?void 0:i.call(a))||!1;if(s&&!t){null==eq||eq.addLog({type:"warning",title:"订单正在同步中,用户点击取消",metadata:{isSyncingLocked:s}});return}let d=null==O||null==(r=O.getOrderIdentity)||null==(n=r.call(O))?void 0:n.orderId,c="start-new-order"===l?Zd({type:"modal-close",status:"cancelled",reason:"start-new-order",orderId:(o={orderId:d,payload:{order_id:d,paymentResult:es.current},isChangePaymentNotIncludeVoucher:eu}).orderId,reset:!0,payload:o.payload,shouldRefreshOrder:!0,shouldCloseCaller:!0,isChangePaymentNotIncludeVoucher:o.isChangePaymentNotIncludeVoucher}):void 0;null==g||g(c||{status:"cancelled",order_id:d}),null==h||h(e||!1,{order_id:d,paymentResult:es.current,...c?{event:c}:{}})},eF=o3(async()=>{var e,t,l,i,a;let n=(null==(t=eA.current)||null==(e=t.getSyncingLock)?void 0:e.call(t))||!1;if(n){null==eq||eq.addLog({type:"warning",title:"订单正在同步中,用户点击返回",metadata:{isSyncingLocked:n}});return}let r=null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId;"shared"!==p&&await e4Y(O);let o=((null==O||null==(a=O.getOrderPayments)?void 0:a.call(O))||[]).some(e=>!!eP_(e)&&0===Number((null==e?void 0:e.voucher_id)||0)),s=!!("shared"!==p&&o&&r);null==g||g({status:"cancelled",source:"back",reason:"back",order_id:r,shouldRefreshOrder:s,isChangePaymentNotIncludeVoucher:eu}),null==h||h(!1,{order_id:r,event:{type:"modal-close",status:"cancelled",reason:"back",orderId:r,order_id:r,reset:!1,shouldRefreshOrder:s,shouldCloseCaller:!1,payload:{order_id:r},isChangePaymentNotIncludeVoucher:eu}})});(0,eC.useEffect)(()=>{var e;(null==m||null==(e=m.order_info)?void 0:e.order_note)&&ek(m.order_info.order_note)},[m]);let eq=eWG(),eB=null==eq?void 0:eq.addLog,eV=(0,eC.useCallback)(()=>{var e;null==eq||null==(e=eq.storeLog)||e.call(eq,!0)},[null==eq?void 0:eq.storeLog]);(0,eC.useEffect)(()=>{var e;if(!d||"u"<typeof window||"u"<typeof document)return;let t=`checkout-layout-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,l=0,i=e=>{let t=document.querySelector(e);if(!t)return null;let l=t.getBoundingClientRect();return{width:Number(l.width.toFixed(2)),height:Number(l.height.toFixed(2)),top:Number(l.top.toFixed(2)),left:Number(l.left.toFixed(2)),right:Number(l.right.toFixed(2)),bottom:Number(l.bottom.toFixed(2))}},a=function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Date.now();if(a||!(n-l<120)){l=n;try{let l=document.querySelector(".payment-modal-modal"),a=document.querySelector(".payment-modal-wrapper"),r=window.getComputedStyle(document.body),o=l?window.getComputedStyle(l):null,s=a?window.getComputedStyle(a):null,d=window.visualViewport;null==eB||eB({type:"info",title:"Checkout modal layout diagnostic",metadata:{sessionId:t,reason:e,timestamp:new Date(n).toISOString(),variant:N,configuredWidth:ec.width,window:{innerWidth:window.innerWidth,innerHeight:window.innerHeight,documentClientWidth:document.documentElement.clientWidth,documentClientHeight:document.documentElement.clientHeight,devicePixelRatio:window.devicePixelRatio},visualViewport:d?{width:d.width,height:d.height,scale:d.scale,offsetLeft:d.offsetLeft,offsetTop:d.offsetTop}:null,body:{transform:r.transform,zoom:r.zoom},modalWrapper:{rect:i(".payment-modal-modal"),width:(null==o?void 0:o.width)??null,maxWidth:(null==o?void 0:o.maxWidth)??null,transform:(null==o?void 0:o.transform)??null},floatingRoot:{rect:i(".payment-modal-wrapper"),width:(null==s?void 0:s.width)??null,height:(null==s?void 0:s.height)??null}}}),eV()}catch(e){console.warn("Failed to record checkout modal layout diagnostic",e)}}},n=()=>a("viewport-change"),r=new MutationObserver(()=>a("body-mutation"));r.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),a("modal-open",!0);let o=window.requestAnimationFrame(()=>a("next-frame",!0)),s=window.setTimeout(()=>a("startup-settled",!0),500);return window.addEventListener("resize",n),window.addEventListener("orientationchange",n),null==(e=window.visualViewport)||e.addEventListener("resize",n),()=>{var e;window.cancelAnimationFrame(o),window.clearTimeout(s),window.removeEventListener("resize",n),window.removeEventListener("orientationchange",n),null==(e=window.visualViewport)||e.removeEventListener("resize",n),r.disconnect(),a("modal-close",!0)}},[eB,ec.width,eV,d,N]);let eU=(0,eC.useRef)(void 0),eY=(0,eC.useRef)(void 0);(0,eC.useEffect)(()=>{(async()=>{try{if(O){eU.current=!0;let e=await ePj(A);O.setOtherParams({is_price_include_tax:P("is_price_include_tax")??1,tax_rate:P("tax_rate"),surcharge_list:P("surcharge_list"),currency_format:P("currency_format"),tax_title:P("tax_title")||"GST",tax_country_code:P("tax_country_code"),currency_code:P("shop_currency_code"),currency_symbol:P("shop_symbol"),order_rounding_setting:P("order_rounding_setting"),shop_wallet_pass_id:e,business_code:eo});let t=e4H(O);t&&t.totalAmount&&Y(Number(t.totalAmount||0)),R(t)}else if(eU.current){var e,t,l;eU.current=!1,await (null==O||null==(e=O.restoreOrder)?void 0:e.call(O)),y||ea?await (null==O||null==(t=O.saveDraft)?void 0:t.call(O)):(null==eq||eq.addLog({type:"info",title:"含有 localOrderCreate, 保存 BaseSales 草稿",metadata:{data:m}}),await (null==O||null==(l=O.saveDraft)?void 0:l.call(O)));let i=e4H(O);i&&i.totalAmount&&Y(Number(i.totalAmount||0)),R(i),eU.current=!0}else throw Error("pisellos is not available")}catch(t){console.error("Failed to initialize checkout data:",t);let e=window.location.hostname;null==eq||eq.addLog({type:"error",title:`${e}: Failed to initialize checkout data`,metadata:{error:null==t?void 0:t.message}}),ei(!0)}})()},[]),(0,eC.useEffect)(()=>()=>{if("function"==typeof eY.current){var e;null==(e=eY.current)||e.call(eY),eY.current=void 0}},[]);let eW={context:M,pisellos:I,getData:P,interaction:A,Toast:er,onToastClose:ez,paymentResultDisplayMode:b,onResultViewModel:e=>{eO({paymentResultViewModel:e})}},eK=function(e){var t,l,i;let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,r=e=>`payment-result-toast-${e}`,{isTerminal:o,isWebPos:s,NativePage:d}=null==(t=M.appHelper)?void 0:t.utils,c=n??(null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId),u=()=>{Ki()},p=async()=>{var e,t,l;setTimeout(()=>{u()},0),null==(l=M.appHelper)||null==(t=l.utils)||null==(e=t.action)||e.call(t,{type:"pisell1.handleOpenSaleDetail",data:{osKey:"big-sale-detail",osProps:{orderId:c}},callback:()=>{}})},m=async()=>{var e,t;if(setTimeout(()=>{u()},0),null==O?void 0:O.printLocalOrderReceipt){null==(e=eq.addLog)||e.call(eq,{type:"info",title:"支付结果弹窗请求本地打印小票"});try{let e=await O.printLocalOrderReceipt(c);null==(t=eq.addLog)||t.call(eq,{type:"info",title:"支付结果弹窗请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==er||er.error(e instanceof Error?e.message:String(e))}}},g=()=>{setTimeout(()=>{u()},0),eL.getText("payment.result.actions.orderNoteClicked"),eD&&eD()},h=()=>{eL.getText("payment.result.actions.refundClicked")};switch(e){case"paid":case"partially_paid":return[[a?{id:"details",buttonProps:{className:r("action-button"),onClick:p,icon:(0,eH.jsx)(KK,{className:r("action-icon")}),children:eL.getText("payment.result.details")}}:{id:"print",buttonProps:{className:r("action-button"),onClick:m,icon:(0,eH.jsx)(KQ,{className:r("action-icon")}),children:eL.getText("payment.result.printReceipt")}},{id:"more",isMore:!0,menuData:[{key:"orderNote",label:eL.getText("payment.result.orderNote"),icon:(0,eH.jsx)(eEx,{className:r("menu-icon")}),onClick:g},a?{key:"print",label:eL.getText("payment.result.printReceipt"),icon:(0,eH.jsx)(KQ,{className:r("action-icon")}),onClick:m}:{key:"details",label:eL.getText("payment.result.details"),icon:(0,eH.jsx)(KK,{className:r("action-icon")}),onClick:p}],buttonProps:{className:r("action-button"),icon:(0,eH.jsx)(ob,{className:r("action-icon")})}}]];case"failed":return[[{id:"retry",buttonProps:{className:r("action-button retry-button"),onClick:()=>{eL.getText("payment.result.actions.retryClicked")},icon:(0,eH.jsx)(e4j,{className:r("action-icon")}),children:eL.getText("payment.result.retry")}},{id:"changePayment",buttonProps:{className:r("action-button change-payment-button"),onClick:()=>{eL.getText("payment.result.actions.changePaymentClicked")},icon:(0,eH.jsx)(eiG,{className:r("action-icon")}),children:eL.getText("payment.result.changePayment")}},{id:"more",isMore:!0,menuData:[{key:"orderNote",label:eL.getText("payment.result.orderNote"),icon:(0,eH.jsx)(eEx,{className:r("menu-icon")}),onClick:g},{key:"refund",label:eL.getText("payment.result.refund"),icon:(0,eH.jsx)(oM,{className:r("menu-icon")}),onClick:h}],buttonProps:{className:r("action-button"),icon:(0,eH.jsx)(ob,{className:r("action-icon")})}}]];case"wallet-pass-failed":return[[{id:"savePartial",buttonProps:{className:r("action-button primary-button"),onClick:()=>{var e;null==(e=eA.current)||e.handleButtonClick("save-pay-later")},children:eL.getText("payment.result.saveAsPartialPaid")}},{id:"continuePayment",buttonProps:{className:r("action-button primary-button"),onClick:()=>{eL.getText("payment.result.actions.continuePaymentClicked"),u()},children:eL.getText("payment.result.continuePayment")}},{id:"more",isMore:!0,menuData:[{key:"details",label:eL.getText("payment.result.details"),icon:(0,eH.jsx)(KK,{className:r("menu-icon")}),onClick:p},{key:"print",label:eL.getText("payment.result.printReceipt"),icon:(0,eH.jsx)(KQ,{className:r("menu-icon")}),onClick:m},{key:"orderNote",label:eL.getText("payment.result.orderNote"),icon:(0,eH.jsx)(eEx,{className:r("menu-icon")}),onClick:g},{key:"refund",label:eL.getText("payment.result.refund"),icon:(0,eH.jsx)(oM,{className:r("menu-icon")}),onClick:h}],buttonProps:{className:r("action-button"),icon:(0,eH.jsx)(ob,{className:r("action-icon")})}}]];default:return[]}},eG=async e=>{var t,l,i;let a,n=null==(t=e.response)?void 0:t.data,r=null==n?void 0:n.payment_status,o=Number((null==n?void 0:n.total_amount)||(null==n?void 0:n.expect_amount)||0),s=Number((null==n?void 0:n.amount_gap)||0),d={autoClose:(a=e4b[e4x(r,void 0)||"paid"]).autoClose,autoCloseDelay:30,maskClosable:a.maskClosable},c=(null==n?void 0:n.order_id)??(null==n?void 0:n.orderId)??(null==(l=e.response)?void 0:l.order_id)??(null==(i=e.response)?void 0:i.orderId),u=eK?eK(r,!1,c):[];return e4w({paymentStatus:r,orderTotalAmount:o,gapAmount:s,autoCloseConfig:d,actionButtons:u},eW)};return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(oU,{renderType:eg?"drawer":"modal",showHandlerBar:eg,props:eg?{open:d,placement:"bottom",header:!1,footer:!1,destroyOnClose:!0,height:"95vh",closable:!1,onClose:()=>{eR(!1)},maskClosable:!0,styles:{body:{padding:0,overflow:"hidden"}},className:"payment-mobile-modal"}:{open:d,onCancel:()=>{eF()},title:(0,eH.jsx)(()=>(0,eH.jsxs)("div",{className:"payment-modal-custom-header",children:[(0,eH.jsx)("div",{className:"header__left",children:(0,eH.jsx)(eT.Button,{icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-arrow-left",size:24}),size:"small",type:"text",onClick:eF})}),(null==C?void 0:C.showHeaderCenter)&&(0,eH.jsxs)("div",{className:"header__center",children:[eE("order.total"),":",e4_(W,P("shop_symbol"))]}),(null==C?void 0:C.showHeaderRightButton)&&(0,eH.jsx)("div",{className:"header__right",children:(0,eH.jsx)(eT.Button,{size:"small",type:"link",onClick:()=>eR(!0,!1,"start-new-order"),children:eL.getText("order.start-new-order")})})]}),{}),width:ec.width,className:`payment-modal-modal ${"smallTablet"===N||"tablet"===N?"payment-modal-modal-responsive":""}`,destroyOnClose:!1,maskClosable:!1,footer:null,closeIcon:!1,wrapClassName:`payment-modal-wrapper ${!K?"no-cash-payment":""}`,size:"large",style:{height:"auto",maxHeight:"98%"},bodyStyle:{maxHeight:"100%",overflowY:"auto",padding:0,display:"flex",flexDirection:"column"}},children:eg?(0,eH.jsxs)("div",{className:"payment-mobile-modal-panel",children:[(0,eH.jsx)("div",{className:"payment-mobile-modal-header",children:(0,eH.jsxs)("div",{style:e4A,children:[(0,eH.jsx)(eT.Button,{icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-arrow-left",size:20}),size:"small",type:"text",style:e4D,onClick:eF}),(null==C?void 0:C.showHeaderCenter)!==!1?(0,eH.jsxs)("div",{style:e4E,children:[eE("order.total")||"Order Total",":"," ",e4_(W,P("shop_symbol"))]}):(0,eH.jsx)("div",{}),(null==C?void 0:C.showHeaderRightButton)!==!1?(0,eH.jsx)(eT.Button,{size:"small",type:"link",style:e4O,onClick:()=>eR(!0,!1,"start-new-order"),children:eL.getText("order.start-new-order")||"New Order"}):(0,eH.jsx)("div",{style:e4O})]})}),(0,eH.jsx)("div",{className:"payment-mobile-modal-content",style:{height:"100%"},children:(0,eH.jsx)(e46,{ref:eA,isModalOpen:d,cartData:(0,no.cloneDeep)(m),orderInfo:L||void 0,onPaymentComplete:eO,onPaymentCancel:eR,onStatusChange:()=>{},paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,showingCashToastRef:eN,onToastClose:ez,orderNote:ex,setOrderNote:ek,setNoteModalSource:ew,setNoteModalOpen:eb,totalAmount:W,moduleConfig:ev,onShowCashPaymentChange:ef,showSuccessToast:eG,dynamicMaxHeight:eh,onOrderSyncFailed:()=>X(!0),generateActionButtons:eK,paymentResultToastConfig:eW,updateOrderInfo:e=>R(e),setCurrentEditOrderId:e=>en(e),baseSales:O,walletPassMode:p,config:C,cardReaderDeviceNumber:$,cardReaders:q,setIsChangePaymentNotIncludeVoucher:ep})})]}):(0,eH.jsx)(e46,{ref:eA,isModalOpen:d,cartData:(0,no.cloneDeep)(m),orderInfo:L||void 0,onPaymentComplete:eO,onPaymentCancel:eR,onStatusChange:()=>{},paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,showingCashToastRef:eN,onToastClose:ez,orderNote:ex,setOrderNote:ek,setNoteModalSource:ew,setNoteModalOpen:eb,totalAmount:W,moduleConfig:ev,onShowCashPaymentChange:ef,showSuccessToast:eG,dynamicMaxHeight:em,onOrderSyncFailed:()=>X(!0),generateActionButtons:eK,paymentResultToastConfig:eW,updateOrderInfo:e=>R(e),setCurrentEditOrderId:e=>en(e),baseSales:O,walletPassMode:p,config:C,cardReaderDeviceNumber:$,cardReaders:q,setIsChangePaymentNotIncludeVoucher:ep})}),ey&&(0,oT.createPortal)((0,eH.jsx)("div",{children:(0,eH.jsx)(dA,{open:ey,title:eL.getText("pisell2.text.add-order-notes"),value:ex,onConfirm:eS,onDelete:ej,onCancel:()=>{eb(!1),ew("payment-content")}})}),document.body),(0,eH.jsx)(nY.PisellContainer,{renderType:"modal",props:{open:J,title:eL.getText("pisell2.checkout.tips"),footer:null,keyboard:!1,maskClosable:!1,closable:!1,onCancel:()=>{}},children:(0,eH.jsxs)("div",{style:{textAlign:"center",padding:"20px"},children:[(0,eH.jsx)("div",{style:{marginBottom:"16px",fontSize:"16px"},children:eL.getText("pisell2.checkout.sync-retry-hint")||"请点击重试按钮重新同步订单"}),(0,eH.jsx)(eT.Button,{type:"primary",size:"large",onClick:ed,loading:ee,disabled:ee,style:{width:"100%",marginTop:"80px"},children:eL.getText("retry")||"重试"})]})}),(0,eH.jsx)(nY.PisellContainer,{renderType:"modal",props:{open:el,title:eL.getText("pisell2.checkout.tips"),footer:null,keyboard:!1,onCancel:()=>{ei(!1)}},children:(0,eH.jsxs)("div",{style:{textAlign:"center",padding:"20px"},children:[(0,eH.jsx)("div",{style:{marginBottom:"16px",fontSize:"16px"},children:eL.getText("pisell2.checkout.order-create-failed")}),(0,eH.jsx)(eT.Button,{type:"primary",size:"large",onClick:()=>{ei(!1),window.location.reload()},style:{width:"100%",marginTop:"80px"},children:eL.getText("confirm")||"确认"})]})})]})};e45.displayName="PaymentModal";let e47=oZ(e45);function e49(e){let t=new Set,l=(e,i)=>{if("string"==typeof e)return"[object Object]"===e.trim()?"":e.trim();if(!e||"object"!=typeof e||i>8||t.has(e))return"";if(t.add(e),Array.isArray(e))return e.map(e=>l(e,i+1)).filter(Boolean).join("\n");for(let t of["response","data","body","message","msg","error","errors","statusText"]){let a=l(e[t],i+1);if(a)return a}return""};return l(e,0)}let e3e=e=>e&&"object"==typeof e&&!Array.isArray(e)?e:{},e3t=e=>{if("number"!=typeof e&&"string"!=typeof e||""===String(e).trim())return null;let t=eUn(e);return null!==t&&t>=0?t:null},e3l=function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];for(let e of t){let t=e3t(e);if(null!==t)return t}return null},e3i=e=>!0===e||1===e||"1"===e||!1!==e&&0!==e&&"0"!==e&&void 0;function e3a(e){let{result:t,amountSnapshot:l,order:i}=e,a=e3e(t),n=e3e(a.data),r=e3e(e3e(n.response).data??e3e(a.response).data??a.data??a),o=e3e(r.summary),s=e3e(l),d=e3e(i),c=e3t(r.order_wait_pay_amount);if(null!==c)return c;let u=String(r.payment_status||"").trim().toLowerCase();if("paid"===u)return 0;let p=r.deposit_amount??o.deposit_amount,m=e3t(p),g=null!=p&&""!==p,h=e3t(s.depositAmount);if(e3i(r.is_deposit)??(null!==m&&m>0||void 0)??e3i(s.isDeposit)??e3i(d.is_deposit)??(e3l(s.depositAmount,d.deposit_amount)??0)>0){let e=e3l(r.order_paid_amount,r.paid_amount,o.order_paid_amount),t=e3t(e3e(s.summary).order_paid_amount),l=m??h??e3t(d.deposit_amount),i=[...Array.isArray(r.payments)?r.payments:[],...Array.isArray(d.payments)?d.payments:[]].map(e3e).filter(e=>"paid"===e.status),a=i.some(e=>"normal"===e.type||"normal"===e.order_payment_type||"deposit"!==e.type&&"deposit"!==e.order_payment_type),n=e??t;if(a||null!==l&&l>0&&[e,t].some(e=>null!==e&&e>=l)||null!==e&&null!==t&&e!==t||i.length>0&&(null===n||0===n&&i.some(e=>(e3l(e.origin_amount,e.amount)??0)>0)))return null;let c=e3t(s.amountGap);return!0===e3i(s.isDeposit)&&null!==h&&h>0&&null!==c&&(!g||m===h)?c:"unpaid"===u&&0===e&&null!==m&&m>0?m:null}let v=e3e(s.summary??d.summary);return e3t(eUd({data:r},{expect_amount:s.expectAmount??v.expect_amount,total_amount:s.totalAmount??v.total_amount},void 0))}let e3n={en:{"pisell2.venue-kiosk.checkout.failed":"Checkout could not be completed. Please try again.","pisell2.venue-kiosk.checkout.reset-failed":"Could not start the next order. Please try again.","pisell2.venue-kiosk.checkout.result-missing":"The payment result could not be displayed. Continue paying this order.","pisell2.venue-kiosk.checkout.order-reference":"Order","pisell2.venue-kiosk.checkout.continue-payment":"Continue payment"},"zh-CN":{"pisell2.venue-kiosk.checkout.failed":"结账未完成,请重试。","pisell2.venue-kiosk.checkout.reset-failed":"暂时无法开始下一单,请重试。","pisell2.venue-kiosk.checkout.result-missing":"暂时无法显示支付结果,请继续处理当前订单。","pisell2.venue-kiosk.checkout.order-reference":"订单","pisell2.venue-kiosk.checkout.continue-payment":"继续支付"}},e3r="venue_booking_form_records";function e3o(e){return[...new Set((e.resources||[]).map(e=>String(e.relation_id??e.resource_id??e.id??"")).filter(e=>e&&"0"!==e))]}function e3s(e,t){var l;if(!t||!e.formId||!e3o(t).includes(e.resourceId))return;let i=(null==(l=t.metadata)?void 0:l[e3r])||{};return[i[e.key],...Object.values(i)].find(l=>l&&String(l.resourceId)===e.resourceId&&Number(l.formId)===e.formId&&/^\d+$/.test(String(l.recordId))&&Number(l.recordId)>0&&(t.relation_forms||[]).some(t=>Number(t.form_id)===e.formId&&Array.isArray(t.form_record_ids)&&t.form_record_ids.some(e=>String(e)===String(l.recordId))))}function e3d(e,t){for(let l of e.members){let e=e3s(l,t(l.bookingUid));if(e)return e}}function e3c(e,t){if(!e.formId)return!0;let l=e3d(e,t);return!!l&&e.members.every(e=>{var i;return String(null==(i=e3s(e,t(e.bookingUid)))?void 0:i.recordId)===String(l.recordId)})}async function e3u(e,t,l){var i,a;let n=t=>{l.assertCurrent();let i=l.readBooking(t.bookingUid);if(!i||!e3o(i).includes(e.resourceId))throw Error("The booking resource changed. Please review its details again.");return i};for(let i of(e.members.forEach(n),e.members)){let r=n(i),o=(null==(a=r.metadata)?void 0:a[e3r])||{},s=new Set,d={...o};for(let[t,l]of Object.entries(o))String(null==l?void 0:l.resourceId)===e.resourceId&&Number(null==l?void 0:l.formId)===e.formId&&(s.add(String(l.recordId)),delete d[t]);for(let t of Object.values(d))Number(null==t?void 0:t.formId)===e.formId&&s.delete(String(t.recordId));let c=(r.relation_forms||[]).map(t=>({...t,form_record_ids:[...t.form_record_ids||[]].filter(l=>Number(t.form_id)!==e.formId||!s.has(String(l)))})),u=c.find(t=>Number(t.form_id)===e.formId);u||(u={form_id:e.formId,form_record_ids:[]},c.push(u)),u.form_record_ids.some(e=>String(e)===String(t.recordId))||u.form_record_ids.push(t.recordId),await l.updateBooking({unique_identification_number:i.bookingUid,updates:{relation_forms:c,metadata:{[e3r]:{...d,[i.key]:t}}}})}if(l.assertCurrent(),!e3c(e,l.readBooking)||String(null==(i=e3d(e,l.readBooking))?void 0:i.recordId)!==String(t.recordId))throw Error("The saved form could not be linked to every booking. Please retry.")}let e3p=e=>null==e?"":String(e).trim(),e3m=e=>null==e?void 0:e.map(e=>[e.option_group_id??e.group_id,e.product_option_item_id??e.option_group_item_id??e.id,e.num??e.quantity]),e3g=e=>{var t,l,i;return[(null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number,e.product_id??e.id,e.product_variant_id??0,Number(e.num??e.quantity),e3m(null==(l=e.product_sku)?void 0:l.option),null==(i=e.product_bundle)?void 0:i.map(e=>{var t;return[e.group_id??e.bundle_group_id,e.id??e.bundle_id,e.product_id??e.bundle_product_id,e.product_variant_id??e.bundle_variant_id,e.num??e.quantity,e3m(e.option??(null==(t=e.product_sku)?void 0:t.option))]})]},e3h=e=>JSON.stringify([null==e?void 0:e.customer_id,((null==e?void 0:e.products)||[]).map(e3g),((null==e?void 0:e.bookings)||[]).map(e=>{var t,l;return[(null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number,e.start_date,e.start_time,e.end_date,e.end_time,e.resources,e.holders,e.relation_forms,null==(l=e.metadata)?void 0:l[e3r]]}),null==e?void 0:e.holder_relations,null==e?void 0:e.contacts_info,null==e?void 0:e.contacts,null==e?void 0:e.notes,null==e?void 0:e.note]),e3v=e=>null!=e&&""!==String(e).trim()&&"0"!==String(e).trim();function e3f(e){var t;if("payment_pending"!==String((null==e?void 0:e.status)||"").toLowerCase()||!e3v(null==e?void 0:e.voucher_id)||e3v(null==e?void 0:e.order_payment_id))return!1;let l=null==e||null==(t=e.metadata)?void 0:t.transactions;return!Array.isArray(l)||!l.some(e=>e3v(null==e?void 0:e.number))}function e3y(e){var t,l,i,a;let n=null==(t=e.getTempOrder)?void 0:t.call(e);return!(!n||e3v(n.order_id)||1===Number(n.need_sync)||[n.paid_amount,null==(l=n.summary)?void 0:l.order_paid_amount,null==(i=n.summary)?void 0:i.customer_paid_amount].some(e=>Number(e)>0))&&((null==(a=e.getOrderPayments)?void 0:a.call(e))||n.payments||[]).every(e3f)}function e3b(e){var t,l,i;let a=null==(t=e.getOrderAmountSnapshot)?void 0:t.call(e),n=null==(l=e.getTempOrder)?void 0:l.call(e),r=(null==(i=e.getOrderPayments)?void 0:i.call(e))||(null==n?void 0:n.payments)||[],o=Number(null==a?void 0:a.depositAmount),s=!!(null==a?void 0:a.isDeposit)&&Number(null==a?void 0:a.depositAmount)>0&&!r.some(e=>"paid"===String((null==e?void 0:e.status)||"").toLowerCase()&&"deposit"!==e.type&&"deposit"!==e.order_payment_type),d=!1;return{canReturn:e3y,readAmount(e){var t,l,i,a,n;if(!s)return eVK(e);if(d)return 0;let r=null==(t=e.getOrderAmountSnapshot)?void 0:t.call(e);if(!(null==r?void 0:r.isDeposit)||Number(r.depositAmount)!==o)return;let c=e3a({result:{},amountSnapshot:r,order:null==(l=e.getTempOrder)?void 0:l.call(e)});if(null!==c)return eC9({baseSalesAmountGap:c,payments:(null==(i=e.getOrderPayments)?void 0:i.call(e))||(null==(n=e.getTempOrder)||null==(a=n.call(e))?void 0:a.payments)})},inspectCompletion(e,t){var l,i,a;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"kiosk",r=(null==t?void 0:t.syncResult)||t;if(!s||(null==r?void 0:r.isOrderFullyPaid)===!0||(null==r?void 0:r.isDepositFullyPaid)!==!0)return eVZ(e,t,n);let o=null==r?void 0:r.submitResult,c=(null==o||null==(l=o.data)?void 0:l.data)||(null==o?void 0:o.data)||o;if(!eA5(o)||"main-screen"!==n&&[null==c?void 0:c.need_sync,null==o?void 0:o.need_sync,null==r?void 0:r.need_sync].some(e=>1===Number(e)))throw Error("Order sync is not complete.");let u=(null==c?void 0:c.order_id)??(null==c?void 0:c.orderId)??("main-screen"===n?null==c?void 0:c.external_sale_number:void 0)??(null==(a=e.getTempOrder)||null==(i=a.call(e))?void 0:i.order_id);if(!e3v(u)||"main-screen"!==n&&(!/^\d+$/.test(String(u))||0>=Number(u)))throw Error("The submitted order has no valid order id.");return d=!0,{kind:"paid",orderId:u,result:t,paymentStatus:"deposit-paid"}}}}let e3x=e=>{let t=String(e??"").trim();return/^\d+$/.test(t)&&Number(t)>0?t:void 0},e3k=e=>{var t;return(null==e||null==(t=e._extend)?void 0:t.localId)||(null==e?void 0:e.external_sale_number)||(null==e?void 0:e.order_id)||e},e3_=0,e3w=0,e3S=e=>{var t,l,i;let a=(null==(l=e.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.sales.tempOrder;return(null==a||null==(i=a._extend)?void 0:i.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id)||a},e3j=new Set(["id","product_id","product_variant_id","product_option_item_id","option_group_item_id","option_group_id","group_id","bundle_id","bundle_group_id","bundle_product_id","_bundle_product_id","bundle_variant_id","variant_id","quantity","num"]),e3N=e=>"string"==typeof e||"number"==typeof e&&Number.isFinite(e),e3C=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(e)?e.map(e=>{let l={};if(!e||"object"!=typeof e)throw Error("Invalid saved Party configuration.");for(let[t,i]of Object.entries(e))e3j.has(t)&&e3N(i)&&(l[t]=i);return!t&&Array.isArray(e.option)&&(l.option=e3C(e.option,!0)),l}):[]},e3M=(e,t)=>Object.entries(e||{}).reduce((e,l)=>{let[i,a]=l;return!["__proto__","constructor","prototype"].includes(i)&&(!t||t.includes(i))&&e3N(a)&&(e[i]=a),e},{}),e3T=e=>e3M(e,["scheduleId","timeSlotId","ruleId","source","label"]);function e3I(e){let t=null==e?void 0:e.candidate;return{...t?{candidate:{key:t.key,productId:t.productId,source:t.source,date:t.date,businessDate:t.businessDate,startAt:t.startAt,endAt:t.endAt,startTime:t.startTime,endTime:t.endTime,bookingStartAt:t.bookingStartAt,bookingEndAt:t.bookingEndAt,timezone:t.timezone,scheduleRefs:(t.scheduleRefs||[]).map(e3T),...t.primaryScheduleRef?{primaryScheduleRef:e3T(t.primaryScheduleRef)}:{}}}:{},requirementSelections:((null==e?void 0:e.requirementSelections)||[]).map(e=>({...null!=e.requirementGroupId?{requirementGroupId:e.requirementGroupId}:{},...null!=e.formId?{formId:e.formId}:{},resourceIds:e.resourceIds.filter(e3N)}))}}function e3P(e,t){let l=Number(e.detail.id??e.detail.product_id),i=e.configuration.skuValue,a=e.quantity??1;if(!Number.isSafeInteger(l)||l<=0||!Number.isSafeInteger(a)||a<=0||Number(i.product_id)!==l||!Number.isSafeInteger(Number(i.product_variant_id??0)))throw Error("Invalid saved Party configuration.");let n=e.configuration.variantDraft;return{version:1,productId:l,phase:t,quantity:a,...e.lineUid?{lineUid:e.lineUid}:{},configuration:{skuValue:{product_id:l,product_variant_id:Number(i.product_variant_id??0),..."string"==typeof i.product_option_string?{product_option_string:i.product_option_string}:{},option:e3C(i.option),bundle:e3C(i.bundle)},variantDraft:n?{productId:n.productId,selectionKey:n.selectionKey,items:e3M(n.items||{}),productOptionString:n.productOptionString}:null},selection:e3I(e.initialSelection)}}function e3A(e,t){var l,i,a;let n=["string"==typeof e?e:void 0,null==e?void 0:e.message,null==e||null==(i=e.response)||null==(l=i.data)?void 0:l.message,null==e||null==(a=e.data)?void 0:a.message].find(e=>"string"==typeof e&&!!e.trim()&&"[object Object]"!==e.trim());return(null==n?void 0:n.trim())||t}let e3D=e=>Array.isArray(e)?e:[],e3E=(e,t)=>null!=e&&null!=t&&String(e)===String(t),e3O=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")},e3z=e=>!!e&&"object"==typeof e&&[0,1,"0","1"].includes(e.has_deposit);function e3L(e,t,l,i){if(!e||Number(e.order_id||0)>0)return[];let a=e3D(e.products);return(0,no.flatMap)(a,n=>{var r,o,s,d,c,u,p;let m=null==(r=n.metadata)?void 0:r.venue_booking_role,g="tickets"===m||"party_main"===m?l:"tickets_extra"===m||"party_extra"===m?i:void 0,h=e3O(n);if(!g||!h||(null==(o=n.metadata)?void 0:o.venue_booking_scope_key)!==t||Number(n.order_detail_id||0)>0||1!==a.filter(e=>e3O(e)===h).length)return[];let v=n._origin??(null==(u=e._extend)||null==(c=u.productsByUid)||null==(d=c[e3O(n)])?void 0:d.origin)??(null==(p=n.metadata)?void 0:p.origin)??{};if(null!=(n.custom_deposit_data??v.custom_deposit_data??(null==(s=v.product)?void 0:s.custom_deposit_data)))return[];let f=g.filter(e=>e3E(e.id,n.product_id));if(1!==f.length||!e3z(f[0].custom_deposit_data))return[];let y=f[0],b=Number(n.product_variant_id||0),x=e3D(y.variant).filter(e=>e3E(e.id,b));if(b>0&&1!==x.length)return[];let k={...v,custom_deposit_data:(0,no.cloneDeep)(y.custom_deposit_data)};if(b>0&&e3z(x[0].custom_deposit_data)){let e=e3D(v.variant),t=e.find(e=>e3E(e.id,b));k.variant=t?e.map(e=>e!==t||null!=e.custom_deposit_data?e:{...e,custom_deposit_data:(0,no.cloneDeep)(x[0].custom_deposit_data)}):[...e,{id:x[0].id,custom_deposit_data:(0,no.cloneDeep)(x[0].custom_deposit_data)}]}let _=!1,w=e3D(n.product_bundle).map(e=>{let t,l,i,a,n;if(null!=e.custom_deposit_data)return e;let r=(t=e.bundle_group_id??e.group_id,l=e.bundle_id??e.id,i=e.bundle_product_id??e._bundle_product_id??e.product_id,a=e.bundle_variant_id??e.product_variant_id??e.variant_id??0,1===(n=(0,no.flatMap)(e3D(y.bundle_group).filter(e=>null==t||e3E(e.id,t)),e=>e3D(e.bundle_item)).filter(e=>null!=l&&e3E(e.id??e.bundle_id,l)&&(null==i||e3E(e.bundle_product_id??e._bundle_product_id??e.product_id,i))&&e3E(e.bundle_variant_id??e.product_variant_id??e.variant_id??0,a))).length?n[0]:void 0);return e3z(null==r?void 0:r.custom_deposit_data)?(_=!0,{...e,custom_deposit_data:(0,no.cloneDeep)(r.custom_deposit_data)}):e});return[{product_id:Number(n.product_id),product_variant_id:b,unique_identification_number:h,updates:{_origin:k,..._?{product_bundle:w}:{}}}]})}let e3R=(e,t)=>{var l,i;return e.os===t.os&&e.scopeKey===t.scopeKey&&e.order===t.os.getTempOrder()&&e.identity===eXv(t.os.getTempOrder())&&e.customer===String((null==(l=t.os.getTempOrder())?void 0:l.customer_id)||"")&&0>=Number((null==(i=t.os.getTempOrder())?void 0:i.order_id)||0)},e3$=e=>({customer:e.customer_id,bookings:e.bookings,holder:e.holder_relations,products:e3D(e.products).filter(e=>{var t;return!(null==(t=e.metadata)?void 0:t._giftInfo)}).map(e=>{var t,l;return{uid:e3O(e),product:e.product_id,variant:e.product_variant_id,num:e.num,sku:id({product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id||0),option:ex4(e),bundle:e.product_bundle||[]}),note:e.note,remark:e.remark,scope:null==(t=e.metadata)?void 0:t.venue_booking_scope_key,role:null==(l=e.metadata)?void 0:l.venue_booking_role}})}),e3F=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}$/.test(e);function e3q(e,t){let l=eXh(Number(e.id)),{value:i}=$e(iu(l.skuValue,e,{overSold:t}).value,e,{overSold:t});if(i===l.skuValue)return l;let a=ip(i,e);return{...l,skuValue:iN(a,e,l.skuValue)}}function e3B(e){var t,l,i,a,n,r,o,s,d,c,u,p,m,g,h,v,f,y,b,x,k;let _,w,S,j,N,C,M=e$(),T=eJ$(),I=exR(),P=UM(),A=function(){var e;let t=(null==(e=eJF())?void 0:e.layout)==="compact",[l,i]=(0,eC.useState)(()=>"u">typeof window&&window.matchMedia("(max-width: 700px)").matches),[a,n]=(0,eC.useState)(!1);return(0,eC.useEffect)(()=>{let e=window.matchMedia("(max-width: 700px)"),l=()=>{i(e.matches),e.matches||t||n(!1)};return l(),e.addEventListener("change",l),()=>e.removeEventListener("change",l)},[t]),{isMobile:t||l,open:a,show:()=>n(!0),close:()=>n(!1),closeThen:e=>{if(!a)return e();n(!1),requestAnimationFrame(e)}}}(),D=eXN(),{mode:E,context:O,config:z,scopeKey:L,variant:R="desktop"}=e,{sales:$,cart:F}=O,q=$.bookingTicket,B=eXy(q),H=String(e.locale).startsWith("zh")?"zh":"en",V=(e,t)=>"zh"===H?t:e,U=function(e){let{enabled:t,timeZone:l,isActive:i}=e,a=l||void 0,n=eXf(a),r=(0,eC.useRef)(n);r.current=n;let o=(0,eC.useRef)({enabled:t,zone:a,isActive:i});o.current={enabled:t,zone:a,isActive:i};let[,s]=(0,eC.useState)(0);return(0,eC.useEffect)(()=>{let e;if(!t||!1===i||"u"<typeof window||"u"<typeof document)return;let l=!0,n=()=>l&&o.current.enabled&&!1!==o.current.isActive&&o.current.zone===a,d=()=>{void 0!==e&&window.clearTimeout(e),e=void 0},c=()=>{if(!n())return;let e=eXf(a);r.current!==e&&(r.current=e,s(e=>e+1))},u=()=>{if(d(),!n()||"hidden"===document.visibilityState)return;let t=6e4-Date.now()%6e4;e=window.setTimeout(()=>{e=void 0,c(),u()},t)},p=()=>{c(),u()};return window.addEventListener("focus",p),window.addEventListener("pageshow",p),document.addEventListener("visibilitychange",p),p(),()=>{l=!1,d(),window.removeEventListener("focus",p),window.removeEventListener("pageshow",p),document.removeEventListener("visibilitychange",p)}},[t,a,i]),n}({enabled:B,isActive:e.isActive,timeZone:(null==(t=q.otherParams)?void 0:t.businessTimezone)||(null==M||null==(a=M.appHelper)||null==(i=a.utils)||null==(l=i.getData)?void 0:l.call(i,"timezone"))}),Y=(0,eC.useRef)({date:U,step:"select"});B&&Y.current.date!==U&&(Y.current={date:U,step:"select"});let[W,K]=(0,eC.useState)(Y.current.date),[G,Q]=(0,eC.useState)(()=>{if(B)return[U];let e=e0v(Y.current.date,e0p(H));return Array.from({length:7},(t,l)=>e0h(e,l)).filter(e=>e>=U)}),[Z,J]=(0,eC.useState)("select"),[X,ee]=(0,eC.useState)(B),[et,el]=(0,eC.useState)(),ei=(0,eC.useRef)(),[ea,en]=(0,eC.useState)(B?"product":"date"),[er,eo]=(0,eC.useState)(),[es,ed]=(0,eC.useState)(),[ec,eu]=(0,eC.useState)(),[ep,em]=(0,eC.useState)(),[eg,eh]=(0,eC.useState)(),[ev,ef]=(0,eC.useState)(!1),[ey,eb]=(0,eC.useState)(),[ex,ek]=(0,eC.useState)(!1),[e_,ew]=(0,eC.useState)(),[ej,eN]=(0,eC.useState)(),[eM,eI]=(0,eC.useState)(!1),[eP,eA]=(0,eC.useState)(!1),[eD,eE]=(0,eC.useState)(0),[eO,ez]=(0,eC.useState)(),[eR,eF]=(0,eC.useState)(!1),[eB,eH]=(0,eC.useState)(!1),eV=(0,eC.useRef)(!1),eU=(0,eC.useRef)(()=>!1),eY=(0,eC.useRef)(async()=>{}),eW=(0,eC.useRef)(async()=>!1),eK=(0,eC.useRef)(0),eG=(0,eC.useRef)(0),eQ=(0,eC.useRef)(!0),eZ=(0,eC.useRef)(),eJ=(0,eC.useCallback)(e=>(eZ.current=e,()=>{eZ.current===e&&(eZ.current=void 0)}),[]),eX=(0,eC.useRef)(null);(0,eC.useEffect)(()=>(eQ.current=!0,()=>{eQ.current=!1,eK.current++}),[]);let e0=z.steps[E].catalog,e2=B?(null==(r=q.getTempOrder)||null==(n=r.call(q))?void 0:n.customer_id)??(null==(o=F.tempOrder)?void 0:o.customer_id)??void 0:(null==(s=O.customer.selected)?void 0:s.id)??(null==(d=F.tempOrder)?void 0:d.customer_id)??void 0,e1=async()=>{await F.recalcSummary(),F.refreshCartSnapshot()},e4=async()=>{await e1(),eQ.current&&eE(e=>e+1)},e3=function(e){var t,l;let{source:i,enabled:a,scopeKey:n,create:r,refresh:o,initialState:s,customerMode:d="web",persistDraft:c=!0,retire:u,canRetire:p,waitForRetire:m}=e,g=e2J(i),h=null==(t=i.otherParams)?void 0:t.businessCode,v=c&&g?`pisell:venue-booking:v2:${JSON.stringify([n,g])}`:void 0,f=()=>({ready:!1,restored:!1,pendingOrder:!1,state:s}),[y,b]=(0,eC.useState)(()=>({value:f()})),x=(0,eC.useRef)(),k=(0,eC.useRef)({create:r,refresh:o,initialState:s,retire:u,canRetire:p,waitForRetire:m});k.current={create:r,refresh:o,initialState:s,retire:u,canRetire:p,waitForRetire:m},(0,eC.useEffect)(()=>{if(!a||!i)return;let e=e2Z.get(i);e||(e={tail:Promise.resolve(),hasSession:!1},e2Z.set(i,e));let t=e,l=t.owner;if(!(null==l?void 0:l.active)||l.scopeKey!==n||l.cacheId!==g){let e;(null==l?void 0:l.active)&&e23(l);let a=k.current,r=!!v&&!t.hasSession&&(()=>{try{var e;return"u">typeof performance&&(null==(e=performance.getEntriesByType("navigation")[0])?void 0:e.type)==="reload"}catch{return!1}})()&&!e2G.has(v);t.hasSession=!0,v&&e2G.add(v);try{let t=v?JSON.parse(sessionStorage.getItem(v)||"null"):null;v&&(null==t?void 0:t.version)===2&&t.scopeKey===n&&t.cacheId===g&&"status"in t&&"submission-pending"===t.status?sessionStorage.removeItem(v):("web"===d&&v&&(null==t?void 0:t.version)===2&&t.scopeKey===n&&t.cacheId===g&&"collectionReturnTo"in t&&t.collectionReturnTo===e21()&&"string"==typeof t.sessionId&&t.sessionId&&(delete t.collectionReturnTo,sessionStorage.setItem(v,JSON.stringify(t)),r=!0),r&&(e=t),v&&!r&&sessionStorage.removeItem(v))}catch{}t.owner=l={source:i,scopeKey:n,cacheId:g,storageKey:v,refs:0,releaseVersion:0,active:!0,order:null,returnPath:e21(),sessionId:`${Date.now()}:${++e2Q}`,discarded:!1,lastState:a.initialState,retireOrder:a.retire,canRetire:a.canRetire,waitForRetire:a.waitForRetire,value:{ready:!1,restored:!1,pendingOrder:!1,state:a.initialState},listeners:new Set};let o=l,s=()=>t.owner===o&&o.active&&o.refs>0,c=e=>{s()&&(o.order=i.getTempOrder(),o.lastState=e.state,o.value=e,e24(o))};t.tail=t.tail.then(async()=>{if(!s())return;if(t.orderOwner=o,t.orderSessionId=o.sessionId,e22(i.getTempOrder()))return void c({ready:!0,restored:!1,pendingOrder:!0,state:a.initialState});if("kiosk"!==d&&("function"!=typeof i.syncAuthenticatedOrderCustomer||"function"!=typeof i.clearOrderCustomer))throw Error("This booking service version cannot safely synchronize the signed-in customer. Please update the service before continuing.");if(await a.create(),!s())return;if(e22(i.getTempOrder()))return void c({ready:!0,restored:!1,pendingOrder:!0,state:a.initialState});let l=!1,r=a.initialState;if((null==e?void 0:e.version)===2&&e.scopeKey===n&&e.cacheId===g&&e.order&&!e22(e.order)&&Array.isArray(e.order.products)&&Object.prototype.hasOwnProperty.call(e,"state")){if(await i.replaceTempOrder(e.order,{persist:!1,recalculateSummary:!1}),!s())return;l=!0,r=e.state}let u=e=>{var t,l;return String((null==e?void 0:e.customer_id)||(null==e||null==(l=e._extend)||null==(t=l.customerSnapshot)?void 0:t.id)||"")},p=u(i.getTempOrder());if("kiosk"!==d){let e=await i.syncAuthenticatedOrderCustomer();if(!s())return;if(!1===e)i.clearOrderCustomer();else if(!0!==e)throw Error("The booking service did not confirm customer synchronization. Please reload before continuing.")}if(!s())return;let m=i.getTempOrder();if(p!==u(m)&&Array.isArray(null==m?void 0:m.payments)&&m.payments.some(e20)){if("function"!=typeof i.clearWalletAssetSelection)throw Error("This booking service version cannot clear the previous customer’s wallet selection. Please update the service before continuing.");if(await i.clearWalletAssetSelection(),!s())return}await a.refresh(),s()&&c({ready:!0,restored:l,pendingOrder:e22(i.getTempOrder()),state:r})}).catch(e=>{s()&&(o.value={...o.value,ready:!1,error:e instanceof Error?e.message:String(e)},e24(o))})}let r=l;r.refs+=1,r.releaseVersion+=1,x.current=r;let o=!0,s=()=>{o&&b({record:r,value:r.value})};return r.listeners.add(s),s(),()=>{o=!1,r.listeners.delete(s),r.refs-=1,x.current===r&&(x.current=void 0);let e=++r.releaseVersion,l="web"===d&&"u">typeof window&&/^\/(?:[^/]+\/)?login-info\/?$/.test(window.location.pathname);"kiosk"===d&&r.retireOrder&&r.canRetire&&e28(r,t,r.sessionId,r.canRetire,!0).catch(()=>{}),Promise.resolve().then(()=>{var a;if(0===r.refs&&r.releaseVersion===e){if(l&&t.owner===r&&t.orderOwner===r&&t.orderSessionId===r.sessionId&&r.value.ready&&!r.value.pendingOrder&&!r.discarded&&r.storageKey&&r.returnPath&&e2J(i)===r.cacheId&&i.getTempOrder()===r.order&&!e22(i.getTempOrder()))try{let e=JSON.parse(sessionStorage.getItem(r.storageKey)||"null");(null==e?void 0:e.version)===2&&e.scopeKey===r.scopeKey&&e.cacheId===r.cacheId&&e.sessionId===r.sessionId&&e.order&&!e22(e.order)&&sessionStorage.setItem(r.storageKey,JSON.stringify({...e,collectionReturnTo:r.returnPath}))}catch{}e23(r),t.owner!==r||(null==(a=r.submittedFinish)?void 0:a.pending)||(t.owner=void 0)}})}},[i,a,n,g,v,d]);let _=y.record,w=null==_?void 0:_.sessionId,S=a&&(null==_?void 0:_.source)===i&&_.scopeKey===n&&_.cacheId===g&&_.active&&(null==(l=e2Z.get(i))?void 0:l.owner)===_,j=S?y.value:f(),N=e=>{if(e.storageKey&&(e=>{if(!e.storageKey)return!1;try{var t;return(null==(t=JSON.parse(sessionStorage.getItem(e.storageKey)||"null"))?void 0:t.sessionId)===e.sessionId}catch{return!1}})(e))try{sessionStorage.removeItem(e.storageKey)}catch{}};return{...j,sessionId:S?_.sessionId:void 0,save:e=>{var t;if(!S||!_||x.current!==_||!_.active||(null==(t=e2Z.get(i))?void 0:t.owner)!==_||_.sessionId!==w||_.retiring||!_.value.ready||_.value.pendingOrder||_.discarded)return;let l=i.getTempOrder();if(!l||e22(l)){try{v&&sessionStorage.removeItem(v)}catch{}return}if(l===_.order&&(_.lastState=e,v&&g))try{sessionStorage.setItem(v,JSON.stringify({version:2,scopeKey:n,cacheId:g,sessionId:_.sessionId,order:l,state:e}))}catch{}},discard:e=>{_&&_.sessionId===w&&(_.discarded=!0,N(_))},restart:()=>{let e=e2Z.get(i);if(!S||!_||!e||x.current!==_||!_.active||_.refs<=0||e.owner!==_||_.sessionId!==w||_.retiring)return Promise.resolve(!1);if(_.restarting)return _.restarting;let t=k.current,l=_.sessionId,a=()=>x.current===_&&e.owner===_&&_.active&&_.refs>0&&_.sessionId===l,n=e=>{a()&&(_.order=i.getTempOrder(),_.lastState=e.state,_.value=e,e24(_))},r=e.tail.then(async()=>{if(!a())return!1;if(e.orderOwner=_,e.orderSessionId=l,"kiosk"!==d&&("function"!=typeof i.syncAuthenticatedOrderCustomer||"function"!=typeof i.clearOrderCustomer))throw Error("This booking service version cannot safely synchronize the signed-in customer. Please update the service before continuing.");if(N(_),n({ready:!1,restored:!1,pendingOrder:!1,state:t.initialState}),await t.create(),!a())return!1;if(e22(i.getTempOrder()))return n({ready:!0,restored:!1,pendingOrder:!0,state:t.initialState}),!1;if("kiosk"!==d){let e=await i.syncAuthenticatedOrderCustomer();if(!a())return!1;if(!1===e)i.clearOrderCustomer();else if(!0!==e)throw Error("The booking service did not confirm customer synchronization. Please reload before continuing.")}return!!a()&&(await t.refresh(),!!a()&&(_.order=i.getTempOrder(),_.lastState=t.initialState,_.discarded=!1,_.sessionId=`${Date.now()}:${++e2Q}`,e.orderSessionId=_.sessionId,_.value={ready:!0,restored:!1,pendingOrder:e22(_.order),state:t.initialState},e24(_),!_.value.pendingOrder))}).catch(e=>{if(!a())return!1;throw _.value={..._.value,ready:!1,error:e instanceof Error?e.message:String(e)},e24(_),e});_.restarting=r;let o=()=>{_.restarting===r&&(_.restarting=void 0)};return e.tail=r.then(o,o),r},retire:function(){let{canRetire:e=()=>!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e2Z.get(i);return"kiosk"===d&&_&&t&&_.source===i&&_.sessionId===w&&e()&&(t.owner===_||t.orderOwner===_)?e28(_,t,w,e):Promise.resolve(!1)},ownsSession:()=>{let e=e2Z.get(i);return!!_&&_.source===i&&_.sessionId===w&&!!e&&(e.owner===_||!e.owner&&e.orderOwner===_&&e.orderSessionId===w)},finishSubmitted:e=>{let t=e2Z.get(i),l=String(e??"").trim();if(!_||!t||!w||!e2X(l)||_.source!==i||_.sessionId!==w||_.scopeKey!==n||_.cacheId!==g)return Promise.resolve(!1);let a=_.submittedFinish;if((null==a?void 0:a.orderId)===l&&a.sessionId===w)return a.promise;let r=i.getTempOrder(),o=()=>{var e;return e2Z.get(i)===t&&t.owner===_&&_.source===i&&_.sessionId===w&&_.scopeKey===n&&_.cacheId===g&&e2J(i)===g&&(null==(e=i.otherParams)?void 0:e.businessCode)===h&&i.getTempOrder()===r&&String((null==r?void 0:r.order_id)??"").trim()===l};if(!r||!o())return Promise.resolve(!1);let s=k.current,d=t.tail.then(async()=>{var e;if(!o())return!1;if("function"!=typeof i.restoreOrder)throw Error("This booking service cannot safely reset the submitted order.");return _.discarded=!0,N(_),await i.restoreOrder(),t.owner===_&&_.active&&_.refs>0&&_.sessionId===w&&e2J(i)===g&&(null==(e=i.otherParams)?void 0:e.businessCode)===h&&await s.refresh(),!0}),c={orderId:l,sessionId:w,pending:!0,promise:d};_.submittedFinish=c;let u=()=>{c.pending=!1,t.owner!==_||_.active||0!==_.refs||(t.owner=void 0)};return t.tail=d.then(u,u),d}}}({source:q,enabled:eU.current()||!1!==e.isActive&&"pending"!==$.catalogState,scopeKey:L,create:async()=>(await $.clearCartAndReset(),$.createNew()),refresh:e4,initialState:Y.current,customerMode:B?"kiosk":"web",persistDraft:!B,canRetire:()=>!eU.current(),waitForRetire:()=>eY.current(),retire:B?async()=>{var e;await $.clearCartAndReset(),await e1(),null==(e=q.clearSessionStorageOrderSnapshot)||e.call(q)}:void 0}),e8=(b={mode:E,os:q,sessionId:e3.sessionId,date:W,step:Z},_=Rd(),(w=(0,eC.useRef)({input:b,logger:_})).current={input:b,logger:_},(S=(0,eC.useRef)()).current||(j=(x={readContext:()=>w.current.input,getLogger:()=>w.current.logger}).flowId,N=0,C=0,S.current={capture(){try{var e,t;let l,i,a=x.readContext(),n=x.getLogger(),r=(e=>{if(!e)return{};try{let t=new URL(e);if(!t.host)return{};let l=e2k(t.searchParams.get("cacheId"))||e2k(t.searchParams.get("cache_id"));t.username="",t.password="",t.hash="";let i=[];return t.searchParams.forEach((e,t)=>i.push(t)),i.forEach(e=>{e2_.has(e.toLowerCase())||t.searchParams.set(e,"[redacted]")}),{pageUrl:t.href,pagePath:t.pathname,pageHost:t.host,urlCacheId:l}}catch{return{}}})((x.getPageUrl||(()=>"u"<typeof window?void 0:window.location.href))()),o=a.os,s={};try{s=(null==o?void 0:o.otherParams)||{}}catch{}let d=e2k(s.cacheId);try{d=e2k(null==o||null==(e=o.getCacheId)?void 0:e.call(o))||d}catch{}try{let e=null==o||null==(t=o.getTempOrder)?void 0:t.call(o);l=e2k(null==e?void 0:e.order_id),i=e2k(null==e?void 0:e.external_sale_number)}catch{}j||(j=(()=>{try{if("u">typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();if("u">typeof crypto&&"function"==typeof crypto.getRandomValues)return Array.from(crypto.getRandomValues(new Uint32Array(4)),e=>e.toString(16).padStart(8,"0")).join("")}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`})());let c=Object.freeze({source:"materials",layer:"ui",module:"venueBookingSales",category:"business",template:a.mode,templateId:"tickets"===a.mode?"ticketing_1":"party_1",...r,cacheId:r.urlCacheId||d,osCacheId:d,materialSessionId:e2k(a.sessionId),flowId:j,operationId:`${j}:${++N}`,date:e2k(a.date),step:e2k(a.step),platform:e2k(s.platform),businessCode:e2k(s.businessCode??s.business_code),shopId:e2k(s.shopId),orderId:l,externalSaleNumber:i});return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"info";try{if("function"!=typeof(null==n?void 0:n.addLog))return;let i=n.addLog({type:l,title:`[VenueBookingSales][${c.template}] ${e}`,metadata:{...c,action:e,eventSequence:++C,payload:{...t}}});i&&"function"==typeof i.then&&Promise.resolve(i).catch(()=>{})}catch{}}}catch{return e2b}}}),S.current),e6=(0,eC.useCallback)(()=>{if(eQ.current&&"party"===E){var e;e8.capture()("product_confirmed"),null==(e=eZ.current)||e.call(eZ)}},[E,e8]),e5=(0,eC.useRef)(),[e7,e9]=(0,eC.useState)(),te=!!e3.sessionId&&e7===e3.sessionId;(0,eC.useEffect)(()=>{var e,t,l,i,a,n,r,o;if(!e3.ready||!e3.sessionId||e5.current===e3.sessionId)return;e5.current&&(++eK.current,eo(void 0),ed(void 0),eu(void 0),em(void 0),eh(void 0),ef(!1),en(B?"product":"date"),ez(void 0),eF(!1),eb(void 0),eN(void 0),eI(!1),eA(!1),ek(!1),eH(!1),eV.current=!1,A.close()),e5.current=e3.sessionId;let s=e3.state,d=q.getTempOrder(),c=e1F(d,{mode:E,scopeKey:L,date:null==s?void 0:s.date});K(function(e){if(!e.todayOnly)return e3F(e.savedDate)?e.savedDate:e.initialDate;if(e.hasSelection){if(e3F(e.savedDate))return e.savedDate;if(e3F(e.orderDate))return e.orderDate}return e.today}({todayOnly:B,today:U,initialDate:Y.current.date,savedDate:null==s?void 0:s.date,orderDate:null==(e=c.bindings[0])?void 0:e.date,hasSelection:!!((null==s?void 0:s.partyPreview)||e3.pendingOrder||eU.current()||(null==d||null==(t=d.products)?void 0:t.length)||(null==d||null==(l=d.bookings)?void 0:l.length))})),ee(B),"party"===E&&e3.restored&&(null==s?void 0:s.partyPreview)?(em({value:s.partyPreview,attempt:0}),ee(!0)):((null==(i=q.getTempOrder())?void 0:i.bookings)||[]).length&&ee(!0);let u=e1H(O,L);J((o={savedStep:null==s?void 0:s.step,restored:e3.restored,canResume:!e3.pendingOrder&&!("party"===E&&(null==s?void 0:s.partyPreview))&&!!((null==s?void 0:s.date)&&/^\d{4}-\d{2}-\d{2}$/.test(s.date)&&s.date>=U)&&c.bindings.length>0&&0===c.issues.length&&c.bindings.every(e=>e.date===(null==s?void 0:s.date)),holderRequired:u.required,holderComplete:u.complete,hasExtras:!!(null==(a=z.steps.extras)?void 0:a.catalog.menuListIds.length)||e1_((null==(n=q.getTempOrder())?void 0:n.products)||[],{mode:E,scopeKey:L,parentLineUid:null==(r=c.bindings[0])?void 0:r.productLineUid}).length>0}).restored&&o.canResume&&"string"==typeof o.savedStep&&["holder","extras","review","payment"].includes(o.savedStep)?o.holderRequired&&!o.holderComplete?"holder":"holder"===o.savedStep?o.holderRequired?"holder":o.hasExtras?"extras":"review":"extras"===o.savedStep&&o.hasExtras?"extras":"review":"select"),e9(e3.sessionId)},[e3.ready,e3.sessionId,e3.state]);let tt="party"!==E?void 0:(null==es?void 0:es.partyDraft)?e3P({...es.partyDraft,configuration:es.configuration},"configuration"):er?(null==ec?void 0:ec.key)===er.key?ec.value:e3P(er,"booking"):void 0,tl=(null==ep?void 0:ep.value)||tt,ti=JSON.stringify(tl),ta=JSON.stringify((null==(c=$.tempOrder)?void 0:c.contacts_info)??null),tn=q.getTempOrder(),tr=(k={todayOnly:B,today:U,date:W,active:!1!==e.isActive,ready:e3.ready&&te,hasSelection:!!((null==tn||null==(u=tn.products)?void 0:u.length)||(null==tn||null==(p=tn.bookings)?void 0:p.length)||er||es||tl||ep||ev),operationPending:!!(e3.pendingOrder||eU.current()||eV.current||ex||eM||eP||e_||ej||eB)}).todayOnly&&k.active&&k.ready&&k.date!==k.today&&!k.hasSelection&&!k.operationPending;(0,eC.useEffect)(()=>{var e,t,l,i;!tr||eU.current()||eV.current||null!=(t=q.getTempOrder())&&null!=(e=t.products)&&e.length||null!=(i=q.getTempOrder())&&null!=(l=i.bookings)&&l.length||(++eK.current,K(U),ee(!0),en("product"))},[tr,U,q,L,e3.sessionId]),(0,eC.useEffect)(()=>{te&&!tr&&e3.save({date:W,step:"payment"===Z?"review":Z,...tl?{partyPreview:tl}:{}})},[e3.ready,e3.sessionId,te,ep,W,Z,F.tempOrder,eD,ti,ta,tr]);let to=e3.ready&&te&&!ep&&!e3.pendingOrder&&!1!==e.isActive&&!eB&&!tr,ts=(0,eC.useRef)();(0,eC.useEffect)(()=>{let e=ts.current;to&&(!e||e.sessionId!==e3.sessionId||e.step!==Z)&&(ts.current={sessionId:e3.sessionId,step:Z},e8.capture()("step_entered",{step:Z,restored:e3.restored}))},[to,Z,e3.sessionId,e3.restored,e8]);let td=JSON.stringify($.salesSettings??null,(e,t)=>!t||"object"!=typeof t||Array.isArray(t)?t:Object.fromEntries(Object.keys(t).sort().map(e=>[e,t[e]]))),tc=(0,eC.useMemo)(()=>{var e;let t,l,i;return e={ensureSalesSettings:$.ensureSalesSettings,getPlatform:()=>{var e;return $.salesSettingsPlatform||(null==(e=q.otherParams)?void 0:e.platform)}},l=()=>{if(t)return t;let l=Promise.resolve().then(async()=>{let t=await e.ensureSalesSettings();if(!t)throw Error("The booking sales settings are unavailable.");return{settings:t,platform:e.getPlatform()}});t=l;let i=()=>{t===l&&(t=void 0)};return l.then(i,i),l},Object.assign((i=e=>async t=>{let{settings:l,platform:i}=await e(),a={source:"picoding",settings:l,platform:i};return{requiredOptionValidation:l.product.checkRequiredOptions,overSold:1===iO({productOverSold:t.over_sold,runtimePolicy:a}),runtimePolicy:a}})(l),{createBatch(){let e;return i(()=>e||(e=l()))}})},[$.ensureSalesSettings,td,$.salesSettingsPlatform,q,L]),tu=e1g({os:q,scopeKey:L,sessionId:e3.sessionId,menuListIds:e0.menuListIds,poolRole:"main"}),tp=e1g({os:q,scopeKey:`${L}:extras`,sessionId:e3.sessionId,menuListIds:(null==(m=z.steps.extras)?void 0:m.catalog.menuListIds)||[],poolRole:"extras"}),tm=(0,eC.useCallback)(()=>{var e;null==(e=tu.retry)||e.call(tu),eE(e=>e+1)},[tu]),tg=JSON.stringify([L,e3.sessionId]),th=(0,eC.useRef)(tg);th.current=tg;let tv=(0,eC.useCallback)(()=>{ei.current=tg,el(tg)},[tg]),tf=et===tg,ty=(0,eC.useMemo)(()=>(function(e){if(!e0m(e))return;let t=new Date(`${e}T12:00:00Z`),l=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+2,0,12)).getUTCDate();return{startDate:e,endDate:new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,Math.min(t.getUTCDate(),l),12)).toISOString().slice(0,10)}})(U),[U]),tb=(0,eC.useMemo)(()=>{var e,t,l,i;return!e3.restored||!(null==(e=e3.state)?void 0:e.partyPreview)&&(!(null==(t=e3.state)?void 0:t.date)||e3.state.date<=U)&&!((null==(l=q.getTempOrder())?void 0:l.products)||[]).length&&!((null==(i=q.getTempOrder())?void 0:i.bookings)||[]).length},[e3.sessionId,e3.restored,q,L]),tx=B||!tb||X||tf||((null==(g=q.getTempOrder())?void 0:g.bookings)||[]).length?void 0:ty,tk=B?{startDate:W,endDate:W}:tx&&W>=tx.startDate&&W<=tx.endDate?tx:e0G(W,G),t_=e1u({os:q,ready:to,catalog:e0,date:W,customerId:e2,scopeKey:L,revision:eD,operationLog:e8,projectionDateRange:tk,queries:tu,onRetry:tm,mode:"tickets"===E?"ticket":"party",resolvePolicy:tc}),tw=q.getTempOrder()||F.tempOrder,tS=e1F(tw,{mode:E}),tj="party"===E?tS.bindings[0]:void 0,tN=!!(null==(h=z.steps.extras)?void 0:h.catalog.menuListIds.length),tC=e1u({os:q,ready:to,operationLog:e8,catalog:null==(v=z.steps.extras)?void 0:v.catalog,date:U,retailTimeZone:T.timeZone,customerId:e2,scopeKey:`${L}:extras`,retail:!0,queries:tp,revision:+(tS.bindings.length>0)}),tM=e1D({os:q,cart:F,mode:E,timeZone:T.timeZone,beforeMutate:I.assertCanMutate,parentLineUid:null==tj?void 0:tj.productLineUid,scopeKey:L,customerId:e2,productLoadParams:{menu_list_ids:(null==(f=z.steps.extras)?void 0:f.catalog.menuListIds)||[]},catalog:tC,catalogSession:tp,onMutated:e1,resolveSelectionPolicy:async e=>{let t=await tL(e);return{...t,overSold:1===t.overSold}}}),tT=function(e){var t;let l,i,a,n,r,o,s,d,c,u,p,m,g=(0,eC.useRef)(e);g.current=e;let h=(0,eC.useRef)(!0),[,v]=(0,eC.useState)(0),f=(0,eC.useRef)();return f.current||(a=(t={getOwner:()=>g.current.getOwner(),productId:e=>String(e.id),readQuantity:e=>g.current.readQuantity(e),applyQuantity:(e,t)=>g.current.applyQuantity(e,t),refreshActual:()=>g.current.refreshActual(),onError:e=>{h.current&&g.current.onError(e)},onChange:()=>{h.current&&v(e=>e+1)}}).getOwner(),n=0,r=!1,o=!1,s=new Map,d=()=>{void 0!==l&&clearTimeout(l),l=void 0},c=(e,l)=>!r&&l===n&&e1m(e,t.getOwner()),u=()=>{r||t.onChange()},p=()=>{let e=t.getOwner();e1m(a,e)||(a=e,n+=1,s.clear(),d(),u())},m=()=>{if(r||o||!s.size)return;d();let e=s.values().next().value;l=setTimeout(async()=>{if(l=void 0,!r&&!o){o=!0;try{for(;!r&&s.size;){p();let l=s.entries().next().value;if(!l)break;let[r,o]=l,d=a,m=n;try{var e;let l=t.readQuantity(o.product);if(!Number.isSafeInteger(l)||l<0)throw Error("The extra quantity is unavailable. Please review the cart.");if(l===o.quantity){s.delete(r),u();continue}let a=o.quantity;i={owner:d,generation:m,intent:o};let n=await t.applyQuantity(o.product,a);if(!c(d,m)){i=void 0,p();continue}if(i=void 0,"function"==typeof n){s.clear(),u(),await n(()=>c(d,m));break}if(!n){s.clear(),u();break}let g=t.readQuantity(o.product),h=a<l&&g>=a&&g<l;if(!Number.isSafeInteger(g)||g<0||g!==a&&!h)throw Error("The extra quantity changed while updating. Please review the cart.");(null==(e=s.get(r))?void 0:e.quantity)===g&&s.delete(r),u();break}catch(e){if(!c(d,m)){i=void 0,p();continue}try{await t.refreshActual()}catch{}i=void 0,c(d,m)&&(s.clear(),u(),t.onError(e));break}}}finally{i=void 0,o=!1,m()}}},Math.max(0,Math.min(e.lastAt+200,e.firstAt+400)-Date.now()))},f.current={enqueue(e,l,a){var n;let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(r||!Number.isSafeInteger(l)||!Number.isSafeInteger(a))return;p();let d=t.productId(e);if(!d)return;let c=t.readQuantity(e);if(!Number.isSafeInteger(c)||c<0)return;let g=((null==(n=s.get(d))?void 0:n.quantity)??c)+l-a,h=Math.max(0,Number.isSafeInteger(o.min)?o.min:0),v=Math.max(h,Number.isSafeInteger(o.max)?o.max:Number.MAX_SAFE_INTEGER),f=g<=0?0:Math.min(v,Math.max(h,g));if(!Number.isSafeInteger(f))return;let y=Date.now(),b=s.get(d);s.set(d,{product:e,quantity:f,firstAt:b===(null==i?void 0:i.intent)?y:(null==b?void 0:b.firstAt)??y,lastAt:y}),u(),m()},isPending:()=>!r&&e1m(a,t.getOwner())&&(s.size>0||!!i&&i.generation===n&&e1m(i.owner,a)),getTargets:()=>!r&&e1m(a,t.getOwner())?Array.from(s).reduce((e,t)=>{let[l,i]=t;return e[l]=i.quantity,e},{}):{},reconcileOwner:p,dispose(){r=!0,n+=1,s.clear(),d()}}),(0,eC.useEffect)(()=>{var e;null==(e=f.current)||e.reconcileOwner()}),(0,eC.useEffect)(()=>()=>{var e;h.current=!1,null==(e=f.current)||e.dispose()},[]),{changeQuantity:(e,t,l)=>{var i,a;if(!h.current||!g.current.canChange())return;let n=1===Number(e.is_track)&&0===Number(e.over_sold)?Number(e.stock_quantity):200,r=Math.max(0,Math.min(Number.isFinite(n)?n:200,Number((null==(i=e.item_rule_limit)?void 0:i.remainingMax)??200)));f.current.enqueue(e,t,l,{min:Number((null==(a=e.item_rule_limit)?void 0:a.min)??0),max:Math.floor(r)})},isPending:f.current.isPending,pending:f.current.isPending(),quantities:f.current.getTargets()}}({getOwner:()=>{var t;let l=eXv(q.getTempOrder());return[q,l&&"object"==typeof l?e3.sessionId:l,null==(t=q.getTempOrder())?void 0:t.customer_id,L,e3.sessionId,e2,E,null==tj?void 0:tj.productLineUid,tp,to,!1!==e.isActive]},readQuantity:e=>{var t;return e1_((null==(t=q.getTempOrder())?void 0:t.products)||[],{mode:E,scopeKey:L,parentLineUid:null==tj?void 0:tj.productLineUid}).filter(t=>String(t.product_id)===String(e.id)).reduce((e,t)=>e+Number(t.num||0),0)},applyQuantity:async(e,t)=>{let l=await tM.setProductQuantity(e,t);if("cancelled"===l.status)return!1;if("invalid"===l.status)throw Error(l.issues.map(e=>e.message).join(" "));return!!["added","updated","unchanged"].includes(l.status)||(t=>tz(async()=>{t()&&await tB(l,t)},e.id))},refreshActual:()=>{F.refreshCartSnapshot()},onError:e=>eb(e instanceof Error?e.message:String(e)),canChange:()=>!tG&&!eV.current}),tI=tT.isPending,tP=tM.rows.length>0||tN&&(tC.loading||!!tC.error||tC.products.some(e1p)),tA=!e0.menuListIds.length||!t_.loading&&!t_.error&&!t_.products.length,tD=tA||t_.loading||!!t_.error;(0,eC.useEffect)(()=>{!(!to||"payment"===Z||eU.current())&&("select"!==Z&&(tA||t_.error)?(en("product"),J("select")):"extras"!==Z||tP?"review"===Z&&tC.error&&J("extras"):J(e1H(O,L).complete?"review":"holder"))},[to,Z,tA,t_.error,tP,tC.error,O,L]);let tE=function(e){var t,l;let i=Array.from(new Set(e.dates)).sort().join(","),a=e.catalog.menuListIds.join(","),n=(0,eC.useMemo)(()=>e1h(e.searchRange),[null==(t=e.searchRange)?void 0:t.startDate,null==(l=e.searchRange)?void 0:l.endDate]),r=n.join(","),o=r||i,s=(0,eC.useMemo)(()=>({}),[e.os,e.ready,a,e.customerId,e.scopeKey,e.revision,e.resolvePolicy,e.mode,e.queries]),d=(0,eC.useMemo)(()=>({...e,queryScope:s,searchDates:n,menuIds:[...e.catalog.menuListIds]}),[e.os,e.ready,o,r,a,e.customerId,e.scopeKey,e.revision,e.resolvePolicy,e.mode,e.queries]),c=(0,eC.useMemo)(()=>i?i.split(","):[],[i]),u=(0,eC.useMemo)(()=>Array.from(new Set([...n,...c])).sort(),[n,c]),p=(0,eC.useMemo)(()=>u.reduce((e,t)=>(e[t]={status:d.menuIds.length?"loading":"unavailable"},e),{}),[d,u]),[m,g]=(0,eC.useState)(),h=(0,eC.useRef)(d);h.current=d;let v=(0,eC.useRef)(),f=(0,eC.useMemo)(()=>{var e;return{states:!r&&(null==(e=v.current)?void 0:e.searching)&&v.current.queryScope===s?{...v.current.states}:{},pending:new Set,visibleDates:c,projectionDates:u,pump:void 0}},[d]);(0,eC.useEffect)(()=>{v.current={queryScope:s,searching:!!r,states:f.states}},[f,s,r]);let y=(0,eC.useRef)(0),b=(0,eC.useRef)();return(0,eC.useEffect)(()=>{var e,t;let l=!0,i=()=>l&&h.current===d;if(g({request:d,states:{...f.states}}),!d.ready||!d.menuIds.length)return()=>{l=!1};let a=(null==(e=(t=d.resolvePolicy).createBatch)?void 0:e.call(t))??d.resolvePolicy,n=(e,t)=>{i()&&(f.states[e]=t,g({request:d,states:{...f.states}}))},r=async e=>{let t=f.projectionDates;try{let l=await d.queries.queryCatalogSnapshot({menu_list_ids:d.menuIds,schedule_date:e,...d.customerId?{customer_id:Number(d.customerId)}:{}});if(!i())return;let r=!1,o=!1;if(l.length){let n=await e1d(d.os,{products:l,productsFromSessionSnapshot:!0,date:e,mode:d.mode,queries:d.queries,projectionDateRange:e0G(e,t),catalogParams:{menu_list_ids:d.menuIds,...d.customerId?{customer_id:d.customerId}:{}},resolvePolicy:a,isCurrent:i,stopAtFirstAvailable:!0});r=n.available,o=!0===n.requiresConfiguration}n(e,{status:r?"available":o?"configuration":"unavailable"})}catch(t){n(e,{status:"error",reason:t instanceof Error?t.message:String(t)})}finally{var l;f.pending.delete(e),y.current--,null==(l=b.current)||l.call(b)}},o=e=>!f.pending.has(e)&&(!f.states[e]||"loading"===f.states[e].status),s=()=>{for(let t of d.searchDates){var e;let l=null==(e=f.states[t])?void 0:e.status;if("available"===l||"configuration"===l||"error"===l)break;if(o(t))return t}return f.visibleDates.find(o)},c=()=>{for(;i()&&y.current<2;){let e=s();if(!e)break;f.pending.add(e),y.current++,r(e)}};return f.pump=c,b.current=c,c(),()=>{l=!1,f.pump===c&&(f.pump=void 0),b.current===c&&(b.current=void 0)}},[d,f]),(0,eC.useEffect)(()=>{var e;f.visibleDates=c,f.projectionDates=u,null==(e=f.pump)||e.call(f)},[f,c,u]),(0,eC.useMemo)(()=>({...p,...(null==m?void 0:m.request)===d?m.states:f.states}),[m,d,p,f])}({os:q,ready:to&&!B,catalog:e0,dates:B?[]:G,customerId:e2,scopeKey:L,revision:eD,searchRange:tx,queries:tu,mode:"tickets"===E?"ticket":"party",resolvePolicy:tc}),tO=(0,eC.useRef)({date:W,scopeKey:L,customerId:e2,ready:to,sessionId:e3.sessionId,composerKey:null==er?void 0:er.key});tO.current={date:W,scopeKey:L,customerId:e2,ready:to,sessionId:e3.sessionId,composerKey:null==er?void 0:er.key};let tz=async(e,t)=>{if(!(eV.current||!to||tI())){eV.current=!0,ek(!0),eb(void 0),ew(null==t?void 0:String(t));try{await e()}catch(e){eQ.current&&eb(e instanceof Error?e.message:String(e))}finally{eV.current=!1,eQ.current&&(ek(!1),ew(void 0))}}},tL=async e=>{var t;let l=await $.ensureSalesSettings();if(!l)throw Error(V("Sales settings are unavailable. Please try again.","销售配置未就绪,请重试。"));return{overSold:iO({productOverSold:e.over_sold,runtimePolicy:{source:"picoding",settings:l,platform:$.salesSettingsPlatform||(null==(t=q.otherParams)?void 0:t.platform)}}),requiredOptionValidation:l.product.checkRequiredOptions}},tR=async function(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=arguments.length>3?arguments[3]:void 0,a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],n=e8.capture();a&&n("product_selected",{productId:e.id,editing:!!t,selectedDate:W});let r=t_.products.find(t=>String(t.id)===String(e.id))||e,o=r.price,s=("string"==typeof o||"number"==typeof o)&&""!==String(o).trim()&&Number.isFinite(Number(o))&&Number(o)>=0?Rv(r):void 0,d=null==s?void 0:s.amount,c="party"===E&&!i&&!t&&l;c&&(null==tt?void 0:tt.productId)===Number(e.id)&&(i=tt),"tickets"===E&&eo(void 0),ed(void 0),"party"!==E||t||Number(null==tj?void 0:tj.line.product_id)!==Number(e.id)||(t=null==tj?void 0:tj.productLineUid);let u=++eK.current,p={...tO.current},m=()=>eQ.current&&u===eK.current&&tO.current.scopeKey===p.scopeKey&&tO.current.date===p.date&&tO.current.customerId===p.customerId&&tO.current.sessionId===p.sessionId;eG.current=u,eN(String(e.id));try{var g;let n,r,o=B&&a?e07():void 0;if(o&&(await o,!m()))return!1;let p={menu_list_ids:e0.menuListIds,product_id:e.id,schedule_date:W,...e2?{customer_id:e2}:{},with_count:["bundleGroup","optionGroup"],with_schedule:1},h=a?await tu.prepareProductDetail({...p,retry:!0}):await tu.queryCatalogProductDetail(p);if(!m())return!1;if(t){let e=await e1B({os:q,queries:tu,mode:E,catalog:e0,scopeKey:L,customerId:e2,isCurrent:m});if(!(n=e.bindings.find(e=>e.productLineUid===t)))throw Error(e.issues.map(e=>e.message).join(" ")||"This booking could not be loaded.")}if(!m())return!1;let v=h&&n?{...h,_extend:{...h._extend,...(null==(g=n.product._extend)?void 0:g.capacity)?{capacity:n.product._extend.capacity}:{}}}:h;if(!v)throw Error(V("This product is no longer in this menu.","当前菜单已不包含该商品。"));let f=await tL(v);if(!m())return!1;let y=`${L}:${u}:${Date.now()}`,b=iD({productDetail:v,requestedProductId:e.id,completeness:"complete",mode:"tickets"===E?"ticket-booking":"product-configuration",openId:y,scopeKey:L,detailRevision:y,selectionKey:t||e.id,intent:t||i?"edit-draft":"create"});if("invalid"===b.status)throw Error(b.issues.map(e=>e.message).join(" "));let x=null==i?void 0:i.configuration,k=(null==x?void 0:x.skuValue)||(null==n?void 0:n.skuValue),_=k?iM(v,k,{...f,overSold:1===f.overSold}):void 0,w="ready"===b.status?b.plan.productDetail:b.productDetail,S=x?{...x,skuValue:_||x.skuValue}:n?{skuValue:_||n.skuValue,variantDraft:null}:e3q(w,1===f.overSold);if(i&&!_&&"no-configuration"===b.status)throw Error(V("The saved options are no longer available. Choose this Party again.","已保存的选项已不可用,请重新选择 Party 商品。"));let j={key:y,catalogStartingAmount:d,catalogPriceQualifier:null==s?void 0:s.qualifier,detail:w,configuration:S,lineUid:"party"===E?null==tj?void 0:tj.productLineUid:t,quantity:null==i?void 0:i.quantity,initialSelection:i?(r=i,e3I(r.selection)):null==n?void 0:n.selection,...f};return"tickets"===E&&"ready"===b.status&&"ticket-booking"===b.plan.mode?eo({...j,plan:b.plan}):"party"===E&&!l&&_?eo(j):"no-configuration"===b.status?(eo(j),en("time"),c&&e6(),D("#party-time")):"product-configuration"===b.plan.mode&&ed({plan:b.plan,configuration:S,partyDraft:j,...f}),J("select"),!0}catch(t){throw a&&n("product_open_failed",{productId:e.id,...e2x(t)},"warning"),t}finally{eQ.current&&u===eG.current&&eN(void 0)}};(0,eC.useEffect)(()=>{if(!te||!e3.ready||e3.pendingOrder||!1===e.isActive||!ep)return;let t=!0;return ef(!0),eh(void 0),(async()=>{try{let e=function(e){if((null==e?void 0:e.version)!==1||!["configuration","booking"].includes(e.phase))throw Error("Invalid saved Party preview.");return e3P({detail:{id:e.productId},quantity:e.quantity,lineUid:e.lineUid,configuration:e.configuration,initialSelection:e.selection},e.phase)}(ep.value),l=await tR({id:e.productId},e.lineUid,"configuration"===e.phase,e,!1);if(!t)return;if(!l)throw Error(V("The draft changed. Retry restoring your Party selection.","草稿已变化,请重试恢复 Party 选择。"));en("time"),em(void 0)}catch(e){t&&eh(e instanceof Error?e.message:String(e))}finally{t&&ef(!1)}})(),()=>{t=!1,++eK.current}},[te,e3.ready,e3.pendingOrder,e.isActive,ep,q,L,W,e2]);let t$=async(e,t)=>{if(tK||er||es||tO.current.scopeKey!==L||tO.current.sessionId!==e3.sessionId||tO.current.customerId!==e2)return!1;let l=!1;return await tz(async()=>{let i=q.getTempOrder(),a=eXv(i),n=null==i?void 0:i.customer_id,r={...tO.current},o=()=>eQ.current&&tO.current.ready&&tO.current.scopeKey===r.scopeKey&&tO.current.sessionId===r.sessionId&&tO.current.customerId===r.customerId&&(null==i?void 0:i.customer_id)===n&&q.getTempOrder()===i&&eXv(i)===a,s=new Set(e);if(!i||Number(i.order_id||0)>0||!s.size||s.size!==e.length||e.some(e=>!e))throw Error(V("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));let d=i.products||[],c=d.filter(e=>s.has(e1E(e))),u="tickets"===E?"tickets":"party_main";if(c.length!==s.size||c.some(e=>{var t,l;return(null==(t=e.metadata)?void 0:t.venue_booking_role)!==u||(null==(l=e.metadata)?void 0:l.venue_booking_scope_key)!==L})||new Set(c.map(e1E)).size!==s.size)throw Error(V("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));if(t&&("tickets"!==E||0!==t.index||1!==s.size||!s.has(t.uid)||1!==Number(c[0].num)))throw Error(V("This saved ticket cannot be removed individually. Remove its cart group instead.","此历史门票无法逐张删除,请删除对应购物车组。"));let p="tickets"===E&&!d.some(e=>{var t,l;return(null==(t=e.metadata)?void 0:t.venue_booking_role)==="tickets"&&(null==(l=e.metadata)?void 0:l.venue_booking_scope_key)===L&&!s.has(e1E(e))}),m=d.filter(e=>{var t,l,i;return s.has(e1E(e))||(null==(t=e.metadata)?void 0:t.venue_booking_scope_key)===L&&("party"===E&&(null==(l=e.metadata)?void 0:l.venue_booking_role)==="party_extra"&&s.has(String(e.metadata.venue_booking_parent_uid||""))||p&&(null==(i=e.metadata)?void 0:i.venue_booking_role)==="tickets_extra")}),g=new Set(m.map(e1E));if(g.has("")||g.size!==m.length||d.filter(e=>g.has(e1E(e))).length!==m.length)throw Error(V("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));let h=JSON.stringify([i.products,i.bookings,i.notes,i.holder_relations]),v=()=>{if(!o()||h!==JSON.stringify([i.products,i.bookings,i.notes,i.holder_relations]))throw Error(V("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"))};if("function"!=typeof q.removeProductsFromOrder)throw Error("The booking cart service needs to be updated.");v();try{if(await q.removeProductsFromOrder(m.map(e_f),{beforeApply:v,isCurrentOrder:o}),!o())return;F.refreshCartSnapshot(),eE(e=>e+1),e1H(O,L).enabled||eA(!1),eo(void 0),e1F(q.getTempOrder(),{mode:E,scopeKey:L}).bindings.length||(eA(!1),J("select")),l=!0}catch(e){throw o()&&(F.refreshCartSnapshot(),eE(e=>e+1),e1H(O,L).enabled||eA(!1),e1F(q.getTempOrder(),{mode:E,scopeKey:L}).bindings.length||(eA(!1),J("select"))),e}}),l},tF=e=>t$(e),tq=async(e,t)=>{if(B)return e===W;if(!eS()(e).isValid()||e<U)return!1;let l=e8.capture();if(e===W)return ee(!0),en("product"),l("date_selected",{previousDate:W,selectedDate:e}),!0;if(eV.current||tI())return;eV.current=!0,ek(!0);let i=eXv(q.getTempOrder()),a=q.getTempOrder(),n=()=>{if(!eQ.current||!tO.current.ready||tO.current.date!==W||eXv(q.getTempOrder())!==i)throw Error(V("The draft changed. Please choose the date again.","草稿已变化,请重新选择日期。"))};try{let o,s,d=e1F(q.getTempOrder(),{mode:E}).bindings;if("tickets"===E&&d.length){var r;if(!await new Promise(e=>eT.Modal.confirm({title:V("Change the date for this order?","更改整单日期?"),content:V("All tickets will be removed so you can choose them again for the new date.","订单中的全部门票将移除,请按新日期重新选择。"),okText:V("Change date","更改日期"),cancelText:V("Keep date","保留日期"),onOk:()=>e(!0),onCancel:()=>e(!1)}))||!eQ.current)return eQ.current&&l("date_change_cancelled",{previousDate:W,selectedDate:e}),!1;n();let t=e1F(q.getTempOrder(),{mode:E}).bindings,o=e1_((null==(r=q.getTempOrder())?void 0:r.products)||[],{mode:E,scopeKey:L});if(await q.removeProductsFromOrder([...t.map(e=>e.identity),...o.map(e_f)],{isCurrentOrder:()=>eQ.current&&q.getTempOrder()===a&&eXv(q.getTempOrder())===i}),n(),e1F(q.getTempOrder(),{mode:E}).bindings.length)throw Error("The cart changed. Please review the tickets before changing date.");eo(void 0),ed(void 0),await e4()}if(n(),"party"===E&&er){let l=await tu.queryCatalogProductDetail({menu_list_ids:e0.menuListIds,product_id:Number(er.detail.id),schedule_date:e,...e2?{customer_id:e2}:{},with_count:["bundleGroup","optionGroup"],with_schedule:1});if(n(),!l)throw Error(V("This Party is unavailable on the selected date. Choose another date or product.","该商品在所选日期不可用,请选择其他日期或商品。"));let i=await tL(l);n();let a=`${L}:date:${++eK.current}:${Date.now()}`,r=iD({productDetail:l,requestedProductId:er.detail.id,completeness:"complete",mode:"product-configuration",openId:a,scopeKey:L,detailRevision:a,selectionKey:er.lineUid||er.detail.id,intent:"edit-draft"});if("invalid"===r.status)throw Error(r.issues.map(e=>e.message).join(" "));let d=(null==t?void 0:t.configuration)||er.configuration,c=iM(l,d.skuValue,{...i,overSold:1===i.overSold}),u={...er,key:a,detail:l,...i,quantity:(null==t?void 0:t.quantity)??er.quantity,initialSelection:(null==t?void 0:t.initialSelection)||er.initialSelection};c?o={...u,configuration:{skuValue:c,variantDraft:null}}:"ready"===r.status&&"product-configuration"===r.plan.mode?s={plan:r.plan,configuration:d,partyDraft:u,...i}:o={...u,configuration:eXh(Number(l.id))}}return n(),++eK.current,eo(o),ed(s),K(e),ee(!0),en(o?"time":"product"),J("select"),eb(void 0),l("date_selected",{previousDate:W,selectedDate:e}),!0}catch(t){throw l("date_change_failed",{previousDate:W,selectedDate:e,...e2x(t)},"warning"),t}finally{eV.current=!1,eQ.current&&ek(!1)}},tB=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;if(t()){if("invalid"===e.status)throw Error(e.issues.map(e=>e.message).join(" "));if("choose-line"===e.status)return void ez(e.rows);if("direct"===e.status)return void await tM.commit(e.session,e.configuration);if("ready"===e.status){let l=await tL(e.session.productDetail);if(!t())return;let i=e.session.lineUid?e.configuration:e3q(e.plan.productDetail,1===l.overSold);ed({plan:e.plan,configuration:i,extraSession:e.session,...l})}}},tH=()=>{var e;let t=q.getTempOrder(),l={mode:E,scopeKey:L,parentLineUid:null==tj?void 0:tj.productLineUid};if(!e1_((null==t?void 0:t.products)||[],l).length)return!0;if(tC.loading||tC.error)return eb(tC.error||V("The extras menu is loading. Please try again.","附加商品菜单正在加载,请稍后重试。")),J("extras"),A.close(),!1;let i=function(e,t,l){if(!e)return;let i=e1_(e.products||[],l);if(!i.length)return;let a=new Map(t.map(e=>[Number(e.id),e]));return i.find(t=>{let l=a.get(Number(t.product_id)),i=t.product_variant_id;return!!Ho(e1y(l,i,t)).required&&!e1b(l,i,Number(t.num),UO(t,e.holder_relations),e.customer_id??void 0,t)})}(t,tC.products,l);return!i||((e=>{J("extras"),A.close();let t=V("Complete the holder details for this extra.","请补全这件附加商品的 Holder 资料。");if(eb(t),!e||eV.current||tI())return;let l=tO.current,i=eXv(q.getTempOrder()),a=()=>eQ.current&&tO.current.ready&&tO.current.scopeKey===l.scopeKey&&tO.current.sessionId===l.sessionId&&tO.current.customerId===l.customerId&&eXv(q.getTempOrder())===i;tz(async()=>{let l=await tM.prepareEdit(e);if(a()){if("invalid"===l.status)throw Error(l.issues.map(e=>e.message).join(" "));"ready"===l.status&&await tB(l,a),a()&&eb(t)}})})(String((null==(e=i.metadata)?void 0:e.unique_identification_number)??"")),!1)},tV=async()=>{if(tW.pending||tW.error||er||es||!eX.current||!to||tD||tI()||tP&&(tC.loading||tC.error))return!1;eb(void 0);let e=e1H(O,L);if(!e.complete||e.pending||e.blocked)return J("holder"),!1;if(!tH()||!await eX.current.validate())return!1;await F.waitForCartConsistency();let t=eXv(q.getTempOrder()),l={...tO.current};return eQ.current&&tO.current.ready&&tO.current.scopeKey===l.scopeKey&&tO.current.date===l.date&&tO.current.customerId===l.customerId&&eXv(q.getTempOrder())===t&&tH()},tU=function(e){var t;let l=function(e){var t,l,i,a,n;s2(eMn,e.locale),s2(e3n,e.locale);let r=e$(),o=eq(),s=exR(),d=e.context.sales.bookingTicket,c=String((null==d||null==(t=d.otherParams)?void 0:t.platform)||o||"").trim().toLowerCase(),u=null==d||null==(l=d.otherParams)?void 0:l.venueBookingMode,p="kiosk"===c&&("tickets"===u||"party"===u),m=null==r||null==(n=r.appHelper)||null==(a=n.utils)||null==(i=a.getApp)?void 0:i.call(a),g=eA0(m),h=(0,eC.useRef)(e);h.current=e;let v=(0,eC.useRef)(!0),f=(0,eC.useRef)(!1),y=(0,eC.useRef)(!1),b=(0,eC.useRef)(),x=(0,eC.useRef)(new Set),k=(0,eC.useRef)(),_=(0,eC.useRef)(),w=(0,eC.useRef)(),S=(0,eC.useRef)(),[j,N]=(0,eC.useState)(null),[C,M]=(0,eC.useState)(!1),[T,I]=(0,eC.useState)(!1),[P,A]=(0,eC.useState)(null),[D,E]=(0,eC.useState)(),[O,z]=(0,eC.useState)(null),[L,R]=(0,eC.useState)(10),[$,F]=(0,eC.useState)(!1);(0,eC.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,eC.useEffect)(()=>{_.current=void 0,k.current=void 0,w.current=void 0,N(null),E(void 0),z(null),A(null)},[e.scopeKey,e.sessionId,d]);let q=o3(async e=>{if(!p&&!O||f.current||b.current||y.current||!v.current)return!1;let t=h.current.onKioskFinish;if(!t)return!1;y.current=!0,F(!0),A(null);try{if(!await t({navigateHome:e}))throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.reset-failed")));return v.current&&z(null),!0}catch(e){return v.current&&A(e49(e)||String(eL.getText("pisell2.venue-kiosk.checkout.reset-failed"))),!1}finally{y.current=!1,v.current&&F(!1)}}),B=o3(()=>q(!0)),H=o3(()=>q(!1)),V=o3(()=>!!(f.current||b.current)),U=o3(()=>V()?new Promise(e=>{x.current.add(e)}):Promise.resolve()),Y=o3(()=>{if(V())return;let e=[...x.current];x.current.clear(),e.forEach(e=>e())}),W=o3(async()=>{var e;await (null==(e=S.current)?void 0:e.page.onBack())}),K=o3(async()=>{var e,t,l,i,a,n,r,o,d,c,u,x,j,C,T,P,D,L,R,$,F;let q,B,H;if(!p||f.current||b.current||y.current||!1===h.current.isActive||!v.current)return!1;let V=h.current,U=V.context,W=U.sales.bookingTicket;if(!W)return!1;let K=(null==(e=W.getTempOrder)?void 0:e.call(W))??U.sales.tempOrder,G=e3k(K),Q=()=>v.current&&h.current.scopeKey===V.scopeKey&&h.current.sessionId===V.sessionId&&h.current.context.sales.bookingTicket===W,Z=()=>Q()&&!1!==h.current.isActive,J=()=>{var e;if(!Z()||e3k(null==(e=W.getTempOrder)?void 0:e.call(W))!==G)throw Error("BOOKING_SELECTION_CHANGED")},X=e=>{let t=e3x(e);if(t&&Q()&&(_.current=t,E(t),k.current!==t)){var l;k.current=t,null==(l=V.onOrderSubmitted)||l.call(V,t)}};f.current=!0,M(!0),A(null);let ee=!1,et=!1;try{let e,p;if(!await s.ensureCanShop()||!Z())return!1;if(await U.cart.waitForCartConsistency(),J(),_.current&&e3x(null==(c=W.getTempOrder)||null==(d=c.call(W))?void 0:d.order_id)!==_.current){let e=null==(u=W.getTempOrder)?void 0:u.call(W);if((null==e||null==(x=e.products)?void 0:x.length)||(null==e||null==(j=e.bookings)?void 0:j.length)||(await U.sales.loadDetailByRemote(Number(_.current)),!Z()))return!1;K=(null==(C=W.getTempOrder)?void 0:C.call(W))??U.sales.tempOrder,G=e3k(K)}let f=!!(O&&w.current&&w.current.scopeKey===V.scopeKey&&w.current.sessionId===V.sessionId&&w.current.source===W&&(w.current.identity===G||_.current&&e3x(null==(F=W.getTempOrder)||null==($=F.call(W))?void 0:$.order_id)===_.current));if(!f&&V.beforeCheckout&&!await V.beforeCheckout())return!1;J(),b.current=q=g(),B=q.hold(),await q.pause(),J();let y=null==m||null==(i=m.history)||null==(l=i.instance)||null==(t=l.block)?void 0:t.call(l,()=>!1);"function"==typeof y&&(H=y),I(!0);let k=async()=>(J(),(!!f||!!await h.current.beforeSubmit())&&(await U.cart.waitForCartConsistency(),J(),w.current={scopeKey:V.scopeKey,sessionId:V.sessionId,source:W,identity:G},(ee=await s.beginCheckout())&&Z())),M=(null==(a=W.getTempOrder)?void 0:a.call(W))??K,A=(null==(r=W.getOrderAmountSnapshot)||null==(n=r.call(W))?void 0:n.summary)??(null==M?void 0:M.summary)??U.summary.summary,E=e3b(W),el=E.readAmount(W),ei=s.enabled&&!s.requirePaymentOnSubmit;if(!ei&&(void 0===el||!Number.isFinite(el)||el<0))throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")));let ea=0===el;if((ei||ea)&&!_.current){let e=E,t=ei?{paymentExecution:"deferred"}:{},l=await U.cart.submit(t,{validateHolder:!0,beforeSubmit:async()=>{if(!await k())return!1;if(!ei){var l,i;if(e=e3b(W),0!==e.readAmount(W))throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")));Object.assign(t,eUc(null==(i=W.getTempOrder)||null==(l=i.call(W))?void 0:l.payments))}return!0}});if(!Z())return!1;if(!eA5(l))throw Error(e49(l));let i=eUa(l,(null==(T=W.getTempOrder)?void 0:T.call(W))??M);if(!i)throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")));if(X(i.orderId),ea&&!ei){let a=(null==(P=W.getTempOrder)?void 0:P.call(W))??M,n=eUd(l,null==a?void 0:a.summary,A),r=null==(R=W.store)||null==(L=R.order)||null==(D=L.getPaymentCompletion)?void 0:D.call(L);if((null==r?void 0:r.isDepositFullyPaid)===!0&&!0!==r.isOrderFullyPaid){let t=e.inspectCompletion(W,{...r,submitResult:l},"kiosk");if("paid"!==t.kind||"deposit-paid"!==t.paymentStatus)throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")));z({kind:"payment",viewModel:eA_({baseSales:W,status:"deposit-paid",displayMode:"page",currencySymbol:null==a?void 0:a.currency_symbol})})}else if(eUu({result:l,orderId:i.orderId,totalAmount:n}).ok)z({kind:"payment",viewModel:t.confirmPendingVoucherPayments?eA_({baseSales:W,status:"success",displayMode:"page",currencySymbol:null==a?void 0:a.currency_symbol}):eUp({summary:(null==a?void 0:a.summary)??A,currencySymbol:null==a?void 0:a.currency_symbol})});else throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")))}else z({kind:"submitted",order:i});return!0}if(await U.sales.validateHoldersBeforePayment(),J(),U.sales.contactInfo&&!await U.sales.contactInfo.ensureComplete()||!await k())return!1;J();let en=function(e){var t,l;let{baseSales:i,isCurrent:a}=e,n=null==(t=i.getTempOrder)?void 0:t.call(i),r=e3p(null==n||null==(l=n._extend)?void 0:l.localId),o=e3p(null==n?void 0:n.external_sale_number),s=e3h(n);return Object.freeze({assertCurrent(){var e,t;let l=null==(e=i.getTempOrder)?void 0:e.call(i),d=r?e3p(null==l||null==(t=l._extend)?void 0:t.localId)===r:o?e3p(null==l?void 0:l.external_sale_number)===o:l===n;if(!n||!l||!a()||!d||e3h(l)!==s)throw Error("BOOKING_SELECTION_CHANGED")}})}({baseSales:W,isCurrent:Z});en.assertCurrent();let er=e3b(W),eo=er.readAmount(W);if(void 0===eo||!Number.isFinite(eo)||eo<0)throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")));let es=()=>e||(e=(async()=>{try{ee&&b.current===q&&s.endCheckout()}catch(e){console.warn("[VenueBooking] Payment checkout cleanup failed",e)}finally{ee=!1;try{null==H||H()}catch(e){console.warn("[VenueBooking] Payment navigation cleanup failed",e)}H=void 0,null==B||B(),B=void 0,await q.release(),b.current===q&&(b.current=void 0),S.current===p&&(S.current=void 0,v.current&&(N(null),I(!1))),Y()}})()),ed={id:`${V.sessionId||"venue"}:payment:${++e3_}`,preparation:en,paymentPolicy:er,onBack:async()=>{var e,t;if(!p.completed&&Z()&&S.current===p&&er.canReturn(W)){p.completed=!0;try{U.cart.refreshCartSnapshot()}catch(e){console.warn("[VenueBooking] Payment cart refresh failed",e)}finally{await es()}Z()&&(null==(e=(t=h.current).onKioskPaymentPageBack)||e.call(t))}},onPaid:async e=>{if(!p.completed){p.completed=!0;try{if(Q()&&S.current===p){z({kind:"payment",viewModel:e.paymentResult});try{X(e.orderId)}catch(e){console.warn("[VenueBooking] Paid order notification failed",e)}try{U.cart.refreshCartSnapshot()}catch(e){console.warn("[VenueBooking] Paid cart refresh failed",e)}}}finally{await es()}}},onDisposed:async()=>{var e,t;let l=!p.completed&&Q()&&S.current===p;p.completed=!0,await es(),l&&Q()&&(null==(e=(t=h.current).onKioskPaymentPageBack)||e.call(t))}};return S.current=p={page:ed,completed:!1},et=!0,z(null),N(ed),null==(o=V.onKioskPaymentPageOpen)||o.call(V),!0}catch(e){if(e===UN||!Z())return!1;return A(e49(e)||String(eL.getText("pisell2.venue-kiosk.checkout.failed"))),!1}finally{et||(ee&&s.endCheckout(),H&&H(),null==B||B(),await (null==q?void 0:q.release()),b.current===q&&(b.current=void 0)),f.current=!1,Y(),v.current&&(M(!1),et||I(!1))}}),G=(null==O?void 0:O.kind)==="submitted"||(null==O?void 0:O.kind)==="payment"&&["success","deposit-paid"].includes(O.viewModel.status);return(0,eC.useEffect)(()=>{if(!p&&!O||!G||C||T||!1===e.isActive)return void R(10);let t=Date.now()+1e4,l=window.setInterval(()=>R(Math.max(0,Math.ceil((t-Date.now())/1e3))),1e3),i=window.setTimeout(()=>{B()},1e4);return()=>{window.clearInterval(l),window.clearTimeout(i)}},[p,G,O,C,T,e.isActive,B]),{enabled:p,checkout:K,submitting:C,error:P,submittedOrderId:D,failure:null,confirmFailure:async()=>{},resettingFailure:!1,resetError:null,kioskPaymentResult:O,kioskPaymentPage:j,backToReview:W,paymentActive:T,isPaymentActive:V,waitForPaymentIdle:U,backHomeCountdown:L,resettingHome:$,returnHome:B,startNewOrder:H}}(e),i=e$(),a=eq(),n=exR(),r=UM(),o=UD(),s=(0,eC.useRef)(e);s.current=e;let d=(0,eC.useRef)(!0),c=(0,eC.useRef)(!1),u=(0,eC.useRef)(null),p=(0,eC.useRef)(null),m=(0,eC.useRef)(null),g=(0,eC.useRef)(!1),h=(0,eC.useRef)(null),[v,f]=(0,eC.useState)(!1),[y,b]=(0,eC.useState)(null),[x,k]=(0,eC.useState)(),[_,w]=(0,eC.useState)("idle"),[S,j]=(0,eC.useState)(null),[N,C]=(0,eC.useState)(!1),[M,T]=(0,eC.useState)(null),I=String(e.locale||"").startsWith("zh"),P=(e,t)=>I?t:e,A=(null==i||null==(t=i.appHelper)?void 0:t.utils)||{};(0,eC.useEffect)(()=>(d.current=!0,()=>{var e;d.current=!1,null==(e=h.current)||e.call(h,!1),h.current=null;let t=u.current;t&&z(t).catch(()=>{})}),[]),(0,eC.useEffect)(()=>{u.current=null,p.current=null,m.current=null,j(null),b(null),T(null),k(void 0),w("idle")},[e.scopeKey,e.sessionId,e.context.sales.bookingTicket]);let D=o3(async()=>{let e=m.current;if(e&&!g.current){if(!(e.resetStarted?e.isSameSession():e.isCurrent())){m.current=null,j(null);return}g.current=!0,e.resetStarted=!0,C(!0),T(null);try{if(!await e.reset()&&e.isSameSession())throw Error(P("Could not reset the cart. Please try again.","购物车清空失败,请重试。"));m.current===e&&(m.current=null,j(null),b(null))}catch(t){d.current&&e.isSameSession()&&T(e49(t)||P("Could not reset the cart. Please try again.","购物车清空失败,请重试。"))}finally{g.current=!1,d.current&&C(!1)}}}),E=e=>{var t,l,i;let a=A.history||(null==(l=A.getApp)||null==(t=l.call(A))?void 0:t.history);if("function"==typeof(null==a?void 0:a.replace))a.replace(e);else{let t=(null==(i=window.location.pathname.match(/^\/(en|zh-CN|zh-HK|ja|pt)(?=\/|$)/i))?void 0:i[0])||"";window.location.replace(`${t}${e}`)}},O=e=>u.current===e&&s.current.scopeKey===e.scopeKey&&s.current.sessionId===e.sessionId&&s.current.context.sales.bookingTicket===e.context.sales.bookingTicket,z=async e=>{if(e.resetTask)return e.resetTask;if(!e.resetDone&&O(e)){e.resetTask=(async()=>{var t,l;let i=null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l);(e3S(e.context)===e.identity||String((null==i?void 0:i.order_id)||"")===e.orderId)&&await e.finishPayment(e.orderId),e.resetDone=!0})();try{await e.resetTask}finally{e.resetTask=void 0}}},L=async function(e){var t,l;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.log,a=()=>d.current&&!1!==s.current.isActive&&s.current.scopeKey===e.scopeKey&&s.current.sessionId===e.sessionId&&s.current.context.sales.bookingTicket===e.context.sales.bookingTicket;if(!a())return;let n=!1,r=()=>{n||(n=!0,null==i||i("payment_handoff",{orderId:e.orderId,kind:e.kind}))},o=()=>z(e);if("deferred"===e.kind||"virtual"===e.kind){if(await o(),!a())return;E("deferred"===e.kind?`/order/details?id=${encodeURIComponent(e.orderId)}`:`/payment-finish/success?amount=${encodeURIComponent(String(e.totalAmount))}&order_id=${encodeURIComponent(e.orderId)}`),r();return}if("function"!=typeof A.action)throw Error(P("Payment is unavailable. Please reopen this order to pay.","支付入口不可用,请从订单详情继续支付。"));let c={target:e,sessionId:`${e.sessionId||"venue"}:${Date.now()}:${++e3w}`,terminal:!1};p.current=c,d.current&&w("opening"),await eW9({action:e=>{a()&&(A.action(e),r())},clearCartAndReset:o,freePay:efD,onFreePayFailure:e=>{throw Error(String((null==e?void 0:e.message)||P("Payment failed. Please try again.","支付失败,请重试。")))},onResetError:e=>console.error("[VenueBooking] Order submitted; local cleanup failed",e),orderId:e.orderId,preparePayments:e.preparePayments,persistCatalogView:()=>{},recalcSummary:async()=>void 0,redirectZeroAmount:(t=e.platform,l=e.totalAmount,"h5"===String(t||"").trim().toLowerCase()&&0===eUn(l)),replace:e=>{a()&&(E(e),r())},totalAmount:e.totalAmount,paymentSessionId:c.sessionId,onPaymentLifecycle:t=>{if(!t||"object"!=typeof t||!("key"in t)||"payment_lifecycle"!==t.key||!("data"in t))return;let l=t.data;if(l&&l.session_id===c.sessionId&&String(l.order_id)===e.orderId&&p.current===c&&!c.terminal&&O(e)){if("opened"===l.phase){d.current&&w("open");return}if("launch_failed"===l.phase){c.terminal=!0,d.current&&(w("failed"),b(("string"!=typeof l.reason||/^[a-z][a-z0-9_]*$/i.test(l.reason)?void 0:l.reason)||P("Payment could not be opened. Please try again.","支付入口未能打开,请重试。")));return}("dismissed"===l.phase||"redirecting"===l.phase)&&(c.terminal=!0,d.current&&w("closing"),o().then(()=>{d.current&&O(e)&&p.current===c&&w("closed")}).catch(t=>{d.current&&O(e)&&p.current===c&&(w("closed"),b(e49(t)||P("Could not clear this completed checkout.","结账页面清理失败。")))}))}}})},R=o3(async()=>{var e,t,l,p,g,v,y,x,_,S,N,C,M,T,I;if(c.current||m.current||!(d.current&&!1!==s.current.isActive))return!1;c.current=!0,f(!0),b(null);let D=!1,E=!1,O=s.current,{context:z}=O,R=z.sales.bookingTicket,$=e3S(z),F=()=>d.current&&!1!==s.current.isActive&&s.current.scopeKey===O.scopeKey&&s.current.sessionId===O.sessionId&&s.current.context.sales.bookingTicket===R,q=()=>F()&&e3S(s.current.context)===$,B={isCurrent:q,isSameSession:F,reset:O.onFailureConfirmed},H=null==(e=O.operationLog)?void 0:e.capture();null==H||H("checkout_requested",{retrySubmittedOrder:!!u.current,submittedOrderId:null==(t=u.current)?void 0:t.orderId});try{if(u.current){let e=u.current;if(O.scopeKey!==u.current.scopeKey||O.sessionId!==u.current.sessionId||R!==u.current.context.sales.bookingTicket)return!1;return await L(e,H),!0}let e=String(n.platform||(null==R||null==(l=R.otherParams)?void 0:l.platform)||a||"").toLowerCase();if(!R||!["pc","h5"].includes(e))throw Error(P("Open this booking from the customer website.","请从用户端预约页面打开。"));if(!r.holderConfirm)throw Error(P("Booking confirmation is unavailable. Please reload.","预订确认服务未就绪,请刷新页面。"));if(!await n.ensureCanShop()||!q())return!1;let t=(null==i||null==(v=i.appHelper)||null==(g=v.constants)||null==(p=g.config)?void 0:p.channel)||e;if(UI(t)&&!o.isLoggedIn()&&(!await new Promise(e=>{h.current=e,o.openLoginModal({callback:t=>{h.current=null,e("success"===t)}})||(h.current=null,e(!1))})||!q())||(await z.cart.waitForCartConsistency(),!q()||s.current.beforeCheckout&&!await s.current.beforeCheckout()||!q()))return!1;let d=(null==(y=R.getTempOrder)?void 0:y.call(R))??z.sales.tempOrder;if(!(null==d||null==(x=d.products)?void 0:x.length)&&!(null==d||null==(_=d.bookings)?void 0:_.length))return!1;let c=n.enabled&&!n.requirePaymentOnSubmit,m=!!(z.sales.enableMultiCurrencySettlement&&YC(d));if(!c&&!m&&"function"!=typeof A.action)throw Error(P("Payment is unavailable. Please reload.","支付入口未就绪,请刷新页面。"));let f=null,b=c?{paymentExecution:"deferred"}:{},w=await z.cart.submit(b,{validateHolder:!0,beforeSubmit:async()=>{var t,l,i;if(!q()||"function"!=typeof s.current.beforeSubmit||!await s.current.beforeSubmit()||(await z.cart.waitForCartConsistency(),!q()))return!1;let a=null==(t=R.getWalletAssetsState)?void 0:t.call(R);f=c||m?null:eW7({platform:e,shouldUseConsumerPayment:!0,payments:null==(i=R.getTempOrder)||null==(l=i.call(R))?void 0:l.payments,selectedItems:null==a?void 0:a.selectedItems,items:null==a?void 0:a.items}),Object.assign(b,null==f?void 0:f.submitParams);let r=(D=await n.beginCheckout())&&q();return E=r,r}}),j=[w,null==w?void 0:w.data,null==w?void 0:w.response,null==w||null==(S=w.data)?void 0:S.response].filter(e=>e4J(e))[0];if(j||!eA5(w))throw Error(e49(j||w)||P("Booking could not be submitted.","预订提交失败。"));let I=eUa(w,d??null);if(!I)throw Error(P("The checkout response did not include an order number.","结账接口未返回订单编号。"));if(null==H||H("order_created",{orderId:I.orderId,deferred:c,virtual:m}),null==(N=O.onOrderSubmitted)||N.call(O,I.orderId),!F())return!1;let B=null==(C=R.getTempOrder)?void 0:C.call(R),V=e3S(z)===$||String((null==B?void 0:B.order_id)||"")===I.orderId;V&&(null==(M=R.clearSessionStorageOrderSnapshot)||M.call(R));let U=e3a({result:w,amountSnapshot:V?null==(T=R.getOrderAmountSnapshot)?void 0:T.call(R):void 0,order:V?B:void 0});if(!c&&null===eUn(U))return u.current={orderId:I.orderId,totalAmount:U,kind:"deferred",platform:e,context:z,identity:$,resetDone:!1,finishPayment:O.onPaymentFinished,scopeKey:O.scopeKey,sessionId:O.sessionId,log:H},k(I.orderId),await L(u.current),!0;return u.current={orderId:I.orderId,totalAmount:U,kind:c?"deferred":m?"virtual":"payment",preparePayments:null==f?void 0:f.preparePayments,platform:e,context:z,identity:$,resetDone:!1,finishPayment:O.onPaymentFinished,scopeKey:O.scopeKey,sessionId:O.sessionId,log:H},k(I.orderId),await L(u.current),!0}catch(t){if(t===UN||!F())return null==H||H("checkout_cancelled",{reason:t===UN?"holder_confirmation":"session_changed"}),!1;null==H||H(u.current?"payment_handoff_failed":"checkout_failed",{orderId:null==(I=u.current)?void 0:I.orderId,admittedToSubmit:E,...e2x(t)},"warning");let e=e49(t)||P("Booking could not be submitted.","预订提交失败。");if(E&&!u.current&&q()){let t={...B,message:e,resetStarted:!1};m.current=t,j(t)}else b(e),u.current&&w("failed");return!1}finally{D&&n.endCheckout(),c.current=!1,d.current&&f(!1)}});return l.enabled||l.isPaymentActive()||l.kioskPaymentResult?{...l,canRetryPayment:!1,retryPayment:l.checkout}:{checkout:R,submitting:v,error:y,submittedOrderId:x,failure:S,confirmFailure:D,resettingFailure:N,resetError:M,kioskPaymentResult:null,paymentActive:!1,isPaymentActive:l.isPaymentActive,kioskPaymentPage:null,backToReview:l.backToReview,waitForPaymentIdle:l.waitForPaymentIdle,backHomeCountdown:l.backHomeCountdown,canRetryPayment:!!(x&&!v&&("failed"===_||"closed"===_)),retryPayment:R,resettingHome:!1,returnHome:l.returnHome,startNewOrder:l.startNewOrder}}({context:O,isActive:e.isActive,locale:H,scopeKey:L,sessionId:e3.sessionId,operationLog:e8,beforeSubmit:tV,beforeCheckout:()=>{var e;return!tW.pending&&!tW.error&&!tI()&&tH()&&((null==(e=eX.current)?void 0:e.validateContact())??!1)},onOrderSubmitted:e3.discard,onFailureConfirmed:e3.restart,onPaymentFinished:e3.finishSubmitted,onKioskFinish:e=>eW.current(e),onKioskPaymentPageOpen:()=>{A.close(),eF(!1),eb(void 0),J("payment")},onKioskPaymentPageBack:()=>{eb(void 0),J("review")}});eU.current=tU.isPaymentActive,eY.current=tU.waitForPaymentIdle;let tY=function(e){var t,l,i,a,n;let r=e$(),o=null==r||null==(i=r.appHelper)||null==(l=i.utils)||null==(t=l.getApp)?void 0:t.call(l),s=(0,eC.useRef)(e);s.current=e;let d=(0,eC.useRef)();e.sessionId&&((null==(a=d.current)?void 0:a.source)!==e.source||d.current.sessionId!==e.sessionId)?d.current={source:e.source,sessionId:e.sessionId,session:e.session,onReset:e.onReset,onRequestHome:e.onRequestHome}:(null==(n=d.current)?void 0:n.source)===e.source&&e.sessionId&&(d.current.session=e.session,d.current.onReset=e.onReset,d.current.onRequestHome=e.onRequestHome);let c=d.current,u=(0,eC.useRef)(!0),p=(0,eC.useRef)(0),m=(0,eC.useRef)(),g=(0,eC.useRef)(),[h,v]=(0,eC.useState)(!1),[f,y]=(0,eC.useState)(),b=()=>s.current.isPaymentActive?s.current.isPaymentActive():s.current.paymentActive,x=async e=>{if(e)await e();else{var t;if("function"!=typeof(null==o||null==(t=o.history)?void 0:t.replace))throw Error("Home navigation is unavailable. Please try again.");await o.history.replace("/")}},k=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!s.current.enabled||b())return Promise.resolve(!1);if(!e||e.source!==s.current.source){if(!t)return Promise.resolve(!1);if(g.current)return g.current;let e=s.current.source,l=s.current.onRequestHome,i=(async()=>{u.current&&(v(!0),y(void 0));try{return await x(l),!0}catch(t){return u.current&&s.current.source===e&&y(t instanceof Error?t.message:String(t)),!1}finally{u.current&&v(!1)}})();return g.current=i,i.then(()=>{g.current===i&&(g.current=void 0)}),i}let i=()=>d.current===e&&s.current.source===e.source;if(t&&!i())return Promise.resolve(!1);if(m.current)return m.current.owner===e?m.current.promise:Promise.resolve(!1);let a=(async()=>{u.current&&i()&&(v(!0),y(void 0));try{if(i()&&e.session.ownsSession()&&e.onReset(),!(l||t||!1===s.current.isActive||!i()?await e.session.retire({canRetire:()=>!b()}):await e.session.restart()))return!1;if(t){if(!i()||b())return!1;await x(e.onRequestHome)}return!0}catch(e){return u.current&&i()&&y(e instanceof Error?e.message:String(e)),!1}})(),n={owner:e,promise:a};return m.current=n,a.then(()=>{m.current===n&&(m.current=void 0,u.current&&v(!1))}),a},_=(0,eC.useRef)(k);_.current=k;let w=(0,eC.useCallback)(e=>{let{navigateHome:t}=e;return _.current(c,t)},[c]),S=(0,eC.useCallback)(()=>_.current(c,!1),[c]);return(0,eC.useEffect)(()=>(u.current=!0,++p.current,()=>{u.current=!1,++p.current}),[]),(0,eC.useEffect)(()=>{!e.enabled||!1!==e.isActive||b()||_.current(c,!1,!0)},[e.enabled,e.isActive,e.paymentActive,c]),(0,eC.useEffect)(()=>{var t;if(!e.enabled||!1===e.isActive||!c)return;let l=null==o||null==(t=o.getPlugin)?void 0:t.call(o,"screenProtector");if("function"==typeof(null==l?void 0:l.subscribeTrigger))return l.subscribeTrigger(()=>{_.current(c,!1,!0)})},[o,e.enabled,e.isActive,c]),(0,eC.useEffect)(()=>{if(e.enabled&&c)return()=>{let e=p.current;Promise.resolve().then(()=>{u.current&&d.current===c||!u.current&&p.current!==e||b()||_.current(c,!1,!0)})}},[e.enabled,c]),{finish:w,reset:S,resetting:h,error:f}}({enabled:B||tU.isPaymentActive()||!!tU.kioskPaymentResult,isActive:e.isActive,sessionId:e3.sessionId,source:q,session:e3,paymentActive:tU.paymentActive,isPaymentActive:()=>eU.current(),onRequestHome:e.onRequestHome,onReset:()=>{++eK.current,eV.current=!1,eo(void 0),ed(void 0),eu(void 0),em(void 0),eh(void 0),ef(!1),ez(void 0),eF(!1),eb(void 0),eN(void 0),ew(void 0),eI(!1),eA(!1),ek(!1),eH(!1),J("select"),ee(B),en(B?"product":"date"),A.close(),P.customerAuth.dismiss(),P.holder.dismiss(),P.normalProductDetail.dismiss(),P.bookingEdit.dismiss(),P.multiDay.dismiss(),P.allergySelection.dismiss(),P.settlementSelect.dismiss(),P.settlementConflict.dismiss(),P.holderConfirm.cancel()}});eW.current=tY.finish,(0,eC.useEffect)(()=>{tY.error&&eb(tY.error)},[tY.error]);let tW=function(e){var t,l,i;let a=(0,eC.useRef)(e);a.current=e;let n=(0,eC.useRef)(!0),r=(0,eC.useRef)(),o=(0,eC.useRef)(),s=(0,eC.useRef)(!1),[,d]=(0,eC.useState)(0),[c,u]=(0,eC.useState)(),p=(0,eC.useMemo)(()=>e.enabled?e3L(e.order,e.scopeKey,e.mainProducts,e.extrasProducts):[],[e.enabled,e.os,e.scopeKey,e.order,null==(t=e.order)?void 0:t.products,null==(i=e.order)||null==(l=i._extend)?void 0:l.productsByUid,e.mainProducts,e.extrasProducts]),m=!!c&&e3R(c.owner,e),g=m?c.error:void 0,h=e.enabled&&(m&&c.pending||!g&&p.length>0);return(0,eC.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]),(0,eC.useEffect)(()=>{var t;let l=o.current;if(!l||e3R(l.owner,e)&&(0,no.isEqual)(l.ownership,e3$(e.os.getTempOrder()||{}))||(o.current=void 0,s.current=!1,u(e=>(null==e?void 0:e.owner)===l.owner?void 0:e)),!e.enabled||r.current)return;let i=o.current&&e3R(o.current.owner,e)?o.current:void 0;if(i&&!s.current||!p.length&&!i)return;s.current=!1;let c={os:e.os,scopeKey:e.scopeKey,order:e.order,identity:eXv(e.order),customer:String((null==(t=e.order)?void 0:t.customer_id)||"")};if(!c.order||!e3R(c,e))return;let m=(null==i?void 0:i.published)?i:{owner:c,patches:p,ownership:(0,no.cloneDeep)(e3$(c.order)),published:!1};r.current=m,u({owner:m.owner,pending:!0});let g=()=>n.current&&e3R(m.owner,a.current),h=()=>0===e3L(m.owner.order,m.owner.scopeKey,e.mainProducts,e.extrasProducts).length,v=String(e.locale||"").startsWith("zh")?"无法更新定金信息,请重试。":"Could not update deposit details. Please try again.";(async()=>{try{if(!g())return;if(!m.published){if(!m.patches.length||!e.os.updateOrderProducts)throw Error(v);let t=(0,no.cloneDeep)({products:c.order.products,bookings:c.order.bookings,customer:c.order.customer_id,payments:c.order.payments,metadata:c.order.metadata,extend:c.order._extend});if(await e.os.updateOrderProducts(m.patches,{beforeApply:()=>{let l=e.os.getTempOrder();if(!a.current.enabled||a.current.mainProducts!==e.mainProducts||a.current.extrasProducts!==e.extrasProducts||!g()||!(0,no.isEqual)(m.ownership,e3$(l||{}))||!(0,no.isEqual)(t,{products:null==l?void 0:l.products,bookings:null==l?void 0:l.bookings,customer:null==l?void 0:l.customer_id,payments:null==l?void 0:l.payments,metadata:null==l?void 0:l.metadata,extend:null==l?void 0:l._extend}))throw Error(v)},isCurrentOrder:g}),!g())return;if(m.ownership=(0,no.cloneDeep)(e3$(m.owner.order)),m.published=h(),!m.published)throw Error(v)}if(!g())return;if(!e.os.getSummary)throw Error(v);let t=await e.os.getSummary();if(!g())return;if(!t||"object"!=typeof t)throw Error(v);a.current.refreshSnapshot(),o.current=void 0,u({owner:m.owner,pending:!1})}catch(e){if(g()){m.ownership=(0,no.cloneDeep)(e3$(m.owner.order)),m.published=h(),o.current=m,u({owner:m.owner,pending:!1,error:e3A(e,v)});try{a.current.refreshSnapshot()}catch{}}}finally{r.current===m&&(r.current=void 0),n.current&&(u(e=>(null==e?void 0:e.owner)===m.owner&&e.pending?void 0:e),d(e=>e+1))}})()}),{pending:h,error:g,retry:()=>{e.enabled&&!r.current&&g&&(s.current=!0,d(e=>e+1))}}}({os:q,scopeKey:L,order:tw,locale:H,mainProducts:t_.products,extrasProducts:tC.products,enabled:to&&!t_.loading&&!t_.error&&!tC.loading&&!tC.error&&!ex&&!eM&&!eP&&!tM.busy&&!tT.pending&&!er&&!es&&!tU.submitting&&!tU.paymentActive&&!tU.failure&&!eB,refreshSnapshot:F.refreshCartSnapshot}),tK=!to||ex||eM||tM.busy||tT.pending||tW.pending||tU.submitting||tU.paymentActive||!!tU.failure||!!tU.submittedOrderId||eB,tG=!to||!1===e.isActive||ex||eM||eP||tM.busy&&!tI()||tW.pending||tU.submitting||tU.paymentActive||!!tU.failure||!!tU.submittedOrderId||eB||!!er||!!es||!!eO||tC.loading||!!tC.error,tQ=tK||eP,tZ=null==(y=q.getOrderAmountSnapshot)?void 0:y.call(q),tJ=(null==tZ?void 0:tZ.summary)||(null==tw?void 0:tw.summary)||O.summary.summary,tX=(null==tZ?void 0:tZ.depositAmount)??(null==tJ?void 0:tJ.deposit_amount)??(null==tw?void 0:tw.deposit_amount),t0=Number(tX)>0&&!!((null==tZ?void 0:tZ.isDeposit)??1===Number(null==tw?void 0:tw.is_deposit)),t2=eC9({baseSalesAmountGap:null==tZ?void 0:tZ.amountGap,amountGap:null==tJ?void 0:tJ.amount_gap,fallbackAmount:null==tJ?void 0:tJ.total_amount,payments:null==tw?void 0:tw.payments}),t1=tS.bindings.reduce((e,t)=>{let l=String(t.line.product_id);return e[l]=(e[l]||0)+t.quantity,e},{}),t4=e1H(O,L);(0,eC.useEffect)(()=>{!to||"review"!==Z||tD||!t4.complete||es||tC.loading||tC.error||tH()},[to,Z,tD,t4.complete,es,tC.loading,tC.error,tC.products,F.tempOrder]);let t3=tS.bindings.length>0,t8=tP?"extras":"review",t6=t4.required?"holder":t8,t5=tS.bindings.every(e=>e.date===W);return{props:e,engine:M,bookingUI:T,orderPanel:A,mode:E,context:O,config:z,scopeKey:L,variant:R,sales:$,cart:F,os:q,isKiosk:B,todayOnly:B,locale:H,text:V,today:U,date:W,setDate:K,visibleDates:G,setVisibleDates:Q,step:Z,setStep:J,dateConfirmed:X,setDateConfirmed:ee,expandedSection:ea,setExpandedSection:en,dateSearchRange:tx,dateInteractionStarted:tf,onDateInteraction:tv,canAutoSelectDate:()=>!B&&th.current===tg&&ei.current!==tg,composer:er,setComposer:eo,configurationModal:es,setConfigurationModal:ed,error:ey,setError:eb,busy:ex,pendingExtraProductId:e_,preparingProductId:ej,composerBusy:eM,setComposerBusy:eI,rememberPartyPreview:(e,t)=>{if(!eQ.current||"party"!==E||!er||tO.current.composerKey!==e)return;let l=e3P({...er,...t},"booking");eu(t=>(null==t?void 0:t.key)===e&&JSON.stringify(t.value)===JSON.stringify(l)?t:{key:e,value:l})},previewRecovery:ep,previewRecoveryError:eg,recoveringPreview:ev,retryPartyPreview:()=>em(e=>e&&{...e,attempt:e.attempt+1}),discardPartyPreview:()=>{++eK.current,eo(void 0),ed(void 0),eu(void 0),eh(void 0),ef(!1),em(void 0),en("product")},uiHydrated:te,subscribePartyProductConfirmed:eJ,notifyPartyProductConfirmed:e6,holderBusy:eP,setHolderBusy:eA,externalHolderDisabled:tK,revision:eD,setRevision:eE,linePicker:eO,setLinePicker:ez,showOffers:eR,setShowOffers:eF,handoff:eB,setHandoff:eH,confirmation:eX,alive:eQ,mainCatalog:e0,mainQueries:tu,extrasQueries:tp,customerId:e2,refresh:e4,session:e3,ready:to,main:t_,order:tw,bindings:tS,partyMain:tj,operationLog:e8,extrasCatalog:tC,extras:tM,extraQuantity:tT,extraQuantityDisabled:tG,isExtraQuantityPending:tI,dateStates:tE,run:tz,policy:tL,openProduct:tR,editLine:e=>tz(async()=>{let t=e1F(q.getTempOrder(),{mode:E}).bindings.find(t=>t.productLineUid===e);if(!t)throw Error(V("This booking changed. Please refresh your order.","预约已变化,请刷新订单。"));await tR({id:Number(t.line.product_id)},e,"party"!==E)}),removeLine:e=>tF([e]),removeLines:tF,removeTicket:(e,t)=>t$([e],{uid:e,index:t}),changeDate:tq,showExtraPreparation:tB,checkout:tU,kioskLifecycle:tY,depositHydration:tW,disabled:tQ,openOrderHistory:()=>{var e,t,l,i,a,n;let r="h5"===String((null==(e=q.otherParams)?void 0:e.platform)||(null==M||null==(l=M.appHelper)||null==(t=l.constants)?void 0:t.platform))?"/orders":"/order",o=null==M||null==(a=M.appHelper)||null==(i=a.utils)?void 0:i.history;(null==o?void 0:o.push)?o.push(r):window.location.assign(`${(null==(n=window.location.pathname.match(/^\/(en|zh-CN|zh-HK|ja|pt)(?=\/|$)/))?void 0:n[0])||""}${r}`)},summary:tJ,amount:e=>YP(tw,e??0),amountDue:t2,hasDeposit:t0,depositAmount:tX,productQuantities:t1,holderState:t4,checkExtraHolders:tH,mainPoolEmpty:tA,mainCatalogBlocked:tD,hasExtras:tP,nextAfterHolder:t8,nextAfterSelect:t6,hasBookings:t3,mainDateMatches:t5,continueOrder:e=>{!(tQ||tW.error||tD||tI())&&t3&&!er&&t5&&(eb(void 0),J(e))}}}let e3H=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,128l-72,72V56Z",opacity:"0.2"}),eC.createElement("path",{d:"M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z"}))]]),e3V=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e3H}));e3V.displayName="ArrowRightIcon";let e3U=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),eC.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),e3Y=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e3U}));function e3W(e){let{id:t,number:l,title:i,meta:a,className:n="",children:r,...o}=e;return(0,eH.jsxs)("section",{...o,className:`checkout-module ${n}`,id:t,"aria-labelledby":`${t}-heading`,children:[(0,eH.jsxs)("header",{className:"checkout-module-heading",children:[(0,eH.jsx)("span",{className:"checkout-module-number","aria-hidden":"true",children:l}),(0,eH.jsx)("h2",{id:`${t}-heading`,children:i}),a&&(0,eH.jsx)("span",{className:"checkout-module-meta",children:a})]}),(0,eH.jsx)("div",{className:"checkout-module-body",children:r})]})}function e3K(e){let{id:t,label:l,value:i,onChange:a,maxLength:n=500,rows:r=3,placeholder:o,disabled:s=!1,hint:d,hideLabel:c=!1}=e;return(0,eH.jsxs)("div",{className:"note-field",children:[(0,eH.jsx)("label",{className:c?"sr-only":"field",htmlFor:t,children:l}),(0,eH.jsx)("textarea",{id:t,value:i,onChange:e=>a(e.target.value),rows:r,maxLength:n,placeholder:o,disabled:s,"aria-describedby":`${t}-count`}),(0,eH.jsxs)("p",{className:"note-help small muted",children:[(0,eH.jsx)("span",{children:d}),(0,eH.jsxs)("span",{id:`${t}-count`,children:[i.length,"/",n]})]})]})}e3Y.displayName="PlusIcon";let e3G=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z"}))]]),e3Q=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e3G}));e3Q.displayName="ClockIcon";let e3Z=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),eC.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z"}))]]),e3J=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e3Z}));e3J.displayName="PencilSimpleIcon";let e3X=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),eC.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),e30=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e3X}));function e32(e){let{title:t,image:l,icon:i,details:a,amount:n,action:r,removeAction:o,children:s,className:d="",layout:c="card",id:u}=e;return(0,eH.jsxs)("article",{id:u,className:`booking-order-item booking-order-item-${c} ${d}`,children:[(0,eH.jsxs)("div",{className:"booking-order-item-heading",children:[i&&(0,eH.jsx)("span",{className:"booking-order-item-icon","aria-hidden":"true",children:i}),l&&(0,eH.jsx)("img",{className:"booking-order-item-image",src:l,alt:""}),(0,eH.jsxs)("div",{className:"booking-order-item-copy",children:[(0,eH.jsx)("h3",{children:t}),a&&(0,eH.jsx)("div",{className:"booking-order-item-details",children:a}),void 0!==n&&(0,eH.jsx)("strong",{className:"booking-order-item-amount",children:n}),(r||o)&&(0,eH.jsxs)("div",{className:"booking-order-item-actions",children:[r&&(0,eH.jsx)(eXO,{className:"booking-order-item-edit","aria-label":r.label,disabled:r.disabled,onClick:r.onClick,children:(0,eH.jsx)(e3J,{size:18,"aria-hidden":"true"})}),o&&(0,eH.jsx)(eXO,{className:"booking-order-remove","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,children:(0,eH.jsx)(e30,{size:18,"aria-hidden":"true"})})]})]})]}),s&&(0,eH.jsx)("div",{className:"booking-order-item-content",children:s})]})}function e31(e){let{items:t}=e;return(0,eH.jsx)("dl",{className:"booking-order-details",children:t.map((e,t)=>(0,eH.jsxs)("div",{className:"booking-order-detail",children:[(0,eH.jsx)("dt",{children:e.label}),(0,eH.jsxs)("dd",{children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("strong",{children:e.value}),e.detail&&(0,eH.jsx)("div",{className:"booking-order-detail-copy",children:e.detail})]}),e.action&&(0,eH.jsx)("button",{type:"button",className:"text-link",disabled:e.action.disabled,onClick:e.action.onClick,children:e.action.label})]})]},t))})}function e34(e){let{rows:t,lang:l,formatAmount:i}=e;return(0,eH.jsx)("div",{className:"booking-price-breakdown",children:t.map(e=>(0,eH.jsxs)("div",{className:"booking-price-line",children:[(0,eH.jsx)(eXT,{label:e.label,amount:e.amount,formatAmount:i,total:"total"===e.tone,lang:l,className:"discount"===e.tone?"discount":""}),e.detail&&(0,eH.jsx)("div",{className:"small muted booking-price-detail",children:e.detail})]},e.id))})}function e33(e){let{title:t,description:l,children:i}=e;return(0,eH.jsxs)("section",{className:"booking-holder-section",children:[t&&(0,eH.jsx)("h2",{children:t}),l&&(0,eH.jsx)("p",{className:"muted",children:l}),(0,eH.jsx)("div",{className:"booking-holder-content",children:i})]})}e30.displayName="TrashIcon";let e38=e=>null==e?"":String(e),e36=e=>e38(e).slice(0,10),e35=e=>{let t=e38(e);return/^\d{2}:\d{2}$/.test(t)?`${t}:00`:t};function e37(e,t){var l,i,a,n,r,o,s,d;if(!t||!e.product_id||(null==(l=e._extend)?void 0:l.independentLine)===!0||(null==(n=e.metadata)||null==(a=n.origin)||null==(i=a._extend)?void 0:i.independentLine)===!0)return null;let c=e36(t.start_date),u=e36(t.end_date),p=e35(t.start_time),m=e35(t.end_time);if(![c,u].every(e=>/^\d{4}-\d{2}-\d{2}$/.test(e))||![p,m].every(e=>/^\d{2}:\d{2}:\d{2}$/.test(e)))return null;let g=Array.isArray(t.resources)?t.resources:[];return g.some(e=>!e||!e38(e.relation_id??e.resource_id??e.id)||!e38(e.form_id))?null:JSON.stringify(function e(t){return null==t?null:Array.isArray(t)?t.map(e):"object"==typeof t?Object.keys(t).sort().reduce((l,i)=>(l[i]=e(t[i]),l),{}):t}({product:e38(e.product_id),variant:e38(e.product_variant_id),sku:{...e.product_sku,option:ex4(e)},bundle:e.product_bundle||[],businessDate:e36((null==(r=t.metadata)?void 0:r.availability_business_date)||c),startDate:c,endDate:u,startTime:p,endTime:m,timezone:e38(null==(o=t.metadata)?void 0:o.availability_timezone),resources:g.map(e=>({form:e38(e.form_id),id:e38(e.relation_id??e.resource_id??e.id),type:e38(e.relation_type),capacity:e38(e.capacity)})).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t))),legacyResource:g.length?null:{id:e38(t.relation_id??t.resource_id),type:e38(t.relation_type)},role:e38(null==(s=e.metadata)?void 0:s.venue_booking_role),scope:e38(null==(d=e.metadata)?void 0:d.venue_booking_scope_key)}))}function e39(e,t){let l=[],i=new Map;return e.forEach((e,a)=>{let n=t(e),r=null===n?void 0:i.get(n);if(r)r.members.push(e);else{let t={key:null===n?`separate:${a}`:`group:${n}`,members:[e]};l.push(t),null!==n&&i.set(n,t)}}),l}function e8e(e,t,l,i,a){let n=e=>[null==e?void 0:e.bundle_title,null==e?void 0:e.title,null==e?void 0:e.name,null==e?void 0:e.product_title].map(e=>eXp(e,l)).find(Boolean);return(e.product_bundle||[]).flatMap((l,r)=>{var o,s;if(!l)return[];let d=Number(l.num??l.quantity??1);if(!Number.isSafeInteger(d)||d<=0)return[];let c=l.bundle_id??l.id,u=l.bundle_group_id??l.group_id,p=null!=c?{bundle_id:c,bundle_group_id:u}:l;return[{key:`${u??""}:${c??""}:${r}`,name:n(l)||n((null==(o=l.metadata)?void 0:o.origin)??l.origin??l.product)||n(ewW(p,[null==(s=e.metadata)?void 0:s.origin,a,i])),quantity:d*t}]})}async function e8t(e){var t,l,i,a,n,r,o,s,d;let{handle:c,line:u,holderIds:p,assertCurrent:m,beforeWrite:g}=e,h=null==(t=u.orderLine.metadata)?void 0:t.venue_booking_role,v=String((null==(l=u.orderLine.metadata)?void 0:l.unique_identification_number)||""),f=String((null==(a=u.booking)||null==(i=a.metadata)?void 0:i.unique_identification_number)||"");if("tickets"!==h&&"party_main"!==h||!v||!f||1!==Number(u.orderLine.num)||1!==p.length||!c.updateOrderBooking)throw Error("This booking cannot accept a Holder-only update. Please reselect the booking.");m();let y=null==(n=c.getTempOrder)?void 0:n.call(c),b=null==y||null==(r=y.bookings)?void 0:r.find(e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)||"")===f});if(!b||String(b.product_uid||"")!==v)throw Error("The booking link changed. Please review the order.");let x=JSON.stringify(b),k=null==y?void 0:y.customer_id,_=await (null==(o=c.getOtherParams)?void 0:o.call(c));m();let w=null==(s=c.getTempOrder)?void 0:s.call(c),S=null==w||null==(d=w.bookings)?void 0:d.find(e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)||"")===f});if(w!==y||(null==w?void 0:w.customer_id)!==k||!S||JSON.stringify(S)!==x)throw Error("The booking changed while choosing a Holder. Please try again.");let j=ek6(p,{customerId:k,isFranchisee:!!(null==_?void 0:_.isFranchisee),holderOptions:e.holderOptions,productSource:u.cacheItem});g(),await c.updateOrderBooking({unique_identification_number:f,updates:{holder:j,metadata:{holder_id:p}}})}class e8l extends Error{constructor(e,t,l=!1){super(e),e1(this,"code",void 0),e1(this,"uncertain",void 0),this.code=t,this.uncertain=l}}let e8i=e=>!!e&&"[object Object]"===Object.prototype.toString.call(e),e8a=e=>!!e&&"object"==typeof e&&"booking-holder-form"===e.kind&&1===e.version&&"function"==typeof e.close;function e8n(e){let t,l,i,{formId:a,customerId:n,locale:r}=e,o=e$(),s=(0,eC.useRef)(e);s.current=e;let d=(0,eC.useRef)();d.current||(l=e=>{try{null==e||e.close()}catch{}},d.current={close:i=()=>{let e=t;t=void 0,e&&(e.done=!0,l(e.handle))},isOpen:()=>!!(t&&!t.done),open(e){if(i(),!e.isCurrent())return;let a={done:!1};t=a;let n=()=>t===a&&!a.done&&e.isCurrent(),r=()=>{a.done=!0,t===a&&(t=void 0)},o=t=>{n()&&(r(),l(a.handle),e.onError(t))},s=()=>new e8l("The kiosk holder form service is unavailable.","HOST_UNAVAILABLE"),d=e.request.formId,c=e.request.customerId;if(!Number.isSafeInteger(d)||d<=0||!e8i(e.request.formDataConfig)&&"function"!=typeof e.request.loadFormData||null!=c&&(!Number.isSafeInteger(Number(c))||1>=Number(c))||!e.action)return void o(s());let u=(t,l)=>{if(n())try{if(!t||Number(t.formId)!==l)return void o(new e8l("The holder form does not match this request.","FORM_MISMATCH",!0));if("opened"===t.status){var i;null==(i=e.onFallbackLoading)||i.call(e,!1),e.onOpened({...t,formId:d})}else if("saved"===t.status){if(!e8i(t.record))return void o(new e8l("The holder form did not return a confirmed save.","SAVED_RESULT_INVALID",!0));let l=JSON.parse(JSON.stringify(t.record));if(!e8i(l))return void o(new e8l("The holder form returned invalid records.","SAVED_RESULT_INVALID",!0));r(),e.onSaved({...t,formId:d,record:l})}else"cancelled"===t.status?(r(),e.onCancelled()):"error"===t.status?o(new e8l(t.message||"Unable to load the holder form.",t.code||"HOST_ERROR",!!t.uncertain)):o(new e8l("The holder form service returned an invalid response.","HOST_RESPONSE_INVALID"))}catch(e){o(new e8l(e instanceof Error?e.message:"Invalid holder form response.","HOST_RESPONSE_INVALID",!0))}},p=async()=>{if(!n())throw new e8l("The holder request changed.","HOLDER_FORM_CLOSED");let t=await e.request.loadFormData();if(!n())throw new e8l("The holder request changed.","HOLDER_FORM_CLOSED");if(!Number.isSafeInteger(null==t?void 0:t.formId)||t.formId<=0||!e8i(t.formDataConfig))throw new e8l("The holder form is unavailable.","HOLDER_FORM_CONFIG_INVALID");return{formId:t.formId,formDataConfig:JSON.parse(JSON.stringify(t.formDataConfig))}},m=(t,i)=>{if(!n())return;let r={};a.attempt=r;let d=!0,c=[],g=()=>n()&&a.attempt===r;try{let r=e.action({type:"pisell1.goBookingHolderForm",data:{...t,...t.formDataConfig?{formDataConfig:JSON.parse(JSON.stringify(t.formDataConfig))}:{},isCurrent:g},callback(e){g()&&(d?c.push(e):u(e,t.formId))}});if(d=!1,!g()){c.length=0,e8a(r)&&l(r);return}if(!e8a(r)){r&&"function"==typeof r.then&&Promise.resolve(r).catch(()=>{}),c.length=0,o(s());return}if(i&&!0!==r.supportsDeferredLoad){var h;let i=c.find(e=>(null==e?void 0:e.status)==="saved"||(null==e?void 0:e.status)==="cancelled"||(null==e?void 0:e.status)==="error"&&(e.uncertain||"HOLDER_FORM_CONFIG_INVALID"!==e.code));if(i){a.handle=r,u(i,t.formId);return}if(a.attempt=void 0,c.length=0,l(r),!n())return;null==(h=e.onFallbackLoading)||h.call(e,!0),p().then(t=>{n()&&m({...e.request,...t,loadFormData:void 0},!1)}).catch(t=>{var l;n()&&(null==(l=e.onFallbackLoading)||l.call(e,!1),o(new e8l(t instanceof Error?t.message:"Unable to load the holder form.","HOLDER_FORM_CONFIG_INVALID")))});return}a.handle=r,c.splice(0).forEach(e=>u(e,t.formId))}catch(e){d=!1,c.length=0,o(new e8l(e instanceof Error?e.message:"Unable to open the holder form.","HOST_ERROR"))}};m({...e.request,...e.request.loadFormData?{loadFormData:p}:{}},!!e.request.loadFormData)}});let c=(0,eC.useRef)(0),u=(0,eC.useRef)(!0),p=(0,eC.useRef)(!1),m=(0,eC.useRef)(!1),[g,h]=(0,eC.useState)(),[v,f]=(0,eC.useState)(!1),[y,b]=(0,eC.useState)(!0),[x,k]=(0,eC.useState)(!1),[_,w]=(0,eC.useState)(0),S=String(r||"").startsWith("zh"),j=(e,t)=>S?t:e;return(0,eC.useEffect)(()=>{var e,t,l;u.current=!0;let i=++c.current,r=()=>u.current&&c.current===i&&String(s.current.formId)===String(a)&&String(s.current.customerId??"")===String(n??"")&&s.current.isCurrent();null==(e=d.current)||e.close(),p.current=!1,b(!0),k(!1),h(void 0);let g=()=>{m.current||(m.current=!0,s.current.onUnconfirmed())},v=!1,y=oi(n??void 0)?void 0:n,x=async()=>{try{var e,t,l;let i=await UV(Number(a),"kiosk");if(!r()||!i)throw Error("Holder form unavailable");let n=i.form_field??i.field,o=(i.form_type??(null==(e=i.form)?void 0:e.form_type))==="minors"?null==n||null==(l=n.find(e=>"form_to_form"===e.filed_type&&"hide"===e.status))||null==(t=l.setting)?void 0:t.linkedTable:void 0,s=Number(o||a),d=o?await dt(s,"kiosk"):i;if(!r()||!d)throw Error("Linked holder form unavailable");let c={...d,form_id:s,is_franchisor:i.is_franchisor};return delete c.customer_id,null!=y&&(c.customer_id=y),v=!!o,{formId:s,formDataConfig:c}}catch{throw Error(j("Unable to load the holder form. Please retry.","无法加载持有人表单,请重试。"))}};return d.current.open({action:"function"==typeof(null==o||null==(l=o.appHelper)||null==(t=l.utils)?void 0:t.action)?e=>o.appHelper.utils.action(e):void 0,request:{formId:Number(a),loadFormData:x,title:j("New holder profile","新建持有人档案"),customerId:y,zIndex:1101},isCurrent:r,onOpened:()=>{r()&&b(!1)},onFallbackLoading:e=>{r()&&k(e)},onSaved:e=>{r()&&!p.current&&(p.current=!0,b(!0),(async()=>{try{await s.current.onCreated({record:e.record,linkedWaiver:v}),r()&&s.current.onClose()}catch{r()&&(f(!0),g(),h(j("The profile was saved. Refresh the list to select it.","档案已保存,请刷新列表后选择,勿重复创建。")))}finally{r()&&b(!1)}})())},onCancelled:()=>{r()&&s.current.onClose()},onError:e=>{r()&&(b(!1),k(!1),e.uncertain?(f(!0),g(),h(j("The save result is unknown. Close this form and refresh the profile list before trying again.","保存结果尚未确认,请关闭表单并刷新档案列表后核对,勿重复创建。"))):h("HOST_UNAVAILABLE"===e.code?j("The kiosk holder form service is unavailable. Please update this terminal and retry.","终端持有人表单服务不可用,请更新终端后重试。"):j("Unable to load the holder form. Please retry.","无法加载持有人表单,请重试。")))}}),()=>{var e;u.current=!1,++c.current,null==(e=d.current)||e.close()}},[a,n,_]),(0,eH.jsxs)("div",{className:"venue-holder-create-feedback","aria-busy":y,children:[x&&y&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(eT.Spin,{}),(0,eH.jsx)(eXE,{secondary:!0,onClick:()=>{var e;null==(e=d.current)||e.close(),s.current.onClose()},children:j("Close","关闭")})]}),g&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:g,action:(0,eH.jsxs)(eH.Fragment,{children:[!v&&!p.current&&(0,eH.jsx)(eXE,{onClick:()=>w(e=>e+1),children:j("Retry","重试")}),(0,eH.jsx)(eXE,{disabled:y&&p.current,onClick:()=>{var e;y&&p.current||(null==(e=d.current)||e.close(),s.current.onClose())},children:j("Close","关闭")})]})})]})}function e8r(e){return e.kiosk?(0,eH.jsx)(e8n,{...e}):(0,eH.jsx)(e8o,{...e})}function e8o(e){let{formId:t,customerId:l,locale:i,onClose:a,onCreated:n,onUnconfirmed:r,isCurrent:o}=e,s=eq(),[d]=Wi({components:["FormCard"]}),[c,u]=(0,eC.useState)(),[p,m]=(0,eC.useState)(),[g,h]=(0,eC.useState)(!1),[v,f]=(0,eC.useState)(!1),[y,b]=(0,eC.useState)(!1),x=(0,eC.useRef)(null),k=(0,eC.useRef)(!0),_=(0,eC.useRef)(!1),w=String(i||"").startsWith("zh"),S=(e,t)=>w?t:e;(0,eC.useEffect)(()=>{k.current=!0;let e=!1;return(async()=>{var l,i,a,n;let r=await UV(Number(t),s);if(!r)throw Error(S("The holder form is unavailable.","持票人表单未加载。"));let d=r.form_field??r.field,c=(r.form_type??(null==(l=r.form)?void 0:l.form_type))==="minors"?null==d||null==(a=d.find(e=>"form_to_form"===e.filed_type&&"hide"===e.status))||null==(i=a.setting)?void 0:i.linkedTable:void 0,p=c?await dt(Number(c),s):r;if(!p)throw Error(S("The linked waiver form is unavailable.","关联协议表单未加载。"));!e&&o()&&u({id:Number(c||t),title:String((null==(n=p.form)?void 0:n.title)||p.title||S("New holder profile","新建持票人档案")),franchisor:r.is_franchisor,linkedWaiver:!!c})})().catch(t=>{e||m(e3A(t,S("Unable to load the holder form.","无法加载持票人表单。")))}),()=>{e=!0,k.current=!1}},[t,l,s]);let j=async(e,t)=>{if(!k.current||!c||_.current)return;if("success"!==e){f(!0),h(!1),r(),m(S("The save result is unknown. Close this form and refresh the profile list before trying again.","保存结果尚未确认,请关闭表单并刷新档案列表后核对,勿重复创建。"));return}let l=Array.isArray(t)?Object.fromEntries(t.filter(e=>e&&"object"==typeof e&&"string"==typeof e.key).map(e=>[e.key,e.value])):t&&"object"==typeof t?{...t}:{};_.current=!0;try{o()&&await n({record:l,linkedWaiver:c.linkedWaiver}),k.current&&a()}catch(e){k.current&&(f(!0),r(),m(e3A(e,S("The profile was saved. Refresh the list to select it.","档案已保存,请刷新列表后选择,勿重复创建。"))))}finally{k.current&&h(!1)}};return(0,eH.jsxs)(e0t,{title:(null==c?void 0:c.title)||S("New holder profile","新建持票人档案"),className:"venue-holder-create-modal",mobile:"fullscreen",zIndex:600,closeLabel:S("Close","关闭"),externalDialogSelector:eX9,bodyClassName:"venue-holder-create-body venue-booking-legacy-controls",footerClassName:"venue-holder-create-footer",onClose:()=>{g&&_.current||(g&&r(),k.current=!1,a())},closeDisabled:g&&_.current,closeOnBackdrop:!g,closeOnEscape:!g,footer:(0,eH.jsx)(eXE,{disabled:!y||v||!o(),busy:g,onClick:()=>{var e;(null==(e=x.current)?void 0:e.submit)&&o()&&(h(!0),m(void 0),x.current.submit())},children:g?S("Saving…","保存中…"):S("Save profile","保存档案")}),children:[p&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:p}),g&&!_.current&&(0,eH.jsx)("p",{className:"small muted",children:S("Saving. If you close this form, check the profile list before creating another profile.","正在保存。如需关闭,请先核对档案列表,勿重复创建。")}),!c&&!p&&(0,eH.jsx)(eT.Spin,{}),c&&(d?(0,eH.jsx)(d,{id:c.id,venueHolderLinkedRecords:!0,ref:e=>{x.current=e},isGetLastData:!1,setting:{isHidden:1},isV2API:!0,isShowSkeleton:!0,isClearData:!1,submitExtraParams:{...null!=l&&""!==l?{customer_id:l}:{},...null!=c.franchisor?{source_shop_customer:c.franchisor}:{}},onSubmit:(e,t)=>void j(e,t),onFormConfigChange:e=>b(!!e&&Object.keys(e).length>0),onChange:(e,t)=>b(!e&&!!t&&Object.keys(t).length>0),onFinishFailed:()=>{h(!1),m(S("Complete the required form fields.","请填写表单中的必填内容。"))}}):(0,eH.jsx)(eT.Alert,{type:"error",message:S("The form component is unavailable.","表单组件未加载。")}))]})}function e8s(e,t){let l=String(t||"").startsWith("zh"),i=l?"zh":"en",a=(null==e?void 0:e.form)||e,n=[null==a?void 0:a.title,null==a?void 0:a.name,null==e?void 0:e.title,null==e?void 0:e.name].map(e=>eXp(e,i).trim()).find(Boolean)||(l?"持有人":"Holder");return{name:n,edit:l?`编辑${n}`:`Edit ${n}`,required:l?`必填${n}`:`${n} required`,optional:l?`${n}选填`:`Optional ${n}`,notRequired:l?`无需填写${n}`:`No ${n} required`,choose:l?`选择${n}`:`Select ${n}`,placeholder:l?`请选择${n}`:`Select ${n}`,create:l?"新建":"New",missing:l?`请选择${n}。`:`Please select ${n}.`}}let e8d=e=>e39(e,e=>{let t=e37(e.orderLine,e.booking);return null===t?null:JSON.stringify([t,e.config.enabled,e.config.required,String(e.config.formId??"")])}),e8c=(0,eC.forwardRef)((e,t)=>{var l,i,a;let{context:n,scopeKey:r,locale:o,isActive:s=!0,disabled:d=!1}=e,c=U4(),u=UM(),p=(0,eC.useMemo)(()=>eN7(u.customerAuth),[u.customerAuth]),m=eXN(),g=dq("venue-holder"),h=(0,eC.useRef)(e);h.current=e;let v=(0,eC.useRef)(!0),f=(0,eC.useRef)(!1),y=(0,eC.useRef)(!1),b=(0,eC.useRef)(null),[x,k]=(0,eC.useState)(),[_,w]=(0,eC.useState)(!1),[S,j]=(0,eC.useState)(),[N,C]=(0,eC.useState)({}),[M,T]=(0,eC.useState)(),[I,P]=(0,eC.useState)(),[,A]=(0,eC.useState)(0),D=n.sales.bookingTicket,E=eXy(D),O=c.loading&&!E,z=e1V(n,r),L=e1H(n,r,o),R=e8d(L.displayLines),$=e=>JSON.stringify([z,e.quantity,e.ids]),F=e=>{var t;return(null==(t=N[e.uid])?void 0:t.base)===$(e)?N[e.uid].ids:void 0},q=L.lines.some(e=>!!F(e));L.pending=!!S||!!M||!!I||q,L.complete=L.complete&&!q,L.blocked=e1W(D,z);let B=String(o||"").startsWith("zh"),H=(e,t)=>B?t:e,V=o3(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z;return v.current&&!1!==h.current.isActive&&e1V(h.current.context,h.current.scopeKey)===e});(0,eC.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,eC.useEffect)(()=>{k(void 0),w(!1),T(void 0),C({})},[z]),(0,eC.useEffect)(()=>{if(!I)return;let e=h.current,t=()=>{var e,t;return v.current&&!1!==h.current.isActive&&h.current.scopeKey===I.scopeKey&&h.current.context.sales.bookingTicket===I.handle&&eXv((null==(t=I.handle)||null==(e=t.getTempOrder)?void 0:e.call(t))??h.current.context.sales.tempOrder)===I.owner};if(!t()){P(void 0),j(void 0);return}if(String(eXb(e.context)||"")!==I.customerId)return;let l=e1H(e.context).lines.find(e=>e.uid===I.uid);if(!(null==l?void 0:l.config.formId)||I.index>=l.quantity){P(void 0),j(void 0);return}let i=!0,a=e1V(e.context,e.scopeKey);return c.prepareHolderOptionsForSource(l.cacheItem,{accessOnly:eXy(I.handle)}).then(e=>{i&&t()&&V(a)&&e.accessAllowed&&(y.current=!1,T({uid:l.uid,index:I.index,identity:a,base:JSON.stringify([a,l.quantity,l.ids]),formId:l.config.formId}))}).catch(e=>{i&&t()&&k(e3A(e,String(h.current.locale||"").startsWith("zh")?"无法打开持票人表单。":"Unable to open the holder form."))}).finally(()=>{i&&v.current&&(P(void 0),j(void 0))}),()=>{i=!1}},[I,z,c.prepareHolderOptionsForSource,V]);let U=JSON.stringify([z,L.requiredCount,L.requiredCompleted,L.total,L.completed,L.pending,L.blocked,L.lines.map(e=>[e.uid,e.config.formId,e.ids]),N]);(0,eC.useEffect)(()=>{var e,t;null==(e=(t=h.current).onStateChange)||e.call(t,L)},[U]);let Y=JSON.stringify(L.lines.map(e=>[e.uid,e.config.formId]));(0,eC.useEffect)(()=>{if(!s||!D)return;let e=new Set;for(let t of L.lines){let l=String(t.config.formId);e.has(l)||(e.add(l),c.prepareHolderOptionsForSource(t.cacheItem).catch(e=>{V()&&k(e3A(e,H("Unable to load holder profiles.","无法加载持票人档案。")))}))}},[D,z,Y,s]),(0,eC.useImperativeHandle)(t,()=>({validate:async()=>{let e=e1H(h.current.context),t=e1W(h.current.context.sales.bookingTicket,e1V(h.current.context,h.current.scopeKey));return!V()||f.current||M||q||t||!e.complete?(w(!0),k(t?H("A holder update could not be confirmed. Review the order before making another change.","持票人写回结果未确认,请先核对订单,勿重复修改。"):H("Complete the required holder details before continuing.","请先完成必填持票人资料。")),requestAnimationFrame(()=>{var e,t;return null==(t=b.current)||null==(e=t.querySelector('[aria-invalid="true"]'))?void 0:e.focus()}),!1):(k(void 0),!0)}}));let W=(e,t)=>{let l;if(!V(e))return;let i=e1H(h.current.context,h.current.scopeKey);if(i.blocked)return;let a=t&&i.lines.find(e=>e.uid===t.uid),n=e8d(i.lines).reduce((e,t)=>e.concat(t.members),[]);for(let e of a?[a,...n.filter(e=>e.config.required&&e.uid!==a.uid)]:n.filter(e=>e.config.required)){let i=(null==t?void 0:t.uid)===e.uid?t.ids:F(e)||e.ids,a=Array.from({length:e.quantity},(e,t)=>i[t]).findIndex(e=>null==e||""===e);if(a>=0){l={uid:e.uid,index:a};break}}let r=l;m(()=>{var t;return!V(e)||f.current||h.current.disabled||!b.current?null:r?Array.from(b.current.querySelectorAll("[data-venue-holder-line]")).find(e=>e.dataset.venueHolderLine===r.uid&&e.dataset.venueHolderIndex===String(r.index)):Array.from((null==(t=b.current.closest(".booking-page"))?void 0:t.querySelectorAll(".booking-primary-action"))||[]).find(eJ8)},{block:r?"start":"nearest"})},K=async function(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:z;if(!D||f.current||d||!V(i)||e1W(D,i))return;let a=e_X(D,e);if(!a)return void k(H("This ticket changed. Please review the order.","该门票已变化,请重新核对订单。"));let r=e1H(h.current.context).lines.find(t=>t.uid===e);if(!r||!Number.isInteger(t)||t<0||t>=r.quantity)return;let o=JSON.stringify([a.orderLine,a.booking]),s=[...F(r)||r.ids];if(s[t]=l,r.quantity>1&&Array.from({length:r.quantity},(e,t)=>s[t]).some(e=>null==e||""===e)){C(t=>({...t,[e]:{base:$(r),ids:s}})),W(i,{uid:e,ids:s});return}let u=s.slice(0,r.quantity).filter(e=>void 0!==e&&""!==e).map(Number);if(u.some(e=>!Number.isSafeInteger(e)||e<=0))return void k(H("The holder profile ID is invalid.","档案编号无效。"));f.current=!0,j(e),k(void 0);let p=!1,m=()=>{let t=e_X(D,e);if(!V(i)||!t||!p&&JSON.stringify([t.orderLine,t.booking])!==o)throw Error(H("The order changed. Please review its holders again.","订单已变化,请重新核对持票人。"))};try{var g,y,b,x;let t=null==(g=a.orderLine.metadata)?void 0:g.venue_booking_role;if(a.booking&&("tickets"===t||"party_main"===t))await e8t({handle:D,line:a,holderIds:u,holderOptions:c.getHolderOptionsForSource(a.cacheItem),assertCurrent:m,beforeWrite:()=>{m(),p=!0}});else{let e=new Proxy(D,{get(e,t){let l=Reflect.get(e,t);return"addProductToOrder"===t&&"function"==typeof l?function(){for(var t=arguments.length,i=Array(t),a=0;a<t;a++)i[a]=arguments[a];return m(),p=!0,l.apply(e,i)}:"function"==typeof l?l.bind(e):l}});await e_U({line:a,bookingTicket:e,tempOrder:(null==(y=D.getTempOrder)?void 0:y.call(D))??n.sales.tempOrder,openHolderSelect:async()=>(m(),u),updateItem:async e=>(m(),p=!0,n.cart.updateItem(e)),getHolderOptions:()=>c.getHolderOptionsForSource(a.cacheItem),getHolderFormDetail:()=>c.getHolderFormDetailForSource(a.cacheItem)})}V(i)&&(C(t=>{let l={...t};return delete l[e],l}),n.cart.refreshCartSnapshot(),await (null==(b=(x=h.current).onMutation)?void 0:b.call(x)),V(i)&&(A(e=>e+1),W(i)))}catch(e){p&&function(e,t){let l=e1U.get(e)||new Set;l.add(t),e1U.set(e,l);try{sessionStorage.setItem(e1Y(t),"1")}catch{}}(D,i),V(i)&&k(e3A(e,H("Unable to update the holder.","持票人写回失败。")))}finally{f.current=!1,v.current&&j(void 0)}},G=async e=>{let t=await c.prepareHolderOptionsForSource(e.cacheItem,{refresh:!0});return t.accessAllowed&&V()?t.options:[]},Q=async e=>{var t;let l;if(!M||!V(M.identity))return;let i=e1H(h.current.context).lines.find(e=>e.uid===M.uid);if(!i||$(i)!==M.base||String(i.config.formId)!==String(M.formId)||M.index>=i.quantity)return;let a=Number.isSafeInteger(l=Number((t=e.record).form_record_id??t.id??t.record_id))&&l>0?l:void 0;e.linkedWaiver||null==a||c.upsertHolderOptions([{...e.record,form_record_id:a}],i.cacheItem);let n=await G(i);y.current=!0;let r=e.linkedWaiver?void 0:a;if(e.linkedWaiver){let t=e.record.form_to_form_value,l=(Array.isArray(t)?t:[]).find(e=>String(null==e?void 0:e.form_id)===String(M.formId)),i=Array.isArray(null==l?void 0:l.form_data_value)?l.form_data_value:[];1===i.length&&n.some(e=>String(e.id)===String(i[0]))&&(r=i[0])}let o=e1H(h.current.context).lines.find(e=>e.uid===M.uid);null!=r&&o&&$(o)===M.base&&V(M.identity)&&await K(M.uid,M.index,r,M.identity)},Z=async(e,t)=>{if(d||L.blocked||f.current||!e.config.formId||e1G(D,`${z}:${e.config.formId}`))return;f.current=!0,j(e.uid);let l=!1;try{if(eXx(n,{products:[e.cacheItem],force:!0})){var i;let a=eXv((null==D||null==(i=D.getTempOrder)?void 0:i.call(D))??n.sales.tempOrder),o=()=>{var e;return v.current&&!1!==h.current.isActive&&h.current.scopeKey===r&&h.current.context.sales.bookingTicket===D&&eXv((null==D||null==(e=D.getTempOrder)?void 0:e.call(D))??h.current.context.sales.tempOrder)===a};if(!await eXk({context:n,products:[e.cacheItem],force:!0,openCustomerAuth:p,isCurrent:o})||!o())return;l=!0,P({uid:e.uid,index:t,handle:D,scopeKey:r,owner:a,customerId:String(eXb(n))});return}(await c.prepareHolderOptionsForSource(e.cacheItem,{accessOnly:E})).accessAllowed&&V(z)&&(y.current=!1,T({uid:e.uid,index:t,identity:z,base:$(e),formId:e.config.formId}))}catch(e){V(z)&&k(e3A(e,H("Unable to open the holder form.","无法打开持票人表单。")))}finally{f.current=!1,v.current&&!l&&j(void 0)}},J=async(e,t)=>{var l;let i=h.current.onRemoveTicket;if(!i||d||f.current||M||L.blocked||!V(z)||1!==e.quantity||0!==t||(null==(l=e.orderLine.metadata)?void 0:l.venue_booking_role)!=="tickets")return;let a=e1H(h.current.context).displayLines.find(t=>t.uid===e.uid);if(a&&$(a)===$(e)){f.current=!0,j(e.uid),k(void 0);try{await i(e.uid,t)&&V(z)&&C(t=>{let l={...t};return delete l[e.uid],l})}catch(e){V(z)&&k(e3A(e,H("Unable to remove this ticket. Please try again.","无法删除这张票,请重试。")))}finally{f.current=!1,v.current&&j(void 0)}}},X=L.lines.reduce((e,t)=>e+(t.config.required?Math.min(t.quantity,(F(t)||t.ids).filter(e=>null!=e&&""!==e).length):0),0),ee=e=>e8s(c.getHolderFormDetailForSource(e.cacheItem),o),et=function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=ee(t);return Array.from({length:t.quantity},(a,n)=>{var r;let o=c.getHolderOptionsForSource(t.cacheItem),s=0===o.length,u=(F(t)||t.ids)[n],p=null==u?void 0:o.find(e=>String(e.id)===String(u)),m=`${g}-${t.uid}-${n}`,h=_&&t.config.required&&null==u;return(0,eH.jsxs)("div",{className:"child-ticket","data-venue-holder-line":t.uid,"data-venue-holder-index":n,children:[(0,eH.jsx)(e32,{layout:"row",icon:(0,eH.jsx)(eXj,{size:20,"aria-hidden":"true"}),title:`${t.title||H("Ticket","门票")} #${l+n+1}`,removeAction:e.onRemoveTicket&&1===t.quantity&&(null==(r=t.orderLine.metadata)?void 0:r.venue_booking_role)==="tickets"?{label:`${H("Remove ticket","删除门票")} ${t.title||H("Ticket","门票")} #${l+n+1}`,disabled:d||!!S||!!M||L.blocked||c.loading,onClick:()=>{J(t,n)}}:void 0}),t.config.enabled&&(0,eH.jsxs)("div",{className:"holder-picker",children:[(0,eH.jsxs)("label",{className:"field",htmlFor:m,children:[(0,eH.jsx)("span",{children:i.choose}),(0,eH.jsxs)("select",{id:m,value:null==u?"":String(u),disabled:d||!!S||!!M||L.blocked||s,style:s?{opacity:.5,cursor:"not-allowed"}:void 0,"aria-invalid":h||void 0,"aria-describedby":h?`${m}-error`:void 0,onChange:e=>{e.target.value&&K(t.uid,n,e.target.value)},children:[(0,eH.jsx)("option",{value:"",disabled:!0,children:i.placeholder}),null!=u&&!p&&(0,eH.jsx)("option",{value:String(u),children:String(u)}),o.map(e=>(0,eH.jsx)("option",{value:String(e.id),children:e.label||String(e.id)},String(e.id)))]})]}),h&&(0,eH.jsx)("p",{id:`${m}-error`,className:"error-text",role:"alert",children:i.missing}),(0,eH.jsxs)(eXE,{secondary:!0,disabled:d||!!S||!!M||L.blocked||e1G(D,`${z}:${t.config.formId}`),onClick:()=>void Z(t,n),children:[(0,eH.jsx)(e3Y,{size:18,"aria-hidden":"true"}),(0,eH.jsx)("span",{children:i.create})]})]})]},m)})},el=(0,eH.jsxs)(eH.Fragment,{children:[q&&(0,eH.jsxs)("p",{className:"small muted",children:[H("Choose a profile for each ticket in this group to save the assignments together.","请为该组每张票选择档案,系统会一并保存,保留全部票数。")," ",(0,eH.jsx)("button",{type:"button",className:"text-link",disabled:!!S||!!M,onClick:()=>C({}),children:H("Discard unsaved choices","撤销未保存选择")})]}),(x||L.blocked)&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:x||H("A previous holder update is unconfirmed. Review the order before continuing.","上次持票人写回结果未确认,请先核对订单。")})]});return(0,eH.jsxs)("div",{ref:b,className:"venue-booking-holder-step",children:[e.renderContent?(0,eH.jsxs)(eH.Fragment,{children:[el,e.renderContent({renderLine:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=L.lines.find(t=>t.uid===e);return l?O?(0,eH.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-busy":"true","aria-label":H("Loading holder profiles","正在加载持票人档案"),children:(0,eH.jsx)("div",{className:"holder-picker","aria-hidden":"true",children:(0,eH.jsx)("span",{className:"venue-holder-skeleton-field"})})}):(0,eH.jsx)("div",{className:"child-assignments",children:et(l,t)}):null}})]}):(0,eH.jsxs)(e33,{children:[(0,eH.jsxs)("div",{className:"completion-bar",children:[(0,eH.jsx)(e2l,{size:23,"aria-hidden":"true"}),(0,eH.jsx)("b",{children:L.requiredCount?`${X}/${L.requiredCount} ${H("completed","已完成")}`:H("Holder profiles are optional","持票人档案选填")}),L.requiredCount>0&&(0,eH.jsx)("progress",{"aria-label":H("Completed","已完成"),value:X,max:L.requiredCount})]}),el,O?(0,eH.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-busy":"true","aria-label":H("Loading holder profiles","正在加载持票人档案"),children:R.map(e=>(0,eH.jsxs)("div",{className:"cart-group","aria-hidden":"true",children:[(0,eH.jsx)("span",{className:"venue-holder-skeleton-title"}),(0,eH.jsx)("span",{className:"venue-holder-skeleton-text"}),(0,eH.jsxs)("div",{className:"holder-picker",children:[(0,eH.jsx)("span",{className:"venue-holder-skeleton-field"}),(0,eH.jsx)("span",{className:"venue-holder-skeleton-field"})]})]},e.key))}):R.map(t=>{var l,i,a,n,r,s,d,c;let u=t.members[0],p=ee(u),m=u.orderLine,g=t.members.reduce((e,t)=>e+t.quantity,0),h=null==(l=e.catalogProducts)?void 0:l.find(e=>String(e.id)===String(u.orderLine.product_id)),v=e8e(u.orderLine,g,o||"en",h,u.cacheItem),f=0,y=t.members.map(e=>{let t=et(e,f);return f+=e.quantity,t});return(0,eH.jsxs)("section",{className:"cart-group",children:[(0,eH.jsx)(e32,{className:"booking-order-item-flat",title:u.title||H("Ticket","门票"),image:eXp(u.cacheItem.cover||(null==(i=u.cacheItem._extend)?void 0:i.product_cover)||m.product_cover,o||"en")||void 0,details:(0,eH.jsxs)("div",{className:"booking-item-metadata",children:[(null==(a=u.booking)?void 0:a.start_date)&&(0,eH.jsxs)("div",{children:[(0,eH.jsx)(e0r,{size:16,"aria-hidden":"true"}),e0y((null==(n=u.booking.metadata)?void 0:n.availability_business_date)||u.booking.start_date,o||"en")]}),(null==(r=u.booking)?void 0:r.start_time)&&(0,eH.jsxs)("div",{children:[(0,eH.jsx)(e3Q,{size:16,"aria-hidden":"true"}),u.booking.start_time,"–",u.booking.end_time]}),((null==(s=u.booking)?void 0:s.resources)||[]).length>0&&(0,eH.jsx)("div",{children:u.booking.resources.map(e=>{var t;return eXp((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,o||"en")}).filter(Boolean).join(" \xb7 ")}),(u.cacheItem.product_option_string||(null==(d=u.cacheItem._extend)?void 0:d.product_option_string)||m.product_option_string)&&(0,eH.jsx)("div",{children:eXp(u.cacheItem.product_option_string||(null==(c=u.cacheItem._extend)?void 0:c.product_option_string)||m.product_option_string,o||"en")}),(0,eH.jsx)("div",{children:u.config.enabled?u.config.required?p.required:p.optional:p.notRequired})]}),children:v.length>0&&(0,eH.jsx)("ul",{className:"venue-order-bundle","aria-label":H("Included items","套餐内含商品"),children:v.map(e=>(0,eH.jsxs)("li",{children:[(0,eH.jsx)("span",{children:e.name||H("Included item","套餐子商品")}),(0,eH.jsxs)("span",{children:["\xd7 ",e.quantity]})]},e.key))})}),(0,eH.jsx)("div",{className:"child-assignments",children:y})]},t.key)}),e.afterAssignments]}),M&&V(M.identity)&&(0,eH.jsx)(e8r,{formId:M.formId,kiosk:eXy(D),customerId:UY(null==D||null==(l=D.getTempOrder)?void 0:l.call(D),void 0,null==D||null==(a=D.getOrderCustomerSnapshot)||null==(i=a.call(D))?void 0:i.id),locale:o,isCurrent:()=>V(M.identity),onClose:()=>{T(void 0),y.current||c.reload()},onCreated:Q,onUnconfirmed:()=>{var e;let t;D&&(e=`${M.identity}:${M.formId}`,(t=e1K.get(D)||new Set).add(e),e1K.set(D,t)),k(H("The profile save result is unconfirmed. Reload this page to check the profiles before creating another one.","档案保存结果未确认,请刷新页面核对档案后再尝试新建。"))}},eXy(D)?JSON.stringify([M.identity,M.uid,M.index,M.base]):void 0)]})});e8c.displayName="VenueBookingHolderStep";let e8u=["first_name","last_name","phone","email"],e8p=e=>e&&"object"==typeof e&&!Array.isArray(e)?e:{},e8m=e=>JSON.parse(JSON.stringify(e)),e8g=e=>JSON.stringify(e8p(e));function e8h(e){var t,l;let i=e.context.sales.bookingTicket,a=(null==i||null==(t=i.getTempOrder)?void 0:t.call(i))??e.context.sales.tempOrder;return{handle:i,scopeKey:e.scopeKey,identity:(null==a||null==(l=a._extend)?void 0:l.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id)||a,customer:String((null==a?void 0:a.customer_id)||""),order:a}}let e8v=(e,t)=>!!e&&e.handle===t.handle&&e.scopeKey===t.scopeKey&&e.identity===t.identity&&e.customer===t.customer,e8f=(0,eC.forwardRef)((e,t)=>{var l;let[i]=eT.Form.useForm(),[a,n]=(0,eC.useState)(),[r,o]=(0,eC.useState)(!1),s=(0,eC.useRef)(e);s.current=e;let d=(0,eC.useRef)(!0),c=(0,eC.useRef)(0),u=(0,eC.useRef)(!1),p=(0,eC.useRef)(),m=e8h(e),g=e8g(null==(l=m.order)?void 0:l.contacts_info),h=JSON.stringify(e.config),v=String(e.locale).startsWith("zh"),f=(e,t)=>v?t:e,y=e=>({first_name:f("Enter a first name.","请输入名字。"),last_name:f("Enter a last name.","请输入姓氏。"),phone:f("Enter a phone number.","请输入电话号码。"),email:f("Enter an email address.","请输入邮箱。")})[e];(0,eC.useEffect)(()=>(d.current=!0,()=>{d.current=!1,c.current+=1}),[]),(0,eC.useLayoutEffect)(()=>{var e,t,l,a;let r=!e8v(null==(e=p.current)?void 0:e.owner,m);if(r||(null==(t=p.current)?void 0:t.contact)!==g){let e,t;c.current+=1,r&&(i.resetFields(),n(void 0)),i.setFieldsValue((a=e8p(null==(l=m.order)?void 0:l.contacts_info),t=String((e=e8p(a.phone)).country_calling_code||""),{first_name:a.first_name||"",last_name:a.last_name||"",email:a.email||"",phone:{phone:e.phone||"",countryCallingCode:t&&!t.startsWith("+")?`+${t}`:t,countryCode:e.country_code||""}})),p.current={owner:m,contact:g}}},[m.handle,m.identity,m.customer,e.scopeKey,g,i]);let b=(e,t)=>{let l=s.current,i=e8h(l);if(!d.current||!1===l.isActive||!e8v(t,i)||!i.order)return!1;let a=e8p(i.order.contacts_info),n=function(e,t,l){let i=e8m(t);for(let o of e8u){var a,n,r;!1!==l.fields[o].visible&&(i[o]="phone"===o?{...e8p(t.phone),phone:(null==(a=e.phone)?void 0:a.phone)||"",country_calling_code:(null==(n=e.phone)?void 0:n.countryCallingCode)||"",country_code:(null==(r=e.phone)?void 0:r.countryCode)||""}:e[o]||"")}return(i.first_name!==t.first_name||i.last_name!==t.last_name)&&(i.display_name=[i.first_name,i.last_name].filter(Boolean).join(" ")),i}(e,a,l.config);if(e8g(n)===e8g(a))return!0;let r=e8m(n);return p.current={owner:i,contact:e8g(r)},p.current={owner:i,contact:e8g(l.context.sales.setContactsInfo(r))},!0};return(0,eC.useImperativeHandle)(t,()=>({validate:async()=>{var e,t,l,a,r;if(u.current||!d.current||!1===s.current.isActive)return!1;if(!s.current.config.enabled)return!0;if((null==(e=s.current.context.sales.contactInfo)?void 0:e.loading)||(null==(t=s.current.context.sales.contactInfo)?void 0:t.pending))return!1;let p=e8h(s.current);if(!(null==(l=p.handle)?void 0:l.validateContactInfo)||!p.order)return n(f("Contact details are not ready. Please retry.","联系人信息尚未就绪,请重试。")),!1;let m=++c.current,g=JSON.stringify(s.current.config),h=e8g(p.order.contacts_info),v=()=>{var e;return d.current&&m===c.current&&!1!==s.current.isActive&&e8v(p,e8h(s.current))&&JSON.stringify(s.current.config)===g&&e8g(null==(e=e8h(s.current).order)?void 0:e.contacts_info)===h};u.current=!0,o(!0),n(void 0);try{let e=await i.validateFields();if(!v())return!1;let t=e8u.filter(t=>{var l;let i=s.current.config.fields[t],a="phone"===t?null==(l=e.phone)?void 0:l.phone:e[t];return i.visible&&i.required&&("string"!=typeof a||!a.trim())});if(t.length)return i.setFields(t.map(e=>({name:e,errors:[y(e)]}))),!1;if(!b(e,p)||(h=e8g(null==(a=e8h(s.current).order)?void 0:a.contacts_info),!v()))return!1;return await p.handle.validateContactInfo(),v()}catch(e){if(!v())return!1;return"CONTACT_INFO_REQUIRED"===e.code&&Array.isArray(e.fields)?i.setFields(e.fields.filter(e=>e8u.includes(e)).map(e=>({name:e,errors:[y(e)]}))):(null==(r=e.errorFields)?void 0:r.length)||n(e.message||f("Unable to validate contact details. Please retry.","无法校验联系人信息,请重试。")),!1}finally{u.current=!1,d.current&&o(!1)}}}),[i,h,e.locale]),(0,eH.jsxs)("div",{className:"venue-contact-form","aria-busy":r,children:[(0,eH.jsx)(ete,{config:e.config.fields,form:i,disabled:e.disabled||r||!1===e.isActive,onValuesChange:(e,t)=>{if(!s.current.disabled&&!1!==s.current.isActive&&s.current.config.enabled&&!u.current){c.current+=1,n(void 0);try{b(t,m)}catch(e){n(e instanceof Error?e.message:f("Unable to save contact details.","无法保存联系人信息。"))}}}}),a&&(0,eH.jsx)("p",{className:"venue-contact-form__error",role:"alert",children:a})]})});function e8y(e){var t,l;let{policyId:i,title:a,request:n,preloadedPolicy:r,locale:o,accepted:s=!1,onClose:d,onConfirm:c,onLoadError:u}=e;s2(Vg,o||(null==(t=eL.getLocale)?void 0:t.call(eL))||"en");let p=(null==(l=eJF())?void 0:l.presentationPlatform)==="kiosk",m=String(o||"").startsWith("zh");return(0,eH.jsx)(Vx,{open:!0,item:{id:i,title:a},isHideCheckout:!1,initialAccepted:s,preloadedPolicy:p?r:void 0,depositProtocolRequest:n,onCancel:d,onConfirm:c,onLoadError:u,renderDialog:e=>{let{title:t,body:l,footer:i}=e;return(0,eH.jsx)(e0t,{title:t,className:"venue-policy-modal",mobile:"fullscreen",zIndex:600,closeLabel:m?"关闭":"Close",onClose:d,bodyClassName:"venue-policy-body venue-booking-legacy-controls",footerClassName:"venue-policy-footer venue-booking-legacy-controls",footer:i,children:l})}})}function e8b(e){let{title:t,resourceTitle:l,saved:i,open:a,disabled:n,busy:r,locale:o,onOpen:s,onClose:d,children:c,footer:u,external:p=!1,opening:m=!1}=e,g=String(o||"").startsWith("zh"),h=r?g?"正在保存…":"Saving…":i?g?"已保存":"Saved":g?"未保存":"Not saved",v=i?g?"编辑资料":"Edit details":g?"填写资料":"Fill in details";return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("button",{type:"button",className:`checkout-agreement venue-resource-form-entry${i?" accepted":""}`,"data-accepted":i,"aria-haspopup":"dialog","aria-expanded":a,"aria-label":`${v} \xb7 ${t} \xb7 ${h}`,disabled:n,onClick:s,children:[(0,eH.jsx)("span",{className:"agreement-state","aria-hidden":"true",children:m?(0,eH.jsx)(eT.Spin,{size:"small"}):i&&(0,eH.jsx)(e2P,{size:15,weight:"bold"})}),(0,eH.jsxs)("span",{className:"agreement-copy",children:[(0,eH.jsx)("b",{children:t}),(0,eH.jsxs)("small",{children:[l&&l!==t?`${l} \xb7 `:"",h]})]}),(0,eH.jsxs)("span",{className:"agreement-open","aria-hidden":"true",children:[(0,eH.jsx)("span",{children:v}),(0,eH.jsx)(e2D,{size:15})]})]}),!p&&(0,eH.jsx)(e0t,{title:t,className:"venue-resource-form-modal",mobile:"fullscreen",zIndex:600,open:a,onClose:d,closeLabel:g?"关闭":"Close",closeOnBackdrop:!r,closeOnEscape:!r,externalDialogSelector:eX9,bodyClassName:"venue-resource-form-body",footerClassName:"venue-resource-form-footer",footer:u,children:c})]})}class e8x extends Error{constructor(e,t,l=!1){super(e),e1(this,"code",void 0),e1(this,"uncertain",void 0),this.code=t,this.uncertain=l}}let e8k=e=>!!e&&"[object Object]"===Object.prototype.toString.call(e),e8_=e=>!!e&&"object"==typeof e&&"booking-resource-form"===e.kind&&1===e.version&&"function"==typeof e.close;function e8w(e){var t,l,i;let a=(null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.context.sales.tempOrder;return JSON.stringify([e.scopeKey,(null==a||null==(i=a._extend)?void 0:i.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id),null==a?void 0:a.customer_id])}function e8S(e){var t,l;let i=(null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.context.sales.tempOrder;return JSON.stringify([e8w(e),((null==i?void 0:i.bookings)||[]).map(e=>{var t;return[null==(t=e.metadata)?void 0:t.unique_identification_number,e.start_date,e.start_time,e.end_date,e.end_time,e3o(e)]})])}let e8j=(0,eC.forwardRef)((e,t)=>{var l,i,a,n,r;let o,s,d,{context:c,locale:u,disabled:p=!1,isActive:m=!0,includeHolderValidation:g=!0}=e,h=dq("venue-review"),v=(0,eC.useRef)(null),f=eXN(),y=(0,eC.useRef)(null),b=(0,eC.useRef)(null),x=(0,eC.useRef)(e);x.current=e;let k=(0,eC.useRef)(!0),_=e$(),w=eXy(c.sales.bookingTicket),S=(0,eC.useRef)();S.current||(s=e=>{try{null==e||e.close()}catch{}},S.current={close:d=()=>{let e=o;o=void 0,e&&(e.done=!0,s(e.handle))},isOpen:()=>!!(o&&!o.done),open(e){if(d(),!e.isCurrent())return;let t={done:!1};o=t;let l=()=>o===t&&!t.done&&e.isCurrent(),i=()=>{t.done=!0,o===t&&(o=void 0)},a=a=>{l()&&(i(),s(t.handle),e.onError(a))},n=()=>new e8x("The kiosk form service is unavailable. Please update this terminal and retry.","HOST_UNAVAILABLE");if(!Number.isSafeInteger(e.request.formId)||e.request.formId<=0||!e.action)return void a(n());let r=e.request.formId,c=t=>{if(l())try{if(!t||Number(t.formId)!==r)return void a(new e8x("The saved form does not match this booking.","FORM_MISMATCH",!0));if("opened"===t.status)e.onOpened(t);else if("saved"===t.status){let l;if(l=t.recordId,!(("string"==typeof l||"number"==typeof l)&&/^\d+$/.test(String(l))&&Number.isSafeInteger(Number(l))&&Number(l)>0)||!e8k(t.values))return void a(new e8x("The form did not return a saved record.","SAVED_RECORD_REQUIRED",!0));let n={...t,values:JSON.parse(JSON.stringify(t.values))};if(!e8k(n.values))return void a(new e8x("The form did not return valid saved values.","SAVED_RECORD_REQUIRED",!0));i(),e.onSaved(n)}else"cancelled"===t.status?(i(),e.onCancelled()):"error"===t.status?a(new e8x("string"==typeof t.message&&t.message||"Unable to load the form. Please retry.",t.code||"HOST_ERROR",!!t.uncertain)):a(new e8x("The kiosk form service returned an invalid result.","HOST_RESPONSE_INVALID"))}catch(e){a(new e8x(e instanceof Error?e.message:"The kiosk form service returned an invalid result.","HOST_RESPONSE_INVALID",!0))}},u=!0,p=[];try{let i=e.action({type:"pisell1.goBookingResourceForm",data:{...e.request,...e.request.values?{values:JSON.parse(JSON.stringify(e.request.values))}:{},isCurrent:l},callback(e){u?p.push(e):c(e)}});if(u=!1,!l()){p.length=0,e8_(i)&&s(i);return}if(!e8_(i)){i&&"function"==typeof i.then&&Promise.resolve(i).catch(()=>{}),p.length=0,a(n());return}t.handle=i,p.splice(0).forEach(c)}catch(e){u=!1,p.length=0,a(e instanceof e8x?e:new e8x(e instanceof Error?e.message:"Unable to open the form. Please retry.","HOST_ERROR"))}}});let j=(0,eC.useRef)(0),[N]=Wi({components:["FormCard"]}),C=(0,eC.useRef)({}),M=(0,eC.useRef)(new Set),T=(0,eC.useRef)(new Set),[I,P]=(0,eC.useState)([]),[A,D]=(0,eC.useState)("loading"),[E,O]=(0,eC.useState)(null),[z,L]=(0,eC.useState)(null),[R,$]=(0,eC.useState)(null),[F,q]=(0,eC.useState)(null),[B,H]=(0,eC.useState)(null),[V,U]=(0,eC.useState)({}),[Y,W]=(0,eC.useState)({}),[K,G]=(0,eC.useState)(),[Q,Z]=(0,eC.useState)({}),J=e.acceptedPolicies??Q,X=(0,eC.useRef)(J);X.current=J;let ee=e=>{var t,l;let i=x.current.acceptedPolicies??X.current,a="function"==typeof e?e(i):e;X.current=a,void 0!==x.current.acceptedPolicies?null==(t=(l=x.current).onAcceptedPoliciesChange)||t.call(l,a):Z(a)},et=(0,eC.useRef)(e8w(e)),[el,ei]=(0,eC.useState)(0),[,ea]=(0,eC.useState)(0),en=e8S(e),er=(0,eC.useRef)(),eo=String(u||"").startsWith("zh"),es=(e,t)=>eo?t:e,ed=e=>{var t,l;return eXp(null==(l=e.policyResponse)||null==(t=l.data)?void 0:t.title,u||"en").trim()||es("Agreement","协议")},ec=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:en;return k.current&&!1!==x.current.isActive&&e8S(x.current)===e},eu=e=>{var t,l,i,a;return null==(a=x.current.context.sales.bookingTicket)||null==(i=a.getTempOrder)||null==(l=i.call(a))||null==(t=l.bookings)?void 0:t.find(t=>{var l;return String((null==(l=t.metadata)?void 0:l.unique_identification_number)||"")===e})},ep=e=>!M.current.has(e.key)&&e3c(e,eu),em=e=>w?ep(e):!!(N&&T.current.has(e.key)&&ep(e)),eg=e=>{let t=()=>{ec(en)&&f(()=>ec(en)&&v.current?e(v.current):null,{block:"center"})};x.current.onValidationBlocked?x.current.onValidationBlocked(t):t()},eh=()=>eg(e=>e.querySelector(".venue-confirmation-feedback"));(0,eC.useEffect)(()=>(k.current=!0,()=>{var e;k.current=!1,++j.current,null==(e=S.current)||e.close()}),[]),(0,eC.useEffect)(()=>{var t;let l=!1;++j.current,null==(t=S.current)||t.close(),er.current=void 0,D("loading"),O(null),L(null);let i=e8w(e);if(et.current!==i&&ee({}),et.current=i,G(void 0),$(null),q(null),H(null),U({}),W({}),M.current.clear(),T.current.clear(),!m)return;let a=c.sales.bookingTicket;return(async()=>{var t,i,n,r,o;if(!a)throw Error(es("Booking details are not ready.","预订详情尚未就绪。"));let s=(null==(i=a.getTempOrder)||null==(t=i.call(a))?void 0:t.bookings)||[],d=[],u=new Map,p=new Map,m=new Map;for(let t of s){let l=String(t.start_date||e.date||"").slice(0,10),i=e3o(t);if(!i.length)continue;let a=m.get(l)||new Set;i.forEach(e=>a.add(e)),m.set(l,a)}for(let t of s){let i=e3o(t);if(!i.length)continue;let r=String((null==(n=t.metadata)?void 0:n.unique_identification_number)||""),o=String(t.start_date||e.date||"").slice(0,10);if(!r||!/^\d{4}-\d{2}-\d{2}$/.test(o))throw Error(es("Unable to load the booking resource forms.","无法读取预订资源的关联表单。"));if("function"!=typeof a.queryBookingResourceDetails)throw Error(es("The booking service needs to be updated before resource forms can be loaded.","预订服务需要更新后才能读取资源关联表单。"));if(u.has(o)||u.set(o,await a.queryBookingResourceDetails({date:o,resourceIds:[...m.get(o)||[]]})),l||!ec())return;let s=u.get(o)||[];for(let e of i){let t=s.find(t=>String(t.id)===e);if(!t)throw Error(es("A selected resource is no longer available. Please reselect it.","无法读取已选资源,请重新选择。"));let i=t.resource_form_id,n=Number(i);if(i&&(!Number.isSafeInteger(n)||n<=0))throw Error(es("The resource form configuration is invalid.","资源关联表单配置无效。"));let o=t.policy_id?String(t.policy_id):void 0;if(o&&!p.has(o)){let e=a.getProtocol;if(!e)throw Error(es("Unable to load the resource policy. Please retry.","无法加载资源协议,请重试。"));let t=function(e){if(!e||"object"!=typeof e||Array.isArray(e)||200!==e.code||!e.data||"string"!=typeof e.data.content)return{status:"invalid"};let t=e.data.content;if(!t.trim())return{status:"empty"};if("u">typeof DOMParser){let l=new DOMParser().parseFromString(t,"text/html").body;if(l.querySelector("img, picture, svg, video, audio, iframe, object, embed, canvas, math, hr, input, select, textarea, button")||Array.from(l.querySelectorAll("[style]")).some(e=>/background(?:-image)?\s*:[^;]*url\s*\(/i.test(e.getAttribute("style")||"")))return{status:"ready",response:e};if(l.querySelectorAll("script, style, template, noscript").forEach(e=>e.remove()),!(l.textContent||"").replace(/[\s\u200b-\u200d\u2060\ufeff]/g,""))return{status:"empty"}}return{status:"ready",response:e}}(await e.call(a,o));if(l||!ec())return;if("invalid"===t.status)throw Error(es("Unable to load the resource policy. Please retry.","无法加载资源协议,请重试。"));p.set(o,"ready"===t.status?t.response:void 0)}let c=o?p.get(o):void 0;(n>0||c)&&d.push({key:`${r}:${e}:${n||""}:${o||""}`,bookingUid:r,resourceId:e,title:String(t.main_field||t.name||e),...n>0?{formId:n}:{},...c?{policyId:o,policyResponse:c}:{}})}}if(!l&&ec()){let e=function(e){let t=new Map;for(let l of e){let e=JSON.stringify([l.resourceId,l.formId??null,l.policyId??null]),i=t.get(e);if(i)i.members.some(e=>e.key===l.key)||i.members.push(l);else{let{bookingUid:i,...a}=l;t.set(e,{...a,key:e,members:[l]})}}return[...t.values()]}(d),t=!1;for(let i of e){let e=e3d(i,eu);if(!(!e||e3c(i,eu))&&1===new Set(i.members.map(e=>e3s(e,eu(e.bookingUid))).filter(Boolean).map(e=>String(e.recordId))).size){if(!a.updateOrderBooking)throw Error(es("Unable to save the form.","表单保存失败。"));await e3u(i,e,{readBooking:eu,updateBooking:e=>a.updateOrderBooking(e),assertCurrent:()=>{if(l||!ec())throw Error(es("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"))}}),t=!0}}if(l||!ec()||(t&&(c.cart.refreshCartSnapshot(),await (null==(r=(o=x.current).onMutation)?void 0:r.call(o))),l||!ec()))return;P(e),ee(t=>(function(e,t){let l={};for(let a of e){var i;let e=t[a.key];(null==e?void 0:e.status)==="confirmed"&&a.policyId&&String(e.policyId)===a.policyId&&e.policy&&(null==(i=a.policyResponse)?void 0:i.data)&&JSON.stringify(e.policy)===JSON.stringify(a.policyResponse.data)&&(l[a.key]=e)}return l})(e,t)),er.current=en,D("ready")}})().catch(e=>{!l&&ec()&&(O(e3A(e,es("Unable to load the booking resource forms. Please retry.","无法加载预订资源的关联表单,请重试。"))),D("error"))}),()=>{var e;l=!0,++j.current,null==(e=S.current)||e.close()}},[c.sales.bookingTicket,en,m,el,w]);let ev=async()=>{var e;let t=c.sales.contactInfo;if(!ec())return!1;if(!(null==t?void 0:t.config)||t.loading||t.pending)return O(es("Wait for the contact details to load and save.","请等待联系人信息加载并保存完成。")),eh(),!1;if(!t.config.enabled)return!0;let l=await (null==(e=b.current)?void 0:e.validate());return!!ec()&&(!0!==l?(L({section:"contact",message:es("Check your contact details before continuing.","请检查联系人信息后继续。")}),eg(e=>e.querySelector('.contact-section input[aria-invalid="true"], .contact-section select[aria-invalid="true"], .contact-section textarea[aria-invalid="true"], .contact-section .pisell-lowcode-form-item-has-error, .contact-section .ant-form-item-has-error')||e.querySelector(".contact-section")),!1):(L(e=>(null==e?void 0:e.section)==="contact"?null:e),!0))};(0,eC.useImperativeHandle)(t,()=>({validateContact:ev,validate:async()=>{var e,t;if(!ec())return!1;if(er.current!==en||"ready"!==A||R||w&&((null==(e=S.current)?void 0:e.isOpen())||B||F))return O(es("Wait for the confirmation details to load and save.","请等待确认资料加载并保存完成。")),eh(),!1;let l=I.filter(e=>e.formId).findIndex(e=>!em(e));if(l>=0)return L({section:"resources",message:es("Complete and save each resource form before continuing.","请先填写并保存每项资源关联表单。")}),eg(e=>e.querySelectorAll(".venue-resource-form-entry")[l]||null),!1;let i=I.filter(e=>e.policyId).findIndex(e=>!J[e.key]);return i>=0?(L({section:"agreements",message:es("Read and agree to each resource policy before continuing.","请先阅读并同意各项资源协议。")}),eg(e=>e.querySelectorAll(".venue-confirmation-agreements .checkout-agreement")[i]||null),!1):g&&!await (null==(t=y.current)?void 0:t.validate())?!!ec()&&(O(es("Complete the required holder details before continuing.","请先完成必填持票人资料。")),eh(),!1):!!await ev()&&!!ec()&&(O(null),L(null),!0)}}));let ef=async(e,t,l,i)=>{let a=(null==i?void 0:i.isCurrent)||ec;if(a())try{var n,r,o,s,d;if("success"!==t)throw Error(es("Unable to save the form.","表单保存失败。"));let c=null==l?void 0:l.form_record_id;if(Number(null==l?void 0:l.form_id)!==e.formId||!c||!/^\d+$/.test(String(c)))throw Error(es("The form did not return a saved record.","表单未返回有效的保存记录。"));let u=x.current.context.sales.bookingTicket;if(!(null==u?void 0:u.updateOrderBooking))throw Error(es("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"));let p=JSON.parse(JSON.stringify(i?i.values:(null==(o=C.current[e.key])||null==(r=o.form)||null==(n=r.getFieldsValue)?void 0:n.call(r))||{}));if(await e3u(e,{resourceId:e.resourceId,formId:e.formId,recordId:c,values:p},{readBooking:eu,updateBooking:e=>u.updateOrderBooking(e),assertCurrent:()=>{if(!a())throw Error(es("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"))}}),!a()||(M.current.delete(e.key),x.current.context.cart.refreshCartSnapshot(),await (null==(s=(d=x.current).onMutation)?void 0:s.call(d)),!a()))return;ea(e=>e+1),O(null),W(t=>({...t,[e.key]:""})),q(t=>t===e.key?null:t)}catch(t){if(a()){let l=e3A(t,es("Unable to save the form. Please retry.","表单保存失败,请重试。"));O(l),W(t=>({...t,[e.key]:l}))}}finally{a()&&$(null)}};(null==(i=c.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))||c.sales.tempOrder;let ey=e1H(c),eb=e.orderReview??e.children,ex=0;return(0,eH.jsxs)("section",{ref:v,className:"venue-booking-confirmation checkout-modules","aria-label":es("Booking details","预订资料"),children:[(null==(a=c.sales.contactInfo)?void 0:a.loading)?(0,eH.jsx)(eT.Spin,{}):null,(null==(r=c.sales.contactInfo)||null==(n=r.config)?void 0:n.enabled)&&(0,eH.jsxs)(e3W,{id:`${h}-contact`,number:++ex,title:es("Contact details","联系人信息"),className:"contact-section",children:[(0,eH.jsx)(e8f,{ref:b,context:c,scopeKey:e.scopeKey,config:c.sales.contactInfo.config,disabled:p,isActive:m,locale:u}),(null==z?void 0:z.section)==="contact"&&(0,eH.jsx)("p",{className:"error-text",role:"alert",children:z.message})]}),eb&&(0,eH.jsx)(e3W,{id:`${h}-order`,number:++ex,title:es("Review your order","核对订单"),children:eb}),g?(0,eH.jsx)("div",{hidden:!ey.enabled,children:(0,eH.jsx)(e8c,{ref:y,context:c,scopeKey:e.scopeKey,locale:u,isActive:m,disabled:p,onMutation:e.onMutation})}):e.holderContent,"loading"===A?(0,eH.jsx)(eT.Spin,{}):null,E?(0,eH.jsx)("div",{className:"venue-confirmation-feedback",children:(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:E,action:"error"===A?(0,eH.jsx)(eT.Button,{onClick:()=>ei(e=>e+1),children:es("Retry","重试")}):void 0})}):null,"ready"===A&&I.some(e=>e.formId)?(0,eH.jsxs)(e3W,{id:`${h}-resources`,number:++ex,title:es("Form","表单"),children:[(null==z?void 0:z.section)==="resources"&&I.some(e=>e.formId&&!em(e))&&(0,eH.jsx)("p",{className:"error-text",role:"alert",children:z.message}),I.filter(e=>e.formId).map(e=>{var t;return(0,eH.jsxs)(e8b,{title:V[e.key]||e.title,resourceTitle:e.title,locale:u,external:w,opening:B===e.key,saved:ep(e),open:F===e.key&&ec(),disabled:p||!!(R&&R!==e.key)||!!B,busy:R===e.key,onOpen:()=>{w?(e=>{var t,l,i,a,n;if(!w||!e.formId||p||R||B||(null==(t=S.current)?void 0:t.isOpen())||!ec())return;let r=++j.current,o=c.sales.bookingTicket,s=()=>ec(en)&&j.current===r&&x.current.context.sales.bookingTicket===o&&eXy(x.current.context.sales.bookingTicket),d=e3d(e,eu),u=(null==(l=(null==o||null==(i=o.getTempOrder)?void 0:i.call(o))||c.sales.tempOrder)?void 0:l.customer_id)??void 0;q(e.key),H(e.key),W(t=>({...t,[e.key]:""})),S.current.open({action:"function"==typeof(null==_||null==(n=_.appHelper)||null==(a=n.utils)?void 0:a.action)?e=>_.appHelper.utils.action(e):void 0,request:{formId:e.formId,recordId:null==d?void 0:d.recordId,values:null==d?void 0:d.values,customerId:oi(u)?void 0:u,zIndex:1101},isCurrent:s,onOpened:t=>{s()&&(H(null),"string"==typeof t.title&&t.title.trim()&&U(l=>({...l,[e.key]:t.title.trim()})))},onSaved:t=>{s()&&(H(null),q(null),M.current.add(e.key),$(e.key),ef(e,"success",{form_id:t.formId,form_record_id:t.recordId},{values:t.values,isCurrent:s}))},onCancelled:()=>{s()&&(H(null),q(null))},onError:t=>{if(!s())return;H(null),q(null),t.uncertain&&M.current.add(e.key);let l="HOST_UNAVAILABLE"===t.code?es("The kiosk form service is unavailable. Please update this terminal and retry.","终端表单服务不可用,请更新终端后重试。"):t.uncertain?es("We could not confirm the saved form. Reopen it to review before continuing.","无法确认表单的保存结果,请重新打开核对后继续。"):es("Unable to load the form. Please retry.","表单加载失败,请重试。");O(l),W(t=>({...t,[e.key]:l}))}})})(e):!ec()||p||R&&R!==e.key||q(e.key)},onClose:()=>q(null),footer:(0,eH.jsx)(eXE,{disabled:p||!!R||!T.current.has(e.key)||ep(e),busy:R===e.key,onClick:()=>{if(ec()&&!p&&!R)try{var t,l,i;if(!(null==(t=C.current[e.key])?void 0:t.submit))throw Error(es("The form is not ready.","表单尚未就绪。"));W(t=>({...t,[e.key]:""})),$(e.key),null==(i=C.current[e.key])||null==(l=i.submit)||l.call(i)}catch(l){let t=e3A(l,es("Unable to save the form. Please retry.","表单保存失败,请重试。"));$(null),O(t),W(l=>({...l,[e.key]:t}))}},children:ep(e)?es("Saved","已保存"):es("Save details","保存资料")}),children:[Y[e.key]&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:Y[e.key]}),!w&&(N?(0,eH.jsx)(eH.Fragment,{children:(0,eH.jsx)("div",{className:"venue-booking-legacy-controls",style:p||R?{pointerEvents:"none"}:void 0,children:(0,eH.jsx)(N,{id:e.formId,ref:t=>{C.current[e.key]=t},isGetLastData:!1,setting:{isHidden:1},isV2API:!0,isShowSkeleton:!0,isClearData:!1,defaultValues:null==(t=e3d(e,eu))?void 0:t.values,onSubmit:(t,l)=>void ef(e,t,l),onFormConfigChange:t=>{if(ec()&&t&&Object.keys(t).length){var l;T.current.add(e.key);let i=eXp((null==(l=t.form)?void 0:l.title)??t.title,u||"en");i&&U(t=>t[e.key]===i?t:{...t,[e.key]:i}),ea(e=>e+1)}},onChange:(t,l)=>{if(ec()){if(t)T.current.delete(e.key);else if(!l||!Object.keys(l).length){T.current.delete(e.key);let t=es("Unable to load the form. Please retry.","表单加载失败,请重试。");O(t),W(l=>({...l,[e.key]:t}))}}},onFinishFailed:()=>{if(!ec())return;let t=es("Please complete the required form fields.","请填写表单中的必填内容。");$(null),O(t),W(l=>({...l,[e.key]:t}))},onFormValueChange:t=>{var l;if(!ec())return;let i=null==(l=e3d(e,eu))?void 0:l.values;JSON.stringify(t)===JSON.stringify(i)?M.current.delete(e.key):M.current.add(e.key),ea(e=>e+1)}})})}):(0,eH.jsx)(eT.Alert,{type:"error",message:es("The form component is unavailable. Reload before continuing.","表单组件未加载,请刷新后继续。")}))]},`${en}:${e.key}`)})]}):null,(e.agreements||"ready"===A&&I.some(e=>e.policyId))&&(0,eH.jsxs)(e3W,{id:`${h}-agreements`,number:++ex,title:es("Agreements","协议"),className:"venue-confirmation-agreements",children:[(null==z?void 0:z.section)==="agreements"&&I.some(e=>e.policyId&&!J[e.key])&&(0,eH.jsx)("p",{className:"error-text",role:"alert",children:z.message}),"ready"===A&&I.filter(e=>e.policyId).map(e=>(0,eH.jsx)(e2z,{title:ed(e),lang:eo?"zh":"en",accepted:!!J[e.key],disabled:p||!!R,onOpen:()=>void(e=>{if(!p&&!R&&ec())try{if(!e.policyId||!e.policyResponse)throw Error(es("Unable to load the resource policy.","无法加载资源协议。"));$(e.key),G({task:e,request:async t=>{if(!ec()||String(t)!==e.policyId)throw Error(es("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"));return e.policyResponse}})}catch(e){ec()&&!["cancel","programmatic-close","replaced"].includes(null==e?void 0:e.type)&&O(e3A(e,es("Unable to load the resource policy.","无法加载资源协议。")))}})(e)},e.key)),e.agreements]}),e.note&&(0,eH.jsx)(e3W,{id:`${h}-note`,number:++ex,title:es("Order note","订单留言"),children:e.note}),(null==K?void 0:K.task.policyId)&&ec()&&(0,eH.jsx)(e8y,{policyId:K.task.policyId,title:ed(K.task),request:K.request,locale:u,preloadedPolicy:w?{policyId:K.task.policyId,response:K.task.policyResponse}:void 0,accepted:!!J[K.task.key],onClose:()=>{G(void 0),$(null)},onConfirm:e=>{let t=K.task.policyId;ec()&&t&&(ee(l=>({...l,[K.task.key]:{status:"confirmed",policyId:t,policy:e}})),G(void 0),$(null))},onLoadError:e=>{ec()&&(O(e3A(e,es("Unable to load the resource policy.","无法加载资源协议。"))),G(void 0),$(null))}},`${en}:${K.task.key}`)]})});function e8N(e,t,l,i){var a,n,r,o;let s=null==(n=i.find(e=>String(e.id)===String(t)))||null==(a=n.label)?void 0:a.trim();if(s)return s;let d=(null==(r=e.booking)?void 0:r.holder)??(null==(o=e.cacheItem._extend)?void 0:o.holder),c=UR(null==d?void 0:d.form_record);if(1===e.quantity&&1===c.length&&String(c[0])===String(t)&&String(null==d?void 0:d.form_id)===String(e.config.formId)&&((null==d?void 0:d.customer_id)==null||String(d.customer_id)===String(l)))return"string"==typeof d.name&&d.name.trim()||void 0}function e8C(e){var t,l,i,a,n,r,o;let{context:s,scopeKey:d,mode:c,locale:u,disabled:p,onEdit:m,productLineUid:g,inline:h=!1,ordinalOffset:v=0,onRemoveTicket:f}=e,y=U4(),b=e1H(s,d,u),x=String(u||"").startsWith("zh"),k=(e,t)=>x?t:e,_=(0,eC.useRef)(!0),w=(0,eC.useRef)(!1),S=(0,eC.useRef)({context:s,scopeKey:d,disabled:p,onRemoveTicket:f});S.current={context:s,scopeKey:d,disabled:p,onRemoveTicket:f};let j=e1V(s,d),[N,C]=(0,eC.useState)(!1),[M,T]=(0,eC.useState)();(0,eC.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]),(0,eC.useEffect)(()=>{T(void 0)},[j]);let I=e=>_.current&&e1V(S.current.context,S.current.scopeKey)===e,P=(null==(i=s.sales.bookingTicket)||null==(l=i.getOrderCustomerSnapshot)||null==(t=l.call(i))?void 0:t.id)??(null==(r=s.sales.bookingTicket)||null==(n=r.getTempOrder)||null==(a=n.call(r))?void 0:a.customer_id)??(null==(o=s.sales.tempOrder)?void 0:o.customer_id),A=(h?b.displayLines:b.lines).filter(e=>{let t=e.orderLine.metadata;return(!g||e.uid===g)&&!!e.booking&&(!(null==t?void 0:t.venue_booking_scope_key)||t.venue_booking_scope_key===d)&&(!(null==t?void 0:t.venue_booking_role)||t.venue_booking_role===("party"===c?"party_main":"tickets"))});if(!A.length)return null;let D=async(e,t)=>{var l;let i=S.current.onRemoveTicket;if(i&&!S.current.disabled&&!w.current&&!b.blocked&&I(j)&&"tickets"===c&&1===e.quantity&&0===t&&(null==(l=e.orderLine.metadata)?void 0:l.venue_booking_role)==="tickets"){w.current=!0,C(!0),T(void 0);try{await i(e.uid,t)}catch(e){I(j)&&T(e3A(e,k("Unable to remove this ticket. Please try again.","无法删除这张票,请重试。")))}finally{w.current=!1,_.current&&C(!1)}}},E=A.map(e=>{let t=e8s(y.getHolderFormDetailForSource(e.cacheItem),u),l={label:t.edit,disabled:p||N||b.blocked,onClick:m},i=y.getHolderOptionsForSource(e.cacheItem),a=e.booking,n=[a.start_date,a.start_time&&a.end_time?`${a.start_time}–${a.end_time}`:a.start_time].filter(Boolean).join(" \xb7 "),r=Array.from({length:e.quantity},(l,a)=>{let n=e.ids[a],r=null!=n&&""!==n,o=r?e8N(e,n,P,i):void 0;return{name:o,label:e.config.enabled?o||(r?k("Profile linked; name unavailable","档案已关联,姓名暂不可用"):k(`${t.name} not selected`,`尚未选择${t.name}`)):t.notRequired}});return(0,eH.jsxs)("section",{className:h?"venue-inline-holder-review":"cart-group",children:[!h&&(0,eH.jsx)(e32,{className:"booking-order-item-flat",title:e.title||k("Booking","预约"),details:n?(0,eH.jsx)("span",{className:"booking-item-metadata",children:n}):void 0}),"party"===c?(0,eH.jsx)(e31,{items:r.map((e,i)=>({label:r.length>1?`${t.name} #${i+1}`:t.name,value:(0,eH.jsx)("span",{className:e.name?void 0:"needs-attention",children:e.label}),action:l}))}):(0,eH.jsx)("div",{className:"ticket-list",children:r.map((t,i)=>{var a;return(0,eH.jsx)(e32,{layout:"row",icon:(0,eH.jsx)(eXj,{size:20,"aria-hidden":"true"}),title:`${k("Ticket","门票")} #${v+i+1}`,details:(0,eH.jsx)("small",{className:t.name||!e.config.enabled?void 0:"needs-attention",children:t.label}),action:e.config.enabled?l:void 0,removeAction:f&&1===e.quantity&&(null==(a=e.orderLine.metadata)?void 0:a.venue_booking_role)==="tickets"?{label:`${k("Remove ticket","删除门票")} ${e.title||k("Ticket","门票")} #${v+i+1}`,disabled:p||N||b.blocked,onClick:()=>{D(e,i)}}:void 0},i)})})]},e.uid)}),O=M&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:M});return h?(0,eH.jsxs)(eH.Fragment,{children:[O,E]}):(0,eH.jsxs)(e33,{title:k("Holder","持有人"),children:[O,E]})}e8j.displayName="VenueBookingConfirmation";let e8M=(0,eC.forwardRef)(function(e,t){let{source:l,previous:i,ids:a,onChange:n,quantity:r,customerId:o,os:s,disabled:d,text:c}=e,u=U3(),{required:p,formId:m}=Ho(l),[g,h]=(0,eC.useState)(!0),[v,f]=(0,eC.useState)(!1),[y,b]=(0,eC.useState)(0),[x,k]=(0,eC.useState)(!1),_=(0,eC.useRef)(null),w=a.length>r||p&&a.length!==r,S=(0,eC.useMemo)(()=>({...l,_extend:{...l._extend,quantity:r,holder_relations:i}}),[l,r,i]),j=(0,eC.useMemo)(()=>({client:{value:{id:o}}}),[o]);return(0,eC.useEffect)(()=>{let e=!0;h(!0),f(!1);let t=t=>{e&&(f(!t),h(!1))};return u.prepareHolderOptionsForSource(l,{throwOnError:!0}).then(e=>t(e.accessAllowed),()=>t(!1)),()=>{e=!1}},[l,o,y,u.prepareHolderOptionsForSource]),(0,eC.useImperativeHandle)(t,()=>({async readRelations(){if(w){var e;k(!0),null==(e=_.current)||e.scrollIntoView({block:"nearest"});return}if(a.length&&(g||v))return;let t=a.length?await s.getOtherParams():void 0;return ek5(S,a,{productSource:l,customerId:o,isFranchisee:!!(null==t?void 0:t.isFranchisee),holderOptions:u.getHolderOptionsForSource(l),holderFormDetail:u.getHolderFormDetailForSource(l)})}}),[a,w,g,v,s,l,o,S,u]),(0,eH.jsxs)("fieldset",{className:"venue-extra-holder",ref:_,disabled:d,children:[g?(0,eH.jsx)("p",{role:"status",children:c("Loading holder profiles…","正在加载档案…")}):v?(0,eH.jsxs)("div",{role:"alert",children:[c("Holder profiles are unavailable.","暂时无法加载档案。")," ",(0,eH.jsx)("button",{type:"button",onClick:()=>b(e=>e+1),children:c("Retry","重试")})]}):(0,eH.jsx)(Yi,{presentation:"inline",holderOptionsLoaded:!0,state:j,cacheItem:S,required:p,getCurrentCacheItem:()=>S,value:a,onChange:e=>{d||(n(e),k(!1))}},String(m)),x&&w&&(0,eH.jsx)("p",{role:"alert",className:"venue-extra-detail-error",children:p?c(`Choose ${r} holder profiles to continue.`,`请选择 ${r} 份档案后继续。`):c(`Choose up to ${r} holder profiles.`,`最多选择 ${r} 份档案。`)})]})});function e8T(e){let{runtime:t}=e,l=t.configurationModal;return(null==l?void 0:l.extraSession)?(0,eH.jsx)(e8I,{runtime:t,modal:l},l.plan.openId):null}function e8I(e){var t,l,i;let{runtime:a,modal:n}=e,{plan:r,extraSession:o,configuration:s}=n,{text:d,locale:c,bookingUI:u}=a,p=UM(),m=(0,eC.useMemo)(()=>eN7(p.customerAuth),[p.customerAuth]),g=r.productDetail,[h,v]=(0,eC.useState)(o.quantity),[f,y]=(0,eC.useState)(!1),[b,x]=(0,eC.useState)(!1),[k,_]=(0,eC.useState)(),[w,S]=(0,eC.useState)(!1),[j,N]=(0,eC.useState)(!1),[C,M]=(0,eC.useState)(),T=(0,eC.useRef)(null),I=(0,eC.useRef)(null),P=!1!==o.hasSku,A=(0,eC.useMemo)(()=>e1y(o.productDetail,s.skuValue.product_variant_id,o.editingLine),[o.productDetail,s.skuValue.product_variant_id,o.editingLine]),D=Ho(A),E=(0,eC.useRef)(a.customerId),[O,z]=(0,eC.useState)(!0),L=(0,eC.useMemo)(()=>(o.holderRelations||[]).filter(e=>{var t,l;return"form"!==e.holder_type||O&&D.enabled&&E.current===a.customerId&&((null==(t=e.metadata)?void 0:t.form_id)==null||String(e.metadata.form_id)===String(D.formId))&&((null==(l=e.metadata)?void 0:l.customer_id)==null||String(e.metadata.customer_id)===String(a.customerId))}),[o.holderRelations,O,D.enabled,D.formId,a.customerId]),R=JSON.stringify([a.customerId,D.formId]),[$,F]=(0,eC.useState)(()=>({key:R,ids:L.filter(e=>"form"===e.holder_type).map(e=>e.holder_id)})),[q,B]=(0,eC.useState)(()=>n.initialStage??(!P||o.lineUid&&D.enabled?"holder":"sku")),[H,V]=(0,eC.useState)(!!o.lineUid||"holder"===n.initialStage),U="holder"===q&&D.enabled,Y="sku"===q&&P,W=(0,eC.useRef)(!0),K=(0,eC.useRef)(!1),G=(0,eC.useRef)(0),Q=(0,eC.useRef)(a);Q.current=a;let Z=eXv((null==(t=(l=a.os).getTempOrder)?void 0:t.call(l))??a.order),J=(0,eC.useRef)({os:a.os,scopeKey:a.scopeKey,sessionId:a.session.sessionId,order:Z}),X=o3(()=>{var e,t,l;return W.current&&!1!==Q.current.props.isActive&&Q.current.os===J.current.os&&Q.current.scopeKey===J.current.scopeKey&&Q.current.session.sessionId===J.current.sessionId&&eXv((null==(e=(t=Q.current.os).getTempOrder)?void 0:e.call(t))??Q.current.order)===J.current.order&&(null==(l=Q.current.configurationModal)?void 0:l.extraSession)===o}),ee=eXy(a.os)&&D.enabled&&!eXb(a.context),et=eXy(a.os)&&String(E.current||"")!==String(a.customerId||""),el=a.busy||a.extras.busy||a.checkout.submitting||f||b||!!C,ei=a.disabled||!1===a.props.isActive,ea=(0,eC.useMemo)(()=>({token:{colorPrimary:u.brand.primaryColor,colorPrimaryBg:u.brandTokens["--primary-soft"]}}),[u.brand.primaryColor,u.brandTokens]);(0,eC.useEffect)(()=>(W.current=!0,()=>{W.current=!1,G.current+=1}),[]);let en=o3(async()=>{if(!X()||K.current||ei)return;K.current=!0,y(!0),N(!0),_(void 0);let e=String(eXb(Q.current.context)||"");try{await eXk({context:Q.current.context,products:[A],force:!0,openCustomerAuth:m,isCurrent:X})}catch(e){X()&&_(e3A(e,d("Unable to open holder details. Please try again.","无法打开持有人资料,请重试。")))}finally{let t=String(eXb(Q.current.context)||"");X()&&t&&t!==e&&M({customerId:t,configuration:Q.current.configurationModal.configuration,quantity:h}),K.current=!1,W.current&&y(!1)}});(0,eC.useEffect)(()=>{U&&ee&&D.required&&!j&&!el&&!ei&&en()},[U,ee,D.required,j,el,ei,en]),(0,eC.useEffect)(()=>{if(!C)return;if(!X())return void M(void 0);if(String(a.customerId||"")!==C.customerId||a.extrasCatalog.loading)return;if(a.extrasCatalog.error){M(void 0),_(d("Unable to reload this item. Close it and try again.","无法重新读取该商品,请关闭后重试。"));return}let e=!0;return K.current=!0,(o.lineUid?a.extras.prepareEdit(o.lineUid,C.quantity):a.extras.prepare(o.productDetail,C.quantity)).then(t=>{if(!(e&&X()))return;if("ready"!==t.status)throw Error("invalid"===t.status?t.issues.map(e=>e.message).join(" "):d("This item changed. Close it and try again.","该商品已变化,请关闭后重试。"));let l=iC(t.plan.productDetail,C.configuration.skuValue,{requiredOptionValidation:n.requiredOptionValidation,overSold:1===n.overSold});if(!l)throw Error(d("The item options changed. Close it and choose again.","商品规格已变化,请关闭后重新选择。"));Q.current.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?{...e,plan:t.plan,extraSession:t.session,configuration:{...C.configuration,skuValue:l},initialStage:"holder"}:e)}).catch(t=>{e&&X()&&_(e3A(t,d("Unable to reload this item. Close it and try again.","无法重新读取该商品,请关闭后重试。")))}).finally(()=>{K.current=!1,e&&W.current&&M(void 0)}),()=>{e=!1}},[C,a.customerId,a.extrasCatalog.loading,a.extrasCatalog.error,a.os,a.scopeKey,a.session.sessionId,Z,X]);let er=(0,eC.useCallback)(e=>{T.current=e,S(!!e)},[]),eo=e2W({enabled:!b&&!1!==a.props.isActive,openId:r.openId,scopeKey:o.contextKey,sessionId:a.session.sessionId,productDetail:g,skuValue:s.skuValue,quantity:h,overSold:1===n.overSold,timeZone:u.timeZone,customerId:a.customerId,os:a.extrasQueries}),es=eXp(g.title||g.name,c),ed=eXp(g.description,c),ec=Rv(g),eu=(g.variant||[]).find(e=>Number(e.id)===Number(s.skuValue.product_variant_id))||g,ep=[99999,Number((null==(i=g.item_rule_limit)?void 0:i.remainingMax)??99999)];1===Number(eu.is_track)&&1!==n.overSold&&ep.push(Number(eu.stock_quantity??0));let em=Math.max(0,Math.min(...ep.filter(Number.isFinite))),eg=e=>String(a.amount(e)),eh=iY(s.skuValue,"",e=>eXp(e,c),eg).reduce((e,t)=>e.concat(t.label,...(t.children||[]).map(e=>e.label)),[]).filter(Boolean).join(" \xb7 "),ev=()=>{el||K.current||(G.current+=1,a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?void 0:e))},ef=async()=>{if(el||ei||K.current||Y&&(!T.current||!w))return;K.current=!0;let e=G.current,t=()=>X()&&e===G.current,l=()=>t()&&!Q.current.disabled&&!1!==Q.current.props.isActive&&(!eXy(Q.current.os)||String(E.current||"")===String(Q.current.customerId||""));y(!0),_(void 0);try{var i,r;if(Y&&!1!==n.requiredOptionValidation)try{await T.current.validate()}catch{return}if(!l())return;let e=iC(g,(null==(i=T.current)?void 0:i.getTransformValues())??s.skuValue,{requiredOptionValidation:n.requiredOptionValidation,overSold:1===n.overSold});if(!e)throw Error(d("Complete the required selections to continue.","请完成必选内容后继续。"));let c={skuValue:e,variantDraft:Q.current.configurationModal.configuration.variantDraft};if(a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?{...e,configuration:c}:e),Y&&Ho(e1y(o.productDetail,e.product_variant_id,o.editingLine)).enabled){V(!0),B("holder");return}let u=U&&!ee?await (null==(r=I.current)?void 0:r.readRelations()):L;if(!u||!l())return;let p=await a.extras.commit(o,c,h,u);if(!t()||"cancelled"===p.status)return;x(!0),a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?void 0:e)}catch(e){t()&&_(e3A(e,d("Unable to add this item. Please try again.","暂时无法添加商品,请重试。")))}finally{K.current=!1,W.current&&y(!1)}},ey="phone"===a.variant?"mobile":"desktop",eb=F6.View;return(0,eH.jsx)(eT.ConfigProvider,{theme:ea,children:(0,eH.jsx)(nY.PisellThemeProvider,{theme:ea,children:(0,eH.jsx)(oU,{renderType:"mobile"===ey?"drawer":"modal",props:{...F6.getContainerProps(ey),open:!0,onCancel:ev,onClose:ev,closable:!1,destroyOnClose:!0,placement:"bottom",getContainer:u.portal||void 0,className:`${F6.containerClassName} venue-extra-detail-modal venue-booking-legacy-controls`},children:(0,eH.jsxs)(eb,{layout:ey,title:es,subtitle:eXp(g.subtitle,c),cover:g.cover,coverText:es.slice(0,2),unitPrice:ec&&(0,eH.jsxs)(eH.Fragment,{children:["from"===ec.qualifier&&d("From ",""),a.amount(ec.amount),"from"===ec.qualifier&&d(""," 起")]}),totalPrice:(0,eH.jsx)("span",{role:"status","aria-live":"polite",children:"ready"===eo.status?a.amount(eo.subtotal):"loading"===eo.status?d("Calculating…","正在计算…"):"—"}),selectionSummary:eh,description:ed?(0,eH.jsx)(e2T,{content:ed}):null,loading:!1,pending:el,confirmDisabled:ei||Y&&!w||h>em||et||U&&ee&&D.required,confirmLabel:Y&&D.enabled?d("Next: holder details","下一步:选择档案"):o.lineUid?d("Save changes","保存修改"):d("Add to cart","加入购物车"),closeLabel:d("Close","关闭"),backLabel:d("Back","返回"),onBack:U&&P&&!o.lineUid?()=>{el||(B("sku"),_(void 0))}:void 0,onClose:ev,onConfirm:()=>{ef()},noteControl:null,quantityControl:(0,eH.jsxs)(eH.Fragment,{children:[k&&(0,eH.jsx)("div",{role:"alert",className:"venue-extra-detail-error",children:k}),(0,eH.jsx)(z8,{variant:"capsule",size:"large",value:h,min:1,max:em,disabled:el||ei,theme:ea,onChange:e=>{K.current||el||ei||(G.current+=1,v(e),_(void 0))}})]}),children:[Y&&(0,eH.jsx)($$,{ref:er,type:F6.skuType,dataSource:g,value:s.skuValue,variantDraft:s.variantDraft,selectionKey:r.selectionKey,initializationPolicy:H?"preserve":"auto-required-defaults",disabled:ei||b,config:{overSold:n.overSold},theme:ea,priceFormatter:eg,customScrollParent:".venue-extra-detail-modal .sku-detail-appearance__scroller",presentation:{modal:{className:"pisell-flat-sku-selection-modal pisell-booking-product-detail-options-modal"}},onChange:(e,t)=>{if(K.current||el||ei)return;G.current+=1,_(void 0);let l=Ho(e1y(o.productDetail,e.product_variant_id,o.editingLine));(String(l.formId)!==String(D.formId)||l.enabled!==D.enabled)&&(z(!1),F({key:JSON.stringify([a.customerId,l.formId]),ids:[]})),a.setConfigurationModal(l=>(null==l?void 0:l.extraSession)===o?{...l,configuration:{skuValue:e,variantDraft:void 0===t?l.configuration.variantDraft:t.variantDraft}}:l)}}),U&&ee?(0,eH.jsx)("div",{className:"venue-extra-holder","aria-busy":f||!!C,children:f||C?(0,eH.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-label":d("Loading holder profiles","正在加载档案"),children:(0,eH.jsx)("div",{className:"holder-picker","aria-hidden":"true",children:(0,eH.jsx)("span",{className:"venue-holder-skeleton-field"})})}):(0,eH.jsx)("button",{type:"button",className:"button secondary",disabled:el||ei,onClick:()=>{en()},children:D.required?d("Choose holders","选择持有人"):d("Choose holders (optional)","选择持有人(选填)")})}):U&&(0,eH.jsx)(e8M,{ref:I,source:A,previous:L,quantity:h,customerId:a.customerId,os:a.os,ids:$.key===R?$.ids:[],onChange:e=>F({key:R,ids:e}),disabled:el||ei,text:d},R)]})})})})}function e8P(e){let{animated:t,artRef:l}=e;return(0,eH.jsx)("span",{ref:l,className:`benefits-banner-art${t?" benefits-banner-art--animated":""}`,"aria-hidden":"true",children:(0,eH.jsxs)("svg",{viewBox:"0 0 120 88",focusable:"false",children:[(0,eH.jsxs)("g",{className:"benefits-banner-sparkles",children:[(0,eH.jsx)("circle",{cx:"18",cy:"18",r:"4"}),(0,eH.jsx)("circle",{cx:"101",cy:"65",r:"3"}),(0,eH.jsx)("path",{d:"M91 11l2 5 5 2-5 2-2 5-2-5-5-2 5-2 2-5Z"})]}),(0,eH.jsxs)("g",{className:"benefits-banner-gift benefits-banner-gift--left",children:[(0,eH.jsx)("rect",{x:"13",y:"31",width:"35",height:"31",rx:"5"}),(0,eH.jsx)("path",{d:"M10 31h41v10H10zM30.5 31v31M19 22c8-1 11 9 11 9s-12 1-12-6c0-1 .3-2 1-3Zm23 0c-8-1-11 9-11 9s12 1 12-6c0-1-.3-2-1-3Z"})]}),(0,eH.jsxs)("g",{className:"benefits-banner-gift benefits-banner-gift--right",children:[(0,eH.jsx)("rect",{x:"80",y:"38",width:"27",height:"25",rx:"4"}),(0,eH.jsx)("path",{d:"M77 38h33v8H77zM93.5 38v25M85 31c6-1 8 7 8 7s-9 1-9-4c0-1 .3-2 1-3Zm17 0c-6-1-8 7-8 7s9 1 9-4c0-1-.3-2-1-3Z"})]}),(0,eH.jsxs)("g",{className:"benefits-banner-ticket",children:[(0,eH.jsx)("path",{d:"M43 20h42a6 6 0 0 1 6 6v8a7 7 0 0 0 0 14v8a6 6 0 0 1-6 6H43a6 6 0 0 1-6-6v-8a7 7 0 0 0 0-14v-8a6 6 0 0 1 6-6Z"}),(0,eH.jsx)("path",{d:"M54 49 74 30"}),(0,eH.jsx)("circle",{cx:"55",cy:"31",r:"3"}),(0,eH.jsx)("circle",{cx:"73",cy:"49",r:"3"})]})]})})}function e8A(e){let{status:t,needsAttention:l=!1,hidden:i=!1,disabled:a=!1,open:n,onOpenChange:r,onOpen:o,onClose:s,children:d,dialogProps:c,presentation:u="dialog"}=e,{lang:p,presentationPlatform:m}=eJ$(),g="kiosk"===m,[h,v]=(0,eC.useState)(!1),f=n??h,y=e=>{void 0===n&&v(e),null==r||r(e)},[b,x]=(0,eC.useState)(!1),k=(0,eC.useRef)(null),_=t??e0_(p,"benefitsTitle"),w=!b&&!a&&!l;(0,eC.useLayoutEffect)(()=>{let e=k.current;if(e)return eJ5(e,"--checkout-benefits-height",g)},[g]);let S=()=>{y(!1),null==s||s(),requestAnimationFrame(()=>{var e,t;return null==(t=k.current)||null==(e=t.querySelector("button"))?void 0:e.focus({preventScroll:!0})})},j=(0,eC.useRef)(S);j.current=S,(0,eC.useEffect)(()=>{if("floating"!==u||!f||i)return;let e=()=>Array.from(document.querySelectorAll((null==c?void 0:c.externalDialogSelector)??eX9)).some(e=>e.getClientRects().length>0),t=t=>{var l;(null==(l=k.current)?void 0:l.contains(t.target))||e()||(y(!1),null==s||s())},l=t=>{"Escape"!==t.key||t.defaultPrevented||e()||(t.preventDefault(),j.current())};return document.addEventListener("pointerdown",t),document.addEventListener("keydown",l),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",l)}},[u,f,i,r,s,null==c?void 0:c.externalDialogSelector]);let N=d??(0,eH.jsx)("p",{className:"benefits-empty",role:"status",children:"zh"===p?"当前没有可用优惠,您可以继续完成预订。":"There are no offers available for this booking. You can continue to checkout."});return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("div",{className:`checkout-benefits${"floating"===u?" checkout-benefits--floating":""}`,ref:k,hidden:i,children:[(0,eH.jsxs)(eXE,{secondary:!0,className:`checkout-benefits-trigger${l?" needs-attention":""}`,"data-attention":w?"true":void 0,disabled:a,"aria-haspopup":"dialog","aria-expanded":f&&!i,onClick:()=>{x(!0),f?S():(y(!0),null==o||o())},children:[(0,eH.jsx)(e8P,{animated:w}),(0,eH.jsx)("span",{className:"checkout-benefits-label","aria-live":"polite","aria-atomic":"true",children:_}),(0,eH.jsx)(e3V,{className:"checkout-benefits-arrow",size:18,"aria-hidden":"true"})]}),"floating"===u&&(0,eH.jsx)("section",{className:"checkout-benefits-popover",role:"dialog","aria-label":e0_(p,"benefitsTitle"),hidden:!f||i,children:N})]}),"dialog"===u&&(0,eH.jsx)(e0t,{...c,zIndex:(null==c?void 0:c.zIndex)??600,externalDialogSelector:(null==c?void 0:c.externalDialogSelector)??eX9,title:e0_(p,"benefitsTitle"),closeLabel:e0_(p,"close"),className:"checkout-benefits-dialog",open:f&&!i,onClose:S,footer:(0,eH.jsxs)("div",{className:"checkout-benefits-footer",children:[(0,eH.jsx)("p",{role:"status","aria-atomic":"true",children:_}),(0,eH.jsx)(eXE,{onClick:S,children:e0_(p,"benefitsDone")})]}),children:N})]})}let e8D=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm84,108a83.6,83.6,0,0,1-16.75,50.28L77.72,60.75A84,84,0,0,1,212,128ZM44,128A83.6,83.6,0,0,1,60.75,77.72L178.28,195.25A84,84,0,0,1,44,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.56,87.56,0,0,1-20.41,56.28L71.72,60.4A88,88,0,0,1,216,128ZM40,128A87.56,87.56,0,0,1,60.41,71.72L184.28,195.6A88,88,0,0,1,40,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M200,128a71.69,71.69,0,0,1-15.78,44.91L83.09,71.78A71.95,71.95,0,0,1,200,128ZM56,128a71.95,71.95,0,0,0,116.91,56.22L71.78,83.09A71.69,71.69,0,0,0,56,128Zm180,0A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-20,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm90,102a89.6,89.6,0,0,1-22.29,59.22L68.78,60.29A89.95,89.95,0,0,1,218,128ZM38,128A89.6,89.6,0,0,1,60.29,68.78L187.22,195.71A89.95,89.95,0,0,1,38,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.56,87.56,0,0,1-20.41,56.28L71.72,60.4A88,88,0,0,1,216,128ZM40,128A87.56,87.56,0,0,1,60.41,71.72L184.28,195.6A88,88,0,0,1,40,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm92,100a91.67,91.67,0,0,1-24.21,62.13L65.87,60.21A92,92,0,0,1,220,128ZM36,128A91.67,91.67,0,0,1,60.21,65.87L190.13,195.79A92,92,0,0,1,36,128Z"}))]]),e8E=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e8D}));function e8O(e){let{name:t,image:l,imageFallback:i,imagePosition:a,description:n,descriptionContent:r,lang:o,price:s,priceSuffix:d,metadata:c,details:u,badge:p,featured:m=!1,selection:g,actionLabel:h,disabled:v=!1,busy:f=!1,unavailable:y,disabledReason:b,onSelect:x}=e,k=dq("booking-presentation"),_=v||!!y,w=y?e0_(o,"unavailableProductAction"):h;return(0,eH.jsxs)("article",{className:`product-card ${m?"featured-product":""} ${g?"has-selection":""} ${_?"is-disabled":""} ${y?"is-unavailable":""}`,children:[g&&(0,eH.jsxs)("p",{id:`${k}-selection`,className:"product-selected-count","aria-live":"polite","aria-atomic":"true",children:[(0,eH.jsx)("span",{className:"sr-only",children:g.description??g.label}),(0,eH.jsx)("span",{className:"product-selected-label","aria-hidden":"true",children:g.label})]}),(l||i||p||y)&&(0,eH.jsxs)("div",{className:"product-image",children:[l&&(0,eH.jsx)("img",{src:l,alt:"",style:a?{objectPosition:a}:void 0}),!l&&i,p&&(0,eH.jsx)("span",{className:"product-badge",children:p}),y&&(0,eH.jsxs)("span",{id:`${k}-unavailable`,className:"product-unavailable-badge",children:["ended"===y.kind?(0,eH.jsx)(e3Q,{size:16,"aria-hidden":"true"}):(0,eH.jsx)(e8E,{size:16,"aria-hidden":"true"}),(0,eH.jsx)("span",{children:y.label})]})]}),(0,eH.jsxs)("div",{className:"product-copy",children:[(0,eH.jsx)("h3",{children:t}),c,(0,eH.jsx)(e2R,{name:t,description:n,content:r,lang:o}),u,!y&&v&&b&&(0,eH.jsx)("span",{id:`${k}-disabled`,className:"sr-only",children:b}),(0,eH.jsxs)("div",{className:"product-bottom",children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("strong",{children:s}),d&&(0,eH.jsx)("small",{children:d})]}),(0,eH.jsxs)(eXE,{className:"product-select","aria-label":`${w}: ${t}`,"aria-describedby":[g&&`${k}-selection`,y?`${k}-unavailable`:v&&b&&`${k}-disabled`].filter(Boolean).join(" ")||void 0,"aria-haspopup":"dialog",disabled:_,busy:f,onClick:x,children:[w,y?(0,eH.jsx)(e8E,{size:18,"aria-hidden":"true"}):(0,eH.jsx)(e3V,{size:18,"aria-hidden":"true"})]})]})]})]})}function e8z(e){let t="string"==typeof e?e.trim().toLowerCase():"";return"past"===t?"ended":"capacity_full"===t||"resource_capacity_exceeded"===t?"capacity":["booking_cutoff_after_start","booking_cutoff_before_start","booking_cutoff_advance"].includes(t)?"cutoff":["booking_cutoff_future_day","schedule_excluded_date","outside_operating_hours","outside_resource_window"].includes(t)?"not-open":t.includes("configuration")||["booking_cutoff_invalid","unsupported_resource_group","availability_unsupported"].includes(t)?"configuration":void 0}e8E.displayName="ProhibitIcon";let e8L=K5["sku-list-a5"],e8R={...e8L,skuListConfig:{...e8L.skuListConfig,listConfig:{...null==(el=e8L.skuListConfig)?void 0:el.listConfig,columns:2,showTab:!0,isTreeTab:!1,tabStyle:"switch",stickyTop:!1,columnGap:16,rowGap:24}}},e8$={...eYn,columns:2,layoutDirection:"column",nameColor:"var(--ink)",priceColor:"var(--ink)"},e8F={...e8L,skuListConfig:{...e8L.skuListConfig,listConfig:{...null==(ei=e8L.skuListConfig)?void 0:ei.listConfig,columns:1,isTreeTab:!1,stickyTop:!1,columnGap:16,rowGap:16},skuCardAllConfig:{...null==(ea=e8L.skuListConfig)?void 0:ea.skuCardAllConfig,skuCardConfig:{...null==(er=e8L.skuListConfig)||null==(en=er.skuCardAllConfig)?void 0:en.skuCardConfig,background:"var(--cream)",paddingX:16,paddingY:16}}}},e8q={...eYn,columns:1,layoutDirection:"row",showImage:!0,imageWidth:"96px",imageHeight:"96px",nameColor:"var(--ink)",priceColor:"var(--ink)"};function e8B(e){let{product:t,presentation:l,disabled:i,onSelect:a,settlementPriceRows:n,mode:r,locale:o,quantityByProductId:s,formatAmount:d,preparingProductId:c,availability:u,catalogLoading:p,catalogError:m,productLoadChannel:g}=e,h="party"===r,v=o.startsWith("zh"),f=function(e){let{product:t,availability:l,loading:i,error:a,channel:n,locale:r}=e;if(i||a)return;let o=String(r||"").startsWith("zh"),s=(e,t)=>o?t:e;if(RD(t,n))return{label:s("Sold out","已售罄"),kind:"unavailable"};let d=!!(l&&!l.available&&!l.requiresConfiguration);if(!RE(t)&&!d)return;let c=null==l?void 0:l.reasons,u=(d&&Array.isArray(c)?c:[]).map(e8z),p=u.length&&u[0]&&u.every(e=>e===u[0])?u[0]:void 0;return"ended"===p?{label:s("Session ended","时段已结束"),kind:"ended"}:"capacity"===p?{label:s("Not enough capacity","剩余容量不足"),kind:"unavailable"}:"cutoff"===p?{label:s("Booking closed","预订已截止"),kind:"unavailable"}:"not-open"===p?{label:s("Not offered on this date","当日未开放"),kind:"unavailable"}:"configuration"===p?{label:s("Booking setup incomplete","配置不完整"),kind:"unavailable"}:{label:s("Unavailable on this date","当前日期不可预约"),kind:"unavailable"}}({product:t,availability:u[String(t.id)],loading:p,error:m,channel:g,locale:o}),y=eXp(t.title??t.name,v?"zh":"en"),b=(null==l?void 0:l.description)??eXm(t.description,v?"zh":"en"),x=Rv(t),k="string"==typeof t.cover?t.cover:"",_=(null==l?void 0:l.actionLabel)??(h?v?"查看并选择":"View and customize":v?"选择门票":"Choose ticket"),w=Array.isArray(t._promotionTags)?t._promotionTags.map(e=>eXp(e.text,v?"zh":"en")).filter(Boolean):[],S=(null==n?void 0:n.length)?(0,eH.jsx)(Rx,{rows:n}):x&&d?(0,eH.jsxs)("span",{className:"pisell-price-text",children:["from"===x.qualifier&&!v&&(0,eH.jsx)("span",{className:"pisell-price-text-prefix-text",style:{fontSize:"0.65em",marginRight:4},children:"From"}),d(x.amount),"from"===x.qualifier&&v&&(0,eH.jsx)("span",{className:"pisell-price-text-suffix-text",style:{fontSize:"0.65em",marginLeft:4},children:"起"}),x.unit&&(0,eH.jsxs)("span",{children:["/",x.unit]})]}):x?(0,eH.jsx)(L6,{value:x.amount,isMini:"from"===x.qualifier,precision:x.precision,hideDecimalForWholeNumbers:!x.precision&&void 0,suffix:x.unit?(0,eH.jsxs)("span",{children:["/",x.unit]}):void 0}):null,j=Number((null==s?void 0:s[String(t.id)])||0),N=h?(null==l?void 0:l.selected)?{label:v?"已选":"Selected"}:void 0:j>0?{label:e0_(v?"zh":"en","selectedTicketCorner").replace("{count}",String(j)),description:e0_(v?"zh":"en","selectedTickets").replace("{count}",String(j))}:void 0;return(0,eH.jsx)(e8O,{name:y,image:k?o0(k,800):void 0,imageFallback:(0,eH.jsx)(nY.PisellImageCard,{className:"venue-catalog-text-cover",dataSource:{alt:y},width:"100%",height:"100%"}),description:"string"==typeof b?b:eXm(t.description,v?"zh":"en"),descriptionContent:(0,eH.jsx)(e2T,{content:eXp(t.description,v?"zh":"en")}),lang:v?"zh":"en",price:S,metadata:null==l?void 0:l.businessInfo,details:w.length?(0,eH.jsx)("span",{className:"venue-catalog-promotions",children:w.map((e,t)=>(0,eH.jsx)("span",{children:e},`${t}:${e}`))}):void 0,selection:N,actionLabel:"string"==typeof _?_:v?"选择商品":"Choose product",busy:c===String(t.id),disabled:i,unavailable:f,onSelect:a})}function e8H(e){return null==e?null:Array.isArray(e)?e.map(e8H):"object"==typeof e?Object.keys(e).sort().reduce((t,l)=>(t[l]=e8H(e[l]),t),{}):e}let e8V=e=>{if("string"!=typeof e&&"number"!=typeof e)return;let t=String(e).trim();return t&&"0"!==t?t:void 0},e8U=e=>{var t;return e8V((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??e.identity_key)};function e8Y(e){if(("string"==typeof e||"number"==typeof e)&&String(e).trim())try{let t=new lz(e);return t.isFinite()&&t.gte(0)?t:void 0}catch{return}}let e8W=new Set(["id","discount_id","order_discount_id","amount","_num","num"]),e8K=new Set(["fixed_amount","original_amount"]),e8G=new Set(["num","mainProductDiscountAmount","optionDiscountAmount","product_discount_difference","custom_product_bundle_map_id","unique_identification_number","product_uid","booking_uid"]);function e8Q(e,t){return Object.keys(e||{}).reduce((l,i)=>(t.has(i)||(l[i]=e[i]),l),{})}function e8Z(e,t){let l=[];for(let i of e){let e=e8Y(i[t]),a=e8Y(i.num);if(!e||!a||!a.gt(0))return;let n=lz.clone({precision:Math.max(20,e.precision()+a.precision())});l.push(new n(e).mul(a))}let i=Math.max(1,...l.map(e=>e.e+1)),a=Math.max(0,...l.map(e=>e.decimalPlaces())),n=lz.clone({precision:i+a+String(e.length).length+2});return l.reduce((e,t)=>e.plus(t),new n(0)).toString()}function e8J(e){if(("string"==typeof e||"number"==typeof e)&&""!==String(e).trim())try{let t=new lz(e);return t.isFinite()?t:void 0}catch{return}}let e8X=e=>{var t,l;return{os:e.os,scopeKey:e.scopeKey,sessionId:e.session.sessionId,identity:eXv((null==(t=(l=e.os).getTempOrder)?void 0:t.call(l))??e.order)}},e80=(e,t)=>e.os===t.os&&e.scopeKey===t.scopeKey&&e.sessionId===t.sessionId&&e.identity===t.identity,e82=e=>{var t,l,i;return String((null==(t=(null==(l=(i=e.os).getTempOrder)?void 0:l.call(i))??e.order)?void 0:t.customer_id)||"")};function e81(e){var t,l,i,a;return String((null==(t=e.os.otherParams)?void 0:t.platform)||(null==(a=e.engine)||null==(i=a.appHelper)||null==(l=i.constants)?void 0:l.platform)||"").trim().toLowerCase()}let e84=(e,t)=>eXy(e.os)||"promotion_code"===t&&"kiosk"===e81(e);function e83(e,t){let l=UD(),i=(0,nY.useToast)(),a=UM(),n=(0,eC.useMemo)(()=>eN7(a.customerAuth),[a.customerAuth]),r=(0,eC.useRef)(e);r.current=e;let o=(0,eC.useRef)(!0),s=(0,eC.useRef)(),[d,c]=(0,eC.useState)(!1),[u,p]=(0,eC.useState)(),m=e8X(e),g=e84(e,t),h=l.isLoggedIn(),v="promotion_code"===t?t:void 0,f=(g?!eXx(e.context,{reason:v}):h)&&!!u&&e80(u.owner,m)&&u.customer===e82(e);return(0,eC.useEffect)(()=>(o.current=!0,()=>{var e,t;o.current=!1,null==(t=s.current)||null==(e=t.cancelLogin)||e.call(t),s.current=void 0}),[]),(0,eC.useEffect)(()=>{if(s.current&&!e80(s.current.owner,m)){var e,t;null==(e=(t=s.current).cancelLogin)||e.call(t),s.current=void 0,c(!1)}},[m.os,m.scopeKey,m.sessionId,m.identity]),(0,eC.useEffect)(()=>{g||h||p(void 0)},[g,h]),{ready:f,pending:d,ensure:o3(()=>{let e=r.current,a=e8X(e);if(!o.current||!e.ready||!1===e.props.isActive)return Promise.resolve(!1);let d=e84(e,t);if((d?!eXx(e.context,{reason:v}):l.isLoggedIn())&&u&&e80(u.owner,a)&&u.customer===e82(e))return Promise.resolve(!0);if(s.current&&e80(s.current.owner,a))return s.current.promise;let m={owner:a};s.current=m;let g=()=>o.current&&s.current===m&&!1!==r.current.props.isActive&&("promotion_code"!==t||r.current.showOffers)&&e80(a,e8X(r.current));return m.promise=Promise.resolve().then(async()=>{try{if(!g())return!1;if(d){if(!await eXk({context:e.context,reason:v,openCustomerAuth:n,isCurrent:g})||!g())return!1;return r.current.cart.refreshCartSnapshot(),p({owner:a,customer:e82(r.current)}),!0}if(!l.isLoggedIn()&&(!await new Promise(t=>{if(m.cancelLogin=()=>t(!1),!l.openLoginModal({callback:e=>{m.cancelLogin=void 0,t("success"===e)}}))throw m.cancelLogin=void 0,Error(e.text("Login is unavailable. Please try again.","登录暂不可用,请重试。"))})||!g()||!l.isLoggedIn())||!g())return!1;if("function"!=typeof a.os.syncAuthenticatedOrderCustomer||await a.os.syncAuthenticatedOrderCustomer()!==!0)throw Error(e.text("Could not load your account details. Please try again.","无法读取账号信息,请重试。"));if(!g()||!l.isLoggedIn())return!1;return r.current.cart.refreshCartSnapshot(),p({owner:a,customer:e82(r.current)}),!0}catch(l){return g()&&("promotion_code"===t?i.fail(e3A(l,e.text("Could not verify your account. Please try again.","无法验证账号,请重试。"))):r.current.setError(e3A(l,e.text("Could not prepare checkout. Please try again.","无法进入确认页面,请重试。")))),!1}finally{s.current===m&&(s.current=void 0,o.current&&c(!1))}}),c(!0),m.promise})}}function e88(e){var t,l;let{runtime:i,visible:a=!0}=e,{context:n,sales:r,cart:o,variant:s}=i,d=e81(i),c=e83(i,"promotion_code"),u=(null==(l=r.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))||r.tempOrder||o.tempOrder,p=Number(null==u?void 0:u.customer_id);return(0,eH.jsx)(eDC,{customerId:Number.isFinite(p)?p:void 0,discountList:o.discountList,getDiscountList:r.getDiscountList,scanPromotionCode:o.scanCode,setDiscountSelected:o.setDiscount,patchDiscountCardHolderOnStore:r.patchDiscountCardHolderOnStore,variant:s,children:(0,eH.jsxs)("div",{hidden:!a,children:[(0,eH.jsx)(eDN,{}),(0,eH.jsx)(eEG,{context:n,variant:s,appearance:"light",enableWalletAssets:!0,enableManualPromotionCode:!0,beforePromotionCodeSearch:["pc","h5","kiosk"].includes(d)?c.ensure:void 0,enablePromotionBanner:!0,preserveWalletAssetsWhileRefreshing:!0,enableVoucherProductAdd:!1,promotionProductSource:"catalog-only"})]})})}function e86(e){var t,l,i,a,n,r,o;let{context:s,lines:d,locale:c}=e,u=U4(),p=String(c||"").startsWith("zh"),m=function(e,t,l){let i=new Map;for(let a of e){if(!a.config.enabled)continue;let e=l(a.cacheItem);for(let l=0;l<a.quantity;l+=1){let n=a.ids[l],r=null!=n&&""!==n,o=JSON.stringify([String(a.config.formId),r?String(n):"unselected"]),s=i.get(o);s?s.quantity+=1:i.set(o,{key:o,formId:a.config.formId,quantity:1,label:r?e8N(a,n,t,e)||String(n):void 0})}}return Array.from(i.values())}(d,(null==(i=s.sales.bookingTicket)||null==(l=i.getOrderCustomerSnapshot)||null==(t=l.call(i))?void 0:t.id)??(null==(r=s.sales.bookingTicket)||null==(n=r.getTempOrder)||null==(a=n.call(r))?void 0:a.customer_id)??(null==(o=s.sales.tempOrder)?void 0:o.customer_id),u.getHolderOptionsForSource);if(!m.length)return null;let g=e8s(void 0,c).name,h=new Map;for(let e of d){let t=String(e.config.formId);e.config.enabled&&!h.has(t)&&h.set(t,e8s(u.getHolderFormDetailForSource(e.cacheItem),c).name)}return(0,eH.jsx)("div",{className:"venue-cart-holders","aria-label":p?"持有人":"Holder",children:m.map(e=>{let t=h.get(String(e.formId))||g;return(0,eH.jsxs)("div",{className:e.label?void 0:"venue-cart-holder-unselected",children:[e.label?(0,eH.jsxs)(eH.Fragment,{children:[t,p?":":": ",e.label]}):p?`尚未选择${t}`:`${t} not selected`,e.quantity>1&&(0,eH.jsxs)(eH.Fragment,{children:[" \xd7 ",e.quantity]})]},e.key)})})}function e85(e){let{products:t,locale:l}=e,i=eMq(t);return i.length?(0,eH.jsx)("div",{className:"venue-order-promotions","aria-label":l.startsWith("zh")?"已生效活动":"Applied promotions",children:i.map(e=>(0,eH.jsx)("span",{children:e.detail||e.title},e.key))}):null}function e87(e,t,l,i){return(0,eC.useMemo)(()=>{if(!e.length)return e;let a=e=>e.map(e=>{let t=e._promotionTags||[];return{...e,_promotionTags:t.map(e=>({...e,text:eXp(e.text,i)})).filter(e=>e.text)}});if(null==t?void 0:t.appendPromotionTags)try{let i=t.appendPromotionTags(e);if(!l||i.some(e=>{var t;return null==(t=e._promotionTags)?void 0:t.length}))return a(i)}catch{}return a(exq(e,l))},[e,t,l,i])}function e89(e,t){var l;let{session:i,checkout:a,error:n,handoff:r,config:o,text:s}=e;if(!i.ready||i.error||i.pendingOrder)return;let d=t||n||a.error;return d?{kind:"error",tone:"error",message:d}:(null==(l=e.depositHydration)?void 0:l.error)?{kind:"deposit",tone:"error",message:e.depositHydration.error}:r?{kind:"submitted",tone:"success",message:s("Your order was submitted. Continue in the payment page or order details.","订单已提交,请在支付页或订单详情继续。")}:o.visualError?{kind:"design",tone:"warning",message:s("The design settings are invalid. The last valid appearance is still in use.","视觉配置无效,已保留上一份有效样式。")}:void 0}function e6e(e){let{feedback:t,text:l,onDismiss:i,onRetry:a,onRetryPayment:n}=e;return(0,eH.jsx)(e2s,{tone:t.tone,className:"venue-action-feedback",children:(0,eH.jsxs)("div",{className:"venue-action-feedback-message",children:[(0,eH.jsx)("span",{children:t.message}),"deposit"===t.kind&&a&&(0,eH.jsx)(eXE,{secondary:!0,onClick:a,children:l("Retry","重试")}),n&&(0,eH.jsx)(eXE,{secondary:!0,onClick:n,children:l("Continue payment","继续支付")}),"restored"===t.kind&&i&&(0,eH.jsx)(eXO,{className:"venue-action-feedback-dismiss","aria-label":l("Dismiss draft notice","关闭草稿恢复提示"),onClick:i,children:(0,eH.jsx)(eXJ,{size:16,"aria-hidden":"true"})})]})})}function e6t(e,t){var l;let[i,a]=(0,eC.useState)(),n=e89(e,t),r=n&&!e.linePicker&&("restored"!==n.kind||i!==e.scopeKey)?(0,eH.jsx)(e6e,{feedback:n,text:e.text,onRetry:null==(l=e.depositHydration)?void 0:l.retry,onRetryPayment:e.checkout.canRetryPayment?()=>{e.checkout.retryPayment()}:void 0,onDismiss:()=>a(e.scopeKey)}):void 0,o=e.orderPanel.isMobile&&!e.orderPanel.open;return{summary:o?void 0:r,footer:o?r:void 0}}function e6l(e){let{extras:t=!1}=e;return(0,eH.jsx)("div",{className:`list-group-items venue-catalog-skeleton-grid${t?" venue-catalog-skeleton-grid--extras":""}`,"aria-hidden":"true",children:[0,1].map(e=>t?(0,eH.jsxs)("div",{className:"pisell-plus-sales-product-card venue-catalog-skeleton-extra",children:[(0,eH.jsx)("div",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-extra-image"}),(0,eH.jsxs)("div",{className:"venue-catalog-skeleton-copy",children:[(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block"}),(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-short"})]}),(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-control"})]},e):(0,eH.jsx)("article",{className:"product-card venue-catalog-skeleton-card",children:(0,eH.jsxs)("div",{className:"product-copy",children:[(0,eH.jsx)("h3",{children:(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block"})}),(0,eH.jsxs)("div",{className:"product-description venue-catalog-skeleton-copy",children:[(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block"}),(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-short"})]}),(0,eH.jsxs)("div",{className:"product-bottom",children:[(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-price"}),(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-action"})]})]})},e))})}function e6i(e){var t;let{runtime:l,showHero:i="select"===l.step}=e,{bookingUI:a,config:n}=l;return(0,eH.jsx)(eH.Fragment,{children:i&&(null==(t=n.brand)?void 0:t.hero)&&(0,eH.jsx)("section",{className:"hero booking-hero venue-booking-sales__hero","aria-label":a.brand.name,children:(0,eH.jsx)("img",{src:n.brand.hero,alt:""})})})}function e6a(e){let{runtime:t}=e,{session:l,order:i,text:a,openOrderHistory:n}=t,r=t.isKiosk&&(0,eH.jsx)(eXE,{secondary:!0,disabled:t.checkout.paymentActive||t.kioskLifecycle.resetting,onClick:()=>{t.kioskLifecycle.finish({navigateHome:!0})},children:a("Back to home","返回首页")});return t.isKiosk&&l.error?(0,eH.jsxs)(e2s,{tone:"error",children:[l.error,(0,eH.jsx)(eXE,{disabled:t.checkout.paymentActive||t.kioskLifecycle.resetting,onClick:()=>{l.restart().catch(e=>t.setError(e instanceof Error?e.message:String(e)))},children:a("Retry","重试")}),r]}):l.error?(0,eH.jsx)(e2s,{tone:"error",children:l.error}):l.ready?t.isKiosk&&l.pendingOrder?(0,eH.jsxs)(e2s,{children:[(0,eH.jsx)("p",{children:a("An order is already open. Return home to start another booking.","当前已有订单,可返回首页开始新的预订。")}),r]}):l.pendingOrder?(0,eH.jsxs)(e2s,{children:[(0,eH.jsx)("p",{children:a("You have an existing order. Continue from its order details.","已有订单,请从订单详情继续。")}),Number(null==i?void 0:i.order_id)>0&&(0,eH.jsx)("a",{className:"button secondary",href:`/order/details?id=${encodeURIComponent(i.order_id)}`,children:a("Open order","查看订单")}),(0,eH.jsx)(eXE,{secondary:!0,onClick:n,children:a("Check order history","核对订单记录")})]}):null:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("div",{className:"venue-booking-sales__loading",role:"status","aria-label":a("Loading your booking","正在加载预订"),children:(0,eH.jsx)(eT.Spin,{})}),r]})}function e6n(e){var t,l;let{runtime:i}=e,{configurationModal:a,setConfigurationModal:n,locale:r,busy:o,extras:s,checkout:d,setComposer:c,linePicker:u,setLinePicker:p,bookingUI:m,text:g,run:h,disabled:v,setExpandedSection:f}=i,y=eXN(),b="zh"===r?"zh":"en",x=u?e89(i):void 0,k=e2W({enabled:!!(null==a?void 0:a.partyDraft)&&!1!==i.props.isActive,openId:null==a?void 0:a.plan.openId,scopeKey:i.scopeKey,sessionId:i.session.sessionId,productDetail:null==a?void 0:a.plan.productDetail,skuValue:null==a?void 0:a.configuration.skuValue,quantity:null==a||null==(t=a.partyDraft)?void 0:t.quantity,overSold:(null==a?void 0:a.overSold)===1,priceBasis:"catalog",timeZone:m.timeZone,customerId:i.customerId,os:i.mainQueries}),_=(null==a?void 0:a.partyDraft)?{label:g("Estimated subtotal","预计小计"),amount:(0,eH.jsx)("span",{role:"status","aria-live":"polite",children:"ready"===k.status?i.amount(k.subtotal):"loading"===k.status?g("Calculating…","正在计算…"):g("Unavailable","暂无法报价")})}:void 0;return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)(eT.Modal,{getContainer:m.portal||void 0,open:!!d.failure,title:g("Booking could not be submitted","预订提交失败"),centered:!0,closable:!1,maskClosable:!1,keyboard:!1,destroyOnClose:!0,footer:(0,eH.jsx)(eXE,{busy:d.resettingFailure,onClick:()=>{d.confirmFailure()},children:g("Confirm","确认")}),children:[(0,eH.jsx)("p",{role:"alert",style:{whiteSpace:"pre-wrap"},children:null==(l=d.failure)?void 0:l.message}),d.resetError&&(0,eH.jsx)(e2s,{tone:"error",children:d.resetError})]}),(0,eH.jsx)(e8T,{runtime:i}),a&&!a.extraSession&&(0,eH.jsx)(e0j,{plan:a.plan,title:eXp(a.plan.productDetail.title||a.plan.productDetail.name,r),summary:a.partyDraft&&(0,eH.jsx)(e2$,{detail:a.plan.productDetail,configuration:a.configuration,locale:b,catalogStartingAmount:a.partyDraft.catalogStartingAmount,catalogPriceQualifier:a.partyDraft.catalogPriceQualifier,formatAmount:i.amount}),configuration:a.configuration,configurationFooter:_,onConfigurationChange:e=>n(t=>t&&{...t,configuration:e}),skuOptions:{config:{overSold:a.overSold}},requiredOptionValidation:a.requiredOptionValidation,locale:b,busy:o||s.busy||d.submitting,onCancel:()=>n(void 0),onConfigurationConfirm:async(e,t)=>!!t.isCurrent()&&(a.partyDraft&&(c({...a.partyDraft,configuration:e}),f("time"),i.notifyPartyProductConfirmed(),y("#party-time")),t.isCurrent()&&n(void 0),!0)},a.plan.openId),(0,eH.jsx)(eT.Modal,{getContainer:m.portal||void 0,open:!!u,title:g("Choose the configured item to change","选择需要调整的商品项"),footer:null,onCancel:()=>p(void 0),destroyOnClose:!0,children:(0,eH.jsxs)("div",{className:"venue-booking-legacy-controls",children:[(null==x?void 0:x.kind)==="error"&&(0,eH.jsx)(e6e,{feedback:x,text:g}),null==u?void 0:u.map(e=>{var t;return(0,eH.jsxs)("div",{className:"venue-booking-sales__line-picker",children:[(0,eH.jsxs)("span",{children:[eXp(e.product_title,r)||String(e.product_id)," ",(null==(t=e.product_sku)?void 0:t.name)||""]}),(0,eH.jsx)(eT.InputNumber,{min:0,precision:0,value:Number(e.num),disabled:v,onChange:t=>{null!=t&&h(async()=>{let l=await s.setLineQuantity(e1E(e),Number(t));p(void 0),await i.showExtraPreparation(l)})}})]},e1E(e))})]})})]})}function e6r(e){let{runtime:t,preview:l,showFilters:i}=e,{mode:a,text:n,disabled:r,main:o,mainPoolEmpty:s}=t;return s&&(!t.mainCatalog.menuListIds.length||l.catalogueReady||"unavailable"===l.status&&!l.searchRange)?(0,eH.jsx)(e2s,{children:"party"===a?n("No Party packages are available.","暂无可选 Party 商品。"):n("No tickets are available.","暂无可选门票。")}):l.catalogueReady?(0,eH.jsx)(e6o,{runtime:t,showFilters:i}):l.awaitingSelection?(0,eH.jsx)(e2s,{children:n("Choose a date to see available products.","请选择日期,再查看可用商品。")}):"error"!==l.status&&"unavailable"!==l.status?(0,eH.jsx)("div",{className:`venue-booking-catalog venue-booking-catalog--${a}`,role:"status","aria-busy":"true","aria-label":"party"===a?n("Loading Party packages","正在加载 Party 商品"):n("Loading tickets","正在加载门票"),children:(0,eH.jsx)(e6l,{})}):(0,eH.jsxs)(e2s,{tone:"error"===l.status?"error":void 0,children:["error"===l.status?n("Available dates could not be checked. Please retry.","可订日期查询失败,请重试。"):l.searchRange?n("No available date in the next month. You can browse other dates.","未来一个月内暂无可订日期,可手动查看其他日期。"):n("No available date in this view. Choose another date or week.","当前日期范围内暂无可订日期,请选择其他日期或翻周查看。"),"error"===l.status&&(0,eH.jsx)("button",{type:"button",className:"button secondary",disabled:r,onClick:o.retry,children:n("Retry","重试")})]})}function e6o(e){var t,l,i;let{runtime:a,showFilters:n=!0,formatAmount:r=a.amount}=e,{mode:o,locale:s,context:d,variant:c,scopeKey:u,date:p,main:m,props:g,productQuantities:h,disabled:v,text:f,partyMain:y,composer:b,run:x,openProduct:k}=a,_=(0,eC.useMemo)(()=>eXg(s),[u,s]),w=e87(m.products,a.sales.bookingTicket,null==(i=a.engine)||null==(l=i.appHelper)||null==(t=l.utils)?void 0:t.promotionEvaluator,s),S=(0,eC.useMemo)(()=>{var e;return e={mode:o,locale:s,quantityByProductId:h,formatAmount:r,preparingProductId:a.preparingProductId,availability:m.availability,catalogLoading:m.loading,catalogError:m.error,productLoadChannel:a.sales.productLoadChannel},t=>(0,eH.jsx)(e8B,{...t,...e},t.product.id)},[o,s,h,r,a.preparingProductId,m.availability,m.loading,m.error,a.sales.productLoadChannel]),j=(0,eC.useMemo)(()=>{var e;return n?e8R:{...e8R,skuListConfig:{...e8R.skuListConfig,listConfig:{...null==(e=e8R.skuListConfig)?void 0:e.listConfig,showTab:!1}}}},[n]);return(0,eH.jsx)(eYH,{context:d,mode:"retail",variant:c,businessCode:g.businessCode,className:`venue-booking-catalog venue-booking-catalog--${o}`,renderProductCard:S,catalog:{scopeKey:`${u}:${p}:main`,products:w,loading:m.loading,error:m.error,onRetry:m.retry,keepContentWhileLoading:!0,loadingContent:(0,eH.jsx)(e6l,{}),loadingLabel:(0,eH.jsx)("span",{className:"sr-only",children:f(m.products.length?"Updating availability…":"Loading available products…",m.products.length?"正在重新校验可用性…":"正在加载可预订商品…")})},quantityByProductId:h,isActive:g.isActive,productDisplayConfig:j,productListPreferences:e8$,productListPreferencesOverride:!0,categoryNavigation:n?"top":"tabbar",defaultCategorySelection:"all",allCategoryLabel:f("All","全部"),showSettings:!1,productCardVersion:"v2",productSelectionTrigger:"click",hideSingleCategoryNavigation:!0,onSelectProduct:e=>x(()=>k(e)),getProductPresentation:e=>{let t=m.availability[String(e.id)],l=(null==t?void 0:t.available)||(null==t?void 0:t.requiresConfiguration),i=e0E(e),a="party"===o&&Number((null==b?void 0:b.detail.id)??(null==y?void 0:y.line.product_id))===Number(e.id);return{disabled:v||m.loading||!!m.error||!l,description:_(e.description),businessInfo:"party"===o&&i.partySize||i.durationMinutes?(0,eH.jsxs)("div",{className:"party-meta venue-booking-sales__facts",children:["party"===o&&i.partySize&&(0,eH.jsxs)("span",{children:[(0,eH.jsx)(e2l,{size:15,"aria-hidden":"true"}),i.partySize," ",f("guests included","位参加者")]}),i.durationMinutes&&(0,eH.jsxs)("span",{children:[(0,eH.jsx)(e3Q,{size:15,"aria-hidden":"true"}),i.durationMinutes," ",f("minutes","分钟")]})]}):void 0,actionLabel:a?f("Edit package","编辑套餐"):void 0,selected:a}}})}function e6s(e){var t,l,i,a;let{runtime:n}=e,{context:r,variant:o,scopeKey:s,extrasCatalog:d,extras:c,props:u,disabled:p,run:m,showExtraPreparation:g}=n,h=(0,eC.useMemo)(()=>eXg(n.locale),[s,n.locale]),v=e87(d.products,n.sales.bookingTicket,null==(i=n.engine)||null==(l=i.appHelper)||null==(t=l.utils)?void 0:t.promotionEvaluator,n.locale),f=(0,nY.usePisellConfig)(),y=null==(a=n.order)?void 0:a.currency_symbol,b=(0,eC.useMemo)(()=>"string"==typeof y&&y.trim()?{...f,symbol:y}:f,[f,y]);return(0,eH.jsxs)(nY.PisellContext.Provider,{value:b,children:[(0,eH.jsx)("span",{className:"sr-only",role:"status","aria-live":"polite",children:n.extraQuantity.pending?n.text("Updating extras…","正在更新附加商品…"):""}),c.invalidItems.map(e=>(0,eH.jsx)(e2s,{tone:"warning",children:e.message},e.lineUid||e.code)),(0,eH.jsx)(eYH,{context:r,mode:"retail",variant:o,businessCode:u.businessCode,className:"venue-booking-catalog venue-booking-catalog--extras",productDisplayConfig:e8F,productListPreferences:e8q,productListPreferencesOverride:!0,catalog:{scopeKey:`${s}:extras`,products:v,loading:d.loading,error:d.error,onRetry:d.retry,keepContentWhileLoading:!0,loadingContent:(0,eH.jsx)(e6l,{extras:!0}),loadingLabel:(0,eH.jsx)("span",{className:"sr-only",children:n.text(d.products.length?"Updating extra prices…":"Loading extras…",d.products.length?"正在更新附加商品价格…":"正在加载附加商品…")})},quantityByProductId:{...c.quantityByProductId,...n.extraQuantity.quantities},showSettings:!1,categoryNavigation:"top",defaultCategorySelection:"all",allCategoryLabel:n.text("All","全部"),productCardVersion:"v2",productSelectionTrigger:"click",isActive:u.isActive,getProductPresentation:e=>{let t=RW(e),l=!e1p(e)||(t?n.extraQuantityDisabled:p),i=eXp(e.subtitle,n.locale).trim(),a={disabled:l,description:i?(0,eH.jsx)("div",{className:"venue-extra-subtitle",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerUp:e=>e.stopPropagation(),children:(0,eH.jsx)(e2R,{name:eXp(e.title,n.locale)||eXp(e.name,n.locale),description:h(i),lang:n.locale,content:(0,eH.jsx)(e2T,{content:i})})}):void 0};if(n.pendingExtraProductId===String(e.id))return{...a,renderAction:()=>(0,eH.jsx)("span",{className:"venue-extra-action-pending",role:"status","aria-label":n.text("Updating item","正在更新商品"),children:(0,eH.jsx)(eT.Spin,{size:"small"})})};let r=Hs(e)?n.text("Choose options","选择选项"):"phone"===o||t?void 0:n.text("Options","选规格");return r?{...a,renderAction:e=>{let{quantity:t,disabled:l,onSelect:i}=e;return(0,eH.jsx)(RK,{label:r,quantity:t,disabled:l,onSelect:i})}}:a},onSelectProduct:e=>m(async()=>g(await c.prepare(e)),e.id),onQuantityChange:(e,t,l)=>{RW(e)&&!Hs(e)?n.extraQuantity.changeQuantity(e,t,l.previousQuantity):m(async()=>g(await c.setProductQuantity(e,t)),e.id)}})]})}function e6d(e,t,l){return function(e){let{line:t,quantity:l,formatAmount:i}=e,a=function(e,t){let l=e8J(t),i=e8J(e.selling_price);if(!l||!l.gt(0)||!i)return;let a=e8J(e.original_price),n=lz.clone({precision:Math.max(20,i.precision()+l.precision(),((null==a?void 0:a.precision())||0)+l.precision())}),r=new n(i).mul(l),o=a&&new n(a).mul(l);return{total:r.toString(),...(null==o?void 0:o.gt(0))&&o.gt(r)?{originalTotal:o.toString()}:{}}}(t,l);if(a)return(0,eH.jsxs)("span",{className:"venue-order-line-price",children:[void 0!==a.originalTotal&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("del",{className:"venue-order-line-price-original",children:i(a.originalTotal)})," "]}),(0,eH.jsx)("span",{className:"venue-order-line-price-current",children:i(a.total)})]})}({line:t,quantity:l,formatAmount:e.amount})}function e6c(e){let{text:t}=e;return(0,eH.jsx)("h3",{className:"venue-cart-addons-title",children:t("Addons","附加商品")})}function e6u(e){let{date:t,locale:l}=e;return l.startsWith("zh")?(0,eH.jsxs)("time",{dateTime:t,children:[e0y(t,l,{year:"numeric",month:"long",day:"numeric"})," ",(0,eH.jsx)("span",{className:"venue-review-weekday",children:e0y(t,l,{weekday:"short"})})]}):(0,eH.jsx)("time",{dateTime:t,children:e0y(t,l)})}function e6p(e){var t,l,i,a;let{runtime:n,onlyExtras:r=!1,includeExtras:o=!0,includeGifts:s=!0,onEditExtras:d,review:c=!1,renderBookingDetails:u}=e,{bindings:p,extras:m,hasBookings:g,mode:h,text:v,locale:f,disabled:y,composer:b,orderPanel:x,editLine:k,removeLines:_,run:w}=n,[S,j]=(0,eC.useState)(),N=(i=p.bindings,a=n.holderState,e39(i,e=>{var t,l;let i=e37(e.line,e.booking);if(null===i)return null;let n=a.displayLines.find(t=>t.uid===e.productLineUid);if(!n||n.config.enabled&&(n.missing||n.ids.length<e.quantity))return null;let r=e.line;return JSON.stringify([i,n.config.enabled,n.config.required,String(n.config.formId??""),n.ids.map(String),r.original_price,r.selling_price,r.discount_list,r.note,r.remark,null==(t=r.metadata)?void 0:t._promotion,null==(l=r.metadata)?void 0:l.manual_discount])})),C=(0,eC.useMemo)(()=>new Map(n.extrasCatalog.products.map(e=>[Number(e.id),e])),[n.extrasCatalog.products]),M=e=>Hs(e1y(C.get(Number(e.product_id)),e.product_variant_id,e)),T=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Hs,a=new Set,n=new Set;return e.forEach(e=>{let t=e8U(e);t&&a.has(t)&&n.add(t),t&&a.add(t)}),e39(e,e=>i(e)||UO(e,l).length?null:function(e,t,l){var i,a,n;let r=e8U(e),o=e.metadata||{},s=o.venue_booking_role,d=Number(e.num),c=e8Y(e.original_price),u=e8Y(e.selling_price);if(!r||l.has(r)||!e8V(e.product_id)||!e8V(o.venue_booking_scope_key)||!["tickets_extra","party_extra"].includes(s)||"party_extra"===s&&!e8V(o.venue_booking_parent_uid)||!Number.isSafeInteger(d)||d<=0||!c||!u||(null==(i=e._extend)?void 0:i.independentLine)===!0||(null==(n=o.origin)||null==(a=n._extend)?void 0:a.independentLine)===!0||null!=e.discount_list&&!Array.isArray(e.discount_list))return null;let p=(e.discount_list||[]).map(e=>(function(e,t){var l,i,a;if(!e||"object"!=typeof e||Array.isArray(e))return null;let n=String(e.type??e.tag??""),r="product_discount_card"===n?"discount_card":n,o=e8V((null==(l=e.discount)?void 0:l.resource_id)??e.resource_id),s=e8V((null==(i=e.discount)?void 0:i.strategy_id)??e.strategy_id??(null==(a=e.metadata)?void 0:a.strategyId))??("promotion"===r?e8V(null==t?void 0:t.strategyId):void 0);return r&&("discount_card"!==r||o)&&(o||s)?{...e8Q(e,e8W),type:r,resource:o,strategy:s,discount:e8Q(e.discount,e8K),metadata:e8Q(e.metadata,e8G)}:null})(e,o._promotion));if(p.some(e=>null===e))return null;let m=function(e,t){let l=[];for(let i of t){let t=null==i?void 0:i.note_relations;if(!Array.isArray(t))return null;let a=t.filter(t=>(null==t?void 0:t.target_type)==="order_detail"&&String(t.target_uuid)===e);if(a.length){if(!i.note_type||!i.content||a.some(e=>"about"!==e.relation_type&&"related_to"!==e.relation_type))return null;l.push({note_type:i.note_type,content:i.content,importance:i.importance})}}return l.sort((e,t)=>JSON.stringify(e8H(e)).localeCompare(JSON.stringify(e8H(t))))}(r,t);return null===m?null:JSON.stringify(e8H({product:String(e.product_id),variant:String(e.product_variant_id??0),sku:{...e.product_sku,option:ex4(e)},bundle:e.product_bundle||[],role:s,scope:o.venue_booking_scope_key,parent:o.venue_booking_parent_uid,original:c.toString(),selling:u.toString(),discounts:p,note:e.note,remark:e.remark,notes:m,inlineNotes:e.notes,salesNotes:e.sales_notes,allergy:e.allergy,allergies:e.allergies,metadataNotes:o.notes,metadataAllergy:o.allergy,metadataAllergies:o.allergies,promotion:o._promotion,promotionTags:o._promotionTags??e._promotionTags,gift:o._giftInfo??e._giftInfo,giftData:e.giftData,manualDiscount:o.manual_discount,isManualDiscount:o.is_manual_discount,priceOverride:o.price_override,sourcePrice:o.source_product_price,mainOriginal:o.main_product_original_price,mainSelling:o.main_product_selling_price}))}(e,t,n)).map(e=>{let t=e8Z(e.members,"original_price");return{...e,quantity:e.members.reduce((e,t)=>e+(Number.isFinite(Number(t.num))?Number(t.num):0),0),price:{selling_price:e8Z(e.members,"selling_price")??"",...void 0===t?{}:{original_price:t}}}})}(m.rows,null==(t=n.order)?void 0:t.notes,null==(l=n.order)?void 0:l.holder_relations,M),I=e=>e.length>0&&(0,eH.jsx)("ul",{className:"venue-order-bundle","aria-label":v("Included items","套餐内含商品"),children:e.map(e=>(0,eH.jsxs)("li",{children:[(0,eH.jsx)("span",{children:e.name||v("Included item","套餐子商品")}),(0,eH.jsxs)("span",{children:["\xd7 ",e.quantity]})]},e.key))}),P=(e,t)=>{"remove"===t?_(e.map(e=>e.productLineUid)):e.length>1?x.closeThen(()=>j({uids:e.map(e=>e.productLineUid)})):x.closeThen(()=>{k(e[0].productLineUid)})};return(0,eH.jsxs)(eH.Fragment,{children:[!r&&!g&&(0,eH.jsxs)("div",{className:"catalog-empty",children:[(0,eH.jsx)(eXj,{size:36,"aria-hidden":"true"}),(0,eH.jsx)("p",{children:v("tickets"===h?"Pick a ticket to start your family’s adventure.":"Choose a Party to begin.","tickets"===h?"选择门票,开启全家的欢乐时光。":"选择商品开始预订 Party。")})]}),(0,eH.jsxs)("div",{className:"selected-order-list",children:[!r&&N.map(e=>{var t,l,i;let a=e.members[0],r=e.members.reduce((e,t)=>e+t.quantity,0),o=eXp(a.line.product_title,f)||String(a.line.product_id),s=(a.booking.resources||[]).map(e=>{var t;return eXp((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,f)}).filter(Boolean).join(" \xb7 "),d=null==(t=n.holderState.displayLines.find(e=>e.uid===a.productLineUid))?void 0:t.cacheItem,p=n.main.products.find(e=>String(e.id)===String(a.line.product_id)),m=e8e(a.line,r,f,p,d),g=!!(null==(l=a.line.product_bundle)?void 0:l.length)||1===Number((null==p?void 0:p.is_bundle)??(null==d?void 0:d.is_bundle)),x=[a.line.product_cover,null==d?void 0:d.cover,null==d||null==(i=d._extend)?void 0:i.product_cover,null==p?void 0:p.cover].map(e=>eXp(e,f)).find(Boolean),k=I(m);return(0,eH.jsxs)(e32,{title:o,amount:e6d(n,a.line,r),image:c&&x||void 0,details:(0,eH.jsxs)("div",{className:c?"booking-item-metadata":void 0,children:[c?(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)(e0r,{size:16,"aria-hidden":"true"}),(0,eH.jsx)(e6u,{date:a.date,locale:f})]}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)(e3Q,{size:16,"aria-hidden":"true"}),a.booking.start_time,"–",a.booking.end_time]})]}):(0,eH.jsxs)("div",{children:[a.date," \xb7 ",a.booking.start_time,"–",a.booking.end_time]}),s&&(0,eH.jsx)("div",{children:s}),!g&&(0,eH.jsx)("div",{children:"tickets"===h?`${r} ${v(1===r?"ticket":"tickets","张票")}`:`\xd7 ${r}`}),!c&&(0,eH.jsx)(e86,{context:n.context,locale:f,lines:n.holderState.displayLines.filter(t=>e.members.some(e=>e.productLineUid===t.uid))})]}),action:{label:`${v("Edit","修改")} ${o}`,disabled:y||!!b,onClick:()=>P(e.members,"edit")},removeAction:{label:`${v("Remove","移除")} ${o}`,disabled:y,onClick:()=>P(e.members,"remove")},children:[(0,eH.jsx)(e85,{products:e.members.map(e=>e.line),locale:f}),u?(0,eH.jsxs)(eH.Fragment,{children:[k,e.members.map((t,l)=>(0,eH.jsx)(eM().Fragment,{children:u(t.productLineUid,e.members.slice(0,l).reduce((e,t)=>e+t.quantity,0))},t.productLineUid))]}):k]},e.key)}),"tickets"===h&&!c&&o&&T.length>0&&(0,eH.jsx)(e6c,{text:v}),o&&T.map(e=>{var t,l,i,a,r;let o=e.members[0],s=eXp(o.product_title,f)||String(o.product_id),c=o._origin??(null==(a=n.order)||null==(i=a._extend)||null==(l=i.productsByUid)||null==(t=l[e1E(o)])?void 0:t.origin),u=e8e(o,e.quantity,f,C.get(Number(o.product_id)),c),p=UO(o,null==(r=n.order)?void 0:r.holder_relations).filter(e=>"form"===e.holder_type),g=M(o)||p.length>0;return(0,eH.jsxs)(e32,{layout:"row",title:s,amount:e6d(n,e.price,1),details:(0,eH.jsxs)(eH.Fragment,{children:["\xd7 ",e.quantity,p.length>0&&(0,eH.jsxs)("div",{children:[v("Holder: ","Holder:"),p.map(e=>{var t;return(null==(t=e.metadata)?void 0:t.name)||e.holder_id}).join(", ")]})]}),action:d?{label:`${v("Edit extra","编辑附加商品")} ${s}`,disabled:y||!!b,onClick:()=>x.closeThen(()=>{g&&1===e.members.length?w(async()=>{await n.showExtraPreparation(await m.prepareEdit(e1E(o)))}):d()})}:void 0,removeAction:{label:`${v("Remove extra","移除附加商品")} ${s}`,disabled:y,onClick:()=>{w(async()=>m.removeLines(e.members.map(e1E)),o.product_id??void 0)}},children:[(0,eH.jsx)(e85,{products:e.members,locale:f}),I(u)]},e.key)}),s&&p.gifts.map(e=>(0,eH.jsx)(e32,{layout:"row",title:eXp(e.product_title,f)||String(e.product_id),details:(0,eH.jsxs)(eH.Fragment,{children:[v("Promotion gift","优惠赠品")," \xd7 ",e.num]}),children:(0,eH.jsx)(e85,{products:[e],locale:f})},e1E(e)))]}),(0,eH.jsx)(eT.Modal,{getContainer:n.bookingUI.portal||void 0,open:!!S,footer:null,title:v("Choose the booking to change","选择需要调整的预订"),onCancel:()=>j(void 0),destroyOnClose:!0,children:(0,eH.jsx)("div",{className:"venue-booking-group-actions",children:p.bindings.filter(e=>null==S?void 0:S.uids.includes(e.productLineUid)).map((e,t)=>(0,eH.jsxs)(eXE,{secondary:!0,disabled:y||!!b,onClick:()=>{j(void 0),k(e.productLineUid)},children:[v("Booking","预订")," ",t+1," \xb7 ",e.quantity," ",v("ticket(s)","张票")]},e.productLineUid))})})]})}function e6m(e){let{runtime:t,includeTotal:l=!0,includeDueNow:i=!0,splitPartySubtotal:a=!1}=e,{hasBookings:n,mode:r,text:o,amount:s,amountDue:d,summary:c,order:u,hasDeposit:p,depositAmount:m}=t,g=a&&"party"===r&&n?function(e){var t,l;let{bindings:i,scopeKey:a,summary:n}=e;if(i.issues.length||1!==i.bindings.length)return null;let r=i.bindings[0].line,o=e1E(r);if(!o||(null==(t=r.metadata)?void 0:t.venue_booking_role)!=="party_main"||r.metadata.venue_booking_scope_key!==a)return null;let s=new Set([o]),d=e=>{if("string"!=typeof e&&"number"!=typeof e||""===String(e).trim())return null;try{let t=new lz(e);return t.isFinite()&&!t.isNegative()?t:null}catch{return null}},c=e=>{let t=d(e.selling_price),l=Number(e.num);return t&&Number.isSafeInteger(l)&&l>0?t.mul(l):null},u=c(r),p=d(null==n?void 0:n.product_expect_amount);if(!u||!p)return null;let m=new lz(0);for(let e of i.extras){let t=e1E(e);if(!t||s.has(t)||(null==(l=e.metadata)?void 0:l.venue_booking_role)!=="party_extra"||e.metadata.venue_booking_scope_key!==a||String(e.metadata.venue_booking_parent_uid||"")!==o)return null;let i=c(e);if(!i)return null;s.add(t),m=m.plus(i)}let g=u.toDecimalPlaces(2,lz.ROUND_HALF_UP),h=m.toDecimalPlaces(2,lz.ROUND_HALF_UP);return u.plus(m).toDecimalPlaces(2,lz.ROUND_HALF_UP).eq(p)&&g.plus(h).eq(p)?{main:g.toFixed(2),extras:h.toFixed(2)}:null}(t):null,h=g?[{id:"party-subtotal",label:o("Party subtotal","Party 商品小计"),amount:s(g.main)},{id:"extras-subtotal",label:o("Extras","附加商品"),amount:s(g.extras)}]:[{id:"subtotal",label:o("Subtotal","商品小计"),amount:s(n?null==c?void 0:c.product_expect_amount:0)}],v=Number(null==c?void 0:c.discount_amount);if(n&&Number.isFinite(v)&&0!==v&&h.push({id:"discount",label:o("Discount","优惠"),amount:s(new lz(c.discount_amount).abs().negated().toString()),tone:"discount"}),Number(null==c?void 0:c.surcharge_fee)>0&&h.push({id:"surcharge",label:o("Surcharge","附加费"),amount:s(null==c?void 0:c.surcharge_fee)}),Number(null==c?void 0:c.tax_fee)>0){var f,y;let e=c.tax_title||(null==u?void 0:u.tax_title)||o("Tax","税费"),t=(f=null==u?void 0:u.products,y=c.is_price_include_tax??c.isPriceIncludeTax??(null==u?void 0:u.is_price_include_tax),!!(null==f?void 0:f.length)&&(null==y||1===Number(y))&&f.every(e=>{let t=e.is_price_include_tax??y;return 1===Number(t)&&(e.product_bundle??[]).every(e=>1===Number(e.is_price_include_tax??t))}));h.push({id:"tax",label:t?o(`${e} (Included)`,`${e}(已含税)`):e,amount:s(c.tax_fee)})}return l&&h.push({id:"total",label:o("Total","合计"),amount:s(n?null==c?void 0:c.expect_amount:0),tone:"total"}),n&&p&&h.push({id:"deposit",label:o("Deposit","定金"),amount:s(m)}),i&&n&&h.push({id:"due-now",label:o("Due now","本次待付"),amount:s(d)}),(0,eH.jsx)(e34,{rows:h})}function e6g(e){let{runtime:t}=e,{step:l,ready:i,session:a,showOffers:n,setShowOffers:r,hasBookings:o,text:s,disabled:d,orderPanel:c}=t,u=i&&!a.error&&("select"===l||o&&("extras"===l||"review"===l)),p=n&&u;return(0,eH.jsx)(e8A,{status:s("Offers and discount cards","优惠与折扣卡"),hidden:!u,open:p,disabled:d,presentation:"floating",onOpenChange:e=>{e?c.closeThen(()=>r(!0)):r(!1)},children:(0,eH.jsx)("fieldset",{disabled:d,"aria-disabled":d,className:`venue-booking-legacy-controls venue-booking-sales__offers ${d?"venue-booking-sales__offers--disabled":""}`,children:(0,eH.jsx)(e88,{runtime:t,visible:p})})})}function e6h(e){let{runtime:t,onBack:l,disabled:i=!1}=e,[a,n]=(0,eC.useState)(!1),[r,o]=(0,eC.useState)(!1),s=(0,eC.useRef)(!1),d=(0,eC.useRef)(!0);(0,eC.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let c=!!l;(0,eC.useEffect)(()=>{c&&n(!1)},[c]);let u=(0,eC.useRef)(t);u.current=t;let p=async()=>{if(s.current||t.disabled||i)return;let e=t.session.sessionId;s.current=!0,o(!0);try{var l,a,r;if(t.isKiosk)return void await t.kioskLifecycle.finish({navigateHome:!0});if(await t.sales.clearCartAndReset(),t.session.discard(),!d.current||!t.alive.current||u.current.session.sessionId!==e)return;let i=null==(r=t.engine)||null==(a=r.appHelper)||null==(l=a.utils)?void 0:l.history;"function"==typeof(null==i?void 0:i.replace)?i.replace("/"):window.location.replace(window.location.origin)}catch(l){d.current&&t.alive.current&&u.current.session.sessionId===e&&t.setError(l instanceof Error?l.message:String(l))}finally{s.current=!1,d.current&&t.alive.current&&(o(!1),n(!1))}},m=c?t.text("Previous step","上一步"):t.text("Close booking","关闭预订");return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("button",{type:"button",className:"venue-booking-exit icon-button","aria-label":m,title:m,disabled:i||t.disabled||r,onClick:()=>{l?l():n(!0)},children:c?(0,eH.jsx)(eXP,{size:22,"aria-hidden":"true"}):(0,eH.jsx)(eXJ,{size:22,"aria-hidden":"true"})}),a&&!c&&(0,eH.jsx)(e0t,{title:t.text("Leave this booking?","退出本次预订?"),closeLabel:t.text("Close","关闭"),onClose:()=>n(!1),closeDisabled:r,closeOnBackdrop:!1,bodyClassName:"venue-booking-exit-body",footerClassName:"venue-booking-exit-actions",footer:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("button",{type:"button",className:"button secondary",disabled:r,onClick:()=>n(!1),children:t.text("Keep booking","继续预订")}),(0,eH.jsx)("button",{type:"button",className:"button",disabled:i||r||t.disabled,onClick:()=>{p()},children:t.text("Leave booking","退出预订")})]}),children:(0,eH.jsx)("p",{children:t.text("Your selections will be cleared and you will return to the store home page.","当前选择将被清除,并返回商家首页。")})})]})}function e6v(e){let{runtime:t}=e,l=t.checkout.kioskPaymentPage,i=(0,eH.jsx)("div",{className:"venue-booking-sales__loading",role:"status","aria-label":t.text("Loading checkout","正在加载确认页面"),children:(0,eH.jsx)(eT.Spin,{})});return(0,eH.jsx)("div",{className:"venue-booking-payment-step venue-booking-legacy-controls",children:l?(0,eH.jsx)(eW1,{context:t.context,checkoutPreparation:l.preparation,paymentPolicy:l.paymentPolicy,channel:"kiosk",active:!1!==t.props.isActive,loadingFallback:i,onBack:l.onBack,onPaid:l.onPaid,onDisposed:l.onDisposed},l.id):i})}let e6f={};function e6y(e){var t,l;let i=e83(e,"review"),a=eXN(),n=(0,eC.useRef)(null),r=(0,eC.useRef)(e);r.current=e;let o=(0,eC.useRef)(!0),s=(0,eC.useRef)(0),d={scopeKey:e.scopeKey,mode:e.mode,date:e.date,customerId:e.customerId,sessionId:e.session.sessionId,os:e.os,order:eXv(e.order)},c=(0,eC.useRef)(d);Object.keys(d).some(e=>d[e]!==c.current[e])&&(c.current=d);let u=c.current,[p,m]=(0,eC.useState)({owner:u,values:e6f}),g=p.owner===u?p.values:e6f;(0,eC.useEffect)(()=>{m(e=>e.owner===u?e:{owner:u,values:e6f})},[u]);let h=(e,t)=>e.scopeKey===t.scopeKey&&e.mode===t.mode&&e.date===t.date&&e.sessionId===t.sessionId&&e.os===t.os&&e.order===t.order;(0,eC.useEffect)(()=>(o.current=!0,()=>{o.current=!1,s.current+=1}),[]);let v=[{id:"select",label:e.text("tickets"===e.mode?"Tickets":"Party","tickets"===e.mode?"门票":"派对")},...e.holderState.required||"holder"===e.step?[{id:"holder",label:e.text("Holder","持有人")}]:[],...e.hasExtras?[{id:"extras",label:e.text("Addons","附加商品")}]:[],{id:"review",label:e.text("Review","确认")},...e.isKiosk||e.checkout.kioskPaymentPage?[{id:"payment",label:e.text("Payment","支付")}]:[]],f=Math.max(0,v.findIndex(t=>t.id===e.step)),y=null==(t=v[f-1])?void 0:t.id,b=async function(t){let l=arguments.length>1&&void 0!==arguments[1]&&arguments[1],d=r.current;if("payment"===t||"payment"===d.step||d.checkout.isPaymentActive()||("extras"!==t||d.hasExtras||(t="review"),"review"===t&&d.hasExtras&&(d.extrasCatalog.loading||d.extrasCatalog.error)&&(t="extras"),!o.current||i.pending||u!==c.current||d.step!==e.step||d.isExtraQuantityPending()))return;let p=v.findIndex(e=>e.id===t),m=p>=0&&p<f,g=++s.current,y=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=r.current;return o.current&&g===s.current&&(e?h(u,c.current):u===c.current)&&!1!==l.props.isActive&&l.step===d.step&&!l.disabled&&!l.isExtraQuantityPending()&&!l.composer&&!l.configurationModal&&("select"===t||m||l.hasBookings&&l.mainDateMatches&&(e?!l.mainPoolEmpty&&!l.main.error:!l.mainCatalogBlocked))};if(!y())return;if(!m&&("extras"===t||"review"===t)){if("holder"===d.step){var b;let e=await (null==(b=n.current)?void 0:b.validate());if(!y()||!e)return}let e=r.current;if(!e1H(e.context,e.scopeKey).complete){e.setError(e.text("Complete the required holder details first.","请先完成必填持票人资料。")),e.setStep("holder"),a('[data-booking-stage="holder"]');return}if("review"===t&&!e.checkExtraHolders())return}if(!y()||"holder"===t&&d.isKiosk&&(!await i.ensure()||!y(!0)))return;if("review"===t){if(!await i.ensure()||!y(!0))return;let e=r.current;if(!e1H(e.context,e.scopeKey).complete){e.setStep("holder"),a('[data-booking-stage="holder"]');return}}let x=r.current;"select"===t&&l&&x.setExpandedSection("product"),x.setError(void 0),x.setStep(t),x.orderPanel.close(),a(`[data-booking-stage="${t}"]`)},x=()=>{!y||e.disabled||i.pending||b(y)},k="review"===e.step||e.isKiosk&&"holder"===e.step;(0,eC.useEffect)(()=>{if(!k||!e.ready||i.ready)return;let t=!0,l=e.step;return i.ensure().then(e=>{let i=r.current;!e&&t&&o.current&&i.step===l&&h(u,c.current)&&i.setStep(y||"select")}),()=>{t=!1}},[k,e.step,e.ready,i.ready,i.ensure,u.scopeKey,u.mode,u.date,u.sessionId,u.os,u.order,y]);let _="select"===e.step?e.nextAfterSelect:"holder"===e.step?e.nextAfterHolder:"review",w="review"===e.step?e.isKiosk?e.text("Next: payment","下一步:支付"):e.text("Confirm & pay","确认并支付"):"holder"===_?e.text("Next: Holder","下一步:持有人"):"extras"===_?e.text("Next: add extras","下一步:附加商品"):"extras"!==e.step||e.extras.rows.some(e=>Number(e.num)>0)?e.text("Next: review & pay","下一步:确认订单"):e0_(e.locale,"skipExtras"),S={label:(0,eH.jsxs)(eH.Fragment,{children:[w," ",(0,eH.jsx)(e3V,{size:20,"aria-hidden":"true"})]}),compactLabel:w,disabled:e.disabled||!!e.depositHydration.error||i.pending||"review"===e.step&&!i.ready||!e.hasBookings||!e.mainDateMatches||e.mainCatalogBlocked||!!e.composer||!!e.configurationModal||("extras"===e.step||"review"===e.step)&&e.hasExtras&&(e.extrasCatalog.loading||!!e.extrasCatalog.error),busy:i.pending||e.depositHydration.pending||e.checkout.submitting||e.busy&&!e.pendingExtraProductId||e.holderBusy,onClick:async()=>{if(!(e.disabled||e.depositHydration.error||i.pending||e.isExtraQuantityPending()))if("review"===e.step){if(!await i.ensure())return;await e.checkout.checkout()&&!e.isKiosk&&e.setHandoff(!0)}else"select"===e.step?await b(e1H(e.context,e.scopeKey).required?"holder":e.nextAfterHolder):"holder"===e.step?await b(e.nextAfterHolder):await b("review")}},j={context:e.context,scopeKey:e.scopeKey,locale:e.locale,catalogProducts:e.main.products,isActive:e.props.isActive,disabled:e.externalHolderDisabled,onMutation:e.refresh,onStateChange:t=>e.setHolderBusy(t.pending),onRemoveTicket:"tickets"===e.mode?e.removeTicket:void 0},N=(0,eH.jsxs)("div",{className:"venue-booking-navigation",children:["payment"!==e.step&&(0,eH.jsx)(e6h,{runtime:e,onBack:y?x:void 0,disabled:i.pending}),(0,eH.jsx)(e0l,{current:f,label:e.text("Booking steps","预订步骤"),currentLabel:e.text("Current step","当前步骤"),readOnly:"payment"===e.step,steps:v.map(t=>({...t,status:"payment"===e.step||"payment"!==t.id&&("select"===t.id||e.hasBookings&&e.mainDateMatches&&!e.mainCatalogBlocked&&("holder"===t.id||e.holderState.complete))&&!e.disabled&&!i.pending?"available":"locked",onClick:()=>{b(t.id)}}))})]}),C=function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(0,eH.jsx)(e8C,{context:e.context,scopeKey:e.scopeKey,mode:e.mode,locale:e.locale,inline:!0,productLineUid:t,ordinalOffset:l,onRemoveTicket:"tickets"===e.mode?e.removeTicket:void 0,disabled:e.disabled||!!e.composer||!!e.configurationModal,onEdit:()=>{b("holder")}})},M="tickets"===e.mode&&(0,eH.jsxs)("button",{type:"button",className:"add-session full",disabled:e.disabled||!!e.composer||!!e.configurationModal,onClick:()=>{b("select",!0)},children:[(0,eH.jsx)(e3Y,{size:22,"aria-hidden":"true"}),e.text("Add more tickets","继续选购门票")]}),T=t=>(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(e6p,{runtime:e,review:!0,renderBookingDetails:t,onEditExtras:()=>{b("extras")}}),M,(0,eH.jsx)(e6m,{runtime:e,splitPartySubtotal:"party"===e.mode})]}),I=(0,eH.jsxs)(eH.Fragment,{children:["payment"===e.step&&e.checkout.kioskPaymentPage&&(0,eH.jsx)(e6v,{runtime:e}),"holder"===e.step&&(!e.isKiosk||i.ready)&&(0,eH.jsx)(e8c,{ref:n,...j,afterAssignments:M}),"extras"===e.step&&(0,eH.jsx)(e6s,{runtime:e}),k&&!i.ready&&(0,eH.jsx)("div",{className:"venue-booking-sales__loading",role:"status","aria-label":e.text("Loading checkout","正在加载确认页面"),children:(0,eH.jsx)(eT.Spin,{})}),"review"===e.step&&i.ready&&(0,eH.jsx)(e8j,{ref:e.confirmation,context:e.context,scopeKey:e.scopeKey,acceptedPolicies:e.isKiosk?g:void 0,onAcceptedPoliciesChange:e.isKiosk?e=>{o.current&&c.current===u&&m({owner:u,values:e})}:void 0,locale:e.locale,date:e.date,isActive:e.props.isActive,disabled:e.disabled,onMutation:e.refresh,onValidationBlocked:e.orderPanel.closeThen,includeHolderValidation:!1,orderReview:e.holderState.enabled&&!e.holderState.required?(0,eH.jsx)(e8c,{ref:n,...j,renderContent:t=>{let{renderLine:l}=t;return T((t,i)=>e.holderState.lines.some(e=>e.uid===t)?l(t,i):C(t,i))}}):T("tickets"===e.mode||e.holderState.enabled?C:void 0),note:(0,eH.jsx)(e3K,{hideLabel:!0,maxLength:2e3,id:`${e.mode}-order-note`,label:e.text("Order note","订单留言"),value:String((null==(l=e.order)?void 0:l.note)||""),disabled:e.disabled,onChange:t=>{e.disabled||e.sales.setOrderNote(t)},placeholder:e.text("Anything else we should know?","还有什么需要告诉我们?")})})]});return{navigation:N,primaryAction:S,back:x,previous:y,holderRef:n,renderStage:I,goTo:b}}function e6b(e){let[t,l]=(0,eC.useState)(),i=(null==t?void 0:t.scopeKey)===e.scopeKey&&t.sessionId===e.session.sessionId&&t.date===e.date,a=e.todayOnly?function(e){if(e.loading)return{status:"loading"};if(e.error)return{status:"error"};let t=Object.values(e.availability);return t.some(e=>e.available)?{status:"available"}:{status:t.some(e=>e.requiresConfiguration)?"configuration":"unavailable"}}(e.main):function(e,t,l,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e;if(i&&e<a)return{status:"unavailable"};let n=i?[e]:Array.from(new Set(t)).filter(t=>t>=e&&t>=a).sort();for(let e of n){var r;let t=(null==(r=l[e])?void 0:r.status)||"loading";if("loading"===t||"error"===t)return{status:t};if("available"===t||"configuration"===t)return{status:t,date:e}}return{status:n.length?"unavailable":"loading"}}(e.date,e.dateSearchRange?e1h(e.dateSearchRange):e.visibleDates,e.dateStates,e.session.restored&&!e.dateSearchRange,e.today);if((0,eC.useEffect)(()=>{e.todayOnly||!e.ready||e.disabled||e.dateConfirmed||i||e.hasBookings||e.composer||e.configurationModal||!e.canAutoSelectDate()||("available"===a.status||"configuration"===a.status)&&a.date&&(e.setDate(a.date),l({scopeKey:e.scopeKey,sessionId:e.session.sessionId,date:a.date}))},[e.todayOnly,e.ready,e.disabled,e.dateConfirmed,i,e.hasBookings,e.composer,e.configurationModal,e.scopeKey,e.session.sessionId,a.status,a.date,e.setDate,e.dateInteractionStarted]),e.todayOnly)return{catalogueReady:!0,status:a.status,searching:!1,searchRange:void 0,awaitingSelection:!1};let n=e.dateConfirmed||i;return{catalogueReady:n,status:a.status,searching:!n&&!!e.dateSearchRange&&"error"!==a.status&&"unavailable"!==a.status,searchRange:e.dateSearchRange,awaitingSelection:!n&&e.dateInteractionStarted&&("available"===a.status||"configuration"===a.status)}}let e6x={openCalendar:["Open calendar","打开日历"],closeCalendar:["Close calendar","关闭日历"],chooseVisitDate:["Choose your visit date","选择游玩日期"],chooseDate:["Choose a date","选择日期"],previousWeek:["Previous week","上一周"],nextWeek:["Next week","下一周"],backThisWeek:["This week","回到本周"],calendarToday:["Today","今天"],previousMonth:["Previous month","上个月"],nextMonth:["Next month","下个月"],calendarMonth:["Month","月份"],calendarYear:["Year","年份"],calendarThisMonth:["This month","回到本月"],calendarVenueTime:["Dates follow venue local time","日期按场馆当地时间"],dateNeedsReselect:["This date is no longer available. Please choose an available date.","此日期已不可预约,请重新选择可用日期。"],quickVisitDates:["Choose a day this week","快捷选择游玩日期"],calendarLoading:["Checking available dates…","正在查询可用日期…"],calendarLoadFailed:["Some dates could not be checked.","部分日期查询失败。"]},e6k=(e,t)=>{var l;return(null==(l=e6x[e])?void 0:l[+("zh"===t)])||e};function e6_(e){let{checkout:t,locale:l}=e;s2(eMn,l),s2(e3n,l);let i=t.kioskPaymentResult;if(!i)return null;let a=`${eL.getText("pisell2.big-sale.kiosk.back-home")} (${t.backHomeCountdown}s)`,n="payment"===i.kind&&!["success","deposit-paid"].includes(i.viewModel.status),r=[[...n?[{id:"continue-payment",buttonProps:{children:eL.getText("pisell2.venue-kiosk.checkout.continue-payment"),className:"primary-button",loading:t.submitting,disabled:t.resettingHome,onClick:()=>{t.checkout()}}}]:[],{id:"back-home",buttonProps:{children:n?eL.getText("pisell2.big-sale.kiosk.back-home"):a,className:n?void 0:"primary-button",loading:t.resettingHome,disabled:t.submitting,onClick:()=>{t.returnHome()}}}]];return(0,eH.jsxs)("section",{className:"venue-kiosk-result",children:[t.error&&(0,eH.jsx)(e2s,{tone:"error",children:t.error}),"payment"===i.kind?(0,eH.jsx)(Kt,{...i.viewModel,presentation:"page",actionButtons:r,autoClose:!1,closable:!1,clickOutsideToClose:!1,footer:void 0}):(0,eH.jsxs)("div",{className:"venue-kiosk-result__submitted",children:[(0,eH.jsx)("h1",{children:eL.getText("pisell2.big-sale.kiosk.order-submitted")}),(0,eH.jsx)("p",{children:eL.getText("pisell2.big-sale.kiosk.order-submitted-description")}),(0,eH.jsx)("strong",{children:i.order.reference||`${eL.getText("pisell2.venue-kiosk.checkout.order-reference")} ${i.order.orderId}`}),i.order.paymentStatusLabel&&(0,eH.jsx)("p",{children:eL.getText(i.order.paymentStatusLabel)}),null!=i.order.amountDue&&i.order.amountDue>0&&(0,eH.jsxs)("p",{children:[eL.getText("pisell2.big-sale.kiosk.to-pay"),": ",i.order.amountDueText]}),(0,eH.jsxs)("div",{className:"venue-kiosk-result__actions",children:[(0,eH.jsx)(eXE,{disabled:t.resettingHome||t.submitting,onClick:()=>{t.startNewOrder()},children:eL.getText("pisell2.big-sale.kiosk.start-next-order")}),(0,eH.jsx)(eXE,{secondary:!0,disabled:t.resettingHome||t.submitting,onClick:()=>{t.returnHome()},children:a})]})]})]})}function e6w(e){var t;let l=e3B(e),i=e6b(l),a=e6y(l),n=e6t(l),r=eXN(),[o,s]=(0,eC.useState)(!1);(0,eC.useEffect)(()=>{if(!o)return;let e=window.setTimeout(()=>s(!1),1e3);return()=>window.clearTimeout(e)},[o]);let d=(0,eC.useRef)({scopeKey:e.scopeKey}),c=l.bindings.bindings.reduce((e,t)=>e+t.quantity,0),u=function(e,t){var l;let[i,a]=(0,eC.useState)({scope:t,indicators:null==e?void 0:e.map(e=>({status:e}))});if(i.scope!==t){let l=null==e?void 0:e.map(e=>({status:e}));return a({scope:t,indicators:l}),l}if(e&&(e.length!==(null==(l=i.indicators)?void 0:l.length)||e.some((e,t)=>{var l,a;return e!==(null==(a=i.indicators)||null==(l=a[t])?void 0:l.status)}))){let l=performance.now(),n=e.map((e,t)=>{var a;let n=null==(a=i.indicators)?void 0:a[t];return(null==n?void 0:n.status)===e?n:{status:e,from:null==n?void 0:n.status,changedAt:l}});return a({scope:t,indicators:n}),n}return i.indicators}([l.dateConfirmed?"complete":"available",i.catalogueReady?c>0?"complete":"available":"locked"],d.current),p="holder"===l.step?l.text("Who is joining the fun?","谁来一起玩?"):"extras"===l.step?l.text("Make your visit extra special","为游玩增添更多乐趣"):"review"===l.step?l.text("Review your booking","确认您的预订"):void 0,m=String(l.amount(l.hasBookings?l.hasDeposit?l.amountDue:null==(t=l.summary)?void 0:t.expect_amount:0)),g=async e=>{try{await l.changeDate(e)&&(s(!0),r("#ticket-products"))}catch(e){l.setError(e instanceof Error?e.message:String(e))}},h=!!l.session.error||!l.session.ready||l.session.pendingOrder,v="payment"===l.step&&!!l.checkout.kioskPaymentPage;return l.checkout.kioskPaymentResult?(0,eH.jsx)(e6_,{checkout:l.checkout,locale:l.locale}):(0,eH.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--tickets",children:[(0,eH.jsx)(e6i,{runtime:l,showHero:!h&&"select"===l.step}),h?(0,eH.jsx)(e6a,{runtime:l}):(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)(eXM,{className:`ticket-catalog-layout${v?" venue-booking-payment-page":""}`,navigation:a.navigation,title:p,stage:l.step,summary:!v&&(0,eH.jsx)(e0i,{panel:l.orderPanel,title:l.text("Your order","您的订单"),closeLabel:l.text("Close order","关闭订单"),decoration:(0,eH.jsx)(eJQ,{className:"order-mascot"}),body:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(e6p,{runtime:l,onEditExtras:()=>{a.goTo("extras")}}),(0,eH.jsx)(e6m,{runtime:l,includeTotal:l.hasDeposit,includeDueNow:"review"===l.step&&!l.hasDeposit})]}),footer:(0,eH.jsxs)(eH.Fragment,{children:[n.summary,(0,eH.jsx)(eXT,{label:l.hasDeposit?l.text("Due now","本次待付"):l.text("Total","合计"),amount:m,total:!0}),(0,eH.jsx)(eXL,{action:a.primaryAction,className:"full"})]})}),footer:!v&&(0,eH.jsx)(eX$,{lang:l.locale,back:a.previous?{label:l.text("Previous step","上一步"),onClick:a.back}:void 0,summary:(0,eH.jsx)(e0a,{panel:l.orderPanel,title:l.text("Your order","您的订单"),label:l.hasDeposit?l.text("Deposit details","定金明细"):l.text("Details","明细"),total:m}),action:a.primaryAction,feedback:n.footer}),children:["select"===l.step&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("section",{id:"ticket-visit-date",className:"visit-date-panel","aria-label":l.text("Shared visit date","统一游玩日期"),tabIndex:-1,children:l.todayOnly?(0,eH.jsx)(e2h,{id:"ticket-current-date",date:l.date,today:l.today,locale:l.locale,stepStatus:null==u?void 0:u[0]}):"date"!==l.expandedSection&&l.dateConfirmed?(0,eH.jsx)(eXK,{id:"ticket-date-summary",className:"visit-date-summary",number:1,stepStatus:null==u?void 0:u[0],title:l.text("Choose a date","选择日期"),open:!1,completing:o,locked:l.disabled,lang:l.locale,summary:(0,eH.jsx)("b",{children:e0y(l.date,l.locale)}),onToggle:()=>{l.disabled||(s(!1),l.setExpandedSection("date"),r("#ticket-visit-date"))},children:null}):(0,eH.jsx)(e0x,{value:l.date,onChange:e=>{g(e)},locale:l.locale,title:l.text("Choose a date","选择日期"),stepNumber:1,stepStatus:null==u?void 0:u[0],timeZone:l.bookingUI.timeZone,todayMarker:"device",minDate:l.today,dateStates:l.dateStates,loading:i.searching,onInteraction:l.onDateInteraction,onVisibleDatesChange:l.setVisibleDates,disabled:l.disabled,t:e=>e6k(e,l.locale)})}),(0,eH.jsx)(eXK,{id:"ticket-products",number:2,stepStatus:null==u?void 0:u[1],title:l.text("Choose tickets","选择门票"),open:"product"===l.expandedSection||!c||!!l.composer,lang:l.locale,locked:l.disabled||!i.catalogueReady,onToggle:()=>{!l.disabled&&i.catalogueReady&&l.setExpandedSection("product"===l.expandedSection&&c?"":"product")},summary:c?(0,eH.jsxs)("span",{children:[(0,eH.jsx)(eXj,{size:20,"aria-hidden":"true"})," ",c," ",l.text("tickets selected","张门票已选")]}):void 0,children:(0,eH.jsx)(e6r,{runtime:l,preview:i})})]}),a.renderStage]}),l.composer&&(0,eH.jsx)(e2K,{mode:"tickets",draft:l.composer,context:l.context,priceSource:l.mainQueries,operationLog:l.operationLog,dateReadOnly:l.todayOnly,scopeKey:l.scopeKey,date:l.date,customerId:l.customerId,locale:l.locale,formatAmount:l.amount,disabled:!l.ready||l.busy||l.extras.busy||l.holderBusy||l.checkout.submitting||!!l.checkout.failure||l.handoff,onBusyChange:l.setComposerBusy,skuOptions:{config:{overSold:l.composer.overSold}},requiredOptionValidation:l.composer.requiredOptionValidation,onDateChange:async e=>l.changeDate(e),onCancel:()=>l.setComposer(void 0),onCommitted:()=>{l.setRevision(e=>e+1),l.setExpandedSection("product"),l.setComposer(void 0)},renderDatePicker:e=>{let{date:t,disabled:i,onChange:a}=e;return(0,eH.jsx)(e0x,{value:t,onChange:a,locale:l.locale,title:l.text("Visit date","游玩日期"),timeZone:l.bookingUI.timeZone,todayMarker:"device",minDate:l.today,dateStates:l.dateStates,onVisibleDatesChange:l.setVisibleDates,disabled:i,t:e=>e6k(e,l.locale)})}},l.composer.key)]}),(0,eH.jsx)(e6n,{runtime:l}),(0,eH.jsx)(e6g,{runtime:l})]})}let e6S=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M114.32,49.8A19.79,19.79,0,0,0,81.72,57L29.22,201.41A19.82,19.82,0,0,0,47.75,228a20,20,0,0,0,6.84-1.22L199,174.28a19.79,19.79,0,0,0,7.24-32.6ZM104.19,183.21l-31.4-31.4L82.94,123.9l49.16,49.16Zm-52.42,26.4Zm12-32.91L79.3,192.26l-24.45,8.89ZM157,164,92,99l10-27.58L184.57,154ZM128,40V16a12,12,0,0,1,24,0V40a12,12,0,0,1-24,0Zm116.48,83.51a12,12,0,0,1-17,17l-16-16a12,12,0,0,1,17-17Zm-.69-40.13-24,8a12,12,0,0,1-7.59-22.77l24-8a12,12,0,1,1,7.59,22.77ZM156.6,65.93C159.83,47.47,173.39,36,192,36c6.45,0,8.69-2.49,10-4.92a18,18,0,0,0,2-7.22V24a12,12,0,0,1,24,0c0,14.47-9.59,36-36,36-4.94,0-10.21,1.19-11.76,10.06A12,12,0,0,1,168.43,80a12.35,12.35,0,0,1-2.08-.18A12,12,0,0,1,156.6,65.93Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M58.89,154.89l42.22,42.22-50.63,18.4a7.79,7.79,0,0,1-10-10Zm138.82-4.72L105.83,58.29A7.79,7.79,0,0,0,93,61.14l-14.9,41,75.82,75.82,41-14.9A7.79,7.79,0,0,0,197.71,150.17Z",opacity:"0.2"}),eC.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26Zm-8.33,135.21-35-35,13.16-36.21,58.05,58.05Zm-55,20,14-38.41,24.45,24.45ZM156,168.64,87.36,100l13-35.87,91.43,91.43ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26ZM65.14,161.13l19.2-52.79,63.32,63.32-52.8,19.2ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M110.08,54a13.8,13.8,0,0,0-22.73,5.05L34.85,203.47A13.82,13.82,0,0,0,47.76,222a14,14,0,0,0,4.77-.85l144.38-52.5a13.8,13.8,0,0,0,5-22.73ZM48.43,209.87a1.79,1.79,0,0,1-2.3-2.3L61.31,165.8,90.2,194.68Zm54.21-19.71-36.8-36.81L80.51,113,143,175.49ZM194,156.07a1.74,1.74,0,0,1-1.14,1.3L155.44,171,85,100.55,98.63,63.19a1.72,1.72,0,0,1,1.3-1.14,1.58,1.58,0,0,1,.41,0,1.72,1.72,0,0,1,1.25.53l91.88,91.88A1.73,1.73,0,0,1,194,156.07ZM162,72a35.52,35.52,0,0,1,3.63-14.68C170.57,47.44,179.93,42,192,42c7.47,0,12.53-2.74,15.48-8.38A24.18,24.18,0,0,0,210,24,6,6,0,0,1,216,18h0a6,6,0,0,1,6,6c0,10.38-6.27,30-30,30-7.47,0-12.53,2.74-15.48,8.38A24,24,0,0,0,174,72a6,6,0,0,1-6,6h0A6,6,0,0,1,162,72ZM138,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm98.24,83.76a6,6,0,1,1-8.48,8.48l-16-16a6,6,0,0,1,8.48-8.48Zm5.66-46.07-24,8a6,6,0,1,1-3.8-11.38l24-8a6,6,0,0,1,3.8,11.38Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26Zm-8.33,135.21-35-35,13.16-36.21,58.05,58.05Zm-55,20,14-38.41,24.45,24.45ZM156,168.64,87.36,100l13-35.87,91.43,91.43ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M108.66,55.46a11.79,11.79,0,0,0-19.43,4.31L36.73,204.15a11.81,11.81,0,0,0,11,15.85,11.88,11.88,0,0,0,4.08-.73l144.38-52.5a11.79,11.79,0,0,0,4.31-19.43Zm-6.53,137L63.52,153.87l16.19-44.51,66.92,66.93Zm-53,19.28a3.81,3.81,0,0,1-4.87-4.87l16.27-44.72,33.32,33.32Zm146.8-55.25a3.77,3.77,0,0,1-2.42,2.74l-38.56,14L82.72,101.07l14-38.56a3.77,3.77,0,0,1,2.74-2.42,4.32,4.32,0,0,1,.85-.09A3.65,3.65,0,0,1,103,61.12L194.88,153A3.78,3.78,0,0,1,195.91,156.51ZM220,24c0,9.68-5.85,28-28,28-8.31,0-14.18,3.29-17.42,9.79A26.12,26.12,0,0,0,172,72a4,4,0,0,1-8,0,34.06,34.06,0,0,1,3.42-13.79C170.66,51.73,177.56,44,192,44c19.29,0,20-18,20-20a4,4,0,0,1,4-4h0A4,4,0,0,1,220,24ZM140,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm94.83,85.17a4,4,0,0,1-5.66,5.66l-16-16a4,4,0,0,1,5.66-5.66Zm6.43-49.37-24,8A4,4,0,0,1,216,84a4,4,0,0,1-1.27-7.79l24-8a4,4,0,0,1,2.53,7.59Z"}))]]),e6j=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e6S}));e6j.displayName="ConfettiIcon";let e6N=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,60a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,60Zm0,64a20,20,0,1,1,20-20A20,20,0,0,1,128,124Zm0-112a92.1,92.1,0,0,0-92,92c0,77.36,81.64,135.4,85.12,137.83a12,12,0,0,0,13.76,0,259,259,0,0,0,42.18-39C205.15,170.57,220,136.37,220,104A92.1,92.1,0,0,0,128,12Zm31.3,174.71A249.35,249.35,0,0,1,128,216.89a249.35,249.35,0,0,1-31.3-30.18C80,167.37,60,137.31,60,104a68,68,0,0,1,136,0C196,137.31,176,167.37,159.3,186.71Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24a80,80,0,0,0-80,80c0,72,80,128,80,128s80-56,80-128A80,80,0,0,0,128,24Zm0,112a32,32,0,1,1,32-32A32,32,0,0,1,128,136Z",opacity:"0.2"}),eC.createElement("path",{d:"M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,16a88.1,88.1,0,0,0-88,88c0,75.3,80,132.17,83.41,134.55a8,8,0,0,0,9.18,0C136,236.17,216,179.3,216,104A88.1,88.1,0,0,0,128,16Zm0,56a32,32,0,1,1-32,32A32,32,0,0,1,128,72Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,66a38,38,0,1,0,38,38A38,38,0,0,0,128,66Zm0,64a26,26,0,1,1,26-26A26,26,0,0,1,128,130Zm0-112a86.1,86.1,0,0,0-86,86c0,30.91,14.34,63.74,41.47,94.94a252.32,252.32,0,0,0,41.09,38,6,6,0,0,0,6.88,0,252.32,252.32,0,0,0,41.09-38c27.13-31.2,41.47-64,41.47-94.94A86.1,86.1,0,0,0,128,18Zm0,206.51C113,212.93,54,163.62,54,104a74,74,0,0,1,148,0C202,163.62,143,212.93,128,224.51Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,68a36,36,0,1,0,36,36A36,36,0,0,0,128,68Zm0,64a28,28,0,1,1,28-28A28,28,0,0,1,128,132Zm0-112a84.09,84.09,0,0,0-84,84c0,30.42,14.17,62.79,41,93.62a250,250,0,0,0,40.73,37.66,4,4,0,0,0,4.58,0A250,250,0,0,0,171,197.62c26.81-30.83,41-63.2,41-93.62A84.09,84.09,0,0,0,128,20Zm37.1,172.23A254.62,254.62,0,0,1,128,227a254.62,254.62,0,0,1-37.1-34.81C73.15,171.8,52,139.9,52,104a76,76,0,0,1,152,0C204,139.9,182.85,171.8,165.1,192.23Z"}))]]),e6C=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e6N}));function e6M(e){let t=e3B(e),l=e6b(t),{composer:i,configurationModal:a,partyMain:n,date:r,step:o,ready:s}=t,[d,c]=(0,eC.useState)(""),u=(0,eC.useCallback)(e=>{t.isKiosk||c(e)},[t.isKiosk]);(0,eC.useEffect)(()=>t.subscribePartyProductConfirmed(()=>{t.setDateConfirmed(!0),u("product")}),[t.subscribePartyProductConfirmed,t.setDateConfirmed,u]),(0,eC.useEffect)(()=>{u("")},[o,u]),(0,eC.useEffect)(()=>{if(t.isKiosk||!d)return;let e=window.setTimeout(()=>c(""),1e3);return()=>window.clearTimeout(e)},[d,t.isKiosk]);let p=(0,eC.useRef)();(0,eC.useEffect)(()=>{if(!s||i||a||"select"!==o||!n||n.date===r)return;let e=`${n.productLineUid}:${r}`;p.current!==e&&(p.current=e,t.editLine(n.productLineUid))},[s,i,a,o,null==n?void 0:n.productLineUid,null==n?void 0:n.date,r]);let m={datePreview:l,completingSection:t.isKiosk?"":d,onComplete:u};return t.checkout.kioskPaymentResult?(0,eH.jsx)(e6_,{checkout:t.checkout,locale:t.locale}):(0,eH.jsxs)(eH.Fragment,{children:[i?(0,eH.jsx)(e6T,{runtime:t,...m},i.key):(0,eH.jsx)(e6I,{runtime:t,...m}),(0,eH.jsx)(e6n,{runtime:t}),(0,eH.jsx)(e6g,{runtime:t})]})}function e6T(e){let{runtime:t,datePreview:l,completingSection:i,onComplete:a}=e,n=t.composer,r=e2w({mode:"party",draft:n,context:t.context,scopeKey:t.scopeKey,priceSource:t.mainQueries,operationLog:t.operationLog,date:t.date,customerId:t.customerId,locale:t.locale,disabled:!t.ready||t.busy||t.holderBusy||t.checkout.submitting||t.handoff,onBusyChange:t.setComposerBusy,onDraftChange:e=>t.rememberPartyPreview(n.key,e),onDateChange:async e=>{await t.changeDate(e)},onCancel:()=>t.setComposer(void 0),onCommitted:()=>{let e=e1H(t.context,t.scopeKey).required?"holder":t.nextAfterHolder;t.setRevision(e=>e+1),t.setStep(e),t.setComposer(void 0)},prepareRelated:async()=>{if(!t.partyMain)return{};let e=await t.extras.prepareRevalidation();if(e.invalidItems.length)throw Error(t.text("Some extras are unavailable for the new Party selection. Remove or reselect them before saving. ","部分附加商品不适用于新选择,请移除或重新选择后保存。 ")+e.invalidItems.map(e=>e.message).join(" "));return{mode:Number(t.partyMain.line.product_id)===Number(n.detail.id)?"edit":"replace",relatedRetailProducts:e.validRows,availabilityCommitGuard:()=>{var l;let i=e1F(t.os.getTempOrder(),{mode:"party"});if((null==(l=i.bindings[0])?void 0:l.productLineUid)!==t.partyMain.productLineUid||JSON.stringify(i.extras)!==JSON.stringify(e.sourceRows))throw Error(t.text("The extras changed. Please review your Party again.","附加商品已变化,请重新核对 Party。"))}}}}),o=e2W({enabled:!1!==t.props.isActive,openId:n.key,scopeKey:t.scopeKey,sessionId:t.session.sessionId,productDetail:n.detail,skuValue:r.configuration.skuValue,quantity:r.quantity,overSold:1===n.overSold,priceBasis:"catalog",timeZone:t.bookingUI.timeZone,customerId:t.customerId,os:t.mainQueries}),s=eXN();return(0,eH.jsx)(e2v,{ref:r.panelRef,...r.bookingProps,dateReadOnly:t.todayOnly,onExplicitSelection:(e,l)=>{if("time"===e){null==a||a("time");let e=l.resourceGroups.some(e=>!e0M(e,r.bookingProps.resourceSettings));t.setExpandedSection(!l.ready&&e?"resource":""),s(l.ready?".party-app .booking-primary-action":e?"#party-room":"#party-time",{block:l.ready?"nearest":"start"})}else l.ready&&(null==a||a("resource"),t.setExpandedSection(""),s(".party-app .booking-primary-action",{block:"nearest"}))},renderContent:e=>(0,eH.jsx)(e6I,{runtime:t,datePreview:l,model:r,selection:e,estimatedSubtotal:"ready"===o.status?o.subtotal:void 0,completingSection:i,onComplete:a})})}function e6I(e){var t,l,i,a;let{runtime:n,datePreview:r,model:o,selection:s,estimatedSubtotal:d,completingSection:c,onComplete:u}=e,p=o?Ho(o.prepared.product).required:n.holderState.required,m=e6y({...n,holderState:{...n.holderState,required:p}}),g=e6t(n,null==o?void 0:o.error),h=eXN(),{text:v,locale:f,partyMain:y,expandedSection:b,dateConfirmed:x}=n,k="payment"===n.step&&!!n.checkout.kioskPaymentPage,_=v("Your party","Party 订单明细"),w=e0y(n.date,"zh"===f?"zh-CN":"en-AU",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),S=n.composer,j=S?eXp(S.detail.title||S.detail.name,f):y?eXp(y.line.product_title,f):"",N=null==s?void 0:s.state.candidate,C=o?N?`${e6P(N.bookingStartAt||N.startAt)}–${e6P(N.bookingEndAt||N.endAt)}`:"":y?`${y.booking.start_time}–${y.booking.end_time}`:"",M=o?((null==s?void 0:s.state.selectedResourceDetails)||[]).map(e=>{var t;return eXp(e.name||(null==(t=e.raw)?void 0:t.name),f)}).filter(Boolean).join(" \xb7 "):((null==y?void 0:y.booking.resources)||[]).map(e=>{var t;return eXp((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,f)}).filter(Boolean).join(" \xb7 "),T=o?!!(N&&(N.businessDate||N.date)===n.date&&(null==s?void 0:s.state.times.some(e=>e0F(e,N)&&e0$(e,(s.state.partySize||0)*s.state.bookingCount)))):!!(C&&n.mainDateMatches),I=(null==o?void 0:o.prepared.partySize)??(null==y||null==(t=y.intent.resources[0])?void 0:t.capacity),P=iY((null==o?void 0:o.configuration.skuValue)||(y?{...y.line.product_sku,bundle:y.line.product_bundle}:void 0),"",e=>eXp(e,f),e=>String(n.amount(e))),A=!!j,D=o?o.bookingReady:n.hasBookings&&n.mainDateMatches,E=n.disabled||!!(null==o?void 0:o.working),O=n.context.sales.salesSettings,z=null==O||null==(l=O.reservation)?void 0:l.resourceSettings,L="picoding"!==n.context.sales.salesSettingsSource||!!(O&&!n.context.sales.salesSettingsError),R=(null==o?void 0:o.prepared.product)||(null==S?void 0:S.detail)||y&&n.main.products.find(e=>String(e.id)===String(y.line.product_id)),$=R?e0I(R,z):!y||y.intent.resources.some(e=>!e0M({formId:e.formId},z)),F=L&&(s?s.showResources:$),q=e=>{E||n.todayOnly&&"date"===e||"resource"===e&&!F||(null==u||u(e?"":b),n.setStep("select"),n.setExpandedSection(e),!o&&y&&["time","resource"].includes(e)&&n.editLine(y.productLineUid),h(`#party-${"resource"===e?"room":e}`))},B=e=>{E||n.orderPanel.closeThen(e)},H="select"===n.step?{label:v("Next: ","下一步:")+(p?v("holder details","Holder 资料"):n.hasExtras?v("extras","附加商品"):v("review","确认")),busy:(null==o?void 0:o.working)||n.busy||n.depositHydration.pending,disabled:E||n.mainCatalogBlocked||!D||!o&&!!n.depositHydration.error,onClick:async()=>{!E&&!n.mainCatalogBlocked&&D&&(o?await o.commit()&&n.orderPanel.closeThen(()=>h("[data-booking-stage]")):n.orderPanel.closeThen(()=>{n.continueOrder(n.nextAfterSelect),h("[data-booking-stage]")}))}}:m.primaryAction,V=(null==o||null==(i=o.quote)?void 0:i.compositeLineTotal)??d,U=o?null==V?"—":n.amount(V):n.amount(n.hasBookings?n.hasDeposit?n.amountDue:null==(a=n.summary)?void 0:a.expect_amount:0),Y=(0,eH.jsx)(eH.Fragment,{children:A?(0,eH.jsxs)("div",{className:"party-summary-lines",children:[(0,eH.jsx)(e31,{items:[{label:v("Your party","我的 Party"),value:j,detail:(0,eH.jsxs)(eH.Fragment,{children:[I?(0,eH.jsxs)("div",{children:[I," ",v("guests","位参加者")]}):null,P.map(e=>(0,eH.jsxs)("div",{children:[e.label," ",e.meta]},e.key)),!o&&y&&(0,eH.jsx)(e85,{products:[y.line],locale:f})]}),action:{label:v("Edit","编辑"),onClick:()=>B(()=>q("product")),disabled:E}},{label:v("When","日期与时间"),value:w,detail:C||v("Choose a time","待选择时间"),action:{label:n.todayOnly?v("Edit time","编辑时间"):v("Edit","编辑"),onClick:()=>B(()=>q(n.todayOnly?"time":"date")),disabled:E}},{label:v("Where","Party room"),value:M||v("Choose a room","待选择房间"),action:F?{label:v("Edit","编辑"),onClick:()=>B(()=>q("resource")),disabled:E}:void 0},...n.holderState.enabled?[{label:v("Holder","持有人"),value:`${n.holderState.completed} / ${n.holderState.total}`,detail:(0,eH.jsx)(e86,{context:n.context,locale:f,lines:n.holderState.lines.filter(e=>e.uid===(null==y?void 0:y.productLineUid))}),action:{label:v("Edit","编辑"),onClick:()=>B(()=>{n.setStep(n.holderState.required?"holder":"review"),h("[data-booking-stage]")}),disabled:E||!!o}}]:[]]}),n.extras.rows.length>0&&(0,eH.jsx)(e6c,{text:v}),(0,eH.jsx)(e6p,{runtime:n,onlyExtras:!0,onEditExtras:()=>{m.goTo("extras")}}),o?(0,eH.jsx)(eXT,{label:v("Party selection subtotal","Party 选择小计"),amount:U}):(0,eH.jsx)(e6m,{runtime:n,splitPartySubtotal:!0,includeTotal:n.hasDeposit,includeDueNow:"review"===n.step&&!n.hasDeposit}),o&&(0,eH.jsx)("p",{className:"small muted",children:v("Final fees and discounts are calculated after saving your selection.","保存选择后计算最终费用与优惠。")})]}):(0,eH.jsx)(e2d,{className:"party-empty",description:n.todayOnly?v("Choose a package to start planning your party.","选择商品,开始安排欢乐派对。"):v("A wonderful party starts here. Choose a date and a package.","从选日期和商品开始,安排一场欢乐派对。"),icon:(0,eH.jsx)(e6j,{size:34})})}),W=n.todayOnly?null:(0,eH.jsx)(e0x,{value:n.date,onChange:e=>{n.changeDate(e,o?{configuration:o.configuration,initialSelection:o.selection,quantity:o.quantity}:void 0).then(e=>{e&&(null==u||u("date"),h(o?"#party-time":"#party-product"))}).catch(e=>n.setError(e instanceof Error?e.message:String(e)))},locale:"zh"===f?"zh-CN":"en-AU",timeZone:n.bookingUI.timeZone,todayMarker:"device",title:v("Choose a date","选择日期"),stepNumber:1,stepStatus:{status:x?"complete":"available"},minDate:n.today,disabled:E,dateStates:n.dateStates,onVisibleDatesChange:n.setVisibleDates,loading:r.searching,onInteraction:n.onDateInteraction,t:e=>e6k(e,f)});return n.session.error||!n.session.ready||n.session.pendingOrder||!n.uiHydrated||n.previewRecovery?(0,eH.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--party",children:[(0,eH.jsx)(e6i,{runtime:n}),(0,eH.jsx)(e6a,{runtime:n}),n.previewRecovery&&(0,eH.jsxs)(e2s,{tone:n.previewRecoveryError?"error":void 0,children:[(0,eH.jsx)("p",{children:n.previewRecoveryError||v("Restoring your Party selection with current availability and prices…","正在按当前可用性和价格恢复 Party 选择…")}),n.previewRecoveryError&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(eXE,{secondary:!0,disabled:n.recoveringPreview,onClick:n.retryPartyPreview,children:v("Retry","重试")}),(0,eH.jsx)(eXE,{secondary:!0,disabled:n.recoveringPreview,onClick:n.discardPartyPreview,children:v("Discard unsaved selection","放弃未保存的选择")})]})]})]}):(0,eH.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--party party-app",children:[(0,eH.jsx)(e6i,{runtime:n}),(0,eH.jsx)(eXM,{className:`party-booking-page${k?" venue-booking-payment-page":""}`,stage:n.step,navigation:m.navigation,title:"holder"===n.step?v("Choose a Holder","选择持有人"):"extras"===n.step?v("Make it your Party","为 Party 增添更多乐趣"):"review"===n.step?v("Your party, all together","确认您的欢乐派对"):void 0,summary:!k&&(0,eH.jsx)(e0i,{panel:n.orderPanel,title:_,closeLabel:v("Close","关闭"),body:Y,footer:(0,eH.jsxs)(eH.Fragment,{children:[g.summary,(0,eH.jsx)(eXT,{label:o?v("Party selection subtotal","Party 选择小计"):n.hasDeposit?v("Due now","本次待付"):v("Party total","Party 总额"),amount:U,total:!0}),(0,eH.jsx)("div",{className:"party-actions",children:(0,eH.jsx)(eXL,{action:H})})]}),decoration:(0,eH.jsx)(eJQ,{variant:"summary"})}),footer:!k&&(0,eH.jsx)(eX$,{lang:f,back:m.previous?{label:v("Previous step","上一步"),onClick:m.back}:void 0,summary:(0,eH.jsx)(e0a,{panel:n.orderPanel,title:_,label:!o&&n.hasDeposit?v("Deposit details","定金明细"):v("Details","明细"),total:String(U)}),action:H,feedback:g.footer}),children:"select"===n.step?(0,eH.jsxs)("div",{className:"party-arrangement",children:[(0,eH.jsx)("section",{id:"party-date",tabIndex:-1,className:"visit-date-panel",children:n.todayOnly?(0,eH.jsx)(e2h,{id:"party-current-date",date:n.date,today:n.today,locale:f,stepStatus:{status:"complete"}}):"date"!==b&&x?(0,eH.jsx)(eXK,{lang:f,id:"party-date-summary",number:1,completing:"date"===c,stepStatus:{status:"complete"},title:v("Choose a date","选择日期"),open:!1,summary:(0,eH.jsx)("b",{children:w}),onToggle:()=>q("date"),locked:E,children:null}):W}),(0,eH.jsx)(eXK,{lang:f,id:"party-product",number:2,title:v("Choose your party package","选择 Party 商品"),completing:"product"===c,stepStatus:{status:A?"complete":r.catalogueReady?"available":"locked"},open:"product"===b||!A,summary:A?(0,eH.jsx)("b",{children:j}):void 0,onToggle:()=>{null==u||u("product"===b?"product":""),n.setExpandedSection("product"===b?"":"product")},locked:E||!r.catalogueReady,children:(0,eH.jsx)(e6r,{runtime:n,preview:r,showFilters:!1})}),(0,eH.jsx)(eXK,{lang:f,id:"party-time",number:3,title:v("Choose a time","选择时间"),completing:"time"===c,stepStatus:{status:T?"complete":A?"available":"locked"},open:"time"===b||!T,summary:C?(0,eH.jsx)("b",{children:C}):void 0,onToggle:()=>q("time"===b?"":"time"),locked:E||!A,children:s?s.timeContent:n.preparingProductId?(0,eH.jsx)(e2d,{className:"party-empty",pending:!0,description:v("Loading your Party selection…","正在加载您的 Party 选择…")}):(0,eH.jsx)(e2d,{className:"party-empty",icon:(0,eH.jsx)(e3Q,{size:28}),description:v("Choose your Party package first.","请先选择 Party 商品。")})}),F&&(0,eH.jsx)(eXK,{lang:f,id:"party-room",number:4,title:v("Choose a room","选择房间"),completing:"resource"===c,stepStatus:{status:D?"complete":T?"available":"locked"},open:"resource"===b||!M||!D,summary:M?(0,eH.jsx)("b",{children:M}):void 0,onToggle:()=>q("resource"===b?"":"resource"),locked:E||!T,children:s&&T?s.resourceContent:n.preparingProductId?(0,eH.jsx)(e2d,{className:"party-empty",pending:!0,description:v("Loading your Party selection…","正在加载您的 Party 选择…")}):(0,eH.jsx)(e2d,{className:"party-empty",icon:(0,eH.jsx)(e6C,{size:28}),description:v("Choose a time to see available rooms.","选择时间后查看可用房间。")})}),!D&&(null==s?void 0:s.statusPanel),D&&!b&&!E&&!(null==o?void 0:o.error)&&(0,eH.jsxs)(e2s,{id:"party-ready-notice",className:"party-ready-notice",tone:"success",icon:(0,eH.jsx)(e2P,{weight:"bold","aria-hidden":"true"}),children:[(0,eH.jsxs)("div",{className:"party-ready-copy",children:[(0,eH.jsx)("strong",{children:v("Your party choices are ready","Party 安排已选好")}),(0,eH.jsxs)("p",{children:[(0,eH.jsx)("span",{className:"party-ready-desktop",children:v("Click ","点击右侧")}),(0,eH.jsx)("span",{className:"party-ready-mobile",children:v("Tap ","点击底部")}),(0,eH.jsx)("b",{children:"zh"===f?(0,eH.jsxs)(eH.Fragment,{children:["「",H.label,"」"]}):(0,eH.jsxs)(eH.Fragment,{children:["“",H.label,"”"]})}),"en"===f&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("span",{className:"party-ready-desktop",children:" on the right."}),(0,eH.jsx)("span",{className:"party-ready-mobile",children:" below."})]})]})]}),(0,eH.jsx)(e3V,{className:"party-ready-direction",size:28,"aria-hidden":"true"})]})]}):m.renderStage})]})}function e6P(e){var t;return(null==(t=String(e||"").match(/[T ](\d{2}:\d{2})/))?void 0:t[1])||String(e||"").slice(0,5)}function e6A(e){var t,l,i,a,n,r,o,s,d,c,u,p,m,g,h;let v="tickets"===e.mode?e6w:e6M,f=e$(),y=(0,eC.useRef)({brand:void 0,design:void 0}),b=function(e,t,l){let i,a;if(!eXu(e)||!eXu(e.steps))return{status:"invalid",reason:"Booking menus have not been configured."};if(void 0!==e.template&&e.template!==t)return{status:"invalid",reason:"The booking template and menu configuration do not match."};let n=[t];Object.prototype.hasOwnProperty.call(e.steps,"extras")&&n.push("extras");let r={};for(let t of n){let l=e.steps[t],i=eXu(l)?l.catalog:void 0,a=eXu(i)?i.menuListIds:void 0;if(!Array.isArray(a)||a.some(e=>"number"!=typeof e||!Number.isSafeInteger(e)||e<=0))return{status:"invalid",reason:`The ${t} menu configuration is missing or invalid.`};r[t]={catalog:{menuListIds:[...new Set(a)]}}}let o=function e(t){if("string"!=typeof t)return;let l=t.trim();if(/^#[\da-f]{6}$/i.test(l))return l.toUpperCase();if(/^#[\da-f]{3}$/i.test(l))return`#${l.slice(1).split("").map(e=>e+e).join("")}`.toUpperCase();if(/^#[\da-f]{6}ff$/i.test(l))return l.slice(0,7).toUpperCase();if(/^#[\da-f]{3}f$/i.test(l))return e(l.slice(0,4));let i=/^(rgb|rgba)\(([^)]+)\)$/i.exec(l);if(!i)return;let a=i[2].split(",").map(e=>e.trim());if(a.length!==("rgba"===i[1].toLowerCase()?4:3)||a.some(e=>!/^(?:\d+(?:\.\d+)?|\.\d+)%?$/.test(e))||4===a.length&&1!==(a[3].endsWith("%")?parseFloat(a[3])/100:Number(a[3])))return;let n=a.slice(0,3).map(e=>{let t=e.endsWith("%"),l=parseFloat(e);return l<0||l>(t?100:255)?NaN:Math.round(t?255*l/100:l)});if(!n.some(e=>!Number.isFinite(e)))return`#${n.map(e=>e.toString(16).padStart(2,"0")).join("")}`.toUpperCase()}(l),s=eXu(e.brand)?e.brand:void 0,d=s||o?{name:"string"==typeof(null==s?void 0:s.name)?s.name:void 0,title:"string"==typeof(null==s?void 0:s.title)?s.title:void 0,logo:"string"==typeof(null==s?void 0:s.logo)?s.logo:void 0,hero:"string"==typeof(null==s?void 0:s.hero)?s.hero:void 0,primaryColor:o??("string"==typeof(null==s?void 0:s.primaryColor)?s.primaryColor:void 0),mascot:"string"==typeof(null==s?void 0:s.mascot)?s.mascot:void 0,logoMode:(null==s?void 0:s.logoMode)==="full"?"full":"icon-and-name"}:void 0;try{i=eJ4(e.design),eJ3(d)}catch{a="The booking design configuration is invalid."}return{status:"ready",value:{template:t,steps:r,brand:d,design:i,visualError:a},scopeKey:JSON.stringify({template:t,steps:r})}}(e.config,e.mode,null==f||null==(l=f.appHelper)||null==(t=l.constants)?void 0:t.themeColor),x=e.context.sales.bookingTicket;if("invalid"===b.status)return(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:b.reason});if(!x)return(0,eH.jsx)(eT.Spin,{});let k=(null==f||null==(n=f.appHelper)||null==(a=n.utils)||null==(i=a.getData)?void 0:i.call(a,"timezone"))||(null==(r=x.otherParams)?void 0:r.businessTimezone);if(!k&&"pending"===e.context.sales.catalogState)return(0,eH.jsx)(eT.Spin,{});try{if(!k)throw Error();eXf(k)}catch{return(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:String(e.locale).startsWith("zh")?"场馆时区尚未配置,请联系商家。":"The venue timezone is not configured. Please contact the venue."})}if("function"!=typeof x.createVenueCatalogSession)return(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:String(e.locale).startsWith("zh")?"预约服务尚未更新,请联系商家。":"The booking service needs to be updated. Please contact the venue."});let _=e.businessCode||(null==(o=x.otherParams)?void 0:o.businessCode)||"venue_booking",w=x.otherParams,S=eXy(x),j=null==f||null==(c=f.appHelper)||null==(d=c.utils)||null==(s=d.getData)?void 0:s.call(d,"shop_id"),N=JSON.stringify([(null==w?void 0:w.shopId)!=null&&String(w.shopId)!==String(j)?w.shopId:j,(null==w?void 0:w.previousVenueCacheId)&&"venue_booking"===_?null:null==w?void 0:w.tenantId,e.context.sales.osKey,k,b.scopeKey,..."venue_booking"===_?[]:[_],...S?["kiosk",e.mode]:[]]),C=String(e.locale).startsWith("zh")?"zh":"en";b.value.visualError||(y.current={brand:b.value.brand,design:b.value.design});let M={...b.value,...y.current},T={...M.brand,name:(null==(u=M.brand)?void 0:u.name)||(null==(p=M.brand)?void 0:p.title)||eXp(null==f||null==(h=f.appHelper)||null==(g=h.utils)||null==(m=g.getData)?void 0:m.call(g,"shop_name"),C)||("zh"===C?"预订游玩":"Book your visit")};return(0,eH.jsx)(eT.ConfigProvider,{theme:{token:{colorPrimary:T.primaryColor||"#D61518",colorText:"#092d3e",fontFamily:'BookingDM, "PingFang SC", "Microsoft YaHei", sans-serif'}},children:(0,eH.jsx)(eXc,{lang:C,brand:T,design:M.design,timeZone:k,className:"venue-booking-design",isActive:e.isActive,presentationPlatform:S?"kiosk":"default",layout:S?"compact":"responsive",children:(0,eH.jsx)(v,{...e,businessCode:_,config:M,scopeKey:N},N)})})}function e6D(e){let{tmpl:t="standard",...l}=e,{venueBookingConfig:i,isActive:a=!0,catalogPreparation:n,osKey:r,productListPreferencesChannel:o,context:s,mode:d,variant:c,productLoadParams:u,businessCode:p,bookingConfigParams:m,hideSelectFloorMapResourceAction:g,productDisplayConfig:h,productCatalogSessionKey:v,productCatalogReady:f,kioskShellLayout:y,kioskAppearance:b,saleDetailTemplate:x,saleDetailModuleConfig:k,orderId:_,locale:w,onLocaleChange:S,saleDetailWrapperProps:j,saleDetailHeaderSlot:N,rightActionBarClose:C,onOrderComplete:M,onPaidCheckout:T,onPaymentPageActiveChange:I,onRequestHome:P,renderCatalog:A,externalActionRequest:D,onExternalActionAccepted:E,onExternalPaymentSettled:O}=l;switch(t){case"venue-ticket-booking":case"venue-party-booking":return(0,eH.jsx)(e6A,{mode:"venue-ticket-booking"===t?"tickets":"party",businessCode:p,context:s,variant:c,config:i,isActive:a,locale:w,onRequestHome:P});case"HDLKiosk":return(0,eH.jsx)(eJL,{isActive:a,osKey:r,context:s,mode:d,variant:c,businessCode:p,locale:w,onLocaleChange:S,productLoadParams:u,productCatalogSessionKey:v,productCatalogReady:f});case"SelfServiceKiosk":return(0,eH.jsx)(eUL,{...l});case"kiosk":return(0,eH.jsx)(eKp,{isActive:a,catalogPreparation:n,osKey:r,productListPreferencesChannel:o,context:s,mode:d,variant:c,productLoadParams:u,businessCode:p,bookingConfigParams:m,hideSelectFloorMapResourceAction:g,productDisplayConfig:h,productCatalogSessionKey:v,productCatalogReady:f,kioskShellLayout:y,kioskAppearance:b,saleDetailTemplate:x,saleDetailModuleConfig:k,orderId:_,locale:w,saleDetailHeaderSlot:N,onOrderComplete:M,onPaidCheckout:T,onPaymentPageActiveChange:I,onRequestHome:P,renderCatalog:A});case"secondaryScreen":return(0,eH.jsx)(eWq,{osKey:r,context:s,mode:d,variant:c,productLoadParams:u,businessCode:p,bookingConfigParams:m,hideSelectFloorMapResourceAction:g,productDisplayConfig:h,productCatalogSessionKey:v,productCatalogReady:f,saleDetailTemplate:x,saleDetailModuleConfig:k,orderId:_,locale:w,saleDetailWrapperProps:j,saleDetailHeaderSlot:N,onOrderComplete:M});default:return(0,eH.jsx)(eWF,{isActive:a,osKey:r,productListPreferencesChannel:o,context:s,mode:d,variant:c,productLoadParams:u,businessCode:p,bookingConfigParams:m,hideSelectFloorMapResourceAction:g,productDisplayConfig:h,productCatalogSessionKey:v,productCatalogReady:f,saleDetailTemplate:x,saleDetailModuleConfig:k,orderId:_,locale:w,saleDetailWrapperProps:j,saleDetailHeaderSlot:N,rightActionBarClose:C,onOrderComplete:M,externalActionRequest:D,onExternalActionAccepted:E,onExternalPaymentSettled:O})}}function e6E(e){var t,l;let i,a,n,r,o,s,{isActive:d=!0,catalogPreparation:c,osKey:u,saleDetailHeaderSlot:p,rightActionBarClose:m,overlaySlot:g,className:h,style:v,mode:f="ticket",tmpl:y,template:b="standard",kioskAppId:x,kioskAppBindings:k,venueBookingConfig:_,variant:w="desktop",productLoadParams:S,businessCode:j,bookingConfigParams:N,hideSelectFloorMapResourceAction:C,productDisplayConfig:M,productCatalogSessionKey:T,productCatalogReady:I,kioskShellLayout:P,kioskAppearance:A,saleDetailTemplate:D,saleDetailModuleConfig:E,autoCreate:O=!0,orderId:z,locale:L,onLocaleChange:R,saleDetailWrapperProps:$,cartProductsPerRow:F,showClient:q,onOrderComplete:B,onPaidCheckout:H,onPaymentPageActiveChange:V,onRequestHome:U,renderCatalog:Y,externalActionRequest:W,onExternalActionAccepted:K,onExternalPaymentSettled:G}=e;s2(eMn,L);let Q=(0,nY.useToast)(),Z=(i=exe(),a=eC0(),n=exr(),r=eND(),o=eC2(),s=eCX(),(0,eC.useMemo)(()=>({sales:i,products:a,customer:n,cart:r,summary:o,booking:s}),[i,a,n,r,o,s]));eK(d);let J=y||b||"standard",X=(0,eC.useRef)(!1),ee=(null==(l=Z.booking)||null==(t=l.getBookingConfig)?void 0:t.call(l))??null,{salesSettingsSource:et,salesSettings:el,salesSettingsError:ei,salesSettingsPlatform:ea,ensureSalesSettings:en}=Z.sales,er="picoding"===et&&!el,eo="SelfServiceKiosk"===J&&"vendingMachine"===x,es=d&&!eo&&er&&!ei?eL.getText("pisell2.big-sale.loading"):void 0,ed=!!(ei||Z.sales.error||"error"===Z.sales.status),ec=null==c?void 0:c.onStateChange;(0,eC.useEffect)(()=>{er&&(null==ec||ec({ready:!1,failed:ed}))},[er,ed,ec]);let eu=function(e){let{template:t,mode:l,bookingConfig:i,salesSettingsSource:a,salesSettings:n,platform:r,saleDetailModuleConfig:o,cartProductsPerRow:s,showClient:d}=e;return(0,eC.useMemo)(()=>{var e;let c;return(c=function(e,t){if(!e&&!t)return;let l={...e,...t,hidden:[...new Set([...(null==e?void 0:e.hidden)??[],...(null==t?void 0:t.hidden)??[]])],amountDetails:{...null==e?void 0:e.amountDetails,...null==t?void 0:t.amountDetails},promotionWalletPanelsBehavior:{...null==e?void 0:e.promotionWalletPanelsBehavior,...null==t?void 0:t.promotionWalletPanelsBehavior}};if((null==e?void 0:e.cartItems)||(null==t?void 0:t.cartItems)){var i,a;l.cartItems={...null==e?void 0:e.cartItems,...null==t?void 0:t.cartItems,layout:{...null==e||null==(i=e.cartItems)?void 0:i.layout,...null==t||null==(a=t.cartItems)?void 0:a.layout}}}return l}(function(e){var t,l;let i,{template:a,mode:n,bookingConfig:r,salesSettingsSource:o,salesSettings:s,platform:d,cartProductsPerRow:c,showClient:u}=e,p="secondaryScreen"===a;if("picoding"===o&&!s)return;let m="picoding"===o?{isShowImage:s.cart.showProductImage,isShowDelete:!!iE(d)||s.cart.showRemoveButton}:(t="retail"===n?"retail":"appointment",{isShowImage:eC5((i=((null==r||null==(l=r.config)?void 0:l.cart_settings_tab)||{})[`${t}_product_card_style`]||{}).show_product_image)??!0,isShowDelete:eC5(i.show_remove_button)??!0}),g=function(e){if(void 0!==e)return{columns:e}}(c),h={cartItems:{showProductImage:m.isShowImage,showRemoveButton:!p&&m.isShowDelete,...g?{layout:g}:{}},promotionWalletPanelsBehavior:{enableVoucherProductAdd:!p,enableWalletAssets:!p}};if(p){let e=[...eMa];!1===u&&e.push("customer"),h.hidden=e,h.amountDetails={defaultExpanded:!0}}return h}(e={template:t,mode:l,bookingConfig:i,salesSettingsSource:a,salesSettings:n,platform:r,cartProductsPerRow:s,showClient:d,saleDetailModuleConfig:o}),e.saleDetailModuleConfig))&&"secondaryScreen"===e.template?{...c,cartItems:{...c.cartItems,showRemoveButton:!1},promotionWalletPanelsBehavior:{...c.promotionWalletPanelsBehavior,enableVoucherProductAdd:!1,enableWalletAssets:!1}}:c},[t,l,i,a,n,r,s,d,o])}({template:J,mode:f,bookingConfig:ee,salesSettingsSource:et,salesSettings:el,platform:ea,saleDetailModuleConfig:E,cartProductsPerRow:F,showClient:q}),ep="secondaryScreen"===J,em="standard"===J,eg=Z.sales.productLoadChannel||"pos";return((0,eC.useEffect)(()=>{let e;if(!es)return;let t=window.setTimeout(()=>{e=Q.loading(es,0,()=>{e=void 0})},0);return()=>{window.clearTimeout(t),null==e||e.close()}},[es,Q]),(0,eC.useEffect)(()=>{er||!O||z||X.current||!Z.sales.bookingTicket||Z.sales.tempOrder||"idle"===Z.sales.status&&(X.current=!0,Z.sales.createNew().catch(()=>{X.current=!1}))},[O,z,Z.sales,Z.sales.bookingTicket,Z.sales.status,Z.sales.tempOrder,er]),er&&!eo)?(0,eH.jsx)("div",{className:aT()("pisell-big-sale",h),style:v,children:ei&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:ei.message,action:(0,eH.jsx)(eT.Button,{onClick:()=>void en().catch(()=>void 0),children:eL.getText("pisell2.big-sale.reload")})})}):(0,eH.jsxs)("div",{className:aT()("pisell-big-sale",`pisell-big-sale--${w}`,`pisell-big-sale-tmpl--${J}`,{"pisell-big-sale--secondary-screen":ep,"pisell-big-sale--has-right-action-panel":em&&"phone"!==w,"pisell-big-sale--has-right-action-close":em&&"phone"!==w&&!!m},h),"data-kiosk-shell":"kiosk"===J?P:void 0,style:v,children:[(0,eH.jsx)("div",{className:"pisell-big-sale__layout",children:(0,eH.jsx)(e6D,{isActive:d,catalogPreparation:c,osKey:u,productListPreferencesChannel:eg,mode:f,tmpl:J,kioskAppId:x,kioskAppBindings:k,venueBookingConfig:_,variant:w,context:Z,productLoadParams:S,businessCode:j,bookingConfigParams:N,hideSelectFloorMapResourceAction:C,productDisplayConfig:M,productCatalogSessionKey:T,productCatalogReady:(!eo||!er)&&I,kioskShellLayout:P,kioskAppearance:A,saleDetailTemplate:D,saleDetailModuleConfig:eu,orderId:z,locale:L,onLocaleChange:R,saleDetailWrapperProps:ep?$:void 0,saleDetailHeaderSlot:p,rightActionBarClose:m,onOrderComplete:B,onPaidCheckout:H,onPaymentPageActiveChange:V,onRequestHome:U,renderCatalog:Y,externalActionRequest:W,onExternalActionAccepted:K,onExternalPaymentSettled:G})}),g]})}e6C.displayName="MapPinIcon",e6E.displayName="BigSaleBase";let e6O=oZ(e6E);function e6z(e){return"product-selection"===e||"appointment-booking"===e}function e6L(e,t,l){if(!e6z(e))return t;let i=Array.isArray(null==t?void 0:t.steps)||"function"==typeof(null==t?void 0:t.resolveSteps);return{...t,enableProductSelectionFlowForCart:!0,enableBookingSelectionFlowForCart:!0,...!i?{resolveSteps:["pos","webpos"].includes(String(l||"").trim().toLowerCase())?HN:HC}:{}}}function e6R(e,t){return e&&eS()(e).isValid()?eS()(e).format("YYYY-MM-DD"):t||eS()().format("YYYY-MM-DD")}let e6$=e=>{var t;let{runtimeRef:l}=e,i=exe(),a=exr();return(0,eC.useEffect)(()=>{let e=()=>{var e,t,n,r,o,s,d,c;let u=(null==(t=i.bookingTicket)||null==(e=t.getBookingDate)?void 0:e.call(t))??(null==(d=i.bookingTicket)||null==(s=d.store)||null==(o=s.bookingContext)||null==(r=o.getState)||null==(n=r.call(o))?void 0:n.date);l.current={customerId:null==(c=a.selected)?void 0:c.id,date:e6R(u)}};return e(),exs(i.bookingTicket,e)},[i.bookingTicket,null==(t=a.selected)?void 0:t.id,l]),null},e6F=e=>{var t,l,i,a,n,r,o;let{osKey:s="big-sale",enableMultiCurrencySettlement:d=!1,osModuleName:c,selectionFlowScene:u="product-selection",lifecycleOwner:p,orderId:m,autoBootstrap:g,autoRestoreOnInit:h,restoreOrderAfterPaidCheckout:v,destroyOnUnmount:f,businessCode:y,bookingConfigParams:b,resourceIdFromCalendar:x,bookingTimeRangeFromCalendar:k,autoInitBookingContext:_,otherParams:w,inventory:S,catalogScope:j,checkoutHooks:N,rulesHooks:C,uiHosts:M,awaitAllergyConfirmation:T,normalProductDetailConfig:I,mergeBookingLinesForDisplay:P,mode:A="ticket",variant:D,tmpl:E,template:O,kioskAppId:z,kioskAppBindings:L,venueBookingConfig:R,secondaryScreenDisplay:$,productLoadParams:F,enableMenuOverride:q=!1,productDisplayConfig:B,hideSelectFloorMapResourceAction:H,productCatalogSessionKey:V,productCatalogReady:U,saleDetailTemplate:Y,saleDetailModuleConfig:W,autoCreate:K=!0,enableTempOrderPersist:G,enableTempOrderSync:Q=!0,isActive:Z=!0,catalogPreparation:J,preserveProductCatalogOnInactiveCustomerClear:X,autoReloadProductCatalogOnCustomerChange:ee,enableGlobalScanListener:et=!1,scanRequest:el,onScanRequestAccepted:ei,onScanRequestSettled:ea,scanScope:en,onScanPromotionResult:er,promotionScanSuccessMessageKey:eo,promotionItemIncreaseMessageKey:es,className:ed,style:ec,locale:eu,bootstrapSlot:ep,saleDetailHeaderSlot:em,rightActionBarClose:eg,overlaySlot:eh,onOrderComplete:ev,onPaidCheckout:ef,onPaymentPageActiveChange:ey,onRequestHome:eb,renderCatalog:ex,externalActionRequest:ek,onExternalActionAccepted:e_,onExternalPaymentSettled:ew}=e,eS=e$(),ej=eq(),eN=null==eS||null==(l=eS.appHelper)||null==(t=l.utils)?void 0:t.action,eM=null==eS||null==(a=eS.appHelper)||null==(i=a.utils)?void 0:i.pisellos,eT=null==eS||null==(o=eS.appHelper)||null==(r=o.utils)||null==(n=r.businessUtils)?void 0:n.isProductMergeDisabled,eI=(0,eC.useMemo)(()=>()=>"function"!=typeof eT||!eT(),[eT]),eP=y?`bookingTicket-${s}-${y}`:[s,A].filter(Boolean).join("-"),eA=c||eP,{runtime:eD}=Kj(),{isSecondaryScreen:eE,secondaryProductsPerRow:eO,showSecondaryCustomerInfo:ez,mainContentWrapperProps:eL,secondaryScreenSettingsModal:eR}=Q2(eD,$),eF=E??O??"standard",eB="SelfServiceKiosk"===eF?"kiosk":eF,eV="venue-ticket-booking"===eB||"venue-party-booking"===eB,eU="kiosk"===eB||"HDLKiosk"===eB,eY=dw({preferEngineLocale:eU}),[eW,eK]=(0,eC.useState)(),eG="HDLKiosk"===eB&&eW?eW:eu||eY,eQ=(0,eC.useCallback)(e=>{eK(e)},[]),eZ=eE&&"secondaryScreen"===eB,eJ=e6z(u),eX=(0,eC.useMemo)(()=>eWV(eWH(null==w?void 0:w.platform,ej),D),[null==w?void 0:w.platform,ej,D]),e0="kiosk"===eB&&eX.variant||D,e2="kiosk"===eB?eX.kioskShellLayout:void 0,e1=(0,eC.useMemo)(()=>{let e=e6L(u,I,eU?void 0:String(eWH(null==w?void 0:w.platform,ej)??"")),t={...e,..."HDLKiosk"===eB&&!(null==e?void 0:e.appearance)&&!(null==e?void 0:e.resolveAppearance)?{resolveAppearance:eMA}:{},enableMultiCurrencySettlement:d},l=eX.platform?eX.productDetailPresentationPlatform:(null==t?void 0:t.presentationPlatform)??eX.productDetailPresentationPlatform;return eU||eV?{...t,initializeFullBookingContext:!1,variant:eX.productDetailVariant,selectorColumns:"phone"===eX.productDetailVariant&&"default"===l?1:2,isShowProductSummary:!0,isShowCollapsibleSections:!0,isShowMobileWeighing:!0,isShowProcedureSteps:!0,isShowNote:!0,isShowManualPriceChange:!1,isShowRemove:!1,presentationPlatform:l}:{...t,selectorColumns:"phone"===D?1:null==t?void 0:t.selectorColumns,presentationPlatform:eJ?"pos":void 0,initializeFullBookingContext:!0,isShowCollapsibleSections:!0,...eJ?{isShowManualPriceChange:!0}:{},allowUnavailableBookingSelection:eJ,allowNoResourceBookingSelection:eJ}},[d,eJ,eV,eX.productDetailPresentationPlatform,eX.productDetailVariant,eX.platform,I,null==w?void 0:w.platform,ej,eU,eB,u,D]),e4="kiosk"!==eB&&eJ,e3=eWH(null==w?void 0:w.platform,ej),e8="webpos"===String(e3??"").trim().toLowerCase()?"pos":e3,e6=(0,eC.useMemo)(()=>({enforceSingleBookingStartDate:!1,enableMemberCartConsistency:"pos"===e8&&"standard"===eB,...w,...e8?{platform:e8}:{},enablePickupTiming:"HDLKiosk"!==eB&&!eV}),[w,e8,eB,eV]),e5=(0,eC.useMemo)(()=>e4?{...W,cartItems:{...null==W?void 0:W.cartItems,bookingQuantityMode:"editable"}}:W,[e4,W]),e7=(0,eC.useRef)({date:void 0,customerId:void 0}),e9=(0,eC.useMemo)(()=>eN?{action:eN,getRuntime:()=>{var e,t,l,i,a;let n=null==eM||null==(e=eM.getModule)?void 0:e.call(eM,eA),r=null==n||null==(i=n.store)||null==(l=i.bookingContext)||null==(t=l.getState)?void 0:t.call(l),o=(null==n||null==(a=n.getBookingDate)?void 0:a.call(n))??(null==r?void 0:r.date);return{...e7.current,date:e6R(o,e7.current.date)}}}:void 0,[eN,eM,eA]);return(0,eH.jsx)(d_,{value:eG,children:(0,eH.jsx)(eCG,{destroyOnUnmount:f,osKey:eA,enableMultiCurrencySettlement:d,solution:"unifiedBookingSales",moduleAccess:c?"existing":"ensure",lifecycleOwner:p,orderId:m,autoBootstrap:g??!!m,autoRestoreOnInit:h,restoreOrderAfterPaidCheckout:v,businessCode:y,bookingConfigParams:b,resourceIdFromCalendar:x,bookingTimeRangeFromCalendar:k,autoInitBookingContext:_,otherParams:e6,inventory:S,catalogScope:j,checkoutHooks:N,deferHolderAuthOnClose:"kiosk"===eB||eV,enablePromotionCodeCustomerAuth:eV&&"kiosk"===eX.platform,enableCustomerAuthHost:"kiosk"===eB&&eX.enableCustomerAuthHost||eV&&eXy({otherParams:w}),shouldMergeProductLines:eI,rulesHooks:C,legacyOpenProductDetail:e9,uiHosts:M,awaitAllergyConfirmation:T,normalProductDetailConfig:e1,mergeBookingLinesForDisplay:!!e4||P,enableTempOrderPersist:G,enableTempOrderSync:Q,isActive:Z,catalogPreparation:J,preserveProductCatalogOnInactiveCustomerClear:X,enableGlobalScanListener:"HDLKiosk"!==eB&&et,scanRequest:el,onScanRequestAccepted:ei,onScanRequestSettled:ea,scanScope:en,onScanPromotionResult:er,suppressCartIneligibleScanToast:!0,promotionScanSuccessMessageKey:eo,promotionItemIncreaseMessageKey:es??(eU?"pisell2.big-sale.kiosk.offer-added-success":void 0),defaultProductLoadParams:F,autoReloadProductCatalogOnCustomerChange:!eV&&ee,promotionProductSource:eV?"catalog-only":void 0,enableMenuOverride:q,children:(0,eH.jsxs)(eCJ,{children:[(0,eH.jsx)(e6$,{runtimeRef:e7}),ep,(0,eH.jsx)(e6O,{isActive:Z,catalogPreparation:J,osKey:s,mode:A,variant:e0,kioskShellLayout:e2,kioskAppearance:"kiosk"===eB?eX.appearance:void 0,template:eF,kioskAppId:z,kioskAppBindings:L,venueBookingConfig:R,productLoadParams:F,productDisplayConfig:B,productCatalogSessionKey:V,productCatalogReady:U,saleDetailTemplate:Y,saleDetailModuleConfig:e5,autoCreate:K,orderId:m,className:ed,style:ec,locale:eG,onLocaleChange:"HDLKiosk"===eB?eQ:void 0,saleDetailWrapperProps:eZ?eL:void 0,cartProductsPerRow:eZ?eO:void 0,showClient:eZ?ez:void 0,businessCode:y,bookingConfigParams:b,hideSelectFloorMapResourceAction:H,saleDetailHeaderSlot:em,rightActionBarClose:eg,overlaySlot:eh,onOrderComplete:ev,onPaidCheckout:ef,onPaymentPageActiveChange:ey,onRequestHome:eb,renderCatalog:ex,externalActionRequest:ek,onExternalActionAccepted:e_,onExternalPaymentSettled:ew}),eZ?eR:null]})})})};e6F.displayName="BigSale";let e6q=e6F;function e6B(e){let{busy:t,pending:l=!1,primaryLabel:i,primaryIcon:a=(0,eH.jsx)("span",{className:"vm-catalog-bar-arrow","aria-hidden":"true",children:(0,eH.jsx)(pr,{})}),primaryType:n="button",primaryDisabled:r=!1,secondaryAction:o,children:s,onBack:d,onPrimary:c}=e,{text:u}=eTp();return(0,eH.jsxs)(eH.Fragment,{children:[o&&(0,eH.jsxs)("button",{className:"vm-bottom-bar-secondary",type:"button",disabled:t,"aria-disabled":t||l,onClick:()=>{t||l||o.onClick()},children:[o.icon,(0,eH.jsx)("span",{children:o.label})]}),(0,eH.jsxs)("footer",{className:"vm-bottom-bar vm-catalog-bar","aria-label":u("catalogOrderActions"),children:[(0,eH.jsx)("div",{className:"vm-catalog-bar-leading",children:(0,eH.jsxs)("button",{className:"vm-catalog-bar-button",type:"button",disabled:t,"aria-disabled":t||l,onClick:()=>{t||l||d()},children:[(0,eH.jsx)("span",{className:"vm-catalog-bar-arrow","aria-hidden":"true",children:(0,eH.jsx)(pa,{})}),(0,eH.jsx)("span",{children:u("back")})]})}),(0,eH.jsx)("div",{className:"vm-catalog-bar-summary","aria-live":s?"polite":void 0,children:s}),(0,eH.jsx)("div",{className:"vm-catalog-bar-trailing",children:(0,eH.jsxs)("button",{className:"vm-catalog-bar-button vm-catalog-bar-next",type:n,disabled:t||r,"aria-disabled":t||l||r,onClick:e=>{t||l||r?e.preventDefault():null==c||c()},children:[(0,eH.jsx)("span",{children:i}),a]})})]})]})}function e6H(e){let{quantity:t,busy:l,pending:i=!1,onReview:a}=e,{text:n}=eTp();return(0,eH.jsxs)("button",{className:"vm-catalog-bar-cart",type:"button",disabled:l||0===t,"aria-disabled":l||i||0===t,onClick:()=>{l||i||!(t>0)||a()},"aria-label":n("catalogCart",{count:t}),children:[(0,eH.jsx)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:(0,eH.jsx)("path",{d:"M6 8h12l1 12H5L6 8Zm3 0a3 3 0 0 1 6 0"})}),(0,eH.jsx)("strong",{children:t})]})}function e6V(e){let{quantity:t,total:l,amountDue:i,busy:a,pending:n=!1,onBack:r,onReview:o,onCheckout:s,onPromotion:d,promotionVisible:c=!1}=e,{text:u}=eTp();return(0,eH.jsxs)(e6B,{busy:a,pending:n,onBack:r,primaryLabel:u(0===i?"catalogConfirmOrder":"catalogCheckout"),onPrimary:s,children:[0!==i&&(0,eH.jsxs)("button",{className:"vm-catalog-bar-amount",type:"button",disabled:a||0===t,"aria-disabled":a||n||0===t,onClick:()=>{a||n||!(t>0)||o()},children:[(0,eH.jsx)("span",{children:u("catalogToPay")}),(0,eH.jsx)("strong",{children:l})]}),(0,eH.jsx)(e6H,{quantity:t,busy:a,pending:n,onReview:o}),d&&(0,eH.jsxs)("button",{className:"vm-catalog-bar-promotion",type:"button",disabled:a,"aria-disabled":a||n,"aria-label":u("catalogPromotion"),"aria-pressed":c,"aria-expanded":c,onClick:()=>{a||n||d()},children:[(0,eH.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,eH.jsx)("path",{d:"m6 18 12-12"}),(0,eH.jsx)("circle",{cx:"7",cy:"7",r:"3"}),(0,eH.jsx)("circle",{cx:"17",cy:"17",r:"3"})]}),(0,eH.jsx)("span",{children:u("catalogPromotion")})]})]})}function e6U(e){let{brand:t,active:l=!0,busy:i=!1,scannedCode:a="",onCodeChange:n,onFindSale:r,onBack:o}=e,{text:s}=eTp();return(0,eH.jsxs)("form",{className:`vm-redeem-screen vm-bottom-bar-layout${l?"":" vm-customer-paused"}`,"aria-busy":i,onSubmit:e=>{e.preventDefault();let t=a.trim();l&&!i&&t&&r(t)},children:[(0,eH.jsx)("header",{className:"vm-redeem-brand",children:(0,eH.jsx)(eTy,{name:t,compact:!0})}),(0,eH.jsx)("div",{className:"vm-redeem-heading",children:(0,eH.jsx)("h1",{children:s("redeemTitle")})}),(0,eH.jsxs)("div",{className:"vm-redeem-content",children:[(0,eH.jsx)("div",{className:"vm-redeem-code",children:(0,eH.jsxs)("div",{className:"vm-redeem-code-field",children:[(0,eH.jsxs)("svg",{className:"vm-redeem-keyboard-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,eH.jsx)("rect",{x:"2",y:"3",width:"20",height:"18",rx:"2"}),(0,eH.jsx)("path",{d:"M6 7h.01M10 7h.01M14 7h.01M18 7h.01M6 11h.01M10 11h.01M14 11h.01M18 11h.01M7 16h10"})]}),(0,eH.jsx)("input",{type:"text",value:a,disabled:!l||i,onChange:e=>n(e.target.value),inputMode:"text",enterKeyHint:"search",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,"aria-label":s("redeemCodeLabel"),placeholder:s("redeemCodePlaceholder")}),a&&(0,eH.jsx)("button",{type:"button",className:"vm-redeem-code-clear",disabled:!l||i,"aria-label":s("redeemClearCode"),onClick:()=>n(""),children:(0,eH.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]})}),(0,eH.jsx)("div",{className:"vm-redeem-divider",children:(0,eH.jsx)("span",{children:s("redeemOr")})}),(0,eH.jsxs)("div",{className:"vm-redeem-scanner-card",children:[(0,eH.jsxs)("div",{className:"vm-redeem-scanner-symbol","aria-hidden":"true",children:[(0,eH.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-tl"}),(0,eH.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-tr"}),(0,eH.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-bl"}),(0,eH.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-br"}),(0,eH.jsx)("span",{className:"vm-redeem-scanner-icon",children:(0,eH.jsx)(eTh,{name:"qr-code"})}),(0,eH.jsx)("span",{className:"vm-redeem-scan-line"})]}),(0,eH.jsxs)("div",{className:"vm-redeem-scanner-copy",children:[(0,eH.jsx)("p",{className:"vm-redeem-scanner-title",children:s("redeemScanPrompt")}),(0,eH.jsx)("p",{className:"vm-redeem-scanner-hint",children:s("redeemScannerLocation")})]}),(0,eH.jsxs)("ul",{className:"vm-redeem-code-types",children:[(0,eH.jsx)("li",{children:s("redeemTypeWristband")}),(0,eH.jsx)("li",{children:s("redeemTypeWallet")}),(0,eH.jsx)("li",{children:s("redeemTypeVoucher")}),(0,eH.jsx)("li",{children:s("redeemTypeReceipt")})]}),(0,eH.jsx)("span",{className:"vm-redeem-scanner-direction","aria-hidden":"true",children:(0,eH.jsx)(eTh,{name:"arrow-down"})})]})]}),(0,eH.jsx)(e6B,{busy:!l||i,onBack:o,primaryType:"submit",primaryDisabled:!a.trim(),primaryLabel:s("redeemContinue")})]})}let e6Y=e=>[...Array.isArray(e)?e:[]].sort((e,t)=>Number(e.sort||0)-Number(t.sort||0)),e6W=(e,t)=>JSON.stringify([String(e),String(t??0)]),e6K=e=>{var t,l;return!(null==(t=e.variant_group)?void 0:t.length)&&!(null==(l=e.variant)?void 0:l.length)};function e6G(e,t,l){let i=new Map,a=new Map;for(let t of e){let e={id:String(t.id),title:l(t.title_i18n)||l(t.title),subtitle:l(t.subtitle_i18n)||l(t.subtitle),cover:"string"==typeof t.cover?t.cover:void 0,rows:[]},n=e6K(t);for(let i of n?[{id:0}]:e6Y(t.variant)){let r=new Set(String(i.sku_ids||"").split("_")),o=e6Y(t.variant_group).map(e=>{var t,a,n;let o=null==(t=e.variant_item)?void 0:t.find(t=>r.has(`${e.id}:${t.id}`));return{name:l(e.name_i18n)||l(e.name),value:l(null==o?void 0:o.name_i18n)||l(null==o?void 0:o.name)||l((null==(a=i.title)?void 0:a[e.position_id])??(null==(n=i.name)?void 0:n[e.position_id])),enabled:l1(e)&&(!o||l1(o))}}),s=i.price??i.base_price??t.price,d={key:e6W(t.id,i.id),product:t,variant:i,label:n?e.title:o.map(e=>e.value).filter(Boolean).join(" \xb7 ")||l("string"==typeof i.title?i.title:i.code)||String(i.id),specification:o.filter(e=>e.value).map(e=>e.name?`${e.name}: ${e.value}`:e.value).join(", "),price:s,enabled:l1(t)&&l1(i)&&o.every(e=>e.enabled)&&null!=s&&Number.isFinite(Number(s))&&Number(s)>=0,items:[],quantity:0};a.has(d.key)||(a.set(d.key,d),e.rows.push(d))}e.rows.length&&i.set(e.id,e)}for(let e of t){var n,r;let t=e.product_variant_id??(null==(n=e.product_sku)?void 0:n.product_variant_id)??0,o=e6W(e.product_id,t),s=a.get(o);if(!s){let n=String(e.product_id),d=i.get(n);d||(d={id:n,title:l(e.product_title??e.title)||n,subtitle:"",rows:[]},i.set(n,d)),s={key:o,product:{id:e.product_id},variant:{id:t},label:l(e.product_option_string??(null==(r=e.product_sku)?void 0:r.product_option_string))||("0"===String(t)?d.title:String(t)),specification:"",price:e.selling_price??e.price??0,enabled:!1,items:[],quantity:0},d.rows.push(s),a.set(o,s)}s.items.push(e),s.quantity+=Number(e.num||0)}return[...i.values()]}function e6Q(e){var t;let{product:l,variant:i,specification:a,price:n}=e,r=e6K(l)&&"0"===String(i.id);if(!e.enabled||!r&&!(null==(t=l.variant)?void 0:t.some(e=>String(e.id)===String(i.id))))throw Error("Invalid vending SKU selection");let o=`${l.id}_${i.id}`;return{...l,product_variant_id:i.id,isOpenDetailModal:!1,_extend:{price:n},cartDetailValue:{key:o,rowKey:o,product_id:l.id,product_variant_id:i.id,production_code:(r?l.production_code:i.production_code)??"",product_option_string:a,price:n,quantity:1,option:[],bundle:[],session:null}}}function e6Z(e,t){let l=e.map(e=>{let l=e.product.variant_group,i={key:"ungrouped",label:"",dimensionName:"",ranks:[Number.MAX_SAFE_INTEGER],display:{row:e,label:e.label}};if(!Array.isArray(l)||0===l.length)return i;if(1===l.length)return{...i,display:{row:e,label:e.specification||e.label}};let a=new Set(String(e.variant.sku_ids||"").split("_")),n=l.map(l=>{var i,n;let r=[...l.variant_item||[]].sort((e,t)=>Number(e.sort||0)-Number(t.sort||0)),o=r.findIndex(e=>a.has(`${l.id}:${e.id}`)),s=r[o],d=t(null==s?void 0:s.name_i18n)||t(null==s?void 0:s.name)||t((null==(i=e.variant.title)?void 0:i[l.position_id])??(null==(n=e.variant.name)?void 0:n[l.position_id]));return{key:JSON.stringify([l.id,(null==s?void 0:s.id)??d]),name:t(l.name_i18n)||t(l.name),value:d,rank:o<0?Number.MAX_SAFE_INTEGER:o}}),[r,...o]=n;return r.value?{key:r.key,label:r.value,dimensionName:t(l[0].name_i18n)||t(l[0].name),ranks:n.map(e=>e.rank),display:{row:e,label:o.filter(e=>e.value).map(e=>e.name?`${e.name}: ${e.value}`:e.value).join(" \xb7 ")||e.label}}:i});l.sort((e,t)=>{for(let l=0;l<Math.max(e.ranks.length,t.ranks.length);l++){let i=(e.ranks[l]??Number.MAX_SAFE_INTEGER)-(t.ranks[l]??Number.MAX_SAFE_INTEGER);if(i)return i}return 0});let i=new Map;for(let e of l){let t=i.get(e.key);t||(t={key:e.key,label:e.label,dimensionName:e.dimensionName,rows:[]},i.set(e.key,t)),t.rows.push(e.display)}return[...i.values()]}function e6J(e){let{choices:t,busy:l,disabled:i,blocked:a,inventoryRefreshing:n,onChange:r}=e,{text:o,localized:s}=eTp(),d=new Map(t.map(e=>[e.row.key,e])),c=e6Z(t.map(e=>{let{row:t}=e;return t}),s);return(0,eH.jsx)("div",{className:"vm-voucher-sku-list","aria-busy":l,children:c.map(e=>{let t=e.label?"fieldset":"div";return(0,eH.jsxs)(t,{className:"vm-voucher-sku-group",role:e.label?"group":void 0,"aria-label":e.label||void 0,children:[e.label&&(0,eH.jsxs)("legend",{className:"vm-voucher-sku-group-title",children:[e.dimensionName&&(0,eH.jsx)("span",{className:"vm-sku-group-dimension",children:e.dimensionName}),(0,eH.jsx)("h3",{children:e.label})]}),(0,eH.jsx)("div",{className:"vm-voucher-sku-options",children:e.rows.map(t=>{let{row:s,label:c}=t,{quantity:u,maxQuantity:p,available:m,soldOut:g,loading:h,limitReason:v}=d.get(s.key),f=n||h,y=f?o("loading"):"stock"===v?o("catalogLimitReached"):null,b=(!m||g)&&!f,x=!i&&!a&&!f&&m&&!g&&u<p,k=e.label?"h4":"h3";return(0,eH.jsxs)("article",{className:`vm-voucher-sku-row${u>0?" is-selected":""}${!m||g?" is-unavailable":""}${b?" has-status-overlay":""}`,"aria-label":s.label,onClick:()=>{!l&&x&&r(s,u+1)},children:[(0,eH.jsx)("button",{type:"button",className:"vm-voucher-sku-add","aria-label":s.label,title:o("collectIncrease",{name:s.label}),disabled:!x,"aria-disabled":l||!x}),s.variant.cover?(0,eH.jsx)("img",{className:"vm-voucher-sku-image",src:s.variant.cover,alt:""}):(0,eH.jsx)("span",{className:"vm-voucher-sku-dot","aria-hidden":"true"}),(0,eH.jsxs)("div",{className:"vm-voucher-sku-label",children:[(0,eH.jsx)(k,{children:c}),!e.label&&s.specification&&c!==s.specification&&(0,eH.jsx)("p",{children:s.specification}),(0,eH.jsx)("p",{className:"vm-voucher-sku-status",role:y?"status":void 0,"aria-hidden":!y,children:y})]}),b&&(0,eH.jsx)(eI9,{label:o(g?"catalogSoldOut":"catalogUnavailableLabel")}),(0,eH.jsx)("div",{className:`vm-voucher-sku-quantity${b&&0===u?" is-hidden":""}`,role:"group","aria-label":s.label,"aria-hidden":b&&0===u,"aria-disabled":l||i,onClickCapture:e=>{(l||i)&&(e.preventDefault(),e.stopPropagation())},onClick:e=>e.stopPropagation(),children:(0,eH.jsx)(z8,{className:"vm-collect-stepper",keyboardClassName:"vm-quantity-keyboard",value:u,min:0,max:Math.max(u,a||f||!m||g?0:p),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:i,onChange:e=>{l||i||r(s,e)},minusIcon:(0,eH.jsx)("span",{"aria-label":o("collectDecrease",{name:s.label}),children:"−"}),plusIcon:(0,eH.jsx)("span",{"aria-label":o("collectIncrease",{name:s.label}),children:"+"})})})]},s.key)})})]},e.key)})})}function e6X(e){let{context:t,isActive:l,pending:i,errorMessage:a,onBusyChange:n}=e,r=(0,nY.useToast)(),o=eCw(),s=(0,eC.useRef)(!1),[d,c]=(0,eC.useState)(null),u=t.sales.bookingTicket,p=(0,eC.useRef)({ticket:u,isActive:l,revision:0});(p.current.ticket!==u||p.current.isActive!==l)&&(p.current={ticket:u,isActive:l,revision:p.current.revision+1}),(0,eC.useEffect)(()=>()=>{p.current.revision+=1},[]);let m=null!==d,g=!!(i||m||o.isProcessing||t.cart.consistencyPending||o.orderTransition.pending);(0,eC.useEffect)(()=>{n(l&&g)},[l,g,n]),(0,eC.useEffect)(()=>()=>n(!1),[n]);let h=o3(()=>{n(l&&!!(i||o.getIsProcessing()||t.cart.consistencyPending||o.getIsOrderTransitionPending()))}),v=o3(function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return l&&!s.current&&(!o.getIsProcessing()||e)&&!o.getIsPaymentProcessing()&&!o.getIsOrderTransitionPending()}),f=o3(async function(e){var l,i;let{key:d="cart",ownsActivityLock:m=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!v(m))return;s.current=!0;let g=p.current.revision,f=null==u||null==(i=u.getTempOrder)||null==(l=i.call(u))?void 0:l.order_id,y=()=>{var e,t;return p.current.isActive&&p.current.revision===g&&(null==u||null==(t=u.getTempOrder)||null==(e=t.call(u))?void 0:e.order_id)===f},b=o.begin();c(d),n(!0);try{if(await t.cart.waitForCartConsistency(),!y())return;await e(y),await t.cart.waitForCartConsistency()}catch(e){y()&&r.fail((null==e?void 0:e.message)||a)}finally{s.current=!1,b(),c(null),p.current.revision===g&&h()}}),y=o3(e=>{!g&&v()&&e()});return{activity:o,session:p,mutation:s,mutationKey:d,mutating:m,busy:g,canInteract:v,run:f,navigate:y}}let e60=e=>{var t,l,i,a,n;return!!((null==(t=e.option)?void 0:t.length)||(null==(l=e.options)?void 0:l.length)||e.option_group_count||(null==(i=e.bundle)?void 0:i.length)||(null==(a=e.bundle_groups)?void 0:a.length)||(null==(n=e.bundle_group)?void 0:n.length)||Number(e.open_sold_weight))},e62=e=>{var t,l;return!(null==(t=e.variant_group)?void 0:t.length)&&!(null==(l=e.variant)?void 0:l.length)&&!e60(e)};function e61(e,t){var l,i,a;if(e60(e))return!1;let n=null==(l=e.variant)?void 0:l.find(e=>String(e.id)===String(t));if(((null==(i=e.variant_group)?void 0:i.length)||(null==(a=e.variant)?void 0:a.length))&&!n)return!1;let r=(null==n?void 0:n.price)??(null==n?void 0:n.base_price)??e.price;return null!=r&&""!==String(r).trim()&&0===Number(r)}function e64(e){var t;let l=e.source;return"product-voucher"===e.kind&&!l.isEditMode&&!l.usageLimitFailKey&&!l.isDisabled&&(null==l.unified_available_status||""===l.unified_available_status||0!==Number(l.unified_available_status))&&(!l.reasonCode||["product_not_applicable","holder_not_matched"].includes(l.reasonCode))&&((null==(t=l.config)?void 0:t.isAvailable)!==!1||"product_not_applicable"===l.reasonCode)}function e63(e,t){let l=new Set(e.map(e=>String(e.id))),i=eMU(t).filter(e64).filter(e=>!l.has(String(e.id))&&(l.add(String(e.id)),!0));return i.length?[...e,...i.map(e=>e.source)]:e}function e68(e,t){let l=e.limited_relation_product_data;if(!l)return!1;let i=String(t.id);return!(1===Number(l.filter)&&(l.exclude_product_ids||[]).map(String).includes(i))&&("product_all"===l.type||["products","product_collection"].includes(l.type)&&(l.product_ids||[]).map(String).includes(i))}function e66(e){return[...new Set((e.discount_list||[]).filter(e=>"good_pass"===(e.type||e.tag)).map(e=>{var t;return null==(t=e.discount)?void 0:t.resource_id}).filter(e=>null!=e&&""!==String(e)).map(String))]}function e65(e){var t;let l=e.selling_price;return null!=l&&""!==String(l).trim()&&0===Number(l)&&!(null==(t=e.discount_list)?void 0:t.length)}function e67(e,t){let l=new Set(e.items.flatMap(e66));return e.vouchers.filter(e=>!l.has(String(e.id))&&e68(e.source,t))}function e69(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=new Map,a=new Set,n=new Set(l.flatMap(e66)),r=l.filter(e65);for(let l of eMU(e).filter(e64)){if(a.has(String(l.id)))continue;a.add(String(l.id));let e=l.source;if(!t.some(t=>e68(e,t))&&!n.has(String(l.id))&&!r.some(t=>e68(e,{id:t.product_id})))continue;let o=function(e){let t=e.product_id;return JSON.stringify(null==t||""===String(t)?["voucher",String(e.id)]:["product",String(t)])}(e),s=i.get(o);s||(s={key:o,title:l.title||Rz(e.product_name),vouchers:[],discountIds:[],quota:0,selected:0,freeQuantity:0,remaining:0,items:[],products:[]},i.set(o,s)),s.discountIds.push(l.id),s.vouchers.push(l),s.quota+=1}let o=new Set(r);for(let e of i.values()){e.products=t.filter(t=>e.vouchers.some(e=>e68(e.source,t)));let i=new Set(e.discountIds.map(String)),a=new Set;e.items=l.filter(t=>{let l=e66(t).filter(e=>i.has(e));return(l.forEach(e=>a.add(e)),o.has(t)&&e.vouchers.some(e=>e68(e.source,{id:t.product_id})))?(e.freeQuantity+=Number(t.num||0),!0):l.length>0}),e.selected=a.size,e.remaining=Math.max(0,e.quota-e.selected)}return[...i.values()].filter(e=>e.products.length>0||e.items.length>0)}function e5e(e){var t;let{brand:l,context:i,products:a,loading:n,isActive:r,inventoryFailed:o,inventoryRefreshing:s,checkoutPending:d,refreshInventory:c,onBack:u,onCheckout:p,onBusyChange:m,onActiveChange:g,autoSelectionRef:h}=e,{text:v,localized:f}=eTp(),y=(0,nY.useToast)();(0,eC.useEffect)(()=>(null==g||g(r),()=>null==g?void 0:g(!1)),[r,g]);let{inventory:b}=L2(),x=i.sales.bookingTicket,{activity:k,mutating:_,busy:w,canInteract:S,run:j,navigate:N}=e6X({context:i,isActive:r,onBusyChange:m,pending:n||!!d,errorMessage:v("collectInvalid")}),C=(null==x||null==(t=x.getTempOrder)?void 0:t.call(x))??i.cart.tempOrder,M=i.summary.summary??(null==C?void 0:C.summary),T=eC9({amountGap:null==M?void 0:M.amount_gap,fallbackAmount:null==M?void 0:M.total_amount,orderPaidAmount:null==M?void 0:M.order_paid_amount,payments:null==C?void 0:C.payments}),I=e69(i.cart.discountList,a,(null==C?void 0:C.products)||[]),P=!!(x&&i.cart.addProductWithFlow),A=!r||!P||n||!!d||k.orderTransition.pending,D=[...new Set(I.flatMap(e=>e.items))].filter(e65).reduce((e,t)=>e+Number(t.num||0),0),E=I.reduce((e,t)=>e+t.selected,D),O=I.reduce((e,t)=>e+t.remaining,0),z=((null==C?void 0:C.products)||[]).reduce((e,t)=>e+Number(t.num||0),0),L=I.reduce((e,t)=>e+t.quota,0),R=o3(()=>{var e,t,l,n;return e69((null==x||null==(e=x.getDiscountList)?void 0:e.call(x))||i.cart.discountList,a,(null==x||null==(l=x.getTempOrder)||null==(t=l.call(x))?void 0:t.products)||(null==(n=i.cart.tempOrder)?void 0:n.products)||[])}),$=o3((e,t)=>{let l=R().find(t=>t.key===e);return l?e67(l,t).length:0}),F=o3(async(e,t,l,a)=>{let n=R().find(t=>t.key===e);for(let r of n?e67(n,t).filter(e=>e.source.isManualSelect):[]){if(!a()||!n||n.selected>=l)return;await i.cart.setDiscount({discountId:r.id,isSelected:!0}),n=R().find(t=>t.key===e)}}),q=o3(function(e,t,l){var a,r,d;let c=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!P||n||o||s||!b)return 0;let u=(null==(a=(null==x||null==(r=x.getTempOrder)?void 0:r.call(x))??i.cart.tempOrder)?void 0:a.products)||[];return Math.max(0,...(void 0===l&&(null==(d=t.variant_group)?void 0:d.length)?t.variant||[]:[{id:l??0}]).map(l=>{let i=l.id??l.product_variant_id,a=b.selectionAvailability(t,i,u),n=c||e61(t,i)?1/0:$(e.key,t);return"ready"===a.availability.status?Math.min(a.availableQuantity,n):0}))}),B=(e,t,l)=>!A&&q(e,t,l)>0,H=o3(async(e,t,l,a)=>{let n=e61(t,t.product_variant_id),r=R().find(t=>t.key===e.key),o=await i.cart.addProductWithFlow(eMW(t),{type:"select",quantity:l,debounceMs:0,notShowToast:!0,getQuantityLimit:n?void 0:()=>$(e.key,t),initialHolderIds:[]});if("added"===o.status&&a()&&!n){let i=R().find(t=>t.key===e.key),n=Math.max(0,((null==i?void 0:i.freeQuantity)||0)-((null==r?void 0:r.freeQuantity)||0));await F(e.key,t,((null==r?void 0:r.selected)||0)+Math.max(0,l-n),a)}return o}),V=(0,eC.useRef)(null),U=h??V,Y=(null==C?void 0:C.external_sale_number)||(null==C?void 0:C.order_id);U.current&&U.current.ticket===x&&U.current.orderKey===Y||(U.current={ticket:x,orderKey:Y,handled:new Set});let W=(e,t)=>JSON.stringify([e.key,String(t)]),K=I.find(e=>{var t;if(1!==e.products.length||!e62(e.products[0]))return!1;let l=e.products[0],i=null==(t=e6G([l],[],f)[0])?void 0:t.rows[0];return(null==i?void 0:i.enabled)&&(null==b?void 0:b.selectionAvailability(l,0,(null==C?void 0:C.products)||[]).availability.status)==="ready"&&e.vouchers.some(t=>!U.current.handled.has(W(e,t.id)))});(0,eC.useEffect)(()=>{if(!K||!P||!r||w||o||s||!S())return;let e=U.current,t=new Set(K.vouchers.filter(t=>!e.handled.has(W(K,t.id))).map(e=>String(e.id)));t.forEach(t=>e.handled.add(W(K,t))),j(async e=>{var l,a,n;let r=R().find(e=>e.key===K.key);if(!r||1!==r.products.length||!e62(r.products[0]))return;let d=r.products[0],c=null==(l=e6G([d],[],f)[0])?void 0:l.rows[0],u=(null==(a=(null==x||null==(n=x.getTempOrder)?void 0:n.call(x))??i.cart.tempOrder)?void 0:a.products)||[];if(!(null==c?void 0:c.enabled)||o||s||(null==b?void 0:b.selectionAvailability(d,0,u).availability.status)!=="ready")return;let p=Math.min(e67(r,d).filter(e=>t.has(String(e.id))&&!e.source.isManualSelect).length,q(r,d,0),e61(d,0)?Math.max(0,r.quota-r.freeQuantity):1/0);if(p>0){let t=await H(r,e6Q(c),p,e);if(e()&&"added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}})},[K,P,r,w,o,s,b,S,j,R,f,x,i.cart,q,H,U,v]);let G=(e,t,l,a,n,r,o)=>{if(!P||w||!Number.isSafeInteger(a)||a<0)return;let s=l.map(e=>({item:e,uid:e_f(e).unique_identification_number})),d=e=>{var t,l;let{item:a,uid:n}=e;return((null==(t=(null==x||null==(l=x.getTempOrder)?void 0:l.call(x))??i.cart.tempOrder)?void 0:t.products)||[]).find(e=>null!=n&&""!==String(n)?e_f(e).unique_identification_number===n:e===a)};j(async l=>{let c=s.map(d).filter(Boolean),u=a-c.reduce((e,t)=>e+Number(t.num||0),0);if(u>0){var p,m;let a=!r&&c.length>0&&c.every(e65),s=c[c.length-1];if(!r&&!s)return;let d=R().find(t=>t.key===e.key),g=null==d?void 0:d.products.find(e=>String(e.id)===String(t.id));if(!n||!g||!d||u>q(d,g,(null==o?void 0:o.variant.id)??(null==s?void 0:s.product_variant_id)??0,a))throw Error(v("collectLimit"));if(r){let e=null==(p=e6G([g],[],f)[0])?void 0:p.rows.find(e=>o?e.key===o.key:"0"===String(e.variant.id));if(!(null==e?void 0:e.enabled))throw Error(v("catalogUnavailable"));let t=await H(d,e6Q(e),u,l);if(l()&&"added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}else{let n=(null==(m=R().find(t=>t.key===e.key))?void 0:m.selected)||0;await i.cart.updateItemQuantity(s,Number(s.num)+u),l()&&!a&&await F(e.key,t,n+u,l)}return}let g=-u;for(let e of[...s].reverse()){if(!l()||g<=0)return;let t=d(e);if(!t)continue;let a=Math.min(g,Number(t.num)),n=Number(t.num)-a;n<=0?await i.cart.removeItem(t):await i.cart.updateItemQuantity(t,n),g-=a,await i.cart.waitForCartConsistency()}})},Q=function(e,t,l,i,a){var n;let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=i.reduce((e,t)=>e+Number(t.num||0),0);return(0,eH.jsx)("div",{className:"vm-collect-selection-actions",role:"group","aria-label":e.trim(),"aria-disabled":w||A,onClickCapture:e=>{(w||A)&&(e.preventDefault(),e.stopPropagation())},children:(0,eH.jsx)(z8,{className:"vm-collect-stepper",keyboardClassName:"vm-quantity-keyboard",value:o,min:0,max:o+(a?q(t,l,(null==(n=i[0])?void 0:n.product_variant_id)??0,!r&&i.length>0&&i.every(e65)):0),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:A,onChange:e=>G(t,l,i,e,a,r),minusIcon:(0,eH.jsx)("span",{"aria-label":v("collectDecrease",{name:e.trim()}),children:"−"}),plusIcon:(0,eH.jsx)("span",{"aria-label":v("collectIncrease",{name:e.trim()}),children:"+"})})})};return(0,eH.jsxs)("div",{className:"vm-voucher-collect vm-bottom-bar-layout",children:[(0,eH.jsx)(eTv,{children:(0,eH.jsxs)("section",{className:"vm-collect-screen",children:[(0,eH.jsxs)("header",{className:"vm-collect-header",children:[(0,eH.jsx)(eTy,{name:l,compact:!0}),(0,eH.jsx)("h1",{children:v("collectTitle")}),(0,eH.jsx)("p",{className:"vm-collect-scan-hint",children:w&&!_?v("scanProcessing"):v("collectScanMore")})]}),(0,eH.jsxs)("div",{className:"vm-collect-scroll",children:[(0,eH.jsxs)("div",{className:"vm-collect-stats",children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("span",{children:v("collectAvailable")}),(0,eH.jsx)("strong",{children:L})]}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("span",{children:v("collectSelected")}),(0,eH.jsx)("strong",{children:E})]}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("span",{children:v("collectRemaining")}),(0,eH.jsx)("strong",{children:O})]})]}),(o&&!d||!P)&&(0,eH.jsxs)("div",{className:"vm-collect-warning",role:"status",children:[(0,eH.jsx)("span",{children:v(P?"inventoryUnavailable":"collectInvalid")}),o&&(0,eH.jsx)("button",{type:"button",disabled:A||s,"aria-disabled":w||s,onClick:()=>{w||j(c)},children:v("retry")})]}),n?(0,eH.jsx)("p",{className:"vm-collect-empty",role:"status",children:v("loading")}):0===I.length?(0,eH.jsx)("p",{className:"vm-collect-empty",role:"status",children:v("collectNoProducts")}):I.map(e=>{let t=e.items,l=e.selected+e.freeQuantity,i=new Set(e.products.map(e=>String(e.id))),n=new Map(e.products.map(e=>[String(e.id),e]));return t.forEach(e=>{var t;n.has(String(e.product_id))||n.set(String(e.product_id),{id:e.product_id,title:e.product_title,variant_group:Number(e.product_variant_id)>0?[{}]:[],option:null==(t=e.product_sku)?void 0:t.option,bundle:e.product_bundle})}),(0,eH.jsxs)("section",{className:"vm-collect-group",children:[(0,eH.jsxs)("header",{children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("h2",{children:e.title}),(0,eH.jsx)("p",{children:v("collectVoucherCount",{count:e.quota})})]}),(0,eH.jsx)("span",{children:v(e.freeQuantity>0?"collectSelectedCount":"collectGroupSelected",{selected:l,total:e.quota})})]}),[...n.values()].map(l=>{var n,r,d;let c=i.has(String(l.id)),u=Rz(l.title??l.name),p=function(e,t){let l=new Map;for(let n of e){var i,a;let e=JSON.stringify(function e(t){return Array.isArray(t)?t.map(e).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t))):t&&"object"==typeof t?Object.fromEntries(Object.keys(t).sort().map(l=>[l,e(t[l])])):t}({productId:n.product_id,variantId:n.product_variant_id??0,options:(null==(i=n.product_sku)?void 0:i.option)||(null==(a=n.product_sku)?void 0:a.options)||[],bundle:n.product_bundle||[]})),r=l.get(e)||{key:e,items:[],quantity:0,specification:ewG(n,t).product_option_string||""};r.items.push(n),r.quantity+=Number(n.num||0),l.set(e,r)}return[...l.values()]}(t.filter(e=>String(e.product_id)===String(l.id)),{productsCatalog:a,productsByUid:null==C||null==(n=C._extend)?void 0:n.productsByUid}),m=!!((null==(r=l.variant_group)?void 0:r.length)&&(null==(d=l.variant)?void 0:d.length)&&!e60(l)),g=!e62(l);return(0,eH.jsxs)("div",{className:`vm-collect-product${!g?" has-direct-quantity":""}`,children:[(0,eH.jsxs)("div",{className:"vm-collect-product-main",children:[(0,eH.jsx)("div",{children:(0,eH.jsx)("h3",{children:u})}),m?null:g?(0,eH.jsx)("button",{type:"button",className:"vm-collect-select",disabled:!c||!B(e,l),"aria-disabled":w||!c||!B(e,l),onClick:()=>{w||j(async t=>{if(1>q(e,l))throw Error(v("collectLimit"));return H(e,l,1,t)})},children:v("collectSelect")}):Q(u,e,l,p.flatMap(e=>e.items),c,!0)]}),m&&(0,eH.jsx)(e6J,{choices:function(e){var t;let{product:l,items:i,selectedItems:a,remaining:n,inventory:r,localize:o}=e;return((null==(t=e6G([l],a.filter(e=>String(e.product_id)===String(l.id)),o)[0])?void 0:t.rows)||[]).map(e=>{let t=null==r?void 0:r.selectionAvailability(l,e.variant.id,i),a=e.enabled&&(null==t?void 0:t.availability.status)==="ready",o=(null==t?void 0:t.availability.status)==="ready"&&0===t.availability.quantity,s=e61(l,e.variant.id);return{row:e,quantity:e.quantity,maxQuantity:e.quantity+(a?Math.max(0,Math.min(t.availableQuantity,s?1/0:n)):0),available:a,soldOut:o,loading:(null==t?void 0:t.availability.status)==="loading",limitReason:a&&!o?!s&&n<=0?"voucher":0===t.availableQuantity?"stock":void 0:void 0}})}({product:l,items:(null==C?void 0:C.products)||[],selectedItems:e.items,remaining:e67(e,l).length,inventory:b,localize:f}),busy:w,disabled:A,blocked:o||s||!b,inventoryRefreshing:s,onChange:(t,i)=>G(e,l,t.items,i,c&&t.enabled,!0,t)}),g&&!m&&p.map(t=>(0,eH.jsxs)("div",{className:"vm-collect-selection",children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("span",{className:"vm-collect-selection-dot"}),(0,eH.jsxs)("p",{children:[u,t.specification&&(0,eH.jsxs)("span",{children:[" \xb7 ",t.specification]})]})]}),Q(`${u} ${t.specification}`,e,l,t.items,c)]},t.key))]},l.id)})]},e.key)})]})]})}),(0,eH.jsx)(e6B,{busy:A,pending:w,onBack:()=>N(u),primaryLabel:v(0===T?"collectRedeem":"catalogCheckout"),primaryDisabled:n||!P||0===z||o||s,onPrimary:()=>N(()=>{var e,t;let l=(null==x||null==(e=x.getTempOrder)?void 0:e.call(x))??i.cart.tempOrder;(null==l||null==(t=l.products)?void 0:t.some(e=>Number(e.num)>0))?p():y.fail(v("catalogCartEmpty"))}),children:(0,eH.jsxs)("div",{className:"vm-catalog-bar-amount","aria-label":v(D>0?"collectSelectedCount":"collectGroupSelected",{selected:E,total:L}),children:[(0,eH.jsx)("span",{children:v("collectSelected")}),(0,eH.jsx)("strong",{children:D>0?E:`${E} / ${L}`})]})})]})}function e5t(){return(0,eH.jsx)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:(0,eH.jsx)("path",{d:"m12 3 9 5-9 5-9-5 9-5Zm9 5v9l-9 5-9-5V8m9 5v9M7.5 5.5l9 5"})})}function e5l(e){let{brand:t,context:l,products:i,loading:a,isActive:n,inventoryFailed:r,inventoryRefreshing:o,checkoutPending:s,refreshInventory:d,onBack:c,onReview:u,onCheckout:p,onBusyChange:m,onPromotion:g,promotionVisible:h}=e,{text:v,localized:f}=eTp(),y=(0,nY.useToast)(),{inventory:b}=L2(),x=!n||a||!l.sales.isReady||!!s,{activity:k,mutationKey:_,busy:w,run:S,navigate:j}=e6X({context:l,isActive:n,pending:x,onBusyChange:m,errorMessage:v("catalogUpdateFailed")}),N=l.sales.bookingTicket,C=(0,eC.useRef)(i);C.current=i;let M=eC3(l.sales,l.cart),T=(null==M?void 0:M.products)||[],I=e6G(i,T,f),P={groups:I,stocks:new Map(I.reduce((e,t)=>e.concat(t.rows),[]).map(e=>[e.key,null==b?void 0:b.selectionAvailability(e.product,e.variant.id,T)])),loading:a,inventoryFailed:r,inventoryRefreshing:o},A=(0,eC.useRef)({ticket:N,inventory:b,orderId:null==M?void 0:M.order_id,presentation:P});s&&A.current.ticket===N&&A.current.inventory===b&&A.current.orderId===(null==M?void 0:M.order_id)||(A.current={ticket:N,inventory:b,orderId:null==M?void 0:M.order_id,presentation:P});let D=A.current.presentation,E=T.reduce((e,t)=>e+Number(t.num||0),0),O=l.summary.summary??(null==M?void 0:M.summary),z=eC9({amountGap:null==O?void 0:O.amount_gap,fallbackAmount:null==O?void 0:O.total_amount,orderPaidAmount:null==O?void 0:O.order_paid_amount,payments:null==M?void 0:M.payments}),L=YP(M,z),R=x||k.orderTransition.pending,$=o3(function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"input";if(!w&&Number.isSafeInteger(t)&&!(t<0))return S(async a=>{var n,s,d,c;let u=(null==N||null==(s=N.getTempOrder)||null==(n=s.call(N))?void 0:n.products)||[],p=e6G(C.current,u,f).reduce((e,t)=>e.concat(t.rows),[]).find(t=>t.key===e.key);if(!p)return;let m="increase"===i?1:"decrease"===i?-1:t-p.quantity;if(m>0){let e=null==b?void 0:b.selectionAvailability(p.product,p.variant.id,u);if(!p.enabled||r||o||(null==e?void 0:e.availability.status)!=="ready"||e.availableQuantity<m)throw Error(v("catalogUnavailable"));let t=await l.cart.addProductWithFlow(e6Q(p),{type:"select",quantity:m,debounceMs:0,notShowToast:!0});if("added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}else if(m<0){let e=p.items.map(e=>({item:e,uid:e_f(e).unique_identification_number})),t=-m;for(let i of e.reverse()){if(!a()||t<=0)return;let e=((null==N||null==(c=N.getTempOrder)||null==(d=c.call(N))?void 0:d.products)||[]).find(e=>i.uid?e_f(e).unique_identification_number===i.uid:e===i.item);if(!e)continue;let n=Math.min(t,Number(e.num)),r=Number(e.num)-n;r<=0?await l.cart.removeItem(e):await l.cart.updateItemQuantity(e,r),t-=n,await l.cart.waitForCartConsistency()}}},{key:e.key})}),F=e=>j(()=>{var t;let i=eC3(l.sales,l.cart);(null==i||null==(t=i.products)?void 0:t.some(e=>Number(e.num)>0))?e():y.show({icon:"warning",content:v("catalogCartEmpty")})});return(0,eH.jsxs)("div",{className:"vm-catalog vm-bottom-bar-layout",children:[(0,eH.jsx)(eTv,{children:(0,eH.jsxs)("section",{className:"vm-catalog-screen","aria-label":v("catalogTitle"),children:[(0,eH.jsxs)("header",{className:"vm-catalog-header",children:[(0,eH.jsx)(eTy,{name:t,compact:!0}),(0,eH.jsx)("h1",{children:v("catalogTitle")}),(0,eH.jsx)("p",{children:v("catalogHint")})]}),(0,eH.jsxs)("div",{className:"vm-catalog-scroll","aria-busy":w||a||o,children:[D.inventoryFailed&&(0,eH.jsxs)("div",{className:"vm-catalog-warning",role:"alert",children:[(0,eH.jsx)("span",{children:v("inventoryUnavailable")}),(0,eH.jsx)("button",{type:"button",disabled:w||o,onClick:()=>{d()},children:v("retry")})]}),D.loading&&(0,eH.jsx)("p",{className:"vm-catalog-empty",role:"status",children:v("loading")}),!D.loading&&0===D.groups.length&&(0,eH.jsx)("p",{className:"vm-catalog-empty",children:v("catalogEmpty")}),D.groups.map(e=>(0,eH.jsxs)("section",{className:"vm-catalog-group","aria-label":e.title,children:[(0,eH.jsxs)("header",{children:[(0,eH.jsx)("span",{className:"vm-catalog-product-icon",children:e.cover?(0,eH.jsx)("img",{src:e.cover,alt:""}):(0,eH.jsx)(e5t,{})}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("h2",{children:e.title}),e.subtitle&&(0,eH.jsx)("p",{children:e.subtitle})]})]}),e6Z(e.rows,f).map(t=>{let l=t.label?"fieldset":"div";return(0,eH.jsxs)(l,{className:"vm-catalog-sku-group",role:t.label?"group":void 0,"aria-label":t.label||void 0,children:[t.label&&(0,eH.jsxs)("legend",{className:"vm-catalog-sku-group-title",children:[t.dimensionName&&(0,eH.jsx)("span",{className:"vm-sku-group-dimension",children:t.dimensionName}),(0,eH.jsx)("h3",{children:t.label})]}),(0,eH.jsx)("div",{className:"vm-catalog-grid",children:t.rows.map(l=>{let{row:i,label:n}=l,s=D.stocks.get(i.key),d=(null==s?void 0:s.availability.status)==="ready"&&0===s.availability.quantity,c=i.enabled&&(null==s?void 0:s.availability.status)==="ready",u=!a&&!r&&!o&&c&&s.availableQuantity>0,p=!c||d,m=D.inventoryRefreshing||(null==s?void 0:s.availability.status)==="loading",g=p&&!m,h=c&&!d&&!m&&0===s.availableQuantity,f="0"===String(i.variant.id)?e.title:`${e.title} \xb7 ${i.label}`,y=t.label?"h4":"h3";return(0,eH.jsxs)("article",{className:`vm-catalog-card${i.quantity>0?" is-selected":""}${p?" is-unavailable":""}${g?" has-status-overlay":""}`,"aria-label":f,onClick:()=>{u&&$(i,i.quantity+1,"increase")},children:[(0,eH.jsx)("button",{type:"button",className:"vm-catalog-card-add","aria-label":f,title:v("collectIncrease",{name:f}),disabled:R||!u,"aria-disabled":w||!u}),(0,eH.jsxs)("div",{className:"vm-catalog-card-heading",children:[(0,eH.jsx)(y,{children:n}),(0,eH.jsx)("strong",{children:YP(M,i.price)})]}),g&&(0,eH.jsx)(eI9,{label:v(d?"catalogSoldOut":"catalogUnavailableLabel")}),m&&(0,eH.jsx)("span",{className:"vm-catalog-stock-loading",role:"status",children:v("loading")}),(!p||i.quantity>0)&&(0,eH.jsxs)("div",{className:"vm-catalog-quantity",children:[(0,eH.jsx)("span",{children:h?v("catalogLimitReached"):v(i.quantity>0?"catalogAdded":"catalogQuantity")}),(0,eH.jsx)("div",{role:"group","aria-label":f,"aria-disabled":w,"aria-busy":_===i.key,onClick:e=>e.stopPropagation(),children:(0,eH.jsx)(z8,{className:"vm-catalog-stepper",keyboardClassName:"vm-quantity-keyboard",value:i.quantity,min:0,max:i.quantity+(u?s.availableQuantity:0),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:R,onChange:(e,t)=>{$(i,e,null==t?void 0:t.action)},minusIcon:(0,eH.jsx)("span",{"aria-label":v("collectDecrease",{name:f}),children:"−"}),plusIcon:(0,eH.jsx)("span",{"aria-label":v("collectIncrease",{name:f}),children:"+"})})})]})]},i.key)})})]},t.key)})]},e.id))]})]})}),(0,eH.jsx)(e6V,{quantity:E,total:L,amountDue:z,busy:R,pending:w,onBack:()=>j(c),onReview:()=>F(u),onCheckout:()=>F(p),onPromotion:g?()=>j(g):void 0,promotionVisible:h})]})}let e5i={en:{label:"Redeemed",fontSize:20,fontFamily:"Arial, sans-serif"},es:{label:"Canjeado",fontSize:21,fontFamily:"Arial, sans-serif"},ja:{label:"引換済み",fontSize:23,fontFamily:"Hiragino Sans, sans-serif"},"zh-CN":{label:"已兑换",fontSize:25,fontFamily:"PingFang SC, sans-serif"},"zh-TW":{label:"已兌換",fontSize:25,fontFamily:"PingFang TC, sans-serif"}};function e5a(){let e=dw().replace(/_/g,"-").toLowerCase(),t=e.split("-")[0],l="zh"===t?e5i[/^zh-(tw|hk|mo|hant)(-|$)/.test(e)?"zh-TW":"zh-CN"]:e5i[t]||e5i.en;return(0,eH.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"vm-voucher-redemption-stamp",viewBox:"0 0 128 128",width:128,height:128,role:"img","aria-label":l.label,focusable:"false",children:(0,eH.jsxs)("g",{transform:"rotate(-10 64 64)",children:[(0,eH.jsx)("circle",{cx:64,cy:64,r:60,fill:"none",stroke:"currentColor",strokeWidth:2.2}),(0,eH.jsx)("path",{d:"M52 46L61 55L77 38",fill:"none",stroke:"currentColor",strokeWidth:3.8,strokeLinecap:"round",strokeLinejoin:"round"}),(0,eH.jsx)("text",{x:64,y:92,textAnchor:"middle",fontFamily:l.fontFamily,fontSize:l.fontSize,fontWeight:600,fill:"currentColor",children:l.label})]})})}function e5n(){let{token:e}=eT.theme.useToken();return{colorPrimary:e.colorPrimary,colorPrimaryHover:e.colorPrimaryHover,colorPrimaryActive:e.colorPrimaryActive,colorPrimaryBg:e.colorPrimaryBg,colorPrimaryBgHover:e.colorPrimaryBgHover,colorPrimaryBorder:e.colorPrimaryBorder,colorTextLightSolid:e.colorTextLightSolid}}function e5r(){let e=e5n();return{"--vm-primary":e.colorPrimary,"--vm-primary-hover":e.colorPrimaryHover,"--vm-primary-active":e.colorPrimaryActive,"--vm-primary-bg":e.colorPrimaryBg,"--vm-primary-bg-hover":e.colorPrimaryBgHover,"--vm-primary-border":e.colorPrimaryBorder,"--vm-primary-foreground":e.colorTextLightSolid,"--vm-customer-page-bg":`linear-gradient(rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.96)), ${e.colorPrimary}`,"--vm-customer-soft-bg":`linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)), ${e.colorPrimary}`}}let e5o=0,e5s={cartItems:{renderProductLineItemStatus:function(e){return e66(e).length>0?(0,eH.jsx)(e5a,{}):null}}};function e5d(e){var t;let{flowMode:l="socks",context:i,sales:a,fulfillment:n,blockNavigation:r,scanSource:o,scanEnabled:s=!0,isActive:d=!0,isVisible:c=!0,idleRequest:u=0,homeIdleTimeoutMs:p=3e4,onHomePageActiveChange:m,onLocaleChange:g,brand:h,subtitle:v,machine:f,onRequestSettings:y,onRequestStaff:b,onPrerenderComplete:x,className:k,style:_}=e,w="retail"===l,{text:S}=eTp(),j=e5r(),N=(0,nY.useToast)(),C=(0,eC.useRef)(null),M=o3(()=>{var e;null==(e=C.current)||e.close(),C.current=null}),[T,I]=eT.Modal.useModal(),{setIdlePaused:P,shouldDispenseAfterSale:A,startDispenseQueue:D,isCurrentContext:E}=n,[O,z]=(0,eC.useState)("idle"),[L,R]=(0,eC.useState)({ready:!1,failed:!1}),[$,F]=(0,eC.useState)(!1),[q,B]=(0,eC.useState)(!1),[H,V]=(0,eC.useState)(!1),[U,Y]=(0,eC.useState)(null),W=(0,eC.useRef)(null),K=(0,eC.useCallback)(e=>{R(t=>t.ready===e.ready&&t.failed===e.failed?t:e)},[]),G=(0,eC.useMemo)(()=>({active:d&&c&&("idle"===O||"home"===O||"redeem"===O),onStateChange:K}),[d,c,O,K]),[Q,Z]=(0,eC.useState)("purchase"),[J,X]=(0,eC.useState)(!1),[ee,et]=(0,eC.useState)(!1),el=(0,eC.useRef)(!1),[ei,ea]=(0,eC.useState)(!1),en=(0,eC.useRef)(!1),[er,eo]=(0,eC.useState)(!1),es=(0,eC.useRef)(!1),[ed,ec]=(0,eC.useState)(!1),eu=(0,eC.useRef)(!1),ep=(0,eC.useCallback)(e=>{eu.current=e,ec(e)},[]),em=(0,eC.useCallback)(e=>{es.current=e,eo(e)},[]),eg=(0,eC.useCallback)(e=>{en.current=e,ea(e)},[]),eh=(0,eC.useCallback)(()=>{Z("purchase"),X(!1),eg(!1),em(!1)},[eg,em]),ev=o3(()=>{d&&c&&s&&!ee&&E(i)&&(!w||q)&&(B(!1),Z("purchase"),z("sale"))}),ef=o3(()=>{if(!d||!c||!s||ee||!a.ready||!L.ready||W.current||ey.getIsBusy())return;if(!a.inventory)return void ev();let e=new AbortController;W.current=e,F(!0),V(!1),a.inventory.refresh({reason:"catalog-entry",signal:e.signal}).then(()=>{!e.signal.aborted&&E(i)&&ev()}).catch(t=>{e.signal.aborted||(null==t?void 0:t.name)==="AbortError"||V(!0)}).finally(()=>{W.current===e&&(W.current=null,F(!1))})}),ey=function(e){let{context:t,scanSource:l,scanEnabled:i=!0,isActive:a,isVisible:n,fulfillment:r,stage:o,obscured:s,isObscured:d,onResolved:c}=e,[u,p]=(0,eC.useState)(null),[m,g]=(0,eC.useState)(""),h=(0,eC.useRef)(null),v=(0,eC.useRef)(!1),f=JSON.stringify([t.tenantDomain,t.shopId,t.deviceId,t.businessCode]),y=!!(a&&n),b=(0,eC.useRef)({scope:f,active:y});b.current={scope:f,active:y},(0,eC.useEffect)(()=>(v.current=!0,()=>{v.current=!1,h.current=null}),[]);let x=o3((e,t,i)=>{try{var a;null==l||null==(a=l.log)||a.call(l,e,{requestId:t.id,sourcePage:t.sourcePage,scope:t.scope,elapsedMs:Date.now()-t.receivedAt,status:null==i?void 0:i.status,kind:null==i?void 0:i.kind,reason:null==i?void 0:i.reason})}catch{}}),k=o3(e=>{h.current=e,p(e)}),_=o3(()=>{h.current&&x("cancelled",h.current),k(null),g("")});(0,eC.useLayoutEffect)(()=>{(!y||h.current&&h.current.scope!==f)&&_()},[y,f,_]);let w=o3(e=>{if(!y||!i||d()||!r.isCurrentContext(t))return;let l="string"==typeof(null==e?void 0:e.data)?e.data.trim():"";if(!l||h.current||"idle"!==o&&"home"!==o&&"redeem"!==o)return;let a={id:`vending-scan-${Date.now()}-${++e5o}`,code:l,sourcePage:o,scope:f,receivedAt:Date.now(),phase:"waiting"};k(a),"redeem"===o&&g(l),x("received",a),r.setIdlePaused(!0)}),S=y&&i&&!s&&("idle"===o||"home"===o||"redeem"===o||"sale"===o&&!!u),j=!!u;(0,eC.useEffect)(()=>{if(S&&l)return l.subscribe(w,{priority:10*!!j})},[S,l,j,w]);let N=e=>{let l=h.current;return v.current&&b.current.active&&(null==l?void 0:l.id)===e&&l.scope===b.current.scope&&r.isCurrentContext(t)?l:null},C=o3(e=>{let t=N(e);t&&"waiting"===t.phase&&(k({...t,phase:"processing"}),x("accepted",t))}),M=o3((e,t)=>{var l;let i=N(e);if(!i)return;let a="success"===t.status&&["customer","promotion"].includes(t.kind||"")&&!Array.isArray(null==(l=t.redemption)?void 0:l.vouchers)?{status:"failed",reason:"entry_resolution_failed"}:t;x("settled",i,a),c(a),k(null)}),T=o3(()=>!!h.current);return{pending:u,scannedCode:m,setScannedCode:g,submitCode:o3(e=>w({data:e})),busy:!!u,getIsBusy:T,clear:_,accepted:C,settled:M}}({context:i,scanSource:o,scanEnabled:s&&!w,isActive:d,isVisible:c,fulfillment:n,stage:O,obscured:ee||$,isObscured:()=>el.current||!!W.current,onResolved:o3(e=>{M();let t=function(e){var t,l,i;if("cancelled"===e.status)return{destination:"stay",vouchers:[]};if(["initialization_failed","order_reset_failed","entry_resolution_failed","scan_failed"].includes(e.reason||""))return{destination:"stay",vouchers:[],notice:"scanResolveFailed"};let a=(null==(t=e.redemption)?void 0:t.vouchers)||[],n="success"===e.status?e63([],a):[];if(n.length)return{destination:"redeem",vouchers:n};if("success"===e.status&&((null==(l=e.redemption)?void 0:l.source)==="wallet"||"products"===e.kind)||"pending"===e.status&&["requiresDetail","requiresBookingEdit"].includes(e.kind||""))return{destination:"purchase",vouchers:[]};let r=a.filter(e=>"good_pass"===(e.tag||e.type)),o=r.map(e=>e.reasonCode);return{destination:"stay",vouchers:[],notice:o.length&&o.every(e=>"not_started"===e)?"scanVoucherNotStarted":o.length&&o.every(e=>"expired"===e)?"scanVoucherExpired":r.length?"scanVoucherUnavailable":(null==(i=e.redemption)?void 0:i.source)==="scan"?"scanNoVouchers":"scanUnrecognized"}}(e);if("redeem"===t.destination)Z("vouchers"),z("sale");else if("purchase"===t.destination)Z("purchase"),z("sale");else if(t.notice){let e=Symbol();Y(e),N.show({icon:"warning",content:S(t.notice),afterClose:()=>Y(t=>t===e?null:t)})}})}),eb=a.ready&&L.ready&&!$&&!H,ex=a.failed||L.failed||H,ek=w&&d&&c&&s&&!ee&&"idle"===O,e_=o3(()=>{R({ready:!1,failed:!1}),V(!1),a.retry()}),ew=o3(()=>{ek&&(!q||ex)&&(ex&&e_(),B(!0))});(0,eC.useLayoutEffect)(()=>{var e;w&&!ek&&(B(!1),null==(e=W.current)||e.abort(),W.current=null,F(!1))},[w,ek]),(0,eC.useEffect)(()=>{ek&&q&&eb&&ef()},[ek,q,eb,ef]);let eS=d&&c&&ey.busy,ej=d&&c&&("home"===O||w&&"idle"===O&&q)&&s&&!ee&&!eb&&!ex&&!U,eN=eS?S("scanProcessing"):ej?S("homePreparing"):null,eM=o3(()=>{eN&&(!eS||ey.getIsBusy())&&(eS&&Y(null),C.current=N.loading(eN,0))});(0,eC.useEffect)(()=>{if(eN)return eM(),M},[eN,eM,M]);let eI=o3(e=>{if(!d||!c||"sale"!==O||"vouchers"!==Q||!J||ey.pending||!E(i))return;let t=e.scannedDiscountList||[];if(!(e.isAccepted??e.isAvailable)||!e63([],t).length){let e=t.some(e=>"good_pass"===(e.tag||e.type));N.fail(S(e?"collectInvalid":"collectUnsupported"))}}),eP=(0,eC.useRef)(null),eA=o3(e=>{let t={...e,isActive:e.isActive&&"sale"===O};return"vouchers"===Q?(0,eH.jsx)(e5e,{...t,brand:h,autoSelectionRef:eP,onActiveChange:X,onBusyChange:eg,onPurchase:()=>{ey.getIsBusy()||en.current||es.current||Z("purchase")}}):(0,eH.jsx)(e5l,{...t,brand:h,onBusyChange:em})});(0,eC.useEffect)(()=>{var e;a.failed&&(null==(e=ey.pending)?void 0:e.phase)==="waiting"&&ey.settled(ey.pending.id,{status:"failed",reason:"initialization_failed"})},[a.failed,ey.pending,ey.settled]);let[eD,eE]=(0,eC.useState)(null),[eO,ez]=(0,eC.useState)(null),[eL,eR]=(0,eC.useState)(!1),[e$,eF]=(0,eC.useState)(10),eq=(0,eC.useRef)(!0),eB=(0,eC.useRef)(d);eB.current=d&&c;let eV=(0,eC.useRef)([]),eU=(0,eC.useRef)(null),eY=(0,eC.useRef)(null),eW=(0,eC.useCallback)(()=>{var e,t;null==(e=eY.current)||e.call(eY),eY.current=null,null==(t=eU.current)||t.cancel(),eU.current=null},[]),eK=(0,eC.useCallback)(e=>{var t,l;ey.getIsBusy()||en.current||es.current||eu.current||(ey.clear(),eh(),B(!1),null==(t=W.current)||t.abort(),W.current=null,F(!1),eE(null),ez(null),eR(!1),z(e),eV.current=[],null==(l=eY.current)||l.call(eY),eY.current=null,P(!1))},[P,ey.clear,ey.getIsBusy,eh]),eG=(0,eC.useCallback)(()=>eK("idle"),[eK]),eQ=(0,eC.useCallback)(()=>eK(w?"idle":"home"),[w,eK]),eZ=(0,eC.useRef)(u);(0,eC.useEffect)(()=>{eZ.current!==u&&(eZ.current=u,eG())},[u,eG]),(0,eC.useEffect)(()=>(eq.current=!0,()=>{eq.current=!1,eW(),P(!1)}),[P,eW]),(0,eC.useEffect)(()=>{d||(ey.clear(),eh(),eW(),eG())},[d,eG,eW,ey.clear,eh]),(0,eC.useEffect)(()=>{c||"sale"!==O||"vouchers"!==Q||(ey.clear(),eh(),eG())},[c,O,Q,ey.clear,eh,eG]);let eJ=JSON.stringify([i.tenantDomain,i.shopId,i.deviceId,i.businessCode]);(0,eC.useEffect)(()=>()=>{var e;null==(e=W.current)||e.abort(),W.current=null,F(!1)},[d,c,eJ,O]),(0,eC.useEffect)(()=>{a.ready||(R({ready:!1,failed:!1}),V(!1))},[a.ready]);let eX=(0,eC.useRef)(eJ);(0,eC.useEffect)(()=>{eX.current!==eJ&&(eX.current=eJ,ey.clear(),eh(),"sale"===O&&eG())},[eJ,O,ey.clear,eh,eG]);let e0=(0,eC.useRef)(!1);(0,eC.useEffect)(()=>{e0.current||(e0.current=!0,null==x||x())},[x]);let e2=(0,eC.useCallback)(e=>{let t=(0,no.cloneDeep)(e),l={snapshot:t,isRedemption:"vouchers"===Q},a={...i,businessCode:e.businessCode||i.businessCode},n=()=>eq.current&&eB.current&&E(i);return(async()=>{if(!n())return!0;try{var e;if(!await A(a))return!1;if(!n()||(eE(l),ez(null),eR(!1),z("dispense"),await P(!0),!n()))return!0;let i=D(t,a);eU.current=i;let r=!1,o=e=>{n()&&(ez(e),"running"===e.status||r||(r=!0,eF(10),z("result")))};null==(e=eY.current)||e.call(eY),eY.current=i.subscribe(o),o(i.getSnapshot())}catch{n()&&(eE(l),eR(!0),z("result"))}return!0})()},[Q,i,E,P,A,D]),e1="dispense"===O||"result"===O,e4=e1||ey.busy||ei||er||ed||!w&&$,e3=e4||$||w&&q&&!ex;(0,eC.useEffect)(()=>{if(P(d&&c&&e3),d&&c&&e4)return null==r?void 0:r(()=>!1)},[r,d,c,e4,e3,P]);let e8="result"===O&&!eL&&(null==eO?void 0:eO.status)==="complete"&&eO.items.length>0&&eO.items.every(e=>"success"===e.status);(0,eC.useEffect)(()=>{if(!e8||!d||!c)return;let e=window.setInterval(()=>eF(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[e8,d,c]),(0,eC.useEffect)(()=>{e8&&0===e$&&eG()},[e8,e$,eG]);let e6="idle"===O||"home"===O,e5=d&&c&&e6;(0,eC.useLayoutEffect)(()=>(null==m||m(e5),()=>null==m?void 0:m(!1)),[e5,m]);let e7=e5&&"home"===O&&s&&!ey.busy&&!ee&&!$;(0,eC.useEffect)(()=>{let e;if(!e7)return;let t=Number.isFinite(p)&&p>0?p:3e4,l=()=>{window.clearTimeout(e),e=window.setTimeout(eG,t)},i=["pointerdown","pointermove","touchstart","touchmove","keydown","wheel","click"];return i.forEach(e=>document.addEventListener(e,l,{capture:!0,passive:!0})),l(),()=>{window.clearTimeout(e),i.forEach(e=>document.removeEventListener(e,l,!0))}},[e7,p,eG]);let e9=(null==(t=ey.pending)?void 0:t.phase)==="processing",te="sale"===O||!!ey.pending,tt="sale"===O&&!a.ready,tl=a.failed;return(0,eH.jsxs)("main",{className:["vm-app",k].filter(Boolean).join(" "),style:{...j,..._},children:[I,e6&&(0,eH.jsx)(eTv,{children:"idle"===O?(0,eH.jsx)(eTk,{enableResponsiveScaling:!0,technicalSupportBarProps:{enableResponsiveScaling:!0},brand:h,subtitle:v,flowMode:l,active:d&&c,busy:w&&q&&!ex,failed:w&&ex,onStart:w?ew:()=>{ey.getIsBusy()||z("home")},onRetry:w?ew:void 0,onRequestSettings:()=>{ey.getIsBusy()||y()}}):(0,eH.jsx)(eT_,{brand:h,machine:f,locale:i.locale,languageDisabled:!s||ey.busy||ee||$,onLocaleChange:g?e=>{d&&c&&s&&!ey.getIsBusy()&&!ee&&!$&&g(e)}:void 0,active:d&&c,ready:eb,failed:ex,onBuy:()=>{ey.getIsBusy()||ef()},onRedeem:()=>{ey.getIsBusy()||z("redeem")},onRetry:e_,onHelp:()=>{ey.getIsBusy()||(el.current=!0,et(!0),T.info({title:S("help"),content:S("contact"),okText:S("done"),className:"vm-dialog",wrapClassName:"vm-dialog-wrap",centered:!0,afterClose:()=>{el.current=!1,et(!1)}}))},onRequestSettings:()=>{ey.getIsBusy()||y()},onStaffTap:()=>{if(ey.getIsBusy())return;let e=Date.now();eV.current=[...eV.current.filter(t=>e-t<3e3),e],eV.current.length>=5&&(eV.current=[],b())}})}),"redeem"===O&&(0,eH.jsx)(eTv,{children:(0,eH.jsx)(e6U,{brand:h,active:d&&c&&s&&!ee,busy:ey.busy,scannedCode:ey.scannedCode,onCodeChange:ey.setScannedCode,onFindSale:ey.submitCode,onBack:eQ})}),tt&&(0,eH.jsx)(eTv,{children:(0,eH.jsxs)("section",{className:`vm-scan-start${d&&c?"":" vm-customer-paused"}`,children:[(0,eH.jsx)("header",{className:"vm-customer-home-header",children:(0,eH.jsx)(eTy,{name:h,compact:!0})}),(0,eH.jsx)("div",{className:"vm-scan-start-content",children:(0,eH.jsxs)("div",{className:"vm-scan-start-card",role:"status","aria-live":"polite","aria-atomic":"true",children:[(0,eH.jsx)("div",{className:"vm-scan-start-symbol","aria-hidden":"true",children:(0,eH.jsx)(eTh,{name:tl?"circle-alert":"loader-circle"})}),(0,eH.jsx)("h1",{children:S(tl?"scanPrepareFailed":"scanPreparing")}),(0,eH.jsx)("p",{children:S(tl?"scanPrepareFailedHint":"scanPreparingHint")})]})}),(0,eH.jsxs)("footer",{className:"vm-scan-start-actions",children:[(0,eH.jsxs)("button",{type:"button",className:"vm-scan-start-button",disabled:e9,onClick:()=>{ey.clear(),z(w?"idle":"home")},children:[(0,eH.jsx)(eTh,{name:"arrow-left"}),S("back")]}),tl&&(0,eH.jsx)("button",{type:"button",className:"vm-scan-start-button vm-scan-start-retry",onClick:()=>{a.retry()},children:S("retry")})]})]})}),a.ready&&(0,eH.jsx)("div",{className:"vm-sales",hidden:"sale"!==O||tt,children:(0,eH.jsx)(e6q,{mode:"retail",template:"kiosk",lifecycleOwner:"provider",destroyOnUnmount:!1,selectionFlowScene:"product-selection",saleDetailTemplate:"A",saleDetailModuleConfig:e5s,autoCreate:!1,enableGlobalScanListener:"sale"===O&&s&&!ee,scanRequest:s&&!ee&&ey.pending||void 0,onScanRequestAccepted:ey.accepted,onScanRequestSettled:ey.settled,onScanPromotionResult:eI,scanScope:w?"all":ey.pending?"product-voucher-collection":"vouchers"===Q&&J?"product-voucher":"all",renderCatalog:w?void 0:eA,catalogPreparation:G,onPaymentPageActiveChange:ep,mergeBookingLinesForDisplay:!1,style:{height:"100%",minHeight:0},businessCode:i.businessCode,osModuleName:a.osModuleName,otherParams:a.otherParams,inventory:a.inventory,catalogScope:a.catalogScope,checkoutHooks:a.checkoutHooks,locale:i.locale,isActive:d&&c&&te,enableTempOrderPersist:!1,onPaidCheckout:e2,onRequestHome:e=>{"catalog-back"===e?eQ():eG()}})}),e1&&(0,eH.jsx)(eTv,{children:(0,eH.jsx)(eTN,{enableResponsiveScaling:!0,brand:h,sale:(null==eD?void 0:eD.snapshot)??null,isRedemption:(null==eD?void 0:eD.isRedemption)??!1,progress:eO,error:eL,stage:O,seconds:e$,onHome:eG})})]})}function e5c(e){let{context:t,onLocaleChange:l}=e,[i,a]=(0,eC.useState)(t.locale||"en");(0,eC.useEffect)(()=>{a(t.locale||"en")},[t.locale,t.tenantDomain,t.businessCode,t.shopId,t.deviceId]);let n=(0,eC.useMemo)(()=>({...t,locale:i}),[t,i]),r=(0,eC.useCallback)(e=>{e!==i&&(null==l||l(e),a(e))},[i,l]);return(0,eH.jsx)(d_,{value:i,children:(0,eH.jsx)(eTf.Provider,{value:e.brandLogo,children:(0,eH.jsx)(e5d,{...e,context:n,onLocaleChange:r},JSON.stringify([t.tenantDomain,t.businessCode,t.shopId,t.deviceId,e.flowMode||"socks"]))})})}function e5u(e){let{brand:t,machine:l,staff:i,onSignOut:a}=e,{text:n}=eTp();return(0,eH.jsxs)("header",{className:"vm-topbar vm-topbar-staff",children:[(0,eH.jsxs)("div",{children:[(0,eH.jsxs)("strong",{children:[(0,eH.jsx)(Ea,{}),l]}),(0,eH.jsx)("small",{children:t})]}),i&&(0,eH.jsxs)("button",{className:"vm-staff-badge",onClick:a,"aria-label":n("signOut"),children:[(0,eH.jsx)("span",{children:i.name.slice(0,2)}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("strong",{children:i.name}),(0,eH.jsx)("small",{children:n("signOut")})]})]})]})}function e5p(e){let{changes:t,products:l,channelLabel:i}=e,{text:a,localized:n}=eTp(),r=(0,eC.useMemo)(()=>new Map(l.map(e=>[e.id,e])),[l]),o=(0,eC.useMemo)(()=>{let e=new Map;for(let l of t){let t=void 0===l.before.spaceId?`channel:${l.channelId}`:`space:${l.before.spaceId}`,i=e.get(t)||[];i.push(l),e.set(t,i)}let l=[];for(let[t,i]of e){let{before:e,after:a}=i[0],n=i.map(e=>e.before);e.productId===a.productId?e.productId&&l.push({key:t,channels:n,productId:e.productId,before:e.quantity,after:a.quantity}):(e.productId&&l.push({key:`${t}:out`,channels:n,productId:e.productId,binding:"removed",before:e.quantity,after:0}),a.productId&&l.push({key:`${t}:in`,channels:n,productId:a.productId,binding:"added",before:0,after:a.quantity}))}return l},[t]),s=(0,eC.useMemo)(()=>{let e=new Map;for(let t of o){let l=e.get(t.productId)||{productId:t.productId,added:0,removed:0},i=t.after-t.before;l.added+=Math.max(0,i),l.removed+=Math.max(0,-i),e.set(t.productId,l)}return[...e.values()]},[o]),d=s.reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),c=e=>{var t,l,i;return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("strong",{children:n(null==(t=r.get(e))?void 0:t.title)||(null==(l=r.get(e))?void 0:l.sku)||e}),(0,eH.jsx)("span",{className:"vm-review-sku",children:(null==(i=r.get(e))?void 0:i.sku)||"—"})]})};return(0,eH.jsxs)("div",{className:"vm-restock-review",children:[(0,eH.jsx)("p",{children:a("reviewDescription")}),(0,eH.jsx)("div",{className:"vm-review-table-scroll",children:(0,eH.jsxs)("table",{className:"vm-review-table",children:[(0,eH.jsx)("caption",{children:a("reviewDetails")}),(0,eH.jsx)("thead",{children:(0,eH.jsxs)("tr",{children:[(0,eH.jsx)("th",{children:a("channel")}),(0,eH.jsx)("th",{children:a("product")}),(0,eH.jsx)("th",{children:a("reviewBefore")}),(0,eH.jsx)("th",{children:a("quantityAfter")}),(0,eH.jsx)("th",{children:a("reviewDelta")})]})}),(0,eH.jsx)("tbody",{children:o.map(e=>{let t=e.after-e.before;return(0,eH.jsxs)("tr",{children:[(0,eH.jsx)("td",{children:e.channels.map(e=>(0,eH.jsx)("div",{children:i(e)},e.id))}),(0,eH.jsxs)("td",{children:[c(e.productId),e.binding&&(0,eH.jsx)("span",{className:"vm-review-binding",children:a("removed"===e.binding?"reviewProductRemoved":"reviewProductAdded")})]}),(0,eH.jsx)("td",{children:e.before}),(0,eH.jsx)("td",{children:e.after}),(0,eH.jsxs)("td",{className:t>0?"vm-review-added":t<0?"vm-review-removed":"",children:[t>0?"+":"",t]})]},e.key)})})]})}),(0,eH.jsx)("div",{className:"vm-review-table-scroll",children:(0,eH.jsxs)("table",{className:"vm-review-table vm-review-summary",children:[(0,eH.jsx)("caption",{children:a("reviewSummary")}),(0,eH.jsx)("thead",{children:(0,eH.jsxs)("tr",{children:[(0,eH.jsx)("th",{children:a("product")}),(0,eH.jsx)("th",{children:a("reviewAdded")}),(0,eH.jsx)("th",{children:a("reviewRemoved")})]})}),(0,eH.jsx)("tbody",{children:s.map(e=>(0,eH.jsxs)("tr",{children:[(0,eH.jsx)("td",{children:c(e.productId)}),(0,eH.jsxs)("td",{className:"vm-review-added",children:["+",e.added]}),(0,eH.jsxs)("td",{className:"vm-review-removed",children:["−",e.removed]})]},e.productId))})]})}),(0,eH.jsx)("p",{className:"vm-review-totals",children:a("reviewTotals",d)})]})}let e5m=e=>({productId:e.productId,quantity:null===e.quantity?"":String(e.quantity)}),e5g=(e,t)=>t.productId!==e.productId||(null===e.quantity?""!==t.quantity:""===t.quantity.trim()||Number(t.quantity)!==e.quantity),e5h=e=>"enabled"===e.status&&!e.issue&&null!==e.quantity,e5v=(e,t)=>e5h(e)&&""!==t.quantity.trim()&&Number.isSafeInteger(Number(t.quantity))&&Number(t.quantity)>=0&&Number(t.quantity)<=e.capacity&&(null!==t.productId||0===Number(t.quantity));function e5f(e){let{context:t,staff:l,onBack:i,setLeaveGuard:a,service:n,blockNavigation:r}=e,{text:o,localized:s}=eTp(),[d,c]=eT.Modal.useModal(),[u,p]=(0,eC.useState)(null),[m,g]=(0,eC.useState)({}),[h,v]=(0,eC.useState)(!0),[f,y]=(0,eC.useState)(!1),[b,x]=(0,eC.useState)(""),[k,_]=(0,eC.useState)(!1),[w,S]=(0,eC.useState)(""),[j,N]=(0,eC.useState)(),[C,M]=(0,eC.useState)(!1),[T,I]=(0,eC.useState)(null),P=(0,eC.useRef)(null),[A,D]=(0,eC.useState)(null),[E,O]=(0,eC.useState)({}),z=(0,eC.useRef)(null),L=(0,eC.useRef)(null),R=(0,eC.useRef)(!1),$=(0,eC.useRef)(!0),F=(0,eC.useRef)(t);F.current=t;let q=(0,eC.useRef)(!1),B=(0,eC.useRef)(null),H=C||null!==T||null!==A,V=(0,eC.useCallback)(async()=>{var e,t;null==(e=L.current)||e.abort(),null==(t=z.current)||t.abort(),z.current=null,D(null),O({}),P.current=null,I(null);let l=new AbortController;L.current=l,v(!0),y(!1),x("");try{let e=await n.load(F.current,l.signal);if(l.signal.aborted)return;p(e),N(e.inventorySync),g({}),_(!1),S("")}catch(e){l.signal.aborted||(y(!0),x(e instanceof Error?e.message:""))}finally{l.signal.aborted||v(!1)}},[t.tenantDomain,t.businessCode,t.shopId,t.deviceId,n]);(0,eC.useEffect)(()=>($.current=!0,V(),()=>{var e,t;$.current=!1,null==(e=L.current)||e.abort(),null==(t=z.current)||t.abort(),P.current=null}),[V]);let U=e=>m[e.id]||e5m(e),Y=((null==u?void 0:u.channels)||[]).filter(e=>e5g(e,U(e)));q.current=Y.length>0;let W=Y.some(e=>!e5v(e,U(e))),K=(0,eC.useMemo)(()=>new Map(null==u?void 0:u.products.map(e=>[e.id,e])),[null==u?void 0:u.products]),G=(0,eC.useMemo)(()=>[{value:"",label:o("noProduct"),disabled:!1},...((null==u?void 0:u.products)||[]).map(e=>({value:e.id,label:s(e.title)||e.sku||e.id,disabled:!!e.disabled}))],[null==u?void 0:u.products,s,o]),Q=(null==u?void 0:u.groupType)==="board"?"board":"row",Z=e=>s(e.groupName)||e.row,J=e=>`${o(Q)} ${Z(e)} \xb7 ${o("editChannel",{code:e.code})}`,X=function(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:U(e);return e5h(e)&&!!l.productId&&K.has(l.productId)&&!(null==(t=K.get(l.productId))?void 0:t.disabled)},ee=(0,eC.useCallback)(()=>{let e;if(R.current||P.current||z.current)return Promise.resolve(!1);if(!q.current)return Promise.resolve(!0);if(B.current)return B.current.promise;let t=new Promise(t=>{e=t}),l=d.confirm({title:o("discardTitle"),content:o("discardDescription"),okText:o("discard"),cancelText:o("keepEditing"),className:"vm-dialog",wrapClassName:"vm-dialog-wrap",centered:!0,onOk:()=>{B.current=null,e(!0)},onCancel:()=>{B.current=null,e(!1)}});return B.current={promise:t,close:()=>{l.destroy(),e(!1)}},t},[d,o]);(0,eC.useEffect)(()=>{a(ee);let e=e=>{(q.current||R.current||z.current)&&(e.preventDefault(),e.returnValue="")};window.addEventListener("beforeunload",e);let t=null==r?void 0:r(()=>!R.current&&!P.current&&!z.current&&(q.current?o("discardDescription"):void 0));return()=>{var l;a(null),null==t||t(),window.removeEventListener("beforeunload",e),null==(l=B.current)||l.close(),B.current=null}},[r,ee,a,o]);let et=(e,t)=>{!R.current&&!P.current&&!z.current&&e5h(e)&&(_(!1),g(l=>{let i={...l};for(let a of(null==u?void 0:u.channels)||[])e5h(a)&&(a.id===e.id||void 0!==e.spaceId&&a.spaceId===e.spaceId)&&(i[a.id]={...l[a.id]||e5m(a),...t});return i}))},el=async()=>{var e;let i=P.current;if(!u||!1===u.canSubmit||R.current||z.current||!(null==i?void 0:i.length))return;R.current=!0,M(!0),_(!1),S(""),null==(e=L.current)||e.abort();let a=new AbortController;L.current=a;try{let e=await n.submit(t,i,l,a.signal);if(a.signal.aborted)return;let r=!e||"accepted"===e.status||"synced"===e.status;if(e&&"accepted"===e.status)p(e.data),N(e.data.inventorySync);else{let t=new Map(i.map(e=>[e.channelId,e.after])),l=new Set(i.map(e=>e.before.spaceId).filter(e=>void 0!==e));p({...u,channels:u.channels.map(i=>r?t.get(i.id)||i:t.has(i.id)||void 0!==i.spaceId&&l.has(i.spaceId)?{...i,status:"blocked",issue:e&&"review"===e.status?"stockSyncReview":"stockSyncPending"}:i)}),N(e||void 0)}g({}),q.current=!1,r&&(0,nY.PisellToast)({content:o("saved")})}catch(e){a.signal.aborted||(_(!0),S(e instanceof Error?e.message:""))}finally{R.current=!1,P.current=null,$.current&&(M(!1),I(null))}},ei=async e=>{if(!n.testChannel||h||f||R.current||P.current||z.current)return;let l=new AbortController;z.current=l,D(e.id),O(t=>{let l={...t};return delete l[e.id],l});try{let i=await n.testChannel(t,{...e},l.signal);!l.signal.aborted&&$.current&&O(t=>({...t,[e.id]:i}))}catch(t){!l.signal.aborted&&$.current&&O(l=>({...l,[e.id]:{success:!1,uncertain:!0,message:t instanceof Error?t.message:o("channelTestUnknown")}}))}finally{z.current===l&&(z.current=null,$.current&&D(null))}},ea=(0,eC.useMemo)(()=>{let e=new Map;return null==u||u.channels.forEach(t=>e.set(t.row,[...e.get(t.row)||[],t])),Array.from(e.entries())},[null==u?void 0:u.channels]);return(0,eH.jsxs)("section",{className:"vm-restock vm-page",children:[c,(0,eH.jsx)(eT.Modal,{open:null!==T,title:o("reviewTitle"),className:"vm-dialog vm-restock-review-dialog",wrapClassName:"vm-dialog-wrap",width:760,centered:!0,maskClosable:!1,closable:!C,keyboard:!C,confirmLoading:C,cancelButtonProps:{disabled:C},okText:o("reviewConfirm"),cancelText:o("keepEditing"),onCancel:()=>{R.current||(P.current=null,I(null))},onOk:()=>void el(),children:T&&u&&(0,eH.jsx)(e5p,{changes:T,products:u.products,channelLabel:J})}),(0,eH.jsxs)("header",{className:"vm-page-heading",children:[i&&(0,eH.jsx)("button",{className:"vm-icon-button","aria-label":o("back"),disabled:H,onClick:async()=>{await ee()&&i()},children:(0,eH.jsx)(pa,{})}),(0,eH.jsxs)("div",{className:"vm-restock-title",children:[(0,eH.jsx)("h1",{children:o("configure")}),(0,eH.jsx)("p",{children:o("configureDescription")}),n.testChannel&&(0,eH.jsx)("span",{className:"vm-caption",children:o("channelTestHint")})]}),(0,eH.jsx)("button",{className:"vm-button vm-button-outline vm-fill-all",disabled:h||f||H||!(null==u?void 0:u.channels.some(e=>X(e))),onClick:()=>{!u||h||f||R.current||P.current||z.current||(_(!1),g(e=>{let t={...e};for(let l of u.channels){let i=e[l.id]||e5m(l);X(l,i)&&(t[l.id]={...i,quantity:String(l.capacity)})}return t}))},children:o("fillAll")})]}),!h&&!f&&(null==u?void 0:u.canSubmit)===!1&&(0,eH.jsx)(eT.Alert,{className:"vm-restock-notice",type:"info",showIcon:!0,message:o("restockDraftOnly")}),(j&&"synced"!==j.status||k)&&(0,eH.jsx)(eT.Alert,{className:"vm-restock-notice",type:k?"error":(null==j?void 0:j.status)==="review"?"warning":"info",showIcon:!0,message:k?w||o("saveError"):(null==j?void 0:j.message)||o("stockSyncPending"),action:(0,eH.jsx)("button",{className:"vm-button vm-button-outline",disabled:h||H,onClick:async()=>{await ee()&&V()},children:o("stockRefresh")})}),(0,eH.jsx)("div",{className:"vm-restock-scroll","aria-busy":h||C,children:h?(0,eH.jsxs)("div",{className:"vm-state",children:[(0,eH.jsx)(eT.Spin,{}),(0,eH.jsx)("span",{children:o("loading")})]}):f?(0,eH.jsxs)("div",{className:"vm-state",role:"alert",children:[(0,eH.jsx)("p",{children:b||o("loadError")}),(0,eH.jsx)("button",{className:"vm-button",onClick:()=>void V(),children:o("retry")})]}):(null==u?void 0:u.channels.length)?(0,eH.jsxs)("div",{className:"vm-inline-list",children:[(0,eH.jsxs)("div",{className:"vm-list-labels",children:[(0,eH.jsx)("span",{children:o("channel")}),(0,eH.jsx)("span",{children:o("productStock")}),(0,eH.jsx)("span",{children:o("quantityAfter")}),(0,eH.jsx)("span",{children:o("action")})]}),ea.map(e=>{let[t,l]=e;return(0,eH.jsxs)("div",{className:"vm-channel-group",children:[ea.length>1&&(0,eH.jsxs)("div",{className:"vm-channel-group-heading",children:[o(Q)," ",Z(l[0])]}),(0,eH.jsx)("div",{className:"vm-group-items",children:l.map(e=>{let t,l,i,a,r,s,d,c,p=K.get(e.productId||""),m="enabled"!==e.status?e.status:0===e.quantity?"empty":null!==e.quantity&&e.quantity<=e.lowThreshold?"low":null;return(0,eH.jsxs)("div",{className:`vm-channel-line ${m?`vm-status-${m}`:""} ${e5g(e,U(e))?"vm-is-changed":""}`,children:[(0,eH.jsxs)("strong",{className:"vm-channel-code",children:[(0,eH.jsx)("span",{className:"vm-restock-field-label",children:o("channel")}),e.code]}),(0,eH.jsxs)("div",{className:"vm-channel-product",children:[(0,eH.jsx)("span",{className:"vm-restock-field-label",children:o("productStock")}),(t=U(e),(0,eH.jsx)("div",{className:"vm-product-picker",children:(0,eH.jsx)(eT.Select,{className:"vm-product-select",bordered:!1,showSearch:!1,virtual:!0,options:G,placeholder:e.issue?o(e.issue):o("noProduct"),"aria-label":`${J(e)} ${o("product")}`,disabled:H||!e5h(e),value:t.productId||void 0,onChange:t=>et(e,{productId:t||null,quantity:"0"})})})),(0,eH.jsxs)("span",{className:"vm-caption",children:[(0,eH.jsx)("span",{className:"vm-sku",children:(null==p?void 0:p.sku)||"—"})," ","\xb7 ",o("current")," ",e.quantity??"—","enabled"!==e.status&&(0,eH.jsxs)(eH.Fragment,{children:[" \xb7 ",o(e.status)]})]}),e.issue&&(0,eH.jsx)("span",{className:"vm-field-error",children:o(e.issue)})]}),(i=Number((l=U(e)).quantity)||0,a=H||!X(e,l),r=e5h(e)&&!e5v(e,l),(0,eH.jsxs)("div",{className:"vm-quantity-editor",children:[(0,eH.jsx)("span",{className:"vm-restock-field-label",children:o("quantityAfter")}),(0,eH.jsxs)("div",{className:"vm-stepper",children:[(0,eH.jsx)("button",{className:"vm-icon-button","aria-label":`${J(e)} −1`,disabled:a||i<=0,onClick:()=>et(e,{quantity:String(Math.max(0,Math.min(e.capacity,Math.trunc(i)-1)))}),children:(0,eH.jsx)(NI,{})}),(0,eH.jsx)("input",{inputMode:"numeric",type:"number",step:1,min:0,max:e.capacity,"aria-label":`${J(e)} ${o("quantity")}`,"aria-invalid":r,disabled:a,placeholder:"—",value:l.quantity,onChange:t=>et(e,{quantity:t.target.value})}),(0,eH.jsx)("button",{className:"vm-icon-button","aria-label":`${J(e)} +1`,disabled:a||i>=e.capacity,onClick:()=>et(e,{quantity:String(Math.min(e.capacity,Math.max(0,Math.trunc(i)+1)))}),children:(0,eH.jsx)(db,{})})]}),(0,eH.jsx)("span",{className:"vm-caption",children:o("capacity",{capacity:e.capacity})}),r&&(0,eH.jsx)("span",{className:"vm-field-error",role:"alert",children:o("invalidQuantity")})]})),(s=E[e.id],d=A===e.id,c="string"==typeof e.machineId&&!!e.machineId&&Number.isSafeInteger(e.boardDeviceId)&&e.boardDeviceId>0&&Number.isInteger(e.laneId)&&e.laneId>=1&&e.laneId<=100,(0,eH.jsxs)("div",{className:"vm-row-actions",children:[(0,eH.jsx)("span",{className:"vm-restock-field-label",children:o("action")}),(0,eH.jsxs)("div",{className:"vm-row-action-buttons",children:[(0,eH.jsx)("button",{className:"vm-button vm-button-outline",disabled:H||!X(e),onClick:()=>et(e,{quantity:String(e.capacity)}),children:o("fill")}),(0,eH.jsx)("button",{className:"vm-button vm-button-outline",title:o("reset"),"aria-label":`${J(e)} ${o("reset")}`,disabled:H||!e5g(e,U(e)),onClick:()=>{!R.current&&!P.current&&!z.current&&(g(t=>{let l={...t};for(let t of(null==u?void 0:u.channels)||[])(t.id===e.id||void 0!==e.spaceId&&t.spaceId===e.spaceId)&&delete l[t.id];return l}),_(!1))},children:o("reset")}),(0,eH.jsx)("button",{className:"vm-button vm-button-outline vm-channel-test",title:o("channelTestHint"),"aria-label":`${J(e)} ${o("channelTest")}`,"aria-busy":d,disabled:H||!n.testChannel||!c,onClick:()=>void ei(e),children:o(d?"channelTesting":"channelTest")})]}),!d&&s&&(0,eH.jsxs)("span",{className:`vm-channel-test-result ${s.success?"vm-test-success":s.uncertain?"vm-test-unknown":"vm-test-failed"}`,role:"status",children:[o(s.success?"channelTestSuccess":s.uncertain?"channelTestUnknown":"channelTestFailed"),!s.success&&s.message&&(0,eH.jsx)("span",{className:"vm-caption",children:s.message})]})]}))]},e.id)})})]},t)})]}):(0,eH.jsx)("div",{className:"vm-state",children:o("noChannels")})}),(0,eH.jsxs)("footer",{className:"vm-submit-bar",children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("span",{className:"vm-caption",children:o("pending")}),(0,eH.jsxs)("strong",{children:[Y.length," ",o("channels")]})]}),(0,eH.jsxs)("button",{className:"vm-button vm-button-primary",disabled:H||h||f||(null==u?void 0:u.canSubmit)===!1||!Y.length||W,onClick:()=>{if(!u||!1===u.canSubmit||h||f||R.current||P.current||z.current||!Y.length||W)return;let e=Y.map(e=>{var t;let l=U(e),i=Number(l.quantity),a=l.productId===e.productId;return{channelId:e.id,before:{...e},after:{...e,productId:l.productId,inventoryItemId:null==(t=K.get(l.productId||""))?void 0:t.inventoryItemId,stockId:a?e.stockId:void 0,submissionId:void 0,quantity:i,availableQuantity:a?null==e.availableQuantity||null===e.quantity?e.availableQuantity:e.availableQuantity+i-e.quantity:i}}}),t=new Map;for(let l of e){let e=K.get(l.after.productId||"");if(l.after.productId&&(!e||e.disabled))return void(0,nY.PisellToast)({content:o("restockStockInvalid"),type:"error"});if(void 0===l.before.spaceId)continue;let i=t.get(l.before.spaceId);if(i&&(i.after.productId!==l.after.productId||i.after.quantity!==l.after.quantity))return void(0,nY.PisellToast)({content:o("restockChanged"),type:"error"});t.set(l.before.spaceId,l)}P.current=e,I(e)},children:[C?(0,eH.jsx)(eT.Spin,{size:"small"}):(0,eH.jsx)(gR,{}),o(C?"saving":"reviewTitle")]})]})]})}function e5y(e){let{context:t,brand:l,machine:i,staff:a=null,onBack:n,onSignOut:r,service:o,blockNavigation:s,className:d,style:c}=e,u=e5r(),p=(0,eC.useRef)(null),m=(0,eC.useRef)(!0),g=(0,eC.useCallback)(e=>{p.current=e},[]);(0,eC.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let h=async()=>{(!p.current||await p.current())&&m.current&&(null==r||r())};return(0,eH.jsxs)("main",{className:["vm-app vm-staff-mode",d].filter(Boolean).join(" "),style:{...u,...c},children:[(0,eH.jsx)(e5u,{brand:l,machine:i,staff:a,onSignOut:()=>void h()}),(0,eH.jsx)(e5f,{context:t,staff:a,onBack:n,setLeaveGuard:g,service:o,blockNavigation:s})]})}function e5b(e){let{context:t}=e;return(0,eH.jsx)(d_,{value:t.locale,children:(0,eH.jsx)(e5y,{...e},JSON.stringify([t.tenantDomain,t.businessCode,t.shopId,t.deviceId]))})}function e5x(e){let{context:t,staff:l,service:i,onConfigure:a,onResume:n}=e,{text:r}=eTp(),[o,s]=(0,eC.useState)(null),[d,c]=(0,eC.useState)(!1),[u,p]=(0,eC.useState)(0);(0,eC.useEffect)(()=>{let e=new AbortController;return c(!1),s(null),i.load(t,e.signal).then(t=>{e.signal.aborted||s(t)}).catch(()=>{e.signal.aborted||c(!0)}),()=>e.abort()},[t.businessCode,t.tenantDomain,t.shopId,t.deviceId,i,u]);let m=(null==o?void 0:o.channels)||[],g=[...new Map(m.filter(e=>"enabled"===e.status&&e.productId).map(e=>[void 0===e.spaceId?`channel:${e.id}`:`space:${e.spaceId}`,e])).values()],h=[{label:"sellable",value:g.some(e=>null===e.availableQuantity||null===e.quantity)?null:g.reduce((e,t)=>e+(t.availableQuantity??t.quantity??0),0)},{label:"low",value:m.filter(e=>"enabled"===e.status&&null!==e.quantity&&e.quantity>0&&e.quantity<=e.lowThreshold).length},{label:"empty",value:m.filter(e=>"enabled"===e.status&&0===e.quantity).length},{label:"unavailable",value:m.filter(e=>"enabled"!==e.status).length}];return(0,eH.jsxs)("section",{className:"vm-staff-home vm-page",children:[(0,eH.jsx)("header",{className:"vm-page-heading",children:(0,eH.jsxs)("div",{children:[(0,eH.jsx)("p",{children:r("welcomeStaff",{name:l.name})}),(0,eH.jsx)("h1",{children:r("staffHome")})]})}),(0,eH.jsxs)("div",{className:"vm-staff-content",children:[d?(0,eH.jsx)(eT.Alert,{type:"warning",message:r("loadError"),action:(0,eH.jsx)("button",{className:"vm-text-button",onClick:()=>p(e=>e+1),children:r("retry")})}):(0,eH.jsx)("div",{className:"vm-stats",children:h.map(e=>(0,eH.jsxs)("div",{className:`vm-stat vm-stat-${e.label}`,children:[(0,eH.jsx)("span",{children:r(e.label)}),(0,eH.jsx)("strong",{children:o?e.value??"—":"—"})]},e.label))}),(0,eH.jsxs)("button",{className:"vm-service-card",onClick:a,children:[(0,eH.jsx)(Pg,{}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("h2",{children:r("configure")}),(0,eH.jsx)("p",{children:r("configureCard")})]}),(0,eH.jsx)(pr,{})]}),(0,eH.jsxs)("button",{className:"vm-button vm-button-outline vm-resume",onClick:n,children:[r("resume"),(0,eH.jsx)(pr,{})]})]})]})}function e5k(e){let{context:t,brand:l,machine:i,staff:a,service:n,onConfigure:r,onSignOut:o}=e,s=e5r();return(0,eH.jsx)(d_,{value:t.locale,children:(0,eH.jsxs)("main",{className:"vm-app vm-staff-mode",style:s,children:[(0,eH.jsx)(e5u,{brand:l,machine:i,staff:a,onSignOut:o}),(0,eH.jsx)(e5x,{context:t,staff:a,service:n,onConfigure:r,onResume:o})]})})}function e5_(e){let{bindings:t,children:l,isActive:i=!0}=e,a=i&&!1!==t.isActive&&!1!==t.isVisible,[n,r]=(0,eC.useState)(!1),[o,s]=(0,eC.useState)(!0),[d,c]=(0,eC.useState)(0),[u,p]=(0,eC.useState)({ready:!1,failed:!1,generation:-1}),[m,g]=(0,eC.useState)(!1),[h,v]=(0,eC.useState)(!1),f=(0,eC.useRef)(!0),y=(0,eC.useRef)(a),b=(0,eC.useRef)(!1),x=e5r(),k=!t.sales.inventory||!t.sales.catalogScope||!t.sales.checkoutHooks||t.sales.failed||m||u.generation===d&&u.failed,_=t.sales.ready&&u.generation===d&&u.ready&&!k,w=(0,eC.useCallback)(e=>{e&&!f.current&&c(e=>e+1),f.current=e,s(e)},[]),S=(0,eC.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r(!1),g(e)},[]),j=o3(()=>{a&&!1!==t.scanEnabled&&(!n||k)&&(k&&(g(!1),c(e=>e+1),t.sales.retry()),r(!0))});(0,eC.useEffect)(()=>{a&&!1!==t.scanEnabled||S(),a&&!y.current&&o&&c(e=>e+1),y.current=a},[a,o,t.scanEnabled,S]);let N=(0,eC.useRef)(t.idleRequest);(0,eC.useEffect)(()=>{N.current!==t.idleRequest&&S(),N.current=t.idleRequest},[t.idleRequest,S]),(0,eC.useEffect)(()=>{var e;return null==(e=t.subscribeIdle)?void 0:e.call(t,()=>S())},[t.subscribeIdle,S]),(0,eC.useEffect)(()=>{if(!b.current){var e;b.current=!0,null==(e=t.onPrerenderComplete)||e.call(t)}},[t.onPrerenderComplete]);let C=t.fulfillment.setIdlePaused;(0,eC.useEffect)(()=>{C(a&&(h||o&&n&&!k))},[a,h,o,n,k,C]),(0,eC.useEffect)(()=>()=>{C(!1)},[C]),(0,eC.useEffect)(()=>{var e;if(a&&h)return null==(e=t.blockNavigation)?void 0:e.call(t,()=>!1)},[a,h,t.blockNavigation]);let M=(0,eC.useMemo)(()=>({active:a&&o,onStateChange:e=>{p(t=>t.generation===d&&t.ready===e.ready&&t.failed===e.failed?t:{...e,generation:d})}}),[a,o,d]);return(0,eH.jsx)(d_,{value:t.context.locale,children:(0,eH.jsx)(eTf.Provider,{value:t.brandLogo,children:(0,eH.jsx)(eTQ.Provider,{value:{bindings:t,active:a,requested:n,ready:_,failed:k,requestStart:j,settleStart:S,setEntry:w},children:(0,eH.jsx)("main",{className:["vm-app vm-self-service",t.className].filter(Boolean).join(" "),style:{...x,...t.style},children:t.sales.ready?l({catalogPreparation:M,productCatalogSessionKey:`vending-entry-${d}`,onPaymentPageActiveChange:v}):(0,eH.jsx)(eTJ,{})})})})})}let e5w=new Set(["venue_booking","venue_ticket","ticket"]);function e5S(e){let{kioskAppId:t=eT2,kioskAppBindings:l,businessCode:i,mode:a=e5w.has(i??"")?"ticket":"retail",autoCreate:n=!1,mergeBookingLinesForDisplay:r=!1,enableGlobalScanListener:o=!0,normalProductDetailConfig:s,otherParams:d,...c}=e,u=(0,eC.useMemo)(()=>({enableBusinessAvailability:!0,enforceSingleBookingStartDate:!0,...d,platform:String((null==d?void 0:d.platform)??"").trim().toLowerCase()||"kiosk"}),[d]),p=(0,eC.useMemo)(()=>({...s,resolveAppearance:(null==s?void 0:s.resolveAppearance)??((null==s?void 0:s.appearance)?void 0:eMA)}),[s]),m=e=>{var s;return(0,eC.createElement)(e6q,{...c,...e,key:JSON.stringify([c.osModuleName,c.osKey,i,a,t]),template:"SelfServiceKiosk",kioskAppId:t,kioskAppBindings:l,businessCode:i,mode:a,autoCreate:n,otherParams:u,normalProductDetailConfig:p,mergeBookingLinesForDisplay:r,enableGlobalScanListener:!!o&&("vendingMachine"!==t||(null==l||null==(s=l.vendingMachine)?void 0:s.scanEnabled)!==!1)&&"scoped"})};if("vendingMachine"===t){let e=null==l?void 0:l.vendingMachine;if(!e)throw Error("vendingMachine requires instance bindings");let t=JSON.stringify([e.context.tenantDomain,e.context.shopId,e.context.deviceId,e.context.businessCode,e.sales.osModuleName]);return(0,eH.jsx)(e5_,{bindings:e,isActive:c.isActive,children:t=>m({...t,productCatalogSessionKey:`${c.productCatalogSessionKey??""}:${t.productCatalogSessionKey}`,isActive:!1!==c.isActive&&!1!==e.isActive&&!1!==e.isVisible,onPaidCheckout:void 0})},t)}return m()}function e5j(e,t,l){let i=Object.entries(e).reduce((e,t)=>{let[l,i]=t;return"channel"===l&&""===String(i??"").trim()||("otherParams"===l&&i&&"object"==typeof i&&!Array.isArray(i)?e[l]={...e[l]||{},...i}:void 0!==i&&(e[l]=i)),e},{...t||{}}),a=[null==l?void 0:l.menuIds,e.menuIds,null==t?void 0:t.menuIds].map(exK).find(e=>e.length>0);return a?i.menuIds=a:delete i.menuIds,i}function e5N(){var e;if("u"<typeof window)return"100dvh";let t=function(){if("u"<typeof window||"u"<typeof document)return 1;let e=document.body.style.transform,t=e&&"none"!==e?e:window.getComputedStyle(document.body).transform;if(!t||"none"===t)return 1;let l=new DOMMatrixReadOnly(t);return Math.sqrt(l.c*l.c+l.d*l.d)||1}();if(.001>Math.abs(t-1))return"100%";let l=(null==(e=window.visualViewport)?void 0:e.height)||window.innerHeight;return`${l/t}px`}function e5C(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];for(let e of t){let t=String(e||"").trim();if(t)return t}return""}function e5M(e){var t,l,i,a,n,r,o;let[s,d]=(0,eC.useState)(e5N),c=e$(),u=eq(),p=(null==c||null==(l=c.appHelper)||null==(t=l.constants)?void 0:t.hostPageProps)||{},m=(null==c||null==(i=c.engine)?void 0:i.props)||{},g=e5C(p.channel,null==(a=p.otherParams)?void 0:a.channel),{className:h,mode:v="retail",style:f,businessCode:y,channel:b,otherParams:x,menuIds:k,productLoadParams:_,bootstrapSlot:w,variant:S,normalProductDetailConfig:j,osModuleName:N,...C}=e5j(e,{...p,...m,channel:e5C(g,m.channel),otherParams:{...p.otherParams||{},...m.otherParams||{},...g?{channel:g}:{}}},p),M=e5C(g,b,null==x?void 0:x.channel,null==c||null==(o=c.appHelper)||null==(r=o.utils)||null==(n=r.getData)?void 0:n.call(r,"channel"),"pos"),T=eWV(eWH(null==x?void 0:x.platform,u),S),I=(0,eC.useMemo)(()=>{if(!_&&!(null==k?void 0:k.length))return;let{menu_list_ids:e,...t}=_||{};return{...t,...(null==k?void 0:k.length)?{menu_list_ids:k}:{}}},[k,_]),P=(0,eC.useMemo)(()=>({...x||{},enforceSingleBookingStartDate:!0,...M?{channel:M}:{},enableBusinessAvailability:!!T.platform,...T.platform?{platform:T.platform}:{}}),[M,T.platform,x]),A="pos"===String(M||"").trim().toLowerCase(),D=(0,eC.useMemo)(()=>({...j,resolveAppearance:(null==j?void 0:j.resolveAppearance)??((null==j?void 0:j.appearance)?void 0:eMA),...A?{allowUnavailableBookingSelection:!0,allowNoResourceBookingSelection:!0}:{},presentationPlatform:T.productDetailPresentationPlatform,hideQuantityForBookingProducts:null==j?void 0:j.hideQuantityForBookingProducts}),[A,T.productDetailPresentationPlatform,j]);return(0,eC.useEffect)(()=>{var e;let t=()=>{d(e5N())};t(),window.addEventListener("resize",t),null==(e=window.visualViewport)||e.addEventListener("resize",t);let l=new MutationObserver(t);return l.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),()=>{var e;window.removeEventListener("resize",t),null==(e=window.visualViewport)||e.removeEventListener("resize",t),l.disconnect()}},[]),(0,eH.jsx)(eU5.Provider,{value:eMP,children:(0,eH.jsx)(e6q,{...C,className:h,mode:v,businessCode:y,otherParams:P,lifecycleOwner:"provider",osModuleName:N,selectionFlowScene:"product-selection",enableGlobalScanListener:!0,normalProductDetailConfig:D,mergeBookingLinesForDisplay:T.mergeBookingLinesForDisplay,productLoadParams:I,enableMenuOverride:!!(null==k?void 0:k.length),autoCreate:!1,bootstrapSlot:w,saleDetailTemplate:"A",style:{minHeight:s,height:s,...f},template:"kiosk",variant:T.variant})})}function e5T(e){var t,l,i,a,n,r,o,s;let{kind:d,...c}=e,u=e$(),p=eq(),m=(null==u||null==(l=u.appHelper)||null==(t=l.constants)?void 0:t.hostPageProps)||{},g=e5j(c,{...m,...(null==u||null==(i=u.engine)?void 0:i.props)||{},otherParams:{...m.otherParams||{},...(null==u||null==(n=u.engine)||null==(a=n.props)?void 0:a.otherParams)||{}}},m),{otherParams:h,channel:v,businessCode:f,variant:y,...b}=g,x=(null==h?void 0:h.platform)||p,k="kiosk"===String(x||"").trim().toLowerCase(),_=f||(null==h?void 0:h.businessCode)||"venue_booking",w=v||(null==h?void 0:h.channel)||(k?"kiosk":"online_ordering"),S=String((null==u||null==(s=u.appHelper)||null==(o=s.utils)||null==(r=o.getData)?void 0:r.call(o,"timezone"))||(null==h?void 0:h.businessTimezone)||""),j=(0,eC.useMemo)(()=>({...h,businessCode:_,channel:w,platform:x,venueBookingMode:d,...k?{enableSessionStoragePersist:!1}:{},businessTimezone:S,type:"appointment_booking",enableBusinessAvailability:!0,enforceSingleBookingStartDate:!0,enablePickupTiming:!1}),[_,w,h,x,S,d,k]);return(0,eH.jsx)(e6q,{...b,osKey:g.osKey||`venue-booking-${d}`,template:"tickets"===d?"venue-ticket-booking":"venue-party-booking",mode:"retail",businessCode:_,otherParams:j,variant:"kiosk"===String(j.platform).trim().toLowerCase()?"phone":y||("h5"===j.platform?"phone":"desktop"),lifecycleOwner:"provider",orderId:void 0,autoBootstrap:!1,autoRestoreOnInit:!1,autoCreate:!1,autoInitBookingContext:!1,enableGlobalScanListener:!1,enableTempOrderSync:k,enableMenuOverride:!1,productLoadParams:void 0,autoReloadProductCatalogOnCustomerChange:!1,mergeBookingLinesForDisplay:!1})}function e5I(e){return(0,eH.jsx)(e5T,{...e,kind:"tickets"})}function e5P(e){return(0,eH.jsx)(e5T,{...e,kind:"party"})}function e5A(e){let{payload:t}=e,l=exe(),i=l.bookingTicket,a=l.clearCartAndReset,n="picoding"===l.salesSettingsSource&&!l.salesSettings,r=(0,eC.useRef)(Promise.resolve());return(0,eC.useEffect)(()=>{if(!i||n)return;let e=!1;return r.current=r.current.then(async()=>{if(!e){if(t.tempOrder){if(!i.replaceTempOrder)return void console.warn("[SharedSecondaryBigSale] 当前销售实例不支持 replaceTempOrder");await i.replaceTempOrder(t.tempOrder)}else await a();!e&&t.walletAssetsSnapshot&&i.importWalletAssetsSnapshot&&await i.importWalletAssetsSnapshot(t.walletAssetsSnapshot)}}).catch(e=>{console.warn("[SharedSecondaryBigSale] 应用副屏订单快照失败",e)}),()=>{e=!0}},[i,a,t,n]),null}let e5D=0;function e5E(e){var t,l,i;let{osKey:a="shared-secondary-big-sale",saleDetailModuleConfig:n,secondaryScreenDisplay:r,className:o,style:s}=e,d=function(){var e,t,l,i,a;let n=e$(),r=null==n||null==(l=n.appHelper)||null==(t=l.utils)||null==(e=t.getApp)?void 0:e.call(t),o=null==r||null==(i=r.getPlugin)?void 0:i.call(r,"unifiedCommunication"),{runtime:s}=(null==o||null==(a=o.useRuntime)?void 0:a.call(o))||{},d=(null==s?void 0:s.role)==="secondary-screen",c=(0,eC.useRef)(0),[u,p]=(0,eC.useState)(null);return(0,eC.useEffect)(()=>{var e,t,l,i;if(!d)return;let a=!1,n=null==o||null==(t=o.sdk)||null==(e=t.onMessage)?void 0:e.call(t,e=>{var t;let l=eN0(e);!a&&l&&"secondary-screen"!==l.sourceRole&&(t=c.current,!0===l.isActive&&l.timestamp>t&&(c.current=l.timestamp,p(l)))});return Promise.resolve(null==o||null==(i=o.sdk)||null==(l=i.publishData)?void 0:l.call(i,{target:{type:"main"},data:{type:eNG,requestId:`shared-secondary-${Date.now()}-${Math.random().toString(16).slice(2)}`,timestamp:Date.now()},meta:{}})).catch(e=>{console.warn("[SharedSecondaryBigSale] 请求主屏订单快照失败",e)}),()=>{if(a=!0,n&&"function"==typeof n.then)n.then(e=>{var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}).catch(()=>{});else{var e;null==n||null==(e=n.remove)||e.call(n)}}},[d,o]),u}(),c=e$(),u=d?eNX(d):void 0,p=null==u?void 0:u.businessCode,m=null==c||null==(i=c.appHelper)||null==(l=i.utils)||null==(t=l.getData)?void 0:t.call(l,"channel"),g=(null==u?void 0:u.channel)||("string"==typeof m&&m.trim()?m.trim():"cds"),h=(0,eC.useMemo)(()=>++e5D,[a,p,g]),v=(0,eC.useMemo)(()=>({channel:g}),[g]);return d&&p?(0,eH.jsx)(e6q,{osKey:`${a}-${encodeURIComponent(g)}-${h}`,businessCode:p,otherParams:v,mode:"ticket",template:"secondaryScreen",saleDetailTemplate:"A",autoCreate:!1,autoRestoreOnInit:!1,autoInitBookingContext:!1,enableTempOrderSync:!1,secondaryScreenDisplay:r,saleDetailModuleConfig:n,className:o,style:s,bootstrapSlot:(0,eH.jsx)(e5A,{payload:d})},h):(0,eH.jsx)("div",{className:o,style:s,"aria-busy":"true"})}let e5O=eM().memo(e6F);async function e5z(e){var t,l,i,a,n,r,o;let s=(null==(l=e.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.tempOrder??null,d=(null==(a=e.salesDetail)||null==(i=a.header)?void 0:i.order_id)??(null==(n=e.salesDetail)?void 0:n.order_id),c=eM6(null==s?void 0:s.order_id)||!!d,u=(null==s||null==(r=s.products)?void 0:r.length)??0,p=(null==s||null==(o=s.bookings)?void 0:o.length)??0;c?await e.restore():((u>0||p>0)&&"function"==typeof e.clearCartItemsOnly&&await e.clearCartItemsOnly(),await e.createNew())}function e5L(e){var t,l;let{open:i,contentActive:a,openNonce:n=0,orderId:r,preloadedSalesDetail:o,createSeed:s,bookingTimeRangeFromCalendar:d,bookingConfigParams:c,onCreateSeedReady:u,onCreateSeedError:p,onEditReady:m}=e,g=exe(),h=eND(),v=eM().useContext(eCY),f=eM().useContext(eCW),y=(0,eC.useRef)(!1),b=(0,eC.useRef)(0),x=(0,eC.useRef)(0),k=(0,eC.useRef)(g);k.current=g;let _=(0,eC.useRef)(h);_.current=h;let w=(0,eC.useRef)(s);w.current=s;let S=(0,eC.useRef)(d);S.current=d;let j=(0,eC.useRef)(o);j.current=o;let N=(0,eC.useRef)(c);N.current=c;let C=(0,eC.useRef)(v);C.current=v;let M=(0,eC.useRef)(f);M.current=f;let T=(0,eC.useRef)(u);T.current=u;let I=(0,eC.useRef)(p);I.current=p;let P=(0,eC.useRef)(m);P.current=m;let A=(0,eC.useRef)(a),D=(0,eC.useRef)(null),E=`${!s?"":`${(null==(t=s.row)?void 0:t.id)??""}-${(null==(l=s.reservationRuleProduct)?void 0:l.id)??""}`}:${(null==d?void 0:d.startAt)||""}:${(null==d?void 0:d.endAt)||""}`,O=!!g.bookingTicket;return(0,eC.useEffect)(()=>{let e=A.current;if(A.current=a,!e||a||!k.current.bookingTicket)return;let t=k.current.restore().then(()=>void 0).catch(e=>{console.warn("[BigSaleDialog] close cleanup failed",e)});D.current=t,t.finally(()=>{D.current===t&&(D.current=null)})},[a,O]),(0,eC.useEffect)(()=>{if(!i){y.current=!1,b.current+=1,x.current+=1;return}y.current=!1,b.current+=1,x.current+=1},[i,n,E]),(0,eC.useEffect)(()=>{var e;if(!i||!r||s)return;let t=k.current;if(!t.bookingTicket)return;let l=x.current;return null==(e=M.current)||e.call(M,r),(async()=>{var e,i,a,n,o,s,d;try{if(await D.current,l!==x.current)return;let d=function(e,t){if(!e||"object"!=typeof e)return;let l=e.order_id;if(null!=l&&String(l)===String(t)&&Array.isArray(e.products)&&Array.isArray(e.bookings))return e}(j.current,r);if(await t.loadDetail(d?{orderId:r,preloadedSalesDetail:d}:r),l!==x.current)return;let c=(null==(i=t.bookingTicket)||null==(e=i.getTempOrder)?void 0:e.call(i))??t.tempOrder,u=exV(c??null);if(await (null==(n=t.bookingTicket)||null==(a=n.initBookingContext)?void 0:a.call(n,exY(N.current,{date:eS()(),bookingIds:u.length?u:void 0,loadResources:!0}))),l!==x.current||(null==(o=C.current)||o.call(C),await _.current.recalcSummary(),l!==x.current))return;null==(s=P.current)||s.call(P)}catch(e){if(l!==x.current)return;null==(d=I.current)||d.call(I,e)}})(),()=>{l===x.current&&(x.current+=1)}},[i,n,r,E,O]),(0,eC.useEffect)(()=>{let e=w.current;if(!i||r)return;let t=k.current;if(!t.bookingTicket||"loading"===t.status||y.current)return;let l=b.current;return(async()=>{var t,i,a,n,r,o,s,d,c,u;try{if(await D.current,l!==b.current||(await e5z(k.current),l!==b.current)||(e&&await eWC({bookingTicket:k.current.bookingTicket,reservationRuleProduct:e.reservationRuleProduct,row:e.row,appointmentStatus:e.appointmentStatus??"started",bookingConfig:(null==(d=k.current.bookingTicket)||null==(s=d.getBookingConfig)?void 0:s.call(d))??null,tempOrder:k.current.tempOrder,date:(null==(c=S.current)?void 0:c.startAt.slice(0,10))||eS()().format("YYYY-MM-DD"),bookingTimeRangeFromCalendar:S.current,assertCurrent:()=>{if(l!==b.current)throw Error("The booking selection has closed.")}}),l!==b.current))return;let u=(null==(i=k.current.bookingTicket)||null==(t=i.getTempOrder)?void 0:t.call(i))??k.current.tempOrder,p=exV(u??null);if(await (null==(n=k.current.bookingTicket)||null==(a=n.initBookingContext)?void 0:a.call(n,exY(N.current,{date:eS()(),bookingIds:p.length?p:void 0,loadResources:!1}))),l!==b.current||(null==(r=C.current)||r.call(C),await _.current.recalcSummary(),l!==b.current))return;y.current=!0,null==(o=T.current)||o.call(T)}catch(e){if(l!==b.current)return;y.current=!1,null==(u=I.current)||u.call(I,e)}})(),()=>{l===b.current&&(b.current+=1)}},[i,n,r,E,O]),null}function e5R(e){let{onClose:t,fallbackTitle:l,variant:i}=e,a=exe(),n=(0,eC.useMemo)(()=>{var e,t,i,n;let r=a.tempOrder,o=(null==r?void 0:r.shop_full_order_number)||(null==r?void 0:r.shop_order_number)||((null==r?void 0:r.order_number)?String(r.order_number):"");if(o)return String(o);let s=(null==(t=a.salesDetail)||null==(e=t.header)?void 0:e.shop_full_order_number)||(null==(n=a.salesDetail)||null==(i=n.header)?void 0:i.shop_order_number);return s?String(s):l||""},[a.tempOrder,a.salesDetail,l]);return n?(0,eH.jsxs)("div",{className:aT()("big-sale-dialog-header-bar",{"big-sale-dialog-header-bar--phone":"phone"===i}),children:[(0,eH.jsx)("div",{className:"big-sale-dialog-header-bar__content",children:(0,eH.jsx)("div",{className:"big-sale-dialog-header-bar__order-id",title:n,children:n})}),(0,eH.jsx)("button",{type:"button",className:"big-sale-dialog-header-bar__close","aria-label":"Close",onClick:t,children:(0,eH.jsx)(nY.Iconfont,{type:"pisell2-x-close"})})]}):null}function e5$(e){let{open:t,contentActive:l,openNonce:i,orderId:a,preloadedSalesDetail:n,createSeed:r,bookingTimeRangeFromCalendar:o,bookingConfigParams:s,onCreateSeedReady:d,onEditReady:c}=e;return(0,eH.jsx)(e5L,{open:t,contentActive:l,openNonce:i,orderId:a,preloadedSalesDetail:n,createSeed:r,bookingTimeRangeFromCalendar:o,bookingConfigParams:s,onCreateSeedReady:d,onEditReady:c})}function e5F(e){var t,l;let{open:i,contentActive:a=i,onVisualStateSettled:n,orderId:r,preloadedSalesDetail:o,resourceIdFromCalendar:s,bookingTimeRangeFromCalendar:d,createSeed:c,onClose:u,callback:p,rulesHooks:m,enableGlobalScanListener:g,title:h,preloaded:v,destroyOnUnmount:f,osKey:y="cached-dine-in-dialog",mode:b="retail",businessCode:x,bookingConfigParams:k,productDisplayConfig:_,productLoadParams:w,productCatalogReady:S=!0,orderType:j=r?void 0:"table-order",variant:N,openNonce:C=0}=e,M="phone"===N;eK(i);let T=!!r,I=T&&!M,P=(0,eC.useRef)(a);P.current=a;let A=(0,eC.useRef)(n);A.current=n;let D=String(x??"").trim()||("retail"===b?"dine_in":b),E=!(eM6(r)&&"dine_in"===D),O=h||(r?`#${r}`:"New Order"),z=(0,eC.useMemo)(()=>`${y}-${b}`,[y,b]),L=(0,eC.useCallback)(()=>{null==p||p({type:"close"}),null==u||u()},[p,u]),R=(0,eC.useCallback)(e=>{!1!==e.reset&&(null==p||p({type:e.type,data:e.data,order_id:e.order_id,reset:!0}),null==u||u())},[p,u]),$=(0,eC.useRef)(j);(!v||a)&&($.current=j);let F=v&&!a?$.current:j,q=(0,eC.useMemo)(()=>F?{type:F}:void 0,[F]),B=!!v||i,H=(0,eC.useMemo)(()=>a?(0,eH.jsx)(e5R,{onClose:L,fallbackTitle:O,variant:N}):null,[a,L,O,N]),[V,U]=(0,eC.useState)(0);(0,eC.useEffect)(()=>{a||U(0)},[a]),(0,eC.useEffect)(()=>{T||U(0)},[C,null==c||null==(t=c.row)?void 0:t.id,T]);let Y=(0,eC.useCallback)(()=>{U(e=>e+1)},[]);(0,eC.useLayoutEffect)(()=>{if(!i||"u"<typeof window)return;let e=0,t=0;return e=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{null==n||n(!0,a)})}),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(t)}},[a,n,i]);let W=(0,eC.useCallback)(e=>{if(!e){var t;null==(t=A.current)||t.call(A,!1,P.current)}},[]),K=(0,eC.useMemo)(()=>{var e;let t=(null==o?void 0:o.customer_id)??(null==o||null==(e=o.customer)?void 0:e.id)??"anonymous",l=(null==o?void 0:o.schedule_date)??(null==o?void 0:o.booking_date)??(null==o?void 0:o.start_time)??"",i=(null==o?void 0:o.updated_at)??"",a=Array.isArray(null==w?void 0:w.menu_list_ids)?w.menu_list_ids.join(","):"";return[String(r??"new"),String(t),String(l),String(x??""),a,String(i)].join("|")},[x,r,o,w]),G=S?T?1:V:0,Q=T?`edit-${K}-p${G}`:`create-${C}-${(null==c||null==(l=c.row)?void 0:l.id)??"new"}-p${G}`,Z=i&&a,J=(0,eC.useMemo)(()=>(0,eH.jsx)(e5$,{open:Z,contentActive:a,openNonce:C,orderId:r,preloadedSalesDetail:o,createSeed:c,bookingTimeRangeFromCalendar:i&&!T?d:void 0,bookingConfigParams:k,onCreateSeedReady:Y}),[Z,a,C,r,o,c,d,i,T,k,Y]);return(0,eH.jsx)(oU,{renderType:M?"drawer":"modal",showHandlerBar:!1,onHandlerBarClick:L,props:M?{open:i,onClose:L,afterOpenChange:W,skipEnterMotion:!0,placement:"bottom",title:void 0,width:"100%",height:"95%",className:"big-sale-dialog-drawer-phone",rootClassName:"big-sale-dialog-drawer-phone-root",destroyOnClose:!1,maskClosable:!1,footer:null,closable:!1,bodyStyle:{padding:0,height:"100%",position:"relative"}}:{open:i,onCancel:L,afterOpenChange:W,skipEnterMotion:!0,title:null,width:"100%",height:"100%",className:"big-sale-dialog-modal",destroyOnClose:!1,header:!1,maskClosable:!1,footer:null,closeIcon:null,wrapClassName:"big-sale-dialog-wrapper",size:"large",styles:{content:{borderRadius:0}},bodyStyle:{padding:0,height:"100%",position:"relative"}},children:(0,eH.jsx)("div",{"aria-hidden":!i,className:aT()("big-sale-dialog-content",{"big-sale-dialog-content--inactive":!a}),children:B?(0,eH.jsx)(e5O,{osKey:y,mode:b,destroyOnUnmount:f,selectionFlowScene:"product-selection",isActive:a,enableGlobalScanListener:g,autoCreate:!1,autoBootstrap:!1,autoRestoreOnInit:!1,autoInitBookingContext:!1,orderId:r,businessCode:x,bookingConfigParams:k,resourceIdFromCalendar:i&&!T?s:void 0,bookingTimeRangeFromCalendar:i&&!T?d:void 0,productDisplayConfig:_,productLoadParams:w,productCatalogSessionKey:Q,productCatalogReady:S,hideSelectFloorMapResourceAction:E,rulesHooks:m,otherParams:q,enableTempOrderPersist:!1,preserveProductCatalogOnInactiveCustomerClear:!0,className:"pisell-big-sale--dialog-host",bootstrapSlot:J,saleDetailHeaderSlot:H,rightActionBarClose:I?L:void 0,overlaySlot:null,onOrderComplete:R},z):null})})}e5F.displayName="BigSaleDialog";let e5q=oZ(e5F);function e5B(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let l=Object.keys(e),i=Object.keys(t);if(l.length!==i.length)return!1;for(let i of l)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}function e5H(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e5B,a=(0,eC.useRef)({value:void 0,initialized:!1}),n=(0,eC.useCallback)(()=>{let e=l(),t=a.current;return t.initialized?i(t.value,e)?t.value:(t.value=e,e):(t.value=e,t.initialized=!0,e)},[i]),r=t.join("|");return LQ((0,eC.useCallback)(l=>{if(!e)return()=>{};let i=t.map(t=>e.effectsOn(t,l));return()=>{for(let e of i)try{e()}catch{}}},[e,r]),n,n)}let e5V=e=>{var t;let{runtimeRef:l}=e,i=exe(),a=exr();return(0,eC.useEffect)(()=>{var e,t,n,r,o;let s=null==(r=i.bookingTicket)||null==(n=r.store)||null==(t=n.bookingContext)||null==(e=t.getState)?void 0:e.call(t),d=null==s?void 0:s.date,c=d&&eS()(d).isValid()?eS()(d).format("YYYY-MM-DD"):eS()().format("YYYY-MM-DD");l.current={customerId:null==(o=a.selected)?void 0:o.id,date:c}},[i.bookingTicket,null==(t=a.selected)?void 0:t.id,l]),null},e5U=e=>{var t,l;let{children:i,uiHosts:a,...n}=e,r=e$(),o=null==r||null==(l=r.appHelper)||null==(t=l.utils)?void 0:t.action,s=(0,eC.useRef)({date:void 0,customerId:void 0}),d=(0,eC.useMemo)(()=>o?{action:o,getRuntime:()=>s.current}:void 0,[o]);return(0,eH.jsxs)(eCG,{...n,legacyOpenProductDetail:d,uiHosts:a,children:[(0,eH.jsx)(e5V,{runtimeRef:s}),i]})},e5Y={schedule_date:S=eS()().format("YYYY-MM-DD"),menu_list_ids:[44858],schedule_datetime:eS()().format(`${S} HH:mm:ss`)},e5W={orderId:97807},e5K={loadProductsParams:{...e5Y},customerId:void 0,productPicker:{variantIndex:0,num:1}},e5G={orderId:e5W.orderId,loadProductsParams:{...e5Y},customerId:void 0,productPicker:{variantIndex:0,num:1},orderNote:"SalesSdk demo note",shopDiscount:5,contactsInfo:{name:"Demo Contact",phone:"13800000000"}};function e5Q(e,t){if(!t)return e;let l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return void 0!==t}));return{...e,...l,loadProductsParams:{...e.loadProductsParams,...t.loadProductsParams||{}},productPicker:{...e.productPicker,...t.productPicker||{}}}}function e5Z(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}let e5J=e=>{let{sales:t,cart:l,customer:i,summary:a,products:n}=e;return(0,eH.jsxs)("section",{className:"sales-sdk-demo__panel",children:[(0,eH.jsx)("h3",{children:"Raw Snapshot"}),(0,eH.jsxs)("div",{className:"sales-sdk-demo__raw-grid",children:[(0,eH.jsx)("pre",{children:e5Z({selectedCustomer:i.selected})}),(0,eH.jsx)("pre",{children:e5Z({tempOrder:t.tempOrder})}),(0,eH.jsx)("pre",{children:e5Z({bookings:l.bookings,items:l.items})}),(0,eH.jsx)("pre",{children:e5Z({products:n})}),(0,eH.jsx)("pre",{children:e5Z({summary:a})})]})]})},e5X=e=>{let{entries:t,title:l="Action Log"}=e;if(!t.length)return null;let i=t[t.length-1];return(0,eH.jsxs)("section",{className:`sales-sdk-demo__panel sales-sdk-demo__panel--${i.status}`,children:[(0,eH.jsx)("h3",{children:l}),(0,eH.jsx)("div",{className:"sales-sdk-demo__action-log",children:t.map((e,t)=>(0,eH.jsx)("pre",{className:`sales-sdk-demo__action-entry sales-sdk-demo__action-entry--${e.status}`,children:e.message},t))})]})};function e50(e){let t=e.trim();if(!t)return;let l=Number(t);return Number.isFinite(l)?l:void 0}function e52(e){let{label:t,value:l,placeholder:i,onChange:a}=e;return(0,eH.jsxs)("label",{className:"sales-sdk-demo__field",children:[(0,eH.jsx)("span",{children:t}),(0,eH.jsx)("input",{value:l,placeholder:i,onChange:e=>a(e.target.value)})]})}function e51(e){let{value:t,onChange:l}=e;return(0,eH.jsx)("div",{className:"sales-sdk-demo__advanced-form",children:(0,eH.jsx)(e52,{label:"orderId",value:null!=t.orderId?String(t.orderId):"",placeholder:"使用 fixture 默认值",onChange:e=>l({...t,orderId:e50(e)})})})}function e54(e){let{value:t,onChange:l}=e,i=t.loadProductsParams||{},a=t.productPicker||{},n=e=>{l({...t,loadProductsParams:{...i,...e}})},r=e=>{l({...t,productPicker:{...a,...e}})};return(0,eH.jsxs)("div",{className:"sales-sdk-demo__advanced-form",children:[(0,eH.jsx)(e52,{label:"loadProductsParams.schedule_date",value:i.schedule_date??"",placeholder:"YYYY-MM-DD",onChange:e=>n({schedule_date:e||void 0})}),(0,eH.jsx)(e52,{label:"loadProductsParams.schedule_datetime",value:i.schedule_datetime??"",placeholder:"YYYY-MM-DD HH:mm:ss",onChange:e=>n({schedule_datetime:e||void 0})}),(0,eH.jsx)(e52,{label:"loadProductsParams.menu_list_ids",value:Array.isArray(i.menu_list_ids)?i.menu_list_ids.join(","):"",placeholder:"逗号分隔,如 44858,44859",onChange:e=>n({menu_list_ids:function(e){let t=e.trim();if(t)return t.split(/[,\s]+/).map(e=>Number(e)).filter(e=>Number.isFinite(e))}(e)})}),(0,eH.jsx)(e52,{label:"customerId",value:null!=t.customerId?String(t.customerId):"",placeholder:"缺省 = customer.list[0]",onChange:e=>{let i=e50(e);l({...t,customerId:i})}}),(0,eH.jsx)(e52,{label:"productPicker.productId",value:null!=a.productId?String(a.productId):"",placeholder:"缺省 = products[0].id",onChange:e=>r({productId:e50(e)})}),(0,eH.jsx)(e52,{label:"productPicker.variantIndex",value:null!=a.variantIndex?String(a.variantIndex):"",placeholder:"缺省 0",onChange:e=>r({variantIndex:e50(e)})}),(0,eH.jsx)(e52,{label:"productPicker.num",value:null!=a.num?String(a.num):"",placeholder:"缺省 1",onChange:e=>r({num:e50(e)})})]})}function e53(e){let{value:t,onChange:l}=e,i=void 0===t.contactsInfo?"":null===t.contactsInfo?"null":JSON.stringify(t.contactsInfo);return(0,eH.jsxs)("div",{className:"sales-sdk-demo__advanced-form sales-sdk-demo__advanced-form--meta",children:[(0,eH.jsx)(e52,{label:"orderNote(sales.setOrderNote)",value:t.orderNote??"",placeholder:"留空 = 使用 fixture 默认;填 __skip__ 跳过步骤",onChange:e=>{let i=e.trim();if("__skip__"===i||!i){let{orderNote:e,...i}=t;l(i);return}l({...t,orderNote:i})}}),(0,eH.jsx)(e52,{label:"shopDiscount(sales.setShopDiscount)",value:null!=t.shopDiscount?String(t.shopDiscount):"",placeholder:"如 5 或 5.00;填 __skip__ 跳过步骤",onChange:e=>{let i=e.trim();if("__skip__"===i||!i){let{shopDiscount:e,...i}=t;l(i);return}let a=Number(i);l({...t,shopDiscount:Number.isFinite(a)?a:i})}}),(0,eH.jsxs)("label",{className:"sales-sdk-demo__field",children:[(0,eH.jsx)("span",{children:"contactsInfo(sales.setContactsInfo,JSON)"}),(0,eH.jsx)("textarea",{className:"sales-sdk-demo__textarea",value:i,placeholder:'如 {"name":"Demo"};填 __skip__ 跳过;填 null 清空',rows:3,onChange:e=>{let i=e.target.value.trim();if("__skip__"===i||""===i){let{contactsInfo:e,...i}=t;l(i);return}if("null"===i)return void l({...t,contactsInfo:null});try{let e=JSON.parse(i);if(null===e||"object"!=typeof e||Array.isArray(e))throw Error("contactsInfo 须为 JSON 对象或 null");l({...t,contactsInfo:e})}catch{}}})]})]})}function e58(e){let{value:t,onChange:l}=e;return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(e52,{label:"orderId",value:null!=t.orderId?String(t.orderId):"",placeholder:"使用 fixture 默认值",onChange:e=>l({...t,orderId:e50(e)})}),(0,eH.jsx)(e53,{value:t,onChange:l}),(0,eH.jsx)(e54,{value:t,onChange:l})]})}let e56=e=>(0,eH.jsx)("div",{className:"sales-sdk-demo__advanced",children:(0,eH.jsx)(eT.Collapse,{ghost:!0,items:[{key:"adv",label:"高级配置(覆盖 fixture)",children:"detail"===e.variant?(0,eH.jsx)(e51,{value:e.value,onChange:e.onChange}):"create"===e.variant?(0,eH.jsx)(e54,{value:e.value,onChange:e.onChange}):(0,eH.jsx)(e58,{value:e.value,onChange:e.onChange})}]})}),e55=e=>{let{initialOrderId:t}=e,l=exe(),i=exr(),a=eND(),n=eC2(),r=eC0(),o=(0,eC.useMemo)(()=>({...e5W,...t?{orderId:t}:{}}),[t]),[s,d]=(0,eC.useState)({}),c=(0,eC.useMemo)(()=>s?{...o,...s}:o,[o,s]),[u,p]=(0,eC.useState)([]),[m,g]=(0,eC.useState)(!1),[h,v]=(0,eC.useState)("confirmed"),[f,y]=(0,eC.useState)(!1);ew$(n.summary);let b=e=>{p(t=>[...t,e])},x=async()=>{if(!Number.isFinite(c.orderId)||c.orderId<=0)return void b({status:"error",message:"orderId 必须为正整数"});g(!0),b({status:"running",message:`loadDetail(${c.orderId}) running...`});try{let e=await l.loadDetail(c.orderId);b({status:"success",message:`loadDetail(${c.orderId}) success
56
+ `:"")}(b,e)+t+l},[b,v,C,o]),T=(0,eC.useMemo)(()=>({...eJW(y.primaryColor),...p?{"--booking-font-family":p}:{},...S?{"--booking-viewport-height":S}:{}}),[y.primaryColor,p,S]),I=(0,eC.useMemo)(()=>({lang:l,layout:f,presentationPlatform:o,currency:a,timeZone:n,progress:N,root:x,portal:_,background:m??x,money:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AUD",i=new Intl.NumberFormat("en"===t?"en-AU":"zh-CN",{style:"currency",currency:l,currencyDisplay:"narrowSymbol"}),a=i.resolvedOptions().maximumFractionDigits??2,n=i.format(e/10**a);return"AUD"===l?n.replace("$","A$"):n}(e,t,a)},brand:y,design:b,fontFamily:p,brandTokens:T,scopeId:v}),[l,f,o,a,n,N,_,x,m,y,b,T,v,p]),P=(0,eH.jsxs)(eJR.Provider,{value:I,children:[(0,eH.jsx)("style",{children:M}),(0,eH.jsx)("div",{ref:k,className:`booking-ui${"compact"===f?" booking-ui-compact":""} ${h}`.trim(),"data-booking-scope":v,"data-booking-presentation":o,lang:"zh"===l?"zh-CN":"en-AU",style:"kiosk"===o?{...T,height:"var(--booking-viewport-height)",minHeight:0,overflowY:"auto"}:T,children:(0,eH.jsx)(eJG,{config:y,children:t})}),"u">typeof document&&(0,oT.createPortal)((0,eH.jsx)("div",{ref:w,className:`booking-ui booking-ui-portals${"compact"===f?" booking-ui-compact":""}`,lang:"zh"===l?"zh-CN":"en-AU","data-booking-scope":v,"data-booking-presentation":o,style:T}),g??document.body)]});return"kiosk"===o?(0,eH.jsx)(eT.ConfigProvider,{theme:eXs,wave:eXd,children:P}):P},eXu=e=>!!(e&&"object"==typeof e&&!Array.isArray(e));function eXp(e,t){if("string"==typeof e)return e;if(e&&"object"==typeof e&&!Array.isArray(e)){let l=e[t]??e["zh"===t?"zh-CN":"en"]??e.en;return"string"==typeof l?l:Object.values(e).find(e=>"string"==typeof e)||""}return""}function eXm(e,t){let l=eXp(e,t);if("u"<typeof DOMParser)return l.replace(/<br\s*\/?\s*>|<\/(?:p|div|li|h[1-6])>/gi,"\n").replace(/<[^>]*>/g,"").trim();if(!/[<&\r\0]/.test(l))return l.replace(/\n{3,}/g,"\n\n").trim();let i=new DOMParser().parseFromString(l,"text/html").body;return i.querySelectorAll("script, style, template").forEach(e=>e.remove()),i.querySelectorAll("br").forEach(e=>e.replaceWith("\n")),i.querySelectorAll("p, div, li, h1, h2, h3, h4, h5, h6, blockquote, tr").forEach(e=>e.append("\n")),(i.textContent||"").replace(/\n{3,}/g,"\n\n").trim()}function eXg(e){let t=new Map,l=0;return i=>{let a=eXp(i,e);if("u"<typeof DOMParser||!/[<&\r\0]/.test(a))return eXm(a,e);let n=t.get(a);if(void 0!==n)return n;let r=eXm(a,e),o=a.length+r.length;if(o>256e3)return r;for(;t.size>=64||l+o>256e3;){let e=t.keys().next().value;l-=e.length+t.get(e).length,t.delete(e)}return t.set(a,r),l+=o,r}}let eXh=e=>({skuValue:{product_id:e,product_variant_id:0,option:[],bundle:[]},variantDraft:null}),eXv=e=>{var t;return(null==e||null==(t=e._extend)?void 0:t.localId)||(null==e?void 0:e.external_sale_number)||(null==e?void 0:e.order_id)||e};function eXf(e){let t=new Intl.DateTimeFormat("en-CA",{timeZone:e||void 0,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date),l=e=>{var l;return null==(l=t.find(t=>t.type===e))?void 0:l.value};return`${l("year")}-${l("month")}-${l("day")}`}function eXy(e){if(!e||"object"!=typeof e)return!1;let t=e.otherParams;return!!t&&"object"==typeof t&&"kiosk"===String((null==t?void 0:t.platform)||"").trim().toLowerCase()&&((null==t?void 0:t.venueBookingMode)==="tickets"||(null==t?void 0:t.venueBookingMode)==="party")}function eXb(e){var t,l,i;let a=e.sales.bookingTicket,n=null==a||null==(t=a.getTempOrder)?void 0:t.call(a),r=null==a||null==(l=a.getOrderCustomerSnapshot)?void 0:l.call(a);return exS(null==n?void 0:n.customer_id,null==n||null==(i=n.customer)?void 0:i.id,null==r?void 0:r.customer_id,null==r?void 0:r.id)}function eXx(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!eXy(e.sales.bookingTicket)&&"promotion_code"!==t.reason)return null;let l=eXb(e);if(exw(l))return null;if("promotion_code"===t.reason)return{reason:"promotion_code",currentCustomerId:l};let i=t.products?t.products.map(e=>({cacheItem:e})):e_J(e.sales.bookingTicket),a=eUl({platform:"kiosk",currentCustomerIdCandidates:[l],unassignedHolderLines:i});return!a&&t.force&&i[0]?{reason:"holder_required",product:i[0].cacheItem,currentCustomerId:l}:a}async function eXk(e){if(!e.isCurrent())return!1;let t=eXx(e.context,e);if(!t)return!0;if(!e.openCustomerAuth)throw Error("Customer sign-in is unavailable. Please try again.");let l=e.context.sales.bookingTicket,i=String(eXb(e.context)||""),a=()=>e.isCurrent()&&String(eXb(e.context)||"")===i;return await eUi({request:t,openCustomerAuth:e.openCustomerAuth,setOrderCustomer:"function"==typeof(null==l?void 0:l.setOrderCustomer)?async t=>{if(!a())return;let n=l.setOrderCustomer(t);i=String(eXb(e.context)||""),await n}:void 0,loadDiscountConfig:async()=>{a()&&(await e.context.cart.loadDiscountConfig(),a()&&e.context.cart.refreshCartSnapshot())},isActive:a})&&a()&&exw(eXb(e.context))}let eX_=(0,eC.createContext)({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),eXw=eC.forwardRef((e,t)=>{let{alt:l,color:i,size:a,weight:n,mirrored:r,children:o,weights:s,...d}=e,{color:c="currentColor",size:u,weight:p="regular",mirrored:m=!1,...g}=eC.useContext(eX_);return eC.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:null!=a?a:u,height:null!=a?a:u,fill:null!=i?i:c,viewBox:"0 0 256 256",transform:r||m?"scale(-1, 1)":void 0,...g,...d},!!l&&eC.createElement("title",null,l),o,s.get(null!=n?n:p))});eXw.displayName="IconBase";let eXS=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,108a12,12,0,0,0,12-12V64a20,20,0,0,0-20-20H32A20,20,0,0,0,12,64V96a12,12,0,0,0,12,12,20,20,0,0,1,0,40,12,12,0,0,0-12,12v32a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V160a12,12,0,0,0-12-12,20,20,0,0,1,0-40ZM36,170.34a44,44,0,0,0,0-84.68V68H88V188H36Zm184,0V188H112V68H220V85.66a44,44,0,0,0,0,84.68Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M200,128a32,32,0,0,0,32,32v32a8,8,0,0,1-8,8H96V56H224a8,8,0,0,1,8,8V96A32,32,0,0,0,200,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Zm192,0V192H104V64H224V88.8a40,40,0,0,0,0,78.4Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,102a6,6,0,0,0,6-6V64a14,14,0,0,0-14-14H32A14,14,0,0,0,18,64V96a6,6,0,0,0,6,6,26,26,0,0,1,0,52,6,6,0,0,0-6,6v32a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V160a6,6,0,0,0-6-6,26,26,0,0,1,0-52ZM30,192V165.53a38,38,0,0,0,0-75.06V64a2,2,0,0,1,2-2H90V194H32A2,2,0,0,1,30,192Zm196-26.47V192a2,2,0,0,1-2,2H102V62H224a2,2,0,0,1,2,2V90.47a38,38,0,0,0,0,75.06Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Zm192,0V192H104V64H224V88.8a40,40,0,0,0,0,78.4Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,100a4,4,0,0,0,4-4V64a12,12,0,0,0-12-12H32A12,12,0,0,0,20,64V96a4,4,0,0,0,4,4,28,28,0,0,1,0,56,4,4,0,0,0-4,4v32a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V160a4,4,0,0,0-4-4,28,28,0,0,1,0-56ZM28,192V163.78a36,36,0,0,0,0-71.56V64a4,4,0,0,1,4-4H92V196H32A4,4,0,0,1,28,192Zm168-64a36.06,36.06,0,0,0,32,35.78V192a4,4,0,0,1-4,4H100V60H224a4,4,0,0,1,4,4V92.22A36.06,36.06,0,0,0,196,128Z"}))]]),eXj=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXS}));function eXN(){let{progress:e}=eJ$(),t=(0,eC.useRef)(void 0);return(0,eC.useEffect)(()=>()=>{var e;return null==(e=t.current)?void 0:e.call(t)},[]),(0,eC.useCallback)((l,i)=>{t.current=e.moveTo(l,i)},[e])}function eXC(e){var t;let{number:l,state:i,lang:a,className:n}=e,r=(null==(t=eJF())?void 0:t.presentationPlatform)==="kiosk",o=(0,eC.useRef)(null);(0,eC.useLayoutEffect)(()=>{if(r)return;let e=o.current;if(!e||!i.from||void 0===i.changedAt)return;let t=window.matchMedia("(prefers-reduced-motion: reduce)"),l=performance.now()-i.changedAt,a="complete"===i.status?320:240;if(t.matches||l>=a)return;let n=[],s=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a;if(!e||"function"!=typeof e.animate||l>=i)return;let r=e.animate(t,{duration:i,easing:"ease-out"});r.currentTime=l,n.push(r)},d=getComputedStyle(e);s(e,[{backgroundColor:d.getPropertyValue(`--step-${i.from}-background`).trim()},{backgroundColor:d.backgroundColor}],240),s(e,[{transform:"scale(0.8)"},..."complete"===i.status?[{opacity:1,transform:"scale(1.12)",offset:.65}]:[],{transform:"scale(1)"}]);let c=()=>n.forEach(e=>e.cancel()),u=()=>{t.matches&&c()};return t.addEventListener("change",u),()=>{c(),t.removeEventListener("change",u)}},[i,r]);let s={locked:"zh"===a?"不可填写":"Locked",available:"zh"===a?"可填写":"Ready to fill in",complete:"zh"===a?"已填写":"Completed"}[i.status];return(0,eH.jsx)("span",{ref:o,className:`${n} selection-step-indicator`,"data-step-status":i.status,role:"img","aria-label":"zh"===a?`第 ${l} 步:${s}`:`Step ${l}: ${s}`})}function eXM(e){let{navigation:t,title:l,description:i,children:a,summary:n,footer:r,className:o="",contentClassName:s="",stage:d,id:c}=e;return(0,eH.jsxs)("div",{id:c,className:`checkout-page booking-page ${o}`,children:[(0,eH.jsxs)("div",{className:`content checkout-grid ${s}`,children:[(0,eH.jsxs)("div",{className:"checkout-main","data-booking-scroll-root":!0,children:[t&&(0,eH.jsx)("div",{className:"booking-page-navigation","data-booking-sticky":!0,children:t}),(l||i)&&(0,eH.jsxs)("header",{className:"page-title","data-booking-stage":d,tabIndex:-1,children:[l&&(0,eH.jsx)("h1",{children:l}),i&&(0,eH.jsx)("p",{children:i})]}),!l&&!i&&d&&(0,eH.jsx)("div",{"data-booking-stage":d,tabIndex:-1}),a]}),n]}),r]})}function eXT(e){let{label:t,amount:l,formatAmount:i,total:a=!1,className:n=""}=e;return(0,eH.jsxs)("div",{className:`amount-row ${a?"total-row":"price-row"} ${n}`,children:[(0,eH.jsx)("span",{children:t}),(0,eH.jsx)("strong",{children:"number"==typeof l&&i?i(l):l})]})}eXj.displayName="TicketIcon";let eXI=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),eXP=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXI}));eXP.displayName="ArrowLeftIcon";let eXA=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z"}))]]),eXD=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXA}));function eXE(e){let{secondary:t,busy:l,children:i,disabled:a,type:n="button",className:r="",...o}=e;return(0,eH.jsxs)("button",{...o,type:n,disabled:a||l,"aria-busy":l||void 0,className:`button ${t?"secondary":""} ${r}`,children:[(0,eH.jsx)("span",{className:"booking-button-content",children:i}),l&&(0,eH.jsx)(eXD,{className:"booking-button-spinner",size:22,"aria-hidden":"true"})]})}function eXO(e){let{type:t="button",className:l="",...i}=e;return(0,eH.jsx)("button",{...i,type:t,className:`shared-icon-button ${l}`})}function eXz(e){var t;let{lang:l,children:i,className:a=""}=e,n=(null==(t=eJF())?void 0:t.presentationPlatform)==="kiosk",r=(0,eC.useRef)(null);return(0,eC.useLayoutEffect)(()=>{let e=r.current;if(e)return eJ5(e,"--mobile-action-bar-height",n)},[n]),(0,eH.jsx)("div",{ref:r,className:`mobile-action-bar ${a}`,role:"region","aria-label":"zh"===l?"订单操作":"Order actions",children:i})}function eXL(e){let{action:t,className:l="",id:i}=e;return(0,eH.jsx)(eXE,{id:i,className:`booking-primary-action ${l}`,disabled:t.disabled,busy:t.busy,onClick:()=>{t.onClick()},children:t.label})}function eXR(e){let{leading:t,amount:l,label:i,detail:a,action:n,actionId:r,secondaryAction:o,feedback:s}=e;return(0,eH.jsxs)("div",{className:"booking-config-footer",children:[a&&(0,eH.jsx)("div",{className:"booking-config-detail",children:a}),(0,eH.jsxs)("div",{className:"booking-config-main",children:[t&&(0,eH.jsx)("div",{className:"booking-config-leading",children:t}),(0,eH.jsxs)("div",{className:"booking-config-amount",children:[i&&(0,eH.jsx)("small",{children:i}),(0,eH.jsx)("strong",{children:l})]}),(0,eH.jsxs)("div",{className:"booking-config-actions",children:[o&&(0,eH.jsx)(eXE,{secondary:!0,disabled:o.disabled||n.busy,busy:o.busy,onClick:()=>{o.onClick()},children:o.label}),(0,eH.jsx)(eXL,{id:r,action:{...n,label:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("span",{className:"booking-config-action-full",children:n.label}),(0,eH.jsxs)("span",{className:"booking-config-action-compact",children:[n.compactLabel??n.label," ",(0,eH.jsx)("span",{"aria-hidden":"true",children:"\xb7"})," ",l]})]})}})]})]}),s&&(0,eH.jsx)("div",{className:"booking-config-feedback",children:s})]})}function eX$(e){let{lang:t,back:l,summary:i,action:a,feedback:n}=e;return(0,eH.jsxs)(eXz,{lang:t,className:`booking-footer mobile-action${n?" booking-footer--with-feedback":""}`,children:[n&&(0,eH.jsx)("div",{className:"booking-footer-feedback",children:n}),l&&(l.href?(0,eH.jsx)("a",{className:"mobile-action-back",href:l.href,"aria-label":l.label,"aria-disabled":a.busy||void 0,tabIndex:a.busy?-1:void 0,onClick:e=>{a.busy?e.preventDefault():0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||l.onClick&&(e.preventDefault(),l.onClick())},children:(0,eH.jsx)(eXP,{size:20,"aria-hidden":"true"})}):(0,eH.jsx)(eXO,{className:"mobile-action-back","aria-label":l.label,disabled:a.busy,onClick:l.onClick,children:(0,eH.jsx)(eXP,{size:20,"aria-hidden":"true"})})),i,(0,eH.jsx)(eXL,{action:a})]})}eXD.displayName="CircleNotchIcon";let eXF=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,76H180V56A52,52,0,0,0,76,56V76H48A20,20,0,0,0,28,96V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V96A20,20,0,0,0,208,76ZM100,56a28,28,0,0,1,56,0V76H100ZM204,204H52V100H204Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,96V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V96a8,8,0,0,1,8-8H208A8,8,0,0,1,216,96Z",opacity:"0.2"}),eC.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,82H174V56a46,46,0,0,0-92,0V82H48A14,14,0,0,0,34,96V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V96A14,14,0,0,0,208,82ZM94,56a34,34,0,0,1,68,0V82H94ZM210,208a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V96a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,84H172V56a44,44,0,0,0-88,0V84H48A12,12,0,0,0,36,96V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V96A12,12,0,0,0,208,84ZM92,56a36,36,0,0,1,72,0V84H92ZM212,208a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V96a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z"}))]]),eXq=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXF}));eXq.displayName="LockSimpleIcon";let eXB=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),eC.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),eXH=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXB}));eXH.displayName="CaretUpIcon";let eXV=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),eXU=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXV}));eXU.displayName="CheckCircleIcon";let eXY=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216.49,184.49l-32,32a12,12,0,0,1-17-17L179,188H48a12,12,0,0,1,0-24H179l-11.52-11.51a12,12,0,0,1,17-17l32,32A12,12,0,0,1,216.49,184.49Zm-145-64a12,12,0,0,0,17-17L77,92H208a12,12,0,0,0,0-24H77L88.49,56.49a12,12,0,0,0-17-17l-32,32a12,12,0,0,0,0,17Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,80v96H48V80Z",opacity:"0.2"}),eC.createElement("path",{d:"M213.66,181.66l-32,32a8,8,0,0,1-11.32-11.32L188.69,184H48a8,8,0,0,1,0-16H188.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,213.66,181.66Zm-139.32-64a8,8,0,0,0,11.32-11.32L67.31,88H208a8,8,0,0,0,0-16H67.31L85.66,53.66A8,8,0,0,0,74.34,42.34l-32,32a8,8,0,0,0,0,11.32Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M42.34,85.66a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,88,48V72H208a8,8,0,0,1,0,16H88v24a8,8,0,0,1-13.66,5.66Zm171.32,84.68-32-32A8,8,0,0,0,168,144v24H48a8,8,0,0,0,0,16H168v24a8,8,0,0,0,13.66,5.66l32-32A8,8,0,0,0,213.66,170.34Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M212.24,171.76a6,6,0,0,1,0,8.48l-32,32a6,6,0,0,1-8.48-8.48L193.51,182H48a6,6,0,0,1,0-12H193.51l-21.75-21.76a6,6,0,0,1,8.48-8.48ZM75.76,116.24a6,6,0,0,0,8.48-8.48L62.49,86H208a6,6,0,0,0,0-12H62.49L84.24,52.24a6,6,0,0,0-8.48-8.48l-32,32a6,6,0,0,0,0,8.48Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M213.66,181.66l-32,32a8,8,0,0,1-11.32-11.32L188.69,184H48a8,8,0,0,1,0-16H188.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,213.66,181.66Zm-139.32-64a8,8,0,0,0,11.32-11.32L67.31,88H208a8,8,0,0,0,0-16H67.31L85.66,53.66A8,8,0,0,0,74.34,42.34l-32,32a8,8,0,0,0,0,11.32Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M210.83,173.17a4,4,0,0,1,0,5.66l-32,32a4,4,0,0,1-5.66-5.66L198.34,180H48a4,4,0,0,1,0-8H198.34l-25.17-25.17a4,4,0,0,1,5.66-5.66ZM77.17,114.83a4,4,0,0,0,5.66-5.66L57.66,84H208a4,4,0,0,0,0-8H57.66L82.83,50.83a4,4,0,0,0-5.66-5.66l-32,32a4,4,0,0,0,0,5.66Z"}))]]),eXW=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXY}));function eXK(e){let{number:t,stepStatus:l,title:i,children:a,summary:n,open:r,onToggle:o,id:s,lang:d,locked:c=!1,completing:u=!1,className:p=""}=e,m=r||!n,g=m?"zh"===d?"收起":"Done":"zh"===d?"切换":"Change";return(0,eH.jsxs)("section",{className:`selection-section ${p}`,id:s,tabIndex:-1,"aria-labelledby":`${s}-title`,children:[(0,eH.jsxs)("div",{className:"selection-section-heading",children:[l?(0,eH.jsx)(eXC,{number:t,state:l,lang:d,className:"checkout-module-number"}):(0,eH.jsx)("span",{className:"checkout-module-number","aria-hidden":"true",children:t}),(0,eH.jsx)("h2",{id:`${s}-title`,children:i}),c&&!l&&(0,eH.jsx)(eXq,{size:18,"aria-label":"zh"===d?"已锁定":"Locked"}),m&&n&&(0,eH.jsx)(eXO,{className:"selection-section-toggle",onClick:o,disabled:c,"aria-label":`${g} \xb7 ${i}`,"aria-expanded":!0,"aria-controls":`${s}-content`,children:(0,eH.jsx)(eXH,{size:20,"aria-hidden":"true"})})]}),(0,eH.jsx)("div",{id:`${s}-content`,children:m?a:(0,eH.jsxs)("button",{type:"button",className:`selection-section-summary${u?" is-completing":""}`,onClick:o,disabled:c,"aria-label":`${g} \xb7 ${i}`,"aria-describedby":`${s}-summary-copy`,"aria-expanded":!1,"aria-controls":`${s}-content`,children:[(0,eH.jsx)("span",{className:"selection-section-summary-copy",id:`${s}-summary-copy`,children:n}),(0,eH.jsxs)("span",{className:"selection-summary-status","aria-hidden":"true",children:[(0,eH.jsx)(eXU,{className:"selection-summary-check",size:24,weight:"fill"}),(0,eH.jsx)(eXW,{className:"selection-summary-change",size:21,weight:"bold"})]})]})})]})}eXW.displayName="ArrowsLeftRightIcon";let eXG=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M233.21,56.31A12,12,0,0,0,224,52H66L60.53,21.85A12,12,0,0,0,48.73,12H24a12,12,0,0,0,0,24H38.71L63.62,173a28,28,0,0,0,4.07,10.21A32,32,0,1,0,123,196h34a32,32,0,1,0,31-24H91.17a4,4,0,0,1-3.93-3.28L84.92,156H196.1a28,28,0,0,0,27.55-23l12.16-66.86A12,12,0,0,0,233.21,56.31ZM100,204a8,8,0,1,1-8-8A8,8,0,0,1,100,204Zm88,8a8,8,0,1,1,8-8A8,8,0,0,1,188,212Zm12-83.28A4,4,0,0,1,196.1,132H80.56L70.38,76H209.62Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,64l-12.16,66.86A16,16,0,0,1,196.1,144H70.55L56,64Z",opacity:"0.2"}),eC.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Zm4-74.57A8,8,0,0,1,196.1,136H77.22L65.59,72H214.41Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228.61,60.16A6,6,0,0,0,224,58H61L54.63,22.93A6,6,0,0,0,48.73,18H24a6,6,0,0,0,0,12H43.72L69.53,171.94a21.93,21.93,0,0,0,6.24,11.77A26,26,0,1,0,113.89,190h52.22A26,26,0,1,0,188,178H91.17a10,10,0,0,1-9.84-8.21L77.73,150H196.1a22,22,0,0,0,21.65-18.06L229.9,65.07A6,6,0,0,0,228.61,60.16ZM106,204a14,14,0,1,1-14-14A14,14,0,0,1,106,204Zm96,0a14,14,0,1,1-14-14A14,14,0,0,1,202,204Zm3.94-74.21A10,10,0,0,1,196.1,138H75.55L63.19,70H216.81Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Zm4-74.57A8,8,0,0,1,196.1,136H77.22L65.59,72H214.41Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M227.07,61.44A4,4,0,0,0,224,60H59.34L52.66,23.28A4,4,0,0,0,48.73,20H24a4,4,0,0,0,0,8H45.39l6.69,36.8h0L71.49,171.58A20,20,0,0,0,79,183.85,24,24,0,1,0,109.87,188h60.26A24,24,0,1,0,188,180H91.17a12,12,0,0,1-11.8-9.85l-4-22.15H196.1a20,20,0,0,0,19.68-16.42l12.16-66.86A4,4,0,0,0,227.07,61.44ZM108,204a16,16,0,1,1-16-16A16,16,0,0,1,108,204Zm96,0a16,16,0,1,1-16-16A16,16,0,0,1,204,204Zm3.91-73.85A12,12,0,0,1,196.1,140H73.88L60.79,68H219.21Z"}))]]),eXQ=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXG}));eXQ.displayName="ShoppingCartIcon";let eXZ=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),eC.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),eXJ=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:eXZ}));eXJ.displayName="XIcon";let eXX=new Map,eX0="content-visibility",eX2="contain-intrinsic-block-size",eX1="important";function eX4(e,t){return{value:e.getPropertyValue(t),priority:e.getPropertyPriority(t)}}function eX3(e,t,l,i){e.getPropertyValue(t)===l&&e.getPropertyPriority(t)===eX1&&(i.value?e.setProperty(t,i.value,i.priority):e.removeProperty(t))}let eX8=[],eX6=new WeakMap,eX5="",eX7=new Map,eX9=".pisell-sku-options-modal[role='dialog'], .pisell-sku-options-modal [role='dialog'], .pisell-lookup-modal-container[role='dialog'], .pisell-lookup-modal-container [role='dialog'], .pisell-lookup-drawer-container[role='dialog'], .pisell-lookup-drawer-container [role='dialog'], .ant-modal-root [role='dialog'], .ant-drawer [role='dialog'], .pisell-pc-modal [role='dialog'], .pisell-mobile-modal [role='dialog'], .pisell-lowcode-floating-layer-root [role='dialog'], .sales-sdk-allergy-modal [role='dialog'], .numeric-stepper-keyboard-popover, .numeric-stepper-keyboard-modal";function e0e(){eX8.forEach((e,t)=>{e.inert=t!==eX8.length-1,e.style.zIndex=String((eX6.get(e)??1e3)+t)})}function e0t(e){let{title:t,children:l,onClose:i,closeLabel:a,wide:n=!1,className:r="",initialFocus:o,open:s=!0,footer:d,intro:c,bodyClassName:u="",footerClassName:p="",mobile:m="sheet",bodyRef:g,closeDisabled:h=!1,closeOnBackdrop:v=!0,closeOnEscape:f=!0,style:y,portal:b,zIndex:x,externalDialogSelector:k}=e,_=eJF(),w=dq("booking-dialog"),S=(0,eC.useRef)(null),j=(0,eC.useRef)(null),N=(0,eC.useRef)(i);N.current=()=>{h||i()};let C=(0,eC.useRef)(f);C.current=f;let M=!!d;if((0,eC.useEffect)(()=>{if(!s||!S.current||!j.current)return;let e=S.current,t=j.current,l=document.activeElement,i=(null==_?void 0:_.background)&&!_.background.contains(e)?_.background:null;if(eX8.length||(eX5=document.body.style.overflow,document.body.style.overflow="hidden"),i){let e=eX7.get(i)??{count:0,inert:i.inert};e.count++,eX7.set(i,e),i.inert=!0}let a=(null==_?void 0:_.presentationPlatform)==="kiosk"&&M&&"fullscreen"===m&&i&&i===_.root?function(e){var t,l;if("u"<typeof CSS||!(null==(t=(l=CSS).supports)?void 0:t.call(l,eX0,"hidden"))||!CSS.supports(eX2,"1px"))return()=>{};let i=Array.from(e.children).filter(e=>e.classList.contains("brand-scope"));if(1!==i.length||"http://www.w3.org/1999/xhtml"!==i[0].namespaceURI)return()=>{};let a=i[0],n=eXX.get(a);if(!n){let e=getComputedStyle(a);if("horizontal-tb"!==e.writingMode||"hidden"===e.contentVisibility||["paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"].some(t=>0!==parseFloat(e[t])))return()=>{};let t=a.offsetHeight;if(t<=0)return()=>{};n={count:0,height:`${t}px`,visibility:eX4(a.style,eX0),intrinsicSize:eX4(a.style,eX2)},eXX.set(a,n),a.style.setProperty(eX2,n.height,eX1),a.style.setProperty(eX0,"hidden",eX1)}n.count++;let r=n,o=!1;return()=>{o||(o=!0,0==--r.count&&(eX3(a.style,eX0,"hidden",r.visibility),eX3(a.style,eX2,r.height,r.intrinsicSize),eXX.delete(a)))}}(i):void 0;void 0!==x&&eX6.set(e,x),eX8.push(e),e0e();let n=e=>{if(!e.getClientRects().length||e.closest('[inert], [aria-hidden="true"]'))return!1;let t=window.getComputedStyle(e);return"hidden"!==t.visibility&&"none"!==t.display},r=e=>{let t=e,l=0;for(;t;){let e=parseInt(window.getComputedStyle(t).zIndex,10);Number.isFinite(e)&&(l=Math.max(l,e)),t=t.parentElement}return l},d=()=>{if(!k)return t;let l=Array.from(document.querySelectorAll(k)).filter(l=>!t.contains(l)&&n(l)&&r(l)>r(e)).sort((e,t)=>r(e)-r(t));return l[l.length-1]||t},c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d();return Array.from(e.querySelectorAll('button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), summary, a[href], [tabindex="0"]')).filter(e=>e.tabIndex>=0&&e.getClientRects().length>0&&!e.closest("[inert]"))},u=()=>{let e=d(),l=e===t&&o&&t.querySelector(o);e.hasAttribute("tabindex")||(e.tabIndex=-1),(l||c(e)[0]||e).focus({preventScroll:!0})},p=requestAnimationFrame(()=>{eX8[eX8.length-1]===e&&u()}),g=l=>{if(eX8[eX8.length-1]!==e)return;let i=d(),a=document.activeElement instanceof HTMLElement&&document.activeElement.closest(".ant-select-dropdown, .ant-picker-dropdown"),r="Escape"===l.key&&Array.from(document.querySelectorAll(".ant-select-dropdown, .ant-picker-dropdown")).some(e=>{if(!n(e))return!1;let t=e;for(;t;){let e=window.getComputedStyle(t);if("hidden"===e.visibility||"none"===e.display||"0"===e.opacity)return!1;t=t.parentElement}return!0});if(("Escape"!==l.key||!r)&&("Tab"!==l.key||!a)&&("Escape"===l.key&&i===t&&(l.preventDefault(),l.stopImmediatePropagation(),C.current&&N.current()),"Tab"===l.key)){let e=c(),t=e[0],a=e[e.length-1];if(!t){l.preventDefault(),i.focus();return}l.shiftKey&&(document.activeElement===t||!i.contains(document.activeElement))?(l.preventDefault(),null==a||a.focus()):l.shiftKey||document.activeElement!==a&&i.contains(document.activeElement)||(l.preventDefault(),t.focus())}},h=null,v=l=>{let i=l.target;i instanceof HTMLElement&&t.contains(i)&&(h=i),!(i instanceof HTMLElement&&i.closest(".ant-select-dropdown, .ant-picker-dropdown"))&&(eX8[eX8.length-1]!==e||d().contains(i)||u())},f=0,y=t,b=k?new MutationObserver(()=>{cancelAnimationFrame(f),f=requestAnimationFrame(()=>{if(eX8[eX8.length-1]!==e)return;let l=d();l===y||l.contains(document.activeElement)||(l===t&&(null==h?void 0:h.isConnected)&&n(h)?h.focus({preventScroll:!0}):u()),y=l})}):null;return null==b||b.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","aria-hidden"]}),document.addEventListener("keydown",g,!0),document.addEventListener("focusin",v),()=>{if(cancelAnimationFrame(p),cancelAnimationFrame(f),null==b||b.disconnect(),document.removeEventListener("keydown",g,!0),document.removeEventListener("focusin",v),eX8.splice(eX8.indexOf(e),1),eX6.delete(e),e0e(),eX8.length||(document.body.style.overflow=eX5),null==a||a(),i){let e=eX7.get(i);0==--e.count&&(i.inert=e.inert,eX7.delete(i))}(null==l?void 0:l.isConnected)&&!l.closest("[inert]")&&l.focus({preventScroll:!0})}},[s,null==_?void 0:_.portal,null==_?void 0:_.background,null==_?void 0:_.root,null==_?void 0:_.presentationPlatform,b,x,k,m,M]),"u"<typeof document||void 0===b&&_&&!_.portal)return null;let T=(0,eH.jsx)("div",{ref:S,hidden:!s,style:s?void 0:{display:"none"},className:`modal-backdrop ${"calendar-modal"===r?"calendar-backdrop":""}`,onMouseDown:e=>{v&&e.target===e.currentTarget&&eX8[eX8.length-1]===S.current&&N.current()},children:(0,eH.jsxs)("div",{ref:j,style:y,"data-booking-scroll-root":!0,className:`modal ${n?"wide":""} ${r} ${d?`dialog-framed dialog-${m}`:""}`,role:"dialog","aria-modal":"true","aria-labelledby":w,tabIndex:-1,children:[(0,eH.jsxs)("div",{className:"modal-heading",children:[(0,eH.jsx)("h2",{id:w,children:t}),(0,eH.jsx)(eXO,{type:"button",className:"icon-button","aria-label":a,disabled:h,onClick:()=>N.current(),children:(0,eH.jsx)(eXJ,{size:23})})]}),d?(0,eH.jsxs)(eH.Fragment,{children:[c&&(0,eH.jsx)("div",{className:"dialog-intro",children:c}),(0,eH.jsx)("div",{ref:g,className:`dialog-body ${u}`,tabIndex:0,role:"region","aria-labelledby":w,children:l}),(0,eH.jsx)("div",{className:`dialog-footer ${p}`,children:d})]}):l]})}),I=_&&(!1===b||null!=b&&b!==_.portal)?(0,eH.jsx)("div",{className:`booking-ui booking-ui-portals${"compact"===_.layout?" booking-ui-compact":""}`,"data-booking-scope":_.scopeId,"data-booking-presentation":_.presentationPlatform,lang:"zh"===_.lang?"zh-CN":"en-AU",style:_.brandTokens,children:T}):T;return!1===b?I:(0,oT.createPortal)(I,b??(null==_?void 0:_.portal)??document.body)}function e0l(e){let{current:t,steps:l,label:i,currentLabel:a,readOnly:n=!1}=e;return(0,eH.jsx)("nav",{"data-booking-sticky":!0,className:"booking-navigation","aria-label":i,children:(0,eH.jsx)("ol",{className:"steps interactive-steps",style:{"--step-count":Math.max(1,l.length),"--step-progress":l.length>1?Math.max(0,Math.min(t,l.length-1))/(l.length-1):0},children:l.map((e,l)=>{let i=l===t,r="skipped"===e.status&&!i,o="available"!==e.status;return(0,eH.jsx)("li",{className:`${i?"active":r?"skipped":l<t?"done":""} ${o&&!r?"locked":""}`,children:(0,eH.jsxs)("button",{type:"button","aria-label":e.ariaLabel??e.label,"aria-current":i?"step":void 0,disabled:n||o&&!i,title:i?a:e.hint,onClick:()=>{var t;i||o||null==(t=e.onClick)||t.call(e)},children:[(0,eH.jsx)("span",{className:"step-number","aria-hidden":"true",children:r?"–":l+1}),(0,eH.jsxs)("span",{className:"step-label",children:[o&&!r&&!i&&(0,eH.jsx)(eXq,{size:13,"aria-hidden":"true"}),(0,eH.jsx)("b",{className:"step-full-label",children:e.label}),(0,eH.jsx)("b",{className:"step-short-label",children:e.shortLabel??e.label})]})]})},e.id)})})})}function e0i(e){let{panel:t,title:l,closeLabel:i,header:a,body:n,footer:r,decoration:o}=e,s=eJF(),d=(0,eC.useRef)(null);(0,eC.useLayoutEffect)(()=>{let e=d.current;if(t.isMobile||!e)return;let l=0,i=()=>{let t=parseFloat(getComputedStyle(e).getPropertyValue("--summary-decoration-bleed"))||0,l=parseFloat(getComputedStyle(e).getPropertyValue("--summary-sticky-offset"))||22,i=Math.max(240,window.innerHeight-Math.max(l,e.getBoundingClientRect().top)-l-t),a=`${Math.floor(i)}px`;e.style.getPropertyValue("--summary-available-height")!==a&&e.style.setProperty("--summary-available-height",a)},a=()=>{cancelAnimationFrame(l),l=requestAnimationFrame(i)},n=new ResizeObserver(a);return n.observe(e),window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),i(),()=>{cancelAnimationFrame(l),n.disconnect(),window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[t.isMobile,null==s?void 0:s.design]);let c=(0,eH.jsxs)(eH.Fragment,{children:[a,(0,eH.jsx)("div",{className:"order-summary-scroll",tabIndex:0,role:"region","aria-label":l,children:n}),(0,eH.jsx)("div",{className:"order-summary-footer",children:r})]});return t.isMobile?(0,eH.jsx)(e0t,{title:l,open:t.open,onClose:t.close,closeLabel:i,className:"order-summary-sheet",zIndex:600,externalDialogSelector:eX9,children:c}):(0,eH.jsxs)("aside",{ref:d,className:"order-summary booking-order-summary",children:[(0,eH.jsx)("h2",{children:l}),c,o]})}function e0a(e){let{panel:t,title:l,label:i,total:a,count:n}=e;return(0,eH.jsx)("button",{type:"button",className:`order-panel-trigger ${void 0!==n?"has-count":""}`,"aria-label":`${l} \xb7 ${a}`,"aria-haspopup":"dialog","aria-expanded":t.open,onClick:t.show,children:void 0!==n?(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("span",{className:"summary-trigger-count","aria-hidden":"true",children:[(0,eH.jsx)(eXQ,{size:25}),(0,eH.jsx)("b",{children:n})]}),(0,eH.jsxs)("span",{className:"summary-trigger-content",children:[(0,eH.jsx)("strong",{children:a}),(0,eH.jsxs)("small",{children:[i,(0,eH.jsx)(eXH,{size:13,"aria-hidden":"true"})]})]})]}):(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("span",{children:[(0,eH.jsx)(eXQ,{size:16,"aria-hidden":"true"}),i,(0,eH.jsx)(eXH,{size:13,"aria-hidden":"true"})]}),(0,eH.jsx)("strong",{children:a})]})})}let e0n=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,28H188V24a12,12,0,0,0-24,0v4H92V24a12,12,0,0,0-24,0v4H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28ZM68,52a12,12,0,0,0,24,0h72a12,12,0,0,0,24,0h16V76H52V52ZM52,204V100H204V204Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,48V88H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z",opacity:"0.2"}),eC.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,48H48V48H72v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,34H182V24a6,6,0,0,0-12,0V34H86V24a6,6,0,0,0-12,0V34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H74V56a6,6,0,0,0,12,0V46h84V56a6,6,0,0,0,12,0V46h26a2,2,0,0,1,2,2V82H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V94H210V208A2,2,0,0,1,208,210Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,36H180V24a4,4,0,0,0-8,0V36H84V24a4,4,0,0,0-8,0V36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H76V56a4,4,0,0,0,8,0V44h88V56a4,4,0,0,0,8,0V44h28a4,4,0,0,1,4,4V84H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V92H212V208A4,4,0,0,1,208,212Z"}))]]),e0r=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e0n}));e0r.displayName="CalendarBlankIcon";let e0o=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M160,48V208L80,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z"}))]]),e0s=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e0o}));e0s.displayName="CaretLeftIcon";let e0d=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),eC.createElement("path",{d:"M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"}))]]),e0c=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e0d}));e0c.displayName="CaretRightIcon";let e0u="Australia/Sydney";function e0p(e){let t,l=Intl.Locale;try{var i,a;let n=l?new l(e):void 0;t=(null==n||null==(i=n.getWeekInfo)?void 0:i.call(n).firstDay)??(null==n||null==(a=n.weekInfo)?void 0:a.firstDay)}catch{}return void 0===t?+("en-US"!==e):t%7}function e0m(e){if("string"!=typeof e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T12:00:00Z`);return Number.isFinite(t.getTime())&&t.toISOString().slice(0,10)===e}function e0g(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e0u,l=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e);return["year","month","day"].map(e=>l.find(t=>t.type===e).value).join("-")}function e0h(e,t){let l=new Date(`${e}T12:00:00Z`);return l.setUTCDate(l.getUTCDate()+t),l.toISOString().slice(0,10)}function e0v(e,t){let l=new Date(`${e}T12:00:00Z`).getUTCDay();return e0h(e,-((l-t+7)%7))}function e0f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e0g(),l=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return e0m(e)&&e>=t&&(void 0===l||e<=l)&&!(null==i?void 0:i(e))}function e0y(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{weekday:"long",year:"numeric",month:"long",day:"numeric"};return new Intl.DateTimeFormat(t,{...l,timeZone:"UTC"}).format(new Date(`${e}T12:00:00Z`))}function e0b(e){let{locale:t,firstDay:l,today:i,month:a,selected:n,minDate:r,maxDate:o,viewEnd:s,disabled:d,allowed:c,onMonthChange:u,onSelect:p,t:m}=e,g=(0,eC.useRef)(null),h=(0,eC.useRef)(),[v,f]=(0,eC.useState)(n);(0,eC.useLayoutEffect)(()=>{var e;let t=null==(e=g.current)?void 0:e.querySelector(".venue-booking-picker-panel");t&&(t.tabIndex=-1)},[]);let y=(0,eC.useMemo)(()=>{let e=t.startsWith("zh"),i=e?ey4:ey3,a=`venue-booking-${e?"zh":"en"}-week-${l}`;return eS().locale({...e?QP():QD(),name:a,weekStart:l},void 0,!0),{...i,lang:{...i.lang,locale:a,shortWeekDays:Array.from({length:7},(e,l)=>e0y(e0h("2023-01-01",l),t,{weekday:"short"}))}}},[t,l]),b=eS()(a).locale(y.lang.locale),x=e=>e.slice(0,7)===a.slice(0,7),k=e=>x(e)&&c(e),_=r.slice(0,7),w=null==o?void 0:o.slice(0,7),S=e=>{d||e.slice(0,7)<_||w&&e.slice(0,7)>w||u(`${e.slice(0,7)}-01`)},j=e0v(a,l),N=Array.from({length:42},(e,t)=>e0h(j,t)).filter(x),C=N.includes(v)&&c(v)?v:N.includes(n)&&c(n)?n:N.find(c);(0,eC.useEffect)(()=>{var e,t;let l=h.current;if(!l||!N.includes(l))return;let i=c(l)?l:N.find(e=>e>=l&&c(e))||N.find(c);i&&(h.current=void 0,f(i),null==(t=g.current)||null==(e=t.querySelector(`[data-calendar-day="${i}"]`))||e.focus())});let M=Number(r.slice(0,4)),T=Array.from({length:Math.max(1,(o?Number(o.slice(0,4)):Math.max(M+10,Number(s.slice(0,4)),b.year()))-M+1)},(e,t)=>M+t);return(0,eH.jsx)("div",{ref:g,lang:t,onFocusCapture:e=>{var t,l;e.target.classList.contains("venue-booking-picker-panel")&&C&&(null==(l=g.current)||null==(t=l.querySelector(`[data-calendar-day="${C}"]`))||t.focus())},onKeyDownCapture:e=>{e.target.classList.contains("venue-booking-picker-panel")&&["Enter"," ","PageUp","PageDown","Home","End","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),e.stopPropagation())},children:(0,eH.jsx)(eT.ConfigProvider,{locale:{locale:t,Calendar:y},children:(0,eH.jsx)(eT.Calendar,{prefixCls:"venue-booking-picker",className:"venue-booking-calendar",fullscreen:!1,mode:"month",locale:y,value:b,disabledDate:e=>!k(e.format("YYYY-MM-DD")),onPanelChange:e=>S(e.format("YYYY-MM-DD")),onSelect:(e,t)=>{let l=e.format("YYYY-MM-DD");"date"===t.source&&k(l)&&p(l)},headerRender:()=>(0,eH.jsxs)("div",{className:"venue-booking-calendar-header",children:[(0,eH.jsx)("button",{type:"button",className:"icon-button","aria-label":m("previousMonth"),disabled:d||b.format("YYYY-MM")<=_,onClick:()=>S(b.subtract(1,"month").format("YYYY-MM-DD")),children:(0,eH.jsx)(e0s,{size:18,"aria-hidden":"true"})}),(0,eH.jsxs)("div",{className:"venue-booking-calendar-dropdowns",children:[(0,eH.jsx)("select",{"aria-label":m("calendarMonth"),value:b.month(),disabled:d,onChange:e=>S(b.month(Number(e.target.value)).format("YYYY-MM-DD")),children:Array.from({length:12},(e,l)=>{let i=b.month(l).format("YYYY-MM-DD");return(0,eH.jsx)("option",{value:l,disabled:i.slice(0,7)<_||!!(w&&i.slice(0,7)>w),children:e0y(i,t,{month:"long"})},l)})}),(0,eH.jsx)("select",{"aria-label":m("calendarYear"),value:b.year(),disabled:d,onChange:e=>{let t=b.year(Number(e.target.value)).format("YYYY-MM-DD");t.slice(0,7)<_&&(t=r),o&&t.slice(0,7)>w&&(t=o),S(t)},children:T.map(e=>(0,eH.jsx)("option",{value:e,children:e},e))})]}),(0,eH.jsx)("button",{type:"button",className:"icon-button","aria-label":m("nextMonth"),disabled:d||!!(w&&b.format("YYYY-MM")>=w),onClick:()=>S(b.add(1,"month").format("YYYY-MM-DD")),children:(0,eH.jsx)(e0c,{size:18,"aria-hidden":"true"})})]}),fullCellRender:e=>{let a=e.format("YYYY-MM-DD");if(!x(a))return null;let s=a===n;return(0,eH.jsx)("button",{type:"button","data-calendar-day":a,className:`venue-booking-calendar-day ${s?"is-selected":""} ${a===i?"is-today":""}`,disabled:!k(a),tabIndex:a===C?0:-1,"aria-label":e0y(a,t),"aria-pressed":s,"aria-current":a===i?"date":void 0,onFocus:()=>f(a),onKeyDown:t=>{if("Enter"===t.key||" "===t.key){t.preventDefault(),t.stopPropagation(),k(a)&&p(a);return}if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault(),t.stopPropagation();let l=e.add("PageUp"===t.key?-1:1,"month").format("YYYY-MM-DD");if(l<r||o&&l>o)return;h.current=l,f(l),S(l);return}let i={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,Home:-((e.day()-l+7)%7),End:6-(e.day()-l+7)%7};if(!(t.key in i))return;t.preventDefault(),t.stopPropagation();let n=e0h(a,i[t.key]),s=i[t.key]<0?-1:1;for(;N.includes(n)&&!c(n);)n=e0h(n,s);n===a||n<r||o&&n>o||(N.includes(n)||S(n),h.current=n,f(n))},children:e.date()})}})})})}function e0x(e){var t,l,i;let{value:a,onChange:n,locale:r,title:o,description:s,stepNumber:d,stepStatus:c,timeZone:u=e0u,todayMarker:p="venue",minDate:m,maxDate:g,isUnavailable:h,dateStates:v={},onVisibleDatesChange:f,onInteraction:y,disabled:b=!1,loading:x=!1,allowEmpty:k=!1,t:_}=e,w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e0u,t=()=>{let t=new Date;return{venue:e0g(t,e),device:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}},[l,i]=(0,eC.useState)(t);return(0,eC.useEffect)(()=>{let e=()=>{let e=t();i(t=>t.venue===e.venue&&t.device===e.device?t:e)};e();let l=window.setInterval(e,1e3);return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{clearInterval(l),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[e]),l}(u),S=w.venue,j="device"===p?w.device:S,N=m||S,C=e0h(e0m(a)&&a>N?a:N,180),[M,T]=(0,eC.useState)(C),I=g||(M>C?M:C),P=e=>{if(g)return;let t=e0h(e,180);T(e=>e>t?e:t)},A=e0p(r),D=(0,eC.useMemo)(()=>(function(e,t,l){let i=[];for(let a=e0v(e,l);a<=t;a=e0h(a,7))i.push(a);return i})(N,I,A),[N,I,A]),E=e0v(e0m(a)?a:S,A),O=Math.max(0,Math.min(D.length-1,D.findIndex(e=>e===E))),[z,L]=(0,eC.useState)(O),R=Math.max(0,Math.min(z,D.length-1)),$=(0,eC.useRef)(R);$.current=R;let[F,q]=(0,eC.useState)(!1),[B,H]=(0,eC.useState)(()=>(e0m(a)?a:S).slice(0,7)+"-01"),[V,U]=(0,eC.useState)(a),Y=(0,eC.useRef)(null),W=(0,eC.useRef)(void 0),K=(0,eC.useRef)(null),G=(0,eC.useRef)(0),Q=(0,eC.useRef)(),Z=dq("booking-date-title"),J=dq("booking-date-description"),X=dq("booking-date-error"),ee=D[R]||e0v(N,A);(0,eC.useEffect)(()=>{!g&&R>=D.length-4&&P(I)},[g,R,D.length,I]);let et=(0,eC.useMemo)(()=>{let e;if(F){let t=`${B.slice(0,7)}-01`;e=Array.from({length:31},(e,l)=>e0h(t,l)).filter(e=>e.slice(0,7)===B.slice(0,7))}else e=Array.from({length:7},(e,t)=>e0h(ee,t)),e0m(a)&&e.push(a);return Array.from(new Set(e)).filter(e=>e>=N&&(void 0===g||e<=g)).sort()},[ee,F,B,u,A,a,N,g]),el=et.join(","),ei=(0,eC.useRef)(f);ei.current=f,(0,eC.useEffect)(()=>{var e;null==(e=ei.current)||e.call(ei,et)},[el]);let ea=x||et.some(e=>!v[e]||"loading"===v[e].status),en=et.some(e=>{var t;return(null==(t=v[e])?void 0:t.status)==="error"}),er=new Map,eo=e=>{var t,l;return er.has(e)||er.set(e,!b&&!x&&((null==(t=v[e])?void 0:t.status)==="available"||(null==(l=v[e])?void 0:l.status)==="configuration")&&e0f(e,N,g,h)),er.get(e)};(0,eC.useEffect)(()=>{let e=Q.current;if(!e||b||x||!v[e]||"loading"===v[e].status)return;let t=Array.from({length:7},(e,t)=>e0h(ee,t));if(!t.includes(e)){Q.current=void 0;return}let l=eo(e)?e:t.find(eo);if(!(!l&&t.some(e=>e>=N&&(void 0===g||e<=g)&&(!v[e]||"loading"===v[e].status)))&&(Q.current=void 0,l)){var i,a;U(l),null==(a=Y.current)||null==(i=a.querySelector(`[data-booking-day="${l}"]`))||i.focus({preventScroll:!0})}},[v,ee,b,x,h,N,g]);let es=x||!v[a]||"loading"===v[a].status,ed=!x&&!(k&&!a)&&(!e0f(a,N,g)||!es&&((null==(t=v[a])?void 0:t.status)==="unavailable"||((null==(l=v[a])?void 0:l.status)==="available"||(null==(i=v[a])?void 0:i.status)==="configuration")&&(null==h?void 0:h(a)))),ec=e=>Math.floor((new Date(`${e}T12:00:00Z`).getTime()-new Date(`${D[0]||e0v(N,A)}T12:00:00Z`).getTime())/6048e5),eu=function(e){var t;let l=!(arguments.length>1)||void 0===arguments[1]||arguments[1];e=Math.max(0,g?Math.min(D.length-1,e):e),!g&&e>=D.length-4&&P(e0h(D[0]||e0v(N,A),7*e+6)),$.current=e,L(e),null==(t=Y.current)||t.scrollTo({left:e*Y.current.clientWidth,behavior:l&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches?"smooth":"instant"})};(0,eC.useLayoutEffect)(()=>{eu(O,!1),U(a)},[a,N,g,A]),(0,eC.useLayoutEffect)(()=>{var e;null==(e=Y.current)||e.scrollTo({left:$.current*Y.current.clientWidth,behavior:"instant"})},[D.length]),(0,eC.useEffect)(()=>{let e=Y.current;if(!e)return;let t=new ResizeObserver(()=>e.scrollTo({left:$.current*e.clientWidth,behavior:"instant"}));return t.observe(e),()=>t.disconnect()},[]),(0,eC.useEffect)(()=>()=>clearTimeout(W.current),[]);let ep=e=>{eo(e)&&(null==y||y(),Q.current=void 0,n(e),eu(ec(e),!1),U(e),q(!1))},em=e0m(a)?e0y(a,r,{day:"numeric",month:"short",year:"numeric"}):_("chooseDate"),eg=e=>e0y(ee,r,{month:e?"short":"long",year:"numeric"}),eh=()=>{let e=K.current,t=Y.current;if(K.current=null,!(null==e?void 0:e.dragging)||!t)return;G.current=Date.now()+300,t.style.scrollSnapType="",t.hasPointerCapture(e.id)&&t.releasePointerCapture(e.id);let l=t.scrollLeft-e.scroll;eu(Math.abs(l)>40?Math.round(e.scroll/t.clientWidth)+Math.sign(l):Math.round(t.scrollLeft/t.clientWidth))};return(0,eH.jsxs)("div",{className:"booking-date-picker",role:"group","aria-labelledby":Z,"aria-disabled":b||void 0,"aria-busy":ea||void 0,children:[(0,eH.jsxs)("div",{className:"booking-date-heading",children:[(0,eH.jsxs)("div",{className:"booking-date-copy",children:[void 0===d?(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("span",{className:"booking-date-icon","aria-hidden":"true",children:(0,eH.jsx)(e0r,{size:17,weight:"bold"})}),(0,eH.jsx)("strong",{id:Z,children:o})]}):(0,eH.jsxs)("h3",{className:"booking-substep-title",id:Z,children:[c?(0,eH.jsx)(eXC,{number:d,state:c,lang:r.startsWith("zh")?"zh":"en",className:"booking-substep-number"}):(0,eH.jsx)("span",{className:"booking-substep-number",children:d}),o]}),s&&(0,eH.jsx)("p",{className:"sr-only",id:J,children:s})]}),(0,eH.jsxs)("div",{className:"booking-date-controls",children:[(0,eH.jsxs)("button",{type:"button",className:"calendar-trigger","aria-haspopup":"dialog","aria-expanded":F,disabled:b,"aria-label":`${_("openCalendar")}: ${em}`,title:`${_("openCalendar")}: ${em}`,"aria-invalid":ed||void 0,"aria-describedby":ed?X:s?J:void 0,onClick:()=>{null==y||y();let e=e0m(a)&&a>=N&&(void 0===g||a<=g)?a:N;H(`${e.slice(0,7)}-01`),P(e),q(!0)},children:[(0,eH.jsx)("span",{className:"calendar-caption-full",children:eg(!1)}),(0,eH.jsx)("span",{className:"calendar-caption-short",children:eg(!0)}),(0,eH.jsx)(e0r,{size:16,"aria-hidden":"true"})]}),(0,eH.jsxs)("div",{className:"booking-week-arrows",children:[(0,eH.jsx)("button",{type:"button",className:"icon-button","aria-label":_("previousWeek"),disabled:b||0===R,onClick:()=>{null==y||y(),eu(R-1)},children:(0,eH.jsx)(e0s,{size:16})}),(0,eH.jsx)("button",{type:"button",className:"icon-button","aria-label":_("nextWeek"),disabled:b||void 0!==g&&R===D.length-1,onClick:()=>{null==y||y(),eu(R+1)},children:(0,eH.jsx)(e0c,{size:16})})]})]})]}),(0,eH.jsx)("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e0g(),i=e0h(e,6),a=new Intl.DateTimeFormat(t,{day:"numeric",month:"short",...e.slice(0,4)!==l.slice(0,4)||e.slice(0,4)!==i.slice(0,4)?{year:"numeric"}:{},timeZone:"UTC"}),n=new Date(`${e}T12:00:00Z`),r=new Date(`${i}T12:00:00Z`);return a.formatRange?a.formatRange(n,r):`${a.format(n)} – ${a.format(r)}`}(ee,r,S)}),(0,eH.jsx)("div",{ref:Y,className:"booking-week-track","aria-label":_("quickVisitDates"),onScroll:()=>{clearTimeout(W.current),W.current=setTimeout(()=>{var e;(null==(e=K.current)?void 0:e.dragging)||!Y.current||L(Math.round(Y.current.scrollLeft/Y.current.clientWidth))},120)},onPointerDown:e=>{b||("mouse"!==e.pointerType&&(null==y||y()),"mouse"===e.pointerType&&0===e.button&&(K.current={id:e.pointerId,x:e.clientX,scroll:e.currentTarget.scrollLeft,dragging:!1}))},onPointerMove:e=>{let t=K.current;t&&(!t.dragging&&Math.abs(e.clientX-t.x)>8&&(null==y||y(),t.dragging=!0,e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.style.scrollSnapType="none"),t.dragging&&(e.preventDefault(),e.currentTarget.scrollLeft=t.scroll-(e.clientX-t.x)))},onPointerUp:eh,onWheel:e=>{!b&&(0!==e.deltaX||e.shiftKey&&0!==e.deltaY)&&(null==y||y())},onPointerCancel:eh,onLostPointerCapture:eh,onPointerLeave:()=>{var e;(null==(e=K.current)?void 0:e.dragging)||(K.current=null)},onClickCapture:e=>{Date.now()<G.current&&(e.preventDefault(),e.stopPropagation())},children:D.map((e,t)=>{if(Math.abs(t-R)>1)return(0,eH.jsx)("div",{className:"booking-week",ref:e=>{null==e||e.setAttribute("inert","")},"aria-hidden":"true"},e);let l=Array.from({length:7},(t,l)=>e0h(e,l)),i=l.includes(V)&&eo(V)?V:l.includes(a)&&eo(a)?a:l.find(eo);return(0,eH.jsx)("div",{className:"booking-week",ref:e=>{null==e||e.toggleAttribute("inert",t!==R)},"aria-hidden":t!==R||void 0,children:l.map(e=>{var n;return(0,eH.jsxs)("button",{type:"button","data-booking-day":e,className:`booking-day ${e===a?"is-selected":""} ${e===j?"is-today":""}`,disabled:!eo(e),"aria-busy":x||!v[e]||"loading"===v[e].status||void 0,title:null==(n=v[e])?void 0:n.reason,"aria-label":e0y(e,r),"aria-pressed":e===a,"aria-current":e===j?"date":void 0,tabIndex:t===R&&e===i?0:-1,onClick:()=>ep(e),onFocus:()=>U(e),onKeyDown:t=>{let i={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,Home:-1*l.indexOf(e),End:6-l.indexOf(e)};if(!(t.key in i))return;t.preventDefault(),null==y||y();let a=e0h(e,i[t.key]),n=i[t.key]<0?-1:1;for(;a>=N&&(void 0===g||a<=g)&&!eo(a);){if(!v[a]||"loading"===v[a].status){Q.current=a,eu(ec(a),!1),U(a);return}a=e0h(a,n)}eo(a)&&(eu(ec(a),!1),U(a),requestAnimationFrame(()=>{var e,t;return null==(t=Y.current)||null==(e=t.querySelector(`[data-booking-day="${a}"]`))?void 0:e.focus({preventScroll:!0})}))},children:[(0,eH.jsx)("small",{children:e===j?_("calendarToday"):e0y(e,r,{weekday:"short"})}),(0,eH.jsxs)("span",{className:"booking-day-date",children:[(0,eH.jsx)("span",{className:"booking-day-date-full",children:e0y(e,r,{day:"numeric",month:"short"})}),(0,eH.jsx)("span",{className:"booking-day-date-short",children:r.startsWith("zh")?e.slice(0,7)===ee.slice(0,7)?e0y(e,r,{day:"numeric"}):`${Number(e.slice(5,7))}/${Number(e.slice(-2))}`:e0y(e,r,{day:"numeric",month:"short"})})]})]},e)})},e)})}),ee!==e0v(S,A)&&(0,eH.jsx)("div",{className:"booking-week-return",children:(0,eH.jsx)("button",{type:"button",className:"back-this-week",disabled:b,onClick:()=>{null==y||y(),eu(ec(S))},children:_("backThisWeek")})}),ed&&(0,eH.jsx)("p",{id:X,className:"booking-date-error",role:"alert",children:_("dateNeedsReselect")}),en&&(0,eH.jsx)("p",{className:"booking-date-error",role:"alert",children:_("calendarLoadFailed")}),F&&(0,eH.jsxs)(e0t,{title:_("chooseVisitDate"),closeLabel:_("closeCalendar"),className:"calendar-modal",initialFocus:'.venue-booking-calendar-day[tabindex="0"]',onClose:()=>q(!1),children:[(0,eH.jsx)(e0b,{locale:r,firstDay:A,today:j,month:B,onMonthChange:e=>{b||(null==y||y(),P(e),H(e))},selected:a,onSelect:ep,allowed:eo,disabled:b,minDate:N,maxDate:g,viewEnd:I,t:_}),(0,eH.jsxs)("div",{className:"calendar-panel-footer",children:[(0,eH.jsx)("span",{role:ea||en?"status":void 0,children:ea?_("calendarLoading"):en?_("calendarLoadFailed"):_("calendarVenueTime")}),(0,eH.jsx)("button",{type:"button",className:"text-link",disabled:b||S<N||void 0!==g&&S>g,onClick:()=>{null==y||y(),H(`${S.slice(0,7)}-01`)},children:_("calendarThisMonth")})]})]})]})}let e0k={unavailableProductAction:["Unavailable","不可预约"],timeMaximumCapacity:["Maximum capacity: {count}","最大容量:{count}"],timeRoomsLeft:["Rooms left: {count}","剩余房间:{count}"],timeSpacesLeft:["Spaces left: {count}","剩余名额:{count}"],capacityAvailable:["Available","可预约"],capacityLimited:["Limited availability","剩余量有限"],updatingQuote:["Updating price…","正在更新报价…"],selected:["Selected","已选"],extras:["Extras","附加商品"],navExtras:["Extras","附加商品"],nextExtras:["Continue: extras","继续:附加商品"],skipExtras:["Skip extras and continue","不加购,继续下一步"],editExtras:["Review extras","修改附加商品"],unavailableExtra:["Unavailable extra","已下架附加商品"],extraUnavailable:["Some extras are unavailable. Remove them or adjust their quantity to continue.","部分附加商品已不可购买,请移除或调整数量后继续。"],selectedTickets:["{count} tickets selected","已选 {count} 张"],selectedTicketCorner:["Selected {count}","已选 {count} 张"],fullProductInfo:["View details","查看详情"],walletPassTitle:["Wallet Pass","卡券/通票"],walletPassLogin:["Sign in to view your passes","登录查看可用卡券/通票"],walletPassUnsupported:["Wallet Pass is not available for this booking.","此预约暂不支持卡券/通票。"],walletPassLoading:["Loading your passes…","正在读取卡券/通票…"],walletPassLoadFailed:["Your passes could not be loaded. Please try again.","卡券/通票加载失败,请重试。"],walletPassEmpty:["You have no passes for this booking.","此预约暂无可用卡券/通票。"],walletPassUses:["{count} visits remaining","剩余 {count} 次"],walletPassUnavailable:["This pass cannot be used for the current booking. Remove it or choose another.","此卡券/通票不适用于当前预约,请移除或重新选择。"],walletPassRemove:["Remove selected pass","移除已选卡券/通票"],walletPassApplied:["Pass applied","已使用卡券/通票"],benefitsTitle:["Use offers","使用优惠"],benefitsSaved:["Saved {amount}","已优惠 {amount}"],benefitsUpdating:["Updating savings…","优惠计算中…"],benefitsAttention:["Review offers","优惠需处理"],benefitsDone:["Done","完成"],benefitsNoOffers:["You have no offers available. You can still enter a promo code.","暂无账号优惠券,你仍可输入优惠码。"],benefitsQuoteFailed:["We couldn’t update your total. Close this panel and retry the quote on the checkout page.","订单金额更新失败,请关闭弹窗,在结账页重试报价。"],redemptionCodes:["Admission codes","入场核销码"],redemptionCode:["Admission code","核销码"],redemptionUnavailable:["Your admission code is not available yet. Check your booking details or contact the venue.","暂未取得核销码,请查看订单详情或联系场馆。"],redemptionUsed:["Already redeemed","已核销"],redemptionExpired:["Expired","已过期"],redemptionVoid:["No longer valid","已失效"],showRedemption:["Show this code when you arrive.","到场时请出示此码。"],demoRedemption:["Demo code \xb7 not valid for real admission","演示核销码 \xb7 不可用于真实入场"],chooseResourceTitle:["Choose a play space","选择场地"],chooseResource:["Choose a play space to continue.","请选择场地后继续。"],resourceChanged:["Your saved play space is no longer offered. Confirm the available space to choose a new time.","原选场地已不再提供,请确认当前可用场地后重新选择时间。"],useResource:["Use {name}","使用{name}"],chooseResourceRights:["Your choice of play space","自选游玩场地"],resourceAdmission:["Play space admission","场地入场"],resourceAvailable:["Available times","有可预约时间"],resourceRemaining:["{count} places left","剩余 {count} 人名额"],resourcePeople:["Up to {count} people","最多 {count} 人"],resourceInsufficient:["Only {count} places left \xb7 reduce quantity","仅剩 {count} 人名额,请减少数量"],resourceFull:["Fully booked","已约满"],resourceNotOpen:["Not open for bookings","未开放预约"],resourceTimeUnavailable:["Unavailable at this time","该时间不可预约"],resourceLoadFailed:["Some play spaces could not be checked. Try again, or choose an available space.","部分场地查询失败,请重试或选择其他可预约场地。"],resourceCapacity:["There are not enough places for this group. Choose another space or time, or reduce the quantity.","该场地在此时间的名额不足,请更换场地、时间或减少数量。"],payNow:["Pay now","立即付款"],paymentRecoveryHint:["Your choices are saved. Check the payment status before trying again.","已保存您的选择,请查询付款状态后再操作。"],openCalendar:["Open calendar","打开日历"],closeCalendar:["Close calendar","关闭日历"],chooseVisitDate:["Choose your visit date","选择游玩日期"],chooseDate:["Choose a date","选择日期"],previousWeek:["Previous week","上一周"],nextWeek:["Next week","下一周"],backThisWeek:["This week","回到本周"],calendarToday:["Today","今天"],previousMonth:["Previous month","上个月"],nextMonth:["Next month","下个月"],calendarMonth:["Month","月份"],calendarYear:["Year","年份"],calendarThisMonth:["This month","回到本月"],calendarVenueTime:["Dates follow venue local time","日期按场馆当地时间"],dateNeedsReselect:["This date is no longer available. Please choose an available date.","此日期已不可预约,请重新选择可用日期。"],validPlayTime:["Your playtime","游玩有效时间"],playStartTime:["Start playing at","开始游玩时间"],timeNotSelected:["Not selected","待选择"],timeLoading:["Updating…","更新中…"],timeLoadFailed:["Load failed","加载失败"],timeUnavailable:["Unavailable","暂无时段"],timeNeedsDate:["Choose today","请选择今天"],immediateTimeHint:["Your start time is recorded when you add this ticket.","开始时间以加入订单时为准。"],closesAt:["Closes","闭馆"],startUnavailable:["This start time is unavailable. Choose a listed time or another date.","此开始时间不可预约,请选择可用时间或更换日期。"],noPlayTimes:["No available playtime","当日暂无可预约时间"],tryAnotherDate:["Try another date; available times depend on this ticket and its play areas.","请更换日期;可预约时间以本票及所含区域的安排为准。"],otherTimes:["View unavailable sessions","查看不可预约场次"],untilClosing:["Until closing","至闭馆"],duringOpening:["During opening hours","营业时间内有效"],todayOnlyTime:["This ticket starts now","本票从当前时间开始"],todayOnlyTimeHint:["Choose today to book immediate entry. Future dates need a ticket with a scheduled start.","即入门票仅支持当天,请选择今天;其他日期请选择可预约开始时间的门票。"],useToday:["Use today for this ticket","此门票改为今天"],timeRuleChanged:["The time rules have changed. Edit this ticket to review and confirm its new validity.","时间规则已变更,请修改此门票,重新核对并确认有效时间。"],timeUpdated:["The available time has changed. Check the time shown before adding.","可用时间已更新,请核对上方有效时间后添加。"],timeConfigTitle:["Ticket & resource time rules","门票与资源时间配置"],timeConfigHint:["Local demo settings. Ticket names do not determine validity; these rules do. Existing tickets keep their recorded time and may need editing after a rule change.","本地演示配置。商品标题不决定权益,实际有效时间由以下规则控制。修改规则后,已选票保留原时间,可能需要重新编辑确认。"],productTimeRules:["Ticket time rule","门票时间规则"],configureProduct:["Ticket product","配置门票"],timeMode:["Validity rule","有效时间规则"],modeFixed:["Fixed sessions","固定时间段"],modeDuration:["Fixed duration \xb7 flexible start","固定时长 \xb7 灵活开始"],modeAllDay:["Opening-hours window","全天 \xb7 营业时间范围"],modeUntilClose:["Choose a start \xb7 until closing","选择开始时间 \xb7 至闭馆"],customerChoosesStart:["Ask the guest to choose a start time","需要客人选择开始时间"],customerStartHint:["The selected time becomes the ticket’s actual validity start. With this off, opening-hours tickets use the full window; fixed-duration tickets start now and are today-only.","开启后,所选时间就是门票实际生效时间。关闭时,全天规则使用完整营业时间;固定时长规则从当前时间开始,仅支持当天。"],configuredDuration:["Play duration (minutes)","游玩时长(分钟)"],startInterval:["Start time increment","开始时间间隔"],fixedStarts:["Session starts (comma-separated)","固定场次开始时间(逗号分隔)"],resourceTimeRules:["Resource opening hours","资源营业时间"],configureResource:["Resource","配置资源"],venueResource:["Venue / lobby","场馆/大厅"],opensAt:["Opens","开门"],resourceInterval:["Resource start increment","资源开始时间间隔"],resourceTimeHint:["A ticket must fit within the venue and every included area’s hours. Time increments must also satisfy each resource.","门票时间需同时满足场馆及所有绑定区域的营业时间和开始间隔。"],applyTimeRules:["Save time rules","保存时间配置"],resetTimeRules:["Restore default time rules","恢复默认时间规则"],timeRulesSaved:["Time rules saved. Review any existing tickets before payment.","时间配置已保存;付款前请核对已有门票的有效时间。"],invalidTimeConfig:["Enter valid opening hours and session times.","请填写有效的营业时间和场次时间。"],book:["Book a play session","预约欢乐时光"],basket:["My order","我的订单"],plan:["Choose tickets","选择门票"],details:["Participants","参加者信息"],confirm:["Review & pay","确认并支付"],booked:["You’re booked","预约成功"],bookingNavigation:["Booking steps","预约步骤导航"],navPlan:["Tickets","选择门票"],navDetails:["Details","参加者"],navReview:["Review","确认支付"],currentStep:["Current step","当前步骤"],jumpToStep:["Click a step to go back or continue.","点击已解锁的步骤,可快捷切换或返回修改。"],addTicketsFirst:["Add tickets to unlock the next steps.","先添加门票,解锁后续步骤。"],previousStep:["Back","上一步"],nextStep:["Next","下一步"],nextDetails:["Next: participants","下一步:参加者信息"],nextReview:["Next: review & pay","下一步:确认与支付"],participantsNotRequired:["Not required for these tickets","所选门票无需填写参加者"],heroTitle:["A little play.\nA big day.","小小玩乐,\n大大快乐。"],heroSub:["Find their perfect ticket to a happy day.","选一张心仪的门票,开启孩子的快乐天地。"],homeEyebrow:["SYDNEY’S LITTLE HAPPY PLACE","悉尼的亲子欢乐天地"],homeTitle:["Big smiles.\nLittle adventures.","小小冒险,\n满满笑容。"],homeSub:["A world of bouncing, climbing and make-believe. Make a little time for a whole lot of happy.","蹦跳、攀爬、天马行空的想象。留一点时间,收获一整天的快乐。"],explore:["Find their happy place","发现孩子的快乐天地"],exploreSub:["Three ways to play. A thousand reasons to smile.","三种游玩方式,无数个开心的理由。"],viewArea:["Find tickets","查看相关门票"],safe:["Little people. Big peace of mind.","孩子玩得开心,家长更安心。"],timed:["Your time to play","专属游玩时间"],family:["Made for families","为亲子家庭设计"],ready:["Ready, set, happy.","准备好,一起快乐出发。"],readySub:["Arrive 15 minutes early. Bring comfy clothes and your biggest smile.","建议提前 15 分钟到场,穿上舒适衣服,带上开心的笑容。"],previous:["Previous","上一页"],next:["Next","下一页"],today:["Today","今天"],soldOut:["Sold out","已售罄"],notOpen:["Unavailable","不可预约"],minutes:["minutes of happy","分钟欢乐时光"],sydneyTime:["All times are venue local time","所有时间均为场馆当地时间"],updateBasket:["Save changes","保存修改"],total:["Total","合计"],subtotal:["Subtotal","小计"],discount:["Discount","优惠"],chooseSession:["Choose your session","选择场次"],selectTickets:["Choose at least one ticket.","请至少选择一张票。"],capacity:["There aren’t enough spots for these tickets. Choose another time or reduce the quantity.","本场次余位不足,请更换时段或减少票数。"],added:["A little happy, added to your basket.","欢乐已加入购物车。"],saved:["Your session has been updated.","场次已更新。"],edit:["Edit","修改"],remove:["Remove","删除"],undo:["Undo","撤销"],removed:["Ticket removed.","门票已删除。"],groupRemoved:["Tickets removed.","门票已删除。"],emptyTitle:["A little empty. For now.","还空着,等你添点快乐。"],emptySub:["Your next happy day starts with a ticket.","下一段欢乐时光,从选择一张门票开始。"],tickets:["tickets","张票"],ticket:["Ticket","门票"],childPending:["Child details to add","待补充儿童信息"],notes:["Anything we should know?","有什么需要我们留意?"],optional:["Optional","选填"],notesHint:["Add a note for our team…","给场馆团队留言…"],notesHelp:["Requests are subject to confirmation. Please don’t include sensitive information.","特殊需求以场馆确认为准,请勿填写敏感信息。"],promo:["A little treat?","让快乐再优惠一点"],promoHint:["Enter a promo code","输入优惠码"],apply:["Apply","使用"],couponApplied:["Promo code applied.","优惠码已使用。"],couponInvalid:["We couldn’t find that code. Try HAPPY10.","没有找到该优惠码,请试试 HAPPY10。"],couponExpired:["This offer has expired. Remove it or choose another.","该优惠已过期,请移除或更换。"],couponMinimum:["PLAY5 needs a ticket subtotal of A$50.","PLAY5 需门票小计达到 A$50。"],accountOffers:["Your offers","你的优惠券"],offer10:["10% off your play day","游玩订单享九折"],offer5:["A$5 off orders of A$50+","满 A$50 减 A$5"],offerLittle:["A$5 off the Little Explorers toddler ticket","小小探索家幼儿单区票减 A$5"],offerHint:["One offer per order. Rechecked when your basket changes.","每单限用一张优惠券,购物车变化后重新计算。"],loginOffers:["Sign in to see your offers","登录查看你的优惠券"],checkout:["Continue to checkout","前往结算"],loginTitle:["Welcome to the sunny side.","欢迎来到欢乐的一边。"],loginSub:["Sign in to keep your little explorers and bookings together.","登录后可管理儿童档案与预约。"],demoLogin:["Demo sign-in","演示登录"],demoLoginHint:["This prototype uses a demo account. No email is sent and no password is needed.","此原型使用演示账号,不会发送邮件,也无需真实密码。"],email:["Email address","电子邮箱"],signIn:["Continue with demo account","使用演示账号继续"],signingIn:["Signing in…","正在登录…"],close:["Close","关闭"],hello:["Hi, Alex","你好,Alex"],signOut:["Sign out","退出登录"],loginRequired:["Sign in to add participant details.","登录后即可填写参加者信息。"],detailsTitle:["Meet the little adventurers.","认识今天的小小冒险家。"],detailsSub:["Match each child ticket to its explorer. Adults don’t need a profile.","为每张儿童票选择参加者,成人票无需儿童档案。"],completed:["complete","已完成"],chooseChild:["Choose a child","选择儿童"],addChild:["Add a child","新增儿童"],newChild:["A new little explorer","新增小小探索家"],childName:["Child’s name","儿童姓名"],dob:["Date of birth","出生日期"],dobHelp:["Age on the visit date is used for guidance only. It will not prevent a booking.","游玩当日年龄仅用于建议提示,不影响购买。"],saveChild:["Save child","保存儿童信息"],childConsent:["Saved for reuse across your bookings.","保存到此演示账号,可在不同场次复用。"],invalidDob:["Enter a valid date of birth, no later than today.","请输入有效出生日期,不能晚于今天。"],nameRequired:["Please enter a name.","请填写姓名。"],emailInvalid:["Enter a valid email address.","请输入有效邮箱。"],childMissing:["Choose a child for this ticket.","请为这张票选择儿童。"],duplicateChild:["This child already has a ticket for this session.","该儿童已绑定此场次的另一张门票。"],invalidTicket:["This ticket is not available in this area.","此票种不适用于当前区域。"],contact:["Who can we get in touch with?","我们可以联系谁?"],phone:["Phone number","联系电话"],review:["Review your booking","确认预约信息"],checkDetails:["A few details need your attention.","还有一些信息需要处理。"],agreement:["Area agreement","区域协议"],confirmAgreement:["Confirm","确认"],accepted:["Agreed","已同意"],notAccepted:["Needs your agreement","待确认协议"],agreementRequired:["Please agree to this area’s current agreement.","请阅读并同意当前版本协议。"],version:["Version","版本"],demoAgreement:["Demo terms for this prototype. Not a legal waiver.","此为原型演示条款,不构成法律责任豁免。"],pay:["Pay","支付"],demoPay:["Simulate payment","模拟付款"],demoPayShort:["Demo pay","模拟付款"],demoPayHint:["Demo checkout \xb7 No real payment or reservation is made.","演示结算 \xb7 不会真实扣款或预订。"],processing:["Checking your booking…","正在检查预约…"],priceChanged:["The ticket price changed. We’ve updated your total. Review it and submit again to confirm.","票价发生变化,已更新总额。请确认新金额后再次提交。"],unavailable:["This session no longer has enough spots. Edit or remove it to continue.","该场次余位已不足,请修改或删除后继续。"],emptyCart:["Your basket is empty.","购物车为空。"],loadError:["We couldn’t load playtimes. Your choices are saved.","暂时无法加载时段,已保留你的选择。"],retry:["Try again","重试"],paymentFailed:["Payment was declined. Your basket is saved. You can try again.","付款未通过,购物车已保留,可以重试。"],paymentPending:["We’re checking your payment.","正在确认付款结果。"],pendingSub:["Your booking is not confirmed yet. Please don’t submit another payment.","预约尚未确认,请勿重复支付。"],checkPayment:["Check payment status","查询付款状态"],successTitle:["Here comes a happy day!","欢乐的一天,要来啦!"],successSub:["Your booking is confirmed. We can’t wait to see those smiles.","预约已确认,期待一起创造快乐回忆。"],bookingRef:["Booking reference","预约编号"],itinerary:["Your play-day plan","你的游玩行程"],download:["Download booking","下载预约凭证"],bookMore:["Plan another happy day","再安排一段欢乐"],bookingDetails:["Booking details","预约详情"],noBooking:["No booking to show yet.","暂时没有预约记录。"],arrival:["A little before you arrive","出发前的小提醒"],arrivalText:["Arrive 15 minutes early. Wear comfortable clothes. Check your area agreement for equipment requirements.","建议提前 15 分钟到场,穿着舒适衣物,装备要求请查看对应区域协议。"],confirmationEmail:["Booking contact","预约联系人"],orderNote:["Your note","订单备注"],date:["Date","日期"],time:["Time","时间"],area:["Play area","游玩区域"],payment:["Payment","付款"],confirmed:["Confirmed","已确认"],demo:["Prototype","交互原型"],demoControls:["Demo scenarios","演示场景"],demoTitle:["Test a different kind of day.","试试不同的预约情况。"],demoSub:["These controls only affect this local prototype. Your basket is kept when switching scenarios.","这些控制仅影响本地原型,切换场景会保留购物车。"],normal:["Normal booking","正常预约"],soldOutScenario:["11:30 sells out \xb7 selectable spaces fully booked","11:30 场次售罄 \xb7 可选场地全部满员"],priceChangeScenario:["Price rises A$2 per ticket at payment","提交时每张票涨价 A$2"],expiredCouponScenario:["Coupons expire","优惠券过期"],loadErrorScenario:["Playtime loading fails once","首次时段加载失败"],paymentFailScenario:["First payment fails","首次付款失败"],paymentPendingScenario:["Payment awaits confirmation","付款结果待确认"],singleAreaScenario:["Only one ticket available","只有一种可售门票"],reset:["Reset demo data","重置演示数据"],resetHint:["Clears this demo basket, profiles and booking.","清除演示购物车、档案与预约。"],backPlan:["Back to tickets","返回选票"],footerNote:["A little play goes a long way.","小小玩乐,收获满满。"],demoFooter:["Interactive prototype \xb7 Sydney \xb7 AUD","交互原型 \xb7 悉尼 \xb7 澳元"],loading:["Finding your happy time…","正在寻找欢乐时段…"],session:["session","个场次"],sessions:["sessions","个场次"],learnMore:["Plan your visit","到访须知"],age:["years old on visit date","岁(游玩当日)"],noChildNeeded:["No child details required","无需儿童信息"],allAccess:["All areas included","全区域通玩"],lobbyOnly:["Lobby admission","仅大厅入场"],singleAreaTicket:["One play area included","包含一个游玩区域"],noPlayAreas:["Lobby only \xb7 No play areas included","仅大厅入场,不含游玩区域"],suggestedAge:["Suggested ages","建议年龄"],minuteUnit:["minutes","分钟"],perPerson:["per person","/人"],visitDate:["Visit date","游玩日期"],quantity:["Number of tickets","门票数量"],chooseRemoval:["Choose the participant ticket to remove.","请选择要移除的参加者门票。"],addTickets:["Add tickets","添加门票"],addTicketsCompact:["Add","添加"],saveTicketsCompact:["Save","保存"],ticketAdded:["Tickets added to your day.","门票已加入本次订单。"],filterTickets:["Filter tickets by audience","按人群筛选门票"],quickVisitDates:["Choose a day this week","快捷选择游玩日期"],sharedVisitDate:["Your visit date","本次游玩日期"],sharedDateHint:["Used for new tickets.","新添加的门票自动沿用"],changeDate:["Change date","更改日期"],ticketDateHint:["Need a different day? Change this ticket only.","需要另一天游玩?可仅修改这张门票的日期。"],noMatchingTickets:["No tickets match these filters.","暂无符合筛选条件的门票。"],allTickets:["All tickets","全部门票"],childrenTickets:["Children","儿童"],adultTickets:["Adults","成人"],ticketsIncluding:["Tickets including","包含以下区域的门票:"],showAllTickets:["View all tickets","查看全部门票"],chooseTicket:["Choose ticket","选择门票"],pickTicketsHint:["Pick a ticket to start your family’s adventure.","选一张门票,开始安排全家的欢乐时光。"],childInvalid:["This child profile needs a valid name and date of birth. Select another profile or add corrected details.","儿童资料的姓名或生日无效,请选择其他档案或新增正确信息。"],couponProduct:["This offer applies only to the Little Explorers toddler ticket.","此优惠仅适用于小小探索家幼儿单区票。"],checkoutTitle:["Your happy day, all together.","确认门票,让快乐出发。"],contactSection:["Contact details","填写联系信息"],orderSection:["Review your tickets","确认订单信息"],agreementSection:["Confirm agreements","确认协议"],noteSection:["Leave a note","留言"],checkoutSub:["Review your tickets, add a little saving and get ready to play.","查看全家的门票,使用优惠,确认后即可出发。"],addMoreTickets:["Add more tickets","继续选购门票"],participantsIncomplete:["Some participant details still need attention. Your tickets are saved.","参加者信息尚未完成,已选门票均已保留。"],completeParticipants:["Add participant details","补充参加者信息"],completeContact:["Add contact details","补充联系人"],orderAgreementsHelp:["Open each agreement and confirm your consent in its details.","请点击协议查看详情,并在详情中确认同意。"],agreementsPending:["Agreements to confirm: {count}","还有 {count} 份协议待确认"],agreementsPaymentHelp:["Select “Read agreement” below, read the details and select “Confirm”. Confirm all agreements, then try payment again.","请点击下方“查看协议”,阅读后点击“确认”。全部确认后,再点击支付。"],readAgreement:["Read agreement","查看协议"],orderSummary:["Your order","订单明细"],orderDetailShort:["Details","明细"],checkOrder:["Check order","检查订单"],loginComplete:["Sign in & add your details","登录并补充信息"],availabilityFix:["Update the tickets marked unavailable.","请修改标记为不可预约的门票。"],confirmPrice:["Confirm new price & pay","确认新价格并付款"],confirmPriceShort:["Confirm & pay","确认并付款"],loginShort:["Sign in","登录并补充"],completeShort:["Add details","补充信息"],migrationNotice:["Some saved demo items could not be converted. The original draft is backed up in this browser; please choose those tickets again.","部分旧演示内容无法转换,原始草稿已备份在当前浏览器,请重新选择相关门票。"],timeRechoose:["That time is no longer available for this date. Please choose another time.","该时段在当前日期已不可预约,请重新选择。"],spotsLeft:["spots left","个余位"]},e0_=(e,t)=>{var l;return(null==(l=e0k[t])?void 0:l[+("en"!==e)])??t},e0w={en:{close:"Close",cancel:"Cancel",back:"Back",next:"Next",configuration:"Choose options",booking:"Choose time",confirmConfiguration:"Confirm options",confirmBooking:"Add tickets",working:"Please wait…",validationFailed:"Complete the required selections to continue.",confirmationFailed:"Unable to save your selection. Please try again.",configurationNotReady:"Options are not ready. Please close and try again.",invalidPlan:"Product details are not ready. Please close and try again."},zh:{close:"关闭",cancel:"取消",back:"上一步",next:"下一步",configuration:"选择商品选项",booking:"选择时间",confirmConfiguration:"确认选项",confirmBooking:"添加门票",working:"请稍候…",validationFailed:"请完成必选内容后继续。",confirmationFailed:"保存失败,请重试。",configurationNotReady:"商品选项尚未准备好,请关闭后重试。",invalidPlan:"商品详情尚未准备好,请关闭后重试。"}};function e0S(e){var t,l,i,a,n,r,o,s,d,c,u;let p=eJF(),m=null==p?void 0:p.brandTokens,[g]=(0,eC.useState)(()=>e.plan),[h,v]=(0,eC.useState)(g.hasConfiguration?"configuration":"booking"),[f,y]=(0,eC.useState)(!1),[b,x]=(0,eC.useState)(!1),[k,_]=(0,eC.useState)(!1),[w,S]=(0,eC.useState)(),[j,N]=(0,eC.useState)(null),[C,M]=(0,eC.useState)(!1),T=(0,eC.useRef)(null),I=(0,eC.useRef)(null),P=(0,eC.useRef)(0),A=(0,eC.useRef)(!0),D=(0,eC.useRef)(e);D.current=e;let E=(0,eC.useRef)(e.configuration);E.current=e.configuration;let O=(0,eC.useRef)(null);null===O.current&&(O.current=(0,no.cloneDeep)(e.configuration));let z=(0,eC.useRef)(null),L=(0,eC.useRef)(0);(0,no.isEqual)(O.current,e.configuration)||(z.current&&(0,no.isEqual)(z.current,e.configuration)||(L.current+=1),z.current=null,O.current=(0,no.cloneDeep)(e.configuration));let R=e.locale||"en",$="edit-draft"===g.intent,F={...e0w[R],...$?{confirmBooking:e0_(R,"updateBasket")}:{},...e.labels},q=!!e.busy||b||k,B=!g.openId||!g.scopeKey||!g.detailRevision||!g.productDetail||String(null==(t=e.configuration.skuValue)?void 0:t.product_id)!==String(g.productDetail.id)||"product-configuration"===g.mode&&(!g.hasConfiguration||!e.onConfigurationConfirm)||"ticket-booking"===g.mode&&(!e.renderBooking||!e.onConfirm),H="ticket-booking"===g.mode,V=H&&g.hasConfiguration;(0,eC.useEffect)(()=>(A.current=!0,()=>{var e;A.current=!1,P.current+=1,null==(e=I.current)||e.abort()}),[]);let U=(0,eC.useCallback)(e=>{T.current=e,M(!!e)},[]),Y=()=>{var t;q||(P.current+=1,null==(t=I.current)||t.abort(),e.onCancel())},W=()=>{!q&&V&&(S(void 0),y(!0),v("configuration"),null==j||j.scrollTo({top:0}))},K=async()=>{var e,t,l,i,a,n,r,o,s,d;if(q||B||I.current)return;let c=new AbortController,u=++P.current,p=D.current.selectionRevision,m=L.current;I.current=c;let f={openId:g.openId,scopeKey:g.scopeKey,detailRevision:g.detailRevision,signal:c.signal,isCurrent:()=>A.current&&!c.signal.aborted&&P.current===u&&L.current===m&&("booking"!==h||D.current.selectionRevision===p)};x(!0),S(void 0);let b="validation";try{let s=E.current;if("configuration"===h){let e=T.current;if(!C||!e)return void S(F.configurationNotReady);if(!1!==D.current.requiredOptionValidation&&await e.validate(),!f.isCurrent())return;let t=iC(g.productDetail,e.getTransformValues(),{requiredOptionValidation:D.current.requiredOptionValidation,overSold:(null==(i=D.current.skuOptions)||null==(l=i.config)?void 0:l.overSold)===1||(null==(n=D.current.skuOptions)||null==(a=n.config)?void 0:a.overSold)==null&&lZ(g.productDetail.over_sold)});if(!t)return void S(F.validationFailed);if(s={skuValue:t,variantDraft:E.current.variantDraft},E.current=s,z.current=(0,no.cloneDeep)(s),D.current.onConfigurationChange(s),H){if(await (null==(r=(o=D.current).onConfigurationContinue)?void 0:r.call(o,s,f)),!f.isCurrent())return;y(!0),v("booking"),null==j||j.scrollTo({top:0});return}}else if(!H||!D.current.bookingReady)return;b="confirmation";let d=H?await D.current.onConfirm(s,f):await (null==(e=(t=D.current).onConfigurationConfirm)?void 0:e.call(t,s,f));f.isCurrent()&&!1!==d&&_(!0)}catch(e){if(!f.isCurrent())return;S("validation"===b?F.validationFailed:F.confirmationFailed),null==(s=(d=D.current).onError)||s.call(d,e,b)}finally{A.current&&P.current===u&&x(!1),I.current===c&&(I.current=null)}},G=q||B||("configuration"===h?!C:!H||!e.bookingReady),Q={mode:g.mode,step:h,configuration:e.configuration,busy:q},Z="function"==typeof e.footerContent?e.footerContent(Q):e.footerContent,J="configuration"===h?e.configurationFooter:void 0,X="configuration"===h?H?F.next:F.confirmConfiguration:F.confirmBooking,ee=B?F.invalidPlan:w||e.error,et=H||!!J,el=H&&"booking"===h?e.bookingActionAmount??"—":(null==J?void 0:J.amount)??null,ei=H&&"booking"===h?e.bookingSubtotalLabel??e0_(R,"subtotal"):(null==J?void 0:J.label)??(H?void 0:e0_(R,"subtotal")),ea=(null==(l=e.skuOptions)?void 0:l.type)||"flat",en=null==(i=e.skuOptions)?void 0:i.presentation,er="function"==typeof e.getContainer?e.getContainer():"string"==typeof e.getContainer?document.querySelector(e.getContainer):e.getContainer,eo=V?(0,eH.jsx)("div",{className:"pisell-booking-product-detail-steps",children:(0,eH.jsx)(e0l,{current:+("configuration"!==h),label:"zh"===R?"商品选择步骤":"Product selection steps",currentLabel:"zh"===R?"当前步骤":"Current step",steps:[{id:"configuration",label:F.configuration,status:"configuration"!==h&&q?"locked":"available",onClick:W},{id:"booking",label:F.booking,status:"booking"===h?"available":"locked"}]})}):null;return(0,eH.jsx)(e0t,{title:e.title,onClose:Y,closeLabel:F.close,closeDisabled:q,wide:!0,className:`${H?"reservation-modal":"party-package-dialog"} pisell-booking-product-detail-modal ${e.className||""}`,bodyClassName:`${H?"reservation-content":"package-config-body"} pisell-booking-product-detail-body`,footerClassName:`${et?"booking-config-dialog-footer":"package-config-footer"} pisell-booking-product-detail-footer`,mobile:"fullscreen",bodyRef:N,portal:er,zIndex:600,externalDialogSelector:eX9,style:{...e.width?{width:e.width}:{},...e.style},footer:et?(0,eH.jsx)(eXR,{leading:!H||"booking"===h||J?Z:void 0,label:ei,amount:el,action:{label:k?F.working:X,disabled:G,busy:b||e.busy,onClick:K},feedback:ee&&(0,eH.jsx)("p",{className:"error-text pisell-booking-product-detail-error",role:"alert",children:ee})}):(0,eH.jsxs)(eH.Fragment,{children:[ee&&(0,eH.jsx)("div",{className:"error-text pisell-booking-product-detail-error",role:"alert",children:ee}),Z&&(0,eH.jsx)("div",{className:"pisell-booking-product-detail-footer-content",children:Z}),(0,eH.jsxs)("div",{className:"package-config-footer-actions pisell-booking-product-detail-actions",children:[(0,eH.jsx)(eXE,{secondary:!0,disabled:q,onClick:Y,children:F.cancel}),(0,eH.jsx)(eXE,{disabled:G,busy:b||e.busy,onClick:()=>void K(),children:(0,eH.jsx)("span",{children:k?F.working:X})})]})]}),children:(0,eH.jsxs)("div",{"aria-busy":q,children:[eo,e.summary&&(0,eH.jsx)("div",{className:"pisell-booking-product-detail-summary",children:e.summary}),!B&&"configuration"===h&&(0,eH.jsx)("div",{className:"pisell-booking-product-detail-sku-guard venue-booking-legacy-controls","aria-disabled":q,style:q?{pointerEvents:"none"}:void 0,onKeyDownCapture:e=>{q&&"Tab"!==e.key&&(e.preventDefault(),e.stopPropagation())},children:(0,eH.jsx)($$,{...e.skuOptions,ref:U,type:ea,presentation:"flat"===ea?{...en,modal:{...null==en?void 0:en.modal,style:{...null==en||null==(a=en.modal)?void 0:a.style,...(null==p?void 0:p.fontFamily)?{fontFamily:p.fontFamily}:{}},className:[null==(o=$I(ea))||null==(r=o.presentation)||null==(n=r.modal)?void 0:n.className,null==en||null==(s=en.modal)?void 0:s.className,"pisell-booking-product-detail-options-modal"].filter(Boolean).join(" ")}}:en,theme:(null==(d=e.skuOptions)?void 0:d.theme)||{token:{colorPrimary:null==m?void 0:m["--primary"],colorPrimaryBg:null==m?void 0:m["--primary-soft"]}},config:(null==(c=e.skuOptions)?void 0:c.config)||{overSold:+!!lZ(g.productDetail.over_sold)},dataSource:g.productDetail,value:e.configuration.skuValue,variantDraft:e.configuration.variantDraft,selectionKey:g.selectionKey,initializationPolicy:f||"edit-draft"===g.intent?"preserve":(null==(u=e.skuOptions)?void 0:u.initializationPolicy)||"auto-required-defaults",disabled:!!e.busy||k,customScrollParent:j||void 0,className:"pisell-booking-product-detail-sku",onChange:(t,l)=>{if(b||k||e.busy)return;let i={skuValue:t,variantDraft:void 0===l?E.current.variantDraft:l.variantDraft};E.current=i,e.onConfigurationChange(i),S(void 0)}})}),!B&&H&&"booking"===h&&e.renderBooking({plan:g,configuration:e.configuration,busy:q,scrollContainer:j,backToConfiguration:W})]})})}let e0j=function(e){let t,l=eJF();if(!e.plan)return null;let i=(0,eH.jsx)(e0S,{...e},JSON.stringify([(t=e.plan).openId,t.scopeKey,t.detailRevision,t.mode,t.selectionKey]));return l?i:(0,eH.jsx)(eXc,{lang:e.locale||"en",children:i})},e0N={en:{date:"Choose a date",time:"Choose a time",room:"Choose a room",resource:"Choose an area",selectTime:"Choose a time to see available areas.",selectRoom:"Choose a room for this time.",timeBeforeRoom:"Choose a time to see available rooms.",timeForRooms:"Choose available rooms for this time.",checking:"Checking availability…",noTimes:"No available times for this selection.",noResources:"No resources are available for this selection.",none:"No selection",optional:"Optional",retry:"Check again",reselect:"Choose again",unavailable:"Unavailable for this selection",selectedUnavailable:"Your previous selection is unavailable. Please choose again.",configuration:"This product’s booking configuration is incomplete. Please contact the venue.",resourceRequired:"Choose one option in each required group.",singleResource:"Choose one option in this group.",chooseTime:"Choose an available time.",quantity:"Choose a valid quantity.",changed:"Your selection has changed. Please review it before continuing.",requestFailed:"Availability could not be checked. Please try again.",reconciliation:"The booking result needs to be checked. Return to your order before trying again.",ready:"This selection is available.",dateFailed:"The date could not be changed. Please try again."},zh:{date:"选择日期",time:"选择时间",room:"选择房间",resource:"选择区域",selectTime:"请先选择时间,再查看可用区域。",selectRoom:"请选择该时段的房间。",timeBeforeRoom:"请先选择时间,再查看可用房间。",timeForRooms:"请先选择在该时段可用的房间。",checking:"正在查询可用性…",noTimes:"当前选择没有可用时段。",noResources:"当前选择没有可用资源。",none:"不选择",optional:"选填",retry:"重新查询",reselect:"重新选择",unavailable:"当前选择不可用",selectedUnavailable:"之前选择的时间或资源已不可用,请重新选择。",configuration:"该商品的预约配置不完整,请联系场馆。",resourceRequired:"请为每个必选组选择一项。",singleResource:"同一组只能选择一项。",chooseTime:"请选择可用时段。",quantity:"请选择有效数量。",changed:"选择已变更,请核对后继续。",requestFailed:"暂时无法查询可用性,请重试。",reconciliation:"本次预约写入结果需要核对,请返回订单查看后再试。",ready:"当前选择可用。",dateFailed:"日期变更失败,请重试。"}};function e0C(e,t){let l=e0N[t],i={past:["This time has passed.","该时段已结束。"],outside_operating_hours:["Outside venue opening hours.","不在场馆营业时间内。"],outside_resource_window:["This area is not open at this time.","该资源在此时段不开放。"],schedule_excluded_date:["Not offered on this date.","此日期未开放预订。"],capacity_full:["Not enough capacity for this selection.","剩余容量不足。"],resource_capacity_exceeded:["Not enough capacity for this selection.","剩余容量不足。"],resource_occupied:["Already booked at this time.","该时段已被预订。"],cart_occupied:["Reserved by another item in your order.","与订单内另一项预约冲突。"],selection_occupied:["Conflicts with the current selection.","与当前选择冲突。"],booking_cutoff_invalid:["Booking rules need to be checked by the venue.","预订截止配置有误,请联系场馆。"],booking_cutoff_future_day:["This date is not open for booking yet.","该日期暂未开放预订。"],booking_cutoff_after_start:["The booking deadline has passed.","已过预订截止时间。"],booking_cutoff_before_start:["The booking deadline has passed.","已过预订截止时间。"],booking_cutoff_advance:["The booking deadline has passed.","已过预订截止时间。"]};return i[e]?i[e][+("zh"===t)]:e.includes("CONFIGURATION")||"UNSUPPORTED_RESOURCE_GROUP"===e||"AVAILABILITY_UNSUPPORTED"===e?l.configuration:"RESOURCE_REQUIRED"===e?l.resourceRequired:"PARTY_ROOM_REQUIRED"===e?l.selectRoom:"RESOURCE_SINGLE_SELECTION_REQUIRED"===e?l.singleResource:"TIME_REQUIRED"===e?l.chooseTime:"QUANTITY_REQUIRED"===e||"SINGLE_BOOKING_REQUIRED"===e?l.quantity:"NO_AVAILABLE_TIME"===e?l.noTimes:"AUTOMATIC_RESOURCE_UNAVAILABLE"===e?l.noResources:"SELECTED_TIME_UNAVAILABLE"===e||"SELECTED_RESOURCE_UNAVAILABLE"===e?l.selectedUnavailable:e.endsWith("_CHANGED")||"BOOKING_SELECTION_NOT_READY"===e?l.changed:"AVAILABILITY_REQUEST_FAILED"===e?l.requestFailed:l.unavailable}function e0M(e,t){var l;return(null==t||null==(l=t[String(e.formId??e.groupId)])?void 0:l.resourceSelectionMode)==="automatic"}let e0T=e=>{var t;return(Array.isArray(null==e||null==(t=e.product_resource)?void 0:t.resources)?e.product_resource.resources:[]).filter(e=>0!==Number(e.status)).map(e=>({groupId:String(e.id??e.form_id??e.code),formId:e.id??e.form_id}))};function e0I(e,t){return!e||e0T(e).some(e=>!e0M(e,t))}let e0P=(e,t)=>null!=e.requirementGroupId?String(e.requirementGroupId)===String(t.groupId):null!=e.formId&&null!=t.formId&&String(e.formId)===String(t.formId),e0A=e=>{if(null==e||""===e)return;let t=Number(e);return Number.isSafeInteger(t)&&t>0?t:void 0},e0D=e=>{if(!(!e.length||e.some(e=>!Number.isSafeInteger(Number(null==e?void 0:e.value))||0>Number(null==e?void 0:e.value))))return e0A(e.reduce((e,t)=>e+Number(t.value),0))};function e0E(e,t){var l,i,a,n,r,o;let s,d,c=void 0===t?null==e||null==(l=e._extend)?void 0:l.other:Bo(null==e||null==(i=e._extend)?void 0:i.other,t),u={...e,id:(null==e?void 0:e.id)??(null==e?void 0:e.product_id),_extend:{...(null==e?void 0:e._extend)||{},other:c}},p=[],m=(null==e||null==(a=e._data)?void 0:a.capacitys)??(null==e?void 0:e.capacity),g=[];if((null==m?void 0:m.type)==="product")s=e0D(g=ng({capacitys:m,cacheItem:u}));else if((null==m?void 0:m.type)==="package")s=e0D(g=ng({capacitys:m,cacheItem:u}));else if((null==m?void 0:m.type)==="custom"){let t=Array.isArray(m.custom)?m.custom:[],l=Array.isArray(null==e||null==(n=e._extend)?void 0:n.capacity)?e._extend.capacity:[];t.length&&t.every(e=>{let t=l.find(t=>String(null==t?void 0:t.id)===String(e.id)),i=Number(null==t?void 0:t.value);return t&&Number.isSafeInteger(i)&&i>=Number(e.min)&&i<=Number(e.max)})?g=t.map(e=>l.find(t=>String(t.id)===String(e.id))):t.length&&t.every(e=>Number.isSafeInteger(Number(e.min))&&Number(e.min)>=0&&Number(e.min)<=Number(e.max))&&(g=ng({capacitys:m,cacheItem:u})),s=e0D(g)??e0A(m.default)}else{s=e0A((null==m?void 0:m.default)??m);let t=null==e||null==(r=e._extend)?void 0:r.capacity;if(!s&&Array.isArray(t)&&(s=e0D(t)),!s){let t=((null==e||null==(o=e.product_resource)?void 0:o.resources)||[]).filter(e=>(null==e?void 0:e.status)!==0).map(e=>e0A(e.capacity_required));t.length&&t.every(e=>e===t[0]&&void 0!==e)&&(s=t[0])}}s||p.push("CAPACITY_CONFIGURATION_REQUIRED"),g.length&&(u._extend.capacity=g);let h=(null==e?void 0:e.duration)??(null==e?void 0:e.service_duration),v=null==h?void 0:ol(h);if("flexible"===v);else if("number"==typeof v||"string"==typeof v){let e=Number(v);Number.isFinite(e)&&e>0?d=e:null!=v&&p.push("DURATION_CONFIGURATION_REQUIRED")}else null!=v&&p.push("UNSUPPORTED_DURATION_CONFIGURATION");let f=u.id;return null!=f&&""!==f&&Number.isFinite(Number(f))||p.push("PRODUCT_CONFIGURATION_REQUIRED"),{product:u,productId:f,partySize:s,durationMinutes:d,reasonCodes:p}}function e0O(e){var t;let l={},i=null==e||null==(t=e.product_resource)?void 0:t.resources;return Array.isArray(i)&&i.filter(e=>(null==e?void 0:e.status)!==0).forEach((e,t)=>{var i;let a=e.id??e.form_id??e.code??`requirement-${t}`,n=[...Array.isArray(e.default_resource)?e.default_resource:[],...Array.isArray(e.optional_resource)?e.optional_resource:[],...(null==(i=e.combined_resource)?void 0:i.status)===1&&Array.isArray(e.combined_resource.resource_ids)?e.combined_resource.resource_ids:[]].filter(e=>"string"==typeof e||"number"==typeof e);l[String(a)]=n.filter((e,t)=>n.findIndex(t=>String(t)===String(e))===t)}),l}function e0z(e){var t,l,i,a;let n=e.product||{};return JSON.stringify({mode:e.mode,date:e.date,quantity:e.quantity,edit:e.editingProductLineUid,disabled:e.disabled,resourcePolicy:(a=e.resourceSettings,JSON.stringify(e0T(n).map(e=>[String(e.formId??e.groupId),e0M(e,a)]).sort((e,t)=>String(e[0]).localeCompare(String(t[0]))))),resourceSettingsReady:!1!==e.resourceSettingsReady,resourceSettingsFailed:!!e.resourceSettingsFailed,id:n.id??n.product_id,updatedAt:n.updated_at,sku:By((null==(t=n._extend)?void 0:t.other)??n.product_sku),capacity:(null==(l=n._data)?void 0:l.capacitys)??n.capacity,capacityValue:null==(i=n._extend)?void 0:i.capacity,duration:n.duration,serviceDuration:n.service_duration,resources:n.product_resource,schedule:n.schedule,schedules:n.schedules,session:n.session})}class e0L extends Error{constructor(e,t=Array.from(new Set(e.map(e=>e0C(e,"en")))).join(" ")){super(t),e1(this,"reasonCodes",void 0),this.reasonCodes=e,this.name="BookingSelectionError"}}let e0R=(e,t)=>String(e)===String(t),e0$=(e,t)=>("available"===e.status||"limited"===e.status)&&(null==e.maxPartySize||e.maxPartySize>=t);function e0F(e,t){return!!e&&!!t&&e0R(e.productId,t.productId)&&e.key===t.key&&e.source===t.source&&e.date===t.date&&e.businessDate===t.businessDate&&e.startAt===t.startAt&&e.endAt===t.endAt&&e.bookingStartAt===t.bookingStartAt&&e.bookingEndAt===t.bookingEndAt&&e.timezone===t.timezone&&JSON.stringify(e.scheduleRefs)===JSON.stringify(t.scheduleRefs)&&JSON.stringify(e.primaryScheduleRef)===JSON.stringify(t.primaryScheduleRef)}let e0q=(e,t)=>e0F(e,t)&&(null==e?void 0:e.availabilityContextId)===(null==t?void 0:t.availabilityContextId)&&(null==e?void 0:e.availabilityContextVersion)===(null==t?void 0:t.availabilityContextVersion);function e0B(e){return JSON.stringify([String(e.productId),e.date,e.businessDate,e.startAt,e.endAt,e.bookingStartAt||e.startAt,e.bookingEndAt||e.endAt,e.timezone])}function e0H(e,t){let l=new Map;for(let i of e){let e=e0B(i),a=l.get(e);a?(a.candidates.push(i),!e0$(a.candidate,t)&&e0$(i,t)&&(a.candidate=i)):l.set(e,{id:e,candidate:i,candidates:[i]})}return Array.from(l.values())}function e0V(e,t){return null!=e.requirementGroupId?e0R(e.requirementGroupId,t.groupId):null!=e.formId&&null!=t.formId&&e0R(e.formId,t.formId)}function e0U(e){return JSON.stringify({candidate:e.candidate&&{productId:e.candidate.productId,key:e.candidate.key,startAt:e.candidate.startAt,endAt:e.candidate.endAt},selections:e.requirementSelections.map(e=>({group:e.requirementGroupId,form:e.formId,ids:e.resourceIds.map(String).sort()})).sort((e,t)=>String(e.group??e.form).localeCompare(String(t.group??t.form)))})}function e0Y(e,t,l){let i=[];for(let n of e){var a;let e=t.filter(e=>e0V(e,n)),r=(null==(a=e[0])?void 0:a.resourceIds)||[],o=Math.max(+!!n.required,n.min||0);(o>1||n.max<o)&&i.push("UNSUPPORTED_RESOURCE_GROUP"),(e.length>1||r.length>1||r.length>n.max)&&i.push("RESOURCE_SINGLE_SELECTION_REQUIRED"),r.length<o&&i.push("RESOURCE_REQUIRED"),r.some(e=>!n.options.some(t=>e0R(t.resourceId,e)&&e0$(t,l)))&&i.push("SELECTED_RESOURCE_UNAVAILABLE")}return t.some(t=>t.resourceIds.length&&!e.some(e=>e0V(t,e)))&&i.push("SELECTED_RESOURCE_UNAVAILABLE"),Array.from(new Set(i))}function e0W(e,t,l,i){let a=e0O(l),n=t.map(e=>({...e,resourceIds:[...e.resourceIds]}));for(let t of e){if(n.some(e=>e0V(e,t)&&e.resourceIds.length))continue;let e=a[t.groupId]||(null==t.formId?[]:a[String(t.formId)])||[];if((t.required||t.min>0)&&1===e.length&&t.max>=1&&t.options.some(t=>e0R(t.resourceId,e[0])&&e0$(t,i))){let l={requirementGroupId:t.groupId,formId:t.formId,resourceIds:[e[0]]},i=n.findIndex(e=>e0V(e,t));-1===i?n.push(l):n[i]=l}}return n}function e0K(e,t){var l;t&&(null==(l=e.releaseAvailabilityContext)||l.call(e,t.contextId))}function e0G(e,t){let l=Array.from(new Set(t.filter(e0m))).sort(),i=l.indexOf(e);if(i<0)return{startDate:e,endDate:e};let a=i,n=i;for(;a>0&&e0h(l[a],-1)===l[a-1];)a--;for(;n+1<l.length&&e0h(l[n],1)===l[n+1];)n++;return{startDate:l[a],endDate:l[n]}}async function e0Q(e,t){let l;var i,a=e.os;if(!a.prepareAvailabilityProjection||!a.getProductTimeRanges||!a.queryBookingAvailability||!a.releaseAvailabilityContext)throw new e0L(["AVAILABILITY_UNSUPPORTED"]);let n=(l=e0E(e.product).reasonCodes,/^\d{4}-\d{2}-\d{2}$/.test(e.date)&&!Number.isNaN(Date.parse(`${e.date}T00:00:00Z`))&&new Date(`${e.date}T00:00:00Z`).toISOString().slice(0,10)===e.date||l.push("DATE_REQUIRED"),e0A(e.quantity)||l.push("QUANTITY_REQUIRED"),("party"===e.mode||e.editingProductLineUid)&&1!==e.quantity&&l.push("SINGLE_BOOKING_REQUIRED"),l);if(n.length)throw new e0L(n);let r=e0E(e.product),o=r.partySize,s=o*e.quantity;if(!Number.isSafeInteger(s))throw new e0L(["CAPACITY_CONFIGURATION_REQUIRED"]);let d={startDate:e.date,endDate:e.date},c=null==t?void 0:t.projectionDateRange,u=c&&e0m(c.startDate)&&e0m(c.endDate)&&c.startDate<=e.date&&c.endDate>=e.date?c:d,p={productIds:[r.productId],rawProducts:[r.product],dateRange:u,editingProductLineUids:e.editingProductLineUid?[e.editingProductLineUid]:void 0,publishCatalog:!1,refreshOccupancies:!1,strictAvailability:!0,mode:"appointment",occupancyCachePolicy:"session"},m=await e.os.prepareAvailabilityProjection(p);try{let t=(await e.os.getProductTimeRanges(m.contextId,{productIds:[r.productId],dateRange:d,partySize:s,...r.durationMinutes?{durationMinutesByProductId:{[String(r.productId)]:r.durationMinutes}}:{},...e.editingProductLineUid&&(null==(i=e.initialSelection)?void 0:i.candidate)&&r.durationMinutes?{editingStartAtByProductId:{[String(r.productId)]:e.initialSelection.candidate.startAt}}:{}})).filter(e=>e0R(e.productId,r.productId)).flatMap(e=>e.ranges||[]),l=t.length?await e.os.queryBookingAvailability(m.contextId,{target:"time",productIds:[r.productId],candidates:t,partySize:s}):void 0,a=((null==l?void 0:l.data)||[]).filter(e=>e0R(e.productId,r.productId)).flatMap(e=>e.times||[]).filter(t=>t.availabilityContextId===m.contextId&&(t.businessDate||t.date)===e.date),n=e.os.getAvailabilityResources?Array.from(await e.os.getAvailabilityResources(m.contextId,"number"==typeof(null==l?void 0:l.contextVersion)?l.contextVersion:void 0)):[];return{contextId:m.contextId,productId:r.productId,partySize:o,bookingCount:e.quantity,queryPartySize:s,times:a,resources:n,product:r.product}}catch(t){throw e0K(e.os,m),t}}async function e0Z(e,t,l){var i;let a={target:"resource",productIds:[t.productId],selectedRanges:[l],partySize:t.queryPartySize,customerSelectionSnapshot:!0},n=(await e.queryBookingAvailability(t.contextId,a)).data.filter(e=>e0R(e.productId,t.productId)).flatMap(e=>e.ranges||[]).find(e=>e0q(e.range,l));if(!n||!e0$(n,t.queryPartySize))throw new e0L((null==n||null==(i=n.reasonCodes)?void 0:i.length)?n.reasonCodes:["SELECTED_TIME_UNAVAILABLE"]);return{candidate:n.range,groups:n.requirementGroups||[]}}async function e0J(e,t,l){let i=e0B(l),a=t.times.filter(e=>e0B(e)===i),n=[];for(let l=0;l<a.length;l+=2){let i=await Promise.all(a.slice(l,l+2).map(async l=>{try{return await e0Z(e,t,l)}catch(e){if(e instanceof e0L)return;throw e}}));n.push(...i.filter(e=>!!e))}if(!n.length)throw new e0L(["SELECTED_TIME_UNAVAILABLE"]);return n}function e0X(e,t,l){let i=new Map;for(let a of e)for(let e of a.groups){let n=i.get(e.groupId);n||(n={...e,options:[]},i.set(e.groupId,n));let r=t.filter(t=>!e0V(t,e)),o=e0Y(a.groups,r,l.queryPartySize).every(e=>"RESOURCE_REQUIRED"===e);for(let t of e.options){let e=o?t:{...t,status:"unavailable",reasonCodes:["SELECTED_RESOURCE_UNAVAILABLE"]},i=n.options.findIndex(t=>e0R(t.resourceId,e.resourceId));i<0?n.options.push(e):!e0$(n.options[i],l.queryPartySize)&&e0$(e,l.queryPartySize)&&(n.options[i]=e)}}return e00(Array.from(i.values()),l)}function e00(e,t){let l=e0O(t.product);return e.map(e=>{let i=[...e.options];for(let a of l[e.groupId]||[])if(!i.some(e=>e0R(e.resourceId,a))){let e=t.resources.find(e=>e0R(e.id,a));i.push({resourceId:a,resourceName:null==e?void 0:e.name,status:"unavailable",reasonCodes:["RESOURCE_NOT_AVAILABLE_IN_CONTEXT"]})}return{...e,options:i}})}function e02(e,t){return e.resources.filter(e=>t.some(t=>t.resourceIds.some(t=>e0R(t,e.id))))}let e01=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return{status:"idle",ready:!1,reasonCodes:[],bookingCount:e,times:[],resourceGroups:[],resources:[],selectedResourceDetails:[],requirementSelections:[],resourceScrollRevision:0}},e04=e=>e instanceof e0L?e.reasonCodes:["AVAILABILITY_REQUEST_FAILED"],e03=e=>e instanceof Error?e.message:String(e),e08=e=>(null==e?void 0:e.resourceSettingsReady)===!1||(null==e?void 0:e.resourceSettingsFailed)===!0,e06=e=>({candidate:null==e?void 0:e.candidate,requirementSelections:((null==e?void 0:e.requirementSelections)||[]).map(e=>({...e,resourceIds:[...e.resourceIds]}))});class e05{publish(e){this.disposed||(this.state={...this.state,...e},this.listeners.forEach(e=>e()))}releaseCurrent(){this.input&&e0K(this.input.os,this.projection),this.projection=void 0}async setInput(e){var t;let l=e0z(e);if(this.disposed)return;if(l===this.inputKey&&e.os===(null==(t=this.input)?void 0:t.os)){this.input=e;return}let i=this.input,a=this.intent.candidate;if(i&&this.projection&&a&&!this.committing&&!e.disabled&&!this.state.requiresOrderReconciliation&&e.os===i.os&&(e.quantity===i.quantity||"ticket"===e.mode&&!e.editingProductLineUid)&&Number.isSafeInteger(e.quantity)&&e.quantity>0&&Number.isSafeInteger(this.projection.partySize*e.quantity)&&e0z({...e,quantity:i.quantity,resourceSettings:i.resourceSettings,resourceSettingsReady:i.resourceSettingsReady,resourceSettingsFailed:i.resourceSettingsFailed})===this.inputKey)return(this.input=e,this.inputKey=l,this.generation++,this.queryRevision++,this.projection={...this.projection,bookingCount:e.quantity,queryPartySize:this.projection.partySize*e.quantity},this.publish({bookingCount:e.quantity}),e08(e))?void this.publish({status:e.resourceSettingsFailed?"error":"loading",ready:!1,reasonCodes:e.resourceSettingsFailed?["AVAILABILITY_REQUEST_FAILED"]:[],error:void 0}):void await this.resolveTime(a,!1);let n=i&&!e0R(i.product.id??i.product.product_id,e.product.id??e.product.product_id);(!i||n||i.editingProductLineUid!==e.editingProductLineUid?this.intent=e06(e.initialSelection):i.date!==e.date&&(this.intent={requirementSelections:[]}),this.releaseCurrent(),this.input=e,this.inputKey=l,this.generation++,this.queryRevision++,this.committing)?this.publish({ready:!1}):await this.load()}async load(){let e,t=this.input;if(!t||this.disposed)return;if(t.disabled)return void this.publish({...e01(t.quantity),status:"blocked",reasonCodes:["BOOKING_DISABLED"]});if(e08(t))return void this.publish({...e01(t.quantity),...e06(this.intent),status:t.resourceSettingsFailed?"error":"loading",reasonCodes:t.resourceSettingsFailed?["AVAILABILITY_REQUEST_FAILED"]:[]});let l=this.generation,i=this.queryRevision;this.publish({...e01(t.quantity),status:"loading",...e06(this.intent)});try{var a;let n=null==(a=this.beforeWork)?void 0:a.call(this);if(n&&(await n,this.disposed||l!==this.generation||i!==this.queryRevision))return;if(e=await e0Q({...t,initialSelection:this.intent}),this.disposed||l!==this.generation)return void e0K(t.os,e);this.projection=e;let r=e00(function(e){let t=new Map;for(let l of e.times)for(let i of l.requirementGroups||[]){let a=t.get(i.groupId);for(let n of(a||(a={...i,options:[]},t.set(i.groupId,a)),i.options||[])){let t=e0$(l,e.queryPartySize)?n:{...n,status:"unavailable"},i=a.options.findIndex(e=>e0R(e.resourceId,t.resourceId));i<0?a.options.push(t):!e0$(a.options[i],e.queryPartySize)&&e0$(t,e.queryPartySize)&&(a.options[i]=t)}}return Array.from(t.values())}(e),e);this.publish({contextId:e.contextId,productId:e.productId,partySize:e.partySize,bookingCount:e.bookingCount,times:e.times,resourceGroups:r,resources:e.resources});let o=e.times.find(t=>e0F(t,this.intent.candidate)&&e0$(t,e.queryPartySize));if(o)return void await this.resolveTime(o,!1);let s=e0H(e.times,e.queryPartySize).filter(t=>e0$(t.candidate,e.queryPartySize));if("ticket"===t.mode&&!this.intent.candidate&&1===s.length)return void await this.resolveTime(s[0].candidate,!1);let d=e.times.some(t=>e0$(t,e.queryPartySize))?[]:["NO_AVAILABLE_TIME"];this.intent.candidate&&d.push("SELECTED_TIME_UNAVAILABLE"),"party"!==t.mode||r.length||d.push("PARTY_ROOM_CONFIGURATION_REQUIRED"),this.publish({status:d.length?"blocked":"selecting",ready:!1,reasonCodes:d,...e06(this.intent),selectedResourceDetails:e02(e,this.intent.requirementSelections)})}catch(e){if(this.disposed||l!==this.generation)return;this.publish({status:"error",ready:!1,reasonCodes:e04(e),error:e03(e)})}}async resolveTime(e,t){let l=this.projection,i=this.input;if(!l||!i)return;let a=this.generation,n=++this.queryRevision;this.intent={...this.intent,candidate:e},this.publish({status:"loading",ready:!1,reasonCodes:[],error:void 0,...e06(this.intent)});try{var r;let o=null==(r=this.beforeWork)?void 0:r.call(this);if(o&&(await o,this.disposed||a!==this.generation||n!==this.queryRevision))return;let s=await e0J(i.os,l,e);if(this.disposed||a!==this.generation||n!==this.queryRevision)return;let d=[...s].sort((t,l)=>Number(e0F(l.candidate,e))-Number(e0F(t.candidate,e))),c=s.some(e=>e.groups.some(e=>e0M(e,i.resourceSettings)))?void 0:e0W(e0X(s,this.intent.requirementSelections,l),this.intent.requirementSelections,l.product,l.queryPartySize),u=d.map(e=>{let t=c||e0W(e.groups,this.intent.requirementSelections,l.product,l.queryPartySize),a=function(e,t,l,i){let a=t.map(e=>({...e,resourceIds:[...e.resourceIds]})),n=[];for(let t of e){if(!e0M(t,l))continue;let e=a.filter(e=>e0P(e,t)),r=VR({...t,options:t.options.filter(e=>null==e.maxPartySize||e.maxPartySize>=i)}),o=1===e.length&&1===e[0].resourceIds.length&&r.some(t=>String(t.resourceId)===String(e[0].resourceIds[0])),s=t.min>1||t.max<1,d=s?[]:o?e[0].resourceIds:VF({...t,options:r},{mode:"availability"});for(let e=a.length-1;e>=0;e--)e0P(a[e],t)&&a.splice(e,1);a.push({requirementGroupId:t.groupId,formId:t.formId,resourceIds:d}),s?n.push("UNSUPPORTED_RESOURCE_GROUP"):1!==d.length&&n.push("AUTOMATIC_RESOURCE_UNAVAILABLE")}return{selections:a,reasonCodes:n}}(e.groups,t,i.resourceSettings,l.queryPartySize);return{result:e,selections:a.selections,reasons:Array.from(new Set([...e0Y(e.groups,a.selections,l.queryPartySize),...a.reasonCodes]))}}),p=u.find(e=>!e.reasons.length)||u.find(e=>e.reasons.every(e=>"RESOURCE_REQUIRED"===e))||u[0],{result:m,selections:g}=p;this.intent={candidate:m.candidate,requirementSelections:g};let h=[...p.reasons];"party"!==i.mode||m.groups.length||h.push("PARTY_ROOM_CONFIGURATION_REQUIRED"),"party"!==i.mode||this.intent.requirementSelections.some(e=>e.resourceIds.length)||h.push("PARTY_ROOM_REQUIRED");let v=g.filter(e=>!s.some(t=>t.groups.some(t=>e0M(t,i.resourceSettings)&&e0V(e,t))));return this.publish({status:h.length?"selecting":"ready",ready:!h.length,reasonCodes:h,...e06(this.intent),resourceGroups:e0X(s,v,l),selectedResourceDetails:e02(l,this.intent.requirementSelections),resourceScrollRevision:this.state.resourceScrollRevision+(t&&m.groups.length?1:0)}),this.state}catch(e){if(this.disposed||a!==this.generation||n!==this.queryRevision)return;this.publish({status:"error",ready:!1,reasonCodes:e04(e),error:e03(e)})}}dispose(){this.disposed||(this.disposed=!0,this.generation++,this.queryRevision++,this.releaseCurrent(),this.listeners.clear())}constructor(e){var t=this;e1(this,"beforeWork",void 0),e1(this,"input",void 0),e1(this,"inputKey",void 0),e1(this,"projection",void 0),e1(this,"intent",void 0),e1(this,"generation",void 0),e1(this,"queryRevision",void 0),e1(this,"disposed",void 0),e1(this,"committing",void 0),e1(this,"listeners",void 0),e1(this,"state",void 0),e1(this,"getSnapshot",void 0),e1(this,"isInputKeyCurrent",void 0),e1(this,"isInputCurrent",void 0),e1(this,"subscribe",void 0),e1(this,"refresh",void 0),e1(this,"resetSelection",void 0),e1(this,"canSelectTime",void 0),e1(this,"selectTime",void 0),e1(this,"selectResource",void 0),e1(this,"commit",void 0),this.beforeWork=e,this.inputKey="",this.intent={requirementSelections:[]},this.generation=0,this.queryRevision=0,this.disposed=!1,this.committing=!1,this.listeners=new Set,this.state=e01(),this.getSnapshot=()=>this.state,this.isInputKeyCurrent=(e,t)=>{var l;return!this.disposed&&(null==(l=this.input)?void 0:l.os)===e&&this.inputKey===t},this.isInputCurrent=e=>{var t;return!this.disposed&&(null==(t=this.input)?void 0:t.os)===e.os&&this.inputKey===e0z(e)},this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.refresh=async()=>{this.disposed||!this.input||this.committing||this.state.requiresOrderReconciliation||(this.generation++,this.queryRevision++,this.releaseCurrent(),await this.load())},this.resetSelection=async()=>{this.committing||this.disposed||this.state.requiresOrderReconciliation||(this.intent={requirementSelections:[]},await this.refresh())},this.canSelectTime=e=>{var t;let l=this.projection;return!!l&&!this.committing&&!(null==(t=this.input)?void 0:t.disabled)&&!e08(this.input)&&!this.state.requiresOrderReconciliation&&"loading"!==this.state.status&&"committed"!==this.state.status&&e0$(e,l.queryPartySize)},this.selectTime=async e=>{var t;if(!this.canSelectTime(e))return;let l=null==(t=this.projection)?void 0:t.times.find(t=>e0F(t,e)&&t.availabilityContextId===e.availabilityContextId&&t.availabilityContextVersion===e.availabilityContextVersion);if(l)return this.resolveTime(l,!0)},this.selectResource=async(e,t)=>{let l=this.projection,i=this.input;if(!l||!i||i.disabled||e08(i)||this.committing||"loading"===this.state.status||"committed"===this.state.status||this.state.requiresOrderReconciliation)return;let a=this.state.resourceGroups,n=a.find(t=>e0R(t.groupId,e));if(!n||!this.intent.candidate||e0M(n,i.resourceSettings)||null==t&&(n.required||n.min>0)||null!=t&&!n.options.some(e=>e0R(e.resourceId,t)&&e0$(e,l.queryPartySize)))return;let r=this.intent.requirementSelections.filter(e=>!e0V(e,n));r.push({requirementGroupId:n.groupId,formId:n.formId,resourceIds:null==t?[]:[t]}),this.intent={...this.intent,requirementSelections:r},this.queryRevision++;let o=l.times.find(e=>e0F(e,this.intent.candidate));if(o&&e0$(o,l.queryPartySize))return this.resolveTime(o,!1);this.publish({status:"selecting",ready:!1,reasonCodes:this.intent.candidate?["SELECTED_TIME_UNAVAILABLE"]:[],...e06(this.intent),resourceGroups:a,selectedResourceDetails:e02(l,r)})},this.commit=async function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.input;if(!(null==i?void 0:i.os.commitAvailabilitySelection))throw new e0L(["AVAILABILITY_UNSUPPORTED"]);let a=t.projection;if(t.disposed||t.committing||!t.state.ready||!a||!t.intent.candidate||t.state.requiresOrderReconciliation)throw new e0L(["BOOKING_SELECTION_NOT_READY"]);if(!e0R(e.product_id??e.id,a.productId))throw new e0L(["PRODUCT_SELECTION_CHANGED"]);if(Number(e.num??e.quantity)!==i.quantity)throw new e0L(["QUANTITY_SELECTION_CHANGED"]);let n=l.mode||(i.editingProductLineUid?"edit":"add");if("add"!==n&&!i.editingProductLineUid||"add"===n&&i.editingProductLineUid)throw new e0L(["BOOKING_EDIT_IDENTITY_REQUIRED"]);if("replace"===n&&!Array.isArray(l.relatedRetailProducts))throw new e0L(["RELATED_PRODUCTS_REQUIRED"]);let r=t.generation,o=t.inputKey,s=e06(t.intent),d=e0U(s),c=()=>{var e,i;if(t.disposed||t.generation!==r||t.inputKey!==o||e0U(t.intent)!==d||(null==(e=t.input)?void 0:e.disabled)||e08(t.input))throw new e0L(["BOOKING_SELECTION_CHANGED"]);null==(i=l.availabilityCommitGuard)||i.call(l)};t.committing=!0,t.publish({status:"committing",ready:!1,reasonCodes:[],error:void 0});let u=!1;try{var p,m;c(),u=!0;let r=i.os.commitAvailabilitySelection,o=await r.call(i.os,a.contextId,{...l,mode:n,customerSelectionSnapshot:!0,productLineUid:i.editingProductLineUid,orderProduct:e,candidate:s.candidate,requirementSelections:s.requirementSelections,partySize:a.partySize,bookingCount:a.bookingCount,availabilityCommitGuard:c});if((null==(p=o.validation)?void 0:p.ok)===!1)throw new e0L((null==(m=o.validation.conflicts)?void 0:m.map(e=>e.code||"BOOKING_COMMIT_FAILED"))||["BOOKING_COMMIT_FAILED"]);return t.publish({status:"committed",ready:!1,reasonCodes:[],candidate:s.candidate,selectedResourceDetails:e02(a,s.requirementSelections)}),o}catch(l){let e=!!l&&"object"==typeof l&&"code"in l&&"BUSINESS_UNAVAILABLE"===l.code;throw t.publish({status:"error",ready:!1,reasonCodes:e04(l),error:e03(l),requiresOrderReconciliation:u&&!e}),l}finally{t.committing=!1}}}}function e07(){if("u">typeof window&&"u">typeof document&&"visible"===document.visibilityState&&"function"==typeof window.requestAnimationFrame&&"function"==typeof window.cancelAnimationFrame)return new Promise(e=>{let t,l,i=!1,a=()=>{i||(i=!0,void 0!==t&&window.cancelAnimationFrame(t),void 0!==l&&window.clearTimeout(l),e())};l=window.setTimeout(a,180);try{t=window.requestAnimationFrame(()=>{try{t=window.requestAnimationFrame(a)}catch{a()}})}catch{a()}})}function e09(e){let{label:t,value:l,options:i,onChange:a,onReselect:n,describedBy:r,invalid:o,busy:s=!1}=e,d=dq("booking-time");return(0,eH.jsx)("div",{className:"time-choices-grid","data-has-end":i.some(e=>!!e.end),role:"radiogroup","aria-label":t,"aria-describedby":r,"aria-invalid":o||void 0,"aria-busy":s||void 0,children:i.map(e=>(0,eH.jsxs)("label",{className:"time-choice","data-unavailable":e.unavailable||void 0,children:[(0,eH.jsx)("input",{className:"sr-only",type:"radio",name:d,value:e.id,checked:l===e.id,disabled:e.disabled,onChange:()=>a(e.id),onKeyDown:t=>{n&&l===e.id&&(" "===t.key||"Enter"===t.key)&&(t.preventDefault(),n())},onClick:()=>{l===e.id&&(null==n||n())}}),(0,eH.jsxs)("span",{className:"time-choice-card",children:[l===e.id&&(0,eH.jsx)(eXU,{className:"time-choice-check",size:12,weight:"fill","aria-hidden":"true"}),(0,eH.jsxs)("span",{children:[e.indicator&&(0,eH.jsx)("span",{className:"time-choice-availability","data-tone":e.indicator.tone,role:"img","aria-label":e.indicator.label,"aria-hidden":s||void 0}),e.start,e.end&&`–${e.end}`]}),e.description&&(0,eH.jsx)("small",{"aria-hidden":s||void 0,children:e.description})]})]},e.id))})}function e2e(e){let{label:t,value:l}=e;return(0,eH.jsxs)("div",{className:"time-choice-validity",role:"status","aria-live":"polite","aria-atomic":"true",children:[(0,eH.jsx)("strong",{children:t}),(0,eH.jsx)("span",{children:l})]})}let e2t=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M125.18,156.94a64,64,0,1,0-82.36,0,100.23,100.23,0,0,0-39.49,32,12,12,0,0,0,19.35,14.2,76,76,0,0,1,122.64,0,12,12,0,0,0,19.36-14.2A100.33,100.33,0,0,0,125.18,156.94ZM44,108a40,40,0,1,1,40,40A40,40,0,0,1,44,108Zm206.1,97.67a12,12,0,0,1-16.78-2.57A76.31,76.31,0,0,0,172,172a12,12,0,0,1,0-24,40,40,0,1,0-10.3-78.67,12,12,0,1,1-6.16-23.19,64,64,0,0,1,57.64,110.8,100.23,100.23,0,0,1,39.49,32A12,12,0,0,1,250.1,205.67Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M136,108A52,52,0,1,1,84,56,52,52,0,0,1,136,108Z",opacity:"0.2"}),eC.createElement("path",{d:"M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M164.47,195.63a8,8,0,0,1-6.7,12.37H10.23a8,8,0,0,1-6.7-12.37,95.83,95.83,0,0,1,47.22-37.71,60,60,0,1,1,66.5,0A95.83,95.83,0,0,1,164.47,195.63Zm87.91-.15a95.87,95.87,0,0,0-47.13-37.56A60,60,0,0,0,144.7,54.59a4,4,0,0,0-1.33,6A75.83,75.83,0,0,1,147,150.53a4,4,0,0,0,1.07,5.53,112.32,112.32,0,0,1,29.85,30.83,23.92,23.92,0,0,1,3.65,16.47,4,4,0,0,0,3.95,4.64h60.3a8,8,0,0,0,7.73-5.93A8.22,8.22,0,0,0,252.38,195.48Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M112.6,158.43a58,58,0,1,0-57.2,0A93.83,93.83,0,0,0,5.21,196.72a6,6,0,0,0,10.05,6.56,82,82,0,0,1,137.48,0,6,6,0,0,0,10-6.56A93.83,93.83,0,0,0,112.6,158.43ZM38,108a46,46,0,1,1,46,46A46.06,46.06,0,0,1,38,108Zm211,97a6,6,0,0,1-8.3-1.74A81.8,81.8,0,0,0,172,166a6,6,0,0,1,0-12,46,46,0,1,0-17.08-88.73,6,6,0,1,1-4.46-11.14,58,58,0,0,1,50.14,104.3,93.83,93.83,0,0,1,50.19,38.29A6,6,0,0,1,249,205Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M107.19,159a56,56,0,1,0-46.38,0A91.83,91.83,0,0,0,6.88,197.81a4,4,0,1,0,6.7,4.37,84,84,0,0,1,140.84,0,4,4,0,1,0,6.7-4.37A91.83,91.83,0,0,0,107.19,159ZM36,108a48,48,0,1,1,48,48A48.05,48.05,0,0,1,36,108Zm212,95.35a4,4,0,0,1-5.53-1.17A83.81,83.81,0,0,0,172,164a4,4,0,0,1,0-8,48,48,0,1,0-17.82-92.58,4,4,0,1,1-3-7.43,56,56,0,0,1,44,103,91.83,91.83,0,0,1,53.93,38.86A4,4,0,0,1,248,203.35Z"}))]]),e2l=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2t}));function e2i(e){let{label:t,value:l,options:i,onChange:a,disabled:n=!1}=e;return(0,eH.jsx)("div",{className:"resource-picker",role:"group","aria-label":t,children:i.map(e=>(0,eH.jsxs)("button",{type:"button",className:"resource-card","aria-pressed":l===e.id,disabled:n||e.disabled,onClick:()=>a(e.id),children:[e.image&&(0,eH.jsx)("img",{src:e.image,alt:""}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("h3",{children:e.name}),e.description&&(0,eH.jsx)("p",{children:e.description}),(e.capacity||e.price)&&(0,eH.jsxs)("div",{className:"resource-card-meta",children:[e.capacity&&(0,eH.jsxs)("span",{children:[(0,eH.jsx)(e2l,{size:15}),e.capacity]}),e.price&&(0,eH.jsx)("b",{children:e.price})]}),e.status&&(0,eH.jsx)("p",{children:e.status})]})]},e.id))})}e2l.displayName="UsersIcon";let e2a=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z"}))]]),e2n=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2a}));e2n.displayName="WarningCircleIcon";let e2r=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),e2o=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2r}));function e2s(e){let{children:t,tone:l="info",id:i,className:a="",icon:n}=e,r="error"===l||"warning"===l?e2n:"success"===l?eXU:e2o;return(0,eH.jsxs)("div",{id:i,className:`shared-notice ${l} ${a}`,role:"error"===l?"alert":"status",children:[n??(0,eH.jsx)(r,{size:20,"aria-hidden":"true"}),(0,eH.jsx)("div",{className:"shared-notice-content",children:t})]})}function e2d(e){let{title:t,description:l,icon:i,decoration:a,eyebrow:n,children:r,actions:o,className:s="",pending:d=!1,headingLevel:c=2}=e;return(0,eH.jsxs)("div",{className:`status-panel ${s}`,role:d?"status":void 0,children:[a,i&&(0,eH.jsx)("div",{className:"status-panel-icon","aria-hidden":"true",children:i}),n,t&&(0,eH.jsx)(1===c?"h1":3===c?"h3":"h2",{children:t}),l&&(0,eH.jsx)("p",{children:l}),r,o]})}e2o.displayName="InfoIcon";let e2c=e=>"number"==typeof e&&Number.isFinite(e)&&e>=0;function e2u(e,t){if(!Array.isArray(e.requirementGroups)||e.requirementGroups.some(e=>!e||"object"!=typeof e))return;let l=e.requirementGroups.filter(e=>!1!==e.required);if(!l.length)return;let i=l.map(e=>{let l=function(e){if(!(!Array.isArray(e.options)||e.options.some(e=>!e||!["available","limited","full","conflict","unavailable","past"].includes(e.status))))return e.options.filter(e=>"available"===e.status||"limited"===e.status)}(e);return void 0===l?void 0:t(l)});return i.every(e2c)?Math.min(...i):void 0}function e2p(e){if(!e.some(e=>!e2c(e.remainingCapacity)))return e.reduce((e,t)=>Math.max(e,t.remainingCapacity),0)}function e2m(e){if(!e.some(e=>!e2c(e.remainingCapacity)))return e.reduce((e,t)=>e+t.remainingCapacity,0)}function e2g(e){let{date:t,locale:l="en"}=e;return(0,eH.jsxs)("div",{className:"selection-section-summary",style:{justifyContent:"flex-start"},children:[(0,eH.jsx)(e0r,{size:21,"aria-hidden":"true"}),(0,eH.jsx)("b",{children:(0,eH.jsx)("time",{dateTime:t,children:e0y(t,l)})})]})}function e2h(e){let{id:t,date:l,today:i,locale:a="en",stepStatus:n}=e,r=l===i?"zh"===a?"当前日期":"Current date":"zh"===a?"游玩日期":"Visit date";return(0,eH.jsx)(eXK,{id:t,number:1,stepStatus:n,title:r,className:"visit-date-summary",lang:a,open:!0,onToggle:()=>{},children:(0,eH.jsx)(e2g,{date:l,locale:a})})}let e2v=(0,eC.forwardRef)((e,t)=>{var l;let{locale:i="en",resourcePresentation:a=[]}=e,n=(null==(l=eJF())?void 0:l.presentationPlatform)==="kiosk",r=e0N[i],o=function(e){var t,l;let i=null==(t=eJF())?void 0:t.presentationPlatform,a=(0,eC.useRef)(i);a.current=i;let n=(0,eC.useRef)(e);n.current=e;let r=(0,eC.useRef)(),o=(0,eC.useRef)(null),[s,d]=(0,eC.useState)(()=>new e05().getSnapshot()),c=e0z(e);r.current={os:e.os,key:c},(0,eC.useLayoutEffect)(()=>{let e=new e05(()=>"kiosk"===a.current?e07():void 0);o.current=e;let t=e.subscribe(()=>d(e.getSnapshot()));return e.setInput(n.current),()=>{t(),e.dispose(),o.current===e&&(o.current=null)}},[]),(0,eC.useLayoutEffect)(()=>{var e;null==(e=o.current)||e.setInput(n.current)},[c,e.os]);let u=(0,eC.useCallback)(async()=>{let e=o.current;e&&(await e.setInput(n.current),await e.refresh())},[]),p=(0,eC.useCallback)(async(e,t)=>{let l=o.current;if(!l)throw new e0L(["BOOKING_SELECTION_NOT_READY"]);if(!l.isInputCurrent(n.current))throw new e0L(["BOOKING_SELECTION_CHANGED"]);return l.commit(e,t)},[]),m=(0,eC.useCallback)(async e=>{let t=o.current;if(null==t?void 0:t.isInputCurrent(n.current)){let l=await t.selectTime(e);if(o.current===t&&t.isInputCurrent(n.current))return l}},[]),g=(0,eC.useCallback)(async(e,t)=>{let l=o.current;if(null==l?void 0:l.isInputCurrent(n.current)){let i=await l.selectResource(e,t);if(o.current===l&&l.isInputCurrent(n.current))return i}},[]),h=(0,eC.useCallback)(e=>{let t=o.current,l=r.current;return!!l&&!!(null==t?void 0:t.isInputKeyCurrent(l.os,l.key))&&t.canSelectTime(e)},[]),v=(0,eC.useCallback)(async()=>{var e;await (null==(e=o.current)?void 0:e.resetSelection())},[]);return{state:(null==(l=o.current)?void 0:l.isInputKeyCurrent(e.os,c))?s:{...s,status:"loading",ready:!1},refresh:u,commit:p,selectTime:m,selectResource:g,canSelectTime:h,resetSelection:v}}(e),{state:s}=o,d=(0,eC.useRef)(e.onSelectionChange);d.current=e.onSelectionChange;let c=(0,eC.useRef)(e);c.current=e;let[u,p]=(0,eC.useState)(!1),m=(0,eC.useRef)(!1),[g,h]=(0,eC.useState)(!1),v=(0,eC.useRef)(null),f=(0,eC.useRef)(null),y=(0,eC.useRef)(),b=(0,eC.useRef)(null),x=(0,eC.useRef)(null),k=(0,eC.useRef)(!0),_=eXN();(0,eC.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let w=(0,eC.useCallback)(async()=>{let e=c.current;if(e.resourceSettingsFailed&&e.onRetryResourceSettings){try{await e.onRetryResourceSettings()}catch{}return}await o.refresh()},[o.refresh]);(0,eC.useImperativeHandle)(t,()=>({refresh:w,commit:(e,t)=>o.commit(e,{...t,availabilityCommitGuard:()=>{var e;if(m.current)throw new e0L(["BOOKING_SELECTION_CHANGED"]);null==t||null==(e=t.availabilityCommitGuard)||e.call(t)}})}),[w,o.commit]),(0,eC.useEffect)(()=>{d.current(u?{...s,ready:!1}:s)},[s,u]);let S="loading"===s.status||"committing"===s.status||u,j=!!e.disabled||!!e.interactionDisabled||S||"committed"===s.status||!!s.requiresOrderReconciliation,N=e.reasonFormatter||(e=>e0C(e,i)),C=e0O(e.product),M=t=>t.resourceGroups.filter(l=>{if(!1===e.resourceSettingsReady||e.resourceSettingsFailed||e0M(l,e.resourceSettings))return!1;if("ticket"!==e.mode||!l.required&&0===l.min)return!0;let i=C[l.groupId]||(null==l.formId?[]:C[String(l.formId)])||[],a=t.requirementSelections.find(e=>e0V(e,l));return!(1===i.length&&(null==a?void 0:a.resourceIds.length)===1&&e0R(i[0],a.resourceIds[0])&&l.options.some(e=>e0R(e.resourceId,i[0])&&e0$(e,(t.partySize||0)*t.bookingCount)))}),T=(e,t)=>{var l,i;null==(l=(i=c.current).onExplicitSelection)||l.call(i,e,t),!c.current.renderContent&&("time"===e&&M(t).length?_(()=>f.current):t.ready&&_(c.current.actionTarget||(()=>{var e,t;return(null==(t=v.current)||null==(e=t.closest('[role="dialog"]'))?void 0:e.querySelector(".reservation-submit"))||null}),{focus:"control"}))},I=async t=>{var l;if(j)return;let i=null==(l=e.operationLog)?void 0:l.capture(),a=await o.selectTime(t);return a&&k.current&&(null==i||i("time_selected",{productId:a.productId,selectedDate:e.date,startAt:t.bookingStartAt||t.startAt,endAt:t.bookingEndAt||t.endAt}),T("time",a)),a},P=async(t,l)=>{var i;if(j)return;let a=null==(i=e.operationLog)?void 0:i.capture(),n=await o.selectResource(t,l);return n&&k.current&&(null==a||a("resource_selected",{productId:n.productId,selectedDate:e.date,groupId:t,resourceId:l}),T("resource",n)),n},A=async t=>{if((!c.current.dateReadOnly||t===c.current.date)&&!j){if(h(!1),t===e.date){x.current&&(x.current.open=!1),c.current.renderContent||_(()=>b.current);return}m.current=!0,p(!0);try{if(await e.onDateChange(t)===!1)return;k.current&&(x.current&&(x.current.open=!1),c.current.renderContent||_(()=>b.current))}catch{k.current&&h(!0)}finally{m.current=!1,k.current&&p(!1)}}},D=e0H(s.times,(s.partySize||0)*s.bookingCount),E=s.times.find(e=>e0F(e,s.candidate)),O=E&&e0$(E,(s.partySize||0)*s.bookingCount)?s.candidate:void 0,z=O?`${s.contextId||""}:${e0B(O)}`:void 0,L=!!z&&!u&&("selecting"===s.status||"ready"===s.status||y.current===z);(0,eC.useEffect)(()=>{!z||u?y.current=void 0:("selecting"===s.status||"ready"===s.status)&&(y.current=z)},[z,s.status,u]);let R="loading"===s.status||u?e0_(i,"timeLoading"):"error"===s.status?e0_(i,"timeLoadFailed"):O?`${e2f(O.bookingStartAt||O.startAt,O.startTime)}–${e2f(O.bookingEndAt||O.endAt,O.endTime)}`:e0_(i,D.some(e=>{let{candidate:t}=e;return e0$(t,(s.partySize||0)*s.bookingCount)})?"timeNotSelected":"timeUnavailable"),$="party"===e.mode&&!s.times.length&&("idle"===s.status||"loading"===s.status||u),F="party"===e.mode&&!s.times.length&&"error"===s.status&&!s.requiresOrderReconciliation,q=(0,eH.jsxs)("div",{ref:b,tabIndex:-1,children:["ticket"===e.mode&&(0,eH.jsx)(e2e,{label:e0_(i,"validPlayTime"),value:R}),$&&(0,eH.jsx)(e2d,{pending:!0,description:e0_(i,"timeLoading")}),F&&(0,eH.jsx)(e2d,{description:e0_(i,"timeLoadFailed"),actions:(0,eH.jsx)(eXE,{secondary:!0,disabled:j,onClick:()=>{w()},children:r.retry})}),(0,eH.jsx)(e09,{label:r.time,value:E?e0B(E):"",busy:n&&S,options:D.map(t=>{var l;let{id:a,candidate:d}=t,c=e0$(d,(s.partySize||0)*s.bookingCount),u=function(e){let{candidate:t,settings:l,mode:i}=e,a=Array.isArray(l)?Array.from(new Set(l.filter(e=>"maximum_capacity"===e||"available_quantity"===e||"colour_indicators"===e))):[],n={showColourIndicator:a.includes("colour_indicators")};return a.includes("maximum_capacity")&&(n.maximumCapacity=e2c(t.maxPartySize)?t.maxPartySize:e2u(t,e2p)),a.includes("available_quantity")&&(n.availableQuantity=e2u(t,"party"===i?e=>e.length:e2m)),n}({candidate:d,settings:e.capacityDisplayContent,mode:e.mode}),p=(!S||n)&&c&&(void 0!==u.maximumCapacity||void 0!==u.availableQuantity);return{id:a,start:d.startTime,end:d.endTime,disabled:j||!o.canSelectTime(d),unavailable:n?!c:void 0,indicator:(!S||n)&&u.showColourIndicator?{tone:c?"limited"===d.status?"limited":"available":"unavailable",label:c?"limited"===d.status?e0_(i,"capacityLimited"):e0_(i,"capacityAvailable"):r.unavailable}:void 0,description:c?p?(0,eH.jsxs)(eH.Fragment,{children:[void 0!==u.maximumCapacity&&(0,eH.jsx)("span",{className:"venue-booking-time-capacity",children:e0_(i,"timeMaximumCapacity").replace("{count}",String(u.maximumCapacity))}),void 0!==u.availableQuantity&&(0,eH.jsx)("span",{className:"venue-booking-time-capacity",children:e0_(i,"party"===e.mode?"timeRoomsLeft":"timeSpacesLeft").replace("{count}",String(u.availableQuantity))})]}):void 0:N((null==(l=d.reasonCodes)?void 0:l[0])||"UNAVAILABLE")}}),onChange:e=>{var t;let l=null==(t=D.find(t=>t.id===e))?void 0:t.candidate;l&&I(l)},onReselect:()=>{!j&&E&&I(E)}}),!S&&!s.times.length&&"idle"!==s.status&&"error"!==s.status&&(0,eH.jsx)("p",{children:r.noTimes})]}),B=(0,eH.jsxs)("div",{ref:f,tabIndex:-1,children:[!E&&(0,eH.jsx)("p",{children:"party"===e.mode?r.timeBeforeRoom:r.selectTime}),M(s).map(t=>{var l;let n=null==(l=e.resourceSettings)?void 0:l[String(t.formId??t.groupId)],o="zh"===i?"zh-CN":"en",d=Rz(null==n?void 0:n.name,void 0,o).trim()||Rz(t.title,void 0,o).trim()||("party"===e.mode?r.room:r.resource),c=s.requirementSelections.find(e=>e0V(e,t)),u=!j&&!!E,p=1===t.options.length?t.options:t.options.filter(e=>e0$(e,(s.partySize||0)*s.bookingCount)),m=p.map(t=>{var l,i,n;let o=a.find(e=>e0R(e.resourceId,t.resourceId)),d=s.resources.find(e=>e0R(e.id,t.resourceId)),c=e0$(t,(s.partySize||0)*s.bookingCount),u=null==d||null==(l=d.raw)?void 0:l.cover,p=Array.isArray(u)?null==(i=u.find(e=>"string"==typeof(null==e?void 0:e.url)&&e.url.trim()))?void 0:i.url:void 0,m=[null==o?void 0:o.image,p,null==d||null==(n=d.raw)?void 0:n.image].find(e=>"string"==typeof e&&e.trim()),g=[null==o?void 0:o.name,t.resourceName,null==d?void 0:d.name].find(e=>"string"==typeof e&&e.trim())||`${"party"===e.mode?r.room:r.resource} ${t.resourceId}`;return{id:String(t.resourceId),name:g,image:m,disabled:!c}});return t.required||0!==t.min||m.unshift({id:"",name:r.none,status:""}),(0,eH.jsxs)("fieldset",{className:"venue-booking-availability__group",disabled:!u,children:[(0,eH.jsxs)("legend",{children:[d,t.required||0!==t.min?"":` \xb7 ${r.optional}`]}),(0,eH.jsx)(e2i,{label:d,value:(null==c?void 0:c.resourceIds.length)?String(c.resourceIds[0]):"",options:m,disabled:!u,onChange:e=>{let l=t.options.find(t=>String(t.resourceId)===e);l?P(t.groupId,l.resourceId):""!==e||t.required||0!==t.min||P(t.groupId,null)}}),!p.length&&(0,eH.jsx)("p",{children:r.noResources})]},t.groupId)})]}),H=e.dateReadOnly?(0,eH.jsx)(e2g,{date:e.date,locale:i}):e.renderDatePicker?e.renderDatePicker({date:e.date,disabled:j,onChange:e=>{A(e)}}):(0,eH.jsx)("input",{type:"date","aria-label":r.date,value:e.date,disabled:j,onChange:e=>{A(e.target.value)}}),V=(e,t)=>(0,eH.jsxs)("section",{className:"reservation-section venue-booking-availability__section","aria-label":e,children:[(0,eH.jsx)("h3",{children:e}),t]}),U=e.dateReadOnly?H:"ticket"===e.mode?(0,eH.jsxs)("details",{ref:x,className:"reservation-date",children:[(0,eH.jsxs)("summary",{"aria-disabled":j,onClick:e=>{j&&e.preventDefault()},children:[(0,eH.jsx)(e0r,{size:21,"aria-hidden":"true"}),(0,eH.jsx)("span",{children:(0,eH.jsx)("b",{children:e0y(e.date,i)})}),(0,eH.jsx)("span",{className:"date-change-label",children:e0_(i,"changeDate")})]}),(0,eH.jsx)("div",{className:"reservation-date-picker",children:H})]}):e.renderDatePicker?H:V(r.date,H),Y="ticket"===e.mode?(0,eH.jsx)("section",{className:"reservation-section venue-booking-availability__section","aria-label":e0_(i,"validPlayTime"),children:q}):V(r.time,q),W=V("party"===e.mode?r.room:r.resource,B),K=s.reasonCodes.filter(e=>!["RESOURCE_REQUIRED","PARTY_ROOM_REQUIRED","TIME_REQUIRED"].includes(e)),G=!S&&("error"===s.status||"blocked"===s.status||s.requiresOrderReconciliation||K.length>0),Q=G?Array.from(new Set(K.map(N))):[],Z=M(s).length>0||!s.resourceGroups.length&&e0I(e.product,e.resourceSettings),J=!1!==e.resourceSettingsReady&&!e.resourceSettingsFailed&&("party"===e.mode||L)&&Z,X=(0,eH.jsxs)(eH.Fragment,{children:[(G||g)&&(0,eH.jsxs)("div",{className:"venue-booking-availability__status",role:"alert",children:[s.requiresOrderReconciliation?(0,eH.jsx)("p",{children:r.reconciliation}):Q.map(e=>(0,eH.jsx)("p",{children:e},e)),g&&(0,eH.jsx)("p",{children:r.dateFailed})]}),("error"===s.status||"blocked"===s.status)&&!s.requiresOrderReconciliation&&!F&&(0,eH.jsx)(eXE,{secondary:!0,className:"venue-booking-availability__retry",disabled:j,onClick:()=>{w()},children:r.retry}),s.reasonCodes.some(e=>"SELECTED_RESOURCE_UNAVAILABLE"===e||"SELECTED_TIME_UNAVAILABLE"===e)&&(0,eH.jsx)(eXE,{secondary:!0,className:"venue-booking-availability__retry",disabled:j,onClick:()=>{o.resetSelection()},children:r.reselect})]}),ee={state:s,busy:S,disabled:j,dateContent:H,timeContent:q,resourceContent:B,datePanel:U,timePanel:Y,resourcePanel:W,statusPanel:X,showResources:J,actions:{changeDate:A,selectTime:I,selectResource:P,refresh:w,resetSelection:o.resetSelection}};return(0,eH.jsx)("div",{ref:v,className:`venue-booking-availability ${e.className||""}`,"aria-busy":S,children:e.renderContent?e.renderContent(ee):(0,eH.jsxs)(eH.Fragment,{children:[U,Y,J&&W,X]})})});function e2f(e,t){let l=null==e?void 0:e.match(/[T ](\d{2}:\d{2})(?::(\d{2}))?/);return l?`${l[1]}${l[2]&&"00"!==l[2]?`:${l[2]}`:""}`:t}async function e2y(e){let t=iM(e.product,e.skuValue,{requiredOptionValidation:!1,overSold:1===Number(e.product.over_sold)});if(!t)throw Error("The selected product options are no longer available.");return ekh({productData:e.product,skuValue:t,quantity:e.quantity,selectedCandidate:e.candidate,duration:null,customerId:e.customerId,contextKey:e.scopeKey},{calculateProductBookingPrice:async t=>{let l=await e.os.calculateProductBookingPrice(t),i=t.product;if(Number(l.product_id)!==Number(i.product_id??i.id)||Number(l.product_variant_id||0)!==Number(i.product_variant_id||0)||null==l.unit_price||""===String(l.unit_price).trim()||!Number.isFinite(Number(l.unit_price))||0>Number(l.unit_price))throw Error("The booking price is unavailable or does not match the selected product.");return l},channel:"online_ordering"})}e2v.displayName="BookingSelectionPanel";let e2b=()=>{};function e2x(e){try{let t=e&&("object"==typeof e||"function"==typeof e)?e:void 0,l=null==t?void 0:t.name,i=null==t?void 0:t.code;return{errorName:"string"==typeof l&&l?l.slice(0,80):"unknown",..."string"==typeof i?{errorCode:i.slice(0,80)}:"number"==typeof i&&Number.isFinite(i)?{errorCode:i}:{}}}catch{return{errorName:"unknown"}}}let e2k=e=>"number"==typeof e?Number.isFinite(e)?e:void 0:"string"==typeof e&&e.trim()?e.trim():void 0,e2_=new Set(["cacheid","cache_id","scene","temp","ticketsmenulistids","partymenulistids","extrasmenulistids","menulistids","businesscode","business_code","channel","template","display_template_id","type","mode","lang","locale","date","schedule_date","resourceid","productid"]);function e2w(e){var t,l,i,a,n;let{mode:r,draft:o,context:s,date:d,scopeKey:c,locale:u,priceSource:p}=e,m=(e,t)=>"zh"===u?t:e,g=s.sales.bookingTicket,h=exR(),v=(0,eC.useRef)(null),[f,y]=(0,eC.useState)(o.configuration),[b,x]=(0,eC.useState)(()=>{let e=Number(o.quantity);return Number.isSafeInteger(e)&&e>0?e:1}),[k,_]=(0,eC.useState)(),w=(0,eC.useRef)(o.initialSelection),[S,j]=(0,eC.useState)(),[N,C]=(0,eC.useState)(),[M,T]=(0,eC.useState)(!1),I=(0,eC.useRef)(!1),P=(0,eC.useRef)(!0),A=(0,eC.useRef)(e.onBusyChange);A.current=e.onBusyChange;let D=(0,eC.useRef)(e.onDraftChange);D.current=e.onDraftChange,(0,eC.useEffect)(()=>(P.current=!0,()=>{var e;P.current=!1,null==(e=A.current)||e.call(A,!1)}),[]);let E=(0,eC.useMemo)(()=>e0E(o.detail,f.skuValue),[o.detail,f]);(0,eC.useEffect)(()=>{var e;k&&"idle"!==k.status&&!("blocked"===k.status&&k.reasonCodes.includes("BOOKING_DISABLED"))&&(w.current=k),null==(e=D.current)||e.call(D,{configuration:f,quantity:b,initialSelection:w.current})},[f,b,k,o]);let O=JSON.stringify([c,r,o.openId??(null==(t=o.plan)?void 0:t.openId),o.detail.product_id??o.detail.id,o.lineUid,d,b,f.skuValue,k&&e0U(k),e.customerId]),z=(0,eC.useRef)({revision:O,disabled:e.disabled,os:g,draft:o,priceSource:p});z.current={revision:O,disabled:e.disabled,os:g,draft:o,priceSource:p},(0,eC.useEffect)(()=>{let t=!0;if(j(void 0),(null==k?void 0:k.candidate)&&["selecting","ready"].includes(k.status)&&("tickets"===r||k.ready)&&!k.requiresOrderReconciliation&&k.candidate.date===d&&k.candidate.availabilityContextId===k.contextId&&k.times.some(e=>e0q(e,k.candidate)&&e0$(e,(k.partySize||0)*k.bookingCount)))return C(void 0),e2y({os:p,product:E.product,skuValue:f.skuValue,candidate:k.candidate,quantity:b,customerId:e.customerId,scopeKey:c}).then(e=>{t&&j(e)}).catch(e=>{t&&C(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[g,p,o,E.product,O,null==k?void 0:k.ready,null==k?void 0:k.status,null==k?void 0:k.contextId,null==k||null==(l=k.candidate)?void 0:l.availabilityContextVersion]);let L=async()=>{var t,l,i,a,n,y,x,_;if(I.current||e.disabled||!S||!(null==k?void 0:k.ready)||!k.candidate||!v.current)return!1;I.current=!0,T(!0),null==(t=A.current)||t.call(A,!0),C(void 0);let w=null==(l=g.getTempOrder)?void 0:l.call(g),N=e=>{var t;return JSON.stringify([null==e?void 0:e.order_id,null==e?void 0:e.external_sale_number,null==e||null==(t=e._extend)?void 0:t.localId])},M=N(w),D=null==(i=e.operationLog)?void 0:i.capture(),L=o.lineUid?"cart_update":"cart_add",R={productId:E.product.product_id??E.product.id,quantity:b,selectedDate:d,startAt:k.candidate.bookingStartAt||k.candidate.startAt,endAt:k.candidate.bookingEndAt||k.candidate.endAt,resourceIds:null==(a=k.requirementSelections)?void 0:a.flatMap(e=>e.resourceIds).slice(0,100)};null==D||D(`${L}_requested`,R);let $=()=>{var e,t;return P.current&&z.current.revision===O&&z.current.os===g&&z.current.draft===o&&z.current.priceSource===p&&(null==(e=g.getTempOrder)?void 0:e.call(g))===w&&N(null==(t=g.getTempOrder)?void 0:t.call(g))===M},F=()=>{if(!$()||z.current.disabled)throw Error(m("Your selection changed. Please review it again.","选择已变化,请重新确认。"))},q=!1;try{F();let t=eXy(g)?e07():void 0;t&&(await t,F()),await h.assertCanMutate(),F();let l=await e2y({os:p,product:E.product,skuValue:f.skuValue,candidate:k.candidate,quantity:b,customerId:e.customerId,scopeKey:c});if(F(),l.compositeLineTotal!==S.compositeLineTotal)throw j(l),Error(m("The price changed. Please review the new amount and confirm again.","价格已更新,请核对新金额后再次确认。"));let i=(_={product:E.product,skuValue:f.skuValue,quote:l,quantity:b,candidate:k.candidate,role:r,scopeKey:c},ekA({...HD({productData:_.product,skuValue:_.skuValue,quantity:_.quantity,booking:{startDate:eS()(_.candidate.startAt),endDate:eS()(_.candidate.endAt),startTime:_.candidate.startTime,endTime:_.candidate.endTime,resource:null,capacity:null,duration:null,holderIds:[]},bookingPrice:{status:"ready",requestKey:_.scopeKey,quote:_.quote}},{moduleTypes:["sku","bookingPrice"],requireBookingPrice:!0}),quantity:_.quantity,num:_.quantity,metadata:{..._.product.metadata,venue_booking_role:"tickets"===_.role?"tickets":"party_main",venue_booking_scope_key:_.scopeKey,venue_booking_service_datetime:_.candidate.startAt}})),a=await s.cart.prepareAllergyBeforeCommit({product:i,flowId:(null==(n=o.plan)?void 0:n.openId)||`${c}:${o.lineUid||o.detail.id}`,perFlow:!0});if(F(),!a.allowed)return null==D||D(`${L}_cancelled`,{...R,reason:"allergy_confirmation"}),!1;let d=e.prepareRelated?await e.prepareRelated(k):{};if(F(),await h.assertCanMutate(),F(),null==(y=d.availabilityCommitGuard)||y.call(d),await v.current.commit(i,{...d,availabilityCommitGuard:()=>{var e;F(),null==(e=d.availabilityCommitGuard)||e.call(d)},salesNotes:a.noteDraft?[a.noteDraft]:void 0,allowBookingReprice:!0}),q=!0,null==D||D(`${L}_succeeded`,R),!$())return!0;return s.cart.refreshCartSnapshot(),$()&&await e.onCommitted(),!0}catch(e){if(q)return null==D||D("cart_view_refresh_failed",{...R,...e2x(e)},"warning"),console.warn("[VenueBooking] Selection saved; view refresh failed",e),$()&&C(m("Your selection was saved, but the view could not refresh. Reopen your order to review it.","选择已保存,但页面刷新失败。请重新打开订单核对。")),!0;if(null==D||D(`${L}_failed`,{...R,writeOutcome:"unconfirmed",...e2x(e)},"warning"),$()){try{s.cart.refreshCartSnapshot()}catch(e){console.warn("[VenueBooking] Could not refresh the current selection",e)}C(e instanceof e0L?e.reasonCodes.map(e=>e0C(e,u)).join(" "):e instanceof Error?e.message:String(e))}return!1}finally{I.current=!1,P.current&&(T(!1),null==(x=A.current)||x.call(A,!1))}},R={operationLog:e.operationLog,os:g,mode:"tickets"===r?"ticket":"party",date:d,product:E.product,quantity:b,editingProductLineUid:o.lineUid,initialSelection:o.initialSelection,disabled:!!e.disabled,interactionDisabled:M,onDateChange:e.onDateChange,onSelectionChange:_,locale:u,capacityDisplayContent:null==(a=g.otherParams)||null==(i=a.openData)?void 0:i["interface.capacity_display_content"],resourceSettings:null==(n=s.sales.salesSettings)?void 0:n.reservation.resourceSettings,resourceSettingsReady:"picoding"!==s.sales.salesSettingsSource||!!(s.sales.salesSettings&&!s.sales.salesSettingsError),resourceSettingsFailed:!!s.sales.salesSettingsError,onRetryResourceSettings:s.sales.ensureSalesSettings},$=!!((null==k?void 0:k.ready)&&S&&!k.requiresOrderReconciliation);return{configuration:f,setConfiguration:y,quantity:b,setQuantity:x,prepared:E,selection:k,quote:S,error:N,working:M,revision:O,panelRef:v,bookingProps:R,bookingReady:$,canCommit:$&&!e.disabled&&!M,preview:{product:E.product,configuration:f,quantity:b,date:d,editingProductLineUid:o.lineUid,candidate:null==k?void 0:k.candidate,requirementSelections:(null==k?void 0:k.requirementSelections)??[],selectedResourceDetails:(null==k?void 0:k.selectedResourceDetails)??[],quote:S},commit:L,cancel:()=>{I.current||e.onCancel()}}}let e2S=new Set(["p","div","span","br","strong","b","em","i","u","s","del","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","pre","code","a","img","hr","sub","sup","table","thead","tbody","tfoot","tr","th","td"]),e2j=new Set(["script","style","iframe","object","embed","svg","math","template","input","button","select","textarea"]),e2N=["fontWeight","fontStyle","fontSize","textDecoration","textAlign","color","backgroundColor","whiteSpace"];function e2C(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=null==e?void 0:e.trim();if(l&&(/^https?:\/\//i.test(l)||/^\/(?!\/)/.test(l)||!t&&/^(?:mailto:|tel:|#)/i.test(l)))return l}function e2M(e,t){if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;let l=e.tagName.toLowerCase();if(e2j.has(l))return null;let i=Array.from(e.childNodes,e2M);if(!e2S.has(l))return(0,eH.jsx)(eM().Fragment,{children:i},t);let a={key:t},n={};if(e2N.forEach(t=>{let l=e.style[t];l&&(n[t]=l)}),a.style=n,"a"===l&&(a.href=e2C(e.getAttribute("href")),a.target="_blank",a.rel="noopener noreferrer"),"img"===l){if(a.src=e2C(e.getAttribute("src"),!0),!a.src)return null;a.alt=e.getAttribute("alt")||"",a.loading="lazy"}if("td"===l||"th"===l)for(let[t,l]of[["colspan","colSpan"],["rowspan","rowSpan"]]){let i=Number(e.getAttribute(t));Number.isInteger(i)&&i>0&&i<=1e3&&(a[l]=i)}if("ol"===l&&e.hasAttribute("start")){let t=Number(e.getAttribute("start"));Number.isInteger(t)&&(a.start=t)}return eM().createElement(l,a,...["br","img","hr"].includes(l)?[]:i)}function e2T(e){let{content:t}=e,l=(0,eC.useMemo)(()=>"u"<typeof DOMParser?t:Array.from(new DOMParser().parseFromString(t,"text/html").body.childNodes,e2M),[t]);return(0,eH.jsx)("div",{className:"venue-product-description",children:l})}let e2I=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),eC.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),e2P=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2I}));e2P.displayName="CheckIcon";let e2A=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z",opacity:"0.2"}),eC.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z"}))]]),e2D=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2A}));e2D.displayName="ArrowSquareOutIcon";let e2E=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,36H48A20,20,0,0,0,28,56v56c0,54.29,26.32,87.22,48.4,105.29,23.71,19.39,47.44,26,48.44,26.29a12.1,12.1,0,0,0,6.32,0c1-.28,24.73-6.9,48.44-26.29,22.08-18.07,48.4-51,48.4-105.29V56A20,20,0,0,0,208,36Zm-4,76c0,35.71-13.09,64.69-38.91,86.15A126.28,126.28,0,0,1,128,219.38a126.14,126.14,0,0,1-37.09-21.23C65.09,176.69,52,147.71,52,112V60H204ZM79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,56v56c0,96-88,120-88,120S40,208,40,112V56a8,8,0,0,1,8-8H208A8,8,0,0,1,216,56Z",opacity:"0.2"}),eC.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm-34.32,69.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,42H48A14,14,0,0,0,34,56v56c0,51.94,25.12,83.4,46.2,100.64,22.73,18.6,45.27,24.89,46.22,25.15a6,6,0,0,0,3.16,0c.95-.26,23.49-6.55,46.22-25.15C196.88,195.4,222,163.94,222,112V56A14,14,0,0,0,208,42Zm2,70c0,37.76-13.94,68.39-41.44,91.06A131.17,131.17,0,0,1,128,225.72a130.94,130.94,0,0,1-40.56-22.66C59.94,180.39,46,149.76,46,112V56a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2ZM172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,44H48A12,12,0,0,0,36,56v56c0,51.16,24.73,82.12,45.47,99.1,22.4,18.32,44.55,24.5,45.48,24.76a4,4,0,0,0,2.1,0c.93-.26,23.08-6.44,45.48-24.76,20.74-17,45.47-47.94,45.47-99.1V56A12,12,0,0,0,208,44Zm4,68c0,38.44-14.23,69.63-42.29,92.71A132.45,132.45,0,0,1,128,227.82a132.23,132.23,0,0,1-41.71-23.11C58.23,181.63,44,150.44,44,112V56a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-41.17-10.83a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17Z"}))]]),e2O=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e2E}));function e2z(e){let{title:t,version:l,accepted:i,lang:a,onOpen:n,disabled:r=!1}=e;return(0,eH.jsxs)("button",{type:"button",className:`checkout-agreement ${i?"accepted":""}`,"data-accepted":i,"aria-haspopup":"dialog","aria-label":`${e0_(a,"readAgreement")} \xb7 ${t} \xb7 ${e0_(a,i?"accepted":"notAccepted")}`,onClick:n,disabled:r,children:[(0,eH.jsx)("span",{className:"agreement-state","aria-hidden":"true",children:i&&(0,eH.jsx)(e2P,{size:15,weight:"bold"})}),(0,eH.jsxs)("span",{className:"agreement-copy",children:[(0,eH.jsx)("b",{children:t}),(0,eH.jsxs)("small",{children:[l&&(0,eH.jsxs)(eH.Fragment,{children:[e0_(a,"version")," ",l," \xb7"," "]}),e0_(a,i?"accepted":"notAccepted")]})]}),(0,eH.jsxs)("span",{className:"agreement-open","aria-hidden":"true",children:[(0,eH.jsx)("span",{children:e0_(a,"readAgreement")}),(0,eH.jsx)(e2D,{size:15})]})]})}function e2L(e){let{title:t,version:l,lang:i,children:a,onConfirm:n,onClose:r}=e;return(0,eH.jsxs)(e0t,{wide:!0,className:"agreement-dialog",title:t,closeLabel:e0_(i,"close"),onClose:r,children:[(0,eH.jsxs)("div",{className:"agreement-dialog-content",tabIndex:0,role:"region","aria-label":t,children:[l&&(0,eH.jsxs)("div",{className:"agreement-label",children:[(0,eH.jsx)(e2O,{size:24,"aria-hidden":"true"}),(0,eH.jsxs)("span",{children:[e0_(i,"version")," ",l]})]}),a]}),(0,eH.jsx)("div",{className:"agreement-dialog-footer",children:(0,eH.jsx)(eXE,{type:"button",className:"button full",onClick:()=>{null==n||n(),r()},children:e0_(i,n?"confirmAgreement":"close")})})]})}function e2R(e){let{name:t,description:l,content:i,lang:a}=e,n=(0,eC.useRef)(null),[r,o]=(0,eC.useState)(!1),[s,d]=(0,eC.useState)(!1),c=e0_(a,"fullProductInfo");return(0,eC.useEffect)(()=>{var e;let t=n.current;if(!t)return;let l=!0,i=()=>{l&&o(t.scrollHeight>t.clientHeight+1)};i();let a="u"<typeof ResizeObserver?void 0:new ResizeObserver(i);return null==a||a.observe(t),window.addEventListener("resize",i),null==(e=document.fonts)||e.ready.then(i),()=>{l=!1,null==a||a.disconnect(),window.removeEventListener("resize",i)}},[l]),(0,eH.jsxs)("div",{className:"product-description",children:[(0,eH.jsx)("p",{className:"product-description-text",ref:n,children:l}),r&&(0,eH.jsx)("button",{type:"button",className:"text-link product-description-more","aria-haspopup":"dialog","aria-label":`${c}: ${t}`,onClick:()=>d(!0),children:c}),s&&(0,eH.jsx)(e2L,{title:t,lang:a,onClose:()=>d(!1),children:i??(0,eH.jsx)("div",{className:"agreement-body",children:(0,eH.jsx)("p",{className:"preserve-lines",children:l})})})]})}function e2$(e){let{detail:t,configuration:l,locale:i,catalogStartingAmount:a,catalogPriceQualifier:n,formatAmount:r}=e,{durationMinutes:o}=(0,eC.useMemo)(()=>e0E(t,{...l.skuValue}),[t,l.skuValue]),s=eXp(t.title,i)||eXp(t.name,i),d=eXp(t.description,i).trim(),c=(0,eC.useMemo)(()=>eXm(d,i),[d,i]),u="string"==typeof t.cover?t.cover.trim():"",p=("string"==typeof a||"number"==typeof a)&&""!==String(a).trim()&&Number.isFinite(Number(a))&&Number(a)>=0;return(0,eH.jsxs)("div",{className:"reservation-intro venue-product-intro",children:[(0,eH.jsx)("div",{className:"venue-product-intro__cover",children:(0,eH.jsx)(nY.PisellImageCard,{dataSource:{src:u||void 0,alt:s},width:"100%",height:"100%",aliWidth:220,fillMode:"cover"})}),(0,eH.jsxs)("div",{className:"venue-product-intro__copy",children:[d&&(0,eH.jsx)(e2R,{name:s,description:c,lang:i,content:(0,eH.jsx)(e2T,{content:d})}),null!=o&&(0,eH.jsxs)("span",{className:"small muted",children:[o," ","zh"===i?"分钟":"minutes"]}),p&&(0,eH.jsxs)("strong",{children:["from"===n&&"zh"!==i&&"From ",r(a),"from"===n&&"zh"===i&&" 起"]})]})]})}e2O.displayName="ShieldCheckIcon";let e2F=(e,t)=>null!=e&&null!=t&&String(e)===String(t),e2q=e=>Array.isArray(e)?e:[],e2B=e=>{if("string"!=typeof e&&"number"!=typeof e||""===String(e).trim())throw Error("The estimated price is unavailable.");let t=new lz(e);if(!t.isFinite())throw Error("The estimated price is unavailable.");return t},e2H=e=>{let t=Number(e);if(!Number.isSafeInteger(t)||t<=0)throw Error("The selected quantity is invalid.");return t},e2V=e=>(e||[]).map(e=>{var t;return{...e,required:0,min_quantity:0,max_quantity:0,metadata:{...e.metadata,option_types_config:{...null==(t=e.metadata)?void 0:t.option_types_config,min:0,max:0}},option_item:(e.option_item||[]).map(e=>({...e,min_quantity:0,max_quantity:0}))}});function e2U(e,t){return e2q(e).reduce((e,l)=>{let i=e2q(t).find(e=>e2F(e.id,l.option_group_id??l.group_id)),a=e2q(null==i?void 0:i.option_item).find(e=>e2F(e.id,l.product_option_item_id??l.option_group_item_id??l.id));if(!a)throw Error("The selected option is unavailable.");return e.add(e2B(a.add_price??a.price).mul(e2H(l.quantity??l.num)))},new lz(0))}async function e2Y(e){var t,l;let i=e2H(e.quantity),a=(t=e.productDetail,l=e.skuValue,{...t,variant_group:0===Number(l.product_variant_id||0)?[]:t.variant_group,option_group:e2V(t.option_group),bundle_group:(t.bundle_group||[]).map(e=>({...e,min_quantity:0,max_quantity:0,bundle_item:(e.bundle_item||[]).map(e=>({...e,min_quantity:0,max_quantity:0,option_group:e2V(e.option_group)}))}))}),n=iM(a,e.skuValue,{requiredOptionValidation:!1,overSold:e.overSold});if(!n)throw Error("The selected options cannot be priced.");let r=Number(n.product_variant_id)>0?e2q(a.variant).find(e=>e2F(e.id,n.product_variant_id)):void 0,o=e2B(r?r.price??r.selling_price??r.base_price:a.price??a.selling_price??a.base_price);if(o.isNegative())throw Error("The estimated price is unavailable.");let s=e2U(n.option,a.option_group),d=e2q(n.bundle).map(e=>{let t=e2q(a.bundle_group).find(t=>e2F(t.id,e.group_id??e.bundle_group_id)),l=e2q(null==t?void 0:t.bundle_item).find(t=>e2F(t.id,e.id??e.bundle_id));if(!l)throw Error("The selected package item is unavailable.");let i=e2B(l.price??l.custom_price??l.product_price??l.base_price),n=(l.price_type??l.custom_price_type)==="markdown"&&(l.price_type_ext??l.custom_price_type_ext)!=="product_price",r=n?i.abs().toString():i.toString();return{selected:e,markdown:n,base:e2B(r),options:e2U(e.option,l.option_group),quantity:e2H(e.quantity??e.num),query:ekr({...e,price:r,bundle_selling_price:r,original_price:r,custom_price:r,product_price:r,base_price:r})}}),c=t=>{let l=t.mul(i);if(l.isNegative()||!l.isFinite())throw Error("The estimated price is unavailable.");return{subtotal:l.toString(),pricedAt:e.datetime}};if("catalog"===e.priceBasis)return c(d.reduce((e,t)=>e.add((t.markdown?t.base.abs().negated():t.base).add(t.options).mul(t.quantity)),o.add(s)));let u=await e.calculateProductBookingPrice({product:{...e.productDetail,product_id:a.id,product_variant_id:n.product_variant_id,price:o.toString(),quantity:i,num:i,product_sku:{option:n.option},product_bundle:d.map(e=>e.query)},datetime:e.datetime,channel:"online_ordering",...null!=e.customerId?{customer_id:e.customerId}:{}});if(!u||!e2F(u.product_id,a.id)||!e2F(u.product_variant_id??0,n.product_variant_id??0)||e2H(u.quantity)!==i)throw Error("The returned estimate does not match the selected product.");let p=e2B(u.unit_price);if(p.isNegative())throw Error("The estimated price is unavailable.");let m=p.add(s);for(let e of d){let t=e2q(u.product_bundle).find(t=>e2F(t.bundle_id,e.selected.id??e.selected.bundle_id)&&e2F(t.bundle_group_id??t.group_id,e.selected.bundle_group_id??e.selected.group_id)&&e2F(t.bundle_product_id,e.query.bundle_product_id)&&e2F(t.bundle_variant_id??0,e.query.bundle_variant_id??0));if(!t)throw Error("The selected package item could not be priced.");let l=e2B(t.unit_price);m=m.add((e.markdown?l.abs().negated():l).add(e.options).mul(e.quantity))}return c(m)}function e2W(e){let{enabled:t,openId:l,scopeKey:i,sessionId:a,productDetail:n,skuValue:r,quantity:o=1,overSold:s,priceBasis:d="current-time",timeZone:c,customerId:u,os:p}=e,m=id(r),g=(0,eC.useMemo)(()=>t&&l&&n&&r?{openId:l,scopeKey:i,sessionId:a,productDetail:n,skuValue:r,quantity:o,overSold:s,priceBasis:d,timeZone:c,customerId:u,os:p}:void 0,[t,l,i,a,n,m,o,s,d,c,u,p]),h=(0,eC.useRef)(g);h.current=g;let[v,f]=(0,eC.useState)();return((0,eC.useEffect)(()=>{if(!g)return;let e=!0,t=()=>e&&h.current===g;return f({request:g,value:{status:"loading"}}),(async()=>{try{if("catalog"!==g.priceBasis&&"function"!=typeof g.os.calculateProductBookingPrice)throw Error("Pricing is unavailable.");let e=await e2Y({productDetail:g.productDetail,skuValue:g.skuValue,quantity:g.quantity,overSold:g.overSold,priceBasis:g.priceBasis,datetime:e_L(g.timeZone),customerId:g.customerId,calculateProductBookingPrice:e=>g.os.calculateProductBookingPrice(e)});t()&&f({request:g,value:{status:"ready",...e}})}catch{t()&&f({request:g,value:{status:"unavailable"}})}})(),()=>{e=!1}},[g]),g)?(null==v?void 0:v.request)===g?v.value:{status:"loading"}:{status:"idle"}}function e2K(e){var t,l,i,a,n;let{mode:r,draft:o,locale:s}=e,d=(e,t)=>"zh"===s?t:e,c=e2w(e),u=eJF(),{configuration:p,setConfiguration:m,quantity:g,setQuantity:h,quote:v,error:f,working:y,revision:b,commit:x}=c,k="tickets"===r&&(null==(t=o.plan)?void 0:t.hasConfiguration)?o.plan.productDetail:void 0,_=lZ((null==(i=e.skuOptions)||null==(l=i.config)?void 0:l.overSold)??o.detail.over_sold),w=(0,eC.useMemo)(()=>!!(k&&iC(k,p.skuValue,{requiredOptionValidation:e.requiredOptionValidation,overSold:_})),[k,p.skuValue,e.requiredOptionValidation,_]),S=e2W({enabled:w,openId:null==(a=o.plan)?void 0:a.openId,scopeKey:e.scopeKey,productDetail:k,skuValue:p.skuValue,quantity:g,overSold:_,priceBasis:"catalog",timeZone:null==u?void 0:u.timeZone,customerId:e.customerId,os:e.priceSource}),j=e.formatAmount||(t=>{var l,i;return YP((null==(i=e.context.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))??e.context.cart.tempOrder,t)}),N=o.catalogStartingAmount,C="tickets"===r&&null!=N&&""!==String(N).trim()&&Number.isFinite(Number(N))?j(new lz(N).times(g).toString()):void 0,M=void 0===C?"—":"zh"===s?`${C} 起`:`From ${C}`,T=M;w&&"ready"===S.status?T=j(S.subtotal):w&&"loading"===S.status&&(T="—");let I=v?j(v.compositeLineTotal):k?T:"from"===o.catalogPriceQualifier?M:C??"—",P=t=>(0,eH.jsx)(e2v,{ref:c.panelRef,...c.bookingProps,scrollContainer:t,renderDatePicker:e.renderDatePicker,dateReadOnly:e.dateReadOnly,actionTarget:()=>{var e;return(null==t||null==(e=t.closest('[role="dialog"]'))?void 0:e.querySelector(".booking-config-actions .booking-primary-action"))||null}}),A=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"tickets"!==r||o.lineUid?null:(0,eH.jsx)("div",{className:"reservation-quantity",role:"group","aria-label":d("Number","数量"),children:(0,eH.jsx)(z8,{className:"booking-ticket-quantity",variant:"capsule",min:1,step:1,value:g,disabled:t||y||e.disabled,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,onChange:l=>{!t&&!y&&!e.disabled&&Number.isSafeInteger(l)&&l>=1&&h(l)}})})},D=(0,eH.jsxs)("div",{className:"venue-booking-sales__booking-footer",children:[A(),(0,eH.jsxs)("div",{className:"tickets"===r?"reservation-subtotal":"party-total","aria-live":"polite",children:[(0,eH.jsx)("span",{children:d("Subtotal","小计")}),(0,eH.jsx)("strong",{children:I})]})]});return"tickets"===r&&o.plan?(0,eH.jsx)(e0j,{plan:o.plan,title:eXp(o.detail.title||o.detail.name,s)||d("Play admission","游玩门票"),summary:(0,eH.jsx)(e2$,{detail:o.detail,configuration:p,locale:s,catalogStartingAmount:o.catalogStartingAmount,catalogPriceQualifier:o.catalogPriceQualifier,formatAmount:j}),configuration:p,onConfigurationChange:m,skuOptions:{...e.skuOptions,priceFormatter:(null==(n=e.skuOptions)?void 0:n.priceFormatter)||(e=>String(j(e)))},requiredOptionValidation:e.requiredOptionValidation,onCancel:c.cancel,locale:s,busy:y||e.disabled,selectionRevision:b,error:f,renderBooking:e=>{let{scrollContainer:t}=e;return P(t)},footerContent:e=>{let{busy:t}=e;return A(t)},configurationFooter:{label:d("Estimated subtotal","预计小计"),amount:(0,eH.jsx)("span",{role:"status","aria-live":"polite",children:T})},bookingActionAmount:I,bookingSubtotalLabel:!v&&w?d("Estimated subtotal","预计小计"):void 0,bookingReady:c.bookingReady,onConfirm:x}):(0,eH.jsxs)("section",{className:"venue-booking-sales__party-selection","aria-label":d("Choose your room and time","选择房间和时间"),children:[P(),f&&(0,eH.jsx)(eT.Alert,{type:"error",message:f,showIcon:!0}),D,(0,eH.jsxs)("div",{className:"venue-booking-sales__actions",children:[(0,eH.jsx)(eXE,{secondary:!0,disabled:y||e.disabled,onClick:c.cancel,children:d("Cancel changes","取消更改")}),(0,eH.jsx)(eXE,{busy:y,disabled:e.disabled||!c.bookingReady,onClick:()=>void x(),children:d("Save Party selection","保存 Party 选择")})]})]})}let e2G=new Set,e2Q=0,e2Z=new WeakMap,e2J=e=>{var t,l,i,a;let n=e=>"string"==typeof e&&e.trim()?e.trim():void 0;if((null==(t=e.otherParams)?void 0:t.businessCode)==="venue_booking"){let t=n(e.otherParams.previousVenueCacheId);if(t)return t}try{return n(null==(l=e.getCacheId)?void 0:l.call(e))||n(null==(i=e.otherParams)?void 0:i.cacheId)}catch{return n(null==(a=e.otherParams)?void 0:a.cacheId)}},e2X=e=>null!=e&&""!==String(e).trim()&&"0"!==String(e).trim(),e20=e=>{var t;if(!e||"payment_pending"!==String(e.status||"").trim().toLowerCase()||!e2X(e.voucher_id)||e2X(e.order_payment_id))return!1;let l=null==(t=e.metadata)?void 0:t.transactions;return!Array.isArray(l)||!l.some(e=>e2X(null==e?void 0:e.number))},e22=e=>{var t,l;return e2X(null==e?void 0:e.order_id)||1===Number(null==e?void 0:e.need_sync)||[null==e?void 0:e.paid_amount,null==e||null==(t=e.summary)?void 0:t.order_paid_amount,null==e||null==(l=e.summary)?void 0:l.customer_paid_amount].some(e=>Number.isFinite(Number(e))&&Number(e)>0)||Array.isArray(null==e?void 0:e.payments)&&e.payments.some(e=>!e20(e))},e21=()=>"u"<typeof window?void 0:window.location.pathname+window.location.search+window.location.hash,e24=e=>e.listeners.forEach(e=>e()),e23=e=>{e.active=!1,e.value={...e.value,ready:!1},e24(e)},e28=function(e,t,l,i){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(e.retiring)return e.retiring;let n=()=>t.orderOwner===e&&t.orderSessionId===l,r=()=>null==t.orderOwner&&(!t.owner||t.owner===e);if(e.retired)return Promise.resolve((n()||r())&&i());if(!e.retireOrder)return Promise.resolve(!1);let o=t.tail.then(async()=>{var t,o;if(a&&e.refs>0||e.sessionId!==l||(await (null==(t=e.waitForRetire)?void 0:t.call(e)),a&&e.refs>0||!i()||e.sessionId!==l))return!1;if(!n())return!!r()&&(e.retired=!0,!0);if(e23(e),e.storageKey)try{(null==(o=JSON.parse(sessionStorage.getItem(e.storageKey)||"null"))?void 0:o.sessionId)===l&&sessionStorage.removeItem(e.storageKey)}catch{}return await e.retireOrder(),!!n()&&(e.order=e.source.getTempOrder(),e.discarded=!0,e.retired=!0,!0)});e.retiring=o;let s=()=>{e.retiring===o&&(e.retiring=void 0)};return t.tail=o.then(s,s),o};class e26 extends Error{constructor(e){super(e),e1(this,"code",void 0),this.code=e}}let e25=e=>{throw new e26(e)},e27=e=>Array.isArray(e)?e.filter(Boolean):[],e29=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(null==e||""===e)return t;let l=Number(e);return Number.isSafeInteger(l)&&l>=0?l:e25("PREVIEW_INVALID_SKU_BOUNDS")},e1e=e=>{++e.work>15e4&&e25("PREVIEW_COMPLEX_CONFIGURATION")};function e1t(e){let t,l;for(let i of e)0===i.capacity?(!t||i.quantity<t.quantity)&&(t=i):(!l||i.capacity<l.capacity||i.capacity===l.capacity&&i.quantity<l.quantity)&&(l=i);return[t,l].filter(e=>!!e)}function e1l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(l||!lZ(e.is_track)||lZ(e.over_sold))return 256;let i=Number(e.stock_quantity);return Number.isFinite(i)&&i>0?Math.max(0,Math.floor(i/t)):0}function e1i(e){var t,l,i,a,n,r;let{group:o,kind:s,policy:d,budget:c,multiplier:u}=e,p="bundle"===s||lZ(o.is_multiple),m="option"===s&&p&&lZ(null==(t=o.metadata)?void 0:t.advanced_settings_enabled),g=d.requiredOptionValidation,h=g&&m?e29(null==(i=o.metadata)||null==(l=i.option_types_config)?void 0:l.min):0,v=m?e29(null==(n=o.metadata)||null==(a=n.option_types_config)?void 0:a.max):0,f=g?p?e29(o.min_quantity):+!!lZ(o.required):0,y=p?e29(o.max_quantity):0;(y&&f>y||v&&h>v)&&e25("PREVIEW_INVALID_SKU_BOUNDS");let b=e.items.filter(e=>l3(e,{overSold:d.overSold})),x=b.map(e=>Math.max(1,e29(e.min_quantity)));if(!p){if(!f)return[{rows:[],capacity:0,quantity:0}];for(let t=0;t<b.length;t++){e1e(c);let l=x[t],i=e29(b[t].max_quantity);if(l>256&&e25("PREVIEW_COMPLEX_CONFIGURATION"),i&&l>i||l>e1l(b[t],u,d.overSold))continue;let a=e.makeRow(b[t],l);if(a)return[{rows:[a],capacity:(null==(r=e.counted)?void 0:r.call(e,b[t]))?l:0,quantity:l}]}return[]}if(0===f&&0===h&&!b.some(t=>{var l;return null==(l=e.counted)?void 0:l.call(e,t)}))return[{rows:[],capacity:0,quantity:0}];let k=Math.max(1,...x),_=Math.max(1,Math.min(f+x.reduce((e,t)=>e+t,0),Math.max(f,h*k)+2*k)),w=y?Math.min(_,y):_;(w>256||h>256)&&e25("PREVIEW_COMPLEX_CONFIGURATION");let S=!p||h>0||v>0,j=new Map([["0:0",[{rows:[],capacity:0,quantity:0}]]]);for(let t=0;t<b.length;t++){let l=b[t],i=x[t],a=Math.min(w,e29(l.max_quantity)||w,e1l(l,u,d.overSold)),n=new Map,r=new Map;for(let[t,o]of j){let[s,d]=t.split(":").map(Number),u=[0];if(p||0===d)for(let e=i;e<=a&&s+e<=w;e++)u.push(e);for(let t of u){let i;e1e(c);let a=d+(t&&S?1:0);if(v&&a>v||t&&(n.has(t)||n.set(t,e.makeRow(l,t)),!(i=n.get(t))))continue;let u=`${s+t}:${a}`,p=o.map(a=>{var n;return{rows:i?[...a.rows,i]:a.rows,quantity:s+t,capacity:a.capacity+((null==(n=e.counted)?void 0:n.call(e,l))?t:0)}});r.set(u,e1t([...r.get(u)||[],...p]))}}j=r}return e1t([...j.entries()].flatMap(e=>{let[t,l]=e,[i,a]=t.split(":").map(Number);return i>=f&&a>=h?l:[]}))}function e1a(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=[];for(let n of e27(e.option_group).filter(l1)){let r=e1i({group:n,items:e27(n.option_item),kind:"option",policy:t,budget:l,multiplier:i,makeRow:(t,l)=>({...t,id:t.id,product_option_item_id:t.id,option_group_id:n.id,product_id:e.id,quantity:l,num:l})});if(!r.length)return;a.push(...r[0].rows)}return a}function e1n(e,t,l){var i;let a=(null==(i=e._data)?void 0:i.capacitys)??e.capacity,n=(null==a?void 0:a.type)==="package"?e27(a.package).map(e=>e.product_id):[],r=[{rows:[],capacity:0,quantity:0}];for(let i of e27(e.bundle_group).filter(l1)){let e=e1i({group:i,items:e27(i.bundle_item),kind:"bundle",policy:t,budget:l,multiplier:1,counted:e=>n.includes(e.bundle_product_id),makeRow:(e,a)=>{let n=e1a(e,t,l,a);if(n)return{...e,id:e.id,group_id:i.id,_bundle_product_id:e.bundle_product_id,quantity:a,num:a,option:n}}});if(!e.length)return[];r=e1t(r.flatMap(t=>e.map(e=>({rows:[...t.rows,...e.rows],capacity:t.capacity+e.capacity,quantity:t.quantity+e.quantity}))))}return r}function e1r(e,t){if(t.overSold)return;let l=new Set;for(let t of e27(e.bundle_group).filter(l1))for(let e of e27(t.bundle_item).filter(l1)){if(lZ(e.is_track)&&!lZ(e.over_sold)){let t=Number(e.bundle_variant_id)>0?`variant:${e.bundle_variant_id}`:`product:${e.bundle_product_id}`;(null==e.bundle_product_id||l.has(t))&&e25("PREVIEW_SHARED_STOCK_CONFIGURATION"),l.add(t)}1!==e29(e.max_quantity)&&1!==e29(t.max_quantity)&&e27(e.option_group).filter(l1).some(e=>e27(e.option_item).some(e=>l1(e)&&lZ(e.is_track)&&!lZ(e.over_sold)))&&e25("PREVIEW_SPLIT_BUNDLE_STOCK_CONFIGURATION")}}let e1o=["duration","service_duration","product_resource","capacity","session","schedule","schedules"];function e1s(e){for(let t of[...e27(e.variant),...e27(e.option_group).flatMap(e=>e27(e.option_item))])for(let l of e1o)null!=t[l]&&JSON.stringify(t[l])!==JSON.stringify(e[l])&&e25("PREVIEW_SKU_BOOKING_OVERRIDE_UNSUPPORTED")}async function e1d(e,t){var l,i;let a={available:!1,availability:{}},n=!1,r=()=>{var e;return!n&&(null==(e=t.isCurrent)?void 0:e.call(t))!==!1},o=(null==(l=(i=t.resolvePolicy).createBatch)?void 0:l.call(i))??t.resolvePolicy,s=async l=>{if(!r())return;let i=l.id??l.product_id;if(!Number.isSafeInteger(Number(i))||0>=Number(i))return{id:String(i),state:{available:!1,reasons:["INVALID_PRODUCT_ID"]}};if(!t.catalogParams.menu_list_ids.length)throw new e26("PREVIEW_MENU_CONFIGURATION_REQUIRED");let a=t.productsFromSessionSnapshot?l:await t.queries.queryCatalogProductDetail({...t.catalogParams,product_id:Number(i),schedule_date:t.date,with_count:["bundleGroup","optionGroup"],with_schedule:1});if(!r())return;if(!a)return{id:String(i),state:{available:!1,reasons:["PRODUCT_NOT_IN_MENU"]}};if(String(a.id??a.product_id)!==String(i))return{id:String(i),state:{available:!1,reasons:["PRODUCT_MISMATCH"]}};let n=function(e,t){try{let l;t.runtimePolicy.settings||e25("PREVIEW_SALES_SETTINGS_REQUIRED");let i=iA({productDetail:e,requestedProductId:e.id??e.product_id,completeness:"complete"}),a=Number(e.variant_count);if(lZ(e.is_variant)&&(!e27(e.variant).length||Number.isSafeInteger(a)&&a>e27(e.variant).length)&&("ready"===i.status||i.issues.length&&i.issues.every(e=>"MISSING_VARIANTS"===e.code&&"variant"===e.path))){let l=function(e,t){if(!l1(e)||!Object.values(e0O(e)).some(e=>e.length>0))return[];e1s(e),e1r(e,t);let l={work:0},i=e1a(e,t,l),a=e1n(e,t,l);if(!i||!a.length)return[];let n=[];for(let t of a){let l=e0E(e,{option:i,bundle:t.rows}),a=e.duration??e.service_duration;!l.reasonCodes.length&&l.partySize&&(l.durationMinutes||(null==a?void 0:a.type)==="flexible")&&n.push({product:l.product,partySize:l.partySize,durationMinutes:l.durationMinutes})}return n}(e,{...t,overSold:t.overSold&&lZ(e.over_sold)});return l.length?{status:"requires-configuration",candidates:l,reasonCodes:[]}:{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE"]}}if("invalid"===i.status)return{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE",...new Set(i.issues.map(e=>e.code))]};let n=i.productDetail;t={...t,overSold:t.overSold&&lZ(n.over_sold)},e1s(n),e1r(n,t);let r={work:0},o=e1a(n,t,r),s=e1n(n,t,r);if(!o||!s.length)return{status:"unavailable",candidates:[],reasonCodes:["NO_SELLABLE_SKU"]};let d=e27(n.variant_group).some(l1)?e27(n.variant).filter(e=>l3(e,{overSold:t.overSold})):[void 0],c=new Set;for(let e of d)for(let i of s){if(e1e(r),1>e1l(e||n,1,t.overSold))continue;let a=iC(n,{product_id:Number(n.id),product_variant_id:Number((null==e?void 0:e.id)||0),option:o,bundle:i.rows},t);if(!a||iK({data:function(e,t){if(!t)return e;let l=e=>e27(e).map(e=>({...e,option_item:e27(e.option_item).map(e=>({...e,over_sold:1}))}));return{...e,over_sold:1,variant:e27(e.variant).map(e=>({...e,over_sold:1})),option_group:l(e.option_group),bundle_group:e27(e.bundle_group).map(e=>({...e,bundle_item:e27(e.bundle_item).map(e=>({...e,over_sold:1,option_group:l(e.option_group)}))}))}}(n,t.overSold),value:a,runtimePolicy:{...t.runtimePolicy,platform:"pc"}}).shouldBlock)continue;let s=e0E(n,a);if(s.reasonCodes.length||!s.partySize){s.reasonCodes.forEach(e=>c.add(e));continue}(!l||s.partySize<l.partySize)&&(l={product:s.product,skuValue:a,partySize:s.partySize,durationMinutes:s.durationMinutes})}if(l)return{status:"ready",candidates:[l],reasonCodes:[]};return{status:c.size?"configuration-error":"unavailable",candidates:[],reasonCodes:c.size?[...c]:["NO_SELLABLE_SKU"]}}catch(e){if(e instanceof e26)return{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE",e.code]};throw e}}(a,await o(a));if(!r())return;let s={available:!1,reasons:[...n.reasonCodes]};if("ready"!==n.status&&"requires-configuration"!==n.status)return{id:String(i),state:s};for(let l of n.candidates){let i;if(!r())break;try{if(i=await e0Q({os:e,mode:t.mode||"ticket",date:t.date,product:l.product,quantity:1},{projectionDateRange:t.projectionDateRange}),!r())break;let a=i.times.filter(e=>e0$(e,l.partySize));if(a.some(e=>{let i=e.requirementGroups||[];return i.every(e=>1>=Math.max(+!!e.required,e.min||0)&&(!(e.required||e.min>0)||e.max>=1&&e.options.some(e=>e0$(e,l.partySize))))&&("party"!==t.mode||i.some(e=>e.max>=1&&e.options.some(e=>e0$(e,l.partySize))))})){"requires-configuration"===n.status?s.requiresConfiguration=!0:s.available=!0,s.reasons=[];break}s.reasons.push(...i.times.flatMap(e=>e.reasonCodes||[])),s.reasons.length||s.reasons.push(a.length?"UNSUPPORTED_RESOURCE_GROUP":"NO_AVAILABLE_BOOKING")}catch(e){if(e instanceof e0L)s.reasons.push(...e.reasonCodes);else throw e}finally{e0K(e,i)}}return s.reasons=[...new Set(s.reasons)],{id:String(i),state:s,evaluated:!0}},d=Array(t.products.length),c=0,u=async()=>{for(;r()&&c<t.products.length;){let e=c++;try{let l=await s(t.products[e]);if(d[e]=l,t.stopAtFirstAvailable&&((null==l?void 0:l.state.available)||(null==l?void 0:l.state.requiresConfiguration)))return}catch(e){throw n=!0,e}}},p=t.stopAtFirstAvailable||2!==t.concurrency?1:2;for(let e of(await Promise.all(Array.from({length:Math.min(p,t.products.length)},()=>u())),d))e&&(a.availability[e.id]=e.state,e.evaluated&&(a.available||(a.available=e.state.available),a.requiresConfiguration||(a.requiresConfiguration=e.state.requiresConfiguration)));return a}let e1c=e=>{let t=e.id??e.product_id;return"number"==typeof t?Number.isFinite(t)?String(t):void 0:"string"==typeof t&&t.trim()?t:void 0};function e1u(e){let{os:t,ready:l,catalog:i,date:a,datetime:n,customerId:r,scopeKey:o,retail:s=!1,retailTimeZone:d,revision:c=0,resolvePolicy:u,mode:p="ticket",queries:m,onRetry:g,projectionDateRange:h,operationLog:v}=e,[f,y]=(0,eC.useState)(0),b=(0,eC.useRef)(0),x=(0,eC.useRef)(v);x.current=v;let k=(0,eC.useRef)(),_=JSON.stringify((null==i?void 0:i.menuListIds)||[]),w=s?void 0:a,S=s?void 0:n,j=s||null==h?void 0:h.startDate,N=s||null==h?void 0:h.endDate,C=(0,eC.useMemo)(()=>({}),[t,_,w,S,r,o,s,d,p]),M=(0,eC.useMemo)(()=>({identity:C,ready:l}),[C,l,f,c,u,m,j,N]),[T,I]=(0,eC.useState)(),P=e=>l&&(null==e?void 0:e.request.identity)===C?e.state.products:[];return(0,eC.useEffect)(()=>{let e,n,o=++b.current,c=!1;if(I(e=>({request:M,state:{products:P(e),loading:!0,availability:{}}})),!l){k.current=void 0;return}try{var g;e=null==(g=x.current)?void 0:g.capture()}catch{}return(async()=>{if(!(null==i?void 0:i.menuListIds.length))return void I({request:M,state:{products:[],availability:{},loading:!1}});if("function"!=typeof(null==m?void 0:m.queryCatalogSnapshot))throw Error("The booking catalog service is unavailable. Please update the booking service.");n=s?e_L(d):S;let l=await m.queryCatalogSnapshot({menu_list_ids:[...i.menuListIds],schedule_date:s?n.slice(0,10):w,...n?{schedule_datetime:n}:{},...r?{customer_id:Number(r)}:{}});if(c||b.current!==o)return;let g={};if(!s&&l.length){if(!u)throw Error("The booking sales settings are unavailable.");Object.assign(g,(await e1d(t,{products:l,productsFromSessionSnapshot:!0,concurrency:2,date:a,mode:p,resolvePolicy:u,queries:m,...j&&N?{projectionDateRange:{startDate:j,endDate:N}}:{},catalogParams:{menu_list_ids:i.menuListIds,...r?{customer_id:r}:{}},isCurrent:()=>!c&&b.current===o})).availability)}c||b.current!==o||(I({request:M,state:{products:l,availability:g,loading:!1,...s?{pricingDatetime:n}:{}}}),((t,l)=>{if(e)try{let r=function(e){let t=e.menuListIds.length>100,l=0,i=new Set,a=[],n={available:{count:0,ids:[]},unavailable:{count:0,ids:[]},requiresConfiguration:{count:0,ids:[]},unknown:{count:0,ids:[]}},r=[];for(let s of e.products){var o;let d=e1c(s);if(void 0===d){l++;continue}if(i.has(d))continue;i.add(d),a.length<100?a.push(d):t=!0;let c="main"===e.poolRole?null==(o=e.availability)?void 0:o[d]:void 0,u=(null==c?void 0:c.requiresConfiguration)?"requiresConfiguration":(null==c?void 0:c.available)===!0?"available":(null==c?void 0:c.available)===!1?"unavailable":"unknown",p=n[u];if(p.count++,p.ids.length<100?p.ids.push(d):t=!0,"unavailable"===u&&r.length<100){let e=(null==c?void 0:c.reasons)||[],l=[];for(let i of e){if(3===l.length){t=!0;break}if("string"==typeof i&&i){if(!/^[a-z][a-z0-9_:-]*$/i.test(i)){t=!0;continue}i.length>80&&(t=!0),l.push(i.slice(0,80))}}r.push({productId:d,reasonCodes:l})}}return{poolRole:e.poolRole,requestedDate:e.requestedDate,...e.pricingDatetime?{pricingDatetime:e.pricingDatetime}:{},menuCount:e.menuListIds.length,menuListIds:e.menuListIds.slice(0,100),productsCount:e.products.length,productIdCount:i.size,productIds:a,unidentifiedProductsCount:l,availabilityChecked:"main"===e.poolRole,availableCount:n.available.count,availableProductIds:n.available.ids,unavailableCount:n.unavailable.count,unavailableProductIds:n.unavailable.ids,requiresConfigurationCount:n.requiresConfiguration.count,requiresConfigurationProductIds:n.requiresConfiguration.ids,unknownCount:n.unknown.count,unknownProductIds:n.unknown.ids,unavailableReasons:r,truncated:t}}({poolRole:s?"extras":"main",requestedDate:s?n.slice(0,10):a,pricingDatetime:n,menuListIds:(null==i?void 0:i.menuListIds)||[],products:t,availability:l}),o=JSON.stringify(r),d=k.current;if(!r.truncated&&(null==d?void 0:d.identity)===C&&d.queries===m&&d.key===o)return;e("catalog_resolved",r),k.current={identity:C,queries:m,key:o}}catch{}})(l,g))})().catch(t=>{if(!c&&b.current===o){I(e=>({request:M,state:{products:P(e),availability:{},loading:!1,error:t instanceof Error?t.message:String(t)}})),k.current=void 0;try{null==e||e("catalog_failed",{poolRole:s?"extras":"main",requestedDate:s?null==n?void 0:n.slice(0,10):a,...n?{pricingDatetime:n}:{},menuListIds:((null==i?void 0:i.menuListIds)||[]).slice(0,100),errorCode:t&&"object"==typeof t&&"code"in t?String(t.code).slice(0,80):void 0,errorMessage:(t instanceof Error?t.message:String(t)).slice(0,300)},"error")}catch{}}}),()=>{c=!0}},[M]),{...(null==T?void 0:T.request)===M?T.state:{products:P(T),loading:!0,availability:{}},retry:g||(()=>{var e;null==(e=m.retry)||e.call(m),y(e=>e+1)})}}function e1p(e){var t;if(!l1(e)||lZ(e.is_grey)||["draft","pending","archived"].includes(e.status))return!1;let l=lJ(null==(t=e.item_rule_limit)?void 0:t.remainingMax);if(void 0!==l&&l<1)return!1;let i=lZ(e.over_sold),a=e=>{let t=lJ(e.stock_quantity)??lJ(e.sum_stock);return!lZ(e.is_track)||i||lZ(e.over_sold)||void 0===t||t>0},n=e.variant;return a(e)&&(!Array.isArray(n)||!n.length||n.some(e=>l1(e)&&a(e)))}let e1m=(e,t)=>e.length===t.length&&e.every((e,l)=>e===t[l]);function e1g(e){let t=e.menuListIds.join(","),l=(0,eC.useMemo)(()=>{if(!e.sessionId||!t||!e.os.createVenueCatalogSession){let e=async()=>{throw Error("The local booking catalog is unavailable. Please update the booking service.")};return{queryCatalogSnapshot:e,queryCatalogProductDetail:e,prepareProductDetail:e,calculateProductBookingPrice:e,dispose(){}}}return e.os.createVenueCatalogSession({menu_list_ids:[...e.menuListIds],poolRole:e.poolRole,sessionKey:e.sessionId})},[e.os,e.scopeKey,e.sessionId,t,e.poolRole]);return(0,eC.useEffect)(()=>()=>l.dispose(),[l]),l}function e1h(e){if(!e||!e0m(e.startDate)||!e0m(e.endDate))return[];let t=(Date.parse(`${e.endDate}T12:00:00Z`)-Date.parse(`${e.startDate}T12:00:00Z`))/864e5+1;return!Number.isSafeInteger(t)||t<1||t>32?[]:Array.from({length:t},(t,l)=>e0h(e.startDate,l))}let e1v=(e,t)=>Array.isArray(e)?e.find(e=>Number(null==e?void 0:e.id)===Number(t)):void 0;function e1f(e,t,l){let i=e||{...l,id:Number(null==l?void 0:l.product_id)},a=t&&e?e1v(e.variant,t):void 0,n=l&&Number(l.product_id)===Number(i.id)&&Number(l.product_variant_id)===Number(t),r=Hn(a);if(!a&&t&&n){var o,s;if(Number(null==(o=l.metadata)?void 0:o.venue_extra_holder_variant_id)===t)r=Hn(l);else{let e=(null==(s=l.metadata)?void 0:s.origin)??l._origin;r=Hn(e1v(null==e?void 0:e.variant,t))}}return r?{source:{...i,holder_config:r},overrideVariantId:t||null}:{source:i,overrideVariantId:null}}function e1y(e,t,l){return e1f(e,t,l).source}function e1b(e,t,l,i,a,n){let r=Ho(e1y(e,t,n)),o=i.filter(e=>"form"===e.holder_type);if(!r.enabled)return!o.length;let s=new Set(o.map(e=>Number(e.holder_id)));return o.every(e=>{var t,l;return"order_detail"===e.relation_model&&Number.isSafeInteger(Number(e.holder_id))&&Number(e.holder_id)>0&&((null==(t=e.metadata)?void 0:t.form_id)==null||String(e.metadata.form_id)===String(r.formId))&&((null==(l=e.metadata)?void 0:l.customer_id)==null||String(e.metadata.customer_id)===String(a))})&&s.size===o.length&&s.size<=l&&(!r.required||s.size===l)}class e1x extends Error{constructor(e,t){super(t),e1(this,"code",void 0),this.code=e,this.name="PartyExtraError"}}let e1k=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")};function e1_(e,t){if("tickets"!==t.mode){let l;return(l=t.parentLineUid)?e.filter(e=>{var t;return(null==(t=e.metadata)?void 0:t.venue_booking_role)==="party_extra"&&String(e.metadata.venue_booking_parent_uid??"")===l}):[]}return e.filter(e=>{var l;return(null==(l=e.metadata)?void 0:l.venue_booking_role)==="tickets_extra"&&e.metadata.venue_booking_scope_key===t.scopeKey})}function e1w(e){let{schedule_date:t,schedule_datetime:l,...i}=e.productLoadParams;return JSON.stringify([e.mode??"party",e.scopeKey,"tickets"===e.mode?null:e.parentLineUid,e.timeZone,e.customerId??null,i])}function e1S(e,t){return{mode:e.mode,timeZone:e.timeZone,parentLineUid:e.parentLineUid,serviceDatetime:e.serviceDatetime,scopeKey:e.scopeKey,customerId:e.customerId,productLoadParams:e.productLoadParams,...t}}function e1j(e,t){let l=e1S(e,t);return{...l,..."tickets"===l.mode?{parentLineUid:void 0}:{},serviceDatetime:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;try{return e_L(e,t)}catch(e){throw new e1x("TIMEZONE_REQUIRED",e instanceof Error?e.message:"The venue timezone is invalid.")}}(l.timeZone)}}function e1N(e,t,l){return{code:e instanceof e1x?e.code:"EXTRA_UNAVAILABLE",message:e instanceof Error?e.message:"Unable to prepare this extra. Please try again.",productId:l??((null==t?void 0:t.product_id)==null?void 0:Number(t.product_id)),...t?{lineUid:e1k(t),line:t}:{}}}function e1C(e){if(!Number.isSafeInteger(e)||e<=0)throw new e1x("INVALID_QUANTITY","Choose a valid quantity.");return e}function e1M(e){let t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>({product_option_item_id:e.product_option_item_id??e.option_group_item_id??e.id,option_group_id:e.option_group_id,num:e.num??e.quantity??1}))};return{product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id??0),product_option_string:e.product_option_string,option:t(e.option),bundle:(e.bundle||[]).map(e=>{var l;return{id:e.id??e.bundle_id??e.bundle_item_id,group_id:e.group_id??e.bundle_group_id,bundle_variant_id:e.bundle_variant_id??e.variant_id,num:e.num??e.quantity??1,option:t(e.option??(null==(l=e.product_sku)?void 0:l.option))}})}}function e1T(e){var t;return e1M({product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id??0),option:(null==(t=e.product_sku)?void 0:t.option)??[],bundle:e.product_bundle??[]})}let e1I=e=>JSON.stringify([String(e.group_id??e.bundle_group_id??""),String(e.id??e.bundle_id??e.bundle_item_id??""),String(e.bundle_variant_id??e.variant_id??0)]);function e1P(e){var t,l;let i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>[String(e.option_group_id??""),String(e.product_option_item_id??e.option_group_item_id??e.id??""),Number(e.num??e.quantity??1),Number(e.original_price??e.price??e.add_price??0)]).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t)))},a=(e.product_bundle??[]).map(e=>{var t;return[String(e.group_id??e.bundle_group_id??""),String(e.id??e.bundle_id??e.bundle_item_id??""),String(e.bundle_variant_id??e.variant_id??0),Number(e.num??e.quantity??1),String(e.price_type??e.custom_price_type??""),String(e.price_type_ext??""),Number(e.original_price??e.product_price??e.price??0),i(e.option??(null==(t=e.product_sku)?void 0:t.option))]}).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t)));return JSON.stringify([Number(e.num),Number((null==(t=e.metadata)?void 0:t.main_product_original_price)??e.original_price),i(null==(l=e.product_sku)?void 0:l.option),a])}function e1A(e){return{venue_booking_role:"tickets"===e.mode?"tickets_extra":"party_extra",..."tickets"===e.mode?{}:{venue_booking_parent_uid:e.parentLineUid},venue_booking_service_datetime:e.serviceDatetime,venue_booking_scope_key:e.scopeKey}}let e1D=function(e){var t;let l,i,a,n,r,o,s,d,c,u,p,m,g,h,v,f,y,b,x,k,_,w,S,j,N,C,M=(0,eC.useRef)(e);M.current=e;let T=(0,eC.useRef)(!0),I=(0,eC.useRef)();I.current||(t=()=>{if(!T.current)throw new e1x("CLOSED","The extras page is closed. Please open it again.");return M.current},l=0,i=0,a=!1,n=new Map,r=()=>{var e;return(null==(e=t().os.getTempOrder())?void 0:e.products)??[]},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e1S(t());return e1_(r(),e)},s=e=>{var l;return UO(e,null==(l=t().os.getTempOrder())?void 0:l.holder_relations)},d=e=>JSON.stringify([e,s(e)]),c=e=>JSON.stringify(o(e).map(d)),u=e=>{var t;return JSON.stringify([null==e?void 0:e.order_id,null==e?void 0:e.external_sale_number,null==e||null==(t=e._extend)?void 0:t.localId])},p=e=>{let l=t().os.getTempOrder();if(!l||Number(l.order_id||0)>0)throw new e1x("NEW_DRAFT_REQUIRED","Start a new booking order before adding extras.");if("tickets"===e.mode){if(!r().some(t=>{var l;return(null==(l=t.metadata)?void 0:l.venue_booking_role)==="tickets"&&t.metadata.venue_booking_scope_key===e.scopeKey}))throw new e1x("TICKETS_REQUIRED","Add a ticket before adding extras.")}else if(!e.parentLineUid||!r().some(t=>{var l;return e1k(t)===e.parentLineUid&&(null==(l=t.metadata)?void 0:l.venue_booking_role)==="party_main"&&t.metadata.venue_booking_scope_key===e.scopeKey}))throw new e1x("PARENT_REQUIRED","Choose and save the Party product before adding extras.")},m=e=>{if(p(e),!e.scopeKey||!e.serviceDatetime||!/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(e.serviceDatetime))throw new e1x("SERVICE_TIME_REQUIRED","The extras pricing date and time are unavailable.");let t=e.productLoadParams.menu_list_ids;if(!(null==t?void 0:t.length)||t.some(e=>!Number.isSafeInteger(e)||e<=0))throw new e1x("CATALOG_REQUIRED","This extras step needs its own menu configuration.")},g=(e,l)=>{if(t().os!==l.os||t().catalogSession!==l.catalogSession||e1w(e1S(t()))!==e1w(e))throw new e1x("STALE_CONTEXT","The booking or extras selection changed. Please choose this item again.");p(e)},h=(e,t)=>{let l=t.os.getTempOrder(),i=null==l?void 0:l.customer_id,a=u(l),n=c(e),r=()=>{if(g(e,t),!l||t.os.getTempOrder()!==l||u(l)!==a||l.customer_id!==i)throw new e1x("STALE_CART","The order or customer changed. Please check the extras again.")};return{beforeApply:()=>{var l,i;if("tickets"===e.mode&&(null==(l=(i=t.os).supportsVenueTicketExtras)?void 0:l.call(i))!==!0)throw new e1x("TICKETS_EXTRAS_SERVICE_UPGRADE_REQUIRED","Tickets extras need an updated booking service. Your selection is kept; update the service before adding or repricing extras.");if(r(),n!==c(e))throw new e1x("STALE_CART","The extras changed while checking the price. Please retry.")},isCurrentOrder:()=>{try{return r(),!0}catch{return!1}}}},v=async e=>{if(a)throw new e1x("BUSY","Please wait for the current cart update.");a=!0;try{return await e()}finally{a=!1}},f=async()=>{try{var e,l;t().cart.refreshCartSnapshot(),await (null==(e=(l=t()).onMutated)?void 0:e.call(l))}catch(e){console.warn("[PartyExtras] Saved extra; UI refresh failed",e)}},y=async function(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"local";m(t);let a=l.catalogSession;if(!(null==a?void 0:a.queryCatalogProductDetail)||!a.calculateProductBookingPrice||"prepare-configuration"===i&&!a.prepareProductDetail)throw new e1x("CATALOG_SESSION_REQUIRED","The extras catalog service is unavailable. Update the booking service and reload this page.");let n={...t.productLoadParams,product_id:e,schedule_date:t.serviceDatetime.slice(0,10),schedule_datetime:t.serviceDatetime,with_count:["bundleGroup","optionGroup"],with_schedule:1,...null!=t.customerId?{customer_id:Number(t.customerId)}:{}},r="prepare-configuration"===i?await a.prepareProductDetail({...n,retry:!0}):await a.queryCatalogProductDetail(n);if(!r||Number(r.id)!==e)throw new e1x("NOT_IN_CATALOG","This extra is no longer available in the selected menu at the current venue time.");for(let[e,t]of[["option_group_count","option_group"],["bundle_group_count","bundle_group"]])if(Number(r[e])>0&&!Array.isArray(r[t]))throw new e1x("INCOMPLETE_DETAIL","Product options are not ready. Please retry.");let o=iA({productDetail:r,requestedProductId:e,completeness:"complete",missingGroupPolicy:l.detailMissingGroupPolicy??"reject"});if("invalid"===o.status)throw new e1x("INCOMPLETE_DETAIL",o.issues.map(e=>e.message).join(" "));if(lZ(r.open_sold_weight))throw new e1x("WEIGHING_REQUIRED","This extra requires a measured weight and cannot be added from this booking page.");return o.productDetail},b=async(e,t,l,i,a,n,r,o)=>{var d,c,u,p,m,g,h;let v,f=a.catalogSession;if(!(null==f?void 0:f.calculateProductBookingPrice))throw new e1x("CATALOG_SESSION_REQUIRED","The extras catalog service is unavailable. Update the booking service and reload this page.");let y=(null==o?void 0:o.detail)===e?o.policy:await a.resolveSelectionPolicy(e),b=iC(e,e1M(t),y);if(!b)throw new e1x("INVALID_CONFIGURATION","An option or variant is no longer available. Please choose the options again.");!function(e,t,l,i){var a,n,r,o,s;e1C(l);let d=(t.product_variant_id?null==(a=e.variant)?void 0:a.find(e=>String(e.id)===String(t.product_variant_id)):void 0)??e;if(!l3(e,{overSold:i})||!l3(d,{overSold:i})||lZ(e.is_grey))throw new e1x("SOLD_OUT","This extra is currently unavailable. Choose another item or remove it.");if(lZ(d.is_track)&&!i&&l>Number(d.stock_quantity??0))throw new e1x("INSUFFICIENT_STOCK","The selected quantity is no longer available.");let c=null==(n=e.item_rule_limit)?void 0:n.remainingMax;if(l<Number((null==(r=e.item_rule_limit)?void 0:r.min)??0)||null!=c&&l>Number(c))throw new e1x("QUANTITY_LIMIT",(null==(o=e.item_rule_limit)?void 0:o.validationMessage)||"Update this extra to an available quantity.");let u=[...t.option,...t.bundle].map(e=>({row:e,multiplier:l}));for(let e of t.bundle)for(let t of e.option??(null==(s=e.product_sku)?void 0:s.option)??[])u.push({row:t,multiplier:l*Number(e.num??1)});for(let{row:e,multiplier:t}of u)if(lZ(e.is_track)&&!i&&t*Number(e.num??1)>Number(e.stock_quantity??0))throw new e1x("INSUFFICIENT_STOCK","An option or bundle item no longer has enough stock.")}(e,b,l,y.overSold);let x={...e,product_id:e.id,product_variant_id:b.product_variant_id,quantity:l,num:l,product_sku:{option:b.option},product_bundle:b.bundle.map(ekr)},k=await f.calculateProductBookingPrice({product:x,datetime:i.serviceDatetime,channel:"online_ordering",...null!=i.customerId?{customer_id:i.customerId}:{}});if(Number(k.product_id)!==Number(e.id)||Number(k.product_variant_id??0)!==Number(b.product_variant_id??0))throw new e1x("PRICE_MISMATCH","The returned price does not match the selected extra. Please retry.");if(null==k.unit_price||""===String(k.unit_price).trim()||!Number.isFinite(Number(k.unit_price))||0>Number(k.unit_price))throw new e1x("PRICE_UNAVAILABLE","The current price is unavailable. Please retry before adding this extra.");let _=eks(x.product_bundle,k)??[],w={...e.metadata||{},...e1A(i),quotation_shelf_id:k.quotation_shelf_id};delete w.unique_identification_number,delete w.booking_uid;let{source:S,overrideVariantId:j}=e1f(e,b.product_variant_id,n),N=Ho(S),C=n?s(n):[],M=r??C;if((N.required||N.enabled&&M.length>0)&&(null==(d=(c=a.os).supportsVenueExtraHolders)?void 0:d.call(c))!==!0)throw new e1x("HOLDER_SERVICE_REQUIRED","The booking service needs to be updated to save holder profiles.");if((N.required||void 0!==r)&&!e1b(e,b.product_variant_id,l,M,i.customerId,n))throw new e1x("HOLDER_REQUIRED","Review the holder profiles for this item.");let T=N.raw??{status:"disable",required:0};w.holder_config=T,w.venue_extra_holder_variant_id=j,"tickets"===i.mode&&delete w.venue_booking_parent_uid,n&&(w.unique_identification_number=e1k(n));let I={...x,price:k.unit_price,selling_price:k.unit_price,quotation_shelf_id:k.quotation_shelf_id,total:void 0,line_total:void 0,price_override:void 0,_extend:N.enabled||M.length?{holder_relations:M}:void 0,unique_identification_number:void 0,discount_list:[],metadata:w,option:b.option,bundle:_,product_bundle:_,holder_config:T,booking_uid:void 0},P=!1;if(n){(v=ekd({line:{...n,num:l,product_sku:x.product_sku,product_bundle:_},result:k,resetDiscountList:!0})).unique_identification_number=e1k(n),v.updates.metadata={...v.updates.metadata,...e1A(i)};let e={...n,...v.updates};if(P=e1P(n)!==e1P(e),e1P(n)===e1P(e)){let e=null==(m=n.product_bundle)?void 0:m.map(e=>{var t;return{...e,quotation_shelf_id:null==(t=_.find(t=>e1I(t)===e1I(e)))?void 0:t.quotation_shelf_id}}),t=[null==(g=n.metadata)?void 0:g.quotation_shelf_id,null==(h=n.product_bundle)?void 0:h.map(e=>e.quotation_shelf_id),Object.keys(e1A(i)).map(e=>{var t;return null==(t=n.metadata)?void 0:t[e]})],l=[k.quotation_shelf_id,null==e?void 0:e.map(e=>e.quotation_shelf_id),Object.values(e1A(i))];v=JSON.stringify(t)===JSON.stringify(l)?void 0:{product_id:n.product_id,product_variant_id:n.product_variant_id,unique_identification_number:e1k(n),updates:{metadata:{...n.metadata,...e1A(i),quotation_shelf_id:k.quotation_shelf_id},...e?{product_bundle:e}:{}}}}(void 0!==r||JSON.stringify(null==(u=n.metadata)?void 0:u.holder_config)!==JSON.stringify(T)||((null==(p=n.metadata)?void 0:p.venue_extra_holder_variant_id)??null)!==j)&&(v={...v||{product_id:n.product_id,product_variant_id:n.product_variant_id,unique_identification_number:e1k(n)},updates:{...null==v?void 0:v.updates,holder_config:T,metadata:{...(null==v?void 0:v.updates.metadata)||n.metadata,holder_config:T,venue_extra_holder_variant_id:j},...void 0!==r?{_extend:{holder_relations:M}}:{}}})}return{source:I,update:v,priceChanged:P}},x=async function(e,a,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"local",c=arguments.length>4?arguments[4]:void 0,p=++i;n.clear();try{let h=(null==r?void 0:r.options)??t(),v=(null==r?void 0:r.context)??e1j(h);if(e1C(a),m(v),h.catalog.loading||h.catalog.error||!h.catalog.products.some(t=>Number(t.id)===Number(e.id)))throw new e1x("CATALOG_NOT_READY","Wait for the current extras menu to load, then choose this item again.");let f=h.catalog.products,b=h.os.getTempOrder(),x=u(b),k=c?d(c):void 0,_=await y(Number(e.id),v,h,o),w=await h.resolveSelectionPolicy(_);if(g(v,h),h.os.getTempOrder()!==b||u(b)!==x)throw new e1x("STALE_CART","The order changed. Please choose this extra again.");if(p!==i)throw new e1x("STALE_SELECTION","A newer extra selection is already open.");if(t().catalog.products!==f)throw new e1x("STALE_CATALOG","The extras menu changed. Please choose this item again.");let S=`party-extra-${Date.now()}-${++l}`,j=iD({productDetail:_,requestedProductId:_.id,completeness:"complete",missingGroupPolicy:h.detailMissingGroupPolicy??"reject",mode:"product-configuration",openId:S,scopeKey:v.scopeKey,detailRevision:S,selectionKey:_.id});if("invalid"===j.status)throw new e1x("INCOMPLETE_DETAIL",j.issues.map(e=>e.message).join(" "));let N="ready"===j.status,C=c?e1T(c):{product_id:_.id,product_variant_id:0,option:[],bundle:[]},M=Ho(e1y(_,C.product_variant_id,c)).enabled,T={id:S,contextKey:e1w(v),productId:_.id,quantity:a,productDetail:_,hasSku:N,...c?{lineUid:e1k(c),editingLine:c,holderRelations:s(c)}:{}};!r||N||M||(r.prepared={detail:_,policy:w}),n.clear(),n.set(S,{session:T,catalog:f,catalogSession:h.catalogSession,os:h.os,order:b,orderIdentity:x,lineSnapshot:k,consumed:!1});let I={skuValue:C,variantDraft:null};if("ready"===j.status)return{status:"ready",session:T,configuration:I,plan:j.plan};if(!M&&!c)return{status:"direct",session:T,configuration:I};return{status:"ready",session:T,configuration:I,plan:{openId:S,scopeKey:v.scopeKey,detailRevision:S,selectionKey:S,productDetail:_,mode:"product-configuration",hasConfiguration:!0}}}catch(t){return{status:"invalid",issues:[e1N(t,void 0,Number(e.id))]}}},k=async(e,l)=>{let i=o().find(t=>e1k(t)===e),a=i&&t().catalog.products.find(e=>Number(e.id)===Number(i.product_id));return i&&a?x(a,l??Number(i.num),void 0,"prepare-configuration",i):{status:"invalid",issues:[e1N(new e1x("LINE_NOT_FOUND","This extra is no longer available. Review your order."),i)]}},_=async function(e,l,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.quantity,r=arguments.length>4?arguments[4]:void 0;return v(async()=>{var s,c,p;let m=(null==i?void 0:i.options)??t(),g=(null==i?void 0:i.context)??e1j(m),v=n.get(e.id);if(!v||v.session!==e||v.consumed||v.os!==m.os||v.catalogSession!==m.catalogSession||e.contextKey!==e1w(g)||v.catalog!==m.catalog.products||v.order!==m.os.getTempOrder()||v.orderIdentity!==u(m.os.getTempOrder()))throw new e1x("STALE_SESSION","The extra selection has expired. Please choose it again.");let x=e1C(a),k=(null==i?void 0:i.guard)??h(g,m);k.beforeApply(),await (null==(s=m.beforeMutate)?void 0:s.call(m)),k.beforeApply();let _=(null==i||null==(c=i.prepared)?void 0:c.detail)??await y(e.productId,g,m),w=e.lineUid?o().find(t=>e1k(t)===e.lineUid):void 0;if(e.lineUid&&(!w||d(w)!==v.lineSnapshot))throw new e1x("STALE_CART","This extra has changed. Please open it again.");let S=w?e1T(w):l.skuValue,j=await b(_,S,x,g,m,w,r,null==i?void 0:i.prepared);if(k.beforeApply(),v.catalog!==t().catalog.products)throw new e1x("STALE_CATALOG","The extras menu changed. Please choose this item again.");let N=w?{allowed:!0,noteDraft:void 0}:await m.cart.prepareAllergyBeforeCommit({product:j.source,flowId:e.id,perFlow:!0});if(k.beforeApply(),!N.allowed)return{status:"cancelled"};if(await (null==(p=m.beforeMutate)?void 0:p.call(m)),k.beforeApply(),v.catalog!==t().catalog.products)throw new e1x("STALE_CATALOG","The extras menu changed. Please choose this item again.");if(v.consumed=!0,w)return j.update&&await m.os.updateOrderProducts([j.update],k),await f(),{status:"updated"};let C=await m.os.addRetailProduct({product:j.source,quantity:x,salesNotes:N.noteDraft?[N.noteDraft]:void 0,availabilityCommitGuard:k.beforeApply});return await f(),{status:"added",products:C}})},w=async function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t(),i=e1S(l),a=l.os.getTempOrder(),n=u(a),r=null==a?void 0:a.customer_id,s=new Set(e),d=o(i).filter(e=>s.has(e1k(e)));if(!a||Number(a.order_id||0)>0||!s.size||s.size!==e.length||e.some(e=>!e)||d.length!==s.size||new Set(d.map(e1k)).size!==s.size||a.products.filter(e=>s.has(e1k(e))).length!==s.size||d.some(e=>{var t;return(null==(t=e.metadata)?void 0:t.venue_booking_scope_key)!==i.scopeKey}))throw new e1x("LINE_NOT_FOUND","These extras changed. Please review the cart.");let c=()=>t().os===l.os&&l.os.getTempOrder()===a&&u(a)===n&&a.customer_id===r&&e1w(e1S(t()))===e1w(i),p=JSON.stringify([a.products,a.bookings,a.notes]),m=()=>{if(!c()||p!==JSON.stringify([a.products,a.bookings,a.notes]))throw new e1x("STALE_CART","The extras changed. Please review the cart.")};if(!l.os.removeProductsFromOrder)throw new e1x("CART_SERVICE_REQUIRED","The booking cart service needs to be updated.");m();try{let e=await l.os.removeProductsFromOrder(d.map(e=>({product_id:e.product_id,product_variant_id:e.product_variant_id,unique_identification_number:e1k(e)})),{beforeApply:m,isCurrentOrder:c});if(!c())throw new e1x("STALE_CART","The order changed while removing extras.");return await f(),{status:"updated",products:e}}catch(e){throw c()&&await f(),e}},S=async(e,l,i)=>v(async()=>{var a,n,r;let s=(null==i?void 0:i.options)??t();if(!Number.isSafeInteger(l)||l<0)throw new e1x("INVALID_QUANTITY","Choose a valid quantity.");let d=o().find(t=>e1k(t)===e);if(!d||!e)throw new e1x("LINE_NOT_FOUND","This extra has changed. Please refresh the cart.");if(l===Number(d.num))return{status:"unchanged"};if(0===l)return w([e],s);let c=(null==i?void 0:i.context)??e1j(s),u=(null==i?void 0:i.guard)??h(c,s);u.beforeApply(),await (null==(a=s.beforeMutate)?void 0:a.call(s)),u.beforeApply();let p=(null==i||null==(n=i.prepared)?void 0:n.detail)??await y(Number(d.product_id),c,s);if(Ho(e1y(p,d.product_variant_id,d)).enabled)return k(e,l);let m=await b(p,e1T(d),l,c,s,d,void 0,null==i?void 0:i.prepared);u.beforeApply(),await (null==(r=s.beforeMutate)?void 0:r.call(s)),u.beforeApply();let g=await s.os.updateOrderProducts([m.update],u);return await f(),{status:"updated",products:g}}),j=(e,t)=>S(e,t),N=async e=>{let l=t(),i=e1j(l,e),a=l.os.getTempOrder(),n=u(a),r=o(e1S(l)),s=c(e1S(l)),d={context:i,contextKey:e1w(i),sourceRows:r,orderSignature:s,validRows:[],updates:[],invalidItems:[],priceChanged:!1};if(!r.length)return d;let p=new Map;for(let e of r)try{if(!e1k(e))throw new e1x("MISSING_LINE_UID","This extra has no line identity. Remove it and add it again.");let t=Number(e.product_id);p.has(t)||p.set(t,y(t,i,l));let a=await p.get(t),n=await b(a,e1T(e),Number(e.num),i,l,e);d.validRows.push(n.source),d.priceChanged||(d.priceChanged=n.priceChanged),n.update&&d.updates.push(n.update)}catch(t){d.invalidItems.push(e1N(t,e))}if(l.os!==t().os||l.catalogSession!==t().catalogSession||l.os.getTempOrder()!==a||u(a)!==n||s!==c(e1S(l))||e1w(e1S(l))!==e1w(e1S(t())))throw new e1x("STALE_CART","The Party or extras changed while checking availability. Please retry.");return d},C=async()=>v(async()=>{var e,l;let i=t(),a=h(e1S(i),i);a.beforeApply(),await (null==(e=i.beforeMutate)?void 0:e.call(i)),a.beforeApply();let n=await N();if(g(n.context,i),n.orderSignature!==c(n.context))throw new e1x("STALE_CART","The extras changed while checking availability. Please retry.");return a.beforeApply(),n.updates.length&&(await (null==(l=i.beforeMutate)?void 0:l.call(i)),a.beforeApply(),await i.os.updateOrderProducts(n.updates,a),await f()),n}),I.current={prepare:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return x(e,t,void 0,"prepare-configuration")},prepareEdit:k,commit:function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.quantity,i=arguments.length>3?arguments[3]:void 0;return _(e,t,void 0,l,i)},setProductQuantity:async(e,l)=>{let i;if(!Number.isSafeInteger(l)||l<0)throw new e1x("INVALID_QUANTITY","Choose a valid quantity.");let a=o().filter(t=>Number(t.product_id)===Number(e.id)),n=a.reduce((e,t)=>e+Number(t.num||0),0);if(n===l)return{status:"unchanged"};if(l<n){var r,s,d;if(1===a.length)return j(e1k(a[0]),l);if(!lZ(e.is_variant)&&!lZ(e.is_bundle)&&!lZ(e.open_sold_weight)&&!lZ(e.isOpenDetailModal)&&!["session_product","session_ticket"].includes(String(e.extension_type||""))&&!Number(e.option_group_count||0)&&!Number(e.bundle_group_count||0)&&!(null==(r=e.variant_group)?void 0:r.length)&&!(null==(s=e.option_group)?void 0:s.length)&&!(null==(d=e.bundle_group)?void 0:d.length)&&a.every(e=>{var t;return!Number(e.product_variant_id)&&!((null==(t=e.product_sku)?void 0:t.option)||[]).length&&!(e.product_bundle||[]).length})){let e=a[a.length-1];return j(e1k(e),Math.max(0,Number(e.num)-(n-l)))}return{status:"choose-line",rows:a,targetQuantity:l}}try{let e,l,a,n;e=t(),l=e1j(e),a=e.catalog.products,n=h(l,e),i={options:e,context:l,guard:{...n,beforeApply:()=>{if(n.beforeApply(),t().catalog.products!==a)throw new e1x("STALE_CATALOG","The extras menu changed. Please choose this item again.")}}}}catch(t){return{status:"invalid",issues:[e1N(t,void 0,Number(e.id))]}}let c=await x(e,l-n,i);if("direct"!==c.status)return c;if(o().filter(t=>Number(t.product_id)===Number(e.id)).reduce((e,t)=>e+Number(t.num||0),0)!==n)throw new e1x("STALE_CART","The extra quantity changed. Please retry.");return 1===a.length?S(e1k(a[0]),l,i):_(c.session,c.configuration,i)},setLineQuantity:j,removeLines:e=>v(()=>w(e)),prepareRevalidation:N,revalidate:C});let[P,A]=(0,eC.useState)(0),[D,E]=(0,eC.useState)([]),[O,z]=(0,eC.useState)(()=>e1w(e));(0,eC.useEffect)(()=>(T.current=!0,()=>{T.current=!1}),[]);let L=(0,eC.useMemo)(()=>{var t;return e1_((null==(t=e.cart.tempOrder)?void 0:t.products)??[],e)},[e.cart.tempOrder,e.parentLineUid,e.mode,e.scopeKey]),R=e1w(e);(0,eC.useEffect)(()=>{L.length||z(R)},[R,L.length]);let $=(0,eC.useMemo)(()=>{let t=new Set(L.map(e1k)),l=D.filter(e=>e.lineUid&&t.has(e.lineUid));for(let t of L){var i;let a=e1k(t);R===O&&(null==(i=t.metadata)?void 0:i.venue_booking_scope_key)===e.scopeKey||l.some(e=>e.lineUid===a)||l.push({code:"REVALIDATION_REQUIRED",message:"The booking context changed. Check this extra again before checkout.",lineUid:a,productId:Number(t.product_id),line:t})}return l},[L,D,R,O,e.scopeKey]),F=(0,eC.useMemo)(()=>{let e={};for(let t of L){let l=Number(t.num);if(Number.isFinite(l)&&l>0){let i=String(t.product_id);e[i]=(e[i]??0)+l}}return e},[L]);return{...(0,eC.useMemo)(()=>{let e=I.current,t=async e=>{T.current&&A(e=>e+1);try{return await e()}finally{T.current&&A(e=>Math.max(0,e-1))}};return{prepare:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepare(...i))},prepareEdit:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepareEdit(...i))},commit:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.commit(...i);return T.current&&i[0].lineUid&&"updated"===t.status&&E(e=>e.filter(e=>e.lineUid!==i[0].lineUid)),t})},setProductQuantity:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.setProductQuantity(...i))},setLineQuantity:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.setLineQuantity(...i);return T.current&&E(e=>e.filter(e=>e.lineUid!==i[0])),t})},removeLines:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.removeLines(...i);return T.current&&E(e=>e.filter(e=>!e.lineUid||!i[0].includes(e.lineUid))),t})},prepareRevalidation:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepareRevalidation(...i))},revalidate:()=>t(async()=>{let t=await e.revalidate();return T.current&&e1w(M.current)===t.contextKey&&(E(t.invalidItems),z(t.contextKey)),t})}},[]),rows:L,quantityByProductId:F,invalidItems:$,busy:P>0}},e1E=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")},e1O=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.booking_uid??"")},e1z=e=>"string"==typeof e&&""!==e.trim()||"number"==typeof e&&Number.isFinite(e),e1L=(e,t)=>{let l=String(e??"").slice(0,10),i=String(t??"");return/^\d{4}-\d{2}-\d{2}$/.test(l)&&/^\d{2}:\d{2}(:\d{2})?$/.test(i)?`${l} ${5===i.length?`${i}:00`:i}`:""},e1R=e=>{let t=String(e??"").replace("T"," ");return 16===t.length?`${t}:00`:t},e1$=e=>e1R(e).slice(0,16);function e1F(e,t){let l={bindings:[],extras:[],gifts:[],issues:[]},i=(e,t,i,a)=>l.issues.push({code:e,message:t,productLineUid:i,bookingUid:a});if(!e)return i("ORDER_REQUIRED","The booking draft is unavailable."),l;Number(e.order_id||0)>0&&i("NEW_DRAFT_REQUIRED","This entry supports new booking drafts only.");let a=Array.isArray(e.products)?e.products:[],n=Array.isArray(e.bookings)?e.bookings:[],r=new Set,o=new Set;for(let e of a){var s,d,c,u,p,m,g,h;let v=e1E(e),f=null==(s=e.metadata)?void 0:s.venue_booking_role;if(null==(d=e.metadata)?void 0:d._giftInfo){l.gifts.push(e);let t=String(e.booking_uid??(null==(u=e.metadata)?void 0:u.booking_uid)??"");n.filter(e=>t&&e1O(e)===t||String(e.product_uid??"")===v).forEach(e=>o.add(e1O(e)));continue}if("party_extra"===f||"tickets_extra"===f){f!==("tickets"===t.mode?"tickets_extra":"party_extra")&&i("UNEXPECTED_ORDER_LINE","The draft contains an extra from another booking entry.",v),(!v||r.has(v))&&i("INVALID_LINE_IDENTITY","The extra line identity is missing or duplicated.",v),r.add(v),Number(e.order_detail_id||0)>0&&i("NEW_DRAFT_REQUIRED","An existing extra cannot be edited here.",v),(!Number.isSafeInteger(Number(e.num))||0>=Number(e.num))&&i("EXTRA_QUANTITY_INVALID","Update this extra to a valid quantity.",v),(null==(p=e.metadata)?void 0:p.venue_booking_scope_key)&&(!t.scopeKey||e.metadata.venue_booking_scope_key===t.scopeKey)||i("EXTRA_SCOPE_INVALID","This extra belongs to another booking entry.",v);let o=String((null==(m=e.metadata)?void 0:m.venue_booking_parent_uid)||"");"tickets_extra"===f&&o&&i("EXTRA_PARENT_INVALID","Ticket extras belong to the order, not a booking line.",v),"party_extra"!==f||a.some(t=>{var l,i;return e1E(t)===o&&(null==(l=t.metadata)?void 0:l.venue_booking_role)==="party_main"&&t.metadata.venue_booking_scope_key===(null==(i=e.metadata)?void 0:i.venue_booking_scope_key)})||i("EXTRA_PARENT_INVALID","The Party product for this extra is missing.",v),(null==(g=e.metadata)?void 0:g.venue_booking_service_datetime)||i("EXTRA_PRICE_CONTEXT_MISSING","Recheck this extra before checkout.",v),(e.booking_uid||(null==(h=e.metadata)?void 0:h.booking_uid)||n.some(e=>String(e.product_uid||"")===v))&&i("EXTRA_BOOKING_INVALID","An extra must not create a booking.",v),l.extras.push(e);continue}if(f!==("tickets"===t.mode?"tickets":"party_main")){i("UNEXPECTED_ORDER_LINE","The draft contains a product from another booking entry.",v);continue}if(!v||r.has(v)){i("INVALID_LINE_IDENTITY","The product line identity is missing or duplicated.",v);continue}r.add(v),Number(e.order_detail_id||0)>0&&i("NEW_DRAFT_REQUIRED","An existing order line cannot be edited here.",v);let y=String(e.booking_uid??(null==(c=e.metadata)?void 0:c.booking_uid)??""),b=n.filter(e=>y&&e1O(e)===y||String(e.product_uid??"")===v);if(1!==b.length){i("BOOKING_LINK_INVALID","A booking product must have exactly one linked booking.",v);continue}let x=b[0],k=e1O(x);if(!k||o.has(k)||y&&y!==k||x.product_uid&&String(x.product_uid)!==v){i("BOOKING_LINK_INVALID","The booking and product line identities no longer match.",v,k);continue}o.add(k);let _=e1L(x.start_date,x.start_time),w=e1L(x.end_date,x.end_time),S=x.metadata||{},j=String(S.availability_business_date||t.date||_.slice(0,10)),N=Number(e.num);_&&w&&!(w<=_)||i("BOOKING_TIME_INVALID","The saved booking interval is incomplete.",v,k),Number.isSafeInteger(N)&&1===N||i("BOOKING_LINE_COUNT_INVALID","Each saved booking must map to one product line.",v,k),S.availability_candidate_key&&S.availability_source&&S.availability_slice_start_at&&S.availability_slice_end_at&&Array.isArray(S.availability_schedule_refs)||i("BOOKING_INTENT_MISSING","The saved booking is missing its original availability intent. Please reselect it.",v,k);let C=[];for(let e of Array.isArray(x.resources)?x.resources:[]){let t=e.relation_id??e.resource_id??e.id;if(!e1z(t)||0===Number(t)||!e1z(e.form_id)){i("BOOKING_RESOURCE_INVALID","The saved resource identity is incomplete.",v,k);continue}C.push({formId:e.form_id,resourceId:t,capacity:Number(e.capacity)})}l.bindings.push({productLineUid:v,bookingUid:k,identity:e_f(e),line:e,booking:x,quantity:N,date:j,intent:{date:j,startAt:_,endAt:w,sliceStartAt:String(S.availability_slice_start_at??""),sliceEndAt:String(S.availability_slice_end_at??""),candidateKey:String(S.availability_candidate_key??""),source:String(S.availability_source??""),scheduleRefs:S.availability_schedule_refs||[],timezone:S.availability_timezone,primaryScheduleRef:S.availability_primary_schedule_ref,resources:C}})}l.bindings.length||i("BOOKING_REQUIRED","Add a booking before continuing."),"party"===t.mode&&1!==l.bindings.length&&i("PARTY_SINGLE_MAIN_REQUIRED","A party order requires one main product, room and time.");let v=new Set(l.bindings.map(e=>e.date));for(let e of((v.size>1||t.date&&[...v].some(e=>e!==t.date))&&i("SINGLE_DATE_REQUIRED","All bookings must retain the selected booking date."),n))o.has(e1O(e))||i("ORPHAN_BOOKING","The draft contains an unlinked booking.",void 0,e1O(e));return l}let e1q=e=>{var t;return(0,no.cloneDeep)(e&&{orderId:e.order_id,externalSaleNumber:e.external_sale_number,localId:null==(t=e._extend)?void 0:t.localId,customerId:e.customer_id,products:e.products,bookings:e.bookings,holder:e.holder,holderRelations:e.holder_relations,notes:e.notes,orderDiscounts:e.discount_list,shopDiscount:e.shop_discount,payments:e.payments})};async function e1B(e){var t,l,i;let a=e.os.getTempOrder(),n=e1q(a),r=e1F(a,e),o={bindings:[],extras:r.extras,gifts:r.gifts,issues:[...r.issues]},s=void 0===e.customerId?null==a?void 0:a.customer_id:e.customerId;if(String(s??"")!==String((null==a?void 0:a.customer_id)??"")&&o.issues.push({code:"CUSTOMER_CHANGED",message:"The customer changed. Please review the booking again."}),r.issues.length)return o;let d=()=>{var t;let l;return(null==(t=e.isCurrent)?void 0:t.call(e))!==!1&&(l=e.os,(0,no.isEqual)(e1q(l.getTempOrder()),n))};if(!(null==(t=e.catalog)?void 0:t.menuListIds.length)||!(null==(l=e.queries)?void 0:l.queryCatalogProductDetail)||!e.os.buildCacheItemFromOrderLine)return o.issues.push({code:"BOOKING_SERVICE_UNAVAILABLE",message:"The configured booking menu or detail service is unavailable."}),o;for(let t of r.bindings){let l,a;try{if(!d())throw Error("ORDER_CHANGED");let n={menu_list_ids:[...e.catalog.menuListIds],schedule_date:t.date,schedule_datetime:t.intent.startAt,...null!=s?{customer_id:Number(s)}:{}},r=await e.queries.queryCatalogProductDetail({...n,product_id:Number(t.line.product_id)});if(!d())throw Error("ORDER_CHANGED");if(!r||String(r.id)!==String(t.line.product_id))throw Error("PRODUCT_DETAIL_UNAVAILABLE");let c=iA({productDetail:r,requestedProductId:Number(t.line.product_id),completeness:"complete"});if("invalid"===c.status)throw Error("PRODUCT_DETAIL_INCOMPLETE");let u=e.os.buildCacheItemFromOrderLine({product:t.line,booking:t.booking,sourceProduct:r}),p=ews({...u,product_resource:r.product_resource,duration:r.duration,capacity:r.capacity,_data:{...u._data,capacitys:null==(i=r._data)?void 0:i.capacitys}}),m=$W(p._extend);if(!m||String(m.product_id)!==String(t.line.product_id)||String(m.product_variant_id)!==String(t.line.product_variant_id))throw Error("ORDER_SKU_INVALID");let g=new Map;for(let e of t.intent.resources){let t=String(e.formId),l=g.get(t)||{formId:e.formId,resourceIds:[]};l.resourceIds.push(e.resourceId),g.set(t,l)}if(a={...t,product:p,skuValue:m,selection:{requirementSelections:[...g.values()]}},l=await e0Q({os:e.os,mode:"tickets"===e.mode?"ticket":"party",date:t.date,product:p,quantity:t.quantity,editingProductLineUid:t.productLineUid}),!d())throw Error("ORDER_CHANGED");let h=l.times.filter(e=>{var l;return l=t.intent,e.key===l.candidateKey&&e.source===l.source&&e1R(e.startAt)===e1R(l.sliceStartAt)&&e1R(e.endAt)===e1R(l.sliceEndAt)&&e1$(e.bookingStartAt||e.startAt)===e1$(l.startAt)&&e1$(e.bookingEndAt||e.endAt)===e1$(l.endAt)&&(0,no.isEqual)(e.scheduleRefs,l.scheduleRefs)&&(!l.timezone||e.timezone===l.timezone)&&(!l.primaryScheduleRef||(0,no.isEqual)(e.primaryScheduleRef,l.primaryScheduleRef))});if(1!==h.length)throw Error("SELECTED_TIME_UNAVAILABLE");let v=await e0Z(e.os,l,h[0]);if(!d())throw Error("ORDER_CHANGED");let f=[];for(let e of t.intent.resources){let t=v.groups.filter(t=>String(t.formId)===String(e.formId)&&t.options.some(t=>String(t.resourceId)===String(e.resourceId)));if(1!==t.length)throw Error("SAVED_RESOURCE_GROUP_AMBIGUOUS");if(e.capacity!==l.partySize)throw Error("BOOKING_CAPACITY_CHANGED");let i=t[0],a=f.find(e=>e.requirementGroupId===i.groupId);a||(a={requirementGroupId:i.groupId,formId:i.formId,resourceIds:[]},f.push(a)),a.resourceIds.push(e.resourceId)}o.bindings.push({...t,product:p,skuValue:m,selection:{candidate:v.candidate,requirementSelections:f}})}catch(i){let l=i instanceof Error?i.message:"BOOKING_VALIDATION_FAILED";!e.requireAvailable&&a&&d()&&o.bindings.push(a),o.issues.push({code:l,message:"ORDER_CHANGED"===l?"The booking draft changed. Please review it again.":"This saved booking is no longer available. Please reselect it.",productLineUid:t.productLineUid,bookingUid:t.bookingUid})}finally{e0K(e.os,l)}if(!d())break}return o}function e1H(e,t){var l,i,a,n,r,o,s,d;let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en",u=e.sales.bookingTicket,p=null==u||null==(l=u.getCart)?void 0:l.call(u),m=new Set(e_J(u).map(e=>{var t;return String((null==(t=e.orderLine.metadata)?void 0:t.unique_identification_number)||"")})),g=new Set;for(let e of(null==p?void 0:p.bookings)||[]){let t=e.product_uid??(null==(n=e._extend)||null==(a=n.product)||null==(i=a.metadata)?void 0:i.unique_identification_number);t&&g.add(String(t))}for(let e of(null==p?void 0:p.items)||[])!["tickets_extra","party_extra"].includes(null==(r=e.metadata)?void 0:r.venue_booking_role)&&(null==(o=e.metadata)?void 0:o.unique_identification_number)&&g.add(String(e.metadata.unique_identification_number));let h=[],v=[];if(u)for(let e of g){let t=e_X(u,e);if(!t)continue;let l=Ho(t.cacheItem),i=Number((null==(s=t.cacheItem._extend)?void 0:s.quantity)||1),a=Number.isSafeInteger(i)&&i>0?i:1,n={...t,uid:e,config:l,quantity:a,title:eXp(t.orderLine.product_title||t.cacheItem.title||t.cacheItem.name||t.cacheItem.product_name,c),ids:UR(null==(d=t.cacheItem._extend)?void 0:d.holder_id),missing:m.has(e)};(t.booking||l.enabled)&&v.push(n),l.enabled&&h.push(n)}let f=h.reduce((e,t)=>e+t.quantity,0),y=h.reduce((e,t)=>e+Math.min(t.quantity,t.ids.length),0),b=h.reduce((e,t)=>e+(t.config.required?t.quantity:0),0),x=h.reduce((e,t)=>e+(t.config.required?Math.min(t.quantity,t.ids.length):0),0),k=JSON.parse(e1V(e,t||"")),_=void 0!==t&&e1W(u,e1V(e,t))||!!u&&[...e1U.get(u)||[]].some(e=>{let l=JSON.parse(e);return(void 0===t||l[0]===t)&&l[1]===k[1]&&l[2]===k[2]});return{enabled:h.length>0,required:b>0,complete:!_&&x===b,total:f,completed:y,requiredCount:b,requiredCompleted:x,pending:!1,blocked:_,lines:h,displayLines:v}}function e1V(e,t){var l,i,a;let n=(null==(i=e.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))??e.sales.tempOrder;return JSON.stringify([t,(null==n||null==(a=n._extend)?void 0:a.localId)||(null==n?void 0:n.external_sale_number)||(null==n?void 0:n.order_id),null==n?void 0:n.customer_id])}let e1U=new WeakMap,e1Y=e=>`pisell:venue-booking:holder-unconfirmed:${e}`;function e1W(e,t){var l;if(!e)return!1;if(null==(l=e1U.get(e))?void 0:l.has(t))return!0;try{return"1"===sessionStorage.getItem(e1Y(t))}catch{return!1}}let e1K=new WeakMap;function e1G(e,t){var l;return!!e&&!!(null==(l=e1K.get(e))?void 0:l.has(t))}let e1Q=(0,eC.memo)(function(e){var t,l,i,a,n,r,o;let{balanceAmount:s="$15.1",customerEmail:d="customer@email.com",customerName:c="",onClose:u,sendPaymentLink:p,customerId:m}=e,g=env(),h=e$();s2(W9,(null==(n=h.appHelper.utils)||null==(a=n.getApp)||null==(i=a.call(n))||null==(l=i.locales)||null==(t=l.getLocale)?void 0:t.call(l))||(null==(o=h.appHelper.utils)||null==(r=o.storage)?void 0:r.get("umi_locale"))||"en");let v=qR(),f=(e,t)=>eL.getText(e)||t,[y,b]=(0,eC.useState)(d||"");(0,eC.useEffect)(()=>{b(d||"")},[d]);let x=(0,eH.jsx)("div",{className:aT()("send-payment-link-modal"),children:(0,eH.jsx)("div",{className:aT()("modal-content"),children:(0,eH.jsxs)("div",{className:aT()("main-content"),children:[(0,eH.jsx)("div",{className:aT()("illustration-container"),children:(0,eH.jsx)("img",{src:g+"/send_payment_link.png",className:aT()("illustration")})}),(0,eH.jsxs)("div",{className:aT()("form-container"),children:[(0,eH.jsx)("div",{className:aT()("email-options-container"),children:(0,eH.jsxs)("div",{className:aT()("email-section"),children:[(0,eH.jsxs)("div",{className:aT()("section-label"),children:[(e=>{if(oi(m))return"";let t=f("pisell2.checkout.send-payment-link.customer-name-format");return"function"==typeof t?t(e):`${e}'s `})(c),f("pisell2.checkout.send-payment-link.email-address","Email Address")]}),(0,eH.jsx)("div",{className:aT()("email-option"),children:(0,eH.jsx)("div",{className:aT()("email-input-container"),children:(0,eH.jsx)("div",{className:`${aT()("email-input")} ${aT()("email-input-selected")}`,children:(0,eH.jsx)("input",{type:"email",value:y,onChange:e=>b(e.target.value),placeholder:f("pisell2.checkout.send-payment-link.email-placeholder","Enter email address"),className:aT()("email-text-input")})})})})]})}),(0,eH.jsx)("div",{className:aT()("footer"),children:(0,eH.jsx)("button",{className:aT()("send-button"),onClick:()=>{var e;y&&""!==y.trim()?(e=y.trim(),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))?(p({emails:[y.trim()],amount:s}),null==u||u()):v.fail(f("pisell2.checkout.send-payment-link.email-invalid")):v.fail(f("pisell2.checkout.send-payment-link.email-required"))},children:f("pisell2.checkout.send-payment-link.send-button","Send Link")})})]})]})})});return(0,eH.jsx)(eT.Modal,{title:f("pisell2.checkout.send-payment-link.modal-title","Send Payment Link"),width:680,footer:null,centered:!0,wrapClassName:"send-payment-link-modal-wrapper",open:!0,onCancel:u,children:x})}),e1Z=e=>(0,eH.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"currentColor",viewBox:"0 0 24 24",...e,children:(0,eH.jsx)("path",{fillRule:"evenodd",d:"M11.293 8.293a1 1 0 0 1 1.414 0l6 6a1 1 0 0 1-1.414 1.414L12 10.414l-5.293 5.293a1 1 0 0 1-1.414-1.414z",clipRule:"evenodd"})}),e1J=e=>(0,eH.jsx)(na,ak(ak({},e),{},{viewBox:(null==e?void 0:e.viewBox)||"0 0 24 24",component:e1Z})),e1X=function(e){var t;let l,i,{amountSymbol:a,orderInfo:n,cartData:r,onClose:o,summaryData:s=[],labelMaps:d,paymentItems:c=[],customAmount:u,voidPayment:p,walletPassData:m,clientInfo:g}=e,[h,v]=(0,eC.useState)(!0),[f,y]=(0,eC.useState)(!0),[b,x]=(0,eC.useState)(!0),k=e$(),_=(e,t)=>{var l,i,a,n,r,o,s,d;let c=null==(d=W9[(null==(r=k.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=k.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:d[e];return c||eL.getText(e)||t},w=()=>{var e;let t=g||{},l=e=>null!=e&&""!==String(e).trim()?String(e).trim():null,i=l(null==t?void 0:t.display_name)||l(null==t?void 0:t.name)||_("pisell2.checkout.customer.default-name")||"Customer";return{nickname:(null==t?void 0:t.nickname)&&(null==t?void 0:t.nickname)!=="Select a customer"?null==t?void 0:t.nickname:eL.getText("pisell2.checkout.customer.default-name"),display_name:i,email:(null==t?void 0:t.email)||(null==t||null==(e=t.contacts)?void 0:e.email)||""}},S=e=>{let{expanded:t,color:l="black"}=e;return(0,eH.jsx)("div",{className:aT()("collapse-icon",{expanded:t}),children:(0,eH.jsx)(e1J,{style:{color:l,fontSize:"24px"}})})},j=e=>{let t=e.order_payment_id;return("cash"===e.code||"custom"===e.type)&&eP_(e)&&(null==t||""===t)},N=e=>eP_(e),C=()=>c.filter(N).reduce((e,t)=>{let l=new lz(Math.abs(t.amount)),i=new lz(Number(t.rounding_amount)>0?0:t.rounding_amount||0);return new lz(e).plus(l).plus(i).toNumber()},0),M=e=>{p&&p(e)},T=e=>e.label||d&&d[e.key]||e.key;return(0,eH.jsxs)("div",{className:aT()("payment-detail-modal"),children:[(0,eH.jsxs)("div",{className:aT()("main-content"),children:[(0,eH.jsxs)("div",{className:aT()("section-container"),children:[(0,eH.jsxs)("div",{className:aT()("section-header"),onClick:()=>v(!h),children:[(0,eH.jsx)("div",{className:aT()("section-title-container"),children:(0,eH.jsx)("div",{className:aT()("section-title"),children:_("order.total")||"Order Total"})}),(0,eH.jsxs)("div",{className:aT()("section-right"),children:[(0,eH.jsx)("div",{className:aT()("section-amount"),children:lQ((l=s.find(e=>"sub_total"===e.key))?l.value:0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})}),(0,eH.jsx)(S,{expanded:h})]})]}),h&&(0,eH.jsx)("div",{className:aT()("section-content"),children:(()=>{if(!s||0===s.length)return(0,eH.jsx)("div",{className:aT()("order-details-grid"),children:(0,eH.jsx)("div",{className:aT()("order-details-column"),children:(0,eH.jsxs)("div",{className:aT()("order-row"),children:[(0,eH.jsx)("div",{className:aT()("order-row-text"),children:_("no.items.found")||"No items found"}),(0,eH.jsx)("div",{className:aT()("order-row-amount"),children:lQ(0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})})});let e=s.slice(0,Math.ceil(s.length/2)),t=s.slice(Math.ceil(s.length/2));return(0,eH.jsxs)("div",{className:aT()("order-details-grid"),children:[(0,eH.jsx)("div",{className:aT()("order-details-column"),children:e.map(e=>{let t="";return(null==e?void 0:e.key)!=="discount"&&(t=e.value>=0?"+":""),(0,eH.jsxs)("div",{className:aT()("order-row"),children:[(0,eH.jsx)("div",{className:aT()("order-row-label"),children:T(e)}),(0,eH.jsxs)("div",{className:aT()("order-row-amount"),children:[t,lQ(e.value,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},e.key)})}),t.length>0&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("div",{className:aT()("divider-vertical")}),(0,eH.jsx)("div",{className:aT()("order-details-column"),children:t.map(e=>{let t="";return(null==e?void 0:e.key)!=="discount"&&(t=e.value>=0?"+":""),(0,eH.jsxs)("div",{className:aT()("order-row"),children:[(0,eH.jsx)("div",{className:aT()("order-row-label"),children:T(e)}),(0,eH.jsxs)("div",{className:aT()("order-row-amount"),children:[t,lQ(e.value,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},e.key)})})]})]})})()})]}),(0,eH.jsx)("div",{className:aT()("divider-horizontal")}),(0,eH.jsxs)("div",{className:aT()("section-container"),children:[(0,eH.jsxs)("div",{className:aT()("section-header"),onClick:()=>y(!f),role:"button",tabIndex:0,children:[(0,eH.jsx)("div",{className:aT()("section-title-container"),children:(0,eH.jsx)("div",{className:aT()("section-title"),children:_("order.paid")||"Order Paid"})}),(0,eH.jsxs)("div",{className:aT()("section-right"),children:[(0,eH.jsxs)("div",{className:aT()("section-amount"),children:["-",lQ(C(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),(0,eH.jsx)(S,{expanded:f})]})]}),f&&(()=>{let e=c.filter(N),t=e.filter(e=>"deposit"===e.type),l=e.filter(e=>"deposit"!==e.type);if(0===e.length||0===l.length&&0===t.length)return(0,eH.jsx)("div",{className:aT()("section-content"),children:(0,eH.jsx)("div",{className:aT()("no-payment-text"),children:_("no.payments.recorded")||"No payments recorded"})});let i=t.reduce((e,t)=>new lz(e).plus(new lz(t.amount)).plus(new lz(Number(t.rounding_amount)>0?0:t.rounding_amount||0)).toNumber(),0),n=l.reduce((e,t)=>new lz(e).plus(new lz(t.amount)).plus(new lz(Number(t.rounding_amount)>0?0:t.rounding_amount||0)).toNumber(),0);return(0,eH.jsx)("div",{className:aT()("section-content"),children:(0,eH.jsxs)("div",{className:aT()("payment-record-container"),children:[t.length>0&&(0,eH.jsxs)("div",{className:aT()("payment-item-header"),children:[(0,eH.jsx)("div",{children:_("pisell2.subtotal.deposit")||"Deposit"}),(0,eH.jsx)("div",{children:lQ(i,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),t.map(e=>(0,eH.jsxs)("div",{className:aT()("payment-item"),children:[(0,eH.jsx)("div",{className:aT()("payment-item-bullet")}),(0,eH.jsxs)("div",{className:aT()("payment-item-content"),children:[(0,eH.jsxs)("div",{className:aT()("payment-item-text"),children:[e.name," - ",e.created_at||new Date().toLocaleDateString()," ",_("pisell2.checkout.payment-detail.by")||"by"," ",w().nickname]}),(0,eH.jsxs)("div",{className:aT()("payment-item-actions"),children:[(0,eH.jsxs)("div",{className:aT()("payment-item-amount"),children:["-",lQ(new lz(Math.abs(e.amount)).plus(new lz(Number(e.rounding_amount)>0?0:e.rounding_amount||0)).toNumber(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),j(e)&&(0,eH.jsx)("button",{className:aT()("void-button"),onClick:()=>M(e),type:"button",children:_("void")||"Void"})]})]})]},e.uuid)),l.length>0&&(0,eH.jsxs)("div",{className:aT()("payment-item-header"),children:[(0,eH.jsx)("div",{children:_("payment.text")||"Payment"}),(0,eH.jsx)("div",{children:lQ(n,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),l.map(e=>(0,eH.jsxs)("div",{className:aT()("payment-item"),children:[(0,eH.jsx)("div",{className:aT()("payment-item-bullet")}),(0,eH.jsxs)("div",{className:aT()("payment-item-content"),children:[(0,eH.jsxs)("div",{className:aT()("payment-item-text"),children:[e.name," - ",e.created_at||new Date().toLocaleDateString()," ",_("pisell2.checkout.payment-detail.by")||"by"," ",w().nickname]}),(0,eH.jsxs)("div",{className:aT()("payment-item-actions"),children:[(0,eH.jsxs)("div",{className:aT()("payment-item-amount"),children:["-",lQ(new lz(Math.abs(e.amount)).plus(new lz(Number(e.rounding_amount)>0?0:e.rounding_amount||0)).toNumber(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),j(e)&&(0,eH.jsx)("button",{className:aT()("void-button"),onClick:()=>M(e),type:"button",children:_("void")||"Void"})]})]})]},e.uuid))]})})})()]})]}),(0,eH.jsxs)("div",{className:aT()("balance-to-pay-section"),children:[(0,eH.jsxs)("div",{className:aT()("balance-to-pay-header"),onClick:()=>x(!b),role:"button",tabIndex:0,children:[(0,eH.jsx)("div",{className:aT()("section-title-container"),children:(0,eH.jsx)("div",{className:aT()("balance-to-pay-title"),children:_("balance.to.pay")||"Balance to Pay"})}),(0,eH.jsxs)("div",{className:aT()("balance-to-pay-right"),children:[(0,eH.jsx)("div",{className:aT()("balance-to-pay-amount"),children:lQ(new lz(n.totalAmount||0).sub(new lz(C())).toNumber().toFixed(2),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})}),(0,eH.jsx)(S,{expanded:b,color:"#7F56DA"})]})]}),b&&(0,eH.jsx)("div",{className:aT()("balance-to-pay-content"),children:(i=[],((null==m||null==(t=m.selectedWallet)?void 0:t.length)&&m.selectedWallet.forEach(e=>{i.push((0,eH.jsxs)("div",{className:aT()("balance-item-row"),children:[(0,eH.jsx)("div",{className:aT()("balance-item-text"),children:e.name||e.product_name||_("wallet.pass")||"Wallet Pass"}),(0,eH.jsxs)("div",{className:aT()("balance-item-amount"),children:["-",e.redeem||lQ(Math.abs(e.savedAmount||0),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},`wallet-${e.id}`))}),0===i.length)?(0,eH.jsx)("div",{className:aT()("balance-item-row","empty-state"),children:(0,eH.jsx)("div",{className:aT()("balance-item-text","empty-text"),children:_("pisell2.checkout.payment-detail.no-wallet-pass-items")||"No WalletPass payment items"})}):(0,eH.jsx)(eH.Fragment,{children:i}))}),(0,eH.jsx)("div",{className:aT()("balance-due-section"),children:(0,eH.jsxs)("div",{className:aT()("balance-due-header"),children:[(0,eH.jsx)("div",{className:aT()("balance-due-title"),children:_("balance.due")||"Balance Due"}),(0,eH.jsx)("div",{className:aT()("balance-due-amount"),children:lQ(u||0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})})]})]})},e10=(0,eC.forwardRef)((e,t)=>{let{children:l,value:i="",onChange:a,onConfirm:n,onCancel:r,showCurrencySymbol:o=!0,useThousandsSeparator:s=!1,selectType:d="dark",disabled:c=!1,overlayClassName:u="",style:p}=e,[m,g]=(0,eC.useState)(!1),[h,v]=(0,eC.useState)(""),[f,y]=(0,eC.useState)(!0);(0,eC.useImperativeHandle)(t,()=>({open:()=>{g(!0),v(i),y(!0)},close:()=>g(!1),isOpen:()=>m}));let b=(0,eH.jsx)("div",{className:"pisell-price-keyboard-popover-content",children:(0,eH.jsx)(nY.PisellPriceKeyboard,{value:h,onChange:e=>{if((""===e||0===e||"0"===e)&&!f){y(!0),v(e),null==a||a(e);return}if(f&&""!==e&&0!==e&&"0"!==e){y(!1);let t=String(h||"").replace(/[^\d.]/g,""),l=String(e).replace(/[^\d.]/g,"");if(t&&"0"!==t&&l.length>t.length&&l.startsWith(t)){let e=l.slice(t.length);if(e){v(e),null==a||a(e);return}}}v(e),null==a||a(e)},onEnter:e=>{null==n||n(e),g(!1)},doneText:eL.getText("pisell2.customise-item.save"),resetText:eL.getText("pisell2.booking.info.text.clear"),amountProps:{showCurrencySymbol:o,useThousandsSeparator:s},selectType:d,backgroundColor:"transparent"})});return(0,eH.jsx)(eT.Popover,{open:m,content:b,trigger:c?[]:["click"],overlayInnerStyle:{padding:0},destroyTooltipOnHide:!0,arrow:!1,align:{offset:[0,0]},overlayClassName:`pisell-price-keyboard-popover ${u}`,onOpenChange:e=>{c||(g(e),e?(v(i),y(!0)):null==r||r())},overlayStyle:p,children:l})});e10.displayName="PisellPriceKeyboardPopover";let e12=e=>{let{style:t}=e;return(0,eH.jsx)("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,children:(0,eH.jsx)("path",{d:"M21 15L18 12L15 15M15 21L18 24L21 21",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},e11=(0,eC.memo)(function(e){var t;let{amountSymbol:l="$",orderInfo:i,open_deposit:a=!1,customAmount:n,balanceDueAmount:r,clientInfo:o,onAmountChange:s,onDepositStatusChange:d,onDepositAmountChange:c,onBalanceDueAmountClick:u,onConfirm:p,confirmLoading:m=!1,paymentItems:g,cartData:h,walletPassData:v,totalAmount:f=0,baseSales:y,shouldUseNormalPayment:b=!1,enablePriceAdjust:x=!0,showPaymentType:k=!0}=e,_=e$(),{action:w,token:S,store:j,getApp:N}=null==(t=_.appHelper)?void 0:t.utils,C=qR(),M=(e,t)=>{var l,i,a,n,r,o,s,d;let c=null==(d=W9[(null==(r=_.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=_.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:d[e];return c||eL.getText(e)||t},[T,I]=(0,eC.useState)("regular"),[P,A]=(0,eC.useState)(!1),[D,E]=(0,eC.useState)(!1),[O,z]=(0,eC.useState)([]),[L,R]=(0,eC.useState)("0"),[$,F]=(0,eC.useState)(!1),q={deposit:M("pisell2.subtotal.deposit")||"Deposit",total:M("pisell2.subtotal.total")||"Total",sub_total:M("pisell2.subtotal.subtotal")||"Subtotal",tax:M("pisell2.subtotal.tax")||"Tax",delivery_fee:M("pisell2.subtotal.delivery-fee")||"Delivery Fee",discount:M("pisell2.subtotal.discount")||"Discount",point_deduction:M("pisell2.subtotal.point-deduction")||"Point Deduction",member_deduction:M("pisell2.subtotal.member-deduction")||"Member Deduction",expect_amount:M("pisell2.subtotal.expect-amount")||"Expected Amount"},B=()=>"deposit"===T?(""===r?void 0:r)??(null==i?void 0:i.remainingAmount)??(null==i?void 0:i.depositAmount)??"0":(null==i?void 0:i.remainingAmount)??(null==i?void 0:i.totalAmount)??"0",H=e=>{if("number"==typeof e)return e;if("string"==typeof e){let t=e.replace(/[^-0-9.]/g,"");try{return new lz(t||"0").toNumber()}catch{}}return 0},[V,U]=(0,eC.useState)(n&&""!==n?n:H(B())),Y=(0,eC.useMemo)(()=>(null==g?void 0:g.reduce((e,t)=>{if(!ePS(t))return e;try{let l=new lz(t.amount||"0"),i=new lz(t.rounding_amount||"0");return e.plus(l).plus(i)}catch{return e}},new lz(0)))||new lz(0),[g]),W=(0,eC.useCallback)(e=>{try{return lz.max(new lz(e||0).minus(Y),0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}},[Y]),K=(0,eC.useMemo)(()=>W(r||B()),[W,r,i,T]),G=(0,eC.useMemo)(()=>W(V||0),[W,V]);(0,eC.useEffect)(()=>{n&&""!==n?U(n):r&&""!==r&&U(r)},[n,r]),(0,eC.useEffect)(()=>{if(y&&i)try{var e,t,l;let a=(null==(t=y.getOrderAmountSnapshot)||null==(e=t.call(y))?void 0:e.summary)||{},n=null==(l=_.appHelper.utils)?void 0:l.translationOriginal,r=Array.isArray(null==a?void 0:a.surcharges)?a.surcharges.filter(e=>null==e?void 0:e.name).map((e,t)=>({key:`custom_surcharge_${e.surcharge_id??t}`,value:e.amount||0,label:(null==n?void 0:n(e.name))||("string"==typeof e.name?e.name:M("service.charge","Service Charge"))})):[],o=[{key:"sub_total",value:a.product_amount||a.product_expect_amount||0},...r,{key:"tax",value:a.tax_fee||0},{key:"discount",value:a.discount_amount||0},{key:"expect_amount",value:a.expect_amount||a.total_amount||0}];Array.isArray(o)&&z(o),b?(I("regular"),A(!1)):P||(I(i.isDeposit?"deposit":"regular"),A(!1))}catch(e){console.warn("Failed to get cart summary:",e)}},[y,i,b,P]),(0,eC.useEffect)(()=>{O.length>0&&(!n||""===n)&&U(H(B()))},[O,n]),(0,eC.useEffect)(()=>{var e;R((null==g||null==(e=g.reduce((e,t)=>{if(!eP_(t))return e;let l=new lz(t.origin_amount??t.amount??"0");if(t.rounding_amount){let e=new lz(t.rounding_amount);e.isNegative()&&(l=l.plus(e.abs()),e.abs().toNumber())}return e.plus(l)},new lz(0)))?void 0:e.toNumber())||0)},[g]);let Q=[{key:"regular",label:(0,eH.jsxs)("div",{className:aT()("amount-summary-dropdown-option"),children:[(0,eH.jsx)(cG,{className:aT()("dropdown-icon")}),M("regular.payment")||"普通支付"]})},{key:"deposit",label:(0,eH.jsxs)("div",{className:aT()("amount-summary-dropdown-option"),children:[(0,eH.jsx)(C3,{className:aT()("dropdown-icon")}),M("deposit.payment")||"定金支付"]})}],Z=(0,eC.useCallback)(e=>(null==e?void 0:e.parentElement)||document.body,[]),J=async()=>{E(!0)},X=()=>{E(!1)},ee=()=>{let e="deposit"===T?"payment-button-deposit":"payment-button-regular";return aT()(a?"payment-button-with-dropdown":"payment-button-without-dropdown",e)},et=()=>{var e;let t=new lz(L||"0"),l=(null==g||null==(e=g.reduce((e,t)=>{if(ePS(t))try{let l=new lz(t.amount||"0"),i=new lz(t.rounding_amount||"0");return e.plus(l).plus(i)}catch{}return e},new lz(0)))?void 0:e.toNumber())||0,i=t.plus(l).toNumber(),a=(null==g?void 0:g.filter(e=>eP_(e)&&!ePk(e)))||[];return(null==a?void 0:a.length)>0&&i<f||!(i>=f)&&t.toNumber()>0},el=()=>{if(!O||0===O.length)return null;let e=et()?2:3;return(O.length>e?O.slice(0,e):O).map(e=>{let t=e.label||q[e.key]||e.key;return(0,eH.jsxs)("div",{className:aT()("payment-detail-row"),children:[(0,eH.jsx)("span",{className:aT()("payment-detail-label"),children:t}),(0,eH.jsx)("span",{className:aT()("payment-detail-amount"),children:lQ(e.value,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]},e.key)})},ei=()=>{if(!O)return!1;let e=et()?2:3;return O.length>e},ea=(0,eC.useMemo)(()=>{var e,t,l,i;return(null==(e=O.find(e=>"discount"===e.key))?void 0:e.value)??(null==y||null==(i=y.getOrderAmountSnapshot)||null==(l=i.call(y))||null==(t=l.summary)?void 0:t.discount_amount)},[y,O]),en=()=>{let e;if(!n&&!Y.gt(0)&&0>=Number(ea||0)&&f>0)return!1;try{e=new lz(G).toNumber()}catch{return!1}if(e<=0){var t;let e=(null==g?void 0:g.filter(ePS))||[];return e.length>0&&e.every(ePk)||((null==v||null==(t=v.selectedDiscountList)?void 0:t.length)??0)>0||Number(ea||0)>0||0===f}return!1},{run:er}=sc(()=>{p&&p()},{wait:500,leading:!0,trailing:!0}),eo=()=>{m||er()},es=async e=>{var t,l;await (null==y||null==(l=y.deleteOrderPayment)?void 0:l.call(y,(null==e?void 0:e.payment_number)||(null==e?void 0:e.order_payment_id)||(null==e||null==(t=e.metadata)?void 0:t.unique_payment_number)||(null==e?void 0:e.uuid)))},ed=(0,eC.useMemo)(()=>{let e=new lz(0),t=null==g?void 0:g.reduce((e,t)=>ePS(t)?e.plus(t.amount):e,new lz(0)).toNumber(),i=lQ((e=new lz(Math.abs(e.plus(new lz(0)).plus(t).toNumber()))).toNumber(),l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0});return(0,eH.jsx)("div",{className:aT()("confirm-payment-container"),children:(0,eH.jsxs)("div",{className:aT()("confirm-payment-content"),children:[(0,eH.jsxs)("div",{className:aT()("confirm-payment-text"),children:[M("will.be.paid.in.full")||"Will be paid in full"," ",(0,eH.jsx)("span",{className:aT()("amount-text"),children:i})," ",M("by.wallet")||"by Wallet"]}),(0,eH.jsx)(eT.Button,{className:aT()("confirm-button"),onClick:eo,type:"primary",loading:m,disabled:m,children:M("confirm")||"Confirm"})]})})},[JSON.stringify(g),T,l,r,n,f,y,m]),ec=(0,eC.useMemo)(()=>0!==Number(null==i?void 0:i.totalAmount)&&!(null==g?void 0:g.some(e=>!ePw(e)&&!!eP_(e)&&(null==e?void 0:e.order_payment_type)!=="deposit"&&(null==e?void 0:e.type)!=="deposit")),[g,null==i?void 0:i.totalAmount]);(0,eC.useMemo)(()=>r!==n&&Number(r)>0&&Number(n)>0,[n,r]);let eu=o3(async e=>{let t=String(e);await (null==c?void 0:c(t))}),ep=(0,eC.useMemo)(()=>null==g?void 0:g.some(e=>"deposit"===e.order_payment_type&&eP_(e)),[g]),em=()=>{null==C||C.fail(eL.getText("pisell2.checkout.can-not-change-deposit-amount"))},eg=(0,eC.useMemo)(()=>(0,eH.jsxs)("div",{onClick:x?em:void 0,children:[(0,eH.jsx)("div",{className:aT()("balance-due-label"),children:M("deposit.due")||"Deposit Due"}),(0,eH.jsxs)("div",{className:aT()("balance-due-amount"),children:[lQ(K,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),x&&(0,eH.jsx)(dG,{className:aT()("edit-icon"),style:{color:"#7F56DA"}})]})]}),[r,l,x]),eh=(0,eC.useMemo)(()=>(0,eH.jsx)(e10,{value:K||"0",onConfirm:eu,showCurrencySymbol:!0,useThousandsSeparator:!0,selectType:"dark",overlayClassName:"cash-payment-keyboard-popover pisell-modal-mask-pointer-events-auto",children:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("div",{className:aT()("balance-due-label"),children:M("deposit.due")||"Deposit Due"}),(0,eH.jsxs)("div",{className:aT()("balance-due-amount"),children:[lQ(K,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),(0,eH.jsx)(dG,{className:aT()("edit-icon"),style:{color:"#7F56DA"}})]})]})}),[r,l]);return(0,eH.jsxs)("div",{className:aT()("amount-summary-module","amount-summary-container"),children:[k&&(0,eH.jsxs)("div",{className:aT()("left-section"),children:[a&&ec?(0,eH.jsx)(eT.Dropdown,{menu:{items:Q,onClick:e=>{var t;let{key:l,domEvent:i}=e;i.preventDefault(),i.stopPropagation(),I(t=String(l)),A(!0),d&&d("deposit"===t)},style:{backgroundColor:"#7F56DA",border:"1px solid #C3B2E7",borderRadius:"8px",padding:"8px 16px"}},trigger:["click"],placement:"bottomLeft",overlayClassName:"amount-summary-dropdown",getPopupContainer:Z,children:(0,eH.jsx)(eT.Button,{className:ee(),children:(0,eH.jsxs)("div",{className:aT()("button-content"),children:[(0,eH.jsx)("span",{className:aT()("button-text"),children:"deposit"===T?M("deposit.payment.short")||"定金\n支付":M("regular.payment.short")||"普通\n支付"}),(0,eH.jsx)(e12,{style:{width:"36px",height:"36px"}})]})})}):(0,eH.jsxs)(eT.Button,{className:ee(),children:[(0,eH.jsx)("div",{children:"deposit"===T?M("deposit.text")||"定金":M("regular.text")||"普通"}),(0,eH.jsx)("div",{children:M("payment.text")||"支付"})]}),(0,eH.jsx)(nY.Iconfont,{type:"pisell2-arrow-right",style:{fontSize:"20px"}})]}),(0,eH.jsx)("div",{className:aT()("middle-section"),children:"deposit"===T?(0,eH.jsx)(eH.Fragment,{children:(0,eH.jsxs)("div",{className:aT()("payment-details"),children:[et()&&(0,eH.jsxs)("div",{className:aT()("partial-paid-card"),children:[(0,eH.jsx)("span",{className:aT()("partial-paid-label"),children:"deposit"===T?M("deposit.partial.paid")||"Deposit Paid":M("partial.paid")||"Partial Paid"}),(0,eH.jsx)("span",{className:aT()("partial-paid-amount"),children:lQ(L,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),el(),ei()&&(0,eH.jsxs)("div",{className:aT()("more-section"),onClick:J,style:{cursor:"pointer"},role:"button",children:[(0,eH.jsx)("span",{className:aT()("more-text"),children:M("more")||"更多"}),(0,eH.jsx)(nY.Iconfont,{type:"pisell2-TriangleFill",style:{fontSize:"12px"}})]})]})}):(0,eH.jsxs)("div",{className:aT()("payment-details"),children:[et()&&(0,eH.jsxs)("div",{className:aT()("partial-paid-card"),children:[(0,eH.jsx)("span",{className:aT()("partial-paid-label"),children:M("partial.paid")||"Partial Paid"}),(0,eH.jsx)("span",{className:aT()("partial-paid-amount"),children:lQ(L,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),el(),ei()&&(0,eH.jsxs)("div",{className:aT()("more-section"),onClick:J,style:{cursor:"pointer"},role:"button",children:[(0,eH.jsx)("span",{className:aT()("more-text"),children:M("more")||"更多"}),(0,eH.jsx)(nY.Iconfont,{type:"pisell2-TriangleFill",style:{fontSize:"24px",color:"#C3B2E7"}})]})]})}),(0,eH.jsxs)("div",{className:aT()("balance-due-card",{"confirm-mode":en()}),children:[en()?ed:(0,eH.jsx)("div",{className:aT()("balance-due-info"),children:"deposit"===T?ep||!x?eg:eh:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("div",{className:aT()("balance-due-label"),children:M("balance.due")||"Balance Due"}),(0,eH.jsxs)("div",{className:aT()("balance-due-amount"),onClick:x?()=>null==u?void 0:u("manual-discount"):void 0,children:[lQ(K,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),x&&(0,eH.jsx)(dG,{className:aT()("edit-icon"),style:{color:"#7F56DA"}})]})]})}),Number(G)>0&&(0,eH.jsxs)("div",{className:aT()("pay-section"),style:{cursor:"pointer"},role:"button",children:[(0,eH.jsx)("span",{className:aT()("pay-text"),children:M("pay")||"支付"}),(0,eH.jsx)("span",{className:aT()("pay-amount"),children:lQ((()=>{try{return new lz(G||"0").toNumber()}catch{return 0}})(),l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})]}),(0,eH.jsx)(nY.PisellModal,{open:D,onCancel:X,footer:null,closable:!0,mask:!0,maskClosable:!0,centered:!0,width:600,wrapClassName:"payment-detail-modal-wrapper",title:M("order.and.payment.summary")||"Order and Payment Summary",children:D&&(0,eH.jsx)(e1X,{amountSymbol:l,orderInfo:i,cartData:h,onClose:X,summaryData:O,labelMaps:q,paymentItems:g,customAmount:n,voidPayment:es,walletPassData:v,clientInfo:o})})]})}),e14=(0,eC.forwardRef)((e,t)=>{let{amountSymbol:l="$",walletPassData:i,onSavePayLater:a}=e,[n,r]=(0,eC.useState)(!1),[o,s]=(0,eC.useState)(""),d=e$(),c=(e,t)=>{var l,i,a,n,r,o,s,c;let u=null==(c=W9[(null==(r=d.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=d.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:c[e];return u||eL.getText(e)||t},u=()=>{(null==i?void 0:i.selectedWallet)&&i.selectedWallet.length>0?(s(lG((null==i?void 0:i.selectedWallet)&&Array.isArray(i.selectedWallet)?i.selectedWallet.reduce((e,t)=>{let l=new lz(parseFloat(t.redeem)||0);return e.plus(l)},new lz(0)).toNumber():0,2,l)),r(!0)):a()},p=e=>{r(!1),a(e)};return(0,eC.useImperativeHandle)(t,()=>({handleSavePayLaterClick:u})),(0,eH.jsx)(eH.Fragment,{children:(0,eH.jsx)(nY.PisellModal,{visible:n,onCancel:()=>p("cancel"),closable:!1,mask:!0,maskClosable:!1,centered:!0,width:530,title:c("pisell2.checkout.wallet-balance-confirm.title"),footer:null,className:"wallet-balance-confirm-modal",styles:{header:{textAlign:"center",borderBottom:"1px solid #EAECF0",paddingBottom:"16px"}},children:(0,eH.jsxs)("div",{style:{padding:"40px 0 0 0"},children:[(0,eH.jsxs)("div",{style:{textAlign:"center",marginBottom:"32px",lineHeight:"1.5"},children:[(0,eH.jsx)("span",{style:{color:"#533795",fontWeight:600,fontSize:"18px"},children:o}),(0,eH.jsx)("span",{style:{color:"#101828",fontSize:"16px"},children:c("pisell2.checkout.wallet-balance-confirm.description-before")}),(0,eH.jsx)("span",{style:{color:"#533795",fontWeight:600,fontSize:"16px"},children:c("pisell2.checkout.wallet-balance-confirm.description-after")})]}),(0,eH.jsxs)("div",{style:{display:"flex",gap:"12px",flexDirection:"row"},children:[(0,eH.jsx)(eT.Button,{onClick:()=>p("cancel"),style:{flex:"0 1 auto",minWidth:"fit-content",height:"48px",borderRadius:"12px",fontSize:"16px",fontWeight:500,border:"1px solid #D0D5DD",color:"#344054",padding:"0 16px",whiteSpace:"nowrap"},children:c("pisell2.checkout.wallet-balance-confirm.cancel")}),(0,eH.jsx)(eT.Button,{onClick:()=>p("save-without-deduct"),style:{flex:"1 1 auto",height:"48px",borderRadius:"12px",fontSize:"16px",fontWeight:500,border:"1px solid #D0D5DD",color:"#344054",padding:"0 16px",whiteSpace:"nowrap"},children:c("pisell2.checkout.wallet-balance-confirm.save-without-deduct")}),(0,eH.jsx)(eT.Button,{type:"primary",style:{flex:"1.2 1 auto",height:"48px",backgroundColor:"#533795",borderColor:"#533795",borderRadius:"12px",fontWeight:600,fontSize:"16px",border:"none",boxShadow:"0px 1px 2px rgba(16, 24, 40, 0.05)",padding:"0 16px",whiteSpace:"nowrap"},onClick:()=>p("apply-deduct-now"),children:c("pisell2.checkout.wallet-balance-confirm.apply-deduct-now")})]})]})})})});function e13(e){var t;return(null==e||null==(t=e.discount)?void 0:t.resource_id)||(null==e?void 0:e.id)}function e18(e){return!!(null==e?void 0:e.order_detail_id)}function e16(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new Set;return e.forEach(e=>{e18(e)&&(e.discount_list||[]).forEach(e=>{let l=e13(e);l&&["good_pass","discount_card"].includes(e.type)&&t.add(String(l))})}),t}function e15(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2?arguments[2]:void 0,i=e16(t),a=l||i;return e.map(e=>{let t=(null==e?void 0:e.id)||e13(e);return t&&a.has(String(t))?{...e,isEditMode:!0,isSelected:!0}:(null==e?void 0:e.isEditMode)?{...e,isEditMode:!1,isSelected:!1}:e}).map(e=>{let t;return"product_discount_card"!==(t=(null==e?void 0:e.tag)||(null==e?void 0:e.type))&&"discount_card"!==t&&"good_pass"!==t||void 0!==e.isAvailable?e:{...e,isAvailable:!0,isSelected:e.isSelected??!1}})}function e17(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e15((null==e||null==(t=e.getDiscountList)?void 0:t.call(e))||[],l,i)}function e19(e){return!!(null==e?void 0:e.expire_date)&&eS()(e.expire_date).endOf("day").isBefore(eS()())}function e4e(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=[];t.forEach(e=>{let t=e18(e);(e.discount_list||[]).forEach(i=>{var a,n,r,o,s;let d=e13(i);if(!d||!["good_pass","discount_card"].includes(i.type))return;let c=e.quantity||e.num||e.product_quantity||1,u=Number(i.amount||0)*Number(c||1)+Number((null==i||null==(a=i.metadata)?void 0:a.product_discount_difference)||0),p=l.findIndex(e=>e.id===d);if(-1!==p){l[p]={...l[p],amount:Number(l[p].amount||0)+Number(i.amount||0),savedAmount:Number(l[p].savedAmount||0)+u};return}l.push({...i,id:d,tag:i.tag||i.type,name:i.name||(null==(r=i.discount)||null==(n=r.title)?void 0:n.auto),format_title:(null==(o=i.discount)?void 0:o.title)||i.format_title,isEditMode:t,isAvailable:!0,isDisabled:!0,isSelected:!0,limited_relation_product_data:{},savedAmount:u,product_id:(null==(s=i.discount)?void 0:s.product_id)||i.product_id})})});let i=new Set(l.map(e=>e.id));return[...l,...e.filter(e=>!i.has(e.id))]}e14.displayName="SavePayLaterHandler";let e4t=e=>{var t,l,i;let{customerName:a,selectedCount:n,expiredCount:r,isCardMode:o,onExpiredClick:s,onBestSaving:d,onClearAll:c,onToggleDisplayMode:u}=e;return(0,eH.jsxs)("div",{className:"wallet-pass-header",children:[(0,eH.jsxs)("div",{className:"wallet-pass-header-left",children:[(0,eH.jsx)("span",{className:"wallet-pass-module-customer-container",dangerouslySetInnerHTML:{__html:(null==(t=eL.getText("wallet-pass-module-cards-vouchers-in-wallet"))?void 0:t(`<span class="theme-color wallet-pass-module-customer">${a}</span>`))||""}}),(0,eH.jsx)("span",{style:{color:"#475467"},children:null==(l=eL.getText("wallet-pass-module-applied"))?void 0:l(n)}),(0,eH.jsx)("span",{className:aT()("error-color","pointer","underline"),onClick:s,children:null==(i=eL.getText("wallet-pass-module-expired"))?void 0:i(r)})]}),(0,eH.jsxs)("div",{className:"wallet-pass-header-right",children:[(0,eH.jsx)("span",{className:aT()("theme-color","pointer","underline"),onClick:d,children:eL.getText("wallet-pass-module-best-saving")}),(0,eH.jsx)("span",{className:aT()("error-color","pointer","underline"),onClick:c,children:eL.getText("wallet-pass-module-clear-all")}),(0,eH.jsx)("div",{onClick:u,className:"wallet-pass-header-right-icon-container",children:(0,eH.jsx)(nY.Icon,{type:"pisell2-chevron-up",className:aT()("wallet-pass-header-right-icon","theme-color","pointer",{rotated:!o})})})]})]})},e4l=nY.PisellText.Amount,e4i=e=>{let{cardData:t,selectedWalletIds:l}=e;return(0,eH.jsx)("div",{className:"wallet-pass-text-mode",children:t&&t.length>0?t.filter(e=>l.includes(e.id)).map(e=>(0,eH.jsxs)("div",{className:"wallet-pass-text-item selected",children:[(0,eH.jsx)("span",{className:"wallet-pass-text-name",children:e.name}),(0,eH.jsxs)("span",{className:"wallet-pass-text-amount",children:["-",(0,eH.jsx)(e4l,{value:e.redeem,showCurrencySymbol:!0})]})]},e.id)):(0,eH.jsx)("div",{className:"wallet-pass-text-empty"})})},e4a=nY.PisellText.Amount,e4n=e=>{let{isCardMode:t,cardData:l,selectedWalletIds:i,onSelectWallet:a,onDetail:n,onConfirmEditAmount:r,onBeforeEditAmount:o}=e;return(0,eH.jsx)("div",{className:"wallet-pass-card-display-container",children:t?(0,eH.jsx)(nY.PisellCardList,{showActiveBackground:!0,showName:!0,showStoreName:!1,showRedeem:!0,showBalance:!0,showCode:!0,showValidDate:!0,showDetail:!0,showQrCode:!0,showCover:!0,showActions:!1,platform:"pc",mode:"multiple",direction:"horizontal",formatBalance:(e,t)=>{var l,i,a,n,r,o,s,d;if((null==t||null==(l=t.data)?void 0:l.originData.tag)==="point_card"){let l=(null==t?void 0:t.active)?(e||0)-((null==t||null==(a=t.data)||null==(i=a.originData)?void 0:i.recommended_usage_par_value)||0):e,o=(s=l||0,(d=null==t||null==(r=t.data)||null==(n=r.originData)?void 0:n.wallet_pass_usage_unit).points&&d.price?new lz(s).div(d.points).mul(d.price).toFixed(2,lz.ROUND_DOWN):new lz(s).toFixed(2));return(0,eH.jsxs)("div",{children:[(0,eH.jsx)(e4a,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:l,showCurrencySymbol:!1}),"(",(0,eH.jsx)(e4a,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:o,showCurrencySymbol:!1}),")"]})}return(null==t?void 0:t.active)?(0,eH.jsx)("div",{children:(0,eH.jsx)(e4a,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:e?e-((null==t||null==(o=t.data)?void 0:o.redeem)||0):0,showCurrencySymbol:!0})}):(0,eH.jsx)("div",{children:(0,eH.jsx)(e4a,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:e,showCurrencySymbol:!0})})},formatBalanceTitle:(e,t)=>(null==t?void 0:t.active)?(0,eH.jsx)("span",{children:eL.getText("wallet-pass-module-balance-after")}):(0,eH.jsx)("span",{children:eL.getText("wallet-pass-module-balance")}),formatRedeemTitle:(e,t)=>(null==t?void 0:t.active)?(0,eH.jsx)("span",{children:t.originDom}):(0,eH.jsx)("span",{children:eL.getText("wallet-pass-module-max.use")}),type:"mini",data:l,hasMore:!1,showEmpty:!1,fullWidth:!1,value:i,useExternalDetail:!0,onDetail:n,showStatus:!1,onChange:e=>{a(e)},actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}},enableEditAmount:!0,onConfirmEditAmount:r,onBeforeEditAmount:o}):(0,eH.jsx)(e4i,{cardData:l,selectedWalletIds:i})})},e4r=e=>{let{visible:t,walletData:l,onClose:i,title:a,emptyText:n}=e;return(0,eH.jsx)(nY.PisellModal,{title:(0,eH.jsx)("div",{className:"wallet-modal-title",children:a}),open:t,onCancel:i,width:680,footerDivider:!1,headerDivider:!1,cancelVisible:!1,onOk:i,okText:eL.getText("wallet-pass-module-expired-modal-close"),children:(0,eH.jsx)("div",{className:"wallet-modal-content",children:l&&l.length>0?(0,eH.jsx)(nY.PisellCardList,{showActiveBackground:!0,showName:!0,showStoreName:!1,showRedeem:!0,showBalance:!0,showCode:!0,showValidDate:!0,showDetail:!0,showQrCode:!0,showCover:!0,platform:"pc",mode:"single",direction:"horizontal",type:"mini",data:l,hasMore:!1,showEmpty:!1,fullWidth:!1,showStatus:!1,nameTitleStyle:{fontSize:20,fontWeight:600,color:"#f5a623"},actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}}}):(0,eH.jsx)(nY.PisellEmpty,{title:n||eL.getText("wallet-pass-module-expired-modal-empty")})})})},e4o=nY.PisellText.Amount,e4s=e=>{let{cardData:t,selectedWalletIds:l}=e;return(0,eH.jsx)("div",{className:"discount-text-mode",children:t&&t.length>0?t.filter(e=>l.includes(e.id)).map(e=>(0,eH.jsxs)("div",{className:"discount-text-item selected",children:[(0,eH.jsx)("span",{className:"discount-text-name",children:e.name}),(0,eH.jsxs)("span",{className:"discount-text-amount",children:["-",(0,eH.jsx)(e4o,{value:e.savedAmount,showCurrencySymbol:!0})]})]},e.id)):(0,eH.jsx)("div",{className:"discount-text-empty"})})},e4d=e=>{let{isCardMode:t,cardData:l,selectedWalletIds:i,onSelectWallet:a,onDetail:n,discountDisabled:r}=e,o=qR(),s=(0,eC.useMemo)(()=>r?l.map(e=>({...e,disabled:!0})):l,[r,l]);return(0,eH.jsx)("div",{className:"discount-wallet-list-container",children:t?(0,eH.jsx)(nY.PisellCardList,{className:"",showName:!0,showActiveBackground:!0,showStoreName:e=>{var t;return(null==e||null==(t=e.originData)?void 0:t.tag)!=="good_pass"||e.active},onItemClick:()=>{r&&o.info(eL.getText("wallet-pass-module-discount-partially-paid"))},disabled:r,showRedeem:!1,showBalance:!1,showCode:!1,showValidDate:!1,showDetail:!1,showQrCode:!1,showCover:!1,showActions:!1,platform:"pc",mode:"multiple",direction:"horizontal",type:"mini",data:s,hasMore:!1,showEmpty:!1,fullWidth:!1,value:i,useExternalDetail:!0,onDetail:n,showStatus:!1,nameTitleStyle:{fontSize:20,fontWeight:600,color:"#FF8A1E"},onChange:a,actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}},enableEditAmount:!1}):(0,eH.jsx)(e4s,{cardData:l,selectedWalletIds:i})})},e4c={status:"idle",items:[],selectedIds:[],selectedItems:[],committedIds:[],selectionSources:{},totalSelectedAmount:0,error:null,revision:0};function e4u(e){return(null==e?void 0:e.id)??(null==e?void 0:e.voucher_id)??(null==e?void 0:e.code)}function e4p(e){return["product_discount_card","discount_card","good_pass","entitlement_pass"].includes((null==e?void 0:e.tag)||(null==e?void 0:e.type))}let e4m=(0,eC.forwardRef)((e,t)=>{var l;let{orderInfo:i,onSelectChange:a,paymentItems:n,clientId:r,baseSales:o,onDiscountChange:s}=e,d=function(e){var t,l;let{baseSales:i,clientId:a,onSelectChange:n,onDiscountChange:r}=e,[o,s]=(0,eC.useState)(()=>{var e;return(null==i||null==(e=i.getWalletAssetsState)?void 0:e.call(i))||e4c}),[d,c]=(0,eC.useState)(()=>{var e;return((null==i||null==(e=i.getDiscountList)?void 0:e.call(i))||[]).filter(e4p)}),[u,p]=(0,eC.useState)(!1),m=(0,eC.useRef)(!1),g=(0,eC.useRef)(null),h=(0,eC.useRef)(null),v=(0,eC.useRef)(!1);(0,eC.useEffect)(()=>{var e,t;let l=null==i||null==(e=i.getWalletAssetsState)?void 0:e.call(i);if(l&&s(l),c(((null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(e4p)),!(null==i?void 0:i.effectsOn))return;let a=i.effectsOn("onWalletAssetsStateChanged",e=>{if(null==e?void 0:e.state){if(m.current){g.current=e.state;return}s(e.state)}}),n=i.effectsOn("onDiscountApplied",e=>{var t;c((Array.isArray(null==e?void 0:e.discountList)?e.discountList:(null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(e4p))});return()=>{[a,n].forEach(e=>{var t;"function"==typeof e?e():null==e||null==(t=e.remove)||t.call(e)})}},[i]),(0,eC.useEffect)(()=>{var e;let t;try{t=null==n?void 0:n(((null==o?void 0:o.selectedItems)||[]).flatMap(e=>{let t,l=(null==e?void 0:e.voucher_id)??(null==e?void 0:e.id),i=(t=Number(eDI(e)??(null==e?void 0:e.amount)??0),Number.isFinite(t)&&t>0?t:0);return void 0===l||i<=0?[]:[{voucher_id:l,amount:i,code:null==e?void 0:e.tag,wallet_pass_usage_unit:null==e?void 0:e.wallet_pass_usage_unit,wallet_pass_use_value:null==e?void 0:e.wallet_pass_use_value}]}))}catch(t){throw null==(e=h.current)||e.call(h),h.current=null,v.current=!1,t}let l=h.current;if(l&&!v.current){v.current=!0;let e=()=>{h.current===l&&(h.current=null,v.current=!1),l()};Promise.resolve(t).then(e,e)}},[n,o.revision]),(0,eC.useEffect)(()=>()=>{var e;null==(e=h.current)||e.call(h),h.current=null,v.current=!1},[]);let f=(0,eC.useMemo)(()=>[...o.selectedIds||[],...o.committedIds||[]],[o.committedIds,o.selectedIds]),y=(0,eC.useMemo)(()=>new Set((o.committedIds||[]).map(e=>String(e))),[o.committedIds]),b=(0,eC.useMemo)(()=>new Map((o.selectedItems||[]).map(e=>[String(e4u(e)??(null==e?void 0:e.code)??""),e])),[o.selectedItems]),x=(0,eC.useMemo)(()=>eDE((o.items||[]).map(e=>{let t={...e,...b.get(String(e4u(e)??(null==e?void 0:e.code)??""))||{}};return{...t,...(null==t?void 0:t.unified_available_status)!==void 0?{unified_available_status:Number(t.unified_available_status)}:{},...(null==t?void 0:t._unified_available_status)!==void 0?{_unified_available_status:Number(t._unified_available_status)}:{},...(null==t?void 0:t.available)===!1||(null==t?void 0:t.isDisabled)===!0?{unified_available_status:0,unified_messages:(null==t?void 0:t.unified_messages)||{title:(null==t?void 0:t.reason)||(null==t?void 0:t.disabledReason)}}:{}}}),f).map(e=>({...e,enableEditAmount:!y.has(String(e.id)),...y.has(String(e.id))?{disabled:!0,active:!0}:{}})),[y,b,f,o.items]),k=(0,eC.useMemo)(()=>x.filter(e=>{var t;let l=null==e||null==(t=e.originData)?void 0:t.expire_date;return!!l&&eS()(l).endOf("day").isBefore(eS()())}),[x]),_=(0,eC.useMemo)(()=>k.map(e=>e.id),[k]),w=(0,eC.useMemo)(()=>d.filter(e=>null==e?void 0:e.isSelected).map(e=>null==e?void 0:e.id),[d]),S=(0,eC.useMemo)(()=>eDO(d.filter(e=>(null==e?void 0:e.isAvailable)!==!1||(null==e?void 0:e.isSelected)),w),[d,w]),j=o3(e=>{var t,l,a;c(((null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(e4p)),null==r||r({...e,discountList:(null==i||null==(l=i.getDiscountList)?void 0:l.call(i))||[],productList:(null==i||null==(a=i.getOrderProducts)?void 0:a.call(i))||[]})}),N=o3(async e=>{if(!(null==i?void 0:i.selectWalletAsset)||u)return;let t=new Set((o.committedIds||[]).map(e=>String(e))),l=new Set((o.selectedIds||[]).map(e=>String(e))),a=new Set(e.map(e=>String(e)));p(!0);try{for(let e of o.items||[]){let n=e4u(e);if(void 0===n||t.has(String(n)))continue;let r=l.has(String(n)),o=a.has(String(n));r!==o&&await i.selectWalletAsset({assetId:n,selected:o,source:"manual"})}}finally{p(!1)}}),C=o3(async()=>{if(!u){p(!0);try{var e,t;for(let l of(await (null==i||null==(e=i.clearWalletAssetSelection)?void 0:e.call(i)),w))await (null==i||null==(t=i.setDiscountSelected)?void 0:t.call(i,{discountId:l,isSelected:!1}));j()}finally{p(!1)}}}),M=o3(async(e,t)=>{var l,a,n,r;if(!(null==i?void 0:i.scanWalletAsset))return null;p(!0),m.current=!0,g.current=null;let d=!1,c=o.revision;try{let t=await i.scanWalletAsset(e);d=!0;let n=null==t?void 0:t.asset;if((null==t?void 0:t.type)==="walletCode"){let e=(null==t?void 0:t.data)||n;if(!e)return t;if((null==e?void 0:e.is_cross_shop_wallet)!==!0&&1!==Number(null==e?void 0:e.is_cross_shop_wallet))return{...t,data:e,asset:e};let l=Number(null==e?void 0:e.customer_id);if(!Number.isInteger(l)||l<=1||"function"!=typeof(null==i?void 0:i.resolveCustomerById))throw Error("Customer resolve is unavailable");let a=await i.resolveCustomerById(l);if(!a)throw Error("Customer resolve failed");let r={...e,customer:a};return{...t,data:r,asset:r}}let r=Number((null==n?void 0:n.customer_id)??(null==n||null==(l=n.holder)?void 0:l.customer_id)),o=null==i||null==(a=i.getOrderCustomerSnapshot)?void 0:a.call(i),s=Number((null==o?void 0:o.id)??(null==o?void 0:o.customer_id)??1),c=!Number.isInteger(s)||s<=1,u=Number.isInteger(r)&&r>1;if(c&&u){if("function"!=typeof(null==i?void 0:i.resolveCustomerById)||"function"!=typeof(null==i?void 0:i.setOrderCustomer)||"function"!=typeof(null==i?void 0:i.refreshWalletAssets))throw Error("Customer resolve is unavailable");let l=await i.resolveCustomerById(r);if(!l)throw Error("Customer resolve failed");i.setOrderCustomer(l);let a=await i.refreshWalletAssets({preserveSelection:!1,retainSearchResultCodes:[e]});return{...t,state:a||(null==t?void 0:t.state)}}return t}finally{let e;m.current=!1;let l=(null==i||null==(n=i.getWalletAssetsState)?void 0:n.call(i))||g.current;g.current=null;try{l&&((null==t?void 0:t.waitForApply)&&d&&!Object.is(l.revision,c)&&(null==(r=h.current)||r.call(h),v.current=!1,e=new Promise(e=>{h.current=e})),s(l)),await e}finally{p(!1)}}}),T=o3(async e=>{if(u)return;let t=new Set(w.map(e=>String(e))),l=new Set(e.map(e=>String(e)));p(!0);try{for(let e of d){let n=null==e?void 0:e.id;if(void 0===n)continue;let r=t.has(String(n)),o=l.has(String(n));if(r!==o){var a;await (null==i||null==(a=i.setDiscountSelected)?void 0:a.call(i,{discountId:n,isSelected:o}))}}j()}finally{p(!1)}}),I=o3(async()=>{if(!u){p(!0);try{var e,t,l;let a=(o.items||[]).filter(e=>null==e?void 0:e._wallet_asset_recommended).map(e=>e4u(e)).filter(e=>void 0!==e);for(let l of(await (null==i||null==(e=i.clearWalletAssetSelection)?void 0:e.call(i)),a))await (null==i||null==(t=i.selectWalletAsset)?void 0:t.call(i,{assetId:l,selected:!0,source:"manual"}));if(S.length){let e=await (null==i||null==(l=i.bestDiscount)?void 0:l.call(i));j(e)}}finally{p(!1)}}}),P=o3(async(e,t,l)=>{if(!(null==i?void 0:i.updateWalletAssetAmount)||u)return;let a=e4u((null==l?void 0:l.originData)||l),n=Number(e);if(void 0!==a&&Number.isFinite(n)&&!(n<0)){p(!0);try{await i.updateWalletAssetAmount({assetId:a,amount:n})}finally{p(!1)}}});return{cardData:x,selectedWalletIds:f,expiredWalletIds:_,expiredWalletData:k,disabledWalletData:[],clearDisabledWalletData:()=>void 0,clearAllSelectedWallet:C,handleBestSaving:I,handleSearchIdentificationCode:M,handleSelectWallet:N,availableDiscountList:S,selectedDiscountList:w,handleSelectDiscount:T,customerName:(null==i||null==(l=i.getCustomer)||null==(t=l.call(i))?void 0:t.name)||(a?String(a):""),handleConfirmEditAmount:P,handleBeforeEditAmount:async()=>!0,loading:"loading"===o.status||u}}({baseSales:o,clientId:r,onSelectChange:a,onDiscountChange:s}),[c,u]=(0,eC.useState)(!0),[p,m]=(0,eC.useState)(!1);(0,eC.useImperativeHandle)(t,()=>({handleSearchIdentificationCode:d.handleSearchIdentificationCode,getWalletPassData:e=>({selectedWallet:e.length?d.cardData.filter(e=>d.selectedWalletIds.some(t=>String(t)===String(e.id))):[],availableDiscountList:d.availableDiscountList,selectedDiscountList:d.selectedDiscountList})}));let g=o3(()=>{u(e=>!e)}),h=(0,eC.useMemo)(()=>0===Number(null==i?void 0:i.totalAmount)||!!(null==n?void 0:n.some(e=>!ePw(e)&&!!eP_(e)&&!ePc.includes(e.code))),[null==i?void 0:i.totalAmount,n]),v=d.selectedWalletIds.length+d.selectedDiscountList.length;return 0===d.cardData.length&&0===d.availableDiscountList.length?null:(0,eH.jsx)("div",{className:"wallet-pass-module-container",children:(0,eH.jsx)(nY.PisellLoading,{delay:300,loading:d.loading,fullscreen:!1,mask:{backgroundColor:"rgba(255, 255, 255, 0.5)",width:"100%",height:"100%"},children:(0,eH.jsxs)("div",{className:"wallet-pass-module",children:[(0,eH.jsx)(e4t,{customerName:d.customerName,selectedCount:v,expiredCount:d.expiredWalletIds.length,isCardMode:c,onExpiredClick:()=>m(!0),onBestSaving:d.handleBestSaving,onClearAll:d.clearAllSelectedWallet,onToggleDisplayMode:g}),(0,eH.jsx)(e4n,{isCardMode:c,cardData:d.cardData,selectedWalletIds:d.selectedWalletIds,onSelectWallet:d.handleSelectWallet,onDetail:()=>void 0,onConfirmEditAmount:d.handleConfirmEditAmount,onBeforeEditAmount:d.handleBeforeEditAmount}),(0,eH.jsx)(e4d,{isCardMode:c,cardData:d.availableDiscountList,selectedWalletIds:d.selectedDiscountList,onSelectWallet:d.handleSelectDiscount,onDetail:()=>void 0,discountDisabled:h}),(0,eH.jsx)(e4r,{visible:p,walletData:d.expiredWalletData,onClose:()=>m(!1),title:null==(l=eL.getText("wallet-pass-module-expired-modal-title"))?void 0:l(d.expiredWalletData.length)})]})})})}),e4g=(0,eC.forwardRef)((e,t)=>{var l;let{orderInfo:i,onSelectChange:a,customAmount:n,paymentItems:r,clientId:o,baseSales:s,onDiscountChange:d}=e,{handleSelectWallet:c,cardData:u,selectedWalletIds:p,expiredWalletIds:m,expiredWalletData:g,disabledWalletData:h,clearAllSelectedWallet:v,clearDisabledWalletData:f,handleBestSaving:y,loading:b,handleSearchIdentificationCode:x,availableDiscountList:k,selectedDiscountList:_,handleSelectDiscount:w,customerName:S,handleConfirmEditAmount:j,handleBeforeEditAmount:N}=(e=>{let{onSelectChange:t,customAmount:l,clientId:i,totalAmount:a}=e,n=eWG(),[r,o]=(0,eC.useState)([]),[s,d]=(0,eC.useState)([]),[c,u]=(0,eC.useState)([]),[p,m]=(0,eC.useState)([]),g=(0,eC.useRef)([]),h=(0,eC.useRef)([]),v=(0,eC.useRef)([]),f=(0,eC.useRef)(""),y=(0,eC.useRef)(null),b=(0,eC.useRef)(""),x=(0,eC.useRef)(null),k=(0,eC.useRef)(new Set),_=(0,eC.useRef)(""),w=(0,eC.useRef)(""),S=(0,eC.useRef)(null),j=(0,eC.useRef)(!1),[N,C]=(0,eC.useState)([]),[M,T]=(0,eC.useState)({}),[I,P]=(0,eC.useState)([]),A=(0,eC.useRef)([]),[D,E]=(0,eC.useState)([]),[O,z]=(0,eC.useState)([]),L=(0,eC.useRef)(!1),R=(0,eC.useRef)(!1),$=(0,eC.useRef)(!1),[F,q]=(0,eC.useState)([]),B=(0,eC.useMemo)(()=>I.map(e=>e.id),[I]),H=(0,nY.useToast)(),[V,U]=(0,eC.useState)(!1),[Y,W]=(0,eC.useState)(null),[K,G]=(0,eC.useState)([]),Q=e.baseSales,Z=null==Q?void 0:Q.payment,J=null==Z?void 0:Z.wallet,X=o3(()=>i),ee=o3(()=>{var e,t,i;let n=(null==Q||null==(e=Q.getOrderAmountSnapshot)?void 0:e.call(Q))||(null==Q||null==(i=Q.getOrderSnapshot)||null==(t=i.call(Q))?void 0:t.amount)||{},r=n.amountGap??n.depositAmount??n.totalAmount??n.expectAmount;return Number(l??r??a??0)}),et=o3(()=>{var e,t,l,i,a,n;if(F.length>0)return F;let r=(null==Q||null==(e=Q.getOrderProducts)?void 0:e.call(Q))||[];return r.length>0?r:(null==Q||null==(l=Q.getTempOrder)||null==(t=l.call(Q))?void 0:t.products)||(null==Q||null==(n=Q.getOrderSnapshot)||null==(a=n.call(Q))||null==(i=a.tempOrder)?void 0:i.products)||[]}),el=o3(()=>{var e,t,l,i,a,n,r,o,s;if(!Q)return;let d=(null==Q||null==(e=Q.getTempOrder)?void 0:e.call(Q))||(null==Q||null==(l=Q.getOrderSnapshot)||null==(t=l.call(Q))?void 0:t.tempOrder),c=(null==Q||null==(i=Q.getOrderProducts)?void 0:i.call(Q))||(null==d?void 0:d.products)||[],u=e16(c),p=String((null==d?void 0:d.order_id)||(null==(n=Q.getOrderIdentity)||null==(a=n.call(Q))?void 0:a.orderId)||""),m=null==Q||null==(r=Q.store)?void 0:r.order,g=(null==Q||null==(o=Q.getDiscountList)?void 0:o.call(Q))||(null==m||null==(s=m.getDiscountList)?void 0:s.call(m))||[];_.current!==p&&(_.current=p,k.current=u);let v=em(e15(g,c,k.current));h.current=v,G(v)}),ei=o3(async()=>{var e,t,l,i,a,n,r,o;let s=(null==Q||null==(e=Q.getTempOrder)?void 0:e.call(Q))||(null==Q||null==(l=Q.getOrderSnapshot)||null==(t=l.call(Q))?void 0:t.tempOrder),d=(null==Q||null==(i=Q.getOrderProducts)?void 0:i.call(Q))||(null==s?void 0:s.products)||[],c=Number(X()||0);if(!Q)return;let u=e16(d),p=String((null==s?void 0:s.order_id)||(null==(n=Q.getOrderIdentity)||null==(a=n.call(Q))?void 0:a.orderId)||"");_.current!==p&&(_.current=p,k.current=u);let m=JSON.stringify({orderId:(null==s?void 0:s.order_id)||(null==(o=Q.getOrderIdentity)||null==(r=o.call(Q))?void 0:r.orderId),customerId:c,productDiscounts:d.map(e=>({productId:e.product_id||e.id,discounts:(e.discount_list||[]).map(e=>({id:e13(e),amount:e.amount,type:e.type}))}))});if(f.current===m&&K.length>0)return;if(y.current&&f.current===m)return y.current;f.current=m;let g=async()=>{var e,t,l,i,a,n,r,o,u,p;if("function"==typeof(null==Q?void 0:Q.loadDiscountConfig)){let e=await Q.loadDiscountConfig({customerId:c,action:(null==s?void 0:s.order_id)?"edit":"create"});return{...e,discountList:e15((null==e?void 0:e.discountList)||[],d,k.current)}}let m=null==Q||null==(e=Q.store)?void 0:e.order;if(!(null==m?void 0:m.loadDiscountConfig))return{productList:d,discountList:e4e((null==m||null==(u=m.getDiscountList)?void 0:u.call(m))||(null==Q||null==(p=Q.getDiscountList)?void 0:p.call(Q))||[],d)};let g=e4e(await m.loadDiscountConfig({customerId:c,action:(null==s?void 0:s.order_id)?"edit":"create",orderId:Number((null==s?void 0:s.order_id)||(null==Q||null==(l=Q.getOrderIdentity)||null==(t=l.call(Q))?void 0:t.orderId))||void 0,apply:!1})||(null==(i=m.getDiscountList)?void 0:i.call(m))||[],d);return await (null==m||null==(r=m.store)||null==(n=r.discount)||null==(a=n.setDiscountList)?void 0:a.call(n,g)),{productList:(null==(o=m.getOrderProducts)?void 0:o.call(m))||d,discountList:g}},v=(async()=>{let e=await g(),t=em((null==e?void 0:e.discountList)||e17(Q,d,k.current));h.current=t,G(t)})();y.current=v;try{return await v}finally{y.current===v&&(y.current=null)}}),ea=(0,eC.useMemo)(()=>{var e,t;return null==Z||null==(t=Z.window)||null==(e=t.getWalletPassEvaluator)?void 0:e.call(t)},[Z]),en=o3(e=>{P(e),A.current=e}),er=o3(()=>A.current.reduce((e,t)=>{let l=Number((null==t?void 0:t.actualDeduction)??(null==t?void 0:t._available_max_amount)??(null==t?void 0:t.available_max_amount)??(null==t?void 0:t.recommended_usage_amount)??(null==t?void 0:t.amount)??0);return e+(Number.isFinite(l)?l:0)},0)),eo=o3(()=>{let e=new Map,t=t=>{"number"==typeof(null==t?void 0:t.edit_current_amount)&&e.set(t.id,t.edit_current_amount)};return[A.current,I,c,r,s,N].forEach(e=>{(e||[]).forEach(t)}),e}),es=o3(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=eo();return t.size?e.map(e=>t.has(e.id)?{...e,edit_current_amount:t.get(e.id)}:e):e}),ed=o3(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new Map;return(A.current.forEach(e=>{D.includes(e.id)&&t.set(e.id,{actualDeduction:e.actualDeduction,_available_max_amount:e._available_max_amount,recommended_usage_amount:e.recommended_usage_amount,recommended_usage_par_value:e.recommended_usage_par_value,available_max_amount:e.available_max_amount})}),t.size)?e.map(e=>{let l=t.get(e.id);return l&&void 0===e.actualDeduction&&void 0===e._available_max_amount&&void 0===e.available_max_amount&&void 0===e.recommended_usage_amount?{...e,...l}:e}):e});(0,eC.useEffect)(()=>{oi(i)&&0===N.length&&!Q&&(d([]),o([]),G([]))},[i]);let ec=(0,eC.useMemo)(()=>eDO(K.filter(e=>!!e.isAvailable).map(e=>({...e,isDisabled:e.isDisabled||e.isDisabledForProductUsed,savedAmount:e.savedAmount||0}))),[K]),eu=(0,eC.useMemo)(()=>ec.filter(e=>e.isSelected&&!e.isEditMode).map(e=>e.id),[ec]),ep=o3(e=>{if(0===g.current.length)return e;let t=new Map(e.map(e=>[e.id,e])),l=[],i=new Set;if(N.length>0)for(let e of[...N].reverse()){let a=t.get(e.id);a&&!i.has(e.id)&&(l.push(a),i.add(e.id))}for(let t of e)g.current.some(e=>e.id===t.id)||i.has(t.id)||(l.push(t),i.add(t.id));for(let e of g.current)t.has(e.id)&&!i.has(e.id)&&(l.push(t.get(e.id)),i.add(e.id));return l}),em=o3(e=>{let t=e=>e.sort((e,t)=>e.isSelected&&!t.isSelected?-1:!e.isSelected&&t.isSelected?1:0);if(0===h.current.length||0===e.length)return[...e.filter(e=>e.isEditMode),...t(e.filter(e=>!e.isEditMode))];let l=new Map;for(let t of e){var i;l.has(t.id)||l.set(t.id,[]),null==(i=l.get(t.id))||i.push(t)}let a=e=>{let t=l.get(e.id);if(!(null==t?void 0:t.length))return null;let i=t.indexOf(e);return -1===i?null:t.splice(i,1)[0]},n=(e,t)=>{let i=l.get(e.id);if(!(null==i?void 0:i.length))return null;let a=i.findIndex(l=>t(l,e));return -1===a?null:i.splice(a,1)[0]},r=[],o=[],s=[];for(let e of h.current.filter(e=>e.isEditMode)){let t=n(e,e=>!!e.isEditMode);t&&r.push(t)}for(let t of e){if(!t.isEditMode)continue;let e=a(t);e&&r.push(e)}for(let e of h.current){if(e.isEditMode)continue;let t=n(e,e=>!e.isEditMode);t&&o.push(t)}for(let t of e){if(t.isEditMode)continue;let e=a(t);e&&s.push(e)}return[...r,...o,...t(s)]}),eg=(0,eC.useMemo)(()=>[...c||[],...N||[]],[c,N]),eh=(0,eC.useMemo)(()=>D.map(e=>eg.find(t=>t.id===e)).filter(Boolean),[D,eg]),{displayVouchers:ev,displayOtherVouchers:ef,selectedWithDetails:ey,totalDeduction:eb}=(0,eC.useMemo)(()=>{if(!ea||!eg.length||!a)return{displayVouchers:[...c||[],...p||[]],displayOtherVouchers:N||[],selectedWithDetails:[],totalDeduction:0};let e=et(),t=ea.recalculateVouchers(eg,eh,a,e),l=[],i=[];return t.allWithUpdatedStatus.forEach(e=>{N.some(t=>t.id===e.id)?i.push(e):l.push(e)}),{displayVouchers:[...l,...p||[]],displayOtherVouchers:i,selectedWithDetails:t.selectedWithDetails,totalDeduction:t.selectedWithDetails.reduce((e,t)=>e+(t.actualDeduction||0),0)}},[eh,eg,c,N,p,a,F,Q]);Fx(()=>{let e;try{e=eE(ey)}catch(e){var t;throw null==(t=S.current)||t.call(S),S.current=null,j.current=!1,e}en(ey),U(!1);let l=S.current;if(l&&!j.current){j.current=!0;let t=()=>{S.current===l&&(S.current=null,j.current=!1),l()};Promise.resolve(e).then(t,t)}},[ey],{wait:200}),(0,eC.useEffect)(()=>()=>{var e;null==(e=S.current)||e.call(S),S.current=null,j.current=!1},[]);let ex=(0,eC.useMemo)(()=>eDE(emy(ep([...ey,...ev,...ef]),"id"),D),[ev,ef,D,ey]),ek=o3(async e=>{U(!0),W(null);try{var t;let l=await (null==J||null==(t=J.getUserIdentificationCodeListAsync)?void 0:t.call(J,e));if(!l)return[];let i=emy([...l,...A.current],"id");return d(i),l}catch(e){throw W(e instanceof Error?e.message:"获取用户识别码列表失败"),e}finally{U(!1)}}),e_=o3(()=>{var e;return(null==J||null==(e=J.getWalletRecommendList)?void 0:e.call(J))||[]}),ew=o3(()=>{var e;return(null==J||null==(e=J.getUserIdentificationCodes)?void 0:e.call(J))||[]}),eS=o3(()=>{var e;null==J||null==(e=J.clearWalletRecommendList)||e.call(J),o([])}),ej=o3(()=>{var e;null==J||null==(e=J.clearUserIdentificationCodes)||e.call(J),d([])}),eN=o3(()=>{var e;null==J||null==(e=J.clearAllCache)||e.call(J),o([]),d([]),C([]),z([]),m([]),u([]),en([]),E([])}),eM=o3(l=>{var i,a;null==J||null==(i=J.clearAllCache)||i.call(J),o([]),d([]),C([]),z([]),m([]),u([]),en([]),E([]),G([]),q([]),T({}),W(null),U(!1),g.current=[],h.current=[],v.current=[],f.current="",y.current=null,b.current="",x.current=null,k.current=new Set,_.current="",L.current=!1,R.current=!1,$.current=!1,(null==l?void 0:l.notify)!==!1&&(null==t||t([]),null==(a=e.onDiscountChange)||a.call(e,{discountList:[]}))}),eT=o3(e=>{let{currentSearchResults:t,cachedSearchResults:l}=e,i=et(),n=t;ea&&t.length>0&&a&&(n=ea.searchVoucherFormat({vouchers:t,orderTotalAmount:a,products:i}));let r=l||[];ea&&l&&l.length>0&&a&&(r=ea.searchVoucherFormat({vouchers:l,orderTotalAmount:a,products:i}));let o=emy([...r||[],...n],"id"),s=[],d=[];n.length>0&&n.forEach(e=>{eDA(e)?s.push(e):d.push(e)});let c=o.filter(e=>eDA(e)),u=o.filter(e=>!eDA(e));z(u);let p=[...A.current];return 1===s.length&&(p=[...A.current,...s],R.current=!0),C(c),m(u),en(p),E(p.map(e=>e.id)),1===s.length}),eI=o3(e=>{var l,i,a,r;T((null==Q||null==(i=Q.getOrderSnapshot)||null==(l=i.call(Q))?void 0:l.tempOrder)||{});let s=(null==e?void 0:e.walletRecommendList)||e_(),c=(null==e?void 0:e.userIdentificationCodes)||ew(),p=(null==J||null==(a=J.getStoredWalletInitData)?void 0:a.call(J))||{},f=(null==e?void 0:e.transformList)||p.transformList||c,y=(null==e?void 0:e.noApplicableVoucher)||p.noApplicableVoucher||[],b=(null==e?void 0:e.products)||p.products||[];(R.current||v.current.length>0)&&(s=es(s),c=es(c),f=es(f)),D.length>0&&(s=ed(s),c=ed(c),f=ed(f));let x=[...s,...c],_=R.current||D.length>0;if(o(s),d(c),u(f),m(y),q(b),g.current=x,L.current||_)if(_){let e=new Set(D);en(emy([...f,...N,...A.current],"id").filter(t=>e.has(t.id)))}else en([]),E([]),L.current=!1,null==t||t([]);else{en(s),E(s.map(e=>e.id));let e=((null==J||null==(r=J.formatWalletPassList2PreparePayments)?void 0:r.call(J,s))||[]).map(e=>({code:e.tag,voucher_id:e.voucher_id,amount:e.amount||0,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:e.wallet_pass_use_value}));null==n||n.addLog({type:"info",title:"useWalletPass_onOrderCreated onSelectChange 开始调用",metadata:{}}),null==t||t(e)}let w=em(e17(Q,b.length?b:F,k.current));h.current=w,G(w),$.current&&(null==H||H.success(eL.getText("wallet-pass-module-best-combination-selected"))),$.current=!1}),eP=o3(async e=>{var t,l,i,a;if(!(null==Q?void 0:Q.initWalletData))return;let n=Number((null==e?void 0:e.order_wait_pay_amount)??ee()),o=er(),s=D.length>0?Number((n+o).toFixed(2)):n;if(s<=0)return;let d=JSON.stringify({orderId:(null==Q||null==(l=Q.getTempOrder)||null==(t=l.call(Q))?void 0:t.order_id)||(null==Q||null==(a=Q.getOrderIdentity)||null==(i=a.call(Q))?void 0:i.orderId),customerId:X(),orderWaitPayAmount:s});if(x.current&&b.current===d)return x.current;if(b.current===d&&r.length>0)return;b.current=d,U(!0);let c=(async()=>{let t=await Q.initWalletData({...e,order_wait_pay_amount:s});return b.current===d&&eI(t),t})();x.current=c;try{return await c}finally{x.current===c&&(x.current=null),U(!1)}}),eA=(0,eC.useMemo)(()=>{var e,t,l,i;let a=(null==M||null==(e=M._extend)?void 0:e.customerSnapshot)||(null==M?void 0:M.customer)||(null==M||null==(t=M.original_order_data)?void 0:t.customer)||{};return oi((null==M?void 0:M.customer_id)||(null==M||null==(l=M.original_order_data)?void 0:l.customer_id)||(null==a?void 0:a.id)||(null==a?void 0:a.customer_id))?eL.getText("wallet-pass-module-customer-name-walk-in"):(null==a?void 0:a.display_name)||(null==a?void 0:a.name)||(null==M?void 0:M.customer_name)||(null==M||null==(i=M.original_order_data)?void 0:i.customer_name)||""},[M]);(0,eC.useEffect)(()=>{let e=X(),t=null==e||""===e?"":String(e);if(Q){if(w.current!==t&&(eM(),w.current=t),!t||oi(e))return void el();(async()=>{await ei()})()}},[Q,i,l,a]),(0,eC.useEffect)(()=>{if(!Q)return;let e=ee();e<=0||eP({order_wait_pay_amount:e})},[Q,i,l,a]);let eD=(0,eC.useMemo)(()=>[...s,...r,...[...N].reverse()],[r,s,N]);o3(()=>N.filter(e=>!A.current.some(t=>t.id===e.id)).map(e=>e.code));let eE=o3(e=>{var l;let i=(null==J||null==(l=J.formatWalletPassList2PreparePayments)?void 0:l.call(J,e))||[],a=[];return i.forEach(e=>{e.amount&&a.every(t=>t.voucher_id!==e.voucher_id)&&a.push({voucher_id:e.voucher_id,amount:e.amount,code:e.tag,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:e.wallet_pass_use_value})}),null==n||n.addLog({type:"info",title:"useWalletPass_notifySelectChange 通知外部选择变化",metadata:{selectedDetails:e,select:a}}),null==t?void 0:t(a)}),eO=o3(async(e,t)=>{var l,i;if(!(null==J?void 0:J.searchIdentificationCodeAsync))return null;let a=await J.searchIdentificationCodeAsync({code:e,prepare_payments:(null==(l=J.formatWalletPassList2PreparePayments)?void 0:l.call(J,ey))||[]}),n=eT({currentSearchResults:(null==a?void 0:a.data)||[],cachedSearchResults:N});return(null==t?void 0:t.waitForApply)&&n&&(null==(i=S.current)||i.call(S),j.current=!1,await new Promise(e=>{S.current=e})),a}),ez=o3(e=>{U(!0),R.current=!0;let t=D.filter(t=>!e.includes(t));if(t.length>0){let e=t.filter(e=>{let t=eg.find(t=>t.id===e);return(null==t?void 0:t.edit_current_amount)!==void 0});e.length>0&&(eY(e,{edit_current_amount:void 0}),v.current=v.current.filter(t=>!e.includes(t)))}E(e),en(eg.filter(t=>e.includes(t.id)))}),eR=(0,eC.useMemo)(()=>emy(eD,"id").filter(e=>e19(e)),[eD,B]),e$=(0,eC.useMemo)(()=>eDE(emy(eD,"id").filter(e=>e19(e)),[],{error:!0,showStatus:!1}),[eD]),eF=o3(async()=>{if(v.current.length>0&&(eY(v.current,{edit_current_amount:void 0}),v.current=[]),0!==B.length||0!==eu.length){if(U(!0),eu.length){var l,i,a;for(let e of(L.current=!0,eu))await (null==Q||null==(a=Q.setDiscountSelected)?void 0:a.call(Q,{discountId:e,isSelected:!1}));let t=(null==Q||null==(l=Q.getOrderProducts)?void 0:l.call(Q))||[],n={productList:t,discountList:e17(Q,t,k.current)},r=em(n.discountList);G(r),null==(i=e.onDiscountChange)||i.call(e,{...n,discountList:r}),U(!1);return}R.current=!0,en([]),E([]),null==n||n.addLog({type:"info",title:"useWalletPass_clearAllSelectedWallet 立即通知外部清空",metadata:{}}),null==t||t([]),U(!1)}}),eq=o3(()=>{if(0===r.length)return!0;let e=r.map(e=>e.id).sort(),t=B.sort();return JSON.stringify(e)===JSON.stringify(t)}),eB=o3(async()=>{null==n||n.addLog({type:"info",title:"useWalletPass_handleBestSaving 开始调用",metadata:{}}),U(!0);let t=!1,l=!1;if(ec.length){var i,a,o,s;t=!0,$.current=!0;let n=await (null==Q||null==(i=Q.bestDiscount)?void 0:i.call(Q)),r=(null==n?void 0:n.productList)||(null==Q||null==(a=Q.getOrderProducts)?void 0:a.call(Q))||[],d=em(e15((null==n?void 0:n.discountList)||(null==Q||null==(o=Q.getDiscountList)?void 0:o.call(Q))||[],r,k.current));G(d),null==(s=e.onDiscountChange)||s.call(e,{...n,discountList:d}),eDz(d.filter(e=>e.isSelected).map(e=>e.id),eu)&&($.current=!1,l=!0,U(!1),null==H||H.info(eL.getText("wallet-pass-module-already-best-combination")))}if(0===r.length){if((!t||t&&l)&&U(!1),N.length)if(eDz(B,N.map(e=>e.id)))null==H||H.info(eL.getText("wallet-pass-module-already-best-combination"));else{let e=N.filter(e=>eDA(e));en(e),E(e.map(e=>e.id)),e.length&&(null==H||H.success(eL.getText("wallet-pass-module-best-combination-selected")))}return}let d=!1,c=r;if(v.current.length>0&&(d=!0,c=eY(v.current,{edit_current_amount:void 0}).newWalletRecommendList,v.current=[]),eq()&&!d)t||null==H||H.info(eL.getText("wallet-pass-module-already-best-combination"));else{if(t&&!l)return;en(c),E(c.map(e=>e.id)),null==H||H.success(eL.getText("wallet-pass-module-best-combination-selected"))}U(!1)}),eH=o3(async(t,l)=>{U(!0);try{var i,a,n;let r=t.includes(l.id);await (null==Q||null==(i=Q.setDiscountSelected)?void 0:i.call(Q,{discountId:l.id,isSelected:r}));let o=(null==Q||null==(a=Q.getOrderProducts)?void 0:a.call(Q))||[],s={productList:o,discountList:e17(Q,o,k.current)},d=em(s.discountList);G(d),null==(n=e.onDiscountChange)||n.call(e,{...s,discountList:d})}finally{U(!1)}}),eV=o3(()=>{z([])}),eU=o3((e,t,l)=>{let i=Array.isArray(t)?t:[t];return e.map(e=>i.includes(e.id)?{...e,...l}:e)}),eY=o3((e,t)=>{let l=eU(r,e,t);o(l);let i=eU(s,e,t);d(i);let a=eU(c,e,t);u(a);let n=eU(N,e,t);C(n);let p=eU(I,e,t);return en(p),{newWalletRecommendList:l,newUserIdentificationCodes:i,newTransformList:a,newSearchIdentificationCodeList:n,newSelectedWallet:p}}),eW=o3((e,t,l)=>{0===e?ez(D.filter(e=>e!==l.id)):(U(!0),v.current.includes(l.id)||v.current.push(l.id),eY(l.id,{edit_current_amount:e}))});return{walletRecommendList:r,userIdentificationCodes:s,loading:V,error:Y,cardData:ex,handleSelectWallet:ez,selectedWalletIds:B,expiredWalletIds:eR,expiredWalletData:e$,disabledWalletData:O,clearAllSelectedWallet:eF,clearDisabledWalletData:eV,handleBeforeEditAmount:o3(async(e,t,l)=>!0),handleBestSaving:eB,handleSearchIdentificationCode:eO,availableDiscountList:ec,selectedDiscountList:eu,handleSelectDiscount:eH,customerName:eA,fetchUserIdentificationCodes:ek,getCachedWalletRecommendList:e_,getCachedUserIdentificationCodes:ew,clearWalletRecommendList:eS,clearUserIdentificationCodes:ej,clearAllCache:eN,handleConfirmEditAmount:eW}})({onSelectChange:a,customAmount:n,totalAmount:Number(null==i?void 0:i.totalAmount)||0,clientId:o,baseSales:s,onDiscountChange:d}),[C,M]=(0,eC.useState)(!1),[T,I]=(0,eC.useState)(!1),[P,A]=(0,eC.useState)(!0),D=o3(()=>{M(!0)}),E=o3(()=>{M(!1)}),O=o3(()=>{I(!1),f()}),z=o3(()=>{A(!P)}),L=o3((e,t)=>{}),R=eM().useMemo(()=>eDE(h||[],[],{error:!0,showStatus:!1}),[h]);(0,eC.useEffect)(()=>{h&&h.length>0&&!T&&I(!0)},[h,T]),(0,eC.useImperativeHandle)(t,()=>({handleSearchIdentificationCode:x,getWalletPassData:e=>({selectedWallet:e.length?u.filter(e=>p.includes(e.id)):[],availableDiscountList:k,selectedDiscountList:_})}));let $=(0,eC.useMemo)(()=>{if(h&&1===h.length){var e,t;return(null==(t=h[0])||null==(e=t.unified_messages)?void 0:e.title)||""}return eL.getText("wallet-pass-module-disabled-modal-title")},[h]),F=(0,eC.useMemo)(()=>p.length+_.length,[p.length,_.length]),q=(0,eC.useMemo)(()=>0===Number(null==i?void 0:i.totalAmount)||!!(null==r?void 0:r.some(e=>!ePw(e)&&!!eP_(e)&&!ePc.includes(e.code))),[r,i]);return 0===u.length&&0===k.length&&0===h.length?null:(0,eH.jsx)("div",{className:"wallet-pass-module-container",children:(0,eH.jsx)(nY.PisellLoading,{delay:300,loading:b,fullscreen:!1,mask:{backgroundColor:"rgba(255, 255, 255, 0.5)",width:"100%",height:"100%"},children:(0,eH.jsxs)("div",{className:"wallet-pass-module",children:[(0,eH.jsx)(e4t,{customerName:S,selectedCount:F,expiredCount:m.length,isCardMode:P,onExpiredClick:D,onBestSaving:y,onClearAll:v,onToggleDisplayMode:z}),(0,eH.jsx)(e4n,{isCardMode:P,cardData:u,selectedWalletIds:p,onSelectWallet:c,onDetail:L,onConfirmEditAmount:j,onBeforeEditAmount:N}),(0,eH.jsx)(e4d,{isCardMode:P,cardData:k,selectedWalletIds:_,onSelectWallet:w,onDetail:L,discountDisabled:q}),(0,eH.jsx)(e4r,{visible:C,walletData:g,onClose:E,title:null==(l=eL.getText("wallet-pass-module-expired-modal-title"))?void 0:l((null==g?void 0:g.length)||0)}),(0,eH.jsx)(e4r,{visible:T,walletData:R,onClose:O,title:$})]})})})}),e4h=(0,eC.forwardRef)((e,t)=>"shared"===e.mode?(0,eH.jsx)(e4m,{...e,ref:t}):(0,eH.jsx)(e4g,{...e,ref:t})),e4v=(0,eC.memo)(e4h),e4f={en:{"pisell2.text.others":"Others","pisell2.text.order-note":"Order Note","pisell2.text.print-receipt":"Print Receipt","pisell2.text.save-pay-later":"Save & Pay Later","pisell2.text.send-link":"Send Link","pisell2.text.manual-order-discount":"Manual Order Discount","pisell2.text.order-no-payment-required":"Order requires no payment, cannot manually adjust price","pisell2.text.order-no-payment-cannot-send-link":"Order requires no payment, cannot send payment link.","pisell2.text.additional-module.order-discount":"Order Discount"},"zh-CN":{"pisell2.text.others":"其他","pisell2.text.order-note":"订单备注","pisell2.text.print-receipt":"打印收据","pisell2.text.save-pay-later":"保存稍后支付","pisell2.text.send-link":"发送链接","pisell2.text.manual-order-discount":"手动订单折扣","pisell2.text.order-no-payment-required":"订单已无需支付,不可手动改价","pisell2.text.order-no-payment-cannot-send-link":"订单已无需支付,不可发送支付链接","pisell2.text.additional-module.order-discount":"订单折扣"},"zh-HK":{"pisell2.text.others":"其他","pisell2.text.order-note":"訂單備註","pisell2.text.print-receipt":"打印收據","pisell2.text.save-pay-later":"保存稍後支付","pisell2.text.send-link":"發送鏈接","pisell2.text.manual-order-discount":"手動訂單折扣","pisell2.text.order-no-payment-required":"訂單已無需支付,不可手動改價","pisell2.text.order-no-payment-cannot-send-link":"訂單已無需支付,不可發送支付鏈接","pisell2.text.additional-module.order-discount":"订单折扣"},ja:{"pisell2.text.others":"その他","pisell2.text.order-note":"注文メモ","pisell2.text.print-receipt":"領収書を印刷","pisell2.text.save-pay-later":"保存して後で支払う","pisell2.text.send-link":"リンクを送信","pisell2.text.manual-order-discount":"手動注文割引","pisell2.text.order-no-payment-required":"注文は支払い不要のため、手動で価格を変更できません","pisell2.text.order-no-payment-cannot-send-link":"注文は支払い不要のため、支払いリンクを送信できません","pisell2.text.additional-module.order-discount":"注文割引"},pt:{"pisell2.text.others":"Outros","pisell2.text.order-note":"Nota do Pedido","pisell2.text.print-receipt":"Imprimir Recibo","pisell2.text.save-pay-later":"Salvar e Pagar Depois","pisell2.text.send-link":"Enviar Link","pisell2.text.manual-order-discount":"Desconto Manual do Pedido","pisell2.text.order-no-payment-required":"O pedido n\xe3o requer pagamento, n\xe3o \xe9 poss\xedvel ajustar o pre\xe7o manualmente","pisell2.text.order-no-payment-cannot-send-link":"O pedido n\xe3o requer pagamento, n\xe3o \xe9 poss\xedvel enviar o link de pagamento.","pisell2.text.additional-module.order-discount":"Desconto do Pedido"}},e4y=function(e){let{orderInfo:t,customAmount:l,handleButtonClick:i,hasOrderNote:a=!1,disabled:n=!1,showCashPayment:r=!1,isFullWidth:o=!1,showMore:s=!0}=e;s2(e4f,eJ());let d=[{key:"send-link",label:eL.getText("pisell2.text.send-link"),icon:(0,eH.jsx)(jv,{})},{key:"print-receipt",label:eL.getText("pisell2.text.print-receipt"),icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-printer"})}],c=qR();return(0,eH.jsxs)("div",{className:"additional-module",children:[r&&(0,eH.jsx)("div",{className:"additional-module-title",children:eL.getText("pisell2.text.others")}),(0,eH.jsx)("div",{className:"additional-module-buttons-container",children:r&&!o?(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("div",{className:"additional-module-button-row",children:[(0,eH.jsxs)(eT.Button,{className:`additional-module-button-base purple-theme ${a?"note-button":""}`,onClick:()=>{i("order-note")},icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-clipboard-minus",className:"additional-module-button-icon"}),size:"large",children:[eL.getText("pisell2.text.order-note"),a&&(0,eH.jsx)("span",{className:"note-indicator",children:(0,eH.jsx)(nY.Icon,{type:"pisell2-info-circle2"})})]}),(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("split-payment")},icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-coins-01",className:"additional-module-button-icon"}),size:"large",children:eL.getText("split.payment")})]}),(0,eH.jsxs)("div",{className:"additional-module-button-row",children:[(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("manual-discount")},icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-sale-01",className:"additional-module-button-icon"}),size:"large",children:eL.getText("pisell2.text.additional-module.order-discount")}),(0,eH.jsx)(eT.Button,{className:`additional-module-button-base ${n?"disabled-theme":"orange-theme"}`,onClick:()=>{i("save-pay-later")},disabled:n,size:"large",icon:(0,eH.jsx)(he,{className:"additional-module-button-icon"}),children:eL.getText("pisell2.text.save-pay-later")}),s&&(0,eH.jsx)(eT.Dropdown,{menu:{items:d,onClick:e=>{let{key:t}=e;"send-link"===t?n?c.fail(eL.getText("pisell2.text.order-no-payment-cannot-send-link")):i("send-link"):"print-receipt"===t?i("print-receipt"):"split-payment"===t?i("split-payment"):"print-receipt"===t&&i("print-receipt")}},trigger:["click"],placement:"bottomLeft",overlayStyle:{zIndex:9999,pointerEvents:"auto"},mouseEnterDelay:.1,mouseLeaveDelay:.1,onOpenChange:e=>{},children:(0,eH.jsx)(eT.Button,{size:"large",className:"additional-module-button-base more-button",icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-dots-vertical",size:20})})})]}),!s&&(0,eH.jsxs)("div",{className:"additional-module-button-row",children:[(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("send-link")},disabled:n,size:"large",icon:(0,eH.jsx)(jv,{}),children:eL.getText("pisell2.text.send-link")}),(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("print-receipt")},disabled:n,size:"large",icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-printer"}),children:eL.getText("pisell2.text.print-receipt")})]})]}):(0,eH.jsxs)("div",{className:"additional-module-button-row",children:[(0,eH.jsxs)(eT.Button,{className:`additional-module-button-base purple-theme ${a?"note-button":""}`,onClick:()=>{i("order-note")},size:"large",icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-clipboard-minus",className:"additional-module-button-icon"}),children:[eL.getText("pisell2.text.order-note"),a&&(0,eH.jsx)("span",{className:"note-indicator",children:(0,eH.jsx)(nY.Icon,{type:"pisell2-info-circle2"})})]}),(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("split-payment")},size:"large",icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-coins-01",className:"additional-module-button-icon"}),children:eL.getText("split.payment")}),(0,eH.jsx)(eT.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("manual-discount")},icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-sale-01",className:"additional-module-button-icon"}),size:"large",children:eL.getText("pisell2.text.additional-module.order-discount")}),(0,eH.jsx)(eT.Button,{className:`additional-module-button-base ${n?"disabled-theme":"orange-theme"}`,onClick:()=>{i("save-pay-later")},disabled:n,size:"large",icon:(0,eH.jsx)(he,{className:"additional-module-button-icon"}),children:eL.getText("pisell2.text.save-pay-later")}),(0,eH.jsx)(eT.Dropdown,{menu:{items:d,onClick:e=>{let{key:t}=e;"send-link"===t?n?c.fail(eL.getText("pisell2.text.order-no-payment-cannot-send-link")):i("send-link"):"split-payment"===t?i("split-payment"):"print-receipt"===t&&i("print-receipt")}},trigger:["click"],placement:"bottomLeft",overlayStyle:{zIndex:9999,pointerEvents:"auto"},mouseEnterDelay:.1,mouseLeaveDelay:.1,onOpenChange:e=>{},children:(0,eH.jsx)(eT.Button,{className:"additional-module-button-base more-button",size:"large",icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-dots-vertical",size:20})})})]})})]})},e4b={paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"paid",colorClass:"paid",statusClassName:"success",autoClose:!0,maskClosable:!1},partially_paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"partial",colorClass:"partially-paid",statusClassName:"success",autoClose:!0,maskClosable:!1},deposit_paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"deposit",colorClass:"paid",statusClassName:"success",autoClose:!0,maskClosable:!1},failed:{titleKey:"payment.result.failed",fallbackTitle:"Payment Failed",subtitleMode:"amount_due",colorClass:"amount-due",statusClassName:"failed",autoClose:!1,maskClosable:!1},"wallet-pass-redemption-failed":{titleKey:"pisell2.checkout.wallet-pass.redemption-failed",fallbackTitle:"Wallet pass redeem failed",subtitleMode:"wallet_pass_partial",colorClass:"partially-paid",statusClassName:"wallet-pass-failed",autoClose:!1,maskClosable:!1}};function e4x(e,t){return t||(e?"error"===e?"failed":e in e4b?e:"paid":null)}function e4k(e){let{paymentStatus:t,resultKind:l,orderTotalAmount:i,gapAmount:a,depositAmount:n,changeGivenAmount:r,failureReason:o,isModalMode:s}=e,d=e4x(t,l);if(!d)return null;let c=e4b[d],u={autoClose:c.autoClose,autoCloseDelay:30,maskClosable:c.maskClosable};return s&&(u.autoClose=!1,u.autoCloseDelay=0,u.maskClosable=!1),{resultKind:d,statusClassName:c.statusClassName,paymentStatus:t||d,orderTotalAmount:Number(i||0),depositAmount:Number(n||0),changeGivenAmount:Number(r||0),gapAmount:"partially_paid"===d?Number(a||0):Number(r||0),failureReason:o,autoCloseConfig:u}}let e4_=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$";return lG(e,2,t)},e4w=async(e,t)=>{var l;let i,{paymentStatus:a,resultKind:n,orderTotalAmount:r,gapAmount:o,depositAmount:s,changeGivenAmount:d,failureReason:c,autoCloseConfig:u,actionButtons:p}=e,{getData:m,onToastClose:g}=t,h=eAk({status:"wallet-pass-redemption-failed"===e4x(a,n)?"wallet-pass-failed":eAx("deposit_paid"===n?"deposit_paid":a),paymentStatus:a,currencySymbol:(null==m?void 0:m("shop_symbol"))||"$",orderTotalAmount:r,changeGivenAmount:d,failureReason:c,summary:null,disableDetail:!0});return(null==(l=t.onResultViewModel)||l.call(t,h),"page"===t.paymentResultDisplayMode)?h:(i={...h,actionButtons:p||[],autoClose:(null==u?void 0:u.autoClose)||!1,autoCloseDelay:(null==u?void 0:u.autoCloseDelay)||10,showCountdownProgress:!!(null==u?void 0:u.autoClose),clickOutsideToClose:!!(null==u?void 0:u.autoClose),closable:!0,onClose:g||(()=>{})},Kl.addToast(i),h)},e4S=e=>(0,eH.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"currentColor",viewBox:"0 0 24 24",...e,children:(0,eH.jsx)("path",{fillRule:"evenodd",d:"M17.646 7.06A7.503 7.503 0 0 0 4.54 11.213 1 1 0 0 1 2.552 11 9.49 9.49 0 0 1 7.25 3.772c4.129-2.383 9.303-1.316 12.182 2.308l.109-.405a1 1 0 0 1 1.932.518l-.732 2.732a1 1 0 0 1-1.225.707L16.784 8.9a1 1 0 0 1 .518-1.932zm2.913 4.839a1 1 0 0 1 .889 1.1 9.49 9.49 0 0 1-4.698 7.228c-4.129 2.384-9.303 1.316-12.182-2.307l-.109.405a1 1 0 0 1-1.932-.518l.733-2.732a1 1 0 0 1 1.224-.707l2.732.732a1 1 0 0 1-.517 1.932l-.345-.093a7.502 7.502 0 0 0 13.105-4.152 1 1 0 0 1 1.1-.889",clipRule:"evenodd"})}),e4j=e=>(0,eH.jsx)(na,ak(ak({},e),{},{viewBox:(null==e?void 0:e.viewBox)||"0 0 24 24",component:e4S})),e4N={display:"flex",flexDirection:"column",minHeight:0,overflowY:"auto",maxHeight:"90%",padding:"0px 16px 16px"},e4C={list:[],pagination:{page:1,pageSize:20,total:0},hasMore:!1};function e4M(e){var t,l,i;if(!e)return e4C;let a=(null==(t=e.getCustomerState)?void 0:t.call(e))||{},n=(null==(l=e.getCustomers)?void 0:l.call(e))||[],r=a.customerList||a.list||a.customers||n,o=a.currentPage||a.page||1,s=a.pageSize||20,d=a.total??r.length;return{list:r,pagination:{page:o,pageSize:s,total:d},hasMore:"boolean"==typeof a.hasMore?a.hasMore:!!(null==(i=e.hasMoreCustomers)?void 0:i.call(e))}}let e4T=(0,eC.memo)(e=>{var t,l,i,a,n,r,o,s;let{disabledSwitch:d,clientInfo:c,onSearch:u,beginScanActivity:p,onClientChange:m,baseSales:g,baseSalesModuleName:h,enableScanner:v=!0,showCustomerSelect:f=!0}=e,[y,b]=(0,eC.useState)(!1),[x,k]=(0,eC.useState)(!1),[_,w]=(0,eC.useState)(!1),[S,j]=(0,eC.useState)(e4C),[N,C]=(0,eC.useState)(0),M=(0,eC.useRef)(null),T=(0,eC.useRef)(null),I=e$(),P=(0,nY.useToast)(),A=(0,eC.useMemo)(()=>{var e,t,l,i;return g||h&&(null==(i=I.appHelper)||null==(l=i.utils)||null==(t=l.pisellos)||null==(e=t.getModule)?void 0:e.call(t,h))||null},[h,null==(l=I.appHelper)||null==(t=l.utils)?void 0:t.pisellos,g]),D=(null==A||null==(i=A.getBookingConfig)?void 0:i.call(A))??null,E=null==D||null==(r=D.config)||null==(n=r.basic)||null==(a=n.appointment_subject)?void 0:a.form_id,O=(0,eC.useCallback)(e=>{var t;let l,i,a;j(e?(l=e4M(A),(a=Array.isArray(i=(null==e?void 0:e.data)??e)?i:Array.isArray(null==i?void 0:i.list)?i.list:Array.isArray(null==i?void 0:i.customerList)?i.customerList:Array.isArray(null==e?void 0:e.list)?e.list:Array.isArray(null==e?void 0:e.customerList)?e.customerList:[]).length?{...l,list:a,pagination:{...l.pagination,total:(null==e?void 0:e.total)??(null==e||null==(t=e.data)?void 0:t.total)??l.pagination.total}}:l):e4M(A))},[A]),z=(0,eC.useCallback)(()=>{C(e=>e+1)},[]),L=(0,eC.useMemo)(()=>{var e,t,l,i,a,n;return(null==c?void 0:c.id)||(null==c?void 0:c.customer_id)||(null==c?void 0:c.display_name)||(null==c?void 0:c.name)?c:(null==A||null==(e=A.getCustomer)?void 0:e.call(A))||(null==A||null==(t=A.getOrderCustomerSnapshot)?void 0:t.call(A))||(null==A||null==(n=A.getOrderSnapshot)||null==(a=n.call(A))||null==(i=a.tempOrder)||null==(l=i._extend)?void 0:l.customerSnapshot)||c||null},[A,c,N]),R=(0,eC.useCallback)(async e=>{var t,l,i,a,n,r,o,s;if(!(null==e?void 0:e.trim()))return;let c=null==p?void 0:p();if(p&&!c){null==(t=M.current)||t.setKeyword("");return}b(!0);try{let t=await (null==u?void 0:u(e));if(!((null==t?void 0:t.asset)||(Array.isArray(null==t?void 0:t.data)?t.data.length>0:!!(null==t?void 0:t.data)))){null==P||null==(i=P.info)||i.call(P,eL.getText("pisell2.checkout.wallet-pass-module.no-result"));return}if("type"in t&&"walletCode"==t.type){if(d){null==P||null==(r=P.info)||r.call(P,eL.getText("pisell2.checkout.client-card.tip.partially-paid"));return}let{customer:e,...l}=t.data;if(!e){null==P||null==(o=P.info)||o.call(P,eL.getText("pisell2.checkout.wallet-pass-module.no-result"));return}let i={...e,latest_wallet_detail:l};await (null==(n=T.current)||null==(a=n.handleSetClient)?void 0:a.call(n,i,{sameClientTip:eL.getText("pisell2.checkout.client-card.tip.same-client")}))}null==(l=M.current)||l.setKeyword("")}catch(t){let e=t instanceof Error?t.message:String(t||"");null==P||null==(s=P.error)||s.call(P,e||eL.getText("pisell2.checkout.wallet-pass-module.no-result"))}finally{b(!1),null==c||c()}},[P,p,d,u]);(0,eC.useEffect)(()=>{O(),z()},[O,z]),(0,eC.useEffect)(()=>{if(!(null==A?void 0:A.effectsOn))return;let e=A.effectsOn("onCustomerListUpdate",()=>{O()}),t=A.effectsOn("onCustomerListReset",()=>{O()}),l=A.effectsOn("onOrderCustomerChange",()=>{z()});return()=>{[e,t,l].forEach(e=>{var t;"function"==typeof e?e():null==e||null==(t=e.remove)||t.call(e)})}},[A,z,O]);let $=(0,eC.useMemo)(()=>{let e=(0,eH.jsx)(nY.Icon,{type:"pisell2-switch-horizontal-01",size:24,style:{color:"#667085"}}),t={buttonProps:{icon:e,size:"default"}};return!0===d&&(t={open:!1,buttonProps:{icon:e,size:"default",onClick:()=>{var e;null==P||null==(e=P.info)||e.call(P,eL.getText("pisell2.checkout.client-card.tip.partially-paid"))},style:{cursor:"not-allowed"}}}),t},[P,d]),F=(0,eC.useCallback)(async(e,t)=>{if(A){(null==t?void 0:t.showLoading)!==!1&&k(!0);try{var l;let i=A.resetAndLoadCustomers?await A.resetAndLoadCustomers({search:e||void 0,relation_form_id:(null==t?void 0:t.relation_form_id)??E??void 0}):await (null==(l=A.getCustomerList)?void 0:l.call(A,{search:e||void 0,relation_form_id:(null==t?void 0:t.relation_form_id)??E??void 0,skip:1,num:S.pagination.pageSize}));O(i)}finally{k(!1)}}},[A,S.pagination.pageSize,E,O]),q=(0,eC.useCallback)(async()=>{if(A&&!_){w(!0);try{var e;let t=await (null==(e=A.loadMoreCustomers)?void 0:e.call(A));O(t)}finally{w(!1)}}},[A,_,O]),B=(0,eC.useCallback)(async(e,t)=>{if(A){k(!0);try{var l;let i=await (null==(l=A.changeCustomerPage)?void 0:l.call(A,e,t));O(i)}finally{k(!1)}}},[A,O]),H=(0,eC.useCallback)(async e=>{var t,l,i,a,n;if(!A){null==m||m(e);return}e?(A.setOrderCustomer?A.setOrderCustomer(e):null==(a=A.updateTempOrderCustomer)||a.call(A,e),null==(i=A.setActiveCustomer)||i.call(A,e)):A.clearOrderCustomer?A.clearOrderCustomer():A.updateTempOrderCustomer?A.updateTempOrderCustomer({customer_id:null,customer_name:"",phone:"",email:""}):null==(n=A.setOrderCustomer)||n.call(A,null),e||null==(t=A.setActiveCustomer)||t.call(A,null),null==(l=A.updateTempOrderContactsInfo)||l.call(A,eCI(e)),z(),null==m||m(e)},[A,m,z]),V=(0,eC.useCallback)(e=>{var t;null==A||null==(t=A.addCustomerToFirst)||t.call(A,e),O()},[A,O]),U=(0,eC.useCallback)((e,t)=>{var l,i;let a=null==(i=I.appHelper)||null==(l=i.utils)?void 0:l.action,n=(null==e?void 0:e.id)??(null==e?void 0:e.customer_id);a&&n&&a({type:"pisell1.handleOpenCustomerModal",data:{id:n},callback:t})},[null==(s=I.appHelper)||null==(o=s.utils)?void 0:o.action]);return(0,eH.jsxs)("div",{className:"checkout-search-client-module",style:{display:"flex",gap:8},children:[(0,eH.jsx)(Zz,{ref:M,className:"checkout-search-client-module__find",displayType:"detached",triggerType:"input",searchMode:"confirm",showConfirmButton:!0,showHistory:!1,enableScanner:v,loading:y,placeholder:eL.getText("pisell2.checkout.search-section.placeholder"),onSearch:R,searchSectionProps:{style:{flex:1,minWidth:0},cameraButtonProps:{icon:["pisell2-camera-01","pisell2-qr-code-02"]},searchButtonProps:{placement:"inside",style:{height:36,padding:8,minWidth:76}}}}),f&&(0,eH.jsx)(eCR,{ref:T,value:L,list:S.list,loading:x,loadingMore:_,hasMore:S.hasMore,pagination:S.pagination,onSearch:F,onLoadMore:q,onChangePage:B,onSelect:H,onAddToFirst:V,onOpenCustomerDetail:U,readOnly:d,bookingConfig:D,clientCardProps:{style:{width:326,minHeight:48,height:48,padding:"4px 8px",borderColor:"#D0D5DD"},avatar:{size:"sm"},dropdown:$}})]})});function e4I(e,t){try{return{value:e(),error:null}}catch(e){return{value:t,error:e}}}let e4P=()=>void 0,e4A={display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto minmax(0, 1fr)",alignItems:"center",gap:12,width:"100%"},e4D={justifySelf:"start"},e4E={minWidth:0,textAlign:"center",fontSize:16,fontWeight:600,lineHeight:"24px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},e4O={justifySelf:"end",minWidth:0};function e4z(e){var t,l;let i=e4R(e.currencyAmount)??new lz(0),a=e4R(null==(t=e.walletPassUsageUnit)?void 0:t.points),n=e4R(null==(l=e.walletPassUsageUnit)?void 0:l.price);return!a||!n||a.eq(0)||n.eq(0)?lG(i.toNumber()):i.div(n).toDecimalPlaces(6,lz.ROUND_DOWN).mul(a).toFixed(2,lz.ROUND_DOWN)}function e4L(e){try{return new lz(e||0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}}function e4R(e){if(null==e)return null;try{return new lz(e)}catch{return null}}function e4$(e){let t=e4R(e);return(null==t?void 0:t.isFinite())?lz.max(t,0).toFixed(2):void 0}function e4F(e){let t=e4R(e);return!t||t.lte(0)?"":t.toDecimalPlaces(2).toFixed(2)}function e4q(e,t){return e4$((null==e?void 0:e.expectAmount)??(null==e?void 0:e.totalAmount)??(null==t?void 0:t.totalAmount))??"0.00"}function e4B(e,t){var l,i;let a=(null==e||null==(l=e.getOrderAmountSnapshot)?void 0:l.call(e))||{},n=(null==e||null==(i=e.getTempOrder)?void 0:i.call(e))||{};return e4$(a.depositAmount??n.deposit_amount??(null==t?void 0:t.depositAmount))??e4q(a,t)}function e4H(e){var t,l,i,a,n,r,o,s,d;let c=null==e||null==(t=e.getOrderSnapshot)?void 0:t.call(e),u=(null==e||null==(l=e.getOrderAmountSnapshot)?void 0:l.call(e))||(null==c?void 0:c.amount)||{},p=(null==c?void 0:c.identity)||{};if(!c&&!u)return null;let m=(null==c?void 0:c.tempOrder)||{},g=(null==m||null==(i=m._extend)?void 0:i.customerSnapshot)||(null==m?void 0:m.customer)||(null==c?void 0:c.customer)||null,h=m.customer_id??(null==g?void 0:g.id)??(null==g?void 0:g.customer_id)??(null==c||null==(a=c.customer)?void 0:a.customerId),v=(null==g?void 0:g.display_name)||(null==g?void 0:g.name)||m.customer_name||(null==c||null==(n=c.customer)?void 0:n.customerName)||"";return{orderId:p.orderId||p.externalSaleNumber||p.orderNumber,status:null==c?void 0:c.status,...eEZ(u,m),paymentStatus:null==c?void 0:c.paymentStatus,itemCount:(null==c?void 0:c.productCount)||(null==c||null==(o=c.tempOrder)||null==(r=o.products)?void 0:r.length)||0,hasLocalOrderData:!!(null==c?void 0:c.tempOrder),customerId:h,customerName:v,customerPhone:(null==g?void 0:g.phone)||m.phone||(null==c||null==(s=c.customer)?void 0:s.phone)||"",customerEmail:(null==g?void 0:g.email)||m.email||(null==c||null==(d=c.customer)?void 0:d.email)||"",customerSnapshot:g}}function e4V(e){let t=(null==e?void 0:e.submitResult)||e,l=e42(t);return(null==l?void 0:l.data)||(null==t?void 0:t.data)||l||{}}async function e4U(e){var t;await (null==e||null==(t=e.confirmPendingVoucherPayments)?void 0:t.call(e))}async function e4Y(e){var t;"function"==typeof(null==e?void 0:e.discardPendingVoucherPayments)?await e.discardPendingVoucherPayments():await (null==e||null==(t=e.updateVoucherOrderPayments)?void 0:t.call(e,[]))}async function e4W(e,t){var l;let i=(null==e?void 0:e.addOrderPaymentAsync)||(null==e?void 0:e.addOrderPayment);if("function"==typeof i)return null==(l=e.ensureOrderCreatedAt)||l.call(e),i.call(e,t)}async function e4K(e,t,l){let i=(null==e?void 0:e.updateVoucherOrderPaymentsAsync)||(null==e?void 0:e.updateVoucherOrderPayments);if("function"==typeof i)return i.call(e,t,l)}async function e4G(e,t){var l;return{success:!0,response:await (null==e||null==(l=e.submitSalesOrder)?void 0:l.call(e,{smallTicketDataFlag:1,...(null==t?void 0:t.confirmPendingVoucherPayments)!==void 0?{confirmPendingVoucherPayments:t.confirmPendingVoucherPayments}:{}}))}}async function e4Q(e){if("function"==typeof(null==e?void 0:e.confirmWalletPayment)){let t=await e.confirmWalletPayment();return{success:!0,response:null==t?void 0:t.submitResult,walletResult:t}}return await e4U(e),e4G(e,{confirmPendingVoucherPayments:!0})}async function e4Z(e,t){if("function"!=typeof(null==e?void 0:e.submitTempOrderAsync))return{success:!1,response:{status:!1,message:"当前订单提交能力不可用,请重启 APP 后再试"}};let l=await e.submitTempOrderAsync({smallTicketDataFlag:1,...(null==t?void 0:t.confirmPendingVoucherPayments)!==void 0?{confirmPendingVoucherPayments:t.confirmPendingVoucherPayments}:{}});return{success:!e4J(l),response:l}}function e4J(e){if(!(e=e42(e))||"object"!=typeof e)return!1;let t=void 0!==e.code&&200!==e.code&&"200"!==e.code,l=!1===e.status||"number"==typeof e.status&&e.status>=400,i=!1===e.success;return t||l||i}function e4X(e){var t,l,i,a,n,r,o;return(e=e42(e))&&"object"==typeof e?String(e.message||e.msg||e.error||(null==(t=e.data)?void 0:t.message)||(null==(l=e.data)?void 0:l.msg)||(null==(i=e.data)?void 0:i.error)||(null==(n=e.errors)||null==(a=n[0])?void 0:a.message)||(null==(o=e.errors)||null==(r=o[0])?void 0:r.msg)||""):""}function e40(e){var t,l,i,a,n;return(null==(e=e42(e))||null==(t=e.data)?void 0:t.order_id)||(null==e?void 0:e.order_id)||(null==e||null==(i=e.data)||null==(l=i.order)?void 0:l.order_id)||(null==e||null==(n=e.data)||null==(a=n.sales)?void 0:a.order_id)}function e42(e){return e&&"object"==typeof e&&e.data&&"object"==typeof e.data&&!e41(e)&&e41(e.data)?e.data:e}function e41(e){return!!e&&"object"==typeof e&&(void 0!==e.code||void 0!==e.status||void 0!==e.success||void 0!==e.message||void 0!==e.msg||void 0!==e.error||void 0!==e.errors)}function e44(e,t){let l=e42(e);return{code:null==l?void 0:l.code,status:null==l?void 0:l.status,success:null==l?void 0:l.success,message:e4X(l),response:l,rawResponse:e,payments:t}}async function e43(e,t,l){var i,a,n;let r=null==e||null==(i=e.getTempOrder)?void 0:i.call(e);await (null==e||null==(a=e.getSummary)?void 0:a.call(e));let o=t&&e4F(l)||"0.00";return"function"==typeof(null==e?void 0:e.updateTempOrderDepositAmount)&&await e.updateTempOrderDepositAmount(o),await (null==e||null==(n=e.saveDraft)?void 0:n.call(e)),r}async function e48(e,t){if("function"==typeof(null==e?void 0:e.updateTempOrderDepositAmount))return e.updateTempOrderDepositAmount(t)}let e46=(0,eC.forwardRef)((e,t)=>{var l,i,a,n,r,o;let{cartData:s,orderInfo:d,isModalOpen:c,onPaymentComplete:u,onPaymentCancel:p,onStatusChange:m,showingCashToastRef:g,onToastClose:h,orderNote:v,setOrderNote:f,setNoteModalSource:y,setNoteModalOpen:b,totalAmount:x=0,moduleConfig:k,onShowCashPaymentChange:_,showSuccessToast:w,dynamicMaxHeight:S="600px",onOrderSyncFailed:j,generateActionButtons:N,paymentResultToastConfig:C,updateOrderInfo:M,setCurrentEditOrderId:T,config:I,paymentResultDisplayMode:P,shopDiscount:A,client:D,currentTotalPrice:E,onChangeShopDiscount:O,onChangeOrderNote:z,onDeleteOrderNote:L,baseSales:R,walletPassMode:$="legacy",cardReaderDeviceNumber:F,cardReaders:q=[],setIsChangePaymentNotIncludeVoucher:B}=e,H=e$(),V=H.appHelper.utils||{},{getApp:U,pisellos:Y,getData:W,pisellosAllModule:K,interaction:G}=V,Q=(0,nY.useToast)(),Z=(0,eC.useRef)(null),J=(0,eC.useRef)(null),X=(0,eC.useRef)(null),[ee,et]=(0,eC.useState)(""),[el,ei]=(0,eC.useState)(""),[ea,en]=(0,eC.useState)(""),[er,eo]=(0,eC.useState)([]),[es,ed]=(0,eC.useState)(!1),ec=(0,eC.useRef)(null),[eu,ep]=(0,eC.useState)([]),[em,eg]=(0,eC.useState)(!1),[eh,ev]=(0,eC.useState)(!1),[ef,ey]=(0,eC.useState)(eL.getText("cards.and.digitals")||"Cards & Digitals"),eb=d2(),ex=(0,eC.useMemo)(()=>String((null==W?void 0:W("channel"))||"").trim().toLowerCase(),[W]),ek=function(e){let t=(0,eC.useRef)(),l=(0,eC.useRef)(!0),[i,a]=(0,eC.useState)(!1),[n,r]=(0,eC.useState)(!1),o=o3(i=>{if(!e)return e4P;if(t.current)return null;let n=Symbol(i);t.current={token:n,type:i},l.current&&(a("payment"===i),r("scan"===i));let o=!1;return()=>{var e;o||(o=!0,(null==(e=t.current)?void 0:e.token)===n&&(t.current=void 0,l.current&&(a(!1),r(!1))))}}),s=o3(()=>o("payment")),d=o3(()=>o("scan")),c=o3(()=>{var l;return e&&(null==(l=t.current)?void 0:l.type)==="payment"}),u=o3(()=>{var l;return e&&(null==(l=t.current)?void 0:l.type)==="scan"});return(0,eC.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]),(0,eC.useEffect)(()=>{e||(t.current=void 0,a(!1),r(!1))},[e]),(0,eC.useMemo)(()=>({tryBeginPayment:s,tryBeginScan:d,getIsPaymentProcessing:c,getIsScanProcessing:u,isPaymentProcessing:i,isScanProcessing:n}),[s,d,c,u,i,n])}("kiosk"===ex),e_=(0,eC.useRef)(),ew=eA0(null==(i=H.appHelper.utils)||null==(l=i.getApp)?void 0:l.call(i)),eS=(0,eC.useRef)(),ej=(0,eC.useMemo)(()=>eu.filter(e=>{var t;return("app"!==e.type||"EFTPOS_LINKLY"!==e.code)&&(null==(t=e.channel_application)?void 0:t.includes(ex))&&(["custom"].includes(e.type)||ePh.includes(e.code))}),[ex,eu]),eN=(0,eC.useMemo)(()=>ePT(eu,q,F||""),[F,q,eu]),eI=(0,eC.useRef)(!1),[eP,eA]=(0,eC.useState)(),eD=(0,eC.useRef)(null),eE=(0,eC.useRef)("0.00"),[eO,ez]=(0,eC.useState)([]),eR=(0,eC.useMemo)(()=>eO.reduce((e,t)=>{if(!ePS(t))return e;try{let l=new lz(t.amount||0),i=new lz(t.rounding_amount||0);return e.plus(l).plus(i)}catch{return e}},new lz(0)),[eO]),eF=(0,eC.useCallback)(e=>{try{return lz.max(new lz(e||0).minus(eR),0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}},[eR]),eq=(0,eC.useMemo)(()=>eF(ee||el||0),[el,ee,eF]),eB=(0,eC.useMemo)(()=>eF(el||0),[el,eF]),eV=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,eC.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.some(e=>!!e&&"voided"!==e.status&&((null==e?void 0:e.voucher_id)===void 0||0===Number(e.voucher_id)))})(e),[e]);return{isCustomerChangeLocked:t,canChangeCustomer:!t,shouldReloadWalletPassAfterCustomerChange:!t}}(eO),eU=(0,eC.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.some(e=>!!eP_(e)&&(null==e?void 0:e.order_payment_type)!=="deposit"&&(null==e?void 0:e.type)!=="deposit")})(eO),[eO]),[eY,eW]=(0,eC.useState)({}),[eK,eG]=(0,eC.useState)(!1),eZ=(0,eC.useMemo)(()=>!!eq&&0>=parseFloat(eq),[eq]),[eJ,eX]=(0,eC.useState)(!1),[e0,e2]=(0,eC.useState)(!1),e1=(null==I?void 0:I.enablePriceAdjust)!==!1,{runWithPermission:e4}=eQ({scopeKey:(null==d?void 0:d.orderId)??(null==d?void 0:d.uuid)??R,active:c,isAvailable:()=>e1}),[e3,e8]=(0,eC.useState)(),e6=eWG(),e5=o3(()=>{var e;null==Q||null==(e=Q.info)||e.call(Q,eL.getText("pisell2.checkout.scan-blocked-by-payment"))}),e7=o3(()=>{var e;null==Q||null==(e=Q.info)||e.call(Q,eL.getText("pisell2.checkout.payment-blocked-by-scan"))}),e9=o3(()=>{if(ek.getIsPaymentProcessing()||eK)return e5(),null;if(ek.getIsScanProcessing()){var e;return null==Q||null==(e=Q.info)||e.call(Q,eL.getText("pisell2.checkout.wallet-scan-processing")),null}return ek.tryBeginScan()}),te=o3((e,t)=>{var l;let i=e_.current;!i||t&&!i.source.startsWith(t)||i.deferRelease||(i.release(),null==e6||null==(l=e6.addLog)||l.call(e6,{type:"info",title:"Kiosk checkout payment activity finished",metadata:{reason:e,source:i.source}}))}),tt=o3(e=>{var t,l,i;if("kiosk"!==ex){let e=()=>void 0;return e.isActive=()=>!0,e}if(ek.getIsScanProcessing())return e7(),null;if(ek.getIsPaymentProcessing())return null==Q||null==(l=Q.info)||l.call(Q,eL.getText("payment.processing")),null;if(eK)return null==Q||null==(i=Q.info)||i.call(Q,eL.getText("payment.processing")),null;let a=ek.tryBeginPayment();if(!a)return null;let n=!1,r=()=>{var e;if(n)return;let t=e_.current;(null==t?void 0:t.release)===r&&t.deferRelease||(n=!0,(null==(e=e_.current)?void 0:e.release)===r&&(e_.current=void 0),a())};return r.isActive=()=>{var e;return!n&&(null==(e=e_.current)?void 0:e.release)===r},e_.current={release:r,source:e},null==e6||null==(t=e6.addLog)||t.call(e6,{type:"info",title:"Kiosk checkout payment activity started",metadata:{source:e}}),r});(0,eC.useEffect)(()=>{if(!c){var e;null==(e=eS.current)||e.release(),te("modal-closed")}},[c]),(0,eC.useEffect)(()=>()=>te("component-unmounted"),[]);let tl=W("shop_currency_code")||"USD",ti=W("bookingv2_deposit")||0,ta=null==R||null==(a=R.getOtherParams)?void 0:a.call(R),tn=exI({handle:R??null,scopeKey:JSON.stringify([(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),null==ta?void 0:ta.channel,null==ta?void 0:ta.shop_id,null==ta?void 0:ta.platform,null==ta?void 0:ta.cacheId]),active:!!c,ready:!!(null==R?void 0:R.getContactInfoConfig),order:(null==R||null==(n=R.getTempOrder)?void 0:n.call(R))??null,save:e=>R.updateTempOrderContactsInfo(e)}),tr=(0,eC.useRef)(!1),to=o3(async()=>{var e,t,l;if(tr.current)return!1;tr.current=!0;try{if((null==R?void 0:R.getContactInfoConfig)&&!await tn.runtime.ensureComplete())return!1;return await (null==R||null==(e=R.ensureSalesOrderReadyForPayment)?void 0:e.call(R)),await (null==R||null==(t=R.preparePickupTimingForCheckout)?void 0:t.call(R)),!0}catch(e){return null==Q||null==(l=Q.error)||l.call(Q,e instanceof Error?e.message:String(e)),!1}finally{tr.current=!1}}),ts=(0,eC.useCallback)(async()=>{"shared"===$&&(null==R?void 0:R.clearWalletAssetSelection)?await R.clearWalletAssetSelection():await e4Y(R)},[R,$]);(0,eC.useEffect)(()=>{c||(eI.current=!1,X.current=null,eE.current="0.00",eA(void 0))},[c]);let td=(0,eC.useMemo)(()=>{var e,t;if(eI.current)return eP??null;let l=(null==D?void 0:D.display_name)||(null==D?void 0:D.name)||(null==D?void 0:D.nickname);if((null==D?void 0:D.id)||(null==D?void 0:D.customer_id)||l)return D;let i=(null==d?void 0:d.customerSnapshot)||{},a=i.id??i.customer_id??(null==d?void 0:d.customerId),n=i.display_name||i.name||(null==d?void 0:d.customerName)||"",r=i.phone||(null==d?void 0:d.customerPhone)||"",o=i.email||(null==d?void 0:d.customerEmail)||"";return a||n||r||o?{...i,id:a,customer_id:a,display_name:n,name:i.name||n,phone:r,email:o,contacts:{...i.contacts||{},email:(null==(e=i.contacts)?void 0:e.email)||o,phone:(null==(t=i.contacts)?void 0:t.phone)||r}}:D},[D,null==d?void 0:d.customerEmail,null==d?void 0:d.customerId,null==d?void 0:d.customerName,null==d?void 0:d.customerPhone,null==d?void 0:d.customerSnapshot,eP]),tc=(0,eC.useMemo)(()=>({map:eu.reduce((e,t)=>(ePc.includes(t.code)&&(e[t.code]=t),e),{}),isShow:!0}),[eu]),tu=o3(()=>{let e=e4H(R);e&&(null==M||M(e),ei(e.remainingAmount||"0"),en(e.totalAmount||"0"),et(e.remainingAmount||"0"))}),tp=o3(async e=>{let t=e.payments??await th(),l=Array.isArray(t)?t.filter(e=>{let t=null==e?void 0:e.order_payment_id;return null==t||""===t||0===t}):t;return eA_({baseSales:R,status:e.status,payments:t,sessionPayments:l,currencySymbol:(null==W?void 0:W("shop_symbol"))||void 0,changeGivenAmount:e.changeGivenAmount,orderTotalAmount:e.orderTotalAmount,failureReason:e.failureReason,taxTitle:null==W?void 0:W("tax_title"),translationOriginal:null==V?void 0:V.translationOriginal,actionButtons:e.actionButtons,autoClose:e.autoClose,autoCloseDelay:60,displayMode:P,onClose:()=>{null==h||h()}})}),tm=o3(async e=>{var t,l,i,a,n,r,o,s;let d=null==R||null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),c=(null==(l=e.syncResult)?void 0:l.isOrderFullyPaid)??(null==(i=e.syncResult)?void 0:i.isFullyPaid),m="deposit_paid"===e.resultKind?"deposit_paid":c?"paid":"partially_paid",g=e4k({paymentStatus:m,resultKind:e.resultKind,orderTotalAmount:e.orderTotalAmount??((null==d?void 0:d.expectAmount)||x),depositAmount:e.depositAmount??(null==(a=e.syncResult)?void 0:a.depositAmount)??(null==d?void 0:d.depositAmount),gapAmount:null==d?void 0:d.amountGap,changeGivenAmount:e.changeGivenAmount,failureReason:e.failureReason,isModalMode:"modal"===P});if(!g)return;let h=e4H(R),v=null==h?void 0:h.orderId,f=await tp({status:eAx(m),changeGivenAmount:e.changeGivenAmount,payments:e.paymentItems,actionButtons:null==N?void 0:N(m,!1,v),autoClose:null==(n=g.autoCloseConfig)?void 0:n.autoClose,autoCloseDelay:null==(r=g.autoCloseConfig)?void 0:r.autoCloseDelay,orderTotalAmount:g.orderTotalAmount});u({response:null==(o=e.syncResult)?void 0:o.submitResult,paymentItems:e.paymentItems,orderPrintPayload:e.orderPrintPayload,paymentResultViewModel:f,toastInfo:{status:m,amount:g.orderTotalAmount,gapAmount:g.gapAmount,depositAmount:g.depositAmount,failureReason:e.failureReason}}),("paid"===m||"deposit_paid"===e.resultKind)&&(null==(s=e.syncResult)?void 0:s.submitResult)&&p(!0,!0)}),tg=o3(e=>{var t;let l=null==e?void 0:e[e.length-1],i=null==l||null==(t=l.metadata)?void 0:t.change_given_amount;if(null==i||""===i)return;let a=Number(i);return Number.isFinite(a)?a:void 0}),th=o3(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];try{var t;let e=await Promise.resolve(null==R||null==(t=R.getOrderPayments)?void 0:t.call(R));if(Array.isArray(e))return e}catch(e){console.warn("Failed to read latest baseSales payment items:",e)}return Array.isArray(e)?e:[]}),tv=o3(async e=>{var t,l,i;let a,n,r,o=(null==e?void 0:e.response)||e,s=e4V(o),d=(i=null==R||null==(l=R.getOrderIdentity)||null==(t=l.call(R))?void 0:t.orderId,n=(null==(a=e4V(o))?void 0:a.payment_info)||{},(r=(null==a?void 0:a.order_id)||(null==a?void 0:a.orderId)||i)?{type:"99",data:{order_id:r,machine_code_print_info:(null==n?void 0:n.machine_code_print_info)||(null==a?void 0:a.machine_code_print_info),small_ticket_data:(null==n?void 0:n.small_ticket_data)||(null==a?void 0:a.small_ticket_data),machine_code_print_info_v2:(null==n?void 0:n.machine_code_print_info_v2)||(null==a?void 0:a.machine_code_print_info_v2)}}:null);return u({response:o,paymentItems:await th(eO),orderPrintPayload:d,toastInfo:{status:null==s?void 0:s.payment_status,amount:Number((null==s?void 0:s.total_amount)||(null==s?void 0:s.expect_amount)||0),gapAmount:Number((null==s?void 0:s.amount_gap)||0)}}),d}),tf=o3(async e=>{var t,l,i,a,n,r,o,s,d,c;let p=e.forceUseParamsPayment&&Array.isArray(e.payments)?e.payments:await th(e.payments),m=null==(t=e.syncResult)?void 0:t.submitResult;if(e4J(m)){let t=e42(m),l=e4X(t)||eL.getText("pisell2.checkout.order-sync-failed");if(console.error(`[PaymentModal] Sales checkout backend rejected: ${l}`,e44(m,p)),Ki(),(null==I?void 0:I.keepOpenOnSyncFailure)===!0)return null==e6||null==(r=e6.addLog)||r.call(e6,{type:"error",title:"BaseSales payment sync rejected; waiting for kiosk retry",metadata:{error:l,response:t,payments:p}}),null==j||j(),null==Q||null==(o=Q.error)||o.call(Q,l),{ok:!1,syncResult:e.syncResult,response:t,message:l,kind:"backend-rejected"};if(e.rollbackPaymentIdentity&&(null==(s=R.deleteOrderPayment)||s.call(R,e.rollbackPaymentIdentity),ez(await th())),null==e6||null==(a=e6.addLog)||a.call(e6,{type:"error",title:"BaseSales payment sync rejected by backend",metadata:{error:l,response:t,payments:p}}),"page"===P){let e=await tp({status:"failed",failureReason:l,payments:p,orderTotalAmount:(null==(c=R.getOrderAmountSnapshot)||null==(d=c.call(R))?void 0:d.totalAmount)||x});u({paymentItems:p,paymentResultViewModel:e,response:t,toastInfo:{status:"failed",failureReason:l}})}return null==Q||null==(n=Q.error)||n.call(Q,l),{ok:!1,syncResult:e.syncResult,response:t,message:l,kind:"backend-rejected"}}let g=e4H(R);g&&(null==M||M(g),ei(g.remainingAmount||"0"),en(g.totalAmount||"0"),et(g.remainingAmount||"0"));let h=e.forceUseParamsPayment?p:await th(p);return ez(h),(null==(l=e.syncResult)?void 0:l.isDepositFullyPaid)&&!(null==(i=e.syncResult)?void 0:i.isOrderFullyPaid)||await tm({syncResult:e.syncResult,paymentItems:h,changeGivenAmount:e.changeGivenAmount??tg(h),orderPrintPayload:null,orderTotalAmount:e.orderTotalAmount}),{ok:!0,syncResult:e.syncResult}});(0,eC.useEffect)(()=>{let e;if("kiosk"===ex){try{let t=U(),l=t.applicationManager.get("global");e=null==l?void 0:l.runFunction("listenExternalCommand",{app:t,handler:async e=>{if("authorization_close"===e.command)return void te("authorization-closed","authorization:");if("payment_result"!==e.command)return;let t=e.params,i=e_.current;(null==i?void 0:i.source.startsWith("authorization:"))&&(i.deferRelease=!0);try{if((null==t?void 0:t.status)==="cancelled")return;let e=Array.isArray(null==t?void 0:t.payments)?t.payments:[];if(null==t?void 0:t.ok){var a,n,r;if((null==t||null==(a=t.syncResult)?void 0:a.isDepositFullyPaid)&&!(null==t||null==(n=t.syncResult)?void 0:n.isOrderFullyPaid))return;await tf({syncResult:t.syncResult,payments:e,changeGivenAmount:tg(e),forceUseParamsPayment:!0,orderTotalAmount:null==t||null==(r=t.syncResult)?void 0:r.orderExpectedAmount});return}await tb({error:(null==t?void 0:t.error)||Error(eL.getText("pisell2.checkout.order-sync-failed")),payments:e,changeGivenAmount:tg(e)})}finally{i&&e_.current===i&&(i.deferRelease=!1);try{l.runFunction("closeAuthorization")}finally{te("payment-result","authorization:")}}}})}catch(e){}return"function"==typeof e?e:void 0}},[]);let ty=o3(async e=>{var t;let l=await th(e.payments),i=e4H(R);i&&(null==M||M(i),ei(i.remainingAmount||"0"),en(i.totalAmount||"0"),et(i.remainingAmount||"0"));let a=await th(l);return ez(a),await tm({syncResult:e.syncResult,paymentItems:a,resultKind:"deposit_paid",depositAmount:e.depositAmount??(null==(t=e.syncResult)?void 0:t.depositAmount)??(null==i?void 0:i.depositAmount),changeGivenAmount:e.changeGivenAmount??tg(a),orderPrintPayload:null}),{ok:!0,syncResult:e.syncResult}}),tb=o3(async e=>{var t,l,i,a,n,r,o,s,d,c,p,m,g,h,v,f,y,b,k,_,w,S;let C,T,A,D,E=await th(e.payments),O=e42([null==(k=e.error)||null==(_=k.response)?void 0:_.data,null==k?void 0:k.data,null==k||null==(w=k.response)?void 0:w.body,null==k?void 0:k.body].find(e=>{let t=e42(e);return t&&"object"==typeof t&&(e4J(t)||e4X(t))})),z=!!O,L=!O&&(T=String((null==(S=e.error)?void 0:S.message)||S||"").toLowerCase(),A=String((null==S?void 0:S.code)||"").toLowerCase(),D=String((null==S?void 0:S.name)||"").toLowerCase(),["network","failed to fetch","load failed","timeout","timed out","请求超时","err_network","econnaborted","etimedout"].some(e=>T.includes(e)||A.includes(e)||D.includes(e))),$=z?e4X(O)||eL.getText("pisell2.checkout.order-sync-failed"):e.error instanceof Error?e.error.message:String(e.error);if((null==I?void 0:I.keepOpenOnSyncFailure)===!0)return Ki(),null==e6||null==(s=e6.addLog)||s.call(e6,{type:"error",title:"BaseSales payment sync failed; waiting for kiosk retry",metadata:{error:$,kind:z?"backend-rejected":null==(r=e.error)?void 0:r.kind,response:O||(null==(o=e.error)?void 0:o.response),payments:E}}),null==j||j(),null==Q||null==(d=Q.error)||d.call(Q,$),{ok:!1,error:e.error,message:$,response:O,kind:z?"backend-rejected":(null==(c=e.error)?void 0:c.kind)||"unknown"};if(z?(console.error(`[PaymentModal] Sales checkout backend rejected: ${$}`,e44(O,E)),Ki()):console.error("[PaymentModal] Sales checkout submit failed",e.error),L){let t=eL.getText("pisell2.checkout.order-saved-sync-later"),l=e4H(R);l&&(null==M||M(l),ei(l.remainingAmount||"0"),en(l.totalAmount||"0"),et(l.remainingAmount||"0"));let i=await th(E);ez(i),null==e6||null==(m=e6.addLog)||m.call(e6,{type:"info",title:"BaseSales payment saved locally, backend sync deferred",metadata:{error:e.error instanceof Error?e.error.message:String(e.error),kind:(null==(p=e.error)?void 0:p.kind)||"network-deferred",payments:i}}),null==Q||null==(g=Q.info)||g.call(Q,t);let a={isFullyPaid:!0,submitResult:{deferred_sync:!0,message:t}};return await tm({syncResult:a,paymentItems:i,changeGivenAmount:e.changeGivenAmount??tg(i),failureReason:t}),{ok:!0,syncResult:a,message:t,kind:"network-deferred"}}if(e.rollbackPaymentIdentity&&(null==(h=R.deleteOrderPayment)||h.call(R,e.rollbackPaymentIdentity),ez(await th())),null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"BaseSales payment sync failed",metadata:{error:$,kind:z?"backend-rejected":null==(t=e.error)?void 0:t.kind,response:O||(null==(l=e.error)?void 0:l.response),payments:E}}),!z||"page"===P){let e=e4k({paymentStatus:"failed",orderTotalAmount:(null==(f=R.getOrderAmountSnapshot)||null==(v=f.call(R))?void 0:v.totalAmount)||x,failureReason:$,isModalMode:"modal"===P});C=await tp({status:"failed",failureReason:$,actionButtons:(null==N?void 0:N("failed"))||[],autoClose:null==e||null==(y=e.autoCloseConfig)?void 0:y.autoClose,autoCloseDelay:null==e||null==(b=e.autoCloseConfig)?void 0:b.autoCloseDelay,orderTotalAmount:null==e?void 0:e.orderTotalAmount})}return"page"===P&&C&&u({error:e.error,paymentItems:E,paymentResultViewModel:C,toastInfo:{status:"failed",failureReason:$}}),null==Q||null==(a=Q.error)||a.call(Q,$),{ok:!1,error:e.error,message:$,response:O,kind:z?"backend-rejected":(null==(n=e.error)?void 0:n.kind)||"unknown"}});o3(async e=>{var t,l;if(!(null==R?void 0:R.syncPaymentsToOrder)){let e=Error("BaseSales syncPaymentsToOrder is not available");return console.error("[PaymentModal] Sales checkout submit failed",e),null==Q||null==(t=Q.error)||t.call(Q,e.message),{ok:!1,error:e,message:e.message,kind:"missing-api"}}let i=await th();try{let t=await (null==(l=R.syncPaymentsToOrder)?void 0:l.call(R,{payments:i,paymentStatus:"paid",submitWhenPaid:!0,smallTicketDataFlag:1}));if(!(null==e?void 0:e.handleResult))return{ok:!0,syncResult:t};return tf({syncResult:t,payments:i,changeGivenAmount:null==e?void 0:e.changeGivenAmount,rollbackPaymentIdentity:null==e?void 0:e.rollbackPaymentIdentity})}catch(t){if(!(null==e?void 0:e.handleResult))return{ok:!1,error:t,message:t instanceof Error?t.message:String(t),kind:(null==t?void 0:t.kind)||"unknown"};return tb({error:t,payments:i,changeGivenAmount:null==e?void 0:e.changeGivenAmount,rollbackPaymentIdentity:null==e?void 0:e.rollbackPaymentIdentity})}});let tx=o3(async()=>{var e;let t=await th();await (null==R||null==(e=R.syncPaymentsToOrder)?void 0:e.call(R,{payments:t,paymentStatus:"paid",submitWhenPaid:!0,smallTicketDataFlag:1}))});(0,eC.useEffect)(()=>{if(!(null==R?void 0:R.effectsOn)||!c)return;let e=R.effectsOn("onPaymentSyncStart",()=>{var e;eG(!0),null==Q||null==(e=Q.loading)||e.call(Q,"",0)}),t=R.effectsOn("onPaymentSyncEnd",async e=>{var t,l,i,a,n,r;try{null==(a=window)||null==(i=a.app)||i.applicationManager.get("global").runFunction("sendCommand",{app:null==(l=window)?void 0:l.app,command:"payment_result",params:e})}catch(e){}null==Q||null==(t=Q.hide)||t.call(Q),eG(!1);let o=Array.isArray(null==e?void 0:e.payments)?e.payments:[];if(null==e?void 0:e.ok){if((null==e||null==(n=e.syncResult)?void 0:n.isDepositFullyPaid)&&!(null==e||null==(r=e.syncResult)?void 0:r.isOrderFullyPaid))return;await tf({syncResult:e.syncResult,payments:o,changeGivenAmount:tg(o)});return}await tb({error:(null==e?void 0:e.error)||Error(eL.getText("pisell2.checkout.order-sync-failed")),payments:o,changeGivenAmount:tg(o)})}),l=R.effectsOn("onDepositPaymentSyncEnd",async e=>{var t;null==Q||null==(t=Q.hide)||t.call(Q),eG(!1);let l=Array.isArray(null==e?void 0:e.payments)?e.payments:[];(null==e?void 0:e.ok)&&await ty({syncResult:e.syncResult,payments:l,depositAmount:null==e?void 0:e.depositAmount,changeGivenAmount:tg(l)})});return()=>{var i;null==e||e(),null==t||t(),null==l||l(),null==Q||null==(i=Q.hide)||i.call(Q),eG(!1)}},[R,c,Q,tg,tf,ty,tb]);let tk=e=>{var t;let l,i=Number(e);return!!Number.isFinite(i)&&!!(i>0)||(l=eL.getText("pisell2.checkout.payment.invalid-positive-amount")||"Please pay an amount greater than 0",(null==Q?void 0:Q.fail)?Q.fail(l):null==Q||null==(t=Q.error)||t.call(Q,l),!1)},t_=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=e4H(R),i=new lz(eF((null==l?void 0:l.remainingAmount)??"0")),a=new lz(e||0).minus(t||0);return!(i.lte(0)||a.lte(0)||a.gt(i.plus("0.01")))||(tu(),!1)},tw=o3(async()=>{let e=await th();return ez(e),e}),tS=o3(async function(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof(null==R?void 0:R.deleteOrderPayment))throw Error("当前订单不支持删除 EFTPOS 待确认支付项,请重启 APP 后再试");if(R.deleteOrderPayment(e),await tw(),!1===l.persistDraft)return;let i=await (null==R||null==(t=R.saveSalesOrderDraft)?void 0:t.call(R));if(e4J(i))throw Error(e4X(i)||eL.getText("pisell2.checkout.order-sync-failed")||"EFTPOS 待确认支付项保存失败,请重试")}),tj=o3(async(e,t)=>{var l,i,a,n,r,o;if(!tk(t))return null;let s="",d=!1,c=[];null==Q||null==(l=Q.loading)||l.call(Q,"",0);try{if("function"!=typeof(null==R?void 0:R.addOrderPaymentAsync)&&"function"!=typeof(null==R?void 0:R.addOrderPayment)||"function"!=typeof(null==R?void 0:R.saveSalesOrderDraft))throw Error(eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");c=await th();let l=await e4W(R,{amount:t,code:e.code,custom_payment_id:e.id,name:e.name,custom_payment_type:e.type,voucher_id:"",service_charge:(null==e?void 0:e.is_surcharge)&&((null==e?void 0:e.fixed)!==void 0||(null==e?void 0:e.percentage)!==void 0)?{amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"}:{},status:"payment_pending",metadata:{transactions:[]}});d=!0,Array.isArray(l)&&ez(l);let n=Array.isArray(l)?l[l.length-1]:void 0;if(!(s=String((null==n?void 0:n.payment_number)||"").trim()))throw Error("EFTPOS 待确认支付项缺少 payment_number,请重启 APP 后再试");let r=await (null==R||null==(i=R.saveSalesOrderDraft)?void 0:i.call(R));if(e4J(r))throw Error(e4X(r)||eL.getText("pisell2.checkout.order-sync-failed")||"EFTPOS 待确认支付项保存失败,请重试");return null==Q||null==(a=Q.hide)||a.call(Q),{paymentNumber:s,draftResult:r}}catch(t){if(d)try{s?await tS(s,{persistDraft:!1}):"function"==typeof(null==R?void 0:R.setOrderPayments)&&(R.setOrderPayments(c),await tw())}catch(e){console.error("Failed to rollback pending EFTPOS payment:",e)}let e=t instanceof Error?t.message:String(t);return null==e6||null==(n=e6.addLog)||n.call(e6,{type:"error",title:"EFTPOS pending payment draft failed",metadata:{error:e,paymentNumber:s}}),null==Q||null==(r=Q.hide)||r.call(Q),null==Q||null==(o=Q.error)||o.call(Q,e),null}}),tN=o3(async e=>{var t,l;let i=null==(t=e.transactionNumber)?void 0:t.trim();if(!i)throw Error("EFTPOS 回调缺少交易号,支付项保持待确认状态");let a={...e.updates||{},status:"paid",metadata:{...(null==(l=e.updates)?void 0:l.metadata)||{},unique_payment_number:i,transactions:[{number:i,status:"success"}]}};if("function"!=typeof(null==R?void 0:R.updateOrderPayment))throw Error("当前订单不支持更新 EFTPOS 支付状态,请重启 APP 后再试");let n=await R.updateOrderPayment(e.paymentNumber,a,{persistDraft:!0,submitWhenPaid:!0});return Array.isArray(null==n?void 0:n.payments)?ez(n.payments):await tw(),null==B||B(!0),n}),tC=o3((e,t)=>{var l,i;let a=e instanceof Error?e.message:String(e);null==e6||null==(l=e6.addLog)||l.call(e6,{type:"error",title:"EFTPOS payment update failed",metadata:{error:a,paymentNumber:t}}),null==Q||null==(i=Q.error)||i.call(Q,a)}),tM=async e=>{var t,l,i,a;let n=tt("cash");if(n)try{if(!tk(e.amount)||!await to()||!n.isActive()||!t_(e.amount,e.roundingAmount))return;let i=(null==W?void 0:W("channel"))||"pos",a=`cash-${Date.now()}-${Math.random().toString(16).slice(2)}`,r=eu.find(e=>{var t,l;return((null==(t=e.name)?void 0:t.toLowerCase().includes("cash"))||/现金|現金/i.test(e.name))&&(null==(l=e.channel_application)?void 0:l.includes(i))});eWZ(e6,W,"cash-local-add",()=>({paymentChannel:ex,currentChannel:i,osKey:eb,...eWQ(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,paymentMethodId:null==r?void 0:r.id,paymentMethodCode:null==r?void 0:r.code,uniquePaymentNumber:a})),null==e6||e6.addLog({type:"info",title:"open_till",metadata:{}}),null==G||null==(l=G.utils)||null==(t=l.postMessageToApp)||t.call(l,{module:"till",key:"open_till",data:{type:"cash"}}),null==B||B(!0),await e4W(R,{amount:e.amount,code:null==r?void 0:r.code,custom_payment_id:null==r?void 0:r.id,name:null==r?void 0:r.name,custom_payment_type:null==r?void 0:r.type,voucher_id:0,rounding_amount:e.roundingAmount,metadata:{unique_payment_number:a,actual_paid_amount:e.actual_paid_amount??e.amount,change_given_amount:e.change||0}})}catch(l){let t=l instanceof Error?l.message:String(l);null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"Cash payment failed",metadata:{error:t,result:e}}),null==Q||null==(a=Q.error)||a.call(Q,t)}finally{n()}},tT=e=>{if("string"==typeof e){let t=e.match(/\d+(?:\.\d+)?/);return t?t[0]:void 0}return"number"==typeof e?String(e):e},tI=(null==(o=H.appHelper.utils)||null==(r=o.getApp)?void 0:r.call(o)).getPlugin("screenProtector"),tP=async e=>{var t,l,i,a,n,r,o,s,d,c,u,m,g,h,v,f,y,b,x,k,_,w,S,j,N,C,M,T,I;let P;if(eK)return;if(eA2()){null==Q||null==(t=Q.info)||t.call(Q,eL.getText("payment.processing"));return}let A=ePg.includes((null==e?void 0:e.code)||""),D=A?eA1():null;if(A&&!D)return;let E=tt(`payment:${(null==e?void 0:e.code)||"unknown"}`);if(!E){null==D||D.release();return}let O=()=>{try{E()}finally{null==D||D.release()}};O.isActive=()=>((null==D?void 0:D.isActive())??!0)&&E.isActive();let z=!1,L=!1,$=e=>{let t;return function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t??(t=Promise.resolve().then(async()=>{let t=null==P?void 0:P.hold();try{await e(...i)}finally{try{null==t||t(),await (null==P?void 0:P.release())}finally{O()}}})),t}};try{let{id:t,code:T,name:I,type:A}=e||{},D=e.totalAmount??eq;if(!await to()||!O.isActive()||!t_(eq))return;let E=ePm.includes(T||""),q=ePg.includes(T||"");if(E||q){if(eS.current=P=ew(),await P.pause(),!P.isActive()||!O.isActive())return;null==R||null==(l=R.ensureOrderCreatedAt)||l.call(R);let j=q?"mx51":"eftpos",N=null==(a=H.appHelper.utils)||null==(i=a.getApp)?void 0:i.call(a),C=!!(null==H||null==(s=H.appHelper)||null==(o=s.utils)||null==(r=o.businessUtils)||null==(n=r.isPiPaymentEnabled)?void 0:n.call(r)),M=ePy((null==e?void 0:e.code)||"",C),E=!!M;if(!E&&q){null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_start_spi",metadata:{timestamp:Date.now()}});let l=await tj(e,D);if(!l)return;let{paymentNumber:i,draftResult:a}=l;if(!P.isActive())return void await tS(i);let n=(null==R||null==(v=R.getOrderIdentity)||null==(h=v.call(R))?void 0:h.externalSaleNumber)||(null==(f=e4V(a))?void 0:f.external_sale_number),r=null==R||null==(b=R.getOrderIdentity)||null==(y=b.call(R))?void 0:y.orderId,o=ec.current;if(!o)return void await tS(i);let s=await o.onPay(j,{isActive:()=>O.isActive()&&!!(null==P?void 0:P.isActive()),source:"normal",data:{payMethod:{id:t,code:T,name:I,type:A},params:{salesId:n,orderId:r,paymentNumber:i,symbol:W("shop_symbol"),amount:D,surcharge:tT(e.surcharge)},mode:"pay"},callback:$(async l=>{let{status:a,data:n,msg:r}=l;if((null==n?void 0:n.action)==="cancel_order"){await tS(i),p(!0);return}if("success"!==a)return;let o={amount:Number(null==n?void 0:n.amount),code:T,custom_payment_id:t,name:I,custom_payment_type:A,voucher_id:"",service_charge:{},metadata:{unique_payment_number:null==n?void 0:n.uniquePaymentNumber}};Number((null==n?void 0:n.surcharge)||0)!==Number((null==e?void 0:e.surcharge)||0)?o.service_charge={amount:(null==n?void 0:n.surcharge)||"0",percentage:"0"}:o.service_charge={amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"},tk(o.amount)&&(null==B||B(!0),await tN({paymentNumber:i,transactionNumber:null==n?void 0:n.uniquePaymentNumber,updates:o}))})});s||await tS(i),z=s;return}if(!E){let l=JSON.parse((null==N||null==(k=N.storage)||null==(x=k.getStorage)?void 0:x.call(k,"account"))||"{}"),i=null==R||null==(w=R.getOrderIdentity)||null==(_=w.call(R))?void 0:_.orderId;if(!i||"string"==typeof i&&i.startsWith("LOCAL_")){let e;null==Q||null==(S=Q.loading)||S.call(Q,"",0);try{e=await e4Z(R)}catch(e){null==Q||Q.error(e instanceof Error?e.message:eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null==e?void 0:e.success)||e4J(null==e?void 0:e.response)){null==Q||Q.error(e4X(null==e?void 0:e.response)||eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(i=e40(null==e?void 0:e.response))){null==Q||Q.error(eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}}null==Q||Q.hide();let a=ec.current;if(!a||!P.isActive())return;z=await a.onPay(j,{isActive:()=>O.isActive()&&!!(null==P?void 0:P.isActive()),source:"normal",data:{payMethod:{id:t,code:T,name:I,type:A},params:{orderId:i,symbol:W("shop_symbol"),amount:D,surcharge:tT(e.surcharge),operator_id:null==l?void 0:l.id,operator_type:"shop",platform:ex||"pos"},mode:"pay"},callback:$(async e=>{let{status:l,data:i,msg:a}=e;if("success"!==l)return;let n={amount:D,code:T,custom_payment_id:t,name:I,custom_payment_type:A,voucher_id:"",service_charge:{percentage:null==i?void 0:i.surPercentRate,amount:null==i?void 0:i.surMoney},metadata:{unique_payment_number:null==i?void 0:i.uniquePaymentNumber,manual_marking_flag:null==i?void 0:i.manual_marking_flag}};tk(n.amount)&&(null==B||B(!0),await e4W(R,n))})});return}null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_start",metadata:{timestamp:Date.now()}});let L=await tj(e,D);if(!L)return;let{paymentNumber:V,draftResult:U}=L,Y=(null==R||null==(c=R.getOrderIdentity)||null==(d=c.call(R))?void 0:d.externalSaleNumber)||(null==(u=e4V(U))?void 0:u.external_sale_number),K=JSON.parse((null==N||null==(g=N.storage)||null==(m=g.getStorage)?void 0:m.call(g,"account"))||"{}"),G=eAW({baseSales:R,salesId:String(Y||""),paymentNumber:V});if(!Y||!ec.current){if(Y)await G.finalize();else throw Error("支付草稿缺少订单标识,请刷新订单后重试");return}if(!O.isActive()||!P.isActive())return void await G.finalize();null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_end",metadata:{timestamp:Date.now()}}),ec.current.openPi({provider:M,mode:"pay",amount:D,salesId:String(Y),paymentNumber:V,currency:W("shop_symbol"),deviceNumber:F,metadata:{payMethod:{id:t,code:T,name:I,type:A},symbol:W("shop_symbol"),payment_number:V},operator:{id:null==K?void 0:K.id,type:"shop"},..."kiosk"===ex?{slots:{failed:(0,eH.jsx)(eT.Button,{block:!0,type:"primary",className:"pi-payment-action-button",onClick:()=>p(!0,!1,"start-new-order"),style:{marginTop:"10px"},children:eL.getText("order.start-new-order")})}}:{},platform:ex||"pos",usageScene:ePp.includes(ex)?"merchant":"user",onChange:async e=>{if(!G.observe(e))return;let t=null==P?void 0:P.hold(),l="success"===e.type||"closed"===e.type||"printOnTimeout"===e.type;try{var i,a,n,r,o;let t=e.transactionNumber;if("printOnTimeout"===e.type){if(await e4G(R,{confirmPendingVoucherPayments:!0}),!(null==R?void 0:R.printLocalOrderReceipt))return;null==e6||null==(i=e6.addLog)||i.call(e6,{type:"info",title:"eftpos支付异常,请求本地打印小票"});try{let e=await R.printLocalOrderReceipt();null==e6||null==(a=e6.addLog)||a.call(e6,{type:"info",title:"eftpos支付异常,请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==e6||null==(n=e6.addLog)||n.call(e6,{type:"error",title:"eftpos支付异常,请求本地打印小票失败",metadata:{error:e instanceof Error?e.message:String(e)}})}p(!0),N.history.replace("/home")}if("success"===e.type||"failed"===e.type){if("success"!==e.type)return;let l=e.amount||D,i={percentage:(null==(r=e.surcharge)?void 0:r.ratePercent)?new lz(e.surcharge.ratePercent).div(100).toString():void 0,amount:null==(o=e.surcharge)?void 0:o.fixedAmount},a={amount:l,service_charge:i,service_fee:function(e,t){if(t)try{return new lz(e||0).times(t.percentage||0).plus(t.amount||0).toDecimalPlaces(2).toFixed(2)}catch{return}}(l,i),metadata:{manual_marking_flag:e.manuallyConfirmed?1:void 0,card_reader_snapshot:e.readerSnapshot}};await tN({paymentNumber:V,transactionNumber:t,updates:a});return}"closed"===e.type&&(await G.finalize(),await tw())}catch(e){tC(e,V)}finally{null==t||t(),l&&(await (null==P?void 0:P.release()),O())}}})?z=!0:(await G.finalize(),await tw())}else{await (null==tI||null==(j=tI.pauseIdleTimer)?void 0:j.call(tI)),L=!0;let t=null;if(((null==e?void 0:e.fixed)||(null==e?void 0:e.percentage))&&(t={amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"}),!tk(D))return;"custom"===e.type&&(null==(N=e.metadata)?void 0:N.order_open_cash_drawer)&&(null==e6||e6.addLog({type:"info",title:"open_till",metadata:{}}),null==G||null==(M=G.utils)||null==(C=M.postMessageToApp)||C.call(M,{module:"till",key:"open_till",data:{type:"cash"}})),null==B||B(!0),eWZ(e6,W,"method-local-add",()=>({paymentChannel:ex,osKey:eb,...eWQ(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,paymentMethodId:e.id,paymentMethodCode:e.code,paymentMethodType:e.type})),await e4W(R,{amount:D,code:e.code,custom_payment_id:e.id,name:e.name,custom_payment_type:e.type,voucher_id:0,service_charge:t,..."custom"===e.type?{metadata:{unique_payment_number:`custom-${Date.now()}-${Math.random().toString(16).slice(2)}`}}:{}})}}catch(e){null==Q||null==(T=Q.error)||T.call(Q,e instanceof Error?e.message:String(e))}finally{if(L)try{await (null==tI||null==(I=tI.resumeIdleTimer)?void 0:I.call(tI))}catch(e){console.warn("[Payment] resume screen protector failed",e)}if(!z)try{await (null==P?void 0:P.release())}finally{O()}}};(0,eC.useEffect)(()=>{var e,t,l,i,a;if(R&&d&&c)try{null===X.current&&(eE.current=e4B(R,d));let a=e4H(R),n=(null==a?void 0:a.remainingAmount)??(null==R||null==(t=R.getOrderAmountSnapshot)||null==(e=t.call(R))?void 0:e.amountGap)??ee??"0";if(n){et(n),ei(n),en(d.totalAmount||"0");let e=null==R||null==(l=R.getTempOrderNote)?void 0:l.call(R);e?f(e):(null==s||null==(i=s.order_info)?void 0:i.order_note)&&f(s.order_info.order_note)}}catch(e){console.warn("Failed to get initial custom amount:",e)}R&&c&&Promise.resolve((null==R||null==(a=R.getOrderPayments)?void 0:a.call(R))||[]).then(e=>{ez(e)})},[R,d,c]),(0,eC.useEffect)(()=>{if(!R||!c)return void eg(!1);let e=!1;return eg(!1),R.getPaymentMethodsAsync().then(async t=>{if(e)return;let l=await ePN(t,G);if(e)return;ep(l),eg(!0);let i=t.some(e=>{var t;return"CASHMANUAL"===e.code||/现金|現金/i.test(e.name)||/cash/i.test(e.name)&&(null==(t=e.channel_application)?void 0:t.includes(ex))});ev(i),null==_||_(i),i||ey(eL.getText("pisell2.checkout.payment.select-payment")||"Select Payment")}),()=>{e=!0}},[R,G,c,_,ex]),(0,eC.useEffect)(()=>{if(eq&&R&&tl&&d&&c)try{let e;eo([e=Number(eq||0),10*Math.ceil(e/10),20*Math.ceil(e/20)].filter((e,t,l)=>e>0&&l.indexOf(e)===t))}catch(e){console.warn("Failed to get recommended amounts:",e)}},[eq,R,tl,d]);let tA=(0,eC.useCallback)(async e=>{if(R)try{et(e)}catch(e){console.error("Failed to set custom amount:",e)}},[R]),tD=(0,eC.useCallback)(async e=>{if(R)try{if(e){var t;let e=e4F(eE.current)||e4F(e4B(R,d))||e4q(null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),d);eE.current=e}X.current=e,await e43(R,!!+!!e,eE.current),tu()}catch(e){console.error("Failed to update deposit status:",e)}},[R,tu]),tE=(0,eC.useCallback)(async e=>{if(R)try{await e48(R,e),eE.current=e,tu()}catch(e){console.error("Failed to update deposit amount:",e)}},[R]),[tO,tz]=(0,eC.useState)(!1),tL=async e=>{if("cancel"===e)return;let t=tt("wallet-confirm");if(!t)return;let l=!0;tz(!0);try{if(!await to()||!t.isActive())return;"save-without-deduct"===e&&(l=!1,await ts());let n=l?await e4Q(R):await e4G(R,{confirmPendingVoucherPayments:!1});if(n.success&&await tv(n),await (null==w?void 0:w({...n})),n.success){var i,a;let e=e4H(R),t=(null==n||null==(a=n.response)||null==(i=a.data)?void 0:i.order_id)||(null==n?void 0:n.orderId);if(null==T||T(t),(null==n?void 0:n.is_deposit)&&e&&Number(e.depositAmount)<Number(e.totalAmount)){null==M||M(e);return}p(!0)}}catch(e){console.error("Failed to submit base sales order:",e)}finally{tz(!1),t()}},tR=(0,eC.useCallback)(async e=>{if("cancel"===e||!await to())return;let t=!0;"apply-deduct-now"===e?await e4U(R):"save-without-deduct"===e&&(t=!1,await ts()),R&&(await e4G(R,{confirmPendingVoucherPayments:t}),p(!0))},[ts,R,p,to]),t$={showCustomerModule:(null==I?void 0:I.showCustomerModule)??!0,showCustomerSelect:(null==I?void 0:I.showCustomerSelect)??!0,showWalletPass:(null==I?void 0:I.showWalletPass)??tc.isShow,showCashPayment:(null==I?void 0:I.showCashPayment)??(null==k?void 0:k.showCashPayment)??!0,showAdditionalModule:(null==I?void 0:I.showAdditionalModule)??!0,showPaymentOptions:(null==I?void 0:I.showPaymentOptions)??!0},tF=t$.showCashPayment&&eh,tq=(0,eC.useRef)();(0,eC.useEffect)(()=>{if(!c){tq.current=void 0;return}if(em)try{let e={paymentChannel:ex,dataChannel:(null==W?void 0:W("channel"))??null,osKey:eb,...eWQ(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,showCashPayment:tF,showCustomerSelect:t$.showCustomerSelect,showPaymentType:(null==I?void 0:I.showPaymentType)!==!1,directCustomPayment:(null==I?void 0:I.directCustomPayment)===!0},t=JSON.stringify(e);if(tq.current===t)return;tq.current=t,eWZ(e6,W,"ui-ready",()=>e)}catch{}});let tB=(null==I?void 0:I.paymentOptionsColumnCount)??(tF?1:2),tH="kiosk"===ex&&(eK||ek.isScanProcessing||ek.isPaymentProcessing),tV=o3(async e=>{if(eD.current)return"kiosk"!==ex?eD.current.handleSearchIdentificationCode(e):eD.current.handleSearchIdentificationCode(e,{waitForApply:!0})});(0,eC.useEffect)(()=>{let e=!1;return(async()=>{var t,l,i,a;if(!R)return e8(void 0);let n=null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),r=null==n||null==(l=n.summary)?void 0:l.product_expect_amount;try{let e=await (null==(i=R.getSummary)?void 0:i.call(R));r=(null==e?void 0:e.product_expect_amount)??(null==e||null==(a=e.summary)?void 0:a.product_expect_amount)??r}catch(e){console.error("Failed to read BaseSales summary:",e)}e||e8(r)})(),()=>{e=!0}},[R,e0,null==d?void 0:d.totalAmount,ea]);let tU=(0,eC.useMemo)(()=>Number(e3??E??(null==d?void 0:d.totalAmount)??0),[e3,E,null==d?void 0:d.totalAmount]),tY=(0,eC.useMemo)(()=>new lz(tU).minus(A||0).toNumber(),[A,tU]),tW=o3(async e=>{var t,l,i,a,n,r,o;if("shared"===$){ez((null==R||null==(t=R.getOrderPayments)?void 0:t.call(R))||[]),tu(),eD.current&&eW(eD.current.getWalletPassData(e));return}if(tc.isShow){let t=[],s=(null==R||null==(l=R.getOrderPayments)?void 0:l.call(R))||[],d=(null==(n=eD.current)||null==(a=n.getWalletPassData)||null==(i=a.call(n,e))?void 0:i.selectedWallet)||[];if(e.forEach(e=>{let l=e.code?ePu[e.code]:null;if(l&&tc.map[l]){let i=tc.map[l],a="payment_pending",n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,l=arguments.length>2?arguments[2]:void 0;return e.find(e=>(null==e?void 0:e.voucher_id)!==void 0&&0!==Number(e.voucher_id||0)&&String(e.voucher_id)===String(t)&&String(e.status||"")===String(l||""))}(s,e.voucher_id,a),r=d.find(t=>{var l;return String((null==t?void 0:t.id)??(null==t||null==(l=t.originData)?void 0:l.id))===String(e.voucher_id)}),o=(null==r?void 0:r.originData)||r||e,c=e4z({currencyAmount:e.amount,walletPassUsageUnit:e.wallet_pass_usage_unit});t.push({...n,amount:e.amount,code:null==i?void 0:i.code,id:Number(null==i?void 0:i.id)||0,name:null==i?void 0:i.name,type:null==i?void 0:i.type,status:a,custom_payment_id:Number(null==i?void 0:i.id)||0,voucher_id:e.voucher_id,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:c,fund_record:function(e){var t,l;let{item:i,originData:a,paymentMethod:n}=e,r="point_card"===i.code||(null==a?void 0:a.tag)==="point_card"||(null==n?void 0:n.code)==="POINTCARD",o=(null==a?void 0:a.balance_par_value)??(null==a?void 0:a.balance)??(null==a?void 0:a.using_before_value)??0,s=i.wallet_pass_use_value??e4z({currencyAmount:i.amount,walletPassUsageUnit:i.wallet_pass_usage_unit}),d=r?s:i.amount,c=(()=>{try{return new lz(o||0).minus(d||0)}catch{return new lz(0)}})();return{voucher_id:i.voucher_id,wallet_pass_name:(t=(null==a?void 0:a.wallet_pass_name)||(null==a?void 0:a.format_title)||(null==a?void 0:a.product_name),l=null==n?void 0:n.name,t&&"object"==typeof t&&!eM().isValidElement(t)?t:{default:t||l||""}),code:(null==a?void 0:a.code)||i.code,encoded:null==a?void 0:a.encoded,using_before_value:e4L(o),using_after_value:e4L(c)}}({item:{...e,wallet_pass_use_value:c},originData:o,paymentMethod:i})})}}),null==e6||e6.addLog({type:"info",title:"handleSelectWalletChange BaseSales updateVoucherOrderPayments",metadata:{voucherItems:t,select:e}}),"function"!=typeof(null==R?void 0:R.updateVoucherOrderPaymentsAsync)&&"function"!=typeof(null==R?void 0:R.updateVoucherOrderPayments)){null==e6||null==(o=e6.addLog)||o.call(e6,{type:"error",title:"BaseSales updateVoucherOrderPayments is not available",metadata:{voucherItems:t,select:e}});return}await e4K(R,t,{status:"payment_pending"}),ez((null==(r=R.getOrderPayments)?void 0:r.call(R))||[]),tu(),eD.current&&eW(eD.current.getWalletPassData(e))}}),tK=o3(e=>{if(tu(),eD.current){let t=eD.current.getWalletPassData([]);eW(l=>{var i;return{...l,availableDiscountList:t.availableDiscountList,selectedDiscountList:(null==e||null==(i=e.discountList)?void 0:i.filter(e=>e.isSelected&&!e.isEditMode).map(e=>e.id))||t.selectedDiscountList}})}}),tG=async e=>{if(!e1)return void e2(!1);try{if(R&&(null==d?void 0:d.totalAmount)){var t;await (null==(t=R.updateTempOrderShopDiscount)?void 0:t.call(R,e)),null==O||O(e),await R.getSummary();let l=e4H(R);l&&(null==M||M(l),ei((null==l?void 0:l.remainingAmount)||"0"),en((null==l?void 0:l.totalAmount)||"0"),et((null==l?void 0:l.remainingAmount)||"0"))}}catch(e){console.error("Failed to adjust price:",e)}e2(!1)},tQ=o3(async()=>{var e;if(!e1)return;if(!(null==d?void 0:d.totalAmount)){null==Q||Q.fail(eL.getText("pisell2.checkout.manual-discount.no-amount"));return}let t=await Promise.resolve((null==R||null==(e=R.getOrderPayments)?void 0:e.call(R))||[]);if(null==t?void 0:t.length){null==Q||Q.fail(eL.getText("pisell2.checkout.manual-discount.has-payment-items"));return}if(0>=Number(eq)&&Number(null==d?void 0:d.totalAmount)>=0){null==Q||Q.fail(eL.getText("pisell2.checkout.manual-discount.no-amount"));return}e2(!0)}),tZ=async e=>{var t,l,i,a;switch(e){case"order-note":b(!0);break;case"send-link":eX(!0);break;case"split-payment":ed(!0);break;case"print-receipt":if(!(null==R?void 0:R.printLocalOrderReceipt))return;null==e6||null==(t=e6.addLog)||t.call(e6,{type:"info",title:"支付弹窗请求本地打印小票"});try{let e=await R.printLocalOrderReceipt();null==e6||null==(l=e6.addLog)||l.call(e6,{type:"info",title:"支付弹窗请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"支付弹窗请求本地打印小票失败",metadata:{error:e instanceof Error?e.message:String(e)}})}break;case"manual-discount":await e4("discount",tQ);break;case"save-pay-later":null==(a=J.current)||a.handleSavePayLaterClick()}};(0,eC.useImperativeHandle)(t,()=>({handleButtonClick:tZ,getSyncingLock:()=>eK,retryPaymentSync:tx}),[tZ,tx,eK]);let tJ=()=>{var e;let t=e=>null!=e&&""!==String(e).trim()?String(e).trim():null,l=t(null==td?void 0:td.display_name)||t(null==td?void 0:td.name)||eL.getText("pisell2.checkout.customer.default-name")||"Customer";return{id:(null==td?void 0:td.id)??(null==td?void 0:td.customer_id),nickname:(null==td?void 0:td.nickname)||eL.getText("pisell2.checkout.customer.default-name"),display_name:l,email:(null==td?void 0:td.email)||(null==td||null==(e=td.contacts)?void 0:e.email)||""}},tX=async e=>{var t,l,i,a,n,r,o;let s;if(!await to())return;let d=null==R||null==(l=R.getOrderIdentity)||null==(t=l.call(R))?void 0:t.orderId;await ts(),null==Q||null==(i=Q.loading)||i.call(Q,"",0);try{s=await e4Z(R,{confirmPendingVoucherPayments:!1})}catch(e){null==Q||Q.error(e instanceof Error?e.message:eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null==s?void 0:s.success)||e4J(null==s?void 0:s.response)){null==Q||Q.error(e4X(null==s?void 0:s.response)||eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null!=(o=d=e40(null==s?void 0:s.response)||(null==R||null==(n=R.getOrderIdentity)||null==(a=n.call(R))?void 0:a.orderId)||d)&&""!==String(o).trim()&&!("string"==typeof o&&/^LOCAL_/i.test(o.trim())))){null==Q||Q.error(eL.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}null==Q||null==(r=Q.hide)||r.call(Q);let c=await R.sendCustomerPayLink({emails:e.emails,order_ids:[d]});c.success||c.status?(null==Q||Q.success(eL.getText("pisell2.checkout.send-payment-link.success")),setTimeout(()=>{null==p||p(!0)},1e3)):null==Q||Q.error(c.message||eL.getText("pisell2.checkout.send-payment-link.error"))},t0=(0,eC.useCallback)(e=>{eI.current=!0,eA(e??null),eW({selectedWallet:[],availableDiscountList:[],selectedDiscountList:[]}),ts().then(async()=>{var e,t;"shared"===$&&await (null==R||null==(t=R.refreshWalletAssets)?void 0:t.call(R,{preserveSelection:!1})),ez((null==R||null==(e=R.getOrderPayments)?void 0:e.call(R))||[]),tu()}).catch(e=>{console.error("Failed to clear wallet pass payments:",e)});let t=e4H(R);t&&(null==M||M(t),ei(t.remainingAmount||"0"),en(t.totalAmount||"0"),et(t.remainingAmount||"0"))},[ts,R,tu,M,$]),t2=(0,eC.useMemo)(()=>({disabledSwitch:(null==I?void 0:I.disabledSwitchClient)||!!R&&eV.isCustomerChangeLocked}),[R,I,eV.isCustomerChangeLocked]),t1=(0,eC.useCallback)(async e=>{var t;return await (null==R||null==(t=R.roundAmount)?void 0:t.call(R,{amount:e}))},[R]),t4=(0,eC.useCallback)(e=>{"modal"!==P&&Kl.clearAll()},[]);return(0,eH.jsxs)("div",{ref:Z,...{onClick:t4},style:{...e4N,maxHeight:S},children:[(t$.showCustomerModule||t$.showCustomerSelect||t$.showWalletPass)&&(0,eH.jsxs)("div",{style:{padding:"12px 16px",border:"1px solid #d0d5dd",borderRadius:8},children:[(t$.showCustomerModule||t$.showCustomerSelect)&&(0,eH.jsx)(e4T,{onClientChange:t0,clientInfo:td,onSearch:tV,baseSales:R,showCustomerSelect:t$.showCustomerSelect,...t2,beginScanActivity:"kiosk"===ex?e9:void 0}),t$.showWalletPass&&(0,eH.jsx)(e4v,{clientId:(null==td?void 0:td.id)??(null==td?void 0:td.customer_id),customAmount:el,orderInfo:d||void 0,ref:eD,paymentItems:eO,onSelectChange:tW,baseSales:R,onDiscountChange:tK,mode:$})]}),(0,eH.jsx)(e11,{amountSymbol:W("shop_symbol"),orderInfo:d||void 0,cartData:s,open_deposit:!!ti&&(null==I?void 0:I.enableDepositSwitch)!==!1,customAmount:ee,balanceDueAmount:el,paymentItems:eO,walletPassData:eY,clientInfo:D,onAmountChange:tA,onDepositStatusChange:tD,onDepositAmountChange:tE,onBalanceDueAmountClick:tZ,onConfirm:tL,confirmLoading:tO,totalAmount:x,baseSales:R,shouldUseNormalPayment:eU,enablePriceAdjust:e1,showPaymentType:(null==I?void 0:I.showPaymentType)!==!1}),(0,eH.jsxs)("div",{className:tF?"payment-grid-layout":"payment-flex-layout",children:[tF&&(0,eH.jsx)("div",{"aria-disabled":tH,style:{...tF?{gridColumn:"1",gridRow:(null==ej?void 0:ej.length)===1?"span 2":"1"}:{},...tH?{opacity:.6,pointerEvents:"none"}:{}},children:(0,eH.jsx)(eD1,{disabled:eZ,isModalOpen:c,syncingLock:eK||tH,amountSymbol:W("shop_symbol"),orderInfo:d||void 0,onPaymentComplete:tM,amountButtons:er,customAmount:eq,roundingFunction:t1,balanceDueAmount:eB,balanceDueTotalAmount:ea,shortcutsSize:(null==ej?void 0:ej.length)===3||(null==ej?void 0:ej.length)===1?"large":"default"})}),t$.showPaymentOptions&&(null==ej?void 0:ej.length)>0&&(0,eH.jsx)("div",{className:tF?"":"payment-options-module-container",style:tF?{gridColumn:"2",gridRow:(null==ej?void 0:ej.length)>3?"1 / 3":"1"}:{},children:(0,eH.jsx)(eWX,{amountSymbol:W("shop_symbol"),orderInfo:d||void 0,onClick:tP,paymentMethods:eu,customAmount:eq,title:ef,disabled:eZ||tH,showCashPayment:tF,channel:ex,columnCount:tB,sciSurchargeDisplayMap:eN,directCustomPayment:(null==I?void 0:I.directCustomPayment)===!0,isModalOpen:c,paymentMethodsReady:em,beginKioskPaymentActivity:tt,currentBaseSales:R,autoTriggerSinglePaymentOption:(null==I?void 0:I.autoTriggerSinglePaymentOption)===!0})}),t$.showAdditionalModule&&(0,eH.jsx)("div",{className:tF?"":"additional-module-container",style:tF?{gridColumn:(null==ej?void 0:ej.length)>3?"1":(null==ej?void 0:ej.length)<=1?"2":"span 2",gridRow:(null==ej?void 0:ej.length)===0?"1":"2"}:{},children:(0,eH.jsx)(e4y,{orderInfo:d||void 0,customAmount:eq,handleButtonClick:tZ,hasOrderNote:!!v&&v.trim().length>0,disabled:eZ,showCashPayment:tF,isFullWidth:!((null==ej?void 0:ej.length)>3||(null==ej?void 0:ej.length)<=1),showMore:!(tF&&(null==ej?void 0:ej.length)===0)})})]}),(0,eH.jsx)(eAJ,{ref:ec,baseSales:R,dynamicMaxHeight:S,isWebPos:!0}),eJ&&(0,eH.jsx)(e1Q,{balanceAmount:ee,customerEmail:tJ().email,customerName:tJ().display_name||tJ().nickname,customerId:tJ().id,onClose:()=>eX(!1),sendPaymentLink:tX}),e1&&(0,eH.jsx)(dU,{containerProps:{wrapClassName:"pisell-modal-mask-pointer-events-auto",renderType:"modal",open:e0,onCancel:()=>e2(!1)},tips:eL.getText("pisell2.checkout.modal.price-adjustment-tips")||"Changing amount will update order total",selectType:"dark",originalValue:tU,defaultValue:tY,resetText:eL.getText("pisell2.checkout.modal.reset-price-adjustment"),onEnter:tG}),tn.editor,(0,eH.jsx)(e14,{ref:J,amountSymbol:W("shop_symbol"),walletPassData:eY,onSavePayLater:tR}),(0,eH.jsx)(ePJ,{containerProps:{wrapClassName:"pisell-modal-mask-pointer-events-auto",renderType:"modal",open:es,onCancel:()=>ed(!1)},paymentOriginalValue:eB,paymentDefaultValue:String(eq||0),enableExceedMaxAmount:!1,payment:{enable:!0},surcharge:{enable:!1},surchargeDefaultValue:{percent:"0",fixed:"0"},selectType:"light",onChange:e=>{},doneText:eL.getText("confirm")||"确认",onPay:e=>{ed(!1);let t=Number(e.amount);if(!Number.isFinite(t)||t<=0){var l;null==Q||null==(l=Q.error)||l.call(Q,eL.getText("pisell2.checkout.split-payment.invalid-positive-amount"));return}tA(String(t))}})]})}),e45=e=>{var t,l,i,a,n,r,o,s;let{open:d,baseSales:c,baseSalesModuleName:u,walletPassMode:p="legacy",data:m,callback:g,onClose:h,onSetLocalOrderId:v,setEditCartMode:f,editOrderId:y,paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,variant:N,config:C={showHeaderCenter:!0,showHeaderRightButton:!0}}=e,M=e$();s2(W9,(null==(n=M.appHelper.utils)||null==(a=n.getApp)||null==(i=a.call(n))||null==(l=i.locales)||null==(t=l.getLocale)?void 0:t.call(l))||(null==(o=M.appHelper.utils)||null==(r=o.storage)?void 0:r.get("umi_locale"))||"en");let{getApp:T,pisellos:I,getData:P,interaction:A,isWebPos:D}=(null==M||null==(s=M.appHelper)?void 0:s.utils)||{},E=function(e){let{baseSales:t,pisellos:l,baseSalesModuleName:i}=e,[a,n]=(0,eC.useState)(0),r=(0,eC.useMemo)(()=>{var e;return t||i&&(null==l||null==(e=l.getModule)?void 0:e.call(l,i))||null},[i,l,t,a]),o=(0,eC.useMemo)(()=>e4I(()=>{var e;return(null==r||null==(e=r.getOrderSnapshot)?void 0:e.call(r))||null},null),[r,a]),s=o.value,d=(0,eC.useMemo)(()=>e4I(()=>{var e;return(null==r||null==(e=r.getOrderAmountSnapshot)?void 0:e.call(r))||(null==s?void 0:s.amount)||null},null),[r,s,a]),c=d.value,u=(0,eC.useMemo)(()=>e4I(()=>{var e,t;return(null==r||null==(e=r.getOrderPayments)?void 0:e.call(r))||(null==s||null==(t=s.tempOrder)?void 0:t.payments)||[]},[]),[r,s,a]),p=u.value,m=(0,eC.useCallback)(()=>{n(e=>e+1)},[]),g=o.error||d.error||u.error||(i&&!r?Error(`BaseSales module not found: ${i}`):null),h=(0,eC.useMemo)(()=>(function(e,t){var l,i,a,n,r,o,s;if(!e&&!t)return null;let d=(null==e?void 0:e.identity)||{},c=t||(null==e?void 0:e.amount)||{},u=(null==e?void 0:e.tempOrder)||{},p=(null==u||null==(l=u._extend)?void 0:l.customerSnapshot)||(null==u?void 0:u.customer)||(null==e?void 0:e.customer)||null,m=u.customer_id??(null==p?void 0:p.id)??(null==p?void 0:p.customer_id)??(null==e||null==(i=e.customer)?void 0:i.customerId),g=(null==p?void 0:p.display_name)||(null==p?void 0:p.name)||u.customer_name||(null==e||null==(a=e.customer)?void 0:a.customerName)||"";return{orderId:d.orderId||d.externalSaleNumber||d.orderNumber,status:null==e?void 0:e.status,...eEZ(c,u),paymentStatus:null==e?void 0:e.paymentStatus,itemCount:(null==e?void 0:e.productCount)||(null==e||null==(r=e.tempOrder)||null==(n=r.products)?void 0:n.length)||0,hasLocalOrderData:!!(null==e?void 0:e.tempOrder),customerId:m,customerName:g,customerPhone:(null==p?void 0:p.phone)||u.phone||(null==e||null==(o=e.customer)?void 0:o.phone)||"",customerEmail:(null==p?void 0:p.email)||u.email||(null==e||null==(s=e.customer)?void 0:s.email)||"",customerSnapshot:p}})(s,c),[s,c]);return{baseSales:r,orderSnapshot:s,amountSnapshot:c,paymentItems:p,orderInfo:h,error:g,refresh:m}}({baseSales:c,pisellos:I,baseSalesModuleName:u}),O=E.baseSales,z=!!u,[L,R]=(0,eC.useState)(null);(0,eC.useRef)(!1);let[$,F]=(0,eC.useState)(""),[q,B]=(0,eC.useState)([]),H=(0,eC.useRef)(!1),V=(0,eC.useRef)(null),[U,Y]=(0,eC.useState)(0),W=(0,eC.useMemo)(()=>Number((null==L?void 0:L.totalAmount)??U??0),[null==L?void 0:L.totalAmount,U]),[K,G]=(0,eC.useState)(!0),[Q,Z]=(0,eC.useState)(0),[J,X]=(0,eC.useState)(!1),[ee,et]=(0,eC.useState)(!1),[el,ei]=(0,eC.useState)(!1),[ea,en]=(0,eC.useState)(y||0),er=(0,nY.useToast)(),eo=d1(),es=eM().useRef(null);(0,eC.useEffect)(()=>{if(z){if(E.error){var e;null==er||null==(e=er.error)||e.call(er,E.error.message);return}if(E.orderInfo){let e=Number(E.orderInfo.totalAmount||0);R(e=>{var t,l,i,a;return(null==e?void 0:e.orderId)===(null==(t=E.orderInfo)?void 0:t.orderId)&&(null==e?void 0:e.totalAmount)===(null==(l=E.orderInfo)?void 0:l.totalAmount)&&(null==e?void 0:e.remainingAmount)===(null==(i=E.orderInfo)?void 0:i.remainingAmount)&&(null==e?void 0:e.paymentStatus)===(null==(a=E.orderInfo)?void 0:a.paymentStatus)?e:E.orderInfo}),Y(t=>t===e?t:e)}}},[z,E.error,E.orderInfo,er]);let ed=async()=>{if(!ee){et(!0);try{var e,t;await (null==(t=eA.current)||null==(e=t.retryPaymentSync)?void 0:e.call(t))}catch(e){console.error("PaymentModal retry payment sync failed",e)}finally{et(!1)}}};(0,eC.useEffect)(()=>{let e=()=>{"u">typeof window&&Z(window.innerHeight)};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[]),(0,eC.useEffect)(()=>{var e;let t=async()=>{try{var e,t;let l=await (null==A||null==(t=A.utils)||null==(e=t.asyncDataManager)?void 0:e.call(t,{module:"get",key:"till_button"}));l&&Kl.setTillButton(l)}catch(e){console.error("PaymentModal: Failed to get till_button from asyncDataManager:",e)}};(null==A||null==(e=A.utils)?void 0:e.asyncDataManager)&&t()},[A]),(0,eC.useEffect)(()=>{!d||H.current||V.current||(V.current=(async()=>{try{let e=await ePC(A);if(F(e),!e)return;let t=await ePM();B(t),H.current=!0}catch(e){console.warn("Failed to load checkout card readers:",e)}finally{V.current=null}})())},[A,d]);let ec=(0,eC.useMemo)(()=>"smallTablet"===N||"tablet"===N?{width:"98%",heightRatio:.98}:{width:880,heightRatio:.9},[N]),[eu,ep]=(0,eC.useState)(!1),em=(0,eC.useMemo)(()=>{if(0===Q)return"600px";let e=getComputedStyle(document.body).transform,t=1;return"none"!==e&&(t=new DOMMatrix(e).d),`${Math.floor(Q*ec.heightRatio/t)}px`},[Q,ec.heightRatio]),eg="phone"===N,eh=(0,eC.useMemo)(()=>"unset",[Q]),ev={showCashPayment:!0},ef=(0,eC.useCallback)(e=>{G(e)},[]),[ey,eb]=(0,eC.useState)(!1),[ex,ek]=(0,eC.useState)(""),[e_,ew]=(0,eC.useState)("payment-content"),eS=async e=>{var t,l,i,a;if("payment-result-toast"===e_){null==O||null==(l=O.getOrderIdentity)||null==(t=l.call(O))||t.orderId,O&&(null==(i=O.updateTempOrderNote)||i.call(O,e),ek(e),null==er||er.success(eL.getText("pisell2.checkout.order-note.updated-successfully"))),eb(!1),ew("payment-content");return}try{O&&(await (null==(a=O.updateTempOrderNote)?void 0:a.call(O,e)),ek(e),null==er||er.success(eL.getText("pisell2.checkout.order-note.updated-successfully"))),null==S||S(e)}catch(e){console.error("Failed to update order note:",e),null==er||er.error(eL.getText("pisell2.checkout.order-note.update-failed"))}eb(!1),ew("payment-content")},ej=async()=>{try{if(O){var e;await (null==(e=O.updateTempOrderNote)?void 0:e.call(O,"")),ek(""),null==er||er.success(eL.getText("pisell2.checkout.order-note.deleted-successfully"))}null==j||j()}catch(e){console.error("Failed to delete order note:",e),null==er||er.error(eL.getText("pisell2.checkout.order-note.delete-failed"))}eb(!1),ew("payment-content")},eN=(0,eC.useRef)(!1),eI=eM().useRef(!1),eP=eM().useRef(null),eA=eM().useRef(null),eD=()=>{try{var e;let t=(null==O||null==(e=O.getTempOrderNote)?void 0:e.call(O))||"";ek(t)}catch(e){console.warn("Failed to get temp order note:",e)}ew("payment-result-toast"),eb(!0)},eE=(e,t)=>{let l=eJ(),i=eL.formatLocale(l);try{let t=W9[i],l=null==t?void 0:t[e];if(l)return l}catch(e){console.error("本地语言包访问错误:",e)}return eL.getText(e)||t},eO=e=>{var t,l,i;let a={...es.current||{},...e||{}};if(es.current=a,(null==e?void 0:e.orderPrintPayload)&&(eP.current=e.orderPrintPayload),"page"===b&&(null==a||null==(t=a.paymentResultViewModel)?void 0:t.status)==="failed"&&!eI.current){eI.current=!0;let e=null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId;null==h||h(!1,{order_id:e,event:{type:"modal-close",status:"failed",reason:"sync-failed",orderId:e,reset:!1,shouldRefreshOrder:!1,shouldCloseCaller:!1,payload:{order_id:e,paymentResult:a},isChangePaymentNotIncludeVoucher:eu}})}},ez=()=>{null==g||g({type:"toast-close",isCallbackFromToast:!0,shouldRefreshOrder:!1,shouldCloseCaller:!1,isChangePaymentNotIncludeVoucher:eu})},eR=async(e,t,l)=>{var i,a,n,r,o;let s=(null==(a=eA.current)||null==(i=a.getSyncingLock)?void 0:i.call(a))||!1;if(s&&!t){null==eq||eq.addLog({type:"warning",title:"订单正在同步中,用户点击取消",metadata:{isSyncingLocked:s}});return}let d=null==O||null==(r=O.getOrderIdentity)||null==(n=r.call(O))?void 0:n.orderId,c="start-new-order"===l?Zd({type:"modal-close",status:"cancelled",reason:"start-new-order",orderId:(o={orderId:d,payload:{order_id:d,paymentResult:es.current},isChangePaymentNotIncludeVoucher:eu}).orderId,reset:!0,payload:o.payload,shouldRefreshOrder:!0,shouldCloseCaller:!0,isChangePaymentNotIncludeVoucher:o.isChangePaymentNotIncludeVoucher}):void 0;null==g||g(c||{status:"cancelled",order_id:d}),null==h||h(e||!1,{order_id:d,paymentResult:es.current,...c?{event:c}:{}})},eF=o3(async()=>{var e,t,l,i,a;let n=(null==(t=eA.current)||null==(e=t.getSyncingLock)?void 0:e.call(t))||!1;if(n){null==eq||eq.addLog({type:"warning",title:"订单正在同步中,用户点击返回",metadata:{isSyncingLocked:n}});return}let r=null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId;"shared"!==p&&await e4Y(O);let o=((null==O||null==(a=O.getOrderPayments)?void 0:a.call(O))||[]).some(e=>!!eP_(e)&&0===Number((null==e?void 0:e.voucher_id)||0)),s=!!("shared"!==p&&o&&r);null==g||g({status:"cancelled",source:"back",reason:"back",order_id:r,shouldRefreshOrder:s,isChangePaymentNotIncludeVoucher:eu}),null==h||h(!1,{order_id:r,event:{type:"modal-close",status:"cancelled",reason:"back",orderId:r,order_id:r,reset:!1,shouldRefreshOrder:s,shouldCloseCaller:!1,payload:{order_id:r},isChangePaymentNotIncludeVoucher:eu}})});(0,eC.useEffect)(()=>{var e;(null==m||null==(e=m.order_info)?void 0:e.order_note)&&ek(m.order_info.order_note)},[m]);let eq=eWG(),eB=null==eq?void 0:eq.addLog,eV=(0,eC.useCallback)(()=>{var e;null==eq||null==(e=eq.storeLog)||e.call(eq,!0)},[null==eq?void 0:eq.storeLog]);(0,eC.useEffect)(()=>{var e;if(!d||"u"<typeof window||"u"<typeof document)return;let t=`checkout-layout-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,l=0,i=e=>{let t=document.querySelector(e);if(!t)return null;let l=t.getBoundingClientRect();return{width:Number(l.width.toFixed(2)),height:Number(l.height.toFixed(2)),top:Number(l.top.toFixed(2)),left:Number(l.left.toFixed(2)),right:Number(l.right.toFixed(2)),bottom:Number(l.bottom.toFixed(2))}},a=function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Date.now();if(a||!(n-l<120)){l=n;try{let l=document.querySelector(".payment-modal-modal"),a=document.querySelector(".payment-modal-wrapper"),r=window.getComputedStyle(document.body),o=l?window.getComputedStyle(l):null,s=a?window.getComputedStyle(a):null,d=window.visualViewport;null==eB||eB({type:"info",title:"Checkout modal layout diagnostic",metadata:{sessionId:t,reason:e,timestamp:new Date(n).toISOString(),variant:N,configuredWidth:ec.width,window:{innerWidth:window.innerWidth,innerHeight:window.innerHeight,documentClientWidth:document.documentElement.clientWidth,documentClientHeight:document.documentElement.clientHeight,devicePixelRatio:window.devicePixelRatio},visualViewport:d?{width:d.width,height:d.height,scale:d.scale,offsetLeft:d.offsetLeft,offsetTop:d.offsetTop}:null,body:{transform:r.transform,zoom:r.zoom},modalWrapper:{rect:i(".payment-modal-modal"),width:(null==o?void 0:o.width)??null,maxWidth:(null==o?void 0:o.maxWidth)??null,transform:(null==o?void 0:o.transform)??null},floatingRoot:{rect:i(".payment-modal-wrapper"),width:(null==s?void 0:s.width)??null,height:(null==s?void 0:s.height)??null}}}),eV()}catch(e){console.warn("Failed to record checkout modal layout diagnostic",e)}}},n=()=>a("viewport-change"),r=new MutationObserver(()=>a("body-mutation"));r.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),a("modal-open",!0);let o=window.requestAnimationFrame(()=>a("next-frame",!0)),s=window.setTimeout(()=>a("startup-settled",!0),500);return window.addEventListener("resize",n),window.addEventListener("orientationchange",n),null==(e=window.visualViewport)||e.addEventListener("resize",n),()=>{var e;window.cancelAnimationFrame(o),window.clearTimeout(s),window.removeEventListener("resize",n),window.removeEventListener("orientationchange",n),null==(e=window.visualViewport)||e.removeEventListener("resize",n),r.disconnect(),a("modal-close",!0)}},[eB,ec.width,eV,d,N]);let eU=(0,eC.useRef)(void 0),eY=(0,eC.useRef)(void 0);(0,eC.useEffect)(()=>{(async()=>{try{if(O){eU.current=!0;let e=await ePj(A);O.setOtherParams({is_price_include_tax:P("is_price_include_tax")??1,tax_rate:P("tax_rate"),surcharge_list:P("surcharge_list"),currency_format:P("currency_format"),tax_title:P("tax_title")||"GST",tax_country_code:P("tax_country_code"),currency_code:P("shop_currency_code"),currency_symbol:P("shop_symbol"),order_rounding_setting:P("order_rounding_setting"),shop_wallet_pass_id:e,business_code:eo});let t=e4H(O);t&&t.totalAmount&&Y(Number(t.totalAmount||0)),R(t)}else if(eU.current){var e,t,l;eU.current=!1,await (null==O||null==(e=O.restoreOrder)?void 0:e.call(O)),y||ea?await (null==O||null==(t=O.saveDraft)?void 0:t.call(O)):(null==eq||eq.addLog({type:"info",title:"含有 localOrderCreate, 保存 BaseSales 草稿",metadata:{data:m}}),await (null==O||null==(l=O.saveDraft)?void 0:l.call(O)));let i=e4H(O);i&&i.totalAmount&&Y(Number(i.totalAmount||0)),R(i),eU.current=!0}else throw Error("pisellos is not available")}catch(t){console.error("Failed to initialize checkout data:",t);let e=window.location.hostname;null==eq||eq.addLog({type:"error",title:`${e}: Failed to initialize checkout data`,metadata:{error:null==t?void 0:t.message}}),ei(!0)}})()},[]),(0,eC.useEffect)(()=>()=>{if("function"==typeof eY.current){var e;null==(e=eY.current)||e.call(eY),eY.current=void 0}},[]);let eW={context:M,pisellos:I,getData:P,interaction:A,Toast:er,onToastClose:ez,paymentResultDisplayMode:b,onResultViewModel:e=>{eO({paymentResultViewModel:e})}},eK=function(e){var t,l,i;let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,r=e=>`payment-result-toast-${e}`,{isTerminal:o,isWebPos:s,NativePage:d}=null==(t=M.appHelper)?void 0:t.utils,c=n??(null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId),u=()=>{Ki()},p=async()=>{var e,t,l;setTimeout(()=>{u()},0),null==(l=M.appHelper)||null==(t=l.utils)||null==(e=t.action)||e.call(t,{type:"pisell1.handleOpenSaleDetail",data:{osKey:"big-sale-detail",osProps:{orderId:c}},callback:()=>{}})},m=async()=>{var e,t;if(setTimeout(()=>{u()},0),null==O?void 0:O.printLocalOrderReceipt){null==(e=eq.addLog)||e.call(eq,{type:"info",title:"支付结果弹窗请求本地打印小票"});try{let e=await O.printLocalOrderReceipt(c);null==(t=eq.addLog)||t.call(eq,{type:"info",title:"支付结果弹窗请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==er||er.error(e instanceof Error?e.message:String(e))}}},g=()=>{setTimeout(()=>{u()},0),eL.getText("payment.result.actions.orderNoteClicked"),eD&&eD()},h=()=>{eL.getText("payment.result.actions.refundClicked")};switch(e){case"paid":case"partially_paid":return[[a?{id:"details",buttonProps:{className:r("action-button"),onClick:p,icon:(0,eH.jsx)(KK,{className:r("action-icon")}),children:eL.getText("payment.result.details")}}:{id:"print",buttonProps:{className:r("action-button"),onClick:m,icon:(0,eH.jsx)(KQ,{className:r("action-icon")}),children:eL.getText("payment.result.printReceipt")}},{id:"more",isMore:!0,menuData:[{key:"orderNote",label:eL.getText("payment.result.orderNote"),icon:(0,eH.jsx)(eEx,{className:r("menu-icon")}),onClick:g},a?{key:"print",label:eL.getText("payment.result.printReceipt"),icon:(0,eH.jsx)(KQ,{className:r("action-icon")}),onClick:m}:{key:"details",label:eL.getText("payment.result.details"),icon:(0,eH.jsx)(KK,{className:r("action-icon")}),onClick:p}],buttonProps:{className:r("action-button"),icon:(0,eH.jsx)(ob,{className:r("action-icon")})}}]];case"failed":return[[{id:"retry",buttonProps:{className:r("action-button retry-button"),onClick:()=>{eL.getText("payment.result.actions.retryClicked")},icon:(0,eH.jsx)(e4j,{className:r("action-icon")}),children:eL.getText("payment.result.retry")}},{id:"changePayment",buttonProps:{className:r("action-button change-payment-button"),onClick:()=>{eL.getText("payment.result.actions.changePaymentClicked")},icon:(0,eH.jsx)(eiG,{className:r("action-icon")}),children:eL.getText("payment.result.changePayment")}},{id:"more",isMore:!0,menuData:[{key:"orderNote",label:eL.getText("payment.result.orderNote"),icon:(0,eH.jsx)(eEx,{className:r("menu-icon")}),onClick:g},{key:"refund",label:eL.getText("payment.result.refund"),icon:(0,eH.jsx)(oM,{className:r("menu-icon")}),onClick:h}],buttonProps:{className:r("action-button"),icon:(0,eH.jsx)(ob,{className:r("action-icon")})}}]];case"wallet-pass-failed":return[[{id:"savePartial",buttonProps:{className:r("action-button primary-button"),onClick:()=>{var e;null==(e=eA.current)||e.handleButtonClick("save-pay-later")},children:eL.getText("payment.result.saveAsPartialPaid")}},{id:"continuePayment",buttonProps:{className:r("action-button primary-button"),onClick:()=>{eL.getText("payment.result.actions.continuePaymentClicked"),u()},children:eL.getText("payment.result.continuePayment")}},{id:"more",isMore:!0,menuData:[{key:"details",label:eL.getText("payment.result.details"),icon:(0,eH.jsx)(KK,{className:r("menu-icon")}),onClick:p},{key:"print",label:eL.getText("payment.result.printReceipt"),icon:(0,eH.jsx)(KQ,{className:r("menu-icon")}),onClick:m},{key:"orderNote",label:eL.getText("payment.result.orderNote"),icon:(0,eH.jsx)(eEx,{className:r("menu-icon")}),onClick:g},{key:"refund",label:eL.getText("payment.result.refund"),icon:(0,eH.jsx)(oM,{className:r("menu-icon")}),onClick:h}],buttonProps:{className:r("action-button"),icon:(0,eH.jsx)(ob,{className:r("action-icon")})}}]];default:return[]}},eG=async e=>{var t,l,i;let a,n=null==(t=e.response)?void 0:t.data,r=null==n?void 0:n.payment_status,o=Number((null==n?void 0:n.total_amount)||(null==n?void 0:n.expect_amount)||0),s=Number((null==n?void 0:n.amount_gap)||0),d={autoClose:(a=e4b[e4x(r,void 0)||"paid"]).autoClose,autoCloseDelay:30,maskClosable:a.maskClosable},c=(null==n?void 0:n.order_id)??(null==n?void 0:n.orderId)??(null==(l=e.response)?void 0:l.order_id)??(null==(i=e.response)?void 0:i.orderId),u=eK?eK(r,!1,c):[];return e4w({paymentStatus:r,orderTotalAmount:o,gapAmount:s,autoCloseConfig:d,actionButtons:u},eW)};return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(oU,{renderType:eg?"drawer":"modal",showHandlerBar:eg,props:eg?{open:d,placement:"bottom",header:!1,footer:!1,destroyOnClose:!0,height:"95vh",closable:!1,onClose:()=>{eR(!1)},maskClosable:!0,styles:{body:{padding:0,overflow:"hidden"}},className:"payment-mobile-modal"}:{open:d,onCancel:()=>{eF()},title:(0,eH.jsx)(()=>(0,eH.jsxs)("div",{className:"payment-modal-custom-header",children:[(0,eH.jsx)("div",{className:"header__left",children:(0,eH.jsx)(eT.Button,{icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-arrow-left",size:24}),size:"small",type:"text",onClick:eF})}),(null==C?void 0:C.showHeaderCenter)&&(0,eH.jsxs)("div",{className:"header__center",children:[eE("order.total"),":",e4_(W,P("shop_symbol"))]}),(null==C?void 0:C.showHeaderRightButton)&&(0,eH.jsx)("div",{className:"header__right",children:(0,eH.jsx)(eT.Button,{size:"small",type:"link",onClick:()=>eR(!0,!1,"start-new-order"),children:eL.getText("order.start-new-order")})})]}),{}),width:ec.width,className:`payment-modal-modal ${"smallTablet"===N||"tablet"===N?"payment-modal-modal-responsive":""}`,destroyOnClose:!1,maskClosable:!1,footer:null,closeIcon:!1,wrapClassName:`payment-modal-wrapper ${!K?"no-cash-payment":""}`,size:"large",style:{height:"auto",maxHeight:"98%"},bodyStyle:{maxHeight:"100%",overflowY:"auto",padding:0,display:"flex",flexDirection:"column"}},children:eg?(0,eH.jsxs)("div",{className:"payment-mobile-modal-panel",children:[(0,eH.jsx)("div",{className:"payment-mobile-modal-header",children:(0,eH.jsxs)("div",{style:e4A,children:[(0,eH.jsx)(eT.Button,{icon:(0,eH.jsx)(nY.Icon,{type:"pisell2-arrow-left",size:20}),size:"small",type:"text",style:e4D,onClick:eF}),(null==C?void 0:C.showHeaderCenter)!==!1?(0,eH.jsxs)("div",{style:e4E,children:[eE("order.total")||"Order Total",":"," ",e4_(W,P("shop_symbol"))]}):(0,eH.jsx)("div",{}),(null==C?void 0:C.showHeaderRightButton)!==!1?(0,eH.jsx)(eT.Button,{size:"small",type:"link",style:e4O,onClick:()=>eR(!0,!1,"start-new-order"),children:eL.getText("order.start-new-order")||"New Order"}):(0,eH.jsx)("div",{style:e4O})]})}),(0,eH.jsx)("div",{className:"payment-mobile-modal-content",style:{height:"100%"},children:(0,eH.jsx)(e46,{ref:eA,isModalOpen:d,cartData:(0,no.cloneDeep)(m),orderInfo:L||void 0,onPaymentComplete:eO,onPaymentCancel:eR,onStatusChange:()=>{},paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,showingCashToastRef:eN,onToastClose:ez,orderNote:ex,setOrderNote:ek,setNoteModalSource:ew,setNoteModalOpen:eb,totalAmount:W,moduleConfig:ev,onShowCashPaymentChange:ef,showSuccessToast:eG,dynamicMaxHeight:eh,onOrderSyncFailed:()=>X(!0),generateActionButtons:eK,paymentResultToastConfig:eW,updateOrderInfo:e=>R(e),setCurrentEditOrderId:e=>en(e),baseSales:O,walletPassMode:p,config:C,cardReaderDeviceNumber:$,cardReaders:q,setIsChangePaymentNotIncludeVoucher:ep})})]}):(0,eH.jsx)(e46,{ref:eA,isModalOpen:d,cartData:(0,no.cloneDeep)(m),orderInfo:L||void 0,onPaymentComplete:eO,onPaymentCancel:eR,onStatusChange:()=>{},paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,showingCashToastRef:eN,onToastClose:ez,orderNote:ex,setOrderNote:ek,setNoteModalSource:ew,setNoteModalOpen:eb,totalAmount:W,moduleConfig:ev,onShowCashPaymentChange:ef,showSuccessToast:eG,dynamicMaxHeight:em,onOrderSyncFailed:()=>X(!0),generateActionButtons:eK,paymentResultToastConfig:eW,updateOrderInfo:e=>R(e),setCurrentEditOrderId:e=>en(e),baseSales:O,walletPassMode:p,config:C,cardReaderDeviceNumber:$,cardReaders:q,setIsChangePaymentNotIncludeVoucher:ep})}),ey&&(0,oT.createPortal)((0,eH.jsx)("div",{children:(0,eH.jsx)(dA,{open:ey,title:eL.getText("pisell2.text.add-order-notes"),value:ex,onConfirm:eS,onDelete:ej,onCancel:()=>{eb(!1),ew("payment-content")}})}),document.body),(0,eH.jsx)(nY.PisellContainer,{renderType:"modal",props:{open:J,title:eL.getText("pisell2.checkout.tips"),footer:null,keyboard:!1,maskClosable:!1,closable:!1,onCancel:()=>{}},children:(0,eH.jsxs)("div",{style:{textAlign:"center",padding:"20px"},children:[(0,eH.jsx)("div",{style:{marginBottom:"16px",fontSize:"16px"},children:eL.getText("pisell2.checkout.sync-retry-hint")||"请点击重试按钮重新同步订单"}),(0,eH.jsx)(eT.Button,{type:"primary",size:"large",onClick:ed,loading:ee,disabled:ee,style:{width:"100%",marginTop:"80px"},children:eL.getText("retry")||"重试"})]})}),(0,eH.jsx)(nY.PisellContainer,{renderType:"modal",props:{open:el,title:eL.getText("pisell2.checkout.tips"),footer:null,keyboard:!1,onCancel:()=>{ei(!1)}},children:(0,eH.jsxs)("div",{style:{textAlign:"center",padding:"20px"},children:[(0,eH.jsx)("div",{style:{marginBottom:"16px",fontSize:"16px"},children:eL.getText("pisell2.checkout.order-create-failed")}),(0,eH.jsx)(eT.Button,{type:"primary",size:"large",onClick:()=>{ei(!1),window.location.reload()},style:{width:"100%",marginTop:"80px"},children:eL.getText("confirm")||"确认"})]})})]})};e45.displayName="PaymentModal";let e47=oZ(e45);function e49(e){let t=new Set,l=(e,i)=>{if("string"==typeof e)return"[object Object]"===e.trim()?"":e.trim();if(!e||"object"!=typeof e||i>8||t.has(e))return"";if(t.add(e),Array.isArray(e))return e.map(e=>l(e,i+1)).filter(Boolean).join("\n");for(let t of["response","data","body","message","msg","error","errors","statusText"]){let a=l(e[t],i+1);if(a)return a}return""};return l(e,0)}let e3e=e=>e&&"object"==typeof e&&!Array.isArray(e)?e:{},e3t=e=>{if("number"!=typeof e&&"string"!=typeof e||""===String(e).trim())return null;let t=eUn(e);return null!==t&&t>=0?t:null},e3l=function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];for(let e of t){let t=e3t(e);if(null!==t)return t}return null},e3i=e=>!0===e||1===e||"1"===e||!1!==e&&0!==e&&"0"!==e&&void 0;function e3a(e){let{result:t,amountSnapshot:l,order:i}=e,a=e3e(t),n=e3e(a.data),r=e3e(e3e(n.response).data??e3e(a.response).data??a.data??a),o=e3e(r.summary),s=e3e(l),d=e3e(i),c=e3t(r.order_wait_pay_amount);if(null!==c)return c;let u=String(r.payment_status||"").trim().toLowerCase();if("paid"===u)return 0;let p=r.deposit_amount??o.deposit_amount,m=e3t(p),g=null!=p&&""!==p,h=e3t(s.depositAmount);if(e3i(r.is_deposit)??(null!==m&&m>0||void 0)??e3i(s.isDeposit)??e3i(d.is_deposit)??(e3l(s.depositAmount,d.deposit_amount)??0)>0){let e=e3l(r.order_paid_amount,r.paid_amount,o.order_paid_amount),t=e3t(e3e(s.summary).order_paid_amount),l=m??h??e3t(d.deposit_amount),i=[...Array.isArray(r.payments)?r.payments:[],...Array.isArray(d.payments)?d.payments:[]].map(e3e).filter(e=>"paid"===e.status),a=i.some(e=>"normal"===e.type||"normal"===e.order_payment_type||"deposit"!==e.type&&"deposit"!==e.order_payment_type),n=e??t;if(a||null!==l&&l>0&&[e,t].some(e=>null!==e&&e>=l)||null!==e&&null!==t&&e!==t||i.length>0&&(null===n||0===n&&i.some(e=>(e3l(e.origin_amount,e.amount)??0)>0)))return null;let c=e3t(s.amountGap);return!0===e3i(s.isDeposit)&&null!==h&&h>0&&null!==c&&(!g||m===h)?c:"unpaid"===u&&0===e&&null!==m&&m>0?m:null}let v=e3e(s.summary??d.summary);return e3t(eUd({data:r},{expect_amount:s.expectAmount??v.expect_amount,total_amount:s.totalAmount??v.total_amount},void 0))}let e3n={en:{"pisell2.venue-kiosk.checkout.failed":"Checkout could not be completed. Please try again.","pisell2.venue-kiosk.checkout.reset-failed":"Could not start the next order. Please try again.","pisell2.venue-kiosk.checkout.result-missing":"The payment result could not be displayed. Continue paying this order.","pisell2.venue-kiosk.checkout.order-reference":"Order","pisell2.venue-kiosk.checkout.continue-payment":"Continue payment"},"zh-CN":{"pisell2.venue-kiosk.checkout.failed":"结账未完成,请重试。","pisell2.venue-kiosk.checkout.reset-failed":"暂时无法开始下一单,请重试。","pisell2.venue-kiosk.checkout.result-missing":"暂时无法显示支付结果,请继续处理当前订单。","pisell2.venue-kiosk.checkout.order-reference":"订单","pisell2.venue-kiosk.checkout.continue-payment":"继续支付"}},e3r="venue_booking_form_records";function e3o(e){return[...new Set((e.resources||[]).map(e=>String(e.relation_id??e.resource_id??e.id??"")).filter(e=>e&&"0"!==e))]}function e3s(e,t){var l;if(!t||!e.formId||!e3o(t).includes(e.resourceId))return;let i=(null==(l=t.metadata)?void 0:l[e3r])||{};return[i[e.key],...Object.values(i)].find(l=>l&&String(l.resourceId)===e.resourceId&&Number(l.formId)===e.formId&&/^\d+$/.test(String(l.recordId))&&Number(l.recordId)>0&&(t.relation_forms||[]).some(t=>Number(t.form_id)===e.formId&&Array.isArray(t.form_record_ids)&&t.form_record_ids.some(e=>String(e)===String(l.recordId))))}function e3d(e,t){for(let l of e.members){let e=e3s(l,t(l.bookingUid));if(e)return e}}function e3c(e,t){if(!e.formId)return!0;let l=e3d(e,t);return!!l&&e.members.every(e=>{var i;return String(null==(i=e3s(e,t(e.bookingUid)))?void 0:i.recordId)===String(l.recordId)})}async function e3u(e,t,l){var i,a;let n=t=>{l.assertCurrent();let i=l.readBooking(t.bookingUid);if(!i||!e3o(i).includes(e.resourceId))throw Error("The booking resource changed. Please review its details again.");return i};for(let i of(e.members.forEach(n),e.members)){let r=n(i),o=(null==(a=r.metadata)?void 0:a[e3r])||{},s=new Set,d={...o};for(let[t,l]of Object.entries(o))String(null==l?void 0:l.resourceId)===e.resourceId&&Number(null==l?void 0:l.formId)===e.formId&&(s.add(String(l.recordId)),delete d[t]);for(let t of Object.values(d))Number(null==t?void 0:t.formId)===e.formId&&s.delete(String(t.recordId));let c=(r.relation_forms||[]).map(t=>({...t,form_record_ids:[...t.form_record_ids||[]].filter(l=>Number(t.form_id)!==e.formId||!s.has(String(l)))})),u=c.find(t=>Number(t.form_id)===e.formId);u||(u={form_id:e.formId,form_record_ids:[]},c.push(u)),u.form_record_ids.some(e=>String(e)===String(t.recordId))||u.form_record_ids.push(t.recordId),await l.updateBooking({unique_identification_number:i.bookingUid,updates:{relation_forms:c,metadata:{[e3r]:{...d,[i.key]:t}}}})}if(l.assertCurrent(),!e3c(e,l.readBooking)||String(null==(i=e3d(e,l.readBooking))?void 0:i.recordId)!==String(t.recordId))throw Error("The saved form could not be linked to every booking. Please retry.")}let e3p=e=>null==e?"":String(e).trim(),e3m=e=>null==e?void 0:e.map(e=>[e.option_group_id??e.group_id,e.product_option_item_id??e.option_group_item_id??e.id,e.num??e.quantity]),e3g=e=>{var t,l,i;return[(null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number,e.product_id??e.id,e.product_variant_id??0,Number(e.num??e.quantity),e3m(null==(l=e.product_sku)?void 0:l.option),null==(i=e.product_bundle)?void 0:i.map(e=>{var t;return[e.group_id??e.bundle_group_id,e.id??e.bundle_id,e.product_id??e.bundle_product_id,e.product_variant_id??e.bundle_variant_id,e.num??e.quantity,e3m(e.option??(null==(t=e.product_sku)?void 0:t.option))]})]},e3h=e=>JSON.stringify([null==e?void 0:e.customer_id,((null==e?void 0:e.products)||[]).map(e3g),((null==e?void 0:e.bookings)||[]).map(e=>{var t,l;return[(null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number,e.start_date,e.start_time,e.end_date,e.end_time,e.resources,e.holders,e.relation_forms,null==(l=e.metadata)?void 0:l[e3r]]}),null==e?void 0:e.holder_relations,null==e?void 0:e.contacts_info,null==e?void 0:e.contacts,null==e?void 0:e.notes,null==e?void 0:e.note]),e3v=e=>null!=e&&""!==String(e).trim()&&"0"!==String(e).trim();function e3f(e){var t;if("payment_pending"!==String((null==e?void 0:e.status)||"").toLowerCase()||!e3v(null==e?void 0:e.voucher_id)||e3v(null==e?void 0:e.order_payment_id))return!1;let l=null==e||null==(t=e.metadata)?void 0:t.transactions;return!Array.isArray(l)||!l.some(e=>e3v(null==e?void 0:e.number))}function e3y(e){var t,l,i,a;let n=null==(t=e.getTempOrder)?void 0:t.call(e);return!(!n||e3v(n.order_id)||1===Number(n.need_sync)||[n.paid_amount,null==(l=n.summary)?void 0:l.order_paid_amount,null==(i=n.summary)?void 0:i.customer_paid_amount].some(e=>Number(e)>0))&&((null==(a=e.getOrderPayments)?void 0:a.call(e))||n.payments||[]).every(e3f)}function e3b(e){var t,l,i;let a=null==(t=e.getOrderAmountSnapshot)?void 0:t.call(e),n=null==(l=e.getTempOrder)?void 0:l.call(e),r=(null==(i=e.getOrderPayments)?void 0:i.call(e))||(null==n?void 0:n.payments)||[],o=Number(null==a?void 0:a.depositAmount),s=!!(null==a?void 0:a.isDeposit)&&Number(null==a?void 0:a.depositAmount)>0&&!r.some(e=>"paid"===String((null==e?void 0:e.status)||"").toLowerCase()&&"deposit"!==e.type&&"deposit"!==e.order_payment_type),d=!1;return{canReturn:e3y,readAmount(e){var t,l,i,a,n;if(!s)return eVK(e);if(d)return 0;let r=null==(t=e.getOrderAmountSnapshot)?void 0:t.call(e);if(!(null==r?void 0:r.isDeposit)||Number(r.depositAmount)!==o)return;let c=e3a({result:{},amountSnapshot:r,order:null==(l=e.getTempOrder)?void 0:l.call(e)});if(null!==c)return eC9({baseSalesAmountGap:c,payments:(null==(i=e.getOrderPayments)?void 0:i.call(e))||(null==(n=e.getTempOrder)||null==(a=n.call(e))?void 0:a.payments)})},inspectCompletion(e,t){var l,i,a;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"kiosk",r=(null==t?void 0:t.syncResult)||t;if(!s||(null==r?void 0:r.isOrderFullyPaid)===!0||(null==r?void 0:r.isDepositFullyPaid)!==!0)return eVZ(e,t,n);let o=null==r?void 0:r.submitResult,c=(null==o||null==(l=o.data)?void 0:l.data)||(null==o?void 0:o.data)||o;if(!eA5(o)||"main-screen"!==n&&[null==c?void 0:c.need_sync,null==o?void 0:o.need_sync,null==r?void 0:r.need_sync].some(e=>1===Number(e)))throw Error("Order sync is not complete.");let u=(null==c?void 0:c.order_id)??(null==c?void 0:c.orderId)??("main-screen"===n?null==c?void 0:c.external_sale_number:void 0)??(null==(a=e.getTempOrder)||null==(i=a.call(e))?void 0:i.order_id);if(!e3v(u)||"main-screen"!==n&&(!/^\d+$/.test(String(u))||0>=Number(u)))throw Error("The submitted order has no valid order id.");return d=!0,{kind:"paid",orderId:u,result:t,paymentStatus:"deposit-paid"}}}}let e3x=e=>{let t=String(e??"").trim();return/^\d+$/.test(t)&&Number(t)>0?t:void 0},e3k=e=>{var t;return(null==e||null==(t=e._extend)?void 0:t.localId)||(null==e?void 0:e.external_sale_number)||(null==e?void 0:e.order_id)||e},e3_=0,e3w=0,e3S=e=>{var t,l,i;let a=(null==(l=e.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.sales.tempOrder;return(null==a||null==(i=a._extend)?void 0:i.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id)||a},e3j=new Set(["id","product_id","product_variant_id","product_option_item_id","option_group_item_id","option_group_id","group_id","bundle_id","bundle_group_id","bundle_product_id","_bundle_product_id","bundle_variant_id","variant_id","quantity","num"]),e3N=e=>"string"==typeof e||"number"==typeof e&&Number.isFinite(e),e3C=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(e)?e.map(e=>{let l={};if(!e||"object"!=typeof e)throw Error("Invalid saved Party configuration.");for(let[t,i]of Object.entries(e))e3j.has(t)&&e3N(i)&&(l[t]=i);return!t&&Array.isArray(e.option)&&(l.option=e3C(e.option,!0)),l}):[]},e3M=(e,t)=>Object.entries(e||{}).reduce((e,l)=>{let[i,a]=l;return!["__proto__","constructor","prototype"].includes(i)&&(!t||t.includes(i))&&e3N(a)&&(e[i]=a),e},{}),e3T=e=>e3M(e,["scheduleId","timeSlotId","ruleId","source","label"]);function e3I(e){let t=null==e?void 0:e.candidate;return{...t?{candidate:{key:t.key,productId:t.productId,source:t.source,date:t.date,businessDate:t.businessDate,startAt:t.startAt,endAt:t.endAt,startTime:t.startTime,endTime:t.endTime,bookingStartAt:t.bookingStartAt,bookingEndAt:t.bookingEndAt,timezone:t.timezone,scheduleRefs:(t.scheduleRefs||[]).map(e3T),...t.primaryScheduleRef?{primaryScheduleRef:e3T(t.primaryScheduleRef)}:{}}}:{},requirementSelections:((null==e?void 0:e.requirementSelections)||[]).map(e=>({...null!=e.requirementGroupId?{requirementGroupId:e.requirementGroupId}:{},...null!=e.formId?{formId:e.formId}:{},resourceIds:e.resourceIds.filter(e3N)}))}}function e3P(e,t){let l=Number(e.detail.id??e.detail.product_id),i=e.configuration.skuValue,a=e.quantity??1;if(!Number.isSafeInteger(l)||l<=0||!Number.isSafeInteger(a)||a<=0||Number(i.product_id)!==l||!Number.isSafeInteger(Number(i.product_variant_id??0)))throw Error("Invalid saved Party configuration.");let n=e.configuration.variantDraft;return{version:1,productId:l,phase:t,quantity:a,...e.lineUid?{lineUid:e.lineUid}:{},configuration:{skuValue:{product_id:l,product_variant_id:Number(i.product_variant_id??0),..."string"==typeof i.product_option_string?{product_option_string:i.product_option_string}:{},option:e3C(i.option),bundle:e3C(i.bundle)},variantDraft:n?{productId:n.productId,selectionKey:n.selectionKey,items:e3M(n.items||{}),productOptionString:n.productOptionString}:null},selection:e3I(e.initialSelection)}}function e3A(e,t){var l,i,a;let n=["string"==typeof e?e:void 0,null==e?void 0:e.message,null==e||null==(i=e.response)||null==(l=i.data)?void 0:l.message,null==e||null==(a=e.data)?void 0:a.message].find(e=>"string"==typeof e&&!!e.trim()&&"[object Object]"!==e.trim());return(null==n?void 0:n.trim())||t}let e3D=e=>Array.isArray(e)?e:[],e3E=(e,t)=>null!=e&&null!=t&&String(e)===String(t),e3O=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")},e3z=e=>!!e&&"object"==typeof e&&[0,1,"0","1"].includes(e.has_deposit);function e3L(e,t,l,i){if(!e||Number(e.order_id||0)>0)return[];let a=e3D(e.products);return(0,no.flatMap)(a,n=>{var r,o,s,d,c,u,p;let m=null==(r=n.metadata)?void 0:r.venue_booking_role,g="tickets"===m||"party_main"===m?l:"tickets_extra"===m||"party_extra"===m?i:void 0,h=e3O(n);if(!g||!h||(null==(o=n.metadata)?void 0:o.venue_booking_scope_key)!==t||Number(n.order_detail_id||0)>0||1!==a.filter(e=>e3O(e)===h).length)return[];let v=n._origin??(null==(u=e._extend)||null==(c=u.productsByUid)||null==(d=c[e3O(n)])?void 0:d.origin)??(null==(p=n.metadata)?void 0:p.origin)??{};if(null!=(n.custom_deposit_data??v.custom_deposit_data??(null==(s=v.product)?void 0:s.custom_deposit_data)))return[];let f=g.filter(e=>e3E(e.id,n.product_id));if(1!==f.length||!e3z(f[0].custom_deposit_data))return[];let y=f[0],b=Number(n.product_variant_id||0),x=e3D(y.variant).filter(e=>e3E(e.id,b));if(b>0&&1!==x.length)return[];let k={...v,custom_deposit_data:(0,no.cloneDeep)(y.custom_deposit_data)};if(b>0&&e3z(x[0].custom_deposit_data)){let e=e3D(v.variant),t=e.find(e=>e3E(e.id,b));k.variant=t?e.map(e=>e!==t||null!=e.custom_deposit_data?e:{...e,custom_deposit_data:(0,no.cloneDeep)(x[0].custom_deposit_data)}):[...e,{id:x[0].id,custom_deposit_data:(0,no.cloneDeep)(x[0].custom_deposit_data)}]}let _=!1,w=e3D(n.product_bundle).map(e=>{let t,l,i,a,n;if(null!=e.custom_deposit_data)return e;let r=(t=e.bundle_group_id??e.group_id,l=e.bundle_id??e.id,i=e.bundle_product_id??e._bundle_product_id??e.product_id,a=e.bundle_variant_id??e.product_variant_id??e.variant_id??0,1===(n=(0,no.flatMap)(e3D(y.bundle_group).filter(e=>null==t||e3E(e.id,t)),e=>e3D(e.bundle_item)).filter(e=>null!=l&&e3E(e.id??e.bundle_id,l)&&(null==i||e3E(e.bundle_product_id??e._bundle_product_id??e.product_id,i))&&e3E(e.bundle_variant_id??e.product_variant_id??e.variant_id??0,a))).length?n[0]:void 0);return e3z(null==r?void 0:r.custom_deposit_data)?(_=!0,{...e,custom_deposit_data:(0,no.cloneDeep)(r.custom_deposit_data)}):e});return[{product_id:Number(n.product_id),product_variant_id:b,unique_identification_number:h,updates:{_origin:k,..._?{product_bundle:w}:{}}}]})}let e3R=(e,t)=>{var l,i;return e.os===t.os&&e.scopeKey===t.scopeKey&&e.order===t.os.getTempOrder()&&e.identity===eXv(t.os.getTempOrder())&&e.customer===String((null==(l=t.os.getTempOrder())?void 0:l.customer_id)||"")&&0>=Number((null==(i=t.os.getTempOrder())?void 0:i.order_id)||0)},e3$=e=>({customer:e.customer_id,bookings:e.bookings,holder:e.holder_relations,products:e3D(e.products).filter(e=>{var t;return!(null==(t=e.metadata)?void 0:t._giftInfo)}).map(e=>{var t,l;return{uid:e3O(e),product:e.product_id,variant:e.product_variant_id,num:e.num,sku:id({product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id||0),option:ex4(e),bundle:e.product_bundle||[]}),note:e.note,remark:e.remark,scope:null==(t=e.metadata)?void 0:t.venue_booking_scope_key,role:null==(l=e.metadata)?void 0:l.venue_booking_role}})}),e3F=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}$/.test(e);function e3q(e,t){let l=eXh(Number(e.id)),{value:i}=$e(iu(l.skuValue,e,{overSold:t}).value,e,{overSold:t});if(i===l.skuValue)return l;let a=ip(i,e);return{...l,skuValue:iN(a,e,l.skuValue)}}function e3B(e){var t,l,i,a,n,r,o,s,d,c,u,p,m,g,h,v,f,y,b,x,k;let _,w,S,j,N,C,M=e$(),T=eJ$(),I=exR(),P=UM(),A=function(){var e;let t=(null==(e=eJF())?void 0:e.layout)==="compact",[l,i]=(0,eC.useState)(()=>"u">typeof window&&window.matchMedia("(max-width: 700px)").matches),[a,n]=(0,eC.useState)(!1);return(0,eC.useEffect)(()=>{let e=window.matchMedia("(max-width: 700px)"),l=()=>{i(e.matches),e.matches||t||n(!1)};return l(),e.addEventListener("change",l),()=>e.removeEventListener("change",l)},[t]),{isMobile:t||l,open:a,show:()=>n(!0),close:()=>n(!1),closeThen:e=>{if(!a)return e();n(!1),requestAnimationFrame(e)}}}(),D=eXN(),{mode:E,context:O,config:z,scopeKey:L,variant:R="desktop"}=e,{sales:$,cart:F}=O,q=$.bookingTicket,B=eXy(q),H=String(e.locale).startsWith("zh")?"zh":"en",V=(e,t)=>"zh"===H?t:e,U=function(e){let{enabled:t,timeZone:l,isActive:i}=e,a=l||void 0,n=eXf(a),r=(0,eC.useRef)(n);r.current=n;let o=(0,eC.useRef)({enabled:t,zone:a,isActive:i});o.current={enabled:t,zone:a,isActive:i};let[,s]=(0,eC.useState)(0);return(0,eC.useEffect)(()=>{let e;if(!t||!1===i||"u"<typeof window||"u"<typeof document)return;let l=!0,n=()=>l&&o.current.enabled&&!1!==o.current.isActive&&o.current.zone===a,d=()=>{void 0!==e&&window.clearTimeout(e),e=void 0},c=()=>{if(!n())return;let e=eXf(a);r.current!==e&&(r.current=e,s(e=>e+1))},u=()=>{if(d(),!n()||"hidden"===document.visibilityState)return;let t=6e4-Date.now()%6e4;e=window.setTimeout(()=>{e=void 0,c(),u()},t)},p=()=>{c(),u()};return window.addEventListener("focus",p),window.addEventListener("pageshow",p),document.addEventListener("visibilitychange",p),p(),()=>{l=!1,d(),window.removeEventListener("focus",p),window.removeEventListener("pageshow",p),document.removeEventListener("visibilitychange",p)}},[t,a,i]),n}({enabled:B,isActive:e.isActive,timeZone:(null==(t=q.otherParams)?void 0:t.businessTimezone)||(null==M||null==(a=M.appHelper)||null==(i=a.utils)||null==(l=i.getData)?void 0:l.call(i,"timezone"))}),Y=(0,eC.useRef)({date:U,step:"select"});B&&Y.current.date!==U&&(Y.current={date:U,step:"select"});let[W,K]=(0,eC.useState)(Y.current.date),[G,Q]=(0,eC.useState)(()=>{if(B)return[U];let e=e0v(Y.current.date,e0p(H));return Array.from({length:7},(t,l)=>e0h(e,l)).filter(e=>e>=U)}),[Z,J]=(0,eC.useState)("select"),[X,ee]=(0,eC.useState)(B),[et,el]=(0,eC.useState)(),ei=(0,eC.useRef)(),[ea,en]=(0,eC.useState)(B?"product":"date"),[er,eo]=(0,eC.useState)(),[es,ed]=(0,eC.useState)(),[ec,eu]=(0,eC.useState)(),[ep,em]=(0,eC.useState)(),[eg,eh]=(0,eC.useState)(),[ev,ef]=(0,eC.useState)(!1),[ey,eb]=(0,eC.useState)(),[ex,ek]=(0,eC.useState)(!1),[e_,ew]=(0,eC.useState)(),[ej,eN]=(0,eC.useState)(),[eM,eI]=(0,eC.useState)(!1),[eP,eA]=(0,eC.useState)(!1),[eD,eE]=(0,eC.useState)(0),[eO,ez]=(0,eC.useState)(),[eR,eF]=(0,eC.useState)(!1),[eB,eH]=(0,eC.useState)(!1),eV=(0,eC.useRef)(!1),eU=(0,eC.useRef)(()=>!1),eY=(0,eC.useRef)(async()=>{}),eW=(0,eC.useRef)(async()=>!1),eK=(0,eC.useRef)(0),eG=(0,eC.useRef)(0),eQ=(0,eC.useRef)(!0),eZ=(0,eC.useRef)(),eJ=(0,eC.useCallback)(e=>(eZ.current=e,()=>{eZ.current===e&&(eZ.current=void 0)}),[]),eX=(0,eC.useRef)(null);(0,eC.useEffect)(()=>(eQ.current=!0,()=>{eQ.current=!1,eK.current++}),[]);let e0=z.steps[E].catalog,e2=B?(null==(r=q.getTempOrder)||null==(n=r.call(q))?void 0:n.customer_id)??(null==(o=F.tempOrder)?void 0:o.customer_id)??void 0:(null==(s=O.customer.selected)?void 0:s.id)??(null==(d=F.tempOrder)?void 0:d.customer_id)??void 0,e1=async()=>{await F.recalcSummary(),F.refreshCartSnapshot()},e4=async()=>{await e1(),eQ.current&&eE(e=>e+1)},e3=function(e){var t,l;let{source:i,enabled:a,scopeKey:n,create:r,refresh:o,initialState:s,customerMode:d="web",persistDraft:c=!0,retire:u,canRetire:p,waitForRetire:m}=e,g=e2J(i),h=null==(t=i.otherParams)?void 0:t.businessCode,v=c&&g?`pisell:venue-booking:v2:${JSON.stringify([n,g])}`:void 0,f=()=>({ready:!1,restored:!1,pendingOrder:!1,state:s}),[y,b]=(0,eC.useState)(()=>({value:f()})),x=(0,eC.useRef)(),k=(0,eC.useRef)({create:r,refresh:o,initialState:s,retire:u,canRetire:p,waitForRetire:m});k.current={create:r,refresh:o,initialState:s,retire:u,canRetire:p,waitForRetire:m},(0,eC.useEffect)(()=>{if(!a||!i)return;let e=e2Z.get(i);e||(e={tail:Promise.resolve(),hasSession:!1},e2Z.set(i,e));let t=e,l=t.owner;if(!(null==l?void 0:l.active)||l.scopeKey!==n||l.cacheId!==g){let e;(null==l?void 0:l.active)&&e23(l);let a=k.current,r=!!v&&!t.hasSession&&(()=>{try{var e;return"u">typeof performance&&(null==(e=performance.getEntriesByType("navigation")[0])?void 0:e.type)==="reload"}catch{return!1}})()&&!e2G.has(v);t.hasSession=!0,v&&e2G.add(v);try{let t=v?JSON.parse(sessionStorage.getItem(v)||"null"):null;v&&(null==t?void 0:t.version)===2&&t.scopeKey===n&&t.cacheId===g&&"status"in t&&"submission-pending"===t.status?sessionStorage.removeItem(v):("web"===d&&v&&(null==t?void 0:t.version)===2&&t.scopeKey===n&&t.cacheId===g&&"collectionReturnTo"in t&&t.collectionReturnTo===e21()&&"string"==typeof t.sessionId&&t.sessionId&&(delete t.collectionReturnTo,sessionStorage.setItem(v,JSON.stringify(t)),r=!0),r&&(e=t),v&&!r&&sessionStorage.removeItem(v))}catch{}t.owner=l={source:i,scopeKey:n,cacheId:g,storageKey:v,refs:0,releaseVersion:0,active:!0,order:null,returnPath:e21(),sessionId:`${Date.now()}:${++e2Q}`,discarded:!1,lastState:a.initialState,retireOrder:a.retire,canRetire:a.canRetire,waitForRetire:a.waitForRetire,value:{ready:!1,restored:!1,pendingOrder:!1,state:a.initialState},listeners:new Set};let o=l,s=()=>t.owner===o&&o.active&&o.refs>0,c=e=>{s()&&(o.order=i.getTempOrder(),o.lastState=e.state,o.value=e,e24(o))};t.tail=t.tail.then(async()=>{if(!s())return;if(t.orderOwner=o,t.orderSessionId=o.sessionId,e22(i.getTempOrder()))return void c({ready:!0,restored:!1,pendingOrder:!0,state:a.initialState});if("kiosk"!==d&&("function"!=typeof i.syncAuthenticatedOrderCustomer||"function"!=typeof i.clearOrderCustomer))throw Error("This booking service version cannot safely synchronize the signed-in customer. Please update the service before continuing.");if(await a.create(),!s())return;if(e22(i.getTempOrder()))return void c({ready:!0,restored:!1,pendingOrder:!0,state:a.initialState});let l=!1,r=a.initialState;if((null==e?void 0:e.version)===2&&e.scopeKey===n&&e.cacheId===g&&e.order&&!e22(e.order)&&Array.isArray(e.order.products)&&Object.prototype.hasOwnProperty.call(e,"state")){if(await i.replaceTempOrder(e.order,{persist:!1,recalculateSummary:!1}),!s())return;l=!0,r=e.state}let u=e=>{var t,l;return String((null==e?void 0:e.customer_id)||(null==e||null==(l=e._extend)||null==(t=l.customerSnapshot)?void 0:t.id)||"")},p=u(i.getTempOrder());if("kiosk"!==d){let e=await i.syncAuthenticatedOrderCustomer();if(!s())return;if(!1===e)i.clearOrderCustomer();else if(!0!==e)throw Error("The booking service did not confirm customer synchronization. Please reload before continuing.")}if(!s())return;let m=i.getTempOrder();if(p!==u(m)&&Array.isArray(null==m?void 0:m.payments)&&m.payments.some(e20)){if("function"!=typeof i.clearWalletAssetSelection)throw Error("This booking service version cannot clear the previous customer’s wallet selection. Please update the service before continuing.");if(await i.clearWalletAssetSelection(),!s())return}if(l&&e){if("function"==typeof i.restoreDraftDiscountSelection)await i.restoreDraftDiscountSelection(e);else{var h;let t=e=>(e.discount_list||[]).some(e=>["discount_card","product_discount_card","good_pass","entitlement_pass"].includes(e.tag||e.type));if((null==(h=e.discountSelection)?void 0:h.length)||t(e.order)||e.order.products.some(e=>t(e)||(e.product_bundle||[]).some(t)))throw Error("This booking service cannot restore draft discounts. Please update the service before continuing.")}if(!s())return}await a.refresh(),s()&&c({ready:!0,restored:l,pendingOrder:e22(i.getTempOrder()),state:r})}).catch(e=>{s()&&(o.value={...o.value,ready:!1,error:e instanceof Error?e.message:String(e)},e24(o))})}let r=l;r.refs+=1,r.releaseVersion+=1,x.current=r;let o=!0,s=()=>{o&&b({record:r,value:r.value})};return r.listeners.add(s),s(),()=>{o=!1,r.listeners.delete(s),r.refs-=1,x.current===r&&(x.current=void 0);let e=++r.releaseVersion,l="web"===d&&"u">typeof window&&/^\/(?:[^/]+\/)?login-info\/?$/.test(window.location.pathname);"kiosk"===d&&r.retireOrder&&r.canRetire&&e28(r,t,r.sessionId,r.canRetire,!0).catch(()=>{}),Promise.resolve().then(()=>{var a;if(0===r.refs&&r.releaseVersion===e){if(l&&t.owner===r&&t.orderOwner===r&&t.orderSessionId===r.sessionId&&r.value.ready&&!r.value.pendingOrder&&!r.discarded&&r.storageKey&&r.returnPath&&e2J(i)===r.cacheId&&i.getTempOrder()===r.order&&!e22(i.getTempOrder()))try{let e=JSON.parse(sessionStorage.getItem(r.storageKey)||"null");(null==e?void 0:e.version)===2&&e.scopeKey===r.scopeKey&&e.cacheId===r.cacheId&&e.sessionId===r.sessionId&&e.order&&!e22(e.order)&&sessionStorage.setItem(r.storageKey,JSON.stringify({...e,collectionReturnTo:r.returnPath}))}catch{}e23(r),t.owner!==r||(null==(a=r.submittedFinish)?void 0:a.pending)||(t.owner=void 0)}})}},[i,a,n,g,v,d]);let _=y.record,w=null==_?void 0:_.sessionId,S=a&&(null==_?void 0:_.source)===i&&_.scopeKey===n&&_.cacheId===g&&_.active&&(null==(l=e2Z.get(i))?void 0:l.owner)===_,j=S?y.value:f(),N=e=>{if(e.storageKey&&(e=>{if(!e.storageKey)return!1;try{var t;return(null==(t=JSON.parse(sessionStorage.getItem(e.storageKey)||"null"))?void 0:t.sessionId)===e.sessionId}catch{return!1}})(e))try{sessionStorage.removeItem(e.storageKey)}catch{}};return{...j,sessionId:S?_.sessionId:void 0,save:e=>{var t,l;if(!S||!_||x.current!==_||!_.active||(null==(t=e2Z.get(i))?void 0:t.owner)!==_||_.sessionId!==w||_.retiring||!_.value.ready||_.value.pendingOrder||_.discarded)return;let a=i.getTempOrder();if(!a||e22(a)){try{v&&sessionStorage.removeItem(v)}catch{}return}if(a===_.order&&(_.lastState=e,v&&g))try{let t=null==(l=i.getDraftDiscountSelection)?void 0:l.call(i);sessionStorage.setItem(v,JSON.stringify({version:2,scopeKey:n,cacheId:g,sessionId:_.sessionId,order:a,discountSelection:t,state:e}))}catch{}},discard:e=>{_&&_.sessionId===w&&(_.discarded=!0,N(_))},restart:()=>{let e=e2Z.get(i);if(!S||!_||!e||x.current!==_||!_.active||_.refs<=0||e.owner!==_||_.sessionId!==w||_.retiring)return Promise.resolve(!1);if(_.restarting)return _.restarting;let t=k.current,l=_.sessionId,a=()=>x.current===_&&e.owner===_&&_.active&&_.refs>0&&_.sessionId===l,n=e=>{a()&&(_.order=i.getTempOrder(),_.lastState=e.state,_.value=e,e24(_))},r=e.tail.then(async()=>{if(!a())return!1;if(e.orderOwner=_,e.orderSessionId=l,"kiosk"!==d&&("function"!=typeof i.syncAuthenticatedOrderCustomer||"function"!=typeof i.clearOrderCustomer))throw Error("This booking service version cannot safely synchronize the signed-in customer. Please update the service before continuing.");if(N(_),n({ready:!1,restored:!1,pendingOrder:!1,state:t.initialState}),await t.create(),!a())return!1;if(e22(i.getTempOrder()))return n({ready:!0,restored:!1,pendingOrder:!0,state:t.initialState}),!1;if("kiosk"!==d){let e=await i.syncAuthenticatedOrderCustomer();if(!a())return!1;if(!1===e)i.clearOrderCustomer();else if(!0!==e)throw Error("The booking service did not confirm customer synchronization. Please reload before continuing.")}return!!a()&&(await t.refresh(),!!a()&&(_.order=i.getTempOrder(),_.lastState=t.initialState,_.discarded=!1,_.sessionId=`${Date.now()}:${++e2Q}`,e.orderSessionId=_.sessionId,_.value={ready:!0,restored:!1,pendingOrder:e22(_.order),state:t.initialState},e24(_),!_.value.pendingOrder))}).catch(e=>{if(!a())return!1;throw _.value={..._.value,ready:!1,error:e instanceof Error?e.message:String(e)},e24(_),e});_.restarting=r;let o=()=>{_.restarting===r&&(_.restarting=void 0)};return e.tail=r.then(o,o),r},retire:function(){let{canRetire:e=()=>!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e2Z.get(i);return"kiosk"===d&&_&&t&&_.source===i&&_.sessionId===w&&e()&&(t.owner===_||t.orderOwner===_)?e28(_,t,w,e):Promise.resolve(!1)},ownsSession:()=>{let e=e2Z.get(i);return!!_&&_.source===i&&_.sessionId===w&&!!e&&(e.owner===_||!e.owner&&e.orderOwner===_&&e.orderSessionId===w)},finishSubmitted:e=>{let t=e2Z.get(i),l=String(e??"").trim();if(!_||!t||!w||!e2X(l)||_.source!==i||_.sessionId!==w||_.scopeKey!==n||_.cacheId!==g)return Promise.resolve(!1);let a=_.submittedFinish;if((null==a?void 0:a.orderId)===l&&a.sessionId===w)return a.promise;let r=i.getTempOrder(),o=()=>{var e;return e2Z.get(i)===t&&t.owner===_&&_.source===i&&_.sessionId===w&&_.scopeKey===n&&_.cacheId===g&&e2J(i)===g&&(null==(e=i.otherParams)?void 0:e.businessCode)===h&&i.getTempOrder()===r&&String((null==r?void 0:r.order_id)??"").trim()===l};if(!r||!o())return Promise.resolve(!1);let s=k.current,d=t.tail.then(async()=>{var e;if(!o())return!1;if("function"!=typeof i.restoreOrder)throw Error("This booking service cannot safely reset the submitted order.");return _.discarded=!0,N(_),await i.restoreOrder(),t.owner===_&&_.active&&_.refs>0&&_.sessionId===w&&e2J(i)===g&&(null==(e=i.otherParams)?void 0:e.businessCode)===h&&await s.refresh(),!0}),c={orderId:l,sessionId:w,pending:!0,promise:d};_.submittedFinish=c;let u=()=>{c.pending=!1,t.owner!==_||_.active||0!==_.refs||(t.owner=void 0)};return t.tail=d.then(u,u),d}}}({source:q,enabled:eU.current()||!1!==e.isActive&&"pending"!==$.catalogState,scopeKey:L,create:async()=>(await $.clearCartAndReset(),$.createNew()),refresh:e4,initialState:Y.current,customerMode:B?"kiosk":"web",persistDraft:!B,canRetire:()=>!eU.current(),waitForRetire:()=>eY.current(),retire:B?async()=>{var e;await $.clearCartAndReset(),await e1(),null==(e=q.clearSessionStorageOrderSnapshot)||e.call(q)}:void 0}),e8=(b={mode:E,os:q,sessionId:e3.sessionId,date:W,step:Z},_=Rd(),(w=(0,eC.useRef)({input:b,logger:_})).current={input:b,logger:_},(S=(0,eC.useRef)()).current||(j=(x={readContext:()=>w.current.input,getLogger:()=>w.current.logger}).flowId,N=0,C=0,S.current={capture(){try{var e,t;let l,i,a=x.readContext(),n=x.getLogger(),r=(e=>{if(!e)return{};try{let t=new URL(e);if(!t.host)return{};let l=e2k(t.searchParams.get("cacheId"))||e2k(t.searchParams.get("cache_id"));t.username="",t.password="",t.hash="";let i=[];return t.searchParams.forEach((e,t)=>i.push(t)),i.forEach(e=>{e2_.has(e.toLowerCase())||t.searchParams.set(e,"[redacted]")}),{pageUrl:t.href,pagePath:t.pathname,pageHost:t.host,urlCacheId:l}}catch{return{}}})((x.getPageUrl||(()=>"u"<typeof window?void 0:window.location.href))()),o=a.os,s={};try{s=(null==o?void 0:o.otherParams)||{}}catch{}let d=e2k(s.cacheId);try{d=e2k(null==o||null==(e=o.getCacheId)?void 0:e.call(o))||d}catch{}try{let e=null==o||null==(t=o.getTempOrder)?void 0:t.call(o);l=e2k(null==e?void 0:e.order_id),i=e2k(null==e?void 0:e.external_sale_number)}catch{}j||(j=(()=>{try{if("u">typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();if("u">typeof crypto&&"function"==typeof crypto.getRandomValues)return Array.from(crypto.getRandomValues(new Uint32Array(4)),e=>e.toString(16).padStart(8,"0")).join("")}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`})());let c=Object.freeze({source:"materials",layer:"ui",module:"venueBookingSales",category:"business",template:a.mode,templateId:"tickets"===a.mode?"ticketing_1":"party_1",...r,cacheId:r.urlCacheId||d,osCacheId:d,materialSessionId:e2k(a.sessionId),flowId:j,operationId:`${j}:${++N}`,date:e2k(a.date),step:e2k(a.step),platform:e2k(s.platform),businessCode:e2k(s.businessCode??s.business_code),shopId:e2k(s.shopId),orderId:l,externalSaleNumber:i});return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"info";try{if("function"!=typeof(null==n?void 0:n.addLog))return;let i=n.addLog({type:l,title:`[VenueBookingSales][${c.template}] ${e}`,metadata:{...c,action:e,eventSequence:++C,payload:{...t}}});i&&"function"==typeof i.then&&Promise.resolve(i).catch(()=>{})}catch{}}}catch{return e2b}}}),S.current),e6=(0,eC.useCallback)(()=>{if(eQ.current&&"party"===E){var e;e8.capture()("product_confirmed"),null==(e=eZ.current)||e.call(eZ)}},[E,e8]),e5=(0,eC.useRef)(),[e7,e9]=(0,eC.useState)(),te=!!e3.sessionId&&e7===e3.sessionId;(0,eC.useEffect)(()=>{var e,t,l,i,a,n,r,o;if(!e3.ready||!e3.sessionId||e5.current===e3.sessionId)return;e5.current&&(++eK.current,eo(void 0),ed(void 0),eu(void 0),em(void 0),eh(void 0),ef(!1),en(B?"product":"date"),ez(void 0),eF(!1),eb(void 0),eN(void 0),eI(!1),eA(!1),ek(!1),eH(!1),eV.current=!1,A.close()),e5.current=e3.sessionId;let s=e3.state,d=q.getTempOrder(),c=e1F(d,{mode:E,scopeKey:L,date:null==s?void 0:s.date});K(function(e){if(!e.todayOnly)return e3F(e.savedDate)?e.savedDate:e.initialDate;if(e.hasSelection){if(e3F(e.savedDate))return e.savedDate;if(e3F(e.orderDate))return e.orderDate}return e.today}({todayOnly:B,today:U,initialDate:Y.current.date,savedDate:null==s?void 0:s.date,orderDate:null==(e=c.bindings[0])?void 0:e.date,hasSelection:!!((null==s?void 0:s.partyPreview)||e3.pendingOrder||eU.current()||(null==d||null==(t=d.products)?void 0:t.length)||(null==d||null==(l=d.bookings)?void 0:l.length))})),ee(B),"party"===E&&e3.restored&&(null==s?void 0:s.partyPreview)?(em({value:s.partyPreview,attempt:0}),ee(!0)):((null==(i=q.getTempOrder())?void 0:i.bookings)||[]).length&&ee(!0);let u=e1H(O,L);J((o={savedStep:null==s?void 0:s.step,restored:e3.restored,canResume:!e3.pendingOrder&&!("party"===E&&(null==s?void 0:s.partyPreview))&&!!((null==s?void 0:s.date)&&/^\d{4}-\d{2}-\d{2}$/.test(s.date)&&s.date>=U)&&c.bindings.length>0&&0===c.issues.length&&c.bindings.every(e=>e.date===(null==s?void 0:s.date)),holderRequired:u.required,holderComplete:u.complete,hasExtras:!!(null==(a=z.steps.extras)?void 0:a.catalog.menuListIds.length)||e1_((null==(n=q.getTempOrder())?void 0:n.products)||[],{mode:E,scopeKey:L,parentLineUid:null==(r=c.bindings[0])?void 0:r.productLineUid}).length>0}).restored&&o.canResume&&"string"==typeof o.savedStep&&["holder","extras","review","payment"].includes(o.savedStep)?o.holderRequired&&!o.holderComplete?"holder":"holder"===o.savedStep?o.holderRequired?"holder":o.hasExtras?"extras":"review":"extras"===o.savedStep&&o.hasExtras?"extras":"review":"select"),e9(e3.sessionId)},[e3.ready,e3.sessionId,e3.state]);let tt="party"!==E?void 0:(null==es?void 0:es.partyDraft)?e3P({...es.partyDraft,configuration:es.configuration},"configuration"):er?(null==ec?void 0:ec.key)===er.key?ec.value:e3P(er,"booking"):void 0,tl=(null==ep?void 0:ep.value)||tt,ti=JSON.stringify(tl),ta=JSON.stringify((null==(c=$.tempOrder)?void 0:c.contacts_info)??null),tn=q.getTempOrder(),tr=(k={todayOnly:B,today:U,date:W,active:!1!==e.isActive,ready:e3.ready&&te,hasSelection:!!((null==tn||null==(u=tn.products)?void 0:u.length)||(null==tn||null==(p=tn.bookings)?void 0:p.length)||er||es||tl||ep||ev),operationPending:!!(e3.pendingOrder||eU.current()||eV.current||ex||eM||eP||e_||ej||eB)}).todayOnly&&k.active&&k.ready&&k.date!==k.today&&!k.hasSelection&&!k.operationPending;(0,eC.useEffect)(()=>{var e,t,l,i;!tr||eU.current()||eV.current||null!=(t=q.getTempOrder())&&null!=(e=t.products)&&e.length||null!=(i=q.getTempOrder())&&null!=(l=i.bookings)&&l.length||(++eK.current,K(U),ee(!0),en("product"))},[tr,U,q,L,e3.sessionId]),(0,eC.useEffect)(()=>{te&&!tr&&e3.save({date:W,step:"payment"===Z?"review":Z,...tl?{partyPreview:tl}:{}})},[e3.ready,e3.sessionId,te,ep,W,Z,F.tempOrder,F.discountList,eD,ti,ta,tr]);let to=e3.ready&&te&&!ep&&!e3.pendingOrder&&!1!==e.isActive&&!eB&&!tr,ts=(0,eC.useRef)();(0,eC.useEffect)(()=>{let e=ts.current;to&&(!e||e.sessionId!==e3.sessionId||e.step!==Z)&&(ts.current={sessionId:e3.sessionId,step:Z},e8.capture()("step_entered",{step:Z,restored:e3.restored}))},[to,Z,e3.sessionId,e3.restored,e8]);let td=JSON.stringify($.salesSettings??null,(e,t)=>!t||"object"!=typeof t||Array.isArray(t)?t:Object.fromEntries(Object.keys(t).sort().map(e=>[e,t[e]]))),tc=(0,eC.useMemo)(()=>{var e;let t,l,i;return e={ensureSalesSettings:$.ensureSalesSettings,getPlatform:()=>{var e;return $.salesSettingsPlatform||(null==(e=q.otherParams)?void 0:e.platform)}},l=()=>{if(t)return t;let l=Promise.resolve().then(async()=>{let t=await e.ensureSalesSettings();if(!t)throw Error("The booking sales settings are unavailable.");return{settings:t,platform:e.getPlatform()}});t=l;let i=()=>{t===l&&(t=void 0)};return l.then(i,i),l},Object.assign((i=e=>async t=>{let{settings:l,platform:i}=await e(),a={source:"picoding",settings:l,platform:i};return{requiredOptionValidation:l.product.checkRequiredOptions,overSold:1===iO({productOverSold:t.over_sold,runtimePolicy:a}),runtimePolicy:a}})(l),{createBatch(){let e;return i(()=>e||(e=l()))}})},[$.ensureSalesSettings,td,$.salesSettingsPlatform,q,L]),tu=e1g({os:q,scopeKey:L,sessionId:e3.sessionId,menuListIds:e0.menuListIds,poolRole:"main"}),tp=e1g({os:q,scopeKey:`${L}:extras`,sessionId:e3.sessionId,menuListIds:(null==(m=z.steps.extras)?void 0:m.catalog.menuListIds)||[],poolRole:"extras"}),tm=(0,eC.useCallback)(()=>{var e;null==(e=tu.retry)||e.call(tu),eE(e=>e+1)},[tu]),tg=JSON.stringify([L,e3.sessionId]),th=(0,eC.useRef)(tg);th.current=tg;let tv=(0,eC.useCallback)(()=>{ei.current=tg,el(tg)},[tg]),tf=et===tg,ty=(0,eC.useMemo)(()=>(function(e){if(!e0m(e))return;let t=new Date(`${e}T12:00:00Z`),l=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+2,0,12)).getUTCDate();return{startDate:e,endDate:new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,Math.min(t.getUTCDate(),l),12)).toISOString().slice(0,10)}})(U),[U]),tb=(0,eC.useMemo)(()=>{var e,t,l,i;return!e3.restored||!(null==(e=e3.state)?void 0:e.partyPreview)&&(!(null==(t=e3.state)?void 0:t.date)||e3.state.date<=U)&&!((null==(l=q.getTempOrder())?void 0:l.products)||[]).length&&!((null==(i=q.getTempOrder())?void 0:i.bookings)||[]).length},[e3.sessionId,e3.restored,q,L]),tx=B||!tb||X||tf||((null==(g=q.getTempOrder())?void 0:g.bookings)||[]).length?void 0:ty,tk=B?{startDate:W,endDate:W}:tx&&W>=tx.startDate&&W<=tx.endDate?tx:e0G(W,G),t_=e1u({os:q,ready:to,catalog:e0,date:W,customerId:e2,scopeKey:L,revision:eD,operationLog:e8,projectionDateRange:tk,queries:tu,onRetry:tm,mode:"tickets"===E?"ticket":"party",resolvePolicy:tc}),tw=q.getTempOrder()||F.tempOrder,tS=e1F(tw,{mode:E}),tj="party"===E?tS.bindings[0]:void 0,tN=!!(null==(h=z.steps.extras)?void 0:h.catalog.menuListIds.length),tC=e1u({os:q,ready:to,operationLog:e8,catalog:null==(v=z.steps.extras)?void 0:v.catalog,date:U,retailTimeZone:T.timeZone,customerId:e2,scopeKey:`${L}:extras`,retail:!0,queries:tp,revision:+(tS.bindings.length>0)}),tM=e1D({os:q,cart:F,mode:E,timeZone:T.timeZone,beforeMutate:I.assertCanMutate,parentLineUid:null==tj?void 0:tj.productLineUid,scopeKey:L,customerId:e2,productLoadParams:{menu_list_ids:(null==(f=z.steps.extras)?void 0:f.catalog.menuListIds)||[]},catalog:tC,catalogSession:tp,onMutated:e1,resolveSelectionPolicy:async e=>{let t=await tL(e);return{...t,overSold:1===t.overSold}}}),tT=function(e){var t;let l,i,a,n,r,o,s,d,c,u,p,m,g=(0,eC.useRef)(e);g.current=e;let h=(0,eC.useRef)(!0),[,v]=(0,eC.useState)(0),f=(0,eC.useRef)();return f.current||(a=(t={getOwner:()=>g.current.getOwner(),productId:e=>String(e.id),readQuantity:e=>g.current.readQuantity(e),applyQuantity:(e,t)=>g.current.applyQuantity(e,t),refreshActual:()=>g.current.refreshActual(),onError:e=>{h.current&&g.current.onError(e)},onChange:()=>{h.current&&v(e=>e+1)}}).getOwner(),n=0,r=!1,o=!1,s=new Map,d=()=>{void 0!==l&&clearTimeout(l),l=void 0},c=(e,l)=>!r&&l===n&&e1m(e,t.getOwner()),u=()=>{r||t.onChange()},p=()=>{let e=t.getOwner();e1m(a,e)||(a=e,n+=1,s.clear(),d(),u())},m=()=>{if(r||o||!s.size)return;d();let e=s.values().next().value;l=setTimeout(async()=>{if(l=void 0,!r&&!o){o=!0;try{for(;!r&&s.size;){p();let l=s.entries().next().value;if(!l)break;let[r,o]=l,d=a,m=n;try{var e;let l=t.readQuantity(o.product);if(!Number.isSafeInteger(l)||l<0)throw Error("The extra quantity is unavailable. Please review the cart.");if(l===o.quantity){s.delete(r),u();continue}let a=o.quantity;i={owner:d,generation:m,intent:o};let n=await t.applyQuantity(o.product,a);if(!c(d,m)){i=void 0,p();continue}if(i=void 0,"function"==typeof n){s.clear(),u(),await n(()=>c(d,m));break}if(!n){s.clear(),u();break}let g=t.readQuantity(o.product),h=a<l&&g>=a&&g<l;if(!Number.isSafeInteger(g)||g<0||g!==a&&!h)throw Error("The extra quantity changed while updating. Please review the cart.");(null==(e=s.get(r))?void 0:e.quantity)===g&&s.delete(r),u();break}catch(e){if(!c(d,m)){i=void 0,p();continue}try{await t.refreshActual()}catch{}i=void 0,c(d,m)&&(s.clear(),u(),t.onError(e));break}}}finally{i=void 0,o=!1,m()}}},Math.max(0,Math.min(e.lastAt+200,e.firstAt+400)-Date.now()))},f.current={enqueue(e,l,a){var n;let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(r||!Number.isSafeInteger(l)||!Number.isSafeInteger(a))return;p();let d=t.productId(e);if(!d)return;let c=t.readQuantity(e);if(!Number.isSafeInteger(c)||c<0)return;let g=((null==(n=s.get(d))?void 0:n.quantity)??c)+l-a,h=Math.max(0,Number.isSafeInteger(o.min)?o.min:0),v=Math.max(h,Number.isSafeInteger(o.max)?o.max:Number.MAX_SAFE_INTEGER),f=g<=0?0:Math.min(v,Math.max(h,g));if(!Number.isSafeInteger(f))return;let y=Date.now(),b=s.get(d);s.set(d,{product:e,quantity:f,firstAt:b===(null==i?void 0:i.intent)?y:(null==b?void 0:b.firstAt)??y,lastAt:y}),u(),m()},isPending:()=>!r&&e1m(a,t.getOwner())&&(s.size>0||!!i&&i.generation===n&&e1m(i.owner,a)),getTargets:()=>!r&&e1m(a,t.getOwner())?Array.from(s).reduce((e,t)=>{let[l,i]=t;return e[l]=i.quantity,e},{}):{},reconcileOwner:p,dispose(){r=!0,n+=1,s.clear(),d()}}),(0,eC.useEffect)(()=>{var e;null==(e=f.current)||e.reconcileOwner()}),(0,eC.useEffect)(()=>()=>{var e;h.current=!1,null==(e=f.current)||e.dispose()},[]),{changeQuantity:(e,t,l)=>{var i,a;if(!h.current||!g.current.canChange())return;let n=1===Number(e.is_track)&&0===Number(e.over_sold)?Number(e.stock_quantity):200,r=Math.max(0,Math.min(Number.isFinite(n)?n:200,Number((null==(i=e.item_rule_limit)?void 0:i.remainingMax)??200)));f.current.enqueue(e,t,l,{min:Number((null==(a=e.item_rule_limit)?void 0:a.min)??0),max:Math.floor(r)})},isPending:f.current.isPending,pending:f.current.isPending(),quantities:f.current.getTargets()}}({getOwner:()=>{var t;let l=eXv(q.getTempOrder());return[q,l&&"object"==typeof l?e3.sessionId:l,null==(t=q.getTempOrder())?void 0:t.customer_id,L,e3.sessionId,e2,E,null==tj?void 0:tj.productLineUid,tp,to,!1!==e.isActive]},readQuantity:e=>{var t;return e1_((null==(t=q.getTempOrder())?void 0:t.products)||[],{mode:E,scopeKey:L,parentLineUid:null==tj?void 0:tj.productLineUid}).filter(t=>String(t.product_id)===String(e.id)).reduce((e,t)=>e+Number(t.num||0),0)},applyQuantity:async(e,t)=>{let l=await tM.setProductQuantity(e,t);if("cancelled"===l.status)return!1;if("invalid"===l.status)throw Error(l.issues.map(e=>e.message).join(" "));return!!["added","updated","unchanged"].includes(l.status)||(t=>tz(async()=>{t()&&await tB(l,t)},e.id))},refreshActual:()=>{F.refreshCartSnapshot()},onError:e=>eb(e instanceof Error?e.message:String(e)),canChange:()=>!tG&&!eV.current}),tI=tT.isPending,tP=tM.rows.length>0||tN&&(tC.loading||!!tC.error||tC.products.some(e1p)),tA=!e0.menuListIds.length||!t_.loading&&!t_.error&&!t_.products.length,tD=tA||t_.loading||!!t_.error;(0,eC.useEffect)(()=>{!(!to||"payment"===Z||eU.current())&&("select"!==Z&&(tA||t_.error)?(en("product"),J("select")):"extras"!==Z||tP?"review"===Z&&tC.error&&J("extras"):J(e1H(O,L).complete?"review":"holder"))},[to,Z,tA,t_.error,tP,tC.error,O,L]);let tE=function(e){var t,l;let i=Array.from(new Set(e.dates)).sort().join(","),a=e.catalog.menuListIds.join(","),n=(0,eC.useMemo)(()=>e1h(e.searchRange),[null==(t=e.searchRange)?void 0:t.startDate,null==(l=e.searchRange)?void 0:l.endDate]),r=n.join(","),o=r||i,s=(0,eC.useMemo)(()=>({}),[e.os,e.ready,a,e.customerId,e.scopeKey,e.revision,e.resolvePolicy,e.mode,e.queries]),d=(0,eC.useMemo)(()=>({...e,queryScope:s,searchDates:n,menuIds:[...e.catalog.menuListIds]}),[e.os,e.ready,o,r,a,e.customerId,e.scopeKey,e.revision,e.resolvePolicy,e.mode,e.queries]),c=(0,eC.useMemo)(()=>i?i.split(","):[],[i]),u=(0,eC.useMemo)(()=>Array.from(new Set([...n,...c])).sort(),[n,c]),p=(0,eC.useMemo)(()=>u.reduce((e,t)=>(e[t]={status:d.menuIds.length?"loading":"unavailable"},e),{}),[d,u]),[m,g]=(0,eC.useState)(),h=(0,eC.useRef)(d);h.current=d;let v=(0,eC.useRef)(),f=(0,eC.useMemo)(()=>{var e;return{states:!r&&(null==(e=v.current)?void 0:e.searching)&&v.current.queryScope===s?{...v.current.states}:{},pending:new Set,visibleDates:c,projectionDates:u,pump:void 0}},[d]);(0,eC.useEffect)(()=>{v.current={queryScope:s,searching:!!r,states:f.states}},[f,s,r]);let y=(0,eC.useRef)(0),b=(0,eC.useRef)();return(0,eC.useEffect)(()=>{var e,t;let l=!0,i=()=>l&&h.current===d;if(g({request:d,states:{...f.states}}),!d.ready||!d.menuIds.length)return()=>{l=!1};let a=(null==(e=(t=d.resolvePolicy).createBatch)?void 0:e.call(t))??d.resolvePolicy,n=(e,t)=>{i()&&(f.states[e]=t,g({request:d,states:{...f.states}}))},r=async e=>{let t=f.projectionDates;try{let l=await d.queries.queryCatalogSnapshot({menu_list_ids:d.menuIds,schedule_date:e,...d.customerId?{customer_id:Number(d.customerId)}:{}});if(!i())return;let r=!1,o=!1;if(l.length){let n=await e1d(d.os,{products:l,productsFromSessionSnapshot:!0,date:e,mode:d.mode,queries:d.queries,projectionDateRange:e0G(e,t),catalogParams:{menu_list_ids:d.menuIds,...d.customerId?{customer_id:d.customerId}:{}},resolvePolicy:a,isCurrent:i,stopAtFirstAvailable:!0});r=n.available,o=!0===n.requiresConfiguration}n(e,{status:r?"available":o?"configuration":"unavailable"})}catch(t){n(e,{status:"error",reason:t instanceof Error?t.message:String(t)})}finally{var l;f.pending.delete(e),y.current--,null==(l=b.current)||l.call(b)}},o=e=>!f.pending.has(e)&&(!f.states[e]||"loading"===f.states[e].status),s=()=>{for(let t of d.searchDates){var e;let l=null==(e=f.states[t])?void 0:e.status;if("available"===l||"configuration"===l||"error"===l)break;if(o(t))return t}return f.visibleDates.find(o)},c=()=>{for(;i()&&y.current<2;){let e=s();if(!e)break;f.pending.add(e),y.current++,r(e)}};return f.pump=c,b.current=c,c(),()=>{l=!1,f.pump===c&&(f.pump=void 0),b.current===c&&(b.current=void 0)}},[d,f]),(0,eC.useEffect)(()=>{var e;f.visibleDates=c,f.projectionDates=u,null==(e=f.pump)||e.call(f)},[f,c,u]),(0,eC.useMemo)(()=>({...p,...(null==m?void 0:m.request)===d?m.states:f.states}),[m,d,p,f])}({os:q,ready:to&&!B,catalog:e0,dates:B?[]:G,customerId:e2,scopeKey:L,revision:eD,searchRange:tx,queries:tu,mode:"tickets"===E?"ticket":"party",resolvePolicy:tc}),tO=(0,eC.useRef)({date:W,scopeKey:L,customerId:e2,ready:to,sessionId:e3.sessionId,composerKey:null==er?void 0:er.key});tO.current={date:W,scopeKey:L,customerId:e2,ready:to,sessionId:e3.sessionId,composerKey:null==er?void 0:er.key};let tz=async(e,t)=>{if(!(eV.current||!to||tI())){eV.current=!0,ek(!0),eb(void 0),ew(null==t?void 0:String(t));try{await e()}catch(e){eQ.current&&eb(e instanceof Error?e.message:String(e))}finally{eV.current=!1,eQ.current&&(ek(!1),ew(void 0))}}},tL=async e=>{var t;let l=await $.ensureSalesSettings();if(!l)throw Error(V("Sales settings are unavailable. Please try again.","销售配置未就绪,请重试。"));return{overSold:iO({productOverSold:e.over_sold,runtimePolicy:{source:"picoding",settings:l,platform:$.salesSettingsPlatform||(null==(t=q.otherParams)?void 0:t.platform)}}),requiredOptionValidation:l.product.checkRequiredOptions}},tR=async function(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=arguments.length>3?arguments[3]:void 0,a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],n=e8.capture();a&&n("product_selected",{productId:e.id,editing:!!t,selectedDate:W});let r=t_.products.find(t=>String(t.id)===String(e.id))||e,o=r.price,s=("string"==typeof o||"number"==typeof o)&&""!==String(o).trim()&&Number.isFinite(Number(o))&&Number(o)>=0?Rv(r):void 0,d=null==s?void 0:s.amount,c="party"===E&&!i&&!t&&l;c&&(null==tt?void 0:tt.productId)===Number(e.id)&&(i=tt),"tickets"===E&&eo(void 0),ed(void 0),"party"!==E||t||Number(null==tj?void 0:tj.line.product_id)!==Number(e.id)||(t=null==tj?void 0:tj.productLineUid);let u=++eK.current,p={...tO.current},m=()=>eQ.current&&u===eK.current&&tO.current.scopeKey===p.scopeKey&&tO.current.date===p.date&&tO.current.customerId===p.customerId&&tO.current.sessionId===p.sessionId;eG.current=u,eN(String(e.id));try{var g;let n,r,o=B&&a?e07():void 0;if(o&&(await o,!m()))return!1;let p={menu_list_ids:e0.menuListIds,product_id:e.id,schedule_date:W,...e2?{customer_id:e2}:{},with_count:["bundleGroup","optionGroup"],with_schedule:1},h=a?await tu.prepareProductDetail({...p,retry:!0}):await tu.queryCatalogProductDetail(p);if(!m())return!1;if(t){let e=await e1B({os:q,queries:tu,mode:E,catalog:e0,scopeKey:L,customerId:e2,isCurrent:m});if(!(n=e.bindings.find(e=>e.productLineUid===t)))throw Error(e.issues.map(e=>e.message).join(" ")||"This booking could not be loaded.")}if(!m())return!1;let v=h&&n?{...h,_extend:{...h._extend,...(null==(g=n.product._extend)?void 0:g.capacity)?{capacity:n.product._extend.capacity}:{}}}:h;if(!v)throw Error(V("This product is no longer in this menu.","当前菜单已不包含该商品。"));let f=await tL(v);if(!m())return!1;let y=`${L}:${u}:${Date.now()}`,b=iD({productDetail:v,requestedProductId:e.id,completeness:"complete",mode:"tickets"===E?"ticket-booking":"product-configuration",openId:y,scopeKey:L,detailRevision:y,selectionKey:t||e.id,intent:t||i?"edit-draft":"create"});if("invalid"===b.status)throw Error(b.issues.map(e=>e.message).join(" "));let x=null==i?void 0:i.configuration,k=(null==x?void 0:x.skuValue)||(null==n?void 0:n.skuValue),_=k?iM(v,k,{...f,overSold:1===f.overSold}):void 0,w="ready"===b.status?b.plan.productDetail:b.productDetail,S=x?{...x,skuValue:_||x.skuValue}:n?{skuValue:_||n.skuValue,variantDraft:null}:e3q(w,1===f.overSold);if(i&&!_&&"no-configuration"===b.status)throw Error(V("The saved options are no longer available. Choose this Party again.","已保存的选项已不可用,请重新选择 Party 商品。"));let j={key:y,catalogStartingAmount:d,catalogPriceQualifier:null==s?void 0:s.qualifier,detail:w,configuration:S,lineUid:"party"===E?null==tj?void 0:tj.productLineUid:t,quantity:null==i?void 0:i.quantity,initialSelection:i?(r=i,e3I(r.selection)):null==n?void 0:n.selection,...f};return"tickets"===E&&"ready"===b.status&&"ticket-booking"===b.plan.mode?eo({...j,plan:b.plan}):"party"===E&&!l&&_?eo(j):"no-configuration"===b.status?(eo(j),en("time"),c&&e6(),D("#party-time")):"product-configuration"===b.plan.mode&&ed({plan:b.plan,configuration:S,partyDraft:j,...f}),J("select"),!0}catch(t){throw a&&n("product_open_failed",{productId:e.id,...e2x(t)},"warning"),t}finally{eQ.current&&u===eG.current&&eN(void 0)}};(0,eC.useEffect)(()=>{if(!te||!e3.ready||e3.pendingOrder||!1===e.isActive||!ep)return;let t=!0;return ef(!0),eh(void 0),(async()=>{try{let e=function(e){if((null==e?void 0:e.version)!==1||!["configuration","booking"].includes(e.phase))throw Error("Invalid saved Party preview.");return e3P({detail:{id:e.productId},quantity:e.quantity,lineUid:e.lineUid,configuration:e.configuration,initialSelection:e.selection},e.phase)}(ep.value),l=await tR({id:e.productId},e.lineUid,"configuration"===e.phase,e,!1);if(!t)return;if(!l)throw Error(V("The draft changed. Retry restoring your Party selection.","草稿已变化,请重试恢复 Party 选择。"));en("time"),em(void 0)}catch(e){t&&eh(e instanceof Error?e.message:String(e))}finally{t&&ef(!1)}})(),()=>{t=!1,++eK.current}},[te,e3.ready,e3.pendingOrder,e.isActive,ep,q,L,W,e2]);let t$=async(e,t)=>{if(tK||er||es||tO.current.scopeKey!==L||tO.current.sessionId!==e3.sessionId||tO.current.customerId!==e2)return!1;let l=!1;return await tz(async()=>{let i=q.getTempOrder(),a=eXv(i),n=null==i?void 0:i.customer_id,r={...tO.current},o=()=>eQ.current&&tO.current.ready&&tO.current.scopeKey===r.scopeKey&&tO.current.sessionId===r.sessionId&&tO.current.customerId===r.customerId&&(null==i?void 0:i.customer_id)===n&&q.getTempOrder()===i&&eXv(i)===a,s=new Set(e);if(!i||Number(i.order_id||0)>0||!s.size||s.size!==e.length||e.some(e=>!e))throw Error(V("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));let d=i.products||[],c=d.filter(e=>s.has(e1E(e))),u="tickets"===E?"tickets":"party_main";if(c.length!==s.size||c.some(e=>{var t,l;return(null==(t=e.metadata)?void 0:t.venue_booking_role)!==u||(null==(l=e.metadata)?void 0:l.venue_booking_scope_key)!==L})||new Set(c.map(e1E)).size!==s.size)throw Error(V("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));if(t&&("tickets"!==E||0!==t.index||1!==s.size||!s.has(t.uid)||1!==Number(c[0].num)))throw Error(V("This saved ticket cannot be removed individually. Remove its cart group instead.","此历史门票无法逐张删除,请删除对应购物车组。"));let p="tickets"===E&&!d.some(e=>{var t,l;return(null==(t=e.metadata)?void 0:t.venue_booking_role)==="tickets"&&(null==(l=e.metadata)?void 0:l.venue_booking_scope_key)===L&&!s.has(e1E(e))}),m=d.filter(e=>{var t,l,i;return s.has(e1E(e))||(null==(t=e.metadata)?void 0:t.venue_booking_scope_key)===L&&("party"===E&&(null==(l=e.metadata)?void 0:l.venue_booking_role)==="party_extra"&&s.has(String(e.metadata.venue_booking_parent_uid||""))||p&&(null==(i=e.metadata)?void 0:i.venue_booking_role)==="tickets_extra")}),g=new Set(m.map(e1E));if(g.has("")||g.size!==m.length||d.filter(e=>g.has(e1E(e))).length!==m.length)throw Error(V("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));let h=JSON.stringify([i.products,i.bookings,i.notes,i.holder_relations]),v=()=>{if(!o()||h!==JSON.stringify([i.products,i.bookings,i.notes,i.holder_relations]))throw Error(V("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"))};if("function"!=typeof q.removeProductsFromOrder)throw Error("The booking cart service needs to be updated.");v();try{if(await q.removeProductsFromOrder(m.map(e_f),{beforeApply:v,isCurrentOrder:o}),!o())return;F.refreshCartSnapshot(),eE(e=>e+1),e1H(O,L).enabled||eA(!1),eo(void 0),e1F(q.getTempOrder(),{mode:E,scopeKey:L}).bindings.length||(eA(!1),J("select")),l=!0}catch(e){throw o()&&(F.refreshCartSnapshot(),eE(e=>e+1),e1H(O,L).enabled||eA(!1),e1F(q.getTempOrder(),{mode:E,scopeKey:L}).bindings.length||(eA(!1),J("select"))),e}}),l},tF=e=>t$(e),tq=async(e,t)=>{if(B)return e===W;if(!eS()(e).isValid()||e<U)return!1;let l=e8.capture();if(e===W)return ee(!0),en("product"),l("date_selected",{previousDate:W,selectedDate:e}),!0;if(eV.current||tI())return;eV.current=!0,ek(!0);let i=eXv(q.getTempOrder()),a=q.getTempOrder(),n=()=>{if(!eQ.current||!tO.current.ready||tO.current.date!==W||eXv(q.getTempOrder())!==i)throw Error(V("The draft changed. Please choose the date again.","草稿已变化,请重新选择日期。"))};try{let o,s,d=e1F(q.getTempOrder(),{mode:E}).bindings;if("tickets"===E&&d.length){var r;if(!await new Promise(e=>eT.Modal.confirm({title:V("Change the date for this order?","更改整单日期?"),content:V("All tickets will be removed so you can choose them again for the new date.","订单中的全部门票将移除,请按新日期重新选择。"),okText:V("Change date","更改日期"),cancelText:V("Keep date","保留日期"),onOk:()=>e(!0),onCancel:()=>e(!1)}))||!eQ.current)return eQ.current&&l("date_change_cancelled",{previousDate:W,selectedDate:e}),!1;n();let t=e1F(q.getTempOrder(),{mode:E}).bindings,o=e1_((null==(r=q.getTempOrder())?void 0:r.products)||[],{mode:E,scopeKey:L});if(await q.removeProductsFromOrder([...t.map(e=>e.identity),...o.map(e_f)],{isCurrentOrder:()=>eQ.current&&q.getTempOrder()===a&&eXv(q.getTempOrder())===i}),n(),e1F(q.getTempOrder(),{mode:E}).bindings.length)throw Error("The cart changed. Please review the tickets before changing date.");eo(void 0),ed(void 0),await e4()}if(n(),"party"===E&&er){let l=await tu.queryCatalogProductDetail({menu_list_ids:e0.menuListIds,product_id:Number(er.detail.id),schedule_date:e,...e2?{customer_id:e2}:{},with_count:["bundleGroup","optionGroup"],with_schedule:1});if(n(),!l)throw Error(V("This Party is unavailable on the selected date. Choose another date or product.","该商品在所选日期不可用,请选择其他日期或商品。"));let i=await tL(l);n();let a=`${L}:date:${++eK.current}:${Date.now()}`,r=iD({productDetail:l,requestedProductId:er.detail.id,completeness:"complete",mode:"product-configuration",openId:a,scopeKey:L,detailRevision:a,selectionKey:er.lineUid||er.detail.id,intent:"edit-draft"});if("invalid"===r.status)throw Error(r.issues.map(e=>e.message).join(" "));let d=(null==t?void 0:t.configuration)||er.configuration,c=iM(l,d.skuValue,{...i,overSold:1===i.overSold}),u={...er,key:a,detail:l,...i,quantity:(null==t?void 0:t.quantity)??er.quantity,initialSelection:(null==t?void 0:t.initialSelection)||er.initialSelection};c?o={...u,configuration:{skuValue:c,variantDraft:null}}:"ready"===r.status&&"product-configuration"===r.plan.mode?s={plan:r.plan,configuration:d,partyDraft:u,...i}:o={...u,configuration:eXh(Number(l.id))}}return n(),++eK.current,eo(o),ed(s),K(e),ee(!0),en(o?"time":"product"),J("select"),eb(void 0),l("date_selected",{previousDate:W,selectedDate:e}),!0}catch(t){throw l("date_change_failed",{previousDate:W,selectedDate:e,...e2x(t)},"warning"),t}finally{eV.current=!1,eQ.current&&ek(!1)}},tB=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;if(t()){if("invalid"===e.status)throw Error(e.issues.map(e=>e.message).join(" "));if("choose-line"===e.status)return void ez(e.rows);if("direct"===e.status)return void await tM.commit(e.session,e.configuration);if("ready"===e.status){let l=await tL(e.session.productDetail);if(!t())return;let i=e.session.lineUid?e.configuration:e3q(e.plan.productDetail,1===l.overSold);ed({plan:e.plan,configuration:i,extraSession:e.session,...l})}}},tH=()=>{var e;let t=q.getTempOrder(),l={mode:E,scopeKey:L,parentLineUid:null==tj?void 0:tj.productLineUid};if(!e1_((null==t?void 0:t.products)||[],l).length)return!0;if(tC.loading||tC.error)return eb(tC.error||V("The extras menu is loading. Please try again.","附加商品菜单正在加载,请稍后重试。")),J("extras"),A.close(),!1;let i=function(e,t,l){if(!e)return;let i=e1_(e.products||[],l);if(!i.length)return;let a=new Map(t.map(e=>[Number(e.id),e]));return i.find(t=>{let l=a.get(Number(t.product_id)),i=t.product_variant_id;return!!Ho(e1y(l,i,t)).required&&!e1b(l,i,Number(t.num),UO(t,e.holder_relations),e.customer_id??void 0,t)})}(t,tC.products,l);return!i||((e=>{J("extras"),A.close();let t=V("Complete the holder details for this extra.","请补全这件附加商品的 Holder 资料。");if(eb(t),!e||eV.current||tI())return;let l=tO.current,i=eXv(q.getTempOrder()),a=()=>eQ.current&&tO.current.ready&&tO.current.scopeKey===l.scopeKey&&tO.current.sessionId===l.sessionId&&tO.current.customerId===l.customerId&&eXv(q.getTempOrder())===i;tz(async()=>{let l=await tM.prepareEdit(e);if(a()){if("invalid"===l.status)throw Error(l.issues.map(e=>e.message).join(" "));"ready"===l.status&&await tB(l,a),a()&&eb(t)}})})(String((null==(e=i.metadata)?void 0:e.unique_identification_number)??"")),!1)},tV=async()=>{if(tW.pending||tW.error||er||es||!eX.current||!to||tD||tI()||tP&&(tC.loading||tC.error))return!1;eb(void 0);let e=e1H(O,L);if(!e.complete||e.pending||e.blocked)return J("holder"),!1;if(!tH()||!await eX.current.validate())return!1;await F.waitForCartConsistency();let t=eXv(q.getTempOrder()),l={...tO.current};return eQ.current&&tO.current.ready&&tO.current.scopeKey===l.scopeKey&&tO.current.date===l.date&&tO.current.customerId===l.customerId&&eXv(q.getTempOrder())===t&&tH()},tU=function(e){var t;let l=function(e){var t,l,i,a,n;s2(eMn,e.locale),s2(e3n,e.locale);let r=e$(),o=eq(),s=exR(),d=e.context.sales.bookingTicket,c=String((null==d||null==(t=d.otherParams)?void 0:t.platform)||o||"").trim().toLowerCase(),u=null==d||null==(l=d.otherParams)?void 0:l.venueBookingMode,p="kiosk"===c&&("tickets"===u||"party"===u),m=null==r||null==(n=r.appHelper)||null==(a=n.utils)||null==(i=a.getApp)?void 0:i.call(a),g=eA0(m),h=(0,eC.useRef)(e);h.current=e;let v=(0,eC.useRef)(!0),f=(0,eC.useRef)(!1),y=(0,eC.useRef)(!1),b=(0,eC.useRef)(),x=(0,eC.useRef)(new Set),k=(0,eC.useRef)(),_=(0,eC.useRef)(),w=(0,eC.useRef)(),S=(0,eC.useRef)(),[j,N]=(0,eC.useState)(null),[C,M]=(0,eC.useState)(!1),[T,I]=(0,eC.useState)(!1),[P,A]=(0,eC.useState)(null),[D,E]=(0,eC.useState)(),[O,z]=(0,eC.useState)(null),[L,R]=(0,eC.useState)(10),[$,F]=(0,eC.useState)(!1);(0,eC.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,eC.useEffect)(()=>{_.current=void 0,k.current=void 0,w.current=void 0,N(null),E(void 0),z(null),A(null)},[e.scopeKey,e.sessionId,d]);let q=o3(async e=>{if(!p&&!O||f.current||b.current||y.current||!v.current)return!1;let t=h.current.onKioskFinish;if(!t)return!1;y.current=!0,F(!0),A(null);try{if(!await t({navigateHome:e}))throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.reset-failed")));return v.current&&z(null),!0}catch(e){return v.current&&A(e49(e)||String(eL.getText("pisell2.venue-kiosk.checkout.reset-failed"))),!1}finally{y.current=!1,v.current&&F(!1)}}),B=o3(()=>q(!0)),H=o3(()=>q(!1)),V=o3(()=>!!(f.current||b.current)),U=o3(()=>V()?new Promise(e=>{x.current.add(e)}):Promise.resolve()),Y=o3(()=>{if(V())return;let e=[...x.current];x.current.clear(),e.forEach(e=>e())}),W=o3(async()=>{var e;await (null==(e=S.current)?void 0:e.page.onBack())}),K=o3(async()=>{var e,t,l,i,a,n,r,o,d,c,u,x,j,C,T,P,D,L,R,$,F;let q,B,H;if(!p||f.current||b.current||y.current||!1===h.current.isActive||!v.current)return!1;let V=h.current,U=V.context,W=U.sales.bookingTicket;if(!W)return!1;let K=(null==(e=W.getTempOrder)?void 0:e.call(W))??U.sales.tempOrder,G=e3k(K),Q=()=>v.current&&h.current.scopeKey===V.scopeKey&&h.current.sessionId===V.sessionId&&h.current.context.sales.bookingTicket===W,Z=()=>Q()&&!1!==h.current.isActive,J=()=>{var e;if(!Z()||e3k(null==(e=W.getTempOrder)?void 0:e.call(W))!==G)throw Error("BOOKING_SELECTION_CHANGED")},X=e=>{let t=e3x(e);if(t&&Q()&&(_.current=t,E(t),k.current!==t)){var l;k.current=t,null==(l=V.onOrderSubmitted)||l.call(V,t)}};f.current=!0,M(!0),A(null);let ee=!1,et=!1;try{let e,p;if(!await s.ensureCanShop()||!Z())return!1;if(await U.cart.waitForCartConsistency(),J(),_.current&&e3x(null==(c=W.getTempOrder)||null==(d=c.call(W))?void 0:d.order_id)!==_.current){let e=null==(u=W.getTempOrder)?void 0:u.call(W);if((null==e||null==(x=e.products)?void 0:x.length)||(null==e||null==(j=e.bookings)?void 0:j.length)||(await U.sales.loadDetailByRemote(Number(_.current)),!Z()))return!1;K=(null==(C=W.getTempOrder)?void 0:C.call(W))??U.sales.tempOrder,G=e3k(K)}let f=!!(O&&w.current&&w.current.scopeKey===V.scopeKey&&w.current.sessionId===V.sessionId&&w.current.source===W&&(w.current.identity===G||_.current&&e3x(null==(F=W.getTempOrder)||null==($=F.call(W))?void 0:$.order_id)===_.current));if(!f&&V.beforeCheckout&&!await V.beforeCheckout())return!1;J(),b.current=q=g(),B=q.hold(),await q.pause(),J();let y=null==m||null==(i=m.history)||null==(l=i.instance)||null==(t=l.block)?void 0:t.call(l,()=>!1);"function"==typeof y&&(H=y),I(!0);let k=async()=>(J(),(!!f||!!await h.current.beforeSubmit())&&(await U.cart.waitForCartConsistency(),J(),w.current={scopeKey:V.scopeKey,sessionId:V.sessionId,source:W,identity:G},(ee=await s.beginCheckout())&&Z())),M=(null==(a=W.getTempOrder)?void 0:a.call(W))??K,A=(null==(r=W.getOrderAmountSnapshot)||null==(n=r.call(W))?void 0:n.summary)??(null==M?void 0:M.summary)??U.summary.summary,E=e3b(W),el=E.readAmount(W),ei=s.enabled&&!s.requirePaymentOnSubmit;if(!ei&&(void 0===el||!Number.isFinite(el)||el<0))throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")));let ea=0===el;if((ei||ea)&&!_.current){let e=E,t=ei?{paymentExecution:"deferred"}:{},l=await U.cart.submit(t,{validateHolder:!0,beforeSubmit:async()=>{if(!await k())return!1;if(!ei){var l,i;if(e=e3b(W),0!==e.readAmount(W))throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")));Object.assign(t,eUc(null==(i=W.getTempOrder)||null==(l=i.call(W))?void 0:l.payments))}return!0}});if(!Z())return!1;if(!eA5(l))throw Error(e49(l));let i=eUa(l,(null==(T=W.getTempOrder)?void 0:T.call(W))??M);if(!i)throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")));if(X(i.orderId),ea&&!ei){let a=(null==(P=W.getTempOrder)?void 0:P.call(W))??M,n=eUd(l,null==a?void 0:a.summary,A),r=null==(R=W.store)||null==(L=R.order)||null==(D=L.getPaymentCompletion)?void 0:D.call(L);if((null==r?void 0:r.isDepositFullyPaid)===!0&&!0!==r.isOrderFullyPaid){let t=e.inspectCompletion(W,{...r,submitResult:l},"kiosk");if("paid"!==t.kind||"deposit-paid"!==t.paymentStatus)throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")));z({kind:"payment",viewModel:eA_({baseSales:W,status:"deposit-paid",displayMode:"page",currencySymbol:null==a?void 0:a.currency_symbol})})}else if(eUu({result:l,orderId:i.orderId,totalAmount:n}).ok)z({kind:"payment",viewModel:t.confirmPendingVoucherPayments?eA_({baseSales:W,status:"success",displayMode:"page",currencySymbol:null==a?void 0:a.currency_symbol}):eUp({summary:(null==a?void 0:a.summary)??A,currencySymbol:null==a?void 0:a.currency_symbol})});else throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")))}else z({kind:"submitted",order:i});return!0}if(await U.sales.validateHoldersBeforePayment(),J(),U.sales.contactInfo&&!await U.sales.contactInfo.ensureComplete()||!await k())return!1;J();let en=function(e){var t,l;let{baseSales:i,isCurrent:a}=e,n=null==(t=i.getTempOrder)?void 0:t.call(i),r=e3p(null==n||null==(l=n._extend)?void 0:l.localId),o=e3p(null==n?void 0:n.external_sale_number),s=e3h(n);return Object.freeze({assertCurrent(){var e,t;let l=null==(e=i.getTempOrder)?void 0:e.call(i),d=r?e3p(null==l||null==(t=l._extend)?void 0:t.localId)===r:o?e3p(null==l?void 0:l.external_sale_number)===o:l===n;if(!n||!l||!a()||!d||e3h(l)!==s)throw Error("BOOKING_SELECTION_CHANGED")}})}({baseSales:W,isCurrent:Z});en.assertCurrent();let er=e3b(W),eo=er.readAmount(W);if(void 0===eo||!Number.isFinite(eo)||eo<0)throw Error(String(eL.getText("pisell2.venue-kiosk.checkout.failed")));let es=()=>e||(e=(async()=>{try{ee&&b.current===q&&s.endCheckout()}catch(e){console.warn("[VenueBooking] Payment checkout cleanup failed",e)}finally{ee=!1;try{null==H||H()}catch(e){console.warn("[VenueBooking] Payment navigation cleanup failed",e)}H=void 0,null==B||B(),B=void 0,await q.release(),b.current===q&&(b.current=void 0),S.current===p&&(S.current=void 0,v.current&&(N(null),I(!1))),Y()}})()),ed={id:`${V.sessionId||"venue"}:payment:${++e3_}`,preparation:en,paymentPolicy:er,onBack:async()=>{var e,t;if(!p.completed&&Z()&&S.current===p&&er.canReturn(W)){p.completed=!0;try{U.cart.refreshCartSnapshot()}catch(e){console.warn("[VenueBooking] Payment cart refresh failed",e)}finally{await es()}Z()&&(null==(e=(t=h.current).onKioskPaymentPageBack)||e.call(t))}},onPaid:async e=>{if(!p.completed){p.completed=!0;try{if(Q()&&S.current===p){z({kind:"payment",viewModel:e.paymentResult});try{X(e.orderId)}catch(e){console.warn("[VenueBooking] Paid order notification failed",e)}try{U.cart.refreshCartSnapshot()}catch(e){console.warn("[VenueBooking] Paid cart refresh failed",e)}}}finally{await es()}}},onDisposed:async()=>{var e,t;let l=!p.completed&&Q()&&S.current===p;p.completed=!0,await es(),l&&Q()&&(null==(e=(t=h.current).onKioskPaymentPageBack)||e.call(t))}};return S.current=p={page:ed,completed:!1},et=!0,z(null),N(ed),null==(o=V.onKioskPaymentPageOpen)||o.call(V),!0}catch(e){if(e===UN||!Z())return!1;return A(e49(e)||String(eL.getText("pisell2.venue-kiosk.checkout.failed"))),!1}finally{et||(ee&&s.endCheckout(),H&&H(),null==B||B(),await (null==q?void 0:q.release()),b.current===q&&(b.current=void 0)),f.current=!1,Y(),v.current&&(M(!1),et||I(!1))}}),G=(null==O?void 0:O.kind)==="submitted"||(null==O?void 0:O.kind)==="payment"&&["success","deposit-paid"].includes(O.viewModel.status);return(0,eC.useEffect)(()=>{if(!p&&!O||!G||C||T||!1===e.isActive)return void R(10);let t=Date.now()+1e4,l=window.setInterval(()=>R(Math.max(0,Math.ceil((t-Date.now())/1e3))),1e3),i=window.setTimeout(()=>{B()},1e4);return()=>{window.clearInterval(l),window.clearTimeout(i)}},[p,G,O,C,T,e.isActive,B]),{enabled:p,checkout:K,submitting:C,error:P,submittedOrderId:D,failure:null,confirmFailure:async()=>{},resettingFailure:!1,resetError:null,kioskPaymentResult:O,kioskPaymentPage:j,backToReview:W,paymentActive:T,isPaymentActive:V,waitForPaymentIdle:U,backHomeCountdown:L,resettingHome:$,returnHome:B,startNewOrder:H}}(e),i=e$(),a=eq(),n=exR(),r=UM(),o=UD(),s=(0,eC.useRef)(e);s.current=e;let d=(0,eC.useRef)(!0),c=(0,eC.useRef)(!1),u=(0,eC.useRef)(null),p=(0,eC.useRef)(null),m=(0,eC.useRef)(null),g=(0,eC.useRef)(!1),h=(0,eC.useRef)(null),[v,f]=(0,eC.useState)(!1),[y,b]=(0,eC.useState)(null),[x,k]=(0,eC.useState)(),[_,w]=(0,eC.useState)("idle"),[S,j]=(0,eC.useState)(null),[N,C]=(0,eC.useState)(!1),[M,T]=(0,eC.useState)(null),I=String(e.locale||"").startsWith("zh"),P=(e,t)=>I?t:e,A=(null==i||null==(t=i.appHelper)?void 0:t.utils)||{};(0,eC.useEffect)(()=>(d.current=!0,()=>{var e;d.current=!1,null==(e=h.current)||e.call(h,!1),h.current=null;let t=u.current;t&&z(t).catch(()=>{})}),[]),(0,eC.useEffect)(()=>{u.current=null,p.current=null,m.current=null,j(null),b(null),T(null),k(void 0),w("idle")},[e.scopeKey,e.sessionId,e.context.sales.bookingTicket]);let D=o3(async()=>{let e=m.current;if(e&&!g.current){if(!(e.resetStarted?e.isSameSession():e.isCurrent())){m.current=null,j(null);return}g.current=!0,e.resetStarted=!0,C(!0),T(null);try{if(!await e.reset()&&e.isSameSession())throw Error(P("Could not reset the cart. Please try again.","购物车清空失败,请重试。"));m.current===e&&(m.current=null,j(null),b(null))}catch(t){d.current&&e.isSameSession()&&T(e49(t)||P("Could not reset the cart. Please try again.","购物车清空失败,请重试。"))}finally{g.current=!1,d.current&&C(!1)}}}),E=e=>{var t,l,i;let a=A.history||(null==(l=A.getApp)||null==(t=l.call(A))?void 0:t.history);if("function"==typeof(null==a?void 0:a.replace))a.replace(e);else{let t=(null==(i=window.location.pathname.match(/^\/(en|zh-CN|zh-HK|ja|pt)(?=\/|$)/i))?void 0:i[0])||"";window.location.replace(`${t}${e}`)}},O=e=>u.current===e&&s.current.scopeKey===e.scopeKey&&s.current.sessionId===e.sessionId&&s.current.context.sales.bookingTicket===e.context.sales.bookingTicket,z=async e=>{if(e.resetTask)return e.resetTask;if(!e.resetDone&&O(e)){e.resetTask=(async()=>{var t,l;let i=null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l);(e3S(e.context)===e.identity||String((null==i?void 0:i.order_id)||"")===e.orderId)&&await e.finishPayment(e.orderId),e.resetDone=!0})();try{await e.resetTask}finally{e.resetTask=void 0}}},L=async function(e){var t,l;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.log,a=()=>d.current&&!1!==s.current.isActive&&s.current.scopeKey===e.scopeKey&&s.current.sessionId===e.sessionId&&s.current.context.sales.bookingTicket===e.context.sales.bookingTicket;if(!a())return;let n=!1,r=()=>{n||(n=!0,null==i||i("payment_handoff",{orderId:e.orderId,kind:e.kind}))},o=()=>z(e);if("deferred"===e.kind||"virtual"===e.kind){if(await o(),!a())return;E("deferred"===e.kind?`/order/details?id=${encodeURIComponent(e.orderId)}`:`/payment-finish/success?amount=${encodeURIComponent(String(e.totalAmount))}&order_id=${encodeURIComponent(e.orderId)}`),r();return}if("function"!=typeof A.action)throw Error(P("Payment is unavailable. Please reopen this order to pay.","支付入口不可用,请从订单详情继续支付。"));let c={target:e,sessionId:`${e.sessionId||"venue"}:${Date.now()}:${++e3w}`,terminal:!1};p.current=c,d.current&&w("opening"),await eW9({action:e=>{a()&&(A.action(e),r())},clearCartAndReset:o,freePay:efD,onFreePayFailure:e=>{throw Error(String((null==e?void 0:e.message)||P("Payment failed. Please try again.","支付失败,请重试。")))},onResetError:e=>console.error("[VenueBooking] Order submitted; local cleanup failed",e),orderId:e.orderId,preparePayments:e.preparePayments,persistCatalogView:()=>{},recalcSummary:async()=>void 0,redirectZeroAmount:(t=e.platform,l=e.totalAmount,"h5"===String(t||"").trim().toLowerCase()&&0===eUn(l)),replace:e=>{a()&&(E(e),r())},totalAmount:e.totalAmount,paymentSessionId:c.sessionId,onPaymentLifecycle:t=>{if(!t||"object"!=typeof t||!("key"in t)||"payment_lifecycle"!==t.key||!("data"in t))return;let l=t.data;if(l&&l.session_id===c.sessionId&&String(l.order_id)===e.orderId&&p.current===c&&!c.terminal&&O(e)){if("opened"===l.phase){d.current&&w("open");return}if("launch_failed"===l.phase){c.terminal=!0,d.current&&(w("failed"),b(("string"!=typeof l.reason||/^[a-z][a-z0-9_]*$/i.test(l.reason)?void 0:l.reason)||P("Payment could not be opened. Please try again.","支付入口未能打开,请重试。")));return}("dismissed"===l.phase||"redirecting"===l.phase)&&(c.terminal=!0,d.current&&w("closing"),o().then(()=>{d.current&&O(e)&&p.current===c&&w("closed")}).catch(t=>{d.current&&O(e)&&p.current===c&&(w("closed"),b(e49(t)||P("Could not clear this completed checkout.","结账页面清理失败。")))}))}}})},R=o3(async()=>{var e,t,l,p,g,v,y,x,_,S,N,C,M,T,I;if(c.current||m.current||!(d.current&&!1!==s.current.isActive))return!1;c.current=!0,f(!0),b(null);let D=!1,E=!1,O=s.current,{context:z}=O,R=z.sales.bookingTicket,$=e3S(z),F=()=>d.current&&!1!==s.current.isActive&&s.current.scopeKey===O.scopeKey&&s.current.sessionId===O.sessionId&&s.current.context.sales.bookingTicket===R,q=()=>F()&&e3S(s.current.context)===$,B={isCurrent:q,isSameSession:F,reset:O.onFailureConfirmed},H=null==(e=O.operationLog)?void 0:e.capture();null==H||H("checkout_requested",{retrySubmittedOrder:!!u.current,submittedOrderId:null==(t=u.current)?void 0:t.orderId});try{if(u.current){let e=u.current;if(O.scopeKey!==u.current.scopeKey||O.sessionId!==u.current.sessionId||R!==u.current.context.sales.bookingTicket)return!1;return await L(e,H),!0}let e=String(n.platform||(null==R||null==(l=R.otherParams)?void 0:l.platform)||a||"").toLowerCase();if(!R||!["pc","h5"].includes(e))throw Error(P("Open this booking from the customer website.","请从用户端预约页面打开。"));if(!r.holderConfirm)throw Error(P("Booking confirmation is unavailable. Please reload.","预订确认服务未就绪,请刷新页面。"));if(!await n.ensureCanShop()||!q())return!1;let t=(null==i||null==(v=i.appHelper)||null==(g=v.constants)||null==(p=g.config)?void 0:p.channel)||e;if(UI(t)&&!o.isLoggedIn()&&(!await new Promise(e=>{h.current=e,o.openLoginModal({callback:t=>{h.current=null,e("success"===t)}})||(h.current=null,e(!1))})||!q())||(await z.cart.waitForCartConsistency(),!q()||s.current.beforeCheckout&&!await s.current.beforeCheckout()||!q()))return!1;let d=(null==(y=R.getTempOrder)?void 0:y.call(R))??z.sales.tempOrder;if(!(null==d||null==(x=d.products)?void 0:x.length)&&!(null==d||null==(_=d.bookings)?void 0:_.length))return!1;let c=n.enabled&&!n.requirePaymentOnSubmit,m=!!(z.sales.enableMultiCurrencySettlement&&YC(d));if(!c&&!m&&"function"!=typeof A.action)throw Error(P("Payment is unavailable. Please reload.","支付入口未就绪,请刷新页面。"));let f=null,b=c?{paymentExecution:"deferred"}:{},w=await z.cart.submit(b,{validateHolder:!0,beforeSubmit:async()=>{var t,l,i;if(!q()||"function"!=typeof s.current.beforeSubmit||!await s.current.beforeSubmit()||(await z.cart.waitForCartConsistency(),!q()))return!1;let a=null==(t=R.getWalletAssetsState)?void 0:t.call(R);f=c||m?null:eW7({platform:e,shouldUseConsumerPayment:!0,payments:null==(i=R.getTempOrder)||null==(l=i.call(R))?void 0:l.payments,selectedItems:null==a?void 0:a.selectedItems,items:null==a?void 0:a.items}),Object.assign(b,null==f?void 0:f.submitParams);let r=(D=await n.beginCheckout())&&q();return E=r,r}}),j=[w,null==w?void 0:w.data,null==w?void 0:w.response,null==w||null==(S=w.data)?void 0:S.response].filter(e=>e4J(e))[0];if(j||!eA5(w))throw Error(e49(j||w)||P("Booking could not be submitted.","预订提交失败。"));let I=eUa(w,d??null);if(!I)throw Error(P("The checkout response did not include an order number.","结账接口未返回订单编号。"));if(null==H||H("order_created",{orderId:I.orderId,deferred:c,virtual:m}),null==(N=O.onOrderSubmitted)||N.call(O,I.orderId),!F())return!1;let B=null==(C=R.getTempOrder)?void 0:C.call(R),V=e3S(z)===$||String((null==B?void 0:B.order_id)||"")===I.orderId;V&&(null==(M=R.clearSessionStorageOrderSnapshot)||M.call(R));let U=e3a({result:w,amountSnapshot:V?null==(T=R.getOrderAmountSnapshot)?void 0:T.call(R):void 0,order:V?B:void 0});if(!c&&null===eUn(U))return u.current={orderId:I.orderId,totalAmount:U,kind:"deferred",platform:e,context:z,identity:$,resetDone:!1,finishPayment:O.onPaymentFinished,scopeKey:O.scopeKey,sessionId:O.sessionId,log:H},k(I.orderId),await L(u.current),!0;return u.current={orderId:I.orderId,totalAmount:U,kind:c?"deferred":m?"virtual":"payment",preparePayments:null==f?void 0:f.preparePayments,platform:e,context:z,identity:$,resetDone:!1,finishPayment:O.onPaymentFinished,scopeKey:O.scopeKey,sessionId:O.sessionId,log:H},k(I.orderId),await L(u.current),!0}catch(t){if(t===UN||!F())return null==H||H("checkout_cancelled",{reason:t===UN?"holder_confirmation":"session_changed"}),!1;null==H||H(u.current?"payment_handoff_failed":"checkout_failed",{orderId:null==(I=u.current)?void 0:I.orderId,admittedToSubmit:E,...e2x(t)},"warning");let e=e49(t)||P("Booking could not be submitted.","预订提交失败。");if(E&&!u.current&&q()){let t={...B,message:e,resetStarted:!1};m.current=t,j(t)}else b(e),u.current&&w("failed");return!1}finally{D&&n.endCheckout(),c.current=!1,d.current&&f(!1)}});return l.enabled||l.isPaymentActive()||l.kioskPaymentResult?{...l,canRetryPayment:!1,retryPayment:l.checkout}:{checkout:R,submitting:v,error:y,submittedOrderId:x,failure:S,confirmFailure:D,resettingFailure:N,resetError:M,kioskPaymentResult:null,paymentActive:!1,isPaymentActive:l.isPaymentActive,kioskPaymentPage:null,backToReview:l.backToReview,waitForPaymentIdle:l.waitForPaymentIdle,backHomeCountdown:l.backHomeCountdown,canRetryPayment:!!(x&&!v&&("failed"===_||"closed"===_)),retryPayment:R,resettingHome:!1,returnHome:l.returnHome,startNewOrder:l.startNewOrder}}({context:O,isActive:e.isActive,locale:H,scopeKey:L,sessionId:e3.sessionId,operationLog:e8,beforeSubmit:tV,beforeCheckout:()=>{var e;return!tW.pending&&!tW.error&&!tI()&&tH()&&((null==(e=eX.current)?void 0:e.validateContact())??!1)},onOrderSubmitted:e3.discard,onFailureConfirmed:e3.restart,onPaymentFinished:e3.finishSubmitted,onKioskFinish:e=>eW.current(e),onKioskPaymentPageOpen:()=>{A.close(),eF(!1),eb(void 0),J("payment")},onKioskPaymentPageBack:()=>{eb(void 0),J("review")}});eU.current=tU.isPaymentActive,eY.current=tU.waitForPaymentIdle;let tY=function(e){var t,l,i,a,n;let r=e$(),o=null==r||null==(i=r.appHelper)||null==(l=i.utils)||null==(t=l.getApp)?void 0:t.call(l),s=(0,eC.useRef)(e);s.current=e;let d=(0,eC.useRef)();e.sessionId&&((null==(a=d.current)?void 0:a.source)!==e.source||d.current.sessionId!==e.sessionId)?d.current={source:e.source,sessionId:e.sessionId,session:e.session,onReset:e.onReset,onRequestHome:e.onRequestHome}:(null==(n=d.current)?void 0:n.source)===e.source&&e.sessionId&&(d.current.session=e.session,d.current.onReset=e.onReset,d.current.onRequestHome=e.onRequestHome);let c=d.current,u=(0,eC.useRef)(!0),p=(0,eC.useRef)(0),m=(0,eC.useRef)(),g=(0,eC.useRef)(),[h,v]=(0,eC.useState)(!1),[f,y]=(0,eC.useState)(),b=()=>s.current.isPaymentActive?s.current.isPaymentActive():s.current.paymentActive,x=async e=>{if(e)await e();else{var t;if("function"!=typeof(null==o||null==(t=o.history)?void 0:t.replace))throw Error("Home navigation is unavailable. Please try again.");await o.history.replace("/")}},k=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!s.current.enabled||b())return Promise.resolve(!1);if(!e||e.source!==s.current.source){if(!t)return Promise.resolve(!1);if(g.current)return g.current;let e=s.current.source,l=s.current.onRequestHome,i=(async()=>{u.current&&(v(!0),y(void 0));try{return await x(l),!0}catch(t){return u.current&&s.current.source===e&&y(t instanceof Error?t.message:String(t)),!1}finally{u.current&&v(!1)}})();return g.current=i,i.then(()=>{g.current===i&&(g.current=void 0)}),i}let i=()=>d.current===e&&s.current.source===e.source;if(t&&!i())return Promise.resolve(!1);if(m.current)return m.current.owner===e?m.current.promise:Promise.resolve(!1);let a=(async()=>{u.current&&i()&&(v(!0),y(void 0));try{if(i()&&e.session.ownsSession()&&e.onReset(),!(l||t||!1===s.current.isActive||!i()?await e.session.retire({canRetire:()=>!b()}):await e.session.restart()))return!1;if(t){if(!i()||b())return!1;await x(e.onRequestHome)}return!0}catch(e){return u.current&&i()&&y(e instanceof Error?e.message:String(e)),!1}})(),n={owner:e,promise:a};return m.current=n,a.then(()=>{m.current===n&&(m.current=void 0,u.current&&v(!1))}),a},_=(0,eC.useRef)(k);_.current=k;let w=(0,eC.useCallback)(e=>{let{navigateHome:t}=e;return _.current(c,t)},[c]),S=(0,eC.useCallback)(()=>_.current(c,!1),[c]);return(0,eC.useEffect)(()=>(u.current=!0,++p.current,()=>{u.current=!1,++p.current}),[]),(0,eC.useEffect)(()=>{!e.enabled||!1!==e.isActive||b()||_.current(c,!1,!0)},[e.enabled,e.isActive,e.paymentActive,c]),(0,eC.useEffect)(()=>{var t;if(!e.enabled||!1===e.isActive||!c)return;let l=null==o||null==(t=o.getPlugin)?void 0:t.call(o,"screenProtector");if("function"==typeof(null==l?void 0:l.subscribeTrigger))return l.subscribeTrigger(()=>{_.current(c,!1,!0)})},[o,e.enabled,e.isActive,c]),(0,eC.useEffect)(()=>{if(e.enabled&&c)return()=>{let e=p.current;Promise.resolve().then(()=>{u.current&&d.current===c||!u.current&&p.current!==e||b()||_.current(c,!1,!0)})}},[e.enabled,c]),{finish:w,reset:S,resetting:h,error:f}}({enabled:B||tU.isPaymentActive()||!!tU.kioskPaymentResult,isActive:e.isActive,sessionId:e3.sessionId,source:q,session:e3,paymentActive:tU.paymentActive,isPaymentActive:()=>eU.current(),onRequestHome:e.onRequestHome,onReset:()=>{++eK.current,eV.current=!1,eo(void 0),ed(void 0),eu(void 0),em(void 0),eh(void 0),ef(!1),ez(void 0),eF(!1),eb(void 0),eN(void 0),ew(void 0),eI(!1),eA(!1),ek(!1),eH(!1),J("select"),ee(B),en(B?"product":"date"),A.close(),P.customerAuth.dismiss(),P.holder.dismiss(),P.normalProductDetail.dismiss(),P.bookingEdit.dismiss(),P.multiDay.dismiss(),P.allergySelection.dismiss(),P.settlementSelect.dismiss(),P.settlementConflict.dismiss(),P.holderConfirm.cancel()}});eW.current=tY.finish,(0,eC.useEffect)(()=>{tY.error&&eb(tY.error)},[tY.error]);let tW=function(e){var t,l,i;let a=(0,eC.useRef)(e);a.current=e;let n=(0,eC.useRef)(!0),r=(0,eC.useRef)(),o=(0,eC.useRef)(),s=(0,eC.useRef)(!1),[,d]=(0,eC.useState)(0),[c,u]=(0,eC.useState)(),p=(0,eC.useMemo)(()=>e.enabled?e3L(e.order,e.scopeKey,e.mainProducts,e.extrasProducts):[],[e.enabled,e.os,e.scopeKey,e.order,null==(t=e.order)?void 0:t.products,null==(i=e.order)||null==(l=i._extend)?void 0:l.productsByUid,e.mainProducts,e.extrasProducts]),m=!!c&&e3R(c.owner,e),g=m?c.error:void 0,h=e.enabled&&(m&&c.pending||!g&&p.length>0);return(0,eC.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]),(0,eC.useEffect)(()=>{var t;let l=o.current;if(!l||e3R(l.owner,e)&&(0,no.isEqual)(l.ownership,e3$(e.os.getTempOrder()||{}))||(o.current=void 0,s.current=!1,u(e=>(null==e?void 0:e.owner)===l.owner?void 0:e)),!e.enabled||r.current)return;let i=o.current&&e3R(o.current.owner,e)?o.current:void 0;if(i&&!s.current||!p.length&&!i)return;s.current=!1;let c={os:e.os,scopeKey:e.scopeKey,order:e.order,identity:eXv(e.order),customer:String((null==(t=e.order)?void 0:t.customer_id)||"")};if(!c.order||!e3R(c,e))return;let m=(null==i?void 0:i.published)?i:{owner:c,patches:p,ownership:(0,no.cloneDeep)(e3$(c.order)),published:!1};r.current=m,u({owner:m.owner,pending:!0});let g=()=>n.current&&e3R(m.owner,a.current),h=()=>0===e3L(m.owner.order,m.owner.scopeKey,e.mainProducts,e.extrasProducts).length,v=String(e.locale||"").startsWith("zh")?"无法更新定金信息,请重试。":"Could not update deposit details. Please try again.";(async()=>{try{if(!g())return;if(!m.published){if(!m.patches.length||!e.os.updateOrderProducts)throw Error(v);let t=(0,no.cloneDeep)({products:c.order.products,bookings:c.order.bookings,customer:c.order.customer_id,payments:c.order.payments,metadata:c.order.metadata,extend:c.order._extend});if(await e.os.updateOrderProducts(m.patches,{beforeApply:()=>{let l=e.os.getTempOrder();if(!a.current.enabled||a.current.mainProducts!==e.mainProducts||a.current.extrasProducts!==e.extrasProducts||!g()||!(0,no.isEqual)(m.ownership,e3$(l||{}))||!(0,no.isEqual)(t,{products:null==l?void 0:l.products,bookings:null==l?void 0:l.bookings,customer:null==l?void 0:l.customer_id,payments:null==l?void 0:l.payments,metadata:null==l?void 0:l.metadata,extend:null==l?void 0:l._extend}))throw Error(v)},isCurrentOrder:g}),!g())return;if(m.ownership=(0,no.cloneDeep)(e3$(m.owner.order)),m.published=h(),!m.published)throw Error(v)}if(!g())return;if(!e.os.getSummary)throw Error(v);let t=await e.os.getSummary();if(!g())return;if(!t||"object"!=typeof t)throw Error(v);a.current.refreshSnapshot(),o.current=void 0,u({owner:m.owner,pending:!1})}catch(e){if(g()){m.ownership=(0,no.cloneDeep)(e3$(m.owner.order)),m.published=h(),o.current=m,u({owner:m.owner,pending:!1,error:e3A(e,v)});try{a.current.refreshSnapshot()}catch{}}}finally{r.current===m&&(r.current=void 0),n.current&&(u(e=>(null==e?void 0:e.owner)===m.owner&&e.pending?void 0:e),d(e=>e+1))}})()}),{pending:h,error:g,retry:()=>{e.enabled&&!r.current&&g&&(s.current=!0,d(e=>e+1))}}}({os:q,scopeKey:L,order:tw,locale:H,mainProducts:t_.products,extrasProducts:tC.products,enabled:to&&!t_.loading&&!t_.error&&!tC.loading&&!tC.error&&!ex&&!eM&&!eP&&!tM.busy&&!tT.pending&&!er&&!es&&!tU.submitting&&!tU.paymentActive&&!tU.failure&&!eB,refreshSnapshot:F.refreshCartSnapshot}),tK=!to||ex||eM||tM.busy||tT.pending||tW.pending||tU.submitting||tU.paymentActive||!!tU.failure||!!tU.submittedOrderId||eB,tG=!to||!1===e.isActive||ex||eM||eP||tM.busy&&!tI()||tW.pending||tU.submitting||tU.paymentActive||!!tU.failure||!!tU.submittedOrderId||eB||!!er||!!es||!!eO||tC.loading||!!tC.error,tQ=tK||eP,tZ=null==(y=q.getOrderAmountSnapshot)?void 0:y.call(q),tJ=(null==tZ?void 0:tZ.summary)||(null==tw?void 0:tw.summary)||O.summary.summary,tX=(null==tZ?void 0:tZ.depositAmount)??(null==tJ?void 0:tJ.deposit_amount)??(null==tw?void 0:tw.deposit_amount),t0=Number(tX)>0&&!!((null==tZ?void 0:tZ.isDeposit)??1===Number(null==tw?void 0:tw.is_deposit)),t2=eC9({baseSalesAmountGap:null==tZ?void 0:tZ.amountGap,amountGap:null==tJ?void 0:tJ.amount_gap,fallbackAmount:null==tJ?void 0:tJ.total_amount,payments:null==tw?void 0:tw.payments}),t1=tS.bindings.reduce((e,t)=>{let l=String(t.line.product_id);return e[l]=(e[l]||0)+t.quantity,e},{}),t4=e1H(O,L);(0,eC.useEffect)(()=>{!to||"review"!==Z||tD||!t4.complete||es||tC.loading||tC.error||tH()},[to,Z,tD,t4.complete,es,tC.loading,tC.error,tC.products,F.tempOrder]);let t3=tS.bindings.length>0,t8=tP?"extras":"review",t6=t4.required?"holder":t8,t5=tS.bindings.every(e=>e.date===W);return{props:e,engine:M,bookingUI:T,orderPanel:A,mode:E,context:O,config:z,scopeKey:L,variant:R,sales:$,cart:F,os:q,isKiosk:B,todayOnly:B,locale:H,text:V,today:U,date:W,setDate:K,visibleDates:G,setVisibleDates:Q,step:Z,setStep:J,dateConfirmed:X,setDateConfirmed:ee,expandedSection:ea,setExpandedSection:en,dateSearchRange:tx,dateInteractionStarted:tf,onDateInteraction:tv,canAutoSelectDate:()=>!B&&th.current===tg&&ei.current!==tg,composer:er,setComposer:eo,configurationModal:es,setConfigurationModal:ed,error:ey,setError:eb,busy:ex,pendingExtraProductId:e_,preparingProductId:ej,composerBusy:eM,setComposerBusy:eI,rememberPartyPreview:(e,t)=>{if(!eQ.current||"party"!==E||!er||tO.current.composerKey!==e)return;let l=e3P({...er,...t},"booking");eu(t=>(null==t?void 0:t.key)===e&&JSON.stringify(t.value)===JSON.stringify(l)?t:{key:e,value:l})},previewRecovery:ep,previewRecoveryError:eg,recoveringPreview:ev,retryPartyPreview:()=>em(e=>e&&{...e,attempt:e.attempt+1}),discardPartyPreview:()=>{++eK.current,eo(void 0),ed(void 0),eu(void 0),eh(void 0),ef(!1),em(void 0),en("product")},uiHydrated:te,subscribePartyProductConfirmed:eJ,notifyPartyProductConfirmed:e6,holderBusy:eP,setHolderBusy:eA,externalHolderDisabled:tK,revision:eD,setRevision:eE,linePicker:eO,setLinePicker:ez,showOffers:eR,setShowOffers:eF,handoff:eB,setHandoff:eH,confirmation:eX,alive:eQ,mainCatalog:e0,mainQueries:tu,extrasQueries:tp,customerId:e2,refresh:e4,session:e3,ready:to,main:t_,order:tw,bindings:tS,partyMain:tj,operationLog:e8,extrasCatalog:tC,extras:tM,extraQuantity:tT,extraQuantityDisabled:tG,isExtraQuantityPending:tI,dateStates:tE,run:tz,policy:tL,openProduct:tR,editLine:e=>tz(async()=>{let t=e1F(q.getTempOrder(),{mode:E}).bindings.find(t=>t.productLineUid===e);if(!t)throw Error(V("This booking changed. Please refresh your order.","预约已变化,请刷新订单。"));await tR({id:Number(t.line.product_id)},e,"party"!==E)}),removeLine:e=>tF([e]),removeLines:tF,removeTicket:(e,t)=>t$([e],{uid:e,index:t}),changeDate:tq,showExtraPreparation:tB,checkout:tU,kioskLifecycle:tY,depositHydration:tW,disabled:tQ,openOrderHistory:()=>{var e,t,l,i,a,n;let r="h5"===String((null==(e=q.otherParams)?void 0:e.platform)||(null==M||null==(l=M.appHelper)||null==(t=l.constants)?void 0:t.platform))?"/orders":"/order",o=null==M||null==(a=M.appHelper)||null==(i=a.utils)?void 0:i.history;(null==o?void 0:o.push)?o.push(r):window.location.assign(`${(null==(n=window.location.pathname.match(/^\/(en|zh-CN|zh-HK|ja|pt)(?=\/|$)/))?void 0:n[0])||""}${r}`)},summary:tJ,amount:e=>YP(tw,e??0),amountDue:t2,hasDeposit:t0,depositAmount:tX,productQuantities:t1,holderState:t4,checkExtraHolders:tH,mainPoolEmpty:tA,mainCatalogBlocked:tD,hasExtras:tP,nextAfterHolder:t8,nextAfterSelect:t6,hasBookings:t3,mainDateMatches:t5,continueOrder:e=>{!(tQ||tW.error||tD||tI())&&t3&&!er&&t5&&(eb(void 0),J(e))}}}let e3H=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,128l-72,72V56Z",opacity:"0.2"}),eC.createElement("path",{d:"M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z"}))]]),e3V=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e3H}));e3V.displayName="ArrowRightIcon";let e3U=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),eC.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),e3Y=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e3U}));function e3W(e){let{id:t,number:l,title:i,meta:a,className:n="",children:r,...o}=e;return(0,eH.jsxs)("section",{...o,className:`checkout-module ${n}`,id:t,"aria-labelledby":`${t}-heading`,children:[(0,eH.jsxs)("header",{className:"checkout-module-heading",children:[(0,eH.jsx)("span",{className:"checkout-module-number","aria-hidden":"true",children:l}),(0,eH.jsx)("h2",{id:`${t}-heading`,children:i}),a&&(0,eH.jsx)("span",{className:"checkout-module-meta",children:a})]}),(0,eH.jsx)("div",{className:"checkout-module-body",children:r})]})}function e3K(e){let{id:t,label:l,value:i,onChange:a,maxLength:n=500,rows:r=3,placeholder:o,disabled:s=!1,hint:d,hideLabel:c=!1}=e;return(0,eH.jsxs)("div",{className:"note-field",children:[(0,eH.jsx)("label",{className:c?"sr-only":"field",htmlFor:t,children:l}),(0,eH.jsx)("textarea",{id:t,value:i,onChange:e=>a(e.target.value),rows:r,maxLength:n,placeholder:o,disabled:s,"aria-describedby":`${t}-count`}),(0,eH.jsxs)("p",{className:"note-help small muted",children:[(0,eH.jsx)("span",{children:d}),(0,eH.jsxs)("span",{id:`${t}-count`,children:[i.length,"/",n]})]})]})}e3Y.displayName="PlusIcon";let e3G=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z"}))]]),e3Q=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e3G}));e3Q.displayName="ClockIcon";let e3Z=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),eC.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z"}))]]),e3J=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e3Z}));e3J.displayName="PencilSimpleIcon";let e3X=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),eC.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),e30=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e3X}));function e32(e){let{title:t,image:l,icon:i,details:a,amount:n,action:r,removeAction:o,children:s,className:d="",layout:c="card",id:u}=e;return(0,eH.jsxs)("article",{id:u,className:`booking-order-item booking-order-item-${c} ${d}`,children:[(0,eH.jsxs)("div",{className:"booking-order-item-heading",children:[i&&(0,eH.jsx)("span",{className:"booking-order-item-icon","aria-hidden":"true",children:i}),l&&(0,eH.jsx)("img",{className:"booking-order-item-image",src:l,alt:""}),(0,eH.jsxs)("div",{className:"booking-order-item-copy",children:[(0,eH.jsx)("h3",{children:t}),a&&(0,eH.jsx)("div",{className:"booking-order-item-details",children:a}),void 0!==n&&(0,eH.jsx)("strong",{className:"booking-order-item-amount",children:n}),(r||o)&&(0,eH.jsxs)("div",{className:"booking-order-item-actions",children:[r&&(0,eH.jsx)(eXO,{className:"booking-order-item-edit","aria-label":r.label,disabled:r.disabled,onClick:r.onClick,children:(0,eH.jsx)(e3J,{size:18,"aria-hidden":"true"})}),o&&(0,eH.jsx)(eXO,{className:"booking-order-remove","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,children:(0,eH.jsx)(e30,{size:18,"aria-hidden":"true"})})]})]})]}),s&&(0,eH.jsx)("div",{className:"booking-order-item-content",children:s})]})}function e31(e){let{items:t}=e;return(0,eH.jsx)("dl",{className:"booking-order-details",children:t.map((e,t)=>(0,eH.jsxs)("div",{className:"booking-order-detail",children:[(0,eH.jsx)("dt",{children:e.label}),(0,eH.jsxs)("dd",{children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("strong",{children:e.value}),e.detail&&(0,eH.jsx)("div",{className:"booking-order-detail-copy",children:e.detail})]}),e.action&&(0,eH.jsx)("button",{type:"button",className:"text-link",disabled:e.action.disabled,onClick:e.action.onClick,children:e.action.label})]})]},t))})}function e34(e){let{rows:t,lang:l,formatAmount:i}=e;return(0,eH.jsx)("div",{className:"booking-price-breakdown",children:t.map(e=>(0,eH.jsxs)("div",{className:"booking-price-line",children:[(0,eH.jsx)(eXT,{label:e.label,amount:e.amount,formatAmount:i,total:"total"===e.tone,lang:l,className:"discount"===e.tone?"discount":""}),e.detail&&(0,eH.jsx)("div",{className:"small muted booking-price-detail",children:e.detail})]},e.id))})}function e33(e){let{title:t,description:l,children:i}=e;return(0,eH.jsxs)("section",{className:"booking-holder-section",children:[t&&(0,eH.jsx)("h2",{children:t}),l&&(0,eH.jsx)("p",{className:"muted",children:l}),(0,eH.jsx)("div",{className:"booking-holder-content",children:i})]})}e30.displayName="TrashIcon";let e38=e=>null==e?"":String(e),e36=e=>e38(e).slice(0,10),e35=e=>{let t=e38(e);return/^\d{2}:\d{2}$/.test(t)?`${t}:00`:t};function e37(e,t){var l,i,a,n,r,o,s,d;if(!t||!e.product_id||(null==(l=e._extend)?void 0:l.independentLine)===!0||(null==(n=e.metadata)||null==(a=n.origin)||null==(i=a._extend)?void 0:i.independentLine)===!0)return null;let c=e36(t.start_date),u=e36(t.end_date),p=e35(t.start_time),m=e35(t.end_time);if(![c,u].every(e=>/^\d{4}-\d{2}-\d{2}$/.test(e))||![p,m].every(e=>/^\d{2}:\d{2}:\d{2}$/.test(e)))return null;let g=Array.isArray(t.resources)?t.resources:[];return g.some(e=>!e||!e38(e.relation_id??e.resource_id??e.id)||!e38(e.form_id))?null:JSON.stringify(function e(t){return null==t?null:Array.isArray(t)?t.map(e):"object"==typeof t?Object.keys(t).sort().reduce((l,i)=>(l[i]=e(t[i]),l),{}):t}({product:e38(e.product_id),variant:e38(e.product_variant_id),sku:{...e.product_sku,option:ex4(e)},bundle:e.product_bundle||[],businessDate:e36((null==(r=t.metadata)?void 0:r.availability_business_date)||c),startDate:c,endDate:u,startTime:p,endTime:m,timezone:e38(null==(o=t.metadata)?void 0:o.availability_timezone),resources:g.map(e=>({form:e38(e.form_id),id:e38(e.relation_id??e.resource_id??e.id),type:e38(e.relation_type),capacity:e38(e.capacity)})).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t))),legacyResource:g.length?null:{id:e38(t.relation_id??t.resource_id),type:e38(t.relation_type)},role:e38(null==(s=e.metadata)?void 0:s.venue_booking_role),scope:e38(null==(d=e.metadata)?void 0:d.venue_booking_scope_key)}))}function e39(e,t){let l=[],i=new Map;return e.forEach((e,a)=>{let n=t(e),r=null===n?void 0:i.get(n);if(r)r.members.push(e);else{let t={key:null===n?`separate:${a}`:`group:${n}`,members:[e]};l.push(t),null!==n&&i.set(n,t)}}),l}function e8e(e,t,l,i,a){let n=e=>[null==e?void 0:e.bundle_title,null==e?void 0:e.title,null==e?void 0:e.name,null==e?void 0:e.product_title].map(e=>eXp(e,l)).find(Boolean);return(e.product_bundle||[]).flatMap((l,r)=>{var o,s;if(!l)return[];let d=Number(l.num??l.quantity??1);if(!Number.isSafeInteger(d)||d<=0)return[];let c=l.bundle_id??l.id,u=l.bundle_group_id??l.group_id,p=null!=c?{bundle_id:c,bundle_group_id:u}:l;return[{key:`${u??""}:${c??""}:${r}`,name:n(l)||n((null==(o=l.metadata)?void 0:o.origin)??l.origin??l.product)||n(ewW(p,[null==(s=e.metadata)?void 0:s.origin,a,i])),quantity:d*t}]})}async function e8t(e){var t,l,i,a,n,r,o,s,d;let{handle:c,line:u,holderIds:p,assertCurrent:m,beforeWrite:g}=e,h=null==(t=u.orderLine.metadata)?void 0:t.venue_booking_role,v=String((null==(l=u.orderLine.metadata)?void 0:l.unique_identification_number)||""),f=String((null==(a=u.booking)||null==(i=a.metadata)?void 0:i.unique_identification_number)||"");if("tickets"!==h&&"party_main"!==h||!v||!f||1!==Number(u.orderLine.num)||1!==p.length||!c.updateOrderBooking)throw Error("This booking cannot accept a Holder-only update. Please reselect the booking.");m();let y=null==(n=c.getTempOrder)?void 0:n.call(c),b=null==y||null==(r=y.bookings)?void 0:r.find(e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)||"")===f});if(!b||String(b.product_uid||"")!==v)throw Error("The booking link changed. Please review the order.");let x=JSON.stringify(b),k=null==y?void 0:y.customer_id,_=await (null==(o=c.getOtherParams)?void 0:o.call(c));m();let w=null==(s=c.getTempOrder)?void 0:s.call(c),S=null==w||null==(d=w.bookings)?void 0:d.find(e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)||"")===f});if(w!==y||(null==w?void 0:w.customer_id)!==k||!S||JSON.stringify(S)!==x)throw Error("The booking changed while choosing a Holder. Please try again.");let j=ek6(p,{customerId:k,isFranchisee:!!(null==_?void 0:_.isFranchisee),holderOptions:e.holderOptions,productSource:u.cacheItem});g(),await c.updateOrderBooking({unique_identification_number:f,updates:{holder:j,metadata:{holder_id:p}}})}class e8l extends Error{constructor(e,t,l=!1){super(e),e1(this,"code",void 0),e1(this,"uncertain",void 0),this.code=t,this.uncertain=l}}let e8i=e=>!!e&&"[object Object]"===Object.prototype.toString.call(e),e8a=e=>!!e&&"object"==typeof e&&"booking-holder-form"===e.kind&&1===e.version&&"function"==typeof e.close;function e8n(e){let t,l,i,{formId:a,customerId:n,locale:r}=e,o=e$(),s=(0,eC.useRef)(e);s.current=e;let d=(0,eC.useRef)();d.current||(l=e=>{try{null==e||e.close()}catch{}},d.current={close:i=()=>{let e=t;t=void 0,e&&(e.done=!0,l(e.handle))},isOpen:()=>!!(t&&!t.done),open(e){if(i(),!e.isCurrent())return;let a={done:!1};t=a;let n=()=>t===a&&!a.done&&e.isCurrent(),r=()=>{a.done=!0,t===a&&(t=void 0)},o=t=>{n()&&(r(),l(a.handle),e.onError(t))},s=()=>new e8l("The kiosk holder form service is unavailable.","HOST_UNAVAILABLE"),d=e.request.formId,c=e.request.customerId;if(!Number.isSafeInteger(d)||d<=0||!e8i(e.request.formDataConfig)&&"function"!=typeof e.request.loadFormData||null!=c&&(!Number.isSafeInteger(Number(c))||1>=Number(c))||!e.action)return void o(s());let u=(t,l)=>{if(n())try{if(!t||Number(t.formId)!==l)return void o(new e8l("The holder form does not match this request.","FORM_MISMATCH",!0));if("opened"===t.status){var i;null==(i=e.onFallbackLoading)||i.call(e,!1),e.onOpened({...t,formId:d})}else if("saved"===t.status){if(!e8i(t.record))return void o(new e8l("The holder form did not return a confirmed save.","SAVED_RESULT_INVALID",!0));let l=JSON.parse(JSON.stringify(t.record));if(!e8i(l))return void o(new e8l("The holder form returned invalid records.","SAVED_RESULT_INVALID",!0));r(),e.onSaved({...t,formId:d,record:l})}else"cancelled"===t.status?(r(),e.onCancelled()):"error"===t.status?o(new e8l(t.message||"Unable to load the holder form.",t.code||"HOST_ERROR",!!t.uncertain)):o(new e8l("The holder form service returned an invalid response.","HOST_RESPONSE_INVALID"))}catch(e){o(new e8l(e instanceof Error?e.message:"Invalid holder form response.","HOST_RESPONSE_INVALID",!0))}},p=async()=>{if(!n())throw new e8l("The holder request changed.","HOLDER_FORM_CLOSED");let t=await e.request.loadFormData();if(!n())throw new e8l("The holder request changed.","HOLDER_FORM_CLOSED");if(!Number.isSafeInteger(null==t?void 0:t.formId)||t.formId<=0||!e8i(t.formDataConfig))throw new e8l("The holder form is unavailable.","HOLDER_FORM_CONFIG_INVALID");return{formId:t.formId,formDataConfig:JSON.parse(JSON.stringify(t.formDataConfig))}},m=(t,i)=>{if(!n())return;let r={};a.attempt=r;let d=!0,c=[],g=()=>n()&&a.attempt===r;try{let r=e.action({type:"pisell1.goBookingHolderForm",data:{...t,...t.formDataConfig?{formDataConfig:JSON.parse(JSON.stringify(t.formDataConfig))}:{},isCurrent:g},callback(e){g()&&(d?c.push(e):u(e,t.formId))}});if(d=!1,!g()){c.length=0,e8a(r)&&l(r);return}if(!e8a(r)){r&&"function"==typeof r.then&&Promise.resolve(r).catch(()=>{}),c.length=0,o(s());return}if(i&&!0!==r.supportsDeferredLoad){var h;let i=c.find(e=>(null==e?void 0:e.status)==="saved"||(null==e?void 0:e.status)==="cancelled"||(null==e?void 0:e.status)==="error"&&(e.uncertain||"HOLDER_FORM_CONFIG_INVALID"!==e.code));if(i){a.handle=r,u(i,t.formId);return}if(a.attempt=void 0,c.length=0,l(r),!n())return;null==(h=e.onFallbackLoading)||h.call(e,!0),p().then(t=>{n()&&m({...e.request,...t,loadFormData:void 0},!1)}).catch(t=>{var l;n()&&(null==(l=e.onFallbackLoading)||l.call(e,!1),o(new e8l(t instanceof Error?t.message:"Unable to load the holder form.","HOLDER_FORM_CONFIG_INVALID")))});return}a.handle=r,c.splice(0).forEach(e=>u(e,t.formId))}catch(e){d=!1,c.length=0,o(new e8l(e instanceof Error?e.message:"Unable to open the holder form.","HOST_ERROR"))}};m({...e.request,...e.request.loadFormData?{loadFormData:p}:{}},!!e.request.loadFormData)}});let c=(0,eC.useRef)(0),u=(0,eC.useRef)(!0),p=(0,eC.useRef)(!1),m=(0,eC.useRef)(!1),[g,h]=(0,eC.useState)(),[v,f]=(0,eC.useState)(!1),[y,b]=(0,eC.useState)(!0),[x,k]=(0,eC.useState)(!1),[_,w]=(0,eC.useState)(0),S=String(r||"").startsWith("zh"),j=(e,t)=>S?t:e;return(0,eC.useEffect)(()=>{var e,t,l;u.current=!0;let i=++c.current,r=()=>u.current&&c.current===i&&String(s.current.formId)===String(a)&&String(s.current.customerId??"")===String(n??"")&&s.current.isCurrent();null==(e=d.current)||e.close(),p.current=!1,b(!0),k(!1),h(void 0);let g=()=>{m.current||(m.current=!0,s.current.onUnconfirmed())},v=!1,y=oi(n??void 0)?void 0:n,x=async()=>{try{var e,t,l;let i=await UV(Number(a),"kiosk");if(!r()||!i)throw Error("Holder form unavailable");let n=i.form_field??i.field,o=(i.form_type??(null==(e=i.form)?void 0:e.form_type))==="minors"?null==n||null==(l=n.find(e=>"form_to_form"===e.filed_type&&"hide"===e.status))||null==(t=l.setting)?void 0:t.linkedTable:void 0,s=Number(o||a),d=o?await dt(s,"kiosk"):i;if(!r()||!d)throw Error("Linked holder form unavailable");let c={...d,form_id:s,is_franchisor:i.is_franchisor};return delete c.customer_id,null!=y&&(c.customer_id=y),v=!!o,{formId:s,formDataConfig:c}}catch{throw Error(j("Unable to load the holder form. Please retry.","无法加载持有人表单,请重试。"))}};return d.current.open({action:"function"==typeof(null==o||null==(l=o.appHelper)||null==(t=l.utils)?void 0:t.action)?e=>o.appHelper.utils.action(e):void 0,request:{formId:Number(a),loadFormData:x,title:j("New holder profile","新建持有人档案"),customerId:y,zIndex:1101},isCurrent:r,onOpened:()=>{r()&&b(!1)},onFallbackLoading:e=>{r()&&k(e)},onSaved:e=>{r()&&!p.current&&(p.current=!0,b(!0),(async()=>{try{await s.current.onCreated({record:e.record,linkedWaiver:v}),r()&&s.current.onClose()}catch{r()&&(f(!0),g(),h(j("The profile was saved. Refresh the list to select it.","档案已保存,请刷新列表后选择,勿重复创建。")))}finally{r()&&b(!1)}})())},onCancelled:()=>{r()&&s.current.onClose()},onError:e=>{r()&&(b(!1),k(!1),e.uncertain?(f(!0),g(),h(j("The save result is unknown. Close this form and refresh the profile list before trying again.","保存结果尚未确认,请关闭表单并刷新档案列表后核对,勿重复创建。"))):h("HOST_UNAVAILABLE"===e.code?j("The kiosk holder form service is unavailable. Please update this terminal and retry.","终端持有人表单服务不可用,请更新终端后重试。"):j("Unable to load the holder form. Please retry.","无法加载持有人表单,请重试。")))}}),()=>{var e;u.current=!1,++c.current,null==(e=d.current)||e.close()}},[a,n,_]),(0,eH.jsxs)("div",{className:"venue-holder-create-feedback","aria-busy":y,children:[x&&y&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(eT.Spin,{}),(0,eH.jsx)(eXE,{secondary:!0,onClick:()=>{var e;null==(e=d.current)||e.close(),s.current.onClose()},children:j("Close","关闭")})]}),g&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:g,action:(0,eH.jsxs)(eH.Fragment,{children:[!v&&!p.current&&(0,eH.jsx)(eXE,{onClick:()=>w(e=>e+1),children:j("Retry","重试")}),(0,eH.jsx)(eXE,{disabled:y&&p.current,onClick:()=>{var e;y&&p.current||(null==(e=d.current)||e.close(),s.current.onClose())},children:j("Close","关闭")})]})})]})}function e8r(e){return e.kiosk?(0,eH.jsx)(e8n,{...e}):(0,eH.jsx)(e8o,{...e})}function e8o(e){let{formId:t,customerId:l,locale:i,onClose:a,onCreated:n,onUnconfirmed:r,isCurrent:o}=e,s=eq(),[d]=Wi({components:["FormCard"]}),[c,u]=(0,eC.useState)(),[p,m]=(0,eC.useState)(),[g,h]=(0,eC.useState)(!1),[v,f]=(0,eC.useState)(!1),[y,b]=(0,eC.useState)(!1),x=(0,eC.useRef)(null),k=(0,eC.useRef)(!0),_=(0,eC.useRef)(!1),w=String(i||"").startsWith("zh"),S=(e,t)=>w?t:e;(0,eC.useEffect)(()=>{k.current=!0;let e=!1;return(async()=>{var l,i,a,n;let r=await UV(Number(t),s);if(!r)throw Error(S("The holder form is unavailable.","持票人表单未加载。"));let d=r.form_field??r.field,c=(r.form_type??(null==(l=r.form)?void 0:l.form_type))==="minors"?null==d||null==(a=d.find(e=>"form_to_form"===e.filed_type&&"hide"===e.status))||null==(i=a.setting)?void 0:i.linkedTable:void 0,p=c?await dt(Number(c),s):r;if(!p)throw Error(S("The linked waiver form is unavailable.","关联协议表单未加载。"));!e&&o()&&u({id:Number(c||t),title:String((null==(n=p.form)?void 0:n.title)||p.title||S("New holder profile","新建持票人档案")),franchisor:r.is_franchisor,linkedWaiver:!!c})})().catch(t=>{e||m(e3A(t,S("Unable to load the holder form.","无法加载持票人表单。")))}),()=>{e=!0,k.current=!1}},[t,l,s]);let j=async(e,t)=>{if(!k.current||!c||_.current)return;if("success"!==e){f(!0),h(!1),r(),m(S("The save result is unknown. Close this form and refresh the profile list before trying again.","保存结果尚未确认,请关闭表单并刷新档案列表后核对,勿重复创建。"));return}let l=Array.isArray(t)?Object.fromEntries(t.filter(e=>e&&"object"==typeof e&&"string"==typeof e.key).map(e=>[e.key,e.value])):t&&"object"==typeof t?{...t}:{};_.current=!0;try{o()&&await n({record:l,linkedWaiver:c.linkedWaiver}),k.current&&a()}catch(e){k.current&&(f(!0),r(),m(e3A(e,S("The profile was saved. Refresh the list to select it.","档案已保存,请刷新列表后选择,勿重复创建。"))))}finally{k.current&&h(!1)}};return(0,eH.jsxs)(e0t,{title:(null==c?void 0:c.title)||S("New holder profile","新建持票人档案"),className:"venue-holder-create-modal",mobile:"fullscreen",zIndex:600,closeLabel:S("Close","关闭"),externalDialogSelector:eX9,bodyClassName:"venue-holder-create-body venue-booking-legacy-controls",footerClassName:"venue-holder-create-footer",onClose:()=>{g&&_.current||(g&&r(),k.current=!1,a())},closeDisabled:g&&_.current,closeOnBackdrop:!g,closeOnEscape:!g,footer:(0,eH.jsx)(eXE,{disabled:!y||v||!o(),busy:g,onClick:()=>{var e;(null==(e=x.current)?void 0:e.submit)&&o()&&(h(!0),m(void 0),x.current.submit())},children:g?S("Saving…","保存中…"):S("Save profile","保存档案")}),children:[p&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:p}),g&&!_.current&&(0,eH.jsx)("p",{className:"small muted",children:S("Saving. If you close this form, check the profile list before creating another profile.","正在保存。如需关闭,请先核对档案列表,勿重复创建。")}),!c&&!p&&(0,eH.jsx)(eT.Spin,{}),c&&(d?(0,eH.jsx)(d,{id:c.id,venueHolderLinkedRecords:!0,ref:e=>{x.current=e},isGetLastData:!1,setting:{isHidden:1},isV2API:!0,isShowSkeleton:!0,isClearData:!1,submitExtraParams:{...null!=l&&""!==l?{customer_id:l}:{},...null!=c.franchisor?{source_shop_customer:c.franchisor}:{}},onSubmit:(e,t)=>void j(e,t),onFormConfigChange:e=>b(!!e&&Object.keys(e).length>0),onChange:(e,t)=>b(!e&&!!t&&Object.keys(t).length>0),onFinishFailed:()=>{h(!1),m(S("Complete the required form fields.","请填写表单中的必填内容。"))}}):(0,eH.jsx)(eT.Alert,{type:"error",message:S("The form component is unavailable.","表单组件未加载。")}))]})}function e8s(e,t){let l=String(t||"").startsWith("zh"),i=l?"zh":"en",a=(null==e?void 0:e.form)||e,n=[null==a?void 0:a.title,null==a?void 0:a.name,null==e?void 0:e.title,null==e?void 0:e.name].map(e=>eXp(e,i).trim()).find(Boolean)||(l?"持有人":"Holder");return{name:n,edit:l?`编辑${n}`:`Edit ${n}`,required:l?`必填${n}`:`${n} required`,optional:l?`${n}选填`:`Optional ${n}`,notRequired:l?`无需填写${n}`:`No ${n} required`,choose:l?`选择${n}`:`Select ${n}`,placeholder:l?`请选择${n}`:`Select ${n}`,create:l?"新建":"New",missing:l?`请选择${n}。`:`Please select ${n}.`}}let e8d=e=>e39(e,e=>{let t=e37(e.orderLine,e.booking);return null===t?null:JSON.stringify([t,e.config.enabled,e.config.required,String(e.config.formId??"")])}),e8c=(0,eC.forwardRef)((e,t)=>{var l,i,a;let{context:n,scopeKey:r,locale:o,isActive:s=!0,disabled:d=!1}=e,c=U4(),u=UM(),p=(0,eC.useMemo)(()=>eN7(u.customerAuth),[u.customerAuth]),m=eXN(),g=dq("venue-holder"),h=(0,eC.useRef)(e);h.current=e;let v=(0,eC.useRef)(!0),f=(0,eC.useRef)(!1),y=(0,eC.useRef)(!1),b=(0,eC.useRef)(null),[x,k]=(0,eC.useState)(),[_,w]=(0,eC.useState)(!1),[S,j]=(0,eC.useState)(),[N,C]=(0,eC.useState)({}),[M,T]=(0,eC.useState)(),[I,P]=(0,eC.useState)(),[,A]=(0,eC.useState)(0),D=n.sales.bookingTicket,E=eXy(D),O=c.loading&&!E,z=e1V(n,r),L=e1H(n,r,o),R=e8d(L.displayLines),$=e=>JSON.stringify([z,e.quantity,e.ids]),F=e=>{var t;return(null==(t=N[e.uid])?void 0:t.base)===$(e)?N[e.uid].ids:void 0},q=L.lines.some(e=>!!F(e));L.pending=!!S||!!M||!!I||q,L.complete=L.complete&&!q,L.blocked=e1W(D,z);let B=String(o||"").startsWith("zh"),H=(e,t)=>B?t:e,V=o3(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z;return v.current&&!1!==h.current.isActive&&e1V(h.current.context,h.current.scopeKey)===e});(0,eC.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,eC.useEffect)(()=>{k(void 0),w(!1),T(void 0),C({})},[z]),(0,eC.useEffect)(()=>{if(!I)return;let e=h.current,t=()=>{var e,t;return v.current&&!1!==h.current.isActive&&h.current.scopeKey===I.scopeKey&&h.current.context.sales.bookingTicket===I.handle&&eXv((null==(t=I.handle)||null==(e=t.getTempOrder)?void 0:e.call(t))??h.current.context.sales.tempOrder)===I.owner};if(!t()){P(void 0),j(void 0);return}if(String(eXb(e.context)||"")!==I.customerId)return;let l=e1H(e.context).lines.find(e=>e.uid===I.uid);if(!(null==l?void 0:l.config.formId)||I.index>=l.quantity){P(void 0),j(void 0);return}let i=!0,a=e1V(e.context,e.scopeKey);return c.prepareHolderOptionsForSource(l.cacheItem,{accessOnly:eXy(I.handle)}).then(e=>{i&&t()&&V(a)&&e.accessAllowed&&(y.current=!1,T({uid:l.uid,index:I.index,identity:a,base:JSON.stringify([a,l.quantity,l.ids]),formId:l.config.formId}))}).catch(e=>{i&&t()&&k(e3A(e,String(h.current.locale||"").startsWith("zh")?"无法打开持票人表单。":"Unable to open the holder form."))}).finally(()=>{i&&v.current&&(P(void 0),j(void 0))}),()=>{i=!1}},[I,z,c.prepareHolderOptionsForSource,V]);let U=JSON.stringify([z,L.requiredCount,L.requiredCompleted,L.total,L.completed,L.pending,L.blocked,L.lines.map(e=>[e.uid,e.config.formId,e.ids]),N]);(0,eC.useEffect)(()=>{var e,t;null==(e=(t=h.current).onStateChange)||e.call(t,L)},[U]);let Y=JSON.stringify(L.lines.map(e=>[e.uid,e.config.formId]));(0,eC.useEffect)(()=>{if(!s||!D)return;let e=new Set;for(let t of L.lines){let l=String(t.config.formId);e.has(l)||(e.add(l),c.prepareHolderOptionsForSource(t.cacheItem).catch(e=>{V()&&k(e3A(e,H("Unable to load holder profiles.","无法加载持票人档案。")))}))}},[D,z,Y,s]),(0,eC.useImperativeHandle)(t,()=>({validate:async()=>{let e=e1H(h.current.context),t=e1W(h.current.context.sales.bookingTicket,e1V(h.current.context,h.current.scopeKey));return!V()||f.current||M||q||t||!e.complete?(w(!0),k(t?H("A holder update could not be confirmed. Review the order before making another change.","持票人写回结果未确认,请先核对订单,勿重复修改。"):H("Complete the required holder details before continuing.","请先完成必填持票人资料。")),requestAnimationFrame(()=>{var e,t;return null==(t=b.current)||null==(e=t.querySelector('[aria-invalid="true"]'))?void 0:e.focus()}),!1):(k(void 0),!0)}}));let W=(e,t)=>{let l;if(!V(e))return;let i=e1H(h.current.context,h.current.scopeKey);if(i.blocked)return;let a=t&&i.lines.find(e=>e.uid===t.uid),n=e8d(i.lines).reduce((e,t)=>e.concat(t.members),[]);for(let e of a?[a,...n.filter(e=>e.config.required&&e.uid!==a.uid)]:n.filter(e=>e.config.required)){let i=(null==t?void 0:t.uid)===e.uid?t.ids:F(e)||e.ids,a=Array.from({length:e.quantity},(e,t)=>i[t]).findIndex(e=>null==e||""===e);if(a>=0){l={uid:e.uid,index:a};break}}let r=l;m(()=>{var t;return!V(e)||f.current||h.current.disabled||!b.current?null:r?Array.from(b.current.querySelectorAll("[data-venue-holder-line]")).find(e=>e.dataset.venueHolderLine===r.uid&&e.dataset.venueHolderIndex===String(r.index)):Array.from((null==(t=b.current.closest(".booking-page"))?void 0:t.querySelectorAll(".booking-primary-action"))||[]).find(eJ8)},{block:r?"start":"nearest"})},K=async function(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:z;if(!D||f.current||d||!V(i)||e1W(D,i))return;let a=e_X(D,e);if(!a)return void k(H("This ticket changed. Please review the order.","该门票已变化,请重新核对订单。"));let r=e1H(h.current.context).lines.find(t=>t.uid===e);if(!r||!Number.isInteger(t)||t<0||t>=r.quantity)return;let o=JSON.stringify([a.orderLine,a.booking]),s=[...F(r)||r.ids];if(s[t]=l,r.quantity>1&&Array.from({length:r.quantity},(e,t)=>s[t]).some(e=>null==e||""===e)){C(t=>({...t,[e]:{base:$(r),ids:s}})),W(i,{uid:e,ids:s});return}let u=s.slice(0,r.quantity).filter(e=>void 0!==e&&""!==e).map(Number);if(u.some(e=>!Number.isSafeInteger(e)||e<=0))return void k(H("The holder profile ID is invalid.","档案编号无效。"));f.current=!0,j(e),k(void 0);let p=!1,m=()=>{let t=e_X(D,e);if(!V(i)||!t||!p&&JSON.stringify([t.orderLine,t.booking])!==o)throw Error(H("The order changed. Please review its holders again.","订单已变化,请重新核对持票人。"))};try{var g,y,b,x;let t=null==(g=a.orderLine.metadata)?void 0:g.venue_booking_role;if(a.booking&&("tickets"===t||"party_main"===t))await e8t({handle:D,line:a,holderIds:u,holderOptions:c.getHolderOptionsForSource(a.cacheItem),assertCurrent:m,beforeWrite:()=>{m(),p=!0}});else{let e=new Proxy(D,{get(e,t){let l=Reflect.get(e,t);return"addProductToOrder"===t&&"function"==typeof l?function(){for(var t=arguments.length,i=Array(t),a=0;a<t;a++)i[a]=arguments[a];return m(),p=!0,l.apply(e,i)}:"function"==typeof l?l.bind(e):l}});await e_U({line:a,bookingTicket:e,tempOrder:(null==(y=D.getTempOrder)?void 0:y.call(D))??n.sales.tempOrder,openHolderSelect:async()=>(m(),u),updateItem:async e=>(m(),p=!0,n.cart.updateItem(e)),getHolderOptions:()=>c.getHolderOptionsForSource(a.cacheItem),getHolderFormDetail:()=>c.getHolderFormDetailForSource(a.cacheItem)})}V(i)&&(C(t=>{let l={...t};return delete l[e],l}),n.cart.refreshCartSnapshot(),await (null==(b=(x=h.current).onMutation)?void 0:b.call(x)),V(i)&&(A(e=>e+1),W(i)))}catch(e){p&&function(e,t){let l=e1U.get(e)||new Set;l.add(t),e1U.set(e,l);try{sessionStorage.setItem(e1Y(t),"1")}catch{}}(D,i),V(i)&&k(e3A(e,H("Unable to update the holder.","持票人写回失败。")))}finally{f.current=!1,v.current&&j(void 0)}},G=async e=>{let t=await c.prepareHolderOptionsForSource(e.cacheItem,{refresh:!0});return t.accessAllowed&&V()?t.options:[]},Q=async e=>{var t;let l;if(!M||!V(M.identity))return;let i=e1H(h.current.context).lines.find(e=>e.uid===M.uid);if(!i||$(i)!==M.base||String(i.config.formId)!==String(M.formId)||M.index>=i.quantity)return;let a=Number.isSafeInteger(l=Number((t=e.record).form_record_id??t.id??t.record_id))&&l>0?l:void 0;e.linkedWaiver||null==a||c.upsertHolderOptions([{...e.record,form_record_id:a}],i.cacheItem);let n=await G(i);y.current=!0;let r=e.linkedWaiver?void 0:a;if(e.linkedWaiver){let t=e.record.form_to_form_value,l=(Array.isArray(t)?t:[]).find(e=>String(null==e?void 0:e.form_id)===String(M.formId)),i=Array.isArray(null==l?void 0:l.form_data_value)?l.form_data_value:[];1===i.length&&n.some(e=>String(e.id)===String(i[0]))&&(r=i[0])}let o=e1H(h.current.context).lines.find(e=>e.uid===M.uid);null!=r&&o&&$(o)===M.base&&V(M.identity)&&await K(M.uid,M.index,r,M.identity)},Z=async(e,t)=>{if(d||L.blocked||f.current||!e.config.formId||e1G(D,`${z}:${e.config.formId}`))return;f.current=!0,j(e.uid);let l=!1;try{if(eXx(n,{products:[e.cacheItem],force:!0})){var i;let a=eXv((null==D||null==(i=D.getTempOrder)?void 0:i.call(D))??n.sales.tempOrder),o=()=>{var e;return v.current&&!1!==h.current.isActive&&h.current.scopeKey===r&&h.current.context.sales.bookingTicket===D&&eXv((null==D||null==(e=D.getTempOrder)?void 0:e.call(D))??h.current.context.sales.tempOrder)===a};if(!await eXk({context:n,products:[e.cacheItem],force:!0,openCustomerAuth:p,isCurrent:o})||!o())return;l=!0,P({uid:e.uid,index:t,handle:D,scopeKey:r,owner:a,customerId:String(eXb(n))});return}(await c.prepareHolderOptionsForSource(e.cacheItem,{accessOnly:E})).accessAllowed&&V(z)&&(y.current=!1,T({uid:e.uid,index:t,identity:z,base:$(e),formId:e.config.formId}))}catch(e){V(z)&&k(e3A(e,H("Unable to open the holder form.","无法打开持票人表单。")))}finally{f.current=!1,v.current&&!l&&j(void 0)}},J=async(e,t)=>{var l;let i=h.current.onRemoveTicket;if(!i||d||f.current||M||L.blocked||!V(z)||1!==e.quantity||0!==t||(null==(l=e.orderLine.metadata)?void 0:l.venue_booking_role)!=="tickets")return;let a=e1H(h.current.context).displayLines.find(t=>t.uid===e.uid);if(a&&$(a)===$(e)){f.current=!0,j(e.uid),k(void 0);try{await i(e.uid,t)&&V(z)&&C(t=>{let l={...t};return delete l[e.uid],l})}catch(e){V(z)&&k(e3A(e,H("Unable to remove this ticket. Please try again.","无法删除这张票,请重试。")))}finally{f.current=!1,v.current&&j(void 0)}}},X=L.lines.reduce((e,t)=>e+(t.config.required?Math.min(t.quantity,(F(t)||t.ids).filter(e=>null!=e&&""!==e).length):0),0),ee=e=>e8s(c.getHolderFormDetailForSource(e.cacheItem),o),et=function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=ee(t);return Array.from({length:t.quantity},(a,n)=>{var r;let o=c.getHolderOptionsForSource(t.cacheItem),s=0===o.length,u=(F(t)||t.ids)[n],p=null==u?void 0:o.find(e=>String(e.id)===String(u)),m=`${g}-${t.uid}-${n}`,h=_&&t.config.required&&null==u;return(0,eH.jsxs)("div",{className:"child-ticket","data-venue-holder-line":t.uid,"data-venue-holder-index":n,children:[(0,eH.jsx)(e32,{layout:"row",icon:(0,eH.jsx)(eXj,{size:20,"aria-hidden":"true"}),title:`${t.title||H("Ticket","门票")} #${l+n+1}`,removeAction:e.onRemoveTicket&&1===t.quantity&&(null==(r=t.orderLine.metadata)?void 0:r.venue_booking_role)==="tickets"?{label:`${H("Remove ticket","删除门票")} ${t.title||H("Ticket","门票")} #${l+n+1}`,disabled:d||!!S||!!M||L.blocked||c.loading,onClick:()=>{J(t,n)}}:void 0}),t.config.enabled&&(0,eH.jsxs)("div",{className:"holder-picker",children:[(0,eH.jsxs)("label",{className:"field",htmlFor:m,children:[(0,eH.jsx)("span",{children:i.choose}),(0,eH.jsxs)("select",{id:m,value:null==u?"":String(u),disabled:d||!!S||!!M||L.blocked||s,style:s?{opacity:.5,cursor:"not-allowed"}:void 0,"aria-invalid":h||void 0,"aria-describedby":h?`${m}-error`:void 0,onChange:e=>{e.target.value&&K(t.uid,n,e.target.value)},children:[(0,eH.jsx)("option",{value:"",disabled:!0,children:i.placeholder}),null!=u&&!p&&(0,eH.jsx)("option",{value:String(u),children:String(u)}),o.map(e=>(0,eH.jsx)("option",{value:String(e.id),children:e.label||String(e.id)},String(e.id)))]})]}),h&&(0,eH.jsx)("p",{id:`${m}-error`,className:"error-text",role:"alert",children:i.missing}),(0,eH.jsxs)(eXE,{secondary:!0,disabled:d||!!S||!!M||L.blocked||e1G(D,`${z}:${t.config.formId}`),onClick:()=>void Z(t,n),children:[(0,eH.jsx)(e3Y,{size:18,"aria-hidden":"true"}),(0,eH.jsx)("span",{children:i.create})]})]})]},m)})},el=(0,eH.jsxs)(eH.Fragment,{children:[q&&(0,eH.jsxs)("p",{className:"small muted",children:[H("Choose a profile for each ticket in this group to save the assignments together.","请为该组每张票选择档案,系统会一并保存,保留全部票数。")," ",(0,eH.jsx)("button",{type:"button",className:"text-link",disabled:!!S||!!M,onClick:()=>C({}),children:H("Discard unsaved choices","撤销未保存选择")})]}),(x||L.blocked)&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:x||H("A previous holder update is unconfirmed. Review the order before continuing.","上次持票人写回结果未确认,请先核对订单。")})]});return(0,eH.jsxs)("div",{ref:b,className:"venue-booking-holder-step",children:[e.renderContent?(0,eH.jsxs)(eH.Fragment,{children:[el,e.renderContent({renderLine:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=L.lines.find(t=>t.uid===e);return l?O?(0,eH.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-busy":"true","aria-label":H("Loading holder profiles","正在加载持票人档案"),children:(0,eH.jsx)("div",{className:"holder-picker","aria-hidden":"true",children:(0,eH.jsx)("span",{className:"venue-holder-skeleton-field"})})}):(0,eH.jsx)("div",{className:"child-assignments",children:et(l,t)}):null}})]}):(0,eH.jsxs)(e33,{children:[(0,eH.jsxs)("div",{className:"completion-bar",children:[(0,eH.jsx)(e2l,{size:23,"aria-hidden":"true"}),(0,eH.jsx)("b",{children:L.requiredCount?`${X}/${L.requiredCount} ${H("completed","已完成")}`:H("Holder profiles are optional","持票人档案选填")}),L.requiredCount>0&&(0,eH.jsx)("progress",{"aria-label":H("Completed","已完成"),value:X,max:L.requiredCount})]}),el,O?(0,eH.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-busy":"true","aria-label":H("Loading holder profiles","正在加载持票人档案"),children:R.map(e=>(0,eH.jsxs)("div",{className:"cart-group","aria-hidden":"true",children:[(0,eH.jsx)("span",{className:"venue-holder-skeleton-title"}),(0,eH.jsx)("span",{className:"venue-holder-skeleton-text"}),(0,eH.jsxs)("div",{className:"holder-picker",children:[(0,eH.jsx)("span",{className:"venue-holder-skeleton-field"}),(0,eH.jsx)("span",{className:"venue-holder-skeleton-field"})]})]},e.key))}):R.map(t=>{var l,i,a,n,r,s,d,c;let u=t.members[0],p=ee(u),m=u.orderLine,g=t.members.reduce((e,t)=>e+t.quantity,0),h=null==(l=e.catalogProducts)?void 0:l.find(e=>String(e.id)===String(u.orderLine.product_id)),v=e8e(u.orderLine,g,o||"en",h,u.cacheItem),f=0,y=t.members.map(e=>{let t=et(e,f);return f+=e.quantity,t});return(0,eH.jsxs)("section",{className:"cart-group",children:[(0,eH.jsx)(e32,{className:"booking-order-item-flat",title:u.title||H("Ticket","门票"),image:eXp(u.cacheItem.cover||(null==(i=u.cacheItem._extend)?void 0:i.product_cover)||m.product_cover,o||"en")||void 0,details:(0,eH.jsxs)("div",{className:"booking-item-metadata",children:[(null==(a=u.booking)?void 0:a.start_date)&&(0,eH.jsxs)("div",{children:[(0,eH.jsx)(e0r,{size:16,"aria-hidden":"true"}),e0y((null==(n=u.booking.metadata)?void 0:n.availability_business_date)||u.booking.start_date,o||"en")]}),(null==(r=u.booking)?void 0:r.start_time)&&(0,eH.jsxs)("div",{children:[(0,eH.jsx)(e3Q,{size:16,"aria-hidden":"true"}),u.booking.start_time,"–",u.booking.end_time]}),((null==(s=u.booking)?void 0:s.resources)||[]).length>0&&(0,eH.jsx)("div",{children:u.booking.resources.map(e=>{var t;return eXp((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,o||"en")}).filter(Boolean).join(" \xb7 ")}),(u.cacheItem.product_option_string||(null==(d=u.cacheItem._extend)?void 0:d.product_option_string)||m.product_option_string)&&(0,eH.jsx)("div",{children:eXp(u.cacheItem.product_option_string||(null==(c=u.cacheItem._extend)?void 0:c.product_option_string)||m.product_option_string,o||"en")}),(0,eH.jsx)("div",{children:u.config.enabled?u.config.required?p.required:p.optional:p.notRequired})]}),children:v.length>0&&(0,eH.jsx)("ul",{className:"venue-order-bundle","aria-label":H("Included items","套餐内含商品"),children:v.map(e=>(0,eH.jsxs)("li",{children:[(0,eH.jsx)("span",{children:e.name||H("Included item","套餐子商品")}),(0,eH.jsxs)("span",{children:["\xd7 ",e.quantity]})]},e.key))})}),(0,eH.jsx)("div",{className:"child-assignments",children:y})]},t.key)}),e.afterAssignments]}),M&&V(M.identity)&&(0,eH.jsx)(e8r,{formId:M.formId,kiosk:eXy(D),customerId:UY(null==D||null==(l=D.getTempOrder)?void 0:l.call(D),void 0,null==D||null==(a=D.getOrderCustomerSnapshot)||null==(i=a.call(D))?void 0:i.id),locale:o,isCurrent:()=>V(M.identity),onClose:()=>{T(void 0),y.current||c.reload()},onCreated:Q,onUnconfirmed:()=>{var e;let t;D&&(e=`${M.identity}:${M.formId}`,(t=e1K.get(D)||new Set).add(e),e1K.set(D,t)),k(H("The profile save result is unconfirmed. Reload this page to check the profiles before creating another one.","档案保存结果未确认,请刷新页面核对档案后再尝试新建。"))}},eXy(D)?JSON.stringify([M.identity,M.uid,M.index,M.base]):void 0)]})});e8c.displayName="VenueBookingHolderStep";let e8u=["first_name","last_name","phone","email"],e8p=e=>e&&"object"==typeof e&&!Array.isArray(e)?e:{},e8m=e=>JSON.parse(JSON.stringify(e)),e8g=e=>JSON.stringify(e8p(e));function e8h(e){var t,l;let i=e.context.sales.bookingTicket,a=(null==i||null==(t=i.getTempOrder)?void 0:t.call(i))??e.context.sales.tempOrder;return{handle:i,scopeKey:e.scopeKey,identity:(null==a||null==(l=a._extend)?void 0:l.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id)||a,customer:String((null==a?void 0:a.customer_id)||""),order:a}}let e8v=(e,t)=>!!e&&e.handle===t.handle&&e.scopeKey===t.scopeKey&&e.identity===t.identity&&e.customer===t.customer,e8f=(0,eC.forwardRef)((e,t)=>{var l;let[i]=eT.Form.useForm(),[a,n]=(0,eC.useState)(),[r,o]=(0,eC.useState)(!1),s=(0,eC.useRef)(e);s.current=e;let d=(0,eC.useRef)(!0),c=(0,eC.useRef)(0),u=(0,eC.useRef)(!1),p=(0,eC.useRef)(),m=e8h(e),g=e8g(null==(l=m.order)?void 0:l.contacts_info),h=JSON.stringify(e.config),v=String(e.locale).startsWith("zh"),f=(e,t)=>v?t:e,y=e=>({first_name:f("Enter a first name.","请输入名字。"),last_name:f("Enter a last name.","请输入姓氏。"),phone:f("Enter a phone number.","请输入电话号码。"),email:f("Enter an email address.","请输入邮箱。")})[e];(0,eC.useEffect)(()=>(d.current=!0,()=>{d.current=!1,c.current+=1}),[]),(0,eC.useLayoutEffect)(()=>{var e,t,l,a;let r=!e8v(null==(e=p.current)?void 0:e.owner,m);if(r||(null==(t=p.current)?void 0:t.contact)!==g){let e,t;c.current+=1,r&&(i.resetFields(),n(void 0)),i.setFieldsValue((a=e8p(null==(l=m.order)?void 0:l.contacts_info),t=String((e=e8p(a.phone)).country_calling_code||""),{first_name:a.first_name||"",last_name:a.last_name||"",email:a.email||"",phone:{phone:e.phone||"",countryCallingCode:t&&!t.startsWith("+")?`+${t}`:t,countryCode:e.country_code||""}})),p.current={owner:m,contact:g}}},[m.handle,m.identity,m.customer,e.scopeKey,g,i]);let b=(e,t)=>{let l=s.current,i=e8h(l);if(!d.current||!1===l.isActive||!e8v(t,i)||!i.order)return!1;let a=e8p(i.order.contacts_info),n=function(e,t,l){let i=e8m(t);for(let o of e8u){var a,n,r;!1!==l.fields[o].visible&&(i[o]="phone"===o?{...e8p(t.phone),phone:(null==(a=e.phone)?void 0:a.phone)||"",country_calling_code:(null==(n=e.phone)?void 0:n.countryCallingCode)||"",country_code:(null==(r=e.phone)?void 0:r.countryCode)||""}:e[o]||"")}return(i.first_name!==t.first_name||i.last_name!==t.last_name)&&(i.display_name=[i.first_name,i.last_name].filter(Boolean).join(" ")),i}(e,a,l.config);if(e8g(n)===e8g(a))return!0;let r=e8m(n);return p.current={owner:i,contact:e8g(r)},p.current={owner:i,contact:e8g(l.context.sales.setContactsInfo(r))},!0};return(0,eC.useImperativeHandle)(t,()=>({validate:async()=>{var e,t,l,a,r;if(u.current||!d.current||!1===s.current.isActive)return!1;if(!s.current.config.enabled)return!0;if((null==(e=s.current.context.sales.contactInfo)?void 0:e.loading)||(null==(t=s.current.context.sales.contactInfo)?void 0:t.pending))return!1;let p=e8h(s.current);if(!(null==(l=p.handle)?void 0:l.validateContactInfo)||!p.order)return n(f("Contact details are not ready. Please retry.","联系人信息尚未就绪,请重试。")),!1;let m=++c.current,g=JSON.stringify(s.current.config),h=e8g(p.order.contacts_info),v=()=>{var e;return d.current&&m===c.current&&!1!==s.current.isActive&&e8v(p,e8h(s.current))&&JSON.stringify(s.current.config)===g&&e8g(null==(e=e8h(s.current).order)?void 0:e.contacts_info)===h};u.current=!0,o(!0),n(void 0);try{let e=await i.validateFields();if(!v())return!1;let t=e8u.filter(t=>{var l;let i=s.current.config.fields[t],a="phone"===t?null==(l=e.phone)?void 0:l.phone:e[t];return i.visible&&i.required&&("string"!=typeof a||!a.trim())});if(t.length)return i.setFields(t.map(e=>({name:e,errors:[y(e)]}))),!1;if(!b(e,p)||(h=e8g(null==(a=e8h(s.current).order)?void 0:a.contacts_info),!v()))return!1;return await p.handle.validateContactInfo(),v()}catch(e){if(!v())return!1;return"CONTACT_INFO_REQUIRED"===e.code&&Array.isArray(e.fields)?i.setFields(e.fields.filter(e=>e8u.includes(e)).map(e=>({name:e,errors:[y(e)]}))):(null==(r=e.errorFields)?void 0:r.length)||n(e.message||f("Unable to validate contact details. Please retry.","无法校验联系人信息,请重试。")),!1}finally{u.current=!1,d.current&&o(!1)}}}),[i,h,e.locale]),(0,eH.jsxs)("div",{className:"venue-contact-form","aria-busy":r,children:[(0,eH.jsx)(ete,{config:e.config.fields,form:i,disabled:e.disabled||r||!1===e.isActive,onValuesChange:(e,t)=>{if(!s.current.disabled&&!1!==s.current.isActive&&s.current.config.enabled&&!u.current){c.current+=1,n(void 0);try{b(t,m)}catch(e){n(e instanceof Error?e.message:f("Unable to save contact details.","无法保存联系人信息。"))}}}}),a&&(0,eH.jsx)("p",{className:"venue-contact-form__error",role:"alert",children:a})]})});function e8y(e){var t,l;let{policyId:i,title:a,request:n,preloadedPolicy:r,locale:o,accepted:s=!1,onClose:d,onConfirm:c,onLoadError:u}=e;s2(Vg,o||(null==(t=eL.getLocale)?void 0:t.call(eL))||"en");let p=(null==(l=eJF())?void 0:l.presentationPlatform)==="kiosk",m=String(o||"").startsWith("zh");return(0,eH.jsx)(Vx,{open:!0,item:{id:i,title:a},isHideCheckout:!1,initialAccepted:s,preloadedPolicy:p?r:void 0,depositProtocolRequest:n,onCancel:d,onConfirm:c,onLoadError:u,renderDialog:e=>{let{title:t,body:l,footer:i}=e;return(0,eH.jsx)(e0t,{title:t,className:"venue-policy-modal",mobile:"fullscreen",zIndex:600,closeLabel:m?"关闭":"Close",onClose:d,bodyClassName:"venue-policy-body venue-booking-legacy-controls",footerClassName:"venue-policy-footer venue-booking-legacy-controls",footer:i,children:l})}})}function e8b(e){let{title:t,resourceTitle:l,saved:i,open:a,disabled:n,busy:r,locale:o,onOpen:s,onClose:d,children:c,footer:u,external:p=!1,opening:m=!1}=e,g=String(o||"").startsWith("zh"),h=r?g?"正在保存…":"Saving…":i?g?"已保存":"Saved":g?"未保存":"Not saved",v=i?g?"编辑资料":"Edit details":g?"填写资料":"Fill in details";return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("button",{type:"button",className:`checkout-agreement venue-resource-form-entry${i?" accepted":""}`,"data-accepted":i,"aria-haspopup":"dialog","aria-expanded":a,"aria-label":`${v} \xb7 ${t} \xb7 ${h}`,disabled:n,onClick:s,children:[(0,eH.jsx)("span",{className:"agreement-state","aria-hidden":"true",children:m?(0,eH.jsx)(eT.Spin,{size:"small"}):i&&(0,eH.jsx)(e2P,{size:15,weight:"bold"})}),(0,eH.jsxs)("span",{className:"agreement-copy",children:[(0,eH.jsx)("b",{children:t}),(0,eH.jsxs)("small",{children:[l&&l!==t?`${l} \xb7 `:"",h]})]}),(0,eH.jsxs)("span",{className:"agreement-open","aria-hidden":"true",children:[(0,eH.jsx)("span",{children:v}),(0,eH.jsx)(e2D,{size:15})]})]}),!p&&(0,eH.jsx)(e0t,{title:t,className:"venue-resource-form-modal",mobile:"fullscreen",zIndex:600,open:a,onClose:d,closeLabel:g?"关闭":"Close",closeOnBackdrop:!r,closeOnEscape:!r,externalDialogSelector:eX9,bodyClassName:"venue-resource-form-body",footerClassName:"venue-resource-form-footer",footer:u,children:c})]})}class e8x extends Error{constructor(e,t,l=!1){super(e),e1(this,"code",void 0),e1(this,"uncertain",void 0),this.code=t,this.uncertain=l}}let e8k=e=>!!e&&"[object Object]"===Object.prototype.toString.call(e),e8_=e=>!!e&&"object"==typeof e&&"booking-resource-form"===e.kind&&1===e.version&&"function"==typeof e.close;function e8w(e){var t,l,i;let a=(null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.context.sales.tempOrder;return JSON.stringify([e.scopeKey,(null==a||null==(i=a._extend)?void 0:i.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id),null==a?void 0:a.customer_id])}function e8S(e){var t,l;let i=(null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.context.sales.tempOrder;return JSON.stringify([e8w(e),((null==i?void 0:i.bookings)||[]).map(e=>{var t;return[null==(t=e.metadata)?void 0:t.unique_identification_number,e.start_date,e.start_time,e.end_date,e.end_time,e3o(e)]})])}let e8j=(0,eC.forwardRef)((e,t)=>{var l,i,a,n,r;let o,s,d,{context:c,locale:u,disabled:p=!1,isActive:m=!0,includeHolderValidation:g=!0}=e,h=dq("venue-review"),v=(0,eC.useRef)(null),f=eXN(),y=(0,eC.useRef)(null),b=(0,eC.useRef)(null),x=(0,eC.useRef)(e);x.current=e;let k=(0,eC.useRef)(!0),_=e$(),w=eXy(c.sales.bookingTicket),S=(0,eC.useRef)();S.current||(s=e=>{try{null==e||e.close()}catch{}},S.current={close:d=()=>{let e=o;o=void 0,e&&(e.done=!0,s(e.handle))},isOpen:()=>!!(o&&!o.done),open(e){if(d(),!e.isCurrent())return;let t={done:!1};o=t;let l=()=>o===t&&!t.done&&e.isCurrent(),i=()=>{t.done=!0,o===t&&(o=void 0)},a=a=>{l()&&(i(),s(t.handle),e.onError(a))},n=()=>new e8x("The kiosk form service is unavailable. Please update this terminal and retry.","HOST_UNAVAILABLE");if(!Number.isSafeInteger(e.request.formId)||e.request.formId<=0||!e.action)return void a(n());let r=e.request.formId,c=t=>{if(l())try{if(!t||Number(t.formId)!==r)return void a(new e8x("The saved form does not match this booking.","FORM_MISMATCH",!0));if("opened"===t.status)e.onOpened(t);else if("saved"===t.status){let l;if(l=t.recordId,!(("string"==typeof l||"number"==typeof l)&&/^\d+$/.test(String(l))&&Number.isSafeInteger(Number(l))&&Number(l)>0)||!e8k(t.values))return void a(new e8x("The form did not return a saved record.","SAVED_RECORD_REQUIRED",!0));let n={...t,values:JSON.parse(JSON.stringify(t.values))};if(!e8k(n.values))return void a(new e8x("The form did not return valid saved values.","SAVED_RECORD_REQUIRED",!0));i(),e.onSaved(n)}else"cancelled"===t.status?(i(),e.onCancelled()):"error"===t.status?a(new e8x("string"==typeof t.message&&t.message||"Unable to load the form. Please retry.",t.code||"HOST_ERROR",!!t.uncertain)):a(new e8x("The kiosk form service returned an invalid result.","HOST_RESPONSE_INVALID"))}catch(e){a(new e8x(e instanceof Error?e.message:"The kiosk form service returned an invalid result.","HOST_RESPONSE_INVALID",!0))}},u=!0,p=[];try{let i=e.action({type:"pisell1.goBookingResourceForm",data:{...e.request,...e.request.values?{values:JSON.parse(JSON.stringify(e.request.values))}:{},isCurrent:l},callback(e){u?p.push(e):c(e)}});if(u=!1,!l()){p.length=0,e8_(i)&&s(i);return}if(!e8_(i)){i&&"function"==typeof i.then&&Promise.resolve(i).catch(()=>{}),p.length=0,a(n());return}t.handle=i,p.splice(0).forEach(c)}catch(e){u=!1,p.length=0,a(e instanceof e8x?e:new e8x(e instanceof Error?e.message:"Unable to open the form. Please retry.","HOST_ERROR"))}}});let j=(0,eC.useRef)(0),[N]=Wi({components:["FormCard"]}),C=(0,eC.useRef)({}),M=(0,eC.useRef)(new Set),T=(0,eC.useRef)(new Set),[I,P]=(0,eC.useState)([]),[A,D]=(0,eC.useState)("loading"),[E,O]=(0,eC.useState)(null),[z,L]=(0,eC.useState)(null),[R,$]=(0,eC.useState)(null),[F,q]=(0,eC.useState)(null),[B,H]=(0,eC.useState)(null),[V,U]=(0,eC.useState)({}),[Y,W]=(0,eC.useState)({}),[K,G]=(0,eC.useState)(),[Q,Z]=(0,eC.useState)({}),J=e.acceptedPolicies??Q,X=(0,eC.useRef)(J);X.current=J;let ee=e=>{var t,l;let i=x.current.acceptedPolicies??X.current,a="function"==typeof e?e(i):e;X.current=a,void 0!==x.current.acceptedPolicies?null==(t=(l=x.current).onAcceptedPoliciesChange)||t.call(l,a):Z(a)},et=(0,eC.useRef)(e8w(e)),[el,ei]=(0,eC.useState)(0),[,ea]=(0,eC.useState)(0),en=e8S(e),er=(0,eC.useRef)(),eo=String(u||"").startsWith("zh"),es=(e,t)=>eo?t:e,ed=e=>{var t,l;return eXp(null==(l=e.policyResponse)||null==(t=l.data)?void 0:t.title,u||"en").trim()||es("Agreement","协议")},ec=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:en;return k.current&&!1!==x.current.isActive&&e8S(x.current)===e},eu=e=>{var t,l,i,a;return null==(a=x.current.context.sales.bookingTicket)||null==(i=a.getTempOrder)||null==(l=i.call(a))||null==(t=l.bookings)?void 0:t.find(t=>{var l;return String((null==(l=t.metadata)?void 0:l.unique_identification_number)||"")===e})},ep=e=>!M.current.has(e.key)&&e3c(e,eu),em=e=>w?ep(e):!!(N&&T.current.has(e.key)&&ep(e)),eg=e=>{let t=()=>{ec(en)&&f(()=>ec(en)&&v.current?e(v.current):null,{block:"center"})};x.current.onValidationBlocked?x.current.onValidationBlocked(t):t()},eh=()=>eg(e=>e.querySelector(".venue-confirmation-feedback"));(0,eC.useEffect)(()=>(k.current=!0,()=>{var e;k.current=!1,++j.current,null==(e=S.current)||e.close()}),[]),(0,eC.useEffect)(()=>{var t;let l=!1;++j.current,null==(t=S.current)||t.close(),er.current=void 0,D("loading"),O(null),L(null);let i=e8w(e);if(et.current!==i&&ee({}),et.current=i,G(void 0),$(null),q(null),H(null),U({}),W({}),M.current.clear(),T.current.clear(),!m)return;let a=c.sales.bookingTicket;return(async()=>{var t,i,n,r,o;if(!a)throw Error(es("Booking details are not ready.","预订详情尚未就绪。"));let s=(null==(i=a.getTempOrder)||null==(t=i.call(a))?void 0:t.bookings)||[],d=[],u=new Map,p=new Map,m=new Map;for(let t of s){let l=String(t.start_date||e.date||"").slice(0,10),i=e3o(t);if(!i.length)continue;let a=m.get(l)||new Set;i.forEach(e=>a.add(e)),m.set(l,a)}for(let t of s){let i=e3o(t);if(!i.length)continue;let r=String((null==(n=t.metadata)?void 0:n.unique_identification_number)||""),o=String(t.start_date||e.date||"").slice(0,10);if(!r||!/^\d{4}-\d{2}-\d{2}$/.test(o))throw Error(es("Unable to load the booking resource forms.","无法读取预订资源的关联表单。"));if("function"!=typeof a.queryBookingResourceDetails)throw Error(es("The booking service needs to be updated before resource forms can be loaded.","预订服务需要更新后才能读取资源关联表单。"));if(u.has(o)||u.set(o,await a.queryBookingResourceDetails({date:o,resourceIds:[...m.get(o)||[]]})),l||!ec())return;let s=u.get(o)||[];for(let e of i){let t=s.find(t=>String(t.id)===e);if(!t)throw Error(es("A selected resource is no longer available. Please reselect it.","无法读取已选资源,请重新选择。"));let i=t.resource_form_id,n=Number(i);if(i&&(!Number.isSafeInteger(n)||n<=0))throw Error(es("The resource form configuration is invalid.","资源关联表单配置无效。"));let o=t.policy_id?String(t.policy_id):void 0;if(o&&!p.has(o)){let e=a.getProtocol;if(!e)throw Error(es("Unable to load the resource policy. Please retry.","无法加载资源协议,请重试。"));let t=function(e){if(!e||"object"!=typeof e||Array.isArray(e)||200!==e.code||!e.data||"string"!=typeof e.data.content)return{status:"invalid"};let t=e.data.content;if(!t.trim())return{status:"empty"};if("u">typeof DOMParser){let l=new DOMParser().parseFromString(t,"text/html").body;if(l.querySelector("img, picture, svg, video, audio, iframe, object, embed, canvas, math, hr, input, select, textarea, button")||Array.from(l.querySelectorAll("[style]")).some(e=>/background(?:-image)?\s*:[^;]*url\s*\(/i.test(e.getAttribute("style")||"")))return{status:"ready",response:e};if(l.querySelectorAll("script, style, template, noscript").forEach(e=>e.remove()),!(l.textContent||"").replace(/[\s\u200b-\u200d\u2060\ufeff]/g,""))return{status:"empty"}}return{status:"ready",response:e}}(await e.call(a,o));if(l||!ec())return;if("invalid"===t.status)throw Error(es("Unable to load the resource policy. Please retry.","无法加载资源协议,请重试。"));p.set(o,"ready"===t.status?t.response:void 0)}let c=o?p.get(o):void 0;(n>0||c)&&d.push({key:`${r}:${e}:${n||""}:${o||""}`,bookingUid:r,resourceId:e,title:String(t.main_field||t.name||e),...n>0?{formId:n}:{},...c?{policyId:o,policyResponse:c}:{}})}}if(!l&&ec()){let e=function(e){let t=new Map;for(let l of e){let e=JSON.stringify([l.resourceId,l.formId??null,l.policyId??null]),i=t.get(e);if(i)i.members.some(e=>e.key===l.key)||i.members.push(l);else{let{bookingUid:i,...a}=l;t.set(e,{...a,key:e,members:[l]})}}return[...t.values()]}(d),t=!1;for(let i of e){let e=e3d(i,eu);if(!(!e||e3c(i,eu))&&1===new Set(i.members.map(e=>e3s(e,eu(e.bookingUid))).filter(Boolean).map(e=>String(e.recordId))).size){if(!a.updateOrderBooking)throw Error(es("Unable to save the form.","表单保存失败。"));await e3u(i,e,{readBooking:eu,updateBooking:e=>a.updateOrderBooking(e),assertCurrent:()=>{if(l||!ec())throw Error(es("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"))}}),t=!0}}if(l||!ec()||(t&&(c.cart.refreshCartSnapshot(),await (null==(r=(o=x.current).onMutation)?void 0:r.call(o))),l||!ec()))return;P(e),ee(t=>(function(e,t){let l={};for(let a of e){var i;let e=t[a.key];(null==e?void 0:e.status)==="confirmed"&&a.policyId&&String(e.policyId)===a.policyId&&e.policy&&(null==(i=a.policyResponse)?void 0:i.data)&&JSON.stringify(e.policy)===JSON.stringify(a.policyResponse.data)&&(l[a.key]=e)}return l})(e,t)),er.current=en,D("ready")}})().catch(e=>{!l&&ec()&&(O(e3A(e,es("Unable to load the booking resource forms. Please retry.","无法加载预订资源的关联表单,请重试。"))),D("error"))}),()=>{var e;l=!0,++j.current,null==(e=S.current)||e.close()}},[c.sales.bookingTicket,en,m,el,w]);let ev=async()=>{var e;let t=c.sales.contactInfo;if(!ec())return!1;if(!(null==t?void 0:t.config)||t.loading||t.pending)return O(es("Wait for the contact details to load and save.","请等待联系人信息加载并保存完成。")),eh(),!1;if(!t.config.enabled)return!0;let l=await (null==(e=b.current)?void 0:e.validate());return!!ec()&&(!0!==l?(L({section:"contact",message:es("Check your contact details before continuing.","请检查联系人信息后继续。")}),eg(e=>e.querySelector('.contact-section input[aria-invalid="true"], .contact-section select[aria-invalid="true"], .contact-section textarea[aria-invalid="true"], .contact-section .pisell-lowcode-form-item-has-error, .contact-section .ant-form-item-has-error')||e.querySelector(".contact-section")),!1):(L(e=>(null==e?void 0:e.section)==="contact"?null:e),!0))};(0,eC.useImperativeHandle)(t,()=>({validateContact:ev,validate:async()=>{var e,t;if(!ec())return!1;if(er.current!==en||"ready"!==A||R||w&&((null==(e=S.current)?void 0:e.isOpen())||B||F))return O(es("Wait for the confirmation details to load and save.","请等待确认资料加载并保存完成。")),eh(),!1;let l=I.filter(e=>e.formId).findIndex(e=>!em(e));if(l>=0)return L({section:"resources",message:es("Complete and save each resource form before continuing.","请先填写并保存每项资源关联表单。")}),eg(e=>e.querySelectorAll(".venue-resource-form-entry")[l]||null),!1;let i=I.filter(e=>e.policyId).findIndex(e=>!J[e.key]);return i>=0?(L({section:"agreements",message:es("Read and agree to each resource policy before continuing.","请先阅读并同意各项资源协议。")}),eg(e=>e.querySelectorAll(".venue-confirmation-agreements .checkout-agreement")[i]||null),!1):g&&!await (null==(t=y.current)?void 0:t.validate())?!!ec()&&(O(es("Complete the required holder details before continuing.","请先完成必填持票人资料。")),eh(),!1):!!await ev()&&!!ec()&&(O(null),L(null),!0)}}));let ef=async(e,t,l,i)=>{let a=(null==i?void 0:i.isCurrent)||ec;if(a())try{var n,r,o,s,d;if("success"!==t)throw Error(es("Unable to save the form.","表单保存失败。"));let c=null==l?void 0:l.form_record_id;if(Number(null==l?void 0:l.form_id)!==e.formId||!c||!/^\d+$/.test(String(c)))throw Error(es("The form did not return a saved record.","表单未返回有效的保存记录。"));let u=x.current.context.sales.bookingTicket;if(!(null==u?void 0:u.updateOrderBooking))throw Error(es("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"));let p=JSON.parse(JSON.stringify(i?i.values:(null==(o=C.current[e.key])||null==(r=o.form)||null==(n=r.getFieldsValue)?void 0:n.call(r))||{}));if(await e3u(e,{resourceId:e.resourceId,formId:e.formId,recordId:c,values:p},{readBooking:eu,updateBooking:e=>u.updateOrderBooking(e),assertCurrent:()=>{if(!a())throw Error(es("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"))}}),!a()||(M.current.delete(e.key),x.current.context.cart.refreshCartSnapshot(),await (null==(s=(d=x.current).onMutation)?void 0:s.call(d)),!a()))return;ea(e=>e+1),O(null),W(t=>({...t,[e.key]:""})),q(t=>t===e.key?null:t)}catch(t){if(a()){let l=e3A(t,es("Unable to save the form. Please retry.","表单保存失败,请重试。"));O(l),W(t=>({...t,[e.key]:l}))}}finally{a()&&$(null)}};(null==(i=c.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))||c.sales.tempOrder;let ey=e1H(c),eb=e.orderReview??e.children,ex=0;return(0,eH.jsxs)("section",{ref:v,className:"venue-booking-confirmation checkout-modules","aria-label":es("Booking details","预订资料"),children:[(null==(a=c.sales.contactInfo)?void 0:a.loading)?(0,eH.jsx)(eT.Spin,{}):null,(null==(r=c.sales.contactInfo)||null==(n=r.config)?void 0:n.enabled)&&(0,eH.jsxs)(e3W,{id:`${h}-contact`,number:++ex,title:es("Contact details","联系人信息"),className:"contact-section",children:[(0,eH.jsx)(e8f,{ref:b,context:c,scopeKey:e.scopeKey,config:c.sales.contactInfo.config,disabled:p,isActive:m,locale:u}),(null==z?void 0:z.section)==="contact"&&(0,eH.jsx)("p",{className:"error-text",role:"alert",children:z.message})]}),eb&&(0,eH.jsx)(e3W,{id:`${h}-order`,number:++ex,title:es("Review your order","核对订单"),children:eb}),g?(0,eH.jsx)("div",{hidden:!ey.enabled,children:(0,eH.jsx)(e8c,{ref:y,context:c,scopeKey:e.scopeKey,locale:u,isActive:m,disabled:p,onMutation:e.onMutation})}):e.holderContent,"loading"===A?(0,eH.jsx)(eT.Spin,{}):null,E?(0,eH.jsx)("div",{className:"venue-confirmation-feedback",children:(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:E,action:"error"===A?(0,eH.jsx)(eT.Button,{onClick:()=>ei(e=>e+1),children:es("Retry","重试")}):void 0})}):null,"ready"===A&&I.some(e=>e.formId)?(0,eH.jsxs)(e3W,{id:`${h}-resources`,number:++ex,title:es("Form","表单"),children:[(null==z?void 0:z.section)==="resources"&&I.some(e=>e.formId&&!em(e))&&(0,eH.jsx)("p",{className:"error-text",role:"alert",children:z.message}),I.filter(e=>e.formId).map(e=>{var t;return(0,eH.jsxs)(e8b,{title:V[e.key]||e.title,resourceTitle:e.title,locale:u,external:w,opening:B===e.key,saved:ep(e),open:F===e.key&&ec(),disabled:p||!!(R&&R!==e.key)||!!B,busy:R===e.key,onOpen:()=>{w?(e=>{var t,l,i,a,n;if(!w||!e.formId||p||R||B||(null==(t=S.current)?void 0:t.isOpen())||!ec())return;let r=++j.current,o=c.sales.bookingTicket,s=()=>ec(en)&&j.current===r&&x.current.context.sales.bookingTicket===o&&eXy(x.current.context.sales.bookingTicket),d=e3d(e,eu),u=(null==(l=(null==o||null==(i=o.getTempOrder)?void 0:i.call(o))||c.sales.tempOrder)?void 0:l.customer_id)??void 0;q(e.key),H(e.key),W(t=>({...t,[e.key]:""})),S.current.open({action:"function"==typeof(null==_||null==(n=_.appHelper)||null==(a=n.utils)?void 0:a.action)?e=>_.appHelper.utils.action(e):void 0,request:{formId:e.formId,recordId:null==d?void 0:d.recordId,values:null==d?void 0:d.values,customerId:oi(u)?void 0:u,zIndex:1101},isCurrent:s,onOpened:t=>{s()&&(H(null),"string"==typeof t.title&&t.title.trim()&&U(l=>({...l,[e.key]:t.title.trim()})))},onSaved:t=>{s()&&(H(null),q(null),M.current.add(e.key),$(e.key),ef(e,"success",{form_id:t.formId,form_record_id:t.recordId},{values:t.values,isCurrent:s}))},onCancelled:()=>{s()&&(H(null),q(null))},onError:t=>{if(!s())return;H(null),q(null),t.uncertain&&M.current.add(e.key);let l="HOST_UNAVAILABLE"===t.code?es("The kiosk form service is unavailable. Please update this terminal and retry.","终端表单服务不可用,请更新终端后重试。"):t.uncertain?es("We could not confirm the saved form. Reopen it to review before continuing.","无法确认表单的保存结果,请重新打开核对后继续。"):es("Unable to load the form. Please retry.","表单加载失败,请重试。");O(l),W(t=>({...t,[e.key]:l}))}})})(e):!ec()||p||R&&R!==e.key||q(e.key)},onClose:()=>q(null),footer:(0,eH.jsx)(eXE,{disabled:p||!!R||!T.current.has(e.key)||ep(e),busy:R===e.key,onClick:()=>{if(ec()&&!p&&!R)try{var t,l,i;if(!(null==(t=C.current[e.key])?void 0:t.submit))throw Error(es("The form is not ready.","表单尚未就绪。"));W(t=>({...t,[e.key]:""})),$(e.key),null==(i=C.current[e.key])||null==(l=i.submit)||l.call(i)}catch(l){let t=e3A(l,es("Unable to save the form. Please retry.","表单保存失败,请重试。"));$(null),O(t),W(l=>({...l,[e.key]:t}))}},children:ep(e)?es("Saved","已保存"):es("Save details","保存资料")}),children:[Y[e.key]&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:Y[e.key]}),!w&&(N?(0,eH.jsx)(eH.Fragment,{children:(0,eH.jsx)("div",{className:"venue-booking-legacy-controls",style:p||R?{pointerEvents:"none"}:void 0,children:(0,eH.jsx)(N,{id:e.formId,ref:t=>{C.current[e.key]=t},isGetLastData:!1,setting:{isHidden:1},isV2API:!0,isShowSkeleton:!0,isClearData:!1,defaultValues:null==(t=e3d(e,eu))?void 0:t.values,onSubmit:(t,l)=>void ef(e,t,l),onFormConfigChange:t=>{if(ec()&&t&&Object.keys(t).length){var l;T.current.add(e.key);let i=eXp((null==(l=t.form)?void 0:l.title)??t.title,u||"en");i&&U(t=>t[e.key]===i?t:{...t,[e.key]:i}),ea(e=>e+1)}},onChange:(t,l)=>{if(ec()){if(t)T.current.delete(e.key);else if(!l||!Object.keys(l).length){T.current.delete(e.key);let t=es("Unable to load the form. Please retry.","表单加载失败,请重试。");O(t),W(l=>({...l,[e.key]:t}))}}},onFinishFailed:()=>{if(!ec())return;let t=es("Please complete the required form fields.","请填写表单中的必填内容。");$(null),O(t),W(l=>({...l,[e.key]:t}))},onFormValueChange:t=>{var l;if(!ec())return;let i=null==(l=e3d(e,eu))?void 0:l.values;JSON.stringify(t)===JSON.stringify(i)?M.current.delete(e.key):M.current.add(e.key),ea(e=>e+1)}})})}):(0,eH.jsx)(eT.Alert,{type:"error",message:es("The form component is unavailable. Reload before continuing.","表单组件未加载,请刷新后继续。")}))]},`${en}:${e.key}`)})]}):null,(e.agreements||"ready"===A&&I.some(e=>e.policyId))&&(0,eH.jsxs)(e3W,{id:`${h}-agreements`,number:++ex,title:es("Agreements","协议"),className:"venue-confirmation-agreements",children:[(null==z?void 0:z.section)==="agreements"&&I.some(e=>e.policyId&&!J[e.key])&&(0,eH.jsx)("p",{className:"error-text",role:"alert",children:z.message}),"ready"===A&&I.filter(e=>e.policyId).map(e=>(0,eH.jsx)(e2z,{title:ed(e),lang:eo?"zh":"en",accepted:!!J[e.key],disabled:p||!!R,onOpen:()=>void(e=>{if(!p&&!R&&ec())try{if(!e.policyId||!e.policyResponse)throw Error(es("Unable to load the resource policy.","无法加载资源协议。"));$(e.key),G({task:e,request:async t=>{if(!ec()||String(t)!==e.policyId)throw Error(es("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"));return e.policyResponse}})}catch(e){ec()&&!["cancel","programmatic-close","replaced"].includes(null==e?void 0:e.type)&&O(e3A(e,es("Unable to load the resource policy.","无法加载资源协议。")))}})(e)},e.key)),e.agreements]}),e.note&&(0,eH.jsx)(e3W,{id:`${h}-note`,number:++ex,title:es("Order note","订单留言"),children:e.note}),(null==K?void 0:K.task.policyId)&&ec()&&(0,eH.jsx)(e8y,{policyId:K.task.policyId,title:ed(K.task),request:K.request,locale:u,preloadedPolicy:w?{policyId:K.task.policyId,response:K.task.policyResponse}:void 0,accepted:!!J[K.task.key],onClose:()=>{G(void 0),$(null)},onConfirm:e=>{let t=K.task.policyId;ec()&&t&&(ee(l=>({...l,[K.task.key]:{status:"confirmed",policyId:t,policy:e}})),G(void 0),$(null))},onLoadError:e=>{ec()&&(O(e3A(e,es("Unable to load the resource policy.","无法加载资源协议。"))),G(void 0),$(null))}},`${en}:${K.task.key}`)]})});function e8N(e,t,l,i){var a,n,r,o;let s=null==(n=i.find(e=>String(e.id)===String(t)))||null==(a=n.label)?void 0:a.trim();if(s)return s;let d=(null==(r=e.booking)?void 0:r.holder)??(null==(o=e.cacheItem._extend)?void 0:o.holder),c=UR(null==d?void 0:d.form_record);if(1===e.quantity&&1===c.length&&String(c[0])===String(t)&&String(null==d?void 0:d.form_id)===String(e.config.formId)&&((null==d?void 0:d.customer_id)==null||String(d.customer_id)===String(l)))return"string"==typeof d.name&&d.name.trim()||void 0}function e8C(e){var t,l,i,a,n,r,o;let{context:s,scopeKey:d,mode:c,locale:u,disabled:p,onEdit:m,productLineUid:g,inline:h=!1,ordinalOffset:v=0,onRemoveTicket:f}=e,y=U4(),b=e1H(s,d,u),x=String(u||"").startsWith("zh"),k=(e,t)=>x?t:e,_=(0,eC.useRef)(!0),w=(0,eC.useRef)(!1),S=(0,eC.useRef)({context:s,scopeKey:d,disabled:p,onRemoveTicket:f});S.current={context:s,scopeKey:d,disabled:p,onRemoveTicket:f};let j=e1V(s,d),[N,C]=(0,eC.useState)(!1),[M,T]=(0,eC.useState)();(0,eC.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]),(0,eC.useEffect)(()=>{T(void 0)},[j]);let I=e=>_.current&&e1V(S.current.context,S.current.scopeKey)===e,P=(null==(i=s.sales.bookingTicket)||null==(l=i.getOrderCustomerSnapshot)||null==(t=l.call(i))?void 0:t.id)??(null==(r=s.sales.bookingTicket)||null==(n=r.getTempOrder)||null==(a=n.call(r))?void 0:a.customer_id)??(null==(o=s.sales.tempOrder)?void 0:o.customer_id),A=(h?b.displayLines:b.lines).filter(e=>{let t=e.orderLine.metadata;return(!g||e.uid===g)&&!!e.booking&&(!(null==t?void 0:t.venue_booking_scope_key)||t.venue_booking_scope_key===d)&&(!(null==t?void 0:t.venue_booking_role)||t.venue_booking_role===("party"===c?"party_main":"tickets"))});if(!A.length)return null;let D=async(e,t)=>{var l;let i=S.current.onRemoveTicket;if(i&&!S.current.disabled&&!w.current&&!b.blocked&&I(j)&&"tickets"===c&&1===e.quantity&&0===t&&(null==(l=e.orderLine.metadata)?void 0:l.venue_booking_role)==="tickets"){w.current=!0,C(!0),T(void 0);try{await i(e.uid,t)}catch(e){I(j)&&T(e3A(e,k("Unable to remove this ticket. Please try again.","无法删除这张票,请重试。")))}finally{w.current=!1,_.current&&C(!1)}}},E=A.map(e=>{let t=e8s(y.getHolderFormDetailForSource(e.cacheItem),u),l={label:t.edit,disabled:p||N||b.blocked,onClick:m},i=y.getHolderOptionsForSource(e.cacheItem),a=e.booking,n=[a.start_date,a.start_time&&a.end_time?`${a.start_time}–${a.end_time}`:a.start_time].filter(Boolean).join(" \xb7 "),r=Array.from({length:e.quantity},(l,a)=>{let n=e.ids[a],r=null!=n&&""!==n,o=r?e8N(e,n,P,i):void 0;return{name:o,label:e.config.enabled?o||(r?k("Profile linked; name unavailable","档案已关联,姓名暂不可用"):k(`${t.name} not selected`,`尚未选择${t.name}`)):t.notRequired}});return(0,eH.jsxs)("section",{className:h?"venue-inline-holder-review":"cart-group",children:[!h&&(0,eH.jsx)(e32,{className:"booking-order-item-flat",title:e.title||k("Booking","预约"),details:n?(0,eH.jsx)("span",{className:"booking-item-metadata",children:n}):void 0}),"party"===c?(0,eH.jsx)(e31,{items:r.map((e,i)=>({label:r.length>1?`${t.name} #${i+1}`:t.name,value:(0,eH.jsx)("span",{className:e.name?void 0:"needs-attention",children:e.label}),action:l}))}):(0,eH.jsx)("div",{className:"ticket-list",children:r.map((t,i)=>{var a;return(0,eH.jsx)(e32,{layout:"row",icon:(0,eH.jsx)(eXj,{size:20,"aria-hidden":"true"}),title:`${k("Ticket","门票")} #${v+i+1}`,details:(0,eH.jsx)("small",{className:t.name||!e.config.enabled?void 0:"needs-attention",children:t.label}),action:e.config.enabled?l:void 0,removeAction:f&&1===e.quantity&&(null==(a=e.orderLine.metadata)?void 0:a.venue_booking_role)==="tickets"?{label:`${k("Remove ticket","删除门票")} ${e.title||k("Ticket","门票")} #${v+i+1}`,disabled:p||N||b.blocked,onClick:()=>{D(e,i)}}:void 0},i)})})]},e.uid)}),O=M&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:M});return h?(0,eH.jsxs)(eH.Fragment,{children:[O,E]}):(0,eH.jsxs)(e33,{title:k("Holder","持有人"),children:[O,E]})}e8j.displayName="VenueBookingConfirmation";let e8M=(0,eC.forwardRef)(function(e,t){let{source:l,previous:i,ids:a,onChange:n,quantity:r,customerId:o,os:s,disabled:d,text:c}=e,u=U3(),{required:p,formId:m}=Ho(l),[g,h]=(0,eC.useState)(!0),[v,f]=(0,eC.useState)(!1),[y,b]=(0,eC.useState)(0),[x,k]=(0,eC.useState)(!1),_=(0,eC.useRef)(null),w=a.length>r||p&&a.length!==r,S=(0,eC.useMemo)(()=>({...l,_extend:{...l._extend,quantity:r,holder_relations:i}}),[l,r,i]),j=(0,eC.useMemo)(()=>({client:{value:{id:o}}}),[o]);return(0,eC.useEffect)(()=>{let e=!0;h(!0),f(!1);let t=t=>{e&&(f(!t),h(!1))};return u.prepareHolderOptionsForSource(l,{throwOnError:!0}).then(e=>t(e.accessAllowed),()=>t(!1)),()=>{e=!1}},[l,o,y,u.prepareHolderOptionsForSource]),(0,eC.useImperativeHandle)(t,()=>({async readRelations(){if(w){var e;k(!0),null==(e=_.current)||e.scrollIntoView({block:"nearest"});return}if(a.length&&(g||v))return;let t=a.length?await s.getOtherParams():void 0;return ek5(S,a,{productSource:l,customerId:o,isFranchisee:!!(null==t?void 0:t.isFranchisee),holderOptions:u.getHolderOptionsForSource(l),holderFormDetail:u.getHolderFormDetailForSource(l)})}}),[a,w,g,v,s,l,o,S,u]),(0,eH.jsxs)("fieldset",{className:"venue-extra-holder",ref:_,disabled:d,children:[g?(0,eH.jsx)("p",{role:"status",children:c("Loading holder profiles…","正在加载档案…")}):v?(0,eH.jsxs)("div",{role:"alert",children:[c("Holder profiles are unavailable.","暂时无法加载档案。")," ",(0,eH.jsx)("button",{type:"button",onClick:()=>b(e=>e+1),children:c("Retry","重试")})]}):(0,eH.jsx)(Yi,{presentation:"inline",holderOptionsLoaded:!0,state:j,cacheItem:S,required:p,getCurrentCacheItem:()=>S,value:a,onChange:e=>{d||(n(e),k(!1))}},String(m)),x&&w&&(0,eH.jsx)("p",{role:"alert",className:"venue-extra-detail-error",children:p?c(`Choose ${r} holder profiles to continue.`,`请选择 ${r} 份档案后继续。`):c(`Choose up to ${r} holder profiles.`,`最多选择 ${r} 份档案。`)})]})});function e8T(e){let{runtime:t}=e,l=t.configurationModal;return(null==l?void 0:l.extraSession)?(0,eH.jsx)(e8I,{runtime:t,modal:l},l.plan.openId):null}function e8I(e){var t,l,i;let{runtime:a,modal:n}=e,{plan:r,extraSession:o,configuration:s}=n,{text:d,locale:c,bookingUI:u}=a,p=UM(),m=(0,eC.useMemo)(()=>eN7(p.customerAuth),[p.customerAuth]),g=r.productDetail,[h,v]=(0,eC.useState)(o.quantity),[f,y]=(0,eC.useState)(!1),[b,x]=(0,eC.useState)(!1),[k,_]=(0,eC.useState)(),[w,S]=(0,eC.useState)(!1),[j,N]=(0,eC.useState)(!1),[C,M]=(0,eC.useState)(),T=(0,eC.useRef)(null),I=(0,eC.useRef)(null),P=!1!==o.hasSku,A=(0,eC.useMemo)(()=>e1y(o.productDetail,s.skuValue.product_variant_id,o.editingLine),[o.productDetail,s.skuValue.product_variant_id,o.editingLine]),D=Ho(A),E=(0,eC.useRef)(a.customerId),[O,z]=(0,eC.useState)(!0),L=(0,eC.useMemo)(()=>(o.holderRelations||[]).filter(e=>{var t,l;return"form"!==e.holder_type||O&&D.enabled&&E.current===a.customerId&&((null==(t=e.metadata)?void 0:t.form_id)==null||String(e.metadata.form_id)===String(D.formId))&&((null==(l=e.metadata)?void 0:l.customer_id)==null||String(e.metadata.customer_id)===String(a.customerId))}),[o.holderRelations,O,D.enabled,D.formId,a.customerId]),R=JSON.stringify([a.customerId,D.formId]),[$,F]=(0,eC.useState)(()=>({key:R,ids:L.filter(e=>"form"===e.holder_type).map(e=>e.holder_id)})),[q,B]=(0,eC.useState)(()=>n.initialStage??(!P||o.lineUid&&D.enabled?"holder":"sku")),[H,V]=(0,eC.useState)(!!o.lineUid||"holder"===n.initialStage),U="holder"===q&&D.enabled,Y="sku"===q&&P,W=(0,eC.useRef)(!0),K=(0,eC.useRef)(!1),G=(0,eC.useRef)(0),Q=(0,eC.useRef)(a);Q.current=a;let Z=eXv((null==(t=(l=a.os).getTempOrder)?void 0:t.call(l))??a.order),J=(0,eC.useRef)({os:a.os,scopeKey:a.scopeKey,sessionId:a.session.sessionId,order:Z}),X=o3(()=>{var e,t,l;return W.current&&!1!==Q.current.props.isActive&&Q.current.os===J.current.os&&Q.current.scopeKey===J.current.scopeKey&&Q.current.session.sessionId===J.current.sessionId&&eXv((null==(e=(t=Q.current.os).getTempOrder)?void 0:e.call(t))??Q.current.order)===J.current.order&&(null==(l=Q.current.configurationModal)?void 0:l.extraSession)===o}),ee=eXy(a.os)&&D.enabled&&!eXb(a.context),et=eXy(a.os)&&String(E.current||"")!==String(a.customerId||""),el=a.busy||a.extras.busy||a.checkout.submitting||f||b||!!C,ei=a.disabled||!1===a.props.isActive,ea=(0,eC.useMemo)(()=>({token:{colorPrimary:u.brand.primaryColor,colorPrimaryBg:u.brandTokens["--primary-soft"]}}),[u.brand.primaryColor,u.brandTokens]);(0,eC.useEffect)(()=>(W.current=!0,()=>{W.current=!1,G.current+=1}),[]);let en=o3(async()=>{if(!X()||K.current||ei)return;K.current=!0,y(!0),N(!0),_(void 0);let e=String(eXb(Q.current.context)||"");try{await eXk({context:Q.current.context,products:[A],force:!0,openCustomerAuth:m,isCurrent:X})}catch(e){X()&&_(e3A(e,d("Unable to open holder details. Please try again.","无法打开持有人资料,请重试。")))}finally{let t=String(eXb(Q.current.context)||"");X()&&t&&t!==e&&M({customerId:t,configuration:Q.current.configurationModal.configuration,quantity:h}),K.current=!1,W.current&&y(!1)}});(0,eC.useEffect)(()=>{U&&ee&&D.required&&!j&&!el&&!ei&&en()},[U,ee,D.required,j,el,ei,en]),(0,eC.useEffect)(()=>{if(!C)return;if(!X())return void M(void 0);if(String(a.customerId||"")!==C.customerId||a.extrasCatalog.loading)return;if(a.extrasCatalog.error){M(void 0),_(d("Unable to reload this item. Close it and try again.","无法重新读取该商品,请关闭后重试。"));return}let e=!0;return K.current=!0,(o.lineUid?a.extras.prepareEdit(o.lineUid,C.quantity):a.extras.prepare(o.productDetail,C.quantity)).then(t=>{if(!(e&&X()))return;if("ready"!==t.status)throw Error("invalid"===t.status?t.issues.map(e=>e.message).join(" "):d("This item changed. Close it and try again.","该商品已变化,请关闭后重试。"));let l=iC(t.plan.productDetail,C.configuration.skuValue,{requiredOptionValidation:n.requiredOptionValidation,overSold:1===n.overSold});if(!l)throw Error(d("The item options changed. Close it and choose again.","商品规格已变化,请关闭后重新选择。"));Q.current.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?{...e,plan:t.plan,extraSession:t.session,configuration:{...C.configuration,skuValue:l},initialStage:"holder"}:e)}).catch(t=>{e&&X()&&_(e3A(t,d("Unable to reload this item. Close it and try again.","无法重新读取该商品,请关闭后重试。")))}).finally(()=>{K.current=!1,e&&W.current&&M(void 0)}),()=>{e=!1}},[C,a.customerId,a.extrasCatalog.loading,a.extrasCatalog.error,a.os,a.scopeKey,a.session.sessionId,Z,X]);let er=(0,eC.useCallback)(e=>{T.current=e,S(!!e)},[]),eo=e2W({enabled:!b&&!1!==a.props.isActive,openId:r.openId,scopeKey:o.contextKey,sessionId:a.session.sessionId,productDetail:g,skuValue:s.skuValue,quantity:h,overSold:1===n.overSold,timeZone:u.timeZone,customerId:a.customerId,os:a.extrasQueries}),es=eXp(g.title||g.name,c),ed=eXp(g.description,c),ec=Rv(g),eu=(g.variant||[]).find(e=>Number(e.id)===Number(s.skuValue.product_variant_id))||g,ep=[99999,Number((null==(i=g.item_rule_limit)?void 0:i.remainingMax)??99999)];1===Number(eu.is_track)&&1!==n.overSold&&ep.push(Number(eu.stock_quantity??0));let em=Math.max(0,Math.min(...ep.filter(Number.isFinite))),eg=e=>String(a.amount(e)),eh=iY(s.skuValue,"",e=>eXp(e,c),eg).reduce((e,t)=>e.concat(t.label,...(t.children||[]).map(e=>e.label)),[]).filter(Boolean).join(" \xb7 "),ev=()=>{el||K.current||(G.current+=1,a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?void 0:e))},ef=async()=>{if(el||ei||K.current||Y&&(!T.current||!w))return;K.current=!0;let e=G.current,t=()=>X()&&e===G.current,l=()=>t()&&!Q.current.disabled&&!1!==Q.current.props.isActive&&(!eXy(Q.current.os)||String(E.current||"")===String(Q.current.customerId||""));y(!0),_(void 0);try{var i,r;if(Y&&!1!==n.requiredOptionValidation)try{await T.current.validate()}catch{return}if(!l())return;let e=iC(g,(null==(i=T.current)?void 0:i.getTransformValues())??s.skuValue,{requiredOptionValidation:n.requiredOptionValidation,overSold:1===n.overSold});if(!e)throw Error(d("Complete the required selections to continue.","请完成必选内容后继续。"));let c={skuValue:e,variantDraft:Q.current.configurationModal.configuration.variantDraft};if(a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?{...e,configuration:c}:e),Y&&Ho(e1y(o.productDetail,e.product_variant_id,o.editingLine)).enabled){V(!0),B("holder");return}let u=U&&!ee?await (null==(r=I.current)?void 0:r.readRelations()):L;if(!u||!l())return;let p=await a.extras.commit(o,c,h,u);if(!t()||"cancelled"===p.status)return;x(!0),a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?void 0:e)}catch(e){t()&&_(e3A(e,d("Unable to add this item. Please try again.","暂时无法添加商品,请重试。")))}finally{K.current=!1,W.current&&y(!1)}},ey="phone"===a.variant?"mobile":"desktop",eb=F6.View;return(0,eH.jsx)(eT.ConfigProvider,{theme:ea,children:(0,eH.jsx)(nY.PisellThemeProvider,{theme:ea,children:(0,eH.jsx)(oU,{renderType:"mobile"===ey?"drawer":"modal",props:{...F6.getContainerProps(ey),open:!0,onCancel:ev,onClose:ev,closable:!1,destroyOnClose:!0,placement:"bottom",getContainer:u.portal||void 0,className:`${F6.containerClassName} venue-extra-detail-modal venue-booking-legacy-controls`},children:(0,eH.jsxs)(eb,{layout:ey,title:es,subtitle:eXp(g.subtitle,c),cover:g.cover,coverText:es.slice(0,2),unitPrice:ec&&(0,eH.jsxs)(eH.Fragment,{children:["from"===ec.qualifier&&d("From ",""),a.amount(ec.amount),"from"===ec.qualifier&&d(""," 起")]}),totalPrice:(0,eH.jsx)("span",{role:"status","aria-live":"polite",children:"ready"===eo.status?a.amount(eo.subtotal):"loading"===eo.status?d("Calculating…","正在计算…"):"—"}),selectionSummary:eh,description:ed?(0,eH.jsx)(e2T,{content:ed}):null,loading:!1,pending:el,confirmDisabled:ei||Y&&!w||h>em||et||U&&ee&&D.required,confirmLabel:Y&&D.enabled?d("Next: holder details","下一步:选择档案"):o.lineUid?d("Save changes","保存修改"):d("Add to cart","加入购物车"),closeLabel:d("Close","关闭"),backLabel:d("Back","返回"),onBack:U&&P&&!o.lineUid?()=>{el||(B("sku"),_(void 0))}:void 0,onClose:ev,onConfirm:()=>{ef()},noteControl:null,quantityControl:(0,eH.jsxs)(eH.Fragment,{children:[k&&(0,eH.jsx)("div",{role:"alert",className:"venue-extra-detail-error",children:k}),(0,eH.jsx)(z8,{variant:"capsule",size:"large",value:h,min:1,max:em,disabled:el||ei,theme:ea,onChange:e=>{K.current||el||ei||(G.current+=1,v(e),_(void 0))}})]}),children:[Y&&(0,eH.jsx)($$,{ref:er,type:F6.skuType,dataSource:g,value:s.skuValue,variantDraft:s.variantDraft,selectionKey:r.selectionKey,initializationPolicy:H?"preserve":"auto-required-defaults",disabled:ei||b,config:{overSold:n.overSold},theme:ea,priceFormatter:eg,customScrollParent:".venue-extra-detail-modal .sku-detail-appearance__scroller",presentation:{modal:{className:"pisell-flat-sku-selection-modal pisell-booking-product-detail-options-modal"}},onChange:(e,t)=>{if(K.current||el||ei)return;G.current+=1,_(void 0);let l=Ho(e1y(o.productDetail,e.product_variant_id,o.editingLine));(String(l.formId)!==String(D.formId)||l.enabled!==D.enabled)&&(z(!1),F({key:JSON.stringify([a.customerId,l.formId]),ids:[]})),a.setConfigurationModal(l=>(null==l?void 0:l.extraSession)===o?{...l,configuration:{skuValue:e,variantDraft:void 0===t?l.configuration.variantDraft:t.variantDraft}}:l)}}),U&&ee?(0,eH.jsx)("div",{className:"venue-extra-holder","aria-busy":f||!!C,children:f||C?(0,eH.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-label":d("Loading holder profiles","正在加载档案"),children:(0,eH.jsx)("div",{className:"holder-picker","aria-hidden":"true",children:(0,eH.jsx)("span",{className:"venue-holder-skeleton-field"})})}):(0,eH.jsx)("button",{type:"button",className:"button secondary",disabled:el||ei,onClick:()=>{en()},children:D.required?d("Choose holders","选择持有人"):d("Choose holders (optional)","选择持有人(选填)")})}):U&&(0,eH.jsx)(e8M,{ref:I,source:A,previous:L,quantity:h,customerId:a.customerId,os:a.os,ids:$.key===R?$.ids:[],onChange:e=>F({key:R,ids:e}),disabled:el||ei,text:d},R)]})})})})}function e8P(e){let{animated:t,artRef:l}=e;return(0,eH.jsx)("span",{ref:l,className:`benefits-banner-art${t?" benefits-banner-art--animated":""}`,"aria-hidden":"true",children:(0,eH.jsxs)("svg",{viewBox:"0 0 120 88",focusable:"false",children:[(0,eH.jsxs)("g",{className:"benefits-banner-sparkles",children:[(0,eH.jsx)("circle",{cx:"18",cy:"18",r:"4"}),(0,eH.jsx)("circle",{cx:"101",cy:"65",r:"3"}),(0,eH.jsx)("path",{d:"M91 11l2 5 5 2-5 2-2 5-2-5-5-2 5-2 2-5Z"})]}),(0,eH.jsxs)("g",{className:"benefits-banner-gift benefits-banner-gift--left",children:[(0,eH.jsx)("rect",{x:"13",y:"31",width:"35",height:"31",rx:"5"}),(0,eH.jsx)("path",{d:"M10 31h41v10H10zM30.5 31v31M19 22c8-1 11 9 11 9s-12 1-12-6c0-1 .3-2 1-3Zm23 0c-8-1-11 9-11 9s12 1 12-6c0-1-.3-2-1-3Z"})]}),(0,eH.jsxs)("g",{className:"benefits-banner-gift benefits-banner-gift--right",children:[(0,eH.jsx)("rect",{x:"80",y:"38",width:"27",height:"25",rx:"4"}),(0,eH.jsx)("path",{d:"M77 38h33v8H77zM93.5 38v25M85 31c6-1 8 7 8 7s-9 1-9-4c0-1 .3-2 1-3Zm17 0c-6-1-8 7-8 7s9 1 9-4c0-1-.3-2-1-3Z"})]}),(0,eH.jsxs)("g",{className:"benefits-banner-ticket",children:[(0,eH.jsx)("path",{d:"M43 20h42a6 6 0 0 1 6 6v8a7 7 0 0 0 0 14v8a6 6 0 0 1-6 6H43a6 6 0 0 1-6-6v-8a7 7 0 0 0 0-14v-8a6 6 0 0 1 6-6Z"}),(0,eH.jsx)("path",{d:"M54 49 74 30"}),(0,eH.jsx)("circle",{cx:"55",cy:"31",r:"3"}),(0,eH.jsx)("circle",{cx:"73",cy:"49",r:"3"})]})]})})}function e8A(e){let{status:t,needsAttention:l=!1,hidden:i=!1,disabled:a=!1,open:n,onOpenChange:r,onOpen:o,onClose:s,children:d,dialogProps:c,presentation:u="dialog"}=e,{lang:p,presentationPlatform:m}=eJ$(),g="kiosk"===m,[h,v]=(0,eC.useState)(!1),f=n??h,y=e=>{void 0===n&&v(e),null==r||r(e)},[b,x]=(0,eC.useState)(!1),k=(0,eC.useRef)(null),_=t??e0_(p,"benefitsTitle"),w=!b&&!a&&!l;(0,eC.useLayoutEffect)(()=>{let e=k.current;if(e)return eJ5(e,"--checkout-benefits-height",g)},[g]);let S=()=>{y(!1),null==s||s(),requestAnimationFrame(()=>{var e,t;return null==(t=k.current)||null==(e=t.querySelector("button"))?void 0:e.focus({preventScroll:!0})})},j=(0,eC.useRef)(S);j.current=S,(0,eC.useEffect)(()=>{if("floating"!==u||!f||i)return;let e=()=>Array.from(document.querySelectorAll((null==c?void 0:c.externalDialogSelector)??eX9)).some(e=>e.getClientRects().length>0),t=t=>{var l;(null==(l=k.current)?void 0:l.contains(t.target))||e()||(y(!1),null==s||s())},l=t=>{"Escape"!==t.key||t.defaultPrevented||e()||(t.preventDefault(),j.current())};return document.addEventListener("pointerdown",t),document.addEventListener("keydown",l),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",l)}},[u,f,i,r,s,null==c?void 0:c.externalDialogSelector]);let N=d??(0,eH.jsx)("p",{className:"benefits-empty",role:"status",children:"zh"===p?"当前没有可用优惠,您可以继续完成预订。":"There are no offers available for this booking. You can continue to checkout."});return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("div",{className:`checkout-benefits${"floating"===u?" checkout-benefits--floating":""}`,ref:k,hidden:i,children:[(0,eH.jsxs)(eXE,{secondary:!0,className:`checkout-benefits-trigger${l?" needs-attention":""}`,"data-attention":w?"true":void 0,disabled:a,"aria-haspopup":"dialog","aria-expanded":f&&!i,onClick:()=>{x(!0),f?S():(y(!0),null==o||o())},children:[(0,eH.jsx)(e8P,{animated:w}),(0,eH.jsx)("span",{className:"checkout-benefits-label","aria-live":"polite","aria-atomic":"true",children:_}),(0,eH.jsx)(e3V,{className:"checkout-benefits-arrow",size:18,"aria-hidden":"true"})]}),"floating"===u&&(0,eH.jsx)("section",{className:"checkout-benefits-popover",role:"dialog","aria-label":e0_(p,"benefitsTitle"),hidden:!f||i,children:N})]}),"dialog"===u&&(0,eH.jsx)(e0t,{...c,zIndex:(null==c?void 0:c.zIndex)??600,externalDialogSelector:(null==c?void 0:c.externalDialogSelector)??eX9,title:e0_(p,"benefitsTitle"),closeLabel:e0_(p,"close"),className:"checkout-benefits-dialog",open:f&&!i,onClose:S,footer:(0,eH.jsxs)("div",{className:"checkout-benefits-footer",children:[(0,eH.jsx)("p",{role:"status","aria-atomic":"true",children:_}),(0,eH.jsx)(eXE,{onClick:S,children:e0_(p,"benefitsDone")})]}),children:N})]})}let e8D=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm84,108a83.6,83.6,0,0,1-16.75,50.28L77.72,60.75A84,84,0,0,1,212,128ZM44,128A83.6,83.6,0,0,1,60.75,77.72L178.28,195.25A84,84,0,0,1,44,128Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.56,87.56,0,0,1-20.41,56.28L71.72,60.4A88,88,0,0,1,216,128ZM40,128A87.56,87.56,0,0,1,60.41,71.72L184.28,195.6A88,88,0,0,1,40,128Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M200,128a71.69,71.69,0,0,1-15.78,44.91L83.09,71.78A71.95,71.95,0,0,1,200,128ZM56,128a71.95,71.95,0,0,0,116.91,56.22L71.78,83.09A71.69,71.69,0,0,0,56,128Zm180,0A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-20,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm90,102a89.6,89.6,0,0,1-22.29,59.22L68.78,60.29A89.95,89.95,0,0,1,218,128ZM38,128A89.6,89.6,0,0,1,60.29,68.78L187.22,195.71A89.95,89.95,0,0,1,38,128Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.56,87.56,0,0,1-20.41,56.28L71.72,60.4A88,88,0,0,1,216,128ZM40,128A87.56,87.56,0,0,1,60.41,71.72L184.28,195.6A88,88,0,0,1,40,128Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm92,100a91.67,91.67,0,0,1-24.21,62.13L65.87,60.21A92,92,0,0,1,220,128ZM36,128A91.67,91.67,0,0,1,60.21,65.87L190.13,195.79A92,92,0,0,1,36,128Z"}))]]),e8E=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e8D}));function e8O(e){let{name:t,image:l,imageFallback:i,imagePosition:a,description:n,descriptionContent:r,lang:o,price:s,priceSuffix:d,metadata:c,details:u,badge:p,featured:m=!1,selection:g,actionLabel:h,disabled:v=!1,busy:f=!1,unavailable:y,disabledReason:b,onSelect:x}=e,k=dq("booking-presentation"),_=v||!!y,w=y?e0_(o,"unavailableProductAction"):h;return(0,eH.jsxs)("article",{className:`product-card ${m?"featured-product":""} ${g?"has-selection":""} ${_?"is-disabled":""} ${y?"is-unavailable":""}`,children:[g&&(0,eH.jsxs)("p",{id:`${k}-selection`,className:"product-selected-count","aria-live":"polite","aria-atomic":"true",children:[(0,eH.jsx)("span",{className:"sr-only",children:g.description??g.label}),(0,eH.jsx)("span",{className:"product-selected-label","aria-hidden":"true",children:g.label})]}),(l||i||p||y)&&(0,eH.jsxs)("div",{className:"product-image",children:[l&&(0,eH.jsx)("img",{src:l,alt:"",style:a?{objectPosition:a}:void 0}),!l&&i,p&&(0,eH.jsx)("span",{className:"product-badge",children:p}),y&&(0,eH.jsxs)("span",{id:`${k}-unavailable`,className:"product-unavailable-badge",children:["ended"===y.kind?(0,eH.jsx)(e3Q,{size:16,"aria-hidden":"true"}):(0,eH.jsx)(e8E,{size:16,"aria-hidden":"true"}),(0,eH.jsx)("span",{children:y.label})]})]}),(0,eH.jsxs)("div",{className:"product-copy",children:[(0,eH.jsx)("h3",{children:t}),c,(0,eH.jsx)(e2R,{name:t,description:n,content:r,lang:o}),u,!y&&v&&b&&(0,eH.jsx)("span",{id:`${k}-disabled`,className:"sr-only",children:b}),(0,eH.jsxs)("div",{className:"product-bottom",children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("strong",{children:s}),d&&(0,eH.jsx)("small",{children:d})]}),(0,eH.jsxs)(eXE,{className:"product-select","aria-label":`${w}: ${t}`,"aria-describedby":[g&&`${k}-selection`,y?`${k}-unavailable`:v&&b&&`${k}-disabled`].filter(Boolean).join(" ")||void 0,"aria-haspopup":"dialog",disabled:_,busy:f,onClick:x,children:[w,y?(0,eH.jsx)(e8E,{size:18,"aria-hidden":"true"}):(0,eH.jsx)(e3V,{size:18,"aria-hidden":"true"})]})]})]})]})}function e8z(e){let t="string"==typeof e?e.trim().toLowerCase():"";return"past"===t?"ended":"capacity_full"===t||"resource_capacity_exceeded"===t?"capacity":["booking_cutoff_after_start","booking_cutoff_before_start","booking_cutoff_advance"].includes(t)?"cutoff":["booking_cutoff_future_day","schedule_excluded_date","outside_operating_hours","outside_resource_window"].includes(t)?"not-open":t.includes("configuration")||["booking_cutoff_invalid","unsupported_resource_group","availability_unsupported"].includes(t)?"configuration":void 0}e8E.displayName="ProhibitIcon";let e8L=K5["sku-list-a5"],e8R={...e8L,skuListConfig:{...e8L.skuListConfig,listConfig:{...null==(el=e8L.skuListConfig)?void 0:el.listConfig,columns:2,showTab:!0,isTreeTab:!1,tabStyle:"switch",stickyTop:!1,columnGap:16,rowGap:24}}},e8$={...eYn,columns:2,layoutDirection:"column",nameColor:"var(--ink)",priceColor:"var(--ink)"},e8F={...e8L,skuListConfig:{...e8L.skuListConfig,listConfig:{...null==(ei=e8L.skuListConfig)?void 0:ei.listConfig,columns:1,isTreeTab:!1,stickyTop:!1,columnGap:16,rowGap:16},skuCardAllConfig:{...null==(ea=e8L.skuListConfig)?void 0:ea.skuCardAllConfig,skuCardConfig:{...null==(er=e8L.skuListConfig)||null==(en=er.skuCardAllConfig)?void 0:en.skuCardConfig,background:"var(--cream)",paddingX:16,paddingY:16}}}},e8q={...eYn,columns:1,layoutDirection:"row",showImage:!0,imageWidth:"96px",imageHeight:"96px",nameColor:"var(--ink)",priceColor:"var(--ink)"};function e8B(e){let{product:t,presentation:l,disabled:i,onSelect:a,settlementPriceRows:n,mode:r,locale:o,quantityByProductId:s,formatAmount:d,preparingProductId:c,availability:u,catalogLoading:p,catalogError:m,productLoadChannel:g}=e,h="party"===r,v=o.startsWith("zh"),f=function(e){let{product:t,availability:l,loading:i,error:a,channel:n,locale:r}=e;if(i||a)return;let o=String(r||"").startsWith("zh"),s=(e,t)=>o?t:e;if(RD(t,n))return{label:s("Sold out","已售罄"),kind:"unavailable"};let d=!!(l&&!l.available&&!l.requiresConfiguration);if(!RE(t)&&!d)return;let c=null==l?void 0:l.reasons,u=(d&&Array.isArray(c)?c:[]).map(e8z),p=u.length&&u[0]&&u.every(e=>e===u[0])?u[0]:void 0;return"ended"===p?{label:s("Session ended","时段已结束"),kind:"ended"}:"capacity"===p?{label:s("Not enough capacity","剩余容量不足"),kind:"unavailable"}:"cutoff"===p?{label:s("Booking closed","预订已截止"),kind:"unavailable"}:"not-open"===p?{label:s("Not offered on this date","当日未开放"),kind:"unavailable"}:"configuration"===p?{label:s("Booking setup incomplete","配置不完整"),kind:"unavailable"}:{label:s("Unavailable on this date","当前日期不可预约"),kind:"unavailable"}}({product:t,availability:u[String(t.id)],loading:p,error:m,channel:g,locale:o}),y=eXp(t.title??t.name,v?"zh":"en"),b=(null==l?void 0:l.description)??eXm(t.description,v?"zh":"en"),x=Rv(t),k="string"==typeof t.cover?t.cover:"",_=(null==l?void 0:l.actionLabel)??(h?v?"查看并选择":"View and customize":v?"选择门票":"Choose ticket"),w=Array.isArray(t._promotionTags)?t._promotionTags.map(e=>eXp(e.text,v?"zh":"en")).filter(Boolean):[],S=(null==n?void 0:n.length)?(0,eH.jsx)(Rx,{rows:n}):x&&d?(0,eH.jsxs)("span",{className:"pisell-price-text",children:["from"===x.qualifier&&!v&&(0,eH.jsx)("span",{className:"pisell-price-text-prefix-text",style:{fontSize:"0.65em",marginRight:4},children:"From"}),d(x.amount),"from"===x.qualifier&&v&&(0,eH.jsx)("span",{className:"pisell-price-text-suffix-text",style:{fontSize:"0.65em",marginLeft:4},children:"起"}),x.unit&&(0,eH.jsxs)("span",{children:["/",x.unit]})]}):x?(0,eH.jsx)(L6,{value:x.amount,isMini:"from"===x.qualifier,precision:x.precision,hideDecimalForWholeNumbers:!x.precision&&void 0,suffix:x.unit?(0,eH.jsxs)("span",{children:["/",x.unit]}):void 0}):null,j=Number((null==s?void 0:s[String(t.id)])||0),N=h?(null==l?void 0:l.selected)?{label:v?"已选":"Selected"}:void 0:j>0?{label:e0_(v?"zh":"en","selectedTicketCorner").replace("{count}",String(j)),description:e0_(v?"zh":"en","selectedTickets").replace("{count}",String(j))}:void 0;return(0,eH.jsx)(e8O,{name:y,image:k?o0(k,800):void 0,imageFallback:(0,eH.jsx)(nY.PisellImageCard,{className:"venue-catalog-text-cover",dataSource:{alt:y},width:"100%",height:"100%"}),description:"string"==typeof b?b:eXm(t.description,v?"zh":"en"),descriptionContent:(0,eH.jsx)(e2T,{content:eXp(t.description,v?"zh":"en")}),lang:v?"zh":"en",price:S,metadata:null==l?void 0:l.businessInfo,details:w.length?(0,eH.jsx)("span",{className:"venue-catalog-promotions",children:w.map((e,t)=>(0,eH.jsx)("span",{children:e},`${t}:${e}`))}):void 0,selection:N,actionLabel:"string"==typeof _?_:v?"选择商品":"Choose product",busy:c===String(t.id),disabled:i,unavailable:f,onSelect:a})}function e8H(e){return null==e?null:Array.isArray(e)?e.map(e8H):"object"==typeof e?Object.keys(e).sort().reduce((t,l)=>(t[l]=e8H(e[l]),t),{}):e}let e8V=e=>{if("string"!=typeof e&&"number"!=typeof e)return;let t=String(e).trim();return t&&"0"!==t?t:void 0},e8U=e=>{var t;return e8V((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??e.identity_key)};function e8Y(e){if(("string"==typeof e||"number"==typeof e)&&String(e).trim())try{let t=new lz(e);return t.isFinite()&&t.gte(0)?t:void 0}catch{return}}let e8W=new Set(["id","discount_id","order_discount_id","amount","_num","num"]),e8K=new Set(["fixed_amount","original_amount"]),e8G=new Set(["num","mainProductDiscountAmount","optionDiscountAmount","product_discount_difference","custom_product_bundle_map_id","unique_identification_number","product_uid","booking_uid"]);function e8Q(e,t){return Object.keys(e||{}).reduce((l,i)=>(t.has(i)||(l[i]=e[i]),l),{})}function e8Z(e,t){let l=[];for(let i of e){let e=e8Y(i[t]),a=e8Y(i.num);if(!e||!a||!a.gt(0))return;let n=lz.clone({precision:Math.max(20,e.precision()+a.precision())});l.push(new n(e).mul(a))}let i=Math.max(1,...l.map(e=>e.e+1)),a=Math.max(0,...l.map(e=>e.decimalPlaces())),n=lz.clone({precision:i+a+String(e.length).length+2});return l.reduce((e,t)=>e.plus(t),new n(0)).toString()}function e8J(e){if(("string"==typeof e||"number"==typeof e)&&""!==String(e).trim())try{let t=new lz(e);return t.isFinite()?t:void 0}catch{return}}let e8X=e=>{var t,l;return{os:e.os,scopeKey:e.scopeKey,sessionId:e.session.sessionId,identity:eXv((null==(t=(l=e.os).getTempOrder)?void 0:t.call(l))??e.order)}},e80=(e,t)=>e.os===t.os&&e.scopeKey===t.scopeKey&&e.sessionId===t.sessionId&&e.identity===t.identity,e82=e=>{var t,l,i;return String((null==(t=(null==(l=(i=e.os).getTempOrder)?void 0:l.call(i))??e.order)?void 0:t.customer_id)||"")};function e81(e){var t,l,i,a;return String((null==(t=e.os.otherParams)?void 0:t.platform)||(null==(a=e.engine)||null==(i=a.appHelper)||null==(l=i.constants)?void 0:l.platform)||"").trim().toLowerCase()}let e84=(e,t)=>eXy(e.os)||"promotion_code"===t&&"kiosk"===e81(e);function e83(e,t){let l=UD(),i=(0,nY.useToast)(),a=UM(),n=(0,eC.useMemo)(()=>eN7(a.customerAuth),[a.customerAuth]),r=(0,eC.useRef)(e);r.current=e;let o=(0,eC.useRef)(!0),s=(0,eC.useRef)(),[d,c]=(0,eC.useState)(!1),[u,p]=(0,eC.useState)(),m=e8X(e),g=e84(e,t),h=l.isLoggedIn(),v="promotion_code"===t?t:void 0,f=(g?!eXx(e.context,{reason:v}):h)&&!!u&&e80(u.owner,m)&&u.customer===e82(e);return(0,eC.useEffect)(()=>(o.current=!0,()=>{var e,t;o.current=!1,null==(t=s.current)||null==(e=t.cancelLogin)||e.call(t),s.current=void 0}),[]),(0,eC.useEffect)(()=>{if(s.current&&!e80(s.current.owner,m)){var e,t;null==(e=(t=s.current).cancelLogin)||e.call(t),s.current=void 0,c(!1)}},[m.os,m.scopeKey,m.sessionId,m.identity]),(0,eC.useEffect)(()=>{g||h||p(void 0)},[g,h]),{ready:f,pending:d,ensure:o3(()=>{let e=r.current,a=e8X(e);if(!o.current||!e.ready||!1===e.props.isActive)return Promise.resolve(!1);let d=e84(e,t);if((d?!eXx(e.context,{reason:v}):l.isLoggedIn())&&u&&e80(u.owner,a)&&u.customer===e82(e))return Promise.resolve(!0);if(s.current&&e80(s.current.owner,a))return s.current.promise;let m={owner:a};s.current=m;let g=()=>o.current&&s.current===m&&!1!==r.current.props.isActive&&("promotion_code"!==t||r.current.showOffers)&&e80(a,e8X(r.current));return m.promise=Promise.resolve().then(async()=>{try{if(!g())return!1;if(d){if(!await eXk({context:e.context,reason:v,openCustomerAuth:n,isCurrent:g})||!g())return!1;return r.current.cart.refreshCartSnapshot(),p({owner:a,customer:e82(r.current)}),!0}if(!l.isLoggedIn()&&(!await new Promise(t=>{if(m.cancelLogin=()=>t(!1),!l.openLoginModal({callback:e=>{m.cancelLogin=void 0,t("success"===e)}}))throw m.cancelLogin=void 0,Error(e.text("Login is unavailable. Please try again.","登录暂不可用,请重试。"))})||!g()||!l.isLoggedIn())||!g())return!1;if("function"!=typeof a.os.syncAuthenticatedOrderCustomer||await a.os.syncAuthenticatedOrderCustomer()!==!0)throw Error(e.text("Could not load your account details. Please try again.","无法读取账号信息,请重试。"));if(!g()||!l.isLoggedIn())return!1;return r.current.cart.refreshCartSnapshot(),p({owner:a,customer:e82(r.current)}),!0}catch(l){return g()&&("promotion_code"===t?i.fail(e3A(l,e.text("Could not verify your account. Please try again.","无法验证账号,请重试。"))):r.current.setError(e3A(l,e.text("Could not prepare checkout. Please try again.","无法进入确认页面,请重试。")))),!1}finally{s.current===m&&(s.current=void 0,o.current&&c(!1))}}),c(!0),m.promise})}}function e88(e){var t,l;let{runtime:i,visible:a=!0}=e,{context:n,sales:r,cart:o,variant:s}=i,d=e81(i),c=e83(i,"promotion_code"),u=(null==(l=r.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))||r.tempOrder||o.tempOrder,p=Number(null==u?void 0:u.customer_id);return(0,eH.jsx)(eDC,{customerId:Number.isFinite(p)?p:void 0,discountList:o.discountList,getDiscountList:r.getDiscountList,scanPromotionCode:o.scanCode,setDiscountSelected:o.setDiscount,patchDiscountCardHolderOnStore:r.patchDiscountCardHolderOnStore,variant:s,children:(0,eH.jsxs)("div",{hidden:!a,children:[(0,eH.jsx)(eDN,{}),(0,eH.jsx)(eEG,{context:n,variant:s,appearance:"light",enableWalletAssets:!0,enableManualPromotionCode:!0,beforePromotionCodeSearch:["pc","h5","kiosk"].includes(d)?c.ensure:void 0,enablePromotionBanner:!0,preserveWalletAssetsWhileRefreshing:!0,enableVoucherProductAdd:!1,promotionProductSource:"catalog-only"})]})})}function e86(e){var t,l,i,a,n,r,o;let{context:s,lines:d,locale:c}=e,u=U4(),p=String(c||"").startsWith("zh"),m=function(e,t,l){let i=new Map;for(let a of e){if(!a.config.enabled)continue;let e=l(a.cacheItem);for(let l=0;l<a.quantity;l+=1){let n=a.ids[l],r=null!=n&&""!==n,o=JSON.stringify([String(a.config.formId),r?String(n):"unselected"]),s=i.get(o);s?s.quantity+=1:i.set(o,{key:o,formId:a.config.formId,quantity:1,label:r?e8N(a,n,t,e)||String(n):void 0})}}return Array.from(i.values())}(d,(null==(i=s.sales.bookingTicket)||null==(l=i.getOrderCustomerSnapshot)||null==(t=l.call(i))?void 0:t.id)??(null==(r=s.sales.bookingTicket)||null==(n=r.getTempOrder)||null==(a=n.call(r))?void 0:a.customer_id)??(null==(o=s.sales.tempOrder)?void 0:o.customer_id),u.getHolderOptionsForSource);if(!m.length)return null;let g=e8s(void 0,c).name,h=new Map;for(let e of d){let t=String(e.config.formId);e.config.enabled&&!h.has(t)&&h.set(t,e8s(u.getHolderFormDetailForSource(e.cacheItem),c).name)}return(0,eH.jsx)("div",{className:"venue-cart-holders","aria-label":p?"持有人":"Holder",children:m.map(e=>{let t=h.get(String(e.formId))||g;return(0,eH.jsxs)("div",{className:e.label?void 0:"venue-cart-holder-unselected",children:[e.label?(0,eH.jsxs)(eH.Fragment,{children:[t,p?":":": ",e.label]}):p?`尚未选择${t}`:`${t} not selected`,e.quantity>1&&(0,eH.jsxs)(eH.Fragment,{children:[" \xd7 ",e.quantity]})]},e.key)})})}function e85(e){let{products:t,locale:l}=e,i=eMq(t);return i.length?(0,eH.jsx)("div",{className:"venue-order-promotions","aria-label":l.startsWith("zh")?"已生效活动":"Applied promotions",children:i.map(e=>(0,eH.jsx)("span",{children:e.detail||e.title},e.key))}):null}function e87(e,t,l,i){return(0,eC.useMemo)(()=>{if(!e.length)return e;let a=e=>e.map(e=>{let t=e._promotionTags||[];return{...e,_promotionTags:t.map(e=>({...e,text:eXp(e.text,i)})).filter(e=>e.text)}});if(null==t?void 0:t.appendPromotionTags)try{let i=t.appendPromotionTags(e);if(!l||i.some(e=>{var t;return null==(t=e._promotionTags)?void 0:t.length}))return a(i)}catch{}return a(exq(e,l))},[e,t,l,i])}function e89(e,t){var l;let{session:i,checkout:a,error:n,handoff:r,config:o,text:s}=e;if(!i.ready||i.error||i.pendingOrder)return;let d=t||n||a.error;return d?{kind:"error",tone:"error",message:d}:(null==(l=e.depositHydration)?void 0:l.error)?{kind:"deposit",tone:"error",message:e.depositHydration.error}:r?{kind:"submitted",tone:"success",message:s("Your order was submitted. Continue in the payment page or order details.","订单已提交,请在支付页或订单详情继续。")}:o.visualError?{kind:"design",tone:"warning",message:s("The design settings are invalid. The last valid appearance is still in use.","视觉配置无效,已保留上一份有效样式。")}:void 0}function e6e(e){let{feedback:t,text:l,onDismiss:i,onRetry:a,onRetryPayment:n}=e;return(0,eH.jsx)(e2s,{tone:t.tone,className:"venue-action-feedback",children:(0,eH.jsxs)("div",{className:"venue-action-feedback-message",children:[(0,eH.jsx)("span",{children:t.message}),"deposit"===t.kind&&a&&(0,eH.jsx)(eXE,{secondary:!0,onClick:a,children:l("Retry","重试")}),n&&(0,eH.jsx)(eXE,{secondary:!0,onClick:n,children:l("Continue payment","继续支付")}),"restored"===t.kind&&i&&(0,eH.jsx)(eXO,{className:"venue-action-feedback-dismiss","aria-label":l("Dismiss draft notice","关闭草稿恢复提示"),onClick:i,children:(0,eH.jsx)(eXJ,{size:16,"aria-hidden":"true"})})]})})}function e6t(e,t){var l;let[i,a]=(0,eC.useState)(),n=e89(e,t),r=n&&!e.linePicker&&("restored"!==n.kind||i!==e.scopeKey)?(0,eH.jsx)(e6e,{feedback:n,text:e.text,onRetry:null==(l=e.depositHydration)?void 0:l.retry,onRetryPayment:e.checkout.canRetryPayment?()=>{e.checkout.retryPayment()}:void 0,onDismiss:()=>a(e.scopeKey)}):void 0,o=e.orderPanel.isMobile&&!e.orderPanel.open;return{summary:o?void 0:r,footer:o?r:void 0}}function e6l(e){let{extras:t=!1}=e;return(0,eH.jsx)("div",{className:`list-group-items venue-catalog-skeleton-grid${t?" venue-catalog-skeleton-grid--extras":""}`,"aria-hidden":"true",children:[0,1].map(e=>t?(0,eH.jsxs)("div",{className:"pisell-plus-sales-product-card venue-catalog-skeleton-extra",children:[(0,eH.jsx)("div",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-extra-image"}),(0,eH.jsxs)("div",{className:"venue-catalog-skeleton-copy",children:[(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block"}),(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-short"})]}),(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-control"})]},e):(0,eH.jsx)("article",{className:"product-card venue-catalog-skeleton-card",children:(0,eH.jsxs)("div",{className:"product-copy",children:[(0,eH.jsx)("h3",{children:(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block"})}),(0,eH.jsxs)("div",{className:"product-description venue-catalog-skeleton-copy",children:[(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block"}),(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-short"})]}),(0,eH.jsxs)("div",{className:"product-bottom",children:[(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-price"}),(0,eH.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-action"})]})]})},e))})}function e6i(e){var t;let{runtime:l,showHero:i="select"===l.step}=e,{bookingUI:a,config:n}=l;return(0,eH.jsx)(eH.Fragment,{children:i&&(null==(t=n.brand)?void 0:t.hero)&&(0,eH.jsx)("section",{className:"hero booking-hero venue-booking-sales__hero","aria-label":a.brand.name,children:(0,eH.jsx)("img",{src:n.brand.hero,alt:""})})})}function e6a(e){let{runtime:t}=e,{session:l,order:i,text:a,openOrderHistory:n}=t,r=t.isKiosk&&(0,eH.jsx)(eXE,{secondary:!0,disabled:t.checkout.paymentActive||t.kioskLifecycle.resetting,onClick:()=>{t.kioskLifecycle.finish({navigateHome:!0})},children:a("Back to home","返回首页")});return t.isKiosk&&l.error?(0,eH.jsxs)(e2s,{tone:"error",children:[l.error,(0,eH.jsx)(eXE,{disabled:t.checkout.paymentActive||t.kioskLifecycle.resetting,onClick:()=>{l.restart().catch(e=>t.setError(e instanceof Error?e.message:String(e)))},children:a("Retry","重试")}),r]}):l.error?(0,eH.jsx)(e2s,{tone:"error",children:l.error}):l.ready?t.isKiosk&&l.pendingOrder?(0,eH.jsxs)(e2s,{children:[(0,eH.jsx)("p",{children:a("An order is already open. Return home to start another booking.","当前已有订单,可返回首页开始新的预订。")}),r]}):l.pendingOrder?(0,eH.jsxs)(e2s,{children:[(0,eH.jsx)("p",{children:a("You have an existing order. Continue from its order details.","已有订单,请从订单详情继续。")}),Number(null==i?void 0:i.order_id)>0&&(0,eH.jsx)("a",{className:"button secondary",href:`/order/details?id=${encodeURIComponent(i.order_id)}`,children:a("Open order","查看订单")}),(0,eH.jsx)(eXE,{secondary:!0,onClick:n,children:a("Check order history","核对订单记录")})]}):null:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("div",{className:"venue-booking-sales__loading",role:"status","aria-label":a("Loading your booking","正在加载预订"),children:(0,eH.jsx)(eT.Spin,{})}),r]})}function e6n(e){var t,l;let{runtime:i}=e,{configurationModal:a,setConfigurationModal:n,locale:r,busy:o,extras:s,checkout:d,setComposer:c,linePicker:u,setLinePicker:p,bookingUI:m,text:g,run:h,disabled:v,setExpandedSection:f}=i,y=eXN(),b="zh"===r?"zh":"en",x=u?e89(i):void 0,k=e2W({enabled:!!(null==a?void 0:a.partyDraft)&&!1!==i.props.isActive,openId:null==a?void 0:a.plan.openId,scopeKey:i.scopeKey,sessionId:i.session.sessionId,productDetail:null==a?void 0:a.plan.productDetail,skuValue:null==a?void 0:a.configuration.skuValue,quantity:null==a||null==(t=a.partyDraft)?void 0:t.quantity,overSold:(null==a?void 0:a.overSold)===1,priceBasis:"catalog",timeZone:m.timeZone,customerId:i.customerId,os:i.mainQueries}),_=(null==a?void 0:a.partyDraft)?{label:g("Estimated subtotal","预计小计"),amount:(0,eH.jsx)("span",{role:"status","aria-live":"polite",children:"ready"===k.status?i.amount(k.subtotal):"loading"===k.status?g("Calculating…","正在计算…"):g("Unavailable","暂无法报价")})}:void 0;return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)(eT.Modal,{getContainer:m.portal||void 0,open:!!d.failure,title:g("Booking could not be submitted","预订提交失败"),centered:!0,closable:!1,maskClosable:!1,keyboard:!1,destroyOnClose:!0,footer:(0,eH.jsx)(eXE,{busy:d.resettingFailure,onClick:()=>{d.confirmFailure()},children:g("Confirm","确认")}),children:[(0,eH.jsx)("p",{role:"alert",style:{whiteSpace:"pre-wrap"},children:null==(l=d.failure)?void 0:l.message}),d.resetError&&(0,eH.jsx)(e2s,{tone:"error",children:d.resetError})]}),(0,eH.jsx)(e8T,{runtime:i}),a&&!a.extraSession&&(0,eH.jsx)(e0j,{plan:a.plan,title:eXp(a.plan.productDetail.title||a.plan.productDetail.name,r),summary:a.partyDraft&&(0,eH.jsx)(e2$,{detail:a.plan.productDetail,configuration:a.configuration,locale:b,catalogStartingAmount:a.partyDraft.catalogStartingAmount,catalogPriceQualifier:a.partyDraft.catalogPriceQualifier,formatAmount:i.amount}),configuration:a.configuration,configurationFooter:_,onConfigurationChange:e=>n(t=>t&&{...t,configuration:e}),skuOptions:{config:{overSold:a.overSold}},requiredOptionValidation:a.requiredOptionValidation,locale:b,busy:o||s.busy||d.submitting,onCancel:()=>n(void 0),onConfigurationConfirm:async(e,t)=>!!t.isCurrent()&&(a.partyDraft&&(c({...a.partyDraft,configuration:e}),f("time"),i.notifyPartyProductConfirmed(),y("#party-time")),t.isCurrent()&&n(void 0),!0)},a.plan.openId),(0,eH.jsx)(eT.Modal,{getContainer:m.portal||void 0,open:!!u,title:g("Choose the configured item to change","选择需要调整的商品项"),footer:null,onCancel:()=>p(void 0),destroyOnClose:!0,children:(0,eH.jsxs)("div",{className:"venue-booking-legacy-controls",children:[(null==x?void 0:x.kind)==="error"&&(0,eH.jsx)(e6e,{feedback:x,text:g}),null==u?void 0:u.map(e=>{var t;return(0,eH.jsxs)("div",{className:"venue-booking-sales__line-picker",children:[(0,eH.jsxs)("span",{children:[eXp(e.product_title,r)||String(e.product_id)," ",(null==(t=e.product_sku)?void 0:t.name)||""]}),(0,eH.jsx)(eT.InputNumber,{min:0,precision:0,value:Number(e.num),disabled:v,onChange:t=>{null!=t&&h(async()=>{let l=await s.setLineQuantity(e1E(e),Number(t));p(void 0),await i.showExtraPreparation(l)})}})]},e1E(e))})]})})]})}function e6r(e){let{runtime:t,preview:l,showFilters:i}=e,{mode:a,text:n,disabled:r,main:o,mainPoolEmpty:s}=t;return s&&(!t.mainCatalog.menuListIds.length||l.catalogueReady||"unavailable"===l.status&&!l.searchRange)?(0,eH.jsx)(e2s,{children:"party"===a?n("No Party packages are available.","暂无可选 Party 商品。"):n("No tickets are available.","暂无可选门票。")}):l.catalogueReady?(0,eH.jsx)(e6o,{runtime:t,showFilters:i}):l.awaitingSelection?(0,eH.jsx)(e2s,{children:n("Choose a date to see available products.","请选择日期,再查看可用商品。")}):"error"!==l.status&&"unavailable"!==l.status?(0,eH.jsx)("div",{className:`venue-booking-catalog venue-booking-catalog--${a}`,role:"status","aria-busy":"true","aria-label":"party"===a?n("Loading Party packages","正在加载 Party 商品"):n("Loading tickets","正在加载门票"),children:(0,eH.jsx)(e6l,{})}):(0,eH.jsxs)(e2s,{tone:"error"===l.status?"error":void 0,children:["error"===l.status?n("Available dates could not be checked. Please retry.","可订日期查询失败,请重试。"):l.searchRange?n("No available date in the next month. You can browse other dates.","未来一个月内暂无可订日期,可手动查看其他日期。"):n("No available date in this view. Choose another date or week.","当前日期范围内暂无可订日期,请选择其他日期或翻周查看。"),"error"===l.status&&(0,eH.jsx)("button",{type:"button",className:"button secondary",disabled:r,onClick:o.retry,children:n("Retry","重试")})]})}function e6o(e){var t,l,i;let{runtime:a,showFilters:n=!0,formatAmount:r=a.amount}=e,{mode:o,locale:s,context:d,variant:c,scopeKey:u,date:p,main:m,props:g,productQuantities:h,disabled:v,text:f,partyMain:y,composer:b,run:x,openProduct:k}=a,_=(0,eC.useMemo)(()=>eXg(s),[u,s]),w=e87(m.products,a.sales.bookingTicket,null==(i=a.engine)||null==(l=i.appHelper)||null==(t=l.utils)?void 0:t.promotionEvaluator,s),S=(0,eC.useMemo)(()=>{var e;return e={mode:o,locale:s,quantityByProductId:h,formatAmount:r,preparingProductId:a.preparingProductId,availability:m.availability,catalogLoading:m.loading,catalogError:m.error,productLoadChannel:a.sales.productLoadChannel},t=>(0,eH.jsx)(e8B,{...t,...e},t.product.id)},[o,s,h,r,a.preparingProductId,m.availability,m.loading,m.error,a.sales.productLoadChannel]),j=(0,eC.useMemo)(()=>{var e;return n?e8R:{...e8R,skuListConfig:{...e8R.skuListConfig,listConfig:{...null==(e=e8R.skuListConfig)?void 0:e.listConfig,showTab:!1}}}},[n]);return(0,eH.jsx)(eYH,{context:d,mode:"retail",variant:c,businessCode:g.businessCode,className:`venue-booking-catalog venue-booking-catalog--${o}`,renderProductCard:S,catalog:{scopeKey:`${u}:${p}:main`,products:w,loading:m.loading,error:m.error,onRetry:m.retry,keepContentWhileLoading:!0,loadingContent:(0,eH.jsx)(e6l,{}),loadingLabel:(0,eH.jsx)("span",{className:"sr-only",children:f(m.products.length?"Updating availability…":"Loading available products…",m.products.length?"正在重新校验可用性…":"正在加载可预订商品…")})},quantityByProductId:h,isActive:g.isActive,productDisplayConfig:j,productListPreferences:e8$,productListPreferencesOverride:!0,categoryNavigation:n?"top":"tabbar",defaultCategorySelection:"all",allCategoryLabel:f("All","全部"),showSettings:!1,productCardVersion:"v2",productSelectionTrigger:"click",hideSingleCategoryNavigation:!0,onSelectProduct:e=>x(()=>k(e)),getProductPresentation:e=>{let t=m.availability[String(e.id)],l=(null==t?void 0:t.available)||(null==t?void 0:t.requiresConfiguration),i=e0E(e),a="party"===o&&Number((null==b?void 0:b.detail.id)??(null==y?void 0:y.line.product_id))===Number(e.id);return{disabled:v||m.loading||!!m.error||!l,description:_(e.description),businessInfo:"party"===o&&i.partySize||i.durationMinutes?(0,eH.jsxs)("div",{className:"party-meta venue-booking-sales__facts",children:["party"===o&&i.partySize&&(0,eH.jsxs)("span",{children:[(0,eH.jsx)(e2l,{size:15,"aria-hidden":"true"}),i.partySize," ",f("guests included","位参加者")]}),i.durationMinutes&&(0,eH.jsxs)("span",{children:[(0,eH.jsx)(e3Q,{size:15,"aria-hidden":"true"}),i.durationMinutes," ",f("minutes","分钟")]})]}):void 0,actionLabel:a?f("Edit package","编辑套餐"):void 0,selected:a}}})}function e6s(e){var t,l,i,a;let{runtime:n}=e,{context:r,variant:o,scopeKey:s,extrasCatalog:d,extras:c,props:u,disabled:p,run:m,showExtraPreparation:g}=n,h=(0,eC.useMemo)(()=>eXg(n.locale),[s,n.locale]),v=e87(d.products,n.sales.bookingTicket,null==(i=n.engine)||null==(l=i.appHelper)||null==(t=l.utils)?void 0:t.promotionEvaluator,n.locale),f=(0,nY.usePisellConfig)(),y=null==(a=n.order)?void 0:a.currency_symbol,b=(0,eC.useMemo)(()=>"string"==typeof y&&y.trim()?{...f,symbol:y}:f,[f,y]);return(0,eH.jsxs)(nY.PisellContext.Provider,{value:b,children:[(0,eH.jsx)("span",{className:"sr-only",role:"status","aria-live":"polite",children:n.extraQuantity.pending?n.text("Updating extras…","正在更新附加商品…"):""}),c.invalidItems.map(e=>(0,eH.jsx)(e2s,{tone:"warning",children:e.message},e.lineUid||e.code)),(0,eH.jsx)(eYH,{context:r,mode:"retail",variant:o,businessCode:u.businessCode,className:"venue-booking-catalog venue-booking-catalog--extras",productDisplayConfig:e8F,productListPreferences:e8q,productListPreferencesOverride:!0,catalog:{scopeKey:`${s}:extras`,products:v,loading:d.loading,error:d.error,onRetry:d.retry,keepContentWhileLoading:!0,loadingContent:(0,eH.jsx)(e6l,{extras:!0}),loadingLabel:(0,eH.jsx)("span",{className:"sr-only",children:n.text(d.products.length?"Updating extra prices…":"Loading extras…",d.products.length?"正在更新附加商品价格…":"正在加载附加商品…")})},quantityByProductId:{...c.quantityByProductId,...n.extraQuantity.quantities},showSettings:!1,categoryNavigation:"top",defaultCategorySelection:"all",allCategoryLabel:n.text("All","全部"),productCardVersion:"v2",productSelectionTrigger:"click",isActive:u.isActive,getProductPresentation:e=>{let t=RW(e),l=!e1p(e)||(t?n.extraQuantityDisabled:p),i=eXp(e.subtitle,n.locale).trim(),a={disabled:l,description:i?(0,eH.jsx)("div",{className:"venue-extra-subtitle",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerUp:e=>e.stopPropagation(),children:(0,eH.jsx)(e2R,{name:eXp(e.title,n.locale)||eXp(e.name,n.locale),description:h(i),lang:n.locale,content:(0,eH.jsx)(e2T,{content:i})})}):void 0};if(n.pendingExtraProductId===String(e.id))return{...a,renderAction:()=>(0,eH.jsx)("span",{className:"venue-extra-action-pending",role:"status","aria-label":n.text("Updating item","正在更新商品"),children:(0,eH.jsx)(eT.Spin,{size:"small"})})};let r=Hs(e)?n.text("Choose options","选择选项"):"phone"===o||t?void 0:n.text("Options","选规格");return r?{...a,renderAction:e=>{let{quantity:t,disabled:l,onSelect:i}=e;return(0,eH.jsx)(RK,{label:r,quantity:t,disabled:l,onSelect:i})}}:a},onSelectProduct:e=>m(async()=>g(await c.prepare(e)),e.id),onQuantityChange:(e,t,l)=>{RW(e)&&!Hs(e)?n.extraQuantity.changeQuantity(e,t,l.previousQuantity):m(async()=>g(await c.setProductQuantity(e,t)),e.id)}})]})}function e6d(e,t,l){return function(e){let{line:t,quantity:l,formatAmount:i}=e,a=function(e,t){let l=e8J(t),i=e8J(e.selling_price);if(!l||!l.gt(0)||!i)return;let a=e8J(e.original_price),n=lz.clone({precision:Math.max(20,i.precision()+l.precision(),((null==a?void 0:a.precision())||0)+l.precision())}),r=new n(i).mul(l),o=a&&new n(a).mul(l);return{total:r.toString(),...(null==o?void 0:o.gt(0))&&o.gt(r)?{originalTotal:o.toString()}:{}}}(t,l);if(a)return(0,eH.jsxs)("span",{className:"venue-order-line-price",children:[void 0!==a.originalTotal&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("del",{className:"venue-order-line-price-original",children:i(a.originalTotal)})," "]}),(0,eH.jsx)("span",{className:"venue-order-line-price-current",children:i(a.total)})]})}({line:t,quantity:l,formatAmount:e.amount})}function e6c(e){let{text:t}=e;return(0,eH.jsx)("h3",{className:"venue-cart-addons-title",children:t("Addons","附加商品")})}function e6u(e){let{date:t,locale:l}=e;return l.startsWith("zh")?(0,eH.jsxs)("time",{dateTime:t,children:[e0y(t,l,{year:"numeric",month:"long",day:"numeric"})," ",(0,eH.jsx)("span",{className:"venue-review-weekday",children:e0y(t,l,{weekday:"short"})})]}):(0,eH.jsx)("time",{dateTime:t,children:e0y(t,l)})}function e6p(e){var t,l,i,a;let{runtime:n,onlyExtras:r=!1,includeExtras:o=!0,includeGifts:s=!0,onEditExtras:d,review:c=!1,renderBookingDetails:u}=e,{bindings:p,extras:m,hasBookings:g,mode:h,text:v,locale:f,disabled:y,composer:b,orderPanel:x,editLine:k,removeLines:_,run:w}=n,[S,j]=(0,eC.useState)(),N=(i=p.bindings,a=n.holderState,e39(i,e=>{var t,l;let i=e37(e.line,e.booking);if(null===i)return null;let n=a.displayLines.find(t=>t.uid===e.productLineUid);if(!n||n.config.enabled&&(n.missing||n.ids.length<e.quantity))return null;let r=e.line;return JSON.stringify([i,n.config.enabled,n.config.required,String(n.config.formId??""),n.ids.map(String),r.original_price,r.selling_price,r.discount_list,r.note,r.remark,null==(t=r.metadata)?void 0:t._promotion,null==(l=r.metadata)?void 0:l.manual_discount])})),C=(0,eC.useMemo)(()=>new Map(n.extrasCatalog.products.map(e=>[Number(e.id),e])),[n.extrasCatalog.products]),M=e=>Hs(e1y(C.get(Number(e.product_id)),e.product_variant_id,e)),T=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Hs,a=new Set,n=new Set;return e.forEach(e=>{let t=e8U(e);t&&a.has(t)&&n.add(t),t&&a.add(t)}),e39(e,e=>i(e)||UO(e,l).length?null:function(e,t,l){var i,a,n;let r=e8U(e),o=e.metadata||{},s=o.venue_booking_role,d=Number(e.num),c=e8Y(e.original_price),u=e8Y(e.selling_price);if(!r||l.has(r)||!e8V(e.product_id)||!e8V(o.venue_booking_scope_key)||!["tickets_extra","party_extra"].includes(s)||"party_extra"===s&&!e8V(o.venue_booking_parent_uid)||!Number.isSafeInteger(d)||d<=0||!c||!u||(null==(i=e._extend)?void 0:i.independentLine)===!0||(null==(n=o.origin)||null==(a=n._extend)?void 0:a.independentLine)===!0||null!=e.discount_list&&!Array.isArray(e.discount_list))return null;let p=(e.discount_list||[]).map(e=>(function(e,t){var l,i,a;if(!e||"object"!=typeof e||Array.isArray(e))return null;let n=String(e.type??e.tag??""),r="product_discount_card"===n?"discount_card":n,o=e8V((null==(l=e.discount)?void 0:l.resource_id)??e.resource_id),s=e8V((null==(i=e.discount)?void 0:i.strategy_id)??e.strategy_id??(null==(a=e.metadata)?void 0:a.strategyId))??("promotion"===r?e8V(null==t?void 0:t.strategyId):void 0);return r&&("discount_card"!==r||o)&&(o||s)?{...e8Q(e,e8W),type:r,resource:o,strategy:s,discount:e8Q(e.discount,e8K),metadata:e8Q(e.metadata,e8G)}:null})(e,o._promotion));if(p.some(e=>null===e))return null;let m=function(e,t){let l=[];for(let i of t){let t=null==i?void 0:i.note_relations;if(!Array.isArray(t))return null;let a=t.filter(t=>(null==t?void 0:t.target_type)==="order_detail"&&String(t.target_uuid)===e);if(a.length){if(!i.note_type||!i.content||a.some(e=>"about"!==e.relation_type&&"related_to"!==e.relation_type))return null;l.push({note_type:i.note_type,content:i.content,importance:i.importance})}}return l.sort((e,t)=>JSON.stringify(e8H(e)).localeCompare(JSON.stringify(e8H(t))))}(r,t);return null===m?null:JSON.stringify(e8H({product:String(e.product_id),variant:String(e.product_variant_id??0),sku:{...e.product_sku,option:ex4(e)},bundle:e.product_bundle||[],role:s,scope:o.venue_booking_scope_key,parent:o.venue_booking_parent_uid,original:c.toString(),selling:u.toString(),discounts:p,note:e.note,remark:e.remark,notes:m,inlineNotes:e.notes,salesNotes:e.sales_notes,allergy:e.allergy,allergies:e.allergies,metadataNotes:o.notes,metadataAllergy:o.allergy,metadataAllergies:o.allergies,promotion:o._promotion,promotionTags:o._promotionTags??e._promotionTags,gift:o._giftInfo??e._giftInfo,giftData:e.giftData,manualDiscount:o.manual_discount,isManualDiscount:o.is_manual_discount,priceOverride:o.price_override,sourcePrice:o.source_product_price,mainOriginal:o.main_product_original_price,mainSelling:o.main_product_selling_price}))}(e,t,n)).map(e=>{let t=e8Z(e.members,"original_price");return{...e,quantity:e.members.reduce((e,t)=>e+(Number.isFinite(Number(t.num))?Number(t.num):0),0),price:{selling_price:e8Z(e.members,"selling_price")??"",...void 0===t?{}:{original_price:t}}}})}(m.rows,null==(t=n.order)?void 0:t.notes,null==(l=n.order)?void 0:l.holder_relations,M),I=e=>e.length>0&&(0,eH.jsx)("ul",{className:"venue-order-bundle","aria-label":v("Included items","套餐内含商品"),children:e.map(e=>(0,eH.jsxs)("li",{children:[(0,eH.jsx)("span",{children:e.name||v("Included item","套餐子商品")}),(0,eH.jsxs)("span",{children:["\xd7 ",e.quantity]})]},e.key))}),P=(e,t)=>{"remove"===t?_(e.map(e=>e.productLineUid)):e.length>1?x.closeThen(()=>j({uids:e.map(e=>e.productLineUid)})):x.closeThen(()=>{k(e[0].productLineUid)})};return(0,eH.jsxs)(eH.Fragment,{children:[!r&&!g&&(0,eH.jsxs)("div",{className:"catalog-empty",children:[(0,eH.jsx)(eXj,{size:36,"aria-hidden":"true"}),(0,eH.jsx)("p",{children:v("tickets"===h?"Pick a ticket to start your family’s adventure.":"Choose a Party to begin.","tickets"===h?"选择门票,开启全家的欢乐时光。":"选择商品开始预订 Party。")})]}),(0,eH.jsxs)("div",{className:"selected-order-list",children:[!r&&N.map(e=>{var t,l,i;let a=e.members[0],r=e.members.reduce((e,t)=>e+t.quantity,0),o=eXp(a.line.product_title,f)||String(a.line.product_id),s=(a.booking.resources||[]).map(e=>{var t;return eXp((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,f)}).filter(Boolean).join(" \xb7 "),d=null==(t=n.holderState.displayLines.find(e=>e.uid===a.productLineUid))?void 0:t.cacheItem,p=n.main.products.find(e=>String(e.id)===String(a.line.product_id)),m=e8e(a.line,r,f,p,d),g=!!(null==(l=a.line.product_bundle)?void 0:l.length)||1===Number((null==p?void 0:p.is_bundle)??(null==d?void 0:d.is_bundle)),x=[a.line.product_cover,null==d?void 0:d.cover,null==d||null==(i=d._extend)?void 0:i.product_cover,null==p?void 0:p.cover].map(e=>eXp(e,f)).find(Boolean),k=I(m);return(0,eH.jsxs)(e32,{title:o,amount:e6d(n,a.line,r),image:c&&x||void 0,details:(0,eH.jsxs)("div",{className:c?"booking-item-metadata":void 0,children:[c?(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)(e0r,{size:16,"aria-hidden":"true"}),(0,eH.jsx)(e6u,{date:a.date,locale:f})]}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)(e3Q,{size:16,"aria-hidden":"true"}),a.booking.start_time,"–",a.booking.end_time]})]}):(0,eH.jsxs)("div",{children:[a.date," \xb7 ",a.booking.start_time,"–",a.booking.end_time]}),s&&(0,eH.jsx)("div",{children:s}),!g&&(0,eH.jsx)("div",{children:"tickets"===h?`${r} ${v(1===r?"ticket":"tickets","张票")}`:`\xd7 ${r}`}),!c&&(0,eH.jsx)(e86,{context:n.context,locale:f,lines:n.holderState.displayLines.filter(t=>e.members.some(e=>e.productLineUid===t.uid))})]}),action:{label:`${v("Edit","修改")} ${o}`,disabled:y||!!b,onClick:()=>P(e.members,"edit")},removeAction:{label:`${v("Remove","移除")} ${o}`,disabled:y,onClick:()=>P(e.members,"remove")},children:[(0,eH.jsx)(e85,{products:e.members.map(e=>e.line),locale:f}),u?(0,eH.jsxs)(eH.Fragment,{children:[k,e.members.map((t,l)=>(0,eH.jsx)(eM().Fragment,{children:u(t.productLineUid,e.members.slice(0,l).reduce((e,t)=>e+t.quantity,0))},t.productLineUid))]}):k]},e.key)}),"tickets"===h&&!c&&o&&T.length>0&&(0,eH.jsx)(e6c,{text:v}),o&&T.map(e=>{var t,l,i,a,r;let o=e.members[0],s=eXp(o.product_title,f)||String(o.product_id),c=o._origin??(null==(a=n.order)||null==(i=a._extend)||null==(l=i.productsByUid)||null==(t=l[e1E(o)])?void 0:t.origin),u=e8e(o,e.quantity,f,C.get(Number(o.product_id)),c),p=UO(o,null==(r=n.order)?void 0:r.holder_relations).filter(e=>"form"===e.holder_type),g=M(o)||p.length>0;return(0,eH.jsxs)(e32,{layout:"row",title:s,amount:e6d(n,e.price,1),details:(0,eH.jsxs)(eH.Fragment,{children:["\xd7 ",e.quantity,p.length>0&&(0,eH.jsxs)("div",{children:[v("Holder: ","Holder:"),p.map(e=>{var t;return(null==(t=e.metadata)?void 0:t.name)||e.holder_id}).join(", ")]})]}),action:d?{label:`${v("Edit extra","编辑附加商品")} ${s}`,disabled:y||!!b,onClick:()=>x.closeThen(()=>{g&&1===e.members.length?w(async()=>{await n.showExtraPreparation(await m.prepareEdit(e1E(o)))}):d()})}:void 0,removeAction:{label:`${v("Remove extra","移除附加商品")} ${s}`,disabled:y,onClick:()=>{w(async()=>m.removeLines(e.members.map(e1E)),o.product_id??void 0)}},children:[(0,eH.jsx)(e85,{products:e.members,locale:f}),I(u)]},e.key)}),s&&p.gifts.map(e=>(0,eH.jsx)(e32,{layout:"row",title:eXp(e.product_title,f)||String(e.product_id),details:(0,eH.jsxs)(eH.Fragment,{children:[v("Promotion gift","优惠赠品")," \xd7 ",e.num]}),children:(0,eH.jsx)(e85,{products:[e],locale:f})},e1E(e)))]}),(0,eH.jsx)(eT.Modal,{getContainer:n.bookingUI.portal||void 0,open:!!S,footer:null,title:v("Choose the booking to change","选择需要调整的预订"),onCancel:()=>j(void 0),destroyOnClose:!0,children:(0,eH.jsx)("div",{className:"venue-booking-group-actions",children:p.bindings.filter(e=>null==S?void 0:S.uids.includes(e.productLineUid)).map((e,t)=>(0,eH.jsxs)(eXE,{secondary:!0,disabled:y||!!b,onClick:()=>{j(void 0),k(e.productLineUid)},children:[v("Booking","预订")," ",t+1," \xb7 ",e.quantity," ",v("ticket(s)","张票")]},e.productLineUid))})})]})}function e6m(e){let{runtime:t,includeTotal:l=!0,includeDueNow:i=!0,splitPartySubtotal:a=!1}=e,{hasBookings:n,mode:r,text:o,amount:s,amountDue:d,summary:c,order:u,hasDeposit:p,depositAmount:m}=t,g=a&&"party"===r&&n?function(e){var t,l;let{bindings:i,scopeKey:a,summary:n}=e;if(i.issues.length||1!==i.bindings.length)return null;let r=i.bindings[0].line,o=e1E(r);if(!o||(null==(t=r.metadata)?void 0:t.venue_booking_role)!=="party_main"||r.metadata.venue_booking_scope_key!==a)return null;let s=new Set([o]),d=e=>{if("string"!=typeof e&&"number"!=typeof e||""===String(e).trim())return null;try{let t=new lz(e);return t.isFinite()&&!t.isNegative()?t:null}catch{return null}},c=e=>{let t=d(e.selling_price),l=Number(e.num);return t&&Number.isSafeInteger(l)&&l>0?t.mul(l):null},u=c(r),p=d(null==n?void 0:n.product_expect_amount);if(!u||!p)return null;let m=new lz(0);for(let e of i.extras){let t=e1E(e);if(!t||s.has(t)||(null==(l=e.metadata)?void 0:l.venue_booking_role)!=="party_extra"||e.metadata.venue_booking_scope_key!==a||String(e.metadata.venue_booking_parent_uid||"")!==o)return null;let i=c(e);if(!i)return null;s.add(t),m=m.plus(i)}let g=u.toDecimalPlaces(2,lz.ROUND_HALF_UP),h=m.toDecimalPlaces(2,lz.ROUND_HALF_UP);return u.plus(m).toDecimalPlaces(2,lz.ROUND_HALF_UP).eq(p)&&g.plus(h).eq(p)?{main:g.toFixed(2),extras:h.toFixed(2)}:null}(t):null,h=g?[{id:"party-subtotal",label:o("Party subtotal","Party 商品小计"),amount:s(g.main)},{id:"extras-subtotal",label:o("Extras","附加商品"),amount:s(g.extras)}]:[{id:"subtotal",label:o("Subtotal","商品小计"),amount:s(n?null==c?void 0:c.product_expect_amount:0)}],v=Number(null==c?void 0:c.discount_amount);if(n&&Number.isFinite(v)&&0!==v&&h.push({id:"discount",label:o("Discount","优惠"),amount:s(new lz(c.discount_amount).abs().negated().toString()),tone:"discount"}),Number(null==c?void 0:c.surcharge_fee)>0&&h.push({id:"surcharge",label:o("Surcharge","附加费"),amount:s(null==c?void 0:c.surcharge_fee)}),Number(null==c?void 0:c.tax_fee)>0){var f,y;let e=c.tax_title||(null==u?void 0:u.tax_title)||o("Tax","税费"),t=(f=null==u?void 0:u.products,y=c.is_price_include_tax??c.isPriceIncludeTax??(null==u?void 0:u.is_price_include_tax),!!(null==f?void 0:f.length)&&(null==y||1===Number(y))&&f.every(e=>{let t=e.is_price_include_tax??y;return 1===Number(t)&&(e.product_bundle??[]).every(e=>1===Number(e.is_price_include_tax??t))}));h.push({id:"tax",label:t?o(`${e} (Included)`,`${e}(已含税)`):e,amount:s(c.tax_fee)})}return l&&h.push({id:"total",label:o("Total","合计"),amount:s(n?null==c?void 0:c.expect_amount:0),tone:"total"}),n&&p&&h.push({id:"deposit",label:o("Deposit","定金"),amount:s(m)}),i&&n&&h.push({id:"due-now",label:o("Due now","本次待付"),amount:s(d)}),(0,eH.jsx)(e34,{rows:h})}function e6g(e){let{runtime:t}=e,{step:l,ready:i,session:a,showOffers:n,setShowOffers:r,hasBookings:o,text:s,disabled:d,orderPanel:c}=t,u=i&&!a.error&&("select"===l||o&&("extras"===l||"review"===l)),p=n&&u;return(0,eH.jsx)(e8A,{status:s("Offers and discount cards","优惠与折扣卡"),hidden:!u,open:p,disabled:d,presentation:"floating",onOpenChange:e=>{e?c.closeThen(()=>r(!0)):r(!1)},children:(0,eH.jsx)("fieldset",{disabled:d,"aria-disabled":d,className:`venue-booking-legacy-controls venue-booking-sales__offers ${d?"venue-booking-sales__offers--disabled":""}`,children:(0,eH.jsx)(e88,{runtime:t,visible:p})})})}function e6h(e){let{runtime:t,onBack:l,disabled:i=!1}=e,[a,n]=(0,eC.useState)(!1),[r,o]=(0,eC.useState)(!1),s=(0,eC.useRef)(!1),d=(0,eC.useRef)(!0);(0,eC.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let c=!!l;(0,eC.useEffect)(()=>{c&&n(!1)},[c]);let u=(0,eC.useRef)(t);u.current=t;let p=async()=>{if(s.current||t.disabled||i)return;let e=t.session.sessionId;s.current=!0,o(!0);try{var l,a,r;if(t.isKiosk)return void await t.kioskLifecycle.finish({navigateHome:!0});if(await t.sales.clearCartAndReset(),t.session.discard(),!d.current||!t.alive.current||u.current.session.sessionId!==e)return;let i=null==(r=t.engine)||null==(a=r.appHelper)||null==(l=a.utils)?void 0:l.history;"function"==typeof(null==i?void 0:i.replace)?i.replace("/"):window.location.replace(window.location.origin)}catch(l){d.current&&t.alive.current&&u.current.session.sessionId===e&&t.setError(l instanceof Error?l.message:String(l))}finally{s.current=!1,d.current&&t.alive.current&&(o(!1),n(!1))}},m=c?t.text("Previous step","上一步"):t.text("Close booking","关闭预订");return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("button",{type:"button",className:"venue-booking-exit icon-button","aria-label":m,title:m,disabled:i||t.disabled||r,onClick:()=>{l?l():n(!0)},children:c?(0,eH.jsx)(eXP,{size:22,"aria-hidden":"true"}):(0,eH.jsx)(eXJ,{size:22,"aria-hidden":"true"})}),a&&!c&&(0,eH.jsx)(e0t,{title:t.text("Leave this booking?","退出本次预订?"),closeLabel:t.text("Close","关闭"),onClose:()=>n(!1),closeDisabled:r,closeOnBackdrop:!1,bodyClassName:"venue-booking-exit-body",footerClassName:"venue-booking-exit-actions",footer:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("button",{type:"button",className:"button secondary",disabled:r,onClick:()=>n(!1),children:t.text("Keep booking","继续预订")}),(0,eH.jsx)("button",{type:"button",className:"button",disabled:i||r||t.disabled,onClick:()=>{p()},children:t.text("Leave booking","退出预订")})]}),children:(0,eH.jsx)("p",{children:t.text("Your selections will be cleared and you will return to the store home page.","当前选择将被清除,并返回商家首页。")})})]})}function e6v(e){let{runtime:t}=e,l=t.checkout.kioskPaymentPage,i=(0,eH.jsx)("div",{className:"venue-booking-sales__loading",role:"status","aria-label":t.text("Loading checkout","正在加载确认页面"),children:(0,eH.jsx)(eT.Spin,{})});return(0,eH.jsx)("div",{className:"venue-booking-payment-step venue-booking-legacy-controls",children:l?(0,eH.jsx)(eW1,{context:t.context,checkoutPreparation:l.preparation,paymentPolicy:l.paymentPolicy,channel:"kiosk",active:!1!==t.props.isActive,loadingFallback:i,onBack:l.onBack,onPaid:l.onPaid,onDisposed:l.onDisposed},l.id):i})}let e6f={};function e6y(e){var t,l;let i=e83(e,"review"),a=eXN(),n=(0,eC.useRef)(null),r=(0,eC.useRef)(e);r.current=e;let o=(0,eC.useRef)(!0),s=(0,eC.useRef)(0),d={scopeKey:e.scopeKey,mode:e.mode,date:e.date,customerId:e.customerId,sessionId:e.session.sessionId,os:e.os,order:eXv(e.order)},c=(0,eC.useRef)(d);Object.keys(d).some(e=>d[e]!==c.current[e])&&(c.current=d);let u=c.current,[p,m]=(0,eC.useState)({owner:u,values:e6f}),g=p.owner===u?p.values:e6f;(0,eC.useEffect)(()=>{m(e=>e.owner===u?e:{owner:u,values:e6f})},[u]);let h=(e,t)=>e.scopeKey===t.scopeKey&&e.mode===t.mode&&e.date===t.date&&e.sessionId===t.sessionId&&e.os===t.os&&e.order===t.order;(0,eC.useEffect)(()=>(o.current=!0,()=>{o.current=!1,s.current+=1}),[]);let v=[{id:"select",label:e.text("tickets"===e.mode?"Tickets":"Party","tickets"===e.mode?"门票":"派对")},...e.holderState.required||"holder"===e.step?[{id:"holder",label:e.text("Holder","持有人")}]:[],...e.hasExtras?[{id:"extras",label:e.text("Addons","附加商品")}]:[],{id:"review",label:e.text("Review","确认")},...e.isKiosk||e.checkout.kioskPaymentPage?[{id:"payment",label:e.text("Payment","支付")}]:[]],f=Math.max(0,v.findIndex(t=>t.id===e.step)),y=null==(t=v[f-1])?void 0:t.id,b=async function(t){let l=arguments.length>1&&void 0!==arguments[1]&&arguments[1],d=r.current;if("payment"===t||"payment"===d.step||d.checkout.isPaymentActive()||("extras"!==t||d.hasExtras||(t="review"),"review"===t&&d.hasExtras&&(d.extrasCatalog.loading||d.extrasCatalog.error)&&(t="extras"),!o.current||i.pending||u!==c.current||d.step!==e.step||d.isExtraQuantityPending()))return;let p=v.findIndex(e=>e.id===t),m=p>=0&&p<f,g=++s.current,y=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=r.current;return o.current&&g===s.current&&(e?h(u,c.current):u===c.current)&&!1!==l.props.isActive&&l.step===d.step&&!l.disabled&&!l.isExtraQuantityPending()&&!l.composer&&!l.configurationModal&&("select"===t||m||l.hasBookings&&l.mainDateMatches&&(e?!l.mainPoolEmpty&&!l.main.error:!l.mainCatalogBlocked))};if(!y())return;if(!m&&("extras"===t||"review"===t)){if("holder"===d.step){var b;let e=await (null==(b=n.current)?void 0:b.validate());if(!y()||!e)return}let e=r.current;if(!e1H(e.context,e.scopeKey).complete){e.setError(e.text("Complete the required holder details first.","请先完成必填持票人资料。")),e.setStep("holder"),a('[data-booking-stage="holder"]');return}if("review"===t&&!e.checkExtraHolders())return}if(!y()||"holder"===t&&d.isKiosk&&(!await i.ensure()||!y(!0)))return;if("review"===t){if(!await i.ensure()||!y(!0))return;let e=r.current;if(!e1H(e.context,e.scopeKey).complete){e.setStep("holder"),a('[data-booking-stage="holder"]');return}}let x=r.current;"select"===t&&l&&x.setExpandedSection("product"),x.setError(void 0),x.setStep(t),x.orderPanel.close(),a(`[data-booking-stage="${t}"]`)},x=()=>{!y||e.disabled||i.pending||b(y)},k="review"===e.step||e.isKiosk&&"holder"===e.step;(0,eC.useEffect)(()=>{if(!k||!e.ready||i.ready)return;let t=!0,l=e.step;return i.ensure().then(e=>{let i=r.current;!e&&t&&o.current&&i.step===l&&h(u,c.current)&&i.setStep(y||"select")}),()=>{t=!1}},[k,e.step,e.ready,i.ready,i.ensure,u.scopeKey,u.mode,u.date,u.sessionId,u.os,u.order,y]);let _="select"===e.step?e.nextAfterSelect:"holder"===e.step?e.nextAfterHolder:"review",w="review"===e.step?e.isKiosk?e.text("Next: payment","下一步:支付"):e.text("Confirm & pay","确认并支付"):"holder"===_?e.text("Next: Holder","下一步:持有人"):"extras"===_?e.text("Next: add extras","下一步:附加商品"):"extras"!==e.step||e.extras.rows.some(e=>Number(e.num)>0)?e.text("Next: review & pay","下一步:确认订单"):e0_(e.locale,"skipExtras"),S={label:(0,eH.jsxs)(eH.Fragment,{children:[w," ",(0,eH.jsx)(e3V,{size:20,"aria-hidden":"true"})]}),compactLabel:w,disabled:e.disabled||!!e.depositHydration.error||i.pending||"review"===e.step&&!i.ready||!e.hasBookings||!e.mainDateMatches||e.mainCatalogBlocked||!!e.composer||!!e.configurationModal||("extras"===e.step||"review"===e.step)&&e.hasExtras&&(e.extrasCatalog.loading||!!e.extrasCatalog.error),busy:i.pending||e.depositHydration.pending||e.checkout.submitting||e.busy&&!e.pendingExtraProductId||e.holderBusy,onClick:async()=>{if(!(e.disabled||e.depositHydration.error||i.pending||e.isExtraQuantityPending()))if("review"===e.step){if(!await i.ensure())return;await e.checkout.checkout()&&!e.isKiosk&&e.setHandoff(!0)}else"select"===e.step?await b(e1H(e.context,e.scopeKey).required?"holder":e.nextAfterHolder):"holder"===e.step?await b(e.nextAfterHolder):await b("review")}},j={context:e.context,scopeKey:e.scopeKey,locale:e.locale,catalogProducts:e.main.products,isActive:e.props.isActive,disabled:e.externalHolderDisabled,onMutation:e.refresh,onStateChange:t=>e.setHolderBusy(t.pending),onRemoveTicket:"tickets"===e.mode?e.removeTicket:void 0},N=(0,eH.jsxs)("div",{className:"venue-booking-navigation",children:["payment"!==e.step&&(0,eH.jsx)(e6h,{runtime:e,onBack:y?x:void 0,disabled:i.pending}),(0,eH.jsx)(e0l,{current:f,label:e.text("Booking steps","预订步骤"),currentLabel:e.text("Current step","当前步骤"),readOnly:"payment"===e.step,steps:v.map(t=>({...t,status:"payment"===e.step||"payment"!==t.id&&("select"===t.id||e.hasBookings&&e.mainDateMatches&&!e.mainCatalogBlocked&&("holder"===t.id||e.holderState.complete))&&!e.disabled&&!i.pending?"available":"locked",onClick:()=>{b(t.id)}}))})]}),C=function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(0,eH.jsx)(e8C,{context:e.context,scopeKey:e.scopeKey,mode:e.mode,locale:e.locale,inline:!0,productLineUid:t,ordinalOffset:l,onRemoveTicket:"tickets"===e.mode?e.removeTicket:void 0,disabled:e.disabled||!!e.composer||!!e.configurationModal,onEdit:()=>{b("holder")}})},M="tickets"===e.mode&&(0,eH.jsxs)("button",{type:"button",className:"add-session full",disabled:e.disabled||!!e.composer||!!e.configurationModal,onClick:()=>{b("select",!0)},children:[(0,eH.jsx)(e3Y,{size:22,"aria-hidden":"true"}),e.text("Add more tickets","继续选购门票")]}),T=t=>(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(e6p,{runtime:e,review:!0,renderBookingDetails:t,onEditExtras:()=>{b("extras")}}),M,(0,eH.jsx)(e6m,{runtime:e,splitPartySubtotal:"party"===e.mode})]}),I=(0,eH.jsxs)(eH.Fragment,{children:["payment"===e.step&&e.checkout.kioskPaymentPage&&(0,eH.jsx)(e6v,{runtime:e}),"holder"===e.step&&(!e.isKiosk||i.ready)&&(0,eH.jsx)(e8c,{ref:n,...j,afterAssignments:M}),"extras"===e.step&&(0,eH.jsx)(e6s,{runtime:e}),k&&!i.ready&&(0,eH.jsx)("div",{className:"venue-booking-sales__loading",role:"status","aria-label":e.text("Loading checkout","正在加载确认页面"),children:(0,eH.jsx)(eT.Spin,{})}),"review"===e.step&&i.ready&&(0,eH.jsx)(e8j,{ref:e.confirmation,context:e.context,scopeKey:e.scopeKey,acceptedPolicies:e.isKiosk?g:void 0,onAcceptedPoliciesChange:e.isKiosk?e=>{o.current&&c.current===u&&m({owner:u,values:e})}:void 0,locale:e.locale,date:e.date,isActive:e.props.isActive,disabled:e.disabled,onMutation:e.refresh,onValidationBlocked:e.orderPanel.closeThen,includeHolderValidation:!1,orderReview:e.holderState.enabled&&!e.holderState.required?(0,eH.jsx)(e8c,{ref:n,...j,renderContent:t=>{let{renderLine:l}=t;return T((t,i)=>e.holderState.lines.some(e=>e.uid===t)?l(t,i):C(t,i))}}):T("tickets"===e.mode||e.holderState.enabled?C:void 0),note:(0,eH.jsx)(e3K,{hideLabel:!0,maxLength:2e3,id:`${e.mode}-order-note`,label:e.text("Order note","订单留言"),value:String((null==(l=e.order)?void 0:l.note)||""),disabled:e.disabled,onChange:t=>{e.disabled||e.sales.setOrderNote(t)},placeholder:e.text("Anything else we should know?","还有什么需要告诉我们?")})})]});return{navigation:N,primaryAction:S,back:x,previous:y,holderRef:n,renderStage:I,goTo:b}}function e6b(e){let[t,l]=(0,eC.useState)(),i=(null==t?void 0:t.scopeKey)===e.scopeKey&&t.sessionId===e.session.sessionId&&t.date===e.date,a=e.todayOnly?function(e){if(e.loading)return{status:"loading"};if(e.error)return{status:"error"};let t=Object.values(e.availability);return t.some(e=>e.available)?{status:"available"}:{status:t.some(e=>e.requiresConfiguration)?"configuration":"unavailable"}}(e.main):function(e,t,l,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e;if(i&&e<a)return{status:"unavailable"};let n=i?[e]:Array.from(new Set(t)).filter(t=>t>=e&&t>=a).sort();for(let e of n){var r;let t=(null==(r=l[e])?void 0:r.status)||"loading";if("loading"===t||"error"===t)return{status:t};if("available"===t||"configuration"===t)return{status:t,date:e}}return{status:n.length?"unavailable":"loading"}}(e.date,e.dateSearchRange?e1h(e.dateSearchRange):e.visibleDates,e.dateStates,e.session.restored&&!e.dateSearchRange,e.today);if((0,eC.useEffect)(()=>{e.todayOnly||!e.ready||e.disabled||e.dateConfirmed||i||e.hasBookings||e.composer||e.configurationModal||!e.canAutoSelectDate()||("available"===a.status||"configuration"===a.status)&&a.date&&(e.setDate(a.date),l({scopeKey:e.scopeKey,sessionId:e.session.sessionId,date:a.date}))},[e.todayOnly,e.ready,e.disabled,e.dateConfirmed,i,e.hasBookings,e.composer,e.configurationModal,e.scopeKey,e.session.sessionId,a.status,a.date,e.setDate,e.dateInteractionStarted]),e.todayOnly)return{catalogueReady:!0,status:a.status,searching:!1,searchRange:void 0,awaitingSelection:!1};let n=e.dateConfirmed||i;return{catalogueReady:n,status:a.status,searching:!n&&!!e.dateSearchRange&&"error"!==a.status&&"unavailable"!==a.status,searchRange:e.dateSearchRange,awaitingSelection:!n&&e.dateInteractionStarted&&("available"===a.status||"configuration"===a.status)}}let e6x={openCalendar:["Open calendar","打开日历"],closeCalendar:["Close calendar","关闭日历"],chooseVisitDate:["Choose your visit date","选择游玩日期"],chooseDate:["Choose a date","选择日期"],previousWeek:["Previous week","上一周"],nextWeek:["Next week","下一周"],backThisWeek:["This week","回到本周"],calendarToday:["Today","今天"],previousMonth:["Previous month","上个月"],nextMonth:["Next month","下个月"],calendarMonth:["Month","月份"],calendarYear:["Year","年份"],calendarThisMonth:["This month","回到本月"],calendarVenueTime:["Dates follow venue local time","日期按场馆当地时间"],dateNeedsReselect:["This date is no longer available. Please choose an available date.","此日期已不可预约,请重新选择可用日期。"],quickVisitDates:["Choose a day this week","快捷选择游玩日期"],calendarLoading:["Checking available dates…","正在查询可用日期…"],calendarLoadFailed:["Some dates could not be checked.","部分日期查询失败。"]},e6k=(e,t)=>{var l;return(null==(l=e6x[e])?void 0:l[+("zh"===t)])||e};function e6_(e){let{checkout:t,locale:l}=e;s2(eMn,l),s2(e3n,l);let i=t.kioskPaymentResult;if(!i)return null;let a=`${eL.getText("pisell2.big-sale.kiosk.back-home")} (${t.backHomeCountdown}s)`,n="payment"===i.kind&&!["success","deposit-paid"].includes(i.viewModel.status),r=[[...n?[{id:"continue-payment",buttonProps:{children:eL.getText("pisell2.venue-kiosk.checkout.continue-payment"),className:"primary-button",loading:t.submitting,disabled:t.resettingHome,onClick:()=>{t.checkout()}}}]:[],{id:"back-home",buttonProps:{children:n?eL.getText("pisell2.big-sale.kiosk.back-home"):a,className:n?void 0:"primary-button",loading:t.resettingHome,disabled:t.submitting,onClick:()=>{t.returnHome()}}}]];return(0,eH.jsxs)("section",{className:"venue-kiosk-result",children:[t.error&&(0,eH.jsx)(e2s,{tone:"error",children:t.error}),"payment"===i.kind?(0,eH.jsx)(Kt,{...i.viewModel,presentation:"page",actionButtons:r,autoClose:!1,closable:!1,clickOutsideToClose:!1,footer:void 0}):(0,eH.jsxs)("div",{className:"venue-kiosk-result__submitted",children:[(0,eH.jsx)("h1",{children:eL.getText("pisell2.big-sale.kiosk.order-submitted")}),(0,eH.jsx)("p",{children:eL.getText("pisell2.big-sale.kiosk.order-submitted-description")}),(0,eH.jsx)("strong",{children:i.order.reference||`${eL.getText("pisell2.venue-kiosk.checkout.order-reference")} ${i.order.orderId}`}),i.order.paymentStatusLabel&&(0,eH.jsx)("p",{children:eL.getText(i.order.paymentStatusLabel)}),null!=i.order.amountDue&&i.order.amountDue>0&&(0,eH.jsxs)("p",{children:[eL.getText("pisell2.big-sale.kiosk.to-pay"),": ",i.order.amountDueText]}),(0,eH.jsxs)("div",{className:"venue-kiosk-result__actions",children:[(0,eH.jsx)(eXE,{disabled:t.resettingHome||t.submitting,onClick:()=>{t.startNewOrder()},children:eL.getText("pisell2.big-sale.kiosk.start-next-order")}),(0,eH.jsx)(eXE,{secondary:!0,disabled:t.resettingHome||t.submitting,onClick:()=>{t.returnHome()},children:a})]})]})]})}function e6w(e){var t;let l=e3B(e),i=e6b(l),a=e6y(l),n=e6t(l),r=eXN(),[o,s]=(0,eC.useState)(!1);(0,eC.useEffect)(()=>{if(!o)return;let e=window.setTimeout(()=>s(!1),1e3);return()=>window.clearTimeout(e)},[o]);let d=(0,eC.useRef)({scopeKey:e.scopeKey}),c=l.bindings.bindings.reduce((e,t)=>e+t.quantity,0),u=function(e,t){var l;let[i,a]=(0,eC.useState)({scope:t,indicators:null==e?void 0:e.map(e=>({status:e}))});if(i.scope!==t){let l=null==e?void 0:e.map(e=>({status:e}));return a({scope:t,indicators:l}),l}if(e&&(e.length!==(null==(l=i.indicators)?void 0:l.length)||e.some((e,t)=>{var l,a;return e!==(null==(a=i.indicators)||null==(l=a[t])?void 0:l.status)}))){let l=performance.now(),n=e.map((e,t)=>{var a;let n=null==(a=i.indicators)?void 0:a[t];return(null==n?void 0:n.status)===e?n:{status:e,from:null==n?void 0:n.status,changedAt:l}});return a({scope:t,indicators:n}),n}return i.indicators}([l.dateConfirmed?"complete":"available",i.catalogueReady?c>0?"complete":"available":"locked"],d.current),p="holder"===l.step?l.text("Who is joining the fun?","谁来一起玩?"):"extras"===l.step?l.text("Make your visit extra special","为游玩增添更多乐趣"):"review"===l.step?l.text("Review your booking","确认您的预订"):void 0,m=String(l.amount(l.hasBookings?l.hasDeposit?l.amountDue:null==(t=l.summary)?void 0:t.expect_amount:0)),g=async e=>{try{await l.changeDate(e)&&(s(!0),r("#ticket-products"))}catch(e){l.setError(e instanceof Error?e.message:String(e))}},h=!!l.session.error||!l.session.ready||l.session.pendingOrder,v="payment"===l.step&&!!l.checkout.kioskPaymentPage;return l.checkout.kioskPaymentResult?(0,eH.jsx)(e6_,{checkout:l.checkout,locale:l.locale}):(0,eH.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--tickets",children:[(0,eH.jsx)(e6i,{runtime:l,showHero:!h&&"select"===l.step}),h?(0,eH.jsx)(e6a,{runtime:l}):(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsxs)(eXM,{className:`ticket-catalog-layout${v?" venue-booking-payment-page":""}`,navigation:a.navigation,title:p,stage:l.step,summary:!v&&(0,eH.jsx)(e0i,{panel:l.orderPanel,title:l.text("Your order","您的订单"),closeLabel:l.text("Close order","关闭订单"),decoration:(0,eH.jsx)(eJQ,{className:"order-mascot"}),body:(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(e6p,{runtime:l,onEditExtras:()=>{a.goTo("extras")}}),(0,eH.jsx)(e6m,{runtime:l,includeTotal:l.hasDeposit,includeDueNow:"review"===l.step&&!l.hasDeposit})]}),footer:(0,eH.jsxs)(eH.Fragment,{children:[n.summary,(0,eH.jsx)(eXT,{label:l.hasDeposit?l.text("Due now","本次待付"):l.text("Total","合计"),amount:m,total:!0}),(0,eH.jsx)(eXL,{action:a.primaryAction,className:"full"})]})}),footer:!v&&(0,eH.jsx)(eX$,{lang:l.locale,back:a.previous?{label:l.text("Previous step","上一步"),onClick:a.back}:void 0,summary:(0,eH.jsx)(e0a,{panel:l.orderPanel,title:l.text("Your order","您的订单"),label:l.hasDeposit?l.text("Deposit details","定金明细"):l.text("Details","明细"),total:m}),action:a.primaryAction,feedback:n.footer}),children:["select"===l.step&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("section",{id:"ticket-visit-date",className:"visit-date-panel","aria-label":l.text("Shared visit date","统一游玩日期"),tabIndex:-1,children:l.todayOnly?(0,eH.jsx)(e2h,{id:"ticket-current-date",date:l.date,today:l.today,locale:l.locale,stepStatus:null==u?void 0:u[0]}):"date"!==l.expandedSection&&l.dateConfirmed?(0,eH.jsx)(eXK,{id:"ticket-date-summary",className:"visit-date-summary",number:1,stepStatus:null==u?void 0:u[0],title:l.text("Choose a date","选择日期"),open:!1,completing:o,locked:l.disabled,lang:l.locale,summary:(0,eH.jsx)("b",{children:e0y(l.date,l.locale)}),onToggle:()=>{l.disabled||(s(!1),l.setExpandedSection("date"),r("#ticket-visit-date"))},children:null}):(0,eH.jsx)(e0x,{value:l.date,onChange:e=>{g(e)},locale:l.locale,title:l.text("Choose a date","选择日期"),stepNumber:1,stepStatus:null==u?void 0:u[0],timeZone:l.bookingUI.timeZone,todayMarker:"device",minDate:l.today,dateStates:l.dateStates,loading:i.searching,onInteraction:l.onDateInteraction,onVisibleDatesChange:l.setVisibleDates,disabled:l.disabled,t:e=>e6k(e,l.locale)})}),(0,eH.jsx)(eXK,{id:"ticket-products",number:2,stepStatus:null==u?void 0:u[1],title:l.text("Choose tickets","选择门票"),open:"product"===l.expandedSection||!c||!!l.composer,lang:l.locale,locked:l.disabled||!i.catalogueReady,onToggle:()=>{!l.disabled&&i.catalogueReady&&l.setExpandedSection("product"===l.expandedSection&&c?"":"product")},summary:c?(0,eH.jsxs)("span",{children:[(0,eH.jsx)(eXj,{size:20,"aria-hidden":"true"})," ",c," ",l.text("tickets selected","张门票已选")]}):void 0,children:(0,eH.jsx)(e6r,{runtime:l,preview:i})})]}),a.renderStage]}),l.composer&&(0,eH.jsx)(e2K,{mode:"tickets",draft:l.composer,context:l.context,priceSource:l.mainQueries,operationLog:l.operationLog,dateReadOnly:l.todayOnly,scopeKey:l.scopeKey,date:l.date,customerId:l.customerId,locale:l.locale,formatAmount:l.amount,disabled:!l.ready||l.busy||l.extras.busy||l.holderBusy||l.checkout.submitting||!!l.checkout.failure||l.handoff,onBusyChange:l.setComposerBusy,skuOptions:{config:{overSold:l.composer.overSold}},requiredOptionValidation:l.composer.requiredOptionValidation,onDateChange:async e=>l.changeDate(e),onCancel:()=>l.setComposer(void 0),onCommitted:()=>{l.setRevision(e=>e+1),l.setExpandedSection("product"),l.setComposer(void 0)},renderDatePicker:e=>{let{date:t,disabled:i,onChange:a}=e;return(0,eH.jsx)(e0x,{value:t,onChange:a,locale:l.locale,title:l.text("Visit date","游玩日期"),timeZone:l.bookingUI.timeZone,todayMarker:"device",minDate:l.today,dateStates:l.dateStates,onVisibleDatesChange:l.setVisibleDates,disabled:i,t:e=>e6k(e,l.locale)})}},l.composer.key)]}),(0,eH.jsx)(e6n,{runtime:l}),(0,eH.jsx)(e6g,{runtime:l})]})}let e6S=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M114.32,49.8A19.79,19.79,0,0,0,81.72,57L29.22,201.41A19.82,19.82,0,0,0,47.75,228a20,20,0,0,0,6.84-1.22L199,174.28a19.79,19.79,0,0,0,7.24-32.6ZM104.19,183.21l-31.4-31.4L82.94,123.9l49.16,49.16Zm-52.42,26.4Zm12-32.91L79.3,192.26l-24.45,8.89ZM157,164,92,99l10-27.58L184.57,154ZM128,40V16a12,12,0,0,1,24,0V40a12,12,0,0,1-24,0Zm116.48,83.51a12,12,0,0,1-17,17l-16-16a12,12,0,0,1,17-17Zm-.69-40.13-24,8a12,12,0,0,1-7.59-22.77l24-8a12,12,0,1,1,7.59,22.77ZM156.6,65.93C159.83,47.47,173.39,36,192,36c6.45,0,8.69-2.49,10-4.92a18,18,0,0,0,2-7.22V24a12,12,0,0,1,24,0c0,14.47-9.59,36-36,36-4.94,0-10.21,1.19-11.76,10.06A12,12,0,0,1,168.43,80a12.35,12.35,0,0,1-2.08-.18A12,12,0,0,1,156.6,65.93Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M58.89,154.89l42.22,42.22-50.63,18.4a7.79,7.79,0,0,1-10-10Zm138.82-4.72L105.83,58.29A7.79,7.79,0,0,0,93,61.14l-14.9,41,75.82,75.82,41-14.9A7.79,7.79,0,0,0,197.71,150.17Z",opacity:"0.2"}),eC.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26Zm-8.33,135.21-35-35,13.16-36.21,58.05,58.05Zm-55,20,14-38.41,24.45,24.45ZM156,168.64,87.36,100l13-35.87,91.43,91.43ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26ZM65.14,161.13l19.2-52.79,63.32,63.32-52.8,19.2ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M110.08,54a13.8,13.8,0,0,0-22.73,5.05L34.85,203.47A13.82,13.82,0,0,0,47.76,222a14,14,0,0,0,4.77-.85l144.38-52.5a13.8,13.8,0,0,0,5-22.73ZM48.43,209.87a1.79,1.79,0,0,1-2.3-2.3L61.31,165.8,90.2,194.68Zm54.21-19.71-36.8-36.81L80.51,113,143,175.49ZM194,156.07a1.74,1.74,0,0,1-1.14,1.3L155.44,171,85,100.55,98.63,63.19a1.72,1.72,0,0,1,1.3-1.14,1.58,1.58,0,0,1,.41,0,1.72,1.72,0,0,1,1.25.53l91.88,91.88A1.73,1.73,0,0,1,194,156.07ZM162,72a35.52,35.52,0,0,1,3.63-14.68C170.57,47.44,179.93,42,192,42c7.47,0,12.53-2.74,15.48-8.38A24.18,24.18,0,0,0,210,24,6,6,0,0,1,216,18h0a6,6,0,0,1,6,6c0,10.38-6.27,30-30,30-7.47,0-12.53,2.74-15.48,8.38A24,24,0,0,0,174,72a6,6,0,0,1-6,6h0A6,6,0,0,1,162,72ZM138,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm98.24,83.76a6,6,0,1,1-8.48,8.48l-16-16a6,6,0,0,1,8.48-8.48Zm5.66-46.07-24,8a6,6,0,1,1-3.8-11.38l24-8a6,6,0,0,1,3.8,11.38Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26Zm-8.33,135.21-35-35,13.16-36.21,58.05,58.05Zm-55,20,14-38.41,24.45,24.45ZM156,168.64,87.36,100l13-35.87,91.43,91.43ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M108.66,55.46a11.79,11.79,0,0,0-19.43,4.31L36.73,204.15a11.81,11.81,0,0,0,11,15.85,11.88,11.88,0,0,0,4.08-.73l144.38-52.5a11.79,11.79,0,0,0,4.31-19.43Zm-6.53,137L63.52,153.87l16.19-44.51,66.92,66.93Zm-53,19.28a3.81,3.81,0,0,1-4.87-4.87l16.27-44.72,33.32,33.32Zm146.8-55.25a3.77,3.77,0,0,1-2.42,2.74l-38.56,14L82.72,101.07l14-38.56a3.77,3.77,0,0,1,2.74-2.42,4.32,4.32,0,0,1,.85-.09A3.65,3.65,0,0,1,103,61.12L194.88,153A3.78,3.78,0,0,1,195.91,156.51ZM220,24c0,9.68-5.85,28-28,28-8.31,0-14.18,3.29-17.42,9.79A26.12,26.12,0,0,0,172,72a4,4,0,0,1-8,0,34.06,34.06,0,0,1,3.42-13.79C170.66,51.73,177.56,44,192,44c19.29,0,20-18,20-20a4,4,0,0,1,4-4h0A4,4,0,0,1,220,24ZM140,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm94.83,85.17a4,4,0,0,1-5.66,5.66l-16-16a4,4,0,0,1,5.66-5.66Zm6.43-49.37-24,8A4,4,0,0,1,216,84a4,4,0,0,1-1.27-7.79l24-8a4,4,0,0,1,2.53,7.59Z"}))]]),e6j=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e6S}));e6j.displayName="ConfettiIcon";let e6N=new Map([["bold",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,60a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,60Zm0,64a20,20,0,1,1,20-20A20,20,0,0,1,128,124Zm0-112a92.1,92.1,0,0,0-92,92c0,77.36,81.64,135.4,85.12,137.83a12,12,0,0,0,13.76,0,259,259,0,0,0,42.18-39C205.15,170.57,220,136.37,220,104A92.1,92.1,0,0,0,128,12Zm31.3,174.71A249.35,249.35,0,0,1,128,216.89a249.35,249.35,0,0,1-31.3-30.18C80,167.37,60,137.31,60,104a68,68,0,0,1,136,0C196,137.31,176,167.37,159.3,186.71Z"}))],["duotone",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,24a80,80,0,0,0-80,80c0,72,80,128,80,128s80-56,80-128A80,80,0,0,0,128,24Zm0,112a32,32,0,1,1,32-32A32,32,0,0,1,128,136Z",opacity:"0.2"}),eC.createElement("path",{d:"M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"}))],["fill",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,16a88.1,88.1,0,0,0-88,88c0,75.3,80,132.17,83.41,134.55a8,8,0,0,0,9.18,0C136,236.17,216,179.3,216,104A88.1,88.1,0,0,0,128,16Zm0,56a32,32,0,1,1-32,32A32,32,0,0,1,128,72Z"}))],["light",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,66a38,38,0,1,0,38,38A38,38,0,0,0,128,66Zm0,64a26,26,0,1,1,26-26A26,26,0,0,1,128,130Zm0-112a86.1,86.1,0,0,0-86,86c0,30.91,14.34,63.74,41.47,94.94a252.32,252.32,0,0,0,41.09,38,6,6,0,0,0,6.88,0,252.32,252.32,0,0,0,41.09-38c27.13-31.2,41.47-64,41.47-94.94A86.1,86.1,0,0,0,128,18Zm0,206.51C113,212.93,54,163.62,54,104a74,74,0,0,1,148,0C202,163.62,143,212.93,128,224.51Z"}))],["regular",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"}))],["thin",eC.createElement(eC.Fragment,null,eC.createElement("path",{d:"M128,68a36,36,0,1,0,36,36A36,36,0,0,0,128,68Zm0,64a28,28,0,1,1,28-28A28,28,0,0,1,128,132Zm0-112a84.09,84.09,0,0,0-84,84c0,30.42,14.17,62.79,41,93.62a250,250,0,0,0,40.73,37.66,4,4,0,0,0,4.58,0A250,250,0,0,0,171,197.62c26.81-30.83,41-63.2,41-93.62A84.09,84.09,0,0,0,128,20Zm37.1,172.23A254.62,254.62,0,0,1,128,227a254.62,254.62,0,0,1-37.1-34.81C73.15,171.8,52,139.9,52,104a76,76,0,0,1,152,0C204,139.9,182.85,171.8,165.1,192.23Z"}))]]),e6C=eC.forwardRef((e,t)=>eC.createElement(eXw,{ref:t,...e,weights:e6N}));function e6M(e){let t=e3B(e),l=e6b(t),{composer:i,configurationModal:a,partyMain:n,date:r,step:o,ready:s}=t,[d,c]=(0,eC.useState)(""),u=(0,eC.useCallback)(e=>{t.isKiosk||c(e)},[t.isKiosk]);(0,eC.useEffect)(()=>t.subscribePartyProductConfirmed(()=>{t.setDateConfirmed(!0),u("product")}),[t.subscribePartyProductConfirmed,t.setDateConfirmed,u]),(0,eC.useEffect)(()=>{u("")},[o,u]),(0,eC.useEffect)(()=>{if(t.isKiosk||!d)return;let e=window.setTimeout(()=>c(""),1e3);return()=>window.clearTimeout(e)},[d,t.isKiosk]);let p=(0,eC.useRef)();(0,eC.useEffect)(()=>{if(!s||i||a||"select"!==o||!n||n.date===r)return;let e=`${n.productLineUid}:${r}`;p.current!==e&&(p.current=e,t.editLine(n.productLineUid))},[s,i,a,o,null==n?void 0:n.productLineUid,null==n?void 0:n.date,r]);let m={datePreview:l,completingSection:t.isKiosk?"":d,onComplete:u};return t.checkout.kioskPaymentResult?(0,eH.jsx)(e6_,{checkout:t.checkout,locale:t.locale}):(0,eH.jsxs)(eH.Fragment,{children:[i?(0,eH.jsx)(e6T,{runtime:t,...m},i.key):(0,eH.jsx)(e6I,{runtime:t,...m}),(0,eH.jsx)(e6n,{runtime:t}),(0,eH.jsx)(e6g,{runtime:t})]})}function e6T(e){let{runtime:t,datePreview:l,completingSection:i,onComplete:a}=e,n=t.composer,r=e2w({mode:"party",draft:n,context:t.context,scopeKey:t.scopeKey,priceSource:t.mainQueries,operationLog:t.operationLog,date:t.date,customerId:t.customerId,locale:t.locale,disabled:!t.ready||t.busy||t.holderBusy||t.checkout.submitting||t.handoff,onBusyChange:t.setComposerBusy,onDraftChange:e=>t.rememberPartyPreview(n.key,e),onDateChange:async e=>{await t.changeDate(e)},onCancel:()=>t.setComposer(void 0),onCommitted:()=>{let e=e1H(t.context,t.scopeKey).required?"holder":t.nextAfterHolder;t.setRevision(e=>e+1),t.setStep(e),t.setComposer(void 0)},prepareRelated:async()=>{if(!t.partyMain)return{};let e=await t.extras.prepareRevalidation();if(e.invalidItems.length)throw Error(t.text("Some extras are unavailable for the new Party selection. Remove or reselect them before saving. ","部分附加商品不适用于新选择,请移除或重新选择后保存。 ")+e.invalidItems.map(e=>e.message).join(" "));return{mode:Number(t.partyMain.line.product_id)===Number(n.detail.id)?"edit":"replace",relatedRetailProducts:e.validRows,availabilityCommitGuard:()=>{var l;let i=e1F(t.os.getTempOrder(),{mode:"party"});if((null==(l=i.bindings[0])?void 0:l.productLineUid)!==t.partyMain.productLineUid||JSON.stringify(i.extras)!==JSON.stringify(e.sourceRows))throw Error(t.text("The extras changed. Please review your Party again.","附加商品已变化,请重新核对 Party。"))}}}}),o=e2W({enabled:!1!==t.props.isActive,openId:n.key,scopeKey:t.scopeKey,sessionId:t.session.sessionId,productDetail:n.detail,skuValue:r.configuration.skuValue,quantity:r.quantity,overSold:1===n.overSold,priceBasis:"catalog",timeZone:t.bookingUI.timeZone,customerId:t.customerId,os:t.mainQueries}),s=eXN();return(0,eH.jsx)(e2v,{ref:r.panelRef,...r.bookingProps,dateReadOnly:t.todayOnly,onExplicitSelection:(e,l)=>{if("time"===e){null==a||a("time");let e=l.resourceGroups.some(e=>!e0M(e,r.bookingProps.resourceSettings));t.setExpandedSection(!l.ready&&e?"resource":""),s(l.ready?".party-app .booking-primary-action":e?"#party-room":"#party-time",{block:l.ready?"nearest":"start"})}else l.ready&&(null==a||a("resource"),t.setExpandedSection(""),s(".party-app .booking-primary-action",{block:"nearest"}))},renderContent:e=>(0,eH.jsx)(e6I,{runtime:t,datePreview:l,model:r,selection:e,estimatedSubtotal:"ready"===o.status?o.subtotal:void 0,completingSection:i,onComplete:a})})}function e6I(e){var t,l,i,a;let{runtime:n,datePreview:r,model:o,selection:s,estimatedSubtotal:d,completingSection:c,onComplete:u}=e,p=o?Ho(o.prepared.product).required:n.holderState.required,m=e6y({...n,holderState:{...n.holderState,required:p}}),g=e6t(n,null==o?void 0:o.error),h=eXN(),{text:v,locale:f,partyMain:y,expandedSection:b,dateConfirmed:x}=n,k="payment"===n.step&&!!n.checkout.kioskPaymentPage,_=v("Your party","Party 订单明细"),w=e0y(n.date,"zh"===f?"zh-CN":"en-AU",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),S=n.composer,j=S?eXp(S.detail.title||S.detail.name,f):y?eXp(y.line.product_title,f):"",N=null==s?void 0:s.state.candidate,C=o?N?`${e6P(N.bookingStartAt||N.startAt)}–${e6P(N.bookingEndAt||N.endAt)}`:"":y?`${y.booking.start_time}–${y.booking.end_time}`:"",M=o?((null==s?void 0:s.state.selectedResourceDetails)||[]).map(e=>{var t;return eXp(e.name||(null==(t=e.raw)?void 0:t.name),f)}).filter(Boolean).join(" \xb7 "):((null==y?void 0:y.booking.resources)||[]).map(e=>{var t;return eXp((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,f)}).filter(Boolean).join(" \xb7 "),T=o?!!(N&&(N.businessDate||N.date)===n.date&&(null==s?void 0:s.state.times.some(e=>e0F(e,N)&&e0$(e,(s.state.partySize||0)*s.state.bookingCount)))):!!(C&&n.mainDateMatches),I=(null==o?void 0:o.prepared.partySize)??(null==y||null==(t=y.intent.resources[0])?void 0:t.capacity),P=iY((null==o?void 0:o.configuration.skuValue)||(y?{...y.line.product_sku,bundle:y.line.product_bundle}:void 0),"",e=>eXp(e,f),e=>String(n.amount(e))),A=!!j,D=o?o.bookingReady:n.hasBookings&&n.mainDateMatches,E=n.disabled||!!(null==o?void 0:o.working),O=n.context.sales.salesSettings,z=null==O||null==(l=O.reservation)?void 0:l.resourceSettings,L="picoding"!==n.context.sales.salesSettingsSource||!!(O&&!n.context.sales.salesSettingsError),R=(null==o?void 0:o.prepared.product)||(null==S?void 0:S.detail)||y&&n.main.products.find(e=>String(e.id)===String(y.line.product_id)),$=R?e0I(R,z):!y||y.intent.resources.some(e=>!e0M({formId:e.formId},z)),F=L&&(s?s.showResources:$),q=e=>{E||n.todayOnly&&"date"===e||"resource"===e&&!F||(null==u||u(e?"":b),n.setStep("select"),n.setExpandedSection(e),!o&&y&&["time","resource"].includes(e)&&n.editLine(y.productLineUid),h(`#party-${"resource"===e?"room":e}`))},B=e=>{E||n.orderPanel.closeThen(e)},H="select"===n.step?{label:v("Next: ","下一步:")+(p?v("holder details","Holder 资料"):n.hasExtras?v("extras","附加商品"):v("review","确认")),busy:(null==o?void 0:o.working)||n.busy||n.depositHydration.pending,disabled:E||n.mainCatalogBlocked||!D||!o&&!!n.depositHydration.error,onClick:async()=>{!E&&!n.mainCatalogBlocked&&D&&(o?await o.commit()&&n.orderPanel.closeThen(()=>h("[data-booking-stage]")):n.orderPanel.closeThen(()=>{n.continueOrder(n.nextAfterSelect),h("[data-booking-stage]")}))}}:m.primaryAction,V=(null==o||null==(i=o.quote)?void 0:i.compositeLineTotal)??d,U=o?null==V?"—":n.amount(V):n.amount(n.hasBookings?n.hasDeposit?n.amountDue:null==(a=n.summary)?void 0:a.expect_amount:0),Y=(0,eH.jsx)(eH.Fragment,{children:A?(0,eH.jsxs)("div",{className:"party-summary-lines",children:[(0,eH.jsx)(e31,{items:[{label:v("Your party","我的 Party"),value:j,detail:(0,eH.jsxs)(eH.Fragment,{children:[I?(0,eH.jsxs)("div",{children:[I," ",v("guests","位参加者")]}):null,P.map(e=>(0,eH.jsxs)("div",{children:[e.label," ",e.meta]},e.key)),!o&&y&&(0,eH.jsx)(e85,{products:[y.line],locale:f})]}),action:{label:v("Edit","编辑"),onClick:()=>B(()=>q("product")),disabled:E}},{label:v("When","日期与时间"),value:w,detail:C||v("Choose a time","待选择时间"),action:{label:n.todayOnly?v("Edit time","编辑时间"):v("Edit","编辑"),onClick:()=>B(()=>q(n.todayOnly?"time":"date")),disabled:E}},{label:v("Where","Party room"),value:M||v("Choose a room","待选择房间"),action:F?{label:v("Edit","编辑"),onClick:()=>B(()=>q("resource")),disabled:E}:void 0},...n.holderState.enabled?[{label:v("Holder","持有人"),value:`${n.holderState.completed} / ${n.holderState.total}`,detail:(0,eH.jsx)(e86,{context:n.context,locale:f,lines:n.holderState.lines.filter(e=>e.uid===(null==y?void 0:y.productLineUid))}),action:{label:v("Edit","编辑"),onClick:()=>B(()=>{n.setStep(n.holderState.required?"holder":"review"),h("[data-booking-stage]")}),disabled:E||!!o}}]:[]]}),n.extras.rows.length>0&&(0,eH.jsx)(e6c,{text:v}),(0,eH.jsx)(e6p,{runtime:n,onlyExtras:!0,onEditExtras:()=>{m.goTo("extras")}}),o?(0,eH.jsx)(eXT,{label:v("Party selection subtotal","Party 选择小计"),amount:U}):(0,eH.jsx)(e6m,{runtime:n,splitPartySubtotal:!0,includeTotal:n.hasDeposit,includeDueNow:"review"===n.step&&!n.hasDeposit}),o&&(0,eH.jsx)("p",{className:"small muted",children:v("Final fees and discounts are calculated after saving your selection.","保存选择后计算最终费用与优惠。")})]}):(0,eH.jsx)(e2d,{className:"party-empty",description:n.todayOnly?v("Choose a package to start planning your party.","选择商品,开始安排欢乐派对。"):v("A wonderful party starts here. Choose a date and a package.","从选日期和商品开始,安排一场欢乐派对。"),icon:(0,eH.jsx)(e6j,{size:34})})}),W=n.todayOnly?null:(0,eH.jsx)(e0x,{value:n.date,onChange:e=>{n.changeDate(e,o?{configuration:o.configuration,initialSelection:o.selection,quantity:o.quantity}:void 0).then(e=>{e&&(null==u||u("date"),h(o?"#party-time":"#party-product"))}).catch(e=>n.setError(e instanceof Error?e.message:String(e)))},locale:"zh"===f?"zh-CN":"en-AU",timeZone:n.bookingUI.timeZone,todayMarker:"device",title:v("Choose a date","选择日期"),stepNumber:1,stepStatus:{status:x?"complete":"available"},minDate:n.today,disabled:E,dateStates:n.dateStates,onVisibleDatesChange:n.setVisibleDates,loading:r.searching,onInteraction:n.onDateInteraction,t:e=>e6k(e,f)});return n.session.error||!n.session.ready||n.session.pendingOrder||!n.uiHydrated||n.previewRecovery?(0,eH.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--party",children:[(0,eH.jsx)(e6i,{runtime:n}),(0,eH.jsx)(e6a,{runtime:n}),n.previewRecovery&&(0,eH.jsxs)(e2s,{tone:n.previewRecoveryError?"error":void 0,children:[(0,eH.jsx)("p",{children:n.previewRecoveryError||v("Restoring your Party selection with current availability and prices…","正在按当前可用性和价格恢复 Party 选择…")}),n.previewRecoveryError&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(eXE,{secondary:!0,disabled:n.recoveringPreview,onClick:n.retryPartyPreview,children:v("Retry","重试")}),(0,eH.jsx)(eXE,{secondary:!0,disabled:n.recoveringPreview,onClick:n.discardPartyPreview,children:v("Discard unsaved selection","放弃未保存的选择")})]})]})]}):(0,eH.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--party party-app",children:[(0,eH.jsx)(e6i,{runtime:n}),(0,eH.jsx)(eXM,{className:`party-booking-page${k?" venue-booking-payment-page":""}`,stage:n.step,navigation:m.navigation,title:"holder"===n.step?v("Choose a Holder","选择持有人"):"extras"===n.step?v("Make it your Party","为 Party 增添更多乐趣"):"review"===n.step?v("Your party, all together","确认您的欢乐派对"):void 0,summary:!k&&(0,eH.jsx)(e0i,{panel:n.orderPanel,title:_,closeLabel:v("Close","关闭"),body:Y,footer:(0,eH.jsxs)(eH.Fragment,{children:[g.summary,(0,eH.jsx)(eXT,{label:o?v("Party selection subtotal","Party 选择小计"):n.hasDeposit?v("Due now","本次待付"):v("Party total","Party 总额"),amount:U,total:!0}),(0,eH.jsx)("div",{className:"party-actions",children:(0,eH.jsx)(eXL,{action:H})})]}),decoration:(0,eH.jsx)(eJQ,{variant:"summary"})}),footer:!k&&(0,eH.jsx)(eX$,{lang:f,back:m.previous?{label:v("Previous step","上一步"),onClick:m.back}:void 0,summary:(0,eH.jsx)(e0a,{panel:n.orderPanel,title:_,label:!o&&n.hasDeposit?v("Deposit details","定金明细"):v("Details","明细"),total:String(U)}),action:H,feedback:g.footer}),children:"select"===n.step?(0,eH.jsxs)("div",{className:"party-arrangement",children:[(0,eH.jsx)("section",{id:"party-date",tabIndex:-1,className:"visit-date-panel",children:n.todayOnly?(0,eH.jsx)(e2h,{id:"party-current-date",date:n.date,today:n.today,locale:f,stepStatus:{status:"complete"}}):"date"!==b&&x?(0,eH.jsx)(eXK,{lang:f,id:"party-date-summary",number:1,completing:"date"===c,stepStatus:{status:"complete"},title:v("Choose a date","选择日期"),open:!1,summary:(0,eH.jsx)("b",{children:w}),onToggle:()=>q("date"),locked:E,children:null}):W}),(0,eH.jsx)(eXK,{lang:f,id:"party-product",number:2,title:v("Choose your party package","选择 Party 商品"),completing:"product"===c,stepStatus:{status:A?"complete":r.catalogueReady?"available":"locked"},open:"product"===b||!A,summary:A?(0,eH.jsx)("b",{children:j}):void 0,onToggle:()=>{null==u||u("product"===b?"product":""),n.setExpandedSection("product"===b?"":"product")},locked:E||!r.catalogueReady,children:(0,eH.jsx)(e6r,{runtime:n,preview:r,showFilters:!1})}),(0,eH.jsx)(eXK,{lang:f,id:"party-time",number:3,title:v("Choose a time","选择时间"),completing:"time"===c,stepStatus:{status:T?"complete":A?"available":"locked"},open:"time"===b||!T,summary:C?(0,eH.jsx)("b",{children:C}):void 0,onToggle:()=>q("time"===b?"":"time"),locked:E||!A,children:s?s.timeContent:n.preparingProductId?(0,eH.jsx)(e2d,{className:"party-empty",pending:!0,description:v("Loading your Party selection…","正在加载您的 Party 选择…")}):(0,eH.jsx)(e2d,{className:"party-empty",icon:(0,eH.jsx)(e3Q,{size:28}),description:v("Choose your Party package first.","请先选择 Party 商品。")})}),F&&(0,eH.jsx)(eXK,{lang:f,id:"party-room",number:4,title:v("Choose a room","选择房间"),completing:"resource"===c,stepStatus:{status:D?"complete":T?"available":"locked"},open:"resource"===b||!M||!D,summary:M?(0,eH.jsx)("b",{children:M}):void 0,onToggle:()=>q("resource"===b?"":"resource"),locked:E||!T,children:s&&T?s.resourceContent:n.preparingProductId?(0,eH.jsx)(e2d,{className:"party-empty",pending:!0,description:v("Loading your Party selection…","正在加载您的 Party 选择…")}):(0,eH.jsx)(e2d,{className:"party-empty",icon:(0,eH.jsx)(e6C,{size:28}),description:v("Choose a time to see available rooms.","选择时间后查看可用房间。")})}),!D&&(null==s?void 0:s.statusPanel),D&&!b&&!E&&!(null==o?void 0:o.error)&&(0,eH.jsxs)(e2s,{id:"party-ready-notice",className:"party-ready-notice",tone:"success",icon:(0,eH.jsx)(e2P,{weight:"bold","aria-hidden":"true"}),children:[(0,eH.jsxs)("div",{className:"party-ready-copy",children:[(0,eH.jsx)("strong",{children:v("Your party choices are ready","Party 安排已选好")}),(0,eH.jsxs)("p",{children:[(0,eH.jsx)("span",{className:"party-ready-desktop",children:v("Click ","点击右侧")}),(0,eH.jsx)("span",{className:"party-ready-mobile",children:v("Tap ","点击底部")}),(0,eH.jsx)("b",{children:"zh"===f?(0,eH.jsxs)(eH.Fragment,{children:["「",H.label,"」"]}):(0,eH.jsxs)(eH.Fragment,{children:["“",H.label,"”"]})}),"en"===f&&(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("span",{className:"party-ready-desktop",children:" on the right."}),(0,eH.jsx)("span",{className:"party-ready-mobile",children:" below."})]})]})]}),(0,eH.jsx)(e3V,{className:"party-ready-direction",size:28,"aria-hidden":"true"})]})]}):m.renderStage})]})}function e6P(e){var t;return(null==(t=String(e||"").match(/[T ](\d{2}:\d{2})/))?void 0:t[1])||String(e||"").slice(0,5)}function e6A(e){var t,l,i,a,n,r,o,s,d,c,u,p,m,g,h;let v="tickets"===e.mode?e6w:e6M,f=e$(),y=(0,eC.useRef)({brand:void 0,design:void 0}),b=function(e,t,l){let i,a;if(!eXu(e)||!eXu(e.steps))return{status:"invalid",reason:"Booking menus have not been configured."};if(void 0!==e.template&&e.template!==t)return{status:"invalid",reason:"The booking template and menu configuration do not match."};let n=[t];Object.prototype.hasOwnProperty.call(e.steps,"extras")&&n.push("extras");let r={};for(let t of n){let l=e.steps[t],i=eXu(l)?l.catalog:void 0,a=eXu(i)?i.menuListIds:void 0;if(!Array.isArray(a)||a.some(e=>"number"!=typeof e||!Number.isSafeInteger(e)||e<=0))return{status:"invalid",reason:`The ${t} menu configuration is missing or invalid.`};r[t]={catalog:{menuListIds:[...new Set(a)]}}}let o=function e(t){if("string"!=typeof t)return;let l=t.trim();if(/^#[\da-f]{6}$/i.test(l))return l.toUpperCase();if(/^#[\da-f]{3}$/i.test(l))return`#${l.slice(1).split("").map(e=>e+e).join("")}`.toUpperCase();if(/^#[\da-f]{6}ff$/i.test(l))return l.slice(0,7).toUpperCase();if(/^#[\da-f]{3}f$/i.test(l))return e(l.slice(0,4));let i=/^(rgb|rgba)\(([^)]+)\)$/i.exec(l);if(!i)return;let a=i[2].split(",").map(e=>e.trim());if(a.length!==("rgba"===i[1].toLowerCase()?4:3)||a.some(e=>!/^(?:\d+(?:\.\d+)?|\.\d+)%?$/.test(e))||4===a.length&&1!==(a[3].endsWith("%")?parseFloat(a[3])/100:Number(a[3])))return;let n=a.slice(0,3).map(e=>{let t=e.endsWith("%"),l=parseFloat(e);return l<0||l>(t?100:255)?NaN:Math.round(t?255*l/100:l)});if(!n.some(e=>!Number.isFinite(e)))return`#${n.map(e=>e.toString(16).padStart(2,"0")).join("")}`.toUpperCase()}(l),s=eXu(e.brand)?e.brand:void 0,d=s||o?{name:"string"==typeof(null==s?void 0:s.name)?s.name:void 0,title:"string"==typeof(null==s?void 0:s.title)?s.title:void 0,logo:"string"==typeof(null==s?void 0:s.logo)?s.logo:void 0,hero:"string"==typeof(null==s?void 0:s.hero)?s.hero:void 0,primaryColor:o??("string"==typeof(null==s?void 0:s.primaryColor)?s.primaryColor:void 0),mascot:"string"==typeof(null==s?void 0:s.mascot)?s.mascot:void 0,logoMode:(null==s?void 0:s.logoMode)==="full"?"full":"icon-and-name"}:void 0;try{i=eJ4(e.design),eJ3(d)}catch{a="The booking design configuration is invalid."}return{status:"ready",value:{template:t,steps:r,brand:d,design:i,visualError:a},scopeKey:JSON.stringify({template:t,steps:r})}}(e.config,e.mode,null==f||null==(l=f.appHelper)||null==(t=l.constants)?void 0:t.themeColor),x=e.context.sales.bookingTicket;if("invalid"===b.status)return(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:b.reason});if(!x)return(0,eH.jsx)(eT.Spin,{});let k=(null==f||null==(n=f.appHelper)||null==(a=n.utils)||null==(i=a.getData)?void 0:i.call(a,"timezone"))||(null==(r=x.otherParams)?void 0:r.businessTimezone);if(!k&&"pending"===e.context.sales.catalogState)return(0,eH.jsx)(eT.Spin,{});try{if(!k)throw Error();eXf(k)}catch{return(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:String(e.locale).startsWith("zh")?"场馆时区尚未配置,请联系商家。":"The venue timezone is not configured. Please contact the venue."})}if("function"!=typeof x.createVenueCatalogSession)return(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:String(e.locale).startsWith("zh")?"预约服务尚未更新,请联系商家。":"The booking service needs to be updated. Please contact the venue."});let _=e.businessCode||(null==(o=x.otherParams)?void 0:o.businessCode)||"venue_booking",w=x.otherParams,S=eXy(x),j=null==f||null==(c=f.appHelper)||null==(d=c.utils)||null==(s=d.getData)?void 0:s.call(d,"shop_id"),N=JSON.stringify([(null==w?void 0:w.shopId)!=null&&String(w.shopId)!==String(j)?w.shopId:j,(null==w?void 0:w.previousVenueCacheId)&&"venue_booking"===_?null:null==w?void 0:w.tenantId,e.context.sales.osKey,k,b.scopeKey,..."venue_booking"===_?[]:[_],...S?["kiosk",e.mode]:[]]),C=String(e.locale).startsWith("zh")?"zh":"en";b.value.visualError||(y.current={brand:b.value.brand,design:b.value.design});let M={...b.value,...y.current},T={...M.brand,name:(null==(u=M.brand)?void 0:u.name)||(null==(p=M.brand)?void 0:p.title)||eXp(null==f||null==(h=f.appHelper)||null==(g=h.utils)||null==(m=g.getData)?void 0:m.call(g,"shop_name"),C)||("zh"===C?"预订游玩":"Book your visit")};return(0,eH.jsx)(eT.ConfigProvider,{theme:{token:{colorPrimary:T.primaryColor||"#D61518",colorText:"#092d3e",fontFamily:'BookingDM, "PingFang SC", "Microsoft YaHei", sans-serif'}},children:(0,eH.jsx)(eXc,{lang:C,brand:T,design:M.design,timeZone:k,className:"venue-booking-design",isActive:e.isActive,presentationPlatform:S?"kiosk":"default",layout:S?"compact":"responsive",children:(0,eH.jsx)(v,{...e,businessCode:_,config:M,scopeKey:N},N)})})}function e6D(e){let{tmpl:t="standard",...l}=e,{venueBookingConfig:i,isActive:a=!0,catalogPreparation:n,osKey:r,productListPreferencesChannel:o,context:s,mode:d,variant:c,productLoadParams:u,businessCode:p,bookingConfigParams:m,hideSelectFloorMapResourceAction:g,productDisplayConfig:h,productCatalogSessionKey:v,productCatalogReady:f,kioskShellLayout:y,kioskAppearance:b,saleDetailTemplate:x,saleDetailModuleConfig:k,orderId:_,locale:w,onLocaleChange:S,saleDetailWrapperProps:j,saleDetailHeaderSlot:N,rightActionBarClose:C,onOrderComplete:M,onPaidCheckout:T,onPaymentPageActiveChange:I,onRequestHome:P,renderCatalog:A,externalActionRequest:D,onExternalActionAccepted:E,onExternalPaymentSettled:O}=l;switch(t){case"venue-ticket-booking":case"venue-party-booking":return(0,eH.jsx)(e6A,{mode:"venue-ticket-booking"===t?"tickets":"party",businessCode:p,context:s,variant:c,config:i,isActive:a,locale:w,onRequestHome:P});case"HDLKiosk":return(0,eH.jsx)(eJL,{isActive:a,osKey:r,context:s,mode:d,variant:c,businessCode:p,locale:w,onLocaleChange:S,productLoadParams:u,productCatalogSessionKey:v,productCatalogReady:f});case"SelfServiceKiosk":return(0,eH.jsx)(eUL,{...l});case"kiosk":return(0,eH.jsx)(eKp,{isActive:a,catalogPreparation:n,osKey:r,productListPreferencesChannel:o,context:s,mode:d,variant:c,productLoadParams:u,businessCode:p,bookingConfigParams:m,hideSelectFloorMapResourceAction:g,productDisplayConfig:h,productCatalogSessionKey:v,productCatalogReady:f,kioskShellLayout:y,kioskAppearance:b,saleDetailTemplate:x,saleDetailModuleConfig:k,orderId:_,locale:w,saleDetailHeaderSlot:N,onOrderComplete:M,onPaidCheckout:T,onPaymentPageActiveChange:I,onRequestHome:P,renderCatalog:A});case"secondaryScreen":return(0,eH.jsx)(eWq,{osKey:r,context:s,mode:d,variant:c,productLoadParams:u,businessCode:p,bookingConfigParams:m,hideSelectFloorMapResourceAction:g,productDisplayConfig:h,productCatalogSessionKey:v,productCatalogReady:f,saleDetailTemplate:x,saleDetailModuleConfig:k,orderId:_,locale:w,saleDetailWrapperProps:j,saleDetailHeaderSlot:N,onOrderComplete:M});default:return(0,eH.jsx)(eWF,{isActive:a,osKey:r,productListPreferencesChannel:o,context:s,mode:d,variant:c,productLoadParams:u,businessCode:p,bookingConfigParams:m,hideSelectFloorMapResourceAction:g,productDisplayConfig:h,productCatalogSessionKey:v,productCatalogReady:f,saleDetailTemplate:x,saleDetailModuleConfig:k,orderId:_,locale:w,saleDetailWrapperProps:j,saleDetailHeaderSlot:N,rightActionBarClose:C,onOrderComplete:M,externalActionRequest:D,onExternalActionAccepted:E,onExternalPaymentSettled:O})}}function e6E(e){var t,l;let i,a,n,r,o,s,{isActive:d=!0,catalogPreparation:c,osKey:u,saleDetailHeaderSlot:p,rightActionBarClose:m,overlaySlot:g,className:h,style:v,mode:f="ticket",tmpl:y,template:b="standard",kioskAppId:x,kioskAppBindings:k,venueBookingConfig:_,variant:w="desktop",productLoadParams:S,businessCode:j,bookingConfigParams:N,hideSelectFloorMapResourceAction:C,productDisplayConfig:M,productCatalogSessionKey:T,productCatalogReady:I,kioskShellLayout:P,kioskAppearance:A,saleDetailTemplate:D,saleDetailModuleConfig:E,autoCreate:O=!0,orderId:z,locale:L,onLocaleChange:R,saleDetailWrapperProps:$,cartProductsPerRow:F,showClient:q,onOrderComplete:B,onPaidCheckout:H,onPaymentPageActiveChange:V,onRequestHome:U,renderCatalog:Y,externalActionRequest:W,onExternalActionAccepted:K,onExternalPaymentSettled:G}=e;s2(eMn,L);let Q=(0,nY.useToast)(),Z=(i=exe(),a=eC0(),n=exr(),r=eND(),o=eC2(),s=eCX(),(0,eC.useMemo)(()=>({sales:i,products:a,customer:n,cart:r,summary:o,booking:s}),[i,a,n,r,o,s]));eK(d);let J=y||b||"standard",X=(0,eC.useRef)(!1),ee=(null==(l=Z.booking)||null==(t=l.getBookingConfig)?void 0:t.call(l))??null,{salesSettingsSource:et,salesSettings:el,salesSettingsError:ei,salesSettingsPlatform:ea,ensureSalesSettings:en}=Z.sales,er="picoding"===et&&!el,eo="SelfServiceKiosk"===J&&"vendingMachine"===x,es=d&&!eo&&er&&!ei?eL.getText("pisell2.big-sale.loading"):void 0,ed=!!(ei||Z.sales.error||"error"===Z.sales.status),ec=null==c?void 0:c.onStateChange;(0,eC.useEffect)(()=>{er&&(null==ec||ec({ready:!1,failed:ed}))},[er,ed,ec]);let eu=function(e){let{template:t,mode:l,bookingConfig:i,salesSettingsSource:a,salesSettings:n,platform:r,saleDetailModuleConfig:o,cartProductsPerRow:s,showClient:d}=e;return(0,eC.useMemo)(()=>{var e;let c;return(c=function(e,t){if(!e&&!t)return;let l={...e,...t,hidden:[...new Set([...(null==e?void 0:e.hidden)??[],...(null==t?void 0:t.hidden)??[]])],amountDetails:{...null==e?void 0:e.amountDetails,...null==t?void 0:t.amountDetails},promotionWalletPanelsBehavior:{...null==e?void 0:e.promotionWalletPanelsBehavior,...null==t?void 0:t.promotionWalletPanelsBehavior}};if((null==e?void 0:e.cartItems)||(null==t?void 0:t.cartItems)){var i,a;l.cartItems={...null==e?void 0:e.cartItems,...null==t?void 0:t.cartItems,layout:{...null==e||null==(i=e.cartItems)?void 0:i.layout,...null==t||null==(a=t.cartItems)?void 0:a.layout}}}return l}(function(e){var t,l;let i,{template:a,mode:n,bookingConfig:r,salesSettingsSource:o,salesSettings:s,platform:d,cartProductsPerRow:c,showClient:u}=e,p="secondaryScreen"===a;if("picoding"===o&&!s)return;let m="picoding"===o?{isShowImage:s.cart.showProductImage,isShowDelete:!!iE(d)||s.cart.showRemoveButton}:(t="retail"===n?"retail":"appointment",{isShowImage:eC5((i=((null==r||null==(l=r.config)?void 0:l.cart_settings_tab)||{})[`${t}_product_card_style`]||{}).show_product_image)??!0,isShowDelete:eC5(i.show_remove_button)??!0}),g=function(e){if(void 0!==e)return{columns:e}}(c),h={cartItems:{showProductImage:m.isShowImage,showRemoveButton:!p&&m.isShowDelete,...g?{layout:g}:{}},promotionWalletPanelsBehavior:{enableVoucherProductAdd:!p,enableWalletAssets:!p}};if(p){let e=[...eMa];!1===u&&e.push("customer"),h.hidden=e,h.amountDetails={defaultExpanded:!0}}return h}(e={template:t,mode:l,bookingConfig:i,salesSettingsSource:a,salesSettings:n,platform:r,cartProductsPerRow:s,showClient:d,saleDetailModuleConfig:o}),e.saleDetailModuleConfig))&&"secondaryScreen"===e.template?{...c,cartItems:{...c.cartItems,showRemoveButton:!1},promotionWalletPanelsBehavior:{...c.promotionWalletPanelsBehavior,enableVoucherProductAdd:!1,enableWalletAssets:!1}}:c},[t,l,i,a,n,r,s,d,o])}({template:J,mode:f,bookingConfig:ee,salesSettingsSource:et,salesSettings:el,platform:ea,saleDetailModuleConfig:E,cartProductsPerRow:F,showClient:q}),ep="secondaryScreen"===J,em="standard"===J,eg=Z.sales.productLoadChannel||"pos";return((0,eC.useEffect)(()=>{let e;if(!es)return;let t=window.setTimeout(()=>{e=Q.loading(es,0,()=>{e=void 0})},0);return()=>{window.clearTimeout(t),null==e||e.close()}},[es,Q]),(0,eC.useEffect)(()=>{er||!O||z||X.current||!Z.sales.bookingTicket||Z.sales.tempOrder||"idle"===Z.sales.status&&(X.current=!0,Z.sales.createNew().catch(()=>{X.current=!1}))},[O,z,Z.sales,Z.sales.bookingTicket,Z.sales.status,Z.sales.tempOrder,er]),er&&!eo)?(0,eH.jsx)("div",{className:aT()("pisell-big-sale",h),style:v,children:ei&&(0,eH.jsx)(eT.Alert,{type:"error",showIcon:!0,message:ei.message,action:(0,eH.jsx)(eT.Button,{onClick:()=>void en().catch(()=>void 0),children:eL.getText("pisell2.big-sale.reload")})})}):(0,eH.jsxs)("div",{className:aT()("pisell-big-sale",`pisell-big-sale--${w}`,`pisell-big-sale-tmpl--${J}`,{"pisell-big-sale--secondary-screen":ep,"pisell-big-sale--has-right-action-panel":em&&"phone"!==w,"pisell-big-sale--has-right-action-close":em&&"phone"!==w&&!!m},h),"data-kiosk-shell":"kiosk"===J?P:void 0,style:v,children:[(0,eH.jsx)("div",{className:"pisell-big-sale__layout",children:(0,eH.jsx)(e6D,{isActive:d,catalogPreparation:c,osKey:u,productListPreferencesChannel:eg,mode:f,tmpl:J,kioskAppId:x,kioskAppBindings:k,venueBookingConfig:_,variant:w,context:Z,productLoadParams:S,businessCode:j,bookingConfigParams:N,hideSelectFloorMapResourceAction:C,productDisplayConfig:M,productCatalogSessionKey:T,productCatalogReady:(!eo||!er)&&I,kioskShellLayout:P,kioskAppearance:A,saleDetailTemplate:D,saleDetailModuleConfig:eu,orderId:z,locale:L,onLocaleChange:R,saleDetailWrapperProps:ep?$:void 0,saleDetailHeaderSlot:p,rightActionBarClose:m,onOrderComplete:B,onPaidCheckout:H,onPaymentPageActiveChange:V,onRequestHome:U,renderCatalog:Y,externalActionRequest:W,onExternalActionAccepted:K,onExternalPaymentSettled:G})}),g]})}e6C.displayName="MapPinIcon",e6E.displayName="BigSaleBase";let e6O=oZ(e6E);function e6z(e){return"product-selection"===e||"appointment-booking"===e}function e6L(e,t,l){if(!e6z(e))return t;let i=Array.isArray(null==t?void 0:t.steps)||"function"==typeof(null==t?void 0:t.resolveSteps);return{...t,enableProductSelectionFlowForCart:!0,enableBookingSelectionFlowForCart:!0,...!i?{resolveSteps:["pos","webpos"].includes(String(l||"").trim().toLowerCase())?HN:HC}:{}}}function e6R(e,t){return e&&eS()(e).isValid()?eS()(e).format("YYYY-MM-DD"):t||eS()().format("YYYY-MM-DD")}let e6$=e=>{var t;let{runtimeRef:l}=e,i=exe(),a=exr();return(0,eC.useEffect)(()=>{let e=()=>{var e,t,n,r,o,s,d,c;let u=(null==(t=i.bookingTicket)||null==(e=t.getBookingDate)?void 0:e.call(t))??(null==(d=i.bookingTicket)||null==(s=d.store)||null==(o=s.bookingContext)||null==(r=o.getState)||null==(n=r.call(o))?void 0:n.date);l.current={customerId:null==(c=a.selected)?void 0:c.id,date:e6R(u)}};return e(),exs(i.bookingTicket,e)},[i.bookingTicket,null==(t=a.selected)?void 0:t.id,l]),null},e6F=e=>{var t,l,i,a,n,r,o;let{osKey:s="big-sale",enableMultiCurrencySettlement:d=!1,osModuleName:c,selectionFlowScene:u="product-selection",lifecycleOwner:p,orderId:m,autoBootstrap:g,autoRestoreOnInit:h,restoreOrderAfterPaidCheckout:v,destroyOnUnmount:f,businessCode:y,bookingConfigParams:b,resourceIdFromCalendar:x,bookingTimeRangeFromCalendar:k,autoInitBookingContext:_,otherParams:w,inventory:S,catalogScope:j,checkoutHooks:N,rulesHooks:C,uiHosts:M,awaitAllergyConfirmation:T,normalProductDetailConfig:I,mergeBookingLinesForDisplay:P,mode:A="ticket",variant:D,tmpl:E,template:O,kioskAppId:z,kioskAppBindings:L,venueBookingConfig:R,secondaryScreenDisplay:$,productLoadParams:F,enableMenuOverride:q=!1,productDisplayConfig:B,hideSelectFloorMapResourceAction:H,productCatalogSessionKey:V,productCatalogReady:U,saleDetailTemplate:Y,saleDetailModuleConfig:W,autoCreate:K=!0,enableTempOrderPersist:G,enableTempOrderSync:Q=!0,isActive:Z=!0,catalogPreparation:J,preserveProductCatalogOnInactiveCustomerClear:X,autoReloadProductCatalogOnCustomerChange:ee,enableGlobalScanListener:et=!1,scanRequest:el,onScanRequestAccepted:ei,onScanRequestSettled:ea,scanScope:en,onScanPromotionResult:er,promotionScanSuccessMessageKey:eo,promotionItemIncreaseMessageKey:es,className:ed,style:ec,locale:eu,bootstrapSlot:ep,saleDetailHeaderSlot:em,rightActionBarClose:eg,overlaySlot:eh,onOrderComplete:ev,onPaidCheckout:ef,onPaymentPageActiveChange:ey,onRequestHome:eb,renderCatalog:ex,externalActionRequest:ek,onExternalActionAccepted:e_,onExternalPaymentSettled:ew}=e,eS=e$(),ej=eq(),eN=null==eS||null==(l=eS.appHelper)||null==(t=l.utils)?void 0:t.action,eM=null==eS||null==(a=eS.appHelper)||null==(i=a.utils)?void 0:i.pisellos,eT=null==eS||null==(o=eS.appHelper)||null==(r=o.utils)||null==(n=r.businessUtils)?void 0:n.isProductMergeDisabled,eI=(0,eC.useMemo)(()=>()=>"function"!=typeof eT||!eT(),[eT]),eP=y?`bookingTicket-${s}-${y}`:[s,A].filter(Boolean).join("-"),eA=c||eP,{runtime:eD}=Kj(),{isSecondaryScreen:eE,secondaryProductsPerRow:eO,showSecondaryCustomerInfo:ez,mainContentWrapperProps:eL,secondaryScreenSettingsModal:eR}=Q2(eD,$),eF=E??O??"standard",eB="SelfServiceKiosk"===eF?"kiosk":eF,eV="venue-ticket-booking"===eB||"venue-party-booking"===eB,eU="kiosk"===eB||"HDLKiosk"===eB,eY=dw({preferEngineLocale:eU}),[eW,eK]=(0,eC.useState)(),eG="HDLKiosk"===eB&&eW?eW:eu||eY,eQ=(0,eC.useCallback)(e=>{eK(e)},[]),eZ=eE&&"secondaryScreen"===eB,eJ=e6z(u),eX=(0,eC.useMemo)(()=>eWV(eWH(null==w?void 0:w.platform,ej),D),[null==w?void 0:w.platform,ej,D]),e0="kiosk"===eB&&eX.variant||D,e2="kiosk"===eB?eX.kioskShellLayout:void 0,e1=(0,eC.useMemo)(()=>{let e=e6L(u,I,eU?void 0:String(eWH(null==w?void 0:w.platform,ej)??"")),t={...e,..."HDLKiosk"===eB&&!(null==e?void 0:e.appearance)&&!(null==e?void 0:e.resolveAppearance)?{resolveAppearance:eMA}:{},enableMultiCurrencySettlement:d},l=eX.platform?eX.productDetailPresentationPlatform:(null==t?void 0:t.presentationPlatform)??eX.productDetailPresentationPlatform;return eU||eV?{...t,initializeFullBookingContext:!1,variant:eX.productDetailVariant,selectorColumns:"phone"===eX.productDetailVariant&&"default"===l?1:2,isShowProductSummary:!0,isShowCollapsibleSections:!0,isShowMobileWeighing:!0,isShowProcedureSteps:!0,isShowNote:!0,isShowManualPriceChange:!1,isShowRemove:!1,presentationPlatform:l}:{...t,selectorColumns:"phone"===D?1:null==t?void 0:t.selectorColumns,presentationPlatform:eJ?"pos":void 0,initializeFullBookingContext:!0,isShowCollapsibleSections:!0,...eJ?{isShowManualPriceChange:!0}:{},allowUnavailableBookingSelection:eJ,allowNoResourceBookingSelection:eJ}},[d,eJ,eV,eX.productDetailPresentationPlatform,eX.productDetailVariant,eX.platform,I,null==w?void 0:w.platform,ej,eU,eB,u,D]),e4="kiosk"!==eB&&eJ,e3=eWH(null==w?void 0:w.platform,ej),e8="webpos"===String(e3??"").trim().toLowerCase()?"pos":e3,e6=(0,eC.useMemo)(()=>({enforceSingleBookingStartDate:!1,enableMemberCartConsistency:"pos"===e8&&"standard"===eB,...w,...e8?{platform:e8}:{},enablePickupTiming:"HDLKiosk"!==eB&&!eV}),[w,e8,eB,eV]),e5=(0,eC.useMemo)(()=>e4?{...W,cartItems:{...null==W?void 0:W.cartItems,bookingQuantityMode:"editable"}}:W,[e4,W]),e7=(0,eC.useRef)({date:void 0,customerId:void 0}),e9=(0,eC.useMemo)(()=>eN?{action:eN,getRuntime:()=>{var e,t,l,i,a;let n=null==eM||null==(e=eM.getModule)?void 0:e.call(eM,eA),r=null==n||null==(i=n.store)||null==(l=i.bookingContext)||null==(t=l.getState)?void 0:t.call(l),o=(null==n||null==(a=n.getBookingDate)?void 0:a.call(n))??(null==r?void 0:r.date);return{...e7.current,date:e6R(o,e7.current.date)}}}:void 0,[eN,eM,eA]);return(0,eH.jsx)(d_,{value:eG,children:(0,eH.jsx)(eCG,{destroyOnUnmount:f,osKey:eA,enableMultiCurrencySettlement:d,solution:"unifiedBookingSales",moduleAccess:c?"existing":"ensure",lifecycleOwner:p,orderId:m,autoBootstrap:g??!!m,autoRestoreOnInit:h,restoreOrderAfterPaidCheckout:v,businessCode:y,bookingConfigParams:b,resourceIdFromCalendar:x,bookingTimeRangeFromCalendar:k,autoInitBookingContext:_,otherParams:e6,inventory:S,catalogScope:j,checkoutHooks:N,deferHolderAuthOnClose:"kiosk"===eB||eV,enablePromotionCodeCustomerAuth:eV&&"kiosk"===eX.platform,enableCustomerAuthHost:"kiosk"===eB&&eX.enableCustomerAuthHost||eV&&eXy({otherParams:w}),shouldMergeProductLines:eI,rulesHooks:C,legacyOpenProductDetail:e9,uiHosts:M,awaitAllergyConfirmation:T,normalProductDetailConfig:e1,mergeBookingLinesForDisplay:!!e4||P,enableTempOrderPersist:G,enableTempOrderSync:Q,isActive:Z,catalogPreparation:J,preserveProductCatalogOnInactiveCustomerClear:X,enableGlobalScanListener:"HDLKiosk"!==eB&&et,scanRequest:el,onScanRequestAccepted:ei,onScanRequestSettled:ea,scanScope:en,onScanPromotionResult:er,suppressCartIneligibleScanToast:!0,promotionScanSuccessMessageKey:eo,promotionItemIncreaseMessageKey:es??(eU?"pisell2.big-sale.kiosk.offer-added-success":void 0),defaultProductLoadParams:F,autoReloadProductCatalogOnCustomerChange:!eV&&ee,promotionProductSource:eV?"catalog-only":void 0,enableMenuOverride:q,children:(0,eH.jsxs)(eCJ,{children:[(0,eH.jsx)(e6$,{runtimeRef:e7}),ep,(0,eH.jsx)(e6O,{isActive:Z,catalogPreparation:J,osKey:s,mode:A,variant:e0,kioskShellLayout:e2,kioskAppearance:"kiosk"===eB?eX.appearance:void 0,template:eF,kioskAppId:z,kioskAppBindings:L,venueBookingConfig:R,productLoadParams:F,productDisplayConfig:B,productCatalogSessionKey:V,productCatalogReady:U,saleDetailTemplate:Y,saleDetailModuleConfig:e5,autoCreate:K,orderId:m,className:ed,style:ec,locale:eG,onLocaleChange:"HDLKiosk"===eB?eQ:void 0,saleDetailWrapperProps:eZ?eL:void 0,cartProductsPerRow:eZ?eO:void 0,showClient:eZ?ez:void 0,businessCode:y,bookingConfigParams:b,hideSelectFloorMapResourceAction:H,saleDetailHeaderSlot:em,rightActionBarClose:eg,overlaySlot:eh,onOrderComplete:ev,onPaidCheckout:ef,onPaymentPageActiveChange:ey,onRequestHome:eb,renderCatalog:ex,externalActionRequest:ek,onExternalActionAccepted:e_,onExternalPaymentSettled:ew}),eZ?eR:null]})})})};e6F.displayName="BigSale";let e6q=e6F;function e6B(e){let{busy:t,pending:l=!1,primaryLabel:i,primaryIcon:a=(0,eH.jsx)("span",{className:"vm-catalog-bar-arrow","aria-hidden":"true",children:(0,eH.jsx)(pr,{})}),primaryType:n="button",primaryDisabled:r=!1,secondaryAction:o,children:s,onBack:d,onPrimary:c}=e,{text:u}=eTp();return(0,eH.jsxs)(eH.Fragment,{children:[o&&(0,eH.jsxs)("button",{className:"vm-bottom-bar-secondary",type:"button",disabled:t,"aria-disabled":t||l,onClick:()=>{t||l||o.onClick()},children:[o.icon,(0,eH.jsx)("span",{children:o.label})]}),(0,eH.jsxs)("footer",{className:"vm-bottom-bar vm-catalog-bar","aria-label":u("catalogOrderActions"),children:[(0,eH.jsx)("div",{className:"vm-catalog-bar-leading",children:(0,eH.jsxs)("button",{className:"vm-catalog-bar-button",type:"button",disabled:t,"aria-disabled":t||l,onClick:()=>{t||l||d()},children:[(0,eH.jsx)("span",{className:"vm-catalog-bar-arrow","aria-hidden":"true",children:(0,eH.jsx)(pa,{})}),(0,eH.jsx)("span",{children:u("back")})]})}),(0,eH.jsx)("div",{className:"vm-catalog-bar-summary","aria-live":s?"polite":void 0,children:s}),(0,eH.jsx)("div",{className:"vm-catalog-bar-trailing",children:(0,eH.jsxs)("button",{className:"vm-catalog-bar-button vm-catalog-bar-next",type:n,disabled:t||r,"aria-disabled":t||l||r,onClick:e=>{t||l||r?e.preventDefault():null==c||c()},children:[(0,eH.jsx)("span",{children:i}),a]})})]})]})}function e6H(e){let{quantity:t,busy:l,pending:i=!1,onReview:a}=e,{text:n}=eTp();return(0,eH.jsxs)("button",{className:"vm-catalog-bar-cart",type:"button",disabled:l||0===t,"aria-disabled":l||i||0===t,onClick:()=>{l||i||!(t>0)||a()},"aria-label":n("catalogCart",{count:t}),children:[(0,eH.jsx)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:(0,eH.jsx)("path",{d:"M6 8h12l1 12H5L6 8Zm3 0a3 3 0 0 1 6 0"})}),(0,eH.jsx)("strong",{children:t})]})}function e6V(e){let{quantity:t,total:l,amountDue:i,busy:a,pending:n=!1,onBack:r,onReview:o,onCheckout:s,onPromotion:d,promotionVisible:c=!1}=e,{text:u}=eTp();return(0,eH.jsxs)(e6B,{busy:a,pending:n,onBack:r,primaryLabel:u(0===i?"catalogConfirmOrder":"catalogCheckout"),onPrimary:s,children:[0!==i&&(0,eH.jsxs)("button",{className:"vm-catalog-bar-amount",type:"button",disabled:a||0===t,"aria-disabled":a||n||0===t,onClick:()=>{a||n||!(t>0)||o()},children:[(0,eH.jsx)("span",{children:u("catalogToPay")}),(0,eH.jsx)("strong",{children:l})]}),(0,eH.jsx)(e6H,{quantity:t,busy:a,pending:n,onReview:o}),d&&(0,eH.jsxs)("button",{className:"vm-catalog-bar-promotion",type:"button",disabled:a,"aria-disabled":a||n,"aria-label":u("catalogPromotion"),"aria-pressed":c,"aria-expanded":c,onClick:()=>{a||n||d()},children:[(0,eH.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,eH.jsx)("path",{d:"m6 18 12-12"}),(0,eH.jsx)("circle",{cx:"7",cy:"7",r:"3"}),(0,eH.jsx)("circle",{cx:"17",cy:"17",r:"3"})]}),(0,eH.jsx)("span",{children:u("catalogPromotion")})]})]})}function e6U(e){let{brand:t,active:l=!0,busy:i=!1,scannedCode:a="",onCodeChange:n,onFindSale:r,onBack:o}=e,{text:s}=eTp();return(0,eH.jsxs)("form",{className:`vm-redeem-screen vm-bottom-bar-layout${l?"":" vm-customer-paused"}`,"aria-busy":i,onSubmit:e=>{e.preventDefault();let t=a.trim();l&&!i&&t&&r(t)},children:[(0,eH.jsx)("header",{className:"vm-redeem-brand",children:(0,eH.jsx)(eTy,{name:t,compact:!0})}),(0,eH.jsx)("div",{className:"vm-redeem-heading",children:(0,eH.jsx)("h1",{children:s("redeemTitle")})}),(0,eH.jsxs)("div",{className:"vm-redeem-content",children:[(0,eH.jsx)("div",{className:"vm-redeem-code",children:(0,eH.jsxs)("div",{className:"vm-redeem-code-field",children:[(0,eH.jsxs)("svg",{className:"vm-redeem-keyboard-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,eH.jsx)("rect",{x:"2",y:"3",width:"20",height:"18",rx:"2"}),(0,eH.jsx)("path",{d:"M6 7h.01M10 7h.01M14 7h.01M18 7h.01M6 11h.01M10 11h.01M14 11h.01M18 11h.01M7 16h10"})]}),(0,eH.jsx)("input",{type:"text",value:a,disabled:!l||i,onChange:e=>n(e.target.value),inputMode:"text",enterKeyHint:"search",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,"aria-label":s("redeemCodeLabel"),placeholder:s("redeemCodePlaceholder")}),a&&(0,eH.jsx)("button",{type:"button",className:"vm-redeem-code-clear",disabled:!l||i,"aria-label":s("redeemClearCode"),onClick:()=>n(""),children:(0,eH.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]})}),(0,eH.jsx)("div",{className:"vm-redeem-divider",children:(0,eH.jsx)("span",{children:s("redeemOr")})}),(0,eH.jsxs)("div",{className:"vm-redeem-scanner-card",children:[(0,eH.jsxs)("div",{className:"vm-redeem-scanner-symbol","aria-hidden":"true",children:[(0,eH.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-tl"}),(0,eH.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-tr"}),(0,eH.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-bl"}),(0,eH.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-br"}),(0,eH.jsx)("span",{className:"vm-redeem-scanner-icon",children:(0,eH.jsx)(eTh,{name:"qr-code"})}),(0,eH.jsx)("span",{className:"vm-redeem-scan-line"})]}),(0,eH.jsxs)("div",{className:"vm-redeem-scanner-copy",children:[(0,eH.jsx)("p",{className:"vm-redeem-scanner-title",children:s("redeemScanPrompt")}),(0,eH.jsx)("p",{className:"vm-redeem-scanner-hint",children:s("redeemScannerLocation")})]}),(0,eH.jsxs)("ul",{className:"vm-redeem-code-types",children:[(0,eH.jsx)("li",{children:s("redeemTypeWristband")}),(0,eH.jsx)("li",{children:s("redeemTypeWallet")}),(0,eH.jsx)("li",{children:s("redeemTypeVoucher")}),(0,eH.jsx)("li",{children:s("redeemTypeReceipt")})]}),(0,eH.jsx)("span",{className:"vm-redeem-scanner-direction","aria-hidden":"true",children:(0,eH.jsx)(eTh,{name:"arrow-down"})})]})]}),(0,eH.jsx)(e6B,{busy:!l||i,onBack:o,primaryType:"submit",primaryDisabled:!a.trim(),primaryLabel:s("redeemContinue")})]})}let e6Y=e=>[...Array.isArray(e)?e:[]].sort((e,t)=>Number(e.sort||0)-Number(t.sort||0)),e6W=(e,t)=>JSON.stringify([String(e),String(t??0)]),e6K=e=>{var t,l;return!(null==(t=e.variant_group)?void 0:t.length)&&!(null==(l=e.variant)?void 0:l.length)};function e6G(e,t,l){let i=new Map,a=new Map;for(let t of e){let e={id:String(t.id),title:l(t.title_i18n)||l(t.title),subtitle:l(t.subtitle_i18n)||l(t.subtitle),cover:"string"==typeof t.cover?t.cover:void 0,rows:[]},n=e6K(t);for(let i of n?[{id:0}]:e6Y(t.variant)){let r=new Set(String(i.sku_ids||"").split("_")),o=e6Y(t.variant_group).map(e=>{var t,a,n;let o=null==(t=e.variant_item)?void 0:t.find(t=>r.has(`${e.id}:${t.id}`));return{name:l(e.name_i18n)||l(e.name),value:l(null==o?void 0:o.name_i18n)||l(null==o?void 0:o.name)||l((null==(a=i.title)?void 0:a[e.position_id])??(null==(n=i.name)?void 0:n[e.position_id])),enabled:l1(e)&&(!o||l1(o))}}),s=i.price??i.base_price??t.price,d={key:e6W(t.id,i.id),product:t,variant:i,label:n?e.title:o.map(e=>e.value).filter(Boolean).join(" \xb7 ")||l("string"==typeof i.title?i.title:i.code)||String(i.id),specification:o.filter(e=>e.value).map(e=>e.name?`${e.name}: ${e.value}`:e.value).join(", "),price:s,enabled:l1(t)&&l1(i)&&o.every(e=>e.enabled)&&null!=s&&Number.isFinite(Number(s))&&Number(s)>=0,items:[],quantity:0};a.has(d.key)||(a.set(d.key,d),e.rows.push(d))}e.rows.length&&i.set(e.id,e)}for(let e of t){var n,r;let t=e.product_variant_id??(null==(n=e.product_sku)?void 0:n.product_variant_id)??0,o=e6W(e.product_id,t),s=a.get(o);if(!s){let n=String(e.product_id),d=i.get(n);d||(d={id:n,title:l(e.product_title??e.title)||n,subtitle:"",rows:[]},i.set(n,d)),s={key:o,product:{id:e.product_id},variant:{id:t},label:l(e.product_option_string??(null==(r=e.product_sku)?void 0:r.product_option_string))||("0"===String(t)?d.title:String(t)),specification:"",price:e.selling_price??e.price??0,enabled:!1,items:[],quantity:0},d.rows.push(s),a.set(o,s)}s.items.push(e),s.quantity+=Number(e.num||0)}return[...i.values()]}function e6Q(e){var t;let{product:l,variant:i,specification:a,price:n}=e,r=e6K(l)&&"0"===String(i.id);if(!e.enabled||!r&&!(null==(t=l.variant)?void 0:t.some(e=>String(e.id)===String(i.id))))throw Error("Invalid vending SKU selection");let o=`${l.id}_${i.id}`;return{...l,product_variant_id:i.id,isOpenDetailModal:!1,_extend:{price:n},cartDetailValue:{key:o,rowKey:o,product_id:l.id,product_variant_id:i.id,production_code:(r?l.production_code:i.production_code)??"",product_option_string:a,price:n,quantity:1,option:[],bundle:[],session:null}}}function e6Z(e,t){let l=e.map(e=>{let l=e.product.variant_group,i={key:"ungrouped",label:"",dimensionName:"",ranks:[Number.MAX_SAFE_INTEGER],display:{row:e,label:e.label}};if(!Array.isArray(l)||0===l.length)return i;if(1===l.length)return{...i,display:{row:e,label:e.specification||e.label}};let a=new Set(String(e.variant.sku_ids||"").split("_")),n=l.map(l=>{var i,n;let r=[...l.variant_item||[]].sort((e,t)=>Number(e.sort||0)-Number(t.sort||0)),o=r.findIndex(e=>a.has(`${l.id}:${e.id}`)),s=r[o],d=t(null==s?void 0:s.name_i18n)||t(null==s?void 0:s.name)||t((null==(i=e.variant.title)?void 0:i[l.position_id])??(null==(n=e.variant.name)?void 0:n[l.position_id]));return{key:JSON.stringify([l.id,(null==s?void 0:s.id)??d]),name:t(l.name_i18n)||t(l.name),value:d,rank:o<0?Number.MAX_SAFE_INTEGER:o}}),[r,...o]=n;return r.value?{key:r.key,label:r.value,dimensionName:t(l[0].name_i18n)||t(l[0].name),ranks:n.map(e=>e.rank),display:{row:e,label:o.filter(e=>e.value).map(e=>e.name?`${e.name}: ${e.value}`:e.value).join(" \xb7 ")||e.label}}:i});l.sort((e,t)=>{for(let l=0;l<Math.max(e.ranks.length,t.ranks.length);l++){let i=(e.ranks[l]??Number.MAX_SAFE_INTEGER)-(t.ranks[l]??Number.MAX_SAFE_INTEGER);if(i)return i}return 0});let i=new Map;for(let e of l){let t=i.get(e.key);t||(t={key:e.key,label:e.label,dimensionName:e.dimensionName,rows:[]},i.set(e.key,t)),t.rows.push(e.display)}return[...i.values()]}function e6J(e){let{choices:t,busy:l,disabled:i,blocked:a,inventoryRefreshing:n,onChange:r}=e,{text:o,localized:s}=eTp(),d=new Map(t.map(e=>[e.row.key,e])),c=e6Z(t.map(e=>{let{row:t}=e;return t}),s);return(0,eH.jsx)("div",{className:"vm-voucher-sku-list","aria-busy":l,children:c.map(e=>{let t=e.label?"fieldset":"div";return(0,eH.jsxs)(t,{className:"vm-voucher-sku-group",role:e.label?"group":void 0,"aria-label":e.label||void 0,children:[e.label&&(0,eH.jsxs)("legend",{className:"vm-voucher-sku-group-title",children:[e.dimensionName&&(0,eH.jsx)("span",{className:"vm-sku-group-dimension",children:e.dimensionName}),(0,eH.jsx)("h3",{children:e.label})]}),(0,eH.jsx)("div",{className:"vm-voucher-sku-options",children:e.rows.map(t=>{let{row:s,label:c}=t,{quantity:u,maxQuantity:p,available:m,soldOut:g,loading:h,limitReason:v}=d.get(s.key),f=n||h,y=f?o("loading"):"stock"===v?o("catalogLimitReached"):null,b=(!m||g)&&!f,x=!i&&!a&&!f&&m&&!g&&u<p,k=e.label?"h4":"h3";return(0,eH.jsxs)("article",{className:`vm-voucher-sku-row${u>0?" is-selected":""}${!m||g?" is-unavailable":""}${b?" has-status-overlay":""}`,"aria-label":s.label,onClick:()=>{!l&&x&&r(s,u+1)},children:[(0,eH.jsx)("button",{type:"button",className:"vm-voucher-sku-add","aria-label":s.label,title:o("collectIncrease",{name:s.label}),disabled:!x,"aria-disabled":l||!x}),s.variant.cover?(0,eH.jsx)("img",{className:"vm-voucher-sku-image",src:s.variant.cover,alt:""}):(0,eH.jsx)("span",{className:"vm-voucher-sku-dot","aria-hidden":"true"}),(0,eH.jsxs)("div",{className:"vm-voucher-sku-label",children:[(0,eH.jsx)(k,{children:c}),!e.label&&s.specification&&c!==s.specification&&(0,eH.jsx)("p",{children:s.specification}),(0,eH.jsx)("p",{className:"vm-voucher-sku-status",role:y?"status":void 0,"aria-hidden":!y,children:y})]}),b&&(0,eH.jsx)(eI9,{label:o(g?"catalogSoldOut":"catalogUnavailableLabel")}),(0,eH.jsx)("div",{className:`vm-voucher-sku-quantity${b&&0===u?" is-hidden":""}`,role:"group","aria-label":s.label,"aria-hidden":b&&0===u,"aria-disabled":l||i,onClickCapture:e=>{(l||i)&&(e.preventDefault(),e.stopPropagation())},onClick:e=>e.stopPropagation(),children:(0,eH.jsx)(z8,{className:"vm-collect-stepper",keyboardClassName:"vm-quantity-keyboard",value:u,min:0,max:Math.max(u,a||f||!m||g?0:p),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:i,onChange:e=>{l||i||r(s,e)},minusIcon:(0,eH.jsx)("span",{"aria-label":o("collectDecrease",{name:s.label}),children:"−"}),plusIcon:(0,eH.jsx)("span",{"aria-label":o("collectIncrease",{name:s.label}),children:"+"})})})]},s.key)})})]},e.key)})})}function e6X(e){let{context:t,isActive:l,pending:i,errorMessage:a,onBusyChange:n}=e,r=(0,nY.useToast)(),o=eCw(),s=(0,eC.useRef)(!1),[d,c]=(0,eC.useState)(null),u=t.sales.bookingTicket,p=(0,eC.useRef)({ticket:u,isActive:l,revision:0});(p.current.ticket!==u||p.current.isActive!==l)&&(p.current={ticket:u,isActive:l,revision:p.current.revision+1}),(0,eC.useEffect)(()=>()=>{p.current.revision+=1},[]);let m=null!==d,g=!!(i||m||o.isProcessing||t.cart.consistencyPending||o.orderTransition.pending);(0,eC.useEffect)(()=>{n(l&&g)},[l,g,n]),(0,eC.useEffect)(()=>()=>n(!1),[n]);let h=o3(()=>{n(l&&!!(i||o.getIsProcessing()||t.cart.consistencyPending||o.getIsOrderTransitionPending()))}),v=o3(function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return l&&!s.current&&(!o.getIsProcessing()||e)&&!o.getIsPaymentProcessing()&&!o.getIsOrderTransitionPending()}),f=o3(async function(e){var l,i;let{key:d="cart",ownsActivityLock:m=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!v(m))return;s.current=!0;let g=p.current.revision,f=null==u||null==(i=u.getTempOrder)||null==(l=i.call(u))?void 0:l.order_id,y=()=>{var e,t;return p.current.isActive&&p.current.revision===g&&(null==u||null==(t=u.getTempOrder)||null==(e=t.call(u))?void 0:e.order_id)===f},b=o.begin();c(d),n(!0);try{if(await t.cart.waitForCartConsistency(),!y())return;await e(y),await t.cart.waitForCartConsistency()}catch(e){y()&&r.fail((null==e?void 0:e.message)||a)}finally{s.current=!1,b(),c(null),p.current.revision===g&&h()}}),y=o3(e=>{!g&&v()&&e()});return{activity:o,session:p,mutation:s,mutationKey:d,mutating:m,busy:g,canInteract:v,run:f,navigate:y}}let e60=e=>{var t,l,i,a,n;return!!((null==(t=e.option)?void 0:t.length)||(null==(l=e.options)?void 0:l.length)||e.option_group_count||(null==(i=e.bundle)?void 0:i.length)||(null==(a=e.bundle_groups)?void 0:a.length)||(null==(n=e.bundle_group)?void 0:n.length)||Number(e.open_sold_weight))},e62=e=>{var t,l;return!(null==(t=e.variant_group)?void 0:t.length)&&!(null==(l=e.variant)?void 0:l.length)&&!e60(e)};function e61(e,t){var l,i,a;if(e60(e))return!1;let n=null==(l=e.variant)?void 0:l.find(e=>String(e.id)===String(t));if(((null==(i=e.variant_group)?void 0:i.length)||(null==(a=e.variant)?void 0:a.length))&&!n)return!1;let r=(null==n?void 0:n.price)??(null==n?void 0:n.base_price)??e.price;return null!=r&&""!==String(r).trim()&&0===Number(r)}function e64(e){var t;let l=e.source;return"product-voucher"===e.kind&&!l.isEditMode&&!l.usageLimitFailKey&&!l.isDisabled&&(null==l.unified_available_status||""===l.unified_available_status||0!==Number(l.unified_available_status))&&(!l.reasonCode||["product_not_applicable","holder_not_matched"].includes(l.reasonCode))&&((null==(t=l.config)?void 0:t.isAvailable)!==!1||"product_not_applicable"===l.reasonCode)}function e63(e,t){let l=new Set(e.map(e=>String(e.id))),i=eMU(t).filter(e64).filter(e=>!l.has(String(e.id))&&(l.add(String(e.id)),!0));return i.length?[...e,...i.map(e=>e.source)]:e}function e68(e,t){let l=e.limited_relation_product_data;if(!l)return!1;let i=String(t.id);return!(1===Number(l.filter)&&(l.exclude_product_ids||[]).map(String).includes(i))&&("product_all"===l.type||["products","product_collection"].includes(l.type)&&(l.product_ids||[]).map(String).includes(i))}function e66(e){return[...new Set((e.discount_list||[]).filter(e=>"good_pass"===(e.type||e.tag)).map(e=>{var t;return null==(t=e.discount)?void 0:t.resource_id}).filter(e=>null!=e&&""!==String(e)).map(String))]}function e65(e){var t;let l=e.selling_price;return null!=l&&""!==String(l).trim()&&0===Number(l)&&!(null==(t=e.discount_list)?void 0:t.length)}function e67(e,t){let l=new Set(e.items.flatMap(e66));return e.vouchers.filter(e=>!l.has(String(e.id))&&e68(e.source,t))}function e69(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=new Map,a=new Set,n=new Set(l.flatMap(e66)),r=l.filter(e65);for(let l of eMU(e).filter(e64)){if(a.has(String(l.id)))continue;a.add(String(l.id));let e=l.source;if(!t.some(t=>e68(e,t))&&!n.has(String(l.id))&&!r.some(t=>e68(e,{id:t.product_id})))continue;let o=function(e){let t=e.product_id;return JSON.stringify(null==t||""===String(t)?["voucher",String(e.id)]:["product",String(t)])}(e),s=i.get(o);s||(s={key:o,title:l.title||Rz(e.product_name),vouchers:[],discountIds:[],quota:0,selected:0,freeQuantity:0,remaining:0,items:[],products:[]},i.set(o,s)),s.discountIds.push(l.id),s.vouchers.push(l),s.quota+=1}let o=new Set(r);for(let e of i.values()){e.products=t.filter(t=>e.vouchers.some(e=>e68(e.source,t)));let i=new Set(e.discountIds.map(String)),a=new Set;e.items=l.filter(t=>{let l=e66(t).filter(e=>i.has(e));return(l.forEach(e=>a.add(e)),o.has(t)&&e.vouchers.some(e=>e68(e.source,{id:t.product_id})))?(e.freeQuantity+=Number(t.num||0),!0):l.length>0}),e.selected=a.size,e.remaining=Math.max(0,e.quota-e.selected)}return[...i.values()].filter(e=>e.products.length>0||e.items.length>0)}function e5e(e){var t;let{brand:l,context:i,products:a,loading:n,isActive:r,inventoryFailed:o,inventoryRefreshing:s,checkoutPending:d,refreshInventory:c,onBack:u,onCheckout:p,onBusyChange:m,onActiveChange:g,autoSelectionRef:h}=e,{text:v,localized:f}=eTp(),y=(0,nY.useToast)();(0,eC.useEffect)(()=>(null==g||g(r),()=>null==g?void 0:g(!1)),[r,g]);let{inventory:b}=L2(),x=i.sales.bookingTicket,{activity:k,mutating:_,busy:w,canInteract:S,run:j,navigate:N}=e6X({context:i,isActive:r,onBusyChange:m,pending:n||!!d,errorMessage:v("collectInvalid")}),C=(null==x||null==(t=x.getTempOrder)?void 0:t.call(x))??i.cart.tempOrder,M=i.summary.summary??(null==C?void 0:C.summary),T=eC9({amountGap:null==M?void 0:M.amount_gap,fallbackAmount:null==M?void 0:M.total_amount,orderPaidAmount:null==M?void 0:M.order_paid_amount,payments:null==C?void 0:C.payments}),I=e69(i.cart.discountList,a,(null==C?void 0:C.products)||[]),P=!!(x&&i.cart.addProductWithFlow),A=!r||!P||n||!!d||k.orderTransition.pending,D=[...new Set(I.flatMap(e=>e.items))].filter(e65).reduce((e,t)=>e+Number(t.num||0),0),E=I.reduce((e,t)=>e+t.selected,D),O=I.reduce((e,t)=>e+t.remaining,0),z=((null==C?void 0:C.products)||[]).reduce((e,t)=>e+Number(t.num||0),0),L=I.reduce((e,t)=>e+t.quota,0),R=o3(()=>{var e,t,l,n;return e69((null==x||null==(e=x.getDiscountList)?void 0:e.call(x))||i.cart.discountList,a,(null==x||null==(l=x.getTempOrder)||null==(t=l.call(x))?void 0:t.products)||(null==(n=i.cart.tempOrder)?void 0:n.products)||[])}),$=o3((e,t)=>{let l=R().find(t=>t.key===e);return l?e67(l,t).length:0}),F=o3(async(e,t,l,a)=>{let n=R().find(t=>t.key===e);for(let r of n?e67(n,t).filter(e=>e.source.isManualSelect):[]){if(!a()||!n||n.selected>=l)return;await i.cart.setDiscount({discountId:r.id,isSelected:!0}),n=R().find(t=>t.key===e)}}),q=o3(function(e,t,l){var a,r,d;let c=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!P||n||o||s||!b)return 0;let u=(null==(a=(null==x||null==(r=x.getTempOrder)?void 0:r.call(x))??i.cart.tempOrder)?void 0:a.products)||[];return Math.max(0,...(void 0===l&&(null==(d=t.variant_group)?void 0:d.length)?t.variant||[]:[{id:l??0}]).map(l=>{let i=l.id??l.product_variant_id,a=b.selectionAvailability(t,i,u),n=c||e61(t,i)?1/0:$(e.key,t);return"ready"===a.availability.status?Math.min(a.availableQuantity,n):0}))}),B=(e,t,l)=>!A&&q(e,t,l)>0,H=o3(async(e,t,l,a)=>{let n=e61(t,t.product_variant_id),r=R().find(t=>t.key===e.key),o=await i.cart.addProductWithFlow(eMW(t),{type:"select",quantity:l,debounceMs:0,notShowToast:!0,getQuantityLimit:n?void 0:()=>$(e.key,t),initialHolderIds:[]});if("added"===o.status&&a()&&!n){let i=R().find(t=>t.key===e.key),n=Math.max(0,((null==i?void 0:i.freeQuantity)||0)-((null==r?void 0:r.freeQuantity)||0));await F(e.key,t,((null==r?void 0:r.selected)||0)+Math.max(0,l-n),a)}return o}),V=(0,eC.useRef)(null),U=h??V,Y=(null==C?void 0:C.external_sale_number)||(null==C?void 0:C.order_id);U.current&&U.current.ticket===x&&U.current.orderKey===Y||(U.current={ticket:x,orderKey:Y,handled:new Set});let W=(e,t)=>JSON.stringify([e.key,String(t)]),K=I.find(e=>{var t;if(1!==e.products.length||!e62(e.products[0]))return!1;let l=e.products[0],i=null==(t=e6G([l],[],f)[0])?void 0:t.rows[0];return(null==i?void 0:i.enabled)&&(null==b?void 0:b.selectionAvailability(l,0,(null==C?void 0:C.products)||[]).availability.status)==="ready"&&e.vouchers.some(t=>!U.current.handled.has(W(e,t.id)))});(0,eC.useEffect)(()=>{if(!K||!P||!r||w||o||s||!S())return;let e=U.current,t=new Set(K.vouchers.filter(t=>!e.handled.has(W(K,t.id))).map(e=>String(e.id)));t.forEach(t=>e.handled.add(W(K,t))),j(async e=>{var l,a,n;let r=R().find(e=>e.key===K.key);if(!r||1!==r.products.length||!e62(r.products[0]))return;let d=r.products[0],c=null==(l=e6G([d],[],f)[0])?void 0:l.rows[0],u=(null==(a=(null==x||null==(n=x.getTempOrder)?void 0:n.call(x))??i.cart.tempOrder)?void 0:a.products)||[];if(!(null==c?void 0:c.enabled)||o||s||(null==b?void 0:b.selectionAvailability(d,0,u).availability.status)!=="ready")return;let p=Math.min(e67(r,d).filter(e=>t.has(String(e.id))&&!e.source.isManualSelect).length,q(r,d,0),e61(d,0)?Math.max(0,r.quota-r.freeQuantity):1/0);if(p>0){let t=await H(r,e6Q(c),p,e);if(e()&&"added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}})},[K,P,r,w,o,s,b,S,j,R,f,x,i.cart,q,H,U,v]);let G=(e,t,l,a,n,r,o)=>{if(!P||w||!Number.isSafeInteger(a)||a<0)return;let s=l.map(e=>({item:e,uid:e_f(e).unique_identification_number})),d=e=>{var t,l;let{item:a,uid:n}=e;return((null==(t=(null==x||null==(l=x.getTempOrder)?void 0:l.call(x))??i.cart.tempOrder)?void 0:t.products)||[]).find(e=>null!=n&&""!==String(n)?e_f(e).unique_identification_number===n:e===a)};j(async l=>{let c=s.map(d).filter(Boolean),u=a-c.reduce((e,t)=>e+Number(t.num||0),0);if(u>0){var p,m;let a=!r&&c.length>0&&c.every(e65),s=c[c.length-1];if(!r&&!s)return;let d=R().find(t=>t.key===e.key),g=null==d?void 0:d.products.find(e=>String(e.id)===String(t.id));if(!n||!g||!d||u>q(d,g,(null==o?void 0:o.variant.id)??(null==s?void 0:s.product_variant_id)??0,a))throw Error(v("collectLimit"));if(r){let e=null==(p=e6G([g],[],f)[0])?void 0:p.rows.find(e=>o?e.key===o.key:"0"===String(e.variant.id));if(!(null==e?void 0:e.enabled))throw Error(v("catalogUnavailable"));let t=await H(d,e6Q(e),u,l);if(l()&&"added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}else{let n=(null==(m=R().find(t=>t.key===e.key))?void 0:m.selected)||0;await i.cart.updateItemQuantity(s,Number(s.num)+u),l()&&!a&&await F(e.key,t,n+u,l)}return}let g=-u;for(let e of[...s].reverse()){if(!l()||g<=0)return;let t=d(e);if(!t)continue;let a=Math.min(g,Number(t.num)),n=Number(t.num)-a;n<=0?await i.cart.removeItem(t):await i.cart.updateItemQuantity(t,n),g-=a,await i.cart.waitForCartConsistency()}})},Q=function(e,t,l,i,a){var n;let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=i.reduce((e,t)=>e+Number(t.num||0),0);return(0,eH.jsx)("div",{className:"vm-collect-selection-actions",role:"group","aria-label":e.trim(),"aria-disabled":w||A,onClickCapture:e=>{(w||A)&&(e.preventDefault(),e.stopPropagation())},children:(0,eH.jsx)(z8,{className:"vm-collect-stepper",keyboardClassName:"vm-quantity-keyboard",value:o,min:0,max:o+(a?q(t,l,(null==(n=i[0])?void 0:n.product_variant_id)??0,!r&&i.length>0&&i.every(e65)):0),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:A,onChange:e=>G(t,l,i,e,a,r),minusIcon:(0,eH.jsx)("span",{"aria-label":v("collectDecrease",{name:e.trim()}),children:"−"}),plusIcon:(0,eH.jsx)("span",{"aria-label":v("collectIncrease",{name:e.trim()}),children:"+"})})})};return(0,eH.jsxs)("div",{className:"vm-voucher-collect vm-bottom-bar-layout",children:[(0,eH.jsx)(eTv,{children:(0,eH.jsxs)("section",{className:"vm-collect-screen",children:[(0,eH.jsxs)("header",{className:"vm-collect-header",children:[(0,eH.jsx)(eTy,{name:l,compact:!0}),(0,eH.jsx)("h1",{children:v("collectTitle")}),(0,eH.jsx)("p",{className:"vm-collect-scan-hint",children:w&&!_?v("scanProcessing"):v("collectScanMore")})]}),(0,eH.jsxs)("div",{className:"vm-collect-scroll",children:[(0,eH.jsxs)("div",{className:"vm-collect-stats",children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("span",{children:v("collectAvailable")}),(0,eH.jsx)("strong",{children:L})]}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("span",{children:v("collectSelected")}),(0,eH.jsx)("strong",{children:E})]}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("span",{children:v("collectRemaining")}),(0,eH.jsx)("strong",{children:O})]})]}),(o&&!d||!P)&&(0,eH.jsxs)("div",{className:"vm-collect-warning",role:"status",children:[(0,eH.jsx)("span",{children:v(P?"inventoryUnavailable":"collectInvalid")}),o&&(0,eH.jsx)("button",{type:"button",disabled:A||s,"aria-disabled":w||s,onClick:()=>{w||j(c)},children:v("retry")})]}),n?(0,eH.jsx)("p",{className:"vm-collect-empty",role:"status",children:v("loading")}):0===I.length?(0,eH.jsx)("p",{className:"vm-collect-empty",role:"status",children:v("collectNoProducts")}):I.map(e=>{let t=e.items,l=e.selected+e.freeQuantity,i=new Set(e.products.map(e=>String(e.id))),n=new Map(e.products.map(e=>[String(e.id),e]));return t.forEach(e=>{var t;n.has(String(e.product_id))||n.set(String(e.product_id),{id:e.product_id,title:e.product_title,variant_group:Number(e.product_variant_id)>0?[{}]:[],option:null==(t=e.product_sku)?void 0:t.option,bundle:e.product_bundle})}),(0,eH.jsxs)("section",{className:"vm-collect-group",children:[(0,eH.jsxs)("header",{children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("h2",{children:e.title}),(0,eH.jsx)("p",{children:v("collectVoucherCount",{count:e.quota})})]}),(0,eH.jsx)("span",{children:v(e.freeQuantity>0?"collectSelectedCount":"collectGroupSelected",{selected:l,total:e.quota})})]}),[...n.values()].map(l=>{var n,r,d;let c=i.has(String(l.id)),u=Rz(l.title??l.name),p=function(e,t){let l=new Map;for(let n of e){var i,a;let e=JSON.stringify(function e(t){return Array.isArray(t)?t.map(e).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t))):t&&"object"==typeof t?Object.fromEntries(Object.keys(t).sort().map(l=>[l,e(t[l])])):t}({productId:n.product_id,variantId:n.product_variant_id??0,options:(null==(i=n.product_sku)?void 0:i.option)||(null==(a=n.product_sku)?void 0:a.options)||[],bundle:n.product_bundle||[]})),r=l.get(e)||{key:e,items:[],quantity:0,specification:ewG(n,t).product_option_string||""};r.items.push(n),r.quantity+=Number(n.num||0),l.set(e,r)}return[...l.values()]}(t.filter(e=>String(e.product_id)===String(l.id)),{productsCatalog:a,productsByUid:null==C||null==(n=C._extend)?void 0:n.productsByUid}),m=!!((null==(r=l.variant_group)?void 0:r.length)&&(null==(d=l.variant)?void 0:d.length)&&!e60(l)),g=!e62(l);return(0,eH.jsxs)("div",{className:`vm-collect-product${!g?" has-direct-quantity":""}`,children:[(0,eH.jsxs)("div",{className:"vm-collect-product-main",children:[(0,eH.jsx)("div",{children:(0,eH.jsx)("h3",{children:u})}),m?null:g?(0,eH.jsx)("button",{type:"button",className:"vm-collect-select",disabled:!c||!B(e,l),"aria-disabled":w||!c||!B(e,l),onClick:()=>{w||j(async t=>{if(1>q(e,l))throw Error(v("collectLimit"));return H(e,l,1,t)})},children:v("collectSelect")}):Q(u,e,l,p.flatMap(e=>e.items),c,!0)]}),m&&(0,eH.jsx)(e6J,{choices:function(e){var t;let{product:l,items:i,selectedItems:a,remaining:n,inventory:r,localize:o}=e;return((null==(t=e6G([l],a.filter(e=>String(e.product_id)===String(l.id)),o)[0])?void 0:t.rows)||[]).map(e=>{let t=null==r?void 0:r.selectionAvailability(l,e.variant.id,i),a=e.enabled&&(null==t?void 0:t.availability.status)==="ready",o=(null==t?void 0:t.availability.status)==="ready"&&0===t.availability.quantity,s=e61(l,e.variant.id);return{row:e,quantity:e.quantity,maxQuantity:e.quantity+(a?Math.max(0,Math.min(t.availableQuantity,s?1/0:n)):0),available:a,soldOut:o,loading:(null==t?void 0:t.availability.status)==="loading",limitReason:a&&!o?!s&&n<=0?"voucher":0===t.availableQuantity?"stock":void 0:void 0}})}({product:l,items:(null==C?void 0:C.products)||[],selectedItems:e.items,remaining:e67(e,l).length,inventory:b,localize:f}),busy:w,disabled:A,blocked:o||s||!b,inventoryRefreshing:s,onChange:(t,i)=>G(e,l,t.items,i,c&&t.enabled,!0,t)}),g&&!m&&p.map(t=>(0,eH.jsxs)("div",{className:"vm-collect-selection",children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("span",{className:"vm-collect-selection-dot"}),(0,eH.jsxs)("p",{children:[u,t.specification&&(0,eH.jsxs)("span",{children:[" \xb7 ",t.specification]})]})]}),Q(`${u} ${t.specification}`,e,l,t.items,c)]},t.key))]},l.id)})]},e.key)})]})]})}),(0,eH.jsx)(e6B,{busy:A,pending:w,onBack:()=>N(u),primaryLabel:v(0===T?"collectRedeem":"catalogCheckout"),primaryDisabled:n||!P||0===z||o||s,onPrimary:()=>N(()=>{var e,t;let l=(null==x||null==(e=x.getTempOrder)?void 0:e.call(x))??i.cart.tempOrder;(null==l||null==(t=l.products)?void 0:t.some(e=>Number(e.num)>0))?p():y.fail(v("catalogCartEmpty"))}),children:(0,eH.jsxs)("div",{className:"vm-catalog-bar-amount","aria-label":v(D>0?"collectSelectedCount":"collectGroupSelected",{selected:E,total:L}),children:[(0,eH.jsx)("span",{children:v("collectSelected")}),(0,eH.jsx)("strong",{children:D>0?E:`${E} / ${L}`})]})})]})}function e5t(){return(0,eH.jsx)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:(0,eH.jsx)("path",{d:"m12 3 9 5-9 5-9-5 9-5Zm9 5v9l-9 5-9-5V8m9 5v9M7.5 5.5l9 5"})})}function e5l(e){let{brand:t,context:l,products:i,loading:a,isActive:n,inventoryFailed:r,inventoryRefreshing:o,checkoutPending:s,refreshInventory:d,onBack:c,onReview:u,onCheckout:p,onBusyChange:m,onPromotion:g,promotionVisible:h}=e,{text:v,localized:f}=eTp(),y=(0,nY.useToast)(),{inventory:b}=L2(),x=!n||a||!l.sales.isReady||!!s,{activity:k,mutationKey:_,busy:w,run:S,navigate:j}=e6X({context:l,isActive:n,pending:x,onBusyChange:m,errorMessage:v("catalogUpdateFailed")}),N=l.sales.bookingTicket,C=(0,eC.useRef)(i);C.current=i;let M=eC3(l.sales,l.cart),T=(null==M?void 0:M.products)||[],I=e6G(i,T,f),P={groups:I,stocks:new Map(I.reduce((e,t)=>e.concat(t.rows),[]).map(e=>[e.key,null==b?void 0:b.selectionAvailability(e.product,e.variant.id,T)])),loading:a,inventoryFailed:r,inventoryRefreshing:o},A=(0,eC.useRef)({ticket:N,inventory:b,orderId:null==M?void 0:M.order_id,presentation:P});s&&A.current.ticket===N&&A.current.inventory===b&&A.current.orderId===(null==M?void 0:M.order_id)||(A.current={ticket:N,inventory:b,orderId:null==M?void 0:M.order_id,presentation:P});let D=A.current.presentation,E=T.reduce((e,t)=>e+Number(t.num||0),0),O=l.summary.summary??(null==M?void 0:M.summary),z=eC9({amountGap:null==O?void 0:O.amount_gap,fallbackAmount:null==O?void 0:O.total_amount,orderPaidAmount:null==O?void 0:O.order_paid_amount,payments:null==M?void 0:M.payments}),L=YP(M,z),R=x||k.orderTransition.pending,$=o3(function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"input";if(!w&&Number.isSafeInteger(t)&&!(t<0))return S(async a=>{var n,s,d,c;let u=(null==N||null==(s=N.getTempOrder)||null==(n=s.call(N))?void 0:n.products)||[],p=e6G(C.current,u,f).reduce((e,t)=>e.concat(t.rows),[]).find(t=>t.key===e.key);if(!p)return;let m="increase"===i?1:"decrease"===i?-1:t-p.quantity;if(m>0){let e=null==b?void 0:b.selectionAvailability(p.product,p.variant.id,u);if(!p.enabled||r||o||(null==e?void 0:e.availability.status)!=="ready"||e.availableQuantity<m)throw Error(v("catalogUnavailable"));let t=await l.cart.addProductWithFlow(e6Q(p),{type:"select",quantity:m,debounceMs:0,notShowToast:!0});if("added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}else if(m<0){let e=p.items.map(e=>({item:e,uid:e_f(e).unique_identification_number})),t=-m;for(let i of e.reverse()){if(!a()||t<=0)return;let e=((null==N||null==(c=N.getTempOrder)||null==(d=c.call(N))?void 0:d.products)||[]).find(e=>i.uid?e_f(e).unique_identification_number===i.uid:e===i.item);if(!e)continue;let n=Math.min(t,Number(e.num)),r=Number(e.num)-n;r<=0?await l.cart.removeItem(e):await l.cart.updateItemQuantity(e,r),t-=n,await l.cart.waitForCartConsistency()}}},{key:e.key})}),F=e=>j(()=>{var t;let i=eC3(l.sales,l.cart);(null==i||null==(t=i.products)?void 0:t.some(e=>Number(e.num)>0))?e():y.show({icon:"warning",content:v("catalogCartEmpty")})});return(0,eH.jsxs)("div",{className:"vm-catalog vm-bottom-bar-layout",children:[(0,eH.jsx)(eTv,{children:(0,eH.jsxs)("section",{className:"vm-catalog-screen","aria-label":v("catalogTitle"),children:[(0,eH.jsxs)("header",{className:"vm-catalog-header",children:[(0,eH.jsx)(eTy,{name:t,compact:!0}),(0,eH.jsx)("h1",{children:v("catalogTitle")}),(0,eH.jsx)("p",{children:v("catalogHint")})]}),(0,eH.jsxs)("div",{className:"vm-catalog-scroll","aria-busy":w||a||o,children:[D.inventoryFailed&&(0,eH.jsxs)("div",{className:"vm-catalog-warning",role:"alert",children:[(0,eH.jsx)("span",{children:v("inventoryUnavailable")}),(0,eH.jsx)("button",{type:"button",disabled:w||o,onClick:()=>{d()},children:v("retry")})]}),D.loading&&(0,eH.jsx)("p",{className:"vm-catalog-empty",role:"status",children:v("loading")}),!D.loading&&0===D.groups.length&&(0,eH.jsx)("p",{className:"vm-catalog-empty",children:v("catalogEmpty")}),D.groups.map(e=>(0,eH.jsxs)("section",{className:"vm-catalog-group","aria-label":e.title,children:[(0,eH.jsxs)("header",{children:[(0,eH.jsx)("span",{className:"vm-catalog-product-icon",children:e.cover?(0,eH.jsx)("img",{src:e.cover,alt:""}):(0,eH.jsx)(e5t,{})}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("h2",{children:e.title}),e.subtitle&&(0,eH.jsx)("p",{children:e.subtitle})]})]}),e6Z(e.rows,f).map(t=>{let l=t.label?"fieldset":"div";return(0,eH.jsxs)(l,{className:"vm-catalog-sku-group",role:t.label?"group":void 0,"aria-label":t.label||void 0,children:[t.label&&(0,eH.jsxs)("legend",{className:"vm-catalog-sku-group-title",children:[t.dimensionName&&(0,eH.jsx)("span",{className:"vm-sku-group-dimension",children:t.dimensionName}),(0,eH.jsx)("h3",{children:t.label})]}),(0,eH.jsx)("div",{className:"vm-catalog-grid",children:t.rows.map(l=>{let{row:i,label:n}=l,s=D.stocks.get(i.key),d=(null==s?void 0:s.availability.status)==="ready"&&0===s.availability.quantity,c=i.enabled&&(null==s?void 0:s.availability.status)==="ready",u=!a&&!r&&!o&&c&&s.availableQuantity>0,p=!c||d,m=D.inventoryRefreshing||(null==s?void 0:s.availability.status)==="loading",g=p&&!m,h=c&&!d&&!m&&0===s.availableQuantity,f="0"===String(i.variant.id)?e.title:`${e.title} \xb7 ${i.label}`,y=t.label?"h4":"h3";return(0,eH.jsxs)("article",{className:`vm-catalog-card${i.quantity>0?" is-selected":""}${p?" is-unavailable":""}${g?" has-status-overlay":""}`,"aria-label":f,onClick:()=>{u&&$(i,i.quantity+1,"increase")},children:[(0,eH.jsx)("button",{type:"button",className:"vm-catalog-card-add","aria-label":f,title:v("collectIncrease",{name:f}),disabled:R||!u,"aria-disabled":w||!u}),(0,eH.jsxs)("div",{className:"vm-catalog-card-heading",children:[(0,eH.jsx)(y,{children:n}),(0,eH.jsx)("strong",{children:YP(M,i.price)})]}),g&&(0,eH.jsx)(eI9,{label:v(d?"catalogSoldOut":"catalogUnavailableLabel")}),m&&(0,eH.jsx)("span",{className:"vm-catalog-stock-loading",role:"status",children:v("loading")}),(!p||i.quantity>0)&&(0,eH.jsxs)("div",{className:"vm-catalog-quantity",children:[(0,eH.jsx)("span",{children:h?v("catalogLimitReached"):v(i.quantity>0?"catalogAdded":"catalogQuantity")}),(0,eH.jsx)("div",{role:"group","aria-label":f,"aria-disabled":w,"aria-busy":_===i.key,onClick:e=>e.stopPropagation(),children:(0,eH.jsx)(z8,{className:"vm-catalog-stepper",keyboardClassName:"vm-quantity-keyboard",value:i.quantity,min:0,max:i.quantity+(u?s.availableQuantity:0),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:R,onChange:(e,t)=>{$(i,e,null==t?void 0:t.action)},minusIcon:(0,eH.jsx)("span",{"aria-label":v("collectDecrease",{name:f}),children:"−"}),plusIcon:(0,eH.jsx)("span",{"aria-label":v("collectIncrease",{name:f}),children:"+"})})})]})]},i.key)})})]},t.key)})]},e.id))]})]})}),(0,eH.jsx)(e6V,{quantity:E,total:L,amountDue:z,busy:R,pending:w,onBack:()=>j(c),onReview:()=>F(u),onCheckout:()=>F(p),onPromotion:g?()=>j(g):void 0,promotionVisible:h})]})}let e5i={en:{label:"Redeemed",fontSize:20,fontFamily:"Arial, sans-serif"},es:{label:"Canjeado",fontSize:21,fontFamily:"Arial, sans-serif"},ja:{label:"引換済み",fontSize:23,fontFamily:"Hiragino Sans, sans-serif"},"zh-CN":{label:"已兑换",fontSize:25,fontFamily:"PingFang SC, sans-serif"},"zh-TW":{label:"已兌換",fontSize:25,fontFamily:"PingFang TC, sans-serif"}};function e5a(){let e=dw().replace(/_/g,"-").toLowerCase(),t=e.split("-")[0],l="zh"===t?e5i[/^zh-(tw|hk|mo|hant)(-|$)/.test(e)?"zh-TW":"zh-CN"]:e5i[t]||e5i.en;return(0,eH.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"vm-voucher-redemption-stamp",viewBox:"0 0 128 128",width:128,height:128,role:"img","aria-label":l.label,focusable:"false",children:(0,eH.jsxs)("g",{transform:"rotate(-10 64 64)",children:[(0,eH.jsx)("circle",{cx:64,cy:64,r:60,fill:"none",stroke:"currentColor",strokeWidth:2.2}),(0,eH.jsx)("path",{d:"M52 46L61 55L77 38",fill:"none",stroke:"currentColor",strokeWidth:3.8,strokeLinecap:"round",strokeLinejoin:"round"}),(0,eH.jsx)("text",{x:64,y:92,textAnchor:"middle",fontFamily:l.fontFamily,fontSize:l.fontSize,fontWeight:600,fill:"currentColor",children:l.label})]})})}function e5n(){let{token:e}=eT.theme.useToken();return{colorPrimary:e.colorPrimary,colorPrimaryHover:e.colorPrimaryHover,colorPrimaryActive:e.colorPrimaryActive,colorPrimaryBg:e.colorPrimaryBg,colorPrimaryBgHover:e.colorPrimaryBgHover,colorPrimaryBorder:e.colorPrimaryBorder,colorTextLightSolid:e.colorTextLightSolid}}function e5r(){let e=e5n();return{"--vm-primary":e.colorPrimary,"--vm-primary-hover":e.colorPrimaryHover,"--vm-primary-active":e.colorPrimaryActive,"--vm-primary-bg":e.colorPrimaryBg,"--vm-primary-bg-hover":e.colorPrimaryBgHover,"--vm-primary-border":e.colorPrimaryBorder,"--vm-primary-foreground":e.colorTextLightSolid,"--vm-customer-page-bg":`linear-gradient(rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.96)), ${e.colorPrimary}`,"--vm-customer-soft-bg":`linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)), ${e.colorPrimary}`}}let e5o=0,e5s={cartItems:{renderProductLineItemStatus:function(e){return e66(e).length>0?(0,eH.jsx)(e5a,{}):null}}};function e5d(e){var t;let{flowMode:l="socks",context:i,sales:a,fulfillment:n,blockNavigation:r,scanSource:o,scanEnabled:s=!0,isActive:d=!0,isVisible:c=!0,idleRequest:u=0,homeIdleTimeoutMs:p=3e4,onHomePageActiveChange:m,onLocaleChange:g,brand:h,subtitle:v,machine:f,onRequestSettings:y,onRequestStaff:b,onPrerenderComplete:x,className:k,style:_}=e,w="retail"===l,{text:S}=eTp(),j=e5r(),N=(0,nY.useToast)(),C=(0,eC.useRef)(null),M=o3(()=>{var e;null==(e=C.current)||e.close(),C.current=null}),[T,I]=eT.Modal.useModal(),{setIdlePaused:P,shouldDispenseAfterSale:A,startDispenseQueue:D,isCurrentContext:E}=n,[O,z]=(0,eC.useState)("idle"),[L,R]=(0,eC.useState)({ready:!1,failed:!1}),[$,F]=(0,eC.useState)(!1),[q,B]=(0,eC.useState)(!1),[H,V]=(0,eC.useState)(!1),[U,Y]=(0,eC.useState)(null),W=(0,eC.useRef)(null),K=(0,eC.useCallback)(e=>{R(t=>t.ready===e.ready&&t.failed===e.failed?t:e)},[]),G=(0,eC.useMemo)(()=>({active:d&&c&&("idle"===O||"home"===O||"redeem"===O),onStateChange:K}),[d,c,O,K]),[Q,Z]=(0,eC.useState)("purchase"),[J,X]=(0,eC.useState)(!1),[ee,et]=(0,eC.useState)(!1),el=(0,eC.useRef)(!1),[ei,ea]=(0,eC.useState)(!1),en=(0,eC.useRef)(!1),[er,eo]=(0,eC.useState)(!1),es=(0,eC.useRef)(!1),[ed,ec]=(0,eC.useState)(!1),eu=(0,eC.useRef)(!1),ep=(0,eC.useCallback)(e=>{eu.current=e,ec(e)},[]),em=(0,eC.useCallback)(e=>{es.current=e,eo(e)},[]),eg=(0,eC.useCallback)(e=>{en.current=e,ea(e)},[]),eh=(0,eC.useCallback)(()=>{Z("purchase"),X(!1),eg(!1),em(!1)},[eg,em]),ev=o3(()=>{d&&c&&s&&!ee&&E(i)&&(!w||q)&&(B(!1),Z("purchase"),z("sale"))}),ef=o3(()=>{if(!d||!c||!s||ee||!a.ready||!L.ready||W.current||ey.getIsBusy())return;if(!a.inventory)return void ev();let e=new AbortController;W.current=e,F(!0),V(!1),a.inventory.refresh({reason:"catalog-entry",signal:e.signal}).then(()=>{!e.signal.aborted&&E(i)&&ev()}).catch(t=>{e.signal.aborted||(null==t?void 0:t.name)==="AbortError"||V(!0)}).finally(()=>{W.current===e&&(W.current=null,F(!1))})}),ey=function(e){let{context:t,scanSource:l,scanEnabled:i=!0,isActive:a,isVisible:n,fulfillment:r,stage:o,obscured:s,isObscured:d,onResolved:c}=e,[u,p]=(0,eC.useState)(null),[m,g]=(0,eC.useState)(""),h=(0,eC.useRef)(null),v=(0,eC.useRef)(!1),f=JSON.stringify([t.tenantDomain,t.shopId,t.deviceId,t.businessCode]),y=!!(a&&n),b=(0,eC.useRef)({scope:f,active:y});b.current={scope:f,active:y},(0,eC.useEffect)(()=>(v.current=!0,()=>{v.current=!1,h.current=null}),[]);let x=o3((e,t,i)=>{try{var a;null==l||null==(a=l.log)||a.call(l,e,{requestId:t.id,sourcePage:t.sourcePage,scope:t.scope,elapsedMs:Date.now()-t.receivedAt,status:null==i?void 0:i.status,kind:null==i?void 0:i.kind,reason:null==i?void 0:i.reason})}catch{}}),k=o3(e=>{h.current=e,p(e)}),_=o3(()=>{h.current&&x("cancelled",h.current),k(null),g("")});(0,eC.useLayoutEffect)(()=>{(!y||h.current&&h.current.scope!==f)&&_()},[y,f,_]);let w=o3(e=>{if(!y||!i||d()||!r.isCurrentContext(t))return;let l="string"==typeof(null==e?void 0:e.data)?e.data.trim():"";if(!l||h.current||"idle"!==o&&"home"!==o&&"redeem"!==o)return;let a={id:`vending-scan-${Date.now()}-${++e5o}`,code:l,sourcePage:o,scope:f,receivedAt:Date.now(),phase:"waiting"};k(a),"redeem"===o&&g(l),x("received",a),r.setIdlePaused(!0)}),S=y&&i&&!s&&("idle"===o||"home"===o||"redeem"===o||"sale"===o&&!!u),j=!!u;(0,eC.useEffect)(()=>{if(S&&l)return l.subscribe(w,{priority:10*!!j})},[S,l,j,w]);let N=e=>{let l=h.current;return v.current&&b.current.active&&(null==l?void 0:l.id)===e&&l.scope===b.current.scope&&r.isCurrentContext(t)?l:null},C=o3(e=>{let t=N(e);t&&"waiting"===t.phase&&(k({...t,phase:"processing"}),x("accepted",t))}),M=o3((e,t)=>{var l;let i=N(e);if(!i)return;let a="success"===t.status&&["customer","promotion"].includes(t.kind||"")&&!Array.isArray(null==(l=t.redemption)?void 0:l.vouchers)?{status:"failed",reason:"entry_resolution_failed"}:t;x("settled",i,a),c(a),k(null)}),T=o3(()=>!!h.current);return{pending:u,scannedCode:m,setScannedCode:g,submitCode:o3(e=>w({data:e})),busy:!!u,getIsBusy:T,clear:_,accepted:C,settled:M}}({context:i,scanSource:o,scanEnabled:s&&!w,isActive:d,isVisible:c,fulfillment:n,stage:O,obscured:ee||$,isObscured:()=>el.current||!!W.current,onResolved:o3(e=>{M();let t=function(e){var t,l,i;if("cancelled"===e.status)return{destination:"stay",vouchers:[]};if(["initialization_failed","order_reset_failed","entry_resolution_failed","scan_failed"].includes(e.reason||""))return{destination:"stay",vouchers:[],notice:"scanResolveFailed"};let a=(null==(t=e.redemption)?void 0:t.vouchers)||[],n="success"===e.status?e63([],a):[];if(n.length)return{destination:"redeem",vouchers:n};if("success"===e.status&&((null==(l=e.redemption)?void 0:l.source)==="wallet"||"products"===e.kind)||"pending"===e.status&&["requiresDetail","requiresBookingEdit"].includes(e.kind||""))return{destination:"purchase",vouchers:[]};let r=a.filter(e=>"good_pass"===(e.tag||e.type)),o=r.map(e=>e.reasonCode);return{destination:"stay",vouchers:[],notice:o.length&&o.every(e=>"not_started"===e)?"scanVoucherNotStarted":o.length&&o.every(e=>"expired"===e)?"scanVoucherExpired":r.length?"scanVoucherUnavailable":(null==(i=e.redemption)?void 0:i.source)==="scan"?"scanNoVouchers":"scanUnrecognized"}}(e);if("redeem"===t.destination)Z("vouchers"),z("sale");else if("purchase"===t.destination)Z("purchase"),z("sale");else if(t.notice){let e=Symbol();Y(e),N.show({icon:"warning",content:S(t.notice),afterClose:()=>Y(t=>t===e?null:t)})}})}),eb=a.ready&&L.ready&&!$&&!H,ex=a.failed||L.failed||H,ek=w&&d&&c&&s&&!ee&&"idle"===O,e_=o3(()=>{R({ready:!1,failed:!1}),V(!1),a.retry()}),ew=o3(()=>{ek&&(!q||ex)&&(ex&&e_(),B(!0))});(0,eC.useLayoutEffect)(()=>{var e;w&&!ek&&(B(!1),null==(e=W.current)||e.abort(),W.current=null,F(!1))},[w,ek]),(0,eC.useEffect)(()=>{ek&&q&&eb&&ef()},[ek,q,eb,ef]);let eS=d&&c&&ey.busy,ej=d&&c&&("home"===O||w&&"idle"===O&&q)&&s&&!ee&&!eb&&!ex&&!U,eN=eS?S("scanProcessing"):ej?S("homePreparing"):null,eM=o3(()=>{eN&&(!eS||ey.getIsBusy())&&(eS&&Y(null),C.current=N.loading(eN,0))});(0,eC.useEffect)(()=>{if(eN)return eM(),M},[eN,eM,M]);let eI=o3(e=>{if(!d||!c||"sale"!==O||"vouchers"!==Q||!J||ey.pending||!E(i))return;let t=e.scannedDiscountList||[];if(!(e.isAccepted??e.isAvailable)||!e63([],t).length){let e=t.some(e=>"good_pass"===(e.tag||e.type));N.fail(S(e?"collectInvalid":"collectUnsupported"))}}),eP=(0,eC.useRef)(null),eA=o3(e=>{let t={...e,isActive:e.isActive&&"sale"===O};return"vouchers"===Q?(0,eH.jsx)(e5e,{...t,brand:h,autoSelectionRef:eP,onActiveChange:X,onBusyChange:eg,onPurchase:()=>{ey.getIsBusy()||en.current||es.current||Z("purchase")}}):(0,eH.jsx)(e5l,{...t,brand:h,onBusyChange:em})});(0,eC.useEffect)(()=>{var e;a.failed&&(null==(e=ey.pending)?void 0:e.phase)==="waiting"&&ey.settled(ey.pending.id,{status:"failed",reason:"initialization_failed"})},[a.failed,ey.pending,ey.settled]);let[eD,eE]=(0,eC.useState)(null),[eO,ez]=(0,eC.useState)(null),[eL,eR]=(0,eC.useState)(!1),[e$,eF]=(0,eC.useState)(10),eq=(0,eC.useRef)(!0),eB=(0,eC.useRef)(d);eB.current=d&&c;let eV=(0,eC.useRef)([]),eU=(0,eC.useRef)(null),eY=(0,eC.useRef)(null),eW=(0,eC.useCallback)(()=>{var e,t;null==(e=eY.current)||e.call(eY),eY.current=null,null==(t=eU.current)||t.cancel(),eU.current=null},[]),eK=(0,eC.useCallback)(e=>{var t,l;ey.getIsBusy()||en.current||es.current||eu.current||(ey.clear(),eh(),B(!1),null==(t=W.current)||t.abort(),W.current=null,F(!1),eE(null),ez(null),eR(!1),z(e),eV.current=[],null==(l=eY.current)||l.call(eY),eY.current=null,P(!1))},[P,ey.clear,ey.getIsBusy,eh]),eG=(0,eC.useCallback)(()=>eK("idle"),[eK]),eQ=(0,eC.useCallback)(()=>eK(w?"idle":"home"),[w,eK]),eZ=(0,eC.useRef)(u);(0,eC.useEffect)(()=>{eZ.current!==u&&(eZ.current=u,eG())},[u,eG]),(0,eC.useEffect)(()=>(eq.current=!0,()=>{eq.current=!1,eW(),P(!1)}),[P,eW]),(0,eC.useEffect)(()=>{d||(ey.clear(),eh(),eW(),eG())},[d,eG,eW,ey.clear,eh]),(0,eC.useEffect)(()=>{c||"sale"!==O||"vouchers"!==Q||(ey.clear(),eh(),eG())},[c,O,Q,ey.clear,eh,eG]);let eJ=JSON.stringify([i.tenantDomain,i.shopId,i.deviceId,i.businessCode]);(0,eC.useEffect)(()=>()=>{var e;null==(e=W.current)||e.abort(),W.current=null,F(!1)},[d,c,eJ,O]),(0,eC.useEffect)(()=>{a.ready||(R({ready:!1,failed:!1}),V(!1))},[a.ready]);let eX=(0,eC.useRef)(eJ);(0,eC.useEffect)(()=>{eX.current!==eJ&&(eX.current=eJ,ey.clear(),eh(),"sale"===O&&eG())},[eJ,O,ey.clear,eh,eG]);let e0=(0,eC.useRef)(!1);(0,eC.useEffect)(()=>{e0.current||(e0.current=!0,null==x||x())},[x]);let e2=(0,eC.useCallback)(e=>{let t=(0,no.cloneDeep)(e),l={snapshot:t,isRedemption:"vouchers"===Q},a={...i,businessCode:e.businessCode||i.businessCode},n=()=>eq.current&&eB.current&&E(i);return(async()=>{if(!n())return!0;try{var e;if(!await A(a))return!1;if(!n()||(eE(l),ez(null),eR(!1),z("dispense"),await P(!0),!n()))return!0;let i=D(t,a);eU.current=i;let r=!1,o=e=>{n()&&(ez(e),"running"===e.status||r||(r=!0,eF(10),z("result")))};null==(e=eY.current)||e.call(eY),eY.current=i.subscribe(o),o(i.getSnapshot())}catch{n()&&(eE(l),eR(!0),z("result"))}return!0})()},[Q,i,E,P,A,D]),e1="dispense"===O||"result"===O,e4=e1||ey.busy||ei||er||ed||!w&&$,e3=e4||$||w&&q&&!ex;(0,eC.useEffect)(()=>{if(P(d&&c&&e3),d&&c&&e4)return null==r?void 0:r(()=>!1)},[r,d,c,e4,e3,P]);let e8="result"===O&&!eL&&(null==eO?void 0:eO.status)==="complete"&&eO.items.length>0&&eO.items.every(e=>"success"===e.status);(0,eC.useEffect)(()=>{if(!e8||!d||!c)return;let e=window.setInterval(()=>eF(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[e8,d,c]),(0,eC.useEffect)(()=>{e8&&0===e$&&eG()},[e8,e$,eG]);let e6="idle"===O||"home"===O,e5=d&&c&&e6;(0,eC.useLayoutEffect)(()=>(null==m||m(e5),()=>null==m?void 0:m(!1)),[e5,m]);let e7=e5&&"home"===O&&s&&!ey.busy&&!ee&&!$;(0,eC.useEffect)(()=>{let e;if(!e7)return;let t=Number.isFinite(p)&&p>0?p:3e4,l=()=>{window.clearTimeout(e),e=window.setTimeout(eG,t)},i=["pointerdown","pointermove","touchstart","touchmove","keydown","wheel","click"];return i.forEach(e=>document.addEventListener(e,l,{capture:!0,passive:!0})),l(),()=>{window.clearTimeout(e),i.forEach(e=>document.removeEventListener(e,l,!0))}},[e7,p,eG]);let e9=(null==(t=ey.pending)?void 0:t.phase)==="processing",te="sale"===O||!!ey.pending,tt="sale"===O&&!a.ready,tl=a.failed;return(0,eH.jsxs)("main",{className:["vm-app",k].filter(Boolean).join(" "),style:{...j,..._},children:[I,e6&&(0,eH.jsx)(eTv,{children:"idle"===O?(0,eH.jsx)(eTk,{enableResponsiveScaling:!0,technicalSupportBarProps:{enableResponsiveScaling:!0},brand:h,subtitle:v,flowMode:l,active:d&&c,busy:w&&q&&!ex,failed:w&&ex,onStart:w?ew:()=>{ey.getIsBusy()||z("home")},onRetry:w?ew:void 0,onRequestSettings:()=>{ey.getIsBusy()||y()}}):(0,eH.jsx)(eT_,{brand:h,machine:f,locale:i.locale,languageDisabled:!s||ey.busy||ee||$,onLocaleChange:g?e=>{d&&c&&s&&!ey.getIsBusy()&&!ee&&!$&&g(e)}:void 0,active:d&&c,ready:eb,failed:ex,onBuy:()=>{ey.getIsBusy()||ef()},onRedeem:()=>{ey.getIsBusy()||z("redeem")},onRetry:e_,onHelp:()=>{ey.getIsBusy()||(el.current=!0,et(!0),T.info({title:S("help"),content:S("contact"),okText:S("done"),className:"vm-dialog",wrapClassName:"vm-dialog-wrap",centered:!0,afterClose:()=>{el.current=!1,et(!1)}}))},onRequestSettings:()=>{ey.getIsBusy()||y()},onStaffTap:()=>{if(ey.getIsBusy())return;let e=Date.now();eV.current=[...eV.current.filter(t=>e-t<3e3),e],eV.current.length>=5&&(eV.current=[],b())}})}),"redeem"===O&&(0,eH.jsx)(eTv,{children:(0,eH.jsx)(e6U,{brand:h,active:d&&c&&s&&!ee,busy:ey.busy,scannedCode:ey.scannedCode,onCodeChange:ey.setScannedCode,onFindSale:ey.submitCode,onBack:eQ})}),tt&&(0,eH.jsx)(eTv,{children:(0,eH.jsxs)("section",{className:`vm-scan-start${d&&c?"":" vm-customer-paused"}`,children:[(0,eH.jsx)("header",{className:"vm-customer-home-header",children:(0,eH.jsx)(eTy,{name:h,compact:!0})}),(0,eH.jsx)("div",{className:"vm-scan-start-content",children:(0,eH.jsxs)("div",{className:"vm-scan-start-card",role:"status","aria-live":"polite","aria-atomic":"true",children:[(0,eH.jsx)("div",{className:"vm-scan-start-symbol","aria-hidden":"true",children:(0,eH.jsx)(eTh,{name:tl?"circle-alert":"loader-circle"})}),(0,eH.jsx)("h1",{children:S(tl?"scanPrepareFailed":"scanPreparing")}),(0,eH.jsx)("p",{children:S(tl?"scanPrepareFailedHint":"scanPreparingHint")})]})}),(0,eH.jsxs)("footer",{className:"vm-scan-start-actions",children:[(0,eH.jsxs)("button",{type:"button",className:"vm-scan-start-button",disabled:e9,onClick:()=>{ey.clear(),z(w?"idle":"home")},children:[(0,eH.jsx)(eTh,{name:"arrow-left"}),S("back")]}),tl&&(0,eH.jsx)("button",{type:"button",className:"vm-scan-start-button vm-scan-start-retry",onClick:()=>{a.retry()},children:S("retry")})]})]})}),a.ready&&(0,eH.jsx)("div",{className:"vm-sales",hidden:"sale"!==O||tt,children:(0,eH.jsx)(e6q,{mode:"retail",template:"kiosk",lifecycleOwner:"provider",destroyOnUnmount:!1,selectionFlowScene:"product-selection",saleDetailTemplate:"A",saleDetailModuleConfig:e5s,autoCreate:!1,enableGlobalScanListener:"sale"===O&&s&&!ee,scanRequest:s&&!ee&&ey.pending||void 0,onScanRequestAccepted:ey.accepted,onScanRequestSettled:ey.settled,onScanPromotionResult:eI,scanScope:w?"all":ey.pending?"product-voucher-collection":"vouchers"===Q&&J?"product-voucher":"all",renderCatalog:w?void 0:eA,catalogPreparation:G,onPaymentPageActiveChange:ep,mergeBookingLinesForDisplay:!1,style:{height:"100%",minHeight:0},businessCode:i.businessCode,osModuleName:a.osModuleName,otherParams:a.otherParams,inventory:a.inventory,catalogScope:a.catalogScope,checkoutHooks:a.checkoutHooks,locale:i.locale,isActive:d&&c&&te,enableTempOrderPersist:!1,onPaidCheckout:e2,onRequestHome:e=>{"catalog-back"===e?eQ():eG()}})}),e1&&(0,eH.jsx)(eTv,{children:(0,eH.jsx)(eTN,{enableResponsiveScaling:!0,brand:h,sale:(null==eD?void 0:eD.snapshot)??null,isRedemption:(null==eD?void 0:eD.isRedemption)??!1,progress:eO,error:eL,stage:O,seconds:e$,onHome:eG})})]})}function e5c(e){let{context:t,onLocaleChange:l}=e,[i,a]=(0,eC.useState)(t.locale||"en");(0,eC.useEffect)(()=>{a(t.locale||"en")},[t.locale,t.tenantDomain,t.businessCode,t.shopId,t.deviceId]);let n=(0,eC.useMemo)(()=>({...t,locale:i}),[t,i]),r=(0,eC.useCallback)(e=>{e!==i&&(null==l||l(e),a(e))},[i,l]);return(0,eH.jsx)(d_,{value:i,children:(0,eH.jsx)(eTf.Provider,{value:e.brandLogo,children:(0,eH.jsx)(e5d,{...e,context:n,onLocaleChange:r},JSON.stringify([t.tenantDomain,t.businessCode,t.shopId,t.deviceId,e.flowMode||"socks"]))})})}function e5u(e){let{brand:t,machine:l,staff:i,onSignOut:a}=e,{text:n}=eTp();return(0,eH.jsxs)("header",{className:"vm-topbar vm-topbar-staff",children:[(0,eH.jsxs)("div",{children:[(0,eH.jsxs)("strong",{children:[(0,eH.jsx)(Ea,{}),l]}),(0,eH.jsx)("small",{children:t})]}),i&&(0,eH.jsxs)("button",{className:"vm-staff-badge",onClick:a,"aria-label":n("signOut"),children:[(0,eH.jsx)("span",{children:i.name.slice(0,2)}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("strong",{children:i.name}),(0,eH.jsx)("small",{children:n("signOut")})]})]})]})}function e5p(e){let{changes:t,products:l,channelLabel:i}=e,{text:a,localized:n}=eTp(),r=(0,eC.useMemo)(()=>new Map(l.map(e=>[e.id,e])),[l]),o=(0,eC.useMemo)(()=>{let e=new Map;for(let l of t){let t=void 0===l.before.spaceId?`channel:${l.channelId}`:`space:${l.before.spaceId}`,i=e.get(t)||[];i.push(l),e.set(t,i)}let l=[];for(let[t,i]of e){let{before:e,after:a}=i[0],n=i.map(e=>e.before);e.productId===a.productId?e.productId&&l.push({key:t,channels:n,productId:e.productId,before:e.quantity,after:a.quantity}):(e.productId&&l.push({key:`${t}:out`,channels:n,productId:e.productId,binding:"removed",before:e.quantity,after:0}),a.productId&&l.push({key:`${t}:in`,channels:n,productId:a.productId,binding:"added",before:0,after:a.quantity}))}return l},[t]),s=(0,eC.useMemo)(()=>{let e=new Map;for(let t of o){let l=e.get(t.productId)||{productId:t.productId,added:0,removed:0},i=t.after-t.before;l.added+=Math.max(0,i),l.removed+=Math.max(0,-i),e.set(t.productId,l)}return[...e.values()]},[o]),d=s.reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),c=e=>{var t,l,i;return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)("strong",{children:n(null==(t=r.get(e))?void 0:t.title)||(null==(l=r.get(e))?void 0:l.sku)||e}),(0,eH.jsx)("span",{className:"vm-review-sku",children:(null==(i=r.get(e))?void 0:i.sku)||"—"})]})};return(0,eH.jsxs)("div",{className:"vm-restock-review",children:[(0,eH.jsx)("p",{children:a("reviewDescription")}),(0,eH.jsx)("div",{className:"vm-review-table-scroll",children:(0,eH.jsxs)("table",{className:"vm-review-table",children:[(0,eH.jsx)("caption",{children:a("reviewDetails")}),(0,eH.jsx)("thead",{children:(0,eH.jsxs)("tr",{children:[(0,eH.jsx)("th",{children:a("channel")}),(0,eH.jsx)("th",{children:a("product")}),(0,eH.jsx)("th",{children:a("reviewBefore")}),(0,eH.jsx)("th",{children:a("quantityAfter")}),(0,eH.jsx)("th",{children:a("reviewDelta")})]})}),(0,eH.jsx)("tbody",{children:o.map(e=>{let t=e.after-e.before;return(0,eH.jsxs)("tr",{children:[(0,eH.jsx)("td",{children:e.channels.map(e=>(0,eH.jsx)("div",{children:i(e)},e.id))}),(0,eH.jsxs)("td",{children:[c(e.productId),e.binding&&(0,eH.jsx)("span",{className:"vm-review-binding",children:a("removed"===e.binding?"reviewProductRemoved":"reviewProductAdded")})]}),(0,eH.jsx)("td",{children:e.before}),(0,eH.jsx)("td",{children:e.after}),(0,eH.jsxs)("td",{className:t>0?"vm-review-added":t<0?"vm-review-removed":"",children:[t>0?"+":"",t]})]},e.key)})})]})}),(0,eH.jsx)("div",{className:"vm-review-table-scroll",children:(0,eH.jsxs)("table",{className:"vm-review-table vm-review-summary",children:[(0,eH.jsx)("caption",{children:a("reviewSummary")}),(0,eH.jsx)("thead",{children:(0,eH.jsxs)("tr",{children:[(0,eH.jsx)("th",{children:a("product")}),(0,eH.jsx)("th",{children:a("reviewAdded")}),(0,eH.jsx)("th",{children:a("reviewRemoved")})]})}),(0,eH.jsx)("tbody",{children:s.map(e=>(0,eH.jsxs)("tr",{children:[(0,eH.jsx)("td",{children:c(e.productId)}),(0,eH.jsxs)("td",{className:"vm-review-added",children:["+",e.added]}),(0,eH.jsxs)("td",{className:"vm-review-removed",children:["−",e.removed]})]},e.productId))})]})}),(0,eH.jsx)("p",{className:"vm-review-totals",children:a("reviewTotals",d)})]})}let e5m=e=>({productId:e.productId,quantity:null===e.quantity?"":String(e.quantity)}),e5g=(e,t)=>t.productId!==e.productId||(null===e.quantity?""!==t.quantity:""===t.quantity.trim()||Number(t.quantity)!==e.quantity),e5h=e=>"enabled"===e.status&&!e.issue&&null!==e.quantity,e5v=(e,t)=>e5h(e)&&""!==t.quantity.trim()&&Number.isSafeInteger(Number(t.quantity))&&Number(t.quantity)>=0&&Number(t.quantity)<=e.capacity&&(null!==t.productId||0===Number(t.quantity));function e5f(e){let{context:t,staff:l,onBack:i,setLeaveGuard:a,service:n,blockNavigation:r}=e,{text:o,localized:s}=eTp(),[d,c]=eT.Modal.useModal(),[u,p]=(0,eC.useState)(null),[m,g]=(0,eC.useState)({}),[h,v]=(0,eC.useState)(!0),[f,y]=(0,eC.useState)(!1),[b,x]=(0,eC.useState)(""),[k,_]=(0,eC.useState)(!1),[w,S]=(0,eC.useState)(""),[j,N]=(0,eC.useState)(),[C,M]=(0,eC.useState)(!1),[T,I]=(0,eC.useState)(null),P=(0,eC.useRef)(null),[A,D]=(0,eC.useState)(null),[E,O]=(0,eC.useState)({}),z=(0,eC.useRef)(null),L=(0,eC.useRef)(null),R=(0,eC.useRef)(!1),$=(0,eC.useRef)(!0),F=(0,eC.useRef)(t);F.current=t;let q=(0,eC.useRef)(!1),B=(0,eC.useRef)(null),H=C||null!==T||null!==A,V=(0,eC.useCallback)(async()=>{var e,t;null==(e=L.current)||e.abort(),null==(t=z.current)||t.abort(),z.current=null,D(null),O({}),P.current=null,I(null);let l=new AbortController;L.current=l,v(!0),y(!1),x("");try{let e=await n.load(F.current,l.signal);if(l.signal.aborted)return;p(e),N(e.inventorySync),g({}),_(!1),S("")}catch(e){l.signal.aborted||(y(!0),x(e instanceof Error?e.message:""))}finally{l.signal.aborted||v(!1)}},[t.tenantDomain,t.businessCode,t.shopId,t.deviceId,n]);(0,eC.useEffect)(()=>($.current=!0,V(),()=>{var e,t;$.current=!1,null==(e=L.current)||e.abort(),null==(t=z.current)||t.abort(),P.current=null}),[V]);let U=e=>m[e.id]||e5m(e),Y=((null==u?void 0:u.channels)||[]).filter(e=>e5g(e,U(e)));q.current=Y.length>0;let W=Y.some(e=>!e5v(e,U(e))),K=(0,eC.useMemo)(()=>new Map(null==u?void 0:u.products.map(e=>[e.id,e])),[null==u?void 0:u.products]),G=(0,eC.useMemo)(()=>[{value:"",label:o("noProduct"),disabled:!1},...((null==u?void 0:u.products)||[]).map(e=>({value:e.id,label:s(e.title)||e.sku||e.id,disabled:!!e.disabled}))],[null==u?void 0:u.products,s,o]),Q=(null==u?void 0:u.groupType)==="board"?"board":"row",Z=e=>s(e.groupName)||e.row,J=e=>`${o(Q)} ${Z(e)} \xb7 ${o("editChannel",{code:e.code})}`,X=function(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:U(e);return e5h(e)&&!!l.productId&&K.has(l.productId)&&!(null==(t=K.get(l.productId))?void 0:t.disabled)},ee=(0,eC.useCallback)(()=>{let e;if(R.current||P.current||z.current)return Promise.resolve(!1);if(!q.current)return Promise.resolve(!0);if(B.current)return B.current.promise;let t=new Promise(t=>{e=t}),l=d.confirm({title:o("discardTitle"),content:o("discardDescription"),okText:o("discard"),cancelText:o("keepEditing"),className:"vm-dialog",wrapClassName:"vm-dialog-wrap",centered:!0,onOk:()=>{B.current=null,e(!0)},onCancel:()=>{B.current=null,e(!1)}});return B.current={promise:t,close:()=>{l.destroy(),e(!1)}},t},[d,o]);(0,eC.useEffect)(()=>{a(ee);let e=e=>{(q.current||R.current||z.current)&&(e.preventDefault(),e.returnValue="")};window.addEventListener("beforeunload",e);let t=null==r?void 0:r(()=>!R.current&&!P.current&&!z.current&&(q.current?o("discardDescription"):void 0));return()=>{var l;a(null),null==t||t(),window.removeEventListener("beforeunload",e),null==(l=B.current)||l.close(),B.current=null}},[r,ee,a,o]);let et=(e,t)=>{!R.current&&!P.current&&!z.current&&e5h(e)&&(_(!1),g(l=>{let i={...l};for(let a of(null==u?void 0:u.channels)||[])e5h(a)&&(a.id===e.id||void 0!==e.spaceId&&a.spaceId===e.spaceId)&&(i[a.id]={...l[a.id]||e5m(a),...t});return i}))},el=async()=>{var e;let i=P.current;if(!u||!1===u.canSubmit||R.current||z.current||!(null==i?void 0:i.length))return;R.current=!0,M(!0),_(!1),S(""),null==(e=L.current)||e.abort();let a=new AbortController;L.current=a;try{let e=await n.submit(t,i,l,a.signal);if(a.signal.aborted)return;let r=!e||"accepted"===e.status||"synced"===e.status;if(e&&"accepted"===e.status)p(e.data),N(e.data.inventorySync);else{let t=new Map(i.map(e=>[e.channelId,e.after])),l=new Set(i.map(e=>e.before.spaceId).filter(e=>void 0!==e));p({...u,channels:u.channels.map(i=>r?t.get(i.id)||i:t.has(i.id)||void 0!==i.spaceId&&l.has(i.spaceId)?{...i,status:"blocked",issue:e&&"review"===e.status?"stockSyncReview":"stockSyncPending"}:i)}),N(e||void 0)}g({}),q.current=!1,r&&(0,nY.PisellToast)({content:o("saved")})}catch(e){a.signal.aborted||(_(!0),S(e instanceof Error?e.message:""))}finally{R.current=!1,P.current=null,$.current&&(M(!1),I(null))}},ei=async e=>{if(!n.testChannel||h||f||R.current||P.current||z.current)return;let l=new AbortController;z.current=l,D(e.id),O(t=>{let l={...t};return delete l[e.id],l});try{let i=await n.testChannel(t,{...e},l.signal);!l.signal.aborted&&$.current&&O(t=>({...t,[e.id]:i}))}catch(t){!l.signal.aborted&&$.current&&O(l=>({...l,[e.id]:{success:!1,uncertain:!0,message:t instanceof Error?t.message:o("channelTestUnknown")}}))}finally{z.current===l&&(z.current=null,$.current&&D(null))}},ea=(0,eC.useMemo)(()=>{let e=new Map;return null==u||u.channels.forEach(t=>e.set(t.row,[...e.get(t.row)||[],t])),Array.from(e.entries())},[null==u?void 0:u.channels]);return(0,eH.jsxs)("section",{className:"vm-restock vm-page",children:[c,(0,eH.jsx)(eT.Modal,{open:null!==T,title:o("reviewTitle"),className:"vm-dialog vm-restock-review-dialog",wrapClassName:"vm-dialog-wrap",width:760,centered:!0,maskClosable:!1,closable:!C,keyboard:!C,confirmLoading:C,cancelButtonProps:{disabled:C},okText:o("reviewConfirm"),cancelText:o("keepEditing"),onCancel:()=>{R.current||(P.current=null,I(null))},onOk:()=>void el(),children:T&&u&&(0,eH.jsx)(e5p,{changes:T,products:u.products,channelLabel:J})}),(0,eH.jsxs)("header",{className:"vm-page-heading",children:[i&&(0,eH.jsx)("button",{className:"vm-icon-button","aria-label":o("back"),disabled:H,onClick:async()=>{await ee()&&i()},children:(0,eH.jsx)(pa,{})}),(0,eH.jsxs)("div",{className:"vm-restock-title",children:[(0,eH.jsx)("h1",{children:o("configure")}),(0,eH.jsx)("p",{children:o("configureDescription")}),n.testChannel&&(0,eH.jsx)("span",{className:"vm-caption",children:o("channelTestHint")})]}),(0,eH.jsx)("button",{className:"vm-button vm-button-outline vm-fill-all",disabled:h||f||H||!(null==u?void 0:u.channels.some(e=>X(e))),onClick:()=>{!u||h||f||R.current||P.current||z.current||(_(!1),g(e=>{let t={...e};for(let l of u.channels){let i=e[l.id]||e5m(l);X(l,i)&&(t[l.id]={...i,quantity:String(l.capacity)})}return t}))},children:o("fillAll")})]}),!h&&!f&&(null==u?void 0:u.canSubmit)===!1&&(0,eH.jsx)(eT.Alert,{className:"vm-restock-notice",type:"info",showIcon:!0,message:o("restockDraftOnly")}),(j&&"synced"!==j.status||k)&&(0,eH.jsx)(eT.Alert,{className:"vm-restock-notice",type:k?"error":(null==j?void 0:j.status)==="review"?"warning":"info",showIcon:!0,message:k?w||o("saveError"):(null==j?void 0:j.message)||o("stockSyncPending"),action:(0,eH.jsx)("button",{className:"vm-button vm-button-outline",disabled:h||H,onClick:async()=>{await ee()&&V()},children:o("stockRefresh")})}),(0,eH.jsx)("div",{className:"vm-restock-scroll","aria-busy":h||C,children:h?(0,eH.jsxs)("div",{className:"vm-state",children:[(0,eH.jsx)(eT.Spin,{}),(0,eH.jsx)("span",{children:o("loading")})]}):f?(0,eH.jsxs)("div",{className:"vm-state",role:"alert",children:[(0,eH.jsx)("p",{children:b||o("loadError")}),(0,eH.jsx)("button",{className:"vm-button",onClick:()=>void V(),children:o("retry")})]}):(null==u?void 0:u.channels.length)?(0,eH.jsxs)("div",{className:"vm-inline-list",children:[(0,eH.jsxs)("div",{className:"vm-list-labels",children:[(0,eH.jsx)("span",{children:o("channel")}),(0,eH.jsx)("span",{children:o("productStock")}),(0,eH.jsx)("span",{children:o("quantityAfter")}),(0,eH.jsx)("span",{children:o("action")})]}),ea.map(e=>{let[t,l]=e;return(0,eH.jsxs)("div",{className:"vm-channel-group",children:[ea.length>1&&(0,eH.jsxs)("div",{className:"vm-channel-group-heading",children:[o(Q)," ",Z(l[0])]}),(0,eH.jsx)("div",{className:"vm-group-items",children:l.map(e=>{let t,l,i,a,r,s,d,c,p=K.get(e.productId||""),m="enabled"!==e.status?e.status:0===e.quantity?"empty":null!==e.quantity&&e.quantity<=e.lowThreshold?"low":null;return(0,eH.jsxs)("div",{className:`vm-channel-line ${m?`vm-status-${m}`:""} ${e5g(e,U(e))?"vm-is-changed":""}`,children:[(0,eH.jsxs)("strong",{className:"vm-channel-code",children:[(0,eH.jsx)("span",{className:"vm-restock-field-label",children:o("channel")}),e.code]}),(0,eH.jsxs)("div",{className:"vm-channel-product",children:[(0,eH.jsx)("span",{className:"vm-restock-field-label",children:o("productStock")}),(t=U(e),(0,eH.jsx)("div",{className:"vm-product-picker",children:(0,eH.jsx)(eT.Select,{className:"vm-product-select",bordered:!1,showSearch:!1,virtual:!0,options:G,placeholder:e.issue?o(e.issue):o("noProduct"),"aria-label":`${J(e)} ${o("product")}`,disabled:H||!e5h(e),value:t.productId||void 0,onChange:t=>et(e,{productId:t||null,quantity:"0"})})})),(0,eH.jsxs)("span",{className:"vm-caption",children:[(0,eH.jsx)("span",{className:"vm-sku",children:(null==p?void 0:p.sku)||"—"})," ","\xb7 ",o("current")," ",e.quantity??"—","enabled"!==e.status&&(0,eH.jsxs)(eH.Fragment,{children:[" \xb7 ",o(e.status)]})]}),e.issue&&(0,eH.jsx)("span",{className:"vm-field-error",children:o(e.issue)})]}),(i=Number((l=U(e)).quantity)||0,a=H||!X(e,l),r=e5h(e)&&!e5v(e,l),(0,eH.jsxs)("div",{className:"vm-quantity-editor",children:[(0,eH.jsx)("span",{className:"vm-restock-field-label",children:o("quantityAfter")}),(0,eH.jsxs)("div",{className:"vm-stepper",children:[(0,eH.jsx)("button",{className:"vm-icon-button","aria-label":`${J(e)} −1`,disabled:a||i<=0,onClick:()=>et(e,{quantity:String(Math.max(0,Math.min(e.capacity,Math.trunc(i)-1)))}),children:(0,eH.jsx)(NI,{})}),(0,eH.jsx)("input",{inputMode:"numeric",type:"number",step:1,min:0,max:e.capacity,"aria-label":`${J(e)} ${o("quantity")}`,"aria-invalid":r,disabled:a,placeholder:"—",value:l.quantity,onChange:t=>et(e,{quantity:t.target.value})}),(0,eH.jsx)("button",{className:"vm-icon-button","aria-label":`${J(e)} +1`,disabled:a||i>=e.capacity,onClick:()=>et(e,{quantity:String(Math.min(e.capacity,Math.max(0,Math.trunc(i)+1)))}),children:(0,eH.jsx)(db,{})})]}),(0,eH.jsx)("span",{className:"vm-caption",children:o("capacity",{capacity:e.capacity})}),r&&(0,eH.jsx)("span",{className:"vm-field-error",role:"alert",children:o("invalidQuantity")})]})),(s=E[e.id],d=A===e.id,c="string"==typeof e.machineId&&!!e.machineId&&Number.isSafeInteger(e.boardDeviceId)&&e.boardDeviceId>0&&Number.isInteger(e.laneId)&&e.laneId>=1&&e.laneId<=100,(0,eH.jsxs)("div",{className:"vm-row-actions",children:[(0,eH.jsx)("span",{className:"vm-restock-field-label",children:o("action")}),(0,eH.jsxs)("div",{className:"vm-row-action-buttons",children:[(0,eH.jsx)("button",{className:"vm-button vm-button-outline",disabled:H||!X(e),onClick:()=>et(e,{quantity:String(e.capacity)}),children:o("fill")}),(0,eH.jsx)("button",{className:"vm-button vm-button-outline",title:o("reset"),"aria-label":`${J(e)} ${o("reset")}`,disabled:H||!e5g(e,U(e)),onClick:()=>{!R.current&&!P.current&&!z.current&&(g(t=>{let l={...t};for(let t of(null==u?void 0:u.channels)||[])(t.id===e.id||void 0!==e.spaceId&&t.spaceId===e.spaceId)&&delete l[t.id];return l}),_(!1))},children:o("reset")}),(0,eH.jsx)("button",{className:"vm-button vm-button-outline vm-channel-test",title:o("channelTestHint"),"aria-label":`${J(e)} ${o("channelTest")}`,"aria-busy":d,disabled:H||!n.testChannel||!c,onClick:()=>void ei(e),children:o(d?"channelTesting":"channelTest")})]}),!d&&s&&(0,eH.jsxs)("span",{className:`vm-channel-test-result ${s.success?"vm-test-success":s.uncertain?"vm-test-unknown":"vm-test-failed"}`,role:"status",children:[o(s.success?"channelTestSuccess":s.uncertain?"channelTestUnknown":"channelTestFailed"),!s.success&&s.message&&(0,eH.jsx)("span",{className:"vm-caption",children:s.message})]})]}))]},e.id)})})]},t)})]}):(0,eH.jsx)("div",{className:"vm-state",children:o("noChannels")})}),(0,eH.jsxs)("footer",{className:"vm-submit-bar",children:[(0,eH.jsxs)("div",{children:[(0,eH.jsx)("span",{className:"vm-caption",children:o("pending")}),(0,eH.jsxs)("strong",{children:[Y.length," ",o("channels")]})]}),(0,eH.jsxs)("button",{className:"vm-button vm-button-primary",disabled:H||h||f||(null==u?void 0:u.canSubmit)===!1||!Y.length||W,onClick:()=>{if(!u||!1===u.canSubmit||h||f||R.current||P.current||z.current||!Y.length||W)return;let e=Y.map(e=>{var t;let l=U(e),i=Number(l.quantity),a=l.productId===e.productId;return{channelId:e.id,before:{...e},after:{...e,productId:l.productId,inventoryItemId:null==(t=K.get(l.productId||""))?void 0:t.inventoryItemId,stockId:a?e.stockId:void 0,submissionId:void 0,quantity:i,availableQuantity:a?null==e.availableQuantity||null===e.quantity?e.availableQuantity:e.availableQuantity+i-e.quantity:i}}}),t=new Map;for(let l of e){let e=K.get(l.after.productId||"");if(l.after.productId&&(!e||e.disabled))return void(0,nY.PisellToast)({content:o("restockStockInvalid"),type:"error"});if(void 0===l.before.spaceId)continue;let i=t.get(l.before.spaceId);if(i&&(i.after.productId!==l.after.productId||i.after.quantity!==l.after.quantity))return void(0,nY.PisellToast)({content:o("restockChanged"),type:"error"});t.set(l.before.spaceId,l)}P.current=e,I(e)},children:[C?(0,eH.jsx)(eT.Spin,{size:"small"}):(0,eH.jsx)(gR,{}),o(C?"saving":"reviewTitle")]})]})]})}function e5y(e){let{context:t,brand:l,machine:i,staff:a=null,onBack:n,onSignOut:r,service:o,blockNavigation:s,className:d,style:c}=e,u=e5r(),p=(0,eC.useRef)(null),m=(0,eC.useRef)(!0),g=(0,eC.useCallback)(e=>{p.current=e},[]);(0,eC.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let h=async()=>{(!p.current||await p.current())&&m.current&&(null==r||r())};return(0,eH.jsxs)("main",{className:["vm-app vm-staff-mode",d].filter(Boolean).join(" "),style:{...u,...c},children:[(0,eH.jsx)(e5u,{brand:l,machine:i,staff:a,onSignOut:()=>void h()}),(0,eH.jsx)(e5f,{context:t,staff:a,onBack:n,setLeaveGuard:g,service:o,blockNavigation:s})]})}function e5b(e){let{context:t}=e;return(0,eH.jsx)(d_,{value:t.locale,children:(0,eH.jsx)(e5y,{...e},JSON.stringify([t.tenantDomain,t.businessCode,t.shopId,t.deviceId]))})}function e5x(e){let{context:t,staff:l,service:i,onConfigure:a,onResume:n}=e,{text:r}=eTp(),[o,s]=(0,eC.useState)(null),[d,c]=(0,eC.useState)(!1),[u,p]=(0,eC.useState)(0);(0,eC.useEffect)(()=>{let e=new AbortController;return c(!1),s(null),i.load(t,e.signal).then(t=>{e.signal.aborted||s(t)}).catch(()=>{e.signal.aborted||c(!0)}),()=>e.abort()},[t.businessCode,t.tenantDomain,t.shopId,t.deviceId,i,u]);let m=(null==o?void 0:o.channels)||[],g=[...new Map(m.filter(e=>"enabled"===e.status&&e.productId).map(e=>[void 0===e.spaceId?`channel:${e.id}`:`space:${e.spaceId}`,e])).values()],h=[{label:"sellable",value:g.some(e=>null===e.availableQuantity||null===e.quantity)?null:g.reduce((e,t)=>e+(t.availableQuantity??t.quantity??0),0)},{label:"low",value:m.filter(e=>"enabled"===e.status&&null!==e.quantity&&e.quantity>0&&e.quantity<=e.lowThreshold).length},{label:"empty",value:m.filter(e=>"enabled"===e.status&&0===e.quantity).length},{label:"unavailable",value:m.filter(e=>"enabled"!==e.status).length}];return(0,eH.jsxs)("section",{className:"vm-staff-home vm-page",children:[(0,eH.jsx)("header",{className:"vm-page-heading",children:(0,eH.jsxs)("div",{children:[(0,eH.jsx)("p",{children:r("welcomeStaff",{name:l.name})}),(0,eH.jsx)("h1",{children:r("staffHome")})]})}),(0,eH.jsxs)("div",{className:"vm-staff-content",children:[d?(0,eH.jsx)(eT.Alert,{type:"warning",message:r("loadError"),action:(0,eH.jsx)("button",{className:"vm-text-button",onClick:()=>p(e=>e+1),children:r("retry")})}):(0,eH.jsx)("div",{className:"vm-stats",children:h.map(e=>(0,eH.jsxs)("div",{className:`vm-stat vm-stat-${e.label}`,children:[(0,eH.jsx)("span",{children:r(e.label)}),(0,eH.jsx)("strong",{children:o?e.value??"—":"—"})]},e.label))}),(0,eH.jsxs)("button",{className:"vm-service-card",onClick:a,children:[(0,eH.jsx)(Pg,{}),(0,eH.jsxs)("div",{children:[(0,eH.jsx)("h2",{children:r("configure")}),(0,eH.jsx)("p",{children:r("configureCard")})]}),(0,eH.jsx)(pr,{})]}),(0,eH.jsxs)("button",{className:"vm-button vm-button-outline vm-resume",onClick:n,children:[r("resume"),(0,eH.jsx)(pr,{})]})]})]})}function e5k(e){let{context:t,brand:l,machine:i,staff:a,service:n,onConfigure:r,onSignOut:o}=e,s=e5r();return(0,eH.jsx)(d_,{value:t.locale,children:(0,eH.jsxs)("main",{className:"vm-app vm-staff-mode",style:s,children:[(0,eH.jsx)(e5u,{brand:l,machine:i,staff:a,onSignOut:o}),(0,eH.jsx)(e5x,{context:t,staff:a,service:n,onConfigure:r,onResume:o})]})})}function e5_(e){let{bindings:t,children:l,isActive:i=!0}=e,a=i&&!1!==t.isActive&&!1!==t.isVisible,[n,r]=(0,eC.useState)(!1),[o,s]=(0,eC.useState)(!0),[d,c]=(0,eC.useState)(0),[u,p]=(0,eC.useState)({ready:!1,failed:!1,generation:-1}),[m,g]=(0,eC.useState)(!1),[h,v]=(0,eC.useState)(!1),f=(0,eC.useRef)(!0),y=(0,eC.useRef)(a),b=(0,eC.useRef)(!1),x=e5r(),k=!t.sales.inventory||!t.sales.catalogScope||!t.sales.checkoutHooks||t.sales.failed||m||u.generation===d&&u.failed,_=t.sales.ready&&u.generation===d&&u.ready&&!k,w=(0,eC.useCallback)(e=>{e&&!f.current&&c(e=>e+1),f.current=e,s(e)},[]),S=(0,eC.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r(!1),g(e)},[]),j=o3(()=>{a&&!1!==t.scanEnabled&&(!n||k)&&(k&&(g(!1),c(e=>e+1),t.sales.retry()),r(!0))});(0,eC.useEffect)(()=>{a&&!1!==t.scanEnabled||S(),a&&!y.current&&o&&c(e=>e+1),y.current=a},[a,o,t.scanEnabled,S]);let N=(0,eC.useRef)(t.idleRequest);(0,eC.useEffect)(()=>{N.current!==t.idleRequest&&S(),N.current=t.idleRequest},[t.idleRequest,S]),(0,eC.useEffect)(()=>{var e;return null==(e=t.subscribeIdle)?void 0:e.call(t,()=>S())},[t.subscribeIdle,S]),(0,eC.useEffect)(()=>{if(!b.current){var e;b.current=!0,null==(e=t.onPrerenderComplete)||e.call(t)}},[t.onPrerenderComplete]);let C=t.fulfillment.setIdlePaused;(0,eC.useEffect)(()=>{C(a&&(h||o&&n&&!k))},[a,h,o,n,k,C]),(0,eC.useEffect)(()=>()=>{C(!1)},[C]),(0,eC.useEffect)(()=>{var e;if(a&&h)return null==(e=t.blockNavigation)?void 0:e.call(t,()=>!1)},[a,h,t.blockNavigation]);let M=(0,eC.useMemo)(()=>({active:a&&o,onStateChange:e=>{p(t=>t.generation===d&&t.ready===e.ready&&t.failed===e.failed?t:{...e,generation:d})}}),[a,o,d]);return(0,eH.jsx)(d_,{value:t.context.locale,children:(0,eH.jsx)(eTf.Provider,{value:t.brandLogo,children:(0,eH.jsx)(eTQ.Provider,{value:{bindings:t,active:a,requested:n,ready:_,failed:k,requestStart:j,settleStart:S,setEntry:w},children:(0,eH.jsx)("main",{className:["vm-app vm-self-service",t.className].filter(Boolean).join(" "),style:{...x,...t.style},children:t.sales.ready?l({catalogPreparation:M,productCatalogSessionKey:`vending-entry-${d}`,onPaymentPageActiveChange:v}):(0,eH.jsx)(eTJ,{})})})})})}let e5w=new Set(["venue_booking","venue_ticket","ticket"]);function e5S(e){let{kioskAppId:t=eT2,kioskAppBindings:l,businessCode:i,mode:a=e5w.has(i??"")?"ticket":"retail",autoCreate:n=!1,mergeBookingLinesForDisplay:r=!1,enableGlobalScanListener:o=!0,normalProductDetailConfig:s,otherParams:d,...c}=e,u=(0,eC.useMemo)(()=>({enableBusinessAvailability:!0,enforceSingleBookingStartDate:!0,...d,platform:String((null==d?void 0:d.platform)??"").trim().toLowerCase()||"kiosk"}),[d]),p=(0,eC.useMemo)(()=>({...s,resolveAppearance:(null==s?void 0:s.resolveAppearance)??((null==s?void 0:s.appearance)?void 0:eMA)}),[s]),m=e=>{var s;return(0,eC.createElement)(e6q,{...c,...e,key:JSON.stringify([c.osModuleName,c.osKey,i,a,t]),template:"SelfServiceKiosk",kioskAppId:t,kioskAppBindings:l,businessCode:i,mode:a,autoCreate:n,otherParams:u,normalProductDetailConfig:p,mergeBookingLinesForDisplay:r,enableGlobalScanListener:!!o&&("vendingMachine"!==t||(null==l||null==(s=l.vendingMachine)?void 0:s.scanEnabled)!==!1)&&"scoped"})};if("vendingMachine"===t){let e=null==l?void 0:l.vendingMachine;if(!e)throw Error("vendingMachine requires instance bindings");let t=JSON.stringify([e.context.tenantDomain,e.context.shopId,e.context.deviceId,e.context.businessCode,e.sales.osModuleName]);return(0,eH.jsx)(e5_,{bindings:e,isActive:c.isActive,children:t=>m({...t,productCatalogSessionKey:`${c.productCatalogSessionKey??""}:${t.productCatalogSessionKey}`,isActive:!1!==c.isActive&&!1!==e.isActive&&!1!==e.isVisible,onPaidCheckout:void 0})},t)}return m()}function e5j(e,t,l){let i=Object.entries(e).reduce((e,t)=>{let[l,i]=t;return"channel"===l&&""===String(i??"").trim()||("otherParams"===l&&i&&"object"==typeof i&&!Array.isArray(i)?e[l]={...e[l]||{},...i}:void 0!==i&&(e[l]=i)),e},{...t||{}}),a=[null==l?void 0:l.menuIds,e.menuIds,null==t?void 0:t.menuIds].map(exK).find(e=>e.length>0);return a?i.menuIds=a:delete i.menuIds,i}function e5N(){var e;if("u"<typeof window)return"100dvh";let t=function(){if("u"<typeof window||"u"<typeof document)return 1;let e=document.body.style.transform,t=e&&"none"!==e?e:window.getComputedStyle(document.body).transform;if(!t||"none"===t)return 1;let l=new DOMMatrixReadOnly(t);return Math.sqrt(l.c*l.c+l.d*l.d)||1}();if(.001>Math.abs(t-1))return"100%";let l=(null==(e=window.visualViewport)?void 0:e.height)||window.innerHeight;return`${l/t}px`}function e5C(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];for(let e of t){let t=String(e||"").trim();if(t)return t}return""}function e5M(e){var t,l,i,a,n,r,o;let[s,d]=(0,eC.useState)(e5N),c=e$(),u=eq(),p=(null==c||null==(l=c.appHelper)||null==(t=l.constants)?void 0:t.hostPageProps)||{},m=(null==c||null==(i=c.engine)?void 0:i.props)||{},g=e5C(p.channel,null==(a=p.otherParams)?void 0:a.channel),{className:h,mode:v="retail",style:f,businessCode:y,channel:b,otherParams:x,menuIds:k,productLoadParams:_,bootstrapSlot:w,variant:S,normalProductDetailConfig:j,osModuleName:N,...C}=e5j(e,{...p,...m,channel:e5C(g,m.channel),otherParams:{...p.otherParams||{},...m.otherParams||{},...g?{channel:g}:{}}},p),M=e5C(g,b,null==x?void 0:x.channel,null==c||null==(o=c.appHelper)||null==(r=o.utils)||null==(n=r.getData)?void 0:n.call(r,"channel"),"pos"),T=eWV(eWH(null==x?void 0:x.platform,u),S),I=(0,eC.useMemo)(()=>{if(!_&&!(null==k?void 0:k.length))return;let{menu_list_ids:e,...t}=_||{};return{...t,...(null==k?void 0:k.length)?{menu_list_ids:k}:{}}},[k,_]),P=(0,eC.useMemo)(()=>({...x||{},enforceSingleBookingStartDate:!0,...M?{channel:M}:{},enableBusinessAvailability:!!T.platform,...T.platform?{platform:T.platform}:{}}),[M,T.platform,x]),A="pos"===String(M||"").trim().toLowerCase(),D=(0,eC.useMemo)(()=>({...j,resolveAppearance:(null==j?void 0:j.resolveAppearance)??((null==j?void 0:j.appearance)?void 0:eMA),...A?{allowUnavailableBookingSelection:!0,allowNoResourceBookingSelection:!0}:{},presentationPlatform:T.productDetailPresentationPlatform,hideQuantityForBookingProducts:null==j?void 0:j.hideQuantityForBookingProducts}),[A,T.productDetailPresentationPlatform,j]);return(0,eC.useEffect)(()=>{var e;let t=()=>{d(e5N())};t(),window.addEventListener("resize",t),null==(e=window.visualViewport)||e.addEventListener("resize",t);let l=new MutationObserver(t);return l.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),()=>{var e;window.removeEventListener("resize",t),null==(e=window.visualViewport)||e.removeEventListener("resize",t),l.disconnect()}},[]),(0,eH.jsx)(eU5.Provider,{value:eMP,children:(0,eH.jsx)(e6q,{...C,className:h,mode:v,businessCode:y,otherParams:P,lifecycleOwner:"provider",osModuleName:N,selectionFlowScene:"product-selection",enableGlobalScanListener:!0,normalProductDetailConfig:D,mergeBookingLinesForDisplay:T.mergeBookingLinesForDisplay,productLoadParams:I,enableMenuOverride:!!(null==k?void 0:k.length),autoCreate:!1,bootstrapSlot:w,saleDetailTemplate:"A",style:{minHeight:s,height:s,...f},template:"kiosk",variant:T.variant})})}function e5T(e){var t,l,i,a,n,r,o,s;let{kind:d,...c}=e,u=e$(),p=eq(),m=(null==u||null==(l=u.appHelper)||null==(t=l.constants)?void 0:t.hostPageProps)||{},g=e5j(c,{...m,...(null==u||null==(i=u.engine)?void 0:i.props)||{},otherParams:{...m.otherParams||{},...(null==u||null==(n=u.engine)||null==(a=n.props)?void 0:a.otherParams)||{}}},m),{otherParams:h,channel:v,businessCode:f,variant:y,...b}=g,x=(null==h?void 0:h.platform)||p,k="kiosk"===String(x||"").trim().toLowerCase(),_=f||(null==h?void 0:h.businessCode)||"venue_booking",w=v||(null==h?void 0:h.channel)||(k?"kiosk":"online_ordering"),S=String((null==u||null==(s=u.appHelper)||null==(o=s.utils)||null==(r=o.getData)?void 0:r.call(o,"timezone"))||(null==h?void 0:h.businessTimezone)||""),j=(0,eC.useMemo)(()=>({...h,businessCode:_,channel:w,platform:x,venueBookingMode:d,...k?{enableSessionStoragePersist:!1}:{},businessTimezone:S,type:"appointment_booking",enableBusinessAvailability:!0,enforceSingleBookingStartDate:!0,enablePickupTiming:!1}),[_,w,h,x,S,d,k]);return(0,eH.jsx)(e6q,{...b,osKey:g.osKey||`venue-booking-${d}`,template:"tickets"===d?"venue-ticket-booking":"venue-party-booking",mode:"retail",businessCode:_,otherParams:j,variant:"kiosk"===String(j.platform).trim().toLowerCase()?"phone":y||("h5"===j.platform?"phone":"desktop"),lifecycleOwner:"provider",orderId:void 0,autoBootstrap:!1,autoRestoreOnInit:!1,autoCreate:!1,autoInitBookingContext:!1,enableGlobalScanListener:!1,enableTempOrderSync:k,enableMenuOverride:!1,productLoadParams:void 0,autoReloadProductCatalogOnCustomerChange:!1,mergeBookingLinesForDisplay:!1})}function e5I(e){return(0,eH.jsx)(e5T,{...e,kind:"tickets"})}function e5P(e){return(0,eH.jsx)(e5T,{...e,kind:"party"})}function e5A(e){let{payload:t}=e,l=exe(),i=l.bookingTicket,a=l.clearCartAndReset,n="picoding"===l.salesSettingsSource&&!l.salesSettings,r=(0,eC.useRef)(Promise.resolve());return(0,eC.useEffect)(()=>{if(!i||n)return;let e=!1;return r.current=r.current.then(async()=>{if(!e){if(t.tempOrder){if(!i.replaceTempOrder)return void console.warn("[SharedSecondaryBigSale] 当前销售实例不支持 replaceTempOrder");await i.replaceTempOrder(t.tempOrder)}else await a();!e&&t.walletAssetsSnapshot&&i.importWalletAssetsSnapshot&&await i.importWalletAssetsSnapshot(t.walletAssetsSnapshot)}}).catch(e=>{console.warn("[SharedSecondaryBigSale] 应用副屏订单快照失败",e)}),()=>{e=!0}},[i,a,t,n]),null}let e5D=0;function e5E(e){var t,l,i;let{osKey:a="shared-secondary-big-sale",saleDetailModuleConfig:n,secondaryScreenDisplay:r,className:o,style:s}=e,d=function(){var e,t,l,i,a;let n=e$(),r=null==n||null==(l=n.appHelper)||null==(t=l.utils)||null==(e=t.getApp)?void 0:e.call(t),o=null==r||null==(i=r.getPlugin)?void 0:i.call(r,"unifiedCommunication"),{runtime:s}=(null==o||null==(a=o.useRuntime)?void 0:a.call(o))||{},d=(null==s?void 0:s.role)==="secondary-screen",c=(0,eC.useRef)(0),[u,p]=(0,eC.useState)(null);return(0,eC.useEffect)(()=>{var e,t,l,i;if(!d)return;let a=!1,n=null==o||null==(t=o.sdk)||null==(e=t.onMessage)?void 0:e.call(t,e=>{var t;let l=eN0(e);!a&&l&&"secondary-screen"!==l.sourceRole&&(t=c.current,!0===l.isActive&&l.timestamp>t&&(c.current=l.timestamp,p(l)))});return Promise.resolve(null==o||null==(i=o.sdk)||null==(l=i.publishData)?void 0:l.call(i,{target:{type:"main"},data:{type:eNG,requestId:`shared-secondary-${Date.now()}-${Math.random().toString(16).slice(2)}`,timestamp:Date.now()},meta:{}})).catch(e=>{console.warn("[SharedSecondaryBigSale] 请求主屏订单快照失败",e)}),()=>{if(a=!0,n&&"function"==typeof n.then)n.then(e=>{var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}).catch(()=>{});else{var e;null==n||null==(e=n.remove)||e.call(n)}}},[d,o]),u}(),c=e$(),u=d?eNX(d):void 0,p=null==u?void 0:u.businessCode,m=null==c||null==(i=c.appHelper)||null==(l=i.utils)||null==(t=l.getData)?void 0:t.call(l,"channel"),g=(null==u?void 0:u.channel)||("string"==typeof m&&m.trim()?m.trim():"cds"),h=(0,eC.useMemo)(()=>++e5D,[a,p,g]),v=(0,eC.useMemo)(()=>({channel:g}),[g]);return d&&p?(0,eH.jsx)(e6q,{osKey:`${a}-${encodeURIComponent(g)}-${h}`,businessCode:p,otherParams:v,mode:"ticket",template:"secondaryScreen",saleDetailTemplate:"A",autoCreate:!1,autoRestoreOnInit:!1,autoInitBookingContext:!1,enableTempOrderSync:!1,secondaryScreenDisplay:r,saleDetailModuleConfig:n,className:o,style:s,bootstrapSlot:(0,eH.jsx)(e5A,{payload:d})},h):(0,eH.jsx)("div",{className:o,style:s,"aria-busy":"true"})}let e5O=eM().memo(e6F);async function e5z(e){var t,l,i,a,n,r,o;let s=(null==(l=e.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.tempOrder??null,d=(null==(a=e.salesDetail)||null==(i=a.header)?void 0:i.order_id)??(null==(n=e.salesDetail)?void 0:n.order_id),c=eM6(null==s?void 0:s.order_id)||!!d,u=(null==s||null==(r=s.products)?void 0:r.length)??0,p=(null==s||null==(o=s.bookings)?void 0:o.length)??0;c?await e.restore():((u>0||p>0)&&"function"==typeof e.clearCartItemsOnly&&await e.clearCartItemsOnly(),await e.createNew())}function e5L(e){var t,l;let{open:i,contentActive:a,openNonce:n=0,orderId:r,preloadedSalesDetail:o,createSeed:s,bookingTimeRangeFromCalendar:d,bookingConfigParams:c,onCreateSeedReady:u,onCreateSeedError:p,onEditReady:m}=e,g=exe(),h=eND(),v=eM().useContext(eCY),f=eM().useContext(eCW),y=(0,eC.useRef)(!1),b=(0,eC.useRef)(0),x=(0,eC.useRef)(0),k=(0,eC.useRef)(g);k.current=g;let _=(0,eC.useRef)(h);_.current=h;let w=(0,eC.useRef)(s);w.current=s;let S=(0,eC.useRef)(d);S.current=d;let j=(0,eC.useRef)(o);j.current=o;let N=(0,eC.useRef)(c);N.current=c;let C=(0,eC.useRef)(v);C.current=v;let M=(0,eC.useRef)(f);M.current=f;let T=(0,eC.useRef)(u);T.current=u;let I=(0,eC.useRef)(p);I.current=p;let P=(0,eC.useRef)(m);P.current=m;let A=(0,eC.useRef)(a),D=(0,eC.useRef)(null),E=`${!s?"":`${(null==(t=s.row)?void 0:t.id)??""}-${(null==(l=s.reservationRuleProduct)?void 0:l.id)??""}`}:${(null==d?void 0:d.startAt)||""}:${(null==d?void 0:d.endAt)||""}`,O=!!g.bookingTicket;return(0,eC.useEffect)(()=>{let e=A.current;if(A.current=a,!e||a||!k.current.bookingTicket)return;let t=k.current.restore().then(()=>void 0).catch(e=>{console.warn("[BigSaleDialog] close cleanup failed",e)});D.current=t,t.finally(()=>{D.current===t&&(D.current=null)})},[a,O]),(0,eC.useEffect)(()=>{if(!i){y.current=!1,b.current+=1,x.current+=1;return}y.current=!1,b.current+=1,x.current+=1},[i,n,E]),(0,eC.useEffect)(()=>{var e;if(!i||!r||s)return;let t=k.current;if(!t.bookingTicket)return;let l=x.current;return null==(e=M.current)||e.call(M,r),(async()=>{var e,i,a,n,o,s,d;try{if(await D.current,l!==x.current)return;let d=function(e,t){if(!e||"object"!=typeof e)return;let l=e.order_id;if(null!=l&&String(l)===String(t)&&Array.isArray(e.products)&&Array.isArray(e.bookings))return e}(j.current,r);if(await t.loadDetail(d?{orderId:r,preloadedSalesDetail:d}:r),l!==x.current)return;let c=(null==(i=t.bookingTicket)||null==(e=i.getTempOrder)?void 0:e.call(i))??t.tempOrder,u=exV(c??null);if(await (null==(n=t.bookingTicket)||null==(a=n.initBookingContext)?void 0:a.call(n,exY(N.current,{date:eS()(),bookingIds:u.length?u:void 0,loadResources:!0}))),l!==x.current||(null==(o=C.current)||o.call(C),await _.current.recalcSummary(),l!==x.current))return;null==(s=P.current)||s.call(P)}catch(e){if(l!==x.current)return;null==(d=I.current)||d.call(I,e)}})(),()=>{l===x.current&&(x.current+=1)}},[i,n,r,E,O]),(0,eC.useEffect)(()=>{let e=w.current;if(!i||r)return;let t=k.current;if(!t.bookingTicket||"loading"===t.status||y.current)return;let l=b.current;return(async()=>{var t,i,a,n,r,o,s,d,c,u;try{if(await D.current,l!==b.current||(await e5z(k.current),l!==b.current)||(e&&await eWC({bookingTicket:k.current.bookingTicket,reservationRuleProduct:e.reservationRuleProduct,row:e.row,appointmentStatus:e.appointmentStatus??"started",bookingConfig:(null==(d=k.current.bookingTicket)||null==(s=d.getBookingConfig)?void 0:s.call(d))??null,tempOrder:k.current.tempOrder,date:(null==(c=S.current)?void 0:c.startAt.slice(0,10))||eS()().format("YYYY-MM-DD"),bookingTimeRangeFromCalendar:S.current,assertCurrent:()=>{if(l!==b.current)throw Error("The booking selection has closed.")}}),l!==b.current))return;let u=(null==(i=k.current.bookingTicket)||null==(t=i.getTempOrder)?void 0:t.call(i))??k.current.tempOrder,p=exV(u??null);if(await (null==(n=k.current.bookingTicket)||null==(a=n.initBookingContext)?void 0:a.call(n,exY(N.current,{date:eS()(),bookingIds:p.length?p:void 0,loadResources:!1}))),l!==b.current||(null==(r=C.current)||r.call(C),await _.current.recalcSummary(),l!==b.current))return;y.current=!0,null==(o=T.current)||o.call(T)}catch(e){if(l!==b.current)return;y.current=!1,null==(u=I.current)||u.call(I,e)}})(),()=>{l===b.current&&(b.current+=1)}},[i,n,r,E,O]),null}function e5R(e){let{onClose:t,fallbackTitle:l,variant:i}=e,a=exe(),n=(0,eC.useMemo)(()=>{var e,t,i,n;let r=a.tempOrder,o=(null==r?void 0:r.shop_full_order_number)||(null==r?void 0:r.shop_order_number)||((null==r?void 0:r.order_number)?String(r.order_number):"");if(o)return String(o);let s=(null==(t=a.salesDetail)||null==(e=t.header)?void 0:e.shop_full_order_number)||(null==(n=a.salesDetail)||null==(i=n.header)?void 0:i.shop_order_number);return s?String(s):l||""},[a.tempOrder,a.salesDetail,l]);return n?(0,eH.jsxs)("div",{className:aT()("big-sale-dialog-header-bar",{"big-sale-dialog-header-bar--phone":"phone"===i}),children:[(0,eH.jsx)("div",{className:"big-sale-dialog-header-bar__content",children:(0,eH.jsx)("div",{className:"big-sale-dialog-header-bar__order-id",title:n,children:n})}),(0,eH.jsx)("button",{type:"button",className:"big-sale-dialog-header-bar__close","aria-label":"Close",onClick:t,children:(0,eH.jsx)(nY.Iconfont,{type:"pisell2-x-close"})})]}):null}function e5$(e){let{open:t,contentActive:l,openNonce:i,orderId:a,preloadedSalesDetail:n,createSeed:r,bookingTimeRangeFromCalendar:o,bookingConfigParams:s,onCreateSeedReady:d,onEditReady:c}=e;return(0,eH.jsx)(e5L,{open:t,contentActive:l,openNonce:i,orderId:a,preloadedSalesDetail:n,createSeed:r,bookingTimeRangeFromCalendar:o,bookingConfigParams:s,onCreateSeedReady:d,onEditReady:c})}function e5F(e){var t,l;let{open:i,contentActive:a=i,onVisualStateSettled:n,orderId:r,preloadedSalesDetail:o,resourceIdFromCalendar:s,bookingTimeRangeFromCalendar:d,createSeed:c,onClose:u,callback:p,rulesHooks:m,enableGlobalScanListener:g,title:h,preloaded:v,destroyOnUnmount:f,osKey:y="cached-dine-in-dialog",mode:b="retail",businessCode:x,bookingConfigParams:k,productDisplayConfig:_,productLoadParams:w,productCatalogReady:S=!0,orderType:j=r?void 0:"table-order",variant:N,openNonce:C=0}=e,M="phone"===N;eK(i);let T=!!r,I=T&&!M,P=(0,eC.useRef)(a);P.current=a;let A=(0,eC.useRef)(n);A.current=n;let D=String(x??"").trim()||("retail"===b?"dine_in":b),E=!(eM6(r)&&"dine_in"===D),O=h||(r?`#${r}`:"New Order"),z=(0,eC.useMemo)(()=>`${y}-${b}`,[y,b]),L=(0,eC.useCallback)(()=>{null==p||p({type:"close"}),null==u||u()},[p,u]),R=(0,eC.useCallback)(e=>{!1!==e.reset&&(null==p||p({type:e.type,data:e.data,order_id:e.order_id,reset:!0}),null==u||u())},[p,u]),$=(0,eC.useRef)(j);(!v||a)&&($.current=j);let F=v&&!a?$.current:j,q=(0,eC.useMemo)(()=>F?{type:F}:void 0,[F]),B=!!v||i,H=(0,eC.useMemo)(()=>a?(0,eH.jsx)(e5R,{onClose:L,fallbackTitle:O,variant:N}):null,[a,L,O,N]),[V,U]=(0,eC.useState)(0);(0,eC.useEffect)(()=>{a||U(0)},[a]),(0,eC.useEffect)(()=>{T||U(0)},[C,null==c||null==(t=c.row)?void 0:t.id,T]);let Y=(0,eC.useCallback)(()=>{U(e=>e+1)},[]);(0,eC.useLayoutEffect)(()=>{if(!i||"u"<typeof window)return;let e=0,t=0;return e=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{null==n||n(!0,a)})}),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(t)}},[a,n,i]);let W=(0,eC.useCallback)(e=>{if(!e){var t;null==(t=A.current)||t.call(A,!1,P.current)}},[]),K=(0,eC.useMemo)(()=>{var e;let t=(null==o?void 0:o.customer_id)??(null==o||null==(e=o.customer)?void 0:e.id)??"anonymous",l=(null==o?void 0:o.schedule_date)??(null==o?void 0:o.booking_date)??(null==o?void 0:o.start_time)??"",i=(null==o?void 0:o.updated_at)??"",a=Array.isArray(null==w?void 0:w.menu_list_ids)?w.menu_list_ids.join(","):"";return[String(r??"new"),String(t),String(l),String(x??""),a,String(i)].join("|")},[x,r,o,w]),G=S?T?1:V:0,Q=T?`edit-${K}-p${G}`:`create-${C}-${(null==c||null==(l=c.row)?void 0:l.id)??"new"}-p${G}`,Z=i&&a,J=(0,eC.useMemo)(()=>(0,eH.jsx)(e5$,{open:Z,contentActive:a,openNonce:C,orderId:r,preloadedSalesDetail:o,createSeed:c,bookingTimeRangeFromCalendar:i&&!T?d:void 0,bookingConfigParams:k,onCreateSeedReady:Y}),[Z,a,C,r,o,c,d,i,T,k,Y]);return(0,eH.jsx)(oU,{renderType:M?"drawer":"modal",showHandlerBar:!1,onHandlerBarClick:L,props:M?{open:i,onClose:L,afterOpenChange:W,skipEnterMotion:!0,placement:"bottom",title:void 0,width:"100%",height:"95%",className:"big-sale-dialog-drawer-phone",rootClassName:"big-sale-dialog-drawer-phone-root",destroyOnClose:!1,maskClosable:!1,footer:null,closable:!1,bodyStyle:{padding:0,height:"100%",position:"relative"}}:{open:i,onCancel:L,afterOpenChange:W,skipEnterMotion:!0,title:null,width:"100%",height:"100%",className:"big-sale-dialog-modal",destroyOnClose:!1,header:!1,maskClosable:!1,footer:null,closeIcon:null,wrapClassName:"big-sale-dialog-wrapper",size:"large",styles:{content:{borderRadius:0}},bodyStyle:{padding:0,height:"100%",position:"relative"}},children:(0,eH.jsx)("div",{"aria-hidden":!i,className:aT()("big-sale-dialog-content",{"big-sale-dialog-content--inactive":!a}),children:B?(0,eH.jsx)(e5O,{osKey:y,mode:b,destroyOnUnmount:f,selectionFlowScene:"product-selection",isActive:a,enableGlobalScanListener:g,autoCreate:!1,autoBootstrap:!1,autoRestoreOnInit:!1,autoInitBookingContext:!1,orderId:r,businessCode:x,bookingConfigParams:k,resourceIdFromCalendar:i&&!T?s:void 0,bookingTimeRangeFromCalendar:i&&!T?d:void 0,productDisplayConfig:_,productLoadParams:w,productCatalogSessionKey:Q,productCatalogReady:S,hideSelectFloorMapResourceAction:E,rulesHooks:m,otherParams:q,enableTempOrderPersist:!1,preserveProductCatalogOnInactiveCustomerClear:!0,className:"pisell-big-sale--dialog-host",bootstrapSlot:J,saleDetailHeaderSlot:H,rightActionBarClose:I?L:void 0,overlaySlot:null,onOrderComplete:R},z):null})})}e5F.displayName="BigSaleDialog";let e5q=oZ(e5F);function e5B(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let l=Object.keys(e),i=Object.keys(t);if(l.length!==i.length)return!1;for(let i of l)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}function e5H(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e5B,a=(0,eC.useRef)({value:void 0,initialized:!1}),n=(0,eC.useCallback)(()=>{let e=l(),t=a.current;return t.initialized?i(t.value,e)?t.value:(t.value=e,e):(t.value=e,t.initialized=!0,e)},[i]),r=t.join("|");return LQ((0,eC.useCallback)(l=>{if(!e)return()=>{};let i=t.map(t=>e.effectsOn(t,l));return()=>{for(let e of i)try{e()}catch{}}},[e,r]),n,n)}let e5V=e=>{var t;let{runtimeRef:l}=e,i=exe(),a=exr();return(0,eC.useEffect)(()=>{var e,t,n,r,o;let s=null==(r=i.bookingTicket)||null==(n=r.store)||null==(t=n.bookingContext)||null==(e=t.getState)?void 0:e.call(t),d=null==s?void 0:s.date,c=d&&eS()(d).isValid()?eS()(d).format("YYYY-MM-DD"):eS()().format("YYYY-MM-DD");l.current={customerId:null==(o=a.selected)?void 0:o.id,date:c}},[i.bookingTicket,null==(t=a.selected)?void 0:t.id,l]),null},e5U=e=>{var t,l;let{children:i,uiHosts:a,...n}=e,r=e$(),o=null==r||null==(l=r.appHelper)||null==(t=l.utils)?void 0:t.action,s=(0,eC.useRef)({date:void 0,customerId:void 0}),d=(0,eC.useMemo)(()=>o?{action:o,getRuntime:()=>s.current}:void 0,[o]);return(0,eH.jsxs)(eCG,{...n,legacyOpenProductDetail:d,uiHosts:a,children:[(0,eH.jsx)(e5V,{runtimeRef:s}),i]})},e5Y={schedule_date:S=eS()().format("YYYY-MM-DD"),menu_list_ids:[44858],schedule_datetime:eS()().format(`${S} HH:mm:ss`)},e5W={orderId:97807},e5K={loadProductsParams:{...e5Y},customerId:void 0,productPicker:{variantIndex:0,num:1}},e5G={orderId:e5W.orderId,loadProductsParams:{...e5Y},customerId:void 0,productPicker:{variantIndex:0,num:1},orderNote:"SalesSdk demo note",shopDiscount:5,contactsInfo:{name:"Demo Contact",phone:"13800000000"}};function e5Q(e,t){if(!t)return e;let l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return void 0!==t}));return{...e,...l,loadProductsParams:{...e.loadProductsParams,...t.loadProductsParams||{}},productPicker:{...e.productPicker,...t.productPicker||{}}}}function e5Z(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}let e5J=e=>{let{sales:t,cart:l,customer:i,summary:a,products:n}=e;return(0,eH.jsxs)("section",{className:"sales-sdk-demo__panel",children:[(0,eH.jsx)("h3",{children:"Raw Snapshot"}),(0,eH.jsxs)("div",{className:"sales-sdk-demo__raw-grid",children:[(0,eH.jsx)("pre",{children:e5Z({selectedCustomer:i.selected})}),(0,eH.jsx)("pre",{children:e5Z({tempOrder:t.tempOrder})}),(0,eH.jsx)("pre",{children:e5Z({bookings:l.bookings,items:l.items})}),(0,eH.jsx)("pre",{children:e5Z({products:n})}),(0,eH.jsx)("pre",{children:e5Z({summary:a})})]})]})},e5X=e=>{let{entries:t,title:l="Action Log"}=e;if(!t.length)return null;let i=t[t.length-1];return(0,eH.jsxs)("section",{className:`sales-sdk-demo__panel sales-sdk-demo__panel--${i.status}`,children:[(0,eH.jsx)("h3",{children:l}),(0,eH.jsx)("div",{className:"sales-sdk-demo__action-log",children:t.map((e,t)=>(0,eH.jsx)("pre",{className:`sales-sdk-demo__action-entry sales-sdk-demo__action-entry--${e.status}`,children:e.message},t))})]})};function e50(e){let t=e.trim();if(!t)return;let l=Number(t);return Number.isFinite(l)?l:void 0}function e52(e){let{label:t,value:l,placeholder:i,onChange:a}=e;return(0,eH.jsxs)("label",{className:"sales-sdk-demo__field",children:[(0,eH.jsx)("span",{children:t}),(0,eH.jsx)("input",{value:l,placeholder:i,onChange:e=>a(e.target.value)})]})}function e51(e){let{value:t,onChange:l}=e;return(0,eH.jsx)("div",{className:"sales-sdk-demo__advanced-form",children:(0,eH.jsx)(e52,{label:"orderId",value:null!=t.orderId?String(t.orderId):"",placeholder:"使用 fixture 默认值",onChange:e=>l({...t,orderId:e50(e)})})})}function e54(e){let{value:t,onChange:l}=e,i=t.loadProductsParams||{},a=t.productPicker||{},n=e=>{l({...t,loadProductsParams:{...i,...e}})},r=e=>{l({...t,productPicker:{...a,...e}})};return(0,eH.jsxs)("div",{className:"sales-sdk-demo__advanced-form",children:[(0,eH.jsx)(e52,{label:"loadProductsParams.schedule_date",value:i.schedule_date??"",placeholder:"YYYY-MM-DD",onChange:e=>n({schedule_date:e||void 0})}),(0,eH.jsx)(e52,{label:"loadProductsParams.schedule_datetime",value:i.schedule_datetime??"",placeholder:"YYYY-MM-DD HH:mm:ss",onChange:e=>n({schedule_datetime:e||void 0})}),(0,eH.jsx)(e52,{label:"loadProductsParams.menu_list_ids",value:Array.isArray(i.menu_list_ids)?i.menu_list_ids.join(","):"",placeholder:"逗号分隔,如 44858,44859",onChange:e=>n({menu_list_ids:function(e){let t=e.trim();if(t)return t.split(/[,\s]+/).map(e=>Number(e)).filter(e=>Number.isFinite(e))}(e)})}),(0,eH.jsx)(e52,{label:"customerId",value:null!=t.customerId?String(t.customerId):"",placeholder:"缺省 = customer.list[0]",onChange:e=>{let i=e50(e);l({...t,customerId:i})}}),(0,eH.jsx)(e52,{label:"productPicker.productId",value:null!=a.productId?String(a.productId):"",placeholder:"缺省 = products[0].id",onChange:e=>r({productId:e50(e)})}),(0,eH.jsx)(e52,{label:"productPicker.variantIndex",value:null!=a.variantIndex?String(a.variantIndex):"",placeholder:"缺省 0",onChange:e=>r({variantIndex:e50(e)})}),(0,eH.jsx)(e52,{label:"productPicker.num",value:null!=a.num?String(a.num):"",placeholder:"缺省 1",onChange:e=>r({num:e50(e)})})]})}function e53(e){let{value:t,onChange:l}=e,i=void 0===t.contactsInfo?"":null===t.contactsInfo?"null":JSON.stringify(t.contactsInfo);return(0,eH.jsxs)("div",{className:"sales-sdk-demo__advanced-form sales-sdk-demo__advanced-form--meta",children:[(0,eH.jsx)(e52,{label:"orderNote(sales.setOrderNote)",value:t.orderNote??"",placeholder:"留空 = 使用 fixture 默认;填 __skip__ 跳过步骤",onChange:e=>{let i=e.trim();if("__skip__"===i||!i){let{orderNote:e,...i}=t;l(i);return}l({...t,orderNote:i})}}),(0,eH.jsx)(e52,{label:"shopDiscount(sales.setShopDiscount)",value:null!=t.shopDiscount?String(t.shopDiscount):"",placeholder:"如 5 或 5.00;填 __skip__ 跳过步骤",onChange:e=>{let i=e.trim();if("__skip__"===i||!i){let{shopDiscount:e,...i}=t;l(i);return}let a=Number(i);l({...t,shopDiscount:Number.isFinite(a)?a:i})}}),(0,eH.jsxs)("label",{className:"sales-sdk-demo__field",children:[(0,eH.jsx)("span",{children:"contactsInfo(sales.setContactsInfo,JSON)"}),(0,eH.jsx)("textarea",{className:"sales-sdk-demo__textarea",value:i,placeholder:'如 {"name":"Demo"};填 __skip__ 跳过;填 null 清空',rows:3,onChange:e=>{let i=e.target.value.trim();if("__skip__"===i||""===i){let{contactsInfo:e,...i}=t;l(i);return}if("null"===i)return void l({...t,contactsInfo:null});try{let e=JSON.parse(i);if(null===e||"object"!=typeof e||Array.isArray(e))throw Error("contactsInfo 须为 JSON 对象或 null");l({...t,contactsInfo:e})}catch{}}})]})]})}function e58(e){let{value:t,onChange:l}=e;return(0,eH.jsxs)(eH.Fragment,{children:[(0,eH.jsx)(e52,{label:"orderId",value:null!=t.orderId?String(t.orderId):"",placeholder:"使用 fixture 默认值",onChange:e=>l({...t,orderId:e50(e)})}),(0,eH.jsx)(e53,{value:t,onChange:l}),(0,eH.jsx)(e54,{value:t,onChange:l})]})}let e56=e=>(0,eH.jsx)("div",{className:"sales-sdk-demo__advanced",children:(0,eH.jsx)(eT.Collapse,{ghost:!0,items:[{key:"adv",label:"高级配置(覆盖 fixture)",children:"detail"===e.variant?(0,eH.jsx)(e51,{value:e.value,onChange:e.onChange}):"create"===e.variant?(0,eH.jsx)(e54,{value:e.value,onChange:e.onChange}):(0,eH.jsx)(e58,{value:e.value,onChange:e.onChange})}]})}),e55=e=>{let{initialOrderId:t}=e,l=exe(),i=exr(),a=eND(),n=eC2(),r=eC0(),o=(0,eC.useMemo)(()=>({...e5W,...t?{orderId:t}:{}}),[t]),[s,d]=(0,eC.useState)({}),c=(0,eC.useMemo)(()=>s?{...o,...s}:o,[o,s]),[u,p]=(0,eC.useState)([]),[m,g]=(0,eC.useState)(!1),[h,v]=(0,eC.useState)("confirmed"),[f,y]=(0,eC.useState)(!1);ew$(n.summary);let b=e=>{p(t=>[...t,e])},x=async()=>{if(!Number.isFinite(c.orderId)||c.orderId<=0)return void b({status:"error",message:"orderId 必须为正整数"});g(!0),b({status:"running",message:`loadDetail(${c.orderId}) running...`});try{let e=await l.loadDetail(c.orderId);b({status:"success",message:`loadDetail(${c.orderId}) success
57
57
  ${e57(e)}`})}catch(e){b({status:"error",message:`loadDetail(${c.orderId}) failed
58
58
  ${String((null==e?void 0:e.message)??e)}`})}finally{g(!1)}},k=async()=>{let e=h.trim();if(!e)return void b({status:"error",message:"appointment_status 不能为空"});y(!0),b({status:"running",message:`setBookingStatus(${e}) running...`});try{let t=await l.setBookingStatus(e);b({status:"success",message:`setBookingStatus(${e}) success
59
59
  ${e57(t)}`})}catch(t){b({status:"error",message:`setBookingStatus(${e}) failed