1import{f as ae,j as e,c as _,b6 as Ba,T as n,r as u,b7 as Ha,b8 as pt,aR as ss,b9 as $s,A as qs,ba as Wa,m as us,aA as H,N as Ka,I as w,v as be,e as S,al as hs,bb as Ga,bc as Ot,d as m,a8 as he,bd as Ke,B as v,b as A,s as G,i as q,D as R,k as U,l as $,p as Q,z as I,t as P,q as T,g as ee,be as jt,bf as Qa,a as F,bg as Ja,bh as Ge,bi as ft,bj as ns,h as O,F as J,n as p,bk as Us,L as D,V as ms,G as _e,bl as X,a4 as L,C as pe,w as Vs,bm as Ya,O as Lt,aS as De,aU as k,y as ve,bn as Za,aW as Rt,aX as $t,a1 as xe,bo as Xa,ap as is,o as bt,Y as qt,aL as Ut,ax as M,K as j,bp as Vt,bq as ye,br as en,au as sn,bs as tn,bt as ps,a_ as Bt,bu as an,bv as nn,bw as Ht,a0 as Bs,ae as Me,P as re,bx as Oe,at as Hs,ah as se,a9 as Ws,aa as Ks,a6 as ce,by as Wt,bz as Gs,aq as rs,ai as Fe,aT as js,bA as Le,aC as rn,ab as He,_ as vt,aD as ln,bB as fs,M as Ae,J as ze,af as As,ag as zs,ay as Kt,az as Xe,bC as on,bD as Gt,bE as cn,bF as dn,aP as un,bG as mn,bH as xn,bI as gn,bJ as hn,bK as pn,bL as jn,bM as fn,S as Qs,aE as Qt,aF as Js,aJ as bn,a2 as Jt,bN as vn,bO as yn,bP as wn,bQ as Ys,aY as Sn,aG as kn,bR as Nn,bS as Cn,X as _n,aH as In,U as Pn,bT as Fn,bU as An,ad as zn,bV as Yt,a7 as Zs,aZ as En,ao as Tn,am as K,an as Dn}from"./main-78aa46db.js";import{S as Qe}from"./section-helper-8bd754d2.js";import{F as B,$ as oe,A as ge,a0 as Xs,a1 as Mn,a2 as On,a3 as Ln,a4 as Rn,a5 as $n,a6 as qn,U as C,a7 as Un,E as Ne,o as te,K as et,y as Re,z as je,S as Es,a8 as ls,D as bs,L as st,C as Vn,W as vs,X as ys,Y as Ce,Z as tt,_ as We,G as Bn,h as W,a9 as Hn,aa as Wn,ab as Zt,H as Kn,f as Gn,j as Qn,e as Jn,i as Yn,R as at,V as Zn}from"./file-thumbnail-aea53471.js";import{c as Ie,d as Ee,e as ws,f as Xn,N as fe,D as ue,g as Te,U as nt,b as it,h as ei,i as Xt,t as si,u as ti,n as ai,w as ni,a as ii,j as ri,k as li,F as oi}from"./file-entry-index-page-b208e7f3.js";import{v as ci,w as di,c as rt,x as Ns,s as ui,m as mi,D as ea,$ as sa,M as Ss,A as xi,I as gi,U as hi,R as pi,a as ta,p as ji,f as fi,g as bi,F as vi,b as yi,l as wi,h as Si,i as ki,j as Ni,k as Ci,e as _i}from"./MoreVert-4d484c39.js";import{O as Ii,B as Pi,a as yt,u as aa,b as Fi}from"./OpenInNew-a8754599.js";import{I as Ai}from"./Info-821e606d.js";function zi({className:s,isCompactMode:a}){const{version:t}=ae();return e.jsxs("div",{className:_(s,"relative flex flex-col gap-20 overflow-y-auto border-r bg-alt px-12 pb-16 pt-26 text-sm font-medium text-muted"),children:[e.jsx(Ba,{matchDescendants:i=>i==="/admin",menu:"admin-sidebar",orientation:"vertical",onlyShowIcons:a,itemClassName:({isActive:i})=>_("block w-full rounded-button py-12 px-16",i?"bg-primary/6 text-primary font-semibold":"hover:bg-hover"),gap:"gap-8"}),!a&&e.jsx("div",{className:"mt-auto gap-14 px-16 text-xs",children:e.jsx(n,{message:"Version: :number",values:{number:t}})})]})}const lt=u.createContext(null);function Ei(s=!1){u.useEffect(()=>(s?document.documentElement.classList.remove("no-page-overflow"):document.documentElement.classList.add("no-page-overflow"),()=>{document.documentElement.classList.remove("no-page-overflow")}),[s])}function Ti({children:s,leftSidenavStatus:a,onLeftSidenavChange:t,rightSidenavStatus:i,initialRightSidenavStatus:r,onRightSidenavChange:l,name:o,leftSidenavCanBeCompact:c,height:d="h-screen",className:x,gridClassName:g="dashboard-grid",blockBodyOverflow:h=!0,...f}){Ei(!h);const b=Ha("(max-width: 1024px)"),y=u.useMemo(()=>o?pt(`${o}.sidenav.compact`):!1,[o])?"compact":"open",[z,V]=ss(a,b?"closed":y,t),Y=u.useMemo(()=>{if(b)return"closed";if(r!=null)return r;const Ye=pt(`${o}.sidenav.right.position`,"open");return Ye??(r||"closed")},[b,o,r]),[we,Z]=ss(i,Y,l),Se=u.useCallback(Ye=>{Z(Ye),$s(`${o}.sidenav.right.position`,Ye)},[Z,o]),Je=b&&(z==="open"||we==="open");return e.jsx(lt.Provider,{value:{leftSidenavStatus:z,setLeftSidenavStatus:V,rightSidenavStatus:we,setRightSidenavStatus:Se,leftSidenavCanBeCompact:c,name:o,isMobileMode:b},children:e.jsxs("div",{...f,className:_("relative isolate",g,x,d),children:[s,e.jsx(qs,{children:Je&&e.jsx(Wa,{position:"fixed",onClick:()=>{V("closed"),Se("closed")}}
1,"dashboard-underlay")})]})})}function Di({children:s,isScrollable:a=!0}){return u.cloneElement(s,{className:_(s.props.className,a&&"overflow-y-auto stable-scrollbar","dashboard-grid-content")})}function Mi({className:s,position:a,children:t,size:i="md",mode:r,overlayPosition:l="fixed",display:o="flex",overflow:c="overflow-hidden",forceClosed:d=!1}){const{isMobileMode:x,leftSidenavStatus:g,setLeftSidenavStatus:h,rightSidenavStatus:f,setRightSidenavStatus:b}=u.useContext(lt),N=a==="left"?g:f,y=x||r==="overlay",z={open:{display:o,width:null},compact:{display:o,width:null},closed:{width:0,transitionEnd:{display:"none"}}},V=Oi(N==="compact"?"compact":i);return e.jsx(us.div,{variants:z,initial:!1,animate:d?"closed":N,transition:{type:"tween",duration:.15},onClick:Y=>{const we=Y.target;x&&(we.closest("button")||we.closest("a"))&&(h("closed"),b("closed"))},className:_(s,a==="left"?"dashboard-grid-sidenav-left":"dashboard-grid-sidenav-right","will-change-[width]",c,V,y&&`${l} bottom-0 top-0 z-20 shadow-2xl`,y&&a==="left"&&"left-0",y&&a==="right"&&"right-0"),children:u.cloneElement(t,{className:_(t.props.className,"w-full h-full",N==="compact"&&"compact-scrollbar"),isCompactMode:N==="compact"})})}function Oi(s){switch(s){case"compact":return"w-80";case"sm":return"w-224";case"md":return"w-240";case"lg":return"w-288";default:return s||""}}const Li=H(e.jsx("path",{d:"M3 18h13v-2H3v2zm0-5h10v-2H3v2zm0-7v2h13V6H3zm18 9.59L17.42 12 21 8.41 19.59 7l-5 5 5 5L21 15.59z"}),"MenuOpenOutlined");function Ri({children:s,className:a,hideToggleButton:t,...i}){const{isMobileMode:r,leftSidenavStatus:l,setLeftSidenavStatus:o,name:c,leftSidenavCanBeCompact:d}=u.useContext(lt),x=d&&!r,g=!t&&(r||d),h=()=>{o(l==="open"?"closed":"open")},f=()=>{const b=l==="compact"?"open":"compact";$s(`${c}.sidenav.compact`,b==="compact"),o(b)};return e.jsx(Ka,{className:_("dashboard-grid-navbar",a),border:"border-b",size:"sm",toggleButton:g?e.jsx(w,{size:"md",onClick:()=>{x?f():h()},children:e.jsx(Li,{})}):void 0,...i,children:s})}function $i(){return be({queryKey:["admin-setup-alerts"],queryFn:()=>qi()})}function qi(){return S.get("admin/setup-alerts").then(s=>s.data)}function Ui(){return e.jsxs(Ti,{name:"admin",leftSidenavCanBeCompact:!0,children:[e.jsx(Ri,{size:"sm",menuPosition:"admin-navbar"}),e.jsx(Mi,{position:"left",size:"sm",children:e.jsx(zi,{})}),e.jsx(Di,{children:e.jsxs("div",{className:"bg dark:bg-alt",children:[e.jsx(Vi,{}),e.jsx(hs,{})]})})]})}function Vi(){const{data:s}=$i(),[a]=Ga("admin-setup-alert-dismissed",null),t=!a||Date.now()-a.timestamp>864e5;return!(s!=null&&s.alerts.length)||!t?null:e.jsx("div",{className:"fixed left-0 right-0 top-24 z-10 mx-auto w-max overflow-hidden rounded-panel bg shadow-md",children:e.jsx(Bi,{alert:s.alerts[0]})})}function Bi({alert:s}){const a=e.jsx("div",{dangerouslySetInnerHTML:{__html:s.description}});return e.jsx(Qe,{leadingIcon:e.jsx(Ot,{size:"xs",className:"text-danger"}),onClose:()=>{$s("admin-setup-alert-dismissed",{timestamp:Date.now()})},title:s.title,description:a,color:"neutral"},s.title)}const Hi=[{key:"email_verified_at",label:m("Email"),description:m("Email verification status"),defaultOperator:B.ne,control:{type:oe.Select,defaultValue:"01",options:[{key:"01",label:m("is confirmed"),value:{value:null,operator:B.ne}},{key:"02",label:m("is not confirmed"),value:{value:null,operator:B.eq}}]}},Ie({description:m("Date user registered or was created")}),Ee({description:m("Date user was last updated")}),{key:"subscriptions",label:m("Subscription"),description:m("Whether user is subscribed or not"),defaultOperator:B.eq,control:{type:oe.Select,defaultValue:"01",options:[{key:"01",label:m("is subscribed"),value:{value:"*",operator:B.has}},{key:"02",label:m("is not subscribed"),value:{value:"*",operator:B.doesntHave}}]}}],ts=""+new URL("team-de984127.svg",import.meta.url).href,me=he.forwardRef(({children:s,to:a,elementType:t,onClick:i,href:r,download:l,icon:o,disabled:c},d)=>Ke()?e.jsx(w,{ref:d,variant:"flat",color:"primary",className:"flex-shrink-0",size:"sm",to:a,href:r,download:l,elementType:t,onClick:i,disabled:c,
1children:o||e.jsx(ge,{})}):e.jsx(v,{ref:d,startIcon:o||e.jsx(ge,{}),variant:"flat",color:"primary",size:"sm",to:a,href:r,download:l,elementType:t,onClick:i,disabled:c,children:s}));function Wi(s){return A({mutationFn:a=>Ki(s,a),onError:a=>G(a)})}function Ki(s,a){return S.post(s,a).then(t=>t.data)}function Gi(){const{close:s}=q();return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Csv export"})}),e.jsx($,{children:e.jsx(n,{message:`Your request is being processed. We'll email you when the report is ready to download. In 2 certain cases, it might take a little longer, depending on the number of items beings 3 exported and the volume of activity.`})}),e.jsx(Q,{children:e.jsx(v,{variant:"flat",color:"primary",onClick:s,children:e.jsx(n,{message:"Got it"})})})]})}function na({endpoint:s,payload:a}){const[t,i]=u.useState(!1),r=Wi(s);return e.jsxs(u.Fragment,{children:[e.jsx(w,{variant:"outline",color:"primary",size:"sm",className:"flex-shrink-0",disabled:r.isPending,onClick:()=>{r.mutate(a,{onSuccess:l=>{l.downloadPath?ws(l.downloadPath):i(!0)}})},children:e.jsx(Xn,{})}),e.jsx(I,{type:"modal",isOpen:t,onOpenChange:i,children:e.jsx(Gi,{})})]})}const ia=H(e.jsx("path",{d:"m20 17.17-3.37-3.38c.64.22 1.23.48 1.77.76.97.51 1.58 1.52 1.6 2.62zm1.19 4.02-1.41 1.41-2.61-2.6H4v-2.78c0-1.12.61-2.15 1.61-2.66 1.29-.66 2.87-1.22 4.67-1.45L1.39 4.22 2.8 2.81l18.39 18.38zM15.17 18l-3-3H12c-2.37 0-4.29.73-5.48 1.34-.32.16-.52.5-.52.88V18h9.17zM12 6c1.1 0 2 .9 2 2 0 .86-.54 1.59-1.3 1.87l1.48 1.48C15.28 10.64 16 9.4 16 8c0-2.21-1.79-4-4-4-1.4 0-2.64.72-3.35 1.82l1.48 1.48C10.41 6.54 11.14 6 12 6z"}),"PersonOffOutlined");function Qi(s,a){return A({mutationFn:t=>Ji(a,t),onSuccess:async()=>{P(m("User suspended")),await T.invalidateQueries({queryKey:["users"]})},onError:t=>ee(t,s)})}function Ji(s,a){return S.post(`users/${s}/ban`,a).then(t=>t.data)}function Yi(s){const a=Xs(),[t,i]=u.useState(!s.value&&!s.defaultValue),r=s.onChange,[l,o]=ss(s.value||a,s.defaultValue||a,Z=>{i(!1),r==null||r(Z)}),{min:c,max:d,granularity:x,timezone:g,calendarIsOpen:h,setCalendarIsOpen:f,closeDialogOnSelection:b}=Mn(l,s),N=u.useCallback(()=>{i(!0),o(a),r==null||r(null),f(!1)},[a,o,r,f]),[y,z]=u.useState(()=>[jt(l)]),V=u.useCallback(Z=>{c&&Z.compare(c)<0?Z=c:d&&Z.compare(d)>0&&(Z=d);const Se=l?l.set(Z):On(Z,g);o(Se),z([jt(Se)]),i(!1)},[o,c,d,l,g]),Y=u.useCallback(Z=>!t&&Qa(l,Z),[l,t]),we=u.useCallback(Z=>({onClick:()=>{V==null||V(Z),b&&(f==null||f(!1))}}),[V,f,b]);return{selectedValue:l,setSelectedValue:o,calendarIsOpen:h,setCalendarIsOpen:f,dayIsActive:Y,dayIsHighlighted:()=>!1,dayIsRangeStart:()=>!1,dayIsRangeEnd:()=>!1,getCellProps:we,calendarDates:y,setCalendarDates:z,isPlaceholder:t,clear:N,setIsPlaceholder:i,min:c,max:d,granularity:x,timezone:g,closeDialogOnSelection:b}}function Zi({showCalendarFooter:s,...a}){const t=Yi(a),i=u.useRef(null),r=Xs(),l=s&&e.jsx(Q,{padding:"px-14 pb-14",startAction:e.jsx(v,{disabled:t.isPlaceholder,variant:"text",color:"primary",onClick:()=>{t.clear()},children:e.jsx(n,{message:"Clear"})}),children:e.jsx(v,{variant:"text",color:"primary",onClick:()=>{t.setSelectedValue(r),t.setCalendarIsOpen(!1)},children:e.jsx(n,{message:"Today"})})}),o=e.jsx(I,{offset:8,placement:"bottom-start",isOpen:t.calendarIsOpen,onOpenChange:t.setCalendarIsOpen,type:"popover",triggerRef:i,returnFocusToTrigger:!1,moveFocusToDialog:!1,children:e.jsxs(R,{size:"auto",children:[e.jsx($,{className:"flex items-start gap-40",padding:s?"px-24 pt-20 pb-10":null,children:e.jsx(qn,{state:t,visibleMonths:1})}),l]})}),c={onClick:d=>{d.stopPropagation(),d.preventDefault(),Xi(d)?t.setCalendarIsOpen(!1):t.setCalendarIsOpen(!0)}};return e.jsxs(u.Fragment,{children:[e.jsx(Ln,{ref:i,wrapperProps:c,endAdornment:e.jsx(Rn,{className:_(a.disabled&&"text-disabled")}),...a,children:e.jsx($n,{segmentProps:c,state:t,value:t.selectedValue,onChange:t.setSelectedValue,isPlaceholder:t.isPlaceholder})}),o]})}function Ts(s){const{min:a,max:t}=s,{trans:i}=F(),{format:r}=Ja(),{field:{onChange:l,onBlur:o,value:c=null,ref:d},fieldState:{invalid:x,error:g}}=Ge({name:s.name,rules:{validate:b=>{if(!b)return;const N=ft(b);
3if(a&&N.compare(a)<0)return i({message:"Enter a date after :date",values:{date:r(b)}});if(t&&N.compare(t)>0)return i({message:"Enter a date before :date",values:{date:r(b)}})}}}),h=c?ft(c):null,f={onChange:b=>{l(b&&b.toAbsoluteString())},onBlur:o,value:h,invalid:x,errorMessage:g==null?void 0:g.message,inputRef:d};return e.jsx(Zi,{...ns(f,s)})}function Xi(s){return["hour","minute","dayPeriod"].includes(s.currentTarget.ariaLabel||"")}function er({user:s}){const{trans:a}=F(),{close:t,formId:i}=q(),r=O({defaultValues:{permanent:!0}}),l=r.watch("permanent"),o=Qi(r,s.id);return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Suspend â:nameâ",values:{name:s.display_name}})}),e.jsx($,{children:e.jsxs(J,{id:i,form:r,onSubmit:c=>o.mutate(c,{onSuccess:()=>t()}),children:[e.jsx(Ts,{name:"ban_until",label:e.jsx(n,{message:"Suspend until"}),disabled:l}),e.jsx(C,{name:"permanent",className:"mt-12",children:e.jsx(n,{message:"Permanent"})}),e.jsx(p,{className:"mt-24",name:"comment",inputElementType:"textarea",maxLength:250,label:e.jsx(n,{message:"Reason"}),placeholder:a(m("Optional"))})]})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>t(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{form:i,variant:"flat",color:"primary",type:"submit",disabled:o.isPending,children:e.jsx(n,{message:"Suspend"})})]})]})}function sr(s){return A({mutationFn:()=>tr(s),onSuccess:()=>{P(m("User unsuspended")),T.invalidateQueries({queryKey:["users"]})},onError:a=>G(a)})}function tr(s){return S.delete(`users/${s}/unban`).then(a=>a.data)}function ar(){return A({mutationFn:s=>nr(s),onSuccess:async s=>{P(m(`Impersonating User "${s.user.display_name}"`)),window.location.href="/"},onError:s=>G(s)})}function nr(s){return S.post(`admin/users/impersonate/${s.userId}`,s).then(a=>a.data)}const wt=[{key:"name",allowsSorting:!0,sortingKey:"email",width:"flex-3 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"User"}),body:s=>e.jsx(fe,{image:s.avatar,label:s.display_name,description:s.email})},{key:"roles",header:()=>e.jsx(n,{message:"Roles"}),body:s=>{var a;return e.jsx(Un,{radius:"rounded",size:"xs",children:(a=s==null?void 0:s.roles)==null?void 0:a.map(t=>e.jsx(Us,{selectable:!0,children:e.jsx(D,{className:_("capitalize"),target:"_blank",to:`/admin/roles/${t.id}/edit`,children:e.jsx(n,{message:t.name})})},t.id))})}},{key:"subscribed",header:()=>e.jsx(n,{message:"Subscribed"}),width:"w-96",body:s=>{var a;return(a=s.subscriptions)!=null&&a.length?e.jsx(ms,{className:"text-positive icon-md"}):e.jsx(_e,{className:"text-danger icon-md"})}},{key:"banned_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Suspended"}),width:"w-96",body:s=>s.banned_at?e.jsx(ms,{className:"text-danger icon-md"}):null},{key:"last_login",width:"w-110",header:()=>e.jsx(n,{message:"Last active"}),body:s=>s.last_login?e.jsx("time",{children:e.jsx(X,{date:s.last_login.created_at})}):"-"},{key:"createdAt",allowsSorting:!0,width:"w-110",header:()=>e.jsx(n,{message:"Created at"}),body:s=>e.jsx("time",{children:e.jsx(X,{date:s.created_at})})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),width:"w-128 flex-shrink-0",hideHeader:!0,align:"end",visibleInMode:"all",body:s=>e.jsxs("div",{className:"text-muted",children:[e.jsx(D,{to:`${s.id}/edit`,children:e.jsx(L,{label:e.jsx(n,{message:"Edit user"}),children:e.jsx(w,{size:"md",children:e.jsx(Ne,{})})})}),s.banned_at?e.jsx(ir,{user:s}):e.jsxs(I,{type:"modal",children:[e.jsx(L,{label:e.jsx(n,{message:"Suspend user"}),children:e.jsx(w,{size:"md",children:e.jsx(ia,{})})}),e.jsx(er,{user:s})]}),e.jsx(rr,{user:s})]})}];function ir({user:s}){const a=sr(s.id);return e.jsxs(I,{type:"modal",onClose:t=>{t&&a.mutate()},children:[e.jsx(L,{label:e.jsx(n,{message:"Remove suspension"}),children:e.jsx(w,{size:"md",color:"danger",children:e.jsx(ia,{})})}),e.jsx(pe,{isDanger:!0,title:e.jsx(n,{message:"Suspend â:nameâ",values:{name:s.display_name}}),body:e.jsx(n,{message:"Are you sure you want to remove suspension from this user?"}),confirm:e.jsx(n,{message:"Unsuspend"})})]})}function rr({user:s}){const{getPermission:a}=Vs(),t=ar();return a("admin")?e.jsxs(I,{type:"modal",children:[e.jsx(L,{label:e.jsx(n,{message:"Login as user"}),children:e.jsx(w,{size:"md",children:e.jsx(Ya,{})})}),e.jsx(pe,{title:e.jsx(n,{message:"Login as â:nameâ",values:{name:s.display_name}}),isLoading:t.isPending,body:e.jsx(n,{message:"Are you sure you want to login as this user?"}),confirm:e.jsx(n,{message:"Login"}),onConfirm:()=>{t.mutate({userId:s.id})}})]}):null}function lr(){const{billing:s}=ae(),a=s.enable?wt:wt.filter(t=>t.key!=="subscribed");
3return e.jsx(u.Fragment,{children:e.jsx(ue,{endpoint:"users",title:e.jsx(n,{message:"Users"}),filters:Hi,columns:a,actions:e.jsx(or,{}),queryParams:{with:"subscriptions,bans,lastLogin"},selectedActions:e.jsx(Te,{}),emptyStateMessage:e.jsx(te,{image:ts,title:e.jsx(n,{message:"No users have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching users"})})})})}function or(){return e.jsxs(u.Fragment,{children:[e.jsx(na,{endpoint:"users/csv/export"}),e.jsx(me,{elementType:D,to:"new",children:e.jsx(n,{message:"Add new user"})})]})}const cr={preview:{defaultRoute:"/",navigationRoutes:[]},sections:{general:{label:m("General"),position:1,buildBreadcrumb:()=>[{label:m("General"),location:"general"}]},themes:{label:m("Themes"),position:2,buildBreadcrumb:(s,a)=>{var l;const t=s.split("/").filter(o=>!!o),[,,,i]=t,r=[{label:m("Themes"),location:"themes"}];return i!=null&&r.push({label:(l=a.appearance.themes.all[+i])==null?void 0:l.name,location:`themes/${i}`}),t.at(-1)==="font"&&r.push({label:m("Font"),location:`themes/${i}/font`}),t.at(-1)==="radius"&&r.push({label:m("Rounding"),location:`themes/${i}/radius`}),r}},menus:{label:m("Menus"),position:3,buildBreadcrumb:(s,a)=>{const t=s.split("/").filter(o=>!!o),[,,...i]=t,r=[{label:m("Menus"),location:"menus"}],l=ci(i,2);return l.forEach(([o,c],d)=>{var x,g;if(o==="menus"&&c!=null)r.push({label:(x=a.settings.menus[+c])==null?void 0:x.name,location:`menus/${c}`});else if(o==="items"&&c!=null){const[,h]=l[d-1];r.push({label:(g=a.settings.menus[+h].items[+c])==null?void 0:g.label,location:`menus/${h}/${c}`})}}),r},config:{availableRoutes:["/","/login","/register","/contact","/pricing","/account-settings","/admin","/admin/appearance","/admin/settings","/admin/plans","/admin/subscriptions","/admin/users","/admin/roles","/admin/pages","/admin/tags","/admin/files","/admin/localizations","/admin/ads","/admin/logs","/admin/settings/authentication","/admin/settings/branding","/admin/settings/cache","/admin/settings/providers","/api-docs"],positions:["admin-navbar","admin-sidebar","custom-page-navbar","auth-page-footer","auth-dropdown","account-settings-page","billing-page","checkout-page-navbar","checkout-page-footer","pricing-table-page","contact-us-page","notifications-page","footer","footer-secondary"]}},"custom-code":{label:m("Custom Code"),position:4,buildBreadcrumb:()=>[{label:m("Custom code"),location:"custom-code"}]},"seo-settings":{label:m("SEO Settings"),position:5,buildBreadcrumb:()=>[{label:m("SEO"),location:"seo"}]}}},le=u.forwardRef(({startIcon:s,children:a,className:t,description:i,...r},l)=>e.jsxs(Lt,{ref:l,display:"flex",className:_("relative mb-10 h-54 w-full items-center gap-10 rounded-input border bg px-14 text-sm hover:bg-hover",t),variant:null,...r,children:[s,e.jsxs("span",{className:"block min-w-0",children:[e.jsx("span",{className:"block",children:a}),i&&e.jsx("span",{className:"block overflow-hidden overflow-ellipsis whitespace-nowrap text-xs text-muted",children:i})]}),e.jsx(et,{"aria-hidden":!0,className:"ml-auto text-muted icon-sm"})]})),ot=H(e.jsx("path",{stroke:"#E0E0E0",d:"M24,44c-7.168,0-13-5.816-13-12.971C11,24,24,4,24,4s13,20,13,27.029C37,38.184,31.168,44,24,44z"}));function dr(){return e.jsxs(u.Fragment,{children:[e.jsx(ur,{}),e.jsxs("div",{className:"my-24 border-y py-24",children:[e.jsx(le,{to:"action-buttons",elementType:D,className:"mb-20",children:e.jsx(n,{message:"Action buttons"})}),e.jsx(le,{to:"primary-features",elementType:D,children:e.jsx(n,{message:"Primary features"})}),e.jsx(le,{to:"secondary-features",elementType:D,children:e.jsx(n,{message:"Secondary features"})})]}),e.jsx(mr,{}),e.jsx(xr,{})]})}function ur(){const s=$e(a=>{var t,i,r;return(r=(i=(t=a.defaults)==null?void 0:t.settings.homepage)==null?void 0:i.appearance)==null?void 0:r.headerImage});return e.jsxs(u.Fragment,{children:[e.jsx(p,{label:e.jsx(n,{message:"Header title"}),className:"mb-20",name:"settings.homepage.appearance.headerTitle",onFocus:()=>{E().preview.setHighlight('[data-testid="headerTitle"]')}}),e.jsx(p,{label:e.jsx(n,{message:"Header subtitle"}),className:"mb-30",inputElementType:"textarea",rows:4,name:"settings.homepage.a
3ppearance.headerSubtitle",onFocus:()=>{E().preview.setHighlight('[data-testid="headerSubtitle"]')}}),e.jsx(De,{name:"settings.homepage.appearance.headerImage",className:"mb-30",label:e.jsx(n,{message:"Header image"}),defaultValue:s,diskPrefix:"homepage"}),e.jsx(di,{name:"settings.homepage.appearance.headerImageOpacity",label:e.jsx(n,{message:"Header image opacity"}),minValue:0,step:.1,maxValue:1,formatOptions:{style:"percent"}}),e.jsx("div",{className:"mb-20 text-xs text-muted",children:e.jsx(n,{message:"In order for overlay colors to appear, header image opacity will need to be less then 100%"})}),e.jsx(St,{formKey:"settings.homepage.appearance.headerOverlayColor1",label:e.jsx(n,{message:"Header overlay color 1"})}),e.jsx(St,{formKey:"settings.homepage.appearance.headerOverlayColor2",label:e.jsx(n,{message:"Header overlay color 2"})})]})}function mr(){const s=$e(a=>{var t,i,r;return(r=(i=(t=a.defaults)==null?void 0:t.settings.homepage)==null?void 0:i.appearance)==null?void 0:r.footerImage});return e.jsxs(u.Fragment,{children:[e.jsx(p,{label:e.jsx(n,{message:"Footer title"}),className:"mb-20",name:"settings.homepage.appearance.footerTitle",onFocus:()=>{E().preview.setHighlight('[data-testid="footerTitle"]')}}),e.jsx(p,{label:e.jsx(n,{message:"Footer subtitle"}),className:"mb-20",name:"settings.homepage.appearance.footerSubtitle",onFocus:()=>{E().preview.setHighlight('[data-testid="footerSubtitle"]')}}),e.jsx(De,{name:"settings.homepage.appearance.footerImage",className:"mb-30",label:e.jsx(n,{message:"Footer background image"}),defaultValue:s,diskPrefix:"homepage"})]})}function xr(){return e.jsxs("div",{className:"mt-24 border-t pt-24",children:[e.jsx(p,{label:e.jsx(n,{message:"Pricing title"}),className:"mb-20",name:"settings.homepage.appearance.pricingTitle",onFocus:()=>{E().preview.setHighlight('[data-testid="pricingTitle"]')}}),e.jsx(p,{label:e.jsx(n,{message:"Pricing subtitle"}),className:"mb-20",name:"settings.homepage.appearance.pricingSubtitle",onFocus:()=>{E().preview.setHighlight('[data-testid="pricingSubtitle"]')}}),e.jsx(C,{className:"mb-24",name:"settings.homepage.appearance.showPricing",children:e.jsx(n,{message:"Show pricing table"})})]})}function St({label:s,formKey:a}){const t=a,{watch:i,setValue:r}=k(),l=i(t),o=c=>{r(a,c,{shouldDirty:!0})};return e.jsxs(I,{value:l,type:"popover",onValueChange:c=>o(c),onClose:c=>o(c),children:[e.jsx(le,{className:"capitalize",startIcon:e.jsx(ot,{viewBox:"0 0 48 48",className:"icon-lg",style:{fill:l}}),children:s}),e.jsx(rt,{})]})}function ra(s){return s&&s.charAt(0).toUpperCase()+s.slice(1)}const gr=he.forwardRef(({valueListKey:s="permissions",permissionBillingPeriod:a="recurring",...t},i)=>{const{data:r}=ve([s]),l=(r==null?void 0:r.permissions)||(r==null?void 0:r.workspacePermissions),[o,c]=ss(t.value,[],t.onChange),[d,x]=u.useState(!1);if(!l)return null;const g=la(l,o,d),h=f=>{const b=[...o],N=b.findIndex(y=>y.id===f.id);N>-1&&b.splice(N,1,f),c(b)};return e.jsxs(u.Fragment,{children:[e.jsx(Re,{variant:"outline",ref:i,children:g.map(({groupName:f,items:b,anyChecked:N})=>e.jsx(je,{label:e.jsx(n,{message:dt(f)}),startIcon:N?e.jsx(Za,{size:"sm"}):void 0,children:e.jsx(Rt,{children:b.map(y=>{const z=o.findIndex(Y=>Y.id===y.id),V=z>-1;return e.jsxs("div",{children:[e.jsx($t,{onSelected:()=>{if(V){const Y=[...o];Y.splice(z,1),c(Y)}else c([...o,y])},endSection:e.jsx(Es,{tabIndex:-1,checked:V,onChange:()=>{}}),description:e.jsx(n,{message:pr(y,a)}),children:e.jsx(n,{message:y.display_name||y.name})}),V&&e.jsx(hr,{permission:y,permissionBillingPeriod:a,onChange:h})]},y.id)})})},f))}),e.jsx(Es,{className:"mt-30",checked:d,onChange:f=>{x(f.target.checked)},children:e.jsx(n,{message:"Show advanced permissions"})})]})});function hr({permission:s,permissionBillingPeriod:a,onChange:t}){var r;if(!((r=s==null?void 0:s.restrictions)!=null&&r.length))return null;const i=(l,o)=>{const c=Xa(s,d=>{const x=d.restrictions.find(g=>g.name===l);x&&(x.value=o)});t==null||t(c)};return e.jsx("div",{className:"px-40 py-20",children:s.restrictions.map((l,o)=>{const c=o===s.restrictions.length-1,d=e.jsx(n,{message:dt(l.name)}
3),x=jr(s.name,l,a),g=x?e.jsx(n,{message:x}):void 0;return l.type==="bool"?e.jsx(Es,{description:g,className:_(!c&&"mb-30"),checked:!!l.value,onChange:h=>{i(l.name,h.target.checked)},children:d},l.name):e.jsx(xe,{size:"sm",label:d,description:g,type:"number",className:_(!c&&"mb-30"),value:l.value||"",onChange:h=>{i(l.name,h.target.value===""?void 0:parseInt(h.target.value))}},l.name)})})}function pr(s,a){const t=fr[s.name];return(t==null?void 0:t[a])||s.description}function jr(s,a,t){var r;const i=(r=br[s])==null?void 0:r[a.name];return(i==null?void 0:i[t])||a.description}const fr={"domains.free_claims":{recurring:"Allow user to claim free Enom domain purchases each month.",lifetime:"Allow user to claim the free Enom domain purchases included with this one-time plan."}},br={"ai.text":{tokens:{recurring:"Maximum AI text tokens per month.",lifetime:"Maximum AI text tokens across all time."}},"ai.images":{tokens:{recurring:"Maximum AI image tokens per month. One token equals one generated image.",lifetime:"Maximum AI image tokens across all time. One token equals one generated image."}},"ai.videos":{count:{recurring:"Maximum AI videos per month.",lifetime:"Maximum AI videos across all time."}},"ai.logos":{count:{recurring:"Maximum AI logos per month.",lifetime:"Maximum AI logos across all time."}},"ebooks.generate":{count:{recurring:"Maximum ebooks per month.",lifetime:"Maximum ebooks across all time."}},"domains.free_claims":{count:{recurring:"Maximum free domain claims per month.",lifetime:"Maximum free domain claims across all time."}}};function ct(s){const{field:{onChange:a,value:t=[],ref:i}}=Ge({name:s.name}),r={onChange:a,value:t};return e.jsx(gr,{ref:i,...ns(r,s)})}const dt=s=>ra(s.replace("_"," "));function la(s,a,t){const i=[];return s.forEach(r=>{const l=a.findIndex(c=>c.id===r.id);if(!t&&r.advanced)return;let o=i.find(c=>c.groupName===r.group);if(o||(o={groupName:r.group,anyChecked:!1,items:[]},i.push(o)),l>-1){const c={...r,restrictions:vr(r.restrictions,a[l].restrictions)};o.anyChecked=!0,o.items.push(c)}else o.items.push(r)}),i}function vr(s,a){return s==null?void 0:s.map(t=>{const i=a.find(r=>r.name===t.name);return i?{...t,value:i.value}:t})}function oa(){const s=ut.sections.menus.config;return s?s.availableRoutes.map(a=>({id:a,label:a,action:a,type:"route",target:"_self"})):[]}const yr=[...Array(60).keys()],wr=he.lazy(()=>is(()=>import("./icon-list-bb02bf0e.js"),["./icon-list-bb02bf0e.js","./main-78aa46db.js","./main-714cd21f.css","./Description-d991fecd.js","./file-thumbnail-aea53471.js","./MoreVert-4d484c39.js","./CalendarToday-6cbe40f2.js","./file-entry-index-page-b208e7f3.js","./section-helper-8bd754d2.js","./DesktopMac-79e51974.js","./KeyboardBackspace-433a7d38.js","./Info-821e606d.js","./OpenInNew-a8754599.js","./Refresh-ced93450.js","./TaskAlt-9518642c.js","./TrendingUp-f0cd576a.js"],import.meta.url));function Sr({onIconSelected:s}){const{trans:a}=F(),[t,i]=he.useState("");return e.jsxs("div",{className:"py-4",children:[e.jsx(xe,{className:"mb-20",value:t,onChange:r=>{i(r.target.value)},placeholder:a({message:"Search icons..."})}),e.jsx(qs,{mode:"wait",children:e.jsx(u.Suspense,{fallback:e.jsx(us.div,{...bt,className:Ns.grid,children:yr.map((r,l)=>e.jsx("div",{className:Ns.button,children:e.jsx(qt,{variant:"rect"})},l))}),children:e.jsx(us.div,{...bt,className:Ns.grid,children:e.jsx(wr,{searchQuery:t,onIconSelected:s})})})})]})}function kr(){return e.jsxs(R,{size:"w-850",className:"min-h-dialog",children:[e.jsx(U,{children:e.jsx(n,{message:"Select icon"})}),e.jsx($,{children:e.jsx(Nr,{})})]})}function Nr(){const{close:s}=q();return e.jsx(Sr,{onIconSelected:a=>{s(a)}})}function Cr(s){const a=u.useRef();return u.useEffect(()=>{a.current=s},[s]),a.current}function Ve({formPathPrefix:s,hideRoleAndPermissionFields:a}){const{trans:t}=F(),i=r=>s?`${s}.${r}`:r;return e.jsxs(u.Fragment,{children:[e.jsx(p,{className:"mb-20",name:i("label"),label:e.jsx(n,{message:"Label"}),placeholder:t(m("No label...")),startAppend:e.jsx(_r,{prefixName:i})}),e.jsx(Ir,{prefixName:i}),!a&&e.jsxs(u.Fragment,{children:[e.jsx(Pr,{prefixName:i}),e.jsx(Fr,{prefixName:i})]}),e.jsx(Ar,{prefixName:i})]})}function _r({prefixName:s,...a}){const{watch:t,setValue:i}=k(),r=s("icon"),l=t(r),o=l&&Ut(l);return e.jsxs(I,{type:"modal",onClose:c=>{(c||c===null)&&i(r,c,{shouldDirty:!0})},children:[e.jsx(w,{className:"text-muted icon-sm",variant:"outline",size:"md",...a,children:o?e.jsx(o,{}):e.jsx(Ne,{})}),e.jsx(kr,{})]})}function Ir({prefixName:s}){const a=k(),t=a.watch(s("type")),i=Cr(t),{data:r}
3=ve(["menuItemCategories"]),l=(r==null?void 0:r.menuItemCategories)||[],o=l.find(x=>x.type===t),{trans:c}=F(),d=oa();return u.useEffect(()=>{i&&i!==t&&a.setValue(s("action"),"")},[t,i,a,s]),e.jsxs(u.Fragment,{children:[e.jsxs(M,{className:"mb-20",name:s("type"),selectionMode:"single",label:e.jsx(n,{message:"Type"}),children:[e.jsx(j,{value:"link",children:e.jsx(n,{message:"Custom link"})}),e.jsx(j,{value:"route",children:e.jsx(n,{message:"Site page"})}),l.map(x=>e.jsx(j,{value:x.type,children:x.name},x.type))]}),t==="link"&&e.jsx(p,{className:"mb-20",required:!0,type:"url",name:s("action"),placeholder:c({message:"Enter a url..."}),label:e.jsx(n,{message:"Url"})}),t==="route"&&e.jsx(M,{className:"mb-20",required:!0,items:d,name:s("action"),label:e.jsx(n,{message:"Page"}),searchPlaceholder:c(m("Search pages")),showSearchField:!0,selectionMode:"single",children:x=>e.jsx(j,{value:x.id,children:x.label},x.id)}),o&&e.jsx(M,{className:"mb-20",required:!0,items:o.items,name:s("action"),showSearchField:!0,searchPlaceholder:c(m("Search...")),selectionMode:"single",label:e.jsx(n,{message:o.name}),children:x=>e.jsx(j,{value:x.action,children:e.jsx(n,{message:x.label})})})]})}function Pr({prefixName:s}){const{data:a}=ve(["roles","permissions"]),t=(a==null?void 0:a.roles)||[],{trans:i}=F();return e.jsx(ls,{className:"mb-20",placeholder:i({message:"Add role..."}),label:e.jsx(n,{message:"Only show if user has role"}),name:s("roles"),chipSize:"sm",suggestions:t,valueKey:"id",displayWith:r=>{var l;return(l=t.find(o=>o.id===r.id))==null?void 0:l.name},children:r=>e.jsx(j,{value:r.id,capitalizeFirst:!0,children:e.jsx(n,{message:r.name})},r.id)})}function Fr({prefixName:s}){const{data:a}=ve(["roles","permissions"]),{trans:t}=F(),i=u.useMemo(()=>la((a==null?void 0:a.permissions)||[],[],!1),[a==null?void 0:a.permissions]);return e.jsx(ls,{label:e.jsx(n,{message:"Only show if user has permissions"}),placeholder:t({message:"Add permission..."}),chipSize:"sm",suggestions:i,name:s("permissions"),valueKey:"name",children:({groupName:r,items:l})=>e.jsx(Vt,{label:dt(r),children:l.map(o=>e.jsx(j,{value:o.name,description:e.jsx(n,{message:o.description}),children:e.jsx(n,{message:o.display_name||o.name})},o.name))},r)})}function Ar({prefixName:s}){return e.jsxs(M,{className:"mt-20",selectionMode:"single",name:s("target"),label:e.jsx(n,{message:"Open link in"}),children:[e.jsx(j,{value:"_self",children:e.jsx(n,{message:"Same window"})}),e.jsx(j,{value:"_blank",children:e.jsx(n,{message:"New window"})})]})}function zr(){const[s,a]=u.useState(["cta1"]);return e.jsxs(Re,{variant:"outline",expandedValues:s,onExpandedChange:t=>{a(t),t.length&&E().preview.setHighlight(`[data-testid="${t[0]}"]`)},children:[e.jsx(je,{value:"cta1",label:e.jsx(n,{message:"Header button 1"}),children:e.jsx(Ve,{formPathPrefix:"settings.homepage.appearance.actions.cta1"})}),e.jsx(je,{value:"ct2",label:e.jsx(n,{message:"Header button 2"}),children:e.jsx(Ve,{formPathPrefix:"settings.homepage.appearance.actions.cta2"})}),e.jsx(je,{value:"cta3",label:e.jsx(n,{message:"Footer button"}),children:e.jsx(Ve,{formPathPrefix:"settings.homepage.appearance.actions.cta3"})})]})}function Er(){const{fields:s,remove:a,append:t}=ye({name:"settings.homepage.appearance.primaryFeatures"}),[i,r]=u.useState([0]);return e.jsxs("div",{children:[e.jsx(Re,{variant:"outline",expandedValues:i,onExpandedChange:l=>{r(l),l.length&&E().preview.setHighlight(`[data-testid="primary-root-${l[0]}"]`)},children:s.map((l,o)=>e.jsxs(je,{value:o,label:e.jsx(n,{message:`Primary feature ${o+1}`}),children:[e.jsx(Tr,{index:o}),e.jsx("div",{className:"text-right",children:e.jsx(v,{size:"xs",variant:"outline",color:"danger",onClick:()=>{a(o)},children:e.jsx(n,{message:"Remove"})})})]},l.id))}),e.jsx("div",{className:"mt-20 text-right",children:e.jsx(v,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(ge,{}),onClick:()=>{t({}),r([s.length])},children:e.jsx(n,{message:"Add feature"})})})]})}function Tr({index:s}){const a=$e(t=>{var i,r,l,o;return(o=(l=(r=(i=t.defaults)==null?void 0:i.settings.homepage)==null?void 0:r.appearance)==null?void 0:l.primaryFeatures[s])==null?void 0:o.image});return e.jsxs(e.Fragment,{children:[e.jsx(De,{name:`settings.homepage.a
3ppearance.primaryFeatures.${s}.image`,className:"mb-30",label:e.jsx(n,{message:"Image"}),defaultValue:a,diskPrefix:"homepage"}),e.jsx(p,{name:`settings.homepage.appearance.primaryFeatures.${s}.title`,label:e.jsx(n,{message:"Title"}),className:"mb-20",onFocus:()=>{E().preview.setHighlight(`[data-testid="primary-title-${s}"]`)}}),e.jsx(p,{name:`settings.homepage.appearance.primaryFeatures.${s}.subtitle`,label:e.jsx(n,{message:"Subtitle"}),className:"mb-20",inputElementType:"textarea",rows:4,onFocus:()=>{E().preview.setHighlight(`[data-testid="primary-subtitle-${s}"]`)}})]})}function Dr(){const{fields:s,remove:a,append:t}=ye({name:"settings.homepage.appearance.secondaryFeatures"}),[i,r]=u.useState([0]);return e.jsxs("div",{children:[e.jsx(Re,{variant:"outline",expandedValues:i,onExpandedChange:l=>{r(l),l.length&&E().preview.setHighlight(`[data-testid="secondary-root-${l[0]}"]`)},children:s.map((l,o)=>e.jsxs(je,{value:o,label:e.jsx(n,{message:`Secondary feature ${o+1}`}),children:[e.jsx(Mr,{index:o}),e.jsx("div",{className:"text-right",children:e.jsx(v,{size:"xs",variant:"outline",color:"danger",onClick:()=>{a(o)},children:e.jsx(n,{message:"Remove"})})})]},l.id))}),e.jsx("div",{className:"mt-20 text-right",children:e.jsx(v,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(ge,{}),onClick:()=>{t({}),r([s.length])},children:e.jsx(n,{message:"Add feature"})})})]})}function Mr({index:s}){return e.jsxs(e.Fragment,{children:[e.jsx(De,{name:`settings.homepage.appearance.secondaryFeatures.${s}.image`,className:"mb-30",label:e.jsx(n,{message:"Image"}),defaultValue:Or(s),diskPrefix:"homepage"}),e.jsx(p,{name:`settings.homepage.appearance.secondaryFeatures.${s}.title`,label:e.jsx(n,{message:"Title"}),className:"mb-20",onFocus:()=>{E().preview.setHighlight(`[data-testid="secondary-title-${s}"]`)}}),e.jsx(p,{name:`settings.homepage.appearance.secondaryFeatures.${s}.subtitle`,label:e.jsx(n,{message:"Subtitle"}),className:"mb-20",inputElementType:"textarea",rows:4,onFocus:()=>{E().preview.setHighlight(`[data-testid="secondary-subtitle-${s}"]`)}}),e.jsx(p,{name:`settings.homepage.appearance.secondaryFeatures.${s}.description`,label:e.jsx(n,{message:"Description"}),className:"mb-20",inputElementType:"textarea",rows:4,onFocus:()=>{E().preview.setHighlight(`[data-testid="secondary-description-${s}"]`)}})]})}function Or(s){var a,t,i,r;return(r=((i=(t=(a=E().defaults)==null?void 0:a.settings)==null?void 0:t.homepage)==null?void 0:i.appearance).secondaryFeatures[s])==null?void 0:r.image}const ca={preview:{defaultRoute:"/",navigationRoutes:["/"]},sections:{"landing-page":{label:m("Landing Page"),position:1,previewRoute:"/",routes:[{path:"landing-page",element:e.jsx(dr,{})},{path:"landing-page/action-buttons",element:e.jsx(zr,{})},{path:"landing-page/primary-features",element:e.jsx(Er,{})},{path:"landing-page/secondary-features",element:e.jsx(Dr,{})}],buildBreadcrumb:s=>{const t=s.split("/").filter(r=>!!r).pop(),i=[{label:m("Landing page"),location:"landing-page"}];return t==="action-buttons"&&i.push({label:m("Action buttons"),location:"landing-page/action-buttons"}),t==="primary-features"&&i.push({label:m("Primary features"),location:"landing-page/primary-features"}),t==="secondary-features"&&i.push({label:m("Secondary features"),location:"landing-page/secondary-features"}),i}},menus:{config:{positions:["dashboard","homepage-navbar","footer","footer-secondary"],availableRoutes:["/dashboard","/dashboard/domains","/dashboard/webinars","/admin/templates"]}},"seo-settings":{config:{pages:[{key:"landing-page",label:m("Landing page")}]}}}},ut=en.all([cr,ca]),$e=sn()(ui(tn((s,a)=>({defaults:null,iframeWindow:null,config:ut,setDefaults:t=>{s(i=>{i.defaults={...t}})},setIframeWindow:t=>{s(()=>({iframeWindow:t}))},preview:{navigate:t=>{var o;const i=(o=a().config)==null?void 0:o.sections[t],r=(i==null?void 0:i.previewRoute)||"/",l=a().iframeWindow;r&&qe(l,{type:"navigate",to:r})},setValues:t=>{const i=a().iframeWindow;qe(i,{type:"setValues",values:t})},setThemeFont:t=>{const i=a().iframeWindow;qe(i,{type:"setThemeFont",value:t})},setThemeValue:(t,i)=>{const r=a().iframeWindow;qe(r,{type:"setThemeValue",name:t,value:i})},setActiveTheme:t=>{const i=a().iframeWindow;qe(i,{type:"setActiveTheme",themeId:t})},setCustomCode:(t,i)=>{const r=a().iframeWindow;qe(r,{type:"setCustomCode",mode:t,value:i})},setHighlight:t=>{s(()=>{var l;let i=null;const r=(l=a().iframeWindow)==null?void 0:l.document;r&&t&&(i=r.querySelector(t)),i&&requestAnimationFrame(()=>{i&&i.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})})})}}}))));function qe(s,a){s&&s.postMessage({source:"be-appearance-editor",...a},"*")}function E(){return $e.getState()}function Lr(){return A({mutationFn:s=>Rr(s),onSuccess:async()=>
3{await T.invalidateQueries({queryKey:["admin/appearance/values"]}),P(m("Changes saved"))},onError:s=>G(s)})}function Rr(s){return S.post("admin/appearance",{changes:s}).then(a=>a.data)}function $r(){return be({queryKey:["admin/appearance/values"],queryFn:()=>qr(),staleTime:1/0})}function qr(){return S.get("admin/appearance/values").then(s=>s.data)}function Ur(){const{pathname:s}=ps(),{getValues:a}=k(),[t,i]=u.useState(null);return u.useEffect(()=>{var l;const[,,r]=s.split("/").filter(o=>!!o);if(r){const o=(l=E().config)==null?void 0:l.sections[r];if(o){i([{label:m("Appearance"),location:""},...o.buildBreadcrumb(s,a())]);return}}i(null)},[s,a]),!t||t.length<2?null:e.jsxs("div",{className:"flex items-center border-b h-60 flex-shrink-0",children:[e.jsx(w,{iconSize:"md",radius:"rounded-none",className:"text-muted h-full w-50 flex-shrink-0",elementType:D,to:`/admin/appearance/${t[t.length-2].location}`,children:e.jsx(Bt,{})}),e.jsxs("div",{className:"border-l p-10 min-w-0",children:[e.jsx("div",{className:"text-xs text-muted",children:e.jsx(n,{message:"Customizing"})}),e.jsx("div",{className:"flex items-center gap-4 text-sm mt-2",children:t.map((r,l)=>{const o=t.length-1===l,c=l===0,d=e.jsx(an,{value:r.label});return c?null:e.jsxs(u.Fragment,{children:[e.jsx("div",{className:_("whitespace-nowrap overflow-hidden overflow-ellipsis min-w-0",o&&"text-primary",o?"flex-shrink-0":"flex-auto"),children:d}),!o&&e.jsx(et,{className:"icon-sm text-muted flex-shrink-0"})]},l)})})]})]})}function Vr(){const{isAppearanceEditorActive:s}=nn(),{data:a}=$r(),{base_url:t}=ae(),i=u.useRef(null),{pathname:r}=ps();return u.useEffect(()=>{a!=null&&a.defaults&&!E().defaults&&E().setDefaults(a.defaults)},[a]),u.useEffect(()=>{i.current&&E().setIframeWindow(i.current.contentWindow)},[]),u.useEffect(()=>{const l=r.split("/")[3];E().preview.navigate(l)},[r]),s?e.jsx(Ht,{to:"/admin"}):e.jsxs("div",{className:"h-screen items-center md:flex",children:[e.jsx(Bs,{children:e.jsx(n,{message:"Appearance"})}),e.jsx(Br,{values:a==null?void 0:a.values}),e.jsx("div",{className:"relative h-full flex-auto",children:e.jsx("iframe",{ref:i,className:"h-full w-full max-md:hidden",src:`${t}?appearanceEditor=true`})})]})}function Br({values:s}){const a=e.jsx("div",{className:"flex h-full flex-auto items-center justify-center",children:e.jsx(re,{isIndeterminate:!0,"aria-label":"Loading editor"})});return e.jsx("div",{className:"relative z-10 h-full w-full border-r bg shadow-lg @container md:w-320",children:s?e.jsx(Hr,{defaultValues:s}):a})}function Hr({defaultValues:s}){const a=O({defaultValues:s}),{watch:t,reset:i}=a,r=Lr();return u.useEffect(()=>{const l=t(o=>{E().preview.setValues(o)});return()=>l.unsubscribe()},[t]),e.jsxs(J,{className:"flex h-full flex-col",form:a,onSubmit:l=>{r.mutate(l,{onSuccess:()=>i(l)})},children:[e.jsx(Wr,{isLoading:r.isPending}),e.jsx(Ur,{}),e.jsx("div",{className:"flex-auto overflow-y-auto px-14 py-20",children:e.jsx(Me,{children:e.jsx(hs,{})})})]})}function Wr({isLoading:s}){const{formState:{dirtyFields:a}}=k(),t=Object.keys(a).length;return e.jsxs("div",{className:"flex h-50 flex-shrink-0 items-center border-b pr-10",children:[e.jsx(w,{border:"border-r",className:"text-muted",elementType:D,to:"..",children:e.jsx(_e,{})}),e.jsx("div",{className:"pl-10",children:e.jsx(n,{message:"Appearance editor"})}),e.jsx(v,{variant:"flat",color:"primary",className:"ml-auto block",disabled:!t||s,type:"submit",children:t?e.jsx(n,{message:"Save"}):e.jsx(n,{message:"Saved"})})]})}function Kr(){const s=Oe(),{trans:a}=F(),{fields:t,append:i}=ye({name:"settings.menus",keyName:"key"});return e.jsxs(u.Fragment,{children:[e.jsx("div",{children:t.map((r,l)=>e.jsx(le,{to:`${l}`,elementType:D,children:r.name},r.key))}),e.jsx("div",{className:"text-right",children:e.jsx(v,{variant:"outline",color:"primary",startIcon:e.jsx(ge,{}),size:"xs",onClick:()=>{const r=Hs(10);i({name:a(m("New menu :number",{values:{number:t.length+1}})),id:r,positions:[],items:[]}),s(`${t.length}`)},children:e.jsx(n,{message:"Create menu"})})})]})}function da({title:s=e.jsx(n,{message:"Add menu item"})}){const{data:a}=ve(["menuItemCategories"]),t=(a==null?void 0:a.menuItemCategories)||[],i=oa();return e.jsxs(R,{size:"sm",children:[e.jsx(U,{children:s}),e.jsx($,{children:e.jsxs(Re,{variant:"outline",children:[e.jsx(je,{label:e.jsx(n,{message:"Link"}),bodyClassName:"max-h-240 overflow-y-auto",children:e.jsx(Gr,{})}),e.jsx(je,{label:e.jsx(n,{message:"Route"}),bodyClassName:"max-h-240 overflow-y-auto",children:e.jsx(kt,{items:i})}),t.map(r=>e.jsx(je,{label:e.jsx(n,{message:r.name}),children:e.jsx(kt,{items:r.items})},r.name))]})})]})}function Gr(){const s=O({defaultValues:{id:Hs(6),type:"link",target:"_blank"}}),{close:a}=q();return e.jsxs(J,{form:s,onSubmit:t=>{a(t)},children:[e.jsx(p,{required:!0,name:"label",label:e.jsx(n,{message:"Label"}),className:"mb-20"}),e.jsx(p,{required:!0,type:"url",name:"action",placeholder:"https://",label:e.jsx(n,{message:"Url"}),className:"mb-20"}),e.jsx("div",{className:"text-right",children:e.jsx(v,{type:"submit",variant:"flat",color:"primary",size:"xs",children:e.jsx(n,{message:"Add to menu"})})})]})}function kt({items:s}){const{close:a}=q();return e.jsx(Rt,{children:s.map(t=>e.jsx($t,{startIcon:e.jsx(ge,{size:"sm"}),onSelected:()=>
3{if(t.label){const i=t.label.split("/").pop();t.label=i?ra(i):t.label,t.id=Hs(6)}a(t)},children:t.label},t.id))})}const Qr=""+new URL("dropdown-menu-c9b3bd6a.svg",import.meta.url).href;function Jr(){const{menuIndex:s}=se(),a=Oe(),{getValues:t}=k(),i=`settings.menus.${s}`,r=t(i);return u.useEffect(()=>{r?E().preview.setHighlight(`[data-menu-id="${r.id}"]`):a("/admin/appearance/menus")},[a,r]),r?e.jsx(Yr,{formPath:i}):null}function Yr({formPath:s}){const{site:{has_mobile_app:a}}=ae(),t=$e(l=>{var o;return(o=l.config)==null?void 0:o.sections.menus.config}),i=u.useMemo(()=>{const l=[...t==null?void 0:t.positions];return a&&l.push("mobile-app-about"),l.map(o=>({key:o,name:o.replaceAll("-"," ")}))},[t,a]),r=ye({name:`${s}.items`,keyName:"key"});return e.jsxs(u.Fragment,{children:[e.jsxs("div",{className:"mb-30 border-b pb-30",children:[e.jsx(p,{name:`${s}.name`,label:e.jsx(n,{message:"Menu name"}),className:"mb-20",autoFocus:!0}),e.jsx(ls,{chipSize:"sm",name:`${s}.positions`,valueKey:"id",label:e.jsx(n,{message:"Menu positions"}),description:e.jsx(n,{message:"Where should this menu appear on the site"}),children:i.map(l=>e.jsx(j,{value:l.key,capitalizeFirst:!0,children:l.name},l.key))})]}),e.jsx(Zr,{fieldArray:r}),e.jsx("div",{className:"text-right",children:e.jsx(Xr,{})})]})}function Zr({fieldArray:{append:s,fields:a,move:t}}){const i=Oe();return e.jsxs(u.Fragment,{children:[e.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between gap-16",children:[e.jsx(n,{message:"Menu items"}),e.jsxs(I,{type:"popover",placement:"right",offset:20,onClose:r=>{r&&(s({...r}),i(`items/${a.length}`))},children:[e.jsx(v,{variant:"outline",color:"primary",size:"xs",startIcon:e.jsx(ge,{}),children:e.jsx(n,{message:"Add"})}),e.jsx(da,{})]})]}),e.jsxs("div",{className:"mt-20 flex-shrink-0",children:[a.map((r,l)=>e.jsx(el,{item:r,items:a,index:l,onSortEnd:(o,c)=>{t(o,c)}},r.key)),a.length?null:e.jsx(Ws,{size:"xs",className:"my-40",image:e.jsx(Ks,{src:Qr}),title:e.jsx(n,{message:"No menu items yet"}),description:e.jsx(n,{message:"Click âaddâ button to start adding links, pages, routes and other items to this menu. "})})]})]})}function Xr(){const s=Oe(),{menuIndex:a}=se(),{fields:t,remove:i}=ye({name:"settings.menus",keyName:"key"});if(!a)return null;const r=t[+a];return e.jsxs(I,{type:"modal",onClose:l=>{if(l){const o=t.findIndex(c=>c.id===r.id);i(o),s("/admin/appearance/menus")}},children:[e.jsx(v,{variant:"outline",color:"danger",size:"xs",startIcon:e.jsx(bs,{}),children:e.jsx(n,{message:"Delete menu"})}),e.jsx(pe,{isDanger:!0,title:e.jsx(n,{message:"Delete menu"}),body:e.jsx(n,{message:"Are you sure you want to delete â:nameâ?",values:{name:r.name}}),confirm:e.jsx(n,{message:"Delete"})})]})}function el({item:s,items:a,index:t,onSortEnd:i}){const r=u.useRef(null),{sortableProps:l,dragHandleRef:o}=mi({item:s,items:a,type:"menuEditorSortable",ref:r,onSortEnd:i,strategy:"liveSort"}),c=s.icon&&Ut(s.icon),d=e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted",children:[c&&e.jsx(c,{size:"sm"}),"(",e.jsx(n,{message:"No label..."}),")"]});return e.jsx(u.Fragment,{children:e.jsx(le,{elementType:D,to:`items/${t}`,ref:r,...l,children:e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsx(w,{ref:o,size:"sm",children:e.jsx(ea,{className:"text-muted hover:cursor-move"})}),e.jsx("div",{children:s.label||d})]})})})}function sl(){const{menuIndex:s,menuItemIndex:a}=se(),t=ce(),{getValues:i}=k(),r=`settings.menus.${s}.items.${a}`,l=i(r);return u.useEffect(()=>{l&&E().preview.setHighlight(`[data-menu-item-id="${l.id}"]`)},[t,l]),!l||a==null?null:e.jsx(tl,{formPath:r})}function tl({formPath:s}){return e.jsxs(u.Fragment,{children:[e.jsx(Ve,{formPathPrefix:s}),e.jsx("div",{className:"text-right mt-40",children:e.jsx(al,{})})]})}function al(){const s=ce(),{menuIndex:a,menuItemIndex:t}=se(),{fields:i,remove:r}=ye({name:`settings.menus.${+a}.items`});if(!t)return null;const l=i[+t];return e.jsxs(I,{type:"modal",onClose:o=>{o&&t&&(r(+t),s(`/admin/appearance/menus/${a}`))},children:[e.jsx(v,{variant:"outline",color:"danger",size:"xs",startIcon:e.jsx(bs,{}),children:e.jsx(n,{message:"Delete this item"})}),e.jsx(pe,{isDanger:!0,title:e.jsx(n,{message:"Delete menu item"}),body:e.jsx(n,{message:"Are you sure you want to delete â:nameâ?",values:{name:l.label}}),confirm:e.jsx(n,{message:"Delete"})})]})}function nl(){return e.jsxs(u.Fragment,{children:[e.jsx(Ze,{label:e.jsx(n,{message:"Favicon"}),description:e.jsx(n,{message:"This will generate different size favicons. Image should be at least 512x512 in size."}),type:"favicon"}),e.jsx(Ze,{label:e.jsx(n,{message:"Light logo"}),description:e.jsx(n,{message:"Will be used on dark backgrounds."}),type:"logo_light"}),e.jsx(Ze,{label:e.jsx(n,{message:"Dark logo"}),description:e.jsx(n,{message:"Will be used on light backgrounds. Will default to light logo if left empty."}),type:"logo_dark"}),e.jsx(Ze,{label:e.jsx(n,{message:"Mobile light logo"}),description:e.jsx(n,{message:"Will be used on light backgrounds on mobile. Will default to desktop logo if left empty."}),type:"logo_light_mobile"}),e.jsx(Ze,{label:e.jsx(n,{message:"Mobile dark logo"}),description:e.jsx(n,{message:"Will be used on dark backgrounds on mobile. Will default to desktop if left empty."}),type:"logo_dark_mobile"}),e.jsx(il,{}),e.jsx(rl,{})]})}function Ze({label:s,description:a,type:t}){const i=$e(r=>{var l;return(l=r.defaults)==null?void 0:l.settings.branding[t]});return e.jsx(De,{name:`settings.branding.${t}`,className:"border-b pb-30 mb-30",label:s,description:a,diskPrefix:"branding_media",defaultValue:i,onChange:()=>{E().preview.setHighlight('[data-logo="navbar"]')}})}function il(){return e.jsx(p,{name:"appearance.env.app_name",required:!0,className:"mt-20",label:e.jsx(n,{message:"Site name"})})}function rl(){return e.jsx(p,{name:"settings.branding.site_description",className:"mt-20",inputElementType:"textarea",rows:4,label:e.jsx(n,{message:"Site description"})})}function ll(s=1,a=1e4){const t=new Uint32Array(1);window.crypto.getRandomValues(t);const i=t[0]/(4294967295+1);return s=Math.ceil(s),a=Math.floor(a),Math.floor(i*(a-s+1))+s}function ol(){const{trans:s}=F(),a=Oe(),{data:{themes:t}}=Wt(),{fields:i,append:r}=ye({name:"appearance.themes.all",keyName:"key"});return u.useEffect(()=>{t.selectedThemeId&&E().preview.setActiveTheme(t.selectedThemeId)},[t.selectedThemeId]),e.jsxs(u.Fragment,{children:[e.jsx("div",{className:"mb-20",children:e.jsx(v,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(ge,{}),onClick:()=>{var o;const l=(o=E().defaults)==null?void 0:o.appearance.themes.light;r({id:ll(),name:s(m("New theme")),values:l}),a(`${i.length+1}`)},children:e.jsx(n,{message:"New theme"})})}),i.map((l,o)=>e.jsx(le,{to:`${o}`,elementType:Gs,children:l.name},l.key))]})}const cl=he.lazy(()=>is(()=>import("./ace-editor-79ac03f0.js"),["./ace-editor-79ac03f0.js","./main-78aa46db.js","./main-714cd21f.css","./index-2fcb5fe9.js"],import.meta.url));function mt({defaultValue:s,mode:a="html",title:t,onSave:i,isSaving:r,footerStartAction:l,beautify:o,editorRef:c}){const[d,x]=u.useState(s),[g,h]=u.useState(!0);return e.jsxs(R,{size:"fullscreen",className:"h-full w-full",children:[e.jsx(U,{children:t}),e.jsx($,{className:"relative flex-auto",padding:"p-0",children:e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"flex h-400 w-full items-center justify-center",children:e.jsx(re,{"aria-label":"Loading editor...",isIndeterminate:!0,size:"md"})}),children:e.jsx(cl,{beautify:o,mode:a,onChange:f=>x(f),defaultValue:d||"",onIsValidChange:h,editorRef:c})})}),e.jsx(dl,{disabled:!g||r,value:d,onSave:i,startAction:l})]})}function dl({disabled:s,value:a,onSave:t,startAction:i}){const{close:r}=q();return e.jsxs(Q,{dividerTop:!0,startAction:i,children:[e.jsx(v,{onClick:()=>r(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{disabled:s,variant:"flat",color:"primary",onClick:()=>{t?t(a):r(a)},children:e.jsx(n,{message:"Save"})})]})}function ua(s){return be({queryKey:["admin","seo-tags",s],queryFn:()=>ul(s)})}function ul(s){return S.get(`admin/appearance/seo-tags/${s}`).then(a=>a.data)}function ml(s){const a=rs();return A({mutationFn:t=>xl(s,t.tags),onSuccess:async()=>{await a.invalidateQueries({queryKey:["admin","seo-tags",s]}),P(m("Updated SEO tags"))},onError:t=>G(t)})}function xl(s,a){return S.put(`admin/appearance/seo-tags/${s}`,{tags:a}).then(t=>t.data)}var Mt;const ma=((Mt=ut.sections["seo-settings"].config)==null?void 0:Mt.pages)||[],xa=ma.map(s=>s.key);function gl(){const{isLoading:s}=ua(xa);return s?e.jsx(Fe,{}):e.jsx(u.Fragment,{children:ma.map(a=>e.jsx(hl,{label:a.label,name:a.key},a.key))})}function hl({label:s,name:a}){const{data:t,isLoading:i}=ua(xa);return e.jsxs(I,{type:"modal",children:[e.jsx(le,{disabled:i,children:e.jsx(n,{...s})}),t?e.jsx(pl,{name:a,value:t[a]}):null]})}function pl({name:s,value:a}){const{close:t}=q(),i=ml(s),r=u.useRef(null),l=e.jsx(v,{variant:"outline",color:"primary",onClick:()=>{r.current&&r.current.editor.setValue(a.original)},children:e.jsx(n,{message:"Reset to original"})});return e.jsx(mt,{mode:"php_laravel_blade",title:e.jsx(n,{message:"Edit SEO meta tags"}),footerStartAction:l,editorRef:r,defaultValue:a.custom||a.original,isSaving:i.isPending,beautify:!1,onSave:o=>{o!=null&&i.mutate({tags:o},{onSuccess:()=>t()})}})}function jl(){return e.jsxs(u.Fragment,{children:[e.jsx(Nt,{mode:"css"}),e.jsx(Nt,{mode:"html"})]})}function Nt({mode:s}){const{getValues:a}=k(),{setValue:t}=k(),i=s==="html"?e.jsx(n,{message:"Custom HTML & JavaScript"}):e.jsx(n,{message:"Custom CSS"});return e.jsxs(I,{type:"modal",onClose:r=>{r!=null&&(t(`appearance.custom_code.${s}`,r,{shouldDirty:!0}),E().preview.setCustomCode(s,r))},children:[e.jsx(le,{children:i}),e.jsx(mt,{title:i,defaultValue:a(`appearance.custom_code.${s}`)||"",mode:s})]})}const fl=""+new URL("articles-8bfd9f17.svg",import.meta.url).href,bl=s=>{const a=s.customPages.types.length>1?[{control:{type:oe.Select,defaultValue:"default",options:s.customPages.types.map(t=>({value:t.type,label:t.label,key:t.type}))},key:"type",label:m("Type"),description:m("Type of the page"),defaultOperator:B.eq}]:[];return[{key:"user_id",label:m("User"),description:m("User page was created by"),defaultOperator:B.eq,control:{type:oe.SelectModel,model:nt}},...a,Ie({description:m("Date page was created")}),Ee({description:m("Date page was last updated")})]},vl=[{key:"slug",allowsSorting:!0,width:"flex-2 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"Slug"}),body:s=>
3e.jsx(D,{target:"_blank",to:`/pages/${s.slug}`,className:js,children:s.slug})},{key:"user_id",allowsSorting:!0,width:"flex-2 min-w-140",header:()=>e.jsx(n,{message:"Owner"}),body:s=>s.user&&e.jsx(fe,{image:s.user.avatar,label:s.user.display_name,description:s.user.email})},{key:"type",maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Type"}),body:s=>e.jsx(n,{message:s.type})},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(X,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-84 flex-shrink-0",visibleInMode:"all",body:s=>e.jsx(w,{size:"md",className:"text-muted",elementType:D,to:`${s.id}/edit`,children:e.jsx(Ne,{})})}];function yl(){const s=u.useContext(Le),a=u.useMemo(()=>bl(s),[s]);return e.jsx(ue,{endpoint:"custom-pages",title:e.jsx(n,{message:"Custom pages"}),filters:a,columns:vl,queryParams:{with:"user"},actions:e.jsx(wl,{}),selectedActions:e.jsx(Te,{}),emptyStateMessage:e.jsx(te,{image:fl,title:e.jsx(n,{message:"No pages have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching pages"})})})}function wl(){return e.jsx(me,{elementType:D,to:"new",children:e.jsx(n,{message:"New page"})})}const Sl=[{label:m("Editor"),to:"editor"},{label:m("Marketplace"),to:"marketplace"},{label:m("Webinars"),to:"webinars"}],kl=[{label:m("General"),to:"general"},...Sl,rn().settings.billing.integrated&&{label:m("Subscriptions"),to:"subscriptions"},{label:m("Localization"),to:"localization"},{label:m("Authentication"),to:"authentication"},{label:m("Uploading"),to:"uploading"},{label:m("Outgoing email"),to:"outgoing-email"},{label:m("Cache"),to:"cache"},{label:m("Analytics"),to:"analytics"},{label:m("Logging"),to:"logging"},{label:m("Queue"),to:"queue"},{label:m("Recaptcha"),to:"recaptcha"},{label:m("GDPR"),to:"gdpr"},{label:m("Menus"),to:"/admin/appearance/menus"},{label:m("Seo"),to:"/admin/appearance/seo-settings"},{label:m("Themes"),to:"/admin/appearance/themes"}].filter(Boolean),ga=kl;function Nl({className:s}){const a=Ke();return e.jsxs("div",{className:_(s,"container mx-auto min-h-full items-start gap-30 p-24 md:flex"),children:[e.jsx(Bs,{children:e.jsx(n,{message:"Settings"})}),a?e.jsx(Cl,{}):e.jsx(_l,{}),e.jsx("div",{className:"relative max-w-500 flex-auto md:px-30",children:e.jsx(hs,{})})]})}function Cl(){const{pathname:s}=ps(),a=Oe(),t=s.split("/").pop();return e.jsx(He,{minWidth:"min-w-none",className:"mb-24 w-full bg",selectionMode:"single",selectedValue:t,onSelectionChange:i=>{a(i)},children:ga.map(i=>e.jsx(j,{value:i.to,children:e.jsx(n,{...i.label})},i.to))})}function _l(){return e.jsx("div",{className:"sticky top-24 w-240 flex-shrink-0",children:ga.map(s=>e.jsx(Gs,{to:s.to,className:({isActive:a})=>_("mb-8 block whitespace-nowrap rounded-button p-14 text-sm transition-bg-color",a?"bg-primary/6 font-semibold text-primary":"hover:bg-hover"),children:e.jsx(n,{...s.label})},s.to))})}function os(){return be({queryKey:["fetchAdminSettings"],queryFn:()=>Il(),staleTime:1/0})}function Il(){return S.get("settings").then(s=>s.data)}const Cs=s=>s instanceof Date,Pl=s=>Object.keys(s).length===0,Ds=s=>s!=null&&typeof s=="object",Ct=(s,...a)=>Object.prototype.hasOwnProperty.call(s,...a),_s=s=>Ds(s)&&Pl(s),Fl=()=>Object.create(null),Ms=(s,a)=>
3{if(s===a)return{};if(!Ds(s)||!Ds(a))return a;const t=Object.keys(s).reduce((i,r)=>(Ct(a,r)||(i[r]=void 0),i),Fl());return Cs(s)||Cs(a)?s.valueOf()==a.valueOf()?{}:a:Object.keys(a).reduce((i,r)=>{if(!Ct(s,r))return i[r]=a[r],i;const l=Ms(s[r],a[r]);return _s(l)&&!Cs(l)&&(_s(s[r])||!_s(a[r]))||(i[r]=l),i},t)};function ha(s){const{data:a}=os();return A({mutationFn:t=>{var l,o,c,d,x,g,h,f,b,N,y;(o=(l=t.client)==null?void 0:l.cookie_notice)!=null&&o.button&&(t.client.cookie_notice.button=JSON.stringify(t.client.cookie_notice.button)),(d=(c=t.client)==null?void 0:c.registration)!=null&&d.policies&&(t.client.registration.policies=JSON.stringify(t.client.registration.policies)),(g=(x=t.client)==null?void 0:x.artistPage)!=null&&g.tabs&&(t.client.artistPage.tabs=JSON.stringify(t.client.artistPage.tabs)),(f=(h=t.client)==null?void 0:h.title_page)!=null&&f.sections&&(t.client.title_page.sections=JSON.stringify(t.client.title_page.sections)),(b=t.client)!=null&&b.incoming_email&&(t.client.incoming_email=JSON.stringify(t.client.incoming_email)),(y=(N=t.client)==null?void 0:N.publish)!=null&&y.default_credentials&&(t.client.publish.default_credentials=JSON.stringify(t.client.publish.default_credentials));const i=t.client?Ms(a.client,t.client):null,r=t.server?Ms(a.server,t.server):null;return Al({client:i,server:r,files:t.files})},onSuccess:()=>{P(m("Settings updated"),{position:"bottom-right"}),T.invalidateQueries({queryKey:["fetchAdminSettings"]})},onError:t=>ee(t,s)})}function Al({client:s,server:a,files:t}){const i=new FormData;return s&&i.set("client",JSON.stringify(vt.dot(s))),a&&i.set("server",JSON.stringify(vt.dot(a))),Object.entries(t||{}).forEach(([r,l])=>{i.set(r,l)}),S.post("settings",i,{headers:{"Content-Type":"multipart/form-data"}}).then(r=>r.data)}function ne({title:s,description:a,children:t,transformValues:i,headerMargin:r="mb-40"}){const{data:l}=os();return e.jsxs("section",{children:[e.jsxs("div",{className:r,children:[e.jsx("h2",{className:"mb-4 text-xl",children:s}),e.jsx("div",{className:"text-sm text-muted",children:a})]}),l?e.jsx(zl,{defaultValues:l,transformValues:i,children:t}):e.jsx(re,{isIndeterminate:!0,"aria-label":"Loading settings..."})]})}function zl({children:s,defaultValues:a,transformValues:t}){const i=O({defaultValues:a}),r=ha(i);return e.jsxs(u.Fragment,{children:[e.jsxs(J,{form:i,onBeforeSubmit:()=>{const l=i.formState.errors,o=Object.keys(l).filter(c=>c.endsWith("_group"));i.clearErrors(o)},onSubmit:l=>{l=t?t(l):l,r.mutate(l)},children:[s,e.jsx("div",{className:"mt-40",children:e.jsx(v,{type:"submit",variant:"flat",color:"primary",disabled:r.isPending,children:e.jsx(n,{message:"Update"})})})]}),r.isPending&&e.jsx(ln,{size:"xs",className:"absolute -bottom-14 left-30 w-full",isIndeterminate:!0,"aria-label":"Saving settings..."})]})}function de(){return e.jsx("div",{className:"h-1 bg-divider my-30"})}function Pe({link:s,className:a}){const{site:t}=ae();return t.hide_docs_button?null:e.jsxs("div",{className:_("flex items-center gap-8",a),children:[e.jsx(st,{size:"sm"}),e.jsx(fs,{href:s,children:e.jsx(n,{message:"Learn more"})})]})}function El(){return A({mutationFn:()=>Tl(),onSuccess:()=>{P(m("Sitemap generated"))},onError:s=>G(s)})}function Tl(){return S.post("sitemap/generate").then(s=>s.data)}function Dl(){return e.jsxs(ne,{title:e.jsx(n,{message:"General"}),description:e.jsx(n,{message:"Configure site url, homepage, theme and other general settings."}),children:[e.jsx(Ml,{}),e.jsx(de,{}),e.jsx(Ol,{}),e.jsx(de,{}),e.jsx(Ll,{}),e.jsx(de,{}),e.jsx(Rl,{})]})}function Ml(){const{data:s}=os();if(!s)return null;let a=null;const t=s.server,i=t.newAppUrl&&t.newAppUrl!==t.app_url;return i&&(a=e.jsx("div",{className:"mt-20 text-sm text-danger",children:e.jsx(n,{values:{baseUrl:t.app_url,currentUrl:t.newAppUrl,b:r=>e.jsx("b",{children:r})},message:"Base site url is set as <b>:baseUrl</b> in configuration, but current url is <b>:currentUrl</b>. It is recommended to set the primary url you want to use in configuration file and then redirect all other url versions to this primary version via cpanel or .htaccess file."})})),e.jsxs(u.Fragment,{children:[e.jsx(p,{invalid:!!i,name:"server.app_url",label:e.jsx(n,{message:"Primary site url"}),description:e.jsx(Pe,{link:"https://support.vebto.com/hc/articles/35/primary-site-url"})}),a]})}function Ol(){var r,l;const{watch:s}=k(),{homepage:a}=u.useContext(Le),{data:t}=ve(["menuItemCategories"]),i=s("client.homepage.type");return e.jsxs("div",{children:[e.jsxs(M,{name:"client.homepage.type",selectionMode:"single",label:e.jsx(n,{message:"Site home page"}),description:e.jsx(n,{message:"Which page should be used as site homepage."}),children:[a.options.map(o=>e.jsx(j,{value:o.value,children:e.jsx(n,{...o.label})},o.value)),(r=t==null?void 0:t.menuItemCategories)==null?void 0:r.map(o=>e.jsx(j,{value:o.type,children:o.name},o.type))]}),(l=t==null?void 0:t.menuItemCategories)==null?void 0:l.map(o=>
3i===o.type?e.jsx(M,{className:"mt-24",name:"client.homepage.value",selectionMode:"single",label:e.jsx(n,{message:"Homepage :name",values:{name:o.name}}),children:o.items.map(c=>e.jsx(j,{value:c.model_id,children:c.label},c.label))},o.name):null)]})}function Ll(){const{data:{themes:s}}=Wt();return e.jsxs(u.Fragment,{children:[e.jsxs(M,{className:"mb-20",name:"client.themes.default_id",selectionMode:"single",label:e.jsx(n,{message:"Default site theme"}),description:e.jsx(n,{message:"Which theme to use for users that have not chosen a theme manually."}),children:[e.jsx(j,{value:0,children:e.jsx(n,{message:"System"})}),s.all.map(a=>e.jsx(j,{value:a.id,children:a.name},a.id))]}),e.jsx(C,{name:"client.themes.user_change",description:e.jsx(n,{message:"Allow users to manually change site theme."}),children:e.jsx(n,{message:"Allow theme change"})})]})}function Rl(){const s=El(),{base_url:a}=ae(),t=`${a}/storage/sitemaps/sitemap-index.xml`,i=e.jsx(fs,{href:t,children:t});return e.jsxs(e.Fragment,{children:[e.jsx(v,{variant:"outline",size:"xs",color:"primary",disabled:s.isPending,onClick:()=>{s.mutate()},children:e.jsx(n,{message:"Generate sitemap"})}),e.jsx("div",{className:"mt-14 text-sm text-muted",children:e.jsx(n,{message:"Once generated, sitemap url will be: :url",values:{url:i}})})]})}function _t(s){return sa(s).toString("rgb").replace("rgb(","").replace(")","").replace(/, ?/g," ")}const $l=H(e.jsx("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}),"TuneOutlined");function ql(){const{getValues:s,setValue:a}=k(),{themeIndex:t}=se(),i=s(`appearance.themes.all.${+t}`);return e.jsxs(I,{type:"modal",onClose:r=>{r&&s("appearance.themes.all").forEach((l,o)=>{if(l.id===r.id){a(`appearance.themes.all.${o}`,r,{shouldDirty:!0});return}if(r.default_light){a(`appearance.themes.all.${o}`,{...l,default_light:!1},{shouldDirty:!0});return}if(r.default_dark){a(`appearance.themes.all.${o}`,{...l,default_dark:!1},{shouldDirty:!0});return}})},children:[e.jsx(v,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx($l,{}),children:e.jsx(n,{message:"Settings"})}),e.jsx(Ul,{theme:i})]})}function Ul({theme:s}){const a=O({defaultValues:s}),{close:t,formId:i}=q();return u.useEffect(()=>{const r=a.watch((l,{name:o})=>{o==="default_light"&&l.default_light&&a.setValue("default_dark",!1),o==="default_dark"&&l.default_dark&&a.setValue("default_light",!1)});return()=>r.unsubscribe()},[a]),e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Update settings"})}),e.jsx($,{children:e.jsxs(J,{form:a,id:i,onSubmit:r=>{t(r)},children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-30",autoFocus:!0}),e.jsx(C,{name:"is_dark",className:"mb-20 pb-20 border-b",description:e.jsx(n,{message:"Whether this theme has light text on dark background."}),children:e.jsx(n,{message:"Dark theme"})}),e.jsx(C,{name:"default_light",className:"mb-30",description:e.jsx(n,{message:"When light mode is selected, this theme will be used."}),children:e.jsx(n,{message:"Default for light mode"})}),e.jsx(C,{name:"default_dark",description:e.jsx(n,{message:"When dark mode is selected, this theme will be used."}),children:e.jsx(n,{message:"Default for dark mode"})})]})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>{t()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{variant:"flat",color:"primary",type:"submit",form:i,disabled:!a.formState.isDirty,children:e.jsx(n,{message:"Save"})})]})]})}const Vl=H(e.jsx("path",{d:"M6 13c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91zm14 0c0-4.42-3.58-8-8-8-.06 0-.12.01-.18.01l1.09-1.09L11.5 2.5 8 6l3.5 3.5 1.41-1.41-1.08-1.08c.06 0 .12-.01.17-.01 3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93z"}),"RestartAltOutlined");function Bl(){const s=ce(),{themeIndex:a}=se(),[t,i]=u.useState(!1),{setValue:r,getValues:l}=k(),{fields:o,remove:c}=ye({name:"appearance.themes.all"}),d=()=>{if(o.length<=1){P.danger(m("At least one theme is required"));return}a&&(s("/admin/appearance/themes"),c(+a),r("appearance.themes.selectedThemeId",null))};return e.jsxs(u.Fragment,{children:[e.jsxs(Ae,{onItemSelected:x=>
3{if(x==="delete")i(!0);else if(x==="reset"){const g=`appearance.themes.all.${+a}`,h=l(`${g}.is_dark`)?E().defaults.appearance.themes.dark:E().defaults.appearance.themes.light;Object.entries(h).forEach(([f,b])=>{E().preview.setThemeValue(f,b)}),E().preview.setThemeFont(null),r(`${g}.values`,h,{shouldDirty:!0}),r(`${g}.font`,void 0,{shouldDirty:!0})}},children:[e.jsx(w,{size:"md",className:"text-muted",children:e.jsx(Ss,{})}),e.jsxs(ze,{children:[e.jsx(j,{value:"reset",startIcon:e.jsx(Vl,{}),children:e.jsx(n,{message:"Reset colors"})}),e.jsx(j,{value:"delete",startIcon:e.jsx(bs,{}),children:e.jsx(n,{message:"Delete"})})]})]}),e.jsx(I,{type:"modal",isOpen:t,onClose:x=>{x&&d(),i(!1)},children:e.jsx(pe,{isDanger:!0,title:e.jsx(n,{message:"Delete theme"}),body:e.jsx(n,{message:"Are you sure you want to delete this theme?"}),confirm:e.jsx(n,{message:"Delete"})})})]})}const It=[{label:m("Accent"),value:"primary",bgColor:"bg-primary",previewBgColor:"text-primary"},{label:m("Background"),value:"bg",bgColor:"bg-background",previewBgColor:"text-background"},{label:m("Background alt"),value:"bg-alt",bgColor:"bg-alt",previewBgColor:"text-background-alt"},{label:m("Transparent"),value:"transparent",bgColor:"bg-transparent",previewBgColor:"text-transparent"}];function Hl(){var o;const{themeIndex:s}=se(),{watch:a,setValue:t}=k(),i=`appearance.themes.all.${s}.values.--be-navbar-color`,r=a(i),l=(o=It.find(({value:c})=>c===r))==null?void 0:o.previewBgColor;return e.jsxs(Ae,{placement:"right",selectionMode:"single",selectedValue:r,onSelectionChange:c=>{t(i,c,{shouldDirty:!0})},children:[e.jsx(le,{startIcon:e.jsx(ot,{viewBox:"0 0 48 48",className:_("icon-lg",l)}),children:e.jsx(n,{message:"Navbar"})}),e.jsx(ze,{children:It.map(({label:c,value:d,bgColor:x})=>e.jsx(j,{value:d,startIcon:e.jsx("div",{className:_("h-20 w-20 rounded border",x)}),children:e.jsx(n,{...c})},d))})]})}function Wl(s){try{return sa(`rgb(${s.split(" ").join(",")})`).toString("hex")}catch{return s}}const Kl=[{label:m("Background"),key:"--be-background"},{label:m("Background alt"),key:"--be-background-alt"},{label:m("Foreground"),key:"--be-foreground-base"},{label:m("Accent light"),key:"--be-primary-light"},{label:m("Accent"),key:"--be-primary"},{label:m("Accent dark"),key:"--be-primary-dark"},{label:m("Text on accent"),key:"--be-on-primary"},{label:m("Chip"),key:"--be-background-chip"}];function Gl(){const s=Oe(),{themeIndex:a}=se(),{getValues:t,watch:i}=k(),r=t(`appearance.themes.all.${+a}`),l=i(`appearance.themes.all.${+a}.font.family`);return u.useEffect(()=>{r||s("/admin/appearance/themes")},[s,r]),u.useEffect(()=>{r!=null&&r.id&&E().preview.setActiveTheme(r.id)},[r==null?void 0:r.id]),r?e.jsxs(u.Fragment,{children:[e.jsxs("div",{className:"mb-20 flex items-center justify-between gap-10",children:[e.jsx(ql,{}),e.jsx(Bl,{})]}),e.jsxs("div",{children:[e.jsx(le,{elementType:D,to:"font",description:l||e.jsx(n,{message:"System"}),children:e.jsx(n,{message:"Font"})}),e.jsx(le,{elementType:D,to:"radius",children:e.jsx(n,{message:"Rounding"})}),e.jsx("div",{className:"mb-6 mt-22 text-sm font-semibold",children:e.jsx(n,{message:"Colors"})}),e.jsx(Hl,{}),Kl.map(o=>e.jsx(Ql,{colorName:o.key,label:e.jsx(n,{...o.label}),initialThemeValue:r.values[o.key],theme:r},o.key))]})]}):null}function Ql({label:s,theme:a,colorName:t,initialThemeValue:i}){const{setValue:r}=k(),{themeIndex:l}=se(),[o,c]=u.useState(i),d=x=>{c(x),E().preview.setThemeValue(t,x)};return u.useEffect(()=>{c(i)},[i]),e.jsxs(I,{value:Wl(o),type:"popover",placement:"right",offset:10,onValueChange:x=>{d(_t(x))},onClose:(x,{valueChanged:g,initialValue:h})=>{x&&g?(r(`appearance.themes.all.${+l}.values.${t}`,_t(x),{shouldDirty:!0}),r("appearance.themes.selectedThemeId",a.id)):d(h)},children:[e.jsx(le,{className:"capitalize",startIcon:e.jsx(ot,{viewBox:"0 0 48 48",className:"icon-lg",style:{fill:`rgb(${o})`}}),children:s}),e.jsx(rt,{})]})}function as({children:s,...a}){const{field:{onChange:t,onBlur:i,value:r=[],ref:l},fieldState:{invalid:o,error:c}}=Ge({name:a.name}),d=u.useMemo(()=>{const g=r;return typeof g=="string"?JSON.parse(g):g}
3,[r]),x={onChange:g=>{const h=JSON.stringify(g.map(f=>f.name));t(h)},onBlur:i,value:d,invalid:o,errorMessage:c==null?void 0:c.message};return e.jsx(Vn,{ref:l,...ns(x,a)})}function Jl(){return e.jsx(ne,{title:e.jsx(n,{message:"Editor"}),description:e.jsx(n,{message:"Configure the site editor and user dashboard settings."}),children:e.jsxs(vs,{isLazy:!0,children:[e.jsxs(ys,{children:[e.jsx(Ce,{children:e.jsx(n,{message:"General"})}),e.jsx(Ce,{children:e.jsx(n,{message:"Exporting"})})]}),e.jsxs(tt,{className:"mt-24",children:[e.jsx(We,{children:e.jsx(Yl,{})}),e.jsx(We,{children:e.jsx(to,{})})]})]})})}function Yl(){const{trans:s}=F();return e.jsxs(u.Fragment,{children:[e.jsx(C,{className:"mb-24",name:"client.builder.enable_subdomains",description:e.jsxs("div",{children:[e.jsx(n,{message:"Should user projects be accessible via subdomain on your site."}),e.jsx(Pe,{className:"mt-6",link:"https://support.vebto.com/hc/articles/5/9/156/custom-domains#sub-domain"})]}),children:e.jsx(n,{message:"Subdomains"})}),e.jsx(C,{className:"mb-24",name:"client.builder.enable_custom_domains",description:e.jsxs("div",{children:[e.jsx(n,{message:"Should users be able to connect their own custom domains. This can also be c
3ontrolled via permissions."}),e.jsx(Pe,{className:"mt-6",link:"https://support.vebto.com/hc/articles/5/9/156/custom-domains#custom-domains"})]}),children:e.jsx(n,{message:"Custom domains"})}),e.jsx(p,{name:"server.openai_api_key",className:"mb-24",label:e.jsx(n,{message:"OpenAI API key"}),description:e.jsx(n,{message:"Used for various AI powered functionality in site editor."})}),e.jsx(p,{name:"server.runway_api_key",className:"mb-24",label:e.jsx(n,{message:"Runway API key"}),description:e.jsx(n,{message:"Used for AI video generation. Saved to server environment; ensure .env is writable."})}),e.jsx(so,{}),e.jsx(p,{name:"client.builder.logo_image_model",className:"mb-24",label:e.jsx(n,{message:"Logo image model"}),description:e.jsx(n,{message:"OpenAI model id used for logo generation."})}),e.jsx(as,{name:"client.builder.logo_prompt_presets",label:e.jsx(n,{message:"Logo prompt presets"}),placeholder:s(m("Add prompt...")),description:e.jsx(n,{message:"These presets appear in site wizard logo step. Use {{businessName}} and {{niche}} placeholders if needed."})}),e.jsx(Zl,{}),e.jsx(p,{name:"client.builder.server_ip",className:"mb-24",label:e.jsx(n,{message:"Server IP for domain DNS"}),description:e.jsx(n,{message:"Used for automatic A-record setup during domain purchase. Leave empty only if SERVER_IP env is configured."})}),e.jsx(as,{name:"client.builder.template_categories",label:e.jsx(n,{message:"Template Categories"}),placeholder:s(m("Add category...")),description:e.jsx(n,{message:"Used for filtering templates on new site page in user dashboard."})}),e.jsx(Xl,{}),e.jsx(de,{}),e.jsx("div",{className:"mb-14 text-sm font-semibold",children:e.jsx(n,{message:"Domain purchase (Enom)"})}),e.jsx(p,{name:"billing.domain_price_cents",type:"number",className:"mb-14",label:e.jsx(n,{message:"Domain price (cents)"}),description:e.jsx(n,{message:"Price in cents shown to users for domain purchases (used for Stripe/PayPal checkout)."})}),e.jsx(p,{name:"billing.domain_currency",className:"mb-24",label:e.jsx(n,{message:"Domain currency"}),placeholder:"usd",description:e.jsx(n,{message:"3-letter currency code (e.g. USD, EUR)."})}),e.jsx(p,{name:"server.enom_api_user",className:"mb-14",label:e.jsx(n,{message:"Enom API user"}),description:e.jsx(n,{message:"Saved to server environment. Ensure .env is writable by the web server."})}),e.jsx(p,{name:"server.enom_api_key",type:"password",className:"mb-14",label:e.jsx(n,{message:"Enom API key"}),description:e.jsx(n,{message:"Saved to server environment. If saving fails, check permissions and php error logs."})}),e.jsx(C,{name:"server.enom_sandbox",className:"mb-24",children:e.jsx(n,{message:"Use Enom sandbox"})}),e.jsx(eo,{}),e.jsx(de,{}),e.jsx("div",{className:"mb-14 text-sm font-semibold",children:e.jsx(n,{message:"Default WHOIS contact (used on purchase)"})}),e.jsx(p,{name:"client.enom_contact.organization",className:"mb-14",label:e.jsx(n,{message:"Organization (optional)"})}),e.jsx(p,{name:"client.enom_contact.phone",className:"mb-14",label:e.jsx(n,{message:"Phone"})}),e.jsx(p,{name:"client.enom_contact.address1",className:"mb-14",label:e.jsx(n,{message:"Address line 1"})}),e.jsx(p,{name:"client.enom_contact.address2",className:"mb-14",label:e.jsx(n,{message:"Address line 2"})}),e.jsxs("div",{className:"grid gap-14 md:grid-cols-2",children:[e.jsx(p,{name:"client.enom_contact.city",label:e.jsx(n,{message:"City"})}),e.jsx(p,{name:"client.enom_contact.state",label:e.jsx(n,{message:"State/Province"})})]}),e.jsxs("div",{className:"grid gap-14 md:grid-cols-2 mt-14",children:[e.jsx(p,{name:"client.enom_contact.postal",label:e.jsx(n,{message:"Postal code"})}),e.jsx(p,{name:"client.enom_contact.country",label:e.jsx(n,{message:"Country (ISO alpha-2)"})})]}),e.jsx("div",{className:"mt-14",children:e.jsx(C,{name:"client.enom_contact.whois_privacy",children:e.jsx(n,{message:"Enable WHOIS privacy (default on)"})})})]})}function Zl(){var c,d;const s=k(),a=(c=s==null?void 0:s.watch)==null?void 0:c.call(s,"client.builder.logo_prompt_presets"),t=(d=s==null?void 0:s.watch)==null?void 0:d.call(s,"client.builder.default_logo_prompt_preset"),r=(x=>{const g=h=>h.filter(f=>typeof f=="string"&&f.trim().length>0).map(f=>f.trim());if(Array.isArray(x))return g(x);
3if(typeof x=="string")try{const h=JSON.parse(x);if(Array.isArray(h))return g(h)}catch{return[]}return[]})(a),l=typeof t=="string"?t.trim():"",o=!!l&&!r.includes(l);return e.jsxs("div",{className:"mb-24",children:[e.jsx("label",{className:"mb-8 block text-sm font-medium",children:e.jsx(n,{message:"Default logo prompt preset"})}),e.jsxs("select",{className:"min-h-42 w-full rounded-panel border bg px-12 text-sm",value:l,onChange:x=>s.setValue("client.builder.default_logo_prompt_preset",x.target.value,{shouldDirty:!0}),children:[e.jsx("option",{value:"",children:"Use first preset"}),o?e.jsx("option",{value:l,children:l}):null,r.map(x=>e.jsx("option",{value:x,children:x},x))]}),e.jsx("div",{className:"mt-8 text-xs text-muted",children:e.jsx(n,{message:"Choose which logo prompt preset should be preselected in the site wizard logo step."})})]})}function Xl(){var d,x;const s=k(),[a,t]=u.useState(null),i=(d=s==null?void 0:s.watch)==null?void 0:d.call(s,"client.builder.template_categories");let r=[];if(Array.isArray(i))r=i;else if(typeof i=="string")try{const g=JSON.parse(i);r=Array.isArray(g)?g:[]}catch{r=[]}const l=((x=s==null?void 0:s.watch)==null?void 0:x.call(s,"client.builder.template_category_icons"))||{},o=(g,h)=>{if(h<0||h>=r.length||g===h)return;const f=[...r],[b]=f.splice(g,1);f.splice(h,0,b),s.setValue("client.builder.template_categories",JSON.stringify(f),{shouldDirty:!0})},c=(g,h)=>{const f=r.indexOf(g),b=r.indexOf(h);o(f,b)};if(l&&Object.values(l).some(g=>typeof g=="string"&&/\bfa[sbrnd]?\b|\bfa-/.test(g))&&!document.getElementById("fa-cdn-css")){const g=document.createElement("link");g.id="fa-cdn-css",g.rel="stylesheet",g.href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css",g.crossOrigin="anonymous",document.head.appendChild(g)}return e.jsxs("div",{className:"mt-24",children:[e.jsx("div",{className:"mb-8 font-medium",children:e.jsx(n,{message:"Template Category Icons (optional)"})}),e.jsx("div",{className:"text-xs text-muted mb-12",children:e.jsx(n,{message:"Set an icon per category. You can use emoji or FontAwesome classes (e.g. 'fa-solid fa-bolt')."})}),e.jsx("div",{className:"mb-12 text-xs text-muted",children:e.jsx(n,{message:"Use the drag handle or arrows to rearrange category order."})}),e.jsx("div",{className:"grid gap-10",children:r.map((g,h)=>{const f=(l==null?void 0:l[g])||"";return e.jsxs("div",{className:`flex items-center gap-12 rounded border border-transparent px-8 py-6 ${a===g?"bg-chip opacity-70":""}`,onDragOver:b=>{a&&b.preventDefault()},onDrop:b=>{b.preventDefault(),a&&a!==g&&c(a,g),t(null)},children:[e.jsx("button",{type:"button",draggable:!0,className:"cursor-grab text-muted transition-colors hover:text-main",onDragStart:b=>{b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("text/plain",g),t(g)},onDragEnd:()=>t(null),"aria-label":`Drag ${g}`,children:e.jsx(ea,{})}),e.jsx("div",{className:"w-160 capitalize truncate",children:g}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(w,{size:"xs",variant:"outline",onClick:()=>o(h,h-1),disabled:h===0,children:e.jsx(xi,{})}),e.jsx(w,{size:"xs",variant:"outline",onClick:()=>o(h,h+1),disabled:h===r.length-1,children:e.jsx(Bn,{})})]}),e.jsx("div",{className:"w-40 h-40 flex items-center justify-center rounded border",children:f?f.startsWith("fa")||f.includes("fa-")?e.jsx("span",{className:`${f} text-xl`}):e.jsx("span",{className:"text-xl",children:f}):e.jsx("span",{className:"text-muted text-xs",children:"-"})}),e.jsx(xe,{className:"flex-auto",size:"sm",label:null,placeholder:"emoji or FontAwesome classes",value:f,onChange:b=>{const N={...l||{},[g]:b.target.value};s.setValue("client.builder.template_category_icons",N)}}),e.jsxs(I,{type:"modal",children:[e.jsx(v,{size:"xs",variant:"outline",children:e.jsx(n,{message:"Choose icon"})}),e.jsx(gi,{})]})]},g)})})]})}function eo(){const[s,a]=u.useState(!1),[t,i]=u.useState(null),[r,l]=u.useState(null),o=async()=>{var c,d;a(!0),l(null);try{(await S.get("domains/suggest",{params:{query:"site"}}).then(g=>g.data)).enomConfigured?(i("ok"),l("Enom API configured.")):(i("fail"),l("Enom not configured. Using local suggestions only."))}catch(x){i("fail"),l(((d=(c=x==null?void 0:x.response)==null?void 0:c.data)==null?void 0:d.message)||"Could not reach suggestions endpoint.")}finally{a(!1)}};return e.jsxs("div",{className:"mb-24 flex items-center gap-12",children:[e.jsx(v,{size:"xs",variant:"outline",onClick:o,disabled:s,children:s?e.jsx(re,{isIndeterminate:!0,size:"xs"}):e.jsx(n,{message:"Check Enom status"})}),t==="ok"&&e.jsx("span",{className:"text-xs text-positive",children:e.jsx(n,{message:"OK"})}),t==="fail"&&e.jsx("span",{className:"text-xs text-warning",children:e.jsx(n,{message:"Not configured"})}),r&&e.jsx("span",{className:"text-xs text-muted",children:r})]})}function so(){const s=k(),[a,t]=u.useState(!1),[i,r]=u.useState(null),[l,o]=u.useState(null),c=async()=>{var d,x,g,h;t(!0),o(null);try{const f=(d=s==null?void 0:s.getValues)==null?void 0:d.call(s,"server.runway_api_key"),b=await S.get("ai/runway/status",{params:{key:f}}).then(N=>N.data);if(!b.configured)r("fail"),o("RUNWAY_API_KEY is not configured.");else if(b.ok){r("ok");const N=(x=b.organization)==null?void 0:x.creditBalance;o(N!=null?`Configured. Credits: ${N}`:"Configured.")}else{r("fail");const N=b.status?` (${b.status})`:"";o(`Could not reach Runway API${N}. ${b.error?JSON.stringify(b.error):""}`)}}catch(f){r("fail"),o(((h=(g=f==null?void 0:f.response)==null?void 0:g.data)==null?void 0:h.message)||"Request failed.")}finally{t(!1)}};return e.jsxs("div",{className:"mb-24 flex items-center gap-12",children:[e.jsx(v,{size:"xs",variant:"outline",onClick:c,disabled:a,children:a?e.jsx(re,{isIndeterminate:!0,size:"xs"}):e.jsx(n,{message:"Check Runway status"})}),i==="ok"&&e.jsx("span",{className:"text-xs text-positive",children:e.jsx(n,{message:"OK"})}),i==="fail"&&e.jsx("span",{className:"text-xs text-warning",children:e.jsx(n,{message:"Not configured / Unreachable"})}),l&&e.jsx("span",{className:"text-xs text-muted",children:l})]})}function to(){return e.jsxs(u.Fragment,{children:[e.jsx(C,{className:"mb-24",n
3ame:"client.publish.allow_credential_change",description:e.jsx(n,{message:"Whether users should be able to enter their own FTP credentials when exorting their site. If disabled, credentials provided below will be used when exporting site via FTP."}),children:e.jsx(n,{message:"Allow custom FTP credentials"})}),e.jsx(de,{}),e.jsx("div",{className:"mb-14 text-sm font-semibold",children:e.jsx(n,{message:"Default FTP credentials for site exporting"})}),e.jsx(p,{name:"client.publish.default_credentials.host",label:e.jsx(n,{message:"Host"}),required:!0,size:"sm",className:"mb-14"}),e.jsx(p,{name:"client.publish.default_credentials.username",label:e.jsx(n,{message:"Username"}),required:!0,size:"sm",className:"mb-14"}),e.jsx(p,{name:"client.publish.default_credentials.password",type:"password",label:e.jsx(n,{message:"Password"}),required:!0,size:"sm",className:"mb-14"}),e.jsx(p,{name:"client.publish.default_credentials.directory",label:e.jsx(n,{message:"Directory"}),size:"sm",className:"mb-14",description:e.jsx(n,{message:"In which directory on your FTP server should site files be stored. Leave empty to store at root."})}),e.jsx(p,{name:"client.publish.default_credentials.port",type:"number",min:1,label:e.jsx(n,{message:"Port"}),placeholder:"21",className:"mb-14",size:"sm"}),e.jsx(C,{name:"client.publish.default_credentials.ssl",className:"mb-10",children:e.jsx(n,{message:"Use SSL"})})]})}function ao(){return e.jsxs(ne,{title:e.jsx(n,{message:"Marketplace"}),description:e.jsx(n,{message:"Configure Buildsites to launch directly into BS Marketplace with linked accounts and plan-aware access."}),children:[e.jsx(p,{name:"client.marketplace.url",className:"mb-24",label:e.jsx(n,{message:"Marketplace URL"}),placeholder:"https://marketplace.buildsites.ai",description:e.jsx(n,{message:"Where Buildsites should redirect users when they open the marketplace."})}),e.jsx(p,{name:"server.marketplace_sso_secret",type:"password",className:"mb-24",label:e.jsx(n,{message:"Marketplace SSO shared secret"}),description:e.jsx(n,{message:"This same secret must also exist on marketplace.buildsites.ai so signed SSO handoffs can be verified."})}),e.jsx(de,{}),e.jsx("div",{className:"mb-14 text-sm font-semibold",children:e.jsx(n,{message:"Default access for direct Buildsites signups"})}),e.jsx("div",{className:"mb-24 text-xs text-muted",children:e.jsx(n,{message:"These defaults are only used when a user does not already receive marketplace permissions from their Buildsites plan. Plan-specific marketplace permissions and quotas always win."})}),e.jsx(C,{name:"client.marketplace.defaults.customer_access",className:"mb-20",children:e.jsx(n,{message:"Allow customer onboarding by default"})}),e.jsx(C,{name:"client.marketplace.defaults.vendor_access",className:"mb-20",children:e.jsx(n,{message:"Allow vendor onboarding by default"})}),e.jsx(C,{name:"client.marketplace.defaults.affiliate_access",className:"mb-24",children:e.jsx(n,{message:"Allow affiliate onboarding by default"})}),e.jsx(p,{name:"client.marketplace.defaults.product_limit",type:"number",min:0,className:"mb-20",label:e.jsx(n,{message:"Default product limit"}),description:e.jsx(n,{message:"Optional fallback quota for marketplace products when vendor access comes from defaults instead of a plan permission."})}),e.jsx(p,{name:"client.marketplace.defaults.affiliate_limit",type:"number",min:0,label:e.jsx(n,{message:"Default affiliate limit"}),description:e.jsx(n,{message:"Optional fallback quota for how many affiliates a default-access vendor can work with."})})]})}const no={title:"",description:"",source_type:"upload",file_entry_id:null,video_url:"",thumbnail_url:"",is_active:!0,sort_order:"0",playback_url:""};function io(){var l;const[s,a]=u.useState(null),t=be({queryKey:["admin-webinars"],queryFn:()=>S.get("webinars",{params:{all:1}}).then(o=>o.data.webinars)}),i=o=>{if(!o){a({...no});return}a({id:o.id,title:o.title,description:o.description??"",source_type:o.source_type,file_entry_id:o.file_entry_id??null,video_url:o.video_url??"",thumbnail_url:o.thumbnail_url??"",is_active:o.is_active,sort_order:`${o.sort_order??0}`,playback_url:o.playback_url??""})},r=async o=>{window.confirm(`Delete "${o.title}"?`)&&(await S.delete(`webinars/${o.id}`),P.positive("Webinar deleted"),await t.refetch())};return e.jsxs(Me,{children:[e.jsxs(ne,{title:e.jsx(n,{message:"Webinars"}),description:e.jsx(n,{values:{a:o=>e.jsx(D,{className:js,to:"/admin/plans",children:o})},message:"Upload webinar videos or add external webinar embeds for your customers. Grant plan access from <a>Admin Plans</a> using the new webinar permission."}),children:[e.jsxs("div",{className:"mb-20 flex items-center justify-between gap-12",children:[e.jsx("div",{className:"text-sm text-muted",children:e.jsx(n,{message:"Only users whose plans include webinar access will see these items inside the dashboard."})}),e.jsx(v,{variant:"flat",color:"primary",onClick:()=>i(),children:e.jsx(n,{message:"Add webinar"})})]}),(l=t.data)!=null&&l.length?e.jsx("div",{className:"space-y-14",children:t.data.map(o=>
3e.jsxs("div",{className:"flex flex-col gap-14 rounded-panel border p-16 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-14",children:[o.thumbnail_url?e.jsx("img",{src:o.thumbnail_url,alt:o.title,className:"h-72 w-120 rounded-panel object-cover"}):e.jsx("div",{className:"flex h-72 w-120 items-center justify-center rounded-panel bg-primary/10 px-10 text-center text-sm font-semibold text-primary",children:o.title}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-8",children:[e.jsx("div",{className:"truncate text-base font-semibold",children:o.title}),e.jsx("span",{className:"rounded-full bg-primary/10 px-10 py-4 text-xs font-medium capitalize text-primary",children:o.source_type}),e.jsx("span",{className:"rounded-full bg-chip px-10 py-4 text-xs",children:o.is_active?"Published":"Hidden"})]}),o.description?e.jsx("div",{className:"mt-6 line-clamp-2 text-sm text-muted",children:o.description}):null,e.jsxs("div",{className:"mt-6 text-xs text-muted",children:["Sort order: ",o.sort_order??0]})]})]}),e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsx(v,{variant:"outline",onClick:()=>i(o),children:e.jsx(n,{message:"Edit"})}),e.jsx(v,{variant:"outline",onClick:()=>r(o),children:e.jsx(n,{message:"Delete"})})]})]},o.id))}):t.isLoading?e.jsx("div",{className:"py-24",children:e.jsx(re,{isIndeterminate:!0})}):e.jsx(Ws,{className:"my-60",size:"sm",title:e.jsx(n,{message:"No webinars yet"}),description:e.jsx(n,{message:"Create your first webinar to start offering gated training inside Buildsites."}),image:e.jsx(Ks,{src:it})})]}),s&&e.jsx(ro,{draft:s,onClose:()=>a(null),onSaved:async()=>{a(null),await t.refetch()}})]})}function ro({draft:s,onClose:a,onSaved:t}){const[i,r]=u.useState(s),[l,o]=u.useState(!1),c=As(),d=As();u.useEffect(()=>{var h,f;if((h=c.entry)!=null&&h.id){const b=c.entry.url||((f=c.entry)!=null&&f.hash?`/api/v1/file-entries/download/${c.entry.hash}`:"");r(N=>{var y;return{...N,file_entry_id:((y=c.entry)==null?void 0:y.id)??null,playback_url:b}})}},[c.entry]),u.useEffect(()=>{var h;(h=d.entry)!=null&&h.url&&r(f=>{var b;return{...f,thumbnail_url:((b=d.entry)==null?void 0:b.url)??""}})},[d.entry]);const x=u.useMemo(()=>i.title.trim()?i.source_type==="upload"?!!i.file_entry_id:!!i.video_url.trim():!1,[i]),g=async()=>{o(!0);const h={title:i.title.trim(),description:i.description.trim(),source_type:i.source_type,file_entry_id:i.source_type==="upload"?i.file_entry_id:null,video_url:i.source_type==="embed"?i.video_url.trim():null,thumbnail_url:i.thumbnail_url.trim()||null,is_active:i.is_active,sort_order:Number.parseInt(i.sort_order||"0",10)||0};try{i.id?(await S.put(`webinars/${i.id}`,h),P.positive("Webinar updated")):(await S.post("webinars",h),P.positive("Webinar created")),await t()}finally{o(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-20",onClick:a,children:e.jsxs("div",{className:"w-full max-w-900 rounded-panel border bg paper p-20",onClick:h=>h.stopPropagation(),children:[e.jsxs("div",{className:"mb-16 flex items-center justify-between gap-12",children:[e.jsx("div",{className:"text-xl font-semibold",children:i.id?"Edit webinar":"Create webinar"}),e.jsx(v,{onClick:a,children:e.jsx(n,{message:"Close"})})]}),e.jsxs("div",{className:"grid gap-14 md:grid-cols-2",children:[e.jsx(xe,{label:e.jsx(n,{message:"Title"}),value:i.title,onChange:h=>r(f=>({...f,title:h.target.value}))}),e.jsx(xe,{label:e.jsx(n,{message:"Sort order"}),type:"number",min:0,value:i.sort_order,onChange:h=>r(f=>({...f,sort_order:h.target.value}))}),e.jsxs(He,{label:e.jsx(n,{message:"Source type"}),selectionMode:"single",selectedValue:i.source_type,onSelectionChange:h=>r(f=>({...f,source_type:h})),children:[e.jsx(j,{value:"upload",children:e.jsx(n,{message:"Upload video"})}),e.jsx(j,{value:"embed",children:e.jsx(n,{message:"Embed link"})})]}),e.jsxs(He,{label:e.jsx(n,{message:"Visibility"}),selectionMode:"single",selectedValue:i.is_active?"published":"hidden",onSelectionChange:h=>r(f=>({...f,is_active:h==="published"})),children:[e.jsx(j,{value:"published",children:e.jsx(n,{message:"Published"})}),e.jsx(j,{value:"hidden",children:e.jsx(n,{message:"Hidden"})})]}),e.jsx(xe,{className:"md:col-span-2",inputElementType:"textarea",rows:4,label:e.jsx(n,{message:"Description"}),value:i.description,onChange:h=>r(f=>({...f,description:h.target.value}))}),i.source_type==="upload"?e.jsxs("div",{className:"md:col-span-2 rounded-panel border p-14",children:[e.jsx("div",{className:"mb-8 text-sm font-medium",children:e.jsx(n,{message:"Webinar video"})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-12",children:[e.jsx(v,{variant:"outline",onClick:async()=>{await c.selectAndUploadFile({restrictions:{allowedFileTypes:["video/*"]},metadata:{disk:zs.public,diskPrefix:"webinars"}})},children:c.uploadStatus==="inProgress"?e.jsxs("span",{className:"flex items-center gap-8",children:[e.jsx(re,{isIndeterminate:!0,size:"xs"}),"Uploading ",Math.round(c.percentage),"%"]}):e.jsx(n,{message:"Upload webinar file"})}),i.playback_url?e.jsx(v,{variant:"outline",elementType:"a",href:i.playback_url,target:"_blank",children:e.jsx(n,{message:"Preview file"})}):null]})]}):e.jsx(xe,{className:"md:col-span-2",label:e.jsx(n,{message:"Embed URL"}),value:i.video_url,onChange:h=>r(f=>({...f,video_url:h.target.value}))}),e.jsxs("div",{className:"md:col-span-2 grid gap-12 md:grid-cols-[1fr_auto] md:items-end",children:[e.jsx(xe,{label:e.jsx(n,{message:"Thumbn
3ail URL (optional)"}),value:i.thumbnail_url,onChange:h=>r(f=>({...f,thumbnail_url:h.target.value}))}),e.jsx(v,{variant:"outline",onClick:async()=>{await d.selectAndUploadFile({restrictions:{allowedFileTypes:["image/*"]},metadata:{disk:zs.public,diskPrefix:"webinars/thumbnails"}})},children:d.uploadStatus==="inProgress"?e.jsxs("span",{className:"flex items-center gap-8",children:[e.jsx(re,{isIndeterminate:!0,size:"xs"}),"Uploading ",Math.round(d.percentage),"%"]}):e.jsx(n,{message:"Upload thumbnail"})})]}),i.thumbnail_url?e.jsx("div",{className:"md:col-span-2",children:e.jsx("img",{src:i.thumbnail_url,alt:"Thumbnail preview",className:"h-120 w-220 rounded-panel object-cover"})}):null]}),e.jsxs("div",{className:"mt-18 flex items-center justify-end gap-12",children:[e.jsx(v,{onClick:a,children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{variant:"flat",color:"primary",disabled:!x||l,onClick:g,children:l?e.jsx(re,{isIndeterminate:!0,size:"xs"}):e.jsx(n,{message:"Save webinar"})})]})]})})}const lo=[{path:"editor",element:e.jsx(Jl,{})},{path:"marketplace",element:e.jsx(ao,{})},{path:"webinars",element:e.jsx(io,{})}];function ie({children:s,name:a,separatorBottom:t=!0,separatorTop:i=!0}){const{formState:{errors:r}}=k(),l=u.useRef(null),o=r[a];return u.useEffect(()=>{var c;o&&((c=l.current)==null||c.scrollIntoView({behavior:"smooth"}))},[o]),e.jsxs("div",{className:_(t&&"border-b mb-20 pb-20",i&&"border-t mt-20 pt-20",o&&"border-y-error"),ref:l,children:[s(!!o),o&&e.jsx("div",{className:"text-danger text-sm mt-20",dangerouslySetInnerHTML:{__html:o.message}})]})}function oo(){const{trans:s}=F();return e.jsx(ne,{title:e.jsx(n,{message:"Subscriptions"}),description:e.jsx(n,{message:"Configure gateway integration, accepted cards, invoices and other related settings."}),children:e.jsxs(vs,{children:[e.jsxs(ys,{children:[e.jsx(Ce,{children:e.jsx(n,{message:"General"})}),e.jsx(Ce,{children:e.jsx(n,{message:"Invoices"})})]}),e.jsxs(tt,{className:"pt-30",children:[e.jsxs(We,{children:[e.jsx(C,{name:"client.billing.enable",description:e.jsx(n,{message:"Enable or disable all subscription related functionality across the site."}),children:e.jsx(n,{message:"Enable subscriptions"})}),e.jsx(de,{}),e.jsx(co,{}),e.jsx(uo,{}),e.jsx(mo,{}),e.jsx(de,{}),e.jsx(as,{label:e.jsx(n,{message:"Accepted cards"}),name:"client.billing.accepted_cards",placeholder:s({message:"Add new card..."})})]}),e.jsxs(We,{children:[e.jsx(p,{inputElementType:"textarea",rows:5,label:e.jsx(n,{message:"Invoice address"}),name:"client.billing.invoice.address",className:"mb-30"}),e.jsx(p,{inputElementType:"textarea",rows:5,label:e.jsx(n,{message:"Invoice notes"}),description:e.jsx(n,{message:"Default notes to show under `notes` section of user invoice. Optional."}),name:"client.billing.invoice.notes"})]})]})]})})}function co(){const{watch:s}=k(),a=s("client.billing.paypal.enable"),[t,i]=u.useState(!1),[r,l]=u.useState(null),[o,c]=u.useState(null);return e.jsxs("div",{className:"mb-30",children:[e.jsx(C,{name:"client.billing.paypal.enable",description:e.jsxs("div",{children:[e.jsx(n,{message:"Enable PayPal payment gateway integration."}),e.jsx(Pe,{className:"mt-6",link:"https://support.vebto.com/hc/articles/147/configuring-paypal"})]}),children:e.jsx(n,{message:"PayPal gateway"})}),a?e.jsx(ie,{name:"paypal_group",children:d=>e.jsxs(u.Fragment,{children:[e.jsx(p,{name:"server.paypal_client_id",label:e.jsx(n,{message:"PayPal Client ID"}),required:!0,invalid:d,className:"mb-20"}),e.jsx(p,{name:"server.paypal_secret",label:e.jsx(n,{message:"PayPal Secret"}),required:!0,invalid:d,className:"mb-20"}),e.jsx(p,{name:"server.paypal_webhook_id",label:e.jsx(n,{message:"PayPal Webhook ID"}),required:!0,invalid:d,className:"mb-20"}),e.jsx(C,{name:"client.billing.paypal_test_mode",invalid:d,description:e.jsx("div",{children:e.jsx(n,{message:"Allows testing PayPal payments with sandbox accounts."})}),children:e.jsx(n,{message:"PayPal test mode"})}),e.jsxs("div",{className:"mt-16 flex items-center gap-12",children:[e.jsx(v,{size:"xs",variant:"outline",onClick:async()=>{var x,g;i(!0),c(null);try{const h=await S.get("billing/status/paypal").then(f=>f.data);l(h.ok?"ok":"fail"),c(h.ok?"Configured and reachable.":h.error||"Not reachable")}catch(h){l("fail"),c(((g=(x=h==null?void 0:h.response)==null?void 0:x.data)==null?void 0:g.message)||"Request failed")}finally{i(!1)}},disabled:t,children:t?e.jsx(re,{isIndeterminate:!0,size:"xs"}):e.jsx(n,{message:"Check PayPal status"})}
3),r==="ok"&&e.jsx("span",{className:"text-xs text-positive",children:e.jsx(n,{message:"OK"})}),r==="fail"&&e.jsx("span",{className:"text-xs text-warning",children:e.jsx(n,{message:"Failed"})}),o&&e.jsx("span",{className:"text-xs text-muted",children:o})]})]})}):null]})}function uo(){const{watch:s}=k(),a=s("client.billing.stripe.enable"),[t,i]=u.useState(!1),[r,l]=u.useState(null),[o,c]=u.useState(null);return e.jsxs(u.Fragment,{children:[e.jsx(C,{name:"client.billing.stripe.enable",description:e.jsxs("div",{children:[e.jsx(n,{message:"Enable Stripe payment gateway integration."}),e.jsx(Pe,{className:"mt-6",link:"https://support.vebto.com/hc/articles/148/configuring-stripe"})]}),children:e.jsx(n,{message:"Stripe gateway"})}),a?e.jsx(ie,{name:"stripe_group",separatorBottom:!1,children:d=>e.jsxs(u.Fragment,{children:[e.jsx(p,{name:"server.stripe_key",label:e.jsx(n,{message:"Stripe publishable key"}),required:!0,className:"mb-20",invalid:d}),e.jsx(p,{name:"server.stripe_secret",label:e.jsx(n,{message:"Stripe secret key"}),required:!0,className:"mb-20",invalid:d}),e.jsx(p,{name:"server.stripe_webhook_secret",label:e.jsx(n,{message:"Stripe webhook signing secret"}),className:"mb-20",invalid:d}),e.jsxs("div",{className:"mt-6 mb-20 flex items-center gap-12",children:[e.jsx(v,{size:"xs",variant:"outline",onClick:async()=>{var x,g;i(!0),c(null);try{const h=await S.get("billing/status/stripe").then(f=>f.data);l(h.ok?"ok":"fail"),c(h.ok?"Configured and reachable.":h.error||"Not reachable")}catch(h){l("fail"),c(((g=(x=h==null?void 0:h.response)==null?void 0:x.data)==null?void 0:g.message)||"Request failed")}finally{i(!1)}},disabled:t,children:t?e.jsx(re,{isIndeterminate:!0,size:"xs"}):e.jsx(n,{message:"Check Stripe status"})}),r==="ok"&&e.jsx("span",{className:"text-xs text-positive",children:e.jsx(n,{message:"OK"})}),r==="fail"&&e.jsx("span",{className:"text-xs text-warning",children:e.jsx(n,{message:"Failed"})}),o&&e.jsx("span",{className:"text-xs text-muted",children:o})]})]})}):null]})}function mo(){const{watch:s,getValues:a}=k(),t=s("client.billing.authorize.enable"),[i,r]=u.useState(!1),[l,o]=u.useState(null),[c,d]=u.useState(null);async function x(){var g,h,f,b;r(!0),d(null);try{const y=(g=a().client)==null?void 0:g.billing,z=await S.post("billing/status/authorize",{enabled:(h=y==null?void 0:y.authorize)==null?void 0:h.enable,api_login_id:y==null?void 0:y.authorize_api_login_id,transaction_key:y==null?void 0:y.authorize_transaction_key,mode:y==null?void 0:y.authorize_mode}).then(V=>V.data);o(z.ok?"ok":"fail"),d(z.ok?"Authorize.Net credentials are valid.":z.error||"Not reachable")}catch(N){o("fail"),d(((b=(f=N==null?void 0:N.response)==null?void 0:f.data)==null?void 0:b.message)||"Request failed")}finally{r(!1)}}return e.jsxs("div",{className:"mb-30",children:[e.jsx(C,{name:"client.billing.authorize.enable",description:e.jsxs("div",{children:[e.jsx(n,{message:"Enable Authorize.Net payment gateway integration."}),e.jsx(Pe,{className:"mt-6",link:"https://developer.authorize.net/api/reference/"})]}),children:e.jsx(n,{message:"Authorize.Net gateway"})}),t?e.jsx(ie,{name:"authorize_group",children:g=>e.jsxs(u.Fragment,{children:[e.jsx(p,{name:"client.billing.authorize_api_login_id",label:e.jsx(n,{message:"API Login ID"}),required:!0,invalid:g,className:"mb-20"}),e.jsx(p,{name:"client.billing.authorize_transaction_key",label:e.jsx(n,{message:"Transaction Key"}),required:!0,invalid:g,className:"mb-20"}),e.jsxs(M,{name:"client.billing.authorize_mode",label:e.jsx(n,{message:"Mode"}),selectionMode:"single",invalid:g,className:"mb-20",children:[e.jsx(j,{value:"sandbox",children:"Sandbox"}),e.jsx(j,{value:"live",children:"Live"})]}),e.jsxs("div",{className:"mt-16 flex items-center gap-12",children:[e.jsx(v,{size:"xs",variant:"outline",onClick:x,disabled:i,children:i?e.jsx(re,{isIndeterminate:!0,size:"xs"}):e.jsx(n,{message:"Check Authorize.Net status"})}),l==="ok"&&e.jsx("span",{className:"text-xs text-positive",children:e.jsx(n,{message:"OK"})}),l==="fail"&&e.jsx("span",{className:"text-xs text-warning",children:e.jsx(n,{message:"Failed"})}),c&&e.jsx("span",{className:"text-xs text-muted",children:c})]})]})}):null]})}function xo(){const{data:s}=ve(["timezones","localizations"]),a=Xs(),{trans:t}=F();return e.jsxs(ne,{title:e.jsx(n,{message:"Localization"}),description:e.jsx(n,{message:"Configure global date, time and language settings."}),children:[e.jsxs(M,{className:"mb-30",required:!0,name:"client.dates.default_timezone",showSearchField:!0,selectionMode:"single",label:e.jsx(n,{message:"Default timezone"}),searchPlaceholder:t(m("Search timezones")),description:e.jsx(n,{message:"Which timezone should be selected by default for new users and guests."}),children:[e.jsx(j,{value:"auto",children:e.jsx(n,{message:"Auto"})},"auto"),Object.entries((s==null?void 0:s.timezones)||{}).map(([i,r])=>e.jsx(Vt,{label:i,children:r.map(l=>e.jsx(j,{value:l.value,children:l.text},l.value))},i))]}),e.jsxs(M,{name:"client.locale.default",className:"mb-30",selectionMode:"single",label:e.jsx(n,{message:"Default language"}),description:e.jsx(n,{message:"Which localization should be selected by default for new users and guests."}),children:[e.jsx(j,{value:"auto",children:e.jsx(n,{message:"Auto"})},"auto"),((s==null?void 0:s.localizations)||[]).map(i=>
3e.jsx(j,{value:i.language,capitalizeFirst:!0,children:i.name},i.language))]}),e.jsxs(Kt,{required:!0,className:"mb-30",size:"sm",name:"client.dates.format",orientation:"vertical",label:e.jsx(n,{message:"Date verbosity"}),description:e.jsx(n,{message:"Default verbosity for all dates displayed across the site. Month/day order and separators will be adjusted automatically, based on user's locale."}),children:[e.jsx(Xe,{value:"auto",children:e.jsx(n,{message:"Auto"})},"auto"),Object.entries(on).map(([i,r])=>e.jsx(Xe,{value:i,children:e.jsx(X,{date:a,options:r})},i))]}),e.jsx(C,{name:"client.i18n.enable",description:e.jsx(n,{message:"If disabled, site will always be shown in default language and user will not be able to change their locale."}),children:e.jsx(n,{message:"Enable translations"})})]})}function go(){return e.jsxs(ne,{title:e.jsx(n,{message:"Authentication"}),description:e.jsx(n,{message:"Configure registration, social login and related 3rd party integrations."}),children:[e.jsx(po,{}),e.jsx(C,{className:"mb-24",name:"client.registration.disable",description:e.jsx(n,{message:"All registration related functionality (including social login) will be disabled."}),children:e.jsx(n,{message:"Disable registration"})}),e.jsx(C,{className:"mb-24",name:"client.single_device_login",description:e.jsx(n,{message:"Only allow one device to be logged into user account at the same time."}),children:e.jsx(n,{message:"Single device login"})}),e.jsx(C,{name:"client.social.compact_buttons",description:e.jsx(n,{message:"Use compact design for social login buttons."}),children:e.jsx(n,{message:"Compact buttons"})}),e.jsx(jo,{}),e.jsx(fo,{}),e.jsx(bo,{}),e.jsx(vo,{}),e.jsx(de,{}),e.jsx(p,{inputElementType:"textarea",rows:3,className:"mt-24",name:"client.auth.domain_blacklist",label:e.jsx(n,{message:"Domain blacklist"}),description:e.jsx(n,{message:"Comma separated list of domains. Users will not be able to register or login using any email adress from specified domains."})})]})}function ho(){const{watch:s}=k();return s("server.mail_setup")?null:e.jsx("p",{className:"mt-10 rounded-panel border p-10 text-sm text-danger",children:e.jsx(n,{message:"Outgoing mail method needs to be setup before enabling this setting. <a>Fix now</a>",values:{a:t=>e.jsx(v,{elementType:D,variant:"outline",size:"xs",display:"flex",className:"mt-10 max-w-max",to:"/admin/settings/outgoing-email",children:t})}})})}function po(){return e.jsx(C,{className:"mb-30",name:"client.require_email_confirmation",description:e.jsxs(u.Fragment,{children:[e.jsx(n,{message:"Require newly registered users to validate their email address before being able to login."}),e.jsx(ho,{})]}),children:e.jsx(n,{message:"Require email confirmation"})})}function jo(){var i;const{watch:s}=k(),a=ae(),t=s("client.social.envato.enable");return(i=a.envato)!=null&&i.enable?e.jsx(ie,{separatorBottom:!1,name:"envato_group",children:r=>e.jsxs(e.Fragment,{children:[e.jsx(C,{invalid:r,name:"client.social.envato.enable",description:e.jsx(n,{message:"Enable logging into the site via envato."}),children:e.jsx(n,{message:"Envato login"})}),!!t&&e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:r,className:"mt-30",name:"server.envato_id",label:e.jsx(n,{message:"Envato ID"}),required:!0}),e.jsx(p,{invalid:r,className:"mt-30",name:"server.envato_secret",label:e.jsx(n,{message:"Envato secret"}),required:!0}),e.jsx(p,{invalid:r,className:"mt-30",name:"server.envato_personal_token",label:e.jsx(n,{message:"Envato personal token"}),required:!0})]})]})}):null}function fo(){const{watch:s}=k(),a=s("client.social.google.enable");return e.jsx(ie,{name:"google_group",children:t=>e.jsxs(e.Fragment,{children:[e.jsx(C,{invalid:t,name:"client.social.google.enable",description:e.jsx(n,{message:"Enable logging into the site via google."}),children:e.jsx(n,{message:"Google login"})}),!!a&&e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:t,className:"mt-30",name:"server.google_id",label:e.jsx(n,{message:"Google client ID"}),required:!0}),e.jsx(p,{className:"mt-30",name:"server.google_secret",label:e.jsx(n,{message:"Google client secret"}),required:!0})]})]})})}function bo(){const{watch:s}=k(),a=s("client.social.facebook.enable");return e.jsx(ie,{name:"facebook_group",separatorTop:!1,children:t=>e.jsxs(e.Fragment,{children:[e.jsx(C,{invalid:t,name:"client.social.facebook.enable",description:e.jsx(n,{message:"Enable logging into the site via facebook."}),children:e.jsx(n,{message:"Facebook login"})}),!!a&&e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:t,className:"mt-30",name:"server.facebook_id",label:e.jsx(n,{message:"Facebook app ID"}),required:!0}),e.jsx(p,{invalid:t,className:"mt-30",name:"server.facebook_secret",label:e.jsx(n,{message:"Facebook app secret"}),required:!0})]})]})})}function vo(){const{watch:s}=k(),a=s("client.social.twitter.enable");return e.jsx(ie,{name:"twitter_group",separatorTop:!1,separatorBottom:!1,children:t=>e.jsxs(e.Fragment,{children:[e.jsx(C,{invalid:t,name:"client.social.twitter.enable",description:e.jsx(n,{message:"Enable logging into the site via twitter."}),children:e.jsx(n,{message:"Twitter login"})}),!!a&&e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:t,className:"mt-30",name:"server.twitter_id",label:e.jsx(n,{message:"Twitter ID"}),required:!0}),e.jsx(p,{invalid:t,className:"mt-30",name:"server.twitter_secret",label:e.jsx(n,{message:"Twitter secret"}),required:!0})]})]})})}function yo(){return S.get("uploads/server-max-file-size").then(s=>s.data)}function wo(){return be({queryKey:["MaxServerUploadSize"],queryFn:()=>yo()})}const So=["B","KB","MB","GB","TB","PB"];function Pt(s,a){if(s==null)return 0;switch(a){case"KB":return s*1024;case"MB":return s*1024**2;case"GB":return s*1024**3;case"TB":return s*1024**4;case"PB":return s*1024**5;default:return s}}const ko=0x630000000000,es=he.forwardRef(({name:s,...a},t)=>
3{const{field:{onChange:i,onBlur:r,value:l="",ref:o},fieldState:{invalid:c,error:d}}=Ge({name:s}),[x,g]=u.useState(""),[h,f]=u.useState("MB");u.useEffect(()=>{if(l==null||l===""){g("");return}const{amount:y,unit:z}=No({bytes:Math.min(l,ko)});f(z||"MB"),g(Number.isNaN(y)?"":y)},[l,h]);const b={onChange:y=>{const z=parseInt(y.target.value);if(Number.isNaN(z))i(z);else{const V=Pt(parseInt(y.target.value),h);i(V)}},onBlur:r,value:x,invalid:c,errorMessage:d==null?void 0:d.message,inputRef:o},N=e.jsx(He,{minWidth:"min-w-80",selectionMode:"single",selectedValue:h,disabled:!l,onSelectionChange:y=>{const z=Pt(x||0,y);i(z)},children:So.slice(0,5).map(y=>e.jsx(j,{value:y,children:y==="B"?"Bytes":y},y))});return e.jsx(xe,{...ns(b,a),type:"number",ref:t,endAppend:N})}),No=Gt(({bytes:s})=>{const a=cn(s);if(!a)return{amount:"",unit:"MB"};let t=parseInt(a.split(" ")[0]);return t=Math.round(t),{amount:t,unit:a.split(" ")[1]}});function Co(){const{trans:s}=F();return A({mutationFn:()=>_o(),onSuccess:()=>{P(s(m("CORS file updated")))},onError:a=>G(a)})}function _o(){return S.post("s3/cors/upload").then(s=>s.data)}function Io(){return A({mutationFn:s=>Po(s),onError:s=>G(s)})}function Po(s){return S.post("settings/uploading/dropbox-refresh-token",s).then(a=>a.data)}function Fo({isInvalid:s}){const{watch:a,setValue:t}=k(),i=a("server.storage_dropbox_app_key"),r=a("server.storage_dropbox_app_secret");return e.jsxs(u.Fragment,{children:[e.jsx(p,{invalid:s,className:"mb-20",name:"server.storage_dropbox_app_key",label:e.jsx(n,{message:"Dropbox application key"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-20",name:"server.storage_dropbox_app_secret",label:e.jsx(n,{message:"Dropbox application secret"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-20",name:"server.storage_dropbox_refresh_token",label:e.jsx(n,{message:"Dropbox refresh token"}),required:!0}),e.jsxs(I,{type:"modal",onClose:l=>{l&&t("server.storage_dropbox_refresh_token",l)},children:[e.jsx(v,{variant:"outline",color:"primary",size:"xs",disabled:!i||!r,children:e.jsx(n,{message:"Get dropbox refresh token"})}),e.jsx(Ao,{appKey:i,appSecret:r})]})]})}function Ao({appKey:s,appSecret:a}){const t=O(),{formId:i,close:r}=q(),l=Io();return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Connected dropbox account"})}),e.jsx($,{children:e.jsxs(J,{id:i,form:t,onSubmit:o=>{l.mutate({app_key:s,app_secret:a,access_code:o.accessCode},{onSuccess:c=>{r(c.refreshToken)}})},children:[e.jsxs("div",{className:"mb-20 pb-20 border-b",children:[e.jsx("div",{className:"text-muted text-sm mb-10",children:e.jsx(n,{message:"Click the 'get access code' button to get dropbox access code, then paste it into the field below."})}),e.jsx(v,{variant:"outline",color:"primary",size:"xs",elementType:"a",target:"_blank",href:`https://www.dropbox.com/oauth2/authorize?client_id=${s}&token_access_type=offline&response_type=code`,children:e.jsx(n,{message:"Get access code"})})]}),e.jsx(p,{name:"accessCode",label:e.jsx(n,{message:"Dropbox access code"}),required:!0})]})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>{r()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{variant:"flat",color:"primary",form:i,type:"submit",disabled:!s||!a||l.isPending,children:e.jsx(n,{message:"Connect"})})]})]})}function zo(){const{trans:s}=F();return e.jsxs(ne,{title:e.jsx(n,{message:"Uploading"}),description:e.jsx(n,{message:"Configure size and type of files that users are able to upload. This will affect all uploads across the site."}),children:[e.jsx(To,{}),e.jsx(Do,{}),e.jsx(Mo,{}),e.jsx(ie,{name:"static_delivery_group",children:a=>e.jsxs(Kt,{invalid:a,size:"sm",name:"server.static_file_delivery",orientation:"vertical",label:e.jsx(n,{message:"File delivery optimization"}),description:e.jsx(n,{message:"Both X-Sendfile and X-Accel need to be enabled on the server first. When enabled, it will reduce server memory and CPU usage when previewing or downloading files, especially for large files."}),children:[e.jsx(Xe,{value:"",children:e.jsx(n,{message:"None"})}),e.jsx(Xe,{value:"xsendfile",children:e.jsx(n,{message:"X-Sendfile (Apache)"})}),e.jsx(Xe,{value:"xaccel",children:e.jsx(n,{message:"X-Accel (Nginx)"})})]})}),e.jsx(es,{className:"mb-30",name:"client.uploads.chunk_size",min:1,label:e.jsx(n,{message:"Chunk size"}),placeholder:"Infinity",description:e.jsx(n,{message:"Size (in bytes) for each file chunk. It should only be changed if there is a maximum upload size on your server or proxy (for example cloudflare). If chunk size is larger then limit on the server, uploads will fail."})}),e.jsx(Eo,{}),e.jsx(de,{}),e.jsx(es,{min:1,name:"client.uploads.max_size",className:"mb-30",label:e.jsx(n,{message:"Maximum file size"}),description:e.jsx(n,{message:"Maximum size (in bytes) for a single file user can upload."})}),e.jsx(es,{min:1,name:"client.uploads.available_space",className:"mb-30",label:e.jsx(n,{message:"Available space"}),description:e.jsx(n,{message:"Disk space (in bytes) each user uploads are allowed to take up. This can be overridden per user."})}),e.jsx(as,{name:"client.uploads.allowed_extensions",className:"mb-30",label:e.jsx(n,{message:"Allowed extensions"}),placeholder:s(m("Add extension...")),description:e.jsx(n,{message:"List of allowed file types (jpg, mp3, pdf etc.). Leave empty to allow all file types."})}),e.jsx(as,{name:"client.uploads.blocked_extensions",label:e.jsx(n,{message:"Blocked extensions"}),placeholder:s(m("Add extension...")),description:e.jsx(n,{message:"Prevent uploading of these file types, even if they are allowed above."})})]})}function Eo(){const{data:s}=wo();return e.jsx(Qe,{color:"warning",description:e.jsx(n,{message:"Maximum upload size on your server currently is set to <b>:size</b>",values:{size:s==null?void 0:s.maxSize,b:a=>e.jsx("b",{children:a})}})})}function To(){const{watch:s,clearErrors:a}=k();return s("server.uploads_disk_driver")?e.jsxs(M,{className:"mb-30",selectionMode:"single",name:"server.uploads_disk_driver",label:e.jsx(n,{message:"User Uploads Storage Method"}),description:e.jsx(n,{message:"Where should user private file uploads be stored."}),onSelectionChange:()=>{a()},children:[e.jsx(j,{value:"local",children:e.jsx(n,{message:"Local Disk (Default)"})}),e.jsx(j,{value:"ftp",children:"FTP"}),e.jsx(j,{value:"digitalocean_s3",children:"DigitalOcean Spaces"}),e.jsx(j,{value:"backblaze_s3",children:"Backblaze"}),e.jsx(j,{value:"s3",children:"Amazon S3 (Or compatible service)"}),e.jsx(j,{value:"dropbox",children:"Dropbox"}),e.jsx(j,{value:"rackspace",children:"Rackspace"})]}):null}function Do(){const{watch:s,clearErrors:a}=k();return s("server.public_disk_driver")?e.jsxs(M,{label:e.jsx(n,{message:"Public Uploads Storage Method"}),selectionMode:"single",name:"server.public_disk_driver",description:e.jsx(n,{message:"Where should user public uploads (like avatars) be stored."}),onSelectionChange:()=>{a()},children:[e.jsx(j,{value:"local",children:e.jsx(n,{message:"Local Disk (Default)"})}),e.jsx(j,{value:"s3",children:"Amazon S3"}),e.jsx(j,{value:"ftp",children:"FTP"}),e.jsx(j,{value:"digitalocean_s3",children:"DigitalOcean Spaces"}),e.jsx(j,{value:"backblaze_s3",children:"Backblaze"})]}):null}function Mo(){const{watch:s}=k(),a=[s("server.uploads_disk_driver"),s("server.public_disk_driver")];return a[0]==="local"&&a[1]==="local"?null:e.jsx(ie,{separatorBottom:!1,name:"storage_group",children:t=>{if(a.includes("s3"))return e.jsx(Oo,{isInvalid:t});if(a.includes("ftp"))return e.jsx($o,{isInvalid:t});if(a.includes("dropbox"))return e.jsx(Fo,{isInvalid:t});if(a.includes("digitalocean_s3"))return e.jsx(Lo,{isInvalid:t});if(a.includes("backblaze_s3"))return e.jsx(Ro,{isInvalid:t})}})}function Oo({isInvalid:s}){return e.jsxs(u.Fragment,{children:[e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_s3_key",label:e.jsx(n,{message:"Amazon S3 key"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_s3_secret",label:e.jsx(n,{message:"Amazon S3 secret"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_s3_region",label:e.jsx(n,{message:"Amazon S3 region"}),pattern:"[a-z1-9\\-]+",placeholder:"us-east-1"}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_s3_bucket",label:e.jsx(n,{message:"Amazon S3 bucket"}),required:!0}),e.jsx(p,{invalid:s,name:"server.storage_s3_endpoint",label:e.jsx(n,{message:"Amazon S3 endpoint"}),description:e.jsx(n,{message:"Only change endpoint if you are using another S3 compatible storage service."})}),e.jsx(xt,{invalid:s})]})}function Lo({isInvalid:s}){return e.jsxs(u.Fragment,{children:[e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_digitalocean_key",label:e.jsx(n,{message:"DigitalOcean key"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_digitalocean_secret",label:e.jsx(n,{message:"DigitalOcean secret"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_digitalocean_region",label:e.jsx(n,{message:"DigitalOcean region"}),pattern:"[a-z0-9\\-]+",placeholder:"us-east-1",required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_digitalocean_bucket",label:e.jsx(n,{message:"DigitalOcean bucket"}),required:!0}),e.jsx(xt,{invalid:s})]})}function Ro({isInvalid:s}){return e.jsxs(u.Fragment,{children:[e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_backblaze_key",label:e.jsx(n,{message:"Backblaze KeyID"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_backblaze_secret",label:e.jsx(n,{message:"Backblaze applicationKey"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_backblaze_region",label:e.jsx(n,{message:"Backblaze Region"}),pattern:"[a-z0-9\\-]+",placeholder:"us-west-002",required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_backblaze_bucket",label:e.jsx(n,{message:"Backblaze bucket name"}),required:!0}),e.jsx(xt,{invalid:s})]})}
3function xt({invalid:s}){var r,l;const a=Co(),{data:t}=os(),i=((r=t==null?void 0:t.server.uploads_disk_driver)==null?void 0:r.endsWith("s3"))||((l=t==null?void 0:t.server.public_disk_driver)==null?void 0:l.endsWith("s3"));return e.jsxs(u.Fragment,{children:[e.jsx(C,{className:"mt-30",invalid:s,name:"client.uploads.s3_direct_upload",description:e.jsxs("div",{children:[e.jsx("p",{children:e.jsx(n,{message:"Upload files directly from the browser to s3 without going through the server. It will save on server bandwidth and should result in faster upload times. This should be enabled, unless storage provider does not support multipart uploads."})}),e.jsx("p",{className:"mt-10",children:e.jsx(n,{message:"If s3 provider is not configured to allow uploads from browser, this can be done automatically via CORS button below, when valid credentials are saved."})})]}),children:e.jsx(n,{message:"Direct upload"})}),e.jsx(v,{variant:"flat",color:"primary",size:"xs",className:"mt-20",onClick:()=>{a.mutate()},disabled:!i||a.isPending,children:e.jsx(n,{message:"Configure CORS"})})]})}function $o({isInvalid:s}){return e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_ftp_host",label:e.jsx(n,{message:"FTP hostname"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_ftp_username",label:e.jsx(n,{message:"FTP username"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_ftp_password",label:e.jsx(n,{message:"FTP password"}),type:"password",required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_ftp_root",label:e.jsx(n,{message:"FTP directory"}),placeholder:"/"}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.storage_ftp_port",label:e.jsx(n,{message:"FTP port"}),type:"number",min:0,placeholder:"21"}),e.jsx(C,{invalid:s,name:"server.storage_ftp_passive",className:"mb-30",children:e.jsx(n,{message:"Passive"})}),e.jsx(C,{invalid:s,name:"server.storage_ftp_ssl",children:e.jsx(n,{message:"SSL"})})]})}function qo({isInvalid:s}){return e.jsxs(u.Fragment,{children:[e.jsx(p,{invalid:s,className:"mb-30",name:"server.mailgun_domain",label:e.jsx(n,{message:"Mailgun domain"}),description:e.jsx(n,{message:"Usually the domain of your site (site.com)"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.mailgun_secret",label:e.jsx(n,{message:"Mailgun API key"}),description:e.jsx(n,{message:"Should start with `key-`"}),required:!0}),e.jsx(p,{invalid:s,name:"server.mailgun_endpoint",label:e.jsx(n,{message:"Mailgun endpoint"}),description:e.jsx(n,{message:"Can be left empty, if your mailgun account is in the US region."}),placeholder:"api.eu.mailgun.net"})]})}function Uo({isInvalid:s}){return e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:s,className:"mb-30",name:"server.mail_host",label:e.jsx(n,{message:"SMTP host"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.mail_username",label:e.jsx(n,{message:"SMTP username"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",type:"password",name:"server.mail_password",label:e.jsx(n,{message:"SMTP password"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",type:"number",name:"server.mail_port",label:e.jsx(n,{message:"SMTP port"})}),e.jsxs(M,{selectionMode:"single",invalid:s,className:"mb-30",name:"server.mail_encryption",label:e.jsx(n,{message:"SMTP encryption"}),children:[e.jsx(j,{value:"",children:e.jsx(n,{message:"None"})}),e.jsx(j,{value:"tls",children:e.jsx(n,{message:"TLS"})})]})]})}function Vo({isInvalid:s}){return e.jsxs(u.Fragment,{children:[e.jsx(p,{invalid:s,className:"mb-30",name:"server.ses_key",label:e.jsx(n,{message:"SES key"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.ses_secret",label:e.jsx(n,{message:"SES secret"}),required:!0}),e.jsx(p,{invalid:s,name:"server.ses_region",label:e.jsx(n,{message:"SES region"}),placeholder:"us-east-1",required:!0})]})}function Bo({isInvalid:s}){return e.jsx(p,{invalid:s,name:"server.postmark_token",label:e.jsx(n,{message:"Postmark token"}),required:!0})}const Ft=H([e.jsx("path",{fill:"#4caf50",d:"M45,16.2l-5,2.75l-5,4.75L35,40h7c1.657,0,3-1.343,3-3V16.2z"},"0"),e.jsx("path",{fill:"#1e88e5",d:"M3,16.2l3.614,1.71L13,23.7V40H6c-1.657,0-3-1.343-3-3V16.2z"},"1"),e.jsx("polygon",{fill:"#e53935",points:"35,11.2 24,19.45 13,11.2 12,17 13,23.7 24,31.95 35,23.7 36,17"},"2"),e.jsx("path",{fill:"#c62828",d:"M3,12.298V16.2l10,7.5V11.2L9.876,8.859C9.132,8.301,8.228,8,7.298,8h0C4.924,8,3,9.924,3,12.298z"},"3"),e.jsx("path",{fill:"#fbc02d",d:"M45,12.298V16.2l-10,7.5V11.2l3.124-2.341C38.868,8.301,39.772,8,40.702,8h0 C43.076,8,45,9.924,45,12.298z"},"4")],"Gmail","0 0 48 48");function Ho(){const{watch:s,setValue:a}=k(),{connectSocial:t}=dn(),i=s("server.connectedGmailAccount"),r=async()=>{const c=await t("secure/settings/mail/gmail/connect");
3if((c==null?void 0:c.status)==="SUCCESS"){const d=c.callbackData.profile.email;a("server.connectedGmailAccount",d),P(m("Connected gmail account: :email",{values:{email:d}}))}},l=e.jsx(v,{variant:"outline",color:"primary",startIcon:e.jsx(Ft,{}),onClick:()=>{r()},children:e.jsx(n,{message:"Connect gmail account"})}),o=e.jsxs("div",{className:"flex items-center gap-14 rounded border bg-alt px-14 py-6 text-sm",children:[e.jsx(Ft,{size:"lg"}),i,e.jsx(v,{variant:"text",color:"primary",className:"ml-auto",onClick:()=>{r()},children:e.jsx(n,{message:"Reconnect"})})]});return e.jsxs(u.Fragment,{children:[e.jsx("div",{className:"mb-6 text-sm",children:e.jsx(n,{message:"Gmail account"})}),i?o:l]})}function Wo(){const{watch:s,clearErrors:a}=k(),t=s("server.mail_driver"),i=[];return t==="mailgun"&&i.push(qo),t==="smtp"&&i.push(Uo),t==="ses"&&i.push(Vo),t==="postmark"&&i.push(Bo),t==="gmailApi"&&i.push(Ho),e.jsx(ie,{separatorTop:!1,separatorBottom:!1,name:"mail_group",children:r=>e.jsxs(u.Fragment,{children:[e.jsxs(M,{onSelectionChange:()=>{a()},invalid:r,selectionMode:"single",name:"server.mail_driver",label:e.jsx(n,{message:"Outgoing mail method"}),description:e.jsxs("div",{children:[e.jsx(n,{message:"Which method should be used for sending outgoing application emails (like registration confirmation)"}),e.jsx(Pe,{className:"mt-8",link:"https://support.vebto.com/hc/articles/42/44/155/incoming-emails"})]}),children:[e.jsx(j,{value:"mailgun",children:"Mailgun"}),e.jsx(j,{value:"gmailApi",children:"Gmail Api"}),e.jsx(j,{value:"smtp",children:"SMTP"}),e.jsx(j,{value:"postmark",children:"Postmark"}),e.jsx(j,{value:"ses",children:"Ses (Amazon Simple Email Service)"}),e.jsx(j,{value:"sendmail",children:"SendMail"}),e.jsx(j,{value:"log",children:"Log (Email will be saved to error log)"})]}),i.length?e.jsx("div",{className:"mt-30",children:i.map((l,o)=>e.jsx(l,{isInvalid:r},o))}):null]})})}function Ko(){return e.jsxs(ne,{title:e.jsx(n,{message:"Outgoing email settings"}),description:e.jsx(n,{message:"Change outgoing email handlers, email credentials and other related settings."}),children:[e.jsx(p,{id:"outgoing-emails",className:"mb-30",type:"email",name:"server.mail_from_address",label:e.jsx(n,{message:"From address"}),description:e.jsx(n,{message:"All outgoing application emails will be sent from this email address."}),required:!0}),e.jsx(Go,{}),e.jsx(p,{className:"mb-30",name:"server.mail_from_name",label:e.jsx(n,{message:"From name"}),description:e.jsx(n,{message:"All outgoing application emails will be sent using this name."}),required:!0}),e.jsx(Qe,{color:"warning",description:e.jsx(n,{message:"Your selected mail method must be authorized to send emails using this address and name."})}),e.jsx(de,{}),e.jsx(Wo,{})]})}function Go(){const{base_url:s}=ae(),a=`${s}/contact`,t=e.jsx(fs,{href:a,children:a});return e.jsx(p,{className:"mb-30",type:"email",name:"client.mail.contact_page_address",label:e.jsx(n,{message:"Contact page address"}),description:e.jsx(n,{values:{contactPageUrl:t},message:"Where emails from :contactPageUrl page should be sent to."})})}function Qo(){return S.post("cache/flush").then(s=>s.data)}function Jo(){return A({mutationFn:()=>Qo(),onSuccess:()=>{P(m("Cache cleared"))},onError:s=>G(s)})}function Yo(){const s=Jo();return e.jsxs(ne,{title:e.jsx(n,{message:"Cache settings"}),description:e.jsx(n,{message:"Select cache provider and manually clear cache."}),children:[e.jsx(Zo,{}),e.jsx(v,{type:"button",variant:"outline",size:"xs",color:"primary",disabled:s.isPending,onClick:()=>{s.mutate()},children:e.jsx(n,{message:"Clear cache"})}),e.jsx(Qe,{color:"warning",className:"mt-30",description:e.jsx(n,{message:'"File" is the best option for most cases and should not be changed, unless you are familiar with another cache method and have it set up on the server already.'})})]})}function Zo(){const{watch:s,clearErrors:a}=k(),t=s("server.cache_driver");let i=null;return t==="memcached"&&(i=Xo),e.jsx(ie,{separatorTop:!1,name:"cache_group",children:r=>e.jsxs(e.Fragment,{children:[e.jsxs(M,{invalid:r,onSelectionChange:()=>{a()},selectionMode:"single",name:"server.cache_driver",label:e.jsx(n,{message:"Cache method"}),description:e.jsx(n,{message:"Which method should be used for storing and retrieving cached items."}),children:[e.jsx(j,{value:"file",children:e.jsx(n,{message:"File (Default)"})}),e.jsx(j,{value:"array",children:e.jsx(n,{message:"None"})}),e.jsx(j,{value:"apc",children:"APC"}),e.jsx(j,{value:"memcached",children:"Memcached"}),e.jsx(j,{value:"redis",children:"Redis"})]}),i&&e.jsx("div",{className:"mt-30",children:e.jsx(i,{isInvalid:r})})]})})}function Xo({isInvalid:s}){return e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:s,className:"mb-30",name:"server.memcached_host",label:e.jsx(n,{message:"Memcached host"}),required:!0}),e.jsx(p,{invalid:s,type:"number",name:"server.memcached_port",label:e.jsx(n,{message:"Memcached port"}),required:!0})]})}function ec(){return e.jsxs(ne,{title:e.jsx(n,{message:"Error logging"}),description:e.jsx(n,{message:"Configure site error logging and related 3rd party integrations."}),children:[e.jsx(sc,{}),e.jsx(Qe,{className:"mt-30",color:"positive",description:e.jsx(n,{values:{a:s=>e.jsx(fs,{href:"https://sentry.io",children:s})},message:"<a>Sentry</a> integration provides real-time error tracking and helps identify and fix issues when site is in production."})})]})}function sc(){const{clearErrors:s}=k();return e.jsx(ie,{separatorTop:!1,separatorBottom:!1,name:"logging_group",children:a=>e.jsx(p,{onChange:()=>{s()},invalid:a,name:"server.sentry_dsn",type:"url",minLength:30,label:e.jsx(n,{message:"Sentry DSN"})})})}function tc(){return be({queryKey:["queue-stats"],queryFn:()=>ac(),refetchInterval:5e3})}function ac(){return S.get("horizon/api/stats").then(s=>s.data)}function nc(){return e.jsxs(ne,{title:e.jsx(n,{message:"Queue"}),description:e.jsxs(u.Fragment,{children:[e.jsx(n,{message:"Queues allow to defer time consuming tasks, such as sending an email, until a later time. They are fully optional and do not provide any additional functionality."}),e.jsx(Pe,{className:"mt-6 text-sm",link:"https://support.vebto.com/hc/articles/224/queues"})]}),children:[e.jsx(ic,{}),e.jsx(rc,{})]})}function ic(){const{base_url:s}=ae(),{watch:a}=k(),{data:t}=tc(),i=a("server.queue_driver"),r=t==null?void 0:t.status;return i==="sync"?null:e.jsx("div",{className:"mb-30 flex h-32 items-center justify-between gap-14",children:r&&e.jsxs(u.Fragment,{children:[e.jsxs("div",{className:_("min-w-108 flex w-max items-center gap-8 rounded-button px-10 py-4 text-sm capitalize",r==="running"&&"bg-positive-lighter",r==="inactive"&&"bg-danger-lighter",r==="paused"&&"bg-chip"),children:[e.jsx("div",{className:_("h-10 w-10 rounded-full",r==="running"&&"bg-positive",r==="inactive"&&"bg-danger",r==="paused"&&"bg-chip")}),e.jsx(n,{message:`Worker ${r}`})]}),e.jsx(v,{variant:"outline",size:"xs",elementType:"a",href:`${s}/horizon`,target:"_blank",endIcon:e.jsx(Ii,{}),children:e.jsx(n,{message:"Monitor"})})]})})}function rc(){const{watch:s,clearErrors:a}=k(),t=s("server.queue_driver");let i=null;return t==="sqs"&&(i=lc),e.jsx(ie,{separatorTop:!1,separatorBottom:!1,name:"queue_group",children:r=>e.jsxs(e.Fragment,{children:[e.jsxs(M,{invalid:r,onSelectionChange:()=>{a()},selectionMode:"single",name:"server.queue_driver",label:e.jsx(n,{message:"Queue method"}),required:!0,children:[e.jsx(j,{value:"sync",children:e.jsx(n,{message:"None (Default)"})}),e.jsx(j,{value:"beanstalkd",children:"Beanstalkd"}),e.jsx(j,{value:"database",children:e.jsx(n,{message:"Database"})}),e.jsx(j,{value:"sqs",children:e.jsx(n,{message:"SQS (Amazon simple queue service)"})}),e.jsx(j,{value:"redis",children:"Redis"})]}),i&&e.jsx("div",{className:"mt-30",children:e.jsx(i,{isInvalid:r})})]})})}function lc({isInvalid:s}){return e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:s,className:"mb-30",name:"server.sqs_queue_key",label:e.jsx(n,{message:"SQS queue key"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.sqs_queue_secret",label:e.jsx(n,{message:"SQS queue secret"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.sqs_queue_prefix",label:e.jsx(n,{message:"SQS queue prefix"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.sqs_queue_name",label:e.jsx(n,{message:"SQS queue name"}),required:!0}),e.jsx(p,{invalid:s,className:"mb-30",name:"server.sqs_queue_region",label:e.jsx(n,{message:"SQS queue region"}),required:!0})]})}function oc(){const{settings:s}=u.useContext(Le);return e.jsxs(ne,{title:e.jsx(n,{message:"Recaptcha"}),description:e.jsx(n,{message:"Configure google recaptcha integration and credentials."}),children:[(s==null?void 0:s.showRecaptchaLinkSwitch)&&e.jsx(C,{className:"mb-30",name:"client.re
3captcha.enable.link_creation",description:e.jsx(n,{message:"Enable recaptcha integration when creating links from homepage or user dashboard."}),children:e.jsx(n,{message:"Link creation"})}),e.jsx(C,{className:"mb-30",name:"client.recaptcha.enable.contact",description:e.jsx(n,{message:'Enable recaptcha integration for "contact us" page.'}),children:e.jsx(n,{message:"Contact page"})}),e.jsx(C,{className:"mb-30",name:"client.recaptcha.enable.register",description:e.jsx(n,{message:"Enable recaptcha integration for registration page."}),children:e.jsx(n,{message:"Registration page"})}),e.jsx(cc,{})]})}function cc(){const{clearErrors:s}=k();return e.jsx(ie,{separatorTop:!1,separatorBottom:!1,name:"recaptcha_group",children:a=>e.jsxs(e.Fragment,{children:[e.jsx(p,{className:"mb-30",onChange:()=>{s()},invalid:a,name:"client.recaptcha.site_key",label:e.jsx(n,{message:"Recaptcha v3 site key"})}),e.jsx(p,{onChange:()=>{s()},invalid:a,name:"client.recaptcha.secret_key",label:e.jsx(n,{message:"Recaptcha v3 secret key"})})]})})}const dc=he.forwardRef((s,a)=>{const t=un(a),{fieldProps:i,inputProps:r}=mn({...s,focusRef:t}
3),l=xn(s);return e.jsx(gn,{ref:a,fieldClassNames:l,...i,children:e.jsx("input",{type:"file",ref:t,...r,className:_(l.input,"py-8","file:bg-primary file:text-on-primary file:border-none file:rounded file:text-sm file:font-semibold file:px-10 file:h-24 file:mr-10")})})});function Os({name:s,...a}){const{field:{onChange:t,onBlur:i,ref:r},fieldState:{invalid:l,error:o}}=Ge({name:s}),[c,d]=he.useState(""),x={onChange:g=>{var h;t((h=g.target.files)==null?void 0:h[0]),d(g.target.value)},onBlur:i,value:c,invalid:l,errorMessage:o==null?void 0:o.message};return e.jsx(dc,{ref:r,...ns(x,a)})}function uc(){return e.jsx(ne,{title:e.jsx(n,{message:"Analytics"}),description:e.jsx(n,{message:"Configure google analytics integration and credentials."}),children:e.jsx(mc,{})})}function mc(){const{clearErrors:s}=k();return e.jsx(ie,{separatorTop:!1,separatorBottom:!1,name:"analytics_group",children:a=>e.jsxs(u.Fragment,{children:[e.jsx(Os,{className:"mb-30",onChange:()=>{s()},invalid:a,name:"files.certificate",accept:".json",label:e.jsx(n,{message:"Google service account key file (.json)"})}),e.jsx(p,{className:"mb-30",onChange:()=>{s()},invalid:a,name:"server.analytics_property_id",type:"number",label:e.jsx(n,{message:"Google analytics property ID"})}),e.jsx(p,{className:"mb-30",onChange:()=>{s()},invalid:a,name:"client.analytics.tracking_code",placeholder:"G-******",min:"1",max:"20",description:e.jsx(n,{message:"Google analytics measurement ID only, not the whole javascript snippet."}),label:e.jsx(n,{message:"Google tag manager measurement ID"})}),e.jsx(p,{name:"client.analytics.gchart_api_key",label:e.jsx(n,{message:"Google maps javascript API key"}),description:e.jsx(n,{message:"Only required in order to show world geochart on integrated analytics pages."})})]})})}function xc(s){const a=ce();return A({mutationFn:t=>gc(t),onSuccess:(t,i)=>{P(m("User updated")),T.invalidateQueries({queryKey:["users"]}),a("/admin/users")},onError:t=>ee(t,s)})}function gc({id:s,...a}){return a.roles&&(a.roles=a.roles.map(t=>t.id)),S.put(`users/${s}`,a).then(t=>t.data)}function pa(){const[s,a]=u.useState(!1),t=u.useRef(),i=u.useCallback(r=>{var l;if(r){const o=new IntersectionObserver(([c])=>a(c.intersectionRatio<1),{threshold:[1]});t.current=o,o.observe(r)}else t.current&&((l=t.current)==null||l.disconnect())},[]);return{isSticky:s,sentinelRef:i}}function cs({onSubmit:s,form:a,title:t,subTitle:i,children:r,actions:l,backButton:o,isLoading:c=!1,disableSaveWhenNotDirty:d=!1,wrapInContainer:x=!0,submitButtonText:g}){const{isSticky:h,sentinelRef:f}=pa(),b=d?Object.keys(a.formState.dirtyFields).length:!0;return e.jsxs(J,{onSubmit:s,onBeforeSubmit:()=>a.clearErrors(),form:a,children:[e.jsx("div",{ref:f}),e.jsx("div",{className:_("sticky top-0 z-10 my-12 transition-shadow md:my-24",h&&"bg shadow"),children:e.jsxs("div",{className:_("flex items-center gap-24 py-14 md:items-start",x&&"container mx-auto px-24"),children:[o,e.jsxs("div",{className:"overflow-hidden overflow-ellipsis md:mr-64",children:[e.jsx("h1",{className:"overflow-hidden overflow-ellipsis whitespace-nowrap text-xl md:text-3xl",children:t}),i&&e.jsx("div",{className:"mt-4",children:i})]}),e.jsx("div",{className:"mr-auto"}),l,e.jsx(v,{variant:"flat",color:"primary",type:"submit",disabled:c||!b,children:g??e.jsx(n,{message:"Save"})})]})}),e.jsx("div",{className:x?"container mx-auto px-24 pb-24":void 0,children:e.jsx("div",{className:"rounded",children:r})})]})}function ja({onSubmit:s,form:a,title:t,subTitle:i,isLoading:r,avatarManager:l,resendEmailButton:o,children:c}){const{require_email_confirmation:d}=ae(),{data:x}=ve(["roles","permissions"]);return e.jsxs(cs,{onSubmit:s,form:a,title:t,subTitle:i,isLoading:r,children:[e.jsxs("div",{className:"mb-40 flex items-start gap-40 md:gap-80",children:[l,e.jsxs("div",{className:"flex-auto",children:[c,e.jsx(p,{className:"mb-30",name:"first_name",label:e.jsx(n,{message:"First name"})}),e.jsx(p,{name:"last_name",label:e.jsx(n,{message:"Last name"})})]})]}),e.jsxs("div",{className:"mb-30 border-b border-t pb-30 pt-30",children:[e.jsx(C,{className:_(o&&"mb-30"),disabled:!d,name:"email_verified_at",description:e.jsx(n,{message:"Whether email address has been confirmed. User will not be able to login until address is confirmed, unless confirmation is disabled from settings page."}),children:e.jsx(n,{message:"Email confirmed"})}),o]}),e.jsx(es,{className:"mb-30",name:"available_space",label:e.jsx(n,{message:"Allowed storage space"}),description:e.jsx(n,{values:{a:g=>e.jsx(D,{className:js,target:"_blank",to:"/admin/settings/uploading",children:g})},message:"Total storage space all user uploads are allowed to take up. If left empty, this value will be inherited from any roles or subscriptions user has, or from 'Available space' setting in <a>Uploading</a> settings page."})}),e.jsx(ls,{className:"mb-30",name:"roles",label:e.jsx(n,{message:"Roles"}),suggestions:x==null?void 0:x.roles,children:g=>e.jsx(j,{value:g.id,children:g.name},g.id)}),e.jsxs("div",{className:"mt-30 border-t pt-30",children:[e.jsx("div",{className:"mb-10 text-sm",children:e.jsx(n,{message:"Permissions"})}),e.jsx(ct,{name:"permissions"})]})]})}const hc=H([e.jsx("path",{d:"M15.73 3H8.27L3 8.27v7.46L8.27 21h7.46L21 15.73V8.27L1
35.73 3zM19 14.9 14.9 19H9.1L5 14.9V9.1L9.1 5h5.8L19 9.1v5.8z"},"0"),e.jsx("circle",{cx:"12",cy:"16",r:"1"},"1"),e.jsx("path",{d:"M11 7h2v7h-2z"},"2")],"ReportOutlined");function pc(){var x,g,h;const s=O(),{require_email_confirmation:a}=ae(),{userId:t}=se(),i=xc(s),r=hn(),{data:l,isLoading:o}=pn(t,{with:["subscriptions","roles","permissions","bans"]}),c=(g=(x=l==null?void 0:l.user.bans)==null?void 0:x[0])==null?void 0:g.comment;if(u.useEffect(()=>{l!=null&&l.user&&!s.getValues().id&&s.reset({first_name:l.user.first_name,last_name:l.user.last_name,roles:l.user.roles,permissions:l.user.permissions,id:l.user.id,email_verified_at:!!l.user.email_verified_at,available_space:l.user.available_space,avatar:l.user.avatar})},[l==null?void 0:l.user,s]),o)return e.jsx(Fe,{});const d=e.jsx(v,{size:"xs",variant:"outline",color:"primary",disabled:!a||r.isPending||((h=l==null?void 0:l.user)==null?void 0:h.email_verified_at)!=null,onClick:()=>{r.mutate({email:l.user.email})},children:e.jsx(n,{message:"Resend email"})});return e.jsx(ja,{onSubmit:f=>{i.mutate(f)},form:s,title:e.jsx(n,{values:{email:l==null?void 0:l.user.email},message:"Edit â:emailâ"}),subTitle:c&&e.jsxs("div",{className:"flex items-center gap-4 text-sm text-danger",children:[e.jsx(hc,{}),e.jsx("div",{children:e.jsx(n,{message:"Suspended: :reason",values:{reason:c}})})]}),isLoading:i.isPending,avatarManager:e.jsx(jc,{user:l.user,onChange:()=>{T.invalidateQueries({queryKey:["users"]})}}),resendEmailButton:d,children:e.jsx(p,{className:"mb-30",name:"password",type:"password",label:e.jsx(n,{message:"New password"})})})}function jc({user:s,onChange:a}){const t=jn({user:s}),i=fn({user:s});return e.jsx(Me,{children:e.jsx(De,{name:"avatar",diskPrefix:"avatars",variant:"avatar",stretchPreview:!0,label:e.jsx(n,{message:"Profile image"}),previewSize:"w-90 h-90",showRemoveButton:!0,onChange:r=>{r?t.mutate({url:r}):i.mutate(),a()}})})}function fc(s){const a=ce();return A({mutationFn:t=>bc(t),onSuccess:()=>{P(m("User created")),T.invalidateQueries({queryKey:W("users")}),a("/admin/users")},onError:t=>ee(t,s)})}function bc(s){return s.roles&&(s.roles=s.roles.map(a=>a.id)),S.post("users",s).then(a=>a.data)}function vc(){const s=O(),a=fc(s),t=e.jsx(Me,{children:e.jsx(De,{name:"avatar",diskPrefix:"avatars",variant:"avatar",stretchPreview:!0,label:e.jsx(n,{message:"Profile image"}),previewSize:"w-90 h-90",showRemoveButton:!0})});return e.jsxs(ja,{onSubmit:i=>{a.mutate(i)},form:s,title:e.jsx(n,{message:"Add new user"}),isLoading:a.isPending,avatarManager:t,children:[e.jsx(p,{className:"mb-30",name:"email",type:"email",label:e.jsx(n,{message:"Email"})}),e.jsx(p,{className:"mb-30",name:"password",type:"password",label:e.jsx(n,{message:"Password"})})]})}const yc=H(e.jsx("path",{d:"m12.87 15.07-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7 1.62-4.33L19.12 17h-3.24z"}),"TranslateOutlined"),gt=s=>{const a=["getLocaleWithLines"];return s!=null&&a.push(s),a};function wc(s){return be({queryKey:gt(s),queryFn:()=>Sc(s),staleTime:1/0})}function Sc(s){return S.get(`localizations/${s}`).then(a=>a.data)}function kc({id:s,...a}){return S.put(`localizations/${s}`,a).then(t=>t.data)}function fa(s){return A({mutationFn:a=>kc(a),onSuccess:()=>{P(m("Localization updated")),T.invalidateQueries({queryKey:W("localizations")}
3),T.invalidateQueries({queryKey:gt()})},onError:a=>s?ee(a,s):G(a)})}function Nc({localization:s}){const{trans:a}=F(),{formId:t,close:i}=q(),r=O({defaultValues:{id:s.id,name:s.name,language:s.language}}),{data:l}=ve(["languages"]),o=(l==null?void 0:l.languages)||[],c=fa(r);return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Update localization"})}),e.jsx($,{children:e.jsxs(J,{form:r,id:t,onSubmit:d=>{c.mutate(d,{onSuccess:i})},children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-30",required:!0}),e.jsx(M,{required:!0,name:"language",label:e.jsx(n,{message:"Language"}),selectionMode:"single",showSearchField:!0,searchPlaceholder:a(m("Search languages")),children:o.map(d=>e.jsx(j,{value:d.code,children:d.name},d.code))})]})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:i,children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{variant:"flat",color:"primary",type:"submit",form:t,disabled:c.isPending,children:e.jsx(n,{message:"Save"})})]})]})}function Cc(s){return S.post("localizations",s).then(a=>a.data)}function _c(s){const a=rs();return A({mutationFn:t=>Cc(t),onSuccess:()=>{P(m("Localization created")),a.invalidateQueries({queryKey:W("localizations")})},onError:t=>ee(t,s)})}function Ic(){const{trans:s}=F(),{formId:a,close:t}=q(),i=O({defaultValues:{language:"en"}}),{data:r}=ve(["languages"]),l=(r==null?void 0:r.languages)||[],o=_c(i);return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Create localization"})}),e.jsx($,{children:e.jsxs(J,{form:i,id:a,onSubmit:c=>{o.mutate(c,{onSuccess:t})},children:[e.jsx(p,{autoFocus:!0,name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-30",required:!0}),e.jsx(M,{required:!0,name:"language",label:e.jsx(n,{message:"Language"}),selectionMode:"single",showSearchField:!0,searchPlaceholder:s(m("Search languages")),children:l.map(c=>e.jsx(j,{value:c.code,children:c.name},c.code))})]})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:t,children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{variant:"flat",color:"primary",type:"submit",form:a,disabled:o.isPending,children:e.jsx(n,{message:"Save"})})]})]})}const Pc=""+new URL("around-the-world-df9b11c5.svg",import.meta.url).href;function ba(){return A({mutationFn:s=>Fc(s),onSuccess:async()=>{await T.invalidateQueries({queryKey:W("localizations")}),await T.invalidateQueries({queryKey:gt()}),P(m("Translation file uploaded"))},onError:s=>G(s)})}function Fc({localeId:s,file:a}){const t=new FormData;return t.append("file",a.native),S.post(`localizations/${s}/upload`,t).then(i=>i.data)}const Ac=[{key:"name",allowsSorting:!0,sortingKey:"name",visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Name"}),body:s=>s.name},{key:"language",allowsSorting:!0,sortingKey:"language",header:()=>e.jsx(n,{message:"Language code"}),body:s=>s.language},{key:"updatedAt",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(X,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-84 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs("div",{className:"text-muted",children:[e.jsx(L,{label:e.jsx(n,{message:"Translate"}),children:e.jsx(w,{size:"md",elementType:D,to:`${s.id}/translate`,children:e.jsx(yc,{})})}),e.jsx(Me,{children:e.jsx(Tc,{locale:s})})]})}];function zc(){return e.jsx(ue,{endpoint:"localizations",title:e.jsx(n,{message:"Localizations"}),columns:Ac,actions:e.jsx(Ec,{}),selectedActions:e.jsx(Te,{}),emptyStateMessage:e.jsx(te,{image:Pc,title:e.jsx(n,{message:"No localizations have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching localizations"})})})}function Ec(){return e.jsx(u.Fragment,{children:e.jsxs(I,{type:"modal",children:[e.jsx(me,{children:e.jsx(n,{message:"Add new localization"})}),e.jsx(Ic,{})]})})}function Tc({locale:s}){const a=ba();return e.jsxs(Ae,{children:[e.jsx(w,{disabled:a.isPending,children:e.jsx(Ss,{})}),e.jsxs(ze,{children:[e.jsx(j,{value:"translate",elementType:D,to:`${s.id}/translate`,children:e.jsx(n,{message:"Translate"})}),e.jsx(j,{value:"rename",onSelected:()=>Qs(Nc,{localization:s}),children:e.jsx(n,{message:"Rename"})}),e.jsx(j,{value:"download",onSelected:()=>ws(`api/v1/localizations/${s.id}/download`),children:e.jsx(n,{message:"Download"})}),e.jsx(j,{value:"upload",onSelected:async()=>{const t=await Qt({types:[Js.json]});t.length==1&&a.mutate({localeId:s.id,file:t[0]})},children:e.jsx(n,{message:"Upload"})})]})]})}function Dc(){const{formId:s,close:a}=q(),t=O();return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Add translation"})}),e.jsx($,{children:e.jsxs(J,{form:t,id:s,onSubmit:i=>{a(i)},children:[e.jsx(Qe,{className:"mb-30",title:e.jsx(n,{message:"Add a new translation, if it does not exist already."}),description:e.jsx(n,{message:"This should only need to be done for things like custom menu items."})}),e.jsx(p,{inputElementType:"textarea",rows:2,autoFocus:!0,name:"key",label:e.jsx(n,{message:"Translation key"}),className:"mb-30",required:!0}),e.jsx(p,{inputElementType:"textarea",rows:2,name:"value",label:e.jsx(n,{message:"Translation value"}),required:!0})]})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:a,children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{variant:"flat",color:"primary",type:"submit",form:s,children:e.jsx(n,{message:"Add"})})]})]})}/** 4 * react-virtual 5 * 6 * Copyright (c) TanStack 7 * 8 * This source code is licensed under the MIT license found in the 9 * LICENSE.md file in the root directory of this source tree. 10 * 11 * @license MIT 12 */function xs(){return xs=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},xs.apply(this,arguments)}/** 13 * virtual-core 14 * 15 * Copyright (c) TanStack 16 * 17 * This source code is licensed under the MIT license found in the 18 * LICENSE.md file in the root directory of this source tree. 19 * 20 * @license MIT 21 */function gs(){return gs=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},gs.apply(this,arguments)}/** 22 * virtual-core 23 * 24 * Copyright (c) TanStack 25 * 26 * This source code is licensed under the MIT license found in the 27 * LICENSE.md file in the root directory of this source tree. 28 * 29 * @license MIT 30 */function Ue(s,a,t){var i,r=(i=t.initialDeps)!=null?i:[],l;return function(){var o;t.key&&t.debug!=null&&t.debug()&&(o=Date.now());var c=s(),d=c.length!==r.length||c.some(function(N,y){return r[y]!==N});if(!d)return l;r=c;var x;if(t.key&&t.debug!=null&&t.debug()&&(x=Date.now()),l=a.apply(void 0,c),t.key&&t.debug!=null&&t.debug()){var g=Math.round((Date.now()-o)*100)/100,h=Math.round((Date.now()-x)*100)/100,f=h/16,b=function(y,z){for(y=String(y);y.length<z;)y=" "+y;return y};console.info("%câ± "+b(h,5)+" /"+b(g,5)+" ms",` 31 font-size: .6rem; 32 font-weight: bold; 33 color: hsl(`+Math.max(0,Math.min(120-120*f,120))+"deg 100% 31%);",t==null?void 0:t.key)}return t==null||t.onChange==null||t.onChange(l),l}}function Is(s,a){if(s===void 0)throw new Error("Unexpected undefined"+(a?": "+a:""));return s}var Mc=function(a,t){return Math.abs(a-t)<1};/** 34 * virtual-core 35 * 36 * Copyright (c) TanStack 37 * 38 * This source code is licensed under the MIT license found in the 39 * LICENSE.md file in the root directory of this source tree. 40 * 41 * @license MIT 42 */var Oc=function(a){return a},Lc=function(a){for(var t=Math.max(a.startIndex-a.overscan,0),i=Math.min(a.endIndex+a.overscan,a.count-1),r=[],l=t;l<=i;l++)r.push(l);return r},Rc=function(a,t){var i=a.scrollElement;if(i){var r=function(c){var d=c.width,x=c.height;t({width:Math.round(d),height:Math.round(x)})};r(i.getBoundingClientRect());var l=new ResizeObserver(function(o){var c=o[0];if(c!=null&&c.borderBoxSize){var d=c.borderBoxSize[0];if(d){r({width:d.inlineSize,height:d.blockSize});return}}r(i.getBoundingClientRect())});return l.observe(i,{box:"border-box"}),function(){l.unobserve(i)}}},$c=function(a,t){var i=a.scrollElement;if(i){var r=function(){t(i[a.options.horizontal?"scrollLeft":"scrollTop"])};return r(),i.addEventListener("scroll",r,{passive:!0}),function(){i.removeEventListener("scroll",r)}}},qc=function(a,t,i){if(t!=null&&t.borderBoxSize){var r=t.borderBoxSize[0];if(r){var l=Math.round(r[i.options.horizontal?"inlineSize":"blockSize"]);return l}}return Math.round(a.getBoundingClientRect()[i.options.horizontal?"width":"height"])},Uc=function(a,t,i){var r,l,o=t.adjustments,c=o===void 0?0:o,d=t.behavior,x=a+c;(r=i.scrollElement)==null||r.scrollTo==null||r.scrollTo((l={}
42,l[i.options.horizontal?"left":"top"]=x,l.behavior=d,l))},Vc=function(a){var t=this;this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=function(){var i=null,r=function(){return i||(typeof ResizeObserver<"u"?i=new ResizeObserver(function(o){o.forEach(function(c){t._measureElement(c.target,c)})}):null)};return{disconnect:function(){var o;return(o=r())==null?void 0:o.disconnect()},observe:function(o){var c;return(c=r())==null?void 0:c.observe(o,{box:"border-box"})},unobserve:function(o){var c;return(c=r())==null?void 0:c.unobserve(o)}}}(),this.range=null,this.setOptions=function(i){Object.entries(i).forEach(function(r){var l=r[0],o=r[1];typeof o>"u"&&delete i[l]}),t.options=gs({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Oc,rangeExtractor:Lc,onChange:function(){},measureElement:qc,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1},i)},this.notify=function(i){t.options.onChange==null||t.options.onChange(t,i)},this.maybeNotify=Ue(function(){return t.calculateRange(),[t.isScrolling,t.range?t.range.startIndex:null,t.range?t.range.endIndex:null]},function(i){t.notify(i)},{key:!1,debug:function(){return t.options.debug},initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=function(){t.unsubs.filter(Boolean).forEach(function(i){return i()}),t.unsubs=[],t.scrollElement=null},this._didMount=function(){return t.measureElementCache.forEach(t.observer.observe),function(){t.observer.disconnect(),t.cleanup()}},this._willUpdate=function(){var i=t.options.getScrollElement();t.scrollElement!==i&&(t.cleanup(),t.scrollElement=i,t._scrollToOffset(t.scrollOffset,{adjustments:void 0,behavior:void 0}),t.unsubs.push(t.options.observeElementRect(t,function(r){t.scrollRect=r,t.maybeNotify()})),t.unsubs.push(t.options.observeElementOffset(t,function(r){t.scrollAdjustments=0,t.scrollOffset!==r&&(t.isScrollingTimeoutId!==null&&(clearTimeout(t.isScrollingTimeoutId),t.isScrollingTimeoutId=null),t.isScrolling=!0,t.scrollDirection=t.scrollOffset<r?"forward":"backward",t.scrollOffset=r,t.maybeNotify(),t.isScrollingTimeoutId=setTimeout(function(){t.isScrollingTimeoutId=null,t.isScrolling=!1,t.scrollDirection=null,t.maybeNotify()},t.options.scrollingDelay))})))},this.getSize=function(){return t.scrollRect[t.options.horizontal?"width":"height"]},this.memoOptions=Ue(function(){return[t.options.count,t.options.paddingStart,t.options.scrollMargin,t.options.getItemKey]},function(i,r,l,o){return t.pendingMeasuredCacheIndexes=[],{count:i,paddingStart:r,scrollMargin:l,getItemKey:o}},{key:!1}),this.getFurthestMeasurement=function(i,r){for(var l=new Map,o=new Map,c=r-1;c>=0;c--){var d=i[c];if(!l.has(d.lane)){var x=o.get(d.lane);if(x==null||d.end>x.end?o.set(d.lane,d):d.end<x.end&&l.set(d.lane,!0),l.size===t.options.lanes)break}}return o.size===t.options.lanes?Array.from(o.values()).sort(function(g,h){return g.end-h.end})[0]:void 0},this.getMeasurements=Ue(function(){return[t.memoOptions(),t.itemSizeCache]},function(i,r){var l=i.count,o=i.paddingStart,c=i.scrollMargin,d=i.getItemKey,x=t.pendingMeasuredCacheIndexes.length>0?Math.min.apply(Math,t.pendingMeasuredCacheIndexes):0;t.pendingMeasuredCacheIndexes=[];for(var g=t.measurementsCache.slice(0,x),h=x;h<l;h++){var f=d(h),b=t.options.lanes===1?g[h-1]:t.getFurthestMeasurement(g,h),N=b?b.end:o+c,y=r.get(f),z=typeof y=="number"?y:t.options.estimateSize(h),V=N+z,Y=b?b.lane:h%t.options.lanes;g[h]={index:h,start:N,size:z,end:V,key:f,lane:Y}}return t.measurementsCache=g,g},{key:!1,debug:function(){return t.options.debug}}),this.calculateRange=Ue(function(){return[t.getMeasurements(),t.getSize(),t.scrollOffset]},function(i,r,l){return t.range=i.length>0&&r>0?Bc({measurements:i,outerSize:r,scrollOffset:l}):null},{key:!1,debug:function(){return t.options.debug}}),this.getIndexes=Ue(function(){return[t.options.rangeExtractor,t.calculateRange(),t.options.overscan,t.options.count]},function(i,r,l,o){return r===null?[]:i(gs({},r,{overscan:l,count:o}))},{key:!1,debug:function(){return t.options.debug}}),this.indexFromElement=function(i){var r=t.options.indexAttribute,l=i.getAttribute(r);return l?parseInt(l,10):(console.warn("Missing attribute name '"+r+"={index}' on measured element."),-1)},this._measureElement=function(i,r){var l=t.measurementsCache[t.indexFromElement(i)];if(!l||!i.isConnected){t.measureElementCache.forEach(function(d,x){d===i&&(t.observer.unobserve(i),t.measureElementCache.delete(x))});return}var o=t.measureElementCache.get(l.key);o!==i&&(o&&t.observer.unobserve(o),t.observer.observe(i),t.measureElementCache.set(l.key,i));var c=t.options.measureElement(i,r,t);t.resizeItem(l,c)},this.resizeItem=function(i,r){var l,o=(l=t.itemSizeCache.get(i.key))!=null?l:i.size,c=r-o;c!==0&&(i.start<t.scrollOffset&&t._scrollToOffset(t.scrollOffset,{adju
42stments:t.scrollAdjustments+=c,behavior:void 0}),t.pendingMeasuredCacheIndexes.push(i.index),t.itemSizeCache=new Map(t.itemSizeCache.set(i.key,r)),t.notify(!1))},this.measureElement=function(i){i&&t._measureElement(i,void 0)},this.getVirtualItems=Ue(function(){return[t.getIndexes(),t.getMeasurements()]},function(i,r){for(var l=[],o=0,c=i.length;o<c;o++){var d=i[o],x=r[d];l.push(x)}return l},{key:!1,debug:function(){return t.options.debug}}),this.getVirtualItemForOffset=function(i){var r=t.getMeasurements();return Is(r[va(0,r.length-1,function(l){return Is(r[l]).start},i)])},this.getOffsetForAlignment=function(i,r){var l=t.getSize();r==="auto"&&(i<=t.scrollOffset?r="start":i>=t.scrollOffset+l?r="end":r="start"),r==="start"?i=i:r==="end"?i=i-l:r==="center"&&(i=i-l/2);var o=t.options.horizontal?"scrollWidth":"scrollHeight",c=t.scrollElement?"document"in t.scrollElement?t.scrollElement.document.documentElement[o]:t.scrollElement[o]:0,d=c-t.getSize();return Math.max(Math.min(d,i),0)},this.getOffsetForIndex=function(i,r){r===void 0&&(r="auto"),i=Math.max(0,Math.min(i,t.options.count-1));var l=Is(t.getMeasurements()[i]);if(r==="auto")if(l.end>=t.scrollOffset+t.getSize()-t.options.scrollPaddingEnd)r="end";else if(l.start<=t.scrollOffset+t.options.scrollPaddingStart)r="start";else return[t.scrollOffset,r];var o=r==="end"?l.end+t.options.scrollPaddingEnd:l.start-t.options.scrollPaddingStart;return[t.getOffsetForAlignment(o,r),r]},this.isDynamicMode=function(){return t.measureElementCache.size>0},this.cancelScrollToIndex=function(){t.scrollToIndexTimeoutId!==null&&(clearTimeout(t.scrollToIndexTimeoutId),t.scrollToIndexTimeoutId=null)},this.scrollToOffset=function(i,r){var l=r===void 0?{}:r,o=l.align,c=o===void 0?"start":o,d=l.behavior;t.cancelScrollToIndex(),d==="smooth"&&t.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t._scrollToOffset(t.getOffsetForAlignment(i,c),{adjustments:void 0,behavior:d})},this.scrollToIndex=function(i,r){var l=r===void 0?{}:r,o=l.align,c=o===void 0?"auto":o,d=l.behavior;i=Math.max(0,Math.min(i,t.options.count-1)),t.cancelScrollToIndex(),d==="smooth"&&t.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var x=t.getOffsetForIndex(i,c),g=x[0],h=x[1];t._scrollToOffset(g,{adjustments:void 0,behavior:d}),d!=="smooth"&&t.isDynamicMode()&&(t.scrollToIndexTimeoutId=setTimeout(function(){t.scrollToIndexTimeoutId=null;var f=t.measureElementCache.has(t.options.getItemKey(i));if(f){var b=t.getOffsetForIndex(i,h),N=b[0];Mc(N,t.scrollOffset)||t.scrollToIndex(i,{align:h,behavior:d})}else t.scrollToIndex(i,{align:h,behavior:d})}))},this.scrollBy=function(i,r){var l=r===void 0?{}:r,o=l.behavior;t.cancelScrollToIndex(),o==="smooth"&&t.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t._scrollToOffset(t.scrollOffset+i,{adjustments:void 0,behavior:o})},this.getTotalSize=function(){var i;return(((i=t.getMeasurements()[t.options.count-1])==null?void 0:i.end)||t.options.paddingStart)-t.options.scrollMargin+t.options.paddingEnd},this._scrollToOffset=function(i,r){var l=r.adjustments,o=r.behavior;t.options.scrollToFn(i,{behavior:o,adjustments:l},t)},this.measure=function(){t.itemSizeCache=new Map,t.notify(!1)},this.setOptions(a),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(i){t.itemSizeCache.set(i.key,i.size)}),this.maybeNotify()},va=function(a,t,i,r){for(;a<=t;){var l=(a+t)/2|0,o=i(l);if(o<r)a=l+1;else if(o>r)t=l-1;else return l}return a>0?a-1:0};function Bc(s){for(var a=s.measurements,t=s.outerSize,i=s.scrollOffset,r=a.length-1,l=function(x){return a[x].start},o=va(0,r,l,i),c=o;c<r&&a[c].end<i+t;)c++;return{startIndex:o,endIndex:c}}/** 43 * react-virtual 44 * 45 * Copyright (c) TanStack 46 * 47 * This source code is licensed under the MIT license found in the 48 * LICENSE.md file in the root directory of this source tree. 49 * 50 * @license MIT 51 */var Hc=typeof document<"u"?u.useLayoutEffect:u.useEffect;function Wc(s){var a=u.useReducer(function(){return{}},{})[1],t=xs({},s,{onChange:function(o,c){c?bn.flushSync(a):a(),s.onChange==null||s.onChange(o,c)}}),i=u.useState(function(){return new Vc(t)}),r=i[0];return r.setOptions(t),u.useEffect(function(){return r._didMount()},[]),Hc(function(){return r._willUpdate()}),r}function Kc(s){return Wc(xs({observeElementRect:Rc,observeElementOffset:$c,scrollToFn:Uc},s))}function Gc(){const{localeId:s}=se(),{data:a,isLoading:t}=wc(s),i=a==null?void 0:a.localization;return t||!i?e.jsx(Fe,{}):e.jsx(Qc,{localization:i})}function Qc({localization:s}){const[a,t]=u.useState(s.lines||{}),i=ce(),r=fa(),[l,o]=u.useState("");return e.jsxs("form",{className:"flex h-full flex-col p-14 md:p-24",onSubmit:c=>{c.preventDefault(),r.mutate({id:s.id,lines:a},{onSuccess:()=>{i("/admin/localizations")}})},children:[e.jsx(Jc,{localization:s,setLines:t,lines:a,searchQuery:l,setSearchQuery:o,isLoading:r.isPending}),e.jsx(Yc,{lines:a,setLines:t,searchQuery:l})]})}
51function Jc({localization:s,searchQuery:a,setSearchQuery:t,isLoading:i,lines:r,setLines:l}){const o=ce(),c=Ke(),{trans:d}=F();return e.jsxs("div",{className:"flex-shrink-0",children:[e.jsxs(Pi,{size:"lg",className:"mb-16",children:[e.jsx(yt,{onSelected:()=>{o("/admin/localizations")},children:e.jsx(n,{message:"Localizations"})}),e.jsx(yt,{children:e.jsx(n,{message:":locale translations",values:{locale:s.name}})})]}),e.jsxs("div",{className:"mb-24 flex items-center gap-32 md:gap-12",children:[e.jsx("div",{className:"max-w-440 flex-auto",children:e.jsx(xe,{value:a,onChange:x=>t(x.target.value),startAdornment:e.jsx(Jt,{}),placeholder:d({message:"Type to search..."})})}),e.jsxs(I,{type:"modal",onClose:x=>{if(x){const g={...r};g[x.key]=x.value,l(g)}},children:[!c&&e.jsx(v,{className:"ml-auto",variant:"outline",color:"primary",startIcon:e.jsx(ge,{}),children:e.jsx(n,{message:"Add new"})}),e.jsx(Dc,{})]}),e.jsx(Zc,{locale:s}),e.jsx(v,{variant:"flat",color:"primary",type:"submit",disabled:i,children:c?e.jsx(n,{message:"Save"}):e.jsx(n,{message:"Save translations"})})]})]})}function Yc({searchQuery:s,lines:a,setLines:t}){const i=u.useMemo(()=>Object.entries(a).filter(([o,c])=>{const d=s==null?void 0:s.toLowerCase();return!d||(o==null?void 0:o.toLowerCase().includes(d))||(c==null?void 0:c.toLowerCase().includes(d))}),[a,s]),r=u.useRef(null),l=Kc({count:i.length,getScrollElement:()=>r.current,estimateSize:()=>123});return e.jsx("div",{className:"flex-auto overflow-y-auto",ref:r,children:e.jsx("div",{className:"relative w-full",style:{height:`${l.getTotalSize()}px`},children:l.getVirtualItems().map(o=>{const[c,d]=i[o.index];return e.jsx("div",{className:"absolute left-0 top-0 w-full",style:{height:`${o.size}px`,transform:`translateY(${o.start}px)`},children:e.jsxs("div",{className:"mb-10 rounded border md:mr-10",children:[e.jsxs("div",{className:"flex items-center justify-between gap-24 border-b px-10 py-2",children:[e.jsx("label",{className:"flex-auto text-xs font-semibold",htmlFor:c,children:c}),e.jsx(w,{size:"xs",className:"text-muted",onClick:()=>{const x={...a};delete x[c],t(x)},children:e.jsx(_e,{})})]}),e.jsx("div",{children:e.jsx("textarea",{id:c,name:c,defaultValue:d,className:"block w-full resize-none rounded bg-inherit p-10 text-sm outline-none focus-visible:ring-2",rows:2,onChange:x=>{const g={...a};g[c]=x.target.value,t(g)}})})]})},c)})})})}function Zc({locale:s}){const a=ba();return e.jsxs(Ae,{children:[e.jsx(w,{variant:"outline",size:"sm",color:"primary",disabled:a.isPending,children:e.jsx(Ss,{})}),e.jsxs(ze,{children:[e.jsx(j,{value:"download",onSelected:()=>ws(`api/v1/localizations/${s.id}/download`),children:e.jsx(n,{message:"Download"})}),e.jsx(j,{value:"upload",onSelected:async()=>{const t=await Qt({types:[Js.json]});t.length==1&&a.mutate({localeId:s.id,file:t[0]})},children:e.jsx(n,{message:"Upload"})})]})]})}function Xc(s){const{close:a}=q(),{image:t,images:i}=s,[r,l]=ss(s.activeIndex,s.defaultActiveIndex,s.onActiveIndexChange),o=t||(i==null?void 0:i[r]);return e.jsx(R,{size:"fullscreenTakeover",background:"bg-black/80",children:e.jsxs($,{padding:"p-0",className:"h-full w-full",children:[e.jsx(w,{size:"lg",color:"paper",className:"absolute right-0 top-0 z-20 text-white",onClick:()=>{a()},children:e.jsx(_e,{})}),e.jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-40",children:[i!=null&&i.length?e.jsx(w,{size:"lg",color:"white",variant:"flat",className:"absolute bottom-0 left-20 top-0 my-auto",disabled:r<1,onClick:()=>{l(r-1)},children:e.jsx(Bt,{})}):null,e.jsx("img",{src:o,alt:"",className:"max-h-full w-auto object-contain shadow"}),i!=null&&i.length?e.jsx(w,{size:"lg",color:"white",variant:"flat",className:"absolute bottom-0 right-20 top-0 my-auto",disabled:r+1===(i==null?void 0:i.length),onClick:()=>{l(r+1)},children:e.jsx(et,{})}):null]})]})})}function ed(){var a;const s=os();return e.jsxs("div",{className:"container mx-auto p-12 md:p-24",children:[e.jsx(Bs,{children:e.jsx(n,{message:"Ads"})}),e.jsx("h1",{className:"mb-20 text-2xl font-light md:mb-40 md:text-3xl",children:e.jsx(n,{message:"Predefined Ad slots"})}),s.isLoading?e.jsx(re,{isIndeterminate:!0}):e.jsx(sd,{defaultValues:((a=s.data)==null?void 0:a.client.ads)||{}})]})}function sd({defaultValues:s}){const{admin:{ads:a}}=u.useContext(Le),t=O({defaultValues:{client:{ads:s}}}),i=ha(t);return e.jsxs(J,{form:t,onSubmit:r=>{i.mutate(r)},children:[a.map(r=>e.jsx(td,{adConfig:r},r.slot)),e.jsx(C,{name:"client.ads.disable",className:"mb-30",description:e.jsx(n,{message:"Disable all add related functionality across the site."}),children:e.jsx(n,{message:"Disable ads"})}),e.jsx(v,{type:"submit",variant:"flat",color:"primary",disabled:i.isPending,children:e.jsx(n,{message:"Save"})})]})}function td({adConfig:s}){return e.jsxs("div",{className:"flex items-center gap-24",children:[e.jsx(p,{className:"mb-30 flex-auto",name:`client.${s.slot}`,inputElementType:"textarea",rows:8,label:e.jsx(n,{...s.description})}),e.jsxs(I,{type:"modal",children:[e.jsx("button",{type:"button",className:"cursor-zoom-in overflow-hidden rounded outline-none transition hover:scale-105 focus-visible:ring max-md:hidden",children:e.jsx("img",{src:s.image,className:"h-[186px] w-auto border",alt:"Ad slot example"})}),e.jsx(Xc,{image:s.image})]})]})}function ad(){const s=$e(t=>{var i;return(i=t.config)==null?void 0:i.sections}),a=u.useMemo(()=>s?Object.entries(s||[]).map(([t,i])=>({...i,key:t})).sort((t,i)=>((t==null?void 0:t.position)||1)-((i==null?void 0:i.position)||1)):[],[s]);return e.jsx(u.Fragment,{children:a.map(t=>e.jsx(le,{to:t.key,elementType:Gs,children:e.jsx(n,{...t.label})},t.key))})}const nd=[{key:"type",label:m("Type"),description:m("Type of the role"),defaultOperator:B.ne,control:{type:oe.Select,defaultValue:"01",options:[{key:"01",label:m("Sitewide"),value:"sitewide"},{key:"02",label:m("Workspace"),value:"workspace"}]}},Ie({description:m("Date role was created")}),Ee({description:m("Date role was last updated")})],id=[{key:"name",allowsSorting:!0,visibleInMode:"all",header:()=>e.jsx(n,{message:"Role"}),body:s=>
51e.jsxs("div",{children:[e.jsx("div",{children:e.jsx(n,{message:s.name})}),e.jsx("div",{className:"text-muted text-xs overflow-x-hidden overflow-ellipsis",children:s.description?e.jsx(n,{message:s.description}):void 0})]})},{key:"type",maxWidth:"max-w-100",allowsSorting:!0,header:()=>e.jsx(n,{message:"Type"}),body:s=>e.jsx(n,{message:s.type})},{key:"updated_at",maxWidth:"max-w-100",allowsSorting:!0,header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(X,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-42 flex-shrink-0",body:s=>e.jsx(D,{to:`${s.id}/edit`,children:e.jsx(w,{size:"md",className:"text-muted",children:e.jsx(Ne,{})})})}];function rd(){return e.jsx(ue,{endpoint:"roles",title:e.jsx(n,{message:"Roles"}),columns:id,filters:nd,actions:e.jsx(ld,{}),selectedActions:e.jsx(Te,{}),emptyStateMessage:e.jsx(te,{image:ts,title:e.jsx(n,{message:"No roles have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching roles"})})})}function ld(){return e.jsxs(u.Fragment,{children:[e.jsx(na,{endpoint:"roles/csv/export"}),e.jsx(me,{elementType:D,to:"new",children:e.jsx(n,{message:"Add new role"})})]})}const ya=s=>`roles/${s}`;function od(){const{roleId:s}=se();return be({queryKey:[ya(s)],queryFn:()=>cd(s)})}function cd(s){return S.get(ya(s)).then(a=>a.data)}const wa=s=>`roles/${s}`;function dd(){const{trans:s}=F(),a=ce();return A({mutationFn:t=>ud(t),onSuccess:t=>{P(s(m("Role updated"))),T.invalidateQueries({queryKey:[wa(t.role.id)]}),T.invalidateQueries({queryKey:W("roles")}),a("/admin/roles")},onError:t=>G(t)})}function ud({id:s,...a}){return S.put(wa(s),a).then(t=>t.data)}function Sa({isInternal:s=!1}){const{trans:a}=F(),{workspaces:t}=ae(),{watch:i,setValue:r}=k(),l=i("type");return e.jsxs(e.Fragment,{children:[e.jsx(p,{label:e.jsx(n,{message:"Name"}),name:"name",className:"mb-20",required:!0}),e.jsx(p,{label:e.jsx(n,{message:"Description"}),name:"description",inputElementType:"textarea",placeholder:a(m("Role description...")),rows:4,className:"mb-20"}),t.integrated&&e.jsxs(M,{label:e.jsx(n,{message:"Type"}),name:"type",selectionMode:"single",className:"mb-20",description:e.jsx(n,{message:"Whether this role will be assigned to users globally on the site or only within workspaces."}),children:[e.jsx(j,{value:"sitewide",children:e.jsx(n,{message:"Sitewide"})}),e.jsx(j,{value:"workspace",children:e.jsx(n,{message:"Workspace"})})]}),!s&&e.jsxs(e.Fragment,{children:[e.jsx(C,{name:"default",className:"mb-20",description:e.jsx(n,{message:"Assign this role to new users automatically."}),children:e.jsx(n,{message:"Default"})}),l==="sitewide"&&e.jsx(C,{name:"guests",description:e.jsx(n,{message:"Assign this role to guests (not logged in users)."}),children:e.jsx(n,{message:"Guests"})})]}),e.jsxs("div",{className:"mb-14 mt-30 flex items-end justify-between gap-12",children:[e.jsx("h2",{className:"text-lg leading-tight",children:e.jsx(n,{message:"Permissions"})}),e.jsx(v,{variant:"outline",size:"xs",onClick:()=>r("permissions",[]),children:e.jsx(n,{message:"Remove all"})})]}),e.jsx(ct,{name:"permissions",valueListKey:l==="sitewide"?"permissions":"workspacePermissions"})]})}function md({onUserSelected:s}){var x;const{close:a}=q(),[t,i]=u.useState(""),{trans:r}=F(),l=Hn("normalized-models/user",{query:t,perPage:14}),o=((x=l.data)==null?void 0:x.results)||[],c=e.jsx(Ws,{className:"pt-20",size:"sm",title:e.jsx(n,{message:"No matching users"}),description:e.jsx(n,{message:"Try another search query"}),image:e.jsx(Ks,{src:ts})}),d=g=>{a(),s(g)};return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Select a user"})}),e.jsxs($,{children:[e.jsx(xe,{autoFocus:!0,className:"mb-20",startAdornment:e.jsx(Jt,{}),placeholder:r(m("Search for user by name or email")),value:t,onChange:g=>{i(g.target.value)}}),!l.isLoading&&!o.length&&c,e.jsx("div",{className:"grid grid-cols-2 gap-x-10",children:o.map(g=>e.jsx(xd,{user:g,onUserSelected:d},g.id))})]})]})}function xd({user:s,onUserSelected:a}){return e.jsxs("div",{className:"flex items-center gap-10 rounded p-10 outline-none ring-offset-4 hover:bg-hover focus-visible:ring",role:"button",tabIndex:0,onClick:()=>{a(s)},onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),a(s))},children:[e.jsx(Wn,{src:s.image}),e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("div",{className:"overflow-hidden text-ellipsis",children:s.name}),e.jsx("div",{className:"overflow-hidden text-ellipsis text-muted",children:s.description})]})]},s.id)}function gd(s){return A({mutationFn:({userIds:a})=>hd({userIds:a,roleId:s.id}),onSuccess:(a,t)=>{P(m("Removed [one 1 user|other :count users] from â{role}â",{values:{count:t.userIds.length,role:s.name}}))},onError:a=>G(a)})}function hd({roleId:s,userIds:a}){return S.post(`roles/${s}/remove-users`,{userIds:a}).then(t=>t.data)}function pd(s){return A({mutationFn:({userIds:a})=>jd({userIds:a,roleId:s.id}),onSuccess:(a,t)=>{P(m("Assigned [one 1 user|other :count users] to {role}",{values:{count:t.userIds.length,role:s.name}}))},onError:a=>G(a)})}
51function jd({roleId:s,userIds:a}){return S.post(`roles/${s}/add-users`,{userIds:a}).then(t=>t.data)}const ka={key:"name",allowsSorting:!0,sortingKey:"email",header:()=>e.jsx(n,{message:"User"}),body:s=>e.jsx(fe,{image:s.avatar,label:s.display_name,description:s.email}),width:"col-w-3"},fd=[ka,{key:"first_name",allowsSorting:!0,header:()=>e.jsx(n,{message:"First name"}),body:s=>s.first_name},{key:"last_name",allowsSorting:!0,header:()=>e.jsx(n,{message:"Last name"}),body:s=>s.last_name},{key:"created_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Assigned at"}),body:s=>e.jsx(X,{date:s.created_at})}],bd=[ka];function vd({role:s}){const a=Ke();return s.guests||s.type==="workspace"?e.jsx("div",{className:"pt-30 pb-10",children:e.jsx(te,{image:ts,title:e.jsx(n,{message:"Users can't be assigned to this role"})})}):e.jsx(ei,{endpoint:"users",columns:a?bd:fd,queryParams:{roleId:`${s.id}`},actions:e.jsx(yd,{role:s}),selectedActions:e.jsx(wd,{role:s}),emptyStateMessage:e.jsx(te,{image:ts,title:e.jsx(n,{message:"No users have been assigned to this role yet"}),filteringTitle:e.jsx(n,{message:"No matching users"})})})}function yd({role:s}){const a=pd(s);return e.jsxs(I,{type:"modal",children:[e.jsx(v,{variant:"flat",color:"primary",disabled:a.isPending,children:e.jsx(n,{message:"Assign user"})}),e.jsx(md,{onUserSelected:t=>{a.mutate({userIds:[t.id]},{onSuccess:()=>{T.invalidateQueries({queryKey:W("users",{roleId:`${s.id}`})})}})}})]})}function wd({role:s}){const a=gd(s),{selectedRows:t}=Xt();return e.jsxs(I,{type:"modal",onClose:i=>{i&&a.mutate({userIds:t},{onSuccess:()=>{T.invalidateQueries({queryKey:W("users",{roleId:`${s.id}`})})}})},children:[e.jsx(v,{variant:"flat",color:"danger",disabled:a.isPending,children:e.jsx(n,{message:"Remove users"})}),e.jsx(pe,{title:e.jsx(n,{message:"Remove [one 1 user|other :count users] from â:nameâ role?",values:{count:t.length,name:s.name}}),body:e.jsx(n,{message:"This will permanently remove the users."}),confirm:e.jsx(n,{message:"Remove"}),isDanger:!0})]})}function Sd(){const s=od();return s.status!=="success"?e.jsx(Fe,{}):e.jsx(kd,{role:s.data.role})}function kd({role:s}){const a=O({defaultValues:s}),t=dd();return e.jsx(cs,{form:a,onSubmit:i=>{t.mutate(i)},title:e.jsx(n,{message:"Edit â:nameâ role",values:{name:s.name}}),isLoading:t.isPending,children:e.jsxs(vs,{isLazy:!0,children:[e.jsxs(ys,{children:[e.jsx(Ce,{children:e.jsx(n,{message:"Settings"})}),e.jsx(Ce,{children:e.jsx(n,{message:"Users"})})]}),e.jsxs(tt,{className:"pt-20",children:[e.jsx(We,{children:e.jsx(Sa,{isInternal:s.internal})}),e.jsx(We,{children:e.jsx(vd,{role:s})})]})]})})}const Nd="roles";function Cd(s){const{trans:a}=F();return A({mutationFn:t=>_d(t),onSuccess:()=>{P(a(m("Created new role"))),T.invalidateQueries({queryKey:W("roles")})},onError:t=>ee(t,s)})}function _d({id:s,...a}){return S.post(Nd,a).then(t=>t.data)}function Id(){const s=O({defaultValues:{type:"sitewide"}}),a=Cd(s),t=ce();return e.jsx(cs,{form:s,onSubmit:i=>{a.mutate(i,{onSuccess:r=>{t(`/admin/roles/${r.role.id}/edit`)}})},title:e.jsx(n,{message:"Add new role"}),isLoading:a.isPending,children:e.jsx(Sa,{})})}const Pd=s=>[{key:"type",label:m("Type"),description:m("Type of the tag"),defaultOperator:B.ne,control:{type:oe.Select,defaultValue:s[0].name,options:s.map(a=>({key:a.name,label:m(a.name),value:a.name}))}},Ie({description:m("Date tag was created")}),Ee({description:m("Date tag was last updated")})],Na=""+new URL("software-engineer-ba026106.svg",import.meta.url).href;function Ca({form:s,onSubmit:a,formId:t}){const{tags:{types:i}}=u.useContext(Le),r=s.watch("type"),l=!!i.find(o=>o.name===r&&o.system);return e.jsxs(J,{id:t,form:s,onSubmit:a,children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),description:e.jsx(n,{message:"Unique tag identifier."}),className:"mb-20",required:!0,autoFocus:!0}),e.jsx(p,{name:"display_name",label:e.jsx(n,{message:"Display name"}),description:e.jsx(n,{message:"User friendly tag name."}),className:"mb-20"}),e.jsx(M,{label:e.jsx(n,{message:"Type"}),name:"type",selectionMode:"single",disabled:l,children:i.filter(o=>!o.system).map(o=>e.jsx(j,{value:o.name,children:e.jsx(n,{message:o.name})},o.name))})]})}var _a={exports:{}};(function(s,a){(function(t,i,r){s.exports=r(),s.exports.default=r()})("slugify",vn,function(){var t
vendor: 6,291 bytes, line 51
51=JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","Â¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","Ã":"A","Ã":"A","Ã":"A","Ã":"A","Ã":"A","Ã
":"A","Ã":"AE","Ã":"C","Ã":"E","Ã":"E","Ã":"E","Ã":"E","Ã":"I","Ã":"I","Ã":"I","Ã":"I","Ã":"D","Ã":"N","Ã":"O","Ã":"O","Ã":"O","Ã":"O","Ã":"O","Ã":"O","Ã":"U","Ã":"U","Ã":"U","Ã":"U","Ã":"Y","Ã":"TH","Ã":"ss","à ":"a","á":"a","â":"a","ã":"a","ä":"a","Ã¥":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","Ã":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ä":"A","Ä":"a","Ä":"A","Ä":"a","Ä":"A","Ä
":"a","Ä":"C","Ä":"c","Ä":"C","Ä":"c","Ä":"D","Ä":"d","Ä":"DJ","Ä":"dj","Ä":"E","Ä":"e","Ä":"E","Ä":"e","Ä":"e","Ä":"e","Ä":"E","Ä":"e","Ä":"G","Ä":"g","Ä¢":"G","Ä£":"g","Ĩ":"I","Ä©":"i","Ī":"i","Ä«":"i","Ä®":"I","į":"i","İ":"I","ı":"i","Ķ":"k","Ä·":"k","Ä»":"L","ļ":"l","Ľ":"L","ľ":"l","Å":"L","Å":"l","Å":"N","Å":"n","Å
":"N","Å":"n","Å":"N","Å":"n","Å":"O","Å":"o","Å":"O","Å":"o","Å":"OE","Å":"oe","Å":"R","Å":"r","Å":"R","Å":"r","Å":"S","Å":"s","Å":"S","Å":"s","Å ":"S","Å¡":"s","Å¢":"T","Å£":"t","Ť":"T","Å¥":"t","Ũ":"U","Å©":"u","Ū":"u","Å«":"u","Å®":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Å´":"W","ŵ":"w","Ŷ":"Y","Å·":"y","Ÿ":"Y","Ź":"Z","ź":"z","Å»":"Z","ż":"z","Ž":"Z","ž":"z","Æ":"E","Æ":"f","Æ ":"O","Æ¡":"o","Ư":"U","ư":"u","Ç":"LJ","Ç":"lj","Ç":"NJ","Ç":"nj","È":"S","È":"s","È":"T","È":"t","É":"e","Ë":"o","Î":"A","Î":"E","Î":"H","Î":"I","Î":"O","Î":"Y","Î":"W","Î":"i","Î":"A","Î":"B","Î":"G","Î":"D","Î":"E","Î":"Z","Î":"H","Î":"8","Î":"I","Î":"K","Î":"L","Î":"M","Î":"N","Î":"3","Î":"O","Î ":"P","Ρ":"R","Σ":"S","Τ":"T","Î¥":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","Î":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","Ï":"p","Ï":"r","Ï":"s","Ï":"s","Ï":"t","Ï
":"y","Ï":"f","Ï":"x","Ï":"ps","Ï":"w","Ï":"i","Ï":"y","Ï":"o","Ï":"y","Ï":"w","Ð":"Yo","Ð":"DJ","Ð":"Ye","Ð":"I","Ð":"Yi","Ð":"J","Ð":"LJ","Ð":"NJ","Ð":"C","Ð":"DZ","Ð":"A","Ð":"B","Ð":"V","Ð":"G","Ð":"D","Ð":"E","Ð":"Zh","Ð":"Z","Ð":"I","Ð":"J","Ð":"K","Ð":"L","Ð":"M","Ð":"N","Ð":"O","Ð":"P","Ð ":"R","С":"S","Т":"T","У":"U","Ф":"F","Ð¥":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Ð":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","Ñ":"r","Ñ":"s","Ñ":"t","Ñ":"u","Ñ":"f","Ñ
":"h","Ñ":"c","Ñ":"ch","Ñ":"sh","Ñ":"sh","Ñ":"u","Ñ":"y","Ñ":"","Ñ":"e","Ñ":"yu","Ñ":"ya","Ñ":"yo","Ñ":"dj","Ñ":"ye","Ñ":"i","Ñ":"yi","Ñ":"j","Ñ":"lj","Ñ":"nj","Ñ":"c","Ñ":"u","Ñ":"dz","Ò":"G","Ò":"g","Ò":"GH","Ò":"gh","Ò":"KH","Ò":"kh","Ò¢":"NG","Ò£":"ng","Ò®":"UE","Ò¯":"ue","Ò°":"U","Ò±":"u","Òº":"H","Ò»":"h","Ó":"AE","Ó":"ae","Ó¨":"OE","Ó©":"oe","Ô±":"A","Ô²":"B","Ô³":"G","Ô´":"D","Ôµ":"E","Ô¶":"Z","Ô·":"E'","Ô¸":"Y'","Ô¹":"T'","Ôº":"JH","Ô»":"I","Ô¼":"L","Ô½":"X","Ô¾":"C'","Ô¿":"K","Õ":"H","Õ":"D'","Õ":"GH","Õ":"TW","Õ":"M","Õ
":"Y","Õ":"N","Õ":"SH","Õ":"CH","Õ":"P","Õ":"J","Õ":"R'","Õ":"S","Õ":"V","Õ":"T","Õ":"R","Õ":"C","Õ":"P'","Õ":"Q'","Õ":"O''","Õ":"F","Ö":"EV","Ø¡":"a","Ø¢":"aa","Ø£":"a","ؤ":"u","Ø¥":"i","ئ":"e","ا":"a","ب":"b","Ø©":"h","ت":"t","Ø«":"th","ج":"j","Ø":"h","Ø®":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","Ø´":"sh","ص":"s","ض":"dh","Ø·":"t","ظ":"z","ع":"a","غ":"gh","Ù":"f","Ù":"q","Ù":"k","Ù":"l","Ù
":"m","Ù":"n","Ù":"h","Ù":"w","Ù":"a","Ù":"y","Ù":"an","Ù":"on","Ù":"en","Ù":"a","Ù":"u","Ù":"e","Ù":"","Ù ":"0","Ù¡":"1","Ù¢":"2","Ù£":"3","Ù¤":"4","Ù¥":"5","Ù¦":"6","Ù§":"7","Ù¨":"8","Ù©":"9","Ù¾":"p","Ú":"ch","Ú":"zh","Ú©":"k","Ú¯":"g","Û":"y","Û°":"0","Û±":"1","Û²":"2","Û³":"3","Û´":"4","Ûµ":"5","Û¶":"6","Û·":"7","Û¸":"8","Û¹":"9","฿":"baht","á":"a","á":"b","á":"g","á":"d","á":"e","á":"v","á":"z","á":"t","á":"i","á":"k","á":"l","á":"m","á":"n","á":"o","á":"p","á":"zh","á ":"r","á¡":"s","á¢":"t","á£":"u","á¤":"f","á¥":"k","á¦":"gh","á§":"q","á¨":"sh","á©":"ch","áª":"ts","á«":"dz","á¬":"ts","á":"ch","á®":"kh","á¯":"j","á°":"h","á¹¢":"S","á¹£":"s","áº":"W","áº":"w","áº":"W","áº":"w","áº":"W","áº
":"w","áº":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","áº":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","á»":"E","á»":"e","á»":"E","á»":"e","á»":"E","á»
":"e","á»":"E","á»":"e","á»":"I","á»":"i","á»":"I","á»":"i","á»":"O","á»":"o","á»":"O","á»":"o","á»":"O","á»":"o","á»":"O","á»":"o","á»":"O","á»":"o","á»":"O","á»":"o","á»":"O","á»":"o","á»":"O","á»":"o","á»":"O","á»":"o","á»":"O","á»":"o","á» ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","á»§":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","á»":"u","á»®":"U","ữ":"u","á»°":"U","á»±":"u","Ỳ":"Y","ỳ":"y","á»´":"Y","ỵ":"y","á»¶":"Y","á»·":"y","Ỹ":"Y","ỹ":"y","â":"-","â":"'","â":"'","â":"\\"","â":"\\"","â":"\\"","â ":"+","â¢":"*","â¦":"...","â ":"ecu","â¢":"cruzeiro","â£":"french franc","â¤":"lira","â¥":"mill","â¦":"naira","â§":"peseta","â¨":"rupee","â©":"won","âª":"new shequel","â«":"dong","â¬":"euro","â":"kip","â®":"tugrik","â¯":"drachma","â°":"penny","â±":"peso","â²":"guarani","â³":"austral","â´":"hryvnia","âµ":"cedi","â¸":"kazakhstani tenge","â¹":"indian rupee","âº":"turkish lira","â½":"russian ruble","â¿":"bitcoin","â ":"sm","â¢":"tm","â":"d","â":"delta","â":"sum","â":"infinity","â¥":"love","å
":"yuan","å":"yen","ï·¼":"rial","ﻵ":"laa","ï»·":"laa","ﻹ":"lai","ï»»":"la"}`),
51i=JSON.parse('{"bg":{"Ð":"Y","Ц":"Ts","Щ":"Sht","Ъ":"A","Ь":"Y","й":"y","Ñ":"ts","Ñ":"sht","Ñ":"a","Ñ":"y"},"de":{"Ã":"AE","ä":"ae","Ã":"OE","ö":"oe","Ã":"UE","ü":"ue","Ã":"ss","%":"prozent","&":"und","|":"oder","â":"summe","â":"unendlich","â¥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","â£":"francos","â":"suma","â":"infinito","â¥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","â£":"franc","â":"somme","â":"infini","â¥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","â":"soma","£":"libra","â":"infinito","â¥":"amor"},"uk":{"Ð":"Y","и":"y","Ð":"Y","й":"y","Ц":"Ts","Ñ":"ts","Ð¥":"Kh","Ñ
":"kh","Щ":"Shch","Ñ":"shch","Ð":"H","г":"h"},"vi":{"Ä":"D","Ä":"d"},"da":{"Ã":"OE","ø":"oe","Ã
":"AA","Ã¥":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"større end"},"nb":{"&":"og","Ã
":"AA","Ã":"AE","Ã":"OE","Ã¥":"aa","æ":"ae","ø":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","Ã
":"AA","Ã":"AE","Ã":"OE","Ã¥":"aa","ä":"ae","ö":"oe"}}');function r(l,o){if(typeof l!="string")throw new Error("slugify: string argument expected");o=typeof o=="string"?{replacement:o}:o||{};var c=i[o.locale]||{},d=o.replacement===void 0?"-":o.replacement,x=o.trim===void 0?!0:o.trim,g=l.normalize().split("").reduce(function(h,f){var b=c[f];return b===void 0&&(b=t[f]),b===void 0&&(b=f),b===d&&(b=" "),h+b.replace(o.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")},"");return o.strict&&(g=g.replace(/[^A-Za-z0-9\s]/g,"")),x&&(g=g.trim()),g=g.replace(/\s+/g,d),o.lower&&(g=g.toLowerCase()),g}return r.extend=function(l){Object.assign(t,l)},r})})(_a);var Fd=_a.exports;const Ad=yn(Fd);function ht(s,a="-",t=!1){if(!s)return s;let i=Ad(s,{lower:!0,replacement:a,strict:t,remove:/[*+~.()'"!:@?\|/\\#]/g});return i||(i=s.replace(/\s+/g,"-").toLowerCase()),i}function zd(s){const{trans:a}=F();return A({mutationFn:t=>Ed(t),onSuccess:()=>{P(a(m("Tag created"))),T.invalidateQueries({queryKey:W("tags")})},onError:t=>ee(t,s)})}function Ed(s){return s.name=ht(s.name),S.post("tags",s).then(a=>a.data)}function Td(){const{close:s,formId:a}=q(),{tags:{types:t}}=u.useContext(Le),i=O({defaultValues:{type:t[0].name}}),r=zd(i);return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Add new tag"})}),e.jsx($,{children:e.jsx(Ca,{formId:a,form:i,onSubmit:l=>{r.mutate(l,{onSuccess:()=>{s()}})}})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>{s()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{form:a,disabled:r.isPending,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}function Dd(s){const{trans:a}=F();return A({mutationFn:t=>Md(t),onSuccess:()=>{P(a(m("Tag updated"))),T.invalidateQueries({queryKey:W("tags")})},onError:t=>ee(t,s)})}function Md({id:s,...a}){return a.name&&(a.name=ht(a.name)),S.put(`tags/${s}`,a).then(t=>t.data)}function Od({tag:s}){const{close:a,formId:t}=q(),i=O({defaultValues:{id:s.id,name:s.name,display_name:s.display_name,type:s.type}}),r=Dd(i);return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Update â:nameâ tag",values:{name:s.name}})}),e.jsx($,{children:e.jsx(Ca,{formId:t,form:i,onSubmit:l=>{r.mutate(l,{onSuccess:()=>{a()}})}})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>{a()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{form:t,disabled:r.isPending,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}const Ld=[{key:"name",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Name"}),body:s=>s.name},{key:"type",allowsSorting:!0,header:()=>e.jsx(n,{message:"Type"}),body:s=>s.type},{key:"display_name",allowsSorting:!0,header:()=>e.jsx(n,{message:"Display name"}),body:s=>s.display_name},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(X,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs(I,{type:"modal",children:[e.jsx(w,{size:"md",className:"text-muted",children:e.jsx(Ne,{})}),e.jsx(Od,{tag:s})]})}];function Rd(){const{tags:s}=u.useContext(Le),a=u.useMemo(()=>Pd(s.types),[s.types]);return e.jsx(ue,{endpoint:"tags",title:e.jsx(n,{message:"Tags"}),columns:Ld,filters:a,actions:e.jsx($d,{}),selectedActions:e.jsx(Te,{}),emptyStateMessage:e.jsx(te,{image:Na,title:e.jsx(n,{message:"No tags have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching tags"})})})}function $d(){return e.jsx(e.Fragment,{children:e.jsxs(I,{type:"modal",children:[e.jsx(me,{children:e.jsx(n,{message:"Add new tag"})}),e.jsx(Td,{})]})})}const qd=[{key:"ends_at",label:m("Status"),description:m("Whether subscription is active or cancelled"),defaultOperator:B.eq,control:{type:oe.Select,defaultValue:"active",options:[{key:"active",label:m("Active"),value:{value:null,operator:B.eq}},{key:"cancelled",label:m("Cancelled"),value:{value:null,operator:B.ne}}]}},{control:{type:oe.Select,defaultValue:"stripe",options:[{key:"stripe",label:m("Stripe"),value:"stripe"},{key:"paypal",label:m("PayPal"),value:"paypal"},{key:"none",label:m("None"),value:"none"}]},key:"gateway_name",label:m("Gateway"),description:m("With which payment provider was subscription created"),defaultOperator:B.eq},si({key:"renews_at",label:m("Renew date"),description:m("Date subscription will renew")}),Ie({description:m("Date subscription was created")}),Ee({description:m("Date subscription was last updated")})],Ud=""+new URL("subscriptions-7eacea42.svg",import.meta.url).href;function Vd(s){const{trans:a}=F();return A({mutationFn:t=>Bd(t),onSuccess:()=>
51{P(a(m("Subscription updated"))),T.invalidateQueries({queryKey:W("billing/subscriptions")})},onError:t=>ee(t,s)})}function Bd({id:s,...a}){return S.put(`billing/subscriptions/${s}`,a).then(t=>t.data)}function Ia({form:s,onSubmit:a,formId:t}){var x,g;const i=wn(),r=s.watch("product_id"),l=(x=i.data)==null?void 0:x.products.find(h=>h.id===Number(r)),o=s.watch("price_id"),c=l==null?void 0:l.prices.find(h=>h.id===Number(o)),d=(c==null?void 0:c.interval)==="one_time";return u.useEffect(()=>{d&&(s.setValue("renews_at",void 0),s.setValue("ends_at",void 0),s.clearErrors(["renews_at","ends_at"]))},[s,d]),e.jsxs(J,{id:t,form:s,onSubmit:a,children:[e.jsx(Zt,{name:"user_id",className:"mb-20",endpoint:"normalized-models/user",label:e.jsx(n,{message:"User"})}),e.jsx(M,{name:"product_id",selectionMode:"single",className:"mb-20",label:e.jsx(n,{message:"Plan"}),children:(g=i.data)==null?void 0:g.products.filter(h=>!h.free).map(h=>e.jsx(j,{value:h.id,children:e.jsx(n,{message:h.name})},h.id))}),!(l!=null&&l.free)&&e.jsx(M,{name:"price_id",selectionMode:"single",className:"mb-20",label:e.jsx(n,{message:"Price"}),children:l==null?void 0:l.prices.map(h=>e.jsx(j,{value:h.id,children:e.jsx(Ys,{price:h})},h.id))}),e.jsx(p,{inputElementType:"textarea",rows:3,name:"description",label:e.jsx(n,{message:"Description"}),className:"mb-20"}),!d&&e.jsxs(e.Fragment,{children:[e.jsx(Ts,{className:"mb-20",name:"renews_at",granularity:"day",label:e.jsx(n,{message:"Renews at"}),description:e.jsx(n,{message:"This will only change local records. User will continue to be billed on their original cycle on the payment gateway."})}),e.jsx(Ts,{className:"mb-20",name:"ends_at",granularity:"day",label:e.jsx(n,{message:"Ends at"}),description:e.jsx(n,{message:"This will only change local records. User will continue to be billed on their original cycle on the payment gateway."})})]})]})}function Hd({subscription:s}){const{close:a,formId:t}=q(),i=O({defaultValues:{id:s.id,product_id:s.product_id,price_id:s.price_id,description:s.description,renews_at:s.renews_at,ends_at:s.ends_at,user_id:s.user_id}}),r=Vd(i);return e.jsxs(R,{size:"md",children:[e.jsx(U,{children:e.jsx(n,{message:"Update subscription"})}),e.jsx($,{children:e.jsx(Ia,{formId:t,form:i,onSubmit:l=>{r.mutate(l,{onSuccess:()=>{a()}})}})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>{a()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{form:t,disabled:r.isPending,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}const Pa="billing/subscriptions";function Wd(s){const{trans:a}=F();return A({mutationFn:t=>Kd(t),onSuccess:()=>{P(a(m("Subscription created"))),T.invalidateQueries({queryKey:W(Pa)})},onError:t=>ee(t,s)})}function Kd(s){return S.post(Pa,s).then(a=>a.data)}function Gd(){const{close:s,formId:a}=q(),t=O({}),i=Wd(t);return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Add new subscription"})}),e.jsx($,{children:e.jsx(Ia,{formId:a,form:t,onSubmit:r=>{i.mutate(r,{onSuccess:()=>{s()}})}})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>{s()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{form:a,disabled:i.isPending,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}const Qd=H(e.jsx("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}),"PauseOutlined"),Jd=H(e.jsx("path",{d:"M10 8.64 15.27 12 10 15.36V8.64M8 5v14l11-7L8 5z"}),"PlayArrowOutlined"),ks="billing/subscriptions",Yd=[{key:"user_id",allowsSorting:!0,width:"flex-3 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"Customer"}),body:s=>s.user&&e.jsx(fe,{image:s.user.avatar,label:s.user.display_name,description:s.user.email})},{key:"status",width:"w-100 flex-shrink-0",header:()=>e.jsx(n,{message:"Status"}),body:s=>e.jsx(Us,{size:"xs",color:s.valid?"positive":void 0,radius:"rounded",className:"w-max",children:s.gateway_status})},{key:"product_id",allowsSorting:!0,header:()=>e.jsx(n,{message:"Plan"}),body:s=>{var a;return(a=s.product)==null?void 0:a.name}},{key:"gateway_name",allowsSorting:!0,header:()=>e.jsx(n,{message:"Gateway"}),body:s=>e.jsx("span",{className:"capitalize",children:s.gateway_name})},{key:"renews_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Renews at"}),body:s=>
51e.jsx(X,{date:s.renews_at})},{key:"ends_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Ends at"}),body:s=>e.jsx(X,{date:s.ends_at})},{key:"created_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Created at"}),body:s=>e.jsx(X,{date:s.created_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",visibleInMode:"all",width:"w-[168px] flex-shrink-0",body:s=>e.jsx(eu,{subscription:s})}];function Zd(){return e.jsx(ue,{endpoint:ks,title:e.jsx(n,{message:"Subscriptions"}),columns:Yd,filters:qd,actions:e.jsx(Xd,{}),enableSelection:!1,selectedActions:e.jsx(Te,{}),queryParams:{with:"product"},emptyStateMessage:e.jsx(te,{image:Ud,title:e.jsx(n,{message:"No subscriptions have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching subscriptions"})})})}function Xd(){return e.jsx(e.Fragment,{children:e.jsxs(I,{type:"modal",children:[e.jsx(me,{children:e.jsx(n,{message:"Add new subscription"})}),e.jsx(Gd,{})]})})}function eu({subscription:s}){return e.jsxs(u.Fragment,{children:[e.jsxs(I,{type:"modal",children:[e.jsx(w,{size:"md",className:"text-muted",children:e.jsx(Ne,{})}),e.jsx(Hd,{subscription:s})]}),s.cancelled&&s.on_grace_period?e.jsx(tu,{subscription:s}):null,s.active?e.jsx(su,{subscription:s}):null,e.jsx(au,{subscription:s})]})}function su({subscription:s}){const a=aa(),t=()=>{a.mutate({subscriptionId:s.id},{onSuccess:()=>{T.invalidateQueries({queryKey:W(ks)})}})};return e.jsxs(I,{type:"modal",onClose:i=>{i&&t()},children:[e.jsx(L,{label:e.jsx(n,{message:"Cancel subscription"}),children:e.jsx(w,{size:"md",className:"text-muted",disabled:a.isPending,children:e.jsx(Qd,{})})}),e.jsx(pe,{title:e.jsx(n,{message:"Cancel subscription"}),body:e.jsxs("div",{children:[e.jsx(n,{message:"Are you sure you want to cancel this subscription?"}),e.jsx("div",{className:"mt-10 text-sm font-semibold",children:e.jsx(n,{message:"This will put user on grace period until their next scheduled renewal date. Subscription can be renewed until that date by user or from admin area."})})]}),confirm:e.jsx(n,{message:"Confirm"})})]})}function tu({subscription:s}){const a=Fi(),t=()=>{a.mutate({subscriptionId:s.id},{onSuccess:()=>{T.invalidateQueries({queryKey:W(ks)})}})};return e.jsxs(I,{type:"modal",onClose:i=>{i&&t()},children:[e.jsx(L,{label:e.jsx(n,{message:"Renew subscription"}),children:e.jsx(w,{size:"md",className:"text-muted",onClick:t,disabled:a.isPending,children:e.jsx(Jd,{})})}),e.jsx(pe,{title:e.jsx(n,{message:"Resume subscription"}),body:e.jsxs("div",{children:[e.jsx(n,{message:"Are you sure you want to resume this subscription?"}),e.jsx("div",{className:"mt-10 text-sm font-semibold",children:e.jsx(n,{message:"This will put user on their original plan and billing cycle."})})]}),confirm:e.jsx(n,{message:"Confirm"})})]})}function au({subscription:s}){const a=aa(),t=()=>{a.mutate({subscriptionId:s.id,delete:!0},{onSuccess:()=>{T.invalidateQueries({queryKey:W(ks)})}})};return e.jsxs(I,{type:"modal",onClose:i=>{i&&t()},children:[e.jsx(L,{label:e.jsx(n,{message:"Delete subscription"}),children:e.jsx(w,{size:"md",className:"text-muted",disabled:a.isPending,children:e.jsx(_e,{})})}),e.jsx(pe,{isDanger:!0,title:e.jsx(n,{message:"Delete subscription"}),body:e.jsxs("div",{children:[e.jsx(n,{message:"Are you sure you want to delete this subscription?"}),e.jsx("div",{className:"mt-10 text-sm font-semibold",children:e.jsx(n,{message:"This will permanently delete the subscription and immediately cancel it on billing gateway. Subscription will not be renewable anymore."})})]}),confirm:e.jsx(n,{message:"Confirm"})})]})}const nu=H(e.jsx("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"}),"SyncOutlined");function iu(){const{trans:s}=F();return A({mutationFn:()=>ru(),onSuccess:()=>{P(s(m("Plans synced")))},onError:a=>G(a,m("Could not sync plans"))})}function ru(){return S.post("billing/products/sync").then(s=>s.data)}const lu=s=>`billing/products/${s}`;function ou(){const{trans:s}=F();return A({mutationFn:a=>cu(a),onSuccess:()=>
51{P(s(m("Plan deleted"))),T.invalidateQueries({queryKey:W("billing/products")})},onError:a=>G(a)})}function cu({productId:s}){return S.delete(lu(s)).then(a=>a.data)}const du=[{key:"subscriptions",label:m("Subscriptions"),description:m("Whether plan has any active subscriptions"),defaultOperator:B.eq,control:{type:oe.Select,defaultValue:"01",options:[{key:"01",label:m("Has active subscriptions"),value:{value:"*",operator:B.has}},{key:"02",label:m("Does not have active subscriptions"),value:{value:"*",operator:B.doesntHave}}]}},Ie({description:m("Date plan was created")}),Ee({description:m("Date plan was last updated")})],uu=[{key:"name",allowsSorting:!0,visibleInMode:"all",header:()=>e.jsx(n,{message:"Name"}),body:s=>{const a=s.prices[0];return e.jsx(fe,{label:s.name,description:s.free?e.jsx(n,{message:"Free"}):e.jsx(Ys,{price:a})})}},{key:"created_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Created"}),body:s=>e.jsx(X,{date:s.created_at})},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(X,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),visibleInMode:"all",hideHeader:!0,align:"end",maxWidth:"max-w-132",body:s=>e.jsxs(u.Fragment,{children:[e.jsx(xu,{product:s}),e.jsx(w,{size:"md",className:"text-muted",elementType:D,to:`/admin/plans/${s.id}/edit`,children:e.jsx(Ne,{})}),e.jsx(gu,{product:s})]})}];function mu(){const s=ce();return e.jsx(ue,{endpoint:"billing/products",title:e.jsx(n,{message:"Subscription plans"}),columns:uu,actions:e.jsx(hu,{}),enableSelection:!1,filters:du,onRowAction:a=>{s(`/admin/plans/${a.id}/edit`)},emptyStateMessage:e.jsx(te,{image:Na,title:e.jsx(n,{message:"No plans have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching plans"})})})}function xu({product:s}){const a=s.prices.find(i=>i.default)||s.prices[0],t=a&&typeof window<"u"?`${window.location.origin}/checkout/${s.id}/${a.id}`:null;return e.jsx(L,{label:t?e.jsx(n,{message:"Copy checkout link"}):e.jsx(n,{message:"No checkout price configured"}),children:e.jsx(w,{size:"md",className:"text-muted",disabled:!t,onClick:async()=>{if(t)try{await navigator.clipboard.writeText(t),P.positive("Checkout link copied.")}catch{P.danger("Could not copy checkout link.")}},children:e.jsx(Kn,{})})})}function gu({product:s}){const a=ou();return e.jsxs(I,{type:"modal",onClose:t=>{t&&a.mutate({productId:s.id})},children:[e.jsx(L,{label:e.jsx(n,{message:"Delete plan"}),children:e.jsx(w,{size:"md",className:"text-muted",disabled:a.isPending,children:e.jsx(bs,{})})}),e.jsx(pe,{title:e.jsx(n,{message:"Delete plan"}),body:e.jsx(n,{message:"Are you sure you want to delete this plan?"}),confirm:e.jsx(n,{message:"Delete"})})]})}function hu(){const s=iu();return e.jsxs(u.Fragment,{children:[e.jsx(L,{label:e.jsx(n,{message:"Sync plans with Stripe & PayPal"}),children:e.jsx(w,{color:"primary",variant:"outline",size:"sm",disabled:s.isPending,onClick:()=>{s.mutate()},children:e.jsx(nu,{})})}),e.jsx(me,{elementType:D,to:"/admin/plans/new",children:e.jsx(n,{message:"Add new plan"})})]})}const Fa=s=>`billing/products/${s}`;function pu(){const{productId:s}=se();return be({queryKey:[Fa(s)],queryFn:()=>ju(s)})}function ju(s){return S.get(Fa(s)).then(a=>a.data)}const Ls=[{key:"day1",label:m("Daily"),interval:"day",interval_count:1},{key:"week1",label:m("Weekly"),interval:"week",interval_count:1},{key:"month1",label:m("Monthly"),interval:"month",interval_count:1},{key:"month3",label:m("Every 3 months"),interval:"month",interval_count:3},{key:"month6",label:m("Every 6 months"),interval:"month",interval_count:6},{key:"year1",label:m("Yearly"),interval:"year",interval_count:1},{key:"one_time1",label:m("One time"),interval:"one_time",interval_count:1,superAdminOnly:!0},{key:"custom",label:m("Custom"),interval:null,interval_count:null}];function fu({index:s,onRemovePrice:a}){const{trans:t}=F(),i=ve(["currencies"]),r=u.useMemo(()=>{var b;return(b=i.data)!=null&&b.currencies?Object.values(i.data.currencies):[]},[i.data]),{watch:l,getValues:o}=k(),c=!l("id"),d=l(`prices.${s}.id`)==null,x=l(`prices.${s}.subscriptions_count`)||0,[g,h]=u.useState(()=>{const b=o(`prices.${s}.interval`),N=o(`prices.${s}.interval_count`),y=Ls.find(z=>z.key===`${b}${N}`);return y?y.key:"custom"}),f=c||d||!x;return e.jsxs(u.Fragment,{children:[!f&&e.jsx("p",{className:"text-muted text-sm max-w-500 mb-20",children:e.jsx(n,{message:"This price can't modified or deleted, because it has [one 1 subscriber|other :count subscribers]. You can instead add a new price.",values:{count:x}})}),e.jsx(p,{required:!0,disabled:!f,label:e.jsx(n,{message:"Amount"}),type:"number",min:.1,step:.01,name:`prices.${s}.amount`,className:"mb-20"}),e.jsx(M,{required:!0,disabled:!f,label:e.jsx(n,{message:"Currency"}),name:`prices.${s}.currency`,items:r,showSearchField:!0,searchPlaceholder:t(m("Search currencies")),selectionMode:"single",className:"mb-20",children:b=>e.jsx(j,{value:b.code,children:`${b.code}: ${b.name}`},b.code)}),e.jsx(bu,{disabled:!f,index:s,value:g,onValueChange:h}),g==="custom"&&e.jsx(vu,{disabled:!f,index:s}),e.jsx(C,{name:`prices.${s}.default`,className:"mb-20",description:e.jsx(n,{message:"Use this price on pricing and upgrade pages for this billing period."}),children:e.jsx(n,{message:"Show on pricing page"})}),e.jsx("div",{className:"text-right",children:e.jsx(v,{size:"xs",variant:"outline",color:"danger",disabled:!f,onClick:()=>{a()},children:e.jsx(n,{message:"Delete price"})})})]})}function bu({index:s,value:a,onValueChange:t,disabled:i}){const{setValue:r}=k(),{getPermission:l}=Vs(),o=!!l("admin"),c=u.useMemo(()=>Ls.filter(d=>!d.superAdminOnly||o||d.key===a),[o,a]);return e.jsx(He,{label:e.jsx(n,{message:"Billing period"}),disabled:i,className:"mb-20",selectionMode:"single",selectedValue:a,onSelectionChange:d=>{if(t(d),d!=="custom"){const x=Ls.find(g=>g.key===d);x&&(r(`prices.${s}.interval`,x.interval),r(`prices.${s}.interval_count`,x.interval_count))}},children:c.map(d=>e.jsx(j,{value:d.key,children:e.jsx(n,{...d.label})},d.key))})}function vu({index:s,disabled:a}){const{watch:t}=k(),i=t(`prices.${s}.interval`);let r;return i==="day"?r=365:i==="week"?r=52:r=12,e.jsxs("div",{className:"flex border rounded w-min",children:[e.jsx("div",{className:"px-18 flex items-center text-sm",children:e.jsx(n,{message:"Every"})}),e.jsx(p,{inputShadow:"shadow-none",inputBorder:"border-none",className:"border-l border-r w-80",name:`prices.${s}.interval_count`,type:"number",min:1,max:r,disabled:a,required:!0}),e.jsxs(M,{inputShadow:"shadow-none",inputBorder:"border-none",name:`prices.${s}.interval`,selectionMode:"single",disabled:a,children:[e.jsx(j,{value:"day",children:e.jsx(n,{message:"Days"})}),e.jsx(j,{value:"week",children:e.jsx(n,{message:"Weeks"})}),e.jsx(j,{value:"month",children:e.jsx(n,{message:"Months"})})]})]})}function Aa(){const{watch:s}=k(),a=s("prices")||[],t=a.find(r=>r.default)||a[0],i=(t==null?void 0:t.interval)==="one_time"?"lifetime":"recurring";return e.jsxs(u.Fragment,{children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-20",required:!0,autoFocus:!0}),e.jsx(p,{name:"description",label:e.jsx(n,{message:"Description"}),className:"mb-20",inputElementType:"textarea",rows:4}),e.jsxs(M,{name:"position",selectionMode:"single",label:e.jsx(n,{message:"Position in pricing table"}),className:"mb-20",children:[e.jsx(j,{value:0,children:e.jsx(n,{message:"First"})}),e.jsx(j,{value:1,children:e.jsx(n,{message:"Second"})}),e.jsx(j,{value:2,children:e.jsx(n,{message:"Third"})}),e.jsx(j,{value:3,children:e.jsx(n,{message:"Fourth"})}),e.jsx(j,{value:4,children:e.jsx(n,{message:"Fifth"})})]}),e.jsx(es,{className:"mb-30",name:"available_space",label:e.jsx(n,{message:"Allowed storage space"}),description:e.jsx(n,{values:{a:r=>e.jsx(D,{className:js,target:"_blank",to:"/admin/settings/uploading",children:r})},message:"Total storage space all user uploads are allowed to take up."})}),e.jsx(C,{name:"recommended",className:"mb-20",description:e.jsx(n,{message:"Plan will be displayed more prominently on pricing page."}),children:e.jsx(n,{message:"Recommend"})}),e.jsx(C,{name:"hidden",className:"mb-20",description:e.jsx(n,{message:"Plan will not be shown on pricing or upgrade pages."}),children:e.jsx(n,{message:"Hidden"})}),e.jsx(C,{name:"free",className:"mb-20",description:e.jsx(n,{message:"Will be assigned to all users, if they are not subscribed already."}),children:e.jsx(n,{message:"Free"})}),e.jsx(Rs,{children:e.jsx(n,{message:"Feature list"})}),e.jsx(yu,{}),e.jsx(wu,{}),e.jsx(Rs,{children:e.jsx(n,{message:"Permissions"})}),e.jsx(ct,{name:"permissions",permissionBillingPeriod:i}
51)]})}function Rs({children:s}){return e.jsx("h2",{className:"mt-40 mb-20 text-base font-semibold",children:s})}function yu(){const{fields:s,append:a,remove:t}=ye({name:"feature_list"});return e.jsxs("div",{children:[s.map((i,r)=>e.jsxs("div",{className:"flex gap-10 mb-10",children:[e.jsx(p,{name:`feature_list.${r}.value`,size:"sm",className:"flex-auto"}),e.jsx(w,{size:"sm",color:"primary",className:"flex-shrink-0",onClick:()=>{t(r)},children:e.jsx(_e,{})})]},i.id)),e.jsx(v,{variant:"text",color:"primary",startIcon:e.jsx(ge,{}),size:"xs",onClick:()=>{a({value:""})},children:e.jsx(n,{message:"Add another line"})})]})}function wu(){var l;const{watch:s,formState:{errors:a}}=k(),{fields:t,append:i,remove:r}=ye({name:"prices",keyName:"key"});return s("free")?null:e.jsxs(u.Fragment,{children:[e.jsx(Rs,{children:e.jsx(n,{message:"Pricing"})}),((l=a.prices)==null?void 0:l.message)&&e.jsx("div",{className:"text-sm text-danger mb-20",children:a.prices.message}),e.jsx(Re,{variant:"outline",className:"mb-10",children:t.map((o,c)=>e.jsx(je,{label:e.jsx(Ys,{price:o}),children:e.jsx(fu,{index:c,onRemovePrice:()=>{r(c)}})},o.key))}),e.jsx(v,{variant:"text",color:"primary",startIcon:e.jsx(ge,{}),size:"xs",onClick:()=>{i({currency:"USD",amount:1,interval_count:1,interval:"month"})},children:e.jsx(n,{message:"Add another price"})})]})}const za=s=>`billing/products/${s}`;function Su(s){const{trans:a}=F(),t=ce();return A({mutationFn:i=>ku(i),onSuccess:i=>{P(a(m("Plan updated"))),T.invalidateQueries({queryKey:[za(i.product.id)]}),T.invalidateQueries({queryKey:W("billing/products")}),t("/admin/plans")},onError:i=>ee(i,s)})}function ku({id:s,...a}){const t={...a,feature_list:a.feature_list.map(i=>i.value)};return S.put(za(s),t).then(i=>i.data)}function Nu(){const s=pu();return s.status!=="success"?e.jsx(Fe,{}):e.jsx(Cu,{product:s.data.product})}function Cu({product:s}){const a=O({defaultValues:{...s,feature_list:s.feature_list.map(i=>({value:i}))}}),t=Su(a);return e.jsx(cs,{form:a,onSubmit:i=>{t.mutate(i)},title:e.jsx(n,{message:"Edit â:nameâ plan",values:{name:s.name}}),isLoading:t.isPending,children:e.jsx(Aa,{})})}const Ea="billing/products";function _u(s){const{trans:a}=F(),t=ce();return A({mutationFn:i=>Iu(i),onSuccess:()=>{P(a(m("Plan created"))),T.invalidateQueries({queryKey:[Ea]}),T.invalidateQueries({queryKey:W("billing/products")}),t("/admin/plans")},onError:i=>ee(i,s)})}function Iu(s){const a={...s,feature_list:s.feature_list.map(t=>t.value)};return S.post(Ea,a).then(t=>t.data)}function Pu(){const s=O({defaultValues:{free:!1,recommended:!1}}),a=_u(s);return e.jsx(cs,{form:s,onSubmit:t=>{a.mutate(t)},title:e.jsx(n,{message:"Create new plan"}),isLoading:a.isPending,children:e.jsx(Aa,{})})}function Fu(){return e.jsxs(ne,{title:e.jsx(n,{message:"GDPR"}),description:e.jsx(n,{message:"Configure settings related to EU General Data Protection Regulation."}),children:[e.jsx(Au,{}),e.jsx(de,{}),e.jsx(zu,{})]})}function Au(){const{watch:s}=k(),a=s("client.cookie_notice.enable");return e.jsxs("div",{children:[e.jsx(C,{name:"client.cookie_notice.enable",className:"mb-20",description:e.jsx(n,{message:"Whether cookie notice should be shown automatically to users from EU until it is accepted."}),children:e.jsx(n,{message:"Enable cookie notice"})}),a&&e.jsxs(u.Fragment,{children:[e.jsxs("div",{className:"mb-20 border-b pb-6",children:[e.jsx("div",{className:"mb-20 border-b pb-10 text-sm font-medium",children:e.jsx(n,{message:"Information button"})}),e.jsx(Ve,{hideRoleAndPermissionFields:!0,formPathPrefix:"client.cookie_notice.button"})]}),e.jsxs(M,{name:"client.cookie_notice.position",selectionMode:"single",label:e.jsx(n,{message:"Cookie notice position"}),className:"mb-20",children:[e.jsx(j,{value:"top",children:e.jsx(n,{message:"Top"})}),e.jsx(j,{value:"bottom",children:e.jsx(n,{message:"Bottom"})})]})]})]})}function zu(){const{fields:s,append:a,remove:t}=ye({name:"client.registration.policies"});return e.jsxs(u.Fragment,{children:[e.jsx("div",{className:"mb-6 text-sm",children:e.jsx(n,{message:"Registration policies"})}),e.jsx("div",{className:"text-xs text-muted",children:e.jsx(n,{message:"Create policies that will be shown on registration page. User will be required to accept them by toggling a checkbox."})}),e.jsx(Re,{className:"mt-16",variant:"outline",children:s.map((i,r)=>e.jsx(je,{label:i.label,chevronPosition:"left",endAppend:e.jsx(w,{variant:"text",color:"danger",size:"sm",onClick:()=>{t(r)},children:e.jsx(_e,{})}),children:e.jsx(Ve,{hideRoleAndPermissionFields:!0,formPathPrefix:`client.register_policies.${r}`})},i.id))}),e.jsxs(I,{type:"modal",onClose:i=>{i&&a(i)},children:[e.jsx(v,{className:"mt-12",variant:"link",color:"primary",startIcon:e.jsx(ge,{}),size:"xs",children:e.jsx(n,{message:"Add another policy"})}),e.jsx(da,{title:e.jsx(n,{message:"Add policy"})})]})]})}function Eu(s,a){const{trans:t}=F(),i=rs();return A({mutationFn:r=>Tu(s,r),onSuccess:async()=>{await i.invalidateQueries({queryKey:["projects"]}),P(t(m("Project updated")))},onError:r=>ee(r,a)})}async function Tu(s,a){return S.put(`projects/${s}`,a).then(t=>t.data)}function Ta(){const{items:s}=Gn({});return e.jsxs(u.Fragment,{children:[e.jsx(p,{autoFocus:!0,name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-14",required:!0}),e.jsx(Zt,{name:"userId",className:"mb-14",endpoint:"normalized-models/user",label:e.jsx(n,{message:"User"}),required:!0}),e.jsxs(M,{name:"templateName",selectionMode:"single",label:e.jsx(n,{message:"Template"}),className:"mb-14",children:[e.jsx(j,{value:null,children:e.jsx(n,{message:"No template"})}),s.map(a=>
51e.jsx(j,{value:a.name,capitalizeFirst:!0,children:a.name},a.name))]}),e.jsx(C,{name:"published",children:e.jsx(n,{message:"Published"})})]})}function Du({project:s}){const{formId:a,close:t}=q(),i=O({defaultValues:{name:s.name,userId:s.user_id,published:s.published,templateName:s.template}}),r=Eu(s.id,i);return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Update project"})}),e.jsx($,{children:e.jsx(J,{id:a,form:i,onSubmit:l=>{r.mutate(l,{onSuccess:()=>t()})},children:e.jsx(Ta,{})})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>t(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{form:a,type:"submit",variant:"flat",color:"primary",disabled:r.isPending,children:e.jsx(n,{message:"Update"})})]})]})}const Mu=[{key:"name",allowsSorting:!0,width:"flex-2 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"Name"}),body:s=>e.jsx(fe,{image:Qn(s),label:e.jsx("a",{href:Jn(s),target:"_blank",rel:"noopener noreferrer",className:"hover:underline",children:s.name})})},{key:"user_id",allowsSorting:!0,width:"flex-2 min-w-140",header:()=>e.jsx(n,{message:"Owner"}),body:s=>s.user&&e.jsx(fe,{image:s.user.avatar,label:e.jsx(D,{className:"hover:underline",target:"_blank",to:`/admin/users/${s.user.id}/edit`,children:s.user.display_name}),description:s.user.email})},{key:"published",allowsSorting:!0,header:()=>e.jsx(n,{message:"Published"}),body:s=>s.published?e.jsx(ms,{className:"text-positive icon-md"}):e.jsx(_e,{className:"text-danger icon-md"})},{key:"template",allowsSorting:!0,header:()=>e.jsx(n,{message:"Template"}),body:s=>s.template},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(X,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-84 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs(u.Fragment,{children:[e.jsx(L,{label:e.jsx(n,{message:"Edit project"}),children:e.jsx(w,{className:"text-muted",elementType:D,to:`/editor/${s.id}`,children:e.jsx(Ne,{})})}),e.jsxs(I,{type:"modal",children:[e.jsx(L,{label:e.jsx(n,{message:"Project settings"}),children:e.jsx(w,{className:"text-muted",children:e.jsx(Sn,{})})}),e.jsx(Du,{project:s})]})]})}];function Ou(){const{formId:s,close:a}=q(),{user:t}=Vs(),i=O({defaultValues:{userId:t==null?void 0:t.id,published:!0}}),r=ti(i);return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"New project"})}),e.jsx($,{children:e.jsx(J,{id:s,form:i,onSubmit:l=>{r.mutate(l,{onSuccess:()=>a()})},children:e.jsx(Ta,{})})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{form:s,type:"submit",variant:"flat",color:"primary",disabled:r.isPending,children:e.jsx(n,{message:"Create"})})]})]})}const Lu=[{key:"published",label:m("Published"),description:m("Whether project is published"),defaultOperator:B.eq,control:{type:oe.Select,defaultValue:"01",options:[{key:"01",label:m("Published"),value:!0},{key:"02",label:m("Unpublished"),value:!1}]}},{key:"user_id",label:m("User"),description:m("User project was created by"),defaultOperator:B.eq,control:{type:oe.SelectModel,model:nt}},Ie({description:m("Date project was created")}),Ee({description:m("Date project was last updated")})];function Ru(){return e.jsx(ue,{endpoint:"projects",title:e.jsx(n,{message:"Projects"}),filters:Lu,columns:Mu,actions:e.jsx($u,{}),selectedActions:e.jsx(Te,{}),emptyStateMessage:e.jsx(te,{image:it,title:e.jsx(n,{message:"No projects have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching projects"})})})}function $u(){return e.jsxs(I,{type:"modal",children:[e.jsx(me,{children:e.jsx(n,{message:"New project"})}),e.jsx(Ou,{})]})}const Da="ALL CATEGORIES",qu=new Set(["all categories","all category","all-categories","all"]);function Ma(s){if(typeof s!="string")return!1;const a=s.trim().toLowerCase();return qu.has(a)}function Oa(s){const a=Array.isArray(s)?s:`${s??""}`.split(","),t=Array.from(new Set(a.map(i=>`${i}`.trim()).filter(Boolean)));return t.length?t.some(Ma)?Da:t.join(", "):""}function Uu(s){const{trans:a}=F(),t=rs();return A({mutationFn:i=>Vu(i),onSuccess:async()=>{await t.invalidateQueries({queryKey:["templates"]}),P(a(m("Template created")))},onError:i=>ee(i,s)})}async function Vu(s){return S.post("templates",La(s),{headers:{"Content-Type":"multipart/form-data"}}).then(a=>a.data)}function La(s){const a=new FormData;s.name&&a.set("name",s.name);const t=Bu(s.category);return t&&a.set("category",t),s.template&&a.set("template",s.template),s.thumbnail&&a.set("thumbnail",s.thumbnail),"isOptin"in s&&a.set("isOptin",s.isOptin?"true":"false"),"includeBootstrap"in s&&a.set("includeBootstrap",s.includeBootstrap?"true":"false"),a}function Bu(s){return Oa(s)}function Hu(s,a){const{trans:t}=F(),i=rs();return A({mutationFn:r=>Wu(s,r),onSuccess:async()=>{await i.invalidateQueries({queryKey:["templates"]}),P(t(m("Template updated")))},onError:r=>ee(r,a)})}async function Wu(s,a){return S.put(`templates/${s}`,La(a),{headers:{"Content-Type":"multipart/form-data"}}).then(t=>t.data)}function Ra({requireFiles:s=!0}){const{builder:a}=ae(),t=k(),i=u.useMemo(()=>ai(a==null?void 0:a.template_categories),[a==null?void 0:a.template_categories]),r=u.useMemo(()=>[Da,...i.filter(o=>!Ma(o))].map(o=>({id:o,name:o})),[i]);return e.jsxs(u.Fragment,{children:[e.jsx(p,{autoFocus:!0,name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-20",required:!0}),e.jsx(ls,{name:"category",label:e.jsx(n,{message:"Category"}),className:"mb-20",suggestions:r,valueKey:"name",allowCustomValue:!0,showDropdownArrow:!0,children:l=>e.jsx(j,{value:l.id,children:l.name},l.id)}),e.jsx(Os,{required:s,onChange:()=>t.clearErrors(),name:"template",label:e.jsx(n,{message:"Template zip file"}),accept:".zip",className:"mb-20",description:e.jsxs("p",{children:[e.jsx(n,{message:"Zip of template files. Must contain index.html file which will be used as default page."}),e.jsx("br",{}),e.jsx("br",{}),e.jsx(n,{message:"(Optional) CSS and JS that should appear in builder code editors should be in 'css/code_editor_styles.css' and 'js/code_editor_scripts.js' files."})]})}),e.jsx(Os,{required:s,onChange:()=>
51t.clearErrors(),name:"thumbnail",label:e.jsx(n,{message:"Thumbnail"}),className:"mb-20",accept:"image/*"}),e.jsx(C,{name:"isOptin",className:"mb-20",children:e.jsx(n,{message:"Show in optin templates"})}),e.jsx(C,{name:"includeBootstrap",description:e.jsx(n,{message:"Deselect if template already includes bootstrap files, otherwise styles will be duplicated which might cause issues."}),children:e.jsx(n,{message:"Include bootstrap"})})]})}function Ku({template:s}){var o,c;const{formId:a,close:t}=q(),i=Oa(`${s.config.category||""}`),r=O({defaultValues:{name:((o=s.config)==null?void 0:o.name)||s.name,category:i.split(",").map(d=>d.trim()).filter(Boolean),isOptin:!!((c=s.config)!=null&&c.isOptin),includeBootstrap:s.config.includeBootstrap}}),l=Hu(s.name,r);return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Update template"})}),e.jsx($,{children:e.jsx(J,{id:a,form:r,onSubmit:d=>{l.mutate(d,{onSuccess:()=>t()})},children:e.jsx(Ra,{requireFiles:!1})})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>t(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{form:a,type:"submit",variant:"flat",color:"primary",disabled:l.isPending,children:e.jsx(n,{message:"Update"})})]})]})}const Gu=[{key:"name",allowsSorting:!0,width:"flex-2 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"Name"}),body:s=>{var a;return e.jsx(fe,{image:s.thumbnail,label:((a=s.config)==null?void 0:a.name)||s.name})}},{key:"category",allowsSorting:!0,header:()=>e.jsx(n,{message:"Category"}),body:s=>s.config.category},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(X,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs(I,{type:"modal",children:[e.jsx(L,{label:e.jsx(n,{message:"Edit template"}),children:e.jsx(w,{className:"text-muted",children:e.jsx(Ne,{})})}),e.jsx(Ku,{template:s})]})}];function Qu(){const{formId:s,close:a}=q(),t=O({defaultValues:{category:["Landing Page"],isOptin:!1}}),i=Uu(t);return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"New template"})}),e.jsx($,{children:e.jsx(J,{id:s,form:t,onSubmit:r=>{i.mutate(r,{onSuccess:()=>a()})},children:e.jsx(Ra,{})})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{form:s,type:"submit",variant:"flat",color:"primary",disabled:i.isPending,children:e.jsx(n,{message:"Create"})})]})]})}function Ju(){return e.jsx(ue,{endpoint:"templates",title:e.jsx(n,{message:"Templates"}),columns:Gu,actions:e.jsx(Yu,{}),selectedActions:e.jsx(Te,{}),emptyStateMessage:e.jsx(te,{image:it,title:e.jsx(n,{message:"No templates have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching templates"})})})}function Yu(){return e.jsxs(I,{type:"modal",children:[e.jsx(me,{children:e.jsx(n,{message:"New template"})}),e.jsx(Qu,{})]})}function Zu(s){return e.jsx(te,{...s,image:ni,title:e.jsx(n,{message:"No domains have been connected yet"}),filteringTitle:e.jsx(n,{message:"No matching domains"})})}function Xu({url:s,className:a,size:t="w-16 h-16",alt:i}){if(!s)return null;const r=At(s);return e.jsx("img",{className:_(t,a),src:At(s),alt:i||`${r} favicon`})}const At=Gt(s=>s.includes("youtube")?"https://www.youtube.com/s/desktop/ca54e1bd/img/favicon.ico":(kn(s)||(s=`${window.location.protocol}//${window.location.host}`),"https://www.google.com/s2/favicons?domain="+new URL(s).origin));function $a({value:s}){return s?e.jsx(ms,{className:"icon-md text-positive"}):e.jsx(_e,{className:"icon-md text-danger"})}function em({domain:s}){const a=ii();return e.jsxs(I,{type:"modal",onClose:t=>{t&&a.mutate({domain:s})},children:[e.jsx(v,{variant:"outline",color:"danger",size:"xs",disabled:a.isPending,children:e.jsx(n,{message:"Remove"})}),e.jsx(pe,{title:e.jsx(n,{message:"Remove domain?"}),body:e.jsx(n,{message:"Are you sure you want to remove â:domainâ?",values:{domain:s.host}}),confirm:e.jsx(n,{message:"Remove"}),isDanger:!0})]})}const sm=[{key:"host",allowsSorting:!0,header:()=>e.jsx(n,{message:"Domain"}),width:"flex-3 min-w-200",visibleInMode:"all",body:s=>e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-6 whitespace-nowrap",children:[e.jsx(Xu,{url:s.host}),e.jsx("a",{className:"block font-semibold hover:underline overflow-ellipsis overflow-hidden w-min",href:s.host,target:"_blank",rel:"noreferrer","data-testid":"host-name",children:s.host})]})})},{key:"user_id",allowsSorting:!0,header:()=>e.jsx(n,{message:"Owner"}),width:"flex-2 min-w-140",body:s=>s.user?e.jsx(fe,{image:s.user.avatar,label:s.user.display_name,description:s.user.email}):""},{key:"global",allowsSorting:!0,header:()=>e.jsx(n,{message:"Global"}),body:s=>
51e.jsx($a,{value:s.global})},{key:"updated_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(X,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,width:"w-80 flex-shrink-0",visibleInMode:"all",align:"end",body:s=>e.jsx(em,{domain:s})}],tm=[{key:"global",label:m("Global"),description:m("Whether domain is marked as global"),defaultOperator:B.eq,control:{type:oe.BooleanToggle,defaultValue:!0}},Ie({description:m("Date domain was created")}),Ee({description:m("Date domain was last updated")}),{key:"user_id",label:m("Owner"),description:m("User domain belongs to"),defaultOperator:B.eq,control:{type:oe.SelectModel,model:nt}}];function am(){return e.jsx(ue,{enableSelection:!1,endpoint:"custom-domain",queryParams:{with:"user"},title:e.jsx(n,{message:"Custom domains"}),filters:tm,columns:sm,actions:e.jsx(nm,{}),emptyStateMessage:e.jsx(Zu,{})})}function nm(){return e.jsxs(I,{type:"modal",children:[e.jsx(me,{children:e.jsx(n,{message:"Connect domain"})}),e.jsx(Yn,{showGlobalField:!0})]})}const im=[{path:"projects",element:e.jsx(Ru,{})},{path:"templates",element:e.jsx(Ju,{})},{path:"custom-domains",element:e.jsx(am,{})}];function rm(s){const{pageId:a}=se(),t=`${s||"custom-pages"}/${a}`;return A({mutationFn:i=>lm(i,t),onError:i=>G(i),onSuccess:async()=>{await T.invalidateQueries({queryKey:["custom-pages"]}),await T.invalidateQueries({queryKey:W(t)}),P(m("Page updated"))}})}function lm(s,a){return S.put(`${a}`,s).then(t=>t.data)}function qa(){const[s,a]=u.useState(!1),{trans:t}=F(),r=k().watch("title"),l=t({message:"Title"});return s?e.jsx(p,{placeholder:l,autoFocus:!0,className:"mb-30",onBlur:()=>{a(!1)},name:"title",required:!0}):e.jsxs("h1",{tabIndex:0,onClick:()=>{a(!0)},onFocus:()=>{a(!0)},className:_("hover:bg-primary/focus rounded cursor-pointer",!r&&"text-muted"),children:[r||l,e.jsx(Ne,{className:"icon-sm mx-8 mt-8 align-top text-muted"})]})}function om({host:s,value:a="",placeholder:t,onChange:i,className:r,inputRef:l,onInputBlur:o,showLinkIcon:c=!0,pattern:d,minLength:x,maxLength:g,hideButton:h,...f}){const{base_url:b}=ae(),N=f.prefix?`/${f.prefix}`:"",y=f.suffix?`/${f.suffix}`:"",[z,V]=u.useState(!1),[Y,we]=u.useState(a);s=s||b,u.useEffect(()=>{we(a)},[a]);const Z=()=>{z?(V(!1),Y&&(i==null||i(Y))):V(!0)};let Se="";return Y?Se=Y:t&&(Se=ht(t)),e.jsxs("div",{className:_("flex items-center",r),children:[c&&e.jsx(st,{className:"icon-md text-muted"}),e.jsxs("div",{className:"text-primary ml-6 mr-14",children:[s,N,!z&&Se&&e.jsxs(u.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("span",{className:"font-medium",children:Se})]}),z?null:y]}),z&&e.jsx(xe,{pattern:d,minLength:x,maxLength:g,onKeyDown:Je=>{Je.key==="Enter"&&Z()},ref:l,"aria-label":"slug",autoFocus:!0,className:"mr-14",size:"2xs",value:Y,onBlur:o,onChange:Je=>{we(Je.target.value)}}),!h&&e.jsx(v,{type:"button",color:"chip",variant:"outline",size:"2xs",onClick:()=>{Z()},children:z?e.jsx(n,{message:"Save"}):e.jsx(n,{message:"Edit"})})]})}const cm=H(e.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"}),"ArrowBackOutlined");function dm({editor:s}){return e.jsxs("span",{children:[e.jsx(w,{size:"md",disabled:!s.can().undo(),onClick:()=>{s.commands.focus(),s.commands.undo()},children:e.jsx(hi,{})}),e.jsx(w,{size:"md",disabled:!s.can().redo(),onClick:()=>{s.commands.focus(),s.commands.redo()},children:e.jsx(pi,{})})]})}function um({editor:s}){return e.jsxs(I,{type:"modal",onClose:a=>{a!=null&&(s==null||s.commands.setContent(a))},children:[e.jsx(v,{variant:"text",startIcon:e.jsx(ta,{}),children:e.jsx(n,{message:"Source"})}),e.jsx(mt,{title:e.jsx(n,{message:"Source code"}),defaultValue:s.getHTML()})]})}function Be(){return e.jsx("div",{className:"self-stretch mx-4 w-1 bg-divider flex-shrink-0"})}function mm({editor:s,size:a}){return e.jsxs("span",{className:_("flex-shrink-0 whitespace-nowrap"),children:[e.jsx(L,{label:e.jsx(n,{message:"Bold"}),children:e.jsx(w,{size:a,color:s.isActive("bold")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleBold()},children:e.jsx(ji,{})})}),e.jsx(L,{label:e.jsx(n,{message:"Italic"}
51),children:e.jsx(w,{size:a,color:s.isActive("italic")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleItalic()},children:e.jsx(fi,{})})}),e.jsx(L,{label:e.jsx(n,{message:"Underline"}),children:e.jsx(w,{size:a,color:s.isActive("underline")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleUnderline()},children:e.jsx(bi,{})})})]})}const xm=H(e.jsx("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"}),"FormatListNumberedOutlined");function gm({editor:s,size:a}){const t=s.isActive("bulletList"),i=s.isActive("orderedList");return e.jsxs("span",{className:_("flex-shrink-0","whitespace-nowrap"),children:[e.jsx(L,{label:e.jsx(n,{message:"Bulleted list"}),children:e.jsx(w,{size:a,color:t?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleBulletList()},children:e.jsx(vi,{})})}),e.jsx(L,{label:e.jsx(n,{message:"Numbered list"}),children:e.jsx(w,{size:a,color:i?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleOrderedList()},children:e.jsx(xm,{})})})]})}function hm(s,{text:a,target:t,href:i}){s.state.selection.empty&&a?s.commands.insertContent(`<a href="${i}" target="${t}">${a}</a>`):s.state.selection.empty||(i?s.chain().focus().extendMarkRange("link").setLink({href:i,target:t}).run():s.chain().focus().extendMarkRange("link").unsetLink().run())}function pm({editor:s,size:a}){return e.jsxs(I,{type:"modal",children:[e.jsx(L,{label:e.jsx(n,{message:"Insert link"}),children:e.jsx(w,{size:a,className:_("flex-shrink-0"),children:e.jsx(st,{})})}),e.jsx(jm,{editor:s})]})}function jm({editor:s}){const a=s.getAttributes("link").href,t=s.state.doc.textBetween(s.state.selection.from,s.state.selection.to,""),i=O({defaultValues:{href:a,text:t,target:"_blank"}}),{formId:r,close:l}=q();return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Insert link"})}),e.jsx($,{children:e.jsxs(J,{form:i,id:r,onSubmit:o=>{hm(s,o),l()},children:[e.jsx(p,{name:"href",label:e.jsx(n,{message:"URL"}
51),autoFocus:!0,type:"url",className:"mb-20"}),e.jsx(p,{name:"text",label:e.jsx(n,{message:"Text to display"}),className:"mb-20"}),e.jsxs(M,{selectionMode:"single",name:"target",label:e.jsx(n,{message:"Open link in..."}),children:[e.jsx(j,{value:"_self",children:e.jsx(n,{message:"Current window"})}),e.jsx(j,{value:"_blank",children:e.jsx(n,{message:"New window"})})]})]})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:l,variant:"text",children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{type:"submit",form:r,variant:"flat",color:"primary",children:e.jsx(n,{message:"Save"})})]})]})}const fm=2097152;function bm({editor:s,size:a,diskPrefix:t="page_media"}){const{selectAndUploadFile:i}=As(),r=()=>{i({showToastOnRestrictionFail:!0,restrictions:{allowedFileTypes:[Js.image],maxFileSize:fm},metadata:{diskPrefix:t,disk:zs.public},onSuccess:l=>{s.commands.focus(),s.commands.setImage({src:l.url})}})};return e.jsx(L,{label:e.jsx(n,{message:"Insert image"}),children:e.jsx(w,{size:a,onClick:r,className:_("flex-shrink-0"),children:e.jsx(yi,{})})})}const vm=H(e.jsx("path",{d:"M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z"}),"FormatClearOutlined");function ym({editor:s,size:a}){return e.jsx(L,{label:e.jsx(n,{message:"Clear formatting"}),children:e.jsx(w,{className:_("flex-shrink-0"),size:a,onClick:()=>{s.chain().focus().clearNodes().unsetAllMarks().run()},children:e.jsx(vm,{})})})}const wm=H(e.jsx("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),Sm=H([e.jsx("circle",{cx:"12",cy:"19",r:"2"},"0"),e.jsx("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHighOutlined"),km=H(e.jsx("path",{d:"M16 4H4c-1.1 0-2 .9-2 2v12.01c0 1.1.9 1.99 2 1.99h16c1.1 0 2-.9 2-2v-8l-6-6zM4 18.01V6h11v5h5v7.01H4z"}),"NoteOutlined"),Nm=H([e.jsx("path",{d:"M9.5 7.5v9l7-4.5z"},"0"),e.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14.01H4V5.99h16v12.02z"},"1")],"SmartDisplayOutlined");function Cm({editor:s,size:a}){const[t,i]=u.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(Ae,{onItemSelected:r=>{r==="hr"?(s.commands.focus(),s.commands.setHorizontalRule()):r==="embed"?i("embed"):(s.commands.focus(),s.commands.addInfo({type:r}))},children:[e.jsx(w,{variant:"text",size:a,className:_("flex-shrink-0"),children:e.jsx(Ss,{})}),e.jsxs(ze,{children:[e.jsx(j,{value:"hr",startIcon:e.jsx(wm,{}),children:e.jsx(n,{message:"Horizontal rule"})}),e.jsx(j,{value:"embed",startIcon:e.jsx(Nm,{}),children:e.jsx(n,{message:"Embed"})}),e.jsx(j,{value:"important",startIcon:e.jsx(Sm,{}),children:e.jsx(n,{message:"Important"})}),e.jsx(j,{value:"warning",startIcon:e.jsx(Nn,{}),children:e.jsx(n,{message:"Warning"})}),e.jsx(j,{value:"success",startIcon:e.jsx(km,{}),children:e.jsx(n,{message:"Note"})})]})]}),e.jsx(I,{type:"modal",isOpen:!!t,onClose:()=>{i(!1)},children:e.jsx(_m,{editor:s})})]})}function _m({editor:s}){const a=s.getAttributes("embed").src,t=O({defaultValues:{src:a}}),{formId:i,close:r}=q();return e.jsxs(R,{children:[e.jsx(U,{children:e.jsx(n,{message:"Insert link"})}),e.jsx($,{children:e.jsx(J,{form:t,id:i,onSubmit:l=>{s.commands.setEmbed(l),r()},children:e.jsx(p,{name:"src",label:e.jsx(n,{message:"Embed URL"}
51),autoFocus:!0,type:"url",required:!0})})}),e.jsxs(Q,{children:[e.jsx(v,{onClick:r,variant:"text",children:e.jsx(n,{message:"Cancel"})}),e.jsx(v,{type:"submit",form:i,disabled:!t.formState.isValid,variant:"flat",color:"primary",children:e.jsx(n,{message:"Add"})})]})]})}function ke({children:s,modifier:a,separator:t="+"}){const i=Cn()?e.jsx("span",{className:"text-base align-middle",children:"â"}):"Ctrl";return e.jsxs("kbd",{className:"text-xs text-muted",children:[a&&e.jsxs(e.Fragment,{children:[i,t]}),s]})}function Im({editor:s,size:a}){return e.jsxs(Ae,{floatingMinWidth:"w-256",onItemSelected:t=>{s.commands.focus(),typeof t=="string"&&t.startsWith("h")?s.commands.toggleHeading({level:parseInt(t.replace("h",""))}):t==="code"?s.commands.toggleCode():t==="strike"?s.commands.toggleStrike():t==="super"?s.commands.toggleSuperscript():t==="sub"?s.commands.toggleSubscript():t==="blockquote"?s.commands.toggleBlockquote():t==="paragraph"&&s.commands.setParagraph()},children:[e.jsx(v,{className:_("flex-shrink-0"),variant:"text",size:a,endIcon:e.jsx(_n,{}),children:e.jsx(n,{message:"Format"})}),e.jsxs(ze,{children:[e.jsx(j,{value:"h1",endSection:e.jsx(ke,{modifier:!0,children:"Alt+1"}),children:e.jsx(n,{message:"Heading :number",values:{number:1}})}),e.jsx(j,{value:"h2",endSection:e.jsx(ke,{modifier:!0,children:"Alt+2"}),children:e.jsx(n,{message:"Heading :number",values:{number:2}})}),e.jsx(j,{value:"h3",endSection:e.jsx(ke,{modifier:!0,children:"Alt+3"}),children:e.jsx(n,{message:"Heading :number",values:{number:3}})}),e.jsx(j,{value:"h4",endSection:e.jsx(ke,{modifier:!0,children:"Alt+4"}),children:e.jsx(n,{message:"Heading :number",values:{number:4}})}),e.jsx(j,{value:"code",endSection:e.jsx(ke,{modifier:!0,children:"E"}),children:e.jsx(n,{message:"Code"})}),e.jsx(j,{value:"strike",endSection:e.jsx(ke,{modifier:!0,children:"Shift+X"}),children:e.jsx(n,{message:"Strikethrough"})}),e.jsx(j,{value:"super",endSection:e.jsx(ke,{modifier:!0,separator:" ",children:"."}),children:e.jsx(n,{message:"Superscript"})}),e.jsx(j,{value:"sub",endSection:e.jsx(ke,{modifier:!0,separator:" ",children:","}),children:e.jsx(n,{message:"Subscript"})}),e.jsx(j,{value:"blockquote",endSection:e.jsx(ke,{modifier:!0,children:"Shift+B"}),children:e.jsx(n,{message:"Blockquote"})}),e.jsx(j,{value:"paragraph",endSection:e.jsx(ke,{modifier:!0,children:"Alt+0"}),children:e.jsx(n,{message:"Paragraph"})})]})]})}const Pm=H(e.jsx("path",{d:"M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z"}),"FormatColorTextOutlined");function Fm({editor:s,size:a}){const[t,i]=u.useState(!1),r=s.getAttributes("textStyle").color,l=s.getAttributes("textStyle").backgroundColor;return e.jsxs(u.Fragment,{children:[e.jsxs("span",{className:_("flex-shrink-0 whitespace-nowrap"),children:[e.jsx(w,{size:a,color:r?"primary":null,onClick:()=>{i("text")},children:e.jsx(Pm,{})}),e.jsx(w,{size:a,color:l?"primary":null,onClick:()=>{i("bg")},children:e.jsx(wi,{})})]}),e.jsx(I,{defaultValue:t==="text"?"#000000":"#FFFFFF",type:"modal",isOpen:!!t,onClose:o=>{o&&(t==="text"?s.commands.setColor(o):s.commands.setBackgroundColor(o)),i(!1)},children:e.jsx(rt,{})})]})}const ds={left:{icon:Si,label:m("Align left")},center:{icon:ki,label:m("Align center")},right:{icon:Ni,label:m("Align right")},justify:{icon:Ci,label:m("Justify")}};function Am({editor:s,size:a}){const t=Object.keys(ds).find(r=>s.isActive({textAlign:r}))||"left",i=t?ds[t].icon:ds.left.icon;return e.jsxs(Ae,{floatingWidth:"auto",selectionMode:"single",selectedValue:t,onSelectionChange:r=>{s.commands.focus(),s.commands.setTextAlign(r)},children:[e.jsx(w,{size:a,color:t?"primary":null,className:_("flex-shrink-0"),children:e.jsx(i,{})}),e.jsx(ze,{children:Object.entries(ds).map(([r,l])=>{const o=l.icon;return e.jsx(j,{value:r,startIcon:e.jsx(o,{size:"md"}),capitalizeFirst:!0,children:e.jsx(n,{message:l.label.message})},r)})})]})}const zm=H(e.jsx("path",{d:"M11 17h10v-2H11v2zm-8-5 4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}),"FormatIndentDecreaseOutlined"),Em=H(e.jsx("path",{d:"M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}),"FormatIndentIncreaseOutlined");function Tm({editor:s,size:a}){return e.jsxs("span",{className:_("flex-shrink-0","whitespace-nowrap"),children:[e.jsx(L,{label:e.jsx(n,{message:"Decrease indent"}),children:e.jsx(w,{size:a,onClick:()=>{s.commands.focus(),s.commands.outdent()},children:e.jsx(zm,{})})}),e.jsx(L,{label:e.jsx(n,{message:"Increase indent"}),children:e.jsx(w,{size:a,onClick:()=>{s.commands.focus(),s.commands.indent()},children:e.jsx(Em,{})})})]})}function Dm({editor:s,size:a}){const t=s.getAttributes("codeBlock").language||"";return e.jsxs(Ae,{selectionMode:"single",selectedValue:t,onSelectionChange:i=>{s.commands.toggleCodeBlock({language:i})},children:[e.jsx(L,{label:e.jsx(n,{message:"Codeblock"}
51),children:e.jsx(w,{className:_("flex-shrink-0"),size:a,color:t?"primary":null,children:e.jsx(ta,{})})}),e.jsxs(ze,{children:[e.jsx(j,{value:"html",children:"HTML"}),e.jsx(j,{value:"javascript",children:"JavaScript"}),e.jsx(j,{value:"css",children:"CSS"}),e.jsx(j,{value:"php",children:"PHP"}),e.jsx(j,{value:"shell",children:"Shell"}),e.jsx(j,{value:"bash",children:"Bash"}),e.jsx(j,{value:"ruby",children:"Ruby"}),e.jsx(j,{value:"python",children:"Python"}),e.jsx(j,{value:"java",children:"Java"}),e.jsx(j,{value:"c++",children:"C++"})]})]})}const zt="flex items-center px-4 h-42 text-muted border-b overflow-hidden";function Mm({editor:s,size:a="md",justify:t="justify-center",hideInsertButton:i=!1,imageDiskPrefix:r}){const l=Ke(),[o,c]=u.useState(!1);return e.jsxs("div",{className:_(o?"h-84":"h-42"),children:[e.jsxs("div",{className:_(zt,t,"relative z-20"),children:[e.jsx(Im,{editor:s,size:a}),e.jsx(Be,{}),e.jsx(mm,{editor:s,size:a}),e.jsx(Be,{}),e.jsx(Am,{editor:s,size:a}),e.jsx(Tm,{editor:s,size:a}),e.jsx(Be,{}),l?e.jsx(w,{className:"flex-shrink-0",color:o?"primary":null,size:a,onClick:()=>{c(!o)},children:o?e.jsx(In,{}):e.jsx(Pn,{})}):e.jsx(Et,{editor:s,size:a,hideInsertButton:i,imageDiskPrefix:r})]}),e.jsx(qs,{children:o&&e.jsx(us.div,{className:_(zt,t,"absolute flex h-full w-full"),initial:{y:"-100%"},animate:{y:0},exit:{y:"-100%"},children:e.jsx(Et,{editor:s,size:a,imageDiskPrefix:r})})})]})}function Et({editor:s,size:a="md",hideInsertButton:t,imageDiskPrefix:i}){return e.jsxs(u.Fragment,{children:[e.jsx(gm,{editor:s,size:a}),e.jsx(Be,{}),e.jsx(pm,{editor:s,size:a}),e.jsx(bm,{editor:s,size:a,diskPrefix:i}),!t&&e.jsx(Cm,{editor:s,size:a}),e.jsx(Be,{}),e.jsx(Fm,{editor:s,size:a}),e.jsx(Be,{}),e.jsx(Dm,{editor:s,size:a}),e.jsx(ym,{editor:s,size:a})]})}function Ua({editor:s,allowSlugEditing:a=!0,onSave:t,saveButton:i,isLoading:r=!1,backLink:l,slugPrefix:o="pages",imageDiskPrefix:c}){const{isSticky:d,sentinelRef:x}=pa(),g=Ke();return e.jsxs(u.Fragment,{children:[e.jsx("div",{ref:x}),e.jsxs("div",{className:_("sticky top-0 z-10 mb-20 bg",d&&"shadow"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-20 border-b px-20 py-10 text-muted sm:justify-start",children:[!g&&e.jsxs(u.Fragment,{children:[e.jsx(v,{variant:"text",size:"sm",elementType:D,to:l,relative:"path",startIcon:e.jsx(cm,{}),children:e.jsx(n,{message:"Back"})}),e.jsx("div",{className:"mr-auto",children:a&&e.jsx(Lm,{name:"slug",showLinkIcon:!1,prefix:o})})]}),s&&e.jsx(dm,{editor:s}),!g&&e.jsx(um,{editor:s}),t&&e.jsx(Om,{onSave:()=>{t(s.getHTML())},isLoading:r}),i]}),e.jsx(Mm,{editor:s,size:"sm",imageDiskPrefix:c})]})]})}function Om({onSave:s,isLoading:a}){const i=k().watch("title");return e.jsx(v,{variant:"flat",size:"sm",color:"primary",className:"min-w-90",disabled:a||!i,onClick:()=>s(),children:e.jsx(n,{message:"Save"})})}function Lm({name:s,...a}){const{field:{onChange:t,onBlur:i,value:r="",ref:l}}=Ge({name:s}),o=u.useRef(!1),{watch:c,setValue:d}=k();return u.useEffect(()=>{const x=c((g,{name:h})=>{h==="title"&&!o.current&&d("slug",g.title)});return()=>x.unsubscribe()},[c,d]),e.jsx(om,{className:_(!r&&"invisible"),onChange:x=>{o.current=!0,t(x)},onInputBlur:i,value:r,inputRef:l,...a})}const Rm=he.lazy(()=>is(()=>import("./article-body-editor-5397d1f2.js"),["./article-body-editor-5397d1f2.js","./main-78aa46db.js","./main-714cd21f.css","./c-30426c14.js","./article-body-editor-c0ff5600.css"],import.meta.url));function $m(){const s=Fn();return s.data?e.jsxs(u.Fragment,{children:[e.jsx(An,{query:s}),e.jsx(qm,{page:s.data.page})]}):e.jsx("div",{className:"relative w-full h-full",children:e.jsx(zn,{query:s})})}function qm({page:s}){const a=ce(),t=rm(),i=O({defaultValues:{title:s.title,slug:s.slug,body:s.body}}),r=l=>{t.mutate({...i.getValues(),body:l},{onSuccess:()=>a("../..",{relative:"path"})})};return e.jsx(u.Suspense,{fallback:e.jsx(Fe,{}),children:e.jsx(Rm,{initialContent:s.body,children:(l,o)=>e.jsx(Me,{children:e.jsxs(Yt,{...i,children:[e.jsx(Ua,{editor:o,backLink:"../..",isLoading:t.isPending,onSave:r}),e.jsx("div",{className:"mx-20",children:e.jsxs("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[e.jsx(qa,{}),l]})})]})})})})}function Um(s){const a=s||"custom-pages";return A({mutationFn:t=>Vm(t,a),onError:t=>G(t),onSuccess:async()=>
51{await T.invalidateQueries({queryKey:["custom-pages"]}),await T.invalidateQueries({queryKey:W(a)}),P(m("Page created"))}})}function Vm(s,a){return S.post(`${a}`,s).then(t=>t.data)}const Bm=he.lazy(()=>is(()=>import("./article-body-editor-5397d1f2.js"),["./article-body-editor-5397d1f2.js","./main-78aa46db.js","./main-714cd21f.css","./c-30426c14.js","./article-body-editor-c0ff5600.css"],import.meta.url));function Hm(){const s=ce(),a=Um(),t=O(),i=r=>{a.mutate({...t.getValues(),body:r},{onSuccess:()=>s("../",{relative:"path"})})};return e.jsx(u.Suspense,{fallback:e.jsx(Fe,{}),children:e.jsx(Bm,{children:(r,l)=>e.jsx(Me,{children:e.jsxs(Yt,{...t,children:[e.jsx(Ua,{editor:l,isLoading:a.isPending,onSave:i,backLink:"../"}),e.jsx("div",{className:"mx-20",children:e.jsxs("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[e.jsx(qa,{}),r]})})]})})})})}function Wm(){const{setValue:s,watch:a}=k(),{themeIndex:t}=se(),i=`appearance.themes.all.${t}.font`;return e.jsx(_i,{value:a(i),onChange:r=>{s(i,r,{shouldDirty:!0}),E().preview.setThemeFont(r)}})}const Km={"rounded-none":{label:m("Square"),value:"0px"},rounded:{label:m("Small"),value:"0.25rem"},"rounded-md":{label:m("Medium"),value:"0.375rem"},"rounded-lg":{label:m("Large"),value:"0.5rem"},"rounded-xl":{label:m("Larger"),value:"0.75rem"},"rounded-full":{label:m("Pill"),value:"9999px"}};function Gm(){return e.jsxs("div",{className:"space-y-24",children:[e.jsx(Ps,{label:e.jsx(n,{message:"Button rounding"}),name:"button-radius"}),e.jsx(Ps,{label:e.jsx(n,{message:"Input rounding"}),name:"input-radius"}),e.jsx(Ps,{label:e.jsx(n,{message:"Panel rounding"}),name:"panel-radius",hidePill:!0})]})}function Ps({label:s,name:a,hidePill:t}){const{themeIndex:i}=se(),{watch:r,setValue:l}=k(),o=`appearance.themes.all.${i}.values.--be-${a}`,c=r(o);return e.jsxs("div",{children:[e.jsx("div",{className:"mb-10 text-sm font-semibold",children:s}),e.jsx("div",{className:"grid grid-cols-3 gap-10 text-sm",children:Object.entries(Km).filter(([d])=>!t||!d.includes("full")).map(([d,{label:x,value:g}])=>e.jsx(Qm,{radius:d,isActive:g===c,onClick:()=>{l(o,g,{shouldDirty:!0})},children:e.jsx(n,{...x})},d))})]})}function Qm({radius:s,children:a,isActive:t,onClick:i}){return e.jsx(Lt,{display:"block",className:_("h-36 border-2 hover:bg-hover",s,t&&"border-primary"),onClick:i,children:a})}const Tt=["schedule","error","outgoing-email"];function Jm(){const{pathname:s}=ps(),a=s.split("/").pop(),t=Tt.includes(a)?Tt.indexOf(a):0;return e.jsxs(vs,{className:"p-12 md:p-24",selectedTab:t,children:[e.jsxs(ys,{children:[e.jsx(Ce,{elementType:D,to:"/admin/logs/schedule",replace:!0,children:e.jsx(n,{message:"Schedule"})}),e.jsx(Ce,{elementType:D,to:"/admin/logs/error",replace:!0,children:e.jsx(n,{message:"Error"})}),e.jsx(Ce,{elementType:D,to:"/admin/logs/outgoing-email",replace:!0,children:e.jsx(n,{message:"Email"})})]}),e.jsx(hs,{})]})}function Va(){const{trans:s}=F();return A({mutationFn:a=>Ym(a),onSuccess:async(a,t)=>{await T.invalidateQueries({queryKey:W("logs/schedule")}),P.positive(s(m("Command reran")))},onError:a=>G(a)})}function Ym({id:s}){return S.post(`logs/schedule/rerun/${s}`).then(a=>a.data)}const Zm=H(e.jsx("path",{d:"M21 12V6c0-1.1-.9-2-2-2h-1V2h-2v2H8V2H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h7v-2H5V10h14v2h2zm-2-4H5V6h14v2zm-3.36 12c.43 1.45 1.77 2.5 3.36 2.5 1.93 0 3.5-1.57 3.5-3.5s-1.57-3.5-3.5-3.5c-.95 0-1.82.38-2.45 1H18V18h-4v-4h1.5v1.43c.9-.88 2.14-1.43 3.5-1.43 2.76 0 5 2.24 5 5s-2.24 5-5 5c-2.42 0-4.44-1.72-4.9-4h1.54z"}),"EventRepeatOutlined"),Xm=[{key:"command",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Name"}),body:s=>e.jsx(fe,{label:s.command,description:s.output})},{key:"ran_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Ran at"}),body:s=>e.jsx(Zs,{date:s.ran_at})},{key:"duration",allowsSorting:!0,header:()=>e.jsx(n,{message:"Duration"}),body:s=>`${s.duration}ms`},{key:"exit_code",allowsSorting:!0,header:()=>e.jsx(n,{message:"Completed"}),body:s=>e.jsx($a,{value:s.exit_code===0})},{key:"count_in_last_hour",allowsSorting:!0,header:()=>e.jsx(n,{message:"Runs recently"}),body:s=>
51e.jsx(ri,{value:s.count_in_last_hour})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsx(ex,{item:s})}];function ex({item:s}){const a=Va();return e.jsx(L,{label:e.jsx(n,{message:"Rerun now"}),children:e.jsx(w,{size:"md",className:"text-muted",disabled:a.isPending,onClick:()=>{a.mutate({id:s.id})},children:e.jsx(Zm,{})})})}const sx=""+new URL("timeline-172fbeee.svg",import.meta.url).href;function Dt(){return e.jsx(ue,{padding:"pt-12 md:pt-24",endpoint:"logs/schedule",title:e.jsx(n,{message:"CRON schedule log"}),columns:Xm,actions:e.jsx(tx,{}),enableSelection:!1,emptyStateMessage:e.jsx(te,{image:sx,title:e.jsx(n,{message:"No scheduled commands have ran yet"}),filteringTitle:e.jsx(n,{message:"No matching scheduled commands"})})})}function tx(){return e.jsx(me,{elementType:"a",href:"api/v1/logs/schedule/download",download:!0,icon:e.jsx(at,{}),children:e.jsx(n,{message:"Download log"})})}const ax=""+new URL("bug-fixing-bd601a66.svg",import.meta.url).href,nx=[{key:"message",visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Message"}),body:s=>s.message},{key:"datetime",header:()=>e.jsx(n,{message:"Date"}),body:s=>e.jsx(Zs,{date:s.datetime})},{key:"severity",header:()=>e.jsx(n,{message:"Severity"}),body:s=>e.jsxs("span",{className:_("flex items-center gap-6 text-xs capitalize",s.level==="error"?"text-danger":"text-primary"),children:[s.level==="error"?e.jsx(Ot,{size:"sm"}):e.jsx(Ai,{size:"sm"}),s.level]})}];function ix({error:s}){return e.jsxs(R,{size:"fullscreen",children:[e.jsx(U,{showDivider:!0,padding:"px-24 py-10",actions:e.jsx(v,{variant:"outline",size:"xs",onClick:()=>rx(s),children:e.jsx(n,{message:"Download"})}),children:e.jsx(n,{message:"Error details"})}),e.jsx($,{children:e.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-5",children:s.exception})})]})}function rx(s){const a=document.createElement("a");a.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(s.exception)),a.setAttribute("download",`error-${s.id}.log`),a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a)}function lx(){const{trans:s}=F();return A({mutationFn:a=>ox(a),onSuccess:async()=>{await T.invalidateQueries({queryKey:W("logs/error")}),P(s(m("Log file deleted")))},onError:a=>G(a)})}function ox({identifier:s}){return S.delete(`logs/error/${s}`).then(a=>a.data)}function cx(){return e.jsx(ue,{padding:"pt-12 md:pt-24",endpoint:"logs/error",title:e.jsx(n,{message:"Error log"}),onRowAction:s=>{Qs(ix,{error:s})},columns:nx,actions:e.jsx(dx,{}),enableSelection:!1,emptyStateMessage:e.jsx(te,{image:ax,title:e.jsx(n,{message:"No errors have been logged yet"}),filteringTitle:e.jsx(n,{message:"No matching error log entries"})})})}function dx(){var l,o,c;const{query:s,setParams:a}=Xt(),t=u.useRef(!1),[i,r]=u.useState(null);return u.useEffect(()=>{var d,x;if((x=(d=s.data)==null?void 0:d.files)!=null&&x.length&&!t.current){t.current=!0;const g=s.data.files[0].identifier;r(s.data.files[0].identifier),g!==s.data.selectedFile&&a({file:s.data.files[0].identifier})}},[s.data,a,t]),e.jsxs(u.Fragment,{children:[e.jsx(ux,{files:((l=s.data)==null?void 0:l.files)??null,selectedFile:i,onSelected:d=>{r(d.identifier),a({file:d.identifier})}}),e.jsx(v,{variant:"outline",color:"danger",disabled:!i,onClick:()=>Qs(mx,{identifier:i}),children:e.jsx(n,{message:"Delete"})}),i&&e.jsx(me,{elementType:"a",download:(c=(o=s.data)==null?void 0:o.files.find(d=>d.identifier===i))==null?void 0:c.name,href:`api/v1/logs/error/${i}/download`,icon:e.jsx(at,{}),children:e.jsx(n,{message:"Download log"})})]})}function ux({files:s,selectedFile:a,onSelected:t}){return s?s.length?e.jsx(He,{selectionMode:"single",selectedValue:a,size:"sm",minWidth:"min-w-[210px]",children:s==null?void 0:s.map(i=>e.jsxs(j,{value:i.identifier,onSelected:()=>t(i),children:[i.name," (",e.jsx(li,{bytes:i.size}),")"]},i.identifier))}):null:e.jsx(qt,{variant:"rect",className:"max-w-[210px]"})}function mx({identifier:s}){const a=lx();return e.jsx(pe,{title:e.jsx(n,{message:"Delete log file"}),body:e.jsx(n,{message:"Are you sure you want to delete this log file?"}),confirm:e.jsx(n,{message:"Delete"}),onConfirm:()=>a.mutate({identifier:s},{onSuccess:()=>En()}),isLoading:a.isPending,isDanger:!0})}const xx=""+new URL("opened-4dded9dc.svg",import.meta.url).href;function gx(s){return be({queryKey:["logs/outgoing-email",s],queryFn:()=>hx(s)})}function hx(s){return S.get(`logs/outgoing-email/${s}`).then(a=>a.data)}function px({logItemId:s}){const{data:a}=gx(s),{base_url:t}=ae();return e.jsxs(R,{size:"fullscreen",children:[e.jsx(U,{showDivider:!0,padding:"px-24 py-10",actions:e.jsx(v,{variant:"outline",size:"xs",disabled:!a,type:"button",onClick:a?()=>ws(`${t}
51/api/v1/logs/outgoing-email/${s}/download`):void 0,children:e.jsx(n,{message:"Download"})}),children:e.jsx(n,{message:"Email preview"})}),e.jsx($,{children:a?e.jsx("iframe",{srcDoc:a.logItem.parsed_message.body.html,className:"h-max w-full border-none",onLoad:i=>{const r=i.target;r.style.height=r.contentWindow.document.body.scrollHeight+"px"}}):e.jsx("div",{className:"flex min-h-200 items-center justify-center",children:e.jsx(re,{isIndeterminate:!0})})})]})}const jx=[{key:"message_id",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Subject"}),body:s=>e.jsx(fe,{label:s.subject,description:s.message_id})},{key:"status",allowsSorting:!0,header:()=>e.jsx(n,{message:"Status"}),body:s=>{switch(s.status){case"sent":return e.jsx(Fs,{color:"positive",children:e.jsx(n,{message:"Sent"})});case"not-sent":return e.jsx(Fs,{color:void 0,children:e.jsx(n,{message:"Not sent"})});case"error":return e.jsx(Fs,{color:"danger",children:e.jsx(n,{message:"Error"})})}}},{key:"from",allowsSorting:!0,header:()=>e.jsx(n,{message:"From"}),body:s=>s.from},{key:"to",allowsSorting:!0,header:()=>e.jsx(n,{message:"To"}),body:s=>s.to},{key:"created_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Date"}),body:s=>e.jsx(Zs,{date:s.created_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsx(fx,{item:s})}];function fx({item:s}){const a=Va();return e.jsxs(I,{type:"modal",children:[e.jsx(L,{label:e.jsx(n,{message:"Preview"}),children:e.jsx(w,{size:"md",className:"text-muted",disabled:a.isPending,onClick:()=>{a.mutate({id:s.id})},children:e.jsx(Zn,{})})}),e.jsx(px,{logItemId:s.id})]})}function Fs({color:s,children:a}){return e.jsx(Us,{color:s,size:"xs",className:"w-max min-w-50 text-center",children:a})}const bx=[{key:"status",label:m("Status"),description:m("Status of the outgoing email"),defaultOperator:B.eq,control:{type:oe.Select,defaultValue:"01",options:[{key:"01",label:m("Not sent"),value:"no-sent"},{key:"02",label:m("Sent"),value:"sent"},{key:"03",label:m("Error"),value:"error"}]}},Ie({description:m("Date email send was attempted")})];function vx(){return e.jsx(ue,{padding:"pt-12 md:pt-24",endpoint:"logs/outgoing-email",title:e.jsx(n,{message:"Outgoing email"}),columns:jx,filters:bx,actions:e.jsx(yx,{}),enableSelection:!1,emptyStateMessage:e.jsx(te,{image:xx,title:e.jsx(n,{message:"No outgoing emails have been logged yet"}),filteringTitle:e.jsx(n,{message:"No matching emails"})})})}function yx(){return e.jsx(me,{elementType:"a",href:"api/v1/logs/
51outgoing-email/download",download:!0,icon:e.jsx(at,{}),children:e.jsx(n,{message:"Download log"})})}const wx=he.lazy(()=>is(()=>import("./admin-report-page-58278640.js"),["./admin-report-page-58278640.js","./main-78aa46db.js","./main-714cd21f.css","./TrendingUp-f0cd576a.js","./file-entry-index-page-b208e7f3.js","./file-thumbnail-aea53471.js","./section-helper-8bd754d2.js","./info-dialog-trigger-6fd12554.js","./MoreVert-4d484c39.js","./OpenInNew-a8754599.js","./Info-821e606d.js"],import.meta.url)),Sx=[{path:"appearance",element:e.jsx(K,{permission:"appearance.update",children:e.jsx(Vr,{})}),children:[{index:!0,element:e.jsx(ad,{})},{path:"general",element:e.jsx(nl,{})},{path:"seo-settings",element:e.jsx(gl,{})},{path:"custom-code",element:e.jsx(jl,{})},{path:"themes",element:e.jsx(ol,{})},{path:"themes/:themeIndex",element:e.jsx(Gl,{})},{path:"themes/:themeIndex/font",element:e.jsx(Wm,{})},{path:"themes/:themeIndex/radius",element:e.jsx(Gm,{})},{path:"menus",element:e.jsx(Kr,{})},{path:"menus/:menuIndex",element:e.jsx(Jr,{})},{path:"menus/:menuIndex/items/:menuItemIndex",element:e.jsx(sl,{})},...Object.values(ca.sections).flatMap(s=>s.routes||[])]},{path:"/",element:e.jsx(Ui,{}),children:[...im,{path:"/",element:e.jsx(he.Suspense,{fallback:e.jsx(Fe,{screen:!0}),children:e.jsx(wx,{})})},{path:"users",element:e.jsx(K,{permission:"users.update",children:e.jsx(lr,{})})},{path:"users/new",element:e.jsx(K,{permission:"users.update",children:e.jsx(vc,{})})},{path:"users/:userId/edit",element:e.jsx(K,{permission:"users.update",children:e.jsx(pc,{})})},{path:"roles",element:e.jsx(K,{permission:"roles.update",children:e.jsx(rd,{})})},{path:"roles/new",element:e.jsx(K,{permission:"roles.update",children:e.jsx(Id,{})})},{path:"roles/:roleId/edit",element:e.jsx(K,{permission:"roles.update",children:e.jsx(Sd,{})})},{path:"subscriptions",element:e.jsx(K,{permission:"subscriptions.update",children:e.jsx(Zd,{})})},{path:"plans",element:e.jsx(K,{permission:"plans.update",children:e.jsx(mu,{})})},{path:"plans/new",element:e.jsx(K,{permission:"plans.update",children:e.jsx(Pu,{})})},{path:"plans/:productId/edit",element:e.jsx(K,{permission:"plans.update",children:e.jsx(Nu,{})})},{path:"custom-pages",element:e.jsx(K,{permission:"custom_pages.update",children:e.jsx(yl,{})})},{path:"custom-pages/new",element:e.jsx(K,{permission:"custom_pages.update",children:e.jsx(Hm,{})})},{path:"custom-pages/:pageId/edit",element:e.jsx(K,{permission:"custom_pages.update",children:e.jsx($m,{})})},{path:"tags",element:e.jsx(K,{permission:"tags.update",children:e.jsx(Rd,{})})},{path:"localizations",element:e.jsx(K,{permission:"localizations.update",children:e.jsx(zc,{})})},{path:"localizations/:localeId/translate",element:e.jsx(Gc,{})},{path:"files",element:e.jsx(K,{permission:"files.update",children:e.jsx(oi,{})})},{path:"ads",element:e.jsx(K,{permission:"settings.update",children:e.jsx(ed,{})})},{path:"settings",element:e.jsx(K,{permission:"settings.update",children:e.jsx(Nl,{})}),children:[{index:!0,element:e.jsx(Ht,{to:"general",replace:!0})},{path:"general",element:e.jsx(Dl,{})},{path:"subscriptions",element:e.jsx(oo,{})},{path:"localization",element:e.jsx(xo,{})},{path:"authentication",element:e.jsx(go,{})},{path:"uploading",element:e.jsx(zo,{})},{path:"outgoing-email",element:e.jsx(Ko,{})},{path:"cache",element:e.jsx(Yo,{})},{path:"analytics",element:e.jsx(uc,{})},{path:"logging",element:e.jsx(ec,{})},{path:"queue",element:e.jsx(nc,{})},{path:"recaptcha",element:e.jsx(oc,{})},{path:"gdpr",element:e.jsx(Fu,{})},...lo]},{path:"logs",element:e.jsx(K,{permission:"logs.view",children:e.jsx(Jm,{})}),children:[{index:!0,element:e.jsx(Dt,{})},{path:"schedule",element:e.jsx(Dt,{})},{path:"error",element:e.jsx(cx,{})},{path:"outgoing-email",element:e.jsx(vx,{})}]}]},{path:"*",element:e.jsx(Dn,{})}];function kx(){return Tn(Sx)}const zx=Object.freeze(Object.defineProperty({__proto__:null,default:kx},Symbol.toStringTag,{value:"Module"}));export{cm as A,Zm as E,vm as F,wm as H,Li as M,km as N,Qd as P,hc as R,Nm as S,yc as T,Pm as a,zm as b,Em as c,xm as d,ia as e,Jd as f,Sm as g,Vl as h,nu as i,$l as j,zx as k,Wl as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.