dsql-admin/dsql-app/.local_dist/static/chunks/pages/su/users/[single]-d81189b8f14033f8.js
Benjamin Toby 7a06e83a46 Updates
2024-12-08 20:56:57 +01:00

1 line
19 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3632],{7538:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/su/users/[single]",function(){return s(73271)}])},41301:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var a=s(74848),l=s(62027);function r(e){let{selectOptions:t,name:s,onChangeHandler:r,required:i,setAlert:n,title:c,defaultValue:d,info:o,id:h}=e;try{function u(e){if(e.type.match(/enter/i)&&window.innerWidth<1200)return;let t=e.target.closest(".info-wrapper"),s=t.querySelector(".info-dropdown");if(e.type.match(/leave/i)&&!s.classList.contains("hidden")){s.classList.add("hidden");return}if(!(e.type.match(/leave/i)&&s.classList.contains("hidden"))){if(!t){s.classList.add("hidden");return}if(s.classList.contains("hidden")){s.classList.remove("hidden");return}s.classList.add("hidden")}}return(0,a.jsxs)("div",{className:"form-select-block flex items-start flex-col gap-0.5 w-full relative"+(o?" pr-8":""),children:[c&&(0,a.jsxs)("label",{htmlFor:s,children:[c,i?"":" (optional)"]}),(0,a.jsxs)("div",{className:"flex items-center w-full relative",children:[(0,a.jsx)("select",{name:s,id:h||s,className:"w-full bg-white",required:i,onChange:e=>{n&&n(null),e.target.classList.remove("warning"),r&&r(e)},defaultValue:d||void 0,children:t.map((e,t)=>{let{payload:s,title:l}=e;return(0,a.jsx)("option",{value:s,selected:!!e.default,children:l},t+1)})}),(0,a.jsx)(l.A,{className:"absolute right-2 text-base text-slate-500 pointer-events-none",size:20}),o&&(0,a.jsxs)("div",{className:"info-wrapper absolute -right-10 w-8 h-8 rounded-full bg-white flex items-center justify-center z-10",style:{top:"50%",transform:"translate(0,-50%)"},onMouseEnter:u,onMouseLeave:u,onClick:u,children:[(0,a.jsx)("img",{src:"/images/info-outlined-black.png",alt:"",className:"w-6 h-6 object-contain opacity-60 pointer-events-none"}),(0,a.jsx)("div",{className:"info-dropdown absolute top-9 right-0 bg-white w-52 md:w-96 p-2 sm:p-6 shadow-xl rounded hidden text-center border border-slate-300 border-solid",children:(0,a.jsx)("span",{children:o})}),(0,a.jsx)("div",{className:"absolute -top-2 w-12",style:{height:"45px"}})]})]})]})}catch(e){return console.log("ERROR in FormSelect =>",e),(0,a.jsx)("div",{children:"Form Select Error"})}}s(96540)},99862:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var a=s(74848);s(96540);var l=s(86625);function r(){return(0,a.jsx)("button",{className:"outlined gray p-2 w-9 h-9 flex items-center justify-center rounded-full",onClick:e=>{window.history.back()},children:(0,a.jsx)(l.A,{color:"inherit",className:"opacity-50 text-black",fontSize:"small"})})}},4709:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var a=s(74848),l=s(96540);function r(e){var t,s,r;let{confirmedDelegetedUser:i,linksArray:n,user:c}=e;null==i||i.delegated,null==i||null===(t=i.priviledges)||void 0===t||t.match(/Edit Tables/i),null==i||null===(s=i.priviledges)||void 0===s||s.match(/Delete Tables/i),null==i||null===(r=i.priviledges)||void 0===r||r.match(/Create Tables/i);let[d,o]=l.useState(n||null);return(l.useEffect(()=>{var e;if(n)return;let t=window.location.pathname,s=t.split("/"),a=[];a.push({title:"Home",path:t.match(/admin/)?"/admin":"/"}),null===(e=window.location.search)||void 0===e||e.match(/delegated=true/),s.forEach((e,t,s)=>{!(null==e?void 0:e.match(/./))||1==t||e.match(/^\d+$/)&&c&&!a.find(e=>!!e.title.match(/^entries$|^users$/))||a.push({title:e,path:(()=>{let e="";for(let a=0;a<s.length;a++){let l=s[a];!(a>t)&&l.match(/./)&&(e+="/".concat(l))}return e})()})}),o(a)},[]),d&&d[1])?(0,a.jsx)("div",{className:"text-sm mt-2 flex-wrap",children:d.map((e,t,s)=>t===d.length-1?(0,a.jsx)("a",{href:e.path,className:"text-slate-400 dark:text-slate-500 pointer-events-none",children:e.title},t):(0,a.jsxs)(l.Fragment,{children:[(0,a.jsx)("a",{href:e.path,className:"query-url",children:e.title}),(0,a.jsx)("span",{className:"opacity-20",children:"|"})]},t))}):(0,a.jsx)(l.Fragment,{})}},35681:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var a=s(74848),l=s(96540),r=s(51105),i=s(87220);function n(e){let{content:t,language:s,style:n,showCopy:c}=e,[d,o]=l.useState(!1),h=()=>{o(!0)},u=(e,t)=>{"clickaway"!==t&&o(!1)},m=(0,a.jsx)(l.Fragment,{children:(0,a.jsx)("button",{className:"outlined gray",style:{border:"none",padding:"2px",width:"20px",height:"20px",color:"white"},onClick:u,children:"✖"})}),x={};return(0,a.jsxs)("pre",{className:"language-".concat(s||"javascript"," w-auto overflow-hidden skip-js code-block relative max-w-4xl flex items-center justify-center"),style:n?{...n,...x}:x,children:[(0,a.jsx)("code",{className:"w-auto px-10",style:{wordBreak:"break-all"},children:t}),(0,a.jsx)("button",{className:"outlined copy-code "+(c?"relative show":" absolute right-2 z-20 hover:opacity-50"),style:{padding:"2px",border:"none"},onClick:e=>{navigator.clipboard.writeText(t).then(()=>{h()})},children:(0,a.jsx)(i.A,{className:"text-white",size:20})}),(0,a.jsx)(r.A,{open:d,autoHideDuration:2e3,onClose:u,children:(0,a.jsxs)("div",{className:"h-full text-white px-4 py-2 justify-between rounded",style:{maxWidth:"250px",width:"250px",backgroundColor:"#0b8862"},children:[(0,a.jsx)("span",{children:"Code Copied!"}),m]})})]})}},30861:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var a=s(74848),l=s(96540);function r(e){let{userObject:t,userPage:s}=e,r=Object.keys(t),[i,n]=l.useState(!1),[c,d]=l.useState(0),[o,h]=l.useState(!s);return(0,a.jsxs)("div",{className:"card col green w-full overflow-hidden"+(o?s?" h-[100px]":" h-[85px]":" "),children:[(0,a.jsxs)("div",{className:"items-center w-full",children:[(0,a.jsx)("img",{src:t.image_thumbnail,alt:"",className:"rounded-full object-cover"+(s?" w-16 h-16":" w-12 h-12")}),!s&&(0,a.jsxs)("h3",{className:"m-0 text-xl",children:[t.first_name," ",t.last_name," "]}),(0,a.jsxs)("div",{className:"ml-auto",children:[(0,a.jsx)("button",{className:"outlined gray small-text",onClick:e=>{o?h(!1):h(!0)},children:o?"More Details":"Collapse"}),!s&&(0,a.jsx)("a",{href:"/su/users/".concat(t.id),className:"button outlined gray small-text",children:"View User"})]})]}),(0,a.jsx)("div",{className:"card no-hover col w-full light-gray-bg",children:r.map((e,s)=>(0,a.jsxs)(l.Fragment,{children:[(0,a.jsx)("div",{children:(0,a.jsxs)("span",{style:{wordBreak:"break-all"},children:[e,":"," ",(0,a.jsx)("b",{children:t[e]})]})}),s<r.length-1&&(0,a.jsx)("hr",{})]},s+1))}),(0,a.jsx)("button",{className:"outlined gray small-text w-full",onClick:e=>{h(!0)},children:"Collapse"})]})}},96228:(e,t,s)=>{"use strict";var a=s(24994);t.A=void 0;var l=a(s(44888)),r=s(74848);t.A=(0,l.default)([(0,r.jsx)("path",{d:"M11.17 4H7v11h14V6h-7.83z",opacity:".3"},"0"),(0,r.jsx)("path",{d:"M21 4h-7l-2-2H7c-1.1 0-1.99.9-1.99 2L5 15c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 11H7V4h4.17l2 2H21z"},"1"),(0,r.jsx)("path",{d:"M3 6H1v13c0 1.1.9 2 2 2h17v-2H3z"},"2")],"FolderCopyTwoTone")},92868:(e,t,s)=>{"use strict";var a=s(24994);t.A=void 0;var l=a(s(44888)),r=s(74848);t.A=(0,l.default)([(0,r.jsx)("path",{d:"M13 4H6v16h12V9h-5z",opacity:".3"},"0"),(0,r.jsx)("path",{d:"m20 8-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2zm-2 12H6V4h7v5h5z"},"1")],"InsertDriveFileTwoTone")},25094:(e,t,s)=>{"use strict";var a=s(24994);t.A=void 0;var l=a(s(44888)),r=s(74848);t.A=(0,l.default)((0,r.jsx)("path",{d:"M8.12 9.29 12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7a.9959.9959 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0"}),"KeyboardArrowDownRounded")},31524:(e,t,s)=>{"use strict";var a=s(24994);t.A=void 0;var l=a(s(44888)),r=s(74848);t.A=(0,l.default)([(0,r.jsx)("path",{d:"M15.22 4.75 7.87 7.79l4.96 11.96 7.35-3.05zM11 10c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1",opacity:".3"},"0"),(0,r.jsx)("path",{d:"m3.87 11.18-2.43 5.86c-.41 1.02.08 2.19 1.09 2.61l1.34.56zm18.16 4.77L17.07 3.98c-.31-.75-1.04-1.21-1.81-1.23-.26 0-.53.04-.79.15L7.1 5.95c-.75.31-1.21 1.03-1.23 1.8-.01.27.04.54.15.8l4.96 11.97c.31.76 1.05 1.22 1.83 1.23.26 0 .52-.05.77-.15l7.36-3.05c1.02-.42 1.51-1.59 1.09-2.6m-9.2 3.8L7.87 7.79l7.35-3.04h.01l4.95 11.95z"},"1"),(0,r.jsx)("circle",{cx:"11",cy:"9",r:"1"},"2"),(0,r.jsx)("path",{d:"m9.33 21.75-3.45-8.34v6.34c0 1.1.9 2 2 2z"},"3")],"StyleTwoTone")},87296:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(95737).A)("CloudUpload",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]])},87220:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(95737).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},6831:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(95737).A)("DatabaseBackup",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 12a9 3 0 0 0 5 2.69",key:"1ui2ym"}],["path",{d:"M21 9.3V5",key:"6k6cib"}],["path",{d:"M3 5v14a9 3 0 0 0 6.47 2.88",key:"i62tjy"}],["path",{d:"M12 12v4h4",key:"1bxaet"}],["path",{d:"M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16",key:"1f4ei9"}]])},68622:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(95737).A)("FileWarning",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},97206:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(95737).A)("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]])},14858:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(95737).A)("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]])},2750:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(95737).A)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},42595:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(95737).A)("SquareChevronRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]])},94909:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(95737).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},73271:(e,t,s)=>{"use strict";s.r(t),s.d(t,{__N_SSP:()=>E,default:()=>H});var a=s(74848),l=s(96540),r=s(2016),i=s(30861),n=s(99862),c=s(620),d=s(23698),o=s(31524);function h(e){let{user:t,refresh:s,setRefresh:r}=e,[i,n]=l.useState(!1),[h,u]=l.useState([]);return l.useEffect(()=>{(0,d.A)("/api/admin/getUserBackups",{method:"post",body:{user:t}}).then(e=>{u(e.backups)})},[s]),(0,a.jsxs)("section",{className:"paper",children:[(0,a.jsx)("h2",{className:"text-xl m-0",children:"User Backups"}),!h&&(0,a.jsx)(c.A,{width:"20px",position:"relative"}),h&&!h[0]&&(0,a.jsx)("div",{children:"This user has no backups"}),h&&h[0]&&h.sort((e,t)=>parseInt(e)>parseInt(t)?-1:1).map((e,s)=>{let l=new Date(parseInt(e));return(0,a.jsxs)("a",{href:"/su/users/".concat(t.id,"/").concat(e),className:"card w-full items-center",children:[(0,a.jsx)(o.A,{color:"inherit",className:"opacity-40 text-slate-500"}),(0,a.jsx)("b",{children:"Backup:"}),(0,a.jsx)("span",{children:l.toString()})]},e)})]})}var u=s(35681),m=s(96228),x=s(25094),p=s(92868);function j(e){let{user:t,file:s,activeFile:l,setActiveFile:r}=e;return(0,a.jsxs)("button",{className:"justify-start gap-4"+((null==l?void 0:l.path)==="".concat(s.root,"/").concat(s.name)?" dark":" light-gray"),onClick:e=>{(0,d.A)("/api/admin/grabFile",{method:"post",body:{user:t,type:"file",path:"".concat(s.root,"/").concat(s.name)}}).then(e=>{if(e.success)try{r({title:s.name,path:"".concat(s.root,"/").concat(s.name),data:JSON.stringify(JSON.parse(e.data),null,4)})}catch(t){r({title:s.name,path:"".concat(s.root,"/").concat(s.name),data:e.data})}})},children:[(0,a.jsx)(p.A,{fontSize:"small",className:"text-slate-400"}),s.name]})}function f(e){let{user:t,file:s,activeFile:r,setActiveFile:i}=e,[n,c]=l.useState(null),[d,o]=l.useState(!1);return(0,a.jsxs)("div",{className:"flex-col w-full items-start relative",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(m.A,{fontSize:"small",className:"text-slate-400"}),s.name,(0,a.jsx)(x.A,{className:"ml-auto absolute right-2"})]}),s.content&&(0,a.jsx)("div",{className:"flex-col w-full pl-4 items-start ml-2",style:{borderLeft:"1px solid var(--slate-200)"},children:s.content.map((e,s)=>{var l;return(null==e?void 0:null===(l=e.type)||void 0===l?void 0:l.match(/file/i))?(0,a.jsx)(j,{user:t,file:e,activeFile:r,setActiveFile:i},s):(0,a.jsx)(f,{user:t,file:e,activeFile:r,setActiveFile:i},s)})})]})}function v(e){let{user:t,rootFilesArray:s}=e,[r,i]=l.useState(null);return(0,a.jsxs)("section",{className:"paper",children:[(0,a.jsx)("h3",{className:"text-lg m-0",children:"User Files"}),(0,a.jsxs)("div",{className:"w-full items-start max-w-7xl",children:[(0,a.jsx)("div",{className:"flex-col items-stretch w-[40%]",children:s.map((e,s)=>{var l;return(null==e?void 0:null===(l=e.type)||void 0===l?void 0:l.match(/file/))?(0,a.jsx)(j,{user:t,file:e,activeFile:r,setActiveFile:i},s):(0,a.jsx)(f,{user:t,file:e,activeFile:r,setActiveFile:i},s)})}),(0,a.jsx)("div",{className:"grow flex-col items-start justify-start w-[60%] h-full -mt-4",children:r&&(0,a.jsx)(u.A,{content:r.data||"",language:"javascript"})})]})]})}s(4709);var y=s(3552),g=s(1771),w=s(39990),b=s(40219),k=s(80943),A=s(20044),N=s(77568),S=s(78036),C=s(34544);let F=(0,y.Ay)(b.A)(e=>{let{theme:t}=e;return{["&.".concat(k.A.head)]:{backgroundColor:"var(--slate-800)",color:"white"},["&.".concat(k.A.body)]:{}}});function M(e){let{data:t,user:s}=e;try{let e=Object.keys(t[0]);return(0,a.jsx)(l.Fragment,{children:(0,a.jsx)("div",{className:"p-4 bg-slate-200 rounded-md overflow-hidden w-full max-w-6xl",children:(0,a.jsx)(A.A,{component:C.A,sx:{width:"100%"},children:(0,a.jsxs)(g.A,{sx:{minWidth:650},"aria-label":"simple table",children:[(0,a.jsx)(N.A,{children:(0,a.jsx)(S.A,{children:e&&e[0]&&e.map((e,t)=>(0,a.jsx)(F,{align:"left",children:e},t+1))})}),(0,a.jsx)(w.A,{children:t&&t[0]&&t.map((t,s)=>(0,a.jsx)(S.A,{sx:{"&:last-child td, &:last-child th":{border:0}},children:e.map((e,s)=>(0,a.jsx)(F,{align:"left",children:t[e]},s+1))},s+1))})]})})})})}catch(e){return(0,a.jsx)(l.Fragment,{children:(0,a.jsx)("span",{children:"No results"})})}}var z=s(41301);function _(e){let{user:t,databases:s}=e;try{let e=l.useRef(),i=l.useRef(),n=l.useRef(s[0]),[o,h]=l.useState(!1),[u,m]=l.useState(!1),[x,p]=l.useState(0),[j,f]=l.useState(s[0]);function r(){h(!0);let e=i.current?i.current.getValue():null;if(!(null==e?void 0:e.match(/./)))return;let t=e.replace(/^--.*/gm,"").replace(/\n|\r|\n\r/gm,"").replace(/ {2,}/g," ");(0,d.A)("/api/admin/runUserDbQuery",{method:"post",body:{database:n.current,query:t}},!0).then(e=>{e.success?m(e.result):e.msg&&window.alert(e.msg),setTimeout(()=>{h(!1)},500)})}l.useEffect(()=>{var e;if(!(null===(e=ace)||void 0===e?void 0:e.edit)){setTimeout(()=>{p(e=>e+1)},1e3);return}let t=ace.edit("ace-editor-wrapper");t.setOptions({mode:"ace/mode/mysql",theme:"ace/theme/twilight",value:"SELECT * FROM table_name",placeholder:"Type an SQL query",enableBasicAutocompletion:!0,enableLiveAutocompletion:!0}),t.commands.addCommand({name:"myCommand",bindKey:{win:"Ctrl-Enter",mac:"Command-Enter"},exec:function(e){r()},readOnly:!0}),i.current=t},[x]);let[v,y]=l.useState([]);return l.useEffect(()=>{(0,d.A)("/api/admin/getTablesForUserDatabase?database=".concat(j)).then(e=>{e.success&&y(e.tables)})},[j,x]),(0,a.jsxs)("div",{className:"paper w-full",children:[(0,a.jsx)("h3",{className:"text-lg m-0",children:(0,a.jsx)("span",{children:"Database Shell"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(z.A,{selectOptions:s.map(e=>({payload:e,title:null==e?void 0:e.replace(new RegExp("datasquirel_user_".concat(t.id,"_")),"")})),name:"select-database",onChangeHandler:e=>{f(e.target.value),n.current=e.target.value},title:"Databases"}),j&&v&&(0,a.jsx)(z.A,{selectOptions:v.map(e=>({payload:e,title:e})),name:"select-database-table",title:"Tables"})]}),(0,a.jsxs)("div",{className:"w-full flex-col relative",children:[(0,a.jsx)("div",{ref:e,id:"ace-editor-wrapper",style:{height:"100px"}}),(0,a.jsxs)("button",{className:"absolute right-4 bottom-4"+(o?" pointer-events-none opacity-70":""),onClick:e=>{r()},children:[o&&(0,a.jsx)(c.A,{position:"relative",width:"15px",borderWidth:"3px",style:{backgroundColor:"transparent"}}),o?"Running Query ...":"Run Query"]})]}),u&&!o&&(0,a.jsx)(M,{data:u,user:t})]})}catch(e){return console.log(e),(0,a.jsx)(l.Fragment,{children:(0,a.jsx)("section",{className:"card",children:(0,a.jsx)("h2",{className:"text-xl m-0",children:"Shell not available at this time"})})})}}function L(e){let{user:t,refresh:s,setRefresh:r}=e,[i,n]=l.useState(!1),[c,o]=l.useState(null),[h,u]=l.useState(null);return l.useEffect(()=>{(0,d.A)("/api/admin/getUserData",{method:"post",body:{user:t}}).then(e=>{console.log(e),e.success&&(o(e.data),u(e.databases))})},[s]),(0,a.jsxs)("div",{className:"paper w-full",children:[(0,a.jsx)("h2",{className:"text-xl m-0",children:"User Data"}),c&&(0,a.jsx)(v,{user:t,rootFilesArray:c}),h&&(0,a.jsx)(_,{user:t,databases:h})]})}function T(e){let{data:t}=e,s=t.user,[r,o]=l.useState(0),[u,m]=l.useState(!1);return(0,a.jsxs)(l.Fragment,{children:[(0,a.jsxs)("div",{className:"w-full justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(n.A,{}),(0,a.jsxs)("h1",{className:"text-3xl m-0",children:[s.first_name," ",s.last_name]}),(0,a.jsx)("span",{className:"info w-auto gray font-normal",children:s.email})]}),(0,a.jsx)("div",{children:(0,a.jsxs)("button",{onClick:e=>{window.confirm("Create a new backup for ".concat(s.first_name,"?"))&&(m(!0),(0,d.A)("/api/admin/addUserBackup",{method:"post",body:{user:s}}).then(e=>{console.log(e),e.success&&o(e=>e+1),setTimeout(()=>{m(!1)},1e3)}))},className:"relative",children:[u&&(0,a.jsx)(c.A,{width:"20px"}),"Backup User"]})})]}),(0,a.jsx)(i.A,{userObject:s,userPage:!0}),(0,a.jsx)(h,{user:s,refresh:r,setRefresh:o}),(0,a.jsx)(L,{user:s,refresh:r,setRefresh:o})]})}var E=!0;function H(e){let{user:t,data:s}=e,i=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,a.jsx)("meta",{name:"description",content:"Welcome to your data app"}),(0,a.jsxs)(l.Fragment,{children:[(0,a.jsx)("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ace.min.js",integrity:"sha512-q6CTB0jS+VuJnSct82rVcWlI06LGzNjaG3CWenHWVUncRvc4UQMFkA3a5Ip880xr+lBx38FcHDclOxPdSg+sBw==",crossOrigin:"anonymous",referrerPolicy:"no-referrer"}),(0,a.jsx)("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ext-language_tools.min.js",integrity:"sha512-6g6cvocV7eT/J8L44lL8gJKqq9onqQeYGgJO0DmrsYFcCfRl6wYkYA/KHS768r4QVTB4JxsCcMQ9gIezxpTCZw==",crossOrigin:"anonymous",referrerPolicy:"no-referrer"})]})]});return(0,a.jsx)(r.A,{head:i,user:t,children:(0,a.jsx)(T,{data:s})})}}},e=>{var t=t=>e(e.s=t);e.O(0,[7623,1105,8949,2016,636,6593,8792],()=>t(7538)),_N_E=e.O()}]);