efficient-storefront-blocks 0.87.0 → 0.88.0

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 (178) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/chunks/{EditorPreviewCheckout-GD4IJ4WK.js → EditorPreviewCheckout-ZGPS3Q3X.js} +1 -1
  3. package/dist/chunks/{SiteEditorProvider-2UVCJZXS.js → SiteEditorProvider-HZ47WOEX.js} +1 -1
  4. package/dist/chunks/{chunk-H4IHUSCU.js → chunk-7C2YH2AQ.js} +1 -1
  5. package/dist/chunks/chunk-O7GCI2MP.js +1 -0
  6. package/dist/chunks/chunk-RHNDIM7Z.js +382 -0
  7. package/dist/chunks/chunk-VOK5N3IB.js +1 -0
  8. package/dist/chunks/{fitment-data-5GBUMO2O.js → fitment-data-SH4US3BV.js} +1 -1
  9. package/dist/contract.js +14 -2
  10. package/dist/editor/components/CategorySource.d.ts +8 -1
  11. package/dist/editor/components/CategorySource.js +1 -1
  12. package/dist/editor/components/CollectionPicker.js +1 -1
  13. package/dist/editor/components/EditProductLink.js +1 -1
  14. package/dist/editor/components/FinishPicker.js +1 -1
  15. package/dist/editor/components/FormPicker.js +1 -1
  16. package/dist/editor/components/GalleryShowcaseSource.js +1 -1
  17. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  18. package/dist/editor/components/ProductHeroSource.js +1 -1
  19. package/dist/editor/components/ProductPicker.js +1 -1
  20. package/dist/editor/components/ReviewsProductSource.js +1 -1
  21. package/dist/editor/components/SocialLinksDoor.js +1 -1
  22. package/dist/editor/components/SpecTableSource.js +1 -1
  23. package/dist/editor/lib/document/blocks/commerce/BundleOffer/fields.js +1 -1
  24. package/dist/editor/lib/document/blocks/commerce/FilterBlock/fields.d.ts +2 -0
  25. package/dist/editor/lib/document/blocks/commerce/FilterBlock/fields.js +1 -0
  26. package/dist/editor/lib/document/blocks/commerce/FilterChipsBlock/fields.d.ts +2 -0
  27. package/dist/editor/lib/document/blocks/commerce/FilterChipsBlock/fields.js +1 -0
  28. package/dist/editor/lib/document/blocks/commerce/GalleryItem/fields.js +1 -1
  29. package/dist/editor/lib/document/blocks/commerce/ProductBuyButton/fields.d.ts +2 -0
  30. package/dist/editor/lib/document/blocks/commerce/ProductBuyButton/fields.js +1 -0
  31. package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
  32. package/dist/editor/lib/document/blocks/commerce/ProductName/fields.js +1 -1
  33. package/dist/editor/lib/document/blocks/commerce/ProductPicture/fields.js +1 -1
  34. package/dist/editor/lib/document/blocks/commerce/controls.d.ts +4 -0
  35. package/dist/editor/lib/document/blocks/commerce/controls.js +1 -1
  36. package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
  37. package/dist/editor/lib/document/blocks/commerce/index.js +1 -1
  38. package/dist/editor/lib/document/config.js +1 -1
  39. package/dist/editor/lib/editor-words-kept.d.ts +1 -0
  40. package/dist/editor/lib/editor-words-kept.js +1 -0
  41. package/dist/editor/lib/efficient-backend.d.ts +7 -1
  42. package/dist/editor/lib/efficient-backend.js +1 -1
  43. package/dist/editor/lib/storefront-document.js +1 -1
  44. package/dist/editor/lib/storefront-editor-words.d.ts +33 -4
  45. package/dist/editor/lib/storefront-editor-words.js +1 -1
  46. package/dist/editor.css +1 -1
  47. package/dist/index.js +134 -81
  48. package/dist/links.js +1 -1
  49. package/dist/render/app/globals.css +111 -0
  50. package/dist/render/built-with.json +1 -1
  51. package/dist/render/components/BundleCard.d.ts +2 -1
  52. package/dist/render/components/BundleCard.js +1 -1
  53. package/dist/render/components/GalleryGrid.js +1 -1
  54. package/dist/render/components/GalleryItem.d.ts +11 -1
  55. package/dist/render/components/GalleryItem.js +1 -1
  56. package/dist/render/components/GridCardTemplate.d.ts +7 -1
  57. package/dist/render/components/GridCardTemplate.js +1 -1
  58. package/dist/render/components/ProductGridSection.d.ts +5 -1
  59. package/dist/render/components/ProductGridSection.js +1 -1
  60. package/dist/render/components/ProductHeroPanel.js +1 -1
  61. package/dist/render/components/ProductRef.d.ts +8 -2
  62. package/dist/render/components/ProductRef.js +1 -1
  63. package/dist/render/components/SectionBand.d.ts +3 -2
  64. package/dist/render/components/SectionBand.js +1 -1
  65. package/dist/render/components/card-pieces/CardBuyButton.d.ts +8 -1
  66. package/dist/render/components/card-pieces/CardBuyButton.js +1 -1
  67. package/dist/render/components/card-pieces/CardName.d.ts +2 -1
  68. package/dist/render/components/card-pieces/CardName.js +1 -1
  69. package/dist/render/components/card-pieces/CardPrice.js +1 -1
  70. package/dist/render/components/card-pieces/CardProductBadge.d.ts +2 -1
  71. package/dist/render/components/card-pieces/CardProductBadge.js +1 -1
  72. package/dist/render/components/card-pieces/CardProductPicture.d.ts +5 -0
  73. package/dist/render/components/card-pieces/CardProductPicture.js +1 -1
  74. package/dist/render/components/card-pieces/CardSpecs.js +1 -1
  75. package/dist/render/components/card-pieces/HostPart.js +1 -1
  76. package/dist/render/components/card-pieces/ProductCardState.d.ts +25 -6
  77. package/dist/render/components/card-pieces/ProductCardState.js +1 -1
  78. package/dist/render/components/catalog/CatalogFilterContext.d.ts +4 -1
  79. package/dist/render/components/catalog/CatalogFilterContext.js +1 -1
  80. package/dist/render/components/catalog/ClearAllButton.d.ts +4 -0
  81. package/dist/render/components/catalog/ClearAllButton.js +1 -0
  82. package/dist/render/components/catalog/FilterPill.d.ts +4 -2
  83. package/dist/render/components/catalog/FilterPill.js +1 -1
  84. package/dist/render/components/catalog/ShopperChips.d.ts +13 -0
  85. package/dist/render/components/catalog/ShopperChips.js +1 -0
  86. package/dist/render/components/catalog/ShopperFilters.d.ts +20 -0
  87. package/dist/render/components/catalog/ShopperFilters.js +1 -0
  88. package/dist/render/components/catalog/ShopperScope.d.ts +72 -0
  89. package/dist/render/components/catalog/ShopperScope.js +3 -0
  90. package/dist/render/components/catalog/SortSelect.js +1 -1
  91. package/dist/render/components/pdp-dynamic/DynamicRelatedProducts.js +1 -1
  92. package/dist/render/components/wheels-plp/PlpActiveChips.js +1 -1
  93. package/dist/render/components/wheels-plp/PlpPagination.d.ts +2 -1
  94. package/dist/render/components/wheels-plp/PlpPagination.js +1 -1
  95. package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
  96. package/dist/render/components/wheels-plp/usePlpFiltersInUrl.d.ts +2 -0
  97. package/dist/render/components/wheels-plp/usePlpFiltersInUrl.js +1 -1
  98. package/dist/render/lib/api/index.d.ts +6 -0
  99. package/dist/render/lib/api/index.js +1 -1
  100. package/dist/render/lib/catalog/related-cards.d.ts +4 -1
  101. package/dist/render/lib/catalog/relationships.d.ts +9 -2
  102. package/dist/render/lib/catalog/relationships.js +1 -1
  103. package/dist/render/lib/commerce.d.ts +2 -0
  104. package/dist/render/lib/commerce.js +1 -1
  105. package/dist/render/lib/content/article-body.js +1 -5
  106. package/dist/render/lib/content/filter-card-seed.d.ts +10 -0
  107. package/dist/render/lib/content/filter-card-seed.js +1 -0
  108. package/dist/render/lib/content/product-card-seed.d.ts +5 -0
  109. package/dist/render/lib/content/product-card-seed.js +1 -1
  110. package/dist/render/lib/document/blocks/commerce/BundleOffer/meta.js +1 -1
  111. package/dist/render/lib/document/blocks/commerce/BundleOffer/render.js +1 -1
  112. package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.d.ts +8 -0
  113. package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.js +1 -0
  114. package/dist/render/lib/document/blocks/commerce/FilterBlock/render.d.ts +2 -0
  115. package/dist/render/lib/document/blocks/commerce/FilterBlock/render.js +1 -0
  116. package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/meta.d.ts +8 -0
  117. package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/meta.js +1 -0
  118. package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/render.d.ts +2 -0
  119. package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/render.js +1 -0
  120. package/dist/render/lib/document/blocks/commerce/GalleryB/meta.js +1 -1
  121. package/dist/render/lib/document/blocks/commerce/GalleryItem/render.js +1 -1
  122. package/dist/render/lib/document/blocks/commerce/ProductBuyButton/meta.d.ts +2 -0
  123. package/dist/render/lib/document/blocks/commerce/ProductBuyButton/meta.js +1 -0
  124. package/dist/render/lib/document/blocks/commerce/ProductBuyButton/render.d.ts +2 -0
  125. package/dist/render/lib/document/blocks/commerce/ProductBuyButton/render.js +1 -0
  126. package/dist/render/lib/document/blocks/commerce/ProductGrid/meta.js +1 -1
  127. package/dist/render/lib/document/blocks/commerce/ProductGrid/render.js +1 -1
  128. package/dist/render/lib/document/blocks/commerce/ProductHero/meta.js +1 -1
  129. package/dist/render/lib/document/blocks/commerce/ProductName/render.js +1 -1
  130. package/dist/render/lib/document/blocks/commerce/ProductPicture/render.js +1 -1
  131. package/dist/render/lib/document/blocks/commerce/metas.d.ts +3 -0
  132. package/dist/render/lib/document/blocks/commerce/metas.js +1 -1
  133. package/dist/render/lib/document/blocks/commerce/renders.d.ts +3 -0
  134. package/dist/render/lib/document/blocks/commerce/renders.js +1 -1
  135. package/dist/render/lib/document/card-templates.d.ts +1 -0
  136. package/dist/render/lib/document/card-templates.js +1 -1
  137. package/dist/render/lib/document/document-nodes.d.ts +24 -0
  138. package/dist/render/lib/document/document-nodes.js +1 -0
  139. package/dist/render/lib/document/lazy-draws.js +1 -1
  140. package/dist/render/lib/document/render-config.js +1 -1
  141. package/dist/render/lib/document/storefront-root.js +1 -1
  142. package/dist/render/lib/links/link-rules.js +1 -1
  143. package/dist/render/lib/sections/bundle-to-grid.d.ts +8 -0
  144. package/dist/render/lib/sections/bundle-to-grid.js +1 -0
  145. package/dist/render/lib/sections/catalog-text-size.d.ts +2 -0
  146. package/dist/render/lib/sections/catalog-text-size.js +1 -1
  147. package/dist/render/lib/sections/filter-option-rows.d.ts +37 -0
  148. package/dist/render/lib/sections/filter-option-rows.js +1 -0
  149. package/dist/render/lib/sections/gallery-toolbar.d.ts +27 -0
  150. package/dist/render/lib/sections/gallery-toolbar.js +1 -0
  151. package/dist/render/lib/sections/grid-no-hole.d.ts +3 -0
  152. package/dist/render/lib/sections/grid-no-hole.js +1 -1
  153. package/dist/render/lib/sections/product-grid-pages.d.ts +42 -0
  154. package/dist/render/lib/sections/product-grid-pages.js +1 -0
  155. package/dist/render/lib/sections/shopper-filters.d.ts +45 -0
  156. package/dist/render/lib/sections/shopper-filters.js +1 -0
  157. package/dist/render/lib/wheels/plp-filters.d.ts +6 -3
  158. package/dist/render/lib/wheels/plp-filters.js +1 -1
  159. package/dist/render/lib/wheels/plp-hydrate.d.ts +5 -3
  160. package/dist/render/lib/wheels/plp-hydrate.js +1 -1
  161. package/dist/render/lib/wheels/selected-ranges.d.ts +16 -0
  162. package/dist/render/lib/wheels/selected-ranges.js +1 -0
  163. package/dist/render/lib/wheels/set-mode.d.ts +10 -0
  164. package/dist/render/lib/wheels/set-mode.js +1 -1
  165. package/dist/render/lib/wheels/shopper-first-paint.d.ts +28 -0
  166. package/dist/render/lib/wheels/shopper-first-paint.js +1 -0
  167. package/dist/render/lib/wheels/shopper-scope.d.ts +11 -0
  168. package/dist/render/lib/wheels/shopper-scope.js +1 -0
  169. package/dist/words.d.ts +46 -6
  170. package/dist/words.js +6 -6
  171. package/package.json +4 -4
  172. package/dist/chunks/chunk-QLR6IVWJ.js +0 -369
  173. package/dist/chunks/chunk-SYK5QPNV.js +0 -1
  174. package/dist/chunks/chunk-XZ46W3NV.js +0 -1
  175. package/dist/render/components/pdp-dynamic/DynamicBundleOffer.d.ts +0 -13
  176. package/dist/render/components/pdp-dynamic/DynamicBundleOffer.js +0 -1
  177. /package/dist/chunks/{chunk-DLWIDJS5.js → chunk-NQLVRCTI.js} +0 -0
  178. /package/dist/chunks/{chunk-QLR6IVWJ.js.LEGAL.txt → chunk-RHNDIM7Z.js.LEGAL.txt} +0 -0
