import './async-D55cHugf.js';
import { f as attr_class, a as attr, d as bind_props, g as attr_style, e as ensure_array_like } from './index-u8mz_F03.js';
import { c } from './BlockTitle-BnJIYf6a.js';
import './2-BLdXJizP.js';
import { y } from './IconButtonWrapper-CjFRPb3y.js';
import { e as escape_html } from './escaping-CBnpiEl5.js';

function F(a){a.push('<svg class="dropdown-arrow svelte-loyhyk" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 18 18"><path d="M5 8l4 4 4-4z"></path></svg>');}function G(a,u){a.component(t=>{let{choices:p,filtered_indices:c,show_options:f=false,disabled:d=false,selected_indices:s=[],active_index:n=null,remember_scroll:m=false,offset_from_top:D=0,from_top:B=false,onchange:I,onload:_}=u,h=0,N=null,w=null,b=0;if(t.push('<div class="reference"></div> '),f&&!d){t.push("<!--[-->"),t.push(`<ul class="options svelte-1ou0lab" role="listbox"${attr_style("",{top:N,bottom:w,"max-height":`calc(${b}px - var(--window-padding))`,width:h+"px"})}><!--[-->`);const x=ensure_array_like(c);for(let v=0,z=x.length;v<z;v++){let e=x[v];t.push(`<li${attr_class("item svelte-1ou0lab",void 0,{selected:s.includes(e),active:e===n,"bg-gray-100":e===n,"dark:bg-gray-600":e===n})}${attr("data-index",e)}${attr("aria-label",p[e][0])} data-testid="dropdown-option" role="option"${attr("aria-selected",s.includes(e))}${attr_style("",{width:h+"px"})}><span${attr_class("inner-item svelte-1ou0lab",void 0,{hide:!s.includes(e)})}>✓</span> ${escape_html(p[e][0])}</li>`);}t.push("<!--]--></ul>");}else t.push("<!--[!-->");t.push("<!--]-->");});}function S(a,u){a.component(t=>{const p=typeof window<"u";let{label:c$1="Dropdown",info:f=void 0,value:d=void 0,choices:s=[],interactive:n=true,show_label:m=true,container:D=true,allow_custom_value:B=false,filterable:I=true,buttons:_=null,oncustom_button_click:h=null,on_change:N,on_input:w,on_select:b,on_focus:x,on_blur:v,on_key_up:z}=u,e,r=p&&e===document.activeElement,E=s.map(i=>i[0]),M=s.map(i=>i[1]),g="",o=null,y$1=!n,O=s.map((i,k)=>k),A=null,T=o===null?[]:[o];function W(i){if(o=parseInt(i),isNaN(o)){o=null;return}let[k,j]=s[o];g=k,d=j,b?.({index:o,value:M[o],selected:true}),r=false,A=null,w?.(),e.blur();}t.push(`<div${attr_class("svelte-1xfsv4t",void 0,{container:D})}>`),m&&_&&_.length>0?(t.push("<!--[-->"),y(t,{buttons:_,on_custom_button_click:h})):t.push("<!--[!-->"),t.push("<!--]--> "),c(t,{show_label:m,info:f,children:i=>{i.push(`<!---->${escape_html(c$1)}`);},$$slots:{default:true}}),t.push(`<!----> <div class="wrap svelte-1xfsv4t"><div${attr_class("wrap-inner svelte-1xfsv4t",void 0,{show_options:r})}><div class="secondary-wrap svelte-1xfsv4t"><input role="listbox" aria-controls="dropdown-options"${attr("aria-expanded",r)}${attr("aria-label",c$1)}${attr_class("border-none svelte-1xfsv4t",void 0,{subdued:!E.includes(g)&&!B})} autocomplete="off"${attr("disabled",y$1,true)}${attr("value",g)}${attr("readonly",!I,true)}/> `),y$1?t.push("<!--[!-->"):(t.push("<!--[-->"),t.push('<div class="icon-wrap svelte-1xfsv4t">'),F(t),t.push("<!----></div>")),t.push("<!--]--></div></div> "),G(t,{show_options:r,choices:s,filtered_indices:O,disabled:y$1,selected_indices:T,active_index:A,onchange:W,onload:()=>true}),t.push("<!----></div></div>"),bind_props(u,{value:d});});}

export { F, G, S };
//# sourceMappingURL=Dropdown-D-In1KD6.js.map
