@pineui/react 0.1.5 → 0.1.6

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
@@ -42,7 +42,7 @@ function pe(e, n) {
42
42
  const r = e.indexOf("}}");
43
43
  if (e.startsWith("{{") && e.endsWith("}}") && r === e.length - 2) {
44
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);
45
+ return (s === "item" || s.startsWith("item.") || /\bitem\b/.test(s)) && (!("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
47
  return e.replace(/\{\{(.+?)\}\}/g, (s, o) => {
48
48
  const a = K(o.trim(), n);
@@ -373,9 +373,9 @@ const _e = ({
373
373
  if (k ? S(!0) : E(!0), N(null), s.type === "action.http") {
374
374
  let u = s.url;
375
375
  u.includes("{{state.") && (u = u.replace(/\{\{state\.([^}]+)\}\}/g, (M, H) => {
376
- const V = H.split(".");
376
+ const R = H.split(".");
377
377
  let F = m.state;
378
- for (const re of V) {
378
+ for (const re of R) {
379
379
  if (F == null) return "";
380
380
  F = F[re];
381
381
  }
@@ -784,7 +784,7 @@ const _e = ({
784
784
  progress: Be,
785
785
  table: We,
786
786
  view: De
787
- }, R = ({ node: e, context: n, parentData: r }) => {
787
+ }, V = ({ node: e, context: n, parentData: r }) => {
788
788
  if (!e || !e.type)
789
789
  return null;
790
790
  const t = r !== void 0 ? Object.assign({}, n, { item: r }) : n, o = e.type !== "collection" && e.type !== "collection.map" ? T(e, t) : e;
@@ -796,7 +796,7 @@ const _e = ({
796
796
  ...t,
797
797
  props: o.props
798
798
  };
799
- return /* @__PURE__ */ i.jsx(R, { node: c.definition, context: p, parentData: r });
799
+ return /* @__PURE__ */ i.jsx(V, { node: c.definition, context: p, parentData: r });
800
800
  }
801
801
  const a = Fe[o.type];
802
802
  return a ? /* @__PURE__ */ i.jsx(
@@ -804,7 +804,7 @@ const _e = ({
804
804
  {
805
805
  ...o,
806
806
  context: n,
807
- renderer: R
807
+ renderer: V
808
808
  }
809
809
  ) : (console.warn(`Unknown component type: ${o.type}`), null);
810
810
  }, Le = ({ messages: e, onDismiss: n }) => /* @__PURE__ */ i.jsx("div", { className: "pineui-snackbar-container", children: e.map((r) => /* @__PURE__ */ i.jsx(ze, { message: r, onDismiss: n }, r.id)) }), ze = ({
@@ -822,7 +822,7 @@ const _e = ({
822
822
  /* @__PURE__ */ i.jsx("span", { className: "pineui-snackbar__message", children: e.message }),
823
823
  e.action && /* @__PURE__ */ i.jsx("button", { className: "pineui-snackbar__action", onClick: e.action.onPress, children: e.action.label })
824
824
  ] });
825
- }, Ve = ({
825
+ }, Re = ({
826
826
  presentation: e = "modal",
827
827
  dismissible: n = !0,
828
828
  child: r,
@@ -841,14 +841,14 @@ const _e = ({
841
841
  W(() => (window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d)), [n]);
842
842
  const c = e === "bottomSheet" ? "pineui-modal-backdrop pineui-modal-backdrop--bottomSheet" : "pineui-modal-backdrop";
843
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 = ({
844
+ }, Ve = ({
845
845
  overlays: e,
846
846
  onClose: n,
847
847
  context: r,
848
848
  renderer: t
849
849
  }) => /* @__PURE__ */ i.jsx(i.Fragment, { children: Object.entries(e).map(
850
850
  ([s, { visible: o, config: a }]) => o ? /* @__PURE__ */ i.jsx(
851
- Ve,
851
+ Re,
852
852
  {
853
853
  id: s,
854
854
  ...a,
@@ -1043,8 +1043,8 @@ const Ue = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
1043
1043
  const u = typeof l.message == "string" && l.message.includes("{{") ? l.message.replace(/\{\{(.+?)\}\}/g, (x, I) => {
1044
1044
  const M = I.trim();
1045
1045
  if (M.startsWith("state.")) {
1046
- const H = M.substring(6), V = He(b, H);
1047
- return V != null ? String(V) : "";
1046
+ const H = M.substring(6), R = He(b, H);
1047
+ return R != null ? String(R) : "";
1048
1048
  }
1049
1049
  return "";
1050
1050
  }) : l.message, v = {
@@ -1138,9 +1138,9 @@ const Ue = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
1138
1138
  }));
1139
1139
  };
1140
1140
  return /* @__PURE__ */ i.jsx(Pe, { children: /* @__PURE__ */ i.jsxs("div", { className: "pineui-root", children: [
1141
- /* @__PURE__ */ i.jsx(R, { node: t.screen, context: C }),
1141
+ /* @__PURE__ */ i.jsx(V, { node: t.screen, context: C }),
1142
1142
  /* @__PURE__ */ i.jsx(Le, { messages: p, onDismiss: O }),
1143
- /* @__PURE__ */ i.jsx(Re, { overlays: y, onClose: B, context: C, renderer: R })
1143
+ /* @__PURE__ */ i.jsx(Ve, { overlays: y, onClose: B, context: C, renderer: V })
1144
1144
  ] }) });
1145
1145
  };
1146
1146
  function qe(e, n, r) {
@@ -1168,7 +1168,7 @@ function Je(e) {
1168
1168
  typeof window < "u" && (window.PineUI = {
1169
1169
  render: Je
1170
1170
  });
1171
- console.log("%c🍍 PineUI v0.1.5%c — Server-Driven UI for AI-Native Apps", "color:#6750A4;font-weight:700;font-size:14px", "color:#79747E;font-size:12px");
1171
+ console.log("%c🍍 PineUI v0.1.6%c — Server-Driven UI for AI-Native Apps", "color:#6750A4;font-weight:700;font-size:14px", "color:#79747E;font-size:12px");
1172
1172
  export {
1173
1173
  Ue as PineUI,
1174
1174
  Je as render
@@ -6991,7 +6991,8 @@
6991
6991
  const isFullBinding = str.startsWith("{{") && str.endsWith("}}") && firstClose === str.length - 2;
6992
6992
  if (isFullBinding) {
6993
6993
  const expr = str.slice(2, -2).trim();
6994
- if ((expr === "item" || expr.startsWith("item.")) && (!("item" in context) || context.item === void 0)) {
6994
+ const hasItemRef = expr === "item" || expr.startsWith("item.") || /\bitem\b/.test(expr);
6995
+ if (hasItemRef && (!("item" in context) || context.item === void 0)) {
6995
6996
  return str;
6996
6997
  }
6997
6998
  if ((expr === "props" || expr.startsWith("props.")) && (!("props" in context) || context.props === void 0)) {
@@ -8374,7 +8375,7 @@
8374
8375
  render
8375
8376
  };
8376
8377
  }
8377
- console.log("%c🍍 PineUI v0.1.5%c — Server-Driven UI for AI-Native Apps", "color:#6750A4;font-weight:700;font-size:14px", "color:#79747E;font-size:12px");
8378
+ console.log("%c🍍 PineUI v0.1.6%c — Server-Driven UI for AI-Native Apps", "color:#6750A4;font-weight:700;font-size:14px", "color:#79747E;font-size:12px");
8378
8379
  exports2.PineUI = PineUI;
8379
8380
  exports2.render = render;
8380
8381
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
@@ -1,4 +1,4 @@
1
- (function(E,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],m):(E=typeof globalThis<"u"?globalThis:E||self,m(E.PineUI={},E.React,E.ReactDOM))})(this,function(E,m,re){"use strict";var H={},K=re;H.createRoot=K.createRoot,H.hydrateRoot=K.hydrateRoot;var Y={exports:{}},R={};/**
1
+ (function(E,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],m):(E=typeof globalThis<"u"?globalThis:E||self,m(E.PineUI={},E.React,E.ReactDOM))})(this,function(E,m,re){"use strict";var H={},K=re;H.createRoot=K.createRoot,H.hydrateRoot=K.hydrateRoot;var Y={exports:{}},P={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,9 +6,9 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ie=m,oe=Symbol.for("react.element"),ae=Symbol.for("react.fragment"),le=Object.prototype.hasOwnProperty,ce=ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ue={key:!0,ref:!0,__self:!0,__source:!0};function Z(e,n,s){var t,r={},o=null,a=null;s!==void 0&&(o=""+s),n.key!==void 0&&(o=""+n.key),n.ref!==void 0&&(a=n.ref);for(t in n)le.call(n,t)&&!ue.hasOwnProperty(t)&&(r[t]=n[t]);if(e&&e.defaultProps)for(t in n=e.defaultProps,n)r[t]===void 0&&(r[t]=n[t]);return{$$typeof:oe,type:e,key:o,ref:a,props:r,_owner:ce.current}}R.Fragment=ae,R.jsx=Z,R.jsxs=Z,Y.exports=R;var i=Y.exports;function A(e,n){if(typeof e=="string")return de(e,n);if(Array.isArray(e))return e.map(s=>A(s,n));if(e&&typeof e=="object"){const s={};for(const t in e)s[t]=A(e[t],n);return s}return e}function de(e,n){const s=e.indexOf("}}");if(e.startsWith("{{")&&e.endsWith("}}")&&s===e.length-2){const r=e.slice(2,-2).trim();return(r==="item"||r.startsWith("item."))&&(!("item"in n)||n.item===void 0)||(r==="props"||r.startsWith("props."))&&(!("props"in n)||n.props===void 0)||(r==="response"||r.startsWith("response."))&&!("response"in n)?e:Q(r,n)}return e.replace(/\{\{(.+?)\}\}/g,(r,o)=>{const a=Q(o.trim(),n);return a!=null?String(a):""})}function Q(e,n){try{if(/^[\w.]+$/.test(e))return X(n,e);if(e.includes("|")&&!e.includes("||"))return pe(e,n);const s=Object.keys(n).filter(o=>/^[a-zA-Z_$][\w$]*$/.test(o)),t=s.map(o=>n[o]);return new Function(...s,`"use strict"; try { return (${e}); } catch(e) { return undefined; }`)(...t)}catch(s){console.warn(`Failed to evaluate expression: ${e}`,s);return}}function X(e,n){const s=n.split(".");let t=e;for(const r of s){if(t==null)return;t=t[r]}return t}function pe(e,n){const[s,t]=e.split("|").map(o=>o.trim()),r=X(n,s);return t==="timeAgo"?fe(r):r}function fe(e){if(!e)return"";const n=new Date(e);if(isNaN(n.getTime()))return e;const t=Math.floor((new Date().getTime()-n.getTime())/1e3);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`}function q(e){var n,s,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(n=0;n<r;n++)e[n]&&(s=q(e[n]))&&(t&&(t+=" "),t+=s)}else for(s in e)e[s]&&(t&&(t+=" "),t+=s);return t}function W(){for(var e,n,s=0,t="",r=arguments.length;s<r;s++)(e=arguments[s])&&(n=q(e))&&(t&&(t+=" "),t+=n);return t}const me=({content:e,style:n="bodyMedium",color:s,fontWeight:t,maxLines:r})=>{const o=W("pineui-text",`pineui-text--${n}`,{"pineui-text--bold":t==="bold"}),a={color:s?`var(--md-sys-color-${s}, ${s})`:void 0,WebkitLineClamp:r??void 0,display:r?"-webkit-box":void 0,WebkitBoxOrient:r?"vertical":void 0,overflow:r?"hidden":void 0};return i.jsx("p",{className:o,style:a,children:e||"(empty)"})},L=({type:e,label:n,icon:s,enabled:t=!0,loading:r=!1,onPress:o,context:a,size:d="medium",color:c})=>{const p=async()=>{if(!t||r||!o||!a)return;const b=A(o,a);await a.executeAction(b)},h=W("pineui-button",`pineui-button--${e.split(".")[1]}`,{"pineui-button--disabled":!t,"pineui-button--loading":r,[`pineui-button--${d}`]:d}),v={color:c?`var(--md-sys-color-${c}, ${c})`:void 0};return i.jsxs("button",{className:h,onClick:p,disabled:!t||r,style:v,children:[r?i.jsx("span",{className:"pineui-button__spinner",children:"⏳"}):s?i.jsx("span",{className:"pineui-button__icon",children:s}):null,n&&i.jsx("span",{className:"pineui-button__label",children:n})]})},ee=({type:e,children:n=[],spacing:s=0,padding:t=0,mainAxisAlignment:r="start",crossAxisAlignment:o="start",flex:a,width:d,height:c,maxWidth:p,overflow:h,backgroundColor:v,border:b,borderRadius:w,elevation:j,borderRight:I,borderLeft:C,borderTop:M,borderBottom:_,onPress:N,context:S,renderer:B})=>{if(!B||!S)return null;const F=async()=>{if(N&&S){const T=A(N,S);await S.executeAction(T)}},f=e==="layout.column",y=W("pineui-layout",{"pineui-layout--column":f,"pineui-layout--row":!f}),l={display:"flex",flexDirection:f?"column":"row",gap:`${s}px`,padding:`${t}px`,justifyContent:he(r),alignItems:ye(o),flex:a,width:d!==void 0?typeof d=="number"?`${d}px`:d:void 0,height:c!==void 0?typeof c=="number"?`${c}px`:c:void 0,maxWidth:p!==void 0?typeof p=="number"?`${p}px`:p:void 0,overflow:h,backgroundColor:v,border:b,borderRadius:w!==void 0?`${w}px`:void 0,boxShadow:j?ve(j):void 0,borderRight:I,borderLeft:C,borderTop:M,borderBottom:_,minWidth:0,cursor:N?"pointer":void 0};return i.jsx("div",{className:y,style:l,onClick:N?F:void 0,children:n.map((T,k)=>i.jsx(B,{node:T,context:S},k))})};function he(e){return{start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around"}[e]||"flex-start"}function ye(e){return{start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"}[e]||"flex-start"}function ve(e){const n={1:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",2:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",3:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",4:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",5:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)"};return n[e]||n[1]}const xe=({child:e,children:n,elevation:s=1,padding:t=16,variant:r,onPress:o,context:a,renderer:d})=>{if(!d||!a)return null;const c=async()=>{if(o&&a){const w=A(o,a);await a.executeAction(w)}},h=W("pineui-card",`pineui-card--elevation-${r==="outlined"||r==="filled"?0:s}`,{"pineui-card--clickable":!!o,"pineui-card--outlined":r==="outlined","pineui-card--filled":r==="filled"}),v={padding:`${t}px`,...r==="outlined"?{border:"1px solid var(--md-sys-color-outline)"}:{},...r==="filled"?{background:"var(--md-sys-color-surfaceVariant)"}:{}},b=e?i.jsx(d,{node:e,context:a}):n?i.jsx(i.Fragment,{children:n.map((w,j)=>i.jsx(d,{node:w,context:a},j))}):null;return i.jsx("div",{className:h,style:v,onClick:o?c:void 0,children:b})},ge=({src:e,alt:n="",aspectRatio:s,borderRadius:t=0,loading:r="lazy",onPress:o,context:a})=>{const d=async()=>{o&&a&&await a.executeAction(o)},c={width:"100%",aspectRatio:s,borderRadius:`${t}px`,objectFit:"cover",cursor:o?"pointer":void 0};return i.jsx("img",{className:"pineui-image",src:e,alt:n,loading:r,style:c,onClick:o?d:void 0})},be=({src:e,size:n=40,onPress:s,context:t})=>{const r=async()=>{s&&t&&await t.executeAction(s)},o={width:`${n}px`,height:`${n}px`,borderRadius:"50%",objectFit:"cover",cursor:s?"pointer":void 0};return i.jsx("img",{className:"pineui-avatar",src:e,alt:"Avatar",style:o,onClick:s?r:void 0})},je=({name:e,size:n=24,color:s,visible:t=!0})=>{if(!t)return null;const r={fontSize:`${n}px`,color:s?`var(--md-sys-color-${s}, ${s})`:void 0},o={verified:"✓",favorite:"❤️",favoriteBorder:"🤍",chatBubbleOutline:"💬",repeat:"🔁",bookmark:"🔖",bookmarkBorder:"🔖",iosShare:"↗️",moreVert:"⋮"};return i.jsx("span",{className:"pineui-icon",style:r,children:o[e]||e})};function $(e,n){return e==="{{response}}"?n:typeof e!="object"||e===null?e:Array.isArray(e)?e.map(s=>$(s,n)):Object.fromEntries(Object.entries(e).map(([s,t])=>[s,$(t,n)]))}const we=({id:e,layout:n="list",columns:s=3,spacing:t=16,data:r,itemTemplate:o,loadingState:a,emptyState:d,errorState:c,refreshable:p=!1,context:h,renderer:v})=>{const[b,w]=m.useState([]),[j,I]=m.useState(!0),[C,M]=m.useState(!1),[_,N]=m.useState(null),[S,B]=m.useState(!0),[F,f]=m.useState(null),y=r.type==="action.http"&&h?r.url.replace(/\{\{state\.([^}]+)\}\}/g,(k,u)=>{const x=u.split(".");let g=h.state;for(const O of x){if(g==null)return"";g=g[O]}return g!=null?String(g):""}):"";m.useEffect(()=>{l()},[y]);const l=async(k=!1)=>{if(h)try{if(k?M(!0):I(!0),N(null),r.type==="action.http"){let u=r.url;u.includes("{{state.")&&(u=u.replace(/\{\{state\.([^}]+)\}\}/g,(D,G)=>{const U=G.split(".");let P=h.state;for(const De of U){if(P==null)return"";P=P[De]}return P!=null?String(P):""})),k&&F&&(u+=`${u.includes("?")?"&":"?"}after=${F}`);const g=await(await fetch(u)).json(),O=g.data||g;if(w(D=>k?[...D,...O]:O),r.onSuccess&&h){console.log(`[Collection] onSuccess called with ${O.length} items`);const D=$(r.onSuccess,O);await h.executeAction(D),console.log("[Collection] onSuccess done")}g.pagination?(B(g.pagination.hasMore),f(g.pagination.cursor)):B(!1)}}catch(u){N(u)}finally{I(!1),M(!1)}},T=()=>{!C&&S&&l(!0)};return!v||!h?null:j&&a?i.jsx(v,{node:a,context:h}):_&&c?i.jsx(v,{node:c,context:h}):b.length===0&&d?i.jsx(v,{node:d,context:h}):i.jsxs("div",{className:"pineui-collection","data-collection-id":e,children:[p&&i.jsx("div",{className:"pineui-collection__refresh",children:i.jsx("button",{onClick:()=>l(!1),children:"Refresh"})}),i.jsx("div",{className:`pineui-collection__${n}`,style:n==="grid"?{display:"grid",gridTemplateColumns:`repeat(${s}, 1fr)`,gap:`${t}px`}:void 0,children:b.map((k,u)=>{const x={...h,item:k,index:u};return i.jsx("div",{className:`pineui-collection__item ${n==="grid"?"pineui-collection__item--grid":""}`,children:i.jsx(v,{node:o,context:x})},k.id||u)})}),S&&!j&&i.jsx("div",{className:"pineui-collection__load-more",style:{padding:"16px",textAlign:"center"},children:i.jsx("button",{onClick:T,disabled:C,style:{padding:"12px 24px",fontSize:"14px",fontWeight:500,cursor:C?"not-allowed":"pointer",opacity:C?.6:1},children:C?"Carregando...":"Carregar mais"})})]})},_e=({data:e,template:n,itemTemplate:s,layout:t="list",columns:r=3,spacing:o=16,context:a,renderer:d})=>{if(!d||!a)return null;const c=n||s;if(!c)return null;const p=typeof e=="string"?A(e,a):e,h=Array.isArray(p)?p:[];if(h.length===0)return null;const v=t==="grid"?{display:"grid",gridTemplateColumns:`repeat(${r}, 1fr)`,gap:`${o}px`}:{display:"flex",flexDirection:"column",gap:`${o}px`};return i.jsx("div",{style:v,children:h.map((b,w)=>{const j={...a,item:b,index:w};return i.jsx(d,{node:c,context:j},b.id??w)})})},Ne=({appBar:e,body:n,floatingActionButton:s,bottomNavigationBar:t,context:r,renderer:o})=>!o||!r?null:i.jsxs("div",{className:"pineui-scaffold",children:[e&&i.jsx("header",{className:"pineui-scaffold__appbar",children:i.jsx(o,{node:e,context:r})}),i.jsx("main",{className:"pineui-scaffold__body",children:i.jsx(o,{node:n,context:r})}),s&&i.jsx("div",{className:"pineui-scaffold__fab",children:i.jsx(o,{node:s,context:r})}),t&&i.jsx("footer",{className:"pineui-scaffold__bottomnav",children:i.jsx(o,{node:t,context:r})})]}),ke=({title:e,leading:n,actions:s=[],context:t,renderer:r})=>!r||!t?null:i.jsxs("div",{className:"pineui-appbar",children:[n&&i.jsx("div",{className:"pineui-appbar__leading",children:i.jsx(r,{node:n,context:t})}),e&&i.jsx("div",{className:"pineui-appbar__title",children:i.jsx(r,{node:e,context:t})}),s.length>0&&i.jsx("div",{className:"pineui-appbar__actions",children:s.map((o,a)=>i.jsx(r,{node:o,context:t},a))})]}),Ce=({items:e,currentIndex:n,onItemTap:s,context:t})=>{const r=async o=>{if(!t)return;const a=JSON.parse(JSON.stringify(s).replace(/\{\{item\.(\w+)\}\}/g,(d,c)=>{const p=o[c];return p!=null?String(p):""}));await t.executeAction(a)};return i.jsx("nav",{className:"pineui-bottomnav",children:e.map((o,a)=>i.jsxs("button",{className:`pineui-bottomnav__item ${a===n?"pineui-bottomnav__item--active":""}`,onClick:()=>r(o),children:[i.jsxs("div",{className:"pineui-bottomnav__icon-container",children:[i.jsx("span",{className:"pineui-bottomnav__icon",children:o.icon}),o.badge&&o.badge>0&&i.jsx("span",{className:"pineui-bottomnav__badge",children:o.badge})]}),i.jsx("span",{className:"pineui-bottomnav__label",children:o.label})]},a))})},z=({type:e,id:n,label:s,placeholder:t="",value:r="",error:o,multiline:a=!1,maxLines:d=1,maxLength:c,autofocus:p=!1,onChanged:h,onChange:v,context:b})=>{const w=v||h,j=async _=>{!w||!b||await b.executeAction(w,{event:{value:_.target.value},value:_.target.value})},C={"input.email":"email","input.password":"password","input.number":"number","input.search":"search","input.text":"text"}[e]||"text",M={id:n,placeholder:t,defaultValue:r,maxLength:c,autoFocus:p,onChange:j,className:`pineui-input${o?" pineui-input--error":""}`};return i.jsxs("div",{className:"pineui-input-wrapper",style:{width:"100%"},children:[s&&i.jsx("label",{htmlFor:n,style:{display:"block",fontSize:"12px",fontWeight:500,color:o?"var(--md-sys-color-error)":"var(--md-sys-color-onSurfaceVariant)",marginBottom:"4px"},children:s}),a?i.jsx("textarea",{...M,rows:d,style:{resize:"none",minHeight:`${d*24}px`}}):i.jsx("input",{...M,type:C}),o&&i.jsx("p",{style:{fontSize:"12px",color:"var(--md-sys-color-error)",marginTop:"4px"},children:o})]})},Se={text:me,"button.filled":L,"button.text":L,"button.outlined":L,"button.icon":L,"button.fab":L,"layout.column":ee,"layout.row":ee,"layout.scaffold":Ne,"layout.appBar":ke,"layout.bottomNav":Ce,card:xe,image:ge,avatar:be,icon:je,collection:we,"collection.map":_e,"input.text":z,"input.email":z,"input.password":z,"input.number":z,"input.search":z,divider:({thickness:e=1,color:n="surfaceVariant"})=>{const s={height:`${e}px`,backgroundColor:`var(--md-sys-color-${n}, #e0e0e0)`,border:"none",margin:0};return i.jsx("hr",{className:"pineui-divider",style:s})},conditionalRender:({conditions:e,context:n,renderer:s})=>{if(!s||!n)return null;for(const t of e){const r=A({when:t.when},n);if(r.when===!0||r.when==="true")return i.jsx(s,{node:t.render,context:n})}return null},"conditional.render":({condition:e,children:n,child:s,context:t,renderer:r})=>{if(!r||!t)return null;const o=A({condition:e},t);return o.condition===!0||o.condition==="true"||o.condition===1?s?i.jsx(r,{node:s,context:t}):n?i.jsx(i.Fragment,{children:n.map((d,c)=>i.jsx(r,{node:d,context:t},c))}):null:null},tabs:({tabs:e,defaultTab:n,context:s,renderer:t})=>{var d;const[r,o]=m.useState(n||((d=e[0])==null?void 0:d.id));if(!t||!s)return null;const a=e.find(c=>c.id===r);return i.jsxs("div",{className:"pineui-tabs",children:[i.jsx("div",{className:"pineui-tabs__header",children:e.map(c=>i.jsxs("button",{className:`pineui-tabs__tab ${r===c.id?"pineui-tabs__tab--active":""}`,onClick:()=>o(c.id),children:[c.icon&&i.jsx("span",{className:"pineui-tabs__icon",children:c.icon}),i.jsx("span",{className:"pineui-tabs__label",children:c.label}),c.badge!==void 0&&c.badge>0&&i.jsx("span",{className:"pineui-tabs__badge",children:c.badge})]},c.id))}),i.jsx("div",{className:"pineui-tabs__content",children:a&&i.jsx(t,{node:a.content,context:s})})]})},badge:({label:e,variant:n="default",size:s="medium"})=>{const t=W("pineui-badge",`pineui-badge--${n}`,`pineui-badge--${s}`);return i.jsx("span",{className:t,children:e})},chip:({label:e,icon:n,selected:s=!1,onPress:t,context:r})=>{const o=async()=>{t&&r&&await r.executeAction(t)},a=W("pineui-chip",{"pineui-chip--selected":s});return i.jsxs("button",{className:a,onClick:o,children:[n&&i.jsx("span",{className:"pineui-chip__icon",children:n}),i.jsx("span",{className:"pineui-chip__label",children:e})]})},grid:({children:e,columns:n=3,spacing:s=16,context:t,renderer:r})=>{if(!r||!t)return null;const o={display:"grid",gridTemplateColumns:`repeat(${n}, 1fr)`,gap:`${s}px`};return i.jsx("div",{className:"pineui-grid",style:o,children:e.map((a,d)=>i.jsx(r,{node:a,context:t},d))})},progress:({value:e,label:n,showPercentage:s=!1,color:t="primary"})=>{const r=Math.min(100,Math.max(0,e));return i.jsxs("div",{className:"pineui-progress",children:[(n||s)&&i.jsxs("div",{className:"pineui-progress__header",children:[n&&i.jsx("span",{className:"pineui-progress__label",children:n}),s&&i.jsxs("span",{className:"pineui-progress__percentage",children:[r,"%"]})]}),i.jsx("div",{className:"pineui-progress__track",children:i.jsx("div",{className:`pineui-progress__fill pineui-progress__fill--${t}`,style:{width:`${r}%`}})})]})},table:({columns:e,data:n,context:s,renderer:t})=>{const[r,o]=m.useState([]),[a,d]=m.useState(!0);m.useEffect(()=>{c()},[]);const c=async()=>{if(s){if(Array.isArray(n)){o(n),d(!1);return}if(n.type==="action.http")try{const p=n,v=await(await fetch(p.url,{method:p.method||"GET",headers:{"Content-Type":"application/json"},body:p.body?JSON.stringify(p.body):void 0})).json();o(v.data||v),d(!1)}catch(p){console.error("Table data fetch error:",p),d(!1)}}};return!t||!s?null:a?i.jsx("div",{className:"pineui-table",children:i.jsx("p",{style:{padding:"16px",textAlign:"center"},children:"Loading..."})}):i.jsx("div",{className:"pineui-table",children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsx("tr",{children:e.map(p=>i.jsx("th",{style:{width:p.width},className:"pineui-table__header",children:p.label},p.key))})}),i.jsx("tbody",{children:r.map((p,h)=>i.jsx("tr",{className:"pineui-table__row",children:e.map(v=>i.jsx("td",{className:"pineui-table__cell",children:v.template?i.jsx(t,{node:v.template,context:s,parentData:p}):i.jsx("span",{children:p[v.key]})},v.key))},h))})]})})},view:({name:e,context:n,renderer:s,flex:t,width:r,height:o})=>{var c;const a=(c=n==null?void 0:n.views)==null?void 0:c[e];if(!a)return console.warn(`View not found: ${e}`),null;const d={};return t&&(d.flex=t),r&&(d.width=r),o&&(d.height=o),i.jsx("div",{className:"pineui-view",style:d,children:i.jsx(s,{node:a.screen,context:n})})}},V=({node:e,context:n,parentData:s})=>{if(!e||!e.type)return null;const t=s!==void 0?Object.assign({},n,{item:s}):n,o=e.type!=="collection"&&e.type!=="collection.map"?A(e,t):e;if(o.type.startsWith("component.")){const d=o.type,c=n.components[d];if(!c)return console.warn(`Component not found: ${d}`),null;const p={...t,props:o.props};return i.jsx(V,{node:c.definition,context:p,parentData:s})}const a=Se[o.type];return a?i.jsx(a,{...o,context:n,renderer:V}):(console.warn(`Unknown component type: ${o.type}`),null)},Ae=({messages:e,onDismiss:n})=>i.jsx("div",{className:"pineui-snackbar-container",children:e.map(s=>i.jsx(Te,{message:s,onDismiss:n},s.id))}),Te=({message:e,onDismiss:n})=>{const[s,t]=m.useState(!1);return m.useEffect(()=>{setTimeout(()=>t(!0),10);const r=setTimeout(()=>{t(!1),setTimeout(()=>n(e.id),300)},e.duration||3e3);return()=>clearTimeout(r)},[e,n]),i.jsxs("div",{className:`pineui-snackbar ${s?"pineui-snackbar--visible":""}`,children:[i.jsx("span",{className:"pineui-snackbar__message",children:e.message}),e.action&&i.jsx("button",{className:"pineui-snackbar__action",onClick:e.action.onPress,children:e.action.label})]})},Ee=({presentation:e="modal",dismissible:n=!0,child:s,onClose:t,context:r,renderer:o})=>{if(m.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[]),!o||!r)return null;const a=p=>{n&&p.target===p.currentTarget&&t()},d=p=>{n&&p.key==="Escape"&&t()};m.useEffect(()=>(window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)),[n]);const c=e==="bottomSheet"?"pineui-modal-backdrop pineui-modal-backdrop--bottomSheet":"pineui-modal-backdrop";return i.jsx("div",{className:c,onClick:a,children:i.jsx("div",{className:`pineui-modal pineui-modal--${e}`,children:i.jsx(o,{node:s,context:r})})})},Ie=({overlays:e,onClose:n,context:s,renderer:t})=>i.jsx(i.Fragment,{children:Object.entries(e).map(([r,{visible:o,config:a}])=>o?i.jsx(Ee,{id:r,...a,onClose:()=>n(r),context:s,renderer:t},r):null)});function J(e,n){if(n.startsWith("http://")||n.startsWith("https://"))return n;try{const s=new URL(e,window.location.href);return new URL(n,s).href}catch{const s=n.replace(/^\.\//,"");return`${e.endsWith("/")?e.slice(0,-1):e}/${s}`}}async function te(e,n){if(!e.imports)return e;const s={...e};if(e.imports.components)for(const t of e.imports.components)try{const r=J(n,t),a=await(await fetch(r)).json();s.components={...s.components,...a}}catch(r){console.error(`❌ Failed to load component from ${t}:`,r),console.error(` Resolved URL: ${J(n,t)}`)}if(e.imports.views)for(const t of e.imports.views)try{const r=J(n,t),a=await(await fetch(r)).json();s.views={...s.views,...a}}catch(r){console.error(`Failed to load view from ${t}:`,r)}return s}class Me extends m.Component{constructor(n){super(n),this.state={hasError:!1,error:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,s){console.error("🚨 PineUI Error:",n),console.error("Component Stack:",s.componentStack)}render(){var n;return this.state.hasError?this.props.fallback?this.props.fallback:i.jsxs("div",{className:"pineui-error",style:{padding:"24px",textAlign:"center"},children:[i.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"⚠️"}),i.jsx("h3",{style:{marginBottom:"8px",fontSize:"18px",fontWeight:600},children:"Something went wrong"}),i.jsx("p",{style:{color:"#79747E",fontSize:"14px",marginBottom:"16px"},children:((n=this.state.error)==null?void 0:n.message)||"An unexpected error occurred"}),i.jsx("button",{onClick:()=>window.location.reload(),style:{padding:"10px 20px",background:"#6750A4",color:"white",border:"none",borderRadius:"20px",cursor:"pointer",fontSize:"14px",fontWeight:500},children:"Reload Page"})]}):this.props.children}}function Oe(e,n){const s=n.split(".");let t=e;for(const r of s){if(t==null)return;t=t[r]}return t}const ne=({schema:e,schemaUrl:n,baseUrl:s=""})=>{const[t,r]=m.useState(null),[o,a]=m.useState(!0),[d,c]=m.useState(null),[p,h]=m.useState([]),[v,b]=m.useState({}),w=(e==null?void 0:e.state)||{currentUser:{id:"user_current",username:"currentuser",displayName:"Current User",avatar:"https://i.pravatar.cc/150?img=1"},composer:{text:"",media:null,posting:!1},testInput:""},[j,I]=m.useState(w);m.useEffect(()=>{n&&!e?M():e&&C()},[n,e,s]);const C=async()=>{try{a(!0);let f=e;f.imports&&s&&(console.log("Loading imports for initial schema...",f.imports),f=await te(f,s),console.log("Imports loaded! Components:",Object.keys(f.components||{}))),r(f),f.state&&I(y=>({...y,...f.state}))}catch(f){c(f)}finally{a(!1)}},M=async()=>{try{a(!0);let y=await(await fetch(n)).json();y.imports&&s&&(y=await te(y,s)),r(y),y.state&&I(l=>({...l,...y.state}))}catch(f){c(f)}finally{a(!1)}},_=async(f,y)=>{var T,k;(f.type==="action.sequence"||f.intent&&f.intent.startsWith("course"))&&console.log(`[executeAction] type=${f.intent||f.type}, courseList.length=${((T=j.courseList)==null?void 0:T.length)??"N/A"}, selectedCourseIndex=${j.selectedCourseIndex}`);const l=A(f,{state:j,...y});if(l.intent){const u=l.intent,x={...y,...l};return delete x.intent,N(u,x)}if(l.type==="intent"&&l.name){const u={...y,...l};return delete u.type,delete u.name,N(l.name,u)}if(l.type&&l.type.startsWith("intent.")){const u=l.type.substring(7),x={...y,...l};return delete x.type,N(u,x)}switch(l.type){case"action.http":{try{const u=l.url.startsWith("http")?l.url:`${s}${l.url}`,g=await(await fetch(u,{method:l.method||"GET",headers:{"Content-Type":"application/json"},body:l.body?JSON.stringify(l.body):void 0})).json();console.log("HTTP action result:",g)}catch(u){console.error("HTTP action error:",u)}break}case"action.state.patch":{const u=l.value;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),I(x=>{const g={...x};return Be(g,l.path,l.value),g});break}case"action.overlay.open":{const u=(k=t==null?void 0:t.overlays)==null?void 0:k[l.overlayId];u?b(x=>({...x,[l.overlayId]:{visible:!0,config:u}})):console.warn("Overlay not found:",l.overlayId);break}case"action.overlay.close":{b(u=>({...u,[l.overlayId]:{...u[l.overlayId],visible:!1}}));break}case"action.collection.refresh":{console.log("Refresh collection:",l.collectionId);break}case"action.snackbar.show":{const u=typeof l.message=="string"&&l.message.includes("{{")?l.message.replace(/\{\{(.+?)\}\}/g,(g,O)=>{const D=O.trim();if(D.startsWith("state.")){const G=D.substring(6),U=Oe(j,G);return U!=null?String(U):""}return""}):l.message,x={id:`snackbar-${Date.now()}`,message:u,duration:l.duration||3e3,action:l.action?{label:l.action.label,onPress:()=>_(l.action.onPress)}:void 0};h(g=>[...g,x]);break}case"action.delay":{const u=l.duration||1e3;await new Promise(x=>setTimeout(x,u));break}case"action.sequence":{for(const u of l.actions??[])await _(u,y);break}default:console.warn("Unknown action type:",l.type)}},N=async(f,y)=>{if(console.log("Executing intent:",f,y),!(t!=null&&t.intents))return;const l=t.intents[f];if(!l){console.warn("Intent not found:",f);return}if(Array.isArray(l.handler))for(const T of l.handler)await _(T,y);else await _(l.handler,y)},S={state:j,data:{},components:(t==null?void 0:t.components)||{},views:(t==null?void 0:t.views)||{},intents:(t==null?void 0:t.intents)||{},schema:t,executeAction:_,executeIntent:N};if(o)return i.jsxs("div",{className:"pineui-loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"400px",gap:"16px",color:"#79747E"},children:[i.jsx("div",{style:{width:"40px",height:"40px",border:"4px solid #E7E0EC",borderTop:"4px solid #6750A4",borderRadius:"50%",animation:"pineui-spin 1s linear infinite"}}),i.jsx("p",{style:{margin:0,fontSize:"14px",fontWeight:500},children:"Loading application..."}),i.jsx("style",{dangerouslySetInnerHTML:{__html:`
9
+ */var ie=m,oe=Symbol.for("react.element"),ae=Symbol.for("react.fragment"),le=Object.prototype.hasOwnProperty,ce=ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ue={key:!0,ref:!0,__self:!0,__source:!0};function Z(e,n,s){var t,r={},o=null,a=null;s!==void 0&&(o=""+s),n.key!==void 0&&(o=""+n.key),n.ref!==void 0&&(a=n.ref);for(t in n)le.call(n,t)&&!ue.hasOwnProperty(t)&&(r[t]=n[t]);if(e&&e.defaultProps)for(t in n=e.defaultProps,n)r[t]===void 0&&(r[t]=n[t]);return{$$typeof:oe,type:e,key:o,ref:a,props:r,_owner:ce.current}}P.Fragment=ae,P.jsx=Z,P.jsxs=Z,Y.exports=P;var i=Y.exports;function A(e,n){if(typeof e=="string")return de(e,n);if(Array.isArray(e))return e.map(s=>A(s,n));if(e&&typeof e=="object"){const s={};for(const t in e)s[t]=A(e[t],n);return s}return e}function de(e,n){const s=e.indexOf("}}");if(e.startsWith("{{")&&e.endsWith("}}")&&s===e.length-2){const r=e.slice(2,-2).trim();return(r==="item"||r.startsWith("item.")||/\bitem\b/.test(r))&&(!("item"in n)||n.item===void 0)||(r==="props"||r.startsWith("props."))&&(!("props"in n)||n.props===void 0)||(r==="response"||r.startsWith("response."))&&!("response"in n)?e:Q(r,n)}return e.replace(/\{\{(.+?)\}\}/g,(r,o)=>{const a=Q(o.trim(),n);return a!=null?String(a):""})}function Q(e,n){try{if(/^[\w.]+$/.test(e))return X(n,e);if(e.includes("|")&&!e.includes("||"))return pe(e,n);const s=Object.keys(n).filter(o=>/^[a-zA-Z_$][\w$]*$/.test(o)),t=s.map(o=>n[o]);return new Function(...s,`"use strict"; try { return (${e}); } catch(e) { return undefined; }`)(...t)}catch(s){console.warn(`Failed to evaluate expression: ${e}`,s);return}}function X(e,n){const s=n.split(".");let t=e;for(const r of s){if(t==null)return;t=t[r]}return t}function pe(e,n){const[s,t]=e.split("|").map(o=>o.trim()),r=X(n,s);return t==="timeAgo"?fe(r):r}function fe(e){if(!e)return"";const n=new Date(e);if(isNaN(n.getTime()))return e;const t=Math.floor((new Date().getTime()-n.getTime())/1e3);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`}function q(e){var n,s,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(n=0;n<r;n++)e[n]&&(s=q(e[n]))&&(t&&(t+=" "),t+=s)}else for(s in e)e[s]&&(t&&(t+=" "),t+=s);return t}function W(){for(var e,n,s=0,t="",r=arguments.length;s<r;s++)(e=arguments[s])&&(n=q(e))&&(t&&(t+=" "),t+=n);return t}const me=({content:e,style:n="bodyMedium",color:s,fontWeight:t,maxLines:r})=>{const o=W("pineui-text",`pineui-text--${n}`,{"pineui-text--bold":t==="bold"}),a={color:s?`var(--md-sys-color-${s}, ${s})`:void 0,WebkitLineClamp:r??void 0,display:r?"-webkit-box":void 0,WebkitBoxOrient:r?"vertical":void 0,overflow:r?"hidden":void 0};return i.jsx("p",{className:o,style:a,children:e||"(empty)"})},L=({type:e,label:n,icon:s,enabled:t=!0,loading:r=!1,onPress:o,context:a,size:d="medium",color:c})=>{const p=async()=>{if(!t||r||!o||!a)return;const b=A(o,a);await a.executeAction(b)},h=W("pineui-button",`pineui-button--${e.split(".")[1]}`,{"pineui-button--disabled":!t,"pineui-button--loading":r,[`pineui-button--${d}`]:d}),v={color:c?`var(--md-sys-color-${c}, ${c})`:void 0};return i.jsxs("button",{className:h,onClick:p,disabled:!t||r,style:v,children:[r?i.jsx("span",{className:"pineui-button__spinner",children:"⏳"}):s?i.jsx("span",{className:"pineui-button__icon",children:s}):null,n&&i.jsx("span",{className:"pineui-button__label",children:n})]})},ee=({type:e,children:n=[],spacing:s=0,padding:t=0,mainAxisAlignment:r="start",crossAxisAlignment:o="start",flex:a,width:d,height:c,maxWidth:p,overflow:h,backgroundColor:v,border:b,borderRadius:w,elevation:j,borderRight:I,borderLeft:C,borderTop:M,borderBottom:_,onPress:N,context:S,renderer:B})=>{if(!B||!S)return null;const F=async()=>{if(N&&S){const T=A(N,S);await S.executeAction(T)}},f=e==="layout.column",y=W("pineui-layout",{"pineui-layout--column":f,"pineui-layout--row":!f}),l={display:"flex",flexDirection:f?"column":"row",gap:`${s}px`,padding:`${t}px`,justifyContent:he(r),alignItems:ye(o),flex:a,width:d!==void 0?typeof d=="number"?`${d}px`:d:void 0,height:c!==void 0?typeof c=="number"?`${c}px`:c:void 0,maxWidth:p!==void 0?typeof p=="number"?`${p}px`:p:void 0,overflow:h,backgroundColor:v,border:b,borderRadius:w!==void 0?`${w}px`:void 0,boxShadow:j?ve(j):void 0,borderRight:I,borderLeft:C,borderTop:M,borderBottom:_,minWidth:0,cursor:N?"pointer":void 0};return i.jsx("div",{className:y,style:l,onClick:N?F:void 0,children:n.map((T,k)=>i.jsx(B,{node:T,context:S},k))})};function he(e){return{start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around"}[e]||"flex-start"}function ye(e){return{start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"}[e]||"flex-start"}function ve(e){const n={1:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",2:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",3:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",4:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",5:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)"};return n[e]||n[1]}const xe=({child:e,children:n,elevation:s=1,padding:t=16,variant:r,onPress:o,context:a,renderer:d})=>{if(!d||!a)return null;const c=async()=>{if(o&&a){const w=A(o,a);await a.executeAction(w)}},h=W("pineui-card",`pineui-card--elevation-${r==="outlined"||r==="filled"?0:s}`,{"pineui-card--clickable":!!o,"pineui-card--outlined":r==="outlined","pineui-card--filled":r==="filled"}),v={padding:`${t}px`,...r==="outlined"?{border:"1px solid var(--md-sys-color-outline)"}:{},...r==="filled"?{background:"var(--md-sys-color-surfaceVariant)"}:{}},b=e?i.jsx(d,{node:e,context:a}):n?i.jsx(i.Fragment,{children:n.map((w,j)=>i.jsx(d,{node:w,context:a},j))}):null;return i.jsx("div",{className:h,style:v,onClick:o?c:void 0,children:b})},ge=({src:e,alt:n="",aspectRatio:s,borderRadius:t=0,loading:r="lazy",onPress:o,context:a})=>{const d=async()=>{o&&a&&await a.executeAction(o)},c={width:"100%",aspectRatio:s,borderRadius:`${t}px`,objectFit:"cover",cursor:o?"pointer":void 0};return i.jsx("img",{className:"pineui-image",src:e,alt:n,loading:r,style:c,onClick:o?d:void 0})},be=({src:e,size:n=40,onPress:s,context:t})=>{const r=async()=>{s&&t&&await t.executeAction(s)},o={width:`${n}px`,height:`${n}px`,borderRadius:"50%",objectFit:"cover",cursor:s?"pointer":void 0};return i.jsx("img",{className:"pineui-avatar",src:e,alt:"Avatar",style:o,onClick:s?r:void 0})},je=({name:e,size:n=24,color:s,visible:t=!0})=>{if(!t)return null;const r={fontSize:`${n}px`,color:s?`var(--md-sys-color-${s}, ${s})`:void 0},o={verified:"✓",favorite:"❤️",favoriteBorder:"🤍",chatBubbleOutline:"💬",repeat:"🔁",bookmark:"🔖",bookmarkBorder:"🔖",iosShare:"↗️",moreVert:"⋮"};return i.jsx("span",{className:"pineui-icon",style:r,children:o[e]||e})};function $(e,n){return e==="{{response}}"?n:typeof e!="object"||e===null?e:Array.isArray(e)?e.map(s=>$(s,n)):Object.fromEntries(Object.entries(e).map(([s,t])=>[s,$(t,n)]))}const we=({id:e,layout:n="list",columns:s=3,spacing:t=16,data:r,itemTemplate:o,loadingState:a,emptyState:d,errorState:c,refreshable:p=!1,context:h,renderer:v})=>{const[b,w]=m.useState([]),[j,I]=m.useState(!0),[C,M]=m.useState(!1),[_,N]=m.useState(null),[S,B]=m.useState(!0),[F,f]=m.useState(null),y=r.type==="action.http"&&h?r.url.replace(/\{\{state\.([^}]+)\}\}/g,(k,u)=>{const x=u.split(".");let g=h.state;for(const O of x){if(g==null)return"";g=g[O]}return g!=null?String(g):""}):"";m.useEffect(()=>{l()},[y]);const l=async(k=!1)=>{if(h)try{if(k?M(!0):I(!0),N(null),r.type==="action.http"){let u=r.url;u.includes("{{state.")&&(u=u.replace(/\{\{state\.([^}]+)\}\}/g,(D,G)=>{const U=G.split(".");let z=h.state;for(const De of U){if(z==null)return"";z=z[De]}return z!=null?String(z):""})),k&&F&&(u+=`${u.includes("?")?"&":"?"}after=${F}`);const g=await(await fetch(u)).json(),O=g.data||g;if(w(D=>k?[...D,...O]:O),r.onSuccess&&h){console.log(`[Collection] onSuccess called with ${O.length} items`);const D=$(r.onSuccess,O);await h.executeAction(D),console.log("[Collection] onSuccess done")}g.pagination?(B(g.pagination.hasMore),f(g.pagination.cursor)):B(!1)}}catch(u){N(u)}finally{I(!1),M(!1)}},T=()=>{!C&&S&&l(!0)};return!v||!h?null:j&&a?i.jsx(v,{node:a,context:h}):_&&c?i.jsx(v,{node:c,context:h}):b.length===0&&d?i.jsx(v,{node:d,context:h}):i.jsxs("div",{className:"pineui-collection","data-collection-id":e,children:[p&&i.jsx("div",{className:"pineui-collection__refresh",children:i.jsx("button",{onClick:()=>l(!1),children:"Refresh"})}),i.jsx("div",{className:`pineui-collection__${n}`,style:n==="grid"?{display:"grid",gridTemplateColumns:`repeat(${s}, 1fr)`,gap:`${t}px`}:void 0,children:b.map((k,u)=>{const x={...h,item:k,index:u};return i.jsx("div",{className:`pineui-collection__item ${n==="grid"?"pineui-collection__item--grid":""}`,children:i.jsx(v,{node:o,context:x})},k.id||u)})}),S&&!j&&i.jsx("div",{className:"pineui-collection__load-more",style:{padding:"16px",textAlign:"center"},children:i.jsx("button",{onClick:T,disabled:C,style:{padding:"12px 24px",fontSize:"14px",fontWeight:500,cursor:C?"not-allowed":"pointer",opacity:C?.6:1},children:C?"Carregando...":"Carregar mais"})})]})},_e=({data:e,template:n,itemTemplate:s,layout:t="list",columns:r=3,spacing:o=16,context:a,renderer:d})=>{if(!d||!a)return null;const c=n||s;if(!c)return null;const p=typeof e=="string"?A(e,a):e,h=Array.isArray(p)?p:[];if(h.length===0)return null;const v=t==="grid"?{display:"grid",gridTemplateColumns:`repeat(${r}, 1fr)`,gap:`${o}px`}:{display:"flex",flexDirection:"column",gap:`${o}px`};return i.jsx("div",{style:v,children:h.map((b,w)=>{const j={...a,item:b,index:w};return i.jsx(d,{node:c,context:j},b.id??w)})})},Ne=({appBar:e,body:n,floatingActionButton:s,bottomNavigationBar:t,context:r,renderer:o})=>!o||!r?null:i.jsxs("div",{className:"pineui-scaffold",children:[e&&i.jsx("header",{className:"pineui-scaffold__appbar",children:i.jsx(o,{node:e,context:r})}),i.jsx("main",{className:"pineui-scaffold__body",children:i.jsx(o,{node:n,context:r})}),s&&i.jsx("div",{className:"pineui-scaffold__fab",children:i.jsx(o,{node:s,context:r})}),t&&i.jsx("footer",{className:"pineui-scaffold__bottomnav",children:i.jsx(o,{node:t,context:r})})]}),ke=({title:e,leading:n,actions:s=[],context:t,renderer:r})=>!r||!t?null:i.jsxs("div",{className:"pineui-appbar",children:[n&&i.jsx("div",{className:"pineui-appbar__leading",children:i.jsx(r,{node:n,context:t})}),e&&i.jsx("div",{className:"pineui-appbar__title",children:i.jsx(r,{node:e,context:t})}),s.length>0&&i.jsx("div",{className:"pineui-appbar__actions",children:s.map((o,a)=>i.jsx(r,{node:o,context:t},a))})]}),Ce=({items:e,currentIndex:n,onItemTap:s,context:t})=>{const r=async o=>{if(!t)return;const a=JSON.parse(JSON.stringify(s).replace(/\{\{item\.(\w+)\}\}/g,(d,c)=>{const p=o[c];return p!=null?String(p):""}));await t.executeAction(a)};return i.jsx("nav",{className:"pineui-bottomnav",children:e.map((o,a)=>i.jsxs("button",{className:`pineui-bottomnav__item ${a===n?"pineui-bottomnav__item--active":""}`,onClick:()=>r(o),children:[i.jsxs("div",{className:"pineui-bottomnav__icon-container",children:[i.jsx("span",{className:"pineui-bottomnav__icon",children:o.icon}),o.badge&&o.badge>0&&i.jsx("span",{className:"pineui-bottomnav__badge",children:o.badge})]}),i.jsx("span",{className:"pineui-bottomnav__label",children:o.label})]},a))})},R=({type:e,id:n,label:s,placeholder:t="",value:r="",error:o,multiline:a=!1,maxLines:d=1,maxLength:c,autofocus:p=!1,onChanged:h,onChange:v,context:b})=>{const w=v||h,j=async _=>{!w||!b||await b.executeAction(w,{event:{value:_.target.value},value:_.target.value})},C={"input.email":"email","input.password":"password","input.number":"number","input.search":"search","input.text":"text"}[e]||"text",M={id:n,placeholder:t,defaultValue:r,maxLength:c,autoFocus:p,onChange:j,className:`pineui-input${o?" pineui-input--error":""}`};return i.jsxs("div",{className:"pineui-input-wrapper",style:{width:"100%"},children:[s&&i.jsx("label",{htmlFor:n,style:{display:"block",fontSize:"12px",fontWeight:500,color:o?"var(--md-sys-color-error)":"var(--md-sys-color-onSurfaceVariant)",marginBottom:"4px"},children:s}),a?i.jsx("textarea",{...M,rows:d,style:{resize:"none",minHeight:`${d*24}px`}}):i.jsx("input",{...M,type:C}),o&&i.jsx("p",{style:{fontSize:"12px",color:"var(--md-sys-color-error)",marginTop:"4px"},children:o})]})},Se={text:me,"button.filled":L,"button.text":L,"button.outlined":L,"button.icon":L,"button.fab":L,"layout.column":ee,"layout.row":ee,"layout.scaffold":Ne,"layout.appBar":ke,"layout.bottomNav":Ce,card:xe,image:ge,avatar:be,icon:je,collection:we,"collection.map":_e,"input.text":R,"input.email":R,"input.password":R,"input.number":R,"input.search":R,divider:({thickness:e=1,color:n="surfaceVariant"})=>{const s={height:`${e}px`,backgroundColor:`var(--md-sys-color-${n}, #e0e0e0)`,border:"none",margin:0};return i.jsx("hr",{className:"pineui-divider",style:s})},conditionalRender:({conditions:e,context:n,renderer:s})=>{if(!s||!n)return null;for(const t of e){const r=A({when:t.when},n);if(r.when===!0||r.when==="true")return i.jsx(s,{node:t.render,context:n})}return null},"conditional.render":({condition:e,children:n,child:s,context:t,renderer:r})=>{if(!r||!t)return null;const o=A({condition:e},t);return o.condition===!0||o.condition==="true"||o.condition===1?s?i.jsx(r,{node:s,context:t}):n?i.jsx(i.Fragment,{children:n.map((d,c)=>i.jsx(r,{node:d,context:t},c))}):null:null},tabs:({tabs:e,defaultTab:n,context:s,renderer:t})=>{var d;const[r,o]=m.useState(n||((d=e[0])==null?void 0:d.id));if(!t||!s)return null;const a=e.find(c=>c.id===r);return i.jsxs("div",{className:"pineui-tabs",children:[i.jsx("div",{className:"pineui-tabs__header",children:e.map(c=>i.jsxs("button",{className:`pineui-tabs__tab ${r===c.id?"pineui-tabs__tab--active":""}`,onClick:()=>o(c.id),children:[c.icon&&i.jsx("span",{className:"pineui-tabs__icon",children:c.icon}),i.jsx("span",{className:"pineui-tabs__label",children:c.label}),c.badge!==void 0&&c.badge>0&&i.jsx("span",{className:"pineui-tabs__badge",children:c.badge})]},c.id))}),i.jsx("div",{className:"pineui-tabs__content",children:a&&i.jsx(t,{node:a.content,context:s})})]})},badge:({label:e,variant:n="default",size:s="medium"})=>{const t=W("pineui-badge",`pineui-badge--${n}`,`pineui-badge--${s}`);return i.jsx("span",{className:t,children:e})},chip:({label:e,icon:n,selected:s=!1,onPress:t,context:r})=>{const o=async()=>{t&&r&&await r.executeAction(t)},a=W("pineui-chip",{"pineui-chip--selected":s});return i.jsxs("button",{className:a,onClick:o,children:[n&&i.jsx("span",{className:"pineui-chip__icon",children:n}),i.jsx("span",{className:"pineui-chip__label",children:e})]})},grid:({children:e,columns:n=3,spacing:s=16,context:t,renderer:r})=>{if(!r||!t)return null;const o={display:"grid",gridTemplateColumns:`repeat(${n}, 1fr)`,gap:`${s}px`};return i.jsx("div",{className:"pineui-grid",style:o,children:e.map((a,d)=>i.jsx(r,{node:a,context:t},d))})},progress:({value:e,label:n,showPercentage:s=!1,color:t="primary"})=>{const r=Math.min(100,Math.max(0,e));return i.jsxs("div",{className:"pineui-progress",children:[(n||s)&&i.jsxs("div",{className:"pineui-progress__header",children:[n&&i.jsx("span",{className:"pineui-progress__label",children:n}),s&&i.jsxs("span",{className:"pineui-progress__percentage",children:[r,"%"]})]}),i.jsx("div",{className:"pineui-progress__track",children:i.jsx("div",{className:`pineui-progress__fill pineui-progress__fill--${t}`,style:{width:`${r}%`}})})]})},table:({columns:e,data:n,context:s,renderer:t})=>{const[r,o]=m.useState([]),[a,d]=m.useState(!0);m.useEffect(()=>{c()},[]);const c=async()=>{if(s){if(Array.isArray(n)){o(n),d(!1);return}if(n.type==="action.http")try{const p=n,v=await(await fetch(p.url,{method:p.method||"GET",headers:{"Content-Type":"application/json"},body:p.body?JSON.stringify(p.body):void 0})).json();o(v.data||v),d(!1)}catch(p){console.error("Table data fetch error:",p),d(!1)}}};return!t||!s?null:a?i.jsx("div",{className:"pineui-table",children:i.jsx("p",{style:{padding:"16px",textAlign:"center"},children:"Loading..."})}):i.jsx("div",{className:"pineui-table",children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsx("tr",{children:e.map(p=>i.jsx("th",{style:{width:p.width},className:"pineui-table__header",children:p.label},p.key))})}),i.jsx("tbody",{children:r.map((p,h)=>i.jsx("tr",{className:"pineui-table__row",children:e.map(v=>i.jsx("td",{className:"pineui-table__cell",children:v.template?i.jsx(t,{node:v.template,context:s,parentData:p}):i.jsx("span",{children:p[v.key]})},v.key))},h))})]})})},view:({name:e,context:n,renderer:s,flex:t,width:r,height:o})=>{var c;const a=(c=n==null?void 0:n.views)==null?void 0:c[e];if(!a)return console.warn(`View not found: ${e}`),null;const d={};return t&&(d.flex=t),r&&(d.width=r),o&&(d.height=o),i.jsx("div",{className:"pineui-view",style:d,children:i.jsx(s,{node:a.screen,context:n})})}},V=({node:e,context:n,parentData:s})=>{if(!e||!e.type)return null;const t=s!==void 0?Object.assign({},n,{item:s}):n,o=e.type!=="collection"&&e.type!=="collection.map"?A(e,t):e;if(o.type.startsWith("component.")){const d=o.type,c=n.components[d];if(!c)return console.warn(`Component not found: ${d}`),null;const p={...t,props:o.props};return i.jsx(V,{node:c.definition,context:p,parentData:s})}const a=Se[o.type];return a?i.jsx(a,{...o,context:n,renderer:V}):(console.warn(`Unknown component type: ${o.type}`),null)},Ae=({messages:e,onDismiss:n})=>i.jsx("div",{className:"pineui-snackbar-container",children:e.map(s=>i.jsx(Te,{message:s,onDismiss:n},s.id))}),Te=({message:e,onDismiss:n})=>{const[s,t]=m.useState(!1);return m.useEffect(()=>{setTimeout(()=>t(!0),10);const r=setTimeout(()=>{t(!1),setTimeout(()=>n(e.id),300)},e.duration||3e3);return()=>clearTimeout(r)},[e,n]),i.jsxs("div",{className:`pineui-snackbar ${s?"pineui-snackbar--visible":""}`,children:[i.jsx("span",{className:"pineui-snackbar__message",children:e.message}),e.action&&i.jsx("button",{className:"pineui-snackbar__action",onClick:e.action.onPress,children:e.action.label})]})},Ee=({presentation:e="modal",dismissible:n=!0,child:s,onClose:t,context:r,renderer:o})=>{if(m.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[]),!o||!r)return null;const a=p=>{n&&p.target===p.currentTarget&&t()},d=p=>{n&&p.key==="Escape"&&t()};m.useEffect(()=>(window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)),[n]);const c=e==="bottomSheet"?"pineui-modal-backdrop pineui-modal-backdrop--bottomSheet":"pineui-modal-backdrop";return i.jsx("div",{className:c,onClick:a,children:i.jsx("div",{className:`pineui-modal pineui-modal--${e}`,children:i.jsx(o,{node:s,context:r})})})},Ie=({overlays:e,onClose:n,context:s,renderer:t})=>i.jsx(i.Fragment,{children:Object.entries(e).map(([r,{visible:o,config:a}])=>o?i.jsx(Ee,{id:r,...a,onClose:()=>n(r),context:s,renderer:t},r):null)});function J(e,n){if(n.startsWith("http://")||n.startsWith("https://"))return n;try{const s=new URL(e,window.location.href);return new URL(n,s).href}catch{const s=n.replace(/^\.\//,"");return`${e.endsWith("/")?e.slice(0,-1):e}/${s}`}}async function te(e,n){if(!e.imports)return e;const s={...e};if(e.imports.components)for(const t of e.imports.components)try{const r=J(n,t),a=await(await fetch(r)).json();s.components={...s.components,...a}}catch(r){console.error(`❌ Failed to load component from ${t}:`,r),console.error(` Resolved URL: ${J(n,t)}`)}if(e.imports.views)for(const t of e.imports.views)try{const r=J(n,t),a=await(await fetch(r)).json();s.views={...s.views,...a}}catch(r){console.error(`Failed to load view from ${t}:`,r)}return s}class Me extends m.Component{constructor(n){super(n),this.state={hasError:!1,error:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,s){console.error("🚨 PineUI Error:",n),console.error("Component Stack:",s.componentStack)}render(){var n;return this.state.hasError?this.props.fallback?this.props.fallback:i.jsxs("div",{className:"pineui-error",style:{padding:"24px",textAlign:"center"},children:[i.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"⚠️"}),i.jsx("h3",{style:{marginBottom:"8px",fontSize:"18px",fontWeight:600},children:"Something went wrong"}),i.jsx("p",{style:{color:"#79747E",fontSize:"14px",marginBottom:"16px"},children:((n=this.state.error)==null?void 0:n.message)||"An unexpected error occurred"}),i.jsx("button",{onClick:()=>window.location.reload(),style:{padding:"10px 20px",background:"#6750A4",color:"white",border:"none",borderRadius:"20px",cursor:"pointer",fontSize:"14px",fontWeight:500},children:"Reload Page"})]}):this.props.children}}function Oe(e,n){const s=n.split(".");let t=e;for(const r of s){if(t==null)return;t=t[r]}return t}const ne=({schema:e,schemaUrl:n,baseUrl:s=""})=>{const[t,r]=m.useState(null),[o,a]=m.useState(!0),[d,c]=m.useState(null),[p,h]=m.useState([]),[v,b]=m.useState({}),w=(e==null?void 0:e.state)||{currentUser:{id:"user_current",username:"currentuser",displayName:"Current User",avatar:"https://i.pravatar.cc/150?img=1"},composer:{text:"",media:null,posting:!1},testInput:""},[j,I]=m.useState(w);m.useEffect(()=>{n&&!e?M():e&&C()},[n,e,s]);const C=async()=>{try{a(!0);let f=e;f.imports&&s&&(console.log("Loading imports for initial schema...",f.imports),f=await te(f,s),console.log("Imports loaded! Components:",Object.keys(f.components||{}))),r(f),f.state&&I(y=>({...y,...f.state}))}catch(f){c(f)}finally{a(!1)}},M=async()=>{try{a(!0);let y=await(await fetch(n)).json();y.imports&&s&&(y=await te(y,s)),r(y),y.state&&I(l=>({...l,...y.state}))}catch(f){c(f)}finally{a(!1)}},_=async(f,y)=>{var T,k;(f.type==="action.sequence"||f.intent&&f.intent.startsWith("course"))&&console.log(`[executeAction] type=${f.intent||f.type}, courseList.length=${((T=j.courseList)==null?void 0:T.length)??"N/A"}, selectedCourseIndex=${j.selectedCourseIndex}`);const l=A(f,{state:j,...y});if(l.intent){const u=l.intent,x={...y,...l};return delete x.intent,N(u,x)}if(l.type==="intent"&&l.name){const u={...y,...l};return delete u.type,delete u.name,N(l.name,u)}if(l.type&&l.type.startsWith("intent.")){const u=l.type.substring(7),x={...y,...l};return delete x.type,N(u,x)}switch(l.type){case"action.http":{try{const u=l.url.startsWith("http")?l.url:`${s}${l.url}`,g=await(await fetch(u,{method:l.method||"GET",headers:{"Content-Type":"application/json"},body:l.body?JSON.stringify(l.body):void 0})).json();console.log("HTTP action result:",g)}catch(u){console.error("HTTP action error:",u)}break}case"action.state.patch":{const u=l.value;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),I(x=>{const g={...x};return Be(g,l.path,l.value),g});break}case"action.overlay.open":{const u=(k=t==null?void 0:t.overlays)==null?void 0:k[l.overlayId];u?b(x=>({...x,[l.overlayId]:{visible:!0,config:u}})):console.warn("Overlay not found:",l.overlayId);break}case"action.overlay.close":{b(u=>({...u,[l.overlayId]:{...u[l.overlayId],visible:!1}}));break}case"action.collection.refresh":{console.log("Refresh collection:",l.collectionId);break}case"action.snackbar.show":{const u=typeof l.message=="string"&&l.message.includes("{{")?l.message.replace(/\{\{(.+?)\}\}/g,(g,O)=>{const D=O.trim();if(D.startsWith("state.")){const G=D.substring(6),U=Oe(j,G);return U!=null?String(U):""}return""}):l.message,x={id:`snackbar-${Date.now()}`,message:u,duration:l.duration||3e3,action:l.action?{label:l.action.label,onPress:()=>_(l.action.onPress)}:void 0};h(g=>[...g,x]);break}case"action.delay":{const u=l.duration||1e3;await new Promise(x=>setTimeout(x,u));break}case"action.sequence":{for(const u of l.actions??[])await _(u,y);break}default:console.warn("Unknown action type:",l.type)}},N=async(f,y)=>{if(console.log("Executing intent:",f,y),!(t!=null&&t.intents))return;const l=t.intents[f];if(!l){console.warn("Intent not found:",f);return}if(Array.isArray(l.handler))for(const T of l.handler)await _(T,y);else await _(l.handler,y)},S={state:j,data:{},components:(t==null?void 0:t.components)||{},views:(t==null?void 0:t.views)||{},intents:(t==null?void 0:t.intents)||{},schema:t,executeAction:_,executeIntent:N};if(o)return i.jsxs("div",{className:"pineui-loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"400px",gap:"16px",color:"#79747E"},children:[i.jsx("div",{style:{width:"40px",height:"40px",border:"4px solid #E7E0EC",borderTop:"4px solid #6750A4",borderRadius:"50%",animation:"pineui-spin 1s linear infinite"}}),i.jsx("p",{style:{margin:0,fontSize:"14px",fontWeight:500},children:"Loading application..."}),i.jsx("style",{dangerouslySetInnerHTML:{__html:`
10
10
  @keyframes pineui-spin {
11
11
  0% { transform: rotate(0deg); }
12
12
  100% { transform: rotate(360deg); }
13
13
  }
14
- `}})]});if(d)return i.jsx("div",{className:"pineui-error",children:i.jsxs("p",{children:["Error loading schema: ",d.message]})});if(!t)return i.jsx("div",{className:"pineui-error",children:i.jsx("p",{children:"No schema provided"})});const B=f=>{h(y=>y.filter(l=>l.id!==f))},F=f=>{b(y=>({...y,[f]:{...y[f],visible:!1}}))};return i.jsx(Me,{children:i.jsxs("div",{className:"pineui-root",children:[i.jsx(V,{node:t.screen,context:S}),i.jsx(Ae,{messages:p,onDismiss:B}),i.jsx(Ie,{overlays:v,onClose:F,context:S,renderer:V})]})})};function Be(e,n,s){const t=n.split(".");let r=e;for(let o=0;o<t.length-1;o++)r[t[o]]||(r[t[o]]={}),r=r[t[o]];r[t[t.length-1]]=s}function se(e){var t,r;const n=typeof e.target=="string"?document.querySelector(e.target):e.target;if(!n){console.error("PineUI: Target element not found"),(t=e.onError)==null||t.call(e,new Error("Target element not found"));return}H.createRoot(n).render(m.createElement(ne,{schema:e.schema,schemaUrl:e.schemaUrl,baseUrl:e.baseUrl})),(r=e.onReady)==null||r.call(e)}typeof window<"u"&&(window.PineUI={render:se}),console.log("%c🍍 PineUI v0.1.5%c — Server-Driven UI for AI-Native Apps","color:#6750A4;font-weight:700;font-size:14px","color:#79747E;font-size:12px"),E.PineUI=ne,E.render=se,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
14
+ `}})]});if(d)return i.jsx("div",{className:"pineui-error",children:i.jsxs("p",{children:["Error loading schema: ",d.message]})});if(!t)return i.jsx("div",{className:"pineui-error",children:i.jsx("p",{children:"No schema provided"})});const B=f=>{h(y=>y.filter(l=>l.id!==f))},F=f=>{b(y=>({...y,[f]:{...y[f],visible:!1}}))};return i.jsx(Me,{children:i.jsxs("div",{className:"pineui-root",children:[i.jsx(V,{node:t.screen,context:S}),i.jsx(Ae,{messages:p,onDismiss:B}),i.jsx(Ie,{overlays:v,onClose:F,context:S,renderer:V})]})})};function Be(e,n,s){const t=n.split(".");let r=e;for(let o=0;o<t.length-1;o++)r[t[o]]||(r[t[o]]={}),r=r[t[o]];r[t[t.length-1]]=s}function se(e){var t,r;const n=typeof e.target=="string"?document.querySelector(e.target):e.target;if(!n){console.error("PineUI: Target element not found"),(t=e.onError)==null||t.call(e,new Error("Target element not found"));return}H.createRoot(n).render(m.createElement(ne,{schema:e.schema,schemaUrl:e.schemaUrl,baseUrl:e.baseUrl})),(r=e.onReady)==null||r.call(e)}typeof window<"u"&&(window.PineUI={render:se}),console.log("%c🍍 PineUI v0.1.6%c — Server-Driven UI for AI-Native Apps","color:#6750A4;font-weight:700;font-size:14px","color:#79747E;font-size:12px"),E.PineUI=ne,E.render=se,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pineui/react",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Server-Driven UI framework for AI-native applications. Build dynamic, multi-platform interfaces from JSON schemas.",
5
5
  "keywords": [
6
6
  "server-driven-ui",