import"./DsnmJJEf.js";import{b as N,G as j,p as w,q as z,f as u,m as B,s as S,g as r,u as k,h as n,a as C,c as y,r as U,t as A}from"./DaF1Dxyz.js";import{s as I}from"./DP6lo9Eo.js";import{i as M}from"./DBNwVM39.js";import{p as c}from"./qWzGFQ66.js";import{i as E,l as H}from"./CWmDRfqq.js";function J(g,t,i,s,m){r(t)?i([]):i(r(s).map(d=>d.value)),m()(i())}var K=u('<i class="bi bi-x"></i>'),O=u('<i class="bi bi-check2-all"></i>'),P=u('<button class="ml-auto block text-blue-500"><!> </button>'),Q=u('<div class="mb-2 text-sm text-gray-500 italic"> </div>'),R=u("<!> <!>",1);function ee(g,t){const i=j();w(t,!0);let s=c(t,"value",31,()=>z(t.options)),m=c(t,"emptyText",3,"No options available."),d=c(t,"disabled",3,!1),_=c(t,"onUpdate",3,()=>{}),v=k(()=>t.options.map(e=>typeof e=="string"?{text:e,value:e}:e)),f=k(()=>s().length==r(v).length);var p=R(),x=B(p);E(x,{get label(){return t.label},get formId(){return i},rightSide:a=>{var l=P();l.__click=[J,f,s,v,_];var h=y(l);{var F=o=>{var b=K();n(o,b)},G=o=>{var b=O();n(o,b)};M(h,o=>{r(f)?o(F):o(G,!1)})}var L=S(h);U(l),A(()=>{l.disabled=d(),I(L,` ${r(f)?"Deselect all":"Select all"}`)}),n(a,l)}});var T=S(x,2);{var q=e=>{var a=Q(),l=y(a,!0);U(a),A(()=>I(l,m())),n(e,a)},D=e=>{H(e,{get id(){return i},get label(){return t.label},get options(){return r(v)},get disabled(){return d()},multiple:!0,get onUpdate(){return _()},get value(){return s()},set value(a){s(a)}})};M(T,e=>{r(v).length==0?e(q):e(D,!1)})}n(g,p),C()}N(["click"]);export{ee as M};
