@lockerverse/react 0.2.235 → 0.2.237

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 (47) hide show
  1. package/MIGRATIONS.md +7 -0
  2. package/dist/accent-contrast.js +1 -1
  3. package/dist/accent-contrast.js.map +1 -1
  4. package/dist/auction-catalog.css +6 -25
  5. package/dist/auction-item-layout.css +1 -6
  6. package/dist/auction-item.d.ts.map +1 -1
  7. package/dist/auction-item.js +1 -1
  8. package/dist/auction-item.js.map +1 -1
  9. package/dist/auction-presentation.d.ts +7 -5
  10. package/dist/auction-presentation.d.ts.map +1 -1
  11. package/dist/auction-presentation.js +1 -1
  12. package/dist/auction-presentation.js.map +1 -1
  13. package/dist/auction-result.d.ts.map +1 -1
  14. package/dist/auction-result2.js +1 -1
  15. package/dist/auction-result2.js.map +1 -1
  16. package/dist/auction.d.ts +2 -2
  17. package/dist/auction.js +1 -1
  18. package/dist/auctions.d.ts.map +1 -1
  19. package/dist/auctions.js +1 -1
  20. package/dist/auctions.js.map +1 -1
  21. package/dist/embed/chunks/{auction-payment-view-HS2VCXUT.js → auction-payment-view-FUYF5OLY.js} +1 -1
  22. package/dist/embed/chunks/chunk-3RYR6IBV.js +2 -0
  23. package/dist/embed/chunks/{chunk-ECU3IX4G.js → chunk-KVE6ZGXF.js} +2 -2
  24. package/dist/embed/chunks/{chunk-FTKUIA4D.js → chunk-OWUENBYV.js} +1 -1
  25. package/dist/embed/chunks/lockerverse-auction-item-QDOQLEXZ.js +2 -0
  26. package/dist/embed/lockerverse.js +1 -1
  27. package/dist/embed/runtime.js +6 -6
  28. package/dist/lockerverse-auction-item-card.d.ts.map +1 -1
  29. package/dist/lockerverse-auction.js +1 -1
  30. package/dist/lockerverse-auction.js.map +1 -1
  31. package/dist/lockerverse-donate-launcher.js +1 -1
  32. package/dist/lockerverse-payment.js +1 -1
  33. package/dist/signup.js +1 -1
  34. package/dist/signup.js.map +1 -1
  35. package/guides/auctions.md +16 -1
  36. package/guides/bookings.md +1 -1
  37. package/guides/browser-embed.md +3 -3
  38. package/guides/events.md +1 -1
  39. package/guides/integration.md +1 -1
  40. package/guides/payment-widgets.md +1 -1
  41. package/guides/signup.md +1 -1
  42. package/package.json +3 -2
  43. package/dist/embed/chunks/chunk-JAZVPYXN.js +0 -2
  44. package/dist/embed/chunks/lockerverse-auction-item-AIEK5XAY.js +0 -2
  45. /package/dist/embed/chunks/{chunk-JAZVPYXN.js.LEGAL.txt → chunk-3RYR6IBV.js.LEGAL.txt} +0 -0
  46. /package/dist/embed/chunks/{chunk-ECU3IX4G.js.LEGAL.txt → chunk-KVE6ZGXF.js.LEGAL.txt} +0 -0
  47. /package/dist/embed/chunks/{lockerverse-auction-item-AIEK5XAY.js.LEGAL.txt → lockerverse-auction-item-QDOQLEXZ.js.LEGAL.txt} +0 -0
package/MIGRATIONS.md CHANGED
@@ -4,6 +4,13 @@ This file ships in both @lockerverse/sdk and @lockerverse/react. Use the copy in
4
4
  the target installed release. This is an agent-run procedure, not an install
5
5
  script. Installing a package does not edit host code or guarantee these steps ran.
6
6
 
7
+ ## 0.2.236 — community styling across auction surfaces
8
+
9
+ - **Automatic:** after updating matching SDK and React packages, the auction browser, catalog, standalone item cards, item checkout, and its result share the community accent. Cards use solid branded actions and a matching hover/focus border. Hex, CSS named, RGB and HSL accents receive contrasting text. The SDK composites translucent colors against the selected theme. Explicit `style` values take precedence; provide `--lockerverse-accent-contrast` for a contextual CSS color during server rendering. The Auburn Vault collection uses its configured two-column layout on wide screens.
10
+ - **Host adoption:** use `getAuctionPresentationStyle(auction, overrides?, theme?)` from `@lockerverse/react/auction-presentation` or `@lockerverse/react/auction` when composing a custom host view. A standalone result can use the helper with its community color and pass the returned `style`. Pinned embeds can continue using `getAuctionEmbedPresentation` for their catalog options.
11
+ - **Script hosts:** update the pinned script URL to `@0.2.236`. Keep `accent` when an explicit override is intended. React hosts keep control of headings, filters, navigation, and themes.
12
+ - **Check:** check the same auction's catalog, item, and result action colors in light and dark themes. Verify host color overrides and card focus without creating a live transaction.
13
+
7
14
  ## 0.2.235 — shared auction embed presentation
8
15
 
9
16
  - **Script hosts:** update the script URL to `@0.2.235`. A pinned auction shows its items without the catalog header or filters. Its actions use the community color. Omit `accent` to use that color, or supply an explicit override. Auburn’s installed collection uses two columns on wide screens.
