PageSourceSearch

https://www.cfainstitute.org/modules/custom/ep_search_api_coveo/js/dist/atomic-product-childrenBgWWiJh0.js

js cfainstitute.org collected 2026-09-24 07:46:03 UTC 4,261 bytes, 96 lines download raw bytes

1import { n as e } from "./commerce.indexBu0Q3kxk.js";
2import { a as t, i as n, n as r, o as i, r as a, u as o } from "./decoratorsDgvFPsqQ.js";
3import { t as s } from "./buttonCbp3zP8q.js";
4import { n as c, t as l } from "./multi-class-maptdI2P4U-.js";
5import { t as u } from "./binding-guardBYpyFCsg.js";
6import { t as d } from "./bindingsC1qzP6-H.js";
7import { t as f } from "./error-guardDZkUaSL0.js";
8import { t as p } from "./dom-utilsBfvQOI-i.js";
9import { t as m } from "./light-domBii3S8u8.js";
10import "./atomic-commerce-textCFWct40j.js";
11import { t as h } from "./product-context-controllerCvsuIJke.js";
12import { t as g } from "./xss-utilsDB5kKKlX.js";
13//#region node_modules/@coveo/atomic/dist/atomic/components/components/commerce/atomic-product-children/atomic-product-children.js
14var _ = function(e, t, n, r) {
15	var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
16	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
17	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);
18	return i > 3 && a && Object.defineProperty(t, n, a), a;
19}, v = 5, y = class extends m(t) {
20	constructor() {
21		super(...arguments), this.productController = h(this), this.childProducts = [], this.activeChildId = "", this.label = "available-in", this.field = "ec_thumbnails", this.fallback = "data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" width=\"50\" height=\"50\" viewBox=\"0 0 50 50\"%3E%3Crect width=\"50\" height=\"50\" fill=\"none\" stroke=\"gray\"%3E%3C/rect%3E%3C/svg%3E", this.handleClick = (e) => {
22			this.parentElement?.tagName === "A" ? e.stopPropagation() : p(this, "atomic-product").clickLinkContainer();
23		};
24	}
25	initialize() {
26		let e = this.productController.item;
27		e && (this.activeChildId = e.permanentid, this.childProducts = e.children ?? []);
28	}
29	onSelectChild(e) {
30		this.activeChildId = e.permanentid, this.dispatchEvent(new CustomEvent("atomic/selectChildProduct", {
31			detail: { child: e },
32			bubbles: !0,
33			composed: !0
34		}));
35	}
36	getImageUrl(t) {
37		let n = e.getProductProperty(t, this.field);
38		return typeof n == "string" ? g(n) : Array.isArray(n) && typeof n[0] == "string" ? g(n[0]) : g(this.fallback);
39	}
40	renderChild(e) {
41		let t = e.ec_name ?? "";
42		return o`
43      <button
44        class="${l(c({
45			"product-child": !0,
46			"box-border rounded border border-primary": e.permanentid === this.activeChildId
47		}))}"
48        title=${t}
49        @keypress=${(t) => t.key === "Enter" && this.onSelectChild(e)}
50        @mouseenter=${() => this.onSelectChild(e)}
51        @touchstart=${(t) => {
52			t.stopPropagation(), t.preventDefault(), this.onSelectChild(e);
53		}}
54        @click=${this.handleClick}
55      >
56        <img
57          class="aspect-square p-1"
58          src=${this.getImageUrl(e)}
59          alt=${t}
60          loading="lazy"
61        />
62      </button>
63    `;
64	}
65	renderLabel() {
66		return o`
67      <div class="text-neutral-dark my-2 font-semibold">
68        <atomic-commerce-text
69          .value=${this.bindings.i18n.t(this.label)}
70        ></atomic-commerce-text>
71      </div>
72    `;
73	}
74	get count() {
75		let e = Math.max(0, this.childProducts.length - v);
76		return this.productController.item?.totalNumberOfChildren - this.productController.item?.children.length + e;
77	}
78	render() {
79		if (this.childProducts.length === 0) return o`${i}`;
80		let e = this.childProducts.slice(0, v);
81		return o`
82      ${this.label.trim() === "" ? i : this.renderLabel()}
83      <div class="flex flex-wrap">
84        ${e.map((e) => this.renderChild(e))}
85        ${this.count > 0 ? s({ props: {
86			style: "text-primary",
87			class: "product-child",
88			onClick: this.handleClick
89		} })(o`+${this.count}`) : i}
90      </div>
91    `;
92	}
93};
94_([r()], y.prototype, "bindings", void 0), _([r()], y.prototype, "childProducts", void 0), _([r()], y.prototype, "activeChildId", void 0), _([a()], y.prototype, "label", void 0), _([a({ reflect: !0 })], y.prototype, "field", void 0), _([a({ reflect: !0 })], y.prototype, "fallback", void 0), _([u(), f()], y.prototype, "render", null), y = _([n("atomic-product-children"), d()], y);
95//#endregion
96export { y as AtomicProductChildren };

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.