@foris/avocado-not-front 5.0.2 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avocado-not-front.es.js +299 -299
- package/dist/avocado-not-front.umd.js +3 -3
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(S,
|
|
1
|
+
(function(S,U){typeof exports=="object"&&typeof module<"u"?U(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"],U):(S=typeof globalThis<"u"?globalThis:S||self,U(S["avocado-not-front"]={},S.axios,S.zustand,S.React,S.AvocadoSuite,S.AiAgent,S.jsonpath,S.Recharts,S.ReactCodeMirror,S.CodeMirrorLangJson,S.CodeMirrorLangMarkdown,S.CodeMirrorLangSql,S.CodeMirrorLangYaml,S.AvocadoIcons))})(this,(function(S,U,ce,x,w,dt,G,L,le,kt,ie,de,_e,Et){"use strict";const E=ce.create(()=>({})),at=(t,e,s,r)=>{const l=s==null?void 0:s.hash,i=r&&Object.keys(r).length>0?{...r}:{};E.setState(c=>{var n;return{...c,[t]:{...c[t],apiConfig:e,currentPageId:l,isLoading:!1,isModalOpen:!0,isDrawerOpen:!1,entries:i,overlay:null,pages:{...(n=c[t])==null?void 0:n.pages,[l]:{page:s}}}}})},Tt=(t,e,s)=>{const r=s&&Object.keys(s).length>0?{...t,...s}:t;return e.length===0?t:Object.fromEntries(Object.entries(r).filter(([l])=>!e.includes(l)))},ue=(t,e,s,r,l)=>{sessionStorage.setItem("sessionId",s),E.setState(i=>{const c=i[t]??{},n=c.entries??{},d=Tt(n,r,l);return{...i,[t]:{...c,currentPageId:e.hash,entries:d,isLoading:!1,overlay:null,pages:{...c.pages,[e.hash]:{page:{...e}}}}}})},he=(t,e,s,r)=>{E.setState(l=>{var a;const i=l[t]??{},c=i.entries??{},n=Tt(c,s,r),d=(a=e.components)==null?void 0:a.some(_=>_.component==="drawer");return{...l,[t]:{...i,entries:n,overlay:e,isLoading:!1,isModalOpen:!d,isDrawerOpen:!!d}}})},_t=t=>{E.setState(e=>({...e,[t]:{...e[t],overlay:null}}))},fe=t=>{var s;return((s=E.getState()[t])==null?void 0:s.overlay)??null},I=(t,e)=>{const{content:s,sessionId:r,deprecatedStateKeys:l=[],sessionState:i}=e;s.type!=="page"&&s.type!=="overlay"||(s.type==="page"?ue(t,s,r,l,i):he(t,s,l,i))},A=(t,e)=>{E.setState(s=>{var r;return{...s,[t]:{...s[t],entries:{...(r=s[t])==null?void 0:r.entries,...e}}}})},me=(t,e)=>{E.setState(s=>{const r=s[t];if(!r)return s;const l=r.entries??{};if(!(e in l))return s;const{[e]:i,...c}=l;return{...s,[t]:{...r,entries:c}}})},q=(t,e)=>{E.setState(s=>({...s,[t]:{...s[t],isLoading:e}}))},rt=(t,e)=>{E.setState(s=>({...s,[t]:{...s[t],isModalOpen:e}}))},W=(t,e)=>{E.setState(s=>({...s,[t]:{...s[t],isDrawerOpen:e}}))},St=(t,e)=>{E.setState(s=>{const r=s[t];return r?{...s,[t]:{...r,apiConfig:{...r.apiConfig,headers:e}}}:s})};let ut=!1,ot=[],Ot=!1;const ge=t=>t._userFlow||null,vt=t=>{ot.forEach(({resolve:e,reject:s})=>{t?s(t):e(void 0)}),ot=[]},ye=async t=>{var r,l;const e=t==null?void 0:t.config;if(((r=t==null?void 0:t.response)==null?void 0:r.status)===401&&!e._retry){const i=ge(e);if(i){const n=(l=E.getState()[i])==null?void 0:l.apiConfig;if(!n)return Promise.reject(t);if(n.onAuthenticationError||typeof n.headers=="function"){if(ut)return new Promise((a,_)=>{ot.push({resolve:a,reject:_})}).then(()=>U(e)).catch(a=>(console.error("[axiosInterceptors] Queued request failed:",a),Promise.reject(a)));e._retry=!0,ut=!0;try{let a;if(n.onAuthenticationError)a=await n.onAuthenticationError();else if(typeof n.headers=="function")a=n.headers();else throw new Error("No refresh handler available");return n.onAuthenticationError&&(typeof n.headers=="string"?St(i,JSON.stringify(a)):St(i,a)),e.headers||(e.headers={}),Object.assign(e.headers,a),vt(null),U(e)}catch(a){return console.error("[axiosInterceptors] Token refresh failed:",a),console.error("[axiosInterceptors] Rejecting queued requests:",ot.length),vt(a),Promise.reject(a)}finally{ut=!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..."),U.interceptors.response.use(void 0,ye),console.debug("[axiosInterceptors] Response error interceptor registered"),Ot=!0,console.debug("[axiosInterceptors] Interceptors initialized successfully")})();function xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ht={exports:{}},tt={};/**
|
|
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 At;function be(){if(At)return tt;At=1;var t=b,e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,l=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(n,d,a){var _,u={},h=null,f=null;a!==void 0&&(h=""+a),d.key!==void 0&&(h=""+d.key),d.ref!==void 0&&(f=d.ref);for(_ in d)r.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:l.current}}return tt.Fragment=s,tt.jsx=c,tt.jsxs=c,tt}var Rt;function pe(){return Rt||(Rt=1,ht.exports=be()),ht.exports}var o=pe();const Dt=t=>{if(!(t!=null&&t.content))return null;const e={...t,children:t.content,type:t.variant};return o.jsx(w.Heading,{...e})},Lt=t=>{if(!t)return null;const e={...t,children:t.content};return o.jsx(w.Text,{...e})},O=(t,e,s,r)=>{var c;const l={accordion:n=>o.jsx(Te,{...n,userFlow:t,pageId:e}),aiChatPanel:n=>o.jsx(Se,{...n,userFlow:t,pageId:e,onResolveProps:r==null?void 0:r.aiChatPanel}),aiSummaryCard:n=>o.jsx(Re,{...n,userFlow:t,pageId:e,onResolveProps:r==null?void 0:r.aiSummaryCard}),aiPromptCodeEditor:n=>o.jsx(ve,{...n,userFlow:t,pageId:e}),box:n=>o.jsx(Ie,{...n,userFlow:t,pageId:e}),breadcrumbs:n=>o.jsx(Ve,{...n,userFlow:t,pageId:e}),tooltip:n=>o.jsx(zn,{...n,userFlow:t,pageId:e}),textarea:n=>o.jsx(Kn,{...n,userFlow:t,pageId:e}),card:n=>o.jsx(Xe,{...n,userFlow:t,pageId:e}),dropdownButton:n=>o.jsx(_n,{...n,userFlow:t,pageId:e}),menu:n=>o.jsx(fn,{...n,userFlow:t,pageId:e}),radioGroup:n=>o.jsx(Ge,{...n,userFlow:t,pageId:e}),stepper:n=>o.jsx(Ke,{...n,userFlow:t,pageId:e}),progressBar:n=>o.jsx(Ue,{...n,userFlow:t,pageId:e}),button:n=>o.jsx(He,{...n,userFlow:t,pageId:e}),cardAccordion:n=>o.jsx(ze,{...n,userFlow:t,pageId:e}),cardNotification:n=>o.jsx(We,{...n}),chart:n=>o.jsx(Wt,{...n,userFlow:t}),dataCard:n=>o.jsx(on,{...n,userFlow:t,pageId:e}),checkbox:n=>o.jsx(an,{...n,userFlow:t,pageId:e}),code:n=>o.jsx(rn,{...n,userFlow:t,pageId:e}),divider:n=>o.jsx(ln,{...n}),drawer:n=>o.jsx(dn,{...n,userFlow:t,pageId:e}),heading:n=>Dt(n),link:n=>o.jsx(hn,{...n,userFlow:t,pageId:e}),pill:n=>o.jsx(bn,{...n}),previewerMarkdown:n=>o.jsx(pn,{...n}),modal:n=>o.jsx(gn,{...n,userFlow:t,pageId:e}),roundButton:n=>o.jsx(Cn,{...n,userFlow:t,pageId:e}),row:n=>o.jsx(Yt,{...n,userFlow:t,pageId:e}),select:n=>o.jsx(Sn,{...n,userFlow:t,pageId:e}),switch:n=>o.jsx(vn,{...n,userFlow:t,pageId:e}),spacing:n=>o.jsx(On,{...n,userFlow:t,pageId:e}),table:n=>o.jsx(In,{...n,userFlow:t,pageId:e}),tabs:n=>o.jsx(Gn,{...n,userFlow:t,pageId:e}),text:n=>Lt(n),textField:n=>o.jsx(Vn,{...n,userFlow:t,pageId:e}),toast:n=>o.jsx(Hn,{...n,userFlow:t,pageId:e})};return(c=s==null?void 0:s.filter(Boolean))==null?void 0:c.map(n=>{const d=l[n.component];return d?d({...n,userFlow:t,pageId:e}):null})};function Ce(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)}function It(t,e){if(!(e!=null&&e.length))return!1;for(const s of e)if(s.when==="empty"){const r=t==null?void 0:t[s.key];if(Ce(r))return!0}return!1}function B(t,e){const s=E(r=>{var l;return(l=r[t])==null?void 0:l.entries});return b.useMemo(()=>({disabled:It(s,e)}),[e,s])}const Q=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},et=()=>new AbortController,je=(t,e={},s={},r=!1,l)=>{const i=et();r&&i.abort();const c=Q(e);return{call:V.get(t,{headers:{...c},params:s,signal:i.signal,_userFlow:l}),controller:i}},ft=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:V.post(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},we=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:V.put(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},Ne=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:V.patch(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},ke=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:V.delete(t,{headers:{...n},data:s,params:r,signal:c.signal,_userFlow:i}),controller:c}},Mt=()=>{let t;return{callEndpoint:async r=>{r.controller&&(t=r.controller);let l={};try{l=await r.call}catch(i){throw i}return l},cancelEndpoint:()=>{t&&t.abort()}}},Bt=async(t,e,s="",r={},l={})=>{try{const{callEndpoint:i}=Mt(),{api:c,headers:n}=t,d=sessionStorage.getItem("sessionId"),a=new URLSearchParams({session_name:e});s&&a.append("hash_code",s),d&&a.append("sessionId",d);const _=`${c}/not-front/next-ui/?${a.toString()}`,u=Q(n),h=ft(_,u,r,l,!1,e);return await i(h)}catch(i){return console.error(i),Promise.reject(i)}},Gt=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"}},Ee=(t,e,s)=>{const{url:r,paginationKeys:l,params:i}=t,c=[],n=(l==null?void 0:l.page)??"page";if(c.push(`${n}=${e}`),typeof s=="string"){const _=(l==null?void 0:l.text)??"text";c.push(`${_}=${encodeURIComponent(s||"")}`)}if(i&&typeof i=="object"){const _=Object.entries(i).map(([u,h])=>`${encodeURIComponent(u)}=${encodeURIComponent(h)}`);c.push(..._)}const d=c.join("&");return d?`${r}?${d}`:r},mt=(t,e,s,r)=>{const{type:l,url:i,method:c,headers:n}=t;if(l==="rest"){const d=Ee(t,e,s),_={...(t==null?void 0:t.data)??{},...r??{}};return{type:"rest",url:d,method:Gt(c),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}}},K=()=>{const t=E(n=>n),{callEndpoint:e}=Mt(),s=async(n,d,a,_,u=!0)=>{var h;try{const f=(h=t[n])==null?void 0:h.apiConfig,g={state:{...a},triggerKey:_};return u&&q(n,!0),await Bt(f,n,d,g)}catch(f){throw u&&q(n,!1),console.error("[getNextUI] Error fetching next UI:",f),f}},r=(n,d)=>{const{url:a,headers:_,data:u,params:h}=n;switch(Gt(n.method)){case"post":return ft(a,_,u,{},!1,d);case"put":return we(a,_,u,{},!1,d);case"patch":return Ne(a,_,u,{},!1,d);case"delete":return ke(a,_,u,h,!1,d);case"get":default:return je(a,_,h,!1,d)}},l=(n,d)=>{const{url:a,headers:_}=n,u={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return ft(a,{..._,"Content-Type":"application/json"},u,{},!1,d)},i=async(n,d,a=!0)=>{var _,u;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}a&&q(d,!0);try{let h;switch(n==null?void 0:n.type){case"rest":h=r(n,d);break;case"graphql":h=l(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{a&&q(d,!1)}};return{getNextUI:s,fetchDataSource:i,fetchAndGetNextUI:async(n,d,a,_,u)=>{try{q(n,!0);const h=await i(u,n,!1);return h&&await s(n,d,a,_)}catch(h){throw q(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",h),h}}}},Kt={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},Te=t=>{const{userFlow:e,pageId:s,responseKey:r,dependencies:l,customContent:i,actionContent:c,components:n,...d}=t,{getNextUI:a}=K(),[_,u]=b.useState(d.checkboxChecked||!1),{disabled:h}=B(e,l),f=O(e,s,n),g=c?O(e,s,c):void 0,x=i?O(e,s,i):void 0,y=b.useCallback(async C=>{var N;try{const j=C.target.checked;u(j);const k={...(N=E.getState()[e])==null?void 0:N.entries,[r]:j};if(A(e,k),d.actionType==="GO_TO_NEXT_UI"){const T=await a(e,s,k,r);T!=null&&T.data&&I(e,T==null?void 0:T.data)}}catch(j){console.error("Error in accordion checkbox action:",j),alert(JSON.stringify(j))}},[e,s,r,d.actionType,a]),m=d.disabled||h,p={...d,className:Kt.accordion,disabled:m,checkboxChecked:_,onChanceCheckbox:d.hasCheckbox?y:void 0,actionContent:g?o.jsx(o.Fragment,{children:g.map((C,N)=>o.jsx(b.Fragment,{children:C},`accordion-action-${N}`))}):void 0,customContent:x?o.jsx(o.Fragment,{children:x.map((C,N)=>o.jsx(b.Fragment,{children:C},`accordion-custom-${N}`))}):void 0,children:f?o.jsx("section",{className:Kt.accordionBody,children:f.map((C,N)=>o.jsx(b.Fragment,{children:C},`accordion-child-${N}`))}):void 0};return o.jsx(w.Accordion,{...p})},Se=t=>{const e=w.ThemeStore.useThemeStore(c=>c.theme.mode),s=t.dataSource,r=b.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]),l=t.locale??"en",i=b.useMemo(()=>{var n,d,a,_,u;const c={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:(a=t==null?void 0:t.translations)==null?void 0:a.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(c).filter(([,h])=>!!h))},[t==null?void 0:t.translations]);return b.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:r,locale:l,translations:i,initialSuggestions:t.initialSuggestions,theme:e})},[t.onResolveProps,r,l,i,t.initialSuggestions,e]),t.onResolveProps?null:o.jsx(dt.ChatPanel,{dataSource:r,locale:l,translations:i,initialSuggestions:t.initialSuggestions,theme:e})},Oe={promptCodeEditor:"_promptCodeEditor_1d57s_1"},ve=t=>{const{userFlow:e,responseKey:s,codeBlockValue:r,language:l,disabled:i,dependencies:c,dataSource:n,inputLabel:d,inputPlaceholder:a,codeBlockLabel:_}=t,u=w.ThemeStore.useThemeStore(C=>C.theme.mode),[h,f]=b.useState(r||""),{disabled:g}=B(e,c),x=i??g,y=l??"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},p=C=>{f(C);const N={[s]:C};A(e,N)};return b.useEffect(()=>{r!==void 0&&r!==h&&f(r)},[r]),o.jsx("section",{className:Oe.promptCodeEditor,children:o.jsx(dt.PromptCodeEditor,{themeMode:u,requestConfig:m,language:y,disabled:x,inputLabel:d,inputPlaceholder:a,codeBlockLabel:_,codeBlockValue:h,onCodeChange:p})})},Ae={summaryCard:"_summaryCard_jva4h_1"},Re=t=>{const e=t.dataSource,s=b.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]),r=t.locale??"en",l=b.useMemo(()=>{var c,n,d;const i={title:(c=t==null?void 0:t.translations)==null?void 0:c.title,loading:(n=t==null?void 0:t.translations)==null?void 0:n.loading,noData:(d=t==null?void 0:t.translations)==null?void 0:d.noData};return Object.fromEntries(Object.entries(i).filter(([,a])=>!!a))},[t==null?void 0:t.translations]);return b.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:s,locale:r,translations:l})},[t.onResolveProps,s,r,l]),t.onResolveProps?null:o.jsx("section",{className:Ae.summaryCard,children:o.jsx(dt.SummaryCard,{dataSource:s,locale:r,translations:l})})},Ut={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},De=({inputs:t})=>o.jsx("section",{className:Ut.body,children:o.jsx("div",{className:Ut.body_content,children:t.map((e,s)=>o.jsx(b.Fragment,{children:e},s))})}),Le={slotStack:"_slotStack_1b4wy_1"},Ie=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c}=t,n=w.ThemeStore.useThemeStore(_=>_.theme.mode)==="dark",d=O(e,s,c!=null&&c.length?c:null),a=d&&d.length>0?o.jsx("div",{className:Le.slotStack,children:d.map((_,u)=>o.jsx(b.Fragment,{children:_},`box-${l}-${u}`))}):null;return o.jsx(w.Box,{darkMode:n,children:a})};var gt={exports:{}};/*!
|
|
9
|
+
*/var At;function be(){if(At)return tt;At=1;var t=x,e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,l=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(n,d,a){var _,u={},h=null,m=null;a!==void 0&&(h=""+a),d.key!==void 0&&(h=""+d.key),d.ref!==void 0&&(m=d.ref);for(_ in d)r.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:m,props:u,_owner:l.current}}return tt.Fragment=s,tt.jsx=c,tt.jsxs=c,tt}var Rt;function pe(){return Rt||(Rt=1,ht.exports=be()),ht.exports}var o=pe();const Dt=t=>{if(!(t!=null&&t.content))return null;const e={...t,children:t.content,type:t.variant};return o.jsx(w.Heading,{...e})},Lt=t=>{if(!t)return null;const e={...t,children:t.content};return o.jsx(w.Text,{...e})},O=(t,e,s,r)=>{var c;const l={accordion:n=>o.jsx(Te,{...n,userFlow:t,pageId:e}),aiChatPanel:n=>o.jsx(Se,{...n,userFlow:t,pageId:e,onResolveProps:r==null?void 0:r.aiChatPanel}),aiSummaryCard:n=>o.jsx(Re,{...n,userFlow:t,pageId:e,onResolveProps:r==null?void 0:r.aiSummaryCard}),aiPromptCodeEditor:n=>o.jsx(ve,{...n,userFlow:t,pageId:e}),box:n=>o.jsx(Ie,{...n,userFlow:t,pageId:e}),breadcrumbs:n=>o.jsx(Ue,{...n,userFlow:t,pageId:e}),tooltip:n=>o.jsx(zn,{...n,userFlow:t,pageId:e}),textarea:n=>o.jsx(Kn,{...n,userFlow:t,pageId:e}),card:n=>o.jsx(Xe,{...n,userFlow:t,pageId:e}),dropdownButton:n=>o.jsx(_n,{...n,userFlow:t,pageId:e}),menu:n=>o.jsx(fn,{...n,userFlow:t,pageId:e}),radioGroup:n=>o.jsx(Ge,{...n,userFlow:t,pageId:e}),stepper:n=>o.jsx(Ke,{...n,userFlow:t,pageId:e}),progressBar:n=>o.jsx(He,{...n,userFlow:t,pageId:e}),button:n=>o.jsx(Ve,{...n,userFlow:t,pageId:e}),cardAccordion:n=>o.jsx(ze,{...n,userFlow:t,pageId:e}),cardNotification:n=>o.jsx(We,{...n}),chart:n=>o.jsx(Wt,{...n,userFlow:t}),dataCard:n=>o.jsx(on,{...n,userFlow:t,pageId:e}),checkbox:n=>o.jsx(an,{...n,userFlow:t,pageId:e}),code:n=>o.jsx(rn,{...n,userFlow:t,pageId:e}),divider:n=>o.jsx(ln,{...n}),drawer:n=>o.jsx(dn,{...n,userFlow:t,pageId:e}),heading:n=>Dt(n),link:n=>o.jsx(hn,{...n,userFlow:t,pageId:e}),pill:n=>o.jsx(bn,{...n}),previewerMarkdown:n=>o.jsx(pn,{...n}),modal:n=>o.jsx(gn,{...n,userFlow:t,pageId:e}),roundButton:n=>o.jsx(Cn,{...n,userFlow:t,pageId:e}),row:n=>o.jsx(Yt,{...n,userFlow:t,pageId:e}),select:n=>o.jsx(Sn,{...n,userFlow:t,pageId:e}),switch:n=>o.jsx(vn,{...n,userFlow:t,pageId:e}),spacing:n=>o.jsx(On,{...n,userFlow:t,pageId:e}),table:n=>o.jsx(In,{...n,userFlow:t,pageId:e}),tabs:n=>o.jsx(Gn,{...n,userFlow:t,pageId:e}),text:n=>Lt(n),textField:n=>o.jsx(Un,{...n,userFlow:t,pageId:e}),toast:n=>o.jsx(Vn,{...n,userFlow:t,pageId:e})};return(c=s==null?void 0:s.filter(Boolean))==null?void 0:c.map(n=>{const d=l[n.component];return d?d({...n,userFlow:t,pageId:e}):null})};function Ce(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)}function It(t,e){if(!(e!=null&&e.length))return!1;for(const s of e)if(s.when==="empty"){const r=t==null?void 0:t[s.key];if(Ce(r))return!0}return!1}function B(t,e){const s=E(r=>{var l;return(l=r[t])==null?void 0:l.entries});return x.useMemo(()=>({disabled:It(s,e)}),[e,s])}const Q=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},et=()=>new AbortController,je=(t,e={},s={},r=!1,l)=>{const i=et();r&&i.abort();const c=Q(e);return{call:U.get(t,{headers:{...c},params:s,signal:i.signal,_userFlow:l}),controller:i}},ft=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:U.post(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},we=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:U.put(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},Ne=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:U.patch(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},ke=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:U.delete(t,{headers:{...n},data:s,params:r,signal:c.signal,_userFlow:i}),controller:c}},Mt=()=>{let t;return{callEndpoint:async r=>{r.controller&&(t=r.controller);let l={};try{l=await r.call}catch(i){throw i}return l},cancelEndpoint:()=>{t&&t.abort()}}},Bt=async(t,e,s="",r={},l={})=>{try{const{callEndpoint:i}=Mt(),{api:c,headers:n}=t,d=sessionStorage.getItem("sessionId"),a=new URLSearchParams({session_name:e});s&&a.append("hash_code",s),d&&a.append("sessionId",d);const _=`${c}/not-front/next-ui/?${a.toString()}`,u=Q(n),h=ft(_,u,r,l,!1,e);return await i(h)}catch(i){return console.error(i),Promise.reject(i)}},Gt=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"}},Ee=(t,e,s)=>{const{url:r,paginationKeys:l,params:i}=t,c=[],n=(l==null?void 0:l.page)??"page";if(c.push(`${n}=${e}`),typeof s=="string"){const _=(l==null?void 0:l.text)??"text";c.push(`${_}=${encodeURIComponent(s||"")}`)}if(i&&typeof i=="object"){const _=Object.entries(i).map(([u,h])=>`${encodeURIComponent(u)}=${encodeURIComponent(h)}`);c.push(..._)}const d=c.join("&");return d?`${r}?${d}`:r},mt=(t,e,s,r)=>{const{type:l,url:i,method:c,headers:n}=t;if(l==="rest"){const d=Ee(t,e,s),_={...(t==null?void 0:t.data)??{},...r??{}};return{type:"rest",url:d,method:Gt(c),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}}},K=()=>{const t=E(n=>n),{callEndpoint:e}=Mt(),s=async(n,d,a,_,u=!0)=>{var h;try{const m=(h=t[n])==null?void 0:h.apiConfig,g={state:{...a},triggerKey:_};return u&&q(n,!0),await Bt(m,n,d,g)}catch(m){throw u&&q(n,!1),console.error("[getNextUI] Error fetching next UI:",m),m}},r=(n,d)=>{const{url:a,headers:_,data:u,params:h}=n;switch(Gt(n.method)){case"post":return ft(a,_,u,{},!1,d);case"put":return we(a,_,u,{},!1,d);case"patch":return Ne(a,_,u,{},!1,d);case"delete":return ke(a,_,u,h,!1,d);case"get":default:return je(a,_,h,!1,d)}},l=(n,d)=>{const{url:a,headers:_}=n,u={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return ft(a,{..._,"Content-Type":"application/json"},u,{},!1,d)},i=async(n,d,a=!0)=>{var _,u;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}a&&q(d,!0);try{let h;switch(n==null?void 0:n.type){case"rest":h=r(n,d);break;case"graphql":h=l(n,d);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await e(h)}catch(h){const m=h;return console.error("[fetchDataSource] Error:",m),{status:((_=m==null?void 0:m.response)==null?void 0:_.status)??0,data:((u=m==null?void 0:m.response)==null?void 0:u.data)??{message:m==null?void 0:m.message,code:m==null?void 0:m.code,config:m==null?void 0:m.config}}}finally{a&&q(d,!1)}};return{getNextUI:s,fetchDataSource:i,fetchAndGetNextUI:async(n,d,a,_,u)=>{try{q(n,!0);const h=await i(u,n,!1);return h&&await s(n,d,a,_)}catch(h){throw q(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",h),h}}}},Kt={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},Te=t=>{const{userFlow:e,pageId:s,responseKey:r,dependencies:l,customContent:i,actionContent:c,components:n,...d}=t,{getNextUI:a}=K(),[_,u]=x.useState(d.checkboxChecked||!1),{disabled:h}=B(e,l),m=O(e,s,n),g=c?O(e,s,c):void 0,b=i?O(e,s,i):void 0,y=x.useCallback(async C=>{var N;try{const j=C.target.checked;u(j);const k={...(N=E.getState()[e])==null?void 0:N.entries,[r]:j};if(A(e,k),d.actionType==="GO_TO_NEXT_UI"){const T=await a(e,s,k,r);T!=null&&T.data&&I(e,T==null?void 0:T.data)}}catch(j){console.error("Error in accordion checkbox action:",j),alert(JSON.stringify(j))}},[e,s,r,d.actionType,a]),f=d.disabled||h,p={...d,className:Kt.accordion,disabled:f,checkboxChecked:_,onChanceCheckbox:d.hasCheckbox?y:void 0,actionContent:g?o.jsx(o.Fragment,{children:g.map((C,N)=>o.jsx(x.Fragment,{children:C},`accordion-action-${N}`))}):void 0,customContent:b?o.jsx(o.Fragment,{children:b.map((C,N)=>o.jsx(x.Fragment,{children:C},`accordion-custom-${N}`))}):void 0,children:m?o.jsx("section",{className:Kt.accordionBody,children:m.map((C,N)=>o.jsx(x.Fragment,{children:C},`accordion-child-${N}`))}):void 0};return o.jsx(w.Accordion,{...p})},Se=t=>{const e=w.ThemeStore.useThemeStore(c=>c.theme.mode),s=t.dataSource,r=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]),l=t.locale??"en",i=x.useMemo(()=>{var n,d,a,_,u;const c={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:(a=t==null?void 0:t.translations)==null?void 0:a.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(c).filter(([,h])=>!!h))},[t==null?void 0:t.translations]);return x.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:r,locale:l,translations:i,initialSuggestions:t.initialSuggestions,theme:e})},[t.onResolveProps,r,l,i,t.initialSuggestions,e]),t.onResolveProps?null:o.jsx(dt.ChatPanel,{dataSource:r,locale:l,translations:i,initialSuggestions:t.initialSuggestions,theme:e})},Oe={promptCodeEditor:"_promptCodeEditor_1d57s_1"},ve=t=>{const{userFlow:e,responseKey:s,codeBlockValue:r,language:l,disabled:i,dependencies:c,dataSource:n,inputLabel:d,inputPlaceholder:a,codeBlockLabel:_}=t,u=w.ThemeStore.useThemeStore(C=>C.theme.mode),[h,m]=x.useState(r||""),{disabled:g}=B(e,c),b=i??g,y=l??"json",f={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},p=C=>{m(C);const N={[s]:C};A(e,N)};return x.useEffect(()=>{r!==void 0&&r!==h&&m(r)},[r]),o.jsx("section",{className:Oe.promptCodeEditor,children:o.jsx(dt.PromptCodeEditor,{themeMode:u,requestConfig:f,language:y,disabled:b,inputLabel:d,inputPlaceholder:a,codeBlockLabel:_,codeBlockValue:h,onCodeChange:p})})},Ae={summaryCard:"_summaryCard_jva4h_1"},Re=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]),r=t.locale??"en",l=x.useMemo(()=>{var c,n,d;const i={title:(c=t==null?void 0:t.translations)==null?void 0:c.title,loading:(n=t==null?void 0:t.translations)==null?void 0:n.loading,noData:(d=t==null?void 0:t.translations)==null?void 0:d.noData};return Object.fromEntries(Object.entries(i).filter(([,a])=>!!a))},[t==null?void 0:t.translations]);return x.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:s,locale:r,translations:l})},[t.onResolveProps,s,r,l]),t.onResolveProps?null:o.jsx("section",{className:Ae.summaryCard,children:o.jsx(dt.SummaryCard,{dataSource:s,locale:r,translations:l})})},Ht={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},De=({inputs:t})=>o.jsx("section",{className:Ht.body,children:o.jsx("div",{className:Ht.body_content,children:t.map((e,s)=>o.jsx(x.Fragment,{children:e},s))})}),Le={slotStack:"_slotStack_1b4wy_1"},Ie=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c}=t,n=w.ThemeStore.useThemeStore(_=>_.theme.mode)==="dark",d=O(e,s,c!=null&&c.length?c:null),a=d&&d.length>0?o.jsx("div",{className:Le.slotStack,children:d.map((_,u)=>o.jsx(x.Fragment,{children:_},`box-${l}-${u}`))}):null;return o.jsx(w.Box,{darkMode:n,children:a})};var gt={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 Me(){return Vt||(Vt=1,(function(t){(function(){var e={}.hasOwnProperty;function s(){for(var r=[],l=0;l<arguments.length;l++){var i=arguments[l];if(i){var c=typeof i;if(c==="string"||c==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var n=s.apply(null,i);n&&r.push(n)}}else if(c==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var d in i)e.call(i,d)&&i[d]&&r.push(d)}}}return r.join(" ")}t.exports?(s.default=s,t.exports=s):window.classNames=s})()})(gt)),gt.exports}var Be=Me();const Y=xe(Be),Z={fieldset:"_fieldset_1xrth_1",fieldsetColumn:"_fieldsetColumn_1xrth_8",legend:"_legend_1xrth_14",options:"_options_1xrth_20",optionsRow:"_optionsRow_1xrth_25",optionsColumn:"_optionsColumn_1xrth_36"},Ge=t=>{const{userFlow:e,pageId:s,responseKey:r,label:l,value:i,required:c,actionType:n,dependencies:d,direction:a,items:_}=t,u=a==="column"?"column":"row",{getNextUI:h}=K(),{disabled:f}=B(e,d),g=E(C=>{var N,j;return(j=(N=C[e])==null?void 0:N.entries)==null?void 0:j[r]}),x=g!=null?String(g):i??"",y=f,m=b.useMemo(()=>l?c?`${l} *`:l:null,[l,c]),p=b.useCallback(async C=>{var N;if(!y)try{const j={...(N=E.getState()[e])==null?void 0:N.entries,[r]:C};if(A(e,j),n==="GO_TO_NEXT_UI"||n==="GO_TO_NEXT_UI_WITHOUT_LOADING"){const R=await h(e,s,j,r,n==="GO_TO_NEXT_UI");R!=null&&R.data&&I(e,R==null?void 0:R.data)}}catch(j){alert(JSON.stringify(j))}},[n,h,y,s,r,e]);return o.jsxs("fieldset",{className:Y(Z.fieldset,u==="column"&&Z.fieldsetColumn),children:[m?o.jsx("legend",{className:Z.legend,children:m}):null,o.jsx("div",{className:Y(Z.options,u==="column"?Z.optionsColumn:Z.optionsRow),children:_.map(C=>o.jsx(w.RadioButton,{name:r,value:C.value,checked:x===C.value,disabled:y||C.disabled,labelRight:C.label,onChange:()=>{p(C.value)}},C.value))})]})},Ke=({userFlow:t,pageId:e,component:s,hash:r,responseKey:l,items:i,itemActive:c,darkMode:n})=>o.jsx(w.Stepper,{items:i,itemActive:c,darkMode:n}),Ue=({userFlow:t,pageId:e,component:s,hash:r,responseKey:l,total:i,done:c,inProgress:n})=>o.jsx(w.ProgressBar,{total:i,done:c,inProgress:n}),Ve=({userFlow:t,items:e,responseKey:s})=>{const{getNextUI:r}=K(),l=b.useCallback(async({actionType:c,hashCode:n,redirectUrl:d})=>{var a;try{switch(c){case"GO_TO_NEXT_UI":const _=await r(t,n,{...(a=E.getState()[t])==null?void 0:a.entries},s);_!=null&&_.data&&I(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: ${c}`);break}}catch(_){alert(JSON.stringify(_))}},[]),i=b.useMemo(()=>e==null?void 0:e.map(c=>({title:c==null?void 0:c.title,component:o.jsx("div",{onClick:()=>l(c)})})),[]);return o.jsx(w.Breadcrumbs,{items:i})};function yt(t,e){const{getNextUI:s,fetchDataSource:r,fetchAndGetNextUI:l}=K();return b.useCallback(async i=>{var h,f,g,x;const{responseKey:c,actionType:n,dataSource:d,redirectUrl:a,dependencies:_}=i,u=(h=E.getState()[t])==null?void 0:h.entries;if(!It(u,_))try{const y={...(f=E.getState()[t])==null?void 0:f.entries,[c]:{status:200}};switch(A(t,y),n){case"CLOSE_MODAL":rt(t,!1);break;case"CLOSE_DRAWER":W(t,!1);break;case"OPEN_DRAWER":W(t,!0);break;case"GO_TO_NEXT_UI":{const m=await s(t,e,y,c);m!=null&&m.data&&I(t,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await l(t,e,y,c,d);m!=null&&m.data&&I(t,m==null?void 0:m.data);break}case"FETCH_DATA_SOURCE":{const m=await r(d,t,!1);A(t,{[c]:{status:m==null?void 0:m.status,content:m==null?void 0:m.data}});break}case"GET_DATA_SOURCE":{const m=await s(t,e,y,c),p=(g=m==null?void 0:m.data)==null?void 0:g.content;if((p==null?void 0:p.type)!=="fetch")break;const C=p==null?void 0:p.dataSource,N=await r(C,t,!1),j={...(x=E.getState()[t])==null?void 0:x.entries,[c]:{status:N==null?void 0:N.status,content:N==null?void 0:N.data}};A(t,j);const k=await s(t,e,j,c);k!=null&&k.data&&I(t,k==null?void 0:k.data);break}case"REDIRECT":a?window.location.href=a:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${n}`)}}catch(y){alert(JSON.stringify(y))}},[l,r,s,e,t])}const He=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,content:c,dataSource:n,redirectUrl:d,dependencies:a,onClick:_,...u}=t,h=yt(e,s),{disabled:f}=B(e,a),g={...u,children:c??i},x=(g==null?void 0:g.disabled)??f,[y,m]=b.useState(!1),p=b.useRef(!1),C=b.useCallback(async()=>{if(p.current)return;const N=l==="FETCH_DATA_SOURCE";N&&(p.current=!0,m(!0));try{await h({responseKey:r,actionType:l,dataSource:n,redirectUrl:d,dependencies:a})}catch(j){console.error("[ButtonNotFront] Action failed:",j)}finally{N&&(p.current=!1,m(!1))}},[l,n,a,d,r,h]);return o.jsx(w.Button,{...g,loading:g.loading||y,disabled:x,onClick:()=>!x&&!y&&(_??C)()})},Ht={slotStack:"_slotStack_12u4t_5"},ze=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,dependencies:c,content:n,actionContent:d,...a}=t,{disabled:_}=B(e,c),u=O(e,s,n&&n.length>0?n:null),h=O(e,s,d&&d.length>0?d:null),f=u&&u.length>0?o.jsx("div",{className:Ht.slotStack,children:u.map((y,m)=>o.jsx(b.Fragment,{children:y},`card-accordion-body-${l}-${m}`))}):void 0,g=h&&h.length>0?o.jsx("div",{className:Ht.slotStack,children:h.map((y,m)=>o.jsx(b.Fragment,{children:y},`card-accordion-actions-${l}-${m}`))}):void 0,x=a.disabled||_;return o.jsx(w.CardAccordion,{...a,disabled:x,actionContent:g,children:f??null})},Je={slotStack:"_slotStack_ivk5b_1"},Xe=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,colorId:n,disabled:d,actionType:a,dataSource:_,redirectUrl:u,dependencies:h}=t,{getNextUI:f,fetchDataSource:g,fetchAndGetNextUI:x}=K(),{disabled:y}=B(e,h),m=d??y,p=O(e,s,c&&c.length>0?c:null),C=p&&p.length>0?o.jsx("div",{className:Je.slotStack,children:p.map((j,k)=>o.jsx(b.Fragment,{children:j},`card-body-${l}-${k}`))}):null,N=b.useCallback(async()=>{var j,k,T;if(!(!a||m))try{const R={...(j=E.getState()[e])==null?void 0:j.entries,[i]:{status:200}};switch(A(e,R),a){case"CLOSE_MODAL":rt(e,!1);break;case"CLOSE_DRAWER":W(e,!1);break;case"OPEN_DRAWER":W(e,!0);break;case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const M=await f(e,s,R,i,a==="GO_TO_NEXT_UI");M!=null&&M.data&&I(e,M==null?void 0:M.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const D=await x(e,s,R,i,_);D!=null&&D.data&&I(e,D==null?void 0:D.data);break}case"GET_DATA_SOURCE":{const D=await f(e,s,R,i),M=(k=D==null?void 0:D.data)==null?void 0:k.content;if((M==null?void 0:M.type)!=="fetch")break;const P=M==null?void 0:M.dataSource,z=await g(P,e,!1),v={...(T=E.getState()[e])==null?void 0:T.entries,[i]:{status:z==null?void 0:z.status,content:z==null?void 0:z.data}};A(e,v);const U=await f(e,s,v,i);U!=null&&U.data&&I(e,U==null?void 0:U.data);break}case"REDIRECT":u&&(window.location.href=u);break;default:console.warn(`Unhandled card actionType: ${a}`)}}catch(R){alert(JSON.stringify(R))}},[a,_,m,x,g,f,s,u,i,e]);return o.jsx(w.Card,{colorId:n,disabled:m,onClick:a&&!m?()=>void N():void 0,children:C})},We=t=>{const{content:e,description:s,...r}=t,l={...r,children:e??s};return o.jsx(w.CardNotification,{...l})},xt=t=>Array.isArray(t)?t:typeof t=="object"?JSON.stringify(t):t,qe=(t,e)=>{if(!e||t==null)return null;const{extractionJsonPath:s,injectionJsonPath:r}=e,l=G.value(t,s);if(l==null)return null;try{const i={};return G.value(i,r,l),i}catch(i){return console.warn("[buildCursorPayload] invalid injectionJsonPath:",r,i),null}},zt=(t,e,s,r)=>{const l=G.query(t,e),i=l==null?void 0:l.map(a=>{var _,u;if(s){const h={};for(const[f,g]of Object.entries(s))if(typeof g=="object"&&"path"in g){const x=g,y=(_=G.query(a,x.path))==null?void 0:_[0];x.translations&&String(y)in x.translations?h[f]=xt(x.translations[String(y)]):h[f]=xt(y)}else{const x=g;h[f]=xt((u=G.query(a,x))==null?void 0:u[0])}return h}else return a}),c=G.value(t,(r==null?void 0:r.size)??"$.meta.size")??l.length,n=G.value(t,(r==null?void 0:r.total)??"$.meta.total")??0,d={size:c,total:n,totalPages:r!=null&&r.totalPages?G.value(t,(r==null?void 0:r.totalPages)??"$.meta.totalPages"):c>0?Math.ceil(n/c):0};return{items:i,pagination:d}},bt=({width:t,data:e,Chart:s,children:r})=>t?o.jsx(s,{width:t,height:it,data:e,children:r}):o.jsx(L.ResponsiveContainer,{width:"100%",height:it,children:o.jsx(s,{data:e,children:r})}),ct=({withPadding:t=!1})=>{const e=s=>o.jsx("span",{style:{color:H.labelColor},children:s});return o.jsx(L.Legend,{formatter:e,wrapperStyle:{fontSize:H.fontSize,fontFamily:H.fontFamily,padding:t?"1rem 0":"0"}})},Qe=({active:t,payload:e,label:s,tooltipKey:r})=>{var i;if(!t||!e||!e.length)return null;const l={backgroundColor:H.tooltipBg,borderRadius:H.tooltipBorderRadius,color:H.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(r){const c=(i=e[0])==null?void 0:i.payload;if(c&&c[r]!==void 0&&c[r]!==null)return o.jsx("div",{style:l,children:o.jsx("p",{style:{margin:0},children:c[r]})})}return o.jsxs("div",{style:l,children:[o.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:s}),e.map((c,n)=>o.jsx("p",{style:{margin:"2px 0",color:c.color},children:`${c.name}: ${c.value}`},n))]})},lt=({tooltipKey:t}={})=>o.jsx(L.Tooltip,{content:o.jsx(Qe,{tooltipKey:t})}),pt=({dataKey:t,hide:e=!1})=>o.jsx(L.XAxis,{dataKey:t,hide:e,tick:{fill:H.labelColor,fontSize:H.fontSize}}),Ct=()=>o.jsx(L.YAxis,{tick:{fill:H.labelColor,fontSize:H.fontSize}}),Ye=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l,width:i}=t;return o.jsxs(bt,{width:i,data:e,Chart:L.AreaChart,children:[o.jsx(L.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(pt,{dataKey:s}),o.jsx(Ct,{}),o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),r.map((c,n)=>o.jsx(L.Area,{type:"monotone",dataKey:c,stroke:J[n%J.length],fill:J[n%J.length]},c))]})},Ze=t=>{const{data:e,yKeys:s,xKey:r,tooltipKey:l,width:i}=t;return o.jsxs(bt,{width:i,data:e,Chart:L.BarChart,children:[o.jsx(L.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(pt,{dataKey:r}),o.jsx(Ct,{}),o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),s.map((c,n)=>o.jsx(L.Bar,{dataKey:c,fill:J[n%J.length]},c))]})},Fe=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l,width:i}=t;return o.jsxs(bt,{width:i,data:e,Chart:L.LineChart,children:[o.jsx(L.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(pt,{dataKey:s}),o.jsx(Ct,{}),o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),r.map((c,n)=>o.jsx(L.Line,{type:"monotone",dataKey:c,stroke:J[n%J.length],strokeWidth:2,dot:!1},c))]})},Pe=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l}=t,i=({cx:c,cy:n,midAngle:d,innerRadius:a,outerRadius:_,value:u})=>{const h=Math.PI/180,f=25+a+(_-a),g=c+f*Math.cos(-(d??0)*h),x=n+f*Math.sin(-(d??0)*h);return o.jsx("text",{x:g,y:x,fill:H.labelColor,color:H.labelColor,textAnchor:"middle",dominantBaseline:"central",children:u})};return o.jsx(L.ResponsiveContainer,{width:"100%",height:it,children:o.jsxs(L.PieChart,{children:[o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),o.jsx(L.Pie,{data:e,dataKey:r[0],nameKey:s,label:i,outerRadius:120,children:e.map((c,n)=>o.jsx(L.Cell,{fill:J[n%J.length]},`cell-${n}`))})]})})},it=400,Jt=56,$e=new Set(["bar","line","area"]),tn={area:Ye,bar:Ze,line:Fe,pie:Pe},J=["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)"],H={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"};function en(t,e,s=Jt){return t<=0?0:e<=0?t:Math.max(t,e*s)}const Xt={chartScrollViewport:"_chartScrollViewport_sm5hx_1",chartScrollViewport_track:"_chartScrollViewport_track_sm5hx_29"},nn="Scrollable chart area",sn=({dataLength:t,minCategoryWidth:e,children:s})=>{const r=b.useRef(null),[l,i]=b.useState(0),c=e??Jt;b.useEffect(()=>{const _=r.current;if(!_)return;const u=()=>{i(_.clientWidth)};u();const h=new ResizeObserver(u);return h.observe(_),()=>h.disconnect()},[]);const n=en(l,t,c),d=l>0&&n>l,a=b.useCallback(_=>{const u=r.current;if(u)switch(_.key){case"ArrowLeft":u.scrollLeft-=c,_.preventDefault();break;case"ArrowRight":u.scrollLeft+=c,_.preventDefault();break;case"Home":u.scrollLeft=0,_.preventDefault();break;case"End":u.scrollLeft=u.scrollWidth-u.clientWidth,_.preventDefault();break}},[c]);return o.jsx("div",{ref:r,className:Xt.chartScrollViewport,role:d?"region":void 0,tabIndex:d?0:void 0,"aria-label":d?nn:void 0,onKeyDown:d?a:void 0,children:o.jsx("div",{className:Xt.chartScrollViewport_track,style:{width:n,height:it},children:l>0?s(n):null})})},Wt=t=>{const{component:e,userFlow:s,hash:r,responseKey:l,dataSource:i,...c}=t,n=tn[c.type],{fetchDataSource:d}=K(),[a,_]=b.useState(!1),[u,h]=b.useState([]),f=async()=>{var y,m;try{_(!0);const{jsonPathData:p,mapperData:C}=i,N=mt(i,1),j=await d(N,s,!1),k=p?(y=zt(j==null?void 0:j.data,p,C))==null?void 0:y.items:(m=j==null?void 0:j.data)==null?void 0:m.data;h(k),_(!1)}catch(p){alert(JSON.stringify(p)),_(!1)}};if(b.useEffect(()=>{n&&(i?f():h(c.data))},[]),!n)return o.jsx("div",{children:"Not supported chart type"});const g={...c,data:u};return a?o.jsx(w.SkeletonBase,{height:400}):u.length===0?o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):$e.has(c.type)?o.jsx(sn,{dataLength:u.length,minCategoryWidth:c.minCategoryWidth,children:y=>o.jsx(n,{...g,width:y})}):o.jsx(n,{...g})},an=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=t,_={...a},{getNextUI:u}=K(),[h,f]=b.useState(c||!1),{disabled:g}=B(e,d),x=b.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),y=b.useCallback(async()=>{var p;try{const C=!h;f(C);const N={...(p=E.getState()[e])==null?void 0:p.entries,[r]:C};switch(A(e,N),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,N,r,l==="GO_TO_NEXT_UI");k!=null&&k.data&&I(e,k==null?void 0:k.data);break}default:break}}catch(C){console.error("Error in checkbox action:",C),alert(JSON.stringify(C))}},[e,s,r,l,h]),m=(_==null?void 0:_.disabled)??g;return o.jsx(w.Checkbox,{..._,labelRight:x,checked:h,disabled:m,onChange:()=>{!m&&y()}})},F={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"},rn=t=>{const{userFlow:e,responseKey:s,label:r,language:l,placeholder:i,value:c,required:n,dependencies:d,disabled:a,showPreview:_,height:u="400px"}=t,[h,f]=b.useState(c??""),g=w.ThemeStore.useThemeStore(N=>N.theme.mode),{disabled:x}=B(e,d),y=a??x,m={json:kt.json(),markdown:ie.markdown(),sql:de.sql(),yaml:_e.yaml()},p=b.useMemo(()=>n&&r?`${r} *`:r??"",[r,n]),C=N=>{f(N);const j={[s]:N};A(e,j)};return o.jsxs("div",{className:F.codeEditor,children:[p&&p!==""&&o.jsx("label",{className:F.codeEditor_label,children:p}),o.jsxs("div",{className:F.codeEditor_wrapper,children:[o.jsx(le,{className:F.input,value:h,height:u,placeholder:i,extensions:[m[l]??kt.json()],onChange:N=>C(N),theme:g,editable:!y}),l==="markdown"&&_&&o.jsx("div",{className:F.preview,style:{height:u},children:o.jsx(w.PreviewerMarkdown,{className:F.preview_inner,children:h})})]})]})},qt={slotStack:"_slotStack_6n2wy_5"},on=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,topContent:n,icon:d,headerStatusColor:a,..._}=t,u=a?`palette_${a}_50`:void 0,h=O(e,s,c&&c.length>0?c:null),f=O(e,s,n&&n.length>0?n:null),g=h&&h.length>0?o.jsx("div",{className:qt.slotStack,children:h.map((y,m)=>o.jsx(b.Fragment,{children:y},`data-card-body-${l}-${m}`))}):void 0,x=f&&f.length>0?o.jsx("div",{className:qt.slotStack,children:f.map((y,m)=>o.jsx(b.Fragment,{children:y},`data-card-top-${l}-${m}`))}):void 0;return o.jsx(w.DataCard,{..._,icon:d,headerStatusColor:u,topContent:x,children:g})},cn={dividerNotFront:"_dividerNotFront_tze3j_1"},ln=t=>o.jsx(w.Divider,{...t,className:cn.dividerNotFront}),jt={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},dn=({userFlow:t,pageId:e,responseKey:s,header:r,body:l,footer:i,...c})=>{const n=E(x=>{var y;return(y=x[t])==null?void 0:y.isDrawerOpen}),d=E(x=>{var y;return(y=x[t])==null?void 0:y.isLoading}),a=n&&!d,_={...c,isOpen:a,children:null},u=b.useCallback(()=>{_t(t),W(t,!1)},[t]),h=Array.isArray(r)?O(t,e,r):r?o.jsx(w.Heading,{type:"h2",children:r}):void 0,f=O(t,e,l),g=i?O(t,e,i):void 0;return o.jsx(w.Drawer,{..._,className:jt.drawer,isOpen:a,onClose:u,heightGap:0,title:h?o.jsx(o.Fragment,{children:Array.isArray(h)?h.map((x,y)=>o.jsx(b.Fragment,{children:x},`drawer-header-${y}`)):h}):void 0,children:o.jsx("section",{className:jt.drawerBody,children:f.map((x,y)=>o.jsx(b.Fragment,{children:x},`drawer-body-${y}`))}),footer:g?o.jsx("div",{className:jt.drawerFooter,children:g.map((x,y)=>o.jsx(b.Fragment,{children:x},`drawer-footer-${y}`))}):void 0})},_n=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,items:n,disabled:d,variant:a,leftIcon:_,rightIcon:u}=t,h=yt(e,s),f=b.useMemo(()=>n.map(g=>({label:g.content??g.label??"",onClick:()=>{h({responseKey:g.responseKey,actionType:g.actionType,dataSource:g.dataSource,redirectUrl:g.redirectUrl,dependencies:g.dependencies})}})),[n,h]);return o.jsx(w.DropdownButton,{disabled:d,variant:a,items:f,children:o.jsxs(b.Fragment,{children:[_?o.jsx(Et.Icon,{name:_,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,c,u?o.jsx(Et.Icon,{name:u,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},Qt={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},un=({components:t=[]})=>o.jsx("section",{className:Y(Qt.header,"avocado-dark-theme"),children:o.jsx("div",{className:Qt.header_content,children:t.map((e,s)=>o.jsx(b.Fragment,{children:e},s))})}),hn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,content:i,redirectUrl:c,target:n,dependencies:d,component:a,hash:_,...u}=t,{getNextUI:h}=K(),{disabled:f}=B(e,d),g=l&&u?(()=>{const{href:m,target:p,download:C,...N}=u;return N})():u,x=b.useCallback(async()=>{var m;if(l)try{const p={...(m=E.getState()[e])==null?void 0:m.entries,[r]:{status:200}};switch(A(e,p),l){case"GO_TO_NEXT_UI":{const C=await h(e,s,p,r);C!=null&&C.data&&I(e,C==null?void 0:C.data);break}case"REDIRECT":if(!c){console.warn("Missing redirectUrl for REDIRECT actionType");break}n==="_blank"?window.open(c,"_blank","noopener,noreferrer"):window.location.assign(c);break;default:console.warn(`Unhandled actionType for link: ${l}`);break}}catch(p){alert(JSON.stringify(p))}},[l,h,s,c,r,n,e]),y=g.disabled??f;return o.jsx(w.Link,{...g,disabled:y,onClick:l?x:void 0,children:i})},fn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,items:c,closeOnClick:n,disabled:d,listOrigin:a,size:_,variant:u}=t,h=yt(e,s),f=b.useMemo(()=>c.map(g=>({icon:g.leftIcon,label:g.content??g.label??"",onClick:x=>{var y;(y=x==null?void 0:x.preventDefault)==null||y.call(x),h({responseKey:g.responseKey,actionType:g.actionType,dataSource:g.dataSource,redirectUrl:g.redirectUrl,dependencies:g.dependencies})}})),[c,h]);return o.jsx(w.Menu,{items:f,closeOnClick:n,disabled:d,listOrigin:a,size:_,variant:u})},mn={modalContent:"_modalContent_p06ci_1"},gn=({userFlow:t,pageId:e,responseKey:s,header:r,body:l,footer:i,headerStatusColor:c,...n})=>{const d=E(m=>{var p;return(p=m[t])==null?void 0:p.isModalOpen}),a=E(m=>{var p;return(p=m[t])==null?void 0:p.isLoading}),_=d&&!a,u={...n},h=(u==null?void 0:u.headerStatusColor)??c,f=b.useCallback(()=>{_t(t),rt(t,!1)},[t,s]),g=Array.isArray(r)?O(t,e,r):r,x=O(t,e,l),y=O(t,e,i);return o.jsx(w.Modal,{...u,headerStatusColor:h,header:typeof g=="string"?g:o.jsx(o.Fragment,{children:g.map((m,p)=>o.jsx(b.Fragment,{children:m},`modal-header-${p}`))}),children:o.jsx("section",{className:mn.modalContent,children:x.map((m,p)=>o.jsx(b.Fragment,{children:m},`modal-body-${p}`))}),actions:o.jsx(o.Fragment,{children:y.map((m,p)=>o.jsx(b.Fragment,{children:m},`modal-footer-${p}`))}),open:_,onClose:f})},yn=({userFlow:t,pageId:e})=>{var i,c;const s=fe(t);if(!s)return null;const r=[...(s==null?void 0:s.components)||[],...((i=s==null?void 0:s.header)==null?void 0:i.components)||[],...((c=s==null?void 0:s.body)==null?void 0:c.components)||[]],l=O(t,e,r);return o.jsx(o.Fragment,{children:l==null?void 0:l.map((n,d)=>{const a=`overlay-${d}-${s==null?void 0:s.hash}`;return o.jsx(b.Fragment,{children:n},a)})})},xn={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"}},bn=t=>{const{content:e,variant:s="neutral",...r}=t,l=xn[s],i={...r,children:e,color:(r==null?void 0:r.color)??l.color,textColor:(r==null?void 0:r.textColor)??l.textColor,iconColor:(r==null?void 0:r.iconColor)??l.iconColor};return o.jsx(w.Pill,{...i})},pn=t=>{const{content:e}=t;return o.jsx(w.PreviewerMarkdown,{children:e})},Cn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,dataSource:i,dependencies:c,onClick:n,...d}=t,{getNextUI:a,fetchAndGetNextUI:_}=K(),{disabled:u}=B(e,c),h={...d},f=(h==null?void 0:h.disabled)??u,g=b.useCallback(async()=>{var x;try{const y={...(x=E.getState()[e])==null?void 0:x.entries,[r]:{status:200}};switch(A(e,y),l){case"GO_TO_NEXT_UI":{const m=await a(e,s,y,r);m!=null&&m.data&&I(e,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await _(e,s,y,r,i);m!=null&&m.data&&I(e,m==null?void 0:m.data);break}case"CLOSE_MODAL":rt(e,!1);break;case"CLOSE_DRAWER":W(e,!1);break;case"OPEN_DRAWER":W(e,!0);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(y){alert(JSON.stringify(y))}},[l,i,s,r,e]);return o.jsx(w.RoundButton,{...h,disabled:f,onClick:()=>!f&&(n??g)()})},X={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"},Yt=t=>{const{userFlow:e,pageId:s,columnWidth:r,columns:l,gap:i="md",justifyContent:c="start",alignItems:n="stretch"}=t,d=Array.isArray(l)?l.map((a,_)=>{const u=`col_${_}`,h=`col_${_}`;if(Array.isArray(a))return{gap:"md",justifyContent:"start",alignItems:"start",items:a,hash:u,responseKey:h};const f=a;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:o.jsx("div",{className:Y(X.row,X[`row__gap-${i}`],X[`row__justify-${c}`],X[`row__align-${n}`]),children:d==null?void 0:d.map((a,_)=>{const u=(r==null?void 0:r[_])||`${100/d.length}%`,h=O(e,s,a.items);return!h||h.length===0?null:o.jsx("div",{className:Y(X.row_column,X[`row_column__gap-${a.gap}`],X[`row_column__justify-${a.justifyContent}`],X[`row_column__align-${a.alignItems}`]),style:{width:u},children:h},a.hash||_)})})};function Zt({userFlow:t,pageId:e,responseKey:s,actionType:r,getNextUI:l,isMulti:i=!1,debounceMs:c}){const n=b.useRef(null);b.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=b.useCallback(async _=>{var f;const u={...(f=E.getState()[t])==null?void 0:f.entries};if(_?(u[s]=_,A(t,u)):(delete u[s],me(t,s)),r&&(r==="GO_TO_NEXT_UI"||r==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const x=await l(t,e,u,s,r==="GO_TO_NEXT_UI");x!=null&&x.data&&I(t,x.data)}catch(g){console.error("[useSelectChange] Failed to fetch next UI",g)}},[t,e,s,r,l]);return b.useCallback(_=>{if(!i){d(_);return}if(c==null){d(_);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{d(_),n.current=null},c)},[i,c,d])}const jn=/\{([^}]+)\}/g,wn=(t,e)=>{var s;return e.includes("{")?e.replace(jn,(r,l)=>{var c;const i=(c=G.query(t,l.trim()))==null?void 0:c[0];return i!=null?String(i):""}):(s=G.query(t,e))==null?void 0:s[0]},Nn=(t,e,s,r)=>{const l=G.query(t,e);return(l==null?void 0:l.map(i=>{var d;const c=wn(i,s),n=r?(d=G.query(i,r))==null?void 0:d[0]:i;return{label:c,value:n}}))??[]},kn=(t,e,s,r=10)=>{var n,d;let l,i;if(s){const a=G.value(t,s.size??"$.meta.size")??r,_=G.value(t,s.total??"$.meta.total")??0;l=a,i=_}else{const a=t==null?void 0:t.meta;l=(a==null?void 0:a.size)??((n=a==null?void 0:a.page)==null?void 0:n.size)??r,i=(a==null?void 0:a.total)??((d=a==null?void 0:a.page)==null?void 0:d.total)??0}const c=i>0?Math.ceil(i/l)>e:!1;return{pageSize:l,total:i,hasMore:c}},Ft={selectNotFront:"_selectNotFront_ch3v5_1"},En=({userFlow:t,pageId:e,responseKey:s,required:r,dataSource:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:_,fetchDataSource:u}=K(),[h,f]=b.useState((a==null?void 0:a.value)??""),{disabled:g}=B(t,c),x=(a==null?void 0:a.disabled)??g,y=b.useMemo(()=>r&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,r]),m=b.useMemo(()=>{const j=a!=null&&a.isMulti?h:[h],k={};return Array.isArray(j)&&j.forEach(T=>{if(!T)return;const R=JSON.stringify(T.value),D=JSON.stringify(T.label);k[R]=T,D in k||(k[D]=T)}),k},[h]),p=Zt({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),C=j=>{f(j),p(j)},N=async(j,k,{page:T})=>{const{jsonPathLabel:R,jsonPathOptions:D,jsonPathValue:M,jsonPathPagination:P}=l,z=mt(l,T,j),v=await u(z,t,!1),U=v==null?void 0:v.data,nt=U?Nn(U,D,R,M):[],{hasMore:wt}=kn(U,T,P);return{options:nt,hasMore:wt,additional:{page:T+1}}};return o.jsx(w.SelectPagination,{...a,className:Ft.selectNotFront,label:y,value:h,disabled:x,noOptionsMessage:()=>o.jsx(o.Fragment,{children:"Sin opciones"}),onChange:j=>!x&&C(j),loadOptions:N,additional:{page:1},isOptionDisabled:j=>{const k=JSON.stringify(j==null?void 0:j.value),T=JSON.stringify(j==null?void 0:j.label);return!!(m!=null&&m[k])||!!(m!=null&&m[T])},debounceTimeout:350})},Tn=({userFlow:t,pageId:e,responseKey:s,dataSource:r,required:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:_}=K(),[u,h]=b.useState(a.value||""),{disabled:f}=B(t,c),g=(a==null?void 0:a.disabled)??f,x=b.useMemo(()=>l&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,l]),y=Zt({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),m=p=>{h(p),y(p)};return o.jsx(w.Select,{...a,className:Ft.selectNotFront,label:x,value:u,disabled:g,onChange:p=>!g&&m(p)})},Sn=t=>{const{dataSource:e}=t;return e?o.jsx(En,{...t}):o.jsx(Tn,{...t})},Pt={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"},On=t=>{const{size:e}=t,s=Y(Pt.spacing,Pt[`spacing__${e}`]);return o.jsx("div",{className:s})},vn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=t,_={...a},{getNextUI:u}=K(),[h,f]=b.useState(c||!1),{disabled:g}=B(e,d),x=(_==null?void 0:_.disabled)??g,y=b.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),m=b.useCallback(async()=>{var p;try{const C=!h;f(C);const N={...(p=E.getState()[e])==null?void 0:p.entries,[r]:C};switch(A(e,N),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,N,r,l==="GO_TO_NEXT_UI");k!=null&&k.data&&I(e,k==null?void 0:k.data);break}default:break}}catch(C){console.error("Error in switch action:",C),alert(JSON.stringify(C))}},[e,s,r,l,h]);return o.jsx(w.Switch,{..._,label:y,checked:h,disabled:x,onChange:()=>!x&&m()})},$t={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},An=({values:t})=>{const s=t==null?void 0:t.slice(0,4),r=(t==null?void 0:t.length)-4;return o.jsxs("div",{className:$t.tableArrayPills,children:[s.map((l,i)=>o.jsx(w.Pill,{children:String(l)},i)),r>0&&o.jsxs(w.Pill,{outlined:!0,children:["+",r]})]})},Rn=({userFlow:t,pageId:e,tableResponseKey:s,component:r,rowData:l})=>{const{getNextUI:i,fetchAndGetNextUI:c,fetchDataSource:n}=K(),d=O(t,e,[{...r}]),a=(d==null?void 0:d[0])||null;if(!a)return null;const{actionType:_,responseKey:u,dataSource:h}=a.props,f=b.useCallback(async()=>{var g,x,y;try{const m={...(g=E.getState()[t])==null?void 0:g.entries,[u]:{status:200},[s]:[{...l}]};switch(A(t,m),_){case"GO_TO_NEXT_UI":{const p=await i(t,e,m,u);p!=null&&p.data&&I(t,p==null?void 0:p.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const p=await c(t,e,m,u,h);p!=null&&p.data&&I(t,p==null?void 0:p.data);break}case"GET_DATA_SOURCE":{const p=await i(t,e,m,u),C=(x=p==null?void 0:p.data)==null?void 0:x.content;if((C==null?void 0:C.type)!=="fetch")break;const N=C==null?void 0:C.dataSource,j=await n(N,t,!1),k={...(y=E.getState()[t])==null?void 0:y.entries,[u]:{status:j==null?void 0:j.status,content:j==null?void 0:j.data}};A(t,k);const T=await i(t,e,k,u);T!=null&&T.data&&I(t,T==null?void 0:T.data);break}default:console.warn(`Unhandled actionType: ${_}`);break}}catch(m){alert(JSON.stringify(m))}},[_,h,e,u,t]);return b.cloneElement(a,{onClick:f})},Dn=()=>o.jsx("div",{className:$t.tableSkeleton,children:[...Array(10)].map((t,e)=>o.jsx(w.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),Ln=(t,e)=>!(e!=null&&e.length)||!t?t:t.map(s=>e.some(l=>Array.isArray(s!=null&&s.accessor?l[s==null?void 0:s.accessor]:void 0))?{...s,renderCell:l=>{const i=s.accessor?l[s.accessor]:void 0;return Array.isArray(i)?o.jsx(An,{values:i}):i??""}}:s),In=({userFlow:t,pageId:e,responseKey:s,component:r,dataSource:l,rightActions:i,data:c,pageSize:n,...d})=>{var M,P,z;const{fetchDataSource:a}=K(),[_,u]=b.useState(!1),[h,f]=b.useState(1),[g,x]=b.useState(null),y=!l&&Array.isArray(c),m=b.useRef(new Map([[1,null]])),p=b.useMemo(()=>{if(i!=null&&i.length)return i.map((v,U)=>({renderContent:nt=>o.jsx(Rn,{userFlow:t,pageId:e,tableResponseKey:s,component:v,rowData:nt},`tableRowAction${U}`)}))},[i,t,e,s]),C=async(v=1)=>{if(!l)return;const{mapperData:U,jsonPathData:nt,jsonPathPagination:wt,jsonPathCursorPagination:st}=l;if(st&&v!==1&&!m.current.has(v)){f(1),C(1);return}st&&v===1&&(m.current=new Map([[1,null]]));try{u(!0);const Nt=st?m.current.get(v)??null:null,qn=mt(l,v,void 0,Nt),$=await a(qn,t,!1);if(x(zt($==null?void 0:$.data,nt,U,wt)),st){const oe=qe($==null?void 0:$.data,st);oe&&m.current.set(v+1,oe)}u(!1)}catch(Nt){console.error("[TableNotFront] fetchData:",Nt),u(!1)}},N=v=>{f(v),C(v)};b.useEffect(()=>{y||C()},[]);const j=y?c:g==null?void 0:g.items,k=y&&!!n&&((c==null?void 0:c.length)??0)>n,T=b.useMemo(()=>{if(!k||!c||!n)return j??[];const v=(h-1)*n;return c.slice(v,v+n)},[k,c,n,h,j]),R=b.useMemo(()=>Ln(d.columns,j),[j,d.columns]),D={...d,data:T,columns:R??[],rightActions:p};return y?!j||j.length===0?o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):o.jsxs(o.Fragment,{children:[o.jsx(w.Table,{...D}),k&&n&&c&&o.jsx(w.Pager,{classname:{global:"row__end"},page:h,size:n,total:c.length,onChange:f})]}):o.jsx(o.Fragment,{children:_?o.jsx(Dn,{}):g&&((M=g==null?void 0:g.items)==null?void 0:M.length)>0?o.jsxs(o.Fragment,{children:[o.jsx(w.Table,{...D}),(g==null?void 0:g.pagination)&&((P=g==null?void 0:g.pagination)==null?void 0:P.totalPages)>1&&o.jsx(w.Pager,{classname:{global:"row__end"},page:h,size:g==null?void 0:g.pagination.size,total:(z=g==null?void 0:g.pagination)==null?void 0:z.total,onChange:N})]}):o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},Mn={tabsPanel:"_tabsPanel_kvslb_1"},Bn=({userFlow:t,pageId:e,components:s})=>{const r=O(t,e,s);return r!=null&&r.length?o.jsx("section",{className:Mn.tabsPanel,children:r.map((l,i)=>o.jsx(b.Fragment,{children:l},`tabs-panel-${i}`))}):null},Gn=({userFlow:t,pageId:e,hash:s,items:r,activeIndex:l,className:i,responseKey:c})=>{const n=r.map((a,_)=>({label:a.label,disabled:a.disabled,children:o.jsx(Bn,{userFlow:t,pageId:e,components:a.components},`${s}-tab-${_}`)})),d=a=>{var u;const _={...(u=E.getState()[t])==null?void 0:u.entries,[c]:a};A(t,_)};return o.jsx(w.Tabs,{className:i,activeIndex:l,items:n,onClick:d})},Kn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,required:c,dependencies:n,...d}=t,a={...d},[_,u]=b.useState((a==null?void 0:a.value)??""),{disabled:h}=B(e,n),f=(a==null?void 0:a.disabled)??h,g=b.useMemo(()=>c&&(a!=null&&a.label)?`${a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),x=y=>{var p;const m=(p=y==null?void 0:y.target)==null?void 0:p.value;u(m),A(e,{[i]:m})};return b.useEffect(()=>{u((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),o.jsx(w.Textarea,{...a,label:g,value:_,disabled:f,onChange:y=>!f&&x(y)})},Un={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},Vn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,required:c,dependencies:n,...d}=t,a={...d},[_,u]=b.useState((a==null?void 0:a.value)??""),{disabled:h}=B(e,n),f=(a==null?void 0:a.disabled)??h,g=b.useMemo(()=>c&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),x=y=>{var C;const m=(C=y==null?void 0:y.target)==null?void 0:C.value;u(m);const p={[i]:m};A(e,p)};return b.useEffect(()=>{u((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),o.jsx(w.TextField,{...a,className:Un.textFieldNotFront,allowClear:!1,label:g,value:_,disabled:f,onChange:y=>!f&&x(y)})},Hn=({userFlow:t,pageId:e,responseKey:s,variant:r,content:l,actionType:i,redirectUrl:c})=>{const n=b.useCallback(async()=>{_t(t);try{switch(i){case"AUTOCLOSE_AND_REDIRECT":window.location.href=c;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,c]);return b.useEffect(()=>{({info:w.toast.info,error:w.toast.error,success:w.toast.success,warning:w.toast.warning}[r]||w.toast.info)(l,{autoClose:i?!1:4e3,containerId:t,onClose:n})},[n,t]),null},te={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},zn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,label:n,placement:d,notShowArrow:a,visible:_}=t,u=O(e,s,c!=null&&c.length?c:null),h=u&&u.length>0?o.jsx("div",{className:te.tooltipNotFront_content,children:u.map((f,g)=>o.jsx(b.Fragment,{children:f},`tooltip-${l}-${g}`))}):null;return o.jsx(w.Tooltip,{className:te.tooltipNotFront,label:n,placement:d,notShowArrow:a,visible:_,children:h})};function Jn({sessionName:t,apiConfig:e,onResolveComponentProps:s,children:r}){const l=re(t,e,null,s);return o.jsxs(o.Fragment,{children:[l,r]})}const Xn={api:"",headers:{}},ee=({userFlow:t,components:e,hash:s,apiConfig:r})=>{const l=s??`${t}-page`;b.useState(()=>{var d,a;return(a=(d=E.getState()[t])==null?void 0:d.pages)!=null&&a[l]||at(t,r??Xn,{type:"page",hash:l,body:{components:e}}),null});const i=O(t,l,e);return o.jsx(o.Fragment,{children:i})};function ne(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 se=({payload:t,userFlow:e})=>{const s=ne(t.display),r=ee({userFlow:e,hash:t.id,components:s});return o.jsx(o.Fragment,{children:r})},Wn=se,ae=(t,e,s,r,l)=>{const i=O(t,e,(r==null?void 0:r.components)||null,l);switch(s){case"body":return o.jsx(De,{...r,inputs:i||[]},JSON.stringify(r==null?void 0:r.components));case"header":return o.jsx(un,{...r,components:i||[]},JSON.stringify(r==null?void 0:r.components));default:return null}},re=(t,e,s,r)=>{var h,f,g;const[l,i]=b.useState(!1),c=E(x=>x),n=(h=c[t])==null?void 0:h.currentPageId;b.useEffect(()=>{if(typeof window>"u")return;const x=new URL(window.location.href),y=x.searchParams.get("sessionId");y&&(sessionStorage.setItem("sessionId",y),x.searchParams.delete("sessionId"),window.history.replaceState({},"",x.toString()))},[]);const d=n?ae(t,n,"header",((f=c[t].pages[n].page)==null?void 0:f.header)||null,r):null,a=n?ae(t,n,"body",((g=c[t].pages[n].page)==null?void 0:g.body)||null,r):null,_=b.useMemo(()=>{var x;return o.jsxs(o.Fragment,{children:[((x=c[t])==null?void 0:x.isLoading)&&o.jsx(w.Loading,{}),d,a,n&&o.jsx(yn,{userFlow:t,pageId:n}),c[t]&&o.jsx(w.Toaster,{})]})},[d,a,n,t]),u=async()=>{try{const x=await Bt(e,t),y=x==null?void 0:x.data,m=y==null?void 0:y.content;(x==null?void 0:x.status)===200?at(t,e,m,y==null?void 0:y.sessionState):i(!0)}catch(x){console.error("[not-page]: API call failed",x),i(!0)}};return b.useEffect(()=>{e!=null&&e.api&&!s&&t?u():!(e!=null&&e.api)&&s&&t||e!=null&&e.api&&s&&t?at(t,e,s):(!(e!=null&&e.api)&&!s||!t)&&(i(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const x="avocado-theme-mode-changed",y=m=>{const p=m.detail;w.ThemeStore.setThemeMode(p)};return window.addEventListener(x,y),()=>{window.removeEventListener(x,y)}},[]),l&&console.error("[not-page]: No render page"),_};S.Chart=Wt,S.NotFrontPage=Jn,S.RenderNotFront=se,S.Row=Yt,S.extractNotFrontComponents=ne,S.heading=Dt,S.renderNotFront=Wn,S.text=Lt,S.useNotFrontFragment=ee,S.usePage=re,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
|
|
13
|
+
*/var Ut;function Me(){return Ut||(Ut=1,(function(t){(function(){var e={}.hasOwnProperty;function s(){for(var r=[],l=0;l<arguments.length;l++){var i=arguments[l];if(i){var c=typeof i;if(c==="string"||c==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var n=s.apply(null,i);n&&r.push(n)}}else if(c==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var d in i)e.call(i,d)&&i[d]&&r.push(d)}}}return r.join(" ")}t.exports?(s.default=s,t.exports=s):window.classNames=s})()})(gt)),gt.exports}var Be=Me();const Y=xe(Be),Z={fieldset:"_fieldset_1xrth_1",fieldsetColumn:"_fieldsetColumn_1xrth_8",legend:"_legend_1xrth_14",options:"_options_1xrth_20",optionsRow:"_optionsRow_1xrth_25",optionsColumn:"_optionsColumn_1xrth_36"},Ge=t=>{const{userFlow:e,pageId:s,responseKey:r,label:l,value:i,required:c,actionType:n,dependencies:d,direction:a,items:_}=t,u=a==="column"?"column":"row",{getNextUI:h}=K(),{disabled:m}=B(e,d),g=E(C=>{var N,j;return(j=(N=C[e])==null?void 0:N.entries)==null?void 0:j[r]}),b=g!=null?String(g):i??"",y=m,f=x.useMemo(()=>l?c?`${l} *`:l:null,[l,c]),p=x.useCallback(async C=>{var N;if(!y)try{const j={...(N=E.getState()[e])==null?void 0:N.entries,[r]:C};if(A(e,j),n==="GO_TO_NEXT_UI"||n==="GO_TO_NEXT_UI_WITHOUT_LOADING"){const R=await h(e,s,j,r,n==="GO_TO_NEXT_UI");R!=null&&R.data&&I(e,R==null?void 0:R.data)}}catch(j){alert(JSON.stringify(j))}},[n,h,y,s,r,e]);return o.jsxs("fieldset",{className:Y(Z.fieldset,u==="column"&&Z.fieldsetColumn),children:[f?o.jsx("legend",{className:Z.legend,children:f}):null,o.jsx("div",{className:Y(Z.options,u==="column"?Z.optionsColumn:Z.optionsRow),children:_.map(C=>o.jsx(w.RadioButton,{name:r,value:C.value,checked:b===C.value,disabled:y||C.disabled,labelRight:C.label,onChange:()=>{p(C.value)}},C.value))})]})},Ke=({userFlow:t,pageId:e,component:s,hash:r,responseKey:l,items:i,itemActive:c,darkMode:n})=>o.jsx(w.Stepper,{items:i,itemActive:c,darkMode:n}),He=({userFlow:t,pageId:e,component:s,hash:r,responseKey:l,total:i,done:c,inProgress:n})=>o.jsx(w.ProgressBar,{total:i,done:c,inProgress:n}),Ue=({userFlow:t,items:e,responseKey:s})=>{const{getNextUI:r}=K(),l=x.useCallback(async({actionType:c,hashCode:n,redirectUrl:d})=>{var a;try{switch(c){case"GO_TO_NEXT_UI":const _=await r(t,n,{...(a=E.getState()[t])==null?void 0:a.entries},s);_!=null&&_.data&&I(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: ${c}`);break}}catch(_){alert(JSON.stringify(_))}},[]),i=x.useMemo(()=>e==null?void 0:e.map(c=>({title:c==null?void 0:c.title,component:o.jsx("div",{onClick:()=>l(c)})})),[]);return o.jsx(w.Breadcrumbs,{items:i})};function yt(t,e){const{getNextUI:s,fetchDataSource:r,fetchAndGetNextUI:l}=K();return x.useCallback(async i=>{var h,m,g,b;const{responseKey:c,actionType:n,dataSource:d,redirectUrl:a,dependencies:_}=i,u=(h=E.getState()[t])==null?void 0:h.entries;if(!It(u,_))try{const y={...(m=E.getState()[t])==null?void 0:m.entries,[c]:{status:200}};switch(A(t,y),n){case"CLOSE_MODAL":rt(t,!1);break;case"CLOSE_DRAWER":W(t,!1);break;case"OPEN_DRAWER":W(t,!0);break;case"GO_TO_NEXT_UI":{const f=await s(t,e,y,c);f!=null&&f.data&&I(t,f==null?void 0:f.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const f=await l(t,e,y,c,d);f!=null&&f.data&&I(t,f==null?void 0:f.data);break}case"FETCH_DATA_SOURCE":{const f=await r(d,t,!1);A(t,{[c]:{status:f==null?void 0:f.status,content:f==null?void 0:f.data}});break}case"GET_DATA_SOURCE":{const f=await s(t,e,y,c),p=(g=f==null?void 0:f.data)==null?void 0:g.content;if((p==null?void 0:p.type)!=="fetch")break;const C=p==null?void 0:p.dataSource,N=await r(C,t,!1),j={...(b=E.getState()[t])==null?void 0:b.entries,[c]:{status:N==null?void 0:N.status,content:N==null?void 0:N.data}};A(t,j);const k=await s(t,e,j,c);k!=null&&k.data&&I(t,k==null?void 0:k.data);break}case"REDIRECT":a?window.location.href=a:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${n}`)}}catch(y){alert(JSON.stringify(y))}},[l,r,s,e,t])}const Ve=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,content:c,dataSource:n,redirectUrl:d,dependencies:a,onClick:_,...u}=t,h=yt(e,s),{disabled:m}=B(e,a),g={...u,children:c??i},b=(g==null?void 0:g.disabled)??m,[y,f]=x.useState(!1),p=x.useRef(!1),C=x.useCallback(async()=>{if(p.current)return;const N=l==="FETCH_DATA_SOURCE";N&&(p.current=!0,f(!0));try{await h({responseKey:r,actionType:l,dataSource:n,redirectUrl:d,dependencies:a})}catch(j){console.error("[ButtonNotFront] Action failed:",j)}finally{N&&(p.current=!1,f(!1))}},[l,n,a,d,r,h]);return o.jsx(w.Button,{...g,loading:g.loading||y,disabled:b,onClick:()=>!b&&!y&&(_??C)()})},Vt={slotStack:"_slotStack_12u4t_5"},ze=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,dependencies:c,content:n,actionContent:d,...a}=t,{disabled:_}=B(e,c),u=O(e,s,n&&n.length>0?n:null),h=O(e,s,d&&d.length>0?d:null),m=u&&u.length>0?o.jsx("div",{className:Vt.slotStack,children:u.map((y,f)=>o.jsx(x.Fragment,{children:y},`card-accordion-body-${l}-${f}`))}):void 0,g=h&&h.length>0?o.jsx("div",{className:Vt.slotStack,children:h.map((y,f)=>o.jsx(x.Fragment,{children:y},`card-accordion-actions-${l}-${f}`))}):void 0,b=a.disabled||_;return o.jsx(w.CardAccordion,{...a,disabled:b,actionContent:g,children:m??null})},Je={slotStack:"_slotStack_ivk5b_1"},Xe=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,colorId:n,disabled:d,actionType:a,dataSource:_,redirectUrl:u,dependencies:h}=t,{getNextUI:m,fetchDataSource:g,fetchAndGetNextUI:b}=K(),{disabled:y}=B(e,h),f=d??y,p=O(e,s,c&&c.length>0?c:null),C=p&&p.length>0?o.jsx("div",{className:Je.slotStack,children:p.map((j,k)=>o.jsx(x.Fragment,{children:j},`card-body-${l}-${k}`))}):null,N=x.useCallback(async()=>{var j,k,T;if(!(!a||f))try{const R={...(j=E.getState()[e])==null?void 0:j.entries,[i]:{status:200}};switch(A(e,R),a){case"CLOSE_MODAL":rt(e,!1);break;case"CLOSE_DRAWER":W(e,!1);break;case"OPEN_DRAWER":W(e,!0);break;case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const M=await m(e,s,R,i,a==="GO_TO_NEXT_UI");M!=null&&M.data&&I(e,M==null?void 0:M.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const D=await b(e,s,R,i,_);D!=null&&D.data&&I(e,D==null?void 0:D.data);break}case"GET_DATA_SOURCE":{const D=await m(e,s,R,i),M=(k=D==null?void 0:D.data)==null?void 0:k.content;if((M==null?void 0:M.type)!=="fetch")break;const P=M==null?void 0:M.dataSource,z=await g(P,e,!1),v={...(T=E.getState()[e])==null?void 0:T.entries,[i]:{status:z==null?void 0:z.status,content:z==null?void 0:z.data}};A(e,v);const H=await m(e,s,v,i);H!=null&&H.data&&I(e,H==null?void 0:H.data);break}case"REDIRECT":u&&(window.location.href=u);break;default:console.warn(`Unhandled card actionType: ${a}`)}}catch(R){alert(JSON.stringify(R))}},[a,_,f,b,g,m,s,u,i,e]);return o.jsx(w.Card,{colorId:n,disabled:f,onClick:a&&!f?()=>void N():void 0,children:C})},We=t=>{const{content:e,description:s,...r}=t,l={...r,children:e??s};return o.jsx(w.CardNotification,{...l})},xt=t=>Array.isArray(t)?t:typeof t=="object"?JSON.stringify(t):t,qe=(t,e)=>{if(!e||t==null)return null;const{extractionJsonPath:s,injectionJsonPath:r}=e,l=G.value(t,s);if(l==null)return null;try{const i={};return G.value(i,r,l),i}catch(i){return console.warn("[buildCursorPayload] invalid injectionJsonPath:",r,i),null}},zt=(t,e,s,r)=>{const l=G.query(t,e),i=l==null?void 0:l.map(a=>{var _,u;if(s){const h={};for(const[m,g]of Object.entries(s))if(typeof g=="object"&&"path"in g){const b=g,y=(_=G.query(a,b.path))==null?void 0:_[0];b.translations&&String(y)in b.translations?h[m]=xt(b.translations[String(y)]):h[m]=xt(y)}else{const b=g;h[m]=xt((u=G.query(a,b))==null?void 0:u[0])}return h}else return a}),c=G.value(t,(r==null?void 0:r.size)??"$.meta.size")??l.length,n=G.value(t,(r==null?void 0:r.total)??"$.meta.total")??0,d={size:c,total:n,totalPages:r!=null&&r.totalPages?G.value(t,(r==null?void 0:r.totalPages)??"$.meta.totalPages"):c>0?Math.ceil(n/c):0};return{items:i,pagination:d}},bt=({width:t,data:e,Chart:s,children:r})=>t?o.jsx(s,{width:t,height:it,data:e,children:r}):o.jsx(L.ResponsiveContainer,{width:"100%",height:it,children:o.jsx(s,{data:e,children:r})}),ct=({withPadding:t=!1})=>{const e=s=>o.jsx("span",{style:{color:V.labelColor},children:s});return o.jsx(L.Legend,{formatter:e,wrapperStyle:{fontSize:V.fontSize,fontFamily:V.fontFamily,padding:t?"1rem 0":"0"}})},Qe=({active:t,payload:e,label:s,tooltipKey:r})=>{var i;if(!t||!e||!e.length)return null;const l={backgroundColor:V.tooltipBg,borderRadius:V.tooltipBorderRadius,color:V.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(r){const c=(i=e[0])==null?void 0:i.payload;if(c&&c[r]!==void 0&&c[r]!==null)return o.jsx("div",{style:l,children:o.jsx("p",{style:{margin:0},children:c[r]})})}return o.jsxs("div",{style:l,children:[o.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:s}),e.map((c,n)=>o.jsx("p",{style:{margin:"2px 0",color:c.color},children:`${c.name}: ${c.value}`},n))]})},lt=({tooltipKey:t}={})=>o.jsx(L.Tooltip,{content:o.jsx(Qe,{tooltipKey:t})}),pt=({dataKey:t,hide:e=!1})=>o.jsx(L.XAxis,{dataKey:t,hide:e,tick:{fill:V.labelColor,fontSize:V.fontSize}}),Ct=()=>o.jsx(L.YAxis,{tick:{fill:V.labelColor,fontSize:V.fontSize}}),Ye=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l,width:i}=t;return o.jsxs(bt,{width:i,data:e,Chart:L.AreaChart,children:[o.jsx(L.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(pt,{dataKey:s}),o.jsx(Ct,{}),o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),r.map((c,n)=>o.jsx(L.Area,{type:"monotone",dataKey:c,stroke:J[n%J.length],fill:J[n%J.length]},c))]})},Ze=t=>{const{data:e,yKeys:s,xKey:r,tooltipKey:l,width:i}=t;return o.jsxs(bt,{width:i,data:e,Chart:L.BarChart,children:[o.jsx(L.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(pt,{dataKey:r}),o.jsx(Ct,{}),o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),s.map((c,n)=>o.jsx(L.Bar,{dataKey:c,fill:J[n%J.length]},c))]})},Fe=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l,width:i}=t;return o.jsxs(bt,{width:i,data:e,Chart:L.LineChart,children:[o.jsx(L.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(pt,{dataKey:s}),o.jsx(Ct,{}),o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),r.map((c,n)=>o.jsx(L.Line,{type:"monotone",dataKey:c,stroke:J[n%J.length],strokeWidth:2,dot:!1},c))]})},Pe=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l}=t,i=({cx:c,cy:n,midAngle:d,innerRadius:a,outerRadius:_,value:u})=>{const h=Math.PI/180,m=25+a+(_-a),g=c+m*Math.cos(-(d??0)*h),b=n+m*Math.sin(-(d??0)*h);return o.jsx("text",{x:g,y:b,fill:V.labelColor,color:V.labelColor,textAnchor:"middle",dominantBaseline:"central",children:u})};return o.jsx(L.ResponsiveContainer,{width:"100%",height:it,children:o.jsxs(L.PieChart,{children:[o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),o.jsx(L.Pie,{data:e,dataKey:r[0],nameKey:s,label:i,outerRadius:120,children:e.map((c,n)=>o.jsx(L.Cell,{fill:J[n%J.length]},`cell-${n}`))})]})})},it=400,Jt=56,$e=new Set(["bar","line","area"]),tn={area:Ye,bar:Ze,line:Fe,pie:Pe},J=["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)"],V={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"};function en(t,e,s=Jt){return t<=0?0:e<=0?t:Math.max(t,e*s)}const Xt={chartScrollViewport:"_chartScrollViewport_sm5hx_1",chartScrollViewport_track:"_chartScrollViewport_track_sm5hx_29"},nn="Scrollable chart area",sn=({dataLength:t,minCategoryWidth:e,children:s})=>{const r=x.useRef(null),[l,i]=x.useState(0),c=e??Jt;x.useEffect(()=>{const _=r.current;if(!_)return;const u=()=>{i(_.clientWidth)};u();const h=new ResizeObserver(u);return h.observe(_),()=>h.disconnect()},[]);const n=en(l,t,c),d=l>0&&n>l,a=x.useCallback(_=>{const u=r.current;if(u)switch(_.key){case"ArrowLeft":u.scrollLeft-=c,_.preventDefault();break;case"ArrowRight":u.scrollLeft+=c,_.preventDefault();break;case"Home":u.scrollLeft=0,_.preventDefault();break;case"End":u.scrollLeft=u.scrollWidth-u.clientWidth,_.preventDefault();break}},[c]);return o.jsx("div",{ref:r,className:Xt.chartScrollViewport,role:d?"region":void 0,tabIndex:d?0:void 0,"aria-label":d?nn:void 0,onKeyDown:d?a:void 0,children:o.jsx("div",{className:Xt.chartScrollViewport_track,style:{width:n,height:it},children:l>0?s(n):null})})},Wt=t=>{const{component:e,userFlow:s,hash:r,responseKey:l,dataSource:i,...c}=t,n=tn[c.type],{fetchDataSource:d}=K(),[a,_]=x.useState(!1),[u,h]=x.useState([]),m=async()=>{var y,f;try{_(!0);const{jsonPathData:p,mapperData:C}=i,N=mt(i,1),j=await d(N,s,!1),k=p?(y=zt(j==null?void 0:j.data,p,C))==null?void 0:y.items:(f=j==null?void 0:j.data)==null?void 0:f.data;h(k),_(!1)}catch(p){alert(JSON.stringify(p)),_(!1)}};if(x.useEffect(()=>{n&&(i?m():h(c.data))},[]),!n)return o.jsx("div",{children:"Not supported chart type"});const g={...c,data:u};return a?o.jsx(w.SkeletonBase,{height:400}):u.length===0?o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):$e.has(c.type)?o.jsx(sn,{dataLength:u.length,minCategoryWidth:c.minCategoryWidth,children:y=>o.jsx(n,{...g,width:y})}):o.jsx(n,{...g})},an=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=t,_={...a},{getNextUI:u}=K(),[h,m]=x.useState(c||!1),{disabled:g}=B(e,d),b=x.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),y=x.useCallback(async()=>{var p;try{const C=!h;m(C);const N={...(p=E.getState()[e])==null?void 0:p.entries,[r]:C};switch(A(e,N),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,N,r,l==="GO_TO_NEXT_UI");k!=null&&k.data&&I(e,k==null?void 0:k.data);break}default:break}}catch(C){console.error("Error in checkbox action:",C),alert(JSON.stringify(C))}},[e,s,r,l,h]),f=(_==null?void 0:_.disabled)??g;return o.jsx(w.Checkbox,{..._,labelRight:b,checked:h,disabled:f,onChange:()=>{!f&&y()}})},F={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"},rn=t=>{const{userFlow:e,responseKey:s,label:r,language:l,placeholder:i,value:c,required:n,dependencies:d,disabled:a,showPreview:_,height:u="400px"}=t,[h,m]=x.useState(c??""),g=w.ThemeStore.useThemeStore(N=>N.theme.mode),{disabled:b}=B(e,d),y=a??b,f={json:kt.json(),markdown:ie.markdown(),sql:de.sql(),yaml:_e.yaml()},p=x.useMemo(()=>n&&r?`${r} *`:r??"",[r,n]),C=N=>{m(N);const j={[s]:N};A(e,j)};return o.jsxs("div",{className:F.codeEditor,children:[p&&p!==""&&o.jsx("label",{className:F.codeEditor_label,children:p}),o.jsxs("div",{className:F.codeEditor_wrapper,children:[o.jsx(le,{className:F.input,value:h,height:u,placeholder:i,extensions:[f[l]??kt.json()],onChange:N=>C(N),theme:g,editable:!y}),l==="markdown"&&_&&o.jsx("div",{className:F.preview,style:{height:u},children:o.jsx(w.PreviewerMarkdown,{className:F.preview_inner,children:h})})]})]})},qt={slotStack:"_slotStack_6n2wy_5"},on=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,topContent:n,icon:d,headerStatusColor:a,..._}=t,u=a?`palette_${a}_50`:void 0,h=O(e,s,c&&c.length>0?c:null),m=O(e,s,n&&n.length>0?n:null),g=h&&h.length>0?o.jsx("div",{className:qt.slotStack,children:h.map((y,f)=>o.jsx(x.Fragment,{children:y},`data-card-body-${l}-${f}`))}):void 0,b=m&&m.length>0?o.jsx("div",{className:qt.slotStack,children:m.map((y,f)=>o.jsx(x.Fragment,{children:y},`data-card-top-${l}-${f}`))}):void 0;return o.jsx(w.DataCard,{..._,icon:d,headerStatusColor:u,topContent:b,children:g})},cn={dividerNotFront:"_dividerNotFront_tze3j_1"},ln=t=>o.jsx(w.Divider,{...t,className:cn.dividerNotFront}),jt={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},dn=({userFlow:t,pageId:e,responseKey:s,header:r,body:l,footer:i,...c})=>{const n=E(y=>{var f;return(f=y[t])==null?void 0:f.isDrawerOpen}),d=E(y=>{var f;return(f=y[t])==null?void 0:f.isLoading}),a=n&&!d,_={...c,isOpen:a,children:null},u=x.useCallback(()=>{_t(t),W(t,!1)},[t]),h=Array.isArray(r)?O(t,e,r):r?o.jsx(w.Heading,{type:"h2",children:r}):void 0,m=O(t,e,l),g=i?O(t,e,i):void 0;return o.jsx(w.Drawer,{..._,className:jt.drawer,isOpen:a,onClose:u,heightGap:50,title:h?o.jsx(o.Fragment,{children:Array.isArray(h)?h.map((y,f)=>o.jsx(x.Fragment,{children:y},`drawer-header-${f}`)):h}):void 0,children:o.jsx("section",{className:jt.drawerBody,children:m.map((y,f)=>o.jsx(x.Fragment,{children:y},`drawer-body-${f}`))}),footer:g?o.jsx("div",{className:jt.drawerFooter,children:g.map((y,f)=>o.jsx(x.Fragment,{children:y},`drawer-footer-${f}`))}):void 0})},_n=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,items:n,disabled:d,variant:a,leftIcon:_,rightIcon:u}=t,h=yt(e,s),m=x.useMemo(()=>n.map(g=>({label:g.content??g.label??"",onClick:()=>{h({responseKey:g.responseKey,actionType:g.actionType,dataSource:g.dataSource,redirectUrl:g.redirectUrl,dependencies:g.dependencies})}})),[n,h]);return o.jsx(w.DropdownButton,{disabled:d,variant:a,items:m,children:o.jsxs(x.Fragment,{children:[_?o.jsx(Et.Icon,{name:_,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,c,u?o.jsx(Et.Icon,{name:u,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},Qt={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},un=({components:t=[]})=>o.jsx("section",{className:Y(Qt.header,"avocado-dark-theme"),children:o.jsx("div",{className:Qt.header_content,children:t.map((e,s)=>o.jsx(x.Fragment,{children:e},s))})}),hn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,content:i,redirectUrl:c,target:n,dependencies:d,component:a,hash:_,...u}=t,{getNextUI:h}=K(),{disabled:m}=B(e,d),g=l&&u?(()=>{const{href:f,target:p,download:C,...N}=u;return N})():u,b=x.useCallback(async()=>{var f;if(l)try{const p={...(f=E.getState()[e])==null?void 0:f.entries,[r]:{status:200}};switch(A(e,p),l){case"GO_TO_NEXT_UI":{const C=await h(e,s,p,r);C!=null&&C.data&&I(e,C==null?void 0:C.data);break}case"REDIRECT":if(!c){console.warn("Missing redirectUrl for REDIRECT actionType");break}n==="_blank"?window.open(c,"_blank","noopener,noreferrer"):window.location.assign(c);break;default:console.warn(`Unhandled actionType for link: ${l}`);break}}catch(p){alert(JSON.stringify(p))}},[l,h,s,c,r,n,e]),y=g.disabled??m;return o.jsx(w.Link,{...g,disabled:y,onClick:l?b:void 0,children:i})},fn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,items:c,closeOnClick:n,disabled:d,listOrigin:a,size:_,variant:u}=t,h=yt(e,s),m=x.useMemo(()=>c.map(g=>({icon:g.leftIcon,label:g.content??g.label??"",onClick:b=>{var y;(y=b==null?void 0:b.preventDefault)==null||y.call(b),h({responseKey:g.responseKey,actionType:g.actionType,dataSource:g.dataSource,redirectUrl:g.redirectUrl,dependencies:g.dependencies})}})),[c,h]);return o.jsx(w.Menu,{items:m,closeOnClick:n,disabled:d,listOrigin:a,size:_,variant:u})},mn={modalContent:"_modalContent_p06ci_1"},gn=({userFlow:t,pageId:e,responseKey:s,header:r,body:l,footer:i,headerStatusColor:c,...n})=>{const d=E(f=>{var p;return(p=f[t])==null?void 0:p.isModalOpen}),a=E(f=>{var p;return(p=f[t])==null?void 0:p.isLoading}),_=d&&!a,u={...n},h=(u==null?void 0:u.headerStatusColor)??c,m=x.useCallback(()=>{_t(t),rt(t,!1)},[t,s]),g=Array.isArray(r)?O(t,e,r):r,b=O(t,e,l),y=O(t,e,i);return o.jsx(w.Modal,{...u,headerStatusColor:h,header:typeof g=="string"?g:o.jsx(o.Fragment,{children:g.map((f,p)=>o.jsx(x.Fragment,{children:f},`modal-header-${p}`))}),children:o.jsx("section",{className:mn.modalContent,children:b.map((f,p)=>o.jsx(x.Fragment,{children:f},`modal-body-${p}`))}),actions:o.jsx(o.Fragment,{children:y.map((f,p)=>o.jsx(x.Fragment,{children:f},`modal-footer-${p}`))}),open:_,onClose:m})},yn=({userFlow:t,pageId:e})=>{var i,c;const s=fe(t);if(!s)return null;const r=[...(s==null?void 0:s.components)||[],...((i=s==null?void 0:s.header)==null?void 0:i.components)||[],...((c=s==null?void 0:s.body)==null?void 0:c.components)||[]],l=O(t,e,r);return o.jsx(o.Fragment,{children:l==null?void 0:l.map((n,d)=>{const a=`overlay-${d}-${s==null?void 0:s.hash}`;return o.jsx(x.Fragment,{children:n},a)})})},xn={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"}},bn=t=>{const{content:e,variant:s="neutral",...r}=t,l=xn[s],i={...r,children:e,color:(r==null?void 0:r.color)??l.color,textColor:(r==null?void 0:r.textColor)??l.textColor,iconColor:(r==null?void 0:r.iconColor)??l.iconColor};return o.jsx(w.Pill,{...i})},pn=t=>{const{content:e}=t;return o.jsx(w.PreviewerMarkdown,{children:e})},Cn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,dataSource:i,dependencies:c,onClick:n,...d}=t,{getNextUI:a,fetchAndGetNextUI:_}=K(),{disabled:u}=B(e,c),h={...d},m=(h==null?void 0:h.disabled)??u,g=x.useCallback(async()=>{var b;try{const y={...(b=E.getState()[e])==null?void 0:b.entries,[r]:{status:200}};switch(A(e,y),l){case"GO_TO_NEXT_UI":{const f=await a(e,s,y,r);f!=null&&f.data&&I(e,f==null?void 0:f.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const f=await _(e,s,y,r,i);f!=null&&f.data&&I(e,f==null?void 0:f.data);break}case"CLOSE_MODAL":rt(e,!1);break;case"CLOSE_DRAWER":W(e,!1);break;case"OPEN_DRAWER":W(e,!0);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(y){alert(JSON.stringify(y))}},[l,i,s,r,e]);return o.jsx(w.RoundButton,{...h,disabled:m,onClick:()=>!m&&(n??g)()})},X={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"},Yt=t=>{const{userFlow:e,pageId:s,columnWidth:r,columns:l,gap:i="md",justifyContent:c="start",alignItems:n="stretch"}=t,d=Array.isArray(l)?l.map((a,_)=>{const u=`col_${_}`,h=`col_${_}`;if(Array.isArray(a))return{gap:"md",justifyContent:"start",alignItems:"start",items:a,hash:u,responseKey:h};const m=a;return{gap:(m==null?void 0:m.gap)??"md",justifyContent:(m==null?void 0:m.justifyContent)??"start",alignItems:(m==null?void 0:m.alignItems)??"start",items:(m==null?void 0:m.items)??[],hash:(m==null?void 0:m.hash)??u,responseKey:(m==null?void 0:m.responseKey)??h}}):[];return d.length===0?null:o.jsx("div",{className:Y(X.row,X[`row__gap-${i}`],X[`row__justify-${c}`],X[`row__align-${n}`]),children:d==null?void 0:d.map((a,_)=>{const u=(r==null?void 0:r[_])||`${100/d.length}%`,h=O(e,s,a.items);return!h||h.length===0?null:o.jsx("div",{className:Y(X.row_column,X[`row_column__gap-${a.gap}`],X[`row_column__justify-${a.justifyContent}`],X[`row_column__align-${a.alignItems}`]),style:{width:u},children:h},a.hash||_)})})};function Zt({userFlow:t,pageId:e,responseKey:s,actionType:r,getNextUI:l,isMulti:i=!1,debounceMs:c}){const n=x.useRef(null);x.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=x.useCallback(async _=>{var m;const u={...(m=E.getState()[t])==null?void 0:m.entries};if(_?(u[s]=_,A(t,u)):(delete u[s],me(t,s)),r&&(r==="GO_TO_NEXT_UI"||r==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const b=await l(t,e,u,s,r==="GO_TO_NEXT_UI");b!=null&&b.data&&I(t,b.data)}catch(g){console.error("[useSelectChange] Failed to fetch next UI",g)}},[t,e,s,r,l]);return x.useCallback(_=>{if(!i){d(_);return}if(c==null){d(_);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{d(_),n.current=null},c)},[i,c,d])}const jn=/\{([^}]+)\}/g,wn=(t,e)=>{var s;return e.includes("{")?e.replace(jn,(r,l)=>{var c;const i=(c=G.query(t,l.trim()))==null?void 0:c[0];return i!=null?String(i):""}):(s=G.query(t,e))==null?void 0:s[0]},Nn=(t,e,s,r)=>{const l=G.query(t,e);return(l==null?void 0:l.map(i=>{var d;const c=wn(i,s),n=r?(d=G.query(i,r))==null?void 0:d[0]:i;return{label:c,value:n}}))??[]},kn=(t,e,s,r=10)=>{var n,d;let l,i;if(s){const a=G.value(t,s.size??"$.meta.size")??r,_=G.value(t,s.total??"$.meta.total")??0;l=a,i=_}else{const a=t==null?void 0:t.meta;l=(a==null?void 0:a.size)??((n=a==null?void 0:a.page)==null?void 0:n.size)??r,i=(a==null?void 0:a.total)??((d=a==null?void 0:a.page)==null?void 0:d.total)??0}const c=i>0?Math.ceil(i/l)>e:!1;return{pageSize:l,total:i,hasMore:c}},Ft={selectNotFront:"_selectNotFront_ch3v5_1"},En=({userFlow:t,pageId:e,responseKey:s,required:r,dataSource:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:_,fetchDataSource:u}=K(),[h,m]=x.useState((a==null?void 0:a.value)??""),{disabled:g}=B(t,c),b=(a==null?void 0:a.disabled)??g,y=x.useMemo(()=>r&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,r]),f=x.useMemo(()=>{const j=a!=null&&a.isMulti?h:[h],k={};return Array.isArray(j)&&j.forEach(T=>{if(!T)return;const R=JSON.stringify(T.value),D=JSON.stringify(T.label);k[R]=T,D in k||(k[D]=T)}),k},[h]),p=Zt({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),C=j=>{m(j),p(j)},N=async(j,k,{page:T})=>{const{jsonPathLabel:R,jsonPathOptions:D,jsonPathValue:M,jsonPathPagination:P}=l,z=mt(l,T,j),v=await u(z,t,!1),H=v==null?void 0:v.data,nt=H?Nn(H,D,R,M):[],{hasMore:wt}=kn(H,T,P);return{options:nt,hasMore:wt,additional:{page:T+1}}};return o.jsx(w.SelectPagination,{...a,className:Ft.selectNotFront,label:y,value:h,disabled:b,noOptionsMessage:()=>o.jsx(o.Fragment,{children:"Sin opciones"}),onChange:j=>!b&&C(j),loadOptions:N,additional:{page:1},isOptionDisabled:j=>{const k=JSON.stringify(j==null?void 0:j.value),T=JSON.stringify(j==null?void 0:j.label);return!!(f!=null&&f[k])||!!(f!=null&&f[T])},debounceTimeout:350})},Tn=({userFlow:t,pageId:e,responseKey:s,dataSource:r,required:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:_}=K(),[u,h]=x.useState(a.value||""),{disabled:m}=B(t,c),g=(a==null?void 0:a.disabled)??m,b=x.useMemo(()=>l&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,l]),y=Zt({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),f=p=>{h(p),y(p)};return o.jsx(w.Select,{...a,className:Ft.selectNotFront,label:b,value:u,disabled:g,onChange:p=>!g&&f(p)})},Sn=t=>{const{dataSource:e}=t;return e?o.jsx(En,{...t}):o.jsx(Tn,{...t})},Pt={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"},On=t=>{const{size:e}=t,s=Y(Pt.spacing,Pt[`spacing__${e}`]);return o.jsx("div",{className:s})},vn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=t,_={...a},{getNextUI:u}=K(),[h,m]=x.useState(c||!1),{disabled:g}=B(e,d),b=(_==null?void 0:_.disabled)??g,y=x.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),f=x.useCallback(async()=>{var p;try{const C=!h;m(C);const N={...(p=E.getState()[e])==null?void 0:p.entries,[r]:C};switch(A(e,N),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,N,r,l==="GO_TO_NEXT_UI");k!=null&&k.data&&I(e,k==null?void 0:k.data);break}default:break}}catch(C){console.error("Error in switch action:",C),alert(JSON.stringify(C))}},[e,s,r,l,h]);return o.jsx(w.Switch,{..._,label:y,checked:h,disabled:b,onChange:()=>!b&&f()})},$t={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},An=({values:t})=>{const s=t==null?void 0:t.slice(0,4),r=(t==null?void 0:t.length)-4;return o.jsxs("div",{className:$t.tableArrayPills,children:[s.map((l,i)=>o.jsx(w.Pill,{children:String(l)},i)),r>0&&o.jsxs(w.Pill,{outlined:!0,children:["+",r]})]})},Rn=({userFlow:t,pageId:e,tableResponseKey:s,component:r,rowData:l})=>{const{getNextUI:i,fetchAndGetNextUI:c,fetchDataSource:n}=K(),d=O(t,e,[{...r}]),a=(d==null?void 0:d[0])||null;if(!a)return null;const{actionType:_,responseKey:u,dataSource:h}=a.props,m=x.useCallback(async()=>{var g,b,y;try{const f={...(g=E.getState()[t])==null?void 0:g.entries,[u]:{status:200},[s]:[{...l}]};switch(A(t,f),_){case"GO_TO_NEXT_UI":{const p=await i(t,e,f,u);p!=null&&p.data&&I(t,p==null?void 0:p.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const p=await c(t,e,f,u,h);p!=null&&p.data&&I(t,p==null?void 0:p.data);break}case"GET_DATA_SOURCE":{const p=await i(t,e,f,u),C=(b=p==null?void 0:p.data)==null?void 0:b.content;if((C==null?void 0:C.type)!=="fetch")break;const N=C==null?void 0:C.dataSource,j=await n(N,t,!1),k={...(y=E.getState()[t])==null?void 0:y.entries,[u]:{status:j==null?void 0:j.status,content:j==null?void 0:j.data}};A(t,k);const T=await i(t,e,k,u);T!=null&&T.data&&I(t,T==null?void 0:T.data);break}default:console.warn(`Unhandled actionType: ${_}`);break}}catch(f){alert(JSON.stringify(f))}},[_,h,e,u,t]);return x.cloneElement(a,{onClick:m})},Dn=()=>o.jsx("div",{className:$t.tableSkeleton,children:[...Array(10)].map((t,e)=>o.jsx(w.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),Ln=(t,e)=>!(e!=null&&e.length)||!t?t:t.map(s=>e.some(l=>Array.isArray(s!=null&&s.accessor?l[s==null?void 0:s.accessor]:void 0))?{...s,renderCell:l=>{const i=s.accessor?l[s.accessor]:void 0;return Array.isArray(i)?o.jsx(An,{values:i}):i??""}}:s),In=({userFlow:t,pageId:e,responseKey:s,component:r,dataSource:l,rightActions:i,data:c,pageSize:n,...d})=>{var M,P,z;const{fetchDataSource:a}=K(),[_,u]=x.useState(!1),[h,m]=x.useState(1),[g,b]=x.useState(null),y=!l&&Array.isArray(c),f=x.useRef(new Map([[1,null]])),p=x.useMemo(()=>{if(i!=null&&i.length)return i.map((v,H)=>({renderContent:nt=>o.jsx(Rn,{userFlow:t,pageId:e,tableResponseKey:s,component:v,rowData:nt},`tableRowAction${H}`)}))},[i,t,e,s]),C=async(v=1)=>{if(!l)return;const{mapperData:H,jsonPathData:nt,jsonPathPagination:wt,jsonPathCursorPagination:st}=l;if(st&&v!==1&&!f.current.has(v)){m(1),C(1);return}st&&v===1&&(f.current=new Map([[1,null]]));try{u(!0);const Nt=st?f.current.get(v)??null:null,qn=mt(l,v,void 0,Nt),$=await a(qn,t,!1);if(b(zt($==null?void 0:$.data,nt,H,wt)),st){const oe=qe($==null?void 0:$.data,st);oe&&f.current.set(v+1,oe)}u(!1)}catch(Nt){console.error("[TableNotFront] fetchData:",Nt),u(!1)}},N=v=>{m(v),C(v)};x.useEffect(()=>{y||C()},[]);const j=y?c:g==null?void 0:g.items,k=y&&!!n&&((c==null?void 0:c.length)??0)>n,T=x.useMemo(()=>{if(!k||!c||!n)return j??[];const v=(h-1)*n;return c.slice(v,v+n)},[k,c,n,h,j]),R=x.useMemo(()=>Ln(d.columns,j),[j,d.columns]),D={...d,data:T,columns:R??[],rightActions:p};return y?!j||j.length===0?o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):o.jsxs(o.Fragment,{children:[o.jsx(w.Table,{...D}),k&&n&&c&&o.jsx(w.Pager,{classname:{global:"row__end"},page:h,size:n,total:c.length,onChange:m})]}):o.jsx(o.Fragment,{children:_?o.jsx(Dn,{}):g&&((M=g==null?void 0:g.items)==null?void 0:M.length)>0?o.jsxs(o.Fragment,{children:[o.jsx(w.Table,{...D}),(g==null?void 0:g.pagination)&&((P=g==null?void 0:g.pagination)==null?void 0:P.totalPages)>1&&o.jsx(w.Pager,{classname:{global:"row__end"},page:h,size:g==null?void 0:g.pagination.size,total:(z=g==null?void 0:g.pagination)==null?void 0:z.total,onChange:N})]}):o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},Mn={tabsPanel:"_tabsPanel_kvslb_1"},Bn=({userFlow:t,pageId:e,components:s})=>{const r=O(t,e,s);return r!=null&&r.length?o.jsx("section",{className:Mn.tabsPanel,children:r.map((l,i)=>o.jsx(x.Fragment,{children:l},`tabs-panel-${i}`))}):null},Gn=({userFlow:t,pageId:e,hash:s,items:r,activeIndex:l,className:i,responseKey:c})=>{const n=r.map((a,_)=>({label:a.label,disabled:a.disabled,children:o.jsx(Bn,{userFlow:t,pageId:e,components:a.components},`${s}-tab-${_}`)})),d=a=>{var u;const _={...(u=E.getState()[t])==null?void 0:u.entries,[c]:a};A(t,_)};return o.jsx(w.Tabs,{className:i,activeIndex:l,items:n,onClick:d})},Kn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,required:c,dependencies:n,...d}=t,a={...d},[_,u]=x.useState((a==null?void 0:a.value)??""),{disabled:h}=B(e,n),m=(a==null?void 0:a.disabled)??h,g=x.useMemo(()=>c&&(a!=null&&a.label)?`${a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),b=y=>{var p;const f=(p=y==null?void 0:y.target)==null?void 0:p.value;u(f),A(e,{[i]:f})};return x.useEffect(()=>{u((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),o.jsx(w.Textarea,{...a,label:g,value:_,disabled:m,onChange:y=>!m&&b(y)})},Hn={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},Un=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,required:c,dependencies:n,...d}=t,a={...d},[_,u]=x.useState((a==null?void 0:a.value)??""),{disabled:h}=B(e,n),m=(a==null?void 0:a.disabled)??h,g=x.useMemo(()=>c&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),b=y=>{var C;const f=(C=y==null?void 0:y.target)==null?void 0:C.value;u(f);const p={[i]:f};A(e,p)};return x.useEffect(()=>{u((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),o.jsx(w.TextField,{...a,className:Hn.textFieldNotFront,allowClear:!1,label:g,value:_,disabled:m,onChange:y=>!m&&b(y)})},Vn=({userFlow:t,pageId:e,responseKey:s,variant:r,content:l,actionType:i,redirectUrl:c})=>{const n=x.useCallback(async()=>{_t(t);try{switch(i){case"AUTOCLOSE_AND_REDIRECT":window.location.href=c;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,c]);return x.useEffect(()=>{({info:w.toast.info,error:w.toast.error,success:w.toast.success,warning:w.toast.warning}[r]||w.toast.info)(l,{autoClose:i?!1:4e3,containerId:t,onClose:n})},[n,t]),null},te={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},zn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,label:n,placement:d,notShowArrow:a,visible:_}=t,u=O(e,s,c!=null&&c.length?c:null),h=u&&u.length>0?o.jsx("div",{className:te.tooltipNotFront_content,children:u.map((m,g)=>o.jsx(x.Fragment,{children:m},`tooltip-${l}-${g}`))}):null;return o.jsx(w.Tooltip,{className:te.tooltipNotFront,label:n,placement:d,notShowArrow:a,visible:_,children:h})};function Jn({sessionName:t,apiConfig:e,onResolveComponentProps:s,children:r}){const l=re(t,e,null,s);return o.jsxs(o.Fragment,{children:[l,r]})}const Xn={api:"",headers:{}},ee=({userFlow:t,components:e,hash:s,apiConfig:r})=>{const l=s??`${t}-page`;x.useState(()=>{var d,a;return(a=(d=E.getState()[t])==null?void 0:d.pages)!=null&&a[l]||at(t,r??Xn,{type:"page",hash:l,body:{components:e}}),null});const i=O(t,l,e);return o.jsx(o.Fragment,{children:i})};function ne(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 se=({payload:t,userFlow:e})=>{const s=ne(t.display),r=ee({userFlow:e,hash:t.id,components:s});return o.jsx(o.Fragment,{children:r})},Wn=se,ae=(t,e,s,r,l)=>{const i=O(t,e,(r==null?void 0:r.components)||null,l);switch(s){case"body":return o.jsx(De,{...r,inputs:i||[]},JSON.stringify(r==null?void 0:r.components));case"header":return o.jsx(un,{...r,components:i||[]},JSON.stringify(r==null?void 0:r.components));default:return null}},re=(t,e,s,r)=>{var h,m,g;const[l,i]=x.useState(!1),c=E(b=>b),n=(h=c[t])==null?void 0:h.currentPageId;x.useEffect(()=>{if(typeof window>"u")return;const b=new URL(window.location.href),y=b.searchParams.get("sessionId");y&&(sessionStorage.setItem("sessionId",y),b.searchParams.delete("sessionId"),window.history.replaceState({},"",b.toString()))},[]);const d=n?ae(t,n,"header",((m=c[t].pages[n].page)==null?void 0:m.header)||null,r):null,a=n?ae(t,n,"body",((g=c[t].pages[n].page)==null?void 0:g.body)||null,r):null,_=x.useMemo(()=>{var b;return o.jsxs(o.Fragment,{children:[((b=c[t])==null?void 0:b.isLoading)&&o.jsx(w.Loading,{}),d,a,n&&o.jsx(yn,{userFlow:t,pageId:n}),c[t]&&o.jsx(w.Toaster,{})]})},[d,a,n,t]),u=async()=>{try{const b=await Bt(e,t),y=b==null?void 0:b.data,f=y==null?void 0:y.content;(b==null?void 0:b.status)===200?at(t,e,f,y==null?void 0:y.sessionState):i(!0)}catch(b){console.error("[not-page]: API call failed",b),i(!0)}};return x.useEffect(()=>{e!=null&&e.api&&!s&&t?u():!(e!=null&&e.api)&&s&&t||e!=null&&e.api&&s&&t?at(t,e,s):(!(e!=null&&e.api)&&!s||!t)&&(i(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const b="avocado-theme-mode-changed",y=f=>{const p=f.detail;w.ThemeStore.setThemeMode(p)};return window.addEventListener(b,y),()=>{window.removeEventListener(b,y)}},[]),l&&console.error("[not-page]: No render page"),_};S.Chart=Wt,S.NotFrontPage=Jn,S.RenderNotFront=se,S.Row=Yt,S.extractNotFrontComponents=ne,S.heading=Dt,S.renderNotFront=Wn,S.text=Lt,S.useNotFrontFragment=ee,S.usePage=re,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foris/avocado-not-front",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"recharts": "3.1.0",
|
|
57
57
|
"zustand": "4.5.4",
|
|
58
58
|
"@uiw/react-codemirror": "4.23.12",
|
|
59
|
-
"@foris/ai-agent": "1.1.1",
|
|
60
59
|
"@foris/avocado-core": "1.3.1",
|
|
60
|
+
"@foris/ai-agent": "1.1.1",
|
|
61
61
|
"@foris/avocado-icons": "1.16.7",
|
|
62
62
|
"@foris/avocado-suite": "1.8.14",
|
|
63
63
|
"@foris/tsconfig": "0.0.2"
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"streamdown": ">=1.6.0",
|
|
80
80
|
"zustand": ">=4.0.0",
|
|
81
81
|
"@foris/ai-agent": "1.1.1",
|
|
82
|
-
"@foris/avocado-core": "1.3.1",
|
|
83
82
|
"@foris/avocado-icons": "1.16.7",
|
|
84
|
-
"@foris/avocado-suite": "1.8.14"
|
|
83
|
+
"@foris/avocado-suite": "1.8.14",
|
|
84
|
+
"@foris/avocado-core": "1.3.1"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build": "tsc && vite build",
|