@claudebernard/search-bar-element
Version:
An element providing some custom stuff.
1,380 lines • 214 kB
JavaScript
import "@claudebernard/design-system";
const __variableDynamicImportRuntimeHelper = (glob$1, path$13, segs) => {
const v2 = glob$1[path$13];
if (v2) return typeof v2 === "function" ? v2() : Promise.resolve(v2);
return new Promise((_2, reject) => {
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + path$13 + (path$13.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : ""))));
});
};
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;
}
class LocalizeController {
constructor(host) {
this.__litLocalizeEventHandler = (event) => {
if (event.detail.status === "ready") {
this.host.requestUpdate();
}
};
this.host = host;
}
hostConnected() {
window.addEventListener(LOCALE_STATUS_EVENT, this.__litLocalizeEventHandler);
}
hostDisconnected() {
window.removeEventListener(LOCALE_STATUS_EVENT, this.__litLocalizeEventHandler);
}
}
const _updateWhenLocaleChanges = (host) => host.addController(new LocalizeController(host));
const updateWhenLocaleChanges = _updateWhenLocaleChanges;
const localized = () => (clazz, _context) => {
clazz.addInitializer(updateWhenLocaleChanges);
return clazz;
};
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);
}
}
for (let i3 = 0; i3 < 256; i3++) {
(i3 >> 4 & 15).toString(16) + (i3 & 15).toString(16);
}
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;
};
var __defProp$4 = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __accessCheck = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var __privateIn = (member, obj) => {
if (Object(obj) !== obj)
throw TypeError('Cannot use the "in" operator on this value');
return member.has(obj);
};
var __privateAdd = (obj, member, value) => {
if (member.has(obj))
throw TypeError("Cannot add the same private member more than once");
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateMethod = (obj, member, method) => {
__accessCheck(obj, member, "access private method");
return method;
};
function defaultEquals(a2, b2) {
return Object.is(a2, b2);
}
let activeConsumer = null;
let inNotificationPhase = false;
let epoch = 1;
const SIGNAL = /* @__PURE__ */ Symbol("SIGNAL");
function setActiveConsumer(consumer) {
const prev = activeConsumer;
activeConsumer = consumer;
return prev;
}
function getActiveConsumer() {
return activeConsumer;
}
function isInNotificationPhase() {
return inNotificationPhase;
}
const REACTIVE_NODE = {
version: 0,
lastCleanEpoch: 0,
dirty: false,
producerNode: void 0,
producerLastReadVersion: void 0,
producerIndexOfThis: void 0,
nextProducerIndex: 0,
liveConsumerNode: void 0,
liveConsumerIndexOfThis: void 0,
consumerAllowSignalWrites: false,
consumerIsAlwaysLive: false,
producerMustRecompute: () => false,
producerRecomputeValue: () => {
},
consumerMarkedDirty: () => {
},
consumerOnSignalRead: () => {
}
};
function producerAccessed(node) {
if (inNotificationPhase) {
throw new Error(
typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : ""
);
}
if (activeConsumer === null) {
return;
}
activeConsumer.consumerOnSignalRead(node);
const idx = activeConsumer.nextProducerIndex++;
assertConsumerNode(activeConsumer);
if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {
if (consumerIsLive(activeConsumer)) {
const staleProducer = activeConsumer.producerNode[idx];
producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);
}
}
if (activeConsumer.producerNode[idx] !== node) {
activeConsumer.producerNode[idx] = node;
activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0;
}
activeConsumer.producerLastReadVersion[idx] = node.version;
}
function producerIncrementEpoch() {
epoch++;
}
function producerUpdateValueVersion(node) {
if (!node.dirty && node.lastCleanEpoch === epoch) {
return;
}
if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {
node.dirty = false;
node.lastCleanEpoch = epoch;
return;
}
node.producerRecomputeValue(node);
node.dirty = false;
node.lastCleanEpoch = epoch;
}
function producerNotifyConsumers(node) {
if (node.liveConsumerNode === void 0) {
return;
}
const prev = inNotificationPhase;
inNotificationPhase = true;
try {
for (const consumer of node.liveConsumerNode) {
if (!consumer.dirty) {
consumerMarkDirty(consumer);
}
}
} finally {
inNotificationPhase = prev;
}
}
function producerUpdatesAllowed() {
return (activeConsumer == null ? void 0 : activeConsumer.consumerAllowSignalWrites) !== false;
}
function consumerMarkDirty(node) {
var _a;
node.dirty = true;
producerNotifyConsumers(node);
(_a = node.consumerMarkedDirty) == null ? void 0 : _a.call(node.wrapper ?? node);
}
function consumerBeforeComputation(node) {
node && (node.nextProducerIndex = 0);
return setActiveConsumer(node);
}
function consumerAfterComputation(node, prevConsumer) {
setActiveConsumer(prevConsumer);
if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) {
return;
}
if (consumerIsLive(node)) {
for (let i3 = node.nextProducerIndex; i3 < node.producerNode.length; i3++) {
producerRemoveLiveConsumerAtIndex(node.producerNode[i3], node.producerIndexOfThis[i3]);
}
}
while (node.producerNode.length > node.nextProducerIndex) {
node.producerNode.pop();
node.producerLastReadVersion.pop();
node.producerIndexOfThis.pop();
}
}
function consumerPollProducersForChange(node) {
assertConsumerNode(node);
for (let i3 = 0; i3 < node.producerNode.length; i3++) {
const producer = node.producerNode[i3];
const seenVersion = node.producerLastReadVersion[i3];
if (seenVersion !== producer.version) {
return true;
}
producerUpdateValueVersion(producer);
if (seenVersion !== producer.version) {
return true;
}
}
return false;
}
function producerAddLiveConsumer(node, consumer, indexOfThis) {
var _a;
assertProducerNode(node);
assertConsumerNode(node);
if (node.liveConsumerNode.length === 0) {
(_a = node.watched) == null ? void 0 : _a.call(node.wrapper);
for (let i3 = 0; i3 < node.producerNode.length; i3++) {
node.producerIndexOfThis[i3] = producerAddLiveConsumer(node.producerNode[i3], node, i3);
}
}
node.liveConsumerIndexOfThis.push(indexOfThis);
return node.liveConsumerNode.push(consumer) - 1;
}
function producerRemoveLiveConsumerAtIndex(node, idx) {
var _a;
assertProducerNode(node);
assertConsumerNode(node);
if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) {
throw new Error(
`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`
);
}
if (node.liveConsumerNode.length === 1) {
(_a = node.unwatched) == null ? void 0 : _a.call(node.wrapper);
for (let i3 = 0; i3 < node.producerNode.length; i3++) {
producerRemoveLiveConsumerAtIndex(node.producerNode[i3], node.producerIndexOfThis[i3]);
}
}
const lastIdx = node.liveConsumerNode.length - 1;
node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];
node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];
node.liveConsumerNode.length--;
node.liveConsumerIndexOfThis.length--;
if (idx < node.liveConsumerNode.length) {
const idxProducer = node.liveConsumerIndexOfThis[idx];
const consumer = node.liveConsumerNode[idx];
assertConsumerNode(consumer);
consumer.producerIndexOfThis[idxProducer] = idx;
}
}
function consumerIsLive(node) {
var _a;
return node.consumerIsAlwaysLive || (((_a = node == null ? void 0 : node.liveConsumerNode) == null ? void 0 : _a.length) ?? 0) > 0;
}
function assertConsumerNode(node) {
node.producerNode ?? (node.producerNode = []);
node.producerIndexOfThis ?? (node.producerIndexOfThis = []);
node.producerLastReadVersion ?? (node.producerLastReadVersion = []);
}
function assertProducerNode(node) {
node.liveConsumerNode ?? (node.liveConsumerNode = []);
node.liveConsumerIndexOfThis ?? (node.liveConsumerIndexOfThis = []);
}
function computedGet(node) {
producerUpdateValueVersion(node);
producerAccessed(node);
if (node.value === ERRORED) {
throw node.error;
}
return node.value;
}
function createComputed(computation) {
const node = Object.create(COMPUTED_NODE);
node.computation = computation;
const computed = () => computedGet(node);
computed[SIGNAL] = node;
return computed;
}
const UNSET = /* @__PURE__ */ Symbol("UNSET");
const COMPUTING = /* @__PURE__ */ Symbol("COMPUTING");
const ERRORED = /* @__PURE__ */ Symbol("ERRORED");
const COMPUTED_NODE = /* @__PURE__ */ (() => {
return {
...REACTIVE_NODE,
value: UNSET,
dirty: true,
error: null,
equal: defaultEquals,
producerMustRecompute(node) {
return node.value === UNSET || node.value === COMPUTING;
},
producerRecomputeValue(node) {
if (node.value === COMPUTING) {
throw new Error("Detected cycle in computations.");
}
const oldValue = node.value;
node.value = COMPUTING;
const prevConsumer = consumerBeforeComputation(node);
let newValue;
let wasEqual = false;
try {
newValue = node.computation.call(node.wrapper);
const oldOk = oldValue !== UNSET && oldValue !== ERRORED;
wasEqual = oldOk && node.equal.call(node.wrapper, oldValue, newValue);
} catch (err) {
newValue = ERRORED;
node.error = err;
} finally {
consumerAfterComputation(node, prevConsumer);
}
if (wasEqual) {
node.value = oldValue;
return;
}
node.value = newValue;
node.version++;
}
};
})();
function defaultThrowError() {
throw new Error();
}
let throwInvalidWriteToSignalErrorFn = defaultThrowError;
function throwInvalidWriteToSignalError() {
throwInvalidWriteToSignalErrorFn();
}
function createSignal(initialValue) {
const node = Object.create(SIGNAL_NODE);
node.value = initialValue;
const getter = () => {
producerAccessed(node);
return node.value;
};
getter[SIGNAL] = node;
return getter;
}
function signalGetFn() {
producerAccessed(this);
return this.value;
}
function signalSetFn(node, newValue) {
if (!producerUpdatesAllowed()) {
throwInvalidWriteToSignalError();
}
if (!node.equal.call(node.wrapper, node.value, newValue)) {
node.value = newValue;
signalValueChanged(node);
}
}
const SIGNAL_NODE = /* @__PURE__ */ (() => {
return {
...REACTIVE_NODE,
equal: defaultEquals,
value: void 0
};
})();
function signalValueChanged(node) {
node.version++;
producerIncrementEpoch();
producerNotifyConsumers(node);
}
const NODE = /* @__PURE__ */ Symbol("node");
var Signal;
((Signal2) => {
var _a, _brand, _b, _brand2;
class State {
constructor(initialValue, options = {}) {
__privateAdd(this, _brand);
__publicField(this, _a);
const ref = createSignal(initialValue);
const node = ref[SIGNAL];
this[NODE] = node;
node.wrapper = this;
if (options) {
const equals = options.equals;
if (equals) {
node.equal = equals;
}
node.watched = options[Signal2.subtle.watched];
node.unwatched = options[Signal2.subtle.unwatched];
}
}
get() {
if (!(0, Signal2.isState)(this))
throw new TypeError("Wrong receiver type for Signal.State.prototype.get");
return signalGetFn.call(this[NODE]);
}
set(newValue) {
if (!(0, Signal2.isState)(this))
throw new TypeError("Wrong receiver type for Signal.State.prototype.set");
if (isInNotificationPhase()) {
throw new Error("Writes to signals not permitted during Watcher callback");
}
const ref = this[NODE];
signalSetFn(ref, newValue);
}
}
_a = NODE;
_brand = /* @__PURE__ */ new WeakSet();
Signal2.isState = (s2) => typeof s2 === "object" && __privateIn(_brand, s2);
Signal2.State = State;
class Computed {
// Create a Signal which evaluates to the value returned by the callback.
// Callback is called with this signal as the parameter.
constructor(computation, options) {
__privateAdd(this, _brand2);
__publicField(this, _b);
const ref = createComputed(computation);
const node = ref[SIGNAL];
node.consumerAllowSignalWrites = true;
this[NODE] = node;
node.wrapper = this;
if (options) {
const equals = options.equals;
if (equals) {
node.equal = equals;
}
node.watched = options[Signal2.subtle.watched];
node.unwatched = options[Signal2.subtle.unwatched];
}
}
get() {
if (!(0, Signal2.isComputed)(this))
throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");
return computedGet(this[NODE]);
}
}
_b = NODE;
_brand2 = /* @__PURE__ */ new WeakSet();
Signal2.isComputed = (c2) => typeof c2 === "object" && __privateIn(_brand2, c2);
Signal2.Computed = Computed;
((subtle2) => {
var _a2, _brand3, _assertSignals, assertSignals_fn;
function untrack(cb) {
let output;
let prevActiveConsumer = null;
try {
prevActiveConsumer = setActiveConsumer(null);
output = cb();
} finally {
setActiveConsumer(prevActiveConsumer);
}
return output;
}
subtle2.untrack = untrack;
function introspectSources(sink) {
var _a3;
if (!(0, Signal2.isComputed)(sink) && !(0, Signal2.isWatcher)(sink)) {
throw new TypeError("Called introspectSources without a Computed or Watcher argument");
}
return ((_a3 = sink[NODE].producerNode) == null ? void 0 : _a3.map((n3) => n3.wrapper)) ?? [];
}
subtle2.introspectSources = introspectSources;
function introspectSinks(signal) {
var _a3;
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
throw new TypeError("Called introspectSinks without a Signal argument");
}
return ((_a3 = signal[NODE].liveConsumerNode) == null ? void 0 : _a3.map((n3) => n3.wrapper)) ?? [];
}
subtle2.introspectSinks = introspectSinks;
function hasSinks(signal) {
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
throw new TypeError("Called hasSinks without a Signal argument");
}
const liveConsumerNode = signal[NODE].liveConsumerNode;
if (!liveConsumerNode)
return false;
return liveConsumerNode.length > 0;
}
subtle2.hasSinks = hasSinks;
function hasSources(signal) {
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isWatcher)(signal)) {
throw new TypeError("Called hasSources without a Computed or Watcher argument");
}
const producerNode = signal[NODE].producerNode;
if (!producerNode)
return false;
return producerNode.length > 0;
}
subtle2.hasSources = hasSources;
class Watcher {
// When a (recursive) source of Watcher is written to, call this callback,
// if it hasn't already been called since the last `watch` call.
// No signals may be read or written during the notify.
constructor(notify) {
__privateAdd(this, _brand3);
__privateAdd(this, _assertSignals);
__publicField(this, _a2);
let node = Object.create(REACTIVE_NODE);
node.wrapper = this;
node.consumerMarkedDirty = notify;
node.consumerIsAlwaysLive = true;
node.consumerAllowSignalWrites = false;
node.producerNode = [];
this[NODE] = node;
}
// Add these signals to the Watcher's set, and set the watcher to run its
// notify callback next time any signal in the set (or one of its dependencies) changes.
// Can be called with no arguments just to reset the "notified" state, so that
// the notify callback will be invoked again.
watch(...signals) {
if (!(0, Signal2.isWatcher)(this)) {
throw new TypeError("Called unwatch without Watcher receiver");
}
__privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals);
const node = this[NODE];
node.dirty = false;
const prev = setActiveConsumer(node);
for (const signal of signals) {
producerAccessed(signal[NODE]);
}
setActiveConsumer(prev);
}
// Remove these signals from the watched set (e.g., for an effect which is disposed)
unwatch(...signals) {
if (!(0, Signal2.isWatcher)(this)) {
throw new TypeError("Called unwatch without Watcher receiver");
}
__privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals);
const node = this[NODE];
assertConsumerNode(node);
for (let i3 = node.producerNode.length - 1; i3 >= 0; i3--) {
if (signals.includes(node.producerNode[i3].wrapper)) {
producerRemoveLiveConsumerAtIndex(node.producerNode[i3], node.producerIndexOfThis[i3]);
const lastIdx = node.producerNode.length - 1;
node.producerNode[i3] = node.producerNode[lastIdx];
node.producerIndexOfThis[i3] = node.producerIndexOfThis[lastIdx];
node.producerNode.length--;
node.producerIndexOfThis.length--;
node.nextProducerIndex--;
if (i3 < node.producerNode.length) {
const idxConsumer = node.producerIndexOfThis[i3];
const producer = node.producerNode[i3];
assertProducerNode(producer);
producer.liveConsumerIndexOfThis[idxConsumer] = i3;
}
}
}
}
// Returns the set of computeds in the Watcher's set which are still yet
// to be re-evaluated
getPending() {
if (!(0, Signal2.isWatcher)(this)) {
throw new TypeError("Called getPending without Watcher receiver");
}
const node = this[NODE];
return node.producerNode.filter((n3) => n3.dirty).map((n3) => n3.wrapper);
}
}
_a2 = NODE;
_brand3 = /* @__PURE__ */ new WeakSet();
_assertSignals = /* @__PURE__ */ new WeakSet();
assertSignals_fn = function(signals) {
for (const signal of signals) {
if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
throw new TypeError("Called watch/unwatch without a Computed or State argument");
}
}
};
Signal2.isWatcher = (w2) => __privateIn(_brand3, w2);
subtle2.Watcher = Watcher;
function currentComputed() {
var _a3;
return (_a3 = getActiveConsumer()) == null ? void 0 : _a3.wrapper;
}
subtle2.currentComputed = currentComputed;
subtle2.watched = /* @__PURE__ */ Symbol("watched");
subtle2.unwatched = /* @__PURE__ */ Symbol("unwatched");
})(Signal2.subtle || (Signal2.subtle = {}));
})(Signal || (Signal = {}));
const i$6 = /* @__PURE__ */ Symbol("SignalWatcherBrand"), s$5 = new FinalizationRegistry((({ watcher: t2, signal: i3 }) => {
t2.unwatch(i3);
})), h$5 = /* @__PURE__ */ new WeakMap();
function e$6(e2) {
return true === e2[i$6] ? (console.warn("SignalWatcher should not be applied to the same class more than once."), e2) : class extends e2 {
constructor() {
super(...arguments), this._$St = new Signal.State(0), this._$Si = false, this._$So = true, this._$Sh = /* @__PURE__ */ new Set();
}
_$Sl() {
if (void 0 !== this._$Su) return;
this._$Sv = new Signal.Computed((() => {
this._$St.get(), super.performUpdate();
}));
const i3 = this._$Su = new Signal.subtle.Watcher((function() {
const t2 = h$5.get(this);
void 0 !== t2 && (false === t2._$Si && t2.requestUpdate(), this.watch());
}));
h$5.set(i3, this), s$5.register(this, { watcher: i3, signal: this._$Sv }), i3.watch(this._$Sv);
}
_$Sp() {
void 0 !== this._$Su && (this._$Su.unwatch(this._$Sv), this._$Sv = void 0, this._$Su = void 0);
}
performUpdate() {
this.isUpdatePending && (this._$Sl(), this._$Si = true, this._$St.set(this._$St.get() + 1), this._$Si = false, this._$Sv.get());
}
update(t2) {
try {
this._$So ? (this._$So = false, super.update(t2)) : this._$Sh.forEach(((t3) => t3.commit()));
} finally {
this.isUpdatePending = false, this._$Sh.clear();
}
}
requestUpdate(t2, i3, s2) {
this._$So = true, super.requestUpdate(t2, i3, s2);
}
connectedCallback() {
super.connectedCallback(), this.requestUpdate();
}
disconnectedCallback() {
super.disconnectedCallback(), queueMicrotask((() => {
false === this.isConnected && this._$Sp();
}));
}
_(t2) {
this._$Sh.add(t2);
const i3 = this._$So;
this.requestUpdate(), this._$So = i3;
}
m(t2) {
this._$Sh.delete(t2);
}
};
}
const t$3 = { ATTRIBUTE: 1, CHILD: 2 }, e$5 = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
let i$5 = class i {
constructor(t2) {
}
get _$AU() {
return this._$AM._$AU;
}
_$AT(t2, e2, i3) {
this._$Ct = t2, this._$AM = e2, this._$Ci = i3;
}
_$AS(t2, e2) {
return this.update(t2, e2);
}
update(t2, e2) {
return this.render(...e2);
}
};
const t$2 = globalThis, i$4 = (t2) => t2, s$4 = t$2.trustedTypes, e$4 = s$4 ? s$4.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, h$4 = "$lit$", o$6 = `lit$${Math.random().toFixed(9).slice(2)}$`, n$6 = "?" + o$6, r$8 = `<${n$6}>`, l$1 = document, c$3 = () => l$1.createComment(""), a$2 = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, u$1 = Array.isArray, d$1 = (t2) => u$1(t2) || "function" == typeof t2?.[Symbol.iterator], f$2 = "[ \n\f\r]", v = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, _$1 = /-->/g, m = />/g, p$1 = RegExp(`>|${f$2}(?:([^\\s"'>=/]+)(${f$2}*=${f$2}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`, "g"), g = /'/g, $ = /"/g, y$2 = /^(?:script|style|textarea|title)$/i, x$1 = (t2) => (i3, ...s2) => ({ _$litType$: t2, strings: i3, values: s2 }), b$1 = x$1(1), E$1 = /* @__PURE__ */ Symbol.for("lit-noChange"), A$1 = /* @__PURE__ */ Symbol.for("lit-nothing"), C$1 = /* @__PURE__ */ new WeakMap(), P$1 = l$1.createTreeWalker(l$1, 129);
function V(t2, i3) {
if (!u$1(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array");
return void 0 !== e$4 ? e$4.createHTML(i3) : i3;
}
const N$1 = (t2, i3) => {
const s2 = t2.length - 1, e2 = [];
let n3, l2 = 2 === i3 ? "<svg>" : 3 === i3 ? "<math>" : "", c2 = v;
for (let i4 = 0; i4 < s2; i4++) {
const s3 = t2[i4];
let a2, u2, d2 = -1, f3 = 0;
for (; f3 < s3.length && (c2.lastIndex = f3, u2 = c2.exec(s3), null !== u2); ) f3 = c2.lastIndex, c2 === v ? "!--" === u2[1] ? c2 = _$1 : void 0 !== u2[1] ? c2 = m : void 0 !== u2[2] ? (y$2.test(u2[2]) && (n3 = RegExp("</" + u2[2], "g")), c2 = p$1) : void 0 !== u2[3] && (c2 = p$1) : c2 === p$1 ? ">" === u2[0] ? (c2 = n3 ?? v, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? p$1 : '"' === u2[3] ? $ : g) : c2 === $ || c2 === g ? c2 = p$1 : c2 === _$1 || c2 === m ? c2 = v : (c2 = p$1, n3 = void 0);
const x2 = c2 === p$1 && t2[i4 + 1].startsWith("/>") ? " " : "";
l2 += c2 === v ? s3 + r$8 : d2 >= 0 ? (e2.push(a2), s3.slice(0, d2) + h$4 + s3.slice(d2) + o$6 + x2) : s3 + o$6 + (-2 === d2 ? i4 : x2);
}
return [V(t2, l2 + (t2[s2] || "<?>") + (2 === i3 ? "</svg>" : 3 === i3 ? "</math>" : "")), e2];
};
let S$2 = class S {
constructor({ strings: t2, _$litType$: i3 }, e2) {
let r2;
this.parts = [];
let l2 = 0, a2 = 0;
const u2 = t2.length - 1, d2 = this.parts, [f3, v2] = N$1(t2, i3);
if (this.el = S.createElement(f3, e2), P$1.currentNode = this.el.content, 2 === i3 || 3 === i3) {
const t3 = this.el.content.firstChild;
t3.replaceWith(...t3.childNodes);
}
for (; null !== (r2 = P$1.nextNode()) && d2.length < u2; ) {
if (1 === r2.nodeType) {
if (r2.hasAttributes()) for (const t3 of r2.getAttributeNames()) if (t3.endsWith(h$4)) {
const i4 = v2[a2++], s2 = r2.getAttribute(t3).split(o$6), e3 = /([.?@])?(.*)/.exec(i4);
d2.push({ type: 1, index: l2, name: e3[2], strings: s2, ctor: "." === e3[1] ? I$1 : "?" === e3[1] ? L : "@" === e3[1] ? z : H$1 }), r2.removeAttribute(t3);
} else t3.startsWith(o$6) && (d2.push({ type: 6, index: l2 }), r2.removeAttribute(t3));
if (y$2.test(r2.tagName)) {
const t3 = r2.textContent.split(o$6), i4 = t3.length - 1;
if (i4 > 0) {
r2.textContent = s$4 ? s$4.emptyScript : "";
for (let s2 = 0; s2 < i4; s2++) r2.append(t3[s2], c$3()), P$1.nextNode(), d2.push({ type: 2, index: ++l2 });
r2.append(t3[i4], c$3());
}
}
} else if (8 === r2.nodeType) if (r2.data === n$6) d2.push({ type: 2, index: l2 });
else {
let t3 = -1;
for (; -1 !== (t3 = r2.data.indexOf(o$6, t3 + 1)); ) d2.push({ type: 7, index: l2 }), t3 += o$6.length - 1;
}
l2++;
}
}
static createElement(t2, i3) {
const s2 = l$1.createElement("template");
return s2.innerHTML = t2, s2;
}
};
function M(t2, i3, s2 = t2, e2) {
if (i3 === E$1) return i3;
let h3 = void 0 !== e2 ? s2._$Co?.[e2] : s2._$Cl;
const o2 = a$2(i3) ? void 0 : i3._$litDirective$;
return h3?.constructor !== o2 && (h3?._$AO?.(false), void 0 === o2 ? h3 = void 0 : (h3 = new o2(t2), h3._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ??= [])[e2] = h3 : s2._$Cl = h3), void 0 !== h3 && (i3 = M(t2, h3._$AS(t2, i3.values), h3, e2)), i3;
}
let R$1 = class R {
constructor(t2, i3) {
this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i3;
}
get parentNode() {
return this._$AM.parentNode;
}
get _$AU() {
return this._$AM._$AU;
}
u(t2) {
const { el: { content: i3 }, parts: s2 } = this._$AD, e2 = (t2?.creationScope ?? l$1).importNode(i3, true);
P$1.currentNode = e2;
let h3 = P$1.nextNode(), o2 = 0, n3 = 0, r2 = s2[0];
for (; void 0 !== r2; ) {
if (o2 === r2.index) {
let i4;
2 === r2.type ? i4 = new k(h3, h3.nextSibling, this, t2) : 1 === r2.type ? i4 = new r2.ctor(h3, r2.name, r2.strings, this, t2) : 6 === r2.type && (i4 = new Z(h3, this, t2)), this._$AV.push(i4), r2 = s2[++n3];
}
o2 !== r2?.index && (h3 = P$1.nextNode(), o2++);
}
return P$1.currentNode = l$1, e2;
}
p(t2) {
let i3 = 0;
for (const s2 of this._$AV) void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i3), i3 += s2.strings.length - 2) : s2._$AI(t2[i3])), i3++;
}
};
class k {
get _$AU() {
return this._$AM?._$AU ?? this._$Cv;
}
constructor(t2, i3, s2, e2) {
this.type = 2, this._$AH = A$1, this._$AN = void 0, this._$AA = t2, this._$AB = i3, this._$AM = s2, this.options = e2, this._$Cv = e2?.isConnected ?? true;
}
get parentNode() {
let t2 = this._$AA.parentNode;
const i3 = this._$AM;
return void 0 !== i3 && 11 === t2?.nodeType && (t2 = i3.parentNode), t2;
}
get startNode() {
return this._$AA;
}
get endNode() {
return this._$AB;
}
_$AI(t2, i3 = this) {
t2 = M(this, t2, i3), a$2(t2) ? t2 === A$1 || null == t2 || "" === t2 ? (this._$AH !== A$1 && this._$AR(), this._$AH = A$1) : t2 !== this._$AH && t2 !== E$1 && this._(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : d$1(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 !== A$1 && a$2(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(l$1.createTextNode(t2)), this._$AH = t2;
}
$(t2) {
const { values: i3, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = S$2.createElement(V(s2.h, s2.h[0]), this.options)), s2);
if (this._$AH?._$AD === e2) this._$AH.p(i3);
else {
const t3 = new R$1(e2, this), s3 = t3.u(this.options);
t3.p(i3), this.T(s3), this._$AH = t3;
}
}
_$AC(t2) {
let i3 = C$1.get(t2.strings);
return void 0 === i3 && C$1.set(t2.strings, i3 = new S$2(t2)), i3;
}
k(t2) {
u$1(this._$AH) || (this._$AH = [], this._$AR());
const i3 = this._$AH;
let s2, e2 = 0;
for (const h3 of t2) e2 === i3.length ? i3.push(s2 = new k(this.O(c$3()), this.O(c$3()), this, this.options)) : s2 = i3[e2], s2._$AI(h3), e2++;
e2 < i3.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i3.length = e2);
}
_$AR(t2 = this._$AA.nextSibling, s2) {
for (this._$AP?.(false, true, s2); t2 !== this._$AB; ) {
const s3 = i$4(t2).nextSibling;
i$4(t2).remove(), t2 = s3;
}
}
setConnected(t2) {
void 0 === this._$AM && (this._$Cv = t2, this._$AP?.(t2));
}
}
let H$1 = class H {
get tagName() {
return this.element.tagName;
}
get _$AU() {
return this._$AM._$AU;
}
constructor(t2, i3, s2, e2, h3) {
this.type = 1, this._$AH = A$1, this._$AN = void 0, this.element = t2, this.name = i3, this._$AM = e2, this.options = h3, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = A$1;
}
_$AI(t2, i3 = this, s2, e2) {
const h3 = this.strings;
let o2 = false;
if (void 0 === h3) t2 = M(this, t2, i3, 0), o2 = !a$2(t2) || t2 !== this._$AH && t2 !== E$1, o2 && (this._$AH = t2);
else {
const e3 = t2;
let n3, r2;
for (t2 = h3[0], n3 = 0; n3 < h3.length - 1; n3++) r2 = M(this, e3[s2 + n3], i3, n3), r2 === E$1 && (r2 = this._$AH[n3]), o2 ||= !a$2(r2) || r2 !== this._$AH[n3], r2 === A$1 ? t2 = A$1 : t2 !== A$1 && (t2 += (r2 ?? "") + h3[n3 + 1]), this._$AH[n3] = r2;
}
o2 && !e2 && this.j(t2);
}
j(t2) {
t2 === A$1 ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
}
};
let I$1 = class I extends H$1 {
constructor() {
super(...arguments), this.type = 3;
}
j(t2) {
this.element[this.name] = t2 === A$1 ? void 0 : t2;
}
};
class L extends H$1 {
constructor() {
super(...arguments), this.type = 4;
}
j(t2) {
this.element.toggleAttribute(this.name, !!t2 && t2 !== A$1);
}
}
class z extends H$1 {
constructor(t2, i3, s2, e2, h3) {
super(t2, i3, s2, e2, h3), this.type = 5;
}
_$AI(t2, i3 = this) {
if ((t2 = M(this, t2, i3, 0) ?? A$1) === E$1) return;
const s2 = this._$AH, e2 = t2 === A$1 && s2 !== A$1 || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h3 = t2 !== A$1 && (s2 === A$1 || e2);
e2 && this.element.removeEventListener(this.name, this, s2), h3 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
}
handleEvent(t2) {
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t2) : this._$AH.handleEvent(t2);
}
}
class Z {
constructor(t2, i3, s2) {
this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i3, this.options = s2;
}
get _$AU() {
return this._$AM._$AU;
}
_$AI(t2) {
M(this, t2);
}
}
const B$1 = t$2.litHtmlPolyfillSupport;
B$1?.(S$2, k), (t$2.litHtmlVersions ??= []).push("3.3.3");
const D$1 = (t2, i3, s2) => {
const e2 = s2?.renderBefore ?? i3;
let h3 = e2._$litPart$;
if (void 0 === h3) {
const t3 = s2?.renderBefore ?? null;
e2._$litPart$ = h3 = new k(i3.insertBefore(c$3(), t3), t3, void 0, s2 ?? {});
}
return h3._$AI(t2), h3;
};
const r$7 = (o2) => void 0 === o2.strings;
const s$3 = (i3, t2) => {
const e2 = i3._$AN;
if (void 0 === e2) return false;
for (const i4 of e2) i4._$AO?.(t2, false), s$3(i4, t2);
return true;
}, o$5 = (i3) => {
let t2, e2;
do {
if (void 0 === (t2 = i3._$AM)) break;
e2 = t2._$AN, e2.delete(i3), i3 = t2;
} while (0 === e2?.size);
}, r$6 = (i3) => {
for (let t2; t2 = i3._$AM; i3 = t2) {
let e2 = t2._$AN;
if (void 0 === e2) t2._$AN = e2 = /* @__PURE__ */ new Set();
else if (e2.has(i3)) break;
e2.add(i3), c$2(t2);
}
};
function h$3(i3) {
void 0 !== this._$AN ? (o$5(this), this._$AM = i3, r$6(this)) : this._$AM = i3;
}
function n$5(i3, t2 = false, e2 = 0) {
const r2 = this._$AH, h3 = this._$AN;
if (void 0 !== h3 && 0 !== h3.size) if (t2) if (Array.isArray(r2)) for (let i4 = e2; i4 < r2.length; i4++) s$3(r2[i4], false), o$5(r2[i4]);
else null != r2 && (s$3(r2, false), o$5(r2));
else s$3(this, i3);
}
const c$2 = (i3) => {
i3.type == t$3.CHILD && (i3._$AP ??= n$5, i3._$AQ ??= h$3);
};
let f$1 = class f extends i$5 {
constructor() {
super(...arguments), this._$AN = void 0;
}
_$AT(i3, t2, e2) {
super._$AT(i3, t2, e2), r$6(this), this.isConnected = i3._$AU;
}
_$AO(i3, t2 = true) {
i3 !== this.isConnected && (this.isConnected = i3, i3 ? this.reconnected?.() : this.disconnected?.()), t2 && (s$3(this, i3), o$5(this));
}
setValue(t2) {
if (r$7(this._$Ct)) this._$Ct._$AI(t2, this);
else {
const i3 = [...this._$Ct._$AH];
i3[this._$Ci] = t2, this._$Ct._$AI(i3, this, 0);
}
}
disconnected() {
}
reconnected() {
}
};
Signal.State;
Signal.Computed;
const r$5 = (l2, o2) => new Signal.State(l2, o2);
var A = async (t2, r2) => {
let e2 = typeof r2 == "function" ? await r2(t2) : r2;
if (e2) return t2.scheme === "bearer" ? `Bearer ${e2}` : t2.scheme === "basic" ? `Basic ${btoa(e2)}` : e2;
}, R2 = { bodySerializer: (t2) => JSON.stringify(t2, (r2, e2) => typeof e2 == "bigint" ? e2.toString() : e2) }, U = (t2) => {
switch (t2) {
case "label":
return ".";
case "matrix":
return ";";
case "simple":
return ",";
default:
return "&";
}
}, _ = (t2) => {
switch (t2) {
case "form":
return ",";
case "pipeDelimited":
return "|";
case "spaceDelimited":
return "%20";
default:
return ",";
}
}, D = (t2) => {
switch (t2) {
case "label":
return ".";
case "matrix":
return ";";
case "simple":
return ",";
default:
return "&";
}
}, O = ({ allowReserved: t2, explode: r2, name: e2, style: a2, value: i3 }) => {
if (!r2) {
let s2 = (t2 ? i3 : i3.map((l2) => encodeURIComponent(l2))).join(_(a2));
switch (a2) {
case "label":
return `.${s2}`;
case "matrix":
return `;${e2}=${s2}`;
case "simple":
return s2;
default:
return `${e2}=${s2}`;
}
}
let o2 = U(a2), n3 = i3.map((s2) => a2 === "label" || a2 === "simple" ? t2 ? s2 : encodeURIComponent(s2) : y$1({ allowReserved: t2, name: e2, value: s2 })).join(o2);
return a2 === "label" || a2 === "matrix" ? o2 + n3 : n3;
}, y$1 = ({ allowReserved: t2, name: r2, value: e2 }) => {
if (e2 == null) return "";
if (typeof e2 == "object") throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
return `${r2}=${t2 ? e2 : encodeURIComponent(e2)}`;
}, q = ({ allowReserved: t2, explode: r2, name: e2, style: a2, value: i3 }) => {
if (i3 instanceof Date) return `${e2}=${i3.toISOString()}`;
if (a2 !== "deepObject" && !r2) {
let s2 = [];
Object.entries(i3).forEach(([f3, u2]) => {
s2 = [...s2, f3, t2 ? u2 : encodeURIComponent(u2)];
});
let l2 = s2.join(",");
switch (a2) {
case "form":
return `${e2}=${l2}`;
case "label":
return `.${l2}`;
case "matrix":
return `;${e2}=${l2}`;
default:
return l2;
}
}
let o2 = D(a2), n3 = Object.entries(i3).map(([s2, l2]) => y$1({ allowReserved: t2, name: a2 === "deepObject" ? `${e2}[${s2}]` : s2, value: l2 })).join(o2);
return a2 === "label" || a2 === "matrix" ? o2 + n3 : n3;
};
var H2 = /\{[^{}]+\}/g, B = ({ path: t2, url: r2 }) => {
let e2 = r2, a2 = r2.match(H2);
if (a2) for (let i3 of a2) {
let o2 = false, n3 = i3.substring(1, i3.length - 1), s2 = "simple";
n3.endsWith("*") && (o2 = true, n3 = n3.substring(0, n3.length - 1)), n3.startsWith(".") ? (n3 = n3.substring(1), s2 = "label") : n3.startsWith(";") && (n3 = n3.substring(1), s2 = "matrix");
let l2 = t2[n3];
if (l2 == null) continue;
if (Array.isArray(l2)) {
e2 = e2.replace(i3, O({ explode: o2, name: n3, style: s2, value: l2 }));
continue;
}
if (typeof l2 == "object") {
e2 = e2.replace(i3, q({ explode: o2, name: n3, style: s2, value: l2 }));
continue;
}
if (s2 === "matrix") {
e2 = e2.replace(i3, `;${y$1({ name: n3, value: l2 })}`);
continue;
}
let f3 = encodeURIComponent(s2 === "label" ? `.${l2}` : l2);
e2 = e2.replace(i3, f3);
}
return e2;
}, E = ({ allowReserved: t2, array: r2, object: e2 } = {}) => (i3) => {
let o2 = [];
if (i3 && typeof i3 == "object") for (let n3 in i3) {
let s2 = i3[n3];
if (s2 != null) {
if (Array.isArray(s2)) {
o2 = [...o2, O({ allowReserved: t2, explode: true, name: n3, style: "form", value: s2, ...r2 })];
continue;
}
if (typeof s2 == "object") {
o2 = [...o2, q({ allowReserved: t2, explode: true, name: n3, style: "deepObject", value: s2, ...e2 })];
continue;
}
o2 = [...o2, y$1({ allowReserved: t2, name: n3, value: s2 })];
}
}
return o2.join("&");
}, P = (t2) => {
if (!t2) return "stream";
let r2 = t2.split(";")[0]?.trim();
if (r2) {
if (r2.startsWith("application/json") || r2.endsWith("+json")) return "json";
if (r2 === "multipart/form-data") return "formData";
if (["application/", "audio/", "image/", "video/"].some((e2) => r2.startsWith(e2))) return "blob";
if (r2.startsWith("text/")) return "text";
}
}, I2 = async ({ security: t2, ...r2 }) => {
for (let e2 of t2) {
let a2 = await A(e2, r2.auth);
if (!a2) continue;
let i3 = e2.name ?? "Authorization";
switch (e2.in) {
case "query":
r2.query || (r2.query = {}), r2.query[i3] = a2;
break;
case "cookie":
r2.headers.append("Cookie", `${i3}=${a2}`);
break;
case "header":
default:
r2.headers.set(i3, a2);
break;
}
return;
}
}, S$1 = (t2) => W({ baseUrl: t2.baseUrl, path: t2.path, query: t2.query, querySerializer: typeof t2.querySerializer == "function" ? t2.querySerializer : E(t2.querySerializer), url: t2.url }), W = ({ baseUrl: t2, path: r2, query: e2, querySerializer: a2, url: i3 }) => {
let o2 = i3.startsWith("/") ? i3 : `/${i3}`, n3 = (t2 ?? "") + o2;
r2 && (n3 = B({ path: r2, url: n3 }));
let s2 = e2 ? a2(e2) : "";
return s2.startsWith("?") && (s2 = s2.substring(1)), s2 && (n3 += `?${s2}`), n3;
}, C = (t2, r2) => {
let e2 = { ...t2, ...r2 };
return e2.baseUrl?.endsWith("/") && (e2.baseUrl = e2.baseUrl.substring(0, e2.baseUrl.length - 1)), e2.headers = x(t2.headers, r2.headers), e2;
}, x = (...t2) => {
let r2 = new Headers();
for (let e2 of t2) {
if (!e2 || typeof e2 != "object") continue;
let a2 = e2 instanceof Headers ? e2.entries() : Object.entries(e2);
for (let [i3, o2] of a2) if (o2 === null) r2.delete(i3);
else if (Array.isArray(o2)) for (let n3 of o2) r2.append(i3, n3);
else o2 !== void 0 && r2.set(i3, typeof o2 == "object" ? JSON.stringify(o2) : o2);
}
return r2;
}, h$2 = class h {
_fns;
constructor() {
this._fns = [];
}
clear() {
this._fns = [];
}
exists(r2) {
return this._fns.indexOf(r2) !== -1;
}
eject(r2) {
let e2 = this._fns.indexOf(r2);
e2 !== -1 && (this._fns = [...this._fns.slice(0, e2), ...this._fns.slice(e2 + 1)]);
}
use(r2) {
this._fns = [...this._fns, r2];
}
}, T = () => ({ error: new h$2(), request: new h$2(), response: new h$2() }), N = E({ allowReserved: false, array: { explode: true, style: "form" }, object: { explode: true, style: "deepObject" } }), Q = { "Content-Type": "application/json" }, w = (t2 = {}) => ({ ...R2, headers: Q, parseAs: "auto", querySerializer: N, ...t2 });
var J = (t2 = {}) => {
let r2 = C(w(), t2), e2 = () => ({ ...r2 }), a2 = (n3) => (r2 = C(r2, n3), e2()), i3 = T(), o2 = async (n3) => {
let s2 = { ...r2, ...n3, fetch: n3.fetch ?? r2.fetch ?? globalThis.fetch, headers: x(r2.headers, n3.headers) };
s2.security && await I2({ ...s2, security: s2.security }), s2.body && s2.bodySerializer && (s2.body = s2.bodySerializer(s2.body)), (s2.body === void 0 || s2.body === "") && s2.headers.delete("Content-Type");
let l2 = S$1(s2), f3 = { redirect: "follow", ...s2 }, u2 = new Request(l2, f3);
for (let p2 of i3.request._fns) u2 = await p2(u2, s2);
let k2 = s2.fetch, c2 = await k2(u2);
for (let p2 of i3.response._fns) c2 = await p2(c2, u2, s2);
let m2 = { request: u2, response: c2 };
if (c2.ok) {
if (c2.status === 204 || c2.headers.get("Content-Length") === "0") return { data: {}, ...m2 };
let p2 = (s2.parseAs === "auto" ? P(c2.headers.get("Content-Type")) : s2.parseAs) ?? "json";
if (p2 === "stream") return { data: c2.body, ...m2 };
let b2 = await c2[p2]();
return p2 === "json" && (s2.responseValidator && await s2.responseValidator(b2), s2.responseTransformer && (b2 = await s2.responseTransformer(b2))), { data: b2, ...m2 };
}
let g2 = await c2.text();
try {
g2 = JSON.parse(g2);
} catch {
}
let d2 = g2;
for (let p2 of i3.error._fns) d2 = await p2(g2, c2, u2, s2);
if (d2 = d2 || {}, s2.throwOnError) throw d2;
return { error: d2, ...m2 };
};
return { buildUrl: S$1, connect: (n3) => o2({ ...n3, method: "CONNECT" }), delete: (n3) => o2({ ...n3, method: "DELETE" }), get: (n3) => o2({ ...n3, method: "GET" }), getConfig: e2, head: (n3) => o2({ ...n3, method: "HEAD" }), interceptors: i3, options: (n3) => o2({ ...n3, method: "OPTIONS" }), patch: (n3) => o2({ ...n3, method: "PATCH" }), post: (n3) => o2({ ...n3, method: "POST" }), put: (n3) => o2({ ...n3, method: "PUT" }), request: o2, setConfig: a2, trace: (n3) => o2({ ...n3, method: "TRACE" }) };
};
const client = J(w({
baseUrl: "https://api-dev.claudebernard.fr/search"
}));
const search3 = (options) => {
return (options.client ?? client).post({
url: "/search/",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
};
const PREFIX = "claudebernard";
const numberOfResults = 50;
const allTrueCategories = {
products: true,
speciality: true,
brands: true,
ranges: true,
genericGroups: true,
genericAccessoriesGroups: true,
biosimilarGroups: true,
companies: true,
commonNames: true,
molecules: true,
indications: true,
segments: true,
atcclass: true,
bcbclass: true,
sideEffects: true,
universes: true,
hybridGroups: true
};
const allFalseCategories = {
products: false,
speciality: false,
brands: false,
ranges: false,
genericGroups: false,
genericAccessoriesGroups: false,
biosimilarGroups: false,
companies: false,
commonNames: false,
molecules: false,
indications: false,
segments: false,
atcclass: false,
bcbclass: false,
sideEffects: false,
universes: false,
hybridGroups: false
};
const defaultFilters = {
dopingProducts: true,
deletedProducts: false,
hospitalProducts: true,
homeoProducts: true,
dermatoProducts: true,
dieteticProducts: true,
horsAmmProducts: true,
veterinarProducts: true,
medicalDevicesProducts: true,
genericProducts: true,
accessoriesProducts: true,
genericAccessoriesProducts: true,
specialityProducts: false,
biosimilarsProducts: true
};
const defaultOptions = {
patientPriorityResult: false,
prescriptionPriorityResult: false,
typeOfProducts: 0,
internal: false,
withFieldFilters: true,
withPrecautionsForUse: true,
maxMonthsDeletedProducts: 0,
facilityCode: 0
};
const defaultRequestBody = {
pageNumber: 0,
pageSize: numberOfResults,
filters: { ...defaultFilters },
categories: { ...allTrueCategories },
options: { ...defaultOptions },
order: { field: "libelleLong", order: "asc" }
};
var ECategories = /* @__PURE__ */ ((ECategories2) => {
ECategories2["allCategories"] = "AllCategories";
ECategories2["products"] = "Products";
ECategories2["companies"] = "Companies";
ECategories2["molecules"] = "Molecules";
ECategories2["indications"] = "Indications";
ECategories2["atcclass"] = "Atcclass";
ECategories2["commonNames"] = "CommonNames";
ECategories2["genericAccessoriesGroups"] = "GenericAccessoriesGroups";
return ECategories2;
})(ECategories || {});
const typeCategoriesLabelMappings = {
[ECategories.products]: ["Dermo–cosmétique", "Diététique", "Accessoires", "Présentation", "Présentation Hosp", "Specialite"],
[ECategories.companies]: ["Laboratoire"],
[ECategories.molecules]: ["Composants"],
[ECategories.indications]: ["Indications"],
[ECategories.atcclass]: ["Classe ATC"],
[ECategories.commonNames]: ["MV DC"],
[ECategories.genericAccessoriesGroups]: ["Accessoire générique"]
};
const typeLabelMappings = {
1: "Med.",
2: "Gé.",
3: "Acc.Gé",
4: "Véto.",
5: "Diét.",
6: "Derm.",
7: "Acc.",
8: "Hors AMM",
9: "Segm.",
10: "Indic.",
11: "Effet.",
12: "Gamme",
13: "Marq.",
14: "Labo.",
15: "Comp.",
16: "DC",
17: "Spec.",
18: "UCD",
19: "Patho.",
20: "Biosim.",
21: "C.ATC",
22: "C.BCB",
23: "Univ.",
24: "Groupe Hybride"
};
const sourceLocale = `en`;
const targetLocales = [`fr-FR`];
const highlightSignal = r$5(false);
const autoFocusSignal = r$5(false);
const userInputSignal = r$5("");
const loadingSignal = r$5(false);
function random(len) {
return crypto.getRandomValues(new Uint8Array(len));
}
for (var r$4 = 256, s$2 = []; r$4--; ) s$2[r$4] = (r$4 + 256).toString(16).substring(1);
var i$3 = (t2) => {
let r2 = 0, i3 = "";
for (; r2 < t2.length; r2++) i3 += s$2[t2[r2]];
return i3;
}, n$4 = (r2, s2, e2, a2) => ({ version: r2, trace_id: s2, parent_id: e2, flags: a2, child(r3) {
return n$4(this.version, this.trace_id, i$3(random(8)), void 0 === r3 ? this.flags : r3 ? 1 | this.flags : -2 & this.flags);
}, toString() {
let t2 = this.flags.toString(16).padStart(2, "0");
return `${this.version}-${this.trace_id}-${this.parent_id}-${t2}`;
} });
function a$1(r2 = true) {
let s2 = random(24);
return n$4("00", i$3(s2.slice(0, 16)), i$3(s2.slice(16, 24)), r2 ? 1 : 0);
}
function makeTraceState(state) {
return Object.entries(state).map((entry) => `${entry[0]}=${entry[1]}`).join(",");
}
function defaultTraceState() {
return makeTraceState({
"client-type": "web-component",
"web-component-package": "@claudebernard/search-bar-element",
"web-component-version": "1.10"
});
}
function makeTraceParent(sampled) {
return a$1(sampled);
}
const getSearchRequestCategoryParamByCategory = (category) => {
swi