@lockerverse/react 0.2.103 → 0.2.105

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 (44) hide show
  1. package/README.md +4 -0
  2. package/dist/auction-checkout.css +6 -73
  3. package/dist/auction-data.js +1 -1
  4. package/dist/auction-data.js.map +1 -1
  5. package/dist/auction-item.d.ts.map +1 -1
  6. package/dist/auction-item.js +1 -1
  7. package/dist/auction-item.js.map +1 -1
  8. package/dist/auctions.d.ts.map +1 -1
  9. package/dist/auctions.js +1 -1
  10. package/dist/auctions.js.map +1 -1
  11. package/dist/form-controls.css +114 -0
  12. package/dist/form-skeleton.js +2 -0
  13. package/dist/form-skeleton.js.map +1 -0
  14. package/dist/form-ui.css +25 -9
  15. package/dist/format-money.js +2 -0
  16. package/dist/format-money.js.map +1 -0
  17. package/dist/host-callback.js +1 -1
  18. package/dist/host-callback.js.map +1 -1
  19. package/dist/immutable-resource-identity.js +1 -1
  20. package/dist/immutable-resource-identity.js.map +1 -1
  21. package/dist/lockerverse-auction.js +1 -1
  22. package/dist/lockerverse-auction.js.map +1 -1
  23. package/dist/lockerverse-donate-launcher.js +1 -1
  24. package/dist/lockerverse-donate-launcher.js.map +1 -1
  25. package/dist/lockerverse-payment.js +1 -1
  26. package/dist/lockerverse-payment.js.map +1 -1
  27. package/dist/payment-form.d.ts +1 -0
  28. package/dist/payment-form.d.ts.map +1 -1
  29. package/dist/phone-field.css +89 -0
  30. package/dist/select-control.css +18 -0
  31. package/dist/signup.css +1 -60
  32. package/dist/signup.d.ts.map +1 -1
  33. package/dist/signup.js +1 -1
  34. package/dist/signup.js.map +1 -1
  35. package/dist/stripe-loader.js +2 -0
  36. package/dist/stripe-loader.js.map +1 -0
  37. package/dist/styles.css +6 -232
  38. package/dist/use-auction-boundary.js +1 -1
  39. package/dist/use-auction-boundary.js.map +1 -1
  40. package/dist/use-lockerverse-auctions.js +1 -1
  41. package/dist/use-lockerverse-auctions.js.map +1 -1
  42. package/package.json +5 -5
  43. package/dist/phone.js +0 -2
  44. package/dist/phone.js.map +0 -1
