@foris/avocado-not-front 5.2.4 → 5.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(v,V){typeof exports=="object"&&typeof module<"u"?V(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"],V):(v=typeof globalThis<"u"?globalThis:v||self,V(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,V,de,x,N,ht,G,A,_e,Tt,ue,he,fe,At){"use strict";const ft="sessionId",me=()=>sessionStorage.getItem(ft),mt=t=>{t&&sessionStorage.setItem(ft,t)},ye=()=>{sessionStorage.removeItem(ft)},T=de.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}}}}})},vt=(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)))},ge=(t,e,s,a,c)=>{mt(s),T.setState(i=>{const l=i[t]??{},n=l.entries??{},d=vt(n,a,c);return{...i,[t]:{...l,currentPageId:e.hash,entries:d,isLoading:!1,overlay:null,pages:{...l.pages,[e.hash]:{page:{...e}}}}}})},xe=(t,e,s,a)=>{T.setState(c=>{var o;const i=c[t]??{},l=i.entries??{},n=vt(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}}))},pe=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"?ge(t,s,a,c,i):xe(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}}}})},be=(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}}))},gt=(t,e)=>{T.setState(s=>({...s,[t]:{...s[t],isModalOpen:e}}))},ot=(t,e)=>{T.setState(s=>({...s,[t]:{...s[t],isDrawerOpen:e}}))},St=(t,e)=>{T.setState(s=>{const a=s[t];return a?{...s,[t]:{...a,apiConfig:{...a.apiConfig,headers:e}}}:s})};let xt=!1,_t=[],Ot=!1;const je=t=>t._userFlow||null,Rt=t=>{_t.forEach(({resolve:e,reject:s})=>{t?s(t):e(void 0)}),_t=[]},Ce=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=je(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(xt)return new Promise((o,_)=>{_t.push({resolve:o,reject:_})}).then(()=>V(e)).catch(o=>(console.error("[axiosInterceptors] Queued request failed:",o),Promise.reject(o)));e._retry=!0,xt=!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"?St(i,JSON.stringify(o)):St(i,o)),e.headers||(e.headers={}),Object.assign(e.headers,o),Rt(null),V(e)}catch(o){return console.error("[axiosInterceptors] Token refresh failed:",o),console.error("[axiosInterceptors] Rejecting queued requests:",_t.length),Rt(o),Promise.reject(o)}finally{xt=!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(Ot){console.debug("[axiosInterceptors] Interceptors already initialized, skipping");return}console.debug("[axiosInterceptors] Initializing interceptors..."),V.interceptors.response.use(void 0,Ce),console.debug("[axiosInterceptors] Response error interceptor registered"),Ot=!0,console.debug("[axiosInterceptors] Interceptors initialized successfully")})();function we(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pt={exports:{}},rt={};/**
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,x,N,ht,G,A,he,At,fe,me,ye,vt){"use strict";const ft="sessionId",ge=()=>sessionStorage.getItem(ft),mt=t=>{t&&sessionStorage.setItem(ft,t)},xe=()=>{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}}))},gt=(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 xt=!1,_t=[],Rt=!1;const we=t=>t._userFlow||null,Dt=t=>{_t.forEach(({resolve:e,reject:s})=>{t?s(t):e(void 0)}),_t=[]},Ne=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=we(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(xt)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,xt=!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{xt=!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,Ne),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={};/**
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 Dt;function Ne(){if(Dt)return rt;Dt=1;var t=x,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 It;function ke(){return It||(It=1,pt.exports=Ne()),pt.exports}var r=ke();const Lt=t=>{if(!(t!=null&&t.content))return null;const e={...t,children:t.content,type:t.variant};return r.jsx(N.Heading,{...e})},Mt=t=>{if(!t)return null;const e={...t,children:t.content};return r.jsx(N.Text,{...e})},S=(t,e,s,a)=>{var l;const c={accordion:n=>r.jsx(Re,{...n,userFlow:t,pageId:e}),aiChatPanel:n=>r.jsx(De,{...n,userFlow:t,pageId:e,onResolveProps:a==null?void 0:a.aiChatPanel}),aiSummaryCard:n=>r.jsx(Ke,{...n,userFlow:t,pageId:e,onResolveProps:a==null?void 0:a.aiSummaryCard}),aiPromptCodeEditor:n=>r.jsx(Le,{...n,userFlow:t,pageId:e}),box:n=>r.jsx(He,{...n,userFlow:t,pageId:e}),breadcrumbs:n=>r.jsx(We,{...n,userFlow:t,pageId:e}),tooltip:n=>r.jsx(is,{...n,userFlow:t,pageId:e}),textarea:n=>r.jsx(os,{...n,userFlow:t,pageId:e}),card:n=>r.jsx(Ze,{...n,userFlow:t,pageId:e}),dropdownButton:n=>r.jsx(On,{...n,userFlow:t,pageId:e}),menu:n=>r.jsx(In,{...n,userFlow:t,pageId:e}),radioGroup:n=>r.jsx(Ve,{...n,userFlow:t,pageId:e}),stepper:n=>r.jsx(Xe,{...n,userFlow:t,pageId:e}),progressBar:n=>r.jsx(Je,{...n,userFlow:t,pageId:e}),button:n=>r.jsx(qe,{...n,userFlow:t,pageId:e}),cardAccordion:n=>r.jsx(Ye,{...n,userFlow:t,pageId:e}),cardNotification:n=>r.jsx(Fe,{...n}),chart:n=>r.jsx(Qt,{...n,userFlow:t}),dataCard:n=>r.jsx(Tn,{...n,userFlow:t,pageId:e}),checkbox:n=>r.jsx(kn,{...n,userFlow:t,pageId:e}),code:n=>r.jsx(En,{...n,userFlow:t,pageId:e}),divider:n=>r.jsx(vn,{...n}),drawer:n=>r.jsx(Sn,{...n,userFlow:t,pageId:e}),heading:n=>Lt(n),link:n=>r.jsx(Dn,{...n,userFlow:t,pageId:e}),pill:n=>r.jsx(Gn,{...n}),previewerMarkdown:n=>r.jsx(Hn,{...n}),modal:n=>r.jsx(Mn,{...n,userFlow:t,pageId:e}),roundButton:n=>r.jsx(Un,{...n,userFlow:t,pageId:e}),row:n=>r.jsx(Pt,{...n,userFlow:t,pageId:e}),select:n=>r.jsx(Yn,{...n,userFlow:t,pageId:e}),switch:n=>r.jsx(Zn,{...n,userFlow:t,pageId:e}),spacing:n=>r.jsx(Qn,{...n,userFlow:t,pageId:e}),table:n=>r.jsx(es,{...n,userFlow:t,pageId:e}),tabs:n=>r.jsx(as,{...n,userFlow:t,pageId:e}),text:n=>Mt(n),textField:n=>r.jsx(cs,{...n,userFlow:t,pageId:e}),toast:n=>r.jsx(ls,{...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 Ee(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)}function Kt(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(Ee(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 x.useMemo(()=>({disabled:Kt(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,Te=(t,e={},s={},a=!1,c)=>{const i=ct();a&&i.abort();const l=Z(e);return{call:V.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:V.post(t,s,{headers:{...n},params:a,signal:l.signal,_userFlow:i}),controller:l}},Ae=(t,e={},s={},a={},c=!1,i)=>{const l=ct();c&&l.abort();const n=Z(e);return{call:V.put(t,s,{headers:{...n},params:a,signal:l.signal,_userFlow:i}),controller:l}},ve=(t,e={},s={},a={},c=!1,i)=>{const l=ct();c&&l.abort();const n=Z(e);return{call:V.patch(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:V.delete(t,{headers:{...n},data:s,params:a,signal:l.signal,_userFlow:i}),controller:l}},Bt=()=>{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()}}},Gt=async(t,e,s="",a={},c={})=>{try{const{callEndpoint:i}=Bt(),{api:l,headers:n}=t,d=me(),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)}},Ht=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"}},Oe=(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=Oe(t,e,s),_={...(t==null?void 0:t.data)??{},...a??{}};return{type:"rest",url:d,method:Ht(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}}},z=()=>{const t=T(n=>n),{callEndpoint:e}=Bt(),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 Gt(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(Ht(n.method)){case"post":return bt(o,_,u,{},!1,d);case"put":return Ae(o,_,u,{},!1,d);case"patch":return ve(o,_,u,{},!1,d);case"delete":return Se(o,_,u,h,!1,d);case"get":default:return Te(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}}}},Ut={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},Re=t=>{const{userFlow:e,pageId:s,responseKey:a,dependencies:c,customContent:i,actionContent:l,components:n,...d}=t,{getNextUI:o}=z(),[_,u]=x.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=x.useCallback(async b=>{var w;try{const C=b.target.checked;u(C);const k={...(w=T.getState()[e])==null?void 0:w.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,g={...d,className:Ut.accordion,disabled:m,checkboxChecked:_,onChanceCheckbox:d.hasCheckbox?p:void 0,actionContent:y?r.jsx(r.Fragment,{children:y.map((b,w)=>r.jsx(x.Fragment,{children:b},`accordion-action-${w}`))}):void 0,customContent:j?r.jsx(r.Fragment,{children:j.map((b,w)=>r.jsx(x.Fragment,{children:b},`accordion-custom-${w}`))}):void 0,children:f?r.jsx("section",{className:Ut.accordionBody,children:f.map((b,w)=>r.jsx(x.Fragment,{children:b},`accordion-child-${w}`))}):void 0};return r.jsx(N.Accordion,{...g})},De=t=>{const e=N.ThemeStore.useThemeStore(l=>l.theme.mode),s=t.dataSource,a=x.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=x.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 x.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})},Ie={promptCodeEditor:"_promptCodeEditor_1d57s_1"},Le=t=>{const{userFlow:e,responseKey:s,codeBlockValue:a,language:c,disabled:i,dependencies:l,dataSource:n,inputLabel:d,inputPlaceholder:o,codeBlockLabel:_}=t,u=N.ThemeStore.useThemeStore(b=>b.theme.mode),[h,f]=x.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},g=b=>{f(b);const w={[s]:b};L(e,w)};return x.useEffect(()=>{a!==void 0&&a!==h&&f(a)},[a]),r.jsx("section",{className:Ie.promptCodeEditor,children:r.jsx(ht.PromptCodeEditor,{themeMode:u,requestConfig:m,language:p,disabled:j,inputLabel:d,inputPlaceholder:o,codeBlockLabel:_,codeBlockValue:h,onCodeChange:g})})},Me={summaryCard:"_summaryCard_jva4h_1"},Ke=t=>{const e=t.dataSource,s=x.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=x.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 x.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:s,locale:a,translations:c})},[t.onResolveProps,s,a,c]),t.onResolveProps?null:r.jsx("section",{className:Me.summaryCard,children:r.jsx(ht.SummaryCard,{dataSource:s,locale:a,translations:c})})},zt={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},Be=({inputs:t})=>r.jsx("section",{className:zt.body,children:r.jsx("div",{className:zt.body_content,children:t.map((e,s)=>r.jsx(x.Fragment,{children:e},s))})}),Ge={slotStack:"_slotStack_1b4wy_1"},He=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,content:l}=t,n=N.ThemeStore.useThemeStore(_=>_.theme.mode)==="dark",d=S(e,s,l!=null&&l.length?l:null),o=d&&d.length>0?r.jsx("div",{className:Ge.slotStack,children:d.map((_,u)=>r.jsx(x.Fragment,{children:_},`box-${c}-${u}`))}):null;return r.jsx(N.Box,{darkMode:n,children:o})};var Ct={exports:{}};/*!
9
+ */var It;function Ee(){if(It)return rt;It=1;var t=x,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(N.Heading,{...e})},Kt=t=>{if(!t)return null;const e={...t,children:t.content};return r.jsx(N.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(us,{...n,userFlow:t,pageId:e}),textarea:n=>r.jsx(ls,{...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(ds,{...n,userFlow:t,pageId:e}),toast:n=>r.jsx(_s,{...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 x.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=ge(),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]=x.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=x.useCallback(async b=>{var w;try{const C=b.target.checked;u(C);const k={...(w=T.getState()[e])==null?void 0:w.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,g={...d,className:Vt.accordion,disabled:m,checkboxChecked:_,onChanceCheckbox:d.hasCheckbox?p:void 0,actionContent:y?r.jsx(r.Fragment,{children:y.map((b,w)=>r.jsx(x.Fragment,{children:b},`accordion-action-${w}`))}):void 0,customContent:j?r.jsx(r.Fragment,{children:j.map((b,w)=>r.jsx(x.Fragment,{children:b},`accordion-custom-${w}`))}):void 0,children:f?r.jsx("section",{className:Vt.accordionBody,children:f.map((b,w)=>r.jsx(x.Fragment,{children:b},`accordion-child-${w}`))}):void 0};return r.jsx(N.Accordion,{...g})},Le=t=>{const e=N.ThemeStore.useThemeStore(l=>l.theme.mode),s=t.dataSource,a=x.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=x.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 x.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=N.ThemeStore.useThemeStore(b=>b.theme.mode),[h,f]=x.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},g=b=>{f(b);const w={[s]:b};L(e,w)};return x.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:g})})},Be={summaryCard:"_summaryCard_jva4h_1"},Ge=t=>{const e=t.dataSource,s=x.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=x.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 x.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(x.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=N.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(x.Fragment,{children:_},`box-${c}-${u}`))}):null;return r.jsx(N.Box,{className:Xt.boxNotFront,darkMode:n,children:o})};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 Vt;function Ue(){return Vt||(Vt=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=Ue();const F=we(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"},Ve=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}=z(),{disabled:f}=H(e,d),y=T(b=>{var w,C;return(C=(w=b[e])==null?void 0:w.entries)==null?void 0:C[a]}),j=y!=null?String(y):i??"",p=f,m=x.useMemo(()=>c?l?`${c} *`:c:null,[c,l]),g=x.useCallback(async b=>{var w;if(!p)try{const C={...(w=T.getState()[e])==null?void 0:w.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(N.RadioButton,{name:a,value:b.value,checked:j===b.value,disabled:p||b.disabled,labelRight:b.label,onChange:()=>{g(b.value)}},b.value))})]})},Xe=({userFlow:t,pageId:e,component:s,hash:a,responseKey:c,items:i,itemActive:l,darkMode:n})=>r.jsx(N.Stepper,{items:i,itemActive:l,darkMode:n}),Je=({userFlow:t,pageId:e,component:s,hash:a,responseKey:c,total:i,done:l,inProgress:n})=>r.jsx(N.ProgressBar,{total:i,done:l,inProgress:n}),We=({userFlow:t,items:e,responseKey:s})=>{const{getNextUI:a}=z(),c=x.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=x.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(N.Breadcrumbs,{items:i})};function ut(t,e){const{getNextUI:s,fetchDataSource:a,fetchAndGetNextUI:c}=z();return x.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(!Kt(u,_))try{const p={...(f=T.getState()[t])==null?void 0:f.entries,[l]:{status:200}};switch(L(t,p),n){case"CLOSE_MODAL":gt(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),g=(y=m==null?void 0:m.data)==null?void 0:y.content;if((g==null?void 0:g.type)!=="fetch")break;const b=g==null?void 0:g.dataSource,w=await a(b,t,!1),C={...(j=T.getState()[t])==null?void 0:j.entries,[l]:{status:w==null?void 0:w.status,content:w==null?void 0:w.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 qe=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]=x.useState(!1),g=x.useRef(!1),b=x.useCallback(async()=>{if(g.current)return;const w=c==="FETCH_DATA_SOURCE";w&&(g.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{w&&(g.current=!1,m(!1))}},[c,n,o,d,a,h]);return r.jsx(N.Button,{...y,loading:y.loading||p,disabled:j,onClick:()=>!j&&!p&&(_??b)()})},Xt={slotStack:"_slotStack_12u4t_5"},Ye=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:Xt.slotStack,children:u.map((p,m)=>r.jsx(x.Fragment,{children:p},`card-accordion-body-${c}-${m}`))}):void 0,y=h&&h.length>0?r.jsx("div",{className:Xt.slotStack,children:h.map((p,m)=>r.jsx(x.Fragment,{children:p},`card-accordion-actions-${c}-${m}`))}):void 0,j=o.disabled||_;return r.jsx(N.CardAccordion,{...o,disabled:j,actionContent:y,children:f??null})},Qe={slotStack:"_slotStack_ivk5b_1"},Ze=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}=z(),{disabled:p}=H(e,h),m=d??p,g=S(e,s,l&&l.length>0?l:null),b=g&&g.length>0?r.jsx("div",{className:Qe.slotStack,children:g.map((C,k)=>r.jsx(x.Fragment,{children:C},`card-body-${c}-${k}`))}):null,w=x.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":gt(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(N.Card,{colorId:n,disabled:m,onClick:o&&!m?()=>void w():void 0,children:b})},Fe=t=>{const{content:e,description:s,...a}=t,c={...a,children:e??s};return r.jsx(N.CardNotification,{...c})},wt=t=>Array.isArray(t)?t:typeof t=="object"?JSON.stringify(t):t,Pe=(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}},Jt=(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"}})},$e=({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($e,{...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}),tn=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))]})},en=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 Wt={NODE_ENV:"production"};const nn=(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"}))},sn=(t,e)=>{!t.type&&Wt.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}},an=t=>{const{data:e,xKey:s,series:a=[],tooltipKey:c,width:i,showLegend:l=!0,yAxes:n}=t;!a.length&&Wt.NODE_ENV;const d=nn(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,_)=>sn(o,_))]})},on="55%",rn=120,cn=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,g=a+(n+30)*j,b=c+(n+30)*y,w=g+(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${g},${b}L${w},${C}`,stroke:_,fill:"none"}),r.jsx("circle",{cx:w,cy:C,r:2,fill:_,stroke:"none"}),r.jsx("text",{x:w+(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:w+(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)}%)`})]})},ln=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:c,innerRadius:i=on,outerRadius:l=rn,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?cn(s):void 0,children:e.map((u,h)=>r.jsx(A.Cell,{fill:I[h%I.length]},`cell-${h}`))})]})})};function dn(t,e,s=qt){return t<=0?0:e<=0?t:Math.max(t,e*s)}function _n(t,e=xn,s){return s!==void 0?s:t<=0?et:Math.max(et,t*e)}function un(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(pn,a*bn)}const hn=t=>{const{data:e,yKeys:s,xKey:a,tooltipKey:c,minCategoryHeight:i,chartHeight:l,tooltipCoverage:n,showLegend:d=!0,yKeyLabels:o,yAxisWidth:_}=t,u=_n(e.length,i,l),h=un(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))]})},fn=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 mn={NODE_ENV:"production"};const yn=t=>{const{data:e,xKey:s,series:a=[],tooltipKey:c,width:i}=t;return!a.length&&mn.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,qt=56,xn=28,pn=100,bn=8,jn=new Set(["bar","line","area","mixBar","composed"]),Cn={area:tn,bar:en,composed:an,donut:ln,horizontalBar:hn,line:fn,mixBar:yn,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"},Yt={chartScrollViewport:"_chartScrollViewport_sm5hx_1",chartScrollViewport_track:"_chartScrollViewport_track_sm5hx_29"},wn="Scrollable chart area",Nn=({dataLength:t,minCategoryWidth:e,children:s})=>{const a=x.useRef(null),[c,i]=x.useState(0),l=e??qt;x.useEffect(()=>{const _=a.current;if(!_)return;const u=()=>{i(_.clientWidth)};u();const h=new ResizeObserver(u);return h.observe(_),()=>h.disconnect()},[]);const n=dn(c,t,l),d=c>0&&n>c,o=x.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:Yt.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:Yt.chartScrollViewport_track,style:{width:n,height:et},children:c>0?s(n):null})})},Qt=t=>{const{component:e,userFlow:s,hash:a,responseKey:c,dataSource:i,...l}=t,n=Cn[l.type],{fetchDataSource:d}=z(),[o,_]=x.useState(!1),[u,h]=x.useState([]),f=async()=>{var p,m;try{_(!0);const{jsonPathData:g,mapperData:b}=i,w=jt(i,1),C=await d(w,s,!1),k=g?(p=Jt(C==null?void 0:C.data,g,b))==null?void 0:p.items:(m=C==null?void 0:C.data)==null?void 0:m.data;h(k),_(!1)}catch(g){alert(JSON.stringify(g)),_(!1)}};if(x.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(N.SkeletonBase,{height:400}):u.length===0?r.jsx(N.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):jn.has(l.type)?r.jsx(Nn,{dataLength:u.length,minCategoryWidth:l.minCategoryWidth,children:p=>r.jsx(n,{...y,width:p})}):r.jsx(n,{...y})},kn=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:c,label:i,value:l,required:n,dependencies:d,...o}=t,_={...o},{getNextUI:u}=z(),[h,f]=x.useState(l||!1),{disabled:y}=H(e,d),j=x.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),p=x.useCallback(async()=>{var g;try{const b=!h;f(b);const w={...(g=T.getState()[e])==null?void 0:g.entries,[a]:b};switch(L(e,w),c){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,w,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(N.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"},En=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]=x.useState(l??""),y=N.ThemeStore.useThemeStore(w=>w.theme.mode),{disabled:j}=H(e,d),p=o??j,m={json:Tt.json(),markdown:ue.markdown(),sql:he.sql(),yaml:fe.yaml()},g=x.useMemo(()=>n&&a?`${a} *`:a??"",[a,n]),b=w=>{f(w);const C={[s]:w};L(e,C)};return r.jsxs("div",{className:nt.codeEditor,children:[g&&g!==""&&r.jsx("label",{className:nt.codeEditor_label,children:g}),r.jsxs("div",{className:nt.codeEditor_wrapper,children:[r.jsx(_e,{className:nt.input,value:h,height:u,placeholder:i,extensions:[m[c]??Tt.json()],onChange:w=>b(w),theme:y,editable:!p}),c==="markdown"&&_&&r.jsx("div",{className:nt.preview,style:{height:u},children:r.jsx(N.PreviewerMarkdown,{className:nt.preview_inner,children:h})})]})]})},Zt={slotStack:"_slotStack_6n2wy_5"},Tn=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:Zt.slotStack,children:h.map((p,m)=>r.jsx(x.Fragment,{children:p},`data-card-body-${c}-${m}`))}):void 0,j=f&&f.length>0?r.jsx("div",{className:Zt.slotStack,children:f.map((p,m)=>r.jsx(x.Fragment,{children:p},`data-card-top-${c}-${m}`))}):void 0;return r.jsx(N.DataCard,{..._,icon:d,headerStatusColor:u,topContent:j,children:y})},An={dividerNotFront:"_dividerNotFront_tze3j_1"},vn=t=>r.jsx(N.Divider,{...t,className:An.dividerNotFront}),Nt={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},Sn=({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=x.useCallback(()=>{yt(t),ot(t,!1)},[t]),h=Array.isArray(a)?S(t,e,a):a?r.jsx(N.Heading,{type:"h2",children:a}):void 0,f=S(t,e,c),y=i?S(t,e,i):void 0;return r.jsx(N.Drawer,{..._,className:Nt.drawer,isOpen:o,onClose:u,heightGap:50,title:h?r.jsx(r.Fragment,{children:Array.isArray(h)?h.map((p,m)=>r.jsx(x.Fragment,{children:p},`drawer-header-${m}`)):h}):void 0,children:r.jsx("section",{className:Nt.drawerBody,children:f.map((p,m)=>r.jsx(x.Fragment,{children:p},`drawer-body-${m}`))}),footer:y?r.jsx("div",{className:Nt.drawerFooter,children:y.map((p,m)=>r.jsx(x.Fragment,{children:p},`drawer-footer-${m}`))}):void 0})},On=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=x.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(N.DropdownButton,{disabled:d,variant:o,items:f,children:r.jsxs(x.Fragment,{children:[_?r.jsx(At.Icon,{name:_,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,l,u?r.jsx(At.Icon,{name:u,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},Ft={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},Rn=({components:t=[]})=>r.jsx("section",{className:F(Ft.header,"avocado-dark-theme"),children:r.jsx("div",{className:Ft.header_content,children:t.map((e,s)=>r.jsx(x.Fragment,{children:e},s))})}),Dn=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}=z(),{disabled:f}=H(e,d),y=c&&u?(()=>{const{href:m,target:g,download:b,...w}=u;return w})():u,j=x.useCallback(async()=>{var m;if(c)try{const g={...(m=T.getState()[e])==null?void 0:m.entries,[a]:{status:200}};switch(L(e,g),c){case"GO_TO_NEXT_UI":{const b=await h(e,s,g,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(g){alert(JSON.stringify(g))}},[c,h,s,l,a,n,e]),p=y.disabled??f;return r.jsx(N.Link,{...y,disabled:p,onClick:c?j:void 0,children:i})},In=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=x.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(N.Menu,{items:f,closeOnClick:n,disabled:d,listOrigin:o,size:_,variant:u})},Ln={modalContent:"_modalContent_p06ci_1"},Mn=({userFlow:t,pageId:e,responseKey:s,header:a,body:c,footer:i,headerStatusColor:l,...n})=>{const d=T(m=>{var g;return(g=m[t])==null?void 0:g.isModalOpen}),o=T(m=>{var g;return(g=m[t])==null?void 0:g.isLoading}),_=d&&!o,u={...n},h=(u==null?void 0:u.headerStatusColor)??l,f=x.useCallback(()=>{yt(t),gt(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(N.Modal,{...u,headerStatusColor:h,header:typeof y=="string"?y:r.jsx(r.Fragment,{children:y.map((m,g)=>r.jsx(x.Fragment,{children:m},`modal-header-${g}`))}),children:r.jsx("section",{className:Ln.modalContent,children:j.map((m,g)=>r.jsx(x.Fragment,{children:m},`modal-body-${g}`))}),actions:r.jsx(r.Fragment,{children:p.map((m,g)=>r.jsx(x.Fragment,{children:m},`modal-footer-${g}`))}),open:_,onClose:f})},Kn=({userFlow:t,pageId:e})=>{var i,l;const s=pe(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(x.Fragment,{children:n},o)})})},Bn={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"}},Gn=t=>{const{content:e,variant:s="neutral",...a}=t,c=Bn[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(N.Pill,{...i})},Hn=t=>{const{content:e}=t;return r.jsx(N.PreviewerMarkdown,{children:e})},Un=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]=x.useState(!1),j=x.useRef(!1),p=x.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(g){console.error("[RoundButtonNotFront] Action failed:",g)}finally{m&&(j.current=!1,y(!1))}},[c,i,l,a,o]);return r.jsx(N.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"},Pt=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 $t({userFlow:t,pageId:e,responseKey:s,actionType:a,getNextUI:c,isMulti:i=!1,debounceMs:l}){const n=x.useRef(null);x.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=x.useCallback(async _=>{var f;const u={...(f=T.getState()[t])==null?void 0:f.entries};if(_?(u[s]=_,L(t,u)):(delete u[s],be(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 x.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 zn=/\{([^}]+)\}/g,Vn=(t,e)=>{var s;return e.includes("{")?e.replace(zn,(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]},Xn=(t,e,s,a)=>{const c=G.query(t,e);return(c==null?void 0:c.map(i=>{var d;const l=Vn(i,s),n=a?(d=G.query(i,a))==null?void 0:d[0]:i;return{label:l,value:n}}))??[]},Jn=(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}},te={selectNotFront:"_selectNotFront_ch3v5_1"},Wn=({userFlow:t,pageId:e,responseKey:s,required:a,dataSource:c,actionType:i,dependencies:l,debounceMs:n,...d})=>{const o={...d},{getNextUI:_,fetchDataSource:u}=z(),[h,f]=x.useState((o==null?void 0:o.value)??""),{disabled:y}=H(t,l),j=(o==null?void 0:o.disabled)??y,p=x.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=x.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]),g=$t({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:o==null?void 0:o.isMulti,debounceMs:n}),b=C=>{f(C),g(C)},w=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?Xn(U,M,R,K):[],{hasMore:kt}=Jn(U,E,st);return{options:lt,hasMore:kt,additional:{page:E+1}}};return r.jsx(N.SelectPagination,{...o,className:te.selectNotFront,label:p,value:h,disabled:j,noOptionsMessage:()=>r.jsx(r.Fragment,{children:"Sin opciones"}),onChange:C=>!j&&b(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})},qn=({userFlow:t,pageId:e,responseKey:s,dataSource:a,required:c,actionType:i,dependencies:l,debounceMs:n,...d})=>{const o={...d},{getNextUI:_}=z(),[u,h]=x.useState(o.value||""),{disabled:f}=H(t,l),y=(o==null?void 0:o.disabled)??f,j=x.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=$t({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:o==null?void 0:o.isMulti,debounceMs:n}),m=g=>{h(g),p(g)};return r.jsx(N.Select,{...o,className:te.selectNotFront,label:j,value:u,disabled:y,onChange:g=>!y&&m(g)})},Yn=t=>{const{dataSource:e}=t;return e?r.jsx(Wn,{...t}):r.jsx(qn,{...t})},ee={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"},Qn=t=>{const{size:e}=t,s=F(ee.spacing,ee[`spacing__${e}`]);return r.jsx("div",{className:s})},Zn=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:c,label:i,value:l,required:n,dependencies:d,...o}=t,_={...o},{getNextUI:u}=z(),[h,f]=x.useState(l||!1),{disabled:y}=H(e,d),j=(_==null?void 0:_.disabled)??y,p=x.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),m=x.useCallback(async()=>{var g;try{const b=!h;f(b);const w={...(g=T.getState()[e])==null?void 0:g.entries,[a]:b};switch(L(e,w),c){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,w,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(N.Switch,{..._,label:p,checked:h,disabled:j,onChange:()=>!j&&m()})},ne={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},Fn=({values:t})=>{const s=t==null?void 0:t.slice(0,4),a=(t==null?void 0:t.length)-4;return r.jsxs("div",{className:ne.tableArrayPills,children:[s.map((c,i)=>r.jsx(N.Pill,{children:String(c)},i)),a>0&&r.jsxs(N.Pill,{outlined:!0,children:["+",a]})]})},Pn=({userFlow:t,pageId:e,tableResponseKey:s,component:a,rowData:c})=>{const{getNextUI:i,fetchAndGetNextUI:l,fetchDataSource:n}=z(),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=x.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 g=await i(t,e,m,u);g!=null&&g.data&&B(t,g==null?void 0:g.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const g=await l(t,e,m,u,h);g!=null&&g.data&&B(t,g==null?void 0:g.data);break}case"GET_DATA_SOURCE":{const g=await i(t,e,m,u),b=(j=g==null?void 0:g.data)==null?void 0:j.content;if((b==null?void 0:b.type)!=="fetch")break;const w=b==null?void 0:b.dataSource,C=await n(w,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 x.cloneElement(o,{onClick:f})},$n=()=>r.jsx("div",{className:ne.tableSkeleton,children:[...Array(10)].map((t,e)=>r.jsx(N.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),ts=(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(Fn,{values:i}):i??""}}:s),es=({userFlow:t,pageId:e,responseKey:s,component:a,dataSource:c,rightActions:i,data:l,pageSize:n,...d})=>{var st,X;const{fetchDataSource:o}=z(),[_,u]=x.useState(!1),[h,f]=x.useState(1),[y,j]=x.useState(null),p=!c&&Array.isArray(l),m=!!(c!=null&&c.jsonPathCursorPagination)&&!!((st=c==null?void 0:c.jsonPathPagination)!=null&&st.hasMore),g=x.useRef(new Map([[1,null]])),b=x.useMemo(()=>{if(i!=null&&i.length)return i.map((D,U)=>({renderContent:lt=>r.jsx(Pn,{userFlow:t,pageId:e,tableResponseKey:s,component:D,rowData:lt},`tableRowAction${U}`)}))},[i,t,e,s]),w=async(D=1)=>{if(!c)return;const{mapperData:U,jsonPathData:lt,jsonPathPagination:kt,jsonPathCursorPagination:it}=c;if(it&&D!==1&&!g.current.has(D)){f(1),w(1);return}it&&D===1&&(g.current=new Map([[1,null]]));try{u(!0);const Et=it?g.current.get(D)??null:null,hs=jt(c,D,void 0,Et),at=await o(hs,t,!1);if(j(Jt(at==null?void 0:at.data,lt,U,kt)),it){const ie=Pe(at==null?void 0:at.data,it);ie&&g.current.set(D+1,ie)}u(!1)}catch(Et){console.error("[TableNotFront] fetchData:",Et),u(!1)}},C=D=>{f(D),w(D)};x.useEffect(()=>{p||w()},[]);const k=p?l:y==null?void 0:y.items,E=p&&!!n&&((l==null?void 0:l.length)??0)>n,R=x.useMemo(()=>{if(!E||!l||!n)return k??[];const D=(h-1)*n;return l.slice(D,D+n)},[E,l,n,h,k]),M=x.useMemo(()=>ts(d.columns,k),[k,d.columns]),K={...d,data:R,columns:M??[],rightActions:b};return p?!k||k.length===0?r.jsx(N.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):r.jsxs(r.Fragment,{children:[r.jsx(N.Table,{...K}),E&&n&&l&&r.jsx(N.Pager,{classname:{global:"row__end"},page:h,size:n,total:l.length,onChange:f})]}):r.jsx(r.Fragment,{children:_?r.jsx($n,{}):y&&((X=y==null?void 0:y.items)==null?void 0:X.length)>0?r.jsxs(r.Fragment,{children:[r.jsx(N.Table,{...K}),!m&&(y==null?void 0:y.pagination)&&y.pagination.totalPages>1&&r.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)&&r.jsx(N.Pager,{variant:"cursor",classname:{global:"row__end"},page:h,hasNextPage:!!y.pagination.hasMore,onChange:C})]}):r.jsx(N.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},ns={tabsPanel:"_tabsPanel_kvslb_1"},ss=({userFlow:t,pageId:e,components:s})=>{const a=S(t,e,s);return a!=null&&a.length?r.jsx("section",{className:ns.tabsPanel,children:a.map((c,i)=>r.jsx(x.Fragment,{children:c},`tabs-panel-${i}`))}):null},as=({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(ss,{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(N.Tabs,{className:i,activeIndex:c,items:n,onClick:d})},os=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,required:l,dependencies:n,...d}=t,o={...d},[_,u]=x.useState((o==null?void 0:o.value)??""),{disabled:h}=H(e,n),f=(o==null?void 0:o.disabled)??h,y=x.useMemo(()=>l&&(o!=null&&o.label)?`${o.label} *`:(o==null?void 0:o.label)??"",[o==null?void 0:o.label,l]),j=p=>{var g;const m=(g=p==null?void 0:p.target)==null?void 0:g.value;u(m),L(e,{[i]:m})};return x.useEffect(()=>{u((o==null?void 0:o.value)??"")},[o==null?void 0:o.value]),r.jsx(N.Textarea,{...o,label:y,value:_,disabled:f,onChange:p=>!f&&j(p)})},rs={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},cs=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,required:l,dependencies:n,...d}=t,o={...d},[_,u]=x.useState((o==null?void 0:o.value)??""),{disabled:h}=H(e,n),f=(o==null?void 0:o.disabled)??h,y=x.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 g={[i]:m};L(e,g)};return x.useEffect(()=>{u((o==null?void 0:o.value)??"")},[o==null?void 0:o.value]),r.jsx(N.TextField,{...o,className:rs.textFieldNotFront,allowClear:!1,label:y,value:_,disabled:f,onChange:p=>!f&&j(p)})},ls=({userFlow:t,pageId:e,responseKey:s,variant:a,content:c,actionType:i,redirectUrl:l})=>{const n=x.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 x.useEffect(()=>{({info:N.toast.info,error:N.toast.error,success:N.toast.success,warning:N.toast.warning}[a]||N.toast.info)(c,{autoClose:i?!1:4e3,containerId:t,onClose:n})},[n,t]),null},se={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},is=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:se.tooltipNotFront_content,children:u.map((f,y)=>r.jsx(x.Fragment,{children:f},`tooltip-${c}-${y}`))}):null;return r.jsx(N.Tooltip,{className:se.tooltipNotFront,label:n,placement:d,notShowArrow:o,visible:_,children:h})};function ds({sessionName:t,apiConfig:e,onResolveComponentProps:s,children:a}){const c=le(t,e,null,s);return r.jsxs(r.Fragment,{children:[c,a]})}const _s={api:"",headers:{}},ae=({userFlow:t,components:e,hash:s,apiConfig:a})=>{const c=s??`${t}-page`;x.useState(()=>{var d,o;return(o=(d=T.getState()[t])==null?void 0:d.pages)!=null&&o[c]||dt(t,a??_s,{type:"page",hash:c,body:{components:e}}),null});const i=S(t,c,e);return r.jsx(r.Fragment,{children:i})};function oe(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 re=({payload:t,userFlow:e})=>{const s=oe(t.display),a=ae({userFlow:e,hash:t.id,components:s});return r.jsx(r.Fragment,{children:a})},us=re,ce=(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(Be,{...a,inputs:i||[]},JSON.stringify(a==null?void 0:a.components));case"header":return r.jsx(Rn,{...a,components:i||[]},JSON.stringify(a==null?void 0:a.components));default:return null}},le=(t,e,s,a)=>{var p,m;const[c,i]=x.useState(!1),l=!!(e!=null&&e.api&&!s&&t),[n,d]=x.useState(l),o=T(g=>g[t]),_=o==null?void 0:o.currentPageId,u=(o==null?void 0:o.isLoading)??!1,h=n||u;x.useEffect(()=>{if(typeof window>"u")return;const g=new URL(window.location.href),b=g.searchParams.get("sessionId");b&&(mt(b),g.searchParams.delete("sessionId"),window.history.replaceState({},"",g.toString()))},[]);const f=_?ce(t,_,"header",((p=o==null?void 0:o.pages[_].page)==null?void 0:p.header)||null,a):null,y=_?ce(t,_,"body",((m=o==null?void 0:o.pages[_].page)==null?void 0:m.body)||null,a):null,j=async()=>{try{const g=await Gt(e,t),b=g==null?void 0:g.data,w=b==null?void 0:b.content;(g==null?void 0:g.status)===200?dt(t,e,w,b==null?void 0:b.sessionState,b==null?void 0:b.sessionId):i(!0)}catch(g){console.error("[not-page]: API call failed",g),i(!0)}finally{d(!1)}};return x.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 g="avocado-theme-mode-changed",b=w=>{const C=w.detail;N.ThemeStore.setThemeMode(C)};return window.addEventListener(g,b),()=>{window.removeEventListener(g,b)}},[]),c&&console.error("[not-page]: No render page"),r.jsxs(r.Fragment,{children:[h&&r.jsx(N.Loading,{}),f,y,_&&r.jsx(Kn,{userFlow:t,pageId:_}),o&&r.jsx(N.Toaster,{})]})};v.Chart=Qt,v.NotFrontPage=ds,v.RenderNotFront=re,v.Row=Pt,v.clearSessionId=ye,v.extractNotFrontComponents=oe,v.heading=Lt,v.renderNotFront=us,v.text=Mt,v.useNotFrontFragment=ae,v.usePage=le,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
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 w,C;return(C=(w=b[e])==null?void 0:w.entries)==null?void 0:C[a]}),j=y!=null?String(y):i??"",p=f,m=x.useMemo(()=>c?l?`${c} *`:c:null,[c,l]),g=x.useCallback(async b=>{var w;if(!p)try{const C={...(w=T.getState()[e])==null?void 0:w.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(N.RadioButton,{name:a,value:b.value,checked:j===b.value,disabled:p||b.disabled,labelRight:b.label,onChange:()=>{g(b.value)}},b.value))})]})},Je=({userFlow:t,pageId:e,component:s,hash:a,responseKey:c,items:i,itemActive:l,darkMode:n})=>r.jsx(N.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(N.ProgressBar,{total:i,done:l,inProgress:n}),qe=({userFlow:t,items:e,responseKey:s})=>{const{getNextUI:a}=V(),c=x.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=x.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(N.Breadcrumbs,{items:i})};function ut(t,e){const{getNextUI:s,fetchDataSource:a,fetchAndGetNextUI:c}=V();return x.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":gt(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),g=(y=m==null?void 0:m.data)==null?void 0:y.content;if((g==null?void 0:g.type)!=="fetch")break;const b=g==null?void 0:g.dataSource,w=await a(b,t,!1),C={...(j=T.getState()[t])==null?void 0:j.entries,[l]:{status:w==null?void 0:w.status,content:w==null?void 0:w.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]=x.useState(!1),g=x.useRef(!1),b=x.useCallback(async()=>{if(g.current)return;const w=c==="FETCH_DATA_SOURCE";w&&(g.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{w&&(g.current=!1,m(!1))}},[c,n,o,d,a,h]);return r.jsx(N.Button,{...y,loading:y.loading||p,disabled:j,onClick:()=>!j&&!p&&(_??b)()})},wt={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:wt.slotStack,children:u.map((p,m)=>r.jsx(x.Fragment,{children:p},`card-accordion-body-${c}-${m}`))}):void 0,y=h&&h.length>0?r.jsx("div",{className:wt.slotStack,children:h.map((p,m)=>r.jsx(x.Fragment,{children:p},`card-accordion-actions-${c}-${m}`))}):void 0,j=o.disabled||_;return r.jsx(N.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,g=S(e,s,l&&l.length>0?l:null),b=g&&g.length>0?r.jsx("div",{className:Ze.slotStack,children:g.map((C,k)=>r.jsx(x.Fragment,{children:C},`card-body-${c}-${k}`))}):null,w=x.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":gt(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(N.Card,{colorId:n,disabled:m,onClick:o&&!m?()=>void w():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:wt.slotStack,children:[n?r.jsx(N.Text,{type:"sm",children:n}):null,_.map((h,f)=>r.jsx(x.Fragment,{children:h},`card-notification-body-${c}-${f}`))]}):u=(typeof l=="string"?l:void 0)??n,r.jsx(N.CardNotification,{...d,children:u})},Nt=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]=Nt(p.translations[String(m)]):f[y]=Nt(m)}else{const p=j;f[y]=Nt((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,g=a+(n+30)*j,b=c+(n+30)*y,w=g+(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${g},${b}L${w},${C}`,stroke:_,fill:"none"}),r.jsx("circle",{cx:w,cy:C,r:2,fill:_,stroke:"none"}),r.jsx("text",{x:w+(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:w+(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 gn=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))]})},xn=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"]),wn={area:en,bar:nn,composed:on,donut:dn,horizontalBar:fn,line:mn,mixBar:gn,pie:xn},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"},Nn="Scrollable chart area",kn=({dataLength:t,minCategoryWidth:e,children:s})=>{const a=x.useRef(null),[c,i]=x.useState(0),l=e??Yt;x.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=x.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?Nn: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=wn[l.type],{fetchDataSource:d}=V(),[o,_]=x.useState(!1),[u,h]=x.useState([]),f=async()=>{var p,m;try{_(!0);const{jsonPathData:g,mapperData:b}=i,w=jt(i,1),C=await d(w,s,!1),k=g?(p=Wt(C==null?void 0:C.data,g,b))==null?void 0:p.items:(m=C==null?void 0:C.data)==null?void 0:m.data;h(k),_(!1)}catch(g){alert(JSON.stringify(g)),_(!1)}};if(x.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(N.SkeletonBase,{height:400}):u.length===0?r.jsx(N.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]=x.useState(l||!1),{disabled:y}=H(e,d),j=x.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),p=x.useCallback(async()=>{var g;try{const b=!h;f(b);const w={...(g=T.getState()[e])==null?void 0:g.entries,[a]:b};switch(L(e,w),c){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,w,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(N.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]=x.useState(l??""),y=N.ThemeStore.useThemeStore(w=>w.theme.mode),{disabled:j}=H(e,d),p=o??j,m={json:At.json(),markdown:fe.markdown(),sql:me.sql(),yaml:ye.yaml()},g=x.useMemo(()=>n&&a?`${a} *`:a??"",[a,n]),b=w=>{f(w);const C={[s]:w};L(e,C)};return r.jsxs("div",{className:nt.codeEditor,children:[g&&g!==""&&r.jsx("label",{className:nt.codeEditor_label,children:g}),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:w=>b(w),theme:y,editable:!p}),c==="markdown"&&_&&r.jsx("div",{className:nt.preview,style:{height:u},children:r.jsx(N.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(x.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(x.Fragment,{children:p},`data-card-top-${c}-${m}`))}):void 0;return r.jsx(N.DataCard,{..._,icon:d,headerStatusColor:u,topContent:j,children:y})},vn={dividerNotFront:"_dividerNotFront_tze3j_1"},Sn=t=>r.jsx(N.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=x.useCallback(()=>{yt(t),ot(t,!1)},[t]),h=Array.isArray(a)?S(t,e,a):a?r.jsx(N.Heading,{type:"h2",children:a}):void 0,f=S(t,e,c),y=i?S(t,e,i):void 0;return r.jsx(N.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(x.Fragment,{children:p},`drawer-header-${m}`)):h}):void 0,children:r.jsx("section",{className:kt.drawerBody,children:f.map((p,m)=>r.jsx(x.Fragment,{children:p},`drawer-body-${m}`))}),footer:y?r.jsx("div",{className:kt.drawerFooter,children:y.map((p,m)=>r.jsx(x.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=x.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(N.DropdownButton,{disabled:d,variant:o,items:f,children:r.jsxs(x.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(x.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:g,download:b,...w}=u;return w})():u,j=x.useCallback(async()=>{var m;if(c)try{const g={...(m=T.getState()[e])==null?void 0:m.entries,[a]:{status:200}};switch(L(e,g),c){case"GO_TO_NEXT_UI":{const b=await h(e,s,g,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(g){alert(JSON.stringify(g))}},[c,h,s,l,a,n,e]),p=y.disabled??f;return r.jsx(N.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=x.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(N.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 g;return(g=m[t])==null?void 0:g.isModalOpen}),o=T(m=>{var g;return(g=m[t])==null?void 0:g.isLoading}),_=d&&!o,u={...n},h=(u==null?void 0:u.headerStatusColor)??l,f=x.useCallback(()=>{yt(t),gt(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(N.Modal,{...u,headerStatusColor:h,header:typeof y=="string"?y:r.jsx(r.Fragment,{children:y.map((m,g)=>r.jsx(x.Fragment,{children:m},`modal-header-${g}`))}),children:r.jsx("section",{className:Mn.modalContent,children:j.map((m,g)=>r.jsx(x.Fragment,{children:m},`modal-body-${g}`))}),actions:r.jsx(r.Fragment,{children:p.map((m,g)=>r.jsx(x.Fragment,{children:m},`modal-footer-${g}`))}),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(x.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(N.Pill,{...i})},zn=t=>{const{content:e}=t;return r.jsx(N.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]=x.useState(!1),j=x.useRef(!1),p=x.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(g){console.error("[RoundButtonNotFront] Action failed:",g)}finally{m&&(j.current=!1,y(!1))}},[c,i,l,a,o]);return r.jsx(N.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=x.useRef(null);x.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=x.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 x.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]=x.useState((o==null?void 0:o.value)??""),{disabled:y}=H(t,l),j=(o==null?void 0:o.disabled)??y,p=x.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=x.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]),g=ee({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:o==null?void 0:o.isMulti,debounceMs:n}),b=C=>{f(C),g(C)},w=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(N.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: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})},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]=x.useState(o.value||""),{disabled:f}=H(t,l),y=(o==null?void 0:o.disabled)??f,j=x.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=g=>{h(g),p(g)};return r.jsx(N.Select,{...o,className:ne.selectNotFront,label:j,value:u,disabled:y,onChange:g=>!y&&m(g)})},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]=x.useState(l||!1),{disabled:y}=H(e,d),j=(_==null?void 0:_.disabled)??y,p=x.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),m=x.useCallback(async()=>{var g;try{const b=!h;f(b);const w={...(g=T.getState()[e])==null?void 0:g.entries,[a]:b};switch(L(e,w),c){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,w,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(N.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(N.Pill,{color:n.color,textColor:n.textColor,iconColor:n.iconColor,children:i.label},`${i.label}-${i.variant}-${l}`)}),c>0&&r.jsxs(N.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=x.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 g=await i(t,e,m,u);g!=null&&g.data&&B(t,g==null?void 0:g.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const g=await l(t,e,m,u,h);g!=null&&g.data&&B(t,g==null?void 0:g.data);break}case"GET_DATA_SOURCE":{const g=await i(t,e,m,u),b=(j=g==null?void 0:g.data)==null?void 0:j.content;if((b==null?void 0:b.type)!=="fetch")break;const w=b==null?void 0:b.dataSource,C=await n(w,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 x.cloneElement(o,{onClick:f})},ns=()=>r.jsx("div",{className:ae.tableSkeleton,children:[...Array(10)].map((t,e)=>r.jsx(N.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]=x.useState(!1),[h,f]=x.useState(1),[y,j]=x.useState(null),p=!c&&Array.isArray(l),m=!!(c!=null&&c.jsonPathCursorPagination)&&!!((st=c==null?void 0:c.jsonPathPagination)!=null&&st.hasMore),g=x.useRef(new Map([[1,null]])),b=x.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]),w=async(D=1)=>{if(!c)return;const{mapperData:U,jsonPathData:lt,jsonPathPagination:Et,jsonPathCursorPagination:it}=c;if(it&&D!==1&&!g.current.has(D)){f(1),w(1);return}it&&D===1&&(g.current=new Map([[1,null]]));try{u(!0);const Tt=it?g.current.get(D)??null:null,ys=jt(c,D,void 0,Tt),at=await o(ys,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&&g.current.set(D+1,_e)}u(!1)}catch(Tt){console.error("[TableNotFront] fetchData:",Tt),u(!1)}},C=D=>{f(D),w(D)};x.useEffect(()=>{p||w()},[]);const k=p?l:y==null?void 0:y.items,E=p&&!!n&&((l==null?void 0:l.length)??0)>n,R=x.useMemo(()=>{if(!E||!l||!n)return k??[];const D=(h-1)*n;return l.slice(D,D+n)},[E,l,n,h,k]),M=x.useMemo(()=>ss(d.columns,k),[k,d.columns]),K={...d,data:R,columns:M??[],rightActions:b};return p?!k||k.length===0?r.jsx(N.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):r.jsxs(r.Fragment,{children:[r.jsx(N.Table,{...K}),E&&n&&l&&r.jsx(N.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(N.Table,{...K}),!m&&(y==null?void 0:y.pagination)&&y.pagination.totalPages>1&&r.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)&&r.jsx(N.Pager,{variant:"cursor",classname:{global:"row__end"},page:h,hasNextPage:!!y.pagination.hasMore,onChange:C})]}):r.jsx(N.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(x.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(N.Tabs,{className:i,activeIndex:c,items:n,onClick:d})},ls=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,required:l,dependencies:n,...d}=t,o={...d},[_,u]=x.useState((o==null?void 0:o.value)??""),{disabled:h}=H(e,n),f=(o==null?void 0:o.disabled)??h,y=x.useMemo(()=>l&&(o!=null&&o.label)?`${o.label} *`:(o==null?void 0:o.label)??"",[o==null?void 0:o.label,l]),j=p=>{var g;const m=(g=p==null?void 0:p.target)==null?void 0:g.value;u(m),L(e,{[i]:m})};return x.useEffect(()=>{u((o==null?void 0:o.value)??"")},[o==null?void 0:o.value]),r.jsx(N.Textarea,{...o,label:y,value:_,disabled:f,onChange:p=>!f&&j(p)})},is={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},ds=t=>{const{userFlow:e,pageId:s,component:a,hash:c,responseKey:i,required:l,dependencies:n,...d}=t,o={...d},[_,u]=x.useState((o==null?void 0:o.value)??""),{disabled:h}=H(e,n),f=(o==null?void 0:o.disabled)??h,y=x.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 g={[i]:m};L(e,g)};return x.useEffect(()=>{u((o==null?void 0:o.value)??"")},[o==null?void 0:o.value]),r.jsx(N.TextField,{...o,className:is.textFieldNotFront,allowClear:!1,label:y,value:_,disabled:f,onChange:p=>!f&&j(p)})},_s=({userFlow:t,pageId:e,responseKey:s,variant:a,content:c,actionType:i,redirectUrl:l})=>{const n=x.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 x.useEffect(()=>{({info:N.toast.info,error:N.toast.error,success:N.toast.success,warning:N.toast.warning}[a]||N.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"},us=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(x.Fragment,{children:f},`tooltip-${c}-${y}`))}):null;return r.jsx(N.Tooltip,{className:oe.tooltipNotFront,label:n,placement:d,notShowArrow:o,visible:_,children:h})};function hs({sessionName:t,apiConfig:e,onResolveComponentProps:s,children:a}){const c=de(t,e,null,s);return r.jsxs(r.Fragment,{children:[c,a]})}const fs={api:"",headers:{}},re=({userFlow:t,components:e,hash:s,apiConfig:a})=>{const c=s??`${t}-page`;x.useState(()=>{var d,o;return(o=(d=T.getState()[t])==null?void 0:d.pages)!=null&&o[c]||dt(t,a??fs,{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})},ms=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]=x.useState(!1),l=!!(e!=null&&e.api&&!s&&t),[n,d]=x.useState(l),o=T(g=>g[t]),_=o==null?void 0:o.currentPageId,u=(o==null?void 0:o.isLoading)??!1,h=n||u;x.useEffect(()=>{if(typeof window>"u")return;const g=new URL(window.location.href),b=g.searchParams.get("sessionId");b&&(mt(b),g.searchParams.delete("sessionId"),window.history.replaceState({},"",g.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 g=await Ht(e,t),b=g==null?void 0:g.data,w=b==null?void 0:b.content;(g==null?void 0:g.status)===200?dt(t,e,w,b==null?void 0:b.sessionState,b==null?void 0:b.sessionId):i(!0)}catch(g){console.error("[not-page]: API call failed",g),i(!0)}finally{d(!1)}};return x.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 g="avocado-theme-mode-changed",b=w=>{const C=w.detail;N.ThemeStore.setThemeMode(C)};return window.addEventListener(g,b),()=>{window.removeEventListener(g,b)}},[]),c&&console.error("[not-page]: No render page"),r.jsxs(r.Fragment,{children:[h&&r.jsx(N.Loading,{}),f,y,_&&r.jsx(Bn,{userFlow:t,pageId:_}),o&&r.jsx(N.Toaster,{})]})};v.Chart=Zt,v.NotFrontPage=hs,v.RenderNotFront=le,v.Row=te,v.clearSessionId=xe,v.extractNotFrontComponents=ce,v.heading=Mt,v.renderNotFront=ms,v.text=Kt,v.useNotFrontFragment=re,v.usePage=de,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
@@ -1,4 +1,7 @@
1
- import type { FC } from 'react';
2
- import { CardNotificationNotFrontProps } from '../../types';
3
- declare const CardNotificationNotFront: FC<CardNotificationNotFrontProps>;
1
+ import type { CardNotificationNotFrontProps } from '../../types';
2
+ interface CardNotificationNotFrontExtendedProps extends CardNotificationNotFrontProps {
3
+ userFlow: string;
4
+ pageId: string;
5
+ }
6
+ declare const CardNotificationNotFront: (notFrontProps: CardNotificationNotFrontExtendedProps) => import("react/jsx-runtime").JSX.Element;
4
7
  export default CardNotificationNotFront;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  interface TableArrayPillsProps {
3
- values: any[];
3
+ values: unknown[];
4
4
  }
5
5
  declare const TableArrayPills: React.FC<TableArrayPillsProps>;
6
6
  export default TableArrayPills;
@@ -0,0 +1 @@
1
+ export {};
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- ._accordion_1ri2t_1{flex-shrink:0}._accordion_1ri2t_1 [class*=cardNotificationNotFront]{max-width:100%}._accordionBody_1ri2t_8{display:flex;flex-direction:column;gap:.75rem}._promptCodeEditor_1d57s_1,._summaryCard_jva4h_1{display:flex}._body_14tsv_1{padding:2rem 2.75rem;width:100%}._body_content_14tsv_5{display:flex;flex-direction:column;gap:.75rem;margin:0 auto;max-width:1440px}._slotStack_1b4wy_1{display:flex;flex-direction:column;gap:.75rem;width:100%}._fieldset_1xrth_1{border:none;margin:0;padding:0;min-width:0}._fieldsetColumn_1xrth_8{display:flex;flex-direction:column;align-items:flex-start}._legend_1xrth_14{padding:0;margin-bottom:.5rem;font-size:inherit}._options_1xrth_20{display:flex;gap:.75rem}._optionsRow_1xrth_25{flex-direction:row;flex-wrap:wrap;align-items:center}._optionsRow_1xrth_25>.container_row{width:auto;flex-wrap:nowrap}._optionsColumn_1xrth_36{flex-direction:column;align-items:flex-start}._slotStack_12u4t_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._slotStack_ivk5b_1{display:flex;flex-direction:column;gap:var(--avocado-spacing-sm, .5rem)}._chartScrollViewport_sm5hx_1{width:100%;max-width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:var(--color-neutral-30) transparent}._chartScrollViewport_sm5hx_1::-webkit-scrollbar{width:8px;height:8px}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-track{background:transparent;border-radius:.5rem}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-thumb{background:var(--color-neutral-30);border-radius:.5rem}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-corner{background:transparent}._chartScrollViewport_sm5hx_1:focus-visible{outline:2px solid var(--color-info-50);outline-offset:2px}._chartScrollViewport_track_sm5hx_29{min-width:100%}._codeEditor_1wi2p_1:not(:first-child){margin:1rem 0 0}._codeEditor_label_1wi2p_4{color:var(--color-neutral-90);display:block;font-family:Roboto,sans-serif;font-size:.75rem;font-weight:700;line-height:.875rem;margin:0 0 .5rem}._codeEditor_wrapper_1wi2p_13{display:grid;gap:1rem}._codeEditor_wrapper_1wi2p_13 ._input_1wi2p_17,._codeEditor_wrapper_1wi2p_13 ._preview_1wi2p_18{flex:1}._codeEditor_wrapper_1wi2p_13 ._input_1wi2p_17{border-radius:.25rem;border:1px solid var(--color-neutral-30);overflow:hidden}._codeEditor_wrapper_1wi2p_13 ._preview_1wi2p_18{border-radius:.25rem;border:1px solid var(--color-neutral-30);display:flex;flex-direction:column;overflow:hidden}._codeEditor_wrapper_1wi2p_13 ._preview_inner_1wi2p_33{flex:1 1 auto;min-height:0;overflow-y:auto;padding:.75rem}._slotStack_6n2wy_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._dividerNotFront_tze3j_1{margin:1.25rem 0}._drawer_13pxo_1{z-index:9}._drawerBody_13pxo_5{display:flex;flex-direction:column;gap:.75rem}._drawerFooter_13pxo_11{display:flex;gap:.75rem}._header_g1eri_1{padding:1.5rem 2.75rem;background-color:var(--color-gray-80)}._header_content_g1eri_5{display:flex;flex-direction:column;gap:.75rem;margin:0 auto;max-width:1440px}._modalContent_p06ci_1{display:flex;flex-direction:column;gap:.75rem;padding:0 .25rem .5rem 0;width:calc(100% - .25rem)}._row_1bqj4_1{display:flex;width:100%}._row__gap-none_1bqj4_5{gap:0}._row__gap-xxs_1bqj4_8{gap:.25rem}._row__gap-xs_1bqj4_11{gap:.5rem}._row__gap-sm_1bqj4_14{gap:.75rem}._row__gap-md_1bqj4_17{gap:1rem}._row__gap-lg_1bqj4_20{gap:1.25rem}._row__gap-xl_1bqj4_23{gap:1.5rem}._row__gap-xxl_1bqj4_26{gap:2rem}._row__gap-xxxl_1bqj4_29{gap:2.75rem}._row__justify-start_1bqj4_32{justify-content:flex-start}._row__justify-end_1bqj4_35{justify-content:flex-end}._row__justify-center_1bqj4_38{justify-content:center}._row__justify-space-between_1bqj4_41{justify-content:space-between}._row__justify-space-around_1bqj4_44{justify-content:space-around}._row__justify-space-evenly_1bqj4_47{justify-content:space-evenly}._row__align-start_1bqj4_50{align-items:flex-start}._row__align-end_1bqj4_53{align-items:flex-end}._row__align-center_1bqj4_56{align-items:center}._row__align-stretch_1bqj4_59{align-items:stretch}._row__align-baseline_1bqj4_62{align-items:baseline}._row_column_1bqj4_65{display:flex;flex-direction:column;min-height:1px;overflow-wrap:break-word;word-wrap:break-word}._row_column__gap-none_1bqj4_72{gap:0}._row_column__gap-xxs_1bqj4_75{gap:.25rem}._row_column__gap-xs_1bqj4_78{gap:.5rem}._row_column__gap-sm_1bqj4_81{gap:.75rem}._row_column__gap-md_1bqj4_84{gap:1rem}._row_column__gap-lg_1bqj4_87{gap:1.25rem}._row_column__gap-xl_1bqj4_90{gap:1.5rem}._row_column__gap-xxl_1bqj4_93{gap:2rem}._row_column__gap-xxxl_1bqj4_96{gap:2.75rem}._row_column__justify-start_1bqj4_99{justify-content:flex-start}._row_column__justify-end_1bqj4_102{justify-content:flex-end}._row_column__justify-center_1bqj4_105{justify-content:center}._row_column__justify-space-between_1bqj4_108{justify-content:space-between}._row_column__justify-space-around_1bqj4_111{justify-content:space-around}._row_column__justify-space-evenly_1bqj4_114{justify-content:space-evenly}._row_column__align-start_1bqj4_117{align-items:flex-start}._row_column__align-end_1bqj4_120{align-items:flex-end}._row_column__align-center_1bqj4_123{align-items:center}._row_column__align-stretch_1bqj4_126{align-items:stretch}._row_column__align-baseline_1bqj4_129{align-items:baseline}._selectNotFront_ch3v5_1{max-width:364px;width:100%}._spacing_19hqa_1._spacing__xxs_19hqa_1{margin:.25rem 0 0}._spacing_19hqa_1._spacing__xs_19hqa_4{margin:.5rem 0 0}._spacing_19hqa_1._spacing__sm_19hqa_7{margin:.75rem 0 0}._spacing_19hqa_1._spacing__md_19hqa_10{margin:1rem 0 0}._spacing_19hqa_1._spacing__lg_19hqa_13{margin:1.25rem 0 0}._spacing_19hqa_1._spacing__xl_19hqa_16{margin:1.5rem 0 0}._spacing_19hqa_1._spacing__xxl_19hqa_19{margin:2rem 0 0}._spacing_19hqa_1._spacing__xxxl_19hqa_22{margin:2.75rem 0 0}._tableSkeleton_3nr9n_1{display:flex;flex-direction:column;gap:.5rem}._tableArrayPills_3nr9n_7{display:flex;gap:.5rem;flex-wrap:wrap}._tabsPanel_kvslb_1{display:flex;flex-direction:column;gap:.75rem}._textFieldNotFront_1n8fy_1{max-width:364px;width:100%}._tooltipNotFront_106iw_1{align-self:flex-start;max-width:100%}._tooltipNotFront_content_106iw_5{display:flex;flex-direction:column;gap:.75rem;width:fit-content}
1
+ ._accordion_1ri2t_1{flex-shrink:0}._accordion_1ri2t_1 [class*=cardNotificationNotFront]{max-width:100%}._accordionBody_1ri2t_8{display:flex;flex-direction:column;gap:.75rem}._promptCodeEditor_1d57s_1,._summaryCard_jva4h_1{display:flex}._body_14tsv_1{padding:2rem 2.75rem;width:100%}._body_content_14tsv_5{display:flex;flex-direction:column;gap:.75rem;margin:0 auto;max-width:1440px}._boxNotFront_67q2e_1{min-height:auto}._slotStack_67q2e_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._fieldset_1xrth_1{border:none;margin:0;padding:0;min-width:0}._fieldsetColumn_1xrth_8{display:flex;flex-direction:column;align-items:flex-start}._legend_1xrth_14{padding:0;margin-bottom:.5rem;font-size:inherit}._options_1xrth_20{display:flex;gap:.75rem}._optionsRow_1xrth_25{flex-direction:row;flex-wrap:wrap;align-items:center}._optionsRow_1xrth_25>.container_row{width:auto;flex-wrap:nowrap}._optionsColumn_1xrth_36{flex-direction:column;align-items:flex-start}._slotStack_12u4t_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._slotStack_ivk5b_1{display:flex;flex-direction:column;gap:var(--avocado-spacing-sm, .5rem)}._chartScrollViewport_sm5hx_1{width:100%;max-width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:var(--color-neutral-30) transparent}._chartScrollViewport_sm5hx_1::-webkit-scrollbar{width:8px;height:8px}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-track{background:transparent;border-radius:.5rem}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-thumb{background:var(--color-neutral-30);border-radius:.5rem}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-corner{background:transparent}._chartScrollViewport_sm5hx_1:focus-visible{outline:2px solid var(--color-info-50);outline-offset:2px}._chartScrollViewport_track_sm5hx_29{min-width:100%}._codeEditor_1wi2p_1:not(:first-child){margin:1rem 0 0}._codeEditor_label_1wi2p_4{color:var(--color-neutral-90);display:block;font-family:Roboto,sans-serif;font-size:.75rem;font-weight:700;line-height:.875rem;margin:0 0 .5rem}._codeEditor_wrapper_1wi2p_13{display:grid;gap:1rem}._codeEditor_wrapper_1wi2p_13 ._input_1wi2p_17,._codeEditor_wrapper_1wi2p_13 ._preview_1wi2p_18{flex:1}._codeEditor_wrapper_1wi2p_13 ._input_1wi2p_17{border-radius:.25rem;border:1px solid var(--color-neutral-30);overflow:hidden}._codeEditor_wrapper_1wi2p_13 ._preview_1wi2p_18{border-radius:.25rem;border:1px solid var(--color-neutral-30);display:flex;flex-direction:column;overflow:hidden}._codeEditor_wrapper_1wi2p_13 ._preview_inner_1wi2p_33{flex:1 1 auto;min-height:0;overflow-y:auto;padding:.75rem}._slotStack_6n2wy_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._dividerNotFront_tze3j_1{margin:1.25rem 0}._drawer_13pxo_1{z-index:9}._drawerBody_13pxo_5{display:flex;flex-direction:column;gap:.75rem}._drawerFooter_13pxo_11{display:flex;gap:.75rem}._header_g1eri_1{padding:1.5rem 2.75rem;background-color:var(--color-gray-80)}._header_content_g1eri_5{display:flex;flex-direction:column;gap:.75rem;margin:0 auto;max-width:1440px}._modalContent_p06ci_1{display:flex;flex-direction:column;gap:.75rem;padding:0 .25rem .5rem 0;width:calc(100% - .25rem)}._row_1bqj4_1{display:flex;width:100%}._row__gap-none_1bqj4_5{gap:0}._row__gap-xxs_1bqj4_8{gap:.25rem}._row__gap-xs_1bqj4_11{gap:.5rem}._row__gap-sm_1bqj4_14{gap:.75rem}._row__gap-md_1bqj4_17{gap:1rem}._row__gap-lg_1bqj4_20{gap:1.25rem}._row__gap-xl_1bqj4_23{gap:1.5rem}._row__gap-xxl_1bqj4_26{gap:2rem}._row__gap-xxxl_1bqj4_29{gap:2.75rem}._row__justify-start_1bqj4_32{justify-content:flex-start}._row__justify-end_1bqj4_35{justify-content:flex-end}._row__justify-center_1bqj4_38{justify-content:center}._row__justify-space-between_1bqj4_41{justify-content:space-between}._row__justify-space-around_1bqj4_44{justify-content:space-around}._row__justify-space-evenly_1bqj4_47{justify-content:space-evenly}._row__align-start_1bqj4_50{align-items:flex-start}._row__align-end_1bqj4_53{align-items:flex-end}._row__align-center_1bqj4_56{align-items:center}._row__align-stretch_1bqj4_59{align-items:stretch}._row__align-baseline_1bqj4_62{align-items:baseline}._row_column_1bqj4_65{display:flex;flex-direction:column;min-height:1px;overflow-wrap:break-word;word-wrap:break-word}._row_column__gap-none_1bqj4_72{gap:0}._row_column__gap-xxs_1bqj4_75{gap:.25rem}._row_column__gap-xs_1bqj4_78{gap:.5rem}._row_column__gap-sm_1bqj4_81{gap:.75rem}._row_column__gap-md_1bqj4_84{gap:1rem}._row_column__gap-lg_1bqj4_87{gap:1.25rem}._row_column__gap-xl_1bqj4_90{gap:1.5rem}._row_column__gap-xxl_1bqj4_93{gap:2rem}._row_column__gap-xxxl_1bqj4_96{gap:2.75rem}._row_column__justify-start_1bqj4_99{justify-content:flex-start}._row_column__justify-end_1bqj4_102{justify-content:flex-end}._row_column__justify-center_1bqj4_105{justify-content:center}._row_column__justify-space-between_1bqj4_108{justify-content:space-between}._row_column__justify-space-around_1bqj4_111{justify-content:space-around}._row_column__justify-space-evenly_1bqj4_114{justify-content:space-evenly}._row_column__align-start_1bqj4_117{align-items:flex-start}._row_column__align-end_1bqj4_120{align-items:flex-end}._row_column__align-center_1bqj4_123{align-items:center}._row_column__align-stretch_1bqj4_126{align-items:stretch}._row_column__align-baseline_1bqj4_129{align-items:baseline}._selectNotFront_ch3v5_1{max-width:364px;width:100%}._spacing_19hqa_1._spacing__xxs_19hqa_1{margin:.25rem 0 0}._spacing_19hqa_1._spacing__xs_19hqa_4{margin:.5rem 0 0}._spacing_19hqa_1._spacing__sm_19hqa_7{margin:.75rem 0 0}._spacing_19hqa_1._spacing__md_19hqa_10{margin:1rem 0 0}._spacing_19hqa_1._spacing__lg_19hqa_13{margin:1.25rem 0 0}._spacing_19hqa_1._spacing__xl_19hqa_16{margin:1.5rem 0 0}._spacing_19hqa_1._spacing__xxl_19hqa_19{margin:2rem 0 0}._spacing_19hqa_1._spacing__xxxl_19hqa_22{margin:2.75rem 0 0}._tableSkeleton_3nr9n_1{display:flex;flex-direction:column;gap:.5rem}._tableArrayPills_3nr9n_7{display:flex;gap:.5rem;flex-wrap:wrap}._tabsPanel_kvslb_1{display:flex;flex-direction:column;gap:.75rem}._textFieldNotFront_1n8fy_1{max-width:364px;width:100%}._tooltipNotFront_106iw_1{align-self:flex-start;max-width:100%}._tooltipNotFront_content_106iw_5{display:flex;flex-direction:column;gap:.75rem;width:fit-content}
@@ -130,14 +130,15 @@ export interface ButtonNotFrontProps extends NotFrontBaseProps, ButtonProps {
130
130
  export interface CardNotificationNotFrontProps extends NotFrontBaseProps, CardNotificationProps {
131
131
  component: 'cardNotification';
132
132
  /**
133
- * The content to be displayed inside the CardNotification component.
134
- * This property is optional and represents the main text or message of the notification.
133
+ * Card body payload from Not Front.
134
+ *
135
+ * - ``string`` — legacy single message (JSON ``content`` string).
136
+ * - ``NotFrontComponent[]`` — nested blocks rendered inside the card.
135
137
  */
136
- content?: string;
138
+ content?: string | NotFrontComponent[];
137
139
  /**
138
- * @deprecated Use `content` instead.
139
- * This property will be removed in the future once the backend stops sending it.
140
- * Currently kept for backward compatibility with existing implementations.
140
+ * Optional lead text when ``content`` is a nested component array.
141
+ * Legacy pages may still receive the sole message via ``content`` string.
141
142
  */
142
143
  description?: string;
143
144
  }
@@ -698,14 +699,15 @@ export interface ButtonNotFrontProps extends NotFrontBaseProps, ButtonProps {
698
699
  export interface CardNotificationNotFrontProps extends NotFrontBaseProps, CardNotificationProps {
699
700
  component: 'cardNotification';
700
701
  /**
701
- * The content to be displayed inside the CardNotification component.
702
- * This property is optional and represents the main text or message of the notification.
702
+ * Card body payload from Not Front.
703
+ *
704
+ * - ``string`` — legacy single message (JSON ``content`` string).
705
+ * - ``NotFrontComponent[]`` — nested blocks rendered inside the card.
703
706
  */
704
- content?: string;
707
+ content?: string | NotFrontComponent[];
705
708
  /**
706
- * @deprecated Use `content` instead.
707
- * This property will be removed in the future once the backend stops sending it.
708
- * Currently kept for backward compatibility with existing implementations.
709
+ * Optional lead text when ``content`` is a nested component array.
710
+ * Legacy pages may still receive the sole message via ``content`` string.
709
711
  */
710
712
  description?: string;
711
713
  }
@@ -1031,14 +1033,15 @@ export interface ButtonNotFrontProps extends NotFrontBaseProps, ButtonProps {
1031
1033
  export interface CardNotificationNotFrontProps extends NotFrontBaseProps, CardNotificationProps {
1032
1034
  component: 'cardNotification';
1033
1035
  /**
1034
- * The content to be displayed inside the CardNotification component.
1035
- * This property is optional and represents the main text or message of the notification.
1036
+ * Card body payload from Not Front.
1037
+ *
1038
+ * - ``string`` — legacy single message (JSON ``content`` string).
1039
+ * - ``NotFrontComponent[]`` — nested blocks rendered inside the card.
1036
1040
  */
1037
- content?: string;
1041
+ content?: string | NotFrontComponent[];
1038
1042
  /**
1039
- * @deprecated Use `content` instead.
1040
- * This property will be removed in the future once the backend stops sending it.
1041
- * Currently kept for backward compatibility with existing implementations.
1043
+ * Optional lead text when ``content`` is a nested component array.
1044
+ * Legacy pages may still receive the sole message via ``content`` string.
1042
1045
  */
1043
1046
  description?: string;
1044
1047
  }
@@ -43,9 +43,18 @@ export interface SelectDataSource {
43
43
  totalPages?: string;
44
44
  };
45
45
  }
46
+ /**
47
+ * Table column translation value.
48
+ *
49
+ * - ``string`` — legacy scalar label.
50
+ * - ``string[]`` — pill cell payload:
51
+ * - ``[label]`` → one neutral pill
52
+ * - ``[label, variant]`` → one semantic pill (see ``TablePillVariant``)
53
+ */
54
+ export type TableColumnTranslationValue = string | string[];
46
55
  interface MapperDataItem {
47
56
  path: string;
48
- translations?: Record<string, string>;
57
+ translations?: Record<string, TableColumnTranslationValue>;
49
58
  }
50
59
  type MapperDataValue = string | MapperDataItem;
51
60
  export type DataSourceMapperData = Record<string, MapperDataValue>;
@@ -0,0 +1,27 @@
1
+ import type { Color } from '../../../avocado-icons';
2
+ export declare const TABLE_PILL_VARIANTS: readonly ["success", "warning", "error", "info", "neutral"];
3
+ export type TablePillVariant = (typeof TABLE_PILL_VARIANTS)[number];
4
+ export type TablePillColors = {
5
+ color: `${Color}`;
6
+ textColor: `${Color}`;
7
+ iconColor: `${Color}`;
8
+ };
9
+ export declare const PILL_VARIANT_COLORS: Record<TablePillVariant, TablePillColors>;
10
+ export declare const isTablePillVariant: (value: unknown) => value is "success" | "info" | "warning" | "error" | "neutral";
11
+ export type ParsedTablePill = {
12
+ label: string;
13
+ variant: TablePillVariant;
14
+ };
15
+ /**
16
+ * Normalizes a table cell value into pill entries.
17
+ *
18
+ * Not Front table ``translations`` support two shapes:
19
+ *
20
+ * - ``[label]`` — one neutral pill (multi-value columns still pass plain strings).
21
+ * - ``[label, variant]`` — one semantic pill when ``variant`` is a known token
22
+ * (``success`` | ``warning`` | ``error`` | ``info`` | ``neutral``).
23
+ *
24
+ * Any other array length renders one neutral pill per element so existing
25
+ * multi-tag columns keep working.
26
+ */
27
+ export declare const parseTablePillCell: (values: unknown[]) => ParsedTablePill[];
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foris/avocado-not-front",
3
- "version": "5.2.4",
3
+ "version": "5.2.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -56,9 +56,9 @@
56
56
  "recharts": "3.1.0",
57
57
  "zustand": "4.5.4",
58
58
  "@uiw/react-codemirror": "4.23.12",
59
+ "@foris/avocado-icons": "1.16.8",
59
60
  "@foris/ai-agent": "1.1.4",
60
61
  "@foris/avocado-core": "1.3.2",
61
- "@foris/avocado-icons": "1.16.8",
62
62
  "@foris/avocado-suite": "1.8.21",
63
63
  "@foris/tsconfig": "0.0.2"
64
64
  },
@@ -78,10 +78,10 @@
78
78
  "recharts": ">=3.0.0",
79
79
  "streamdown": ">=1.6.0",
80
80
  "zustand": ">=4.0.0",
81
- "@foris/ai-agent": "1.1.4",
82
81
  "@foris/avocado-core": "1.3.2",
82
+ "@foris/avocado-suite": "1.8.21",
83
83
  "@foris/avocado-icons": "1.16.8",
84
- "@foris/avocado-suite": "1.8.21"
84
+ "@foris/ai-agent": "1.1.4"
85
85
  },
86
86
  "scripts": {
87
87
  "build": "tsc && vite build",