@pineui/react 0.1.0 → 0.1.2

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/pineui.es.js CHANGED
@@ -1,8 +1,8 @@
1
- import ee, { useState as x, useEffect as R, Component as se } from "react";
1
+ import Q, { useState as b, useEffect as W, Component as se } from "react";
2
2
  import ie from "react-dom";
3
- var U = {}, K = ie;
4
- U.createRoot = K.createRoot, U.hydrateRoot = K.hydrateRoot;
5
- var te = { exports: {} }, T = {};
3
+ var J = {}, G = ie;
4
+ J.createRoot = G.createRoot, J.hydrateRoot = G.hydrateRoot;
5
+ var X = { exports: {} }, H = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.min.js
@@ -12,76 +12,68 @@ var te = { exports: {} }, T = {};
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
14
  */
15
- var oe = ee, ae = Symbol.for("react.element"), le = Symbol.for("react.fragment"), ce = Object.prototype.hasOwnProperty, de = oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, ue = { key: !0, ref: !0, __self: !0, __source: !0 };
16
- function ne(e, n, r) {
17
- var t, i = {}, o = null, a = null;
15
+ var oe = Q, ae = Symbol.for("react.element"), le = Symbol.for("react.fragment"), ce = Object.prototype.hasOwnProperty, ue = oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, de = { key: !0, ref: !0, __self: !0, __source: !0 };
16
+ function ee(e, n, r) {
17
+ var t, s = {}, o = null, a = null;
18
18
  r !== void 0 && (o = "" + r), n.key !== void 0 && (o = "" + n.key), n.ref !== void 0 && (a = n.ref);
19
- for (t in n) ce.call(n, t) && !ue.hasOwnProperty(t) && (i[t] = n[t]);
20
- if (e && e.defaultProps) for (t in n = e.defaultProps, n) i[t] === void 0 && (i[t] = n[t]);
21
- return { $$typeof: ae, type: e, key: o, ref: a, props: i, _owner: de.current };
19
+ for (t in n) ce.call(n, t) && !de.hasOwnProperty(t) && (s[t] = n[t]);
20
+ if (e && e.defaultProps) for (t in n = e.defaultProps, n) s[t] === void 0 && (s[t] = n[t]);
21
+ return { $$typeof: ae, type: e, key: o, ref: a, props: s, _owner: ue.current };
22
22
  }
23
- T.Fragment = le;
24
- T.jsx = ne;
25
- T.jsxs = ne;
26
- te.exports = T;
27
- var s = te.exports;
28
- function W(e, n) {
23
+ H.Fragment = le;
24
+ H.jsx = ee;
25
+ H.jsxs = ee;
26
+ X.exports = H;
27
+ var i = X.exports;
28
+ function S(e, n) {
29
29
  if (typeof e == "string")
30
30
  return pe(e, n);
31
31
  if (Array.isArray(e))
32
- return e.map((r) => W(r, n));
32
+ return e.map((r) => S(r, n));
33
33
  if (e && typeof e == "object") {
34
34
  const r = {};
35
35
  for (const t in e)
36
- r[t] = W(e[t], n);
36
+ r[t] = S(e[t], n);
37
37
  return r;
38
38
  }
39
39
  return e;
40
40
  }
41
41
  function pe(e, n) {
42
- const r = e.match(/^\{\{(.+)\}\}$/);
43
- if (r) {
44
- const t = r[1].trim();
45
- return (t === "item" || t.startsWith("item.")) && (!("item" in n) || n.item === void 0) ? e : Q(t, n);
42
+ const r = e.indexOf("}}");
43
+ if (e.startsWith("{{") && e.endsWith("}}") && r === e.length - 2) {
44
+ const s = e.slice(2, -2).trim();
45
+ return (s === "item" || s.startsWith("item.")) && (!("item" in n) || n.item === void 0) || (s === "props" || s.startsWith("props.")) && (!("props" in n) || n.props === void 0) || (s === "response" || s.startsWith("response.")) && !("response" in n) ? e : K(s, n);
46
46
  }
47
- return e.replace(/\{\{(.+?)\}\}/g, (t, i) => {
48
- const o = Q(i.trim(), n);
49
- return o != null ? String(o) : "";
47
+ return e.replace(/\{\{(.+?)\}\}/g, (s, o) => {
48
+ const a = K(o.trim(), n);
49
+ return a != null ? String(a) : "";
50
50
  });
51
51
  }
52
- function Q(e, n) {
52
+ function K(e, n) {
53
53
  try {
54
- return /^[\w.]+$/.test(e) ? M(n, e) : e.includes("!") || e.includes("==") || e.includes("!=") ? fe(e, n) : e.includes("|") ? he(e, n) : M(n, e);
54
+ if (/^[\w.]+$/.test(e))
55
+ return te(n, e);
56
+ if (e.includes("|") && !e.includes("||"))
57
+ return fe(e, n);
58
+ const r = Object.keys(n).filter((o) => /^[a-zA-Z_$][\w$]*$/.test(o)), t = r.map((o) => n[o]);
59
+ return new Function(...r, `"use strict"; try { return (${e}); } catch(e) { return undefined; }`)(...t);
55
60
  } catch (r) {
56
61
  console.warn(`Failed to evaluate expression: ${e}`, r);
57
62
  return;
58
63
  }
59
64
  }
60
- function M(e, n) {
65
+ function te(e, n) {
61
66
  const r = n.split(".");
62
67
  let t = e;
63
- for (const i of r) {
68
+ for (const s of r) {
64
69
  if (t == null) return;
65
- t = t[i];
70
+ t = t[s];
66
71
  }
67
72
  return t;
68
73
  }
69
74
  function fe(e, n) {
70
- if (e.startsWith("!"))
71
- return !M(n, e.slice(1).trim());
72
- if (e.includes("!= null")) {
73
- const r = e.split("!=")[0].trim();
74
- return M(n, r) != null;
75
- }
76
- if (e.includes("==")) {
77
- const [r, t] = e.split("==").map((a) => a.trim()), i = M(n, r), o = t.startsWith("'") || t.startsWith('"') ? t.slice(1, -1) : M(n, t);
78
- return i == o;
79
- }
80
- return !1;
81
- }
82
- function he(e, n) {
83
- const [r, t] = e.split("|").map((o) => o.trim()), i = M(n, r);
84
- return t === "timeAgo" ? me(i) : i;
75
+ const [r, t] = e.split("|").map((o) => o.trim()), s = te(n, r);
76
+ return t === "timeAgo" ? me(s) : s;
85
77
  }
86
78
  function me(e) {
87
79
  if (!e) return "";
@@ -90,102 +82,102 @@ function me(e) {
90
82
  const t = Math.floor(((/* @__PURE__ */ new Date()).getTime() - n.getTime()) / 1e3);
91
83
  return t < 60 ? `${t}s` : t < 3600 ? `${Math.floor(t / 60)}m` : t < 86400 ? `${Math.floor(t / 3600)}h` : t < 2592e3 ? `${Math.floor(t / 86400)}d` : t < 31536e3 ? `${Math.floor(t / 2592e3)}mo` : `${Math.floor(t / 31536e3)}y`;
92
84
  }
93
- function re(e) {
85
+ function ne(e) {
94
86
  var n, r, t = "";
95
87
  if (typeof e == "string" || typeof e == "number") t += e;
96
88
  else if (typeof e == "object") if (Array.isArray(e)) {
97
- var i = e.length;
98
- for (n = 0; n < i; n++) e[n] && (r = re(e[n])) && (t && (t += " "), t += r);
89
+ var s = e.length;
90
+ for (n = 0; n < s; n++) e[n] && (r = ne(e[n])) && (t && (t += " "), t += r);
99
91
  } else for (r in e) e[r] && (t && (t += " "), t += r);
100
92
  return t;
101
93
  }
102
- function V() {
103
- for (var e, n, r = 0, t = "", i = arguments.length; r < i; r++) (e = arguments[r]) && (n = re(e)) && (t && (t += " "), t += n);
94
+ function F() {
95
+ for (var e, n, r = 0, t = "", s = arguments.length; r < s; r++) (e = arguments[r]) && (n = ne(e)) && (t && (t += " "), t += n);
104
96
  return t;
105
97
  }
106
- const ve = ({
98
+ const he = ({
107
99
  content: e,
108
100
  style: n = "bodyMedium",
109
101
  color: r,
110
102
  fontWeight: t,
111
- maxLines: i
103
+ maxLines: s
112
104
  }) => {
113
- const o = V("pineui-text", `pineui-text--${n}`, {
105
+ const o = F("pineui-text", `pineui-text--${n}`, {
114
106
  "pineui-text--bold": t === "bold"
115
107
  }), a = {
116
108
  color: r ? `var(--md-sys-color-${r}, ${r})` : void 0,
117
- WebkitLineClamp: i ?? void 0,
118
- display: i ? "-webkit-box" : void 0,
119
- WebkitBoxOrient: i ? "vertical" : void 0,
120
- overflow: i ? "hidden" : void 0
109
+ WebkitLineClamp: s ?? void 0,
110
+ display: s ? "-webkit-box" : void 0,
111
+ WebkitBoxOrient: s ? "vertical" : void 0,
112
+ overflow: s ? "hidden" : void 0
121
113
  };
122
- return /* @__PURE__ */ s.jsx("p", { className: o, style: a, children: e || "(empty)" });
123
- }, J = ({
114
+ return /* @__PURE__ */ i.jsx("p", { className: o, style: a, children: e || "(empty)" });
115
+ }, L = ({
124
116
  type: e,
125
117
  label: n,
126
118
  icon: r,
127
119
  enabled: t = !0,
128
- loading: i = !1,
120
+ loading: s = !1,
129
121
  onPress: o,
130
122
  context: a,
131
123
  size: d = "medium",
132
124
  color: c
133
125
  }) => {
134
- const u = async () => {
135
- if (!t || i || !o || !a) return;
136
- const j = W(o, a);
137
- await a.executeAction(j);
138
- }, v = V("pineui-button", `pineui-button--${e.split(".")[1]}`, {
126
+ const p = async () => {
127
+ if (!t || s || !o || !a) return;
128
+ const g = S(o, a);
129
+ await a.executeAction(g);
130
+ }, m = F("pineui-button", `pineui-button--${e.split(".")[1]}`, {
139
131
  "pineui-button--disabled": !t,
140
- "pineui-button--loading": i,
132
+ "pineui-button--loading": s,
141
133
  [`pineui-button--${d}`]: d
142
134
  }), y = {
143
135
  color: c ? `var(--md-sys-color-${c}, ${c})` : void 0
144
136
  };
145
- return /* @__PURE__ */ s.jsxs(
137
+ return /* @__PURE__ */ i.jsxs(
146
138
  "button",
147
139
  {
148
- className: v,
149
- onClick: u,
150
- disabled: !t || i,
140
+ className: m,
141
+ onClick: p,
142
+ disabled: !t || s,
151
143
  style: y,
152
144
  children: [
153
- i ? /* @__PURE__ */ s.jsx("span", { className: "pineui-button__spinner", children: "⏳" }) : r ? /* @__PURE__ */ s.jsx("span", { className: "pineui-button__icon", children: r }) : null,
154
- n && /* @__PURE__ */ s.jsx("span", { className: "pineui-button__label", children: n })
145
+ s ? /* @__PURE__ */ i.jsx("span", { className: "pineui-button__spinner", children: "⏳" }) : r ? /* @__PURE__ */ i.jsx("span", { className: "pineui-button__icon", children: r }) : null,
146
+ n && /* @__PURE__ */ i.jsx("span", { className: "pineui-button__label", children: n })
155
147
  ]
156
148
  }
157
149
  );
158
- }, X = ({
150
+ }, Y = ({
159
151
  type: e,
160
152
  children: n = [],
161
153
  spacing: r = 0,
162
154
  padding: t = 0,
163
- mainAxisAlignment: i = "start",
155
+ mainAxisAlignment: s = "start",
164
156
  crossAxisAlignment: o = "start",
165
157
  flex: a,
166
158
  width: d,
167
159
  height: c,
168
- maxWidth: u,
169
- overflow: v,
160
+ maxWidth: p,
161
+ overflow: m,
170
162
  backgroundColor: y,
171
- border: j,
172
- borderRadius: B,
173
- elevation: C,
174
- borderRight: A,
175
- borderLeft: k,
176
- borderTop: D,
177
- borderBottom: E,
178
- onPress: _,
179
- context: w,
180
- renderer: I
163
+ border: g,
164
+ borderRadius: j,
165
+ elevation: w,
166
+ borderRight: T,
167
+ borderLeft: $,
168
+ borderTop: E,
169
+ borderBottom: _,
170
+ onPress: N,
171
+ context: C,
172
+ renderer: O
181
173
  }) => {
182
- if (!I || !w) return null;
183
- const P = async () => {
184
- if (_ && w) {
185
- const g = W(_, w);
186
- await w.executeAction(g);
174
+ if (!O || !C) return null;
175
+ const B = async () => {
176
+ if (N && C) {
177
+ const A = S(N, C);
178
+ await C.executeAction(A);
187
179
  }
188
- }, f = e === "layout.column", h = V("pineui-layout", {
180
+ }, f = e === "layout.column", h = F("pineui-layout", {
189
181
  "pineui-layout--column": f,
190
182
  "pineui-layout--row": !f
191
183
  }), l = {
@@ -193,26 +185,26 @@ const ve = ({
193
185
  flexDirection: f ? "column" : "row",
194
186
  gap: `${r}px`,
195
187
  padding: `${t}px`,
196
- justifyContent: ye(i),
197
- alignItems: ge(o),
188
+ justifyContent: ye(s),
189
+ alignItems: ve(o),
198
190
  flex: a,
199
191
  width: d !== void 0 ? typeof d == "number" ? `${d}px` : d : void 0,
200
192
  height: c !== void 0 ? typeof c == "number" ? `${c}px` : c : void 0,
201
- maxWidth: u !== void 0 ? typeof u == "number" ? `${u}px` : u : void 0,
202
- overflow: v,
193
+ maxWidth: p !== void 0 ? typeof p == "number" ? `${p}px` : p : void 0,
194
+ overflow: m,
203
195
  backgroundColor: y,
204
- border: j,
205
- borderRadius: B !== void 0 ? `${B}px` : void 0,
206
- boxShadow: C ? xe(C) : void 0,
207
- borderRight: A,
208
- borderLeft: k,
209
- borderTop: D,
210
- borderBottom: E,
196
+ border: g,
197
+ borderRadius: j !== void 0 ? `${j}px` : void 0,
198
+ boxShadow: w ? xe(w) : void 0,
199
+ borderRight: T,
200
+ borderLeft: $,
201
+ borderTop: E,
202
+ borderBottom: _,
211
203
  minWidth: 0,
212
204
  // Permite que flex shrink funcione corretamente
213
- cursor: _ ? "pointer" : void 0
205
+ cursor: N ? "pointer" : void 0
214
206
  };
215
- return /* @__PURE__ */ s.jsx("div", { className: h, style: l, onClick: _ ? P : void 0, children: n.map((g, p) => /* @__PURE__ */ s.jsx(I, { node: g, context: w }, p)) });
207
+ return /* @__PURE__ */ i.jsx("div", { className: h, style: l, onClick: N ? B : void 0, children: n.map((A, k) => /* @__PURE__ */ i.jsx(O, { node: A, context: C }, k)) });
216
208
  };
217
209
  function ye(e) {
218
210
  return {
@@ -223,7 +215,7 @@ function ye(e) {
223
215
  spaceAround: "space-around"
224
216
  }[e] || "flex-start";
225
217
  }
226
- function ge(e) {
218
+ function ve(e) {
227
219
  return {
228
220
  start: "flex-start",
229
221
  center: "center",
@@ -241,33 +233,39 @@ function xe(e) {
241
233
  };
242
234
  return n[e] || n[1];
243
235
  }
244
- const be = ({
236
+ const ge = ({
245
237
  child: e,
246
- elevation: n = 1,
247
- padding: r = 16,
248
- onTap: t,
249
- context: i,
250
- renderer: o
238
+ children: n,
239
+ elevation: r = 1,
240
+ padding: t = 16,
241
+ variant: s,
242
+ onPress: o,
243
+ context: a,
244
+ renderer: d
251
245
  }) => {
252
- if (!o || !i) return null;
253
- const a = async () => {
254
- if (t && i) {
255
- const u = W(t, i);
256
- await i.executeAction(u);
246
+ if (!d || !a) return null;
247
+ const c = async () => {
248
+ if (o && a) {
249
+ const j = S(o, a);
250
+ await a.executeAction(j);
257
251
  }
258
- }, d = V("pineui-card", `pineui-card--elevation-${n}`, {
259
- "pineui-card--clickable": !!t
260
- }), c = {
261
- padding: `${r}px`
262
- };
263
- return /* @__PURE__ */ s.jsx("div", { className: d, style: c, onClick: t ? a : void 0, children: /* @__PURE__ */ s.jsx(o, { node: e, context: i }) });
264
- }, je = ({
252
+ }, m = F("pineui-card", `pineui-card--elevation-${s === "outlined" || s === "filled" ? 0 : r}`, {
253
+ "pineui-card--clickable": !!o,
254
+ "pineui-card--outlined": s === "outlined",
255
+ "pineui-card--filled": s === "filled"
256
+ }), y = {
257
+ padding: `${t}px`,
258
+ ...s === "outlined" ? { border: "1px solid var(--md-sys-color-outline)" } : {},
259
+ ...s === "filled" ? { background: "var(--md-sys-color-surfaceVariant)" } : {}
260
+ }, g = e ? /* @__PURE__ */ i.jsx(d, { node: e, context: a }) : n ? /* @__PURE__ */ i.jsx(i.Fragment, { children: n.map((j, w) => /* @__PURE__ */ i.jsx(d, { node: j, context: a }, w)) }) : null;
261
+ return /* @__PURE__ */ i.jsx("div", { className: m, style: y, onClick: o ? c : void 0, children: g });
262
+ }, be = ({
265
263
  src: e,
266
264
  alt: n = "",
267
265
  aspectRatio: r,
268
266
  borderRadius: t = 0,
269
- loading: i = "lazy",
270
- onTap: o,
267
+ loading: s = "lazy",
268
+ onPress: o,
271
269
  context: a
272
270
  }) => {
273
271
  const d = async () => {
@@ -279,24 +277,24 @@ const be = ({
279
277
  objectFit: "cover",
280
278
  cursor: o ? "pointer" : void 0
281
279
  };
282
- return /* @__PURE__ */ s.jsx(
280
+ return /* @__PURE__ */ i.jsx(
283
281
  "img",
284
282
  {
285
283
  className: "pineui-image",
286
284
  src: e,
287
285
  alt: n,
288
- loading: i,
286
+ loading: s,
289
287
  style: c,
290
288
  onClick: o ? d : void 0
291
289
  }
292
290
  );
293
- }, _e = ({
291
+ }, je = ({
294
292
  src: e,
295
293
  size: n = 40,
296
- onTap: r,
294
+ onPress: r,
297
295
  context: t
298
296
  }) => {
299
- const i = async () => {
297
+ const s = async () => {
300
298
  r && t && await t.executeAction(r);
301
299
  }, o = {
302
300
  width: `${n}px`,
@@ -305,14 +303,14 @@ const be = ({
305
303
  objectFit: "cover",
306
304
  cursor: r ? "pointer" : void 0
307
305
  };
308
- return /* @__PURE__ */ s.jsx(
306
+ return /* @__PURE__ */ i.jsx(
309
307
  "img",
310
308
  {
311
309
  className: "pineui-avatar",
312
310
  src: e,
313
311
  alt: "Avatar",
314
312
  style: o,
315
- onClick: r ? i : void 0
313
+ onClick: r ? s : void 0
316
314
  }
317
315
  );
318
316
  }, we = ({
@@ -322,7 +320,7 @@ const be = ({
322
320
  visible: t = !0
323
321
  }) => {
324
322
  if (!t) return null;
325
- const i = {
323
+ const s = {
326
324
  fontSize: `${n}px`,
327
325
  color: r ? `var(--md-sys-color-${r}, ${r})` : void 0
328
326
  }, o = {
@@ -336,53 +334,72 @@ const be = ({
336
334
  iosShare: "↗️",
337
335
  moreVert: "⋮"
338
336
  };
339
- return /* @__PURE__ */ s.jsx("span", { className: "pineui-icon", style: i, children: o[e] || e });
340
- }, Ne = ({
337
+ return /* @__PURE__ */ i.jsx("span", { className: "pineui-icon", style: s, children: o[e] || e });
338
+ };
339
+ function U(e, n) {
340
+ return e === "{{response}}" ? n : typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map((r) => U(r, n)) : Object.fromEntries(
341
+ Object.entries(e).map(([r, t]) => [r, U(t, n)])
342
+ );
343
+ }
344
+ const _e = ({
341
345
  id: e,
342
346
  layout: n = "list",
343
347
  columns: r = 3,
344
348
  spacing: t = 16,
345
- data: i,
349
+ data: s,
346
350
  itemTemplate: o,
347
351
  loadingState: a,
348
352
  emptyState: d,
349
353
  errorState: c,
350
- refreshable: u = !1,
351
- context: v,
354
+ refreshable: p = !1,
355
+ context: m,
352
356
  renderer: y
353
357
  }) => {
354
- const [j, B] = x([]), [C, A] = x(!0), [k, D] = x(!1), [E, _] = x(null), [w, I] = x(!0), [P, f] = x(null);
355
- R(() => {
356
- h();
357
- }, [v == null ? void 0 : v.state]);
358
- const h = async (g = !1) => {
359
- if (v)
358
+ const [g, j] = b([]), [w, T] = b(!0), [$, E] = b(!1), [_, N] = b(null), [C, O] = b(!0), [B, f] = b(null), h = s.type === "action.http" && m ? s.url.replace(/\{\{state\.([^}]+)\}\}/g, (k, u) => {
359
+ const v = u.split(".");
360
+ let x = m.state;
361
+ for (const I of v) {
362
+ if (x == null) return "";
363
+ x = x[I];
364
+ }
365
+ return x != null ? String(x) : "";
366
+ }) : "";
367
+ W(() => {
368
+ l();
369
+ }, [h]);
370
+ const l = async (k = !1) => {
371
+ if (m)
360
372
  try {
361
- if (g ? D(!0) : A(!0), _(null), i.type === "action.http") {
362
- let p = i.url;
363
- p.includes("{{state.") && (p = p.replace(/\{\{state\.([^}]+)\}\}/g, (N, L) => {
364
- const O = L.split(".");
365
- let S = v.state;
366
- for (const F of O) {
367
- if (S == null) return "";
368
- S = S[F];
373
+ if (k ? E(!0) : T(!0), N(null), s.type === "action.http") {
374
+ let u = s.url;
375
+ u.includes("{{state.") && (u = u.replace(/\{\{state\.([^}]+)\}\}/g, (M, P) => {
376
+ const z = P.split(".");
377
+ let D = m.state;
378
+ for (const re of z) {
379
+ if (D == null) return "";
380
+ D = D[re];
369
381
  }
370
- return S != null ? String(S) : "";
371
- })), g && P && (p += `${p.includes("?") ? "&" : "?"}after=${P}`);
372
- const b = await (await fetch(p)).json(), $ = b.data || b;
373
- B((N) => g ? [...N, ...$] : $), b.pagination ? (I(b.pagination.hasMore), f(b.pagination.cursor)) : I(!1);
382
+ return D != null ? String(D) : "";
383
+ })), k && B && (u += `${u.includes("?") ? "&" : "?"}after=${B}`);
384
+ const x = await (await fetch(u)).json(), I = x.data || x;
385
+ if (j((M) => k ? [...M, ...I] : I), s.onSuccess && m) {
386
+ console.log(`[Collection] onSuccess called with ${I.length} items`);
387
+ const M = U(s.onSuccess, I);
388
+ await m.executeAction(M), console.log("[Collection] onSuccess done");
389
+ }
390
+ x.pagination ? (O(x.pagination.hasMore), f(x.pagination.cursor)) : O(!1);
374
391
  }
375
- } catch (p) {
376
- _(p);
392
+ } catch (u) {
393
+ N(u);
377
394
  } finally {
378
- A(!1), D(!1);
395
+ T(!1), E(!1);
379
396
  }
380
- }, l = () => {
381
- !k && w && h(!0);
397
+ }, A = () => {
398
+ !$ && C && l(!0);
382
399
  };
383
- return !y || !v ? null : C && a ? /* @__PURE__ */ s.jsx(y, { node: a, context: v }) : E && c ? /* @__PURE__ */ s.jsx(y, { node: c, context: v }) : j.length === 0 && d ? /* @__PURE__ */ s.jsx(y, { node: d, context: v }) : /* @__PURE__ */ s.jsxs("div", { className: "pineui-collection", "data-collection-id": e, children: [
384
- u && /* @__PURE__ */ s.jsx("div", { className: "pineui-collection__refresh", children: /* @__PURE__ */ s.jsx("button", { onClick: () => h(!1), children: "Refresh" }) }),
385
- /* @__PURE__ */ s.jsx(
400
+ return !y || !m ? null : w && a ? /* @__PURE__ */ i.jsx(y, { node: a, context: m }) : _ && c ? /* @__PURE__ */ i.jsx(y, { node: c, context: m }) : g.length === 0 && d ? /* @__PURE__ */ i.jsx(y, { node: d, context: m }) : /* @__PURE__ */ i.jsxs("div", { className: "pineui-collection", "data-collection-id": e, children: [
401
+ p && /* @__PURE__ */ i.jsx("div", { className: "pineui-collection__refresh", children: /* @__PURE__ */ i.jsx("button", { onClick: () => l(!1), children: "Refresh" }) }),
402
+ /* @__PURE__ */ i.jsx(
386
403
  "div",
387
404
  {
388
405
  className: `pineui-collection__${n}`,
@@ -391,150 +408,170 @@ const be = ({
391
408
  gridTemplateColumns: `repeat(${r}, 1fr)`,
392
409
  gap: `${t}px`
393
410
  } : void 0,
394
- children: j.map((g, p) => {
395
- var b, $, N, L, O, S, F, q, G, Y;
396
- let m = o;
397
- return (b = o.type) != null && b.startsWith("pattern.") && (($ = o.props) == null ? void 0 : $.post) === "{{item}}" ? m = {
398
- ...o,
399
- props: {
400
- ...o.props,
401
- post: g
402
- }
403
- } : (N = o.type) != null && N.startsWith("pattern.") && ((L = o.props) == null ? void 0 : L.course) === "{{item}}" ? m = {
404
- ...o,
405
- props: {
406
- ...o.props,
407
- course: g
408
- }
409
- } : (O = o.type) != null && O.startsWith("pattern.") && ((S = o.props) == null ? void 0 : S.conversation) === "{{item}}" ? m = {
410
- ...o,
411
- props: {
412
- ...o.props,
413
- conversation: g
414
- }
415
- } : (F = o.type) != null && F.startsWith("pattern.") && ((q = o.props) == null ? void 0 : q.message) === "{{item}}" ? m = {
416
- ...o,
417
- props: {
418
- ...o.props,
419
- message: g
420
- }
421
- } : (G = o.type) != null && G.startsWith("pattern.") && ((Y = o.props) == null ? void 0 : Y.profile) === "{{item}}" && (m = {
422
- ...o,
423
- props: {
424
- ...o.props,
425
- profile: g
426
- }
427
- }), /* @__PURE__ */ s.jsx("div", { className: `pineui-collection__item ${n === "grid" ? "pineui-collection__item--grid" : ""}`, children: /* @__PURE__ */ s.jsx(y, { node: m, context: v, parentData: g }) }, g.id || p);
411
+ children: g.map((k, u) => {
412
+ const v = { ...m, item: k, index: u };
413
+ return /* @__PURE__ */ i.jsx("div", { className: `pineui-collection__item ${n === "grid" ? "pineui-collection__item--grid" : ""}`, children: /* @__PURE__ */ i.jsx(y, { node: o, context: v }) }, k.id || u);
428
414
  })
429
415
  }
430
416
  ),
431
- w && !C && /* @__PURE__ */ s.jsx("div", { className: "pineui-collection__load-more", style: { padding: "16px", textAlign: "center" }, children: /* @__PURE__ */ s.jsx(
417
+ C && !w && /* @__PURE__ */ i.jsx("div", { className: "pineui-collection__load-more", style: { padding: "16px", textAlign: "center" }, children: /* @__PURE__ */ i.jsx(
432
418
  "button",
433
419
  {
434
- onClick: l,
435
- disabled: k,
420
+ onClick: A,
421
+ disabled: $,
436
422
  style: {
437
423
  padding: "12px 24px",
438
424
  fontSize: "14px",
439
425
  fontWeight: 500,
440
- cursor: k ? "not-allowed" : "pointer",
441
- opacity: k ? 0.6 : 1
426
+ cursor: $ ? "not-allowed" : "pointer",
427
+ opacity: $ ? 0.6 : 1
442
428
  },
443
- children: k ? "Carregando..." : "Carregar mais"
429
+ children: $ ? "Carregando..." : "Carregar mais"
444
430
  }
445
431
  ) })
446
432
  ] });
433
+ }, Ne = ({
434
+ data: e,
435
+ template: n,
436
+ itemTemplate: r,
437
+ layout: t = "list",
438
+ columns: s = 3,
439
+ spacing: o = 16,
440
+ context: a,
441
+ renderer: d
442
+ }) => {
443
+ if (!d || !a) return null;
444
+ const c = n || r;
445
+ if (!c) return null;
446
+ const p = Array.isArray(e) ? e : [];
447
+ if (p.length === 0) return null;
448
+ const m = t === "grid" ? { display: "grid", gridTemplateColumns: `repeat(${s}, 1fr)`, gap: `${o}px` } : { display: "flex", flexDirection: "column", gap: `${o}px` };
449
+ return /* @__PURE__ */ i.jsx("div", { style: m, children: p.map((y, g) => {
450
+ const j = { ...a, item: y, index: g };
451
+ return /* @__PURE__ */ i.jsx(
452
+ d,
453
+ {
454
+ node: c,
455
+ context: j
456
+ },
457
+ y.id ?? g
458
+ );
459
+ }) });
447
460
  }, ke = ({
448
461
  appBar: e,
449
462
  body: n,
450
463
  floatingActionButton: r,
451
464
  bottomNavigationBar: t,
452
- context: i,
465
+ context: s,
453
466
  renderer: o
454
- }) => !o || !i ? null : /* @__PURE__ */ s.jsxs("div", { className: "pineui-scaffold", children: [
455
- e && /* @__PURE__ */ s.jsx("header", { className: "pineui-scaffold__appbar", children: /* @__PURE__ */ s.jsx(o, { node: e, context: i }) }),
456
- /* @__PURE__ */ s.jsx("main", { className: "pineui-scaffold__body", children: /* @__PURE__ */ s.jsx(o, { node: n, context: i }) }),
457
- r && /* @__PURE__ */ s.jsx("div", { className: "pineui-scaffold__fab", children: /* @__PURE__ */ s.jsx(o, { node: r, context: i }) }),
458
- t && /* @__PURE__ */ s.jsx("footer", { className: "pineui-scaffold__bottomnav", children: /* @__PURE__ */ s.jsx(o, { node: t, context: i }) })
467
+ }) => !o || !s ? null : /* @__PURE__ */ i.jsxs("div", { className: "pineui-scaffold", children: [
468
+ e && /* @__PURE__ */ i.jsx("header", { className: "pineui-scaffold__appbar", children: /* @__PURE__ */ i.jsx(o, { node: e, context: s }) }),
469
+ /* @__PURE__ */ i.jsx("main", { className: "pineui-scaffold__body", children: /* @__PURE__ */ i.jsx(o, { node: n, context: s }) }),
470
+ r && /* @__PURE__ */ i.jsx("div", { className: "pineui-scaffold__fab", children: /* @__PURE__ */ i.jsx(o, { node: r, context: s }) }),
471
+ t && /* @__PURE__ */ i.jsx("footer", { className: "pineui-scaffold__bottomnav", children: /* @__PURE__ */ i.jsx(o, { node: t, context: s }) })
459
472
  ] }), $e = ({
460
473
  title: e,
461
474
  leading: n,
462
475
  actions: r = [],
463
476
  context: t,
464
- renderer: i
465
- }) => !i || !t ? null : /* @__PURE__ */ s.jsxs("div", { className: "pineui-appbar", children: [
466
- n && /* @__PURE__ */ s.jsx("div", { className: "pineui-appbar__leading", children: /* @__PURE__ */ s.jsx(i, { node: n, context: t }) }),
467
- e && /* @__PURE__ */ s.jsx("div", { className: "pineui-appbar__title", children: /* @__PURE__ */ s.jsx(i, { node: e, context: t }) }),
468
- r.length > 0 && /* @__PURE__ */ s.jsx("div", { className: "pineui-appbar__actions", children: r.map((o, a) => /* @__PURE__ */ s.jsx(i, { node: o, context: t }, a)) })
477
+ renderer: s
478
+ }) => !s || !t ? null : /* @__PURE__ */ i.jsxs("div", { className: "pineui-appbar", children: [
479
+ n && /* @__PURE__ */ i.jsx("div", { className: "pineui-appbar__leading", children: /* @__PURE__ */ i.jsx(s, { node: n, context: t }) }),
480
+ e && /* @__PURE__ */ i.jsx("div", { className: "pineui-appbar__title", children: /* @__PURE__ */ i.jsx(s, { node: e, context: t }) }),
481
+ r.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "pineui-appbar__actions", children: r.map((o, a) => /* @__PURE__ */ i.jsx(s, { node: o, context: t }, a)) })
469
482
  ] }), Ce = ({
470
483
  items: e,
471
484
  currentIndex: n,
472
485
  onItemTap: r,
473
486
  context: t
474
487
  }) => {
475
- const i = async (o) => {
488
+ const s = async (o) => {
476
489
  if (!t) return;
477
490
  const a = JSON.parse(
478
491
  JSON.stringify(r).replace(/\{\{item\.(\w+)\}\}/g, (d, c) => {
479
- const u = o[c];
480
- return u != null ? String(u) : "";
492
+ const p = o[c];
493
+ return p != null ? String(p) : "";
481
494
  })
482
495
  );
483
496
  await t.executeAction(a);
484
497
  };
485
- return /* @__PURE__ */ s.jsx("nav", { className: "pineui-bottomnav", children: e.map((o, a) => /* @__PURE__ */ s.jsxs(
498
+ return /* @__PURE__ */ i.jsx("nav", { className: "pineui-bottomnav", children: e.map((o, a) => /* @__PURE__ */ i.jsxs(
486
499
  "button",
487
500
  {
488
501
  className: `pineui-bottomnav__item ${a === n ? "pineui-bottomnav__item--active" : ""}`,
489
- onClick: () => i(o),
502
+ onClick: () => s(o),
490
503
  children: [
491
- /* @__PURE__ */ s.jsxs("div", { className: "pineui-bottomnav__icon-container", children: [
492
- /* @__PURE__ */ s.jsx("span", { className: "pineui-bottomnav__icon", children: o.icon }),
493
- o.badge && o.badge > 0 && /* @__PURE__ */ s.jsx("span", { className: "pineui-bottomnav__badge", children: o.badge })
504
+ /* @__PURE__ */ i.jsxs("div", { className: "pineui-bottomnav__icon-container", children: [
505
+ /* @__PURE__ */ i.jsx("span", { className: "pineui-bottomnav__icon", children: o.icon }),
506
+ o.badge && o.badge > 0 && /* @__PURE__ */ i.jsx("span", { className: "pineui-bottomnav__badge", children: o.badge })
494
507
  ] }),
495
- /* @__PURE__ */ s.jsx("span", { className: "pineui-bottomnav__label", children: o.label })
508
+ /* @__PURE__ */ i.jsx("span", { className: "pineui-bottomnav__label", children: o.label })
496
509
  ]
497
510
  },
498
511
  a
499
512
  )) });
500
- }, Ae = ({
501
- id: e,
502
- placeholder: n = "",
503
- value: r = "",
504
- multiline: t = !1,
505
- maxLines: i = 1,
506
- maxLength: o,
507
- autofocus: a = !1,
508
- onChanged: d,
509
- context: c
513
+ }, V = ({
514
+ type: e,
515
+ id: n,
516
+ label: r,
517
+ placeholder: t = "",
518
+ value: s = "",
519
+ error: o,
520
+ multiline: a = !1,
521
+ maxLines: d = 1,
522
+ maxLength: c,
523
+ autofocus: p = !1,
524
+ onChanged: m,
525
+ onChange: y,
526
+ context: g
510
527
  }) => {
511
- const v = {
512
- id: e,
513
- placeholder: n,
514
- defaultValue: r,
515
- maxLength: o,
516
- autoFocus: a,
517
- onChange: async (y) => {
518
- if (!d || !c) return;
519
- const j = JSON.parse(
520
- JSON.stringify(d).replace(/\{\{value\}\}/g, y.target.value)
521
- );
522
- await c.executeAction(j);
523
- },
524
- className: "pineui-input"
528
+ const j = y || m, w = async (_) => {
529
+ !j || !g || await g.executeAction(j, { event: { value: _.target.value }, value: _.target.value });
530
+ }, $ = {
531
+ "input.email": "email",
532
+ "input.password": "password",
533
+ "input.number": "number",
534
+ "input.search": "search",
535
+ "input.text": "text"
536
+ }[e] || "text", E = {
537
+ id: n,
538
+ placeholder: t,
539
+ defaultValue: s,
540
+ maxLength: c,
541
+ autoFocus: p,
542
+ onChange: w,
543
+ className: `pineui-input${o ? " pineui-input--error" : ""}`
525
544
  };
526
- return t ? /* @__PURE__ */ s.jsx(
527
- "textarea",
528
- {
529
- ...v,
530
- rows: i,
531
- style: {
532
- resize: "none",
533
- minHeight: `${i * 24}px`
545
+ return /* @__PURE__ */ i.jsxs("div", { className: "pineui-input-wrapper", style: { width: "100%" }, children: [
546
+ r && /* @__PURE__ */ i.jsx(
547
+ "label",
548
+ {
549
+ htmlFor: n,
550
+ style: {
551
+ display: "block",
552
+ fontSize: "12px",
553
+ fontWeight: 500,
554
+ color: o ? "var(--md-sys-color-error)" : "var(--md-sys-color-onSurfaceVariant)",
555
+ marginBottom: "4px"
556
+ },
557
+ children: r
534
558
  }
535
- }
536
- ) : /* @__PURE__ */ s.jsx("input", { ...v, type: "text" });
537
- }, Ee = ({
559
+ ),
560
+ a ? /* @__PURE__ */ i.jsx(
561
+ "textarea",
562
+ {
563
+ ...E,
564
+ rows: d,
565
+ style: { resize: "none", minHeight: `${d * 24}px` }
566
+ }
567
+ ) : /* @__PURE__ */ i.jsx("input", { ...E, type: $ }),
568
+ o && /* @__PURE__ */ i.jsx("p", { style: {
569
+ fontSize: "12px",
570
+ color: "var(--md-sys-color-error)",
571
+ marginTop: "4px"
572
+ }, children: o })
573
+ ] });
574
+ }, Ae = ({
538
575
  thickness: e = 1,
539
576
  color: n = "surfaceVariant"
540
577
  }) => {
@@ -544,117 +581,127 @@ const be = ({
544
581
  border: "none",
545
582
  margin: 0
546
583
  };
547
- return /* @__PURE__ */ s.jsx("hr", { className: "pineui-divider", style: r });
548
- }, Se = ({
584
+ return /* @__PURE__ */ i.jsx("hr", { className: "pineui-divider", style: r });
585
+ }, Te = ({
549
586
  conditions: e,
550
587
  context: n,
551
588
  renderer: r
552
589
  }) => {
553
590
  if (!r || !n) return null;
554
591
  for (const t of e) {
555
- const i = W({ when: t.when }, n);
556
- if (i.when === !0 || i.when === "true")
557
- return /* @__PURE__ */ s.jsx(r, { node: t.render, context: n });
592
+ const s = S({ when: t.when }, n);
593
+ if (s.when === !0 || s.when === "true")
594
+ return /* @__PURE__ */ i.jsx(r, { node: t.render, context: n });
558
595
  }
559
596
  return null;
560
- }, Ie = ({
597
+ }, Ee = ({
598
+ condition: e,
599
+ children: n,
600
+ child: r,
601
+ context: t,
602
+ renderer: s
603
+ }) => {
604
+ if (!s || !t) return null;
605
+ const o = S({ condition: e }, t);
606
+ return o.condition === !0 || o.condition === "true" || o.condition === 1 ? r ? /* @__PURE__ */ i.jsx(s, { node: r, context: t }) : n ? /* @__PURE__ */ i.jsx(i.Fragment, { children: n.map((d, c) => /* @__PURE__ */ i.jsx(s, { node: d, context: t }, c)) }) : null : null;
607
+ }, Se = ({
561
608
  tabs: e,
562
609
  defaultTab: n,
563
610
  context: r,
564
611
  renderer: t
565
612
  }) => {
566
613
  var d;
567
- const [i, o] = x(n || ((d = e[0]) == null ? void 0 : d.id));
614
+ const [s, o] = b(n || ((d = e[0]) == null ? void 0 : d.id));
568
615
  if (!t || !r) return null;
569
- const a = e.find((c) => c.id === i);
570
- return /* @__PURE__ */ s.jsxs("div", { className: "pineui-tabs", children: [
571
- /* @__PURE__ */ s.jsx("div", { className: "pineui-tabs__header", children: e.map((c) => /* @__PURE__ */ s.jsxs(
616
+ const a = e.find((c) => c.id === s);
617
+ return /* @__PURE__ */ i.jsxs("div", { className: "pineui-tabs", children: [
618
+ /* @__PURE__ */ i.jsx("div", { className: "pineui-tabs__header", children: e.map((c) => /* @__PURE__ */ i.jsxs(
572
619
  "button",
573
620
  {
574
- className: `pineui-tabs__tab ${i === c.id ? "pineui-tabs__tab--active" : ""}`,
621
+ className: `pineui-tabs__tab ${s === c.id ? "pineui-tabs__tab--active" : ""}`,
575
622
  onClick: () => o(c.id),
576
623
  children: [
577
- c.icon && /* @__PURE__ */ s.jsx("span", { className: "pineui-tabs__icon", children: c.icon }),
578
- /* @__PURE__ */ s.jsx("span", { className: "pineui-tabs__label", children: c.label }),
579
- c.badge !== void 0 && c.badge > 0 && /* @__PURE__ */ s.jsx("span", { className: "pineui-tabs__badge", children: c.badge })
624
+ c.icon && /* @__PURE__ */ i.jsx("span", { className: "pineui-tabs__icon", children: c.icon }),
625
+ /* @__PURE__ */ i.jsx("span", { className: "pineui-tabs__label", children: c.label }),
626
+ c.badge !== void 0 && c.badge > 0 && /* @__PURE__ */ i.jsx("span", { className: "pineui-tabs__badge", children: c.badge })
580
627
  ]
581
628
  },
582
629
  c.id
583
630
  )) }),
584
- /* @__PURE__ */ s.jsx("div", { className: "pineui-tabs__content", children: a && /* @__PURE__ */ s.jsx(t, { node: a.content, context: r }) })
631
+ /* @__PURE__ */ i.jsx("div", { className: "pineui-tabs__content", children: a && /* @__PURE__ */ i.jsx(t, { node: a.content, context: r }) })
585
632
  ] });
586
- }, Oe = ({
633
+ }, Ie = ({
587
634
  label: e,
588
635
  variant: n = "default",
589
636
  size: r = "medium"
590
637
  }) => {
591
- const t = V(
638
+ const t = F(
592
639
  "pineui-badge",
593
640
  `pineui-badge--${n}`,
594
641
  `pineui-badge--${r}`
595
642
  );
596
- return /* @__PURE__ */ s.jsx("span", { className: t, children: e });
597
- }, Me = ({
643
+ return /* @__PURE__ */ i.jsx("span", { className: t, children: e });
644
+ }, Oe = ({
598
645
  label: e,
599
646
  icon: n,
600
647
  selected: r = !1,
601
648
  onPress: t,
602
- context: i
649
+ context: s
603
650
  }) => {
604
651
  const o = async () => {
605
- t && i && await i.executeAction(t);
606
- }, a = V("pineui-chip", {
652
+ t && s && await s.executeAction(t);
653
+ }, a = F("pineui-chip", {
607
654
  "pineui-chip--selected": r
608
655
  });
609
- return /* @__PURE__ */ s.jsxs("button", { className: a, onClick: o, children: [
610
- n && /* @__PURE__ */ s.jsx("span", { className: "pineui-chip__icon", children: n }),
611
- /* @__PURE__ */ s.jsx("span", { className: "pineui-chip__label", children: e })
656
+ return /* @__PURE__ */ i.jsxs("button", { className: a, onClick: o, children: [
657
+ n && /* @__PURE__ */ i.jsx("span", { className: "pineui-chip__icon", children: n }),
658
+ /* @__PURE__ */ i.jsx("span", { className: "pineui-chip__label", children: e })
612
659
  ] });
613
- }, We = ({
660
+ }, Me = ({
614
661
  children: e,
615
662
  columns: n = 3,
616
663
  spacing: r = 16,
617
664
  context: t,
618
- renderer: i
665
+ renderer: s
619
666
  }) => {
620
- if (!i || !t) return null;
667
+ if (!s || !t) return null;
621
668
  const o = {
622
669
  display: "grid",
623
670
  gridTemplateColumns: `repeat(${n}, 1fr)`,
624
671
  gap: `${r}px`
625
672
  };
626
- return /* @__PURE__ */ s.jsx("div", { className: "pineui-grid", style: o, children: e.map((a, d) => /* @__PURE__ */ s.jsx(i, { node: a, context: t }, d)) });
673
+ return /* @__PURE__ */ i.jsx("div", { className: "pineui-grid", style: o, children: e.map((a, d) => /* @__PURE__ */ i.jsx(s, { node: a, context: t }, d)) });
627
674
  }, Be = ({
628
675
  value: e,
629
676
  label: n,
630
677
  showPercentage: r = !1,
631
678
  color: t = "primary"
632
679
  }) => {
633
- const i = Math.min(100, Math.max(0, e));
634
- return /* @__PURE__ */ s.jsxs("div", { className: "pineui-progress", children: [
635
- (n || r) && /* @__PURE__ */ s.jsxs("div", { className: "pineui-progress__header", children: [
636
- n && /* @__PURE__ */ s.jsx("span", { className: "pineui-progress__label", children: n }),
637
- r && /* @__PURE__ */ s.jsxs("span", { className: "pineui-progress__percentage", children: [
638
- i,
680
+ const s = Math.min(100, Math.max(0, e));
681
+ return /* @__PURE__ */ i.jsxs("div", { className: "pineui-progress", children: [
682
+ (n || r) && /* @__PURE__ */ i.jsxs("div", { className: "pineui-progress__header", children: [
683
+ n && /* @__PURE__ */ i.jsx("span", { className: "pineui-progress__label", children: n }),
684
+ r && /* @__PURE__ */ i.jsxs("span", { className: "pineui-progress__percentage", children: [
685
+ s,
639
686
  "%"
640
687
  ] })
641
688
  ] }),
642
- /* @__PURE__ */ s.jsx("div", { className: "pineui-progress__track", children: /* @__PURE__ */ s.jsx(
689
+ /* @__PURE__ */ i.jsx("div", { className: "pineui-progress__track", children: /* @__PURE__ */ i.jsx(
643
690
  "div",
644
691
  {
645
692
  className: `pineui-progress__fill pineui-progress__fill--${t}`,
646
- style: { width: `${i}%` }
693
+ style: { width: `${s}%` }
647
694
  }
648
695
  ) })
649
696
  ] });
650
- }, De = ({
697
+ }, We = ({
651
698
  columns: e,
652
699
  data: n,
653
700
  context: r,
654
701
  renderer: t
655
702
  }) => {
656
- const [i, o] = x([]), [a, d] = x(!0);
657
- R(() => {
703
+ const [s, o] = b([]), [a, d] = b(!0);
704
+ W(() => {
658
705
  c();
659
706
  }, []);
660
707
  const c = async () => {
@@ -665,147 +712,154 @@ const be = ({
665
712
  }
666
713
  if (n.type === "action.http")
667
714
  try {
668
- const u = n, y = await (await fetch(u.url, {
669
- method: u.method || "GET",
715
+ const p = n, y = await (await fetch(p.url, {
716
+ method: p.method || "GET",
670
717
  headers: {
671
718
  "Content-Type": "application/json"
672
719
  },
673
- body: u.body ? JSON.stringify(u.body) : void 0
720
+ body: p.body ? JSON.stringify(p.body) : void 0
674
721
  })).json();
675
722
  o(y.data || y), d(!1);
676
- } catch (u) {
677
- console.error("Table data fetch error:", u), d(!1);
723
+ } catch (p) {
724
+ console.error("Table data fetch error:", p), d(!1);
678
725
  }
679
726
  }
680
727
  };
681
- return !t || !r ? null : a ? /* @__PURE__ */ s.jsx("div", { className: "pineui-table", children: /* @__PURE__ */ s.jsx("p", { style: { padding: "16px", textAlign: "center" }, children: "Loading..." }) }) : /* @__PURE__ */ s.jsx("div", { className: "pineui-table", children: /* @__PURE__ */ s.jsxs("table", { children: [
682
- /* @__PURE__ */ s.jsx("thead", { children: /* @__PURE__ */ s.jsx("tr", { children: e.map((u) => /* @__PURE__ */ s.jsx(
728
+ return !t || !r ? null : a ? /* @__PURE__ */ i.jsx("div", { className: "pineui-table", children: /* @__PURE__ */ i.jsx("p", { style: { padding: "16px", textAlign: "center" }, children: "Loading..." }) }) : /* @__PURE__ */ i.jsx("div", { className: "pineui-table", children: /* @__PURE__ */ i.jsxs("table", { children: [
729
+ /* @__PURE__ */ i.jsx("thead", { children: /* @__PURE__ */ i.jsx("tr", { children: e.map((p) => /* @__PURE__ */ i.jsx(
683
730
  "th",
684
731
  {
685
- style: { width: u.width },
732
+ style: { width: p.width },
686
733
  className: "pineui-table__header",
687
- children: u.label
734
+ children: p.label
688
735
  },
689
- u.key
736
+ p.key
690
737
  )) }) }),
691
- /* @__PURE__ */ s.jsx("tbody", { children: i.map((u, v) => /* @__PURE__ */ s.jsx("tr", { className: "pineui-table__row", children: e.map((y) => /* @__PURE__ */ s.jsx("td", { className: "pineui-table__cell", children: y.template ? /* @__PURE__ */ s.jsx(
738
+ /* @__PURE__ */ i.jsx("tbody", { children: s.map((p, m) => /* @__PURE__ */ i.jsx("tr", { className: "pineui-table__row", children: e.map((y) => /* @__PURE__ */ i.jsx("td", { className: "pineui-table__cell", children: y.template ? /* @__PURE__ */ i.jsx(
692
739
  t,
693
740
  {
694
741
  node: y.template,
695
742
  context: r,
696
- parentData: u
743
+ parentData: p
697
744
  }
698
- ) : /* @__PURE__ */ s.jsx("span", { children: u[y.key] }) }, y.key)) }, v)) })
745
+ ) : /* @__PURE__ */ i.jsx("span", { children: p[y.key] }) }, y.key)) }, m)) })
699
746
  ] }) });
700
- }, Pe = ({ name: e, context: n, renderer: r, flex: t, width: i, height: o }) => {
747
+ }, Fe = ({ name: e, context: n, renderer: r, flex: t, width: s, height: o }) => {
701
748
  var c;
702
749
  const a = (c = n == null ? void 0 : n.views) == null ? void 0 : c[e];
703
750
  if (!a)
704
751
  return console.warn(`View not found: ${e}`), null;
705
752
  const d = {};
706
- return t && (d.flex = t), i && (d.width = i), o && (d.height = o), /* @__PURE__ */ s.jsx("div", { className: "pineui-view", style: d, children: /* @__PURE__ */ s.jsx(r, { node: a.screen, context: n }) });
707
- }, Le = {
708
- text: ve,
709
- "button.filled": J,
710
- "button.text": J,
711
- "button.icon": J,
712
- "button.fab": J,
713
- "layout.column": X,
714
- "layout.row": X,
753
+ return t && (d.flex = t), s && (d.width = s), o && (d.height = o), /* @__PURE__ */ i.jsx("div", { className: "pineui-view", style: d, children: /* @__PURE__ */ i.jsx(r, { node: a.screen, context: n }) });
754
+ }, De = {
755
+ text: he,
756
+ "button.filled": L,
757
+ "button.text": L,
758
+ "button.outlined": L,
759
+ "button.icon": L,
760
+ "button.fab": L,
761
+ "layout.column": Y,
762
+ "layout.row": Y,
715
763
  "layout.scaffold": ke,
716
764
  "layout.appBar": $e,
717
765
  "layout.bottomNav": Ce,
718
- card: be,
719
- image: je,
720
- avatar: _e,
766
+ card: ge,
767
+ image: be,
768
+ avatar: je,
721
769
  icon: we,
722
- collection: Ne,
723
- "input.text": Ae,
724
- divider: Ee,
725
- conditionalRender: Se,
726
- tabs: Ie,
727
- badge: Oe,
728
- chip: Me,
729
- grid: We,
770
+ collection: _e,
771
+ "collection.map": Ne,
772
+ "input.text": V,
773
+ "input.email": V,
774
+ "input.password": V,
775
+ "input.number": V,
776
+ "input.search": V,
777
+ divider: Ae,
778
+ conditionalRender: Te,
779
+ "conditional.render": Ee,
780
+ tabs: Se,
781
+ badge: Ie,
782
+ chip: Oe,
783
+ grid: Me,
730
784
  progress: Be,
731
- table: De,
732
- view: Pe
733
- }, z = ({ node: e, context: n, parentData: r }) => {
785
+ table: We,
786
+ view: Fe
787
+ }, R = ({ node: e, context: n, parentData: r }) => {
734
788
  if (!e || !e.type)
735
789
  return null;
736
- const t = r !== void 0 ? Object.assign({}, n, { item: r }) : n, o = e.type !== "collection" ? W(e, t) : e;
790
+ const t = r !== void 0 ? Object.assign({}, n, { item: r }) : n, o = e.type !== "collection" ? S(e, t) : e;
737
791
  if (o.type.startsWith("component.")) {
738
792
  const d = o.type, c = n.components[d];
739
793
  if (!c)
740
794
  return console.warn(`Component not found: ${d}`), null;
741
- const u = {
795
+ const p = {
742
796
  ...t,
743
797
  props: o.props
744
798
  };
745
- return /* @__PURE__ */ s.jsx(z, { node: c.definition, context: u, parentData: r });
799
+ return /* @__PURE__ */ i.jsx(R, { node: c.definition, context: p, parentData: r });
746
800
  }
747
- const a = Le[o.type];
748
- return a ? /* @__PURE__ */ s.jsx(
801
+ const a = De[o.type];
802
+ return a ? /* @__PURE__ */ i.jsx(
749
803
  a,
750
804
  {
751
805
  ...o,
752
806
  context: n,
753
- renderer: z
807
+ renderer: R
754
808
  }
755
809
  ) : (console.warn(`Unknown component type: ${o.type}`), null);
756
- }, Re = ({ messages: e, onDismiss: n }) => /* @__PURE__ */ s.jsx("div", { className: "pineui-snackbar-container", children: e.map((r) => /* @__PURE__ */ s.jsx(Ve, { message: r, onDismiss: n }, r.id)) }), Ve = ({
810
+ }, Le = ({ messages: e, onDismiss: n }) => /* @__PURE__ */ i.jsx("div", { className: "pineui-snackbar-container", children: e.map((r) => /* @__PURE__ */ i.jsx(Ve, { message: r, onDismiss: n }, r.id)) }), Ve = ({
757
811
  message: e,
758
812
  onDismiss: n
759
813
  }) => {
760
- const [r, t] = x(!1);
761
- return R(() => {
814
+ const [r, t] = b(!1);
815
+ return W(() => {
762
816
  setTimeout(() => t(!0), 10);
763
- const i = setTimeout(() => {
817
+ const s = setTimeout(() => {
764
818
  t(!1), setTimeout(() => n(e.id), 300);
765
819
  }, e.duration || 3e3);
766
- return () => clearTimeout(i);
767
- }, [e, n]), /* @__PURE__ */ s.jsxs("div", { className: `pineui-snackbar ${r ? "pineui-snackbar--visible" : ""}`, children: [
768
- /* @__PURE__ */ s.jsx("span", { className: "pineui-snackbar__message", children: e.message }),
769
- e.action && /* @__PURE__ */ s.jsx("button", { className: "pineui-snackbar__action", onClick: e.action.onPress, children: e.action.label })
820
+ return () => clearTimeout(s);
821
+ }, [e, n]), /* @__PURE__ */ i.jsxs("div", { className: `pineui-snackbar ${r ? "pineui-snackbar--visible" : ""}`, children: [
822
+ /* @__PURE__ */ i.jsx("span", { className: "pineui-snackbar__message", children: e.message }),
823
+ e.action && /* @__PURE__ */ i.jsx("button", { className: "pineui-snackbar__action", onClick: e.action.onPress, children: e.action.label })
770
824
  ] });
771
- }, Fe = ({
825
+ }, ze = ({
772
826
  presentation: e = "modal",
773
827
  dismissible: n = !0,
774
828
  child: r,
775
829
  onClose: t,
776
- context: i,
830
+ context: s,
777
831
  renderer: o
778
832
  }) => {
779
- if (R(() => (document.body.style.overflow = "hidden", () => {
833
+ if (W(() => (document.body.style.overflow = "hidden", () => {
780
834
  document.body.style.overflow = "";
781
- }), []), !o || !i) return null;
782
- const a = (u) => {
783
- n && u.target === u.currentTarget && t();
784
- }, d = (u) => {
785
- n && u.key === "Escape" && t();
835
+ }), []), !o || !s) return null;
836
+ const a = (p) => {
837
+ n && p.target === p.currentTarget && t();
838
+ }, d = (p) => {
839
+ n && p.key === "Escape" && t();
786
840
  };
787
- R(() => (window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d)), [n]);
841
+ W(() => (window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d)), [n]);
788
842
  const c = e === "bottomSheet" ? "pineui-modal-backdrop pineui-modal-backdrop--bottomSheet" : "pineui-modal-backdrop";
789
- return /* @__PURE__ */ s.jsx("div", { className: c, onClick: a, children: /* @__PURE__ */ s.jsx("div", { className: `pineui-modal pineui-modal--${e}`, children: /* @__PURE__ */ s.jsx(o, { node: r, context: i }) }) });
790
- }, Je = ({
843
+ return /* @__PURE__ */ i.jsx("div", { className: c, onClick: a, children: /* @__PURE__ */ i.jsx("div", { className: `pineui-modal pineui-modal--${e}`, children: /* @__PURE__ */ i.jsx(o, { node: r, context: s }) }) });
844
+ }, Re = ({
791
845
  overlays: e,
792
846
  onClose: n,
793
847
  context: r,
794
848
  renderer: t
795
- }) => /* @__PURE__ */ s.jsx(s.Fragment, { children: Object.entries(e).map(
796
- ([i, { visible: o, config: a }]) => o ? /* @__PURE__ */ s.jsx(
797
- Fe,
849
+ }) => /* @__PURE__ */ i.jsx(i.Fragment, { children: Object.entries(e).map(
850
+ ([s, { visible: o, config: a }]) => o ? /* @__PURE__ */ i.jsx(
851
+ ze,
798
852
  {
799
- id: i,
853
+ id: s,
800
854
  ...a,
801
- onClose: () => n(i),
855
+ onClose: () => n(s),
802
856
  context: r,
803
857
  renderer: t
804
858
  },
805
- i
859
+ s
806
860
  ) : null
807
861
  ) });
808
- function H(e, n) {
862
+ function q(e, n) {
809
863
  if (n.startsWith("http://") || n.startsWith("https://"))
810
864
  return n;
811
865
  try {
@@ -822,28 +876,28 @@ async function Z(e, n) {
822
876
  if (e.imports.components)
823
877
  for (const t of e.imports.components)
824
878
  try {
825
- const i = H(n, t), a = await (await fetch(i)).json();
879
+ const s = q(n, t), a = await (await fetch(s)).json();
826
880
  r.components = {
827
881
  ...r.components,
828
882
  ...a
829
883
  };
830
- } catch (i) {
831
- console.error(`❌ Failed to load component from ${t}:`, i), console.error(` Resolved URL: ${H(n, t)}`);
884
+ } catch (s) {
885
+ console.error(`❌ Failed to load component from ${t}:`, s), console.error(` Resolved URL: ${q(n, t)}`);
832
886
  }
833
887
  if (e.imports.views)
834
888
  for (const t of e.imports.views)
835
889
  try {
836
- const i = H(n, t), a = await (await fetch(i)).json();
890
+ const s = q(n, t), a = await (await fetch(s)).json();
837
891
  r.views = {
838
892
  ...r.views,
839
893
  ...a
840
894
  };
841
- } catch (i) {
842
- console.error(`Failed to load view from ${t}:`, i);
895
+ } catch (s) {
896
+ console.error(`Failed to load view from ${t}:`, s);
843
897
  }
844
898
  return r;
845
899
  }
846
- class ze extends se {
900
+ class He extends se {
847
901
  constructor(n) {
848
902
  super(n), this.state = { hasError: !1, error: null };
849
903
  }
@@ -855,11 +909,11 @@ class ze extends se {
855
909
  }
856
910
  render() {
857
911
  var n;
858
- return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ s.jsxs("div", { className: "pineui-error", style: { padding: "24px", textAlign: "center" }, children: [
859
- /* @__PURE__ */ s.jsx("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "⚠️" }),
860
- /* @__PURE__ */ s.jsx("h3", { style: { marginBottom: "8px", fontSize: "18px", fontWeight: 600 }, children: "Something went wrong" }),
861
- /* @__PURE__ */ s.jsx("p", { style: { color: "#79747E", fontSize: "14px", marginBottom: "16px" }, children: ((n = this.state.error) == null ? void 0 : n.message) || "An unexpected error occurred" }),
862
- /* @__PURE__ */ s.jsx(
912
+ return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ i.jsxs("div", { className: "pineui-error", style: { padding: "24px", textAlign: "center" }, children: [
913
+ /* @__PURE__ */ i.jsx("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "⚠️" }),
914
+ /* @__PURE__ */ i.jsx("h3", { style: { marginBottom: "8px", fontSize: "18px", fontWeight: 600 }, children: "Something went wrong" }),
915
+ /* @__PURE__ */ i.jsx("p", { style: { color: "#79747E", fontSize: "14px", marginBottom: "16px" }, children: ((n = this.state.error) == null ? void 0 : n.message) || "An unexpected error occurred" }),
916
+ /* @__PURE__ */ i.jsx(
863
917
  "button",
864
918
  {
865
919
  onClick: () => window.location.reload(),
@@ -879,17 +933,17 @@ class ze extends se {
879
933
  ] }) : this.props.children;
880
934
  }
881
935
  }
882
- function Te(e, n) {
936
+ function Pe(e, n) {
883
937
  const r = n.split(".");
884
938
  let t = e;
885
- for (const i of r) {
939
+ for (const s of r) {
886
940
  if (t == null) return;
887
- t = t[i];
941
+ t = t[s];
888
942
  }
889
943
  return t;
890
944
  }
891
- const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
892
- const [t, i] = x(null), [o, a] = x(!0), [d, c] = x(null), [u, v] = x([]), [y, j] = x({}), B = (e == null ? void 0 : e.state) || {
945
+ const qe = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
946
+ const [t, s] = b(null), [o, a] = b(!0), [d, c] = b(null), [p, m] = b([]), [y, g] = b({}), j = (e == null ? void 0 : e.state) || {
893
947
  currentUser: {
894
948
  id: "user_current",
895
949
  username: "currentuser",
@@ -902,84 +956,82 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
902
956
  posting: !1
903
957
  },
904
958
  testInput: ""
905
- }, [C, A] = x(B);
906
- R(() => {
907
- n && !e ? D() : e && k();
959
+ }, [w, T] = b(j);
960
+ W(() => {
961
+ n && !e ? E() : e && $();
908
962
  }, [n, e, r]);
909
- const k = async () => {
963
+ const $ = async () => {
910
964
  try {
911
965
  a(!0);
912
966
  let f = e;
913
- f.imports && r && (console.log("Loading imports for initial schema...", f.imports), f = await Z(f, r), console.log("Imports loaded! Components:", Object.keys(f.components || {}))), i(f), f.state && A((h) => ({ ...h, ...f.state }));
967
+ f.imports && r && (console.log("Loading imports for initial schema...", f.imports), f = await Z(f, r), console.log("Imports loaded! Components:", Object.keys(f.components || {}))), s(f), f.state && T((h) => ({ ...h, ...f.state }));
914
968
  } catch (f) {
915
969
  c(f);
916
970
  } finally {
917
971
  a(!1);
918
972
  }
919
- }, D = async () => {
973
+ }, E = async () => {
920
974
  try {
921
975
  a(!0);
922
976
  let h = await (await fetch(n)).json();
923
- h.imports && r && (h = await Z(h, r)), i(h), h.state && A((l) => ({ ...l, ...h.state }));
977
+ h.imports && r && (h = await Z(h, r)), s(h), h.state && T((l) => ({ ...l, ...h.state }));
924
978
  } catch (f) {
925
979
  c(f);
926
980
  } finally {
927
981
  a(!1);
928
982
  }
929
- }, E = async (f, h) => {
930
- var g;
931
- console.log("Executing action:", f, "with params:", h);
932
- let l = f;
933
- if (h) {
934
- const m = JSON.stringify(f).replace(/\{\{([^}]+)\}\}/g, (b, $) => {
935
- const N = $.trim();
936
- return h[N] !== void 0 ? String(h[N]) : "";
937
- });
938
- l = JSON.parse(m);
939
- }
983
+ }, _ = async (f, h) => {
984
+ var A, k;
985
+ (f.type === "action.sequence" || f.intent && f.intent.startsWith("course")) && console.log(`[executeAction] type=${f.intent || f.type}, courseList.length=${((A = w.courseList) == null ? void 0 : A.length) ?? "N/A"}, selectedCourseIndex=${w.selectedCourseIndex}`);
986
+ const l = S(f, { state: w, ...h });
940
987
  if (l.intent) {
941
- const p = l.intent, m = { ...h, ...l };
942
- return delete m.intent, _(p, m);
988
+ const u = l.intent, v = { ...h, ...l };
989
+ return delete v.intent, N(u, v);
990
+ }
991
+ if (l.type === "intent" && l.name) {
992
+ const u = { ...h, ...l };
993
+ return delete u.type, delete u.name, N(l.name, u);
943
994
  }
944
995
  if (l.type && l.type.startsWith("intent.")) {
945
- const p = l.type.substring(7), m = { ...h, ...l };
946
- return delete m.type, _(p, m);
996
+ const u = l.type.substring(7), v = { ...h, ...l };
997
+ return delete v.type, N(u, v);
947
998
  }
948
999
  switch (l.type) {
949
1000
  case "action.http": {
950
1001
  try {
951
- const p = l.url.startsWith("http") ? l.url : `${r}${l.url}`, b = await (await fetch(p, {
1002
+ const u = l.url.startsWith("http") ? l.url : `${r}${l.url}`, x = await (await fetch(u, {
952
1003
  method: l.method || "GET",
953
1004
  headers: {
954
1005
  "Content-Type": "application/json"
955
1006
  },
956
1007
  body: l.body ? JSON.stringify(l.body) : void 0
957
1008
  })).json();
958
- console.log("HTTP action result:", b);
959
- } catch (p) {
960
- console.error("HTTP action error:", p);
1009
+ console.log("HTTP action result:", x);
1010
+ } catch (u) {
1011
+ console.error("HTTP action error:", u);
961
1012
  }
962
1013
  break;
963
1014
  }
964
1015
  case "action.state.patch": {
965
- A((p) => {
966
- const m = { ...p };
967
- return Ue(m, l.path, l.value), m;
1016
+ const u = l.value;
1017
+ console.log(`[patch] ${l.path} =`, typeof u == "object" && u !== null ? Array.isArray(u) ? `Array(${u.length})` : `{id: ${u == null ? void 0 : u.id}, title: ${u == null ? void 0 : u.title}}` : u), T((v) => {
1018
+ const x = { ...v };
1019
+ return Je(x, l.path, l.value), x;
968
1020
  });
969
1021
  break;
970
1022
  }
971
1023
  case "action.overlay.open": {
972
- const p = (g = t == null ? void 0 : t.overlays) == null ? void 0 : g[l.overlayId];
973
- p ? j((m) => ({
974
- ...m,
975
- [l.overlayId]: { visible: !0, config: p }
1024
+ const u = (k = t == null ? void 0 : t.overlays) == null ? void 0 : k[l.overlayId];
1025
+ u ? g((v) => ({
1026
+ ...v,
1027
+ [l.overlayId]: { visible: !0, config: u }
976
1028
  })) : console.warn("Overlay not found:", l.overlayId);
977
1029
  break;
978
1030
  }
979
1031
  case "action.overlay.close": {
980
- j((p) => ({
981
- ...p,
982
- [l.overlayId]: { ...p[l.overlayId], visible: !1 }
1032
+ g((u) => ({
1033
+ ...u,
1034
+ [l.overlayId]: { ...u[l.overlayId], visible: !1 }
983
1035
  }));
984
1036
  break;
985
1037
  }
@@ -988,34 +1040,39 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
988
1040
  break;
989
1041
  }
990
1042
  case "action.snackbar.show": {
991
- const p = typeof l.message == "string" && l.message.includes("{{") ? l.message.replace(/\{\{(.+?)\}\}/g, (b, $) => {
992
- const N = $.trim();
993
- if (N.startsWith("state.")) {
994
- const L = N.substring(6), O = Te(C, L);
995
- return O != null ? String(O) : "";
1043
+ const u = typeof l.message == "string" && l.message.includes("{{") ? l.message.replace(/\{\{(.+?)\}\}/g, (x, I) => {
1044
+ const M = I.trim();
1045
+ if (M.startsWith("state.")) {
1046
+ const P = M.substring(6), z = Pe(w, P);
1047
+ return z != null ? String(z) : "";
996
1048
  }
997
1049
  return "";
998
- }) : l.message, m = {
1050
+ }) : l.message, v = {
999
1051
  id: `snackbar-${Date.now()}`,
1000
- message: p,
1052
+ message: u,
1001
1053
  duration: l.duration || 3e3,
1002
1054
  action: l.action ? {
1003
1055
  label: l.action.label,
1004
- onPress: () => E(l.action.onPress)
1056
+ onPress: () => _(l.action.onPress)
1005
1057
  } : void 0
1006
1058
  };
1007
- v((b) => [...b, m]);
1059
+ m((x) => [...x, v]);
1008
1060
  break;
1009
1061
  }
1010
1062
  case "action.delay": {
1011
- const p = l.duration || 1e3;
1012
- await new Promise((m) => setTimeout(m, p));
1063
+ const u = l.duration || 1e3;
1064
+ await new Promise((v) => setTimeout(v, u));
1065
+ break;
1066
+ }
1067
+ case "action.sequence": {
1068
+ for (const u of l.actions ?? [])
1069
+ await _(u, h);
1013
1070
  break;
1014
1071
  }
1015
1072
  default:
1016
1073
  console.warn("Unknown action type:", l.type);
1017
1074
  }
1018
- }, _ = async (f, h) => {
1075
+ }, N = async (f, h) => {
1019
1076
  if (console.log("Executing intent:", f, h), !(t != null && t.intents)) return;
1020
1077
  const l = t.intents[f];
1021
1078
  if (!l) {
@@ -1023,22 +1080,22 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
1023
1080
  return;
1024
1081
  }
1025
1082
  if (Array.isArray(l.handler))
1026
- for (const g of l.handler)
1027
- await E(g, h);
1083
+ for (const A of l.handler)
1084
+ await _(A, h);
1028
1085
  else
1029
- await E(l.handler, h);
1030
- }, w = {
1031
- state: C,
1086
+ await _(l.handler, h);
1087
+ }, C = {
1088
+ state: w,
1032
1089
  data: {},
1033
1090
  components: (t == null ? void 0 : t.components) || {},
1034
1091
  views: (t == null ? void 0 : t.views) || {},
1035
1092
  intents: (t == null ? void 0 : t.intents) || {},
1036
1093
  schema: t,
1037
- executeAction: E,
1038
- executeIntent: _
1094
+ executeAction: _,
1095
+ executeIntent: N
1039
1096
  };
1040
1097
  if (o)
1041
- return /* @__PURE__ */ s.jsxs("div", { className: "pineui-loading", style: {
1098
+ return /* @__PURE__ */ i.jsxs("div", { className: "pineui-loading", style: {
1042
1099
  display: "flex",
1043
1100
  flexDirection: "column",
1044
1101
  alignItems: "center",
@@ -1047,7 +1104,7 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
1047
1104
  gap: "16px",
1048
1105
  color: "#79747E"
1049
1106
  }, children: [
1050
- /* @__PURE__ */ s.jsx("div", { style: {
1107
+ /* @__PURE__ */ i.jsx("div", { style: {
1051
1108
  width: "40px",
1052
1109
  height: "40px",
1053
1110
  border: "4px solid #E7E0EC",
@@ -1055,8 +1112,8 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
1055
1112
  borderRadius: "50%",
1056
1113
  animation: "pineui-spin 1s linear infinite"
1057
1114
  } }),
1058
- /* @__PURE__ */ s.jsx("p", { style: { margin: 0, fontSize: "14px", fontWeight: 500 }, children: "Loading application..." }),
1059
- /* @__PURE__ */ s.jsx("style", { dangerouslySetInnerHTML: {
1115
+ /* @__PURE__ */ i.jsx("p", { style: { margin: 0, fontSize: "14px", fontWeight: 500 }, children: "Loading application..." }),
1116
+ /* @__PURE__ */ i.jsx("style", { dangerouslySetInnerHTML: {
1060
1117
  __html: `
1061
1118
  @keyframes pineui-spin {
1062
1119
  0% { transform: rotate(0deg); }
@@ -1066,52 +1123,52 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
1066
1123
  } })
1067
1124
  ] });
1068
1125
  if (d)
1069
- return /* @__PURE__ */ s.jsx("div", { className: "pineui-error", children: /* @__PURE__ */ s.jsxs("p", { children: [
1126
+ return /* @__PURE__ */ i.jsx("div", { className: "pineui-error", children: /* @__PURE__ */ i.jsxs("p", { children: [
1070
1127
  "Error loading schema: ",
1071
1128
  d.message
1072
1129
  ] }) });
1073
1130
  if (!t)
1074
- return /* @__PURE__ */ s.jsx("div", { className: "pineui-error", children: /* @__PURE__ */ s.jsx("p", { children: "No schema provided" }) });
1075
- const I = (f) => {
1076
- v((h) => h.filter((l) => l.id !== f));
1077
- }, P = (f) => {
1078
- j((h) => ({
1131
+ return /* @__PURE__ */ i.jsx("div", { className: "pineui-error", children: /* @__PURE__ */ i.jsx("p", { children: "No schema provided" }) });
1132
+ const O = (f) => {
1133
+ m((h) => h.filter((l) => l.id !== f));
1134
+ }, B = (f) => {
1135
+ g((h) => ({
1079
1136
  ...h,
1080
1137
  [f]: { ...h[f], visible: !1 }
1081
1138
  }));
1082
1139
  };
1083
- return /* @__PURE__ */ s.jsx(ze, { children: /* @__PURE__ */ s.jsxs("div", { className: "pineui-root", children: [
1084
- /* @__PURE__ */ s.jsx(z, { node: t.screen, context: w }),
1085
- /* @__PURE__ */ s.jsx(Re, { messages: u, onDismiss: I }),
1086
- /* @__PURE__ */ s.jsx(Je, { overlays: y, onClose: P, context: w, renderer: z })
1140
+ return /* @__PURE__ */ i.jsx(He, { children: /* @__PURE__ */ i.jsxs("div", { className: "pineui-root", children: [
1141
+ /* @__PURE__ */ i.jsx(R, { node: t.screen, context: C }),
1142
+ /* @__PURE__ */ i.jsx(Le, { messages: p, onDismiss: O }),
1143
+ /* @__PURE__ */ i.jsx(Re, { overlays: y, onClose: B, context: C, renderer: R })
1087
1144
  ] }) });
1088
1145
  };
1089
- function Ue(e, n, r) {
1146
+ function Je(e, n, r) {
1090
1147
  const t = n.split(".");
1091
- let i = e;
1148
+ let s = e;
1092
1149
  for (let o = 0; o < t.length - 1; o++)
1093
- i[t[o]] || (i[t[o]] = {}), i = i[t[o]];
1094
- i[t[t.length - 1]] = r;
1150
+ s[t[o]] || (s[t[o]] = {}), s = s[t[o]];
1151
+ s[t[t.length - 1]] = r;
1095
1152
  }
1096
- function qe(e) {
1097
- var t, i;
1153
+ function Ue(e) {
1154
+ var t, s;
1098
1155
  const n = typeof e.target == "string" ? document.querySelector(e.target) : e.target;
1099
1156
  if (!n) {
1100
1157
  console.error("PineUI: Target element not found"), (t = e.onError) == null || t.call(e, new Error("Target element not found"));
1101
1158
  return;
1102
1159
  }
1103
- U.createRoot(n).render(
1104
- ee.createElement(He, {
1160
+ J.createRoot(n).render(
1161
+ Q.createElement(qe, {
1105
1162
  schema: e.schema,
1106
1163
  schemaUrl: e.schemaUrl,
1107
1164
  baseUrl: e.baseUrl
1108
1165
  })
1109
- ), (i = e.onReady) == null || i.call(e);
1166
+ ), (s = e.onReady) == null || s.call(e);
1110
1167
  }
1111
1168
  typeof window < "u" && (window.PineUI = {
1112
- render: qe
1169
+ render: Ue
1113
1170
  });
1114
1171
  export {
1115
- He as PineUI,
1116
- qe as render
1172
+ qe as PineUI,
1173
+ Ue as render
1117
1174
  };