@isardsat/editorial-admin 6.19.0 → 6.19.2

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.
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html><html lang="en" class="min-h-screen"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Editorial Admin</title><meta name="robots" content="noindex"/><link rel="icon" type="image/ico" href="/admin/favicon.ico"/><link rel="modulepreload" href="/assets/manifest-a01080e9.js"/><link rel="modulepreload" href="/assets/entry.client-C94uvdU2.js"/><link rel="modulepreload" href="/assets/chunk-EPOLDU6W-CiSVlmCe.js"/><link rel="modulepreload" href="/assets/index-DLIEpuwL.js"/><link rel="modulepreload" href="/assets/root-CLpfMQQt.js"/><link rel="modulepreload" href="/assets/index-CZSVchcX.js"/><link rel="modulepreload" href="/assets/loader-circle-BDUbeTTe.js"/><link rel="modulepreload" href="/assets/createLucideIcon-BvSqmaUO.js"/><link rel="modulepreload" href="/assets/circle-check-C6CxUIig.js"/><link rel="modulepreload" href="/assets/utils-CCKKso3e.js"/><link rel="modulepreload" href="/assets/authSlice-BI_rlf3v.js"/><link rel="modulepreload" href="/assets/Loading-MKgXMPvl.js"/><link rel="stylesheet" href="/assets/root-D5WeoLDH.css"/></head><body class="h-full min-h-screen bg-background font-sans antialiased"><div class="flex gap-1 items-center justify-center min-h-screen"><svg xmlns="http://www.w3.org/2000/svg" width="28px" height="28px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-loader-circle animate-spin"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg><p class="text-gray-600">Loading Editorial...</p></div><section aria-label="Notifications alt+T" tabindex="-1" aria-live="polite" aria-relevant="additions text" aria-atomic="false"></section><script>window.__reactRouterContext = {"basename":"/","future":{"unstable_optimizeDeps":false,"unstable_subResourceIntegrity":false,"unstable_trailingSlashAwareDataRequests":false,"v8_middleware":false,"v8_splitRouteModules":false,"v8_viteEnvironmentApi":false},"routeDiscovery":{"mode":"initial"},"ssr":false,"isSpaMode":true};window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());</script><script type="module" async="">import "/assets/manifest-a01080e9.js";
1
+ <!DOCTYPE html><html lang="en" class="min-h-screen"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Editorial Admin</title><meta name="robots" content="noindex"/><link rel="icon" type="image/ico" href="/admin/favicon.ico"/><link rel="modulepreload" href="/assets/manifest-a21d1f62.js"/><link rel="modulepreload" href="/assets/entry.client-C94uvdU2.js"/><link rel="modulepreload" href="/assets/chunk-EPOLDU6W-CiSVlmCe.js"/><link rel="modulepreload" href="/assets/index-DLIEpuwL.js"/><link rel="modulepreload" href="/assets/root-CLpfMQQt.js"/><link rel="modulepreload" href="/assets/index-CZSVchcX.js"/><link rel="modulepreload" href="/assets/loader-circle-BDUbeTTe.js"/><link rel="modulepreload" href="/assets/createLucideIcon-BvSqmaUO.js"/><link rel="modulepreload" href="/assets/circle-check-C6CxUIig.js"/><link rel="modulepreload" href="/assets/utils-CCKKso3e.js"/><link rel="modulepreload" href="/assets/authSlice-BI_rlf3v.js"/><link rel="modulepreload" href="/assets/Loading-MKgXMPvl.js"/><link rel="stylesheet" href="/assets/root-D5WeoLDH.css"/></head><body class="h-full min-h-screen bg-background font-sans antialiased"><div class="flex gap-1 items-center justify-center min-h-screen"><svg xmlns="http://www.w3.org/2000/svg" width="28px" height="28px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-loader-circle animate-spin"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg><p class="text-gray-600">Loading Editorial...</p></div><section aria-label="Notifications alt+T" tabindex="-1" aria-live="polite" aria-relevant="additions text" aria-atomic="false"></section><script>window.__reactRouterContext = {"basename":"/","future":{"unstable_optimizeDeps":false,"unstable_subResourceIntegrity":false,"unstable_trailingSlashAwareDataRequests":false,"v8_middleware":false,"v8_splitRouteModules":false,"v8_viteEnvironmentApi":false},"routeDiscovery":{"mode":"initial"},"ssr":false,"isSpaMode":true};window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());</script><script type="module" async="">import "/assets/manifest-a21d1f62.js";
2
2
  import * as route0 from "/assets/root-CLpfMQQt.js";
3
3
 
4
4
  window.__reactRouterRouteModules = {"root":route0};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isardsat/editorial-admin",
3
- "version": "6.19.0",
3
+ "version": "6.19.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -78,7 +78,7 @@
78
78
  "tailwindcss-animate": "^1.0.7",
79
79
  "vaul": "^1.1.2",
80
80
  "zod": "^4.1.11",
