import{S as q,i as D,s as H,e as w,a as S,t as J,b as d,d as T,f as m,g as k,l as N,h as K,n as g,c as v,m as C,j as y,k as B,o as G,B as O,E as P,P as Q,Q as R,H as z,N as A,R as F,T as I,K as L,J as M}from"./index.3a2fd726.js";import{g as U}from"./styles.ed3b21b5.js";import{B as V}from"./BlockTitle.f6993203.js";import{B as W}from"./Block.6d18beac.js";function j(t,e,l){const s=t.slice();return s[10]=e[l],s}function X(t){let e;return{c(){e=J(t[3])},m(l,s){m(l,e,s)},p(l,s){s&8&&K(e,l[3])},d(l){l&&g(e)}}}function E(t){let e,l,s,o,c,u=t[10]+"",n,f,b,a;function r(){return t[8](t[10])}return{c(){e=w("label"),l=w("input"),o=S(),c=w("span"),n=J(u),l.disabled=t[2],l.checked=s=t[0].includes(t[10]),d(l,"type","checkbox"),d(l,"name","test"),d(l,"class","gr-check-radio gr-checkbox"),d(c,"class","ml-2"),d(e,"class",f="gr-input-label flex items-center text-gray-700 text-sm space-x-2 border py-1.5 px-3 rounded-lg cursor-pointer bg-white shadow-sm checked:shadow-inner "+t[5]),T(e,"!cursor-not-allowed",t[2])},m(h,i){m(h,e,i),k(e,l),k(e,o),k(e,c),k(c,n),b||(a=N(l,"change",r),b=!0)},p(h,i){t=h,i&4&&(l.disabled=t[2]),i&3&&s!==(s=t[0].includes(t[10]))&&(l.checked=s),i&2&&u!==(u=t[10]+"")&&K(n,u),i&32&&f!==(f="gr-input-label flex items-center text-gray-700 text-sm space-x-2 border py-1.5 px-3 rounded-lg cursor-pointer bg-white shadow-sm checked:shadow-inner "+t[5])&&d(e,"class",f),i&36&&T(e,"!cursor-not-allowed",t[2])},d(h){h&&g(e),b=!1,a()}}}function Y(t){let e,l,s,o;e=new V({props:{show_label:t[4],$$slots:{default:[X]},$$scope:{ctx:t}}});let c=t[1],u=[];for(let n=0;n<c.length;n+=1)u[n]=E(j(t,c,n));return{c(){v(e.$$.fragment),l=S(),s=w("div");for(let n=0;n<u.length;n+=1)u[n].c();d(s,"class","flex flex-wrap gap-2"),d(s,"data-testid","checkbox-group")},m(n,f){C(e,n,f),m(n,l,f),m(n,s,f);for(let b=0;b<u.length;b+=1)u[b].m(s,null);o=!0},p(n,[f]){const b={};if(f&16&&(b.show_label=n[4]),f&8200&&(b.$$scope={dirty:f,ctx:n}),e.$set(b),f&103){c=n[1];let a;for(a=0;a<c.length;a+=1){const r=j(n,c,a);u[a]?u[a].p(r,f):(u[a]=E(r),u[a].c(),u[a].m(s,null))}for(;a<u.length;a+=1)u[a].d(1);u.length=c.length}},i(n){o||(y(e.$$.fragment,n),o=!0)},o(n){B(e.$$.fragment,n),o=!1},d(n){G(e,n),n&&g(l),n&&g(s),O(u,n)}}}function Z(t,e,l){let s,{value:o=[]}=e,{style:c={}}=e,{choices:u}=e,{disabled:n=!1}=e,{label:f}=e,{show_label:b}=e;const a=P(),r=i=>{o.includes(i)?o.splice(o.indexOf(i),1):o.push(i),a("change",o),l(0,o)},h=i=>r(i);return t.$$set=i=>{"value"in i&&l(0,o=i.value),"style"in i&&l(7,c=i.style),"choices"in i&&l(1,u=i.choices),"disabled"in i&&l(2,n=i.disabled),"label"in i&&l(3,f=i.label),"show_label"in i&&l(4,b=i.show_label)},t.$$.update=()=>{t.$$.dirty&128&&l(5,{item_container:s}=U(c,["item_container"]),s)},[o,u,n,f,b,s,r,c,h]}class p extends q{constructor(e){super(),D(this,e,Z,Y,H,{value:0,style:7,choices:1,disabled:2,label:3,show_label:4})}}function x(t){let e,l,s,o,c;const u=[t[8]];let n={};for(let a=0;a<u.length;a+=1)n=Q(n,u[a]);e=new R({props:n});function f(a){t[9](a)}let b={choices:t[3],label:t[6],style:t[4],show_label:t[7],disabled:t[5]==="static"};return t[0]!==void 0&&(b.value=t[0]),s=new p({props:b}),z.push(()=>A(s,"value",f)),s.$on("change",t[10]),{c(){v(e.$$.fragment),l=S(),v(s.$$.fragment)},m(a,r){C(e,a,r),m(a,l,r),C(s,a,r),c=!0},p(a,r){const h=r&256?F(u,[I(a[8])]):{};e.$set(h);const i={};r&8&&(i.choices=a[3]),r&64&&(i.label=a[6]),r&16&&(i.style=a[4]),r&128&&(i.show_label=a[7]),r&32&&(i.disabled=a[5]==="static"),!o&&r&1&&(o=!0,i.value=a[0],L(()=>o=!1)),s.$set(i)},i(a){c||(y(e.$$.fragment,a),y(s.$$.fragment,a),c=!0)},o(a){B(e.$$.fragment,a),B(s.$$.fragment,a),c=!1},d(a){G(e,a),a&&g(l),G(s,a)}}}function $(t){let e,l;return e=new W({props:{visible:t[2],elem_id:t[1],type:"fieldset",disable:typeof t[4].container=="boolean"&&!t[4].container,$$slots:{default:[x]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(s,o){C(e,s,o),l=!0},p(s,[o]){const c={};o&4&&(c.visible=s[2]),o&2&&(c.elem_id=s[1]),o&16&&(c.disable=typeof s[4].container=="boolean"&&!s[4].container),o&2553&&(c.$$scope={dirty:o,ctx:s}),e.$set(c)},i(s){l||(y(e.$$.fragment,s),l=!0)},o(s){B(e.$$.fragment,s),l=!1},d(s){G(e,s)}}}function ee(t,e,l){let{elem_id:s=""}=e,{visible:o=!0}=e,{value:c=[]}=e,{choices:u}=e,{style:n={}}=e,{mode:f}=e,{label:b="Checkbox Group"}=e,{show_label:a}=e,{loading_status:r}=e;function h(_){c=_,l(0,c)}function i(_){M.call(this,t,_)}return t.$$set=_=>{"elem_id"in _&&l(1,s=_.elem_id),"visible"in _&&l(2,o=_.visible),"value"in _&&l(0,c=_.value),"choices"in _&&l(3,u=_.choices),"style"in _&&l(4,n=_.style),"mode"in _&&l(5,f=_.mode),"label"in _&&l(6,b=_.label),"show_label"in _&&l(7,a=_.show_label),"loading_status"in _&&l(8,r=_.loading_status)},[c,s,o,u,n,f,b,a,r,h,i]}class le extends q{constructor(e){super(),D(this,e,ee,$,H,{elem_id:1,visible:2,value:0,choices:3,style:4,mode:5,label:6,show_label:7,loading_status:8})}}var ie=le;const oe=["static","dynamic"];export{ie as Component,oe as modes};
