import{c as q,u as K,j as i,r as v,aq as U,ar as V,as as H,a9 as y,at as E,au as W,av as g,aw as j,ax as X,ay as w,az as Y,aA as $}from"./index-XbihxApF.js";import{B as J}from"./button-h0tC9PDp.js";import{T as Q,a as Z,c as ee,b as oe}from"./tooltip-oyhh3051.js";import{c as te}from"./Pin01-D9FLA-TJ.js";import{u as re,a as ae}from"./use-organization-settings-D78gPJ1h.js";function xe(d){const e=q.c(19),{title:t,url:r,icon:o}=d,{org:s}=K(),a=re(s.id),m=ae(s.id);let l;e[0]!==a?.sidebar_items||e[1]!==r?(l=a?.sidebar_items?.some(_=>_.url===r),e[0]=a?.sidebar_items,e[1]=r,e[2]=l):l=e[2];const u=!!l;let p;e[3]!==m.update||e[4]!==o||e[5]!==u||e[6]!==a?.sidebar_items||e[7]!==t||e[8]!==r?(p=async()=>{const _=a?.sidebar_items||[];let P;u?P=_.filter(L=>L.url!==r):P=[..._,{title:t,url:r,icon:o}],await m.update.mutateAsync({sidebar_items:P})},e[3]=m.update,e[4]=o,e[5]=u,e[6]=a?.sidebar_items,e[7]=t,e[8]=r,e[9]=p):p=e[9];const f=p,b=u?"secondary":"outline";let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(te,{size:16}),e[10]=c):c=e[10];let n;e[11]!==f||e[12]!==b?(n=i.jsx(Q,{asChild:!0,children:i.jsx(J,{onClick:f,size:"icon",variant:b,className:"size-7 border border-input",children:c})}),e[11]=f,e[12]=b,e[13]=n):n=e[13];const h=u?"Pinned":"Pin to sidebar";let R;e[14]!==h?(R=i.jsx(Z,{children:h}),e[14]=h,e[15]=R):R=e[15];let x;return e[16]!==n||e[17]!==R?(x=i.jsx(ee,{children:i.jsxs(oe,{children:[n,R]})}),e[16]=n,e[17]=R,e[18]=x):x=e[18],x}var I="Radio",[se,S]=w(I),[ne,ie]=se(I),k=v.forwardRef((d,e)=>{const{__scopeRadio:t,name:r,checked:o=!1,required:s,disabled:a,value:m="on",onCheck:l,form:u,...p}=d,[f,b]=v.useState(null),c=E(e,R=>b(R)),n=v.useRef(!1),h=f?u||!!f.closest("form"):!0;return i.jsxs(ne,{scope:t,checked:o,disabled:a,children:[i.jsx(y.button,{type:"button",role:"radio","aria-checked":o,"data-state":T(o),"data-disabled":a?"":void 0,disabled:a,value:m,...p,ref:c,onClick:g(d.onClick,R=>{o||l?.(),h&&(n.current=R.isPropagationStopped(),n.current||R.stopPropagation())})}),h&&i.jsx(N,{control:f,bubbles:!n.current,name:r,value:m,checked:o,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});k.displayName=I;var A="RadioIndicator",G=v.forwardRef((d,e)=>{const{__scopeRadio:t,forceMount:r,...o}=d,s=ie(A,t);return i.jsx(X,{present:r||s.checked,children:i.jsx(y.span,{"data-state":T(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:e})})});G.displayName=A;var ce="RadioBubbleInput",N=v.forwardRef(({__scopeRadio:d,control:e,checked:t,bubbles:r=!0,...o},s)=>{const a=v.useRef(null),m=E(a,s),l=Y(t),u=$(e);return v.useEffect(()=>{const p=a.current;if(!p)return;const f=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==t&&c){const n=new Event("click",{bubbles:r});c.call(p,t),p.dispatchEvent(n)}},[l,t,r]),i.jsx(y.input,{type:"radio","aria-hidden":!0,defaultChecked:t,...o,tabIndex:-1,ref:m,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});N.displayName=ce;function T(d){return d?"checked":"unchecked"}var de=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],C="RadioGroup",[ue]=w(C,[j,S]),D=j(),O=S(),[le,pe]=ue(C),B=v.forwardRef((d,e)=>{const{__scopeRadioGroup:t,name:r,defaultValue:o,value:s,required:a=!1,disabled:m=!1,orientation:l,dir:u,loop:p=!0,onValueChange:f,...b}=d,c=D(t),n=U(u),[h,R]=V({prop:s,defaultProp:o??null,onChange:f,caller:C});return i.jsx(le,{scope:t,name:r,required:a,disabled:m,value:h,onValueChange:R,children:i.jsx(H,{asChild:!0,...c,orientation:l,dir:n,loop:p,children:i.jsx(y.div,{role:"radiogroup","aria-required":a,"aria-orientation":l,"data-disabled":m?"":void 0,dir:n,...b,ref:e})})})});B.displayName=C;var M="RadioGroupItem",z=v.forwardRef((d,e)=>{const{__scopeRadioGroup:t,disabled:r,...o}=d,s=pe(M,t),a=s.disabled||r,m=D(t),l=O(t),u=v.useRef(null),p=E(e,u),f=s.value===o.value,b=v.useRef(!1);return v.useEffect(()=>{const c=h=>{de.includes(h.key)&&(b.current=!0)},n=()=>b.current=!1;return document.addEventListener("keydown",c),document.addEventListener("keyup",n),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",n)}},[]),i.jsx(W,{asChild:!0,...m,focusable:!a,active:f,children:i.jsx(k,{disabled:a,required:s.required,checked:f,...l,...o,name:s.name,ref:p,onCheck:()=>s.onValueChange(o.value),onKeyDown:g(c=>{c.key==="Enter"&&c.preventDefault()}),onFocus:g(o.onFocus,()=>{b.current&&u.current?.click()})})})});z.displayName=M;var fe="RadioGroupIndicator",F=v.forwardRef((d,e)=>{const{__scopeRadioGroup:t,...r}=d,o=O(t);return i.jsx(G,{...o,...r,ref:e})});F.displayName=fe;var _e=B,ye=z,Ce=F;export{ye as I,xe as P,_e as R,Ce as a};