@@ -1,2 +1,2 @@
1
- const e=/^#([\da-f]{3}|[\da-f]{6})$/i,t=/^([\da-f]{3}|[\da-f]{6})$/i;function n(e){let n=e.trim();return t.test(n)?`#${n}`:n}function r(t){let r=e.exec(n(t));if(!r)return;let[,i]=r;if(!i)return;let a=i.length===3?Array.from(i,e=>`${e}${e}`).join(``):i;return[0,2,4].map(e=>Number.parseInt(a.slice(e,e+2),16))}function i([e,t,n]){let[r=0,i=0,a=0]=[e,t,n].map((e=0)=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a}function a(e){let t=r(e);if(!t)return;let n=i(t);return(n+.05)/.05>=1.05/(n+.05)?`#000`:`#fff`}export{n,a as t};
1
+ const e=/^#([\da-f]{3}|[\da-f]{6})$/i,t=/^([\da-f]{3}|[\da-f]{6})$/i;function n(e){let n=e.trim();return t.test(n)?`#${n}`:n}function r(t){let r=e.exec(n(t));if(!r)return;let[,i]=r;if(!i)return;let a=i.length===3?Array.from(i,e=>`${e}${e}`).join(``):i;return[0,2,4].map(e=>Number.parseInt(a.slice(e,e+2),16))}function i([e,t,n]){let[r=0,i=0,a=0]=[e,t,n].map((e=0)=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}),o=.2126*r+.7152*i+.0722*a;return(o+.05)/.05>=1.05/(o+.05)?`#000`:`#fff`}function a(e){let t=r(e);if(t)return i(t)}export{i as n,n as r,a as t};
2
2
  //# sourceMappingURL=accent-contrast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accent-contrast.js","names":[],"sources":["../src/accent-contrast.ts"],"sourcesContent":["const HEX_COLOR = /^#([\\da-f]{3}|[\\da-f]{6})$/i;\nconst UNPREFIXED_HEX_COLOR = /^([\\da-f]{3}|[\\da-f]{6})$/i;\n\nexport function normalizeAccentColor(color: string) {\n const trimmedColor = color.trim();\n return UNPREFIXED_HEX_COLOR.test(trimmedColor)\n ? `#${trimmedColor}`\n : trimmedColor;\n}\n\nfunction parseHexColor(color: string) {\n const match = HEX_COLOR.exec(normalizeAccentColor(color));\n if (!match) {\n return;\n }\n const [, value] = match;\n if (!value) {\n return;\n }\n const expanded =\n value.length === 3\n ? Array.from(value, (character) => `${character}${character}`).join(\"\")\n : value;\n return [0, 2, 4].map((offset) =>\n Number.parseInt(expanded.slice(offset, offset + 2), 16)\n );\n}\n\nfunction relativeLuminance([red, green, blue]: number[]) {\n const [linearRed = 0, linearGreen = 0, linearBlue = 0] = [\n red,\n green,\n blue,\n ].map((channel = 0) => {\n const normalized = channel / 255;\n return normalized <= 0.040_45\n ? normalized / 12.92\n : ((normalized + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * linearRed + 0.7152 * linearGreen + 0.0722 * linearBlue;\n}\n\nexport function getAccentContrast(color: string) {\n const parsed = parseHexColor(color);\n if (!parsed) {\n return;\n }\n const luminance = relativeLuminance(parsed);\n const blackContrast = (luminance + 0.05) / 0.05;\n const whiteContrast = 1.05 / (luminance + 0.05);\n return blackContrast >= whiteContrast ? \"#000\" : \"#fff\";\n}\n"],"mappings":"AAAA,MAAM,EAAY,8BACZ,EAAuB,6BAE7B,SAAgB,EAAqB,EAAe,CAClD,IAAM,EAAe,EAAM,KAAK,EAChC,OAAO,EAAqB,KAAK,CAAY,EACzC,IAAI,IACJ,CACN,CAEA,SAAS,EAAc,EAAe,CACpC,IAAM,EAAQ,EAAU,KAAK,EAAqB,CAAK,CAAC,EACxD,GAAI,CAAC,EACH,OAEF,GAAM,EAAG,GAAS,EAClB,GAAI,CAAC,EACH,OAEF,IAAM,EACJ,EAAM,SAAW,EACb,MAAM,KAAK,EAAQ,GAAc,GAAG,IAAY,GAAW,CAAC,CAAC,KAAK,EAAE,EACpE,EACN,MAAO,CAAC,EAAG,EAAG,CAAC,CAAC,CAAC,IAAK,GACpB,OAAO,SAAS,EAAS,MAAM,EAAQ,EAAS,CAAC,EAAG,EAAE,CACxD,CACF,CAEA,SAAS,EAAkB,CAAC,EAAK,EAAO,GAAiB,CACvD,GAAM,CAAC,EAAY,EAAG,EAAc,EAAG,EAAa,GAAK,CACvD,EACA,EACA,CACF,CAAC,CAAC,KAAK,EAAU,IAAM,CACrB,IAAM,EAAa,EAAU,IAC7B,OAAO,GAAc,OACjB,EAAa,QACX,EAAa,MAAS,QAAU,GACxC,CAAC,EACD,MAAO,OAAS,EAAY,MAAS,EAAc,MAAS,CAC9D,CAEA,SAAgB,EAAkB,EAAe,CAC/C,IAAM,EAAS,EAAc,CAAK,EAClC,GAAI,CAAC,EACH,OAEF,IAAM,EAAY,EAAkB,CAAM,EAG1C,OAFuB,EAAY,KAAQ,KACrB,MAAQ,EAAY,KACF,OAAS,MACnD"}
1
+ {"version":3,"file":"accent-contrast.js","names":[],"sources":["../src/accent-contrast.ts"],"sourcesContent":["const HEX_COLOR = /^#([\\da-f]{3}|[\\da-f]{6})$/i;\nconst UNPREFIXED_HEX_COLOR = /^([\\da-f]{3}|[\\da-f]{6})$/i;\n\nexport function normalizeAccentColor(color: string) {\n const trimmedColor = color.trim();\n return UNPREFIXED_HEX_COLOR.test(trimmedColor)\n ? `#${trimmedColor}`\n : trimmedColor;\n}\n\nfunction parseHexColor(color: string) {\n const match = HEX_COLOR.exec(normalizeAccentColor(color));\n if (!match) {\n return;\n }\n const [, value] = match;\n if (!value) {\n return;\n }\n const expanded =\n value.length === 3\n ? Array.from(value, (character) => `${character}${character}`).join(\"\")\n : value;\n return [0, 2, 4].map((offset) =>\n Number.parseInt(expanded.slice(offset, offset + 2), 16)\n );\n}\n\nexport function getRgbAccentContrast([red, green, blue]: number[]) {\n const [linearRed = 0, linearGreen = 0, linearBlue = 0] = [\n red,\n green,\n blue,\n ].map((channel = 0) => {\n const normalized = channel / 255;\n return normalized <= 0.040_45\n ? normalized / 12.92\n : ((normalized + 0.055) / 1.055) ** 2.4;\n });\n const luminance =\n 0.2126 * linearRed + 0.7152 * linearGreen + 0.0722 * linearBlue;\n const blackContrast = (luminance + 0.05) / 0.05;\n const whiteContrast = 1.05 / (luminance + 0.05);\n return blackContrast >= whiteContrast ? \"#000\" : \"#fff\";\n}\n\nexport function getAccentContrast(color: string) {\n const parsed = parseHexColor(color);\n if (!parsed) {\n return;\n }\n return getRgbAccentContrast(parsed);\n}\n"],"mappings":"AAAA,MAAM,EAAY,8BACZ,EAAuB,6BAE7B,SAAgB,EAAqB,EAAe,CAClD,IAAM,EAAe,EAAM,KAAK,EAChC,OAAO,EAAqB,KAAK,CAAY,EACzC,IAAI,IACJ,CACN,CAEA,SAAS,EAAc,EAAe,CACpC,IAAM,EAAQ,EAAU,KAAK,EAAqB,CAAK,CAAC,EACxD,GAAI,CAAC,EACH,OAEF,GAAM,EAAG,GAAS,EAClB,GAAI,CAAC,EACH,OAEF,IAAM,EACJ,EAAM,SAAW,EACb,MAAM,KAAK,EAAQ,GAAc,GAAG,IAAY,GAAW,CAAC,CAAC,KAAK,EAAE,EACpE,EACN,MAAO,CAAC,EAAG,EAAG,CAAC,CAAC,CAAC,IAAK,GACpB,OAAO,SAAS,EAAS,MAAM,EAAQ,EAAS,CAAC,EAAG,EAAE,CACxD,CACF,CAEA,SAAgB,EAAqB,CAAC,EAAK,EAAO,GAAiB,CACjE,GAAM,CAAC,EAAY,EAAG,EAAc,EAAG,EAAa,GAAK,CACvD,EACA,EACA,CACF,CAAC,CAAC,KAAK,EAAU,IAAM,CACrB,IAAM,EAAa,EAAU,IAC7B,OAAO,GAAc,OACjB,EAAa,QACX,EAAa,MAAS,QAAU,GACxC,CAAC,EACK,EACJ,MAAS,EAAY,MAAS,EAAc,MAAS,EAGvD,OAFuB,EAAY,KAAQ,KACrB,MAAQ,EAAY,KACF,OAAS,MACnD,CAEA,SAAgB,EAAkB,EAAe,CAC/C,IAAM,EAAS,EAAc,CAAK,EAC7B,KAGL,OAAO,EAAqB,CAAM,CACpC"}
@@ -120,14 +120,12 @@
120
120
  transform 0.3s,
121
121
  border-color 0.3s;
122
122
  }
123
+ .lockerverse-auctions__catalog-card:is(:hover, :focus-within) {
124
+ border-color: var(--lockerverse-accent);
125
+ }
123
126
  .lockerverse-auctions__catalog-card:hover {
124
- border-color: rgb(255 255 255 / 20%);
125
127
  transform: translateY(-4px);
126
128
  }
