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