decocms
Version:
Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools
2 lines (1 loc) • 32.1 kB
JavaScript
import{c as I,b as X,r as M,m as B,j as s,a6 as Re,e as nt,t as je,D as lt,v as ot,w as at,x as ct,y as dt,B as Fe,ax as ut,Y as ke,a7 as ft,E as H,X as mt,Z as ht,_ as pt,d as gt,aE as bt,l as Ye,H as xt,au as $e,L as Ge,$ as jt,aw as Ve,aF as vt,aG as yt,P as St}from"./index-ztdGKvBm.js";import{u as Ie,c as Ze,g as wt,h as Ct,i as _t}from"./use-sidebar-collapsed-Cy-mIzeN.js";import{S as kt,a as Ot,b as Rt}from"./sheet-C-umRrOH.js";import{u as Et}from"./use-mobile-C_hdQY5I.js";import{u as zt,a as Dt,D as Nt,c as Tt,C as Lt,P as Pt}from"./task-key-Bt60Ndov.js";import{S as At,v as Mt,u as $t}from"./sortable.esm-CKl9Rez4.js";import{i as It}from"./Tool01-BCJ5kyrz.js";import{t as Kt,u as Ft,v as Ut,w as Wt,A as Bt,x as Ue}from"./agent-icon-BYWtutu9.js";import{s as Ht}from"./Plus-DWySsEmB.js";import{a as Xt}from"./UserSquare-CafFh5_d.js";import{a as Yt}from"./UserCheck01-k-4bTA2h.js";import{s as qe}from"./XClose-CmTuu4UN.js";import{T as ge,a as be,c as xe}from"./tooltip-Bm0P1gm_.js";import{C as Pe,f as Gt,g as Vt,e as Zt}from"./context-menu-DkaKc9e5.js";import{a as qt,O as Je,w as Jt,b as Qt,c as es,E as ts,r as Oe,d as ss,e as rs,h as is,t as ns,f as Qe,m as ls,o as os}from"./use-org-notice-Bg0zOPPj.js";import{C as as}from"./create-organization-dialog-BVTSqOJU.js";import{P as cs}from"./project-apps-BcKyvp4E.js";import{u as ds,a as us}from"./use-recent-apps-DlYlQGYK.js";import{a as fs}from"./use-navigate-to-agent-Cw8_3uU5.js";import{a as ms,u as hs}from"./use-project-scope-BwqdbGG4.js";import{C as We,a as ps,b as gs,c as bs,d as xs}from"./command-C3tlrKUq.js";import{u as js}from"./use-debounced-value-DO5dvp6c.js";import{n as vs}from"./BookOpen01-DU-B3R7s.js";import{F as ys,a as Ae,b as Ss,c as et}from"./feedback-BqoIMOg7.js";import{T as ws}from"./textarea-viSdm6BE.js";import{a as Cs}from"./thread-button-CP83i3PG.js";function _s(t){const e=I.c(48),{open:i,onOpenChange:r,orgs:n,currentSlug:d,onSelect:l}=t,a=X(),[o,u]=M.useState("");let b;e[0]!==o?(b=o.trim(),e[0]=o,e[1]=b):b=e[1];const p=b,m=js(p,150),h=p.length>0,f=m===p,{hits:v,isSearching:j,isStale:C,isError:w}=qt(h?m:""),c=h?v:n;let x;e[2]!==r?(x=L=>{r(L),L||u("")},e[2]=r,e[3]=x):x=e[3];const g=x;let y;e[4]!==a?(y=a("sidebar.rail.searchOrganizations"),e[4]=a,e[5]=y):y=e[5];let S;e[6]!==a?(S=a("sidebar.rail.searchPlaceholder"),e[6]=a,e[7]=S):S=e[7];let k;e[8]!==a?(k=a("sidebar.rail.searchPlaceholder"),e[8]=a,e[9]=k):k=e[9];let _;e[10]!==o||e[11]!==k?(_=s.jsx(ps,{value:o,onValueChange:u,placeholder:k}),e[10]=o,e[11]=k,e[12]=_):_=e[12];const T=h&&(C||!f)&&"opacity-50";let E;e[13]!==T?(E=B(T),e[13]=T,e[14]=E):E=e[14];let O;e[15]!==w||e[16]!==h||e[17]!==a?(O=h&&w&&s.jsx(We,{children:a("sidebar.rail.searchFailed")}),e[15]=w,e[16]=h,e[17]=a,e[18]=O):O=e[18];let z;e[19]!==w||e[20]!==j||e[21]!==c.length||e[22]!==f||e[23]!==a?(z=!w&&f&&!j&&c.length===0&&s.jsx(We,{children:a("sidebar.rail.searchEmpty")}),e[19]=w,e[20]=j,e[21]=c.length,e[22]=f,e[23]=a,e[24]=z):z=e[24];let D;if(e[25]!==d||e[26]!==l||e[27]!==g||e[28]!==c||e[29]!==a){let L;e[31]!==d||e[32]!==l||e[33]!==g||e[34]!==a?(L=P=>s.jsxs(gs,{value:P.slug,onSelect:()=>{g(!1),P.slug!==d&&l(P.slug)},className:"gap-2.5",children:[s.jsx(Je,{org:P,size:"sm"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:P.name}),P.slug===d&&s.jsx("span",{className:"text-meta shrink-0",children:a("sidebar.rail.currentOrganization")})]},P.id),e[31]=d,e[32]=l,e[33]=g,e[34]=a,e[35]=L):L=e[35],D=c.map(L),e[25]=d,e[26]=l,e[27]=g,e[28]=c,e[29]=a,e[30]=D}else D=e[30];let R;e[36]!==z||e[37]!==D||e[38]!==E||e[39]!==O?(R=s.jsxs(bs,{className:E,children:[O,z,D]}),e[36]=z,e[37]=D,e[38]=E,e[39]=O,e[40]=R):R=e[40];let A;return e[41]!==i||e[42]!==g||e[43]!==R||e[44]!==y||e[45]!==S||e[46]!==_?(A=s.jsxs(xs,{open:i,onOpenChange:g,title:y,description:S,shouldFilter:!1,children:[_,R]}),e[41]=i,e[42]=g,e[43]=R,e[44]=y,e[45]=S,e[46]=_,e[47]=A):A=e[47],A}function ks(t){const e=I.c(4),{size:i,className:r}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("path",{d:"M20.317 4.37a19.79 19.79 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.865-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.74 19.74 0 0 0 3.677 4.37a.07.07 0 0 0-.032.028C.533 9.046-.32 13.58.099 18.058a.082.082 0 0 0 .031.056 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.042-.106 13.1 13.1 0 0 1-1.872-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.291a.074.074 0 0 1 .078-.01c3.927 1.793 8.18 1.793 12.061 0a.074.074 0 0 1 .079.009c.12.099.246.198.373.292a.077.077 0 0 1-.007.128 12.3 12.3 0 0 1-1.873.891.077.077 0 0 0-.041.107c.36.698.772 1.363 1.225 1.993a.076.076 0 0 0 .084.029 19.84 19.84 0 0 0 6.002-3.03.077.077 0 0 0 .032-.055c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.029ZM8.02 15.331c-1.183 0-2.157-1.086-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.332-.956 2.418-2.157 2.418Zm7.975 0c-1.183 0-2.157-1.086-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.332-.946 2.418-2.157 2.418Z"}),e[0]=n):n=e[0];let d;return e[1]!==r||e[2]!==i?(d=s.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:r,children:n}),e[1]=r,e[2]=i,e[3]=d):d=e[3],d}const Os=250;function Rs(){return typeof navigator<"u"&&!!navigator.mediaDevices?.getDisplayMedia}function Be(t,e,i){return new Promise(r=>t.toBlob(r,e,i))}async function Es(){const t=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include"});try{const e=document.createElement("video");e.muted=!0,e.srcObject=t,await e.play(),await new Promise(d=>setTimeout(d,Os));const i=document.createElement("canvas");i.width=e.videoWidth,i.height=e.videoHeight,i.getContext("2d")?.drawImage(e,0,0),e.srcObject=null;let r=await Be(i,"image/png");if((!r||r.size>et)&&(r=await Be(i,"image/jpeg",.85)),!r)throw new Error("Could not encode the screenshot");const n=r.type==="image/png"?"png":"jpg";return new File([r],`screenshot.${n}`,{type:r.type})}finally{for(const e of t.getTracks())e.stop()}}function He({kind:t,open:e,onOpenChange:i}){const r=X(),n=t==="problem"?{title:r("sidebar.problem.title"),placeholder:r("sidebar.problem.placeholder"),sent:r("sidebar.problem.sent"),failed:r("sidebar.problem.failed")}:{title:r("sidebar.feedback.title"),placeholder:r("sidebar.feedback.placeholder"),sent:r("sidebar.feedback.sent"),failed:r("sidebar.feedback.failed")},{org:d}=Re(),[l,a]=M.useState(""),[o,u]=M.useState([]),[b,p]=M.useState(!1),m=()=>{for(const c of o)URL.revokeObjectURL(c.previewUrl);u([]),a("")},h=c=>{const x=c.filter(S=>Ss.includes(S.type)?S.size>et?(je.error(r("sidebar.feedback.screenshotTooLarge")),!1):!0:!1),g=Ae-o.length;x.length>g&&je.error(r("sidebar.feedback.tooManyScreenshots",{max:String(Ae)}));const y=x.slice(0,Math.max(g,0)).map(S=>({file:S,previewUrl:URL.createObjectURL(S)}));y.length>0&&u(S=>[...S,...y])},f=c=>{URL.revokeObjectURL(c.previewUrl),u(x=>x.filter(g=>g!==c))},v=async()=>{p(!0);try{h([await Es()])}catch(c){c instanceof DOMException&&c.name==="NotAllowedError"||(console.error("[feedback] screenshot failed",c),je.error(r("sidebar.feedback.screenshotFailed")))}finally{p(!1)}},j=c=>{const x=Array.from(c.clipboardData.files).filter(g=>g.type.startsWith("image/"));x.length!==0&&(c.preventDefault(),h(x))},C=nt({mutationFn:async()=>{const c=new FormData;c.set("kind",t),c.set("message",l.trim()),c.set("pageUrl",window.location.href);for(const g of o)c.append("screenshot",g.file);const x=await fetch(`/api/${encodeURIComponent(d.slug)}/feedback`,{method:"POST",body:c});if(!x.ok)throw new Error(`Feedback failed: ${x.status}`)},onSuccess:()=>{je.success(n.sent),m(),i(!1)},onError:()=>je.error(n.failed)}),w=l.trim().length>0&&!C.isPending;return s.jsx(lt,{open:e&&!b,onOpenChange:i,children:s.jsxs(ot,{className:"sm:max-w-lg","aria-describedby":void 0,children:[s.jsx(at,{children:s.jsx(ct,{children:n.title})}),s.jsx(ws,{autoFocus:!0,value:l,onChange:c=>a(c.target.value),onPaste:j,onKeyDown:c=>{c.key==="Enter"&&(c.metaKey||c.ctrlKey)&&(c.preventDefault(),w&&C.mutate())},placeholder:n.placeholder,className:"min-h-32 max-h-80",maxLength:ys}),o.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2",children:o.map((c,x)=>s.jsxs("div",{className:"group relative size-20 overflow-hidden rounded-lg shadow-edge",children:[s.jsx("a",{href:c.previewUrl,target:"_blank",rel:"noreferrer",children:s.jsx("img",{src:c.previewUrl,alt:r("sidebar.feedback.screenshotAlt",{n:String(x+1)}),className:"size-full object-cover"})}),s.jsx("button",{type:"button",onClick:()=>f(c),"aria-label":r("sidebar.feedback.removeScreenshot"),className:"absolute top-1 right-1 flex size-5 items-center justify-center rounded-full bg-background/90 text-foreground opacity-0 shadow-edge transition-opacity group-hover:opacity-100 focus-visible:opacity-100",children:s.jsx(qe,{size:12})})]},c.previewUrl))}),s.jsxs(dt,{className:"sm:justify-between",children:[Rs()?s.jsxs(Fe,{type:"button",variant:"outline",onClick:v,disabled:o.length>=Ae,children:[s.jsx(Kt,{size:14}),r("sidebar.feedback.takeScreenshot")]}):s.jsx("span",{}),s.jsx(Fe,{type:"button",onClick:()=>C.mutate(),disabled:!w,children:C.isPending?r("sidebar.feedback.sending"):r("sidebar.feedback.send")})]})]})})}function ve(t){const e=I.c(11),{active:i,label:r,children:n}=t,d=i?"h-7 opacity-100":"h-2 opacity-0 group-hover/rail:opacity-60";let l;e[0]!==d?(l=B("w-1 rounded-r-full bg-foreground","transition-[height,opacity] duration-200 ease-[var(--ease-out-cubic)]","motion-reduce:transition-none",d),e[0]=d,e[1]=l):l=e[1];let a;e[2]!==l?(a=s.jsx("span",{"aria-hidden":!0,className:"absolute top-0 -left-2.5 flex h-9 items-center",children:s.jsx("span",{className:l})}),e[2]=l,e[3]=a):a=e[3];let o;e[4]!==i||e[5]!==r?(o=r&&s.jsx("span",{"aria-hidden":!0,className:B("line-clamp-2 w-full px-0.5 text-center text-2xs text-ellipsis transition-colors",i?"font-medium text-sidebar-foreground":"text-muted-foreground group-hover/rail:text-sidebar-foreground"),children:r}),e[4]=i,e[5]=r,e[6]=o):o=e[6];let u;return e[7]!==n||e[8]!==a||e[9]!==o?(u=s.jsxs("div",{className:"group/rail relative flex w-full shrink-0 flex-col items-center gap-1",children:[a,n,o]}),e[7]=n,e[8]=a,e[9]=o,e[10]=u):u=e[10],u}const zs="https://docs.decocms.com/",Ds="https://discord.gg/EQkX7CymV";function Ns(){const t=I.c(39),e=X(),{org:i}=Re(),[r,n]=M.useState(null),d=!!i.id;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=_=>{H("help_menu_dialog_opened",{kind:_}),n(_)},t[0]=l):l=t[0];const a=l;let o;t[1]!==e?(o=e("sidebar.help.button"),t[1]=e,t[2]=o):o=t[2];let u;t[3]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ut,{size:18}),t[3]=u):u=t[3];let b;t[4]!==o?(b=s.jsx(ge,{asChild:!0,children:s.jsx(mt,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":o,onClick:Ps,className:"flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground focus-ring data-[state=open]:bg-sidebar-accent data-[state=open]:text-foreground",children:u})})}),t[4]=o,t[5]=b):b=t[5];let p;t[6]!==e?(p=e("sidebar.help.button"),t[6]=e,t[7]=p):p=t[7];let m;t[8]!==p?(m=s.jsx(be,{side:"right",children:p}),t[8]=p,t[9]=m):m=t[9];let h;t[10]!==b||t[11]!==m?(h=s.jsxs(xe,{children:[b,m]}),t[10]=b,t[11]=m,t[12]=h):h=t[12];let f;t[13]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(vs,{}),t[13]=f):f=t[13];let v;t[14]!==e?(v=e("sidebar.help.guides"),t[14]=e,t[15]=v):v=t[15];let j;t[16]!==v?(j=s.jsx(ke,{asChild:!0,children:s.jsxs("a",{href:zs,target:"_blank",rel:"noopener noreferrer",onClick:Ls,children:[f,v]})}),t[16]=v,t[17]=j):j=t[17];let C;t[18]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(ks,{}),t[18]=C):C=t[18];let w;t[19]!==e?(w=e("sidebar.help.discord"),t[19]=e,t[20]=w):w=t[20];let c;t[21]!==w?(c=s.jsx(ke,{asChild:!0,children:s.jsxs("a",{href:Ds,target:"_blank",rel:"noopener noreferrer",onClick:Ts,children:[C,w]})}),t[21]=w,t[22]=c):c=t[22];let x;t[23]!==d||t[24]!==e?(x=d&&s.jsxs(s.Fragment,{children:[s.jsx(ut,{}),s.jsxs(ke,{onSelect:()=>a("problem"),children:[s.jsx(ft,{}),e("sidebar.help.reportProblem")]}),s.jsxs(ke,{onSelect:()=>a("feedback"),children:[s.jsx(Ft,{}),e("sidebar.feedback.button")]})]}),t[23]=d,t[24]=e,t[25]=x):x=t[25];let g;t[26]!==c||t[27]!==x||t[28]!==j?(g=s.jsxs(ht,{side:"right",align:"end",className:"w-56",children:[j,c,x]}),t[26]=c,t[27]=x,t[28]=j,t[29]=g):g=t[29];let y;t[30]!==g||t[31]!==h?(y=s.jsx(ve,{active:!1,children:s.jsxs(pt,{children:[h,g]})}),t[30]=g,t[31]=h,t[32]=y):y=t[32];let S;t[33]!==d||t[34]!==r?(S=d&&s.jsxs(s.Fragment,{children:[s.jsx(He,{kind:"problem",open:r==="problem",onOpenChange:_=>n(_?"problem":null)}),s.jsx(He,{kind:"feedback",open:r==="feedback",onOpenChange:_=>n(_?"feedback":null)})]}),t[33]=d,t[34]=r,t[35]=S):S=t[35];let k;return t[36]!==y||t[37]!==S?(k=s.jsxs(s.Fragment,{children:[y,S]}),t[36]=y,t[37]=S,t[38]=k):k=t[38],k}function Ts(){return H("help_menu_discord_opened")}function Ls(){return H("help_menu_guides_opened")}function Ps(){return H("help_menu_opened")}function As(t){return globalThis.addEventListener("resize",t),()=>globalThis.removeEventListener("resize",t)}const Ms=()=>Qe(globalThis.innerHeight),$s=()=>Qe(0);function Is(t){const e=I.c(59),{org:i,active:r,onSelect:n,pinned:d,onOpenSettings:l,onTogglePin:a,onHide:o}=t,u=X();let b;e[0]!==i.slug?(b={id:i.slug},e[0]=i.slug,e[1]=b):b=e[1];const{setNodeRef:p,listeners:m,transform:h,transition:f,isDragging:v}=$t(b);let j;e[2]!==h?(j=Lt.Transform.toString(h?{...h,x:0}:null),e[2]=h,e[3]=j):j=e[3];const C=v?1:void 0,w=`rail-org-${i.slug}`;let c;e[4]!==j||e[5]!==C||e[6]!==w||e[7]!==f?(c={transform:j,transition:f,zIndex:C,viewTransitionName:w},e[4]=j,e[5]=C,e[6]=w,e[7]=f,e[8]=c):c=e[8];const x=i.name,g=r||void 0,y=r?"opacity-100":"opacity-60 hover:scale-105 hover:opacity-100",S=n&&"cursor-pointer";let k;e[9]!==y||e[10]!==S?(k=B("relative flex shrink-0 items-center justify-center rounded-xl focus-ring","transition-[opacity,transform] duration-150 ease-out",y,S),e[9]=y,e[10]=S,e[11]=k):k=e[11];let _;e[12]!==i?(_=s.jsx(Je,{org:i,size:"lg"}),e[12]=i,e[13]=_):_=e[13];let T;e[14]!==d?(T=d&&s.jsx("span",{"aria-hidden":!0,className:"absolute -top-1 -right-1 flex size-4 items-center justify-center rounded-full bg-sidebar-accent text-muted-foreground ring-2 ring-sidebar",children:s.jsx(Ue,{size:9})}),e[14]=d,e[15]=T):T=e[15];let E;e[16]!==n||e[17]!==i.name||e[18]!==k||e[19]!==_||e[20]!==T||e[21]!==g?(E=s.jsx(ge,{asChild:!0,children:s.jsx(Gt,{asChild:!0,children:s.jsxs("button",{type:"button","aria-label":x,"aria-current":g,onClick:n,className:k,children:[_,T]})})}),e[16]=n,e[17]=i.name,e[18]=k,e[19]=_,e[20]=T,e[21]=g,e[22]=E):E=e[22];let O;e[23]!==i.name?(O=s.jsx(be,{side:"right",children:i.name}),e[23]=i.name,e[24]=O):O=e[24];let z;e[25]!==E||e[26]!==O?(z=s.jsxs(xe,{children:[E,O]}),e[25]=E,e[26]=O,e[27]=z):z=e[27];let D;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(Yt,{}),e[28]=D):D=e[28];let R;e[29]!==u?(R=u("sidebar.rail.organizationSettings"),e[29]=u,e[30]=R):R=e[30];let A;e[31]!==l||e[32]!==R?(A=s.jsxs(Pe,{onSelect:l,children:[D,R]}),e[31]=l,e[32]=R,e[33]=A):A=e[33];let L;e[34]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(Ue,{}),e[34]=L):L=e[34];let P;e[35]!==d||e[36]!==u?(P=u(d?"sidebar.rail.unpinOrganization":"sidebar.rail.pinOrganization"),e[35]=d,e[36]=u,e[37]=P):P=e[37];let F;e[38]!==a||e[39]!==P?(F=s.jsxs(Pe,{onSelect:a,children:[L,P]}),e[38]=a,e[39]=P,e[40]=F):F=e[40];let U;e[41]!==o||e[42]!==u?(U=o&&s.jsxs(Pe,{onSelect:o,children:[s.jsx(It,{}),u("sidebar.rail.hideOrganization")]}),e[41]=o,e[42]=u,e[43]=U):U=e[43];let Y;e[44]!==A||e[45]!==F||e[46]!==U?(Y=s.jsxs(Vt,{children:[A,F,U]}),e[44]=A,e[45]=F,e[46]=U,e[47]=Y):Y=e[47];let K;e[48]!==z||e[49]!==Y?(K=s.jsxs(Zt,{children:[z,Y]}),e[48]=z,e[49]=Y,e[50]=K):K=e[50];let W;e[51]!==r||e[52]!==K?(W=s.jsx(ve,{active:r,children:K}),e[51]=r,e[52]=K,e[53]=W):W=e[53];let G;return e[54]!==m||e[55]!==p||e[56]!==W||e[57]!==c?(G=s.jsx("div",{ref:p,...m,style:c,className:"w-full shrink-0 touch-none",children:W}),e[54]=m,e[55]=p,e[56]=W,e[57]=c,e[58]=G):G=e[58],G}function Ks(t){const e=I.c(64),{project:i,orgSlug:r,active:n,onClose:d,onNavigate:l}=t,a=X();let o,u,b,p,m,h,f,v,j,C,w;if(e[0]!==n||e[1]!==l||e[2]!==r||e[3]!==i.icon||e[4]!==i.id||e[5]!==i.title){const L=Wt(i.icon,i.title);w="group/rail relative flex w-full flex-col items-center gap-1",b=xe,u=ge,C=!0,o=Ge,p=jt.root,e[17]!==r||e[18]!==i.id?(m={org:r,agentId:i.id},e[17]=r,e[18]=i.id,e[19]=m):m=e[19],h=i.title,f=n||void 0,e[20]!==l?(v=()=>{H("org_rail_recent_project_opened"),l?.()},e[20]=l,e[21]=v):v=e[21],j=B("flex shrink-0 rounded-lg focus-ring",L.text,n&&"ring-[1.5px] ring-current"),e[0]=n,e[1]=l,e[2]=r,e[3]=i.icon,e[4]=i.id,e[5]=i.title,e[6]=o,e[7]=u,e[8]=b,e[9]=p,e[10]=m,e[11]=h,e[12]=f,e[13]=v,e[14]=j,e[15]=C,e[16]=w}else o=e[6],u=e[7],b=e[8],p=e[9],m=e[10],h=e[11],f=e[12],v=e[13],j=e[14],C=e[15],w=e[16];let c;e[22]!==i.icon||e[23]!==i.title?(c=s.jsx(Bt,{icon:i.icon,name:i.title,size:"sm",className:"size-8 rounded-lg"}),e[22]=i.icon,e[23]=i.title,e[24]=c):c=e[24];let x;e[25]!==o||e[26]!==p||e[27]!==m||e[28]!==h||e[29]!==f||e[30]!==v||e[31]!==j||e[32]!==c?(x=s.jsx(o,{to:p,params:m,"aria-label":h,"aria-current":f,onClick:v,className:j,children:c}),e[25]=o,e[26]=p,e[27]=m,e[28]=h,e[29]=f,e[30]=v,e[31]=j,e[32]=c,e[33]=x):x=e[33];let g;e[34]!==u||e[35]!==x||e[36]!==C?(g=s.jsx(u,{asChild:C,children:x}),e[34]=u,e[35]=x,e[36]=C,e[37]=g):g=e[37];let y;e[38]!==i.title?(y=s.jsx(be,{side:"right",children:i.title}),e[38]=i.title,e[39]=y):y=e[39];let S;e[40]!==b||e[41]!==g||e[42]!==y?(S=s.jsxs(b,{children:[g,y]}),e[40]=b,e[41]=g,e[42]=y,e[43]=S):S=e[43];const k=n?"font-medium text-sidebar-foreground":"text-muted-foreground group-hover/rail:text-sidebar-foreground";let _;e[44]!==k?(_=B("line-clamp-2 w-full text-center text-2xs break-words transition-colors",k),e[44]=k,e[45]=_):_=e[45];let T;e[46]!==i.title||e[47]!==_?(T=s.jsx("span",{"aria-hidden":!0,className:_,children:i.title}),e[46]=i.title,e[47]=_,e[48]=T):T=e[48];let E;e[49]!==i.title||e[50]!==a?(E=a("sidebar.rail.closeApp",{name:i.title}),e[49]=i.title,e[50]=a,e[51]=E):E=e[51];let O;e[52]!==d?(O=()=>{H("org_rail_recent_project_closed"),d()},e[52]=d,e[53]=O):O=e[53];let z,D;e[54]===Symbol.for("react.memo_cache_sentinel")?(z=B("absolute -top-1.5 right-[calc(50%-1.25rem)] flex size-4 cursor-pointer items-center justify-center rounded-full","bg-sidebar-accent text-muted-foreground ring-2 ring-sidebar hover:text-foreground","opacity-0 transition-opacity duration-150 group-hover/rail:opacity-100 focus-visible:opacity-100 focus-visible:outline-none"),D=s.jsx(qe,{size:10}),e[54]=z,e[55]=D):(z=e[54],D=e[55]);let R;e[56]!==E||e[57]!==O?(R=s.jsx("button",{type:"button","aria-label":E,onClick:O,className:z,children:D}),e[56]=E,e[57]=O,e[58]=R):R=e[58];let A;return e[59]!==S||e[60]!==T||e[61]!==R||e[62]!==w?(A=s.jsxs("div",{className:w,children:[S,T,R]}),e[59]=S,e[60]=T,e[61]=R,e[62]=w,e[63]=A):A=e[63],A}const Fs={"site-editor":"/site-editor"};function Us(t){const e=I.c(26),{app:i}=t,r=X(),n=cs[i],d=Fs[i];if(!n||!d)return null;let l;e[0]!==n.labelKey||e[1]!==r?(l=r(n.labelKey),e[0]=n.labelKey,e[1]=r,e[2]=l):l=e[2];let a;e[3]!==n.labelKey||e[4]!==r?(a=r(n.labelKey),e[3]=n.labelKey,e[4]=r,e[5]=a):a=e[5];let o;e[6]!==n.tone?(o=B("flex size-9 shrink-0 items-center justify-center rounded-xl focus-ring opacity-100",n.tone),e[6]=n.tone,e[7]=o):o=e[7];let u;e[8]!==n.Icon?(u=s.jsx(n.Icon,{size:18}),e[8]=n.Icon,e[9]=u):u=e[9];let b;e[10]!==a||e[11]!==o||e[12]!==u||e[13]!==d?(b=s.jsx(ge,{asChild:!0,children:s.jsx(Ge,{to:d,"aria-label":a,"aria-current":"page","data-testid":"org-rail-local-app",className:o,children:u})}),e[10]=a,e[11]=o,e[12]=u,e[13]=d,e[14]=b):b=e[14];let p;e[15]!==n.labelKey||e[16]!==r?(p=r(n.labelKey),e[15]=n.labelKey,e[16]=r,e[17]=p):p=e[17];let m;e[18]!==p?(m=s.jsx(be,{side:"right",children:p}),e[18]=p,e[19]=m):m=e[19];let h;e[20]!==b||e[21]!==m?(h=s.jsxs(xe,{children:[b,m]}),e[20]=b,e[21]=m,e[22]=h):h=e[22];let f;return e[23]!==l||e[24]!==h?(f=s.jsx(ve,{active:!0,label:l,children:h}),e[23]=l,e[24]=h,e[25]=f):f=e[25],f}function Ws(){const{org:t}=Re();return ds(t.slug),null}function tt(t){const e=I.c(77),{onNavigate:i}=t===void 0?{}:t,r=X(),n=gt(),{org:d}=Re(),l=bt();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={select:Ys},e[0]=a):a=e[0];const o=Ye(a);let u;e[1]!==o||e[2]!==l?(u=o?l({to:"/$org",fuzzy:!0,pending:!0}):!1,e[1]=o,e[2]=l,e[3]=u):u=e[3];const b=u,p=b?b.org:d.slug,{data:m}=xt(),[h,f]=M.useState(!1),[v,j]=M.useState(!1),C=Ie(),{recent:w,forget:c}=fs(d.slug),{projects:x}=ms(),g=hs(),y=us(),S=y&&y.projectId===null?y.app:null,k=S?[]:w.flatMap(N=>x.filter($=>$.id===N)),_=Jt(m??[],d),{recent:T}=Qt(),E=es();let O;e[4]===Symbol.for("react.memo_cache_sentinel")?(O=Ve.railOrgPrefs(),e[4]=O):O=e[4];const[z,D]=$e(O,ts),R=Oe(z),A=M.useSyncExternalStore(As,Ms,$s),{shown:L}=ss(rs(_,R,d.slug),T,d.slug,A,R.pinned);let P;e[5]===Symbol.for("react.memo_cache_sentinel")?(P={activationConstraint:{distance:8}},e[5]=P):P=e[5];const F=zt(Dt(Pt,P)),U=N=>{const{active:$,over:Ke}=N;Ke&&(H("org_rail_reordered"),D(it=>ls(Oe(it),L.map(Xs),String($.id),String(Ke.id))))},Y=N=>{i?.(),n({to:"/$org/home",params:{org:N},viewTransition:!0})},K=N=>{H("org_rail_travel"),i?.(),E(N,L.map(Hs))},W=()=>{if(H("org_rail_search_opened"),!d.id){j(!0);return}i?.(),os()},G=!C&&"border-r border-sidebar-border";let V;e[6]!==G?(V=B("flex w-[68px] shrink-0 flex-col bg-sidebar",G),e[6]=G,e[7]=V):V=e[7];const rt="flex min-h-0 flex-1 flex-col items-center gap-2.5 overflow-y-auto px-2.5 pt-3 pb-2 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden";let Z;e[8]!==r?(Z=r("sidebar.rail.ariaLabel"),e[8]=r,e[9]=Z):Z=e[9];const Ee=Nt,ze=Tt,De=At,Ne=L.map(Bs),Te=Mt,Le=L.map(N=>s.jsxs(M.Fragment,{children:[s.jsx(Is,{org:N,active:N.slug===p,pinned:R.pinned.includes(N.slug),onSelect:N.slug!==d.slug?()=>K(N.slug):g?()=>Y(N.slug):void 0,onOpenSettings:()=>{i?.(),n({to:"/$org/settings",params:{org:N.slug},search:{thread:void 0}})},onTogglePin:()=>D($=>ns(Oe($),N.slug)),onHide:N.slug===d.slug?void 0:()=>D($=>is(Oe($),N.slug))}),N.slug===d.slug&&k.length>0&&s.jsx("div",{style:{viewTransitionName:"rail-projects"},className:"-mx-1.5 flex w-[calc(100%+0.75rem)] flex-col items-center gap-3 rounded-[12px] bg-foreground/4 px-1 py-3",children:k.map($=>s.jsx(Ks,{project:$,orgSlug:d.slug,active:g===$.id,onClose:()=>c($.id),onNavigate:i},$.id))})]},N.id));let q;e[10]!==De||e[11]!==Ne||e[12]!==Te||e[13]!==Le?(q=s.jsx(De,{items:Ne,strategy:Te,children:Le}),e[10]=De,e[11]=Ne,e[12]=Te,e[13]=Le,e[14]=q):q=e[14];let J;e[15]!==Ee||e[16]!==U||e[17]!==F||e[18]!==ze||e[19]!==q?(J=s.jsx(Ee,{sensors:F,collisionDetection:ze,onDragEnd:U,children:q}),e[15]=Ee,e[16]=U,e[17]=F,e[18]=ze,e[19]=q,e[20]=J):J=e[20];let Q;e[21]!==S?(Q=S&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"my-2 h-px w-6 shrink-0 bg-sidebar-border","aria-hidden":!0}),s.jsx(Us,{app:S})]}),e[21]=S,e[22]=Q):Q=e[22];let ee;e[23]!==J||e[24]!==Q||e[25]!==Z?(ee=s.jsxs("div",{className:rt,"aria-label":Z,children:[J,Q]}),e[23]=J,e[24]=Q,e[25]=Z,e[26]=ee):ee=e[26];let te;e[27]!==r?(te=r("sidebar.rail.search"),e[27]=r,e[28]=te):te=e[28];let ye;e[29]===Symbol.for("react.memo_cache_sentinel")?(ye=s.jsx(Xt,{size:18}),e[29]=ye):ye=e[29];let se;e[30]!==W||e[31]!==te?(se=s.jsx(ge,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":te,"aria-keyshortcuts":"Meta+K Control+K",onClick:W,className:"flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground focus-ring",children:ye})}),e[30]=W,e[31]=te,e[32]=se):se=e[32];let re;e[33]!==r?(re=r("sidebar.rail.search"),e[33]=r,e[34]=re):re=e[34];let Se;e[35]===Symbol.for("react.memo_cache_sentinel")?(Se=s.jsx("span",{className:"ml-2 text-muted-foreground",children:vt.commandPalette.keys.join("")}),e[35]=Se):Se=e[35];let ie;e[36]!==re?(ie=s.jsxs(be,{side:"right",children:[re,Se]}),e[36]=re,e[37]=ie):ie=e[37];let ne;e[38]!==se||e[39]!==ie?(ne=s.jsx(ve,{active:!1,children:s.jsxs(xe,{children:[se,ie]})}),e[38]=se,e[39]=ie,e[40]=ne):ne=e[40];let le;e[41]!==r?(le=r("sidebar.picker.newOrganization"),e[41]=r,e[42]=le):le=e[42];let oe;e[43]!==f?(oe=()=>f(!0),e[43]=f,e[44]=oe):oe=e[44];let we;e[45]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx(Ht,{size:18}),e[45]=we):we=e[45];let ae;e[46]!==le||e[47]!==oe?(ae=s.jsx(ge,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":le,onClick:oe,className:"flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground focus-ring",children:we})}),e[46]=le,e[47]=oe,e[48]=ae):ae=e[48];let ce;e[49]!==r?(ce=r("sidebar.picker.newOrganization"),e[49]=r,e[50]=ce):ce=e[50];let de;e[51]!==ce?(de=s.jsx(be,{side:"right",children:ce}),e[51]=ce,e[52]=de):de=e[52];let ue;e[53]!==ae||e[54]!==de?(ue=s.jsx(ve,{active:!1,children:s.jsxs(xe,{children:[ae,de]})}),e[53]=ae,e[54]=de,e[55]=ue):ue=e[55];let Ce;e[56]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx(Ns,{}),e[56]=Ce):Ce=e[56];let fe;e[57]!==ne||e[58]!==ue?(fe=s.jsxs("div",{className:"flex shrink-0 flex-col items-center gap-1 px-2.5 pt-2 pb-3",children:[ne,ue,Ce]}),e[57]=ne,e[58]=ue,e[59]=fe):fe=e[59];let me;e[60]!==ee||e[61]!==fe||e[62]!==V?(me=s.jsxs("div",{className:V,children:[ee,fe]}),e[60]=ee,e[61]=fe,e[62]=V,e[63]=me):me=e[63];let he;e[64]!==d.slug||e[65]!==_||e[66]!==v||e[67]!==j||e[68]!==K?(he=s.jsx(_s,{open:v,onOpenChange:j,orgs:_,currentSlug:d.slug,onSelect:K}),e[64]=d.slug,e[65]=_,e[66]=v,e[67]=j,e[68]=K,e[69]=he):he=e[69];let pe;e[70]!==h||e[71]!==f?(pe=s.jsx(as,{open:h,onOpenChange:f}),e[70]=h,e[71]=f,e[72]=pe):pe=e[72];let _e;return e[73]!==me||e[74]!==he||e[75]!==pe?(_e=s.jsxs(s.Fragment,{children:[me,he,pe]}),e[73]=me,e[74]=he,e[75]=pe,e[76]=_e):_e=e[76],_e}function Bs(t){return t.slug}function Hs(t){return t.slug}function Xs(t){return t.slug}function Ys(t){return t.isLoading}function Gs(t){const e=I.c(15),{width:i,minWidth:r,maxWidth:n,onPointerDown:d,onKeyDown:l,onDoubleClick:a}=t,o=X(),{isMobile:u}=Ze(),b=Ie();if(u||b)return null;let p;e[0]!==o?(p=o("sidebar.sidebarResizeHandle.ariaLabel"),e[0]=o,e[1]=p):p=e[1];let m;e[2]!==o?(m=o("sidebar.sidebarResizeHandle.title"),e[2]=o,e[3]=m):m=e[3];let h,f;e[4]===Symbol.for("react.memo_cache_sentinel")?(h={left:"var(--sidebar-width)"},f=s.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover/resize:bg-border group-active/resize:bg-border group-focus-visible/resize:bg-ring"}),e[4]=h,e[5]=f):(h=e[4],f=e[5]);let v;return e[6]!==n||e[7]!==r||e[8]!==a||e[9]!==l||e[10]!==d||e[11]!==p||e[12]!==m||e[13]!==i?(v=s.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":p,"aria-valuenow":i,"aria-valuemin":r,"aria-valuemax":n,title:m,tabIndex:0,onPointerDown:d,onKeyDown:l,onDoubleClick:a,className:"group/resize absolute top-0 z-20 h-full w-2 -translate-x-1/2 cursor-col-resize focus-visible:outline-none",style:h,children:f}),e[6]=n,e[7]=r,e[8]=a,e[9]=l,e[10]=d,e[11]=p,e[12]=m,e[13]=i,e[14]=v):v=e[14],v}const Me=400,Xe=16,Vs="sidebar.width.v2";function Zs(){const t=I.c(14),e=qs;let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=f=>typeof f=="number"?e(f):192,t[0]=i):i=t[0];const[r,n]=$e(Vs,i),d=M.useRef(null);let l;t[1]!==n||t[2]!==r?(l=f=>{f.preventDefault();const v=f.clientX,j=e(r),C=d.current??(typeof document<"u"?document.querySelector('[data-slot="sidebar-wrapper"]'):null),w=C?Array.from(C.querySelectorAll('[data-slot="sidebar"], [data-slot="sidebar-container"]')):[];for(const g of w)g.style.transition="none";const c=g=>{const y=e(j+(g.clientX-v));C?.style.setProperty("--sidebar-width",`${y}px`)},x=g=>{const y=e(j+(g.clientX-v));n(y);for(const S of w)S.style.transition="";window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),document.body.style.userSelect="",document.body.style.cursor=""};document.body.style.userSelect="none",document.body.style.cursor="col-resize",window.addEventListener("pointermove",c),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x)},t[1]=n,t[2]=r,t[3]=l):l=t[3];const a=l;let o;t[4]!==n?(o=()=>{n(192)},t[4]=n,t[5]=o):o=t[5];const u=o;let b;t[6]!==n||t[7]!==r?(b=f=>{if(f.key==="ArrowLeft")n(e(r-Xe));else if(f.key==="ArrowRight")n(e(r+Xe));else if(f.key==="Home")n(192);else if(f.key==="End")n(Me);else return;f.preventDefault()},t[6]=n,t[7]=r,t[8]=b):b=t[8];const p=b,m=e(r);let h;return t[9]!==p||t[10]!==a||t[11]!==u||t[12]!==m?(h={width:m,minWidth:192,maxWidth:Me,wrapperRef:d,onStartResize:a,onKeyDownResize:p,resetWidth:u},t[9]=p,t[10]=a,t[11]=u,t[12]=m,t[13]=h):h=t[13],h}function qs(t){return Math.max(192,Math.min(Me,t))}const st=M.createContext(null);function Js(){const t=M.use(st);if(!t)throw new Error("Layout regions require a Layout");return t}function Qs({children:t,notice:e,outsideOrg:i}){const r=Et(),[n,d]=$e(Ve.sidebarOpen(),!0),l=Zs(),a=Ye({select:m=>yt(m.location.state)}),[o,u]=M.useState(!1);!a&&o&&u(!1);const b=a&&!o?!1:n,p=m=>{if(!a){d(m);return}u(m),m&&!n&&d(!0)};return s.jsx(st,{value:{isMobile:r,resize:l},children:s.jsx(wt,{open:b,onOpenChange:p,children:s.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[e,s.jsxs("div",{className:"flex flex-1 flex-row min-h-0",children:[!i&&s.jsx(Ws,{}),!r&&(i?.rail??!0)&&s.jsx(tt,{}),s.jsx(Ct,{ref:l.wrapperRef,className:"flex-1 bg-sidebar relative min-h-0",style:{"--sidebar-width":`${l.width}px`,"--sidebar-width-icon":"0px"},children:s.jsx(Cs,{children:t})})]})]})})})}function er(t){const e=I.c(36),{children:i,renderMobile:r}=t,n=X(),{isMobile:d,resize:l}=Js(),{openMobile:a,setOpenMobile:o}=Ze(),u=Ie();let b;e[0]!==o?(b=()=>o(!1),e[0]=o,e[1]=b):b=e[1];const p=b;if(!d){let x;e[2]!==i||e[3]!==u?(x=s.jsx("div",{className:"contents",inert:u,children:i}),e[2]=i,e[3]=u,e[4]=x):x=e[4];let g;e[5]!==l.maxWidth||e[6]!==l.minWidth||e[7]!==l.onKeyDownResize||e[8]!==l.onStartResize||e[9]!==l.resetWidth||e[10]!==l.width?(g=s.jsx(Gs,{width:l.width,minWidth:l.minWidth,maxWidth:l.maxWidth,onPointerDown:l.onStartResize,onKeyDown:l.onKeyDownResize,onDoubleClick:l.resetWidth}),e[5]=l.maxWidth,e[6]=l.minWidth,e[7]=l.onKeyDownResize,e[8]=l.onStartResize,e[9]=l.resetWidth,e[10]=l.width,e[11]=g):g=e[11];let y;return e[12]!==x||e[13]!==g?(y=s.jsxs(s.Fragment,{children:[x,g]}),e[12]=x,e[13]=g,e[14]=y):y=e[14],y}let m;e[15]!==n?(m=n("layouts.shellControls.navigationTitle"),e[15]=n,e[16]=m):m=e[16];let h;e[17]!==m?(h=s.jsx(kt,{className:"sr-only",children:m}),e[17]=m,e[18]=h):h=e[18];let f;e[19]!==p?(f=s.jsx(tt,{onNavigate:p}),e[19]=p,e[20]=f):f=e[20];let v;e[21]!==p||e[22]!==r?(v=r({onClose:p}),e[21]=p,e[22]=r,e[23]=v):v=e[23];let j;e[24]!==v?(j=s.jsx("div",{className:"min-w-0 flex-1",children:v}),e[24]=v,e[25]=j):j=e[25];let C;e[26]!==f||e[27]!==j?(C=s.jsxs("div",{className:"flex h-full min-h-0",children:[f,j]}),e[26]=f,e[27]=j,e[28]=C):C=e[28];let w;e[29]!==h||e[30]!==C?(w=s.jsxs(Ot,{side:"left",hideCloseButton:!0,className:"w-screen max-w-none! p-0",onOpenAutoFocus:tr,children:[h,C]}),e[29]=h,e[30]=C,e[31]=w):w=e[31];let c;return e[32]!==a||e[33]!==o||e[34]!==w?(c=s.jsx(Rt,{open:a,onOpenChange:o,children:w}),e[32]=a,e[33]=o,e[34]=w,e[35]=c):c=e[35],c}function tr(t){return t.preventDefault()}function sr(t){const e=I.c(3),{children:i}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={background:"transparent",containerType:"inline-size"},e[0]=r):r=e[0];let n;return e[1]!==i?(n=s.jsx(_t,{className:"flex flex-col min-h-0",style:r,children:s.jsx(St,{variant:"plain",className:"bg-sidebar",children:s.jsx("div",{className:"relative flex-1 min-h-0 flex flex-row",children:i})})}),e[1]=i,e[2]=n):n=e[2],n}const Er=Object.assign(Qs,{Sidebar:er,Content:sr});export{Er as L};