127
- [data-lockerverse-theme="light"]
128
- .lockerverse-auctions__catalog-card:is(:hover, :focus-within) {
129
- border-color: color-mix(in srgb, var(--lockerverse-accent) 72%, #121416);
130
- }
131
129
  .lockerverse-auctions .lockerverse-auctions__catalog-select {
132
130
  position: absolute;
133
131
  inset: 0;
@@ -300,19 +298,16 @@
300
298
  padding: 10px 20px;
301
299
  font-size: 14px;
302
300
  font-weight: 600;
301
+ color: var(--lockerverse-accent-contrast, #000);
303
302
  text-transform: uppercase;
304
303
  letter-spacing: 0.12em;
305
- background: rgb(255 255 255 / 6%);
306
- border: 1px solid var(--lockerverse-border);
304
+ background: var(--lockerverse-accent);
305
+ border: 1px solid var(--lockerverse-accent);
307
306
  border-radius: 999px;
308
307
  transition:
309
308
  background 0.2s,
310
309
  color 0.2s;
311
310
  }
312
- .lockerverse-auctions__catalog-card:hover .lockerverse-auctions__catalog-cta {
313
- color: var(--lockerverse-bg);
314
- background: var(--lockerverse-text);
315
- }
316
311
  .lockerverse-auctions__catalog-arrow {
317
312
  display: flex;
318
313
  align-items: center;
@@ -383,17 +378,3 @@
383
378
  .lockerverse-auctions__catalog-header .lockerverse-auctions__catalog-next {
384
379
  color: var(--lockerverse-text);
385
380
  }
386
-
387
- /* The ready-made embed uses the community accent for its item actions. */
388
- .lockerverse-auctions--embed .lockerverse-auctions__catalog-cta,
389
- .lockerverse-auctions--embed
390
- .lockerverse-auctions__catalog-card:is(:hover, :focus-within)
391
- .lockerverse-auctions__catalog-cta {
392
- color: var(--lockerverse-accent-contrast);
393
- background: var(--lockerverse-accent);
394
- border-color: var(--lockerverse-accent);
395
- }
396
- .lockerverse-auctions--embed
397
- .lockerverse-auctions__catalog-card:is(:hover, :focus-within) {
398
- border-color: var(--lockerverse-accent);
399
- }
@@ -207,7 +207,7 @@
207
207
  padding: 12px 24px;
208
208
  font-size: 14px;
209
209
  font-weight: 600;
210
- color: #fff;
210
+ color: var(--lockerverse-accent-contrast, #000);
211
211
  text-transform: uppercase;
212
212
  letter-spacing: 0.14em;
213
213
  text-decoration: none;
@@ -384,8 +384,3 @@
384
384
  border: 1px solid var(--lockerverse-border);
385
385
  border-radius: 8px;
386
386
  }
387
-
388
- .lockerverse-auctions--embed.lockerverse-auctions
389
- .lockerverse-auctions__button {
390
- color: var(--lockerverse-accent-contrast);
391
- }
@@ -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;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA,2BAA2B;EAC3B;EACA;EACA,QAAQ;EACR,QAAQ;EACR,eAAe;;EAEf,kBAAkB,QAAQ;;EAE1B,sBAAsB,QAAQ;EAC9B,4BACE,UAAU;EAEZ,eAAe;;EAEf,iBAAiB;;;;iBC6PH,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;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA,2BAA2B;EAC3B;EACA;EACA,QAAQ;EACR,QAAQ;EACR,eAAe;;EAEf,kBAAkB,QAAQ;;EAE1B,sBAAsB,QAAQ;EAC9B,4BACE,UAAU;EAEZ,eAAe;;EAEf,iBAAiB;;;;iBC4PH,uBAAuB,OAAO,8CAA2B,IAAA"}
@@ -1,2 +1,2 @@
1
- import{a as e,c as t,i as n,l as r,n as i,r as a,s as o,t as s}from"./use-auction-boundary.js";import{n as c,t as l}from"./auction-image.js";import{a as u,o as d,t as f}from"./auction-checkout-view.js";import{r as p}from"./phone-field.js";import{t as m}from"./auction-result2.js";import{t as h}from"./host-callback.js";import{ArrowRight as g,ChevronDown as _,ChevronLeft as v,ChevronRight as y,Clock3 as b,Gavel as x,Info as S,Pause as C,Play as w,ShieldCheck as T,TimerReset as E,X as D}from"lucide-react";import{useCallback as O,useEffect as k,useId as A,useMemo as j,useRef as M,useState as N}from"react";import{Fragment as P,jsx as F,jsxs as I}from"react/jsx-runtime";import{getLockerverseAuctionMinimumBid as L}from"@lockerverse/sdk/auctions";import{Dialog as R}from"@base-ui/react/dialog";import z from"embla-carousel-autoplay";import B from"embla-carousel-react";const V=6e3;function H(e,t){let n=M(V),r=M(null),[i,a]=N(V),o=j(()=>z({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=B({duration:t?0:25,loop:!0},[o]),l=O(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/V})`)},[]),u=O(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(V,e))),o.stop(),l()},[o,l]),d=O(()=>{n.current=V,a(V),o.reset(),l()},[o,l]);return k(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),k(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(V,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 U({photos:e,name:t,imageSizes:n=`(max-width: 1279px) 100vw, 45vw`,selected:r,paused:a=!1,photoButtonRef:o,onSelect:s,onExpand:c}){let u=M(null),d=M(null),f=M([]),[p,m]=N(!0),[h,g]=N(!1),[_,b]=N(!1),[x,S]=N(!1),[T,E]=N(!1),{ref:D,visible:O}=i(),[A,j]=N(!1),[L,R]=N(!0),z=M(null),B=`lockerverse-auction-gallery__control ${L||A||_?`is-visible`:``}`,V=()=>{z.current&&clearTimeout(z.current),z.current=setTimeout(()=>j(!1),2e3)},U=e=>{if(e.pointerType!==`mouse`){R(!0);return}j(!0),z.current&&clearTimeout(z.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||V()};k(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>R(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(z.current??void 0)}},[]);let W=!(a||p||h||_||x||T)&&O,G=e.length,K=G?(r%G+G)%G:0,{viewportRef:q,embla:J,progressRef:Y,freeze:X,reset:Z}=H(W&&G>1,p);k(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>m(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),k(()=>{if(!J)return;let e=()=>s(J.selectedScrollSnap());return J.on(`select`,e).on(`reInit`,e),()=>{J.off(`select`,e).off(`reInit`,e)}},[J,s]),k(()=>{J&&J.selectedScrollSnap()!==K&&J.scrollTo(K,!0)},[J,K]),k(()=>{let e=()=>{document.hidden&&X()},t=()=>E(!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)}},[X]);let Q=e=>{J?.scrollTo((e+G)%G,p),Z()};return k(()=>{let e=d.current;d.current=null,e&&document.activeElement===e&&D.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[K,D]),k(()=>{let e=u.current,t=f.current[K];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)},[K,G]),I(`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=>{G<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`)&&(d.current=e.target),Q(K+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&g(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&g(!1)},ref:D,children:[G?I(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:U,onPointerLeave:V,onPointerMove:U,children:[F(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{X(),E(!0)},ref:q,children:F(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,r)=>F(`div`,{"aria-hidden":r!==K,className:`lockerverse-auction-gallery__slide`,children:F(`button`,{"aria-label":`View photo ${r+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{c(r)},ref:r===K?o:void 0,tabIndex:r===K?0:-1,type:`button`,children:F(l,{alt:`${t}, ${r+1} of ${G}`,className:`lockerverse-auction-gallery__image`,draggable:!1,fetchPriority:r===0?`high`:`auto`,height:900,loading:r===K?`eager`:`lazy`,maxWidth:1920,sizes:r===K?n:`auto, ${n}`,src:e,width:1200})})},`${e}-${r}`))})}),G>1&&!p&&I(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[F(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:F(`div`,{className:`lockerverse-auction-gallery__progress`,ref:Y,style:{transform:`scaleX(0)`}})}),F(`button`,{"aria-label":x?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${B}`,"data-gallery-control":!0,onClick:()=>S(e=>!e),title:x?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:F(x?w:C,{"aria-hidden":`true`,size:13})})]}),G>1&&I(P,{children:[F(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${B}`,"data-gallery-control":!0,onClick:()=>Q(K-1),type:`button`,children:F(v,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),F(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${B}`,"data-gallery-control":!0,onClick:()=>Q(K+1),type:`button`,children:F(y,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):F(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),G>1&&F(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:u,children:F(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>F(`button`,{"aria-label":`Show photo ${t+1} of ${G}`,"aria-pressed":K===t,className:`lockerverse-auction-gallery__thumbnail ${K===t?`is-selected`:``}`,onClick:()=>Q(t),ref:e=>{f.current[t]=e},type:`button`,children:F(l,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,loading:`lazy`,maxWidth:192,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function W({images:e,fallbackImage:t,name:n,imageSizes:r}){let i=[...new Set(e.filter(Boolean))];!i.length&&t&&i.push(t);let[a,o]=N(0),[s,c]=N(!1),u=M(null),d=M(null),f=u.current?.getRootNode(),p=f&&f instanceof ShadowRoot?f:void 0,m=i.length,h=m?(a%m+m)%m:0;return I(P,{children:[F(U,{imageSizes:r,name:n,onExpand:e=>{o(e),c(!0)},onSelect:o,paused:s,photoButtonRef:u,photos:i,selected:h}),m>0&&F(R.Root,{onOpenChange:c,open:s,children:I(R.Portal,{container:p,children:[F(R.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),I(R.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:u,onKeyDown:e=>{m<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),o((h+(e.key===`ArrowRight`?1:-1)+m)%m))},children:[I(R.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,h+1,` of `,m]}),I(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{d.current=null},onTouchEnd:e=>{let t=d.current;d.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||m<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&&o((h+(r<0?1:-1)+m)%m)},onTouchMove:e=>{e.touches.length!==1&&(d.current=null)},onTouchStart:e=>{let t=e.touches.item(0);d.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[F(l,{alt:`${n}, ${h+1} of ${m}`,height:900,maxWidth:1920,sizes:`100vw`,src:i[h],width:1200}),s&&m>1&&F(l,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,maxWidth:1920,sizes:`100vw`,src:i[(h+1)%m],width:1200})]}),F(R.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:F(D,{"aria-hidden":`true`,size:22})}),m>1&&I(P,{children:[F(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>o((h-1+m)%m),type:`button`,children:F(v,{"aria-hidden":`true`,size:28})}),F(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>o((h+1)%m),type:`button`,children:F(y,{"aria-hidden":`true`,size:28})})]})]})]})})]})}const G={1:`h1`,2:`h2`};function K(e){return F(e===`Buy Now`?T:e===`Available`||e===`Increment`?E:x,{"aria-hidden":`true`,size:16})}function q(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 J({auction:r,item:i,itemHeadingLevel:o=2,galleryImageSizes:c}){s(i.startAt??r.startAt,i.endAt??r.endAt);let[l,u]=N(!1),d=A(),f=e(r,i),p={active:`Closes`,draft:`Opens`,finished:`Closed`}[f],m=a(r,f,i),h=i.saleMode===`buy_now`,g=(i.description??``).trim().length>240,v=q(i,f),y=G[o];return I(`section`,{className:`lockerverse-auctions__item-summary`,children:[F(W,{fallbackImage:i.image??r.configuration.image??r.community?.banner??r.community?.thumbnail??null,imageSizes:c,images:i.images,name:i.name}),I(`div`,{className:`lockerverse-auctions__item-copy`,children:[F(y,{children:i.name}),i.description?I(`div`,{className:`lockerverse-auctions__item-description`,children:[F(t,{className:!l&&g?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:d}),g?I(`button`,{"aria-controls":d,"aria-expanded":l,className:`lockerverse-auctions__description-toggle`,onClick:()=>u(!l),type:`button`,children:[l?`Hide description`:`Read full description`,` `,F(_,{"aria-hidden":`true`,size:16,style:{transform:l?`rotate(180deg)`:void 0}})]}):null]}):null,I(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[v.map(([e,t])=>I(`div`,{className:`lockerverse-auctions__stat-row`,children:[I(`dt`,{children:[K(e),e]}),F(`dd`,{children:t})]},e)),I(`div`,{className:`lockerverse-auctions__stat-row`,children:[I(`dt`,{children:[F(b,{"aria-hidden":`true`,size:16}),p]}),F(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!h&&f===`finished`?I(`div`,{className:`lockerverse-auctions__stat-footer`,children:[I(`div`,{children:[F(`dt`,{children:`Floor`}),F(`dd`,{children:n(i.minBidAmount??0)})]}),I(`div`,{children:[F(`dt`,{children:`Bid increment`}),F(`dd`,{children:n(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const Y={1:`h2`,2:`h3`},X=/^\d+$/;function Z(e,t){let r=Number(e),i=r*(t.buyNowPriceAmount??0);if(!(X.test(e)&&Number.isSafeInteger(i))||r<1)return`Enter a whole-number quantity.`;if(!t.additionalCharge)return`Total: ${n(i)}`;let a=t.additionalCharge.firstUnitAmountCents+t.additionalCharge.additionalUnitAmountCents*(r-1),o=i+a;return Number.isSafeInteger(o)?`Subtotal: ${n(i)} · ${t.additionalCharge.name}: ${n(a)} · Total: ${n(o)}`:`Enter a valid quantity.`}function Q(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function ee(e,t){return o(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 te(e,t,n){return o(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${a(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function ne(e,t,n,r,i){let a={amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1};return t||(a.bidType=i),a}function re({auction:t,item:i,initialSelection:a,onContinue:c,onError:l,onBack:f,backHref:p,itemHeadingLevel:m=2}){let h=Y[m],_=i.saleMode===`buy_now`,v=Math.ceil(L(i)/100),[y,b]=N(Q(_,a,v)),[x,S]=N(a?.bidType??`fixed`),[C,w]=N(null),T=A();s(i.startAt??t.startAt,i.endAt??t.endAt);let E=e(t,i),D=E===`active`&&!o(i)&&i.saleMode!==`hybrid`;function O(e){if(e.preventDefault(),!X.test(y)){w(_?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let n=ne(t,_,a,y,x),r=u(t,i,n);if(r){w(r),l(r);return}try{d(t,i,n)}catch{w(`Enter a valid amount or quantity.`);return}c(n)}return D?I(`form`,{className:`lockerverse-auctions__selection`,onSubmit:O,children:[F(ie,{buyNow:_,headingTag:h,item:i,minimum:v}),I(`div`,{className:`lockerverse-auctions__selection-body`,children:[F(se,{bidType:x,enabled:!_&&!!i.supportsMaximumBids,id:T,onChange:e=>{S(e),w(null)}}),I(`label`,{className:`lockerverse-auctions__field`,htmlFor:T,children:[oe(_,x),I(`span`,{className:`lockerverse-auctions__amount-control`,children:[_?null:F(`span`,{"aria-hidden":`true`,children:`$`}),F(`input`,{"aria-describedby":`${T}-help`,"aria-invalid":!!C,autoComplete:`off`,id:T,inputMode:`numeric`,onChange:e=>{b(e.target.value),w(null)},placeholder:_?`1`:String(v),required:!0,value:y})]})]}),C?F(`p`,{role:`alert`,children:C}):null,F(`p`,{id:`${T}-help`,children:_?Z(y,i):`Enter a whole-dollar bid of at least ${n(v*100)}. Bid increment: ${n(i.bidIncrementAmount??100)}.`}),F(ae,{item:i}),I(`div`,{className:`lockerverse-auctions__selection-footer`,children:[F(`p`,{children:_?`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.`}),I(`button`,{className:`lockerverse-auctions__button`,disabled:!t.payment,type:`submit`,children:[_?`Continue to Checkout`:`Continue to Payment`,` `,F(g,{"aria-hidden":`true`,size:16})]})]}),t.payment?null:F(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):I(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[F(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),F(h,{children:ee(i,E)}),F(`p`,{children:te(t,i,E)}),I(r,{className:`lockerverse-auctions__button`,href:p,onBack:f,children:[`Browse auction items `,F(g,{"aria-hidden":`true`,size:16})]})]})}function ie({headingTag:e,item:t,buyNow:r,minimum:i}){return I(`div`,{className:`lockerverse-auctions__selection-header`,children:[F(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),F(e,{children:r?`Buy this item now.`:`Place your bid.`}),F(`p`,{children:r?`Choose how many you want, then complete the secure checkout.`:`Choose your bid amount. You are only charged if this bid wins after bidding closes.`}),I(`p`,{children:[r?`Price: `:`Minimum qualifying bid: `,F(`strong`,{children:n(r?t.buyNowPriceAmount??0:i*100)})]}),r&&t.availableQuantity!==null?I(`p`,{children:[t.availableQuantity,` available`]}):null,t.collectShippingAddress?F(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function ae({item:e}){return e.saleMode===`buy_now`||!e.additionalCharge?null:I(`p`,{children:[e.additionalCharge.name,`:`,` `,n(e.additionalCharge.firstUnitAmountCents),` will be added to your winning bid.`]})}function oe(e,t){return e?`Quantity`:t===`maximum`?`Your maximum bid`:`Your bid amount`}function se({bidType:e,enabled:t,id:n,onChange:r}){return t?I(`fieldset`,{className:`lockerverse-auctions__bid-types`,children:[F(`legend`,{children:`Bid type`}),[`fixed`,`maximum`].map(t=>I(`div`,{className:`lockerverse-auctions__bid-type`,children:[I(`label`,{children:[F(`input`,{checked:e===t,name:`${n}-bid-type`,onChange:()=>r(t),type:`radio`,value:t}),F(`span`,{children:t===`fixed`?`Fixed bid`:`Maximum bid`})]}),F(ce,{id:`${n}-${t}-help`,type:t})]},t))]}):null}function ce({id:e,type:t}){let[n,r]=N(!1);return I(`button`,{"aria-describedby":n?e:void 0,"aria-label":`About ${t===`fixed`?`fixed`:`maximum`} bids`,className:`lockerverse-auctions__bid-help-button`,onBlur:()=>r(!1),onClick:()=>r(!0),onFocus:()=>r(!0),onKeyDown:e=>{e.key===`Escape`&&r(!1)},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),type:`button`,children:[F(S,{"aria-hidden":`true`,size:16}),n&&F(`span`,{className:`lockerverse-auctions__bid-tip`,id:e,role:`tooltip`,children:t===`fixed`?`Bid this exact amount. It will not increase automatically.`:`We bid only what is needed to lead, up to your private limit. Accepted bids cannot be changed or canceled. A new bid is separate.`})]})}const $=()=>void 0;function le(e){let t=A(),{auction:n,item:r,selection:i,resumePurchase:a}=e,o=a?a.pricing:d(n,r,i),s=!!a||r.saleMode===`buy_now`;return F(f,{billingFields:null,buttonText:s?`Buy Now`:`Authorize Bid`,communityName:e.communityName??n.name,contactErrors:{},email:e.contact.email,id:t,includeServiceFee:i.includeServiceFee,isMaximumBid:!s&&i.bidType===`maximum`,isPurchase:s,isTerminal:!1,item:r,locked:!0,message:null,onBack:a||e.interactionLocked?void 0:e.onBack,onEmailChange:$,onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPhoneChange:$,onSameAsBillingChange:$,onSubmit:e=>e.preventDefault(),paymentFields:null,phone:e.contact.phone,phoneCountry:p(e.contact.phone),pricing:o,quantity:i.quantity,sameAsBilling:!0,serviceFeeCents:a?o.serviceFeeCents:d(n,r,{...i,includeServiceFee:n.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:n.serviceFeeEnabled,shippingFields:null,showFields:!a,submitDisabled:!0})}let ue,de=null;function fe(){return ue??=import(`./auction-payment-view.js`).then(e=>(de=e.AuctionPayment,e)),ue}function pe(e,t,n){let r=e?.publishableKey,i=e?.connectedAccountId,[a,o]=N(null);return k(()=>{if(!(n&&r))return;let e=fe().then(e=>e.loadAuctionStripe(r,i,t)).catch(()=>null);o({connectedAccountId:i,publishableKey:r,stripe:e,stripeLoader:t})},[n,r,i,t]),a?.publishableKey===r&&a?.connectedAccountId===i&&a?.stripeLoader===t?a?.stripe:void 0}function me(e){let[t,n]=N(()=>de),[r,i]=N(!1),a=!!(e.resumePurchase||e.interactionLocked);return k(()=>{let e=!0;return fe().then(({AuctionPayment:t})=>{e&&n(()=>t)},()=>{e&&i(!0)}),()=>{e=!1}},[]),t?F(t,{...e}):r?I(`div`,{children:[F(`p`,{role:`alert`,children:`Payment details could not load.`}),a&&F(`p`,{children:`Your purchase status is not confirmed. Keep this page open and contact the auction organizer before you try another purchase.`}),a?null:F(`button`,{onClick:e.onBack,type:`button`,children:`Back to item`}),!a&&F(`button`,{onClick:()=>window.location.reload(),type:`button`,children:`Reload page to try again`})]}):F(le,{...e})}function he({buyNow:e}){return I(`div`,{className:`lockerverse-auctions__progress`,children:[I(`span`,{children:[F(e?T:x,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),I(`span`,{children:[F(T,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),I(`span`,{children:[F(E,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function ge(e){let{auction:t,item:n,outcome:r}=e,i;return e.backHref?i={href:e.backHref,label:`View auction items`}:e.onBack&&(i={label:`View auction items`,onClick:e.onBack}),F(m,{auctionName:t.name,className:e.className,closesAtLabel:a(t,`active`,n),communityName:e.communityName??t.community?.name,focusHeading:!0,imageUrl:n.image??n.images[0]??t.configuration.image??void 0,itemName:n.name,outcome:r,primaryAction:e.returnToItemHref?{href:e.returnToItemHref,label:`Return to item`}:i,secondaryAction:e.returnToItemHref?i:void 0,style:{"--lockerverse-accent":t.community?.color??`#6f8f6d`,...e.style},theme:e.theme})}function _e(t){let{auction:n,itemId:i,resumePurchase:a,className:c,theme:l=`dark`,style:u}=t,d=M(null),[f,p]=N(n),m=M(n),_=f.items.find(e=>e.id===i)??a?.item;s(_?.startAt??f.startAt,_?.endAt??f.endAt);let[y,b]=N(()=>a?{amount:0,includeServiceFee:a.submission.includeServiceFee??!1,quantity:a.submission.quantity}:null),[x,S]=N(!!a),C=M(!0),w=M(t);w.current=t;let T=M(null),E=O(e=>{C.current&&S(e),T.current!==e&&(T.current=e,h(w.current.onInteractionLockChange,e))},[]),D=!!a;k(()=>(C.current=!0,E(D),()=>{C.current=!1}),[D,E]);let[A,j]=N({email:``,phone:``}),[P,L]=N(!!a),[R,z]=N(null),[B,V]=N(null);k(()=>{!(P||x||a)&&m.current!==n&&(m.current=n,p(n))},[n,P,x,a]);let H=pe(a?.payment??f.payment,t.stripeLoader,!!a||!!(_&&e(f,_)===`active`&&!o(_)&&_.saleMode!==`hybrid`));function U(e,t){E(!1),m.current=w.current.auction,p(e),b(null),L(!1),z(t)}function W(e){z(null),b(e),L(!0)}return _?B?F(ge,{...t,auction:f,item:_,outcome:B}):I(`section`,{className:[`lockerverse-auctions`,c].filter(Boolean).join(` `),"data-lockerverse-theme":l,ref:d,style:{"--lockerverse-accent":f.community?.color??`#6f8f6d`,...u},children:[x?null:I(r,{className:`lockerverse-auctions__back`,href:t.backHref,onBack:t.onBack,children:[F(v,{"aria-hidden":`true`,size:16}),` All items`]}),I(`div`,{className:`lockerverse-auctions__detail`,children:[F(J,{auction:f,galleryImageSizes:t.galleryImageSizes,item:_,itemHeadingLevel:t.itemHeadingLevel}),I(`div`,{className:`lockerverse-auctions__transaction`,children:[e(f,_)===`active`?F(he,{buyNow:_.saleMode===`buy_now`}):null,R?F(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:R}):null,P&&y?F(me,{...t,appearanceRoot:d,auction:f,communityName:t.communityName??f.community?.name,contact:A,interactionLocked:x,item:_,onBack:()=>L(!1),onContactChange:j,onIncludeServiceFeeChange:e=>b(t=>t&&{...t,includeServiceFee:f.serviceFeeEnabled&&e}),onInteractionLockChange:E,onResult:V,onReview:U,selection:y,stripePromise:H}):F(re,{auction:f,backHref:t.backHref,initialSelection:y,item:_,itemHeadingLevel:t.itemHeadingLevel,onBack:t.onBack,onContinue:W,onError:z}),x?null:I(r,{className:`lockerverse-auctions__footer-back`,href:t.backHref,onBack:t.onBack,children:[`Back to auction items `,F(g,{"aria-hidden":`true`,size:16})]})]})]})]}):I(`div`,{children:[F(`p`,{role:`alert`,children:`This auction item is no longer available.`}),F(r,{href:t.backHref,onBack:t.onBack,children:`Back to auction items`})]})}function ve(e){let t=M({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 F(c.Provider,{value:e.auction.mediaBaseUrl,children:F(_e,{...e})})}export{ve as LockerverseAuctionItem};
1
+ import{getAuctionPresentationStyle as e}from"./auction-presentation.js";import{a as t,c as n,i as r,l as i,n as a,r as o,s,t as c}from"./use-auction-boundary.js";import{n as l,t as u}from"./auction-image.js";import{a as d,o as f,t as p}from"./auction-checkout-view.js";import{r as m}from"./phone-field.js";import{t as h}from"./auction-result2.js";import{t as g}from"./host-callback.js";import{ArrowRight as _,ChevronDown as v,ChevronLeft as y,ChevronRight as b,Clock3 as x,Gavel as S,Info as C,Pause as w,Play as T,ShieldCheck as E,TimerReset as D,X as O}from"lucide-react";import{useCallback as k,useEffect as A,useId as j,useMemo as M,useRef as N,useState as P}from"react";import{Fragment as F,jsx as I,jsxs as L}from"react/jsx-runtime";import{getLockerverseAuctionMinimumBid as R}from"@lockerverse/sdk/auctions";import{Dialog as z}from"@base-ui/react/dialog";import B from"embla-carousel-autoplay";import V from"embla-carousel-react";const H=6e3;function U(e,t){let n=N(H),r=N(null),[i,a]=P(H),o=M(()=>B({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=V({duration:t?0:25,loop:!0},[o]),l=k(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/H})`)},[]),u=k(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(H,e))),o.stop(),l()},[o,l]),d=k(()=>{n.current=H,a(H),o.reset(),l()},[o,l]);return A(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),A(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(H,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 W({photos:e,name:t,imageSizes:n=`(max-width: 1279px) 100vw, 45vw`,selected:r,paused:i=!1,photoButtonRef:o,onSelect:s,onExpand:c}){let l=N(null),d=N(null),f=N([]),[p,m]=P(!0),[h,g]=P(!1),[_,v]=P(!1),[x,S]=P(!1),[C,E]=P(!1),{ref:D,visible:O}=a(),[k,j]=P(!1),[M,R]=P(!0),z=N(null),B=`lockerverse-auction-gallery__control ${M||k||_?`is-visible`:``}`,V=()=>{z.current&&clearTimeout(z.current),z.current=setTimeout(()=>j(!1),2e3)},H=e=>{if(e.pointerType!==`mouse`){R(!0);return}j(!0),z.current&&clearTimeout(z.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||V()};A(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>R(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(z.current??void 0)}},[]);let W=!(i||p||h||_||x||C)&&O,G=e.length,K=G?(r%G+G)%G:0,{viewportRef:q,embla:J,progressRef:Y,freeze:X,reset:Z}=U(W&&G>1,p);A(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>m(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),A(()=>{if(!J)return;let e=()=>s(J.selectedScrollSnap());return J.on(`select`,e).on(`reInit`,e),()=>{J.off(`select`,e).off(`reInit`,e)}},[J,s]),A(()=>{J&&J.selectedScrollSnap()!==K&&J.scrollTo(K,!0)},[J,K]),A(()=>{let e=()=>{document.hidden&&X()},t=()=>E(!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)}},[X]);let Q=e=>{J?.scrollTo((e+G)%G,p),Z()};return A(()=>{let e=d.current;d.current=null,e&&document.activeElement===e&&D.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[K,D]),A(()=>{let e=l.current,t=f.current[K];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)},[K,G]),L(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||v(!1)},onFocusCapture:e=>v(e.target.matches(`:focus-visible`)),onKeyDown:e=>{G<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`)&&(d.current=e.target),Q(K+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&g(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&g(!1)},ref:D,children:[G?L(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:H,onPointerLeave:V,onPointerMove:H,children:[I(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{X(),E(!0)},ref:q,children:I(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,r)=>I(`div`,{"aria-hidden":r!==K,className:`lockerverse-auction-gallery__slide`,children:I(`button`,{"aria-label":`View photo ${r+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{c(r)},ref:r===K?o:void 0,tabIndex:r===K?0:-1,type:`button`,children:I(u,{alt:`${t}, ${r+1} of ${G}`,className:`lockerverse-auction-gallery__image`,draggable:!1,fetchPriority:r===0?`high`:`auto`,height:900,loading:r===K?`eager`:`lazy`,maxWidth:1920,sizes:r===K?n:`auto, ${n}`,src:e,width:1200})})},`${e}-${r}`))})}),G>1&&!p&&L(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[I(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:I(`div`,{className:`lockerverse-auction-gallery__progress`,ref:Y,style:{transform:`scaleX(0)`}})}),I(`button`,{"aria-label":x?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${B}`,"data-gallery-control":!0,onClick:()=>S(e=>!e),title:x?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:I(x?T:w,{"aria-hidden":`true`,size:13})})]}),G>1&&L(F,{children:[I(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${B}`,"data-gallery-control":!0,onClick:()=>Q(K-1),type:`button`,children:I(y,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),I(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${B}`,"data-gallery-control":!0,onClick:()=>Q(K+1),type:`button`,children:I(b,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):I(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),G>1&&I(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:l,children:I(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>I(`button`,{"aria-label":`Show photo ${t+1} of ${G}`,"aria-pressed":K===t,className:`lockerverse-auction-gallery__thumbnail ${K===t?`is-selected`:``}`,onClick:()=>Q(t),ref:e=>{f.current[t]=e},type:`button`,children:I(u,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,loading:`lazy`,maxWidth:192,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function G({images:e,fallbackImage:t,name:n,imageSizes:r}){let i=[...new Set(e.filter(Boolean))];!i.length&&t&&i.push(t);let[a,o]=P(0),[s,c]=P(!1),l=N(null),d=N(null),f=l.current?.getRootNode(),p=f&&f instanceof ShadowRoot?f:void 0,m=i.length,h=m?(a%m+m)%m:0;return L(F,{children:[I(W,{imageSizes:r,name:n,onExpand:e=>{o(e),c(!0)},onSelect:o,paused:s,photoButtonRef:l,photos:i,selected:h}),m>0&&I(z.Root,{onOpenChange:c,open:s,children:L(z.Portal,{container:p,children:[I(z.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),L(z.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:l,onKeyDown:e=>{m<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),o((h+(e.key===`ArrowRight`?1:-1)+m)%m))},children:[L(z.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,h+1,` of `,m]}),L(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{d.current=null},onTouchEnd:e=>{let t=d.current;d.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||m<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&&o((h+(r<0?1:-1)+m)%m)},onTouchMove:e=>{e.touches.length!==1&&(d.current=null)},onTouchStart:e=>{let t=e.touches.item(0);d.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[I(u,{alt:`${n}, ${h+1} of ${m}`,height:900,maxWidth:1920,sizes:`100vw`,src:i[h],width:1200}),s&&m>1&&I(u,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,maxWidth:1920,sizes:`100vw`,src:i[(h+1)%m],width:1200})]}),I(z.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:I(O,{"aria-hidden":`true`,size:22})}),m>1&&L(F,{children:[I(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>o((h-1+m)%m),type:`button`,children:I(y,{"aria-hidden":`true`,size:28})}),I(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>o((h+1)%m),type:`button`,children:I(b,{"aria-hidden":`true`,size:28})})]})]})]})})]})}const K={1:`h1`,2:`h2`};function q(e){return I(e===`Buy Now`?E:e===`Available`||e===`Increment`?D:S,{"aria-hidden":`true`,size:16})}function J(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,r(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?r(e.maxBidAmount):`No bids`]]:[[`Current bid`,r(e.maxBidAmount??0)],[`Floor`,r(e.minBidAmount??0)],[`Increment`,r(e.bidIncrementAmount??100)]]}function Y({auction:e,item:i,itemHeadingLevel:a=2,galleryImageSizes:s}){c(i.startAt??e.startAt,i.endAt??e.endAt);let[l,u]=P(!1),d=j(),f=t(e,i),p={active:`Closes`,draft:`Opens`,finished:`Closed`}[f],m=o(e,f,i),h=i.saleMode===`buy_now`,g=(i.description??``).trim().length>240,_=J(i,f),y=K[a];return L(`section`,{className:`lockerverse-auctions__item-summary`,children:[I(G,{fallbackImage:i.image??e.configuration.image??e.community?.banner??e.community?.thumbnail??null,imageSizes:s,images:i.images,name:i.name}),L(`div`,{className:`lockerverse-auctions__item-copy`,children:[I(y,{children:i.name}),i.description?L(`div`,{className:`lockerverse-auctions__item-description`,children:[I(n,{className:!l&&g?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:d}),g?L(`button`,{"aria-controls":d,"aria-expanded":l,className:`lockerverse-auctions__description-toggle`,onClick:()=>u(!l),type:`button`,children:[l?`Hide description`:`Read full description`,` `,I(v,{"aria-hidden":`true`,size:16,style:{transform:l?`rotate(180deg)`:void 0}})]}):null]}):null,L(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[_.map(([e,t])=>L(`div`,{className:`lockerverse-auctions__stat-row`,children:[L(`dt`,{children:[q(e),e]}),I(`dd`,{children:t})]},e)),L(`div`,{className:`lockerverse-auctions__stat-row`,children:[L(`dt`,{children:[I(x,{"aria-hidden":`true`,size:16}),p]}),I(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!h&&f===`finished`?L(`div`,{className:`lockerverse-auctions__stat-footer`,children:[L(`div`,{children:[I(`dt`,{children:`Floor`}),I(`dd`,{children:r(i.minBidAmount??0)})]}),L(`div`,{children:[I(`dt`,{children:`Bid increment`}),I(`dd`,{children:r(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const X={1:`h2`,2:`h3`},Z=/^\d+$/;function Q(e,t){let n=Number(e),i=n*(t.buyNowPriceAmount??0);if(!(Z.test(e)&&Number.isSafeInteger(i))||n<1)return`Enter a whole-number quantity.`;if(!t.additionalCharge)return`Total: ${r(i)}`;let a=t.additionalCharge.firstUnitAmountCents+t.additionalCharge.additionalUnitAmountCents*(n-1),o=i+a;return Number.isSafeInteger(o)?`Subtotal: ${r(i)} · ${t.additionalCharge.name}: ${r(a)} · Total: ${r(o)}`:`Enter a valid quantity.`}function ee(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function te(e,t){return s(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 ne(e,t,n){return s(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${o(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function re(e,t,n,r,i){let a={amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1};return t||(a.bidType=i),a}function ie({auction:e,item:n,initialSelection:a,onContinue:o,onError:l,onBack:u,backHref:p,itemHeadingLevel:m=2}){let h=X[m],g=n.saleMode===`buy_now`,v=Math.ceil(R(n)/100),[y,b]=P(ee(g,a,v)),[x,S]=P(a?.bidType??`fixed`),[C,w]=P(null),T=j();c(n.startAt??e.startAt,n.endAt??e.endAt);let E=t(e,n),D=E===`active`&&!s(n)&&n.saleMode!==`hybrid`;function O(t){if(t.preventDefault(),!Z.test(y)){w(g?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let r=re(e,g,a,y,x),i=d(e,n,r);if(i){w(i),l(i);return}try{f(e,n,r)}catch{w(`Enter a valid amount or quantity.`);return}o(r)}return D?L(`form`,{className:`lockerverse-auctions__selection`,onSubmit:O,children:[I(ae,{buyNow:g,headingTag:h,item:n,minimum:v}),L(`div`,{className:`lockerverse-auctions__selection-body`,children:[I(ce,{bidType:x,enabled:!g&&!!n.supportsMaximumBids,id:T,onChange:e=>{S(e),w(null)}}),L(`label`,{className:`lockerverse-auctions__field`,htmlFor:T,children:[se(g,x),L(`span`,{className:`lockerverse-auctions__amount-control`,children:[g?null:I(`span`,{"aria-hidden":`true`,children:`$`}),I(`input`,{"aria-describedby":`${T}-help`,"aria-invalid":!!C,autoComplete:`off`,id:T,inputMode:`numeric`,onChange:e=>{b(e.target.value),w(null)},placeholder:g?`1`:String(v),required:!0,value:y})]})]}),C?I(`p`,{role:`alert`,children:C}):null,I(`p`,{id:`${T}-help`,children:g?Q(y,n):`Enter a whole-dollar bid of at least ${r(v*100)}. Bid increment: ${r(n.bidIncrementAmount??100)}.`}),I(oe,{item:n}),L(`div`,{className:`lockerverse-auctions__selection-footer`,children:[I(`p`,{children:g?`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.`}),L(`button`,{className:`lockerverse-auctions__button`,disabled:!e.payment,type:`submit`,children:[g?`Continue to Checkout`:`Continue to Payment`,` `,I(_,{"aria-hidden":`true`,size:16})]})]}),e.payment?null:I(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):L(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[I(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),I(h,{children:te(n,E)}),I(`p`,{children:ne(e,n,E)}),L(i,{className:`lockerverse-auctions__button`,href:p,onBack:u,children:[`Browse auction items `,I(_,{"aria-hidden":`true`,size:16})]})]})}function ae({headingTag:e,item:t,buyNow:n,minimum:i}){return L(`div`,{className:`lockerverse-auctions__selection-header`,children:[I(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),I(e,{children:n?`Buy this item now.`:`Place your bid.`}),I(`p`,{children:n?`Choose how many you want, then complete the secure checkout.`:`Choose your bid amount. You are only charged if this bid wins after bidding closes.`}),L(`p`,{children:[n?`Price: `:`Minimum qualifying bid: `,I(`strong`,{children:r(n?t.buyNowPriceAmount??0:i*100)})]}),n&&t.availableQuantity!==null?L(`p`,{children:[t.availableQuantity,` available`]}):null,t.collectShippingAddress?I(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function oe({item:e}){return e.saleMode===`buy_now`||!e.additionalCharge?null:L(`p`,{children:[e.additionalCharge.name,`:`,` `,r(e.additionalCharge.firstUnitAmountCents),` will be added to your winning bid.`]})}function se(e,t){return e?`Quantity`:t===`maximum`?`Your maximum bid`:`Your bid amount`}function ce({bidType:e,enabled:t,id:n,onChange:r}){return t?L(`fieldset`,{className:`lockerverse-auctions__bid-types`,children:[I(`legend`,{children:`Bid type`}),[`fixed`,`maximum`].map(t=>L(`div`,{className:`lockerverse-auctions__bid-type`,children:[L(`label`,{children:[I(`input`,{checked:e===t,name:`${n}-bid-type`,onChange:()=>r(t),type:`radio`,value:t}),I(`span`,{children:t===`fixed`?`Fixed bid`:`Maximum bid`})]}),I(le,{id:`${n}-${t}-help`,type:t})]},t))]}):null}function le({id:e,type:t}){let[n,r]=P(!1);return L(`button`,{"aria-describedby":n?e:void 0,"aria-label":`About ${t===`fixed`?`fixed`:`maximum`} bids`,className:`lockerverse-auctions__bid-help-button`,onBlur:()=>r(!1),onClick:()=>r(!0),onFocus:()=>r(!0),onKeyDown:e=>{e.key===`Escape`&&r(!1)},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),type:`button`,children:[I(C,{"aria-hidden":`true`,size:16}),n&&I(`span`,{className:`lockerverse-auctions__bid-tip`,id:e,role:`tooltip`,children:t===`fixed`?`Bid this exact amount. It will not increase automatically.`:`We bid only what is needed to lead, up to your private limit. Accepted bids cannot be changed or canceled. A new bid is separate.`})]})}const $=()=>void 0;function ue(e){let t=j(),{auction:n,item:r,selection:i,resumePurchase:a}=e,o=a?a.pricing:f(n,r,i),s=!!a||r.saleMode===`buy_now`;return I(p,{billingFields:null,buttonText:s?`Buy Now`:`Authorize Bid`,communityName:e.communityName??n.name,contactErrors:{},email:e.contact.email,id:t,includeServiceFee:i.includeServiceFee,isMaximumBid:!s&&i.bidType===`maximum`,isPurchase:s,isTerminal:!1,item:r,locked:!0,message:null,onBack:a||e.interactionLocked?void 0:e.onBack,onEmailChange:$,onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPhoneChange:$,onSameAsBillingChange:$,onSubmit:e=>e.preventDefault(),paymentFields:null,phone:e.contact.phone,phoneCountry:m(e.contact.phone),pricing:o,quantity:i.quantity,sameAsBilling:!0,serviceFeeCents:a?o.serviceFeeCents:f(n,r,{...i,includeServiceFee:n.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:n.serviceFeeEnabled,shippingFields:null,showFields:!a,submitDisabled:!0})}let de,fe=null;function pe(){return de??=import(`./auction-payment-view.js`).then(e=>(fe=e.AuctionPayment,e)),de}function me(e,t,n){let r=e?.publishableKey,i=e?.connectedAccountId,[a,o]=P(null);return A(()=>{if(!(n&&r))return;let e=pe().then(e=>e.loadAuctionStripe(r,i,t)).catch(()=>null);o({connectedAccountId:i,publishableKey:r,stripe:e,stripeLoader:t})},[n,r,i,t]),a?.publishableKey===r&&a?.connectedAccountId===i&&a?.stripeLoader===t?a?.stripe:void 0}function he(e){let[t,n]=P(()=>fe),[r,i]=P(!1),a=!!(e.resumePurchase||e.interactionLocked);return A(()=>{let e=!0;return pe().then(({AuctionPayment:t})=>{e&&n(()=>t)},()=>{e&&i(!0)}),()=>{e=!1}},[]),t?I(t,{...e}):r?L(`div`,{children:[I(`p`,{role:`alert`,children:`Payment details could not load.`}),a&&I(`p`,{children:`Your purchase status is not confirmed. Keep this page open and contact the auction organizer before you try another purchase.`}),a?null:I(`button`,{onClick:e.onBack,type:`button`,children:`Back to item`}),!a&&I(`button`,{onClick:()=>window.location.reload(),type:`button`,children:`Reload page to try again`})]}):I(ue,{...e})}function ge({buyNow:e}){return L(`div`,{className:`lockerverse-auctions__progress`,children:[L(`span`,{children:[I(e?E:S,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),L(`span`,{children:[I(E,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),L(`span`,{children:[I(D,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function _e(t){let{auction:n,item:r,outcome:i}=t,a;return t.backHref?a={href:t.backHref,label:`View auction items`}:t.onBack&&(a={label:`View auction items`,onClick:t.onBack}),I(h,{auctionName:n.name,className:t.className,closesAtLabel:o(n,`active`,r),communityName:t.communityName??n.community?.name,focusHeading:!0,imageUrl:r.image??r.images[0]??n.configuration.image??void 0,itemName:r.name,outcome:i,primaryAction:t.returnToItemHref?{href:t.returnToItemHref,label:`Return to item`}:a,secondaryAction:t.returnToItemHref?a:void 0,style:e(n,t.style,t.theme??`dark`),theme:t.theme})}function ve(n){let{auction:r,itemId:a,resumePurchase:o,className:l,theme:u=`dark`,style:d}=n,f=N(null),[p,m]=P(r),h=N(r),v=p.items.find(e=>e.id===a)??o?.item;c(v?.startAt??p.startAt,v?.endAt??p.endAt);let[b,x]=P(()=>o?{amount:0,includeServiceFee:o.submission.includeServiceFee??!1,quantity:o.submission.quantity}:null),[S,C]=P(!!o),w=N(!0),T=N(n);T.current=n;let E=N(null),D=k(e=>{w.current&&C(e),E.current!==e&&(E.current=e,g(T.current.onInteractionLockChange,e))},[]),O=!!o;A(()=>(w.current=!0,D(O),()=>{w.current=!1}),[O,D]);let[j,M]=P({email:``,phone:``}),[F,R]=P(!!o),[z,B]=P(null),[V,H]=P(null);A(()=>{!(F||S||o)&&h.current!==r&&(h.current=r,m(r))},[r,F,S,o]);let U=me(o?.payment??p.payment,n.stripeLoader,!!o||!!(v&&t(p,v)===`active`&&!s(v)&&v.saleMode!==`hybrid`));function W(e,t){D(!1),h.current=T.current.auction,m(e),x(null),R(!1),B(t)}function G(e){B(null),x(e),R(!0)}return v?V?I(_e,{...n,auction:p,item:v,outcome:V}):L(`section`,{className:[`lockerverse-auctions`,l].filter(Boolean).join(` `),"data-lockerverse-theme":u,ref:f,style:e(p,d,u),children:[S?null:L(i,{className:`lockerverse-auctions__back`,href:n.backHref,onBack:n.onBack,children:[I(y,{"aria-hidden":`true`,size:16}),` All items`]}),L(`div`,{className:`lockerverse-auctions__detail`,children:[I(Y,{auction:p,galleryImageSizes:n.galleryImageSizes,item:v,itemHeadingLevel:n.itemHeadingLevel}),L(`div`,{className:`lockerverse-auctions__transaction`,children:[t(p,v)===`active`?I(ge,{buyNow:v.saleMode===`buy_now`}):null,z?I(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:z}):null,F&&b?I(he,{...n,appearanceRoot:f,auction:p,communityName:n.communityName??p.community?.name,contact:j,interactionLocked:S,item:v,onBack:()=>R(!1),onContactChange:M,onIncludeServiceFeeChange:e=>x(t=>t&&{...t,includeServiceFee:p.serviceFeeEnabled&&e}),onInteractionLockChange:D,onResult:H,onReview:W,selection:b,stripePromise:U}):I(ie,{auction:p,backHref:n.backHref,initialSelection:b,item:v,itemHeadingLevel:n.itemHeadingLevel,onBack:n.onBack,onContinue:G,onError:B}),S?null:L(i,{className:`lockerverse-auctions__footer-back`,href:n.backHref,onBack:n.onBack,children:[`Back to auction items `,I(_,{"aria-hidden":`true`,size:16})]})]})]})]}):L(`div`,{children:[I(`p`,{role:`alert`,children:`This auction item is no longer available.`}),I(i,{href:n.backHref,onBack:n.onBack,children:`Back to auction items`})]})}function ye(e){let t=N({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 I(l.Provider,{value:e.auction.mediaBaseUrl,children:I(ve,{...e})})}export{ye as LockerverseAuctionItem};
2
2
  //# sourceMappingURL=auction-item.js.map