package/README.md CHANGED
@@ -257,6 +257,10 @@ const widget = useLockerverseWidget({
257
257
 
258
258
  ## Styling
259
259
 
260
+ Auction checkout, payment, and signup use common email, phone, field-error, and checkbox controls. Payment and signup share the custom-field renderer. Phone fields use the lightweight payment/signup country list, normalization, and Valibot format validation. The shared phone control is imported directly, with no separate phone chunk or metadata library. Each flow keeps its existing field configuration and backend rules.
261
+
262
+ Payment and auction Stripe forms resolve the rendered SDK font and theme tokens before passing them to Stripe. Custom font files are not loaded into Stripe by a font family name alone. See [the shared form foundation](https://github.com/Lockerverse/lockerverse-sdk/blob/main/docs/shared-form-foundation.md) for module boundaries and bundle measurement.
263
+
260
264
  Use `theme="dark"` or `theme="light"`. Lockerverse applies the community branding returned by the widget API. Pass the same `LockerverseStyle` object to payment, signup, and donate launcher components.
261
265
 
262
266
  ```tsx
@@ -1,3 +1,6 @@
1
+ @import "./form-controls.css";
2
+ @import "./phone-field.css";
3
+
1
4
  .lockerverse-auctions .lockerverse-auctions__checkout {
2
5
  display: block;
3
6
  padding: 0;
@@ -101,27 +104,6 @@
101
104
  grid-template-columns: repeat(2, minmax(0, 1fr));
102
105
  gap: 16px;
103
106
  }
104
- .lockerverse-auctions__checkout .lockerverse-auctions__field {
105
- display: flex;
106
- flex-direction: column;
107
- gap: 8px;
108
- font-size: 14px;
109
- }
110
- .lockerverse-auctions__checkout .lockerverse-auctions__field input {
111
- width: 100%;
112
- min-width: 0;
113
- height: 48px;
114
- padding: 0 16px;
115
- font: inherit;
116
- color: var(--lockerverse-text);
117
- background: var(--lockerverse-bg);
118
- border: 1px solid #3a3944;
119
- border-radius: 18px;
120
- }
121
- .lockerverse-auctions__checkout-phone-help {
122
- font-size: 12px;
123
- color: var(--lockerverse-muted);
124
- }
125
107
  .lockerverse-auctions__checkout-section {
126
108
  display: grid;
127
109
  gap: 12px;
@@ -151,14 +133,9 @@
151
133
  align-items: flex-start;
152
134
  cursor: pointer;
153
135
  }
154
- .lockerverse-auctions__checkout
155
- .lockerverse-auctions__checkout-checkbox
156
- > input {
157
- flex: 0 0 16px;
158
- width: 16px;
159
- height: 16px;
160
- margin: 4px 0 0;
161
- accent-color: var(--lockerverse-accent);
136
+ /* The label owns alignment; the shared checkbox owns size and appearance. */
137
+ .lockerverse-auctions__checkout-checkbox > input {
138
+ margin-top: 4px;
162
139
  }
163
140
  .lockerverse-auctions__checkout-checkbox > span {
164
141
  display: grid;
@@ -220,47 +197,3 @@
220
197
  grid-template-columns: minmax(0, 1fr);
221
198
  }
222
199
  }
223
-
224
- .lockerverse-auctions__phone {
225
- display: flex;
226
- width: 100%;
227
- min-width: 0;
228
- }
229
- .lockerverse-auctions__phone-country {
230
- position: relative;
231
- display: inline-flex;
232
- flex-shrink: 0;
233
- align-items: center;
234
- padding: 0 10px;
235
- color: var(--lockerverse-muted);
236
- background: var(--lockerverse-bg);
237
- border: 1px solid #3a3944;
238
- border-radius: 18px 0 0 18px;
239
- }
240
- .lockerverse-auctions__phone-country > span {
241
- display: inline-flex;
242
- gap: 5px;
243
- align-items: center;
244
- white-space: nowrap;
245
- }
246
- .lockerverse-auctions__phone-country select {
247
- position: absolute;
248
- inset: 0;
249
- width: 100%;
250
- cursor: pointer;
251
- opacity: 0;
252
- }
253
- .lockerverse-auctions__phone-country:focus-within {
254
- z-index: 1;
255
- outline: 2px solid var(--lockerverse-accent);
256
- outline-offset: 2px;
257
- }
258
- .lockerverse-auctions__phone-flag {
259
- width: 20px;
260
- overflow: hidden;
261
- font-size: 17px;
262
- }
263
- .lockerverse-auctions__checkout .lockerverse-auctions__phone input {
264
- margin-left: -1px;
265
- border-radius: 0 18px 18px 0;
266
- }
@@ -1,2 +1,2 @@
1
- import{t as e}from"./immutable-resource-identity.js";import{t}from"./use-lockerverse-auctions.js";import{useCallback as n,useEffect as r,useRef as i,useState as a}from"react";import{createLockerverseAuctionClient as o}from"@lockerverse/sdk/auctions";function s(t,s){e(`auction`,{apiBaseUrl:t.apiBaseUrl,communitySlug:t.communitySlug,environment:t.environment,slug:s});let c=i(t.onError);c.current=t.onError;let[l]=a(()=>o({...t,onError:e=>c.current?.(e)})),u=i(0),[d,f]=a(0),[p,m]=a({auction:null,error:null,loading:!0});r(()=>{let e=!0,t=u.current;return l.load(s).then(n=>{e&&t===u.current&&m({auction:n,error:null,loading:!1})},n=>{e&&t===u.current&&m(e=>({...e,error:n,loading:!1}))}),()=>{e=!1}},[l,s,d]);let h=n(()=>{u.current+=1,m(e=>({...e,error:null,loading:!0})),f(e=>e+1)},[]);return{...p,client:l,refresh:h}}export{s as useLockerverseAuction,t as useLockerverseAuctions};
1
+ import{t as e}from"./immutable-resource-identity.js";import{t}from"./use-lockerverse-auctions.js";import{useCallback as n,useEffect as r,useRef as i,useState as a}from"react";import{createLockerverseAuctionClient as o}from"@lockerverse/sdk/auctions";function s(t,s){e(`auction`,{apiBaseUrl:t.apiBaseUrl,communitySlug:t.communitySlug,environment:t.environment,mediaBaseUrl:t.mediaBaseUrl,slug:s});let c=i(t.onError);c.current=t.onError;let[l]=a(()=>o({...t,onError:e=>c.current?.(e)})),u=i(0),[d,f]=a(0),[p,m]=a({auction:null,error:null,loading:!0});r(()=>{let e=!0,t=u.current;return l.load(s).then(n=>{e&&t===u.current&&m({auction:n,error:null,loading:!1})},n=>{e&&t===u.current&&m(e=>({...e,error:n,loading:!1}))}),()=>{e=!1}},[l,s,d]);let h=n(()=>{u.current+=1,m(e=>({...e,error:null,loading:!0})),f(e=>e+1)},[]);return{...p,client:l,refresh:h}}export{s as useLockerverseAuction,t as useLockerverseAuctions};
2
2
  //# sourceMappingURL=auction-data.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auction-data.js","names":[],"sources":["../src/use-lockerverse-auction.ts"],"sourcesContent":["import {\n type CreateLockerverseAuctionOptions,\n createLockerverseAuctionClient,\n type LockerverseAuction,\n type LockerverseAuctionClient,\n type LockerverseSdkError,\n} from \"@lockerverse/sdk/auctions\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useImmutableResourceIdentity } from \"./immutable-resource-identity.ts\";\n\nexport type UseLockerverseAuctionResult = {\n client: LockerverseAuctionClient;\n /** Last successful snapshot, retained during refresh and refresh errors. */\n auction: LockerverseAuction | null;\n loading: boolean;\n error: LockerverseSdkError | null;\n refresh: () => void;\n};\n\n/** Load one auction by slug without requesting the community auction list. */\nexport function useLockerverseAuction(\n options: CreateLockerverseAuctionOptions,\n auctionSlug: string\n): UseLockerverseAuctionResult {\n useImmutableResourceIdentity(\"auction\", {\n apiBaseUrl: options.apiBaseUrl,\n communitySlug: options.communitySlug,\n environment: options.environment,\n slug: auctionSlug,\n });\n const onErrorRef = useRef(options.onError);\n onErrorRef.current = options.onError;\n const [client] = useState(() =>\n createLockerverseAuctionClient({\n ...options,\n onError: (error) => onErrorRef.current?.(error),\n })\n );\n const generation = useRef(0);\n const [revision, setRevision] = useState(0);\n const [state, setState] = useState<\n Pick<UseLockerverseAuctionResult, \"auction\" | \"loading\" | \"error\">\n >({ auction: null, error: null, loading: true });\n\n useEffect(() => {\n let active = true;\n const requestGeneration = generation.current;\n client.load(auctionSlug).then(\n (auction) => {\n if (active && requestGeneration === generation.current) {\n setState({ auction, error: null, loading: false });\n }\n },\n (error: LockerverseSdkError) => {\n if (active && requestGeneration === generation.current) {\n setState((current) => ({ ...current, error, loading: false }));\n }\n }\n );\n return () => {\n active = false;\n };\n }, [client, auctionSlug, revision]);\n\n const refresh = useCallback(() => {\n generation.current += 1;\n setState((current) => ({ ...current, error: null, loading: true }));\n setRevision((current) => current + 1);\n }, []);\n\n return { ...state, client, refresh };\n}\n"],"mappings":"0PAoBA,SAAgB,EACd,EACA,EAC6B,CAC7B,EAA6B,UAAW,CACtC,WAAY,EAAQ,WACpB,cAAe,EAAQ,cACvB,YAAa,EAAQ,YACrB,KAAM,CACR,CAAC,EACD,IAAM,EAAa,EAAO,EAAQ,OAAO,EACzC,EAAW,QAAU,EAAQ,QAC7B,GAAM,CAAC,GAAU,MACf,EAA+B,CAC7B,GAAG,EACH,QAAU,GAAU,EAAW,UAAU,CAAK,CAChD,CAAC,CACH,EACM,EAAa,EAAO,CAAC,EACrB,CAAC,EAAU,GAAe,EAAS,CAAC,EACpC,CAAC,EAAO,GAAY,EAExB,CAAE,QAAS,KAAM,MAAO,KAAM,QAAS,EAAK,CAAC,EAE/C,MAAgB,CACd,IAAI,EAAS,GACP,EAAoB,EAAW,QAarC,OAZA,EAAO,KAAK,CAAW,CAAC,CAAC,KACtB,GAAY,CACP,GAAU,IAAsB,EAAW,SAC7C,EAAS,CAAE,UAAS,MAAO,KAAM,QAAS,EAAM,CAAC,CAErD,EACC,GAA+B,CAC1B,GAAU,IAAsB,EAAW,SAC7C,EAAU,IAAa,CAAE,GAAG,EAAS,QAAO,QAAS,EAAM,EAAE,CAEjE,CACF,MACa,CACX,EAAS,EACX,CACF,EAAG,CAAC,EAAQ,EAAa,CAAQ,CAAC,EAElC,IAAM,EAAU,MAAkB,CAChC,EAAW,SAAW,EACtB,EAAU,IAAa,CAAE,GAAG,EAAS,MAAO,KAAM,QAAS,EAAK,EAAE,EAClE,EAAa,GAAY,EAAU,CAAC,CACtC,EAAG,CAAC,CAAC,EAEL,MAAO,CAAE,GAAG,EAAO,SAAQ,SAAQ,CACrC"}
1
+ {"version":3,"file":"auction-data.js","names":[],"sources":["../src/use-lockerverse-auction.ts"],"sourcesContent":["import {\n type CreateLockerverseAuctionOptions,\n createLockerverseAuctionClient,\n type LockerverseAuction,\n type LockerverseAuctionClient,\n type LockerverseSdkError,\n} from \"@lockerverse/sdk/auctions\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useImmutableResourceIdentity } from \"./immutable-resource-identity.ts\";\n\nexport type UseLockerverseAuctionResult = {\n client: LockerverseAuctionClient;\n /** Last successful snapshot, retained during refresh and refresh errors. */\n auction: LockerverseAuction | null;\n loading: boolean;\n error: LockerverseSdkError | null;\n refresh: () => void;\n};\n\n/** Load one auction by slug without requesting the community auction list. */\nexport function useLockerverseAuction(\n options: CreateLockerverseAuctionOptions,\n auctionSlug: string\n): UseLockerverseAuctionResult {\n useImmutableResourceIdentity(\"auction\", {\n apiBaseUrl: options.apiBaseUrl,\n communitySlug: options.communitySlug,\n environment: options.environment,\n mediaBaseUrl: options.mediaBaseUrl,\n slug: auctionSlug,\n });\n const onErrorRef = useRef(options.onError);\n onErrorRef.current = options.onError;\n const [client] = useState(() =>\n createLockerverseAuctionClient({\n ...options,\n onError: (error) => onErrorRef.current?.(error),\n })\n );\n const generation = useRef(0);\n const [revision, setRevision] = useState(0);\n const [state, setState] = useState<\n Pick<UseLockerverseAuctionResult, \"auction\" | \"loading\" | \"error\">\n >({ auction: null, error: null, loading: true });\n\n useEffect(() => {\n let active = true;\n const requestGeneration = generation.current;\n client.load(auctionSlug).then(\n (auction) => {\n if (active && requestGeneration === generation.current) {\n setState({ auction, error: null, loading: false });\n }\n },\n (error: LockerverseSdkError) => {\n if (active && requestGeneration === generation.current) {\n setState((current) => ({ ...current, error, loading: false }));\n }\n }\n );\n return () => {\n active = false;\n };\n }, [client, auctionSlug, revision]);\n\n const refresh = useCallback(() => {\n generation.current += 1;\n setState((current) => ({ ...current, error: null, loading: true }));\n setRevision((current) => current + 1);\n }, []);\n\n return { ...state, client, refresh };\n}\n"],"mappings":"0PAoBA,SAAgB,EACd,EACA,EAC6B,CAC7B,EAA6B,UAAW,CACtC,WAAY,EAAQ,WACpB,cAAe,EAAQ,cACvB,YAAa,EAAQ,YACrB,aAAc,EAAQ,aACtB,KAAM,CACR,CAAC,EACD,IAAM,EAAa,EAAO,EAAQ,OAAO,EACzC,EAAW,QAAU,EAAQ,QAC7B,GAAM,CAAC,GAAU,MACf,EAA+B,CAC7B,GAAG,EACH,QAAU,GAAU,EAAW,UAAU,CAAK,CAChD,CAAC,CACH,EACM,EAAa,EAAO,CAAC,EACrB,CAAC,EAAU,GAAe,EAAS,CAAC,EACpC,CAAC,EAAO,GAAY,EAExB,CAAE,QAAS,KAAM,MAAO,KAAM,QAAS,EAAK,CAAC,EAE/C,MAAgB,CACd,IAAI,EAAS,GACP,EAAoB,EAAW,QAarC,OAZA,EAAO,KAAK,CAAW,CAAC,CAAC,KACtB,GAAY,CACP,GAAU,IAAsB,EAAW,SAC7C,EAAS,CAAE,UAAS,MAAO,KAAM,QAAS,EAAM,CAAC,CAErD,EACC,GAA+B,CAC1B,GAAU,IAAsB,EAAW,SAC7C,EAAU,IAAa,CAAE,GAAG,EAAS,QAAO,QAAS,EAAM,EAAE,CAEjE,CACF,MACa,CACX,EAAS,EACX,CACF,EAAG,CAAC,EAAQ,EAAa,CAAQ,CAAC,EAElC,IAAM,EAAU,MAAkB,CAChC,EAAW,SAAW,EACtB,EAAU,IAAa,CAAE,GAAG,EAAS,MAAO,KAAM,QAAS,EAAK,EAAE,EAClE,EAAa,GAAY,EAAU,CAAC,CACtC,EAAG,CAAC,CAAC,EAEL,MAAO,CAAE,GAAG,EAAO,SAAQ,SAAQ,CACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"auction-item.d.ts","names":[],"sources":["../src/auction-item-types.ts","../src/lockerverse-auction-item.tsx"],"mappings":";;;;;KAaY;EACV;EACA;EACA,MAAM;EACN,SAAS,YAAY;EACrB,SAAS;EACT,YAAY;;KAGF;EACV,SAAS;EACT,QAAQ;EACR;;EAEA;;;EAGA,2BAA2B;EAC3B;EACA;EACA,QAAQ;EACR,QAAQ;EACR,eAAe;;EAEf,kBAAkB,QAAQ;;EAE1B,sBAAsB,QAAQ;EAC9B,4BACE,UAAU;EAEZ,eAAe;;EAEf,iBAAiB;;;;iBC4TH,uBAAuB,OAAO,8CAA2B,IAAA"}
1
+ {"version":3,"file":"auction-item.d.ts","names":[],"sources":["../src/auction-item-types.ts","../src/lockerverse-auction-item.tsx"],"mappings":";;;;;KAaY;EACV;EACA;EACA,MAAM;EACN,SAAS,YAAY;EACrB,SAAS;EACT,YAAY;;KAGF;EACV,SAAS;EACT,QAAQ;EACR;;EAEA;;;EAGA,2BAA2B;EAC3B;EACA;EACA,QAAQ;EACR,QAAQ;EACR,eAAe;;EAEf,kBAAkB,QAAQ;;EAE1B,sBAAsB,QAAQ;EAC9B,4BACE,UAAU;EAEZ,eAAe;;EAEf,iBAAiB;;;;iBCmUH,uBAAuB,OAAO,8CAA2B,IAAA"}
@@ -1,2 +1,2 @@
1
- import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./use-auction-boundary.js";import{c,s as l,t as u}from"./host-callback.js";import{ArrowRight as d,ChevronDown as f,ChevronLeft as p,ChevronRight as m,Clock3 as h,Gavel as g,Pause as _,Play as v,ShieldCheck as y,TimerReset as b,X as x}from"lucide-react";import{useCallback as S,useEffect as C,useId as w,useMemo as T,useRef as E,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";import{LockerverseSdkError as j,calculateLockerverseAuctionPricing as M,getLockerverseAuctionMinimumBid as N}from"@lockerverse/sdk/auctions";import{AddressElement as P,Elements as F,PaymentElement as I,useElements as L,useStripe as R}from"@stripe/react-stripe-js";import{loadStripe as z}from"@stripe/stripe-js/pure/index.js";import{safeParse as B}from"valibot";import{AsYouType as V,getCountries as H,getCountryCallingCode as U,parsePhoneNumberFromString as W}from"libphonenumber-js/max";import{Dialog as G}from"@base-ui/react/dialog";import K from"embla-carousel-autoplay";import q from"embla-carousel-react";const J=/^00/,Y=new Intl.DisplayNames([`en`],{type:`region`}),X=H().map(e=>({country:e,label:Y.of(e)??e})).sort((e,t)=>e.label.localeCompare(t.label,`en`));function Z(e,t){let n=e.normalize(`NFKC`).trim().replace(J,`+`),r=n.startsWith(`+`)?void 0:W(n,{defaultCountry:t,extract:!1});if(r?.isValid()&&!r.ext)return r;let i=W(n,{extract:!1})??W(`+${n}`,{extract:!1});return i?.isValid()&&!i.ext?i:null}function ee(e){return String.fromCodePoint(...Array.from(e,e=>127397+e.charCodeAt(0)))}function te({id:e,value:t,onChange:n}){let r=W(t),[i,a]=D(r?.country??`US`),[o,s]=D(r?.formatNational()??t),c=E(null),l=E(t);C(()=>{if(t===l.current)return;let e=W(t);l.current=t,a(e?.country??`US`),s((e?e.formatNational():null)??t)},[t]),C(()=>{c.current?.setCustomValidity(o&&!Z(o,i)?`Enter a valid phone number.`:``)},[i,o]);function u(e,t,r=!1){let i=e.normalize(`NFKC`).trim().replace(J,`+`),o=Z(e,t),c=i.startsWith(`+`)?o?.country??t:t,u=(o?o.formatNational():null)??new V(c).input(i);a(c),s(r?e:u),l.current=o?o.number:``,n(l.current)}return A(`div`,{className:`lockerverse-auctions__phone`,dir:`ltr`,children:[A(`div`,{className:`lockerverse-auctions__phone-country`,children:[A(`span`,{"aria-hidden":`true`,children:[k(`span`,{className:`lockerverse-auctions__phone-flag`,children:ee(i)}),` `,`+`,U(i),` `,k(f,{"aria-hidden":`true`,size:14})]}),k(`select`,{"aria-label":`Phone number country`,onChange:e=>{let t=X.find(t=>t.country===e.target.value);t&&u(o,t.country)},value:i,children:X.map(e=>A(`option`,{value:e.country,children:[e.label,` +`,U(e.country)]},e.country))})]}),k(`input`,{autoComplete:`tel-national`,id:e,onChange:e=>u(e.target.value,i,e.target.value.length<o.length),onPaste:e=>{let t=Z(e.clipboardData.getData(`text`),i);t&&(e.preventDefault(),u(t.number,t.country??i))},placeholder:`(201) 555-0123`,ref:c,required:!0,type:`tel`,value:o})]})}function ne(e){return{business:{name:`Lockerverse`},fields:{billingDetails:{address:`never`,email:`never`,name:`never`,phone:`never`}},terms:{applePay:e?`auto`:`never`,auBecsDebit:`never`,bancontact:`never`,card:`always`,cashapp:`never`,googlePay:`never`,ideal:`never`,paypal:e?`auto`:`never`,sepaDebit:`never`,sofort:`never`,usBankAccount:`never`},wallets:{applePay:e?`auto`:`never`,googlePay:`never`}}}function re(e){let{isPurchase:t,item:r,pricing:i,id:a}=e;return A(`form`,{className:`lockerverse-auctions__checkout`,onSubmit:e.onSubmit,children:[A(`div`,{className:`lockerverse-auctions__checkout-header`,children:[A(`div`,{className:`lockerverse-auctions__checkout-navigation`,children:[k(`button`,{"aria-label":`Back`,className:`lockerverse-auctions__checkout-back`,disabled:!e.onBack,onClick:e.onBack,type:`button`,children:k(p,{"aria-hidden":`true`,size:20})}),A(`div`,{children:[k(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Step 2 of 2`}),k(`p`,{children:t?`Secure checkout`:`Secure payment method`})]})]}),k(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:e.communityName}),k(`h2`,{children:t?`Finalize your purchase.`:`Finalize your bid authorization.`}),k(`p`,{className:`lockerverse-auctions__checkout-summary`,children:t?A(O,{children:[`Pay `,k(`strong`,{children:n(i.totalCents)}),` for`,` `,e.quantity,` `,e.quantity===1?`item`:`items`,` of`,` `,k(`strong`,{children:r.name}),`. Your card is charged immediately once checkout succeeds.`]}):A(O,{children:[`Authorize a payment method for your bid of`,` `,k(`strong`,{children:n(i.subtotalCents)}),` on`,` `,k(`strong`,{children:r.name}),`. Your card is only charged if this bid wins the item.`]})}),r.collectShippingAddress&&A(`div`,{className:`lockerverse-auctions__checkout-physical`,children:[k(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Physical item`}),k(`p`,{children:`This item requires a delivery address. Billing details are used by default, and you can switch to a separate delivery address below if needed.`})]})]}),A(`div`,{className:`lockerverse-auctions__checkout-body`,children:[e.showFields&&A(`fieldset`,{disabled:e.locked,children:[A(`div`,{className:`lockerverse-auctions__checkout-contact`,children:[A(`label`,{className:`lockerverse-auctions__field`,htmlFor:`${a}-email`,children:[`Email`,k(`input`,{autoComplete:`email`,id:`${a}-email`,onChange:t=>e.onEmailChange(t.target.value),placeholder:`example@domain.com`,required:!0,type:`email`,value:e.email})]}),A(`label`,{className:`lockerverse-auctions__field`,htmlFor:`${a}-phone`,children:[`Phone Number`,k(te,{id:`${a}-phone`,onChange:e.onPhoneChange,value:e.phone})]})]}),A(`section`,{"aria-label":`Payment Information`,className:`lockerverse-auctions__checkout-section`,children:[A(`div`,{className:`lockerverse-auctions__checkout-section-heading`,children:[k(`h3`,{children:`Payment Information`}),k(`p`,{children:t?`Processed securely and charged immediately for this purchase.`:`Stored securely and charged only if your bid finishes on top.`})]}),k(I,{onLoadError:e.onPaymentLoadError,options:ne(t)})]}),A(`section`,{"aria-label":`Billing Details`,className:`lockerverse-auctions__checkout-section`,children:[k(`h3`,{children:`Billing Details`}),k(P,{onChange:e.onBillingChange,options:{mode:`billing`}}),k(`p`,{children:t?`Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.`:`Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.`})]}),r.collectShippingAddress&&A(`section`,{"aria-label":`Delivery Details`,className:`lockerverse-auctions__checkout-section`,children:[A(`label`,{className:`lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery`,children:[k(`input`,{checked:e.sameAsBilling,onChange:t=>e.onSameAsBillingChange(t.target.checked),type:`checkbox`}),A(`span`,{children:[k(`strong`,{children:`Delivery address is the same as billing`}),k(`span`,{children:`Leave this on for the fastest flow. Turn it off only if the delivery address should differ from the billing details above.`})]})]}),!e.sameAsBilling&&A(O,{children:[k(`h3`,{children:`Delivery Address`}),k(P,{onChange:e.onShippingChange,options:{mode:`shipping`}})]})]}),e.serviceFeeEnabled&&k(ie,{...e})]}),e.message&&k(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__notice`,role:`status`,children:e.message}),!e.isTerminal&&A(`div`,{className:`lockerverse-auctions__checkout-footer`,children:[A(`p`,{children:[t?`By continuing, you agree to be charged for this purchase.`:`By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.`,r.collectShippingAddress?` Your delivery details are stored with the ${t?`order`:`bid`} so the seller can fulfill the item after payment.`:``]}),A(`button`,{className:`lockerverse-auctions__button lockerverse-auctions__checkout-submit`,disabled:e.submitDisabled,type:`submit`,children:[e.buttonText,k(d,{"aria-hidden":`true`,size:16})]})]})]})]})}function ie(e){let{isPurchase:t,pricing:r}=e;return k(`section`,{"aria-label":`Processing fees`,className:`lockerverse-auctions__checkout-section`,children:e.onIncludeServiceFeeChange?A(`label`,{className:`lockerverse-auctions__checkout-checkbox`,children:[k(`input`,{checked:e.includeServiceFee,onChange:t=>e.onIncludeServiceFeeChange?.(t.target.checked),type:`checkbox`}),A(`span`,{children:[A(`strong`,{children:[t?`Add`:`If I win, add`,` `,n(e.serviceFeeCents),` to help cover processing fees`]}),A(`span`,{children:[t?`Total`:`Total if I win`,`:`,` `,n(r.totalCents)]})]})]}):A(`p`,{children:[t?`Total`:`Total if I win`,`:`,` `,n(r.totalCents)]})})}function Q(e,t,n){return M(e,t.saleMode===`buy_now`?(t.buyNowPriceAmount??0)*n.quantity:n.amount,n.includeServiceFee)}function ae(e,t,n){if(e.status!==`active`||t.status!==`active`||Date.parse(e.endAt)<=Date.now())return`This item is not accepting bids or purchases.`;if(t.saleMode===`hybrid`)return`This item type is not supported for checkout.`;if(t.saleMode===`buy_now`){if(t.isSoldOut||t.availableQuantity===0)return`This item is sold out.`;if(!(t.buyNowPriceAmount&&Number.isSafeInteger(n.quantity))||n.quantity<1||t.availableQuantity!==null&&n.quantity>t.availableQuantity)return`Select an available quantity.`}else if(!Number.isSafeInteger(n.amount)||n.amount%100!=0||n.amount<N(t))return`Enter a whole-dollar bid at or above the minimum bid.`;return null}function oe(e,t,n,r,i){return e.payment?.publishableKey!==t.payment?.publishableKey||e.payment?.connectedAccountId!==t.payment?.connectedAccountId||e.serviceFeeEnabled!==t.serviceFeeEnabled||n.saleMode!==r.saleMode||n.collectShippingAddress!==r.collectShippingAddress||JSON.stringify(Q(e,n,i))!==JSON.stringify(Q(t,r,i))}function se(e){return{expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function ce({stripe:e,elements:t,email:n,phone:r,billing:i,shipping:a,collectShippingAddress:o}){if(!(i?.complete&&i.value.name.trim()))throw Error(`Complete your billing name and address.`);if(o&&!(a?.complete&&a.value.name.trim()))throw Error(`Complete your shipping name and address.`);let s=await t.submit();if(s.error)throw Error(s.error.message??`Check your payment details.`);let c=await e.createConfirmationToken({elements:t,params:{payment_method_data:{allow_redisplay:`always`,billing_details:{address:i.value.address,email:n,name:i.value.name,phone:r}},return_url:window.location.href,...o&&a?{shipping:{address:a.value.address,name:a.value.name,phone:r}}:void 0}});if(c.error||!c.confirmationToken)throw Error(c.error?.message??`Unable to prepare payment details.`);return c.confirmationToken.id}async function le(e,t){if(!t.requiresAction)return;if(!t.clientSecret)throw Error(`Payment confirmation is incomplete. Check its status before trying again.`);let n=await e.handleNextAction({clientSecret:t.clientSecret});if(n.error)throw Error(n.error.message??`Payment confirmation is incomplete.`)}function ue(e,t,n){return e===`busy`?n?`Processing...`:`Authorizing...`:e===`retry`?`Retry original purchase`:t?`Check purchase status`:n?`Buy Now`:`Authorize Bid`}function de(e){let{auction:t,item:n,selection:r,client:i,onReview:a,onBack:o}=e,s=R(),d=L(),f=w(),[p,m]=D(e.contact?.email??``),[h,g]=D(e.contact?.phone??``),[_,v]=D(!0),[y,b]=D(null),[x,S]=D(null),[T,O]=D(e.resumePurchase??null),[A,M]=D(e.resumePurchase?`pending`:`ready`),[N,P]=D(null),F=E(e.resumePurchase?.submission.clientRequestId??null),I=A===`complete`||A===`uncertain`,z=E(!1),V=E(!0),H=E(e);H.current=e;let U=E(!1);function W(e){V.current&&M(e),u(H.current.onInteractionLockChange,e!==`ready`&&e!==`complete`)}function G(e){V.current&&P(e)}function K(e){W(e===`bid`?`uncertain`:`pending`),G(e===`bid`?`We could not confirm your bid. Do not submit another bid until you check your email or contact the auction organizer.`:`We could not confirm the purchase result. Check its status using the same purchase request.`),U.current||(U.current=!0,u(H.current.onUncertain,e))}C(()=>(V.current=!0,()=>{V.current=!1}),[]);let q=!!(T??e.resumePurchase)||n.saleMode===`buy_now`,J=T?.pricing??e.resumePurchase?.pricing??Q(t,n,r),Y=T?.payment??e.resumePurchase?.payment??t.payment;function X(e){V.current&&O(e),u(H.current.onPurchaseRecoveryChange,e)}function Z(e){e.status===`paid`?(F.current=null,X(null),W(`complete`),G(`Purchase complete. Receipt: ${e.purchaseId}`),U.current||(U.current=!0,u(H.current.onPurchaseComplete,e))):e.status===`pending_payment`?(W(`pending`),G(`Your purchase is pending. Check its status before making another payment.`)):(F.current=null,X(null),W(`ready`),G(`This purchase is ${e.status.replaceAll(`_`,` `)}. You can start a new purchase.`))}async function ee(){if(!(s&&d&&t.payment))throw Error(`Payment details are still loading.`);let e=B(l,p),o=B(c,h);if(!(e.success&&o.success))throw Error(`Enter a valid email and phone number with its country code.`);let u=await i.load(t.slug);if(!V.current)return null;let f=u.items.find(e=>e.id===n.id);if(!f)return a(u,`This item is no longer available.`),null;let m=ae(u,f,r);if(m||oe(t,u,n,f,r))return a(u,m??`The checkout details changed. Review them before continuing.`),null;let g=await ce({billing:y,collectShippingAddress:n.collectShippingAddress,elements:d,email:e.output,phone:o.output,shipping:_?y:x,stripe:s});return V.current?{confirmationToken:g,email:e.output,includeServiceFee:r.includeServiceFee,phone:o.output,...se(J)}:null}async function te(e){let a=await i.createBid(t.slug,n.id,{...e,amount:r.amount});if(a.requiresAction){if(!(V.current&&s)){K(`bid`);return}await le(s,a)}W(`complete`),G(`Bid submitted. Watch your email for bid and auction updates.`),U.current||(U.current=!0,u(H.current.onBidSubmitted,a))}async function ne(e,r){if(e.requiresAction){if(!(V.current&&s)){K(`purchase`);return}await le(s,e);let a=await i.getPurchaseStatus(t.slug,n.id,r.submission.clientRequestId);a?Z(a):(W(`pending`),G(`Payment status is not available yet. Check again shortly.`));return}Z(e),!V.current&&e.status===`pending_payment`&&K(`purchase`)}async function ie(e){let r=await i.getPurchaseStatus(t.slug,n.id,e.submission.clientRequestId);if(r)await ne(r,e);else{if(!V.current){K(`purchase`);return}W(`retry`),G(`No purchase is recorded yet. You can retry the original purchase with the same request ID.`)}}async function de(e,r){let a=await i.getPurchaseStatus(t.slug,n.id,r.submission.clientRequestId);if(a){await ne(a,r);return}X(null),W(`ready`),G(`The purchase was rejected. Review the item and payment details before trying again. (${e.status??`validation`})`)}async function $(e,t,n,r){let i=t&&(!(e instanceof j)||e.recoveryRecommended);if(G(e instanceof Error?e.message:`Unable to complete this request.`),q&&n){if(!r&&e instanceof j&&!e.recoveryRecommended)try{await de(e,n);return}catch{}K(`purchase`)}else i?K(`bid`):W(`ready`)}function fe(){return F.current??=globalThis.crypto.randomUUID(),F.current}function pe(){return V.current?!0:(T||(X(null),W(`ready`)),!1)}async function me(e,r){if(r){await ie(e);return}pe()&&await ne(await i.createPurchase(t.slug,n.id,e.submission),e)}let he=s&&d&&Y;async function ge(e){if(e.preventDefault(),z.current||I)return;if(!he){G(`Payment details are still loading.`);return}let i=A===`retry`;z.current=!0,U.current=!1,W(`busy`),G(null);let a=!1,o=T;try{if(!o){let e=await ee();if(!(e&&V.current)){W(`ready`);return}if(!q){a=!0,await te(e);return}o=Object.freeze({auctionId:t.id,item:n,itemId:n.id,payment:Object.freeze({...he}),pricing:J,submission:Object.freeze({...e,clientRequestId:fe(),paymentMethodTypes:Object.freeze([`card`]),quantity:r.quantity})}),X(o)}a=!0,await me(o,!!T&&!i)}catch(e){await $(e,a,o,T!==null&&!i)}finally{z.current=!1}}let _e=ue(A,T!==null,q),ve=A!==`ready`;return k(re,{buttonText:_e,communityName:e.communityName??t.name,email:p,id:f,includeServiceFee:r.includeServiceFee,isPurchase:q,isTerminal:I,item:n,locked:ve,message:N,onBack:A===`ready`?o:void 0,onBillingChange:b,onEmailChange:t=>{m(t),e.onContactChange?.({email:t,phone:h})},onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPaymentLoadError:()=>G(`Unable to load payment form.`),onPhoneChange:t=>{g(t),e.onContactChange?.({email:p,phone:t})},onSameAsBillingChange:v,onShippingChange:S,onSubmit:ge,phone:h,pricing:J,quantity:r.quantity,sameAsBilling:_,serviceFeeCents:T?J.serviceFeeCents:Q(t,n,{...r,includeServiceFee:t.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:t.serviceFeeEnabled,showFields:!(T||I),submitDisabled:A===`busy`||!s||!d})}const $=6e3;function fe(e,t){let n=E($),r=E(null),[i,a]=D($),o=T(()=>K({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=q({duration:t?0:25,loop:!0},[o]),l=S(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/$})`)},[]),u=S(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min($,e))),o.stop(),l()},[o,l]),d=S(()=>{n.current=$,a($),o.reset(),l()},[o,l]);return C(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),C(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min($,i)),l(),t=requestAnimationFrame(r))},i=()=>{cancelAnimationFrame(t),e&&(t=requestAnimationFrame(r))},a=()=>cancelAnimationFrame(t),s=()=>{e&&o.play()};return c.on(`select`,d).on(`reInit`,s).on(`autoplay:timerset`,i).on(`autoplay:timerstopped`,a),l(),i(),()=>{a(),c.off(`select`,d).off(`reInit`,s).off(`autoplay:timerset`,i).off(`autoplay:timerstopped`,a)}},[c,o,e,n,d,l]),{embla:c,freeze:u,progressRef:r,reset:d,viewportRef:s}}function pe({photos:e,name:t,selected:n,paused:i=!1,photoButtonRef:a,onSelect:o,onExpand:s}){let c=E(null),l=E(null),u=E([]),[d,f]=D(!0),[h,g]=D(!1),[y,b]=D(!1),[x,S]=D(!1),[w,T]=D(!1),{ref:j,visible:M}=r(),[N,P]=D(!1),[F,I]=D(!0),L=E(null),R=`lockerverse-auction-gallery__control ${F||N||y?`is-visible`:``}`,z=()=>{L.current&&clearTimeout(L.current),L.current=setTimeout(()=>P(!1),2e3)},B=e=>{if(e.pointerType!==`mouse`){I(!0);return}P(!0),L.current&&clearTimeout(L.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||z()};C(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>I(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(L.current??void 0)}},[]);let V=!(i||d||h||y||x||w)&&M,H=e.length,U=H?(n%H+H)%H:0,{viewportRef:W,embla:G,progressRef:K,freeze:q,reset:J}=fe(V&&H>1,d);C(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>f(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),C(()=>{if(!G)return;let e=()=>o(G.selectedScrollSnap());return G.on(`select`,e).on(`reInit`,e),()=>{G.off(`select`,e).off(`reInit`,e)}},[G,o]),C(()=>{G&&G.selectedScrollSnap()!==U&&G.scrollTo(U,!0)},[G,U]),C(()=>{let e=()=>{document.hidden&&q()},t=()=>T(!1);return e(),document.addEventListener(`visibilitychange`,e,!0),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{document.removeEventListener(`visibilitychange`,e,!0),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[q]);let Y=e=>{G?.scrollTo((e+H)%H,d),J()};return C(()=>{let e=l.current;l.current=null,e&&document.activeElement===e&&j.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[U,j]),C(()=>{let e=c.current,t=u.current[U];if(!(e&&t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.left<n.left?e.scrollLeft-=n.left-r.left:r.right>n.right&&(e.scrollLeft+=r.right-n.right)},[U,H]),A(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||b(!1)},onFocusCapture:e=>b(e.target.matches(`:focus-visible`)),onKeyDown:e=>{H<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),e.target instanceof HTMLButtonElement&&e.target.classList.contains(`lockerverse-auction-gallery__photo`)&&(l.current=e.target),Y(U+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&g(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&g(!1)},ref:j,children:[H?A(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:B,onPointerLeave:z,onPointerMove:B,children:[k(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{q(),T(!0)},ref:W,children:k(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,n)=>k(`div`,{"aria-hidden":n!==U,className:`lockerverse-auction-gallery__slide`,children:k(`button`,{"aria-label":`View photo ${n+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{s(n)},ref:n===U?a:void 0,tabIndex:n===U?0:-1,type:`button`,children:k(`img`,{alt:`${t}, ${n+1} of ${H}`,className:`lockerverse-auction-gallery__image`,draggable:!1,height:900,loading:n===0||n===U||n===(U+1)%H?`eager`:`lazy`,sizes:`(max-width: 1280px) 100vw, 45vw`,src:e,width:1200})})},`${e}-${n}`))})}),H>1&&!d&&A(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[k(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:k(`div`,{className:`lockerverse-auction-gallery__progress`,ref:K,style:{transform:`scaleX(0)`}})}),k(`button`,{"aria-label":x?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${R}`,"data-gallery-control":!0,onClick:()=>S(e=>!e),title:x?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:k(x?v:_,{"aria-hidden":`true`,size:13})})]}),H>1&&A(O,{children:[k(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${R}`,"data-gallery-control":!0,onClick:()=>Y(U-1),type:`button`,children:k(p,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),k(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${R}`,"data-gallery-control":!0,onClick:()=>Y(U+1),type:`button`,children:k(m,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):k(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),H>1&&k(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:c,children:k(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>k(`button`,{"aria-label":`Show photo ${t+1} of ${H}`,"aria-pressed":U===t,className:`lockerverse-auction-gallery__thumbnail ${U===t?`is-selected`:``}`,onClick:()=>Y(t),ref:e=>{u.current[t]=e},type:`button`,children:k(`img`,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function me({images:e,fallbackImage:t,name:n}){let r=[...new Set(e.filter(Boolean))];!r.length&&t&&r.push(t);let[i,a]=D(0),[o,s]=D(!1),c=E(null),l=E(null),u=r.length,d=u?(i%u+u)%u:0;return A(O,{children:[k(pe,{name:n,onExpand:e=>{a(e),s(!0)},onSelect:a,paused:o,photoButtonRef:c,photos:r,selected:d}),u>0&&k(G.Root,{onOpenChange:s,open:o,children:A(G.Portal,{children:[k(G.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),A(G.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:c,onKeyDown:e=>{u<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),a((d+(e.key===`ArrowRight`?1:-1)+u)%u))},children:[A(G.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,d+1,` of `,u]}),A(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{l.current=null},onTouchEnd:e=>{let t=l.current;l.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||u<2)return;let r=n.clientX-t.x,i=n.clientY-t.y;Math.abs(r)>=45&&Math.abs(r)>Math.abs(i)*1.3&&a((d+(r<0?1:-1)+u)%u)},onTouchMove:e=>{e.touches.length!==1&&(l.current=null)},onTouchStart:e=>{let t=e.touches.item(0);l.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[k(`img`,{alt:`${n}, ${d+1} of ${u}`,height:900,src:r[d],width:1200}),o&&u>1&&k(`img`,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,src:r[(d+1)%u],width:1200})]}),k(G.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:k(x,{"aria-hidden":`true`,size:22})}),u>1&&A(O,{children:[k(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>a((d-1+u)%u),type:`button`,children:k(p,{"aria-hidden":`true`,size:28})}),k(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>a((d+1)%u),type:`button`,children:k(m,{"aria-hidden":`true`,size:28})})]})]})]})})]})}function he(e){return k(e===`Buy Now`?y:e===`Available`||e===`Increment`?b:g,{"aria-hidden":`true`,size:16})}function ge(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,n(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?n(e.maxBidAmount):`No bids`]]:[[`Current bid`,n(e.maxBidAmount??0)],[`Floor`,n(e.minBidAmount??0)],[`Increment`,n(e.bidIncrementAmount??100)]]}function _e({auction:r,item:i}){s(r.startAt,r.endAt);let[c,l]=D(!1),u=w(),d=e(r,i),p={active:`Closes`,draft:`Opens`,finished:`Closed`}[d],m=a(r,d),g=i.saleMode===`buy_now`,_=t(i.description??``).length>240,v=ge(i,d);return A(`section`,{className:`lockerverse-auctions__item-summary`,children:[k(me,{fallbackImage:i.image??r.configuration.image??r.community?.banner??r.community?.thumbnail??null,images:i.images,name:i.name}),A(`div`,{className:`lockerverse-auctions__item-copy`,children:[A(`p`,{className:`lockerverse-auctions__eyebrow`,children:[p,` `,m,` `,k(`span`,{"aria-hidden":`true`,children:` · `}),` Public item`]}),k(`h2`,{children:i.name}),i.description?A(`div`,{className:`lockerverse-auctions__item-description`,children:[k(o,{className:!c&&_?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:u}),_?A(`button`,{"aria-controls":u,"aria-expanded":c,className:`lockerverse-auctions__description-toggle`,onClick:()=>l(!c),type:`button`,children:[c?`Hide description`:`Read full description`,` `,k(f,{"aria-hidden":`true`,size:16,style:{transform:c?`rotate(180deg)`:void 0}})]}):null]}):null,A(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[v.map(([e,t])=>A(`div`,{className:`lockerverse-auctions__stat-row`,children:[A(`dt`,{children:[he(e),e]}),k(`dd`,{children:t})]},e)),A(`div`,{className:`lockerverse-auctions__stat-row`,children:[A(`dt`,{children:[k(h,{"aria-hidden":`true`,size:16}),p]}),k(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!g&&d===`finished`?A(`div`,{className:`lockerverse-auctions__stat-footer`,children:[A(`div`,{children:[k(`dt`,{children:`Floor`}),k(`dd`,{children:n(i.minBidAmount??0)})]}),A(`div`,{children:[k(`dt`,{children:`Bid increment`}),k(`dd`,{children:n(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const ve=/^\d+$/;function ye(e,t){return ve.test(e)&&Number.isSafeInteger(Number(e)*t)?`Total: ${n(Number(e)*t)}`:`Enter a whole-number quantity.`}function be(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function xe(e,t){return i(e)?`This item is sold out.`:t===`draft`?`This item is not open yet.`:t===`finished`?e.saleMode===`buy_now`?`Purchases are closed for this item.`:`Bidding is closed for this item.`:`This item is not available.`}function Se(e,t,n){return i(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${a(e,`draft`)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function Ce(e,t,n,r){return{amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1}}function we({auction:t,item:r,initialSelection:a,onContinue:o,onError:c,onBack:l}){let u=r.saleMode===`buy_now`,f=Math.ceil(N(r)/100),[p,m]=D(be(u,a,f)),[h,g]=D(null),_=w();s(t.startAt,t.endAt);let v=e(t,r),y=v===`active`&&!i(r)&&r.saleMode!==`hybrid`;function b(e){if(e.preventDefault(),!ve.test(p)){g(u?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let n=Ce(t,u,a,p),i=ae(t,r,n);if(i){g(i),c(i);return}try{Q(t,r,n)}catch{g(`Enter a valid amount or quantity.`);return}o(n)}return y?A(`form`,{className:`lockerverse-auctions__selection`,onSubmit:b,children:[k(Te,{buyNow:u,item:r,minimum:f}),A(`div`,{className:`lockerverse-auctions__selection-body`,children:[A(`label`,{className:`lockerverse-auctions__field`,htmlFor:_,children:[u?`Quantity`:`Your bid amount`,A(`span`,{className:`lockerverse-auctions__amount-control`,children:[u?null:k(`span`,{"aria-hidden":`true`,children:`$`}),k(`input`,{"aria-describedby":`${_}-help`,"aria-invalid":!!h,autoComplete:`off`,id:_,inputMode:`numeric`,onChange:e=>{m(e.target.value),g(null)},placeholder:u?`1`:String(f),required:!0,value:p})]})]}),h?k(`p`,{role:`alert`,children:h}):null,k(`p`,{id:`${_}-help`,children:u?ye(p,r.buyNowPriceAmount??0):`Enter a whole-dollar bid of at least ${n(f*100)}. Bid increment: ${n(r.bidIncrementAmount??100)}.`}),A(`div`,{className:`lockerverse-auctions__selection-footer`,children:[k(`p`,{children:u?`Continuing moves you into secure checkout where your payment is processed immediately.`:`Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.`}),A(`button`,{className:`lockerverse-auctions__button`,disabled:!t.payment,type:`submit`,children:[u?`Continue to Checkout`:`Continue to Payment`,` `,k(d,{"aria-hidden":`true`,size:16})]})]}),t.payment?null:k(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):A(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[k(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),k(`h3`,{children:xe(r,v)}),k(`p`,{children:Se(t,r,v)}),l?A(`button`,{className:`lockerverse-auctions__button`,onClick:l,type:`button`,children:[`Browse auction items `,k(d,{"aria-hidden":`true`,size:16})]}):null]})}function Te({item:e,buyNow:t,minimum:r}){return A(`div`,{className:`lockerverse-auctions__selection-header`,children:[k(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),k(`h3`,{children:t?`Buy this item now.`:`Place your bid.`}),k(`p`,{children:t?`Choose how many you want, then complete the secure checkout.`:`Enter the bid amount you want to place for this item. You are only charged if this bid wins after bidding closes.`}),A(`p`,{children:[t?`Price: `:`Minimum qualifying bid: `,k(`strong`,{children:n(t?e.buyNowPriceAmount??0:r*100)})]}),t&&e.availableQuantity!==null?A(`p`,{children:[e.availableQuantity,` available`]}):null,e.collectShippingAddress?k(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function Ee(e){let{auction:t,item:n,selection:r,theme:i=`dark`,stripeLoader:a=z,style:o,onBack:s,resumePurchase:c}=e,[l,u]=D(null),[d,f]=D(!1),[p,m]=D(0),h=c?.payment??t.payment;if(C(()=>{let e=!0;if(!h){f(!0);return}return Promise.resolve().then(()=>a(h.publishableKey,h.connectedAccountId?{stripeAccount:h.connectedAccountId}:void 0)).then(t=>{e&&(u(t),f(!t))},()=>{e&&f(!0)}),()=>{e=!1}},[h,a,p]),d)return A(`div`,{children:[k(`p`,{role:`alert`,children:`Payment details could not load.`}),c?null:k(`button`,{onClick:s,type:`button`,children:`Back to item`}),k(`button`,{onClick:()=>{f(!1),u(null),m(e=>e+1)},type:`button`,children:`Try again`})]});if(!l)return A(`div`,{children:[k(`p`,{role:`status`,children:`Loading secure payment details…`}),c?null:k(`button`,{onClick:s,type:`button`,children:`Back to item`})]});let g={mode:`setup`,setupFutureUsage:`off_session`};c?g={amount:c.pricing.totalCents,currency:`usd`,mode:`payment`}:n.saleMode===`buy_now`&&(g={amount:Q(t,n,r).totalCents,currency:`usd`,mode:`payment`});let _={...g,appearance:{theme:i===`dark`?`night`:`stripe`,variables:{borderRadius:`18px`,colorBackground:i===`dark`?`#0F1014`:`#FFFFFF`,colorDanger:`#EF4444`,colorText:i===`dark`?`#FFFFFF`:`#121416`,colorTextSecondary:i===`dark`?`#C0BBC8`:`#55515E`,...o?.[`--lockerverse-accent`]?{colorPrimary:o[`--lockerverse-accent`]}:void 0,...o?.[`--lockerverse-font-family`]?{fontFamily:o[`--lockerverse-font-family`]}:void 0}},currency:`usd`,paymentMethodTypes:[`card`],syncAddressCheckbox:`none`};return k(F,{options:_,stripe:l,children:k(de,{...e})})}function De({buyNow:e}){return A(`div`,{className:`lockerverse-auctions__progress`,children:[A(`span`,{children:[k(e?y:g,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),A(`span`,{children:[k(y,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),A(`span`,{children:[k(b,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function Oe(t){let{auction:n,itemId:r,resumePurchase:i,className:a,theme:o=`dark`,style:c}=t,[l,f]=D(n),m=E(n);s(l.startAt,l.endAt);let h=l.items.find(e=>e.id===r)??i?.item,[g,_]=D(()=>i?{amount:0,includeServiceFee:i.submission.includeServiceFee??!1,quantity:i.submission.quantity}:null),[v,y]=D(!!i),b=E(!0),x=E(t);x.current=t;let w=E(null),T=S(e=>{b.current&&y(e),w.current!==e&&(w.current=e,u(x.current.onInteractionLockChange,e))},[]),O=!!i;C(()=>(b.current=!0,T(O),()=>{b.current=!1}),[O,T]);let[j,M]=D({email:``,phone:``}),[N,P]=D(!!i),[F,I]=D(null);C(()=>{!(N||v||i)&&m.current!==n&&(m.current=n,f(n))},[n,N,v,i]);function L(e,t){T(!1),m.current=x.current.auction,f(e),_(null),P(!1),I(t)}function R(e){I(null),_(e),P(!0)}return h?A(`section`,{className:[`lockerverse-auctions`,a].filter(Boolean).join(` `),"data-lockerverse-theme":o,style:{"--lockerverse-accent":l.community?.color??`#6f8f6d`,...c},children:[t.onBack&&!v?A(`button`,{className:`lockerverse-auctions__back`,onClick:t.onBack,type:`button`,children:[k(p,{"aria-hidden":`true`,size:16}),` All items`]}):null,A(`div`,{className:`lockerverse-auctions__detail`,children:[k(_e,{auction:l,item:h}),A(`div`,{className:`lockerverse-auctions__transaction`,children:[e(l,h)===`active`?k(De,{buyNow:h.saleMode===`buy_now`}):null,F?k(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:F}):null,N&&g?k(Ee,{...t,auction:l,communityName:t.communityName??l.community?.name,contact:j,item:h,onBack:()=>P(!1),onContactChange:M,onIncludeServiceFeeChange:e=>_(t=>t&&{...t,includeServiceFee:l.serviceFeeEnabled&&e}),onInteractionLockChange:T,onReview:L,selection:g}):k(we,{auction:l,initialSelection:g,item:h,onBack:t.onBack,onContinue:R,onError:I}),t.onBack&&!v?A(`button`,{className:`lockerverse-auctions__footer-back`,onClick:t.onBack,type:`button`,children:[`Back to auction items `,k(d,{"aria-hidden":`true`,size:16})]}):null]})]})]}):A(`div`,{children:[k(`p`,{role:`alert`,children:`This auction item is no longer available.`}),t.onBack?k(`button`,{onClick:t.onBack,type:`button`,children:`Back to auction items`}):null]})}function ke(e){let t=E({auctionId:e.auction.id,client:e.client,itemId:e.itemId});if(t.current.client!==e.client||t.current.auctionId!==e.auction.id||t.current.itemId!==e.itemId)throw TypeError(`Auction item identity cannot change. Remount with a new React key.`);if(e.resumePurchase&&(e.resumePurchase.auctionId!==e.auction.id||e.resumePurchase.itemId!==e.itemId||e.resumePurchase.item.id!==e.itemId||e.resumePurchase.item.auctionId!==e.auction.id))throw TypeError(`The purchase recovery record belongs to a different auction item.`);return k(Oe,{...e})}export{ke as LockerverseAuctionItem};
1
+ import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./use-auction-boundary.js";import{d as s,f as c,i as l,m as u,n as d,r as f,t as p}from"./host-callback.js";import{i as m,n as h,t as g}from"./stripe-loader.js";import{ArrowRight as _,ChevronDown as v,ChevronLeft as y,ChevronRight as b,Clock3 as x,Gavel as S,Pause as C,Play as w,ShieldCheck as T,TimerReset as E,X as ee}from"lucide-react";import{useCallback as D,useEffect as O,useId as k,useMemo as A,useRef as j,useState as M}from"react";import{Fragment as N,jsx as P,jsxs as F}from"react/jsx-runtime";import{LockerverseSdkError as I,calculateLockerverseAuctionPricing as L,getLockerverseAuctionMinimumBid as R}from"@lockerverse/sdk/auctions";import{AddressElement as z,Elements as B,PaymentElement as V,useElements as H,useStripe as te}from"@stripe/react-stripe-js";import{Dialog as U}from"@base-ui/react/dialog";import W from"embla-carousel-autoplay";import G from"embla-carousel-react";function K(e){return{business:{name:`Lockerverse`},fields:{billingDetails:{address:`never`,email:`never`,name:`never`,phone:`never`}},terms:{applePay:e?`auto`:`never`,auBecsDebit:`never`,bancontact:`never`,card:`always`,cashapp:`never`,googlePay:`never`,ideal:`never`,paypal:e?`auto`:`never`,sepaDebit:`never`,sofort:`never`,usBankAccount:`never`},wallets:{applePay:e?`auto`:`never`,googlePay:`never`}}}function q(e){let{isPurchase:n,item:r,pricing:i,id:a}=e;return F(`form`,{className:`lockerverse-auctions__checkout`,noValidate:!0,onSubmit:e.onSubmit,children:[F(`div`,{className:`lockerverse-auctions__checkout-header`,children:[F(`div`,{className:`lockerverse-auctions__checkout-navigation`,children:[P(`button`,{"aria-label":`Back`,className:`lockerverse-auctions__checkout-back`,disabled:!e.onBack,onClick:e.onBack,type:`button`,children:P(y,{"aria-hidden":`true`,size:20})}),F(`div`,{children:[P(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Step 2 of 2`}),P(`p`,{children:n?`Secure checkout`:`Secure payment method`})]})]}),P(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:e.communityName}),P(`h2`,{children:n?`Finalize your purchase.`:`Finalize your bid authorization.`}),P(`p`,{className:`lockerverse-auctions__checkout-summary`,children:n?F(N,{children:[`Pay `,P(`strong`,{children:t(i.totalCents)}),` for`,` `,e.quantity,` `,e.quantity===1?`item`:`items`,` of`,` `,P(`strong`,{children:r.name}),`. Your card is charged immediately once checkout succeeds.`]}):F(N,{children:[`Authorize a payment method for your bid of`,` `,P(`strong`,{children:t(i.subtotalCents)}),` on`,` `,P(`strong`,{children:r.name}),`. Your card is only charged if this bid wins the item.`]})}),r.collectShippingAddress&&F(`div`,{className:`lockerverse-auctions__checkout-physical`,children:[P(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Physical item`}),P(`p`,{children:`This item requires a delivery address. Billing details are used by default, and you can switch to a separate delivery address below if needed.`})]})]}),F(`div`,{className:`lockerverse-auctions__checkout-body`,children:[e.showFields&&F(`fieldset`,{disabled:e.locked,children:[F(`div`,{className:`lockerverse-auctions__checkout-contact`,children:[P(c,{error:e.contactErrors.email,id:`${a}-email`,label:`Email`,name:`email`,onChange:t=>e.onEmailChange(t.target.value),required:!0,value:e.email}),P(u,{error:e.contactErrors.phone,id:`${a}-phone`,label:`Phone`,children:P(d,{country:e.phoneCountry,error:e.contactErrors.phone,errorId:`${a}-phone-error`,id:`${a}-phone`,name:`phone`,onChange:e.onPhoneChange,required:!0,value:e.phone})})]}),F(`section`,{"aria-label":`Payment Information`,className:`lockerverse-auctions__checkout-section`,children:[F(`div`,{className:`lockerverse-auctions__checkout-section-heading`,children:[P(`h3`,{children:`Payment Information`}),P(`p`,{children:n?`Processed securely and charged immediately for this purchase.`:`Stored securely and charged only if your bid finishes on top.`})]}),P(V,{onLoadError:e.onPaymentLoadError,options:K(n)})]}),F(`section`,{"aria-label":`Billing Details`,className:`lockerverse-auctions__checkout-section`,children:[P(`h3`,{children:`Billing Details`}),P(z,{onChange:e.onBillingChange,options:{mode:`billing`}}),P(`p`,{children:n?`Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.`:`Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.`})]}),r.collectShippingAddress&&F(`section`,{"aria-label":`Delivery Details`,className:`lockerverse-auctions__checkout-section`,children:[F(`label`,{className:`lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery`,htmlFor:`${a}-delivery-same-as-billing`,children:[P(s,{checked:e.sameAsBilling,id:`${a}-delivery-same-as-billing`,onChange:t=>e.onSameAsBillingChange(t.target.checked)}),F(`span`,{children:[P(`strong`,{children:`Delivery address is the same as billing`}),P(`span`,{children:`Leave this on for the fastest flow. Turn it off only if the delivery address should differ from the billing details above.`})]})]}),!e.sameAsBilling&&F(N,{children:[P(`h3`,{children:`Delivery Address`}),P(z,{onChange:e.onShippingChange,options:{mode:`shipping`}})]})]}),e.serviceFeeEnabled&&P(J,{...e})]}),e.message&&P(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__notice`,role:`status`,children:e.message}),!e.isTerminal&&F(`div`,{className:`lockerverse-auctions__checkout-footer`,children:[F(`p`,{children:[n?`By continuing, you agree to be charged for this purchase.`:`By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.`,r.collectShippingAddress?` Your delivery details are stored with the ${n?`order`:`bid`} so the seller can fulfill the item after payment.`:``]}),F(`button`,{className:`lockerverse-auctions__button lockerverse-auctions__checkout-submit`,disabled:e.submitDisabled,type:`submit`,children:[e.buttonText,P(_,{"aria-hidden":`true`,size:16})]})]})]})]})}function J(e){let{isPurchase:n,pricing:r}=e;return P(`section`,{"aria-label":`Processing fees`,className:`lockerverse-auctions__checkout-section`,children:e.onIncludeServiceFeeChange?F(`label`,{className:`lockerverse-auctions__checkout-checkbox`,htmlFor:`${e.id}-service-fee`,children:[P(s,{checked:e.includeServiceFee,id:`${e.id}-service-fee`,onChange:t=>e.onIncludeServiceFeeChange?.(t.target.checked)}),F(`span`,{children:[F(`strong`,{children:[n?`Add`:`If I win, add`,` `,t(e.serviceFeeCents),` to help cover processing fees`]}),F(`span`,{children:[n?`Total`:`Total if I win`,`:`,` `,t(r.totalCents)]})]})]}):F(`p`,{children:[n?`Total`:`Total if I win`,`:`,` `,t(r.totalCents)]})})}function Y(e,t,n){return L(e,t.saleMode===`buy_now`?(t.buyNowPriceAmount??0)*n.quantity:n.amount,n.includeServiceFee)}function ne(t,n,r){if(e(t,n)!==`active`)return`This item is not accepting bids or purchases.`;if(n.saleMode===`hybrid`)return`This item type is not supported for checkout.`;if(n.saleMode===`buy_now`){if(n.isSoldOut||n.availableQuantity===0)return`This item is sold out.`;if(!(n.buyNowPriceAmount&&Number.isSafeInteger(r.quantity))||r.quantity<1||n.availableQuantity!==null&&r.quantity>n.availableQuantity)return`Select an available quantity.`}else if(!Number.isSafeInteger(r.amount)||r.amount%100!=0||r.amount<R(n))return`Enter a whole-dollar bid at or above the minimum bid.`;return null}function re(e,t,n,r,i){return e.payment?.publishableKey!==t.payment?.publishableKey||e.payment?.connectedAccountId!==t.payment?.connectedAccountId||e.serviceFeeEnabled!==t.serviceFeeEnabled||n.saleMode!==r.saleMode||n.collectShippingAddress!==r.collectShippingAddress||JSON.stringify(Y(e,n,i))!==JSON.stringify(Y(t,r,i))}function ie(e){return{expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function ae({stripe:e,elements:t,email:n,phone:r,billing:i,shipping:a,collectShippingAddress:o}){if(!(i?.complete&&i.value.name.trim()))throw Error(`Complete your billing name and address.`);if(o&&!(a?.complete&&a.value.name.trim()))throw Error(`Complete your shipping name and address.`);let s=await t.submit();if(s.error)throw Error(s.error.message??`Check your payment details.`);let c=await e.createConfirmationToken({elements:t,params:{payment_method_data:{allow_redisplay:`always`,billing_details:{address:i.value.address,email:n,name:i.value.name,phone:r}},return_url:window.location.href,...o&&a?{shipping:{address:a.value.address,name:a.value.name,phone:r}}:void 0}});if(c.error||!c.confirmationToken)throw Error(c.error?.message??`Unable to prepare payment details.`);return c.confirmationToken.id}async function oe(e,t){if(!t.requiresAction)return;if(!t.clientSecret)throw Error(`Payment confirmation is incomplete. Check its status before trying again.`);let n=await e.handleNextAction({clientSecret:t.clientSecret});if(n.error)throw Error(n.error.message??`Payment confirmation is incomplete.`)}function se(e,t,n){return e===`busy`?n?`Processing...`:`Authorizing...`:e===`retry`?`Retry original purchase`:t?`Check purchase status`:n?`Buy Now`:`Authorize Bid`}function X(e){let{auction:t,item:n,selection:r,client:i,onReview:a,onBack:o}=e,s=te(),c=H(),u=k(),[d,h]=M(e.contact?.email??``),[g,_]=M(e.contact?.phone??``),[v,y]=M(()=>l(e.contact?.phone??``)),[b,x]=M({}),[S,C]=M(!0),[w,T]=M(null),[E,ee]=M(null),[D,A]=M(e.resumePurchase??null),[N,F]=M(e.resumePurchase?`pending`:`ready`),[L,R]=M(null),z=j(e.resumePurchase?.submission.clientRequestId??null),B=N===`complete`||N===`uncertain`,V=j(!1),U=j(!0),W=j(e);W.current=e;let G=j(!1);function K(e){U.current&&F(e),p(W.current.onInteractionLockChange,e!==`ready`&&e!==`complete`)}function J(e){U.current&&R(e)}function X(e){K(e===`bid`?`uncertain`:`pending`),J(e===`bid`?`We could not confirm your bid. Do not submit another bid until you check your email or contact the auction organizer.`:`We could not confirm the purchase result. Check its status using the same purchase request.`),G.current||(G.current=!0,p(W.current.onUncertain,e))}O(()=>(U.current=!0,()=>{U.current=!1}),[]);let Z=!!(D??e.resumePurchase)||n.saleMode===`buy_now`,Q=D?.pricing??e.resumePurchase?.pricing??Y(t,n,r),ce=D?.payment??e.resumePurchase?.payment??t.payment;function $(e){U.current&&A(e),p(W.current.onPurchaseRecoveryChange,e)}function le(e){e.status===`paid`?(z.current=null,$(null),K(`complete`),J(`Purchase complete. Receipt: ${e.purchaseId}`),G.current||(G.current=!0,p(W.current.onPurchaseComplete,e))):e.status===`pending_payment`?(K(`pending`),J(`Your purchase is pending. Check its status before making another payment.`)):(z.current=null,$(null),K(`ready`),J(`This purchase is ${e.status.replaceAll(`_`,` `)}. You can start a new purchase.`))}function ue(){let e=f(g,v),t=m({email:d,phone:e},!0);return x(t.errors),t.value?{email:t.value.email,phone:e}:(document.getElementById(`${u}-${t.errors.email?`email`:`phone`}`)?.focus(),null)}async function de(e){if(!e)throw Error(`Check the contact fields below.`);if(!(s&&c&&t.payment))throw Error(`Payment details are still loading.`);let o=await i.load(t.slug);if(!U.current)return null;let l=o.items.find(e=>e.id===n.id);if(!l)return a(o,`This item is no longer available.`),null;let u=ne(o,l,r);if(u||re(t,o,n,l,r))return a(o,u??`The checkout details changed. Review them before continuing.`),null;let d=await ae({billing:w,collectShippingAddress:n.collectShippingAddress,elements:c,email:e.email,phone:e.phone,shipping:S?w:E,stripe:s});return U.current?{confirmationToken:d,email:e.email,includeServiceFee:r.includeServiceFee,phone:e.phone,...ie(Q)}:null}async function fe(e){let a=await i.createBid(t.slug,n.id,{...e,amount:r.amount});if(a.requiresAction){if(!(U.current&&s)){X(`bid`);return}await oe(s,a)}K(`complete`),J(`Bid submitted. Watch your email for bid and auction updates.`),G.current||(G.current=!0,p(W.current.onBidSubmitted,a))}async function pe(e,r){if(e.requiresAction){if(!(U.current&&s)){X(`purchase`);return}await oe(s,e);let a=await i.getPurchaseStatus(t.slug,n.id,r.submission.clientRequestId);a?le(a):(K(`pending`),J(`Payment status is not available yet. Check again shortly.`));return}le(e),!U.current&&e.status===`pending_payment`&&X(`purchase`)}async function me(e){let r=await i.getPurchaseStatus(t.slug,n.id,e.submission.clientRequestId);if(r)await pe(r,e);else{if(!U.current){X(`purchase`);return}K(`retry`),J(`No purchase is recorded yet. You can retry the original purchase with the same request ID.`)}}async function he(e,r){let a=await i.getPurchaseStatus(t.slug,n.id,r.submission.clientRequestId);if(a){await pe(a,r);return}$(null),K(`ready`),J(`The purchase was rejected. Review the item and payment details before trying again. (${e.status??`validation`})`)}async function ge(e,t,n,r){let i=t&&(!(e instanceof I)||e.recoveryRecommended);if(J(e instanceof Error?e.message:`Unable to complete this request.`),Z&&n){if(!r&&e instanceof I&&!e.recoveryRecommended)try{await he(e,n);return}catch{}X(`purchase`)}else i?X(`bid`):K(`ready`)}function _e(){return z.current??=globalThis.crypto.randomUUID(),z.current}function ve(){return U.current?!0:(D||($(null),K(`ready`)),!1)}async function ye(e,r){if(r){await me(e);return}ve()&&await pe(await i.createPurchase(t.slug,n.id,e.submission),e)}let be=s&&c&&ce;function xe(){if(V.current||B)return null;if(!be)return J(`Payment details are still loading.`),null;let e=D?null:ue();return D||e?{checkoutPayment:be,contact:e,retryOriginal:N===`retry`}:null}async function Se(e){e.preventDefault();let i=xe();if(!i)return;let{contact:a,checkoutPayment:o,retryOriginal:s}=i;V.current=!0,G.current=!1,K(`busy`),J(null);let c=!1,l=D;try{if(!l){let e=await de(a);if(!(e&&U.current)){K(`ready`);return}if(!Z){c=!0,await fe(e);return}l=Object.freeze({auctionId:t.id,item:n,itemId:n.id,payment:Object.freeze({...o}),pricing:Q,submission:Object.freeze({...e,clientRequestId:_e(),paymentMethodTypes:Object.freeze([`card`]),quantity:r.quantity})}),$(l)}c=!0,await ye(l,!!D&&!s)}catch(e){await ge(e,c,l,D!==null&&!s)}finally{V.current=!1}}let Ce=se(N,D!==null,Z),we=N!==`ready`;return P(q,{buttonText:Ce,communityName:e.communityName??t.name,contactErrors:b,email:d,id:u,includeServiceFee:r.includeServiceFee,isPurchase:Z,isTerminal:B,item:n,locked:we,message:L,onBack:N===`ready`?o:void 0,onBillingChange:T,onEmailChange:t=>{h(t),e.onContactChange?.({email:t,phone:f(g,v)})},onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPaymentLoadError:()=>J(`Unable to load payment form.`),onPhoneChange:({value:t,country:n})=>{_(t),y(n),e.onContactChange?.({email:d,phone:f(t,n)})},onSameAsBillingChange:C,onShippingChange:ee,onSubmit:Se,phone:g,phoneCountry:v,pricing:Q,quantity:r.quantity,sameAsBilling:S,serviceFeeCents:D?Q.serviceFeeCents:Y(t,n,{...r,includeServiceFee:t.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:t.serviceFeeEnabled,showFields:!(D||B),submitDisabled:N===`busy`||!s||!c})}const Z=6e3;function Q(e,t){let n=j(Z),r=j(null),[i,a]=M(Z),o=A(()=>W({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=G({duration:t?0:25,loop:!0},[o]),l=D(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/Z})`)},[]),u=D(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(Z,e))),o.stop(),l()},[o,l]),d=D(()=>{n.current=Z,a(Z),o.reset(),l()},[o,l]);return O(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),O(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(Z,i)),l(),t=requestAnimationFrame(r))},i=()=>{cancelAnimationFrame(t),e&&(t=requestAnimationFrame(r))},a=()=>cancelAnimationFrame(t),s=()=>{e&&o.play()};return c.on(`select`,d).on(`reInit`,s).on(`autoplay:timerset`,i).on(`autoplay:timerstopped`,a),l(),i(),()=>{a(),c.off(`select`,d).off(`reInit`,s).off(`autoplay:timerset`,i).off(`autoplay:timerstopped`,a)}},[c,o,e,n,d,l]),{embla:c,freeze:u,progressRef:r,reset:d,viewportRef:s}}function ce({photos:e,name:t,selected:r,paused:i=!1,photoButtonRef:a,onSelect:o,onExpand:s}){let c=j(null),l=j(null),u=j([]),[d,f]=M(!0),[p,m]=M(!1),[h,g]=M(!1),[_,v]=M(!1),[x,S]=M(!1),{ref:T,visible:E}=n(),[ee,D]=M(!1),[k,A]=M(!0),I=j(null),L=`lockerverse-auction-gallery__control ${k||ee||h?`is-visible`:``}`,R=()=>{I.current&&clearTimeout(I.current),I.current=setTimeout(()=>D(!1),2e3)},z=e=>{if(e.pointerType!==`mouse`){A(!0);return}D(!0),I.current&&clearTimeout(I.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||R()};O(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>A(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(I.current??void 0)}},[]);let B=!(i||d||p||h||_||x)&&E,V=e.length,H=V?(r%V+V)%V:0,{viewportRef:te,embla:U,progressRef:W,freeze:G,reset:K}=Q(B&&V>1,d);O(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>f(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),O(()=>{if(!U)return;let e=()=>o(U.selectedScrollSnap());return U.on(`select`,e).on(`reInit`,e),()=>{U.off(`select`,e).off(`reInit`,e)}},[U,o]),O(()=>{U&&U.selectedScrollSnap()!==H&&U.scrollTo(H,!0)},[U,H]),O(()=>{let e=()=>{document.hidden&&G()},t=()=>S(!1);return e(),document.addEventListener(`visibilitychange`,e,!0),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{document.removeEventListener(`visibilitychange`,e,!0),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[G]);let q=e=>{U?.scrollTo((e+V)%V,d),K()};return O(()=>{let e=l.current;l.current=null,e&&document.activeElement===e&&T.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[H,T]),O(()=>{let e=c.current,t=u.current[H];if(!(e&&t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.left<n.left?e.scrollLeft-=n.left-r.left:r.right>n.right&&(e.scrollLeft+=r.right-n.right)},[H,V]),F(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||g(!1)},onFocusCapture:e=>g(e.target.matches(`:focus-visible`)),onKeyDown:e=>{V<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),e.target instanceof HTMLButtonElement&&e.target.classList.contains(`lockerverse-auction-gallery__photo`)&&(l.current=e.target),q(H+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&m(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&m(!1)},ref:T,children:[V?F(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:z,onPointerLeave:R,onPointerMove:z,children:[P(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{G(),S(!0)},ref:te,children:P(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,n)=>P(`div`,{"aria-hidden":n!==H,className:`lockerverse-auction-gallery__slide`,children:P(`button`,{"aria-label":`View photo ${n+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{s(n)},ref:n===H?a:void 0,tabIndex:n===H?0:-1,type:`button`,children:P(`img`,{alt:`${t}, ${n+1} of ${V}`,className:`lockerverse-auction-gallery__image`,draggable:!1,height:900,loading:n===0||n===H||n===(H+1)%V?`eager`:`lazy`,sizes:`(max-width: 1280px) 100vw, 45vw`,src:e,width:1200})})},`${e}-${n}`))})}),V>1&&!d&&F(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[P(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:P(`div`,{className:`lockerverse-auction-gallery__progress`,ref:W,style:{transform:`scaleX(0)`}})}),P(`button`,{"aria-label":_?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${L}`,"data-gallery-control":!0,onClick:()=>v(e=>!e),title:_?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:P(_?w:C,{"aria-hidden":`true`,size:13})})]}),V>1&&F(N,{children:[P(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${L}`,"data-gallery-control":!0,onClick:()=>q(H-1),type:`button`,children:P(y,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),P(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${L}`,"data-gallery-control":!0,onClick:()=>q(H+1),type:`button`,children:P(b,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):P(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),V>1&&P(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:c,children:P(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>P(`button`,{"aria-label":`Show photo ${t+1} of ${V}`,"aria-pressed":H===t,className:`lockerverse-auction-gallery__thumbnail ${H===t?`is-selected`:``}`,onClick:()=>q(t),ref:e=>{u.current[t]=e},type:`button`,children:P(`img`,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function $({images:e,fallbackImage:t,name:n}){let r=[...new Set(e.filter(Boolean))];!r.length&&t&&r.push(t);let[i,a]=M(0),[o,s]=M(!1),c=j(null),l=j(null),u=r.length,d=u?(i%u+u)%u:0;return F(N,{children:[P(ce,{name:n,onExpand:e=>{a(e),s(!0)},onSelect:a,paused:o,photoButtonRef:c,photos:r,selected:d}),u>0&&P(U.Root,{onOpenChange:s,open:o,children:F(U.Portal,{children:[P(U.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),F(U.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:c,onKeyDown:e=>{u<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),a((d+(e.key===`ArrowRight`?1:-1)+u)%u))},children:[F(U.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,d+1,` of `,u]}),F(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{l.current=null},onTouchEnd:e=>{let t=l.current;l.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||u<2)return;let r=n.clientX-t.x,i=n.clientY-t.y;Math.abs(r)>=45&&Math.abs(r)>Math.abs(i)*1.3&&a((d+(r<0?1:-1)+u)%u)},onTouchMove:e=>{e.touches.length!==1&&(l.current=null)},onTouchStart:e=>{let t=e.touches.item(0);l.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[P(`img`,{alt:`${n}, ${d+1} of ${u}`,height:900,src:r[d],width:1200}),o&&u>1&&P(`img`,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,src:r[(d+1)%u],width:1200})]}),P(U.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:P(ee,{"aria-hidden":`true`,size:22})}),u>1&&F(N,{children:[P(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>a((d-1+u)%u),type:`button`,children:P(y,{"aria-hidden":`true`,size:28})}),P(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>a((d+1)%u),type:`button`,children:P(b,{"aria-hidden":`true`,size:28})})]})]})]})})]})}function le(e){return P(e===`Buy Now`?T:e===`Available`||e===`Increment`?E:S,{"aria-hidden":`true`,size:16})}function ue(e,n){return e.saleMode===`buy_now`?[[`Buy Now`,t(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:n===`finished`?[[`Final bid`,e.maxBidAmount?t(e.maxBidAmount):`No bids`]]:[[`Current bid`,t(e.maxBidAmount??0)],[`Floor`,t(e.minBidAmount??0)],[`Increment`,t(e.bidIncrementAmount??100)]]}function de({auction:n,item:r}){o(r.startAt??n.startAt,r.endAt??n.endAt);let[s,c]=M(!1),l=k(),u=e(n,r),d={active:`Closes`,draft:`Opens`,finished:`Closed`}[u],f=i(n,u,r),p=r.saleMode===`buy_now`,m=(r.description??``).trim().length>240,h=ue(r,u);return F(`section`,{className:`lockerverse-auctions__item-summary`,children:[P($,{fallbackImage:r.image??n.configuration.image??n.community?.banner??n.community?.thumbnail??null,images:r.images,name:r.name}),F(`div`,{className:`lockerverse-auctions__item-copy`,children:[F(`p`,{className:`lockerverse-auctions__eyebrow`,children:[d,` `,f,` `,P(`span`,{"aria-hidden":`true`,children:` · `}),` Public item`]}),P(`h2`,{children:r.name}),r.description?F(`div`,{className:`lockerverse-auctions__item-description`,children:[P(a,{className:!s&&m?`lockerverse-auctions__description-clamped`:void 0,description:r.description,id:l}),m?F(`button`,{"aria-controls":l,"aria-expanded":s,className:`lockerverse-auctions__description-toggle`,onClick:()=>c(!s),type:`button`,children:[s?`Hide description`:`Read full description`,` `,P(v,{"aria-hidden":`true`,size:16,style:{transform:s?`rotate(180deg)`:void 0}})]}):null]}):null,F(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[h.map(([e,t])=>F(`div`,{className:`lockerverse-auctions__stat-row`,children:[F(`dt`,{children:[le(e),e]}),P(`dd`,{children:t})]},e)),F(`div`,{className:`lockerverse-auctions__stat-row`,children:[F(`dt`,{children:[P(x,{"aria-hidden":`true`,size:16}),d]}),P(`dd`,{className:`lockerverse-auctions__stat-date`,children:f})]}),!p&&u===`finished`?F(`div`,{className:`lockerverse-auctions__stat-footer`,children:[F(`div`,{children:[P(`dt`,{children:`Floor`}),P(`dd`,{children:t(r.minBidAmount??0)})]}),F(`div`,{children:[P(`dt`,{children:`Bid increment`}),P(`dd`,{children:t(r.bidIncrementAmount??100)})]})]}):null]})]})]})}const fe=/^\d+$/;function pe(e,n){return fe.test(e)&&Number.isSafeInteger(Number(e)*n)?`Total: ${t(Number(e)*n)}`:`Enter a whole-number quantity.`}function me(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function he(e,t){return r(e)?`This item is sold out.`:t===`draft`?`This item is not open yet.`:t===`finished`?e.saleMode===`buy_now`?`Purchases are closed for this item.`:`Bidding is closed for this item.`:`This item is not available.`}function ge(e,t,n){return r(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${i(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function _e(e,t,n,r){return{amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1}}function ve({auction:n,item:i,initialSelection:a,onContinue:s,onError:c,onBack:l}){let u=i.saleMode===`buy_now`,d=Math.ceil(R(i)/100),[f,p]=M(me(u,a,d)),[m,h]=M(null),g=k();o(i.startAt??n.startAt,i.endAt??n.endAt);let v=e(n,i),y=v===`active`&&!r(i)&&i.saleMode!==`hybrid`;function b(e){if(e.preventDefault(),!fe.test(f)){h(u?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let t=_e(n,u,a,f),r=ne(n,i,t);if(r){h(r),c(r);return}try{Y(n,i,t)}catch{h(`Enter a valid amount or quantity.`);return}s(t)}return y?F(`form`,{className:`lockerverse-auctions__selection`,onSubmit:b,children:[P(ye,{buyNow:u,item:i,minimum:d}),F(`div`,{className:`lockerverse-auctions__selection-body`,children:[F(`label`,{className:`lockerverse-auctions__field`,htmlFor:g,children:[u?`Quantity`:`Your bid amount`,F(`span`,{className:`lockerverse-auctions__amount-control`,children:[u?null:P(`span`,{"aria-hidden":`true`,children:`$`}),P(`input`,{"aria-describedby":`${g}-help`,"aria-invalid":!!m,autoComplete:`off`,id:g,inputMode:`numeric`,onChange:e=>{p(e.target.value),h(null)},placeholder:u?`1`:String(d),required:!0,value:f})]})]}),m?P(`p`,{role:`alert`,children:m}):null,P(`p`,{id:`${g}-help`,children:u?pe(f,i.buyNowPriceAmount??0):`Enter a whole-dollar bid of at least ${t(d*100)}. Bid increment: ${t(i.bidIncrementAmount??100)}.`}),F(`div`,{className:`lockerverse-auctions__selection-footer`,children:[P(`p`,{children:u?`Continuing moves you into secure checkout where your payment is processed immediately.`:`Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.`}),F(`button`,{className:`lockerverse-auctions__button`,disabled:!n.payment,type:`submit`,children:[u?`Continue to Checkout`:`Continue to Payment`,` `,P(_,{"aria-hidden":`true`,size:16})]})]}),n.payment?null:P(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):F(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[P(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),P(`h3`,{children:he(i,v)}),P(`p`,{children:ge(n,i,v)}),l?F(`button`,{className:`lockerverse-auctions__button`,onClick:l,type:`button`,children:[`Browse auction items `,P(_,{"aria-hidden":`true`,size:16})]}):null]})}function ye({item:e,buyNow:n,minimum:r}){return F(`div`,{className:`lockerverse-auctions__selection-header`,children:[P(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),P(`h3`,{children:n?`Buy this item now.`:`Place your bid.`}),P(`p`,{children:n?`Choose how many you want, then complete the secure checkout.`:`Enter the bid amount you want to place for this item. You are only charged if this bid wins after bidding closes.`}),F(`p`,{children:[n?`Price: `:`Minimum qualifying bid: `,P(`strong`,{children:t(n?e.buyNowPriceAmount??0:r*100)})]}),n&&e.availableQuantity!==null?F(`p`,{children:[e.availableQuantity,` available`]}):null,e.collectShippingAddress?P(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function be(e){let{auction:t,item:n,selection:r,theme:i=`dark`,stripeLoader:a=g,style:o,onBack:s,resumePurchase:c}=e,[l,u]=M(null),[d,f]=M(!1),[p,m]=M(0),_=h(e.appearanceRoot,i,o,e.interactionLocked),v=c?.payment??t.payment;if(O(()=>{let e=!0;if(!v){f(!0);return}return Promise.resolve().then(()=>a(v.publishableKey,v.connectedAccountId?{stripeAccount:v.connectedAccountId}:void 0)).then(t=>{e&&(u(t),f(!t))},()=>{e&&f(!0)}),()=>{e=!1}},[v,a,p]),d)return F(`div`,{children:[P(`p`,{role:`alert`,children:`Payment details could not load.`}),c?null:P(`button`,{onClick:s,type:`button`,children:`Back to item`}),P(`button`,{onClick:()=>{f(!1),u(null),m(e=>e+1)},type:`button`,children:`Try again`})]});if(!(l&&_))return F(`div`,{children:[P(`p`,{role:`status`,children:`Loading secure payment details…`}),c?null:P(`button`,{onClick:s,type:`button`,children:`Back to item`})]});let y={mode:`setup`,setupFutureUsage:`off_session`};c?y={amount:c.pricing.totalCents,currency:`usd`,mode:`payment`}:n.saleMode===`buy_now`&&(y={amount:Y(t,n,r).totalCents,currency:`usd`,mode:`payment`});let b={...y,appearance:_,currency:`usd`,paymentMethodTypes:[`card`],syncAddressCheckbox:`none`};return P(B,{options:b,stripe:l,children:P(X,{...e})})}function xe({buyNow:e}){return F(`div`,{className:`lockerverse-auctions__progress`,children:[F(`span`,{children:[P(e?T:S,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),F(`span`,{children:[P(T,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),F(`span`,{children:[P(E,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function Se(t){let{auction:n,itemId:r,resumePurchase:i,className:a,theme:s=`dark`,style:c}=t,l=j(null),[u,d]=M(n),f=j(n),m=u.items.find(e=>e.id===r)??i?.item;o(m?.startAt??u.startAt,m?.endAt??u.endAt);let[h,g]=M(()=>i?{amount:0,includeServiceFee:i.submission.includeServiceFee??!1,quantity:i.submission.quantity}:null),[v,b]=M(!!i),x=j(!0),S=j(t);S.current=t;let C=j(null),w=D(e=>{x.current&&b(e),C.current!==e&&(C.current=e,p(S.current.onInteractionLockChange,e))},[]),T=!!i;O(()=>(x.current=!0,w(T),()=>{x.current=!1}),[T,w]);let[E,ee]=M({email:``,phone:``}),[k,A]=M(!!i),[N,I]=M(null);O(()=>{!(k||v||i)&&f.current!==n&&(f.current=n,d(n))},[n,k,v,i]);function L(e,t){w(!1),f.current=S.current.auction,d(e),g(null),A(!1),I(t)}function R(e){I(null),g(e),A(!0)}return m?F(`section`,{className:[`lockerverse-auctions`,a].filter(Boolean).join(` `),"data-lockerverse-theme":s,ref:l,style:{"--lockerverse-accent":u.community?.color??`#6f8f6d`,...c},children:[t.onBack&&!v?F(`button`,{className:`lockerverse-auctions__back`,onClick:t.onBack,type:`button`,children:[P(y,{"aria-hidden":`true`,size:16}),` All items`]}):null,F(`div`,{className:`lockerverse-auctions__detail`,children:[P(de,{auction:u,item:m}),F(`div`,{className:`lockerverse-auctions__transaction`,children:[e(u,m)===`active`?P(xe,{buyNow:m.saleMode===`buy_now`}):null,N?P(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:N}):null,k&&h?P(be,{...t,appearanceRoot:l,auction:u,communityName:t.communityName??u.community?.name,contact:E,interactionLocked:v,item:m,onBack:()=>A(!1),onContactChange:ee,onIncludeServiceFeeChange:e=>g(t=>t&&{...t,includeServiceFee:u.serviceFeeEnabled&&e}),onInteractionLockChange:w,onReview:L,selection:h}):P(ve,{auction:u,initialSelection:h,item:m,onBack:t.onBack,onContinue:R,onError:I}),t.onBack&&!v?F(`button`,{className:`lockerverse-auctions__footer-back`,onClick:t.onBack,type:`button`,children:[`Back to auction items `,P(_,{"aria-hidden":`true`,size:16})]}):null]})]})]}):F(`div`,{children:[P(`p`,{role:`alert`,children:`This auction item is no longer available.`}),t.onBack?P(`button`,{onClick:t.onBack,type:`button`,children:`Back to auction items`}):null]})}function Ce(e){let t=j({auctionId:e.auction.id,client:e.client,itemId:e.itemId});if(t.current.client!==e.client||t.current.auctionId!==e.auction.id||t.current.itemId!==e.itemId)throw TypeError(`Auction item identity cannot change. Remount with a new React key.`);if(e.resumePurchase&&(e.resumePurchase.auctionId!==e.auction.id||e.resumePurchase.itemId!==e.itemId||e.resumePurchase.item.id!==e.itemId||e.resumePurchase.item.auctionId!==e.auction.id))throw TypeError(`The purchase recovery record belongs to a different auction item.`);return P(Se,{...e})}export{Ce as LockerverseAuctionItem};
2
2
  //# sourceMappingURL=auction-item.js.map