@8wave/ai-elements 0.104.0-beta.1 → 0.105.0-beta.1

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 (125) hide show
  1. package/dist/_chunks/{Agent-DG4nPG72.js → Agent-VhugusRf.js} +2 -2
  2. package/dist/_chunks/Agent-VhugusRf.js.map +1 -0
  3. package/dist/_chunks/{Document-DXkvvAnt.js → Document-DjNrISX1.js} +2 -2
  4. package/dist/_chunks/{Document-DXkvvAnt.js.map → Document-DjNrISX1.js.map} +1 -1
  5. package/dist/_chunks/{Media-3Mo4NRj7.js → Media-hjgDyEMr.js} +2 -2
  6. package/dist/_chunks/Media-hjgDyEMr.js.map +1 -0
  7. package/dist/_chunks/{PkStreamingMarkdown-YKd9F3xU.js → PkStreamingMarkdown-B4eMb97I.js} +2 -2
  8. package/dist/_chunks/{PkStreamingMarkdown-YKd9F3xU.js.map → PkStreamingMarkdown-B4eMb97I.js.map} +1 -1
  9. package/dist/_chunks/{PkToolRequestGeolocation-sf6LpUN_.js → PkToolRequestGeolocation-Bp-D2nDb.js} +3 -3
  10. package/{dist-vue/_chunks/PkToolRequestGeolocation-BdX5DzEN.js.map → dist/_chunks/PkToolRequestGeolocation-Bp-D2nDb.js.map} +1 -1
  11. package/dist/_chunks/{PkToolRequestOAuthConnection-BB8mlQit.js → PkToolRequestOAuthConnection-CjjyDj9A.js} +3 -3
  12. package/dist/_chunks/{PkToolRequestOAuthConnection-BB8mlQit.js.map → PkToolRequestOAuthConnection-CjjyDj9A.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowArtifact-54saXXCe.js → PkToolShowArtifact-Dl8f7Q7q.js} +2 -2
  14. package/dist/_chunks/{PkToolShowArtifact-54saXXCe.js.map → PkToolShowArtifact-Dl8f7Q7q.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowCalendarEvent-B_HPVUDk.js → PkToolShowCalendarEvent-B_QmZrlZ.js} +2 -2
  16. package/dist/_chunks/{PkToolShowCalendarEvent-B_HPVUDk.js.map → PkToolShowCalendarEvent-B_QmZrlZ.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowContactForm-BtcNCixq.js → PkToolShowContactForm-CXE0485W.js} +14 -14
  18. package/dist/_chunks/{PkToolShowContactForm-BtcNCixq.js.map → PkToolShowContactForm-CXE0485W.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowDiagram-cA64c2_N.js → PkToolShowDiagram-D-TyCkCB.js} +2 -2
  20. package/dist/_chunks/{PkToolShowDiagram-cA64c2_N.js.map → PkToolShowDiagram-D-TyCkCB.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowForm-DdBAG0Qs.js → PkToolShowForm-BzaibKAz.js} +101 -115
  22. package/dist/_chunks/PkToolShowForm-BzaibKAz.js.map +1 -0
  23. package/dist/_chunks/{PkToolShowSources-0qudS-bu.js → PkToolShowSources-CoTIoupP.js} +3 -3
  24. package/dist/_chunks/{PkToolShowSources-0qudS-bu.js.map → PkToolShowSources-CoTIoupP.js.map} +1 -1
  25. package/dist/_chunks/{PkToolShowSuggestedReply-B2IB6ioR.js → PkToolShowSuggestedReply-DA2Bi7k4.js} +2 -2
  26. package/dist/_chunks/{PkToolShowSuggestedReply-B2IB6ioR.js.map → PkToolShowSuggestedReply-DA2Bi7k4.js.map} +1 -1
  27. package/dist/_chunks/{PkToolShowWeather-Bl3Yoscl.js → PkToolShowWeather-ChDHtOLz.js} +2 -2
  28. package/dist/_chunks/{PkToolShowWeather-Bl3Yoscl.js.map → PkToolShowWeather-ChDHtOLz.js.map} +1 -1
  29. package/dist/_chunks/{browser-DuzNfJq0.js → browser-BXy4OnXA.js} +804 -779
  30. package/dist/_chunks/browser-BXy4OnXA.js.map +1 -0
  31. package/dist/_chunks/index.es-CnpsLhp_.js +1006 -0
  32. package/dist/_chunks/index.es-CnpsLhp_.js.map +1 -0
  33. package/dist/_chunks/utils-DtJdKlnF.js +185 -0
  34. package/dist/_chunks/utils-DtJdKlnF.js.map +1 -0
  35. package/dist/_chunks/{vue-i18n-_ouwlDGE.js → vue-i18n-C3J36GV4.js} +2 -2
  36. package/dist/_chunks/{vue-i18n-_ouwlDGE.js.map → vue-i18n-C3J36GV4.js.map} +1 -1
  37. package/dist/_chunks/{web-DnPxEADy.js → web-CzR5jWfC.js} +46 -45
  38. package/dist/_chunks/{web-DnPxEADy.js.map → web-CzR5jWfC.js.map} +1 -1
  39. package/dist/ai-elements.es.js +2100 -2159
  40. package/dist/ai-elements.es.js.map +1 -1
  41. package/dist-vue/PkChatbot.js +1 -1
  42. package/dist-vue/PkChatbotMessages.js +1 -1
  43. package/dist-vue/PkChatbotStepPayload.js +1 -1
  44. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  45. package/dist-vue/PkChatbotSteps.js +1 -1
  46. package/dist-vue/PkChatbotViewChat.js +1 -1
  47. package/dist-vue/PkChatbotViewConversations.js +1 -1
  48. package/dist-vue/PkChatbotViewFiles.js +1 -1
  49. package/dist-vue/PkChatbotViewProfile.js +1 -1
  50. package/dist-vue/_chunks/{Agent-gCuDMxHN.js → Agent-CpIgGdU4.js} +2 -2
  51. package/dist-vue/_chunks/Agent-CpIgGdU4.js.map +1 -0
  52. package/dist-vue/_chunks/{Document-iH61Cw06.js → Document-CiaGPYTR.js} +2 -2
  53. package/dist-vue/_chunks/{Document-iH61Cw06.js.map → Document-CiaGPYTR.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkChatbot-Bg9oercD.js → PkChatbot-xmjKbljL.js} +7 -7
  55. package/dist-vue/_chunks/{PkChatbot-Bg9oercD.js.map → PkChatbot-xmjKbljL.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkChatbotMessages-DUQxuYaG.js → PkChatbotMessages-tHQ2JQrb.js} +75 -75
  57. package/dist-vue/_chunks/{PkChatbotMessages-DUQxuYaG.js.map → PkChatbotMessages-tHQ2JQrb.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkChatbotStepPayload-hCmy4XG9.js → PkChatbotStepPayload-BtsnkJIV.js} +2 -2
  59. package/dist-vue/_chunks/{PkChatbotStepPayload-hCmy4XG9.js.map → PkChatbotStepPayload-BtsnkJIV.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkChatbotStepToolDetail-B0WU0HcD.js → PkChatbotStepToolDetail-CCa95eBO.js} +116 -101
  61. package/dist-vue/_chunks/PkChatbotStepToolDetail-CCa95eBO.js.map +1 -0
  62. package/dist-vue/_chunks/PkChatbotSteps-CPBzs7Gi.js +180 -0
  63. package/dist-vue/_chunks/PkChatbotSteps-CPBzs7Gi.js.map +1 -0
  64. package/dist-vue/_chunks/{PkChatbotViewChat-YwjWNoqf.js → PkChatbotViewChat-CdiPjQLq.js} +6 -6
  65. package/dist-vue/_chunks/{PkChatbotViewChat-YwjWNoqf.js.map → PkChatbotViewChat-CdiPjQLq.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkChatbotViewConversations-vo57eSwy.js → PkChatbotViewConversations-BP-NJvlK.js} +2 -2
  67. package/dist-vue/_chunks/{PkChatbotViewConversations-vo57eSwy.js.map → PkChatbotViewConversations-BP-NJvlK.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkChatbotViewFiles-DDPugn7F.js → PkChatbotViewFiles-DRUVmxU5.js} +3 -3
  69. package/dist-vue/_chunks/{PkChatbotViewFiles-DDPugn7F.js.map → PkChatbotViewFiles-DRUVmxU5.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkChatbotViewProfile-Dww5KI21.js → PkChatbotViewProfile-ywvIs6N5.js} +2 -2
  71. package/dist-vue/_chunks/{PkChatbotViewProfile-Dww5KI21.js.map → PkChatbotViewProfile-ywvIs6N5.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkToolRequestGeolocation-BdX5DzEN.js → PkToolRequestGeolocation-BdIyXoPQ.js} +2 -2
  73. package/{dist/_chunks/PkToolRequestGeolocation-sf6LpUN_.js.map → dist-vue/_chunks/PkToolRequestGeolocation-BdIyXoPQ.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BUmnRgMi.js → PkToolRequestOAuthConnection-Dnch7xAB.js} +2 -2
  75. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BUmnRgMi.js.map → PkToolRequestOAuthConnection-Dnch7xAB.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolShowDiagram-YMo-iVWr.js → PkToolShowDiagram-DgLxNNp7.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolShowDiagram-YMo-iVWr.js.map → PkToolShowDiagram-DgLxNNp7.js.map} +1 -1
  78. package/dist-vue/_chunks/{PkToolShowForm-D2n2rA6J.js → PkToolShowForm-6eLi6Wr0.js} +103 -117
  79. package/dist-vue/_chunks/PkToolShowForm-6eLi6Wr0.js.map +1 -0
  80. package/dist-vue/_chunks/{PkToolShowSources-DUAsrrzC.js → PkToolShowSources-DTJgvDiB.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolShowSources-DUAsrrzC.js.map → PkToolShowSources-DTJgvDiB.js.map} +1 -1
  82. package/dist-vue/_chunks/{PkToolShowSuggestedReply-Dm28RIJF.js → PkToolShowSuggestedReply-D9RY2h6Z.js} +2 -2
  83. package/dist-vue/_chunks/{PkToolShowSuggestedReply-Dm28RIJF.js.map → PkToolShowSuggestedReply-D9RY2h6Z.js.map} +1 -1
  84. package/dist-vue/_chunks/{createChatbotApiClient-CAX-3-oK.js → createChatbotApiClient-12eL7hul.js} +2 -2
  85. package/dist-vue/_chunks/{createChatbotApiClient-CAX-3-oK.js.map → createChatbotApiClient-12eL7hul.js.map} +1 -1
  86. package/dist-vue/_chunks/{useChatbotStore-Rj18hAUf.js → useChatbotStore-Chtzi5jc.js} +1086 -1016
  87. package/dist-vue/_chunks/useChatbotStore-Chtzi5jc.js.map +1 -0
  88. package/dist-vue/_chunks/{utils-B0jsOUqd.js → utils-DKNWwMTQ.js} +46 -23
  89. package/dist-vue/_chunks/utils-DKNWwMTQ.js.map +1 -0
  90. package/dist-vue/_chunks/{web-DnPxEADy.js → web-CzR5jWfC.js} +46 -45
  91. package/dist-vue/_chunks/{web-DnPxEADy.js.map → web-CzR5jWfC.js.map} +1 -1
  92. package/dist-vue/api.js +1 -1
  93. package/dist-vue/composables.js +3 -3
  94. package/dist-vue/index.js +261 -261
  95. package/dist-vue/index.js.map +1 -1
  96. package/dist-vue/locales.js +10 -4
  97. package/dist-vue/packages/components/src/PkEditorRepeater.d.ts +1 -1
  98. package/dist-vue/packages/components/src/chat/constants.d.ts +12 -0
  99. package/dist-vue/packages/components/src/chat/utils.d.ts +37 -0
  100. package/dist-vue/packages/models/src/schema/Agent.d.ts +24 -16
  101. package/dist-vue/packages/models/src/schema/AgentChatStatistics.d.ts +1 -1
  102. package/dist-vue/packages/models/src/schema/Chat.d.ts +9 -9
  103. package/dist-vue/packages/models/src/schema/Document.d.ts +6 -6
  104. package/dist-vue/packages/models/src/schema/DocumentFolder.d.ts +0 -1
  105. package/dist-vue/packages/models/src/schema/McpServer.d.ts +2 -2
  106. package/dist-vue/packages/models/src/schema/Member.d.ts +2 -2
  107. package/dist-vue/packages/models/src/schema/Organization.d.ts +4 -4
  108. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +29 -29
  109. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +20 -20
  110. package/dist-vue/packages/models/src/schema/User.d.ts +6 -6
  111. package/dist-vue/packages/models/src/schema/constants.d.ts +2 -0
  112. package/package.json +10 -5
  113. package/dist/_chunks/Agent-DG4nPG72.js.map +0 -1
  114. package/dist/_chunks/Media-3Mo4NRj7.js.map +0 -1
  115. package/dist/_chunks/PkToolShowForm-DdBAG0Qs.js.map +0 -1
  116. package/dist/_chunks/browser-DuzNfJq0.js.map +0 -1
  117. package/dist/_chunks/index.es-DXx8DNKf.js +0 -2986
  118. package/dist/_chunks/index.es-DXx8DNKf.js.map +0 -1
  119. package/dist-vue/_chunks/Agent-gCuDMxHN.js.map +0 -1
  120. package/dist-vue/_chunks/PkChatbotStepToolDetail-B0WU0HcD.js.map +0 -1
  121. package/dist-vue/_chunks/PkChatbotSteps-BrvTsAeZ.js +0 -177
  122. package/dist-vue/_chunks/PkChatbotSteps-BrvTsAeZ.js.map +0 -1
  123. package/dist-vue/_chunks/PkToolShowForm-D2n2rA6J.js.map +0 -1
  124. package/dist-vue/_chunks/useChatbotStore-Rj18hAUf.js.map +0 -1
  125. package/dist-vue/_chunks/utils-B0jsOUqd.js.map +0 -1
