File "AppMetaData-1.0.13-6be54eba.js"

Full Path: /home/vantageo/public_html/cache/cache/cache/.wp-cli/wp-content/plugins/wp-data-access/assets/dist/AppMetaData-1.0.13-6be54eba.js
File size: 5.67 KB
MIME-type: text/x-java
Charset: utf-8

import{r as o,j as e,a0 as $,l as u,a1 as W,a2 as _,a3 as H,a4 as q,a5 as G,a6 as J,a7 as K,a8 as U,a9 as Q,F as N,aa as V,e as R,C as S,A as X,ab as Y}from"./main-1.0.13.js";import{B as A,u as v,a as E,C as Z,T as O,E as I,D as w,k as ee,F as te,R as se,G as ae,v as ne,H as pe,S as L,t as re,A as oe,g as ie,h as le,I as k,J as D,K as ce}from"./main-1.0.13-4cbe632d.js";import{b as ue}from"./ActionsApp-1.0.13-9ce21fa9.js";import de from"./Alert-1.0.13-3cded9f0.js";import{I as F}from"./iconBase-1.0.13-98e06aa9.js";import{M as me}from"./MenuItem-1.0.13-e7719456.js";import{M as xe}from"./Menu-1.0.13-2a06ef00.js";import{a as he}from"./AdminTheme-1.0.13-a1e60de2.js";const fe=({appRootId:t,appId:s,appDbId:r,isVisible:a,fullScreen:x})=>{const[h,p]=o.useState(!1);return o.useEffect(()=>{a&&!h&&p(!0)},[a]),h?e.jsx(A,{className:a?"pp-app-show":"pp-app-hide",sx:{"& .pp-app-container .pp-component header":{margin:0},"& .pp-app-container .pp-component header *":{visibility:"hidden",position:"fixed"}},children:e.jsx(ye,{appId:s,appDbId:r,fullScreen:x,appRootId:t})}):null},ge=t=>{const s=v(r=>$(r,t));return u.debug("appData",s),s},Ae=({appId:t})=>{const s=E(),r=Z(t),a=ge(t);return e.jsx(O,{title:e.jsx(I,{details:r,mode:a==null?void 0:a.mode}),className:"pp-builder-button",children:e.jsx(F,{sx:{color:"inherit",padding:0},onClick:()=>{(a==null?void 0:a.mode)===w.FORM?s(W({appId:t})):s(_({appId:t}))},children:e.jsx(ee,{})})})},je=({appDbId:t,appTitle:s,setActiveApp:r,handleClose:a})=>e.jsx(me,{onClick:()=>{r(t),a()},children:e.jsx("span",{children:s})}),Se=({apps:t,setActiveApp:s})=>{const[r,a]=o.useState(null),x=!!r,h=d=>{a(d.currentTarget),d.stopPropagation()},p=()=>{a(null)};return e.jsxs(A,{sx:{position:"relative"},children:[e.jsx(F,{sx:{color:"inherit",padding:0},onClick:h,children:e.jsx(te,{})}),e.jsxs(xe,{anchorEl:r,disablePortal:!0,open:x,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},sx:{marginTop:"8px","& ul":{padding:"0 !important"},"& ul li":{padding:"12px 18px !important"}},children:[...t.apps.map(d=>e.jsx(je,{appDbId:d,appTitle:t.titles[d],setActiveApp:s,handleClose:p}))]})]})},be=({appId:t})=>{var P;u.debug(t);const s=E(),r=se(),a=ae(),x=o.useRef(null),h=o.useRef(null),p=v(n=>H(n,t));u.debug("apps",p);const d=v(n=>q(n));u.debug("themes",d);const i=o.useMemo(()=>{const n={};return Array.isArray(p.apps)&&p.apps.length>0&&p.apps.map(C=>{n[C]=ne()}),n},[]),b=pe(t),c=o.useMemo(()=>G(J.getState(),t),[]),y=o.useMemo(()=>{var n,C;return((C=(n=c==null?void 0:c.app)==null?void 0:n.app[0])==null?void 0:C.app_title)!==""?c.app.app[0].app_title:"WP Data Access"},[]),[f,M]=o.useState((p==null?void 0:p.apps[0])??0);u.debug(f);const T=he(),[g,B]=o.useState(!1);u.debug("appFullScreen",g);const j=v(n=>K(n));u.debug("appData",j),o.useEffect(()=>{u.debug("setFullScreen",i,g),Object.keys(i).map(n=>{s(U({appId:i[Number(n)],fullScreen:g}))})},[j,g]);const m=((P=j[i[f]])==null?void 0:P.mode)??w.TABLE;u.debug("mode",m);let l={};const z=()=>null;return p===void 0||Object.keys(i).length===0?e.jsx(L,{}):e.jsx(re,{theme:T,children:e.jsxs(A,{className:"pp-apps-container",ref:x,sx:{...g?l:{},"& .pp-app-hide *":{visibility:"hidden",position:"fixed"}},children:[e.jsx(oe,{className:"pp-apps-header",ref:h,position:"relative",sx:{margin:"0 0 5px 0"},children:e.jsxs(ie,{sx:{display:"grid",gridTemplateColumns:"auto auto",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs(A,{sx:{display:"grid",gridTemplateColumns:"auto auto",justifyContent:"space-between",alignItems:"center",gap:"5px","& span":{whiteSpace:"nowrap",fontSize:"18px",lineHeight:"18px",fontWeight:"bold"},"& span.pp-header-title":{minWidth:0,textOverflow:"ellipsis",overflow:"hidden",marginRight:"10px"}},children:[e.jsx("span",{children:e.jsx(Se,{apps:p,setActiveApp:M})}),e.jsxs("span",{className:"pp-header-title",children:[y," - ",p.titles[f]]})]}),e.jsxs(A,{sx:{display:"flex",gap:"10px",justifyContent:"center",alignItems:"center"},children:[Q(c)&&e.jsx(Ae,{appId:i[f]}),z(),(c==null?void 0:c.isExploring)&&e.jsx(O,{title:b.close,children:e.jsx(F,{sx:{color:"inherit",padding:0},onClick:()=>{s(N({isActive:!1,appDbId:0})),a(t),r(t),s(V({})),Object.keys(i).map(n=>{a(i[n]),r(i[n])})},children:e.jsx(le,{})})})]})]})}),...p.apps.map(n=>e.jsx(fe,{appRootId:t,appId:i[n],appDbId:n,isVisible:n===f,fullScreen:g}))]})})},ye=({appId:t,appDbId:s,designMode:r,staticFilter:a,shortcodeArgs:x,fullScreen:h,isExploring:p,appRootId:d})=>{u.debug(t,s,r,a,x,h,p);const i=E(),[b,c]=o.useState(""),[y,f]=o.useState(!1),[M,T]=o.useState(!1),{prepareAppStore:g}=k(t,D.APP),{prepareApp:B}=k(t,D.APP);o.useEffect(()=>{y||j()},[s]);const j=()=>{ue(s,m=>{const l=m==null?void 0:m.data;u.debug("response data",l),l.app&&l.app.app&&Array.isArray(l.app.app)&&l.app.container&&Array.isArray(l.app.container)&&l.app.apps&&Array.isArray(l.app.apps)?l.app.app[0].app_type===X.APPCONTAINER.toString()?(B(l,p),T(!0),f(!0)):g(s,l,r===!0,void 0,d,()=>{})?(i(Y({appId:t,staticFilter:a,shortcodeArgs:x})),f(!0)):c(S.contactSupport):(R(S.contactSupport,{variant:"error"}),c(S.contactSupport))},m=>{u.error("error",m),R(m??S.contactSupport,{variant:"error"}),c(m??S.contactSupport)})};return b!==""?e.jsx(o.Suspense,{children:e.jsx(de,{severity:"error",message:b,close:!0,setClose:()=>{i(N({isActive:!1,appDbId:0}))}})}):y?M?e.jsx(be,{appId:t}):e.jsx(A,{id:"pp-app-"+t,className:"pp-app-container pp-app-"+s,sx:{[`&#pp-app-${t} .pp-column-search-field ul`]:{marginLeft:0,padding:0},[`&#pp-app-${t} .pp-global-search-field input, &#pp-app-${t} .pp-column-search-field input`]:{boxSizing:"content-box"},[`&#pp-app-${t} .pp-form form input`]:{boxSizing:"content-box"}},children:e.jsx(ce,{appId:t})}):e.jsx(A,{sx:{padding:"50px"},children:e.jsx(L,{})})};export{ye as A};