@feedmepos/mf-inventory-portal 0.0.22-dev.4 → 0.0.22-dev.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/{ApprovalView-xF73Z1jN.js → ApprovalView-DKqwRFlF.js} +25 -26
  2. package/dist/{BindingsDialog-CCSAxGT4.js → BindingsDialog-CtMSqEuE.js} +9 -9
  3. package/dist/{BindingsPicker-ErFH0uEQ.js → BindingsPicker-DCLNF1PL.js} +22 -22
  4. package/dist/{BindingsTable-D8ffJgIJ.js → BindingsTable-6ndQuHeA.js} +1 -1
  5. package/dist/ClosingTemplateView-BPrDQ_8-.js +1688 -0
  6. package/dist/FmDroppableField-DQFPEiJn.js +152 -0
  7. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BUGB0uk3.js +266 -0
  8. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CM93v-jp.js +359 -0
  9. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-SNp8etCc.js +51 -0
  10. package/dist/IngredientsView-B1jGkWYN.js +1611 -0
  11. package/dist/{IntegrationView-54yz2EqS.js → IntegrationView-Bu0waSjB.js} +71 -71
  12. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CKvKlCk-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-mZQlrYaY.js} +1 -1
  13. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BEFmqnHk.js +116 -0
  14. package/dist/{PurchaseOrderPrintPreview-pcpWSfl4.js → PurchaseOrderPrintPreview-DTQViYuX.js} +7 -7
  15. package/dist/ReceiveRequestView-CNRixgQu.js +4069 -0
  16. package/dist/RecipeView-HStPC5pE.js +591 -0
  17. package/dist/Standalone.vue.d.ts +2 -0
  18. package/dist/StockView-JO3NtkX9.js +7762 -0
  19. package/dist/{SupplierView-TYCkPXan.js → SupplierView-gtaS4K3U.js} +111 -111
  20. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-dPt3qbcX.js +1146 -0
  21. package/dist/TransferTemplateView-C0pjLfbz.js +2054 -0
  22. package/dist/{UnitView-B9yE4-rc.js → UnitView-dbInWUk4.js} +18 -18
  23. package/dist/{WarehouseView-DUtVLTjb.js → WarehouseView-BlTBvLF0.js} +176 -177
  24. package/dist/api/bill.d.ts +84 -238
  25. package/dist/api/closing-template.d.ts +6 -4
  26. package/dist/api/inventory.d.ts +72 -85
  27. package/dist/api/netsuite.d.ts +47 -0
  28. package/dist/api/purchase-order-template.d.ts +4 -6
  29. package/dist/{app-w8TOQVZc.js → app-TB3IWuaU.js} +24520 -23671
  30. package/dist/app.d.ts +7 -0
  31. package/dist/app.js +3 -3
  32. package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
  33. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  34. package/dist/components/FmUnitInputRules.d.ts +2 -0
  35. package/dist/components/map/GoogleMap.vue.d.ts +4 -4
  36. package/dist/{decimal-C4q7UMfr.js → decimal-BRAYgPnN.js} +1 -1
  37. package/dist/defineDeepModel-DrEk5Fhq.js +13 -0
  38. package/dist/format-time-from-id-kpVYfVQb.js +15 -0
  39. package/dist/helper/rules.d.ts +7 -0
  40. package/dist/helper/rules.spec.d.ts +1 -0
  41. package/dist/helper/xlsx.util.d.ts +7 -0
  42. package/dist/purchase-order-transaction-type-ZMNa__2l.js +348 -0
  43. package/dist/stores/api.d.ts +1 -0
  44. package/dist/stores/feature.d.ts +0 -1
  45. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  46. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  47. package/dist/stores/inventory.d.ts +85 -0
  48. package/dist/stores/location.d.ts +508 -503
  49. package/dist/stores/netsuite.d.ts +69 -0
  50. package/dist/stores/route.d.ts +0 -5
  51. package/dist/stores/supplier.d.ts +120 -3
  52. package/dist/style.css +1 -1
  53. package/dist/supplier-CJcqHpaM.js +70 -0
  54. package/dist/tsconfig.app.tsbuildinfo +1 -1
  55. package/dist/use-template-enabled-locations-2-DyD24laW.js +85 -0
  56. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
  57. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
  58. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +1093 -1026
  59. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +1098 -1037
  60. package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
  61. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
  62. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  63. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +45 -0
  64. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1944 -82
  65. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  66. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2351 -284
  67. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2300 -233
  68. package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
  69. package/dist/views/stock/components/StockRecordCard.vue.d.ts +42 -119
  70. package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
  71. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
  72. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
  73. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  74. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -85
  75. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +39 -2
  76. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
  77. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
  78. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
  79. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1263 -1466
  80. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +1688 -897
  81. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
  82. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -0
  83. package/dist/views/transfer-template/helpers/template-item.error.helper.d.ts +1 -0
  84. package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
  85. package/dist/{xlsx-BggStaH1.js → xlsx-Dd5ckm6-.js} +1525 -1525
  86. package/dist/xlsx.util-qlqvEcJz.js +78 -0
  87. package/package.json +7 -5
  88. package/dist/ClosingTemplateView-DdZlX1ug.js +0 -1030
  89. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ZYtBNoaE.js +0 -372
  90. package/dist/IngredientsView-DnwwQJTN.js +0 -1758
  91. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-Bom_KvXW.js +0 -88
  92. package/dist/ReceiveRequestView-D5HXMY4Z.js +0 -215
  93. package/dist/RecipeView-BHkTgm5H.js +0 -581
  94. package/dist/StockView-iczCFYxn.js +0 -1892
  95. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-EN3JgHKF.js +0 -740
  96. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DC0Ss5hi.js +0 -1409
  97. package/dist/TransferTemplateView-Bbvpuys7.js +0 -1230
  98. package/dist/defineDeepModel-BOApqV24.js +0 -13
  99. package/dist/format-time-from-id-Cafjo8fn.js +0 -15
  100. package/dist/id-to-date-CtSHSVJF.js +0 -30
  101. package/dist/layout/layout-routes.d.ts +0 -6
  102. package/dist/purchase-order-transaction-type-CIC5h-6x.js +0 -712
  103. package/dist/supplier-CM-vZ4bQ.js +0 -69
  104. package/dist/use-template-enabled-locations-Bm00vEzC.js +0 -57
  105. package/dist/xlsx.util-CqlYZLKW.js +0 -109
  106. /package/dist/{layout/InventoryLayout.vue.d.ts → views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts} +0 -0
