UNPKG

@claudebernard/prescription-alerts-element

Version:

An element providing some custom stuff.

1,095 lines 222 kB
var _a; import "@claudebernard/design-system"; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t$2 = globalThis, e$2 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = Symbol(), o$4 = /* @__PURE__ */ new WeakMap(); let n$3 = class n { constructor(t2, e2, o2) { if (this._$cssResult$ = true, o2 !== s$2) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); this.cssText = t2, this.t = e2; } get styleSheet() { let t2 = this.o; const s2 = this.t; if (e$2 && void 0 === t2) { const e2 = void 0 !== s2 && 1 === s2.length; e2 && (t2 = o$4.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$4.set(s2, t2)); } return t2; } toString() { return this.cssText; } }; const r$4 = (t2) => new n$3("string" == typeof t2 ? t2 : t2 + "", void 0, s$2), S$1 = (s2, o2) => { if (e$2) s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet); else for (const e2 of o2) { const o3 = document.createElement("style"), n3 = t$2.litNonce; void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3); } }, c$2 = e$2 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => { let e2 = ""; for (const s2 of t3.cssRules) e2 += s2.cssText; return r$4(e2); })(t2) : t2; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPropertyNames: r$3, getOwnPropertySymbols: o$3, getPrototypeOf: n$2 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (t2, s2) => t2, u$1 = { toAttribute(t2, s2) { switch (s2) { case Boolean: t2 = t2 ? l$1 : null; break; case Object: case Array: t2 = null == t2 ? t2 : JSON.stringify(t2); } return t2; }, fromAttribute(t2, s2) { let i2 = t2; switch (s2) { case Boolean: i2 = null !== t2; break; case Number: i2 = null === t2 ? null : Number(t2); break; case Object: case Array: try { i2 = JSON.parse(t2); } catch (t3) { i2 = null; } } return i2; } }, f$1 = (t2, s2) => !i$2(t2, s2), b = { attribute: true, type: String, converter: u$1, reflect: false, useDefault: false, hasChanged: f$1 }; Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a$1.litPropertyMetadata ?? (a$1.litPropertyMetadata = /* @__PURE__ */ new WeakMap()); let y$1 = class y extends HTMLElement { static addInitializer(t2) { this._$Ei(), (this.l ?? (this.l = [])).push(t2); } static get observedAttributes() { return this.finalize(), this._$Eh && [...this._$Eh.keys()]; } static createProperty(t2, s2 = b) { if (s2.state && (s2.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t2) && ((s2 = Object.create(s2)).wrapped = true), this.elementProperties.set(t2, s2), !s2.noAccessor) { const i2 = Symbol(), h2 = this.getPropertyDescriptor(t2, i2, s2); void 0 !== h2 && e$1(this.prototype, t2, h2); } } static getPropertyDescriptor(t2, s2, i2) { const { get: e2, set: r2 } = h$1(this.prototype, t2) ?? { get() { return this[s2]; }, set(t3) { this[s2] = t3; } }; return { get: e2, set(s3) { const h2 = e2 == null ? void 0 : e2.call(this); r2 == null ? void 0 : r2.call(this, s3), this.requestUpdate(t2, h2, i2); }, configurable: true, enumerable: true }; } static getPropertyOptions(t2) { return this.elementProperties.get(t2) ?? b; } static _$Ei() { if (this.hasOwnProperty(d$1("elementProperties"))) return; const t2 = n$2(this); t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties); } static finalize() { if (this.hasOwnProperty(d$1("finalized"))) return; if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) { const t3 = this.properties, s2 = [...r$3(t3), ...o$3(t3)]; for (const i2 of s2) this.createProperty(i2, t3[i2]); } const t2 = this[Symbol.metadata]; if (null !== t2) { const s2 = litPropertyMetadata.get(t2); if (void 0 !== s2) for (const [t3, i2] of s2) this.elementProperties.set(t3, i2); } this._$Eh = /* @__PURE__ */ new Map(); for (const [t3, s2] of this.elementProperties) { const i2 = this._$Eu(t3, s2); void 0 !== i2 && this._$Eh.set(i2, t3); } this.elementStyles = this.finalizeStyles(this.styles); } static finalizeStyles(s2) { const i2 = []; if (Array.isArray(s2)) { const e2 = new Set(s2.flat(1 / 0).reverse()); for (const s3 of e2) i2.unshift(c$2(s3)); } else void 0 !== s2 && i2.push(c$2(s2)); return i2; } static _$Eu(t2, s2) { const i2 = s2.attribute; return false === i2 ? void 0 : "string" == typeof i2 ? i2 : "string" == typeof t2 ? t2.toLowerCase() : void 0; } constructor() { super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev(); } _$Ev() { var _a2; this._$ES = new Promise((t2) => this.enableUpdating = t2), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (_a2 = this.constructor.l) == null ? void 0 : _a2.forEach((t2) => t2(this)); } addController(t2) { var _a2; (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t2), void 0 !== this.renderRoot && this.isConnected && ((_a2 = t2.hostConnected) == null ? void 0 : _a2.call(t2)); } removeController(t2) { var _a2; (_a2 = this._$EO) == null ? void 0 : _a2.delete(t2); } _$E_() { const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties; for (const i2 of s2.keys()) this.hasOwnProperty(i2) && (t2.set(i2, this[i2]), delete this[i2]); t2.size > 0 && (this._$Ep = t2); } createRenderRoot() { const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); return S$1(t2, this.constructor.elementStyles), t2; } connectedCallback() { var _a2; this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), (_a2 = this._$EO) == null ? void 0 : _a2.forEach((t2) => { var _a3; return (_a3 = t2.hostConnected) == null ? void 0 : _a3.call(t2); }); } enableUpdating(t2) { } disconnectedCallback() { var _a2; (_a2 = this._$EO) == null ? void 0 : _a2.forEach((t2) => { var _a3; return (_a3 = t2.hostDisconnected) == null ? void 0 : _a3.call(t2); }); } attributeChangedCallback(t2, s2, i2) { this._$AK(t2, i2); } _$ET(t2, s2) { var _a2; const i2 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i2); if (void 0 !== e2 && true === i2.reflect) { const h2 = (void 0 !== ((_a2 = i2.converter) == null ? void 0 : _a2.toAttribute) ? i2.converter : u$1).toAttribute(s2, i2.type); this._$Em = t2, null == h2 ? this.removeAttribute(e2) : this.setAttribute(e2, h2), this._$Em = null; } } _$AK(t2, s2) { var _a2, _b; const i2 = this.constructor, e2 = i2._$Eh.get(t2); if (void 0 !== e2 && this._$Em !== e2) { const t3 = i2.getPropertyOptions(e2), h2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== ((_a2 = t3.converter) == null ? void 0 : _a2.fromAttribute) ? t3.converter : u$1; this._$Em = e2, this[e2] = h2.fromAttribute(s2, t3.type) ?? ((_b = this._$Ej) == null ? void 0 : _b.get(e2)) ?? null, this._$Em = null; } } requestUpdate(t2, s2, i2) { var _a2; if (void 0 !== t2) { const e2 = this.constructor, h2 = this[t2]; if (i2 ?? (i2 = e2.getPropertyOptions(t2)), !((i2.hasChanged ?? f$1)(h2, s2) || i2.useDefault && i2.reflect && h2 === ((_a2 = this._$Ej) == null ? void 0 : _a2.get(t2)) && !this.hasAttribute(e2._$Eu(t2, i2)))) return; this.C(t2, s2, i2); } false === this.isUpdatePending && (this._$ES = this._$EP()); } C(t2, s2, { useDefault: i2, reflect: e2, wrapped: h2 }, r2) { i2 && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t2) && (this._$Ej.set(t2, r2 ?? s2 ?? this[t2]), true !== h2 || void 0 !== r2) || (this._$AL.has(t2) || (this.hasUpdated || i2 || (s2 = void 0), this._$AL.set(t2, s2)), true === e2 && this._$Em !== t2 && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t2)); } async _$EP() { this.isUpdatePending = true; try { await this._$ES; } catch (t3) { Promise.reject(t3); } const t2 = this.scheduleUpdate(); return null != t2 && await t2, !this.isUpdatePending; } scheduleUpdate() { return this.performUpdate(); } performUpdate() { var _a2; if (!this.isUpdatePending) return; if (!this.hasUpdated) { if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) { for (const [t4, s3] of this._$Ep) this[t4] = s3; this._$Ep = void 0; } const t3 = this.constructor.elementProperties; if (t3.size > 0) for (const [s3, i2] of t3) { const { wrapped: t4 } = i2, e2 = this[s3]; true !== t4 || this._$AL.has(s3) || void 0 === e2 || this.C(s3, void 0, i2, e2); } } let t2 = false; const s2 = this._$AL; try { t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), (_a2 = this._$EO) == null ? void 0 : _a2.forEach((t3) => { var _a3; return (_a3 = t3.hostUpdate) == null ? void 0 : _a3.call(t3); }), this.update(s2)) : this._$EM(); } catch (s3) { throw t2 = false, this._$EM(), s3; } t2 && this._$AE(s2); } willUpdate(t2) { } _$AE(t2) { var _a2; (_a2 = this._$EO) == null ? void 0 : _a2.forEach((t3) => { var _a3; return (_a3 = t3.hostUpdated) == null ? void 0 : _a3.call(t3); }), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2); } _$EM() { this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false; } get updateComplete() { return this.getUpdateComplete(); } getUpdateComplete() { return this._$ES; } shouldUpdate(t2) { return true; } update(t2) { this._$Eq && (this._$Eq = this._$Eq.forEach((t3) => this._$ET(t3, this[t3]))), this._$EM(); } updated(t2) { } firstUpdated(t2) { } }; y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("elementProperties")] = /* @__PURE__ */ new Map(), y$1[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1 == null ? void 0 : p$1({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ?? (a$1.reactiveElementVersions = [])).push("2.1.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t$1 = globalThis, i$1 = t$1.trustedTypes, s$1 = i$1 ? i$1.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$2 = "?" + h, n$1 = `<${o$2}>`, r$2 = document, l = () => r$2.createComment(""), c = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof (t2 == null ? void 0 : t2[Symbol.iterator]), d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y2 = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, values: s2 }), x = y2(1), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r$2.createTreeWalker(r$2, 129); function P(t2, i2) { if (!a(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array"); return void 0 !== s$1 ? s$1.createHTML(i2) : i2; } const V = (t2, i2) => { const s2 = t2.length - 1, o2 = []; let r2, l2 = 2 === i2 ? "<svg>" : 3 === i2 ? "<math>" : "", c2 = f; for (let i3 = 0; i3 < s2; i3++) { const s3 = t2[i3]; let a2, u2, d2 = -1, y3 = 0; for (; y3 < s3.length && (c2.lastIndex = y3, u2 = c2.exec(s3), null !== u2); ) y3 = c2.lastIndex, c2 === f ? "!--" === u2[1] ? c2 = v : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($.test(u2[2]) && (r2 = RegExp("</" + u2[2], "g")), c2 = m) : void 0 !== u2[3] && (c2 = m) : c2 === m ? ">" === u2[0] ? (c2 = r2 ?? f, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g : p) : c2 === g || c2 === p ? c2 = m : c2 === v || c2 === _ ? c2 = f : (c2 = m, r2 = void 0); const x2 = c2 === m && t2[i3 + 1].startsWith("/>") ? " " : ""; l2 += c2 === f ? s3 + n$1 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e + s3.slice(d2) + h + x2) : s3 + h + (-2 === d2 ? i3 : x2); } return [P(t2, l2 + (t2[s2] || "<?>") + (2 === i2 ? "</svg>" : 3 === i2 ? "</math>" : "")), o2]; }; class N { constructor({ strings: t2, _$litType$: s2 }, n3) { let r2; this.parts = []; let c2 = 0, a2 = 0; const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = V(t2, s2); if (this.el = N.createElement(f2, n3), C.currentNode = this.el.content, 2 === s2 || 3 === s2) { const t3 = this.el.content.firstChild; t3.replaceWith(...t3.childNodes); } for (; null !== (r2 = C.nextNode()) && d2.length < u2; ) { if (1 === r2.nodeType) { if (r2.hasAttributes()) for (const t3 of r2.getAttributeNames()) if (t3.endsWith(e)) { const i2 = v2[a2++], s3 = r2.getAttribute(t3).split(h), e2 = /([.?@])?(.*)/.exec(i2); d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? H : "?" === e2[1] ? I : "@" === e2[1] ? L : k }), r2.removeAttribute(t3); } else t3.startsWith(h) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3)); if ($.test(r2.tagName)) { const t3 = r2.textContent.split(h), s3 = t3.length - 1; if (s3 > 0) { r2.textContent = i$1 ? i$1.emptyScript : ""; for (let i2 = 0; i2 < s3; i2++) r2.append(t3[i2], l()), C.nextNode(), d2.push({ type: 2, index: ++c2 }); r2.append(t3[s3], l()); } } } else if (8 === r2.nodeType) if (r2.data === o$2) d2.push({ type: 2, index: c2 }); else { let t3 = -1; for (; -1 !== (t3 = r2.data.indexOf(h, t3 + 1)); ) d2.push({ type: 7, index: c2 }), t3 += h.length - 1; } c2++; } } static createElement(t2, i2) { const s2 = r$2.createElement("template"); return s2.innerHTML = t2, s2; } } function S(t2, i2, s2 = t2, e2) { var _a2, _b; if (i2 === T) return i2; let h2 = void 0 !== e2 ? (_a2 = s2._$Co) == null ? void 0 : _a2[e2] : s2._$Cl; const o2 = c(i2) ? void 0 : i2._$litDirective$; return (h2 == null ? void 0 : h2.constructor) !== o2 && ((_b = h2 == null ? void 0 : h2._$AO) == null ? void 0 : _b.call(h2, false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ?? (s2._$Co = []))[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i2 = S(t2, h2._$AS(t2, i2.values), h2, e2)), i2; } class M { constructor(t2, i2) { this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i2; } get parentNode() { return this._$AM.parentNode; } get _$AU() { return this._$AM._$AU; } u(t2) { const { el: { content: i2 }, parts: s2 } = this._$AD, e2 = ((t2 == null ? void 0 : t2.creationScope) ?? r$2).importNode(i2, true); C.currentNode = e2; let h2 = C.nextNode(), o2 = 0, n3 = 0, l2 = s2[0]; for (; void 0 !== l2; ) { if (o2 === l2.index) { let i3; 2 === l2.type ? i3 = new R(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i3 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i3 = new z(h2, this, t2)), this._$AV.push(i3), l2 = s2[++n3]; } o2 !== (l2 == null ? void 0 : l2.index) && (h2 = C.nextNode(), o2++); } return C.currentNode = r$2, e2; } p(t2) { let i2 = 0; for (const s2 of this._$AV) void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i2), i2 += s2.strings.length - 2) : s2._$AI(t2[i2])), i2++; } } class R { get _$AU() { var _a2; return ((_a2 = this._$AM) == null ? void 0 : _a2._$AU) ?? this._$Cv; } constructor(t2, i2, s2, e2) { this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t2, this._$AB = i2, this._$AM = s2, this.options = e2, this._$Cv = (e2 == null ? void 0 : e2.isConnected) ?? true; } get parentNode() { let t2 = this._$AA.parentNode; const i2 = this._$AM; return void 0 !== i2 && 11 === (t2 == null ? void 0 : t2.nodeType) && (t2 = i2.parentNode), t2; } get startNode() { return this._$AA; } get endNode() { return this._$AB; } _$AI(t2, i2 = this) { t2 = S(this, t2, i2), c(t2) ? t2 === E || null == t2 || "" === t2 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t2 !== this._$AH && t2 !== T && this._(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : u(t2) ? this.k(t2) : this._(t2); } O(t2) { return this._$AA.parentNode.insertBefore(t2, this._$AB); } T(t2) { this._$AH !== t2 && (this._$AR(), this._$AH = this.O(t2)); } _(t2) { this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(r$2.createTextNode(t2)), this._$AH = t2; } $(t2) { var _a2; const { values: i2, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = N.createElement(P(s2.h, s2.h[0]), this.options)), s2); if (((_a2 = this._$AH) == null ? void 0 : _a2._$AD) === e2) this._$AH.p(i2); else { const t3 = new M(e2, this), s3 = t3.u(this.options); t3.p(i2), this.T(s3), this._$AH = t3; } } _$AC(t2) { let i2 = A.get(t2.strings); return void 0 === i2 && A.set(t2.strings, i2 = new N(t2)), i2; } k(t2) { a(this._$AH) || (this._$AH = [], this._$AR()); const i2 = this._$AH; let s2, e2 = 0; for (const h2 of t2) e2 === i2.length ? i2.push(s2 = new R(this.O(l()), this.O(l()), this, this.options)) : s2 = i2[e2], s2._$AI(h2), e2++; e2 < i2.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i2.length = e2); } _$AR(t2 = this._$AA.nextSibling, i2) { var _a2; for ((_a2 = this._$AP) == null ? void 0 : _a2.call(this, false, true, i2); t2 && t2 !== this._$AB; ) { const i3 = t2.nextSibling; t2.remove(), t2 = i3; } } setConnected(t2) { var _a2; void 0 === this._$AM && (this._$Cv = t2, (_a2 = this._$AP) == null ? void 0 : _a2.call(this, t2)); } } class k { get tagName() { return this.element.tagName; } get _$AU() { return this._$AM._$AU; } constructor(t2, i2, s2, e2, h2) { this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t2, this.name = i2, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = E; } _$AI(t2, i2 = this, s2, e2) { const h2 = this.strings; let o2 = false; if (void 0 === h2) t2 = S(this, t2, i2, 0), o2 = !c(t2) || t2 !== this._$AH && t2 !== T, o2 && (this._$AH = t2); else { const e3 = t2; let n3, r2; for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++) r2 = S(this, e3[s2 + n3], i2, n3), r2 === T && (r2 = this._$AH[n3]), o2 || (o2 = !c(r2) || r2 !== this._$AH[n3]), r2 === E ? t2 = E : t2 !== E && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2; } o2 && !e2 && this.j(t2); } j(t2) { t2 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? ""); } } class H extends k { constructor() { super(...arguments), this.type = 3; } j(t2) { this.element[this.name] = t2 === E ? void 0 : t2; } } class I extends k { constructor() { super(...arguments), this.type = 4; } j(t2) { this.element.toggleAttribute(this.name, !!t2 && t2 !== E); } } class L extends k { constructor(t2, i2, s2, e2, h2) { super(t2, i2, s2, e2, h2), this.type = 5; } _$AI(t2, i2 = this) { if ((t2 = S(this, t2, i2, 0) ?? E) === T) return; const s2 = this._$AH, e2 = t2 === E && s2 !== E || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== E && (s2 === E || e2); e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2; } handleEvent(t2) { var _a2; "function" == typeof this._$AH ? this._$AH.call(((_a2 = this.options) == null ? void 0 : _a2.host) ?? this.element, t2) : this._$AH.handleEvent(t2); } } class z { constructor(t2, i2, s2) { this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i2, this.options = s2; } get _$AU() { return this._$AM._$AU; } _$AI(t2) { S(this, t2); } } const j = t$1.litHtmlPolyfillSupport; j == null ? void 0 : j(N, R), (t$1.litHtmlVersions ?? (t$1.litHtmlVersions = [])).push("3.3.0"); const B = (t2, i2, s2) => { const e2 = (s2 == null ? void 0 : s2.renderBefore) ?? i2; let h2 = e2._$litPart$; if (void 0 === h2) { const t3 = (s2 == null ? void 0 : s2.renderBefore) ?? null; e2._$litPart$ = h2 = new R(i2.insertBefore(l(), t3), t3, void 0, s2 ?? {}); } return h2._$AI(t2), h2; }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const s = globalThis; class i extends y$1 { constructor() { super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; } createRenderRoot() { var _a2; const t2 = super.createRenderRoot(); return (_a2 = this.renderOptions).renderBefore ?? (_a2.renderBefore = t2.firstChild), t2; } update(t2) { const r2 = this.render(); this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this._$Do = B(r2, this.renderRoot, this.renderOptions); } connectedCallback() { var _a2; super.connectedCallback(), (_a2 = this._$Do) == null ? void 0 : _a2.setConnected(true); } disconnectedCallback() { var _a2; super.disconnectedCallback(), (_a2 = this._$Do) == null ? void 0 : _a2.setConnected(false); } render() { return T; } } i._$litElement$ = true, i["finalized"] = true, (_a = s.litElementHydrateSupport) == null ? void 0 : _a.call(s, { LitElement: i }); const o$1 = s.litElementPolyfillSupport; o$1 == null ? void 0 : o$1({ LitElement: i }); (s.litElementVersions ?? (s.litElementVersions = [])).push("4.2.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t = (t2) => (e2, o2) => { void 0 !== o2 ? o2.addInitializer(() => { customElements.define(t2, e2); }) : customElements.define(t2, e2); }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const o = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 }, r$1 = (t2 = o, e2, r2) => { const { kind: n3, metadata: i2 } = r2; let s2 = globalThis.litPropertyMetadata.get(i2); if (void 0 === s2 && globalThis.litPropertyMetadata.set(i2, s2 = /* @__PURE__ */ new Map()), "setter" === n3 && ((t2 = Object.create(t2)).wrapped = true), s2.set(r2.name, t2), "accessor" === n3) { const { name: o2 } = r2; return { set(r3) { const n4 = e2.get.call(this); e2.set.call(this, r3), this.requestUpdate(o2, n4, t2); }, init(e3) { return void 0 !== e3 && this.C(o2, void 0, t2, e3), e3; } }; } if ("setter" === n3) { const { name: o2 } = r2; return function(r3) { const n4 = this[o2]; e2.call(this, r3), this.requestUpdate(o2, n4, t2); }; } throw Error("Unsupported decorator location: " + n3); }; function n2(t2) { return (e2, o2) => "object" == typeof o2 ? r$1(t2, e2, o2) : ((t3, e3, o3) => { const r2 = e3.hasOwnProperty(o3); return e3.constructor.createProperty(o3, t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0; })(t2, e2, o2); } /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ function r(r2) { return n2({ ...r2, state: true, attribute: false }); } const style$2 = '.text-info {\n color: var(--bcbd-dark-info-color, #206f76);\n}\n.text-info .btn-help {\n color: var(--bcbd-white-color, #FFFFFF);\n}\n.text-info span {\n color: var(--bcbd-dark-info-color, #206f76);\n}\n.text-info span:after {\n background-color: var(--bcbd-dark-info-color, #206f76) !important;\n}\n\n.bg-info {\n background-color: var(--bcbd-dark-info-color, #206f76) !important;\n}\n\n.text-danger {\n color: var(--bcbd-dark-danger-color, #7c2642);\n}\n.text-danger .btn-help {\n color: var(--bcbd-white-color, #FFFFFF);\n}\n.text-danger span {\n color: var(--bcbd-dark-danger-color, #7c2642);\n}\n.text-danger span:after {\n background-color: var(--bcbd-dark-danger-color, #7c2642) !important;\n}\n\n.bg-danger {\n background-color: var(--bcbd-dark-danger-color, #7c2642) !important;\n}\n\n.text-warning {\n color: var(--bcbd-dark-warning-color, #935f00);\n}\n.text-warning .btn-help {\n color: var(--bcbd-white-color, #FFFFFF);\n}\n.text-warning span {\n color: var(--bcbd-dark-warning-color, #935f00);\n}\n.text-warning span:after {\n background-color: var(--bcbd-dark-warning-color, #935f00) !important;\n}\n\n.bg-warning {\n background-color: var(--bcbd-dark-warning-color, #935f00) !important;\n}\n\n.text-orange {\n color: var(--bcbd-dark-orange-color, #943e04);\n}\n.text-orange .btn-help {\n color: var(--bcbd-white-color, #FFFFFF);\n}\n.text-orange span {\n color: var(--bcbd-dark-orange-color, #943e04);\n}\n.text-orange span:after {\n background-color: var(--bcbd-dark-orange-color, #943e04) !important;\n}\n\n.bg-orange {\n background-color: var(--bcbd-dark-orange-color, #943e04) !important;\n}\n\n::ng-deep .fiche-modal {\n display: flex !important;\n justify-content: center;\n align-items: center;\n}\n\n::ng-deep .modal-alert {\n overflow-y: auto;\n max-height: 400px;\n}\n\n.icon-container span {\n padding-left: 4px;\n}\n\n.alerts-modal {\n position: fixed;\n z-index: 9999;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100vh;\n overflow: auto;\n background-color: var(--bcbd-black-color, #000000);\n background-color: color-mix(in srgb, var(--bcbd-black-color, #000000) 40%, transparent);\n}\n\n.modal-content {\n background-color: var(--bcbd-white-color, #FFFFFF);\n margin: 15% auto;\n border: 1px solid var(--bcbd-light-gray-color, #AFAFAF);\n width: 40%;\n border-radius: 8px;\n max-height: 400px;\n}\n\n.close {\n color: var(--bcbd-white-color, #FFFFFF);\n float: right;\n font-size: 28px;\n font-weight: bold;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.close:hover,\n.close:focus {\n color: var(--bcbd-light-gray-color, #AFAFAF);\n text-decoration: none;\n cursor: pointer;\n}\n\n.modal-body {\n padding: 20px;\n}\n\n.modal-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n background: linear-gradient(45deg, var(--bcbd-secondary-color, #4A0C8A) 0%, var(--bcbd-primary-color, #0C75AD) 100%);\n padding: 10px;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n}\n\n.modal-title {\n -webkit-text-fill-color: var(--bcbd-white-color, #FFFFFF);\n}\n\n.modal-body-content {\n max-height: 200px;\n overflow-y: auto;\n}\n\n.card-body {\n border: none;\n background: var(--bcbd-gray-100-color, #f1f5f9);\n font-family: var(--custom-font-family, "Ubuntu"), sans-serif;\n}\n.card-body ul {\n padding-left: 4px;\n margin: 0;\n list-style: none;\n}\n.card-body ul li {\n font-size: 16px;\n border: none;\n background: none;\n white-space: inherit;\n text-decoration: none;\n text-align: left;\n}\n.card-body ul li:hover, .card-body ul li:focus {\n cursor: pointer;\n text-decoration: underline;\n}\n\n.btn-help {\n height: 16px;\n width: 16px;\n border-radius: 8px;\n text-align: center;\n font-size: 10px;\n background-color: var(--bcbd-black-color, #000000);\n display: inline-block;\n font-weight: 700;\n text-decoration: none;\n cursor: pointer;\n user-select: none;\n line-height: 16px;\n}'; var EPatientFieldType = /* @__PURE__ */ ((EPatientFieldType2) => { EPatientFieldType2[EPatientFieldType2["Boolean"] = 0] = "Boolean"; EPatientFieldType2[EPatientFieldType2["AMM"] = 1] = "AMM"; EPatientFieldType2[EPatientFieldType2["CIM10"] = 2] = "CIM10"; return EPatientFieldType2; })(EPatientFieldType || {}); class PatientField { constructor(id, label, type, toDisplay, code) { this.id = id; this.label = label; this.type = type; this.toDisplay = toDisplay; if (type === EPatientFieldType.AMM) { this.code = code; } } } function getPatientForApi(patient) { var _a2, _b, _c, _d, _e; const profilPatient = patient; const pathologies = []; (_a2 = profilPatient == null ? void 0 : profilPatient.antecedents) == null ? void 0 : _a2.forEach((option) => { pathologies.push({ type: option.type, code: option.value, label: "" }); }); getTerrains(patient).filter((terrain) => terrain.type === EPatientFieldType.AMM).forEach((terrain) => { terrain == null ? void 0 : terrain.code.forEach((code) => { pathologies.push({ type: "AMM", code, label: "" }); }); }); const allergies = []; (_b = profilPatient == null ? void 0 : profilPatient.allergies) == null ? void 0 : _b.forEach((option) => { allergies.push({ code: parseInt(option.value), label: "" }); }); return { age: Number.isInteger(profilPatient == null ? void 0 : profilPatient.age) ? profilPatient.unite == "mois" ? profilPatient.age : profilPatient.age * 12 : 0, gender: (_c = profilPatient == null ? void 0 : profilPatient.sexe) == null ? void 0 : _c.substring(0, 1), weight: Number.isInteger(profilPatient == null ? void 0 : profilPatient.poids) ? profilPatient.poids : 0, pregnancy: ((_d = profilPatient == null ? void 0 : profilPatient.terrains) == null ? void 0 : _d.find((terrain) => terrain.value === "grossesse")) != void 0, breastfeeding: ((_e = profilPatient == null ? void 0 : profilPatient.terrains) == null ? void 0 : _e.find((terrain) => terrain.value === "allaitement")) != void 0, ammPathologies: pathologies, allergies, hepaticStage: "", firstName: profilPatient == null ? void 0 : profilPatient.firstName, lastName: profilPatient == null ? void 0 : profilPatient.lastName, height: Number.isInteger(profilPatient == null ? void 0 : profilPatient.taille) ? profilPatient.taille : 0, weeksOfPregnancy: profilPatient == null ? void 0 : profilPatient.amenorrhee, creatinineClearance: 0, molCreatinine: 0, mglCreatinine: 0, gfr: 0, medicalTeam: null }; } function getTerrains(patient) { return createTerrains().filter((terrain) => { var _a2; return ((_a2 = patient == null ? void 0 : patient.terrains) == null ? void 0 : _a2.filter((option) => option.value == terrain.id).length) > 0; }); } function createTerrains() { return [ new PatientField("grossesse", "Grossesse", EPatientFieldType.Boolean, (profilPatient) => { return !profilPatient || hasOver12YearsAndIsNotMan(profilPatient); }), new PatientField("allaitement", "Allaitement", EPatientFieldType.Boolean, (profilPatient) => { return !profilPatient || hasOver12YearsAndIsNotMan(profilPatient); }), new PatientField("insuffisanceRenaleLegere", "Insuffisance rénale légère", EPatientFieldType.AMM, () => true, ["0000023388"]), new PatientField("insuffisanceRenaleModeree", "Insuffisance rénale modérée", EPatientFieldType.AMM, () => true, ["0000033534"]), new PatientField("insuffisanceRenaleSevere", "Insuffisance rénale sévère", EPatientFieldType.AMM, () => true, ["0000003855"]), new PatientField("A", "Insuffisance hépatique légère", EPatientFieldType.AMM, () => true, ["0000023738"]), new PatientField("B", "Insuffisance hépatique modérée", EPatientFieldType.AMM, () => true, ["0000012038"]), new PatientField("C", "Insuffisance hépatique sévère", EPatientFieldType.AMM, () => true, ["0000003833"]), new PatientField("diabeteType1", "Diabète de type 1", EPatientFieldType.AMM, () => true, ["0000016787"]), new PatientField("diabeteType2", "Diabète de type 2", EPatientFieldType.AMM, () => true, ["0000014836"]), new PatientField("tabagisme", "Tabagisme", EPatientFieldType.AMM, () => true, ["0000000716", "0000005790", "0000007923", "0000020997", "0000027203", "0000030315", "0000028979"]), new PatientField("alcoolisme", "Alcoolisme", EPatientFieldType.AMM, () => true, ["0000000276", "0000001403", "0000002335", "0000003969", "0000005517", "0000006578", "0000006601", "0000006952", "0000013679", "0000014126", "0000015263", "0000017637", "0000020999", "0000024408", "0000025632", "0000027502", "0000028763"]), new PatientField("menopause", "Ménopause", EPatientFieldType.AMM, () => true, ["0000004447", "0000004451", "0000004764", "0000324555"]) ]; } function hasOver12YearsAndIsNotMan(profilPatient) { var _a2; return (!profilPatient.age || getAgeInYears(profilPatient) > 12) && ((_a2 = profilPatient == null ? void 0 : profilPatient.sexe) == null ? void 0 : _a2.toString()) != "Masculin"; } function getAgeInYears(profilPatient) { return profilPatient.unite === "ans" ? profilPatient.age : profilPatient.age / 12; } const responses = {}; const promises = {}; let alertsGroupedById = {}; async function hashData(apiUrl, patient, products) { const string = apiUrl + JSON.stringify(patient) + JSON.stringify(products); const utf8 = new TextEncoder().encode(string); return crypto.subtle.digest("SHA-256", utf8).then((hashBuffer) => { const hashArray = Array.from(new Uint8Array(hashBuffer)); return hashArray.map((bytes) => bytes.toString(16).padStart(2, "0")).join(""); }); } async function getAlerts(apiUrl, patient, products, isNewApiEnabled) { const hash = await hashData(apiUrl, patient, products); let response; if (responses[hash]) { response = responses[hash]; } else if (promises[hash] !== void 0) { response = await promises[hash]; } else { promises[hash] = fetchAlerts(apiUrl, getPatientForApi(patient), products, isNewApiEnabled); promises[hash].then((data) => { delete promises[hash]; responses[hash] = data; }); response = await promises[hash]; } const productPrescriptionIds = findProductIds((response.prescriptionAlerts ?? []).concat(response.stoppAlerts ?? [])); const productsSAMIds = findSAMProductIds(response.samAlerts); const productsIds = productPrescriptionIds.concat(productsSAMIds); return _groupByProductId(response.prescriptionAlerts.concat(response.samAlerts), productsIds); } async function getPosoAlerts(apiUrl, patient, posologies) { var _a2; const hash = await hashData(apiUrl, patient, posologies); let response; if (responses[hash]) { response = responses[hash]; } else if (promises[hash] !== void 0) { response = await promises[hash]; } else { promises[hash] = fetchPosoAlerts(apiUrl, getPatientForApi(patient), posologies); promises[hash].then((data) => { delete promises[hash]; responses[hash] = data; }); response = await promises[hash]; } const productIds = (_a2 = response == null ? void 0 : response.posoAlerts) == null ? void 0 : _a2.map((product) => product.productId); return _groupByProductId(response.posoAlerts, productIds); } async function fetchPosoAlerts(apiUrl, patient, posologies) { if (posologies.every((valeur) => valeur === null)) { posologies = []; } else { posologies = posologies.filter((valeur) => valeur !== null); } const prescription = { patient, posologies }; try { const response = await fetch(apiUrl + "/api/prescription/posologies/check", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(prescription) }); if (!response.ok) { throw new Error("Échec de la requête."); } const jsonData = await response.json(); return { posoAlerts: jsonData.posologiesAlerts }; } catch (error) { console.error("Erreur lors de la récupération des données de l'API : ", error); return Promise.reject(new Error(error)); } } async function fetchAlerts(apiUrl, patient, products, isNewApiEnabled) { const prescription = { products, patient, filters: { "withInteractions": true, "withRedundants": true, "withCI": true, "withPE": true, "withOverdose": true, "withAllergies": true, "withIpc": true, "withStopp": true, "withSAM": true } }; if (isNewApiEnabled) { apiUrl = apiUrl + "/api/prescription/prescription"; } else { apiUrl = apiUrl + "/api/prescription/prescription/check"; } try { const response = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(prescription) }); if (!response.ok) { throw new Error("Échec de la requête."); } const jsonData = await response.json(); return { prescriptionAlerts: jsonData.prescriptionAlerts, stoppAlerts: jsonData.stoppAlerts, samAlerts: jsonData.samAlerts }; } catch (error) { console.error("Erreur lors de la récupération des données de l'API : ", error); return Promise.reject(new Error(error)); } } function getAlertsCount(alerts) { return (alerts == null ? void 0 : alerts.length) ? alerts.length : 0; } function findProductIds(alerts) { return alerts.map((data) => data.products).flat().map((product) => product == null ? void 0 : product.productId).reduce((acc, val) => { if (!acc.includes(val)) { acc.push(val); } return acc; }, []); } function findSAMProductIds(alerts) { return alerts.filter((alert) => alert.hasSam).map((alert) => alert.productId).reduce((acc, val) => { if (!acc.includes(val)) { acc.push(val); } return acc; }, []); } function _isProductIdPresent(alert, productIds) { var _a2; return (_a2 = alert.products) == null ? void 0 : _a2.some((product) => productIds.includes(product.productId)); } function _isProductIdPresentPoso(alert, productIds) { return productIds.includes(alert.productId); } function _getAlertProductById(alert, productId) { return alert.products.map((product) => product.productId).indexOf(productId) > -1; } function _getAlertProductByIdPoso(alert, productId) { return alert.productId === productId; } function _groupByProductId(alerts, productIds) { const alerts0 = alerts == null ? void 0 : alerts.filter((alert) => _isProductIdPresent(alert, productIds) && alert.type === 0); const alerts1d = alerts == null ? void 0 : alerts.filter((alert) => _isProductIdPresent(alert, productIds) && alert.type === 1 && alert.level === 3); const alerts1c = alerts == null ? void 0 : alerts.filter((alert) => _isProductIdPresent(alert, productIds) && alert.type === 1 && alert.level === 4); const alerts2 = alerts == null ? void 0 : alerts.filter((alert) => _isProductIdPresent(alert, productIds) && alert.type === 2); const alerts4 = alerts == null ? void 0 : alerts.filter((alert) => _isProductIdPresent(alert, productIds) && alert.type === 4); const alerts5 = alerts == null ? void 0 : alerts.filter((alert) => _isProductIdPresent(alert, productIds) && alert.type === 5); const alerts6 = alerts == null ? void 0 : alerts.filter((alert) => _isProductIdPresent(alert, productIds) && alert.type === 6); const stoppAlerts = alerts == null ? void 0 : alerts.filter((alert) => _isProductIdPresent(alert, productIds) && alert.type === 7); const posoAlerts = alerts == null ? void 0 : alerts.filter((alert) => _isProductIdPresentPoso(alert, productIds)); const samAlerts = alerts == null ? void 0 : alerts.filter((alert) => _isProductIdPresentPoso(alert, productIds)); alertsGroupedById = {}; productIds.forEach((productId) => { alertsGroupedById[productId] = { alerts0: alerts0 == null ? void 0 : alerts0.filter((alert) => _getAlertProductById(alert, productId)), alerts1d: alerts1d == null ? void 0 : alerts1d.filter((alert) => _getAlertProductById(alert, productId)), alerts1c: alerts1c == null ? void 0 : alerts1c.filter((alert) => _getAlertProductById(alert, productId)), alerts2: alerts2 == null ? void 0 : alerts2.filter((alert) => _getAlertProductById(alert, productId)), alerts4: alerts4 == null ? void 0 : alerts4.filter((alert) => _getAlertProductById(alert, productId)), alerts5: alerts5 == null ? void 0 : alerts5.filter((alert) => _getAlertProductById(alert, productId)), alerts6: alerts6 == null ? void 0 : alerts6.filter((alert) => _getAlertProductById(alert, productId)), stoppAlerts: stoppAlerts == null ? void 0 : stoppAlerts.filter((alert) => _getAlertProductById(alert, productId)), posoAlerts: posoAlerts == null ? void 0 : posoAlerts.filter((alert) => _getAlertProductByIdPoso(alert, productId)), samAlerts: samAlerts == null ? void 0 : samAlerts.filter((alert) => _getAlertProductByIdPoso(alert, productId)) }; }); return alertsGroupedById; } const __variableDynamicImportRuntimeHelper = (glob, path, segs) => { const v2 = glob[path]; if (v2) { return typeof v2 === "function" ? v2() : Promise.resolve(v2); } return new Promise((_2, reject) => { (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)( reject.bind( null, new Error( "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "") ) ) ); }); }; /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const LOCALE_STATUS_EVENT = "lit-localize-status"; let installed = false; function _installMsgImplementation(impl) { if (installed) { throw new Error("lit-localize can only be configured once"); } installed = true; } /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class Deferred { constructor() { this.settled = false; this.promise = new Promise((resolve, reject) => { this._resolve = resolve; this._reject = reject; }); } resolve(value) { this.settled = true; this._resolve(value); } reject(error) { this.settled = true; this._reject(error); } } /** * @license * Copyright 2014 Travis Webb * SPDX-License-Identifier: MIT */ for (let i2 = 0; i2 < 256; i2++) { (i2 >> 4 & 15).toString(16) + (i2 & 15).toString(16); } /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ function dispatchStatusEvent(detail) { window.dispatchEvent(new CustomEvent(LOCALE_STATUS_EVENT, { detail })); } let activeLocale = ""; let loadingLocale; let sourceLocale$1; let validLocales; let loadLocale; let loading = new Deferred(); loading.resolve(); let requestId = 0; const configureLocalization = (config) => { _installMsgImplementation(); activeLocale = sourceLocale$1 = config.sourceLocale; validLocales = new Set(config.targetLocales); validLocales.add(config.sourceLocale); loadLocale = config.loadLocale; return { getLocale, setLocale: setLocale$1 }; }; const getLocale = () => { return activeLocale; }; const setLocale$1 = (newLocale) => { if (newLocale === (loadingLocale ?? activeLocale)) { return loading.promise; } if (!validLocales || !loadLocale) { throw new Error("Internal error"); } if (!validLocales.has(newLocale)) { throw new Error("Invalid locale code"); } requestId++; const thisRequestId = requestId; loadingLocale = newLocale; if (loading.settled) { loading = new Deferred(); } dispatchStatusEvent({ status: "loading", loadingLocale: newLocale }); const localePromise = newLocale === sourceLocale$1 ? ( // We could switch to the source locale synchronously, but we prefer to // queue it on a microtask so that switching locales is consistently // asynchronous. Promise.resolve({ templates: void 0 }) ) : loadLocale(newLocale); localePromise.then((mod) => { if (requestId === thisRequestId) { activeLocale = newLocale; loadingLocale = void 0; mod.templates; dispatchStatusEvent({ status: "ready", readyLocale: newLocale }); loading.resolve(); } }, (err) => { if (requestId === thisRequestId) { dispatchStatusEvent({ status: "error", errorLocale: newLocale, errorMessage: err.toString() }); loading.reject(err); } }); return loading.promise; }; const sourceLocale = `en`; const targetLocales = [ `fr-FR` ]; const { setLocale } = configureLocalization({ sourceLocale, targetLocales, loadLocale: (locale) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../i18n/locales/fr-FR.ts": () => import("./fr-FR-C9-5SvOU.js") }), `../i18n/locales/${locale}.ts`, 4) }); const ALERT_LEVELS = { NOT_RECOMMENDED: "déconseillé", CONTRAINDICATED: "contre-indiqué", PRECAUTION_FOR_USE: "précaution", ALLERGY: "Allergie" }; const ALERT_CHAPTER = { CI_CHAPTER: "2", PFU_CHAPTER: "3", ALLERGY_CHAPTER: "22,23" }; const ALERT_TYPES = { CONTRAINDICATION: 1, PRECAUTION_FOR_USE: 2, ALLERGY: 6, STOPP: 7, REDUNDANCY: 4, IPC: 5, INTERACTION: 0, POSOLOGY: 8, SAM: 9 }; let alertChapter = []; function _isPregnantOrNursing(productAlert) { return productAlert.some((alert) => alert.shortText == "Grossesse" || alert.shortText == "Allaitement"); } function _getProductAlertByLevel(level, product) { switch (level) { case ALERT_LEVELS.CONTRAINDICATED: return product.alerts1c; case ALERT_LEVELS.NOT_RECOMMENDED: return product.alerts1d; case ALERT_LEVELS.PRECAUTION_FOR_USE: return product.alerts2; default: return []; } } async function getAlertChapter(chapter, level, product, productId, apiUrl) { const productAlert = _getProductAlertByLevel(level, product); if ((level == ALERT_LEVELS.CONTRAINDICATED || level == ALERT_LEVELS.NOT_RECOMMENDED || level == ALERT_LEVELS.PRECAUTION_FOR_USE) && _isPregnantOrNursing(productAlert)) { chapter += ",7"; } alertChapter = []; try { const response = await fetch(apiUrl + "/api/infos/products/" + productId + "/chapters/" + chapter, { method: "GET", headers: { "Content-Type": "application/json" } }); if (!response.ok) { throw new Error("Échec de la requête."); } const jsonData = await response.json(); jsonData.forEach((data) => { data.extendedProperties.chapters.forEach((chapter2) => { alertChapter.push(chapter2); }); }); } catch (error) { console.error("Erreur lors de la récupération des données de l'API : ", error); throw error; } return alertChapter; } function getStoppMessage(product) { return product.stoppAlerts[0].stoppMessage; } function getPosoMessage(product) { const posoMessage = { htmlMessage: product.posoAlerts[0].htmlMessage, quantityMessage: product.posoAlerts[0].quantityMessage }; return posoMessage; } var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; var he = { exports: {} }; /*! https://mths.be/he v1.2.0 by @mathias | MIT license */ he.exports; (function(module, exports) { (function(root) { var freeExports = exports; var freeModule = module && module.exports == freeExports && module; var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal; if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { root = freeGlobal; } var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; var regexAsciiWhitelist = /[\x01-\x7F]/g; var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g; var regexEncodeNonAscii = /<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u22