81
- "@isardsat/editorial-common": "^6.19.0"
81
+ "@isardsat/editorial-common": "^6.19.2"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@react-router/dev": "^7.7.0",
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilePicker-CRgpF9yp.js","assets/chunk-EPOLDU6W-CiSVlmCe.js","assets/utils-CCKKso3e.js","assets/files-Cdeyho5X.js","assets/index-CZSVchcX.js","assets/index-DLIEpuwL.js","assets/badge-gLcN3Bjg.js","assets/index-CtLWaleL.js","assets/upload-DhJ5wU_H.js","assets/createLucideIcon-BvSqmaUO.js","assets/trash-UKLAaALv.js","assets/x-BVtfHpQX.js","assets/check-DF0ucE8d.js","assets/index-BhARCKRr.js","assets/input-Bk91TMQj.js","assets/external-link-ERgO2SVI.js","assets/markdownEditor-WUG-CxJI.js","assets/authSlice-BI_rlf3v.js","assets/index-cCny74f5.js","assets/zod-BFfp0fV9.js","assets/index-CHzEoQKp.js","assets/schemas-CPJfa6mm.js","assets/index-B0u0hYGX.js","assets/index-B2dzkZu5.js","assets/index-B3bJjaCJ.js","assets/alert-dialog-CN-uuUVp.js","assets/schemas-CsWpUuhN.js","assets/loader-circle-BDUbeTTe.js","assets/markdownEditor-Dha_UaaS.css","assets/date-picker-Dgbvfw_1.js","assets/clear-button-D05R9Y5Y.js","assets/chevron-right-BFlMu-RJ.js","assets/calendar-Frbsxn98.js","assets/datetime-picker-De7vM6e7.js","assets/URLInput-CPrLDhlu.js","assets/ColorPicker-kqchGTe4.js"])))=>i.map(i=>d[i]);
2
- import{R as V,p as e,a as l,A as _t,v as Tt,z as Pt}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{B as Rt}from"./badge-gLcN3Bjg.js";import{c as Xe,e as Te,u as ke,P as F,a as M,d as Z,B as Ve}from"./index-BhARCKRr.js";import{g as Dt,u as Mt,a as At,F as Ot,b as me,c as fe,d as ce,e as he,f as xe,C as Fe,h as Ee}from"./zod-BFfp0fV9.js";import{I as _e}from"./input-Bk91TMQj.js";import{a as Ze}from"./index-DLIEpuwL.js";import{u as H}from"./index-CtLWaleL.js";import{u as Oe,b as Lt,c as kt,h as Vt,d as Ft,e as Bt,F as Ht,f as zt}from"./index-cCny74f5.js";import{c as Qe,R as Ut,V as $t,A as Wt,C as Kt,a as qt}from"./index-B2dzkZu5.js";import{b as B,z as Gt,A as Yt,h as Xt,n as Zt}from"./utils-CCKKso3e.js";import{C as Je,X as Be}from"./x-BVtfHpQX.js";import{C as Qt}from"./check-DF0ucE8d.js";import{c as et}from"./createLucideIcon-BvSqmaUO.js";import{A as Jt,b as eo,c as to,d as oo,e as no,f as so,g as ro,h as ao}from"./alert-dialog-CN-uuUVp.js";import{R as lo}from"./schemas-CsWpUuhN.js";import{t as ie}from"./index-CZSVchcX.js";import{L as co}from"./loader-circle-BDUbeTTe.js";import{s as X,_ as He,u as io,n as uo,l as po,o as mo,a as fo}from"./schemas-CPJfa6mm.js";const ho=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],xo=et("chevron-up",ho);const go=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],vo=et("save",go);function ze(o){if(!o||o.length!==1)return null;const n=o[0].match(/^\$(.+)$/);return n?n[1]:null}const So="modulepreload",Co=function(o){return"/"+o},Ue={},re=function(n,t,p){let m=Promise.resolve();if(t&&t.length>0){let f=function(x){return Promise.all(x.map(S=>Promise.resolve(S).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),i=c?.nonce||c?.getAttribute("nonce");m=f(t.map(x=>{if(x=Co(x),x in Ue)return;Ue[x]=!0;const S=x.endsWith(".css"),y=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${x}"]${y}`))return;const b=document.createElement("link");if(b.rel=S?"stylesheet":So,S||(b.as="script"),b.crossOrigin="",b.href=x,i&&b.setAttribute("nonce",i),document.head.appendChild(b),S)return new Promise((N,E)=>{b.addEventListener("load",N),b.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${x}`)))})}))}function h(c){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=c,window.dispatchEvent(i),!i.defaultPrevented)throw c}return m.then(c=>{for(const i of c||[])i.status==="rejected"&&h(i.reason);return n().catch(h)})};function $e(o,[n,t]){return Math.min(t,Math.max(n,o))}function wo(o){const n=o+"CollectionProvider",[t,p]=Xe(n),[m,h]=t(n,{collectionRef:{current:null},itemMap:new Map}),c=s=>{const{scope:v,children:I}=s,g=V.useRef(null),C=V.useRef(new Map).current;return e.jsx(m,{scope:v,itemMap:C,collectionRef:g,children:I})};c.displayName=n;const i=o+"CollectionSlot",f=Te(i),x=V.forwardRef((s,v)=>{const{scope:I,children:g}=s,C=h(i,I),P=H(v,C.collectionRef);return e.jsx(f,{ref:P,children:g})});x.displayName=i;const S=o+"CollectionItemSlot",y="data-radix-collection-item",b=Te(S),N=V.forwardRef((s,v)=>{const{scope:I,children:g,...C}=s,P=V.useRef(null),r=H(v,P),a=h(S,I);return V.useEffect(()=>(a.itemMap.set(P,{ref:P,...C}),()=>{a.itemMap.delete(P)})),e.jsx(b,{[y]:"",ref:r,children:g})});N.displayName=S;function E(s){const v=h(o+"CollectionConsumer",s);return V.useCallback(()=>{const g=v.collectionRef.current;if(!g)return[];const C=Array.from(g.querySelectorAll(`[${y}]`));return Array.from(v.itemMap.values()).sort((a,d)=>C.indexOf(a.ref.current)-C.indexOf(d.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:x,ItemSlot:N},E,p]}var yo=l.createContext(void 0);function bo(o){const n=l.useContext(yo);return o||n||"ltr"}var jo=[" ","Enter","ArrowUp","ArrowDown"],Io=[" ","Enter"],oe="Select",[ve,Se,No]=wo(oe),[ae]=Xe(oe,[No,Qe]),Ce=Qe(),[Eo,Q]=ae(oe),[_o,To]=ae(oe),tt=o=>{const{__scopeSelect:n,children:t,open:p,defaultOpen:m,onOpenChange:h,value:c,defaultValue:i,onValueChange:f,dir:x,name:S,autoComplete:y,disabled:b,required:N,form:E}=o,s=Ce(n),[v,I]=l.useState(null),[g,C]=l.useState(null),[P,r]=l.useState(!1),a=bo(x),[d,u]=ke({prop:p,defaultProp:m??!1,onChange:h,caller:oe}),[O,z]=ke({prop:c,defaultProp:i,onChange:f,caller:oe}),j=l.useRef(null),A=v?E||!!v.closest("form"):!0,[$,K]=l.useState(new Set),q=Array.from($).map(L=>L.props.value).join(";");return e.jsx(Ut,{...s,children:e.jsxs(Eo,{required:N,scope:n,trigger:v,onTriggerChange:I,valueNode:g,onValueNodeChange:C,valueNodeHasChildren:P,onValueNodeHasChildrenChange:r,contentId:Oe(),value:O,onValueChange:z,open:d,onOpenChange:u,dir:a,triggerPointerDownPosRef:j,disabled:b,children:[e.jsx(ve.Provider,{scope:n,children:e.jsx(_o,{scope:o.__scopeSelect,onNativeOptionAdd:l.useCallback(L=>{K(W=>new Set(W).add(L))},[]),onNativeOptionRemove:l.useCallback(L=>{K(W=>{const G=new Set(W);return G.delete(L),G})},[]),children:t})}),A?e.jsxs(jt,{"aria-hidden":!0,required:N,tabIndex:-1,name:S,autoComplete:y,value:O,onChange:L=>z(L.target.value),disabled:b,form:E,children:[O===void 0?e.jsx("option",{value:""}):null,Array.from($)]},q):null]})})};tt.displayName=oe;var ot="SelectTrigger",nt=l.forwardRef((o,n)=>{const{__scopeSelect:t,disabled:p=!1,...m}=o,h=Ce(t),c=Q(ot,t),i=c.disabled||p,f=H(n,c.onTriggerChange),x=Se(t),S=l.useRef("touch"),[y,b,N]=Nt(s=>{const v=x().filter(C=>!C.disabled),I=v.find(C=>C.value===c.value),g=Et(v,s,I);g!==void 0&&c.onValueChange(g.value)}),E=s=>{i||(c.onOpenChange(!0),N()),s&&(c.triggerPointerDownPosRef.current={x:Math.round(s.pageX),y:Math.round(s.pageY)})};return e.jsx(Wt,{asChild:!0,...h,children:e.jsx(F.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":It(c.value)?"":void 0,...m,ref:f,onClick:M(m.onClick,s=>{s.currentTarget.focus(),S.current!=="mouse"&&E(s)}),onPointerDown:M(m.onPointerDown,s=>{S.current=s.pointerType;const v=s.target;v.hasPointerCapture(s.pointerId)&&v.releasePointerCapture(s.pointerId),s.button===0&&s.ctrlKey===!1&&s.pointerType==="mouse"&&(E(s),s.preventDefault())}),onKeyDown:M(m.onKeyDown,s=>{const v=y.current!=="";!(s.ctrlKey||s.altKey||s.metaKey)&&s.key.length===1&&b(s.key),!(v&&s.key===" ")&&jo.includes(s.key)&&(E(),s.preventDefault())})})})});nt.displayName=ot;var st="SelectValue",rt=l.forwardRef((o,n)=>{const{__scopeSelect:t,className:p,style:m,children:h,placeholder:c="",...i}=o,f=Q(st,t),{onValueNodeHasChildrenChange:x}=f,S=h!==void 0,y=H(n,f.onValueNodeChange);return Z(()=>{x(S)},[x,S]),e.jsx(F.span,{...i,ref:y,style:{pointerEvents:"none"},children:It(f.value)?e.jsx(e.Fragment,{children:c}):h})});rt.displayName=st;var Po="SelectIcon",at=l.forwardRef((o,n)=>{const{__scopeSelect:t,children:p,...m}=o;return e.jsx(F.span,{"aria-hidden":!0,...m,ref:n,children:p||"▼"})});at.displayName=Po;var Ro="SelectPortal",lt=o=>e.jsx(Lt,{asChild:!0,...o});lt.displayName=Ro;var ne="SelectContent",ct=l.forwardRef((o,n)=>{const t=Q(ne,o.__scopeSelect),[p,m]=l.useState();if(Z(()=>{m(new DocumentFragment)},[]),!t.open){const h=p;return h?Ze.createPortal(e.jsx(it,{scope:o.__scopeSelect,children:e.jsx(ve.Slot,{scope:o.__scopeSelect,children:e.jsx("div",{children:o.children})})}),h):null}return e.jsx(dt,{...o,ref:n})});ct.displayName=ne;var U=10,[it,J]=ae(ne),Do="SelectContentImpl",Mo=Te("SelectContent.RemoveScroll"),dt=l.forwardRef((o,n)=>{const{__scopeSelect:t,position:p="item-aligned",onCloseAutoFocus:m,onEscapeKeyDown:h,onPointerDownOutside:c,side:i,sideOffset:f,align:x,alignOffset:S,arrowPadding:y,collisionBoundary:b,collisionPadding:N,sticky:E,hideWhenDetached:s,avoidCollisions:v,...I}=o,g=Q(ne,t),[C,P]=l.useState(null),[r,a]=l.useState(null),d=H(n,w=>P(w)),[u,O]=l.useState(null),[z,j]=l.useState(null),A=Se(t),[$,K]=l.useState(!1),q=l.useRef(!1);l.useEffect(()=>{if(C)return Vt(C)},[C]),Ft();const L=l.useCallback(w=>{const[R,...k]=A().map(D=>D.ref.current),[_]=k.slice(-1),T=document.activeElement;for(const D of w)if(D===T||(D?.scrollIntoView({block:"nearest"}),D===R&&r&&(r.scrollTop=0),D===_&&r&&(r.scrollTop=r.scrollHeight),D?.focus(),document.activeElement!==T))return},[A,r]),W=l.useCallback(()=>L([u,C]),[L,u,C]);l.useEffect(()=>{$&&W()},[$,W]);const{onOpenChange:G,triggerPointerDownPosRef:Y}=g;l.useEffect(()=>{if(C){let w={x:0,y:0};const R=_=>{w={x:Math.abs(Math.round(_.pageX)-(Y.current?.x??0)),y:Math.abs(Math.round(_.pageY)-(Y.current?.y??0))}},k=_=>{w.x<=10&&w.y<=10?_.preventDefault():C.contains(_.target)||G(!1),document.removeEventListener("pointermove",R),Y.current=null};return Y.current!==null&&(document.addEventListener("pointermove",R),document.addEventListener("pointerup",k,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",R),document.removeEventListener("pointerup",k,{capture:!0})}}},[C,G,Y]),l.useEffect(()=>{const w=()=>G(!1);return window.addEventListener("blur",w),window.addEventListener("resize",w),()=>{window.removeEventListener("blur",w),window.removeEventListener("resize",w)}},[G]);const[we,ue]=Nt(w=>{const R=A().filter(T=>!T.disabled),k=R.find(T=>T.ref.current===document.activeElement),_=Et(R,w,k);_&&setTimeout(()=>_.ref.current.focus())}),ye=l.useCallback((w,R,k)=>{const _=!q.current&&!k;(g.value!==void 0&&g.value===R||_)&&(O(w),_&&(q.current=!0))},[g.value]),be=l.useCallback(()=>C?.focus(),[C]),se=l.useCallback((w,R,k)=>{const _=!q.current&&!k;(g.value!==void 0&&g.value===R||_)&&j(w)},[g.value]),pe=p==="popper"?Pe:ut,le=pe===Pe?{side:i,sideOffset:f,align:x,alignOffset:S,arrowPadding:y,collisionBoundary:b,collisionPadding:N,sticky:E,hideWhenDetached:s,avoidCollisions:v}:{};return e.jsx(it,{scope:t,content:C,viewport:r,onViewportChange:a,itemRefCallback:ye,selectedItem:u,onItemLeave:be,itemTextRefCallback:se,focusSelectedItem:W,selectedItemText:z,position:p,isPositioned:$,searchRef:we,children:e.jsx(Bt,{as:Mo,allowPinchZoom:!0,children:e.jsx(Ht,{asChild:!0,trapped:g.open,onMountAutoFocus:w=>{w.preventDefault()},onUnmountAutoFocus:M(m,w=>{g.trigger?.focus({preventScroll:!0}),w.preventDefault()}),children:e.jsx(zt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:h,onPointerDownOutside:c,onFocusOutside:w=>w.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:e.jsx(pe,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:w=>w.preventDefault(),...I,...le,onPlaced:()=>K(!0),ref:d,style:{display:"flex",flexDirection:"column",outline:"none",...I.style},onKeyDown:M(I.onKeyDown,w=>{const R=w.ctrlKey||w.altKey||w.metaKey;if(w.key==="Tab"&&w.preventDefault(),!R&&w.key.length===1&&ue(w.key),["ArrowUp","ArrowDown","Home","End"].includes(w.key)){let _=A().filter(T=>!T.disabled).map(T=>T.ref.current);if(["ArrowUp","End"].includes(w.key)&&(_=_.slice().reverse()),["ArrowUp","ArrowDown"].includes(w.key)){const T=w.target,D=_.indexOf(T);_=_.slice(D+1)}setTimeout(()=>L(_)),w.preventDefault()}})})})})})})});dt.displayName=Do;var Ao="SelectItemAlignedPosition",ut=l.forwardRef((o,n)=>{const{__scopeSelect:t,onPlaced:p,...m}=o,h=Q(ne,t),c=J(ne,t),[i,f]=l.useState(null),[x,S]=l.useState(null),y=H(n,d=>S(d)),b=Se(t),N=l.useRef(!1),E=l.useRef(!0),{viewport:s,selectedItem:v,selectedItemText:I,focusSelectedItem:g}=c,C=l.useCallback(()=>{if(h.trigger&&h.valueNode&&i&&x&&s&&v&&I){const d=h.trigger.getBoundingClientRect(),u=x.getBoundingClientRect(),O=h.valueNode.getBoundingClientRect(),z=I.getBoundingClientRect();if(h.dir!=="rtl"){const T=z.left-u.left,D=O.left-T,ee=d.left-D,te=d.width+ee,je=Math.max(te,u.width),Ie=window.innerWidth-U,Ne=$e(D,[U,Math.max(U,Ie-je)]);i.style.minWidth=te+"px",i.style.left=Ne+"px"}else{const T=u.right-z.right,D=window.innerWidth-O.right-T,ee=window.innerWidth-d.right-D,te=d.width+ee,je=Math.max(te,u.width),Ie=window.innerWidth-U,Ne=$e(D,[U,Math.max(U,Ie-je)]);i.style.minWidth=te+"px",i.style.right=Ne+"px"}const j=b(),A=window.innerHeight-U*2,$=s.scrollHeight,K=window.getComputedStyle(x),q=parseInt(K.borderTopWidth,10),L=parseInt(K.paddingTop,10),W=parseInt(K.borderBottomWidth,10),G=parseInt(K.paddingBottom,10),Y=q+L+$+G+W,we=Math.min(v.offsetHeight*5,Y),ue=window.getComputedStyle(s),ye=parseInt(ue.paddingTop,10),be=parseInt(ue.paddingBottom,10),se=d.top+d.height/2-U,pe=A-se,le=v.offsetHeight/2,w=v.offsetTop+le,R=q+L+w,k=Y-R;if(R<=se){const T=j.length>0&&v===j[j.length-1].ref.current;i.style.bottom="0px";const D=x.clientHeight-s.offsetTop-s.offsetHeight,ee=Math.max(pe,le+(T?be:0)+D+W),te=R+ee;i.style.height=te+"px"}else{const T=j.length>0&&v===j[0].ref.current;i.style.top="0px";const ee=Math.max(se,q+s.offsetTop+(T?ye:0)+le)+k;i.style.height=ee+"px",s.scrollTop=R-se+s.offsetTop}i.style.margin=`${U}px 0`,i.style.minHeight=we+"px",i.style.maxHeight=A+"px",p?.(),requestAnimationFrame(()=>N.current=!0)}},[b,h.trigger,h.valueNode,i,x,s,v,I,h.dir,p]);Z(()=>C(),[C]);const[P,r]=l.useState();Z(()=>{x&&r(window.getComputedStyle(x).zIndex)},[x]);const a=l.useCallback(d=>{d&&E.current===!0&&(C(),g?.(),E.current=!1)},[C,g]);return e.jsx(Lo,{scope:t,contentWrapper:i,shouldExpandOnScrollRef:N,onScrollButtonChange:a,children:e.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:e.jsx(F.div,{...m,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...m.style}})})})});ut.displayName=Ao;var Oo="SelectPopperPosition",Pe=l.forwardRef((o,n)=>{const{__scopeSelect:t,align:p="start",collisionPadding:m=U,...h}=o,c=Ce(t);return e.jsx(Kt,{...c,...h,ref:n,align:p,collisionPadding:m,style:{boxSizing:"border-box",...h.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Pe.displayName=Oo;var[Lo,Le]=ae(ne,{}),Re="SelectViewport",pt=l.forwardRef((o,n)=>{const{__scopeSelect:t,nonce:p,...m}=o,h=J(Re,t),c=Le(Re,t),i=H(n,h.onViewportChange),f=l.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:p}),e.jsx(ve.Slot,{scope:t,children:e.jsx(F.div,{"data-radix-select-viewport":"",role:"presentation",...m,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...m.style},onScroll:M(m.onScroll,x=>{const S=x.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:b}=c;if(b?.current&&y){const N=Math.abs(f.current-S.scrollTop);if(N>0){const E=window.innerHeight-U*2,s=parseFloat(y.style.minHeight),v=parseFloat(y.style.height),I=Math.max(s,v);if(I<E){const g=I+N,C=Math.min(E,g),P=g-C;y.style.height=C+"px",y.style.bottom==="0px"&&(S.scrollTop=P>0?P:0,y.style.justifyContent="flex-end")}}}f.current=S.scrollTop})})})]})});pt.displayName=Re;var mt="SelectGroup",[ko,Vo]=ae(mt),Fo=l.forwardRef((o,n)=>{const{__scopeSelect:t,...p}=o,m=Oe();return e.jsx(ko,{scope:t,id:m,children:e.jsx(F.div,{role:"group","aria-labelledby":m,...p,ref:n})})});Fo.displayName=mt;var ft="SelectLabel",Bo=l.forwardRef((o,n)=>{const{__scopeSelect:t,...p}=o,m=Vo(ft,t);return e.jsx(F.div,{id:m.id,...p,ref:n})});Bo.displayName=ft;var ge="SelectItem",[Ho,ht]=ae(ge),xt=l.forwardRef((o,n)=>{const{__scopeSelect:t,value:p,disabled:m=!1,textValue:h,...c}=o,i=Q(ge,t),f=J(ge,t),x=i.value===p,[S,y]=l.useState(h??""),[b,N]=l.useState(!1),E=H(n,g=>f.itemRefCallback?.(g,p,m)),s=Oe(),v=l.useRef("touch"),I=()=>{m||(i.onValueChange(p),i.onOpenChange(!1))};if(p==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(Ho,{scope:t,value:p,disabled:m,textId:s,isSelected:x,onItemTextChange:l.useCallback(g=>{y(C=>C||(g?.textContent??"").trim())},[]),children:e.jsx(ve.ItemSlot,{scope:t,value:p,disabled:m,textValue:S,children:e.jsx(F.div,{role:"option","aria-labelledby":s,"data-highlighted":b?"":void 0,"aria-selected":x&&b,"data-state":x?"checked":"unchecked","aria-disabled":m||void 0,"data-disabled":m?"":void 0,tabIndex:m?void 0:-1,...c,ref:E,onFocus:M(c.onFocus,()=>N(!0)),onBlur:M(c.onBlur,()=>N(!1)),onClick:M(c.onClick,()=>{v.current!=="mouse"&&I()}),onPointerUp:M(c.onPointerUp,()=>{v.current==="mouse"&&I()}),onPointerDown:M(c.onPointerDown,g=>{v.current=g.pointerType}),onPointerMove:M(c.onPointerMove,g=>{v.current=g.pointerType,m?f.onItemLeave?.():v.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:M(c.onPointerLeave,g=>{g.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:M(c.onKeyDown,g=>{f.searchRef?.current!==""&&g.key===" "||(Io.includes(g.key)&&I(),g.key===" "&&g.preventDefault())})})})})});xt.displayName=ge;var de="SelectItemText",gt=l.forwardRef((o,n)=>{const{__scopeSelect:t,className:p,style:m,...h}=o,c=Q(de,t),i=J(de,t),f=ht(de,t),x=To(de,t),[S,y]=l.useState(null),b=H(n,I=>y(I),f.onItemTextChange,I=>i.itemTextRefCallback?.(I,f.value,f.disabled)),N=S?.textContent,E=l.useMemo(()=>e.jsx("option",{value:f.value,disabled:f.disabled,children:N},f.value),[f.disabled,f.value,N]),{onNativeOptionAdd:s,onNativeOptionRemove:v}=x;return Z(()=>(s(E),()=>v(E)),[s,v,E]),e.jsxs(e.Fragment,{children:[e.jsx(F.span,{id:f.textId,...h,ref:b}),f.isSelected&&c.valueNode&&!c.valueNodeHasChildren?Ze.createPortal(h.children,c.valueNode):null]})});gt.displayName=de;var vt="SelectItemIndicator",St=l.forwardRef((o,n)=>{const{__scopeSelect:t,...p}=o;return ht(vt,t).isSelected?e.jsx(F.span,{"aria-hidden":!0,...p,ref:n}):null});St.displayName=vt;var De="SelectScrollUpButton",Ct=l.forwardRef((o,n)=>{const t=J(De,o.__scopeSelect),p=Le(De,o.__scopeSelect),[m,h]=l.useState(!1),c=H(n,p.onScrollButtonChange);return Z(()=>{if(t.viewport&&t.isPositioned){let i=function(){const x=f.scrollTop>0;h(x)};const f=t.viewport;return i(),f.addEventListener("scroll",i),()=>f.removeEventListener("scroll",i)}},[t.viewport,t.isPositioned]),m?e.jsx(yt,{...o,ref:c,onAutoScroll:()=>{const{viewport:i,selectedItem:f}=t;i&&f&&(i.scrollTop=i.scrollTop-f.offsetHeight)}}):null});Ct.displayName=De;var Me="SelectScrollDownButton",wt=l.forwardRef((o,n)=>{const t=J(Me,o.__scopeSelect),p=Le(Me,o.__scopeSelect),[m,h]=l.useState(!1),c=H(n,p.onScrollButtonChange);return Z(()=>{if(t.viewport&&t.isPositioned){let i=function(){const x=f.scrollHeight-f.clientHeight,S=Math.ceil(f.scrollTop)<x;h(S)};const f=t.viewport;return i(),f.addEventListener("scroll",i),()=>f.removeEventListener("scroll",i)}},[t.viewport,t.isPositioned]),m?e.jsx(yt,{...o,ref:c,onAutoScroll:()=>{const{viewport:i,selectedItem:f}=t;i&&f&&(i.scrollTop=i.scrollTop+f.offsetHeight)}}):null});wt.displayName=Me;var yt=l.forwardRef((o,n)=>{const{__scopeSelect:t,onAutoScroll:p,...m}=o,h=J("SelectScrollButton",t),c=l.useRef(null),i=Se(t),f=l.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return l.useEffect(()=>()=>f(),[f]),Z(()=>{i().find(S=>S.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[i]),e.jsx(F.div,{"aria-hidden":!0,...m,ref:n,style:{flexShrink:0,...m.style},onPointerDown:M(m.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(p,50))}),onPointerMove:M(m.onPointerMove,()=>{h.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(p,50))}),onPointerLeave:M(m.onPointerLeave,()=>{f()})})}),zo="SelectSeparator",bt=l.forwardRef((o,n)=>{const{__scopeSelect:t,...p}=o;return e.jsx(F.div,{"aria-hidden":!0,...p,ref:n})});bt.displayName=zo;var Ae="SelectArrow",Uo=l.forwardRef((o,n)=>{const{__scopeSelect:t,...p}=o,m=Ce(t),h=Q(Ae,t),c=J(Ae,t);return h.open&&c.position==="popper"?e.jsx(qt,{...m,...p,ref:n}):null});Uo.displayName=Ae;var $o="SelectBubbleInput",jt=l.forwardRef(({__scopeSelect:o,value:n,...t},p)=>{const m=l.useRef(null),h=H(p,m),c=Dt(n);return l.useEffect(()=>{const i=m.current;if(!i)return;const f=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(f,"value").set;if(c!==n&&S){const y=new Event("change",{bubbles:!0});S.call(i,n),i.dispatchEvent(y)}},[c,n]),e.jsx(F.select,{...t,style:{...$t,...t.style},ref:h,defaultValue:n})});jt.displayName=$o;function It(o){return o===""||o===void 0}function Nt(o){const n=kt(o),t=l.useRef(""),p=l.useRef(0),m=l.useCallback(c=>{const i=t.current+c;n(i),(function f(x){t.current=x,window.clearTimeout(p.current),x!==""&&(p.current=window.setTimeout(()=>f(""),1e3))})(i)},[n]),h=l.useCallback(()=>{t.current="",window.clearTimeout(p.current)},[]);return l.useEffect(()=>()=>window.clearTimeout(p.current),[]),[t,m,h]}function Et(o,n,t){const m=n.length>1&&Array.from(n).every(x=>x===n[0])?n[0]:n,h=t?o.indexOf(t):-1;let c=Wo(o,Math.max(h,0));m.length===1&&(c=c.filter(x=>x!==t));const f=c.find(x=>x.textValue.toLowerCase().startsWith(m.toLowerCase()));return f!==t?f:void 0}function Wo(o,n){return o.map((t,p)=>o[(n+p)%o.length])}var Ko=tt,qo=nt,Go=rt,Yo=at,Xo=lt,Zo=ct,Qo=pt,Jo=xt,en=gt,tn=St,on=Ct,nn=wt,Dn=bt;function We({...o}){return e.jsx(Ko,{"data-slot":"select",...o})}function Ke({...o}){return e.jsx(Go,{"data-slot":"select-value",...o})}function qe({className:o,size:n="default",children:t,...p}){return e.jsxs(qo,{"data-slot":"select-trigger","data-size":n,className:B("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),...p,children:[t,e.jsx(Yo,{asChild:!0,children:e.jsx(Je,{className:"size-4 opacity-50"})})]})}function Ge({className:o,children:n,position:t="popper",...p}){return e.jsx(Xo,{children:e.jsxs(Zo,{"data-slot":"select-content",className:B("bg-popover text-popover-foreground 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 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",t==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",o),position:t,...p,children:[e.jsx(sn,{}),e.jsx(Qo,{className:B("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),e.jsx(rn,{})]})})}function Ye({className:o,children:n,...t}){return e.jsxs(Jo,{"data-slot":"select-item",className:B("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),...t,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(tn,{children:e.jsx(Qt,{className:"size-4"})})}),e.jsx(en,{children:n})]})}function sn({className:o,...n}){return e.jsx(on,{"data-slot":"select-scroll-up-button",className:B("flex cursor-default items-center justify-center py-1",o),...n,children:e.jsx(xo,{className:"size-4"})})}function rn({className:o,...n}){return e.jsx(nn,{"data-slot":"select-scroll-down-button",className:B("flex cursor-default items-center justify-center py-1",o),...n,children:e.jsx(Je,{className:"size-4"})})}function an({hasUnsavedChanges:o,title:n="Unsaved Changes",description:t="You have unsaved changes. Are you sure you want to leave this page? Your changes will be lost.",stayButtonText:p="Stay on Page",leaveButtonText:m="Leave Page"}){const h=_t(({currentLocation:S,nextLocation:y})=>o&&S.pathname!==y.pathname),[c,i]=l.useState(!1),f=()=>{h.state==="blocked"&&h.proceed()},x=()=>{h.state==="blocked"&&h.reset()};return l.useEffect(()=>{i(h.state==="blocked")},[h.state,c]),l.useEffect(()=>{const S=y=>{o&&(y.preventDefault(),y.returnValue="")};return o&&window.addEventListener("beforeunload",S),()=>{window.removeEventListener("beforeunload",S)}},[o]),e.jsx(Jt,{open:c,onOpenChange:i,children:e.jsxs(eo,{children:[e.jsxs(to,{children:[e.jsx(oo,{children:n}),e.jsx(no,{children:t})]}),e.jsxs(so,{children:[e.jsx(ro,{onClick:x,children:p}),e.jsx(ao,{onClick:f,children:m})]})]})})}const ln=V.lazy(()=>re(()=>import("./FilePicker-CRgpF9yp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),cn=V.lazy(()=>re(()=>import("./markdownEditor-WUG-CxJI.js"),__vite__mapDeps([16,1,17,2,5,18,13,7,19,20,12,9,21,22,23,24,6,14,11,25,26,4,27,28]))),dn=V.lazy(()=>re(()=>import("./date-picker-Dgbvfw_1.js"),__vite__mapDeps([29,1,13,7,2,5,30,9,31,11,22,18,23,20,32]))),un=V.lazy(()=>re(()=>import("./datetime-picker-De7vM6e7.js"),__vite__mapDeps([33,1,13,7,2,5,30,9,31,11,22,18,23,20,14,32]))),pn=V.lazy(()=>re(()=>import("./URLInput-CPrLDhlu.js"),__vite__mapDeps([34,1,14,2,15,9]))),mn=V.lazy(()=>re(()=>import("./ColorPicker-kqchGTe4.js"),__vite__mapDeps([35,1])));function Mn({itemType:o,fields:n,isSingleton:t,data:p,isNew:m,changedFields:h=[],itemStatus:c}){const i=Tt(),{hash:f}=Pt(),[x]=Gt(),[S]=Yt(),{data:y}=Xt(),b=r=>h.includes(r);l.useEffect(()=>{if(!f)return;const r=f.slice(1),a=document.getElementById(r);a&&(window.scrollTo({top:window.scrollY,behavior:"smooth"}),a.focus())},[f]);const N=l.useMemo(()=>({id:t?"default":p?.id??"",isDraft:String(p?.isDraft??!1),...Object.fromEntries(Object.keys(n).map(r=>{const a=n[r].type,d=p?.[r];return d!=null?a==="boolean"?[r,String(d)]:a==="multiselect"?[r,Array.isArray(d)?d:[d]]:[r,String(d)]:a==="boolean"?[r,"false"]:a==="multiselect"?[r,[]]:[r,""]}))}),[p,n,t]),E=l.useMemo(()=>{const r={id:X().min(1,"ID is required").regex(/^[a-z0-9-]+$/,"ID can only include lowercase letters and numbers"),isDraft:X()};return Object.entries(n).forEach(([a,d])=>{let u;switch(d.type){case"boolean":u=He(["true","false"]);break;case"number":u=uo();break;case"url":u=io("Must be a valid URL");break;case"date":u=X();break;case"datetime":u=X();break;case"color":u=lo;break;case"select":ze(d.choicesFixed)?u=X():d.choicesFixed&&d.choicesFixed.length>0?u=He(d.choicesFixed):u=X();break;case"multiselect":u=fo(X()),d.minSelectedChoices&&(u=u.min(d.minSelectedChoices,`${d.displayName} requires at least ${d.minSelectedChoices} selection${d.minSelectedChoices>1?"s":""}`)),d.maxSelectedChoices&&(u=u.max(d.maxSelectedChoices,`${d.displayName} allows maximum ${d.maxSelectedChoices} selection${d.maxSelectedChoices>1?"s":""}`));break;default:u=X()}d.optional?d.type==="multiselect"?d.minSelectedChoices||(u=u.optional()):u=u.optional().or(po("")):d.type==="multiselect"&&!d.minSelectedChoices?u=u.min(1,`${d.displayName} requires at least one selection`):d.type!=="boolean"&&d.type!=="select"&&(u=u.min(1,`${d.displayName} is required`)),r[a]=u}),mo(r)},[n]),s=Mt({resolver:At(E),defaultValues:N});l.useEffect(()=>{s.reset(N)},[N,s]),l.useEffect(()=>{if(!s)return;const r=window.location.hash;r&&s.setFocus(r.substring(1))},[s]),l.useEffect(()=>{const r=a=>{(a.ctrlKey||a.metaKey)&&a.key==="s"&&(a.preventDefault(),(s.formState.isDirty||m)&&s.handleSubmit(v)())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[s,m,v]);async function v(r){const a={...r,isDraft:r.isDraft==="true",type:o};if(Object.entries(n).forEach(([d,u])=>{u.type==="boolean"&&(a[d]=r[d]==="true")}),m)try{const d=await x(a);"error"in d?ie.error("Failed to create item."):(ie.success("Item created successfully."),i(`/admin/dashboard/${o}/${d.data.id}`))}catch(d){ie.error("Failed to create item."),console.error(d)}else try{await S(a),ie.success("Item updated successfully."),s.reset(r)}catch(d){ie.error("Failed to update item."),console.error(d)}}const I=l.useMemo(()=>Object.entries(n).filter(([,r])=>r.type==="boolean"),[n]),g=l.useMemo(()=>{const r={};return Object.entries(n).forEach(([a,d])=>{if(d.type==="select"||d.type==="multiselect"){const u=ze(d.choicesFixed);if(u&&y){const O=y[u];O?r[a]=Object.values(O).map(z=>z.id):r[a]=[]}else r[a]=d.choicesFixed||[]}}),r},[n,y]),C="outline outline-1 outline-yellow-400 outline-offset-4 rounded-sm",P=()=>e.jsx("span",{className:"text-yellow-800 text-xs",children:"(modified)"});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[p&&p.updatedAt&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated:"}),e.jsx("p",{className:"text-sm",children:new Date(p.updatedAt).toLocaleString()})]}),c&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Unpublished status:"}),e.jsx(Rt,{className:B("capitalize",Zt[c]),children:c})]})]}),e.jsxs(Ot,{...s,children:[e.jsxs("form",{onSubmit:s.handleSubmit(v),className:"space-y-4 max-w-[800px] w-[800px]",children:[e.jsx(me,{name:"id",control:s.control,rules:{required:!0},render:({field:r})=>e.jsxs(fe,{id:"id",className:B((p?.id==="default"||t)&&"hidden",b("id")&&C),children:[e.jsxs(ce,{className:"flex gap-1 items-baseline",children:["ID",b("id")&&e.jsx(P,{})]}),e.jsx(he,{children:e.jsx(_e,{placeholder:"item-id",...s.register("id"),...r,value:r.value,onChange:a=>{const d=a.target.value.toLowerCase().replace(/\s+/g,"-").replace(/-+/g,"-").replace(/[^a-z0-9-]/g,"");r.onChange(d)},onBlur:a=>{const d=a.target.value.trim().replace(/^-+|-+$/g,"");r.onChange(d)}})}),e.jsx(xe,{})]})}),e.jsx(me,{name:"isDraft",control:s.control,render:({field:r})=>e.jsxs(fe,{id:"isDraft",className:B("flex flex-col items-start",(p?.id==="default"||t)&&"hidden",b("isDraft")&&C),children:[e.jsxs("div",{className:"flex flex-row space-x-2",children:[e.jsx(he,{children:e.jsx(Fe,{id:"isDraft",...s.register("isDraft"),checked:r.value==="true",onCheckedChange:a=>{r.onChange(a===!0?"true":"false")}})}),e.jsxs(ce,{className:"flex gap-1 items-baseline",children:["Draft",b("isDraft")&&e.jsx("span",{className:"text-yellow-600 text-xs",children:e.jsx(P,{})})]})]}),e.jsx(Ee,{children:"Draft items are not visible on the published site"}),e.jsx(xe,{})]})}),I.length>0&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(ce,{children:"Flags"}),e.jsx("div",{className:"flex flex-row flex-wrap gap-4",children:I.map(([r,a])=>e.jsx(me,{name:r,control:s.control,render:({field:d})=>e.jsxs(fe,{className:B("flex flex-col items-start",b(r)&&C),children:[e.jsxs("div",{className:"flex flex-row space-x-2",children:[e.jsx(he,{children:e.jsx(Fe,{id:r,...s.register(r),checked:d.value==="true",onCheckedChange:u=>{d.onChange(u===!0?"true":"false")}})}),e.jsxs(ce,{className:"flex gap-1 items-baseline",children:[a.displayName,b(r)&&e.jsx("span",{className:"text-yellow-800 text-xs",children:e.jsx(P,{})})]})]}),a.displayExtra&&e.jsx(Ee,{children:a.displayExtra}),e.jsx(xe,{})]})},r))})]}),Object.entries(n).filter(([,r])=>r.type!=="boolean").map(([r,a])=>{const d=g[r]??[];return e.jsx(me,{name:r,control:s.control,rules:{required:!a.optional},render:({field:u})=>{const O=u.value?.length??0,z=a.type==="multiselect"&&(a.minSelectedChoices||a.maxSelectedChoices);return e.jsxs(fe,{id:r,className:B(b(r)&&C),children:[e.jsxs(ce,{className:"flex gap-1 items-baseline",children:[a.displayName,a.optional&&e.jsx("span",{className:"text-gray-400",children:"(optional)"}),b(r)&&e.jsx("span",{className:"text-yellow-600 text-xs",children:e.jsx(P,{})})]}),e.jsx(he,{children:a.type==="markdown"?e.jsx(cn,{id:r,name:r,register:s.register,className:"h-52",markdown:u.value,onChange:(j,A)=>{A||u.onChange(j)},placeholder:a.placeholder,fieldDisplayName:a.displayName}):a.type==="url"?e.jsx(pn,{id:r,...s.register(r),placeholder:a.placeholder??"https://example.website/",...u,value:u.value}):a.type==="string"&&a.isUploadedFile?e.jsx(ln,{id:r,name:r,register:s.register,value:u.value,onChange:u.onChange}):a.type==="date"?e.jsx(dn,{id:r,...s.register(r),date:u.value?new Date(u.value):void 0,onDateChange:j=>{u.onChange(j?j.toISOString():"")},placeholder:a.placeholder??"Select date",allowClear:a.optional}):a.type==="datetime"?e.jsx("div",{className:"relative",children:e.jsx(un,{id:r,...s.register(r),date:u.value?new Date(u.value):void 0,onDateTimeChange:j=>{u.onChange(j?j.toISOString():"")},placeholder:a.placeholder??"Select date and time",allowClear:a.optional})}):a.type==="color"?e.jsx(mn,{id:r,value:u.value,onChange:u.onChange,placeholder:a.placeholder}):a.type==="number"?e.jsx(_e,{id:r,...s.register(r,{valueAsNumber:!0}),type:"number",value:u.value,onChange:u.onChange,placeholder:a.placeholder}):a.type==="select"?e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(We,{value:u.value,onValueChange:u.onChange,children:[e.jsx(qe,{id:r,className:"w-full",children:e.jsx(Ke,{placeholder:a.placeholder??"Select an item..."})}),e.jsx(Ge,{children:d.map(j=>e.jsx(Ye,{value:j,children:j},j))})]}),a.optional&&u.value&&e.jsxs(Ve,{type:"button",variant:"outline",size:"icon",onClick:()=>u.onChange(""),className:"shrink-0",children:[e.jsx(Be,{size:16}),e.jsx("span",{className:"sr-only",children:"Clear selection"})]})]}):a.type==="multiselect"?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:"flex flex-wrap gap-2 min-h-[38px] p-2 border rounded-md bg-background",children:u.value?.length>0?u.value.map(j=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md text-sm font-medium bg-gray-100 text-black-800",children:[j,e.jsxs("button",{type:"button",onClick:()=>{const A=u.value.filter($=>$!==j);u.onChange(A)},className:"hover:bg-gray-200 rounded-sm p-0.5",children:[e.jsx(Be,{size:14}),e.jsxs("span",{className:"sr-only",children:["Remove ",j]})]})]},j)):e.jsx("span",{className:"text-muted-foreground text-sm",children:a.placeholder??"Select items..."})}),(!a.maxSelectedChoices||O<a.maxSelectedChoices)&&e.jsxs(We,{value:"",onValueChange:j=>{const A=u.value||[];A.includes(j)||u.onChange([...A,j])},children:[e.jsx(qe,{id:r,className:"w-full",children:e.jsx(Ke,{placeholder:"Add item..."})}),e.jsx(Ge,{children:d.filter(j=>!u.value?.includes(j)).map(j=>e.jsx(Ye,{value:j,children:j},j))})]}),z&&e.jsxs("span",{className:B("text-xs",a.minSelectedChoices&&O<a.minSelectedChoices?"text-destructive":"text-muted-foreground"),children:[O,a.minSelectedChoices&&a.maxSelectedChoices?`/${a.maxSelectedChoices} (min ${a.minSelectedChoices})`:a.minSelectedChoices?` selected (min ${a.minSelectedChoices})`:`/${a.maxSelectedChoices} selected`]})]}):e.jsx(_e,{id:r,...s.register(r),placeholder:a.placeholder,...u,value:u.value})}),a.displayExtra&&e.jsx(Ee,{children:a.displayExtra}),e.jsx(xe,{})]})}},r)}),e.jsxs(Ve,{disabled:!s.formState.isDirty&&!m||s.formState.isSubmitting,type:"submit",children:[s.formState.isSubmitting?e.jsx(co,{className:"animate-spin"}):e.jsx(vo,{}),s.formState.isSubmitting?"Saving":s.watch("isDraft")==="true"?"Save Draft":"Save"]})]}),e.jsx(an,{hasUnsavedChanges:!s.formState.isSubmitting&&s.formState.isDirty})]})]})}export{Zo as C,Mn as I,Xo as P,Ko as R,Dn as S,qo as T,Go as V,Yo as a,Qo as b,wo as c,Jo as d,en as e,bo as u};