streamlit-nightly 1.42.3.dev20250301__py2.py3-none-any.whl → 1.43.1.dev20250306__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. streamlit/commands/navigation.py +138 -98
  2. streamlit/components/v1/component_arrow.py +3 -1
  3. streamlit/config.py +33 -11
  4. streamlit/dataframe_util.py +12 -4
  5. streamlit/elements/lib/built_in_chart_utils.py +3 -3
  6. streamlit/elements/lib/pandas_styler_utils.py +4 -4
  7. streamlit/elements/map.py +4 -2
  8. streamlit/elements/media.py +4 -2
  9. streamlit/elements/widgets/button.py +92 -28
  10. streamlit/elements/widgets/data_editor.py +4 -4
  11. streamlit/proto/ClientState_pb2.py +5 -5
  12. streamlit/proto/ClientState_pb2.pyi +7 -2
  13. streamlit/proto/NewSession_pb2.py +16 -16
  14. streamlit/proto/NewSession_pb2.pyi +8 -3
  15. streamlit/runtime/caching/hashing.py +1 -1
  16. streamlit/runtime/context.py +9 -0
  17. streamlit/static/index.html +1 -1
  18. streamlit/static/static/js/{FileDownload.esm.CUiEWbzl.js → FileDownload.esm.D90ZPlvX.js} +1 -1
  19. streamlit/static/static/js/{FileHelper.B6bBsK7b.js → FileHelper.B7wMHnJf.js} +1 -1
  20. streamlit/static/static/js/{FormClearHelper.B_9Ez6vr.js → FormClearHelper.DiTttn8n.js} +1 -1
  21. streamlit/static/static/js/{Hooks.VwVTTUgt.js → Hooks.DlsrQbRk.js} +1 -1
  22. streamlit/static/static/js/{InputInstructions.vmQUtJfB.js → InputInstructions.DABeMich.js} +1 -1
  23. streamlit/static/static/js/{ProgressBar.CrEUq34O.js → ProgressBar.B0_wzszZ.js} +2 -2
  24. streamlit/static/static/js/{RenderInPortalIfExists.uSIUxO87.js → RenderInPortalIfExists.Ct3yXHYV.js} +1 -1
  25. streamlit/static/static/js/{Toolbar.DDSvrD0E.js → Toolbar.BhJd2eBO.js} +1 -1
  26. streamlit/static/static/js/{base-input.JpWAqJ0N.js → base-input.BT0Fve4h.js} +1 -1
  27. streamlit/static/static/js/{checkbox.CWR-VT1j.js → checkbox.DytiXgc4.js} +2 -2
  28. streamlit/static/static/js/{createSuper.HcF5WnqF.js → createSuper.Dey_Nchq.js} +1 -1
  29. streamlit/static/static/js/{data-grid-overlay-editor.DminHUYw.js → data-grid-overlay-editor.DHaS0Xdu.js} +1 -1
  30. streamlit/static/static/js/{downloader._SGckIiV.js → downloader.CpXHg7_L.js} +1 -1
  31. streamlit/static/static/js/{es6.b4hv8be8.js → es6.B12jZN2H.js} +2 -2
  32. streamlit/static/static/js/{iframeResizer.contentWindow.BqakL47H.js → iframeResizer.contentWindow.Dp7IrKgg.js} +1 -1
  33. streamlit/static/static/js/{index.BL2LjKzZ.js → index.3smrX8Wb.js} +1 -1
  34. streamlit/static/static/js/index.6GcOZfbK.js +1 -0
  35. streamlit/static/static/js/index.9aouXH1R.js +1 -0
  36. streamlit/static/static/js/{index.cVjFgmUG.js → index.B0Dq5tyz.js} +1 -1
  37. streamlit/static/static/js/index.B0vUg2Y3.js +1 -0
  38. streamlit/static/static/js/index.BEjwL3_Z.js +1 -0
  39. streamlit/static/static/js/{index.C7GAgXnu.js → index.BFTv_Z_e.js} +1 -1
  40. streamlit/static/static/js/{index.C59Ya3CM.js → index.BWJyhyqF.js} +1 -1
  41. streamlit/static/static/js/{index.Dl9vrclR.js → index.Bb8aDqLI.js} +1 -1
  42. streamlit/static/static/js/{index.Cr9buiVv.js → index.Bd3HEJHM.js} +53 -53
  43. streamlit/static/static/js/index.BpUFb67U.js +1 -0
  44. streamlit/static/static/js/{index.CqU47T61.js → index.BpcIvL5C.js} +135 -170
  45. streamlit/static/static/js/{index.3M6TVRo2.js → index.BtGwo9mt.js} +1 -1
  46. streamlit/static/static/js/{index.D7yQTfz7.js → index.Bx2jHxuL.js} +1 -1
  47. streamlit/static/static/js/{index.Dph-QYbt.js → index.C8NedCpe.js} +2 -2
  48. streamlit/static/static/js/{index.D4vb0WQf.js → index.C8i44-aA.js} +1 -1
  49. streamlit/static/static/js/{index.Dev73dEg.js → index.CCzbz0re.js} +1 -1
  50. streamlit/static/static/js/{index.J3DKPewF.js → index.CKTE0OmI.js} +1 -1
  51. streamlit/static/static/js/{index.CpyxO9i-.js → index.Chro-AQL.js} +1 -1
  52. streamlit/static/static/js/{index.C-MV6qmR.js → index.D1pT2XNV.js} +1 -1
  53. streamlit/static/static/js/{index.CAxOUw_O.js → index.D2zBv6ha.js} +1 -1
  54. streamlit/static/static/js/{index.E5dz2muJ.js → index.D6F98iFW.js} +1 -1
  55. streamlit/static/static/js/{index.D4Nzp4K3.js → index.DDLiQS9D.js} +1 -1
  56. streamlit/static/static/js/{index.Cs86Rh1I.js → index.DVFO4dUf.js} +1 -1
  57. streamlit/static/static/js/index.DcZtLSnI.js +1 -0
  58. streamlit/static/static/js/index.Dnp2nMgW.js +1 -0
  59. streamlit/static/static/js/{index.SYnyLAtV.js → index.DpvAFLbG.js} +1 -1
  60. streamlit/static/static/js/{index.B5U4WHdm.js → index.Jj9qMZu5.js} +1 -1
  61. streamlit/static/static/js/{index.BFysNJg1.js → index.SSx319oy.js} +1 -1
  62. streamlit/static/static/js/{index.B4fN2DMS.js → index.U8Sox-zm.js} +1 -1
  63. streamlit/static/static/js/{index.BV5mA8ty.js → index.VRF0kACr.js} +5 -5
  64. streamlit/static/static/js/{index.BLVbwbeW.js → index.d4FK8xGd.js} +2 -2
  65. streamlit/static/static/js/index.ep0QJQk3.js +203 -0
  66. streamlit/static/static/js/index.f0VnAfoO.js +1 -0
  67. streamlit/static/static/js/index.l49xBSOh.js +73 -0
  68. streamlit/static/static/js/{index.Cb8hCZyO.js → index.v5B-faMq.js} +1 -1
  69. streamlit/static/static/js/{index.BgLbohq1.js → index.ydk_VgsB.js} +1 -1
  70. streamlit/static/static/js/{input.Dfd0mQ2M.js → input.D6h4j3mu.js} +2 -2
  71. streamlit/static/static/js/{memory.DFfwDfdX.js → memory.BE4D3Ruc.js} +1 -1
  72. streamlit/static/static/js/{mergeWith.B3E2fSKt.js → mergeWith.CfZBFCuT.js} +1 -1
  73. streamlit/static/static/js/{number-overlay-editor.DG8NE_c_.js → number-overlay-editor.BGuXja4w.js} +1 -1
  74. streamlit/static/static/js/{possibleConstructorReturn.CJ1f9cWL.js → possibleConstructorReturn.GfM_znXN.js} +1 -1
  75. streamlit/static/static/js/{sandbox.-T0hcQrx.js → sandbox.SNug_eHS.js} +1 -1
  76. streamlit/static/static/js/{textarea.CCPaMMRd.js → textarea.C9gOMijs.js} +2 -2
  77. streamlit/static/static/js/{timepicker.BrQl1vN-.js → timepicker.DnkicraE.js} +1 -1
  78. streamlit/static/static/js/{toConsumableArray.UwlRgC7o.js → toConsumableArray.CwiePuJG.js} +1 -1
  79. streamlit/static/static/js/{uniqueId.C5B1A1oI.js → uniqueId.BzT4v6M6.js} +1 -1
  80. streamlit/static/static/js/{useBasicWidgetState.Czrslgva.js → useBasicWidgetState.DKA7kWgD.js} +1 -1
  81. streamlit/static/static/js/{useOnInputChange.Dw8zLgsb.js → useOnInputChange.mkVXolML.js} +1 -1
  82. streamlit/static/static/js/{withFullScreenWrapper.t6HIFyK0.js → withFullScreenWrapper.CfWBIrsM.js} +1 -1
  83. {streamlit_nightly-1.42.3.dev20250301.dist-info → streamlit_nightly-1.43.1.dev20250306.dist-info}/METADATA +1 -1
  84. {streamlit_nightly-1.42.3.dev20250301.dist-info → streamlit_nightly-1.43.1.dev20250306.dist-info}/RECORD +88 -88
  85. streamlit/static/static/js/index.BVLYWr2w.js +0 -1
  86. streamlit/static/static/js/index.BWfK_Obw.js +0 -203
  87. streamlit/static/static/js/index.BXSIv1Yj.js +0 -1
  88. streamlit/static/static/js/index.BhVVEe37.js +0 -1
  89. streamlit/static/static/js/index.BkDOb1MH.js +0 -73
  90. streamlit/static/static/js/index.C2ti2ux-.js +0 -1
  91. streamlit/static/static/js/index.CA_X6A4G.js +0 -1
  92. streamlit/static/static/js/index.CpN57BL8.js +0 -1
  93. streamlit/static/static/js/index.D6kHe3jN.js +0 -1
  94. streamlit/static/static/js/index._Q_M1OIX.js +0 -1
  95. {streamlit_nightly-1.42.3.dev20250301.data → streamlit_nightly-1.43.1.dev20250306.data}/scripts/streamlit.cmd +0 -0
  96. {streamlit_nightly-1.42.3.dev20250301.dist-info → streamlit_nightly-1.43.1.dev20250306.dist-info}/WHEEL +0 -0
  97. {streamlit_nightly-1.42.3.dev20250301.dist-info → streamlit_nightly-1.43.1.dev20250306.dist-info}/entry_points.txt +0 -0
  98. {streamlit_nightly-1.42.3.dev20250301.dist-info → streamlit_nightly-1.43.1.dev20250306.dist-info}/top_level.txt +0 -0
