@foris/avocado-not-front 6.0.0 → 8.0.0
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/src/components/breadcrumbs/Breadcrumbs.d.ts +2 -5
- package/dist/avocado-not-front/src/components/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/dist/avocado-not-front/src/components/header-navigation/HeaderNavigation.d.ts +10 -0
- package/dist/avocado-not-front/src/components/header-navigation/HeaderNavigation.test.d.ts +1 -0
- package/dist/avocado-not-front/src/components/header-navigation/useHeaderNavigationActions.d.ts +6 -0
- package/dist/avocado-not-front/src/components/header-navigation/useHeaderNavigationActions.test.d.ts +1 -0
- package/dist/avocado-not-front/src/components/index.d.ts +2 -1
- package/dist/avocado-not-front/src/components/pill/Pill.test.d.ts +1 -0
- package/dist/avocado-not-front/src/components/table/Table.d.ts +1 -1
- package/dist/avocado-not-front/src/components/table/Table.viewport.test.d.ts +1 -0
- package/dist/avocado-not-front/src/components/table/table.constants.d.ts +17 -0
- package/dist/avocado-not-front/src/components/table/table.constants.test.d.ts +1 -0
- package/dist/avocado-not-front/src/components/table/tableAvailableHeight.util.d.ts +12 -0
- package/dist/avocado-not-front/src/components/table/tableScroll.util.d.ts +20 -0
- package/dist/avocado-not-front/src/components/table/tableScroll.util.test.d.ts +1 -0
- package/dist/avocado-not-front/src/components/table/useAvailableHeight.d.ts +17 -0
- package/dist/avocado-not-front/src/components/table/useAvailableHeight.test.d.ts +1 -0
- package/dist/avocado-not-front/src/hooks/builder/useBuildComponentsList.test.d.ts +1 -0
- package/dist/avocado-not-front/src/hooks/useAction.d.ts +15 -0
- package/dist/avocado-not-front/src/hooks/useNotFrontBreadcrumbActionRunner.d.ts +6 -0
- package/dist/avocado-not-front/src/hooks/useNotFrontBreadcrumbActionRunner.test.d.ts +1 -0
- package/dist/avocado-not-front/src/hooks/useNotFrontButtonActionRunner.d.ts +2 -5
- package/dist/avocado-not-front/src/types/builder.type.d.ts +4 -2
- package/dist/avocado-not-front/src/types/components.type.d.ts +65 -10
- package/dist/avocado-not-front/src/types/componentsCore.type.d.ts +9 -2
- package/dist/avocado-not-front/src/utils/dataSource.util.d.ts +4 -2
- package/dist/avocado-not-front/src/utils/pillVariant.util.d.ts +9 -0
- package/dist/avocado-not-front.es.js +2321 -2155
- package/dist/avocado-not-front.umd.js +3 -3
- package/dist/style.css +1 -1
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(A,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):(A=typeof globalThis<"u"?globalThis:A||self,U(A["avocado-not-front"]={},A.axios,A.zustand,A.React,A.AvocadoSuite,A.AiAgent,A.jsonpath,A.Recharts,A.ReactCodeMirror,A.CodeMirrorLangJson,A.CodeMirrorLangMarkdown,A.CodeMirrorLangSql,A.CodeMirrorLangYaml,A.AvocadoIcons))})(this,(function(A,U,Ie,y,w,xt,B,T,Le,Ht,Be,Me,He,Kt){"use strict";const pt="sessionId",Ke=()=>sessionStorage.getItem(pt),bt=t=>{t&&sessionStorage.setItem(pt,t)},Ge=()=>{sessionStorage.removeItem(pt)},v=Ie.create(()=>({})),_t=(t,e,n,o,a)=>{bt(a);const c=n==null?void 0:n.hash,l=o&&Object.keys(o).length>0?{...o}:{};v.setState(s=>{var _;return{...s,[t]:{...s[t],apiConfig:e,currentPageId:c,isLoading:!1,isModalOpen:!0,isDrawerOpen:!1,entries:l,overlay:null,pages:{...(_=s[t])==null?void 0:_.pages,[c]:{page:n}}}}})},Gt=(t,e,n)=>{const o=n&&Object.keys(n).length>0?{...t,...n}:t;return e.length===0?o:Object.fromEntries(Object.entries(o).filter(([a])=>!e.includes(a)))},Ue=(t,e,n,o,a)=>{bt(n),v.setState(c=>{const l=c[t]??{},s=l.entries??{},_=Gt(s,o,a);return{...c,[t]:{...l,currentPageId:e.hash,entries:_,isLoading:!1,overlay:null,pages:{...l.pages,[e.hash]:{page:{...e}}}}}})},ze=(t,e,n,o)=>{v.setState(a=>{var i;const c=a[t]??{},l=c.entries??{},s=Gt(l,n,o),_=(i=e.components)==null?void 0:i.some(d=>d.component==="drawer");return{...a,[t]:{...c,entries:s,overlay:e,isLoading:!1,isModalOpen:!_,isDrawerOpen:!!_}}})},Ct=t=>{v.setState(e=>({...e,[t]:{...e[t],overlay:null}}))},Ve=t=>{var n;return((n=v.getState()[t])==null?void 0:n.overlay)??null},K=(t,e)=>{const{content:n,sessionId:o,deprecatedStateKeys:a=[],sessionState:c}=e;n.type!=="page"&&n.type!=="overlay"||(n.type==="page"?Ue(t,n,o,a,c):ze(t,n,a,c))},M=(t,e)=>{v.setState(n=>{var o;return{...n,[t]:{...n[t],entries:{...(o=n[t])==null?void 0:o.entries,...e}}}})},Xe=(t,e)=>{v.setState(n=>{const o=n[t];if(!o)return n;const a=o.entries??{};if(!(e in a))return n;const{[e]:c,...l}=a;return{...n,[t]:{...o,entries:l}}})},Y=(t,e)=>{v.setState(n=>({...n,[t]:{...n[t],isLoading:e}}))},jt=(t,e)=>{v.setState(n=>({...n,[t]:{...n[t],isModalOpen:e}}))},rt=(t,e)=>{v.setState(n=>({...n,[t]:{...n[t],isDrawerOpen:e}}))},Ut=(t,e)=>{v.setState(n=>{const o=n[t];return o?{...n,[t]:{...o,apiConfig:{...o.apiConfig,headers:e}}}:n})};let wt=!1,ut=[],zt=!1;const We=t=>t._userFlow||null,Vt=t=>{ut.forEach(({resolve:e,reject:n})=>{t?n(t):e(void 0)}),ut=[]},Je=async t=>{var o,a;const e=t==null?void 0:t.config;if(((o=t==null?void 0:t.response)==null?void 0:o.status)===401&&!e._retry){const c=We(e);if(c){const s=(a=v.getState()[c])==null?void 0:a.apiConfig;if(!s)return Promise.reject(t);if(s.onAuthenticationError||typeof s.headers=="function"){if(wt)return new Promise((i,d)=>{ut.push({resolve:i,reject:d})}).then(()=>U(e)).catch(i=>(console.error("[axiosInterceptors] Queued request failed:",i),Promise.reject(i)));e._retry=!0,wt=!0;try{let i;if(s.onAuthenticationError)i=await s.onAuthenticationError();else if(typeof s.headers=="function")i=s.headers();else throw new Error("No refresh handler available");return s.onAuthenticationError&&(typeof s.headers=="string"?Ut(c,JSON.stringify(i)):Ut(c,i)),e.headers||(e.headers={}),Object.assign(e.headers,i),Vt(null),U(e)}catch(i){return console.error("[axiosInterceptors] Token refresh failed:",i),console.error("[axiosInterceptors] Rejecting queued requests:",ut.length),Vt(i),Promise.reject(i)}finally{wt=!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(zt){console.debug("[axiosInterceptors] Interceptors already initialized, skipping");return}console.debug("[axiosInterceptors] Initializing interceptors..."),U.interceptors.response.use(void 0,Je),console.debug("[axiosInterceptors] Response error interceptor registered"),zt=!0,console.debug("[axiosInterceptors] Interceptors initialized successfully")})();function qe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nt={exports:{}},ct={};/**
|
|
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 Mt;function Se(){if(Mt)return rt;Mt=1;var t=g,e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(n,_,i){var d,u={},h=null,f=null;i!==void 0&&(h=""+i),_.key!==void 0&&(h=""+_.key),_.ref!==void 0&&(f=_.ref);for(d in _)a.call(_,d)&&!l.hasOwnProperty(d)&&(u[d]=_[d]);if(n&&n.defaultProps)for(d in _=n.defaultProps,_)u[d]===void 0&&(u[d]=_[d]);return{$$typeof:e,type:n,key:h,ref:f,props:u,_owner:r.current}}return rt.Fragment=s,rt.jsx=c,rt.jsxs=c,rt}var Bt;function Oe(){return Bt||(Bt=1,pt.exports=Se()),pt.exports}var o=Oe();const Kt=t=>{if(!(t!=null&&t.content))return null;const e={...t,children:t.content,type:t.variant};return o.jsx(N.Heading,{...e})},Gt=t=>{if(!t)return null;const e={...t,children:t.content};return o.jsx(N.Text,{...e})},S=(t,e,s,a)=>{var c;const r={accordion:n=>o.jsx(Ke,{...n,userFlow:t,pageId:e}),aiChatPanel:n=>o.jsx(Ge,{...n,userFlow:t,pageId:e,onResolveProps:a==null?void 0:a.aiChatPanel}),aiSummaryCard:n=>o.jsx(ze,{...n,userFlow:t,pageId:e,onResolveProps:a==null?void 0:a.aiSummaryCard}),aiPromptCodeEditor:n=>o.jsx(Ve,{...n,userFlow:t,pageId:e}),box:n=>o.jsx(Je,{...n,userFlow:t,pageId:e}),breadcrumbs:n=>o.jsx(Fe,{...n,userFlow:t,pageId:e}),tooltip:n=>o.jsx(js,{...n,userFlow:t,pageId:e}),textarea:n=>o.jsx(gs,{...n,userFlow:t,pageId:e}),card:n=>o.jsx(tn,{...n,userFlow:t,pageId:e}),dropdownButton:n=>o.jsx(Hn,{...n,userFlow:t,pageId:e}),menu:n=>o.jsx(zn,{...n,userFlow:t,pageId:e}),radioGroup:n=>o.jsx(Ye,{...n,userFlow:t,pageId:e}),stepper:n=>o.jsx(Qe,{...n,userFlow:t,pageId:e}),progressBar:n=>o.jsx(Ze,{...n,userFlow:t,pageId:e}),button:n=>o.jsx(Pe,{...n,userFlow:t,pageId:e}),cardAccordion:n=>o.jsx($e,{...n,userFlow:t,pageId:e}),cardNotification:n=>o.jsx(en,{...n,userFlow:t,pageId:e}),chart:n=>o.jsx($t,{...n,userFlow:t}),dataCard:n=>o.jsx(Mn,{...n,userFlow:t,pageId:e}),checkbox:n=>o.jsx(vn,{...n,userFlow:t,pageId:e}),code:n=>o.jsx(Sn,{...n,userFlow:t,pageId:e}),divider:n=>o.jsx(Kn,{...n}),drawer:n=>o.jsx(Gn,{...n,userFlow:t,pageId:e}),heading:n=>Kt(n),link:n=>o.jsx(Un,{...n,userFlow:t,pageId:e}),pill:n=>o.jsx(Zn,{...n}),previewerMarkdown:n=>o.jsx(Fn,{...n}),modal:n=>o.jsx(Jn,{...n,userFlow:t,pageId:e}),roundButton:n=>o.jsx(Pn,{...n,userFlow:t,pageId:e}),row:n=>o.jsx(se,{...n,userFlow:t,pageId:e}),select:n=>o.jsx(os,{...n,userFlow:t,pageId:e}),switch:n=>o.jsx(cs,{...n,userFlow:t,pageId:e}),spacing:n=>o.jsx(rs,{...n,userFlow:t,pageId:e}),table:n=>o.jsx(hs,{...n,userFlow:t,pageId:e}),tabs:n=>o.jsx(ys,{...n,userFlow:t,pageId:e}),text:n=>Gt(n),textField:n=>o.jsx(bs,{...n,userFlow:t,pageId:e}),toast:n=>o.jsx(Cs,{...n,userFlow:t,pageId:e})};return(c=s==null?void 0:s.filter(Boolean))==null?void 0:c.map(n=>{const _=r[n.component];return _?_({...n,userFlow:t,pageId:e}):null})};function Re(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)}function Ht(t,e){if(!(e!=null&&e.length))return!1;for(const s of e)if(s.when==="empty"){const a=t==null?void 0:t[s.key];if(Re(a))return!0}return!1}function G(t,e){const s=T(a=>{var r;return(r=a[t])==null?void 0:r.entries});return g.useMemo(()=>({disabled:Ht(s,e)}),[e,s])}const Z=t=>{if(!t)return{"content-type":"application/json"};if(typeof t=="function")return t();if(typeof t=="string")try{return JSON.parse(t)}catch{return{"content-type":"application/json",Authorization:t}}return t},ct=()=>new AbortController,De=(t,e={},s={},a=!1,r)=>{const l=ct();a&&l.abort();const c=Z(e);return{call:z.get(t,{headers:{...c},params:s,signal:l.signal,_userFlow:r}),controller:l}},bt=(t,e={},s={},a={},r=!1,l)=>{const c=ct();r&&c.abort();const n=Z(e);return{call:z.post(t,s,{headers:{...n},params:a,signal:c.signal,_userFlow:l}),controller:c}},Le=(t,e={},s={},a={},r=!1,l)=>{const c=ct();r&&c.abort();const n=Z(e);return{call:z.put(t,s,{headers:{...n},params:a,signal:c.signal,_userFlow:l}),controller:c}},Ie=(t,e={},s={},a={},r=!1,l)=>{const c=ct();r&&c.abort();const n=Z(e);return{call:z.patch(t,s,{headers:{...n},params:a,signal:c.signal,_userFlow:l}),controller:c}},Me=(t,e={},s={},a={},r=!1,l)=>{const c=ct();r&&c.abort();const n=Z(e);return{call:z.delete(t,{headers:{...n},data:s,params:a,signal:c.signal,_userFlow:l}),controller:c}},Vt=()=>{let t;return{callEndpoint:async a=>{a.controller&&(t=a.controller);let r={};try{r=await a.call}catch(l){throw l}return r},cancelEndpoint:()=>{t&&t.abort()}}},Ut=async(t,e,s="",a={},r={})=>{try{const{callEndpoint:l}=Vt(),{api:c,headers:n}=t,_=Ce(),i=new URLSearchParams({session_name:e});s&&i.append("hash_code",s),_&&i.append("sessionId",_);const d=`${c}/not-front/next-ui/?${i.toString()}`,u=Z(n),h=bt(d,u,a,r,!1,e);return await l(h)}catch(l){return console.error(l),Promise.reject(l)}},zt=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"}},Be=(t,e,s)=>{const{url:a,paginationKeys:r,params:l}=t,c=[],n=(r==null?void 0:r.page)??"page";if(c.push(`${n}=${e}`),typeof s=="string"){const d=(r==null?void 0:r.text)??"text";c.push(`${d}=${encodeURIComponent(s||"")}`)}if(l&&typeof l=="object"){const d=Object.entries(l).map(([u,h])=>`${encodeURIComponent(u)}=${encodeURIComponent(h)}`);c.push(...d)}const _=c.join("&");return _?`${a}?${_}`:a},Ct=(t,e,s,a)=>{const{type:r,url:l,method:c,headers:n}=t;if(r==="rest"){const _=Be(t,e,s),d={...(t==null?void 0:t.data)??{},...a??{}};return{type:"rest",url:_,method:zt(c),headers:n,data:d}}else return{type:"graphql",url:l,method:"post",headers:n,query:t==null?void 0:t.query,variables:{...(t==null?void 0:t.variables)||{},...typeof s=="string"?{text:s}:{},page:e}}},U=()=>{const t=T(n=>n),{callEndpoint:e}=Vt(),s=async(n,_,i,d,u=!0)=>{var h;try{const f=(h=t[n])==null?void 0:h.apiConfig,y={state:{...i},triggerKey:d};return u&&Q(n,!0),await Ut(f,n,_,y)}catch(f){throw u&&Q(n,!1),console.error("[getNextUI] Error fetching next UI:",f),f}},a=(n,_)=>{const{url:i,headers:d,data:u,params:h}=n;switch(zt(n.method)){case"post":return bt(i,d,u,{},!1,_);case"put":return Le(i,d,u,{},!1,_);case"patch":return Ie(i,d,u,{},!1,_);case"delete":return Me(i,d,u,h,!1,_);case"get":default:return De(i,d,h,!1,_)}},r=(n,_)=>{const{url:i,headers:d}=n,u={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return bt(i,{...d,"Content-Type":"application/json"},u,{},!1,_)},l=async(n,_,i=!0)=>{var d,u;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}i&&Q(_,!0);try{let h;switch(n==null?void 0:n.type){case"rest":h=a(n,_);break;case"graphql":h=r(n,_);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await e(h)}catch(h){const f=h;return console.error("[fetchDataSource] Error:",f),{status:((d=f==null?void 0:f.response)==null?void 0:d.status)??0,data:((u=f==null?void 0:f.response)==null?void 0:u.data)??{message:f==null?void 0:f.message,code:f==null?void 0:f.code,config:f==null?void 0:f.config}}}finally{i&&Q(_,!1)}};return{getNextUI:s,fetchDataSource:l,fetchAndGetNextUI:async(n,_,i,d,u)=>{try{Q(n,!0);const h=await l(u,n,!1);return h&&await s(n,_,i,d)}catch(h){throw Q(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",h),h}}}},Xt={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},Ke=t=>{const{userFlow:e,pageId:s,responseKey:a,dependencies:r,customContent:l,actionContent:c,components:n,..._}=t,{getNextUI:i}=U(),[d,u]=g.useState(_.checkboxChecked||!1),{disabled:h}=G(e,r),f=S(e,s,n),y=c?S(e,s,c):void 0,C=l?S(e,s,l):void 0,b=g.useCallback(async p=>{var w;try{const j=p.target.checked;u(j);const k={...(w=T.getState()[e])==null?void 0:w.entries,[a]:j};if(B(e,k),_.actionType==="GO_TO_NEXT_UI"){const E=await i(e,s,k,a);E!=null&&E.data&&K(e,E==null?void 0:E.data)}}catch(j){console.error("Error in accordion checkbox action:",j),alert(JSON.stringify(j))}},[e,s,a,_.actionType,i]),m=_.disabled||h,x={..._,className:Xt.accordion,disabled:m,checkboxChecked:d,onChanceCheckbox:_.hasCheckbox?b:void 0,actionContent:y?o.jsx(o.Fragment,{children:y.map((p,w)=>o.jsx(g.Fragment,{children:p},`accordion-action-${w}`))}):void 0,customContent:C?o.jsx(o.Fragment,{children:C.map((p,w)=>o.jsx(g.Fragment,{children:p},`accordion-custom-${w}`))}):void 0,children:f?o.jsx("section",{className:Xt.accordionBody,children:f.map((p,w)=>o.jsx(g.Fragment,{children:p},`accordion-child-${w}`))}):void 0};return o.jsx(N.Accordion,{...x})},Ge=t=>{const e=N.ThemeStore.useThemeStore(c=>c.theme.mode),s=t.dataSource,a=g.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,params:s==null?void 0:s.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,s==null?void 0:s.data]),r=t.locale??"en",l=g.useMemo(()=>{var n,_,i,d,u;const c={title:(n=t==null?void 0:t.translations)==null?void 0:n.title,welcomeTitle:(_=t==null?void 0:t.translations)==null?void 0:_.welcomeTitle,welcomeDescription:(i=t==null?void 0:t.translations)==null?void 0:i.welcomeDescription,placeholder:(d=t==null?void 0:t.translations)==null?void 0:d.placeholder,disclaimer:(u=t==null?void 0:t.translations)==null?void 0:u.disclaimer};return Object.fromEntries(Object.entries(c).filter(([,h])=>!!h))},[t==null?void 0:t.translations]);return g.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:a,locale:r,translations:l,initialSuggestions:t.initialSuggestions,theme:e})},[t.onResolveProps,a,r,l,t.initialSuggestions,e]),t.onResolveProps?null:o.jsx(ht.ChatPanel,{dataSource:a,locale:r,translations:l,initialSuggestions:t.initialSuggestions,theme:e})},He={promptCodeEditor:"_promptCodeEditor_1d57s_1"},Ve=t=>{const{userFlow:e,responseKey:s,codeBlockValue:a,language:r,disabled:l,dependencies:c,dataSource:n,inputLabel:_,inputPlaceholder:i,codeBlockLabel:d}=t,u=N.ThemeStore.useThemeStore(p=>p.theme.mode),[h,f]=g.useState(a||""),{disabled:y}=G(e,c),C=l??y,b=r??"json",m={url:(n==null?void 0:n.url)||"",method:(n==null?void 0:n.method)||"post",headers:n==null?void 0:n.headers,body:n==null?void 0:n.data},x=p=>{f(p);const w={[s]:p};B(e,w)};return g.useEffect(()=>{a!==void 0&&a!==h&&f(a)},[a]),o.jsx("section",{className:He.promptCodeEditor,children:o.jsx(ht.PromptCodeEditor,{themeMode:u,requestConfig:m,language:b,disabled:C,inputLabel:_,inputPlaceholder:i,codeBlockLabel:d,codeBlockValue:h,onCodeChange:x})})},Ue={summaryCard:"_summaryCard_jva4h_1"},ze=t=>{const e=t.dataSource,s=g.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,body:e==null?void 0:e.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,e==null?void 0:e.data]),a=t.locale??"en",r=g.useMemo(()=>{var c,n,_;const l={title:(c=t==null?void 0:t.translations)==null?void 0:c.title,loading:(n=t==null?void 0:t.translations)==null?void 0:n.loading,noData:(_=t==null?void 0:t.translations)==null?void 0:_.noData};return Object.fromEntries(Object.entries(l).filter(([,i])=>!!i))},[t==null?void 0:t.translations]);return g.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:s,locale:a,translations:r})},[t.onResolveProps,s,a,r]),t.onResolveProps?null:o.jsx("section",{className:Ue.summaryCard,children:o.jsx(ht.SummaryCard,{dataSource:s,locale:a,translations:r})})},Jt={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},Xe=({inputs:t})=>o.jsx("section",{className:Jt.body,children:o.jsx("div",{className:Jt.body_content,children:t.map((e,s)=>o.jsx(g.Fragment,{children:e},s))})}),Wt={boxNotFront:"_boxNotFront_67q2e_1",slotStack:"_slotStack_67q2e_5"},Je=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,content:c}=t,n=N.ThemeStore.useThemeStore(d=>d.theme.mode)==="dark",_=S(e,s,c!=null&&c.length?c:null),i=_&&_.length>0?o.jsx("div",{className:Wt.slotStack,children:_.map((d,u)=>o.jsx(g.Fragment,{children:d},`box-${r}-${u}`))}):null;return o.jsx(N.Box,{className:Wt.boxNotFront,darkMode:n,children:i})};var jt={exports:{}};/*!
|
|
9
|
+
*/var Xt;function Ye(){if(Xt)return ct;Xt=1;var t=y,e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(s,_,i){var d,u={},h=null,f=null;i!==void 0&&(h=""+i),_.key!==void 0&&(h=""+_.key),_.ref!==void 0&&(f=_.ref);for(d in _)o.call(_,d)&&!c.hasOwnProperty(d)&&(u[d]=_[d]);if(s&&s.defaultProps)for(d in _=s.defaultProps,_)u[d]===void 0&&(u[d]=_[d]);return{$$typeof:e,type:s,key:h,ref:f,props:u,_owner:a.current}}return ct.Fragment=n,ct.jsx=l,ct.jsxs=l,ct}var Wt;function Qe(){return Wt||(Wt=1,Nt.exports=Ye()),Nt.exports}var r=Qe();const Jt=t=>{if(!(t!=null&&t.content))return null;const e={...t,children:t.content,type:t.variant};return r.jsx(w.Heading,{...e})},qt=t=>{if(!t)return null;const e={...t,children:t.content};return r.jsx(w.Text,{...e})},O=(t,e,n,o)=>{var l;const a={accordion:s=>r.jsx(on,{...s,userFlow:t,pageId:e}),aiChatPanel:s=>r.jsx(an,{...s,userFlow:t,pageId:e,onResolveProps:o==null?void 0:o.aiChatPanel}),aiSummaryCard:s=>r.jsx(dn,{...s,userFlow:t,pageId:e,onResolveProps:o==null?void 0:o.aiSummaryCard}),aiPromptCodeEditor:s=>r.jsx(cn,{...s,userFlow:t,pageId:e}),box:s=>r.jsx(un,{...s,userFlow:t,pageId:e}),breadcrumbs:s=>r.jsx(xn,{...s,userFlow:t,pageId:e}),tooltip:s=>r.jsx($s,{...s,userFlow:t,pageId:e}),textarea:s=>r.jsx(Qs,{...s,userFlow:t,pageId:e}),card:s=>r.jsx(Cn,{...s,userFlow:t,pageId:e}),dropdownButton:s=>r.jsx(rs,{...s,userFlow:t,pageId:e}),menu:s=>r.jsx(ds,{...s,userFlow:t,pageId:e}),radioGroup:s=>r.jsx(mn,{...s,userFlow:t,pageId:e}),stepper:s=>r.jsx(gn,{...s,userFlow:t,pageId:e}),progressBar:s=>r.jsx(yn,{...s,userFlow:t,pageId:e}),button:s=>r.jsx(pn,{...s,userFlow:t,pageId:e}),cardAccordion:s=>r.jsx(bn,{...s,userFlow:t,pageId:e}),cardNotification:s=>r.jsx(jn,{...s,userFlow:t,pageId:e}),chart:s=>r.jsx(le,{...s,userFlow:t}),dataCard:s=>r.jsx(ns,{...s,userFlow:t,pageId:e}),checkbox:s=>r.jsx(Qn,{...s,userFlow:t,pageId:e}),code:s=>r.jsx(Zn,{...s,userFlow:t,pageId:e}),divider:s=>r.jsx(os,{...s}),drawer:s=>r.jsx(as,{...s,userFlow:t,pageId:e}),heading:s=>Jt(s),headerNavigation:s=>r.jsx(de,{...s,userFlow:t,pageId:e,onResolveComponentProps:o}),link:s=>r.jsx(is,{...s,userFlow:t,pageId:e}),pill:s=>r.jsx(ps,{...s}),previewerMarkdown:s=>r.jsx(bs,{...s}),modal:s=>r.jsx(us,{...s,userFlow:t,pageId:e}),roundButton:s=>r.jsx(Cs,{...s,userFlow:t,pageId:e}),row:s=>r.jsx(ue,{...s,userFlow:t,pageId:e}),select:s=>r.jsx(vs,{...s,userFlow:t,pageId:e}),switch:s=>r.jsx(Ss,{...s,userFlow:t,pageId:e}),spacing:s=>r.jsx(As,{...s,userFlow:t,pageId:e}),table:s=>r.jsx(Xs,{...s,userFlow:t,pageId:e}),tabs:s=>r.jsx(qs,{...s,userFlow:t,pageId:e}),text:s=>qt(s),textField:s=>r.jsx(Fs,{...s,userFlow:t,pageId:e}),toast:s=>r.jsx(Ps,{...s,userFlow:t,pageId:e})};return(l=n==null?void 0:n.filter(Boolean))==null?void 0:l.map(s=>{const _=a[s.component];return _?_({...s,userFlow:t,pageId:e}):null})};function Ze(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)}function Yt(t,e){if(!(e!=null&&e.length))return!1;for(const n of e)if(n.when==="empty"){const o=t==null?void 0:t[n.key];if(Ze(o))return!0}return!1}function L(t,e){const n=v(o=>{var a;return(a=o[t])==null?void 0:a.entries});return y.useMemo(()=>({disabled:Yt(n,e)}),[e,n])}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},lt=()=>new AbortController,Fe=(t,e={},n={},o=!1,a)=>{const c=lt();o&&c.abort();const l=Q(e);return{call:U.get(t,{headers:{...l},params:n,signal:c.signal,_userFlow:a}),controller:c}},Et=(t,e={},n={},o={},a=!1,c)=>{const l=lt();a&&l.abort();const s=Q(e);return{call:U.post(t,n,{headers:{...s},params:o,signal:l.signal,_userFlow:c}),controller:l}},Pe=(t,e={},n={},o={},a=!1,c)=>{const l=lt();a&&l.abort();const s=Q(e);return{call:U.put(t,n,{headers:{...s},params:o,signal:l.signal,_userFlow:c}),controller:l}},$e=(t,e={},n={},o={},a=!1,c)=>{const l=lt();a&&l.abort();const s=Q(e);return{call:U.patch(t,n,{headers:{...s},params:o,signal:l.signal,_userFlow:c}),controller:l}},tn=(t,e={},n={},o={},a=!1,c)=>{const l=lt();a&&l.abort();const s=Q(e);return{call:U.delete(t,{headers:{...s},data:n,params:o,signal:l.signal,_userFlow:c}),controller:l}},Qt=()=>{let t;return{callEndpoint:async o=>{o.controller&&(t=o.controller);let a={};try{a=await o.call}catch(c){throw c}return a},cancelEndpoint:()=>{t&&t.abort()}}},Zt=async(t,e,n="",o={},a={})=>{try{const{callEndpoint:c}=Qt(),{api:l,headers:s}=t,_=Ke(),i=new URLSearchParams({session_name:e});n&&i.append("hash_code",n),_&&i.append("sessionId",_);const d=`${l}/not-front/next-ui/?${i.toString()}`,u=Q(s),h=Et(d,u,o,a,!1,e);return await c(h)}catch(c){return console.error(c),Promise.reject(c)}},Ft=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"}},en=(t,e,n,o)=>{const{url:a,paginationKeys:c,params:l}=t,s=[],_=(c==null?void 0:c.page)??"page";if(s.push(`${_}=${e}`),o!=null){const u=(c==null?void 0:c.size)??"size";s.push(`${u}=${o}`)}if(typeof n=="string"){const u=(c==null?void 0:c.text)??"text";s.push(`${u}=${encodeURIComponent(n||"")}`)}if(l&&typeof l=="object"){const u=Object.entries(l).map(([h,f])=>`${encodeURIComponent(h)}=${encodeURIComponent(f)}`);s.push(...u)}const i=s.join("&");return i?`${a}?${i}`:a},nn=(t,e,n)=>{var c;const a={...(t==null?void 0:t.data)??{},...e??{}};if(n!=null){const l=((c=t.paginationKeys)==null?void 0:c.size)??"size";a[l]=n}return a},kt=(t,e,n,o,a)=>{const{type:c,url:l,method:s,headers:_}=t;if(c==="rest"){const i=en(t,e,n,a),d=nn(t,o,a);return{type:"rest",url:i,method:Ft(s),headers:_,data:d}}else return{type:"graphql",url:l,method:"post",headers:_,query:t==null?void 0:t.query,variables:{...(t==null?void 0:t.variables)||{},...typeof n=="string"?{text:n}:{},page:e,...a!=null?{size:a}:{}}}};async function sn(t,e,n,o,a,c){var f,m;const l=await a(t,e,o,n),s=(f=l==null?void 0:l.data)==null?void 0:f.content;if((s==null?void 0:s.type)!=="fetch")return;const _=s.responseKey??n,i=await c(s.dataSource,t,!1),d={...(m=v.getState()[t])==null?void 0:m.entries,[_]:{status:i==null?void 0:i.status,content:i==null?void 0:i.data}};M(t,d);const h=await a(t,e,d,_);h!=null&&h.data&&K(t,h.data)}const G=()=>{const t=v(_=>_),{callEndpoint:e}=Qt(),n=async(_,i,d,u,h=!0)=>{var f;try{const m=(f=t[_])==null?void 0:f.apiConfig,x={state:{...d},triggerKey:u};return h&&Y(_,!0),await Zt(m,_,i,x)}catch(m){throw h&&Y(_,!1),console.error("[getNextUI] Error fetching next UI:",m),m}},o=(_,i)=>{const{url:d,headers:u,data:h,params:f}=_;switch(Ft(_.method)){case"post":return Et(d,u,h,{},!1,i);case"put":return Pe(d,u,h,{},!1,i);case"patch":return $e(d,u,h,{},!1,i);case"delete":return tn(d,u,h,f,!1,i);case"get":default:return Fe(d,u,f,!1,i)}},a=(_,i)=>{const{url:d,headers:u}=_,h={query:_==null?void 0:_.query,variables:(_==null?void 0:_.variables)||{}};return Et(d,{...u,"Content-Type":"application/json"},h,{},!1,i)},c=async(_,i,d=!0)=>{var u,h;if(!_){console.warn("[fetchDataSource] Invalid or missing dataSource");return}d&&Y(i,!0);try{let f;switch(_==null?void 0:_.type){case"rest":f=o(_,i);break;case"graphql":f=a(_,i);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await e(f)}catch(f){const m=f;return console.error("[fetchDataSource] Error:",m),{status:((u=m==null?void 0:m.response)==null?void 0:u.status)??0,data:((h=m==null?void 0:m.response)==null?void 0:h.data)??{message:m==null?void 0:m.message,code:m==null?void 0:m.code,config:m==null?void 0:m.config}}}finally{d&&Y(i,!1)}};return{getNextUI:n,fetchDataSource:c,fetchAndGetNextUI:async(_,i,d,u,h)=>{try{Y(_,!0);const f=await c(h,_,!1);return f&&await n(_,i,d,u)}catch(f){throw Y(_,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",f),f}},runGetDataSource:(_,i,d,u)=>sn(_,i,d,u,n,c)}},Pt={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},on=t=>{const{userFlow:e,pageId:n,responseKey:o,dependencies:a,customContent:c,actionContent:l,components:s,..._}=t,{getNextUI:i}=G(),[d,u]=y.useState(_.checkboxChecked||!1),{disabled:h}=L(e,a),f=O(e,n,s),m=l?O(e,n,l):void 0,x=c?O(e,n,c):void 0,g=y.useCallback(async C=>{var E;try{const p=C.target.checked;u(p);const N={...(E=v.getState()[e])==null?void 0:E.entries,[o]:p};if(M(e,N),_.actionType==="GO_TO_NEXT_UI"){const k=await i(e,n,N,o);k!=null&&k.data&&K(e,k==null?void 0:k.data)}}catch(p){console.error("Error in accordion checkbox action:",p),alert(JSON.stringify(p))}},[e,n,o,_.actionType,i]),b=_.disabled||h,j={..._,className:Pt.accordion,disabled:b,checkboxChecked:d,onChanceCheckbox:_.hasCheckbox?g:void 0,actionContent:m?r.jsx(r.Fragment,{children:m.map((C,E)=>r.jsx(y.Fragment,{children:C},`accordion-action-${E}`))}):void 0,customContent:x?r.jsx(r.Fragment,{children:x.map((C,E)=>r.jsx(y.Fragment,{children:C},`accordion-custom-${E}`))}):void 0,children:f?r.jsx("section",{className:Pt.accordionBody,children:f.map((C,E)=>r.jsx(y.Fragment,{children:C},`accordion-child-${E}`))}):void 0};return r.jsx(w.Accordion,{...j})},an=t=>{const e=w.ThemeStore.useThemeStore(l=>l.theme.mode),n=t.dataSource,o=y.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,params:n==null?void 0:n.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,n==null?void 0:n.data]),a=t.locale??"en",c=y.useMemo(()=>{var s,_,i,d,u;const l={title:(s=t==null?void 0:t.translations)==null?void 0:s.title,welcomeTitle:(_=t==null?void 0:t.translations)==null?void 0:_.welcomeTitle,welcomeDescription:(i=t==null?void 0:t.translations)==null?void 0:i.welcomeDescription,placeholder:(d=t==null?void 0:t.translations)==null?void 0:d.placeholder,disclaimer:(u=t==null?void 0:t.translations)==null?void 0:u.disclaimer};return Object.fromEntries(Object.entries(l).filter(([,h])=>!!h))},[t==null?void 0:t.translations]);return y.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:o,locale:a,translations:c,initialSuggestions:t.initialSuggestions,theme:e})},[t.onResolveProps,o,a,c,t.initialSuggestions,e]),t.onResolveProps?null:r.jsx(xt.ChatPanel,{dataSource:o,locale:a,translations:c,initialSuggestions:t.initialSuggestions,theme:e})},rn={promptCodeEditor:"_promptCodeEditor_1d57s_1"},cn=t=>{const{userFlow:e,responseKey:n,codeBlockValue:o,language:a,disabled:c,dependencies:l,dataSource:s,inputLabel:_,inputPlaceholder:i,codeBlockLabel:d}=t,u=w.ThemeStore.useThemeStore(C=>C.theme.mode),[h,f]=y.useState(o||""),{disabled:m}=L(e,l),x=c??m,g=a??"json",b={url:(s==null?void 0:s.url)||"",method:(s==null?void 0:s.method)||"post",headers:s==null?void 0:s.headers,body:s==null?void 0:s.data},j=C=>{f(C);const E={[n]:C};M(e,E)};return y.useEffect(()=>{o!==void 0&&o!==h&&f(o)},[o]),r.jsx("section",{className:rn.promptCodeEditor,children:r.jsx(xt.PromptCodeEditor,{themeMode:u,requestConfig:b,language:g,disabled:x,inputLabel:_,inputPlaceholder:i,codeBlockLabel:d,codeBlockValue:h,onCodeChange:j})})},ln={summaryCard:"_summaryCard_jva4h_1"},dn=t=>{const e=t.dataSource,n=y.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]),o=t.locale??"en",a=y.useMemo(()=>{var l,s,_;const c={title:(l=t==null?void 0:t.translations)==null?void 0:l.title,loading:(s=t==null?void 0:t.translations)==null?void 0:s.loading,noData:(_=t==null?void 0:t.translations)==null?void 0:_.noData};return Object.fromEntries(Object.entries(c).filter(([,i])=>!!i))},[t==null?void 0:t.translations]);return y.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:n,locale:o,translations:a})},[t.onResolveProps,n,o,a]),t.onResolveProps?null:r.jsx("section",{className:ln.summaryCard,children:r.jsx(xt.SummaryCard,{dataSource:n,locale:o,translations:a})})},$t={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},_n=({inputs:t})=>r.jsx("section",{className:$t.body,children:r.jsx("div",{className:$t.body_content,children:t.map((e,n)=>r.jsx(y.Fragment,{children:e},n))})}),te={boxNotFront:"_boxNotFront_67q2e_1",slotStack:"_slotStack_67q2e_5"},un=t=>{const{userFlow:e,pageId:n,component:o,hash:a,responseKey:c,content:l}=t,s=w.ThemeStore.useThemeStore(d=>d.theme.mode)==="dark",_=O(e,n,l!=null&&l.length?l:null),i=_&&_.length>0?r.jsx("div",{className:te.slotStack,children:_.map((d,u)=>r.jsx(y.Fragment,{children:d},`box-${a}-${u}`))}):null;return r.jsx(w.Box,{className:te.boxNotFront,darkMode:s,children:i})};var Tt={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 qt;function We(){return qt||(qt=1,(function(t){(function(){var e={}.hasOwnProperty;function s(){for(var a=[],r=0;r<arguments.length;r++){var l=arguments[r];if(l){var c=typeof l;if(c==="string"||c==="number")a.push(l);else if(Array.isArray(l)){if(l.length){var n=s.apply(null,l);n&&a.push(n)}}else if(c==="object"){if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]")){a.push(l.toString());continue}for(var _ in l)e.call(l,_)&&l[_]&&a.push(_)}}}return a.join(" ")}t.exports?(s.default=s,t.exports=s):window.classNames=s})()})(jt)),jt.exports}var qe=We();const F=ve(qe),P={fieldset:"_fieldset_1xrth_1",fieldsetColumn:"_fieldsetColumn_1xrth_8",legend:"_legend_1xrth_14",options:"_options_1xrth_20",optionsRow:"_optionsRow_1xrth_25",optionsColumn:"_optionsColumn_1xrth_36"},Ye=t=>{const{userFlow:e,pageId:s,responseKey:a,label:r,value:l,required:c,actionType:n,dependencies:_,direction:i,items:d}=t,u=i==="column"?"column":"row",{getNextUI:h}=U(),{disabled:f}=G(e,_),y=T(p=>{var w,j;return(j=(w=p[e])==null?void 0:w.entries)==null?void 0:j[a]}),C=y!=null?String(y):l??"",b=f,m=g.useMemo(()=>r?c?`${r} *`:r:null,[r,c]),x=g.useCallback(async p=>{var w;if(!b)try{const j={...(w=T.getState()[e])==null?void 0:w.entries,[a]:p};if(B(e,j),n==="GO_TO_NEXT_UI"||n==="GO_TO_NEXT_UI_WITHOUT_LOADING"){const O=await h(e,s,j,a,n==="GO_TO_NEXT_UI");O!=null&&O.data&&K(e,O==null?void 0:O.data)}}catch(j){alert(JSON.stringify(j))}},[n,h,b,s,a,e]);return o.jsxs("fieldset",{className:F(P.fieldset,u==="column"&&P.fieldsetColumn),children:[m?o.jsx("legend",{className:P.legend,children:m}):null,o.jsx("div",{className:F(P.options,u==="column"?P.optionsColumn:P.optionsRow),children:d.map(p=>o.jsx(N.RadioButton,{name:a,value:p.value,checked:C===p.value,disabled:b||p.disabled,labelRight:p.label,onChange:()=>{x(p.value)}},p.value))})]})},Qe=({userFlow:t,pageId:e,component:s,hash:a,responseKey:r,items:l,itemActive:c,darkMode:n})=>o.jsx(N.Stepper,{items:l,itemActive:c,darkMode:n}),Ze=({userFlow:t,pageId:e,component:s,hash:a,responseKey:r,total:l,done:c,inProgress:n})=>o.jsx(N.ProgressBar,{total:l,done:c,inProgress:n}),Fe=({userFlow:t,items:e,responseKey:s})=>{const{getNextUI:a}=U(),r=g.useCallback(async({actionType:c,hashCode:n,redirectUrl:_})=>{var i;try{switch(c){case"GO_TO_NEXT_UI":const d=await a(t,n,{...(i=T.getState()[t])==null?void 0:i.entries},s);d!=null&&d.data&&K(t,d==null?void 0:d.data);break;case"REDIRECT":_?window.location.href=_:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${c}`);break}}catch(d){alert(JSON.stringify(d))}},[]),l=g.useMemo(()=>e==null?void 0:e.map(c=>({title:c==null?void 0:c.title,component:o.jsx("div",{onClick:()=>r(c)})})),[]);return o.jsx(N.Breadcrumbs,{items:l})};function lt(t,e){const{getNextUI:s,fetchDataSource:a,fetchAndGetNextUI:r}=U();return g.useCallback(async l=>{var h,f,y,C;const{responseKey:c,actionType:n,dataSource:_,redirectUrl:i,dependencies:d}=l,u=(h=T.getState()[t])==null?void 0:h.entries;if(!Ht(u,d))try{const b={...(f=T.getState()[t])==null?void 0:f.entries,[c]:{status:200}};switch(B(t,b),n){case"CLOSE_MODAL":xt(t,!1);break;case"CLOSE_DRAWER":ot(t,!1);break;case"OPEN_DRAWER":ot(t,!0);break;case"GO_TO_NEXT_UI":{const m=await s(t,e,b,c);m!=null&&m.data&&K(t,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await r(t,e,b,c,_);m!=null&&m.data&&K(t,m==null?void 0:m.data);break}case"FETCH_DATA_SOURCE":{const m=await a(_,t,!1);B(t,{[c]:{status:m==null?void 0:m.status,content:m==null?void 0:m.data}});break}case"GET_DATA_SOURCE":{const m=await s(t,e,b,c),x=(y=m==null?void 0:m.data)==null?void 0:y.content;if((x==null?void 0:x.type)!=="fetch")break;const p=x==null?void 0:x.dataSource,w=await a(p,t,!1),j={...(C=T.getState()[t])==null?void 0:C.entries,[c]:{status:w==null?void 0:w.status,content:w==null?void 0:w.data}};B(t,j);const k=await s(t,e,j,c);k!=null&&k.data&&K(t,k==null?void 0:k.data);break}case"REDIRECT":i?window.location.href=i:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${n}`)}}catch(b){alert(JSON.stringify(b))}},[r,a,s,e,t])}const Pe=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:r,label:l,content:c,dataSource:n,redirectUrl:_,dependencies:i,onClick:d,...u}=t,h=lt(e,s),{disabled:f}=G(e,i),y={...u,children:c??l},C=(y==null?void 0:y.disabled)??f,[b,m]=g.useState(!1),x=g.useRef(!1),p=g.useCallback(async()=>{if(x.current)return;const w=r==="FETCH_DATA_SOURCE";w&&(x.current=!0,m(!0));try{await h({responseKey:a,actionType:r,dataSource:n,redirectUrl:_,dependencies:i})}catch(j){console.error("[ButtonNotFront] Action failed:",j)}finally{w&&(x.current=!1,m(!1))}},[r,n,i,_,a,h]);return o.jsx(N.Button,{...y,loading:y.loading||b,disabled:C,onClick:()=>!C&&!b&&(d??p)()})},wt={slotStack:"_slotStack_12u4t_5"},$e=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,dependencies:c,content:n,actionContent:_,...i}=t,{disabled:d}=G(e,c),u=S(e,s,n&&n.length>0?n:null),h=S(e,s,_&&_.length>0?_:null),f=u&&u.length>0?o.jsx("div",{className:wt.slotStack,children:u.map((b,m)=>o.jsx(g.Fragment,{children:b},`card-accordion-body-${r}-${m}`))}):void 0,y=h&&h.length>0?o.jsx("div",{className:wt.slotStack,children:h.map((b,m)=>o.jsx(g.Fragment,{children:b},`card-accordion-actions-${r}-${m}`))}):void 0,C=i.disabled||d;return o.jsx(N.CardAccordion,{...i,disabled:C,actionContent:y,children:f??null})},Yt={cardNotFront:"_cardNotFront_2xt48_1",slotStack:"_slotStack_2xt48_5"},tn=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,content:c,colorId:n,disabled:_,actionType:i,dataSource:d,redirectUrl:u,dependencies:h}=t,{getNextUI:f,fetchDataSource:y,fetchAndGetNextUI:C}=U(),{disabled:b}=G(e,h),m=_??b,x=S(e,s,c&&c.length>0?c:null),p=x&&x.length>0?o.jsx("div",{className:Yt.slotStack,children:x.map((j,k)=>o.jsx(g.Fragment,{children:j},`card-body-${r}-${k}`))}):null,w=g.useCallback(async()=>{var j,k,E;if(!(!i||m))try{const O={...(j=T.getState()[e])==null?void 0:j.entries,[l]:{status:200}};switch(B(e,O),i){case"CLOSE_MODAL":xt(e,!1);break;case"CLOSE_DRAWER":ot(e,!1);break;case"OPEN_DRAWER":ot(e,!0);break;case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const I=await f(e,s,O,l,i==="GO_TO_NEXT_UI");I!=null&&I.data&&K(e,I==null?void 0:I.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const L=await C(e,s,O,l,d);L!=null&&L.data&&K(e,L==null?void 0:L.data);break}case"GET_DATA_SOURCE":{const L=await f(e,s,O,l),I=(k=L==null?void 0:L.data)==null?void 0:k.content;if((I==null?void 0:I.type)!=="fetch")break;const st=I==null?void 0:I.dataSource,X=await y(st,e,!1),D={...(E=T.getState()[e])==null?void 0:E.entries,[l]:{status:X==null?void 0:X.status,content:X==null?void 0:X.data}};B(e,D);const V=await f(e,s,D,l);V!=null&&V.data&&K(e,V==null?void 0:V.data);break}case"REDIRECT":u&&(window.location.href=u);break;default:console.warn(`Unhandled card actionType: ${i}`)}}catch(O){alert(JSON.stringify(O))}},[i,d,m,C,y,f,s,u,l,e]);return o.jsx(N.Card,{className:Yt.cardNotFront,colorId:n,disabled:m,onClick:i&&!m?()=>void w():void 0,children:p})},en=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,content:c,description:n,..._}=t,i=Array.isArray(c),d=S(e,s,i&&c.length>0?c:null);let u;return d&&d.length>0?u=o.jsxs("div",{className:wt.slotStack,children:[n?o.jsx(N.Text,{type:"sm",children:n}):null,d.map((h,f)=>o.jsx(g.Fragment,{children:h},`card-notification-body-${r}-${f}`))]}):u=(typeof c=="string"?c:void 0)??n,o.jsx(N.CardNotification,{..._,children:u})},Nt=t=>Array.isArray(t)?t:typeof t=="object"?JSON.stringify(t):t,nn=(t,e)=>{if(!e||t==null)return null;const{extractionJsonPath:s,injectionJsonPath:a}=e,r=H.value(t,s);if(r==null)return null;try{const l={};return H.value(l,a,r),l}catch(l){return console.warn("[buildCursorPayload] invalid injectionJsonPath:",a,l),null}},Qt=(t,e,s,a)=>{const r=H.query(t,e),l=r==null?void 0:r.map(d=>{var u,h;if(s){const f={};for(const[y,C]of Object.entries(s))if(typeof C=="object"&&"path"in C){const b=C,m=(u=H.query(d,b.path))==null?void 0:u[0];b.translations&&String(m)in b.translations?f[y]=Nt(b.translations[String(m)]):f[y]=Nt(m)}else{const b=C;f[y]=Nt((h=H.query(d,b))==null?void 0:h[0])}return f}else return d}),c=H.value(t,(a==null?void 0:a.size)??"$.meta.size")??r.length,n=H.value(t,(a==null?void 0:a.total)??"$.meta.total")??0,_=a!=null&&a.hasMore?!!H.value(t,a.hasMore):void 0,i={size:c,total:n,totalPages:a!=null&&a.totalPages?H.value(t,(a==null?void 0:a.totalPages)??"$.meta.totalPages"):c>0?Math.ceil(n/c):0,..._!==void 0?{hasMore:_}:{}};return{items:l,pagination:i}},$=({width:t,height:e,layout:s,data:a,Chart:r,children:l})=>{const c=e??et,n=s?{layout:s}:{};return t?o.jsx(r,{width:t,height:c,data:a,...n,children:l}):o.jsx(A.ResponsiveContainer,{width:"100%",height:c,children:o.jsx(r,{data:a,...n,children:l})})},J=({withPadding:t=!1})=>{const e=s=>o.jsx("span",{style:{color:R.labelColor},children:s});return o.jsx(A.Legend,{formatter:e,wrapperStyle:{fontSize:R.fontSize,fontFamily:R.fontFamily,padding:t?"1rem 0":"0"}})},sn=({active:t,payload:e,label:s,tooltipKey:a,tooltipCoverage:r})=>{var d,u;if(!t||!e||!e.length)return null;const l={backgroundColor:R.tooltipBg,borderRadius:R.tooltipBorderRadius,color:R.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(a){const h=(d=e[0])==null?void 0:d.payload;if(h&&h[a]!==void 0&&h[a]!==null)return o.jsx("div",{style:l,children:o.jsx("p",{style:{margin:0},children:h[a]})})}const c=(u=e[0])==null?void 0:u.payload,n=(r==null?void 0:r.label)??"Cobertura",_=r?c==null?void 0:c[r.denominatorKey]:void 0,i=r&&_!==void 0&&_!==null&&_>0;return o.jsxs("div",{style:l,children:[o.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:s}),e.map((h,f)=>o.jsx("p",{style:{margin:"2px 0",color:h.color},children:`${h.name}: ${h.value}`},f)),i&&o.jsx("p",{style:{margin:"2px 0"},children:`${n}: ${Math.round(c[r.numeratorKey]/_*100)}%`})]})},W=({tooltipKey:t,tooltipCoverage:e,defaultIndex:s,hideContent:a=!1}={})=>o.jsx(A.Tooltip,{defaultIndex:s,cursor:a?!1:void 0,content:a?()=>null:r=>o.jsx(sn,{...r,tooltipKey:t,tooltipCoverage:e})}),tt=({dataKey:t,hide:e=!1,type:s})=>o.jsx(A.XAxis,{...t?{dataKey:t}:{},...s?{type:s}:{},hide:e,tick:{fill:R.labelColor,fontSize:R.fontSize}}),Y=({type:t,dataKey:e,width:s,yAxisId:a,orientation:r}={})=>o.jsx(A.YAxis,{...t?{type:t}:{},...e?{dataKey:e}:{},...s!==void 0?{width:s}:{},...a?{yAxisId:a}:{},...r?{orientation:r}:{},tick:{fill:R.labelColor,fontSize:R.fontSize},tickMargin:4}),an=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:r,width:l}=t;return o.jsxs($,{width:l,data:e,Chart:A.AreaChart,children:[o.jsx(A.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(tt,{dataKey:s}),o.jsx(Y,{}),o.jsx(W,{tooltipKey:r}),o.jsx(J,{}),a.map((c,n)=>o.jsx(A.Area,{type:"monotone",dataKey:c,stroke:M[n%M.length],fill:M[n%M.length]},c))]})},on=t=>{const{data:e,yKeys:s,xKey:a,tooltipKey:r,width:l}=t;return o.jsxs($,{width:l,data:e,Chart:A.BarChart,children:[o.jsx(A.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(tt,{dataKey:a}),o.jsx(Y,{}),o.jsx(W,{tooltipKey:r}),o.jsx(J,{}),s.map((c,n)=>o.jsx(A.Bar,{dataKey:c,fill:M[n%M.length]},c))]})};var Zt={NODE_ENV:"production"};const rn=(t,e)=>{if(e!=null&&e.length)return e;const s=[...new Set(t.map(a=>a.yAxisId).filter(a=>!!a))];return s.length===0?[]:s.map((a,r)=>({id:a,orientation:r===1?"right":"left"}))},cn=(t,e)=>{!t.type&&Zt.NODE_ENV;const s=t.color??M[e%M.length],a=t.label??t.key,r=t.yAxisId?{yAxisId:t.yAxisId}:{};switch(t.type){case"area":return o.jsx(A.Area,{dataKey:t.key,name:a,type:"monotone",fill:s,stroke:s,fillOpacity:.3,...r},t.key);case"line":return o.jsx(A.Line,{dataKey:t.key,name:a,type:"monotone",stroke:s,strokeWidth:2,dot:!1,...r},t.key);case"bar":return o.jsx(A.Bar,{dataKey:t.key,name:a,fill:s,stackId:t.stackId,barSize:t.barSize,...r},t.key);default:return null}},ln=t=>{const{data:e,xKey:s,series:a=[],tooltipKey:r,width:l,showLegend:c=!0,yAxes:n}=t;!a.length&&Zt.NODE_ENV;const _=rn(a,n);return o.jsxs($,{width:l,data:e,Chart:A.ComposedChart,children:[o.jsx(A.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(tt,{dataKey:s}),_.length>0?_.map(i=>o.jsx(Y,{yAxisId:i.id,orientation:i.orientation},i.id)):o.jsx(Y,{}),o.jsx(W,{tooltipKey:r}),c&&o.jsx(J,{}),a.map((i,d)=>cn(i,d))]})},dn="55%",_n=120,un=t=>e=>{const s=Math.PI/180,{cx:a=0,cy:r=0,midAngle:l=0,innerRadius:c=0,outerRadius:n=0,startAngle:_=0,endAngle:i=0,fill:d=M[0],payload:u,percent:h=0,value:f=0}=e,y=Math.sin(-s*l),C=Math.cos(-s*l),b=a+(n+10)*C,m=r+(n+10)*y,x=a+(n+30)*C,p=r+(n+30)*y,w=x+(C>=0?1:-1)*22,j=p,k=C>=0?"start":"end",E=u,O=String((E==null?void 0:E[t])??"");return o.jsxs("g",{children:[o.jsx("text",{x:a,y:r,dy:8,textAnchor:"middle",fill:R.labelColor,fontSize:R.fontSize+2,fontFamily:R.fontFamily,children:O}),o.jsx(A.Sector,{cx:a,cy:r,innerRadius:c,outerRadius:n,startAngle:_,endAngle:i,fill:d}),o.jsx(A.Sector,{cx:a,cy:r,startAngle:_,endAngle:i,innerRadius:n+6,outerRadius:n+10,fill:d}),o.jsx("path",{d:`M${b},${m}L${x},${p}L${w},${j}`,stroke:d,fill:"none"}),o.jsx("circle",{cx:w,cy:j,r:2,fill:d,stroke:"none"}),o.jsx("text",{x:w+(C>=0?1:-1)*12,y:j,textAnchor:k,fill:R.labelColor,fontSize:R.fontSize+2,fontFamily:R.fontFamily,children:f}),o.jsx("text",{x:w+(C>=0?1:-1)*12,y:j,dy:18,textAnchor:k,fill:R.labelColorMuted,fontSize:R.fontSize,fontFamily:R.fontFamily,children:`(${(h*100).toFixed(0)}%)`})]})},hn=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:r,innerRadius:l=dn,outerRadius:c=_n,activeShape:n=!0,defaultIndex:_,showLegend:i=!0}=t,d=a[0];return o.jsx(A.ResponsiveContainer,{width:"100%",height:et,children:o.jsxs(A.PieChart,{children:[o.jsx(W,{tooltipKey:n?void 0:r,defaultIndex:_,hideContent:n}),i&&o.jsx(J,{}),o.jsx(A.Pie,{data:e,dataKey:d,nameKey:s,cx:"50%",cy:"50%",innerRadius:l,outerRadius:c,activeShape:n?un(s):void 0,children:e.map((u,h)=>o.jsx(A.Cell,{fill:M[h%M.length]},`cell-${h}`))})]})})};function fn(t,e,s=Ft){return t<=0?0:e<=0?t:Math.max(t,e*s)}function mn(t,e=jn,s){return s!==void 0?s:t<=0?et:Math.max(et,t*e)}function yn(t,e,s){if(s!==void 0)return s;const a=t.reduce((r,l)=>{const c=String(l[e]??"");return Math.max(r,c.length)},0);return Math.max(wn,a*Nn)}const xn=t=>{const{data:e,yKeys:s,xKey:a,tooltipKey:r,minCategoryHeight:l,chartHeight:c,tooltipCoverage:n,showLegend:_=!0,yKeyLabels:i,yAxisWidth:d}=t,u=mn(e.length,l,c),h=yn(e,a,d);return o.jsxs($,{height:u,layout:"vertical",data:e,Chart:A.BarChart,children:[o.jsx(A.CartesianGrid,{strokeDasharray:"3 3",horizontal:!1}),o.jsx(tt,{type:"number"}),o.jsx(Y,{type:"category",dataKey:a,width:h}),o.jsx(W,{tooltipKey:r,tooltipCoverage:n}),_&&o.jsx(J,{}),s.map((f,y)=>o.jsx(A.Bar,{dataKey:f,name:(i==null?void 0:i[f])??f,fill:M[y%M.length]},f))]})},gn=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:r,width:l}=t;return o.jsxs($,{width:l,data:e,Chart:A.LineChart,children:[o.jsx(A.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(tt,{dataKey:s}),o.jsx(Y,{}),o.jsx(W,{tooltipKey:r}),o.jsx(J,{}),a.map((c,n)=>o.jsx(A.Line,{type:"monotone",dataKey:c,stroke:M[n%M.length],strokeWidth:2,dot:!1},c))]})};var pn={NODE_ENV:"production"};const bn=t=>{const{data:e,xKey:s,series:a=[],tooltipKey:r,width:l}=t;return!a.length&&pn.NODE_ENV,o.jsxs($,{width:l,data:e,Chart:A.BarChart,children:[o.jsx(A.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(tt,{dataKey:s}),o.jsx(Y,{}),o.jsx(W,{tooltipKey:r}),o.jsx(J,{}),a.map((c,n)=>o.jsx(A.Bar,{dataKey:c.key,name:c.label??c.key,stackId:c.stackId,fill:c.color??M[n%M.length]},c.key))]})},Cn=t=>{const{data:e,xKey:s,yKeys:a,tooltipKey:r}=t,l=({cx:c,cy:n,midAngle:_,innerRadius:i,outerRadius:d,value:u})=>{const h=Math.PI/180,f=25+i+(d-i),y=c+f*Math.cos(-(_??0)*h),C=n+f*Math.sin(-(_??0)*h);return o.jsx("text",{x:y,y:C,fill:R.labelColor,color:R.labelColor,textAnchor:"middle",dominantBaseline:"central",children:u})};return o.jsx(A.ResponsiveContainer,{width:"100%",height:et,children:o.jsxs(A.PieChart,{children:[o.jsx(W,{tooltipKey:r}),o.jsx(J,{}),o.jsx(A.Pie,{data:e,dataKey:a[0],nameKey:s,label:l,outerRadius:120,children:e.map((c,n)=>o.jsx(A.Cell,{fill:M[n%M.length]},`cell-${n}`))})]})})},et=400,Ft=56,jn=28,wn=100,Nn=8,kn=new Set(["bar","line","area","mixBar","composed"]),En={area:an,bar:on,composed:ln,donut:hn,horizontalBar:xn,line:gn,mixBar:bn,pie:Cn},M=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],R={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",labelColorMuted:"var(--color-neutral-50)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},Pt={chartScrollViewport:"_chartScrollViewport_sm5hx_1",chartScrollViewport_track:"_chartScrollViewport_track_sm5hx_29"},Tn="Scrollable chart area",An=({dataLength:t,minCategoryWidth:e,children:s})=>{const a=g.useRef(null),[r,l]=g.useState(0),c=e??Ft;g.useEffect(()=>{const d=a.current;if(!d)return;const u=()=>{l(d.clientWidth)};u();const h=new ResizeObserver(u);return h.observe(d),()=>h.disconnect()},[]);const n=fn(r,t,c),_=r>0&&n>r,i=g.useCallback(d=>{const u=a.current;if(u)switch(d.key){case"ArrowLeft":u.scrollLeft-=c,d.preventDefault();break;case"ArrowRight":u.scrollLeft+=c,d.preventDefault();break;case"Home":u.scrollLeft=0,d.preventDefault();break;case"End":u.scrollLeft=u.scrollWidth-u.clientWidth,d.preventDefault();break}},[c]);return o.jsx("div",{ref:a,className:Pt.chartScrollViewport,role:_?"region":void 0,tabIndex:_?0:void 0,"aria-label":_?Tn:void 0,onKeyDown:_?i:void 0,children:o.jsx("div",{className:Pt.chartScrollViewport_track,style:{width:n,height:et},children:r>0?s(n):null})})},$t=t=>{const{component:e,userFlow:s,hash:a,responseKey:r,dataSource:l,...c}=t,n=En[c.type],{fetchDataSource:_}=U(),[i,d]=g.useState(!1),[u,h]=g.useState([]),f=async()=>{var b,m;try{d(!0);const{jsonPathData:x,mapperData:p}=l,w=Ct(l,1),j=await _(w,s,!1),k=x?(b=Qt(j==null?void 0:j.data,x,p))==null?void 0:b.items:(m=j==null?void 0:j.data)==null?void 0:m.data;h(k),d(!1)}catch(x){alert(JSON.stringify(x)),d(!1)}};if(g.useEffect(()=>{n&&(l?f():h(c.data))},[]),!n)return o.jsx("div",{children:"Not supported chart type"});const y={...c,data:u};return i?o.jsx(N.SkeletonBase,{height:400}):u.length===0?o.jsx(N.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):kn.has(c.type)?o.jsx(An,{dataLength:u.length,minCategoryWidth:c.minCategoryWidth,children:b=>o.jsx(n,{...y,width:b})}):o.jsx(n,{...y})},vn=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:r,label:l,value:c,required:n,dependencies:_,...i}=t,d={...i},{getNextUI:u}=U(),[h,f]=g.useState(c||!1),{disabled:y}=G(e,_),C=g.useMemo(()=>n&&l?`${l} *`:l??"",[l,n]),b=g.useCallback(async()=>{var x;try{const p=!h;f(p);const w={...(x=T.getState()[e])==null?void 0:x.entries,[a]:p};switch(B(e,w),r){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,w,a,r==="GO_TO_NEXT_UI");k!=null&&k.data&&K(e,k==null?void 0:k.data);break}default:break}}catch(p){console.error("Error in checkbox action:",p),alert(JSON.stringify(p))}},[e,s,a,r,h]),m=(d==null?void 0:d.disabled)??y;return o.jsx(N.Checkbox,{...d,labelRight:C,checked:h,disabled:m,onChange:()=>{!m&&b()}})},nt={codeEditor:"_codeEditor_1wi2p_1",codeEditor_label:"_codeEditor_label_1wi2p_4",codeEditor_wrapper:"_codeEditor_wrapper_1wi2p_13",input:"_input_1wi2p_17",preview:"_preview_1wi2p_18",preview_inner:"_preview_inner_1wi2p_33"},Sn=t=>{const{userFlow:e,responseKey:s,label:a,language:r,placeholder:l,value:c,required:n,dependencies:_,disabled:i,showPreview:d,height:u="400px"}=t,[h,f]=g.useState(c??""),y=N.ThemeStore.useThemeStore(w=>w.theme.mode),{disabled:C}=G(e,_),b=i??C,m={json:St.json(),markdown:ge.markdown(),sql:pe.sql(),yaml:be.yaml()},x=g.useMemo(()=>n&&a?`${a} *`:a??"",[a,n]),p=w=>{f(w);const j={[s]:w};B(e,j)};return o.jsxs("div",{className:nt.codeEditor,children:[x&&x!==""&&o.jsx("label",{className:nt.codeEditor_label,children:x}),o.jsxs("div",{className:nt.codeEditor_wrapper,children:[o.jsx(xe,{className:nt.input,value:h,height:u,placeholder:l,extensions:[m[r]??St.json()],onChange:w=>p(w),theme:y,editable:!b}),r==="markdown"&&d&&o.jsx("div",{className:nt.preview,style:{height:u},children:o.jsx(N.PreviewerMarkdown,{className:nt.preview_inner,children:h})})]})]})},On={slotStack:"_slotStack_6n2wy_5"};var Rn={NODE_ENV:"production"};const Dn=new Set(["accordion","button","cardAccordion","checkbox","dropdownButton","link","menu","radioGroup","roundButton","select","stepper","switch","table","tabs","textField","textarea"]),kt=(t,e)=>{if(t!=null&&t.length)return o.jsx("div",{className:On.slotStack,children:t.map((s,a)=>{var r;return o.jsx(g.Fragment,{children:s},((r=e==null?void 0:e[a])==null?void 0:r.hash)??a)})})},Ln=({userFlow:t,pageId:e,component:s,hash:a,responseKey:r,content:l,topContent:c,icon:n,headerStatusColor:_,...i})=>{const d=_?`palette_${_}_50`:void 0,u=S(t,e,l!=null&&l.length?l:null),h=S(t,e,c!=null&&c.length?c:null);return o.jsx(N.DataCard,{...i,icon:n,headerStatusColor:d,topContent:kt(h,c),children:kt(u,l)})},In=({userFlow:t,pageId:e,responseKey:s,actionType:a,dataSource:r,redirectUrl:l,dependencies:c,content:n,icon:_,ariaLabel:i,description:d,descriptionBottom:u,disabled:h,status:f,headerStyle:y,showBorder:C,borderColor:b,title:m,descriptionTop:x,pillLabel:p})=>{const w=S(t,e,n!=null&&n.length?n:null),j=lt(t,e),{disabled:k}=G(t,c),E=a?()=>void j({responseKey:s,actionType:a,dataSource:r,redirectUrl:l,dependencies:c}):void 0,O=h??k;E&&(n!=null&&n.some(I=>Dn.has(I.component)))&&Rn.NODE_ENV;const L=E?{onClick:E,disabled:O}:{};return o.jsx(N.DataCard,{version:"v2",status:f,headerStyle:y,showBorder:C,borderColor:b,title:m,ariaLabel:i,descriptionTop:x,descriptionBottom:u??d,pillLabel:p,icon:_,...L,children:kt(w,n)})},Mn=t=>t.version==="v2"?o.jsx(In,{...t}):o.jsx(Ln,{...t}),Bn={dividerNotFront:"_dividerNotFront_tze3j_1"},Kn=t=>o.jsx(N.Divider,{...t,className:Bn.dividerNotFront}),Et={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},Gn=({userFlow:t,pageId:e,responseKey:s,header:a,body:r,footer:l,...c})=>{const n=T(b=>{var m;return(m=b[t])==null?void 0:m.isDrawerOpen}),_=T(b=>{var m;return(m=b[t])==null?void 0:m.isLoading}),i=n&&!_,d={...c,isOpen:i,children:null},u=g.useCallback(()=>{yt(t),ot(t,!1)},[t]),h=Array.isArray(a)?S(t,e,a):a?o.jsx(N.Heading,{type:"h2",children:a}):void 0,f=S(t,e,r),y=l?S(t,e,l):void 0;return o.jsx(N.Drawer,{...d,className:Et.drawer,isOpen:i,onClose:u,heightGap:50,title:h?o.jsx(o.Fragment,{children:Array.isArray(h)?h.map((b,m)=>o.jsx(g.Fragment,{children:b},`drawer-header-${m}`)):h}):void 0,children:o.jsx("section",{className:Et.drawerBody,children:f.map((b,m)=>o.jsx(g.Fragment,{children:b},`drawer-body-${m}`))}),footer:y?o.jsx("div",{className:Et.drawerFooter,children:y.map((b,m)=>o.jsx(g.Fragment,{children:b},`drawer-footer-${m}`))}):void 0})},Hn=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,content:c,items:n,disabled:_,variant:i,leftIcon:d,rightIcon:u}=t,h=lt(e,s),f=g.useMemo(()=>n.map(y=>({label:y.content??y.label??"",onClick:()=>{h({responseKey:y.responseKey,actionType:y.actionType,dataSource:y.dataSource,redirectUrl:y.redirectUrl,dependencies:y.dependencies})}})),[n,h]);return o.jsx(N.DropdownButton,{disabled:_,variant:i,items:f,children:o.jsxs(g.Fragment,{children:[d?o.jsx(Ot.Icon,{name:d,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,c,u?o.jsx(Ot.Icon,{name:u,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},te={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},Vn=({components:t=[]})=>o.jsx("section",{className:F(te.header,"avocado-dark-theme"),children:o.jsx("div",{className:te.header_content,children:t.map((e,s)=>o.jsx(g.Fragment,{children:e},s))})}),Un=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:r,content:l,redirectUrl:c,target:n,dependencies:_,component:i,hash:d,...u}=t,{getNextUI:h}=U(),{disabled:f}=G(e,_),y=r&&u?(()=>{const{href:m,target:x,download:p,...w}=u;return w})():u,C=g.useCallback(async()=>{var m;if(r)try{const x={...(m=T.getState()[e])==null?void 0:m.entries,[a]:{status:200}};switch(B(e,x),r){case"GO_TO_NEXT_UI":{const p=await h(e,s,x,a);p!=null&&p.data&&K(e,p==null?void 0:p.data);break}case"REDIRECT":if(!c){console.warn("Missing redirectUrl for REDIRECT actionType");break}n==="_blank"?window.open(c,"_blank","noopener,noreferrer"):window.location.assign(c);break;default:console.warn(`Unhandled actionType for link: ${r}`);break}}catch(x){alert(JSON.stringify(x))}},[r,h,s,c,a,n,e]),b=y.disabled??f;return o.jsx(N.Link,{...y,disabled:b,onClick:r?C:void 0,children:l})},zn=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,items:c,closeOnClick:n,disabled:_,listOrigin:i,size:d,variant:u}=t,h=lt(e,s),f=g.useMemo(()=>c.map(y=>({icon:y.leftIcon,label:y.content??y.label??"",onClick:C=>{var b;(b=C==null?void 0:C.preventDefault)==null||b.call(C),h({responseKey:y.responseKey,actionType:y.actionType,dataSource:y.dataSource,redirectUrl:y.redirectUrl,dependencies:y.dependencies})}})),[c,h]);return o.jsx(N.Menu,{items:f,closeOnClick:n,disabled:_,listOrigin:i,size:d,variant:u})},Xn={modalContent:"_modalContent_p06ci_1"},Jn=({userFlow:t,pageId:e,responseKey:s,header:a,body:r,footer:l,headerStatusColor:c,...n})=>{const _=T(m=>{var x;return(x=m[t])==null?void 0:x.isModalOpen}),i=T(m=>{var x;return(x=m[t])==null?void 0:x.isLoading}),d=_&&!i,u={...n},h=(u==null?void 0:u.headerStatusColor)??c,f=g.useCallback(()=>{yt(t),xt(t,!1)},[t,s]),y=Array.isArray(a)?S(t,e,a):a,C=S(t,e,r),b=S(t,e,l);return o.jsx(N.Modal,{...u,headerStatusColor:h,header:typeof y=="string"?y:o.jsx(o.Fragment,{children:y.map((m,x)=>o.jsx(g.Fragment,{children:m},`modal-header-${x}`))}),children:o.jsx("section",{className:Xn.modalContent,children:C.map((m,x)=>o.jsx(g.Fragment,{children:m},`modal-body-${x}`))}),actions:o.jsx(o.Fragment,{children:b.map((m,x)=>o.jsx(g.Fragment,{children:m},`modal-footer-${x}`))}),open:d,onClose:f})},Wn=({userFlow:t,pageId:e})=>{var l,c;const s=ke(t);if(!s)return null;const a=[...(s==null?void 0:s.components)||[],...((l=s==null?void 0:s.header)==null?void 0:l.components)||[],...((c=s==null?void 0:s.body)==null?void 0:c.components)||[]],r=S(t,e,a);return o.jsx(o.Fragment,{children:r==null?void 0:r.map((n,_)=>{const i=`overlay-${_}-${s==null?void 0:s.hash}`;return o.jsx(g.Fragment,{children:n},i)})})},qn=["success","warning","error","info","neutral"],ee={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"}},Tt={success:{color:"success-50",textColor:"success-60",iconColor:"success-50"},warning:{color:"warning-50",textColor:"warning-60",iconColor:"warning-50"},error:{color:"error-50",textColor:"error-60",iconColor:"error-50"},info:{color:"primary-50",textColor:"primary-70",iconColor:"primary-70"},neutral:{color:"neutral-30",textColor:"neutral-50",iconColor:"neutral-50"}},Yn="outlined",ne=t=>typeof t=="string"&&qn.includes(t),Qn=(t,e={})=>t!=null&&t.length?t.length===3&&ne(t[1])&&t[2]===Yn?[{label:String(t[0]),variant:t[1],outlined:!0}]:t.length===2&&ne(t[1])?[{label:String(t[0]),variant:t[1],...e.outlined?{outlined:!0}:{}}]:t.map(s=>({label:String(s),variant:e.variant??"neutral",...e.outlined?{outlined:!0}:{}})):[],Zn=t=>{const{content:e,variant:s="neutral",...a}=t,r=ee[s],l={...a,children:e,color:(a==null?void 0:a.color)??r.color,textColor:(a==null?void 0:a.textColor)??r.textColor,iconColor:(a==null?void 0:a.iconColor)??r.iconColor};return o.jsx(N.Pill,{...l})},Fn=t=>{const{content:e}=t;return o.jsx(N.PreviewerMarkdown,{children:e})},Pn=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:r,dataSource:l,dependencies:c,onClick:n,..._}=t,i=lt(e,s),{disabled:d}=G(e,c),u={..._},h=(u==null?void 0:u.disabled)??d,[f,y]=g.useState(!1),C=g.useRef(!1),b=g.useCallback(async()=>{if(C.current)return;const m=r==="FETCH_DATA_SOURCE";m&&(C.current=!0,y(!0));try{await i({responseKey:a,actionType:r,dataSource:l,dependencies:c})}catch(x){console.error("[RoundButtonNotFront] Action failed:",x)}finally{m&&(C.current=!1,y(!1))}},[r,l,c,a,i]);return o.jsx(N.RoundButton,{...u,loading:u.loading||f,disabled:h,onClick:()=>!h&&!f&&(n??b)()})},q={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},se=t=>{const{userFlow:e,pageId:s,columnWidth:a,columns:r,gap:l="md",justifyContent:c="start",alignItems:n="stretch"}=t,_=Array.isArray(r)?r.map((i,d)=>{const u=`col_${d}`,h=`col_${d}`;if(Array.isArray(i))return{gap:"md",justifyContent:"start",alignItems:"start",items:i,hash:u,responseKey:h};const f=i;return{gap:(f==null?void 0:f.gap)??"md",justifyContent:(f==null?void 0:f.justifyContent)??"start",alignItems:(f==null?void 0:f.alignItems)??"start",items:(f==null?void 0:f.items)??[],hash:(f==null?void 0:f.hash)??u,responseKey:(f==null?void 0:f.responseKey)??h}}):[];return _.length===0?null:o.jsx("div",{className:F(q.row,q[`row__gap-${l}`],q[`row__justify-${c}`],q[`row__align-${n}`]),children:_==null?void 0:_.map((i,d)=>{const u=(a==null?void 0:a[d])||`${100/_.length}%`,h=S(e,s,i.items);return!h||h.length===0?null:o.jsx("div",{className:F(q.row_column,q[`row_column__gap-${i.gap}`],q[`row_column__justify-${i.justifyContent}`],q[`row_column__align-${i.alignItems}`]),style:{width:u},children:h},i.hash||d)})})};function ae({userFlow:t,pageId:e,responseKey:s,actionType:a,getNextUI:r,isMulti:l=!1,debounceMs:c}){const n=g.useRef(null);g.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const _=g.useCallback(async d=>{var f;const u={...(f=T.getState()[t])==null?void 0:f.entries};if(d?(u[s]=d,B(t,u)):(delete u[s],Ee(t,s)),a&&(a==="GO_TO_NEXT_UI"||a==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const C=await r(t,e,u,s,a==="GO_TO_NEXT_UI");C!=null&&C.data&&K(t,C.data)}catch(y){console.error("[useSelectChange] Failed to fetch next UI",y)}},[t,e,s,a,r]);return g.useCallback(d=>{if(!l){_(d);return}if(c==null){_(d);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{_(d),n.current=null},c)},[l,c,_])}const $n=/\{([^}]+)\}/g,ts=(t,e)=>{var s;return e.includes("{")?e.replace($n,(a,r)=>{var c;const l=(c=H.query(t,r.trim()))==null?void 0:c[0];return l!=null?String(l):""}):(s=H.query(t,e))==null?void 0:s[0]},es=(t,e,s,a)=>{const r=H.query(t,e);return(r==null?void 0:r.map(l=>{var _;const c=ts(l,s),n=a?(_=H.query(l,a))==null?void 0:_[0]:l;return{label:c,value:n}}))??[]},ns=(t,e,s,a=10)=>{var n,_;let r,l;if(s){const i=H.value(t,s.size??"$.meta.size")??a,d=H.value(t,s.total??"$.meta.total")??0;r=i,l=d}else{const i=t==null?void 0:t.meta;r=(i==null?void 0:i.size)??((n=i==null?void 0:i.page)==null?void 0:n.size)??a,l=(i==null?void 0:i.total)??((_=i==null?void 0:i.page)==null?void 0:_.total)??0}const c=l>0?Math.ceil(l/r)>e:!1;return{pageSize:r,total:l,hasMore:c}},oe={selectNotFront:"_selectNotFront_ch3v5_1"},ss=({userFlow:t,pageId:e,responseKey:s,required:a,dataSource:r,actionType:l,dependencies:c,debounceMs:n,..._})=>{const i={..._},{getNextUI:d,fetchDataSource:u}=U(),[h,f]=g.useState((i==null?void 0:i.value)??""),{disabled:y}=G(t,c),C=(i==null?void 0:i.disabled)??y,b=g.useMemo(()=>a&&(i!=null&&i.label)?`${i==null?void 0:i.label} *`:(i==null?void 0:i.label)??"",[i==null?void 0:i.label,a]),m=g.useMemo(()=>{const j=i!=null&&i.isMulti?h:[h],k={};return Array.isArray(j)&&j.forEach(E=>{if(!E)return;const O=JSON.stringify(E.value),L=JSON.stringify(E.label);k[O]=E,L in k||(k[L]=E)}),k},[h]),x=ae({userFlow:t,pageId:e,responseKey:s,actionType:l,getNextUI:d,isMulti:i==null?void 0:i.isMulti,debounceMs:n}),p=j=>{f(j),x(j)},w=async(j,k,{page:E})=>{const{jsonPathLabel:O,jsonPathOptions:L,jsonPathValue:I,jsonPathPagination:st}=r,X=Ct(r,E,j),D=await u(X,t,!1),V=D==null?void 0:D.data,it=V?es(V,L,O,I):[],{hasMore:At}=ns(V,E,st);return{options:it,hasMore:At,additional:{page:E+1}}};return o.jsx(N.SelectPagination,{...i,className:oe.selectNotFront,label:b,value:h,disabled:C,noOptionsMessage:()=>o.jsx(o.Fragment,{children:"Sin opciones"}),onChange:j=>!C&&p(j),loadOptions:w,additional:{page:1},isOptionDisabled:j=>{const k=JSON.stringify(j==null?void 0:j.value),E=JSON.stringify(j==null?void 0:j.label);return!!(m!=null&&m[k])||!!(m!=null&&m[E])},debounceTimeout:350})},as=({userFlow:t,pageId:e,responseKey:s,dataSource:a,required:r,actionType:l,dependencies:c,debounceMs:n,..._})=>{const i={..._},{getNextUI:d}=U(),[u,h]=g.useState(i.value||""),{disabled:f}=G(t,c),y=(i==null?void 0:i.disabled)??f,C=g.useMemo(()=>r&&(i!=null&&i.label)?`${i==null?void 0:i.label} *`:(i==null?void 0:i.label)??"",[i==null?void 0:i.label,r]),b=ae({userFlow:t,pageId:e,responseKey:s,actionType:l,getNextUI:d,isMulti:i==null?void 0:i.isMulti,debounceMs:n}),m=x=>{h(x),b(x)};return o.jsx(N.Select,{...i,className:oe.selectNotFront,label:C,value:u,disabled:y,onChange:x=>!y&&m(x)})},os=t=>{const{dataSource:e}=t;return e?o.jsx(ss,{...t}):o.jsx(as,{...t})},re={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"},rs=t=>{const{size:e}=t,s=F(re.spacing,re[`spacing__${e}`]);return o.jsx("div",{className:s})},cs=t=>{const{userFlow:e,pageId:s,responseKey:a,actionType:r,label:l,value:c,required:n,dependencies:_,...i}=t,d={...i},{getNextUI:u}=U(),[h,f]=g.useState(c||!1),{disabled:y}=G(e,_),C=(d==null?void 0:d.disabled)??y,b=g.useMemo(()=>n&&l?`${l} *`:l??"",[l,n]),m=g.useCallback(async()=>{var x;try{const p=!h;f(p);const w={...(x=T.getState()[e])==null?void 0:x.entries,[a]:p};switch(B(e,w),r){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,w,a,r==="GO_TO_NEXT_UI");k!=null&&k.data&&K(e,k==null?void 0:k.data);break}default:break}}catch(p){console.error("Error in switch action:",p),alert(JSON.stringify(p))}},[e,s,a,r,h]);return o.jsx(N.Switch,{...d,label:b,checked:h,disabled:C,onChange:()=>!C&&m()})},ce={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},ls=(t,e)=>{if(t)return Tt[t];if(e)return Tt.neutral},is=({values:t,pillVariant:e,pillOutlined:s})=>{const r=Qn(t??[],{variant:e,outlined:s}),l=r.slice(0,4),c=r.length-4,n=ls(e,s);return o.jsxs("div",{className:ce.tableArrayPills,children:[l.map((_,i)=>{const d=_.outlined?Tt[_.variant]:ee[_.variant];return o.jsx(N.Pill,{color:d.color,textColor:d.textColor,iconColor:d.iconColor,outlined:_.outlined,children:_.label},`${_.label}-${_.variant}-${_.outlined??!1}-${i}`)}),c>0&&o.jsxs(N.Pill,{outlined:!0,color:n==null?void 0:n.color,textColor:n==null?void 0:n.textColor,iconColor:n==null?void 0:n.iconColor,children:["+",c]})]})},ds=({userFlow:t,pageId:e,tableResponseKey:s,component:a,rowData:r})=>{const{getNextUI:l,fetchAndGetNextUI:c,fetchDataSource:n}=U(),_=S(t,e,[{...a}]),i=(_==null?void 0:_[0])||null;if(!i)return null;const{actionType:d,responseKey:u,dataSource:h}=i.props,f=g.useCallback(async()=>{var y,C,b;try{const m={...(y=T.getState()[t])==null?void 0:y.entries,[u]:{status:200},[s]:[{...r}]};switch(B(t,m),d){case"GO_TO_NEXT_UI":{const x=await l(t,e,m,u);x!=null&&x.data&&K(t,x==null?void 0:x.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const x=await c(t,e,m,u,h);x!=null&&x.data&&K(t,x==null?void 0:x.data);break}case"GET_DATA_SOURCE":{const x=await l(t,e,m,u),p=(C=x==null?void 0:x.data)==null?void 0:C.content;if((p==null?void 0:p.type)!=="fetch")break;const w=p==null?void 0:p.dataSource,j=await n(w,t,!1),k={...(b=T.getState()[t])==null?void 0:b.entries,[u]:{status:j==null?void 0:j.status,content:j==null?void 0:j.data}};B(t,k);const E=await l(t,e,k,u);E!=null&&E.data&&K(t,E==null?void 0:E.data);break}default:console.warn(`Unhandled actionType: ${d}`);break}}catch(m){alert(JSON.stringify(m))}},[d,h,e,u,t]);return g.cloneElement(i,{onClick:f})},_s=()=>o.jsx("div",{className:ce.tableSkeleton,children:[...Array(10)].map((t,e)=>o.jsx(N.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),us=(t,e)=>!(e!=null&&e.length)||!t?t:t.map(s=>e.some(r=>{const l=r;return Array.isArray(s!=null&&s.accessor?l[s.accessor]:void 0)})?{...s,renderCell:r=>{const l=s.accessor?r[s.accessor]:void 0;return Array.isArray(l)?o.jsx(is,{values:l,pillVariant:s.pillVariant,pillOutlined:s.pillOutlined}):l??""}}:s),hs=({userFlow:t,pageId:e,responseKey:s,component:a,dataSource:r,rightActions:l,data:c,pageSize:n,..._})=>{var st,X;const{fetchDataSource:i}=U(),[d,u]=g.useState(!1),[h,f]=g.useState(1),[y,C]=g.useState(null),b=!r&&Array.isArray(c),m=!!(r!=null&&r.jsonPathCursorPagination)&&!!((st=r==null?void 0:r.jsonPathPagination)!=null&&st.hasMore),x=g.useRef(new Map([[1,null]])),p=g.useMemo(()=>{if(l!=null&&l.length)return l.map((D,V)=>({renderContent:it=>o.jsx(ds,{userFlow:t,pageId:e,tableResponseKey:s,component:D,rowData:it},`tableRowAction${V}`)}))},[l,t,e,s]),w=async(D=1)=>{if(!r)return;const{mapperData:V,jsonPathData:it,jsonPathPagination:At,jsonPathCursorPagination:dt}=r;if(dt&&D!==1&&!x.current.has(D)){f(1),w(1);return}dt&&D===1&&(x.current=new Map([[1,null]]));try{u(!0);const vt=dt?x.current.get(D)??null:null,Es=Ct(r,D,void 0,vt),at=await i(Es,t,!1);if(C(Qt(at==null?void 0:at.data,it,V,At)),dt){const me=nn(at==null?void 0:at.data,dt);me&&x.current.set(D+1,me)}u(!1)}catch(vt){console.error("[TableNotFront] fetchData:",vt),u(!1)}},j=D=>{f(D),w(D)};g.useEffect(()=>{b||w()},[]);const k=b?c:y==null?void 0:y.items,E=b&&!!n&&((c==null?void 0:c.length)??0)>n,O=g.useMemo(()=>{if(!E||!c||!n)return k??[];const D=(h-1)*n;return c.slice(D,D+n)},[E,c,n,h,k]),L=g.useMemo(()=>us(_.columns,k),[k,_.columns]),I={..._,data:O,columns:L??[],rightActions:p};return b?!k||k.length===0?o.jsx(N.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):o.jsxs(o.Fragment,{children:[o.jsx(N.Table,{...I}),E&&n&&c&&o.jsx(N.Pager,{classname:{global:"row__end"},page:h,size:n,total:c.length,onChange:f})]}):o.jsx(o.Fragment,{children:d?o.jsx(_s,{}):y&&((X=y==null?void 0:y.items)==null?void 0:X.length)>0?o.jsxs(o.Fragment,{children:[o.jsx(N.Table,{...I}),!m&&(y==null?void 0:y.pagination)&&y.pagination.totalPages>1&&o.jsx(N.Pager,{classname:{global:"row__end"},page:h,size:y.pagination.size,total:y.pagination.total,onChange:j}),m&&(y==null?void 0:y.pagination)&&o.jsx(N.Pager,{variant:"cursor",classname:{global:"row__end"},page:h,hasNextPage:!!y.pagination.hasMore,onChange:j})]}):o.jsx(N.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},fs={tabsPanel:"_tabsPanel_kvslb_1"},ms=({userFlow:t,pageId:e,components:s})=>{const a=S(t,e,s);return a!=null&&a.length?o.jsx("section",{className:fs.tabsPanel,children:a.map((r,l)=>o.jsx(g.Fragment,{children:r},`tabs-panel-${l}`))}):null},ys=({userFlow:t,pageId:e,hash:s,items:a,activeIndex:r,className:l,responseKey:c})=>{const n=a.map((i,d)=>({label:i.label,disabled:i.disabled,children:o.jsx(ms,{userFlow:t,pageId:e,components:i.components},`${s}-tab-${d}`)})),_=i=>{var u;const d={...(u=T.getState()[t])==null?void 0:u.entries,[c]:i};B(t,d)};return o.jsx(N.Tabs,{className:l,activeIndex:r,items:n,onClick:_})},le=(t,e,s)=>{const a=T(l=>{var c,n;return(n=(c=l[t])==null?void 0:c.entries)==null?void 0:n[e]}),r=g.useCallback(l=>B(t,{[e]:l}),[t,e]);return[a??s,r]},xs={textareaNotFront:"_textareaNotFront_1wpe5_1"},gs=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,required:c,dependencies:n,..._}=t,{value:i,...d}=_,[u,h]=le(e,l,i??""),{disabled:f}=G(e,n),y=(d==null?void 0:d.disabled)??f,C=g.useMemo(()=>c&&(d!=null&&d.label)?`${d.label} *`:(d==null?void 0:d.label)??"",[d==null?void 0:d.label,c]),b=m=>h(m.target.value);return o.jsx(N.Textarea,{...d,className:xs.textareaNotFront,label:C,value:u,disabled:y,onChange:m=>!y&&b(m)})},ps={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},bs=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,required:c,dependencies:n,..._}=t,{value:i,...d}=_,[u,h]=le(e,l,i??""),{disabled:f}=G(e,n),y=(d==null?void 0:d.disabled)??f,C=g.useMemo(()=>c&&(d!=null&&d.label)?`${d==null?void 0:d.label} *`:(d==null?void 0:d.label)??"",[d==null?void 0:d.label,c]),b=m=>h(m.target.value);return o.jsx(N.TextField,{...d,className:ps.textFieldNotFront,allowClear:!1,label:C,value:u,disabled:y,onChange:m=>!y&&b(m)})},Cs=({userFlow:t,pageId:e,responseKey:s,variant:a,content:r,actionType:l,redirectUrl:c})=>{const n=g.useCallback(async()=>{yt(t);try{switch(l){case"AUTOCLOSE_AND_REDIRECT":window.location.href=c;break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(_){console.error("Error in toast action:",_),alert(JSON.stringify(_))}},[l,e,s,t,c]);return g.useEffect(()=>{({info:N.toast.info,error:N.toast.error,success:N.toast.success,warning:N.toast.warning}[a]||N.toast.info)(r,{autoClose:l?!1:4e3,containerId:t,onClose:n})},[n,t]),null},ie={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},js=t=>{const{userFlow:e,pageId:s,component:a,hash:r,responseKey:l,content:c,label:n,placement:_,notShowArrow:i,visible:d}=t,u=S(e,s,c!=null&&c.length?c:null),h=u&&u.length>0?o.jsx("div",{className:ie.tooltipNotFront_content,children:u.map((f,y)=>o.jsx(g.Fragment,{children:f},`tooltip-${r}-${y}`))}):null;return o.jsx(N.Tooltip,{className:ie.tooltipNotFront,label:n,placement:_,notShowArrow:i,visible:d,children:h})};function ws({sessionName:t,apiConfig:e,onResolveComponentProps:s,children:a}){const r=fe(t,e,null,s);return o.jsxs(o.Fragment,{children:[r,a]})}const Ns={api:"",headers:{}},de=({userFlow:t,components:e,hash:s,apiConfig:a})=>{const r=s??`${t}-page`;g.useState(()=>{var _,i;return(i=(_=T.getState()[t])==null?void 0:_.pages)!=null&&i[r]||_t(t,a??Ns,{type:"page",hash:r,body:{components:e}}),null});const l=S(t,r,e);return o.jsx(o.Fragment,{children:l})};function _e(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 ue=({payload:t,userFlow:e})=>{const s=_e(t.display),a=de({userFlow:e,hash:t.id,components:s});return o.jsx(o.Fragment,{children:a})},ks=ue,he=(t,e,s,a,r)=>{const l=S(t,e,(a==null?void 0:a.components)||null,r);switch(s){case"body":return o.jsx(Xe,{...a,inputs:l||[]},JSON.stringify(a==null?void 0:a.components));case"header":return o.jsx(Vn,{...a,components:l||[]},JSON.stringify(a==null?void 0:a.components));default:return null}},fe=(t,e,s,a)=>{var b,m;const[r,l]=g.useState(!1),c=!!(e!=null&&e.api&&!s&&t),[n,_]=g.useState(c),i=T(x=>x[t]),d=i==null?void 0:i.currentPageId,u=(i==null?void 0:i.isLoading)??!1,h=n||u;g.useEffect(()=>{if(typeof window>"u")return;const x=new URL(window.location.href),p=x.searchParams.get("sessionId");p&&(mt(p),x.searchParams.delete("sessionId"),window.history.replaceState({},"",x.toString()))},[]);const f=d?he(t,d,"header",((b=i==null?void 0:i.pages[d].page)==null?void 0:b.header)||null,a):null,y=d?he(t,d,"body",((m=i==null?void 0:i.pages[d].page)==null?void 0:m.body)||null,a):null,C=async()=>{try{const x=await Ut(e,t),p=x==null?void 0:x.data,w=p==null?void 0:p.content;(x==null?void 0:x.status)===200?_t(t,e,w,p==null?void 0:p.sessionState,p==null?void 0:p.sessionId):l(!0)}catch(x){console.error("[not-page]: API call failed",x),l(!0)}finally{_(!1)}};return g.useEffect(()=>{e!=null&&e.api&&!s&&t?C():!(e!=null&&e.api)&&s&&t||e!=null&&e.api&&s&&t?_t(t,e,s):(!(e!=null&&e.api)&&!s||!t)&&(l(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const x="avocado-theme-mode-changed",p=w=>{const j=w.detail;N.ThemeStore.setThemeMode(j)};return window.addEventListener(x,p),()=>{window.removeEventListener(x,p)}},[]),r&&console.error("[not-page]: No render page"),o.jsxs(o.Fragment,{children:[h&&o.jsx(N.Loading,{}),f,y,d&&o.jsx(Wn,{userFlow:t,pageId:d}),i&&o.jsx(N.Toaster,{})]})};v.Chart=$t,v.NotFrontPage=ws,v.RenderNotFront=ue,v.Row=se,v.clearSessionId=je,v.extractNotFrontComponents=_e,v.heading=Kt,v.renderNotFront=ks,v.text=Gt,v.useNotFrontFragment=de,v.usePage=fe,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
|
|
13
|
+
*/var ee;function hn(){return ee||(ee=1,(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o=[],a=0;a<arguments.length;a++){var c=arguments[a];if(c){var l=typeof c;if(l==="string"||l==="number")o.push(c);else if(Array.isArray(c)){if(c.length){var s=n.apply(null,c);s&&o.push(s)}}else if(l==="object"){if(c.toString!==Object.prototype.toString&&!c.toString.toString().includes("[native code]")){o.push(c.toString());continue}for(var _ in c)e.call(c,_)&&c[_]&&o.push(_)}}}return o.join(" ")}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(Tt)),Tt.exports}var fn=hn();const Z=qe(fn),F={fieldset:"_fieldset_1xrth_1",fieldsetColumn:"_fieldsetColumn_1xrth_8",legend:"_legend_1xrth_14",options:"_options_1xrth_20",optionsRow:"_optionsRow_1xrth_25",optionsColumn:"_optionsColumn_1xrth_36"},mn=t=>{const{userFlow:e,pageId:n,responseKey:o,label:a,value:c,required:l,actionType:s,dependencies:_,direction:i,items:d}=t,u=i==="column"?"column":"row",{getNextUI:h}=G(),{disabled:f}=L(e,_),m=v(C=>{var E,p;return(p=(E=C[e])==null?void 0:E.entries)==null?void 0:p[o]}),x=m!=null?String(m):c??"",g=f,b=y.useMemo(()=>a?l?`${a} *`:a:null,[a,l]),j=y.useCallback(async C=>{var E;if(!g)try{const p={...(E=v.getState()[e])==null?void 0:E.entries,[o]:C};if(M(e,p),s==="GO_TO_NEXT_UI"||s==="GO_TO_NEXT_UI_WITHOUT_LOADING"){const S=await h(e,n,p,o,s==="GO_TO_NEXT_UI");S!=null&&S.data&&K(e,S==null?void 0:S.data)}}catch(p){alert(JSON.stringify(p))}},[s,h,g,n,o,e]);return r.jsxs("fieldset",{className:Z(F.fieldset,u==="column"&&F.fieldsetColumn),children:[b?r.jsx("legend",{className:F.legend,children:b}):null,r.jsx("div",{className:Z(F.options,u==="column"?F.optionsColumn:F.optionsRow),children:d.map(C=>r.jsx(w.RadioButton,{name:o,value:C.value,checked:x===C.value,disabled:g||C.disabled,labelRight:C.label,onChange:()=>{j(C.value)}},C.value))})]})},gn=({userFlow:t,pageId:e,component:n,hash:o,responseKey:a,items:c,itemActive:l,darkMode:s})=>r.jsx(w.Stepper,{items:c,itemActive:l,darkMode:s}),yn=({userFlow:t,pageId:e,component:n,hash:o,responseKey:a,total:c,done:l,inProgress:s})=>r.jsx(w.ProgressBar,{total:c,done:l,inProgress:s}),ne=(t,e)=>{const{getNextUI:n}=G();return y.useCallback(async({hashCode:o,responseKey:a})=>{var c;try{const l=await n(t,o,{...(c=v.getState()[t])==null?void 0:c.entries},a??e);l!=null&&l.data&&K(t,l.data)}catch(l){alert(JSON.stringify(l))}},[e,n,t])},xn=({userFlow:t,items:e,responseKey:n})=>{const o=ne(t,n),a=y.useMemo(()=>e.map((c,l)=>l===e.length-1?{title:c.title}:c.actionType==="REDIRECT"?{title:c.title,path:c.redirectUrl}:c.actionType==="GO_TO_NEXT_UI"?{title:c.title,path:"#",component:r.jsx("a",{onClick:s=>{s.preventDefault(),o(c)}})}:{title:c.title}),[e,o]);return r.jsx(w.Breadcrumbs,{items:a})};function P(t,e){const{getNextUI:n,fetchDataSource:o,fetchAndGetNextUI:a,runGetDataSource:c}=G();return y.useCallback(async l=>{var f,m;const{responseKey:s,actionType:_,dataSource:i,redirectUrl:d,dependencies:u}=l,h=(f=v.getState()[t])==null?void 0:f.entries;if(!Yt(h,u))try{const x={...(m=v.getState()[t])==null?void 0:m.entries,[s]:{status:200}};switch(M(t,x),_){case"CLOSE_MODAL":jt(t,!1);break;case"CLOSE_DRAWER":rt(t,!1);break;case"OPEN_DRAWER":rt(t,!0);break;case"GO_TO_NEXT_UI":{const g=await n(t,e,x,s);g!=null&&g.data&&K(t,g==null?void 0:g.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const g=await a(t,e,x,s,i);g!=null&&g.data&&K(t,g==null?void 0:g.data);break}case"FETCH_DATA_SOURCE":{const g=await o(i,t,!1);M(t,{[s]:{status:g==null?void 0:g.status,content:g==null?void 0:g.data}});break}case"GET_DATA_SOURCE":{await c(t,e,s,x);break}case"REDIRECT":d?window.location.href=d:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${_}`)}}catch(x){alert(JSON.stringify(x))}},[a,o,n,e,c,t])}const pn=t=>{const{userFlow:e,pageId:n,responseKey:o,actionType:a,label:c,content:l,dataSource:s,redirectUrl:_,dependencies:i,onClick:d,...u}=t,h=P(e,n),{disabled:f}=L(e,i),m={...u,children:l??c},x=(m==null?void 0:m.disabled)??f,[g,b]=y.useState(!1),j=y.useRef(!1),C=y.useCallback(async()=>{if(j.current)return;const E=a==="FETCH_DATA_SOURCE";E&&(j.current=!0,b(!0));try{await h({responseKey:o,actionType:a,dataSource:s,redirectUrl:_,dependencies:i})}catch(p){console.error("[ButtonNotFront] Action failed:",p)}finally{E&&(j.current=!1,b(!1))}},[a,s,i,_,o,h]);return r.jsx(w.Button,{...m,loading:m.loading||g,disabled:x,onClick:()=>!x&&!g&&(d??C)()})},vt={slotStack:"_slotStack_12u4t_5"},bn=t=>{const{userFlow:e,pageId:n,component:o,hash:a,responseKey:c,dependencies:l,content:s,actionContent:_,...i}=t,{disabled:d}=L(e,l),u=O(e,n,s&&s.length>0?s:null),h=O(e,n,_&&_.length>0?_:null),f=u&&u.length>0?r.jsx("div",{className:vt.slotStack,children:u.map((g,b)=>r.jsx(y.Fragment,{children:g},`card-accordion-body-${a}-${b}`))}):void 0,m=h&&h.length>0?r.jsx("div",{className:vt.slotStack,children:h.map((g,b)=>r.jsx(y.Fragment,{children:g},`card-accordion-actions-${a}-${b}`))}):void 0,x=i.disabled||d;return r.jsx(w.CardAccordion,{...i,disabled:x,actionContent:m,children:f??null})},se={cardNotFront:"_cardNotFront_2xt48_1",slotStack:"_slotStack_2xt48_5"},Cn=t=>{const{userFlow:e,pageId:n,component:o,hash:a,responseKey:c,content:l,colorId:s,disabled:_,actionType:i,dataSource:d,redirectUrl:u,dependencies:h}=t,{getNextUI:f,fetchDataSource:m,fetchAndGetNextUI:x,runGetDataSource:g}=G(),{disabled:b}=L(e,h),j=_??b,C=O(e,n,l&&l.length>0?l:null),E=C&&C.length>0?r.jsx("div",{className:se.slotStack,children:C.map((N,k)=>r.jsx(y.Fragment,{children:N},`card-body-${a}-${k}`))}):null,p=y.useCallback(async()=>{var N;if(!(!i||j))try{const k={...(N=v.getState()[e])==null?void 0:N.entries,[c]:{status:200}};switch(M(e,k),i){case"CLOSE_MODAL":jt(e,!1);break;case"CLOSE_DRAWER":rt(e,!1);break;case"OPEN_DRAWER":rt(e,!0);break;case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const H=await f(e,n,k,c,i==="GO_TO_NEXT_UI");H!=null&&H.data&&K(e,H==null?void 0:H.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const S=await x(e,n,k,c,d);S!=null&&S.data&&K(e,S==null?void 0:S.data);break}case"GET_DATA_SOURCE":{await g(e,n,c,k);break}case"REDIRECT":u&&(window.location.href=u);break;default:console.warn(`Unhandled card actionType: ${i}`)}}catch(k){alert(JSON.stringify(k))}},[i,d,j,x,m,f,n,u,c,g,e]);return r.jsx(w.Card,{className:se.cardNotFront,colorId:s,disabled:j,onClick:i&&!j?()=>void p():void 0,children:E})},jn=t=>{const{userFlow:e,pageId:n,component:o,hash:a,responseKey:c,content:l,description:s,..._}=t,i=Array.isArray(l),d=O(e,n,i&&l.length>0?l:null);let u;return d&&d.length>0?u=r.jsxs("div",{className:vt.slotStack,children:[s?r.jsx(w.Text,{type:"sm",children:s}):null,d.map((h,f)=>r.jsx(y.Fragment,{children:h},`card-notification-body-${a}-${f}`))]}):u=(typeof l=="string"?l:void 0)??s,r.jsx(w.CardNotification,{..._,children:u})},At=t=>Array.isArray(t)?t:typeof t=="object"?JSON.stringify(t):t,wn=(t,e)=>{if(!e||t==null)return null;const{extractionJsonPath:n,injectionJsonPath:o}=e,a=B.value(t,n);if(a==null)return null;try{const c={};return B.value(c,o,a),c}catch(c){return console.warn("[buildCursorPayload] invalid injectionJsonPath:",o,c),null}},oe=(t,e,n,o)=>{const a=B.query(t,e),c=a==null?void 0:a.map(d=>{var u,h;if(n){const f={};for(const[m,x]of Object.entries(n))if(typeof x=="object"&&"path"in x){const g=x,b=(u=B.query(d,g.path))==null?void 0:u[0];g.translations&&String(b)in g.translations?f[m]=At(g.translations[String(b)]):f[m]=At(b)}else{const g=x;f[m]=At((h=B.query(d,g))==null?void 0:h[0])}return f}else return d}),l=B.value(t,(o==null?void 0:o.size)??"$.meta.size")??a.length,s=B.value(t,(o==null?void 0:o.total)??"$.meta.total")??0,_=o!=null&&o.hasMore?!!B.value(t,o.hasMore):void 0,i={size:l,total:s,totalPages:o!=null&&o.totalPages?B.value(t,(o==null?void 0:o.totalPages)??"$.meta.totalPages"):l>0?Math.ceil(s/l):0,..._!==void 0?{hasMore:_}:{}};return{items:c,pagination:i}},$=({width:t,height:e,layout:n,data:o,Chart:a,children:c})=>{const l=e??et,s=n?{layout:n}:{};return t?r.jsx(a,{width:t,height:l,data:o,...s,children:c}):r.jsx(T.ResponsiveContainer,{width:"100%",height:l,children:r.jsx(a,{data:o,...s,children:c})})},z=({withPadding:t=!1})=>{const e=n=>r.jsx("span",{style:{color:R.labelColor},children:n});return r.jsx(T.Legend,{formatter:e,wrapperStyle:{fontSize:R.fontSize,fontFamily:R.fontFamily,padding:t?"1rem 0":"0"}})},Nn=({active:t,payload:e,label:n,tooltipKey:o,tooltipCoverage:a})=>{var d,u;if(!t||!e||!e.length)return null;const c={backgroundColor:R.tooltipBg,borderRadius:R.tooltipBorderRadius,color:R.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(o){const h=(d=e[0])==null?void 0:d.payload;if(h&&h[o]!==void 0&&h[o]!==null)return r.jsx("div",{style:c,children:r.jsx("p",{style:{margin:0},children:h[o]})})}const l=(u=e[0])==null?void 0:u.payload,s=(a==null?void 0:a.label)??"Cobertura",_=a?l==null?void 0:l[a.denominatorKey]:void 0,i=a&&_!==void 0&&_!==null&&_>0;return r.jsxs("div",{style:c,children:[r.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:n}),e.map((h,f)=>r.jsx("p",{style:{margin:"2px 0",color:h.color},children:`${h.name}: ${h.value}`},f)),i&&r.jsx("p",{style:{margin:"2px 0"},children:`${s}: ${Math.round(l[a.numeratorKey]/_*100)}%`})]})},V=({tooltipKey:t,tooltipCoverage:e,defaultIndex:n,hideContent:o=!1}={})=>r.jsx(T.Tooltip,{defaultIndex:n,cursor:o?!1:void 0,content:o?()=>null:a=>r.jsx(Nn,{...a,tooltipKey:t,tooltipCoverage:e})}),tt=({dataKey:t,hide:e=!1,type:n})=>r.jsx(T.XAxis,{...t?{dataKey:t}:{},...n?{type:n}:{},hide:e,tick:{fill:R.labelColor,fontSize:R.fontSize}}),J=({type:t,dataKey:e,width:n,yAxisId:o,orientation:a}={})=>r.jsx(T.YAxis,{...t?{type:t}:{},...e?{dataKey:e}:{},...n!==void 0?{width:n}:{},...o?{yAxisId:o}:{},...a?{orientation:a}:{},tick:{fill:R.labelColor,fontSize:R.fontSize},tickMargin:4}),En=t=>{const{data:e,xKey:n,yKeys:o,tooltipKey:a,width:c}=t;return r.jsxs($,{width:c,data:e,Chart:T.AreaChart,children:[r.jsx(T.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(tt,{dataKey:n}),r.jsx(J,{}),r.jsx(V,{tooltipKey:a}),r.jsx(z,{}),o.map((l,s)=>r.jsx(T.Area,{type:"monotone",dataKey:l,stroke:D[s%D.length],fill:D[s%D.length]},l))]})},kn=t=>{const{data:e,yKeys:n,xKey:o,tooltipKey:a,width:c}=t;return r.jsxs($,{width:c,data:e,Chart:T.BarChart,children:[r.jsx(T.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(tt,{dataKey:o}),r.jsx(J,{}),r.jsx(V,{tooltipKey:a}),r.jsx(z,{}),n.map((l,s)=>r.jsx(T.Bar,{dataKey:l,fill:D[s%D.length]},l))]})};var ae={NODE_ENV:"production"};const Tn=(t,e)=>{if(e!=null&&e.length)return e;const n=[...new Set(t.map(o=>o.yAxisId).filter(o=>!!o))];return n.length===0?[]:n.map((o,a)=>({id:o,orientation:a===1?"right":"left"}))},vn=(t,e)=>{!t.type&&ae.NODE_ENV;const n=t.color??D[e%D.length],o=t.label??t.key,a=t.yAxisId?{yAxisId:t.yAxisId}:{};switch(t.type){case"area":return r.jsx(T.Area,{dataKey:t.key,name:o,type:"monotone",fill:n,stroke:n,fillOpacity:.3,...a},t.key);case"line":return r.jsx(T.Line,{dataKey:t.key,name:o,type:"monotone",stroke:n,strokeWidth:2,dot:!1,...a},t.key);case"bar":return r.jsx(T.Bar,{dataKey:t.key,name:o,fill:n,stackId:t.stackId,barSize:t.barSize,...a},t.key);default:return null}},An=t=>{const{data:e,xKey:n,series:o=[],tooltipKey:a,width:c,showLegend:l=!0,yAxes:s}=t;!o.length&&ae.NODE_ENV;const _=Tn(o,s);return r.jsxs($,{width:c,data:e,Chart:T.ComposedChart,children:[r.jsx(T.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(tt,{dataKey:n}),_.length>0?_.map(i=>r.jsx(J,{yAxisId:i.id,orientation:i.orientation},i.id)):r.jsx(J,{}),r.jsx(V,{tooltipKey:a}),l&&r.jsx(z,{}),o.map((i,d)=>vn(i,d))]})},Sn="55%",On=120,Rn=t=>e=>{const n=Math.PI/180,{cx:o=0,cy:a=0,midAngle:c=0,innerRadius:l=0,outerRadius:s=0,startAngle:_=0,endAngle:i=0,fill:d=D[0],payload:u,percent:h=0,value:f=0}=e,m=Math.sin(-n*c),x=Math.cos(-n*c),g=o+(s+10)*x,b=a+(s+10)*m,j=o+(s+30)*x,C=a+(s+30)*m,E=j+(x>=0?1:-1)*22,p=C,N=x>=0?"start":"end",k=u,S=String((k==null?void 0:k[t])??"");return r.jsxs("g",{children:[r.jsx("text",{x:o,y:a,dy:8,textAnchor:"middle",fill:R.labelColor,fontSize:R.fontSize+2,fontFamily:R.fontFamily,children:S}),r.jsx(T.Sector,{cx:o,cy:a,innerRadius:l,outerRadius:s,startAngle:_,endAngle:i,fill:d}),r.jsx(T.Sector,{cx:o,cy:a,startAngle:_,endAngle:i,innerRadius:s+6,outerRadius:s+10,fill:d}),r.jsx("path",{d:`M${g},${b}L${j},${C}L${E},${p}`,stroke:d,fill:"none"}),r.jsx("circle",{cx:E,cy:p,r:2,fill:d,stroke:"none"}),r.jsx("text",{x:E+(x>=0?1:-1)*12,y:p,textAnchor:N,fill:R.labelColor,fontSize:R.fontSize+2,fontFamily:R.fontFamily,children:f}),r.jsx("text",{x:E+(x>=0?1:-1)*12,y:p,dy:18,textAnchor:N,fill:R.labelColorMuted,fontSize:R.fontSize,fontFamily:R.fontFamily,children:`(${(h*100).toFixed(0)}%)`})]})},Dn=t=>{const{data:e,xKey:n,yKeys:o,tooltipKey:a,innerRadius:c=Sn,outerRadius:l=On,activeShape:s=!0,defaultIndex:_,showLegend:i=!0}=t,d=o[0];return r.jsx(T.ResponsiveContainer,{width:"100%",height:et,children:r.jsxs(T.PieChart,{children:[r.jsx(V,{tooltipKey:s?void 0:a,defaultIndex:_,hideContent:s}),i&&r.jsx(z,{}),r.jsx(T.Pie,{data:e,dataKey:d,nameKey:n,cx:"50%",cy:"50%",innerRadius:c,outerRadius:l,activeShape:s?Rn(n):void 0,children:e.map((u,h)=>r.jsx(T.Cell,{fill:D[h%D.length]},`cell-${h}`))})]})})};function In(t,e,n=re){return t<=0?0:e<=0?t:Math.max(t,e*n)}function Ln(t,e=zn,n){return n!==void 0?n:t<=0?et:Math.max(et,t*e)}function Bn(t,e,n){if(n!==void 0)return n;const o=t.reduce((a,c)=>{const l=String(c[e]??"");return Math.max(a,l.length)},0);return Math.max(Vn,o*Xn)}const Mn=t=>{const{data:e,yKeys:n,xKey:o,tooltipKey:a,minCategoryHeight:c,chartHeight:l,tooltipCoverage:s,showLegend:_=!0,yKeyLabels:i,yAxisWidth:d}=t,u=Ln(e.length,c,l),h=Bn(e,o,d);return r.jsxs($,{height:u,layout:"vertical",data:e,Chart:T.BarChart,children:[r.jsx(T.CartesianGrid,{strokeDasharray:"3 3",horizontal:!1}),r.jsx(tt,{type:"number"}),r.jsx(J,{type:"category",dataKey:o,width:h}),r.jsx(V,{tooltipKey:a,tooltipCoverage:s}),_&&r.jsx(z,{}),n.map((f,m)=>r.jsx(T.Bar,{dataKey:f,name:(i==null?void 0:i[f])??f,fill:D[m%D.length]},f))]})},Hn=t=>{const{data:e,xKey:n,yKeys:o,tooltipKey:a,width:c}=t;return r.jsxs($,{width:c,data:e,Chart:T.LineChart,children:[r.jsx(T.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(tt,{dataKey:n}),r.jsx(J,{}),r.jsx(V,{tooltipKey:a}),r.jsx(z,{}),o.map((l,s)=>r.jsx(T.Line,{type:"monotone",dataKey:l,stroke:D[s%D.length],strokeWidth:2,dot:!1},l))]})};var Kn={NODE_ENV:"production"};const Gn=t=>{const{data:e,xKey:n,series:o=[],tooltipKey:a,width:c}=t;return!o.length&&Kn.NODE_ENV,r.jsxs($,{width:c,data:e,Chart:T.BarChart,children:[r.jsx(T.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(tt,{dataKey:n}),r.jsx(J,{}),r.jsx(V,{tooltipKey:a}),r.jsx(z,{}),o.map((l,s)=>r.jsx(T.Bar,{dataKey:l.key,name:l.label??l.key,stackId:l.stackId,fill:l.color??D[s%D.length]},l.key))]})},Un=t=>{const{data:e,xKey:n,yKeys:o,tooltipKey:a}=t,c=({cx:l,cy:s,midAngle:_,innerRadius:i,outerRadius:d,value:u})=>{const h=Math.PI/180,f=25+i+(d-i),m=l+f*Math.cos(-(_??0)*h),x=s+f*Math.sin(-(_??0)*h);return r.jsx("text",{x:m,y:x,fill:R.labelColor,color:R.labelColor,textAnchor:"middle",dominantBaseline:"central",children:u})};return r.jsx(T.ResponsiveContainer,{width:"100%",height:et,children:r.jsxs(T.PieChart,{children:[r.jsx(V,{tooltipKey:a}),r.jsx(z,{}),r.jsx(T.Pie,{data:e,dataKey:o[0],nameKey:n,label:c,outerRadius:120,children:e.map((l,s)=>r.jsx(T.Cell,{fill:D[s%D.length]},`cell-${s}`))})]})})},et=400,re=56,zn=28,Vn=100,Xn=8,Wn=new Set(["bar","line","area","mixBar","composed"]),Jn={area:En,bar:kn,composed:An,donut:Dn,horizontalBar:Mn,line:Hn,mixBar:Gn,pie:Un},D=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],R={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",labelColorMuted:"var(--color-neutral-50)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},ce={chartScrollViewport:"_chartScrollViewport_sm5hx_1",chartScrollViewport_track:"_chartScrollViewport_track_sm5hx_29"},qn="Scrollable chart area",Yn=({dataLength:t,minCategoryWidth:e,children:n})=>{const o=y.useRef(null),[a,c]=y.useState(0),l=e??re;y.useEffect(()=>{const d=o.current;if(!d)return;const u=()=>{c(d.clientWidth)};u();const h=new ResizeObserver(u);return h.observe(d),()=>h.disconnect()},[]);const s=In(a,t,l),_=a>0&&s>a,i=y.useCallback(d=>{const u=o.current;if(u)switch(d.key){case"ArrowLeft":u.scrollLeft-=l,d.preventDefault();break;case"ArrowRight":u.scrollLeft+=l,d.preventDefault();break;case"Home":u.scrollLeft=0,d.preventDefault();break;case"End":u.scrollLeft=u.scrollWidth-u.clientWidth,d.preventDefault();break}},[l]);return r.jsx("div",{ref:o,className:ce.chartScrollViewport,role:_?"region":void 0,tabIndex:_?0:void 0,"aria-label":_?qn:void 0,onKeyDown:_?i:void 0,children:r.jsx("div",{className:ce.chartScrollViewport_track,style:{width:s,height:et},children:a>0?n(s):null})})},le=t=>{const{component:e,userFlow:n,hash:o,responseKey:a,dataSource:c,...l}=t,s=Jn[l.type],{fetchDataSource:_}=G(),[i,d]=y.useState(!1),[u,h]=y.useState([]),f=async()=>{var g,b;try{d(!0);const{jsonPathData:j,mapperData:C}=c,E=kt(c,1),p=await _(E,n,!1),N=j?(g=oe(p==null?void 0:p.data,j,C))==null?void 0:g.items:(b=p==null?void 0:p.data)==null?void 0:b.data;h(N),d(!1)}catch(j){alert(JSON.stringify(j)),d(!1)}};if(y.useEffect(()=>{s&&(c?f():h(l.data))},[]),!s)return r.jsx("div",{children:"Not supported chart type"});const m={...l,data:u};return i?r.jsx(w.SkeletonBase,{height:400}):u.length===0?r.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):Wn.has(l.type)?r.jsx(Yn,{dataLength:u.length,minCategoryWidth:l.minCategoryWidth,children:g=>r.jsx(s,{...m,width:g})}):r.jsx(s,{...m})},Qn=t=>{const{userFlow:e,pageId:n,responseKey:o,actionType:a,label:c,value:l,required:s,dependencies:_,...i}=t,d={...i},{getNextUI:u}=G(),[h,f]=y.useState(l||!1),{disabled:m}=L(e,_),x=y.useMemo(()=>s&&c?`${c} *`:c??"",[c,s]),g=y.useCallback(async()=>{var j;try{const C=!h;f(C);const E={...(j=v.getState()[e])==null?void 0:j.entries,[o]:C};switch(M(e,E),a){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const N=await u(e,n,E,o,a==="GO_TO_NEXT_UI");N!=null&&N.data&&K(e,N==null?void 0:N.data);break}default:break}}catch(C){console.error("Error in checkbox action:",C),alert(JSON.stringify(C))}},[e,n,o,a,h]),b=(d==null?void 0:d.disabled)??m;return r.jsx(w.Checkbox,{...d,labelRight:x,checked:h,disabled:b,onChange:()=>{!b&&g()}})},nt={codeEditor:"_codeEditor_1wi2p_1",codeEditor_label:"_codeEditor_label_1wi2p_4",codeEditor_wrapper:"_codeEditor_wrapper_1wi2p_13",input:"_input_1wi2p_17",preview:"_preview_1wi2p_18",preview_inner:"_preview_inner_1wi2p_33"},Zn=t=>{const{userFlow:e,responseKey:n,label:o,language:a,placeholder:c,value:l,required:s,dependencies:_,disabled:i,showPreview:d,height:u="400px"}=t,[h,f]=y.useState(l??""),m=w.ThemeStore.useThemeStore(E=>E.theme.mode),{disabled:x}=L(e,_),g=i??x,b={json:Ht.json(),markdown:Be.markdown(),sql:Me.sql(),yaml:He.yaml()},j=y.useMemo(()=>s&&o?`${o} *`:o??"",[o,s]),C=E=>{f(E);const p={[n]:E};M(e,p)};return r.jsxs("div",{className:nt.codeEditor,children:[j&&j!==""&&r.jsx("label",{className:nt.codeEditor_label,children:j}),r.jsxs("div",{className:nt.codeEditor_wrapper,children:[r.jsx(Le,{className:nt.input,value:h,height:u,placeholder:c,extensions:[b[a]??Ht.json()],onChange:E=>C(E),theme:m,editable:!g}),a==="markdown"&&d&&r.jsx("div",{className:nt.preview,style:{height:u},children:r.jsx(w.PreviewerMarkdown,{className:nt.preview_inner,children:h})})]})]})},Fn={slotStack:"_slotStack_6n2wy_5"};var Pn={NODE_ENV:"production"};const $n=new Set(["accordion","button","cardAccordion","checkbox","dropdownButton","link","menu","radioGroup","roundButton","select","stepper","switch","table","tabs","textField","textarea"]),St=(t,e)=>{if(t!=null&&t.length)return r.jsx("div",{className:Fn.slotStack,children:t.map((n,o)=>{var a;return r.jsx(y.Fragment,{children:n},((a=e==null?void 0:e[o])==null?void 0:a.hash)??o)})})},ts=({userFlow:t,pageId:e,component:n,hash:o,responseKey:a,content:c,topContent:l,icon:s,headerStatusColor:_,...i})=>{const d=_?`palette_${_}_50`:void 0,u=O(t,e,c!=null&&c.length?c:null),h=O(t,e,l!=null&&l.length?l:null);return r.jsx(w.DataCard,{...i,icon:s,headerStatusColor:d,topContent:St(h,l),children:St(u,c)})},es=({userFlow:t,pageId:e,responseKey:n,actionType:o,dataSource:a,redirectUrl:c,dependencies:l,content:s,icon:_,ariaLabel:i,description:d,descriptionBottom:u,disabled:h,status:f,headerStyle:m,showBorder:x,borderColor:g,title:b,descriptionTop:j,pillLabel:C})=>{const E=O(t,e,s!=null&&s.length?s:null),p=P(t,e),{disabled:N}=L(t,l),k=o?()=>void p({responseKey:n,actionType:o,dataSource:a,redirectUrl:c,dependencies:l}):void 0,S=h??N;k&&(s!=null&&s.some(q=>$n.has(q.component)))&&Pn.NODE_ENV;const H=k?{onClick:k,disabled:S}:{};return r.jsx(w.DataCard,{version:"v2",status:f,headerStyle:m,showBorder:x,borderColor:g,title:b,ariaLabel:i,descriptionTop:j,descriptionBottom:u??d,pillLabel:C,icon:_,...H,children:St(E,s)})},ns=t=>t.version==="v2"?r.jsx(es,{...t}):r.jsx(ts,{...t}),ss={dividerNotFront:"_dividerNotFront_tze3j_1"},os=t=>r.jsx(w.Divider,{...t,className:ss.dividerNotFront}),Ot={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},as=({userFlow:t,pageId:e,responseKey:n,header:o,body:a,footer:c,...l})=>{const s=v(g=>{var b;return(b=g[t])==null?void 0:b.isDrawerOpen}),_=v(g=>{var b;return(b=g[t])==null?void 0:b.isLoading}),i=s&&!_,d={...l,isOpen:i,children:null},u=y.useCallback(()=>{Ct(t),rt(t,!1)},[t]),h=Array.isArray(o)?O(t,e,o):o?r.jsx(w.Heading,{type:"h2",children:o}):void 0,f=O(t,e,a),m=c?O(t,e,c):void 0;return r.jsx(w.Drawer,{...d,className:Ot.drawer,isOpen:i,onClose:u,heightGap:50,title:h?r.jsx(r.Fragment,{children:Array.isArray(h)?h.map((g,b)=>r.jsx(y.Fragment,{children:g},`drawer-header-${b}`)):h}):void 0,children:r.jsx("section",{className:Ot.drawerBody,children:f.map((g,b)=>r.jsx(y.Fragment,{children:g},`drawer-body-${b}`))}),footer:m?r.jsx("div",{className:Ot.drawerFooter,children:m.map((g,b)=>r.jsx(y.Fragment,{children:g},`drawer-footer-${b}`))}):void 0})},rs=t=>{const{userFlow:e,pageId:n,component:o,hash:a,responseKey:c,content:l,items:s,disabled:_,variant:i,leftIcon:d,rightIcon:u}=t,h=P(e,n),f=y.useMemo(()=>s.map(m=>({label:m.content??m.label??"",onClick:()=>{h({responseKey:m.responseKey,actionType:m.actionType,dataSource:m.dataSource,redirectUrl:m.redirectUrl,dependencies:m.dependencies})}})),[s,h]);return r.jsx(w.DropdownButton,{disabled:_,variant:i,items:f,children:r.jsxs(y.Fragment,{children:[d?r.jsx(Kt.Icon,{name:d,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,l,u?r.jsx(Kt.Icon,{name:u,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},ie={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},cs=({components:t=[]})=>r.jsx("section",{className:Z(ie.header,"avocado-dark-theme"),children:r.jsx("div",{className:ie.header_content,children:t.map((e,n)=>r.jsx(y.Fragment,{children:e},n))})}),ls=(t,e,n,o,a)=>{const c=ne(t,n),l=P(t,e),s=async(d,u)=>{d.preventDefault(),await c(u)},_=o.map((d,u)=>u===o.length-1||!d.actionType?{title:d.title}:d.actionType==="REDIRECT"?{title:d.title,path:d.redirectUrl}:{title:d.title,path:"#",component:r.jsx("a",{onClick:h=>void s(h,d)})}),i=a.map(d=>({label:d.content??d.label??"",icon:d.leftIcon,onClick:u=>{u.preventDefault(),l(d)}}));return{breadcrumbs:_,menu:i}},de=({userFlow:t,pageId:e,responseKey:n,component:o,hash:a,breadcrumbsItems:c=[],menuItems:l=[],components:s,onResolveComponentProps:_,...i})=>{const{breadcrumbs:d,menu:u}=ls(t,e,n,c,l),h=O(t,e,s??null,_);return r.jsx(w.HeaderNavigation,{...i,breadcrumbsItems:d,menuItems:u,children:h!=null&&h.length?h.map((f,m)=>{var x;return r.jsx(y.Fragment,{children:f},((x=s==null?void 0:s[m])==null?void 0:x.hash)??m)}):void 0})},is=t=>{const{userFlow:e,pageId:n,responseKey:o,actionType:a,content:c,redirectUrl:l,target:s,dependencies:_,component:i,hash:d,...u}=t,{getNextUI:h}=G(),{disabled:f}=L(e,_),m=a&&u?(()=>{const{href:b,target:j,download:C,...E}=u;return E})():u,x=y.useCallback(async()=>{var b;if(a)try{const j={...(b=v.getState()[e])==null?void 0:b.entries,[o]:{status:200}};switch(M(e,j),a){case"GO_TO_NEXT_UI":{const C=await h(e,n,j,o);C!=null&&C.data&&K(e,C==null?void 0:C.data);break}case"REDIRECT":if(!l){console.warn("Missing redirectUrl for REDIRECT actionType");break}s==="_blank"?window.open(l,"_blank","noopener,noreferrer"):window.location.assign(l);break;default:console.warn(`Unhandled actionType for link: ${a}`);break}}catch(j){alert(JSON.stringify(j))}},[a,h,n,l,o,s,e]),g=m.disabled??f;return r.jsx(w.Link,{...m,disabled:g,onClick:a?x:void 0,children:c})},ds=t=>{const{userFlow:e,pageId:n,component:o,hash:a,responseKey:c,items:l,closeOnClick:s,disabled:_,listOrigin:i,size:d,variant:u}=t,h=P(e,n),f=y.useMemo(()=>l.map(m=>({icon:m.leftIcon,label:m.content??m.label??"",onClick:x=>{var g;(g=x==null?void 0:x.preventDefault)==null||g.call(x),h({responseKey:m.responseKey,actionType:m.actionType,dataSource:m.dataSource,redirectUrl:m.redirectUrl,dependencies:m.dependencies})}})),[l,h]);return r.jsx(w.Menu,{items:f,closeOnClick:s,disabled:_,listOrigin:i,size:d,variant:u})},_s={modalContent:"_modalContent_p06ci_1"},us=({userFlow:t,pageId:e,responseKey:n,header:o,body:a,footer:c,headerStatusColor:l,...s})=>{const _=v(b=>{var j;return(j=b[t])==null?void 0:j.isModalOpen}),i=v(b=>{var j;return(j=b[t])==null?void 0:j.isLoading}),d=_&&!i,u={...s},h=(u==null?void 0:u.headerStatusColor)??l,f=y.useCallback(()=>{Ct(t),jt(t,!1)},[t,n]),m=Array.isArray(o)?O(t,e,o):o,x=O(t,e,a),g=O(t,e,c);return r.jsx(w.Modal,{...u,headerStatusColor:h,header:typeof m=="string"?m:r.jsx(r.Fragment,{children:m.map((b,j)=>r.jsx(y.Fragment,{children:b},`modal-header-${j}`))}),children:r.jsx("section",{className:_s.modalContent,children:x.map((b,j)=>r.jsx(y.Fragment,{children:b},`modal-body-${j}`))}),actions:r.jsx(r.Fragment,{children:g.map((b,j)=>r.jsx(y.Fragment,{children:b},`modal-footer-${j}`))}),open:d,onClose:f})},hs=({userFlow:t,pageId:e})=>{var c,l;const n=Ve(t);if(!n)return null;const o=[...(n==null?void 0:n.components)||[],...((c=n==null?void 0:n.header)==null?void 0:c.components)||[],...((l=n==null?void 0:n.body)==null?void 0:l.components)||[]],a=O(t,e,o);return r.jsx(r.Fragment,{children:a==null?void 0:a.map((s,_)=>{const i=`overlay-${_}-${n==null?void 0:n.hash}`;return r.jsx(y.Fragment,{children:s},i)})})},fs=["success","warning","error","info","neutral"],ms={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"}},gs={success:{color:"success-50",textColor:"success-60",iconColor:"success-50"},warning:{color:"warning-50",textColor:"warning-60",iconColor:"warning-50"},error:{color:"error-50",textColor:"error-60",iconColor:"error-50"},info:{color:"primary-50",textColor:"primary-70",iconColor:"primary-70"},neutral:{color:"neutral-30",textColor:"neutral-50",iconColor:"neutral-50"}},ht=(t,e)=>e?gs[t]:ms[t],ys="outlined",_e=t=>typeof t=="string"&&fs.includes(t),xs=(t,e={})=>t!=null&&t.length?t.length===3&&_e(t[1])&&t[2]===ys?[{label:String(t[0]),variant:t[1],outlined:!0}]:t.length===2&&_e(t[1])?[{label:String(t[0]),variant:t[1],...e.outlined?{outlined:!0}:{}}]:t.map(n=>({label:String(n),variant:e.variant??"neutral",...e.outlined?{outlined:!0}:{}})):[],ps=t=>{const{content:e,variant:n="neutral",...o}=t,a=ht(n,o==null?void 0:o.outlined),c={...o,children:e,color:(o==null?void 0:o.color)??a.color,textColor:(o==null?void 0:o.textColor)??a.textColor,iconColor:(o==null?void 0:o.iconColor)??a.iconColor};return r.jsx(w.Pill,{...c})},bs=t=>{const{content:e}=t;return r.jsx(w.PreviewerMarkdown,{children:e})},Cs=t=>{const{userFlow:e,pageId:n,responseKey:o,actionType:a,dataSource:c,dependencies:l,onClick:s,..._}=t,i=P(e,n),{disabled:d}=L(e,l),u={..._},h=(u==null?void 0:u.disabled)??d,[f,m]=y.useState(!1),x=y.useRef(!1),g=y.useCallback(async()=>{if(x.current)return;const b=a==="FETCH_DATA_SOURCE";b&&(x.current=!0,m(!0));try{await i({responseKey:o,actionType:a,dataSource:c,dependencies:l})}catch(j){console.error("[RoundButtonNotFront] Action failed:",j)}finally{b&&(x.current=!1,m(!1))}},[a,c,l,o,i]);return r.jsx(w.RoundButton,{...u,loading:u.loading||f,disabled:h,onClick:()=>!h&&!f&&(s??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"},ue=t=>{const{userFlow:e,pageId:n,columnWidth:o,columns:a,gap:c="md",justifyContent:l="start",alignItems:s="stretch"}=t,_=Array.isArray(a)?a.map((i,d)=>{const u=`col_${d}`,h=`col_${d}`;if(Array.isArray(i))return{gap:"md",justifyContent:"start",alignItems:"start",items:i,hash:u,responseKey:h};const f=i;return{gap:(f==null?void 0:f.gap)??"md",justifyContent:(f==null?void 0:f.justifyContent)??"start",alignItems:(f==null?void 0:f.alignItems)??"start",items:(f==null?void 0:f.items)??[],hash:(f==null?void 0:f.hash)??u,responseKey:(f==null?void 0:f.responseKey)??h}}):[];return _.length===0?null:r.jsx("div",{className:Z(X.row,X[`row__gap-${c}`],X[`row__justify-${l}`],X[`row__align-${s}`]),children:_==null?void 0:_.map((i,d)=>{const u=(o==null?void 0:o[d])||`${100/_.length}%`,h=O(e,n,i.items);return!h||h.length===0?null:r.jsx("div",{className:Z(X.row_column,X[`row_column__gap-${i.gap}`],X[`row_column__justify-${i.justifyContent}`],X[`row_column__align-${i.alignItems}`]),style:{width:u},children:h},i.hash||d)})})};function he({userFlow:t,pageId:e,responseKey:n,actionType:o,getNextUI:a,isMulti:c=!1,debounceMs:l}){const s=y.useRef(null);y.useEffect(()=>()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]);const _=y.useCallback(async d=>{var f;const u={...(f=v.getState()[t])==null?void 0:f.entries};if(d?(u[n]=d,M(t,u)):(delete u[n],Xe(t,n)),o&&(o==="GO_TO_NEXT_UI"||o==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const x=await a(t,e,u,n,o==="GO_TO_NEXT_UI");x!=null&&x.data&&K(t,x.data)}catch(m){console.error("[useSelectChange] Failed to fetch next UI",m)}},[t,e,n,o,a]);return y.useCallback(d=>{if(!c){_(d);return}if(l==null){_(d);return}s.current!==null&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{_(d),s.current=null},l)},[c,l,_])}const js=/\{([^}]+)\}/g,ws=(t,e)=>{var n;return e.includes("{")?e.replace(js,(o,a)=>{var l;const c=(l=B.query(t,a.trim()))==null?void 0:l[0];return c!=null?String(c):""}):(n=B.query(t,e))==null?void 0:n[0]},Ns=(t,e,n,o)=>{const a=B.query(t,e);return(a==null?void 0:a.map(c=>{var _;const l=ws(c,n),s=o?(_=B.query(c,o))==null?void 0:_[0]:c;return{label:l,value:s}}))??[]},Es=(t,e,n,o=10)=>{var s,_;let a,c;if(n){const i=B.value(t,n.size??"$.meta.size")??o,d=B.value(t,n.total??"$.meta.total")??0;a=i,c=d}else{const i=t==null?void 0:t.meta;a=(i==null?void 0:i.size)??((s=i==null?void 0:i.page)==null?void 0:s.size)??o,c=(i==null?void 0:i.total)??((_=i==null?void 0:i.page)==null?void 0:_.total)??0}const l=c>0?Math.ceil(c/a)>e:!1;return{pageSize:a,total:c,hasMore:l}},fe={selectNotFront:"_selectNotFront_ch3v5_1"},ks=({userFlow:t,pageId:e,responseKey:n,required:o,dataSource:a,actionType:c,dependencies:l,debounceMs:s,..._})=>{const i={..._},{getNextUI:d,fetchDataSource:u}=G(),[h,f]=y.useState((i==null?void 0:i.value)??""),{disabled:m}=L(t,l),x=(i==null?void 0:i.disabled)??m,g=y.useMemo(()=>o&&(i!=null&&i.label)?`${i==null?void 0:i.label} *`:(i==null?void 0:i.label)??"",[i==null?void 0:i.label,o]),b=y.useMemo(()=>{const p=i!=null&&i.isMulti?h:[h],N={};return Array.isArray(p)&&p.forEach(k=>{if(!k)return;const S=JSON.stringify(k.value),H=JSON.stringify(k.label);N[S]=k,H in N||(N[H]=k)}),N},[h]),j=he({userFlow:t,pageId:e,responseKey:n,actionType:c,getNextUI:d,isMulti:i==null?void 0:i.isMulti,debounceMs:s}),C=p=>{f(p),j(p)},E=async(p,N,{page:k})=>{const{jsonPathLabel:S,jsonPathOptions:H,jsonPathValue:q,jsonPathPagination:ft}=a,st=kt(a,k,p),it=await u(st,t,!1),W=it==null?void 0:it.data,mt=W?Ns(W,H,S,q):[],{hasMore:Dt}=Es(W,k,ft);return{options:mt,hasMore:Dt,additional:{page:k+1}}};return r.jsx(w.SelectPagination,{...i,className:fe.selectNotFront,label:g,value:h,disabled:x,noOptionsMessage:()=>r.jsx(r.Fragment,{children:"Sin opciones"}),onChange:p=>!x&&C(p),loadOptions:E,additional:{page:1},isOptionDisabled:p=>{const N=JSON.stringify(p==null?void 0:p.value),k=JSON.stringify(p==null?void 0:p.label);return!!(b!=null&&b[N])||!!(b!=null&&b[k])},debounceTimeout:350})},Ts=({userFlow:t,pageId:e,responseKey:n,dataSource:o,required:a,actionType:c,dependencies:l,debounceMs:s,..._})=>{const i={..._},{getNextUI:d}=G(),[u,h]=y.useState(i.value||""),{disabled:f}=L(t,l),m=(i==null?void 0:i.disabled)??f,x=y.useMemo(()=>a&&(i!=null&&i.label)?`${i==null?void 0:i.label} *`:(i==null?void 0:i.label)??"",[i==null?void 0:i.label,a]),g=he({userFlow:t,pageId:e,responseKey:n,actionType:c,getNextUI:d,isMulti:i==null?void 0:i.isMulti,debounceMs:s}),b=j=>{h(j),g(j)};return r.jsx(w.Select,{...i,className:fe.selectNotFront,label:x,value:u,disabled:m,onChange:j=>!m&&b(j)})},vs=t=>{const{dataSource:e}=t;return e?r.jsx(ks,{...t}):r.jsx(Ts,{...t})},me={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},As=t=>{const{size:e}=t,n=Z(me.spacing,me[`spacing__${e}`]);return r.jsx("div",{className:n})},Ss=t=>{const{userFlow:e,pageId:n,responseKey:o,actionType:a,label:c,value:l,required:s,dependencies:_,...i}=t,d={...i},{getNextUI:u}=G(),[h,f]=y.useState(l||!1),{disabled:m}=L(e,_),x=(d==null?void 0:d.disabled)??m,g=y.useMemo(()=>s&&c?`${c} *`:c??"",[c,s]),b=y.useCallback(async()=>{var j;try{const C=!h;f(C);const E={...(j=v.getState()[e])==null?void 0:j.entries,[o]:C};switch(M(e,E),a){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const N=await u(e,n,E,o,a==="GO_TO_NEXT_UI");N!=null&&N.data&&K(e,N==null?void 0:N.data);break}default:break}}catch(C){console.error("Error in switch action:",C),alert(JSON.stringify(C))}},[e,n,o,a,h]);return r.jsx(w.Switch,{...d,label:g,checked:h,disabled:x,onChange:()=>!x&&b()})},Os=10,Rs=[10,20,50,100],Ds=72,Is=120,Ls=(t,e)=>t!=null&&e.includes(t)?t:e[0]??Os,Bs=({maxHeight:t,stickyHeader:e,autoFitToViewport:n,availableHeight:o})=>t!=null?{maxHeight:t,stickyHeader:e??!1}:!n||o==null?{maxHeight:void 0,stickyHeader:e??!1}:{maxHeight:o,stickyHeader:e??!0},Ms=({viewportHeight:t,elementTop:e,pagerReservedHeight:n=Ds,minTableHeight:o=Is})=>{const a=t-Math.max(e,0)-n;return Math.max(a,o)},Hs=({enabled:t})=>{const[e,n]=y.useState(null),[o,a]=y.useState();return y.useLayoutEffect(()=>{if(!t||!e){a(void 0);return}const c=()=>{const s=e.getBoundingClientRect().top;a(Ms({viewportHeight:window.innerHeight,elementTop:s}))};c(),window.addEventListener("resize",c);const l=typeof ResizeObserver<"u"?new ResizeObserver(c):null;return l==null||l.observe(e),()=>{window.removeEventListener("resize",c),l==null||l.disconnect()}},[t,e]),{tableContainerRef:n,availableHeight:o}},Rt={table_scrollContainer:"_table_scrollContainer_1g2ed_1",tableSkeleton:"_tableSkeleton_1g2ed_5",tableArrayPills:"_tableArrayPills_1g2ed_11"},Ks=(t,e)=>{if(t)return ht(t,!0);if(e)return ht("neutral",!0)},Gs=({values:t,pillVariant:e,pillOutlined:n})=>{const a=xs(t??[],{variant:e,outlined:n}),c=a.slice(0,4),l=a.length-4,s=Ks(e,n);return r.jsxs("div",{className:Rt.tableArrayPills,children:[c.map((_,i)=>{const d=ht(_.variant,_.outlined);return r.jsx(w.Pill,{color:d.color,textColor:d.textColor,iconColor:d.iconColor,outlined:_.outlined,children:_.label},`${_.label}-${_.variant}-${_.outlined??!1}-${i}`)}),l>0&&r.jsxs(w.Pill,{outlined:!0,color:s==null?void 0:s.color,textColor:s==null?void 0:s.textColor,iconColor:s==null?void 0:s.iconColor,children:["+",l]})]})},Us=({userFlow:t,pageId:e,tableResponseKey:n,component:o,rowData:a})=>{const{getNextUI:c,fetchAndGetNextUI:l,runGetDataSource:s}=G(),_=O(t,e,[{...o}]),i=(_==null?void 0:_[0])||null;if(!i)return null;const{actionType:d,responseKey:u,dataSource:h}=i.props,f=y.useCallback(async()=>{var m;try{const x={...(m=v.getState()[t])==null?void 0:m.entries,[u]:{status:200},[n]:[{...a}]};switch(M(t,x),d){case"GO_TO_NEXT_UI":{const g=await c(t,e,x,u);g!=null&&g.data&&K(t,g==null?void 0:g.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const g=await l(t,e,x,u,h);g!=null&&g.data&&K(t,g==null?void 0:g.data);break}case"GET_DATA_SOURCE":{await s(t,e,u,x);break}default:console.warn(`Unhandled actionType: ${d}`);break}}catch(x){alert(JSON.stringify(x))}},[d,h,e,u,s,n,t,c,l,a]);return y.cloneElement(i,{onClick:f})},zs=()=>r.jsx("div",{className:Rt.tableSkeleton,children:[...Array(10)].map((t,e)=>r.jsx(w.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),Vs=(t,e)=>!(e!=null&&e.length)||!t?t:t.map(n=>e.some(a=>{const c=a;return Array.isArray(n!=null&&n.accessor?c[n.accessor]:void 0)})?{...n,renderCell:a=>{const c=n.accessor?a[n.accessor]:void 0;return Array.isArray(c)?r.jsx(Gs,{values:c,pillVariant:n.pillVariant,pillOutlined:n.pillOutlined}):c??""}}:n),Xs=({userFlow:t,pageId:e,responseKey:n,component:o,dataSource:a,rightActions:c,data:l,pageSize:s,showRowsPerPage:_=!1,pageSizeOptions:i,labelRowsPerPage:d,autoHeight:u,...h})=>{var ve,Ae;const{fetchDataSource:f}=G(),[m,x]=y.useState(!1),[g,b]=y.useState(1),j=i??Rs,[C,E]=y.useState(()=>Ls(s,j)),[p,N]=y.useState(null),k=!a&&Array.isArray(l),S=!!(a!=null&&a.jsonPathCursorPagination)&&!!((ve=a==null?void 0:a.jsonPathPagination)!=null&&ve.hasMore),H=_&&!S,q=_||s!=null,ft=q?C:void 0,st=y.useRef(new Map([[1,null]])),it=y.useMemo(()=>{if(c!=null&&c.length)return c.map((I,yt)=>({renderContent:Lt=>r.jsx(Us,{userFlow:t,pageId:e,tableResponseKey:n,component:I,rowData:Lt},`tableRowAction${yt}`)}))},[c,t,e,n]),W=async(I,yt)=>{var Se,Oe;if(!a)return;const{mapperData:Lt,jsonPathData:lo,jsonPathPagination:io,jsonPathCursorPagination:dt}=a;if(dt&&I!==1&&!st.current.has(I)){b(1),W(1,yt);return}dt&&I===1&&(st.current=new Map([[1,null]]));try{x(!0);const Bt=dt?st.current.get(I)??null:null,_o=kt(a,I,void 0,Bt,yt),at=await f(_o,t,!1),Re=oe(at==null?void 0:at.data,lo,Lt,io);N(Re);const uo=!!((Se=a==null?void 0:a.jsonPathPagination)!=null&&Se.size),Mt=(Oe=Re.pagination)==null?void 0:Oe.size;if(q&&uo&&Mt!=null&&j.includes(Mt)&&E(Mt),dt){const De=wn(at==null?void 0:at.data,dt);De&&st.current.set(I+1,De)}x(!1)}catch(Bt){console.error("[TableNotFront] fetchData:",Bt),x(!1)}},mt=I=>{b(I),W(I,ft)},Dt=I=>{E(I.value),b(1),W(1,I.value)};y.useEffect(()=>{k||W(1,ft)},[]);const ot=k?l:p==null?void 0:p.items,It=k&&q&&((l==null?void 0:l.length)??0)>C,so=y.useMemo(()=>{if(!It||!l)return ot??[];const I=(g-1)*C;return l.slice(I,I+C)},[It,l,C,g,ot]),oo=y.useMemo(()=>Vs(h.columns,ot),[ot,h.columns]),gt=(u??!0)&&!S,{tableContainerRef:ao,availableHeight:we}=Hs({enabled:gt}),Ne=y.useMemo(()=>Bs({maxHeight:h.maxHeight,stickyHeader:h.stickyHeader,autoFitToViewport:gt,availableHeight:we}),[h.maxHeight,h.stickyHeader,gt,we]),ro={...h,maxHeight:Ne.maxHeight,stickyHeader:Ne.stickyHeader,data:so,columns:oo??[],rightActions:it},Ee=r.jsx(w.Table,{...ro}),ke=gt?r.jsx("div",{ref:ao,className:Rt.table_scrollContainer,children:Ee}):Ee,Te={showRowsPerPage:H,pageSizeOptions:j,labelRowsPerPage:d,onRowsPerPageChange:Dt};if(k)return!ot||ot.length===0?r.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):r.jsxs(r.Fragment,{children:[ke,(It||_)&&l&&r.jsx(w.Pager,{...Te,classname:{global:"row__end"},page:g,size:C,total:l.length,onChange:b})]});const co=!S&&(p==null?void 0:p.pagination)&&(p.pagination.totalPages>1||_);return r.jsx(r.Fragment,{children:m?r.jsx(zs,{}):p&&((Ae=p==null?void 0:p.items)==null?void 0:Ae.length)>0?r.jsxs(r.Fragment,{children:[ke,co&&r.jsx(w.Pager,{...Te,classname:{global:"row__end"},page:g,size:C,totalPages:p.pagination.totalPages,onChange:mt}),S&&(p==null?void 0:p.pagination)&&r.jsx(w.Pager,{variant:"cursor",classname:{global:"row__end"},page:g,hasNextPage:!!p.pagination.hasMore,onChange:mt})]}):r.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},Ws={tabsPanel:"_tabsPanel_kvslb_1"},Js=({userFlow:t,pageId:e,components:n})=>{const o=O(t,e,n);return o!=null&&o.length?r.jsx("section",{className:Ws.tabsPanel,children:o.map((a,c)=>r.jsx(y.Fragment,{children:a},`tabs-panel-${c}`))}):null},qs=({userFlow:t,pageId:e,hash:n,items:o,activeIndex:a,className:c,responseKey:l})=>{const s=o.map((i,d)=>({label:i.label,disabled:i.disabled,children:r.jsx(Js,{userFlow:t,pageId:e,components:i.components},`${n}-tab-${d}`)})),_=i=>{var u;const d={...(u=v.getState()[t])==null?void 0:u.entries,[l]:i};M(t,d)};return r.jsx(w.Tabs,{className:c,activeIndex:a,items:s,onClick:_})},ge=(t,e,n)=>{const o=v(c=>{var l,s;return(s=(l=c[t])==null?void 0:l.entries)==null?void 0:s[e]}),a=y.useCallback(c=>M(t,{[e]:c}),[t,e]);return[o??n,a]},Ys={textareaNotFront:"_textareaNotFront_1wpe5_1"},Qs=t=>{const{userFlow:e,pageId:n,component:o,hash:a,responseKey:c,required:l,dependencies:s,..._}=t,{value:i,...d}=_,[u,h]=ge(e,c,i??""),{disabled:f}=L(e,s),m=(d==null?void 0:d.disabled)??f,x=y.useMemo(()=>l&&(d!=null&&d.label)?`${d.label} *`:(d==null?void 0:d.label)??"",[d==null?void 0:d.label,l]),g=b=>h(b.target.value);return r.jsx(w.Textarea,{...d,className:Ys.textareaNotFront,label:x,value:u,disabled:m,onChange:b=>!m&&g(b)})},Zs={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},Fs=t=>{const{userFlow:e,pageId:n,component:o,hash:a,responseKey:c,required:l,dependencies:s,..._}=t,{value:i,...d}=_,[u,h]=ge(e,c,i??""),{disabled:f}=L(e,s),m=(d==null?void 0:d.disabled)??f,x=y.useMemo(()=>l&&(d!=null&&d.label)?`${d==null?void 0:d.label} *`:(d==null?void 0:d.label)??"",[d==null?void 0:d.label,l]),g=b=>h(b.target.value);return r.jsx(w.TextField,{...d,className:Zs.textFieldNotFront,allowClear:!1,label:x,value:u,disabled:m,onChange:b=>!m&&g(b)})},Ps=({userFlow:t,pageId:e,responseKey:n,variant:o,content:a,actionType:c,redirectUrl:l})=>{const s=y.useCallback(async()=>{Ct(t);try{switch(c){case"AUTOCLOSE_AND_REDIRECT":window.location.href=l;break;default:console.warn(`Unhandled actionType: ${c}`);break}}catch(_){console.error("Error in toast action:",_),alert(JSON.stringify(_))}},[c,e,n,t,l]);return y.useEffect(()=>{({info:w.toast.info,error:w.toast.error,success:w.toast.success,warning:w.toast.warning}[o]||w.toast.info)(a,{autoClose:c?!1:4e3,containerId:t,onClose:s})},[s,t]),null},ye={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},$s=t=>{const{userFlow:e,pageId:n,component:o,hash:a,responseKey:c,content:l,label:s,placement:_,notShowArrow:i,visible:d}=t,u=O(e,n,l!=null&&l.length?l:null),h=u&&u.length>0?r.jsx("div",{className:ye.tooltipNotFront_content,children:u.map((f,m)=>r.jsx(y.Fragment,{children:f},`tooltip-${a}-${m}`))}):null;return r.jsx(w.Tooltip,{className:ye.tooltipNotFront,label:s,placement:_,notShowArrow:i,visible:d,children:h})};function to({sessionName:t,apiConfig:e,onResolveComponentProps:n,children:o}){const a=je(t,e,null,n);return r.jsxs(r.Fragment,{children:[a,o]})}const eo={api:"",headers:{}},xe=({userFlow:t,components:e,hash:n,apiConfig:o})=>{const a=n??`${t}-page`;y.useState(()=>{var _,i;return(i=(_=v.getState()[t])==null?void 0:_.pages)!=null&&i[a]||_t(t,o??eo,{type:"page",hash:a,body:{components:e}}),null});const c=O(t,a,e);return r.jsx(r.Fragment,{children:c})};function pe(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 be=({payload:t,userFlow:e})=>{const n=pe(t.display),o=xe({userFlow:e,hash:t.id,components:n});return r.jsx(r.Fragment,{children:o})},no=be,Ce=(t,e,n,o,a)=>{const c=O(t,e,(o==null?void 0:o.components)||null,a);switch(n){case"body":return r.jsx(_n,{...o,inputs:c||[]},JSON.stringify(o==null?void 0:o.components));case"header":return r.jsx(cs,{...o,components:c||[]},JSON.stringify(o==null?void 0:o.components));default:return null}},je=(t,e,n,o)=>{var E;const[a,c]=y.useState(!1),l=!!(e!=null&&e.api&&!n&&t),[s,_]=y.useState(l),i=v(p=>p[t]),d=i==null?void 0:i.currentPageId,u=(i==null?void 0:i.isLoading)??!1,h=s||u,f=d?(E=i==null?void 0:i.pages[d])==null?void 0:E.page:void 0,m=(f==null?void 0:f.type)==="page"?f.headerNavigation:void 0,x=(f==null?void 0:f.header)??null,g=!!x||!m;y.useEffect(()=>{if(typeof window>"u")return;const p=new URL(window.location.href),N=p.searchParams.get("sessionId");N&&(bt(N),p.searchParams.delete("sessionId"),window.history.replaceState({},"",p.toString()))},[]);const b=Ce(t,d??"","header",x,o),j=Ce(t,d??"","body",(f==null?void 0:f.body)??null,o),C=async()=>{try{const p=await Zt(e,t),N=p==null?void 0:p.data,k=N==null?void 0:N.content;(p==null?void 0:p.status)===200?_t(t,e,k,N==null?void 0:N.sessionState,N==null?void 0:N.sessionId):c(!0)}catch(p){console.error("[not-page]: API call failed",p),c(!0)}finally{_(!1)}};return y.useEffect(()=>{e!=null&&e.api&&!n&&t?C():!(e!=null&&e.api)&&n&&t||e!=null&&e.api&&n&&t?_t(t,e,n):(!(e!=null&&e.api)&&!n||!t)&&(c(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const p="avocado-theme-mode-changed",N=k=>{const S=k.detail;w.ThemeStore.setThemeMode(S)};return window.addEventListener(p,N),()=>{window.removeEventListener(p,N)}},[]),a&&console.error("[not-page]: No render page"),r.jsxs(r.Fragment,{children:[h&&r.jsx(w.Loading,{}),d&&g?b:null,d&&m&&r.jsx(de,{...m,userFlow:t,pageId:d,onResolveComponentProps:o}),d?j:null,d&&r.jsx(hs,{userFlow:t,pageId:d}),i&&r.jsx(w.Toaster,{})]})};A.Chart=le,A.NotFrontPage=to,A.RenderNotFront=be,A.Row=ue,A.clearSessionId=Ge,A.extractNotFrontComponents=pe,A.heading=Jt,A.renderNotFront=no,A.text=qt,A.useNotFrontFragment=xe,A.usePage=je,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._accordion_1ri2t_1{flex-shrink:0}._accordion_1ri2t_1 [class*=cardNotificationNotFront]{max-width:100%}._accordionBody_1ri2t_8{display:flex;flex-direction:column;gap:.75rem}._promptCodeEditor_1d57s_1,._summaryCard_jva4h_1{display:flex}._body_14tsv_1{padding:2rem 2.75rem;width:100%}._body_content_14tsv_5{display:flex;flex-direction:column;gap:.75rem;margin:0 auto;max-width:1440px}._boxNotFront_67q2e_1{min-height:auto}._slotStack_67q2e_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._fieldset_1xrth_1{border:none;margin:0;padding:0;min-width:0}._fieldsetColumn_1xrth_8{display:flex;flex-direction:column;align-items:flex-start}._legend_1xrth_14{padding:0;margin-bottom:.5rem;font-size:inherit}._options_1xrth_20{display:flex;gap:.75rem}._optionsRow_1xrth_25{flex-direction:row;flex-wrap:wrap;align-items:center}._optionsRow_1xrth_25>.container_row{width:auto;flex-wrap:nowrap}._optionsColumn_1xrth_36{flex-direction:column;align-items:flex-start}._slotStack_12u4t_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._cardNotFront_2xt48_1{flex-grow:1}._slotStack_2xt48_5{display:flex;flex-direction:column;gap:.75rem}._chartScrollViewport_sm5hx_1{width:100%;max-width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:var(--color-neutral-30) transparent}._chartScrollViewport_sm5hx_1::-webkit-scrollbar{width:8px;height:8px}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-track{background:transparent;border-radius:.5rem}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-thumb{background:var(--color-neutral-30);border-radius:.5rem}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-corner{background:transparent}._chartScrollViewport_sm5hx_1:focus-visible{outline:2px solid var(--color-info-50);outline-offset:2px}._chartScrollViewport_track_sm5hx_29{min-width:100%}._codeEditor_1wi2p_1:not(:first-child){margin:1rem 0 0}._codeEditor_label_1wi2p_4{color:var(--color-neutral-90);display:block;font-family:Roboto,sans-serif;font-size:.75rem;font-weight:700;line-height:.875rem;margin:0 0 .5rem}._codeEditor_wrapper_1wi2p_13{display:grid;gap:1rem}._codeEditor_wrapper_1wi2p_13 ._input_1wi2p_17,._codeEditor_wrapper_1wi2p_13 ._preview_1wi2p_18{flex:1}._codeEditor_wrapper_1wi2p_13 ._input_1wi2p_17{border-radius:.25rem;border:1px solid var(--color-neutral-30);overflow:hidden}._codeEditor_wrapper_1wi2p_13 ._preview_1wi2p_18{border-radius:.25rem;border:1px solid var(--color-neutral-30);display:flex;flex-direction:column;overflow:hidden}._codeEditor_wrapper_1wi2p_13 ._preview_inner_1wi2p_33{flex:1 1 auto;min-height:0;overflow-y:auto;padding:.75rem}._slotStack_6n2wy_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._dividerNotFront_tze3j_1{margin:1.25rem 0}._drawer_13pxo_1{z-index:9}._drawerBody_13pxo_5{display:flex;flex-direction:column;gap:.75rem}._drawerFooter_13pxo_11{display:flex;gap:.75rem}._header_g1eri_1{padding:1.5rem 2.75rem;background-color:var(--color-gray-80)}._header_content_g1eri_5{display:flex;flex-direction:column;gap:.75rem;margin:0 auto;max-width:1440px}._modalContent_p06ci_1{display:flex;flex-direction:column;gap:.75rem;padding:0 .25rem .5rem 0;width:calc(100% - .25rem)}._row_1bqj4_1{display:flex;width:100%}._row__gap-none_1bqj4_5{gap:0}._row__gap-xxs_1bqj4_8{gap:.25rem}._row__gap-xs_1bqj4_11{gap:.5rem}._row__gap-sm_1bqj4_14{gap:.75rem}._row__gap-md_1bqj4_17{gap:1rem}._row__gap-lg_1bqj4_20{gap:1.25rem}._row__gap-xl_1bqj4_23{gap:1.5rem}._row__gap-xxl_1bqj4_26{gap:2rem}._row__gap-xxxl_1bqj4_29{gap:2.75rem}._row__justify-start_1bqj4_32{justify-content:flex-start}._row__justify-end_1bqj4_35{justify-content:flex-end}._row__justify-center_1bqj4_38{justify-content:center}._row__justify-space-between_1bqj4_41{justify-content:space-between}._row__justify-space-around_1bqj4_44{justify-content:space-around}._row__justify-space-evenly_1bqj4_47{justify-content:space-evenly}._row__align-start_1bqj4_50{align-items:flex-start}._row__align-end_1bqj4_53{align-items:flex-end}._row__align-center_1bqj4_56{align-items:center}._row__align-stretch_1bqj4_59{align-items:stretch}._row__align-baseline_1bqj4_62{align-items:baseline}._row_column_1bqj4_65{display:flex;flex-direction:column;min-height:1px;overflow-wrap:break-word;word-wrap:break-word}._row_column__gap-none_1bqj4_72{gap:0}._row_column__gap-xxs_1bqj4_75{gap:.25rem}._row_column__gap-xs_1bqj4_78{gap:.5rem}._row_column__gap-sm_1bqj4_81{gap:.75rem}._row_column__gap-md_1bqj4_84{gap:1rem}._row_column__gap-lg_1bqj4_87{gap:1.25rem}._row_column__gap-xl_1bqj4_90{gap:1.5rem}._row_column__gap-xxl_1bqj4_93{gap:2rem}._row_column__gap-xxxl_1bqj4_96{gap:2.75rem}._row_column__justify-start_1bqj4_99{justify-content:flex-start}._row_column__justify-end_1bqj4_102{justify-content:flex-end}._row_column__justify-center_1bqj4_105{justify-content:center}._row_column__justify-space-between_1bqj4_108{justify-content:space-between}._row_column__justify-space-around_1bqj4_111{justify-content:space-around}._row_column__justify-space-evenly_1bqj4_114{justify-content:space-evenly}._row_column__align-start_1bqj4_117{align-items:flex-start}._row_column__align-end_1bqj4_120{align-items:flex-end}._row_column__align-center_1bqj4_123{align-items:center}._row_column__align-stretch_1bqj4_126{align-items:stretch}._row_column__align-baseline_1bqj4_129{align-items:baseline}._selectNotFront_ch3v5_1{max-width:364px;width:100%}._spacing_19hqa_1._spacing__xxs_19hqa_1{margin:.25rem 0 0}._spacing_19hqa_1._spacing__xs_19hqa_4{margin:.5rem 0 0}._spacing_19hqa_1._spacing__sm_19hqa_7{margin:.75rem 0 0}._spacing_19hqa_1._spacing__md_19hqa_10{margin:1rem 0 0}._spacing_19hqa_1._spacing__lg_19hqa_13{margin:1.25rem 0 0}._spacing_19hqa_1._spacing__xl_19hqa_16{margin:1.5rem 0 0}._spacing_19hqa_1._spacing__xxl_19hqa_19{margin:2rem 0 0}._spacing_19hqa_1._spacing__xxxl_19hqa_22{margin:2.75rem 0 0}.
|
|
1
|
+
._accordion_1ri2t_1{flex-shrink:0}._accordion_1ri2t_1 [class*=cardNotificationNotFront]{max-width:100%}._accordionBody_1ri2t_8{display:flex;flex-direction:column;gap:.75rem}._promptCodeEditor_1d57s_1,._summaryCard_jva4h_1{display:flex}._body_14tsv_1{padding:2rem 2.75rem;width:100%}._body_content_14tsv_5{display:flex;flex-direction:column;gap:.75rem;margin:0 auto;max-width:1440px}._boxNotFront_67q2e_1{min-height:auto}._slotStack_67q2e_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._fieldset_1xrth_1{border:none;margin:0;padding:0;min-width:0}._fieldsetColumn_1xrth_8{display:flex;flex-direction:column;align-items:flex-start}._legend_1xrth_14{padding:0;margin-bottom:.5rem;font-size:inherit}._options_1xrth_20{display:flex;gap:.75rem}._optionsRow_1xrth_25{flex-direction:row;flex-wrap:wrap;align-items:center}._optionsRow_1xrth_25>.container_row{width:auto;flex-wrap:nowrap}._optionsColumn_1xrth_36{flex-direction:column;align-items:flex-start}._slotStack_12u4t_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._cardNotFront_2xt48_1{flex-grow:1}._slotStack_2xt48_5{display:flex;flex-direction:column;gap:.75rem}._chartScrollViewport_sm5hx_1{width:100%;max-width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:var(--color-neutral-30) transparent}._chartScrollViewport_sm5hx_1::-webkit-scrollbar{width:8px;height:8px}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-track{background:transparent;border-radius:.5rem}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-thumb{background:var(--color-neutral-30);border-radius:.5rem}._chartScrollViewport_sm5hx_1::-webkit-scrollbar-corner{background:transparent}._chartScrollViewport_sm5hx_1:focus-visible{outline:2px solid var(--color-info-50);outline-offset:2px}._chartScrollViewport_track_sm5hx_29{min-width:100%}._codeEditor_1wi2p_1:not(:first-child){margin:1rem 0 0}._codeEditor_label_1wi2p_4{color:var(--color-neutral-90);display:block;font-family:Roboto,sans-serif;font-size:.75rem;font-weight:700;line-height:.875rem;margin:0 0 .5rem}._codeEditor_wrapper_1wi2p_13{display:grid;gap:1rem}._codeEditor_wrapper_1wi2p_13 ._input_1wi2p_17,._codeEditor_wrapper_1wi2p_13 ._preview_1wi2p_18{flex:1}._codeEditor_wrapper_1wi2p_13 ._input_1wi2p_17{border-radius:.25rem;border:1px solid var(--color-neutral-30);overflow:hidden}._codeEditor_wrapper_1wi2p_13 ._preview_1wi2p_18{border-radius:.25rem;border:1px solid var(--color-neutral-30);display:flex;flex-direction:column;overflow:hidden}._codeEditor_wrapper_1wi2p_13 ._preview_inner_1wi2p_33{flex:1 1 auto;min-height:0;overflow-y:auto;padding:.75rem}._slotStack_6n2wy_5{display:flex;flex-direction:column;gap:.75rem;width:100%}._dividerNotFront_tze3j_1{margin:1.25rem 0}._drawer_13pxo_1{z-index:9}._drawerBody_13pxo_5{display:flex;flex-direction:column;gap:.75rem}._drawerFooter_13pxo_11{display:flex;gap:.75rem}._header_g1eri_1{padding:1.5rem 2.75rem;background-color:var(--color-gray-80)}._header_content_g1eri_5{display:flex;flex-direction:column;gap:.75rem;margin:0 auto;max-width:1440px}._modalContent_p06ci_1{display:flex;flex-direction:column;gap:.75rem;padding:0 .25rem .5rem 0;width:calc(100% - .25rem)}._row_1bqj4_1{display:flex;width:100%}._row__gap-none_1bqj4_5{gap:0}._row__gap-xxs_1bqj4_8{gap:.25rem}._row__gap-xs_1bqj4_11{gap:.5rem}._row__gap-sm_1bqj4_14{gap:.75rem}._row__gap-md_1bqj4_17{gap:1rem}._row__gap-lg_1bqj4_20{gap:1.25rem}._row__gap-xl_1bqj4_23{gap:1.5rem}._row__gap-xxl_1bqj4_26{gap:2rem}._row__gap-xxxl_1bqj4_29{gap:2.75rem}._row__justify-start_1bqj4_32{justify-content:flex-start}._row__justify-end_1bqj4_35{justify-content:flex-end}._row__justify-center_1bqj4_38{justify-content:center}._row__justify-space-between_1bqj4_41{justify-content:space-between}._row__justify-space-around_1bqj4_44{justify-content:space-around}._row__justify-space-evenly_1bqj4_47{justify-content:space-evenly}._row__align-start_1bqj4_50{align-items:flex-start}._row__align-end_1bqj4_53{align-items:flex-end}._row__align-center_1bqj4_56{align-items:center}._row__align-stretch_1bqj4_59{align-items:stretch}._row__align-baseline_1bqj4_62{align-items:baseline}._row_column_1bqj4_65{display:flex;flex-direction:column;min-height:1px;overflow-wrap:break-word;word-wrap:break-word}._row_column__gap-none_1bqj4_72{gap:0}._row_column__gap-xxs_1bqj4_75{gap:.25rem}._row_column__gap-xs_1bqj4_78{gap:.5rem}._row_column__gap-sm_1bqj4_81{gap:.75rem}._row_column__gap-md_1bqj4_84{gap:1rem}._row_column__gap-lg_1bqj4_87{gap:1.25rem}._row_column__gap-xl_1bqj4_90{gap:1.5rem}._row_column__gap-xxl_1bqj4_93{gap:2rem}._row_column__gap-xxxl_1bqj4_96{gap:2.75rem}._row_column__justify-start_1bqj4_99{justify-content:flex-start}._row_column__justify-end_1bqj4_102{justify-content:flex-end}._row_column__justify-center_1bqj4_105{justify-content:center}._row_column__justify-space-between_1bqj4_108{justify-content:space-between}._row_column__justify-space-around_1bqj4_111{justify-content:space-around}._row_column__justify-space-evenly_1bqj4_114{justify-content:space-evenly}._row_column__align-start_1bqj4_117{align-items:flex-start}._row_column__align-end_1bqj4_120{align-items:flex-end}._row_column__align-center_1bqj4_123{align-items:center}._row_column__align-stretch_1bqj4_126{align-items:stretch}._row_column__align-baseline_1bqj4_129{align-items:baseline}._selectNotFront_ch3v5_1{max-width:364px;width:100%}._spacing_19hqa_1._spacing__xxs_19hqa_1{margin:.25rem 0 0}._spacing_19hqa_1._spacing__xs_19hqa_4{margin:.5rem 0 0}._spacing_19hqa_1._spacing__sm_19hqa_7{margin:.75rem 0 0}._spacing_19hqa_1._spacing__md_19hqa_10{margin:1rem 0 0}._spacing_19hqa_1._spacing__lg_19hqa_13{margin:1.25rem 0 0}._spacing_19hqa_1._spacing__xl_19hqa_16{margin:1.5rem 0 0}._spacing_19hqa_1._spacing__xxl_19hqa_19{margin:2rem 0 0}._spacing_19hqa_1._spacing__xxxl_19hqa_22{margin:2.75rem 0 0}._table_scrollContainer_1g2ed_1{min-height:0}._tableSkeleton_1g2ed_5{display:flex;flex-direction:column;gap:.5rem}._tableArrayPills_1g2ed_11{display:flex;gap:.5rem;flex-wrap:wrap}._tabsPanel_kvslb_1{display:flex;flex-direction:column;gap:.75rem}._textareaNotFront_1wpe5_1{min-width:0;width:100%}._textFieldNotFront_1n8fy_1{max-width:364px;width:100%}._tooltipNotFront_106iw_1{align-self:flex-start;max-width:100%}._tooltipNotFront_content_106iw_5{display:flex;flex-direction:column;gap:.75rem;width:fit-content}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foris/avocado-not-front",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"recharts": "3.1.0",
|
|
57
57
|
"zustand": "4.5.4",
|
|
58
58
|
"@uiw/react-codemirror": "4.23.12",
|
|
59
|
-
"@foris/ai-agent": "2.0.
|
|
60
|
-
"@foris/avocado-core": "1.3.
|
|
59
|
+
"@foris/ai-agent": "2.0.1",
|
|
60
|
+
"@foris/avocado-core": "1.3.3",
|
|
61
61
|
"@foris/avocado-icons": "1.17.0",
|
|
62
|
-
"@foris/avocado-suite": "1.
|
|
62
|
+
"@foris/avocado-suite": "1.10.0",
|
|
63
63
|
"@foris/tsconfig": "0.0.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -78,10 +78,10 @@
|
|
|
78
78
|
"recharts": ">=3.0.0",
|
|
79
79
|
"streamdown": ">=1.6.0",
|
|
80
80
|
"zustand": ">=4.0.0",
|
|
81
|
-
"@foris/ai-agent": "2.0.
|
|
82
|
-
"@foris/avocado-core": "1.3.
|
|
81
|
+
"@foris/ai-agent": "2.0.1",
|
|
82
|
+
"@foris/avocado-core": "1.3.3",
|
|
83
83
|
"@foris/avocado-icons": "1.17.0",
|
|
84
|
-
"@foris/avocado-suite": "1.
|
|
84
|
+
"@foris/avocado-suite": "1.10.0"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build": "tsc && vite build",
|