@oneclick.dev/cms-core-modules 0.0.122 → 0.0.123

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 (72) hide show
  1. package/dist/{ContentEditor-CoJjsV-m.js → ContentEditor-C-Wm48ai.js} +63 -59
  2. package/dist/{ContentEditor-DIwqplfB.mjs → ContentEditor-MDGolnIP.mjs} +27596 -26138
  3. 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
  4. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BVE_uURZ.js +1 -0
  5. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs +3566 -0
  6. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DzPOadcU.js +925 -0
  7. package/dist/TableCalculationWidget-CkQPrVUd.js +59 -0
  8. package/dist/TableCalculationWidget-CrqcLGfU.mjs +254 -0
  9. package/dist/TableDataWidget-7qvC3Egd.js +1 -0
  10. package/dist/TableDataWidget-DMTSoGRO.mjs +121 -0
  11. package/dist/TableOverviewCard-AFq-puJs.js +1 -0
  12. package/dist/TableOverviewCard-Ci0d4o4w.mjs +391 -0
  13. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs +534 -0
  14. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js +1 -0
  15. package/dist/TableRowActionCard-BhdnnPaq.mjs +266 -0
  16. package/dist/TableRowActionCard-IzB6tNN-.js +1 -0
  17. package/dist/TableView-BkwoKREo.js +4 -0
  18. package/dist/TableView-C4Zyp8d7.mjs +8228 -0
  19. package/dist/{agenda-BCKDYOeF.mjs → agenda-DWdbWUbb.mjs} +10 -9
  20. package/dist/agenda-r9Gl85GL.js +1 -0
  21. package/dist/dateRangePresets-B-l5b_wR.mjs +48 -0
  22. package/dist/dateRangePresets-CPWqst_x.js +1 -0
  23. package/dist/fuse-Deb-Iq39.mjs +1473 -0
  24. package/dist/fuse-_CGUd5Zq.js +1 -0
  25. package/dist/{index-DU3Ib10Z.mjs → index-B_qaX29C.mjs} +7 -6
  26. package/dist/{index-Bk3yLv_G.js → index-yHLT6gaZ.js} +3 -3
  27. package/dist/index.cjs.js +1 -1
  28. package/dist/index.mjs +419 -109
  29. package/dist/{orders-CElKNc1v.mjs → orders-BfTLIm7U.mjs} +10 -9
  30. package/dist/orders-DUa2PVoa.js +1 -0
  31. package/dist/reports-ChCsd1Gk.mjs +1107 -0
  32. package/dist/reports-DmJPm8uP.js +158 -0
  33. package/dist/row-item-C1dUyimV.mjs +204 -0
  34. package/dist/row-item-Cyo3m3MZ.js +1 -0
  35. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +9 -3
  36. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +2 -0
  37. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +4 -2
  38. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +9 -3
  39. package/dist/src/appointments/pages/edit/orders.vue.d.ts +9 -3
  40. package/dist/src/appointments/pages/edit/reports.vue.d.ts +229 -1
  41. package/dist/src/table/chat-components/TableCalculationWidget.vue.d.ts +15 -0
  42. package/dist/src/table/chat-components/TableDataWidget.vue.d.ts +15 -0
  43. package/dist/src/table/chat-components/TableOverviewCard.vue.d.ts +61 -0
  44. package/dist/src/table/chat-components/TableResultView.vue.d.ts +48 -0
  45. package/dist/src/table/chat-components/TableRowActionCard.vue.d.ts +15 -0
  46. package/dist/src/table/components/filters/DialogTableFilterOptionItem.vue.d.ts +16 -0
  47. package/dist/src/table/components/filters/NumberComparisonFilter.vue.d.ts +12 -0
  48. package/dist/src/table/components/filters/NumberComparisonFilterSettings.vue.d.ts +12 -0
  49. package/dist/src/table/components/filters/NumberRangeFilter.vue.d.ts +12 -0
  50. package/dist/src/table/components/filters/NumberRangeFilterSettings.vue.d.ts +12 -0
  51. package/dist/src/table/components/filters/filter-utils.d.ts +14 -0
  52. package/dist/src/table/composables/useTableAgentTools.d.ts +33 -0
  53. package/dist/src/table/index.d.ts +339 -0
  54. package/dist/src/table/tool-sandbox.d.ts +13 -0
  55. package/dist/src/table/tool-utils.d.ts +11 -0
  56. package/dist/src/table/tools.d.ts +333 -1
  57. package/dist/src/table/types.d.ts +79 -0
  58. package/dist/tool-sandbox-DdkMLkDK.mjs +182 -0
  59. package/dist/tool-sandbox-DoF1PsyS.js +115 -0
  60. package/dist/useTableAgentTools-D5mzGf3A.js +1 -0
  61. package/dist/useTableAgentTools-DcN3kYRL.mjs +131 -0
  62. package/package.json +17 -17
  63. package/src/table/tools.ts +304 -1
  64. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +0 -1
  65. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +0 -925
  66. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +0 -5021
  67. package/dist/TableView-Ctnep-Qu.mjs +0 -6247
  68. package/dist/TableView-DJqyJL9L.js +0 -4
  69. package/dist/agenda-B54F8cEr.js +0 -1
  70. package/dist/orders-BMosTk6r.js +0 -1
  71. package/dist/reports-BQT_GZzU.js +0 -158
  72. package/dist/reports-DksZCTOw.mjs +0 -837