@@ -0,0 +1,42 @@
1
+ export declare const MORE_PRODUCTS_OPTIONS: readonly [{
2
+ readonly value: "hide";
3
+ readonly label: "Hide the rest";
4
+ }, {
5
+ readonly value: "pages";
6
+ readonly label: "Pages";
7
+ }];
8
+ export type MoreProducts = (typeof MORE_PRODUCTS_OPTIONS)[number]["value"];
9
+ export declare const DEFAULT_MORE_PRODUCTS: MoreProducts;
10
+ export declare const DEFAULT_PER_PAGE = 12;
11
+ export declare const PER_PAGE_RANGE: {
12
+ readonly min: 4;
13
+ readonly max: 48;
14
+ readonly step: 4;
15
+ };
16
+ export declare function parseMoreProducts(value: unknown): MoreProducts;
17
+ export declare function gridShownOf(total: number, paging: {
18
+ paged: boolean;
19
+ per: number;
20
+ cap: boolean;
21
+ }, page?: number): {
22
+ total: number;
23
+ range: {
24
+ from: number;
25
+ to: number;
26
+ } | null;
27
+ };
28
+ export declare function gridLimitOf(props: {
29
+ limit?: unknown;
30
+ showAll?: unknown;
31
+ }): number | undefined;
32
+ export declare function gridPagingOf(props: {
33
+ moreProducts?: unknown;
34
+ perPage?: unknown;
35
+ limit?: unknown;
36
+ showAll?: unknown;
37
+ }): {
38
+ paged: boolean;
39
+ per: number;
40
+ limit: number | undefined;
41
+ cap: boolean;
42
+ };
@@ -0,0 +1 @@
1
+ import{parseOption as o}from"efficient-web-builder/format/lib/parse-option";const i=[{value:"hide",label:"Hide the rest"},{value:"pages",label:"Pages"}],u="hide",f=12,a={min:4,max:48,step:4};function c(e){return o(i.map(t=>t.value),u,typeof e=="string"?e:void 0)}function p(e,t,r=1){const n=e===0?null:t.paged?{from:(r-1)*t.per+1,to:Math.min(e,r*t.per)}:t.cap?null:{from:1,to:e};return{total:e,range:n}}function d(e){return e.showAll||typeof e.limit!="number"?void 0:e.limit}function P(e){const t=c(e.moreProducts)==="pages",r=t?void 0:d(e),n=typeof e.perPage=="number"&&e.perPage>0?Math.floor(e.perPage):f;return{paged:t,per:n,limit:r,cap:typeof r=="number"&&r>0}}export{u as DEFAULT_MORE_PRODUCTS,f as DEFAULT_PER_PAGE,i as MORE_PRODUCTS_OPTIONS,a as PER_PAGE_RANGE,d as gridLimitOf,P as gridPagingOf,p as gridShownOf,c as parseMoreProducts};
@@ -0,0 +1,45 @@
1
+ import { type PlpSortKey } from "../wheels/plp-filters.js";
2
+ export declare const FILTER_LOOK_OPTIONS: readonly [{
3
+ readonly value: "bar-pills";
4
+ readonly label: "Bar · pills";
5
+ }, {
6
+ readonly value: "bar-columns";
7
+ readonly label: "Bar · columns";
8
+ }, {
9
+ readonly value: "rail";
10
+ readonly label: "Side rail";
11
+ }];
12
+ export type FilterLook = (typeof FILTER_LOOK_OPTIONS)[number]["value"];
13
+ export declare const DEFAULT_FILTER_LOOK: FilterLook;
14
+ export declare const FILTER_LOOK_PHONE_OPTIONS: readonly [{
15
+ readonly value: "bar";
16
+ readonly label: "Bar";
17
+ }, {
18
+ readonly value: "button";
19
+ readonly label: "Filters button";
20
+ }, {
21
+ readonly value: "rail";
22
+ readonly label: "Side rail";
23
+ }];
24
+ export type FilterLookPhone = (typeof FILTER_LOOK_PHONE_OPTIONS)[number]["value"];
25
+ export declare const DEFAULT_FILTER_LOOK_PHONE: FilterLookPhone;
26
+ export declare const SHOWN_FILTER_OPTIONS: readonly [{
27
+ readonly value: "inStock";
28
+ readonly label: "In stock";
29
+ }, {
30
+ readonly value: "category";
31
+ readonly label: "Category";
32
+ }, {
33
+ readonly value: "lugs";
34
+ readonly label: string;
35
+ }, {
36
+ readonly value: "price";
37
+ readonly label: string;
38
+ }];
39
+ export type ShownFilter = (typeof SHOWN_FILTER_OPTIONS)[number]["value"];
40
+ export declare const DEFAULT_SHOWN_FILTERS: readonly ShownFilter[];
41
+ export declare const DEFAULT_OPENING_SORT: PlpSortKey;
42
+ export declare function parseFilterLook(value: unknown): FilterLook;
43
+ export declare function parseFilterLookPhone(value: unknown): FilterLookPhone;
44
+ export declare function parseShownFilters(value: unknown): ShownFilter[];
45
+ export declare function parseOpeningSort(value: unknown): PlpSortKey;
@@ -0,0 +1 @@
1
+ import{DEFAULT_CATALOG_FILTER_LABELS as o}from"../content/catalog-filter-labels.js";import{STOCK_WORDS as n}from"../content/stock-words.js";import{parseOption as l}from"efficient-web-builder/format/lib/parse-option";import{asPlpSortKey as a}from"../wheels/plp-filters.js";const i=[{value:"bar-pills",label:"Bar · pills"},{value:"bar-columns",label:"Bar · columns"},{value:"rail",label:"Side rail"}],p="bar-pills",s=[{value:"bar",label:"Bar"},{value:"button",label:"Filters button"},{value:"rail",label:"Side rail"}],u="bar",O=[{value:"inStock",label:n.inStock},{value:"category",label:"Category"},{value:"lugs",label:o.lugs},{value:"price",label:o.price}],c=["inStock","category","lugs","price"],b="recommended";function f(e){return l(i.map(r=>r.value),p,typeof e=="string"?e:void 0)}function E(e){return l(s.map(r=>r.value),u,typeof e=="string"?e:void 0)}function F(e){if(!Array.isArray(e))return[...c];const r=new Set(O.map(t=>t.value));return e.filter(t=>typeof t=="string"&&r.has(t))}function m(e){return a(typeof e=="string"?e:void 0)}export{p as DEFAULT_FILTER_LOOK,u as DEFAULT_FILTER_LOOK_PHONE,b as DEFAULT_OPENING_SORT,c as DEFAULT_SHOWN_FILTERS,i as FILTER_LOOK_OPTIONS,s as FILTER_LOOK_PHONE_OPTIONS,O as SHOWN_FILTER_OPTIONS,f as parseFilterLook,E as parseFilterLookPhone,m as parseOpeningSort,F as parseShownFilters};
@@ -22,6 +22,8 @@ export interface PlpFilterState {
22
22
  tyreTypes: string[];
23
23
  speedRatings: string[];
24
24
  priceMax: number | null;
25
+ priceMin?: number | null;
26
+ lugs?: number[];
25
27
  inStockOnly: boolean;
26
28
  kind: ProductKind | null;
27
29
  sort: PlpSortKey;
@@ -31,10 +33,11 @@ export declare const EMPTY_PLP_FILTERS: PlpFilterState;
31
33
  export declare function sizePairLabel(pair: SizePair): string;
32
34
  export declare function wheelSizeLabels(wheel: WheelSummary): string[];
33
35
  export declare function formatWidth(width: number): string;
34
- export declare function itemMatchesPlp(item: PlpItem, f: PlpFilterState, currency: Currency, except?: PlpFacetKey | "price" | "inStock" | "kind" | null): boolean;
36
+ export declare function itemMatchesPlp(item: PlpItem, f: PlpFilterState, currency: Currency, except?: PlpFacetKey | "price" | "inStock" | "kind" | "lugs" | null, otherKinds?: "fail" | "pass"): boolean;
35
37
  export declare function plpInStockCount(items: readonly PlpItem[], f: PlpFilterState, currency: Currency): number;
36
38
  export declare function sortPlpItems<T extends PlpItem>(items: readonly T[], sort: PlpSortKey, currency: Currency): T[];
37
39
  export declare function applyPlpFilters<T extends PlpItem>(items: readonly T[], f: PlpFilterState, currency: Currency): T[];
40
+ export declare function applyShopperFilters<T extends PlpItem>(items: readonly T[], f: PlpFilterState, currency: Currency): T[];
38
41
  export declare function hasActivePlpFilters(f: PlpFilterState): boolean;
39
42
  export interface PlpFacetOption {
40
43
  value: string;
@@ -49,7 +52,7 @@ export interface PlpFacetGroup {
49
52
  options: PlpFacetOption[];
50
53
  }
51
54
  export declare const PLP_FACET_LABELS: Record<PlpFacetKey, string>;
52
- export declare function buildPlpFacets(items: readonly PlpItem[], f: PlpFilterState, currency: Currency, kinds?: readonly ProductKind[], fieldUsage?: readonly FieldUsageAnswer[]): PlpFacetGroup[];
55
+ export declare function buildPlpFacets(items: readonly PlpItem[], f: PlpFilterState, currency: Currency, kinds?: readonly ProductKind[], fieldUsage?: readonly FieldUsageAnswer[], otherKinds?: "fail" | "pass"): PlpFacetGroup[];
53
56
  export declare const PLP_ONE_VALUE_MAX = 1;
54
57
  export declare function listingHiddenFacets(props: Readonly<Record<string, unknown>>): PlpFacetKey[];
55
58
  export declare function facetWantedByAnyKind(key: PlpFacetKey, kinds: readonly ProductKind[], fieldUsage: readonly FieldUsageAnswer[]): boolean;
@@ -79,7 +82,7 @@ export declare function plpPriceBounds(items: readonly PlpItem[], currency: Curr
79
82
  max: number;
80
83
  } | null;
81
84
  export interface PlpChip {
82
- key: PlpFacetKey | "price" | "inStock" | "kind";
85
+ key: PlpFacetKey | "price" | "priceMin" | "inStock" | "kind" | "lugs";
83
86
  value: string;
84
87
  label: string;
85
88
  }
@@ -1 +1 @@
1
- import{answerOrder as q,answersForKind as M,facetFieldKey as T,keepForFilter as U,NO_FIELD_ANSWERS as V,orderByAnswers as G}from"../content/field-usage.js";import{STOCK_WORDS as H}from"../content/stock-words.js";import{parseOption as X}from"efficient-web-builder/format/lib/parse-option";import{comparePrice as A,priceIn as J,withinPriceRange as Q}from"./price-display.js";import{trimDecimal as ee,wheelSizeLabel as te}from"./spec-format.js";import{itemBrand as z,itemCollections as ne,itemDiameters as re,itemFinishFamilies as oe,itemFinishes as ie,itemInStock as k,itemIsNew as L,itemKind as b,itemName as R,itemPcds as se,itemPrices as S,itemSpeedRatings as ce,itemTyreSizes as _,itemTyreTypes as le,PLP_ANY_TYPE_LABEL as ae,PLP_KIND_LABELS as E,PLP_KINDS as ue}from"../catalog/plp-item.js";import{parseTyreSize as pe,tyreSizeLabel as F,tyreSizeLabels as fe,TYRE_SIZE_PARTS as h,TYRE_SIZE_PART_LABELS as de}from"../tyres/tyre-size.js";const me={recommended:"Recommended","price-asc":"Price · low to high","price-desc":"Price · high to low",new:"Newest",name:"Name A–Z"},O=Object.keys(me);function N(e){return X(O,"recommended",e)}function he(e){return O.filter(t=>t!=="recommended"||e.length<=1)}function Oe(e,t){const r=N(e);return he(t).includes(r)?r:"name"}const y=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],Se={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},ye={diameters:"tyreSizes"};function I(e){if(e.length===0)return[];const t=y.filter(r=>e.every(n=>Se[r].includes(n)));return t.filter(r=>{const n=ye[r];return!n||!t.includes(n)})}function Ne(e,t){return t&&e.includes(t)?[t]:[...e]}function K(e){const t=new Set;for(const r of e)t.add(b(r));return[...t]}const Ie={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function Ke(e){return`${ge(e.width)}×${e.diameter}`}function ve(e){return[...new Set((e.sizePairs??[]).map(t=>te(t.diameter,t.width)))]}function ge(e){return ee(e)}function g(e,t,r,n=null){if(n!=="kind"&&t.kind&&b(e)!==t.kind)return!1;for(const i of y){if(n===i)continue;const o=t[i];if(o.length===0)continue;const s=o.map(String);if(!v(e,i).some(l=>s.includes(l)))return!1}return!(n!=="price"&&!Q(S(e),r,null,t.priceMax)||n!=="inStock"&&t.inStockOnly&&!k(e))}function Be(e,t,r){return e.filter(n=>k(n)&&g(n,t,r,"inStock")).length}function Pe(e,t,r){const n=[...e],i=(s,l)=>R(s).localeCompare(R(l)),o=K(e).length>1;switch(t){case"price-asc":return n.sort((s,l)=>A(S(s),S(l),r,"asc"));case"price-desc":return n.sort((s,l)=>A(S(s),S(l),r,"desc"));case"name":return n.sort(i);case"new":return n.sort((s,l)=>{const a=(L(l)?1:0)-(L(s)?1:0);return a!==0||!o?a:i(s,l)});default:return n}}function Ce(e,t,r){return Pe(e.filter(n=>g(n,t,r)),t.sort,r)}function De(e){return y.some(t=>e[t].length>0)||e.priceMax!=null||e.inStockOnly||e.kind!=null}const xe={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size · diameter",collections:"Collection",pcds:"PCD · fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function v(e,t){switch(t){case"tyreSizes":return[...new Set(_(e).flatMap(fe))];case"brands":return z(e)?[z(e)]:[];case"finishes":return oe(e);case"diameters":return re(e).map(String);case"collections":return ne(e);case"pcds":return se(e);case"tyreTypes":return le(e);case"speedRatings":return ce(e)}}function we(e){const t=new Map;for(const r of e)for(const n of ie(r))n.color&&!t.has(n.family)&&t.set(n.family,n.color);return t}function Ye(e,t,r,n=K(e),i=V){const o=c=>be(c,n,i),s=we(e),l=I(n).filter(c=>c!=="tyreSizes").filter(o).map(c=>{const u=t[c].map(String),P=new Set,w=new Map,x=new Map;for(const p of e){const m=v(p,c);for(const f of m)P.add(f);for(const f of new Set(m))x.set(f,(x.get(f)??0)+1);if(g(p,t,r,c))for(const f of new Set(m))w.set(f,(w.get(f)??0)+1)}const j=[...P].map(p=>({value:p,label:c==="diameters"?`${p}″`:p,count:w.get(p)??0,checked:u.includes(p),swatch:c==="finishes"?s.get(p)??null:null})).sort((p,m)=>{if(c==="diameters")return Number(p.value)-Number(m.value);const f=(x.get(m.value)??0)-(x.get(p.value)??0);return f!==0?f:p.value.localeCompare(m.value)});return{key:c,label:xe[c],options:j}}).filter(c=>c.options.length>B),a=[];for(const c of l){const u=_e(c.key,n,i);u!==void 0&&a.push({fieldKey:c.key,filterOrder:u})}return[...G(l,c=>c.key,a,"filterOrder")]}const B=1;function $e(e){return e.showCollection===!1?["collections"]:[]}function be(e,t,r){return t.length===0||r.length===0?!0:t.some(n=>U(M(r,n))(T(e,n)))}function _e(e,t,r){if(r.length===0)return;let n;for(const i of t){const o=q(M(r,i),"filter")(T(e,i));o!==void 0&&(n===void 0||o<n)&&(n=o)}return n}function Me(e){const t=new Set;for(const r of e)for(const n of _(r))t.add(F(n));return t.size}function We(e,t){return I(t).includes("tyreSizes")?Me(e)>B:!1}function C(e){const t=pe(e);if(t)return t;const[r,n]=e.split("/");return{width:r?Number(r):void 0,profile:n?Number(n):void 0}}function Te(e,t,r){return h.slice(0,h.indexOf(r)).every(n=>{const i=t[n];return i==null||e[n]===i})}function Ze(e,t,r){const n=C(t.tyreSizes[0]??""),i=new Set(e.filter(o=>g(o,t,r,"tyreSizes")));return h.map(o=>{const s=new Map;for(const a of e){const c=_(a).filter(u=>Te(u,n,o));for(const u of new Set(c.map(P=>P[o])))s.has(u)||s.set(u,0),i.has(a)&&s.set(u,(s.get(u)??0)+1)}const l=[...s.keys()].sort((a,c)=>a-c).map(a=>({value:a,label:o==="rim"?`R${a}`:String(a),count:s.get(a)??0}));return{part:o,label:de[o],value:n[o]??null,options:l}})}function je(e,t,r,n){const i={...C(t)},o=h.indexOf(r);i[r]=n??void 0;for(const s of h.slice(o+1))i[s]!=null&&e.some(c=>h.slice(0,h.indexOf(s)+1).every(u=>i[u]==null||c[u]===i[u]))||(i[s]=void 0);return F(i)}function qe(e,t,r,n){if(t.length<2)return[];const i=e.filter(o=>g(o,r,n,"kind"));return[{kind:null,label:ae,count:i.length,checked:r.kind===null},...t.map(o=>({kind:o,label:E[o],count:i.filter(s=>b(s)===o).length,checked:r.kind===o}))]}function Ue(e,t){if(e.length===0)return null;const r=e.map(o=>J(S(o),t)).filter(o=>o!==null);if(r.length===0)return null;const n=Math.floor(Math.min(...r)),i=Math.ceil(Math.max(...r));return i>n?{min:n,max:i}:null}function Ve(e,t,r){const n=[];e.kind&&n.push({key:"kind",value:e.kind,label:E[e.kind]}),e.inStockOnly&&n.push({key:"inStock",value:"",label:H.inStock});for(const i of y)for(const o of e[i]){const s=String(o);n.push({key:i,value:s,label:i==="diameters"?`${s}″`:i==="pcds"?`PCD ${s}`:s})}return e.priceMax!=null&&n.push({key:"price",value:"",label:`Up to ${r(e.priceMax,t)}`}),n}const d={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},D="type",Y="maxPrice",$="inStock",W="sort",Z="page";function Ge(e){const t=o=>e.getAll(o).flatMap(s=>s.split(",")).filter(Boolean),r=Number(e.get(Y)),n=Number(e.get(Z)),i=e.get(D);return{tyreSizes:t(d.tyreSizes),brands:t(d.brands),finishes:t(d.finishes),diameters:t(d.diameters).map(Number).filter(Number.isFinite),collections:t(d.collections),pcds:t(d.pcds),tyreTypes:t(d.tyreTypes),speedRatings:t(d.speedRatings),priceMax:Number.isFinite(r)&&r>0?r:null,inStockOnly:e.get($)==="1",kind:ue.find(o=>o===i)??null,sort:N(e.get(W)),page:Number.isFinite(n)&&n>=1?Math.floor(n):1}}function He(e){const t=new URLSearchParams;for(const r of y){const n=e[r];n.length>0&&t.set(d[r],n.join(","))}return e.priceMax!=null&&t.set(Y,String(e.priceMax)),e.inStockOnly&&t.set($,"1"),e.kind&&t.set(D,e.kind),e.sort!=="recommended"&&t.set(W,e.sort),e.page>1&&t.set(Z,String(e.page)),t}function Xe(e,t){if(e<=7)return Array.from({length:e},(o,s)=>s+1);const r=[1],n=Math.max(2,t-1),i=Math.min(e-1,t+1);n>2&&r.push(null);for(let o=n;o<=i;o++)r.push(o);return i<e-1&&r.push(null),r.push(e),r}function Je(e,t,r){const n=e.length,i=Math.max(1,Math.floor(r)),o=Math.max(1,Math.ceil(n/i)),s=Math.min(Math.max(1,Math.floor(t)),o),l=(s-1)*i;return{items:e.slice(l,l+i),page:s,pageCount:o,total:n,from:n===0?0:l+1,to:Math.min(l+i,n)}}export{Ie as EMPTY_PLP_FILTERS,y as PLP_FACET_KEYS,xe as PLP_FACET_LABELS,B as PLP_ONE_VALUE_MAX,d as PLP_PARAM,me as PLP_SORT_LABELS,D as PLP_TYPE_PARAM,Ce as applyPlpFilters,N as asPlpSortKey,Ye as buildPlpFacets,qe as buildPlpTypeOptions,Ze as buildTyreSizeBoxes,be as facetWantedByAnyKind,ge as formatWidth,De as hasActivePlpFilters,g as itemMatchesPlp,$e as listingHiddenFacets,Je as paginatePlp,je as pickTyreSize,Ve as plpActiveChips,I as plpFacetKeysFor,Ge as plpFiltersFromParams,He as plpFiltersToParams,Be as plpInStockCount,Oe as plpOpeningSort,Xe as plpPageSequence,Ue as plpPriceBounds,Ne as plpShownKinds,he as plpSortKeysFor,We as plpTyreSizeBoxesShown,Me as plpTyreSizeCount,Ke as sizePairLabel,Pe as sortPlpItems,ve as wheelSizeLabels};
1
+ import{answerOrder as G,answersForKind as k,facetFieldKey as L,keepForFilter as H,NO_FIELD_ANSWERS as J,orderByAnswers as Q}from"../content/field-usage.js";import{STOCK_WORDS as ee}from"../content/stock-words.js";import{parseOption as te}from"efficient-web-builder/format/lib/parse-option";import{comparePrice as R,FROM_PREFIX_START as ne,priceIn as re,withinPriceRange as ie}from"./price-display.js";import{trimDecimal as se,wheelSizeLabel as oe}from"./spec-format.js";import{itemLugs as le,lugFilterLabel as ce}from"./lug-count.js";import{itemBrand as z,itemCollections as ae,itemDiameters as ue,itemFinishFamilies as pe,itemFinishes as fe,itemInStock as F,itemIsNew as E,itemKind as M,itemName as O,itemPcds as de,itemPrices as g,itemSpeedRatings as me,itemTyreSizes as _,itemTyreTypes as he,PLP_ANY_TYPE_LABEL as Se,PLP_KIND_LABELS as N,PLP_KINDS as ye}from"../catalog/plp-item.js";import{parseTyreSize as ge,tyreSizeLabel as v,tyreSizeLabels as Pe,TYRE_SIZE_PARTS as S,TYRE_SIZE_PART_LABELS as we}from"../tyres/tyre-size.js";const xe={recommended:"Recommended","price-asc":"Price · low to high","price-desc":"Price · high to low",new:"Newest",name:"Name A–Z"},I=Object.keys(xe);function B(e){return te(I,"recommended",e)}function be(e){return I.filter(t=>t!=="recommended"||e.length<=1)}function Ke(e,t){const r=B(e);return be(t).includes(r)?r:"name"}const P=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],T={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Me={diameters:"tyreSizes"};function C(e){if(e.length===0)return[];const t=P.filter(r=>e.every(n=>T[r].includes(n)));return t.filter(r=>{const n=Me[r];return!n||!t.includes(n)})}function De(e,t){return t&&e.includes(t)?[t]:[...e]}function K(e){const t=new Set;for(const r of e)t.add(M(r));return[...t]}const Ye={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function $e(e){return`${_e(e.width)}×${e.diameter}`}function We(e){return[...new Set((e.sizePairs??[]).map(t=>oe(t.diameter,t.width)))]}function _e(e){return se(e)}function w(e,t,r,n=null,s="fail"){const i=M(e),o=l=>s==="fail"||(l==="lugs"?i==="alloy-wheel":T[l].includes(i));if(n!=="kind"&&t.kind&&i!==t.kind)return!1;for(const l of P){if(n===l)continue;const a=t[l];if(a.length===0||!o(l))continue;const f=a.map(String);if(!Y(e,l).some(u=>f.includes(u)))return!1}if(n!=="lugs"&&t.lugs&&t.lugs.length>0&&o("lugs")){const l=le(e);if(l===null||!t.lugs.includes(l))return!1}return!(n!=="price"&&!ie(g(e),r,t.priceMin??null,t.priceMax)||n!=="inStock"&&t.inStockOnly&&!F(e))}function Ze(e,t,r){return e.filter(n=>F(n)&&w(n,t,r,"inStock")).length}function D(e,t,r){const n=[...e],s=(o,l)=>O(o).localeCompare(O(l)),i=K(e).length>1;switch(t){case"price-asc":return n.sort((o,l)=>R(g(o),g(l),r,"asc"));case"price-desc":return n.sort((o,l)=>R(g(o),g(l),r,"desc"));case"name":return n.sort(s);case"new":return n.sort((o,l)=>{const a=(E(l)?1:0)-(E(o)?1:0);return a!==0||!i?a:s(o,l)});default:return n}}function je(e,t,r){return D(e.filter(n=>w(n,t,r)),t.sort,r)}function qe(e,t,r){return D(e.filter(n=>w(n,t,r,null,"pass")),t.sort,r)}function Ue(e){return P.some(t=>e[t].length>0)||(e.lugs?.length??0)>0||e.priceMin!=null||e.priceMax!=null||e.inStockOnly||e.kind!=null}const Te={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size · diameter",collections:"Collection",pcds:"PCD · fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function Y(e,t){switch(t){case"tyreSizes":return[...new Set(_(e).flatMap(Pe))];case"brands":return z(e)?[z(e)]:[];case"finishes":return pe(e);case"diameters":return ue(e).map(String);case"collections":return ae(e);case"pcds":return de(e);case"tyreTypes":return he(e);case"speedRatings":return me(e)}}function Ae(e){const t=new Map;for(const r of e)for(const n of fe(r))n.color&&!t.has(n.family)&&t.set(n.family,n.color);return t}function Ve(e,t,r,n=K(e),s=J,i="fail"){const o=c=>ke(c,n,s),l=Ae(e),f=(i==="pass"?P.filter(c=>n.some(y=>T[c].includes(y))):C(n)).filter(c=>c!=="tyreSizes").filter(o).map(c=>{const y=t[c].map(String),A=new Set,b=new Map,x=new Map;for(const p of e){const h=Y(p,c);for(const d of h)A.add(d);for(const d of new Set(h))x.set(d,(x.get(d)??0)+1);if(w(p,t,r,c,i))for(const d of new Set(h))b.set(d,(b.get(d)??0)+1)}const X=[...A].map(p=>({value:p,label:c==="diameters"?`${p}″`:p,count:b.get(p)??0,checked:y.includes(p),swatch:c==="finishes"?l.get(p)??null:null})).sort((p,h)=>{if(c==="diameters")return Number(p.value)-Number(h.value);const d=(x.get(h.value)??0)-(x.get(p.value)??0);return d!==0?d:p.value.localeCompare(h.value)});return{key:c,label:Te[c],options:X}}).filter(c=>c.options.length>$),u=[];for(const c of f){const y=Le(c.key,n,s);y!==void 0&&u.push({fieldKey:c.key,filterOrder:y})}return[...Q(f,c=>c.key,u,"filterOrder")]}const $=1;function Xe(e){return e.showCollection===!1?["collections"]:[]}function ke(e,t,r){return t.length===0||r.length===0?!0:t.some(n=>H(k(r,n))(L(e,n)))}function Le(e,t,r){if(r.length===0)return;let n;for(const s of t){const i=G(k(r,s),"filter")(L(e,s));i!==void 0&&(n===void 0||i<n)&&(n=i)}return n}function Re(e){const t=new Set;for(const r of e)for(const n of _(r))t.add(v(n));return t.size}function Ge(e,t){return C(t).includes("tyreSizes")?Re(e)>$:!1}function W(e){const t=ge(e);if(t)return t;const[r,n]=e.split("/");return{width:r?Number(r):void 0,profile:n?Number(n):void 0}}function ze(e,t,r){return S.slice(0,S.indexOf(r)).every(n=>{const s=t[n];return s==null||e[n]===s})}function He(e,t,r){const n=W(t.tyreSizes[0]??""),s=new Set(e.filter(i=>w(i,t,r,"tyreSizes")));return S.map(i=>{const o=new Map;for(const a of e){const f=_(a).filter(u=>ze(u,n,i));for(const u of new Set(f.map(c=>c[i])))o.has(u)||o.set(u,0),s.has(a)&&o.set(u,(o.get(u)??0)+1)}const l=[...o.keys()].sort((a,f)=>a-f).map(a=>({value:a,label:i==="rim"?`R${a}`:String(a),count:o.get(a)??0}));return{part:i,label:we[i],value:n[i]??null,options:l}})}function Je(e,t,r,n){const s={...W(t)},i=S.indexOf(r);s[r]=n??void 0;for(const o of S.slice(i+1))s[o]!=null&&e.some(f=>S.slice(0,S.indexOf(o)+1).every(u=>s[u]==null||f[u]===s[u]))||(s[o]=void 0);return v(s)}function Qe(e,t,r,n){if(t.length<2)return[];const s=e.filter(i=>w(i,r,n,"kind"));return[{kind:null,label:Se,count:s.length,checked:r.kind===null},...t.map(i=>({kind:i,label:N[i],count:s.filter(o=>M(o)===i).length,checked:r.kind===i}))]}function et(e,t){if(e.length===0)return null;const r=e.map(i=>re(g(i),t)).filter(i=>i!==null);if(r.length===0)return null;const n=Math.floor(Math.min(...r)),s=Math.ceil(Math.max(...r));return s>n?{min:n,max:s}:null}function tt(e,t,r){const n=[];e.kind&&n.push({key:"kind",value:e.kind,label:N[e.kind]}),e.inStockOnly&&n.push({key:"inStock",value:"",label:ee.inStock});for(const s of P)for(const i of e[s]){const o=String(i);n.push({key:s,value:o,label:s==="diameters"?`${o}″`:s==="pcds"?`PCD ${o}`:o})}for(const s of e.lugs??[])n.push({key:"lugs",value:String(s),label:ce(s)});return e.priceMin!=null&&n.push({key:"priceMin",value:"",label:`${ne}${r(e.priceMin,t)}`}),e.priceMax!=null&&n.push({key:"price",value:"",label:`Up to ${r(e.priceMax,t)}`}),n}const m={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},Z="type",j="maxPrice",q="inStock",U="sort",V="page";function nt(e){const t=i=>e.getAll(i).flatMap(o=>o.split(",")).filter(Boolean),r=Number(e.get(j)),n=Number(e.get(V)),s=e.get(Z);return{tyreSizes:t(m.tyreSizes),brands:t(m.brands),finishes:t(m.finishes),diameters:t(m.diameters).map(Number).filter(Number.isFinite),collections:t(m.collections),pcds:t(m.pcds),tyreTypes:t(m.tyreTypes),speedRatings:t(m.speedRatings),priceMax:Number.isFinite(r)&&r>0?r:null,inStockOnly:e.get(q)==="1",kind:ye.find(i=>i===s)??null,sort:B(e.get(U)),page:Number.isFinite(n)&&n>=1?Math.floor(n):1}}function rt(e){const t=new URLSearchParams;for(const r of P){const n=e[r];n.length>0&&t.set(m[r],n.join(","))}return e.priceMax!=null&&t.set(j,String(e.priceMax)),e.inStockOnly&&t.set(q,"1"),e.kind&&t.set(Z,e.kind),e.sort!=="recommended"&&t.set(U,e.sort),e.page>1&&t.set(V,String(e.page)),t}function it(e,t){if(e<=7)return Array.from({length:e},(i,o)=>o+1);const r=[1],n=Math.max(2,t-1),s=Math.min(e-1,t+1);n>2&&r.push(null);for(let i=n;i<=s;i++)r.push(i);return s<e-1&&r.push(null),r.push(e),r}function st(e,t,r){const n=e.length,s=Math.max(1,Math.floor(r)),i=Math.max(1,Math.ceil(n/s)),o=Math.min(Math.max(1,Math.floor(t)),i),l=(o-1)*s;return{items:e.slice(l,l+s),page:o,pageCount:i,total:n,from:n===0?0:l+1,to:Math.min(l+s,n)}}export{Ye as EMPTY_PLP_FILTERS,P as PLP_FACET_KEYS,Te as PLP_FACET_LABELS,$ as PLP_ONE_VALUE_MAX,m as PLP_PARAM,xe as PLP_SORT_LABELS,Z as PLP_TYPE_PARAM,je as applyPlpFilters,qe as applyShopperFilters,B as asPlpSortKey,Ve as buildPlpFacets,Qe as buildPlpTypeOptions,He as buildTyreSizeBoxes,ke as facetWantedByAnyKind,_e as formatWidth,Ue as hasActivePlpFilters,w as itemMatchesPlp,Xe as listingHiddenFacets,st as paginatePlp,Je as pickTyreSize,tt as plpActiveChips,C as plpFacetKeysFor,nt as plpFiltersFromParams,rt as plpFiltersToParams,Ze as plpInStockCount,Ke as plpOpeningSort,it as plpPageSequence,et as plpPriceBounds,De as plpShownKinds,be as plpSortKeysFor,Ge as plpTyreSizeBoxesShown,Re as plpTyreSizeCount,$e as sizePairLabel,D as sortPlpItems,We as wheelSizeLabels};
@@ -1,17 +1,20 @@
1
1
  import type { Data } from "efficient-easel/blocks";
2
2
  import type { ProductKind, ProductSummary, WheelSummary } from "../api/index.js";
3
3
  import type { FieldUsageAnswer } from "../content/field-usage.js";
4
+ import { FILTER_BLOCK_TYPE, PRODUCT_GRID_TYPE } from "../document/document-nodes.js";
4
5
  export declare const ALLOY_WHEELS_LISTING_TYPE = "AlloyWheelsListing";
5
- export declare const PRODUCT_GRID_TYPE = "ProductGrid";
6
+ export { PRODUCT_GRID_TYPE };
6
7
  export declare const GRID_CATALOG_PROP = "catalog";
7
8
  export declare const CATALOG_FILTER_BAR_TYPE = "CatalogFilterBar";
8
9
  export declare const FIELD_USAGE_PROP = "fieldUsage";
9
10
  export declare const LISTING_QUERY_PROP = "requestQuery";
11
+ export { FILTER_BLOCK_TYPE };
10
12
  interface ContentNode {
11
13
  type?: string;
12
14
  props?: Record<string, unknown>;
13
15
  }
14
16
  export declare function pageHasWheelsListing(data: Data | null | undefined): boolean;
17
+ export declare function pageHasHydratedValues(data: Data | null | undefined): boolean;
15
18
  export declare function pageReadsFieldUsage(data: Data | null | undefined): boolean;
16
19
  export declare function hydrateFieldUsage(data: Data, answers: readonly FieldUsageAnswer[]): Data;
17
20
  export declare function listingCatalogKinds(data: Data | null | undefined): ProductKind[];
@@ -19,5 +22,4 @@ export declare function listingWantsWheelsOnly(kinds: readonly ProductKind[]): b
19
22
  export declare function hydrateWheelsListing(data: Data, products: ProductSummary[] | WheelSummary[]): Data;
20
23
  export declare function stampListingQuery(data: Data, query: string): Data;
21
24
  export declare function dehydrateWheelsListing(data: Data): Data;
22
- export declare function dehydrateWheelsListingNode<T extends ContentNode>(node: T): T;
23
- export {};
25
+ export declare function dehydrateWheelsListingNode<T extends ContentNode>(stamped: T): T;
@@ -1 +1 @@
1
- import{resolvePlpKinds as O}from"../catalog/plp-item.js";import{gridKindsOf as R,gridRowsOf as w,isLinkedSource as E}from"./grid-source.js";const c="AlloyWheelsListing",G="ProductGrid",L="catalog",W="CatalogFilterBar",u="fieldUsage",x="requestQuery";function l(r){return r.props?.source}function o(r){return r?.type===G&&E(l(r))}function a(r){return r?.type===W}function g(r){return r?.type===c||o(r)||a(r)}function _(r){const e=r.content??[],t=r.zones??{};return[...e,...Object.values(t).flat()]}function I(r){return r?_(r).some(e=>e?.type===c||o(e)):!1}function U(r){return r?_(r).some(g):!1}function S(r,e){return e.length===0?r:f(r,g,t=>({...t,props:{...t.props??{},[u]:e}}))}function C(r){if(!r)return[];const e=new Set;for(const t of _(r)){if(t?.type!==c&&!o(t))continue;const s=t.props?.kinds;for(const n of o(t)?R(l(t),s):O(s))e.add(n)}return[...e]}function N(r){return r.length===1&&r[0]==="alloy-wheel"}function k(r,e){return T(r,t=>o(t)?{...t,props:{...h(t).props,[L]:w(l(t),t.props?.kinds,e)}}:{...t,props:{...y(t).props,products:e}})}function z(r,e){const t=e.replace(/^\?/,"");return t?f(r,s=>s?.type===c,s=>({...s,props:{...s.props??{},[x]:t}})):r}function Y(r){return f(r,g,e=>a(e)?P(e):o(e)?h(e):y(e))}function P(r){if(!r.props||!(u in r.props))return r;const{[u]:e,...t}=r.props;return{...r,props:t}}function h(r){const{[L]:e,[u]:t,...s}=r.props??{},n=s.source;if(n&&"wheels"in n){const{wheels:i,...p}=n;s.source=p}return{...r,props:s}}function D(r){return o(r)?h(r):a(r)?P(r):r?.type===c?y(r):r}function y(r){const{wheels:e,products:t,[u]:s,[x]:n,...i}=r.props??{};return{...r,props:i}}function T(r,e){return f(r,t=>t?.type===c||o(t),e)}function f(r,e,t){const s=p=>e(p)?t(p):p,n=r,i={...r};return n.content&&(i.content=n.content.map(s)),n.zones&&(i.zones=Object.fromEntries(Object.entries(n.zones).map(([p,m])=>[p,m.map(s)]))),i}export{c as ALLOY_WHEELS_LISTING_TYPE,W as CATALOG_FILTER_BAR_TYPE,u as FIELD_USAGE_PROP,L as GRID_CATALOG_PROP,x as LISTING_QUERY_PROP,G as PRODUCT_GRID_TYPE,Y as dehydrateWheelsListing,D as dehydrateWheelsListingNode,S as hydrateFieldUsage,k as hydrateWheelsListing,C as listingCatalogKinds,N as listingWantsWheelsOnly,I as pageHasWheelsListing,U as pageReadsFieldUsage,z as stampListingQuery};
1
+ import{resolvePlpKinds as O}from"../catalog/plp-item.js";import{gridKindsOf as E,gridRowsOf as S,isLinkedSource as T}from"./grid-source.js";import{FILTER_BLOCK_TYPE as y,PRODUCT_GRID_TYPE as L,documentNodes as W,mapDocumentNodes as G}from"../document/document-nodes.js";import{selectedRangesOf as I,stripSelectedRanges as f}from"./selected-ranges.js";import{withShopperFirstPaint as N,withoutShopperFirstPaint as A,withoutShopperFirstPaintNode as P}from"./shopper-first-paint.js";const p="AlloyWheelsListing",x="catalog",U="CatalogFilterBar",i="fieldUsage",R="requestQuery";function l(r){return r.props?.source}function o(r){return r?.type===L&&T(l(r))}function a(r){return r?.type===U||r?.type===y}function g(r){return r?.type===p||o(r)||a(r)}const u=r=>W(r);function d(r){return r?u(r).some(t=>t?.type===p||o(t)):!1}function K(r){return r?d(r)||u(r).some(t=>P(t)!==t)||f(r)!==r:!1}function Q(r){return r?u(r).some(g):!1}function q(r,t){return t.length===0?r:c(r,g,e=>({...e,props:{...e.props??{},[i]:t}}))}function v(r){if(!r)return[];const t=new Set;for(const e of u(r)){if(e?.type!==p&&!o(e))continue;const s=e.props?.kinds;for(const n of o(e)?E(l(e),s):O(s))t.add(n)}return[...t]}function V(r){return r.length===1&&r[0]==="alloy-wheel"}function b(r,t){const e=I(r.root?.props);return N(C(r,s=>o(s)?{...s,props:{...h(s).props,[x]:S(l(s),s.props?.kinds,t)}}:{...s,props:{..._(s).props,products:t}}),e)}function j(r,t){const e=t.replace(/^\?/,"");return e?c(r,s=>s?.type===p,s=>({...s,props:{...s.props??{},[R]:e}})):r}function z(r){return A(c(f(r),g,t=>a(t)?w(t):o(t)?h(t):_(t)))}function w(r){if(!r.props||!(i in r.props))return r;const{[i]:t,...e}=r.props;return{...r,props:e}}function h(r){const{[x]:t,[i]:e,...s}=r.props??{},n=s.source;if(n&&"wheels"in n){const{wheels:m,...F}=n;s.source=F}return{...r,props:s}}function J(r){const t=f({content:[r]}).content[0],e=P(t);return o(e)?h(e):a(e)?w(e):e?.type===p?_(e):e}function _(r){const{wheels:t,products:e,[i]:s,[R]:n,...m}=r.props??{};return{...r,props:m}}function C(r,t){return c(r,e=>e?.type===p||o(e),t)}function c(r,t,e){return G(r,s=>t(s)?e(s):s)}export{p as ALLOY_WHEELS_LISTING_TYPE,U as CATALOG_FILTER_BAR_TYPE,i as FIELD_USAGE_PROP,y as FILTER_BLOCK_TYPE,x as GRID_CATALOG_PROP,R as LISTING_QUERY_PROP,L as PRODUCT_GRID_TYPE,z as dehydrateWheelsListing,J as dehydrateWheelsListingNode,q as hydrateFieldUsage,b as hydrateWheelsListing,v as listingCatalogKinds,V as listingWantsWheelsOnly,K as pageHasHydratedValues,d as pageHasWheelsListing,Q as pageReadsFieldUsage,j as stampListingQuery};
@@ -0,0 +1,16 @@
1
+ import type { Data } from "efficient-easel/blocks";
2
+ import type { SelectedRanges } from "efficient-web-builder/render/lib/content/box-show-for";
3
+ import { type PlpSortKey } from "./plp-filters.js";
4
+ export declare const SELECTED_RANGES_PROP = "selectedRanges";
5
+ export declare const SHOPPER_ADDRESS_PROP = "shopperAddress";
6
+ export interface ShopperAddressMark {
7
+ writes: boolean;
8
+ sort: PlpSortKey;
9
+ }
10
+ export type AddressQuery = string | URLSearchParams | Readonly<Record<string, string | readonly string[] | undefined>>;
11
+ export declare function readSelectedRanges(query: AddressQuery, knownNames: readonly string[]): readonly string[];
12
+ export declare function selectedRangesOf(rootProps: Readonly<Record<string, unknown>> | null | undefined): SelectedRanges | null;
13
+ export declare function shopperAddressMarkOf(props: Readonly<Record<string, unknown>> | null | undefined): ShopperAddressMark | null;
14
+ export declare function stampSelectedRanges(data: Data, query: AddressQuery, knownNames: readonly string[]): Data;
15
+ export declare function stripSelectedRanges(data: Data): Data;
16
+ export declare function pageReadsSelectedRanges(data: Data | null | undefined): boolean;
@@ -0,0 +1 @@
1
+ import{SHOW_FOR_PROP as R,showForOf as g}from"efficient-web-builder/format/lib/content/box-show-for-choices";import{asPlpSortKey as l,plpFiltersFromParams as w}from"./plp-filters.js";import{FILTER_BLOCK_TYPE as P,documentNodes as O,mapDocumentNodes as d}from"../document/document-nodes.js";import{documentShopperScopes as h,pageReachFilterOf as y}from"./shopper-first-paint.js";const u="selectedRanges",i="shopperAddress";function k(r){if(typeof r=="string")return new URLSearchParams(r.replace(/^\?/,""));if(r instanceof URLSearchParams)return r;const e=new URLSearchParams;for(const[o,t]of Object.entries(r))if(typeof t=="string")e.append(o,t);else if(Array.isArray(t))for(const s of t)typeof s=="string"&&e.append(o,s);return e}function A(r,e){const o=new Set(e),t=[];for(const s of w(k(r)).collections)o.has(s)&&!t.includes(s)&&t.push(s);return t}function L(r){const e=r?.[u];if(!e||!Array.isArray(e.selected)||!Array.isArray(e.known))return null;const o=s=>s.filter(n=>typeof n=="string"),t=o(e.known);return{selected:o(e.selected).filter(s=>t.includes(s)),known:t}}function D(r){const e=r?.[i];return!e||typeof e!="object"?null:{writes:e.writes===!0,sort:l(typeof e.sort=="string"?e.sort:void 0)}}function b(r,e,o){const t=[...new Set(o)],s={selected:A(e,t),known:t},n=y(r),p=new Map;if(n){const c=l(typeof n.props?.openingSort=="string"?n.props.openingSort:void 0);p.set(n,{[i]:{writes:!0,sort:c}});for(const[a,S]of h(r))S===n&&p.set(a,{[i]:{writes:!1,sort:c}})}const f=p.size?d(r,(c,a)=>p.has(a)?{...c,props:{...c.props,...p.get(a)}}:c):r,m=f.root??{};return{...f,root:{...m,props:{...m.props??{},[u]:s}}}}function N(r){const e=d(r,n=>{if(!(i in n.props))return n;const{[i]:p,...f}=n.props;return{...n,props:f}}),o=e.root;if(!o?.props||!(u in o.props))return e;const{[u]:t,...s}=o.props;return{...e,root:{...o,props:s}}}function T(r){return r?O(r).some(e=>e.type===P||g(e.props[R])!==void 0):!1}export{u as SELECTED_RANGES_PROP,i as SHOPPER_ADDRESS_PROP,T as pageReadsSelectedRanges,A as readSelectedRanges,L as selectedRangesOf,D as shopperAddressMarkOf,b as stampSelectedRanges,N as stripSelectedRanges};
@@ -32,3 +32,13 @@ export declare function setSecondSrc(finish: {
32
32
  } | null | undefined, painted: string | null): string | null;
33
33
  export declare const PER_WHEEL_UNIT = "per wheel";
34
34
  export declare function wheelCardPriceLine(label: string, priced: boolean): string;
35
+ export declare const SET_PICTURE_POINTS: readonly [{
36
+ readonly label: "Pair";
37
+ readonly value: "pair";
38
+ }, {
39
+ readonly label: "One wheel";
40
+ readonly value: "one";
41
+ }];
42
+ export type SetPicture = (typeof SET_PICTURE_POINTS)[number]["value"];
43
+ export declare const SET_PICTURE_DEFAULT: SetPicture;
44
+ export declare function parseSetPicture(raw: unknown): SetPicture;
@@ -1 +1 @@
1
- import{WHEELS_PER_SET as r}from"../commerce.js";function u(e){return(e.components??[]).reduce((o,s)=>o+s.wheels,0)>r}function R(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(u)}const a=150,c="Front + rear",w="L/R pair",_="Not handed",l="L/R";function i(e){return e.et==null||e.rearEt==null?0:Math.abs(e.rearEt-e.et)}function n(e){return i(e)>=a}function D(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(n)}function d(e){return e.directional===!0}function p(e){return e.kind==="staggered"}function m(e){return e.rearWidth!=null||e.rearEt!=null&&e.rearEt!==e.et}function O(e){return{twoObjects:n(e),handed:d(e),staggered:p(e)}}function g(e){return{twoObjects:f(e),handed:e.handed??!1,staggered:!1}}function W(e){const t=[e.twoObjects?c:"",e.handed?l:""].filter(Boolean);return t.length?t.join(" · "):null}function H(e){return e.handed}function x(e){return new Set((e.components??[]).map(t=>t.partNumber)).size>1}function I(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(x)}function f(e){return(e.setWheelCount??0)>r}const E=new Set(["boltPattern"]);function T(e,t){return e&&E.has(t)}function b(e,t){return!e?.srcRight||!t||t!==e.src?null:e.srcRight}const S="per wheel";function y(e,t){return t?`${e} ${S}`:e}export{c as AXLE_WORDS,l as CARD_HAND_WORDS,w as HAND_WORDS,_ as NOT_HANDED_WORDS,S as PER_WHEEL_UNIT,a as TWO_OBJECT_ET_SPREAD_MM,I as productHasComposedRender,R as productIsDually,D as productIsTwoObjects,W as setBuildLabel,H as setIsWide,b as setSecondSrc,T as setSuppressesRow,f as summaryIsDually,g as summarySetBuild,i as variantEtSpread,x as variantHasComposedRender,m as variantHasDistinctRear,u as variantIsDually,d as variantIsHanded,p as variantIsStaggered,n as variantIsTwoObjects,O as variantSetBuild,y as wheelCardPriceLine};
1
+ import{WHEELS_PER_SET as r}from"../commerce.js";function u(e){return(e.components??[]).reduce((o,s)=>o+s.wheels,0)>r}function R(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(u)}const a=150,c="Front + rear",w="L/R pair",D="Not handed",l="L/R";function i(e){return e.et==null||e.rearEt==null?0:Math.abs(e.rearEt-e.et)}function n(e){return i(e)>=a}function O(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(n)}function p(e){return e.directional===!0}function d(e){return e.kind==="staggered"}function T(e){return e.rearWidth!=null||e.rearEt!=null&&e.rearEt!==e.et}function m(e){return{twoObjects:n(e),handed:p(e),staggered:d(e)}}function I(e){return{twoObjects:E(e),handed:e.handed??!1,staggered:!1}}function P(e){const t=[e.twoObjects?c:"",e.handed?l:""].filter(Boolean);return t.length?t.join(" · "):null}function g(e){return e.handed}function x(e){return new Set((e.components??[]).map(t=>t.partNumber)).size>1}function W(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(x)}function E(e){return(e.setWheelCount??0)>r}const S=new Set(["boltPattern"]);function b(e,t){return e&&S.has(t)}function H(e,t){return!e?.srcRight||!t||t!==e.src?null:e.srcRight}const f="per wheel";function C(e,t){return t?`${e} ${f}`:e}const L=[{label:"Pair",value:"pair"},{label:"One wheel",value:"one"}],_="pair";function N(e){return e==="one"?"one":_}export{c as AXLE_WORDS,l as CARD_HAND_WORDS,w as HAND_WORDS,D as NOT_HANDED_WORDS,f as PER_WHEEL_UNIT,_ as SET_PICTURE_DEFAULT,L as SET_PICTURE_POINTS,a as TWO_OBJECT_ET_SPREAD_MM,N as parseSetPicture,W as productHasComposedRender,R as productIsDually,O as productIsTwoObjects,P as setBuildLabel,g as setIsWide,H as setSecondSrc,b as setSuppressesRow,E as summaryIsDually,I as summarySetBuild,i as variantEtSpread,x as variantHasComposedRender,T as variantHasDistinctRear,u as variantIsDually,p as variantIsHanded,d as variantIsStaggered,n as variantIsTwoObjects,m as variantSetBuild,C as wheelCardPriceLine};
@@ -0,0 +1,28 @@
1
+ import type { Data } from "efficient-easel/blocks";
2
+ import { type DocNode } from "../document/document-nodes.js";
3
+ import type { ProductKind } from "../api/index.js";
4
+ import type { SelectedRanges } from "efficient-web-builder/render/lib/content/box-show-for";
5
+ import { type PlpSortKey } from "./plp-filters.js";
6
+ type ContentNode = DocNode;
7
+ export declare const FIRST_ROWS_PROP = "firstRows";
8
+ export declare const FIRST_SHOWN_PROP = "firstShown";
9
+ export declare const FIRST_COUNT_IN_CHIPS_PROP = "firstCountInChips";
10
+ export interface FirstShown {
11
+ total: number;
12
+ range: {
13
+ from: number;
14
+ to: number;
15
+ } | null;
16
+ kinds: ProductKind[];
17
+ sort: PlpSortKey;
18
+ }
19
+ export declare const SHOPPER_BLOCK_TYPES: ReadonlySet<string>;
20
+ export declare function pageReachFilterOf(data: Data): ContentNode | null;
21
+ export declare function documentShopperScopes(data: Data): Map<ContentNode, ContentNode | null>;
22
+ export declare function withShopperFirstPaint(data: Data, stamp?: SelectedRanges | null): Data;
23
+ export declare function withoutShopperFirstPaintNode<T extends {
24
+ type?: string;
25
+ props?: Record<string, unknown>;
26
+ }>(node: T): T;
27
+ export declare function withoutShopperFirstPaint(data: Data): Data;
28
+ export {};
@@ -0,0 +1 @@
1
+ import{FILTER_BLOCK_TYPE as C,FILTER_CHIPS_TYPE as F,PRODUCT_GRID_TYPE as E,documentNodes as L,mapDocumentNodes as R,placedDocumentNodes as N}from"../document/document-nodes.js";import{itemKind as M}from"../catalog/plp-item.js";import{gridPagingOf as b,gridShownOf as D}from"../sections/product-grid-pages.js";import{parseOpeningSort as H}from"../sections/shopper-filters.js";import{EMPTY_PLP_FILTERS as Y,itemMatchesPlp as B}from"./plp-filters.js";const h="firstRows",m="firstShown",P="firstCountInChips",u=C,S=F,w=E,A=new Set([u,S,w]);function K(t){return L(t).find(o=>o.type===u&&o.props.filtersBelow===!0)??null}const I=t=>N(t);function G(t){return t.lists.length<2?null:t.lists.find(o=>o.length>1)??null}const U=(t,o)=>o.lists.includes(t);function T(t){const o=t.filter(e=>e.node.type===u),p=new Map(o.map(e=>[e,G(e)])),l=new Map;for(const e of t){if(e.node.type!==S&&e.node.type!==w)continue;let s=null;for(const r of o){const c=p.get(r);if(!c||!U(c,e))continue;const f=e.lists.length-e.lists.indexOf(c);(!s||f>s.depth)&&(s={f:r,depth:f})}if(s){l.set(e.node,s.f.node);continue}const i=o.filter(r=>r.node.props.filtersBelow===!0&&r.order<e.order).at(-1);l.set(e.node,i?.node??null)}return l}function _(t){const o=t.props.catalog;return Array.isArray(o)?o:null}function X(t){return T(I(t))}function W(t,o){if(!t||t.selected.length===0)return null;const p=K(o);return p?{filter:p,state:{...Y,collections:[...t.selected]}}:null}function k(t,o){return t.filter(p=>B(p,o,void 0,"price","pass"))}function Z(t,o=null){const p=I(t);if(!p.some(i=>i.node.type===u))return t;const l=T(p),e=W(o,t),s=new Map;for(const i of p.filter(r=>r.node.type===u).map(r=>r.node)){const r=[...l].filter(([,n])=>n===i).map(([n])=>n),c=r.filter(n=>n.type===w&&_(n)),f=r.filter(n=>n.type===S),g=c.flatMap(n=>_(n));s.set(i,{[h]:g});const O=e?.filter===i?e.state:null,d=c.map(n=>{const a=_(n);return D(O?k(a,O).length:a.length,b(n.props))}),x={total:d.reduce((n,a)=>n+a.total,0),range:d.length===1?d[0].range:null,kinds:[...new Set(g.map(M))],sort:H(i.props.openingSort)};for(const n of f)s.set(n,{[m]:x});const y=f.some(n=>n.props.showCount!==!1);for(const n of c)s.set(n,{[P]:y})}return R(t,(i,r)=>s.has(r)?{...i,props:{...i.props,...s.get(r)}}:i)}function v(t){if(!t?.type||!A.has(t.type)||!t.props)return t;const o=t.props;if(!(h in o)&&!(m in o)&&!(P in o))return t;const{[h]:p,[m]:l,[P]:e,...s}=o;return{...t,props:s}}function $(t){return R(t,o=>v(o))}export{P as FIRST_COUNT_IN_CHIPS_PROP,h as FIRST_ROWS_PROP,m as FIRST_SHOWN_PROP,A as SHOPPER_BLOCK_TYPES,X as documentShopperScopes,K as pageReachFilterOf,Z as withShopperFirstPaint,$ as withoutShopperFirstPaint,v as withoutShopperFirstPaintNode};
@@ -0,0 +1,11 @@
1
+ export type ShopperRole = "filter" | "chips" | "grid" | "gallery";
2
+ export interface ScopeMember {
3
+ key: string;
4
+ role: ShopperRole;
5
+ boxId: string | null;
6
+ node: Element | null;
7
+ filtersBelow?: boolean;
8
+ }
9
+ export declare function boxContentOf(filter: Element): Element | null;
10
+ export declare function resolveShopperScopes(members: readonly ScopeMember[]): Map<string, string | null>;
11
+ export declare function resolveGalleryFollows(members: readonly ScopeMember[]): Map<string, string | null>;
@@ -0,0 +1 @@
1
+ function a(r){let n=r;for(;n?.parentElement;){const o=n.parentElement;if(p(o)>1)return o;n=o}return null}function p(r){let n=0;for(const o of Array.from(r.children))y.has(o.tagName)||(n+=1);return n}const y=new Set(["STYLE","SCRIPT","TEMPLATE","LINK"]);function k(r){let n=0;for(let o=r;o;o=o.parentNode)n+=1;return n}function d(r,n){return(r.compareDocumentPosition(n)&4)!==0&&!r.contains(n)}function h(r){const n=r.filter(e=>e.role==="filter"&&e.node),o=new Map;for(const e of n)o.set(e.key,e.boxId===null?null:a(e.node));const t=new Map;for(const e of r){if(e.role==="filter"){t.set(e.key,e.key);continue}if(!e.node||e.role==="gallery"){t.set(e.key,null);continue}let c=null;for(const f of n){const u=o.get(f.key);if(!u||!u.contains(e.node))continue;const l=k(u);(!c||l>c.depth)&&(c={key:f.key,depth:l})}if(c){t.set(e.key,c.key);continue}let i=null;for(const f of n)!f.filtersBelow||!d(f.node,e.node)||(!i||d(i.node,f.node))&&(i=f);t.set(e.key,i?.key??null)}return t}function w(r){const n=r.filter(t=>t.role==="gallery"&&t.node),o=new Map;for(const t of r){if(t.role!=="chips")continue;const e=t.node&&t.boxId!==null?a(t.node):null;if(!e){o.set(t.key,null);continue}const c=n.filter(l=>e.contains(l.node)),i=c.filter(l=>d(t.node,l.node)),f=i.reduce((l,s)=>!l||d(s.node,l.node)?s:l,null),u=c.filter(l=>!i.includes(l)).reduce((l,s)=>!l||d(l.node,s.node)?s:l,null);o.set(t.key,(f??u)?.key??null)}return o}export{a as boxContentOf,w as resolveGalleryFollows,h as resolveShopperScopes};