import{o as e,r as t,t as n}from"./compiler-runtime-Cs91PcD2.js";import{l as r}from"./button-CmLxDlCv.js";import{n as i}from"./checkbox-BlEgF5ZV.js";import{i as a,n as o,r as s}from"./textarea-DV1qaluU.js";function c(){let e=null,t=null,n=new Set,r=!1,i=null;function a(){for(let e of n)e()}function o(){e!==null&&(e=null,a())}return{install({bridge:n}){if(n&&n.onboarding)return r?i??void 0:(r=!0,t=n,i=n.onboarding.onShow(t=>{e=t,a()}),n.onboarding.signalReady(),()=>{i?.(),i=null,r=!1,t=null,o()})},getSnapshot(){return e},subscribe(e){return n.add(e),()=>{n.delete(e)}},async confirm(e){let n=t;if(!n)return{ok:!1,error:`Not attached to desktop bridge`};try{let t=await n.onboarding.confirm(e);return t.ok&&o(),t}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Unknown error`}}},async cancel(){let e=t;if(!e)return{ok:!1,error:`Not attached to desktop bridge`};try{let t=await e.onboarding.cancel();return t.ok&&o(),t}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Unknown error`}}},dismiss(){o()}}}var l=c();function u(e){return l.install(e)}var d=n(),f=e(),p=`flex items-start gap-2 rounded-md border p-3 text-sm font-normal transition-colors cursor-pointer`;function m(e){let n=(0,d.c)(34),{value:c,onValueChange:l,disabled:u,idPrefix:m,testIdPrefix:h}=e,g=u===void 0?!1:u,_=`${m}-sharing-shared`,v=`${m}-sharing-local-only`,y;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,f.jsxs)(`legend`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,f.jsx)(t,{id:`wtcxiD`}),(0,f.jsx)(a,{})]}),n[0]=y):y=n[0];let b;n[1]===l?b=n[2]:(b=e=>l(e),n[1]=l,n[2]=b);let x=c===`shared`?`border-primary bg-primary/5`:`border-border hover:bg-muted/40`,S;n[3]===x?S=n[4]:(S=r(p,x),n[3]=x,n[4]=S);let C=`${h}-shared`,w;n[5]!==_||n[6]!==C?(w=(0,f.jsx)(s,{id:_,value:`shared`,"data-testid":C,className:`mt-0.5`}),n[5]=_,n[6]=C,n[7]=w):w=n[7];let T;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,f.jsx)(`span`,{className:`block font-medium`,children:(0,f.jsx)(t,{id:`0Gd0NU`})}),n[8]=T):T=n[8];let E;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,f.jsxs)(`span`,{children:[T,(0,f.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,f.jsx)(t,{id:`dJw2_7`})})]}),n[9]=E):E=n[9];let D;n[10]!==_||n[11]!==S||n[12]!==w?(D=(0,f.jsxs)(i,{htmlFor:_,className:S,children:[w,E]}),n[10]=_,n[11]=S,n[12]=w,n[13]=D):D=n[13];let O=c===`local-only`?`border-primary bg-primary/5`:`border-border hover:bg-muted/40`,k;n[14]===O?k=n[15]:(k=r(p,O),n[14]=O,n[15]=k);let A=`${h}-local-only`,j;n[16]!==v||n[17]!==A?(j=(0,f.jsx)(s,{id:v,value:`local-only`,"data-testid":A,className:`mt-0.5`}),n[16]=v,n[17]=A,n[18]=j):j=n[18];let M;n[19]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,f.jsx)(`span`,{className:`block font-medium`,children:(0,f.jsx)(t,{id:`OgyJSr`})}),n[19]=M):M=n[19];let N;n[20]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,f.jsxs)(`span`,{children:[M,(0,f.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,f.jsx)(t,{id:`cZ_8zB`})})]}),n[20]=N):N=n[20];let P;n[21]!==v||n[22]!==k||n[23]!==j?(P=(0,f.jsxs)(i,{htmlFor:v,className:k,children:[j,N]}),n[21]=v,n[22]=k,n[23]=j,n[24]=P):P=n[24];let F;n[25]!==g||n[26]!==D||n[27]!==P||n[28]!==b||n[29]!==c?(F=(0,f.jsxs)(o,{value:c,onValueChange:b,disabled:g,className:`grid-cols-2 gap-3`,children:[D,P]}),n[25]=g,n[26]=D,n[27]=P,n[28]=b,n[29]=c,n[30]=F):F=n[30];let I;return n[31]!==F||n[32]!==h?(I=(0,f.jsxs)(`fieldset`,{className:`flex flex-col space-y-2`,"data-testid":h,children:[y,F]}),n[31]=F,n[32]=h,n[33]=I):I=n[33],I}function h(e,t){let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``)||(e.startsWith(`/`)?`/`:``),r=n(e),i=n(t);if(r===i)return`.`;let a=r.endsWith(`/`)?r:`${r}/`;return i.startsWith(a)?i.slice(a.length):null}function g(e){if(e===``||e===`.`)return!0;if(e.startsWith(`/`)||/^[A-Za-z]:/.test(e))return!1;let t=e.replace(/\\/g,`/`).split(`/`),n=0;for(let e of t)if(!(e===``||e===`.`))if(e===`..`){if(--n,n<0)return!1}else n+=1;return!0}export{u as a,l as i,h as n,m as r,g as t};