@foris/avocado-not-front 5.2.7 → 5.2.9

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.
@@ -1,4 +1,4 @@
1
- (function(v,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("axios"),require("zustand"),require("react"),require("@foris/avocado-suite"),require("@foris/ai-agent"),require("jsonpath"),require("recharts"),require("@uiw/react-codemirror"),require("@codemirror/lang-json"),require("@codemirror/lang-markdown"),require("@codemirror/lang-sql"),require("@codemirror/lang-yaml"),require("@foris/avocado-icons")):typeof define=="function"&&define.amd?define(["exports","axios","zustand","react","@foris/avocado-suite","@foris/ai-agent","jsonpath","recharts","@uiw/react-codemirror","@codemirror/lang-json","@codemirror/lang-markdown","@codemirror/lang-sql","@codemirror/lang-yaml","@foris/avocado-icons"],z):(v=typeof globalThis<"u"?globalThis:v||self,z(v["avocado-not-front"]={},v.axios,v.zustand,v.React,v.AvocadoSuite,v.AiAgent,v.jsonpath,v.Recharts,v.ReactCodeMirror,v.CodeMirrorLangJson,v.CodeMirrorLangMarkdown,v.CodeMirrorLangSql,v.CodeMirrorLangYaml,v.AvocadoIcons))})(this,(function(v,z,ue,g,w,ht,G,A,he,At,fe,me,ye,vt){"use strict";const ft="sessionId",xe=()=>sessionStorage.getItem(ft),mt=t=>{t&&sessionStorage.setItem(ft,t)},ge=()=>{sessionStorage.removeItem(ft)},T=ue.create(()=>({})),dt=(t,e,s,a,c)=>{mt(c);const i=s==null?void 0:s.hash,l=a&&Object.keys(a).length>0?{...a}:{};T.setState(n=>{var d;return{...n,[t]:{...n[t],apiConfig:e,currentPageId:i,isLoading:!1,isModalOpen:!0,isDrawerOpen:!1,entries:l,overlay:null,pages:{...(d=n[t])==null?void 0:d.pages,[i]:{page:s}}}}})},St=(t,e,s)=>{const a=s&&Object.keys(s).length>0?{...t,...s}:t;return e.length===0?t:Object.fromEntries(Object.entries(a).filter(([c])=>!e.includes(c)))},pe=(t,e,s,a,c)=>{mt(s),T.setState(i=>{const l=i[t]??{},n=l.entries??{},d=St(n,a,c);return{...i,[t]:{...l,currentPageId:e.hash,entries:d,isLoading:!1,overlay:null,pages:{...l.pages,[e.hash]:{page:{...e}}}}}})},be=(t,e,s,a)=>{T.setState(c=>{var o;const i=c[t]??{},l=i.entries??{},n=St(l,s,a),d=(o=e.components)==null?void 0:o.some(_=>_.component==="drawer");return{...c,[t]:{...i,entries:n,overlay:e,isLoading:!1,isModalOpen:!d,isDrawerOpen:!!d}}})},yt=t=>{T.setState(e=>({...e,[t]:{...e[t],overlay:null}}))},je=t=>{var s;return((s=T.getState()[t])==null?void 0:s.overlay)??null},B=(t,e)=>{const{content:s,sessionId:a,deprecatedStateKeys:c=[],sessionState:i}=e;s.type!=="page"&&s.type!=="overlay"||(s.type==="page"?pe(t,s,a,c,i):be(t,s,c,i))},L=(t,e)=>{T.setState(s=>{var a;return{...s,[t]:{...s[t],entries:{...(a=s[t])==null?void 0:a.entries,...e}}}})},Ce=(t,e)=>{T.setState(s=>{const a=s[t];if(!a)return s;const c=a.entries??{};if(!(e in c))return s;const{[e]:i,...l}=c;return{...s,[t]:{...a,entries:l}}})},Q=(t,e)=>{T.setState(s=>({...s,[t]:{...s[t],isLoading:e}}))},xt=(t,e)=>{T.setState(s=>({...s,[t]:{...s[t],isModalOpen:e}}))},ot=(t,e)=>{T.setState(s=>({...s,[t]:{...s[t],isDrawerOpen:e}}))},Ot=(t,e)=>{T.setState(s=>{const a=s[t];return a?{...s,[t]:{...a,apiConfig:{...a.apiConfig,headers:e}}}:s})};let gt=!1,_t=[],Rt=!1;const Ne=t=>t._userFlow||null,Dt=t=>{_t.forEach(({resolve:e,reject:s})=>{t?s(t):e(void 0)}),_t=[]},we=async t=>{var a,c;const e=t==null?void 0:t.config;if(((a=t==null?void 0:t.response)==null?void 0:a.status)===401&&!e._retry){const i=Ne(e);if(i){const n=(c=T.getState()[i])==null?void 0:c.apiConfig;if(!n)return Promise.reject(t);if(n.onAuthenticationError||typeof n.headers=="function"){if(gt)return new Promise((o,_)=>{_t.push({resolve:o,reject:_})}).then(()=>z(e)).catch(o=>(console.error("[axiosInterceptors] Queued request failed:",o),Promise.reject(o)));e._retry=!0,gt=!0;try{let o;if(n.onAuthenticationError)o=await n.onAuthenticationError();else if(typeof n.headers=="function")o=n.headers();else throw new Error("No refresh handler available");return n.onAuthenticationError&&(typeof n.headers=="string"?Ot(i,JSON.stringify(o)):Ot(i,o)),e.headers||(e.headers={}),Object.assign(e.headers,o),Dt(null),z(e)}catch(o){return console.error("[axiosInterceptors] Token refresh failed:",o),console.error("[axiosInterceptors] Rejecting queued requests:",_t.length),Dt(o),Promise.reject(o)}finally{gt=!1}}else console.warn("[axiosInterceptors] No refresh handler available, rejecting request")}else console.warn("[axiosInterceptors] No userFlow found in URL:",e.url)}return Promise.reject(t)};(()=>{if(Rt){console.debug("[axiosInterceptors] Interceptors already initialized, skipping");return}console.debug("[axiosInterceptors] Initializing interceptors..."),z.interceptors.response.use(void 0,we),console.debug("[axiosInterceptors] Response error interceptor registered"),Rt=!0,console.debug("[axiosInterceptors] Interceptors initialized successfully")})();function ke(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pt={exports:{}},rt={};/**
1
+ (function(A,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("axios"),require("zustand"),require("react"),require("@foris/avocado-suite"),require("@foris/ai-agent"),require("jsonpath"),require("recharts"),require("@uiw/react-codemirror"),require("@codemirror/lang-json"),require("@codemirror/lang-markdown"),require("@codemirror/lang-sql"),require("@codemirror/lang-yaml"),require("@foris/avocado-icons")):typeof define=="function"&&define.amd?define(["exports","axios","zustand","react","@foris/avocado-suite","@foris/ai-agent","jsonpath","recharts","@uiw/react-codemirror","@codemirror/lang-json","@codemirror/lang-markdown","@codemirror/lang-sql","@codemirror/lang-yaml","@foris/avocado-icons"],z):(A=typeof globalThis<"u"?globalThis:A||self,z(A["avocado-not-front"]={},A.axios,A.zustand,A.React,A.AvocadoSuite,A.AiAgent,A.jsonpath,A.Recharts,A.ReactCodeMirror,A.CodeMirrorLangJson,A.CodeMirrorLangMarkdown,A.CodeMirrorLangSql,A.CodeMirrorLangYaml,A.AvocadoIcons))})(this,(function(A,z,he,g,N,ht,H,v,fe,At,me,ye,xe,St){"use strict";const ft="sessionId",ge=()=>sessionStorage.getItem(ft),mt=t=>{t&&sessionStorage.setItem(ft,t)},pe=()=>{sessionStorage.removeItem(ft)},T=he.create(()=>({})),_t=(t,e,s,a,r)=>{mt(r);const l=s==null?void 0:s.hash,c=a&&Object.keys(a).length>0?{...a}:{};T.setState(n=>{var _;return{...n,[t]:{...n[t],apiConfig:e,currentPageId:l,isLoading:!1,isModalOpen:!0,isDrawerOpen:!1,entries:c,overlay:null,pages:{...(_=n[t])==null?void 0:_.pages,[l]:{page:s}}}}})},Ot=(t,e,s)=>{const a=s&&Object.keys(s).length>0?{...t,...s}:t;return e.length===0?a:Object.fromEntries(Object.entries(a).filter(([r])=>!e.includes(r)))},be=(t,e,s,a,r)=>{mt(s),T.setState(l=>{const c=l[t]??{},n=c.entries??{},_=Ot(n,a,r);return{...l,[t]:{...c,currentPageId:e.hash,entries:_,isLoading:!1,overlay:null,pages:{...c.pages,[e.hash]:{page:{...e}}}}}})},je=(t,e,s,a)=>{T.setState(r=>{var i;const l=r[t]??{},c=l.entries??{},n=Ot(c,s,a),_=(i=e.components)==null?void 0:i.some(d=>d.component==="drawer");return{...r,[t]:{...l,entries:n,overlay:e,isLoading:!1,isModalOpen:!_,isDrawerOpen:!!_}}})},yt=t=>{T.setState(e=>({...e,[t]:{...e[t],overlay:null}}))},Ce=t=>{var s;return((s=T.getState()[t])==null?void 0:s.overlay)??null},K=(t,e)=>{const{content:s,sessionId:a,deprecatedStateKeys:r=[],sessionState:l}=e;s.type!=="page"&&s.type!=="overlay"||(s.type==="page"?be(t,s,a,r,l):je(t,s,r,l))},B=(t,e)=>{T.setState(s=>{var a;return{...s,[t]:{...s[t],entries:{...(a=s[t])==null?void 0:a.entries,...e}}}})},we=(t,e)=>{T.setState(s=>{const a=s[t];if(!a)return s;const r=a.entries??{};if(!(e in r))return s;const{[e]:l,...c}=r;return{...s,[t]:{...a,entries:c}}})},Q=(t,e)=>{T.setState(s=>({...s,[t]:{...s[t],isLoading:e}}))},xt=(t,e)=>{T.setState(s=>({...s,[t]:{...s[t],isModalOpen:e}}))},ot=(t,e)=>{T.setState(s=>({...s,[t]:{...s[t],isDrawerOpen:e}}))},Rt=(t,e)=>{T.setState(s=>{const a=s[t];return a?{...s,[t]:{...a,apiConfig:{...a.apiConfig,headers:e}}}:s})};let gt=!1,ut=[],Dt=!1;const Ne=t=>t._userFlow||null,Lt=t=>{ut.forEach(({resolve:e,reject:s})=>{t?s(t):e(void 0)}),ut=[]},ke=async t=>{var a,r;const e=t==null?void 0:t.config;if(((a=t==null?void 0:t.response)==null?void 0:a.status)===401&&!e._retry){const l=Ne(e);if(l){const n=(r=T.getState()[l])==null?void 0:r.apiConfig;if(!n)return Promise.reject(t);if(n.onAuthenticationError||typeof n.headers=="function"){if(gt)return new Promise((i,d)=>{ut.push({resolve:i,reject:d})}).then(()=>z(e)).catch(i=>(console.error("[axiosInterceptors] Queued request failed:",i),Promise.reject(i)));e._retry=!0,gt=!0;try{let i;if(n.onAuthenticationError)i=await n.onAuthenticationError();else if(typeof n.headers=="function")i=n.headers();else throw new Error("No refresh handler available");return n.onAuthenticationError&&(typeof n.headers=="string"?Rt(l,JSON.stringify(i)):Rt(l,i)),e.headers||(e.headers={}),Object.assign(e.headers,i),Lt(null),z(e)}catch(i){return console.error("[axiosInterceptors] Token refresh failed:",i),console.error("[axiosInterceptors] Rejecting queued requests:",ut.length),Lt(i),Promise.reject(i)}finally{gt=!1}}else console.warn("[axiosInterceptors] No refresh handler available, rejecting request")}else console.warn("[axiosInterceptors] No userFlow found in URL:",e.url)}return Promise.reject(t)};(()=>{if(Dt){console.debug("[axiosInterceptors] Interceptors already initialized, skipping");return}console.debug("[axiosInterceptors] Initializing interceptors..."),z.interceptors.response.use(void 0,ke),console.debug("[axiosInterceptors] Response error interceptor registered"),Dt=!0,console.debug("[axiosInterceptors] Interceptors initialized successfully")})();function Ee(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pt={exports:{}},rt={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,8 +6,8 @@
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 It;function Ee(){if(It)return rt;It=1;var t=g,e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,c=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(n,d,o){var _,u={},h=null,f=null;o!==void 0&&(h=""+o),d.key!==void 0&&(h=""+d.key),d.ref!==void 0&&(f=d.ref);for(_ in d)a.call(d,_)&&!i.hasOwnProperty(_)&&(u[_]=d[_]);if(n&&n.defaultProps)for(_ in d=n.defaultProps,d)u[_]===void 0&&(u[_]=d[_]);return{$$typeof:e,type:n,key:h,ref:f,props:u,_owner:c.current}}return rt.Fragment=s,rt.jsx=l,rt.jsxs=l,rt}var Lt;function Te(){return Lt||(Lt=1,pt.exports=Ee()),pt.exports}var r=Te();const Mt=t=>{if(!(t!=null&&t.content))return null;const e={...t,children:t.content,type:t.variant};return r.jsx(w.Heading,{...e})},Kt=t=>{if(!t)return null;const e={...t,children:t.content};return r.jsx(w.Text,{...e})},S=(t,e,s,a)=>{var l;const c={accordion:n=>r.jsx(Ie,{...n,userFlow:t,pageId:e}),aiChatPanel:n=>r.jsx(Le,{...n,userFlow:t,pageId:e,onResolveProps:a==null?void 0:a.aiChatPanel}),aiSummaryCard:n=>r.jsx(Ge,{...n,userFlow:t,pageId:e,onResolveProps:a==null?void 0:a.aiSummaryCard}),aiPromptCodeEditor:n=>r.jsx(Ke,{...n,userFlow:t,pageId:e}),box:n=>r.jsx(Ue,{...n,userFlow:t,pageId:e}),breadcrumbs:n=>r.jsx(qe,{...n,userFlow:t,pageId:e}),tooltip:n=>r.jsx(hs,{...n,userFlow:t,pageId:e}),textarea:n=>r.jsx(is,{...n,userFlow:t,pageId:e}),card:n=>r.jsx(Fe,{...n,userFlow:t,pageId:e}),dropdownButton:n=>r.jsx(Rn,{...n,userFlow:t,pageId:e}),menu:n=>r.jsx(Ln,{...n,userFlow:t,pageId:e}),radioGroup:n=>r.jsx(Xe,{...n,userFlow:t,pageId:e}),stepper:n=>r.jsx(Je,{...n,userFlow:t,pageId:e}),progressBar:n=>r.jsx(We,{...n,userFlow:t,pageId:e}),button:n=>r.jsx(Ye,{...n,userFlow:t,pageId:e}),cardAccordion:n=>r.jsx(Qe,{...n,userFlow:t,pageId:e}),cardNotification:n=>r.jsx(Pe,{...n,userFlow:t,pageId:e}),chart:n=>r.jsx(Zt,{...n,userFlow:t}),dataCard:n=>r.jsx(An,{...n,userFlow:t,pageId:e}),checkbox:n=>r.jsx(En,{...n,userFlow:t,pageId:e}),code:n=>r.jsx(Tn,{...n,userFlow:t,pageId:e}),divider:n=>r.jsx(Sn,{...n}),drawer:n=>r.jsx(On,{...n,userFlow:t,pageId:e}),heading:n=>Mt(n),link:n=>r.jsx(In,{...n,userFlow:t,pageId:e}),pill:n=>r.jsx(Vn,{...n}),previewerMarkdown:n=>r.jsx(zn,{...n}),modal:n=>r.jsx(Kn,{...n,userFlow:t,pageId:e}),roundButton:n=>r.jsx(Xn,{...n,userFlow:t,pageId:e}),row:n=>r.jsx(te,{...n,userFlow:t,pageId:e}),select:n=>r.jsx(Fn,{...n,userFlow:t,pageId:e}),switch:n=>r.jsx($n,{...n,userFlow:t,pageId:e}),spacing:n=>r.jsx(Pn,{...n,userFlow:t,pageId:e}),table:n=>r.jsx(as,{...n,userFlow:t,pageId:e}),tabs:n=>r.jsx(cs,{...n,userFlow:t,pageId:e}),text:n=>Kt(n),textField:n=>r.jsx(_s,{...n,userFlow:t,pageId:e}),toast:n=>r.jsx(us,{...n,userFlow:t,pageId:e})};return(l=s==null?void 0:s.filter(Boolean))==null?void 0:l.map(n=>{const d=c[n.component];return d?d({...n,userFlow:t,pageId:e}):null})};function Ae(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)}function Bt(t,e){if(!(e!=null&&e.length))return!1;for(const s of e)if(s.when==="empty"){const a=t==null?void 0:t[s.key];if(Ae(a))return!0}return!1}function H(t,e){const s=T(a=>{var c;return(c=a[t])==null?void 0:c.entries});return g.useMemo(()=>({disabled:Bt(s,e)}),[e,s])}const Z=t=>{if(!t)return{"content-type":"application/json"};if(typeof t=="function")return t();if(typeof t=="string")try{return JSON.parse(t)}catch{return{"content-type":"application/json",Authorization:t}}return t},ct=()=>new AbortController,ve=(t,e={},s={},a=!1,c)=>{const i=ct();a&&i.abort();const l=Z(e);return{call:z.get(t,{headers:{...l},params:s,signal:i.signal,_userFlow:c}),controller:i}},bt=(t,e={},s={},a={},c=!1,i)=>{const l=ct();c&&l.abort();const n=Z(e);return{call:z.post(t,s,{headers:{...n},params:a,signal:l.signal,_userFlow:i}),controller:l}},Se=(t,e={},s={},a={},c=!1,i)=>{const l=ct();c&&l.abort();const n=Z(e);return{call:z.put(t,s,{headers:{...n},params:a,signal:l.signal,_userFlow:i}),controller:l}},Oe=(t,e={},s={},a={},c=!1,i)=>{const l=ct();c&&l.abort();const n=Z(e);return{call:z.patch(t,s,{headers:{...n},params:a,signal:l.signal,_userFlow:i}),controller:l}},Re=(t,e={},s={},a={},c=!1,i)=>{const l=ct();c&&l.abort();const n=Z(e);return{call:z.delete(t,{headers:{...n},data:s,params:a,signal:l.signal,_userFlow:i}),controller:l}},Gt=()=>{let t;return{callEndpoint:async a=>{a.controller&&(t=a.controller);let c={};try{c=await a.call}catch(i){throw i}return c},cancelEndpoint:()=>{t&&t.abort()}}},Ht=async(t,e,s="",a={},c={})=>{try{const{callEndpoint:i}=Gt(),{api:l,headers:n}=t,d=xe(),o=new URLSearchParams({session_name:e});s&&o.append("hash_code",s),d&&o.append("sessionId",d);const _=`${l}/not-front/next-ui/?${o.toString()}`,u=Z(n),h=bt(_,u,a,c,!1,e);return await i(h)}catch(i){return console.error(i),Promise.reject(i)}},Ut=t=>{const e=t==null?void 0:t.toLowerCase();switch(e){case"post":case"get":case"put":case"patch":case"delete":return e;default:return"get"}},De=(t,e,s)=>{const{url:a,paginationKeys:c,params:i}=t,l=[],n=(c==null?void 0:c.page)??"page";if(l.push(`${n}=${e}`),typeof s=="string"){const _=(c==null?void 0:c.text)??"text";l.push(`${_}=${encodeURIComponent(s||"")}`)}if(i&&typeof i=="object"){const _=Object.entries(i).map(([u,h])=>`${encodeURIComponent(u)}=${encodeURIComponent(h)}`);l.push(..._)}const d=l.join("&");return d?`${a}?${d}`:a},jt=(t,e,s,a)=>{const{type:c,url:i,method:l,headers:n}=t;if(c==="rest"){const d=De(t,e,s),_={...(t==null?void 0:t.data)??{},...a??{}};return{type:"rest",url:d,method:Ut(l),headers:n,data:_}}else return{type:"graphql",url:i,method:"post",headers:n,query:t==null?void 0:t.query,variables:{...(t==null?void 0:t.variables)||{},...typeof s=="string"?{text:s}:{},page:e}}},V=()=>{const t=T(n=>n),{callEndpoint:e}=Gt(),s=async(n,d,o,_,u=!0)=>{var h;try{const f=(h=t[n])==null?void 0:h.apiConfig,y={state:{...o},triggerKey:_};return u&&Q(n,!0),await Ht(f,n,d,y)}catch(f){throw u&&Q(n,!1),console.error("[getNextUI] Error fetching next UI:",f),f}},a=(n,d)=>{const{url:o,headers:_,data:u,params:h}=n;switch(Ut(n.method)){case"post":return bt(o,_,u,{},!1,d);case"put":return Se(o,_,u,{},!1,d);case"patch":return Oe(o,_,u,{},!1,d);case"delete":return Re(o,_,u,h,!1,d);case"get":default:return ve(o,_,h,!1,d)}},c=(n,d)=>{const{url:o,headers:_}=n,u={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return bt(o,{..._,"Content-Type":"application/json"},u,{},!1,d)},i=async(n,d,o=!0)=>{var _,u;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}o&&Q(d,!0);try{let h;switch(n==null?void 0:n.type){case"rest":h=a(n,d);break;case"graphql":h=c(n,d);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await e(h)}catch(h){const f=h;return console.error("[fetchDataSource] Error:",f),{status:((_=f==null?void 0:f.response)==null?void 0:_.status)??0,data:((u=f==null?void 0:f.response)==null?void 0:u.data)??{message:f==null?void 0:f.message,code:f==null?void 0:f.code,config:f==null?void 0:f.config}}}finally{o&&Q(d,!1)}};return{getNextUI:s,fetchDataSource:i,fetchAndGetNextUI:async(n,d,o,_,u)=>{try{Q(n,!0);const h=await i(u,n,!1);return h&&await s(n,d,o,_)}catch(h){throw Q(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",h),h}}}},Vt={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},Ie=t=>{const{userFlow:e,pageId:s,responseKey:a,dependencies:c,customContent:i,actionContent:l,components:n,...d}=t,{getNextUI:o}=V(),[_,u]=g.useState(d.checkboxChecked||!1),{disabled:h}=H(e,c),f=S(e,s,n),y=l?S(e,s,l):void 0,j=i?S(e,s,i):void 0,p=g.useCallback(async b=>{var N;try{const C=b.target.checked;u(C);const k={...(N=T.getState()[e])==null?void 0:N.entries,[a]:C};if(L(e,k),d.actionType==="GO_TO_NEXT_UI"){const E=await o(e,s,k,a);E!=null&&E.data&&B(e,E==null?void 0:E.data)}}catch(C){console.error("Error in accordion checkbox action:",C),alert(JSON.stringify(C))}},[e,s,a,d.actionType,o]),m=d.disabled||h,x={...d,className:Vt.accordion,disabled:m,checkboxChecked:_,onChanceCheckbox:d.hasCheckbox?p:void 0,actionContent:y?r.jsx(r.Fragment,{children:y.map((b,N)=>r.jsx(g.Fragment,{children:b},`accordion-action-${N}`))}):void 0,customContent:j?r.jsx(r.Fragment,{children:j.map((b,N)=>r.jsx(g.Fragment,{children:b},`accordion-custom-${N}`))}):void 0,children:f?r.jsx("section",{className:Vt.accordionBody,children:f.map((b,N)=>r.jsx(g.Fragment,{children:b},`accordion-child-${N}`))}):void 0};return r.jsx(w.Accordion,{...x})},Le=t=>{const e=w.ThemeStore.useThemeStore(l=>l.theme.mode),s=t.dataSource,a=g.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,params:s==null?void 0:s.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,s==null?void 0:s.data]),c=t.locale??"en",i=g.useMemo(()=>{var n,d,o,_,u;const l={title:(n=t==null?void 0:t.translations)==null?void 0:n.title,welcomeTitle:(d=t==null?void 0:t.translations)==null?void 0:d.welcomeTitle,welcomeDescription:(o=t==null?void 0:t.translations)==null?void 0:o.welcomeDescription,placeholder:(_=t==null?void 0:t.translations)==null?void 0:_.placeholder,disclaimer:(u=t==null?void 0:t.translations)==null?void 0:u.disclaimer};return Object.fromEntries(Object.entries(l).filter(([,h])=>!!h))},[t==null?void 0:t.translations]);return g.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:a,locale:c,translations:i,initialSuggestions:t.initialSuggestions,theme:e})},[t.onResolveProps,a,c,i,t.initialSuggestions,e]),t.onResolveProps?null:r.jsx(ht.ChatPanel,{dataSource:a,locale:c,translations:i,initialSuggestions:t.initialSuggestions,theme:e})},Me={promptCodeEditor:"_promptCodeEditor_1d57s_1"},Ke=t=>{const{userFlow:e,responseKey:s,codeBlockValue:a,language:c,disabled:i,dependencies:l,dataSource:n,inputLabel:d,inputPlaceholder:o,codeBlockLabel:_}=t,u=w.ThemeStore.useThemeStore(b=>b.theme.mode),[h,f]=g.useState(a||""),{disabled:y}=H(e,l),j=i??y,p=c??"json",m={url:(n==null?void 0:n.url)||"",method:(n==null?void 0:n.method)||"post",headers:n==null?void 0:n.headers,body:n==null?void 0:n.data},x=b=>{f(b);const N={[s]:b};L(e,N)};return g.useEffect(()=>{a!==void 0&&a!==h&&f(a)},[a]),r.jsx("section",{className:Me.promptCodeEditor,children:r.jsx(ht.PromptCodeEditor,{themeMode:u,requestConfig:m,language:p,disabled:j,inputLabel:d,inputPlaceholder:o,codeBlockLabel:_,codeBlockValue:h,onCodeChange:x})})},Be={summaryCard:"_summaryCard_jva4h_1"},Ge=t=>{const e=t.dataSource,s=g.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,body:e==null?void 0:e.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,e==null?void 0:e.data]),a=t.locale??"en",c=g.useMemo(()=>{var l,n,d;const i={title:(l=t==null?void 0:t.translations)==null?void 0:l.title,loading:(n=t==null?void 0:t.translations)==null?void 0:n.loading,noData:(d=t==null?void 0:t.translations)==null?void 0:d.noData};return Object.fromEntries(Object.entries(i).filter(([,o])=>!!o))},[t==null?void 0:t.translations]);return g.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:s,locale:a,translations:c})},[t.onResolveProps,s,a,c]),t.onResolveProps?null:r.jsx("section",{className:Be.summaryCard,children:r.jsx(ht.SummaryCard,{dataSource:s,locale:a,translations:c})})},zt={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},He=({inputs:t})=>r.jsx("section",{className:zt.body,children:r.jsx("div",{className:zt.body_content,children:t.map((e,s)=>r.jsx(g.Fragment,{children:e},s))})}),Xt={boxNotFront:"_boxNotFront_67q2e_1",slotStack:"_slotStack_67q2e_5"},Ue=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,content:l}=t,n=w.ThemeStore.useThemeStore(_=>_.theme.mode)==="dark",d=S(e,s,l!=null&&l.length?l:null),o=d&&d.length>0?r.jsx("div",{className:Xt.slotStack,children:d.map((_,u)=>r.jsx(g.Fragment,{children:_},`box-${c}-${u}`))}):null;return r.jsx(w.Box,{className:Xt.boxNotFront,darkMode:n,children:o})};var Ct={exports:{}};/*!
9
+ */var It;function Te(){if(It)return rt;It=1;var t=g,e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(n,_,i){var d,u={},h=null,f=null;i!==void 0&&(h=""+i),_.key!==void 0&&(h=""+_.key),_.ref!==void 0&&(f=_.ref);for(d in _)a.call(_,d)&&!l.hasOwnProperty(d)&&(u[d]=_[d]);if(n&&n.defaultProps)for(d in _=n.defaultProps,_)u[d]===void 0&&(u[d]=_[d]);return{$$typeof:e,type:n,key:h,ref:f,props:u,_owner:r.current}}return rt.Fragment=s,rt.jsx=c,rt.jsxs=c,rt}var Mt;function ve(){return Mt||(Mt=1,pt.exports=Te()),pt.exports}var o=ve();const Bt=t=>{if(!(t!=null&&t.content))return null;const e={...t,children:t.content,type:t.variant};return o.jsx(N.Heading,{...e})},Kt=t=>{if(!t)return null;const e={...t,children:t.content};return o.jsx(N.Text,{...e})},S=(t,e,s,a)=>{var c;const r={accordion:n=>o.jsx(Ie,{...n,userFlow:t,pageId:e}),aiChatPanel:n=>o.jsx(Me,{...n,userFlow:t,pageId:e,onResolveProps:a==null?void 0:a.aiChatPanel}),aiSummaryCard:n=>o.jsx(He,{...n,userFlow:t,pageId:e,onResolveProps:a==null?void 0:a.aiSummaryCard}),aiPromptCodeEditor:n=>o.jsx(Ke,{...n,userFlow:t,pageId:e}),box:n=>o.jsx(Ue,{...n,userFlow:t,pageId:e}),breadcrumbs:n=>o.jsx(Ye,{...n,userFlow:t,pageId:e}),tooltip:n=>o.jsx(ps,{...n,userFlow:t,pageId:e}),textarea:n=>o.jsx(ms,{...n,userFlow:t,pageId:e}),card:n=>o.jsx(Pe,{...n,userFlow:t,pageId:e}),dropdownButton:n=>o.jsx(Kn,{...n,userFlow:t,pageId:e}),menu:n=>o.jsx(Vn,{...n,userFlow:t,pageId:e}),radioGroup:n=>o.jsx(Je,{...n,userFlow:t,pageId:e}),stepper:n=>o.jsx(We,{...n,userFlow:t,pageId:e}),progressBar:n=>o.jsx(qe,{...n,userFlow:t,pageId:e}),button:n=>o.jsx(Qe,{...n,userFlow:t,pageId:e}),cardAccordion:n=>o.jsx(Ze,{...n,userFlow:t,pageId:e}),cardNotification:n=>o.jsx($e,{...n,userFlow:t,pageId:e}),chart:n=>o.jsx(Ft,{...n,userFlow:t}),dataCard:n=>o.jsx(Ln,{...n,userFlow:t,pageId:e}),checkbox:n=>o.jsx(Tn,{...n,userFlow:t,pageId:e}),code:n=>o.jsx(vn,{...n,userFlow:t,pageId:e}),divider:n=>o.jsx(Mn,{...n}),drawer:n=>o.jsx(Bn,{...n,userFlow:t,pageId:e}),heading:n=>Bt(n),link:n=>o.jsx(Hn,{...n,userFlow:t,pageId:e}),pill:n=>o.jsx(Yn,{...n}),previewerMarkdown:n=>o.jsx(Qn,{...n}),modal:n=>o.jsx(zn,{...n,userFlow:t,pageId:e}),roundButton:n=>o.jsx(Zn,{...n,userFlow:t,pageId:e}),row:n=>o.jsx(te,{...n,userFlow:t,pageId:e}),select:n=>o.jsx(ss,{...n,userFlow:t,pageId:e}),switch:n=>o.jsx(os,{...n,userFlow:t,pageId:e}),spacing:n=>o.jsx(as,{...n,userFlow:t,pageId:e}),table:n=>o.jsx(ds,{...n,userFlow:t,pageId:e}),tabs:n=>o.jsx(hs,{...n,userFlow:t,pageId:e}),text:n=>Kt(n),textField:n=>o.jsx(xs,{...n,userFlow:t,pageId:e}),toast:n=>o.jsx(gs,{...n,userFlow:t,pageId:e})};return(c=s==null?void 0:s.filter(Boolean))==null?void 0:c.map(n=>{const _=r[n.component];return _?_({...n,userFlow:t,pageId:e}):null})};function Ae(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)}function Gt(t,e){if(!(e!=null&&e.length))return!1;for(const s of e)if(s.when==="empty"){const a=t==null?void 0:t[s.key];if(Ae(a))return!0}return!1}function G(t,e){const s=T(a=>{var r;return(r=a[t])==null?void 0:r.entries});return g.useMemo(()=>({disabled:Gt(s,e)}),[e,s])}const Z=t=>{if(!t)return{"content-type":"application/json"};if(typeof t=="function")return t();if(typeof t=="string")try{return JSON.parse(t)}catch{return{"content-type":"application/json",Authorization:t}}return t},ct=()=>new AbortController,Se=(t,e={},s={},a=!1,r)=>{const l=ct();a&&l.abort();const c=Z(e);return{call:z.get(t,{headers:{...c},params:s,signal:l.signal,_userFlow:r}),controller:l}},bt=(t,e={},s={},a={},r=!1,l)=>{const c=ct();r&&c.abort();const n=Z(e);return{call:z.post(t,s,{headers:{...n},params:a,signal:c.signal,_userFlow:l}),controller:c}},Oe=(t,e={},s={},a={},r=!1,l)=>{const c=ct();r&&c.abort();const n=Z(e);return{call:z.put(t,s,{headers:{...n},params:a,signal:c.signal,_userFlow:l}),controller:c}},Re=(t,e={},s={},a={},r=!1,l)=>{const c=ct();r&&c.abort();const n=Z(e);return{call:z.patch(t,s,{headers:{...n},params:a,signal:c.signal,_userFlow:l}),controller:c}},De=(t,e={},s={},a={},r=!1,l)=>{const c=ct();r&&c.abort();const n=Z(e);return{call:z.delete(t,{headers:{...n},data:s,params:a,signal:c.signal,_userFlow:l}),controller:c}},Ht=()=>{let t;return{callEndpoint:async a=>{a.controller&&(t=a.controller);let r={};try{r=await a.call}catch(l){throw l}return r},cancelEndpoint:()=>{t&&t.abort()}}},Vt=async(t,e,s="",a={},r={})=>{try{const{callEndpoint:l}=Ht(),{api:c,headers:n}=t,_=ge(),i=new URLSearchParams({session_name:e});s&&i.append("hash_code",s),_&&i.append("sessionId",_);const d=`${c}/not-front/next-ui/?${i.toString()}`,u=Z(n),h=bt(d,u,a,r,!1,e);return await l(h)}catch(l){return console.error(l),Promise.reject(l)}},Ut=t=>{const e=t==null?void 0:t.toLowerCase();switch(e){case"post":case"get":case"put":case"patch":case"delete":return e;default:return"get"}},Le=(t,e,s)=>{const{url:a,paginationKeys:r,params:l}=t,c=[],n=(r==null?void 0:r.page)??"page";if(c.push(`${n}=${e}`),typeof s=="string"){const d=(r==null?void 0:r.text)??"text";c.push(`${d}=${encodeURIComponent(s||"")}`)}if(l&&typeof l=="object"){const d=Object.entries(l).map(([u,h])=>`${encodeURIComponent(u)}=${encodeURIComponent(h)}`);c.push(...d)}const _=c.join("&");return _?`${a}?${_}`:a},jt=(t,e,s,a)=>{const{type:r,url:l,method:c,headers:n}=t;if(r==="rest"){const _=Le(t,e,s),d={...(t==null?void 0:t.data)??{},...a??{}};return{type:"rest",url:_,method:Ut(c),headers:n,data:d}}else return{type:"graphql",url:l,method:"post",headers:n,query:t==null?void 0:t.query,variables:{...(t==null?void 0:t.variables)||{},...typeof s=="string"?{text:s}:{},page:e}}},U=()=>{const t=T(n=>n),{callEndpoint:e}=Ht(),s=async(n,_,i,d,u=!0)=>{var h;try{const f=(h=t[n])==null?void 0:h.apiConfig,y={state:{...i},triggerKey:d};return u&&Q(n,!0),await Vt(f,n,_,y)}catch(f){throw u&&Q(n,!1),console.error("[getNextUI] Error fetching next UI:",f),f}},a=(n,_)=>{const{url:i,headers:d,data:u,params:h}=n;switch(Ut(n.method)){case"post":return bt(i,d,u,{},!1,_);case"put":return Oe(i,d,u,{},!1,_);case"patch":return Re(i,d,u,{},!1,_);case"delete":return De(i,d,u,h,!1,_);case"get":default:return Se(i,d,h,!1,_)}},r=(n,_)=>{const{url:i,headers:d}=n,u={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return bt(i,{...d,"Content-Type":"application/json"},u,{},!1,_)},l=async(n,_,i=!0)=>{var d,u;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}i&&Q(_,!0);try{let h;switch(n==null?void 0:n.type){case"rest":h=a(n,_);break;case"graphql":h=r(n,_);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await e(h)}catch(h){const f=h;return console.error("[fetchDataSource] Error:",f),{status:((d=f==null?void 0:f.response)==null?void 0:d.status)??0,data:((u=f==null?void 0:f.response)==null?void 0:u.data)??{message:f==null?void 0:f.message,code:f==null?void 0:f.code,config:f==null?void 0:f.config}}}finally{i&&Q(_,!1)}};return{getNextUI:s,fetchDataSource:l,fetchAndGetNextUI:async(n,_,i,d,u)=>{try{Q(n,!0);const h=await l(u,n,!1);return h&&await s(n,_,i,d)}catch(h){throw Q(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",h),h}}}},zt={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},Ie=t=>{const{userFlow:e,pageId:s,responseKey:a,dependencies:r,customContent:l,actionContent:c,components:n,..._}=t,{getNextUI:i}=U(),[d,u]=g.useState(_.checkboxChecked||!1),{disabled:h}=G(e,r),f=S(e,s,n),y=c?S(e,s,c):void 0,j=l?S(e,s,l):void 0,b=g.useCallback(async p=>{var w;try{const C=p.target.checked;u(C);const k={...(w=T.getState()[e])==null?void 0:w.entries,[a]:C};if(B(e,k),_.actionType==="GO_TO_NEXT_UI"){const E=await i(e,s,k,a);E!=null&&E.data&&K(e,E==null?void 0:E.data)}}catch(C){console.error("Error in accordion checkbox action:",C),alert(JSON.stringify(C))}},[e,s,a,_.actionType,i]),m=_.disabled||h,x={..._,className:zt.accordion,disabled:m,checkboxChecked:d,onChanceCheckbox:_.hasCheckbox?b:void 0,actionContent:y?o.jsx(o.Fragment,{children:y.map((p,w)=>o.jsx(g.Fragment,{children:p},`accordion-action-${w}`))}):void 0,customContent:j?o.jsx(o.Fragment,{children:j.map((p,w)=>o.jsx(g.Fragment,{children:p},`accordion-custom-${w}`))}):void 0,children:f?o.jsx("section",{className:zt.accordionBody,children:f.map((p,w)=>o.jsx(g.Fragment,{children:p},`accordion-child-${w}`))}):void 0};return o.jsx(N.Accordion,{...x})},Me=t=>{const e=N.ThemeStore.useThemeStore(c=>c.theme.mode),s=t.dataSource,a=g.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,params:s==null?void 0:s.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,s==null?void 0:s.data]),r=t.locale??"en",l=g.useMemo(()=>{var n,_,i,d,u;const c={title:(n=t==null?void 0:t.translations)==null?void 0:n.title,welcomeTitle:(_=t==null?void 0:t.translations)==null?void 0:_.welcomeTitle,welcomeDescription:(i=t==null?void 0:t.translations)==null?void 0:i.welcomeDescription,placeholder:(d=t==null?void 0:t.translations)==null?void 0:d.placeholder,disclaimer:(u=t==null?void 0:t.translations)==null?void 0:u.disclaimer};return Object.fromEntries(Object.entries(c).filter(([,h])=>!!h))},[t==null?void 0:t.translations]);return g.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:a,locale:r,translations:l,initialSuggestions:t.initialSuggestions,theme:e})},[t.onResolveProps,a,r,l,t.initialSuggestions,e]),t.onResolveProps?null:o.jsx(ht.ChatPanel,{dataSource:a,locale:r,translations:l,initialSuggestions:t.initialSuggestions,theme:e})},Be={promptCodeEditor:"_promptCodeEditor_1d57s_1"},Ke=t=>{const{userFlow:e,responseKey:s,codeBlockValue:a,language:r,disabled:l,dependencies:c,dataSource:n,inputLabel:_,inputPlaceholder:i,codeBlockLabel:d}=t,u=N.ThemeStore.useThemeStore(p=>p.theme.mode),[h,f]=g.useState(a||""),{disabled:y}=G(e,c),j=l??y,b=r??"json",m={url:(n==null?void 0:n.url)||"",method:(n==null?void 0:n.method)||"post",headers:n==null?void 0:n.headers,body:n==null?void 0:n.data},x=p=>{f(p);const w={[s]:p};B(e,w)};return g.useEffect(()=>{a!==void 0&&a!==h&&f(a)},[a]),o.jsx("section",{className:Be.promptCodeEditor,children:o.jsx(ht.PromptCodeEditor,{themeMode:u,requestConfig:m,language:b,disabled:j,inputLabel:_,inputPlaceholder:i,codeBlockLabel:d,codeBlockValue:h,onCodeChange:x})})},Ge={summaryCard:"_summaryCard_jva4h_1"},He=t=>{const e=t.dataSource,s=g.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,body:e==null?void 0:e.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,e==null?void 0:e.data]),a=t.locale??"en",r=g.useMemo(()=>{var c,n,_;const l={title:(c=t==null?void 0:t.translations)==null?void 0:c.title,loading:(n=t==null?void 0:t.translations)==null?void 0:n.loading,noData:(_=t==null?void 0:t.translations)==null?void 0:_.noData};return Object.fromEntries(Object.entries(l).filter(([,i])=>!!i))},[t==null?void 0:t.translations]);return g.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:s,locale:a,translations:r})},[t.onResolveProps,s,a,r]),t.onResolveProps?null:o.jsx("section",{className:Ge.summaryCard,children:o.jsx(ht.SummaryCard,{dataSource:s,locale:a,translations:r})})},Xt={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},Ve=({inputs:t})=>o.jsx("section",{className:Xt.body,children:o.jsx("div",{className:Xt.body_content,children:t.map((e,s)=>o.jsx(g.Fragment,{children:e},s))})}),Jt={boxNotFront:"_boxNotFront_67q2e_1",slotStack:"_slotStack_67q2e_5"},Ue=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,content:c}=t,n=N.ThemeStore.useThemeStore(d=>d.theme.mode)==="dark",_=S(e,s,c!=null&&c.length?c:null),i=_&&_.length>0?o.jsx("div",{className:Jt.slotStack,children:_.map((d,u)=>o.jsx(g.Fragment,{children:d},`box-${r}-${u}`))}):null;return o.jsx(N.Box,{className:Jt.boxNotFront,darkMode:n,children:i})};var Ct={exports:{}};/*!
10
10
  Copyright (c) 2018 Jed Watson.
11
11
  Licensed under the MIT License (MIT), see
12
12
  http://jedwatson.github.io/classnames
13
- */var Jt;function Ve(){return Jt||(Jt=1,(function(t){(function(){var e={}.hasOwnProperty;function s(){for(var a=[],c=0;c<arguments.length;c++){var i=arguments[c];if(i){var l=typeof i;if(l==="string"||l==="number")a.push(i);else if(Array.isArray(i)){if(i.length){var n=s.apply(null,i);n&&a.push(n)}}else if(l==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){a.push(i.toString());continue}for(var d in i)e.call(i,d)&&i[d]&&a.push(d)}}}return a.join(" ")}t.exports?(s.default=s,t.exports=s):window.classNames=s})()})(Ct)),Ct.exports}var ze=Ve();const F=ke(ze),P={fieldset:"_fieldset_1xrth_1",fieldsetColumn:"_fieldsetColumn_1xrth_8",legend:"_legend_1xrth_14",options:"_options_1xrth_20",optionsRow:"_optionsRow_1xrth_25",optionsColumn:"_optionsColumn_1xrth_36"},Xe=t=>{const{userFlow:e,pageId:s,responseKey:a,label:c,value:i,required:l,actionType:n,dependencies:d,direction:o,items:_}=t,u=o==="column"?"column":"row",{getNextUI:h}=V(),{disabled:f}=H(e,d),y=T(b=>{var N,C;return(C=(N=b[e])==null?void 0:N.entries)==null?void 0:C[a]}),j=y!=null?String(y):i??"",p=f,m=g.useMemo(()=>c?l?`${c} *`:c:null,[c,l]),x=g.useCallback(async b=>{var N;if(!p)try{const C={...(N=T.getState()[e])==null?void 0:N.entries,[a]:b};if(L(e,C),n==="GO_TO_NEXT_UI"||n==="GO_TO_NEXT_UI_WITHOUT_LOADING"){const R=await h(e,s,C,a,n==="GO_TO_NEXT_UI");R!=null&&R.data&&B(e,R==null?void 0:R.data)}}catch(C){alert(JSON.stringify(C))}},[n,h,p,s,a,e]);return r.jsxs("fieldset",{className:F(P.fieldset,u==="column"&&P.fieldsetColumn),children:[m?r.jsx("legend",{className:P.legend,children:m}):null,r.jsx("div",{className:F(P.options,u==="column"?P.optionsColumn:P.optionsRow),children:_.map(b=>r.jsx(w.RadioButton,{name:a,value:b.value,checked:j===b.value,disabled:p||b.disabled,labelRight:b.label,onChange:()=>{x(b.value)}},b.value))})]})},Je=({userFlow:t,pageId:e,component:s,hash:a,responseKey:c,items:i,itemActive:l,darkMode:n})=>r.jsx(w.Stepper,{items:i,itemActive:l,darkMode:n}),We=({userFlow:t,pageId:e,component:s,hash:a,responseKey:c,total:i,done:l,inProgress:n})=>r.jsx(w.ProgressBar,{total:i,done:l,inProgress:n}),qe=({userFlow:t,items:e,responseKey:s})=>{const{getNextUI:a}=V(),c=g.useCallback(async({actionType:l,hashCode:n,redirectUrl:d})=>{var o;try{switch(l){case"GO_TO_NEXT_UI":const _=await a(t,n,{...(o=T.getState()[t])==null?void 0:o.entries},s);_!=null&&_.data&&B(t,_==null?void 0:_.data);break;case"REDIRECT":d?window.location.href=d:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(_){alert(JSON.stringify(_))}},[]),i=g.useMemo(()=>e==null?void 0:e.map(l=>({title:l==null?void 0:l.title,component:r.jsx("div",{onClick:()=>c(l)})})),[]);return r.jsx(w.Breadcrumbs,{items:i})};function ut(t,e){const{getNextUI:s,fetchDataSource:a,fetchAndGetNextUI:c}=V();return g.useCallback(async i=>{var h,f,y,j;const{responseKey:l,actionType:n,dataSource:d,redirectUrl:o,dependencies:_}=i,u=(h=T.getState()[t])==null?void 0:h.entries;if(!Bt(u,_))try{const p={...(f=T.getState()[t])==null?void 0:f.entries,[l]:{status:200}};switch(L(t,p),n){case"CLOSE_MODAL":xt(t,!1);break;case"CLOSE_DRAWER":ot(t,!1);break;case"OPEN_DRAWER":ot(t,!0);break;case"GO_TO_NEXT_UI":{const m=await s(t,e,p,l);m!=null&&m.data&&B(t,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await c(t,e,p,l,d);m!=null&&m.data&&B(t,m==null?void 0:m.data);break}case"FETCH_DATA_SOURCE":{const m=await a(d,t,!1);L(t,{[l]:{status:m==null?void 0:m.status,content:m==null?void 0:m.data}});break}case"GET_DATA_SOURCE":{const m=await s(t,e,p,l),x=(y=m==null?void 0:m.data)==null?void 0:y.content;if((x==null?void 0:x.type)!=="fetch")break;const b=x==null?void 0:x.dataSource,N=await a(b,t,!1),C={...(j=T.getState()[t])==null?void 0:j.entries,[l]:{status:N==null?void 0:N.status,content:N==null?void 0:N.data}};L(t,C);const k=await s(t,e,C,l);k!=null&&k.data&&B(t,k==null?void 0:k.data);break}case"REDIRECT":o?window.location.href=o:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${n}`)}}catch(p){alert(JSON.stringify(p))}},[c,a,s,e,t])}const Ye=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:c,label:i,content:l,dataSource:n,redirectUrl:d,dependencies:o,onClick:_,...u}=t,h=ut(e,s),{disabled:f}=H(e,o),y={...u,children:l??i},j=(y==null?void 0:y.disabled)??f,[p,m]=g.useState(!1),x=g.useRef(!1),b=g.useCallback(async()=>{if(x.current)return;const N=c==="FETCH_DATA_SOURCE";N&&(x.current=!0,m(!0));try{await h({responseKey:a,actionType:c,dataSource:n,redirectUrl:d,dependencies:o})}catch(C){console.error("[ButtonNotFront] Action failed:",C)}finally{N&&(x.current=!1,m(!1))}},[c,n,o,d,a,h]);return r.jsx(w.Button,{...y,loading:y.loading||p,disabled:j,onClick:()=>!j&&!p&&(_??b)()})},Nt={slotStack:"_slotStack_12u4t_5"},Qe=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,dependencies:l,content:n,actionContent:d,...o}=t,{disabled:_}=H(e,l),u=S(e,s,n&&n.length>0?n:null),h=S(e,s,d&&d.length>0?d:null),f=u&&u.length>0?r.jsx("div",{className:Nt.slotStack,children:u.map((p,m)=>r.jsx(g.Fragment,{children:p},`card-accordion-body-${c}-${m}`))}):void 0,y=h&&h.length>0?r.jsx("div",{className:Nt.slotStack,children:h.map((p,m)=>r.jsx(g.Fragment,{children:p},`card-accordion-actions-${c}-${m}`))}):void 0,j=o.disabled||_;return r.jsx(w.CardAccordion,{...o,disabled:j,actionContent:y,children:f??null})},Ze={slotStack:"_slotStack_ivk5b_1"},Fe=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,content:l,colorId:n,disabled:d,actionType:o,dataSource:_,redirectUrl:u,dependencies:h}=t,{getNextUI:f,fetchDataSource:y,fetchAndGetNextUI:j}=V(),{disabled:p}=H(e,h),m=d??p,x=S(e,s,l&&l.length>0?l:null),b=x&&x.length>0?r.jsx("div",{className:Ze.slotStack,children:x.map((C,k)=>r.jsx(g.Fragment,{children:C},`card-body-${c}-${k}`))}):null,N=g.useCallback(async()=>{var C,k,E;if(!(!o||m))try{const R={...(C=T.getState()[e])==null?void 0:C.entries,[i]:{status:200}};switch(L(e,R),o){case"CLOSE_MODAL":xt(e,!1);break;case"CLOSE_DRAWER":ot(e,!1);break;case"OPEN_DRAWER":ot(e,!0);break;case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const K=await f(e,s,R,i,o==="GO_TO_NEXT_UI");K!=null&&K.data&&B(e,K==null?void 0:K.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const M=await j(e,s,R,i,_);M!=null&&M.data&&B(e,M==null?void 0:M.data);break}case"GET_DATA_SOURCE":{const M=await f(e,s,R,i),K=(k=M==null?void 0:M.data)==null?void 0:k.content;if((K==null?void 0:K.type)!=="fetch")break;const st=K==null?void 0:K.dataSource,X=await y(st,e,!1),D={...(E=T.getState()[e])==null?void 0:E.entries,[i]:{status:X==null?void 0:X.status,content:X==null?void 0:X.data}};L(e,D);const U=await f(e,s,D,i);U!=null&&U.data&&B(e,U==null?void 0:U.data);break}case"REDIRECT":u&&(window.location.href=u);break;default:console.warn(`Unhandled card actionType: ${o}`)}}catch(R){alert(JSON.stringify(R))}},[o,_,m,j,y,f,s,u,i,e]);return r.jsx(w.Card,{colorId:n,disabled:m,onClick:o&&!m?()=>void N():void 0,children:b})},Pe=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,content:l,description:n,...d}=t,o=Array.isArray(l),_=S(e,s,o&&l.length>0?l:null);let u;return _&&_.length>0?u=r.jsxs("div",{className:Nt.slotStack,children:[n?r.jsx(w.Text,{type:"sm",children:n}):null,_.map((h,f)=>r.jsx(g.Fragment,{children:h},`card-notification-body-${c}-${f}`))]}):u=(typeof l=="string"?l:void 0)??n,r.jsx(w.CardNotification,{...d,children:u})},wt=t=>Array.isArray(t)?t:typeof t=="object"?JSON.stringify(t):t,$e=(t,e)=>{if(!e||t==null)return null;const{extractionJsonPath:s,injectionJsonPath:a}=e,c=G.value(t,s);if(c==null)return null;try{const i={};return G.value(i,a,c),i}catch(i){return console.warn("[buildCursorPayload] invalid injectionJsonPath:",a,i),null}},Wt=(t,e,s,a)=>{const c=G.query(t,e),i=c==null?void 0:c.map(_=>{var u,h;if(s){const f={};for(const[y,j]of Object.entries(s))if(typeof j=="object"&&"path"in j){const p=j,m=(u=G.query(_,p.path))==null?void 0:u[0];p.translations&&String(m)in p.translations?f[y]=wt(p.translations[String(m)]):f[y]=wt(m)}else{const p=j;f[y]=wt((h=G.query(_,p))==null?void 0:h[0])}return f}else return _}),l=G.value(t,(a==null?void 0:a.size)??"$.meta.size")??c.length,n=G.value(t,(a==null?void 0:a.total)??"$.meta.total")??0,d=a!=null&&a.hasMore?!!G.value(t,a.hasMore):void 0,o={size:l,total:n,totalPages:a!=null&&a.totalPages?G.value(t,(a==null?void 0:a.totalPages)??"$.meta.totalPages"):l>0?Math.ceil(n/l):0,...d!==void 0?{hasMore:d}:{}};return{items:i,pagination:o}},$=({width:t,height:e,layout:s,data:a,Chart:c,children:i})=>{const l=e??et,n=s?{layout:s}:{};return t?r.jsx(c,{width:t,height:l,data:a,...n,children:i}):r.jsx(A.ResponsiveContainer,{width:"100%",height:l,children:r.jsx(c,{data:a,...n,children:i})})},J=({withPadding:t=!1})=>{const e=s=>r.jsx("span",{style:{color:O.labelColor},children:s});return r.jsx(A.Legend,{formatter:e,wrapperStyle:{fontSize:O.fontSize,fontFamily:O.fontFamily,padding:t?"1rem 0":"0"}})},tn=({active:t,payload:e,label:s,tooltipKey:a,tooltipCoverage:c})=>{var _,u;if(!t||!e||!e.length)return null;const i={backgroundColor:O.tooltipBg,borderRadius:O.tooltipBorderRadius,color:O.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(a){const h=(_=e[0])==null?void 0:_.payload;if(h&&h[a]!==void 0&&h[a]!==null)return r.jsx("div",{style:i,children:r.jsx("p",{style:{margin:0},children:h[a]})})}const l=(u=e[0])==null?void 0:u.payload,n=(c==null?void 0:c.label)??"Cobertura",d=c?l==null?void 0:l[c.denominatorKey]:void 0,o=c&&d!==void 0&&d!==null&&d>0;return r.jsxs("div",{style:i,children:[r.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:s}),e.map((h,f)=>r.jsx("p",{style:{margin:"2px 0",color:h.color},children:`${h.name}: ${h.value}`},f)),o&&r.jsx("p",{style:{margin:"2px 0"},children:`${n}: ${Math.round(l[c.numeratorKey]/d*100)}%`})]})},W=({tooltipKey:t,tooltipCoverage:e,defaultIndex:s,hideContent:a=!1}={})=>r.jsx(A.Tooltip,{defaultIndex:s,cursor:a?!1:void 0,content:a?()=>null:c=>r.jsx(tn,{...c,tooltipKey:t,tooltipCoverage:e})}),tt=({dataKey:t,hide:e=!1,type:s})=>r.jsx(A.XAxis,{...t?{dataKey:t}:{},...s?{type:s}:{},hide:e,tick:{fill:O.labelColor,fontSize:O.fontSize}}),Y=({type:t,dataKey:e,width:s,yAxisId:a,orientation:c}={})=>r.jsx(A.YAxis,{...t?{type:t}:{},...e?{dataKey:e}:{},...s!==void 0?{width:s}:{},...a?{yAxisId:a}:{},...c?{orientation:c}:{},tick:{fill:O.labelColor,fontSize:O.fontSize},tickMargin:4}),en=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:c,width:i}=t;return r.jsxs($,{width:i,data:e,Chart:A.AreaChart,children:[r.jsx(A.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(tt,{dataKey:s}),r.jsx(Y,{}),r.jsx(W,{tooltipKey:c}),r.jsx(J,{}),a.map((l,n)=>r.jsx(A.Area,{type:"monotone",dataKey:l,stroke:I[n%I.length],fill:I[n%I.length]},l))]})},nn=t=>{const{data:e,yKeys:s,xKey:a,tooltipKey:c,width:i}=t;return r.jsxs($,{width:i,data:e,Chart:A.BarChart,children:[r.jsx(A.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(tt,{dataKey:a}),r.jsx(Y,{}),r.jsx(W,{tooltipKey:c}),r.jsx(J,{}),s.map((l,n)=>r.jsx(A.Bar,{dataKey:l,fill:I[n%I.length]},l))]})};var qt={NODE_ENV:"production"};const sn=(t,e)=>{if(e!=null&&e.length)return e;const s=[...new Set(t.map(a=>a.yAxisId).filter(a=>!!a))];return s.length===0?[]:s.map((a,c)=>({id:a,orientation:c===1?"right":"left"}))},an=(t,e)=>{!t.type&&qt.NODE_ENV;const s=t.color??I[e%I.length],a=t.label??t.key,c=t.yAxisId?{yAxisId:t.yAxisId}:{};switch(t.type){case"area":return r.jsx(A.Area,{dataKey:t.key,name:a,type:"monotone",fill:s,stroke:s,fillOpacity:.3,...c},t.key);case"line":return r.jsx(A.Line,{dataKey:t.key,name:a,type:"monotone",stroke:s,strokeWidth:2,dot:!1,...c},t.key);case"bar":return r.jsx(A.Bar,{dataKey:t.key,name:a,fill:s,stackId:t.stackId,barSize:t.barSize,...c},t.key);default:return null}},on=t=>{const{data:e,xKey:s,series:a=[],tooltipKey:c,width:i,showLegend:l=!0,yAxes:n}=t;!a.length&&qt.NODE_ENV;const d=sn(a,n);return r.jsxs($,{width:i,data:e,Chart:A.ComposedChart,children:[r.jsx(A.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(tt,{dataKey:s}),d.length>0?d.map(o=>r.jsx(Y,{yAxisId:o.id,orientation:o.orientation},o.id)):r.jsx(Y,{}),r.jsx(W,{tooltipKey:c}),l&&r.jsx(J,{}),a.map((o,_)=>an(o,_))]})},rn="55%",cn=120,ln=t=>e=>{const s=Math.PI/180,{cx:a=0,cy:c=0,midAngle:i=0,innerRadius:l=0,outerRadius:n=0,startAngle:d=0,endAngle:o=0,fill:_=I[0],payload:u,percent:h=0,value:f=0}=e,y=Math.sin(-s*i),j=Math.cos(-s*i),p=a+(n+10)*j,m=c+(n+10)*y,x=a+(n+30)*j,b=c+(n+30)*y,N=x+(j>=0?1:-1)*22,C=b,k=j>=0?"start":"end",E=u,R=String((E==null?void 0:E[t])??"");return r.jsxs("g",{children:[r.jsx("text",{x:a,y:c,dy:8,textAnchor:"middle",fill:O.labelColor,fontSize:O.fontSize+2,fontFamily:O.fontFamily,children:R}),r.jsx(A.Sector,{cx:a,cy:c,innerRadius:l,outerRadius:n,startAngle:d,endAngle:o,fill:_}),r.jsx(A.Sector,{cx:a,cy:c,startAngle:d,endAngle:o,innerRadius:n+6,outerRadius:n+10,fill:_}),r.jsx("path",{d:`M${p},${m}L${x},${b}L${N},${C}`,stroke:_,fill:"none"}),r.jsx("circle",{cx:N,cy:C,r:2,fill:_,stroke:"none"}),r.jsx("text",{x:N+(j>=0?1:-1)*12,y:C,textAnchor:k,fill:O.labelColor,fontSize:O.fontSize+2,fontFamily:O.fontFamily,children:f}),r.jsx("text",{x:N+(j>=0?1:-1)*12,y:C,dy:18,textAnchor:k,fill:O.labelColorMuted,fontSize:O.fontSize,fontFamily:O.fontFamily,children:`(${(h*100).toFixed(0)}%)`})]})},dn=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:c,innerRadius:i=rn,outerRadius:l=cn,activeShape:n=!0,defaultIndex:d,showLegend:o=!0}=t,_=a[0];return r.jsx(A.ResponsiveContainer,{width:"100%",height:et,children:r.jsxs(A.PieChart,{children:[r.jsx(W,{tooltipKey:n?void 0:c,defaultIndex:d,hideContent:n}),o&&r.jsx(J,{}),r.jsx(A.Pie,{data:e,dataKey:_,nameKey:s,cx:"50%",cy:"50%",innerRadius:i,outerRadius:l,activeShape:n?ln(s):void 0,children:e.map((u,h)=>r.jsx(A.Cell,{fill:I[h%I.length]},`cell-${h}`))})]})})};function _n(t,e,s=Yt){return t<=0?0:e<=0?t:Math.max(t,e*s)}function un(t,e=pn,s){return s!==void 0?s:t<=0?et:Math.max(et,t*e)}function hn(t,e,s){if(s!==void 0)return s;const a=t.reduce((c,i)=>{const l=String(i[e]??"");return Math.max(c,l.length)},0);return Math.max(bn,a*jn)}const fn=t=>{const{data:e,yKeys:s,xKey:a,tooltipKey:c,minCategoryHeight:i,chartHeight:l,tooltipCoverage:n,showLegend:d=!0,yKeyLabels:o,yAxisWidth:_}=t,u=un(e.length,i,l),h=hn(e,a,_);return r.jsxs($,{height:u,layout:"vertical",data:e,Chart:A.BarChart,children:[r.jsx(A.CartesianGrid,{strokeDasharray:"3 3",horizontal:!1}),r.jsx(tt,{type:"number"}),r.jsx(Y,{type:"category",dataKey:a,width:h}),r.jsx(W,{tooltipKey:c,tooltipCoverage:n}),d&&r.jsx(J,{}),s.map((f,y)=>r.jsx(A.Bar,{dataKey:f,name:(o==null?void 0:o[f])??f,fill:I[y%I.length]},f))]})},mn=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:c,width:i}=t;return r.jsxs($,{width:i,data:e,Chart:A.LineChart,children:[r.jsx(A.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(tt,{dataKey:s}),r.jsx(Y,{}),r.jsx(W,{tooltipKey:c}),r.jsx(J,{}),a.map((l,n)=>r.jsx(A.Line,{type:"monotone",dataKey:l,stroke:I[n%I.length],strokeWidth:2,dot:!1},l))]})};var yn={NODE_ENV:"production"};const xn=t=>{const{data:e,xKey:s,series:a=[],tooltipKey:c,width:i}=t;return!a.length&&yn.NODE_ENV,r.jsxs($,{width:i,data:e,Chart:A.BarChart,children:[r.jsx(A.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(tt,{dataKey:s}),r.jsx(Y,{}),r.jsx(W,{tooltipKey:c}),r.jsx(J,{}),a.map((l,n)=>r.jsx(A.Bar,{dataKey:l.key,name:l.label??l.key,stackId:l.stackId,fill:l.color??I[n%I.length]},l.key))]})},gn=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:c}=t,i=({cx:l,cy:n,midAngle:d,innerRadius:o,outerRadius:_,value:u})=>{const h=Math.PI/180,f=25+o+(_-o),y=l+f*Math.cos(-(d??0)*h),j=n+f*Math.sin(-(d??0)*h);return r.jsx("text",{x:y,y:j,fill:O.labelColor,color:O.labelColor,textAnchor:"middle",dominantBaseline:"central",children:u})};return r.jsx(A.ResponsiveContainer,{width:"100%",height:et,children:r.jsxs(A.PieChart,{children:[r.jsx(W,{tooltipKey:c}),r.jsx(J,{}),r.jsx(A.Pie,{data:e,dataKey:a[0],nameKey:s,label:i,outerRadius:120,children:e.map((l,n)=>r.jsx(A.Cell,{fill:I[n%I.length]},`cell-${n}`))})]})})},et=400,Yt=56,pn=28,bn=100,jn=8,Cn=new Set(["bar","line","area","mixBar","composed"]),Nn={area:en,bar:nn,composed:on,donut:dn,horizontalBar:fn,line:mn,mixBar:xn,pie:gn},I=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],O={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",labelColorMuted:"var(--color-neutral-50)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},Qt={chartScrollViewport:"_chartScrollViewport_sm5hx_1",chartScrollViewport_track:"_chartScrollViewport_track_sm5hx_29"},wn="Scrollable chart area",kn=({dataLength:t,minCategoryWidth:e,children:s})=>{const a=g.useRef(null),[c,i]=g.useState(0),l=e??Yt;g.useEffect(()=>{const _=a.current;if(!_)return;const u=()=>{i(_.clientWidth)};u();const h=new ResizeObserver(u);return h.observe(_),()=>h.disconnect()},[]);const n=_n(c,t,l),d=c>0&&n>c,o=g.useCallback(_=>{const u=a.current;if(u)switch(_.key){case"ArrowLeft":u.scrollLeft-=l,_.preventDefault();break;case"ArrowRight":u.scrollLeft+=l,_.preventDefault();break;case"Home":u.scrollLeft=0,_.preventDefault();break;case"End":u.scrollLeft=u.scrollWidth-u.clientWidth,_.preventDefault();break}},[l]);return r.jsx("div",{ref:a,className:Qt.chartScrollViewport,role:d?"region":void 0,tabIndex:d?0:void 0,"aria-label":d?wn:void 0,onKeyDown:d?o:void 0,children:r.jsx("div",{className:Qt.chartScrollViewport_track,style:{width:n,height:et},children:c>0?s(n):null})})},Zt=t=>{const{component:e,userFlow:s,hash:a,responseKey:c,dataSource:i,...l}=t,n=Nn[l.type],{fetchDataSource:d}=V(),[o,_]=g.useState(!1),[u,h]=g.useState([]),f=async()=>{var p,m;try{_(!0);const{jsonPathData:x,mapperData:b}=i,N=jt(i,1),C=await d(N,s,!1),k=x?(p=Wt(C==null?void 0:C.data,x,b))==null?void 0:p.items:(m=C==null?void 0:C.data)==null?void 0:m.data;h(k),_(!1)}catch(x){alert(JSON.stringify(x)),_(!1)}};if(g.useEffect(()=>{n&&(i?f():h(l.data))},[]),!n)return r.jsx("div",{children:"Not supported chart type"});const y={...l,data:u};return o?r.jsx(w.SkeletonBase,{height:400}):u.length===0?r.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):Cn.has(l.type)?r.jsx(kn,{dataLength:u.length,minCategoryWidth:l.minCategoryWidth,children:p=>r.jsx(n,{...y,width:p})}):r.jsx(n,{...y})},En=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:c,label:i,value:l,required:n,dependencies:d,...o}=t,_={...o},{getNextUI:u}=V(),[h,f]=g.useState(l||!1),{disabled:y}=H(e,d),j=g.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),p=g.useCallback(async()=>{var x;try{const b=!h;f(b);const N={...(x=T.getState()[e])==null?void 0:x.entries,[a]:b};switch(L(e,N),c){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,N,a,c==="GO_TO_NEXT_UI");k!=null&&k.data&&B(e,k==null?void 0:k.data);break}default:break}}catch(b){console.error("Error in checkbox action:",b),alert(JSON.stringify(b))}},[e,s,a,c,h]),m=(_==null?void 0:_.disabled)??y;return r.jsx(w.Checkbox,{..._,labelRight:j,checked:h,disabled:m,onChange:()=>{!m&&p()}})},nt={codeEditor:"_codeEditor_1wi2p_1",codeEditor_label:"_codeEditor_label_1wi2p_4",codeEditor_wrapper:"_codeEditor_wrapper_1wi2p_13",input:"_input_1wi2p_17",preview:"_preview_1wi2p_18",preview_inner:"_preview_inner_1wi2p_33"},Tn=t=>{const{userFlow:e,responseKey:s,label:a,language:c,placeholder:i,value:l,required:n,dependencies:d,disabled:o,showPreview:_,height:u="400px"}=t,[h,f]=g.useState(l??""),y=w.ThemeStore.useThemeStore(N=>N.theme.mode),{disabled:j}=H(e,d),p=o??j,m={json:At.json(),markdown:fe.markdown(),sql:me.sql(),yaml:ye.yaml()},x=g.useMemo(()=>n&&a?`${a} *`:a??"",[a,n]),b=N=>{f(N);const C={[s]:N};L(e,C)};return r.jsxs("div",{className:nt.codeEditor,children:[x&&x!==""&&r.jsx("label",{className:nt.codeEditor_label,children:x}),r.jsxs("div",{className:nt.codeEditor_wrapper,children:[r.jsx(he,{className:nt.input,value:h,height:u,placeholder:i,extensions:[m[c]??At.json()],onChange:N=>b(N),theme:y,editable:!p}),c==="markdown"&&_&&r.jsx("div",{className:nt.preview,style:{height:u},children:r.jsx(w.PreviewerMarkdown,{className:nt.preview_inner,children:h})})]})]})},Ft={slotStack:"_slotStack_6n2wy_5"},An=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,content:l,topContent:n,icon:d,headerStatusColor:o,..._}=t,u=o?`palette_${o}_50`:void 0,h=S(e,s,l&&l.length>0?l:null),f=S(e,s,n&&n.length>0?n:null),y=h&&h.length>0?r.jsx("div",{className:Ft.slotStack,children:h.map((p,m)=>r.jsx(g.Fragment,{children:p},`data-card-body-${c}-${m}`))}):void 0,j=f&&f.length>0?r.jsx("div",{className:Ft.slotStack,children:f.map((p,m)=>r.jsx(g.Fragment,{children:p},`data-card-top-${c}-${m}`))}):void 0;return r.jsx(w.DataCard,{..._,icon:d,headerStatusColor:u,topContent:j,children:y})},vn={dividerNotFront:"_dividerNotFront_tze3j_1"},Sn=t=>r.jsx(w.Divider,{...t,className:vn.dividerNotFront}),kt={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},On=({userFlow:t,pageId:e,responseKey:s,header:a,body:c,footer:i,...l})=>{const n=T(p=>{var m;return(m=p[t])==null?void 0:m.isDrawerOpen}),d=T(p=>{var m;return(m=p[t])==null?void 0:m.isLoading}),o=n&&!d,_={...l,isOpen:o,children:null},u=g.useCallback(()=>{yt(t),ot(t,!1)},[t]),h=Array.isArray(a)?S(t,e,a):a?r.jsx(w.Heading,{type:"h2",children:a}):void 0,f=S(t,e,c),y=i?S(t,e,i):void 0;return r.jsx(w.Drawer,{..._,className:kt.drawer,isOpen:o,onClose:u,heightGap:50,title:h?r.jsx(r.Fragment,{children:Array.isArray(h)?h.map((p,m)=>r.jsx(g.Fragment,{children:p},`drawer-header-${m}`)):h}):void 0,children:r.jsx("section",{className:kt.drawerBody,children:f.map((p,m)=>r.jsx(g.Fragment,{children:p},`drawer-body-${m}`))}),footer:y?r.jsx("div",{className:kt.drawerFooter,children:y.map((p,m)=>r.jsx(g.Fragment,{children:p},`drawer-footer-${m}`))}):void 0})},Rn=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,content:l,items:n,disabled:d,variant:o,leftIcon:_,rightIcon:u}=t,h=ut(e,s),f=g.useMemo(()=>n.map(y=>({label:y.content??y.label??"",onClick:()=>{h({responseKey:y.responseKey,actionType:y.actionType,dataSource:y.dataSource,redirectUrl:y.redirectUrl,dependencies:y.dependencies})}})),[n,h]);return r.jsx(w.DropdownButton,{disabled:d,variant:o,items:f,children:r.jsxs(g.Fragment,{children:[_?r.jsx(vt.Icon,{name:_,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,l,u?r.jsx(vt.Icon,{name:u,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},Pt={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},Dn=({components:t=[]})=>r.jsx("section",{className:F(Pt.header,"avocado-dark-theme"),children:r.jsx("div",{className:Pt.header_content,children:t.map((e,s)=>r.jsx(g.Fragment,{children:e},s))})}),In=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:c,content:i,redirectUrl:l,target:n,dependencies:d,component:o,hash:_,...u}=t,{getNextUI:h}=V(),{disabled:f}=H(e,d),y=c&&u?(()=>{const{href:m,target:x,download:b,...N}=u;return N})():u,j=g.useCallback(async()=>{var m;if(c)try{const x={...(m=T.getState()[e])==null?void 0:m.entries,[a]:{status:200}};switch(L(e,x),c){case"GO_TO_NEXT_UI":{const b=await h(e,s,x,a);b!=null&&b.data&&B(e,b==null?void 0:b.data);break}case"REDIRECT":if(!l){console.warn("Missing redirectUrl for REDIRECT actionType");break}n==="_blank"?window.open(l,"_blank","noopener,noreferrer"):window.location.assign(l);break;default:console.warn(`Unhandled actionType for link: ${c}`);break}}catch(x){alert(JSON.stringify(x))}},[c,h,s,l,a,n,e]),p=y.disabled??f;return r.jsx(w.Link,{...y,disabled:p,onClick:c?j:void 0,children:i})},Ln=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,items:l,closeOnClick:n,disabled:d,listOrigin:o,size:_,variant:u}=t,h=ut(e,s),f=g.useMemo(()=>l.map(y=>({icon:y.leftIcon,label:y.content??y.label??"",onClick:j=>{var p;(p=j==null?void 0:j.preventDefault)==null||p.call(j),h({responseKey:y.responseKey,actionType:y.actionType,dataSource:y.dataSource,redirectUrl:y.redirectUrl,dependencies:y.dependencies})}})),[l,h]);return r.jsx(w.Menu,{items:f,closeOnClick:n,disabled:d,listOrigin:o,size:_,variant:u})},Mn={modalContent:"_modalContent_p06ci_1"},Kn=({userFlow:t,pageId:e,responseKey:s,header:a,body:c,footer:i,headerStatusColor:l,...n})=>{const d=T(m=>{var x;return(x=m[t])==null?void 0:x.isModalOpen}),o=T(m=>{var x;return(x=m[t])==null?void 0:x.isLoading}),_=d&&!o,u={...n},h=(u==null?void 0:u.headerStatusColor)??l,f=g.useCallback(()=>{yt(t),xt(t,!1)},[t,s]),y=Array.isArray(a)?S(t,e,a):a,j=S(t,e,c),p=S(t,e,i);return r.jsx(w.Modal,{...u,headerStatusColor:h,header:typeof y=="string"?y:r.jsx(r.Fragment,{children:y.map((m,x)=>r.jsx(g.Fragment,{children:m},`modal-header-${x}`))}),children:r.jsx("section",{className:Mn.modalContent,children:j.map((m,x)=>r.jsx(g.Fragment,{children:m},`modal-body-${x}`))}),actions:r.jsx(r.Fragment,{children:p.map((m,x)=>r.jsx(g.Fragment,{children:m},`modal-footer-${x}`))}),open:_,onClose:f})},Bn=({userFlow:t,pageId:e})=>{var i,l;const s=je(t);if(!s)return null;const a=[...(s==null?void 0:s.components)||[],...((i=s==null?void 0:s.header)==null?void 0:i.components)||[],...((l=s==null?void 0:s.body)==null?void 0:l.components)||[]],c=S(t,e,a);return r.jsx(r.Fragment,{children:c==null?void 0:c.map((n,d)=>{const o=`overlay-${d}-${s==null?void 0:s.hash}`;return r.jsx(g.Fragment,{children:n},o)})})},Gn=["success","warning","error","info","neutral"],$t={success:{color:"success-opacity",textColor:"success-60",iconColor:"success-50"},warning:{color:"warning-opacity",textColor:"warning-60",iconColor:"warning-50"},error:{color:"error-opacity",textColor:"error-60",iconColor:"error-50"},info:{color:"primary-10",textColor:"primary-70",iconColor:"primary-70"},neutral:{color:"neutral-10",textColor:"neutral-70",iconColor:"neutral-70"}},Hn=t=>typeof t=="string"&&Gn.includes(t),Un=t=>t!=null&&t.length?t.length===2&&Hn(t[1])?[{label:String(t[0]),variant:t[1]}]:t.map(e=>({label:String(e),variant:"neutral"})):[],Vn=t=>{const{content:e,variant:s="neutral",...a}=t,c=$t[s],i={...a,children:e,color:(a==null?void 0:a.color)??c.color,textColor:(a==null?void 0:a.textColor)??c.textColor,iconColor:(a==null?void 0:a.iconColor)??c.iconColor};return r.jsx(w.Pill,{...i})},zn=t=>{const{content:e}=t;return r.jsx(w.PreviewerMarkdown,{children:e})},Xn=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:c,dataSource:i,dependencies:l,onClick:n,...d}=t,o=ut(e,s),{disabled:_}=H(e,l),u={...d},h=(u==null?void 0:u.disabled)??_,[f,y]=g.useState(!1),j=g.useRef(!1),p=g.useCallback(async()=>{if(j.current)return;const m=c==="FETCH_DATA_SOURCE";m&&(j.current=!0,y(!0));try{await o({responseKey:a,actionType:c,dataSource:i,dependencies:l})}catch(x){console.error("[RoundButtonNotFront] Action failed:",x)}finally{m&&(j.current=!1,y(!1))}},[c,i,l,a,o]);return r.jsx(w.RoundButton,{...u,loading:u.loading||f,disabled:h,onClick:()=>!h&&!f&&(n??p)()})},q={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},te=t=>{const{userFlow:e,pageId:s,columnWidth:a,columns:c,gap:i="md",justifyContent:l="start",alignItems:n="stretch"}=t,d=Array.isArray(c)?c.map((o,_)=>{const u=`col_${_}`,h=`col_${_}`;if(Array.isArray(o))return{gap:"md",justifyContent:"start",alignItems:"start",items:o,hash:u,responseKey:h};const f=o;return{gap:(f==null?void 0:f.gap)??"md",justifyContent:(f==null?void 0:f.justifyContent)??"start",alignItems:(f==null?void 0:f.alignItems)??"start",items:(f==null?void 0:f.items)??[],hash:(f==null?void 0:f.hash)??u,responseKey:(f==null?void 0:f.responseKey)??h}}):[];return d.length===0?null:r.jsx("div",{className:F(q.row,q[`row__gap-${i}`],q[`row__justify-${l}`],q[`row__align-${n}`]),children:d==null?void 0:d.map((o,_)=>{const u=(a==null?void 0:a[_])||`${100/d.length}%`,h=S(e,s,o.items);return!h||h.length===0?null:r.jsx("div",{className:F(q.row_column,q[`row_column__gap-${o.gap}`],q[`row_column__justify-${o.justifyContent}`],q[`row_column__align-${o.alignItems}`]),style:{width:u},children:h},o.hash||_)})})};function ee({userFlow:t,pageId:e,responseKey:s,actionType:a,getNextUI:c,isMulti:i=!1,debounceMs:l}){const n=g.useRef(null);g.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=g.useCallback(async _=>{var f;const u={...(f=T.getState()[t])==null?void 0:f.entries};if(_?(u[s]=_,L(t,u)):(delete u[s],Ce(t,s)),a&&(a==="GO_TO_NEXT_UI"||a==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const j=await c(t,e,u,s,a==="GO_TO_NEXT_UI");j!=null&&j.data&&B(t,j.data)}catch(y){console.error("[useSelectChange] Failed to fetch next UI",y)}},[t,e,s,a,c]);return g.useCallback(_=>{if(!i){d(_);return}if(l==null){d(_);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{d(_),n.current=null},l)},[i,l,d])}const Jn=/\{([^}]+)\}/g,Wn=(t,e)=>{var s;return e.includes("{")?e.replace(Jn,(a,c)=>{var l;const i=(l=G.query(t,c.trim()))==null?void 0:l[0];return i!=null?String(i):""}):(s=G.query(t,e))==null?void 0:s[0]},qn=(t,e,s,a)=>{const c=G.query(t,e);return(c==null?void 0:c.map(i=>{var d;const l=Wn(i,s),n=a?(d=G.query(i,a))==null?void 0:d[0]:i;return{label:l,value:n}}))??[]},Yn=(t,e,s,a=10)=>{var n,d;let c,i;if(s){const o=G.value(t,s.size??"$.meta.size")??a,_=G.value(t,s.total??"$.meta.total")??0;c=o,i=_}else{const o=t==null?void 0:t.meta;c=(o==null?void 0:o.size)??((n=o==null?void 0:o.page)==null?void 0:n.size)??a,i=(o==null?void 0:o.total)??((d=o==null?void 0:o.page)==null?void 0:d.total)??0}const l=i>0?Math.ceil(i/c)>e:!1;return{pageSize:c,total:i,hasMore:l}},ne={selectNotFront:"_selectNotFront_ch3v5_1"},Qn=({userFlow:t,pageId:e,responseKey:s,required:a,dataSource:c,actionType:i,dependencies:l,debounceMs:n,...d})=>{const o={...d},{getNextUI:_,fetchDataSource:u}=V(),[h,f]=g.useState((o==null?void 0:o.value)??""),{disabled:y}=H(t,l),j=(o==null?void 0:o.disabled)??y,p=g.useMemo(()=>a&&(o!=null&&o.label)?`${o==null?void 0:o.label} *`:(o==null?void 0:o.label)??"",[o==null?void 0:o.label,a]),m=g.useMemo(()=>{const C=o!=null&&o.isMulti?h:[h],k={};return Array.isArray(C)&&C.forEach(E=>{if(!E)return;const R=JSON.stringify(E.value),M=JSON.stringify(E.label);k[R]=E,M in k||(k[M]=E)}),k},[h]),x=ee({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:o==null?void 0:o.isMulti,debounceMs:n}),b=C=>{f(C),x(C)},N=async(C,k,{page:E})=>{const{jsonPathLabel:R,jsonPathOptions:M,jsonPathValue:K,jsonPathPagination:st}=c,X=jt(c,E,C),D=await u(X,t,!1),U=D==null?void 0:D.data,lt=U?qn(U,M,R,K):[],{hasMore:Et}=Yn(U,E,st);return{options:lt,hasMore:Et,additional:{page:E+1}}};return r.jsx(w.SelectPagination,{...o,className:ne.selectNotFront,label:p,value:h,disabled:j,noOptionsMessage:()=>r.jsx(r.Fragment,{children:"Sin opciones"}),onChange:C=>!j&&b(C),loadOptions:N,additional:{page:1},isOptionDisabled:C=>{const k=JSON.stringify(C==null?void 0:C.value),E=JSON.stringify(C==null?void 0:C.label);return!!(m!=null&&m[k])||!!(m!=null&&m[E])},debounceTimeout:350})},Zn=({userFlow:t,pageId:e,responseKey:s,dataSource:a,required:c,actionType:i,dependencies:l,debounceMs:n,...d})=>{const o={...d},{getNextUI:_}=V(),[u,h]=g.useState(o.value||""),{disabled:f}=H(t,l),y=(o==null?void 0:o.disabled)??f,j=g.useMemo(()=>c&&(o!=null&&o.label)?`${o==null?void 0:o.label} *`:(o==null?void 0:o.label)??"",[o==null?void 0:o.label,c]),p=ee({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:o==null?void 0:o.isMulti,debounceMs:n}),m=x=>{h(x),p(x)};return r.jsx(w.Select,{...o,className:ne.selectNotFront,label:j,value:u,disabled:y,onChange:x=>!y&&m(x)})},Fn=t=>{const{dataSource:e}=t;return e?r.jsx(Qn,{...t}):r.jsx(Zn,{...t})},se={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},Pn=t=>{const{size:e}=t,s=F(se.spacing,se[`spacing__${e}`]);return r.jsx("div",{className:s})},$n=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:c,label:i,value:l,required:n,dependencies:d,...o}=t,_={...o},{getNextUI:u}=V(),[h,f]=g.useState(l||!1),{disabled:y}=H(e,d),j=(_==null?void 0:_.disabled)??y,p=g.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),m=g.useCallback(async()=>{var x;try{const b=!h;f(b);const N={...(x=T.getState()[e])==null?void 0:x.entries,[a]:b};switch(L(e,N),c){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,N,a,c==="GO_TO_NEXT_UI");k!=null&&k.data&&B(e,k==null?void 0:k.data);break}default:break}}catch(b){console.error("Error in switch action:",b),alert(JSON.stringify(b))}},[e,s,a,c,h]);return r.jsx(w.Switch,{..._,label:p,checked:h,disabled:j,onChange:()=>!j&&m()})},ae={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},ts=({values:t})=>{const s=Un(t??[]),a=s.slice(0,4),c=s.length-4;return r.jsxs("div",{className:ae.tableArrayPills,children:[a.map((i,l)=>{const n=$t[i.variant];return r.jsx(w.Pill,{color:n.color,textColor:n.textColor,iconColor:n.iconColor,children:i.label},`${i.label}-${i.variant}-${l}`)}),c>0&&r.jsxs(w.Pill,{outlined:!0,children:["+",c]})]})},es=({userFlow:t,pageId:e,tableResponseKey:s,component:a,rowData:c})=>{const{getNextUI:i,fetchAndGetNextUI:l,fetchDataSource:n}=V(),d=S(t,e,[{...a}]),o=(d==null?void 0:d[0])||null;if(!o)return null;const{actionType:_,responseKey:u,dataSource:h}=o.props,f=g.useCallback(async()=>{var y,j,p;try{const m={...(y=T.getState()[t])==null?void 0:y.entries,[u]:{status:200},[s]:[{...c}]};switch(L(t,m),_){case"GO_TO_NEXT_UI":{const x=await i(t,e,m,u);x!=null&&x.data&&B(t,x==null?void 0:x.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const x=await l(t,e,m,u,h);x!=null&&x.data&&B(t,x==null?void 0:x.data);break}case"GET_DATA_SOURCE":{const x=await i(t,e,m,u),b=(j=x==null?void 0:x.data)==null?void 0:j.content;if((b==null?void 0:b.type)!=="fetch")break;const N=b==null?void 0:b.dataSource,C=await n(N,t,!1),k={...(p=T.getState()[t])==null?void 0:p.entries,[u]:{status:C==null?void 0:C.status,content:C==null?void 0:C.data}};L(t,k);const E=await i(t,e,k,u);E!=null&&E.data&&B(t,E==null?void 0:E.data);break}default:console.warn(`Unhandled actionType: ${_}`);break}}catch(m){alert(JSON.stringify(m))}},[_,h,e,u,t]);return g.cloneElement(o,{onClick:f})},ns=()=>r.jsx("div",{className:ae.tableSkeleton,children:[...Array(10)].map((t,e)=>r.jsx(w.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),ss=(t,e)=>!(e!=null&&e.length)||!t?t:t.map(s=>e.some(c=>Array.isArray(s!=null&&s.accessor?c[s==null?void 0:s.accessor]:void 0))?{...s,renderCell:c=>{const i=s.accessor?c[s.accessor]:void 0;return Array.isArray(i)?r.jsx(ts,{values:i}):i??""}}:s),as=({userFlow:t,pageId:e,responseKey:s,component:a,dataSource:c,rightActions:i,data:l,pageSize:n,...d})=>{var st,X;const{fetchDataSource:o}=V(),[_,u]=g.useState(!1),[h,f]=g.useState(1),[y,j]=g.useState(null),p=!c&&Array.isArray(l),m=!!(c!=null&&c.jsonPathCursorPagination)&&!!((st=c==null?void 0:c.jsonPathPagination)!=null&&st.hasMore),x=g.useRef(new Map([[1,null]])),b=g.useMemo(()=>{if(i!=null&&i.length)return i.map((D,U)=>({renderContent:lt=>r.jsx(es,{userFlow:t,pageId:e,tableResponseKey:s,component:D,rowData:lt},`tableRowAction${U}`)}))},[i,t,e,s]),N=async(D=1)=>{if(!c)return;const{mapperData:U,jsonPathData:lt,jsonPathPagination:Et,jsonPathCursorPagination:it}=c;if(it&&D!==1&&!x.current.has(D)){f(1),N(1);return}it&&D===1&&(x.current=new Map([[1,null]]));try{u(!0);const Tt=it?x.current.get(D)??null:null,xs=jt(c,D,void 0,Tt),at=await o(xs,t,!1);if(j(Wt(at==null?void 0:at.data,lt,U,Et)),it){const _e=$e(at==null?void 0:at.data,it);_e&&x.current.set(D+1,_e)}u(!1)}catch(Tt){console.error("[TableNotFront] fetchData:",Tt),u(!1)}},C=D=>{f(D),N(D)};g.useEffect(()=>{p||N()},[]);const k=p?l:y==null?void 0:y.items,E=p&&!!n&&((l==null?void 0:l.length)??0)>n,R=g.useMemo(()=>{if(!E||!l||!n)return k??[];const D=(h-1)*n;return l.slice(D,D+n)},[E,l,n,h,k]),M=g.useMemo(()=>ss(d.columns,k),[k,d.columns]),K={...d,data:R,columns:M??[],rightActions:b};return p?!k||k.length===0?r.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):r.jsxs(r.Fragment,{children:[r.jsx(w.Table,{...K}),E&&n&&l&&r.jsx(w.Pager,{classname:{global:"row__end"},page:h,size:n,total:l.length,onChange:f})]}):r.jsx(r.Fragment,{children:_?r.jsx(ns,{}):y&&((X=y==null?void 0:y.items)==null?void 0:X.length)>0?r.jsxs(r.Fragment,{children:[r.jsx(w.Table,{...K}),!m&&(y==null?void 0:y.pagination)&&y.pagination.totalPages>1&&r.jsx(w.Pager,{classname:{global:"row__end"},page:h,size:y.pagination.size,total:y.pagination.total,onChange:C}),m&&(y==null?void 0:y.pagination)&&r.jsx(w.Pager,{variant:"cursor",classname:{global:"row__end"},page:h,hasNextPage:!!y.pagination.hasMore,onChange:C})]}):r.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},os={tabsPanel:"_tabsPanel_kvslb_1"},rs=({userFlow:t,pageId:e,components:s})=>{const a=S(t,e,s);return a!=null&&a.length?r.jsx("section",{className:os.tabsPanel,children:a.map((c,i)=>r.jsx(g.Fragment,{children:c},`tabs-panel-${i}`))}):null},cs=({userFlow:t,pageId:e,hash:s,items:a,activeIndex:c,className:i,responseKey:l})=>{const n=a.map((o,_)=>({label:o.label,disabled:o.disabled,children:r.jsx(rs,{userFlow:t,pageId:e,components:o.components},`${s}-tab-${_}`)})),d=o=>{var u;const _={...(u=T.getState()[t])==null?void 0:u.entries,[l]:o};L(t,_)};return r.jsx(w.Tabs,{className:i,activeIndex:c,items:n,onClick:d})},ls={textareaNotFront:"_textareaNotFront_1wpe5_1"},is=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,required:l,dependencies:n,...d}=t,o={...d},[_,u]=g.useState((o==null?void 0:o.value)??""),{disabled:h}=H(e,n),f=(o==null?void 0:o.disabled)??h,y=g.useMemo(()=>l&&(o!=null&&o.label)?`${o.label} *`:(o==null?void 0:o.label)??"",[o==null?void 0:o.label,l]),j=p=>{var x;const m=(x=p==null?void 0:p.target)==null?void 0:x.value;u(m),L(e,{[i]:m})};return g.useEffect(()=>{u((o==null?void 0:o.value)??"")},[o==null?void 0:o.value]),r.jsx(w.Textarea,{...o,className:ls.textareaNotFront,label:y,value:_,disabled:f,onChange:p=>!f&&j(p)})},ds={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},_s=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,required:l,dependencies:n,...d}=t,o={...d},[_,u]=g.useState((o==null?void 0:o.value)??""),{disabled:h}=H(e,n),f=(o==null?void 0:o.disabled)??h,y=g.useMemo(()=>l&&(o!=null&&o.label)?`${o==null?void 0:o.label} *`:(o==null?void 0:o.label)??"",[o==null?void 0:o.label,l]),j=p=>{var b;const m=(b=p==null?void 0:p.target)==null?void 0:b.value;u(m);const x={[i]:m};L(e,x)};return g.useEffect(()=>{u((o==null?void 0:o.value)??"")},[o==null?void 0:o.value]),r.jsx(w.TextField,{...o,className:ds.textFieldNotFront,allowClear:!1,label:y,value:_,disabled:f,onChange:p=>!f&&j(p)})},us=({userFlow:t,pageId:e,responseKey:s,variant:a,content:c,actionType:i,redirectUrl:l})=>{const n=g.useCallback(async()=>{yt(t);try{switch(i){case"AUTOCLOSE_AND_REDIRECT":window.location.href=l;break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(d){console.error("Error in toast action:",d),alert(JSON.stringify(d))}},[i,e,s,t,l]);return g.useEffect(()=>{({info:w.toast.info,error:w.toast.error,success:w.toast.success,warning:w.toast.warning}[a]||w.toast.info)(c,{autoClose:i?!1:4e3,containerId:t,onClose:n})},[n,t]),null},oe={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},hs=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,content:l,label:n,placement:d,notShowArrow:o,visible:_}=t,u=S(e,s,l!=null&&l.length?l:null),h=u&&u.length>0?r.jsx("div",{className:oe.tooltipNotFront_content,children:u.map((f,y)=>r.jsx(g.Fragment,{children:f},`tooltip-${c}-${y}`))}):null;return r.jsx(w.Tooltip,{className:oe.tooltipNotFront,label:n,placement:d,notShowArrow:o,visible:_,children:h})};function fs({sessionName:t,apiConfig:e,onResolveComponentProps:s,children:a}){const c=de(t,e,null,s);return r.jsxs(r.Fragment,{children:[c,a]})}const ms={api:"",headers:{}},re=({userFlow:t,components:e,hash:s,apiConfig:a})=>{const c=s??`${t}-page`;g.useState(()=>{var d,o;return(o=(d=T.getState()[t])==null?void 0:d.pages)!=null&&o[c]||dt(t,a??ms,{type:"page",hash:c,body:{components:e}}),null});const i=S(t,c,e);return r.jsx(r.Fragment,{children:i})};function ce(t){if(t==null||typeof t!="object"||!("components"in t)||!Array.isArray(t.components))throw new Error("[renderNotFront] payload.display must be an object with a `components` array");return t.components}const le=({payload:t,userFlow:e})=>{const s=ce(t.display),a=re({userFlow:e,hash:t.id,components:s});return r.jsx(r.Fragment,{children:a})},ys=le,ie=(t,e,s,a,c)=>{const i=S(t,e,(a==null?void 0:a.components)||null,c);switch(s){case"body":return r.jsx(He,{...a,inputs:i||[]},JSON.stringify(a==null?void 0:a.components));case"header":return r.jsx(Dn,{...a,components:i||[]},JSON.stringify(a==null?void 0:a.components));default:return null}},de=(t,e,s,a)=>{var p,m;const[c,i]=g.useState(!1),l=!!(e!=null&&e.api&&!s&&t),[n,d]=g.useState(l),o=T(x=>x[t]),_=o==null?void 0:o.currentPageId,u=(o==null?void 0:o.isLoading)??!1,h=n||u;g.useEffect(()=>{if(typeof window>"u")return;const x=new URL(window.location.href),b=x.searchParams.get("sessionId");b&&(mt(b),x.searchParams.delete("sessionId"),window.history.replaceState({},"",x.toString()))},[]);const f=_?ie(t,_,"header",((p=o==null?void 0:o.pages[_].page)==null?void 0:p.header)||null,a):null,y=_?ie(t,_,"body",((m=o==null?void 0:o.pages[_].page)==null?void 0:m.body)||null,a):null,j=async()=>{try{const x=await Ht(e,t),b=x==null?void 0:x.data,N=b==null?void 0:b.content;(x==null?void 0:x.status)===200?dt(t,e,N,b==null?void 0:b.sessionState,b==null?void 0:b.sessionId):i(!0)}catch(x){console.error("[not-page]: API call failed",x),i(!0)}finally{d(!1)}};return g.useEffect(()=>{e!=null&&e.api&&!s&&t?j():!(e!=null&&e.api)&&s&&t||e!=null&&e.api&&s&&t?dt(t,e,s):(!(e!=null&&e.api)&&!s||!t)&&(i(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const x="avocado-theme-mode-changed",b=N=>{const C=N.detail;w.ThemeStore.setThemeMode(C)};return window.addEventListener(x,b),()=>{window.removeEventListener(x,b)}},[]),c&&console.error("[not-page]: No render page"),r.jsxs(r.Fragment,{children:[h&&r.jsx(w.Loading,{}),f,y,_&&r.jsx(Bn,{userFlow:t,pageId:_}),o&&r.jsx(w.Toaster,{})]})};v.Chart=Zt,v.NotFrontPage=fs,v.RenderNotFront=le,v.Row=te,v.clearSessionId=ge,v.extractNotFrontComponents=ce,v.heading=Mt,v.renderNotFront=ys,v.text=Kt,v.useNotFrontFragment=re,v.usePage=de,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
13
+ */var Wt;function ze(){return Wt||(Wt=1,(function(t){(function(){var e={}.hasOwnProperty;function s(){for(var a=[],r=0;r<arguments.length;r++){var l=arguments[r];if(l){var c=typeof l;if(c==="string"||c==="number")a.push(l);else if(Array.isArray(l)){if(l.length){var n=s.apply(null,l);n&&a.push(n)}}else if(c==="object"){if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]")){a.push(l.toString());continue}for(var _ in l)e.call(l,_)&&l[_]&&a.push(_)}}}return a.join(" ")}t.exports?(s.default=s,t.exports=s):window.classNames=s})()})(Ct)),Ct.exports}var Xe=ze();const F=Ee(Xe),P={fieldset:"_fieldset_1xrth_1",fieldsetColumn:"_fieldsetColumn_1xrth_8",legend:"_legend_1xrth_14",options:"_options_1xrth_20",optionsRow:"_optionsRow_1xrth_25",optionsColumn:"_optionsColumn_1xrth_36"},Je=t=>{const{userFlow:e,pageId:s,responseKey:a,label:r,value:l,required:c,actionType:n,dependencies:_,direction:i,items:d}=t,u=i==="column"?"column":"row",{getNextUI:h}=U(),{disabled:f}=G(e,_),y=T(p=>{var w,C;return(C=(w=p[e])==null?void 0:w.entries)==null?void 0:C[a]}),j=y!=null?String(y):l??"",b=f,m=g.useMemo(()=>r?c?`${r} *`:r:null,[r,c]),x=g.useCallback(async p=>{var w;if(!b)try{const C={...(w=T.getState()[e])==null?void 0:w.entries,[a]:p};if(B(e,C),n==="GO_TO_NEXT_UI"||n==="GO_TO_NEXT_UI_WITHOUT_LOADING"){const O=await h(e,s,C,a,n==="GO_TO_NEXT_UI");O!=null&&O.data&&K(e,O==null?void 0:O.data)}}catch(C){alert(JSON.stringify(C))}},[n,h,b,s,a,e]);return o.jsxs("fieldset",{className:F(P.fieldset,u==="column"&&P.fieldsetColumn),children:[m?o.jsx("legend",{className:P.legend,children:m}):null,o.jsx("div",{className:F(P.options,u==="column"?P.optionsColumn:P.optionsRow),children:d.map(p=>o.jsx(N.RadioButton,{name:a,value:p.value,checked:j===p.value,disabled:b||p.disabled,labelRight:p.label,onChange:()=>{x(p.value)}},p.value))})]})},We=({userFlow:t,pageId:e,component:s,hash:a,responseKey:r,items:l,itemActive:c,darkMode:n})=>o.jsx(N.Stepper,{items:l,itemActive:c,darkMode:n}),qe=({userFlow:t,pageId:e,component:s,hash:a,responseKey:r,total:l,done:c,inProgress:n})=>o.jsx(N.ProgressBar,{total:l,done:c,inProgress:n}),Ye=({userFlow:t,items:e,responseKey:s})=>{const{getNextUI:a}=U(),r=g.useCallback(async({actionType:c,hashCode:n,redirectUrl:_})=>{var i;try{switch(c){case"GO_TO_NEXT_UI":const d=await a(t,n,{...(i=T.getState()[t])==null?void 0:i.entries},s);d!=null&&d.data&&K(t,d==null?void 0:d.data);break;case"REDIRECT":_?window.location.href=_:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${c}`);break}}catch(d){alert(JSON.stringify(d))}},[]),l=g.useMemo(()=>e==null?void 0:e.map(c=>({title:c==null?void 0:c.title,component:o.jsx("div",{onClick:()=>r(c)})})),[]);return o.jsx(N.Breadcrumbs,{items:l})};function lt(t,e){const{getNextUI:s,fetchDataSource:a,fetchAndGetNextUI:r}=U();return g.useCallback(async l=>{var h,f,y,j;const{responseKey:c,actionType:n,dataSource:_,redirectUrl:i,dependencies:d}=l,u=(h=T.getState()[t])==null?void 0:h.entries;if(!Gt(u,d))try{const b={...(f=T.getState()[t])==null?void 0:f.entries,[c]:{status:200}};switch(B(t,b),n){case"CLOSE_MODAL":xt(t,!1);break;case"CLOSE_DRAWER":ot(t,!1);break;case"OPEN_DRAWER":ot(t,!0);break;case"GO_TO_NEXT_UI":{const m=await s(t,e,b,c);m!=null&&m.data&&K(t,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await r(t,e,b,c,_);m!=null&&m.data&&K(t,m==null?void 0:m.data);break}case"FETCH_DATA_SOURCE":{const m=await a(_,t,!1);B(t,{[c]:{status:m==null?void 0:m.status,content:m==null?void 0:m.data}});break}case"GET_DATA_SOURCE":{const m=await s(t,e,b,c),x=(y=m==null?void 0:m.data)==null?void 0:y.content;if((x==null?void 0:x.type)!=="fetch")break;const p=x==null?void 0:x.dataSource,w=await a(p,t,!1),C={...(j=T.getState()[t])==null?void 0:j.entries,[c]:{status:w==null?void 0:w.status,content:w==null?void 0:w.data}};B(t,C);const k=await s(t,e,C,c);k!=null&&k.data&&K(t,k==null?void 0:k.data);break}case"REDIRECT":i?window.location.href=i:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${n}`)}}catch(b){alert(JSON.stringify(b))}},[r,a,s,e,t])}const Qe=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:r,label:l,content:c,dataSource:n,redirectUrl:_,dependencies:i,onClick:d,...u}=t,h=lt(e,s),{disabled:f}=G(e,i),y={...u,children:c??l},j=(y==null?void 0:y.disabled)??f,[b,m]=g.useState(!1),x=g.useRef(!1),p=g.useCallback(async()=>{if(x.current)return;const w=r==="FETCH_DATA_SOURCE";w&&(x.current=!0,m(!0));try{await h({responseKey:a,actionType:r,dataSource:n,redirectUrl:_,dependencies:i})}catch(C){console.error("[ButtonNotFront] Action failed:",C)}finally{w&&(x.current=!1,m(!1))}},[r,n,i,_,a,h]);return o.jsx(N.Button,{...y,loading:y.loading||b,disabled:j,onClick:()=>!j&&!b&&(d??p)()})},wt={slotStack:"_slotStack_12u4t_5"},Ze=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,dependencies:c,content:n,actionContent:_,...i}=t,{disabled:d}=G(e,c),u=S(e,s,n&&n.length>0?n:null),h=S(e,s,_&&_.length>0?_:null),f=u&&u.length>0?o.jsx("div",{className:wt.slotStack,children:u.map((b,m)=>o.jsx(g.Fragment,{children:b},`card-accordion-body-${r}-${m}`))}):void 0,y=h&&h.length>0?o.jsx("div",{className:wt.slotStack,children:h.map((b,m)=>o.jsx(g.Fragment,{children:b},`card-accordion-actions-${r}-${m}`))}):void 0,j=i.disabled||d;return o.jsx(N.CardAccordion,{...i,disabled:j,actionContent:y,children:f??null})},Fe={slotStack:"_slotStack_ivk5b_1"},Pe=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,content:c,colorId:n,disabled:_,actionType:i,dataSource:d,redirectUrl:u,dependencies:h}=t,{getNextUI:f,fetchDataSource:y,fetchAndGetNextUI:j}=U(),{disabled:b}=G(e,h),m=_??b,x=S(e,s,c&&c.length>0?c:null),p=x&&x.length>0?o.jsx("div",{className:Fe.slotStack,children:x.map((C,k)=>o.jsx(g.Fragment,{children:C},`card-body-${r}-${k}`))}):null,w=g.useCallback(async()=>{var C,k,E;if(!(!i||m))try{const O={...(C=T.getState()[e])==null?void 0:C.entries,[l]:{status:200}};switch(B(e,O),i){case"CLOSE_MODAL":xt(e,!1);break;case"CLOSE_DRAWER":ot(e,!1);break;case"OPEN_DRAWER":ot(e,!0);break;case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const I=await f(e,s,O,l,i==="GO_TO_NEXT_UI");I!=null&&I.data&&K(e,I==null?void 0:I.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const L=await j(e,s,O,l,d);L!=null&&L.data&&K(e,L==null?void 0:L.data);break}case"GET_DATA_SOURCE":{const L=await f(e,s,O,l),I=(k=L==null?void 0:L.data)==null?void 0:k.content;if((I==null?void 0:I.type)!=="fetch")break;const st=I==null?void 0:I.dataSource,X=await y(st,e,!1),D={...(E=T.getState()[e])==null?void 0:E.entries,[l]:{status:X==null?void 0:X.status,content:X==null?void 0:X.data}};B(e,D);const V=await f(e,s,D,l);V!=null&&V.data&&K(e,V==null?void 0:V.data);break}case"REDIRECT":u&&(window.location.href=u);break;default:console.warn(`Unhandled card actionType: ${i}`)}}catch(O){alert(JSON.stringify(O))}},[i,d,m,j,y,f,s,u,l,e]);return o.jsx(N.Card,{colorId:n,disabled:m,onClick:i&&!m?()=>void w():void 0,children:p})},$e=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,content:c,description:n,..._}=t,i=Array.isArray(c),d=S(e,s,i&&c.length>0?c:null);let u;return d&&d.length>0?u=o.jsxs("div",{className:wt.slotStack,children:[n?o.jsx(N.Text,{type:"sm",children:n}):null,d.map((h,f)=>o.jsx(g.Fragment,{children:h},`card-notification-body-${r}-${f}`))]}):u=(typeof c=="string"?c:void 0)??n,o.jsx(N.CardNotification,{..._,children:u})},Nt=t=>Array.isArray(t)?t:typeof t=="object"?JSON.stringify(t):t,tn=(t,e)=>{if(!e||t==null)return null;const{extractionJsonPath:s,injectionJsonPath:a}=e,r=H.value(t,s);if(r==null)return null;try{const l={};return H.value(l,a,r),l}catch(l){return console.warn("[buildCursorPayload] invalid injectionJsonPath:",a,l),null}},qt=(t,e,s,a)=>{const r=H.query(t,e),l=r==null?void 0:r.map(d=>{var u,h;if(s){const f={};for(const[y,j]of Object.entries(s))if(typeof j=="object"&&"path"in j){const b=j,m=(u=H.query(d,b.path))==null?void 0:u[0];b.translations&&String(m)in b.translations?f[y]=Nt(b.translations[String(m)]):f[y]=Nt(m)}else{const b=j;f[y]=Nt((h=H.query(d,b))==null?void 0:h[0])}return f}else return d}),c=H.value(t,(a==null?void 0:a.size)??"$.meta.size")??r.length,n=H.value(t,(a==null?void 0:a.total)??"$.meta.total")??0,_=a!=null&&a.hasMore?!!H.value(t,a.hasMore):void 0,i={size:c,total:n,totalPages:a!=null&&a.totalPages?H.value(t,(a==null?void 0:a.totalPages)??"$.meta.totalPages"):c>0?Math.ceil(n/c):0,..._!==void 0?{hasMore:_}:{}};return{items:l,pagination:i}},$=({width:t,height:e,layout:s,data:a,Chart:r,children:l})=>{const c=e??et,n=s?{layout:s}:{};return t?o.jsx(r,{width:t,height:c,data:a,...n,children:l}):o.jsx(v.ResponsiveContainer,{width:"100%",height:c,children:o.jsx(r,{data:a,...n,children:l})})},J=({withPadding:t=!1})=>{const e=s=>o.jsx("span",{style:{color:R.labelColor},children:s});return o.jsx(v.Legend,{formatter:e,wrapperStyle:{fontSize:R.fontSize,fontFamily:R.fontFamily,padding:t?"1rem 0":"0"}})},en=({active:t,payload:e,label:s,tooltipKey:a,tooltipCoverage:r})=>{var d,u;if(!t||!e||!e.length)return null;const l={backgroundColor:R.tooltipBg,borderRadius:R.tooltipBorderRadius,color:R.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(a){const h=(d=e[0])==null?void 0:d.payload;if(h&&h[a]!==void 0&&h[a]!==null)return o.jsx("div",{style:l,children:o.jsx("p",{style:{margin:0},children:h[a]})})}const c=(u=e[0])==null?void 0:u.payload,n=(r==null?void 0:r.label)??"Cobertura",_=r?c==null?void 0:c[r.denominatorKey]:void 0,i=r&&_!==void 0&&_!==null&&_>0;return o.jsxs("div",{style:l,children:[o.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:s}),e.map((h,f)=>o.jsx("p",{style:{margin:"2px 0",color:h.color},children:`${h.name}: ${h.value}`},f)),i&&o.jsx("p",{style:{margin:"2px 0"},children:`${n}: ${Math.round(c[r.numeratorKey]/_*100)}%`})]})},W=({tooltipKey:t,tooltipCoverage:e,defaultIndex:s,hideContent:a=!1}={})=>o.jsx(v.Tooltip,{defaultIndex:s,cursor:a?!1:void 0,content:a?()=>null:r=>o.jsx(en,{...r,tooltipKey:t,tooltipCoverage:e})}),tt=({dataKey:t,hide:e=!1,type:s})=>o.jsx(v.XAxis,{...t?{dataKey:t}:{},...s?{type:s}:{},hide:e,tick:{fill:R.labelColor,fontSize:R.fontSize}}),Y=({type:t,dataKey:e,width:s,yAxisId:a,orientation:r}={})=>o.jsx(v.YAxis,{...t?{type:t}:{},...e?{dataKey:e}:{},...s!==void 0?{width:s}:{},...a?{yAxisId:a}:{},...r?{orientation:r}:{},tick:{fill:R.labelColor,fontSize:R.fontSize},tickMargin:4}),nn=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:r,width:l}=t;return o.jsxs($,{width:l,data:e,Chart:v.AreaChart,children:[o.jsx(v.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(tt,{dataKey:s}),o.jsx(Y,{}),o.jsx(W,{tooltipKey:r}),o.jsx(J,{}),a.map((c,n)=>o.jsx(v.Area,{type:"monotone",dataKey:c,stroke:M[n%M.length],fill:M[n%M.length]},c))]})},sn=t=>{const{data:e,yKeys:s,xKey:a,tooltipKey:r,width:l}=t;return o.jsxs($,{width:l,data:e,Chart:v.BarChart,children:[o.jsx(v.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(tt,{dataKey:a}),o.jsx(Y,{}),o.jsx(W,{tooltipKey:r}),o.jsx(J,{}),s.map((c,n)=>o.jsx(v.Bar,{dataKey:c,fill:M[n%M.length]},c))]})};var Yt={NODE_ENV:"production"};const an=(t,e)=>{if(e!=null&&e.length)return e;const s=[...new Set(t.map(a=>a.yAxisId).filter(a=>!!a))];return s.length===0?[]:s.map((a,r)=>({id:a,orientation:r===1?"right":"left"}))},on=(t,e)=>{!t.type&&Yt.NODE_ENV;const s=t.color??M[e%M.length],a=t.label??t.key,r=t.yAxisId?{yAxisId:t.yAxisId}:{};switch(t.type){case"area":return o.jsx(v.Area,{dataKey:t.key,name:a,type:"monotone",fill:s,stroke:s,fillOpacity:.3,...r},t.key);case"line":return o.jsx(v.Line,{dataKey:t.key,name:a,type:"monotone",stroke:s,strokeWidth:2,dot:!1,...r},t.key);case"bar":return o.jsx(v.Bar,{dataKey:t.key,name:a,fill:s,stackId:t.stackId,barSize:t.barSize,...r},t.key);default:return null}},rn=t=>{const{data:e,xKey:s,series:a=[],tooltipKey:r,width:l,showLegend:c=!0,yAxes:n}=t;!a.length&&Yt.NODE_ENV;const _=an(a,n);return o.jsxs($,{width:l,data:e,Chart:v.ComposedChart,children:[o.jsx(v.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(tt,{dataKey:s}),_.length>0?_.map(i=>o.jsx(Y,{yAxisId:i.id,orientation:i.orientation},i.id)):o.jsx(Y,{}),o.jsx(W,{tooltipKey:r}),c&&o.jsx(J,{}),a.map((i,d)=>on(i,d))]})},cn="55%",ln=120,dn=t=>e=>{const s=Math.PI/180,{cx:a=0,cy:r=0,midAngle:l=0,innerRadius:c=0,outerRadius:n=0,startAngle:_=0,endAngle:i=0,fill:d=M[0],payload:u,percent:h=0,value:f=0}=e,y=Math.sin(-s*l),j=Math.cos(-s*l),b=a+(n+10)*j,m=r+(n+10)*y,x=a+(n+30)*j,p=r+(n+30)*y,w=x+(j>=0?1:-1)*22,C=p,k=j>=0?"start":"end",E=u,O=String((E==null?void 0:E[t])??"");return o.jsxs("g",{children:[o.jsx("text",{x:a,y:r,dy:8,textAnchor:"middle",fill:R.labelColor,fontSize:R.fontSize+2,fontFamily:R.fontFamily,children:O}),o.jsx(v.Sector,{cx:a,cy:r,innerRadius:c,outerRadius:n,startAngle:_,endAngle:i,fill:d}),o.jsx(v.Sector,{cx:a,cy:r,startAngle:_,endAngle:i,innerRadius:n+6,outerRadius:n+10,fill:d}),o.jsx("path",{d:`M${b},${m}L${x},${p}L${w},${C}`,stroke:d,fill:"none"}),o.jsx("circle",{cx:w,cy:C,r:2,fill:d,stroke:"none"}),o.jsx("text",{x:w+(j>=0?1:-1)*12,y:C,textAnchor:k,fill:R.labelColor,fontSize:R.fontSize+2,fontFamily:R.fontFamily,children:f}),o.jsx("text",{x:w+(j>=0?1:-1)*12,y:C,dy:18,textAnchor:k,fill:R.labelColorMuted,fontSize:R.fontSize,fontFamily:R.fontFamily,children:`(${(h*100).toFixed(0)}%)`})]})},_n=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:r,innerRadius:l=cn,outerRadius:c=ln,activeShape:n=!0,defaultIndex:_,showLegend:i=!0}=t,d=a[0];return o.jsx(v.ResponsiveContainer,{width:"100%",height:et,children:o.jsxs(v.PieChart,{children:[o.jsx(W,{tooltipKey:n?void 0:r,defaultIndex:_,hideContent:n}),i&&o.jsx(J,{}),o.jsx(v.Pie,{data:e,dataKey:d,nameKey:s,cx:"50%",cy:"50%",innerRadius:l,outerRadius:c,activeShape:n?dn(s):void 0,children:e.map((u,h)=>o.jsx(v.Cell,{fill:M[h%M.length]},`cell-${h}`))})]})})};function un(t,e,s=Qt){return t<=0?0:e<=0?t:Math.max(t,e*s)}function hn(t,e=bn,s){return s!==void 0?s:t<=0?et:Math.max(et,t*e)}function fn(t,e,s){if(s!==void 0)return s;const a=t.reduce((r,l)=>{const c=String(l[e]??"");return Math.max(r,c.length)},0);return Math.max(jn,a*Cn)}const mn=t=>{const{data:e,yKeys:s,xKey:a,tooltipKey:r,minCategoryHeight:l,chartHeight:c,tooltipCoverage:n,showLegend:_=!0,yKeyLabels:i,yAxisWidth:d}=t,u=hn(e.length,l,c),h=fn(e,a,d);return o.jsxs($,{height:u,layout:"vertical",data:e,Chart:v.BarChart,children:[o.jsx(v.CartesianGrid,{strokeDasharray:"3 3",horizontal:!1}),o.jsx(tt,{type:"number"}),o.jsx(Y,{type:"category",dataKey:a,width:h}),o.jsx(W,{tooltipKey:r,tooltipCoverage:n}),_&&o.jsx(J,{}),s.map((f,y)=>o.jsx(v.Bar,{dataKey:f,name:(i==null?void 0:i[f])??f,fill:M[y%M.length]},f))]})},yn=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:r,width:l}=t;return o.jsxs($,{width:l,data:e,Chart:v.LineChart,children:[o.jsx(v.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(tt,{dataKey:s}),o.jsx(Y,{}),o.jsx(W,{tooltipKey:r}),o.jsx(J,{}),a.map((c,n)=>o.jsx(v.Line,{type:"monotone",dataKey:c,stroke:M[n%M.length],strokeWidth:2,dot:!1},c))]})};var xn={NODE_ENV:"production"};const gn=t=>{const{data:e,xKey:s,series:a=[],tooltipKey:r,width:l}=t;return!a.length&&xn.NODE_ENV,o.jsxs($,{width:l,data:e,Chart:v.BarChart,children:[o.jsx(v.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(tt,{dataKey:s}),o.jsx(Y,{}),o.jsx(W,{tooltipKey:r}),o.jsx(J,{}),a.map((c,n)=>o.jsx(v.Bar,{dataKey:c.key,name:c.label??c.key,stackId:c.stackId,fill:c.color??M[n%M.length]},c.key))]})},pn=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:r}=t,l=({cx:c,cy:n,midAngle:_,innerRadius:i,outerRadius:d,value:u})=>{const h=Math.PI/180,f=25+i+(d-i),y=c+f*Math.cos(-(_??0)*h),j=n+f*Math.sin(-(_??0)*h);return o.jsx("text",{x:y,y:j,fill:R.labelColor,color:R.labelColor,textAnchor:"middle",dominantBaseline:"central",children:u})};return o.jsx(v.ResponsiveContainer,{width:"100%",height:et,children:o.jsxs(v.PieChart,{children:[o.jsx(W,{tooltipKey:r}),o.jsx(J,{}),o.jsx(v.Pie,{data:e,dataKey:a[0],nameKey:s,label:l,outerRadius:120,children:e.map((c,n)=>o.jsx(v.Cell,{fill:M[n%M.length]},`cell-${n}`))})]})})},et=400,Qt=56,bn=28,jn=100,Cn=8,wn=new Set(["bar","line","area","mixBar","composed"]),Nn={area:nn,bar:sn,composed:rn,donut:_n,horizontalBar:mn,line:yn,mixBar:gn,pie:pn},M=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],R={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",labelColorMuted:"var(--color-neutral-50)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},Zt={chartScrollViewport:"_chartScrollViewport_sm5hx_1",chartScrollViewport_track:"_chartScrollViewport_track_sm5hx_29"},kn="Scrollable chart area",En=({dataLength:t,minCategoryWidth:e,children:s})=>{const a=g.useRef(null),[r,l]=g.useState(0),c=e??Qt;g.useEffect(()=>{const d=a.current;if(!d)return;const u=()=>{l(d.clientWidth)};u();const h=new ResizeObserver(u);return h.observe(d),()=>h.disconnect()},[]);const n=un(r,t,c),_=r>0&&n>r,i=g.useCallback(d=>{const u=a.current;if(u)switch(d.key){case"ArrowLeft":u.scrollLeft-=c,d.preventDefault();break;case"ArrowRight":u.scrollLeft+=c,d.preventDefault();break;case"Home":u.scrollLeft=0,d.preventDefault();break;case"End":u.scrollLeft=u.scrollWidth-u.clientWidth,d.preventDefault();break}},[c]);return o.jsx("div",{ref:a,className:Zt.chartScrollViewport,role:_?"region":void 0,tabIndex:_?0:void 0,"aria-label":_?kn:void 0,onKeyDown:_?i:void 0,children:o.jsx("div",{className:Zt.chartScrollViewport_track,style:{width:n,height:et},children:r>0?s(n):null})})},Ft=t=>{const{component:e,userFlow:s,hash:a,responseKey:r,dataSource:l,...c}=t,n=Nn[c.type],{fetchDataSource:_}=U(),[i,d]=g.useState(!1),[u,h]=g.useState([]),f=async()=>{var b,m;try{d(!0);const{jsonPathData:x,mapperData:p}=l,w=jt(l,1),C=await _(w,s,!1),k=x?(b=qt(C==null?void 0:C.data,x,p))==null?void 0:b.items:(m=C==null?void 0:C.data)==null?void 0:m.data;h(k),d(!1)}catch(x){alert(JSON.stringify(x)),d(!1)}};if(g.useEffect(()=>{n&&(l?f():h(c.data))},[]),!n)return o.jsx("div",{children:"Not supported chart type"});const y={...c,data:u};return i?o.jsx(N.SkeletonBase,{height:400}):u.length===0?o.jsx(N.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):wn.has(c.type)?o.jsx(En,{dataLength:u.length,minCategoryWidth:c.minCategoryWidth,children:b=>o.jsx(n,{...y,width:b})}):o.jsx(n,{...y})},Tn=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:r,label:l,value:c,required:n,dependencies:_,...i}=t,d={...i},{getNextUI:u}=U(),[h,f]=g.useState(c||!1),{disabled:y}=G(e,_),j=g.useMemo(()=>n&&l?`${l} *`:l??"",[l,n]),b=g.useCallback(async()=>{var x;try{const p=!h;f(p);const w={...(x=T.getState()[e])==null?void 0:x.entries,[a]:p};switch(B(e,w),r){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,w,a,r==="GO_TO_NEXT_UI");k!=null&&k.data&&K(e,k==null?void 0:k.data);break}default:break}}catch(p){console.error("Error in checkbox action:",p),alert(JSON.stringify(p))}},[e,s,a,r,h]),m=(d==null?void 0:d.disabled)??y;return o.jsx(N.Checkbox,{...d,labelRight:j,checked:h,disabled:m,onChange:()=>{!m&&b()}})},nt={codeEditor:"_codeEditor_1wi2p_1",codeEditor_label:"_codeEditor_label_1wi2p_4",codeEditor_wrapper:"_codeEditor_wrapper_1wi2p_13",input:"_input_1wi2p_17",preview:"_preview_1wi2p_18",preview_inner:"_preview_inner_1wi2p_33"},vn=t=>{const{userFlow:e,responseKey:s,label:a,language:r,placeholder:l,value:c,required:n,dependencies:_,disabled:i,showPreview:d,height:u="400px"}=t,[h,f]=g.useState(c??""),y=N.ThemeStore.useThemeStore(w=>w.theme.mode),{disabled:j}=G(e,_),b=i??j,m={json:At.json(),markdown:me.markdown(),sql:ye.sql(),yaml:xe.yaml()},x=g.useMemo(()=>n&&a?`${a} *`:a??"",[a,n]),p=w=>{f(w);const C={[s]:w};B(e,C)};return o.jsxs("div",{className:nt.codeEditor,children:[x&&x!==""&&o.jsx("label",{className:nt.codeEditor_label,children:x}),o.jsxs("div",{className:nt.codeEditor_wrapper,children:[o.jsx(fe,{className:nt.input,value:h,height:u,placeholder:l,extensions:[m[r]??At.json()],onChange:w=>p(w),theme:y,editable:!b}),r==="markdown"&&d&&o.jsx("div",{className:nt.preview,style:{height:u},children:o.jsx(N.PreviewerMarkdown,{className:nt.preview_inner,children:h})})]})]})},An={slotStack:"_slotStack_6n2wy_5"};var Sn={NODE_ENV:"production"};const On=new Set(["accordion","button","cardAccordion","checkbox","dropdownButton","link","menu","radioGroup","roundButton","select","stepper","switch","table","tabs","textField","textarea"]),kt=(t,e)=>{if(t!=null&&t.length)return o.jsx("div",{className:An.slotStack,children:t.map((s,a)=>{var r;return o.jsx(g.Fragment,{children:s},((r=e==null?void 0:e[a])==null?void 0:r.hash)??a)})})},Rn=({userFlow:t,pageId:e,component:s,hash:a,responseKey:r,content:l,topContent:c,icon:n,headerStatusColor:_,...i})=>{const d=_?`palette_${_}_50`:void 0,u=S(t,e,l!=null&&l.length?l:null),h=S(t,e,c!=null&&c.length?c:null);return o.jsx(N.DataCard,{...i,icon:n,headerStatusColor:d,topContent:kt(h,c),children:kt(u,l)})},Dn=({userFlow:t,pageId:e,responseKey:s,actionType:a,dataSource:r,redirectUrl:l,dependencies:c,content:n,icon:_,ariaLabel:i,description:d,descriptionBottom:u,disabled:h,status:f,headerStyle:y,showBorder:j,borderColor:b,title:m,descriptionTop:x,pillLabel:p})=>{const w=S(t,e,n!=null&&n.length?n:null),C=lt(t,e),{disabled:k}=G(t,c),E=a?()=>void C({responseKey:s,actionType:a,dataSource:r,redirectUrl:l,dependencies:c}):void 0,O=h??k;E&&(n!=null&&n.some(I=>On.has(I.component)))&&Sn.NODE_ENV;const L=E?{onClick:E,disabled:O}:{};return o.jsx(N.DataCard,{version:"v2",status:f,headerStyle:y,showBorder:j,borderColor:b,title:m,ariaLabel:i,descriptionTop:x,descriptionBottom:u??d,pillLabel:p,icon:_,...L,children:kt(w,n)})},Ln=t=>t.version==="v2"?o.jsx(Dn,{...t}):o.jsx(Rn,{...t}),In={dividerNotFront:"_dividerNotFront_tze3j_1"},Mn=t=>o.jsx(N.Divider,{...t,className:In.dividerNotFront}),Et={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},Bn=({userFlow:t,pageId:e,responseKey:s,header:a,body:r,footer:l,...c})=>{const n=T(b=>{var m;return(m=b[t])==null?void 0:m.isDrawerOpen}),_=T(b=>{var m;return(m=b[t])==null?void 0:m.isLoading}),i=n&&!_,d={...c,isOpen:i,children:null},u=g.useCallback(()=>{yt(t),ot(t,!1)},[t]),h=Array.isArray(a)?S(t,e,a):a?o.jsx(N.Heading,{type:"h2",children:a}):void 0,f=S(t,e,r),y=l?S(t,e,l):void 0;return o.jsx(N.Drawer,{...d,className:Et.drawer,isOpen:i,onClose:u,heightGap:50,title:h?o.jsx(o.Fragment,{children:Array.isArray(h)?h.map((b,m)=>o.jsx(g.Fragment,{children:b},`drawer-header-${m}`)):h}):void 0,children:o.jsx("section",{className:Et.drawerBody,children:f.map((b,m)=>o.jsx(g.Fragment,{children:b},`drawer-body-${m}`))}),footer:y?o.jsx("div",{className:Et.drawerFooter,children:y.map((b,m)=>o.jsx(g.Fragment,{children:b},`drawer-footer-${m}`))}):void 0})},Kn=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,content:c,items:n,disabled:_,variant:i,leftIcon:d,rightIcon:u}=t,h=lt(e,s),f=g.useMemo(()=>n.map(y=>({label:y.content??y.label??"",onClick:()=>{h({responseKey:y.responseKey,actionType:y.actionType,dataSource:y.dataSource,redirectUrl:y.redirectUrl,dependencies:y.dependencies})}})),[n,h]);return o.jsx(N.DropdownButton,{disabled:_,variant:i,items:f,children:o.jsxs(g.Fragment,{children:[d?o.jsx(St.Icon,{name:d,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,c,u?o.jsx(St.Icon,{name:u,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},Pt={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},Gn=({components:t=[]})=>o.jsx("section",{className:F(Pt.header,"avocado-dark-theme"),children:o.jsx("div",{className:Pt.header_content,children:t.map((e,s)=>o.jsx(g.Fragment,{children:e},s))})}),Hn=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:r,content:l,redirectUrl:c,target:n,dependencies:_,component:i,hash:d,...u}=t,{getNextUI:h}=U(),{disabled:f}=G(e,_),y=r&&u?(()=>{const{href:m,target:x,download:p,...w}=u;return w})():u,j=g.useCallback(async()=>{var m;if(r)try{const x={...(m=T.getState()[e])==null?void 0:m.entries,[a]:{status:200}};switch(B(e,x),r){case"GO_TO_NEXT_UI":{const p=await h(e,s,x,a);p!=null&&p.data&&K(e,p==null?void 0:p.data);break}case"REDIRECT":if(!c){console.warn("Missing redirectUrl for REDIRECT actionType");break}n==="_blank"?window.open(c,"_blank","noopener,noreferrer"):window.location.assign(c);break;default:console.warn(`Unhandled actionType for link: ${r}`);break}}catch(x){alert(JSON.stringify(x))}},[r,h,s,c,a,n,e]),b=y.disabled??f;return o.jsx(N.Link,{...y,disabled:b,onClick:r?j:void 0,children:l})},Vn=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,items:c,closeOnClick:n,disabled:_,listOrigin:i,size:d,variant:u}=t,h=lt(e,s),f=g.useMemo(()=>c.map(y=>({icon:y.leftIcon,label:y.content??y.label??"",onClick:j=>{var b;(b=j==null?void 0:j.preventDefault)==null||b.call(j),h({responseKey:y.responseKey,actionType:y.actionType,dataSource:y.dataSource,redirectUrl:y.redirectUrl,dependencies:y.dependencies})}})),[c,h]);return o.jsx(N.Menu,{items:f,closeOnClick:n,disabled:_,listOrigin:i,size:d,variant:u})},Un={modalContent:"_modalContent_p06ci_1"},zn=({userFlow:t,pageId:e,responseKey:s,header:a,body:r,footer:l,headerStatusColor:c,...n})=>{const _=T(m=>{var x;return(x=m[t])==null?void 0:x.isModalOpen}),i=T(m=>{var x;return(x=m[t])==null?void 0:x.isLoading}),d=_&&!i,u={...n},h=(u==null?void 0:u.headerStatusColor)??c,f=g.useCallback(()=>{yt(t),xt(t,!1)},[t,s]),y=Array.isArray(a)?S(t,e,a):a,j=S(t,e,r),b=S(t,e,l);return o.jsx(N.Modal,{...u,headerStatusColor:h,header:typeof y=="string"?y:o.jsx(o.Fragment,{children:y.map((m,x)=>o.jsx(g.Fragment,{children:m},`modal-header-${x}`))}),children:o.jsx("section",{className:Un.modalContent,children:j.map((m,x)=>o.jsx(g.Fragment,{children:m},`modal-body-${x}`))}),actions:o.jsx(o.Fragment,{children:b.map((m,x)=>o.jsx(g.Fragment,{children:m},`modal-footer-${x}`))}),open:d,onClose:f})},Xn=({userFlow:t,pageId:e})=>{var l,c;const s=Ce(t);if(!s)return null;const a=[...(s==null?void 0:s.components)||[],...((l=s==null?void 0:s.header)==null?void 0:l.components)||[],...((c=s==null?void 0:s.body)==null?void 0:c.components)||[]],r=S(t,e,a);return o.jsx(o.Fragment,{children:r==null?void 0:r.map((n,_)=>{const i=`overlay-${_}-${s==null?void 0:s.hash}`;return o.jsx(g.Fragment,{children:n},i)})})},Jn=["success","warning","error","info","neutral"],$t={success:{color:"success-opacity",textColor:"success-60",iconColor:"success-50"},warning:{color:"warning-opacity",textColor:"warning-60",iconColor:"warning-50"},error:{color:"error-opacity",textColor:"error-60",iconColor:"error-50"},info:{color:"primary-10",textColor:"primary-70",iconColor:"primary-70"},neutral:{color:"neutral-10",textColor:"neutral-70",iconColor:"neutral-70"}},Wn=t=>typeof t=="string"&&Jn.includes(t),qn=t=>t!=null&&t.length?t.length===2&&Wn(t[1])?[{label:String(t[0]),variant:t[1]}]:t.map(e=>({label:String(e),variant:"neutral"})):[],Yn=t=>{const{content:e,variant:s="neutral",...a}=t,r=$t[s],l={...a,children:e,color:(a==null?void 0:a.color)??r.color,textColor:(a==null?void 0:a.textColor)??r.textColor,iconColor:(a==null?void 0:a.iconColor)??r.iconColor};return o.jsx(N.Pill,{...l})},Qn=t=>{const{content:e}=t;return o.jsx(N.PreviewerMarkdown,{children:e})},Zn=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:r,dataSource:l,dependencies:c,onClick:n,..._}=t,i=lt(e,s),{disabled:d}=G(e,c),u={..._},h=(u==null?void 0:u.disabled)??d,[f,y]=g.useState(!1),j=g.useRef(!1),b=g.useCallback(async()=>{if(j.current)return;const m=r==="FETCH_DATA_SOURCE";m&&(j.current=!0,y(!0));try{await i({responseKey:a,actionType:r,dataSource:l,dependencies:c})}catch(x){console.error("[RoundButtonNotFront] Action failed:",x)}finally{m&&(j.current=!1,y(!1))}},[r,l,c,a,i]);return o.jsx(N.RoundButton,{...u,loading:u.loading||f,disabled:h,onClick:()=>!h&&!f&&(n??b)()})},q={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},te=t=>{const{userFlow:e,pageId:s,columnWidth:a,columns:r,gap:l="md",justifyContent:c="start",alignItems:n="stretch"}=t,_=Array.isArray(r)?r.map((i,d)=>{const u=`col_${d}`,h=`col_${d}`;if(Array.isArray(i))return{gap:"md",justifyContent:"start",alignItems:"start",items:i,hash:u,responseKey:h};const f=i;return{gap:(f==null?void 0:f.gap)??"md",justifyContent:(f==null?void 0:f.justifyContent)??"start",alignItems:(f==null?void 0:f.alignItems)??"start",items:(f==null?void 0:f.items)??[],hash:(f==null?void 0:f.hash)??u,responseKey:(f==null?void 0:f.responseKey)??h}}):[];return _.length===0?null:o.jsx("div",{className:F(q.row,q[`row__gap-${l}`],q[`row__justify-${c}`],q[`row__align-${n}`]),children:_==null?void 0:_.map((i,d)=>{const u=(a==null?void 0:a[d])||`${100/_.length}%`,h=S(e,s,i.items);return!h||h.length===0?null:o.jsx("div",{className:F(q.row_column,q[`row_column__gap-${i.gap}`],q[`row_column__justify-${i.justifyContent}`],q[`row_column__align-${i.alignItems}`]),style:{width:u},children:h},i.hash||d)})})};function ee({userFlow:t,pageId:e,responseKey:s,actionType:a,getNextUI:r,isMulti:l=!1,debounceMs:c}){const n=g.useRef(null);g.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const _=g.useCallback(async d=>{var f;const u={...(f=T.getState()[t])==null?void 0:f.entries};if(d?(u[s]=d,B(t,u)):(delete u[s],we(t,s)),a&&(a==="GO_TO_NEXT_UI"||a==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const j=await r(t,e,u,s,a==="GO_TO_NEXT_UI");j!=null&&j.data&&K(t,j.data)}catch(y){console.error("[useSelectChange] Failed to fetch next UI",y)}},[t,e,s,a,r]);return g.useCallback(d=>{if(!l){_(d);return}if(c==null){_(d);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{_(d),n.current=null},c)},[l,c,_])}const Fn=/\{([^}]+)\}/g,Pn=(t,e)=>{var s;return e.includes("{")?e.replace(Fn,(a,r)=>{var c;const l=(c=H.query(t,r.trim()))==null?void 0:c[0];return l!=null?String(l):""}):(s=H.query(t,e))==null?void 0:s[0]},$n=(t,e,s,a)=>{const r=H.query(t,e);return(r==null?void 0:r.map(l=>{var _;const c=Pn(l,s),n=a?(_=H.query(l,a))==null?void 0:_[0]:l;return{label:c,value:n}}))??[]},ts=(t,e,s,a=10)=>{var n,_;let r,l;if(s){const i=H.value(t,s.size??"$.meta.size")??a,d=H.value(t,s.total??"$.meta.total")??0;r=i,l=d}else{const i=t==null?void 0:t.meta;r=(i==null?void 0:i.size)??((n=i==null?void 0:i.page)==null?void 0:n.size)??a,l=(i==null?void 0:i.total)??((_=i==null?void 0:i.page)==null?void 0:_.total)??0}const c=l>0?Math.ceil(l/r)>e:!1;return{pageSize:r,total:l,hasMore:c}},ne={selectNotFront:"_selectNotFront_ch3v5_1"},es=({userFlow:t,pageId:e,responseKey:s,required:a,dataSource:r,actionType:l,dependencies:c,debounceMs:n,..._})=>{const i={..._},{getNextUI:d,fetchDataSource:u}=U(),[h,f]=g.useState((i==null?void 0:i.value)??""),{disabled:y}=G(t,c),j=(i==null?void 0:i.disabled)??y,b=g.useMemo(()=>a&&(i!=null&&i.label)?`${i==null?void 0:i.label} *`:(i==null?void 0:i.label)??"",[i==null?void 0:i.label,a]),m=g.useMemo(()=>{const C=i!=null&&i.isMulti?h:[h],k={};return Array.isArray(C)&&C.forEach(E=>{if(!E)return;const O=JSON.stringify(E.value),L=JSON.stringify(E.label);k[O]=E,L in k||(k[L]=E)}),k},[h]),x=ee({userFlow:t,pageId:e,responseKey:s,actionType:l,getNextUI:d,isMulti:i==null?void 0:i.isMulti,debounceMs:n}),p=C=>{f(C),x(C)},w=async(C,k,{page:E})=>{const{jsonPathLabel:O,jsonPathOptions:L,jsonPathValue:I,jsonPathPagination:st}=r,X=jt(r,E,C),D=await u(X,t,!1),V=D==null?void 0:D.data,it=V?$n(V,L,O,I):[],{hasMore:Tt}=ts(V,E,st);return{options:it,hasMore:Tt,additional:{page:E+1}}};return o.jsx(N.SelectPagination,{...i,className:ne.selectNotFront,label:b,value:h,disabled:j,noOptionsMessage:()=>o.jsx(o.Fragment,{children:"Sin opciones"}),onChange:C=>!j&&p(C),loadOptions:w,additional:{page:1},isOptionDisabled:C=>{const k=JSON.stringify(C==null?void 0:C.value),E=JSON.stringify(C==null?void 0:C.label);return!!(m!=null&&m[k])||!!(m!=null&&m[E])},debounceTimeout:350})},ns=({userFlow:t,pageId:e,responseKey:s,dataSource:a,required:r,actionType:l,dependencies:c,debounceMs:n,..._})=>{const i={..._},{getNextUI:d}=U(),[u,h]=g.useState(i.value||""),{disabled:f}=G(t,c),y=(i==null?void 0:i.disabled)??f,j=g.useMemo(()=>r&&(i!=null&&i.label)?`${i==null?void 0:i.label} *`:(i==null?void 0:i.label)??"",[i==null?void 0:i.label,r]),b=ee({userFlow:t,pageId:e,responseKey:s,actionType:l,getNextUI:d,isMulti:i==null?void 0:i.isMulti,debounceMs:n}),m=x=>{h(x),b(x)};return o.jsx(N.Select,{...i,className:ne.selectNotFront,label:j,value:u,disabled:y,onChange:x=>!y&&m(x)})},ss=t=>{const{dataSource:e}=t;return e?o.jsx(es,{...t}):o.jsx(ns,{...t})},se={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},as=t=>{const{size:e}=t,s=F(se.spacing,se[`spacing__${e}`]);return o.jsx("div",{className:s})},os=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:r,label:l,value:c,required:n,dependencies:_,...i}=t,d={...i},{getNextUI:u}=U(),[h,f]=g.useState(c||!1),{disabled:y}=G(e,_),j=(d==null?void 0:d.disabled)??y,b=g.useMemo(()=>n&&l?`${l} *`:l??"",[l,n]),m=g.useCallback(async()=>{var x;try{const p=!h;f(p);const w={...(x=T.getState()[e])==null?void 0:x.entries,[a]:p};switch(B(e,w),r){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,w,a,r==="GO_TO_NEXT_UI");k!=null&&k.data&&K(e,k==null?void 0:k.data);break}default:break}}catch(p){console.error("Error in switch action:",p),alert(JSON.stringify(p))}},[e,s,a,r,h]);return o.jsx(N.Switch,{...d,label:b,checked:h,disabled:j,onChange:()=>!j&&m()})},ae={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},rs=({values:t})=>{const s=qn(t??[]),a=s.slice(0,4),r=s.length-4;return o.jsxs("div",{className:ae.tableArrayPills,children:[a.map((l,c)=>{const n=$t[l.variant];return o.jsx(N.Pill,{color:n.color,textColor:n.textColor,iconColor:n.iconColor,children:l.label},`${l.label}-${l.variant}-${c}`)}),r>0&&o.jsxs(N.Pill,{outlined:!0,children:["+",r]})]})},cs=({userFlow:t,pageId:e,tableResponseKey:s,component:a,rowData:r})=>{const{getNextUI:l,fetchAndGetNextUI:c,fetchDataSource:n}=U(),_=S(t,e,[{...a}]),i=(_==null?void 0:_[0])||null;if(!i)return null;const{actionType:d,responseKey:u,dataSource:h}=i.props,f=g.useCallback(async()=>{var y,j,b;try{const m={...(y=T.getState()[t])==null?void 0:y.entries,[u]:{status:200},[s]:[{...r}]};switch(B(t,m),d){case"GO_TO_NEXT_UI":{const x=await l(t,e,m,u);x!=null&&x.data&&K(t,x==null?void 0:x.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const x=await c(t,e,m,u,h);x!=null&&x.data&&K(t,x==null?void 0:x.data);break}case"GET_DATA_SOURCE":{const x=await l(t,e,m,u),p=(j=x==null?void 0:x.data)==null?void 0:j.content;if((p==null?void 0:p.type)!=="fetch")break;const w=p==null?void 0:p.dataSource,C=await n(w,t,!1),k={...(b=T.getState()[t])==null?void 0:b.entries,[u]:{status:C==null?void 0:C.status,content:C==null?void 0:C.data}};B(t,k);const E=await l(t,e,k,u);E!=null&&E.data&&K(t,E==null?void 0:E.data);break}default:console.warn(`Unhandled actionType: ${d}`);break}}catch(m){alert(JSON.stringify(m))}},[d,h,e,u,t]);return g.cloneElement(i,{onClick:f})},ls=()=>o.jsx("div",{className:ae.tableSkeleton,children:[...Array(10)].map((t,e)=>o.jsx(N.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),is=(t,e)=>!(e!=null&&e.length)||!t?t:t.map(s=>e.some(r=>Array.isArray(s!=null&&s.accessor?r[s==null?void 0:s.accessor]:void 0))?{...s,renderCell:r=>{const l=s.accessor?r[s.accessor]:void 0;return Array.isArray(l)?o.jsx(rs,{values:l}):l??""}}:s),ds=({userFlow:t,pageId:e,responseKey:s,component:a,dataSource:r,rightActions:l,data:c,pageSize:n,..._})=>{var st,X;const{fetchDataSource:i}=U(),[d,u]=g.useState(!1),[h,f]=g.useState(1),[y,j]=g.useState(null),b=!r&&Array.isArray(c),m=!!(r!=null&&r.jsonPathCursorPagination)&&!!((st=r==null?void 0:r.jsonPathPagination)!=null&&st.hasMore),x=g.useRef(new Map([[1,null]])),p=g.useMemo(()=>{if(l!=null&&l.length)return l.map((D,V)=>({renderContent:it=>o.jsx(cs,{userFlow:t,pageId:e,tableResponseKey:s,component:D,rowData:it},`tableRowAction${V}`)}))},[l,t,e,s]),w=async(D=1)=>{if(!r)return;const{mapperData:V,jsonPathData:it,jsonPathPagination:Tt,jsonPathCursorPagination:dt}=r;if(dt&&D!==1&&!x.current.has(D)){f(1),w(1);return}dt&&D===1&&(x.current=new Map([[1,null]]));try{u(!0);const vt=dt?x.current.get(D)??null:null,ws=jt(r,D,void 0,vt),at=await i(ws,t,!1);if(j(qt(at==null?void 0:at.data,it,V,Tt)),dt){const ue=tn(at==null?void 0:at.data,dt);ue&&x.current.set(D+1,ue)}u(!1)}catch(vt){console.error("[TableNotFront] fetchData:",vt),u(!1)}},C=D=>{f(D),w(D)};g.useEffect(()=>{b||w()},[]);const k=b?c:y==null?void 0:y.items,E=b&&!!n&&((c==null?void 0:c.length)??0)>n,O=g.useMemo(()=>{if(!E||!c||!n)return k??[];const D=(h-1)*n;return c.slice(D,D+n)},[E,c,n,h,k]),L=g.useMemo(()=>is(_.columns,k),[k,_.columns]),I={..._,data:O,columns:L??[],rightActions:p};return b?!k||k.length===0?o.jsx(N.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):o.jsxs(o.Fragment,{children:[o.jsx(N.Table,{...I}),E&&n&&c&&o.jsx(N.Pager,{classname:{global:"row__end"},page:h,size:n,total:c.length,onChange:f})]}):o.jsx(o.Fragment,{children:d?o.jsx(ls,{}):y&&((X=y==null?void 0:y.items)==null?void 0:X.length)>0?o.jsxs(o.Fragment,{children:[o.jsx(N.Table,{...I}),!m&&(y==null?void 0:y.pagination)&&y.pagination.totalPages>1&&o.jsx(N.Pager,{classname:{global:"row__end"},page:h,size:y.pagination.size,total:y.pagination.total,onChange:C}),m&&(y==null?void 0:y.pagination)&&o.jsx(N.Pager,{variant:"cursor",classname:{global:"row__end"},page:h,hasNextPage:!!y.pagination.hasMore,onChange:C})]}):o.jsx(N.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},_s={tabsPanel:"_tabsPanel_kvslb_1"},us=({userFlow:t,pageId:e,components:s})=>{const a=S(t,e,s);return a!=null&&a.length?o.jsx("section",{className:_s.tabsPanel,children:a.map((r,l)=>o.jsx(g.Fragment,{children:r},`tabs-panel-${l}`))}):null},hs=({userFlow:t,pageId:e,hash:s,items:a,activeIndex:r,className:l,responseKey:c})=>{const n=a.map((i,d)=>({label:i.label,disabled:i.disabled,children:o.jsx(us,{userFlow:t,pageId:e,components:i.components},`${s}-tab-${d}`)})),_=i=>{var u;const d={...(u=T.getState()[t])==null?void 0:u.entries,[c]:i};B(t,d)};return o.jsx(N.Tabs,{className:l,activeIndex:r,items:n,onClick:_})},oe=(t,e,s)=>{const a=T(l=>{var c,n;return(n=(c=l[t])==null?void 0:c.entries)==null?void 0:n[e]}),r=g.useCallback(l=>B(t,{[e]:l}),[t,e]);return[a??s,r]},fs={textareaNotFront:"_textareaNotFront_1wpe5_1"},ms=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,required:c,dependencies:n,..._}=t,{value:i,...d}=_,[u,h]=oe(e,l,i??""),{disabled:f}=G(e,n),y=(d==null?void 0:d.disabled)??f,j=g.useMemo(()=>c&&(d!=null&&d.label)?`${d.label} *`:(d==null?void 0:d.label)??"",[d==null?void 0:d.label,c]),b=m=>h(m.target.value);return o.jsx(N.Textarea,{...d,className:fs.textareaNotFront,label:j,value:u,disabled:y,onChange:m=>!y&&b(m)})},ys={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},xs=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,required:c,dependencies:n,..._}=t,{value:i,...d}=_,[u,h]=oe(e,l,i??""),{disabled:f}=G(e,n),y=(d==null?void 0:d.disabled)??f,j=g.useMemo(()=>c&&(d!=null&&d.label)?`${d==null?void 0:d.label} *`:(d==null?void 0:d.label)??"",[d==null?void 0:d.label,c]),b=m=>h(m.target.value);return o.jsx(N.TextField,{...d,className:ys.textFieldNotFront,allowClear:!1,label:j,value:u,disabled:y,onChange:m=>!y&&b(m)})},gs=({userFlow:t,pageId:e,responseKey:s,variant:a,content:r,actionType:l,redirectUrl:c})=>{const n=g.useCallback(async()=>{yt(t);try{switch(l){case"AUTOCLOSE_AND_REDIRECT":window.location.href=c;break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(_){console.error("Error in toast action:",_),alert(JSON.stringify(_))}},[l,e,s,t,c]);return g.useEffect(()=>{({info:N.toast.info,error:N.toast.error,success:N.toast.success,warning:N.toast.warning}[a]||N.toast.info)(r,{autoClose:l?!1:4e3,containerId:t,onClose:n})},[n,t]),null},re={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},ps=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,content:c,label:n,placement:_,notShowArrow:i,visible:d}=t,u=S(e,s,c!=null&&c.length?c:null),h=u&&u.length>0?o.jsx("div",{className:re.tooltipNotFront_content,children:u.map((f,y)=>o.jsx(g.Fragment,{children:f},`tooltip-${r}-${y}`))}):null;return o.jsx(N.Tooltip,{className:re.tooltipNotFront,label:n,placement:_,notShowArrow:i,visible:d,children:h})};function bs({sessionName:t,apiConfig:e,onResolveComponentProps:s,children:a}){const r=_e(t,e,null,s);return o.jsxs(o.Fragment,{children:[r,a]})}const js={api:"",headers:{}},ce=({userFlow:t,components:e,hash:s,apiConfig:a})=>{const r=s??`${t}-page`;g.useState(()=>{var _,i;return(i=(_=T.getState()[t])==null?void 0:_.pages)!=null&&i[r]||_t(t,a??js,{type:"page",hash:r,body:{components:e}}),null});const l=S(t,r,e);return o.jsx(o.Fragment,{children:l})};function le(t){if(t==null||typeof t!="object"||!("components"in t)||!Array.isArray(t.components))throw new Error("[renderNotFront] payload.display must be an object with a `components` array");return t.components}const ie=({payload:t,userFlow:e})=>{const s=le(t.display),a=ce({userFlow:e,hash:t.id,components:s});return o.jsx(o.Fragment,{children:a})},Cs=ie,de=(t,e,s,a,r)=>{const l=S(t,e,(a==null?void 0:a.components)||null,r);switch(s){case"body":return o.jsx(Ve,{...a,inputs:l||[]},JSON.stringify(a==null?void 0:a.components));case"header":return o.jsx(Gn,{...a,components:l||[]},JSON.stringify(a==null?void 0:a.components));default:return null}},_e=(t,e,s,a)=>{var b,m;const[r,l]=g.useState(!1),c=!!(e!=null&&e.api&&!s&&t),[n,_]=g.useState(c),i=T(x=>x[t]),d=i==null?void 0:i.currentPageId,u=(i==null?void 0:i.isLoading)??!1,h=n||u;g.useEffect(()=>{if(typeof window>"u")return;const x=new URL(window.location.href),p=x.searchParams.get("sessionId");p&&(mt(p),x.searchParams.delete("sessionId"),window.history.replaceState({},"",x.toString()))},[]);const f=d?de(t,d,"header",((b=i==null?void 0:i.pages[d].page)==null?void 0:b.header)||null,a):null,y=d?de(t,d,"body",((m=i==null?void 0:i.pages[d].page)==null?void 0:m.body)||null,a):null,j=async()=>{try{const x=await Vt(e,t),p=x==null?void 0:x.data,w=p==null?void 0:p.content;(x==null?void 0:x.status)===200?_t(t,e,w,p==null?void 0:p.sessionState,p==null?void 0:p.sessionId):l(!0)}catch(x){console.error("[not-page]: API call failed",x),l(!0)}finally{_(!1)}};return g.useEffect(()=>{e!=null&&e.api&&!s&&t?j():!(e!=null&&e.api)&&s&&t||e!=null&&e.api&&s&&t?_t(t,e,s):(!(e!=null&&e.api)&&!s||!t)&&(l(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const x="avocado-theme-mode-changed",p=w=>{const C=w.detail;N.ThemeStore.setThemeMode(C)};return window.addEventListener(x,p),()=>{window.removeEventListener(x,p)}},[]),r&&console.error("[not-page]: No render page"),o.jsxs(o.Fragment,{children:[h&&o.jsx(N.Loading,{}),f,y,d&&o.jsx(Xn,{userFlow:t,pageId:d}),i&&o.jsx(N.Toaster,{})]})};A.Chart=Ft,A.NotFrontPage=bs,A.RenderNotFront=ie,A.Row=te,A.clearSessionId=pe,A.extractNotFrontComponents=le,A.heading=Bt,A.renderNotFront=Cs,A.text=Kt,A.useNotFrontFragment=ce,A.usePage=_e,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
@@ -1,7 +1,8 @@
1
- import type { DataCardNotFrontProps } from '../../types';
2
- interface DataCardNotFrontExtendedProps extends DataCardNotFrontProps {
1
+ import type { DataCardNotFrontV1Props, DataCardNotFrontV2Props } from '../../types';
2
+ type WithNotFrontContext<T> = T & {
3
3
  userFlow: string;
4
4
  pageId: string;
5
- }
6
- declare const DataCardNotFront: (notFrontProps: DataCardNotFrontExtendedProps) => import("react/jsx-runtime").JSX.Element;
5
+ };
6
+ type DataCardNotFrontProps = WithNotFrontContext<DataCardNotFrontV1Props> | WithNotFrontContext<DataCardNotFrontV2Props>;
7
+ declare const DataCardNotFront: (notFrontProps: DataCardNotFrontProps) => import("react/jsx-runtime").JSX.Element;
7
8
  export default DataCardNotFront;
@@ -0,0 +1 @@
1
+ export {};
@@ -10,9 +10,8 @@ interface TextFieldNotFrontExtendedProps extends TextFieldNotFrontProps {
10
10
  /**
11
11
  * Renders a text field connected to the NotFront store.
12
12
  *
13
- * - Tracks local state.
13
+ * - Renders and writes `entries[responseKey]`; the JSON `value` is only a seed.
14
14
  * - Appends an asterisk to the label if the field is required.
15
- * - On change, updates the store (`updateEntries`) for a specific userFlow and pageId.
16
15
  *
17
16
  */
18
17
  declare const TextFieldNotFront: (notFrontProps: TextFieldNotFrontExtendedProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Reads the value of a `responseKey` from the store `entries` and writes it back
3
+ * through `updateEntries`, so the rendered value and the submitted payload cannot diverge.
4
+ *
5
+ * The seed is only a fallback while the key is absent from `entries`, and is never written
6
+ * on mount: the backend owns the value through `sessionState` and `deprecatedStateKeys`.
7
+ *
8
+ * @param userFlow - Identifier for the current user flow.
9
+ * @param responseKey - Key of the component inside `entries`.
10
+ * @param seed - JSON `value` of the node, used only while `responseKey` is absent.
11
+ */
12
+ export declare const useEntryValue: <T>(userFlow: string, responseKey: string, seed: T) => readonly [T, (next: T) => void];
@@ -0,0 +1 @@
1
+ export {};
@@ -6,7 +6,7 @@ export type PageStore = {
6
6
  export type UserFlow = {
7
7
  apiConfig: ApiConfig;
8
8
  currentPageId: string;
9
- entries?: {};
9
+ entries?: Record<string, unknown>;
10
10
  pages: Record<string, PageStore>;
11
11
  isLoading: boolean;
12
12
  overlay: OverlayContent | null;
@@ -39,7 +39,7 @@ export declare const setPage: (userFlow: string, response: NextUIResponseData) =
39
39
  * @param userFlow - The identifier for the current userFlow (e.g., 'piper-editor').
40
40
  * @param partial - A key-value map of new form entries to merge into the existing `entries` object.
41
41
  */
42
- export declare const updateEntries: (userFlow: string, partial: Record<string, any>) => void;
42
+ export declare const updateEntries: (userFlow: string, partial: Record<string, unknown>) => void;
43
43
  /**
44
44
  * Removes a single key from `entries` for a userFlow.
45
45
  */
@@ -1,4 +1,4 @@
1
- import { AccordionProps, ButtonProps, CardAccordionProps, CardNotificationProps, CheckboxProps, DividerProps, DrawerProps, HeadingProps, LinkProps, ModalProps, PillProps, PreviewerMarkdownProps, RoundButtonProps, SelectProps, SwitchProps, TableProps, TabsProps, TextareaProps, TextFieldProps, TextProps } from '../../../avocado-suite';
1
+ import { AccordionProps, ButtonProps, CardAccordionProps, CardNotificationProps, CheckboxProps, DataCardPaletteIndex, DataCardV2HeaderStyle, DataCardV2Status, DividerProps, DrawerProps, HeadingProps, LinkProps, ModalProps, PillProps, PreviewerMarkdownProps, RoundButtonProps, SelectProps, SwitchProps, TableProps, TabsProps, TextareaProps, TextFieldProps, TextProps } from '../../../avocado-suite';
2
2
  import type { AiAgentTheme, ChatPanelTranslations, SuggestionType, SupportedLocale } from '../../../ai-agent';
3
3
  import type { TooltipCoverageConfig } from '../components/chart/chart.types';
4
4
  import type { ChartSeriesConfig, ChartYAxisConfig } from '../components/chart/chart.types';
@@ -299,35 +299,58 @@ export interface PreviewerMarkdownNotFrontProps extends NotFrontBaseProps, Omit<
299
299
  }
300
300
  /** Mirrors suite `DataCard` variants. */
301
301
  export type DataCardVariant = 'success' | 'info' | 'warning' | 'error' | 'neutral';
302
+ interface DataCardNotFrontSharedProps extends NotFrontBaseProps {
303
+ component: 'dataCard';
304
+ icon?: string;
305
+ content?: NotFrontComponent[];
306
+ dependencies?: NotFrontDependency[];
307
+ disabled?: boolean;
308
+ }
302
309
  /**
303
- * Palette index for the DataCard header bar (1–17). Prefer integers in page JSON.
304
- * The wrapper also accepts legacy `palette_N_50` strings and author color names
305
- * (`sky`, …) and coerces unknown values to **1**; empty string omits the prop.
306
- */
307
- export type DataCardHeaderStatusPaletteIndex = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17;
308
- /**
309
- * Suite `DataCard`: JSON slots replace suite `children` / `topContent`.
310
+ * Suite `DataCard` v1: JSON slots replace suite `children` / `topContent`.
310
311
  * Body slot uses `content` only (`NotFrontComponent[]`); plain copy is a nested
311
312
  * `text` child. Top band uses `topContent`. Multiple items in a slot are stacked
312
313
  * in a not-front wrapper (column + gap `sm`); use a nested `row` for horizontal
313
314
  * groups. `className` is not part of the contract.
314
315
  */
315
- export interface DataCardNotFrontProps extends NotFrontBaseProps {
316
- component: 'dataCard';
316
+ export interface DataCardNotFrontV1Props extends DataCardNotFrontSharedProps {
317
+ version?: 'v1';
317
318
  title: string;
318
319
  variant: DataCardVariant;
319
320
  description?: string;
320
- icon?: string;
321
+ /** @deprecated v2: use `version: 'v2'` */
321
322
  hasTopBar?: boolean;
322
- /** Integer 1–17 preferred; string tokens / names coerced at runtime (invalid → 1). */
323
- headerStatusColor?: DataCardHeaderStatusPaletteIndex | number | string;
324
- /** Main body: nested not-front blocks (maps to suite `children`). */
325
- content?: NotFrontComponent[];
326
- /** Top band: nested blocks (maps to suite `topContent`). */
323
+ /**
324
+ * @deprecated v2: use `version: 'v2'` with `borderColor`.
325
+ * Palette index 1–17 for the header bar. The wrapper maps it to
326
+ * `palette_N_50` without validating: a value outside the range builds a class
327
+ * that does not exist and simply renders no color.
328
+ */
329
+ headerStatusColor?: DataCardPaletteIndex | number | string;
330
+ /** @deprecated v2: compose through `content` with `version: 'v2'` */
327
331
  topContent?: NotFrontComponent[];
328
- dependencies?: NotFrontDependency[];
329
- disabled?: boolean;
330
332
  }
333
+ /** Suite `DataCard` v2 — opt in with `version: 'v2'`. */
334
+ export interface DataCardNotFrontV2Props extends DataCardNotFrontSharedProps {
335
+ version: 'v2';
336
+ title?: string;
337
+ /** Accessible name when there is no `title`. Required if the block declares `actionType`. */
338
+ ariaLabel?: string;
339
+ status?: DataCardV2Status;
340
+ headerStyle?: DataCardV2HeaderStyle;
341
+ showBorder?: boolean;
342
+ /** Palette index 1–17 for the top border. Implies the border. */
343
+ borderColor?: DataCardPaletteIndex;
344
+ descriptionTop?: string;
345
+ descriptionBottom?: string;
346
+ /** Legacy — maps to `descriptionBottom` when that field is absent. */
347
+ description?: string;
348
+ pillLabel?: string;
349
+ actionType?: NotFrontActionType;
350
+ dataSource?: NotFrontDataSource;
351
+ redirectUrl?: string;
352
+ }
353
+ export type DataCardNotFrontProps = DataCardNotFrontV1Props | DataCardNotFrontV2Props;
331
354
  /**
332
355
  * Interface for the props used in the PillNotFront component.
333
356
  */
@@ -1338,3 +1361,4 @@ export type NotFrontComponentTypeMap = {
1338
1361
  toast: ToastNotFrontProps;
1339
1362
  tooltip: TooltipNotFrontProps;
1340
1363
  };
1364
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foris/avocado-not-front",
3
- "version": "5.2.7",
3
+ "version": "5.2.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -56,11 +56,11 @@
56
56
  "recharts": "3.1.0",
57
57
  "zustand": "4.5.4",
58
58
  "@uiw/react-codemirror": "4.23.12",
59
- "@foris/ai-agent": "1.1.4",
60
59
  "@foris/avocado-core": "1.3.2",
61
- "@foris/avocado-icons": "1.16.8",
62
- "@foris/avocado-suite": "1.8.21",
63
- "@foris/tsconfig": "0.0.2"
60
+ "@foris/ai-agent": "1.1.4",
61
+ "@foris/tsconfig": "0.0.2",
62
+ "@foris/avocado-suite": "1.8.22",
63
+ "@foris/avocado-icons": "1.16.8"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@codemirror/lang-json": ">=6.0.0",
@@ -79,9 +79,9 @@
79
79
  "streamdown": ">=1.6.0",
80
80
  "zustand": ">=4.0.0",
81
81
  "@foris/ai-agent": "1.1.4",
82
- "@foris/avocado-icons": "1.16.8",
83
- "@foris/avocado-suite": "1.8.21",
84
- "@foris/avocado-core": "1.3.2"
82
+ "@foris/avocado-core": "1.3.2",
83
+ "@foris/avocado-suite": "1.8.22",
84
+ "@foris/avocado-icons": "1.16.8"
85
85
  },
86
86
  "scripts": {
87
87
  "build": "tsc && vite build",