@@ -0,0 +1,59 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),f=require("lucide-vue-next"),D=require("./useTableAgentTools-D5mzGf3A.js"),c=require("./TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js"),O=require("./tool-sandbox-DoF1PsyS.js"),V={class:"w-full"},q={key:0,class:"flex items-center gap-2 py-3 text-xs text-muted-foreground"},$={key:1,class:"flex items-start gap-2 rounded-xl border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive"},M={key:2,class:"rounded-xl border bg-background p-4"},R={class:"flex items-center gap-2 text-xs font-medium text-muted-foreground"},I={class:"mt-3 break-words text-3xl font-semibold tracking-tight"},U={key:0,class:"mt-1 text-xs text-muted-foreground"},P={key:0},z={key:1},F=`
2
+ const get = (object, path) => {
3
+ if (!path) return object;
4
+ if (Object.prototype.hasOwnProperty.call(object, path)) return object[path];
5
+ return path.split('.').reduce((value, key) => value == null ? undefined : value[key], object);
6
+ };
7
+ const present = value => value !== undefined && value !== null && value !== '';
8
+ const numericValues = rows => rows
9
+ .map(row => Number(get(row, property)))
10
+ .filter(value => Number.isFinite(value));
11
+ const aggregate = rows => {
12
+ if (operation === 'count') {
13
+ return property ? rows.filter(row => present(get(row, property))).length : rows.length;
14
+ }
15
+ if (operation === 'unique_count') {
16
+ return new Set(rows.map(row => get(row, property)).filter(present).map(value => JSON.stringify(value))).size;
17
+ }
18
+ const values = numericValues(rows);
19
+ if (!values.length) return null;
20
+ if (operation === 'sum') return values.reduce((sum, value) => sum + value, 0);
21
+ if (operation === 'average') return values.reduce((sum, value) => sum + value, 0) / values.length;
22
+ if (operation === 'min') return values.reduce((minimum, value) => Math.min(minimum, value), Infinity);
23
+ if (operation === 'max') return values.reduce((maximum, value) => Math.max(maximum, value), -Infinity);
24
+ if (operation === 'median') {
25
+ const sorted = [...values].sort((left, right) => left - right);
26
+ const middle = Math.floor(sorted.length / 2);
27
+ return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;
28
+ }
29
+ throw new Error('Unsupported calculation operation: ' + operation);
30
+ };
31
+ const round = value => typeof value === 'number' && Number.isFinite(value)
32
+ ? Number(value.toFixed(precision))
33
+ : value;
34
+
35
+ if (groupBy) {
36
+ const grouped = new Map();
37
+ for (const row of data) {
38
+ const rawGroup = get(row, groupBy);
39
+ const key = rawGroup == null || rawGroup === '' ? 'Empty' : String(rawGroup);
40
+ if (!grouped.has(key)) grouped.set(key, []);
41
+ grouped.get(key).push(row);
42
+ }
43
+ return Array.from(grouped, ([group, rows]) => ({
44
+ group,
45
+ value: round(aggregate(rows)),
46
+ rows: rows.length,
47
+ }));
48
+ }
49
+
50
+ return round(aggregate(data));
51
+ `,G=t.defineComponent({__name:"TableCalculationWidget",props:{projectSlug:{},toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(A,{emit:S}){const o=A,w=S,y=t.ref(!0),d=t.ref(null),r=t.ref(null),{loadRows:B}=D.useTableAgentTools(o);function h(e){return e.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase())}function N(){if(o.status!=="completed")return!1;const e=o.resolvedArgs?._cachedData;return!e||typeof e!="object"||Array.isArray(e)?!1:typeof e.error=="string"?(d.value=e.error,y.value=!1,!0):!e.display||typeof e.display!="object"?!1:(r.value=e,y.value=!1,!0)}function j(e,l,a,m,i){const s=o.resolvedArgs?.title||(l==="custom"?"Calculation result":`${h(l)}${a?` of ${a}`:""}`);if(m&&Array.isArray(e))return{kind:"rows",title:s,rows:e.slice(0,100),columns:[{property:"group",label:m,type:"text"},{property:"value",label:h(l),type:"number"},{property:"rows",label:"Rows",type:"number"}],truncated:e.length>100,totalCount:e.length};if(Array.isArray(e)){const u=e.slice(0,100).map(n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{value:n});return{kind:"rows",title:s,rows:u,columns:c.inferTableColumns(u).slice(0,12),truncated:e.length>u.length,totalCount:e.length}}if(e&&typeof e=="object"&&Array.isArray(e.rows)){const u=e.rows.slice(0,100).map(n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{value:n});return{kind:"rows",title:s,description:e.summary==null?void 0:typeof e.summary=="string"?e.summary:JSON.stringify(e.summary),rows:u,columns:c.inferTableColumns(u).slice(0,12),truncated:e.rows.length>u.length,totalCount:e.rows.length}}return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"value")?{kind:"metric",title:typeof e.label=="string"&&e.label?e.label:s,value:e.value,description:typeof e.description=="string"?e.description:`Calculated from ${i} matching ${i===1?"row":"rows"}`}:e&&typeof e=="object"?{kind:"rows",title:s,rows:[e],columns:c.inferTableColumns([e]).slice(0,12),truncated:!1,totalCount:1}:{kind:"metric",title:s,value:e,description:`Calculated from ${i} matching ${i===1?"row":"rows"}`}}async function E(){if(!N()){y.value=!0,d.value=null;try{const e=String(o.resolvedArgs?.operation||"").toLowerCase(),l=["count","sum","average","min","max","median","unique_count","custom"];if(!l.includes(e))throw new Error(`Unsupported calculation. Choose one of: ${l.join(", ")}.`);const a=await B(o.resolvedArgs||{}),m=a.columns.length?a.columns:c.inferTableColumns(a.rows),i=o.resolvedArgs?.property?String(o.resolvedArgs.property):null,s=o.resolvedArgs?.groupBy?String(o.resolvedArgs.groupBy):null,u=i?c.resolveColumn(i,m):null,n=s?c.resolveColumn(s,m):null;if(i&&!u)throw new Error(`Unknown calculation property "${i}". Use a property or label reported by inspectTable.`);if(s&&!n)throw new Error(`Unknown grouping property "${s}". Use a property or label reported by inspectTable.`);const g=u?.property||null,v=n?.property||null;if(!["count","custom"].includes(e)&&!g)throw new Error(`The ${e} calculation needs a column property or label.`);const b=Math.min(Math.max(Math.trunc(Number(o.resolvedArgs?.precision??2)),0),10);let k=F;if(e==="custom"){const p=String(o.resolvedArgs?.code||"").trim();if(!p)throw new Error("A custom calculation needs JavaScript code that returns a result.");k=`
52
+ const get = (object, path) => {
53
+ if (!path) return object;
54
+ if (Object.prototype.hasOwnProperty.call(object, path)) return object[path];
55
+ return path.split('.').reduce((value, key) => value == null ? undefined : value[key], object);
56
+ };
57
+ const values = path => data.map(row => get(row, path));
58
+ ${p}
59
+ `}const x=await O.runSandboxedTableCode(k,{data:a.rows,rows:a.rows,columns:m.map(p=>({property:p.property,label:p.label||p.property,type:p.type||"text"})),now:new Date().toISOString(),operation:e,property:g,groupBy:v,precision:b},{timeoutMs:2e3,maxInputBytes:8*1024*1024,maxOutputBytes:256*1024}),_=j(x,e,g,v,a.rows.length),C=c.serializeBounded({title:_.title,display:_,calculation:{operation:e,property:g,groupBy:v,precision:b},matchedRowCount:a.rows.length,result:x,dateRange:a.requestedRange?{startDate:a.requestedRange.startDate,endDate:a.requestedRange.endDate,localProperty:a.localDateProperty}:null},512*1024);r.value=C,o.status!=="completed"&&w("submit",C)}catch(e){d.value=e?.message||"Failed to calculate table data.",o.status!=="completed"&&w("submit",{error:d.value,result:null})}finally{y.value=!1}}}const T=t.computed(()=>{const e=r.value?.display?.value;return e==null?"No value":typeof e=="number"?new Intl.NumberFormat(void 0,{maximumFractionDigits:r.value?.calculation?.precision??2}).format(e):typeof e=="object"?JSON.stringify(e):String(e)});return t.onMounted(E),(e,l)=>(t.openBlock(),t.createElementBlock("div",V,[y.value?(t.openBlock(),t.createElementBlock("div",q,[t.createVNode(t.unref(f.Loader2),{class:"size-4 animate-spin"}),l[0]||(l[0]=t.createElementVNode("span",null,"Calculating table data…",-1))])):d.value?(t.openBlock(),t.createElementBlock("div",$,[t.createVNode(t.unref(f.AlertCircle),{class:"mt-0.5 size-4 shrink-0"}),t.createElementVNode("span",null,t.toDisplayString(d.value),1)])):r.value?.display?.kind==="metric"?(t.openBlock(),t.createElementBlock("div",M,[t.createElementVNode("div",R,[t.createVNode(t.unref(f.Calculator),{class:"size-4 text-primary"}),t.createElementVNode("span",null,t.toDisplayString(r.value.display.title),1)]),t.createElementVNode("p",I,t.toDisplayString(T.value),1),r.value.display.description?(t.openBlock(),t.createElementBlock("p",U,t.toDisplayString(r.value.display.description),1)):t.createCommentVNode("",!0)])):r.value?.display?(t.openBlock(),t.createBlock(c._sfc_main,{key:3,title:r.value.display.title,description:r.value.display.description,rows:r.value.display.rows||[],columns:r.value.display.columns||[],"total-count":r.value.display.totalCount,view:o.resolvedArgs?.view||"auto","max-rows":100},{footer:t.withCtx(()=>[r.value.display.truncated?(t.openBlock(),t.createElementBlock("span",P," Showing the first "+t.toDisplayString(r.value.display.rows.length)+" of "+t.toDisplayString(r.value.display.totalCount)+" results ",1)):(t.openBlock(),t.createElementBlock("span",z," Calculated from "+t.toDisplayString(r.value.matchedRowCount)+" matching "+t.toDisplayString(r.value.matchedRowCount===1?"row":"rows"),1))]),_:1},8,["title","description","rows","columns","total-count","view"])):t.createCommentVNode("",!0)]))}});exports.default=G;
@@ -0,0 +1,254 @@
1
+ import { defineComponent as q, ref as b, computed as z, onMounted as F, openBlock as i, createElementBlock as d, createVNode as x, unref as C, createElementVNode as f, toDisplayString as c, createCommentVNode as $, createBlock as P, withCtx as G } from "vue";
2
+ import { Loader2 as L, AlertCircle as V, Calculator as J } from "lucide-vue-next";
3
+ import { u as W } from "./useTableAgentTools-DcN3kYRL.mjs";
4
+ import { _ as H, i as w, r as B, s as K } from "./TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs";
5
+ import { r as Q } from "./tool-sandbox-DdkMLkDK.mjs";
6
+ const X = { class: "w-full" }, Y = {
7
+ key: 0,
8
+ class: "flex items-center gap-2 py-3 text-xs text-muted-foreground"
9
+ }, Z = {
10
+ key: 1,
11
+ class: "flex items-start gap-2 rounded-xl border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive"
12
+ }, ee = {
13
+ key: 2,
14
+ class: "rounded-xl border bg-background p-4"
15
+ }, te = { class: "flex items-center gap-2 text-xs font-medium text-muted-foreground" }, re = { class: "mt-3 break-words text-3xl font-semibold tracking-tight" }, oe = {
16
+ key: 0,
17
+ class: "mt-1 text-xs text-muted-foreground"
18
+ }, ae = { key: 0 }, ne = { key: 1 }, le = `
19
+ const get = (object, path) => {
20
+ if (!path) return object;
21
+ if (Object.prototype.hasOwnProperty.call(object, path)) return object[path];
22
+ return path.split('.').reduce((value, key) => value == null ? undefined : value[key], object);
23
+ };
24
+ const present = value => value !== undefined && value !== null && value !== '';
25
+ const numericValues = rows => rows
26
+ .map(row => Number(get(row, property)))
27
+ .filter(value => Number.isFinite(value));
28
+ const aggregate = rows => {
29
+ if (operation === 'count') {
30
+ return property ? rows.filter(row => present(get(row, property))).length : rows.length;
31
+ }
32
+ if (operation === 'unique_count') {
33
+ return new Set(rows.map(row => get(row, property)).filter(present).map(value => JSON.stringify(value))).size;
34
+ }
35
+ const values = numericValues(rows);
36
+ if (!values.length) return null;
37
+ if (operation === 'sum') return values.reduce((sum, value) => sum + value, 0);
38
+ if (operation === 'average') return values.reduce((sum, value) => sum + value, 0) / values.length;
39
+ if (operation === 'min') return values.reduce((minimum, value) => Math.min(minimum, value), Infinity);
40
+ if (operation === 'max') return values.reduce((maximum, value) => Math.max(maximum, value), -Infinity);
41
+ if (operation === 'median') {
42
+ const sorted = [...values].sort((left, right) => left - right);
43
+ const middle = Math.floor(sorted.length / 2);
44
+ return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;
45
+ }
46
+ throw new Error('Unsupported calculation operation: ' + operation);
47
+ };
48
+ const round = value => typeof value === 'number' && Number.isFinite(value)
49
+ ? Number(value.toFixed(precision))
50
+ : value;
51
+
52
+ if (groupBy) {
53
+ const grouped = new Map();
54
+ for (const row of data) {
55
+ const rawGroup = get(row, groupBy);
56
+ const key = rawGroup == null || rawGroup === '' ? 'Empty' : String(rawGroup);
57
+ if (!grouped.has(key)) grouped.set(key, []);
58
+ grouped.get(key).push(row);
59
+ }
60
+ return Array.from(grouped, ([group, rows]) => ({
61
+ group,
62
+ value: round(aggregate(rows)),
63
+ rows: rows.length,
64
+ }));
65
+ }
66
+
67
+ return round(aggregate(data));
68
+ `, de = /* @__PURE__ */ q({
69
+ __name: "TableCalculationWidget",
70
+ props: {
71
+ projectSlug: {},
72
+ toolName: {},
73
+ instanceId: {},
74
+ instanceName: {},
75
+ moduleType: {},
76
+ resolvedArgs: {},
77
+ status: {}
78
+ },
79
+ emits: ["submit"],
80
+ setup(T, { emit: D }) {
81
+ const r = T, _ = D, g = b(!0), m = b(null), t = b(null), { loadRows: E } = W(r);
82
+ function k(e) {
83
+ return e.replace(/_/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
84
+ }
85
+ function M() {
86
+ if (r.status !== "completed") return !1;
87
+ const e = r.resolvedArgs?._cachedData;
88
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : typeof e.error == "string" ? (m.value = e.error, g.value = !1, !0) : !e.display || typeof e.display != "object" ? !1 : (t.value = e, g.value = !1, !0);
89
+ }
90
+ function R(e, n, o, y, u) {
91
+ const l = r.resolvedArgs?.title || (n === "custom" ? "Calculation result" : `${k(n)}${o ? ` of ${o}` : ""}`);
92
+ if (y && Array.isArray(e))
93
+ return {
94
+ kind: "rows",
95
+ title: l,
96
+ rows: e.slice(0, 100),
97
+ columns: [
98
+ { property: "group", label: y, type: "text" },
99
+ { property: "value", label: k(n), type: "number" },
100
+ { property: "rows", label: "Rows", type: "number" }
101
+ ],
102
+ truncated: e.length > 100,
103
+ totalCount: e.length
104
+ };
105
+ if (Array.isArray(e)) {
106
+ const s = e.slice(0, 100).map((a) => a && typeof a == "object" && !Array.isArray(a) ? a : { value: a });
107
+ return {
108
+ kind: "rows",
109
+ title: l,
110
+ rows: s,
111
+ columns: w(s).slice(0, 12),
112
+ truncated: e.length > s.length,
113
+ totalCount: e.length
114
+ };
115
+ }
116
+ if (e && typeof e == "object" && Array.isArray(e.rows)) {
117
+ const s = e.rows.slice(0, 100).map((a) => a && typeof a == "object" && !Array.isArray(a) ? a : { value: a });
118
+ return {
119
+ kind: "rows",
120
+ title: l,
121
+ description: e.summary == null ? void 0 : typeof e.summary == "string" ? e.summary : JSON.stringify(e.summary),
122
+ rows: s,
123
+ columns: w(s).slice(0, 12),
124
+ truncated: e.rows.length > s.length,
125
+ totalCount: e.rows.length
126
+ };
127
+ }
128
+ return e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "value") ? {
129
+ kind: "metric",
130
+ title: typeof e.label == "string" && e.label ? e.label : l,
131
+ value: e.value,
132
+ description: typeof e.description == "string" ? e.description : `Calculated from ${u} matching ${u === 1 ? "row" : "rows"}`
133
+ } : e && typeof e == "object" ? {
134
+ kind: "rows",
135
+ title: l,
136
+ rows: [e],
137
+ columns: w([e]).slice(0, 12),
138
+ truncated: !1,
139
+ totalCount: 1
140
+ } : {
141
+ kind: "metric",
142
+ title: l,
143
+ value: e,
144
+ description: `Calculated from ${u} matching ${u === 1 ? "row" : "rows"}`
145
+ };
146
+ }
147
+ async function I() {
148
+ if (!M()) {
149
+ g.value = !0, m.value = null;
150
+ try {
151
+ const e = String(r.resolvedArgs?.operation || "").toLowerCase(), n = ["count", "sum", "average", "min", "max", "median", "unique_count", "custom"];
152
+ if (!n.includes(e))
153
+ throw new Error(`Unsupported calculation. Choose one of: ${n.join(", ")}.`);
154
+ const o = await E(r.resolvedArgs || {}), y = o.columns.length ? o.columns : w(o.rows), u = r.resolvedArgs?.property ? String(r.resolvedArgs.property) : null, l = r.resolvedArgs?.groupBy ? String(r.resolvedArgs.groupBy) : null, s = u ? B(u, y) : null, a = l ? B(l, y) : null;
155
+ if (u && !s)
156
+ throw new Error(`Unknown calculation property "${u}". Use a property or label reported by inspectTable.`);
157
+ if (l && !a)
158
+ throw new Error(`Unknown grouping property "${l}". Use a property or label reported by inspectTable.`);
159
+ const v = s?.property || null, h = a?.property || null;
160
+ if (!["count", "custom"].includes(e) && !v)
161
+ throw new Error(`The ${e} calculation needs a column property or label.`);
162
+ const A = Math.min(Math.max(Math.trunc(Number(r.resolvedArgs?.precision ?? 2)), 0), 10);
163
+ let j = le;
164
+ if (e === "custom") {
165
+ const p = String(r.resolvedArgs?.code || "").trim();
166
+ if (!p) throw new Error("A custom calculation needs JavaScript code that returns a result.");
167
+ j = `
168
+ const get = (object, path) => {
169
+ if (!path) return object;
170
+ if (Object.prototype.hasOwnProperty.call(object, path)) return object[path];
171
+ return path.split('.').reduce((value, key) => value == null ? undefined : value[key], object);
172
+ };
173
+ const values = path => data.map(row => get(row, path));
174
+ ${p}
175
+ `;
176
+ }
177
+ const S = await Q(j, {
178
+ data: o.rows,
179
+ rows: o.rows,
180
+ columns: y.map((p) => ({
181
+ property: p.property,
182
+ label: p.label || p.property,
183
+ type: p.type || "text"
184
+ })),
185
+ now: (/* @__PURE__ */ new Date()).toISOString(),
186
+ operation: e,
187
+ property: v,
188
+ groupBy: h,
189
+ precision: A
190
+ }, {
191
+ timeoutMs: 2e3,
192
+ maxInputBytes: 8 * 1024 * 1024,
193
+ maxOutputBytes: 256 * 1024
194
+ }), N = R(S, e, v, h, o.rows.length), O = K({
195
+ title: N.title,
196
+ display: N,
197
+ calculation: { operation: e, property: v, groupBy: h, precision: A },
198
+ matchedRowCount: o.rows.length,
199
+ result: S,
200
+ dateRange: o.requestedRange ? {
201
+ startDate: o.requestedRange.startDate,
202
+ endDate: o.requestedRange.endDate,
203
+ localProperty: o.localDateProperty
204
+ } : null
205
+ }, 512 * 1024);
206
+ t.value = O, r.status !== "completed" && _("submit", O);
207
+ } catch (e) {
208
+ m.value = e?.message || "Failed to calculate table data.", r.status !== "completed" && _("submit", { error: m.value, result: null });
209
+ } finally {
210
+ g.value = !1;
211
+ }
212
+ }
213
+ }
214
+ const U = z(() => {
215
+ const e = t.value?.display?.value;
216
+ return e == null ? "No value" : typeof e == "number" ? new Intl.NumberFormat(void 0, {
217
+ maximumFractionDigits: t.value?.calculation?.precision ?? 2
218
+ }).format(e) : typeof e == "object" ? JSON.stringify(e) : String(e);
219
+ });
220
+ return F(I), (e, n) => (i(), d("div", X, [
221
+ g.value ? (i(), d("div", Y, [
222
+ x(C(L), { class: "size-4 animate-spin" }),
223
+ n[0] || (n[0] = f("span", null, "Calculating table data…", -1))
224
+ ])) : m.value ? (i(), d("div", Z, [
225
+ x(C(V), { class: "mt-0.5 size-4 shrink-0" }),
226
+ f("span", null, c(m.value), 1)
227
+ ])) : t.value?.display?.kind === "metric" ? (i(), d("div", ee, [
228
+ f("div", te, [
229
+ x(C(J), { class: "size-4 text-primary" }),
230
+ f("span", null, c(t.value.display.title), 1)
231
+ ]),
232
+ f("p", re, c(U.value), 1),
233
+ t.value.display.description ? (i(), d("p", oe, c(t.value.display.description), 1)) : $("", !0)
234
+ ])) : t.value?.display ? (i(), P(H, {
235
+ key: 3,
236
+ title: t.value.display.title,
237
+ description: t.value.display.description,
238
+ rows: t.value.display.rows || [],
239
+ columns: t.value.display.columns || [],
240
+ "total-count": t.value.display.totalCount,
241
+ view: r.resolvedArgs?.view || "auto",
242
+ "max-rows": 100
243
+ }, {
244
+ footer: G(() => [
245
+ t.value.display.truncated ? (i(), d("span", ae, " Showing the first " + c(t.value.display.rows.length) + " of " + c(t.value.display.totalCount) + " results ", 1)) : (i(), d("span", ne, " Calculated from " + c(t.value.matchedRowCount) + " matching " + c(t.value.matchedRowCount === 1 ? "row" : "rows"), 1))
246
+ ]),
247
+ _: 1
248
+ }, 8, ["title", "description", "rows", "columns", "total-count", "view"])) : $("", !0)
249
+ ]));
250
+ }
251
+ });
252
+ export {
253
+ de as default
254
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),g=require("lucide-vue-next"),B=require("./useTableAgentTools-D5mzGf3A.js"),c=require("./TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js"),D={class:"w-full"},C={key:0,class:"flex items-center gap-2 py-3 text-xs text-muted-foreground"},M={key:1,class:"flex items-start gap-2 rounded-xl border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive"},N={key:0},R={key:1},q=t.defineComponent({__name:"TableDataWidget",props:{projectSlug:{},toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(y,{emit:h}){const s=y,f=h,d=t.ref(!0),u=t.ref(null),o=t.ref(null),{loadRows:w}=B.useTableAgentTools(s);function b(e){const l=Number(e);return Number.isFinite(l)?Math.min(Math.max(Math.trunc(l),1),100):20}function _(e,l){const a=l.length?l:c.inferTableColumns(e),p=Array.isArray(s.resolvedArgs?.columns)?s.resolvedArgs.columns:[];if(p.length){const n=p.map(r=>({requested:String(r),column:c.resolveColumn(String(r),a)})),m=n.filter(r=>!r.column).map(r=>r.requested);if(m.length)throw new Error(`Unknown table ${m.length===1?"column":"columns"}: ${m.join(", ")}. Use properties or labels reported by inspectTable.`);const v=n.map(r=>r.column);return Array.from(new Map(v.map(r=>[r.property,r])).values()).slice(0,12)}const i=a.filter(n=>n.visible!==!1&&!n._remove);return(i.length?i:a).slice(0,12)}function A(e,l){return Object.fromEntries(l.map(a=>[a.property,c.resolveProperty(e,a.property)]))}function k(){if(s.status!=="completed")return!1;const e=s.resolvedArgs?._cachedData;return!e||typeof e!="object"||Array.isArray(e)?!1:typeof e.error=="string"?(u.value=e.error,d.value=!1,!0):!Array.isArray(e.rows)||!Array.isArray(e.columns)?!1:(o.value=e,d.value=!1,!0)}async function x(){if(!k()){d.value=!0,u.value=null;try{const e=await w(s.resolvedArgs||{}),l=b(s.resolvedArgs?.limit),a=_(e.rows,e.columns),p=e.rows.slice(0,l),i=p.map(r=>A(r,a)),n=e.columns.length?e.columns:c.inferTableColumns(e.rows),m=p.map((r,S)=>({row:S,match:c.buildRowReference(r,e.rows,n)})),v=c.serializeBounded({title:s.resolvedArgs?.title||s.instanceName,view:s.resolvedArgs?.view||"auto",columns:a.map(r=>({property:r.property,label:r.label||r.property,type:r.type||"text"})),rows:i,rowReferences:m,totalFetched:e.sourceRows.length,totalMatched:e.rows.length,displayedCount:i.length,truncated:e.rows.length>i.length,dateRange:e.requestedRange?{startDate:e.requestedRange.startDate,endDate:e.requestedRange.endDate,localProperty:e.localDateProperty}:null,availableActions:e.actions.map(r=>({id:r.id,label:r.label}))});o.value=v,s.status!=="completed"&&f("submit",v)}catch(e){u.value=e?.message||"Failed to load table data.",s.status!=="completed"&&f("submit",{error:u.value,rows:[],totalMatched:0})}finally{d.value=!1}}}return t.onMounted(x),(e,l)=>(t.openBlock(),t.createElementBlock("div",D,[d.value?(t.openBlock(),t.createElementBlock("div",C,[t.createVNode(t.unref(g.Loader2),{class:"size-4 animate-spin"}),l[0]||(l[0]=t.createElementVNode("span",null,"Loading table data…",-1))])):u.value?(t.openBlock(),t.createElementBlock("div",M,[t.createVNode(t.unref(g.AlertCircle),{class:"mt-0.5 size-4 shrink-0"}),t.createElementVNode("span",null,t.toDisplayString(u.value),1)])):o.value?(t.openBlock(),t.createBlock(c._sfc_main,{key:2,title:o.value.title,rows:o.value.rows||[],columns:o.value.columns||[],view:o.value.view||"auto","total-count":o.value.totalMatched,"max-rows":o.value.displayedCount,"empty-text":"No rows match this request."},{footer:t.withCtx(()=>[o.value.truncated?(t.openBlock(),t.createElementBlock("span",N," Showing "+t.toDisplayString(o.value.displayedCount)+" of "+t.toDisplayString(o.value.totalMatched)+" matching rows ",1)):(t.openBlock(),t.createElementBlock("span",R,t.toDisplayString(o.value.totalMatched)+" "+t.toDisplayString(o.value.totalMatched===1?"row":"rows"),1))]),_:1},8,["title","rows","columns","view","total-count","max-rows"])):t.createCommentVNode("",!0)]))}});exports.default=q;
@@ -0,0 +1,121 @@
1
+ import { defineComponent as q, ref as h, onMounted as T, openBlock as u, createElementBlock as p, createVNode as w, unref as y, createElementVNode as b, toDisplayString as v, createBlock as j, withCtx as B, createCommentVNode as E } from "vue";
2
+ import { Loader2 as z, AlertCircle as F } from "lucide-vue-next";
3
+ import { u as L } from "./useTableAgentTools-DcN3kYRL.mjs";
4
+ import { _ as P, i as A, b as V, s as $, r as U, a as I } from "./TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs";
5
+ const O = { class: "w-full" }, W = {
6
+ key: 0,
7
+ class: "flex items-center gap-2 py-3 text-xs text-muted-foreground"
8
+ }, G = {
9
+ key: 1,
10
+ class: "flex items-start gap-2 rounded-xl border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive"
11
+ }, H = { key: 0 }, J = { key: 1 }, Z = /* @__PURE__ */ q({
12
+ __name: "TableDataWidget",
13
+ props: {
14
+ projectSlug: {},
15
+ toolName: {},
16
+ instanceId: {},
17
+ instanceName: {},
18
+ moduleType: {},
19
+ resolvedArgs: {},
20
+ status: {}
21
+ },
22
+ emits: ["submit"],
23
+ setup(_, { emit: x }) {
24
+ const s = _, g = x, c = h(!0), n = h(null), r = h(null), { loadRows: k } = L(s);
25
+ function C(e) {
26
+ const a = Number(e);
27
+ return Number.isFinite(a) ? Math.min(Math.max(Math.trunc(a), 1), 100) : 20;
28
+ }
29
+ function M(e, a) {
30
+ const o = a.length ? a : A(e), d = Array.isArray(s.resolvedArgs?.columns) ? s.resolvedArgs.columns : [];
31
+ if (d.length) {
32
+ const l = d.map((t) => ({
33
+ requested: String(t),
34
+ column: U(String(t), o)
35
+ })), m = l.filter((t) => !t.column).map((t) => t.requested);
36
+ if (m.length)
37
+ throw new Error(`Unknown table ${m.length === 1 ? "column" : "columns"}: ${m.join(", ")}. Use properties or labels reported by inspectTable.`);
38
+ const f = l.map((t) => t.column);
39
+ return Array.from(new Map(f.map((t) => [t.property, t])).values()).slice(0, 12);
40
+ }
41
+ const i = o.filter((l) => l.visible !== !1 && !l._remove);
42
+ return (i.length ? i : o).slice(0, 12);
43
+ }
44
+ function R(e, a) {
45
+ return Object.fromEntries(a.map((o) => [
46
+ o.property,
47
+ I(e, o.property)
48
+ ]));
49
+ }
50
+ function D() {
51
+ if (s.status !== "completed") return !1;
52
+ const e = s.resolvedArgs?._cachedData;
53
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : typeof e.error == "string" ? (n.value = e.error, c.value = !1, !0) : !Array.isArray(e.rows) || !Array.isArray(e.columns) ? !1 : (r.value = e, c.value = !1, !0);
54
+ }
55
+ async function N() {
56
+ if (!D()) {
57
+ c.value = !0, n.value = null;
58
+ try {
59
+ const e = await k(s.resolvedArgs || {}), a = C(s.resolvedArgs?.limit), o = M(e.rows, e.columns), d = e.rows.slice(0, a), i = d.map((t) => R(t, o)), l = e.columns.length ? e.columns : A(e.rows), m = d.map((t, S) => ({
60
+ row: S,
61
+ match: V(t, e.rows, l)
62
+ })), f = $({
63
+ title: s.resolvedArgs?.title || s.instanceName,
64
+ view: s.resolvedArgs?.view || "auto",
65
+ columns: o.map((t) => ({
66
+ property: t.property,
67
+ label: t.label || t.property,
68
+ type: t.type || "text"
69
+ })),
70
+ rows: i,
71
+ rowReferences: m,
72
+ totalFetched: e.sourceRows.length,
73
+ totalMatched: e.rows.length,
74
+ displayedCount: i.length,
75
+ truncated: e.rows.length > i.length,
76
+ dateRange: e.requestedRange ? {
77
+ startDate: e.requestedRange.startDate,
78
+ endDate: e.requestedRange.endDate,
79
+ localProperty: e.localDateProperty
80
+ } : null,
81
+ availableActions: e.actions.map((t) => ({
82
+ id: t.id,
83
+ label: t.label
84
+ }))
85
+ });
86
+ r.value = f, s.status !== "completed" && g("submit", f);
87
+ } catch (e) {
88
+ n.value = e?.message || "Failed to load table data.", s.status !== "completed" && g("submit", { error: n.value, rows: [], totalMatched: 0 });
89
+ } finally {
90
+ c.value = !1;
91
+ }
92
+ }
93
+ }
94
+ return T(N), (e, a) => (u(), p("div", O, [
95
+ c.value ? (u(), p("div", W, [
96
+ w(y(z), { class: "size-4 animate-spin" }),
97
+ a[0] || (a[0] = b("span", null, "Loading table data…", -1))
98
+ ])) : n.value ? (u(), p("div", G, [
99
+ w(y(F), { class: "mt-0.5 size-4 shrink-0" }),
100
+ b("span", null, v(n.value), 1)
101
+ ])) : r.value ? (u(), j(P, {
102
+ key: 2,
103
+ title: r.value.title,
104
+ rows: r.value.rows || [],
105
+ columns: r.value.columns || [],
106
+ view: r.value.view || "auto",
107
+ "total-count": r.value.totalMatched,
108
+ "max-rows": r.value.displayedCount,
109
+ "empty-text": "No rows match this request."
110
+ }, {
111
+ footer: B(() => [
112
+ r.value.truncated ? (u(), p("span", H, " Showing " + v(r.value.displayedCount) + " of " + v(r.value.totalMatched) + " matching rows ", 1)) : (u(), p("span", J, v(r.value.totalMatched) + " " + v(r.value.totalMatched === 1 ? "row" : "rows"), 1))
113
+ ]),
114
+ _: 1
115
+ }, 8, ["title", "rows", "columns", "view", "total-count", "max-rows"])) : E("", !0)
116
+ ]));
117
+ }
118
+ });
119
+ export {
120
+ Z as default
121
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ae=require("nuxt/app"),d=require("lucide-vue-next"),le=require("./dateRangePresets-CPWqst_x.js"),N=require("./TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js"),ie={class:"w-full min-w-0"},ce={key:0,class:"flex items-center gap-2 py-3"},de={class:"text-xs text-muted-foreground"},ue={key:1,class:"rounded-xl border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive"},me={key:2,class:"overflow-hidden rounded-xl border bg-background"},pe={class:"flex items-start gap-3 border-b bg-muted/30 p-3"},fe={class:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary/10"},ge={class:"min-w-0 flex-1"},ye={class:"truncate text-sm font-semibold"},be={class:"mt-0.5 text-[11px] text-muted-foreground"},xe={key:0,class:"mt-2 flex flex-wrap gap-1"},he={class:"grid gap-3 border-b p-3 sm:grid-cols-2"},_e={class:"rounded-lg border bg-muted/15 p-2.5"},ke={class:"flex items-center gap-1.5 text-[11px] font-medium"},ve={class:"rounded-lg border bg-muted/15 p-2.5"},we={class:"flex items-center gap-1.5 text-[11px] font-medium"},Ne={key:0,class:"mt-1.5 flex flex-wrap gap-1"},Ae={key:1,class:"mt-1 text-xs text-muted-foreground"},Ee={class:"border-b p-3"},Be={class:"mb-2 flex items-center justify-between gap-2"},Se={class:"flex items-center gap-1.5 text-[11px] font-medium"},Ve={class:"text-[10px] text-muted-foreground"},Ce={key:0,class:"flex flex-wrap gap-1.5"},De={class:"font-medium"},$e={class:"text-muted-foreground"},Re={key:0,class:"text-muted-foreground/70"},je={key:1,class:"text-xs text-muted-foreground"},ze={class:"p-3"},Fe={key:0,class:"mt-2 text-[11px] text-amber-600 dark:text-amber-400"},Le={key:0,class:"border-t bg-muted/20 px-3 py-2 text-[10px] text-muted-foreground"},Te=e.defineComponent({__name:"TableOverviewCard",props:{projectSlug:{},toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(f,{emit:z}){const i=f,F=z,{$useProjectService:L,$useModuleStorage:T,$useFlowBuilder:O,$useRoute:A}=ae.useNuxtApp(),p=e.ref(!0),u=e.ref(null),a=e.ref(null),g=e.ref(null),E=e.ref(!1),B=e.computed(()=>{const t=Number(i.resolvedArgs?.sampleLimit);return Number.isFinite(t)?Math.min(Math.max(Math.floor(t),1),10):3}),I=e.computed(()=>a.value?.columns.filter(t=>t.visible!==!1)||[]),S=e.computed(()=>{if(!a.value)return[];const t={fetchConfigured:"Data source connected",viewable:"Row details",editable:"Editable",deletable:"Deletable",addable:"Addable",searchable:"Searchable",downloadable:"Downloadable",allowBulkActions:"Bulk actions"};return Object.entries(a.value.capabilities).filter(([,r])=>r).map(([r])=>t[r]||r)});function M(){if(i.status!=="completed")return!1;const t=i.resolvedArgs?._cachedData;return!t||typeof t!="object"||Array.isArray(t)?!1:typeof t.error=="string"?(u.value=t.error,p.value=!1,!0):!t.module||!Array.isArray(t.columns)||!Array.isArray(t.sampleRows)?!1:(a.value=t,g.value=i.resolvedArgs?._fetchedAt||null,p.value=!1,!0)}async function P(){p.value=!0,u.value=null;try{const t=L(),r=T({projectId:i.projectSlug,moduleId:i.instanceId}),[o,n]=await Promise.all([t.getModule(i.projectSlug,i.instanceId),r.getAllModuleData()]),s=q(n),l=U(s.columns),b=Y(s.itemActions),h=H(s.filters),_=Q(s.stats),k=W(s.dateRangeFilter);let m=[],v;if(o?.config?.getItems)try{const{runFlow:c}=O(),ne=typeof A=="function"?A():null,se=await c(o.config.getItems,Z(k.defaultPreset,ne?.query||{}));m=G(se)}catch(c){v=D(c,"The table data sample could not be loaded.")}const w=l.length>0?l:X(m),$=w.filter(c=>c.visible!==!1).slice(0,40),R=$.length>0?m.slice(0,B.value).map(c=>J(c,$)).map(te):[],j=N.serializeBounded({module:{id:i.instanceId,name:o?.name||i.instanceName,type:o?.type||i.moduleType},capabilities:{fetchConfigured:!!o?.config?.getItems,viewable:o?.config?.viewable===!0,editable:o?.config?.editable===!0,deletable:o?.config?.deletable===!0,addable:o?.config?.addable===!0,searchable:o?.config?.searchable===!0,downloadable:o?.config?.downloadable===!0,allowBulkActions:o?.config?.allowBulkActions===!0},columnCount:w.length,columns:w.slice(0,40),dateRangeFilter:k,actionCount:b.length,actions:b.slice(0,20),filters:h.slice(0,20),stats:_.slice(0,20),totalRows:m.length,sampleCount:R.length,sampleRows:R,...v?{sampleError:v}:{}},512*1024);a.value=j,g.value=new Date().toISOString(),V(j)}catch(t){u.value=D(t,"Failed to inspect this table."),V({error:u.value})}finally{p.value=!1}}function V(t){i.status==="completed"||E.value||(E.value=!0,F("submit",t))}function q(t){return Array.isArray(t)?Object.fromEntries(t.filter(r=>r&&typeof r.key=="string").map(r=>[r.key,r.value])):t&&typeof t=="object"?t:{}}function U(t){return Array.isArray(t)?t.filter(r=>r&&typeof r.property=="string"&&r.property.trim()).map((r,o)=>({id:typeof r.id=="string"?r.id:`column-${o}`,property:r.property,label:typeof r.label=="string"&&r.label.trim()?r.label:y(r.property),type:typeof r.type=="string"&&r.type?r.type:"text",visible:r.visible!==!1})):[]}function Y(t){return Array.isArray(t)?t.filter(r=>r&&r.flow&&(typeof r.id=="string"||typeof r.label=="string")).map((r,o)=>({id:typeof r.id=="string"?r.id:`action-${o}`,label:typeof r.label=="string"&&r.label.trim()?r.label:`Action ${o+1}`})):[]}function H(t){return Array.isArray(t)?t.filter(r=>r&&typeof r.property=="string").map((r,o)=>({id:typeof r.id=="string"?r.id:`filter-${o}`,label:typeof r.label=="string"&&r.label.trim()?r.label:y(r.property),property:r.property})):[]}function Q(t){return Array.isArray(t)?t.filter(r=>r&&typeof r.method=="string").map((r,o)=>({id:typeof r.id=="string"?r.id:`stat-${o}`,label:typeof r.label=="string"&&r.label.trim()?r.label:`Statistic ${o+1}`,method:r.method,...typeof r.field=="string"&&r.field?{field:r.field}:{}})):[]}function W(t){const r=t&&typeof t.defaultDate=="string"&&t.defaultDate?t.defaultDate:null;return{enabled:!!r,defaultPreset:r,label:r?re(r):"Not configured"}}function Z(t,r){const o=Object.entries(r).map(([h,_])=>({name:h.replace(/-([a-z])/g,(k,m)=>m.toUpperCase()),type:"routeQueryParam",value:_??null}));if(!t)return o;const s=le.getDateRangePresets()[t];if(!Array.isArray(s)||!s[0])return o;const l=C(s[0],!1),b=C(s[1]||s[0],!0);return[...o,{name:"dateRangeFilter",type:"dateRangeFilter",value:{from:l,to:b}}]}function C(t,r){const[o,n,s]=t.split("-").map(Number),l=new Date(o,n-1,s);return r&&l.setHours(23,59,59,999),l}function G(t){return(Array.isArray(t)?t:Array.isArray(t?.data)?t.data:Array.isArray(t?.items)?t.items:Array.isArray(t?.rows)?t.rows:[]).map(o=>o&&typeof o=="object"&&!Array.isArray(o)?o:{value:o})}function J(t,r){return Object.fromEntries(r.map(o=>[o.property,K(t,o.property)]))}function K(t,r){const o=r.split(".");if(!o.some(n=>["__proto__","constructor","prototype"].includes(n)))return Object.prototype.hasOwnProperty.call(t,r)?t[r]:o.reduce((n,s)=>n?.[s],t)}function X(t){const r=[],o=new Set;for(const n of t.slice(0,10))for(const s of Object.keys(n))o.has(s)||(o.add(s),r.push(s));return r.slice(0,40).map((n,s)=>({id:`inferred-${s}`,property:n,label:y(n),type:ee(n,t.map(l=>l[n])),visible:!0}))}function ee(t,r){const n=t.toLowerCase().replace(/[_.-]/g,"");if(/email$/.test(n))return"email";if(/(phone|mobile|telephone|tel)$/.test(n))return"phone";if(/(image|photo|avatar|thumbnail|logo|picture)$/.test(n))return"image";if(/(url|link|website|href)$/.test(n))return"URL";if(/(price|amount|cost|total|revenue|salary|fee)$/.test(n))return"currency";if(/(date|createdat|updatedat|timestamp)$/.test(n))return"datetime";const s=r.filter(l=>l!=null&&l!=="");return s.length===0?"text":s.every(l=>typeof l=="boolean")?"boolean":s.every(l=>Array.isArray(l))?"array":s.every(l=>typeof l=="number")?"number":"text"}function te(t){const r=x(t,0,new WeakSet);try{return N.serializeBounded(r,32*1024)}catch{return{_sampleOmitted:"This sample row was too large to include in chat."}}}function x(t,r,o){if(t==null||typeof t=="number"||typeof t=="boolean")return t;if(typeof t=="string")return t.length>500?`${t.slice(0,499)}…`:t;if(typeof t=="bigint")return String(t);if(t instanceof Date)return t.toISOString();if(typeof t!="object")return String(t);if(r>=3)return Array.isArray(t)?`[Array(${t.length})]`:"[Object]";if(o.has(t))return"[Circular]";if(o.add(t),Array.isArray(t)){const s=t.slice(0,10).map(l=>x(l,r+1,o));return t.length>10&&s.push(`[${t.length-10} more items]`),s}const n={};for(const[s,l]of Object.entries(t).slice(0,20))s==="__proto__"||s==="constructor"||s==="prototype"||(n[s]=x(l,r+1,o));return n}function y(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_.-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,r=>r.toUpperCase())}function re(t){return{today:"Today",yesterday:"Yesterday",last7days:"Last 7 days",lastMonth:"Last 30 days",last6months:"Last 6 months",lastYear:"Last 12 months",tomorrow:"Tomorrow",next7days:"Next 7 days",nextMonth:"Next 30 days",next6months:"Next 6 months",nextYear:"Next 12 months"}[t]||y(t)}function D(t,r){const o=t?.data?.statusMessage||t?.statusMessage||t?.message;return typeof o=="string"&&o.trim()?o.slice(0,500):r}function oe(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?"":r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}return e.onMounted(()=>{i.status==="completed"&&M()||P()}),(t,r)=>{const o=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",ie,[p.value?(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(e.unref(d.Loader2),{class:"size-4 animate-spin text-muted-foreground"}),e.createElementVNode("span",de,"Inspecting "+e.toDisplayString(f.instanceName)+"…",1)])):u.value?(e.openBlock(),e.createElementBlock("div",ue,e.toDisplayString(u.value),1)):a.value?(e.openBlock(),e.createElementBlock("div",me,[e.createElementVNode("div",pe,[e.createElementVNode("div",fe,[e.createVNode(e.unref(d.Table2),{class:"size-4 text-primary"})]),e.createElementVNode("div",ge,[e.createElementVNode("p",ye,e.toDisplayString(a.value.module.name),1),e.createElementVNode("p",be,e.toDisplayString(a.value.totalRows)+" "+e.toDisplayString(a.value.totalRows===1?"row":"rows")+" · "+e.toDisplayString(a.value.columnCount)+" "+e.toDisplayString(a.value.columnCount===1?"column":"columns"),1),S.value.length?(e.openBlock(),e.createElementBlock("div",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,n=>(e.openBlock(),e.createElementBlock("span",{key:n,class:"inline-flex items-center gap-1 rounded-full border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground"},[e.createVNode(e.unref(d.Check),{class:"size-2.5 text-emerald-500"}),e.createTextVNode(" "+e.toDisplayString(n),1)]))),128))])):e.createCommentVNode("",!0)]),e.createVNode(o,{to:`/projects/${f.projectSlug}/modules/${f.instanceId}`,class:"inline-flex shrink-0 items-center gap-1 text-[11px] text-primary hover:underline"},{default:e.withCtx(()=>[r[0]||(r[0]=e.createTextVNode(" Open ",-1)),e.createVNode(e.unref(d.ExternalLink),{class:"size-3"})]),_:1},8,["to"])]),e.createElementVNode("div",he,[e.createElementVNode("div",_e,[e.createElementVNode("div",ke,[e.createVNode(e.unref(d.CalendarRange),{class:"size-3.5 text-primary"}),r[1]||(r[1]=e.createTextVNode(" Date range filter ",-1))]),e.createElementVNode("p",{class:e.normalizeClass(["mt-1 text-xs",a.value.dateRangeFilter.enabled?"text-foreground":"text-muted-foreground"])},e.toDisplayString(a.value.dateRangeFilter.label),3)]),e.createElementVNode("div",ve,[e.createElementVNode("div",we,[e.createVNode(e.unref(d.MousePointerClick),{class:"size-3.5 text-primary"}),r[2]||(r[2]=e.createTextVNode(" Row actions ",-1))]),a.value.actions.length?(e.openBlock(),e.createElementBlock("div",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.actions,n=>(e.openBlock(),e.createElementBlock("span",{key:n.id,class:"rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary"},e.toDisplayString(n.label),1))),128))])):(e.openBlock(),e.createElementBlock("p",Ae,"No row actions configured"))])]),e.createElementVNode("div",Ee,[e.createElementVNode("div",Be,[e.createElementVNode("div",Se,[e.createVNode(e.unref(d.Columns3),{class:"size-3.5 text-primary"}),r[3]||(r[3]=e.createTextVNode(" Columns ",-1))]),e.createElementVNode("span",Ve,e.toDisplayString(I.value.length)+" visible ",1)]),a.value.columns.length?(e.openBlock(),e.createElementBlock("div",Ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.columns,n=>(e.openBlock(),e.createElementBlock("span",{key:n.id||n.property,class:e.normalizeClass(["inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[10px]",n.visible?"bg-background":"bg-muted/40 text-muted-foreground"])},[e.createElementVNode("span",De,e.toDisplayString(n.label),1),e.createElementVNode("span",$e,e.toDisplayString(n.type),1),n.visible?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Re,"hidden"))],2))),128))])):(e.openBlock(),e.createElementBlock("p",je,"No columns could be inferred."))]),e.createElementVNode("div",ze,[e.createVNode(N._sfc_main,{rows:a.value.sampleRows,columns:a.value.columns,title:"Sample data",description:a.value.sampleCount?`First ${a.value.sampleCount} ${a.value.sampleCount===1?"row":"rows"} from the current data set`:"","total-count":a.value.sampleCount,"max-rows":B.value,"max-columns":6,"empty-text":"No sample rows were returned."},null,8,["rows","columns","description","total-count","max-rows"]),a.value.sampleError?(e.openBlock(),e.createElementBlock("p",Fe,e.toDisplayString(a.value.sampleError),1)):e.createCommentVNode("",!0)]),g.value?(e.openBlock(),e.createElementBlock("div",Le," Snapshot from "+e.toDisplayString(oe(g.value)),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])}}});exports.default=Te;