@oneclick.dev/cms-core-modules 0.0.122 → 0.0.124
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.
- package/dist/{ContentEditor-CoJjsV-m.js → ContentEditor-BcIUumah.js} +63 -59
- package/dist/{ContentEditor-DIwqplfB.mjs → ContentEditor-DX1bTQKs.mjs} +27894 -26319
- package/dist/{Detail-Dk8E6_uF.mjs → Detail-B7pe808q.mjs} +15 -14
- package/dist/Detail-BESGmY7z.js +1 -0
- package/dist/{Detail-Cn9Bk0u0.mjs → Detail-B_Q7Qkuz.mjs} +26 -25
- package/dist/Detail-CNiLIEh9.js +1 -0
- package/dist/{Detail-B_scnidb.mjs → Detail-DNxAzeCs.mjs} +35 -34
- package/dist/Detail-t3tOcy3X.js +1 -0
- package/dist/Editor-D4evcdhv.mjs +768 -0
- package/dist/Editor-gLLtuJbY.js +1 -0
- package/dist/FormStatusBadge.vue_vue_type_script_setup_true_lang-BjKpsqT9.js +1 -0
- package/dist/FormStatusBadge.vue_vue_type_script_setup_true_lang-D5v5AhLe.mjs +76 -0
- package/dist/Knowledge-B66vxz--.js +1 -0
- package/dist/Knowledge-BnMTTuJ7.mjs +742 -0
- package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-8I_Z9cD_.mjs} +530 -530
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BVE_uURZ.js +1 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs +3566 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DzPOadcU.js +925 -0
- package/dist/Overview-BE4uYPx0.mjs +745 -0
- package/dist/Overview-CQRpFhbJ.mjs +286 -0
- package/dist/Overview-CTs7sX4d.js +1 -0
- package/dist/Overview-Cj89XXKN.js +1 -0
- package/dist/Overview-D_c18mbR.mjs +248 -0
- package/dist/Overview-g4Rcj245.js +1 -0
- package/dist/TableCalculationWidget-CkQPrVUd.js +59 -0
- package/dist/TableCalculationWidget-CrqcLGfU.mjs +254 -0
- package/dist/TableDataWidget-7qvC3Egd.js +1 -0
- package/dist/TableDataWidget-DMTSoGRO.mjs +121 -0
- package/dist/TableOverviewCard-AFq-puJs.js +1 -0
- package/dist/TableOverviewCard-Ci0d4o4w.mjs +391 -0
- package/dist/TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs +534 -0
- package/dist/TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js +1 -0
- package/dist/TableRowActionCard-BhdnnPaq.mjs +266 -0
- package/dist/TableRowActionCard-IzB6tNN-.js +1 -0
- package/dist/TableView-6mdrL3zx.js +4 -0
- package/dist/TableView-Du5nOE6R.mjs +8228 -0
- package/dist/Test-CzmOmi53.mjs +447 -0
- package/dist/Test-USDtNFY1.js +1 -0
- package/dist/UserDetail-DpUL3mhk.mjs +1483 -0
- package/dist/UserDetail-KRIfxaYd.js +1 -0
- package/dist/{agenda-BCKDYOeF.mjs → agenda-DWdbWUbb.mjs} +10 -9
- package/dist/agenda-r9Gl85GL.js +1 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/dateRangePresets-B-l5b_wR.mjs +48 -0
- package/dist/dateRangePresets-CPWqst_x.js +1 -0
- package/dist/fuse-Deb-Iq39.mjs +1473 -0
- package/dist/fuse-_CGUd5Zq.js +1 -0
- package/dist/{index-DU3Ib10Z.mjs → index-B_qaX29C.mjs} +7 -6
- package/dist/index-CQuN5rKx.js +1 -0
- package/dist/index-CnDGeInm.js +1 -0
- package/dist/index-CqDTc5Ig.mjs +20 -0
- package/dist/index-CyvvAdt4.js +1 -0
- package/dist/index-DIRD7t5_.mjs +20 -0
- package/dist/index-OJuBYR60.mjs +57 -0
- package/dist/{index-Bk3yLv_G.js → index-yHLT6gaZ.js} +3 -3
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +671 -118
- package/dist/{orders-CElKNc1v.mjs → orders-BfTLIm7U.mjs} +10 -9
- package/dist/orders-DUa2PVoa.js +1 -0
- package/dist/reports-ChCsd1Gk.mjs +1107 -0
- package/dist/reports-DmJPm8uP.js +158 -0
- package/dist/row-item-C1dUyimV.mjs +204 -0
- package/dist/row-item-Cyo3m3MZ.js +1 -0
- package/dist/server-handlers.cjs.js +1 -1
- package/dist/server-handlers.mjs +1764 -605
- package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +9 -3
- package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +2 -0
- package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +4 -2
- package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +9 -3
- package/dist/src/appointments/pages/edit/orders.vue.d.ts +9 -3
- package/dist/src/appointments/pages/edit/reports.vue.d.ts +229 -1
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/Container.d.ts +1 -1
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/Row.d.ts +7 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/Stack.d.ts +7 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/resizeHistory.d.ts +9 -0
- package/dist/src/contentManager/components/content-editor/tiptap-menus/ElementEditorMenu.vue.d.ts +3 -1
- package/dist/src/firebaseAuthManager/components/DeleteUserDialog.vue.d.ts +25 -0
- package/dist/src/firebaseAuthManager/components/ReasonActionDialog.vue.d.ts +23 -0
- package/dist/src/firebaseAuthManager/components/UserStatusBadge.vue.d.ts +5 -0
- package/dist/src/firebaseAuthManager/config.d.ts +151 -0
- package/dist/src/firebaseAuthManager/index.d.ts +163 -0
- package/dist/src/firebaseAuthManager/index.vue.d.ts +14 -0
- package/dist/src/firebaseAuthManager/metadata.d.ts +2 -0
- package/dist/src/firebaseAuthManager/pages/Overview.vue.d.ts +2 -0
- package/dist/src/firebaseAuthManager/pages/UserDetail.vue.d.ts +2 -0
- package/dist/src/firebaseAuthManager/permissions.d.ts +5 -0
- package/dist/src/firebaseAuthManager/routes.d.ts +5 -0
- package/dist/src/firebaseAuthManager/server.d.ts +162 -0
- package/dist/src/firebaseAuthManager/types.d.ts +84 -0
- package/dist/src/formBuilder/components/FormPreviewDialog.vue.d.ts +12 -0
- package/dist/src/formBuilder/components/FormStatusBadge.vue.d.ts +9 -0
- package/dist/src/formBuilder/config.d.ts +31 -0
- package/dist/src/formBuilder/index.d.ts +44 -0
- package/dist/src/formBuilder/index.vue.d.ts +14 -0
- package/dist/src/formBuilder/lib/forms.d.ts +11 -0
- package/dist/src/formBuilder/metadata.d.ts +2 -0
- package/dist/src/formBuilder/pages/Editor.vue.d.ts +2 -0
- package/dist/src/formBuilder/pages/Overview.vue.d.ts +2 -0
- package/dist/src/formBuilder/permissions.d.ts +5 -0
- package/dist/src/formBuilder/routes.d.ts +5 -0
- package/dist/src/formBuilder/server.d.ts +87 -0
- package/dist/src/formBuilder/tools.d.ts +1 -0
- package/dist/src/formBuilder/types.d.ts +46 -0
- package/dist/src/helpbot/composables/useHelpbotApi.d.ts +18 -0
- package/dist/src/helpbot/config.d.ts +17 -0
- package/dist/src/helpbot/index.d.ts +29 -0
- package/dist/src/helpbot/index.vue.d.ts +2 -0
- package/dist/src/helpbot/metadata.d.ts +2 -0
- package/dist/src/helpbot/pages/Knowledge.vue.d.ts +4 -0
- package/dist/src/helpbot/pages/Overview.vue.d.ts +2 -0
- package/dist/src/helpbot/pages/Test.vue.d.ts +4 -0
- package/dist/src/helpbot/permissions.d.ts +5 -0
- package/dist/src/helpbot/routes.d.ts +5 -0
- package/dist/src/helpbot/types.d.ts +42 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/server-handlers.d.ts +2 -0
- package/dist/src/table/chat-components/TableCalculationWidget.vue.d.ts +15 -0
- package/dist/src/table/chat-components/TableDataWidget.vue.d.ts +15 -0
- package/dist/src/table/chat-components/TableOverviewCard.vue.d.ts +61 -0
- package/dist/src/table/chat-components/TableResultView.vue.d.ts +48 -0
- package/dist/src/table/chat-components/TableRowActionCard.vue.d.ts +15 -0
- package/dist/src/table/components/filters/DialogTableFilterOptionItem.vue.d.ts +16 -0
- package/dist/src/table/components/filters/NumberComparisonFilter.vue.d.ts +12 -0
- package/dist/src/table/components/filters/NumberComparisonFilterSettings.vue.d.ts +12 -0
- package/dist/src/table/components/filters/NumberRangeFilter.vue.d.ts +12 -0
- package/dist/src/table/components/filters/NumberRangeFilterSettings.vue.d.ts +12 -0
- package/dist/src/table/components/filters/filter-utils.d.ts +14 -0
- package/dist/src/table/composables/useTableAgentTools.d.ts +33 -0
- package/dist/src/table/index.d.ts +339 -0
- package/dist/src/table/tool-sandbox.d.ts +13 -0
- package/dist/src/table/tool-utils.d.ts +11 -0
- package/dist/src/table/tools.d.ts +333 -1
- package/dist/src/table/types.d.ts +79 -0
- package/dist/tool-sandbox-DdkMLkDK.mjs +182 -0
- package/dist/tool-sandbox-DoF1PsyS.js +115 -0
- package/dist/types-9N-DKxNj.mjs +250 -0
- package/dist/types-BMraG1kN.js +1 -0
- package/dist/types-Cem0vPo_.js +1 -0
- package/dist/types-ibC3-e1N.mjs +2630 -0
- package/dist/useHelpbotApi-BIIungOh.js +1 -0
- package/dist/useHelpbotApi-HC9JSiSn.mjs +229 -0
- package/dist/useTableAgentTools-D5mzGf3A.js +1 -0
- package/dist/useTableAgentTools-DcN3kYRL.mjs +131 -0
- package/dist/vee-validate-zod-BQElPD0m.js +1 -0
- package/dist/vee-validate-zod-CN16K2x9.mjs +1780 -0
- package/package.json +17 -17
- package/src/formBuilder/tools.ts +1 -0
- package/src/table/tools.ts +304 -1
- package/dist/Detail-BCUUNWvp.js +0 -1
- package/dist/Detail-DGg_xXZc.js +0 -1
- package/dist/Detail-Sc2qZdxj.js +0 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +0 -1
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +0 -925
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +0 -5021
- package/dist/TableView-Ctnep-Qu.mjs +0 -6247
- package/dist/TableView-DJqyJL9L.js +0 -4
- package/dist/agenda-B54F8cEr.js +0 -1
- package/dist/orders-BMosTk6r.js +0 -1
- package/dist/reports-BQT_GZzU.js +0 -158
- package/dist/reports-DksZCTOw.mjs +0 -837
- package/dist/vee-validate-zod-SjDT8X35.mjs +0 -4404
- package/dist/vee-validate-zod-VCmLnrtQ.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const _=require("@oneclick.dev/cms-kit");function r(n){return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}function a(...n){const s=n.find(i=>typeof i=="string"&&i.trim());return typeof s=="string"?s.trim():""}function p(...n){for(const s of n){if(typeof s=="number"&&Number.isFinite(s))return s;if(typeof s=="string"&&s.trim()&&Number.isFinite(Number(s)))return Number(s)}}function w(n){if(typeof n!="string")return"available";const s=n.trim().toLowerCase();return["ready","available","complete","completed","indexed","active"].includes(s)?"available":["pending","queued","processing","indexing","uploading"].includes(s)?"processing":["failed","error","unavailable"].includes(s)?"failed":"unknown"}function m(n,s){if(Array.isArray(n))return n;const i=r(n);for(const u of s)if(Array.isArray(i[u]))return i[u];return[]}function T(n){return r(n.metadata)}function x(n){if(typeof n=="string")return{title:"Saved knowledge",excerpt:n};const s=r(n),i=T(s),u=a(s.filename,i.filename,i.file_name,i.source),g=a(s.title,i.title,i.name,u,"Saved knowledge"),y=a(s.excerpt,s.preview,s.text,s.content,s.page_content);return{title:g,excerpt:y,kind:u.toLowerCase().endsWith(".pdf")?"pdf":"answer"}}function z(n,s="Something went wrong. Please try again."){const i=r(n),u=r(i.data);return a(u.statusMessage,u.message,i.statusMessage,i.message,s)}function F(){const n=_.useModuleApi();async function s(){const t=r(await n.get("/helpbot/status")),o=r(t.status),e=r(t.counts),c=r(t.sourceCounts),l=r(t.permissions),b=r(t.agent),h=r(t.server),f=a(typeof t.health=="string"?t.health:void 0,r(t.health).status,r(t.health).state)||void 0,v=a(typeof t.status=="string"?t.status:void 0,t.state,o.state,f).toLowerCase();let d=null;return typeof t.connected=="boolean"?d=t.connected:typeof t.healthy=="boolean"?d=t.healthy:typeof o.connected=="boolean"?d=o.connected:["ok","ready","connected","healthy","available"].includes(v)?d=!0:["error","failed","disconnected","unavailable"].includes(v)&&(d=!1),{configured:typeof t.configured=="boolean"?t.configured:!0,connected:d,health:f,helpbotName:a(b.name,t.helpbotName,t.helpbot_name,t.agentName)||void 0,connectionName:a(h.name,t.connectionName,t.connection_name,t.knowledgeName)||void 0,message:a(t.message,o.message)||void 0,sourceCounts:{texts:p(c.texts,c.answers,e.texts,e.answers),pdfs:p(c.pdfs,c.files,e.pdfs,e.files),chunks:p(c.chunks,e.chunks)},permissions:{canManageKnowledge:l.canManageKnowledge===!0,canTestHelpbot:l.canTestHelpbot===!0}}}async function i(){const t=await n.get("/helpbot/texts");return m(t,["items","texts","data"]).flatMap(o=>{if(typeof o=="string")return[{title:o,preview:"",status:"available"}];const e=r(o),c=a(e.title,e.name);if(!c)return[];const l=a(e.content,e.text);return[{title:c,preview:a(e.preview,e.summary,l),content:l||void 0,status:w(e.status),updatedAt:a(e.updatedAt,e.updated_at,e.createdAt)||void 0}]})}async function u(t){const o=r(await n.get(`/helpbot/texts/${encodeURIComponent(t)}`)),e=r(o.item||o.text||o);return{title:a(e.title,e.name,t),preview:a(e.preview,e.summary),content:a(e.content,e.text),status:w(e.status),updatedAt:a(e.updatedAt,e.updated_at,e.createdAt)||void 0}}function g(t,o){return n.post("/helpbot/texts",{body:{title:t,content:o}})}function y(t,o,e){return n.patch(`/helpbot/texts/${encodeURIComponent(t)}`,{body:{title:o,content:e}})}function A(t){return n.del(`/helpbot/texts/${encodeURIComponent(t)}`)}async function C(){const t=await n.get("/helpbot/files");return m(t,["items","files","data"]).flatMap(o=>{if(typeof o=="string")return[{filename:o,status:"available"}];const e=r(o),c=a(e.filename,e.name,e.title);return c?[{filename:c,status:w(e.status),size:p(e.size,e.sizeBytes,e.size_bytes),pages:p(e.pages,e.pageCount,e.page_count),updatedAt:a(e.updatedAt,e.updated_at,e.createdAt)||void 0}]:[]})}function M(t){const o=new FormData;return o.append("file",t),n.post("/helpbot/files",{body:o})}function N(t){return n.del(`/helpbot/files/${encodeURIComponent(t)}`)}async function k(t){const o=await n.post("/helpbot/query",{body:{question:t}});return m(o,["items","matches","sources","results","data"]).map(x)}async function S(t,o){const e=r(await n.post("/helpbot/chat",{body:{message:t,history:o.map(({role:h,content:f})=>({role:h,content:f}))}})),c=r(e.message),l=a(e.answer,e.content,c.content,typeof e.message=="string"?e.message:void 0),b=m(e,["sources","matches","references"]).map(x);return{answer:l,sources:b}}return{getStatus:s,listTexts:i,getText:u,createText:g,updateText:y,deleteText:A,listFiles:C,uploadFile:M,deleteFile:N,query:k,chat:S}}exports.getHelpbotErrorMessage=z;exports.useHelpbotApi=F;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { useModuleApi as _ } from "@oneclick.dev/cms-kit";
|
|
2
|
+
function r(n) {
|
|
3
|
+
return n && typeof n == "object" && !Array.isArray(n) ? n : {};
|
|
4
|
+
}
|
|
5
|
+
function a(...n) {
|
|
6
|
+
const s = n.find(
|
|
7
|
+
(i) => typeof i == "string" && i.trim()
|
|
8
|
+
);
|
|
9
|
+
return typeof s == "string" ? s.trim() : "";
|
|
10
|
+
}
|
|
11
|
+
function p(...n) {
|
|
12
|
+
for (const s of n) {
|
|
13
|
+
if (typeof s == "number" && Number.isFinite(s)) return s;
|
|
14
|
+
if (typeof s == "string" && s.trim() && Number.isFinite(Number(s)))
|
|
15
|
+
return Number(s);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function w(n) {
|
|
19
|
+
if (typeof n != "string") return "available";
|
|
20
|
+
const s = n.trim().toLowerCase();
|
|
21
|
+
return ["ready", "available", "complete", "completed", "indexed", "active"].includes(s) ? "available" : ["pending", "queued", "processing", "indexing", "uploading"].includes(s) ? "processing" : ["failed", "error", "unavailable"].includes(s) ? "failed" : "unknown";
|
|
22
|
+
}
|
|
23
|
+
function m(n, s) {
|
|
24
|
+
if (Array.isArray(n)) return n;
|
|
25
|
+
const i = r(n);
|
|
26
|
+
for (const u of s)
|
|
27
|
+
if (Array.isArray(i[u])) return i[u];
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
function T(n) {
|
|
31
|
+
return r(n.metadata);
|
|
32
|
+
}
|
|
33
|
+
function x(n) {
|
|
34
|
+
if (typeof n == "string")
|
|
35
|
+
return { title: "Saved knowledge", excerpt: n };
|
|
36
|
+
const s = r(n), i = T(s), u = a(
|
|
37
|
+
s.filename,
|
|
38
|
+
i.filename,
|
|
39
|
+
i.file_name,
|
|
40
|
+
i.source
|
|
41
|
+
), g = a(
|
|
42
|
+
s.title,
|
|
43
|
+
i.title,
|
|
44
|
+
i.name,
|
|
45
|
+
u,
|
|
46
|
+
"Saved knowledge"
|
|
47
|
+
), y = a(
|
|
48
|
+
s.excerpt,
|
|
49
|
+
s.preview,
|
|
50
|
+
s.text,
|
|
51
|
+
s.content,
|
|
52
|
+
s.page_content
|
|
53
|
+
);
|
|
54
|
+
return {
|
|
55
|
+
title: g,
|
|
56
|
+
excerpt: y,
|
|
57
|
+
kind: u.toLowerCase().endsWith(".pdf") ? "pdf" : "answer"
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function F(n, s = "Something went wrong. Please try again.") {
|
|
61
|
+
const i = r(n), u = r(i.data);
|
|
62
|
+
return a(
|
|
63
|
+
u.statusMessage,
|
|
64
|
+
u.message,
|
|
65
|
+
i.statusMessage,
|
|
66
|
+
i.message,
|
|
67
|
+
s
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function R() {
|
|
71
|
+
const n = _();
|
|
72
|
+
async function s() {
|
|
73
|
+
const t = r(await n.get("/helpbot/status")), o = r(t.status), e = r(t.counts), c = r(t.sourceCounts), l = r(t.permissions), b = r(t.agent), h = r(t.server), f = a(
|
|
74
|
+
typeof t.health == "string" ? t.health : void 0,
|
|
75
|
+
r(t.health).status,
|
|
76
|
+
r(t.health).state
|
|
77
|
+
) || void 0, v = a(
|
|
78
|
+
typeof t.status == "string" ? t.status : void 0,
|
|
79
|
+
t.state,
|
|
80
|
+
o.state,
|
|
81
|
+
f
|
|
82
|
+
).toLowerCase();
|
|
83
|
+
let d = null;
|
|
84
|
+
return typeof t.connected == "boolean" ? d = t.connected : typeof t.healthy == "boolean" ? d = t.healthy : typeof o.connected == "boolean" ? d = o.connected : ["ok", "ready", "connected", "healthy", "available"].includes(v) ? d = !0 : ["error", "failed", "disconnected", "unavailable"].includes(v) && (d = !1), {
|
|
85
|
+
configured: typeof t.configured == "boolean" ? t.configured : !0,
|
|
86
|
+
connected: d,
|
|
87
|
+
health: f,
|
|
88
|
+
helpbotName: a(
|
|
89
|
+
b.name,
|
|
90
|
+
t.helpbotName,
|
|
91
|
+
t.helpbot_name,
|
|
92
|
+
t.agentName
|
|
93
|
+
) || void 0,
|
|
94
|
+
connectionName: a(
|
|
95
|
+
h.name,
|
|
96
|
+
t.connectionName,
|
|
97
|
+
t.connection_name,
|
|
98
|
+
t.knowledgeName
|
|
99
|
+
) || void 0,
|
|
100
|
+
message: a(t.message, o.message) || void 0,
|
|
101
|
+
sourceCounts: {
|
|
102
|
+
texts: p(
|
|
103
|
+
c.texts,
|
|
104
|
+
c.answers,
|
|
105
|
+
e.texts,
|
|
106
|
+
e.answers
|
|
107
|
+
),
|
|
108
|
+
pdfs: p(
|
|
109
|
+
c.pdfs,
|
|
110
|
+
c.files,
|
|
111
|
+
e.pdfs,
|
|
112
|
+
e.files
|
|
113
|
+
),
|
|
114
|
+
chunks: p(c.chunks, e.chunks)
|
|
115
|
+
},
|
|
116
|
+
permissions: {
|
|
117
|
+
canManageKnowledge: l.canManageKnowledge === !0,
|
|
118
|
+
canTestHelpbot: l.canTestHelpbot === !0
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function i() {
|
|
123
|
+
const t = await n.get("/helpbot/texts");
|
|
124
|
+
return m(t, ["items", "texts", "data"]).flatMap((o) => {
|
|
125
|
+
if (typeof o == "string")
|
|
126
|
+
return [{ title: o, preview: "", status: "available" }];
|
|
127
|
+
const e = r(o), c = a(e.title, e.name);
|
|
128
|
+
if (!c) return [];
|
|
129
|
+
const l = a(e.content, e.text);
|
|
130
|
+
return [
|
|
131
|
+
{
|
|
132
|
+
title: c,
|
|
133
|
+
preview: a(e.preview, e.summary, l),
|
|
134
|
+
content: l || void 0,
|
|
135
|
+
status: w(e.status),
|
|
136
|
+
updatedAt: a(e.updatedAt, e.updated_at, e.createdAt) || void 0
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async function u(t) {
|
|
142
|
+
const o = r(
|
|
143
|
+
await n.get(`/helpbot/texts/${encodeURIComponent(t)}`)
|
|
144
|
+
), e = r(o.item || o.text || o);
|
|
145
|
+
return {
|
|
146
|
+
title: a(e.title, e.name, t),
|
|
147
|
+
preview: a(e.preview, e.summary),
|
|
148
|
+
content: a(e.content, e.text),
|
|
149
|
+
status: w(e.status),
|
|
150
|
+
updatedAt: a(e.updatedAt, e.updated_at, e.createdAt) || void 0
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function g(t, o) {
|
|
154
|
+
return n.post("/helpbot/texts", { body: { title: t, content: o } });
|
|
155
|
+
}
|
|
156
|
+
function y(t, o, e) {
|
|
157
|
+
return n.patch(`/helpbot/texts/${encodeURIComponent(t)}`, {
|
|
158
|
+
body: { title: o, content: e }
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function A(t) {
|
|
162
|
+
return n.del(`/helpbot/texts/${encodeURIComponent(t)}`);
|
|
163
|
+
}
|
|
164
|
+
async function C() {
|
|
165
|
+
const t = await n.get("/helpbot/files");
|
|
166
|
+
return m(t, ["items", "files", "data"]).flatMap((o) => {
|
|
167
|
+
if (typeof o == "string")
|
|
168
|
+
return [{ filename: o, status: "available" }];
|
|
169
|
+
const e = r(o), c = a(e.filename, e.name, e.title);
|
|
170
|
+
return c ? [
|
|
171
|
+
{
|
|
172
|
+
filename: c,
|
|
173
|
+
status: w(e.status),
|
|
174
|
+
size: p(e.size, e.sizeBytes, e.size_bytes),
|
|
175
|
+
pages: p(e.pages, e.pageCount, e.page_count),
|
|
176
|
+
updatedAt: a(e.updatedAt, e.updated_at, e.createdAt) || void 0
|
|
177
|
+
}
|
|
178
|
+
] : [];
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function N(t) {
|
|
182
|
+
const o = new FormData();
|
|
183
|
+
return o.append("file", t), n.post("/helpbot/files", { body: o });
|
|
184
|
+
}
|
|
185
|
+
function k(t) {
|
|
186
|
+
return n.del(`/helpbot/files/${encodeURIComponent(t)}`);
|
|
187
|
+
}
|
|
188
|
+
async function M(t) {
|
|
189
|
+
const o = await n.post("/helpbot/query", { body: { question: t } });
|
|
190
|
+
return m(o, ["items", "matches", "sources", "results", "data"]).map(
|
|
191
|
+
x
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
async function S(t, o) {
|
|
195
|
+
const e = r(
|
|
196
|
+
await n.post("/helpbot/chat", {
|
|
197
|
+
body: {
|
|
198
|
+
message: t,
|
|
199
|
+
history: o.map(({ role: h, content: f }) => ({ role: h, content: f }))
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
), c = r(e.message), l = a(
|
|
203
|
+
e.answer,
|
|
204
|
+
e.content,
|
|
205
|
+
c.content,
|
|
206
|
+
typeof e.message == "string" ? e.message : void 0
|
|
207
|
+
), b = m(e, ["sources", "matches", "references"]).map(
|
|
208
|
+
x
|
|
209
|
+
);
|
|
210
|
+
return { answer: l, sources: b };
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
getStatus: s,
|
|
214
|
+
listTexts: i,
|
|
215
|
+
getText: u,
|
|
216
|
+
createText: g,
|
|
217
|
+
updateText: y,
|
|
218
|
+
deleteText: A,
|
|
219
|
+
listFiles: C,
|
|
220
|
+
uploadFile: N,
|
|
221
|
+
deleteFile: k,
|
|
222
|
+
query: M,
|
|
223
|
+
chat: S
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
export {
|
|
227
|
+
F as g,
|
|
228
|
+
R as u
|
|
229
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const j=require("@oneclick.dev/cms-kit"),$=require("nuxt/app"),q=require("./dateRangePresets-CPWqst_x.js"),_=require("./row-item-Cyo3m3MZ.js"),p=require("./TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js");function P(o,s=!1){const r=/^\d{4}-\d{2}-\d{2}$/.test(o)?new Date(`${o}T${s?"23:59:59.999":"00:00:00.000"}`):new Date(o);if(Number.isNaN(r.getTime()))throw new Error(`Invalid date "${o}". Use YYYY-MM-DD.`);return s&&!/^\d{4}-\d{2}-\d{2}$/.test(o)&&r.setHours(23,59,59,999),r}function E(o){return o.replace(/-([a-z])/g,(s,r)=>r.toUpperCase())}function I(o,s){let r=o.startDate,d=o.endDate;if(!r&&!d&&o.useDefaultDateRange!==!1&&s){const w=q.getDateRangePresets()[s];w&&(r=w[0],d=w[1]||w[0])}if(!r&&!d)return null;r||=d,d||=r;const f=P(r,!1),g=P(d,!0);if(f.getTime()>g.getTime())throw new Error("The start date must be before the end date.");return{from:f,to:g,startDate:r,endDate:d}}function S(o){const s=$.useNuxtApp(),{runFlow:r}=j.useFlowBuilder(),d=typeof s.$useRoute=="function"?s.$useRoute():null;let f=null;async function g(l={}){return l.fresh&&(f=null),f||(f=(async()=>{const m=s.$useProjectService(),u=s.$useModuleStorage({projectId:o.projectSlug,moduleId:o.instanceId}),[y,t]=await Promise.all([m.getModule(o.projectSlug,o.instanceId),u.getAllModuleData()]),n=Array.isArray(t)?Object.fromEntries(t.filter(e=>e&&typeof e.key=="string").map(e=>[e.key,e.value])):t&&typeof t=="object"?t:{},h=p.normalizeTableColumns(n.columns),a=Array.isArray(n.itemActions)?n.itemActions.filter(e=>e&&typeof e=="object"&&e.id&&e.label&&e.flow).map(e=>({...e})):[];return{moduleRecord:y,config:y?.config||{},columns:h,actions:a,dateRangeFilter:n.dateRangeFilter&&typeof n.dateRangeFilter=="object"?n.dateRangeFilter:null}})().catch(m=>{throw f=null,m}),f)}async function w(l={},m={}){const u=await g({fresh:m.freshMetadata}),y=u.config?.getItems;if(!y)throw new Error("This table has no Fetch items flow configured.");const t=I(l,u.dateRangeFilter?.defaultDate||void 0),n=Object.entries(d?.query||{}).map(([T,D])=>({name:E(T),type:"routeQueryParam",value:D??null})),h=t?[...n,{name:"dateRangeFilter",type:"dateRangeFilter",value:{from:t.from,to:t.to}}]:n,a=await r(y,h),e=p.normalizeTableRows(a),i=u.columns.length?u.columns:p.inferTableColumns(e);let c=[...e],b=null;if(t){const T=!!u.dateRangeFilter?.defaultDate,D=l.dateProperty?p.resolveColumn(l.dateProperty,i)||{property:l.dateProperty}:null,v=i.filter(A=>["date","datetime"].includes(String(A.type||"").toLowerCase())),R=D||(!T&&v.length===1?v[0]:null);if(R?.property){if(!(e.length===0||e.some(F=>p.resolveProperty(F,R.property)!==void 0)))throw new Error(`The date property "${R.property}" does not exist in the fetched rows.`);b=R.property,c=p.applyLocalDateRange(c,R.property,t.from,t.to)}else if(!T)throw new Error("This table has no configured date-range flow and no unambiguous date column. Provide dateProperty using a property reported by inspectTable.")}return c=p.applyTableFilters(c,l.filters||[],i),c=p.applyTableSort(c,l.sortBy,l.sortDirection||"asc",i),{...u,columns:i,sourceRows:e,rows:c,requestedRange:t,localDateProperty:b}}async function C(l,m,u,y){let t=[...y];const n=[];return{flowResult:await r(l.flow,[{name:"item",value:{data:{...m}},type:"object"},{name:"tableActiveRowIndex",type:"number",value:u}],[],[_.createTableRowExtension({tableRowActions:{create:a=>{t=[...t,a],n.push({type:"create",data:a})},update:(a,e,i=!1)=>{t=t.map((c,b)=>b!==a?c:i?{...c,...e}:e),n.push({type:"update",index:a,data:e,merge:i})},remove:a=>{t=t.filter((e,i)=>i!==a),n.push({type:"remove",index:a})}}})]),effects:n,rows:t}}return{loadMetadata:g,loadRows:w,runStoredRowAction:C}}exports.useTableAgentTools=S;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { useFlowBuilder as P } from "@oneclick.dev/cms-kit";
|
|
2
|
+
import { useNuxtApp as j } from "nuxt/app";
|
|
3
|
+
import { g as $ } from "./dateRangePresets-B-l5b_wR.mjs";
|
|
4
|
+
import { c as E } from "./row-item-C1dUyimV.mjs";
|
|
5
|
+
import { n as S, i as I, r as M, a as x, c as k, d as q, e as B, f as N } from "./TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs";
|
|
6
|
+
function A(o, s = !1) {
|
|
7
|
+
const r = /^\d{4}-\d{2}-\d{2}$/.test(o) ? /* @__PURE__ */ new Date(`${o}T${s ? "23:59:59.999" : "00:00:00.000"}`) : new Date(o);
|
|
8
|
+
if (Number.isNaN(r.getTime()))
|
|
9
|
+
throw new Error(`Invalid date "${o}". Use YYYY-MM-DD.`);
|
|
10
|
+
return s && !/^\d{4}-\d{2}-\d{2}$/.test(o) && r.setHours(23, 59, 59, 999), r;
|
|
11
|
+
}
|
|
12
|
+
function Y(o) {
|
|
13
|
+
return o.replace(/-([a-z])/g, (s, r) => r.toUpperCase());
|
|
14
|
+
}
|
|
15
|
+
function z(o, s) {
|
|
16
|
+
let r = o.startDate, d = o.endDate;
|
|
17
|
+
if (!r && !d && o.useDefaultDateRange !== !1 && s) {
|
|
18
|
+
const y = $()[s];
|
|
19
|
+
y && (r = y[0], d = y[1] || y[0]);
|
|
20
|
+
}
|
|
21
|
+
if (!r && !d) return null;
|
|
22
|
+
r ||= d, d ||= r;
|
|
23
|
+
const f = A(r, !1), w = A(d, !0);
|
|
24
|
+
if (f.getTime() > w.getTime())
|
|
25
|
+
throw new Error("The start date must be before the end date.");
|
|
26
|
+
return { from: f, to: w, startDate: r, endDate: d };
|
|
27
|
+
}
|
|
28
|
+
function O(o) {
|
|
29
|
+
const s = j(), { runFlow: r } = P(), d = typeof s.$useRoute == "function" ? s.$useRoute() : null;
|
|
30
|
+
let f = null;
|
|
31
|
+
async function w(l = {}) {
|
|
32
|
+
return l.fresh && (f = null), f || (f = (async () => {
|
|
33
|
+
const p = s.$useProjectService(), u = s.$useModuleStorage({
|
|
34
|
+
projectId: o.projectSlug,
|
|
35
|
+
moduleId: o.instanceId
|
|
36
|
+
}), [m, t] = await Promise.all([
|
|
37
|
+
p.getModule(o.projectSlug, o.instanceId),
|
|
38
|
+
u.getAllModuleData()
|
|
39
|
+
]), a = Array.isArray(t) ? Object.fromEntries(
|
|
40
|
+
t.filter((e) => e && typeof e.key == "string").map((e) => [e.key, e.value])
|
|
41
|
+
) : t && typeof t == "object" ? t : {}, h = N(a.columns), n = Array.isArray(a.itemActions) ? a.itemActions.filter((e) => e && typeof e == "object" && e.id && e.label && e.flow).map((e) => ({ ...e })) : [];
|
|
42
|
+
return {
|
|
43
|
+
moduleRecord: m,
|
|
44
|
+
config: m?.config || {},
|
|
45
|
+
columns: h,
|
|
46
|
+
actions: n,
|
|
47
|
+
dateRangeFilter: a.dateRangeFilter && typeof a.dateRangeFilter == "object" ? a.dateRangeFilter : null
|
|
48
|
+
};
|
|
49
|
+
})().catch((p) => {
|
|
50
|
+
throw f = null, p;
|
|
51
|
+
}), f);
|
|
52
|
+
}
|
|
53
|
+
async function y(l = {}, p = {}) {
|
|
54
|
+
const u = await w({ fresh: p.freshMetadata }), m = u.config?.getItems;
|
|
55
|
+
if (!m)
|
|
56
|
+
throw new Error("This table has no Fetch items flow configured.");
|
|
57
|
+
const t = z(
|
|
58
|
+
l,
|
|
59
|
+
u.dateRangeFilter?.defaultDate || void 0
|
|
60
|
+
), a = Object.entries(d?.query || {}).map(([b, D]) => ({
|
|
61
|
+
name: Y(b),
|
|
62
|
+
type: "routeQueryParam",
|
|
63
|
+
value: D ?? null
|
|
64
|
+
})), h = t ? [...a, {
|
|
65
|
+
name: "dateRangeFilter",
|
|
66
|
+
type: "dateRangeFilter",
|
|
67
|
+
value: {
|
|
68
|
+
from: t.from,
|
|
69
|
+
to: t.to
|
|
70
|
+
}
|
|
71
|
+
}] : a, n = await r(m, h), e = S(n), i = u.columns.length ? u.columns : I(e);
|
|
72
|
+
let c = [...e], R = null;
|
|
73
|
+
if (t) {
|
|
74
|
+
const b = !!u.dateRangeFilter?.defaultDate, D = l.dateProperty ? M(l.dateProperty, i) || { property: l.dateProperty } : null, T = i.filter(
|
|
75
|
+
(v) => ["date", "datetime"].includes(String(v.type || "").toLowerCase())
|
|
76
|
+
), g = D || (!b && T.length === 1 ? T[0] : null);
|
|
77
|
+
if (g?.property) {
|
|
78
|
+
if (!(e.length === 0 || e.some((F) => x(F, g.property) !== void 0)))
|
|
79
|
+
throw new Error(`The date property "${g.property}" does not exist in the fetched rows.`);
|
|
80
|
+
R = g.property, c = k(c, g.property, t.from, t.to);
|
|
81
|
+
} else if (!b)
|
|
82
|
+
throw new Error("This table has no configured date-range flow and no unambiguous date column. Provide dateProperty using a property reported by inspectTable.");
|
|
83
|
+
}
|
|
84
|
+
return c = q(c, l.filters || [], i), c = B(c, l.sortBy, l.sortDirection || "asc", i), {
|
|
85
|
+
...u,
|
|
86
|
+
columns: i,
|
|
87
|
+
sourceRows: e,
|
|
88
|
+
rows: c,
|
|
89
|
+
requestedRange: t,
|
|
90
|
+
localDateProperty: R
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
async function C(l, p, u, m) {
|
|
94
|
+
let t = [...m];
|
|
95
|
+
const a = [];
|
|
96
|
+
return { flowResult: await r(l.flow, [
|
|
97
|
+
{
|
|
98
|
+
name: "item",
|
|
99
|
+
value: { data: { ...p } },
|
|
100
|
+
type: "object"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "tableActiveRowIndex",
|
|
104
|
+
type: "number",
|
|
105
|
+
value: u
|
|
106
|
+
}
|
|
107
|
+
], [], [
|
|
108
|
+
E({
|
|
109
|
+
tableRowActions: {
|
|
110
|
+
create: (n) => {
|
|
111
|
+
t = [...t, n], a.push({ type: "create", data: n });
|
|
112
|
+
},
|
|
113
|
+
update: (n, e, i = !1) => {
|
|
114
|
+
t = t.map((c, R) => R !== n ? c : i ? { ...c, ...e } : e), a.push({ type: "update", index: n, data: e, merge: i });
|
|
115
|
+
},
|
|
116
|
+
remove: (n) => {
|
|
117
|
+
t = t.filter((e, i) => i !== n), a.push({ type: "remove", index: n });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
]), effects: a, rows: t };
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
loadMetadata: w,
|
|
125
|
+
loadRows: y,
|
|
126
|
+
runStoredRowAction: C
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
O as u
|
|
131
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("vue"),Oe=require("./types-BMraG1kN.js");function L(e){return typeof e=="function"}function gt(e){return e==null}const le=e=>e!==null&&!!e&&typeof e=="object"&&!Array.isArray(e);function Ye(e){return Number(e)>=0}function Gt(e){const t=parseFloat(e);return isNaN(t)?e:t}function Ht(e){return typeof e=="object"&&e!==null}function Yt(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}function it(e){if(!Ht(e)||Yt(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ee(e,t){return Object.keys(t).forEach(n=>{if(it(t[n])&&it(e[n])){e[n]||(e[n]={}),Ee(e[n],t[n]);return}e[n]=t[n]}),e}function be(e){const t=e.split(".");if(!t.length)return"";let n=String(t[0]);for(let r=1;r<t.length;r++){if(Ye(t[r])){n+=`[${t[r]}]`;continue}n+=`.${t[r]}`}return n}const Jt={};function Xt(e){return Jt[e]}function lt(e,t,n){typeof n.value=="object"&&(n.value=j(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function j(e){if(typeof e!="object")return e;var t=0,n,r,o,a=Object.prototype.toString.call(e);if(a==="[object Object]"?o=Object.create(e.__proto__||null):a==="[object Array]"?o=Array(e.length):a==="[object Set]"?(o=new Set,e.forEach(function(c){o.add(j(c))})):a==="[object Map]"?(o=new Map,e.forEach(function(c,f){o.set(j(f),j(c))})):a==="[object Date]"?o=new Date(+e):a==="[object RegExp]"?o=new RegExp(e.source,e.flags):a==="[object DataView]"?o=new e.constructor(j(e.buffer)):a==="[object ArrayBuffer]"?o=e.slice(0):a.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t<r.length;t++)lt(o,r[t],Object.getOwnPropertyDescriptor(e,r[t]));for(t=0,r=Object.getOwnPropertyNames(e);t<r.length;t++)Object.hasOwnProperty.call(o,n=r[t])&&o[n]===e[n]||lt(o,n,Object.getOwnPropertyDescriptor(e,n))}return o||e}const Je=Symbol("vee-validate-form"),bt=Symbol("vee-validate-form-context"),Qt=Symbol("vee-validate-field-instance"),ut=Symbol("Default empty value"),Vt=typeof window<"u";function Ze(e){return L(e)&&!!e.__locatorRef}function Y(e){return!!e&&L(e.parse)&&e.__type==="VVTypedSchema"}function Pe(e){return!!e&&L(e.validate)}function Ot(e){return e==="checkbox"||e==="radio"}function en(e){return le(e)||Array.isArray(e)}function tn(e){return Array.isArray(e)?e.length===0:le(e)&&Object.keys(e).length===0}function Ae(e){return/^\[.+\]$/i.test(e)}function nn(e){return _t(e)&&e.multiple}function _t(e){return e.tagName==="SELECT"}function rn(e){return St(e)&&e.target&&"submit"in e.target}function St(e){return e?!!(typeof Event<"u"&&L(Event)&&e instanceof Event||e&&e.srcElement):!1}function M(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,o;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!M(e[r],t[r]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(r of e.entries())if(!t.has(r[0]))return!1;for(r of e.entries())if(!M(r[1],t.get(r[0])))return!1;return!0}if(at(e)&&at(t))return!(e.size!==t.size||e.name!==t.name||e.lastModified!==t.lastModified||e.type!==t.type);if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(r of e.entries())if(!t.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(e=ot(e),t=ot(t),o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){var a=o[r];if(!M(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function ot(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function at(e){return Vt?e instanceof File:!1}function ke(e){return Ae(e)?e.replace(/\[|\]/gi,""):e}function z(e,t,n){return e?Ae(t)?e[ke(t)]:(t||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((o,a)=>en(o)&&a in o?o[a]:n,e):n}function X(e,t,n){if(Ae(t)){e[ke(t)]=n;return}const r=t.split(/\.|\[(\d+)\]/).filter(Boolean);let o=e;for(let a=0;a<r.length;a++){if(a===r.length-1){o[r[a]]=n;return}(!(r[a]in o)||gt(o[r[a]]))&&(o[r[a]]=Ye(r[a+1])?[]:{}),o=o[r[a]]}}function We(e,t){if(Array.isArray(e)&&Ye(t)){e.splice(Number(t),1);return}le(e)&&delete e[t]}function st(e,t){if(Ae(t)){delete e[ke(t)];return}const n=t.split(/\.|\[(\d+)\]/).filter(Boolean);let r=e;for(let a=0;a<n.length;a++){if(a===n.length-1){We(r,n[a]);break}if(!(n[a]in r)||gt(r[n[a]]))break;r=r[n[a]]}const o=n.map((a,c)=>z(e,n.slice(0,c).join(".")));for(let a=o.length-1;a>=0;a--)if(tn(o[a])){if(a===0){We(e,n[0]);continue}We(o[a-1],n[a-1])}}function B(e){return Object.keys(e)}function jt(e,t=void 0){const n=i.getCurrentInstance();return n?.provides[e]||i.inject(e,t)}function ln(e,t,n){if(Array.isArray(e)){const r=[...e],o=r.findIndex(a=>M(a,t));return o>=0?r.splice(o,1):r.push(t),r}return M(e,t)?n:t}function un(e,t){let n,r;return function(...o){const a=this;return n||(n=!0,setTimeout(()=>n=!1,t),r=e.apply(a,o)),r}}function ct(e,t=0){let n=null,r=[];return function(...o){return n&&clearTimeout(n),n=setTimeout(()=>{const a=e(...o);r.forEach(c=>c(a)),r=[]},t),new Promise(a=>r.push(a))}}function on(e,t){return le(t)&&t.number?Gt(e):e}function Ge(e,t){let n;return async function(...o){const a=e(...o);n=a;const c=await a;return a!==n?c:(n=void 0,t(c,o))}}function He(e){return Array.isArray(e)?e:e?[e]:[]}function Ie(e,t){const n={};for(const r in e)t.includes(r)||(n[r]=e[r]);return n}function an(e){let t=null,n=[];return function(...r){const o=i.nextTick(()=>{if(t!==o)return;const a=e(...r);n.forEach(c=>c(a)),n=[],t=null});return t=o,new Promise(a=>n.push(a))}}function Ke(e){if(Et(e))return e._value}function Et(e){return"_value"in e}function sn(e){return e.type==="number"||e.type==="range"?Number.isNaN(e.valueAsNumber)?e.value:e.valueAsNumber:e.value}function Te(e){if(!St(e))return e;const t=e.target;if(Ot(t.type)&&Et(t))return Ke(t);if(t.type==="file"&&t.files){const n=Array.from(t.files);return t.multiple?n:n[0]}if(nn(t))return Array.from(t.options).filter(n=>n.selected&&!n.disabled).map(Ke);if(_t(t)){const n=Array.from(t.options).find(r=>r.selected);return n?Ke(n):t.value}return sn(t)}function At(e){const t={};return Object.defineProperty(t,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),e?le(e)&&e._$$isNormalized?e:le(e)?Object.keys(e).reduce((n,r)=>{const o=cn(e[r]);return e[r]!==!1&&(n[r]=dt(o)),n},t):typeof e!="string"?t:e.split("|").reduce((n,r)=>{const o=dn(r);return o.name&&(n[o.name]=dt(o.params)),n},t):t}function cn(e){return e===!0?[]:Array.isArray(e)||le(e)?e:[e]}function dt(e){const t=n=>typeof n=="string"&&n[0]==="@"?fn(n.slice(1)):n;return Array.isArray(e)?e.map(t):e instanceof RegExp?[e]:Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{})}const dn=e=>{let t=[];const n=e.split(":")[0];return e.includes(":")&&(t=e.split(":").slice(1).join(":").split(",")),{name:n,params:t}};function fn(e){const t=n=>{var r;return(r=z(n,e))!==null&&r!==void 0?r:n[e]};return t.__locatorRef=e,t}function vn(e){return Array.isArray(e)?e.filter(Ze):B(e).filter(t=>Ze(e[t])).map(t=>e[t])}const hn={generateMessage:({field:e})=>`${e} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0};let mn=Object.assign({},hn);const Ve=()=>mn;async function Ct(e,t,n={}){const r=n?.bails,o={name:n?.name||"{field}",rules:t,label:n?.label,bails:r??!0,formData:n?.values||{}},a=await pn(o,e);return Object.assign(Object.assign({},a),{valid:!a.errors.length})}async function pn(e,t){const n=e.rules;if(Y(n)||Pe(n))return gn(t,Object.assign(Object.assign({},e),{rules:n}));if(L(n)||Array.isArray(n)){const f={field:e.label||e.name,name:e.name,label:e.label,form:e.formData,value:t},h=Array.isArray(n)?n:[n],d=h.length,p=[];for(let _=0;_<d;_++){const A=h[_],O=await A(t,f);if(!(typeof O!="string"&&!Array.isArray(O)&&O)){if(Array.isArray(O))p.push(...O);else{const q=typeof O=="string"?O:It(f);p.push(q)}if(e.bails)return{errors:p}}}return{errors:p}}const r=Object.assign(Object.assign({},e),{rules:At(n)}),o=[],a=Object.keys(r.rules),c=a.length;for(let f=0;f<c;f++){const h=a[f],d=await bn(r,t,{name:h,params:r.rules[h]});if(d.error&&(o.push(d.error),e.bails))return{errors:o}}return{errors:o}}function yn(e){return!!e&&e.name==="ValidationError"}function wt(e){return{__type:"VVTypedSchema",async parse(n,r){var o;try{return{output:await e.validate(n,{abortEarly:!1,context:r?.formData||{}}),errors:[]}}catch(a){if(!yn(a))throw a;if(!(!((o=a.inner)===null||o===void 0)&&o.length)&&a.errors.length)return{errors:[{path:a.path,errors:a.errors}]};const c=a.inner.reduce((f,h)=>{const d=h.path||"";return f[d]||(f[d]={errors:[],path:d}),f[d].errors.push(...h.errors),f},{});return{errors:Object.values(c)}}}}}async function gn(e,t){const r=await(Y(t.rules)?t.rules:wt(t.rules)).parse(e,{formData:t.formData}),o=[];for(const a of r.errors)a.errors.length&&o.push(...a.errors);return{value:r.value,errors:o}}async function bn(e,t,n){const r=Xt(n.name);if(!r)throw new Error(`No such validator '${n.name}' exists.`);const o=Vn(n.params,e.formData),a={field:e.label||e.name,name:e.name,label:e.label,value:t,form:e.formData,rule:Object.assign(Object.assign({},n),{params:o})},c=await r(t,o,a);return typeof c=="string"?{error:c}:{error:c?void 0:It(a)}}function It(e){const t=Ve().generateMessage;return t?t(e):"Field is invalid"}function Vn(e,t){const n=r=>Ze(r)?r(t):r;return Array.isArray(e)?e.map(n):Object.keys(e).reduce((r,o)=>(r[o]=n(e[o]),r),{})}async function On(e,t){const r=await(Y(e)?e:wt(e)).parse(j(t),{formData:j(t)}),o={},a={};for(const c of r.errors){const f=c.errors,h=(c.path||"").replace(/\["(\d+)"\]/g,(d,p)=>`[${p}]`);o[h]={valid:!f.length,errors:f},f.length&&(a[h]=f[0])}return{valid:!r.errors.length,results:o,errors:a,values:r.value,source:"schema"}}async function _n(e,t,n){const o=B(e).map(async d=>{var p,_,A;const O=(p=n?.names)===null||p===void 0?void 0:p[d],F=await Ct(z(t,d),e[d],{name:O?.name||d,label:O?.label,values:t,bails:(A=(_=n?.bailsMap)===null||_===void 0?void 0:_[d])!==null&&A!==void 0?A:!0});return Object.assign(Object.assign({},F),{path:d})});let a=!0;const c=await Promise.all(o),f={},h={};for(const d of c)f[d.path]={valid:d.valid,errors:d.errors},d.valid||(a=!1,h[d.path]=d.errors[0]);return{valid:a,results:f,errors:h,source:"schema"}}let ft=0;function Sn(e,t){const{value:n,initialValue:r,setInitialValue:o}=jn(e,t.modelValue,t.form);if(!t.form){let A=function(O){var F;"value"in O&&(n.value=O.value),"errors"in O&&d(O.errors),"touched"in O&&(_.touched=(F=O.touched)!==null&&F!==void 0?F:_.touched),"initialValue"in O&&o(O.initialValue)};const{errors:h,setErrors:d}=Cn(),p=ft>=Number.MAX_SAFE_INTEGER?0:++ft,_=An(n,r,h,t.schema);return{id:p,path:e,value:n,initialValue:r,meta:_,flags:{pendingUnmount:{[p]:!1},pendingReset:!1},errors:h,setState:A}}const a=t.form.createPathState(e,{bails:t.bails,label:t.label,type:t.type,validate:t.validate,schema:t.schema}),c=i.computed(()=>a.errors);function f(h){var d,p,_;"value"in h&&(n.value=h.value),"errors"in h&&((d=t.form)===null||d===void 0||d.setFieldError(i.unref(e),h.errors)),"touched"in h&&((p=t.form)===null||p===void 0||p.setFieldTouched(i.unref(e),(_=h.touched)!==null&&_!==void 0?_:!1)),"initialValue"in h&&o(h.initialValue)}return{id:Array.isArray(a.id)?a.id[a.id.length-1]:a.id,path:e,value:n,errors:c,meta:a,initialValue:r,flags:a.__flags,setState:f}}function jn(e,t,n){const r=i.ref(i.unref(t));function o(){return n?z(n.initialValues.value,i.unref(e),i.unref(r)):i.unref(r)}function a(d){if(!n){r.value=d;return}n.setFieldInitialValue(i.unref(e),d,!0)}const c=i.computed(o);if(!n)return{value:i.ref(o()),initialValue:c,setInitialValue:a};const f=En(t,n,c,e);return n.stageInitialValue(i.unref(e),f,!0),{value:i.computed({get(){return z(n.values,i.unref(e))},set(d){n.setFieldValue(i.unref(e),d,!1)}}),initialValue:c,setInitialValue:a}}function En(e,t,n,r){return i.isRef(e)?i.unref(e):e!==void 0?e:z(t.values,i.unref(r),i.unref(n))}function An(e,t,n,r){const o=i.computed(()=>{var c,f,h;return(h=(f=(c=i.toValue(r))===null||c===void 0?void 0:c.describe)===null||f===void 0?void 0:f.call(c).required)!==null&&h!==void 0?h:!1}),a=i.reactive({touched:!1,pending:!1,valid:!0,required:o,validated:!!i.unref(n).length,initialValue:i.computed(()=>i.unref(t)),dirty:i.computed(()=>!M(i.unref(e),i.unref(t)))});return i.watch(n,c=>{a.valid=!c.length},{immediate:!0,flush:"sync"}),a}function Cn(){const e=i.ref([]);return{errors:e,setErrors:t=>{e.value=He(t)}}}const _e={},Se={},je="vee-validate-inspector",$={error:12405579,success:448379,unknown:5522283,white:16777215,black:0,blue:218007,purple:12157168,orange:16099682,gray:12304330};let T=null,te;async function Ft(e){if(process.env.NODE_ENV!=="production"){if(!Vt)return;(await Promise.resolve().then(()=>require("./index-CZau1wR8.js"))).setupDevtoolsPlugin({id:"vee-validate-devtools-plugin",label:"VeeValidate Plugin",packageName:"vee-validate",homepage:"https://vee-validate.logaretm.com/v4",app:e,logo:"https://vee-validate.logaretm.com/v4/logo.png"},n=>{te=n,n.addInspector({id:je,icon:"rule",label:"vee-validate",noSelectionText:"Select a vee-validate node to inspect",actions:[{icon:"done_outline",tooltip:"Validate selected item",action:async()=>{if(!T){console.error("There is not a valid selected vee-validate node or component");return}if(T.type==="field"){await T.field.validate();return}if(T.type==="form"){await T.form.validate();return}T.type==="pathState"&&await T.form.validateField(T.state.path)}},{icon:"delete_sweep",tooltip:"Clear validation state of the selected item",action:()=>{if(!T){console.error("There is not a valid selected vee-validate node or component");return}if(T.type==="field"){T.field.resetField();return}T.type==="form"&&T.form.resetForm(),T.type==="pathState"&&T.form.resetField(T.state.path)}}]}),n.on.getInspectorTree(r=>{if(r.inspectorId!==je)return;const o=Object.values(_e),a=Object.values(Se);r.rootNodes=[...o.map(Fn),...a.map(c=>Tn(c))]}),n.on.getInspectorState(r=>{if(r.inspectorId!==je)return;const{form:o,field:a,state:c,type:f}=kn(r.nodeId);if(n.unhighlightElement(),o&&f==="form"){r.state=Nn(o),T={type:"form",form:o},n.highlightElement(o._vm);return}if(c&&f==="pathState"&&o){r.state=vt(c),T={type:"pathState",state:c,form:o};return}if(a&&f==="field"){r.state=vt({errors:a.errors.value,dirty:a.meta.dirty,valid:a.meta.valid,touched:a.meta.touched,value:a.value.value,initialValue:a.meta.initialValue}),T={field:a,type:"field"},n.highlightElement(a._vm);return}T=null,n.unhighlightElement()})})}}const pe=un(()=>{setTimeout(async()=>{await i.nextTick(),te?.sendInspectorState(je),te?.sendInspectorTree(je)},100)},100);function wn(e){const t=i.getCurrentInstance();if(!te){const n=t?.appContext.app;if(!n)return;Ft(n)}_e[e.formId]=Object.assign({},e),_e[e.formId]._vm=t,i.onUnmounted(()=>{delete _e[e.formId],pe()}),pe()}function In(e){const t=i.getCurrentInstance();if(!te){const n=t?.appContext.app;if(!n)return;Ft(n)}Se[e.id]=Object.assign({},e),Se[e.id]._vm=t,i.onUnmounted(()=>{delete Se[e.id],pe()}),pe()}function Fn(e){const{textColor:t,bgColor:n}=Tt(e.meta.value.valid),r={};Object.values(e.getAllPathStates()).forEach(c=>{X(r,i.toValue(c.path),Pn(c,e))});function o(c,f=[]){const h=[...f].pop();return"id"in c?Object.assign(Object.assign({},c),{label:h||c.label}):le(c)?{id:`${f.join(".")}`,label:h||"",children:Object.keys(c).map(d=>o(c[d],[...f,d]))}:Array.isArray(c)?{id:`${f.join(".")}`,label:`${h}[]`,children:c.map((d,p)=>o(d,[...f,String(p)]))}:{id:"",label:"",children:[]}}const{children:a}=o(r);return{id:Xe(e),label:e.name,children:a,tags:[{label:"Form",textColor:t,backgroundColor:n},{label:`${e.getAllPathStates().length} fields`,textColor:$.white,backgroundColor:$.unknown}]}}function Pn(e,t){return{id:Xe(t,e),label:i.toValue(e.path),tags:Pt(e.multiple,e.fieldsCount,e.type,e.valid,t)}}function Tn(e,t){return{id:Xe(t,e),label:i.unref(e.name),tags:Pt(!1,1,e.type,e.meta.valid,t)}}function Pt(e,t,n,r,o){const{textColor:a,bgColor:c}=Tt(r);return[e?void 0:{label:"Field",textColor:a,backgroundColor:c},o?void 0:{label:"Standalone",textColor:$.black,backgroundColor:$.gray},n==="checkbox"?{label:"Checkbox",textColor:$.white,backgroundColor:$.blue}:void 0,n==="radio"?{label:"Radio",textColor:$.white,backgroundColor:$.purple}:void 0,e?{label:"Multiple",textColor:$.black,backgroundColor:$.orange}:void 0].filter(Boolean)}function Xe(e,t){const n=t?"path"in t?"pathState":"field":"form",r=t?"path"in t?t?.path:i.toValue(t?.name):"",o={f:e?.formId,ff:t?.id||r,type:n};return btoa(encodeURIComponent(JSON.stringify(o)))}function kn(e){try{const t=JSON.parse(decodeURIComponent(atob(e))),n=_e[t.f];if(!n&&t.ff){const o=Se[t.ff];return o?{type:t.type,field:o}:{}}if(!n)return{};const r=n.getPathState(t.ff);return{type:t.type,form:n,state:r}}catch{}return{}}function vt(e){return{"Field state":[{key:"errors",value:e.errors},{key:"initialValue",value:e.initialValue},{key:"currentValue",value:e.value},{key:"touched",value:e.touched},{key:"dirty",value:e.dirty},{key:"valid",value:e.valid}]}}function Nn(e){const{errorBag:t,meta:n,values:r,isSubmitting:o,isValidating:a,submitCount:c}=e;return{"Form state":[{key:"submitCount",value:c.value},{key:"isSubmitting",value:o.value},{key:"isValidating",value:a.value},{key:"touched",value:n.value.touched},{key:"dirty",value:n.value.dirty},{key:"valid",value:n.value.valid},{key:"initialValues",value:n.value.initialValues},{key:"currentValues",value:r},{key:"errors",value:B(t.value).reduce((f,h)=>{var d;const p=(d=t.value[h])===null||d===void 0?void 0:d[0];return p&&(f[h]=p),f},{})}]}}function Tt(e){return{bgColor:e?$.success:$.error,textColor:e?$.black:$.white}}function xn(e,t,n){return Ot(void 0)?Dn(e,t):kt(e,t)}function kt(e,t,n){const{initialValue:r,validateOnMount:o,bails:a,type:c,checkedValue:f,label:h,validateOnValueUpdate:d,uncheckedValue:p,controlled:_,keepValueOnUnmount:A,syncVModel:O,form:F}=Rn(),q=_?jt(Je):void 0,S=F||q,W=i.computed(()=>be(i.toValue(e))),H=i.computed(()=>{if(i.toValue(S?.schema))return;const V=i.unref(t);return Pe(V)||Y(V)||L(V)||Array.isArray(V)?V:At(V)}),Ne=!L(H.value)&&Y(i.toValue(t)),{id:de,value:ue,initialValue:oe,meta:k,setState:fe,errors:ve,flags:ae}=Sn(W,{modelValue:r,form:S,bails:a,label:h,type:c,validate:H.value?re:void 0,schema:Ne?t:void 0}),K=i.computed(()=>ve.value[0]);O&&Mn({value:ue,prop:O,handleChange:N,shouldValidate:()=>d&&!ae.pendingReset});const he=(m,V=!1)=>{k.touched=!0,V&&ne()};async function Ce(m){var V,C;if(S?.validateSchema){const{results:E}=await S.validateSchema(m);return(V=E[i.toValue(W)])!==null&&V!==void 0?V:{valid:!0,errors:[]}}return H.value?Ct(ue.value,H.value,{name:i.toValue(W),label:i.toValue(h),values:(C=S?.values)!==null&&C!==void 0?C:{},bails:a}):{valid:!0,errors:[]}}const ne=Ge(async()=>(k.pending=!0,k.validated=!0,Ce("validated-only")),m=>(ae.pendingUnmount[x.id]||(fe({errors:m.errors}),k.pending=!1,k.valid=m.valid),m)),Q=Ge(async()=>Ce("silent"),m=>(k.valid=m.valid,m));function re(m){return m?.mode==="silent"?Q():ne()}function N(m,V=!0){const C=Te(m);ye(C,V)}i.onMounted(()=>{if(o)return ne();(!S||!S.validateSchema)&&Q()});function xe(m){k.touched=m}function ie(m){var V;const C=m&&"value"in m?m.value:oe.value;fe({value:j(C),initialValue:j(C),touched:(V=m?.touched)!==null&&V!==void 0?V:!1,errors:m?.errors||[]}),k.pending=!1,k.validated=!1,Q()}const se=i.getCurrentInstance();function ye(m,V=!0){ue.value=se&&O?on(m,se.props.modelModifiers):m,(V?ne:Q)()}function we(m){fe({errors:Array.isArray(m)?m:[m]})}const Qe=i.computed({get(){return ue.value},set(m){ye(m,d)}}),x={id:de,name:W,label:h,value:Qe,meta:k,errors:ve,errorMessage:K,type:c,checkedValue:f,uncheckedValue:p,bails:a,keepValueOnUnmount:A,resetField:ie,handleReset:()=>ie(),validate:re,handleChange:N,handleBlur:he,setState:fe,setTouched:xe,setErrors:we,setValue:ye};if(i.provide(Qt,x),i.isRef(t)&&typeof i.unref(t)!="function"&&i.watch(t,(m,V)=>{M(m,V)||(k.validated?ne():Q())},{deep:!0}),process.env.NODE_ENV!=="production"&&(x._vm=i.getCurrentInstance(),i.watch(()=>Object.assign(Object.assign({errors:ve.value},k),{value:ue.value}),pe,{deep:!0}),S||In(x)),!S)return x;const Re=i.computed(()=>{const m=H.value;return!m||L(m)||Pe(m)||Y(m)||Array.isArray(m)?{}:Object.keys(m).reduce((V,C)=>{const E=vn(m[C]).map(ee=>ee.__locatorRef).reduce((ee,J)=>{const Z=z(S.values,J)||S.values[J];return Z!==void 0&&(ee[J]=Z),ee},{});return Object.assign(V,E),V},{})});return i.watch(Re,(m,V)=>{if(!Object.keys(m).length)return;!M(m,V)&&(k.validated?ne():Q())}),i.onBeforeUnmount(()=>{var m;const V=(m=i.toValue(x.keepValueOnUnmount))!==null&&m!==void 0?m:i.toValue(S.keepValuesOnUnmount),C=i.toValue(W);if(V||!S||ae.pendingUnmount[x.id]){S?.removePathState(C,de);return}ae.pendingUnmount[x.id]=!0;const E=S.getPathState(C);if(Array.isArray(E?.id)&&E?.multiple?E?.id.includes(x.id):E?.id===x.id){if(E?.multiple&&Array.isArray(E.value)){const J=E.value.findIndex(Z=>M(Z,i.toValue(x.checkedValue)));if(J>-1){const Z=[...E.value];Z.splice(J,1),S.setFieldValue(C,Z)}Array.isArray(E.id)&&E.id.splice(E.id.indexOf(x.id),1)}else S.unsetPathValue(i.toValue(W));S.removePathState(C,de)}}),x}function Rn(e){return Object.assign(Object.assign({},{initialValue:void 0,validateOnMount:!1,bails:!0,label:void 0,validateOnValueUpdate:!0,keepValueOnUnmount:void 0,syncVModel:!1,controlled:!0}),{initialValue:void 0})}function Dn(e,t,n){const r=jt(Je),o=void 0,a=void 0;function c(f){const h=f.handleChange,d=i.computed(()=>{const _=i.toValue(f.value),A=i.toValue(o);return Array.isArray(_)?_.findIndex(O=>M(O,A))>=0:M(A,_)});function p(_,A=!0){var O,F;if(d.value===((O=_?.target)===null||O===void 0?void 0:O.checked)){A&&f.validate();return}const q=i.toValue(e),S=r?.getPathState(q),W=Te(_);let H=(F=i.toValue(o))!==null&&F!==void 0?F:W;r&&S?.multiple&&S.type==="checkbox"&&(H=ln(z(r.values,q)||[],H,void 0)),h(H,A)}return Object.assign(Object.assign({},f),{checked:d,checkedValue:o,uncheckedValue:a,handleChange:p})}return c(kt(e,t))}function Mn({prop:e,value:t,handleChange:n,shouldValidate:r}){const o=i.getCurrentInstance();if(!o||!e){process.env.NODE_ENV!=="production"&&console.warn("Failed to setup model events because `useField` was not called in setup.");return}const a=typeof e=="string"?e:"modelValue",c=`update:${a}`;a in o.props&&(i.watch(t,f=>{M(f,ht(o,a))||o.emit(c,f)}),i.watch(()=>ht(o,a),f=>{if(f===ut&&t.value===void 0)return;const h=f===ut?void 0:f;M(h,t.value)||n(h,r())}))}function ht(e,t){if(e)return e.props[t]}let Un=0;const Fe=["bails","fieldsCount","id","multiple","type","validate"];function Nt(e){const t=e?.initialValues||{},n=Object.assign({},i.toValue(t)),r=i.unref(e?.validationSchema);return r&&Y(r)&&L(r.cast)?j(r.cast(n)||{}):j(n)}function Bn(e){var t;const n=Un++,r=e?.name||"Form";let o=0;const a=i.ref(!1),c=i.ref(!1),f=i.ref(0),h=[],d=i.reactive(Nt(e)),p=i.ref([]),_=i.ref({}),A=i.ref({}),O=an(()=>{A.value=p.value.reduce((u,l)=>(u[be(i.toValue(l.path))]=l,u),{})});function F(u,l){const s=N(u);if(!s){typeof u=="string"&&(_.value[be(u)]=He(l));return}if(typeof u=="string"){const v=be(u);_.value[v]&&delete _.value[v]}s.errors=He(l),s.valid=!s.errors.length}function q(u){B(u).forEach(l=>{F(l,u[l])})}e?.initialErrors&&q(e.initialErrors);const S=i.computed(()=>{const u=p.value.reduce((l,s)=>(s.errors.length&&(l[i.toValue(s.path)]=s.errors),l),{});return Object.assign(Object.assign({},_.value),u)}),W=i.computed(()=>B(S.value).reduce((u,l)=>{const s=S.value[l];return s?.length&&(u[l]=s[0]),u},{})),H=i.computed(()=>p.value.reduce((u,l)=>(u[i.toValue(l.path)]={name:i.toValue(l.path)||"",label:l.label||""},u),{})),Ne=i.computed(()=>p.value.reduce((u,l)=>{var s;return u[i.toValue(l.path)]=(s=l.bails)!==null&&s!==void 0?s:!0,u},{})),de=Object.assign({},e?.initialErrors||{}),ue=(t=e?.keepValuesOnUnmount)!==null&&t!==void 0?t:!1,{initialValues:oe,originalInitialValues:k,setInitialValues:fe}=Ln(p,d,e),ve=$n(p,d,k,W),ae=i.computed(()=>p.value.reduce((u,l)=>{const s=z(d,i.toValue(l.path));return X(u,i.toValue(l.path),s),u},{})),K=e?.validationSchema;function he(u,l){var s,v;const g=i.computed(()=>z(oe.value,i.toValue(u))),b=A.value[i.toValue(u)],y=l?.type==="checkbox"||l?.type==="radio";if(b&&y){b.multiple=!0;const G=o++;return Array.isArray(b.id)?b.id.push(G):b.id=[b.id,G],b.fieldsCount++,b.__flags.pendingUnmount[G]=!1,b}const I=i.computed(()=>z(d,i.toValue(u))),P=i.toValue(u),R=ie.findIndex(G=>G===P);R!==-1&&ie.splice(R,1);const w=i.computed(()=>{var G,ge,$e,Le;const ze=i.toValue(K);if(Y(ze))return(ge=(G=ze.describe)===null||G===void 0?void 0:G.call(ze,i.toValue(u)).required)!==null&&ge!==void 0?ge:!1;const qe=i.toValue(l?.schema);return Y(qe)&&(Le=($e=qe.describe)===null||$e===void 0?void 0:$e.call(qe).required)!==null&&Le!==void 0?Le:!1}),D=o++,U=i.reactive({id:D,path:u,touched:!1,pending:!1,valid:!0,validated:!!(!((s=de[P])===null||s===void 0)&&s.length),required:w,initialValue:g,errors:i.shallowRef([]),bails:(v=l?.bails)!==null&&v!==void 0?v:!1,label:l?.label,type:l?.type||"default",value:I,multiple:!1,__flags:{pendingUnmount:{[D]:!1},pendingReset:!1},fieldsCount:1,validate:l?.validate,dirty:i.computed(()=>!M(i.unref(I),i.unref(g)))});return p.value.push(U),A.value[P]=U,O(),W.value[P]&&!de[P]&&i.nextTick(()=>{ce(P,{mode:"silent"})}),i.isRef(u)&&i.watch(u,G=>{O();const ge=j(I.value);A.value[G]=U,i.nextTick(()=>{X(d,G,ge)})}),U}const Ce=ct(nt,5),ne=ct(nt,5),Q=Ge(async u=>await(u==="silent"?Ce():ne()),(u,[l])=>{const s=B(V.errorBag.value),g=[...new Set([...B(u.results),...p.value.map(b=>b.path),...s])].sort().reduce((b,y)=>{var I;const P=y,R=N(P)||xe(P),w=((I=u.results[P])===null||I===void 0?void 0:I.errors)||[],D=i.toValue(R?.path)||P,U=zn({errors:w,valid:!w.length},b.results[D]);return b.results[D]=U,U.valid||(b.errors[D]=U.errors[0]),R&&_.value[D]&&delete _.value[D],R?(R.valid=U.valid,l==="silent"||l==="validated-only"&&!R.validated||F(R,U.errors),b):(F(D,w),b)},{valid:u.valid,results:{},errors:{},source:u.source});return u.values&&(g.values=u.values,g.source=u.source),B(g.results).forEach(b=>{var y;const I=N(b);I&&l!=="silent"&&(l==="validated-only"&&!I.validated||F(I,(y=g.results[b])===null||y===void 0?void 0:y.errors))}),g});function re(u){p.value.forEach(u)}function N(u){const l=typeof u=="string"?be(u):u;return typeof l=="string"?A.value[l]:l}function xe(u){return p.value.filter(s=>u.startsWith(i.toValue(s.path))).reduce((s,v)=>s?v.path.length>s.path.length?v:s:v,void 0)}let ie=[],se;function ye(u){return ie.push(u),se||(se=i.nextTick(()=>{[...ie].sort().reverse().forEach(s=>{st(d,s)}),ie=[],se=null})),se}function we(u){return function(s,v){return function(b){return b instanceof Event&&(b.preventDefault(),b.stopPropagation()),re(y=>y.touched=!0),a.value=!0,f.value++,me().then(y=>{const I=j(d);if(y.valid&&typeof s=="function"){const P=j(ae.value);let R=u?P:I;return y.values&&(R=y.source==="schema"?y.values:Object.assign({},R,y.values)),s(R,{evt:b,controlledValues:P,setErrors:q,setFieldError:F,setTouched:De,setFieldTouched:Z,setValues:ee,setFieldValue:C,resetForm:Me,resetField:et})}!y.valid&&typeof v=="function"&&v({values:I,evt:b,errors:y.errors,results:y.results})}).then(y=>(a.value=!1,y),y=>{throw a.value=!1,y})}}}const x=we(!1);x.withControlled=we(!0);function Re(u,l){const s=p.value.findIndex(g=>g.path===u&&(Array.isArray(g.id)?g.id.includes(l):g.id===l)),v=p.value[s];if(!(s===-1||!v)){if(i.nextTick(()=>{ce(u,{mode:"silent",warn:!1})}),v.multiple&&v.fieldsCount&&v.fieldsCount--,Array.isArray(v.id)){const g=v.id.indexOf(l);g>=0&&v.id.splice(g,1),delete v.__flags.pendingUnmount[l]}(!v.multiple||v.fieldsCount<=0)&&(p.value.splice(s,1),tt(u),O(),delete A.value[u])}}function m(u){B(A.value).forEach(l=>{l.startsWith(u)&&delete A.value[l]}),p.value=p.value.filter(l=>!l.path.startsWith(u)),i.nextTick(()=>{O()})}const V={name:r,formId:n,values:d,controlledValues:ae,errorBag:S,errors:W,schema:K,submitCount:f,meta:ve,isSubmitting:a,isValidating:c,fieldArrays:h,keepValuesOnUnmount:ue,validateSchema:i.unref(K)?Q:void 0,validate:me,setFieldError:F,validateField:ce,setFieldValue:C,setValues:ee,setErrors:q,setFieldTouched:Z,setTouched:De,resetForm:Me,resetField:et,handleSubmit:x,useFieldModel:Wt,defineInputBinds:Kt,defineComponentBinds:Zt,defineField:Be,stageInitialValue:zt,unsetInitialValue:tt,setFieldInitialValue:Ue,createPathState:he,getPathState:N,unsetPathValue:ye,removePathState:Re,initialValues:oe,getAllPathStates:()=>p.value,destroyPath:m,isFieldTouched:Bt,isFieldDirty:$t,isFieldValid:Lt};function C(u,l,s=!0){const v=j(l),g=typeof u=="string"?u:u.path;N(g)||he(g),X(d,g,v),s&&ce(g)}function E(u,l=!0){B(d).forEach(s=>{delete d[s]}),B(u).forEach(s=>{C(s,u[s],!1)}),l&&me()}function ee(u,l=!0){Ee(d,u),h.forEach(s=>s&&s.reset()),l&&me()}function J(u,l){const s=N(i.toValue(u))||he(u);return i.computed({get(){return s.value},set(v){var g;const b=i.toValue(u);C(b,v,(g=i.toValue(l))!==null&&g!==void 0?g:!1)}})}function Z(u,l){const s=N(u);s&&(s.touched=l)}function Bt(u){const l=N(u);return l?l.touched:p.value.filter(s=>s.path.startsWith(u)).some(s=>s.touched)}function $t(u){const l=N(u);return l?l.dirty:p.value.filter(s=>s.path.startsWith(u)).some(s=>s.dirty)}function Lt(u){const l=N(u);return l?l.valid:p.value.filter(s=>s.path.startsWith(u)).every(s=>s.valid)}function De(u){if(typeof u=="boolean"){re(l=>{l.touched=u});return}B(u).forEach(l=>{Z(l,!!u[l])})}function et(u,l){var s;const v=l&&"value"in l?l.value:z(oe.value,u),g=N(u);g&&(g.__flags.pendingReset=!0),Ue(u,j(v),!0),C(u,v,!1),Z(u,(s=l?.touched)!==null&&s!==void 0?s:!1),F(u,l?.errors||[]),i.nextTick(()=>{g&&(g.__flags.pendingReset=!1)})}function Me(u,l){let s=j(u?.values?u.values:k.value);s=l?.force?s:Ee(k.value,s),s=Y(K)&&L(K.cast)?K.cast(s):s,fe(s,{force:l?.force}),re(v=>{var g;v.__flags.pendingReset=!0,v.validated=!1,v.touched=((g=u?.touched)===null||g===void 0?void 0:g[i.toValue(v.path)])||!1,C(i.toValue(v.path),z(s,i.toValue(v.path)),!1),F(i.toValue(v.path),void 0)}),l?.force?E(s,!1):ee(s,!1),q(u?.errors||{}),f.value=u?.submitCount||0,i.nextTick(()=>{me({mode:"silent"}),re(v=>{v.__flags.pendingReset=!1})})}async function me(u){const l=u?.mode||"force";if(l==="force"&&re(y=>y.validated=!0),V.validateSchema)return V.validateSchema(l);c.value=!0;const s=await Promise.all(p.value.map(y=>y.validate?y.validate(u).then(I=>({key:i.toValue(y.path),valid:I.valid,errors:I.errors,value:I.value})):Promise.resolve({key:i.toValue(y.path),valid:!0,errors:[],value:void 0})));c.value=!1;const v={},g={},b={};for(const y of s)v[y.key]={valid:y.valid,errors:y.errors},y.value&&X(b,y.key,y.value),y.errors.length&&(g[y.key]=y.errors[0]);return{valid:s.every(y=>y.valid),results:v,errors:g,values:b,source:"fields"}}async function ce(u,l){var s;const v=N(u);if(v&&l?.mode!=="silent"&&(v.validated=!0),K){const{results:b}=await Q(l?.mode||"validated-only");return b[u]||{errors:[],valid:!0}}return v?.validate?v.validate(l):(!v&&(!((s=l?.warn)!==null&&s!==void 0)||s)&&process.env.NODE_ENV!=="production"&&i.warn(`field with path ${u} was not found`),Promise.resolve({errors:[],valid:!0}))}function tt(u){st(oe.value,u)}function zt(u,l,s=!1){Ue(u,l),X(d,u,l),s&&!e?.initialValues&&X(k.value,u,j(l))}function Ue(u,l,s=!1){X(oe.value,u,j(l)),s&&X(k.value,u,j(l))}async function nt(){const u=i.unref(K);if(!u)return{valid:!0,results:{},errors:{},source:"none"};c.value=!0;const l=Pe(u)||Y(u)?await On(u,d):await _n(u,d,{names:H.value,bailsMap:Ne.value});return c.value=!1,l}const qt=x((u,{evt:l})=>{rn(l)&&l.target.submit()});i.onMounted(()=>{if(e?.initialErrors&&q(e.initialErrors),e?.initialTouched&&De(e.initialTouched),e?.validateOnMount){me();return}V.validateSchema&&V.validateSchema("silent")}),i.isRef(K)&&i.watch(K,()=>{var u;(u=V.validateSchema)===null||u===void 0||u.call(V,"validated-only")}),i.provide(Je,V),process.env.NODE_ENV!=="production"&&(wn(V),i.watch(()=>Object.assign(Object.assign({errors:S.value},ve.value),{values:d,isSubmitting:a.value,isValidating:c.value,submitCount:f.value}),pe,{deep:!0}));function Be(u,l){const s=L(l)?void 0:l?.label,v=N(i.toValue(u))||he(u,{label:s}),g=()=>L(l)?l(Ie(v,Fe)):l||{};function b(){var w;v.touched=!0,((w=g().validateOnBlur)!==null&&w!==void 0?w:Ve().validateOnBlur)&&ce(i.toValue(v.path))}function y(){var w;((w=g().validateOnInput)!==null&&w!==void 0?w:Ve().validateOnInput)&&i.nextTick(()=>{ce(i.toValue(v.path))})}function I(){var w;((w=g().validateOnChange)!==null&&w!==void 0?w:Ve().validateOnChange)&&i.nextTick(()=>{ce(i.toValue(v.path))})}const P=i.computed(()=>{const w={onChange:I,onInput:y,onBlur:b};return L(l)?Object.assign(Object.assign({},w),l(Ie(v,Fe)).props||{}):l?.props?Object.assign(Object.assign({},w),l.props(Ie(v,Fe))):w});return[J(u,()=>{var w,D,U;return(U=(w=g().validateOnModelUpdate)!==null&&w!==void 0?w:(D=Ve())===null||D===void 0?void 0:D.validateOnModelUpdate)!==null&&U!==void 0?U:!0}),P]}function Wt(u){return Array.isArray(u)?u.map(l=>J(l,!0)):J(u)}function Kt(u,l){const[s,v]=Be(u,l);function g(){v.value.onBlur()}function b(I){const P=Te(I);C(i.toValue(u),P,!1),v.value.onInput()}function y(I){const P=Te(I);C(i.toValue(u),P,!1),v.value.onChange()}return i.computed(()=>Object.assign(Object.assign({},v.value),{onBlur:g,onInput:b,onChange:y,value:s.value}))}function Zt(u,l){const[s,v]=Be(u,l),g=N(i.toValue(u));function b(y){s.value=y}return i.computed(()=>{const y=L(l)?l(Ie(g,Fe)):l||{};return Object.assign({[y.model||"modelValue"]:s.value,[`onUpdate:${y.model||"modelValue"}`]:b},v.value)})}const rt=Object.assign(Object.assign({},V),{values:i.readonly(d),handleReset:()=>Me(),submitForm:qt});return i.provide(bt,rt),rt}function $n(e,t,n,r){const o={touched:"some",pending:"some",valid:"every"},a=i.computed(()=>!M(t,i.unref(n)));function c(){const h=e.value;return B(o).reduce((d,p)=>{const _=o[p];return d[p]=h[_](A=>A[p]),d},{})}const f=i.reactive(c());return i.watchEffect(()=>{const h=c();f.touched=h.touched,f.valid=h.valid,f.pending=h.pending}),i.computed(()=>Object.assign(Object.assign({initialValues:i.unref(n)},f),{valid:f.valid&&!B(r.value).length,dirty:a.value}))}function Ln(e,t,n){const r=Nt(n),o=i.ref(r),a=i.ref(j(r));function c(f,h){h?.force?(o.value=j(f),a.value=j(f)):(o.value=Ee(j(o.value)||{},j(f)),a.value=Ee(j(a.value)||{},j(f))),h?.updateFields&&e.value.forEach(d=>{if(d.touched)return;const _=z(o.value,i.toValue(d.path));X(t,i.toValue(d.path),j(_))})}return{initialValues:o,originalInitialValues:a,setInitialValues:c}}function zn(e,t){return t?{valid:e.valid&&t.valid,errors:[...e.errors,...t.errors]}:e}function qn(){return i.inject(bt)}const mt=e=>e!==null&&!!e&&typeof e=="object"&&!Array.isArray(e);function xt(e){return Number(e)>=0}function Wn(e){return typeof e=="object"&&e!==null}function Kn(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}function pt(e){if(!Wn(e)||Kn(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Rt(e,t){return Object.keys(t).forEach(n=>{if(pt(t[n])&&pt(e[n])){e[n]||(e[n]={}),Rt(e[n],t[n]);return}e[n]=t[n]}),e}function Zn(e){const t=e.split(".");if(!t.length)return"";let n=String(t[0]);for(let r=1;r<t.length;r++){if(xt(t[r])){n+=`[${t[r]}]`;continue}n+=`.${t[r]}`}return n}function Gn(e,t){return{__type:"VVTypedSchema",async parse(r){const o=await e.safeParseAsync(r,t);if(o.success)return{value:o.data,errors:[]};const a={};return Dt(o.error.issues,a),{errors:Object.values(a)}},cast(r){try{return e.parse(r)}catch{const a=Mt(e);return mt(a)&&mt(r)?Rt(a,r):r}},describe(r){try{if(!r)return{required:!e.isOptional(),exists:!0};const o=Hn(r,e);return o?{required:!o.isOptional(),exists:!0}:{required:!1,exists:!1}}catch{return process.env.NODE_ENV!=="production"&&console.warn(`Failed to describe path ${r} on the schema, returning a default description.`),{required:!1,exists:!1}}}}}function Dt(e,t){e.forEach(n=>{const r=Zn(n.path.join("."));n.code==="invalid_union"&&(Dt(n.unionErrors.flatMap(o=>o.issues),t),!r)||(t[r]||(t[r]={errors:[],path:r}),t[r].errors.push(n.message))})}function Mt(e){if(e instanceof Oe.ZodObject)return Object.fromEntries(Object.entries(e.shape).map(([t,n])=>n instanceof Oe.ZodDefault?[t,n._def.defaultValue()]:n instanceof Oe.ZodObject?[t,Mt(n)]:[t,void 0]))}function Hn(e,t){if(!yt(t))return null;if(Ae(e))return t.shape[ke(e)];const n=(e||"").split(/\.|\[(\d+)\]/).filter(Boolean);let r=t;for(let o=0;o<=n.length;o++){const a=n[o];if(!a||!r)return r;if(yt(r)){r=r.shape[a]||null;continue}xt(a)&&Yn(r)&&(r=r._def.type)}return null}function Ut(e){return e._def.typeName}function Yn(e){return Ut(e)===Oe.ZodFirstPartyTypeKind.ZodArray}function yt(e){return Ut(e)===Oe.ZodFirstPartyTypeKind.ZodObject}exports.toTypedSchema=Gn;exports.useField=xn;exports.useForm=Bn;exports.useFormContext=qn;
|