import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{c as n,l as r,s as i}from"./emotion-styled.browser.esm.DmHEQgFq.js";import{l as a}from"./protobuf.Cj15o6C6.js";import{N as o}from"./utils.CmclnrwZ.js";import{p as s,r as c}from"./StreamlitMarkdown.DgiZKHgf.js";import{Bt as l,Ht as u,It as d,Lt as f,Rt as p,Vt as m,it as h,zt as g}from"./index.D3kRk1xg.js";import{n as _}from"./useBasicWidgetState.Bh_1DRpL.js";var v=e(t(),1);function y({element:e,disabled:t,widgetMgr:y,fragmentId:w}){let[T,E]=_({getStateFromWidgetMgr:b,getDefaultStateFromProto:x,getCurrStateFromProto:S,updateWidgetMgrState:C,element:e,widgetMgr:y,fragmentId:w,formClearBehavior:`resetValueOnly`,queryParamBinding:e.queryParamKey?{paramKey:e.queryParamKey,valueType:`bool_value`,clearable:!1}:void 0}),D=(0,v.useCallback)(e=>{E({value:e,fromUi:!0})},[E]),O=e.type===a.StyleType.TOGGLE,k=r(g,{visibility:o(e.labelVisibility?.value),"data-testid":`stWidgetLabel`,children:[n(c,{source:e.label,allowHTML:!1,isLabel:!0}),e.help&&n(h,{content:e.help,placement:s.TOP_RIGHT,label:e.label})]});return O?n(d,{className:`row-widget stCheckbox`,"data-testid":`stCheckbox`,children:n(l,{isSelected:T,isDisabled:t,onChange:D,"aria-label":e.label,children:({isSelected:e,isHovered:t,isDisabled:a})=>r(i,{children:[n(u,{$isSelected:e,$isHovered:t,$isDisabled:a,children:n(m,{$isSelected:e,$isDisabled:a})}),k]})})}):n(d,{className:`row-widget stCheckbox`,"data-testid":`stCheckbox`,children:n(p,{isSelected:T,isDisabled:t,onChange:D,"aria-label":e.label,children:({isSelected:e,isFocusVisible:t,isDisabled:a})=>r(i,{children:[n(f,{$isSelected:e,$isFocusVisible:t,$isDisabled:a,children:e&&n(`svg`,{viewBox:`0 0 10 8`,"aria-hidden":`true`,children:n(`polyline`,{points:`1 4 4 7 9 1`})})}),k]})})})}function b(e,t){return e.getBoolValue(t)}function x(e){return e.default??!1}function S(e){return e.value??!1}function C(e,t,n,r){t.setBoolValue(e,n.value,{fromUi:n.fromUi},r)}var w=(0,v.memo)(y);export{w as default};