import './async-Djx13DAD.js';
import { b as spread_props, c as bind_props, d as attr_class, e as ensure_array_like, a as attr } from './index-B7gr0Dsc.js';
import './2-CeYbpaU1.js';
import { g } from './utils.svelte-D8Xdzglu.js';
import { i } from './File-CWWp_-I1.js';
import { G } from './Block-2-03Azgw.js';
import './MarkdownCode.svelte_svelte_type_style_lang-DJRtJayx.js';
import { k } from './BlockLabel-DYKzuObf.js';
import { y } from './IconButtonWrapper-DlgTGGi-.js';
import { R } from './index3-DONAw0dG.js';
import { e as escape_html } from './escaping-CBnpiEl5.js';
import './context-BZS6UlnY.js';
import './uneval-DjLoL4oF.js';
import './clone-BLo8hHdj.js';
import './index5-BoOEKc6P.js';
import './dev-fallback-Bc5Ork7Y.js';
import './prism-python-BaDPvmdn.js';
import './spring-DyDQVd5U.js';
import './IconButton-7VBZdgpA.js';
import './Clear-CiR-WD8W.js';

function D(u){u.push('<svg width="100%" height="100%" viewBox="0 0 14 17" version="1.1" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><g transform="matrix(1,0,0,1,-10.6667,-7.73588)"><path d="M12.7,24.033C12.256,24.322 11.806,24.339 11.351,24.084C10.896,23.829 10.668,23.434 10.667,22.9L10.667,9.1C10.667,8.567 10.895,8.172 11.351,7.916C11.807,7.66 12.256,7.677 12.7,7.967L23.567,14.867C23.967,15.133 24.167,15.511 24.167,16C24.167,16.489 23.967,16.867 23.567,17.133L12.7,24.033Z" style="fill:currentColor;fill-rule:nonzero;"></path></g></svg>');}function H(u,m){u.component(s$1=>{let{value:p=void 0,disabled:_,onchange:l}=m;s$1.push(`<input${attr("checked",p,true)} type="checkbox"${attr("disabled",_,true)}${attr_class("svelte-3g0mcl",void 0,{disabled:_&&!p})}/>`),bind_props(m,{value:p});});}const O="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23888888'%20d='M6%202c-1.1%200-1.99.9-1.99%202L4%2020c0%201.1.89%202%201.99%202H18c1.1%200%202-.9%202-2V8l-6-6H6zm7%207V3.5L18.5%209H13z'/%3e%3c/svg%3e",P="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20viewBox='0%200%2032%2032'%20version='1.1'%20id='svg7'%20sodipodi:docname='light-folder-new.svg'%20inkscape:version='1.3.2%20(091e20e,%202023-11-25)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview7'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20inkscape:zoom='7.375'%20inkscape:cx='15.932203'%20inkscape:cy='16'%20inkscape:window-width='1312'%20inkscape:window-height='529'%20inkscape:window-x='0'%20inkscape:window-y='38'%20inkscape:window-maximized='0'%20inkscape:current-layer='svg7'%20/%3e%3cdefs%20id='defs6'%3e%3cclipPath%20id='clipPath1'%3e%3cpath%20d='m69.63%2012.145h-.052c-22.727-.292-46.47%204.077-46.709%204.122-2.424.451-4.946%202.974-5.397%205.397-.044.237-4.414%2023.983-4.122%2046.71-.292%2022.777%204.078%2046.523%204.122%2046.761.451%202.423%202.974%204.945%205.398%205.398.237.044%2023.982%204.413%2046.709%204.121%2022.779.292%2046.524-4.077%2046.761-4.121%202.423-.452%204.946-2.976%205.398-5.399.044-.236%204.413-23.981%204.121-46.709.292-22.777-4.077-46.523-4.121-46.761-.453-2.423-2.976-4.946-5.398-5.397-.238-.045-23.984-4.414-46.71-4.122'%20id='path1'%20/%3e%3c/clipPath%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20y2='352.98'%20x2='-601.15'%20y1='663.95'%20x1='-591.02'%20id='2'%3e%3cstop%20stop-color='%23a0a0a0'%20id='stop1'%20/%3e%3cstop%20offset='1'%20stop-color='%23aaa'%20id='stop2'%20/%3e%3c/linearGradient%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20y2='354.29'%20x2='-704.05'%20y1='647.77'%20x1='-701.19'%20id='1'%3e%3cstop%20stop-color='%23acabab'%20id='stop3'%20/%3e%3cstop%20offset='1'%20stop-color='%23d4d4d4'%20id='stop4'%20/%3e%3c/linearGradient%3e%3clinearGradient%20id='0'%20x1='59.12'%20y1='-19.888'%20x2='59.15'%20y2='-37.783'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(4.17478%200%200%204.16765-1069.7%20447.73)'%3e%3cstop%20stop-color='%23a0a0a0'%20id='stop5'%20/%3e%3cstop%20offset='1'%20stop-color='%23bdbdbd'%20id='stop6'%20/%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20transform='matrix(.07089%200%200%20.07017%2023.295-40.67)'%20fill='%2360aae5'%20id='g7'%20style='fill:%23888888;fill-opacity:1'%3e%3cpath%20transform='matrix(.7872%200%200%20.79524%20415.34%20430.11)'%20d='m-884.1%20294.78c-4.626%200-8.349%203.718-8.349%208.335v161.41l468.19%201v-121.2c0-4.618-3.724-8.335-8.35-8.335h-272.65c-8.51.751-9.607-.377-13.812-5.981-5.964-7.968-14.969-21.443-20.84-29.21-4.712-6.805-5.477-6.02-13.292-6.02z'%20fill='url(%230)'%20color='%23000'%20id='path6'%20style='fill:%23888888;fill-opacity:1'%20/%3e%3crect%20transform='matrix(.7872%200%200%20.79524%20415.34%20430.11)'%20y='356.85'%20x='-890.28'%20height='295.13'%20width='463.85'%20fill='url(%231)'%20stroke='url(%231)'%20stroke-width='2.378'%20rx='9.63'%20id='rect6'%20style='fill:%23888888;fill-opacity:1'%20/%3e%3crect%20width='463.85'%20height='295.13'%20x='-890.28'%20y='356.85'%20transform='matrix(.7872%200%200%20.79524%20415.34%20430.11)'%20fill='none'%20stroke='url(%232)'%20stroke-linejoin='round'%20stroke-linecap='round'%20stroke-width='5.376'%20rx='9.63'%20id='rect7'%20style='fill:%23888888;fill-opacity:1'%20/%3e%3c/g%3e%3c/svg%3e";function j(u,m){u.component(s$1=>{let{path:p=[],index_path:_=[],selected_files:l=[],selected_folders:e=[],is_selected_entirely:x=false,interactive:d,selectable:v=false,ls_fn:n,file_count:o="multiple",valid_for_selection:r,oncheck:k,onselect:h}=m,t=[],f=[];const B=i=>{f.includes(i)||(f=[...f,i]);};(async()=>(t=await n(p),r&&(t=[{name:".",type:"file"},...t]),f=t.map((i,y)=>i.type==="folder"&&(x||l.some(w=>w[0]===i.name))?y:null).filter(i=>i!==null)))();function g(i,y,w){h?.({index:i,value:y.join("/"),selected:true});}s$1.push(`<ul${attr_class("svelte-6im0c4",void 0,{"no-checkboxes":!d,root:p.length===0})}><!--[-->`);const C=ensure_array_like(t);for(let i=0,y=C.length;i<y;i++){let{type:w,name:b,valid:F}=C[i];const G=(w==="file"?l:e).some(a=>a[0]===b&&a.length===1);s$1.push(`<li class="svelte-6im0c4"><span${attr_class("wrap svelte-6im0c4",void 0,{selected:!d&&G,selectable:v})}${attr("role",v?"button":void 0)}${attr("tabindex",v?0:void 0)}>`),d?(s$1.push("<!--[-->"),w==="folder"&&o==="single"?(s$1.push("<!--[-->"),s$1.push('<span class="no-checkbox svelte-6im0c4" aria-hidden="true"></span>')):(s$1.push("<!--[!-->"),H(s$1,{disabled:false,value:G,onchange:a=>{k?.({path:[...p,b],checked:a,type:w}),v&&g([..._,i],[...p,b]),w==="folder"&&a&&B(i);}})),s$1.push("<!--]-->")):s$1.push("<!--[!-->"),s$1.push("<!--]--> "),w==="folder"?(s$1.push("<!--[-->"),s$1.push(`<span${attr_class("icon svelte-6im0c4",void 0,{hidden:!f.includes(i)})} role="button" aria-label="expand directory" tabindex="0">`),D(s$1),s$1.push("<!----></span>")):(s$1.push("<!--[!-->"),s$1.push(`<span class="file-icon svelte-6im0c4"><img${attr("src",b==="."?P:O)} alt="file icon" class="svelte-6im0c4"/></span>`)),s$1.push(`<!--]--> <span class="item-name svelte-6im0c4">${escape_html(b)}</span></span> `),w==="folder"&&f.includes(i)?(s$1.push("<!--[-->"),j(s$1,{path:[...p,b],index_path:[..._,i],selected_files:l.filter(a=>a[0]===b).map(a=>a.slice(1)),selected_folders:e.filter(a=>a[0]===b).map(a=>a.slice(1)),is_selected_entirely:e.some(a=>a[0]===b&&a.length===1),interactive:d,selectable:v,ls_fn:n,file_count:o,valid_for_selection:F??false,oncheck:k,onselect:h})):s$1.push("<!--[!-->"),s$1.push("<!--]--></li>");}s$1.push("<!--]--></ul>");});}function E(u,m){u.component(s$1=>{let{interactive:p,file_count:_="multiple",value:l=void 0,selectable:e=false,ls_fn:x,oninput:d,onselect:v}=m,n=[];const o=(h,t)=>h.join("/")===t.join("/"),r=(h,t)=>t.some(f=>o(f,h)),k=(h,t)=>h.join("/").startsWith(t.join("/"));s$1.push('<div class="file-wrap svelte-1gs1iku">'),j(s$1,{path:[],selected_files:l,selected_folders:n,interactive:p,selectable:e,ls_fn:x,file_count:_,valid_for_selection:false,oncheck:h=>{const{path:t,checked:f,type:B}=h;f?_==="single"?l=[t]:B==="folder"?r(t,n)||(n=[...n,t]):r(t,l)||(l=[...l,t]):(n=n.filter(g=>!k(t,g)),B==="folder"?(n=n.filter(g=>!k(g,t)),l=l.filter(g=>!k(g,t))):l=l.filter(g=>!o(g,t))),d?.();},onselect:v}),s$1.push("<!----></div>"),bind_props(m,{value:l});});}function ee(u,m){u.component(s$1=>{const{$$slots:p,$$events:_,...l}=m,e=new g(l,{value:[]});e.props.value,e.props.root_dir,e.props.glob,e.props.ignore_glob;let x=true,d;function v(n){G(n,{visible:e.shared.visible,variant:e.props.value===null?"dashed":"solid",border_mode:"base",padding:false,elem_id:e.shared.elem_id,elem_classes:e.shared.elem_classes,container:e.shared.container,scale:e.shared.scale,min_width:e.shared.min_width,allow_overflow:true,overflow_behavior:"auto",height:e.props.height,max_height:e.props.max_height,min_height:e.props.min_height,children:o=>{R(o,spread_props([e.shared.loading_status,{autoscroll:e.shared.autoscroll,i18n:e.i18n,on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}])),o.push("<!----> "),e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0?(o.push("<!--[-->"),y(o,{buttons:e.props.buttons,on_custom_button_click:r=>{e.dispatch("custom_button_click",{id:r});}})):o.push("<!--[!-->"),o.push("<!--]--> "),k(o,{show_label:e.shared.show_label,Icon:i,label:e.shared.label||"FileExplorer",float:false}),o.push("<!----> <!---->"),E(o,{file_count:e.props.file_count,interactive:e.shared.interactive,selectable:e.props._selectable,ls_fn:e.shared.server.ls,oninput:()=>e.dispatch("input"),onselect:r=>e.dispatch("select",r),get value(){return e.props.value},set value(r){e.props.value=r,x=false;}}),o.push("<!---->");},$$slots:{default:true}});}do x=true,d=s$1.copy(),v(d);while(!x);s$1.subsume(d);});}

export { ee as default };
//# sourceMappingURL=Index54-CtKH6-sz.js.map