@@ -1,2 +1,2 @@
1
- import{bw as Z,bx as J,r as f,by as Q,y as Y,bz as s,j as v,B as ee,bs as te,bA as re,bt as ne,ba as oe,bB as ie,bu as ae,bq as ue,b5 as P,b4 as W,b7 as le}from"./index.CqU47T61.js";import{a as ce}from"./useBasicWidgetState.Czrslgva.js";import"./FormClearHelper.B_9Ez6vr.js";var se={secondary:"secondary"},G={default:"default"},fe={default:"default"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=Z("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==G.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function j(e){"@babel/helpers - typeof";return j=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(e)}function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},M.apply(this,arguments)}function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function de(e,t){return me(e)||he(e,t)||be(e,t)||ye()}function ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function be(e,t){if(e){if(typeof e=="string")return X(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X(e,t)}}function X(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function he(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,p;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(c){i=!0,p=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw p}}return n}}function me(e){if(Array.isArray(e))return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Se(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ve(e,t,r){return t&&Se(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Oe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$(e,t)}function $(e,t){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$(e,t)}function Ee(e){var t=we();return function(){var n=B(e),o;if(t){var i=B(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _e(this,o)}}function _e(e,t){if(t&&(j(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},B(e)}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Le(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var F=function(e){Oe(r,e);var t=Ee(r);function r(){var n;ge(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),N(K(n),"childRefs",{}),n}return ve(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,p=a===void 0?{}:a,c=i.mode,C=c===void 0?k.checkbox:c,d=i.children,y=i.selected,h=i.disabled,l=i.onClick,_=i.kind,m=i.shape,w=i.size,A=J(p.Root,z),O=de(A,2),E=O[0],L=O[1],H=this.props["aria-label"]||this.props.ariaLabel,g=C===k.radio,V=f.Children.count(d);return f.createElement(Q.Consumer,null,function(q){return f.createElement(E,M({"aria-label":H||q.buttongroup.ariaLabel,"data-baseweb":"button-group",role:g?"radiogroup":"group",$shape:m,$length:d.length},L),f.Children.map(d,function(b,R){if(!f.isValidElement(b))return null;var I=b.props.isSelected?b.props.isSelected:Le(y,R);return g&&(o.childRefs[R]=f.createRef()),f.cloneElement(b,{disabled:h||b.props.disabled,isSelected:I,ref:g?o.childRefs[R]:void 0,tabIndex:!g||I||g&&(!y||y===-1)&&R===0?0:-1,onKeyDown:function(u){if(g){var S=Number(y)?Number(y):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var T=S-1<0?V-1:S-1;l&&l(u,T),o.childRefs[T].current&&o.childRefs[T].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var D=S+1>V-1?0:S+1;l&&l(u,D),o.childRefs[D].current&&o.childRefs[D].current.focus()}}},kind:_,onClick:function(u){h||(b.props.onClick&&b.props.onClick(u),l&&l(u,R))},shape:m,size:w,overrides:pe({BaseButton:{style:function(u){var S=u.$theme;return d.length===1?{}:m!==G.default?{marginLeft:S.sizing.scale100,marginRight:S.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":I,role:g?"radio":"checkbox"}}},b.props.overrides)})}))})}}]),r}(f.Component);N(F,"defaultProps",{disabled:!1,onClick:function(){},shape:G.default,size:fe.default,kind:se.secondary});function Re(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Pe(e,t,r){return e==s.ClickMode.MULTI_SELECT?Re(t,r??[]):r!=null&&r.includes(t)?[]:[t]}function Ce(e){return e.length===0?-1:e[0]}function ke(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Be(e,t,r){const n=r===s.Style.PILLS?P.PILLS:r===s.Style.BORDERLESS?P.BORDERLESS_ICON:P.SEGMENTED_CONTROL,o=r===s.Style.BORDERLESS?W.XSMALL:W.MEDIUM,i=n===P.PILLS||n===P.SEGMENTED_CONTROL,a=r===s.Style.BORDERLESS?"lg":"base";return{element:v(le,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Ae(e,t,r,n){return r.indexOf(n)>-1?!0:t!==s.ClickMode.SINGLE_SELECT||e!==s.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function Ie(e,t){return e&&(t=`${t}Active`),t}function Te(e,t){const r={flexWrap:"wrap",maxWidth:"fit-content"};switch(e){case s.Style.BORDERLESS:return{...r,columnGap:t.threeXS,rowGap:t.threeXS};case s.Style.PILLS:return{...r,columnGap:t.twoXS,rowGap:t.twoXS};case s.Style.SEGMENTED_CONTROL:return{...r,columnGap:t.none,rowGap:t.twoXS,"::after":{content:"''",flex:1e4}};default:return r}}function De(e,t,r,n,o,i){const a=Ae(r,n,o,t);let p=e.content,c=e.contentIcon;return a&&(p=e.selectedContent?e.selectedContent:p,c=e.selectedContentIcon?e.selectedContentIcon:c),f.forwardRef(function(d,y){const{element:h,kind:l,size:_}=Be(p??"",c??void 0,i),m=Ie(!!(a&&!e.selectedContent&&!e.selectedContentIcon),l);return v(ue,{...d,size:_,kind:m,children:h})})}function je(e,t){return e.getIntArrayValue(t)}function Me(e){return e.default??null}function $e(e){return e.value??null}function Ge(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o}=e,{clickMode:i,options:a,selectionVisualization:p,style:c,label:C,labelVisibility:d,help:y}=r,h=Y(),[l,_]=ce({getStateFromWidgetMgr:je,getDefaultStateFromProto:Me,getCurrStateFromProto:$e,updateWidgetMgrState:ke,element:r,widgetMgr:o,fragmentId:n}),m=(O,E)=>{const L=Pe(i,E,l);_({value:L,fromUi:!0})};let w;i===s.ClickMode.SINGLE_SELECT?w=k.radio:i===s.ClickMode.MULTI_SELECT&&(w=k.checkbox);const A=f.useMemo(()=>a.map((O,E)=>{const L=De(O,E,p,i,l,c);return v(L,{},`${O.content}-${E}`)}),[i,a,p,c,l]);return ee("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[v(ae,{label:C,disabled:t,labelVisibility:te((d==null?void 0:d.value)??ie.LabelVisibilityOptions.COLLAPSED),children:y&&v(re,{children:v(ne,{content:y,placement:oe.TOP})})}),v(F,{disabled:t,mode:w,onClick:m,selected:i===s.ClickMode.MULTI_SELECT?l:Ce(l),overrides:{Root:{style:f.useCallback(()=>Te(c,h.spacing),[c,h.spacing])}},children:A})]})}const Ue=f.memo(Ge);export{Ue as default};
1
+ import{bv as q,bw as J,r as f,bx as Q,y as Y,by as s,j as S,B as ee,br as te,bz as re,bs as ne,ba as oe,bA as ie,bt as ae,bp as ue,b5 as P,b4 as W,b7 as le}from"./index.BpcIvL5C.js";import{a as ce}from"./useBasicWidgetState.DKA7kWgD.js";import"./FormClearHelper.DiTttn8n.js";var se={secondary:"secondary"},G={default:"default"},fe={default:"default"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=q("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==G.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function j(e){"@babel/helpers - typeof";return j=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(e)}function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},M.apply(this,arguments)}function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function de(e,t){return me(e)||he(e,t)||be(e,t)||ye()}function ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function be(e,t){if(e){if(typeof e=="string")return X(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X(e,t)}}function X(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function he(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,p;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(c){i=!0,p=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw p}}return n}}function me(e){if(Array.isArray(e))return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Se(e,t,r){return t&&ve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Oe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$(e,t)}function $(e,t){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$(e,t)}function Ee(e){var t=we();return function(){var n=A(e),o;if(t){var i=A(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _e(this,o)}}function _e(e,t){if(t&&(j(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function A(e){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},A(e)}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Le(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var F=function(e){Oe(r,e);var t=Ee(r);function r(){var n;ge(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),N(K(n),"childRefs",{}),n}return Se(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,p=a===void 0?{}:a,c=i.mode,C=c===void 0?k.checkbox:c,d=i.children,y=i.selected,h=i.disabled,l=i.onClick,_=i.kind,m=i.shape,w=i.size,B=J(p.Root,z),O=de(B,2),E=O[0],L=O[1],H=this.props["aria-label"]||this.props.ariaLabel,g=C===k.radio,V=f.Children.count(d);return f.createElement(Q.Consumer,null,function(Z){return f.createElement(E,M({"aria-label":H||Z.buttongroup.ariaLabel,"data-baseweb":"button-group",role:g?"radiogroup":"group",$shape:m,$length:d.length},L),f.Children.map(d,function(b,R){if(!f.isValidElement(b))return null;var I=b.props.isSelected?b.props.isSelected:Le(y,R);return g&&(o.childRefs[R]=f.createRef()),f.cloneElement(b,{disabled:h||b.props.disabled,isSelected:I,ref:g?o.childRefs[R]:void 0,tabIndex:!g||I||g&&(!y||y===-1)&&R===0?0:-1,onKeyDown:function(u){if(g){var v=Number(y)?Number(y):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var T=v-1<0?V-1:v-1;l&&l(u,T),o.childRefs[T].current&&o.childRefs[T].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var D=v+1>V-1?0:v+1;l&&l(u,D),o.childRefs[D].current&&o.childRefs[D].current.focus()}}},kind:_,onClick:function(u){h||(b.props.onClick&&b.props.onClick(u),l&&l(u,R))},shape:m,size:w,overrides:pe({BaseButton:{style:function(u){var v=u.$theme;return d.length===1?{}:m!==G.default?{marginLeft:v.sizing.scale100,marginRight:v.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":I,role:g?"radio":"checkbox"}}},b.props.overrides)})}))})}}]),r}(f.Component);N(F,"defaultProps",{disabled:!1,onClick:function(){},shape:G.default,size:fe.default,kind:se.secondary});function Re(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Pe(e,t,r){return e==s.ClickMode.MULTI_SELECT?Re(t,r??[]):r!=null&&r.includes(t)?[]:[t]}function Ce(e){return e.length===0?-1:e[0]}function ke(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Ae(e,t,r){const n=r===s.Style.PILLS?P.PILLS:r===s.Style.BORDERLESS?P.BORDERLESS_ICON:P.SEGMENTED_CONTROL,o=r===s.Style.BORDERLESS?W.XSMALL:W.MEDIUM,i=n===P.PILLS||n===P.SEGMENTED_CONTROL,a=r===s.Style.BORDERLESS?"lg":"base";return{element:S(le,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Be(e,t,r,n){return r.indexOf(n)>-1?!0:t!==s.ClickMode.SINGLE_SELECT||e!==s.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function Ie(e,t){return e&&(t=`${t}Active`),t}function Te(e,t){const r={flexWrap:"wrap",maxWidth:"fit-content"};switch(e){case s.Style.BORDERLESS:return{...r,columnGap:t.threeXS,rowGap:t.threeXS};case s.Style.PILLS:return{...r,columnGap:t.twoXS,rowGap:t.twoXS};case s.Style.SEGMENTED_CONTROL:return{...r,columnGap:t.none,rowGap:t.twoXS,"::after":{content:"''",flex:1e4}};default:return r}}function De(e,t,r,n,o,i){const a=Be(r,n,o,t);let p=e.content,c=e.contentIcon;return a&&(p=e.selectedContent?e.selectedContent:p,c=e.selectedContentIcon?e.selectedContentIcon:c),f.forwardRef(function(d,y){const{element:h,kind:l,size:_}=Ae(p??"",c??void 0,i),m=Ie(!!(a&&!e.selectedContent&&!e.selectedContentIcon),l);return S(ue,{...d,size:_,kind:m,children:h})})}function je(e,t){return e.getIntArrayValue(t)}function Me(e){return e.default??null}function $e(e){return e.value??null}function Ge(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o}=e,{clickMode:i,options:a,selectionVisualization:p,style:c,label:C,labelVisibility:d,help:y}=r,h=Y(),[l,_]=ce({getStateFromWidgetMgr:je,getDefaultStateFromProto:Me,getCurrStateFromProto:$e,updateWidgetMgrState:ke,element:r,widgetMgr:o,fragmentId:n}),m=(O,E)=>{const L=Pe(i,E,l);_({value:L,fromUi:!0})};let w;i===s.ClickMode.SINGLE_SELECT?w=k.radio:i===s.ClickMode.MULTI_SELECT&&(w=k.checkbox);const B=f.useMemo(()=>a.map((O,E)=>{const L=De(O,E,p,i,l,c);return S(L,{},`${O.content}-${E}`)}),[i,a,p,c,l]);return ee("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[S(ae,{label:C,disabled:t,labelVisibility:te((d==null?void 0:d.value)??ie.LabelVisibilityOptions.COLLAPSED),children:y&&S(re,{children:S(ne,{content:y,placement:oe.TOP})})}),S(F,{disabled:t,mode:w,onClick:m,selected:i===s.ClickMode.MULTI_SELECT?l:Ce(l),overrides:{Root:{style:f.useCallback(()=>Te(c,h.spacing),[c,h.spacing])}},children:B})]})}const Ue=f.memo(Ge);export{Ue as default};