v-dashkit
Version:
This template should help get you started developing with Vue 3 in Vite.
1,287 lines • 118 kB
JavaScript
var Ne = Object.defineProperty;
var Ue = (e, t, n) => t in e ? Ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var A = (e, t, n) => (Ue(e, typeof t != "symbol" ? t + "" : t, n), n);
import { createInput as X, plugin as Ge, defaultConfig as Be } from "@formkit/vue";
import { defineComponent as H, openBlock as p, createBlock as V, resolveDynamicComponent as N, h as g, createElementBlock as b, createElementVNode as I, resolveComponent as G, Fragment as j, renderList as ee, normalizeStyle as Y, toDisplayString as P, unref as B, ref as K, inject as me, withAsyncContext as ue, watch as He, withCtx as U, createVNode as E, computed as je, withDirectives as de, vShow as ze, createCommentVNode as M, normalizeClass as W, mergeProps as v, resolveDirective as qe, renderSlot as D, createTextVNode as ie, withModifiers as ve, Transition as Ze, createSlots as Qe, normalizeProps as We, guardReactiveProps as Je, useSlots as Ve, onMounted as Xe } from "vue";
import { d as Ye, a as be, O as et, e as tt, f as nt, g as it, c as st, h as ot, i as lt, j as $e } from "../TableLoading.vue_vue_type_style_index_0_lang-ab8481ef.js";
import { _ as te } from "../AppIcon.vue_vue_type_script_setup_true_lang-b22091f5.js";
import { _ as Fe } from "../DataList.vue_vue_type_style_index_0_lang-4d2f6120.js";
import { RouterLink as rt, useRouter as at, useRoute as ct } from "vue-router";
import { _ as ut, s as dt } from "../AppImage.vue_vue_type_style_index_0_lang-a95cef58.js";
import { FormateCurrency as _e, UnitSellShift as pt, UnitParseWholeQty as ht } from "./utils/currency/currency.js";
import { useI18n as ae, createI18n as ft } from "vue-i18n";
import { u as Te, d as pe, P as mt } from "../theme-64767209.js";
import { a as yt, u as vt } from "../AppForm.vue_vue_type_style_index_0_lang-0ee8a63a.js";
import { _ as bt, D as ge } from "../DataList.vue_vue_type_script_setup_true_lang-b847d2ac.js";
import { _ as Oe } from "../AppPanel.vue_vue_type_script_setup_true_lang-6f7148d4.js";
import "../AppPanel.vue_vue_type_style_index_0_scope_true_deep_true_lang-c245c0a9.js";
import { TableHeaderText as gt, TableHeaderHidden as Ot } from "./utils/table/TableHeader.js";
import { u as It } from "../dialog-4153ffff.js";
import { ObjectKeys as ye } from "./utils/object/object.js";
import "../InputUnitQty.vue_vue_type_style_index_0_lang-4ed993c7.js";
import { s as St } from "../skeleton.esm-d22776ea.js";
import { a as xt } from "../api.esm-bda24f57.js";
import { s as wt, a as kt } from "../portal.esm-1269e141.js";
import { s as Ct } from "../basedirective.esm-f0eabb7b.js";
import { R as Lt } from "../index.esm-4f9ffa3c.js";
import { U as Vt, Z as ce, O as C, D as T, C as $t } from "../utils.esm-8765b9e6.js";
import { B as Ft, s as _t } from "../basecomponent.esm-3611fa56.js";
import { createPinia as Tt } from "pinia";
import "../query-edffae38.js";
import "../tag.esm-c852367d.js";
import "./utils/date/date.js";
const le = /* @__PURE__ */ H({
__name: "AppBtn",
props: {
label: {},
icon: {},
loading: { type: Boolean },
iconColor: {},
iconType: {},
disabled: { type: Boolean }
},
setup(e) {
const t = e, n = () => {
const i = t.iconType == "primevue";
return g(Ye, {
label: t.label,
disabled: t.disabled,
loading: t.loading,
icon: i ? `pi pi-${t.icon}` : void 0
}, {
icon: () => i ? void 0 : g(te, { icon: t.icon, color: t.iconColor })
});
};
return (i, o) => (p(), V(N(n), { class: "app-btn" }));
}
}), Pt = {}, Kt = {
xmlns: "http://www.w3.org/2000/svg",
width: "211",
height: "54",
fill: "none"
}, At = /* @__PURE__ */ I("path", {
fill: "#fff",
d: "M15.307 41.933c-1.803 0-3.382-.306-4.738-.918-1.355-.612-2.34-1.466-2.954-2.562v11.014H2.091v-29.37h5.294l.23 3.155c1.177-2.32 3.74-3.48 7.692-3.48 1.42 0 2.75.28 3.99.841a9.738 9.738 0 0 1 3.242 2.276c.92.956 1.643 2.129 2.168 3.518.537 1.377.805 2.862.805 4.455 0 1.594-.268 3.085-.805 4.474-.525 1.377-1.247 2.544-2.168 3.5a10.116 10.116 0 0 1-3.242 2.275 9.759 9.759 0 0 1-3.99.822Zm-1.496-17.476c-1.726 0-3.19.605-4.393 1.816-1.202 1.198-1.803 2.728-1.803 4.59 0 1.86.595 3.396 1.784 4.607 1.202 1.199 2.673 1.798 4.412 1.798 1.726 0 3.178-.6 4.355-1.798 1.189-1.21 1.783-2.747 1.783-4.608 0-1.848-.594-3.378-1.784-4.589-1.189-1.21-2.64-1.816-4.354-1.816Zm26.471-4.685c1.714 0 3.3.3 4.758.899 1.47.599 2.717 1.447 3.74 2.543 1.036 1.083 1.822 2.435 2.36 4.054.536 1.606.748 3.377.633 5.315H34.298c.332 1.517 1.048 2.728 2.148 3.633 1.1.905 2.379 1.358 3.836 1.358 1.267 0 2.385-.32 3.357-.956.985-.65 1.746-1.556 2.283-2.716l4.738 2.257c-.972 1.797-2.391 3.212-4.258 4.244-1.868 1.02-3.907 1.53-6.12 1.53-2.122 0-4.066-.44-5.83-1.32-1.753-.879-3.166-2.166-4.24-3.862-1.074-1.708-1.611-3.67-1.611-5.889 0-2.218.537-4.18 1.61-5.889 1.075-1.708 2.488-3.002 4.24-3.881 1.765-.88 3.709-1.32 5.831-1.32Zm0 4.379c-1.534 0-2.845.452-3.932 1.357-1.074.893-1.758 2.104-2.052 3.633h11.988c-.306-1.53-.997-2.74-2.071-3.633-1.075-.905-2.385-1.357-3.933-1.357Zm24.822-4.379c1.803 0 3.376.306 4.719.918 1.356.612 2.347 1.466 2.973 2.562l.25-3.155h5.275v21.53h-5.275l-.25-3.174c-1.176 2.32-3.74 3.48-7.692 3.48a9.891 9.891 0 0 1-4.009-.822 10.174 10.174 0 0 1-3.222-2.275c-.909-.956-1.631-2.123-2.168-3.5-.524-1.389-.786-2.88-.786-4.474 0-1.593.262-3.078.786-4.455.537-1.39 1.26-2.562 2.168-3.518a9.789 9.789 0 0 1 3.222-2.276 9.7 9.7 0 0 1 4.01-.84ZM66.6 37.268c1.74 0 3.204-.6 4.393-1.798 1.202-1.21 1.803-2.747 1.803-4.608 0-1.874-.601-3.41-1.803-4.608-1.19-1.198-2.654-1.797-4.393-1.797-1.726 0-3.184.599-4.373 1.797-1.177 1.198-1.765 2.734-1.765 4.608 0 1.849.595 3.378 1.784 4.59 1.19 1.21 2.64 1.816 4.354 1.816Zm37.424-17.17-8.555 9.062 8.555 12.467h-6.253l-5.908-8.642-3.05 3.23v5.412H83.27v-29.37h5.543v16.98l8.575-9.14h6.636Zm12.197-1.622c2.325 0 4.385.529 6.2 1.606 1.814 1.077 3.119 2.52 3.914 4.309V10.407h2.366v31.22h-2.284l-.082-5.67c-.774 1.87-2.059 3.312-3.853 4.349-1.815 1.037-3.895 1.565-6.261 1.565-2.08 0-3.996-.508-5.729-1.545a10.872 10.872 0 0 1-4.14-4.228c-1.019-1.788-1.529-3.76-1.529-5.914 0-2.155.51-4.127 1.529-5.936a11.151 11.151 0 0 1 4.14-4.227c1.733-1.037 3.649-1.545 5.729-1.545Zm.531 21.322c2.65 0 4.914-.935 6.79-2.805 1.856-1.87 2.793-4.147 2.793-6.81 0-2.703-.937-4.98-2.814-6.85-1.876-1.849-4.139-2.784-6.769-2.784-5.139-.122-9.645 4.37-9.543 9.635-.102 5.264 4.404 9.736 9.543 9.614Zm20.064-25.245c-.958 0-1.672-.711-1.672-1.667 0-.894.714-1.626 1.672-1.626.898 0 1.632.732 1.632 1.627 0 .955-.734 1.666-1.632 1.666Zm-1.203 27.074V18.74h2.366v22.887h-2.366Zm29.098-17.236.082-5.65h2.284v21.077c0 3.496-1.285 6.26-3.467 7.907-2.181 1.626-5.016 2.48-8.38 2.48-3.977 0-7.545-1.688-9.85-4.553l1.387-1.444c2.141 2.622 4.894 3.923 8.299 3.903 2.712 0 5.017-.65 6.811-1.951 1.774-1.301 2.834-3.557 2.834-6.423v-3.78c-.795 1.87-2.08 3.312-3.874 4.349-1.794 1.037-3.874 1.565-6.24 1.565-2.08 0-3.996-.508-5.729-1.545a10.872 10.872 0 0 1-4.14-4.228c-1.019-1.788-1.529-3.76-1.529-5.914 0-2.155.51-4.127 1.529-5.936a11.151 11.151 0 0 1 4.14-4.227c1.733-1.037 3.649-1.545 5.729-1.545 2.325 0 4.385.529 6.2 1.606 1.794 1.077 3.099 2.52 3.914 4.309Zm-9.583 15.407c2.65 0 4.914-.935 6.79-2.805 1.856-1.87 2.793-4.147 2.793-6.83 0-2.662-.937-4.939-2.813-6.809-1.876-1.87-4.14-2.805-6.77-2.805-5.139-.122-9.645 4.37-9.544 9.635-.101 5.264 4.405 9.736 9.544 9.614Zm19.738-25.245c-.959 0-1.672-.711-1.672-1.667 0-.894.713-1.626 1.672-1.626.898 0 1.631.732 1.631 1.627 0 .955-.733 1.666-1.631 1.666Zm-1.203 27.074V18.74h2.365v22.887h-2.365Zm11.746-22.887v-5.284h2.365v5.284h6.667v1.931h-6.667V35.53c0 2.765.835 4.126 3.12 4.208 1.244.081 2.426-.02 3.547-.325v2.032c-1.325.264-2.61.407-3.813.407-3.813 0-5.219-2.053-5.219-6.281v-14.9h-3.752v-1.93h3.752Z"
}, null, -1), Dt = [
At
];
function Mt(e, t) {
return p(), b("svg", Kt, Dt);
}
const Et = /* @__PURE__ */ Fe(Pt, [["render", Mt]]), Rt = {}, Nt = {
xmlns: "http://www.w3.org/2000/svg",
width: "48",
height: "40",
fill: "none"
}, Ut = /* @__PURE__ */ I("path", {
fill: "#fff",
d: "M12.987 32.263c-1.648 0-3.09-.28-4.33-.84-1.238-.562-2.138-1.344-2.699-2.349v10.093H.911V12.252h4.837l.21 2.891c1.075-2.126 3.418-3.189 7.03-3.189 1.296 0 2.511.257 3.645.771a8.898 8.898 0 0 1 2.962 2.085c.841.877 1.502 1.951 1.98 3.225.491 1.261.737 2.622.737 4.082s-.246 2.828-.736 4.101c-.48 1.262-1.14 2.33-1.981 3.207a9.244 9.244 0 0 1-2.962 2.085 8.895 8.895 0 0 1-3.646.753ZM11.62 16.247c-1.578 0-2.916.555-4.014 1.665-1.098 1.098-1.648 2.5-1.648 4.206 0 1.705.544 3.113 1.63 4.223 1.099 1.098 2.443 1.647 4.032 1.647 1.577 0 2.904-.55 3.979-1.647 1.086-1.11 1.63-2.518 1.63-4.224 0-1.693-.544-3.095-1.63-4.205-1.087-1.11-2.413-1.665-3.98-1.665Z"
}, null, -1), Gt = /* @__PURE__ */ I("path", {
fill: "#fff",
d: "M24.219 10.932c2.124 0 4.006.485 5.664 1.472 1.658.987 2.85 2.31 3.577 3.949V3.537h2.162V32.15h-2.087l-.075-5.197c-.708 1.714-1.882 3.036-3.521 3.986-1.658.95-3.559 1.434-5.72 1.434-1.9 0-3.652-.465-5.236-1.415a9.952 9.952 0 0 1-3.782-3.875c-.932-1.639-1.398-3.446-1.398-5.42 0-1.975.466-3.782 1.398-5.44a10.207 10.207 0 0 1 3.782-3.874c1.584-.95 3.335-1.416 5.236-1.416Zm.484 19.54c2.422 0 4.49-.857 6.205-2.57 1.695-1.714 2.552-3.8 2.552-6.24 0-2.478-.857-4.564-2.571-6.278-1.714-1.695-3.782-2.552-6.186-2.552-4.695-.111-8.813 4.005-8.72 8.83-.093 4.824 4.025 8.922 8.72 8.81ZM41.471.751a3.773 3.773 0 0 1 1.927-.512c.695 0 1.337.17 1.932.512.59.347 1.055.813 1.403 1.402.341.595.512 1.237.512 1.932a3.897 3.897 0 0 1-1.12 2.721 3.91 3.91 0 0 1-2.727 1.13c-.695 0-1.338-.17-1.927-.517a3.753 3.753 0 0 1-1.396-1.402 3.726 3.726 0 0 1-.518-1.932c0-.695.17-1.337.518-1.932A3.84 3.84 0 0 1 41.471.75Zm1.927 6.68c.913 0 1.767-.384 2.363-.978.595-.595.977-1.461.977-2.368a3.38 3.38 0 0 0-.977-2.362 3.371 3.371 0 0 0-2.363-.978c-.902 0-1.768.383-2.357.978a3.38 3.38 0 0 0-.978 2.362c0 .907.383 1.773.978 2.368.59.594 1.456.977 2.357.977Zm1.732-3.959c0 .642-.342 1.155-.948 1.36l.86 1.385h-.843l-.783-1.278h-.866v1.278h-.825V1.994h1.797c.495 0 .89.135 1.178.412.289.277.43.63.43 1.066Zm-2.58.795h.895a.835.835 0 0 0 .613-.241.754.754 0 0 0 .236-.554.77.77 0 0 0-.236-.565.826.826 0 0 0-.613-.242h-.895v1.602Z"
}, null, -1), Bt = [
Ut,
Gt
];
function Ht(e, t) {
return p(), b("svg", Nt, Bt);
}
const jt = /* @__PURE__ */ Fe(Rt, [["render", Ht]]), zt = /* @__PURE__ */ H({
__name: "AppLogo",
props: {
disabled: { type: Boolean },
iconOnly: { type: Boolean }
},
setup(e) {
const t = e, n = () => {
const i = t.iconOnly ? "LogoIcon" : "Logo", o = G(i);
return t.disabled ? g(o) : g(
rt,
{
to: { name: "home_view" }
},
{
default: () => g(o)
}
);
};
return (i, o) => (p(), V(N(n), { class: "logo-container" }));
}
});
const qt = { class: "unit-qty-price" }, Zt = { class: "top" }, Qt = { class: "bottom" }, Wt = /* @__PURE__ */ H({
__name: "UnitPrice",
props: {
headers: {}
},
setup(e) {
const t = e;
return (n, i) => (p(), b("div", qt, [
I("div", Zt, [
(p(!0), b(j, null, ee(t.headers, (o, s) => (p(), b("div", {
class: "header",
key: s,
style: Y(`background: ${o.background}`)
}, P(n.$t(o.label)), 5))), 128))
]),
I("div", Qt, [
(p(!0), b(j, null, ee(t.headers, (o, s) => (p(), b("div", {
class: "header",
key: s,
style: Y(`background: ${o.background}`)
}, P(B(_e)(o.value, n.$t("currency"))), 5))), 128))
])
]));
}
});
const Jt = /* @__PURE__ */ H({
__name: "UnitHeader",
props: {
class: {},
headers: {}
},
setup(e) {
const t = e, { t: n } = ae(), i = () => {
if (t.headers.length == 0)
return;
const o = [], s = [];
return t.headers.forEach((l) => {
o.push(g("div", { style: `background: ${l.background}` }, n(l.label))), s.push(g("div", { style: `background: ${l.background}` }, l.is_currency ? _e(l.value, n("currency")) : l.value));
}), g("div", { class: `unit-header ${t.class}` }, [
g("div", { class: "top" }, o),
g("div", { class: "bottom" }, s)
]);
};
return (o, s) => (p(), V(N(i)));
}
});
const Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
AppBtn: le,
AppIcon: te,
AppImage: ut,
AppLogo: zt,
Logo: Et,
LogoIcon: jt,
UnitHeader: Jt,
UnitPrice: Wt
}, Symbol.toStringTag, { value: "Module" })), Xt = { class: "permission-group grid" }, Yt = (e, t) => new Promise(async (n) => {
const i = {}, o = {}, s = [], l = [];
e.forEach((a) => {
const u = [], m = [];
for (let c = 0; c < a.permissions.length; c++) {
const d = a.permissions[c];
u.push({
$formkit: "toggle",
label: d.permissionName,
trueValue: d.permissionId
}), t && t.includes(d.permissionId) ? m.push(d.permissionId) : m.push(void 0);
}
const h = {
permissionGroup: a.permissionGroup,
permissions: a.permissions,
searchPermissions: JSON.stringify(a.permissions)
};
m.filter((c) => c).length == a.permissions.length && s.push(h), l.push(h), i[a.permissionGroup] = [
{
$formkit: "list",
children: [
{
$el: "div",
attrs: {
class: "grid"
},
children: u
}
]
}
], o[a.permissionGroup] = m;
}), n({ schema: i, modelValues: o, searchablePermission: l, initiallySelectedItems: s });
}), en = /* @__PURE__ */ H({
__name: "InputPermissions",
props: {
context: {}
},
async setup(e) {
let t, n;
const i = Te(), o = It();
i.startProgressBar();
const s = e, l = K(!1), a = K(!1), u = me("permissionsHandler"), { records: m } = ([t, n] = ue(() => u.permissionsListAllEndpoint({})), t = await t, n(), t), { modelValues: h, initiallySelectedItems: f, searchablePermission: c } = ([t, n] = ue(() => Yt(m, s.context.node._value)), t = await t, n(), t), d = K(h);
i.stopProgressBar();
const w = {
permissionGroup: new gt("permissionGroup", {
sortable: !0,
isGlobalFilter: !0
}),
searchPermissions: new Ot("searchPermissions", {
sortable: !0,
isGlobalFilter: !0
})
}, _ = {
context: {
title: "permissions",
dataKey: "permissionGroup",
records: c,
initiallySelectedItems: f,
displayType: "table",
options: {
title: "permissions",
description: "permissions_description"
},
headers: w
}
}, $ = () => {
const y = ye(d.value), O = [];
for (const x of y)
d.value[x].forEach((L) => {
L && O.push(L);
});
s.context.node.input(O);
}, ne = (y, O) => {
if (l.value)
return;
if (a.value = !0, d.value[O.permissionGroup] = y, y.filter((k) => k).length == O.permissions.length)
o.modelSelectionRef.push(O);
else {
const k = o.modelSelectionRef.indexOf(O);
if (k !== -1)
if (!o.isAllRecordsSelected)
o.modelSelectionRef.splice(k, 1);
else {
const L = o.modelSelectionRef.filter((Z) => Z != O);
o.modelSelectionRef = L;
}
}
$(), setTimeout(() => a.value = !1, 100);
}, z = K([]);
He(z, async (y, O) => {
if (o.isAllRecordsSelected) {
y.forEach((x) => {
const k = [];
x.permissions.forEach((L) => {
k.push(L.permissionId);
}), d.value[x.permissionGroup] = k;
}), $();
return;
}
y.length > O.length ? (console.log("attaching pemissions"), y.forEach((x) => {
const k = [];
x.permissions.forEach((L) => {
k.push(L.permissionId);
}), d.value[x.permissionGroup] = k;
})) : O.filter((k) => !y.includes(k)).forEach((k) => {
d.value[k.permissionGroup] = [];
}), $();
});
const S = K(), F = (y) => {
a.value || (l.value = !0, console.log("selection val", y), z.value = y, setTimeout(() => l.value = !1, 100));
}, R = "", q = (y) => {
console.log(Object.keys(S.value)), o.tableFiltersRef && (o.tableFiltersRef.global.value = y || null, console.log("global search", y));
};
return (y, O) => {
const x = G("FormKit"), k = G("form-kit");
return p(), V(Oe, {
class: "input-permissions",
header: "Permissions",
icon: "shield",
toggleable: s.context.toggleable,
collapsed: s.context.toggleable && s.context.inputCollapsed
}, {
headerEnd: U(() => [
E(x, {
type: "text",
placeholder: y.$t("search"),
outerClass: "global-search",
value: R,
prefixIcon: "search",
onInput: q
}, null, 8, ["placeholder"])
]),
default: U(() => [
E(bt, {
ref_key: "dataListElementRef",
ref: S,
"onUpdate:selection": F,
class: "sm-column",
context: _.context
}, {
default: U(() => [
E(B(be), {
style: { width: "100%" },
header: "permissionGroup",
field: "permissionGroup"
}, {
body: U(({ data: L }) => [
E(Oe, {
collapsed: s.context.groupCollapsed,
class: "permission-group-panel",
header: y.$t(L.permissionGroup),
toggleable: ""
}, {
default: U(() => [
I("div", Xt, [
E(k, {
id: L.permissionGroup,
modelValue: d.value[L.permissionGroup],
"onUpdate:modelValue": (Z) => d.value[L.permissionGroup] = Z,
onInput: (Z) => ne(Z, L),
type: "list",
name: L.permissionGroup
}, {
default: U(() => [
(p(!0), b(j, null, ee(L.permissions, (Z, Re) => (p(), V(k, {
label: y.$t(Z.permissionName),
onValue: Z.permissionId,
key: Re,
type: "toggle",
onInput: (si) => null
}, null, 8, ["label", "onValue"]))), 128))
]),
_: 2
}, 1032, ["id", "modelValue", "onUpdate:modelValue", "onInput", "name"])
])
]),
_: 2
}, 1032, ["collapsed", "header"])
]),
_: 1
}),
E(B(be), {
colspan: 0,
selectionMode: "multiple",
class: "select-all"
})
]),
_: 1
}, 8, ["context"])
]),
_: 1
}, 8, ["toggleable", "collapsed"]);
};
}
}), tn = {
key: 0,
class: "no-image"
}, nn = { class: "upload w-full" }, sn = ["multiple"], on = /* @__PURE__ */ H({
__name: "InputImage",
props: {
context: {}
},
setup(e) {
const t = e, n = yt(), i = K(), o = vt(), s = me("uploadHandler"), l = t.context.bucketName ? t.context.bucketName : "images", a = dt(t.context.size), u = je(() => t.context._value ? t.context._value.split(",") : []), m = async (h) => {
i.value = h.target.files, n.isUploading = !0;
let f = "";
const c = h.target.files.length;
if (console.log("filesLength", c), c == 1) {
const d = h.target.files[0];
await s.uploadEndpoint(d, l).then((w) => {
f = `,${w}`, console.log("uploadeddddd", w);
}).catch((w) => {
o.showError("upload_error", w.message), console.log(w, "error");
}).finally(() => {
console.log("from finally"), setTimeout(() => n.isUploading = !1, 50);
});
}
if (c > 1)
for (let d = 0; d < h.target.files.length; d++) {
const w = h.target.files[d];
await s.uploadEndpoint(w, l).then((_) => {
f = `${f},${_}`;
}).catch((_) => {
o.showError("upload_error", _.message), console.log(_, "error");
}).finally(() => {
setTimeout(() => n.isUploading = !1, 50);
});
}
setTimeout(() => n.isUploading = !1, 50), t.context.node._value = f.substring(1), t.context.node.input(t.context.node._value);
};
return (h, f) => {
const c = G("app-image");
return p(), b("div", {
class: "img-input",
style: Y(B(a))
}, [
de(E(B(St), {
style: Y(B(a)),
class: "mr-2"
}, null, 8, ["style"]), [
[ze, B(n).isUploading]
]),
!B(n).isUploading && u.value.length == 0 ? (p(), b("div", tn, [
E(c, {
src: "images/noimg.webp",
size: t.context.size
}, null, 8, ["size"]),
I("div", {
class: "upload",
style: Y(`width : ${t.context.size || "150"}px`)
}, [
I("span", null, P(h.$t("replace")), 1)
], 4)
])) : M("", !0),
!B(n).isUploading && u.value.length > 0 ? (p(), b("div", {
key: 1,
class: W(["grid", { multiple: t.context.multiple }]),
style: Y(`width : ${t.context.size || "150"}px`)
}, [
(p(!0), b(j, null, ee(u.value, (d) => (p(), V(c, {
class: "mr-2",
src: d,
size: t.context.size
}, null, 8, ["src", "size"]))), 256)),
I("div", nn, [
I("span", null, P(h.$t("replace")), 1)
])
], 6)) : M("", !0),
I("input", {
onChange: m,
onBlur: f[0] || (f[0] = () => B(n).isUploading = !1),
multiple: t.context.multiple,
type: "file",
id: "imageUpload",
class: "actual-input",
accept: "image/*"
}, null, 40, sn)
], 4);
};
}
});
class Pe {
constructor(t) {
A(this, "data");
A(this, "rootData", { options: [] });
A(this, "activeInputs", {});
A(this, "levels", {});
A(this, "levelsKeys", []);
A(this, "loadRootData", async () => {
if (this.data) {
if (typeof this.data == "function") {
const t = await this.data({});
this.rootData = t;
return;
}
this.rootData = this.data;
}
});
A(this, "loadInputOptions", async (t) => new Promise(async (n) => {
n([]);
}));
A(this, "setChildInputOptions", async (t, n) => {
console.log("setChildInputOptions", t);
const i = this.levelsKeys.indexOf(t);
if (i >= n.length || i == -1)
return;
const o = n[i];
if (!o)
return;
const s = await this.loadInputOptions(t);
console.log("childInputOptions", s), o.node.context.options = s;
});
A(this, "resetChildInputs", (t, n) => {
const i = this.levelsKeys.indexOf(t);
for (let o = i; o < n.length; o++) {
const s = n[o];
s && (delete this.activeInputs[s.node.name], s.node.reset());
}
});
A(this, "getIndexByValue", (t, n) => {
for (let i = 0; i < t.length; i++)
if (t[i].__original === n || t[i].value == n)
return i;
return -1;
});
this.data = t.context.data, this.levels = t.context.levels, this.levelsKeys = ye(t.context.levels), this.loadRootData();
}
}
class ln extends Pe {
constructor() {
super(...arguments);
A(this, "setInputValue", async (n, i, o) => {
const s = this.levelsKeys.indexOf(n), l = this.levelsKeys[s + 1];
return this.activeInputs[n] = { value: i, children: [] }, this.setChildInputOptions(l, o), l && this.resetChildInputs(l, o), {
childInputName: l
};
});
A(this, "loadInputOptions", async (n) => new Promise(async (i) => {
const o = this.levels[n];
if (!o)
return [];
if (!o.optionsListFn)
return [];
const s = this.levelsKeys.indexOf(n), l = this.levelsKeys[s - 1], a = {};
o.requestPropertyName && this.activeInputs[l] && (a[o.requestPropertyName] = this.activeInputs[l].value);
const u = await o.optionsListFn(a);
i(u.options);
}));
}
}
class rn extends Pe {
constructor() {
super(...arguments);
A(this, "setInputValue", async (n, i, o) => {
const s = this.levelsKeys.indexOf(n), l = this.levelsKeys[s - 1], a = this.levelsKeys[s + 1], u = s == 0 ? this.rootData.options : this.activeInputs[l] ? this.activeInputs[l].children : void 0;
if (!u)
return {};
const m = this.getIndexByValue(u, i);
if (m == -1)
return {};
const h = u[m].children;
return h ? (this.activeInputs[n] = { value: i, children: h }, this.setChildInputOptions(a, o), a && this.resetChildInputs(a, o), {
levelIndex: s,
childInputName: a
}) : {};
});
A(this, "loadInputOptions", async (n) => new Promise(async (i) => {
if (!this.levels[n])
return [];
if (!this.data)
return [];
const s = this.levelsKeys.indexOf(n), l = this.levelsKeys[s - 1], a = s == 0 ? this.rootData : { options: this.activeInputs[l].children };
i(a.options);
}));
}
}
const an = (e, t, n) => new Promise(async (i) => {
const o = [], s = ye(n);
for (let l = 0; l < s.length; l++) {
const a = s[l], u = n[a];
u.label = u.label ? e(u.label) : e(a), u.placeholder = u.placeholder ? e(u.placeholder) : void 0;
const m = s[l - 1], h = {
$cmp: "FormKit",
if: l == 0 ? "true" : `$get(${m}).value`,
props: {
type: "dropdown",
name: a,
ref: (f) => t[l] = f,
id: a,
onInput: "$setInputValue",
loadOnCreated: !1,
alwaysLoadOnOpen: !0,
selectionRemovable: !0,
options: "$loadOptions",
...u
}
};
o.push(h);
}
i({ schema: o });
}), cn = /* @__PURE__ */ H({
__name: "InputDepndentDropdown",
props: {
context: {}
},
async setup(e) {
let t, n;
const i = e, { t: o } = ae(), s = K([]), l = ([t, n] = ue(() => an(o, s.value, i.context.levels)), t = await t, n(), t), a = i.context.data ? new rn(i) : new ln(i), u = K({
loadOptions: async (m) => a.loadInputOptions(m.id),
setInputValue: async (m, h) => {
if (console.log(m), !m || a.activeInputs[h.name] && a.activeInputs[h.name].value == m)
return;
const { childInputName: f } = await a.setInputValue(h.name, m, s.value);
f || i.context.node.input(m);
}
});
return (m, h) => {
const f = G("FormKitSchema");
return p(), V(f, {
data: u.value,
schema: B(l).schema
}, null, 8, ["data", "schema"]);
};
}
}), un = /* @__PURE__ */ H({
__name: "InputPicker",
props: {
context: {}
},
setup(e) {
const t = e, n = async (i) => {
t.context.node._value = new Date(i), t.context.node.input(t.context.node._value);
};
return (i, o) => {
const s = G("FormKit");
return p(), V(s, {
ignore: !0,
outerClass: "w-full",
type: "datepicker",
name: "custom-picker",
onInput: n
});
};
}
}), dn = { class: "unit-qty" }, pn = { class: "top" }, hn = { class: "start" }, fn = { class: "end" }, mn = { class: "bottom" }, Se = 5, yn = /* @__PURE__ */ H({
__name: "InputUnitQty",
props: {
context: {}
},
setup(e) {
const t = e, { unitRatio: n } = t.context, i = K(!1), o = K(), s = K(), l = (h) => {
const f = h || a(), c = ht(f, n);
t.context.node.input(c);
}, a = () => {
const h = o.value.node.value, f = s.value.node.value, c = h ? parseFloat(h) : 0, d = f ? parseFloat(f) : 0, w = c < 0 ? 0 : c, _ = d < 0 ? 0 : d;
return { unitBuy: w, unitSell: _ };
}, u = (h, f) => {
if (!o.value.node.value && !h || i.value)
return;
i.value = !0;
const c = a(), { unitBuyQuantityIncreaseAmount: d, unitSellQuantity: w } = pt(c, n);
c.unitBuy = c.unitBuy + d, d > 0 && (o.value.node.input(c.unitBuy), f.input(w)), parseFloat(h) < 0 && f.input(0), ge(() => {
l(c), i.value = !1;
}, Se)();
}, m = (h, f) => {
if (!s.value.node.value && !h || i.value)
return;
parseFloat(h) < 0 && f.input(0), a(), ge(l, Se)();
};
return (h, f) => {
const c = G("FormKit");
return p(), b("div", dn, [
I("div", pn, [
I("div", hn, P(t.context.unitBuy), 1),
I("div", fn, P(t.context.unitSell), 1)
]),
I("div", mn, [
E(c, {
type: "number",
ref_key: "buyUnitElementRef",
ref: o,
onInput: m,
outerClass: "start",
value: t.context.initialValues ? t.context.initialValues.unitBuy.toString() : void 0
}, null, 8, ["value"]),
E(c, {
type: "number",
ref_key: "sellUnitElementRef",
ref: s,
onInput: u,
value: t.context.initialValues ? t.context.initialValues.unitSell.toString() : void 0,
outerClass: "end"
}, null, 8, ["value"])
])
]);
};
}
});
var Ke = {
name: "TimesCircleIcon",
extends: Ct
}, vn = /* @__PURE__ */ I("path", {
"fill-rule": "evenodd",
"clip-rule": "evenodd",
d: "M7 14C5.61553 14 4.26215 13.5895 3.11101 12.8203C1.95987 12.0511 1.06266 10.9579 0.532846 9.67879C0.00303296 8.3997 -0.13559 6.99224 0.134506 5.63437C0.404603 4.2765 1.07129 3.02922 2.05026 2.05026C3.02922 1.07129 4.2765 0.404603 5.63437 0.134506C6.99224 -0.13559 8.3997 0.00303296 9.67879 0.532846C10.9579 1.06266 12.0511 1.95987 12.8203 3.11101C13.5895 4.26215 14 5.61553 14 7C14 8.85652 13.2625 10.637 11.9497 11.9497C10.637 13.2625 8.85652 14 7 14ZM7 1.16667C5.84628 1.16667 4.71846 1.50879 3.75918 2.14976C2.79989 2.79074 2.05222 3.70178 1.61071 4.76768C1.16919 5.83358 1.05367 7.00647 1.27876 8.13803C1.50384 9.26958 2.05941 10.309 2.87521 11.1248C3.69102 11.9406 4.73042 12.4962 5.86198 12.7212C6.99353 12.9463 8.16642 12.8308 9.23232 12.3893C10.2982 11.9478 11.2093 11.2001 11.8502 10.2408C12.4912 9.28154 12.8333 8.15373 12.8333 7C12.8333 5.45291 12.2188 3.96918 11.1248 2.87521C10.0308 1.78125 8.5471 1.16667 7 1.16667ZM4.66662 9.91668C4.58998 9.91704 4.51404 9.90209 4.44325 9.87271C4.37246 9.84333 4.30826 9.8001 4.2544 9.74557C4.14516 9.6362 4.0838 9.48793 4.0838 9.33335C4.0838 9.17876 4.14516 9.0305 4.2544 8.92113L6.17553 7L4.25443 5.07891C4.15139 4.96832 4.09529 4.82207 4.09796 4.67094C4.10063 4.51982 4.16185 4.37563 4.26872 4.26876C4.3756 4.16188 4.51979 4.10066 4.67091 4.09799C4.82204 4.09532 4.96829 4.15142 5.07887 4.25446L6.99997 6.17556L8.92106 4.25446C9.03164 4.15142 9.1779 4.09532 9.32903 4.09799C9.48015 4.10066 9.62434 4.16188 9.73121 4.26876C9.83809 4.37563 9.89931 4.51982 9.90198 4.67094C9.90464 4.82207 9.84855 4.96832 9.74551 5.07891L7.82441 7L9.74554 8.92113C9.85478 9.0305 9.91614 9.17876 9.91614 9.33335C9.91614 9.48793 9.85478 9.6362 9.74554 9.74557C9.69168 9.8001 9.62748 9.84333 9.55669 9.87271C9.4859 9.90209 9.40996 9.91704 9.33332 9.91668C9.25668 9.91704 9.18073 9.90209 9.10995 9.87271C9.03916 9.84333 8.97495 9.8001 8.9211 9.74557L6.99997 7.82444L5.07884 9.74557C5.02499 9.8001 4.96078 9.84333 4.88999 9.87271C4.81921 9.90209 4.74326 9.91704 4.66662 9.91668Z",
fill: "currentColor"
}, null, -1), bn = [vn];
function gn(e, t, n, i, o, s) {
return p(), b("svg", v({
width: "14",
height: "14",
viewBox: "0 0 14 14",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, e.pti()), bn, 16);
}
Ke.render = gn;
var On = {
root: function(t) {
var n = t.props;
return {
position: n.appendTo === "self" ? "relative" : void 0
};
}
}, In = {
root: function(t) {
var n = t.instance, i = t.props;
return ["p-multiselect p-component p-inputwrapper", {
"p-multiselect-chip": i.display === "chip",
"p-disabled": i.disabled,
"p-invalid": i.invalid,
"p-variant-filled": i.variant ? i.variant === "filled" : n.$primevue.config.inputStyle === "filled",
"p-focus": n.focused,
"p-inputwrapper-filled": i.modelValue && i.modelValue.length,
"p-inputwrapper-focus": n.focused || n.overlayVisible,
"p-overlay-open": n.overlayVisible
}];
},
labelContainer: "p-multiselect-label-container",
label: function(t) {
var n = t.instance, i = t.props;
return ["p-multiselect-label", {
"p-placeholder": n.label === i.placeholder,
"p-multiselect-label-empty": !i.placeholder && (!i.modelValue || i.modelValue.length === 0)
}];
},
token: "p-multiselect-token",
tokenLabel: "p-multiselect-token-label",
removeTokenIcon: "p-multiselect-token-icon",
trigger: "p-multiselect-trigger",
loadingIcon: "p-multiselect-trigger-icon",
dropdownIcon: "p-multiselect-trigger-icon",
panel: function(t) {
t.props;
var n = t.instance;
return ["p-multiselect-panel p-component", {
"p-ripple-disabled": n.$primevue.config.ripple === !1
}];
},
header: "p-multiselect-header",
filterContainer: "p-multiselect-filter-container",
filterInput: function(t) {
var n = t.props, i = t.instance;
return ["p-multiselect-filter p-inputtext p-component", {
"p-variant-filled": n.variant ? n.variant === "filled" : i.$primevue.config.inputStyle === "filled"
}];
},
filterIcon: "p-multiselect-filter-icon",
closeButton: "p-multiselect-close p-link",
closeIcon: "p-multiselect-close-icon",
wrapper: "p-multiselect-items-wrapper",
list: "p-multiselect-items p-component",
itemGroup: "p-multiselect-item-group",
item: function(t) {
var n = t.instance, i = t.option, o = t.index, s = t.getItemOptions, l = t.props;
return ["p-multiselect-item", {
"p-highlight": n.isSelected(i) && l.highlightOnSelect,
"p-focus": n.focusedOptionIndex === n.getOptionIndex(o, s),
"p-disabled": n.isOptionDisabled(i)
}];
},
emptyMessage: "p-multiselect-empty-message"
}, Sn = Ft.extend({
name: "multiselect",
classes: In,
inlineStyles: On
}), xn = {
name: "BaseMultiSelect",
extends: _t,
props: {
modelValue: null,
options: Array,
optionLabel: null,
optionValue: null,
optionDisabled: null,
optionGroupLabel: null,
optionGroupChildren: null,
scrollHeight: {
type: String,
default: "200px"
},
placeholder: String,
variant: {
type: String,
default: null
},
invalid: {
type: Boolean,
default: !1
},
disabled: Boolean,
inputId: {
type: String,
default: null
},
inputProps: {
type: null,
default: null
},
panelClass: {
type: String,
default: null
},
panelStyle: {
type: null,
default: null
},
panelProps: {
type: null,
default: null
},
filterInputProps: {
type: null,
default: null
},
closeButtonProps: {
type: null,
default: null
},
dataKey: null,
filter: Boolean,
filterPlaceholder: String,
filterLocale: String,
filterMatchMode: {
type: String,
default: "contains"
},
filterFields: {
type: Array,
default: null
},
appendTo: {
type: [String, Object],
default: "body"
},
display: {
type: String,
default: "comma"
},
selectedItemsLabel: {
type: String,
default: "{0} items selected"
},
maxSelectedLabels: {
type: Number,
default: null
},
selectionLimit: {
type: Number,
default: null
},
showToggleAll: {
type: Boolean,
default: !0
},
loading: {
type: Boolean,
default: !1
},
checkboxIcon: {
type: String,
default: void 0
},
closeIcon: {
type: String,
default: void 0
},
dropdownIcon: {
type: String,
default: void 0
},
filterIcon: {
type: String,
default: void 0
},
loadingIcon: {
type: String,
default: void 0
},
removeTokenIcon: {
type: String,
default: void 0
},
selectAll: {
type: Boolean,
default: null
},
resetFilterOnHide: {
type: Boolean,
default: !1
},
virtualScrollerOptions: {
type: Object,
default: null
},
autoOptionFocus: {
type: Boolean,
default: !1
},
autoFilterFocus: {
type: Boolean,
default: !1
},
focusOnHover: {
type: Boolean,
default: !0
},
highlightOnSelect: {
type: Boolean,
default: !1
},
filterMessage: {
type: String,
default: null
},
selectionMessage: {
type: String,
default: null
},
emptySelectionMessage: {
type: String,
default: null
},
emptyFilterMessage: {
type: String,
default: null
},
emptyMessage: {
type: String,
default: null
},
tabindex: {
type: Number,
default: 0
},
ariaLabel: {
type: String,
default: null
},
ariaLabelledby: {
type: String,
default: null
}
},
style: Sn,
provide: function() {
return {
$parentInstance: this
};
}
};
function se(e) {
"@babel/helpers - typeof";
return se = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
return typeof t;
} : function(t) {
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
}, se(e);
}
function xe(e, t) {
var n = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var i = Object.getOwnPropertySymbols(e);
t && (i = i.filter(function(o) {
return Object.getOwnPropertyDescriptor(e, o).enumerable;
})), n.push.apply(n, i);
}
return n;
}
function we(e) {
for (var t = 1; t < arguments.length; t++) {
var n = arguments[t] != null ? arguments[t] : {};
t % 2 ? xe(Object(n), !0).forEach(function(i) {
Ae(e, i, n[i]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : xe(Object(n)).forEach(function(i) {
Object.defineProperty(e, i, Object.getOwnPropertyDescriptor(n, i));
});
}
return e;
}
function Ae(e, t, n) {
return t = wn(t), t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
}
function wn(e) {
var t = kn(e, "string");
return se(t) == "symbol" ? t : String(t);
}
function kn(e, t) {
if (se(e) != "object" || !e)
return e;
var n = e[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(e, t || "default");
if (se(i) != "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (t === "string" ? String : Number)(e);
}
function ke(e) {
return $n(e) || Vn(e) || Ln(e) || Cn();
}
function Cn() {
throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function Ln(e, t) {
if (e) {
if (typeof e == "string")
return he(e, t);
var n = Object.prototype.toString.call(e).slice(8, -1);
if (n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set")
return Array.from(e);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
return he(e, t);
}
}
function Vn(e) {
if (typeof Symbol < "u" && e[Symbol.iterator] != null || e["@@iterator"] != null)
return Array.from(e);
}
function $n(e) {
if (Array.isArray(e))
return he(e);
}
function he(e, t) {
(t == null || t > e.length) && (t = e.length);
for (var n = 0, i = new Array(t); n < t; n++)
i[n] = e[n];
return i;
}
var De = {
name: "MultiSelect",
extends: xn,
inheritAttrs: !1,
emits: ["update:modelValue", "change", "focus", "blur", "before-show", "before-hide", "show", "hide", "filter", "selectall-change"],
outsideClickListener: null,
scrollHandler: null,
resizeListener: null,
overlay: null,
list: null,
virtualScroller: null,
startRangeIndex: -1,
searchTimeout: null,
searchValue: "",
selectOnFocus: !1,
data: function() {
return {
id: this.$attrs.id,
clicked: !1,
focused: !1,
focusedOptionIndex: -1,
filterValue: null,
overlayVisible: !1
};
},
watch: {
"$attrs.id": {
immediate: !0,
handler: function(t) {
this.id = t || Vt();
}
},
options: function() {
this.autoUpdateModel();
}
},
mounted: function() {
this.autoUpdateModel();
},
beforeUnmount: function() {
this.unbindOutsideClickListener(), this.unbindResizeListener(), this.scrollHandler && (this.scrollHandler.destroy(), this.scrollHandler = null), this.overlay && (ce.clear(this.overlay), this.overlay = null);
},
methods: {
getOptionIndex: function(t, n) {
return this.virtualScrollerDisabled ? t : n && n(t).index;
},
getOptionLabel: function(t) {
return this.optionLabel ? C.resolveFieldData(t, this.optionLabel) : t;
},
getOptionValue: function(t) {
return this.optionValue ? C.resolveFieldData(t, this.optionValue) : t;
},
getOptionRenderKey: function(t, n) {
return this.dataKey ? C.resolveFieldData(t, this.dataKey) : this.getOptionLabel(t) + "_".concat(n);
},
getHeaderCheckboxPTOptions: function(t) {
return this.ptm(t, {
context: {
selected: this.allSelected
}
});
},
getCheckboxPTOptions: function(t, n, i, o) {
return this.ptm(o, {
context: {
selected: this.isSelected(t),
focused: this.focusedOptionIndex === this.getOptionIndex(i, n),
disabled: this.isOptionDisabled(t)
}
});
},
isOptionDisabled: function(t) {
return this.maxSelectionLimitReached && !this.isSelected(t) ? !0 : this.optionDisabled ? C.resolveFieldData(t, this.optionDisabled) : !1;
},
isOptionGroup: function(t) {
return this.optionGroupLabel && t.optionGroup && t.group;
},
getOptionGroupLabel: function(t) {
return C.resolveFieldData(t, this.optionGroupLabel);
},
getOptionGroupChildren: function(t) {
return C.resolveFieldData(t, this.optionGroupChildren);
},
getAriaPosInset: function(t) {
var n = this;
return (this.optionGroupLabel ? t - this.visibleOptions.slice(0, t).filter(function(i) {
return n.isOptionGroup(i);
}).length : t) + 1;
},
show: function(t) {
this.$emit("before-show"), this.overlayVisible = !0, this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.findSelectedOptionIndex(), t && T.focus(this.$refs.focusInput);
},
hide: function(t) {
var n = this, i = function() {
n.$emit("before-hide"), n.overlayVisible = !1, n.clicked = !1, n.focusedOptionIndex = -1, n.searchValue = "", n.resetFilterOnHide && (n.filterValue = null), t && T.focus(n.$refs.focusInput);
};
setTimeout(function() {
i();
}, 0);
},
onFocus: function(t) {
this.disabled || (this.focused = !0, this.overlayVisible && (this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.findSelectedOptionIndex(), this.scrollInView(this.focusedOptionIndex)), this.$emit("focus", t));
},
onBlur: function(t) {
this.clicked = !1, this.focused = !1, this.focusedOptionIndex = -1, this.searchValue = "", this.$emit("blur", t);
},
onKeyDown: function(t) {
var n = this;
if (this.disabled) {
t.preventDefault();
return;
}
var i = t.metaKey || t.ctrlKey;
switch (t.code) {
case "ArrowDown":
this.onArrowDownKey(t);
break;
case "ArrowUp":
this.onArrowUpKey(t);
break;
case "Home":
this.onHomeKey(t);
break;
case "End":
this.onEndKey(t);
break;
case "PageDown":
this.onPageDownKey(t);
break;
case "PageUp":
this.onPageUpKey(t);
break;
case "Enter":
case "NumpadEnter":
case "Space":
this.onEnterKey(t);
break;
case "Escape":
this.onEscapeKey(t);
break;
case "Tab":
this.onTabKey(t);
break;
case "ShiftLeft":
case "ShiftRight":
this.onShiftKey(t);
break;
default:
if (t.code === "KeyA" && i) {
var o = this.visibleOptions.filter(function(s) {
return n.isValidOption(s);
}).map(function(s) {
return n.getOptionValue(s);
});
this.updateModel(t, o), t.preventDefault();
break;
}
!i && C.isPrintableCharacter(t.key) && (!this.overlayVisible && this.show(), this.searchOptions(t), t.preventDefault());
break;
}
this.clicked = !1;
},
onContainerClick: function(t) {
this.disabled || this.loading || ((!this.overlay || !this.overlay.contains(t.target)) && (this.overlayVisible ? this.hide(!0) : this.show(!0)), this.clicked = !0);
},
onFirstHiddenFocus: function(t) {
var n = t.relatedTarget === this.$refs.focusInput ? T.getFirstFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput;
T.focus(n);
},
onLastHiddenFocus: function(t) {
var n = t.relatedTarget === this.$refs.focusInput ? T.getLastFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput;
T.focus(n);
},
onCloseClick: function() {
this.hide(!0);
},
onOptionSelect: function(t, n) {
var i = this, o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1, s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
if (!(this.disabled || this.isOptionDisabled(n))) {
var l = this.isSelected(n), a = null;
l ? a = this.modelValue.filter(function(u) {
return !C.equals(u, i.getOptionValue(n), i.equalityKey);
}) : a = [].concat(ke(this.modelValue || []), [this.getOptionValue(n)]), this.updateModel(t, a), o !== -1 && (this.focusedOptionIndex = o), s && T.focus(this.$refs.focusInput);
}
},
onOptionMouseMove: function(t, n) {
this.focusOnHover && this.changeFocusedOptionIndex(t, n);
},
onOptionSelectRange: function(t) {
var n = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1, o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1;
if (i === -1 && (i = this.findNearestSelectedOptionIndex(o, !0)), o === -1 && (o = this.findNearestSelectedOptionIndex(i)), i !== -1 && o !== -1) {
var s = Math.min(i, o), l = Math.max(i, o), a = this.visibleOptions.slice(s, l + 1).filter(function(u) {
return n.isValidOption(u);
}).map(function(u) {
return n.getOptionValue(u);
});
this.updateModel(t, a);
}
},
onFilterChange: function(t) {
var n = t.target.value;
this.filterValue = n, this.focusedOptionIndex = -1, this.$emit("filter", {
originalEvent: t,
value: n
}), !this.virtualScrollerDisabled && this.virtualScroller.scrollToIndex(0);
},
onFilterKeyDown: function(t) {
switch (t.code) {
case "ArrowDown":
this.onArrowDownKey(t);
break;
case "ArrowUp":
this.onArrowUpKey(t, !0);
break;
case "ArrowLeft":
case "ArrowRight":
this.onArrowLeftKey(t, !0);
break;
case "Home":
this.onHomeKey(t, !0);
break;
case "End":
this.onEndKey(t, !0);
break;
case "Enter":
case "NumpadEnter":
this.onEnterKey(t);
break;
case "Escape":
this.onEscapeKey(t);
break;
case "Tab":
this.onTabKey(t, !0);
break;
}
},
onFilterBlur: function() {
this.focusedOptionIndex = -1;
},
onFilterUpdated: function() {
this.overlayVisible && this.alignOverlay();
},
onOverlayClick: function(t) {
et.emit("overlay-click", {
originalEvent: t,
target: this.$el
});
},
onOverlayKeyDown: function(t) {
switch (t.code) {
case "Escape":
this.onEscapeKey(t);
break;
}
},
onArrowDownKey: function(t) {
if (!this.overlayVisible)
this.show();
else {
var n = this.focusedOptionIndex !== -1 ? this.findNextOptionIndex(this.focusedOptionIndex) : this.clicked ? this.findFirstOptionIndex() : this.findFirstFocusedOptionIndex();
t.shiftKey && this.onOptionSelectRange(t, this.startRangeIndex, n), this.changeFocusedOptionIndex(t, n);
}
t.preventDefault();
},
onArrowUpKey: function(t) {
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
if (t.altKey && !n)
this.focusedOptionIndex !== -1 && this.onOptionSelect(t, this.visibleOptions[this.focusedOptionIndex]), this.overlayVisible && this.hide(), t.preventDefault();
else {
var i = this.focusedOptionIndex !== -1 ? this.findPrevOptionIndex(t