@isardsat/editorial-admin 6.12.2 → 6.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/client/assets/FilePicker-BOG-CiCh.js +1 -0
- package/build/client/assets/{dashboard._collection._document-CV_4Y66A.js → dashboard._collection._document-BvlZxhhi.js} +1 -1
- package/build/client/assets/{dashboard._collection.new-Dvx5O_Ty.js → dashboard._collection.new-DtiytHCL.js} +1 -1
- package/build/client/assets/{dashboard._layout-BVmYHqrw.js → dashboard._layout-CjR2E0jq.js} +1 -1
- package/build/client/assets/{dashboard.files-xlUtjOxw.js → dashboard.files-BE_bSAhV.js} +1 -1
- package/build/client/assets/{files-BFmouRir.js → files-Eirjo7Qj.js} +1 -1
- package/build/client/assets/{itemForm-B0XbAy-p.js → itemForm-B7lrEKSL.js} +2 -2
- package/build/client/assets/{manifest-7a3ee773.js → manifest-cc71d710.js} +1 -1
- package/build/client/assets/root-B-n-Uyca.css +1 -0
- package/build/client/index.html +2 -2
- package/package.json +2 -2
- package/build/client/assets/FilePicker-Cl1xE7Nb.js +0 -1
- package/build/client/assets/root--tn719HN.css +0 -1
- /package/build/client/assets/{root-CchL-zdR.js → root-s6t5WLEc.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as m,p as e,x as v}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{r as F,a as z}from"./utils-oJIM4U5n.js";import{a as C,F as M}from"./files-Eirjo7Qj.js";import{B as o}from"./button-CAQsSeJv.js";import{I as j}from"./input-BuAmKgZ9.js";import{E as B}from"./external-link-ERgO2SVI.js";import{c as E}from"./createLucideIcon-BvSqmaUO.js";import{X as u}from"./x-D6gZWaAR.js";import{U as I}from"./upload-DhJ5wU_H.js";import"./index-B-2LEQwB.js";import"./trash-UKLAaALv.js";import"./chevron-down-qxzqwz13.js";const L=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],U=E("pencil",L);function D({id:h,value:t,name:p,register:x,onChange:f}){const{isLoading:n}=F(),[w,c]=m.useState(!1),[i,l]=m.useState(null),d=s=>s?/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(s):!1,N=s=>{if(s===0)return"0 Bytes";const a=1024,r=["Bytes","KB","MB","GB"],g=Math.floor(Math.log(s)/Math.log(a));return Math.round(s/Math.pow(a,g)*100)/100+" "+r[g]},b=s=>{const a=new Image;a.onload=()=>{fetch(s).then(r=>r.blob()).then(r=>{l({width:a.width,height:a.height,size:r.size,format:r.type.split("/")[1]?.toUpperCase()||s.split(".").pop()?.toUpperCase(),name:s.split("/").pop()})}).catch(r=>{console.error("Error fetching image for size:",r),l({width:a.width,height:a.height,format:s.split(".").pop()?.toUpperCase(),name:s.split("/").pop()})})},a.onerror=r=>{console.error("Error loading image for metadata:",r),l({name:s.split("/").pop(),format:s.split(".").pop()?.toUpperCase()})},a.src=s};m.useEffect(()=>{t&&d(t)?b(t):l(null)},[t]);const y=()=>{f(""),l(null)},k=s=>{c(!1),f(s)};return e.jsxs(e.Fragment,{children:[t?e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"border rounded-lg p-4 bg-background",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"shrink-0",children:d(t)?e.jsx("div",{className:"w-32 h-24 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:t,alt:"Preview",className:"max-w-full max-h-full object-contain"})}):e.jsx("div",{className:"w-32 h-24 rounded border bg-muted flex items-center justify-center",children:e.jsx(C,{className:"w-12 h-12 text-muted-foreground"})})}),e.jsx("div",{className:"flex-1 min-w-0 space-y-2",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm truncate",children:i?.name||t.split("/").pop()}),d(t)&&i&&e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 mt-2 text-xs text-muted-foreground",children:[i.size&&e.jsx("span",{children:N(i.size)}),i.width&&i.height&&e.jsxs("span",{children:[i.width,"x",i.height]}),i.format&&e.jsx("span",{children:i.format})]})]}),e.jsxs("div",{children:[e.jsx(o,{type:"button",variant:"ghost",size:"icon",title:"Open File",className:"h-8 w-8 shrink-0 cursor-pointer",asChild:!0,children:e.jsx(v,{to:`/${t}`,target:"_blank",children:e.jsx(B,{className:"h-4 w-4"})})}),e.jsx(o,{type:"button",variant:"ghost",size:"icon",title:"Change File",className:"h-8 w-8 shrink-0 cursor-pointer",onClick:()=>c(!0),disabled:n,children:e.jsx(U,{className:"h-4 w-4"})}),e.jsx(o,{type:"button",variant:"ghost",size:"icon",title:"Remove File",className:"h-8 w-8 shrink-0 cursor-pointer",onClick:y,disabled:n,children:e.jsx(u,{className:"h-4 w-4"})})]})]})})]})}),e.jsx(j,{id:h,...x(p),type:"hidden",value:t})]}):e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative flex items-center flex-1",children:[e.jsx(o,{type:"button",variant:"outline",className:z("w-full h-24 border-2 border-dashed",n&&"opacity-50"),onClick:()=>c(!0),disabled:n,children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(I,{className:"h-8 w-8 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:n?"Loading...":"Click to select file"})]})}),e.jsx(j,{id:h,...x(p),type:"hidden",value:""})]})}),w&&e.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-950 p-4 rounded-lg shadow-lg max-w-2xl w-full max-h-[80vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h2",{className:"text-xl font-bold",children:"Select File"}),e.jsx(o,{onClick:()=>c(!1),children:e.jsx(u,{})})]}),e.jsx(M,{onChange:k})]})})]})}export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{w as n,p as i}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{I as c}from"./itemForm-
|
|
1
|
+
import{w as n,p as i}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{I as c}from"./itemForm-B7lrEKSL.js";import{l,o as p}from"./utils-oJIM4U5n.js";import"./button-CAQsSeJv.js";import"./index-B-2LEQwB.js";import"./schemas-DSUGmKgQ.js";import"./index-Cxe-PO-X.js";import"./index-DLIEpuwL.js";import"./createLucideIcon-BvSqmaUO.js";import"./input-BuAmKgZ9.js";import"./index-DgNySWwD.js";import"./tslib.es6-Dm3DwgL9.js";const S=n(function({params:s}){const{collectionId:t,documentId:o}=s,{data:e,isFetching:a}=l(t),{data:r,isFetching:m}=p({itemType:t,id:o});return!e||(a||m)?null:i.jsx("div",{className:"overflow-auto scrollbar-stable",children:i.jsx("div",{className:"flex p-4 gap-4",children:i.jsx(c,{itemType:t,fields:e.fields,data:r??void 0,isSingleton:e.singleton},`${t}-${o}`)})})});export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{w as r,p as t}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{I as s}from"./itemForm-
|
|
1
|
+
import{w as r,p as t}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{I as s}from"./itemForm-B7lrEKSL.js";import{l as m}from"./utils-oJIM4U5n.js";import"./button-CAQsSeJv.js";import"./index-B-2LEQwB.js";import"./schemas-DSUGmKgQ.js";import"./index-Cxe-PO-X.js";import"./index-DLIEpuwL.js";import"./createLucideIcon-BvSqmaUO.js";import"./input-BuAmKgZ9.js";import"./index-DgNySWwD.js";import"./tslib.es6-Dm3DwgL9.js";const v=r(function({params:i}){const{collectionId:e}=i,{data:o}=m(e);return o?t.jsx("div",{className:"overflow-auto",children:t.jsx("div",{className:"flex p-4 gap-4",children:t.jsx(s,{itemType:e,fields:o.fields,isNew:!0,isSingleton:o.singleton})})}):null});export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,a as r,x as N,y as X,v as he,z as xe,R as fe,w as be,O as me}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{u as ge,d as z,e as je}from"./authSlice-DyBWbN7g.js";import{a as l,b as P,d as ve,f as we,g as Ne,h as ye,u as Ce}from"./utils-oJIM4U5n.js";import{t as M}from"./index-CZSVchcX.js";import{R as Z,C as Y,a as J,T as ee,D as te,P as ae,O as se,u as Se}from"./index-DgNySWwD.js";import{X as ie}from"./x-D6gZWaAR.js";import{B as k}from"./button-CAQsSeJv.js";import{c as y}from"./createLucideIcon-BvSqmaUO.js";import{S as E,c as ke,u as _e}from"./index-B-2LEQwB.js";import{P as Me,u as Oe,c as ze,a as R,b as Pe,d as Ee,e as Re}from"./index-Cxe-PO-X.js";import{P as Ae,R as De,T as Ie,a as Te,C as Le,A as $e}from"./index-C0hImMcN.js";import{C as $}from"./chevron-down-qxzqwz13.js";import{A as Be,a as Ge}from"./arrow-up-C0I0e1Jt.js";import{L as He}from"./tslib.es6-Dm3DwgL9.js";import{U as Fe}from"./upload-DhJ5wU_H.js";import{E as Ve}from"./external-link-ERgO2SVI.js";import{L as Ke}from"./Loading-BkOvB9cm.js";import{C as Ue}from"./chevron-right-BFlMu-RJ.js";import"./index-DLIEpuwL.js";import"./index-B45LLRRA.js";const qe=[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]],We=y("blocks",qe);const Qe=[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]],Xe=y("files",Qe);const Ze=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Ye=y("grid-3x3",Ze);const Je=[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]],et=y("heart",Je);const tt=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],at=y("log-out",tt);const st=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],it=y("panel-left",st);const ot=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],nt=y("square",ot);function rt({...t}){return e.jsx(Z,{"data-slot":"dialog",...t})}function lt({...t}){return e.jsx(ae,{"data-slot":"dialog-portal",...t})}function dt({className:t,...a}){return e.jsx(se,{"data-slot":"dialog-overlay",className:l("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function ct({className:t,children:a,...i}){return e.jsxs(lt,{"data-slot":"dialog-portal",children:[e.jsx(dt,{}),e.jsxs(Y,{"data-slot":"dialog-content",className:l("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...i,children:[a,e.jsxs(J,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(ie,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ut({className:t,...a}){return e.jsx("div",{"data-slot":"dialog-header",className:l("flex flex-col gap-2 text-center sm:text-left",t),...a})}function pt({className:t,...a}){return e.jsx("div",{"data-slot":"dialog-footer",className:l("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function ht({className:t,...a}){return e.jsx(ee,{"data-slot":"dialog-title",className:l("text-lg leading-none font-semibold",t),...a})}function xt({className:t,...a}){return e.jsx(te,{"data-slot":"dialog-description",className:l("text-muted-foreground text-sm",t),...a})}const ft="#181717",bt=r.forwardRef(function({title:a="GitHub",color:i="currentColor",size:s=24,...o},n){return i==="default"&&(i=ft),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,fill:i,viewBox:"0 0 24 24",ref:n,...o,children:[e.jsx("title",{children:a}),e.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})}),mt="#85EA2D",B=r.forwardRef(function({title:a="Swagger",color:i="currentColor",size:s=24,...o},n){return i==="default"&&(i=mt),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,fill:i,viewBox:"0 0 24 24",ref:n,...o,children:[e.jsx("title",{children:a}),e.jsx("path",{d:"M12 0C5.383 0 0 5.383 0 12s5.383 12 12 12c6.616 0 12-5.383 12-12S18.616 0 12 0zm0 1.144c5.995 0 10.856 4.86 10.856 10.856 0 5.995-4.86 10.856-10.856 10.856-5.996 0-10.856-4.86-10.856-10.856C1.144 6.004 6.004 1.144 12 1.144zM8.37 5.868a6.707 6.707 0 0 0-.423.005c-.983.056-1.573.517-1.735 1.472-.115.665-.096 1.348-.143 2.017-.013.35-.05.697-.115 1.038-.134.609-.397.798-1.016.83a2.65 2.65 0 0 0-.244.042v1.463c1.126.055 1.278.452 1.37 1.629.033.429-.013.858.015 1.287.018.406.073.808.156 1.2.259 1.075 1.307 1.435 2.575 1.218v-1.283c-.203 0-.383.005-.558 0-.43-.013-.591-.12-.632-.535-.056-.535-.042-1.08-.075-1.62-.064-1.001-.175-1.988-1.153-2.625.503-.37.868-.812.983-1.398.083-.41.134-.821.166-1.237.028-.415-.023-.84.014-1.25.06-.665.102-.937.9-.91.12 0 .235-.017.369-.027v-1.31c-.16 0-.31-.004-.454-.006zm7.593.009a4.247 4.247 0 0 0-.813.06v1.274c.245 0 .434 0 .623.005.328.004.577.13.61.494.032.332.031.669.064 1.006.065.669.101 1.347.217 2.007.102.544.475.95.941 1.283-.817.549-1.057 1.333-1.098 2.215-.023.604-.037 1.213-.069 1.822-.028.554-.222.734-.78.748-.157.004-.31.018-.484.028v1.305c.327 0 .627.019.927 0 .932-.055 1.495-.507 1.68-1.412.078-.498.124-1 .138-1.504.032-.461.028-.927.074-1.384.069-.715.397-1.01 1.112-1.057a.972.972 0 0 0 .199-.046v-1.463c-.12-.014-.204-.027-.291-.032-.536-.023-.804-.203-.937-.71a5.146 5.146 0 0 1-.152-.993c-.037-.618-.033-1.241-.074-1.86-.08-1.192-.794-1.753-1.887-1.786zm-6.89 5.28a.844.844 0 0 0-.083 1.684h.055a.83.83 0 0 0 .877-.78v-.046a.845.845 0 0 0-.83-.858zm2.911 0a.808.808 0 0 0-.834.78c0 .027 0 .05.004.078 0 .503.342.826.859.826.507 0 .826-.332.826-.853-.005-.503-.342-.836-.855-.831zm2.963 0a.861.861 0 0 0-.876.835c0 .47.378.849.849.849h.009c.425.074.853-.337.881-.83.023-.457-.392-.854-.863-.854z"})]})});function gt({isOpen:t,setOpen:a}){return e.jsx(rt,{open:t,onOpenChange:i=>a(i),children:e.jsxs(ct,{children:[e.jsxs(ut,{children:[e.jsx(ht,{children:"Editorial"}),e.jsx(xt,{children:"A simple CMS for static websites"})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(k,{asChild:!0,variant:"ghost",children:e.jsxs(N,{to:"https://lobelia-earth.github.io/editorial/",children:[e.jsx(B,{size:14}),"Documentation"]})}),e.jsx(k,{asChild:!0,variant:"ghost",children:e.jsxs(N,{to:"/doc/ui",children:[e.jsx(B,{size:14}),"Swagger API UI"]})}),e.jsx(k,{asChild:!0,variant:"ghost",children:e.jsxs(N,{to:"https://github.com/Lobelia-Earth/editorial",children:[e.jsx(bt,{size:14}),"GitHub repository"]})})]}),e.jsx(pt,{children:e.jsxs("p",{className:"flex items-center gap-1",children:["Created with",e.jsx(et,{size:14,className:"stroke-red-500 fill-red-500"})," by"," ",e.jsx(N,{to:"https://lobelia.earth",className:"underline hover:text-blue-500",children:"Lobelia.earth"})]})})]})})}var jt="Separator",G="horizontal",vt=["horizontal","vertical"],oe=r.forwardRef((t,a)=>{const{decorative:i,orientation:s=G,...o}=t,n=wt(s)?s:G,c=i?{role:"none"}:{"aria-orientation":n==="vertical"?n:void 0,role:"separator"};return e.jsx(Me.div,{"data-orientation":n,...c,...o,ref:a})});oe.displayName=jt;function wt(t){return vt.includes(t)}var Nt=oe;function ne({className:t,orientation:a="horizontal",decorative:i=!0,...s}){return e.jsx(Nt,{"data-slot":"separator-root",decorative:i,orientation:a,className:l("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...s})}function yt({...t}){return e.jsx(Z,{"data-slot":"sheet",...t})}function Ct({...t}){return e.jsx(ae,{"data-slot":"sheet-portal",...t})}function St({className:t,...a}){return e.jsx(se,{"data-slot":"sheet-overlay",className:l("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function kt({className:t,children:a,side:i="right",...s}){return e.jsxs(Ct,{children:[e.jsx(St,{}),e.jsxs(Y,{"data-slot":"sheet-content",className:l("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",i==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",i==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",i==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",i==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...s,children:[a,e.jsxs(J,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e.jsx(ie,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function _t({className:t,...a}){return e.jsx("div",{"data-slot":"sheet-header",className:l("flex flex-col gap-1.5 p-4",t),...a})}function Mt({className:t,...a}){return e.jsx(ee,{"data-slot":"sheet-title",className:l("text-foreground font-semibold",t),...a})}function Ot({className:t,...a}){return e.jsx(te,{"data-slot":"sheet-description",className:l("text-muted-foreground text-sm",t),...a})}function re({delayDuration:t=0,...a}){return e.jsx(Ae,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function zt({...t}){return e.jsx(re,{children:e.jsx(De,{"data-slot":"tooltip",...t})})}function Pt({...t}){return e.jsx(Ie,{"data-slot":"tooltip-trigger",...t})}function Et({className:t,sideOffset:a=0,children:i,...s}){return e.jsx(Te,{children:e.jsxs(Le,{"data-slot":"tooltip-content",sideOffset:a,className:l("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...s,children:[i,e.jsx($e,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const O=768;function Rt(){const[t,a]=r.useState(void 0);return r.useEffect(()=>{const i=window.matchMedia(`(max-width: ${O-1}px)`),s=()=>{a(window.innerWidth<O)};return i.addEventListener("change",s),a(window.innerWidth<O),()=>i.removeEventListener("change",s)},[]),!!t}const At="sidebar_state",Dt=3600*24*7,It="16rem",Tt="18rem",Lt="3rem",$t="b",le=r.createContext(null);function A(){const t=r.useContext(le);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Bt({defaultOpen:t=!0,open:a,onOpenChange:i,className:s,style:o,children:n,...d}){const c=Rt(),[f,u]=r.useState(!1),[m,C]=r.useState(t),b=a??m,j=r.useCallback(x=>{const p=typeof x=="function"?x(b):x;i?i(p):C(p),document.cookie=`${At}=${p}; path=/; max-age=${Dt}`},[i,b]),h=r.useCallback(()=>c?u(x=>!x):j(x=>!x),[c,j,u]);r.useEffect(()=>{const x=p=>{p.key===$t&&(p.metaKey||p.ctrlKey)&&(p.preventDefault(),h())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[h]);const v=b?"expanded":"collapsed",S=r.useMemo(()=>({state:v,open:b,setOpen:j,isMobile:c,openMobile:f,setOpenMobile:u,toggleSidebar:h}),[v,b,j,c,f,u,h]);return e.jsx(le.Provider,{value:S,children:e.jsx(re,{delayDuration:0,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":It,"--sidebar-width-icon":Lt,...o},className:l("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",s),...d,children:n})})})}function Gt({side:t="left",variant:a="sidebar",collapsible:i="offcanvas",className:s,children:o,...n}){const{isMobile:d,state:c,openMobile:f,setOpenMobile:u}=A();return i==="none"?e.jsx("div",{"data-slot":"sidebar",className:l("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",s),...n,children:o}):d?e.jsx(yt,{open:f,onOpenChange:u,...n,children:e.jsxs(kt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":Tt},side:t,children:[e.jsxs(_t,{className:"sr-only",children:[e.jsx(Mt,{children:"Sidebar"}),e.jsx(Ot,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):e.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":c,"data-collapsible":c==="collapsed"?i:"","data-variant":a,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:l("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",a==="floating"||a==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container",className:l("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",a==="floating"||a==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...n,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:o})})]})}function Ht({className:t,onClick:a,...i}){const{toggleSidebar:s}=A();return e.jsxs(k,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:l("size-7",t),onClick:o=>{a?.(o),s()},...i,children:[e.jsx(it,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Ft({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:l("flex flex-col gap-2 p-2",t),...a})}function Vt({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:l("flex flex-col gap-2 p-2",t),...a})}function Kt({className:t,...a}){return e.jsx(ne,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:l("bg-sidebar-border mx-2 w-auto",t),...a})}function Ut({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:l("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...a})}function H({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:l("relative flex w-full min-w-0 flex-col p-2",t),...a})}function F({className:t,asChild:a=!1,...i}){const s=a?E:"div";return e.jsx(s,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:l("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...i})}function V({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:l("w-full text-sm",t),...a})}function K({className:t,...a}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:l("flex w-full min-w-0 flex-col gap-1",t),...a})}function w({className:t,...a}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:l("group/menu-item relative",t),...a})}const qt=ke("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function g({asChild:t=!1,isActive:a=!1,variant:i="default",size:s="default",tooltip:o,className:n,...d}){const c=t?E:"button",{isMobile:f,state:u}=A(),m=e.jsx(c,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":a,className:l(qt({variant:i,size:s}),n),...d});return o?(typeof o=="string"&&(o={children:o}),e.jsxs(zt,{children:[e.jsx(Pt,{asChild:!0,children:m}),e.jsx(Et,{side:"right",align:"center",hidden:u!=="collapsed"||f,...o})]})):m}function Wt({className:t,...a}){return e.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:l("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...a})}function Qt({asChild:t=!1,size:a="md",isActive:i=!1,className:s,...o}){const n=t?E:"a";return e.jsx(n,{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":a,"data-active":i,className:l("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",a==="sm"&&"text-xs",a==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",s),...o})}function U({singleton:t}){const{data:a}=P(),{data:i}=ve();if(!a)return null;const s=r.useMemo(()=>Object.entries(a).filter(([,o])=>t?o.singleton:!o.singleton).toSorted(([o],[n])=>o.localeCompare(n)),[a,t]);return e.jsx(e.Fragment,{children:s.map(([o,n])=>e.jsx(Wt,{children:e.jsx(X,{to:t?`/admin/dashboard/${o}/default`:`/admin/dashboard/${o}`,className:({isActive:d,isPending:c})=>c?"pending":d?"active":"",children:({isActive:d})=>e.jsx(Qt,{isActive:d,asChild:!0,children:e.jsxs("div",{children:[e.jsx("span",{className:"inline-block overflow-hidden whitespace-nowrap text-ellipsis text-nowrap",children:n.displayName}),!t&&i?.[o]&&e.jsx("span",{className:"text-xs text-gray-500 ml-auto pr-1 min-w-[25px] text-right",children:Object.keys(i[o]).length})]})})})},n.displayName))})}var _="Collapsible",[Xt]=ze(_),[Zt,D]=Xt(_),de=r.forwardRef((t,a)=>{const{__scopeCollapsible:i,open:s,defaultOpen:o,disabled:n,onOpenChange:d,...c}=t,[f,u]=Oe({prop:s,defaultProp:o??!1,onChange:d,caller:_});return e.jsx(Zt,{scope:i,disabled:n,contentId:Se(),open:f,onOpenToggle:r.useCallback(()=>u(m=>!m),[u]),children:e.jsx(R.div,{"data-state":T(f),"data-disabled":n?"":void 0,...c,ref:a})})});de.displayName=_;var ce="CollapsibleTrigger",ue=r.forwardRef((t,a)=>{const{__scopeCollapsible:i,...s}=t,o=D(ce,i);return e.jsx(R.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":T(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...s,ref:a,onClick:Pe(t.onClick,o.onOpenToggle)})});ue.displayName=ce;var I="CollapsibleContent",pe=r.forwardRef((t,a)=>{const{forceMount:i,...s}=t,o=D(I,t.__scopeCollapsible);return e.jsx(Ee,{present:i||o.open,children:({present:n})=>e.jsx(Yt,{...s,ref:a,present:n})})});pe.displayName=I;var Yt=r.forwardRef((t,a)=>{const{__scopeCollapsible:i,present:s,children:o,...n}=t,d=D(I,i),[c,f]=r.useState(s),u=r.useRef(null),m=_e(a,u),C=r.useRef(0),b=C.current,j=r.useRef(0),h=j.current,v=d.open||c,S=r.useRef(v),x=r.useRef(void 0);return r.useEffect(()=>{const p=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(p)},[]),Re(()=>{const p=u.current;if(p){x.current=x.current||{transitionDuration:p.style.transitionDuration,animationName:p.style.animationName},p.style.transitionDuration="0s",p.style.animationName="none";const L=p.getBoundingClientRect();C.current=L.height,j.current=L.width,S.current||(p.style.transitionDuration=x.current.transitionDuration,p.style.animationName=x.current.animationName),f(s)}},[d.open,s]),e.jsx(R.div,{"data-state":T(d.open),"data-disabled":d.disabled?"":void 0,id:d.contentId,hidden:!v,...n,ref:m,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...t.style},children:v&&o})});function T(t){return t?"open":"closed"}var Jt=de;function q({...t}){return e.jsx(Jt,{"data-slot":"collapsible",...t})}function W({...t}){return e.jsx(ue,{"data-slot":"collapsible-trigger",...t})}function Q({...t}){return e.jsx(pe,{"data-slot":"collapsible-content",...t})}function ea(){const t=ge(),[a,i]=r.useState(!1),[s]=we(),[o]=Ne(),[n]=ye(),[d,c]=r.useState(!1),{data:f}=Ce(),{data:u}=P(),m=r.useMemo(()=>u&&!!Object.values(u).find(h=>!h.singleton),[u]),C=r.useMemo(()=>u&&!!Object.values(u).find(h=>h.singleton),[u]),b=z(h=>h.auth.user),j=async h=>{c(!0);try{await s({author:h}).unwrap()?M.success("Content published successfully."):M.error("Publishing failed.")}catch(v){M.error("Publishing failed."),console.error(v)}finally{c(!1)}};return e.jsxs(Gt,{className:"z-50",children:[e.jsx(gt,{isOpen:a,setOpen:i}),e.jsx(Ft,{className:"h-14 justify-center",children:e.jsx(H,{children:e.jsx(N,{to:"/admin/dashboard",className:"text-3xl font-semibold tracking-tight transition-colors",children:f?.name})})}),e.jsx(Ut,{children:e.jsxs(H,{children:[e.jsx(F,{children:"Content"}),e.jsx(V,{children:e.jsxs(K,{children:[e.jsx(q,{className:"group/collapsible",disabled:!m,children:e.jsxs(w,{children:[e.jsx(W,{asChild:!0,children:e.jsxs(g,{className:"group",children:[e.jsx(Ye,{}),e.jsx("span",{children:"Collections"}),e.jsx($,{className:"transition-transform ml-auto -mr-[2px] group-data-[state=open]:rotate-180"})]})}),e.jsx(Q,{children:e.jsx(U,{})})]})}),e.jsx(q,{className:"group/collapsible",disabled:!C,children:e.jsxs(w,{children:[e.jsx(W,{asChild:!0,children:e.jsxs(g,{className:"group",children:[e.jsx(nt,{}),e.jsx("span",{children:"Singles"}),e.jsx($,{className:"transition-transform ml-auto -mr-[2px] group-data-[state=open]:rotate-180"})]})}),e.jsx(Q,{children:e.jsx(U,{singleton:!0})})]})}),e.jsx(w,{children:e.jsx(g,{asChild:!0,children:e.jsxs(N,{to:"/admin/dashboard/files",children:[e.jsx(Xe,{}),e.jsx("span",{children:"Files"})]})})}),e.jsx(w,{children:e.jsxs(g,{disabled:!0,children:[e.jsx(We,{}),e.jsx("span",{children:"Components"})]})})]})})]})}),e.jsxs(Vt,{children:[e.jsx(F,{children:"Actions"}),e.jsx(V,{children:e.jsxs(K,{children:[b?.role==="developer"&&e.jsxs(e.Fragment,{children:[e.jsx(w,{children:e.jsxs(g,{className:"cursor-pointer",onClick:()=>o(),children:[e.jsx(Be,{}),e.jsx("span",{children:"Pull from repo"})]})}),e.jsx(w,{children:e.jsxs(g,{className:"cursor-pointer",onClick:()=>n({author:b.email}),children:[e.jsx(Ge,{}),e.jsx("span",{children:"Push to repo"})]})})]}),b&&e.jsx(w,{children:e.jsxs(g,{className:"cursor-pointer",onClick:()=>{j(b.email)},children:[d?e.jsx(He,{className:"animate-spin"}):e.jsx(Fe,{}),e.jsx("span",{children:"Publish"})]})})]})}),e.jsx(Kt,{}),e.jsx(g,{asChild:!0,children:e.jsxs(N,{to:f?.previewUrl,children:["Preview",e.jsx(Ve,{className:"ml-auto"})]})}),e.jsx(g,{className:"cursor-pointer",onClick:()=>i(!0),children:"About"}),e.jsxs(g,{className:"cursor-pointer",onClick:()=>t(je()),children:[e.jsx(at,{}),"Log out"]}),e.jsxs("div",{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",children:["Editorial v","6.12.2"]})]})]})}function ta({children:t}){const a=he(),i=z(o=>o.auth.user),s=z(o=>o.auth.isLoading);return r.useEffect(()=>{!s&&!i&&a("/admin")},[s,a,i]),s||!i?e.jsx(Ke,{}):t}function aa(){const{pathname:t}=xe(),{data:a}=P(),i=t.split("/").filter(s=>!["admin","dashboard"].includes(s)&&s!=="");return a?e.jsx(e.Fragment,{children:i.map((s,o,n)=>e.jsxs(fe.Fragment,{children:[n.length>1&&o>=1&&e.jsx(Ue,{size:12,className:"text-gray-500 pt-[1px]"}),e.jsxs("p",{className:"text-sm leading-none tracking-tight capitalize text-gray-500 last:text-foreground",children:[o<n.length-1&&a[s]&&a[s].singleton&&(a[s]?a[s].displayName:s),o<n.length-1&&a[s]&&!a[s].singleton&&e.jsx(X,{to:`/admin/dashboard/${s}`,className:({isActive:d,isPending:c})=>c?"pending":d?"active":"",children:a[s]?a[s].displayName:s}),o===n.length-1&&(a[s]?a[s].displayName:s)]},s)]},o))}):null}const ya=be(function(){return e.jsx(ta,{children:e.jsxs(Bt,{className:"flex h-full",children:[e.jsx(ea,{}),e.jsxs("main",{className:"flex flex-col flex-1 h-full w-0",children:[e.jsx("header",{className:"flex sticky bg-sidebar dark:bg-sidebar z-40 top-0 h-14 shrink-0 items-center gap-2 border-b",children:e.jsxs("div",{className:"flex items-center gap-2 px-3",children:[e.jsx(Ht,{}),e.jsx(ne,{orientation:"vertical",className:"h-4"}),e.jsx(aa,{})]})}),e.jsx(me,{})]})]})})});export{ya as default};
|
|
1
|
+
import{p as e,a as r,x as N,y as X,v as he,z as xe,R as fe,w as be,O as me}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{u as ge,d as z,e as je}from"./authSlice-DyBWbN7g.js";import{a as l,b as P,d as ve,f as we,g as Ne,h as ye,u as Ce}from"./utils-oJIM4U5n.js";import{t as M}from"./index-CZSVchcX.js";import{R as Z,C as Y,a as J,T as ee,D as te,P as ae,O as se,u as Se}from"./index-DgNySWwD.js";import{X as ie}from"./x-D6gZWaAR.js";import{B as k}from"./button-CAQsSeJv.js";import{c as y}from"./createLucideIcon-BvSqmaUO.js";import{S as E,c as ke,u as _e}from"./index-B-2LEQwB.js";import{P as Me,u as Oe,c as ze,a as R,b as Pe,d as Ee,e as Re}from"./index-Cxe-PO-X.js";import{P as Ae,R as De,T as Ie,a as Te,C as Le,A as $e}from"./index-C0hImMcN.js";import{C as $}from"./chevron-down-qxzqwz13.js";import{A as Be,a as Ge}from"./arrow-up-C0I0e1Jt.js";import{L as He}from"./tslib.es6-Dm3DwgL9.js";import{U as Fe}from"./upload-DhJ5wU_H.js";import{E as Ve}from"./external-link-ERgO2SVI.js";import{L as Ke}from"./Loading-BkOvB9cm.js";import{C as Ue}from"./chevron-right-BFlMu-RJ.js";import"./index-DLIEpuwL.js";import"./index-B45LLRRA.js";const qe=[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]],We=y("blocks",qe);const Qe=[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]],Xe=y("files",Qe);const Ze=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Ye=y("grid-3x3",Ze);const Je=[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]],et=y("heart",Je);const tt=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],at=y("log-out",tt);const st=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],it=y("panel-left",st);const ot=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],nt=y("square",ot);function rt({...t}){return e.jsx(Z,{"data-slot":"dialog",...t})}function lt({...t}){return e.jsx(ae,{"data-slot":"dialog-portal",...t})}function dt({className:t,...a}){return e.jsx(se,{"data-slot":"dialog-overlay",className:l("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function ct({className:t,children:a,...i}){return e.jsxs(lt,{"data-slot":"dialog-portal",children:[e.jsx(dt,{}),e.jsxs(Y,{"data-slot":"dialog-content",className:l("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...i,children:[a,e.jsxs(J,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(ie,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ut({className:t,...a}){return e.jsx("div",{"data-slot":"dialog-header",className:l("flex flex-col gap-2 text-center sm:text-left",t),...a})}function pt({className:t,...a}){return e.jsx("div",{"data-slot":"dialog-footer",className:l("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function ht({className:t,...a}){return e.jsx(ee,{"data-slot":"dialog-title",className:l("text-lg leading-none font-semibold",t),...a})}function xt({className:t,...a}){return e.jsx(te,{"data-slot":"dialog-description",className:l("text-muted-foreground text-sm",t),...a})}const ft="#181717",bt=r.forwardRef(function({title:a="GitHub",color:i="currentColor",size:s=24,...o},n){return i==="default"&&(i=ft),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,fill:i,viewBox:"0 0 24 24",ref:n,...o,children:[e.jsx("title",{children:a}),e.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})}),mt="#85EA2D",B=r.forwardRef(function({title:a="Swagger",color:i="currentColor",size:s=24,...o},n){return i==="default"&&(i=mt),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,fill:i,viewBox:"0 0 24 24",ref:n,...o,children:[e.jsx("title",{children:a}),e.jsx("path",{d:"M12 0C5.383 0 0 5.383 0 12s5.383 12 12 12c6.616 0 12-5.383 12-12S18.616 0 12 0zm0 1.144c5.995 0 10.856 4.86 10.856 10.856 0 5.995-4.86 10.856-10.856 10.856-5.996 0-10.856-4.86-10.856-10.856C1.144 6.004 6.004 1.144 12 1.144zM8.37 5.868a6.707 6.707 0 0 0-.423.005c-.983.056-1.573.517-1.735 1.472-.115.665-.096 1.348-.143 2.017-.013.35-.05.697-.115 1.038-.134.609-.397.798-1.016.83a2.65 2.65 0 0 0-.244.042v1.463c1.126.055 1.278.452 1.37 1.629.033.429-.013.858.015 1.287.018.406.073.808.156 1.2.259 1.075 1.307 1.435 2.575 1.218v-1.283c-.203 0-.383.005-.558 0-.43-.013-.591-.12-.632-.535-.056-.535-.042-1.08-.075-1.62-.064-1.001-.175-1.988-1.153-2.625.503-.37.868-.812.983-1.398.083-.41.134-.821.166-1.237.028-.415-.023-.84.014-1.25.06-.665.102-.937.9-.91.12 0 .235-.017.369-.027v-1.31c-.16 0-.31-.004-.454-.006zm7.593.009a4.247 4.247 0 0 0-.813.06v1.274c.245 0 .434 0 .623.005.328.004.577.13.61.494.032.332.031.669.064 1.006.065.669.101 1.347.217 2.007.102.544.475.95.941 1.283-.817.549-1.057 1.333-1.098 2.215-.023.604-.037 1.213-.069 1.822-.028.554-.222.734-.78.748-.157.004-.31.018-.484.028v1.305c.327 0 .627.019.927 0 .932-.055 1.495-.507 1.68-1.412.078-.498.124-1 .138-1.504.032-.461.028-.927.074-1.384.069-.715.397-1.01 1.112-1.057a.972.972 0 0 0 .199-.046v-1.463c-.12-.014-.204-.027-.291-.032-.536-.023-.804-.203-.937-.71a5.146 5.146 0 0 1-.152-.993c-.037-.618-.033-1.241-.074-1.86-.08-1.192-.794-1.753-1.887-1.786zm-6.89 5.28a.844.844 0 0 0-.083 1.684h.055a.83.83 0 0 0 .877-.78v-.046a.845.845 0 0 0-.83-.858zm2.911 0a.808.808 0 0 0-.834.78c0 .027 0 .05.004.078 0 .503.342.826.859.826.507 0 .826-.332.826-.853-.005-.503-.342-.836-.855-.831zm2.963 0a.861.861 0 0 0-.876.835c0 .47.378.849.849.849h.009c.425.074.853-.337.881-.83.023-.457-.392-.854-.863-.854z"})]})});function gt({isOpen:t,setOpen:a}){return e.jsx(rt,{open:t,onOpenChange:i=>a(i),children:e.jsxs(ct,{children:[e.jsxs(ut,{children:[e.jsx(ht,{children:"Editorial"}),e.jsx(xt,{children:"A simple CMS for static websites"})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(k,{asChild:!0,variant:"ghost",children:e.jsxs(N,{to:"https://lobelia-earth.github.io/editorial/",children:[e.jsx(B,{size:14}),"Documentation"]})}),e.jsx(k,{asChild:!0,variant:"ghost",children:e.jsxs(N,{to:"/doc/ui",children:[e.jsx(B,{size:14}),"Swagger API UI"]})}),e.jsx(k,{asChild:!0,variant:"ghost",children:e.jsxs(N,{to:"https://github.com/Lobelia-Earth/editorial",children:[e.jsx(bt,{size:14}),"GitHub repository"]})})]}),e.jsx(pt,{children:e.jsxs("p",{className:"flex items-center gap-1",children:["Created with",e.jsx(et,{size:14,className:"stroke-red-500 fill-red-500"})," by"," ",e.jsx(N,{to:"https://lobelia.earth",className:"underline hover:text-blue-500",children:"Lobelia.earth"})]})})]})})}var jt="Separator",G="horizontal",vt=["horizontal","vertical"],oe=r.forwardRef((t,a)=>{const{decorative:i,orientation:s=G,...o}=t,n=wt(s)?s:G,c=i?{role:"none"}:{"aria-orientation":n==="vertical"?n:void 0,role:"separator"};return e.jsx(Me.div,{"data-orientation":n,...c,...o,ref:a})});oe.displayName=jt;function wt(t){return vt.includes(t)}var Nt=oe;function ne({className:t,orientation:a="horizontal",decorative:i=!0,...s}){return e.jsx(Nt,{"data-slot":"separator-root",decorative:i,orientation:a,className:l("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...s})}function yt({...t}){return e.jsx(Z,{"data-slot":"sheet",...t})}function Ct({...t}){return e.jsx(ae,{"data-slot":"sheet-portal",...t})}function St({className:t,...a}){return e.jsx(se,{"data-slot":"sheet-overlay",className:l("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function kt({className:t,children:a,side:i="right",...s}){return e.jsxs(Ct,{children:[e.jsx(St,{}),e.jsxs(Y,{"data-slot":"sheet-content",className:l("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",i==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",i==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",i==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",i==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...s,children:[a,e.jsxs(J,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e.jsx(ie,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function _t({className:t,...a}){return e.jsx("div",{"data-slot":"sheet-header",className:l("flex flex-col gap-1.5 p-4",t),...a})}function Mt({className:t,...a}){return e.jsx(ee,{"data-slot":"sheet-title",className:l("text-foreground font-semibold",t),...a})}function Ot({className:t,...a}){return e.jsx(te,{"data-slot":"sheet-description",className:l("text-muted-foreground text-sm",t),...a})}function re({delayDuration:t=0,...a}){return e.jsx(Ae,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function zt({...t}){return e.jsx(re,{children:e.jsx(De,{"data-slot":"tooltip",...t})})}function Pt({...t}){return e.jsx(Ie,{"data-slot":"tooltip-trigger",...t})}function Et({className:t,sideOffset:a=0,children:i,...s}){return e.jsx(Te,{children:e.jsxs(Le,{"data-slot":"tooltip-content",sideOffset:a,className:l("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...s,children:[i,e.jsx($e,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const O=768;function Rt(){const[t,a]=r.useState(void 0);return r.useEffect(()=>{const i=window.matchMedia(`(max-width: ${O-1}px)`),s=()=>{a(window.innerWidth<O)};return i.addEventListener("change",s),a(window.innerWidth<O),()=>i.removeEventListener("change",s)},[]),!!t}const At="sidebar_state",Dt=3600*24*7,It="16rem",Tt="18rem",Lt="3rem",$t="b",le=r.createContext(null);function A(){const t=r.useContext(le);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Bt({defaultOpen:t=!0,open:a,onOpenChange:i,className:s,style:o,children:n,...d}){const c=Rt(),[f,u]=r.useState(!1),[m,C]=r.useState(t),b=a??m,j=r.useCallback(x=>{const p=typeof x=="function"?x(b):x;i?i(p):C(p),document.cookie=`${At}=${p}; path=/; max-age=${Dt}`},[i,b]),h=r.useCallback(()=>c?u(x=>!x):j(x=>!x),[c,j,u]);r.useEffect(()=>{const x=p=>{p.key===$t&&(p.metaKey||p.ctrlKey)&&(p.preventDefault(),h())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[h]);const v=b?"expanded":"collapsed",S=r.useMemo(()=>({state:v,open:b,setOpen:j,isMobile:c,openMobile:f,setOpenMobile:u,toggleSidebar:h}),[v,b,j,c,f,u,h]);return e.jsx(le.Provider,{value:S,children:e.jsx(re,{delayDuration:0,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":It,"--sidebar-width-icon":Lt,...o},className:l("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",s),...d,children:n})})})}function Gt({side:t="left",variant:a="sidebar",collapsible:i="offcanvas",className:s,children:o,...n}){const{isMobile:d,state:c,openMobile:f,setOpenMobile:u}=A();return i==="none"?e.jsx("div",{"data-slot":"sidebar",className:l("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",s),...n,children:o}):d?e.jsx(yt,{open:f,onOpenChange:u,...n,children:e.jsxs(kt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":Tt},side:t,children:[e.jsxs(_t,{className:"sr-only",children:[e.jsx(Mt,{children:"Sidebar"}),e.jsx(Ot,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):e.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":c,"data-collapsible":c==="collapsed"?i:"","data-variant":a,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:l("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",a==="floating"||a==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container",className:l("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",a==="floating"||a==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...n,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:o})})]})}function Ht({className:t,onClick:a,...i}){const{toggleSidebar:s}=A();return e.jsxs(k,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:l("size-7",t),onClick:o=>{a?.(o),s()},...i,children:[e.jsx(it,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Ft({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:l("flex flex-col gap-2 p-2",t),...a})}function Vt({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:l("flex flex-col gap-2 p-2",t),...a})}function Kt({className:t,...a}){return e.jsx(ne,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:l("bg-sidebar-border mx-2 w-auto",t),...a})}function Ut({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:l("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...a})}function H({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:l("relative flex w-full min-w-0 flex-col p-2",t),...a})}function F({className:t,asChild:a=!1,...i}){const s=a?E:"div";return e.jsx(s,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:l("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...i})}function V({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:l("w-full text-sm",t),...a})}function K({className:t,...a}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:l("flex w-full min-w-0 flex-col gap-1",t),...a})}function w({className:t,...a}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:l("group/menu-item relative",t),...a})}const qt=ke("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function g({asChild:t=!1,isActive:a=!1,variant:i="default",size:s="default",tooltip:o,className:n,...d}){const c=t?E:"button",{isMobile:f,state:u}=A(),m=e.jsx(c,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":a,className:l(qt({variant:i,size:s}),n),...d});return o?(typeof o=="string"&&(o={children:o}),e.jsxs(zt,{children:[e.jsx(Pt,{asChild:!0,children:m}),e.jsx(Et,{side:"right",align:"center",hidden:u!=="collapsed"||f,...o})]})):m}function Wt({className:t,...a}){return e.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:l("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...a})}function Qt({asChild:t=!1,size:a="md",isActive:i=!1,className:s,...o}){const n=t?E:"a";return e.jsx(n,{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":a,"data-active":i,className:l("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",a==="sm"&&"text-xs",a==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",s),...o})}function U({singleton:t}){const{data:a}=P(),{data:i}=ve();if(!a)return null;const s=r.useMemo(()=>Object.entries(a).filter(([,o])=>t?o.singleton:!o.singleton).toSorted(([o],[n])=>o.localeCompare(n)),[a,t]);return e.jsx(e.Fragment,{children:s.map(([o,n])=>e.jsx(Wt,{children:e.jsx(X,{to:t?`/admin/dashboard/${o}/default`:`/admin/dashboard/${o}`,className:({isActive:d,isPending:c})=>c?"pending":d?"active":"",children:({isActive:d})=>e.jsx(Qt,{isActive:d,asChild:!0,children:e.jsxs("div",{children:[e.jsx("span",{className:"inline-block overflow-hidden whitespace-nowrap text-ellipsis text-nowrap",children:n.displayName}),!t&&i?.[o]&&e.jsx("span",{className:"text-xs text-gray-500 ml-auto pr-1 min-w-[25px] text-right",children:Object.keys(i[o]).length})]})})})},n.displayName))})}var _="Collapsible",[Xt]=ze(_),[Zt,D]=Xt(_),de=r.forwardRef((t,a)=>{const{__scopeCollapsible:i,open:s,defaultOpen:o,disabled:n,onOpenChange:d,...c}=t,[f,u]=Oe({prop:s,defaultProp:o??!1,onChange:d,caller:_});return e.jsx(Zt,{scope:i,disabled:n,contentId:Se(),open:f,onOpenToggle:r.useCallback(()=>u(m=>!m),[u]),children:e.jsx(R.div,{"data-state":T(f),"data-disabled":n?"":void 0,...c,ref:a})})});de.displayName=_;var ce="CollapsibleTrigger",ue=r.forwardRef((t,a)=>{const{__scopeCollapsible:i,...s}=t,o=D(ce,i);return e.jsx(R.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":T(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...s,ref:a,onClick:Pe(t.onClick,o.onOpenToggle)})});ue.displayName=ce;var I="CollapsibleContent",pe=r.forwardRef((t,a)=>{const{forceMount:i,...s}=t,o=D(I,t.__scopeCollapsible);return e.jsx(Ee,{present:i||o.open,children:({present:n})=>e.jsx(Yt,{...s,ref:a,present:n})})});pe.displayName=I;var Yt=r.forwardRef((t,a)=>{const{__scopeCollapsible:i,present:s,children:o,...n}=t,d=D(I,i),[c,f]=r.useState(s),u=r.useRef(null),m=_e(a,u),C=r.useRef(0),b=C.current,j=r.useRef(0),h=j.current,v=d.open||c,S=r.useRef(v),x=r.useRef(void 0);return r.useEffect(()=>{const p=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(p)},[]),Re(()=>{const p=u.current;if(p){x.current=x.current||{transitionDuration:p.style.transitionDuration,animationName:p.style.animationName},p.style.transitionDuration="0s",p.style.animationName="none";const L=p.getBoundingClientRect();C.current=L.height,j.current=L.width,S.current||(p.style.transitionDuration=x.current.transitionDuration,p.style.animationName=x.current.animationName),f(s)}},[d.open,s]),e.jsx(R.div,{"data-state":T(d.open),"data-disabled":d.disabled?"":void 0,id:d.contentId,hidden:!v,...n,ref:m,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...t.style},children:v&&o})});function T(t){return t?"open":"closed"}var Jt=de;function q({...t}){return e.jsx(Jt,{"data-slot":"collapsible",...t})}function W({...t}){return e.jsx(ue,{"data-slot":"collapsible-trigger",...t})}function Q({...t}){return e.jsx(pe,{"data-slot":"collapsible-content",...t})}function ea(){const t=ge(),[a,i]=r.useState(!1),[s]=we(),[o]=Ne(),[n]=ye(),[d,c]=r.useState(!1),{data:f}=Ce(),{data:u}=P(),m=r.useMemo(()=>u&&!!Object.values(u).find(h=>!h.singleton),[u]),C=r.useMemo(()=>u&&!!Object.values(u).find(h=>h.singleton),[u]),b=z(h=>h.auth.user),j=async h=>{c(!0);try{await s({author:h}).unwrap()?M.success("Content published successfully."):M.error("Publishing failed.")}catch(v){M.error("Publishing failed."),console.error(v)}finally{c(!1)}};return e.jsxs(Gt,{className:"z-50",children:[e.jsx(gt,{isOpen:a,setOpen:i}),e.jsx(Ft,{className:"h-14 justify-center",children:e.jsx(H,{children:e.jsx(N,{to:"/admin/dashboard",className:"text-3xl font-semibold tracking-tight transition-colors",children:f?.name})})}),e.jsx(Ut,{children:e.jsxs(H,{children:[e.jsx(F,{children:"Content"}),e.jsx(V,{children:e.jsxs(K,{children:[e.jsx(q,{className:"group/collapsible",disabled:!m,children:e.jsxs(w,{children:[e.jsx(W,{asChild:!0,children:e.jsxs(g,{className:"group",children:[e.jsx(Ye,{}),e.jsx("span",{children:"Collections"}),e.jsx($,{className:"transition-transform ml-auto -mr-[2px] group-data-[state=open]:rotate-180"})]})}),e.jsx(Q,{children:e.jsx(U,{})})]})}),e.jsx(q,{className:"group/collapsible",disabled:!C,children:e.jsxs(w,{children:[e.jsx(W,{asChild:!0,children:e.jsxs(g,{className:"group",children:[e.jsx(nt,{}),e.jsx("span",{children:"Singles"}),e.jsx($,{className:"transition-transform ml-auto -mr-[2px] group-data-[state=open]:rotate-180"})]})}),e.jsx(Q,{children:e.jsx(U,{singleton:!0})})]})}),e.jsx(w,{children:e.jsx(g,{asChild:!0,children:e.jsxs(N,{to:"/admin/dashboard/files",children:[e.jsx(Xe,{}),e.jsx("span",{children:"Files"})]})})}),e.jsx(w,{children:e.jsxs(g,{disabled:!0,children:[e.jsx(We,{}),e.jsx("span",{children:"Components"})]})})]})})]})}),e.jsxs(Vt,{children:[e.jsx(F,{children:"Actions"}),e.jsx(V,{children:e.jsxs(K,{children:[b?.role==="developer"&&e.jsxs(e.Fragment,{children:[e.jsx(w,{children:e.jsxs(g,{className:"cursor-pointer",onClick:()=>o(),children:[e.jsx(Be,{}),e.jsx("span",{children:"Pull from repo"})]})}),e.jsx(w,{children:e.jsxs(g,{className:"cursor-pointer",onClick:()=>n({author:b.email}),children:[e.jsx(Ge,{}),e.jsx("span",{children:"Push to repo"})]})})]}),b&&e.jsx(w,{children:e.jsxs(g,{className:"cursor-pointer",onClick:()=>{j(b.email)},children:[d?e.jsx(He,{className:"animate-spin"}):e.jsx(Fe,{}),e.jsx("span",{children:"Publish"})]})})]})}),e.jsx(Kt,{}),e.jsx(g,{asChild:!0,children:e.jsxs(N,{to:f?.previewUrl,children:["Preview",e.jsx(Ve,{className:"ml-auto"})]})}),e.jsx(g,{className:"cursor-pointer",onClick:()=>i(!0),children:"About"}),e.jsxs(g,{className:"cursor-pointer",onClick:()=>t(je()),children:[e.jsx(at,{}),"Log out"]}),e.jsxs("div",{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",children:["Editorial v","6.13.0"]})]})]})}function ta({children:t}){const a=he(),i=z(o=>o.auth.user),s=z(o=>o.auth.isLoading);return r.useEffect(()=>{!s&&!i&&a("/admin")},[s,a,i]),s||!i?e.jsx(Ke,{}):t}function aa(){const{pathname:t}=xe(),{data:a}=P(),i=t.split("/").filter(s=>!["admin","dashboard"].includes(s)&&s!=="");return a?e.jsx(e.Fragment,{children:i.map((s,o,n)=>e.jsxs(fe.Fragment,{children:[n.length>1&&o>=1&&e.jsx(Ue,{size:12,className:"text-gray-500 pt-[1px]"}),e.jsxs("p",{className:"text-sm leading-none tracking-tight capitalize text-gray-500 last:text-foreground",children:[o<n.length-1&&a[s]&&a[s].singleton&&(a[s]?a[s].displayName:s),o<n.length-1&&a[s]&&!a[s].singleton&&e.jsx(X,{to:`/admin/dashboard/${s}`,className:({isActive:d,isPending:c})=>c?"pending":d?"active":"",children:a[s]?a[s].displayName:s}),o===n.length-1&&(a[s]?a[s].displayName:s)]},s)]},o))}):null}const ya=be(function(){return e.jsx(ta,{children:e.jsxs(Bt,{className:"flex h-full",children:[e.jsx(ea,{}),e.jsxs("main",{className:"flex flex-col flex-1 h-full w-0",children:[e.jsx("header",{className:"flex sticky bg-sidebar dark:bg-sidebar z-40 top-0 h-14 shrink-0 items-center gap-2 border-b",children:e.jsxs("div",{className:"flex items-center gap-2 px-3",children:[e.jsx(Ht,{}),e.jsx(ne,{orientation:"vertical",className:"h-4"}),e.jsx(aa,{})]})}),e.jsx(me,{})]})]})})});export{ya as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{w as e,p as o}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{F as r}from"./files-
|
|
1
|
+
import{w as e,p as o}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{F as r}from"./files-Eirjo7Qj.js";import"./utils-oJIM4U5n.js";import"./index-B-2LEQwB.js";import"./upload-DhJ5wU_H.js";import"./createLucideIcon-BvSqmaUO.js";import"./trash-UKLAaALv.js";import"./chevron-down-qxzqwz13.js";const n=e(function(){return o.jsx("div",{className:"overflow-auto flex flex-1 p-4 gap-4",children:o.jsx("div",{className:"flex flex-col flex-1 gap-8",children:o.jsx(r,{})})})});export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,a as g,x as w}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{a as v,r as k,t as F,v as z,w as C,u as $,x as M,n as D}from"./utils-oJIM4U5n.js";import{S as U,c as _}from"./index-B-2LEQwB.js";import{U as y}from"./upload-DhJ5wU_H.js";import{F as H,T as L}from"./trash-UKLAaALv.js";import{c as m}from"./createLucideIcon-BvSqmaUO.js";import{C as S}from"./chevron-down-qxzqwz13.js";const T=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],I=m("copy",T);const V=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],P=m("file-text",V);const E=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],q=m("file",E);const Z=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],G=m("folder-open",Z);const Q=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],R=m("folder",Q),W=_("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function B({className:s,variant:i,asChild:l=!1,...o}){const n=l?U:"span";return e.jsx(n,{"data-slot":"badge",className:v(W({variant:i}),s),...o})}const O=["txt","md","html","pdf"],J=["svg","webp","png","jpeg","jpg"],K=[{Icon:H,test:s=>J.some(i=>s.name.endsWith(i))},{Icon:P,test:s=>O.some(i=>s.name.endsWith(i))}],X={Icon:q},j=({node:s,level:i=0,onDelete:l,onChange:o,disableActions:n,onUpload:p,onCreateFolder:f})=>{const[d,h]=g.useState(!1),{data:u}=$(),a=K.find(r=>r.test(s))??X,t=s.type==="directory",c=t||o?"div":w,b=()=>{t&&h(!d)},N=r=>{const x=r.target.files;x&&p&&p(s.path,x)};return e.jsxs("div",{className:"select-none",children:[e.jsxs(c,{to:`/${s.relativePath}`,target:"_blank",className:"flex items-center gap-2 h-10 p-2 group hover:bg-muted/50 cursor-pointer",style:{paddingLeft:`calc(0.5rem + ${i*20}px)`},onClick:t?b:o?()=>o(s.isLarge?`${u?.largeFilesUrl}/${s.relativePath}`:s.relativePath):void 0,children:[t?e.jsx(S,{size:16,className:v("transition-transform",{"rotate-180":d})}):e.jsx("div",{className:"w-4"}),e.jsxs("div",{className:"flex flex-grow w-24 items-center gap-2 ml-2",children:[t?d?e.jsx(G,{size:16,className:"text-yellow-500"}):e.jsx(R,{size:16,className:"text-yellow-500"}):e.jsx(a.Icon,{size:16,className:" text-gray-500"}),e.jsxs("span",{className:"flex gap-2 items-center text-sm whitespace-nowrap text-ellipsis overflow-hidden w-full",children:[!t&&s.isLarge&&e.jsx(B,{variant:"outline",children:"Large"}),s.name]})]}),e.jsx("div",{className:"flex w-24 justify-end gap-2",children:e.jsx("span",{className:"text-sm text-gray-500",children:t?"--":M(s.size)})}),!n&&e.jsxs("div",{className:"flex items-center gap-1 ml-4 group-hover:visible invisible z-50",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"file",multiple:!0,onChange:N,className:"hidden",id:`dir-upload-${s.name}-${i}`}),e.jsxs("label",{htmlFor:`dir-upload-${s.name}-${i}`,className:"hover:text-blue-500 p-1 hover:bg-muted rounded-sm cursor-pointer",onClick:r=>{r.stopPropagation()},children:[e.jsx(y,{size:16}),e.jsx("span",{className:"sr-only",children:"Upload files to this folder"})]})]}),e.jsxs("button",{className:D("hover:text-yellow-500 p-1 hover:bg-muted rounded-sm",t&&"hidden"),onClick:r=>{r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(s.path)},children:[e.jsx(I,{size:16}),e.jsx("span",{className:"sr-only",children:"Copy file URL"})]}),e.jsxs("button",{className:"hover:text-red-500 p-1 hover:bg-muted rounded-sm",onClick:r=>{r.preventDefault(),r.stopPropagation(),l(s.path)},children:[e.jsx(L,{size:16}),e.jsxs("span",{className:"sr-only",children:["Delete this ",t?"folder":"file"]})]})]})]}),t&&d&&s.children&&e.jsx("div",{children:s.children.map((r,x)=>e.jsx(j,{node:r,level:i+1,onDelete:l,onChange:o,disableActions:n,onUpload:p,onCreateFolder:f},`${r.name}-${x}`))})]})};function ie({disableActions:s,onChange:i}){const{data:l}=k(),[o]=F(),[n]=z(),[p]=C(),f=async a=>{const t=a.target.files;if(t)try{await n({files:t}).unwrap()}catch(c){console.error("Upload failed:",c)}},d=async(a,t)=>{try{await n({files:t,path:a}).unwrap()}catch(c){console.error("Upload failed:",c)}},h=async(a,t)=>{try{await p({name:t,path:a}).unwrap()}catch(c){console.error("Create folder failed:",c)}},u=g.useMemo(()=>l?.toSorted((a,t)=>a.type==="directory"&&t.type!=="directory"?-1:a.type!=="directory"&&t.type==="directory"?1:a.name.localeCompare(t.name)).map(a=>e.jsx(j,{node:a,onDelete:o,onChange:i,disableActions:s,onUpload:d,onCreateFolder:h},a.name)),[l,s,i]);return e.jsxs("div",{className:"overflow-auto h-full max-w-[800px] rounded-xl border",children:[e.jsxs("div",{className:"sticky top-0 bg-white flex items-center gap-2 py-1 px-2 border-b group",children:[e.jsx("div",{className:"w-4"}),e.jsx("div",{className:"flex flex-grow items-center gap-2 ml-2",children:e.jsx("span",{className:"text-sm font-semibold",children:"Name"})}),e.jsx("div",{className:"flex w-24 items-center gap-2 ml-2",children:e.jsx("span",{className:"text-sm font-semibold",children:"Size"})}),!s&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"file",multiple:!0,onChange:f,className:"hidden",id:"file-upload"}),e.jsxs("label",{htmlFor:"file-upload",className:"hover:text-blue-500 p-1 hover:bg-muted rounded-sm cursor-pointer",children:[e.jsx(y,{size:16}),e.jsx("span",{className:"sr-only",children:"Upload files"})]})]})]}),u]})}export{ie as F};
|
|
1
|
+
import{p as e,a as g,x as w}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{a as v,r as k,t as F,v as z,w as C,u as $,x as M,n as D}from"./utils-oJIM4U5n.js";import{S as U,c as _}from"./index-B-2LEQwB.js";import{U as y}from"./upload-DhJ5wU_H.js";import{F as H,T as L}from"./trash-UKLAaALv.js";import{c as m}from"./createLucideIcon-BvSqmaUO.js";import{C as S}from"./chevron-down-qxzqwz13.js";const T=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],I=m("copy",T);const V=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],P=m("file-text",V);const E=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],q=m("file",E);const Z=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],G=m("folder-open",Z);const Q=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],R=m("folder",Q),W=_("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function B({className:s,variant:i,asChild:l=!1,...o}){const n=l?U:"span";return e.jsx(n,{"data-slot":"badge",className:v(W({variant:i}),s),...o})}const O=["txt","md","html","pdf"],J=["svg","webp","png","jpeg","jpg"],K=[{Icon:H,test:s=>J.some(i=>s.name.endsWith(i))},{Icon:P,test:s=>O.some(i=>s.name.endsWith(i))}],X={Icon:q},j=({node:s,level:i=0,onDelete:l,onChange:o,disableActions:n,onUpload:p,onCreateFolder:f})=>{const[d,h]=g.useState(!1),{data:u}=$(),a=K.find(r=>r.test(s))??X,t=s.type==="directory",c=t||o?"div":w,b=()=>{t&&h(!d)},N=r=>{const x=r.target.files;x&&p&&p(s.path,x)};return e.jsxs("div",{className:"select-none",children:[e.jsxs(c,{to:`/${s.relativePath}`,target:"_blank",className:"flex items-center gap-2 h-10 p-2 group hover:bg-muted/50 cursor-pointer",style:{paddingLeft:`calc(0.5rem + ${i*20}px)`},onClick:t?b:o?()=>o(s.isLarge?`${u?.largeFilesUrl}/${s.relativePath}`:s.relativePath):void 0,children:[t?e.jsx(S,{size:16,className:v("transition-transform",{"rotate-180":d})}):e.jsx("div",{className:"w-4"}),e.jsxs("div",{className:"flex flex-grow w-24 items-center gap-2 ml-2",children:[t?d?e.jsx(G,{size:16,className:"text-yellow-500"}):e.jsx(R,{size:16,className:"text-yellow-500"}):e.jsx(a.Icon,{size:16,className:" text-gray-500"}),e.jsxs("span",{className:"flex gap-2 items-center text-sm whitespace-nowrap text-ellipsis overflow-hidden w-full",children:[!t&&s.isLarge&&e.jsx(B,{variant:"outline",children:"Large"}),s.name]})]}),e.jsx("div",{className:"flex w-24 justify-end gap-2",children:e.jsx("span",{className:"text-sm text-gray-500",children:t?"--":M(s.size)})}),!n&&e.jsxs("div",{className:"flex items-center gap-1 ml-4 group-hover:visible invisible z-50",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"file",multiple:!0,onChange:N,className:"hidden",id:`dir-upload-${s.name}-${i}`}),e.jsxs("label",{htmlFor:`dir-upload-${s.name}-${i}`,className:"hover:text-blue-500 p-1 hover:bg-muted rounded-sm cursor-pointer",onClick:r=>{r.stopPropagation()},children:[e.jsx(y,{size:16}),e.jsx("span",{className:"sr-only",children:"Upload files to this folder"})]})]}),e.jsxs("button",{className:D("hover:text-yellow-500 p-1 hover:bg-muted rounded-sm",t&&"hidden"),onClick:r=>{r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(s.path)},children:[e.jsx(I,{size:16}),e.jsx("span",{className:"sr-only",children:"Copy file URL"})]}),e.jsxs("button",{className:"hover:text-red-500 p-1 hover:bg-muted rounded-sm",onClick:r=>{r.preventDefault(),r.stopPropagation(),l(s.path)},children:[e.jsx(L,{size:16}),e.jsxs("span",{className:"sr-only",children:["Delete this ",t?"folder":"file"]})]})]})]}),t&&d&&s.children&&e.jsx("div",{children:s.children.map((r,x)=>e.jsx(j,{node:r,level:i+1,onDelete:l,onChange:o,disableActions:n,onUpload:p,onCreateFolder:f},`${r.name}-${x}`))})]})};function ie({disableActions:s,onChange:i}){const{data:l}=k(),[o]=F(),[n]=z(),[p]=C(),f=async a=>{const t=a.target.files;if(t)try{await n({files:t}).unwrap()}catch(c){console.error("Upload failed:",c)}},d=async(a,t)=>{try{await n({files:t,path:a}).unwrap()}catch(c){console.error("Upload failed:",c)}},h=async(a,t)=>{try{await p({name:t,path:a}).unwrap()}catch(c){console.error("Create folder failed:",c)}},u=g.useMemo(()=>l?.toSorted((a,t)=>a.type==="directory"&&t.type!=="directory"?-1:a.type!=="directory"&&t.type==="directory"?1:a.name.localeCompare(t.name)).map(a=>e.jsx(j,{node:a,onDelete:o,onChange:i,disableActions:s,onUpload:d,onCreateFolder:h},a.name)),[l,s,i]);return e.jsxs("div",{className:"overflow-auto h-full max-w-[800px] rounded-xl border",children:[e.jsxs("div",{className:"sticky top-0 bg-white flex items-center gap-2 py-1 px-2 border-b group",children:[e.jsx("div",{className:"w-4"}),e.jsx("div",{className:"flex flex-grow items-center gap-2 ml-2",children:e.jsx("span",{className:"text-sm font-semibold",children:"Name"})}),e.jsx("div",{className:"flex w-24 items-center gap-2 ml-2",children:e.jsx("span",{className:"text-sm font-semibold",children:"Size"})}),!s&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"file",multiple:!0,onChange:f,className:"hidden",id:"file-upload"}),e.jsxs("label",{htmlFor:"file-upload",className:"hover:text-blue-500 p-1 hover:bg-muted rounded-sm cursor-pointer",children:[e.jsx(y,{size:16}),e.jsx("span",{className:"sr-only",children:"Upload files"})]})]})]}),u]})}export{ie as F,q as a};
|