1import { l as e, n as t, o as n } from "./commerce.indexBu0Q3kxk.js"; 2import { a as r, i, n as a, o, r as s, u as c } from "./decoratorsDgvFPsqQ.js"; 3import { t as l } from "./field-utilsg9G_5Y8p.js"; 4import { t as u } from "./binding-guardBYpyFCsg.js"; 5import { t as d } from "./bindingsC1qzP6-H.js"; 6import { t as f } from "./with-tailwind-stylesCLrXF-GP.js"; 7import { t as p } from "./error-guardDZkUaSL0.js"; 8import { p as m } from "./utilsCdZ5ESYt.js"; 9import { t as h } from "./product-context-controllerCvsuIJke.js"; 10//#region node_modules/@coveo/atomic/dist/atomic/components/components/commerce/atomic-product-multi-value-text/atomic-product-multi-value-text.js 11var g = function(e, t, n, r) { 12 var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o; 13 if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r); 14 else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a); 15 return i > 3 && a && Object.defineProperty(t, n, a), a; 16}, _ = class extends r { 17 constructor() { 18 super(...arguments), this.productController = h(this), this.maxValuesToDisplay = 3, this.delimiter = null, this.values = []; 19 } 20 initialize() { 21 this.breadcrumbManager = (this.bindings.interfaceElement.type === "product-listing" ? e(this.bindings.engine) : n(this.bindings.engine)).breadcrumbManager(), this.values = this.initializeValues(); 22 } 23 initializeValues() { 24 let e = this.productController.item; 25 if (!e) return []; 26 let n = t.getProductProperty(e, this.field); 27 return n === null ? [] : Array.isArray(n) ? n.map((e) => `${e}`.trim()) : typeof n != "string" || n.trim() === "" ? (this.error = /* @__PURE__ */ Error(`Could not parse "${n}" from field "${this.field}" as a string array.`), []) : this.delimiter ? n.split(this.delimiter).map((e) => e.trim()) : [n]; 28 } 29 get facetSelectedValues() { 30 return this.breadcrumbManager.state.facetBreadcrumbs.reduce((e, t) => t.field === this.field ? e.concat(t.values.map(({ value: e }) => e.value)) : e, []); 31 } 32 get sortedValues() { 33 let e = this.facetSelectedValues.filter((e) => this.values.includes(e)); 34 return Array.from(new Set([...e, ...this.values])); 35 } 36 get shouldDisplayLabel() { 37 return this.maxValuesToDisplay > 0 && this.sortedValues.length > this.maxValuesToDisplay; 38 } 39 get numberOfValuesToDisplay() { 40 return Math.min(this.sortedValues.length, this.maxValuesToDisplay); 41 } 42 renderValue(e) { 43 let t = l(this.field, e, this.bindings.i18n); 44 return c` 45 <li part="product-multi-value-text-value" class="inline-block"> 46 <slot name=${`product-multi-value-text-value-${m(e)}`}> 47 ${t} 48 </slot> 49 </li> 50 `; 51 } 52 renderSeparator() { 53 return c` 54 <li 55 aria-hidden="true" 56 part="product-multi-value-text-separator" 57 class="${String.raw`inline-block before:inline before:content-[',\00a0']`}" 58 ></li> 59 `; 60 } 61 renderMoreLabel(e) { 62 return c` 63 <li part="product-multi-value-text-value-more" class="inline-block"> 64 ${this.bindings.i18n.t("n-more", { value: e })} 65 </li> 66 `; 67 } 68 renderListItems(e) { 69 let t = []; 70 t.push(this.renderValue(e[0])); 71 for (let n = 1; n < this.numberOfValuesToDisplay; n++) t.push(this.renderSeparator()), t.push(this.renderValue(e[n])); 72 return this.shouldDisplayLabel && (t.push(this.renderSeparator()), t.push(this.renderMoreLabel(e.length - this.numberOfValuesToDisplay))), t; 73 } 74 render() { 75 return this.sortedValues.length === 0 ? c`${o}` : c` 76 <ul part="product-multi-value-text-list" class="m-0 flex list-none p-0 set-font-size-sm"> 77 ${this.renderListItems(this.sortedValues)} 78 </ul> 79 `; 80 } 81}; 82g([a()], _.prototype, "bindings", void 0), g([a()], _.prototype, "error", void 0), g([s({ reflect: !0 })], _.prototype, "field", void 0), g([s({ 83 reflect: !0, 84 type: Number, 85 attribute: "max-values-to-display" 86})], _.prototype, "maxValuesToDisplay", void 0), g([s({ reflect: !0 })], _.prototype, "delimiter", void 0), g([a()], _.prototype, "values", void 0), g([u(), p()], _.prototype, "render", null), _ = g([ 87 i("atomic-product-multi-value-text"), 88 d(), 89 f 90], _); 91//#endregion 92export { _ as AtomicProductMultiValueText };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.