@@ -0,0 +1,1006 @@
1
+ import { C as e, E as t, F as n, G as r, O as i, P as a, R as o, S as s, V as c, X as l, at as u, bt as d, ft as f, gt as p, it as m, k as h, m as g, pt as _, r as v, u as y, vt as b, w as x, yt as S } from "./vue.runtime.esm-bundler-D6KKITU0.js";
2
+ import { r as C } from "./vue-i18n-C3J36GV4.js";
3
+ import { t as w } from "./src-Co0-iQeD.js";
4
+ import { _ as T, g as E, u as D } from "./dist-vbhhaYbZ.js";
5
+ import { n as O, t as k } from "./dot-prop-BEIkPL0b.js";
6
+ import { D as A, E as j, O as M, k as N } from "./schemas-U769m8P5.js";
7
+ //#region ../../packages/composable/src/useSafeLocalStorage.ts
8
+ m();
9
+ function P(e, t) {
10
+ try {
11
+ return window.localStorage.getItem(""), D(e, t);
12
+ } catch (e) {
13
+ return w.warn("[useSafeLocalStorage] localStorage blocked, falling back to in-memory ref", e), _(t);
14
+ }
15
+ }
16
+ //#endregion
17
+ //#region ../../packages/composable/src/useLocalizedString.ts
18
+ i(), m();
19
+ function F(e, t) {
20
+ let { locale: n, t: r, te: i } = C({ useScope: "global" });
21
+ return g(() => {
22
+ let a = S(e), o = t !== void 0 && i(t) ? r(t) : void 0;
23
+ return a && a[n.value] || o;
24
+ });
25
+ }
26
+ //#endregion
27
+ //#region ../../node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/helpers/util.js
28
+ var I;
29
+ (function(e) {
30
+ e.assertEqual = (e) => {};
31
+ function t(e) {}
32
+ e.assertIs = t;
33
+ function n(e) {
34
+ throw Error();
35
+ }
36
+ e.assertNever = n, e.arrayToEnum = (e) => {
37
+ let t = {};
38
+ for (let n of e) t[n] = n;
39
+ return t;
40
+ }, e.getValidEnumValues = (t) => {
41
+ let n = e.objectKeys(t).filter((e) => typeof t[t[e]] != "number"), r = {};
42
+ for (let e of n) r[e] = t[e];
43
+ return e.objectValues(r);
44
+ }, e.objectValues = (t) => e.objectKeys(t).map(function(e) {
45
+ return t[e];
46
+ }), e.objectKeys = typeof Object.keys == "function" ? (e) => Object.keys(e) : (e) => {
47
+ let t = [];
48
+ for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && t.push(n);
49
+ return t;
50
+ }, e.find = (e, t) => {
51
+ for (let n of e) if (t(n)) return n;
52
+ }, e.isInteger = typeof Number.isInteger == "function" ? (e) => Number.isInteger(e) : (e) => typeof e == "number" && Number.isFinite(e) && Math.floor(e) === e;
53
+ function r(e, t = " | ") {
54
+ return e.map((e) => typeof e == "string" ? `'${e}'` : e).join(t);
55
+ }
56
+ e.joinValues = r, e.jsonStringifyReplacer = (e, t) => typeof t == "bigint" ? t.toString() : t;
57
+ })(I ||= {});
58
+ var L;
59
+ (function(e) {
60
+ e.mergeShapes = (e, t) => ({
61
+ ...e,
62
+ ...t
63
+ });
64
+ })(L ||= {}), I.arrayToEnum([
65
+ "string",
66
+ "nan",
67
+ "number",
68
+ "integer",
69
+ "float",
70
+ "boolean",
71
+ "date",
72
+ "bigint",
73
+ "symbol",
74
+ "function",
75
+ "undefined",
76
+ "null",
77
+ "array",
78
+ "object",
79
+ "unknown",
80
+ "promise",
81
+ "void",
82
+ "never",
83
+ "map",
84
+ "set"
85
+ ]), I.arrayToEnum([
86
+ "invalid_type",
87
+ "invalid_literal",
88
+ "custom",
89
+ "invalid_union",
90
+ "invalid_union_discriminator",
91
+ "invalid_enum_value",
92
+ "unrecognized_keys",
93
+ "invalid_arguments",
94
+ "invalid_return_type",
95
+ "invalid_date",
96
+ "invalid_string",
97
+ "too_small",
98
+ "too_big",
99
+ "invalid_intersection_types",
100
+ "not_multiple_of",
101
+ "not_finite"
102
+ ]);
103
+ var R = class e extends Error {
104
+ get errors() {
105
+ return this.issues;
106
+ }
107
+ constructor(e) {
108
+ super(), this.issues = [], this.addIssue = (e) => {
109
+ this.issues = [...this.issues, e];
110
+ }, this.addIssues = (e = []) => {
111
+ this.issues = [...this.issues, ...e];
112
+ };
113
+ let t = new.target.prototype;
114
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
115
+ }
116
+ format(e) {
117
+ let t = e || function(e) {
118
+ return e.message;
119
+ }, n = { _errors: [] }, r = (e) => {
120
+ for (let i of e.issues) if (i.code === "invalid_union") i.unionErrors.map(r);
121
+ else if (i.code === "invalid_return_type") r(i.returnTypeError);
122
+ else if (i.code === "invalid_arguments") r(i.argumentsError);
123
+ else if (i.path.length === 0) n._errors.push(t(i));
124
+ else {
125
+ let e = n, r = 0;
126
+ for (; r < i.path.length;) {
127
+ let n = i.path[r], a = r === i.path.length - 1;
128
+ if (n === "_errors") {
129
+ a && e._errors.push(t(i)), r++;
130
+ continue;
131
+ }
132
+ Object.prototype.hasOwnProperty.call(e, n) || (n === "__proto__" ? Object.defineProperty(e, n, {
133
+ value: { _errors: [] },
134
+ writable: !0,
135
+ enumerable: !0,
136
+ configurable: !0
137
+ }) : e[n] = { _errors: [] }), e = e[n], a && e._errors.push(t(i)), r++;
138
+ }
139
+ }
140
+ };
141
+ return r(this), n;
142
+ }
143
+ static assert(t) {
144
+ if (!(t instanceof e)) throw Error(`Not a ZodError: ${t}`);
145
+ }
146
+ toString() {
147
+ return this.message;
148
+ }
149
+ get message() {
150
+ return JSON.stringify(this.issues, I.jsonStringifyReplacer, 2);
151
+ }
152
+ get isEmpty() {
153
+ return this.issues.length === 0;
154
+ }
155
+ flatten(e = (e) => e.message) {
156
+ let t = Object.create(null), n = [];
157
+ for (let r of this.issues) if (r.path.length > 0) {
158
+ let n = r.path[0];
159
+ t[n] = t[n] || [], t[n].push(e(r));
160
+ } else n.push(e(r));
161
+ return {
162
+ formErrors: n,
163
+ fieldErrors: t
164
+ };
165
+ }
166
+ get formErrors() {
167
+ return this.flatten();
168
+ }
169
+ };
170
+ //#endregion
171
+ //#region ../../node_modules/.pnpm/@volverjs+form-vue@1.1.5_@volverjs+ui-vue@0.0.18_@json-render+core@0.19.0_zod@4.5.4__@v_edf01ce1f50ea1c1fdfa716abcb63f61/node_modules/@volverjs/form-vue/dist/index.es.js
172
+ R.create = (e) => new R(e), i(), m(), v();
173
+ var z = /* @__PURE__ */ function(e) {
174
+ return e.text = "text", e.number = "number", e.email = "email", e.password = "password", e.tel = "tel", e.url = "url", e.search = "search", e.date = "date", e.time = "time", e.datetimeLocal = "datetime-local", e.month = "month", e.week = "week", e.color = "color", e.select = "select", e.checkbox = "checkbox", e.radio = "radio", e.textarea = "textarea", e.radioGroup = "radioGroup", e.checkboxGroup = "checkboxGroup", e.combobox = "combobox", e.custom = "custom", e;
175
+ }({}), B = /* @__PURE__ */ function(e) {
176
+ return e.invalid = "invalid", e.valid = "valid", e.submitting = "submitting", e.reset = "reset", e.updated = "updated", e.unknown = "unknown", e;
177
+ }({}), V = (e) => e._def.typeName === "ZodObject", H = (e) => e._zod.def.type === "object", ee = (e) => e._def.typeName === "ZodDefault", te = (e) => e._zod.def.type === "default", ne = (e) => e._def.typeName === "ZodNullable", re = (e) => e._zod.def.type === "nullable", ie = (e) => e._def.typeName === "ZodRecord", ae = (e) => e._zod.def.type === "record", oe = (e) => e._def.typeName === "ZodArray", U = (e) => e._zod.def.type === "array", W = (e) => e._def.typeName === "ZodEffects", G = (e) => e._def.typeName === "ZodOptional", K = (e) => e._zod.def.type === "optional", se = (e) => e._zod.def.type === "pipe", ce = (e) => e._zod.def.type === "transform";
178
+ function q(e) {
179
+ let t = e;
180
+ for (; W(t);) t = t.innerType();
181
+ return t;
182
+ }
183
+ function J(e) {
184
+ let t = e;
185
+ for (; se(t);) t = ce(t._zod.def.out) ? t._zod.def.in : t._zod.def.out;
186
+ return t;
187
+ }
188
+ var le = (e) => {
189
+ let t = q(e);
190
+ return G(t) && (t = t._def.innerType), t;
191
+ }, ue = (e) => {
192
+ let t = J(e);
193
+ return K(t) && (t = t._zod.def.innerType), t;
194
+ }, de = (e) => !!G(q(e)), fe = (e) => !!K(J(e)), Y = (e) => "_zod" in e, pe = {
195
+ getInnerType: le,
196
+ isObject: V,
197
+ hasUnknownKeys: (e) => e._def.unknownKeys === "passthrough",
198
+ getShapeEntries: (e) => "shape" in e ? Object.entries(e.shape) : [],
199
+ isOptional: de,
200
+ isDefault: ee,
201
+ getDefaultValue: (e) => e._def.defaultValue(),
202
+ getDefaultInnerType: (e) => e._def.innerType,
203
+ isNullable: ne,
204
+ safeParse: (e, t) => e.safeParse(t),
205
+ isArray: oe,
206
+ getArrayElement: (e) => e._def.type,
207
+ isRecord: ie,
208
+ getRecordValue: (e) => e._def.valueType
209
+ }, me = {
210
+ getInnerType: ue,
211
+ isObject: H,
212
+ hasUnknownKeys: (e) => !!(e._zod.def.catchall && e._zod.def.catchall._zod.def.type !== "never"),
213
+ getShapeEntries: (e) => "shape" in e._zod.def ? Object.entries(e._zod.def.shape) : [],
214
+ isOptional: fe,
215
+ isDefault: te,
216
+ getDefaultValue: (e) => e._zod.def.defaultValue,
217
+ getDefaultInnerType: (e) => e._zod.def.innerType,
218
+ isNullable: re,
219
+ safeParse: (e, t) => j(e, t),
220
+ isArray: U,
221
+ getArrayElement: (e) => e._zod.def.element,
222
+ isRecord: ae,
223
+ getRecordValue: (e) => e._zod.def.valueType
224
+ };
225
+ function he(e, t, n) {
226
+ let r = e.getInnerType(e.getArrayElement(t));
227
+ return e.isObject(r) ? n.map((t) => X(e, r, t)) : n;
228
+ }
229
+ function ge(e, t, n) {
230
+ let r = e.getInnerType(e.getRecordValue(t));
231
+ return e.isObject(r) ? Object.keys(n).reduce((t, i) => (t[i] = X(e, r, n[i]), t), {}) : n;
232
+ }
233
+ function _e(e, t, n, r) {
234
+ let i = e.isOptional(n), a = e.getInnerType(n), o;
235
+ if (e.isDefault(a) && (o = e.getDefaultValue(a), a = e.getDefaultInnerType(a)), r === null && e.isNullable(a)) return [t, r];
236
+ if (r == null && i) return [t, o];
237
+ if (a && r !== void 0) {
238
+ let i = e.safeParse(n, r);
239
+ if (i.success) return [t, i.data ?? o];
240
+ }
241
+ return e.isArray(a) && Array.isArray(r) ? [t, he(e, a, r)] : e.isRecord(a) && r ? [t, ge(e, a, r)] : e.isObject(a) ? [t, X(e, a, r && typeof r == "object" ? r : o)] : [t, o];
242
+ }
243
+ function X(e, t, n) {
244
+ let r = n && typeof n == "object" && !Array.isArray(n) ? n : {};
245
+ return {
246
+ ...e.hasUnknownKeys(t) ? r : {},
247
+ ...Object.fromEntries(e.getShapeEntries(t).map(([t, n]) => _e(e, t, n, r[t])))
248
+ };
249
+ }
250
+ function ve(e, t = {}) {
251
+ let n = Y(e) ? me : pe, r = n.getInnerType(e);
252
+ return n.isObject(r) ? X(n, r, t) : t;
253
+ }
254
+ var ye = (e, t) => Y(e) ? A(e, t) : e.safeParseAsync(t), be = (e, t) => Y(e) ? N(t) : t.format(), xe = (e, t) => Y(e) ? N(new M(t)) : new R(t).format();
255
+ function Se(r, i, a, s, c) {
256
+ let d = _(), m = _(), h = g(() => m.value === B.invalid), v = _(), b = _(!1), x, S = (e) => {
257
+ let t = ve(r, e);
258
+ if (a?.class) {
259
+ let e = a.class;
260
+ return new e(t);
261
+ }
262
+ return t;
263
+ }, C = async (e = v.value, t) => {
264
+ if (x = t?.fields, b.value) return !0;
265
+ let n = await ye(r, e);
266
+ if (!n.success) {
267
+ if (m.value = B.invalid, !x?.size) return d.value = be(r, n.error), !1;
268
+ let e = n.error.issues.filter((e) => x?.has(e.path.join(".")));
269
+ return e.length ? (d.value = xe(r, e), !1) : (d.value = void 0, !0);
270
+ }
271
+ return d.value = void 0, m.value = B.valid, v.value = S(n.data), !0;
272
+ }, w = () => {
273
+ d.value = void 0, m.value = void 0, x = void 0;
274
+ }, { ignoreUpdates: D, stop: O } = T(v, () => {
275
+ m.value = B.updated;
276
+ }, {
277
+ deep: !0,
278
+ eventFilter: E(a?.updateThrottle ?? 500)
279
+ }), k = () => {
280
+ D(() => {
281
+ v.value = S();
282
+ }), w(), m.value = B.reset;
283
+ }, A = async (e) => b.value || !await C(void 0, e) ? !1 : (m.value = B.submitting, !0), j = f(d), M = f(m);
284
+ return {
285
+ clear: w,
286
+ errors: d,
287
+ formData: v,
288
+ ignoreUpdates: D,
289
+ invalid: h,
290
+ readonly: b,
291
+ reset: k,
292
+ status: m,
293
+ wrappers: c,
294
+ stopUpdatesWatch: O,
295
+ submit: A,
296
+ validate: C,
297
+ VvForm: e({
298
+ name: "VvForm",
299
+ props: {
300
+ continuousValidation: {
301
+ type: Boolean,
302
+ default: !1
303
+ },
304
+ modelValue: {
305
+ type: Object,
306
+ default: () => ({})
307
+ },
308
+ readonly: {
309
+ type: Boolean,
310
+ default: a?.readonly
311
+ },
312
+ tag: {
313
+ type: String,
314
+ default: "form"
315
+ },
316
+ template: {
317
+ type: [Array, Function],
318
+ default: void 0
319
+ },
320
+ superRefine: {
321
+ type: Function,
322
+ default: void 0
323
+ },
324
+ validateFields: {
325
+ type: Array,
326
+ default: void 0
327
+ }
328
+ },
329
+ emits: [
330
+ "invalid",
331
+ "submit",
332
+ "update:modelValue",
333
+ "update:readonly",
334
+ "valid",
335
+ "reset"
336
+ ],
337
+ expose: [
338
+ "errors",
339
+ "invalid",
340
+ "readonly",
341
+ "status",
342
+ "submit",
343
+ "tag",
344
+ "template",
345
+ "valid",
346
+ "validate",
347
+ "clear",
348
+ "reset"
349
+ ],
350
+ slots: Object,
351
+ setup(e, { emit: t }) {
352
+ return v.value = S(p(e.modelValue)), l(() => e.modelValue, (e) => {
353
+ if (e) {
354
+ let t = u(e) ? p(e) : e;
355
+ if (JSON.stringify(t) === JSON.stringify(p(v.value))) return;
356
+ v.value = S(t);
357
+ }
358
+ }, { deep: !0 }), l(m, async (n) => {
359
+ if (n === B.invalid) {
360
+ let e = p(d.value);
361
+ t("invalid", e), a?.onInvalid?.(e);
362
+ return;
363
+ }
364
+ if (n === B.valid) {
365
+ let e = p(v.value);
366
+ t("valid", e), a?.onValid?.(e), t("update:modelValue", e), a?.onUpdate?.(e);
367
+ return;
368
+ }
369
+ if (n === B.submitting) {
370
+ let e = p(v.value);
371
+ t("submit", e), a?.onSubmit?.(e);
372
+ return;
373
+ }
374
+ if (n === B.reset) {
375
+ let e = p(v.value);
376
+ t("reset", e), a?.onReset?.(e);
377
+ return;
378
+ }
379
+ if (n === B.updated) {
380
+ if ((d.value || a?.continuousValidation || e.continuousValidation) && await C(void 0, {
381
+ superRefine: e.superRefine,
382
+ fields: x ?? new Set(e.validateFields)
383
+ }), !v.value || !e.modelValue || JSON.stringify(v.value) !== JSON.stringify(e.modelValue)) {
384
+ let e = p(v.value);
385
+ t("update:modelValue", e), a?.onUpdate?.(e);
386
+ }
387
+ m.value === B.updated && (m.value = B.unknown);
388
+ }
389
+ }), n(() => {
390
+ e.readonly !== void 0 && (b.value = e.readonly);
391
+ }), l(() => e.readonly, (e) => {
392
+ b.value = e;
393
+ }), l(b, (n) => {
394
+ n !== e.readonly && t("update:readonly", b.value);
395
+ }), o(i, {
396
+ clear: w,
397
+ errors: j,
398
+ formData: v,
399
+ ignoreUpdates: D,
400
+ invalid: h,
401
+ readonly: b,
402
+ reset: k,
403
+ status: M,
404
+ stopUpdatesWatch: O,
405
+ submit: A,
406
+ validate: C,
407
+ wrappers: c
408
+ }), {
409
+ clear: w,
410
+ errors: j,
411
+ formData: v,
412
+ ignoreUpdates: D,
413
+ invalid: h,
414
+ isReadonly: b,
415
+ reset: k,
416
+ status: M,
417
+ stopUpdatesWatch: O,
418
+ submit: () => A({
419
+ superRefine: e.superRefine,
420
+ fields: new Set(e.validateFields)
421
+ }),
422
+ validate: C,
423
+ wrappers: c
424
+ };
425
+ },
426
+ render() {
427
+ let e = () => this.$slots?.default?.({
428
+ errors: j.value,
429
+ formData: v.value,
430
+ invalid: h.value,
431
+ readonly: b.value,
432
+ status: M.value,
433
+ wrappers: c,
434
+ clear: w,
435
+ ignoreUpdates: D,
436
+ reset: k,
437
+ stopUpdatesWatch: O,
438
+ submit: A,
439
+ validate: C
440
+ }) ?? this.$slots.default;
441
+ return t(this.tag, {
442
+ onSubmit: y(this.submit, ["prevent"]),
443
+ onReset: y(this.reset, ["prevent"])
444
+ }, (this.template ?? a?.template) && s ? [t(s, { schema: this.template ?? a?.template }, { default: e })] : { default: e });
445
+ }
446
+ })
447
+ };
448
+ }
449
+ function Z(i, u, p, m) {
450
+ return e({
451
+ name: "VvFormField",
452
+ props: {
453
+ type: {
454
+ type: String,
455
+ validator: (e) => Object.values(z).includes(e),
456
+ default: z.custom
457
+ },
458
+ is: {
459
+ type: [Object, String],
460
+ default: void 0
461
+ },
462
+ name: {
463
+ type: [
464
+ String,
465
+ Number,
466
+ Boolean,
467
+ Symbol
468
+ ],
469
+ required: !0
470
+ },
471
+ props: {
472
+ type: [Object, Function],
473
+ default: () => ({})
474
+ },
475
+ showValid: {
476
+ type: Boolean,
477
+ default: !1
478
+ },
479
+ defaultValue: {
480
+ type: [
481
+ String,
482
+ Number,
483
+ Boolean,
484
+ Array,
485
+ Object
486
+ ],
487
+ default: void 0
488
+ },
489
+ lazyLoad: {
490
+ type: Boolean,
491
+ default: !1
492
+ },
493
+ readonly: {
494
+ type: Boolean,
495
+ default: void 0
496
+ }
497
+ },
498
+ emits: [
499
+ "invalid",
500
+ "update:formData",
501
+ "update:modelValue",
502
+ "valid"
503
+ ],
504
+ expose: [
505
+ "component",
506
+ "errors",
507
+ "hasProps",
508
+ "invalid",
509
+ "invalidLabel",
510
+ "is",
511
+ "type"
512
+ ],
513
+ slots: Object,
514
+ setup(e, { slots: t, emit: _ }) {
515
+ let { props: v, name: y } = b(e), x = r(), S = h(u, void 0);
516
+ S && S.fields.value.set(x, e.name);
517
+ let C = h(i), w = g({
518
+ get() {
519
+ if (C?.formData) return k(new Object(C.formData.value), String(e.name));
520
+ },
521
+ set(t) {
522
+ C?.formData && (O(new Object(C.formData.value), String(e.name), t), _("update:modelValue", {
523
+ newValue: w.value,
524
+ formData: C?.formData
525
+ }));
526
+ }
527
+ });
528
+ n(() => {
529
+ w.value === void 0 && e.defaultValue !== void 0 && (w.value = e.defaultValue);
530
+ }), a(() => {
531
+ S && S.fields.value.delete(x);
532
+ });
533
+ let T = g(() => {
534
+ if (C?.errors.value) return k(C.errors.value, String(e.name));
535
+ }), E = g(() => T.value?._errors), D = g(() => T.value !== void 0), A = l(D, (t) => {
536
+ if (t) {
537
+ _("invalid", T.value), S && S.errors.value.set(String(e.name), T.value);
538
+ return;
539
+ }
540
+ _("valid", w.value), S && S.errors.value.delete(e.name);
541
+ }), j = l(() => C?.formData, () => {
542
+ _("update:formData", C?.formData);
543
+ }, { deep: !0 });
544
+ a(() => {
545
+ A(), j();
546
+ });
547
+ let M = (e) => {
548
+ e instanceof InputEvent && (e = e.target.value), w.value = e;
549
+ }, N = g(() => {
550
+ let e = v.value;
551
+ return typeof e == "function" && (e = e(C?.formData)), Object.keys(e).reduce((t, n) => (t[n] = d(e[n]), t), {});
552
+ }), P = g(() => C?.readonly.value || S?.readonly.value ? !0 : N.value.readonly ?? e.readonly), F = g(() => ({
553
+ ...N.value,
554
+ name: N.value.name ?? e.name,
555
+ invalid: D.value,
556
+ valid: e.showValid ? !!(!D.value && w.value) : void 0,
557
+ type: ((e) => {
558
+ if ([
559
+ z.color,
560
+ z.date,
561
+ z.datetimeLocal,
562
+ z.email,
563
+ z.month,
564
+ z.number,
565
+ z.password,
566
+ z.search,
567
+ z.tel,
568
+ z.text,
569
+ z.time,
570
+ z.url,
571
+ z.week
572
+ ].includes(e)) return e;
573
+ })(e.type),
574
+ invalidLabel: E.value,
575
+ modelValue: w.value,
576
+ readonly: P.value,
577
+ "onUpdate:modelValue": M
578
+ }));
579
+ return o(p, {
580
+ name: f(y),
581
+ errors: f(T)
582
+ }), {
583
+ component: g(() => {
584
+ if (e.type === z.custom) return { render() {
585
+ return t.default?.({
586
+ errors: f(T).value,
587
+ formData: C?.formData.value,
588
+ formErrors: C?.errors.value,
589
+ invalid: D.value,
590
+ invalidLabel: E.value,
591
+ modelValue: w.value,
592
+ readonly: P.value,
593
+ onUpdate: M,
594
+ submit: C?.submit,
595
+ validate: C?.validate
596
+ }) ?? t.default;
597
+ } };
598
+ if (!(m?.lazyLoad ?? e.lazyLoad)) {
599
+ let t;
600
+ switch (e.type) {
601
+ case z.select:
602
+ t = c("VvSelect");
603
+ break;
604
+ case z.checkbox:
605
+ t = c("VvCheckbox");
606
+ break;
607
+ case z.radio:
608
+ t = c("VvRadio");
609
+ break;
610
+ case z.textarea:
611
+ t = c("VvTextarea");
612
+ break;
613
+ case z.radioGroup:
614
+ t = c("VvRadioGroup");
615
+ break;
616
+ case z.checkboxGroup:
617
+ t = c("VvCheckboxGroup");
618
+ break;
619
+ case z.combobox:
620
+ t = c("VvCombobox");
621
+ break;
622
+ default: t = c("VvInputText");
623
+ }
624
+ if (typeof t != "string") return t;
625
+ console.warn(`[@volverjs/form-vue]: ${t} not found, the component will be loaded asynchronously. To avoid this warning, please set "lazyLoad" option.`);
626
+ }
627
+ return s(async () => {
628
+ switch (m?.sideEffects && await Promise.resolve(m.sideEffects(e.type)), e.type) {
629
+ case z.textarea: return import("./VvTextarea.es-DBXLtc0A.js");
630
+ case z.radio: return import("./VvRadio.es-DlQppq3w.js");
631
+ case z.radioGroup: return import("./VvRadioGroup.es-CQgfwKsS.js");
632
+ case z.checkbox: return import("./VvCheckbox.es-BifV6dIp.js");
633
+ case z.checkboxGroup: return import("./VvCheckboxGroup.es-BPTV2McU.js");
634
+ case z.select: return import("./VvSelect.es-D-U8Eya6.js");
635
+ case z.combobox: return import("./VvCombobox.es-DCOcQU3R.js");
636
+ }
637
+ return import("./VvInputText.es-D-hc8C2_.js");
638
+ });
639
+ }),
640
+ hasProps: F,
641
+ invalid: D
642
+ };
643
+ },
644
+ render() {
645
+ return this.is ? t(this.is, this.hasProps, this.$slots) : this.type === z.custom ? t(this.component, null, this.$slots) : t(this.component, this.hasProps, this.$slots);
646
+ }
647
+ });
648
+ }
649
+ function Ce(i, s, c) {
650
+ return e({
651
+ name: "VvFormFieldsGroup",
652
+ props: {
653
+ is: {
654
+ type: [Object, String],
655
+ default: void 0
656
+ },
657
+ names: {
658
+ type: [Array, Object],
659
+ required: !0
660
+ },
661
+ props: {
662
+ type: [Object, Function],
663
+ default: () => ({})
664
+ },
665
+ showValid: {
666
+ type: Boolean,
667
+ default: !1
668
+ },
669
+ defaultValues: {
670
+ type: [Object],
671
+ default: void 0
672
+ },
673
+ readonly: {
674
+ type: Boolean,
675
+ default: void 0
676
+ }
677
+ },
678
+ emits: [
679
+ "invalid",
680
+ "update:formData",
681
+ "update:modelValue",
682
+ "valid"
683
+ ],
684
+ expose: [
685
+ "component",
686
+ "errors",
687
+ "hasProps",
688
+ "invalid",
689
+ "invalidLabels",
690
+ "is"
691
+ ],
692
+ slots: Object,
693
+ setup(e, { slots: t, emit: u }) {
694
+ let { props: p, names: m, defaultValues: _ } = b(e), v = r(), y = g(() => Array.isArray(m.value) ? m.value : Object.values(m.value)), x = g(() => Array.isArray(m.value) ? m.value : Object.keys(m.value)), S = g(() => Array.isArray(m.value) ? m.value.reduce((e, t) => (e[String(t)] = t, e), {}) : m.value), C = g(() => Object.keys(S.value).reduce((e, t) => (e[String(S.value[t])] = t, e), {})), w = h(s, void 0);
695
+ w && y.value.forEach((e) => {
696
+ w.fields.value.set(`${v}-${e}`, e);
697
+ });
698
+ let T = h(i), E = g({
699
+ get() {
700
+ return T?.formData ? x.value.reduce((e, t) => (e[t] = k(new Object(T.formData.value), S.value[t]), e), {}) : {};
701
+ },
702
+ set(e) {
703
+ T?.formData && (x.value.forEach((t) => {
704
+ O(new Object(T.formData.value), S.value[t], e?.[t]);
705
+ }), u("update:modelValue", {
706
+ newValue: E.value,
707
+ formData: T?.formData
708
+ }));
709
+ }
710
+ });
711
+ n(() => {
712
+ _.value && y.value.forEach((e) => {
713
+ _.value?.[e] !== void 0 && E.value[e] === void 0 && (E.value = {
714
+ ...E.value,
715
+ [e]: _.value?.[e]
716
+ });
717
+ });
718
+ }), a(() => {
719
+ w && y.value.forEach((e) => {
720
+ w.fields.value.delete(`${v}-${e}`);
721
+ });
722
+ });
723
+ let D = g(() => {
724
+ if (!T?.errors.value) return;
725
+ let e = y.value.reduce((e, t) => {
726
+ if (!T.errors.value) return e;
727
+ let n = k(T.errors.value, String(t));
728
+ return n === void 0 || (e[String(t)] = n), e;
729
+ }, {});
730
+ if (Object.keys(e).length !== 0) return e;
731
+ }), A = g(() => {
732
+ if (!D.value) return;
733
+ let e = Object.keys(D.value).reduce((e, t) => (D.value?.[t] && (e[C.value[t]] = D.value[t]._errors), e), {});
734
+ if (Object.keys(e).length !== 0) return e;
735
+ }), j = g(() => D.value !== void 0), M = g(() => x.value.reduce((e, t) => (e[t] = !!D.value?.[S.value[t]], e), {})), N = l(j, () => {
736
+ if (j.value) {
737
+ u("invalid", D.value), w && y.value.forEach((e) => {
738
+ if (!D.value?.[e]) {
739
+ w.errors.value.delete(e);
740
+ return;
741
+ }
742
+ w.errors.value.set(e, D.value?.[e]);
743
+ });
744
+ return;
745
+ }
746
+ u("valid", E.value), w && y.value.forEach((e) => {
747
+ w.errors.value.delete(e);
748
+ });
749
+ }), P = l(() => T?.formData, () => {
750
+ u("update:formData", T?.formData);
751
+ }, { deep: !0 });
752
+ a(() => {
753
+ N(), P();
754
+ });
755
+ let F = (e) => {
756
+ E.value = e;
757
+ }, I = (e, t) => {
758
+ t instanceof InputEvent && (t = t.target.value), x.value.includes(e) && (E.value = {
759
+ ...E.value,
760
+ [e]: t
761
+ });
762
+ }, L = g(() => {
763
+ let e = p.value;
764
+ return typeof e == "function" && (e = e(T?.formData)), Object.keys(e).reduce((t, n) => (t[n] = d(e[n]), t), {});
765
+ }), R = g(() => T?.readonly.value ? !0 : L.value.readonly ?? e.readonly), z = g(() => x.value.reduce((e, t) => (e[`onUpdate:${t}`] = (e) => {
766
+ I(t, e);
767
+ }, e), { "onUpdate:modelValue": F })), B = g(() => ({
768
+ ...z.value,
769
+ ...L.value,
770
+ ...E.value,
771
+ modelValue: E.value,
772
+ names: L.value.name ?? y.value,
773
+ invalid: j.value,
774
+ invalids: M.value,
775
+ valid: e.showValid ? !!(!j.value && E.value) : void 0,
776
+ invalidLabels: A.value,
777
+ readonly: R.value
778
+ }));
779
+ return o(c, {
780
+ names: f(m),
781
+ errors: f(D)
782
+ }), {
783
+ component: g(() => ({ render() {
784
+ return t.default?.({
785
+ errors: D.value,
786
+ formData: T?.formData.value,
787
+ formErrors: T?.errors.value,
788
+ invalid: j.value,
789
+ invalids: M.value,
790
+ invalidLabels: A.value,
791
+ modelValue: E.value,
792
+ onUpdate: F,
793
+ onUpdateField: I,
794
+ readonly: R.value,
795
+ submit: T?.submit,
796
+ validate: T?.validate
797
+ }) ?? t.default;
798
+ } })),
799
+ hasProps: B,
800
+ invalid: j
801
+ };
802
+ },
803
+ render() {
804
+ return this.is ? t(this.is, this.hasProps, this.$slots) : t(this.component, null, this.$slots);
805
+ }
806
+ });
807
+ }
808
+ function we(r, i) {
809
+ return e({
810
+ name: "VvFormWrapper",
811
+ props: {
812
+ name: {
813
+ type: String,
814
+ required: !0
815
+ },
816
+ tag: {
817
+ type: String,
818
+ default: void 0
819
+ },
820
+ readonly: {
821
+ type: Boolean,
822
+ default: !1
823
+ }
824
+ },
825
+ emits: ["invalid", "valid"],
826
+ expose: [
827
+ "clear",
828
+ "errors",
829
+ "fields",
830
+ "fieldsErrors",
831
+ "formData",
832
+ "invalid",
833
+ "readonly",
834
+ "reset",
835
+ "submit",
836
+ "tag",
837
+ "validate",
838
+ "validateWrapper"
839
+ ],
840
+ slots: Object,
841
+ setup(e, { emit: t }) {
842
+ let s = h(r), c = h(i, void 0), u = _(/* @__PURE__ */ new Map()), d = _(/* @__PURE__ */ new Map()), { name: p } = b(e), m = g(() => s?.invalid.value ? d.value.size > 0 : !1);
843
+ l(m, (e) => {
844
+ if (e) {
845
+ t("invalid");
846
+ return;
847
+ }
848
+ t("valid");
849
+ });
850
+ let v = g(() => s?.readonly.value || e.readonly), y = {
851
+ name: f(p),
852
+ errors: d,
853
+ invalid: f(m),
854
+ readonly: f(v),
855
+ fields: u
856
+ };
857
+ return o(i, y), l(g(() => new Map(u.value)), (e, t) => {
858
+ c?.fields && (t.forEach((t, n) => {
859
+ e.has(n) || c?.fields.value.delete(n);
860
+ }), e.forEach((e, t) => {
861
+ c?.fields.value.has(t) || c?.fields.value.set(t, e);
862
+ }));
863
+ }, { deep: !0 }), l(d, (e) => {
864
+ c?.errors && u.value.forEach((t) => {
865
+ if (e.has(t) || c.errors.value.delete(t), e.has(t)) {
866
+ let n = e.get(t);
867
+ n && c.errors.value.set(t, n);
868
+ }
869
+ });
870
+ }, { deep: !0 }), n(() => {
871
+ if (!s?.wrappers || !p.value) {
872
+ console.warn("[@volverjs/form-vue]: Invalid wrapper registration state");
873
+ return;
874
+ }
875
+ if (s.wrappers.has(p.value)) {
876
+ console.warn(`[@volverjs/form-vue]: wrapper name "${p.value}" is already used`);
877
+ return;
878
+ }
879
+ s.wrappers.set(p.value, y);
880
+ }), a(() => {
881
+ s?.wrappers && p.value && s.wrappers.delete(p.value);
882
+ }), {
883
+ errors: s?.errors,
884
+ fields: u,
885
+ fieldsErrors: d,
886
+ formData: s?.formData,
887
+ invalid: m,
888
+ readonly: v,
889
+ clear: s?.clear,
890
+ reset: s?.reset,
891
+ submit: s?.submit,
892
+ validate: s?.validate,
893
+ validateWrapper: () => s?.validate(void 0, { fields: new Set(u.value.values()) }) ?? Promise.resolve(!0)
894
+ };
895
+ },
896
+ render() {
897
+ let e = () => this.$slots.default?.({
898
+ errors: this.errors,
899
+ fieldsErrors: this.fieldsErrors,
900
+ formData: this.formData,
901
+ invalid: this.invalid,
902
+ readonly: this.readonly,
903
+ clear: this.clear,
904
+ reset: this.reset,
905
+ submit: this.submit,
906
+ validate: this.validate,
907
+ validateWrapper: this.validateWrapper
908
+ });
909
+ return this.tag ? t(this.tag, null, { default: e }) : e();
910
+ }
911
+ });
912
+ }
913
+ function Te(n, r) {
914
+ let i = e({
915
+ name: "VvFormTemplate",
916
+ props: {
917
+ schema: {
918
+ type: [Array, Function],
919
+ required: !0
920
+ },
921
+ scope: {
922
+ type: Object,
923
+ default: () => ({})
924
+ }
925
+ },
926
+ slots: Object,
927
+ setup(e, { slots: a }) {
928
+ let o = h(n);
929
+ if (o?.formData) return () => {
930
+ let n = typeof e.schema == "function" ? e.schema(o, e.scope) : e.schema, s, c = n.reduce((n, a) => {
931
+ let { vvIs: c, vvName: l, vvSlots: u, vvChildren: f, vvIf: p, vvElseIf: m, vvType: h, vvDefaultValue: g, vvShowValid: _, vvContent: v, ...y } = typeof a == "function" ? a(o, e.scope) : a;
932
+ if (p !== void 0) {
933
+ if (s = typeof p == "string" ? !!k(new Object(o.formData.value), p) : d(typeof p == "function" ? p(o) : p), !s) return n;
934
+ } else if (m !== void 0 && s !== void 0) {
935
+ if (s || (s = typeof m == "string" ? !!k(new Object(o.formData.value), m) : d(typeof m == "function" ? m(o) : m), !s)) return n;
936
+ } else s = void 0;
937
+ let b;
938
+ return f && (b = typeof c == "string" ? t(i, { schema: f }) : { default: (e) => t(i, {
939
+ schema: f,
940
+ scope: e
941
+ }) }), l ? (n.push(t(r, {
942
+ name: l,
943
+ is: c,
944
+ type: h,
945
+ defaultValue: g,
946
+ showValid: _,
947
+ props: y
948
+ }, u ?? b ?? v)), n) : c ? (n.push(t(c, y, u ?? b ?? v)), n) : (b && ("default" in b ? n.push(b.default(e.scope)) : n.push(b)), n);
949
+ }, []);
950
+ return c.push(a?.default?.({
951
+ errors: o?.errors.value,
952
+ formData: o?.formData.value,
953
+ invalid: o?.invalid.value,
954
+ status: o?.status.value,
955
+ submit: o?.submit,
956
+ validate: o?.validate,
957
+ clear: o?.clear,
958
+ reset: o?.reset
959
+ })), c;
960
+ };
961
+ }
962
+ });
963
+ return i;
964
+ }
965
+ function Q(e, t = {}) {
966
+ let n = Symbol("formInjectionKey"), r = Symbol("formWrapperInjectionKey"), i = Symbol("formFieldInjectionKey"), a = Symbol("formFieldsGroupInjectionKey"), o = we(n, r), s = Z(n, r, i, t), c = Ce(n, r, a), l = Te(n, s), u = /* @__PURE__ */ new Map(), { clear: d, errors: f, formData: p, ignoreUpdates: m, invalid: h, readonly: g, reset: _, status: v, stopUpdatesWatch: y, submit: b, validate: x, VvForm: S } = Se(e, n, t, l, u);
967
+ return {
968
+ clear: d,
969
+ errors: f,
970
+ formData: p,
971
+ formFieldInjectionKey: i,
972
+ formInjectionKey: n,
973
+ formWrapperInjectionKey: r,
974
+ ignoreUpdates: m,
975
+ invalid: h,
976
+ readonly: g,
977
+ reset: _,
978
+ status: v,
979
+ stopUpdatesWatch: y,
980
+ submit: b,
981
+ validate: x,
982
+ wrappers: u,
983
+ VvForm: S,
984
+ VvFormField: s,
985
+ VvFormFieldsGroup: c,
986
+ VvFormTemplate: l,
987
+ VvFormWrapper: o
988
+ };
989
+ }
990
+ var Ee = Symbol("pluginInjectionKey"), $ = /* @__PURE__ */ new Map();
991
+ function De(e, t = {}) {
992
+ if (t.scope && $.has(t.scope)) return $.get(t.scope);
993
+ if (!x()) {
994
+ let n = Q(e, t);
995
+ return t.scope && $.set(t.scope, n), n;
996
+ }
997
+ let n = Q(e, {
998
+ ...h(Ee, {}),
999
+ ...t
1000
+ });
1001
+ return t.scope && $.set(t.scope, n), n;
1002
+ }
1003
+ //#endregion
1004
+ export { F as n, P as r, De as t };
1005
+
1006
+ //# sourceMappingURL=index.es-CnpsLhp_.js.map