@@ -0,0 +1,152 @@
1
+ import { defineComponent as O, ref as r, computed as v, resolveComponent as z, openBlock as n, createElementBlock as p, createElementVNode as d, createCommentVNode as k, renderSlot as c, createBlock as C, normalizeClass as u, toDisplayString as g } from "vue";
2
+ import { X as N } from "./app-TB3IWuaU.js";
3
+ const M = {
4
+ key: 0,
5
+ class: "relative"
6
+ }, W = ["accept", "disabled"], X = { class: "flex flex-col gap-8" }, q = ["accept", "disabled"], G = /* @__PURE__ */ O({
7
+ __name: "FmDroppableField",
8
+ props: {
9
+ buttonLabel: {},
10
+ label: { default: "" },
11
+ disabled: { type: Boolean, default: !1 },
12
+ accept: { default: "" },
13
+ maxFileSize: { default: 8e6 },
14
+ contentClass: {}
15
+ },
16
+ emits: ["file-upload", "file-rejected"],
17
+ setup(S, { emit: $ }) {
18
+ const l = S, y = $, t = r(!1), i = r(null), s = r(null), f = r(), B = (e) => {
19
+ l.disabled || (e.stopPropagation(), e.preventDefault());
20
+ }, V = (e) => {
21
+ l.disabled || (e.stopPropagation(), e.preventDefault(), t.value = !0);
22
+ }, R = (e) => {
23
+ l.disabled || (e.stopPropagation(), e.preventDefault(), t.value = !1);
24
+ }, j = (e) => {
25
+ var a;
26
+ l.disabled || (e.stopPropagation(), e.preventDefault(), t.value = !1, F((a = e.dataTransfer) == null ? void 0 : a.files));
27
+ };
28
+ function F(e) {
29
+ if (e)
30
+ if (f.value = e, i.value = T(e[0]), s.value = A(e[0]), i.value && s.value)
31
+ y("file-upload", e[0]);
32
+ else {
33
+ const a = L();
34
+ y("file-rejected", [
35
+ {
36
+ file: e[0],
37
+ reason: a
38
+ }
39
+ ]);
40
+ }
41
+ }
42
+ const L = () => {
43
+ const e = new Array();
44
+ return i.value || e.push("invalid-type"), s.value || e.push("invalid-size"), e;
45
+ }, T = (e) => {
46
+ if (!l.accept) return !0;
47
+ const a = l.accept.split(",").map((o) => o.trim());
48
+ for (const o of a)
49
+ if (E(o)) {
50
+ if (D(o) === D(e.type)) return !0;
51
+ } else if (P(e) === o || e.type === o) return !0;
52
+ return !1;
53
+ }, A = (e) => e.size <= l.maxFileSize, E = (e) => e.indexOf("*") !== -1, P = (e) => "." + e.name.split(".").pop(), D = (e) => e.substring(0, e.indexOf("/")), w = v(() => {
54
+ if (t.value) return "Drop file to upload";
55
+ if (i.value) {
56
+ if (!s.value) return `File size exceeds ${l.maxFileSize * 1e-6}mb`;
57
+ } else return "File type is not valid";
58
+ return "";
59
+ }), m = v(() => f.value ? !i.value || !s.value : !1), _ = (e) => {
60
+ const a = e.target;
61
+ F(a.files);
62
+ }, x = v(() => {
63
+ var e;
64
+ return (e = f.value) == null ? void 0 : e.item(0);
65
+ }), b = r();
66
+ return (e, a) => {
67
+ const o = z("FmLabel"), I = z("FmButton");
68
+ return n(), p("label", {
69
+ class: "fm-droppable-field",
70
+ ref_key: "fmButtonRef",
71
+ ref: b
72
+ }, [
73
+ e.$slots.default ? (n(), p("div", M, [
74
+ d("input", {
75
+ accept: e.accept,
76
+ disabled: e.disabled,
77
+ class: "fm-droppable-field__input",
78
+ type: "file",
79
+ onChange: _
80
+ }, null, 40, W)
81
+ ])) : k("", !0),
82
+ c(e.$slots, "default", {
83
+ isDragging: t.value,
84
+ isValidFileType: i.value,
85
+ isValidFileSize: s.value,
86
+ singleValidFile: x.value,
87
+ openFileDialog: () => {
88
+ var h;
89
+ return console.log("click", b.value), (h = b.value) == null ? void 0 : h.click();
90
+ }
91
+ }, () => [
92
+ d("div", X, [
93
+ e.$slots.label ? c(e.$slots, "label", { key: 0 }, void 0, !0) : (n(), C(o, {
94
+ key: 1,
95
+ label: e.label
96
+ }, null, 8, ["label"]))
97
+ ]),
98
+ d("div", {
99
+ class: u([[
100
+ e.contentClass ? e.contentClass : "w-full h-full",
101
+ {
102
+ "fm-droppable-field__container--dragging": t.value,
103
+ "fm-droppable-field__container--invalid": m.value && !e.disabled,
104
+ "fm-droppable-field__container--disabled": e.disabled
105
+ }
106
+ ], "fm-droppable-field__container"]),
107
+ onDragenter: B,
108
+ onDragleave: R,
109
+ onDragover: V,
110
+ onDrop: j
111
+ }, [
112
+ (t.value || m.value) && !e.disabled ? (n(), p("div", {
113
+ key: 0,
114
+ class: u({
115
+ "fm-typo-en-body-lg-600": !0,
116
+ "text-fm-color-primary": t.value,
117
+ "text-fm-color-typo-error": m.value
118
+ })
119
+ }, g(w.value), 3)) : (n(), C(I, {
120
+ key: 1,
121
+ disabled: e.disabled,
122
+ label: e.buttonLabel ?? "Add files",
123
+ size: "md",
124
+ variant: "secondary"
125
+ }, null, 8, ["disabled", "label"])),
126
+ c(e.$slots, "accept-text", {}, () => [
127
+ l.accept ? (n(), p("div", {
128
+ key: 0,
129
+ class: u([[e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"], "fm-typo-en-body-md-400"])
130
+ }, g(`Accepts ${l.accept}`), 3)) : k("", !0)
131
+ ], !0),
132
+ d("input", {
133
+ accept: e.accept,
134
+ disabled: e.disabled,
135
+ class: "fm-droppable-field__input",
136
+ type: "file",
137
+ onChange: _
138
+ }, null, 40, q)
139
+ ], 34),
140
+ c(e.$slots, "helper-text", {}, () => [
141
+ d("div", {
142
+ class: u([[e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"], "fm-typo-en-body-sm-400"])
143
+ }, g(`Max size ${l.maxFileSize * 1e-6}mb`), 3)
144
+ ], !0)
145
+ ], !0)
146
+ ], 512);
147
+ };
148
+ }
149
+ }), K = /* @__PURE__ */ N(G, [["__scopeId", "data-v-311b22a0"]]);
150
+ export {
151
+ K as F
152
+ };
@@ -0,0 +1,266 @@
1
+ import { a as P, t as B, a7 as A, i as D, ae as R, am as H, an as V } from "./app-TB3IWuaU.js";
2
+ import { u as j } from "./supplier-CJcqHpaM.js";
3
+ import { P as S } from "./purchase-order-transaction-type-ZMNa__2l.js";
4
+ import { computed as y, defineComponent as $, mergeModels as W, useModel as J, resolveComponent as w, openBlock as F, createElementBlock as I, normalizeStyle as K, createElementVNode as N, createVNode as Q, withCtx as X, createBlock as x, createCommentVNode as E, Fragment as Y, renderList as Z, unref as M } from "vue";
5
+ function ne(c, i, t, s) {
6
+ var b, g, u;
7
+ if (s != null && s.manualTotalCost)
8
+ return s == null ? void 0 : s.manualTotalCost;
9
+ const e = (u = (g = (b = s == null ? void 0 : s.supplier) == null ? void 0 : b.supplyItems) == null ? void 0 : g.find(
10
+ (r) => r.skuId === c._id
11
+ )) == null ? void 0 : u.defaultCost, o = c.defaultCost, n = e ?? o, l = n == null ? void 0 : n.costPerUnit, a = l ? n != null && n.measurement ? +P(l) / +P(n == null ? void 0 : n.measurement.conversion) : +P(l) : void 0, p = a ? t ? a * +P(t.conversion) : a : void 0, d = p ? +P(i) * p : void 0;
12
+ return d ? {
13
+ ...B(d ?? 0, 2),
14
+ currency: A()
15
+ } : {
16
+ amount: 0,
17
+ precision: 0,
18
+ currency: A()
19
+ };
20
+ }
21
+ function _(c) {
22
+ return H.parse(c);
23
+ }
24
+ function T(c) {
25
+ return {
26
+ _id: c.doc._id,
27
+ internal: c.type,
28
+ contactName: c.doc.profile.name,
29
+ name: c.doc.profile.name ?? "",
30
+ email: c.doc.profile.email,
31
+ phoneNumber: c.doc.profile.phoneNo,
32
+ registrationNumber: c.doc.profile.regNo,
33
+ address: c.doc.profile.address ?? {
34
+ line1: "",
35
+ state: "",
36
+ city: "",
37
+ postcode: "",
38
+ country: ""
39
+ }
40
+ };
41
+ }
42
+ function oe(c, i, t = !1, s = !1) {
43
+ const e = j(), o = D();
44
+ o.watchLocation(async () => {
45
+ var v;
46
+ await e.readSuppliers();
47
+ const u = c();
48
+ if ((v = u.supplier) != null && v._id) return;
49
+ const r = s ? e.suppliers[0] : e.businessSuppliers[0], f = (t ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations)[0];
50
+ i({
51
+ ...u,
52
+ supplier: r ? _(r) : f ? T(f) : u.supplier
53
+ });
54
+ });
55
+ const n = y(
56
+ () => {
57
+ var u, r;
58
+ return typeof ((r = (u = c()) == null ? void 0 : u.supplier) == null ? void 0 : r.internal) == "string" ? S.TRANSFER : S.PURCHASE;
59
+ }
60
+ ), l = y({
61
+ get() {
62
+ var u, r;
63
+ return (r = (u = c()) == null ? void 0 : u.supplier) == null ? void 0 : r._id;
64
+ },
65
+ set(u) {
66
+ const r = c() ?? {};
67
+ if (n.value === S.PURCHASE) {
68
+ const C = (s ? e.suppliers : e.businessSuppliers).find((U) => U._id === u);
69
+ i({
70
+ ...r,
71
+ supplier: C ? _(C) : r.supplier
72
+ });
73
+ return;
74
+ }
75
+ const v = (t ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations).find((m) => m.doc._id === u);
76
+ i({
77
+ ...r,
78
+ supplier: v ? T(v) : r.supplier
79
+ });
80
+ }
81
+ }), a = y(() => e.locationSuppliers.map(_)), p = y(() => e.businessSuppliers.map(_)), d = y(() => {
82
+ const u = [...a.value], r = [...p.value];
83
+ return s ? [...r, ...u] : r;
84
+ }), k = y(() => {
85
+ var h;
86
+ const u = ((h = o._currentLocation) == null ? void 0 : h.type) === R.warehouse;
87
+ return (t ? o.locations.filter((f) => f.doc._id !== o.currentLocation.doc._id) : o.locations).filter((f) => u || f.acceptRequest).map(T);
88
+ }), b = y(() => {
89
+ if (n.value === S.PURCHASE) {
90
+ const r = a.value.map((f) => ({
91
+ label: f.name,
92
+ value: f._id
93
+ })), h = p.value.map((f) => ({
94
+ label: f.name,
95
+ sublabel: "Business supplier",
96
+ value: f._id
97
+ }));
98
+ return s ? [...r, ...h] : h;
99
+ }
100
+ return k.value.map((r) => ({
101
+ label: r.name,
102
+ sublabel: r.internal ? `${r.internal}` : void 0,
103
+ value: r._id
104
+ }));
105
+ }), g = y(() => {
106
+ var f, v;
107
+ const u = (v = (f = c()) == null ? void 0 : f.supplier) == null ? void 0 : v._id;
108
+ if (n.value === S.PURCHASE) {
109
+ const m = e.suppliers.find((C) => C._id === u);
110
+ return m ? _(m) : null;
111
+ }
112
+ const h = o.locations.find((m) => m.doc._id);
113
+ return h ? T(h) : null;
114
+ });
115
+ return {
116
+ transferLocationModel: l,
117
+ transferLocationOptions: b,
118
+ locationOptionsTypePurchase: d,
119
+ locationOptionsTypePurchaseLocationLevel: a,
120
+ locationOptionsTypeTransfer: k,
121
+ selectedLocation: g
122
+ };
123
+ }
124
+ class O {
125
+ static getDescendantProperty(i, t, s = []) {
126
+ let e, o, n, l, a, p;
127
+ if (t) {
128
+ if (n = t.indexOf("."), n === -1 ? e = t : (e = t.slice(0, n), o = t.slice(n + 1)), l = i[e], l !== null && typeof l < "u")
129
+ if (!o && (typeof l == "string" || typeof l == "number"))
130
+ s.push(l);
131
+ else if (Object.prototype.toString.call(l) === "[object Array]")
132
+ for (a = 0, p = l.length; a < p; a++)
133
+ O.getDescendantProperty(l[a], o, s);
134
+ else o && O.getDescendantProperty(l, o, s);
135
+ } else
136
+ s.push(i);
137
+ return s;
138
+ }
139
+ }
140
+ class L {
141
+ constructor(i = [], t = [], s = {}) {
142
+ Array.isArray(t) || (s = t, t = []), this.haystack = i, this.keys = t, this.options = Object.assign({
143
+ caseSensitive: !1,
144
+ sort: !1
145
+ }, s);
146
+ }
147
+ search(i = "") {
148
+ if (i === "")
149
+ return this.haystack;
150
+ const t = [];
151
+ for (let s = 0; s < this.haystack.length; s++) {
152
+ const e = this.haystack[s];
153
+ if (this.keys.length === 0) {
154
+ const o = L.isMatch(e, i, this.options.caseSensitive);
155
+ o && t.push({ item: e, score: o });
156
+ } else
157
+ for (let o = 0; o < this.keys.length; o++) {
158
+ const n = O.getDescendantProperty(e, this.keys[o]);
159
+ let l = !1;
160
+ for (let a = 0; a < n.length; a++) {
161
+ const p = L.isMatch(n[a], i, this.options.caseSensitive);
162
+ if (p) {
163
+ l = !0, t.push({ item: e, score: p });
164
+ break;
165
+ }
166
+ }
167
+ if (l)
168
+ break;
169
+ }
170
+ }
171
+ return this.options.sort && t.sort((s, e) => s.score - e.score), t.map((s) => s.item);
172
+ }
173
+ static isMatch(i, t, s) {
174
+ i = String(i), t = String(t), s || (i = i.toLocaleLowerCase(), t = t.toLocaleLowerCase());
175
+ const e = L.nearestIndexesFor(i, t);
176
+ return e ? i === t ? 1 : e.length > 1 ? 2 + (e[e.length - 1] - e[0]) : 2 + e[0] : !1;
177
+ }
178
+ static nearestIndexesFor(i, t) {
179
+ const s = t.split("");
180
+ let e = [];
181
+ return L.indexesOfFirstLetter(i, t).forEach((n, l) => {
182
+ let a = n + 1;
183
+ e[l] = [n];
184
+ for (let p = 1; p < s.length; p++) {
185
+ const d = s[p];
186
+ if (a = i.indexOf(d, a), a === -1) {
187
+ e[l] = !1;
188
+ break;
189
+ }
190
+ e[l].push(a), a++;
191
+ }
192
+ }), e = e.filter((n) => n !== !1), e.length ? e.sort((n, l) => n.length === 1 ? n[0] - l[0] : (n = n[n.length - 1] - n[0], l = l[l.length - 1] - l[0], n - l))[0] : !1;
193
+ }
194
+ static indexesOfFirstLetter(i, t) {
195
+ const s = t[0];
196
+ return i.split("").map((e, o) => e !== s ? !1 : o).filter((e) => e !== !1);
197
+ }
198
+ }
199
+ const z = { class: "sticky top-0 bg-white mb-8" }, G = { class: "overflow-y-auto pb-8" }, le = /* @__PURE__ */ $({
200
+ __name: "FmFilterableMenuOptions",
201
+ props: /* @__PURE__ */ W({
202
+ modelValue: {},
203
+ maxHeight: {},
204
+ width: {},
205
+ handleItemChange: { type: Function },
206
+ items: {},
207
+ options: {}
208
+ }, {
209
+ search: {},
210
+ searchModifiers: {}
211
+ }),
212
+ emits: ["update:search"],
213
+ setup(c) {
214
+ const i = c, t = J(c, "search"), s = y(
215
+ () => new L(i.items, ["label", "sublabel"], i.options)
216
+ ), e = y(() => s.value.search(t.value));
217
+ return (o, n) => {
218
+ const l = w("FmButton"), a = w("FmTextField"), p = w("FmMenuItem");
219
+ return F(), I("div", {
220
+ class: "relative",
221
+ style: K({ maxHeight: `${o.maxHeight}px`, width: o.width })
222
+ }, [
223
+ N("div", z, [
224
+ Q(a, {
225
+ modelValue: t.value,
226
+ "onUpdate:modelValue": n[1] || (n[1] = (d) => t.value = d),
227
+ placeholder: "Filter options"
228
+ }, {
229
+ append: X(() => [
230
+ t.value ? (F(), x(l, {
231
+ key: 0,
232
+ variant: "tertiary",
233
+ "prepend-icon": "close",
234
+ onClick: n[0] || (n[0] = (d) => t.value = "")
235
+ })) : E("", !0)
236
+ ]),
237
+ _: 1
238
+ }, 8, ["modelValue"])
239
+ ]),
240
+ N("div", G, [
241
+ (F(!0), I(Y, null, Z(e.value, (d, k) => (F(), x(p, {
242
+ key: k,
243
+ label: d.label,
244
+ sublabel: d.sublabel,
245
+ "model-value": M(V)(o.modelValue, d.value),
246
+ onClick: () => o.handleItemChange(M(V)(o.modelValue, d.value), d),
247
+ onVnodeMounted: (b) => {
248
+ var g;
249
+ return M(V)(o.modelValue, d.value) && ((g = b.el) == null || g.scrollIntoView({ behavior: "smooth", block: "center" }), console.log("scrollTo", b.el)), void 0;
250
+ }
251
+ }, null, 8, ["label", "sublabel", "model-value", "onClick", "onVnodeMounted"]))), 128)),
252
+ e.value.length ? E("", !0) : (F(), x(p, {
253
+ key: 0,
254
+ disabled: "",
255
+ label: "No options available"
256
+ }))
257
+ ])
258
+ ], 4);
259
+ };
260
+ }
261
+ });
262
+ export {
263
+ le as _,
264
+ ne as c,
265
+ oe as u
266
+ };