import{l as A,m as B,s as D,q as M,z as N,G as q,H as C,K as P,W as Q,X as S,Y as O,t as T,x as v,D as W,J as w,az as X,a5 as Y,M as I,n as U,o as V,v as d,w as E,A as R,N as Z,O as p,Q as x,ad as $,an as ee,a8 as te}from"./index.881b9b68.js";function le(l){let e,i,n,u,c,o,r,f,b,m;const y=l[13].default,_=I(y,l,l[12],null);return{c(){e=U("input"),c=V(),o=U("button"),_&&_.c(),d(e,"class","hidden-upload hidden"),d(e,"accept",l[5]),d(e,"type","file"),e.multiple=i=l[3]==="multiple"||void 0,d(e,"webkitdirectory",n=l[3]==="directory"||void 0),d(e,"mozdirectory",u=l[3]==="directory"||void 0),d(o,"class",r="gr-button gr-button-"+l[2]+" "+l[6]),d(o,"id",l[0]),E(o,"!hidden",!l[1])},m(s,t){v(s,e,t),l[14](e),v(s,c,t),v(s,o,t),_&&_.m(o,null),f=!0,b||(m=[R(e,"change",l[8]),R(o,"click",l[7])],b=!0)},p(s,[t]){(!f||t&32)&&d(e,"accept",s[5]),(!f||t&8&&i!==(i=s[3]==="multiple"||void 0))&&(e.multiple=i),(!f||t&8&&n!==(n=s[3]==="directory"||void 0))&&d(e,"webkitdirectory",n),(!f||t&8&&u!==(u=s[3]==="directory"||void 0))&&d(e,"mozdirectory",u),_&&_.p&&(!f||t&4096)&&Z(_,y,s,s[12],f?x(y,s[12],t,null):p(s[12]),null),(!f||t&68&&r!==(r="gr-button gr-button-"+s[2]+" "+s[6]))&&d(o,"class",r),(!f||t&1)&&d(o,"id",s[0]),t&70&&E(o,"!hidden",!s[1])},i(s){f||(q(_,s),f=!0)},o(s){C(_,s),f=!1},d(s){s&&w(e),l[14](null),s&&w(c),s&&w(o),_&&_.d(s),b=!1,$(m)}}}function ie(l,e,i){let n,{$$slots:u={},$$scope:c}=e,{style:o={}}=e,{elem_id:r=""}=e,{visible:f=!0}=e,{size:b="lg"}=e,{file_count:m}=e,{file_types:y=["file"]}=e,{include_file_metadata:_=!0}=e,s;const t=O();let k="";try{y.forEach(a=>i(5,k+=a+"/*, "))}catch(a){if(a instanceof TypeError)t("error","Please set file_types to a list.");else throw a}const j=()=>{s.click()},G=a=>{let h=Array.from(a);if(!(!a.length||!window.FileReader)){m==="single"&&(h=[a[0]]);var g=[];h.forEach((z,K)=>{let F=new FileReader;F.readAsDataURL(z),F.onloadend=function(){g[K]=_?{name:z.name,size:z.size,data:this.result}:this.result,g.filter(L=>L!==void 0).length===a.length&&t("load",m=="single"?g[0]:g)}})}},H=a=>{const h=a.target;!h.files||G(h.files)};function J(a){te[a?"unshift":"push"](()=>{s=a,i(4,s)})}return l.$$set=a=>{"style"in a&&i(9,o=a.style),"elem_id"in a&&i(0,r=a.elem_id),"visible"in a&&i(1,f=a.visible),"size"in a&&i(2,b=a.size),"file_count"in a&&i(3,m=a.file_count),"file_types"in a&&i(10,y=a.file_types),"include_file_metadata"in a&&i(11,_=a.include_file_metadata),"$$scope"in a&&i(12,c=a.$$scope)},l.$$.update=()=>{l.$$.dirty&512&&i(6,{classes:n}=ee(o,["full_width"]),n)},[r,f,b,m,s,k,n,j,H,o,y,_,c,u,J]}class ne extends A{constructor(e){super(),B(this,e,ie,le,D,{style:9,elem_id:0,visible:1,size:2,file_count:3,file_types:10,include_file_metadata:11})}}function se(l){let e=l[6](l[3])+"",i;return{c(){i=T(e)},m(n,u){v(n,i,u)},p(n,u){u&72&&e!==(e=n[6](n[3])+"")&&W(i,e)},d(n){n&&w(i)}}}function ae(l){let e,i;return e=new ne({props:{elem_id:l[1],style:l[0],visible:l[2],file_count:l[4],file_types:l[5],$$slots:{default:[se]},$$scope:{ctx:l}}}),e.$on("click",l[9]),e.$on("load",l[7]),{c(){M(e.$$.fragment)},m(n,u){N(e,n,u),i=!0},p(n,[u]){const c={};u&2&&(c.elem_id=n[1]),u&1&&(c.style=n[0]),u&4&&(c.visible=n[2]),u&16&&(c.file_count=n[4]),u&32&&(c.file_types=n[5]),u&2120&&(c.$$scope={dirty:u,ctx:n}),e.$set(c)},i(n){i||(q(e.$$.fragment,n),i=!0)},o(n){C(e.$$.fragment,n),i=!1},d(n){P(e,n)}}}function ue(l,e,i){let n;Q(l,S,t=>i(6,n=t));let{style:u={}}=e,{elem_id:c=""}=e,{visible:o=!0}=e,{label:r}=e,{value:f}=e,{file_count:b}=e,{file_types:m=["file"]}=e;async function y({detail:t}){i(8,f=t),await X(),_("change",f),_("upload",t)}const _=O();function s(t){Y.call(this,l,t)}return l.$$set=t=>{"style"in t&&i(0,u=t.style),"elem_id"in t&&i(1,c=t.elem_id),"visible"in t&&i(2,o=t.visible),"label"in t&&i(3,r=t.label),"value"in t&&i(8,f=t.value),"file_count"in t&&i(4,b=t.file_count),"file_types"in t&&i(5,m=t.file_types)},[u,c,o,r,b,m,n,y,f,s]}class fe extends A{constructor(e){super(),B(this,e,ue,ae,D,{style:0,elem_id:1,visible:2,label:3,value:8,file_count:4,file_types:5})}}var _e=fe;const ce=["static"];export{_e as Component,ce as modes};
