Files
mtdb_movie/public/build/assets/admin-routes-cb411577.js
maher 703f50a09d
Some checks failed
Build / run (push) Has been cancelled
first commit
2025-10-29 11:42:25 +01:00

54 lines
440 KiB
JavaScript
Executable File
Vendored
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{u as ue,j as e,c as w,C as jo,T as n,r as m,a as jr,g as Tn,$ as Xs,s as Fa,A as Oe,U as fo,m as De,b as T,N as bo,I as C,d as be,e as S,O as Ms,f as vo,E as fr,h as d,R as B,i as Ae,k as yo,S as Ye,l as h,K as zt,n as z,o as Be,p as it,q as Je,P as Dt,t as cs,v as I,w as _,x as M,y as q,D as A,B as b,z as K,F as ce,G as Co,H as He,J as At,L as G,M as se,Q as X,V as re,W as ee,X as En,Y as wo,Z as So,_ as No,a0 as ps,a1 as Mt,a2 as js,a3 as O,a4 as te,a5 as p,a6 as $t,a7 as $e,a8 as Rt,a9 as F,aa as ne,ab as W,ac as ko,ad as Vt,ae as Ns,af as de,ag as Pa,ah as Ta,ai as Le,aj as P,ak as le,al as Lo,am as br,an as vr,ao as _o,ap as fs,aq as ls,ar as Ea,as as D,at as yr,au as Re,av as Mo,aw as Io,ax as Fo,ay as bs,az as Po,aA as To,aB as zs,aC as we,aD as ds,aE as vs,aF as za,aG as V,aH as Y,aI as Cr,aJ as qt,aK as Da,aL as _e,aM as lt,aN as Xe,aO as wr,aP as zn,aQ as Ot,aR as Ze,aS as Ke,aT as Eo,aU as zo,aV as Aa,aW as Sr,aX as Qs,aY as Nr,aZ as kr,a_ as Lr,a$ as Do,b0 as Ao,b1 as $o,b2 as $a,b3 as Ro,b4 as Vo,b5 as qo,b6 as Oo,b7 as $s,b8 as Ra,b9 as Ut,ba as Uo,bb as Va,bc as Bo,bd as Ho,be as qa,bf as _r,bg as ys,bh as Mr,bi as ot,bj as Oa,bk as Ir,bl as Zo,bm as Fr,bn as Ko,bo as Bt,bp as Wo,bq as Dn,br as Me,bs as Qo,bt as Go,bu as Ua,bv as Jo,bw as Yo,bx as Xo,by as ec,bz as Ht,bA as sc,bB as tc,bC as Zt,bD as ac,bE as An,bF as ie,bG as nc,bH as rc,bI as ic,bJ as lc,bK as oc,bL as cc}from"./main-239552ae.js";import{S as Ue,u as Pr,a as dc}from"./section-helper-79a95256.js";import{F as R,a as H,d as uc,D as Ba,h as mc,K as ct,A as Tr,u as Kt,b as Ha,B as xc,c as hc,e as Wt,T as dt,f as J,g as me,i as ut,j as gc,k as pc,l as Er,m as jc,C as fc,n as $,N as us,o as bc,p as vc,q as Cs,r as Ce,S as ya,s as yc,t as Vs,v as Cc,w as Qt,x as zr,M as Gt,y as wc,z as Dr,E as Za,G as Ar,H as Ka,I as ws,J as Ss,L as fe,O as We,P as $r,Q as Rr,R as Wa,U as Sc,V as Vr,W as Nc,X as kc,Y as ze,Z as et,_ as Jt,$ as st,a0 as qr,a1 as Lc,a2 as Or,a3 as Ur,a4 as _c,a5 as Mc,a6 as Ic,a7 as Fc,a8 as Yt,a9 as Pc,aa as Tc,ab as Ec,ac as Qa,ad as zc,ae as Br,af as Dc,ag as Ac,ah as Gs,ai as $c,aj as Rs,ak as mt,al as Hr,am as Te,an as Rc,ao as Vc,ap as qc,aq as Zr,ar as Oc,as as Uc,at as qs,au as rs,av as Bc,aw as Hc,ax as Kr,ay as Ga,az as Wr,aA as Zc,aB as Kc,aC as Qr,aD as Gr,aE as Wc,aF as Qc,aG as Xt,aH as Jr,aI as Gc,aJ as Ja,aK as Ya,aL as Jc,aM as Yr,aN as Yc,aO as Xr,aP as ei,aQ as si,aR as Xc,aS as ed,aT as ti,aU as Xa,aV as ai,aW as sd,aX as td,aY as ad,aZ as nd,a_ as rd,a$ as id,b0 as ld,b1 as $n,b2 as od,b3 as cd,b4 as ni,b5 as dd,b6 as ri,b7 as ud,b8 as md,b9 as xd}from"./user-profile-link-0c8224d9.js";import{E as xe,B as ii,a as It,C as hd,O as li}from"./OpenInNew-32d7773a.js";function gd({className:s,isCompactMode:t}){const{version:a}=ue();return e.jsxs("div",{className:w(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(jo,{matchDescendants:r=>r==="/admin",menu:"admin-sidebar",orientation:"vertical",onlyShowIcons:t,itemClassName:({isActive:r})=>w("block w-full rounded-button py-12 px-16",r?"bg-primary/6 text-primary font-semibold":"hover:bg-hover"),gap:"gap-8"}),!t&&e.jsx("div",{className:"mt-auto gap-14 px-16 text-xs",children:e.jsx(n,{message:"Version: :number",values:{number:a}})})]})}const en=m.createContext(null);function pd(s=!1){m.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 jd({children:s,leftSidenavStatus:t,onLeftSidenavChange:a,rightSidenavStatus:r,initialRightSidenavStatus:i,onRightSidenavChange:l,name:o,leftSidenavCanBeCompact:c,height:u="h-screen",className:x,gridClassName:g="dashboard-grid",blockBodyOverflow:j=!0,...v}){pd(!j);const f=jr("(max-width: 1024px)"),y=m.useMemo(()=>o?Tn(`${o}.sidenav.compact`):!1,[o])?"compact":"open",[L,k]=Xs(t,f?"closed":y,a),E=m.useMemo(()=>{if(f)return"closed";if(i!=null)return i;const ye=Tn(`${o}.sidenav.right.position`,"open");return ye??(i||"closed")},[f,o,i]),[U,Q]=Xs(r,E,l),ae=m.useCallback(ye=>{Q(ye),Fa(`${o}.sidenav.right.position`,ye)},[Q,o]),ge=f&&(L==="open"||U==="open");return e.jsx(en.Provider,{value:{leftSidenavStatus:L,setLeftSidenavStatus:k,rightSidenavStatus:U,setRightSidenavStatus:ae,leftSidenavCanBeCompact:c,name:o,isMobileMode:f},children:e.jsxs("div",{...v,className:w("relative isolate",g,x,u),children:[s,e.jsx(Oe,{children:ge&&e.jsx(fo,{position:"fixed",onClick:()=>{k("closed"),ae("closed")}},"dashboard-underlay")})]})})}function fd({children:s,isScrollable:t=!0}){return m.cloneElement(s,{className:w(s.props.className,t&&"overflow-y-auto stable-scrollbar","dashboard-grid-content")})}function bd({className:s,position:t,children:a,size:r="md",mode:i,overlayPosition:l="fixed",display:o="flex",overflow:c="overflow-hidden",forceClosed:u=!1}){const{isMobileMode:x,leftSidenavStatus:g,setLeftSidenavStatus:j,rightSidenavStatus:v,setRightSidenavStatus:f}=m.useContext(en),N=t==="left"?g:v,y=x||i==="overlay",L={open:{display:o,width:null},compact:{display:o,width:null},closed:{width:0,transitionEnd:{display:"none"}}},k=vd(N==="compact"?"compact":r);return e.jsx(De.div,{variants:L,initial:!1,animate:u?"closed":N,transition:{type:"tween",duration:.15},onClick:E=>{const U=E.target;x&&(U.closest("button")||U.closest("a"))&&(j("closed"),f("closed"))},className:w(s,t==="left"?"dashboard-grid-sidenav-left":"dashboard-grid-sidenav-right","will-change-[width]",c,k,y&&`${l} bottom-0 top-0 z-20 shadow-2xl`,y&&t==="left"&&"left-0",y&&t==="right"&&"right-0"),children:m.cloneElement(a,{className:w(a.props.className,"w-full h-full",N==="compact"&&"compact-scrollbar"),isCompactMode:N==="compact"})})}function vd(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 yd=T(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 Cd({children:s,className:t,hideToggleButton:a,...r}){const{isMobileMode:i,leftSidenavStatus:l,setLeftSidenavStatus:o,name:c,leftSidenavCanBeCompact:u}=m.useContext(en),x=u&&!i,g=!a&&(i||u),j=()=>{o(l==="open"?"closed":"open")},v=()=>{const f=l==="compact"?"open":"compact";Fa(`${c}.sidenav.compact`,f==="compact"),o(f)};return e.jsx(bo,{className:w("dashboard-grid-navbar",t),border:"border-b",size:"sm",toggleButton:g?e.jsx(C,{size:"md",onClick:()=>{x?v():j()},children:e.jsx(yd,{})}):void 0,...r,children:s})}function wd(){return be({queryKey:["admin-setup-alerts"],queryFn:()=>Sd()})}function Sd(){return S.get("admin/setup-alerts").then(s=>s.data)}function Nd(){return e.jsxs(jd,{name:"admin",leftSidenavCanBeCompact:!0,children:[e.jsx(Cd,{size:"sm",menuPosition:"admin-navbar"}),e.jsx(bd,{position:"left",size:"sm",children:e.jsx(gd,{})}),e.jsx(fd,{children:e.jsxs("div",{className:"bg dark:bg-alt",children:[e.jsx(kd,{}),e.jsx(Ms,{})]})})]})}function kd(){const{data:s}=wd(),[t]=vo("admin-setup-alert-dismissed",null),a=!t||Date.now()-t.timestamp>864e5;return!(s!=null&&s.alerts.length)||!a?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(Ld,{alert:s.alerts[0]})})}function Ld({alert:s}){const t=e.jsx("div",{dangerouslySetInnerHTML:{__html:s.description}});return e.jsx(Ue,{leadingIcon:e.jsx(fr,{size:"xs",className:"text-danger"}),onClose:()=>{Fa("admin-setup-alert-dismissed",{timestamp:Date.now()})},title:s.title,description:t,color:"neutral"},s.title)}function tt(s){var t;return{...s,defaultOperator:R.between,control:{type:H.DateRangePicker,defaultValue:((t=s.control)==null?void 0:t.defaultValue)||uc(Ba[3].getRangeValue())}}}function Se(s){return tt({key:"created_at",label:d("Date created"),...s})}function Ie(s){return tt({key:"updated_at",label:d("Last updated"),...s})}const _d=[{key:"email_verified_at",label:d("Email"),description:d("Email verification status"),defaultOperator:R.ne,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("is confirmed"),value:{value:null,operator:R.ne}},{key:"02",label:d("is not confirmed"),value:{value:null,operator:R.eq}}]}},Se({description:d("Date user registered or was created")}),Ie({description:d("Date user was last updated")}),{key:"subscriptions",label:d("Subscription"),description:d("Whether user is subscribed or not"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("is subscribed"),value:{value:"*",operator:R.has}},{key:"02",label:d("is not subscribed"),value:{value:"*",operator:R.doesntHave}}]}}],oi=B.createContext(null);function xt(){return m.useContext(oi)}const Md=15,Id=[{key:10},{key:15},{key:20},{key:50},{key:100}];function sn({query:s,onPerPageChange:t,onPageChange:a,className:r}){var u;const i=Ae(),l=yo(),o=(u=s.data)==null?void 0:u.pagination;if(!o)return null;const c=t?e.jsx(Ye,{minWidth:"min-w-auto",selectionMode:"single",disabled:s.isLoading,labelPosition:"side",size:"xs",label:e.jsx(n,{message:"Items per page"}),selectedValue:o.per_page||Md,onSelectionChange:x=>t(x),children:Id.map(x=>e.jsx(h,{value:x.key,children:x.key},x.key))}):null;return e.jsxs("div",{className:w("flex h-54 select-none items-center justify-end gap-20 px-20",r),children:[!i&&c,o.from&&o.to&&"total"in o?e.jsx("div",{className:"text-sm",children:e.jsx(n,{message:":from - :to of :total",values:{from:o.from,to:o.to,total:l.format(o.total)}})}):null,e.jsxs("div",{className:"text-muted",children:[e.jsx(C,{disabled:s.isFetching||o.current_page<2,onClick:()=>{a==null||a((o==null?void 0:o.current_page)-1)},children:e.jsx(zt,{})}),e.jsx(C,{disabled:s.isFetching||!mc(o),onClick:()=>{a==null||a((o==null?void 0:o.current_page)+1)},children:e.jsx(ct,{})})]})]})}function tn({actions:s,filters:t,filtersLoading:a,searchPlaceholder:r=d("Type to search..."),searchValue:i="",onSearchChange:l}){const{trans:o}=z();return e.jsxs(ci,{children:[e.jsx(Be,{size:"sm",className:"mr-auto min-w-180 max-w-440 flex-auto",inputWrapperClassName:"mr-24 md:mr-0",placeholder:o(r),startAdornment:e.jsx(it,{size:"sm"}),value:i,onChange:c=>{l(c.target.value)}}),t&&e.jsx(Tr,{filters:t,disabled:a}),s]})}function ci({children:s,...t}){return e.jsx("div",{className:"hidden-scrollbar relative mb-24 flex h-42 items-center gap-8 overflow-x-auto text-muted md:gap-12",...t,children:s})}function an({actions:s,selectedItemsCount:t}){return e.jsxs(ci,{"data-testid":"datatable-selected-header",children:[e.jsx("div",{className:"mr-auto",children:e.jsx(n,{message:"[one 1 item|other :count items] selected",values:{count:t}})}),s]})}function di({filters:s,filtersLoading:t,columns:a,searchPlaceholder:r,queryParams:i,endpoint:l,actions:o,selectedActions:c,emptyStateMessage:u,tableDomProps:x,onRowAction:g,enableSelection:j=!0,selectionStyle:v="checkbox",children:f,cellHeight:N,collapseTableOnMobile:y=!0}){var Ps;const L=Ae(),{trans:k}=z(),{encodedFilters:E}=Kt(s),[U,Q]=m.useState({perPage:15}),[ae,ge]=m.useState([]),ye=Ha(l,{...U,...i,[xc]:E},void 0,()=>ge([])),Ks=!!(U.query||U.filters||E),ts=(Ps=ye.data)==null?void 0:Ps.pagination;return e.jsxs(oi.Provider,{value:{selectedRows:ae,setSelectedRows:ge,endpoint:l,params:U,setParams:Q,query:ye},children:[f,e.jsx(Oe,{initial:!1,mode:"wait",children:ae.length?e.jsx(an,{selectedItemsCount:ae.length,actions:c},"selected"):e.jsx(tn,{searchPlaceholder:r,searchValue:U.query,onSearchChange:as=>Q({...U,query:as}),actions:o,filters:s,filtersLoading:t},"default")}),s&&e.jsx("div",{className:"mb-14",children:e.jsx(Oe,{initial:!1,mode:"wait",children:t&&E?e.jsx(hc,{}):e.jsx(De.div,{...Je,children:e.jsx(Wt,{filters:s})},"filter-list")})}),e.jsxs("div",{className:w("relative rounded-panel",(!L||!y)&&"border"),children:[ye.isFetching&&e.jsx(Dt,{isIndeterminate:!0,className:"absolute left-0 top-0 z-10 w-full","aria-label":k({message:"Loading"}),size:"xs"}),e.jsx("div",{className:"relative overflow-x-auto md:overflow-hidden",children:e.jsx(dt,{...x,columns:a,data:(ts==null?void 0:ts.data)||[],sortDescriptor:U,onSortChange:as=>{Q({...U,...as})},selectedRows:ae,enableSelection:j,selectionStyle:v,onSelectionChange:ge,onAction:g,collapseOnMobile:y,cellHeight:N})}),(ye.isFetched||ye.isPlaceholderData)&&!(ts!=null&&ts.data.length)?e.jsx("div",{className:"pt-50",children:m.cloneElement(u,{isFiltering:Ks})}):void 0,e.jsx(sn,{query:ye,onPageChange:as=>Q({...U,page:as}),onPerPageChange:as=>Q({...U,perPage:as})})]})]})}function he({title:s,headerContent:t,headerItemsAlign:a="items-end",className:r,padding:i,...l}){const o=m.useId();return e.jsxs("div",{className:w(i??"p-12 md:p-24",r),children:[s&&e.jsxs("div",{className:w("mb-16",t&&`flex ${a} gap-4`),children:[e.jsx(cs,{children:s}),e.jsx("h1",{className:"text-3xl font-light first:capitalize",id:o,children:s}),t]}),e.jsx(di,{...l,tableDomProps:{"aria-labelledby":s?o:void 0}})]})}function Fd(){const{endpoint:s,selectedRows:t,setSelectedRows:a}=xt();return I({mutationFn:()=>Pd(s,t),onSuccess:async()=>{await _.invalidateQueries({queryKey:J(s)}),M(d("Deleted [one 1 record|other :count records]",{values:{count:t.length}})),a([])},onError:r=>q(r,d("Could not delete records"))})}function Pd(s,t){return S.delete(`${s}/${t.join(",")}`).then(a=>a.data)}function Fe(){return e.jsxs(A,{type:"modal",children:[e.jsx(b,{variant:"flat",color:"danger",className:"ml-auto",children:e.jsx(n,{message:"Delete"})}),e.jsx(Td,{})]})}function Td(){const s=Fd(),{selectedRows:t,setSelectedRows:a}=xt(),{close:r}=K();return e.jsx(ce,{isLoading:s.isPending,title:e.jsx(n,{message:"Delete [one 1 item|other :count items]?",values:{count:t.length}}),body:e.jsx(n,{message:"This will permanently remove the items and cannot be undone."}),confirm:e.jsx(n,{message:"Delete"}),isDanger:!0,onConfirm:()=>{s.mutate(void 0,{onSuccess:()=>r(),onError:i=>{Co(i,422)&&(a([]),r())}})}})}function oe({isFiltering:s,title:t,filteringTitle:a,image:r,size:i,className:l}){const o=Ae();return i||(i=o?"sm":"md"),e.jsx(He,{className:l,size:i,image:e.jsx(At,{src:r}),title:s&&a?a:t,description:s&&a?e.jsx(n,{message:"Try another search query or different filters"}):void 0})}const at=""+new URL("team-de984127.svg",import.meta.url).href,je=B.forwardRef(({children:s,to:t,elementType:a,onClick:r,href:i,download:l,icon:o,disabled:c},u)=>Ae()?e.jsx(C,{ref:u,variant:"flat",color:"primary",className:"flex-shrink-0",size:"sm",to:t,href:i,download:l,elementType:a,onClick:r,disabled:c,children:o||e.jsx(me,{})}):e.jsx(b,{ref:u,startIcon:o||e.jsx(me,{}),variant:"flat",color:"primary",size:"sm",to:t,href:i,download:l,elementType:a,onClick:r,disabled:c,children:s})),Ca=T(e.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}),"FileDownloadOutlined");function Ed(s){return I({mutationFn:t=>zd(s,t),onError:t=>q(t)})}function zd(s,t){return S.post(s,t).then(a=>a.data)}function Ls(s,t){const a=document.createElement("a");a.href=s,t&&(a.download=t),document.body.appendChild(a),a.click(),document.body.removeChild(a)}function Dd(){const{close:s}=K();return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Csv export"})}),e.jsx(X,{children:e.jsx(n,{message:`Your request is being processed. We'll email you when the report is ready to download. In
certain cases, it might take a little longer, depending on the number of items beings
exported and the volume of activity.`})}),e.jsx(re,{children:e.jsx(b,{variant:"flat",color:"primary",onClick:s,children:e.jsx(n,{message:"Got it"})})})]})}function ui({endpoint:s,payload:t}){const[a,r]=m.useState(!1),i=Ed(s);return e.jsxs(m.Fragment,{children:[e.jsx(C,{variant:"outline",color:"primary",size:"sm",className:"flex-shrink-0",disabled:i.isPending,onClick:()=>{i.mutate(t,{onSuccess:l=>{l.downloadPath?Ls(l.downloadPath):r(!0)}})},children:e.jsx(Ca,{})}),e.jsx(A,{type:"modal",isOpen:a,onOpenChange:r,children:e.jsx(Dd,{})})]})}const mi=T(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 Ad(s,t){return I({mutationFn:a=>$d(t,a),onSuccess:async()=>{M(d("User suspended")),await _.invalidateQueries({queryKey:["users"]})},onError:a=>ee(a,s)})}function $d(s,t){return S.post(`users/${s}/ban`,t).then(a=>a.data)}function Rd(s){const t=ut(),[a,r]=m.useState(!s.value&&!s.defaultValue),i=s.onChange,[l,o]=Xs(s.value||t,s.defaultValue||t,Q=>{r(!1),i==null||i(Q)}),{min:c,max:u,granularity:x,timezone:g,calendarIsOpen:j,setCalendarIsOpen:v,closeDialogOnSelection:f}=gc(l,s),N=m.useCallback(()=>{r(!0),o(t),i==null||i(null),v(!1)},[t,o,i,v]),[y,L]=m.useState(()=>[En(l)]),k=m.useCallback(Q=>{c&&Q.compare(c)<0?Q=c:u&&Q.compare(u)>0&&(Q=u);const ae=l?l.set(Q):wo(Q,g);o(ae),L([En(ae)]),r(!1)},[o,c,u,l,g]),E=m.useCallback(Q=>!a&&So(l,Q),[l,a]),U=m.useCallback(Q=>({onClick:()=>{k==null||k(Q),f&&(v==null||v(!1))}}),[k,v,f]);return{selectedValue:l,setSelectedValue:o,calendarIsOpen:j,setCalendarIsOpen:v,dayIsActive:E,dayIsHighlighted:()=>!1,dayIsRangeStart:()=>!1,dayIsRangeEnd:()=>!1,getCellProps:U,calendarDates:y,setCalendarDates:L,isPlaceholder:a,clear:N,setIsPlaceholder:r,min:c,max:u,granularity:x,timezone:g,closeDialogOnSelection:f}}function Vd({showCalendarFooter:s,...t}){const a=Rd(t),r=m.useRef(null),i=ut(),l=s&&e.jsx(re,{padding:"px-14 pb-14",startAction:e.jsx(b,{disabled:a.isPlaceholder,variant:"text",color:"primary",onClick:()=>{a.clear()},children:e.jsx(n,{message:"Clear"})}),children:e.jsx(b,{variant:"text",color:"primary",onClick:()=>{a.setSelectedValue(i),a.setCalendarIsOpen(!1)},children:e.jsx(n,{message:"Today"})})}),o=e.jsx(A,{offset:8,placement:"bottom-start",isOpen:a.calendarIsOpen,onOpenChange:a.setCalendarIsOpen,type:"popover",triggerRef:r,returnFocusToTrigger:!1,moveFocusToDialog:!1,children:e.jsxs(G,{size:"auto",children:[e.jsx(X,{className:"flex items-start gap-40",padding:s?"px-24 pt-20 pb-10":null,children:e.jsx(fc,{state:a,visibleMonths:1})}),l]})}),c={onClick:u=>{u.stopPropagation(),u.preventDefault(),qd(u)?a.setCalendarIsOpen(!1):a.setCalendarIsOpen(!0)}};return e.jsxs(m.Fragment,{children:[e.jsx(pc,{ref:r,wrapperProps:c,endAdornment:e.jsx(Er,{className:w(t.disabled&&"text-disabled")}),...t,children:e.jsx(jc,{segmentProps:c,state:a,value:a.selectedValue,onChange:a.setSelectedValue,isPlaceholder:a.isPlaceholder})}),o]})}function _s(s){const{min:t,max:a}=s,{trans:r}=z(),{format:i}=No(),{field:{onChange:l,onBlur:o,value:c=null,ref:u},fieldState:{invalid:x,error:g}}=ps({name:s.name,rules:{validate:f=>{if(!f)return;const N=Mt(f);if(t&&N.compare(t)<0)return r({message:"Enter a date after :date",values:{date:i(f)}});if(a&&N.compare(a)>0)return r({message:"Enter a date before :date",values:{date:i(f)}})}}}),j=c?Mt(c):null,v={onChange:f=>{l(f&&f.toAbsoluteString())},onBlur:o,value:j,invalid:x,errorMessage:g==null?void 0:g.message,inputRef:u};return e.jsx(Vd,{...js(v,s)})}function qd(s){return["hour","minute","dayPeriod"].includes(s.currentTarget.ariaLabel||"")}function Od({user:s}){const{trans:t}=z(),{close:a,formId:r}=K(),i=O({defaultValues:{permanent:!0}}),l=i.watch("permanent"),o=Ad(i,s.id);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Suspend “:name“",values:{name:s.display_name}})}),e.jsx(X,{children:e.jsxs(te,{id:r,form:i,onSubmit:c=>o.mutate(c,{onSuccess:()=>a()}),children:[e.jsx(_s,{name:"ban_until",label:e.jsx(n,{message:"Suspend until"}),disabled:l}),e.jsx($,{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:t(d("Optional"))})]})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:r,variant:"flat",color:"primary",type:"submit",disabled:o.isPending,children:e.jsx(n,{message:"Suspend"})})]})]})}function Ud(s){return I({mutationFn:()=>Bd(s),onSuccess:()=>{M(d("User unsuspended")),_.invalidateQueries({queryKey:["users"]})},onError:t=>q(t)})}function Bd(s){return S.delete(`users/${s}/unban`).then(t=>t.data)}function Hd(){return I({mutationFn:s=>Zd(s),onSuccess:async s=>{M(d(`Impersonating User "${s.user.display_name}"`)),window.location.href="/"},onError:s=>q(s)})}function Zd(s){return S.post(`admin/users/impersonate/${s.userId}`,s).then(t=>t.data)}const Rn=[{key:"name",allowsSorting:!0,sortingKey:"email",width:"flex-3 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"User"}),body:s=>e.jsx(us,{image:s.avatar,label:s.display_name,description:s.email})},{key:"subscribed",header:()=>e.jsx(n,{message:"Subscribed"}),width:"w-96",body:s=>{var t;return(t=s.subscriptions)!=null&&t.length?e.jsx($t,{className:"text-positive icon-md"}):e.jsx($e,{className:"text-danger icon-md"})}},{key:"roles",header:()=>e.jsx(n,{message:"Roles"}),body:s=>{var t;return e.jsx(bc,{radius:"rounded",size:"xs",children:(t=s==null?void 0:s.roles)==null?void 0:t.map(a=>e.jsx(Rt,{selectable:!0,children:e.jsx(F,{className:w("capitalize"),target:"_blank",to:`/admin/roles/${a.id}/edit`,children:e.jsx(n,{message:a.name})})},a.id))})}},{key:"firstName",allowsSorting:!0,header:()=>e.jsx(n,{message:"First name"}),body:s=>s.first_name},{key:"lastName",allowsSorting:!0,header:()=>e.jsx(n,{message:"Last name"}),body:s=>s.last_name},{key:"createdAt",allowsSorting:!0,width:"w-96",header:()=>e.jsx(n,{message:"Created at"}),body:s=>e.jsx("time",{children:e.jsx(ne,{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(F,{to:`${s.id}/edit`,children:e.jsx(W,{label:e.jsx(n,{message:"Edit user"}),children:e.jsx(C,{size:"md",children:e.jsx(xe,{})})})}),s.banned_at?e.jsx(Kd,{user:s}):e.jsxs(A,{type:"modal",children:[e.jsx(W,{label:e.jsx(n,{message:"Suspend user"}),children:e.jsx(C,{size:"md",children:e.jsx(mi,{})})}),e.jsx(Od,{user:s})]}),e.jsx(Wd,{user:s})]})}];function Kd({user:s}){const t=Ud(s.id);return e.jsxs(A,{type:"modal",onClose:a=>{a&&t.mutate()},children:[e.jsx(W,{label:e.jsx(n,{message:"Remove suspension"}),children:e.jsx(C,{size:"md",color:"danger",children:e.jsx(mi,{})})}),e.jsx(ce,{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 Wd({user:s}){const t=Hd();return e.jsxs(A,{type:"modal",children:[e.jsx(W,{label:e.jsx(n,{message:"Login as user"}),children:e.jsx(C,{size:"md",children:e.jsx(ko,{})})}),e.jsx(ce,{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})}})]})}function Qd(){const{billing:s}=ue(),t=s.enable?Rn:Rn.filter(a=>a.key!=="subscribed");return e.jsx(m.Fragment,{children:e.jsx(he,{endpoint:"users",title:e.jsx(n,{message:"Users"}),filters:_d,columns:t,actions:e.jsx(Gd,{}),queryParams:{with:"subscriptions,bans"},selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:at,title:e.jsx(n,{message:"No users have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching users"})})})})}function Gd(){return e.jsxs(m.Fragment,{children:[e.jsx(ui,{endpoint:"users/csv/export"}),e.jsx(je,{elementType:F,to:"new",children:e.jsx(n,{message:"Add new user"})})]})}function xi(s,t){return s.reduce((a,r,i)=>{const l=Math.floor(i/t);return a[l]||(a[l]=[]),a[l].push(r),a},[])}const Jd={preview:{defaultRoute:"/",navigationRoutes:[]},sections:{general:{label:d("General"),position:1,buildBreadcrumb:()=>[{label:d("General"),location:"general"}]},themes:{label:d("Themes"),position:2,buildBreadcrumb:(s,t)=>{var l;const a=s.split("/").filter(o=>!!o),[,,,r]=a,i=[{label:d("Themes"),location:"themes"}];return r!=null&&i.push({label:(l=t.appearance.themes.all[+r])==null?void 0:l.name,location:`themes/${r}`}),a.at(-1)==="font"&&i.push({label:d("Font"),location:`themes/${r}/font`}),a.at(-1)==="radius"&&i.push({label:d("Rounding"),location:`themes/${r}/radius`}),i}},menus:{label:d("Menus"),position:3,buildBreadcrumb:(s,t)=>{const a=s.split("/").filter(o=>!!o),[,,...r]=a,i=[{label:d("Menus"),location:"menus"}],l=xi(r,2);return l.forEach(([o,c],u)=>{var x,g;if(o==="menus"&&c!=null)i.push({label:(x=t.settings.menus[+c])==null?void 0:x.name,location:`menus/${c}`});else if(o==="items"&&c!=null){const[,j]=l[u-1];i.push({label:(g=t.settings.menus[+j].items[+c])==null?void 0:g.label,location:`menus/${j}/${c}`})}}),i},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/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:d("Custom Code"),position:4,buildBreadcrumb:()=>[{label:d("Custom code"),location:"custom-code"}]},"seo-settings":{label:d("SEO Settings"),position:5,buildBreadcrumb:()=>[{label:d("SEO"),location:"seo"}]}}},ke=m.forwardRef(({startIcon:s,children:t,className:a,description:r,...i},l)=>e.jsxs(Vt,{ref:l,display:"flex",className:w("relative mb-10 h-54 w-full items-center gap-10 rounded-input border bg px-14 text-sm hover:bg-hover",a),variant:null,...i,children:[s,e.jsxs("span",{className:"block min-w-0",children:[e.jsx("span",{className:"block",children:t}),r&&e.jsx("span",{className:"block overflow-hidden overflow-ellipsis whitespace-nowrap text-xs text-muted",children:r})]}),e.jsx(ct,{"aria-hidden":!0,className:"ml-auto text-muted icon-sm"})]})),nn=T(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 Os(){return(Os=Object.assign||function(s){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])}return s}).apply(this,arguments)}function ea(s,t){if(s==null)return{};var a,r,i={},l=Object.keys(s);for(r=0;r<l.length;r++)t.indexOf(a=l[r])>=0||(i[a]=s[a]);return i}function nt(s){var t=m.useRef(s),a=m.useRef(function(r){t.current&&t.current(r)});return t.current=s,a.current}var rt=function(s,t,a){return t===void 0&&(t=0),a===void 0&&(a=1),s>a?a:s<t?t:s},Js=function(s){return"touches"in s},wa=function(s){return s&&s.ownerDocument.defaultView||self},Vn=function(s,t,a){var r=s.getBoundingClientRect(),i=Js(t)?function(l,o){for(var c=0;c<l.length;c++)if(l[c].identifier===o)return l[c];return l[0]}(t.touches,a):t;return{left:rt((i.pageX-(r.left+wa(s).pageXOffset))/r.width),top:rt((i.pageY-(r.top+wa(s).pageYOffset))/r.height)}},qn=function(s){!Js(s)&&s.preventDefault()},hi=B.memo(function(s){var t=s.onMove,a=s.onKey,r=ea(s,["onMove","onKey"]),i=m.useRef(null),l=nt(t),o=nt(a),c=m.useRef(null),u=m.useRef(!1),x=m.useMemo(function(){var f=function(L){qn(L),(Js(L)?L.touches.length>0:L.buttons>0)&&i.current?l(Vn(i.current,L,c.current)):y(!1)},N=function(){return y(!1)};function y(L){var k=u.current,E=wa(i.current),U=L?E.addEventListener:E.removeEventListener;U(k?"touchmove":"mousemove",f),U(k?"touchend":"mouseup",N)}return[function(L){var k=L.nativeEvent,E=i.current;if(E&&(qn(k),!function(Q,ae){return ae&&!Js(Q)}(k,u.current)&&E)){if(Js(k)){u.current=!0;var U=k.changedTouches||[];U.length&&(c.current=U[0].identifier)}E.focus(),l(Vn(E,k,c.current)),y(!0)}},function(L){var k=L.which||L.keyCode;k<37||k>40||(L.preventDefault(),o({left:k===39?.05:k===37?-.05:0,top:k===40?.05:k===38?-.05:0}))},y]},[o,l]),g=x[0],j=x[1],v=x[2];return m.useEffect(function(){return v},[v]),B.createElement("div",Os({},r,{onTouchStart:g,onMouseDown:g,className:"react-colorful__interactive",ref:i,onKeyDown:j,tabIndex:0,role:"slider"}))}),rn=function(s){return s.filter(Boolean).join(" ")},gi=function(s){var t=s.color,a=s.left,r=s.top,i=r===void 0?.5:r,l=rn(["react-colorful__pointer",s.className]);return B.createElement("div",{className:l,style:{top:100*i+"%",left:100*a+"%"}},B.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},pe=function(s,t,a){return t===void 0&&(t=0),a===void 0&&(a=Math.pow(10,t)),Math.round(a*s)/a},Yd=function(s){return au(Sa(s))},Sa=function(s){return s[0]==="#"&&(s=s.substring(1)),s.length<6?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?pe(parseInt(s[3]+s[3],16)/255,2):1}:{r:parseInt(s.substring(0,2),16),g:parseInt(s.substring(2,4),16),b:parseInt(s.substring(4,6),16),a:s.length===8?pe(parseInt(s.substring(6,8),16)/255,2):1}},Xd=function(s){return tu(su(s))},eu=function(s){var t=s.s,a=s.v,r=s.a,i=(200-t)*a/100;return{h:pe(s.h),s:pe(i>0&&i<200?t*a/100/(i<=100?i:200-i)*100:0),l:pe(i/2),a:pe(r,2)}},Na=function(s){var t=eu(s);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},su=function(s){var t=s.h,a=s.s,r=s.v,i=s.a;t=t/360*6,a/=100,r/=100;var l=Math.floor(t),o=r*(1-a),c=r*(1-(t-l)*a),u=r*(1-(1-t+l)*a),x=l%6;return{r:pe(255*[r,c,o,o,u,r][x]),g:pe(255*[u,r,r,c,o,o][x]),b:pe(255*[o,o,u,r,r,c][x]),a:pe(i,2)}},Nt=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},tu=function(s){var t=s.r,a=s.g,r=s.b,i=s.a,l=i<1?Nt(pe(255*i)):"";return"#"+Nt(t)+Nt(a)+Nt(r)+l},au=function(s){var t=s.r,a=s.g,r=s.b,i=s.a,l=Math.max(t,a,r),o=l-Math.min(t,a,r),c=o?l===t?(a-r)/o:l===a?2+(r-t)/o:4+(t-a)/o:0;return{h:pe(60*(c<0?c+6:c)),s:pe(l?o/l*100:0),v:pe(l/255*100),a:i}},nu=B.memo(function(s){var t=s.hue,a=s.onChange,r=rn(["react-colorful__hue",s.className]);return B.createElement("div",{className:r},B.createElement(hi,{onMove:function(i){a({h:360*i.left})},onKey:function(i){a({h:rt(t+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":pe(t),"aria-valuemax":"360","aria-valuemin":"0"},B.createElement(gi,{className:"react-colorful__hue-pointer",left:t/360,color:Na({h:t,s:100,v:100,a:1})})))}),ru=B.memo(function(s){var t=s.hsva,a=s.onChange,r={backgroundColor:Na({h:t.h,s:100,v:100,a:1})};return B.createElement("div",{className:"react-colorful__saturation",style:r},B.createElement(hi,{onMove:function(i){a({s:100*i.left,v:100-100*i.top})},onKey:function(i){a({s:rt(t.s+100*i.left,0,100),v:rt(t.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+pe(t.s)+"%, Brightness "+pe(t.v)+"%"},B.createElement(gi,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Na(t)})))}),pi=function(s,t){if(s===t)return!0;for(var a in s)if(s[a]!==t[a])return!1;return!0},iu=function(s,t){return s.toLowerCase()===t.toLowerCase()||pi(Sa(s),Sa(t))};function lu(s,t,a){var r=nt(a),i=m.useState(function(){return s.toHsva(t)}),l=i[0],o=i[1],c=m.useRef({color:t,hsva:l});m.useEffect(function(){if(!s.equal(t,c.current.color)){var x=s.toHsva(t);c.current={hsva:x,color:t},o(x)}},[t,s]),m.useEffect(function(){var x;pi(l,c.current.hsva)||s.equal(x=s.fromHsva(l),c.current.color)||(c.current={hsva:l,color:x},r(x))},[l,s,r]);var u=m.useCallback(function(x){o(function(g){return Object.assign({},g,x)})},[]);return[l,u]}var ou=typeof window<"u"?m.useLayoutEffect:m.useEffect,cu=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},On=new Map,du=function(s){ou(function(){var t=s.current?s.current.ownerDocument:document;if(t!==void 0&&!On.has(t)){var a=t.createElement("style");a.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,On.set(t,a);var r=cu();r&&a.setAttribute("nonce",r),t.head.appendChild(a)}},[])},uu=function(s){var t=s.className,a=s.colorModel,r=s.color,i=r===void 0?a.defaultColor:r,l=s.onChange,o=ea(s,["className","colorModel","color","onChange"]),c=m.useRef(null);du(c);var u=lu(a,i,l),x=u[0],g=u[1],j=rn(["react-colorful",t]);return B.createElement("div",Os({},o,{ref:c,className:j}),B.createElement(ru,{hsva:x,onChange:g}),B.createElement(nu,{hue:x.h,onChange:g,className:"react-colorful__last-control"}))},mu={defaultColor:"000",toHsva:Yd,fromHsva:function(s){return Xd({h:s.h,s:s.s,v:s.v,a:1})},equal:iu},xu=function(s){return B.createElement(uu,Os({},s,{colorModel:mu}))},hu=/^#?([0-9A-F]{3,8})$/i,gu=function(s){var t=s.color,a=t===void 0?"":t,r=s.onChange,i=s.onBlur,l=s.escape,o=s.validate,c=s.format,u=s.process,x=ea(s,["color","onChange","onBlur","escape","validate","format","process"]),g=m.useState(function(){return l(a)}),j=g[0],v=g[1],f=nt(r),N=nt(i),y=m.useCallback(function(k){var E=l(k.target.value);v(E),o(E)&&f(u?u(E):E)},[l,u,o,f]),L=m.useCallback(function(k){o(k.target.value)||v(l(a)),N(k)},[a,l,o,N]);return m.useEffect(function(){v(l(a))},[a,l]),B.createElement("input",Os({},x,{value:c?c(j):j,spellCheck:"false",onChange:y,onBlur:L}))},Un=function(s){return"#"+s},pu=function(s){var t=s.prefixed,a=s.alpha,r=ea(s,["prefixed","alpha"]),i=m.useCallback(function(o){return o.replace(/([^0-9A-F]+)/gi,"").substring(0,a?8:6)},[a]),l=m.useCallback(function(o){return function(c,u){var x=hu.exec(c),g=x?x[1].length:0;return g===3||g===6||!!u&&g===4||!!u&&g===8}(o,a)},[a]);return B.createElement(gu,Os({},r,{escape:i,format:t?Un:void 0,process:Un,validate:l}))};class ju{getStringForLocale(t,a){let r=this.strings[a];r||(r=fu(a,this.strings,this.defaultLocale),this.strings[a]=r);let i=r[t];if(!i)throw new Error(`Could not find intl message ${t} in ${a} locale`);return i}constructor(t,a="en-US"){this.strings={...t},this.defaultLocale=a}}function fu(s,t,a="en-US"){if(t[s])return t[s];let r=bu(s);if(t[r])return t[r];for(let i in t)if(i.startsWith(r+"-"))return t[i];return t[a]}function bu(s){return Intl.Locale?new Intl.Locale(s).language:s.split("-")[0]}function vu(s){return s&&s.__esModule?s.default:s}var ji={},fi={};fi={alpha:"ألفا",blue:"أزرق",brightness:"السطوع",green:"أخضر",hue:"درجة اللون",lightness:"الإضاءة",red:"أحمر",saturation:"التشبع"};var bi={};bi={alpha:"Алфа",blue:"Синьо",brightness:"Яркост",green:"Зелено",hue:"Оттенък",lightness:"Лекота",red:"Червено",saturation:"Наситеност"};var vi={};vi={alpha:"Alfa",blue:"Modrá",brightness:"Jas",green:"Zelená",hue:"Odstín",lightness:"Světlost",red:"Červená",saturation:"Sytost"};var yi={};yi={alpha:"Alfa",blue:"Blå",brightness:"Lysstyrke",green:"Grøn",hue:"Tone",lightness:"Lyshed",red:"Rød",saturation:"Farvemætning"};var Ci={};Ci={alpha:"Alpha",blue:"Blau",brightness:"Helligkeit",green:"Grün",hue:"Farbton",lightness:"Leuchtkraft",red:"Rot",saturation:"Sättigung"};var wi={};wi={alpha:"Άλφα",blue:"Μπλε",brightness:"Φωτεινότητα",green:"Πράσινο",hue:"Τόνος",lightness:"Φωτεινότητα",red:"Κόκκινο",saturation:"Κορεσμός"};var Si={};Si={hue:"Hue",saturation:"Saturation",lightness:"Lightness",brightness:"Brightness",red:"Red",green:"Green",blue:"Blue",alpha:"Alpha"};var Ni={};Ni={alpha:"Alpha",blue:"Azul",brightness:"Brillo",green:"Verde",hue:"Tono",lightness:"Luminosidad",red:"Rojo",saturation:"Saturación"};var ki={};ki={alpha:"Alfa",blue:"Sinine",brightness:"Heledus",green:"Roheline",hue:"Värv",lightness:"Valgus",red:"Punane",saturation:"Küllastus"};var Li={};Li={alpha:"Alpha",blue:"Sininen",brightness:"Kirkkaus",green:"Vihreä",hue:"Sävy",lightness:"Valomäärä",red:"Punainen",saturation:"Värikylläisyys"};var _i={};_i={alpha:"Alpha",blue:"Bleu",brightness:"Luminosité",green:"Vert",hue:"Teinte",lightness:"Luminosité",red:"Rouge",saturation:"Saturation"};var Mi={};Mi={alpha:"אלפא",blue:"כחול",brightness:"בהירות",green:"ירוק",hue:"גוון",lightness:"כמות אור",red:"אדום",saturation:"רוויה"};var Ii={};Ii={alpha:"Alfa",blue:"Plava",brightness:"Svjetlina",green:"Zelena",hue:"Nijansa",lightness:"Osvijetljenost",red:"Crvena",saturation:"Zasićenost"};var Fi={};Fi={alpha:"Alfa",blue:"Kék",brightness:"Fényesség",green:"Zöld",hue:"Színárnyalat",lightness:"Világosság",red:"Piros",saturation:"Telítettség"};var Pi={};Pi={alpha:"Alfa",blue:"Blu",brightness:"Luminosità",green:"Verde",hue:"Tonalità",lightness:"Luminosità",red:"Rosso",saturation:"Saturazione"};var Ti={};Ti={alpha:"アルファ",blue:"青",brightness:"明るさ",green:"緑",hue:"色相",lightness:"明度",red:"赤",saturation:"彩度"};var Ei={};Ei={alpha:"알파",blue:"파랑",brightness:"명도",green:"초록",hue:"색조",lightness:"밝기",red:"빨강",saturation:"채도"};var zi={};zi={alpha:"Alfa",blue:"Mėlyna",brightness:"Ryškumas",green:"Žalia",hue:"Atspalvis",lightness:"Šviesumas",red:"Raudona",saturation:"Įsotinimas"};var Di={};Di={alpha:"Alfa",blue:"Zila",brightness:"Spilgtums",green:"Zaļa",hue:"Nokrāsa",lightness:"Gaišums",red:"Sarkana",saturation:"Piesātinājums"};var Ai={};Ai={alpha:"Alfa",blue:"Blå",brightness:"Lysstyrke",green:"Grønn",hue:"Fargetone",lightness:"Lyshet",red:"Rød",saturation:"Metning"};var $i={};$i={alpha:"Alfa",blue:"Blauw",brightness:"Helderheid",green:"Groen",hue:"Kleurtoon",lightness:"Lichtsterkte",red:"Rood",saturation:"Verzadiging"};var Ri={};Ri={alpha:"Alfa",blue:"Niebieski",brightness:"Jasność",green:"Zielony",hue:"Odcień",lightness:"Jaskrawość",red:"Czerwony",saturation:"Nasycenie"};var Vi={};Vi={alpha:"Alfa",blue:"Azul",brightness:"Brilho",green:"Verde",hue:"Matiz",lightness:"Luminosidade",red:"Vermelho",saturation:"Saturação"};var qi={};qi={alpha:"Alfa",blue:"Azul",brightness:"Luminosidade",green:"Verde",hue:"Tonalidade",lightness:"Claridade",red:"Vermelho",saturation:"Saturação"};var Oi={};Oi={alpha:"Alfa",blue:"Albastru",brightness:"Luminozitate",green:"Verde",hue:"Nuanță",lightness:"Luminozitate",red:"Roșu",saturation:"Saturație"};var Ui={};Ui={alpha:"Альфа",blue:"Синий",brightness:"Яркость",green:"Зеленый",hue:"Оттенок",lightness:"Освещенность",red:"Красный",saturation:"Насыщенность"};var Bi={};Bi={alpha:"Alfa",blue:"Modrá",brightness:"Jas",green:"Zelená",hue:"Odtieň",lightness:"Svetlosť",red:"Červená",saturation:"Sýtosť"};var Hi={};Hi={alpha:"Alfa",blue:"Modra",brightness:"Svetlost",green:"Zelena",hue:"Barva",lightness:"Lahkost",red:"Rdeča",saturation:"Nasičenost"};var Zi={};Zi={alpha:"Alfa",blue:"Plava",brightness:"Osvetljenost",green:"Zelena",hue:"Nijansa",lightness:"Osvetljenje",red:"Crvena",saturation:"Zasićenje"};var Ki={};Ki={alpha:"Alfa",blue:"Blått",brightness:"Ljusstyrka",green:"Grönt",hue:"Nyans",lightness:"Ljushet",red:"Rött",saturation:"Mättnad"};var Wi={};Wi={alpha:"Alfa",blue:"Mavi",brightness:"Parlaklık",green:"Yeşil",hue:"Ton",lightness:"Canlılık",red:"Kırmızı",saturation:"Doygunluk"};var Qi={};Qi={alpha:"Альфа",blue:"Синій",brightness:"Яскравість",green:"Зелений",hue:"Тон",lightness:"Освітленість",red:"Червоний",saturation:"Насиченість"};var Gi={};Gi={alpha:"Alpha",blue:"蓝色",brightness:"亮度",green:"绿色",hue:"色相",lightness:"明亮度",red:"红色",saturation:"饱和度"};var Ji={};Ji={alpha:"Alpha",blue:"藍色",brightness:"亮度",green:"綠色",hue:"色相",lightness:"明亮",red:"紅色",saturation:"飽和度"};ji={"ar-AE":fi,"bg-BG":bi,"cs-CZ":vi,"da-DK":yi,"de-DE":Ci,"el-GR":wi,"en-US":Si,"es-ES":Ni,"et-EE":ki,"fi-FI":Li,"fr-FR":_i,"he-IL":Mi,"hr-HR":Ii,"hu-HU":Fi,"it-IT":Pi,"ja-JP":Ti,"ko-KR":Ei,"lt-LT":zi,"lv-LV":Di,"nb-NO":Ai,"nl-NL":$i,"pl-PL":Ri,"pt-BR":Vi,"pt-PT":qi,"ro-RO":Oi,"ru-RU":Ui,"sk-SK":Bi,"sl-SI":Hi,"sr-SP":Zi,"sv-SE":Ki,"tr-TR":Wi,"uk-UA":Qi,"zh-CN":Gi,"zh-TW":Ji};const yu=new ju(vu(ji));function Is(s){let t=xs.parse(s)||hs.parse(s)||gs.parse(s);if(t)return t;throw new Error("Invalid color value: "+s)}class ln{toHexInt(){return this.toFormat("rgb").toHexInt()}getChannelValue(t){if(t in this)return this[t];throw new Error("Unsupported color channel: "+t)}withChannelValue(t,a){if(t in this){let r=this.clone();return r[t]=a,r}throw new Error("Unsupported color channel: "+t)}getChannelName(t,a){return yu.getStringForLocale(t,a)}getColorSpaceAxes(t){let{xChannel:a,yChannel:r}=t,i=a||this.getColorChannels().find(c=>c!==r),l=r||this.getColorChannels().find(c=>c!==i),o=this.getColorChannels().find(c=>c!==i&&c!==l);return{xChannel:i,yChannel:l,zChannel:o}}}class xs extends ln{static parse(t){let a=[];if(/^#[\da-f]+$/i.test(t)&&[4,5,7,9].includes(t.length)){const l=(t.length<6?t.replace(/[^#]/gi,"$&$&"):t).slice(1).split("");for(;l.length>0;)a.push(parseInt(l.splice(0,2).join(""),16));a[3]=a[3]!==void 0?a[3]/255:void 0}const r=t.match(/^rgba?\((.*)\)$/);r!=null&&r[1]&&(a=r[1].split(",").map(l=>Number(l.trim())),a=a.map((l,o)=>Ns(l,0,o<3?255:1)));var i;return a.length<3?void 0:new xs(a[0],a[1],a[2],(i=a[3])!==null&&i!==void 0?i:1)}toString(t){switch(t){case"hex":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")).toUpperCase();case"hexa":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")+Math.round(this.alpha*255).toString(16).padStart(2,"0")).toUpperCase();case"rgb":return`rgb(${this.red}, ${this.green}, ${this.blue})`;case"css":case"rgba":return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"hex":case"hexa":case"rgb":case"rgba":return this;case"hsb":case"hsba":return this.toHSB();case"hsl":case"hsla":return this.toHSL();default:throw new Error("Unsupported color conversion: rgb -> "+t)}}toHexInt(){return this.red<<16|this.green<<8|this.blue}toHSB(){const t=this.red/255,a=this.green/255,r=this.blue/255,i=Math.min(t,a,r),l=Math.max(t,a,r),o=l-i,c=l===0?0:o/l;let u=0;if(o!==0){switch(l){case t:u=(a-r)/o+(a<r?6:0);break;case a:u=(r-t)/o+2;break;case r:u=(t-a)/o+4;break}u/=6}return new hs(de(u*360,2),de(c*100,2),de(l*100,2),this.alpha)}toHSL(){const t=this.red/255,a=this.green/255,r=this.blue/255,i=Math.min(t,a,r),l=Math.max(t,a,r),o=(l+i)/2,c=l-i;let u,x;if(c===0)u=x=0;else{switch(x=c/(o<.5?l+i:2-l-i),l){case t:u=(a-r)/c+(a<r?6:0);break;case a:u=(r-t)/c+2;break;case r:u=(t-a)/c+4;break}u/=6}return new gs(de(u*360,2),de(x*100,2),de(o*100,2),this.alpha)}clone(){return new xs(this.red,this.green,this.blue,this.alpha)}getChannelRange(t){switch(t){case"red":case"green":case"blue":return{minValue:0,maxValue:255,step:1,pageSize:17};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,a){let r,i=this.getChannelValue(t);switch(t){case"red":case"green":case"blue":r={style:"decimal"};break;case"alpha":r={style:"percent"};break;default:throw new Error("Unknown color channel: "+t)}return new Pa(a,r).format(i)}getColorSpace(){return"rgb"}getColorChannels(){return xs.colorChannels}constructor(t,a,r,i){super(),this.red=t,this.green=a,this.blue=r,this.alpha=i}}xs.colorChannels=["red","green","blue"];const Cu=/hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;class hs extends ln{static parse(t){let a;if(a=t.match(Cu)){var r;const[i,l,o,c]=((r=a[1])!==null&&r!==void 0?r:a[2]).split(",").map(u=>Number(u.trim().replace("%","")));return new hs(Yi(i,360),Ns(l,0,100),Ns(o,0,100),Ns(c??1,0,1))}}toString(t){switch(t){case"css":return this.toHSL().toString("css");case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsb":return`hsb(${this.hue}, ${de(this.saturation,2)}%, ${de(this.brightness,2)}%)`;case"hsba":return`hsba(${this.hue}, ${de(this.saturation,2)}%, ${de(this.brightness,2)}%, ${this.alpha})`;default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"hsb":case"hsba":return this;case"hsl":case"hsla":return this.toHSL();case"rgb":case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsb -> "+t)}}toHSL(){let t=this.saturation/100,a=this.brightness/100,r=a*(1-t/2);return t=r===0||r===1?0:(a-r)/Math.min(r,1-r),new gs(de(this.hue,2),de(t*100,2),de(r*100,2),this.alpha)}toRGB(){let t=this.hue,a=this.saturation/100,r=this.brightness/100,i=(l,o=(l+t/60)%6)=>r-a*r*Math.max(Math.min(o,4-o,1),0);return new xs(Math.round(i(5)*255),Math.round(i(3)*255),Math.round(i(1)*255),this.alpha)}clone(){return new hs(this.hue,this.saturation,this.brightness,this.alpha)}getChannelRange(t){switch(t){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"brightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,a){let r,i=this.getChannelValue(t);switch(t){case"hue":r={style:"unit",unit:"degree",unitDisplay:"narrow"};break;case"saturation":case"brightness":r={style:"percent"},i/=100;break;case"alpha":r={style:"percent"};break;default:throw new Error("Unknown color channel: "+t)}return new Pa(a,r).format(i)}getColorSpace(){return"hsb"}getColorChannels(){return hs.colorChannels}constructor(t,a,r,i){super(),this.hue=t,this.saturation=a,this.brightness=r,this.alpha=i}}hs.colorChannels=["hue","saturation","brightness"];const wu=/hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;function Yi(s,t){return(s%t+t)%t}class gs extends ln{static parse(t){let a;if(a=t.match(wu)){var r;const[i,l,o,c]=((r=a[1])!==null&&r!==void 0?r:a[2]).split(",").map(u=>Number(u.trim().replace("%","")));return new gs(Yi(i,360),Ns(l,0,100),Ns(o,0,100),Ns(c??1,0,1))}}toString(t){switch(t){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${de(this.saturation,2)}%, ${de(this.lightness,2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${de(this.saturation,2)}%, ${de(this.lightness,2)}%, ${this.alpha})`;default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"hsl":case"hsla":return this;case"hsb":case"hsba":return this.toHSB();case"rgb":case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsl -> "+t)}}toHSB(){let t=this.saturation/100,a=this.lightness/100,r=a+t*Math.min(a,1-a);return t=r===0?0:2*(1-a/r),new hs(de(this.hue,2),de(t*100,2),de(r*100,2),this.alpha)}toRGB(){let t=this.hue,a=this.saturation/100,r=this.lightness/100,i=a*Math.min(r,1-r),l=(o,c=(o+t/30)%12)=>r-i*Math.max(Math.min(c-3,9-c,1),-1);return new xs(Math.round(l(0)*255),Math.round(l(8)*255),Math.round(l(4)*255),this.alpha)}clone(){return new gs(this.hue,this.saturation,this.lightness,this.alpha)}getChannelRange(t){switch(t){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"lightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,a){let r,i=this.getChannelValue(t);switch(t){case"hue":r={style:"unit",unit:"degree",unitDisplay:"narrow"};break;case"saturation":case"lightness":r={style:"percent"},i/=100;break;case"alpha":r={style:"percent"};break;default:throw new Error("Unknown color channel: "+t)}return new Pa(a,r).format(i)}getColorSpace(){return"hsl"}getColorChannels(){return gs.colorChannels}constructor(t,a,r,i){super(),this.hue=t,this.saturation=a,this.lightness=r,this.alpha=i}}gs.colorChannels=["hue","saturation","lightness"];Is("#ffffff");Is("hsl(0, 100%, 50%)");const Su=Is("#000000"),Nu=Is("#FFFFFF");Su.toHexInt();Nu.toHexInt();function ku({onChange:s,value:t,colors:a}){const r=a.map(i=>{const l=t===i;return e.jsx(Vt,{onClick:()=>{s==null||s(i)},className:w("relative block flex-shrink-0 w-26 h-26 border rounded",l&&"shadow-md"),style:{backgroundColor:i},children:l&&e.jsx("span",{className:"absolute inset-0 m-auto rounded-full w-8 h-8 bg-white"})},i)});return e.jsx("div",{className:"flex flex-wrap gap-6",children:r})}const Lu=[{color:"rgb(255, 255, 255)",name:d("White")},{color:"rgb(239,245,245)",name:d("Solitude")},{color:"rgb(245,213,174)",name:d("Wheat")},{color:"rgb(253,227,167)",name:d("Cape Honey")},{color:"rgb(242,222,186)",name:d("Milk punch")},{color:"rgb(97,118,75)",name:d("Dingy"),foreground:"rgb(255, 255, 255)"},{color:"rgb(4, 147, 114)",name:d("Aquamarine"),foreground:"rgb(255, 255, 255)"},{color:"rgb(222,245,229)",name:d("Cosmic Latte")},{color:"rgb(233,119,119)",name:d("Geraldine"),foreground:"rgb(90,14,14)"},{color:"rgb(247,164,164)",name:d("Sundown")},{color:"rgb(30,139,195)",name:d("Pelorous"),foreground:"rgb(255, 255, 255)"},{color:"rgb(142,68,173)",name:d("Deep Lilac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(108,74,182)",name:d("Blue marguerite"),foreground:"rgb(255, 255, 255)"},{color:"rgb(139,126,116)",name:d("Americano"),foreground:"rgb(255, 255, 255)"},{color:"rgb(0,0,0)",name:d("Black"),foreground:"rgb(255, 255, 255)"},{color:"rgb(64,66,88)",name:d("Blue zodiac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(101,100,124)",name:d("Comet"),foreground:"rgb(255, 255, 255)"}],_u=Lu.map(({color:s})=>s).slice(0,14);function Mu({defaultValue:s,onChange:t,colorPresets:a,showInput:r}){const[i,l]=m.useState(s),o=a||_u,c=Ta({size:"sm"});return e.jsxs("div",{children:[e.jsx(xu,{className:"!w-auto",color:i,onChange:u=>{t==null||t(u),l(u)}}),e.jsxs("div",{className:"py-20 px-12",children:[o&&e.jsx(ku,{colors:o,onChange:u=>{if(u){const x=Is(u).toString("hex");t==null||t(x),l(x)}},value:i}),r&&e.jsx("div",{className:"pt-20",children:e.jsx(pu,{autoComplete:"off",role:"textbox",autoCorrect:"off",spellCheck:"false",required:!0,"aria-label":"Hex color",prefixed:!0,className:c.input,color:i,onChange:u=>{t==null||t(u),l(u)}})})]})]})}function on({hideFooter:s=!1,showInput:t=!0}){const{close:a,value:r,setValue:i,initialValue:l}=K();return e.jsxs(G,{size:"2xs",children:[e.jsx(Mu,{showInput:t,defaultValue:l||"",onChange:o=>i(o)}),!s&&e.jsxs(re,{dividerTop:!0,children:[e.jsx(b,{variant:"text",size:"xs",onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",size:"xs",onClick:()=>a(r),children:e.jsx(n,{message:"Apply"})})]})]})}function Iu(){return e.jsxs(m.Fragment,{children:[e.jsx(Fu,{}),e.jsxs("div",{className:"my-24 border-y py-24",children:[e.jsx(ke,{to:"action-buttons",elementType:F,className:"mb-20",children:e.jsx(n,{message:"Action buttons"})}),e.jsx(ke,{to:"primary-features",elementType:F,children:e.jsx(n,{message:"Primary features"})}),e.jsx(ke,{to:"secondary-features",elementType:F,children:e.jsx(n,{message:"Secondary features"})})]}),e.jsx(Pu,{}),e.jsx(Tu,{})]})}function Fu(){const s=Fs(t=>{var a,r,i;return(i=(r=(a=t.defaults)==null?void 0:a.settings.homepage)==null?void 0:r.appearance)==null?void 0:i.headerImage});return e.jsxs(m.Fragment,{children:[e.jsx(p,{label:e.jsx(n,{message:"Header title"}),className:"mb-20",name:"settings.homepage.appearance.headerTitle",onFocus:()=>{Z().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.appearance.headerSubtitle",onFocus:()=>{Z().preview.setHighlight('[data-testid="headerSubtitle"]')}}),e.jsx(Le,{name:"settings.homepage.appearance.headerImage",className:"mb-30",label:e.jsx(n,{message:"Header image"}),defaultValue:s,diskPrefix:"homepage"}),e.jsx($,{className:"mb-24",name:"settings.homepage.appearance.blurHeaderImage",children:e.jsx(n,{message:"Blur header image"})}),e.jsx(vc,{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(Bn,{formKey:"settings.homepage.appearance.headerOverlayColor1",label:e.jsx(n,{message:"Header overlay color 1"})}),e.jsx(Bn,{formKey:"settings.homepage.appearance.headerOverlayColor2",label:e.jsx(n,{message:"Header overlay color 2"})})]})}function Pu(){const s=Fs(t=>{var a,r,i;return(i=(r=(a=t.defaults)==null?void 0:a.settings.homepage)==null?void 0:r.appearance)==null?void 0:i.footerImage});return e.jsxs(m.Fragment,{children:[e.jsx($,{className:"mb-24",name:"settings.homepage.trending",children:e.jsx(n,{message:"Show trending titles"})}),e.jsx(p,{label:e.jsx(n,{message:"Footer title"}),className:"mb-20",name:"settings.homepage.appearance.footerTitle",onFocus:()=>{Z().preview.setHighlight('[data-testid="footerTitle"]')}}),e.jsx(p,{label:e.jsx(n,{message:"Footer subtitle"}),className:"mb-20",name:"settings.homepage.appearance.footerSubtitle",onFocus:()=>{Z().preview.setHighlight('[data-testid="footerSubtitle"]')}}),e.jsx(Le,{name:"settings.homepage.appearance.footerImage",className:"mb-30",label:e.jsx(n,{message:"Footer background image"}),defaultValue:s,diskPrefix:"homepage"})]})}function Tu(){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:()=>{Z().preview.setHighlight('[data-testid="pricingTitle"]')}}),e.jsx(p,{label:e.jsx(n,{message:"Pricing subtitle"}),className:"mb-20",name:"settings.homepage.appearance.pricingSubtitle",onFocus:()=>{Z().preview.setHighlight('[data-testid="pricingSubtitle"]')}}),e.jsx($,{className:"mb-24",name:"settings.homepage.pricing",children:e.jsx(n,{message:"Show pricing table"})})]})}function Bn({label:s,formKey:t}){const a=t,{watch:r,setValue:i}=P(),l=r(a),o=c=>{i(t,c,{shouldDirty:!0})};return e.jsxs(A,{value:l,onValueChange:c=>o(c),type:"popover",onClose:c=>o(c),children:[e.jsx(ke,{className:"capitalize",startIcon:e.jsx(nn,{viewBox:"0 0 48 48",className:"icon-lg",style:{fill:l}}),children:s}),e.jsx(on,{})]})}function Xi(s){return s&&s.charAt(0).toUpperCase()+s.slice(1)}const Eu=B.forwardRef(({valueListKey:s="permissions",...t},a)=>{const{data:r}=le([s]),i=(r==null?void 0:r.permissions)||(r==null?void 0:r.workspacePermissions),[l,o]=Xs(t.value,[],t.onChange),[c,u]=m.useState(!1);if(!i)return null;const x=el(i,l,c),g=j=>{const v=[...l],f=v.findIndex(N=>N.id===j.id);f>-1&&v.splice(f,1,j),o(v)};return e.jsxs(m.Fragment,{children:[e.jsx(Cs,{variant:"outline",ref:a,children:x.map(({groupName:j,items:v,anyChecked:f})=>e.jsx(Ce,{label:e.jsx(n,{message:dn(j)}),startIcon:f?e.jsx(Lo,{size:"sm"}):void 0,children:e.jsx(br,{children:v.map(N=>{const y=l.findIndex(k=>k.id===N.id),L=y>-1;return e.jsxs("div",{children:[e.jsx(vr,{onSelected:()=>{if(L){const k=[...l];k.splice(y,1),o(k)}else o([...l,N])},endSection:e.jsx(ya,{tabIndex:-1,checked:L,onChange:()=>{}}),description:e.jsx(n,{message:N.description}),children:e.jsx(n,{message:N.display_name||N.name})}),L&&e.jsx(zu,{permission:N,onChange:g})]},N.id)})})},j))}),e.jsx(ya,{className:"mt-30",checked:c,onChange:j=>{u(j.target.checked)},children:e.jsx(n,{message:"Show advanced permissions"})})]})});function zu({permission:s,onChange:t}){var r;if(!((r=s==null?void 0:s.restrictions)!=null&&r.length))return null;const a=(i,l)=>{const o=_o(s,c=>{const u=c.restrictions.find(x=>x.name===i);u&&(u.value=l)});t==null||t(o)};return e.jsx("div",{className:"px-40 py-20",children:s.restrictions.map((i,l)=>{const o=l===s.restrictions.length-1,c=e.jsx(n,{message:dn(i.name)}),u=i.description?e.jsx(n,{message:i.description}):void 0;return i.type==="bool"?e.jsx(ya,{description:u,className:w(!o&&"mb-30"),checked:!!i.value,onChange:x=>{a(i.name,x.target.checked)},children:c},i.name):e.jsx(Be,{size:"sm",label:c,description:u,type:"number",className:w(!o&&"mb-30"),value:i.value||"",onChange:x=>{a(i.name,x.target.value===""?void 0:parseInt(x.target.value))}},i.name)})})}function cn(s){const{field:{onChange:t,value:a=[],ref:r}}=ps({name:s.name}),i={onChange:t,value:a};return e.jsx(Eu,{ref:r,...js(i,s)})}const dn=s=>Xi(s.replace("_"," "));function el(s,t,a){const r=[];return s.forEach(i=>{const l=t.findIndex(c=>c.id===i.id);if(!a&&i.advanced)return;let o=r.find(c=>c.groupName===i.group);if(o||(o={groupName:i.group,anyChecked:!1,items:[]},r.push(o)),l>-1){const c={...i,restrictions:Du(i.restrictions,t[l].restrictions)};o.anyChecked=!0,o.items.push(c)}else o.items.push(i)}),r}function Du(s,t){return s==null?void 0:s.map(a=>{const r=t.find(i=>i.name===a.name);return r?{...a,value:r.value}:a})}function sl(){const s=un.sections.menus.config;return s?s.availableRoutes.map(t=>({id:t,label:t,action:t,type:"route",target:"_self"})):[]}const ca={grid:"flex flex-wrap gap-24",button:"flex flex-col items-center rounded hover:bg-hover h-90 aspect-square"},Au=[...Array(60).keys()],$u=B.lazy(()=>fs(()=>import("./icon-list-f2f41e27.js"),["./icon-list-f2f41e27.js","./main-239552ae.js","./main-3987dbef.css","./user-profile-link-0c8224d9.js","./OpenInNew-32d7773a.js","./BookmarkBorder-469fad29.js","./CalendarToday-7e762aef.js","./TaskAlt-50ceef7c.js","./section-helper-79a95256.js"],import.meta.url));function Ru({onIconSelected:s}){const{trans:t}=z(),[a,r]=B.useState("");return e.jsxs("div",{className:"py-4",children:[e.jsx(Be,{className:"mb-20",value:a,onChange:i=>{r(i.target.value)},placeholder:t({message:"Search icons..."})}),e.jsx(Oe,{mode:"wait",children:e.jsx(m.Suspense,{fallback:e.jsx(De.div,{...Je,className:ca.grid,children:Au.map((i,l)=>e.jsx("div",{className:ca.button,children:e.jsx(ls,{variant:"rect"})},l))}),children:e.jsx(De.div,{...Je,className:ca.grid,children:e.jsx($u,{searchQuery:a,onIconSelected:s})})})})]})}function Vu(){return e.jsxs(G,{size:"w-850",className:"min-h-dialog",children:[e.jsx(se,{children:e.jsx(n,{message:"Select icon"})}),e.jsx(X,{children:e.jsx(qu,{})})]})}function qu(){const{close:s}=K();return e.jsx(Ru,{onIconSelected:t=>{s(t)}})}function Ds({formPathPrefix:s,hideRoleAndPermissionFields:t}){const{trans:a}=z(),r=i=>s?`${s}.${i}`:i;return e.jsxs(m.Fragment,{children:[e.jsx(p,{className:"mb-20",name:r("label"),label:e.jsx(n,{message:"Label"}),placeholder:a(d("No label...")),startAppend:e.jsx(Ou,{prefixName:r})}),e.jsx(Uu,{prefixName:r}),!t&&e.jsxs(m.Fragment,{children:[e.jsx(Bu,{prefixName:r}),e.jsx(Hu,{prefixName:r})]}),e.jsx(Zu,{prefixName:r})]})}function Ou({prefixName:s,...t}){const{watch:a,setValue:r}=P(),i=s("icon"),l=a(i),o=l&&Ea(l);return e.jsxs(A,{type:"modal",onClose:c=>{(c||c===null)&&r(i,c,{shouldDirty:!0})},children:[e.jsx(C,{className:"text-muted icon-sm",variant:"outline",size:"md",...t,children:o?e.jsx(o,{}):e.jsx(xe,{})}),e.jsx(Vu,{})]})}function Uu({prefixName:s}){const t=P(),a=t.watch(s("type")),r=yc(a),{data:i}=le(["menuItemCategories"]),l=(i==null?void 0:i.menuItemCategories)||[],o=l.find(x=>x.type===a),{trans:c}=z(),u=sl();return m.useEffect(()=>{r&&r!==a&&t.setValue(s("action"),"")},[a,r,t,s]),e.jsxs(m.Fragment,{children:[e.jsxs(D,{className:"mb-20",name:s("type"),selectionMode:"single",label:e.jsx(n,{message:"Type"}),children:[e.jsx(h,{value:"link",children:e.jsx(n,{message:"Custom link"})}),e.jsx(h,{value:"route",children:e.jsx(n,{message:"Site page"})}),l.map(x=>e.jsx(h,{value:x.type,children:x.name},x.type))]}),a==="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"})}),a==="route"&&e.jsx(D,{className:"mb-20",required:!0,items:u,name:s("action"),label:e.jsx(n,{message:"Page"}),searchPlaceholder:c(d("Search pages")),showSearchField:!0,selectionMode:"single",children:x=>e.jsx(h,{value:x.id,children:x.label},x.id)}),o&&e.jsx(D,{className:"mb-20",required:!0,items:o.items,name:s("action"),showSearchField:!0,searchPlaceholder:c(d("Search...")),selectionMode:"single",label:e.jsx(n,{message:o.name}),children:x=>e.jsx(h,{value:x.action,children:e.jsx(n,{message:x.label})})})]})}function Bu({prefixName:s}){const{data:t}=le(["roles","permissions"]),a=(t==null?void 0:t.roles)||[],{trans:r}=z();return e.jsx(Vs,{className:"mb-20",placeholder:r({message:"Add role..."}),label:e.jsx(n,{message:"Only show if user has role"}),name:s("roles"),chipSize:"sm",suggestions:a,valueKey:"id",displayWith:i=>{var l;return(l=a.find(o=>o.id===i.id))==null?void 0:l.name},children:i=>e.jsx(h,{value:i.id,capitalizeFirst:!0,children:e.jsx(n,{message:i.name})},i.id)})}function Hu({prefixName:s}){const{data:t}=le(["roles","permissions"]),{trans:a}=z(),r=m.useMemo(()=>el((t==null?void 0:t.permissions)||[],[],!1),[t==null?void 0:t.permissions]);return e.jsx(Vs,{label:e.jsx(n,{message:"Only show if user has permissions"}),placeholder:a({message:"Add permission..."}),chipSize:"sm",suggestions:r,name:s("permissions"),valueKey:"name",children:({groupName:i,items:l})=>e.jsx(yr,{label:dn(i),children:l.map(o=>e.jsx(h,{value:o.name,description:e.jsx(n,{message:o.description}),children:e.jsx(n,{message:o.display_name||o.name})},o.name))},i)})}function Zu({prefixName:s}){return e.jsxs(D,{className:"mt-20",selectionMode:"single",name:s("target"),label:e.jsx(n,{message:"Open link in"}),children:[e.jsx(h,{value:"_self",children:e.jsx(n,{message:"Same window"})}),e.jsx(h,{value:"_blank",children:e.jsx(n,{message:"New window"})})]})}function Ku(){const[s,t]=m.useState(["cta1"]);return e.jsxs(Cs,{variant:"outline",expandedValues:s,onExpandedChange:a=>{t(a),a.length&&Z().preview.setHighlight(`[data-testid="${a[0]}"]`)},children:[e.jsx(Ce,{value:"cta1",label:e.jsx(n,{message:"Header button 1"}),children:e.jsx(Ds,{formPathPrefix:"settings.homepage.appearance.actions.cta1"})}),e.jsx(Ce,{value:"ct2",label:e.jsx(n,{message:"Header button 2"}),children:e.jsx(Ds,{formPathPrefix:"settings.homepage.appearance.actions.cta2"})}),e.jsx(Ce,{value:"cta3",label:e.jsx(n,{message:"Footer button"}),children:e.jsx(Ds,{formPathPrefix:"settings.homepage.appearance.actions.cta3"})})]})}function Wu(){const{fields:s,remove:t,append:a}=Re({name:"settings.homepage.appearance.primaryFeatures"}),[r,i]=m.useState([0]);return e.jsxs("div",{children:[e.jsx(Cs,{variant:"outline",expandedValues:r,onExpandedChange:l=>{i(l),l.length&&Z().preview.setHighlight(`[data-testid="primary-root-${l[0]}"]`)},children:s.map((l,o)=>e.jsxs(Ce,{value:o,label:e.jsx(n,{message:`Primary feature ${o+1}`}),children:[e.jsx(Qu,{index:o}),e.jsx("div",{className:"text-right",children:e.jsx(b,{size:"xs",variant:"outline",color:"danger",onClick:()=>{t(o)},children:e.jsx(n,{message:"Remove"})})})]},l.id))}),e.jsx("div",{className:"mt-20 text-right",children:e.jsx(b,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(me,{}),onClick:()=>{a({}),i([s.length])},children:e.jsx(n,{message:"Add feature"})})})]})}function Qu({index:s}){const t=Fs(a=>{var r,i,l,o,c;return(c=(o=(l=(i=(r=a.defaults)==null?void 0:r.settings.homepage)==null?void 0:i.appearance)==null?void 0:l.primaryFeatures)==null?void 0:o[s])==null?void 0:c.image});return e.jsxs(e.Fragment,{children:[e.jsx(Le,{name:`settings.homepage.appearance.primaryFeatures.${s}.image`,className:"mb-30",label:e.jsx(n,{message:"Image"}),defaultValue:t,diskPrefix:"homepage"}),e.jsx(p,{name:`settings.homepage.appearance.primaryFeatures.${s}.title`,label:e.jsx(n,{message:"Title"}),className:"mb-20",onFocus:()=>{Z().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:()=>{Z().preview.setHighlight(`[data-testid="primary-subtitle-${s}"]`)}})]})}function Gu(){const{fields:s,remove:t,append:a}=Re({name:"settings.homepage.appearance.secondaryFeatures"}),[r,i]=m.useState([0]);return e.jsxs("div",{children:[e.jsx(Cs,{variant:"outline",expandedValues:r,onExpandedChange:l=>{i(l),l.length&&Z().preview.setHighlight(`[data-testid="secondary-root-${l[0]}"]`)},children:s.map((l,o)=>e.jsxs(Ce,{value:o,label:e.jsx(n,{message:`Secondary feature ${o+1}`}),children:[e.jsx(Ju,{index:o}),e.jsx("div",{className:"text-right",children:e.jsx(b,{size:"xs",variant:"outline",color:"danger",onClick:()=>{t(o)},children:e.jsx(n,{message:"Remove"})})})]},l.id))}),e.jsx("div",{className:"mt-20 text-right",children:e.jsx(b,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(me,{}),onClick:()=>{a({}),i([s.length])},children:e.jsx(n,{message:"Add feature"})})})]})}function Ju({index:s}){return e.jsxs(e.Fragment,{children:[e.jsx(Le,{name:`settings.homepage.appearance.secondaryFeatures.${s}.image`,className:"mb-30",label:e.jsx(n,{message:"Image"}),defaultValue:Yu(s),diskPrefix:"homepage"}),e.jsx(p,{name:`settings.homepage.appearance.secondaryFeatures.${s}.title`,label:e.jsx(n,{message:"Title"}),className:"mb-20",onFocus:()=>{Z().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:()=>{Z().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:()=>{Z().preview.setHighlight(`[data-testid="secondary-description-${s}"]`)}})]})}function Yu(s){var t,a,r;return(r=(a=(t=Z().defaults)==null?void 0:t.settings.homepage)==null?void 0:a.appearance.secondaryFeatures[s])==null?void 0:r.image}const tl={preview:{defaultRoute:"dashboard",navigationRoutes:["dashboard"]},sections:{"landing-page":{label:d("Landing Page"),position:1,previewRoute:"/",routes:[{path:"landing-page",element:e.jsx(Iu,{})},{path:"landing-page/action-buttons",element:e.jsx(Ku,{})},{path:"landing-page/primary-features",element:e.jsx(Wu,{})},{path:"landing-page/secondary-features",element:e.jsx(Gu,{})}],buildBreadcrumb:s=>{const a=s.split("/").filter(i=>!!i).pop(),r=[{label:d("Landing page"),location:"landing-page"}];return a==="action-buttons"&&r.push({label:d("Action buttons"),location:"landing-page/action-buttons"}),a==="primary-features"&&r.push({label:d("Primary features"),location:"landing-page/primary-features"}),a==="secondary-features"&&r.push({label:d("Secondary features"),location:"landing-page/secondary-features"}),r}},menus:{config:{positions:["sidebar-primary","sidebar-secondary","mobile-bottom","landing-page-navbar","landing-page-footer"],availableRoutes:["/lists","/watchlist","/admin/channels","/admin/comments"]}},"seo-settings":{config:{pages:[{key:"title-page",label:d("Title page")},{key:"season-page",label:d("Season page")},{key:"episode-page",label:d("Episode page")},{key:"watch-page",label:d("Watch page")},{key:"person-page",label:d("Person page")},{key:"landing-page",label:d("Landing page")},{key:"news-article-page",label:d("News article page")},{key:"channel-page",label:d("Channel page")}]}}}},un=Mo.all([Jd,tl]),Fs=Io()(Cc(Fo((s,t)=>({defaults:null,iframeWindow:null,config:un,setDefaults:a=>{s(r=>{r.defaults={...a}})},setIframeWindow:a=>{s(()=>({iframeWindow:a}))},preview:{navigate:a=>{var o;const r=(o=t().config)==null?void 0:o.sections[a],i=(r==null?void 0:r.previewRoute)||"/",l=t().iframeWindow;i&&Ts(l,{type:"navigate",to:i})},setValues:a=>{const r=t().iframeWindow;Ts(r,{type:"setValues",values:a})},setThemeFont:a=>{const r=t().iframeWindow;Ts(r,{type:"setThemeFont",value:a})},setThemeValue:(a,r)=>{const i=t().iframeWindow;Ts(i,{type:"setThemeValue",name:a,value:r})},setActiveTheme:a=>{const r=t().iframeWindow;Ts(r,{type:"setActiveTheme",themeId:a})},setCustomCode:(a,r)=>{const i=t().iframeWindow;Ts(i,{type:"setCustomCode",mode:a,value:r})},setHighlight:a=>{s(()=>{var l;let r=null;const i=(l=t().iframeWindow)==null?void 0:l.document;i&&a&&(r=i.querySelector(a)),r&&requestAnimationFrame(()=>{r&&r.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})})})}}}))));function Ts(s,t){s&&s.postMessage({source:"be-appearance-editor",...t},"*")}function Z(){return Fs.getState()}function Xu(){return I({mutationFn:s=>em(s),onSuccess:async()=>{await _.invalidateQueries({queryKey:["admin/appearance/values"]}),M(d("Changes saved"))},onError:s=>q(s)})}function em(s){return S.post("admin/appearance",{changes:s}).then(t=>t.data)}function sm(){return be({queryKey:["admin/appearance/values"],queryFn:()=>tm(),staleTime:1/0})}function tm(){return S.get("admin/appearance/values").then(s=>s.data)}function am(){const{pathname:s}=bs(),{getValues:t}=P(),[a,r]=m.useState(null);return m.useEffect(()=>{var l;const[,,i]=s.split("/").filter(o=>!!o);if(i){const o=(l=Z().config)==null?void 0:l.sections[i];if(o){r([{label:d("Appearance"),location:""},...o.buildBreadcrumb(s,t())]);return}}r(null)},[s,t]),!a||a.length<2?null:e.jsxs("div",{className:"flex items-center border-b h-60 flex-shrink-0",children:[e.jsx(C,{iconSize:"md",radius:"rounded-none",className:"text-muted h-full w-50 flex-shrink-0",elementType:F,to:`/admin/appearance/${a[a.length-2].location}`,children:e.jsx(zt,{})}),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:a.map((i,l)=>{const o=a.length-1===l,c=l===0,u=e.jsx(Po,{value:i.label});return c?null:e.jsxs(m.Fragment,{children:[e.jsx("div",{className:w("whitespace-nowrap overflow-hidden overflow-ellipsis min-w-0",o&&"text-primary",o?"flex-shrink-0":"flex-auto"),children:u}),!o&&e.jsx(ct,{className:"icon-sm text-muted flex-shrink-0"})]},l)})})]})]})}function nm(){const{isAppearanceEditorActive:s}=To(),{data:t}=sm(),{base_url:a}=ue(),r=m.useRef(null),{pathname:i}=bs();return m.useEffect(()=>{t!=null&&t.defaults&&!Z().defaults&&Z().setDefaults(t.defaults)},[t]),m.useEffect(()=>{r.current&&Z().setIframeWindow(r.current.contentWindow)},[]),m.useEffect(()=>{const l=i.split("/")[3];Z().preview.navigate(l)},[i]),s?e.jsx(zs,{to:"/admin"}):e.jsxs("div",{className:"h-screen items-center md:flex",children:[e.jsx(cs,{children:e.jsx(n,{message:"Appearance"})}),e.jsx(rm,{values:t==null?void 0:t.values}),e.jsx("div",{className:"relative h-full flex-auto",children:e.jsx("iframe",{ref:r,className:"h-full w-full max-md:hidden",src:`${a}?appearanceEditor=true`})})]})}function rm({values:s}){const t=e.jsx("div",{className:"flex h-full flex-auto items-center justify-center",children:e.jsx(ds,{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(im,{defaultValues:s}):t})}function im({defaultValues:s}){const t=O({defaultValues:s}),{watch:a,reset:r}=t,i=Xu();return m.useEffect(()=>{const l=a(o=>{Z().preview.setValues(o)});return()=>l.unsubscribe()},[a]),e.jsxs(te,{className:"flex h-full flex-col",form:t,onSubmit:l=>{i.mutate(l,{onSuccess:()=>r(l)})},children:[e.jsx(lm,{isLoading:i.isPending}),e.jsx(am,{}),e.jsx("div",{className:"flex-auto overflow-y-auto px-14 py-20",children:e.jsx(we,{children:e.jsx(Ms,{})})})]})}function lm({isLoading:s}){const{formState:{dirtyFields:t}}=P(),a=Object.keys(t).length;return e.jsxs("div",{className:"flex h-50 flex-shrink-0 items-center border-b pr-10",children:[e.jsx(C,{border:"border-r",className:"text-muted",elementType:F,to:"..",children:e.jsx($e,{})}),e.jsx("div",{className:"pl-10",children:e.jsx(n,{message:"Appearance editor"})}),e.jsx(b,{variant:"flat",color:"primary",className:"ml-auto block",disabled:!a||s,type:"submit",children:a?e.jsx(n,{message:"Save"}):e.jsx(n,{message:"Saved"})})]})}function om(){const s=vs(),{trans:t}=z(),{fields:a,append:r}=Re({name:"settings.menus",keyName:"key"});return e.jsxs(m.Fragment,{children:[e.jsx("div",{children:a.map((i,l)=>e.jsx(ke,{to:`${l}`,elementType:F,children:i.name},i.key))}),e.jsx("div",{className:"text-right",children:e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(me,{}),size:"xs",onClick:()=>{const i=za(10);r({name:t(d("New menu :number",{values:{number:a.length+1}})),id:i,positions:[],items:[]}),s(`${a.length}`)},children:e.jsx(n,{message:"Create menu"})})})]})}function al({title:s=e.jsx(n,{message:"Add menu item"})}){const{data:t}=le(["menuItemCategories"]),a=(t==null?void 0:t.menuItemCategories)||[],r=sl();return e.jsxs(G,{size:"sm",children:[e.jsx(se,{children:s}),e.jsx(X,{children:e.jsxs(Cs,{variant:"outline",children:[e.jsx(Ce,{label:e.jsx(n,{message:"Link"}),bodyClassName:"max-h-240 overflow-y-auto",children:e.jsx(cm,{})}),e.jsx(Ce,{label:e.jsx(n,{message:"Route"}),bodyClassName:"max-h-240 overflow-y-auto",children:e.jsx(Hn,{items:r})}),a.map(i=>e.jsx(Ce,{label:e.jsx(n,{message:i.name}),children:e.jsx(Hn,{items:i.items})},i.name))]})})]})}function cm(){const s=O({defaultValues:{id:za(6),type:"link",target:"_blank"}}),{close:t}=K();return e.jsxs(te,{form:s,onSubmit:a=>{t(a)},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(b,{type:"submit",variant:"flat",color:"primary",size:"xs",children:e.jsx(n,{message:"Add to menu"})})})]})}function Hn({items:s}){const{close:t}=K();return e.jsx(br,{children:s.map(a=>e.jsx(vr,{startIcon:e.jsx(me,{size:"sm"}),onSelected:()=>{if(a.label){const r=a.label.split("/").pop();a.label=r?Xi(r):a.label,a.id=za(6)}t(a)},children:a.label},a.id))})}const dm=T(e.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"DragIndicatorOutlined"),es=T(e.jsx("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}),"DeleteOutlined"),um=""+new URL("dropdown-menu-c9b3bd6a.svg",import.meta.url).href;function mm(){const{menuIndex:s}=V(),t=vs(),{getValues:a}=P(),r=`settings.menus.${s}`,i=a(r);return m.useEffect(()=>{i?Z().preview.setHighlight(`[data-menu-id="${i.id}"]`):t("/admin/appearance/menus")},[t,i]),i?e.jsx(xm,{formPath:r}):null}function xm({formPath:s}){const{site:{has_mobile_app:t}}=ue(),a=Fs(l=>{var o;return(o=l.config)==null?void 0:o.sections.menus.config}),r=m.useMemo(()=>{const l=[...a==null?void 0:a.positions];return t&&l.push("mobile-app-about"),l.map(o=>({key:o,name:o.replaceAll("-"," ")}))},[a,t]),i=Re({name:`${s}.items`,keyName:"key"});return e.jsxs(m.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(Vs,{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:r.map(l=>e.jsx(h,{value:l.key,capitalizeFirst:!0,children:l.name},l.key))})]}),e.jsx(hm,{fieldArray:i}),e.jsx("div",{className:"text-right",children:e.jsx(gm,{})})]})}function hm({fieldArray:{append:s,fields:t,move:a}}){const r=vs();return e.jsxs(m.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(A,{type:"popover",placement:"right",offset:20,onClose:i=>{i&&(s({...i}),r(`items/${t.length}`))},children:[e.jsx(b,{variant:"outline",color:"primary",size:"xs",startIcon:e.jsx(me,{}),children:e.jsx(n,{message:"Add"})}),e.jsx(al,{})]})]}),e.jsxs("div",{className:"mt-20 flex-shrink-0",children:[t.map((i,l)=>e.jsx(pm,{item:i,items:t,index:l,onSortEnd:(o,c)=>{a(o,c)}},i.key)),t.length?null:e.jsx(He,{size:"xs",className:"my-40",image:e.jsx(At,{src:um}),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 gm(){const s=vs(),{menuIndex:t}=V(),{fields:a,remove:r}=Re({name:"settings.menus",keyName:"key"});if(!t)return null;const i=a[+t];return e.jsxs(A,{type:"modal",onClose:l=>{if(l){const o=a.findIndex(c=>c.id===i.id);r(o),s("/admin/appearance/menus")}},children:[e.jsx(b,{variant:"outline",color:"danger",size:"xs",startIcon:e.jsx(es,{}),children:e.jsx(n,{message:"Delete menu"})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete menu"}),body:e.jsx(n,{message:"Are you sure you want to delete “:name“?",values:{name:i.name}}),confirm:e.jsx(n,{message:"Delete"})})]})}function pm({item:s,items:t,index:a,onSortEnd:r}){const i=m.useRef(null),{sortableProps:l,dragHandleRef:o}=Qt({item:s,items:t,type:"menuEditorSortable",ref:i,onSortEnd:r,strategy:"liveSort"}),c=s.icon&&Ea(s.icon),u=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(m.Fragment,{children:e.jsx(ke,{elementType:F,to:`items/${a}`,ref:i,...l,children:e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsx(C,{ref:o,size:"sm",children:e.jsx(dm,{className:"text-muted hover:cursor-move"})}),e.jsx("div",{children:s.label||u})]})})})}function jm(){const{menuIndex:s,menuItemIndex:t}=V(),a=Y(),{getValues:r}=P(),i=`settings.menus.${s}.items.${t}`,l=r(i);return m.useEffect(()=>{l&&Z().preview.setHighlight(`[data-menu-item-id="${l.id}"]`)},[a,l]),!l||t==null?null:e.jsx(fm,{formPath:i})}function fm({formPath:s}){return e.jsxs(m.Fragment,{children:[e.jsx(Ds,{formPathPrefix:s}),e.jsx("div",{className:"text-right mt-40",children:e.jsx(bm,{})})]})}function bm(){const s=Y(),{menuIndex:t,menuItemIndex:a}=V(),{fields:r,remove:i}=Re({name:`settings.menus.${+t}.items`});if(!a)return null;const l=r[+a];return e.jsxs(A,{type:"modal",onClose:o=>{o&&a&&(i(+a),s(`/admin/appearance/menus/${t}`))},children:[e.jsx(b,{variant:"outline",color:"danger",size:"xs",startIcon:e.jsx(es,{}),children:e.jsx(n,{message:"Delete this item"})}),e.jsx(ce,{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 vm(){return e.jsxs(m.Fragment,{children:[e.jsx(Ws,{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(Ws,{label:e.jsx(n,{message:"Light logo"}),description:e.jsx(n,{message:"Will be used on dark backgrounds."}),type:"logo_light"}),e.jsx(Ws,{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(Ws,{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(Ws,{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(ym,{}),e.jsx(Cm,{})]})}function Ws({label:s,description:t,type:a}){const r=Fs(i=>{var l;return(l=i.defaults)==null?void 0:l.settings.branding[a]});return e.jsx(Le,{name:`settings.branding.${a}`,className:"border-b pb-30 mb-30",label:s,description:t,diskPrefix:"branding_media",defaultValue:r,onChange:()=>{Z().preview.setHighlight('[data-logo="navbar"]')}})}function ym(){return e.jsx(p,{name:"appearance.env.app_name",required:!0,className:"mt-20",label:e.jsx(n,{message:"Site name"})})}function Cm(){return e.jsx(p,{name:"settings.branding.site_description",className:"mt-20",inputElementType:"textarea",rows:4,label:e.jsx(n,{message:"Site description"})})}function wm(s=1,t=1e4){const a=new Uint32Array(1);window.crypto.getRandomValues(a);const r=a[0]/(4294967295+1);return s=Math.ceil(s),t=Math.floor(t),Math.floor(r*(t-s+1))+s}function Sm(){const{trans:s}=z(),t=vs(),{data:{themes:a}}=Cr(),{fields:r,append:i}=Re({name:"appearance.themes.all",keyName:"key"});return m.useEffect(()=>{a.selectedThemeId&&Z().preview.setActiveTheme(a.selectedThemeId)},[a.selectedThemeId]),e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"mb-20",children:e.jsx(b,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(me,{}),onClick:()=>{var o;const l=(o=Z().defaults)==null?void 0:o.appearance.themes.light;i({id:wm(),name:s(d("New theme")),values:l}),t(`${r.length+1}`)},children:e.jsx(n,{message:"New theme"})})}),r.map((l,o)=>e.jsx(ke,{to:`${o}`,elementType:qt,children:l.name},l.key))]})}const Nm=B.lazy(()=>fs(()=>import("./ace-editor-3d06c157.js"),["./ace-editor-3d06c157.js","./main-239552ae.js","./main-3987dbef.css","./index-c7d484cf.js"],import.meta.url));function mn({defaultValue:s,mode:t="html",title:a,onSave:r,isSaving:i,footerStartAction:l,beautify:o,editorRef:c}){const[u,x]=m.useState(s),[g,j]=m.useState(!0);return e.jsxs(G,{size:"fullscreen",className:"h-full w-full",children:[e.jsx(se,{children:a}),e.jsx(X,{className:"relative flex-auto",padding:"p-0",children:e.jsx(m.Suspense,{fallback:e.jsx("div",{className:"flex h-400 w-full items-center justify-center",children:e.jsx(ds,{"aria-label":"Loading editor...",isIndeterminate:!0,size:"md"})}),children:e.jsx(Nm,{beautify:o,mode:t,onChange:v=>x(v),defaultValue:u||"",onIsValidChange:j,editorRef:c})})}),e.jsx(km,{disabled:!g||i,value:u,onSave:r,startAction:l})]})}function km({disabled:s,value:t,onSave:a,startAction:r}){const{close:i}=K();return e.jsxs(re,{dividerTop:!0,startAction:r,children:[e.jsx(b,{onClick:()=>i(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{disabled:s,variant:"flat",color:"primary",onClick:()=>{a?a(t):i(t)},children:e.jsx(n,{message:"Save"})})]})}function nl(s){return be({queryKey:["admin","seo-tags",s],queryFn:()=>Lm(s)})}function Lm(s){return S.get(`admin/appearance/seo-tags/${s}`).then(t=>t.data)}function _m(s){const t=Da();return I({mutationFn:a=>Mm(s,a.tags),onSuccess:async()=>{await t.invalidateQueries({queryKey:["admin","seo-tags",s]}),M(d("Updated SEO tags"))},onError:a=>q(a)})}function Mm(s,t){return S.put(`admin/appearance/seo-tags/${s}`,{tags:t}).then(a=>a.data)}var pr;const rl=((pr=un.sections["seo-settings"].config)==null?void 0:pr.pages)||[],il=rl.map(s=>s.key);function Im(){const{isLoading:s}=nl(il);return s?e.jsx(_e,{}):e.jsx(m.Fragment,{children:rl.map(t=>e.jsx(Fm,{label:t.label,name:t.key},t.key))})}function Fm({label:s,name:t}){const{data:a,isLoading:r}=nl(il);return e.jsxs(A,{type:"modal",children:[e.jsx(ke,{disabled:r,children:e.jsx(n,{...s})}),a?e.jsx(Pm,{name:t,value:a[t]}):null]})}function Pm({name:s,value:t}){const{close:a}=K(),r=_m(s),i=m.useRef(null),l=e.jsx(b,{variant:"outline",color:"primary",onClick:()=>{i.current&&i.current.editor.setValue(t.original)},children:e.jsx(n,{message:"Reset to original"})});return e.jsx(mn,{mode:"php_laravel_blade",title:e.jsx(n,{message:"Edit SEO meta tags"}),footerStartAction:l,editorRef:i,defaultValue:t.custom||t.original,isSaving:r.isPending,beautify:!1,onSave:o=>{o!=null&&r.mutate({tags:o},{onSuccess:()=>a()})}})}function Tm(){return e.jsxs(m.Fragment,{children:[e.jsx(Zn,{mode:"css"}),e.jsx(Zn,{mode:"html"})]})}function Zn({mode:s}){const{getValues:t}=P(),{setValue:a}=P(),r=s==="html"?e.jsx(n,{message:"Custom HTML & JavaScript"}):e.jsx(n,{message:"Custom CSS"});return e.jsxs(A,{type:"modal",onClose:i=>{i!=null&&(a(`appearance.custom_code.${s}`,i,{shouldDirty:!0}),Z().preview.setCustomCode(s,i))},children:[e.jsx(ke,{children:r}),e.jsx(mn,{title:r,defaultValue:t(`appearance.custom_code.${s}`)||"",mode:s})]})}const Em=""+new URL("articles-8bfd9f17.svg",import.meta.url).href,ht="user",zm=s=>{const t=s.customPages.types.length>1?[{control:{type:H.Select,defaultValue:"default",options:s.customPages.types.map(a=>({value:a.type,label:a.label,key:a.type}))},key:"type",label:d("Type"),description:d("Type of the page"),defaultOperator:R.eq}]:[];return[{key:"user_id",label:d("User"),description:d("User page was created by"),defaultOperator:R.eq,control:{type:H.SelectModel,model:ht}},...t,Se({description:d("Date page was created")}),Ie({description:d("Date page was last updated")})]},Dm=[{key:"slug",allowsSorting:!0,width:"flex-2 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"Slug"}),body:s=>e.jsx(F,{target:"_blank",to:`/pages/${s.slug}`,className:lt,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(us,{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(ne,{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(C,{size:"md",className:"text-muted",elementType:F,to:`${s.id}/edit`,children:e.jsx(xe,{})})}];function Am(){const s=m.useContext(Xe),t=m.useMemo(()=>zm(s),[s]);return e.jsx(he,{endpoint:"custom-pages",title:e.jsx(n,{message:"Custom pages"}),filters:t,columns:Dm,queryParams:{with:"user"},actions:e.jsx($m,{}),selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:Em,title:e.jsx(n,{message:"No pages have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching pages"})})})}function $m(){return e.jsx(je,{elementType:F,to:"new",children:e.jsx(n,{message:"New page"})})}const Rm=[{label:d("Local search"),to:"search"},{label:d("Content"),to:"content"},{label:d("Videos"),to:"videos"}],Vm=[{label:d("General"),to:"general"},...Rm,wr().settings.billing.integrated&&{label:d("Subscriptions"),to:"subscriptions"},{label:d("Localization"),to:"localization"},{label:d("Authentication"),to:"authentication"},{label:d("Uploading"),to:"uploading"},{label:d("Outgoing email"),to:"outgoing-email"},{label:d("Cache"),to:"cache"},{label:d("Analytics"),to:"analytics"},{label:d("Logging"),to:"logging"},{label:d("Queue"),to:"queue"},{label:d("Recaptcha"),to:"recaptcha"},{label:d("GDPR"),to:"gdpr"},{label:d("Menus"),to:"/admin/appearance/menus"},{label:d("Seo"),to:"/admin/appearance/seo-settings"},{label:d("Themes"),to:"/admin/appearance/themes"}].filter(Boolean),ll=Vm;function qm({className:s}){const t=Ae();return e.jsxs("div",{className:w(s,"container mx-auto min-h-full items-start gap-30 p-24 md:flex"),children:[e.jsx(cs,{children:e.jsx(n,{message:"Settings"})}),t?e.jsx(Om,{}):e.jsx(Um,{}),e.jsx("div",{className:"relative max-w-500 flex-auto md:px-30",children:e.jsx(Ms,{})})]})}function Om(){const{pathname:s}=bs(),t=vs(),a=s.split("/").pop();return e.jsx(Ye,{minWidth:"min-w-none",className:"mb-24 w-full bg",selectionMode:"single",selectedValue:a,onSelectionChange:r=>{t(r)},children:ll.map(r=>e.jsx(h,{value:r.to,children:e.jsx(n,{...r.label})},r.to))})}function Um(){return e.jsx("div",{className:"sticky top-24 w-240 flex-shrink-0",children:ll.map(s=>e.jsx(qt,{to:s.to,className:({isActive:t})=>w("mb-8 block whitespace-nowrap rounded-button p-14 text-sm transition-bg-color",t?"bg-primary/6 font-semibold text-primary":"hover:bg-hover"),children:e.jsx(n,{...s.label})},s.to))})}function gt(){return be({queryKey:["fetchAdminSettings"],queryFn:()=>Bm(),staleTime:1/0})}function Bm(){return S.get("settings").then(s=>s.data)}function Hm(){return S.post("sitemap/generate").then(s=>s.data)}function Zm(){return I({mutationFn:()=>Hm(),onSuccess:()=>{M(d("Sitemap generated"))},onError:s=>q(s)})}const da=s=>s instanceof Date,Km=s=>Object.keys(s).length===0,ka=s=>s!=null&&typeof s=="object",Kn=(s,...t)=>Object.prototype.hasOwnProperty.call(s,...t),ua=s=>ka(s)&&Km(s),Wm=()=>Object.create(null),La=(s,t)=>{if(s===t)return{};if(!ka(s)||!ka(t))return t;const a=Object.keys(s).reduce((r,i)=>(Kn(t,i)||(r[i]=void 0),r),Wm());return da(s)||da(t)?s.valueOf()==t.valueOf()?{}:t:Object.keys(t).reduce((r,i)=>{if(!Kn(s,i))return r[i]=t[i],r;const l=La(s[i],t[i]);return ua(l)&&!da(l)&&(ua(s[i])||!ua(t[i]))||(r[i]=l),r},a)};function ol(s){const{data:t}=gt();return I({mutationFn:a=>{var l,o,c,u,x,g,j,v,f,N,y;(o=(l=a.client)==null?void 0:l.cookie_notice)!=null&&o.button&&(a.client.cookie_notice.button=JSON.stringify(a.client.cookie_notice.button)),(u=(c=a.client)==null?void 0:c.registration)!=null&&u.policies&&(a.client.registration.policies=JSON.stringify(a.client.registration.policies)),(g=(x=a.client)==null?void 0:x.artistPage)!=null&&g.tabs&&(a.client.artistPage.tabs=JSON.stringify(a.client.artistPage.tabs)),(v=(j=a.client)==null?void 0:j.title_page)!=null&&v.sections&&(a.client.title_page.sections=JSON.stringify(a.client.title_page.sections)),(f=a.client)!=null&&f.incoming_email&&(a.client.incoming_email=JSON.stringify(a.client.incoming_email)),(y=(N=a.client)==null?void 0:N.publish)!=null&&y.default_credentials&&(a.client.publish.default_credentials=JSON.stringify(a.client.publish.default_credentials));const r=a.client?La(t.client,a.client):null,i=a.server?La(t.server,a.server):null;return Qm({client:r,server:i,files:a.files})},onSuccess:()=>{M(d("Settings updated"),{position:"bottom-right"}),_.invalidateQueries({queryKey:["fetchAdminSettings"]})},onError:a=>ee(a,s)})}function Qm({client:s,server:t,files:a}){const r=new FormData;return s&&r.set("client",JSON.stringify(zn.dot(s))),t&&r.set("server",JSON.stringify(zn.dot(t))),Object.entries(a||{}).forEach(([i,l])=>{r.set(i,l)}),S.post("settings",r,{headers:{"Content-Type":"multipart/form-data"}}).then(i=>i.data)}function Ne({title:s,description:t,children:a,transformValues:r}){const{data:i}=gt();return e.jsxs("section",{children:[e.jsxs("div",{className:"mb-40",children:[e.jsx("h2",{className:"mb-4 text-xl",children:s}),e.jsx("div",{className:"text-sm text-muted",children:t})]}),i?e.jsx(Gm,{defaultValues:i,transformValues:r,children:a}):e.jsx(ds,{isIndeterminate:!0,"aria-label":"Loading settings..."})]})}function Gm({children:s,defaultValues:t,transformValues:a}){const r=O({defaultValues:t}),i=ol(r);return e.jsxs(m.Fragment,{children:[e.jsxs(te,{form:r,onBeforeSubmit:()=>{const l=r.formState.errors,o=Object.keys(l).filter(c=>c.endsWith("_group"));r.clearErrors(o)},onSubmit:l=>{l=a?a(l):l,i.mutate(l)},children:[s,e.jsx("div",{className:"mt-40",children:e.jsx(b,{type:"submit",variant:"flat",color:"primary",disabled:i.isPending,children:e.jsx(n,{message:"Update"})})})]}),i.isPending&&e.jsx(Dt,{size:"xs",className:"absolute -bottom-14 left-30 w-full",isIndeterminate:!0,"aria-label":"Saving settings..."})]})}function Ge(){return e.jsx("div",{className:"h-1 bg-divider my-30"})}const xn=T(e.jsx("path",{d:"M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-2zm-3-4h8v2H8z"}),"LinkOutlined");function pt({link:s,className:t}){const{site:a}=ue();return a.hide_docs_button?null:e.jsxs("div",{className:w("flex items-center gap-8",t),children:[e.jsx(xn,{size:"sm"}),e.jsx(Ot,{href:s,children:e.jsx(n,{message:"Learn more"})})]})}function Jm(){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(Ym,{}),e.jsx(Ge,{}),e.jsx(Xm,{}),e.jsx(Ge,{}),e.jsx(ex,{}),e.jsx(Ge,{}),e.jsx(sx,{})]})}function Ym(){const{data:s}=gt();if(!s)return null;let t=null;const a=s.server,r=a.newAppUrl&&a.newAppUrl!==a.app_url;return r&&(t=e.jsx("div",{className:"mt-20 text-sm text-danger",children:e.jsx(n,{values:{baseUrl:a.app_url,currentUrl:a.newAppUrl,b:i=>e.jsx("b",{children:i})},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(m.Fragment,{children:[e.jsx(p,{invalid:!!r,name:"server.app_url",label:e.jsx(n,{message:"Primary site url"}),description:e.jsx(pt,{link:"https://support.vebto.com/hc/articles/35/primary-site-url"})}),t]})}function Xm(){var i,l;const{watch:s}=P(),{homepage:t}=m.useContext(Xe),{data:a}=le(["menuItemCategories"]),r=s("client.homepage.type");return e.jsxs("div",{children:[e.jsxs(D,{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:[t.options.map(o=>e.jsx(h,{value:o.value,children:e.jsx(n,{...o.label})},o.value)),(i=a==null?void 0:a.menuItemCategories)==null?void 0:i.map(o=>e.jsx(h,{value:o.type,children:o.name},o.type))]}),(l=a==null?void 0:a.menuItemCategories)==null?void 0:l.map(o=>r===o.type?e.jsx(D,{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(h,{value:c.model_id,children:c.label},c.label))},o.name):null)]})}function ex(){const{data:{themes:s}}=Cr();return e.jsxs(m.Fragment,{children:[e.jsxs(D,{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(h,{value:0,children:e.jsx(n,{message:"System"})}),s.all.map(t=>e.jsx(h,{value:t.id,children:t.name},t.id))]}),e.jsx($,{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 sx(){const s=Zm(),{base_url:t}=ue(),a=`${t}/storage/sitemaps/sitemap-index.xml`,r=e.jsx(Ot,{href:a,children:a});return e.jsxs(e.Fragment,{children:[e.jsx(b,{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:r}})})]})}function Wn(s){return Is(s).toString("rgb").replace("rgb(","").replace(")","").replace(/, ?/g," ")}function tx(){const{getValues:s,setValue:t}=P(),{themeIndex:a}=V(),r=s(`appearance.themes.all.${+a}`);return e.jsxs(A,{type:"modal",onClose:i=>{i&&s("appearance.themes.all").forEach((l,o)=>{if(l.id===i.id){t(`appearance.themes.all.${o}`,i,{shouldDirty:!0});return}if(i.default_light){t(`appearance.themes.all.${o}`,{...l,default_light:!1},{shouldDirty:!0});return}if(i.default_dark){t(`appearance.themes.all.${o}`,{...l,default_dark:!1},{shouldDirty:!0});return}})},children:[e.jsx(b,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(zr,{}),children:e.jsx(n,{message:"Settings"})}),e.jsx(ax,{theme:r})]})}function ax({theme:s}){const t=O({defaultValues:s}),{close:a,formId:r}=K();return m.useEffect(()=>{const i=t.watch((l,{name:o})=>{o==="default_light"&&l.default_light&&t.setValue("default_dark",!1),o==="default_dark"&&l.default_dark&&t.setValue("default_light",!1)});return()=>i.unsubscribe()},[t]),e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Update settings"})}),e.jsx(X,{children:e.jsxs(te,{form:t,id:r,onSubmit:i=>{a(i)},children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-30",autoFocus:!0}),e.jsx($,{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($,{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($,{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(re,{children:[e.jsx(b,{onClick:()=>{a()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",type:"submit",form:r,disabled:!t.formState.isDirty,children:e.jsx(n,{message:"Save"})})]})]})}const nx=T(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 rx(){const s=Y(),{themeIndex:t}=V(),[a,r]=m.useState(!1),{setValue:i,getValues:l}=P(),{fields:o,remove:c}=Re({name:"appearance.themes.all"}),u=()=>{if(o.length<=1){M.danger(d("At least one theme is required"));return}t&&(s("/admin/appearance/themes"),c(+t),i("appearance.themes.selectedThemeId",null))};return e.jsxs(m.Fragment,{children:[e.jsxs(Ze,{onItemSelected:x=>{if(x==="delete")r(!0);else if(x==="reset"){const g=`appearance.themes.all.${+t}`,j=l(`${g}.is_dark`)?Z().defaults.appearance.themes.dark:Z().defaults.appearance.themes.light;Object.entries(j).forEach(([v,f])=>{Z().preview.setThemeValue(v,f)}),Z().preview.setThemeFont(null),i(`${g}.values`,j,{shouldDirty:!0}),i(`${g}.font`,void 0,{shouldDirty:!0})}},children:[e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(Gt,{})}),e.jsxs(Ke,{children:[e.jsx(h,{value:"reset",startIcon:e.jsx(nx,{}),children:e.jsx(n,{message:"Reset colors"})}),e.jsx(h,{value:"delete",startIcon:e.jsx(es,{}),children:e.jsx(n,{message:"Delete"})})]})]}),e.jsx(A,{type:"modal",isOpen:a,onClose:x=>{x&&u(),r(!1)},children:e.jsx(ce,{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 Qn=[{label:d("Accent"),value:"primary",bgColor:"bg-primary",previewBgColor:"text-primary"},{label:d("Background"),value:"bg",bgColor:"bg-background",previewBgColor:"text-background"},{label:d("Background alt"),value:"bg-alt",bgColor:"bg-alt",previewBgColor:"text-background-alt"},{label:d("Transparent"),value:"transparent",bgColor:"bg-transparent",previewBgColor:"text-transparent"}];function ix(){var o;const{themeIndex:s}=V(),{watch:t,setValue:a}=P(),r=`appearance.themes.all.${s}.values.--be-navbar-color`,i=t(r),l=(o=Qn.find(({value:c})=>c===i))==null?void 0:o.previewBgColor;return e.jsxs(Ze,{placement:"right",selectionMode:"single",selectedValue:i,onSelectionChange:c=>{a(r,c,{shouldDirty:!0})},children:[e.jsx(ke,{startIcon:e.jsx(nn,{viewBox:"0 0 48 48",className:w("icon-lg",l)}),children:e.jsx(n,{message:"Navbar"})}),e.jsx(Ke,{children:Qn.map(({label:c,value:u,bgColor:x})=>e.jsx(h,{value:u,startIcon:e.jsx("div",{className:w("h-20 w-20 rounded border",x)}),children:e.jsx(n,{...c})},u))})]})}function _a(s){try{return Is(`rgb(${s.split(" ").join(",")})`).toString("hex")}catch{return s}}const lx=[{label:d("Background"),key:"--be-background"},{label:d("Background alt"),key:"--be-background-alt"},{label:d("Foreground"),key:"--be-foreground-base"},{label:d("Accent light"),key:"--be-primary-light"},{label:d("Accent"),key:"--be-primary"},{label:d("Accent dark"),key:"--be-primary-dark"},{label:d("Text on accent"),key:"--be-on-primary"},{label:d("Chip"),key:"--be-background-chip"}];function ox(){const s=vs(),{themeIndex:t}=V(),{getValues:a,watch:r}=P(),i=a(`appearance.themes.all.${+t}`),l=r(`appearance.themes.all.${+t}.font.family`);return m.useEffect(()=>{i||s("/admin/appearance/themes")},[s,i]),m.useEffect(()=>{i!=null&&i.id&&Z().preview.setActiveTheme(i.id)},[i==null?void 0:i.id]),i?e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"mb-20 flex items-center justify-between gap-10",children:[e.jsx(tx,{}),e.jsx(rx,{})]}),e.jsxs("div",{children:[e.jsx(ke,{elementType:F,to:"font",description:l||e.jsx(n,{message:"System"}),children:e.jsx(n,{message:"Font"})}),e.jsx(ke,{elementType:F,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(ix,{}),lx.map(o=>e.jsx(cx,{colorName:o.key,label:e.jsx(n,{...o.label}),initialThemeValue:i.values[o.key],theme:i},o.key))]})]}):null}function cx({label:s,theme:t,colorName:a,initialThemeValue:r}){const{setValue:i}=P(),{themeIndex:l}=V(),[o,c]=m.useState(r),u=x=>{c(x),Z().preview.setThemeValue(a,x)};return m.useEffect(()=>{c(r)},[r]),e.jsxs(A,{value:_a(o),type:"popover",placement:"right",offset:10,onValueChange:x=>{u(Wn(x))},onClose:(x,{valueChanged:g,initialValue:j})=>{x&&g?(i(`appearance.themes.all.${+l}.values.${a}`,Wn(x),{shouldDirty:!0}),i("appearance.themes.selectedThemeId",t.id)):u(j)},children:[e.jsx(ke,{className:"capitalize",startIcon:e.jsx(nn,{viewBox:"0 0 48 48",className:"icon-lg",style:{fill:`rgb(${o})`}}),children:s}),e.jsx(on,{})]})}function Ft({children:s,...t}){const{field:{onChange:a,onBlur:r,value:i=[],ref:l},fieldState:{invalid:o,error:c}}=ps({name:t.name}),u=m.useMemo(()=>{const g=i;return typeof g=="string"?JSON.parse(g):g},[i]),x={onChange:g=>{const j=JSON.stringify(g.map(v=>v.name));a(j)},onBlur:r,value:u,invalid:o,errorMessage:c==null?void 0:c.message};return e.jsx(wc,{ref:l,...js(x,t)})}function dx(){const{trans:s}=z();return e.jsxs(Ne,{title:e.jsx(n,{message:"Video and streaming"}),description:e.jsx(n,{message:"Control how videos are played and displayed on the site."}),children:[e.jsx(mx,{}),e.jsx(ux,{}),e.jsx($,{className:"mb-24",name:"client.streaming.prefer_full",description:e.jsx(n,{message:'When user clicks on "play" buttons across the site play full movie or episode instead of trailers and clips.'}),children:e.jsx(n,{message:"Prefer full videos"})}),e.jsx($,{className:"mb-24",name:"client.streaming.show_video_selector",description:e.jsx(n,{message:"Show alternative videos on the watch page."}),children:e.jsx(n,{message:"Alternative videos"})}),e.jsx($,{className:"mb-24",name:"client.streaming.show_header_play",description:e.jsx(n,{message:"Whether play button should be shown on main title header."}),children:e.jsx(n,{message:"Header play button"})}),e.jsx(Ft,{className:"mb-24",label:e.jsx(n,{message:"Possible video qualities"}),name:"client.streaming.qualities",placeholder:s({message:"Add another..."})})]})}function ux(){return e.jsxs(D,{className:"mb-24",name:"client.streaming.default_sort",label:e.jsx(n,{message:"Video sorting"}),selectionMode:"single",description:e.jsx(n,{message:"When multiple videos are shown on the page, how should they be sorted by default."}),children:[e.jsx(h,{value:"order:asc",children:e.jsx(n,{message:"Manual (order assigned manually in admin area)"})}),e.jsx(h,{value:"created_at:desc",children:e.jsx(n,{message:"Date added"})}),e.jsx(h,{value:"name:asc",children:e.jsx(n,{message:"Name (a-z)"})}),e.jsx(h,{value:"Language:asc",children:e.jsx(n,{message:"Language (a-z)"})}),e.jsx(h,{value:"reports:asc",children:e.jsx(n,{message:"Reports (videos with less reports first)"})}),e.jsx(h,{value:"score:desc",children:e.jsx(n,{message:"Score (most liked videos first)"})})]})}function mx(){return e.jsxs(D,{className:"mb-24",name:"client.streaming.video_panel_content",label:e.jsx(n,{message:"Shown videos"}),selectionMode:"single",description:e.jsx(n,{message:"What type of videos should be shown in title and episode pages (if there is more then one video attached)."}),children:[e.jsx(h,{value:"all",children:e.jsx(n,{message:"All videos"})}),e.jsx(h,{value:"full",children:e.jsx(n,{message:"Full movies and episodes"})}),e.jsx(h,{value:"short",children:e.jsx(n,{message:"Short videos (everything except full movies & episodes)"})}),e.jsx(h,{value:"trailer",children:e.jsx(n,{message:"Trailers"})}),e.jsx(h,{value:"clip",children:e.jsx(n,{message:"Clips"})})]})}function sa({children:s,className:t}){const{selectedTab:a,isLazy:r}=m.useContext(Dr),i=m.Children.toArray(s).filter(o=>!!o);let l;if(r){const o=i[a];l=m.isValidElement(o)?m.cloneElement(i[a],{index:a}):null}else l=i.map((o,c)=>{if(m.isValidElement(o)){const u=c===a;return m.cloneElement(o,{index:c,"aria-hidden":!u,className:u?o.props.className:w(o.props.className,"hidden")})}return null});return e.jsx("div",{className:t,children:l})}function is({className:s,children:t,index:a,...r}){const{id:i}=m.useContext(Dr),[l,o]=m.useState(0),c=m.useRef(null);return Eo(()=>{if(c!=null&&c.current){const u=()=>{const g=zo(c.current,{tabbable:!0});o(g.nextNode()?void 0:0)};u();const x=new MutationObserver(u);return x.observe(c.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{x.disconnect()}}},[c]),e.jsx("div",{tabIndex:l,ref:c,id:`${i}-${a}-tabpanel`,"aria-labelledby":`${i}-${a}-tab`,className:w(s,"focus-visible:outline-primary-light"),role:"tabpanel",...r,children:t})}function xx(){const{watch:s}=P();return e.jsxs(m.Fragment,{children:[e.jsx(hx,{}),e.jsx($,{className:"mb-24",name:"client.titles.enable_reviews",description:e.jsx(n,{message:"Enable or disable all review functionality across the site."}),children:e.jsx(n,{message:"Enable reviews"})}),e.jsx($,{className:"mb-24",name:"client.titles.enable_comments",description:e.jsx(n,{message:"Enable or disable all comment functionality across the site."}),children:e.jsx(n,{message:"Enable comments"})}),s("client.titles.enable_comments")&&e.jsx($,{name:"client.comments.per_video",description:e.jsx(n,{message:"When enabled, individual videos will have their own separate comment section (if there are multiple videos), otherwise comments will be shared by all videos for the same title."}),children:e.jsx(n,{message:"Per video comments"})})]})}function hx(){return e.jsxs(D,{className:"mb-24",name:"server.rating_column",label:e.jsx(n,{message:"Rating used for sorting"}),selectionMode:"single",description:e.jsx(n,{message:`When ordering titles by rating, should local user rating or TheMovieDB rating average be
used.`}),children:[e.jsx(h,{value:"tmdb_vote_average",children:e.jsx(n,{message:"TheMovieDB"})}),e.jsx(h,{value:"local_vote_average",children:e.jsx(n,{message:"Local (Ratings and reviews from site users)"})})]})}function ve({children:s,name:t,separatorBottom:a=!0,separatorTop:r=!0}){const{formState:{errors:i}}=P(),l=m.useRef(null),o=i[t];return m.useEffect(()=>{var c;o&&((c=l.current)==null||c.scrollIntoView({behavior:"smooth"}))},[o]),e.jsxs("div",{className:w(a&&"border-b mb-20 pb-20",r&&"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 gx(){const{watch:s}=P();return e.jsxs(m.Fragment,{children:[e.jsx(px,{}),e.jsx($,{className:"mb-24",name:"client.content.title_provider",value:"tmdb",description:e.jsx(n,{message:"This will automatically import, and periodically update, all metadata available on TheMovieDB about the title when user visits that title's page."}),children:e.jsx(n,{message:"Title automation"})}),e.jsx($,{className:"mb-24",name:"client.content.force_season_update",value:"tmdb",description:e.jsx(n,{message:"When this is enabled, season episodes will be automatically updated, even if title automation is disabled."}),children:e.jsx(n,{message:"Always update seasons"})}),e.jsx(Ge,{}),e.jsx($,{className:"mb-24",name:"client.content.people_provider",value:"tmdb",description:e.jsx(n,{message:"This will automatically import, and periodically update, all metadata available on TheMovieDB about a person, when user visits that person's page."}),children:e.jsx(n,{message:"People automation"})}),s("client.content.people_provider")==="tmdb"&&e.jsx($,{className:"mb-24",name:"client.content.automate_filmography",description:e.jsx(n,{message:"Whether full filmograpy for a person should be imported from TheMovieDB when auto updating the person metadata."}),children:e.jsx(n,{message:"Full filmography"})}),e.jsx(jx,{})]})}function px(){return e.jsxs(D,{className:"mb-24",name:"client.content.search_provider",selectionMode:"single",label:e.jsx(n,{message:"Search method"}),description:e.jsx(n,{message:"Which method should be used for user facing search on the site."}),children:[e.jsx(h,{value:"tmdb",description:e.jsx(n,{message:"Search on the site will directly connect to, and search TheMovieDB. Any movie, series and artist available on TheMovieDB will be discoverable via search, without needing to import or create it first."}),children:e.jsx(n,{message:"TheMovieDB"})}),e.jsx(h,{value:"local",description:e.jsx(n,{message:"Will only search content that was created or imported from admin area. This can be further configured from 'Local search' settings page."}),children:e.jsx(n,{message:"Local"})}),e.jsx(h,{value:"all",description:e.jsx(n,{message:"Will combine search results from both 'Local' and 'TheMovieDB' methods. If there are identical matches, local results will be preferred."}),children:e.jsx(n,{message:"Local and TheMovieDB"})})]})}function jx(){const{data:s}=le(["tmdbLanguages"]),{watch:t}=P();return[t("client.content.people_provider"),t("client.content.title_provider"),t("client.content.search_provider")].some(r=>`${r}`.toLowerCase().includes("tmdb"))?e.jsx(ve,{name:"tmdb_group",separatorBottom:!1,children:r=>e.jsxs(m.Fragment,{children:[e.jsx(p,{invalid:r,name:"server.tmdb_api_key",label:e.jsx(n,{message:"TheMovieDB API Key"}),className:"mb-24",required:!0}),e.jsx(D,{className:"mb-24",selectionMode:"single",showSearchField:!0,invalid:r,name:"client.tmdb.language",label:e.jsx(n,{message:"TheMovieDB language"}),description:e.jsx(n,{message:"In what language should content be fetched from TMDb. If translation is not available, data will be in original language for that movie or series."}),children:s==null?void 0:s.tmdbLanguages.map(({code:i,name:l})=>e.jsx(h,{value:i,children:l},i))}),e.jsx($,{name:"client.tmdb.includeAdult",children:e.jsx(n,{message:"Import adult content"})})]})}):null}const fx=[{name:"episodes",title:{message:"Episode grid"}},{name:"seasons",title:{message:"Season grid"}},{name:"videos",title:{message:"Video grid"}},{name:"images",title:{message:"Image grid"}},{name:"reviews",title:{message:"Reviews"}},{name:"cast",title:{message:"Cast grid"}},{name:"related",title:{message:"Related titles"}}];function bx(){const{getValues:s,setValue:t}=P(),a=()=>s("client.title_page.sections")||[],[r,i]=m.useState(()=>{const l=a(),o=c=>l.includes(c)?l.indexOf(c):l.length;return[...fx].sort((c,u)=>o(c.name)-o(u.name))});return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-14 text-sm",children:[e.jsx(n,{message:"Title page sections"}),e.jsx("div",{className:"text-xs text-muted",children:e.jsx(n,{message:"Select which sections should appear on title page and in which order."})})]}),r.map((l,o)=>e.jsx(vx,{items:r,isFirst:o===0,section:l,title:e.jsx(n,{...l.title}),onToggle:(c,u)=>{const x=a(),g=u?[...x,c.name]:x.filter(j=>j!==c.name);t("client.title_page.sections",g)},onSortEnd:(c,u)=>{const x=Ar(r,c,u);i(x);const g=a(),j=x.filter(v=>g.includes(v.name)).map(v=>v.name);t("client.title_page.sections",j)}},l.name))]})}function vx({isFirst:s,title:t,items:a,section:r,onSortEnd:i,onToggle:l}){const o=m.useRef(null),c=m.useRef(null),{watch:u}=P(),g=(u("client.title_page.sections")||[]).includes(r.name),{sortableProps:j,dragHandleRef:v}=Qt({ref:o,item:r,items:a,type:"titlePageSections",preview:c,strategy:"line",onSortEnd:i});return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:w("flex w-full items-center gap-8 border-b py-6",s&&"border-t border-t-transparent"),ref:o,...j,children:[e.jsx(C,{ref:v,children:e.jsx(Ka,{})}),e.jsx("div",{className:"flex-auto",children:e.jsx("div",{className:"text-sm",children:t})}),e.jsx(Aa,{checked:g,onChange:()=>{l(r,!g)}})]}),e.jsx(yx,{title:t,ref:c})]})}const yx=B.forwardRef(({title:s},t)=>e.jsx(Za,{ref:t,children:()=>e.jsx("div",{className:"rounded bg-chip p-8 text-sm shadow",children:s})}));function Cx(){return e.jsx(Ne,{title:e.jsx(n,{message:"Content"}),description:e.jsx(n,{message:"Control how content is displayed across the site."}),children:e.jsxs(ws,{children:[e.jsxs(Ss,{children:[e.jsx(fe,{width:"min-w-132",children:e.jsx(n,{message:"General"})}),e.jsx(fe,{width:"min-w-132",children:e.jsx(n,{message:"Automation"})}),e.jsx(fe,{width:"min-w-132",children:e.jsx(n,{message:"Title page"})})]}),e.jsxs(sa,{className:"pt-24",children:[e.jsx(is,{children:e.jsx(xx,{})}),e.jsx(is,{children:e.jsx(gx,{})}),e.jsx(is,{children:e.jsx(bx,{})})]})]})})}function wx(){return be({queryKey:["search-models"],queryFn:()=>Sx()})}function Sx(){return S.get("admin/search/models").then(s=>s.data)}function Nx(){const{trans:s}=z();return I({mutationFn:t=>kx(t),onSuccess:()=>{M(s(d("Imported search models")))},onError:t=>q(t)})}function kx(s){return S.post("admin/search/import",s).then(t=>t.data)}function Lx(){return e.jsxs(Ne,{title:e.jsx(n,{message:"Search"}),description:e.jsx(n,{message:"Configure search method used on the site as well as related 3rd party integrations."}),children:[e.jsx(_x,{}),e.jsx(Tx,{})]})}function _x(){const{watch:s}=P(),t=s("server.scout_driver");return e.jsx(ve,{name:"search_group",separatorBottom:!1,children:a=>e.jsxs(m.Fragment,{children:[e.jsxs(D,{invalid:a,name:"server.scout_driver",selectionMode:"single",label:e.jsx(n,{message:"Search method"}),description:e.jsx(n,{message:"Which method should be used for search related functionality across the site."}),children:[e.jsx(h,{value:"mysql",children:"Mysql"}),e.jsx(h,{value:"meilisearch",children:"Meilisearch"}),e.jsx(h,{value:"tntsearch",children:"TNTSearch"}),e.jsx(h,{value:"Matchish\\ScoutElasticSearch\\Engines\\ElasticSearchEngine",children:"Elasticsearch"}),e.jsx(h,{value:"algolia",children:"Algolia"})]}),t==="mysql"&&e.jsx(Mx,{}),t==="meilisearch"&&e.jsx(Ix,{}),t==="algolia"&&e.jsx(Px,{}),t==="Matchish\\ScoutElasticSearch\\Engines\\ElasticSearchEngine"&&e.jsx(Fx,{})]})})}function Mx(){const{clearErrors:s}=P();return e.jsxs(D,{className:"mt-24",name:"server.scout_mysql_mode",selectionMode:"single",label:e.jsx(n,{message:"MySQL mode"}),onSelectionChange:()=>{s()},children:[e.jsx(h,{value:"basic",children:e.jsx(n,{message:"Basic"})}),e.jsx(h,{value:"extended",children:e.jsx(n,{message:"Extended"})}),e.jsx(h,{value:"fulltext",children:e.jsx(n,{message:"Fulltext"})})]})}function Ix(){return e.jsx(Ue,{className:"mt-24",color:"warning",title:e.jsx(n,{message:"Important!"}),description:e.jsx(n,{message:"<a>Meilisearch</a> needs to be installed and running for this method to work.",values:{a:s=>e.jsx("a",{href:"https://www.meilisearch.com",target:"_blank",rel:"noreferrer",children:s})}})})}function Fx(){return e.jsx(Ue,{className:"mt-24",color:"warning",title:e.jsx(n,{message:"Important!"}),description:e.jsx(n,{message:"<a>Elasticsearch</a> needs to be installed and running for this method to work.",values:{a:s=>e.jsx("a",{href:"https://www.elastic.co",target:"_blank",rel:"noreferrer",children:s})}})})}function Px(){return e.jsxs(m.Fragment,{children:[e.jsx(p,{className:"mt-24",name:"server.algolia_app_id",label:e.jsx(n,{message:"Algolia app ID"}),required:!0}),e.jsx(p,{className:"mt-24",name:"server.algolia_secret",label:e.jsx(n,{message:"Algolia app secret"}),required:!0})]})}function Tx(){const{getValues:s}=P(),{data:t}=wx(),a=Nx(),[r,i]=m.useState("*");return e.jsx(Ue,{className:"mt-34",color:"neutral",title:e.jsx(n,{message:"Import records"}),description:e.jsxs("span",{children:[e.jsx(n,{message:"Whenever a new search method is enabled, records that already exist in database need to be imported into the index. All records created after search method is enabled will be imported automatically."}),e.jsx("br",{}),e.jsx("br",{}),e.jsx(n,{message:"Depending on number of records in database, importing could take some time. Don't close this window while it is in progress."})]}),actions:e.jsxs("div",{className:"mt-10 border-t pt-14",children:[e.jsxs(Ye,{selectionMode:"single",label:e.jsx(n,{message:"What to import?"}),selectedValue:r,onSelectionChange:l=>{i(l)},children:[e.jsx(h,{value:"*",children:e.jsx(n,{message:"Everything"})}),t==null?void 0:t.models.map(l=>e.jsx(h,{value:l.model,children:e.jsx(n,{message:l.name})},l.model))]}),e.jsx(b,{variant:"flat",color:"primary",className:"mb-8 mt-24",disabled:a.isPending,onClick:()=>{a.mutate({model:r,driver:s("server.scout_driver")})},children:e.jsx(n,{message:"Import now"})})]})})}const Ex=[{path:"search",element:e.jsx(Lx,{})},{path:"videos",element:e.jsx(dx,{})},{path:"content",element:e.jsx(Cx,{})}];function zx(){const{trans:s}=z();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(ws,{children:[e.jsxs(Ss,{children:[e.jsx(fe,{children:e.jsx(n,{message:"General"})}),e.jsx(fe,{children:e.jsx(n,{message:"Invoices"})})]}),e.jsxs(sa,{className:"pt-30",children:[e.jsxs(is,{children:[e.jsx($,{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(Ge,{}),e.jsx(Dx,{}),e.jsx(Ax,{}),e.jsx(Ge,{}),e.jsx(Ft,{label:e.jsx(n,{message:"Accepted cards"}),name:"client.billing.accepted_cards",placeholder:s({message:"Add new card..."})})]}),e.jsxs(is,{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 Dx(){const{watch:s}=P(),t=s("client.billing.paypal.enable");return e.jsxs("div",{className:"mb-30",children:[e.jsx($,{name:"client.billing.paypal.enable",description:e.jsxs("div",{children:[e.jsx(n,{message:"Enable PayPal payment gateway integration."}),e.jsx(pt,{className:"mt-6",link:"https://support.vebto.com/hc/articles/147/configuring-paypal"})]}),children:e.jsx(n,{message:"PayPal gateway"})}),t?e.jsx(ve,{name:"paypal_group",children:a=>e.jsxs(m.Fragment,{children:[e.jsx(p,{name:"server.paypal_client_id",label:e.jsx(n,{message:"PayPal Client ID"}),required:!0,invalid:a,className:"mb-20"}),e.jsx(p,{name:"server.paypal_secret",label:e.jsx(n,{message:"PayPal Secret"}),required:!0,invalid:a,className:"mb-20"}),e.jsx(p,{name:"server.paypal_webhook_id",label:e.jsx(n,{message:"PayPal Webhook ID"}),required:!0,invalid:a,className:"mb-20"}),e.jsx($,{name:"client.billing.paypal_test_mode",invalid:a,description:e.jsx("div",{children:e.jsx(n,{message:"Allows testing PayPal payments with sandbox accounts."})}),children:e.jsx(n,{message:"PayPal test mode"})})]})}):null]})}function Ax(){const{watch:s}=P(),t=s("client.billing.stripe.enable");return e.jsxs(m.Fragment,{children:[e.jsx($,{name:"client.billing.stripe.enable",description:e.jsxs("div",{children:[e.jsx(n,{message:"Enable Stripe payment gateway integration."}),e.jsx(pt,{className:"mt-6",link:"https://support.vebto.com/hc/articles/148/configuring-stripe"})]}),children:e.jsx(n,{message:"Stripe gateway"})}),t?e.jsx(ve,{name:"stripe_group",separatorBottom:!1,children:a=>e.jsxs(m.Fragment,{children:[e.jsx(p,{name:"server.stripe_key",label:e.jsx(n,{message:"Stripe publishable key"}),required:!0,className:"mb-20",invalid:a}),e.jsx(p,{name:"server.stripe_secret",label:e.jsx(n,{message:"Stripe secret key"}),required:!0,className:"mb-20",invalid:a}),e.jsx(p,{name:"server.stripe_webhook_secret",label:e.jsx(n,{message:"Stripe webhook signing secret"}),className:"mb-20",invalid:a})]})}):null]})}function $x(){const{data:s}=le(["timezones","localizations"]),t=ut(),{trans:a}=z();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(D,{className:"mb-30",required:!0,name:"client.dates.default_timezone",showSearchField:!0,selectionMode:"single",label:e.jsx(n,{message:"Default timezone"}),searchPlaceholder:a(d("Search timezones")),description:e.jsx(n,{message:"Which timezone should be selected by default for new users and guests."}),children:[e.jsx(h,{value:"auto",children:e.jsx(n,{message:"Auto"})},"auto"),Object.entries((s==null?void 0:s.timezones)||{}).map(([r,i])=>e.jsx(yr,{label:r,children:i.map(l=>e.jsx(h,{value:l.value,children:l.text},l.value))},r))]}),e.jsxs(D,{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(h,{value:"auto",children:e.jsx(n,{message:"Auto"})},"auto"),((s==null?void 0:s.localizations)||[]).map(r=>e.jsx(h,{value:r.language,capitalizeFirst:!0,children:r.name},r.language))]}),e.jsxs(Sr,{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(Qs,{value:"auto",children:e.jsx(n,{message:"Auto"})},"auto"),Object.entries(Nr).map(([r,i])=>e.jsx(Qs,{value:r,children:e.jsx(ne,{date:t,options:i})},r))]}),e.jsx($,{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 Rx(){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(qx,{}),e.jsx($,{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($,{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($,{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(Ox,{}),e.jsx(Ux,{}),e.jsx(Bx,{}),e.jsx(Hx,{}),e.jsx(Ge,{}),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 Vx(){const{watch:s}=P();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:a=>e.jsx(b,{elementType:F,variant:"outline",size:"xs",display:"flex",className:"mt-10 max-w-max",to:"/admin/settings/outgoing-email",children:a})}})})}function qx(){return e.jsx($,{className:"mb-30",name:"client.require_email_confirmation",description:e.jsxs(m.Fragment,{children:[e.jsx(n,{message:"Require newly registered users to validate their email address before being able to login."}),e.jsx(Vx,{})]}),children:e.jsx(n,{message:"Require email confirmation"})})}function Ox(){var r;const{watch:s}=P(),t=ue(),a=s("client.social.envato.enable");return(r=t.envato)!=null&&r.enable?e.jsx(ve,{separatorBottom:!1,name:"envato_group",children:i=>e.jsxs(e.Fragment,{children:[e.jsx($,{invalid:i,name:"client.social.envato.enable",description:e.jsx(n,{message:"Enable logging into the site via envato."}),children:e.jsx(n,{message:"Envato login"})}),!!a&&e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:i,className:"mt-30",name:"server.envato_id",label:e.jsx(n,{message:"Envato ID"}),required:!0}),e.jsx(p,{invalid:i,className:"mt-30",name:"server.envato_secret",label:e.jsx(n,{message:"Envato secret"}),required:!0}),e.jsx(p,{invalid:i,className:"mt-30",name:"server.envato_personal_token",label:e.jsx(n,{message:"Envato personal token"}),required:!0})]})]})}):null}function Ux(){const{watch:s}=P(),t=s("client.social.google.enable");return e.jsx(ve,{name:"google_group",children:a=>e.jsxs(e.Fragment,{children:[e.jsx($,{invalid:a,name:"client.social.google.enable",description:e.jsx(n,{message:"Enable logging into the site via google."}),children:e.jsx(n,{message:"Google login"})}),!!t&&e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:a,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 Bx(){const{watch:s}=P(),t=s("client.social.facebook.enable");return e.jsx(ve,{name:"facebook_group",separatorTop:!1,children:a=>e.jsxs(e.Fragment,{children:[e.jsx($,{invalid:a,name:"client.social.facebook.enable",description:e.jsx(n,{message:"Enable logging into the site via facebook."}),children:e.jsx(n,{message:"Facebook login"})}),!!t&&e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:a,className:"mt-30",name:"server.facebook_id",label:e.jsx(n,{message:"Facebook app ID"}),required:!0}),e.jsx(p,{invalid:a,className:"mt-30",name:"server.facebook_secret",label:e.jsx(n,{message:"Facebook app secret"}),required:!0})]})]})})}function Hx(){const{watch:s}=P(),t=s("client.social.twitter.enable");return e.jsx(ve,{name:"twitter_group",separatorTop:!1,separatorBottom:!1,children:a=>e.jsxs(e.Fragment,{children:[e.jsx($,{invalid:a,name:"client.social.twitter.enable",description:e.jsx(n,{message:"Enable logging into the site via twitter."}),children:e.jsx(n,{message:"Twitter login"})}),!!t&&e.jsxs(e.Fragment,{children:[e.jsx(p,{invalid:a,className:"mt-30",name:"server.twitter_id",label:e.jsx(n,{message:"Twitter ID"}),required:!0}),e.jsx(p,{invalid:a,className:"mt-30",name:"server.twitter_secret",label:e.jsx(n,{message:"Twitter secret"}),required:!0})]})]})})}function Zx(){return S.get("uploads/server-max-file-size").then(s=>s.data)}function Kx(){return be({queryKey:["MaxServerUploadSize"],queryFn:()=>Zx()})}const Wx=["B","KB","MB","GB","TB","PB"];function Gn(s,t){if(s==null)return 0;switch(t){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 Qx=0x630000000000,Ys=B.forwardRef(({name:s,...t},a)=>{const{field:{onChange:r,onBlur:i,value:l="",ref:o},fieldState:{invalid:c,error:u}}=ps({name:s}),[x,g]=m.useState(""),[j,v]=m.useState("MB");m.useEffect(()=>{if(l==null||l===""){g("");return}const{amount:y,unit:L}=Gx({bytes:Math.min(l,Qx)});v(L||"MB"),g(Number.isNaN(y)?"":y)},[l,j]);const f={onChange:y=>{const L=parseInt(y.target.value);if(Number.isNaN(L))r(L);else{const k=Gn(parseInt(y.target.value),j);r(k)}},onBlur:i,value:x,invalid:c,errorMessage:u==null?void 0:u.message,inputRef:o},N=e.jsx(Ye,{minWidth:"min-w-80",selectionMode:"single",selectedValue:j,disabled:!l,onSelectionChange:y=>{const L=Gn(x||0,y);r(L)},children:Wx.slice(0,5).map(y=>e.jsx(h,{value:y,children:y==="B"?"Bytes":y},y))});return e.jsx(Be,{...js(f,t),type:"number",ref:a,endAppend:N})}),Gx=kr(({bytes:s})=>{const t=Lr(s);if(!t)return{amount:"",unit:"MB"};let a=parseInt(t.split(" ")[0]);return a=Math.round(a),{amount:a,unit:t.split(" ")[1]}});function Jx(){const{trans:s}=z();return I({mutationFn:()=>Yx(),onSuccess:()=>{M(s(d("CORS file updated")))},onError:t=>q(t)})}function Yx(){return S.post("s3/cors/upload").then(s=>s.data)}function Xx(){return I({mutationFn:s=>eh(s),onError:s=>q(s)})}function eh(s){return S.post("settings/uploading/dropbox-refresh-token",s).then(t=>t.data)}function sh({isInvalid:s}){const{watch:t,setValue:a}=P(),r=t("server.storage_dropbox_app_key"),i=t("server.storage_dropbox_app_secret");return e.jsxs(m.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(A,{type:"modal",onClose:l=>{l&&a("server.storage_dropbox_refresh_token",l)},children:[e.jsx(b,{variant:"outline",color:"primary",size:"xs",disabled:!r||!i,children:e.jsx(n,{message:"Get dropbox refresh token"})}),e.jsx(th,{appKey:r,appSecret:i})]})]})}function th({appKey:s,appSecret:t}){const a=O(),{formId:r,close:i}=K(),l=Xx();return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Connected dropbox account"})}),e.jsx(X,{children:e.jsxs(te,{id:r,form:a,onSubmit:o=>{l.mutate({app_key:s,app_secret:t,access_code:o.accessCode},{onSuccess:c=>{i(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(b,{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(re,{children:[e.jsx(b,{onClick:()=>{i()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",form:r,type:"submit",disabled:!s||!t||l.isPending,children:e.jsx(n,{message:"Connect"})})]})]})}function ah(){const{trans:s}=z();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(rh,{}),e.jsx(ih,{}),e.jsx(lh,{}),e.jsx(ve,{name:"static_delivery_group",children:t=>e.jsxs(Sr,{invalid:t,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(Qs,{value:"",children:e.jsx(n,{message:"None"})}),e.jsx(Qs,{value:"xsendfile",children:e.jsx(n,{message:"X-Sendfile (Apache)"})}),e.jsx(Qs,{value:"xaccel",children:e.jsx(n,{message:"X-Accel (Nginx)"})})]})}),e.jsx(Ys,{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(nh,{}),e.jsx(Ge,{}),e.jsx(Ys,{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(Ys,{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(Ft,{name:"client.uploads.allowed_extensions",className:"mb-30",label:e.jsx(n,{message:"Allowed extensions"}),placeholder:s(d("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(Ft,{name:"client.uploads.blocked_extensions",label:e.jsx(n,{message:"Blocked extensions"}),placeholder:s(d("Add extension...")),description:e.jsx(n,{message:"Prevent uploading of these file types, even if they are allowed above."})})]})}function nh(){const{data:s}=Kx();return e.jsx(Ue,{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:t=>e.jsx("b",{children:t})}})})}function rh(){const{watch:s,clearErrors:t}=P();return s("server.uploads_disk_driver")?e.jsxs(D,{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:()=>{t()},children:[e.jsx(h,{value:"local",children:e.jsx(n,{message:"Local Disk (Default)"})}),e.jsx(h,{value:"ftp",children:"FTP"}),e.jsx(h,{value:"digitalocean_s3",children:"DigitalOcean Spaces"}),e.jsx(h,{value:"backblaze_s3",children:"Backblaze"}),e.jsx(h,{value:"s3",children:"Amazon S3 (Or compatible service)"}),e.jsx(h,{value:"dropbox",children:"Dropbox"}),e.jsx(h,{value:"rackspace",children:"Rackspace"})]}):null}function ih(){const{watch:s,clearErrors:t}=P();return s("server.public_disk_driver")?e.jsxs(D,{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:()=>{t()},children:[e.jsx(h,{value:"local",children:e.jsx(n,{message:"Local Disk (Default)"})}),e.jsx(h,{value:"s3",children:"Amazon S3"}),e.jsx(h,{value:"ftp",children:"FTP"}),e.jsx(h,{value:"digitalocean_s3",children:"DigitalOcean Spaces"}),e.jsx(h,{value:"backblaze_s3",children:"Backblaze"})]}):null}function lh(){const{watch:s}=P(),t=[s("server.uploads_disk_driver"),s("server.public_disk_driver")];return t[0]==="local"&&t[1]==="local"?null:e.jsx(ve,{separatorBottom:!1,name:"storage_group",children:a=>{if(t.includes("s3"))return e.jsx(oh,{isInvalid:a});if(t.includes("ftp"))return e.jsx(uh,{isInvalid:a});if(t.includes("dropbox"))return e.jsx(sh,{isInvalid:a});if(t.includes("digitalocean_s3"))return e.jsx(ch,{isInvalid:a});if(t.includes("backblaze_s3"))return e.jsx(dh,{isInvalid:a})}})}function oh({isInvalid:s}){return e.jsxs(m.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(hn,{invalid:s})]})}function ch({isInvalid:s}){return e.jsxs(m.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(hn,{invalid:s})]})}function dh({isInvalid:s}){return e.jsxs(m.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(hn,{invalid:s})]})}function hn({invalid:s}){var i,l;const t=Jx(),{data:a}=gt(),r=((i=a==null?void 0:a.server.uploads_disk_driver)==null?void 0:i.endsWith("s3"))||((l=a==null?void 0:a.server.public_disk_driver)==null?void 0:l.endsWith("s3"));return e.jsxs(m.Fragment,{children:[e.jsx($,{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(b,{variant:"flat",color:"primary",size:"xs",className:"mt-20",onClick:()=>{t.mutate()},disabled:!r||t.isPending,children:e.jsx(n,{message:"Configure CORS"})})]})}function uh({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($,{invalid:s,name:"server.storage_ftp_passive",className:"mb-30",children:e.jsx(n,{message:"Passive"})}),e.jsx($,{invalid:s,name:"server.storage_ftp_ssl",children:e.jsx(n,{message:"SSL"})})]})}function mh({isInvalid:s}){return e.jsxs(m.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 xh({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(D,{selectionMode:"single",invalid:s,className:"mb-30",name:"server.mail_encryption",label:e.jsx(n,{message:"SMTP encryption"}),children:[e.jsx(h,{value:"",children:e.jsx(n,{message:"None"})}),e.jsx(h,{value:"tls",children:e.jsx(n,{message:"TLS"})})]})]})}function hh({isInvalid:s}){return e.jsxs(m.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 gh({isInvalid:s}){return e.jsx(p,{invalid:s,name:"server.postmark_token",label:e.jsx(n,{message:"Postmark token"}),required:!0})}const Jn=T([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 ph(){const{watch:s,setValue:t}=P(),{connectSocial:a}=Do(),r=s("server.connectedGmailAccount"),i=async()=>{const c=await a("secure/settings/mail/gmail/connect");if((c==null?void 0:c.status)==="SUCCESS"){const u=c.callbackData.profile.email;t("server.connectedGmailAccount",u),M(d("Connected gmail account: :email",{values:{email:u}}))}},l=e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(Jn,{}),onClick:()=>{i()},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(Jn,{size:"lg"}),r,e.jsx(b,{variant:"text",color:"primary",className:"ml-auto",onClick:()=>{i()},children:e.jsx(n,{message:"Reconnect"})})]});return e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"mb-6 text-sm",children:e.jsx(n,{message:"Gmail account"})}),r?o:l]})}function jh(){const{watch:s,clearErrors:t}=P(),a=s("server.mail_driver"),r=[];return a==="mailgun"&&r.push(mh),a==="smtp"&&r.push(xh),a==="ses"&&r.push(hh),a==="postmark"&&r.push(gh),a==="gmailApi"&&r.push(ph),e.jsx(ve,{separatorTop:!1,separatorBottom:!1,name:"mail_group",children:i=>e.jsxs(m.Fragment,{children:[e.jsxs(D,{onSelectionChange:()=>{t()},invalid:i,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(pt,{className:"mt-8",link:"https://support.vebto.com/hc/articles/42/44/155/incoming-emails"})]}),children:[e.jsx(h,{value:"mailgun",children:"Mailgun"}),e.jsx(h,{value:"gmailApi",children:"Gmail Api"}),e.jsx(h,{value:"smtp",children:"SMTP"}),e.jsx(h,{value:"postmark",children:"Postmark"}),e.jsx(h,{value:"ses",children:"Ses (Amazon Simple Email Service)"}),e.jsx(h,{value:"sendmail",children:"SendMail"}),e.jsx(h,{value:"log",children:"Log (Email will be saved to error log)"})]}),r.length?e.jsx("div",{className:"mt-30",children:r.map((l,o)=>e.jsx(l,{isInvalid:i},o))}):null]})})}function fh(){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(bh,{}),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(Ue,{color:"warning",description:e.jsx(n,{message:"Your selected mail method must be authorized to send emails using this address and name."})}),e.jsx(Ge,{}),e.jsx(jh,{})]})}function bh(){const{base_url:s}=ue(),t=`${s}/contact`,a=e.jsx(Ot,{href:t,children:t});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:a},message:"Where emails from :contactPageUrl page should be sent to."})})}function vh(){return S.post("cache/flush").then(s=>s.data)}function yh(){return I({mutationFn:()=>vh(),onSuccess:()=>{M(d("Cache cleared"))},onError:s=>q(s)})}function Ch(){const s=yh();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(wh,{}),e.jsx(b,{type:"button",variant:"outline",size:"xs",color:"primary",disabled:s.isPending,onClick:()=>{s.mutate()},children:e.jsx(n,{message:"Clear cache"})}),e.jsx(Ue,{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 wh(){const{watch:s,clearErrors:t}=P(),a=s("server.cache_driver");let r=null;return a==="memcached"&&(r=Sh),e.jsx(ve,{separatorTop:!1,name:"cache_group",children:i=>e.jsxs(e.Fragment,{children:[e.jsxs(D,{invalid:i,onSelectionChange:()=>{t()},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(h,{value:"file",children:e.jsx(n,{message:"File (Default)"})}),e.jsx(h,{value:"array",children:e.jsx(n,{message:"None"})}),e.jsx(h,{value:"apc",children:"APC"}),e.jsx(h,{value:"memcached",children:"Memcached"}),e.jsx(h,{value:"redis",children:"Redis"})]}),r&&e.jsx("div",{className:"mt-30",children:e.jsx(r,{isInvalid:i})})]})})}function Sh({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 Nh(){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(kh,{}),e.jsx(Ue,{className:"mt-30",color:"positive",description:e.jsx(n,{values:{a:s=>e.jsx(Ot,{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 kh(){const{clearErrors:s}=P();return e.jsx(ve,{separatorTop:!1,separatorBottom:!1,name:"logging_group",children:t=>e.jsx(p,{onChange:()=>{s()},invalid:t,name:"server.sentry_dsn",type:"url",minLength:30,label:e.jsx(n,{message:"Sentry DSN"})})})}function Lh(){return e.jsxs(Ne,{title:e.jsx(n,{message:"Queue"}),description:e.jsx(n,{message:"Select active queue method and enter related 3rd party API keys."}),children:[e.jsx(Ue,{color:"positive",className:"mb-30",description:e.jsx(n,{message:"Queues allow to defer time consuming tasks, such as sending an email, until a later time. Deferring these tasks can speed up web requests to the application."})}),e.jsx(Ue,{color:"warning",className:"mb-30",description:e.jsx(n,{message:"All methods except sync require additional setup, which should be performed before changing the queue method. Consult documentation for more information."})}),e.jsx(_h,{})]})}function _h(){const{watch:s,clearErrors:t}=P(),a=s("server.queue_driver");let r=null;return a==="sqs"&&(r=Mh),e.jsx(ve,{separatorTop:!1,separatorBottom:!1,name:"queue_group",children:i=>e.jsxs(e.Fragment,{children:[e.jsxs(D,{invalid:i,onSelectionChange:()=>{t()},selectionMode:"single",name:"server.queue_driver",label:e.jsx(n,{message:"Queue method"}),required:!0,children:[e.jsx(h,{value:"sync",children:e.jsx(n,{message:"Sync (Default)"})}),e.jsx(h,{value:"beanstalkd",children:"Beanstalkd"}),e.jsx(h,{value:"database",children:e.jsx(n,{message:"Database"})}),e.jsx(h,{value:"sqs",children:e.jsx(n,{message:"SQS (Amazon simple queue service)"})}),e.jsx(h,{value:"redis",children:"Redis"})]}),r&&e.jsx("div",{className:"mt-30",children:e.jsx(r,{isInvalid:i})})]})})}function Mh({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 Ih(){const{settings:s}=m.useContext(Xe);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($,{className:"mb-30",name:"client.recaptcha.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($,{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($,{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(Fh,{})]})}function Fh(){const{clearErrors:s}=P();return e.jsx(ve,{separatorTop:!1,separatorBottom:!1,name:"recaptcha_group",children:t=>e.jsxs(e.Fragment,{children:[e.jsx(p,{className:"mb-30",onChange:()=>{s()},invalid:t,name:"client.recaptcha.site_key",label:e.jsx(n,{message:"Recaptcha v3 site key"})}),e.jsx(p,{onChange:()=>{s()},invalid:t,name:"client.recaptcha.secret_key",label:e.jsx(n,{message:"Recaptcha v3 secret key"})})]})})}const Ph=B.forwardRef((s,t)=>{const a=Ao(t),{fieldProps:r,inputProps:i}=$o({...s,focusRef:a}),l=Ta(s);return e.jsx($a,{ref:t,fieldClassNames:l,...r,children:e.jsx("input",{type:"file",ref:a,...i,className:w(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 Th({name:s,...t}){const{field:{onChange:a,onBlur:r,ref:i},fieldState:{invalid:l,error:o}}=ps({name:s}),[c,u]=B.useState(""),x={onChange:g=>{var j;a((j=g.target.files)==null?void 0:j[0]),u(g.target.value)},onBlur:r,value:c,invalid:l,errorMessage:o==null?void 0:o.message};return e.jsx(Ph,{ref:i,...js(x,t)})}function Eh(){return e.jsx(Ne,{title:e.jsx(n,{message:"Analytics"}),description:e.jsx(n,{message:"Configure google analytics integration and credentials."}),children:e.jsx(zh,{})})}function zh(){const{clearErrors:s}=P();return e.jsx(ve,{separatorTop:!1,separatorBottom:!1,name:"analytics_group",children:t=>e.jsxs(m.Fragment,{children:[e.jsx(Th,{className:"mb-30",onChange:()=>{s()},invalid:t,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:t,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:t,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 Dh(s){const t=Y();return I({mutationFn:a=>Ah(a),onSuccess:(a,r)=>{M(d("User updated")),_.invalidateQueries({queryKey:["users"]}),t("/admin/users")},onError:a=>ee(a,s)})}function Ah({id:s,...t}){return t.roles&&(t.roles=t.roles.map(a=>a.id)),S.put(`users/${s}`,t).then(a=>a.data)}function cl({onSubmit:s,form:t,title:a,subTitle:r,isLoading:i,avatarManager:l,resendEmailButton:o,children:c}){const{require_email_confirmation:u}=ue(),{data:x}=le(["roles","permissions"]);return e.jsxs(We,{onSubmit:s,form:t,title:a,subTitle:r,isLoading:i,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($,{className:w(o&&"mb-30"),disabled:!u,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(Ys,{className:"mb-30",name:"available_space",label:e.jsx(n,{message:"Allowed storage space"}),description:e.jsx(n,{values:{a:g=>e.jsx(F,{className:lt,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(Vs,{className:"mb-30",name:"roles",label:e.jsx(n,{message:"Roles"}),suggestions:x==null?void 0:x.roles,children:g=>e.jsx(h,{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(cn,{name:"permissions"})]})]})}const $h=T([e.jsx("path",{d:"M15.73 3H8.27L3 8.27v7.46L8.27 21h7.46L21 15.73V8.27L15.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 Rh(){var x,g,j;const s=O(),{require_email_confirmation:t}=ue(),{userId:a}=V(),r=Dh(s),i=Ro(),{data:l,isLoading:o}=Vo(a,{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(m.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(_e,{});const u=e.jsx(b,{size:"xs",variant:"outline",color:"primary",disabled:!t||i.isPending||((j=l==null?void 0:l.user)==null?void 0:j.email_verified_at)!=null,onClick:()=>{i.mutate({email:l.user.email})},children:e.jsx(n,{message:"Resend email"})});return e.jsx(cl,{onSubmit:v=>{r.mutate(v)},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($h,{}),e.jsx("div",{children:e.jsx(n,{message:"Suspended: :reason",values:{reason:c}})})]}),isLoading:r.isPending,avatarManager:e.jsx(Vh,{user:l.user,onChange:()=>{_.invalidateQueries({queryKey:["users"]})}}),resendEmailButton:u,children:e.jsx(p,{className:"mb-30",name:"password",type:"password",label:e.jsx(n,{message:"New password"})})})}function Vh({user:s,onChange:t}){const a=qo({user:s}),r=Oo({user:s});return e.jsx(we,{children:e.jsx(Le,{name:"avatar",diskPrefix:"avatars",variant:"avatar",stretchPreview:!0,label:e.jsx(n,{message:"Profile image"}),previewSize:"w-90 h-90",showRemoveButton:!0,onChange:i=>{i?a.mutate({url:i}):r.mutate(),t()}})})}function qh(s){const t=Y();return I({mutationFn:a=>Oh(a),onSuccess:()=>{M(d("User created")),_.invalidateQueries({queryKey:J("users")}),t("/admin/users")},onError:a=>ee(a,s)})}function Oh(s){return s.roles&&(s.roles=s.roles.map(t=>t.id)),S.post("users",s).then(t=>t.data)}function Uh(){const s=O(),t=qh(s),a=e.jsx(we,{children:e.jsx(Le,{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(cl,{onSubmit:r=>{t.mutate(r)},form:s,title:e.jsx(n,{message:"Add new user"}),isLoading:t.isPending,avatarManager:a,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 Bh=T(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"),gn=s=>{const t=["getLocaleWithLines"];return s!=null&&t.push(s),t};function Hh(s){return be({queryKey:gn(s),queryFn:()=>Zh(s),staleTime:1/0})}function Zh(s){return S.get(`localizations/${s}`).then(t=>t.data)}function Kh({id:s,...t}){return S.put(`localizations/${s}`,t).then(a=>a.data)}function dl(s){return I({mutationFn:t=>Kh(t),onSuccess:()=>{M(d("Localization updated")),_.invalidateQueries({queryKey:J("localizations")}),_.invalidateQueries({queryKey:gn()})},onError:t=>s?ee(t,s):q(t)})}function Wh({localization:s}){const{trans:t}=z(),{formId:a,close:r}=K(),i=O({defaultValues:{id:s.id,name:s.name,language:s.language}}),{data:l}=le(["languages"]),o=(l==null?void 0:l.languages)||[],c=dl(i);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Update localization"})}),e.jsx(X,{children:e.jsxs(te,{form:i,id:a,onSubmit:u=>{c.mutate(u,{onSuccess:r})},children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-30",required:!0}),e.jsx(D,{required:!0,name:"language",label:e.jsx(n,{message:"Language"}),selectionMode:"single",showSearchField:!0,searchPlaceholder:t(d("Search languages")),children:o.map(u=>e.jsx(h,{value:u.code,children:u.name},u.code))})]})}),e.jsxs(re,{children:[e.jsx(b,{onClick:r,children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",type:"submit",form:a,disabled:c.isPending,children:e.jsx(n,{message:"Save"})})]})]})}function Qh(s){return S.post("localizations",s).then(t=>t.data)}function Gh(s){const t=Da();return I({mutationFn:a=>Qh(a),onSuccess:()=>{M(d("Localization created")),t.invalidateQueries({queryKey:J("localizations")})},onError:a=>ee(a,s)})}function Jh(){const{trans:s}=z(),{formId:t,close:a}=K(),r=O({defaultValues:{language:"en"}}),{data:i}=le(["languages"]),l=(i==null?void 0:i.languages)||[],o=Gh(r);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Create localization"})}),e.jsx(X,{children:e.jsxs(te,{form:r,id:t,onSubmit:c=>{o.mutate(c,{onSuccess:a})},children:[e.jsx(p,{autoFocus:!0,name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-30",required:!0}),e.jsx(D,{required:!0,name:"language",label:e.jsx(n,{message:"Language"}),selectionMode:"single",showSearchField:!0,searchPlaceholder:s(d("Search languages")),children:l.map(c=>e.jsx(h,{value:c.code,children:c.name},c.code))})]})}),e.jsxs(re,{children:[e.jsx(b,{onClick:a,children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",type:"submit",form:t,disabled:o.isPending,children:e.jsx(n,{message:"Save"})})]})]})}const Yh=""+new URL("around-the-world-df9b11c5.svg",import.meta.url).href;function ul(){return I({mutationFn:s=>Xh(s),onSuccess:async()=>{await _.invalidateQueries({queryKey:J("localizations")}),await _.invalidateQueries({queryKey:gn()}),M(d("Translation file uploaded"))},onError:s=>q(s)})}function Xh({localeId:s,file:t}){const a=new FormData;return a.append("file",t.native),S.post(`localizations/${s}/upload`,a).then(r=>r.data)}const eg=[{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(ne,{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(W,{label:e.jsx(n,{message:"Translate"}),children:e.jsx(C,{size:"md",elementType:F,to:`${s.id}/translate`,children:e.jsx(Bh,{})})}),e.jsx(we,{children:e.jsx(ag,{locale:s})})]})}];function sg(){return e.jsx(he,{endpoint:"localizations",title:e.jsx(n,{message:"Localizations"}),columns:eg,actions:e.jsx(tg,{}),selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:Yh,title:e.jsx(n,{message:"No localizations have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching localizations"})})})}function tg(){return e.jsx(m.Fragment,{children:e.jsxs(A,{type:"modal",children:[e.jsx(je,{children:e.jsx(n,{message:"Add new localization"})}),e.jsx(Jh,{})]})})}function ag({locale:s}){const t=ul();return e.jsxs(Ze,{children:[e.jsx(C,{disabled:t.isPending,children:e.jsx(Gt,{})}),e.jsxs(Ke,{children:[e.jsx(h,{value:"translate",elementType:F,to:`${s.id}/translate`,children:e.jsx(n,{message:"Translate"})}),e.jsx(h,{value:"rename",onSelected:()=>$s(Wh,{localization:s}),children:e.jsx(n,{message:"Rename"})}),e.jsx(h,{value:"download",onSelected:()=>Ls(`api/v1/localizations/${s.id}/download`),children:e.jsx(n,{message:"Download"})}),e.jsx(h,{value:"upload",onSelected:async()=>{const a=await Ra({types:[Ut.json]});a.length==1&&t.mutate({localeId:s.id,file:a[0]})},children:e.jsx(n,{message:"Upload"})})]})]})}function ng(){const{formId:s,close:t}=K(),a=O();return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Add translation"})}),e.jsx(X,{children:e.jsxs(te,{form:a,id:s,onSubmit:r=>{t(r)},children:[e.jsx(Ue,{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(re,{children:[e.jsx(b,{onClick:t,children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",type:"submit",form:s,children:e.jsx(n,{message:"Add"})})]})]})}/**
* react-virtual
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Pt(){return Pt=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])}return s},Pt.apply(this,arguments)}/**
* virtual-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Tt(){return Tt=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])}return s},Tt.apply(this,arguments)}/**
* virtual-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Es(s,t,a){var r,i=(r=a.initialDeps)!=null?r:[],l;return function(){var o;a.key&&a.debug!=null&&a.debug()&&(o=Date.now());var c=s(),u=c.length!==i.length||c.some(function(N,y){return i[y]!==N});if(!u)return l;i=c;var x;if(a.key&&a.debug!=null&&a.debug()&&(x=Date.now()),l=t.apply(void 0,c),a.key&&a.debug!=null&&a.debug()){var g=Math.round((Date.now()-o)*100)/100,j=Math.round((Date.now()-x)*100)/100,v=j/16,f=function(y,L){for(y=String(y);y.length<L;)y=" "+y;return y};console.info("%c⏱ "+f(j,5)+" /"+f(g,5)+" ms",`
font-size: .6rem;
font-weight: bold;
color: hsl(`+Math.max(0,Math.min(120-120*v,120))+"deg 100% 31%);",a==null?void 0:a.key)}return a==null||a.onChange==null||a.onChange(l),l}}function ma(s,t){if(s===void 0)throw new Error("Unexpected undefined"+(t?": "+t:""));return s}var rg=function(t,a){return Math.abs(t-a)<1};/**
* virtual-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/var ig=function(t){return t},lg=function(t){for(var a=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1),i=[],l=a;l<=r;l++)i.push(l);return i},og=function(t,a){var r=t.scrollElement;if(r){var i=function(c){var u=c.width,x=c.height;a({width:Math.round(u),height:Math.round(x)})};i(r.getBoundingClientRect());var l=new ResizeObserver(function(o){var c=o[0];if(c!=null&&c.borderBoxSize){var u=c.borderBoxSize[0];if(u){i({width:u.inlineSize,height:u.blockSize});return}}i(r.getBoundingClientRect())});return l.observe(r,{box:"border-box"}),function(){l.unobserve(r)}}},cg=function(t,a){var r=t.scrollElement;if(r){var i=function(){a(r[t.options.horizontal?"scrollLeft":"scrollTop"])};return i(),r.addEventListener("scroll",i,{passive:!0}),function(){r.removeEventListener("scroll",i)}}},dg=function(t,a,r){if(a!=null&&a.borderBoxSize){var i=a.borderBoxSize[0];if(i){var l=Math.round(i[r.options.horizontal?"inlineSize":"blockSize"]);return l}}return Math.round(t.getBoundingClientRect()[r.options.horizontal?"width":"height"])},ug=function(t,a,r){var i,l,o=a.adjustments,c=o===void 0?0:o,u=a.behavior,x=t+c;(i=r.scrollElement)==null||i.scrollTo==null||i.scrollTo((l={},l[r.options.horizontal?"left":"top"]=x,l.behavior=u,l))},mg=function(t){var a=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 r=null,i=function(){return r||(typeof ResizeObserver<"u"?r=new ResizeObserver(function(o){o.forEach(function(c){a._measureElement(c.target,c)})}):null)};return{disconnect:function(){var o;return(o=i())==null?void 0:o.disconnect()},observe:function(o){var c;return(c=i())==null?void 0:c.observe(o,{box:"border-box"})},unobserve:function(o){var c;return(c=i())==null?void 0:c.unobserve(o)}}}(),this.range=null,this.setOptions=function(r){Object.entries(r).forEach(function(i){var l=i[0],o=i[1];typeof o>"u"&&delete r[l]}),a.options=Tt({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ig,rangeExtractor:lg,onChange:function(){},measureElement:dg,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1},r)},this.notify=function(r){a.options.onChange==null||a.options.onChange(a,r)},this.maybeNotify=Es(function(){return a.calculateRange(),[a.isScrolling,a.range?a.range.startIndex:null,a.range?a.range.endIndex:null]},function(r){a.notify(r)},{key:!1,debug:function(){return a.options.debug},initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=function(){a.unsubs.filter(Boolean).forEach(function(r){return r()}),a.unsubs=[],a.scrollElement=null},this._didMount=function(){return a.measureElementCache.forEach(a.observer.observe),function(){a.observer.disconnect(),a.cleanup()}},this._willUpdate=function(){var r=a.options.getScrollElement();a.scrollElement!==r&&(a.cleanup(),a.scrollElement=r,a._scrollToOffset(a.scrollOffset,{adjustments:void 0,behavior:void 0}),a.unsubs.push(a.options.observeElementRect(a,function(i){a.scrollRect=i,a.maybeNotify()})),a.unsubs.push(a.options.observeElementOffset(a,function(i){a.scrollAdjustments=0,a.scrollOffset!==i&&(a.isScrollingTimeoutId!==null&&(clearTimeout(a.isScrollingTimeoutId),a.isScrollingTimeoutId=null),a.isScrolling=!0,a.scrollDirection=a.scrollOffset<i?"forward":"backward",a.scrollOffset=i,a.maybeNotify(),a.isScrollingTimeoutId=setTimeout(function(){a.isScrollingTimeoutId=null,a.isScrolling=!1,a.scrollDirection=null,a.maybeNotify()},a.options.scrollingDelay))})))},this.getSize=function(){return a.scrollRect[a.options.horizontal?"width":"height"]},this.memoOptions=Es(function(){return[a.options.count,a.options.paddingStart,a.options.scrollMargin,a.options.getItemKey]},function(r,i,l,o){return a.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:i,scrollMargin:l,getItemKey:o}},{key:!1}),this.getFurthestMeasurement=function(r,i){for(var l=new Map,o=new Map,c=i-1;c>=0;c--){var u=r[c];if(!l.has(u.lane)){var x=o.get(u.lane);if(x==null||u.end>x.end?o.set(u.lane,u):u.end<x.end&&l.set(u.lane,!0),l.size===a.options.lanes)break}}return o.size===a.options.lanes?Array.from(o.values()).sort(function(g,j){return g.end-j.end})[0]:void 0},this.getMeasurements=Es(function(){return[a.memoOptions(),a.itemSizeCache]},function(r,i){var l=r.count,o=r.paddingStart,c=r.scrollMargin,u=r.getItemKey,x=a.pendingMeasuredCacheIndexes.length>0?Math.min.apply(Math,a.pendingMeasuredCacheIndexes):0;a.pendingMeasuredCacheIndexes=[];for(var g=a.measurementsCache.slice(0,x),j=x;j<l;j++){var v=u(j),f=a.options.lanes===1?g[j-1]:a.getFurthestMeasurement(g,j),N=f?f.end:o+c,y=i.get(v),L=typeof y=="number"?y:a.options.estimateSize(j),k=N+L,E=f?f.lane:j%a.options.lanes;g[j]={index:j,start:N,size:L,end:k,key:v,lane:E}}return a.measurementsCache=g,g},{key:!1,debug:function(){return a.options.debug}}),this.calculateRange=Es(function(){return[a.getMeasurements(),a.getSize(),a.scrollOffset]},function(r,i,l){return a.range=r.length>0&&i>0?xg({measurements:r,outerSize:i,scrollOffset:l}):null},{key:!1,debug:function(){return a.options.debug}}),this.getIndexes=Es(function(){return[a.options.rangeExtractor,a.calculateRange(),a.options.overscan,a.options.count]},function(r,i,l,o){return i===null?[]:r(Tt({},i,{overscan:l,count:o}))},{key:!1,debug:function(){return a.options.debug}}),this.indexFromElement=function(r){var i=a.options.indexAttribute,l=r.getAttribute(i);return l?parseInt(l,10):(console.warn("Missing attribute name '"+i+"={index}' on measured element."),-1)},this._measureElement=function(r,i){var l=a.measurementsCache[a.indexFromElement(r)];if(!l||!r.isConnected){a.measureElementCache.forEach(function(u,x){u===r&&(a.observer.unobserve(r),a.measureElementCache.delete(x))});return}var o=a.measureElementCache.get(l.key);o!==r&&(o&&a.observer.unobserve(o),a.observer.observe(r),a.measureElementCache.set(l.key,r));var c=a.options.measureElement(r,i,a);a.resizeItem(l,c)},this.resizeItem=function(r,i){var l,o=(l=a.itemSizeCache.get(r.key))!=null?l:r.size,c=i-o;c!==0&&(r.start<a.scrollOffset&&a._scrollToOffset(a.scrollOffset,{adjustments:a.scrollAdjustments+=c,behavior:void 0}),a.pendingMeasuredCacheIndexes.push(r.index),a.itemSizeCache=new Map(a.itemSizeCache.set(r.key,i)),a.notify(!1))},this.measureElement=function(r){r&&a._measureElement(r,void 0)},this.getVirtualItems=Es(function(){return[a.getIndexes(),a.getMeasurements()]},function(r,i){for(var l=[],o=0,c=r.length;o<c;o++){var u=r[o],x=i[u];l.push(x)}return l},{key:!1,debug:function(){return a.options.debug}}),this.getVirtualItemForOffset=function(r){var i=a.getMeasurements();return ma(i[ml(0,i.length-1,function(l){return ma(i[l]).start},r)])},this.getOffsetForAlignment=function(r,i){var l=a.getSize();i==="auto"&&(r<=a.scrollOffset?i="start":r>=a.scrollOffset+l?i="end":i="start"),i==="start"?r=r:i==="end"?r=r-l:i==="center"&&(r=r-l/2);var o=a.options.horizontal?"scrollWidth":"scrollHeight",c=a.scrollElement?"document"in a.scrollElement?a.scrollElement.document.documentElement[o]:a.scrollElement[o]:0,u=c-a.getSize();return Math.max(Math.min(u,r),0)},this.getOffsetForIndex=function(r,i){i===void 0&&(i="auto"),r=Math.max(0,Math.min(r,a.options.count-1));var l=ma(a.getMeasurements()[r]);if(i==="auto")if(l.end>=a.scrollOffset+a.getSize()-a.options.scrollPaddingEnd)i="end";else if(l.start<=a.scrollOffset+a.options.scrollPaddingStart)i="start";else return[a.scrollOffset,i];var o=i==="end"?l.end+a.options.scrollPaddingEnd:l.start-a.options.scrollPaddingStart;return[a.getOffsetForAlignment(o,i),i]},this.isDynamicMode=function(){return a.measureElementCache.size>0},this.cancelScrollToIndex=function(){a.scrollToIndexTimeoutId!==null&&(clearTimeout(a.scrollToIndexTimeoutId),a.scrollToIndexTimeoutId=null)},this.scrollToOffset=function(r,i){var l=i===void 0?{}:i,o=l.align,c=o===void 0?"start":o,u=l.behavior;a.cancelScrollToIndex(),u==="smooth"&&a.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),a._scrollToOffset(a.getOffsetForAlignment(r,c),{adjustments:void 0,behavior:u})},this.scrollToIndex=function(r,i){var l=i===void 0?{}:i,o=l.align,c=o===void 0?"auto":o,u=l.behavior;r=Math.max(0,Math.min(r,a.options.count-1)),a.cancelScrollToIndex(),u==="smooth"&&a.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var x=a.getOffsetForIndex(r,c),g=x[0],j=x[1];a._scrollToOffset(g,{adjustments:void 0,behavior:u}),u!=="smooth"&&a.isDynamicMode()&&(a.scrollToIndexTimeoutId=setTimeout(function(){a.scrollToIndexTimeoutId=null;var v=a.measureElementCache.has(a.options.getItemKey(r));if(v){var f=a.getOffsetForIndex(r,j),N=f[0];rg(N,a.scrollOffset)||a.scrollToIndex(r,{align:j,behavior:u})}else a.scrollToIndex(r,{align:j,behavior:u})}))},this.scrollBy=function(r,i){var l=i===void 0?{}:i,o=l.behavior;a.cancelScrollToIndex(),o==="smooth"&&a.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),a._scrollToOffset(a.scrollOffset+r,{adjustments:void 0,behavior:o})},this.getTotalSize=function(){var r;return(((r=a.getMeasurements()[a.options.count-1])==null?void 0:r.end)||a.options.paddingStart)-a.options.scrollMargin+a.options.paddingEnd},this._scrollToOffset=function(r,i){var l=i.adjustments,o=i.behavior;a.options.scrollToFn(r,{behavior:o,adjustments:l},a)},this.measure=function(){a.itemSizeCache=new Map,a.notify(!1)},this.setOptions(t),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(r){a.itemSizeCache.set(r.key,r.size)}),this.maybeNotify()},ml=function(t,a,r,i){for(;t<=a;){var l=(t+a)/2|0,o=r(l);if(o<i)t=l+1;else if(o>i)a=l-1;else return l}return t>0?t-1:0};function xg(s){for(var t=s.measurements,a=s.outerSize,r=s.scrollOffset,i=t.length-1,l=function(x){return t[x].start},o=ml(0,i,l,r),c=o;c<i&&t[c].end<r+a;)c++;return{startIndex:o,endIndex:c}}/**
* react-virtual
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/var hg=typeof document<"u"?m.useLayoutEffect:m.useEffect;function gg(s){var t=m.useReducer(function(){return{}},{})[1],a=Pt({},s,{onChange:function(o,c){c?Uo.flushSync(t):t(),s.onChange==null||s.onChange(o,c)}}),r=m.useState(function(){return new mg(a)}),i=r[0];return i.setOptions(a),m.useEffect(function(){return i._didMount()},[]),hg(function(){return i._willUpdate()}),i}function pg(s){return gg(Pt({observeElementRect:og,observeElementOffset:cg,scrollToFn:ug},s))}function jg(){const{localeId:s}=V(),{data:t,isLoading:a}=Hh(s),r=t==null?void 0:t.localization;return a||!r?e.jsx(_e,{}):e.jsx(fg,{localization:r})}function fg({localization:s}){const[t,a]=m.useState(s.lines||{}),r=Y(),i=dl(),[l,o]=m.useState("");return e.jsxs("form",{className:"flex h-full flex-col p-14 md:p-24",onSubmit:c=>{c.preventDefault(),i.mutate({id:s.id,lines:t},{onSuccess:()=>{r("/admin/localizations")}})},children:[e.jsx(bg,{localization:s,setLines:a,lines:t,searchQuery:l,setSearchQuery:o,isLoading:i.isPending}),e.jsx(vg,{lines:t,setLines:a,searchQuery:l})]})}function bg({localization:s,searchQuery:t,setSearchQuery:a,isLoading:r,lines:i,setLines:l}){const o=Y(),c=Ae(),{trans:u}=z();return e.jsxs("div",{className:"flex-shrink-0",children:[e.jsxs(ii,{size:"lg",className:"mb-16",children:[e.jsx(It,{onSelected:()=>{o("/admin/localizations")},children:e.jsx(n,{message:"Localizations"})}),e.jsx(It,{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(Be,{value:t,onChange:x=>a(x.target.value),startAdornment:e.jsx(it,{}),placeholder:u({message:"Type to search..."})})}),e.jsxs(A,{type:"modal",onClose:x=>{if(x){const g={...i};g[x.key]=x.value,l(g)}},children:[!c&&e.jsx(b,{className:"ml-auto",variant:"outline",color:"primary",startIcon:e.jsx(me,{}),children:e.jsx(n,{message:"Add new"})}),e.jsx(ng,{})]}),e.jsx(yg,{locale:s}),e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:r,children:c?e.jsx(n,{message:"Save"}):e.jsx(n,{message:"Save translations"})})]})]})}function vg({searchQuery:s,lines:t,setLines:a}){const r=m.useMemo(()=>Object.entries(t).filter(([o,c])=>{const u=s==null?void 0:s.toLowerCase();return!u||(o==null?void 0:o.toLowerCase().includes(u))||(c==null?void 0:c.toLowerCase().includes(u))}),[t,s]),i=m.useRef(null),l=pg({count:r.length,getScrollElement:()=>i.current,estimateSize:()=>123});return e.jsx("div",{className:"flex-auto overflow-y-auto",ref:i,children:e.jsx("div",{className:"relative w-full",style:{height:`${l.getTotalSize()}px`},children:l.getVirtualItems().map(o=>{const[c,u]=r[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(C,{size:"xs",className:"text-muted",onClick:()=>{const x={...t};delete x[c],a(x)},children:e.jsx($e,{})})]}),e.jsx("div",{children:e.jsx("textarea",{id:c,name:c,defaultValue:u,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={...t};g[c]=x.target.value,a(g)}})})]})},c)})})})}function yg({locale:s}){const t=ul();return e.jsxs(Ze,{children:[e.jsx(C,{variant:"outline",size:"sm",color:"primary",disabled:t.isPending,children:e.jsx(Gt,{})}),e.jsxs(Ke,{children:[e.jsx(h,{value:"download",onSelected:()=>Ls(`api/v1/localizations/${s.id}/download`),children:e.jsx(n,{message:"Download"})}),e.jsx(h,{value:"upload",onSelected:async()=>{const a=await Ra({types:[Ut.json]});a.length==1&&t.mutate({localeId:s.id,file:a[0]})},children:e.jsx(n,{message:"Upload"})})]})]})}function Cg(){var t;const s=gt();return e.jsxs("div",{className:"container mx-auto p-12 md:p-24",children:[e.jsx(cs,{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(ds,{isIndeterminate:!0}):e.jsx(wg,{defaultValues:((t=s.data)==null?void 0:t.client.ads)||{}})]})}function wg({defaultValues:s}){const{admin:{ads:t}}=m.useContext(Xe),a=O({defaultValues:{client:{ads:s}}}),r=ol(a);return e.jsxs(te,{form:a,onSubmit:i=>{r.mutate(i)},children:[t.map(i=>e.jsx(Sg,{adConfig:i},i.slot)),e.jsx($,{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(b,{type:"submit",variant:"flat",color:"primary",disabled:r.isPending,children:e.jsx(n,{message:"Save"})})]})}function Sg({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(A,{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($r,{image:s.image})]})]})}function Ng(){const s=Fs(a=>{var r;return(r=a.config)==null?void 0:r.sections}),t=m.useMemo(()=>s?Object.entries(s||[]).map(([a,r])=>({...r,key:a})).sort((a,r)=>((a==null?void 0:a.position)||1)-((r==null?void 0:r.position)||1)):[],[s]);return e.jsx(m.Fragment,{children:t.map(a=>e.jsx(ke,{to:a.key,elementType:qt,children:e.jsx(n,{...a.label})},a.key))})}const kg=[{key:"type",label:d("Type"),description:d("Type of the role"),defaultOperator:R.ne,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("Sitewide"),value:"sitewide"},{key:"02",label:d("Workspace"),value:"workspace"}]}},Se({description:d("Date role was created")}),Ie({description:d("Date role was last updated")})],Lg=[{key:"name",allowsSorting:!0,visibleInMode:"all",header:()=>e.jsx(n,{message:"Role"}),body:s=>e.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(ne,{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(F,{to:`${s.id}/edit`,children:e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(xe,{})})})}];function _g(){return e.jsx(he,{endpoint:"roles",title:e.jsx(n,{message:"Roles"}),columns:Lg,filters:kg,actions:e.jsx(Mg,{}),selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:at,title:e.jsx(n,{message:"No roles have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching roles"})})})}function Mg(){return e.jsxs(m.Fragment,{children:[e.jsx(ui,{endpoint:"roles/csv/export"}),e.jsx(je,{elementType:F,to:"new",children:e.jsx(n,{message:"Add new role"})})]})}const xl=s=>`roles/${s}`;function Ig(){const{roleId:s}=V();return be({queryKey:[xl(s)],queryFn:()=>Fg(s)})}function Fg(s){return S.get(xl(s)).then(t=>t.data)}const hl=s=>`roles/${s}`;function Pg(){const{trans:s}=z(),t=Y();return I({mutationFn:a=>Tg(a),onSuccess:a=>{M(s(d("Role updated"))),_.invalidateQueries({queryKey:[hl(a.role.id)]}),_.invalidateQueries({queryKey:J("roles")}),t("/admin/roles")},onError:a=>q(a)})}function Tg({id:s,...t}){return S.put(hl(s),t).then(a=>a.data)}function gl({isInternal:s=!1}){const{trans:t}=z(),{workspaces:a}=ue(),{watch:r,setValue:i}=P(),l=r("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:t(d("Role description...")),rows:4,className:"mb-20"}),a.integrated&&e.jsxs(D,{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(h,{value:"sitewide",children:e.jsx(n,{message:"Sitewide"})}),e.jsx(h,{value:"workspace",children:e.jsx(n,{message:"Workspace"})})]}),!s&&e.jsxs(e.Fragment,{children:[e.jsx($,{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($,{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(b,{variant:"outline",size:"xs",onClick:()=>i("permissions",[]),children:e.jsx(n,{message:"Remove all"})})]}),e.jsx(cn,{name:"permissions",valueListKey:l==="sitewide"?"permissions":"workspacePermissions"})]})}function Eg({onUserSelected:s}){var x;const{close:t}=K(),[a,r]=m.useState(""),{trans:i}=z(),l=Rr("normalized-models/user",{query:a,perPage:14}),o=((x=l.data)==null?void 0:x.results)||[],c=e.jsx(He,{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(At,{src:at})}),u=g=>{t(),s(g)};return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Select a user"})}),e.jsxs(X,{children:[e.jsx(Be,{autoFocus:!0,className:"mb-20",startAdornment:e.jsx(it,{}),placeholder:i(d("Search for user by name or email")),value:a,onChange:g=>{r(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(zg,{user:g,onUserSelected:u},g.id))})]})]})}function zg({user:s,onUserSelected:t}){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:()=>{t(s)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t(s))},children:[e.jsx(Wa,{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 Dg(s){return I({mutationFn:({userIds:t})=>Ag({userIds:t,roleId:s.id}),onSuccess:(t,a)=>{M(d("Removed [one 1 user|other :count users] from “{role}“",{values:{count:a.userIds.length,role:s.name}}))},onError:t=>q(t)})}function Ag({roleId:s,userIds:t}){return S.post(`roles/${s}/remove-users`,{userIds:t}).then(a=>a.data)}function $g(s){return I({mutationFn:({userIds:t})=>Rg({userIds:t,roleId:s.id}),onSuccess:(t,a)=>{M(d("Assigned [one 1 user|other :count users] to {role}",{values:{count:a.userIds.length,role:s.name}}))},onError:t=>q(t)})}function Rg({roleId:s,userIds:t}){return S.post(`roles/${s}/add-users`,{userIds:t}).then(a=>a.data)}const pl={key:"name",allowsSorting:!0,sortingKey:"email",header:()=>e.jsx(n,{message:"User"}),body:s=>e.jsx(us,{image:s.avatar,label:s.display_name,description:s.email}),width:"col-w-3"},Vg=[pl,{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(ne,{date:s.created_at})}],qg=[pl];function Og({role:s}){const t=Ae();return s.guests||s.type==="workspace"?e.jsx("div",{className:"pt-30 pb-10",children:e.jsx(oe,{image:at,title:e.jsx(n,{message:"Users can't be assigned to this role"})})}):e.jsx(di,{endpoint:"users",columns:t?qg:Vg,queryParams:{roleId:`${s.id}`},actions:e.jsx(Ug,{role:s}),selectedActions:e.jsx(Bg,{role:s}),emptyStateMessage:e.jsx(oe,{image:at,title:e.jsx(n,{message:"No users have been assigned to this role yet"}),filteringTitle:e.jsx(n,{message:"No matching users"})})})}function Ug({role:s}){const t=$g(s);return e.jsxs(A,{type:"modal",children:[e.jsx(b,{variant:"flat",color:"primary",disabled:t.isPending,children:e.jsx(n,{message:"Assign user"})}),e.jsx(Eg,{onUserSelected:a=>{t.mutate({userIds:[a.id]},{onSuccess:()=>{_.invalidateQueries({queryKey:J("users",{roleId:`${s.id}`})})}})}})]})}function Bg({role:s}){const t=Dg(s),{selectedRows:a}=xt();return e.jsxs(A,{type:"modal",onClose:r=>{r&&t.mutate({userIds:a},{onSuccess:()=>{_.invalidateQueries({queryKey:J("users",{roleId:`${s.id}`})})}})},children:[e.jsx(b,{variant:"flat",color:"danger",disabled:t.isPending,children:e.jsx(n,{message:"Remove users"})}),e.jsx(ce,{title:e.jsx(n,{message:"Remove [one 1 user|other :count users] from “:name“ role?",values:{count:a.length,name:s.name}}),body:e.jsx(n,{message:"This will permanently remove the users."}),confirm:e.jsx(n,{message:"Remove"}),isDanger:!0})]})}function Hg(){const s=Ig();return s.status!=="success"?e.jsx(_e,{}):e.jsx(Zg,{role:s.data.role})}function Zg({role:s}){const t=O({defaultValues:s}),a=Pg();return e.jsx(We,{form:t,onSubmit:r=>{a.mutate(r)},title:e.jsx(n,{message:"Edit “:name“ role",values:{name:s.name}}),isLoading:a.isPending,children:e.jsxs(ws,{isLazy:!0,children:[e.jsxs(Ss,{children:[e.jsx(fe,{children:e.jsx(n,{message:"Settings"})}),e.jsx(fe,{children:e.jsx(n,{message:"Users"})})]}),e.jsxs(sa,{className:"pt-20",children:[e.jsx(is,{children:e.jsx(gl,{isInternal:s.internal})}),e.jsx(is,{children:e.jsx(Og,{role:s})})]})]})})}const Kg="roles";function Wg(s){const{trans:t}=z();return I({mutationFn:a=>Qg(a),onSuccess:()=>{M(t(d("Created new role"))),_.invalidateQueries({queryKey:J("roles")})},onError:a=>ee(a,s)})}function Qg({id:s,...t}){return S.post(Kg,t).then(a=>a.data)}function Gg(){const s=O({defaultValues:{type:"sitewide"}}),t=Wg(s),a=Y();return e.jsx(We,{form:s,onSubmit:r=>{t.mutate(r,{onSuccess:i=>{a(`/admin/roles/${i.role.id}/edit`)}})},title:e.jsx(n,{message:"Add new role"}),isLoading:t.isPending,children:e.jsx(gl,{})})}const Jg=s=>[{key:"type",label:d("Type"),description:d("Type of the tag"),defaultOperator:R.ne,control:{type:H.Select,defaultValue:s[0].name,options:s.map(t=>({key:t.name,label:d(t.name),value:t.name}))}},Se({description:d("Date tag was created")}),Ie({description:d("Date tag was last updated")})],pn=""+new URL("software-engineer-ba026106.svg",import.meta.url).href;function jl({form:s,onSubmit:t,formId:a}){const{tags:{types:r}}=m.useContext(Xe),i=s.watch("type"),l=!!r.find(o=>o.name===i&&o.system);return e.jsxs(te,{id:a,form:s,onSubmit:t,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(D,{label:e.jsx(n,{message:"Type"}),name:"type",selectionMode:"single",disabled:l,children:r.filter(o=>!o.system).map(o=>e.jsx(h,{value:o.name,children:e.jsx(n,{message:o.name})},o.name))})]})}function Yg(s){const{trans:t}=z();return I({mutationFn:a=>Xg(a),onSuccess:()=>{M(t(d("Tag created"))),_.invalidateQueries({queryKey:J("tags")})},onError:a=>ee(a,s)})}function Xg(s){return s.name=Va(s.name),S.post("tags",s).then(t=>t.data)}function ep(){const{close:s,formId:t}=K(),{tags:{types:a}}=m.useContext(Xe),r=O({defaultValues:{type:a[0].name}}),i=Yg(r);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Add new tag"})}),e.jsx(X,{children:e.jsx(jl,{formId:t,form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>{s()}})}})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>{s()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:t,disabled:i.isPending,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}function sp(s){const{trans:t}=z();return I({mutationFn:a=>tp(a),onSuccess:()=>{M(t(d("Tag updated"))),_.invalidateQueries({queryKey:J("tags")})},onError:a=>ee(a,s)})}function tp({id:s,...t}){return t.name&&(t.name=Va(t.name)),S.put(`tags/${s}`,t).then(a=>a.data)}function ap({tag:s}){const{close:t,formId:a}=K(),r=O({defaultValues:{id:s.id,name:s.name,display_name:s.display_name,type:s.type}}),i=sp(r);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Update “:name“ tag",values:{name:s.name}})}),e.jsx(X,{children:e.jsx(jl,{formId:a,form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>{t()}})}})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>{t()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,disabled:i.isPending,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}const np=[{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(ne,{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(A,{type:"modal",children:[e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(xe,{})}),e.jsx(ap,{tag:s})]})}];function rp(){const{tags:s}=m.useContext(Xe),t=m.useMemo(()=>Jg(s.types),[s.types]);return e.jsx(he,{endpoint:"tags",title:e.jsx(n,{message:"Tags"}),columns:np,filters:t,actions:e.jsx(ip,{}),selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:pn,title:e.jsx(n,{message:"No tags have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching tags"})})})}function ip(){return e.jsx(e.Fragment,{children:e.jsxs(A,{type:"modal",children:[e.jsx(je,{children:e.jsx(n,{message:"Add new tag"})}),e.jsx(ep,{})]})})}const jn=m.memo(({bytes:s})=>e.jsx(m.Fragment,{children:Lr(s)})),fl=T(e.jsx("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z"}),"VisibilityOutlined"),lp=""+new URL("upload-cabfc914.svg",import.meta.url).href,op=B.createContext(null);function ms(s,t){const{base_url:a}=ue(),r=m.useContext(op);return m.useMemo(()=>{if(!s)return{};let i;s.url&&(i=Bo(s.url)?s.url:`${a}/${s.url}`);const l={previewUrl:i,downloadUrl:`${a}/api/v1/file-entries/download/${(t==null?void 0:t.downloadHashes)||s.hash}`};return r&&(l.previewUrl&&(l.previewUrl=Yn(l.previewUrl,{...r,thumbnail:t!=null&&t.thumbnail?"true":""},a)),l.downloadUrl=Yn(l.downloadUrl,r,a)),l},[a,s,t==null?void 0:t.downloadHashes,t==null?void 0:t.thumbnail,r])}function Yn(s,t,a){const r=new URL(s,a);return Object.entries(t).forEach(([i,l])=>{r.searchParams.append(i,l)}),r.toString()}const fn=B.createContext(null);function os({message:s,className:t,allowDownload:a}){const{entries:r,activeIndex:i}=m.useContext(fn),l=r[i],o=s||e.jsx(n,{message:"No file preview available"}),{downloadUrl:c}=ms(l);return e.jsxs("div",{className:w(t,"shadow bg-paper max-w-400 w-[calc(100%-40px)] text-center p-40 rounded"),children:[e.jsx("div",{className:"text-lg",children:o}),a&&e.jsx("div",{className:"block mt-20 text-center",children:e.jsx(b,{variant:"flat",color:"primary",onClick:()=>{c&&Ls(c)},children:e.jsx(n,{message:"Download"})})})]})}function cp(s){const{entry:t,className:a}=s,{trans:r}=z(),{previewUrl:i}=ms(t);return i?e.jsx("img",{className:w(a,"shadow"),src:i,alt:r({message:"Preview for :name",values:{name:t.name}})}):e.jsx(os,{...s})}const dp=5242880;function up(s){const{entry:t,className:a}=s,{trans:r}=z(),[i,l]=m.useState(!1),[o,c]=m.useState(!0),[u,x]=m.useState(!1),[g,j]=m.useState(null),{previewUrl:v}=ms(t);return m.useEffect(()=>{t&&(v?t.file_size>=dp?(l(!0),c(!1)):mp(v).then(f=>{j(f.data)}).catch(()=>{x(!0)}).finally(()=>{c(!1)}):x(!0))},[t,v]),o?e.jsx(ds,{isIndeterminate:!0,"aria-label":r({message:"Loading file contents"})}):i?e.jsx(os,{...s,message:e.jsx(n,{message:"This file is too large to preview."})}):u?e.jsx(os,{...s,message:e.jsx(n,{message:"There was an issue previewing this file"})}):e.jsx("pre",{className:w("rounded bg-paper p-20 text-sm whitespace-pre-wrap break-words h-full overflow-y-auto w-full",a),children:e.jsx("div",{className:"container mx-auto",children:`${g}`})})}function mp(s){return S.get(s,{responseType:"text",withCredentials:!1,headers:{Accept:"text/plain"}})}function xp(s){const{entry:t,className:a}=s,{previewUrl:r}=ms(t),i=m.useRef(null),[l,o]=m.useState(!1);return m.useEffect(()=>{var c;o(!((c=i.current)!=null&&c.canPlayType(t.mime)))},[t]),l||!r?e.jsx(os,{...s}):e.jsx("video",{className:a,ref:i,controls:!0,controlsList:"nodownload noremoteplayback",playsInline:!0,autoPlay:!0,children:e.jsx("source",{src:r,type:t.mime,onError:()=>{o(!0)}})})}function hp(s){const{entry:t,className:a}=s,{previewUrl:r}=ms(t),i=m.useRef(null),[l,o]=m.useState(!1);return m.useEffect(()=>{var c;o(!((c=i.current)!=null&&c.canPlayType(t.mime)))},[t]),l||!r?e.jsx(os,{...s}):e.jsx("audio",{className:a,ref:i,controls:!0,controlsList:"nodownload noremoteplayback",autoPlay:!0,children:e.jsx("source",{src:r,type:t.mime,onError:()=>{o(!0)}})})}function gp(s){const{entry:t,className:a}=s,{trans:r}=z(),{previewUrl:i}=ms(t);return i?e.jsx("iframe",{title:r({message:"Preview for :name",values:{name:t.name}}),className:w(a,"w-full h-full"),src:`${i}#toolbar=0`}):e.jsx(os,{...s})}function xa(s){const{entry:t,className:a}=s,{trans:r}=z(),i=m.useRef(null),[l,o]=m.useState(!1),c=m.useRef(),[u,x]=m.useState(!1),{previewUrl:g}=ms(t);return m.useEffect(()=>{g?t.file_size&&t.file_size>25e6?o(!0):i.current&&(i.current.onload=()=>{clearTimeout(c.current),x(!1)},pp(g,t).then(j=>{i.current&&(i.current.src=j)}),c.current=setTimeout(()=>{o(!0)},5e3)):o(!0)},[t,g]),l?e.jsx(os,{...s}):e.jsxs("div",{className:w(a,"w-full h-full"),children:[u&&e.jsx(ds,{}),e.jsx("iframe",{ref:i,title:r({message:"Preview for :name",values:{name:t.name}}),className:w("w-full h-full",u&&"hidden")})]})}async function pp(s,t){const a=new URL(s);if(!a.searchParams.has("shareable_link")){const{data:r}=await S.post(`file-entries/${t.id}/add-preview-token`);a.searchParams.append("preview_token",r.preview_token)}return jp(a)}function jp(s){return`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(s.toString())}`}const Xn={text:up,video:xp,audio:hp,image:cp,pdf:gp,spreadsheet:xa,powerPoint:xa,word:xa,"text/rtf":os};function fp(s){const t=s==null?void 0:s.mime,a=s==null?void 0:s.type;return Xn[t]||Xn[a]||os}const bp=T(e.jsx("g",{children:e.jsx("path",{d:"M 23.65625 4 C 22.320313 4 21.066406 4.519531 20.121094 5.464844 L 11.464844 14.121094 C 10.519531 15.066406 10 16.320313 10 17.65625 L 10 57 C 10 58.652344 11.347656 60 13 60 L 53 60 C 54.652344 60 56 58.652344 56 57 L 56 7 C 56 5.347656 54.652344 4 53 4 Z M 24 6 L 53 6 C 53.550781 6 54 6.449219 54 7 L 54 57 C 54 57.550781 53.550781 58 53 58 L 13 58 C 12.449219 58 12 57.550781 12 57 L 12 18 L 21 18 C 22.652344 18 24 16.652344 24 15 Z M 22 6.5 L 22 15 C 22 15.550781 21.550781 16 21 16 L 12.5 16 C 12.605469 15.835938 12.734375 15.679688 12.878906 15.535156 L 21.535156 6.878906 C 21.679688 6.738281 21.835938 6.613281 22 6.5 Z M 21 22 C 20.449219 22 20 22.449219 20 23 C 20 23.550781 20.449219 24 21 24 L 37 24 C 37.550781 24 38 23.550781 38 23 C 38 22.449219 37.550781 22 37 22 Z M 41 22 C 40.449219 22 40 22.449219 40 23 C 40 23.550781 40.449219 24 41 24 L 45 24 C 45.550781 24 46 23.550781 46 23 C 46 22.449219 45.550781 22 45 22 Z M 21 26 C 20.449219 26 20 26.449219 20 27 C 20 27.550781 20.449219 28 21 28 L 41 28 C 41.550781 28 42 27.550781 42 27 C 42 26.449219 41.550781 26 41 26 Z M 21 32 C 20.449219 32 20 32.449219 20 33 C 20 33.550781 20.449219 34 21 34 L 43 34 C 43.550781 34 44 33.550781 44 33 C 44 32.449219 43.550781 32 43 32 Z M 21 36 C 20.449219 36 20 36.449219 20 37 C 20 37.550781 20.449219 38 21 38 L 33 38 C 33.550781 38 34 37.550781 34 37 C 34 36.449219 33.550781 36 33 36 Z M 15 50 C 14.449219 50 14 50.449219 14 51 L 14 53 C 14 53.550781 14.449219 54 15 54 C 15.550781 54 16 53.550781 16 53 L 16 51 C 16 50.449219 15.550781 50 15 50 Z M 20 50 C 19.449219 50 19 50.449219 19 51 L 19 53 C 19 53.550781 19.449219 54 20 54 C 20.550781 54 21 53.550781 21 53 L 21 51 C 21 50.449219 20.550781 50 20 50 Z M 25 50 C 24.449219 50 24 50.449219 24 51 L 24 53 C 24 53.550781 24.449219 54 25 54 C 25.550781 54 26 53.550781 26 53 L 26 51 C 26 50.449219 25.550781 50 25 50 Z M 30 50 C 29.449219 50 29 50.449219 29 51 L 29 53 C 29 53.550781 29.449219 54 30 54 C 30.550781 54 31 53.550781 31 53 L 31 51 C 31 50.449219 30.550781 50 30 50 Z M 35 50 C 34.449219 50 34 50.449219 34 51 L 34 53 C 34 53.550781 34.449219 54 35 54 C 35.550781 54 36 53.550781 36 53 L 36 51 C 36 50.449219 35.550781 50 35 50 Z M 40 50 C 39.449219 50 39 50.449219 39 51 L 39 53 C 39 53.550781 39.449219 54 40 54 C 40.550781 54 41 53.550781 41 53 L 41 51 C 41 50.449219 40.550781 50 40 50 Z M 45 50 C 44.449219 50 44 50.449219 44 51 L 44 53 C 44 53.550781 44.449219 54 45 54 C 45.550781 54 46 53.550781 46 53 L 46 51 C 46 50.449219 45.550781 50 45 50 Z M 50 50 C 49.449219 50 49 50.449219 49 51 L 49 53 C 49 53.550781 49.449219 54 50 54 C 50.550781 54 51 53.550781 51 53 L 51 51 C 51 50.449219 50.550781 50 50 50 Z "})})),vp=T(e.jsx("g",{children:e.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.0625 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.609375 15.835938 10.734375 15.679688 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.734375 19.835938 6.609375 20 6.5 Z M 42.78125 18.023438 L 24.78125 22.023438 C 24.328125 22.125 24 22.53125 24 23 L 24 37 C 20.691406 37 18 39.242188 18 42 C 18 44.757813 20.691406 47 24 47 C 27.308594 47 30 44.757813 30 42 L 30 29.910156 L 38 28.136719 L 38 33 C 34.691406 33 32 35.242188 32 38 C 32 40.757813 34.691406 43 38 43 C 41.308594 43 44 40.757813 44 38 L 44 19 C 44 18.695313 43.863281 18.410156 43.625 18.21875 C 43.390625 18.03125 43.082031 17.960938 42.78125 18.023438 Z M 42 20.246094 L 42 38 C 42 39.652344 40.207031 41 38 41 C 35.792969 41 34 39.652344 34 38 C 34 36.347656 35.792969 35 38 35 C 38.28125 35 38.5625 35.023438 38.839844 35.066406 C 39.128906 35.117188 39.421875 35.03125 39.648438 34.84375 C 39.871094 34.652344 40 34.375 40 34.078125 L 40 26.890625 C 40 26.585938 39.863281 26.300781 39.625 26.109375 C 39.390625 25.921875 39.078125 25.847656 38.78125 25.910156 L 28.78125 28.136719 C 28.328125 28.238281 28 28.644531 28 29.109375 L 28 42 C 28 43.652344 26.207031 45 24 45 C 21.792969 45 20 43.652344 20 42 C 20 40.347656 21.792969 39 24 39 C 24.28125 39 24.5625 39.023438 24.839844 39.066406 C 25.128906 39.117188 25.425781 39.03125 25.648438 38.84375 C 25.871094 38.652344 26 38.375 26 38.078125 L 26 23.800781 Z M 13 52 C 12.449219 52 12 52.445313 12 53 L 12 55 C 12 55.554688 12.449219 56 13 56 C 13.550781 56 14 55.554688 14 55 L 14 53 C 14 52.445313 13.550781 52 13 52 Z M 18 52 C 17.449219 52 17 52.445313 17 53 L 17 55 C 17 55.554688 17.449219 56 18 56 C 18.550781 56 19 55.554688 19 55 L 19 53 C 19 52.445313 18.550781 52 18 52 Z M 23 52 C 22.449219 52 22 52.445313 22 53 L 22 55 C 22 55.554688 22.449219 56 23 56 C 23.550781 56 24 55.554688 24 55 L 24 53 C 24 52.445313 23.550781 52 23 52 Z M 28 52 C 27.449219 52 27 52.445313 27 53 L 27 55 C 27 55.554688 27.449219 56 28 56 C 28.550781 56 29 55.554688 29 55 L 29 53 C 29 52.445313 28.550781 52 28 52 Z M 33 52 C 32.449219 52 32 52.445313 32 53 L 32 55 C 32 55.554688 32.449219 56 33 56 C 33.550781 56 34 55.554688 34 55 L 34 53 C 34 52.445313 33.550781 52 33 52 Z M 38 52 C 37.449219 52 37 52.445313 37 53 L 37 55 C 37 55.554688 37.449219 56 38 56 C 38.550781 56 39 55.554688 39 55 L 39 53 C 39 52.445313 38.550781 52 38 52 Z M 43 52 C 42.449219 52 42 52.445313 42 53 L 42 55 C 42 55.554688 42.449219 56 43 56 C 43.550781 56 44 55.554688 44 55 L 44 53 C 44 52.445313 43.550781 52 43 52 Z M 48 52 C 47.449219 52 47 52.445313 47 53 L 47 55 C 47 55.554688 47.449219 56 48 56 C 48.550781 56 49 55.554688 49 55 L 49 53 C 49 52.445313 48.550781 52 48 52 Z "})})),yp=T(e.jsx("g",{children:e.jsx("path",{d:"M 23.65625 4 C 22.320313 4 21.0625 4.519531 20.121094 5.464844 L 11.464844 14.121094 C 10.519531 15.066406 10 16.320313 10 17.65625 L 10 57 C 10 58.652344 11.347656 60 13 60 L 53 60 C 54.652344 60 56 58.652344 56 57 L 56 7 C 56 5.347656 54.652344 4 53 4 Z M 24 6 L 53 6 C 53.550781 6 54 6.449219 54 7 L 54 57 C 54 57.550781 53.550781 58 53 58 L 13 58 C 12.449219 58 12 57.550781 12 57 L 12 18 L 21 18 C 22.652344 18 24 16.652344 24 15 Z M 22 6.5 L 22 15 C 22 15.550781 21.550781 16 21 16 L 12.5 16 C 12.613281 15.835938 12.738281 15.675781 12.878906 15.535156 L 21.535156 6.878906 C 21.679688 6.734375 21.835938 6.609375 22 6.5 Z M 28.023438 21.816406 C 27.671875 21.808594 27.316406 21.890625 26.996094 22.0625 C 26.355469 22.417969 25.964844 23.085938 25.964844 23.816406 L 25.964844 42.183594 C 25.964844 42.910156 26.355469 43.582031 26.996094 43.933594 C 27.296875 44.097656 27.632813 44.183594 27.964844 44.183594 C 28.335938 44.183594 28.707031 44.078125 29.03125 43.871094 L 43.53125 34.6875 C 44.113281 34.320313 44.464844 33.6875 44.464844 33 C 44.464844 32.308594 44.113281 31.679688 43.53125 31.3125 L 29.03125 22.125 C 28.722656 21.933594 28.375 21.828125 28.023438 21.816406 Z M 27.964844 23.816406 L 42.464844 33 L 27.964844 42.1875 Z M 15 52 C 14.449219 52 14 52.449219 14 53 L 14 55 C 14 55.550781 14.449219 56 15 56 C 15.550781 56 16 55.550781 16 55 L 16 53 C 16 52.449219 15.550781 52 15 52 Z M 20 52 C 19.449219 52 19 52.449219 19 53 L 19 55 C 19 55.550781 19.449219 56 20 56 C 20.550781 56 21 55.550781 21 55 L 21 53 C 21 52.449219 20.550781 52 20 52 Z M 25 52 C 24.449219 52 24 52.449219 24 53 L 24 55 C 24 55.550781 24.449219 56 25 56 C 25.550781 56 26 55.550781 26 55 L 26 53 C 26 52.449219 25.550781 52 25 52 Z M 30 52 C 29.449219 52 29 52.449219 29 53 L 29 55 C 29 55.550781 29.449219 56 30 56 C 30.550781 56 31 55.550781 31 55 L 31 53 C 31 52.449219 30.550781 52 30 52 Z M 35 52 C 34.449219 52 34 52.449219 34 53 L 34 55 C 34 55.550781 34.449219 56 35 56 C 35.550781 56 36 55.550781 36 55 L 36 53 C 36 52.449219 35.550781 52 35 52 Z M 40 52 C 39.449219 52 39 52.449219 39 53 L 39 55 C 39 55.550781 39.449219 56 40 56 C 40.550781 56 41 55.550781 41 55 L 41 53 C 41 52.449219 40.550781 52 40 52 Z M 45 52 C 44.449219 52 44 52.449219 44 53 L 44 55 C 44 55.550781 44.449219 56 45 56 C 45.550781 56 46 55.550781 46 55 L 46 53 C 46 52.449219 45.550781 52 45 52 Z M 50 52 C 49.449219 52 49 52.449219 49 53 L 49 55 C 49 55.550781 49.449219 56 50 56 C 50.550781 56 51 55.550781 51 55 L 51 53 C 51 52.449219 50.550781 52 50 52 Z "})})),Cp=T(e.jsx("g",{children:e.jsx("path",{d:"M 17.660156 4 C 16.320313 4 15.058594 4.519531 14.121094 5.460938 L 5.460938 14.121094 C 4.519531 15.070313 4 16.320313 4 17.660156 L 4 57 C 4 58.648438 5.351563 60 7 60 L 47 60 C 48.648438 60 50 58.648438 50 57 L 50 46 L 58 46 C 59.101563 46 60 45.101563 60 44 L 60 24 C 60 22.898438 59.101563 22 58 22 L 50 22 L 50 7 C 50 5.351563 48.648438 4 47 4 Z M 18 6 L 47 6 C 47.550781 6 48 6.449219 48 7 L 48 22 L 16 22 C 14.898438 22 14 22.898438 14 24 L 14 44 C 14 45.101563 14.898438 46 16 46 L 48 46 L 48 57 C 48 57.550781 47.550781 58 47 58 L 7 58 C 6.449219 58 6 57.550781 6 57 L 6 18 L 15 18 C 16.652344 18 18 16.652344 18 15 Z M 16 6.5 L 16 15 C 16 15.550781 15.550781 16 15 16 L 6.5 16 C 6.613281 15.835938 6.738281 15.679688 6.882813 15.539063 L 15.539063 6.882813 C 15.679688 6.738281 15.835938 6.609375 16 6.5 Z M 16 24 L 58 24 L 58 44 L 16 44 Z M 24 28 C 23.449219 28 23 28.445313 23 29 C 23 29.554688 23.449219 30 24 30 L 26 30 L 26 39 C 26 39.554688 26.449219 40 27 40 C 27.550781 40 28 39.554688 28 39 L 28 30 L 30 30 C 30.550781 30 31 29.554688 31 29 C 31 28.445313 30.550781 28 30 28 Z M 44 28 C 43.449219 28 43 28.445313 43 29 C 43 29.554688 43.449219 30 44 30 L 46 30 L 46 39 C 46 39.554688 46.449219 40 47 40 C 47.550781 40 48 39.554688 48 39 L 48 30 L 50 30 C 50.550781 30 51 29.554688 51 29 C 51 28.445313 50.550781 28 50 28 Z M 33.859375 28.011719 C 33.730469 28.027344 33.601563 28.070313 33.484375 28.140625 C 33.011719 28.425781 32.859375 29.039063 33.140625 29.515625 L 35.832031 34 L 33.140625 38.484375 C 32.859375 38.957031 33.011719 39.574219 33.484375 39.859375 C 33.644531 39.953125 33.824219 40 34 40 C 34.339844 40 34.671875 39.828125 34.859375 39.515625 L 37 35.941406 L 39.140625 39.515625 C 39.328125 39.828125 39.660156 40 40 40 C 40.175781 40 40.355469 39.953125 40.515625 39.859375 C 40.988281 39.574219 41.140625 38.957031 40.859375 38.484375 L 38.167969 34 L 40.859375 29.515625 C 41.140625 29.042969 40.988281 28.425781 40.515625 28.140625 C 40.042969 27.859375 39.425781 28.011719 39.140625 28.484375 L 37 32.058594 L 34.859375 28.484375 C 34.644531 28.128906 34.246094 27.957031 33.859375 28.011719 Z M 9 52 C 8.449219 52 8 52.445313 8 53 L 8 55 C 8 55.554688 8.449219 56 9 56 C 9.550781 56 10 55.554688 10 55 L 10 53 C 10 52.445313 9.550781 52 9 52 Z M 14 52 C 13.449219 52 13 52.445313 13 53 L 13 55 C 13 55.554688 13.449219 56 14 56 C 14.550781 56 15 55.554688 15 55 L 15 53 C 15 52.445313 14.550781 52 14 52 Z M 19 52 C 18.449219 52 18 52.445313 18 53 L 18 55 C 18 55.554688 18.449219 56 19 56 C 19.550781 56 20 55.554688 20 55 L 20 53 C 20 52.445313 19.550781 52 19 52 Z M 24 52 C 23.449219 52 23 52.445313 23 53 L 23 55 C 23 55.554688 23.449219 56 24 56 C 24.550781 56 25 55.554688 25 55 L 25 53 C 25 52.445313 24.550781 52 24 52 Z M 29 52 C 28.449219 52 28 52.445313 28 53 L 28 55 C 28 55.554688 28.449219 56 29 56 C 29.550781 56 30 55.554688 30 55 L 30 53 C 30 52.445313 29.550781 52 29 52 Z M 34 52 C 33.449219 52 33 52.445313 33 53 L 33 55 C 33 55.554688 33.449219 56 34 56 C 34.550781 56 35 55.554688 35 55 L 35 53 C 35 52.445313 34.550781 52 34 52 Z M 39 52 C 38.449219 52 38 52.445313 38 53 L 38 55 C 38 55.554688 38.449219 56 39 56 C 39.550781 56 40 55.554688 40 55 L 40 53 C 40 52.445313 39.550781 52 39 52 Z M 44 52 C 43.449219 52 43 52.445313 43 53 L 43 55 C 43 55.554688 43.449219 56 44 56 C 44.550781 56 45 55.554688 45 55 L 45 53 C 45 52.445313 44.550781 52 44 52 Z "})})),wp=T(e.jsx("g",{children:e.jsx("path",{d:"M 17.65625 4 C 16.320313 4 15.066406 4.519531 14.121094 5.464844 L 5.464844 14.121094 C 4.519531 15.066406 4 16.320313 4 17.65625 L 4 57 C 4 58.652344 5.347656 60 7 60 L 47 60 C 48.652344 60 50 58.652344 50 57 L 50 46 L 58 46 C 59.101563 46 60 45.101563 60 44 L 60 24 C 60 22.898438 59.101563 22 58 22 L 50 22 L 50 7 C 50 5.347656 48.652344 4 47 4 Z M 18 6 L 47 6 C 47.550781 6 48 6.449219 48 7 L 48 22 L 16 22 C 14.898438 22 14 22.898438 14 24 L 14 44 C 14 45.101563 14.898438 46 16 46 L 48 46 L 48 57 C 48 57.550781 47.550781 58 47 58 L 7 58 C 6.449219 58 6 57.550781 6 57 L 6 18 L 15 18 C 16.652344 18 18 16.652344 18 15 Z M 16 6.5 L 16 15 C 16 15.550781 15.550781 16 15 16 L 6.5 16 C 6.609375 15.835938 6.734375 15.679688 6.878906 15.535156 L 15.535156 6.878906 C 15.679688 6.734375 15.835938 6.609375 16 6.5 Z M 16 24 L 58 24 L 58 44 L 16 44 Z M 25 28 C 24.445313 28 24 28.449219 24 29 L 24 39 C 24 39.550781 24.445313 40 25 40 C 25.554688 40 26 39.550781 26 39 L 26 36 L 29 36 C 30.652344 36 32 34.652344 32 33 L 32 31 C 32 29.347656 30.652344 28 29 28 Z M 35 28 C 34.445313 28 34 28.449219 34 29 L 34 39 C 34 39.550781 34.445313 40 35 40 L 38 40 C 40.207031 40 42 38.207031 42 36 L 42 32 C 42 29.792969 40.207031 28 38 28 Z M 45 28 C 44.445313 28 44 28.449219 44 29 L 44 39 C 44 39.550781 44.445313 40 45 40 C 45.554688 40 46 39.550781 46 39 L 46 36 L 49 36 C 49.554688 36 50 35.550781 50 35 C 50 34.449219 49.554688 34 49 34 L 46 34 L 46 30 L 50 30 C 50.554688 30 51 29.550781 51 29 C 51 28.449219 50.554688 28 50 28 Z M 26 30 L 29 30 C 29.550781 30 30 30.449219 30 31 L 30 33 C 30 33.550781 29.550781 34 29 34 L 26 34 Z M 36 30 L 38 30 C 39.101563 30 40 30.898438 40 32 L 40 36 C 40 37.101563 39.101563 38 38 38 L 36 38 Z M 9 52 C 8.445313 52 8 52.449219 8 53 L 8 55 C 8 55.550781 8.445313 56 9 56 C 9.554688 56 10 55.550781 10 55 L 10 53 C 10 52.449219 9.554688 52 9 52 Z M 14 52 C 13.445313 52 13 52.449219 13 53 L 13 55 C 13 55.550781 13.445313 56 14 56 C 14.554688 56 15 55.550781 15 55 L 15 53 C 15 52.449219 14.554688 52 14 52 Z M 19 52 C 18.445313 52 18 52.449219 18 53 L 18 55 C 18 55.550781 18.445313 56 19 56 C 19.554688 56 20 55.550781 20 55 L 20 53 C 20 52.449219 19.554688 52 19 52 Z M 24 52 C 23.445313 52 23 52.449219 23 53 L 23 55 C 23 55.550781 23.445313 56 24 56 C 24.554688 56 25 55.550781 25 55 L 25 53 C 25 52.449219 24.554688 52 24 52 Z M 29 52 C 28.445313 52 28 52.449219 28 53 L 28 55 C 28 55.550781 28.445313 56 29 56 C 29.554688 56 30 55.550781 30 55 L 30 53 C 30 52.449219 29.554688 52 29 52 Z M 34 52 C 33.445313 52 33 52.449219 33 53 L 33 55 C 33 55.550781 33.445313 56 34 56 C 34.554688 56 35 55.550781 35 55 L 35 53 C 35 52.449219 34.554688 52 34 52 Z M 39 52 C 38.445313 52 38 52.449219 38 53 L 38 55 C 38 55.550781 38.445313 56 39 56 C 39.554688 56 40 55.550781 40 55 L 40 53 C 40 52.449219 39.554688 52 39 52 Z M 44 52 C 43.445313 52 43 52.449219 43 53 L 43 55 C 43 55.550781 43.445313 56 44 56 C 44.554688 56 45 55.550781 45 55 L 45 53 C 45 52.449219 44.554688 52 44 52 Z "})})),Sp=T(e.jsx("g",{children:e.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.066406 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 36 6 L 36 27.59375 C 35.144531 27.222656 34.210938 27 33.226563 27 L 32.773438 27 C 31.789063 27 30.859375 27.222656 30 27.59375 L 30 9 C 30 8.449219 29.554688 8 29 8 C 28.449219 8 28 8.449219 28 9 L 28 28.902344 C 27.015625 29.824219 26.277344 31.023438 25.953125 32.425781 L 24.875 37.097656 C 24.597656 38.292969 24.878906 39.53125 25.640625 40.488281 C 26.40625 41.449219 27.546875 42 28.769531 42 L 37.230469 42 C 38.457031 42 39.59375 41.449219 40.359375 40.488281 C 41.121094 39.53125 41.402344 38.292969 41.125 37.097656 L 40.046875 32.425781 C 39.726563 31.023438 38.984375 29.824219 38 28.902344 L 38 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.609375 15.835938 10.734375 15.679688 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.738281 19.835938 6.609375 20 6.5 Z M 32 8 C 31.449219 8 31 8.445313 31 9 C 31 9.554688 31.449219 10 32 10 L 34 10 C 34.550781 10 35 9.554688 35 9 C 35 8.445313 34.550781 8 34 8 Z M 32 13 C 31.449219 13 31 13.445313 31 14 C 31 14.554688 31.449219 15 32 15 L 34 15 C 34.550781 15 35 14.554688 35 14 C 35 13.445313 34.550781 13 34 13 Z M 32 18 C 31.449219 18 31 18.445313 31 19 C 31 19.554688 31.449219 20 32 20 L 34 20 C 34.550781 20 35 19.554688 35 19 C 35 18.445313 34.550781 18 34 18 Z M 32 23 C 31.449219 23 31 23.445313 31 24 C 31 24.554688 31.449219 25 32 25 L 34 25 C 34.550781 25 35 24.554688 35 24 C 35 23.445313 34.550781 23 34 23 Z M 32.773438 29 L 33.226563 29 C 35.570313 29 37.574219 30.59375 38.097656 32.875 L 39.175781 37.550781 C 39.316406 38.148438 39.175781 38.765625 38.796875 39.246094 C 38.414063 39.722656 37.839844 40 37.230469 40 L 28.769531 40 C 28.160156 40 27.589844 39.722656 27.207031 39.246094 C 26.824219 38.765625 26.683594 38.148438 26.824219 37.550781 L 27.902344 32.875 C 28.429688 30.59375 30.429688 29 32.773438 29 Z M 31 34 C 30.449219 34 30 34.445313 30 35 C 30 35.554688 30.449219 36 31 36 L 35 36 C 35.550781 36 36 35.554688 36 35 C 36 34.445313 35.550781 34 35 34 Z M 13 52 C 12.449219 52 12 52.445313 12 53 C 12 53.554688 12.449219 54 13 54 L 17 54 C 17.550781 54 18 53.554688 18 53 C 18 52.445313 17.550781 52 17 52 Z M 21 52 C 20.449219 52 20 52.445313 20 53 C 20 53.554688 20.449219 54 21 54 L 49 54 C 49.550781 54 50 53.554688 50 53 C 50 52.445313 49.550781 52 49 52 Z "})})),Np=T(e.jsx("g",{children:e.jsx("path",{d:"M 5 10 C 3.300781 10 2 11.300781 2 13 L 2 52 C 2 54.199219 3.800781 56 6 56 L 60 56 C 62.199219 56 64 54.199219 64 52 L 64 23 C 64 21.300781 62.699219 20 61 20 L 58 20 L 58 19 C 58 17.300781 56.699219 16 55 16 L 29.699219 16 C 28.898438 16 28.199219 15.699219 27.597656 15.097656 L 23.902344 11.402344 C 23 10.5 21.699219 10 20.402344 10 Z M 5 12 L 20.402344 12 C 21.199219 12 21.898438 12.300781 22.5 12.902344 L 26.199219 16.597656 C 27.097656 17.5 28.398438 18 29.699219 18 L 55 18 C 55.601563 18 56 18.398438 56 19 L 56 52 C 56 52.601563 56.199219 53.300781 56.597656 54 L 6 54 C 4.898438 54 4 53.101563 4 52 L 4 46 L 45 46 C 45.601563 46 46 45.601563 46 45 C 46 44.398438 45.601563 44 45 44 L 4 44 L 4 13 C 4 12.398438 4.398438 12 5 12 Z M 58 22 L 61 22 C 61.601563 22 62 22.398438 62 23 L 62 52 C 62 53.101563 61.101563 54 60 54 C 58.800781 54 58 52.601563 58 52 Z M 11 24 C 10.398438 24 10 24.398438 10 25 C 10 25.601563 10.398438 26 11 26 L 21 26 C 21.601563 26 22 25.601563 22 25 C 22 24.398438 21.601563 24 21 24 Z M 25 24 C 24.398438 24 24 24.398438 24 25 C 24 25.601563 24.398438 26 25 26 L 31 26 C 31.601563 26 32 25.601563 32 25 C 32 24.398438 31.601563 24 31 24 Z M 11 28 C 10.398438 28 10 28.398438 10 29 C 10 29.601563 10.398438 30 11 30 L 15 30 C 15.601563 30 16 29.601563 16 29 C 16 28.398438 15.601563 28 15 28 Z M 19 28 C 18.398438 28 18 28.398438 18 29 C 18 29.601563 18.398438 30 19 30 L 26 30 C 26.601563 30 27 29.601563 27 29 C 27 28.398438 26.601563 28 26 28 Z M 49 44 C 48.398438 44 48 44.398438 48 45 C 48 45.601563 48.398438 46 49 46 L 53 46 C 53.601563 46 54 45.601563 54 45 C 54 44.398438 53.601563 44 53 44 Z M 7 48 C 6.398438 48 6 48.398438 6 49 L 6 51 C 6 51.601563 6.398438 52 7 52 C 7.601563 52 8 51.601563 8 51 L 8 49 C 8 48.398438 7.601563 48 7 48 Z M 12 48 C 11.398438 48 11 48.398438 11 49 L 11 51 C 11 51.601563 11.398438 52 12 52 C 12.601563 52 13 51.601563 13 51 L 13 49 C 13 48.398438 12.601563 48 12 48 Z M 17 48 C 16.398438 48 16 48.398438 16 49 L 16 51 C 16 51.601563 16.398438 52 17 52 C 17.601563 52 18 51.601563 18 51 L 18 49 C 18 48.398438 17.601563 48 17 48 Z M 22 48 C 21.398438 48 21 48.398438 21 49 L 21 51 C 21 51.601563 21.398438 52 22 52 C 22.601563 52 23 51.601563 23 51 L 23 49 C 23 48.398438 22.601563 48 22 48 Z M 27 48 C 26.398438 48 26 48.398438 26 49 L 26 51 C 26 51.601563 26.398438 52 27 52 C 27.601563 52 28 51.601563 28 51 L 28 49 C 28 48.398438 27.601563 48 27 48 Z M 32 48 C 31.398438 48 31 48.398438 31 49 L 31 51 C 31 51.601563 31.398438 52 32 52 C 32.601563 52 33 51.601563 33 51 L 33 49 C 33 48.398438 32.601563 48 32 48 Z M 37 48 C 36.398438 48 36 48.398438 36 49 L 36 51 C 36 51.601563 36.398438 52 37 52 C 37.601563 52 38 51.601563 38 51 L 38 49 C 38 48.398438 37.601563 48 37 48 Z M 42 48 C 41.398438 48 41 48.398438 41 49 L 41 51 C 41 51.601563 41.398438 52 42 52 C 42.601563 52 43 51.601563 43 51 L 43 49 C 43 48.398438 42.601563 48 42 48 Z M 47 48 C 46.398438 48 46 48.398438 46 49 L 46 51 C 46 51.601563 46.398438 52 47 52 C 47.601563 52 48 51.601563 48 51 L 48 49 C 48 48.398438 47.601563 48 47 48 Z M 52 48 C 51.398438 48 51 48.398438 51 49 L 51 51 C 51 51.601563 51.398438 52 52 52 C 52.601563 52 53 51.601563 53 51 L 53 49 C 53 48.398438 52.601563 48 52 48 Z "})})),kp=T(e.jsx("g",{children:e.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.066406 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.605469 15.835938 10.734375 15.679688 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.738281 19.835938 6.613281 20 6.5 Z M 20 24 C 17.792969 24 16 25.792969 16 28 C 16 30.207031 17.792969 32 20 32 C 22.207031 32 24 30.207031 24 28 C 24 25.792969 22.207031 24 20 24 Z M 20 25.75 C 21.242188 25.75 22.25 26.757813 22.25 28 C 22.25 29.242188 21.242188 30.25 20 30.25 C 18.757813 30.25 17.75 29.242188 17.75 28 C 17.75 26.757813 18.757813 25.75 20 25.75 Z M 37 30.414063 C 36.488281 30.414063 35.976563 30.609375 35.585938 31 L 29 37.585938 L 26.414063 35 C 25.632813 34.21875 24.363281 34.21875 23.585938 35 L 14.585938 44 L 13.042969 44 C 12.417969 44 12 44.398438 12 45 C 12 45.601563 12.523438 46 13.042969 46 L 48.980469 46 C 49.5 46 50.023438 45.601563 50.023438 45 C 50.023438 44.398438 49.5 44 48.980469 44 L 25.414063 44 L 37 32.414063 L 45.292969 40.707031 C 45.683594 41.097656 46.316406 41.097656 46.707031 40.707031 C 47.097656 40.316406 47.097656 39.683594 46.707031 39.292969 L 38.414063 31 C 38.023438 30.609375 37.511719 30.414063 37 30.414063 Z M 25 36.414063 L 27.585938 39 L 22.585938 44 L 17.414063 44 Z M 13 52 C 12.449219 52 12 52.449219 12 53 L 12 55 C 12 55.550781 12.449219 56 13 56 C 13.550781 56 14 55.550781 14 55 L 14 53 C 14 52.449219 13.550781 52 13 52 Z M 18 52 C 17.449219 52 17 52.449219 17 53 L 17 55 C 17 55.550781 17.449219 56 18 56 C 18.550781 56 19 55.550781 19 55 L 19 53 C 19 52.449219 18.550781 52 18 52 Z M 23 52 C 22.449219 52 22 52.449219 22 53 L 22 55 C 22 55.550781 22.449219 56 23 56 C 23.550781 56 24 55.550781 24 55 L 24 53 C 24 52.449219 23.550781 52 23 52 Z M 28 52 C 27.449219 52 27 52.449219 27 53 L 27 55 C 27 55.550781 27.449219 56 28 56 C 28.550781 56 29 55.550781 29 55 L 29 53 C 29 52.449219 28.550781 52 28 52 Z M 33 52 C 32.449219 52 32 52.449219 32 53 L 32 55 C 32 55.550781 32.449219 56 33 56 C 33.550781 56 34 55.550781 34 55 L 34 53 C 34 52.449219 33.550781 52 33 52 Z M 38 52 C 37.449219 52 37 52.449219 37 53 L 37 55 C 37 55.550781 37.449219 56 38 56 C 38.550781 56 39 55.550781 39 55 L 39 53 C 39 52.449219 38.550781 52 38 52 Z M 43 52 C 42.449219 52 42 52.449219 42 53 L 42 55 C 42 55.550781 42.449219 56 43 56 C 43.550781 56 44 55.550781 44 55 L 44 53 C 44 52.449219 43.550781 52 43 52 Z M 48 52 C 47.449219 52 47 52.449219 47 53 L 47 55 C 47 55.550781 47.449219 56 48 56 C 48.550781 56 49 55.550781 49 55 L 49 53 C 49 52.449219 48.550781 52 48 52 Z "})})),Lp=T(e.jsx("g",{children:e.jsx("path",{d:"M 35.136719 2.386719 C 34.917969 2.378906 34.699219 2.390625 34.480469 2.429688 L 5.304688 7.578125 C 3.390625 7.917969 2 9.574219 2 11.515625 L 2 50.484375 C 2 52.429688 3.390625 54.085938 5.304688 54.421875 L 34.480469 59.570313 C 34.652344 59.601563 34.828125 59.613281 35 59.613281 C 35.703125 59.613281 36.382813 59.371094 36.925781 58.914063 C 37.609375 58.34375 38 57.503906 38 56.613281 L 38 52 L 57 52 C 58.652344 52 60 50.652344 60 49 L 60 13 C 60 11.347656 58.652344 10 57 10 L 38 10 L 38 5.382813 C 38 4.496094 37.609375 3.65625 36.925781 3.085938 C 36.417969 2.65625 35.789063 2.414063 35.136719 2.386719 Z M 35.105469 4.390625 C 35.359375 4.414063 35.542969 4.535156 35.640625 4.617188 C 35.777344 4.730469 36 4.980469 36 5.382813 L 36 56.613281 C 36 57.019531 35.777344 57.269531 35.640625 57.382813 C 35.507813 57.496094 35.226563 57.667969 34.828125 57.601563 L 5.652344 52.453125 C 4.695313 52.285156 4 51.457031 4 50.484375 L 4 11.515625 C 4 10.542969 4.695313 9.714844 5.652344 9.546875 L 34.824219 4.398438 C 34.925781 4.382813 35.019531 4.378906 35.105469 4.390625 Z M 38 12 L 57 12 C 57.550781 12 58 12.449219 58 13 L 58 49 C 58 49.550781 57.550781 50 57 50 L 38 50 L 38 45.949219 L 52.949219 45.949219 C 53.5 45.949219 53.949219 45.554688 53.949219 45 C 53.949219 44.445313 53.5 44 52.949219 44 L 50 44 L 50 41 C 50 40.445313 49.550781 40 49 40 L 46 40 L 46 37 C 46 36.445313 45.550781 36 45 36 L 41 36 C 40.449219 36 40 36.445313 40 37 L 40 39 L 38 39 L 38 32.46875 C 39.46875 33.449219 41.203125 34 43 34 C 47.960938 34 52 29.964844 52 25 C 52 20.035156 47.960938 16 43 16 C 41.1875 16 39.464844 16.535156 38 17.519531 Z M 42 18.078125 L 42 24.832031 C 42 25.027344 42.070313 25.203125 42.171875 25.359375 C 42.21875 25.492188 42.289063 25.617188 42.394531 25.726563 L 47.234375 30.5625 C 46.054688 31.460938 44.589844 32 43 32 C 41.113281 32 39.316406 31.230469 38 29.886719 L 38 20.105469 C 39.089844 18.992188 40.484375 18.292969 42 18.078125 Z M 44 18.078125 C 47.386719 18.566406 50 21.480469 50 25 C 50 26.546875 49.488281 27.976563 48.636719 29.136719 L 44 24.5 Z M 15 20 C 14.449219 20 14 20.445313 14 21 L 14 41 C 14 41.554688 14.449219 42 15 42 C 15.550781 42 16 41.554688 16 41 L 16 34 L 21 34 C 23.757813 34 26 31.757813 26 29 L 26 25 C 26 22.242188 23.757813 20 21 20 Z M 16 22 L 21 22 C 22.652344 22 24 23.347656 24 25 L 24 29 C 24 30.652344 22.652344 32 21 32 L 16 32 Z M 42 38 L 44 38 L 44 44 L 42 44 Z M 38 41 L 40 41 L 40 44 L 38 44 Z M 46 42 L 48 42 L 48 44 L 46 44 Z "})})),_p=T(e.jsx("g",{children:e.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.0625 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.613281 15.832031 10.738281 15.675781 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.734375 19.835938 6.609375 20 6.5 Z M 21.140625 23.011719 C 21.015625 22.992188 20.878906 22.996094 20.746094 23.03125 C 20.210938 23.175781 19.894531 23.722656 20.03125 24.253906 L 25.03125 43.253906 C 25.148438 43.691406 25.539063 43.996094 25.984375 44 L 26 44 C 26.441406 44 26.832031 43.710938 26.957031 43.28125 L 31 29.546875 L 35.042969 43.28125 C 35.167969 43.707031 35.558594 44 36 44 L 36.015625 44 C 36.460938 43.992188 36.851563 43.6875 36.96875 43.253906 L 41.96875 24.253906 C 42.105469 23.722656 41.789063 23.175781 41.253906 23.03125 C 40.71875 22.890625 40.171875 23.210938 40.03125 23.746094 L 35.945313 39.273438 L 31.957031 25.71875 C 31.832031 25.292969 31.445313 25 31 25 C 30.554688 25 30.167969 25.292969 30.042969 25.71875 L 26.054688 39.277344 L 21.96875 23.746094 C 21.863281 23.347656 21.527344 23.066406 21.140625 23.011719 Z M 13 52 C 12.449219 52 12 52.445313 12 53 L 12 55 C 12 55.554688 12.449219 56 13 56 C 13.550781 56 14 55.554688 14 55 L 14 53 C 14 52.445313 13.550781 52 13 52 Z M 18 52 C 17.449219 52 17 52.445313 17 53 L 17 55 C 17 55.554688 17.449219 56 18 56 C 18.550781 56 19 55.554688 19 55 L 19 53 C 19 52.445313 18.550781 52 18 52 Z M 23 52 C 22.449219 52 22 52.445313 22 53 L 22 55 C 22 55.554688 22.449219 56 23 56 C 23.550781 56 24 55.554688 24 55 L 24 53 C 24 52.445313 23.550781 52 23 52 Z M 28 52 C 27.449219 52 27 52.445313 27 53 L 27 55 C 27 55.554688 27.449219 56 28 56 C 28.550781 56 29 55.554688 29 55 L 29 53 C 29 52.445313 28.550781 52 28 52 Z M 33 52 C 32.449219 52 32 52.445313 32 53 L 32 55 C 32 55.554688 32.449219 56 33 56 C 33.550781 56 34 55.554688 34 55 L 34 53 C 34 52.445313 33.550781 52 33 52 Z M 38 52 C 37.449219 52 37 52.445313 37 53 L 37 55 C 37 55.554688 37.449219 56 38 56 C 38.550781 56 39 55.554688 39 55 L 39 53 C 39 52.445313 38.550781 52 38 52 Z M 43 52 C 42.449219 52 42 52.445313 42 53 L 42 55 C 42 55.554688 42.449219 56 43 56 C 43.550781 56 44 55.554688 44 55 L 44 53 C 44 52.445313 43.550781 52 43 52 Z M 48 52 C 47.449219 52 47 52.445313 47 53 L 47 55 C 47 55.554688 47.449219 56 48 56 C 48.550781 56 49 55.554688 49 55 L 49 53 C 49 52.445313 48.550781 52 48 52 Z "})})),Mp=T(e.jsx("g",{children:e.jsx("path",{d:"M 35.136719 2.386719 C 34.917969 2.378906 34.699219 2.390625 34.480469 2.429688 L 5.304688 7.578125 C 3.390625 7.917969 2 9.574219 2 11.515625 L 2 50.484375 C 2 52.429688 3.390625 54.085938 5.304688 54.421875 L 34.480469 59.570313 C 34.652344 59.601563 34.828125 59.613281 35 59.613281 C 35.703125 59.613281 36.382813 59.371094 36.925781 58.914063 C 37.609375 58.34375 38 57.503906 38 56.613281 L 38 52 L 57 52 C 58.652344 52 60 50.652344 60 49 L 60 13 C 60 11.347656 58.652344 10 57 10 L 38 10 L 38 5.382813 C 38 4.496094 37.609375 3.65625 36.925781 3.085938 C 36.417969 2.65625 35.789063 2.414063 35.136719 2.386719 Z M 35.105469 4.390625 C 35.359375 4.414063 35.542969 4.535156 35.640625 4.617188 C 35.777344 4.730469 36 4.980469 36 5.382813 L 36 56.613281 C 36 57.019531 35.777344 57.269531 35.640625 57.382813 C 35.507813 57.496094 35.226563 57.671875 34.828125 57.601563 L 5.652344 52.453125 C 4.695313 52.285156 4 51.457031 4 50.484375 L 4 11.515625 C 4 10.542969 4.695313 9.714844 5.652344 9.546875 L 34.824219 4.398438 C 34.925781 4.382813 35.019531 4.378906 35.105469 4.390625 Z M 38 12 L 57 12 C 57.550781 12 58 12.449219 58 13 L 58 49 C 58 49.550781 57.550781 50 57 50 L 38 50 L 38 44 L 41 44 C 41.550781 44 42 43.554688 42 43 C 42 42.445313 41.550781 42 41 42 L 38 42 L 38 38 L 41 38 C 41.550781 38 42 37.554688 42 37 C 42 36.445313 41.550781 36 41 36 L 38 36 L 38 32 L 41 32 C 41.550781 32 42 31.554688 42 31 C 42 30.445313 41.550781 30 41 30 L 38 30 L 38 26 L 41 26 C 41.550781 26 42 25.554688 42 25 C 42 24.445313 41.550781 24 41 24 L 38 24 L 38 20 L 41 20 C 41.550781 20 42 19.554688 42 19 C 42 18.445313 41.550781 18 41 18 L 38 18 Z M 45 18 C 44.449219 18 44 18.445313 44 19 C 44 19.554688 44.449219 20 45 20 L 51 20 C 51.550781 20 52 19.554688 52 19 C 52 18.445313 51.550781 18 51 18 Z M 12.824219 20.015625 C 12.695313 20.039063 12.570313 20.085938 12.453125 20.160156 C 11.992188 20.460938 11.859375 21.082031 12.160156 21.546875 L 18.308594 31 L 12.160156 40.453125 C 11.859375 40.917969 11.992188 41.539063 12.453125 41.839844 C 12.625 41.949219 12.8125 42 13 42 C 13.324219 42 13.648438 41.839844 13.839844 41.546875 L 19.5 32.835938 L 25.160156 41.546875 C 25.351563 41.839844 25.675781 42 26 42 C 26.1875 42 26.375 41.949219 26.546875 41.839844 C 27.007813 41.539063 27.140625 40.917969 26.839844 40.453125 L 20.691406 31 L 26.839844 21.546875 C 27.140625 21.082031 27.007813 20.460938 26.546875 20.160156 C 26.082031 19.859375 25.460938 19.992188 25.160156 20.453125 L 19.5 29.164063 L 13.839844 20.453125 C 13.613281 20.105469 13.207031 19.945313 12.824219 20.015625 Z M 45 24 C 44.449219 24 44 24.445313 44 25 C 44 25.554688 44.449219 26 45 26 L 51 26 C 51.550781 26 52 25.554688 52 25 C 52 24.445313 51.550781 24 51 24 Z M 45 30 C 44.449219 30 44 30.445313 44 31 C 44 31.554688 44.449219 32 45 32 L 51 32 C 51.550781 32 52 31.554688 52 31 C 52 30.445313 51.550781 30 51 30 Z M 45 36 C 44.449219 36 44 36.445313 44 37 C 44 37.554688 44.449219 38 45 38 L 51 38 C 51.550781 38 52 37.554688 52 37 C 52 36.445313 51.550781 36 51 36 Z M 45 42 C 44.449219 42 44 42.445313 44 43 C 44 43.554688 44.449219 44 45 44 L 51 44 C 51.550781 44 52 43.554688 52 43 C 52 42.445313 51.550781 42 51 42 Z "})})),Ip=T(e.jsx("g",{children:e.jsx("path",{d:"M 3 8 C 1.347656 8 0 9.347656 0 11 L 0 52 C 0 54.207031 1.792969 56 4 56 L 58 56 C 60.207031 56 62 54.207031 62 52 L 62 21 C 62 19.347656 60.652344 18 59 18 L 56 18 L 56 17 C 56 15.347656 54.652344 14 53 14 L 27.707031 14 C 26.910156 14 26.164063 13.691406 25.597656 13.132813 L 21.875 9.445313 C 20.929688 8.515625 19.679688 8 18.355469 8 Z M 3 10 L 18.355469 10 C 19.152344 10 19.898438 10.308594 20.464844 10.867188 L 24.1875 14.554688 C 25.132813 15.484375 26.382813 16 27.707031 16 L 53 16 C 53.550781 16 54 16.449219 54 17 L 54 52 C 54 52.617188 54.222656 53.339844 54.632813 54 L 4 54 C 2.898438 54 2 53.101563 2 52 L 2 46 L 43 46 C 43.550781 46 44 45.550781 44 45 C 44 44.449219 43.550781 44 43 44 L 2 44 L 2 11 C 2 10.449219 2.449219 10 3 10 Z M 56 20 L 59 20 C 59.550781 20 60 20.449219 60 21 L 60 52 C 60 53.101563 59.101563 54 58 54 C 56.753906 54 56 52.609375 56 52 Z M 27 22 C 24.242188 22 22 24.242188 22 27 L 22 29 C 22 29.992188 22.300781 30.914063 22.800781 31.691406 C 20.058594 32.886719 17.882813 35.527344 17.28125 38.765625 C 17.179688 39.3125 17.539063 39.832031 18.082031 39.933594 C 18.625 40.035156 19.148438 39.675781 19.25 39.132813 C 19.785156 36.242188 21.863281 33.949219 24.371094 33.234375 C 25.136719 33.710938 26.03125 34 27 34 C 27.96875 34 28.863281 33.710938 29.628906 33.234375 C 32.136719 33.949219 34.214844 36.246094 34.75 39.136719 C 34.839844 39.617188 35.261719 39.953125 35.734375 39.953125 C 35.796875 39.953125 35.855469 39.949219 35.917969 39.9375 C 36.460938 39.835938 36.820313 39.3125 36.71875 38.769531 C 36.117188 35.53125 33.941406 32.886719 31.199219 31.691406 C 31.699219 30.914063 32 29.992188 32 29 L 32 27 C 32 24.242188 29.757813 22 27 22 Z M 27 24 C 28.652344 24 30 25.347656 30 27 L 30 29 C 30 30.652344 28.652344 32 27 32 C 25.347656 32 24 30.652344 24 29 L 24 27 C 24 25.347656 25.347656 24 27 24 Z M 47 44 C 46.449219 44 46 44.449219 46 45 C 46 45.550781 46.449219 46 47 46 L 51 46 C 51.550781 46 52 45.550781 52 45 C 52 44.449219 51.550781 44 51 44 Z M 5 48 C 4.449219 48 4 48.449219 4 49 L 4 51 C 4 51.550781 4.449219 52 5 52 C 5.550781 52 6 51.550781 6 51 L 6 49 C 6 48.449219 5.550781 48 5 48 Z M 10 48 C 9.449219 48 9 48.449219 9 49 L 9 51 C 9 51.550781 9.449219 52 10 52 C 10.550781 52 11 51.550781 11 51 L 11 49 C 11 48.449219 10.550781 48 10 48 Z M 15 48 C 14.449219 48 14 48.449219 14 49 L 14 51 C 14 51.550781 14.449219 52 15 52 C 15.550781 52 16 51.550781 16 51 L 16 49 C 16 48.449219 15.550781 48 15 48 Z M 20 48 C 19.449219 48 19 48.449219 19 49 L 19 51 C 19 51.550781 19.449219 52 20 52 C 20.550781 52 21 51.550781 21 51 L 21 49 C 21 48.449219 20.550781 48 20 48 Z M 25 48 C 24.449219 48 24 48.449219 24 49 L 24 51 C 24 51.550781 24.449219 52 25 52 C 25.550781 52 26 51.550781 26 51 L 26 49 C 26 48.449219 25.550781 48 25 48 Z M 30 48 C 29.449219 48 29 48.449219 29 49 L 29 51 C 29 51.550781 29.449219 52 30 52 C 30.550781 52 31 51.550781 31 51 L 31 49 C 31 48.449219 30.550781 48 30 48 Z M 35 48 C 34.449219 48 34 48.449219 34 49 L 34 51 C 34 51.550781 34.449219 52 35 52 C 35.550781 52 36 51.550781 36 51 L 36 49 C 36 48.449219 35.550781 48 35 48 Z M 40 48 C 39.449219 48 39 48.449219 39 49 L 39 51 C 39 51.550781 39.449219 52 40 52 C 40.550781 52 41 51.550781 41 51 L 41 49 C 41 48.449219 40.550781 48 40 48 Z M 45 48 C 44.449219 48 44 48.449219 44 49 L 44 51 C 44 51.550781 44.449219 52 45 52 C 45.550781 52 46 51.550781 46 51 L 46 49 C 46 48.449219 45.550781 48 45 48 Z M 50 48 C 49.449219 48 49 48.449219 49 49 L 49 51 C 49 51.550781 49.449219 52 50 52 C 50.550781 52 51 51.550781 51 51 L 51 49 C 51 48.449219 50.550781 48 50 48 Z "})}));function bl({type:s,mime:t,className:a,size:r}){!s&&t&&(s=t.split("/")[0]);const i=er[s]||er.default;return e.jsx(i,{size:r,className:w(a,`${s}-file-color`),viewBox:"0 0 64 64"})}const er={default:bp,audio:vp,video:yp,text:Cp,pdf:wp,archive:Sp,folder:Np,sharedFolder:Ip,image:kp,powerPoint:Lp,word:_p,spreadsheet:Mp},Fp=2*1024*1024;function Pp({file:s,className:t,iconClassName:a,showImage:r=!0}){const{trans:i}=z(),{previewUrl:l}=ms(s,{thumbnail:!0});if(s.file_size&&s.file_size>Fp&&!s.thumbnail&&(r=!1),r&&s.type==="image"&&l){const o=i({message:":fileName thumbnail",values:{fileName:s.name}});return e.jsx("img",{className:w(t,"object-cover"),src:l,alt:o,draggable:!1})}return e.jsx(bl,{className:a,type:s.type})}function Tp({entries:s,onClose:t,showHeader:a=!0,className:r,headerActionsLeft:i,allowDownload:l=!0,...o}){const c=jr("(max-width: 1024px)"),[u,x]=Xs(o.activeIndex,o.defaultActiveIndex||0,o.onActiveIndexChange),g=s[u],j=m.useMemo(()=>({entries:s,activeIndex:u}),[s,u]),v=fp(g);if(!g)return t==null||t(),null;const f=s.length-1>u,N=()=>{x(u+1)},y=u>0,L=()=>{x(u-1)};return e.jsxs(fn.Provider,{value:j,children:[a&&e.jsx(Ep,{actionsLeft:i,isMobile:c,onClose:t,onNext:f?N:void 0,onPrevious:y?L:void 0,allowDownload:l}),e.jsxs("div",{className:w("overflow-hidden relative flex-auto",r),children:[c&&e.jsx(C,{size:"lg",className:"text-muted absolute left-0 top-1/2 transform -translate-y-1/2 z-10",disabled:!y,onClick:L,children:e.jsx(zt,{})}),e.jsx(Oe,{initial:!1,children:e.jsx(De.div,{className:"absolute inset-0 flex items-center justify-center",...Je,children:e.jsx(v,{className:"max-h-[calc(100%-30px)]",entry:g,allowDownload:l})},g.id)}),c&&e.jsx(C,{size:"lg",className:"text-muted absolute right-0 top-1/2 transform -translate-y-1/2 z-10",disabled:!f,onClick:N,children:e.jsx(ct,{})})]})]})}function Ep({onNext:s,onPrevious:t,onClose:a,isMobile:r,actionsLeft:i,allowDownload:l}){const{entries:o,activeIndex:c}=m.useContext(fn),u=o[c],{downloadUrl:x}=ms(u),v=r?e.jsx(C,{onClick:()=>{x&&Ls(x)},children:e.jsx(Ca,{})}):e.jsx(b,{startIcon:e.jsx(Ca,{}),variant:"text",onClick:()=>{x&&Ls(x)},children:e.jsx(n,{message:"Download"})});return e.jsxs("div",{className:"flex items-center justify-between gap-20 bg-paper border-b flex-shrink-0 text-sm min-h-50 px-10 text-muted",children:[e.jsxs("div",{className:"flex items-center gap-4 w-1/3 justify-start",children:[i,l?v:void 0]}),e.jsxs("div",{className:"flex items-center gap-10 w-1/3 justify-center flex-nowrap text-main",children:[e.jsx(Pp,{file:u,iconClassName:"w-16 h-16",showImage:!1}),e.jsx("div",{className:"whitespace-nowrap overflow-hidden overflow-ellipsis",children:u.name})]}),e.jsxs("div",{className:"w-1/3 flex items-center gap-10 justify-end whitespace-nowrap",children:[!r&&e.jsxs(m.Fragment,{children:[e.jsx(C,{disabled:!t,onClick:t,children:e.jsx(Sc,{})}),e.jsx("div",{children:c+1}),e.jsx("div",{children:"/"}),e.jsx("div",{children:o.length}),e.jsx(C,{disabled:!s,onClick:s,children:e.jsx(hd,{})}),e.jsx("div",{className:"bg-divider w-1 h-24 mx-20"})]}),e.jsx(C,{radius:"rounded-none",onClick:a,children:e.jsx($e,{})})]})]})}function zp(s){return e.jsx(G,{size:"fullscreenTakeover",background:"bg-alt",className:"flex flex-col",children:e.jsx(Dp,{...s})})}function Dp(s){const{close:t}=K();return e.jsx(Tp,{onClose:t,...s})}const Ap={key:"type",label:d("Type"),description:d("Type of the file"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"05",options:[{key:"02",label:d("Text"),value:"text"},{key:"03",label:d("Audio"),value:"audio"},{key:"04",label:d("Video"),value:"video"},{key:"05",label:d("Image"),value:"image"},{key:"06",label:d("PDF"),value:"pdf"},{key:"07",label:d("Spreadsheet"),value:"spreadsheet"},{key:"08",label:d("Word Document"),value:"word"},{key:"09",label:d("Photoshop"),value:"photoshop"},{key:"10",label:d("Archive"),value:"archive"},{key:"11",label:d("Folder"),value:"folder"}]}},$p=[Ap,{key:"public",label:d("Visibility"),description:d("Whether file is publicly accessible"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("Private"),value:!1},{key:"02",label:d("Public"),value:!0}]}},Se({description:d("Date file was uploaded")}),Ie({description:d("Date file was last changed")}),{key:"owner_id",label:d("Uploader"),description:d("User that this file was uploaded by"),defaultOperator:R.eq,control:{type:H.SelectModel,model:ht}}],Rp=[{key:"name",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Name"}),body:s=>e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"overflow-x-hidden overflow-ellipsis",children:s.name}),e.jsx("div",{className:"text-muted text-xs overflow-x-hidden overflow-ellipsis",children:s.file_name})]})},{key:"owner_id",allowsSorting:!0,width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Uploader"}),body:s=>{var a;const t=(a=s.users)==null?void 0:a[0];return t?e.jsx(us,{image:t.avatar,label:t.display_name,description:t.email}):null}},{key:"type",width:"w-100 flex-shrink-0",allowsSorting:!0,header:()=>e.jsx(n,{message:"Type"}),body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(bl,{type:s.type,className:"w-24 h-24 overflow-hidden"}),e.jsx("div",{className:"capitalize",children:s.type})]})},{key:"public",allowsSorting:!0,width:"w-60 flex-shrink-0",header:()=>e.jsx(n,{message:"Public"}),body:s=>s.public?e.jsx($t,{className:"icon-md text-positive"}):e.jsx($e,{className:"icon-md text-danger"})},{key:"file_size",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"File size"}),body:s=>e.jsx(jn,{bytes:s.file_size})},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(ne,{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(A,{type:"modal",children:[e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(fl,{})}),e.jsx(zp,{entries:[s]})]})}];function Vp(){return e.jsx(he,{endpoint:"file-entries",title:e.jsx(n,{message:"Uploaded files and folders"}),columns:Rp,filters:$p,selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:lp,title:e.jsx(n,{message:"Nothing has been uploaded yet"}),filteringTitle:e.jsx(n,{message:"No matching files or folders"})})})}const qp=[{key:"ends_at",label:d("Status"),description:d("Whether subscription is active or cancelled"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"active",options:[{key:"active",label:d("Active"),value:{value:null,operator:R.eq}},{key:"cancelled",label:d("Cancelled"),value:{value:null,operator:R.ne}}]}},{control:{type:H.Select,defaultValue:"stripe",options:[{key:"stripe",label:d("Stripe"),value:"stripe"},{key:"paypal",label:d("PayPal"),value:"paypal"},{key:"none",label:d("None"),value:"none"}]},key:"gateway_name",label:d("Gateway"),description:d("With which payment provider was subscription created"),defaultOperator:R.eq},tt({key:"renews_at",label:d("Renew date"),description:d("Date subscription will renew")}),Se({description:d("Date subscription was created")}),Ie({description:d("Date subscription was last updated")})],Op=""+new URL("subscriptions-7eacea42.svg",import.meta.url).href;function Up(s){const{trans:t}=z();return I({mutationFn:a=>Bp(a),onSuccess:()=>{M(t(d("Subscription updated"))),_.invalidateQueries({queryKey:J("billing/subscriptions")})},onError:a=>ee(a,s)})}function Bp({id:s,...t}){return S.put(`billing/subscriptions/${s}`,t).then(a=>a.data)}function vl({form:s,onSubmit:t,formId:a}){var o,c;const r=Ho(),i=s.watch("product_id"),l=(o=r.data)==null?void 0:o.products.find(u=>u.id===i);return e.jsxs(te,{id:a,form:s,onSubmit:t,children:[e.jsx(Vr,{name:"user_id",className:"mb-20",endpoint:"normalized-models/user",label:e.jsx(n,{message:"User"})}),e.jsx(D,{name:"product_id",selectionMode:"single",className:"mb-20",label:e.jsx(n,{message:"Plan"}),children:(c=r.data)==null?void 0:c.products.filter(u=>!u.free).map(u=>e.jsx(h,{value:u.id,children:e.jsx(n,{message:u.name})},u.id))}),!(l!=null&&l.free)&&e.jsx(D,{name:"price_id",selectionMode:"single",className:"mb-20",label:e.jsx(n,{message:"Price"}),children:l==null?void 0:l.prices.map(u=>e.jsx(h,{value:u.id,children:e.jsx(qa,{price:u})},u.id))}),e.jsx(p,{inputElementType:"textarea",rows:3,name:"description",label:e.jsx(n,{message:"Description"}),className:"mb-20"}),e.jsx(_s,{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(_s,{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 Hp({subscription:s}){const{close:t,formId:a}=K(),r=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}}),i=Up(r);return e.jsxs(G,{size:"md",children:[e.jsx(se,{children:e.jsx(n,{message:"Update subscription"})}),e.jsx(X,{children:e.jsx(vl,{formId:a,form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>{t()}})}})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>{t()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,disabled:i.isPending,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}const yl="billing/subscriptions";function Zp(s){const{trans:t}=z();return I({mutationFn:a=>Kp(a),onSuccess:()=>{M(t(d("Subscription created"))),_.invalidateQueries({queryKey:J(yl)})},onError:a=>ee(a,s)})}function Kp(s){return S.post(yl,s).then(t=>t.data)}function Wp(){const{close:s,formId:t}=K(),a=O({}),r=Zp(a);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Add new subscription"})}),e.jsx(X,{children:e.jsx(vl,{formId:t,form:a,onSubmit:i=>{r.mutate(i,{onSuccess:()=>{s()}})}})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>{s()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:t,disabled:r.isPending,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}const Qp=T(e.jsx("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}),"PauseOutlined"),Gp=T(e.jsx("path",{d:"M10 8.64 15.27 12 10 15.36V8.64M8 5v14l11-7L8 5z"}),"PlayArrowOutlined"),ta="billing/subscriptions",Jp=[{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(us,{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(Rt,{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 t;return(t=s.product)==null?void 0:t.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=>e.jsx(ne,{date:s.renews_at})},{key:"ends_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Ends at"}),body:s=>e.jsx(ne,{date:s.ends_at})},{key:"created_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Created at"}),body:s=>e.jsx(ne,{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(e5,{subscription:s})}];function Yp(){return e.jsx(he,{endpoint:ta,title:e.jsx(n,{message:"Subscriptions"}),columns:Jp,filters:qp,actions:e.jsx(Xp,{}),enableSelection:!1,selectedActions:e.jsx(Fe,{}),queryParams:{with:"product"},emptyStateMessage:e.jsx(oe,{image:Op,title:e.jsx(n,{message:"No subscriptions have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching subscriptions"})})})}function Xp(){return e.jsx(e.Fragment,{children:e.jsxs(A,{type:"modal",children:[e.jsx(je,{children:e.jsx(n,{message:"Add new subscription"})}),e.jsx(Wp,{})]})})}function e5({subscription:s}){return e.jsxs(m.Fragment,{children:[e.jsxs(A,{type:"modal",children:[e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(xe,{})}),e.jsx(Hp,{subscription:s})]}),s.cancelled&&s.on_grace_period?e.jsx(t5,{subscription:s}):null,s.active?e.jsx(s5,{subscription:s}):null,e.jsx(a5,{subscription:s})]})}function s5({subscription:s}){const t=Pr(),a=()=>{t.mutate({subscriptionId:s.id},{onSuccess:()=>{_.invalidateQueries({queryKey:J(ta)})}})};return e.jsxs(A,{type:"modal",onClose:r=>{r&&a()},children:[e.jsx(W,{label:e.jsx(n,{message:"Cancel subscription"}),children:e.jsx(C,{size:"md",className:"text-muted",disabled:t.isPending,children:e.jsx(Qp,{})})}),e.jsx(ce,{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 t5({subscription:s}){const t=dc(),a=()=>{t.mutate({subscriptionId:s.id},{onSuccess:()=>{_.invalidateQueries({queryKey:J(ta)})}})};return e.jsxs(A,{type:"modal",onClose:r=>{r&&a()},children:[e.jsx(W,{label:e.jsx(n,{message:"Renew subscription"}),children:e.jsx(C,{size:"md",className:"text-muted",onClick:a,disabled:t.isPending,children:e.jsx(Gp,{})})}),e.jsx(ce,{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 a5({subscription:s}){const t=Pr(),a=()=>{t.mutate({subscriptionId:s.id,delete:!0},{onSuccess:()=>{_.invalidateQueries({queryKey:J(ta)})}})};return e.jsxs(A,{type:"modal",onClose:r=>{r&&a()},children:[e.jsx(W,{label:e.jsx(n,{message:"Delete subscription"}),children:e.jsx(C,{size:"md",className:"text-muted",disabled:t.isPending,children:e.jsx($e,{})})}),e.jsx(ce,{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 n5=T(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 r5(){const{trans:s}=z();return I({mutationFn:()=>i5(),onSuccess:()=>{M(s(d("Plans synced")))},onError:t=>q(t,d("Could not sync plans"))})}function i5(){return S.post("billing/products/sync").then(s=>s.data)}const l5=s=>`billing/products/${s}`;function o5(){const{trans:s}=z();return I({mutationFn:t=>c5(t),onSuccess:()=>{M(s(d("Plan deleted"))),_.invalidateQueries({queryKey:J("billing/products")})},onError:t=>q(t)})}function c5({productId:s}){return S.delete(l5(s)).then(t=>t.data)}const d5=[{key:"subscriptions",label:d("Subscriptions"),description:d("Whether plan has any active subscriptions"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("Has active subscriptions"),value:{value:"*",operator:R.has}},{key:"02",label:d("Does not have active subscriptions"),value:{value:"*",operator:R.doesntHave}}]}},Se({description:d("Date plan was created")}),Ie({description:d("Date plan was last updated")})],u5=[{key:"name",allowsSorting:!0,visibleInMode:"all",header:()=>e.jsx(n,{message:"Name"}),body:s=>{const t=s.prices[0];return e.jsx(us,{label:s.name,description:s.free?e.jsx(n,{message:"Free"}):e.jsx(qa,{price:t})})}},{key:"created_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Created"}),body:s=>e.jsx(ne,{date:s.created_at})},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(ne,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),visibleInMode:"all",hideHeader:!0,align:"end",maxWidth:"max-w-84",body:s=>e.jsxs(m.Fragment,{children:[e.jsx(C,{size:"md",className:"text-muted",elementType:F,to:`/admin/plans/${s.id}/edit`,children:e.jsx(xe,{})}),e.jsx(x5,{product:s})]})}];function m5(){const s=Y();return e.jsx(he,{endpoint:"billing/products",title:e.jsx(n,{message:"Subscription plans"}),columns:u5,actions:e.jsx(h5,{}),enableSelection:!1,filters:d5,onRowAction:t=>{s(`/admin/plans/${t.id}/edit`)},emptyStateMessage:e.jsx(oe,{image:pn,title:e.jsx(n,{message:"No plans have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching plans"})})})}function x5({product:s}){const t=o5();return e.jsxs(A,{type:"modal",onClose:a=>{a&&t.mutate({productId:s.id})},children:[e.jsx(W,{label:e.jsx(n,{message:"Delete plan"}),children:e.jsx(C,{size:"md",className:"text-muted",disabled:t.isPending,children:e.jsx(es,{})})}),e.jsx(ce,{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 h5(){const s=r5();return e.jsxs(m.Fragment,{children:[e.jsx(W,{label:e.jsx(n,{message:"Sync plans with Stripe & PayPal"}),children:e.jsx(C,{color:"primary",variant:"outline",size:"sm",disabled:s.isPending,onClick:()=>{s.mutate()},children:e.jsx(n5,{})})}),e.jsx(je,{elementType:F,to:"/admin/plans/new",children:e.jsx(n,{message:"Add new plan"})})]})}const Cl=s=>`billing/products/${s}`;function g5(){const{productId:s}=V();return be({queryKey:[Cl(s)],queryFn:()=>p5(s)})}function p5(s){return S.get(Cl(s)).then(t=>t.data)}const Ma=[{key:"day1",label:d("Daily"),interval:"day",interval_count:1},{key:"week1",label:d("Weekly"),interval:"week",interval_count:1},{key:"month1",label:d("Monthly"),interval:"month",interval_count:1},{key:"month3",label:d("Every 3 months"),interval:"month",interval_count:3},{key:"month6",label:d("Every 6 months"),interval:"month",interval_count:6},{key:"year1",label:d("Yearly"),interval:"year",interval_count:1},{key:"custom",label:d("Custom"),interval:null,interval_count:null}];function j5({index:s,onRemovePrice:t}){const{trans:a}=z(),r=le(["currencies"]),i=m.useMemo(()=>{var f;return(f=r.data)!=null&&f.currencies?Object.values(r.data.currencies):[]},[r.data]),{watch:l,getValues:o}=P(),c=!l("id"),u=l(`prices.${s}.id`)==null,x=l(`prices.${s}.subscriptions_count`)||0,[g,j]=m.useState(()=>{const f=o(`prices.${s}.interval`),N=o(`prices.${s}.interval_count`),y=Ma.find(L=>L.key===`${f}${N}`);return y?y.key:"custom"}),v=c||u||!x;return e.jsxs(m.Fragment,{children:[!v&&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:!v,label:e.jsx(n,{message:"Amount"}),type:"number",min:.1,step:.01,name:`prices.${s}.amount`,className:"mb-20"}),e.jsx(D,{required:!0,disabled:!v,label:e.jsx(n,{message:"Currency"}),name:`prices.${s}.currency`,items:i,showSearchField:!0,searchPlaceholder:a(d("Search currencies")),selectionMode:"single",className:"mb-20",children:f=>e.jsx(h,{value:f.code,children:`${f.code}: ${f.name}`},f.code)}),e.jsx(f5,{disabled:!v,index:s,value:g,onValueChange:j}),g==="custom"&&e.jsx(b5,{disabled:!v,index:s}),e.jsx("div",{className:"text-right",children:e.jsx(b,{size:"xs",variant:"outline",color:"danger",disabled:!v,onClick:()=>{t()},children:e.jsx(n,{message:"Delete price"})})})]})}function f5({index:s,value:t,onValueChange:a,disabled:r}){const{setValue:i}=P();return e.jsx(Ye,{label:e.jsx(n,{message:"Billing period"}),disabled:r,className:"mb-20",selectionMode:"single",selectedValue:t,onSelectionChange:l=>{if(a(l),l!=="custom"){const o=Ma.find(c=>c.key===l);o&&(i(`prices.${s}.interval`,o.interval),i(`prices.${s}.interval_count`,o.interval_count))}},children:Ma.map(l=>e.jsx(h,{value:l.key,children:e.jsx(n,{...l.label})},l.key))})}function b5({index:s,disabled:t}){const{watch:a}=P(),r=a(`prices.${s}.interval`);let i;return r==="day"?i=365:r==="week"?i=52:i=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:i,disabled:t,required:!0}),e.jsxs(D,{inputShadow:"shadow-none",inputBorder:"border-none",name:`prices.${s}.interval`,selectionMode:"single",disabled:t,children:[e.jsx(h,{value:"day",children:e.jsx(n,{message:"Days"})}),e.jsx(h,{value:"week",children:e.jsx(n,{message:"Weeks"})}),e.jsx(h,{value:"month",children:e.jsx(n,{message:"Months"})})]})]})}function wl(){return e.jsxs(m.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(D,{name:"position",selectionMode:"single",label:e.jsx(n,{message:"Position in pricing table"}),className:"mb-20",children:[e.jsx(h,{value:0,children:e.jsx(n,{message:"First"})}),e.jsx(h,{value:1,children:e.jsx(n,{message:"Second"})}),e.jsx(h,{value:2,children:e.jsx(n,{message:"Third"})}),e.jsx(h,{value:3,children:e.jsx(n,{message:"Fourth"})}),e.jsx(h,{value:4,children:e.jsx(n,{message:"Fifth"})})]}),e.jsx(Ys,{className:"mb-30",name:"available_space",label:e.jsx(n,{message:"Allowed storage space"}),description:e.jsx(n,{values:{a:s=>e.jsx(F,{className:lt,target:"_blank",to:"/admin/settings/uploading",children:s})},message:"Total storage space all user uploads are allowed to take up."})}),e.jsx($,{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($,{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($,{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(Ia,{children:e.jsx(n,{message:"Feature list"})}),e.jsx(v5,{}),e.jsx(y5,{}),e.jsx(Ia,{children:e.jsx(n,{message:"Permissions"})}),e.jsx(cn,{name:"permissions"})]})}function Ia({children:s}){return e.jsx("h2",{className:"mt-40 mb-20 text-base font-semibold",children:s})}function v5(){const{fields:s,append:t,remove:a}=Re({name:"feature_list"});return e.jsxs("div",{children:[s.map((r,i)=>e.jsxs("div",{className:"flex gap-10 mb-10",children:[e.jsx(p,{name:`feature_list.${i}.value`,size:"sm",className:"flex-auto"}),e.jsx(C,{size:"sm",color:"primary",className:"flex-shrink-0",onClick:()=>{a(i)},children:e.jsx($e,{})})]},r.id)),e.jsx(b,{variant:"text",color:"primary",startIcon:e.jsx(me,{}),size:"xs",onClick:()=>{t({value:""})},children:e.jsx(n,{message:"Add another line"})})]})}function y5(){var l;const{watch:s,formState:{errors:t}}=P(),{fields:a,append:r,remove:i}=Re({name:"prices",keyName:"key"});return s("free")?null:e.jsxs(m.Fragment,{children:[e.jsx(Ia,{children:e.jsx(n,{message:"Pricing"})}),((l=t.prices)==null?void 0:l.message)&&e.jsx("div",{className:"text-sm text-danger mb-20",children:t.prices.message}),e.jsx(Cs,{variant:"outline",className:"mb-10",children:a.map((o,c)=>e.jsx(Ce,{label:e.jsx(qa,{price:o}),children:e.jsx(j5,{index:c,onRemovePrice:()=>{i(c)}})},o.key))}),e.jsx(b,{variant:"text",color:"primary",startIcon:e.jsx(me,{}),size:"xs",onClick:()=>{r({currency:"USD",amount:1,interval_count:1,interval:"month"})},children:e.jsx(n,{message:"Add another price"})})]})}const Sl=s=>`billing/products/${s}`;function C5(s){const{trans:t}=z(),a=Y();return I({mutationFn:r=>w5(r),onSuccess:r=>{M(t(d("Plan updated"))),_.invalidateQueries({queryKey:[Sl(r.product.id)]}),_.invalidateQueries({queryKey:J("billing/products")}),a("/admin/plans")},onError:r=>ee(r,s)})}function w5({id:s,...t}){const a={...t,feature_list:t.feature_list.map(r=>r.value)};return S.put(Sl(s),a).then(r=>r.data)}function S5(){const s=g5();return s.status!=="success"?e.jsx(_e,{}):e.jsx(N5,{product:s.data.product})}function N5({product:s}){const t=O({defaultValues:{...s,feature_list:s.feature_list.map(r=>({value:r}))}}),a=C5(t);return e.jsx(We,{form:t,onSubmit:r=>{a.mutate(r)},title:e.jsx(n,{message:"Edit “:name“ plan",values:{name:s.name}}),isLoading:a.isPending,children:e.jsx(wl,{})})}const Nl="billing/products";function k5(s){const{trans:t}=z(),a=Y();return I({mutationFn:r=>L5(r),onSuccess:()=>{M(t(d("Plan created"))),_.invalidateQueries({queryKey:[Nl]}),_.invalidateQueries({queryKey:J("billing/products")}),a("/admin/plans")},onError:r=>ee(r,s)})}function L5(s){const t={...s,feature_list:s.feature_list.map(a=>a.value)};return S.post(Nl,t).then(a=>a.data)}function _5(){const s=O({defaultValues:{free:!1,recommended:!1}}),t=k5(s);return e.jsx(We,{form:s,onSubmit:a=>{t.mutate(a)},title:e.jsx(n,{message:"Create new plan"}),isLoading:t.isPending,children:e.jsx(wl,{})})}function M5(){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(I5,{}),e.jsx(Ge,{}),e.jsx(F5,{})]})}function I5(){const{watch:s}=P(),t=s("client.cookie_notice.enable");return e.jsxs("div",{children:[e.jsx($,{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"})}),t&&e.jsxs(m.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(Ds,{hideRoleAndPermissionFields:!0,formPathPrefix:"client.cookie_notice.button"})]}),e.jsxs(D,{name:"client.cookie_notice.position",selectionMode:"single",label:e.jsx(n,{message:"Cookie notice position"}),className:"mb-20",children:[e.jsx(h,{value:"top",children:e.jsx(n,{message:"Top"})}),e.jsx(h,{value:"bottom",children:e.jsx(n,{message:"Bottom"})})]})]})]})}function F5(){const{fields:s,append:t,remove:a}=Re({name:"client.registration.policies"});return e.jsxs(m.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(Cs,{className:"mt-16",variant:"outline",children:s.map((r,i)=>e.jsx(Ce,{label:r.label,chevronPosition:"left",endAppend:e.jsx(C,{variant:"text",color:"danger",size:"sm",onClick:()=>{a(i)},children:e.jsx($e,{})}),children:e.jsx(Ds,{hideRoleAndPermissionFields:!0,formPathPrefix:`client.register_policies.${i}`})},r.id))}),e.jsxs(A,{type:"modal",onClose:r=>{r&&t(r)},children:[e.jsx(b,{className:"mt-12",variant:"link",color:"primary",startIcon:e.jsx(me,{}),size:"xs",children:e.jsx(n,{message:"Add another policy"})}),e.jsx(al,{title:e.jsx(n,{message:"Add policy"})})]})]})}const aa=T(e.jsx("path",{d:"M9 8a1 1 0 0 0-1-1H5.5a1 1 0 1 0 0 2H7v4a1 1 0 0 0 2 0zM4 0h8a4 4 0 0 1 4 4v8a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4zm4 5.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"}),"InfoDialogTrigger");function jt({title:s,body:t,dialogSize:a="sm",className:r}){return e.jsxs(A,{type:"popover",triggerOnHover:!0,children:[e.jsx(C,{className:w("ml-4 text-muted opacity-70",r),iconSize:"xs",size:"2xs",children:e.jsx(aa,{viewBox:"0 0 16 16"})}),e.jsxs(G,{size:a,children:[s&&e.jsx(se,{padding:"px-18 pt-12",size:"md",hideDismissButton:!0,children:s}),e.jsx(X,{children:t})]})]})}const P5=T(e.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z"}),"HomeOutlined"),T5=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>e.jsx(n,{message:"Name"}),body:s=>e.jsxs("div",{children:[e.jsx("div",{className:"overflow-hidden overflow-ellipsis whitespace-nowrap font-medium",children:e.jsx(z5,{channel:s})}),s.config.adminDescription&&e.jsx("p",{className:"max-w-680 whitespace-normal text-xs text-muted",children:s.config.adminDescription})]})},{key:"content",allowsSorting:!1,header:()=>e.jsx(n,{message:"Content"}),body:s=>e.jsx(E5,{channel:s})},{key:"content_type",allowsSorting:!1,header:()=>e.jsx(n,{message:"Content type"}),body:s=>e.jsx("span",{className:"capitalize",children:s.config.contentModel?e.jsx(n,{message:s.config.contentModel}):void 0})},{key:"internal",allowsSorting:!0,maxWidth:"max-w-100",hideHeader:!0,header:()=>e.jsx(n,{message:"Internal"}),body:s=>e.jsx(D5,{channel:s})},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(ne,{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(F,{to:`${s.id}/edit`,className:"text-muted",children:e.jsx(C,{size:"md",children:e.jsx(xe,{})})})}];function E5({channel:s}){switch(s.config.contentType){case"listAll":return e.jsx(n,{message:"List all"});case"manual":return e.jsx(n,{message:"Managed manually"});case"autoUpdate":return e.jsx(n,{message:"Updated automatically"})}}function z5({channel:s}){return s.config.restriction&&s.config.restrictionModelId==="urlParam"?s.name:e.jsx("a",{className:"outline-none hover:underline focus-visible:underline",href:`channel/${s.slug}`,target:"_blank",rel:"noreferrer",children:s.name})}function D5({channel:s}){const{homepage:t}=ue(),a=s.internal?e.jsx(W,{label:e.jsx(n,{message:"This channel is required for some site functionality to work properly and can't be deleted."}),children:e.jsx("div",{children:e.jsx(Rt,{className:"w-max",size:"xs",radius:"rounded-panel",children:e.jsx(n,{message:"Internal"})})})}):"",r=(t==null?void 0:t.type)==="channels"&&`${t.value}`==`${s.id}`;return e.jsxs("div",{className:"flex items-center gap-6",children:[a,r?e.jsx(P5,{className:"text-muted",size:"sm"}):null]})}function A5(){const{trans:s}=z();return I({mutationFn:t=>$5(t),onSuccess:async()=>{await _.invalidateQueries({queryKey:J("channel")}),M(s(d("Channel preset applied")))},onError:t=>q(t)})}function $5(s){return S.post("channel/apply-preset",s).then(t=>t.data)}function bn({className:s,hash:t}){const{admin:a}=m.useContext(Xe);if(!(a!=null&&a.channelsDocsLink))return null;const r=t?`${a.channelsDocsLink}#${t}`:a.channelsDocsLink;return e.jsx(pt,{link:r,className:s})}function R5(){return e.jsx(he,{endpoint:"channel",title:e.jsx(n,{message:"Channels"}),headerContent:e.jsx(V5,{}),headerItemsAlign:"items-center",queryParams:{type:"channel"},columns:T5,actions:e.jsx(q5,{}),selectedActions:e.jsx(Fe,{}),cellHeight:"h-52",emptyStateMessage:e.jsx(oe,{image:Nc,title:e.jsx(n,{message:"No channels have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching channels"})})})}function V5(){return e.jsx(jt,{body:e.jsxs(m.Fragment,{children:[e.jsx(n,{message:"Channels are used to create pages that show various content on the site."}),e.jsx(bn,{className:"mt-14"})]})})}function q5(){var t,a;const{query:s}=xt();return e.jsxs(m.Fragment,{children:[e.jsxs(Ze,{onItemSelected:r=>$s(O5,{preset:r}),children:[e.jsx(b,{variant:"outline",color:"primary",size:"sm",endIcon:e.jsx(_r,{}),disabled:!((t=s.data)!=null&&t.presets.length),children:e.jsx(n,{message:"Apply preset"})}),e.jsx(Ke,{children:(a=s.data)==null?void 0:a.presets.map(r=>e.jsx(h,{value:r.preset,description:e.jsx(n,{message:r.description}),children:e.jsx(n,{message:r.name})},r.preset))})]}),e.jsx(je,{elementType:F,to:"new",children:e.jsx(n,{message:"Add new channel"})})]})}function O5({preset:s}){const{close:t}=K(),a=A5();return e.jsx(ce,{isLoading:a.isPending,onConfirm:()=>{a.mutate({preset:s},{onSuccess:()=>t()})},isDanger:!0,title:e.jsx(n,{message:"Apply preset"}),body:e.jsx(n,{message:"Are you sure you want to apply this channel preset? This will delete all current channels and leave only channels from the selected preset."}),confirm:e.jsx(n,{message:"Apply"})})}const U5=s=>`channel/${s}`;function B5(s){const{trans:t}=z(),a=Y();return I({mutationFn:r=>H5(r),onSuccess:async()=>{await _.invalidateQueries({queryKey:J("channel")}),M(t(d("Channel updated"))),a("/admin/channels")},onError:r=>ee(r,s)})}function H5({id:s,...t}){return S.put(U5(s),t).then(a=>a.data)}function Z5({children:s}){const t=kc(void 0,"editChannelPage");return t.data?e.jsx(K5,{channel:t.data.channel,children:s}):e.jsx(ys,{query:t,loaderIsScreen:!1})}function K5({channel:s,children:t}){const a=O({defaultValues:{...s}}),r=B5(a);return e.jsx(We,{form:a,onSubmit:i=>{r.mutate(i)},title:e.jsx(n,{message:"Edit “:name“ channel",values:{name:s.name}}),isLoading:r.isPending,children:t})}const W5=T(e.jsx("path",{d:"M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"}),"DescriptionOutlined");function kl({host:s,value:t="",placeholder:a,onChange:r,className:i,inputRef:l,onInputBlur:o,showLinkIcon:c=!0,pattern:u,minLength:x,maxLength:g,hideButton:j,...v}){const{base_url:f}=ue(),N=v.prefix?`/${v.prefix}`:"",y=v.suffix?`/${v.suffix}`:"",[L,k]=m.useState(!1),[E,U]=m.useState(t);s=s||f,m.useEffect(()=>{U(t)},[t]);const Q=()=>{L?(k(!1),E&&(r==null||r(E))):k(!0)};let ae="";return E?ae=E:a&&(ae=Va(a)),e.jsxs("div",{className:w("flex items-center",i),children:[c&&e.jsx(xn,{className:"icon-md text-muted"}),e.jsxs("div",{className:"text-primary ml-6 mr-14",children:[s,N,!L&&ae&&e.jsxs(m.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("span",{className:"font-medium",children:ae})]}),L?null:y]}),L&&e.jsx(Be,{pattern:u,minLength:x,maxLength:g,onKeyDown:ge=>{ge.key==="Enter"&&Q()},ref:l,"aria-label":"slug",autoFocus:!0,className:"mr-14",size:"2xs",value:E,onBlur:o,onChange:ge=>{U(ge.target.value)}}),!j&&e.jsx(b,{type:"button",color:"chip",variant:"outline",size:"2xs",onClick:()=>{Q()},children:L?e.jsx(n,{message:"Save"}):e.jsx(n,{message:"Edit"})})]})}function Ll({className:s,autoFocus:t}){return e.jsxs(m.Fragment,{children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Title"}),required:!0,autoFocus:t,className:w("mb-10",s)}),e.jsx(Q5,{})]})}function Q5(){const{watch:s,setValue:t}=P(),a=s("slug"),r=s("name"),i=s("config.lockSlug"),l=s("config.restriction"),o=s("config.restrictionModelId"),{trans:c}=z();return e.jsx(kl,{hideButton:i,placeholder:r,suffix:l&&o==="urlParam"?c(d(":restriction_name",{values:{restriction:l}})):void 0,className:"text-sm",pattern:"[A-Za-z0-9_-]+",minLength:3,maxLength:20,value:a,onChange:u=>{t("slug",u)}})}function _l({config:s,className:t}){const{setValue:a}=P();return e.jsxs(D,{className:t,selectionMode:"single",name:"config.contentType",label:e.jsx(n,{message:"Content"}),onSelectionChange:r=>{var c;let i=Object.entries(s.models)[0];if(r==="autoUpdate"){const u=Object.entries(s.models).find(([,x])=>{var g;return(g=x.autoUpdateMethods)==null?void 0:g.length});u&&(i=u)}const[l,o]=i;a("config.contentModel",l),a("config.restrictionModelId",void 0),a("config.autoUpdateMethod",r==="autoUpdate"?(c=o.autoUpdateMethods)==null?void 0:c[0]:""),a("config.contentOrder",o.sortMethods[0]),a("config.restriction",null)},children:[e.jsx(h,{value:"listAll",children:e.jsx(n,{message:"List all content of specified type"})}),e.jsx(h,{value:"manual",children:e.jsx(n,{message:"Manage content manually"})}),e.jsx(h,{value:"autoUpdate",children:e.jsx(n,{message:"Automatically update content with specified method"})})]})}function G5({children:s,config:t,className:a}){var c;const{watch:r,setValue:i}=P(),l=t.models[r("config.contentModel")],o=t.autoUpdateMethods[r("config.autoUpdateMethod")];return r("config.contentType")!=="autoUpdate"||!((c=l.autoUpdateMethods)!=null&&c.length)?null:e.jsxs("div",{className:w("items-end gap-14 md:flex",a),children:[e.jsx(D,{required:!0,className:"flex-auto",selectionMode:"single",name:"config.autoUpdateMethod",onSelectionChange:u=>{t.autoUpdateMethods[u].provider&&i("config.autoUpdateProvider",t.autoUpdateMethods[u].provider)},label:e.jsxs(m.Fragment,{children:[e.jsx(n,{message:"Auto update method"}),e.jsx(jt,{body:e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"mb-20",children:e.jsx(n,{message:"This option will automatically update channel content every 24 hours using the specified method."})}),e.jsx(bn,{hash:"automatically-update-content-with-specified-method"})]})})]}),children:l.autoUpdateMethods.map(u=>e.jsx(h,{value:u,children:e.jsx(n,{...t.autoUpdateMethods[u].label})},u))}),o!=null&&o.value?e.jsx(p,{name:"config.autoUpdateValue",required:!0,className:"flex-auto",label:e.jsx(n,{...o==null?void 0:o.value.label}),type:o==null?void 0:o.value.inputType}):null,s]})}function Ml({className:s}){const{tmdb_is_setup:t}=ue(),{watch:a}=P(),r=ze.autoUpdateMethods[a("config.autoUpdateMethod")];return e.jsx(G5,{config:ze,className:s,children:!(r!=null&&r.provider)&&t&&e.jsxs(D,{selectionMode:"single",className:"mt-24 flex-auto md:mt-0",name:"config.autoUpdateProvider",label:e.jsx(n,{message:"Fetch content from"}),required:!0,children:[e.jsx(h,{value:"tmdb",children:e.jsx(n,{message:"TheMovieDB"})}),e.jsx(h,{value:"local",children:e.jsx(n,{message:"Local database"})})]})})}const ks="keyword",J5=[st,qr,Lc],Il={[et]:d("Genre"),[ks]:d("Keyword"),[Jt]:d("Production country")};function Fl({className:s}){const{setValue:t}=P(),{watch:a}=P();return J5.includes(a("config.contentModel"))?e.jsxs("div",{className:w("items-end gap-14 md:flex",s),children:[e.jsxs(D,{className:"w-full flex-auto",name:"config.restriction",selectionMode:"single",label:e.jsxs(m.Fragment,{children:[e.jsx(n,{message:"Filter titles by"}),e.jsx(X5,{})]}),onSelectionChange:()=>{t("config.restrictionModelId","urlParam")},children:[e.jsx(h,{value:null,children:e.jsx(n,{message:"Don't filter titles"})}),Object.entries(Il).map(([r,i])=>e.jsx(h,{value:r,children:e.jsx(n,{...i})},r))]}),e.jsx(Y5,{})]}):null}function Y5(){var g,j;const{trans:s}=z(),[t,a]=m.useState(""),{watch:r}=P(),{data:i}=le(["genres","productionCountries"],{type:r("config.autoUpdateProvider")}),l=r("config.restriction"),o=r("config.restrictionModelId"),c=le(["keywords"],{searchQuery:t,selectedValue:o,type:r("config.autoUpdateProvider")});if(!l)return null;const u={[et]:i==null?void 0:i.genres,[ks]:(g=c.data)==null?void 0:g.keywords,[Jt]:i==null?void 0:i.productionCountries},x=Il[l];return e.jsxs(D,{className:"w-full flex-auto",name:"config.restrictionModelId",selectionMode:"single",showSearchField:!0,searchPlaceholder:s(d("Search...")),isAsync:l===ks,isLoading:l===ks&&c.isLoading,inputValue:t,onInputValueChange:a,label:e.jsx(n,{message:":restriction name",values:{restriction:s(x)}}),children:[e.jsx(h,{value:"urlParam",children:e.jsx(n,{message:"Dynamic (from url)"})}),(j=u[l])==null?void 0:j.map(v=>e.jsx(h,{value:v.value,children:e.jsx(n,{message:v.name})},v.value))]})}function X5(){return e.jsx(jt,{body:e.jsxs(m.Fragment,{children:[e.jsx(n,{message:"Allows specifying additional condition channel content should be filtered on. "}),e.jsx(bn,{className:"mt-20",hash:"filter-titles-by"})]})})}const ej=T(e.jsx("path",{d:"M19 5v2h-4V5h4M9 5v6H5V5h4m10 8v6h-4v-6h4M9 17v2H5v-2h4M21 3h-8v6h8V3zM11 3H3v10h8V3zm10 8h-8v10h8V11zm-10 4H3v6h8v-6z"}),"DashboardOutlined");function Pl({config:s,className:t}){return e.jsxs("div",{className:w("items-end gap-14 md:flex",t),children:[e.jsx(sr,{config:s,name:"config.layout",label:e.jsx(n,{message:"Layout"})}),e.jsx(sr,{config:s,name:"config.nestedLayout",label:e.jsx(n,{message:"Layout when nested"})})]})}function sr({config:s,name:t,label:a}){var o;const{watch:r}=P(),i=r("config.contentModel"),l=s.models[i];return(o=l.layoutMethods)!=null&&o.length?e.jsx(D,{className:"w-full flex-auto",selectionMode:"single",name:t,label:a,children:l.layoutMethods.map(c=>{const u=s.layoutMethods[c].label;return e.jsx(h,{value:c,children:e.jsx(n,{...u})},c)})}):null}function Tl({className:s}){return e.jsxs(D,{className:s,selectionMode:"single",name:"config.paginationType",label:e.jsx(n,{message:"Pagination type"}),children:[e.jsx(h,{value:"infiniteScroll",children:e.jsx(n,{message:"Infinite scroll"})}),e.jsx(h,{value:"lengthAware",children:e.jsx(n,{message:"List of page buttons"})}),e.jsx(h,{value:"simple",children:e.jsx(n,{message:"Next/previous page buttons only"})})]})}const sj=T(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-.61.08-1.21.21-1.78L8.99 15v1c0 1.1.9 2 2 2v1.93C7.06 19.43 4 16.07 4 12zm13.89 5.4c-.26-.81-1-1.4-1.9-1.4h-1v-3c0-.55-.45-1-1-1h-6v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41C17.92 5.77 20 8.65 20 12c0 2.08-.81 3.98-2.11 5.4z"}),"PublicOutlined");function El(){const{trans:s}=z();return e.jsxs(m.Fragment,{children:[e.jsx(p,{name:"config.seoTitle",label:e.jsx(n,{message:"SEO title"}),className:"mb-24",placeholder:s(d("Optional"))}),e.jsx(p,{name:"config.seoDescription",label:e.jsx(n,{message:"SEO description"}),inputElementType:"textarea",rows:6,placeholder:s(d("Optional"))})]})}function tj(){return e.jsx(Z5,{children:e.jsxs(m.Fragment,{children:[e.jsxs(Cs,{variant:"outline",children:[e.jsxs(Ce,{label:e.jsx(n,{message:"Title & description"}),startIcon:e.jsx(W5,{}),children:[e.jsx(Ll,{}),e.jsx($,{className:"mt-24",name:"config.hideTitle",description:e.jsx(n,{message:"Whether title should be shown when displaying this channel on the site."}),children:e.jsx(n,{message:"Hide title"})}),e.jsx(p,{name:"description",label:e.jsx(n,{message:"Description"}),inputElementType:"textarea",rows:1,className:"mt-24"}),e.jsx(p,{name:"config.adminDescription",label:e.jsxs(m.Fragment,{children:[e.jsx(n,{message:"Internal description"}),e.jsx(jt,{body:e.jsx(n,{message:"This describes the purpose of the channel and is only visible in admin area."})})]}),inputElementType:"textarea",rows:1,className:"mt-24"})]}),e.jsxs(Ce,{label:e.jsx(n,{message:"Content settings"}),startIcon:e.jsx(Mr,{}),children:[e.jsx(_l,{config:ze,className:"mb-24"}),e.jsx(Ml,{className:"mb-24"}),e.jsx(Or,{config:ze,className:"mb-24"}),e.jsx(Fl,{className:"mb-24"}),e.jsx(Ur,{config:ze})]}),e.jsxs(Ce,{label:e.jsx(n,{message:"Layout"}),startIcon:e.jsx(ej,{}),children:[e.jsx(Pl,{config:ze,className:"mb-24"}),e.jsx(Tl,{config:ze})]}),e.jsx(Ce,{label:e.jsx(n,{message:"SEO"}),startIcon:e.jsx(sj,{}),children:e.jsx(El,{})})]}),e.jsx(_c,{searchField:e.jsx(aj,{})})]})})}function aj(s){return e.jsx(Mc,{...s,imgRenderer:t=>e.jsx(Ic,{item:t})})}const zl="channel";function nj(s){const{trans:t}=z(),a=Y(),r=Da();return I({mutationFn:i=>rj(i),onSuccess:async i=>{await r.invalidateQueries({queryKey:J(zl)}),M(t(d("Channel created"))),a(`/admin/channels/${i.channel.id}/edit`,{replace:!0})},onError:i=>ee(i,s)})}function rj(s){return S.post(zl,s).then(t=>t.data)}function ij({defaultValues:s,children:t}){const a=O({defaultValues:{content:Fc.pagination,config:{contentType:"listAll",contentOrder:"created_at:desc",nestedLayout:"carousel",...s}}}),r=nj(a);return e.jsx(We,{form:a,onSubmit:i=>{r.mutate(i)},title:e.jsx(n,{message:"Add new channel"}),isLoading:r.isPending,children:t})}function lj(){return e.jsx(ij,{defaultValues:{contentModel:qr,autoUpdateProvider:"local",layout:"grid",nestedLayout:"carousel",paginationType:"infiniteScroll"},children:e.jsxs(ws,{children:[e.jsxs(Ss,{children:[e.jsx(fe,{children:e.jsx(n,{message:"Settings"})}),e.jsx(fe,{children:e.jsx(n,{message:"SEO"})})]}),e.jsxs(sa,{className:"pt-24",children:[e.jsxs(is,{children:[e.jsx(Ll,{}),e.jsx($,{className:"mt-24",name:"config.hideTitle",description:e.jsx(n,{message:"Whether title should be shown when displaying this channel on the site."}),children:e.jsx(n,{message:"Hide title"})}),e.jsx(p,{name:"description",label:e.jsx(n,{message:"Description"}),inputElementType:"textarea",rows:2,className:"my-24"}),e.jsx(_l,{config:ze,className:"mb-24"}),e.jsx(Ml,{className:"mb-24"}),e.jsx(Or,{config:ze,className:"mb-24"}),e.jsx(Fl,{className:"mb-24"}),e.jsx(Ur,{config:ze}),e.jsx(Pl,{config:ze,className:"my-24"}),e.jsx(Tl,{config:ze,className:"mb-24"})]}),e.jsx(is,{children:e.jsx(El,{})})]})]})})}const oj=[Se({description:d("Date article was created")}),Ie({description:d("Date article was last updated")})],cj=""+new URL("online-articles-1ec8936a.svg",import.meta.url).href;function dj(){return I({mutationFn:s=>uj(s),onError:s=>q(s),onSuccess:async()=>{await _.invalidateQueries({queryKey:J("news")}),M(d("Article deleted"))}})}function uj(s){return S.delete(`news/${s.articleId}`).then(t=>t.data)}const mj=[{key:"name",width:"flex-3 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"Title"}),body:s=>e.jsx(xj,{article:s})},{key:"updatedAt",allowsSorting:!0,width:"w-96",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx("time",{children:e.jsx(ne,{date:s.updated_at})})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),width:"w-84 flex-shrink-0",hideHeader:!0,align:"end",visibleInMode:"all",body:s=>e.jsxs("div",{className:"text-muted",children:[e.jsx(F,{to:`${s.id}/edit`,children:e.jsx(W,{label:e.jsx(n,{message:"Edit article"}),children:e.jsx(C,{size:"md",children:e.jsx(xe,{})})})}),e.jsxs(A,{type:"modal",children:[e.jsx(W,{label:e.jsx(n,{message:"Delete article"}),children:e.jsx(C,{children:e.jsx(es,{})})}),e.jsx(hj,{article:s})]})]})}];function xj({article:s}){const{isCollapsedMode:t}=m.useContext(Yt);return e.jsxs("div",{className:"flex gap-14",children:[e.jsx(Pc,{article:s,size:"w-52 h-52",lazy:!1}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:w(t?"whitespace-normal":"font-medium whitespace-nowrap overflow-hidden overflow-ellipsis"),children:e.jsx(Tc,{article:s,target:"_blank"})}),!t&&e.jsx("p",{className:"text-muted mt-4 text-xs max-w-680 whitespace-normal",children:s.body})]})]})}function hj({article:s}){const t=dj(),{close:a}=K();return e.jsx(ce,{isDanger:!0,isLoading:t.isPending,title:e.jsx(n,{message:"Delete article"}),body:e.jsx(n,{message:"Are you sure you want to delete this article?"}),confirm:e.jsx(n,{message:"Delete"}),onConfirm:()=>{t.mutate({articleId:s.id},{onSuccess:()=>a()})}})}const vn=T(e.jsx("path",{d:"M5 4h14v2H5zm0 10h4v6h6v-6h4l-7-7-7 7zm8-2v6h-2v-6H9.83L12 9.83 14.17 12H13z"}),"PublishOutlined");function gj(){return I({mutationFn:()=>pj(),onSuccess:async()=>{await _.invalidateQueries({queryKey:["news"]}),M(d("Imported news articles"))},onError:s=>q(s)})}function pj(){return S.post("news/import-from-remote-provider").then(s=>s.data)}function jj(){return e.jsx(he,{endpoint:"news",title:e.jsx(n,{message:"News articles"}),filters:oj,columns:mj,queryParams:{stripHtml:"true",truncateBody:200},actions:e.jsx(fj,{}),selectedActions:e.jsx(Fe,{}),enableSelection:!1,cellHeight:"h-80",emptyStateMessage:e.jsx(oe,{image:cj,title:e.jsx(n,{message:"No articles have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching articles"})})})}function fj(){const s=gj();return e.jsxs(m.Fragment,{children:[e.jsx(W,{label:e.jsx(n,{message:"Import news articles"}),children:e.jsx(C,{variant:"outline",color:"primary",size:"sm",onClick:()=>s.mutate(),disabled:s.isPending,children:e.jsx(vn,{})})}),e.jsx(je,{elementType:F,to:"add",children:e.jsx(n,{message:"Add news article"})})]})}function Dl({commentIds:s,variant:t="outline",size:a="xs"}){const r=Ec();return e.jsxs(A,{type:"modal",onClose:i=>{i&&r.mutate({commentIds:s},{onSuccess:()=>{_.invalidateQueries({queryKey:["comment"]})}})},children:[e.jsx(b,{variant:t,size:a,color:"danger",className:"mr-10",disabled:r.isPending,children:e.jsx(n,{message:"Delete"})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete [one comment|other :count comments]",values:{count:s.length}}),body:s.length>1?e.jsx(n,{message:"Are you sure you want to delete selected comments?"}):e.jsx(n,{message:"Are you sure you want to delete this comment?"}),confirm:e.jsx(n,{message:"Delete"})})]})}function bj(){return I({mutationFn:s=>vj(s),onSuccess:()=>{M(d("Comment updated")),_.invalidateQueries({queryKey:["comment"]})},onError:s=>q(s)})}function vj({commentId:s,content:t}){return S.put(`comment/${s}`,{content:t}).then(a=>a.data)}function yj(){return I({mutationFn:s=>Cj(s),onSuccess:(s,t)=>{M(d("Restored [one 1 comment|other :count comments]",{values:{count:t.commentIds.length}}))},onError:s=>q(s)})}function Cj({commentIds:s}){return S.post("comment/restore",{commentIds:s}).then(t=>t.data)}function wj({commentIds:s,variant:t="outline",size:a="xs"}){const r=yj();return e.jsx(b,{variant:t,size:a,className:"mr-10",disabled:r.isPending,color:"primary",onClick:()=>{r.mutate({commentIds:s},{onSuccess:()=>{_.invalidateQueries({queryKey:["comment"]})}})},children:e.jsx(n,{message:"Restore"})})}function Sj({comment:s,isSelected:t,onToggle:a}){const[r,i]=m.useState(!1);return e.jsxs("div",{className:w("p-14 border-b",s.deleted&&"bg-danger/6"),children:[s.commentable&&e.jsx(Nj,{isSelected:t,onToggle:a,commentable:s.commentable}),e.jsxs("div",{className:"flex items-start gap-10 pt-14 md:pl-20",children:[e.jsx(Qa,{className:"flex-shrink-0",user:s.user,size:"md"}),e.jsxs("div",{className:"flex-auto",children:[e.jsx(kj,{comment:s}),r?e.jsx(Lj,{comment:s,onClose:l=>{i(!1),l&&_.invalidateQueries({queryKey:["comment"]})}}):e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"text-sm my-14",children:s.content}),e.jsxs("div",{className:"flex items-center gap-24 justify-between",children:[e.jsxs("div",{children:[s.deleted?e.jsx(wj,{commentIds:[s.id]}):e.jsx(Dl,{commentIds:[s.id]}),e.jsx(b,{variant:"outline",size:"xs",onClick:()=>{i(!0)},children:e.jsx(n,{message:"Edit"})})]}),e.jsx("div",{className:"text-xs text-danger",children:e.jsx(n,{message:"Reported [one 1 time|other :count times]",values:{count:s.reports_count}})})]})]})]})]})]})}function Nj({isSelected:s,onToggle:t,commentable:a}){return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"mr-14",children:e.jsx(Aa,{checked:s,onChange:()=>t()})}),a.image&&e.jsx("img",{className:"w-20 h-20 rounded overflow-hidden object-cover mr-6",src:a.image,alt:""}),e.jsx("div",{className:"text-sm mr-4",children:a.name}),e.jsxs("div",{className:"text-muted text-xs",children:["(",a.model_type,")"]})]})}function kj({comment:s}){return e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsx("div",{children:s.user&&e.jsx(tr,{user:s.user,show:"display_name"})}),e.jsx("div",{children:"•"}),e.jsx("time",{children:e.jsx(ot,{date:s.created_at})}),s.user&&e.jsx("div",{className:"ml-auto hidden md:block",children:e.jsx(tr,{user:s.user,show:"email"})})]})}function Lj({comment:s,onClose:t}){const[a,r]=m.useState(s.content),i=bj();return e.jsxs("form",{onSubmit:l=>{l.preventDefault(),i.mutate({commentId:s.id,content:a},{onSuccess:()=>t(!0)})},children:[e.jsx(Be,{autoFocus:!0,inputElementType:"textarea",className:"my-14",rows:2,value:a,onChange:l=>r(l.target.value)}),e.jsx(b,{size:"xs",variant:"outline",color:"primary",type:"submit",className:"mr-6",disabled:i.isPending,children:e.jsx(n,{message:"Save edit"})}),e.jsx(b,{size:"xs",variant:"outline",className:"mr-6",onClick:l=>t(!1),disabled:i.isPending,children:e.jsx(n,{message:"Cancel"})})]})}function tr({user:s,show:t}){const{auth:a}=m.useContext(Xe);return a.getUserProfileLink?e.jsx(F,{to:a.getUserProfileLink(s),className:lt,target:"_blank",children:s[t]}):e.jsx("div",{className:"text-muted",children:s[t]})}const _j=""+new URL("public-discussion-7f74dab5.svg",import.meta.url).href,Mj=[{key:"deleted",label:d("Status"),description:d("Whether comment is active or deleted"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("Active"),value:!1},{key:"02",label:d("Deleted"),value:!0}]}},{key:"reports",label:d("Reported"),description:d("Show only reported comments"),defaultOperator:R.has,control:{type:H.BooleanToggle,defaultValue:"*"}},{key:"user_id",label:d("User"),description:d("User comment was created by"),defaultOperator:R.eq,control:{type:H.SelectModel,model:ht}},Se({description:d("Date comment was created")}),Ie({description:d("Date comment was last updated")})];function Al({hideTitle:s,commentable:t}){var v;const a=m.useMemo(()=>Mj.filter(f=>f.key!=="commentable_id"||!t),[t]),{encodedFilters:r}=Kt(a),[i,l]=m.useState({perPage:15}),[o,c]=m.useState([]),u=Ha("comment",{...i,with:"commentable",withCount:"reports",filters:r,commentable_type:t==null?void 0:t.model_type,commentable_id:t==null?void 0:t.id},void 0,()=>{c([])}),x=m.useCallback(f=>{const N=[...o];if(!N.includes(f))N.push(f);else{const y=N.indexOf(f);N.splice(y,1)}c(N)},[o,c]),g=!!(i.query||i.filters||r),j=(v=u.data)==null?void 0:v.pagination;return e.jsxs("div",{className:w(!s&&"p-12 md:p-24"),children:[e.jsxs("div",{className:w("mb-16"),children:[e.jsx(cs,{children:e.jsx(n,{message:"Comments"})}),!s&&e.jsx("h1",{className:"text-3xl font-light",children:e.jsx(n,{message:"Comments"})})]}),e.jsxs("div",{children:[e.jsx(Oe,{initial:!1,mode:"wait",children:o.length?e.jsx(an,{selectedItemsCount:o.length,actions:e.jsx(Dl,{size:"sm",variant:"flat",commentIds:o})},"selected"):e.jsx(tn,{filters:a,searchValue:i.query,onSearchChange:f=>l({...i,query:f})},"default")}),e.jsx(Wt,{className:"mb-14",filters:a}),u.isLoading?e.jsx(_e,{className:"min-h-200"}):e.jsx("div",{className:"rounded border-x border-t",children:j==null?void 0:j.data.map(f=>e.jsx(Sj,{comment:f,isSelected:o.includes(f.id),onToggle:()=>x(f.id)},f.id))}),(u.isFetched||u.isPlaceholderData)&&!(j!=null&&j.data.length)?e.jsx(oe,{className:"pt-50",isFiltering:g,image:_j,title:e.jsx(n,{message:"No comments have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching comments"})}):void 0,e.jsx(sn,{className:"mt-10",query:u,onPageChange:f=>l({...i,page:f}),onPerPageChange:f=>l({...i,perPage:f})})]})]})}const Ij=""+new URL("reviews-b904b01e.svg",import.meta.url).href;function $l({reviewIds:s,variant:t="outline",size:a="xs"}){const r=zc();return e.jsxs(A,{type:"modal",onClose:i=>{i&&r.mutate({reviewIds:s})},children:[e.jsx(b,{variant:t,size:a,color:"danger",className:"mr-10",disabled:r.isPending,children:e.jsx(n,{message:"Delete"})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete [one review|other :count reviews]",values:{count:s.length}}),body:s.length>1?e.jsx(n,{message:"Are you sure you want to delete selected reviews?"}):e.jsx(n,{message:"Are you sure you want to delete this review?"}),confirm:e.jsx(n,{message:"Delete"})})]})}function Fj(s,t){return I({mutationFn:a=>Pj(s,a),onSuccess:()=>{_.invalidateQueries({queryKey:["reviews"]}),M(d("Review updated"))},onError:a=>t?ee(a,t):q(a)})}function Pj(s,t){return S.put(`reviews/${s.id}`,{score:t.score,title:t.title,body:t.body}).then(a=>a.data)}function Tj({review:s,isSelected:t,onToggle:a}){const[r,i]=m.useState(!1),l=s.helpful_count||1,o=s.helpful_count+s.not_helpful_count||1;return e.jsxs("div",{className:"border-b p-14",children:[s.reviewable&&e.jsx(Ej,{isSelected:t,onToggle:a,reviewable:s.reviewable}),e.jsxs("div",{className:"flex items-start gap-10 pt-14 md:pl-20",children:[e.jsx(Qa,{className:"flex-shrink-0",user:s.user,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-auto overflow-hidden",children:[e.jsx(zj,{review:s}),r?e.jsx(Dj,{review:s,onClose:c=>{i(!1),c&&_.invalidateQueries({queryKey:["comment"]})}}):e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"my-14",children:[e.jsx(Br,{className:"mb-8",score:s.score}),s.title&&e.jsx("div",{className:"mb-8 text-base font-medium",children:s.title}),e.jsx("div",{className:"whitespace-break-spaces text-sm",children:s.body}),e.jsx("div",{className:"mt-8 text-xs text-muted",children:e.jsxs(Dc,{children:[e.jsx(n,{message:":helpfulCount out of :total people found this helpful",values:{helpfulCount:l,total:o}}),s.reports_count?e.jsx(n,{message:":count reports",values:{count:s.reports_count||0}}):null]})})]}),e.jsxs("div",{children:[e.jsx($l,{reviewIds:[s.id]}),e.jsx(b,{variant:"outline",size:"xs",onClick:()=>i(!0),children:e.jsx(n,{message:"Edit"})})]})]})]})]})]})}function Ej({isSelected:s,onToggle:t,reviewable:a}){return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"mr-14",children:e.jsx(Aa,{checked:s,onChange:()=>t()})}),a.image&&e.jsx("img",{className:"mr-6 h-20 w-20 overflow-hidden rounded object-cover",src:a.image,alt:""}),e.jsx("div",{className:"mr-4 text-sm",children:a.name}),e.jsxs("div",{className:"text-xs text-muted",children:["(",a.model_type,")"]})]})}function zj({review:s}){return e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsx("div",{children:s.user&&e.jsx(ar,{user:s.user,show:"display_name"})}),e.jsx("div",{children:"•"}),e.jsx("time",{children:e.jsx(ot,{date:s.created_at})}),s.user&&e.jsx("div",{className:"ml-auto hidden md:block",children:e.jsx(ar,{user:s.user,show:"email"})})]})}function Dj({review:s,onClose:t}){m.useState(s.body);const a=Fj(s),r=O({defaultValues:{score:s.score,title:s.title,body:s.body}});return e.jsxs(te,{className:"mt-24",form:r,onSubmit:i=>{a.mutate(i,{onSuccess:()=>t(!0)})},children:[e.jsx(Ac,{className:"-ml-8 mb-12",count:10,value:r.watch("score"),onValueChange:i=>{r.setValue("score",i)}}),e.jsx(p,{name:"title",className:"mb-24",label:e.jsx(n,{message:"Title"}),labelSuffix:e.jsx(n,{message:"10 character minimum"}),autoFocus:!0,minLength:10,required:!0}),e.jsx(p,{className:"mb-24",name:"body",label:e.jsx(n,{message:"Review"}),labelSuffix:e.jsx(n,{message:"100 character minimum"}),inputElementType:"textarea",rows:5,minLength:100,required:!0}),e.jsx(b,{size:"xs",variant:"outline",color:"primary",type:"submit",className:"mr-6",disabled:a.isPending,children:e.jsx(n,{message:"Save"})}),e.jsx(b,{size:"xs",variant:"outline",className:"mr-6",onClick:i=>t(!1),disabled:a.isPending,children:e.jsx(n,{message:"Cancel"})})]})}function ar({user:s,show:t}){const{auth:a}=m.useContext(Xe);return a.getUserProfileLink?e.jsx(F,{to:a.getUserProfileLink(s),className:lt,target:"_blank",children:s[t]}):e.jsx("div",{className:"text-muted",children:s[t]})}const Aj=[{key:"user_id",label:d("User"),description:d("User review was created by"),defaultOperator:R.eq,control:{type:H.SelectModel,model:ht}},{key:"reviewable_id",label:d("Title"),description:d("Movie or series review was created for"),defaultOperator:R.eq,extraFilters:[{key:"reviewable_type",operator:R.eq,value:"App\\Title"}],control:{type:H.SelectModel,model:st}},{key:"score",label:d("Score"),description:d("Review score"),defaultOperator:R.gte,operators:Gs,control:{type:H.Input,inputType:"number",minValue:1,maxValue:10,defaultValue:7}},{key:"helpful_count",label:d("Helpful count"),description:d("How many users found this review helpful"),defaultOperator:R.gte,operators:Gs,control:{type:H.Input,inputType:"number",minValue:1,defaultValue:10}},{key:"not_helpful_count",label:d("Not helpful count"),description:d("How many users found this review not helpful"),defaultOperator:R.gte,operators:Gs,control:{type:H.Input,inputType:"number",minValue:1,defaultValue:10}},Se({description:d("Date review was created")}),Ie({description:d("Date review was last updated")})];function Rl({hideTitle:s,reviewable:t}){var L;const a=m.useMemo(()=>Aj.filter(k=>k.key!=="reviewable_id"||!t),[t]),{encodedFilters:r}=Kt(a),[i,l]=m.useState({perPage:15}),[o,c]=m.useState([]),[u,x]=m.useState("created_at:desc"),[g,j]=u.split(":"),v=Ha("reviews",{...i,orderBy:g,orderDir:j,with:"reviewable,user",filters:r,reviewable_type:t==null?void 0:t.model_type,reviewable_id:t==null?void 0:t.id},void 0,()=>{c([])}),f=m.useCallback(k=>{const E=[...o];if(!E.includes(k))E.push(k);else{const U=E.indexOf(k);E.splice(U,1)}c(E)},[o,c]),N=!!(i.query||i.filters||r),y=(L=v.data)==null?void 0:L.pagination;return e.jsxs("div",{className:w(!s&&"p-12 md:p-24"),children:[e.jsxs("div",{className:w("mb-16"),children:[e.jsx(cs,{children:e.jsx(n,{message:"Reviews"})}),!s&&e.jsx("h1",{className:"text-3xl font-light",children:e.jsx(n,{message:"Reviews"})})]}),e.jsxs("div",{children:[e.jsx(Oe,{initial:!1,mode:"wait",children:o.length?e.jsx(an,{selectedItemsCount:o.length,actions:e.jsx($l,{size:"sm",variant:"flat",reviewIds:o})},"selected"):e.jsx(tn,{filters:a,searchValue:i.query,onSearchChange:k=>l({...i,query:k}),actions:e.jsx($c,{value:u,onValueChange:k=>x(k),color:"primary",showReportsItem:!0})},"default")}),e.jsx(Wt,{className:"mb-14",filters:a}),v.isLoading?e.jsx(_e,{className:"min-h-200"}):e.jsx("div",{className:"border-x border-t rounded",children:y==null?void 0:y.data.map(k=>e.jsx(Tj,{review:k,isSelected:o.includes(k.id),onToggle:()=>f(k.id)},k.id))}),(v.isFetched||v.isPlaceholderData)&&!(y!=null&&y.data.length)?e.jsx(oe,{className:"pt-50",isFiltering:N,image:Ij,title:e.jsx(n,{message:"No reviews have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching reviews"})}):void 0,e.jsx(sn,{className:"mt-10",query:v,onPageChange:k=>l({...i,page:k}),onPerPageChange:k=>l({...i,perPage:k})})]})]})}const $j=""+new URL("video-files-a4728f55.svg",import.meta.url).href;function Vl({value:s}){return s?e.jsx($t,{className:"icon-md text-positive"}):e.jsx($e,{className:"icon-md text-danger"})}const ql=T(e.jsx("path",{d:"M5 9.2h3V19H5V9.2zM10.6 5h2.8v14h-2.8V5zm5.6 8H19v6h-2.8v-6z"}),"BarChartOutlined"),Rj=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>e.jsx(n,{message:"Video"}),body:s=>{var t;return e.jsxs("div",{className:"flex items-center gap-12",children:[s.title?e.jsx(Rs,{title:s.title,srcSize:"sm",size:"w-32",aspect:"aspect-square"}):null,e.jsxs("div",{className:"overflow-hidden min-w-0",children:[e.jsx("div",{className:"overflow-hidden overflow-ellipsis",children:e.jsxs(F,{to:mt(s),target:"_blank",className:"hover:underline",children:[(t=s.title)==null?void 0:t.name,s.season_num|s.episode_num?e.jsxs("span",{children:[" ","(",e.jsx(Hr,{seasonNum:s.season_num,episodeNum:s.episode_num}),")"]}):null]})}),e.jsx("div",{className:"text-muted text-xs overflow-hidden overflow-ellipsis",children:s.name})]})]})}},{key:"type",allowsSorting:!0,header:()=>e.jsx(n,{message:"Type"}),body:s=>e.jsx("span",{className:"capitalize",children:s.type})},{key:"category",allowsSorting:!0,header:()=>e.jsx(n,{message:"Category"}),body:s=>e.jsx("span",{className:"capitalize",children:s.category})},{key:"approved",allowsSorting:!0,header:()=>e.jsx(n,{message:"Approved"}),body:s=>e.jsx(Vl,{value:s.approved}),width:"w-80 flex-shrink-0"},{key:"plays_count",allowsSorting:!0,header:()=>e.jsx(n,{message:"Plays"}),body:s=>s.plays_count?e.jsx(Te,{value:s.plays_count}):null,width:"w-80 flex-shrink-0"},{key:"reports_count",allowsSorting:!0,header:()=>e.jsx(n,{message:"Reports"}),body:s=>s.reports_count?e.jsx(Te,{value:s.reports_count}):null,width:"w-80 flex-shrink-0"},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(ne,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-84 flex-shrink-0",body:s=>e.jsxs(m.Fragment,{children:[e.jsx(C,{size:"md",className:"text-muted",elementType:F,to:`${s.id}/insights`,children:e.jsx(ql,{})}),e.jsx(F,{to:`${s.id}/edit`,className:"text-muted",children:e.jsx(C,{size:"md",children:e.jsx(xe,{})})})]})}];function Vj(s){const{value:t,filter:a}=s,{isLoading:r,data:i}=Rc(`normalized-models/title/${t}`),l=e.jsxs(m.Fragment,{children:[e.jsx(ls,{variant:"avatar",size:"w-18 h-18 mr-6"}),e.jsx(ls,{variant:"rect",size:"w-50"})]}),o=e.jsxs(m.Fragment,{children:[e.jsx(Wa,{size:"xs",src:i==null?void 0:i.model.image,className:"mr-6"}),i==null?void 0:i.model.name]}),c=r||!i?l:o,u=a.control.panel;return e.jsx(Vc,{...s,label:c,panel:e.jsx(u,{filter:a})})}function qj(s){return be({queryKey:["titles","autocomplete",s],queryFn:()=>Oj(s),placeholderData:Oa})}function Oj(s){return S.get("titles/autocomplete",{params:s}).then(t=>t.data)}function Ol({name:s,seasonName:t,episodeName:a,disableTitleField:r,className:i}){var L,k;const{trans:l}=z(),o=P(),c=o.watch(s),[u,x]=m.useState(""),g=t?o.watch(t):void 0,j=qj({searchQuery:u,selectedTitleId:c,seasonNumber:g}),v=j.isLoading||j.isPlaceholderData,f=(L=j.data)==null?void 0:L.titles.find(E=>E.id===c),N=(f==null?void 0:f.seasons_count)||0,y=(f==null?void 0:f.episode_numbers)||[];return e.jsxs("div",{className:i,children:[e.jsx(D,{selectionMode:"single",name:s,label:e.jsx(n,{message:"Title"}),placeholder:l(d("Select a title")),showSearchField:!0,searchPlaceholder:l(d("Search titles")),inputValue:u,onInputValueChange:x,isAsync:!0,isLoading:v,required:!0,disabled:r,children:(k=j.data)==null?void 0:k.titles.map(E=>e.jsx(h,{value:E.id,description:E.description,startIcon:e.jsx(Wa,{src:E.image}),children:E.name},E.id))}),N>0&&t&&e.jsxs(D,{className:"mt-12",name:t,placeholder:l(d("Select a season (optional)")),selectionMode:"single",label:e.jsx(n,{message:"Season"}),children:[e.jsx(h,{value:"",onSelected:()=>o.resetField(t),children:e.jsx(n,{message:"None"})},"none"),[...new Array(N).keys()].map(E=>{const U=E+1;return e.jsx(h,{value:U,children:e.jsx(n,{message:"Season :number",values:{number:U}})},U)})]}),!!y.length&&a&&e.jsxs(D,{className:"mt-12",name:a,placeholder:l(d("Select an episode (optional)")),selectionMode:"single",label:e.jsx(n,{message:"Episode"}),children:[e.jsx(h,{value:"",onSelected:()=>o.resetField(a),children:e.jsx(n,{message:"None"})},"none"),y.map(E=>e.jsx(h,{value:E,children:e.jsx(n,{message:"Episode :number",values:{number:E}})},E))]})]})}function Uj({filter:s}){return e.jsx(Ol,{name:`${s.key}.value`,seasonName:`${s.key}.season`,episodeName:`${s.key}.episode`})}const Ul=[{key:"user_id",label:d("User"),description:d("User video was created by"),defaultOperator:R.eq,control:{type:H.SelectModel,model:ht}},{key:"title_id",label:d("Title"),description:d("Movie or series video was created for"),defaultOperator:R.eq,control:{type:H.Custom,panel:Uj,listItem:Vj}},{key:"approved",label:d("Status"),description:d("Whether video is approved or not"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:!1,options:[{label:d("Approved"),key:"approved",value:!0},{label:d("Not approved"),key:"not_approved",value:!1}]}},{key:"origin",label:d("Origin"),description:d("Whether video origin is local or external"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"local",options:[{label:d("Local"),key:"local",value:"local"},{label:d("External"),key:"external",value:{operator:R.ne,value:"local"}}]}},{key:"type",label:d("Type"),description:d("Type of the video"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"embed",options:[{label:d("Embed"),key:"embed",value:"embed"},{label:d("Direct Video"),key:"video",value:"video"},{label:d("Stream"),key:"stream",value:"stream"},{label:d("Remote Link"),key:"remote",value:"remote"}]}},{key:"quality",label:d("Quality"),description:d("Quality of video"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"hd",options:[{label:d("HD"),key:"hd",value:"hd"},{label:d("SD"),key:"sd",value:"sd"},{label:d("Stream"),key:"stream",value:"stream"},{label:d("Remote Link"),key:"remote",value:"remote"}]}},{key:"category",label:d("Category"),description:d("Video category"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"trailer",options:[{label:d("Trailer"),key:"trailer",value:"trailer"},{label:d("Full Movie or episode"),key:"full",value:"full"},{label:d("Clip"),key:"clip",value:"clip"},{label:d("Teaser"),key:"teaser",value:"teaser"},{label:d("Featurette"),key:"featurette",value:"featurette"},{label:d("Behind the scenes"),key:"behind_the_scenes",value:"behind the scenes"}]}},Se({description:d("Date video was created")}),Ie({description:d("Date video was last updated")})];function Bj(){return e.jsx(he,{endpoint:"videos",queryParams:{withCount:"plays,reports",with:"episode"},title:e.jsx(n,{message:"Videos"}),columns:Rj,filters:Ul,actions:e.jsx(Hj,{}),selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:$j,title:e.jsx(n,{message:"No videos have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching videos"})})})}function Hj(){return e.jsx(je,{elementType:F,to:"new",children:e.jsx(n,{message:"Add video"})})}function Zj(s){return I({mutationFn:t=>Kj(t),onSuccess:async()=>{await _.invalidateQueries({queryKey:["video"]})},onError:t=>s?ee(t,s):q(t)})}function Kj(s){return S.post("videos",s).then(t=>t.data)}function Wj(s,t={enabled:!0}){const a=Gj(s);return be({queryKey:["file-entries",`${a}`],queryFn:()=>Qj(a),enabled:!!a&&t.enabled})}function Qj(s){return S.get(`file-entries/${s}/model`).then(t=>t.data)}function Gj(s){if(!s)return;const t=parseInt(s);return isNaN(t)?`${s}`.split("/").pop():t}function Jj({className:s,label:t,description:a,value:r,onChange:i,diskPrefix:l,disk:o=Bt.uploads,showRemoveButton:c,invalid:u,errorMessage:x,required:g,autoFocus:j,disabled:v,allowedFileTypes:f,maxFileSize:N}){const{uploadFile:y,entry:L,uploadStatus:k,deleteEntry:E,isDeletingEntry:U,percentage:Q}=Ir(),ae=m.useRef(null);Zo({autoFocus:j},ae);const{data:ge}=Wj(r,{enabled:!L&&!!r}),ye=m.useId(),Ks=t?`${ye}-label`:void 0,ts=a?`${ye}-description`:void 0,Ps=r||(L==null?void 0:L.url),as=L||(ge==null?void 0:ge.fileEntry),In={showToastOnRestrictionFail:!0,restrictions:{allowedFileTypes:f,maxFileSize:N},metadata:{diskPrefix:l,disk:o},onSuccess:qe=>i==null?void 0:i(qe.url),onError:qe=>{qe&&M.danger(qe)}},St=Ta({description:a,descriptionPosition:"top",invalid:u,disabled:v||k==="inProgress"}),go=c?e.jsx(b,{variant:"link",color:"danger",size:"xs",disabled:U||!Ps||v,onClick:()=>{E({onSuccess:()=>i==null?void 0:i("")})},children:e.jsx(n,{message:"Remove file"})}):null,po=m.useCallback(()=>{var qe;(qe=ae.current)==null||qe.click()},[]);return e.jsxs("div",{className:w("text-sm",s),children:[t&&e.jsxs("div",{className:"flex items-center justify-between gap-24",children:[e.jsx("div",{id:Ks,className:St.label,children:t}),go]}),a&&e.jsx("div",{className:St.description,children:a}),e.jsx("div",{"aria-labelledby":Ks,"aria-describedby":ts,children:e.jsxs($a,{fieldClassNames:St,errorMessage:x,invalid:u,children:[e.jsx(Yj,{inputFieldClassNames:St,currentValue:Ps,currentEntry:as,handleUpload:po,children:e.jsx("input",{ref:ae,"aria-labelledby":Ks,"aria-describedby":ts,required:Ps?!1:g,accept:f==null?void 0:f.join(","),type:"file",disabled:k==="inProgress",className:"sr-only",onChange:qe=>{var Fn;if((Fn=qe.target.files)!=null&&Fn.length){const Pn=Fr(new Ko(qe.target.files[0]),In.restrictions);Pn&&ae.current?(ae.current.value="",M.danger(Pn)):y(qe.target.files[0],In)}}})}),k==="inProgress"&&e.jsx(Dt,{className:"absolute left-0 right-0 top-0",size:"xs",value:Q})]})})]})}function Yj({children:s,inputFieldClassNames:t,currentValue:a,currentEntry:r,handleUpload:i}){const l=m.useRef(null);return a?e.jsx($a,{wrapperProps:{onClick:()=>{var o,c;(o=l.current)==null||o.focus(),(c=l.current)==null||c.click()}},fieldClassNames:t,children:e.jsxs(qc,{className:w(t.input,"gap-10"),children:[e.jsx("button",{ref:l,type:"button",className:"flex-shrink-0 rounded bg-primary px-10 py-2 text-sm font-semibold text-on-primary outline-none",onClick:()=>i(),children:e.jsx(n,{message:"Replace file"})}),e.jsx(Oe,{initial:!1,mode:"wait",children:e.jsx("div",{className:"min-w-0 overflow-hidden overflow-ellipsis whitespace-nowrap",children:r?e.jsx(De.div,{...Je,children:r.name},"file-entry-name"):e.jsx(De.div,{...Je,children:e.jsx(ls,{className:"min-w-144"})},"skeleton")})}),s]})}):m.cloneElement(s,{className:w(t.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 Bl(s){const{field:{onChange:t,value:a=null},fieldState:{error:r}}=ps({name:s.name}),i={onChange:t,value:a,invalid:r!=null,errorMessage:r?e.jsx(n,{message:"Please select a file."}):null};return e.jsx(Jj,{...js(i,s)})}function Hl({caption:s}){const{close:t,formId:a}=K(),r=O({defaultValues:{language:"en",...s}});return e.jsxs(G,{children:[e.jsx(se,{children:s?e.jsx(n,{message:"Update caption"}):e.jsx(n,{message:"Add caption"})}),e.jsx(X,{children:e.jsxs(te,{id:a,form:r,onSubmit:i=>t(i),children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-24",required:!0,autoFocus:!0}),e.jsx(Xj,{}),e.jsx(we,{children:e.jsx(Bl,{required:!s,name:"url",diskPrefix:"captions",disk:Bt.public,allowedFileTypes:[".vtt"],maxFileSize:1024*1024,label:e.jsx(n,{message:"Caption file"}),onChange:()=>{r.clearErrors()}})})]})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>t(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,variant:"flat",color:"primary",type:"submit",children:s?e.jsx(n,{message:"Update"}):e.jsx(n,{message:"Add"})})]})]})}function Xj(){var a;const{trans:s}=z(),{data:t}=le(["languages"]);return e.jsx(D,{name:"language",selectionMode:"single",showSearchField:!0,searchPlaceholder:s(d("Search languages")),label:e.jsx(n,{message:"Language"}),className:"mb-24",children:(a=t==null?void 0:t.languages)==null?void 0:a.map(r=>e.jsx(h,{value:r.code,capitalizeFirst:!0,children:e.jsx(n,{message:r.name})},r.code))})}const e1=T(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 14H4V6h16v12zM6 10h2v2H6zm0 4h8v2H6zm10 0h2v2h-2zm-6-4h8v2h-8z"}),"SubtitlesOutlined");function s1(){const{watch:s}=P(),{fields:t,append:a,remove:r,swap:i,update:l}=Re({name:"captions",keyName:"key"}),o=s("type"),c=o==="video";return e.jsxs("div",{className:"mt-24",children:[e.jsxs("div",{className:"flex items-center justify-between gap-24",children:[e.jsx("div",{className:"text-xl font-medium",children:e.jsx(n,{message:"Captions"})}),e.jsxs(A,{type:"modal",onClose:u=>{u&&a(u)},children:[e.jsx(b,{variant:"outline",startIcon:e.jsx(me,{}),size:"xs",disabled:!c,children:e.jsx(n,{message:"Add caption"})}),e.jsx(Hl,{})]})]}),e.jsxs("div",{className:"mt-24",children:[!c||!(t!=null&&t.length)?e.jsx(He,{size:"sm",image:e.jsx(e1,{}),imageHeight:"h-24",imageMargin:"mb-12",title:e.jsx(n1,{sourceType:o})}):null,c&&t.map((u,x)=>e.jsx(t1,{caption:u,captions:t,onSort:(g,j)=>i(g,j),onRemove:()=>r(x),onUpdate:g=>l(x,g)},u.key))]})]})}function t1({caption:s,captions:t,onSort:a,onRemove:r,onUpdate:i}){const l=m.useRef(null),o=m.useRef(null),c=Zr(),{sortableProps:u,dragHandleRef:x}=Qt({ref:l,disabled:c??!1,item:s,items:t,type:"captionItem",preview:o,strategy:"line",onSortEnd:(g,j)=>a(g,j)});return e.jsxs("div",{className:"mb-6 flex items-center border-b border-t border-transparent",ref:l,...u,children:[e.jsx(C,{ref:x,"aria-label":"Sort captions",children:e.jsx(Ka,{})}),e.jsx("div",{className:"ml-12 capitalize",children:s.name}),e.jsx("div",{className:"ml-auto mr-12 rounded border px-8 py-4 text-xs uppercase",children:s.language}),e.jsxs(A,{type:"modal",onClose:g=>{g&&i(g)},children:[e.jsx(W,{label:e.jsx(n,{message:"Edit"}),children:e.jsx(C,{onClick:()=>r(),className:"text-muted",children:e.jsx(Mr,{})})}),e.jsx(Hl,{caption:s})]}),e.jsx(W,{label:e.jsx(n,{message:"Remove"}),children:e.jsx(C,{onClick:()=>r(),className:"text-danger",children:e.jsx($e,{})})}),e.jsx(a1,{caption:s,ref:o})]})}const a1=B.forwardRef(({caption:s},t)=>e.jsx(Za,{ref:t,children:()=>e.jsx("div",{className:"rounded bg-background p-8 text-base shadow",children:s.name})}));function n1({sourceType:s}){switch(s){case"video":return e.jsx(n,{message:"No captions have been added to this video yet."});case"stream":return e.jsx(n,{message:"Captions (if available) are embedded within the stream itself."});default:return e.jsx(n,{message:"This source type does not support captions."})}}function Zl({form:s,video:t}){return e.jsxs("div",{className:"flex items-start gap-54",children:[e.jsxs("div",{className:"flex-auto",children:[e.jsx(i1,{video:t}),e.jsx(r1,{form:s}),e.jsx(s1,{})]}),e.jsx("div",{className:"w-440 flex-shrink-0",children:e.jsx(l1,{})})]})}function r1({form:s}){const t=s.formState.dirtyFields;return!t.src&&!t.thumbnail?null:e.jsxs("div",{className:"mt-12 flex items-center gap-6 text-sm text-muted",children:[e.jsx(aa,{size:"xs",className:"text-muted",viewBox:"0 0 16 16"}),e.jsx(n,{message:"Save your changes to reload video preview."})]})}function i1({video:s}){return!s||!s.src?e.jsx(Oc,{animate:!1}):e.jsx(Uc,{video:s,mediaItemId:`${s.id}-${s.updated_at}`})}function l1(){return e.jsxs(we,{children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-24",required:!0}),e.jsx(Ol,{name:"title_id",seasonName:"season_num",episodeName:"episode_num",className:"mb-24"}),e.jsx(Le,{name:"thumbnail",label:e.jsx(n,{message:"Thumbnail"}),diskPrefix:"video-thumbnails",className:"mb-24"}),e.jsx(o1,{}),e.jsx(c1,{}),e.jsx(u1,{}),e.jsx(m1,{}),e.jsx(x1,{})]})}function o1(){const{setValue:s}=P();return e.jsxs(D,{name:"type",selectionMode:"single",label:e.jsx(n,{message:"Source type"}),className:"mb-24",onSelectionChange:()=>s("src",""),children:[e.jsx(h,{value:"embed",description:e.jsx(n,{message:"Embed video hosted on another site. Youtube, vimeo etc."}),children:e.jsx(n,{message:"Embed"})}),e.jsx(h,{value:"video",description:e.jsx(n,{message:"Upload a video file or enter a url to direct video (.mp4, .webm, .avi, .mov etc.) hosted online."}),children:e.jsx(n,{message:"Direct"})}),e.jsx(h,{value:"stream",description:e.jsx(n,{message:"Enter a url to HLS or DASH stream."}),children:e.jsx(n,{message:"Adaptive stream"})}),e.jsx(h,{value:"external",description:e.jsx(n,{message:"Enter any url. User will be redirected to this url after clicking the video."}),children:e.jsx(n,{message:"Basic url"})})]})}function c1(){const{watch:s}=P(),t=s("type")==="embed",a=s("type")==="external",r=s("type")==="video",{trans:i}=z();return r?e.jsx(d1,{}):e.jsx(p,{required:!0,name:"src",label:e.jsx(n,{message:"Source"}),className:"mb-24",type:a?"url":void 0,placeholder:t?i(d("Full embed code snippet or just src url")):void 0,inputElementType:t?"textarea":"input",rows:4})}function d1(){const s=P(),[t,a]=m.useState(()=>{const r=s.getValues("src");return r.includes("api/v1/file-entries")||r.includes("storage/title-videos")?"file":"url"});return e.jsxs("div",{className:"mb-24",children:[e.jsxs(Wo,{size:"sm",className:"mb-8",name:"direct-type",children:[e.jsx(Dn,{value:"url",checked:t==="url",onChange:r=>a(r.target.value),children:e.jsx(n,{message:"Url"})}),e.jsx(Dn,{value:"file",checked:t==="file",onChange:r=>a(r.target.value),children:e.jsx(n,{message:"File"})})]}),t==="file"?e.jsx(Bl,{required:!0,name:"src",disk:Bt.public,diskPrefix:"title-videos",label:e.jsx(n,{message:"Source"})}):e.jsx(p,{name:"src",label:e.jsx(n,{message:"source"}),inputElementType:"textarea",rows:2,required:!0,type:"url"})]})}function u1(){const{streaming:s}=ue(),t=(s==null?void 0:s.qualities)||[];return e.jsx(D,{name:"quality",selectionMode:"single",label:e.jsx(n,{message:"Quality"}),className:"mb-24",children:t.map(a=>e.jsx(h,{value:a.toLowerCase(),capitalizeFirst:!0,children:e.jsx(n,{message:a})},a))})}function m1(){var a,r;const{trans:s}=z(),t=le(["languages"]);return e.jsx(D,{name:"language",selectionMode:"single",showSearchField:!0,searchPlaceholder:s(d("Search languages")),label:e.jsx(n,{message:"Language"}),className:"mb-24",children:(r=(a=t.data)==null?void 0:a.languages)==null?void 0:r.map(i=>e.jsx(h,{value:i.code,capitalizeFirst:!0,children:e.jsx(n,{message:i.name})},i.code))})}function x1(){return e.jsxs(D,{name:"category",selectionMode:"single",label:e.jsx(n,{message:"Content type"}),className:"mb-24",children:[e.jsx(h,{value:"trailer",children:e.jsx(n,{message:"Trailer"})}),e.jsx(h,{value:"clip",children:e.jsx(n,{message:"Clip"})}),e.jsx(h,{value:"featurette",children:e.jsx(n,{message:"Featurette"})}),e.jsx(h,{value:"teaser",children:e.jsx(n,{message:"Teaser"})}),e.jsx(h,{value:"full",children:e.jsx(n,{message:"Full Movie or Episode"})})]})}function kt({children:s}){const{titleId:t,season:a,episode:r}=V(),i=Y(),l=O({defaultValues:{quality:"regular",language:"en",category:"trailer",type:"embed",title_id:t?Number(t):void 0,season_num:a?Number(a):void 0,episode_num:r?Number(r):void 0}}),o=Zj(l);return e.jsxs(We,{onSubmit:c=>{o.mutate(c,{onSuccess:u=>{M(d("Video created")),t?i("../",{relative:"path"}):i(`../${u.video.id}/edit`,{relative:"path"})}})},backButton:t?e.jsx(C,{className:"text-muted",elementType:F,to:"../",relative:"path",children:e.jsx(qs,{})}):void 0,form:l,title:e.jsx(n,{message:"New video"}),isLoading:o.isPending,disableSaveWhenNotDirty:!0,children:[s,e.jsx(Zl,{form:l})]})}function h1(s){const{videoId:t}=V();return I({mutationFn:a=>g1(t,a),onSuccess:async()=>{await _.invalidateQueries({queryKey:["video"]})},onError:a=>ee(a,s)})}function g1(s,t){return S.put(`videos/${s}`,t).then(a=>a.data)}function Kl(){const{videoId:s}=V();return be({queryKey:["video",`${s}`],queryFn:()=>p1(s)})}function p1(s){return S.get(`videos/${s}`).then(t=>t.data)}function Lt(){var c;const{titleId:s}=V(),t=Y(),a=O(),r=Kl(),i=(c=r.data)==null?void 0:c.video,l=h1(a),o=i&&mt(i);return m.useEffect(()=>{var u;i&&!a.getValues().name&&a.reset({name:i.name,title_id:i.title_id,season_num:i.season_num,episode_num:i.episode_num,thumbnail:i.thumbnail,type:i.type,src:i.src,quality:i.quality,language:i.language,category:i.category,captions:((u=i.captions)==null?void 0:u.map(x=>({id:x.id,name:x.name,url:x.url,language:x.language})))||[]})},[i,a]),e.jsx(We,{onSubmit:u=>{l.mutate(u,{onSuccess:()=>{a.reset(u),M(d("Video updated")),s&&t("../../",{relative:"path"})}})},backButton:s?e.jsx(C,{className:"text-muted",elementType:F,to:"../../",relative:"path",children:e.jsx(qs,{})}):void 0,form:a,title:i?e.jsx(n,{values:{name:i.name},message:"Edit “:name“"}):e.jsx(n,{message:"Edit video"}),actions:o?e.jsx(C,{size:"sm",elementType:F,to:o,target:"_blank",children:e.jsx(li,{})}):null,isLoading:r.isLoading||l.isPending,disableSaveWhenNotDirty:!0,children:r.isLoading?e.jsx(_e,{}):e.jsx(Zl,{form:a,video:i})})}const j1=""+new URL("movie-night-f53006ef.svg",import.meta.url).href,f1=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>e.jsx(n,{message:"Title"}),body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(Rs,{title:s,srcSize:"sm",size:"w-32",aspect:"aspect-square"}),e.jsxs("div",{className:"overflow-hidden min-w-0",children:[e.jsx("div",{className:"overflow-hidden overflow-ellipsis",children:e.jsx(rs,{title:s,target:"_blank"})}),e.jsx("div",{className:"text-muted text-xs overflow-hidden overflow-ellipsis",children:s.is_series?e.jsx(n,{message:"Series"}):e.jsx(n,{message:"Movie"})})]})]})},{key:"release_date",allowsSorting:!0,header:()=>e.jsx(n,{message:"Release date"}),body:s=>e.jsx(ne,{date:s.release_date})},{key:"rating",allowsSorting:!0,header:()=>e.jsx(n,{message:"Rating"}),body:s=>e.jsx(Br,{score:s.rating}),width:"w-124 flex-shrink-0"},{key:"views",allowsSorting:!0,header:()=>e.jsx(n,{message:"Page views"}),body:s=>e.jsx(Te,{value:s.views}),width:"w-124 flex-shrink-0"},{key:"popularity",allowsSorting:!0,header:()=>e.jsx(n,{message:"Popularity"}),body:s=>s.popularity?e.jsx(Te,{value:s.popularity}):null,width:"w-124 flex-shrink-0"},{key:"updated_at",allowsSorting:!0,width:"w-124 flex-shrink-0",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(ne,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-84 flex-shrink-0",body:s=>e.jsxs(m.Fragment,{children:[e.jsx(C,{size:"md",className:"text-muted",elementType:F,to:`${s.id}/insights`,children:e.jsx(ql,{})}),e.jsx(F,{to:`${s.id}/edit/primary-facts`,className:"text-muted",children:e.jsx(W,{label:e.jsx(n,{message:"Edit"}),children:e.jsx(C,{size:"md",children:e.jsx(xe,{})})})})]})}],b1=[{key:"is_series",label:d("Type"),description:d("Whether title is a movie or a TV series"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"02",options:[{key:"01",label:d("Both"),value:!1},{key:"02",label:d("Movie"),value:!1},{key:"03",label:d("TV series"),value:!0}]}},{key:"views",label:d("Page views"),description:d("Number of unique page views"),defaultOperator:R.lte,operators:Gs,control:{type:H.Input,inputType:"number",minValue:1,defaultValue:100}},{key:"poster",label:d("No poster"),description:d("Whether title has a poster"),defaultOperator:R.eq,control:{type:H.BooleanToggle,defaultValue:null}},Se({description:d("Date title was created")}),Ie({description:d("Date title was last updated")})];function v1(){const{trans:s}=z();return I({mutationFn:t=>y1(t),onSuccess:async()=>{await _.invalidateQueries({queryKey:J("titles")}),M(s(d("Item imported")))},onError:t=>q(t)})}function y1(s){return S.post("media/import",s).then(t=>t.data)}function Wl({modelType:s}){const t=O({defaultValues:{media_type:s===st?"movie":"person"}}),{formId:a,close:r}=K(),i=v1();return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Import from TheMovieDB"})}),e.jsx(X,{children:e.jsxs(te,{id:a,form:t,onSubmit:l=>{i.mutate(l,{onSuccess:o=>{r(o.mediaItem)}})},children:[s===st&&e.jsxs(D,{name:"media_type",label:e.jsx(n,{message:"Type"}),className:"mb-24",selectionMode:"single",children:[e.jsx(h,{value:"movie",children:e.jsx(n,{message:"Movie"})}),e.jsx(h,{value:"series",children:e.jsx(n,{message:"Series"})})]}),e.jsx(p,{autoFocus:!0,required:!0,name:"tmdb_id",min:1,type:"number",label:e.jsx(n,{message:"TheMovieDB ID"})})]})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>r(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,variant:"flat",color:"primary",type:"submit",disabled:i.isPending,children:e.jsx(n,{message:"Import"})})]})]})}function C1(){const{trans:s}=z(),t=m.useRef([]),[a,r]=m.useState(!1),i=m.useRef(new AbortController),l=m.useCallback(()=>{i.current.abort("canceled")},[]);return{mutate:m.useCallback(async(c,u)=>{var L,k,E;let x=!1,g=!1,j=c.pages_to_import?+c.pages_to_import:1;const v=c.start_from_page?+c.start_from_page:1;j+v>500&&(j=500-v);const f=()=>{r(!1),t.current=[],i.current=new AbortController,x=!0};let N=v;r(!0),i.current.signal.addEventListener("abort",()=>f());let y=0;for(;y<=j&&!x;){y===0&&((L=u.onProgress)==null||L.call(u,{totalItems:j*20,currentItem:0,progress:0,titleList:[]})),y++,N++;try{const U=await S.post("tmdb/import",w1({...c,current_page:N}),{signal:i.current.signal}).then(ge=>ge.data);U.total_pages<j&&(j=U.total_pages),t.current.length>1e3&&(t.current=t.current.slice(0,1e3)),t.current.unshift(...U.titles.map(ge=>ge.name));const Q=j*20,ae=(y-1)*20;(k=u.onProgress)==null||k.call(u,{totalItems:Q,currentItem:ae,progress:Math.round(ae/Q*100),titleList:t.current})}catch(U){f(),g=!0,U.message!=="canceled"&&(console.error(U),q(U))}}g||(await _.invalidateQueries({queryKey:J("titles")}),M(s(d("Titles imported"))),r(!1),(E=u.onSuccess)==null||E.call(u))},[s]),cancel:l,isLoading:a}}function w1(s){const t={type:s.type,pages_to_import:s.pages_to_import,start_from_page:s.start_from_page,current_page:s.current_page};return s.country&&(t.country=s.country),s.language&&(t.language=s.language),s.min_rating&&(t.min_rating=s.min_rating),s.max_rating&&(t.max_rating=s.max_rating),s.genres&&(t.genres=s.genres.map(a=>a.id).join(",")),s.keywords&&(t.keywords=s.keywords.map(a=>a.id).join(",")),s.release_date&&(t.start_date=s.release_date.start,t.end_date=s.release_date.start),t}function S1(){const s=O({defaultValues:{type:"movie",start_from_page:1,pages_to_import:10}}),{formId:t,close:a}=K(),r=C1(),[i,l]=m.useState("form"),[o,c]=m.useState();return e.jsxs(G,{size:"lg",children:[e.jsx(se,{children:e.jsx(n,{message:"Import from TheMovieDB"})}),e.jsx(X,{children:e.jsx(te,{id:t,form:s,onSubmit:u=>{r.mutate(u,{onProgress:x=>{l("progress"),c(x)}})},children:o?e.jsx(k1,{data:o}):e.jsx(N1,{})})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>{o?(r.cancel(),c(void 0),l("form")):a()},children:r.isLoading||i==="form"?e.jsx(n,{message:"Cancel"}):e.jsx(n,{message:"Back"})}),e.jsx(b,{form:t,variant:"flat",color:"primary",type:"submit",disabled:r.isLoading||i==="progress",children:e.jsx(n,{message:"Import"})})]})]})}function N1(){return e.jsxs(m.Fragment,{children:[e.jsxs("p",{className:"mb-24 flex items-center gap-8 text-muted",children:[e.jsx(aa,{size:"xs",viewBox:"0 0 16 16"}),e.jsx(n,{message:"All filters below are optional and can be left empty."})]}),e.jsxs(D,{name:"type",label:e.jsx(n,{message:"Type"}),className:"mb-24",selectionMode:"single",children:[e.jsx(h,{value:"movie",children:e.jsx(n,{message:"Movie"})}),e.jsx(h,{value:"series",children:e.jsx(n,{message:"Series"})})]}),e.jsx(L1,{}),e.jsx(_1,{}),e.jsx(M1,{}),e.jsx(I1,{}),e.jsx(F1,{}),e.jsx(P1,{}),e.jsx(Bc,{name:"release_date",granularity:"day",label:e.jsx(n,{message:"Release date"}),description:e.jsx(n,{message:"Only import titles released between specified dates."})})]})}function k1({data:s}){return e.jsxs("div",{children:[e.jsx(Dt,{value:s.progress,label:e.jsx(n,{message:"Imported :number titles of :total",values:{number:s.currentItem,total:s.totalItems}})}),e.jsxs("div",{className:"compact-scrollbar mt-24 h-400 overflow-auto text-xs",children:[s.titleList.map((t,a)=>e.jsx("div",{children:t},a)),s.titleList.length?null:e.jsx(m.Fragment,{children:[...new Array(20).keys()].map(t=>e.jsx(ls,{className:"mb-2 max-w-200"},t))})]})]})}function L1(){return e.jsxs("div",{className:"mb-24",children:[e.jsxs("div",{className:"flex items-center gap-24",children:[e.jsx(p,{className:"flex-1",name:"start_from_page",label:e.jsx(n,{message:"Starting page"}),type:"number",min:1,max:500}),e.jsx(p,{className:"flex-1",name:"pages_to_import",label:e.jsx(n,{message:"How many pages to import"}),type:"number",min:1,max:500})]}),e.jsx("p",{className:"pt-10 text-xs text-muted",children:e.jsx(n,{message:"20 titles per page are imported. "})})]})}function _1(){const{data:s}=na(),t=s==null?void 0:s.genres.map(a=>({id:a.value,name:a.name}));return e.jsx(Vs,{className:"mb-24",name:"genres",label:e.jsx(n,{message:"Genres"}),suggestions:t,allowCustomValue:!1,description:e.jsx(n,{message:"Only import titles belonging to specified genres."}),children:a=>e.jsx(h,{value:a.id,children:e.jsx(n,{message:a.name})})})}function M1(){const{data:s}=na(),t=s==null?void 0:s.keywords.map(a=>({id:a.value,name:a.name}));return e.jsx(Vs,{name:"keywords",className:"mb-24",label:e.jsx(n,{message:"Keywords"}),suggestions:t,allowCustomValue:!1,description:e.jsx(n,{message:"Only import titles that have specied keywords attached."}),children:a=>e.jsx(h,{value:a.id,children:e.jsx(n,{message:a.name})})})}function I1(){const{data:s}=na();return e.jsx(D,{name:"language",className:"mb-24",label:e.jsx(n,{message:"Language"}),items:s==null?void 0:s.languages,selectionMode:"single",description:e.jsx(n,{message:"Only import titles with specied primary spoken language."}),children:t=>e.jsx(h,{value:t.code,children:e.jsx(n,{message:t.name})})})}function F1(){const{data:s}=na();return e.jsx(D,{name:"country",className:"mb-24",label:e.jsx(n,{message:"Country"}),items:s==null?void 0:s.countries,selectionMode:"single",description:e.jsx(n,{message:"Only import titles with specied origin country."}),children:t=>e.jsx(h,{value:t.code,children:e.jsx(n,{message:t.name})})})}function P1(){return e.jsxs("div",{className:"mb-24 flex items-center gap-24",children:[e.jsx(p,{className:"flex-1",name:"min_rating",label:e.jsx(n,{message:"Minimum rating"}),type:"number",min:1,max:10}),e.jsx(p,{className:"flex-1",name:"max_rating",label:e.jsx(n,{message:"Maximum rating"}),type:"number",min:1,max:10})]})}function na(){return le(["genres","keywords","languages","countries"],{type:"tmdb"})}function T1(){const{filters:s,filtersLoading:t}=Hc(),a=m.useMemo(()=>[...s,...b1],[s]);return e.jsx(he,{endpoint:"titles",title:e.jsx(n,{message:"Titles"}),columns:f1,filters:a,filtersLoading:t,actions:e.jsx(E1,{}),selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:j1,title:e.jsx(n,{message:"No titles have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching titles"})})})}function E1(){const{tmdb_is_setup:s}=ue();return e.jsxs(m.Fragment,{children:[s&&e.jsx(z1,{}),e.jsx(je,{elementType:F,to:"new",children:e.jsx(n,{message:"Add title"})})]})}function z1(){const s=Y();return e.jsxs(Ze,{children:[e.jsx(W,{label:e.jsx(n,{message:"Import from TheMovieDB"}),children:e.jsx(C,{variant:"outline",color:"primary",className:"flex-shrink-0",size:"sm",children:e.jsx(vn,{})})}),e.jsxs(Ke,{children:[e.jsx(h,{value:"single",onSelected:async()=>{const t=await $s(Wl,{modelType:st});t&&s(`/admin/titles/${t.id}/edit/primary-facts`)},children:e.jsx(n,{message:"Import single title by ID"})}),e.jsx(h,{value:"multiple",onSelected:()=>{$s(S1)},children:e.jsx(n,{message:"Import multiple titles"})})]})]})}function D1(){const s=Kr("editTitlePage");return s.data?e.jsx(Ms,{context:s.data.title}):e.jsx(_e,{})}function A1(s){return I({mutationFn:()=>$1(s.id),onSuccess:async()=>{await _.invalidateQueries({queryKey:Ga(s.title_id,s.season_number)}),M(d("Episode deleted"))},onError:t=>q(t)})}function $1(s){return S.delete(`episodes/${s}`).then(t=>t.data)}const R1=[{to:"primary-facts",label:d("Primary Facts")},{to:"seasons",label:d("Seasons"),hideIfMovie:!0},{to:"images",label:d("Images")},{to:"videos",label:d("Videos")},{to:"cast",label:d("Cast")},{to:"crew",label:d("Crew")},{to:"genres",label:d("Genres")},{to:"keywords",label:d("Keywords")},{to:"countries",label:d("Countries")},{to:"reviews",label:d("Reviews")},{to:"comments",label:d("Comments")}];function Ql(){const s=Me(),t=!(s!=null&&s.is_series);return R1.filter(a=>!t||!a.hideIfMovie)}function Ve({children:s,actions:t}){const a=Ae(),{isSticky:r,sentinelRef:i}=Wr(),l=Me(),{season:o,episode:c}=V(),u=l?Zc(l,{season:o,episode:c}):null,x=m.useRef(null),g=l?e.jsx(n,{values:{name:l.name},message:"Edit “:name“"}):e.jsx(n,{message:"New title"});return Kc(x),e.jsxs(m.Fragment,{children:[e.jsx(cs,{children:e.jsx(n,{message:"Edit title"})}),e.jsx("div",{ref:i}),e.jsx("div",{ref:x,className:w("sticky top-0 my-12 md:my-24 z-10 transition-shadow",r&&"bg-paper shadow"),children:e.jsxs("div",{className:w("flex items-center md:items-start gap-24 py-14 container mx-auto px-24"),children:[e.jsx("h1",{className:"text-xl md:text-3xl whitespace-nowrap overflow-hidden overflow-ellipsis md:mr-64",children:g}),e.jsx("div",{className:"mr-auto"}),u?e.jsx(C,{size:"sm",elementType:F,to:u,target:"_blank",children:e.jsx(li,{})}):null,t]})}),e.jsxs("div",{className:"container md:flex gap-30 items-stretch mx-auto px-24 pb-24",children:[a?e.jsx(V1,{}):e.jsx(q1,{}),e.jsx("div",{className:"md:pl-30 flex-auto relative",children:s})]})]})}function V1(){const{titleId:s}=V(),{pathname:t}=bs(),a=vs(),r=s?t.split("/").pop():"primary-facts",i=Ql();return e.jsx(Ye,{disabled:!s,minWidth:"min-w-none",className:"w-full bg-paper mb-24",selectionMode:"single",selectedValue:r,onSelectionChange:l=>{s&&a(Gl(s,l))},children:i.map(l=>e.jsx(h,{value:l.to,children:e.jsx(n,{...l.label})},l.to))})}function q1(){const{titleId:s}=V(),t=Ql();return e.jsxs("div",{className:"w-240 sticky top-24 flex-shrink-0",children:[t.map(a=>{const r=s?Gl(s,a.to):"";return e.jsx(qt,{to:r,"aria-disabled":!s,className:({isActive:i})=>w("block p-14 whitespace-nowrap mb-8 rounded border-l-4 text-sm transition-bg-color",!r&&"pointer-events-none text-muted",i&&r||a.to==="primary-facts"&&!r?"bg-primary/selected border-l-primary font-medium":"border-l-transparent hover:bg-hover"),children:e.jsx(n,{...a.label})},a.to)}),s?null:e.jsxs("div",{className:"flex items-center gap-8 text-muted text-xs mt-24",children:[e.jsx(aa,{viewBox:"0 0 16 16",size:"xs"}),e.jsx(n,{message:"Create title to enable menu items."})]})]})}const Gl=(s,t)=>`/admin/titles/${s}/edit/${t}`,ha=[{uri:"episodes",label:d("Episodes")},{uri:"cast",label:d("Regular cast")},{uri:"crew",label:d("Regular crew")}];function yn({children:s}){const{season:t}=V(),{pathname:a}=bs(),r=a.split("/").pop(),i=t?ha.findIndex(l=>l.uri===r):0;return e.jsxs(Ve,{children:[e.jsxs("div",{className:"flex items-center gap-12 mb-4",children:[e.jsx(C,{elementType:F,to:"../../",relative:"path",className:"text-muted",children:e.jsx(qs,{})}),e.jsx("h2",{className:"text-base",children:e.jsx(n,{message:"Season :number",values:{number:t}})})]}),e.jsxs(ws,{selectedTab:i,children:[e.jsx(Ss,{children:ha.map(l=>e.jsx(fe,{isDisabled:!t&&l.uri!==ha[0].uri,width:"min-w-132",elementType:F,to:`../${l.uri}`,relative:"path",replace:!0,children:e.jsx(n,{...l.label})},l.uri))}),e.jsx("div",{className:"pt-24 min-h-512",children:s})]})]})}function ft({query:s}){return s.isLoading?e.jsx("div",{className:"h-full min-h-120 flex items-center justify-center",children:e.jsx(ds,{isIndeterminate:!0,"aria-label":"Loading page..."})}):e.jsx(Qo,{})}function O1(){return e.jsxs(yn,{children:[e.jsx("div",{className:"mb-16",children:e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(me,{}),size:"xs",elementType:F,to:"new",children:e.jsx(n,{message:"Add episode"})})}),e.jsx(U1,{})]})}function U1(){var t;const s=Qr("editSeasonPage");return s.data?(t=s.data.episodes)!=null&&t.data.length?e.jsx(H1,{data:s.data}):e.jsx(B1,{}):e.jsx(ft,{query:s})}function B1(){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(Gr,{size:"xl"})}),imageHeight:"h-auto",title:e.jsx(n,{message:"No episodes have been added yet"})})}function H1({data:s}){const t=Wc(s.episodes);return e.jsxs(m.Fragment,{children:[t.items.map(a=>e.jsx(Qc,{episode:a,title:s.title,className:"mb-24",children:e.jsxs("div",{className:"mt-12 flex items-center gap-12",children:[e.jsx(b,{variant:"outline",size:"xs",startIcon:e.jsx(xe,{}),elementType:F,to:`${a.episode_number}/primary-facts`,children:e.jsx(n,{message:"Edit"})}),e.jsxs(A,{type:"modal",children:[e.jsx(C,{size:"xs",variant:"outline",children:e.jsx(es,{})}),e.jsx(Z1,{episode:a})]})]})},a.id)),e.jsx(Xt,{query:t})]})}function Z1({episode:s}){const t=A1(s),{close:a}=K();return e.jsx(ce,{isLoading:t.isPending,isDanger:!0,title:e.jsx(n,{message:"Delete episode"}),body:e.jsx(n,{message:"Are you sure you want to delete this episode?"}),confirm:e.jsx(n,{message:"Delete"}),onConfirm:()=>{t.mutate(void 0,{onSuccess:()=>a()})}})}function K1(s,t){return I({mutationFn:()=>W1(t),onSuccess:async()=>{await _.invalidateQueries({queryKey:Jr(s.id)}),M(d("Season deleted"))},onError:a=>q(a)})}function W1(s){return S.delete(`seasons/${s}`).then(t=>t.data)}function Q1(s){return I({mutationFn:()=>G1(s),onSuccess:async t=>{await _.invalidateQueries({queryKey:Jr(t.season.title_id)}),M(d("Season :number created",{values:{number:t.season.number}}))},onError:t=>q(t)})}function G1(s){return S.post(`titles/${s}/seasons`).then(t=>t.data)}function J1(){const s=Me(),t=Q1(s.id),a=Gc(s.id,void 0,{perPage:15});let r;return a.data?r=a.items.length?e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"mt-24 grid grid-cols-2 gap-24 md:grid-cols-5",children:a.items.map(i=>e.jsxs("div",{children:[e.jsx(Ja,{title:s,season:i,srcSize:"md",className:"aspect-poster flex-shrink-0"}),e.jsxs("div",{className:"mt-8",children:[e.jsxs("div",{className:"flex items-center justify-between gap-14",children:[e.jsx(Ya,{title:s,seasonNumber:i.number}),e.jsx("div",{className:"text-xs text-muted",children:e.jsx(ne,{date:i.release_date,options:{year:"numeric"}})})]}),e.jsx("div",{className:"mt-2 text-sm",children:e.jsx(n,{message:":count episodes",values:{count:i.episodes_count}})}),e.jsxs("div",{className:"mt-14 flex items-center justify-between gap-14",children:[e.jsx(b,{variant:"outline",size:"xs",startIcon:e.jsx(xe,{}),elementType:F,to:`${i.number}/episodes`,children:e.jsx(n,{message:"Edit"})}),e.jsx(X1,{title:s,season:i})]})]})]},i.id))}),e.jsx(Xt,{query:a})]}):e.jsx(Y1,{}):r=e.jsx(ft,{query:a}),e.jsxs(Ve,{children:[e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(me,{}),disabled:t.isPending,onClick:()=>t.mutate(),children:e.jsx(n,{message:"Add season"})}),r]})}function Y1(){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(Gr,{size:"xl"})}),imageHeight:"h-auto",title:e.jsx(n,{message:"No seasons have been added yet"})})}function X1({title:s,season:t}){const a=K1(s,t.id);return e.jsxs(A,{type:"modal",onClose:r=>{r&&a.mutate()},children:[e.jsx(C,{size:"xs",variant:"outline",children:e.jsx(es,{})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete season"}),body:e.jsx(n,{message:"Are you sure you want to delete this season?"}),confirm:e.jsx(n,{message:"Delete"})})]})}function e4(s){return I({mutationFn:t=>s4(t),onSuccess:async()=>{await _.invalidateQueries({queryKey:["titles"]})},onError:t=>s?ee(t,s):q(t)})}function s4(s){return S.post("titles",s).then(t=>t.data)}function t4(s){const{titleId:t}=V();return I({mutationFn:a=>a4(t,a),onSuccess:async()=>{await _.invalidateQueries({queryKey:["titles"]})},onError:a=>ee(a,s)})}function a4(s,t){return S.put(`titles/${s}`,t).then(a=>a.data)}function Jl({children:s,...t}){const{field:{onChange:a,onBlur:r,value:i="",ref:l},fieldState:{invalid:o,error:c}}=ps({name:t.name}),u={onSelectionChange:a,onBlur:r,selectedValue:i,defaultInputValue:i,invalid:o,errorMessage:c==null?void 0:c.message};return e.jsx(Go,{ref:l,...js(u,t),children:s})}function ga(){const s=Me();return e.jsx(we,{children:s?e.jsx(r4,{title:s}):e.jsx(n4,{})})}function n4(){const s=ut(),t=Y(),a=O({defaultValues:{release_date:s.toAbsoluteString(),certification:"pg",language:"en"}}),r=e4(a),i=Object.keys(a.formState.dirtyFields).length>0;return e.jsx(te,{form:a,onSubmit:l=>{r.mutate(l,{onSuccess:o=>{M(d("Title created")),t(`../${o.title.id}/edit`,{relative:"path",replace:!0})}})},children:e.jsx(Ve,{actions:e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:r.isPending||!i,children:e.jsx(n,{message:"Create"})}),children:e.jsx(Yl,{})})})}function r4({title:s}){const t=Y(),a=O({defaultValues:{name:s.name,is_series:s.is_series,original_title:s.original_title,poster:s.poster,backdrop:s.backdrop,release_date:s.release_date,tagline:s.tagline,description:s.description,runtime:s.runtime,certification:s.certification,budget:s.budget,revenue:s.revenue,language:s.language,popularity:s.popularity}}),r=t4(a);return e.jsx(te,{form:a,onSubmit:i=>{r.mutate(i,{onSuccess:()=>{M(d("Title updated")),t("../../../",{relative:"path",replace:!0})}})},children:e.jsx(Ve,{actions:e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:r.isPending||!a.formState.isDirty,children:e.jsx(n,{message:"Save"})}),children:e.jsx(Yl,{})})})}function Yl(){return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"gap-24 md:flex",children:[e.jsx(Le,{variant:"square",previewSize:"w-204 aspect-poster",name:"poster",diskPrefix:"title-posters",label:e.jsx(n,{message:"Poster"}),showRemoveButton:!0}),e.jsxs("div",{className:"flex-auto max-md:mt-24",children:[e.jsx(Le,{name:"backdrop",variant:"square",diskPrefix:"title-backdrops",label:e.jsx(n,{message:"Backdrop"}),stretchPreview:!0,previewSize:"min-h-124",className:"mb-24"}),e.jsx(p,{name:"name",label:e.jsx(n,{message:"Title"}),className:"mb-24",required:!0}),e.jsx(p,{name:"original_title",label:e.jsx(n,{message:"Original title"}),className:"mb-24"}),e.jsx($,{name:"is_series",className:"mb-24",children:e.jsx(n,{message:"Series"})})]})]}),e.jsx(_s,{name:"release_date",label:e.jsx(n,{message:"Release date"}),className:"mb-24",granularity:"day"}),e.jsx(p,{name:"tagline",label:e.jsx(n,{message:"Tagline"}),className:"mb-24"}),e.jsx(p,{name:"description",label:e.jsx(n,{message:"Overview"}),inputElementType:"textarea",rows:4,className:"mb-24"}),e.jsxs("div",{className:"mb-24 items-center gap-24 md:flex",children:[e.jsx(p,{name:"runtime",label:e.jsx(n,{message:"Runtime"}),type:"number",min:1,className:"flex-1 max-md:mb-24"}),e.jsx(i4,{})]}),e.jsxs("div",{className:"mb-24 items-center gap-24 md:flex",children:[e.jsx(p,{name:"budget",label:e.jsx(n,{message:"Budget (US dollars)"}),type:"number",min:1,className:"flex-1 max-md:mb-24"}),e.jsx(p,{name:"revenue",label:e.jsx(n,{message:"Revenue (US dollars)"}),type:"number",min:1,className:"flex-1 max-md:mb-24"})]}),e.jsxs("div",{className:"mb-24 items-center gap-24 md:flex",children:[e.jsx(p,{name:"popularity",label:e.jsx(n,{message:"Popularity"}),type:"number",min:1,className:"flex-1 max-md:mb-24"}),e.jsx(l4,{})]})]})}function i4(){const{data:s}=le(["titleFilterAgeRatings"]);return e.jsx(Jl,{name:"certification",selectionMode:"single",label:e.jsx(n,{message:"Certification"}),className:"flex-1",allowCustomValue:!0,children:s==null?void 0:s.titleFilterAgeRatings.map(({name:t,value:a})=>e.jsx(h,{value:a,children:e.jsx(n,{message:t})},a))})}function l4(){const{data:s}=le(["tmdbLanguages"]);return e.jsx(D,{name:"language",selectionMode:"single",label:e.jsx(n,{message:"Language"}),showSearchField:!0,searchPlaceholder:"Search languages",className:"flex-1",children:s==null?void 0:s.tmdbLanguages.map(t=>e.jsx(h,{value:t.code,children:e.jsx(n,{message:t.name})},t.code))})}function o4(){const s=Me();return e.jsx(Ve,{children:e.jsx(Rl,{hideTitle:!0,reviewable:s})})}const c4=T(e.jsx("path",{d:"m15 3 2.3 2.3-2.89 2.87 1.42 1.42L18.7 6.7 21 9V3h-6zM3 9l2.3-2.3 2.87 2.89 1.42-1.42L6.7 5.3 9 3H3v6zm6 12-2.3-2.3 2.89-2.87-1.42-1.42L5.3 17.3 3 15v6h6zm12-6-2.3 2.3-2.87-2.89-1.42 1.42 2.89 2.87L15 21h6v-6z"}),"ZoomOutMapOutlined");function d4(s){const{titleId:t}=V();return I({mutationFn:()=>u4(s),onSuccess:async()=>{await _.invalidateQueries({queryKey:["titles",`${t}`]}),M(d("Image deleted"))},onError:a=>q(a)})}function u4(s){return S.delete(`images/${s}`).then(t=>t.data)}function m4(){const{titleId:s}=V();return I({mutationFn:t=>x4(t),onSuccess:async()=>{await _.invalidateQueries({queryKey:["titles",`${s}`]}),M(d("Image uploaded"))},onError:t=>q(t)})}function x4(s){const t=new FormData;return t.append("titleId",s.titleId.toString()),t.append("file",s.file),S.post("images",t).then(a=>a.data)}function h4(){const s=Me();return e.jsxs(Ve,{children:[e.jsx(we,{children:e.jsx(j4,{})}),e.jsx("div",{className:"mt-24 grid grid-cols-2 gap-24 md:grid-cols-3",children:s.images.map((t,a)=>e.jsxs("div",{children:[e.jsx(Jc,{src:t.url,srcSize:"md",className:"rounded"}),e.jsxs("div",{className:"mt-6 flex items-center justify-between gap-14",children:[e.jsx(f4,{imageId:t.id}),e.jsxs(A,{type:"modal",children:[e.jsx(C,{variant:"outline",size:"xs",children:e.jsx(c4,{})}),e.jsx($r,{images:s.images.map(r=>r.url),defaultActiveIndex:a})]})]})]},t.id))}),!s.images.length&&e.jsx(g4,{})]})}function g4(){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(Yr,{size:"xl"})}),imageHeight:"h-auto",title:e.jsx(n,{message:"No images have been added yet"})})}const p4=5e6;function j4(){const{titleId:s}=V(),t=m4(),a=async()=>{const r=await Ra({types:[Ut.image]}),i=Fr(r[0],{maxFileSize:p4});if(i){M.danger(i);return}t.mutate({file:r[0].native,titleId:s})};return e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(me,{}),disabled:t.isPending,onClick:()=>a(),children:e.jsx(n,{message:"Upload image"})})}function f4({imageId:s}){const t=d4(s);return e.jsx(b,{variant:"outline",size:"xs",disabled:t.isPending,onClick:()=>t.mutate(),children:e.jsx(n,{message:"Delete"})})}const pa=[{value:"created_at:desc",label:d("Newest")},{value:"created_at:asc",label:d("Oldest")},{value:"upvotes:desc",label:d("Most upvotes")},{value:"reports_count:desc",label:d("Most reported")},{value:"season_num:desc",label:d("Seasons")},{value:"order:asc",label:d("Curated")}];function b4({value:s,onValueChange:t,color:a}){let r=pa.find(i=>i.value===s);return r||(r=pa[0]),e.jsxs(Ze,{selectedValue:s,onSelectionChange:i=>t(i),selectionMode:"single",children:[e.jsx(b,{variant:"outline",startIcon:e.jsx(Yc,{}),color:a,children:e.jsx(n,{...r.label})}),e.jsx(Ke,{children:pa.map(i=>e.jsx(h,{value:i.value,children:e.jsx(n,{...i.label})},i.value))})]})}function v4(){return I({mutationFn:s=>y4(s),onSuccess:async()=>{await _.invalidateQueries({queryKey:["video"]})},onError:s=>q(s)})}function y4({videoIds:s}){return S.delete(`videos/${s.join(",")}`).then(t=>t.data)}function C4(){const{titleId:s,season:t}=V();return be({queryKey:["titles",`${s}`,"seasons",`${t}`,"episodeNumbers"],queryFn:()=>w4(s,t)})}function w4(s,t){return S.get(`titles/${s}/seasons/${t}/episode-numbers`).then(a=>a.data)}function S4({title:s}){const t=Y(),{trans:a}=z(),r=V(),i=r.season?Number(r.season):"",l=r.episode?Number(r.episode):"",o=(c,u)=>{let x=`/admin/titles/${s.id}/edit/videos`;c&&(x+=`/seasons/${c}`),u&&(x+=`/episodes/${u}`),t(x)};return s.seasons_count?e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsxs(Ye,{className:"flex-1",selectedValue:i,onSelectionChange:c=>{o(c)},placeholder:a(d("Season")),selectionMode:"single",size:"sm",children:[e.jsx(h,{value:"",children:e.jsx(n,{message:"All seasons"})},"none"),[...new Array(s.seasons_count).keys()].map(c=>{const u=c+1;return e.jsx(h,{value:u,children:e.jsx(n,{message:"Season :number",values:{number:u}})},u)})]}),i&&e.jsx(N4,{value:l,onChange:c=>{o(i,c)}})]}):null}function N4({value:s,onChange:t}){const{trans:a}=z(),{data:r}=C4();return e.jsxs(Ye,{placeholder:a(d("Episode")),selectionMode:"single",className:"flex-1",size:"sm",selectedValue:s,onSelectionChange:t,children:[e.jsx(h,{value:"",children:e.jsx(n,{message:"All episodes"})},"none"),r==null?void 0:r.episodeNumbers.map(i=>e.jsx(h,{value:i,children:e.jsx(n,{message:"Episode :number",values:{number:i}})},i))]})}function ja(){const s=m.useMemo(()=>Ul.filter(c=>c.key!=="title_id"),[]),{encodedFilters:t}=Kt(s),{season:a,episode:r}=V(),i=Me(),l=Xr({queryKey:["video","edit-title-page"],endpoint:"videos",defaultOrderBy:"created_at",defaultOrderDir:"desc",queryParams:{perPage:20,filters:t,title_id:i.id,season:a??null,episode:r??null}});let o;return l.data?o=l.items.length?e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 gap-24 md:grid-cols-2 lg:grid-cols-3",children:l.items.map(c=>e.jsx(L4,{video:c},c.id))}),e.jsx(Xt,{query:l})]}):e.jsx(k4,{isFiltering:t!=null}):o=e.jsx(ft,{query:l}),e.jsxs(Ve,{children:[e.jsxs("div",{className:"mb-24 flex flex-wrap items-center gap-12",children:[e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(me,{}),elementType:F,to:"new",className:"mr-auto",children:e.jsx(n,{message:"Add video"})}),e.jsx(S4,{title:i}),e.jsx(b4,{value:`${l.sortDescriptor.orderBy}:${l.sortDescriptor.orderDir}`,onValueChange:c=>{const[u,x]=c.split(":");l.setSortDescriptor({orderBy:u,orderDir:x})}}),e.jsx(Tr,{icon:e.jsx(zr,{}),color:null,variant:"outline",filters:s})]}),e.jsx(Wt,{className:"mb-24",filters:s}),o]})}function k4({isFiltering:s}){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(ei,{size:"xl"})}),imageHeight:"h-auto",title:s?e.jsx(n,{message:"No matching videos"}):e.jsx(n,{message:"No videos have been added yet"})})}function L4({video:s}){const t=mt(s);return e.jsxs("div",{className:"",children:[e.jsxs(F,{to:t,className:"relative isolate block",target:"_blank",children:[e.jsx(si,{video:s,title:s.title,srcSize:"lg"}),e.jsx(Xc,{}),e.jsxs("span",{className:"absolute bottom-0 left-0 z-30 flex items-center gap-x-6 p-10 text-white",children:[e.jsx(ed,{}),e.jsx("span",{className:"capitalize",children:s.category})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 mt-12 flex items-center gap-24",children:[e.jsx(F,{to:t,className:"block font-semibold hover:underline",children:s.name}),s.reports_count?e.jsx("div",{className:"ml-auto flex-shrink-0 whitespace-nowrap text-sm text-muted",children:e.jsx(n,{message:":count reports",values:{count:s.reports_count}})}):null]}),e.jsxs("div",{className:"flex items-center justify-between gap-14 text-sm text-muted",children:[(s.season_num!=null||s.episode_num!=null)&&e.jsx(Hr,{seasonNum:s.season_num,episodeNum:s.episode_num}),e.jsx(ne,{date:s.created_at})]}),e.jsxs("div",{className:"mt-14 flex items-center gap-24",children:[e.jsx(b,{variant:"outline",size:"xs",startIcon:e.jsx(xe,{}),elementType:F,to:`edit/${s.id}`,children:e.jsx(n,{message:"Edit"})}),e.jsx(_4,{video:s})]})]})]})}function _4({video:s}){const t=v4();return e.jsxs(A,{type:"modal",onClose:a=>{a&&t.mutate({videoIds:[s.id]})},children:[e.jsx(b,{className:"ml-auto",variant:"outline",size:"xs",startIcon:e.jsx(es,{}),disabled:t.isPending,children:e.jsx(n,{message:"Delete"})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete video"}),body:e.jsx(n,{message:"Are you sure you want to delete this video?"}),confirm:e.jsx(n,{message:"Delete"})})]})}function M4(s,t,a,r){return I({mutationFn:i=>I4(s,t,a,i),onSuccess:async({episode:i})=>{await _.invalidateQueries({queryKey:Ga(i.title_id,i.season_number)})},onError:i=>ee(i,r)})}function I4(s,t,a,r){return S.put(`titles/${s}/seasons/${t}/episodes/${a}`,r).then(i=>i.data)}const nr=[{uri:"primary-facts",label:d("Primary facts")},{uri:"cast",label:d("Cast")},{uri:"crew",label:d("Crew")}];function bt({children:s,actions:t}){const{episode:a,season:r}=V(),i=Y(),{pathname:l}=bs(),o=l.split("/").pop(),c=a?nr.findIndex(u=>u.uri===o):0;return e.jsxs(Ve,{actions:t,children:[e.jsxs(ii,{className:"mb-24",children:[e.jsx(It,{onSelected:()=>i("../..",{relative:"path"}),children:e.jsx(n,{message:"Season :number",values:{number:r}})}),e.jsx(It,{children:a?e.jsx(n,{message:"Episode :number",values:{number:a}}):e.jsx(n,{message:"New episode"})})]}),e.jsx(we,{children:e.jsxs(ws,{selectedTab:c,children:[e.jsx(Ss,{children:nr.map(u=>e.jsx(fe,{isDisabled:!a&&u.uri!=="primary-facts",width:"min-w-132",elementType:F,to:`../${u.uri}`,relative:"path",replace:!0,children:e.jsx(n,{...u.label})},u.uri))}),e.jsx("div",{className:"pt-24",children:s})]})})]})}function F4(s,t,a){return I({mutationFn:r=>P4(t,a,r),onSuccess:async()=>{await _.invalidateQueries({queryKey:Ga(t,a)})},onError:r=>s?ee(r,s):q(r)})}function P4(s,t,a){return S.post(`titles/${s}/seasons/${t}/episodes`,a).then(r=>r.data)}function rr(){const{episode:s}=V();return s?e.jsx(E4,{}):e.jsx(T4,{})}function T4(){const s=Me(),{season:t}=V(),a=Y(),r=ut(),i=O({defaultValues:{release_date:r.toAbsoluteString()}}),l=F4(i,s.id,t),o=Object.keys(i.formState.dirtyFields).length>0;return e.jsx(te,{form:i,onSubmit:c=>{l.mutate(c,{onSuccess:u=>{M(d("Episode created")),a(`../${u.episode.episode_number}`,{relative:"path"})}})},children:e.jsx(bt,{actions:e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:l.isPending||!o,children:e.jsx(n,{message:"Save"})}),children:e.jsx(Xl,{})})})}function E4(){const s=ti("episode");return s.data?e.jsx(z4,{episode:s.data.episode}):e.jsx(bt,{actions:e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:!0,children:e.jsx(n,{message:"Save"})}),children:e.jsx(ft,{query:s})})}function z4({episode:s}){const t=Me(),a=Y(),r=O({defaultValues:{name:s.name,description:s.description,release_date:s.release_date,runtime:s.runtime,popularity:s.popularity,poster:s.poster}}),i=M4(t.id,s.season_number,s.episode_number,r);return e.jsx(te,{form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>{M(d("Episode updated")),a("../../../",{relative:"path"})}})},children:e.jsx(bt,{actions:e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:i.isPending||!r.formState.isDirty,children:e.jsx(n,{message:"Save"})}),children:e.jsx(Xl,{})})})}function Xl(){return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"gap-24 md:flex",children:[e.jsx(Le,{variant:"square",previewSize:"w-204 aspect-poster",name:"poster",diskPrefix:"episode-posters",label:e.jsx(n,{message:"Poster"}),stretchPreview:!0}),e.jsxs("div",{className:"mb-24 flex-auto max-md:mt-24",children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Title"}),className:"mb-24",required:!0}),e.jsx(_s,{name:"release_date",label:e.jsx(n,{message:"Release date"}),className:"mb-24",granularity:"day"}),e.jsx(p,{name:"runtime",label:e.jsx(n,{message:"Runtime"}),type:"number",min:1,className:"mb-24"}),e.jsx(p,{name:"popularity",label:e.jsx(n,{message:"Popularity"}),type:"number",min:1})]})]}),e.jsx(p,{name:"description",label:e.jsx(n,{message:"Overview"}),inputElementType:"textarea",rows:6,className:"mb-24"})]})}const Us=(s,t,a,r)=>{const i=["titles",`${s}`,"credits"];return t&&i.push("season",`${t}`),a&&i.push("episode",`${a}`),r&&i.push(r),i};function Bs(s={}){const{titleId:t,season:a,episode:r}=V();return Xr({endpoint:`titles/${t}/credits`,queryKey:Us(t,a,r,s),queryParams:{...s,perPage:30,season:a||"",episode:r||""}})}function D4(){const{titleId:s}=V();return I({mutationFn:t=>A4(t),onSuccess:async()=>{await _.invalidateQueries({queryKey:Us(s)}),M(d("Credit added"))},onError:t=>q(t)})}function A4(s){return S.post("titles/credits/reorder",s).then(t=>t.data)}function $4(s,t){const{titleId:a,season:r,episode:i}=V();return I({mutationFn:l=>R4(a,r,i,t,l),onSuccess:async()=>{await _.invalidateQueries({queryKey:Us(a)}),M(d("Credit updated"))},onError:l=>ee(l,s)})}function R4(s,t,a,r,i){return i={...i,season:t,episode:a},S.put(`titles/${s}/credits/${r}`,i).then(l=>l.data)}function V4(s){const{titleId:t,season:a,episode:r}=V();return I({mutationFn:i=>q4(t,a,r,i),onSuccess:async()=>{await _.invalidateQueries({queryKey:Us(t)}),M(d("Credit added"))},onError:i=>ee(i,s)})}function q4(s,t,a,r){return r={...r,season:t,episode:a},S.post(`titles/${s}/credits`,r).then(i=>i.data)}function O4({isCrew:s}){const{formId:t,close:a}=K(),r=O({defaultValues:{department:s?void 0:"actors",job:s?void 0:"actor"}}),i=V4(r);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Create credit"})}),e.jsx(X,{children:e.jsxs(te,{id:t,form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>a()})},children:[e.jsx(Vr,{endpoint:"normalized-models/person",name:"person_id",label:e.jsx(n,{message:"Person"}),className:"mb-24",autoFocus:!0}),e.jsx(eo,{isCrew:s})]})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:t,type:"submit",variant:"flat",color:"primary",disabled:i.isPending,children:e.jsx(n,{message:"Create"})})]})]})}function eo({isCrew:s}){return e.jsxs(m.Fragment,{children:[e.jsx(p,{name:"character",label:e.jsx(n,{message:"Character"}),required:!s,className:w("mb-24",s&&"hidden")}),e.jsx(U4,{isCrew:s})]})}function U4({isCrew:s}){const{data:t}=le(["tmdbDepartments"]),{watch:a}=P(),r=a("department"),{jobs:i,departments:l}=m.useMemo(()=>{const o=(t==null?void 0:t.tmdbDepartments.map(x=>({department:x.department.toLowerCase(),jobs:x.jobs})))||[],c=o.find(x=>x.department===r);return{jobs:(c==null?void 0:c.jobs.map(x=>({job:x.toLowerCase()})))||[],departments:o}},[t,r]);return e.jsxs(m.Fragment,{children:[e.jsx(D,{name:"department",label:e.jsx(n,{message:"Department"}),required:!0,disabled:!s,items:l,className:"mb-24",selectionMode:"single",showSearchField:!0,children:o=>e.jsx(h,{value:o.department,children:e.jsx(n,{message:o.department})})}),e.jsx(D,{name:"job",label:e.jsx(n,{message:"Job"}),required:!0,disabled:!s,items:i,selectionMode:"single",showSearchField:!0,children:o=>e.jsx(h,{value:o.job,children:e.jsx(n,{message:o.job})},o.job)})]})}function B4({credit:s}){const{formId:t,close:a}=K(),r=s.pivot.department!=="actors",i=O({defaultValues:{character:s.pivot.character,department:s.pivot.department,job:s.pivot.job}}),l=$4(i,s.pivot.id);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Edit credit"})}),e.jsx(X,{children:e.jsxs(te,{id:t,form:i,onSubmit:o=>{l.mutate(o,{onSuccess:()=>a()})},children:[e.jsx(Be,{value:s.name,label:e.jsx(n,{message:"Person"}),required:!0,readOnly:!0,disabled:!0,className:"mb-24"}),e.jsx(eo,{isCrew:r})]})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:t,type:"submit",variant:"flat",color:"primary",disabled:l.isPending,children:e.jsx(n,{message:"Save"})})]})]})}function H4(s){const{titleId:t,season:a,episode:r}=V();return I({mutationFn:()=>Z4(t,a,r,s),onSuccess:async()=>{await _.invalidateQueries({queryKey:Us(t)}),M(d("Credit deleted"))},onError:i=>q(i)})}function Z4(s,t,a,r){return S.delete(`titles/${s}/credits/${r}`,{params:{season:t,episode:a}}).then(i=>i.data)}const so=()=>({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.jsxs(A,{type:"modal",children:[e.jsx(C,{children:e.jsx(xe,{})}),e.jsx(B4,{credit:s})]}),e.jsx(K4,{creditId:s.pivot.id})]})});function K4({creditId:s}){const t=H4(s);return e.jsxs(A,{type:"modal",onClose:a=>{a&&t.mutate()},children:[e.jsx(C,{children:e.jsx(es,{})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete credit"}),body:e.jsx(n,{message:"Are you sure you want to delete this credit?"}),confirm:e.jsx(n,{message:"Delete"})})]})}const to=T([e.jsx("path",{d:"M21 5h2v14h-2zm-4 0h2v14h-2zm-3 0H2c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zm-1 12H3V7h10v10z"},"0"),e.jsx("circle",{cx:"8",cy:"9.94",r:"1.95"},"1"),e.jsx("path",{d:"M11.89 15.35c0-1.3-2.59-1.95-3.89-1.95s-3.89.65-3.89 1.95V16h7.78v-.65z"},"2")],"RecentActorsOutlined");function ao({query:s}){return s.data&&!s.items.length?e.jsx(W4,{}):s.data?e.jsx(Xt,{query:s}):e.jsx(ft,{query:s})}function W4(){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(to,{size:"xl"})}),imageHeight:"h-auto",title:e.jsx(n,{message:"No credits have been added yet"})})}const Q4=[{key:"dragHandle",width:"w-42 flex-shrink-0",header:()=>e.jsx(n,{message:"Drag handle"}),hideHeader:!0,body:()=>e.jsx(Ka,{className:"cursor-pointer text-muted hover:text"})},{key:"name",header:()=>e.jsx(n,{message:"Person"}),visibleInMode:"all",body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(Xa,{rounded:!0,person:s,size:"w-44"}),e.jsx("div",{className:"min-w-0 overflow-hidden",children:s.name})]})},{key:"character",header:()=>e.jsx(n,{message:"Character"}),body:s=>s.pivot.character},so()];function Cn({query:s}){return e.jsxs(m.Fragment,{children:[e.jsx(dt,{enableSelection:!1,columns:Q4,data:s.items,renderRowAs:G4,cellHeight:"h-54"}),e.jsx(ao,{query:s})]})}function G4({item:s,children:t,className:a,...r}){const i=Zr(),l=m.useContext(Yt),o=m.useRef(null),c=m.useRef(null),u=l.data,x=D4(),{sortableProps:g}=Qt({ref:o,disabled:i??!1,item:s,items:u,type:"cast-editor-item",preview:c,strategy:"line",onSortEnd:(j,v)=>{const f=u.map(y=>y.pivot.id),N=Ar(f,j,v);x.mutate({ids:N})}});return e.jsxs("div",{className:a,ref:o,...js(g,r),children:[t,!s.isPlaceholder&&e.jsx(J4,{item:s,ref:c})]})}const J4=B.forwardRef(({item:s},t)=>e.jsx(Za,{ref:t,children:()=>e.jsx("div",{className:"rounded bg-chip p-8 text-sm shadow",children:s.name})}));function Hs({query:s,isCrew:t}){const{trans:a}=z();return e.jsxs("div",{className:"flex items-center gap-24 justify-between mb-14",children:[e.jsxs(A,{type:"modal",children:[e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(me,{}),children:e.jsx(n,{message:"Add credit"})}),e.jsx(O4,{isCrew:t})]}),e.jsx(Be,{size:"sm",value:s.searchQuery,onChange:r=>s.setSearchQuery(r.target.value),placeholder:a(d("Search")),startAdornment:e.jsx(it,{})})]})}function Y4(){const s=Bs({department:"actors"});return e.jsxs(bt,{children:[e.jsx(Hs,{query:s,isCrew:!1}),e.jsx(Cn,{query:s})]})}function X4(){const s=Bs({department:"actors"});return e.jsxs(Ve,{children:[e.jsx(Hs,{query:s,isCrew:!1}),e.jsx(Cn,{query:s})]})}const e2=[{key:"name",header:()=>e.jsx(n,{message:"Person"}),visibleInMode:"all",body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(Xa,{rounded:!0,person:s,size:"w-44"}),e.jsx("div",{className:"overflow-hidden min-w-0",children:s.name})]})},{key:"department",header:()=>e.jsx(n,{message:"Department"}),body:s=>s.pivot.department},{key:"job",header:()=>e.jsx(n,{message:"Job"}),body:s=>s.pivot.job},so()];function wn({query:s}){return e.jsxs(m.Fragment,{children:[e.jsx(dt,{enableSelection:!1,columns:e2,data:s.items,cellHeight:"h-54",tableBody:e.jsx(s2,{})}),e.jsx(ao,{query:s})]})}function s2({renderRowAs:s}){const{data:t}=m.useContext(Yt);return e.jsx(m.Fragment,{children:t.map((a,r)=>e.jsx(ai,{item:a,index:r,renderAs:s},a.pivot.id))})}function t2(){const s=Bs({crewOnly:"true"});return e.jsxs(Ve,{children:[e.jsx(Hs,{query:s,isCrew:!0}),e.jsx(wn,{query:s})]})}function a2(){const s=Bs({department:"actors"});return e.jsxs(yn,{children:[e.jsx(Hs,{query:s,isCrew:!1}),e.jsx(Cn,{query:s})]})}function n2(){const s=Bs({crewOnly:"true"});return e.jsxs(yn,{children:[e.jsx(Hs,{query:s,isCrew:!0}),e.jsx(wn,{query:s})]})}function r2(){const s=Bs({crewOnly:"true"});return e.jsxs(bt,{children:[e.jsx(Hs,{query:s,isCrew:!0}),e.jsx(wn,{query:s})]})}function i2(s){const{titleId:t}=V();return I({mutationFn:()=>l2(t,s),onSuccess:async()=>{await _.invalidateQueries({queryKey:["titles",`${t}`]}),M(d("Tag detached"))},onError:a=>q(a)})}function l2(s,t){return S.delete(`titles/${s}/tags/${t.model_type}/${t.id}`).then(a=>a.data)}function o2(s,t){const{titleId:a}=V();return I({mutationFn:r=>c2(a,t,r),onSuccess:async()=>{await _.invalidateQueries({queryKey:["titles",`${a}`]}),M(d("Tag attached"))},onError:r=>ee(r,s)})}function c2(s,t,a){return S.post(`titles/${s}/tags/${t}`,a).then(r=>r.data)}function d2({type:s}){const{formId:t,close:a}=K(),r=O(),i=o2(r,s);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Add :name",values:{name:s.replace("_"," ")}})}),e.jsx(X,{children:e.jsx(te,{id:t,form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>a()})},children:e.jsx(u2,{type:s})})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:t,type:"submit",variant:"flat",color:"primary",disabled:i.isPending,children:e.jsx(n,{message:"Add"})})]})]})}function u2({type:s}){const[t,a]=m.useState(""),{isFetching:r,data:i}=Rr(`normalized-models/${s}`,{query:t});return e.jsx(Jl,{isAsync:!0,name:"tag_name",isLoading:r,inputValue:t,onInputValueChange:a,items:i==null?void 0:i.results,allowCustomValue:!0,autoFocus:!0,children:l=>e.jsx(h,{value:l.name,textLabel:l.name,children:e.jsx(n,{message:l.description||l.name})},l.id)})}const m2=[{key:"name",header:()=>e.jsx(n,{message:"ID"}),visibleInMode:"all",body:s=>e.jsx("span",{children:s.name})},{key:"display_name",header:()=>e.jsx(n,{message:"Display name"}),body:s=>e.jsx("span",{children:s.display_name})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs(A,{type:"modal",children:[e.jsx(C,{className:"text-muted",children:e.jsx($e,{})}),e.jsx(h2,{tag:s})]})}];function fa({type:s}){const t=x2({type:s});return e.jsxs(Ve,{children:[e.jsx("div",{className:"mb-14",children:e.jsxs(A,{type:"modal",children:[e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(me,{}),children:e.jsx(n,{message:"Add :name",values:{name:s.replace("_"," ")}})}),e.jsx(d2,{type:s})]})}),e.jsx(dt,{enableSelection:!1,columns:m2,data:t})]})}function x2({type:s}){const t=Me();switch(s){case et:return t.genres;case ks:return t.keywords;case Jt:return t.production_countries}}function h2({tag:s}){const{close:t}=K(),a=i2(s),r=s.model_type.replace("_"," ");return e.jsx(ce,{isLoading:a.isPending,isDanger:!0,title:e.jsx(n,{message:"Detach :name",values:{name:r}}),body:e.jsx(n,{message:"Are you sure you want to detach this :name?",values:{name:r}}),confirm:e.jsx(n,{message:"Detach"}),onConfirm:()=>{a.mutate(void 0,{onSuccess:()=>t()})}})}function g2(){const s=Me();return e.jsx(Ve,{children:e.jsx(Al,{hideTitle:!0,commentable:s})})}const p2=""+new URL("awards-411fec7f.svg",import.meta.url).href,j2=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>e.jsx(n,{message:"Person"}),body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(Xa,{person:s,srcSize:"sm",size:"w-32",rounded:!0}),e.jsxs("div",{className:"overflow-hidden min-w-0",children:[e.jsx("div",{className:"overflow-hidden overflow-ellipsis",children:e.jsx(sd,{person:s,target:"_blank"})}),e.jsx("div",{className:"text-muted text-xs overflow-hidden overflow-ellipsis",children:e.jsx(td,{person:s,linkTarget:"_blank",linkColor:"inherit"})})]})]})},{key:"birth_date",allowsSorting:!0,header:()=>e.jsx(n,{message:"Birth date"}),body:s=>e.jsx(ne,{date:s.birth_date})},{key:"views",allowsSorting:!0,header:()=>e.jsx(n,{message:"Page views"}),body:s=>s.views?e.jsx(Te,{value:s.views}):null,width:"w-124 flex-shrink-0"},{key:"popularity",allowsSorting:!0,header:()=>e.jsx(n,{message:"Popularity"}),body:s=>s.popularity?e.jsx(Te,{value:s.popularity}):null,width:"w-124 flex-shrink-0"},{key:"updated_at",allowsSorting:!0,width:"w-124 flex-shrink-0",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(ne,{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(F,{to:`${s.id}/edit/primary-facts`,className:"text-muted",children:e.jsx(W,{label:e.jsx(n,{message:"Edit"}),children:e.jsx(C,{size:"md",children:e.jsx(xe,{})})})})}],f2=[{key:"known_for",label:d("Known for"),description:d("What role is person known for"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"acting",options:[{label:d("Acting"),key:"acting",value:"acting"},{label:d("Directing"),key:"directing",value:"directing"},{label:d("Production"),key:"production",value:"production"},{label:d("Writing"),key:"writing",value:"writing"},{label:d("Crew"),key:"crew",value:"crew"},{label:d("Art"),key:"art",value:"art"},{label:d("Costume & Make-Up"),key:"Costume & Make-Up",value:"Costume & Make-Up"},{label:d("Camera"),key:"camera",value:"camera"},{label:d("Editing"),key:"editing",value:"editing"},{label:d("Visual Effects"),key:"visual effects",value:"visual effects"},{label:d("Sound"),key:"sound",value:"sound"},{label:d("Lighting"),key:"lighting",value:"lighting"},{label:d("Creator"),key:"creator",value:"creator"}]}},{key:"gender",label:d("Gender"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"male",options:[{label:d("Male"),key:"male",value:"male"},{label:d("Female"),key:"female",value:"female"}]}},{key:"poster",label:d("No poster"),description:d("Whether person has a poster"),defaultOperator:R.eq,control:{type:H.BooleanToggle,defaultValue:null}},{key:"views",label:d("Page views"),description:d("Number of unique page views"),defaultOperator:R.lte,operators:Gs,control:{type:H.Input,inputType:"number",minValue:1,defaultValue:100}},tt({key:"birth_date",label:d("Birth date"),description:d("Date person was born")}),tt({key:"death_date",label:d("Death date"),description:d("Date person died")}),Se({description:d("Date person was created")}),Ie({description:d("Date person was last updated")})];function b2(){return e.jsx(he,{endpoint:"people",title:e.jsx(n,{message:"People"}),columns:j2,filters:f2,actions:e.jsx(v2,{}),selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:p2,title:e.jsx(n,{message:"No people have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching people"})})})}function v2(){const{tmdb_is_setup:s}=ue(),t=Y();return e.jsxs(m.Fragment,{children:[s&&e.jsxs(A,{type:"modal",onClose:a=>{a&&t(`/admin/people/${a.id}/edit/primary-facts`)},children:[e.jsx(W,{label:e.jsx(n,{message:"Import using TheMovieDB ID"}),children:e.jsx(C,{variant:"outline",color:"primary",className:"flex-shrink-0",size:"sm",children:e.jsx(vn,{})})}),e.jsx(Wl,{modelType:ad})]}),e.jsx(je,{elementType:F,to:"new",children:e.jsx(n,{message:"Add person"})})]})}function y2(s){return I({mutationFn:t=>C2(t),onSuccess:async()=>{await _.invalidateQueries({queryKey:["people"]}),M(d("Person created"))},onError:t=>ee(t,s)})}function C2(s){return S.post("people",s).then(t=>t.data)}function no(){return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"mb-24 gap-24 md:flex",children:[e.jsx(Le,{variant:"square",previewSize:"w-204 aspect-poster",name:"poster",diskPrefix:"person-posters",label:e.jsx(n,{message:"Poster"}),showRemoveButton:!0}),e.jsxs("div",{className:"flex-auto max-md:mt-24",children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-24",required:!0}),e.jsx(w2,{}),e.jsx(_s,{name:"birth_date",label:e.jsx(n,{message:"Birth date"}),className:"mb-24",granularity:"day"}),e.jsx(_s,{name:"death_date",label:e.jsx(n,{message:"Death date"}),granularity:"day"})]})]}),e.jsx(p,{name:"description",label:e.jsx(n,{message:"Biography"}),inputElementType:"textarea",rows:4,className:"mb-24"}),e.jsx("div",{className:"mb-24 items-center gap-24 md:flex",children:e.jsx(p,{name:"birth_place",label:e.jsx(n,{message:"Birth place"}),className:"flex-1 max-md:mb-24"})}),e.jsx("div",{className:"mb-24 items-center gap-24 md:flex",children:e.jsxs(D,{name:"gender",label:e.jsx(n,{message:"Gender"}),className:"flex-1 max-md:mb-24",selectionMode:"single",children:[e.jsx(h,{value:"male",children:e.jsx(n,{message:"Male"})}),e.jsx(h,{value:"female",children:e.jsx(n,{message:"Female"})})]})}),e.jsx("div",{className:"mb-24 items-center gap-24 md:flex",children:e.jsx(p,{name:"popularity",label:e.jsx(n,{message:"Popularity"}),type:"number",min:1,className:"flex-1 max-md:mb-24"})})]})}function w2(){const{data:s}=le(["tmdbDepartments"]),t=m.useMemo(()=>s==null?void 0:s.tmdbDepartments.map(a=>a.department==="Actors"?{department:"Acting"}:{department:a.department}),[s]);return e.jsx(D,{name:"known_for",label:e.jsx(n,{message:"Known for"}),required:!0,items:t,className:"mb-24",selectionMode:"single",showSearchField:!0,children:a=>e.jsx(h,{value:a.department,children:e.jsx(n,{message:a.department})})})}function S2(){const s=Y(),t=O({defaultValues:{gender:"female",known_for:"Acting",popularity:3}}),a=y2(t);return e.jsx(We,{onSubmit:r=>a.mutate(r,{onSuccess:i=>{s(`../${i.person.id}/edit`,{relative:"path",replace:!0})}}),form:t,title:e.jsx(n,{message:"New person"}),isLoading:a.isPending,disableSaveWhenNotDirty:!0,children:e.jsx(we,{children:e.jsx(no,{})})})}function N2(s){const{personId:t}=V();return I({mutationFn:a=>k2(a,t),onSuccess:async()=>{await _.invalidateQueries({queryKey:["people",`${t}`]}),M(d("Person updated"))},onError:a=>ee(a,s)})}function k2(s,t){return S.put(`people/${t}`,s).then(a=>a.data)}function L2(){const s=nd("editPersonPage");return s.data?e.jsxs(m.Fragment,{children:[e.jsx(Ua,{query:s}),e.jsx(_2,{data:s.data})]}):e.jsx("div",{className:"relative h-full w-full",children:e.jsx(ys,{query:s,loaderClassName:"absolute inset-0 m-auto"})})}function _2({data:s}){const{person:t}=s,a=Y(),r=O({defaultValues:{name:t.name,known_for:t.known_for,poster:t.poster,birth_date:t.birth_date,death_date:t.death_date,birth_place:t.birth_place,description:t.description,gender:t.gender,popularity:t.popularity}}),i=N2(r),{pathname:l}=bs(),c=l.split("/").pop()==="credits"?1:0;return e.jsx(We,{onSubmit:u=>i.mutate(u,{onSuccess:()=>{a("../../../",{relative:"path",replace:!0})}}),form:r,title:e.jsx(n,{values:{name:t.name},message:"Edit “:name“"}),isLoading:i.isPending,disableSaveWhenNotDirty:!0,children:e.jsxs(ws,{selectedTab:c,children:[e.jsxs(Ss,{children:[e.jsx(fe,{elementType:F,to:"../primary-facts",relative:"path",replace:!0,children:e.jsx(n,{message:"Primary facts"})}),e.jsx(fe,{elementType:F,to:"../credits",relative:"path",replace:!0,children:e.jsx(n,{message:"Credits"})})]}),e.jsx("div",{className:"min-h-512 pt-24",children:e.jsx(we,{children:e.jsx(Ms,{context:s})})})]})})}function M2(s){const{personId:t}=V();return I({mutationFn:()=>I2(s.id,void 0,void 0,s.pivot.id),onSuccess:async()=>{await _.invalidateQueries({queryKey:Us(s.id)}),await _.invalidateQueries({queryKey:["people",`${t}`]}),M(d("Credit deleted"))},onError:a=>q(a)})}function I2(s,t,a,r){return S.delete(`titles/${s}/credits/${r}`,{params:{season:t,episode:a}}).then(i=>i.data)}const F2=[{key:"name",header:()=>e.jsx(n,{message:"Credit"}),visibleInMode:"all",width:"flex-3",body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(Rs,{title:s,srcSize:"sm",size:"w-32"}),e.jsxs("div",{className:"overflow-hidden min-w-0",children:[e.jsx("div",{className:"overflow-hidden overflow-ellipsis",children:e.jsx(rs,{title:s,target:"_blank"})}),e.jsx("div",{className:"text-muted text-xs overflow-hidden overflow-ellipsis",children:s.is_series?e.jsx(n,{message:"Series"}):e.jsx(n,{message:"Movie"})})]})]})},{key:"year",header:()=>e.jsx(n,{message:"Year"}),body:s=>s.year},{key:"character",header:()=>e.jsx(n,{message:"Character"}),body:s=>s.pivot.character?s.pivot.character:"-"},{key:"department",header:()=>e.jsx(n,{message:"Department"}),body:s=>e.jsx("span",{className:"capitalize",children:s.pivot.department})},{key:"job",header:()=>e.jsx(n,{message:"Job"}),body:s=>e.jsx("span",{className:"capitalize",children:s.pivot.job})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsx("div",{className:"text-muted",children:e.jsx(z2,{credit:s})})}];function P2(){const s=Me(),t=m.useMemo(()=>Object.values(s.credits).flat().filter(a=>a.pivot!=null),[s.credits]);return e.jsxs(m.Fragment,{children:[e.jsx(dt,{enableSelection:!1,columns:F2,data:t,cellHeight:"h-54",tableBody:e.jsx(T2,{})}),!t.length&&e.jsx(E2,{})]})}function T2({renderRowAs:s}){const{data:t}=m.useContext(Yt);return e.jsx(m.Fragment,{children:t.map((a,r)=>e.jsx(ai,{item:a,index:r,renderAs:s},a.pivot.id))})}function E2(){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(to,{size:"xl"})}),imageHeight:"h-auto",title:e.jsx(n,{message:"No credits have been added yet"})})}function z2({credit:s}){const t=M2(s);return e.jsxs(A,{type:"modal",children:[e.jsx(C,{children:e.jsx(es,{})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete credit"}),body:e.jsx(n,{message:"Are you sure you want to delete this credit?"}),confirm:e.jsx(n,{message:"Delete"}),isLoading:t.isPending,onConfirm:()=>t.mutate()})]})}function ra(){const[s,t]=m.useState(!1),{trans:a}=z(),i=P().watch("title"),l=a({message:"Title"});return s?e.jsx(p,{placeholder:l,autoFocus:!0,className:"mb-30",onBlur:()=>{t(!1)},name:"title",required:!0}):e.jsxs("h1",{tabIndex:0,onClick:()=>{t(!0)},onFocus:()=>{t(!0)},className:w("hover:bg-primary/focus rounded cursor-pointer",!i&&"text-muted"),children:[i||l,e.jsx(xe,{className:"icon-sm mx-8 mt-8 align-top text-muted"})]})}const D2=T(e.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"}),"UndoOutlined"),A2=T(e.jsx("path",{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"}),"RedoOutlined");function $2({editor:s}){return e.jsxs("span",{children:[e.jsx(C,{size:"md",disabled:!s.can().undo(),onClick:()=>{s.commands.focus(),s.commands.undo()},children:e.jsx(D2,{})}),e.jsx(C,{size:"md",disabled:!s.can().redo(),onClick:()=>{s.commands.focus(),s.commands.redo()},children:e.jsx(A2,{})})]})}const ro=T(e.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}),"CodeOutlined");function R2({editor:s}){return e.jsxs(A,{type:"modal",onClose:t=>{t!=null&&(s==null||s.commands.setContent(t))},children:[e.jsx(b,{variant:"text",startIcon:e.jsx(ro,{}),children:e.jsx(n,{message:"Source"})}),e.jsx(mn,{title:e.jsx(n,{message:"Source code"}),defaultValue:s.getHTML()})]})}function As(){return e.jsx("div",{className:"self-stretch mx-4 w-1 bg-divider flex-shrink-0"})}const V2=T(e.jsx("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"}),"FormatBoldOutlined"),q2=T(e.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z"}),"FormatItalicOutlined"),O2=T(e.jsx("path",{d:"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"}),"FormatUnderlinedOutlined");function U2({editor:s,size:t}){return e.jsxs("span",{className:w("flex-shrink-0 whitespace-nowrap"),children:[e.jsx(W,{label:e.jsx(n,{message:"Bold"}),children:e.jsx(C,{size:t,color:s.isActive("bold")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleBold()},children:e.jsx(V2,{})})}),e.jsx(W,{label:e.jsx(n,{message:"Italic"}),children:e.jsx(C,{size:t,color:s.isActive("italic")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleItalic()},children:e.jsx(q2,{})})}),e.jsx(W,{label:e.jsx(n,{message:"Underline"}),children:e.jsx(C,{size:t,color:s.isActive("underline")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleUnderline()},children:e.jsx(O2,{})})})]})}const B2=T(e.jsx("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"}),"FormatListBulletedOutlined"),H2=T(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 Z2({editor:s,size:t}){const a=s.isActive("bulletList"),r=s.isActive("orderedList");return e.jsxs("span",{className:w("flex-shrink-0","whitespace-nowrap"),children:[e.jsx(W,{label:e.jsx(n,{message:"Bulleted list"}),children:e.jsx(C,{size:t,color:a?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleBulletList()},children:e.jsx(B2,{})})}),e.jsx(W,{label:e.jsx(n,{message:"Numbered list"}),children:e.jsx(C,{size:t,color:r?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleOrderedList()},children:e.jsx(H2,{})})})]})}function K2(s,{text:t,target:a,href:r}){s.state.selection.empty&&t?s.commands.insertContent(`<a href="${r}" target="${a}">${t}</a>`):s.state.selection.empty||(r?s.chain().focus().extendMarkRange("link").setLink({href:r,target:a}).run():s.chain().focus().extendMarkRange("link").unsetLink().run())}function W2({editor:s,size:t}){return e.jsxs(A,{type:"modal",children:[e.jsx(W,{label:e.jsx(n,{message:"Insert link"}),children:e.jsx(C,{size:t,className:w("flex-shrink-0"),children:e.jsx(xn,{})})}),e.jsx(Q2,{editor:s})]})}function Q2({editor:s}){const t=s.getAttributes("link").href,a=s.state.doc.textBetween(s.state.selection.from,s.state.selection.to,""),r=O({defaultValues:{href:t,text:a,target:"_blank"}}),{formId:i,close:l}=K();return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Insert link"})}),e.jsx(X,{children:e.jsxs(te,{form:r,id:i,onSubmit:o=>{K2(s,o),l()},children:[e.jsx(p,{name:"href",label:e.jsx(n,{message:"URL"}),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(D,{selectionMode:"single",name:"target",label:e.jsx(n,{message:"Open link in..."}),children:[e.jsx(h,{value:"_self",children:e.jsx(n,{message:"Current window"})}),e.jsx(h,{value:"_blank",children:e.jsx(n,{message:"New window"})})]})]})}),e.jsxs(re,{children:[e.jsx(b,{onClick:l,variant:"text",children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{type:"submit",form:i,variant:"flat",color:"primary",children:e.jsx(n,{message:"Save"})})]})]})}const G2=2097152;function J2({editor:s,size:t,diskPrefix:a="page_media"}){const{selectAndUploadFile:r}=Ir(),i=()=>{r({showToastOnRestrictionFail:!0,restrictions:{allowedFileTypes:[Ut.image],maxFileSize:G2},metadata:{diskPrefix:a,disk:Bt.public},onSuccess:l=>{s.commands.focus(),s.commands.setImage({src:l.url})}})};return e.jsx(W,{label:e.jsx(n,{message:"Insert image"}),children:e.jsx(C,{size:t,onClick:i,className:w("flex-shrink-0"),children:e.jsx(Yr,{})})})}const Y2=T(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 X2({editor:s,size:t}){return e.jsx(W,{label:e.jsx(n,{message:"Clear formatting"}),children:e.jsx(C,{className:w("flex-shrink-0"),size:t,onClick:()=>{s.chain().focus().clearNodes().unsetAllMarks().run()},children:e.jsx(Y2,{})})})}const ef=T(e.jsx("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),sf=T([e.jsx("circle",{cx:"12",cy:"19",r:"2"},"0"),e.jsx("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHighOutlined"),tf=T(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"),af=T([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 nf({editor:s,size:t}){const[a,r]=m.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(Ze,{onItemSelected:i=>{i==="hr"?(s.commands.focus(),s.commands.setHorizontalRule()):i==="embed"?r("embed"):(s.commands.focus(),s.commands.addInfo({type:i}))},children:[e.jsx(C,{variant:"text",size:t,className:w("flex-shrink-0"),children:e.jsx(Gt,{})}),e.jsxs(Ke,{children:[e.jsx(h,{value:"hr",startIcon:e.jsx(ef,{}),children:e.jsx(n,{message:"Horizontal rule"})}),e.jsx(h,{value:"embed",startIcon:e.jsx(af,{}),children:e.jsx(n,{message:"Embed"})}),e.jsx(h,{value:"important",startIcon:e.jsx(sf,{}),children:e.jsx(n,{message:"Important"})}),e.jsx(h,{value:"warning",startIcon:e.jsx(Jo,{}),children:e.jsx(n,{message:"Warning"})}),e.jsx(h,{value:"success",startIcon:e.jsx(tf,{}),children:e.jsx(n,{message:"Note"})})]})]}),e.jsx(A,{type:"modal",isOpen:!!a,onClose:()=>{r(!1)},children:e.jsx(rf,{editor:s})})]})}function rf({editor:s}){const t=s.getAttributes("embed").src,a=O({defaultValues:{src:t}}),{formId:r,close:i}=K();return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Insert link"})}),e.jsx(X,{children:e.jsx(te,{form:a,id:r,onSubmit:l=>{s.commands.setEmbed(l),i()},children:e.jsx(p,{name:"src",label:e.jsx(n,{message:"Embed URL"}),autoFocus:!0,type:"url",required:!0})})}),e.jsxs(re,{children:[e.jsx(b,{onClick:i,variant:"text",children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{type:"submit",form:r,disabled:!a.formState.isValid,variant:"flat",color:"primary",children:e.jsx(n,{message:"Add"})})]})]})}function Qe({children:s,modifier:t,separator:a="+"}){const r=Yo()?e.jsx("span",{className:"text-base align-middle",children:"⌘"}):"Ctrl";return e.jsxs("kbd",{className:"text-xs text-muted",children:[t&&e.jsxs(e.Fragment,{children:[r,a]}),s]})}function lf({editor:s,size:t}){return e.jsxs(Ze,{floatingMinWidth:"w-256",onItemSelected:a=>{s.commands.focus(),typeof a=="string"&&a.startsWith("h")?s.commands.toggleHeading({level:parseInt(a.replace("h",""))}):a==="code"?s.commands.toggleCode():a==="strike"?s.commands.toggleStrike():a==="super"?s.commands.toggleSuperscript():a==="sub"?s.commands.toggleSubscript():a==="blockquote"?s.commands.toggleBlockquote():a==="paragraph"&&s.commands.setParagraph()},children:[e.jsx(b,{className:w("flex-shrink-0"),variant:"text",size:t,endIcon:e.jsx(_r,{}),children:e.jsx(n,{message:"Format"})}),e.jsxs(Ke,{children:[e.jsx(h,{value:"h1",endSection:e.jsx(Qe,{modifier:!0,children:"Alt+1"}),children:e.jsx(n,{message:"Heading :number",values:{number:1}})}),e.jsx(h,{value:"h2",endSection:e.jsx(Qe,{modifier:!0,children:"Alt+2"}),children:e.jsx(n,{message:"Heading :number",values:{number:2}})}),e.jsx(h,{value:"h3",endSection:e.jsx(Qe,{modifier:!0,children:"Alt+3"}),children:e.jsx(n,{message:"Heading :number",values:{number:3}})}),e.jsx(h,{value:"h4",endSection:e.jsx(Qe,{modifier:!0,children:"Alt+4"}),children:e.jsx(n,{message:"Heading :number",values:{number:4}})}),e.jsx(h,{value:"code",endSection:e.jsx(Qe,{modifier:!0,children:"E"}),children:e.jsx(n,{message:"Code"})}),e.jsx(h,{value:"strike",endSection:e.jsx(Qe,{modifier:!0,children:"Shift+X"}),children:e.jsx(n,{message:"Strikethrough"})}),e.jsx(h,{value:"super",endSection:e.jsx(Qe,{modifier:!0,separator:" ",children:"."}),children:e.jsx(n,{message:"Superscript"})}),e.jsx(h,{value:"sub",endSection:e.jsx(Qe,{modifier:!0,separator:" ",children:","}),children:e.jsx(n,{message:"Subscript"})}),e.jsx(h,{value:"blockquote",endSection:e.jsx(Qe,{modifier:!0,children:"Shift+B"}),children:e.jsx(n,{message:"Blockquote"})}),e.jsx(h,{value:"paragraph",endSection:e.jsx(Qe,{modifier:!0,children:"Alt+0"}),children:e.jsx(n,{message:"Paragraph"})})]})]})}const of=T(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"),cf=T(e.jsx("path",{d:"M16.56 8.94 7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10 10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5zM2 20h20v4H2v-4z"}),"FormatColorFillOutlined");function df({editor:s,size:t}){const[a,r]=m.useState(!1),i=s.getAttributes("textStyle").color,l=s.getAttributes("textStyle").backgroundColor;return e.jsxs(m.Fragment,{children:[e.jsxs("span",{className:w("flex-shrink-0 whitespace-nowrap"),children:[e.jsx(C,{size:t,color:i?"primary":null,onClick:()=>{r("text")},children:e.jsx(of,{})}),e.jsx(C,{size:t,color:l?"primary":null,onClick:()=>{r("bg")},children:e.jsx(cf,{})})]}),e.jsx(A,{defaultValue:a==="text"?"#000000":"#FFFFFF",type:"modal",isOpen:!!a,onClose:o=>{o&&(a==="text"?s.commands.setColor(o):s.commands.setBackgroundColor(o)),r(!1)},children:e.jsx(on,{})})]})}const uf=T(e.jsx("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}),"FormatAlignLeftOutlined"),mf=T(e.jsx("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}),"FormatAlignCenterOutlined"),xf=T(e.jsx("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}),"FormatAlignRightOutlined"),hf=T(e.jsx("path",{d:"M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"}),"FormatAlignJustifyOutlined"),_t={left:{icon:uf,label:d("Align left")},center:{icon:mf,label:d("Align center")},right:{icon:xf,label:d("Align right")},justify:{icon:hf,label:d("Justify")}};function gf({editor:s,size:t}){const a=Object.keys(_t).find(i=>s.isActive({textAlign:i}))||"left",r=a?_t[a].icon:_t.left.icon;return e.jsxs(Ze,{floatingWidth:"auto",selectionMode:"single",selectedValue:a,onSelectionChange:i=>{s.commands.focus(),s.commands.setTextAlign(i)},children:[e.jsx(C,{size:t,color:a?"primary":null,className:w("flex-shrink-0"),children:e.jsx(r,{})}),e.jsx(Ke,{children:Object.entries(_t).map(([i,l])=>{const o=l.icon;return e.jsx(h,{value:i,startIcon:e.jsx(o,{size:"md"}),capitalizeFirst:!0,children:e.jsx(n,{message:l.label.message})},i)})})]})}const pf=T(e.jsx("path",{d:"M11 17h10v-2H11v2zm-8-5 4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}),"FormatIndentDecreaseOutlined"),jf=T(e.jsx("path",{d:"M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}),"FormatIndentIncreaseOutlined");function ff({editor:s,size:t}){return e.jsxs("span",{className:w("flex-shrink-0","whitespace-nowrap"),children:[e.jsx(W,{label:e.jsx(n,{message:"Decrease indent"}),children:e.jsx(C,{size:t,onClick:()=>{s.commands.focus(),s.commands.outdent()},children:e.jsx(pf,{})})}),e.jsx(W,{label:e.jsx(n,{message:"Increase indent"}),children:e.jsx(C,{size:t,onClick:()=>{s.commands.focus(),s.commands.indent()},children:e.jsx(jf,{})})})]})}function bf({editor:s,size:t}){const a=s.getAttributes("codeBlock").language||"";return e.jsxs(Ze,{selectionMode:"single",selectedValue:a,onSelectionChange:r=>{s.commands.toggleCodeBlock({language:r})},children:[e.jsx(W,{label:e.jsx(n,{message:"Codeblock"}),children:e.jsx(C,{className:w("flex-shrink-0"),size:t,color:a?"primary":null,children:e.jsx(ro,{})})}),e.jsxs(Ke,{children:[e.jsx(h,{value:"html",children:"HTML"}),e.jsx(h,{value:"javascript",children:"JavaScript"}),e.jsx(h,{value:"css",children:"CSS"}),e.jsx(h,{value:"php",children:"PHP"}),e.jsx(h,{value:"shell",children:"Shell"}),e.jsx(h,{value:"bash",children:"Bash"}),e.jsx(h,{value:"ruby",children:"Ruby"}),e.jsx(h,{value:"python",children:"Python"}),e.jsx(h,{value:"java",children:"Java"}),e.jsx(h,{value:"c++",children:"C++"})]})]})}const ir="flex items-center px-4 h-42 text-muted border-b overflow-hidden";function vf({editor:s,size:t="md",justify:a="justify-center",hideInsertButton:r=!1,imageDiskPrefix:i}){const l=Ae(),[o,c]=m.useState(!1);return e.jsxs("div",{className:w(o?"h-84":"h-42"),children:[e.jsxs("div",{className:w(ir,a,"relative z-20"),children:[e.jsx(lf,{editor:s,size:t}),e.jsx(As,{}),e.jsx(U2,{editor:s,size:t}),e.jsx(As,{}),e.jsx(gf,{editor:s,size:t}),e.jsx(ff,{editor:s,size:t}),e.jsx(As,{}),l?e.jsx(C,{className:"flex-shrink-0",color:o?"primary":null,size:t,onClick:()=>{c(!o)},children:o?e.jsx(Xo,{}):e.jsx(ec,{})}):e.jsx(lr,{editor:s,size:t,hideInsertButton:r,imageDiskPrefix:i})]}),e.jsx(Oe,{children:o&&e.jsx(De.div,{className:w(ir,a,"absolute flex h-full w-full"),initial:{y:"-100%"},animate:{y:0},exit:{y:"-100%"},children:e.jsx(lr,{editor:s,size:t,imageDiskPrefix:i})})})]})}function lr({editor:s,size:t="md",hideInsertButton:a,imageDiskPrefix:r}){return e.jsxs(m.Fragment,{children:[e.jsx(Z2,{editor:s,size:t}),e.jsx(As,{}),e.jsx(W2,{editor:s,size:t}),e.jsx(J2,{editor:s,size:t,diskPrefix:r}),!a&&e.jsx(nf,{editor:s,size:t}),e.jsx(As,{}),e.jsx(df,{editor:s,size:t}),e.jsx(As,{}),e.jsx(bf,{editor:s,size:t}),e.jsx(X2,{editor:s,size:t})]})}function ia({editor:s,allowSlugEditing:t=!0,onSave:a,saveButton:r,isLoading:i=!1,backLink:l,slugPrefix:o="pages",imageDiskPrefix:c}){const{isSticky:u,sentinelRef:x}=Wr(),g=Ae();return e.jsxs(m.Fragment,{children:[e.jsx("div",{ref:x}),e.jsxs("div",{className:w("sticky top-0 z-10 mb-20 bg",u&&"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(m.Fragment,{children:[e.jsx(b,{variant:"text",size:"sm",elementType:F,to:l,relative:"path",startIcon:e.jsx(qs,{}),children:e.jsx(n,{message:"Back"})}),e.jsx("div",{className:"mr-auto",children:t&&e.jsx(Cf,{name:"slug",showLinkIcon:!1,prefix:o})})]}),s&&e.jsx($2,{editor:s}),!g&&e.jsx(R2,{editor:s}),a&&e.jsx(yf,{onSave:()=>{a(s.getHTML())},isLoading:i}),r]}),e.jsx(vf,{editor:s,size:"sm",imageDiskPrefix:c})]})]})}function yf({onSave:s,isLoading:t}){const r=P().watch("title");return e.jsx(b,{variant:"flat",size:"sm",color:"primary",className:"min-w-90",disabled:t||!r,onClick:()=>s(),children:e.jsx(n,{message:"Save"})})}function Cf({name:s,...t}){const{field:{onChange:a,onBlur:r,value:i="",ref:l}}=ps({name:s}),o=m.useRef(!1),{watch:c,setValue:u}=P();return m.useEffect(()=>{const x=c((g,{name:j})=>{j==="title"&&!o.current&&u("slug",g.title)});return()=>x.unsubscribe()},[c,u]),e.jsx(kl,{className:w(!i&&"invisible"),onChange:x=>{o.current=!0,a(x)},onInputBlur:r,value:i,inputRef:l,...t})}function wf(){const{articleId:s}=V();return I({mutationFn:t=>Sf(s,t),onError:t=>q(t),onSuccess:async()=>{await _.invalidateQueries({queryKey:["news"]}),M(d("Article updated"))}})}function Sf(s,t){return S.put(`news/${s}`,t).then(a=>a.data)}const Nf=B.lazy(()=>fs(()=>import("./article-body-editor-9fa9dbcf.js"),["./article-body-editor-9fa9dbcf.js","./main-239552ae.js","./main-3987dbef.css","./linkify.es-ff711e62.js","./c-ea92d14f.js","./article-body-editor-c0ff5600.css"],import.meta.url));function kf(){const s=rd("newsArticlePage");return s.data?e.jsxs(m.Fragment,{children:[e.jsx(Ua,{query:s}),e.jsx(Lf,{article:s.data.article})]}):e.jsx("div",{className:"relative h-full w-full",children:e.jsx(ys,{query:s})})}function Lf({article:s}){const t=Y(),a=wf(),r=O({defaultValues:{title:s.title,slug:s.slug,body:s.body,image:s.image}}),i=l=>{a.mutate({...r.getValues(),body:l},{onSuccess:()=>t("../..",{relative:"path"})})};return e.jsx(m.Suspense,{fallback:e.jsx(_e,{}),children:e.jsx(Nf,{initialContent:s.body,children:(l,o)=>e.jsx(we,{children:e.jsxs(Ht,{...r,children:[e.jsx(ia,{editor:o,backLink:"../..",slugPrefix:"news",isLoading:a.isPending,onSave:i}),e.jsxs("div",{className:"mx-20",children:[e.jsx(Le,{className:"mx-auto mb-32 max-w-[655px]",showEditButtonOnHover:!0,variant:"square",name:"image",diskPrefix:"news_images"}),e.jsxs("div",{className:"prose mx-auto flex-auto dark:prose-invert",children:[e.jsx(ra,{}),l]})]})]})})})})}function _f(){return I({mutationFn:s=>Mf(s),onError:s=>q(s),onSuccess:async()=>{await _.invalidateQueries({queryKey:["news"]}),M(d("Article created"))}})}function Mf(s){return S.post("news",s).then(t=>t.data)}const If=B.lazy(()=>fs(()=>import("./article-body-editor-9fa9dbcf.js"),["./article-body-editor-9fa9dbcf.js","./main-239552ae.js","./main-3987dbef.css","./linkify.es-ff711e62.js","./c-ea92d14f.js","./article-body-editor-c0ff5600.css"],import.meta.url));function Ff(){const s=Y(),t=_f(),a=O({}),r=i=>{t.mutate({...a.getValues(),body:i},{onSuccess:()=>s("..",{relative:"path"})})};return e.jsx(m.Suspense,{fallback:e.jsx(_e,{}),children:e.jsx(If,{children:(i,l)=>e.jsx(we,{children:e.jsxs(Ht,{...a,children:[e.jsx(ia,{editor:l,backLink:"..",isLoading:t.isPending,onSave:r}),e.jsxs("div",{className:"mx-20",children:[e.jsx(Le,{className:"mx-auto mb-32 max-w-[655px]",showEditButtonOnHover:!0,variant:"square",name:"image",diskPrefix:"news_images"}),e.jsxs("div",{className:"prose mx-auto flex-auto dark:prose-invert",children:[e.jsx(ra,{}),i]})]})]})})})})}function Pf(s,t){return I({mutationFn:a=>Tf(a,t),onSuccess:async()=>{await _.invalidateQueries({queryKey:J("title-tags")})},onError:a=>ee(a,s)})}function Tf(s,t){return S.post(`title-tags/${t}`,s).then(a=>a.data)}function Ef({type:s}){const t=s.replace("_"," "),{formId:a,close:r}=K(),i=O(),l=Pf(i,s);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Add :name",values:{name:t}})}),e.jsx(X,{children:e.jsxs(te,{id:a,form:i,onSubmit:async o=>{await l.mutate(o,{onSuccess:()=>{M(d(":name created",{values:{name:t}})),r()}})},children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),description:e.jsx(n,{message:"Unique :name identifier.",values:{name:t}}),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 :name name.",values:{name:t}}),className:"mb-20"})]})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>r(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,type:"submit",variant:"flat",color:"primary",disabled:l.isPending,children:e.jsx(n,{message:"Create"})})]})]})}function zf(s,t){return I({mutationFn:a=>Df(a,t),onSuccess:async()=>{await _.invalidateQueries({queryKey:J("title-tags")})},onError:a=>ee(a,s)})}function Df(s,t){return S.put(`title-tags/${t.model_type}/${t.id}`,s).then(a=>a.data)}function Af({tag:s}){const t=s.model_type.replace("_"," "),{formId:a,close:r}=K(),i=O({defaultValues:{name:s.name,display_name:s.display_name}}),l=zf(i,s);return e.jsxs(G,{children:[e.jsx(se,{children:e.jsx(n,{message:"Add :name",values:{name:t}})}),e.jsx(X,{children:e.jsxs(te,{id:a,form:i,onSubmit:async o=>{l.mutate(o,{onSuccess:()=>{M(d(":name updated",{values:{name:t}})),r()}})},children:[e.jsx(p,{name:"name",label:e.jsx(n,{message:"Name"}),description:e.jsx(n,{message:"Unique :name identifier.",values:{name:t}}),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 :name name.",values:{name:t}}),className:"mb-20"})]})}),e.jsxs(re,{children:[e.jsx(b,{onClick:()=>r(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,type:"submit",variant:"flat",color:"primary",disabled:l.isPending,children:e.jsx(n,{message:"Save"})})]})]})}const $f=[Se({description:d("Date item was created")}),Ie({description:d("Date item was last updated")})],Rf=[{key:"name",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Name"}),body:s=>s.name},{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(ne,{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(A,{type:"modal",children:[e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(xe,{})}),e.jsx(Af,{tag:s})]})}];function or({type:s}){const t=`${s.replace("_"," ")}s`;return e.jsx(he,{endpoint:`title-tags/${s}`,title:e.jsx(n,{message:t}),columns:Rf,filters:$f,actions:e.jsx(Vf,{type:s}),selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:pn,title:e.jsx(n,{message:"No :name have been created yet",values:{name:t}}),filteringTitle:e.jsx(n,{message:"No matching :name",values:{name:t}})})})}function Vf({type:s}){return e.jsx(m.Fragment,{children:e.jsxs(A,{type:"modal",children:[e.jsx(je,{children:e.jsx(n,{message:"Add new :name",values:{name:s.replace("_"," ")}})}),e.jsx(Ef,{type:s})]})})}const qf=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>e.jsx(n,{message:"Name"}),body:s=>e.jsx("a",{className:"outline-none hover:underline focus-visible:underline",href:`lists/${s.id}`,target:"_blank",rel:"noreferrer",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(us,{image:s.user.avatar,label:s.user.display_name,description:s.user.email})},{key:"items_count",width:"w-96",header:()=>e.jsx(n,{message:"Items"}),body:s=>s.items_count&&e.jsx(Te,{value:s.items_count})},{key:"public",header:()=>e.jsx(n,{message:"Public"}),width:"w-96",body:s=>s.public?e.jsx($t,{className:"text-positive"}):e.jsx($e,{className:"text-danger"})},{key:"content_type",allowsSorting:!1,header:()=>e.jsx(n,{message:"Content type"}),body:s=>e.jsx("span",{className:"capitalize",children:s.config.contentModel?e.jsx(n,{message:s.config.contentModel}):void 0})},{key:"layout",allowsSorting:!1,header:()=>e.jsx(n,{message:"Layout"}),body:s=>e.jsx("span",{className:"capitalize",children:s.config.layout?e.jsx(n,{message:s.config.layout}):void 0})},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(ne,{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(F,{to:`${s.id}/edit`,className:"text-muted",children:e.jsx(C,{size:"md",children:e.jsx(xe,{})})})}];function Of(){return e.jsx(he,{endpoint:"lists",title:e.jsx(n,{message:"User lists"}),columns:qf,actions:e.jsx(Uf,{}),selectedActions:e.jsx(Fe,{}),emptyStateMessage:e.jsx(oe,{image:id,title:e.jsx(n,{message:"No lists have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching lists"})})})}function Uf(){return e.jsx(je,{elementType:F,to:"new",children:e.jsx(n,{message:"Add new list"})})}const Bf={month:"short",day:"2-digit"};function io({value:s,onChange:t,disabled:a,compactOnMobile:r=!0,enableCompare:i=!1,granularity:l="minute"}){const o=Ae();return e.jsxs(A,{type:"popover",onClose:c=>{c&&t(c)},children:[e.jsx(b,{variant:"outline",color:"chip",endIcon:e.jsx(Er,{}),disabled:a,children:e.jsx(ld,{start:s.start,end:s.end,options:o&&r?Bf:Nr.short})}),e.jsx(Hf,{value:s,enableCompare:i,granularity:l})]})}function Hf({value:s,enableCompare:t,granularity:a}){const r=Ae(),i=$n({granularity:a,defaultValue:{start:s.start,end:s.end,preset:s.preset},closeDialogOnSelection:!1}),l=!!s.compareStart&&!!s.compareEnd,o=$n({granularity:a,defaultValue:l?{start:s.compareStart,end:s.compareEnd,preset:s.comparePreset}:od[0].getRangeValue(i.selectedValue)});return e.jsx(cd,{state:i,compareState:t?o:void 0,compareVisibleDefault:l,showInlineDatePickerField:!r})}function Zf({children:s,color:t,variant:a,radius:r="rounded-button",size:i,className:l,value:o,onChange:c,multiple:u,disabled:x}){const g=f=>o===void 0?!1:u?o.includes(f):f===o,j=f=>{const N=[...o],y=o.indexOf(f);return y>-1?N.splice(y,1):N.push(f),N},v=B.Children.map(s,(f,N)=>{if(B.isValidElement(f)){const y=g(f.props.value),L=y?"primary":t;return B.cloneElement(f,{color:y?"primary":t,variant:a,size:i,radius:null,disabled:f.props.disabled||x,...f.props,onClick:k=>{f.props.onClick&&f.props.onClick(k),c&&(u?c==null||c(j(f.props.value)):c==null||c(f.props.value))},className:w(f.props.className,y?"z-20":"z-10",Kf(N,s,r,L))})}});return e.jsx("div",{className:w(r,"isolate inline-flex",l),children:v})}function Kf(s,t,a,r){return s===0?w(a,"rounded-tr-none rounded-br-none",!r&&"border-r-transparent disabled:border-r-transparent"):s===t.length-1?w(a,"rounded-tl-none rounded-bl-none -ml-1"):w("rounded-none -ml-1",!r&&"border-r-transparent disabled:border-r-transparent")}const Wf=T(e.jsx("path",{d:"m16 6 2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6h-6z"}),"TrendingUpOutlined"),Qf=T(e.jsx("path",{d:"m16 18 2.29-2.29-4.88-4.88-4 4L2 7.41 3.41 6l6 6 4-4 6.3 6.29L22 12v6h-6z"}),"TrendingDownOutlined");function Sn(s){const{title:t,description:a,children:r,className:i,contentIsFlex:l=!0,contentClassName:o,contentRef:c,minHeight:u="min-h-440"}=s;return e.jsxs("div",{className:w("rounded-panel flex h-full flex-auto flex-col border bg",u,i),children:[e.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between p-14 text-xs",children:[e.jsx("div",{className:"text-sm font-semibold",children:t}),a&&e.jsx("div",{className:"text-muted",children:a})]}),e.jsx("div",{ref:c,className:w("relative p-14",l&&"flex flex-auto items-center justify-center",o),children:r})]})}function Et(){return e.jsxs("div",{className:"flex items-center gap-10 text-sm absolute mx-auto",children:[e.jsx(ds,{isIndeterminate:!0,size:"sm"}),e.jsx(n,{message:"Chart loading"})]})}const Gf=m.lazy(()=>fs(()=>import("./lazy-chart-b797a81a.js"),["./lazy-chart-b797a81a.js","./main-239552ae.js","./main-3987dbef.css"],import.meta.url));function Nn(s){const{title:t,description:a,className:r,contentRef:i,isLoading:l}=s;return e.jsx(Sn,{title:t,description:a,className:r,contentRef:i,children:e.jsxs(m.Suspense,{fallback:e.jsx(Et,{}),children:[e.jsx(Gf,{...s}),l&&e.jsx(Et,{})]})})}function kn(s,{localeCode:t="en",shareFirstDatasetLabels:a=!0}){if(!s)return{datasets:[]};const r=[];return{...s,datasets:s.datasets.map((i,l)=>{const o=i.data.map((c,u)=>{let x;return l===0||!a?(x=Jf(c,s.granularity,t),r[u]=x):x=r[u],{...x,value:c.value}});return{...i,data:o}})}}function Jf(s,t,a){return s.label?{label:s.label}:s.date?Yf(s,t,a):{label:""}}function Yf({date:s,endDate:t},a="day",r){const i=Mt(s).toDate(),l=t?Mt(t).toDate():null;switch(a){case"minute":return{label:Ee(r,{second:"2-digit"}).format(i),tooltipTitle:Ee(r,{day:"2-digit",hour:"numeric",minute:"numeric",second:"2-digit"}).format(i)};case"hour":return{label:Ee(r,{hour:"numeric",minute:"numeric"}).format(i),tooltipTitle:Ee(r,{month:"short",day:"2-digit",hour:"numeric",minute:"numeric"}).format(i)};case"day":return{label:Ee(r,{day:"2-digit",weekday:"short"}).format(i),tooltipTitle:Ee(r,{day:"2-digit",weekday:"short",month:"short"}).format(i)};case"week":return{label:Ee(r,{month:"short",day:"2-digit"}).format(i),tooltipTitle:Ee(r,{day:"2-digit",month:"long",year:"numeric"}).formatRange(i,l)};case"month":return{label:Ee(r,{month:"short",year:"numeric"}).format(i),tooltipTitle:Ee(r,{month:"long",year:"numeric"}).format(i)};case"year":return{label:Ee(r,{year:"numeric"}).format(i),tooltipTitle:Ee(r,{year:"numeric"}).format(i)}}}const Ee=kr((s,t)=>new sc(s,t),{equals:(s,t)=>tc(s,t),callTimeout:void 0}),cr=wr().themes.all[0].values["--be-primary"],ns=[[`rgb(${cr.replaceAll(" ",",")})`,`rgba(${cr.replaceAll(" ",",")},0.2)`],["rgb(255,112,67)","rgb(255,112,67,0.2)"],["rgb(255,167,38)","rgb(255,167,38,0.2)"],["rgb(141,110,99)","rgb(141,110,99,0.2)"],["rgb(102,187,106)","rgba(102,187,106,0.2)"],["rgb(92,107,192)","rgb(92,107,192,0.2)"]],Xf={parsing:{xAxisKey:"label",yAxisKey:"value"},datasets:{line:{fill:"origin",tension:.1,pointBorderWidth:4,pointHitRadius:10}},plugins:{tooltip:{intersect:!1,mode:"index"}}};function lo({data:s,className:t,...a}){const{localeCode:r}=Zt(),i=m.useMemo(()=>{const l=kn(s,{localeCode:r});return l.datasets=l.datasets.map((o,c)=>({...o,backgroundColor:ns[c][1],borderColor:ns[c][0],pointBackgroundColor:ns[c][0]})),l},[s,r]);return e.jsx(Nn,{...a,className:w(t,"min-w-500"),data:i,type:"line",options:Xf})}const e3={parsing:{key:"value"},plugins:{tooltip:{intersect:!0}}};function Ln({data:s,className:t,...a}){const{localeCode:r}=Zt(),i=m.useMemo(()=>{var o;const l=kn(s,{localeCode:r});return l.labels=(o=l.datasets[0])==null?void 0:o.data.map(c=>c.label),l.datasets=l.datasets.map((c,u)=>({...c,backgroundColor:ns.map(x=>x[1]),borderColor:ns.map(x=>x[0]),borderWidth:2})),l},[s,r]);return e.jsx(Nn,{type:"polarArea",data:i,options:e3,className:w(t,"min-w-500"),...a})}function s3({data:s,direction:t="vertical",individualBarColors:a=!1,className:r,...i}){const{localeCode:l}=Zt(),o=m.useMemo(()=>{const x=kn(s,{localeCode:l});return x.datasets=x.datasets.map((g,j)=>({...g,backgroundColor:a?ns.map(v=>v[1]):ns[j][1],borderColor:a?ns.map(v=>v[0]):ns[j][0],borderWidth:2})),x},[s,l,a]),c=t==="horizontal",u=m.useMemo(()=>({indexAxis:c?"y":"x",parsing:{xAxisKey:c?"value":"label",yAxisKey:c?"label":"value"}}),[c]);return e.jsx(Nn,{type:"bar",className:w(r,"min-w-500"),data:o,options:u,...i})}const dr="https://www.gstatic.com/charts/loader.js";function t3({placeholderRef:s,data:t,country:a,onCountrySelected:r}){const{trans:i}=z(),{analytics:l}=ue(),o=l==null?void 0:l.gchart_api_key,{selectedTheme:c}=ac(),u=m.useRef(),x=!!r&&!a,g=m.useCallback(()=>{var L,k;if(typeof google>"u")return;const v=t.map(E=>[E.label,E.value]);v.unshift([i(a?d("City"):d("Country")),i(d("Clicks"))]);const f=`${_a(c.values["--be-paper"])}`,y={colorAxis:{colors:[`${_a(c.values["--be-primary"])}`]},backgroundColor:f,region:a?a.toUpperCase():void 0,resolution:a?"provinces":"countries",displayMode:a?"markers":"regions",enableRegionInteractivity:x};!u.current&&s.current&&((L=google==null?void 0:google.visualization)!=null&&L.GeoChart)&&(u.current=new google.visualization.GeoChart(s.current)),(k=u.current)==null||k.draw(google.visualization.arrayToDataTable(v),y)},[c,t,s,i,a,x]),j=m.useCallback(async()=>{An.isLoadingOrLoaded(dr)||(await An.loadAsset(dr,{type:"js",id:"google-charts-js"}),await google.charts.load("current",{packages:["geochart"],mapsApiKey:o}),g())},[o,g]);return m.useEffect(()=>(u.current&&r&&google.visualization.events.addListener(u.current,"regionClick",v=>r==null?void 0:r(v.region)),()=>{u.current&&google.visualization.events.removeAllListeners(u.current)}),[r,u.current]),m.useEffect(()=>{j()},[j]),m.useEffect(()=>{g()},[c,g,t]),{drawGoogleChart:g}}const a3=m.memo(({code:s})=>{const{localeCode:t}=Zt(),a=new Intl.DisplayNames([t],{type:"region"});let r;try{r=a.of(s.toUpperCase())}catch{}return e.jsx(m.Fragment,{children:r})});function oo({data:s,isLoading:t,onCountrySelected:a,country:r,...i}){const l=m.useRef(null),o=!!a,c=s==null?void 0:s.datasets[0].data,u=m.useMemo(()=>c||[],[c]);return t3({placeholderRef:l,data:u,country:r,onCountrySelected:a}),e.jsxs(Sn,{...i,className:"min-w-500",title:e.jsxs("div",{className:"flex items-center",children:[e.jsx(n,{message:"Top Locations"}),r?e.jsxs("span",{className:"pl-4",children:["(",e.jsx(a3,{code:r}),")"]}):null,o&&e.jsx(n3,{})]}),contentIsFlex:t,children:[t&&e.jsx(Et,{}),e.jsxs("div",{className:"flex gap-24",children:[e.jsx("div",{ref:l,className:"flex-auto w-[480px] min-h-[340px]"}),e.jsxs("div",{className:"w-[170px]",children:[e.jsx("div",{className:"text-sm max-h-[340px] w-full flex-initial overflow-y-auto",children:u.map(x=>e.jsxs("div",{className:w("flex items-center gap-4 mb-4",o&&"cursor-pointer hover:underline"),role:o?"button":void 0,onClick:()=>{a==null||a(x.code)},children:[e.jsx("div",{className:"max-w-110 whitespace-nowrap overflow-hidden overflow-ellipsis",children:x.label}),e.jsxs("div",{children:["(",x.percentage,")%"]})]},x.label))}),r&&e.jsx(b,{variant:"outline",size:"xs",className:"mt-14",startIcon:e.jsx(qs,{}),onClick:()=>{a==null||a(void 0)},children:e.jsx(n,{message:"Back to countries"})})]})]})]})}function n3(){return e.jsx(jt,{title:e.jsx(n,{message:"Zooming in"}),body:e.jsx(n,{message:"Click on a country inside the map or country list to zoom in and see city data for that country."})})}const co="gap-12 md:gap-16 mb-12 md:mb-16",ur=`flex flex-col md:flex-row md:items-center overflow-x-auto ${co}`;function r3({report:s,isLoading:t}){const a=s==null?void 0:s.pageViews.total;return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:ur,children:[e.jsx(lo,{isLoading:t,className:"flex-auto",data:s==null?void 0:s.pageViews,title:e.jsx(n,{message:"Pageviews"}),description:a?e.jsx(n,{message:":count total views",values:{count:e.jsx(Te,{value:a})}}):null}),e.jsx(Ln,{isLoading:t,data:s==null?void 0:s.devices,title:e.jsx(n,{message:"Top devices"})})]}),e.jsxs("div",{className:ur,children:[e.jsx(s3,{isLoading:t,data:s==null?void 0:s.browsers,className:"flex-auto md:w-1/3",direction:"horizontal",individualBarColors:!0,hideLegend:!0,title:e.jsx(n,{message:"Top browsers"})}),e.jsx(oo,{isLoading:t,className:"flex-auto",data:s==null?void 0:s.locations,title:e.jsx(n,{message:"Top locations"})})]})]})}const i3=T(e.jsx("path",{d:"m22 12-4-4v3H3v2h15v3l4-4z"}),"TrendingFlatOutlined");function l3({report:s,isLoading:t}){return e.jsx("div",{className:`flex h-[97px] flex-shrink-0 items-center overflow-x-auto ${co}`,children:s==null?void 0:s.map(a=>e.jsx(o3,{datum:a,isLoading:t},a.name))})}function o3({datum:s,isLoading:t=!1}){let a;if(m.isValidElement(s.icon))a=m.cloneElement(s.icon,{size:"lg"});else{const r=Ea(s.icon);a=e.jsx(r,{size:"lg"})}return e.jsxs("div",{className:"rounded-panel flex h-full flex-auto items-center gap-18 whitespace-nowrap border p-20",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary-light/20 p-10 text-primary",children:a}),e.jsxs("div",{className:"flex-auto",children:[e.jsx("div",{className:"flex items-center justify-between gap-20",children:e.jsx("div",{className:"text-lg font-bold text-main",children:e.jsx(Oe,{initial:!1,mode:"wait",children:t?e.jsx(De.div,{...Je,children:e.jsx(ls,{className:"min-w-24"})},"skeleton"):e.jsx(De.div,{...Je,children:e.jsx(c3,{datum:s})},"value")})})}),e.jsxs("div",{className:"flex items-center justify-between gap-20",children:[e.jsx("h2",{className:"text-sm text-muted",children:s.name}),(s.percentageChange!=null||s.previousValue!=null)&&e.jsx("div",{className:"flex items-center gap-10",children:e.jsx(d3,{datum:s})})]})]})]},s.name)}function c3({datum:s}){switch(s.type){case"fileSize":return e.jsx(jn,{bytes:s.currentValue});case"percentage":return e.jsx(Te,{value:s.currentValue,style:"percent",maximumFractionDigits:1});default:return e.jsx(Te,{value:s.currentValue})}}function d3({datum:s}){const t=u3(s);let a;return t>0?a=e.jsx(Wf,{size:"md",className:"text-positive"}):t===0?a=e.jsx(i3,{className:"text-muted"}):a=e.jsx(Qf,{className:"text-danger"}),e.jsxs(m.Fragment,{children:[a,e.jsxs("div",{className:"text-sm font-semibold text-muted",children:[t,"%"]})]})}function u3({percentageChange:s,previousValue:t,currentValue:a}){return s!=null||t==null||a==null?s??0:t===0?100:Math.round((a-t)/t*100)}const uo="admin/reports";function mo(s={}){return be({queryKey:[uo,s],queryFn:()=>m3(s),placeholderData:Oa})}function m3({types:s,dateRange:t}){const a={};return s&&(a.types=s.join(",")),t&&(a.startDate=t.start.toAbsoluteString(),a.endDate=t.end.toAbsoluteString(),a.timezone=t.start.timeZone),S.get(uo,{params:a}).then(r=>r.data)}function x3(){const[s,t]=m.useState(()=>Ba[2].getRangeValue()),r=V()["*"]||"plays",i=r==="visitors"?e.jsx(n,{message:"Visitors report"}):e.jsx(n,{message:"Plays report"});return e.jsxs("div",{className:"min-h-full overflow-x-hidden p-12 md:p-24",children:[e.jsxs("div",{className:"mb-24 items-center justify-between gap-24 md:flex",children:[e.jsx(cs,{children:i}),e.jsx("h1",{className:"mb-24 text-3xl font-light md:mb-0",children:i}),e.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between gap-10 md:gap-24",children:[e.jsxs(Zf,{variant:"outline",value:r,children:[e.jsx(b,{value:"plays",elementType:F,to:"plays",children:e.jsx(n,{message:"Plays"})}),e.jsx(b,{value:"visitors",elementType:F,to:"visitors",children:e.jsx(n,{message:"Visitors"})})]}),e.jsx(io,{value:s,onChange:t})]})]}),e.jsx(h3,{dateRange:s}),e.jsx(Ms,{context:{dateRange:s,setDateRange:t}})]})}function h3({dateRange:s}){const{data:t}=mo({types:["header"],dateRange:s});return e.jsx(l3,{report:t==null?void 0:t.headerReport})}function Pe({children:s}){return e.jsx("div",{className:"mb-12 flex flex-col gap-12 overflow-x-auto md:mb-18 md:gap-18 lg:flex-row lg:items-center",children:s})}const mr="reports/insights";function g3(s,t){return be({queryKey:[mr,s],queryFn:()=>p3(mr,s),placeholderData:Oa,enabled:t.isEnabled,staleTime:1/0})}function p3(s,t){var r;const a={model:t.model,metrics:(r=t.metrics)==null?void 0:r.join(",")};return a.startDate=t.dateRange.start.toAbsoluteString(),a.endDate=t.dateRange.end.toAbsoluteString(),a.timezone=t.dateRange.start.timeZone,S.get(s,{params:a}).then(i=>i.data)}const _n=B.createContext(null);function j3(){return m.useContext(_n)}function ss({children:s,metric:t}){var g,j;const[a,r]=m.useState(!1),{dateRange:i,model:l}=j3(),o=g3({metrics:[t],model:l,dateRange:i},{isEnabled:a}),c=typeof s=="function"?s(o):s,u=m.useRef(),x=m.useCallback(v=>{var f;if(v){const N=new IntersectionObserver(([y])=>{var L;y.isIntersecting&&(r(!0),(L=u.current)==null||L.disconnect(),u.current=void 0)},{threshold:.1});u.current=N,N.observe(v)}else u.current&&((f=u.current)==null||f.disconnect())},[]);return m.cloneElement(c,{data:(j=(g=o.data)==null?void 0:g.report)==null?void 0:j[t],isLoading:o.isLoading,contentRef:x})}function vt(){return e.jsx(ss,{metric:"plays",children:({data:s})=>e.jsx(lo,{className:"flex-auto",title:e.jsx(n,{message:"Plays"}),hideLegend:!0,description:e.jsx(n,{message:":count total plays",values:{count:e.jsx(Te,{value:(s==null?void 0:s.report.plays.total)||0})}})})})}function yt(){return e.jsx(ss,{metric:"devices",children:e.jsx(Ln,{title:e.jsx(n,{message:"Top devices"})})})}const xo=T(e.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"InfoOutlined");function Zs({data:s,isLoading:t,...a}){const r=(s==null?void 0:s.datasets[0].data)||[];return e.jsxs(Sn,{...a,className:"w-1/2 min-w-500 md:min-w-0",contentIsFlex:t,contentClassName:"max-h-[370px] overflow-y-auto compact-scrollbar",children:[t&&e.jsx(Et,{}),r.map(i=>e.jsxs("div",{className:"mb-20 flex items-center justify-between gap-24 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsx(f3,{model:i.model,size:"w-42 h-42",className:"flex-shrink-0 rounded"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm",children:e.jsx(b3,{model:i.model})}),e.jsx("div",{className:"text-xs text-muted",children:e.jsx(v3,{model:i.model})})]})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-4",children:[e.jsx(ei,{className:"text-muted",size:"sm"}),e.jsx(n,{message:":count plays",values:{count:e.jsx(Te,{value:i.value})}})]})]},i.model.id)),!t&&!r.length?e.jsxs("div",{className:"flex items-center gap-8 text-muted",children:[e.jsx(xo,{size:"sm"}),e.jsx(n,{message:"No plays in selected timeframe."})]}):null]})}function f3({model:s,size:t,className:a}){const r=`/admin/${s.model_type}s/${s.id}`;switch(s.model_type){case"title":return e.jsx(Rs,{title:s,size:t,srcSize:"sm",className:a,link:`/admin/titles/${s.id}/insights`});case"season":return e.jsx(Ja,{season:s,title:s.title,size:t,srcSize:"sm",className:a,link:`/admin/titles/${s.title_id}/insights/seasons/${s.number}`});case"episode":return e.jsx(ni,{episode:s,title:s.title,size:t,srcSize:"sm",className:a,link:`/admin/titles/${s.title_id}/insights/seasons/${s.season_number}/episodes/${s.episode_number}`});case"video":return s.thumbnail?e.jsx(F,{to:r,className:w(t,a),children:e.jsx("img",{src:s.thumbnail,className:"h-full w-full",alt:""})}):e.jsx(Rs,{title:s.title,size:t,srcSize:"sm",className:a,link:`/admin/videos/${s.id}/insights`});case"user":return e.jsx(Qa,{user:s,size:t,className:a})}}function b3({model:s}){switch(s.model_type){case"title":return e.jsx(rs,{title:s,target:"_blank"});case"season":return e.jsx(Ya,{title:s.title,seasonNumber:s.number,target:"_blank"});case"episode":return e.jsx(ri,{title:s.title,episode:s,seasonNumber:s.season_number,target:"_blank"});case"video":return e.jsx(F,{to:mt(s),className:"hover:underline",target:"_blank",children:s.name});case"user":return s.id?e.jsx(dd,{user:s,target:"_blank"}):e.jsx(m.Fragment,{children:s.display_name})}}function v3({model:s}){switch(s.model_type){case"title":return e.jsx("span",{children:s.year});case"season":return e.jsx(rs,{title:s.title,target:"_blank"});case"episode":return e.jsx(rs,{title:s.title,target:"_blank"});case"user":return null;case"video":return e.jsx(rs,{title:s.title,target:"_blank"})}}function y3(){return e.jsx(ss,{metric:"series",children:e.jsx(Zs,{title:e.jsx(n,{message:"Most played series"})})})}function C3(){return e.jsx(ss,{metric:"movies",children:e.jsx(Zs,{title:e.jsx(n,{message:"Most played movies"})})})}function w3(){return e.jsx(ss,{metric:"videos",children:e.jsx(Zs,{title:e.jsx(n,{message:"Most played videos"})})})}function S3(){return e.jsx(ss,{metric:"users",children:e.jsx(Zs,{title:e.jsx(n,{message:"Top users"})})})}function Ct(){return e.jsx(ss,{metric:"locations",children:e.jsx(oo,{className:"flex-auto w-1/2 lg:max-w-[740px]"})})}function wt(){return e.jsx(ss,{metric:"platforms",children:e.jsx(Ln,{className:"max-w-500",title:e.jsx(n,{message:"Top platforms"})})})}function xr(){const{dateRange:s}=Me(),t="video_play=0";return e.jsxs(_n.Provider,{value:{dateRange:s,model:t},children:[e.jsxs(Pe,{children:[e.jsx(vt,{}),e.jsx(yt,{})]}),e.jsxs(Pe,{children:[e.jsx(y3,{}),e.jsx(C3,{})]}),e.jsxs(Pe,{children:[e.jsx(w3,{}),e.jsx(S3,{})]}),e.jsxs(Pe,{children:[e.jsx(Ct,{}),e.jsx(wt,{})]})]})}function N3(){const{dateRange:s}=Me(),{data:t,isLoading:a,isPlaceholderData:r}=mo({types:["visitors"],dateRange:s});return e.jsx(r3,{isLoading:a||r,report:t==null?void 0:t.visitorsReport})}function la({children:s,reportModel:t,title:a,name:r,backLink:i}){const[l,o]=m.useState(()=>Ba[2].getRangeValue());return e.jsxs(m.Fragment,{children:[e.jsx(cs,{children:e.jsx(n,{message:":name insights",values:{name:r}})}),e.jsx("div",{className:"h-full flex flex-col",children:e.jsx("div",{className:"flex-auto bg-cover relative",children:e.jsx("div",{className:"min-h-full p-12 md:p-24 overflow-x-hidden max-w-[1600px] mx-auto flex flex-col",children:e.jsxs("div",{className:"flex-auto",children:[e.jsxs("div",{className:"md:flex items-center gap-12 h-48 mt-14 mb-38",children:[e.jsx(C,{elementType:F,to:i||"../../",relative:"path",className:"text-muted",children:e.jsx(qs,{})}),a,e.jsx("div",{className:"ml-auto flex-shrink-0 flex items-center justify-between gap-10 md:gap-24",children:e.jsx(io,{value:l,onChange:o})})]}),e.jsx(_n.Provider,{value:{dateRange:l,model:t},children:s})]})})})})]})}function oa({image:s,name:t,description:a}){return e.jsxs("div",{className:"flex items-center gap-10",children:[m.cloneElement(s,{size:"w-48 h-48",className:"rounded"}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-base whitespace-nowrap overflow-hidden overflow-ellipsis",children:["“",t,"“ ",e.jsx(n,{message:"insights"})]}),a&&e.jsx("div",{className:"text-muted text-sm",children:a})]})]})}function k3(){return e.jsx(ss,{metric:"seasons",children:e.jsx(Zs,{title:e.jsx(n,{message:"Most played seasons"})})})}function L3(){return e.jsx(ss,{metric:"episodes",children:e.jsx(Zs,{title:e.jsx(n,{message:"Most played episodes"})})})}function _3(){const{titleId:s}=V(),t=Kr("title");return t.data?e.jsxs(la,{reportModel:`title=${s}`,name:t.data.title.name,title:e.jsx(oa,{image:e.jsx(Rs,{title:t.data.title,srcSize:"sm"}),name:e.jsx(rs,{title:t.data.title}),description:e.jsx("span",{children:t.data.title.year})}),children:[e.jsxs(Pe,{children:[e.jsx(vt,{}),e.jsx(yt,{})]}),e.jsxs(Pe,{children:[e.jsx(k3,{}),e.jsx(L3,{})]}),e.jsxs(Pe,{children:[e.jsx(Ct,{}),e.jsx(wt,{})]})]}):e.jsx(ys,{query:t,loaderClassName:"absolute inset-0 m-auto"})}function M3(){const s=ti("episode");return s.data?e.jsxs(la,{reportModel:`episode=${s.data.episode.id}`,name:s.data.episode.name,backLink:"../../../../",title:e.jsx(oa,{image:e.jsx(ni,{episode:s.data.episode,title:s.data.title,srcSize:"sm"}),name:e.jsx(ri,{episode:s.data.episode,title:s.data.title,seasonNumber:s.data.episode.season_number}),description:e.jsx(ud,{episode:s.data.episode,title:s.data.title})}),children:[e.jsxs(Pe,{children:[e.jsx(vt,{}),e.jsx(yt,{})]}),e.jsxs(Pe,{children:[e.jsx(Ct,{}),e.jsx(wt,{})]})]}):e.jsx(ys,{query:s,loaderClassName:"absolute inset-0 m-auto"})}function I3(){const s=Qr("season");return s.data?e.jsxs(la,{reportModel:`season=${s.data.season.id}`,name:`Season ${s.data.season.number}`,title:e.jsx(oa,{image:e.jsx(Ja,{season:s.data.season,title:s.data.title,srcSize:"sm"}),name:e.jsx(Ya,{seasonNumber:s.data.season.number,title:s.data.title}),description:e.jsx(rs,{title:s.data.title})}),children:[e.jsxs(Pe,{children:[e.jsx(vt,{}),e.jsx(yt,{})]}),e.jsxs(Pe,{children:[e.jsx(Ct,{}),e.jsx(wt,{})]})]}):e.jsx(ys,{query:s,loaderClassName:"absolute inset-0 m-auto"})}function F3(){var a;const s=Kl(),t=(a=s.data)==null?void 0:a.video;return t?e.jsxs(la,{reportModel:`video=${t.id}`,name:t.name,title:e.jsx(oa,{image:e.jsx(si,{video:t,srcSize:"sm"}),name:e.jsx(F,{to:mt(t),className:"hover:underline",target:"_blank",children:t.name}),description:e.jsx(rs,{title:t.title})}),children:[e.jsxs(Pe,{children:[e.jsx(vt,{}),e.jsx(yt,{})]}),e.jsxs(Pe,{children:[e.jsx(Ct,{}),e.jsx(wt,{})]})]}):e.jsx(ys,{query:s,loaderClassName:"absolute inset-0 m-auto"})}const P3=[{path:"/",element:e.jsx(x3,{}),children:[{index:!0,element:e.jsx(xr,{})},{path:"plays",element:e.jsx(xr,{})},{path:"visitors",element:e.jsx(N3,{})}]},{path:"channels",element:e.jsx(R5,{})},{path:"channels/new",element:e.jsx(lj,{})},{path:"channels/:slugOrId/edit",element:e.jsx(tj,{})},{path:"lists",element:e.jsx(Of,{})},{path:"lists/new",element:e.jsx(md,{})},{path:"lists/:slugOrId/edit",element:e.jsx(xd,{})},{path:"people",element:e.jsx(b2,{})},{path:"people/new",element:e.jsx(S2,{})},{path:"people/:personId/edit",element:e.jsx(L2,{}),children:[{index:!0,element:e.jsx(zs,{to:"primary-facts",replace:!0})},{path:"primary-facts",element:e.jsx(no,{})},{path:"credits",element:e.jsx(P2,{})}]},{path:"titles",element:e.jsx(T1,{})},{path:"titles/new",element:e.jsx(ga,{})},{path:"videos/:videoId/insights",element:e.jsx(F3,{})},{path:"titles/:titleId/insights",element:e.jsx(_3,{})},{path:"titles/:titleId/insights/seasons/:season",element:e.jsx(I3,{})},{path:"titles/:titleId/insights/seasons/:season/episodes/:episode",element:e.jsx(M3,{})},{path:"titles/:titleId/edit",element:e.jsx(zs,{to:"primary-facts",replace:!0})},{path:"titles/:titleId/edit",element:e.jsx(D1,{}),children:[{index:!0,element:e.jsx(ga,{})},{path:"primary-facts",element:e.jsx(ga,{})},{path:"reviews",element:e.jsx(o4,{})},{path:"comments",element:e.jsx(g2,{})},{path:"images",element:e.jsx(h4,{})},{path:"genres",element:e.jsx(fa,{type:et})},{path:"keywords",element:e.jsx(fa,{type:ks})},{path:"countries",element:e.jsx(fa,{type:Jt})},{path:"cast",element:e.jsx(X4,{})},{path:"crew",element:e.jsx(t2,{})},{path:"videos",element:e.jsx(ja,{})},{path:"videos/seasons/:season",element:e.jsx(ja,{})},{path:"videos/seasons/:season/episodes/:episode",element:e.jsx(ja,{})},{path:"seasons",element:e.jsx(J1,{})},{path:"seasons/:season",children:[{index:!0,element:e.jsx(zs,{to:"episodes",replace:!0})},{path:"Episodes",element:e.jsx(O1,{})},{path:"cast",element:e.jsx(a2,{})},{path:"crew",element:e.jsx(n2,{})}]},{path:"seasons/:season/episodes/new",element:e.jsx(rr,{})},{path:"seasons/:season/episodes/:episode",children:[{index:!0,element:e.jsx(zs,{to:"primary-facts",replace:!0})},{path:"primary-facts",element:e.jsx(rr,{})},{path:"cast",element:e.jsx(Y4,{})},{path:"crew",element:e.jsx(r2,{})}]}]},{path:"titles/:titleId/edit/videos/new",element:e.jsx(kt,{})},{path:"titles/:titleId/edit/videos/edit/:videoId",element:e.jsx(Lt,{})},{path:"titles/:titleId/edit/videos/seasons/:season/new",element:e.jsx(kt,{})},{path:"titles/:titleId/edit/videos/seasons/:season/edit/:videoId",element:e.jsx(Lt,{})},{path:"titles/:titleId/edit/videos/seasons/:season/episodes/:episode/new",element:e.jsx(kt,{})},{path:"titles/:titleId/edit/videos/seasons/:season/episodes/:episode/edit/:videoId",element:e.jsx(Lt,{})},{path:"news",element:e.jsx(jj,{})},{path:"news/add",element:e.jsx(ie,{permission:"news.update",children:e.jsx(Ff,{})})},{path:"news/:articleId/edit",element:e.jsx(ie,{permission:"news.update",children:e.jsx(kf,{})})},{path:"comments",element:e.jsx(Al,{})},{path:"reviews",element:e.jsx(Rl,{})},{path:"videos",element:e.jsx(Bj,{})},{path:"videos/new",element:e.jsx(kt,{})},{path:"videos/:videoId/edit",element:e.jsx(Lt,{})},{path:"keywords",element:e.jsx(or,{type:ks})},{path:"genres",element:e.jsx(or,{type:et})}];function T3(s){const{pageId:t}=V(),a=`${s||"custom-pages"}/${t}`;return I({mutationFn:r=>E3(r,a),onError:r=>q(r),onSuccess:async()=>{await _.invalidateQueries({queryKey:["custom-pages"]}),await _.invalidateQueries({queryKey:J(a)}),M(d("Page updated"))}})}function E3(s,t){return S.put(`${t}`,s).then(a=>a.data)}const z3=B.lazy(()=>fs(()=>import("./article-body-editor-9fa9dbcf.js"),["./article-body-editor-9fa9dbcf.js","./main-239552ae.js","./main-3987dbef.css","./linkify.es-ff711e62.js","./c-ea92d14f.js","./article-body-editor-c0ff5600.css"],import.meta.url));function D3(){const s=nc();return s.data?e.jsxs(m.Fragment,{children:[e.jsx(Ua,{query:s}),e.jsx(A3,{page:s.data.page})]}):e.jsx("div",{className:"relative w-full h-full",children:e.jsx(ys,{query:s})})}function A3({page:s}){const t=Y(),a=T3(),r=O({defaultValues:{title:s.title,slug:s.slug,body:s.body}}),i=l=>{a.mutate({...r.getValues(),body:l},{onSuccess:()=>t("../..",{relative:"path"})})};return e.jsx(m.Suspense,{fallback:e.jsx(_e,{}),children:e.jsx(z3,{initialContent:s.body,children:(l,o)=>e.jsx(we,{children:e.jsxs(Ht,{...r,children:[e.jsx(ia,{editor:o,backLink:"../..",isLoading:a.isPending,onSave:i}),e.jsx("div",{className:"mx-20",children:e.jsxs("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[e.jsx(ra,{}),l]})})]})})})})}function $3(s){const t=s||"custom-pages";return I({mutationFn:a=>R3(a,t),onError:a=>q(a),onSuccess:async()=>{await _.invalidateQueries({queryKey:["custom-pages"]}),await _.invalidateQueries({queryKey:J(t)}),M(d("Page created"))}})}function R3(s,t){return S.post(`${t}`,s).then(a=>a.data)}const V3=B.lazy(()=>fs(()=>import("./article-body-editor-9fa9dbcf.js"),["./article-body-editor-9fa9dbcf.js","./main-239552ae.js","./main-3987dbef.css","./linkify.es-ff711e62.js","./c-ea92d14f.js","./article-body-editor-c0ff5600.css"],import.meta.url));function q3(){const s=Y(),t=$3(),a=O(),r=i=>{t.mutate({...a.getValues(),body:i},{onSuccess:()=>s("../",{relative:"path"})})};return e.jsx(m.Suspense,{fallback:e.jsx(_e,{}),children:e.jsx(V3,{children:(i,l)=>e.jsx(we,{children:e.jsxs(Ht,{...a,children:[e.jsx(ia,{editor:l,isLoading:t.isPending,onSave:r,backLink:"../"}),e.jsx("div",{className:"mx-20",children:e.jsxs("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[e.jsx(ra,{}),i]})})]})})})})}const O3=""+new URL("font-a5a81d1a.svg",import.meta.url).href;function U3({state:{filters:s,setFilters:t}}){const{trans:a}=z();return e.jsxs("div",{className:"mb-24 items-center gap-24 @xs:flex",children:[e.jsx(Be,{className:"mb-12 flex-auto @xs:mb-0",value:s.query,onChange:r=>{t({...s,query:r.target.value})},startAdornment:e.jsx(it,{}),placeholder:a(d("Search fonts"))}),e.jsxs(Ye,{className:"flex-auto",selectionMode:"single",selectedValue:s.category,onSelectionChange:r=>{t({...s,category:r})},children:[e.jsx(h,{value:"",children:e.jsx(n,{message:"All categories"})}),e.jsx(h,{value:"serif",children:e.jsx(n,{message:"Serif"})}),e.jsx(h,{value:"sans-serif",children:e.jsx(n,{message:"Sans serif"})}),e.jsx(h,{value:"display",children:e.jsx(n,{message:"Display"})}),e.jsx(h,{value:"handwriting",children:e.jsx(n,{message:"Handwriting"})}),e.jsx(h,{value:"monospace",children:e.jsx(n,{message:"Monospace"})})]})]})}function B3(s){const t=rc({usage:"search",...s});return{startsWith(a,r){return r.length===0?!0:(a=a.normalize("NFC"),r=r.normalize("NFC"),t.compare(a.slice(0,r.length),r)===0)},endsWith(a,r){return r.length===0?!0:(a=a.normalize("NFC"),r=r.normalize("NFC"),t.compare(a.slice(-r.length),r)===0)},contains(a,r){if(r.length===0)return!0;a=a.normalize("NFC"),r=r.normalize("NFC");let i=0;const l=r.length;for(;i+l<=a.length;i++){const o=a.slice(i,i+l);if(t.compare(r,o)===0)return!0}return!1}}}const H3=[{label:d("System"),family:'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',category:"sans-serif"},{family:"Impact, Charcoal, sans-serif",category:"sans-serif"},{family:"Arial, Helvetica Neue, Helvetica, sans-serif",category:"serif"},{family:'"Comic Sans MS", cursive, sans-serif',category:"Handwriting"},{family:"Century Gothic, sans-serif",category:"sans-serif"},{family:'"Courier New", Courier, monospace',category:"monospace"},{family:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',category:"sans-serif"},{family:'"Times New Roman", Times, serif',category:"serif"},{family:'"Lucida Console", Monaco, monospace',category:"monospace"},{family:'"Andele Mono", monospace, sans-serif',category:"sans-serif"},{family:"Verdana, Geneva, sans-serif",category:"sans-serif"},{family:'"Helvetica Neue", Helvetica, Arial, sans-serif',category:"sans-serif"}];function Z3({value:s,onChange:t}){const{data:a,isLoading:r}=le(["googleFonts"]),[i,l]=m.useState(0),[o,c]=m.useState({query:"",category:(s==null?void 0:s.category)??""}),{contains:u}=B3({sensitivity:"base"}),x=m.useCallback(N=>{c(N),l(0)},[]),g=m.useMemo(()=>H3.concat((a==null?void 0:a.googleFonts)??[]),[a==null?void 0:a.googleFonts]),j=m.useMemo(()=>g.filter(N=>{var y;return u(N.family,o.query)&&(!o.category||((y=N.category)==null?void 0:y.toLowerCase())===o.category.toLowerCase())}),[g,o,u]),v=m.useMemo(()=>xi(j,20),[j]),f=v[i];return m.useEffect(()=>{const N="font-selector";f!=null&&f.length&&ic(f,{id:N})},[f,i]),{fonts:f||[],currentPage:i,filteredFonts:j||[],setCurrentPage:l,isLoading:r,filters:o,setFilters:x,value:s,onChange:t,pages:v}}function K3({state:{currentPage:s=0,setCurrentPage:t,filteredFonts:a,pages:r}}){const i=(a==null?void 0:a.length)||0;return e.jsxs("div",{className:"flex items-center justify-end gap-24 text-sm mt-30 pt-14 border-t",children:[i>0&&e.jsx("div",{children:e.jsx(n,{message:":from - :to of :total",values:{from:s*20+1,to:Math.min((s+1)*20,i),total:i}})}),e.jsxs("div",{className:"text-muted",children:[e.jsx(C,{disabled:s<1,onClick:()=>{t(Math.max(0,s-1))},children:e.jsx(zt,{})}),e.jsx(C,{disabled:s>=r.length-1,onClick:()=>{t(s+1)},children:e.jsx(ct,{})})]})]})}function W3(s){const t=Z3(s);return e.jsxs("div",{className:s.className,children:[e.jsx(U3,{state:t}),e.jsx(Oe,{initial:!1,mode:"wait",children:e.jsx(Q3,{state:t})}),e.jsx(K3,{state:t})]})}function Q3({state:s}){const{isLoading:t,fonts:a}=s,r="grid gap-24 grid-cols-[repeat(auto-fill,minmax(90px,1fr))] items-start";return t?e.jsx(J3,{className:r}):a!=null&&a.length?e.jsx(De.div,{...Je,className:r,children:a==null?void 0:a.map(i=>e.jsx(G3,{font:i,state:s},i.family))},"font-list"):e.jsx(He,{className:"mt-60",size:"sm",image:e.jsx(At,{src:O3}),title:e.jsx(n,{message:"No matching fonts"}),description:e.jsx(n,{message:"Try another search query or different category"})})}function G3({font:s,state:{value:t,onChange:a}}){const r=(t==null?void 0:t.family)===s.family,i=s.family.split(",")[0].replace(/"/g,"");return e.jsxs(Vt,{display:"block",onClick:()=>{a(s)},children:[e.jsx("span",{className:w("flex aspect-square items-center justify-center rounded-panel border text-4xl transition-bg-color hover:bg-hover md:text-5xl",r&&"ring-2 ring-primary ring-offset-2"),children:e.jsx("span",{style:{fontFamily:s.family},children:"Aa"})}),e.jsx("span",{className:w("mt-6 block overflow-hidden overflow-ellipsis whitespace-nowrap text-sm",r&&"text-primary"),children:s.label?e.jsx(n,{...s.label}):i})]},s.family)}function J3({className:s}){const t=Array.from(Array(20).keys());return e.jsx(De.div,{...Je,className:s,children:t.map(a=>e.jsxs("div",{children:[e.jsx("div",{className:"aspect-square",children:e.jsx(ls,{display:"block",variant:"rect"})}),e.jsx(ls,{className:"mt-6 text-sm"})]},a))},"font-list-skeleton")}function Y3(){const{setValue:s,watch:t}=P(),{themeIndex:a}=V(),r=`appearance.themes.all.${a}.font`;return e.jsx(W3,{value:t(r),onChange:i=>{s(r,i,{shouldDirty:!0}),Z().preview.setThemeFont(i)}})}const X3={"rounded-none":{label:d("Square"),value:"0px"},rounded:{label:d("Small"),value:"0.25rem"},"rounded-md":{label:d("Medium"),value:"0.375rem"},"rounded-lg":{label:d("Large"),value:"0.5rem"},"rounded-xl":{label:d("Larger"),value:"0.75rem"},"rounded-full":{label:d("Pill"),value:"9999px"}};function eb(){return e.jsxs("div",{className:"space-y-24",children:[e.jsx(ba,{label:e.jsx(n,{message:"Button rounding"}),name:"button-radius"}),e.jsx(ba,{label:e.jsx(n,{message:"Input rounding"}),name:"input-radius"}),e.jsx(ba,{label:e.jsx(n,{message:"Panel rounding"}),name:"panel-radius",hidePill:!0})]})}function ba({label:s,name:t,hidePill:a}){const{themeIndex:r}=V(),{watch:i,setValue:l}=P(),o=`appearance.themes.all.${r}.values.--be-${t}`,c=i(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(X3).filter(([u])=>!a||!u.includes("full")).map(([u,{label:x,value:g}])=>e.jsx(sb,{radius:u,isActive:g===c,onClick:()=>{l(o,g,{shouldDirty:!0})},children:e.jsx(n,{...x})},u))})]})}function sb({radius:s,children:t,isActive:a,onClick:r}){return e.jsx(Vt,{display:"block",className:w("h-36 border-2 hover:bg-hover",s,a&&"border-primary"),onClick:r,children:t})}const hr=["schedule","error","outgoing-email"];function tb(){const{pathname:s}=bs(),t=s.split("/").pop(),a=hr.includes(t)?hr.indexOf(t):0;return e.jsxs(ws,{className:"p-12 md:p-24",selectedTab:a,children:[e.jsxs(Ss,{children:[e.jsx(fe,{elementType:F,to:"/admin/logs/schedule",replace:!0,children:e.jsx(n,{message:"Schedule"})}),e.jsx(fe,{elementType:F,to:"/admin/logs/error",replace:!0,children:e.jsx(n,{message:"Error"})}),e.jsx(fe,{elementType:F,to:"/admin/logs/outgoing-email",replace:!0,children:e.jsx(n,{message:"Email"})})]}),e.jsx(Ms,{})]})}function ho(){const{trans:s}=z();return I({mutationFn:t=>ab(t),onSuccess:async(t,a)=>{await _.invalidateQueries({queryKey:J("logs/schedule")}),M.positive(s(d("Command reran")))},onError:t=>q(t)})}function ab({id:s}){return S.post(`logs/schedule/rerun/${s}`).then(t=>t.data)}const nb=T(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"),rb=[{key:"command",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Name"}),body:s=>e.jsx(us,{label:s.command,description:s.output})},{key:"ran_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Ran at"}),body:s=>e.jsx(ot,{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(Vl,{value:s.exit_code===0})},{key:"count_in_last_hour",allowsSorting:!0,header:()=>e.jsx(n,{message:"Runs recently"}),body:s=>e.jsx(Te,{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(ib,{item:s})}];function ib({item:s}){const t=ho();return e.jsx(W,{label:e.jsx(n,{message:"Rerun now"}),children:e.jsx(C,{size:"md",className:"text-muted",disabled:t.isPending,onClick:()=>{t.mutate({id:s.id})},children:e.jsx(nb,{})})})}const lb=""+new URL("timeline-172fbeee.svg",import.meta.url).href,Mn=T(e.jsx("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"}),"DownloadOutlined");function gr(){return e.jsx(he,{padding:"pt-12 md:pt-24",endpoint:"logs/schedule",title:e.jsx(n,{message:"CRON schedule log"}),columns:rb,actions:e.jsx(ob,{}),enableSelection:!1,emptyStateMessage:e.jsx(oe,{image:lb,title:e.jsx(n,{message:"No scheduled commands have ran yet"}),filteringTitle:e.jsx(n,{message:"No matching scheduled commands"})})})}function ob(){return e.jsx(je,{elementType:"a",href:"api/v1/logs/schedule/download",download:!0,icon:e.jsx(Mn,{}),children:e.jsx(n,{message:"Download log"})})}const cb=""+new URL("bug-fixing-bd601a66.svg",import.meta.url).href,db=[{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(ot,{date:s.datetime})},{key:"severity",header:()=>e.jsx(n,{message:"Severity"}),body:s=>e.jsxs("span",{className:w("flex items-center gap-6 text-xs capitalize",s.level==="error"?"text-danger":"text-primary"),children:[s.level==="error"?e.jsx(fr,{size:"sm"}):e.jsx(xo,{size:"sm"}),s.level]})}];function ub({error:s}){return e.jsxs(G,{size:"fullscreen",children:[e.jsx(se,{showDivider:!0,padding:"px-24 py-10",actions:e.jsx(b,{variant:"outline",size:"xs",onClick:()=>mb(s),children:e.jsx(n,{message:"Download"})}),children:e.jsx(n,{message:"Error details"})}),e.jsx(X,{children:e.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-5",children:s.exception})})]})}function mb(s){const t=document.createElement("a");t.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(s.exception)),t.setAttribute("download",`error-${s.id}.log`),t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)}function xb(){const{trans:s}=z();return I({mutationFn:t=>hb(t),onSuccess:async()=>{await _.invalidateQueries({queryKey:J("logs/error")}),M(s(d("Log file deleted")))},onError:t=>q(t)})}function hb({identifier:s}){return S.delete(`logs/error/${s}`).then(t=>t.data)}function gb(){return e.jsx(he,{padding:"pt-12 md:pt-24",endpoint:"logs/error",title:e.jsx(n,{message:"Error log"}),onRowAction:s=>{$s(ub,{error:s})},columns:db,actions:e.jsx(pb,{}),enableSelection:!1,emptyStateMessage:e.jsx(oe,{image:cb,title:e.jsx(n,{message:"No errors have been logged yet"}),filteringTitle:e.jsx(n,{message:"No matching error log entries"})})})}function pb(){var l,o,c;const{query:s,setParams:t}=xt(),a=m.useRef(!1),[r,i]=m.useState(null);return m.useEffect(()=>{var u,x;if((x=(u=s.data)==null?void 0:u.files)!=null&&x.length&&!a.current){a.current=!0;const g=s.data.files[0].identifier;i(s.data.files[0].identifier),g!==s.data.selectedFile&&t({file:s.data.files[0].identifier})}},[s.data,t,a]),e.jsxs(m.Fragment,{children:[e.jsx(jb,{files:((l=s.data)==null?void 0:l.files)??null,selectedFile:r,onSelected:u=>{i(u.identifier),t({file:u.identifier})}}),e.jsx(b,{variant:"outline",color:"danger",disabled:!r,onClick:()=>$s(fb,{identifier:r}),children:e.jsx(n,{message:"Delete"})}),r&&e.jsx(je,{elementType:"a",download:(c=(o=s.data)==null?void 0:o.files.find(u=>u.identifier===r))==null?void 0:c.name,href:`api/v1/logs/error/${r}/download`,icon:e.jsx(Mn,{}),children:e.jsx(n,{message:"Download log"})})]})}function jb({files:s,selectedFile:t,onSelected:a}){return s?s.length?e.jsx(Ye,{selectionMode:"single",selectedValue:t,size:"sm",minWidth:"min-w-[210px]",children:s==null?void 0:s.map(r=>e.jsxs(h,{value:r.identifier,onSelected:()=>a(r),children:[r.name," (",e.jsx(jn,{bytes:r.size}),")"]},r.identifier))}):null:e.jsx(ls,{variant:"rect",className:"max-w-[210px]"})}function fb({identifier:s}){const t=xb();return e.jsx(ce,{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:()=>t.mutate({identifier:s},{onSuccess:()=>lc()}),isLoading:t.isPending,isDanger:!0})}const bb=""+new URL("opened-4dded9dc.svg",import.meta.url).href;function vb(s){return be({queryKey:["logs/outgoing-email",s],queryFn:()=>yb(s)})}function yb(s){return S.get(`logs/outgoing-email/${s}`).then(t=>t.data)}function Cb({logItemId:s}){const{data:t}=vb(s),{base_url:a}=ue();return e.jsxs(G,{size:"fullscreen",children:[e.jsx(se,{showDivider:!0,padding:"px-24 py-10",actions:e.jsx(b,{variant:"outline",size:"xs",disabled:!t,type:"button",onClick:t?()=>Ls(`${a}/api/v1/logs/outgoing-email/${s}/download`):void 0,children:e.jsx(n,{message:"Download"})}),children:e.jsx(n,{message:"Email preview"})}),e.jsx(X,{children:t?e.jsx("iframe",{srcDoc:t.logItem.parsed_message.body.html,className:"h-max w-full border-none",onLoad:r=>{const i=r.target;i.style.height=i.contentWindow.document.body.scrollHeight+"px"}}):e.jsx("div",{className:"flex min-h-200 items-center justify-center",children:e.jsx(ds,{isIndeterminate:!0})})})]})}const wb=[{key:"message_id",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Subject"}),body:s=>e.jsx(us,{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(va,{color:"positive",children:e.jsx(n,{message:"Sent"})});case"not-sent":return e.jsx(va,{color:void 0,children:e.jsx(n,{message:"Not sent"})});case"error":return e.jsx(va,{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(ot,{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(Sb,{item:s})}];function Sb({item:s}){const t=ho();return e.jsxs(A,{type:"modal",children:[e.jsx(W,{label:e.jsx(n,{message:"Preview"}),children:e.jsx(C,{size:"md",className:"text-muted",disabled:t.isPending,onClick:()=>{t.mutate({id:s.id})},children:e.jsx(fl,{})})}),e.jsx(Cb,{logItemId:s.id})]})}function va({color:s,children:t}){return e.jsx(Rt,{color:s,size:"xs",className:"w-max min-w-50 text-center",children:t})}const Nb=[{key:"status",label:d("Status"),description:d("Status of the outgoing email"),defaultOperator:R.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("Not sent"),value:"no-sent"},{key:"02",label:d("Sent"),value:"sent"},{key:"03",label:d("Error"),value:"error"}]}},Se({description:d("Date email send was attempted")})];function kb(){return e.jsx(he,{padding:"pt-12 md:pt-24",endpoint:"logs/outgoing-email",title:e.jsx(n,{message:"Outgoing email"}),columns:wb,filters:Nb,actions:e.jsx(Lb,{}),enableSelection:!1,emptyStateMessage:e.jsx(oe,{image:bb,title:e.jsx(n,{message:"No outgoing emails have been logged yet"}),filteringTitle:e.jsx(n,{message:"No matching emails"})})})}function Lb(){return e.jsx(je,{elementType:"a",href:"api/v1/logs/outgoing-email/download",download:!0,icon:e.jsx(Mn,{}),children:e.jsx(n,{message:"Download log"})})}const _b=B.lazy(()=>fs(()=>import("./admin-report-page-632b991d.js"),["./admin-report-page-632b991d.js","./main-239552ae.js","./main-3987dbef.css","./user-profile-link-0c8224d9.js","./OpenInNew-32d7773a.js","./section-helper-79a95256.js"],import.meta.url)),Mb=[{path:"appearance",element:e.jsx(ie,{permission:"appearance.update",children:e.jsx(nm,{})}),children:[{index:!0,element:e.jsx(Ng,{})},{path:"general",element:e.jsx(vm,{})},{path:"seo-settings",element:e.jsx(Im,{})},{path:"custom-code",element:e.jsx(Tm,{})},{path:"themes",element:e.jsx(Sm,{})},{path:"themes/:themeIndex",element:e.jsx(ox,{})},{path:"themes/:themeIndex/font",element:e.jsx(Y3,{})},{path:"themes/:themeIndex/radius",element:e.jsx(eb,{})},{path:"menus",element:e.jsx(om,{})},{path:"menus/:menuIndex",element:e.jsx(mm,{})},{path:"menus/:menuIndex/items/:menuItemIndex",element:e.jsx(jm,{})},...Object.values(tl.sections).flatMap(s=>s.routes||[])]},{path:"/",element:e.jsx(Nd,{}),children:[...P3,{path:"/",element:e.jsx(B.Suspense,{fallback:e.jsx(_e,{screen:!0}),children:e.jsx(_b,{})})},{path:"users",element:e.jsx(ie,{permission:"users.update",children:e.jsx(Qd,{})})},{path:"users/new",element:e.jsx(ie,{permission:"users.update",children:e.jsx(Uh,{})})},{path:"users/:userId/edit",element:e.jsx(ie,{permission:"users.update",children:e.jsx(Rh,{})})},{path:"roles",element:e.jsx(ie,{permission:"roles.update",children:e.jsx(_g,{})})},{path:"roles/new",element:e.jsx(ie,{permission:"roles.update",children:e.jsx(Gg,{})})},{path:"roles/:roleId/edit",element:e.jsx(ie,{permission:"roles.update",children:e.jsx(Hg,{})})},{path:"subscriptions",element:e.jsx(ie,{permission:"subscriptions.update",children:e.jsx(Yp,{})})},{path:"plans",element:e.jsx(ie,{permission:"plans.update",children:e.jsx(m5,{})})},{path:"plans/new",element:e.jsx(ie,{permission:"plans.update",children:e.jsx(_5,{})})},{path:"plans/:productId/edit",element:e.jsx(ie,{permission:"plans.update",children:e.jsx(S5,{})})},{path:"custom-pages",element:e.jsx(ie,{permission:"custom_pages.update",children:e.jsx(Am,{})})},{path:"custom-pages/new",element:e.jsx(ie,{permission:"custom_pages.update",children:e.jsx(q3,{})})},{path:"custom-pages/:pageId/edit",element:e.jsx(ie,{permission:"custom_pages.update",children:e.jsx(D3,{})})},{path:"tags",element:e.jsx(ie,{permission:"tags.update",children:e.jsx(rp,{})})},{path:"localizations",element:e.jsx(ie,{permission:"localizations.update",children:e.jsx(sg,{})})},{path:"localizations/:localeId/translate",element:e.jsx(jg,{})},{path:"files",element:e.jsx(ie,{permission:"files.update",children:e.jsx(Vp,{})})},{path:"ads",element:e.jsx(ie,{permission:"settings.update",children:e.jsx(Cg,{})})},{path:"settings",element:e.jsx(ie,{permission:"settings.update",children:e.jsx(qm,{})}),children:[{index:!0,element:e.jsx(zs,{to:"general",replace:!0})},{path:"general",element:e.jsx(Jm,{})},{path:"subscriptions",element:e.jsx(zx,{})},{path:"localization",element:e.jsx($x,{})},{path:"authentication",element:e.jsx(Rx,{})},{path:"uploading",element:e.jsx(ah,{})},{path:"outgoing-email",element:e.jsx(fh,{})},{path:"cache",element:e.jsx(Ch,{})},{path:"analytics",element:e.jsx(Eh,{})},{path:"logging",element:e.jsx(Nh,{})},{path:"queue",element:e.jsx(Lh,{})},{path:"recaptcha",element:e.jsx(Ih,{})},{path:"gdpr",element:e.jsx(M5,{})},...Ex]},{path:"logs",element:e.jsx(ie,{permission:"logs.view",children:e.jsx(tb,{})}),children:[{index:!0,element:e.jsx(gr,{})},{path:"schedule",element:e.jsx(gr,{})},{path:"error",element:e.jsx(gb,{})},{path:"outgoing-email",element:e.jsx(kb,{})}]}]},{path:"*",element:e.jsx(cc,{})}];function Ib(){return oc(Mb)}const zb=Object.freeze(Object.defineProperty({__proto__:null,default:Ib},Symbol.toStringTag,{value:"Module"}));export{B3 as $,l3 as A,ql as B,ro as C,ej as D,nb as E,Ca as F,A2 as G,P5 as H,xo as I,$h as J,nx as K,xn as L,yd as M,tf as N,e1 as O,Qp as P,n5 as Q,io as R,af as S,Bh as T,Qf as U,r3 as V,i3 as W,Wf as X,D2 as Y,fl as Z,c4 as _,es as a,ca as a0,zb as a1,W5 as b,Mn as c,dm as d,mf as e,hf as f,uf as g,xf as h,V2 as i,Y2 as j,cf as k,of as l,pf as m,jf as n,q2 as o,B2 as p,H2 as q,O2 as r,ef as s,mi as t,mo as u,Gp as v,sf as w,sj as x,vn as y,to as z};
//# sourceMappingURL=admin-routes-cb411577.js.map