streamlit-nightly 1.53.2.dev20260128__py3-none-any.whl → 1.53.2.dev20260131__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 (222) hide show
  1. streamlit/config.py +3 -2
  2. streamlit/config_util.py +63 -8
  3. streamlit/elements/deck_gl_json_chart.py +5 -1
  4. streamlit/elements/lib/built_in_chart_utils.py +24 -4
  5. streamlit/elements/lib/color_util.py +20 -1
  6. streamlit/elements/vega_charts.py +24 -4
  7. streamlit/proto/Alert_pb2.py +2 -3
  8. streamlit/proto/AppPage_pb2.py +2 -3
  9. streamlit/proto/ArrowData_pb2.py +2 -3
  10. streamlit/proto/ArrowNamedDataSet_pb2.py +2 -3
  11. streamlit/proto/ArrowVegaLiteChart_pb2.py +2 -3
  12. streamlit/proto/Arrow_pb2.py +11 -18
  13. streamlit/proto/Arrow_pb2.pyi +1 -42
  14. streamlit/proto/AudioInput_pb2.py +2 -3
  15. streamlit/proto/Audio_pb2.py +2 -3
  16. streamlit/proto/AuthRedirect_pb2.py +2 -3
  17. streamlit/proto/AutoRerun_pb2.py +2 -3
  18. streamlit/proto/BackMsg_pb2.py +2 -3
  19. streamlit/proto/Balloons_pb2.py +2 -3
  20. streamlit/proto/BidiComponent_pb2.py +2 -3
  21. streamlit/proto/Block_pb2.py +36 -43
  22. streamlit/proto/Block_pb2.pyi +3 -48
  23. streamlit/proto/BokehChart_pb2.py +2 -3
  24. streamlit/proto/ButtonGroup_pb2.py +2 -3
  25. streamlit/proto/ButtonLikeIconPosition_pb2.py +2 -3
  26. streamlit/proto/Button_pb2.py +3 -6
  27. streamlit/proto/Button_pb2.pyi +1 -18
  28. streamlit/proto/CameraInput_pb2.py +2 -3
  29. streamlit/proto/ChatInput_pb2.py +5 -8
  30. streamlit/proto/ChatInput_pb2.pyi +1 -17
  31. streamlit/proto/Checkbox_pb2.py +2 -3
  32. streamlit/proto/ClientState_pb2.py +2 -3
  33. streamlit/proto/Code_pb2.py +3 -6
  34. streamlit/proto/Code_pb2.pyi +1 -18
  35. streamlit/proto/ColorPicker_pb2.py +2 -3
  36. streamlit/proto/Common_pb2.py +7 -8
  37. streamlit/proto/Common_pb2.pyi +2 -10
  38. streamlit/proto/Components_pb2.py +2 -3
  39. streamlit/proto/DateInput_pb2.py +2 -3
  40. streamlit/proto/DateTimeInput_pb2.py +2 -3
  41. streamlit/proto/DeckGlJsonChart_pb2.py +5 -12
  42. streamlit/proto/DeckGlJsonChart_pb2.pyi +1 -54
  43. streamlit/proto/Delta_pb2.py +4 -6
  44. streamlit/proto/Delta_pb2.pyi +5 -14
  45. streamlit/proto/DocString_pb2.py +2 -3
  46. streamlit/proto/DownloadButton_pb2.py +2 -3
  47. streamlit/proto/Element_pb2.py +4 -7
  48. streamlit/proto/Element_pb2.pyi +3 -23
  49. streamlit/proto/Empty_pb2.py +2 -3
  50. streamlit/proto/Exception_pb2.py +2 -3
  51. streamlit/proto/Favicon_pb2.py +2 -3
  52. streamlit/proto/FileUploader_pb2.py +2 -3
  53. streamlit/proto/ForwardMsg_pb2.py +12 -18
  54. streamlit/proto/ForwardMsg_pb2.pyi +4 -48
  55. streamlit/proto/GapSize_pb2.py +2 -3
  56. streamlit/proto/GitInfo_pb2.py +2 -3
  57. streamlit/proto/GraphVizChart_pb2.py +3 -6
  58. streamlit/proto/GraphVizChart_pb2.pyi +1 -18
  59. streamlit/proto/Heading_pb2.py +2 -3
  60. streamlit/proto/HeightConfig_pb2.py +2 -3
  61. streamlit/proto/Html_pb2.py +2 -3
  62. streamlit/proto/IFrame_pb2.py +3 -10
  63. streamlit/proto/IFrame_pb2.pyi +1 -42
  64. streamlit/proto/Image_pb2.py +3 -6
  65. streamlit/proto/Image_pb2.pyi +1 -18
  66. streamlit/proto/Json_pb2.py +2 -3
  67. streamlit/proto/LabelVisibilityMessage_pb2.py +2 -3
  68. streamlit/proto/LinkButton_pb2.py +2 -3
  69. streamlit/proto/Logo_pb2.py +2 -3
  70. streamlit/proto/Markdown_pb2.py +2 -3
  71. streamlit/proto/Metric_pb2.py +2 -3
  72. streamlit/proto/MetricsEvent_pb2.py +2 -3
  73. streamlit/proto/MultiSelect_pb2.py +3 -6
  74. streamlit/proto/MultiSelect_pb2.pyi +1 -11
  75. streamlit/proto/Navigation_pb2.py +2 -3
  76. streamlit/proto/NewSession_pb2.py +27 -28
  77. streamlit/proto/NewSession_pb2.pyi +2 -12
  78. streamlit/proto/NumberInput_pb2.py +2 -3
  79. streamlit/proto/PageConfig_pb2.py +2 -3
  80. streamlit/proto/PageInfo_pb2.py +2 -3
  81. streamlit/proto/PageLink_pb2.py +2 -3
  82. streamlit/proto/PageNotFound_pb2.py +2 -3
  83. streamlit/proto/PageProfile_pb2.py +2 -3
  84. streamlit/proto/ParentMessage_pb2.py +2 -3
  85. streamlit/proto/PlotlyChart_pb2.py +5 -10
  86. streamlit/proto/PlotlyChart_pb2.pyi +1 -58
  87. streamlit/proto/Progress_pb2.py +2 -3
  88. streamlit/proto/Radio_pb2.py +3 -6
  89. streamlit/proto/Radio_pb2.pyi +2 -19
  90. streamlit/proto/RootContainer_pb2.py +2 -3
  91. streamlit/proto/Selectbox_pb2.py +3 -6
  92. streamlit/proto/Selectbox_pb2.pyi +2 -19
  93. streamlit/proto/SessionEvent_pb2.py +2 -3
  94. streamlit/proto/SessionStatus_pb2.py +2 -3
  95. streamlit/proto/Skeleton_pb2.py +2 -3
  96. streamlit/proto/Slider_pb2.py +2 -3
  97. streamlit/proto/Snow_pb2.py +2 -3
  98. streamlit/proto/Space_pb2.py +2 -3
  99. streamlit/proto/Spinner_pb2.py +2 -3
  100. streamlit/proto/TextAlignmentConfig_pb2.py +2 -3
  101. streamlit/proto/TextArea_pb2.py +3 -6
  102. streamlit/proto/TextArea_pb2.pyi +1 -18
  103. streamlit/proto/TextInput_pb2.py +2 -3
  104. streamlit/proto/Text_pb2.py +2 -3
  105. streamlit/proto/TimeInput_pb2.py +2 -3
  106. streamlit/proto/Toast_pb2.py +2 -3
  107. streamlit/proto/Transient_pb2.py +2 -3
  108. streamlit/proto/Video_pb2.py +2 -3
  109. streamlit/proto/WidgetStates_pb2.py +2 -3
  110. streamlit/proto/WidthConfig_pb2.py +2 -3
  111. streamlit/proto/openmetrics_data_model_pb2.py +2 -3
  112. streamlit/runtime/runtime.py +0 -4
  113. streamlit/static/index.html +1 -1
  114. streamlit/static/manifest.json +295 -295
  115. streamlit/static/static/js/{ErrorOutline.esm.D71F8ziR.js → ErrorOutline.esm.DC6KVDKK.js} +1 -1
  116. streamlit/static/static/js/{FileDownload.esm.yTkppsJy.js → FileDownload.esm.Z9hRQIHi.js} +1 -1
  117. streamlit/static/static/js/{FileHelper.hUOqtbwa.js → FileHelper.DqvW90pm.js} +1 -1
  118. streamlit/static/static/js/{FormClearHelper.DN8D_YXO.js → FormClearHelper.DTFnX0js.js} +1 -1
  119. streamlit/static/static/js/{InputInstructions.DbssY6d4.js → InputInstructions.CdzsN_Va.js} +1 -1
  120. streamlit/static/static/js/{Particles.BznyVdfo.js → Particles.12xFSjcn.js} +1 -1
  121. streamlit/static/static/js/{ProgressBar.C5uBOtcx.js → ProgressBar.Dg-oMbWg.js} +1 -1
  122. streamlit/static/static/js/{StreamlitSyntaxHighlighter.Nf1895x-.js → StreamlitSyntaxHighlighter.rbzmcipw.js} +1 -1
  123. streamlit/static/static/js/{TableChart.esm.DHKzVs3a.js → TableChart.esm.CzJtGIR-.js} +1 -1
  124. streamlit/static/static/js/{Toolbar.CQsWYXer.js → Toolbar.COH7NaOE.js} +1 -1
  125. streamlit/static/static/js/{WidgetLabelHelpIconInline.6xCU76OE.js → WidgetLabelHelpIconInline.Dlc8f0Ji.js} +1 -1
  126. streamlit/static/static/js/{base-input.Cs-E6S71.js → base-input.Q-zJLgRK.js} +4 -4
  127. streamlit/static/static/js/{checkbox.OTGupu18.js → checkbox.BKgWNdeI.js} +1 -1
  128. streamlit/static/static/js/{createDownloadLinkElement.DnBEQQbK.js → createDownloadLinkElement.6oO-YlYv.js} +1 -1
  129. streamlit/static/static/js/{data-grid-overlay-editor.COiiMi5r.js → data-grid-overlay-editor.CO0xdNiG.js} +1 -1
  130. streamlit/static/static/js/{downloader.K0GUNeuj.js → downloader.BBXcXdX1.js} +1 -1
  131. streamlit/static/static/js/{embed.o8HvK3mH.js → embed.CJzOXYBF.js} +1 -1
  132. streamlit/static/static/js/{es6.BHy5pqTP.js → es6.CdxPQzwJ.js} +2 -2
  133. streamlit/static/static/js/{formatNumber.BK7h0k2z.js → formatNumber.DB5irY8c.js} +1 -1
  134. streamlit/static/static/js/{iconPosition.2YynQUxu.js → iconPosition.BVScIr6G.js} +1 -1
  135. streamlit/static/static/js/{iframeResizer.contentWindow.D5h3hQuU.js → iframeResizer.contentWindow.D_QHVqPM.js} +1 -1
  136. streamlit/static/static/js/{index.cfuZ69LI.js → index.6DFY6LUF.js} +1 -1
  137. streamlit/static/static/js/{index.Dh3PJIlq.js → index.B80gSxrS.js} +1 -1
  138. streamlit/static/static/js/{index.DxfYCrPp.js → index.BDtN2n7T.js} +1 -1
  139. streamlit/static/static/js/{index.DLUSo6de.js → index.BED2_zc7.js} +1 -1
  140. streamlit/static/static/js/{index.CxWzt6oi.js → index.BQnLeHnr.js} +1 -1
  141. streamlit/static/static/js/{index.Cb03y5I8.js → index.BSYebegS.js} +1 -1
  142. streamlit/static/static/js/{index.BtuskCwg.js → index.BSpYHDvk.js} +1 -1
  143. streamlit/static/static/js/{index.q0ceUXt6.js → index.BiCbrx53.js} +1 -1
  144. streamlit/static/static/js/{index.CgVv04GM.js → index.Biyf9aUg.js} +1 -1
  145. streamlit/static/static/js/{index.BPdmXoYW.js → index.BqbKiDp2.js} +1 -1
  146. streamlit/static/static/js/{index.COh5V_89.js → index.BqxwnMem.js} +1 -1
  147. streamlit/static/static/js/{index.DVRCyxMp.js → index.BtOoVQt7.js} +1 -1
  148. streamlit/static/static/js/{index.C7wst9Tm.js → index.BxMkW82k.js} +1 -1
  149. streamlit/static/static/js/{index.5zqfJ-in.js → index.BxQxTpWl.js} +1 -1
  150. streamlit/static/static/js/{index.BtRWcqZV.js → index.C5oqIM3a.js} +1 -1
  151. streamlit/static/static/js/{index.iUV9rb8C.js → index.CBE2cIbj.js} +1 -1
  152. streamlit/static/static/js/{index.DcngUOyD.js → index.CE2WIFD1.js} +1 -1
  153. streamlit/static/static/js/{index.aCorc3Yt.js → index.CPc_uZux.js} +48 -48
  154. streamlit/static/static/js/{index.Bqmx23jK.js → index.CUYi3FrD.js} +1 -1
  155. streamlit/static/static/js/index.Cpu2p5bH.js +1 -0
  156. streamlit/static/static/js/{index.Bfo1cXfC.js → index.CrY1BsL3.js} +1 -1
  157. streamlit/static/static/js/{index.Dc5-tFdw.js → index.CtbETWQK.js} +1 -1
  158. streamlit/static/static/js/{index.CUkhn-vu.js → index.CvtybR-u.js} +1 -1
  159. streamlit/static/static/js/{index.BZ-GJVxB.js → index.CxoREvnF.js} +1 -1
  160. streamlit/static/static/js/{index.C6wyTXhz.js → index.D6OexhdL.js} +1 -1
  161. streamlit/static/static/js/{index.HmRK3HyC.js → index.D9v2Y8Gk.js} +1 -1
  162. streamlit/static/static/js/{index.8MlRyIxN.js → index.DAfIQKfP.js} +1 -1
  163. streamlit/static/static/js/index.DAnczAW2.js +2 -0
  164. streamlit/static/static/js/{index.TjMWsKSH.js → index.DAyGxxdm.js} +1 -1
  165. streamlit/static/static/js/{index.6c-qDsD7.js → index.DCe7fo-m.js} +1 -1
  166. streamlit/static/static/js/{index.CX0KdFyR.js → index.DNfyKqhQ.js} +1 -1
  167. streamlit/static/static/js/{index.DJfMW0Gy.js → index.DRoJNzFX.js} +1 -1
  168. streamlit/static/static/js/{index.DBPWUJsj.js → index.DU68jVpM.js} +54 -54
  169. streamlit/static/static/js/{index.BfMPq234.js → index.DZmBuE3z.js} +2 -2
  170. streamlit/static/static/js/{index.CYhhEdja.js → index.DhRAGiPR.js} +1 -1
  171. streamlit/static/static/js/{index.DlgcEr0f.js → index.DrcbvB2t.js} +1 -1
  172. streamlit/static/static/js/{index.DxGXuhh6.js → index.Dud7RRHc.js} +1 -1
  173. streamlit/static/static/js/{index.C2EoeVjP.js → index.DyXcT2tD.js} +1 -1
  174. streamlit/static/static/js/{index.Bgf49D1Z.js → index.DyfvmNCy.js} +222 -222
  175. streamlit/static/static/js/{index.CZf7Go1Z.js → index.GieKl4BG.js} +1 -1
  176. streamlit/static/static/js/{index.C65jHNhe.js → index.YULCxEtm.js} +1 -1
  177. streamlit/static/static/js/{index.DL_yE83J.js → index._1zqETQ9.js} +2 -2
  178. streamlit/static/static/js/{index.CwtpGPHA.js → index.bQJYmJ2T.js} +1 -1
  179. streamlit/static/static/js/{index.hlAfdSqC.js → index.iXh5nbLZ.js} +1 -1
  180. streamlit/static/static/js/index.mSdC1FV6.js +1 -0
  181. streamlit/static/static/js/{index.BIqcOZ_u.js → index.nL1fkE1D.js} +1 -1
  182. streamlit/static/static/js/{index.VwDKazgt.js → index.tuFFlbxa.js} +1 -1
  183. streamlit/static/static/js/{index.BzTVI_BY.js → index.y-pa6LIX.js} +1 -1
  184. streamlit/static/static/js/{input.CXGIJ7D6.js → input.BcC6sPE_.js} +1 -1
  185. streamlit/static/static/js/{main.CCVkbuxC.js → main.TU5_aabd.js} +1 -1
  186. streamlit/static/static/js/{memory.CNbnYs2A.js → memory.By_OTlI4.js} +1 -1
  187. streamlit/static/static/js/{number-overlay-editor.CvI6wkld.js → number-overlay-editor.FSRaRpbU.js} +1 -1
  188. streamlit/static/static/js/{pandasStylerUtils.CFSReOTm.js → pandasStylerUtils.3IiIKU9-.js} +1 -1
  189. streamlit/static/static/js/{sandbox.Bld0L3us.js → sandbox.DnxTbWzV.js} +1 -1
  190. streamlit/static/static/js/{styled-components.BoUHK6TA.js → styled-components.BeEcZ0vW.js} +1 -1
  191. streamlit/static/static/js/{throttle.ByDFm7WV.js → throttle.emUyC44c.js} +1 -1
  192. streamlit/static/static/js/{timepicker.CN6CUZEL.js → timepicker.DZ_ZufYF.js} +1 -1
  193. streamlit/static/static/js/{toConsumableArray.DwMycSpg.js → toConsumableArray.DDV1bN1-.js} +1 -1
  194. streamlit/static/static/js/uniqueId.DTwvAE-J.js +1 -0
  195. streamlit/static/static/js/{useBasicWidgetState.Bg0ZMUt5.js → useBasicWidgetState.DvpdEDYZ.js} +1 -1
  196. streamlit/static/static/js/{useIntlLocale.DgBUDcPA.js → useIntlLocale.BBDLbTq9.js} +1 -1
  197. streamlit/static/static/js/{useTextInputAutoExpand.DDBezxks.js → useTextInputAutoExpand.BIApLJKn.js} +1 -1
  198. streamlit/static/static/js/{useUpdateUiValue.Df1h6fXC.js → useUpdateUiValue.DQ4RuJNC.js} +1 -1
  199. streamlit/static/static/js/{useWaveformController.DbWw5MEk.js → useWaveformController.B0olyXLQ.js} +1 -1
  200. streamlit/static/static/js/{withCalculatedWidth.YaK0HIIP.js → withCalculatedWidth.DYeqePuh.js} +1 -1
  201. streamlit/static/static/js/{withFullScreenWrapper.CcWCKoY8.js → withFullScreenWrapper.DtkUCO_d.js} +1 -1
  202. streamlit/testing/v1/element_tree.py +16 -2
  203. streamlit/web/server/server.py +0 -1
  204. streamlit/web/server/starlette/starlette_app.py +0 -1
  205. {streamlit_nightly-1.53.2.dev20260128.dist-info → streamlit_nightly-1.53.2.dev20260131.dist-info}/METADATA +10 -25
  206. {streamlit_nightly-1.53.2.dev20260128.dist-info → streamlit_nightly-1.53.2.dev20260131.dist-info}/RECORD +209 -218
  207. streamlit/proto/DataFrame_pb2.py +0 -56
  208. streamlit/proto/DataFrame_pb2.pyi +0 -430
  209. streamlit/proto/NamedDataSet_pb2.py +0 -28
  210. streamlit/proto/NamedDataSet_pb2.pyi +0 -67
  211. streamlit/proto/PagesChanged_pb2.py +0 -28
  212. streamlit/proto/PagesChanged_pb2.pyi +0 -55
  213. streamlit/proto/VegaLiteChart_pb2.py +0 -29
  214. streamlit/proto/VegaLiteChart_pb2.pyi +0 -79
  215. streamlit/static/static/js/index.CSPY26T2.js +0 -1
  216. streamlit/static/static/js/index.CdsyTabv.js +0 -1
  217. streamlit/static/static/js/index.CjRU8O1O.js +0 -2
  218. streamlit/static/static/js/uniqueId.DcCWa2cf.js +0 -1
  219. streamlit_nightly-1.53.2.dev20260128.data/scripts/streamlit.cmd +0 -16
  220. {streamlit_nightly-1.53.2.dev20260128.dist-info → streamlit_nightly-1.53.2.dev20260131.dist-info}/WHEEL +0 -0
  221. {streamlit_nightly-1.53.2.dev20260128.dist-info → streamlit_nightly-1.53.2.dev20260131.dist-info}/entry_points.txt +0 -0
  222. {streamlit_nightly-1.53.2.dev20260128.dist-info → streamlit_nightly-1.53.2.dev20260131.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,3 @@
1
- import{am as _,an as ye,w as O,r as u,l as $e,o as ne,j as M,P as Oe,ac as Re,q as oe,aa as ie,bq as ae,p as _e,e as Se}from"./index.aCorc3Yt.js";import{W as Pe}from"./WidgetLabelHelpIconInline.6xCU76OE.js";import{u as we}from"./useBasicWidgetState.Bg0ZMUt5.js";import"./FormClearHelper.DN8D_YXO.js";var se={vertical:"vertical",horizontal:"horizontal"};function le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?le(Object(n),!0).forEach(function(r){R(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):le(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=0,L=1,T=2;function z(e){return e.$isActive?T:e.$isHovered?L:E}function Me(e){var t=e.$theme.colors,n=e.$disabled,r=e.$checked,o=e.$isFocusVisible,i=e.$error;if(n)return t.tickFillDisabled;if(r)if(i)switch(z(e)){case E:return t.tickFillErrorSelected;case L:return t.tickFillErrorSelectedHover;case T:return t.tickFillErrorSelectedHoverActive}else switch(z(e)){case E:return t.tickFillSelected;case L:return t.tickFillSelectedHover;case T:return t.tickFillSelectedHoverActive}else return o?t.borderSelected:i?t.tickBorderError:t.tickBorder;return null}function ke(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(z(e)){case E:return t.tickFillError;case L:return t.tickFillErrorHover;case T:return t.tickFillErrorHoverActive}else switch(z(e)){case E:return t.tickFill;case L:return t.tickFillHover;case T:return t.tickFillActive}}function Fe(e){var t=e.$labelPlacement,n=t===void 0?"":t,r=e.$theme,o;switch(n){case"top":o="Bottom";break;case"bottom":o="Top";break;case"left":o=r.direction==="rtl"?"Left":"Right";break;default:case"right":o=r.direction==="rtl"?"Right":"Left";break}var i=r.sizing,s=i.scale300;return R({},"padding".concat(o),s)}function Ie(e){var t=e.$disabled,n=e.$theme,r=n.colors;return t?r.contentSecondary:r.contentPrimary}var q=_("div",function(e){var t=e.$disabled,n=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:n==="horizontal"?"row":"column",alignItems:n==="horizontal"?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}});q.displayName="RadioGroupRoot";q.displayName="RadioGroupRoot";var X=_("label",function(e){var t,n=e.$disabled,r=e.$hasDescription,o=e.$labelPlacement,i=e.$theme,s=e.$align,a=i.sizing,c=s==="horizontal",p=i.direction==="rtl"?"Left":"Right";return t={flexDirection:o==="top"||o==="bottom"?"column":"row",display:"flex",alignItems:"center",cursor:n?"not-allowed":"pointer",marginTop:a.scale200},R(t,"margin".concat(p),c?a.scale200:null),R(t,"marginBottom",r&&!c?null:a.scale200),t});X.displayName="Root";X.displayName="Root";var K=_("div",function(e){var t=e.$theme,n=t.animation,r=t.sizing;return{backgroundColor:ke(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?r.scale200:r.scale550,transitionDuration:n.timing200,transitionTimingFunction:n.easeOutCurve,width:e.$checked?r.scale200:r.scale550}});K.displayName="RadioMarkInner";K.displayName="RadioMarkInner";var J=_("div",function(e){var t=e.$theme,n=t.animation,r=t.sizing;return{alignItems:"center",backgroundColor:Me(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:r.scale700,justifyContent:"center",marginTop:r.scale0,marginRight:r.scale0,marginBottom:r.scale0,marginLeft:r.scale0,outline:"none",verticalAlign:"middle",width:r.scale700,flexShrink:0,transitionDuration:n.timing200,transitionTimingFunction:n.easeOutCurve}});J.displayName="RadioMarkOuter";J.displayName="RadioMarkOuter";var Q=_("div",function(e){var t=e.$theme.typography;return D(D({verticalAlign:"middle"},Fe(e)),{},{color:Ie(e)},t.LabelMedium)});Q.displayName="Label";Q.displayName="Label";var Y=_("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});Y.displayName="Input";Y.displayName="Input";var Z=_("div",function(e){var t,n=e.$theme,r=e.$align,o=r==="horizontal",i=n.direction==="rtl"?"Right":"Left",s=n.direction==="rtl"?"Left":"Right";return D(D({},n.typography.ParagraphSmall),{},(t={color:n.colors.contentSecondary,cursor:"auto"},R(t,"margin".concat(i),r==="horizontal"?null:n.sizing.scale900),R(t,"margin".concat(s),o?n.sizing.scale200:null),R(t,"maxWidth","240px"),t))});Z.displayName="Description";Z.displayName="Description";function N(e){"@babel/helpers - typeof";return N=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},N(e)}function V(){return V=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},V.apply(this,arguments)}function Ee(e,t){return Ae(e)||xe(e,t)||Te(e,t)||Le()}function Le(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{am as _,an as ye,w as O,r as u,l as $e,o as ne,j as M,P as Oe,ac as Re,q as oe,aa as ie,bk as ae,p as _e,e as Se}from"./index.CPc_uZux.js";import{W as Pe}from"./WidgetLabelHelpIconInline.Dlc8f0Ji.js";import{u as we}from"./useBasicWidgetState.DvpdEDYZ.js";import"./FormClearHelper.DTFnX0js.js";var se={vertical:"vertical",horizontal:"horizontal"};function le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?le(Object(n),!0).forEach(function(r){R(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):le(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=0,L=1,T=2;function z(e){return e.$isActive?T:e.$isHovered?L:E}function Me(e){var t=e.$theme.colors,n=e.$disabled,r=e.$checked,o=e.$isFocusVisible,i=e.$error;if(n)return t.tickFillDisabled;if(r)if(i)switch(z(e)){case E:return t.tickFillErrorSelected;case L:return t.tickFillErrorSelectedHover;case T:return t.tickFillErrorSelectedHoverActive}else switch(z(e)){case E:return t.tickFillSelected;case L:return t.tickFillSelectedHover;case T:return t.tickFillSelectedHoverActive}else return o?t.borderSelected:i?t.tickBorderError:t.tickBorder;return null}function ke(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(z(e)){case E:return t.tickFillError;case L:return t.tickFillErrorHover;case T:return t.tickFillErrorHoverActive}else switch(z(e)){case E:return t.tickFill;case L:return t.tickFillHover;case T:return t.tickFillActive}}function Fe(e){var t=e.$labelPlacement,n=t===void 0?"":t,r=e.$theme,o;switch(n){case"top":o="Bottom";break;case"bottom":o="Top";break;case"left":o=r.direction==="rtl"?"Left":"Right";break;default:case"right":o=r.direction==="rtl"?"Right":"Left";break}var i=r.sizing,s=i.scale300;return R({},"padding".concat(o),s)}function Ie(e){var t=e.$disabled,n=e.$theme,r=n.colors;return t?r.contentSecondary:r.contentPrimary}var q=_("div",function(e){var t=e.$disabled,n=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:n==="horizontal"?"row":"column",alignItems:n==="horizontal"?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}});q.displayName="RadioGroupRoot";q.displayName="RadioGroupRoot";var X=_("label",function(e){var t,n=e.$disabled,r=e.$hasDescription,o=e.$labelPlacement,i=e.$theme,s=e.$align,a=i.sizing,c=s==="horizontal",p=i.direction==="rtl"?"Left":"Right";return t={flexDirection:o==="top"||o==="bottom"?"column":"row",display:"flex",alignItems:"center",cursor:n?"not-allowed":"pointer",marginTop:a.scale200},R(t,"margin".concat(p),c?a.scale200:null),R(t,"marginBottom",r&&!c?null:a.scale200),t});X.displayName="Root";X.displayName="Root";var K=_("div",function(e){var t=e.$theme,n=t.animation,r=t.sizing;return{backgroundColor:ke(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?r.scale200:r.scale550,transitionDuration:n.timing200,transitionTimingFunction:n.easeOutCurve,width:e.$checked?r.scale200:r.scale550}});K.displayName="RadioMarkInner";K.displayName="RadioMarkInner";var J=_("div",function(e){var t=e.$theme,n=t.animation,r=t.sizing;return{alignItems:"center",backgroundColor:Me(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:r.scale700,justifyContent:"center",marginTop:r.scale0,marginRight:r.scale0,marginBottom:r.scale0,marginLeft:r.scale0,outline:"none",verticalAlign:"middle",width:r.scale700,flexShrink:0,transitionDuration:n.timing200,transitionTimingFunction:n.easeOutCurve}});J.displayName="RadioMarkOuter";J.displayName="RadioMarkOuter";var Q=_("div",function(e){var t=e.$theme.typography;return D(D({verticalAlign:"middle"},Fe(e)),{},{color:Ie(e)},t.LabelMedium)});Q.displayName="Label";Q.displayName="Label";var Y=_("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});Y.displayName="Input";Y.displayName="Input";var Z=_("div",function(e){var t,n=e.$theme,r=e.$align,o=r==="horizontal",i=n.direction==="rtl"?"Right":"Left",s=n.direction==="rtl"?"Left":"Right";return D(D({},n.typography.ParagraphSmall),{},(t={color:n.colors.contentSecondary,cursor:"auto"},R(t,"margin".concat(i),r==="horizontal"?null:n.sizing.scale900),R(t,"margin".concat(s),o?n.sizing.scale200:null),R(t,"maxWidth","240px"),t))});Z.displayName="Description";Z.displayName="Description";function N(e){"@babel/helpers - typeof";return N=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},N(e)}function V(){return V=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},V.apply(this,arguments)}function Ee(e,t){return Ae(e)||xe(e,t)||Te(e,t)||Le()}function Le(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Te(e,t){if(e){if(typeof e=="string")return ue(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ue(e,t)}}function ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(e);!(o=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));o=!0);}catch(c){i=!0,a=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function Ae(e){if(Array.isArray(e))return e}function je(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function De(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ze(e,t,n){return t&&De(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Be(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&&U(e,t)}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},U(e,t)}function Ce(e){var t=Ne();return function(){var r=B(e),o;if(t){var i=B(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return He(this,o)}}function He(e,t){if(t&&(N(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return A(e)}function A(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ne(){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(n){return n.__proto__||Object.getPrototypeOf(n)},B(e)}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pe=(function(e){Be(n,e);var t=Ce(n);function n(){var r;je(this,n);for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return r=t.call.apply(t,[this].concat(i)),j(A(r),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),j(A(r),"handleFocus",function(a,c){ye(a)&&r.setState({isFocusVisible:!0}),r.setState({focusedRadioIndex:c}),r.props.onFocus&&r.props.onFocus(a)}),j(A(r),"handleBlur",function(a,c){r.state.isFocusVisible!==!1&&r.setState({isFocusVisible:!1}),r.setState({focusedRadioIndex:-1}),r.props.onBlur&&r.props.onBlur(a)}),r}return ze(n,[{key:"render",value:function(){var o=this,i=this.props.overrides,s=i===void 0?{}:i,a=O(s.RadioGroupRoot,q),c=Ee(a,2),p=c[0],m=c[1];return u.createElement(p,V({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},m),u.Children.map(this.props.children,function(f,l){if(!u.isValidElement(f))return null;var d=o.props.value===f.props.value;return u.cloneElement(f,{align:o.props.align,autoFocus:o.props.autoFocus,checked:d,disabled:o.props.disabled||f.props.disabled,error:o.props.error,isFocused:o.state.focusedRadioIndex===l,isFocusVisible:o.state.isFocusVisible,tabIndex:l===0&&!o.props.value||d?"0":"-1",labelPlacement:o.props.labelPlacement,name:o.props.name,onBlur:function(g){return o.handleBlur(g,l)},onFocus:function(g){return o.handleFocus(g,l)},onChange:o.props.onChange,onMouseEnter:o.props.onMouseEnter,onMouseLeave:o.props.onMouseLeave})}))}}]),n})(u.Component);j(pe,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});function G(e){"@babel/helpers - typeof";return G=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},G(e)}function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$.apply(this,arguments)}function w(e,t){return We(e)||Ge(e,t)||Ue(e,t)||Ve()}function Ve(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ue(e,t){if(e){if(typeof e=="string")return ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ce(e,t)}}function ce(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ge(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(e);!(o=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));o=!0);}catch(c){i=!0,a=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function We(e){if(Array.isArray(e))return e}function qe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ke(e,t,n){return t&&Xe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Je(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&&W(e,t)}function W(e,t){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},W(e,t)}function Qe(e){var t=Ze();return function(){var r=C(e),o;if(t){var i=C(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Ye(this,o)}}function Ye(e,t){if(t&&(G(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 Ze(){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 C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},C(e)}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function et(e){return e==="top"||e==="left"}function tt(e){return e==="bottom"||e==="right"}var rt=function(t){return t.stopPropagation()},fe=(function(e){Je(n,e);var t=Qe(n);function n(){var r;qe(this,n);for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return r=t.call.apply(t,[this].concat(i)),F(k(r),"state",{isActive:!1,isHovered:!1}),F(k(r),"onMouseEnter",function(a){r.setState({isHovered:!0}),r.props.onMouseEnter&&r.props.onMouseEnter(a)}),F(k(r),"onMouseLeave",function(a){r.setState({isHovered:!1}),r.props.onMouseLeave&&r.props.onMouseLeave(a)}),F(k(r),"onMouseDown",function(a){r.setState({isActive:!0}),r.props.onMouseDown&&r.props.onMouseDown(a)}),F(k(r),"onMouseUp",function(a){r.setState({isActive:!1}),r.props.onMouseUp&&r.props.onMouseUp(a)}),r}return Ke(n,[{key:"componentDidMount",value:function(){var o;this.props.autoFocus&&(o=this.props.inputRef)!==null&&o!==void 0&&o.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var o=this.props.overrides,i=o===void 0?{}:o,s=O(i.Root,X),a=w(s,2),c=a[0],p=a[1],m=O(i.Label,Q),f=w(m,2),l=f[0],d=f[1],h=O(i.Input,Y),g=w(h,2),S=g[0],H=g[1],x=O(i.Description,Z),I=w(x,2),v=I[0],b=I[1],y=O(i.RadioMarkInner,K),ee=w(y,2),de=ee[0],he=ee[1],ge=O(i.RadioMarkOuter,J),te=w(ge,2),be=te[0],me=te[1],P={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},re=u.createElement(l,$({},P,d),this.props.containsInteractiveElement?u.createElement("div",{onClick:function(ve){return ve.preventDefault()}},this.props.children):this.props.children);return u.createElement(u.Fragment,null,u.createElement(c,$({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},P,p),et(this.props.labelPlacement)&&re,u.createElement(be,$({},P,me),u.createElement(de,$({},P,he))),u.createElement(S,$({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:rt,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},P,H)),tt(this.props.labelPlacement)&&re),!!this.props.description&&u.createElement(v,$({},P,b),this.props.description))}}]),n})(u.Component);F(fe,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:u.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});function nt(e){const t=parseFloat(e.sizes.checkbox),n=parseFloat(e.spacing.threeXS),r=ie(t.toString()),o=Math.round(r*.375);let i=Math.round(ie((t-n).toString()));return i>=r&&(i-=1),[ae(o,"px"),ae(i,"px")]}function ot({disabled:e,horizontal:t,value:n,onChange:r,options:o,captions:i,label:s,labelVisibility:a,help:c}){const[p,m]=u.useState(n??null);u.useEffect(()=>{n!==p&&m(n??null)},[n]);const f=u.useCallback(v=>{const b=parseInt(v.target.value,10);m(b),r(b)},[r]),l=$e(),d=i.length>0,h=o.length>0,g=h?o:["No options to select."],S=e||!h,H=v=>v==""&&t&&d?"&nbsp;":v,[x,I]=nt(l);return ne("div",{className:"stRadio","data-testid":"stRadio",children:[M(Re,{label:s,disabled:S,labelVisibility:a,children:c&&M(Pe,{content:c,placement:Oe.TOP_RIGHT,label:s})}),M(pe,{onChange:f,value:p!==null?p.toString():void 0,disabled:S,align:t?se.horizontal:se.vertical,"aria-label":s,"data-testid":"stRadioGroup",overrides:{RadioGroupRoot:{style:{gap:d?l.spacing.sm:l.spacing.none,minHeight:l.sizes.minElementHeight}}},children:g.map((v,b)=>ne(fe,{value:b.toString(),overrides:{Root:{style:({$isFocusVisible:y})=>({marginBottom:l.spacing.none,marginTop:l.spacing.none,marginRight:d?l.spacing.sm:l.spacing.lg,paddingLeft:l.spacing.none,alignItems:"start",paddingRight:l.spacing.threeXS,backgroundColor:y?l.colors.darkenedBgMix25:""})},RadioMarkOuter:{style:({$checked:y})=>({width:l.sizes.checkbox,height:l.sizes.checkbox,marginTop:"0.35rem",marginRight:l.spacing.none,marginLeft:l.spacing.none,backgroundColor:y&&!S?l.colors.primary:l.colors.borderColor})},RadioMarkInner:{style:({$checked:y})=>({height:y?x:I,width:y?x:I})},Label:{style:{color:S?l.colors.fadedText40:l.colors.bodyText,position:"relative",top:l.spacing.px}}},children:[M(oe,{source:v,allowHTML:!1,isLabel:!0,largerLabel:!0}),d&&M(oe,{source:H(i[b]),allowHTML:!1,isCaption:!0,isLabel:!0})]},b))})]})}const it=u.memo(ot);function at({disabled:e,element:t,widgetMgr:n,fragmentId:r}){const[o,i]=we({getStateFromWidgetMgr:st,getDefaultStateFromProto:lt,getCurrStateFromProto:ut,updateWidgetMgrState:ct,element:t,widgetMgr:n,fragmentId:r}),{horizontal:s,options:a,captions:c,label:p,labelVisibility:m,help:f}=t,l=u.useCallback(h=>{const g=a[h]??null;i({value:g,fromUi:!0})},[i,a]),d=u.useMemo(()=>{if(o===null)return null;const h=a.indexOf(o);return h>=0?h:null},[o,a]);return M(it,{label:p,onChange:l,options:a,captions:c,disabled:e,horizontal:s,labelVisibility:_e(m?.value),value:d,help:f})}function st(e,t){return e.getStringValue(t)}function lt(e){return e.options.length===0||Se(e.default)?null:e.options[e.default]}function ut(e){return e.rawValue??null}function ct(e,t,n,r){t.setStringValue(e,n.value,{fromUi:n.fromUi},r)}const bt=u.memo(at);export{bt as default};
@@ -1 +1 @@
1
- import{get as O}from"./index.BIqcOZ_u.js";import{K as P}from"./index.aCorc3Yt.js";const s=[{description:"angry face",emoji:"😠",emoticons:[">:(",">:[",">:-(",">:-[",">=(",">=[",">=-(",">=-["],name:"angry",tags:["mad","annoyed"]},{description:"smiling face with smiling eyes",emoji:"😊",emoticons:[':")',':"]',':"D',':-")',':-"]',':-"D','=")','="]','="D','=-")','=-"]','=-"D'],name:"blush",tags:["proud"]},{description:"broken heart",emoji:"💔",emoticons:["<\\3","</3"],name:"broken_heart",tags:[]},{description:"confused face",emoji:"😕",emoticons:[":/",":\\",":-/",":-\\","=/","=\\","=-/","=-\\"],name:"confused",tags:[]},{description:"crying face",emoji:"😢",emoticons:[":,(",":,[",":,|",":,-(",":,-[",":,-|",":'(",":'[",":'|",":'-(",":'-[",":'-|","=,(","=,[","=,|","=,-(","=,-[","=,-|","='(","='[","='|","='-(","='-[","='-|","T-T"],name:"cry",tags:["sad","tear"]},{description:"frowning face with open mouth",emoji:"😦",emoticons:[":(",":[",":-(",":-[","=(","=[","=-(","=-["],name:"frowning",tags:[]},{description:"red heart",emoji:"❤️",emoticons:["<3"],name:"heart",tags:["love"]},{description:"angry face with horns",emoji:"👿",emoticons:["]:(","]:[","]:-(","]:-[","]=(","]=[","]=-(","]=-["],name:"imp",tags:["angry","devil","evil","horns"]},{description:"smiling face with halo",emoji:"😇",emoticons:["o:)","o:]","o:D","o:-)","o:-]","o:-D","o=)","o=]","o=D","o=-)","o=-]","o=-D","O:)","O:]","O:D","O:-)","O:-]","O:-D","O=)","O=]","O=D","O=-)","O=-]","O=-D","0:)","0:]","0:D","0:-)","0:-]","0:-D","0=)","0=]","0=D","0=-)","0=-]","0=-D"],name:"innocent",tags:["angel"]},{description:"face with tears of joy",emoji:"😂",emoticons:[":,)",":,]",":,D",":,-)",":,-]",":,-D",":')",":']",":'D",":'-)",":'-]",":'-D","=,)","=,]","=,D","=,-)","=,-]","=,-D","=')","=']","='D","='-)","='-]","='-D"],name:"joy",tags:["tears"]},{description:"kissing face",emoji:"😗",emoticons:[":*",":-*","=*","=-*"],name:"kissing",tags:[]},{description:"grinning squinting face",emoji:"😆",emoticons:["x)","x]","xD","x-)","x-]","x-D","X)","X]","X-)","X-]","X-D"],name:"laughing",tags:["happy","haha"]},{description:"man",emoji:"👨",emoticons:[":3",":-3","=3","=-3",";3",";-3","x3","x-3","X3","X-3"],name:"man",tags:["mustache","father","dad"]},{description:"neutral face",emoji:"😐",emoticons:[":|",":-|","=|","=-|"],name:"neutral_face",tags:["meh"]},{description:"face without mouth",emoji:"😶",emoticons:[":-"],name:"no_mouth",tags:["mute","silence"]},{description:"face with open mouth",emoji:"😮",emoticons:[":o",":O",":0",":-o",":-O",":-0","=o","=O","=0","=-o","=-O","=-0"],name:"open_mouth",tags:["surprise","impressed","wow"]},{description:"enraged face",emoji:"😡",emoticons:[":@",":-@","=@","=-@"],name:"rage",tags:["angry"]},{description:"grinning face with smiling eyes",emoji:"😄",emoticons:[":D",":-D","=D","=-D"],name:"smile",tags:["happy","joy","laugh","pleased"]},{description:"grinning face with big eyes",emoji:"😃",emoticons:[":)",":]",":-)",":-]","=)","=]","=-)","=-]"],name:"smiley",tags:["happy","joy","haha"]},{description:"smiling face with horns",emoji:"😈",emoticons:["]:)","]:]","]:D","]:-)","]:-]","]:-D","]=)","]=]","]=D","]=-)","]=-]","]=-D"],name:"smiling_imp",tags:["devil","evil","horns"]},{description:"loudly crying face",emoji:"😭",emoticons:[":,'(",":,'[",":,'-(",":,'-[",":',(",":',[",":',-(",":',-[","=,'(","=,'[","=,'-(","=,'-[","=',(","=',[","=',-(","=',-["],name:"sob",tags:["sad","cry","bawling"]},{description:"face with tongue",emoji:"😛",emoticons:[":p",":P",":d",":-p",":-P",":-d","=p","=P","=d","=-p","=-P","=-d"],name:"stuck_out_tongue",tags:[]},{description:"squinting face with tongue",emoji:"😝",emoticons:["xP","x-p","x-P","x-d","Xp","Xd","X-p","X-P","X-d"],name:"stuck_out_tongue_closed_eyes",tags:["prank"]},{description:"winking face with tongue",emoji:"😜",emoticons:[";p",";P",";d",";-p",";-P",";-d"],name:"stuck_out_tongue_winking_eye",tags:["prank","silly"]},{description:"smiling face with sunglasses",emoji:"😎",emoticons:["8)","8]","8D","8-)","8-]","8-D","B)","B]","B-)","B-]","B-D"],name:"sunglasses",tags:["cool"]},{description:"downcast face with sweat",emoji:"😓",emoticons:[",:(",",:[",",:-(",",:-[",",=(",",=[",",=-(",",=-[","':(","':[","':-(","':-[","'=(","'=[","'=-(","'=-["],name:"sweat",tags:[]},{description:"grinning face with sweat",emoji:"😅",emoticons:[",:)",",:]",",:D",",:-)",",:-]",",:-D",",=)",",=]",",=D",",=-)",",=-]",",=-D","':)","':]","':D","':-)","':-]","':-D","'=)","'=]","'=D","'=-)","'=-]","'=-D"],name:"sweat_smile",tags:["hot"]},{description:"unamused face",emoji:"😒",emoticons:[":$",":s",":z",":S",":Z",":-$",":-s",":-z",":-S",":-Z","=$","=s","=z","=S","=Z","=-$","=-s","=-z","=-S","=-Z"],name:"unamused",tags:["meh"]},{description:"winking face",emoji:"😉",emoticons:[";)",";]",";D",";-)",";-]",";-D"],name:"wink",tags:["flirt"]}],x=/:\+1:|:-1:|:[\w-]+:/g,b=/(^|\s)[@$|*'",;.=:\-)([\]\\/<>038BOopPsSdDxXzZ]{2,5}/g,k=/(?:_|-(?!1))/g,X={padSpaceAfter:!1,emoticon:!1,accessible:!1},T=f=>{const t=Object.assign({},X,f),r=!!t.padSpaceAfter,u=!!t.emoticon,g=!!t.accessible;function d(e,i){return{type:"text",value:e,data:{hName:"span",hProperties:{role:"img",ariaLabel:i},hChildren:[{type:"text",value:e}]}}}function D(e){const i=s.find(o=>o.emoticons.includes(e)),n=s.find(o=>o.emoticons.includes(e.slice(0,-1))),a=s.find(o=>o.emoticons.includes(e.slice(1))),c=s.find(o=>o.emoticons.includes(e.slice(1,-1))),m=i||n||a||c;if(!m)return!1;const w=!(i||a)&&(c||n)?e.slice(-1):"",y=!(i||n)&&(c||a)?e.slice(0,1):"",_=r?" ":"",l=y+m.emoji+_+w;return g?d(l,m.name+" emoticon"):l}function h(e){let i=O(e);if(typeof i>"u")return!1;if(r&&(i=i+" "),g){const n=e.slice(1,-1).replace(k," ")+" emoji";return d(i,n)}return i}const p=[[x,h]];u&&p.push([b,D]);function j(e){P(e,p)}return j};export{T as default};
1
+ import{get as O}from"./index.nL1fkE1D.js";import{K as P}from"./index.CPc_uZux.js";const s=[{description:"angry face",emoji:"😠",emoticons:[">:(",">:[",">:-(",">:-[",">=(",">=[",">=-(",">=-["],name:"angry",tags:["mad","annoyed"]},{description:"smiling face with smiling eyes",emoji:"😊",emoticons:[':")',':"]',':"D',':-")',':-"]',':-"D','=")','="]','="D','=-")','=-"]','=-"D'],name:"blush",tags:["proud"]},{description:"broken heart",emoji:"💔",emoticons:["<\\3","</3"],name:"broken_heart",tags:[]},{description:"confused face",emoji:"😕",emoticons:[":/",":\\",":-/",":-\\","=/","=\\","=-/","=-\\"],name:"confused",tags:[]},{description:"crying face",emoji:"😢",emoticons:[":,(",":,[",":,|",":,-(",":,-[",":,-|",":'(",":'[",":'|",":'-(",":'-[",":'-|","=,(","=,[","=,|","=,-(","=,-[","=,-|","='(","='[","='|","='-(","='-[","='-|","T-T"],name:"cry",tags:["sad","tear"]},{description:"frowning face with open mouth",emoji:"😦",emoticons:[":(",":[",":-(",":-[","=(","=[","=-(","=-["],name:"frowning",tags:[]},{description:"red heart",emoji:"❤️",emoticons:["<3"],name:"heart",tags:["love"]},{description:"angry face with horns",emoji:"👿",emoticons:["]:(","]:[","]:-(","]:-[","]=(","]=[","]=-(","]=-["],name:"imp",tags:["angry","devil","evil","horns"]},{description:"smiling face with halo",emoji:"😇",emoticons:["o:)","o:]","o:D","o:-)","o:-]","o:-D","o=)","o=]","o=D","o=-)","o=-]","o=-D","O:)","O:]","O:D","O:-)","O:-]","O:-D","O=)","O=]","O=D","O=-)","O=-]","O=-D","0:)","0:]","0:D","0:-)","0:-]","0:-D","0=)","0=]","0=D","0=-)","0=-]","0=-D"],name:"innocent",tags:["angel"]},{description:"face with tears of joy",emoji:"😂",emoticons:[":,)",":,]",":,D",":,-)",":,-]",":,-D",":')",":']",":'D",":'-)",":'-]",":'-D","=,)","=,]","=,D","=,-)","=,-]","=,-D","=')","=']","='D","='-)","='-]","='-D"],name:"joy",tags:["tears"]},{description:"kissing face",emoji:"😗",emoticons:[":*",":-*","=*","=-*"],name:"kissing",tags:[]},{description:"grinning squinting face",emoji:"😆",emoticons:["x)","x]","xD","x-)","x-]","x-D","X)","X]","X-)","X-]","X-D"],name:"laughing",tags:["happy","haha"]},{description:"man",emoji:"👨",emoticons:[":3",":-3","=3","=-3",";3",";-3","x3","x-3","X3","X-3"],name:"man",tags:["mustache","father","dad"]},{description:"neutral face",emoji:"😐",emoticons:[":|",":-|","=|","=-|"],name:"neutral_face",tags:["meh"]},{description:"face without mouth",emoji:"😶",emoticons:[":-"],name:"no_mouth",tags:["mute","silence"]},{description:"face with open mouth",emoji:"😮",emoticons:[":o",":O",":0",":-o",":-O",":-0","=o","=O","=0","=-o","=-O","=-0"],name:"open_mouth",tags:["surprise","impressed","wow"]},{description:"enraged face",emoji:"😡",emoticons:[":@",":-@","=@","=-@"],name:"rage",tags:["angry"]},{description:"grinning face with smiling eyes",emoji:"😄",emoticons:[":D",":-D","=D","=-D"],name:"smile",tags:["happy","joy","laugh","pleased"]},{description:"grinning face with big eyes",emoji:"😃",emoticons:[":)",":]",":-)",":-]","=)","=]","=-)","=-]"],name:"smiley",tags:["happy","joy","haha"]},{description:"smiling face with horns",emoji:"😈",emoticons:["]:)","]:]","]:D","]:-)","]:-]","]:-D","]=)","]=]","]=D","]=-)","]=-]","]=-D"],name:"smiling_imp",tags:["devil","evil","horns"]},{description:"loudly crying face",emoji:"😭",emoticons:[":,'(",":,'[",":,'-(",":,'-[",":',(",":',[",":',-(",":',-[","=,'(","=,'[","=,'-(","=,'-[","=',(","=',[","=',-(","=',-["],name:"sob",tags:["sad","cry","bawling"]},{description:"face with tongue",emoji:"😛",emoticons:[":p",":P",":d",":-p",":-P",":-d","=p","=P","=d","=-p","=-P","=-d"],name:"stuck_out_tongue",tags:[]},{description:"squinting face with tongue",emoji:"😝",emoticons:["xP","x-p","x-P","x-d","Xp","Xd","X-p","X-P","X-d"],name:"stuck_out_tongue_closed_eyes",tags:["prank"]},{description:"winking face with tongue",emoji:"😜",emoticons:[";p",";P",";d",";-p",";-P",";-d"],name:"stuck_out_tongue_winking_eye",tags:["prank","silly"]},{description:"smiling face with sunglasses",emoji:"😎",emoticons:["8)","8]","8D","8-)","8-]","8-D","B)","B]","B-)","B-]","B-D"],name:"sunglasses",tags:["cool"]},{description:"downcast face with sweat",emoji:"😓",emoticons:[",:(",",:[",",:-(",",:-[",",=(",",=[",",=-(",",=-[","':(","':[","':-(","':-[","'=(","'=[","'=-(","'=-["],name:"sweat",tags:[]},{description:"grinning face with sweat",emoji:"😅",emoticons:[",:)",",:]",",:D",",:-)",",:-]",",:-D",",=)",",=]",",=D",",=-)",",=-]",",=-D","':)","':]","':D","':-)","':-]","':-D","'=)","'=]","'=D","'=-)","'=-]","'=-D"],name:"sweat_smile",tags:["hot"]},{description:"unamused face",emoji:"😒",emoticons:[":$",":s",":z",":S",":Z",":-$",":-s",":-z",":-S",":-Z","=$","=s","=z","=S","=Z","=-$","=-s","=-z","=-S","=-Z"],name:"unamused",tags:["meh"]},{description:"winking face",emoji:"😉",emoticons:[";)",";]",";D",";-)",";-]",";-D"],name:"wink",tags:["flirt"]}],x=/:\+1:|:-1:|:[\w-]+:/g,b=/(^|\s)[@$|*'",;.=:\-)([\]\\/<>038BOopPsSdDxXzZ]{2,5}/g,k=/(?:_|-(?!1))/g,X={padSpaceAfter:!1,emoticon:!1,accessible:!1},T=f=>{const t=Object.assign({},X,f),r=!!t.padSpaceAfter,u=!!t.emoticon,g=!!t.accessible;function d(e,i){return{type:"text",value:e,data:{hName:"span",hProperties:{role:"img",ariaLabel:i},hChildren:[{type:"text",value:e}]}}}function D(e){const i=s.find(o=>o.emoticons.includes(e)),n=s.find(o=>o.emoticons.includes(e.slice(0,-1))),a=s.find(o=>o.emoticons.includes(e.slice(1))),c=s.find(o=>o.emoticons.includes(e.slice(1,-1))),m=i||n||a||c;if(!m)return!1;const w=!(i||a)&&(c||n)?e.slice(-1):"",y=!(i||n)&&(c||a)?e.slice(0,1):"",_=r?" ":"",l=y+m.emoji+_+w;return g?d(l,m.name+" emoticon"):l}function h(e){let i=O(e);if(typeof i>"u")return!1;if(r&&(i=i+" "),g){const n=e.slice(1,-1).replace(k," ")+" emoji";return d(i,n)}return i}const p=[[x,h]];u&&p.push([b,D]);function j(e){P(e,p)}return j};export{T as default};
@@ -1 +1 @@
1
- import{r as n,E as H,_ as D,z as k,o as O,j as U,ay as ge,P as he,b as ve,B as me,ax as q,bN as re,al as Se,ag as be,bg as ye,l as Ce,bO as Ue,k as we,aj as Me,e as W,V as xe,bh as Ee,p as Ie,ab as Fe,ac as Re,$ as ke,bP as _e,bQ as Oe}from"./index.aCorc3Yt.js";import{U as ie}from"./UploadFileInfo.Dr-zDST7.js";import{u as Pe}from"./FormClearHelper.DN8D_YXO.js";import{P as Te,S as Le}from"./ProgressBar.C5uBOtcx.js";import{b as We}from"./urls.BwSlolu9.js";var oe=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:a}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});oe.displayName="SwitchCamera";var ne=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:a}),n.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});ne.displayName="Video";var ae=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:a}),n.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});ae.displayName="X";function Ve(e,a){switch(e){case"xsmall":return{padding:`${a.spacing.twoXS} ${a.spacing.sm}`,fontSize:a.fontSizes.sm};case"small":return{padding:`${a.spacing.twoXS} ${a.spacing.md}`};case"large":return{padding:`${a.spacing.md} ${a.spacing.md}`};default:return{padding:`${a.spacing.xs} ${a.spacing.md}`}}}const se=k("div",{target:"exxgkyt0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),G=k("div",{target:"exxgkyt1"})(({theme:e,width:a})=>({backgroundColor:e.colors.secondaryBg,borderRadius:`${e.radii.default} ${e.radii.default} 0 0`,width:"100%",height:a*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),je=k("p",{target:"exxgkyt2"})(({theme:e})=>({marginTop:e.spacing.sm,textAlign:"center"})),Be=k("img",{target:"exxgkyt3"})(({theme:e,opacity:a})=>({borderRadius:`${e.radii.default} ${e.radii.default} 0 0`,objectFit:"contain",opacity:a})),$e=k("a",{target:"exxgkyt4"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none",display:"block"})),ze=k("span",{target:"exxgkyt5"})({display:"flex",alignItems:"center"}),Ae=k("div",{target:"exxgkyt6"})(({theme:e})=>({position:"absolute",top:e.spacing.lg,right:e.spacing.lg,zIndex:e.zIndices.priority,color:e.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Ne=k("div",{target:"exxgkyt8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),He=k("button",{target:"exxgkyt9"})(({theme:e})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:e.colors.lightenedBg05,border:`${e.sizes.borderWidth} solid ${e.colors.borderColor}`,borderRadius:`0 0 ${e.radii.default} ${e.radii.default}`,"&:hover":{borderColor:e.colors.primary,color:e.colors.primary},"&:active":{color:e.colors.white,borderColor:e.colors.primary,backgroundColor:e.colors.primary},"&:focus:not(:active)":{borderColor:e.colors.primary,color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:e.colors.fadedText40,borderColor:e.colors.borderColor,backgroundColor:e.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:e.fontWeights.normal,padding:`${e.spacing.xs} ${e.spacing.md}`,margin:e.spacing.none,lineHeight:e.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:e.shadows.focusRing},...Ve("medium",e)}));function De({disabled:e,onClick:a,children:d,progress:h}){return O(He,{disabled:e||!1,onClick:a||(()=>{}),progress:h||null,"data-testid":"stCameraInputButton",children:[d,h?U(Ne,{children:U(Te,{value:h,size:Le.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const le=n.memo(De);var B=(function(e){return e.USER="user",e.ENVIRONMENT="environment",e})({});const qe=({switchFacingMode:e})=>U(Ae,{"data-testid":"stCameraInputSwitchButton",children:U(ge,{content:"Switch camera",placement:he.TOP_RIGHT,children:U(ve,{kind:me.MINIMAL,onClick:e,children:U(q,{content:oe,size:"twoXL",color:re.white})})})}),Ge=n.memo(qe);var $={exports:{}},Xe=$.exports,te;function Qe(){return te||(te=1,(function(e,a){(function(h,v){e.exports=v(Se())})(Xe,function(d){return(function(h){var v={};function p(o){if(v[o])return v[o].exports;var f=v[o]={i:o,l:!1,exports:{}};return h[o].call(f.exports,f,f.exports,p),f.l=!0,f.exports}return p.m=h,p.c=v,p.d=function(o,f,m){p.o(o,f)||Object.defineProperty(o,f,{enumerable:!0,get:m})},p.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},p.t=function(o,f){if(f&1&&(o=p(o)),f&8||f&4&&typeof o=="object"&&o&&o.__esModule)return o;var m=Object.create(null);if(p.r(m),Object.defineProperty(m,"default",{enumerable:!0,value:o}),f&2&&typeof o!="string")for(var F in o)p.d(m,F,(function(I){return o[I]}).bind(null,F));return m},p.n=function(o){var f=o&&o.__esModule?function(){return o.default}:function(){return o};return p.d(f,"a",f),f},p.o=function(o,f){return Object.prototype.hasOwnProperty.call(o,f)},p.p="",p(p.s="./src/react-webcam.tsx")})({"./src/react-webcam.tsx":(function(h,v,p){p.r(v);var o=p("react"),f=(function(){var b=function(i,t){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var l in s)s.hasOwnProperty(l)&&(r[l]=s[l])},b(i,t)};return function(i,t){b(i,t);function r(){this.constructor=i}i.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}})(),m=function(){return m=Object.assign||function(b){for(var i,t=1,r=arguments.length;t<r;t++){i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(b[s]=i[s])}return b},m.apply(this,arguments)},F=function(b,i){var t={};for(var r in b)Object.prototype.hasOwnProperty.call(b,r)&&i.indexOf(r)<0&&(t[r]=b[r]);if(b!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(b);s<r.length;s++)i.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(b,r[s])&&(t[r[s]]=b[r[s]]);return t};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(i){var t=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return t?new Promise(function(r,s){t.call(navigator,i,r,s)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function I(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var R=(function(b){f(i,b);function i(t){var r=b.call(this,t)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return i.prototype.componentDidMount=function(){var t=this,r=t.state,s=t.props;if(this.unmounted=!1,!I()){s.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),s.children&&typeof s.children!="function"&&console.warn("children must be a function")},i.prototype.componentDidUpdate=function(t){var r=this.props;if(!I()){r.onUserMediaError("getUserMedia not supported");return}var s=JSON.stringify(t.audioConstraints)!==JSON.stringify(r.audioConstraints),l=JSON.stringify(t.videoConstraints)!==JSON.stringify(r.videoConstraints),M=t.minScreenshotWidth!==r.minScreenshotWidth,y=t.minScreenshotHeight!==r.minScreenshotHeight;(l||M||y)&&(this.canvas=null,this.ctx=null),(s||l)&&(this.stopAndCleanup(),this.requestUserMedia())},i.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},i.stopMediaStream=function(t){t&&(t.getVideoTracks&&t.getAudioTracks?(t.getVideoTracks().map(function(r){t.removeTrack(r),r.stop()}),t.getAudioTracks().map(function(r){t.removeTrack(r),r.stop()})):t.stop())},i.prototype.stopAndCleanup=function(){var t=this.state;t.hasUserMedia&&(i.stopMediaStream(this.stream),t.src&&window.URL.revokeObjectURL(t.src))},i.prototype.getScreenshot=function(t){var r=this,s=r.state,l=r.props;if(!s.hasUserMedia)return null;var M=this.getCanvas(t);return M&&M.toDataURL(l.screenshotFormat,l.screenshotQuality)},i.prototype.getCanvas=function(t){var r=this,s=r.state,l=r.props;if(!this.video||!s.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var M=this.video.videoWidth,y=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var C=M/y;M=l.minScreenshotWidth||this.video.clientWidth,y=M/C,l.minScreenshotHeight&&y<l.minScreenshotHeight&&(y=l.minScreenshotHeight,M=y*C)}this.canvas=document.createElement("canvas"),this.canvas.width=t?.width||M,this.canvas.height=t?.height||y,this.ctx=this.canvas.getContext("2d")}var E=this,w=E.ctx,S=E.canvas;return w&&S&&(S.width=t?.width||S.width,S.height=t?.height||S.height,l.mirrored&&(w.translate(S.width,0),w.scale(-1,1)),w.imageSmoothingEnabled=l.imageSmoothing,w.drawImage(this.video,0,0,t?.width||S.width,t?.height||S.height),l.mirrored&&(w.scale(-1,1),w.translate(-S.width,0))),S},i.prototype.requestUserMedia=function(){var t=this,r=this.props,s=function(y,C){var E={video:typeof C<"u"?C:!0};r.audio&&(E.audio=typeof y<"u"?y:!0),t.requestUserMediaId++;var w=t.requestUserMediaId;navigator.mediaDevices.getUserMedia(E).then(function(S){t.unmounted||w!==t.requestUserMediaId?i.stopMediaStream(S):t.handleUserMedia(null,S)}).catch(function(S){t.handleUserMedia(S)})};if("mediaDevices"in navigator)s(r.audioConstraints,r.videoConstraints);else{var l=function(y){return{optional:[{sourceId:y}]}},M=function(y){var C=y.deviceId;return typeof C=="string"?C:Array.isArray(C)&&C.length>0?C[0]:typeof C=="object"&&C.ideal?C.ideal:null};MediaStreamTrack.getSources(function(y){var C=null,E=null;y.forEach(function(_){_.kind==="audio"?C=_.id:_.kind==="video"&&(E=_.id)});var w=M(r.audioConstraints);w&&(C=w);var S=M(r.videoConstraints);S&&(E=S),s(l(C),l(E))})}},i.prototype.handleUserMedia=function(t,r){var s=this.props;if(t||!r){this.setState({hasUserMedia:!1}),s.onUserMediaError(t);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}s.onUserMedia(r)},i.prototype.render=function(){var t=this,r=this,s=r.state,l=r.props,M=l.audio;l.forceScreenshotSourceSize;var y=l.disablePictureInPicture;l.onUserMedia,l.onUserMediaError,l.screenshotFormat,l.screenshotQuality,l.minScreenshotWidth,l.minScreenshotHeight,l.audioConstraints,l.videoConstraints,l.imageSmoothing;var C=l.mirrored,E=l.style,w=E===void 0?{}:E,S=l.children,_=F(l,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),z=C?m(m({},w),{transform:(w.transform||"")+" scaleX(-1)"}):w,V={getScreenshot:this.getScreenshot.bind(this)};return o.createElement(o.Fragment,null,o.createElement("video",m({autoPlay:!0,disablePictureInPicture:y,src:s.src,muted:!M,playsInline:!0,ref:function(j){t.video=j},style:z},_)),S&&S(V))},i.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},i})(o.Component);v.default=R}),react:(function(h,v){h.exports=d})}).default})})($)),$.exports}var Je=Qe();const Ke=be(Je),Ye=({width:e})=>O(G,{width:e,children:[U(q,{size:"threeXL",color:re.gray60,content:ne}),O(je,{children:["This app would like to use your camera.",U($e,{href:We,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Ze=({handleCapture:e,width:a,disabled:d,clearPhotoInProgress:h,setClearPhotoInProgress:v,facingMode:p,setFacingMode:o,testOverride:f})=>{const[m,F]=n.useState(f||"pending"),I=n.useRef(null),[R,b]=n.useState(a),i=n.useCallback(ye(1e3,b),[]);n.useEffect(()=>{i(a)},[a,i]);function t(){if(I.current!==null){const s=I.current.getScreenshot();e(s)}}const r=Ce();return O(se,{"data-testid":"stCameraInputWebcamComponent",children:[m!=="success"&&!d&&!h?U(Ye,{width:R}):Ue()&&U(Ge,{switchFacingMode:o}),U(G,{"data-testid":"stCameraInputWebcamStyledBox",hidden:m!=="success"&&!d&&!h,width:R,children:!d&&U(Ke,{audio:!1,ref:I,screenshotFormat:"image/jpeg",screenshotQuality:1,width:R,height:R*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{F("error")},onUserMedia:()=>{F("success"),v(!1)},videoConstraints:{width:{ideal:R},facingMode:p}})}),U(le,{onClick:t,disabled:m!=="success"||d||h,children:"Take Photo"})]})},et=n.memo(Ze),ce="RESTORED_FROM_WIDGET",tt=150,rt=xe.getLogger("CameraInput"),N=e=>{const a=e.filter(d=>d.status.type==="uploaded").map(d=>{const{name:h,size:v,status:p}=d,{fileId:o,fileUrls:f}=p;return new _e({fileId:o,fileUrls:f,name:h,size:v})});return new Oe({uploadedFileInfo:a})},it=(e,a)=>{const d=a.getFileUploaderStateValue(e);if(W(d))return{files:[],nextLocalId:1,imgSrc:null};const{uploadedFileInfo:h}=d;if(W(h)||h.length===0)return{files:[],nextLocalId:1,imgSrc:null};let v=1;const p=h.map(o=>{const f=o.name,m=o.size,F=o.fileId,I=o.fileUrls,R=new ie(f,m,v,{type:"uploaded",fileId:F,fileUrls:I});return v+=1,R});return{files:p,nextLocalId:v,imgSrc:p.length>0?ce:null}};function ot(e,a){return fetch(e).then(d=>d.arrayBuffer()).then(d=>new File([d],a,{type:"image/jpeg"}))}const nt=({element:e,widgetMgr:a,uploadClient:d,disabled:h,fragmentId:v,testOverride:p})=>{const{width:o,elementRef:f}=we(),m=n.useRef(null);m.current===null&&(m.current=it(e,a));const{files:F,nextLocalId:I,imgSrc:R}=m.current,b=n.useRef(I),[i,t]=n.useState(()=>F),r=n.useRef(i);n.useLayoutEffect(()=>{r.current=i},[i]);const[s,l]=n.useState(()=>R),[M,y]=n.useState(!1),[C,E]=n.useState(!0),[w,S]=n.useState(!1),[_,z]=n.useState(B.USER),V=n.useCallback(()=>{const c=b.current;return b.current+=1,c},[]),j=n.useMemo(()=>{const c=u=>u.status.type==="uploading";return i.some(c)?"updating":"ready"},[i]),A=n.useMemo(()=>{if(i.length>0&&i[i.length-1].status.type==="uploading")return i[i.length-1].status.progress},[i]),de=n.useCallback(()=>{z(c=>c===B.USER?B.ENVIRONMENT:B.USER)},[]),P=n.useCallback(c=>r.current.find(u=>u.id===c),[]),X=n.useCallback(c=>{Me.flushSync(()=>{t(u=>[...u,c])})},[]),Q=n.useCallback(c=>{t(u=>u.filter(g=>g.id!==c))},[]),T=n.useCallback((c,u)=>{t(g=>g.map(x=>x.id===c?u:x))},[]),J=n.useCallback((c,u)=>{y(!1);const g=P(c);W(g)||g.status.type!=="uploading"||T(g.id,g.setStatus({type:"uploaded",fileId:u.fileId,fileUrls:u}))},[P,T]),K=n.useCallback((c,u)=>{const g=P(u);if(W(g)||g.status.type!=="uploading")return;const x=Math.round(c.loaded*100/c.total);g.status.progress!==x&&T(u,g.setStatus({type:"uploading",abortController:g.status.abortController,progress:x}))},[P,T]),Y=n.useCallback((c,u)=>{const g=new AbortController,x=new ie(u.name,u.size,V(),{type:"uploading",abortController:g,progress:1});X(x),d.uploadFile(e,c.uploadUrl,u,L=>K(L,x.id),g.signal).then(()=>J(x.id,c)).catch(L=>{L instanceof DOMException&&L.name==="AbortError"||T(x.id,x.setStatus({type:"error",errorMessage:L?L.toString():"Unknown error"}))})},[X,e,V,J,K,T,d]),Z=n.useCallback(c=>{const u=P(c);W(u)||(u.status.type==="uploading"&&u.status.abortController.abort(),u.status.type==="uploaded"&&u.status.fileUrls.deleteUrl&&d.deleteFile(u.status.fileUrls.deleteUrl),Q(c))},[P,Q,d]),ee=n.useCallback(c=>{if(c===null)return Promise.resolve();l(c),y(!0),E(!1);const u=g=>new Promise(x=>setTimeout(x,g));return ot(c,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(g=>d.fetchFileURLs([g]).then(x=>({file:g,fileUrls:x[0]}))).then(({file:g,fileUrls:x})=>Y(x,g)).then(()=>u(tt)).then(()=>{E(!0)}).catch(g=>{rt.error(g)})},[d,Y]),ue=n.useCallback(c=>{ee(c)},[ee]),fe=n.useCallback(()=>{i.length!==0&&(i.forEach(c=>Z(c.id)),l(null),S(!0))},[i,Z]);n.useEffect(()=>{a.getFileUploaderStateValue(e)===void 0&&a.setFileUploaderStateValue(e,N(i),{fromUi:!1},v)},[]),n.useEffect(()=>{if(j!=="ready")return;const c=N(i),u=a.getFileUploaderStateValue(e);Ee(c,u)||a.setFileUploaderStateValue(e,c,{fromUi:!0},v)},[j,i,a,e,v]);const pe=n.useCallback(()=>{t([]),l(null);const c=N([]);a.setFileUploaderStateValue(e,c,{fromUi:!0},v)},[e,v,a]);return Pe({element:e,widgetMgr:a,onFormCleared:pe}),O(se,{className:"stCameraInput","data-testid":"stCameraInput",ref:f,children:[U(Re,{label:e.label,disabled:h,labelVisibility:Ie(e.labelVisibility?.value),children:e.help&&U(Fe,{content:e.help,label:e.label})}),s?O(ke,{children:[U(G,{width:o,children:s!==ce&&U(Be,{src:s,alt:"Snapshot",opacity:M||!C?"50%":"100%",width:o,height:o*9/16})}),U(le,{onClick:fe,progress:A,disabled:!!A||h,children:A?"Uploading...":O(ze,{children:[U(q,{content:ae,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):U(et,{handleCapture:ue,width:o,disabled:h,clearPhotoInProgress:w,setClearPhotoInProgress:S,facingMode:_,setFacingMode:de,testOverride:p})]})},ut=n.memo(nt);export{ut as default};
1
+ import{r as n,E as H,_ as D,z as k,o as P,j as U,ay as ge,P as he,b as ve,B as me,ax as q,bP as re,al as Se,ag as be,bt as ye,l as Ce,bQ as Ue,k as we,aj as Me,e as W,V as xe,bu as Ee,p as Ie,ab as Fe,ac as Re,$ as ke,bR as _e,bS as Pe}from"./index.CPc_uZux.js";import{U as ie}from"./UploadFileInfo.Dr-zDST7.js";import{u as Oe}from"./FormClearHelper.DTFnX0js.js";import{P as Te,S as Le}from"./ProgressBar.Dg-oMbWg.js";import{b as We}from"./urls.BwSlolu9.js";var oe=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:a}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});oe.displayName="SwitchCamera";var ne=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:a}),n.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});ne.displayName="Video";var ae=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:a}),n.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});ae.displayName="X";function Ve(e,a){switch(e){case"xsmall":return{padding:`${a.spacing.twoXS} ${a.spacing.sm}`,fontSize:a.fontSizes.sm};case"small":return{padding:`${a.spacing.twoXS} ${a.spacing.md}`};case"large":return{padding:`${a.spacing.md} ${a.spacing.md}`};default:return{padding:`${a.spacing.xs} ${a.spacing.md}`}}}const se=k("div",{target:"exxgkyt0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),G=k("div",{target:"exxgkyt1"})(({theme:e,width:a})=>({backgroundColor:e.colors.secondaryBg,borderRadius:`${e.radii.default} ${e.radii.default} 0 0`,width:"100%",height:a*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),je=k("p",{target:"exxgkyt2"})(({theme:e})=>({marginTop:e.spacing.sm,textAlign:"center"})),Be=k("img",{target:"exxgkyt3"})(({theme:e,opacity:a})=>({borderRadius:`${e.radii.default} ${e.radii.default} 0 0`,objectFit:"contain",opacity:a})),$e=k("a",{target:"exxgkyt4"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none",display:"block"})),ze=k("span",{target:"exxgkyt5"})({display:"flex",alignItems:"center"}),Ae=k("div",{target:"exxgkyt6"})(({theme:e})=>({position:"absolute",top:e.spacing.lg,right:e.spacing.lg,zIndex:e.zIndices.priority,color:e.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Ne=k("div",{target:"exxgkyt8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),He=k("button",{target:"exxgkyt9"})(({theme:e})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:e.colors.lightenedBg05,border:`${e.sizes.borderWidth} solid ${e.colors.borderColor}`,borderRadius:`0 0 ${e.radii.default} ${e.radii.default}`,"&:hover":{borderColor:e.colors.primary,color:e.colors.primary},"&:active":{color:e.colors.white,borderColor:e.colors.primary,backgroundColor:e.colors.primary},"&:focus:not(:active)":{borderColor:e.colors.primary,color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:e.colors.fadedText40,borderColor:e.colors.borderColor,backgroundColor:e.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:e.fontWeights.normal,padding:`${e.spacing.xs} ${e.spacing.md}`,margin:e.spacing.none,lineHeight:e.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:e.shadows.focusRing},...Ve("medium",e)}));function De({disabled:e,onClick:a,children:d,progress:h}){return P(He,{disabled:e||!1,onClick:a||(()=>{}),progress:h||null,"data-testid":"stCameraInputButton",children:[d,h?U(Ne,{children:U(Te,{value:h,size:Le.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const le=n.memo(De);var B=(function(e){return e.USER="user",e.ENVIRONMENT="environment",e})({});const qe=({switchFacingMode:e})=>U(Ae,{"data-testid":"stCameraInputSwitchButton",children:U(ge,{content:"Switch camera",placement:he.TOP_RIGHT,children:U(ve,{kind:me.MINIMAL,onClick:e,children:U(q,{content:oe,size:"twoXL",color:re.white})})})}),Ge=n.memo(qe);var $={exports:{}},Xe=$.exports,te;function Qe(){return te||(te=1,(function(e,a){(function(h,v){e.exports=v(Se())})(Xe,function(d){return(function(h){var v={};function p(o){if(v[o])return v[o].exports;var f=v[o]={i:o,l:!1,exports:{}};return h[o].call(f.exports,f,f.exports,p),f.l=!0,f.exports}return p.m=h,p.c=v,p.d=function(o,f,m){p.o(o,f)||Object.defineProperty(o,f,{enumerable:!0,get:m})},p.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},p.t=function(o,f){if(f&1&&(o=p(o)),f&8||f&4&&typeof o=="object"&&o&&o.__esModule)return o;var m=Object.create(null);if(p.r(m),Object.defineProperty(m,"default",{enumerable:!0,value:o}),f&2&&typeof o!="string")for(var F in o)p.d(m,F,(function(I){return o[I]}).bind(null,F));return m},p.n=function(o){var f=o&&o.__esModule?function(){return o.default}:function(){return o};return p.d(f,"a",f),f},p.o=function(o,f){return Object.prototype.hasOwnProperty.call(o,f)},p.p="",p(p.s="./src/react-webcam.tsx")})({"./src/react-webcam.tsx":(function(h,v,p){p.r(v);var o=p("react"),f=(function(){var b=function(i,t){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var l in s)s.hasOwnProperty(l)&&(r[l]=s[l])},b(i,t)};return function(i,t){b(i,t);function r(){this.constructor=i}i.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}})(),m=function(){return m=Object.assign||function(b){for(var i,t=1,r=arguments.length;t<r;t++){i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(b[s]=i[s])}return b},m.apply(this,arguments)},F=function(b,i){var t={};for(var r in b)Object.prototype.hasOwnProperty.call(b,r)&&i.indexOf(r)<0&&(t[r]=b[r]);if(b!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(b);s<r.length;s++)i.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(b,r[s])&&(t[r[s]]=b[r[s]]);return t};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(i){var t=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return t?new Promise(function(r,s){t.call(navigator,i,r,s)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function I(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var R=(function(b){f(i,b);function i(t){var r=b.call(this,t)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return i.prototype.componentDidMount=function(){var t=this,r=t.state,s=t.props;if(this.unmounted=!1,!I()){s.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),s.children&&typeof s.children!="function"&&console.warn("children must be a function")},i.prototype.componentDidUpdate=function(t){var r=this.props;if(!I()){r.onUserMediaError("getUserMedia not supported");return}var s=JSON.stringify(t.audioConstraints)!==JSON.stringify(r.audioConstraints),l=JSON.stringify(t.videoConstraints)!==JSON.stringify(r.videoConstraints),M=t.minScreenshotWidth!==r.minScreenshotWidth,y=t.minScreenshotHeight!==r.minScreenshotHeight;(l||M||y)&&(this.canvas=null,this.ctx=null),(s||l)&&(this.stopAndCleanup(),this.requestUserMedia())},i.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},i.stopMediaStream=function(t){t&&(t.getVideoTracks&&t.getAudioTracks?(t.getVideoTracks().map(function(r){t.removeTrack(r),r.stop()}),t.getAudioTracks().map(function(r){t.removeTrack(r),r.stop()})):t.stop())},i.prototype.stopAndCleanup=function(){var t=this.state;t.hasUserMedia&&(i.stopMediaStream(this.stream),t.src&&window.URL.revokeObjectURL(t.src))},i.prototype.getScreenshot=function(t){var r=this,s=r.state,l=r.props;if(!s.hasUserMedia)return null;var M=this.getCanvas(t);return M&&M.toDataURL(l.screenshotFormat,l.screenshotQuality)},i.prototype.getCanvas=function(t){var r=this,s=r.state,l=r.props;if(!this.video||!s.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var M=this.video.videoWidth,y=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var C=M/y;M=l.minScreenshotWidth||this.video.clientWidth,y=M/C,l.minScreenshotHeight&&y<l.minScreenshotHeight&&(y=l.minScreenshotHeight,M=y*C)}this.canvas=document.createElement("canvas"),this.canvas.width=t?.width||M,this.canvas.height=t?.height||y,this.ctx=this.canvas.getContext("2d")}var E=this,w=E.ctx,S=E.canvas;return w&&S&&(S.width=t?.width||S.width,S.height=t?.height||S.height,l.mirrored&&(w.translate(S.width,0),w.scale(-1,1)),w.imageSmoothingEnabled=l.imageSmoothing,w.drawImage(this.video,0,0,t?.width||S.width,t?.height||S.height),l.mirrored&&(w.scale(-1,1),w.translate(-S.width,0))),S},i.prototype.requestUserMedia=function(){var t=this,r=this.props,s=function(y,C){var E={video:typeof C<"u"?C:!0};r.audio&&(E.audio=typeof y<"u"?y:!0),t.requestUserMediaId++;var w=t.requestUserMediaId;navigator.mediaDevices.getUserMedia(E).then(function(S){t.unmounted||w!==t.requestUserMediaId?i.stopMediaStream(S):t.handleUserMedia(null,S)}).catch(function(S){t.handleUserMedia(S)})};if("mediaDevices"in navigator)s(r.audioConstraints,r.videoConstraints);else{var l=function(y){return{optional:[{sourceId:y}]}},M=function(y){var C=y.deviceId;return typeof C=="string"?C:Array.isArray(C)&&C.length>0?C[0]:typeof C=="object"&&C.ideal?C.ideal:null};MediaStreamTrack.getSources(function(y){var C=null,E=null;y.forEach(function(_){_.kind==="audio"?C=_.id:_.kind==="video"&&(E=_.id)});var w=M(r.audioConstraints);w&&(C=w);var S=M(r.videoConstraints);S&&(E=S),s(l(C),l(E))})}},i.prototype.handleUserMedia=function(t,r){var s=this.props;if(t||!r){this.setState({hasUserMedia:!1}),s.onUserMediaError(t);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}s.onUserMedia(r)},i.prototype.render=function(){var t=this,r=this,s=r.state,l=r.props,M=l.audio;l.forceScreenshotSourceSize;var y=l.disablePictureInPicture;l.onUserMedia,l.onUserMediaError,l.screenshotFormat,l.screenshotQuality,l.minScreenshotWidth,l.minScreenshotHeight,l.audioConstraints,l.videoConstraints,l.imageSmoothing;var C=l.mirrored,E=l.style,w=E===void 0?{}:E,S=l.children,_=F(l,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),z=C?m(m({},w),{transform:(w.transform||"")+" scaleX(-1)"}):w,V={getScreenshot:this.getScreenshot.bind(this)};return o.createElement(o.Fragment,null,o.createElement("video",m({autoPlay:!0,disablePictureInPicture:y,src:s.src,muted:!M,playsInline:!0,ref:function(j){t.video=j},style:z},_)),S&&S(V))},i.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},i})(o.Component);v.default=R}),react:(function(h,v){h.exports=d})}).default})})($)),$.exports}var Je=Qe();const Ke=be(Je),Ye=({width:e})=>P(G,{width:e,children:[U(q,{size:"threeXL",color:re.gray60,content:ne}),P(je,{children:["This app would like to use your camera.",U($e,{href:We,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Ze=({handleCapture:e,width:a,disabled:d,clearPhotoInProgress:h,setClearPhotoInProgress:v,facingMode:p,setFacingMode:o,testOverride:f})=>{const[m,F]=n.useState(f||"pending"),I=n.useRef(null),[R,b]=n.useState(a),i=n.useCallback(ye(1e3,b),[]);n.useEffect(()=>{i(a)},[a,i]);function t(){if(I.current!==null){const s=I.current.getScreenshot();e(s)}}const r=Ce();return P(se,{"data-testid":"stCameraInputWebcamComponent",children:[m!=="success"&&!d&&!h?U(Ye,{width:R}):Ue()&&U(Ge,{switchFacingMode:o}),U(G,{"data-testid":"stCameraInputWebcamStyledBox",hidden:m!=="success"&&!d&&!h,width:R,children:!d&&U(Ke,{audio:!1,ref:I,screenshotFormat:"image/jpeg",screenshotQuality:1,width:R,height:R*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{F("error")},onUserMedia:()=>{F("success"),v(!1)},videoConstraints:{width:{ideal:R},facingMode:p}})}),U(le,{onClick:t,disabled:m!=="success"||d||h,children:"Take Photo"})]})},et=n.memo(Ze),ce="RESTORED_FROM_WIDGET",tt=150,rt=xe.getLogger("CameraInput"),N=e=>{const a=e.filter(d=>d.status.type==="uploaded").map(d=>{const{name:h,size:v,status:p}=d,{fileId:o,fileUrls:f}=p;return new _e({fileId:o,fileUrls:f,name:h,size:v})});return new Pe({uploadedFileInfo:a})},it=(e,a)=>{const d=a.getFileUploaderStateValue(e);if(W(d))return{files:[],nextLocalId:1,imgSrc:null};const{uploadedFileInfo:h}=d;if(W(h)||h.length===0)return{files:[],nextLocalId:1,imgSrc:null};let v=1;const p=h.map(o=>{const f=o.name,m=o.size,F=o.fileId,I=o.fileUrls,R=new ie(f,m,v,{type:"uploaded",fileId:F,fileUrls:I});return v+=1,R});return{files:p,nextLocalId:v,imgSrc:p.length>0?ce:null}};function ot(e,a){return fetch(e).then(d=>d.arrayBuffer()).then(d=>new File([d],a,{type:"image/jpeg"}))}const nt=({element:e,widgetMgr:a,uploadClient:d,disabled:h,fragmentId:v,testOverride:p})=>{const{width:o,elementRef:f}=we(),m=n.useRef(null);m.current===null&&(m.current=it(e,a));const{files:F,nextLocalId:I,imgSrc:R}=m.current,b=n.useRef(I),[i,t]=n.useState(()=>F),r=n.useRef(i);n.useLayoutEffect(()=>{r.current=i},[i]);const[s,l]=n.useState(()=>R),[M,y]=n.useState(!1),[C,E]=n.useState(!0),[w,S]=n.useState(!1),[_,z]=n.useState(B.USER),V=n.useCallback(()=>{const c=b.current;return b.current+=1,c},[]),j=n.useMemo(()=>{const c=u=>u.status.type==="uploading";return i.some(c)?"updating":"ready"},[i]),A=n.useMemo(()=>{if(i.length>0&&i[i.length-1].status.type==="uploading")return i[i.length-1].status.progress},[i]),de=n.useCallback(()=>{z(c=>c===B.USER?B.ENVIRONMENT:B.USER)},[]),O=n.useCallback(c=>r.current.find(u=>u.id===c),[]),X=n.useCallback(c=>{Me.flushSync(()=>{t(u=>[...u,c])})},[]),Q=n.useCallback(c=>{t(u=>u.filter(g=>g.id!==c))},[]),T=n.useCallback((c,u)=>{t(g=>g.map(x=>x.id===c?u:x))},[]),J=n.useCallback((c,u)=>{y(!1);const g=O(c);W(g)||g.status.type!=="uploading"||T(g.id,g.setStatus({type:"uploaded",fileId:u.fileId,fileUrls:u}))},[O,T]),K=n.useCallback((c,u)=>{const g=O(u);if(W(g)||g.status.type!=="uploading")return;const x=Math.round(c.loaded*100/c.total);g.status.progress!==x&&T(u,g.setStatus({type:"uploading",abortController:g.status.abortController,progress:x}))},[O,T]),Y=n.useCallback((c,u)=>{const g=new AbortController,x=new ie(u.name,u.size,V(),{type:"uploading",abortController:g,progress:1});X(x),d.uploadFile(e,c.uploadUrl,u,L=>K(L,x.id),g.signal).then(()=>J(x.id,c)).catch(L=>{L instanceof DOMException&&L.name==="AbortError"||T(x.id,x.setStatus({type:"error",errorMessage:L?L.toString():"Unknown error"}))})},[X,e,V,J,K,T,d]),Z=n.useCallback(c=>{const u=O(c);W(u)||(u.status.type==="uploading"&&u.status.abortController.abort(),u.status.type==="uploaded"&&u.status.fileUrls.deleteUrl&&d.deleteFile(u.status.fileUrls.deleteUrl),Q(c))},[O,Q,d]),ee=n.useCallback(c=>{if(c===null)return Promise.resolve();l(c),y(!0),E(!1);const u=g=>new Promise(x=>setTimeout(x,g));return ot(c,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(g=>d.fetchFileURLs([g]).then(x=>({file:g,fileUrls:x[0]}))).then(({file:g,fileUrls:x})=>Y(x,g)).then(()=>u(tt)).then(()=>{E(!0)}).catch(g=>{rt.error(g)})},[d,Y]),ue=n.useCallback(c=>{ee(c)},[ee]),fe=n.useCallback(()=>{i.length!==0&&(i.forEach(c=>Z(c.id)),l(null),S(!0))},[i,Z]);n.useEffect(()=>{a.getFileUploaderStateValue(e)===void 0&&a.setFileUploaderStateValue(e,N(i),{fromUi:!1},v)},[]),n.useEffect(()=>{if(j!=="ready")return;const c=N(i),u=a.getFileUploaderStateValue(e);Ee(c,u)||a.setFileUploaderStateValue(e,c,{fromUi:!0},v)},[j,i,a,e,v]);const pe=n.useCallback(()=>{t([]),l(null);const c=N([]);a.setFileUploaderStateValue(e,c,{fromUi:!0},v)},[e,v,a]);return Oe({element:e,widgetMgr:a,onFormCleared:pe}),P(se,{className:"stCameraInput","data-testid":"stCameraInput",ref:f,children:[U(Re,{label:e.label,disabled:h,labelVisibility:Ie(e.labelVisibility?.value),children:e.help&&U(Fe,{content:e.help,label:e.label})}),s?P(ke,{children:[U(G,{width:o,children:s!==ce&&U(Be,{src:s,alt:"Snapshot",opacity:M||!C?"50%":"100%",width:o,height:o*9/16})}),U(le,{onClick:fe,progress:A,disabled:!!A||h,children:A?"Uploading...":P(ze,{children:[U(q,{content:ae,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):U(et,{handleCapture:ue,width:o,disabled:h,clearPhotoInProgress:w,setClearPhotoInProgress:S,facingMode:_,setFacingMode:de,testOverride:p})]})},ut=n.memo(nt);export{ut as default};
@@ -1 +1 @@
1
- import{z as c,ah as e,c as t,r as n,B as l,j as a,u as C,a as x,D as L,d as S}from"./index.aCorc3Yt.js";import{m as $}from"./iconPosition.2YynQUxu.js";function R(o,r){switch(o){case t.XSMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.sm}`,fontSize:r.fontSizes.sm};case t.SMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.md}`};case t.LARGE:return{padding:`${r.spacing.md} ${r.spacing.md}`};default:return{padding:`${r.spacing.xs} ${r.spacing.md}`}}}const f=c("a",{target:"e1hofpsd0"})(({containerWidth:o,size:r,theme:i})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,borderRadius:i.radii.button,minHeight:i.sizes.minElementHeight,margin:0,lineHeight:i.lineHeights.base,color:i.colors.primary,textDecoration:"none",width:o?"100%":"auto",userSelect:"none","&:visited":{color:i.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:i.shadows.focusRing},"&:hover":{textDecoration:"none"},"&:active":{textDecoration:"none"},...R(r,i)})),T=c(f,{target:"e1hofpsd1"})(({theme:o})=>({backgroundColor:o.colors.primary,color:o.colors.white,border:`${o.sizes.borderWidth} solid ${o.colors.primary}`,"&:hover, &:focus-visible":{backgroundColor:e(o.colors.primary,.15),borderColor:e(o.colors.primary,.15)},"&:active":{backgroundColor:o.colors.primary,borderColor:e(o.colors.primary,.15)},"&:visited:not(:active)":{color:o.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),w=c(f,{target:"e1hofpsd2"})(({theme:o})=>({backgroundColor:o.colors.lightenedBg05,color:o.colors.bodyText,border:`${o.sizes.borderWidth} solid ${o.colors.borderColor}`,"&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{backgroundColor:o.colors.darkenedBgMix15},"&:active":{backgroundColor:o.colors.darkenedBgMix25},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),z=c(f,{target:"e1hofpsd3"})(({theme:o})=>({padding:o.spacing.none,backgroundColor:o.colors.transparent,color:o.colors.bodyText,border:"none","&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{color:o.colors.primary},"&:hover:not([disabled]), &:focus-visible:not([disabled])":{"span.stMarkdownColoredText":{color:"inherit !important"}},"&:active":{color:e(o.colors.primary,.25)},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),y=n.forwardRef(function({kind:r,size:i,disabled:s,children:d,autoFocus:u,href:b,rel:p,target:k,onClick:B},v){let g=T;return r===l.SECONDARY?g=w:r===l.TERTIARY&&(g=z),a(g,{ref:v,kind:r,size:i||t.MEDIUM,containerWidth:!0,disabled:s||!1,autoFocus:u||!1,href:b,target:k,rel:p,onClick:B,tabIndex:s?-1:0,"data-testid":`stBaseLinkButton-${r}`,children:d})});y.displayName="BaseLinkButton";const A=n.memo(y);function D(o){const{element:r}=o,i=r.shortcut?r.shortcut:void 0;let s=l.SECONDARY;r.type==="primary"?s=l.PRIMARY:r.type==="tertiary"&&(s=l.TERTIARY);const d=n.useRef(null),u=n.useCallback(()=>{r.disabled||d.current?.click()},[r.disabled]),b=n.useCallback(p=>{r.disabled&&p.preventDefault()},[r.disabled]);return C({shortcut:i,disabled:r.disabled,onActivate:u}),a(S,{className:"stLinkButton","data-testid":"stLinkButton",children:a(x,{help:r.help,containerWidth:!0,children:a(A,{ref:d,kind:s,size:t.SMALL,disabled:r.disabled,onClick:b,href:r.url,target:"_blank",rel:"noreferrer","aria-disabled":r.disabled,children:a(L,{icon:r.icon,iconPosition:$(r.iconPosition),label:r.label,shortcut:i})})})})}const I=n.memo(D);export{I as default};
1
+ import{z as c,ah as e,c as t,r as n,B as l,j as a,u as C,a as x,D as L,d as S}from"./index.CPc_uZux.js";import{m as $}from"./iconPosition.BVScIr6G.js";function R(o,r){switch(o){case t.XSMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.sm}`,fontSize:r.fontSizes.sm};case t.SMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.md}`};case t.LARGE:return{padding:`${r.spacing.md} ${r.spacing.md}`};default:return{padding:`${r.spacing.xs} ${r.spacing.md}`}}}const f=c("a",{target:"e1hofpsd0"})(({containerWidth:o,size:r,theme:i})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,borderRadius:i.radii.button,minHeight:i.sizes.minElementHeight,margin:0,lineHeight:i.lineHeights.base,color:i.colors.primary,textDecoration:"none",width:o?"100%":"auto",userSelect:"none","&:visited":{color:i.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:i.shadows.focusRing},"&:hover":{textDecoration:"none"},"&:active":{textDecoration:"none"},...R(r,i)})),T=c(f,{target:"e1hofpsd1"})(({theme:o})=>({backgroundColor:o.colors.primary,color:o.colors.white,border:`${o.sizes.borderWidth} solid ${o.colors.primary}`,"&:hover, &:focus-visible":{backgroundColor:e(o.colors.primary,.15),borderColor:e(o.colors.primary,.15)},"&:active":{backgroundColor:o.colors.primary,borderColor:e(o.colors.primary,.15)},"&:visited:not(:active)":{color:o.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),w=c(f,{target:"e1hofpsd2"})(({theme:o})=>({backgroundColor:o.colors.lightenedBg05,color:o.colors.bodyText,border:`${o.sizes.borderWidth} solid ${o.colors.borderColor}`,"&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{backgroundColor:o.colors.darkenedBgMix15},"&:active":{backgroundColor:o.colors.darkenedBgMix25},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),z=c(f,{target:"e1hofpsd3"})(({theme:o})=>({padding:o.spacing.none,backgroundColor:o.colors.transparent,color:o.colors.bodyText,border:"none","&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{color:o.colors.primary},"&:hover:not([disabled]), &:focus-visible:not([disabled])":{"span.stMarkdownColoredText":{color:"inherit !important"}},"&:active":{color:e(o.colors.primary,.25)},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),y=n.forwardRef(function({kind:r,size:i,disabled:s,children:d,autoFocus:u,href:b,rel:p,target:k,onClick:B},v){let g=T;return r===l.SECONDARY?g=w:r===l.TERTIARY&&(g=z),a(g,{ref:v,kind:r,size:i||t.MEDIUM,containerWidth:!0,disabled:s||!1,autoFocus:u||!1,href:b,target:k,rel:p,onClick:B,tabIndex:s?-1:0,"data-testid":`stBaseLinkButton-${r}`,children:d})});y.displayName="BaseLinkButton";const A=n.memo(y);function D(o){const{element:r}=o,i=r.shortcut?r.shortcut:void 0;let s=l.SECONDARY;r.type==="primary"?s=l.PRIMARY:r.type==="tertiary"&&(s=l.TERTIARY);const d=n.useRef(null),u=n.useCallback(()=>{r.disabled||d.current?.click()},[r.disabled]),b=n.useCallback(p=>{r.disabled&&p.preventDefault()},[r.disabled]);return C({shortcut:i,disabled:r.disabled,onActivate:u}),a(S,{className:"stLinkButton","data-testid":"stLinkButton",children:a(x,{help:r.help,containerWidth:!0,children:a(A,{ref:d,kind:s,size:t.SMALL,disabled:r.disabled,onClick:b,href:r.url,target:"_blank",rel:"noreferrer","aria-disabled":r.disabled,children:a(L,{icon:r.icon,iconPosition:$(r.iconPosition),label:r.label,shortcut:i})})})})}const I=n.memo(D);export{I as default};
@@ -1,2 +1,2 @@
1
- import{z as f,r,l as b,aI as y,j as c,aJ as S,aw as x,o as h,m as T,Y as R,aK as v,aL as B,aM as E}from"./index.aCorc3Yt.js";import{l as J}from"./index.8HslT92O.js";import{R as k}from"./main.CCVkbuxC.js";const w=f("div",{target:"eem6pay0"})(({theme:o})=>({overflowY:"auto",position:"relative",".react-json-view .copy-icon svg":{fontSize:"1em !important",marginRight:`${o.spacing.threeXS} !important`,verticalAlign:"middle !important"}})),L=f("div",{target:"eem6pay1"})(({theme:o})=>({display:"flex",alignItems:"center",gap:o.spacing.sm,padding:o.spacing.sm,paddingLeft:o.spacing.md,fontFamily:o.genericFonts.codeFont,fontSize:o.fontSizes.twoSm,color:o.colors.bodyText,maxWidth:"90vw",wordBreak:"break-all"})),$=f("button",{target:"eem6pay2"})(({theme:o})=>({display:"flex",alignItems:"center",justifyContent:"center",padding:o.spacing.threeXS,backgroundColor:"transparent",border:"none",borderRadius:o.radii.md,cursor:"pointer",color:o.colors.fadedText60,transition:"color 0.15s ease, background-color 0.15s ease","&:hover":{backgroundColor:o.colors.darkenedBgMix15,color:o.colors.bodyText},"&:active":{backgroundColor:o.colors.darkenedBgMix25},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:o.shadows.focusRing}})),I=f("div",{target:"eem6pay3"})(({top:o,left:e})=>({position:"fixed",top:o,left:e}));function P({top:o,left:e,path:t,clearTooltip:d}){const[p,n]=r.useState(!0),s=b(),{colors:i,radii:a}=s,{isCopied:l,copyToClipboard:u,label:m}=y(),g=r.useCallback(()=>{n(!1),d()},[d]),C=r.useCallback(()=>{u(t)},[u,t]);return c(v,{content:h(L,{"data-testid":"stJsonPathTooltip",children:[c("code",{children:t}),c($,{onClick:C,title:m,"aria-label":m,autoFocus:!0,children:c(R,{size:"sm",iconValue:l?":material/check:":":material/content_copy:"})})]}),placement:x.top,accessibilityType:S.tooltip,showArrow:!1,popoverMargin:15,onClickOutside:g,onEsc:g,overrides:{Body:{style:{borderTopLeftRadius:a.default,borderTopRightRadius:a.default,borderBottomLeftRadius:a.default,borderBottomRightRadius:a.default,paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important",backgroundColor:"transparent"}},Inner:{style:{backgroundColor:T(s)?i.bgColor:i.secondaryBg,color:i.bodyText,borderTopLeftRadius:a.default,borderTopRightRadius:a.default,borderBottomLeftRadius:a.default,borderBottomRightRadius:a.default,paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important"}}},isOpen:p,children:c(I,{"data-testid":"stJsonPathTooltipTarget",top:o,left:e})})}const j=r.memo(P);function z(o){return o.length===0?"$":o.reduce((e,t,d)=>{if(t===null)return e;if(/^\d+$/.test(t))return`${e}[${t}]`;if(t===""||/[^a-zA-Z0-9_$]/.test(t)||/^\d/.test(t)){const s=t.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return`${e}["${s}"]`}return d===0||e===""?t:`${e}.${t}`},"")}function F(){const[o,e]=r.useState(null),t=r.useRef({x:0,y:0});r.useEffect(()=>{const n=s=>{t.current={x:s.clientX,y:s.clientY}};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[]);const d=r.useCallback(n=>{const{x:s,y:i}=t.current,a=[...n.namespace,n.name],l=z(a);e({path:l,x:s,y:i})},[]),p=r.useCallback(()=>{e(null)},[]);return{tooltip:o,handleSelect:d,clearTooltip:p}}function A({element:o}){const e=b(),{tooltip:t,handleSelect:d,clearTooltip:p}=F(),{copyToClipboard:n}=y(),s=r.useCallback(l=>{n(JSON.stringify(l.src))},[n]);let i;try{i=JSON.parse(o.body)}catch(l){const u=B(l);try{i=J.parse(o.body)}catch{const g=parseInt(u.message.replace(/[^0-9]/g,""),10);return u.message+=`
1
+ import{z as f,r,l as b,aI as y,j as c,aJ as S,aw as x,o as h,m as T,Y as R,aK as v,aL as B,aM as E}from"./index.CPc_uZux.js";import{l as J}from"./index.8HslT92O.js";import{R as k}from"./main.TU5_aabd.js";const w=f("div",{target:"eem6pay0"})(({theme:o})=>({overflowY:"auto",position:"relative",".react-json-view .copy-icon svg":{fontSize:"1em !important",marginRight:`${o.spacing.threeXS} !important`,verticalAlign:"middle !important"}})),L=f("div",{target:"eem6pay1"})(({theme:o})=>({display:"flex",alignItems:"center",gap:o.spacing.sm,padding:o.spacing.sm,paddingLeft:o.spacing.md,fontFamily:o.genericFonts.codeFont,fontSize:o.fontSizes.twoSm,color:o.colors.bodyText,maxWidth:"90vw",wordBreak:"break-all"})),$=f("button",{target:"eem6pay2"})(({theme:o})=>({display:"flex",alignItems:"center",justifyContent:"center",padding:o.spacing.threeXS,backgroundColor:"transparent",border:"none",borderRadius:o.radii.md,cursor:"pointer",color:o.colors.fadedText60,transition:"color 0.15s ease, background-color 0.15s ease","&:hover":{backgroundColor:o.colors.darkenedBgMix15,color:o.colors.bodyText},"&:active":{backgroundColor:o.colors.darkenedBgMix25},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:o.shadows.focusRing}})),I=f("div",{target:"eem6pay3"})(({top:o,left:e})=>({position:"fixed",top:o,left:e}));function P({top:o,left:e,path:t,clearTooltip:d}){const[p,n]=r.useState(!0),s=b(),{colors:i,radii:a}=s,{isCopied:l,copyToClipboard:u,label:m}=y(),g=r.useCallback(()=>{n(!1),d()},[d]),C=r.useCallback(()=>{u(t)},[u,t]);return c(v,{content:h(L,{"data-testid":"stJsonPathTooltip",children:[c("code",{children:t}),c($,{onClick:C,title:m,"aria-label":m,autoFocus:!0,children:c(R,{size:"sm",iconValue:l?":material/check:":":material/content_copy:"})})]}),placement:x.top,accessibilityType:S.tooltip,showArrow:!1,popoverMargin:15,onClickOutside:g,onEsc:g,overrides:{Body:{style:{borderTopLeftRadius:a.default,borderTopRightRadius:a.default,borderBottomLeftRadius:a.default,borderBottomRightRadius:a.default,paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important",backgroundColor:"transparent"}},Inner:{style:{backgroundColor:T(s)?i.bgColor:i.secondaryBg,color:i.bodyText,borderTopLeftRadius:a.default,borderTopRightRadius:a.default,borderBottomLeftRadius:a.default,borderBottomRightRadius:a.default,paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important"}}},isOpen:p,children:c(I,{"data-testid":"stJsonPathTooltipTarget",top:o,left:e})})}const j=r.memo(P);function z(o){return o.length===0?"$":o.reduce((e,t,d)=>{if(t===null)return e;if(/^\d+$/.test(t))return`${e}[${t}]`;if(t===""||/[^a-zA-Z0-9_$]/.test(t)||/^\d/.test(t)){const s=t.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return`${e}["${s}"]`}return d===0||e===""?t:`${e}.${t}`},"")}function F(){const[o,e]=r.useState(null),t=r.useRef({x:0,y:0});r.useEffect(()=>{const n=s=>{t.current={x:s.clientX,y:s.clientY}};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[]);const d=r.useCallback(n=>{const{x:s,y:i}=t.current,a=[...n.namespace,n.name],l=z(a);e({path:l,x:s,y:i})},[]),p=r.useCallback(()=>{e(null)},[]);return{tooltip:o,handleSelect:d,clearTooltip:p}}function A({element:o}){const e=b(),{tooltip:t,handleSelect:d,clearTooltip:p}=F(),{copyToClipboard:n}=y(),s=r.useCallback(l=>{n(JSON.stringify(l.src))},[n]);let i;try{i=JSON.parse(o.body)}catch(l){const u=B(l);try{i=J.parse(o.body)}catch{const g=parseInt(u.message.replace(/[^0-9]/g,""),10);return u.message+=`
2
2
  ${o.body.substring(0,g+1)} ← here`,c(E,{name:"Json Parse Error",message:u.message})}}const a=T(e)?"rjv-default":"monokai";return h(w,{className:"stJson","data-testid":"stJson",children:[c(k,{src:i,collapsed:o.maxExpandDepth??!o.expanded,displayDataTypes:!1,displayObjectSize:!1,name:!1,theme:a,enableClipboard:s,onSelect:d,style:{fontFamily:e.genericFonts.codeFont,fontSize:e.fontSizes.codeFontSize,fontWeight:e.fontWeights.code,backgroundColor:e.colors.bgColor,whiteSpace:"pre-wrap"}}),t&&c(j,{top:t.y,left:t.x,path:t.path,clearTooltip:p})]})}const Y=r.memo(A);export{Y as default};
@@ -1 +1 @@
1
- import{W as f,a6 as p,B as i,r as l,u as h,j as o,a as S,b as F,c as I,D as R,d as C,a7 as M}from"./index.aCorc3Yt.js";import{a8 as D}from"./index.aCorc3Yt.js";import{m as x}from"./iconPosition.2YynQUxu.js";import{F as E,u as O}from"./FormClearHelper.DN8D_YXO.js";function y(a){const{disabled:d,element:t,widgetMgr:e,fragmentId:u}=a,{formId:s}=t,m=t.shortcut?t.shortcut:void 0,{formsData:B}=f(p),b=B.formsWithUploads.has(s);let n=i.SECONDARY_FORM_SUBMIT;t.type==="primary"?n=i.PRIMARY_FORM_SUBMIT:t.type==="tertiary"&&(n=i.TERTIARY_FORM_SUBMIT);const r=d||b;l.useEffect(()=>(e.addSubmitButton(s,t),()=>e.removeSubmitButton(s,t)),[e,s,t]);const c=l.useCallback(()=>{r||e.submitForm(t.formId,u,t)},[r,e,t,u]);return h({shortcut:m,disabled:r,onActivate:c}),o(C,{className:"stFormSubmitButton","data-testid":"stFormSubmitButton",children:o(S,{help:t.help,containerWidth:!0,children:o(F,{kind:n,size:I.SMALL,containerWidth:!0,disabled:r,onClick:c,children:o(R,{icon:t.icon,iconPosition:x(t.iconPosition),label:t.label,shortcut:m})})})})}function _(a){return o(M,{children:o(y,{...a})})}export{E as FormClearHelper,y as FormSubmitButton,_ as FormSubmitContent,D as default,O as useFormClearHelper};
1
+ import{W as f,a6 as p,B as i,r as l,u as h,j as o,a as S,b as F,c as I,D as R,d as C,a7 as M}from"./index.CPc_uZux.js";import{a8 as D}from"./index.CPc_uZux.js";import{m as x}from"./iconPosition.BVScIr6G.js";import{F as E,u as O}from"./FormClearHelper.DTFnX0js.js";function y(a){const{disabled:d,element:t,widgetMgr:e,fragmentId:u}=a,{formId:s}=t,m=t.shortcut?t.shortcut:void 0,{formsData:B}=f(p),b=B.formsWithUploads.has(s);let n=i.SECONDARY_FORM_SUBMIT;t.type==="primary"?n=i.PRIMARY_FORM_SUBMIT:t.type==="tertiary"&&(n=i.TERTIARY_FORM_SUBMIT);const r=d||b;l.useEffect(()=>(e.addSubmitButton(s,t),()=>e.removeSubmitButton(s,t)),[e,s,t]);const c=l.useCallback(()=>{r||e.submitForm(t.formId,u,t)},[r,e,t,u]);return h({shortcut:m,disabled:r,onActivate:c}),o(C,{className:"stFormSubmitButton","data-testid":"stFormSubmitButton",children:o(S,{help:t.help,containerWidth:!0,children:o(F,{kind:n,size:I.SMALL,containerWidth:!0,disabled:r,onClick:c,children:o(R,{icon:t.icon,iconPosition:x(t.iconPosition),label:t.label,shortcut:m})})})})}function _(a){return o(M,{children:o(y,{...a})})}export{E as FormClearHelper,y as FormSubmitButton,_ as FormSubmitContent,D as default,O as useFormClearHelper};
@@ -1,2 +1,2 @@
1
- import{J as P,r as u,V as ao,cs as L,ct as co,aL as io,l as lo,j as m,W as U,R as fo,cu as go,z as _,aM as V}from"./index.aCorc3Yt.js";function Co(o,e,r,n){for(var t=-1,s=o==null?0:o.length;++t<s;)r=e(r,o[t],t,o);return r}function xo(o){return function(e){return o?.[e]}}var po={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ho=xo(po),mo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bo="\\u0300-\\u036f",So="\\ufe20-\\ufe2f",Ro="\\u20d0-\\u20ff",yo=bo+So+Ro,Eo="["+yo+"]",Fo=RegExp(Eo,"g");function wo(o){return o=P(o),o&&o.replace(mo,ho).replace(Fo,"")}var vo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ko(o){return o.match(vo)||[]}var Bo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function To(o){return Bo.test(o)}var H="\\ud800-\\udfff",zo="\\u0300-\\u036f",Ao="\\ufe20-\\ufe2f",Uo="\\u20d0-\\u20ff",Io=zo+Ao+Uo,J="\\u2700-\\u27bf",Z="a-z\\xdf-\\xf6\\xf8-\\xff",Wo="\\xac\\xb1\\xd7\\xf7",Lo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Oo="\\u2000-\\u206f",Mo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",G="A-Z\\xc0-\\xd6\\xd8-\\xde",jo="\\ufe0e\\ufe0f",Y=Wo+Lo+Oo+Mo,q="['’]",O="["+Y+"]",$o="["+Io+"]",K="\\d+",No="["+J+"]",X="["+Z+"]",Q="[^"+H+Y+K+J+Z+G+"]",Do="\\ud83c[\\udffb-\\udfff]",Po="(?:"+$o+"|"+Do+")",_o="[^"+H+"]",oo="(?:\\ud83c[\\udde6-\\uddff]){2}",eo="[\\ud800-\\udbff][\\udc00-\\udfff]",w="["+G+"]",Vo="\\u200d",M="(?:"+X+"|"+Q+")",Ho="(?:"+w+"|"+Q+")",j="(?:"+q+"(?:d|ll|m|re|s|t|ve))?",$="(?:"+q+"(?:D|LL|M|RE|S|T|VE))?",ro=Po+"?",to="["+jo+"]?",Jo="(?:"+Vo+"(?:"+[_o,oo,eo].join("|")+")"+to+ro+")*",Zo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Go="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Yo=to+ro+Jo,qo="(?:"+[No,oo,eo].join("|")+")"+Yo,Ko=RegExp([w+"?"+X+"+"+j+"(?="+[O,w,"$"].join("|")+")",Ho+"+"+$+"(?="+[O,w+M,"$"].join("|")+")",w+"?"+M+"+"+j,w+"+"+$,Go,Zo,K,qo].join("|"),"g");function Xo(o){return o.match(Ko)||[]}function Qo(o,e,r){return o=P(o),e=e,e===void 0?To(o)?Xo(o):ko(o):o.match(e)||[]}var oe="['’]",ee=RegExp(oe,"g");function re(o){return function(e){return Co(Qo(wo(e).replace(ee,"")),o,"")}}var te=re(function(o,e,r){return o+(r?"-":"")+e.toLowerCase()});const k=u.createContext(null);k.displayName="BidiComponentContext";const v=ao.getLogger("BidiComponent"),N="__",z="__streamlit_arrow_ref__",ne="$$STREAMLIT_INTERNAL_KEY",se=(o,e)=>{if(o&&typeof o=="object"&&!Array.isArray(o)){if(typeof o[z]=="string"){const n=o[z],t=e[n];if(t)try{return L(t)}catch{return null}return null}const r={};for(const[n,t]of Object.entries(o))if(t&&typeof t=="object"&&!Array.isArray(t)&&typeof t[z]=="string"){const s=t[z],a=e[s];if(a)try{r[n]=L(a)}catch{r[n]=null}else r[n]=null}else r[n]=t;return r}return o},ue=({arrowBlobs:o,arrowData:e,bytes:r,data:n,json:t,mixedJson:s})=>{switch(n){case"json":return t?JSON.parse(t):null;case"arrowData":return e??null;case"bytes":return r??null;case"mixed":{if(s&&o){const a=JSON.parse(s),i={};return Object.entries(o).forEach(([l,d])=>{d?.data&&(i[l]=d.data)}),se(a,i)}return null}case"any":case void 0:return null;default:co(n)}},ae=(o,e="--st")=>{const r={};return Object.entries(o).forEach(([n,t])=>{const s=te(n),a=`${e}-${s}`;if(typeof t=="boolean"){r[a]=t?"1":"0";return}if(t==null){r[a]="unset";return}if(Array.isArray(t)){r[a]=t.join(",");return}if(typeof t=="number"||typeof t=="string"){r[a]=String(t);return}r[a]="unset"}),r},ce=o=>{const e=[o.fontSizes.h1FontSize,o.fontSizes.h2FontSize,o.fontSizes.h3FontSize,o.fontSizes.h4FontSize,o.fontSizes.h5FontSize,o.fontSizes.h6FontSize],r=[o.fontWeights.h1FontWeight,o.fontWeights.h2FontWeight,o.fontWeights.h3FontWeight,o.fontWeights.h4FontWeight,o.fontWeights.h5FontWeight,o.fontWeights.h6FontWeight];return{primaryColor:o.colors.primary,backgroundColor:o.colors.bgColor,secondaryBackgroundColor:o.colors.secondaryBg,textColor:o.colors.bodyText,linkColor:o.colors.link,linkUnderline:o.linkUnderline,headingFont:o.genericFonts.headingFont,codeFont:o.genericFonts.codeFont,baseRadius:o.radii.default,buttonRadius:o.radii.button,baseFontSize:typeof o.fontSizes.baseFontSize=="number"?`${o.fontSizes.baseFontSize}px`:String(o.fontSizes.baseFontSize),baseFontWeight:o.fontWeights.normal,codeFontWeight:o.fontWeights.code,codeFontSize:o.fontSizes.codeFontSize,headingFontSizes:e,headingFontSize1:e[0],headingFontSize2:e[1],headingFontSize3:e[2],headingFontSize4:e[3],headingFontSize5:e[4],headingFontSize6:e[5],headingFontWeights:r,headingFontWeight1:r[0],headingFontWeight2:r[1],headingFontWeight3:r[2],headingFontWeight4:r[3],headingFontWeight5:r[4],headingFontWeight6:r[5],borderColor:o.colors.borderColor,dataframeBorderColor:o.colors.dataframeBorderColor,dataframeHeaderBackgroundColor:o.colors.dataframeHeaderBackgroundColor,codeBackgroundColor:o.colors.codeBackgroundColor,font:o.genericFonts.bodyFont,chartCategoricalColors:o.colors.chartCategoricalColors,chartSequentialColors:o.colors.chartSequentialColors,chartDivergingColors:o.colors.chartDivergingColors,headingColor:o.colors.headingColor,borderColorLight:o.colors.borderColorLight,codeTextColor:o.colors.codeTextColor,widgetBorderColor:o.colors.widgetBorderColor||"transparent",redColor:o.colors.redColor,orangeColor:o.colors.orangeColor,yellowColor:o.colors.yellowColor,blueColor:o.colors.blueColor,greenColor:o.colors.greenColor,violetColor:o.colors.violetColor,grayColor:o.colors.grayColor,redBackgroundColor:o.colors.redBackgroundColor,orangeBackgroundColor:o.colors.orangeBackgroundColor,yellowBackgroundColor:o.colors.yellowBackgroundColor,blueBackgroundColor:o.colors.blueBackgroundColor,greenBackgroundColor:o.colors.greenBackgroundColor,violetBackgroundColor:o.colors.violetBackgroundColor,grayBackgroundColor:o.colors.grayBackgroundColor,redTextColor:o.colors.redTextColor,orangeTextColor:o.colors.orangeTextColor,yellowTextColor:o.colors.yellowTextColor,blueTextColor:o.colors.blueTextColor,greenTextColor:o.colors.greenTextColor,violetTextColor:o.colors.violetTextColor,grayTextColor:o.colors.grayTextColor}},ie=u.memo(({element:o,children:e,widgetMgr:r,fragmentId:n,componentRegistry:t})=>{const{arrowData:s,bytes:a,componentName:i,cssContent:l,cssSourcePath:d,data:f,htmlContent:g,id:c,jsContent:b,json:p,jsSourcePath:h,mixed:C}=o,y=u.useMemo(()=>({id:o.id,formId:o.formId}),[o.id,o.formId]),B=u.useCallback(()=>{const F=r.getJsonValue(y);if(!F)return{};try{return JSON.parse(F)}catch(I){const R=io(I);return v.warn("Failed to parse widget JSON value; returning empty object.",{widgetId:y.id,formId:y.formId,error:R.message}),{}}},[y,r]),T=u.useMemo(()=>ue({arrowBlobs:C?.arrowBlobs||void 0,arrowData:s?.data||void 0,bytes:a,data:f,json:p,mixedJson:C?.json||void 0}),[f,p,s?.data,a,C?.json,C?.arrowBlobs]),S=lo(),E=u.useMemo(()=>ce(S),[S]),x=u.useMemo(()=>({componentName:i,componentRegistry:t,cssContent:l?.trim(),cssSourcePath:d||void 0,data:T,fragmentId:n,getWidgetValue:B,htmlContent:g?.trim(),id:c,formId:o.formId||void 0,jsContent:b||void 0,jsSourcePath:h||void 0,theme:E,widgetMgr:r}),[i,t,l,d,n,B,g,c,o.formId,b,h,T,E,r]);return m(k.Provider,{value:x,children:e})}),no=(o,e)=>{if(o instanceof Error)return o;const r=e?`${e}: ${String(o)}`:String(o);return new Error(r)},A=(o,e,r)=>{const n=no(o,r);v.error(`BidiComponent Error: ${n.message}`,o),e(n)},de=(o,e)=>{try{const n=document.createRange().createContextualFragment(o);e.appendChild(n)}catch(r){v.warn("createContextualFragment failed, falling back to innerHTML",r),e.innerHTML=o}},so=({containerRef:o,setError:e,skip:r=!1})=>{const n=u.useRef(null),{htmlContent:t,cssContent:s,cssSourcePath:a,componentName:i,componentRegistry:{getBidiComponentURL:l}}=U(k),d=u.useMemo(()=>{if(a)return l(i,a)},[i,a,l]),f=fo(d);return u.useEffect(()=>{if(r)return;const g=o.current;if(g)try{if(n.current?.parentNode===g&&g.removeChild(n.current),n.current=document.createElement("div"),t){const c=document.createElement("div");de(t,c),n.current.appendChild(c)}if(s){const c=document.createElement("style");c.textContent=s,n.current.appendChild(c)}else if(d){const c=document.createElement("link");c.href=d,c.rel="stylesheet",f&&(c.crossOrigin=f),c.onerror=()=>{A(new Error(`Failed to load CSS from ${d}`),e)},n.current.appendChild(c)}g.appendChild(n.current)}catch(c){A(c,e,"Failed to process HTML/CSS content")}},[t,s,o,f,d,e,r]),n};class le{constructor(){this.hashSeed=2166136261,this.hashPrime=16777619,this.cache=new Map}computeHash(e){let r=this.hashSeed;for(let n=0;n<e.length;n++)r^=e.charCodeAt(n),r=Math.imul(r>>>0,this.hashPrime)>>>0;return(r>>>0).toString(16)}getOrCreateUrlForJs(e,r){const n=this.computeHash(e),t=this.cache.get(n);if(t)return{url:t,hash:n};const s=`${e}
1
+ import{J as P,r as u,V as ao,cu as L,cv as co,aL as io,l as lo,j as m,W as U,R as fo,cw as go,z as _,aM as V}from"./index.CPc_uZux.js";function Co(o,e,r,n){for(var t=-1,s=o==null?0:o.length;++t<s;)r=e(r,o[t],t,o);return r}function xo(o){return function(e){return o?.[e]}}var po={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ho=xo(po),mo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bo="\\u0300-\\u036f",So="\\ufe20-\\ufe2f",Ro="\\u20d0-\\u20ff",yo=bo+So+Ro,Eo="["+yo+"]",Fo=RegExp(Eo,"g");function wo(o){return o=P(o),o&&o.replace(mo,ho).replace(Fo,"")}var vo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ko(o){return o.match(vo)||[]}var Bo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function To(o){return Bo.test(o)}var H="\\ud800-\\udfff",zo="\\u0300-\\u036f",Ao="\\ufe20-\\ufe2f",Uo="\\u20d0-\\u20ff",Io=zo+Ao+Uo,J="\\u2700-\\u27bf",Z="a-z\\xdf-\\xf6\\xf8-\\xff",Wo="\\xac\\xb1\\xd7\\xf7",Lo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Oo="\\u2000-\\u206f",Mo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",G="A-Z\\xc0-\\xd6\\xd8-\\xde",jo="\\ufe0e\\ufe0f",Y=Wo+Lo+Oo+Mo,q="['’]",O="["+Y+"]",$o="["+Io+"]",K="\\d+",No="["+J+"]",X="["+Z+"]",Q="[^"+H+Y+K+J+Z+G+"]",Do="\\ud83c[\\udffb-\\udfff]",Po="(?:"+$o+"|"+Do+")",_o="[^"+H+"]",oo="(?:\\ud83c[\\udde6-\\uddff]){2}",eo="[\\ud800-\\udbff][\\udc00-\\udfff]",w="["+G+"]",Vo="\\u200d",M="(?:"+X+"|"+Q+")",Ho="(?:"+w+"|"+Q+")",j="(?:"+q+"(?:d|ll|m|re|s|t|ve))?",$="(?:"+q+"(?:D|LL|M|RE|S|T|VE))?",ro=Po+"?",to="["+jo+"]?",Jo="(?:"+Vo+"(?:"+[_o,oo,eo].join("|")+")"+to+ro+")*",Zo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Go="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Yo=to+ro+Jo,qo="(?:"+[No,oo,eo].join("|")+")"+Yo,Ko=RegExp([w+"?"+X+"+"+j+"(?="+[O,w,"$"].join("|")+")",Ho+"+"+$+"(?="+[O,w+M,"$"].join("|")+")",w+"?"+M+"+"+j,w+"+"+$,Go,Zo,K,qo].join("|"),"g");function Xo(o){return o.match(Ko)||[]}function Qo(o,e,r){return o=P(o),e=e,e===void 0?To(o)?Xo(o):ko(o):o.match(e)||[]}var oe="['’]",ee=RegExp(oe,"g");function re(o){return function(e){return Co(Qo(wo(e).replace(ee,"")),o,"")}}var te=re(function(o,e,r){return o+(r?"-":"")+e.toLowerCase()});const k=u.createContext(null);k.displayName="BidiComponentContext";const v=ao.getLogger("BidiComponent"),N="__",z="__streamlit_arrow_ref__",ne="$$STREAMLIT_INTERNAL_KEY",se=(o,e)=>{if(o&&typeof o=="object"&&!Array.isArray(o)){if(typeof o[z]=="string"){const n=o[z],t=e[n];if(t)try{return L(t)}catch{return null}return null}const r={};for(const[n,t]of Object.entries(o))if(t&&typeof t=="object"&&!Array.isArray(t)&&typeof t[z]=="string"){const s=t[z],a=e[s];if(a)try{r[n]=L(a)}catch{r[n]=null}else r[n]=null}else r[n]=t;return r}return o},ue=({arrowBlobs:o,arrowData:e,bytes:r,data:n,json:t,mixedJson:s})=>{switch(n){case"json":return t?JSON.parse(t):null;case"arrowData":return e??null;case"bytes":return r??null;case"mixed":{if(s&&o){const a=JSON.parse(s),i={};return Object.entries(o).forEach(([l,d])=>{d?.data&&(i[l]=d.data)}),se(a,i)}return null}case"any":case void 0:return null;default:co(n)}},ae=(o,e="--st")=>{const r={};return Object.entries(o).forEach(([n,t])=>{const s=te(n),a=`${e}-${s}`;if(typeof t=="boolean"){r[a]=t?"1":"0";return}if(t==null){r[a]="unset";return}if(Array.isArray(t)){r[a]=t.join(",");return}if(typeof t=="number"||typeof t=="string"){r[a]=String(t);return}r[a]="unset"}),r},ce=o=>{const e=[o.fontSizes.h1FontSize,o.fontSizes.h2FontSize,o.fontSizes.h3FontSize,o.fontSizes.h4FontSize,o.fontSizes.h5FontSize,o.fontSizes.h6FontSize],r=[o.fontWeights.h1FontWeight,o.fontWeights.h2FontWeight,o.fontWeights.h3FontWeight,o.fontWeights.h4FontWeight,o.fontWeights.h5FontWeight,o.fontWeights.h6FontWeight];return{primaryColor:o.colors.primary,backgroundColor:o.colors.bgColor,secondaryBackgroundColor:o.colors.secondaryBg,textColor:o.colors.bodyText,linkColor:o.colors.link,linkUnderline:o.linkUnderline,headingFont:o.genericFonts.headingFont,codeFont:o.genericFonts.codeFont,baseRadius:o.radii.default,buttonRadius:o.radii.button,baseFontSize:typeof o.fontSizes.baseFontSize=="number"?`${o.fontSizes.baseFontSize}px`:String(o.fontSizes.baseFontSize),baseFontWeight:o.fontWeights.normal,codeFontWeight:o.fontWeights.code,codeFontSize:o.fontSizes.codeFontSize,headingFontSizes:e,headingFontSize1:e[0],headingFontSize2:e[1],headingFontSize3:e[2],headingFontSize4:e[3],headingFontSize5:e[4],headingFontSize6:e[5],headingFontWeights:r,headingFontWeight1:r[0],headingFontWeight2:r[1],headingFontWeight3:r[2],headingFontWeight4:r[3],headingFontWeight5:r[4],headingFontWeight6:r[5],borderColor:o.colors.borderColor,dataframeBorderColor:o.colors.dataframeBorderColor,dataframeHeaderBackgroundColor:o.colors.dataframeHeaderBackgroundColor,codeBackgroundColor:o.colors.codeBackgroundColor,font:o.genericFonts.bodyFont,chartCategoricalColors:o.colors.chartCategoricalColors,chartSequentialColors:o.colors.chartSequentialColors,chartDivergingColors:o.colors.chartDivergingColors,headingColor:o.colors.headingColor,borderColorLight:o.colors.borderColorLight,codeTextColor:o.colors.codeTextColor,widgetBorderColor:o.colors.widgetBorderColor||"transparent",redColor:o.colors.redColor,orangeColor:o.colors.orangeColor,yellowColor:o.colors.yellowColor,blueColor:o.colors.blueColor,greenColor:o.colors.greenColor,violetColor:o.colors.violetColor,grayColor:o.colors.grayColor,redBackgroundColor:o.colors.redBackgroundColor,orangeBackgroundColor:o.colors.orangeBackgroundColor,yellowBackgroundColor:o.colors.yellowBackgroundColor,blueBackgroundColor:o.colors.blueBackgroundColor,greenBackgroundColor:o.colors.greenBackgroundColor,violetBackgroundColor:o.colors.violetBackgroundColor,grayBackgroundColor:o.colors.grayBackgroundColor,redTextColor:o.colors.redTextColor,orangeTextColor:o.colors.orangeTextColor,yellowTextColor:o.colors.yellowTextColor,blueTextColor:o.colors.blueTextColor,greenTextColor:o.colors.greenTextColor,violetTextColor:o.colors.violetTextColor,grayTextColor:o.colors.grayTextColor}},ie=u.memo(({element:o,children:e,widgetMgr:r,fragmentId:n,componentRegistry:t})=>{const{arrowData:s,bytes:a,componentName:i,cssContent:l,cssSourcePath:d,data:f,htmlContent:g,id:c,jsContent:b,json:p,jsSourcePath:h,mixed:C}=o,y=u.useMemo(()=>({id:o.id,formId:o.formId}),[o.id,o.formId]),B=u.useCallback(()=>{const F=r.getJsonValue(y);if(!F)return{};try{return JSON.parse(F)}catch(I){const R=io(I);return v.warn("Failed to parse widget JSON value; returning empty object.",{widgetId:y.id,formId:y.formId,error:R.message}),{}}},[y,r]),T=u.useMemo(()=>ue({arrowBlobs:C?.arrowBlobs||void 0,arrowData:s?.data||void 0,bytes:a,data:f,json:p,mixedJson:C?.json||void 0}),[f,p,s?.data,a,C?.json,C?.arrowBlobs]),S=lo(),E=u.useMemo(()=>ce(S),[S]),x=u.useMemo(()=>({componentName:i,componentRegistry:t,cssContent:l?.trim(),cssSourcePath:d||void 0,data:T,fragmentId:n,getWidgetValue:B,htmlContent:g?.trim(),id:c,formId:o.formId||void 0,jsContent:b||void 0,jsSourcePath:h||void 0,theme:E,widgetMgr:r}),[i,t,l,d,n,B,g,c,o.formId,b,h,T,E,r]);return m(k.Provider,{value:x,children:e})}),no=(o,e)=>{if(o instanceof Error)return o;const r=e?`${e}: ${String(o)}`:String(o);return new Error(r)},A=(o,e,r)=>{const n=no(o,r);v.error(`BidiComponent Error: ${n.message}`,o),e(n)},de=(o,e)=>{try{const n=document.createRange().createContextualFragment(o);e.appendChild(n)}catch(r){v.warn("createContextualFragment failed, falling back to innerHTML",r),e.innerHTML=o}},so=({containerRef:o,setError:e,skip:r=!1})=>{const n=u.useRef(null),{htmlContent:t,cssContent:s,cssSourcePath:a,componentName:i,componentRegistry:{getBidiComponentURL:l}}=U(k),d=u.useMemo(()=>{if(a)return l(i,a)},[i,a,l]),f=fo(d);return u.useEffect(()=>{if(r)return;const g=o.current;if(g)try{if(n.current?.parentNode===g&&g.removeChild(n.current),n.current=document.createElement("div"),t){const c=document.createElement("div");de(t,c),n.current.appendChild(c)}if(s){const c=document.createElement("style");c.textContent=s,n.current.appendChild(c)}else if(d){const c=document.createElement("link");c.href=d,c.rel="stylesheet",f&&(c.crossOrigin=f),c.onerror=()=>{A(new Error(`Failed to load CSS from ${d}`),e)},n.current.appendChild(c)}g.appendChild(n.current)}catch(c){A(c,e,"Failed to process HTML/CSS content")}},[t,s,o,f,d,e,r]),n};class le{constructor(){this.hashSeed=2166136261,this.hashPrime=16777619,this.cache=new Map}computeHash(e){let r=this.hashSeed;for(let n=0;n<e.length;n++)r^=e.charCodeAt(n),r=Math.imul(r>>>0,this.hashPrime)>>>0;return(r>>>0).toString(16)}getOrCreateUrlForJs(e,r){const n=this.computeHash(e),t=this.cache.get(n);if(t)return{url:t,hash:n};const s=`${e}
2
2
  //# sourceURL=${r}-${n}.js`,a=new Blob([s],{type:"text/javascript"}),i=URL.createObjectURL(a);return this.cache.set(n,i),{url:i,hash:n}}}const fe=new le,ge="events";function Ce(o){if(o.includes(N))throw new Error("Base component id must not contain the delimiter sequence");return`${ne}_${o}${N}${ge}`}const D=async({componentId:o,componentIdForWidgetMgr:e,componentName:r,data:n,formId:t,fragmentId:s,getWidgetValue:a,moduleUrl:i,parentElement:l,widgetMgr:d})=>{const f=await import(i);if(!f)throw new Error("JS module does not exist.");if(!f.default||typeof f.default!="function")throw new Error("JS module does not have a default export function.");const g=(b,p)=>{let h={};try{h={...a(),[b]:p}}catch(C){v.error(`Failed to get existing value for ${b}`,C),h={[b]:p}}d.setJsonValue({id:e,formId:t},h,{fromUi:!0},s)},c=(b,p)=>{if(t){v.warn("BidiComponent: setTriggerValue ignored inside st.form. Triggers are not allowed in forms; use setStateValue and form submit instead.");return}const h=Ce(e);d.setTriggerValue({id:h,formId:t},{fromUi:!0},s,{event:b,value:p})};return f.default({name:r,data:n,key:o,parentElement:l,setStateValue:g,setTriggerValue:c})},uo=({containerRef:o,setError:e,skip:r=!1})=>{const t=`st-bidi-component-${u.useMemo(()=>go(),[])}`,{componentName:s,data:a,formId:i,fragmentId:l,getWidgetValue:d,id:f,jsContent:g,jsSourcePath:c,theme:b,widgetMgr:p,componentRegistry:{getBidiComponentURL:h}}=U(k),C=u.useMemo(()=>{if(c)return h(s,c)},[s,c,h]),y=u.useRef(),B=u.useRef(),T=u.useRef(!1);u.useEffect(()=>{const{current:S}=o;if(r||!g&&!C||!S)return;(async()=>{try{if(g){const{url:x}=fe.getOrCreateUrlForJs(g,`st-bidi-${s}`);y.current=await D({componentId:t,componentIdForWidgetMgr:f,componentName:s,data:a,formId:i,fragmentId:l,getWidgetValue:d,moduleUrl:x,parentElement:S,widgetMgr:p})}else if(C){const x=C;try{await new Promise((F,I)=>{const R=document.createElement("script");R.type="module",R.src=x,R.async=!0,R.onload=()=>F(),R.onerror=()=>I(new Error(`Failed to load script from ${C}`)),document.head.appendChild(R),B.current=R}),y.current=await D({componentId:t,componentIdForWidgetMgr:f,componentName:s,data:a,formId:i,fragmentId:l,getWidgetValue:d,moduleUrl:x,parentElement:S,widgetMgr:p})}catch(F){throw no(F,`Failed to load or execute script from ${C}`)}}}catch(x){T.current||A(x,e)}})()},[t,s,o,a,i,l,d,f,g,C,e,r,p,b]),u.useEffect(()=>()=>{T.current=!0;const S=y.current;S&&Promise.resolve(S).then(x=>{x?.()}).catch(x=>{v.error("Failed to run custom component cleanup",x)});const E=B.current;E?.parentNode&&E.parentNode.removeChild(E)},[])},xe=_("div",{target:"epzkg1s0"})(({cssCustomProperties:o})=>({...o,display:"contents"})),W=_("div",{target:"epzkg1s1"})({width:"100%",height:"100%"}),pe=u.memo(()=>{const o=u.useRef(null),e=u.useRef(null),[r,n]=u.useState(!1),[t,s]=u.useState(null),{id:a}=U(k);u.useEffect(()=>{if(o.current)try{if(o.current.shadowRoot){e.current=o.current.shadowRoot,n(!0);return}e.current=o.current.attachShadow({mode:"open"}),n(!0)}catch(l){A(l,s,"Failed to create shadow DOM")}},[a]);const i=!r||!!t;return so({containerRef:e,setError:s,skip:i}),uo({containerRef:e,setError:s,skip:i}),t?m(V,{name:"BidiComponent Error",message:t.message,stack:t.stack}):m(W,{ref:o,"data-testid":"stBidiComponentIsolated"})}),he=u.memo(()=>{const o=u.useRef(null),[e,r]=u.useState(null),n=!!e;return so({containerRef:o,setError:r,skip:n}),uo({containerRef:o,setError:r,skip:n}),e?m(V,{name:"BidiComponent Error",message:e.message,stack:e.stack}):m(W,{ref:o,"data-testid":"stBidiComponentRegular"})}),me=({children:o})=>{const{theme:e}=U(k),r=u.useMemo(()=>ae(e),[e]);return m(xe,{cssCustomProperties:r,children:o})},be=({element:o,widgetMgr:e,fragmentId:r,componentRegistry:n})=>{const{isolateStyles:t}=o;return m(ie,{element:o,widgetMgr:e,fragmentId:r,componentRegistry:n,children:m(W,{className:"stBidiComponent",children:m(me,{children:t?m(pe,{}):m(he,{})})})})},Re=u.memo(be);export{k as BidiComponentContext,Re as default};
@@ -1 +1 @@
1
- import{z as e,r as a,o as t,j as r,q as o}from"./index.aCorc3Yt.js";import{P as i}from"./ProgressBar.C5uBOtcx.js";const l=e("div",{target:"e1jwj65h0"})(({theme:s})=>({paddingBottom:s.spacing.sm,lineHeight:"normal"}));function n({element:s}){return t("div",{className:"stProgress","data-testid":"stProgress",children:[r(l,{children:r(o,{source:s.text,allowHTML:!1,isLabel:!0})}),r(i,{value:s.value})]})}const m=a.memo(n);export{m as default};
1
+ import{z as e,r as a,o as t,j as r,q as o}from"./index.CPc_uZux.js";import{P as i}from"./ProgressBar.Dg-oMbWg.js";const l=e("div",{target:"e1jwj65h0"})(({theme:s})=>({paddingBottom:s.spacing.sm,lineHeight:"normal"}));function n({element:s}){return t("div",{className:"stProgress","data-testid":"stProgress",children:[r(l,{children:r(o,{source:s.text,allowHTML:!1,isLabel:!0})}),r(i,{value:s.value})]})}const m=a.memo(n);export{m as default};
@@ -1 +1 @@
1
- import{r as m,l as x,m as C,j as s,o as T,p as y,q as L,P as S,t as W,C as B,v as w}from"./index.aCorc3Yt.js";import{W as R}from"./WidgetLabelHelpIconInline.6xCU76OE.js";import{u as E}from"./useBasicWidgetState.Bg0ZMUt5.js";import{S as P,L as v,a as u}from"./checkbox.OTGupu18.js";import"./FormClearHelper.DN8D_YXO.js";function $({element:o,disabled:a,widgetMgr:n,fragmentId:d}){const[p,g]=E({getStateFromWidgetMgr:M,getDefaultStateFromProto:X,getCurrStateFromProto:H,updateWidgetMgrState:V,element:o,widgetMgr:n,fragmentId:d}),f=m.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=x(),{colors:r,spacing:h,sizes:e}=t,b=C(t),k=a?r.fadedText40:r.bodyText;return s(w,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:s(P,{checked:p,disabled:a,onChange:f,"aria-label":o.label,checkmarkType:o.type===B.StyleType.TOGGLE?u.toggle:u.default,labelPlacement:v.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?r.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=b?r.bgColor:r.bodyText;return a&&(c=b?r.gray70:r.gray90),{width:`calc(${e.checkbox} - ${t.spacing.twoXS})`,height:`calc(${e.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${e.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=r.borderColor;return c&&!a&&(l=r.darkenedBgMix15),i&&!a&&(l=r.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${e.checkbox})`,minWidth:`calc(2 * ${e.checkbox})`,height:e.checkbox,minHeight:e.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?r.primary:r.borderColor;return{outline:0,width:e.checkbox,height:e.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?t.shadows.focusRing:"",borderLeftWidth:e.borderWidth,borderRightWidth:e.borderWidth,borderTopWidth:e.borderWidth,borderBottomWidth:e.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:k}}},children:T(W,{visibility:y(o.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[s(L,{source:o.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),o.help&&s(R,{content:o.help,placement:S.TOP_RIGHT,label:o.label})]})})})}function M(o,a){return o.getBoolValue(a)}function X(o){return o.default??null}function H(o){return o.value??null}function V(o,a,n,d){a.setBoolValue(o,n.value,{fromUi:n.fromUi},d)}const _=m.memo($);export{_ as default};
1
+ import{r as m,l as x,m as C,j as s,o as T,p as y,q as L,P as S,t as W,C as B,v as w}from"./index.CPc_uZux.js";import{W as R}from"./WidgetLabelHelpIconInline.Dlc8f0Ji.js";import{u as E}from"./useBasicWidgetState.DvpdEDYZ.js";import{S as P,L as v,a as u}from"./checkbox.BKgWNdeI.js";import"./FormClearHelper.DTFnX0js.js";function $({element:o,disabled:a,widgetMgr:n,fragmentId:d}){const[p,g]=E({getStateFromWidgetMgr:M,getDefaultStateFromProto:X,getCurrStateFromProto:H,updateWidgetMgrState:V,element:o,widgetMgr:n,fragmentId:d}),f=m.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=x(),{colors:r,spacing:h,sizes:e}=t,b=C(t),k=a?r.fadedText40:r.bodyText;return s(w,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:s(P,{checked:p,disabled:a,onChange:f,"aria-label":o.label,checkmarkType:o.type===B.StyleType.TOGGLE?u.toggle:u.default,labelPlacement:v.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?r.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=b?r.bgColor:r.bodyText;return a&&(c=b?r.gray70:r.gray90),{width:`calc(${e.checkbox} - ${t.spacing.twoXS})`,height:`calc(${e.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${e.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=r.borderColor;return c&&!a&&(l=r.darkenedBgMix15),i&&!a&&(l=r.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${e.checkbox})`,minWidth:`calc(2 * ${e.checkbox})`,height:e.checkbox,minHeight:e.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?r.primary:r.borderColor;return{outline:0,width:e.checkbox,height:e.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?t.shadows.focusRing:"",borderLeftWidth:e.borderWidth,borderRightWidth:e.borderWidth,borderTopWidth:e.borderWidth,borderBottomWidth:e.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:k}}},children:T(W,{visibility:y(o.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[s(L,{source:o.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),o.help&&s(R,{content:o.help,placement:S.TOP_RIGHT,label:o.label})]})})})}function M(o,a){return o.getBoolValue(a)}function X(o){return o.default??null}function H(o){return o.value??null}function V(o,a,n,d){a.setBoolValue(o,n.value,{fromUi:n.fromUi},d)}const _=m.memo($);export{_ as default};
@@ -1 +1 @@
1
- import{aC as A,aD as p,aE as y,aF as d,aG as j,aH as C}from"./index.aCorc3Yt.js";const m=/[#.]/g;function x(r,e){const n=r||"",t={};let i=0,o,f;for(;i<n.length;){m.lastIndex=i;const a=m.exec(n),s=n.slice(i,a?a.index:n.length);s&&(o?o==="#"?t.id=s:Array.isArray(t.className)?t.className.push(s):t.className=[s]:f=s,i+=s.length),a&&(o=a[0],i++)}return{type:"element",tagName:f||e||"div",properties:t,children:[]}}function u(r,e,n){const t=n?G(n):void 0;function i(o,f,...a){let s;if(o==null){s={type:"root",children:[]};const c=f;a.unshift(c)}else{s=x(o,e);const c=s.tagName.toLowerCase(),g=t?t.get(c):void 0;if(s.tagName=g||c,S(f))a.unshift(f);else for(const[N,b]of Object.entries(f))M(r,s.properties,N,b)}for(const c of a)l(s.children,c);return s.type==="element"&&s.tagName==="template"&&(s.content={type:"root",children:s.children},s.children=[]),s}return i}function S(r){if(r===null||typeof r!="object"||Array.isArray(r))return!0;if(typeof r.type!="string")return!1;const e=r,n=Object.keys(r);for(const t of n){const i=e[t];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const o=i;for(const f of o)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in r&&Array.isArray(r.children))}function M(r,e,n,t){const i=A(r,n);let o;if(t!=null){if(typeof t=="number"){if(Number.isNaN(t))return;o=t}else typeof t=="boolean"?o=t:typeof t=="string"?i.spaceSeparated?o=p(t):i.commaSeparated?o=y(t):i.commaOrSpaceSeparated?o=p(y(t).join(" ")):o=h(i,i.property,t):Array.isArray(t)?o=[...t]:o=i.property==="style"?w(t):String(t);if(Array.isArray(o)){const f=[];for(const a of o)f.push(h(i,i.property,a));o=f}i.property==="className"&&Array.isArray(e.className)&&(o=e.className.concat(o)),e[i.property]=o}}function l(r,e){if(e!=null)if(typeof e=="number"||typeof e=="string")r.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)l(r,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?l(r,e.children):r.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function h(r,e,n){if(typeof n=="string"){if(r.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((r.boolean||r.overloadedBoolean)&&(n===""||d(n)===d(e)))return!0}return n}function w(r){const e=[];for(const[n,t]of Object.entries(r))e.push([n,t].join(": "));return e.join("; ")}function G(r){const e=new Map;for(const n of r)e.set(n.toLowerCase(),n);return e}const L=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],F=u(j,"div"),O=u(C,"g",L);export{F as h,O as s};
1
+ import{aC as A,aD as p,aE as y,aF as d,aG as j,aH as C}from"./index.CPc_uZux.js";const m=/[#.]/g;function x(r,e){const n=r||"",t={};let i=0,o,f;for(;i<n.length;){m.lastIndex=i;const a=m.exec(n),s=n.slice(i,a?a.index:n.length);s&&(o?o==="#"?t.id=s:Array.isArray(t.className)?t.className.push(s):t.className=[s]:f=s,i+=s.length),a&&(o=a[0],i++)}return{type:"element",tagName:f||e||"div",properties:t,children:[]}}function u(r,e,n){const t=n?G(n):void 0;function i(o,f,...a){let s;if(o==null){s={type:"root",children:[]};const c=f;a.unshift(c)}else{s=x(o,e);const c=s.tagName.toLowerCase(),g=t?t.get(c):void 0;if(s.tagName=g||c,S(f))a.unshift(f);else for(const[N,b]of Object.entries(f))M(r,s.properties,N,b)}for(const c of a)l(s.children,c);return s.type==="element"&&s.tagName==="template"&&(s.content={type:"root",children:s.children},s.children=[]),s}return i}function S(r){if(r===null||typeof r!="object"||Array.isArray(r))return!0;if(typeof r.type!="string")return!1;const e=r,n=Object.keys(r);for(const t of n){const i=e[t];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const o=i;for(const f of o)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in r&&Array.isArray(r.children))}function M(r,e,n,t){const i=A(r,n);let o;if(t!=null){if(typeof t=="number"){if(Number.isNaN(t))return;o=t}else typeof t=="boolean"?o=t:typeof t=="string"?i.spaceSeparated?o=p(t):i.commaSeparated?o=y(t):i.commaOrSpaceSeparated?o=p(y(t).join(" ")):o=h(i,i.property,t):Array.isArray(t)?o=[...t]:o=i.property==="style"?w(t):String(t);if(Array.isArray(o)){const f=[];for(const a of o)f.push(h(i,i.property,a));o=f}i.property==="className"&&Array.isArray(e.className)&&(o=e.className.concat(o)),e[i.property]=o}}function l(r,e){if(e!=null)if(typeof e=="number"||typeof e=="string")r.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)l(r,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?l(r,e.children):r.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function h(r,e,n){if(typeof n=="string"){if(r.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((r.boolean||r.overloadedBoolean)&&(n===""||d(n)===d(e)))return!0}return n}function w(r){const e=[];for(const[n,t]of Object.entries(r))e.push([n,t].join(": "));return e.join("; ")}function G(r){const e=new Map;for(const n of r)e.set(n.toLowerCase(),n);return e}const L=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],F=u(j,"div"),O=u(C,"g",L);export{F as h,O as s};
@@ -1,4 +1,4 @@
1
- import{z as c,a3 as l,r as i,j as a,b2 as p}from"./index.aCorc3Yt.js";import{P as d,R as f}from"./Particles.BznyVdfo.js";const g=""+new URL("../media/flake-0.DgWaVvm5.png",import.meta.url).href,u=""+new URL("../media/flake-1.B2r5AHMK.png",import.meta.url).href,E=""+new URL("../media/flake-2.BnWSExPC.png",import.meta.url).href,o=150,s=150,S=10,w=90,x=4e3,e=(t,n=0)=>Math.random()*(t-n)+n,_=()=>l(`from{transform:translateY(0)
1
+ import{z as c,a3 as l,r as i,j as a,b2 as p}from"./index.CPc_uZux.js";import{P as d,R as f}from"./Particles.12xFSjcn.js";const g=""+new URL("../media/flake-0.DgWaVvm5.png",import.meta.url).href,u=""+new URL("../media/flake-1.B2r5AHMK.png",import.meta.url).href,E=""+new URL("../media/flake-2.BnWSExPC.png",import.meta.url).href,o=150,s=150,S=10,w=90,x=4e3,e=(t,n=0)=>Math.random()*(t-n)+n,_=()=>l(`from{transform:translateY(0)
2
2
  rotateX(`,e(360),`deg)
3
3
  rotateY(`,e(360),`deg)
4
4
  rotateZ(`,e(360),"deg);}to{transform:translateY(calc(100vh + ",o,`px))
@@ -1 +1 @@
1
- import{r,E as S,_ as E,V as ct,z as m,cv as b,ct as Fe,o as A,j as a,P as ue,ax as V,ay as pe,$ as K,b as dt,B as ut,Y as Me,bW as pt,l as gt,k as ft,b6 as ht,cw as mt,e as ie,bP as Re,bQ as wt,aa as vt}from"./index.aCorc3Yt.js";import{u as ke,I as Ct,g as Ve,F as Y,E as ce,b as xt,s as yt,a as Ae}from"./FileHelper.hUOqtbwa.js";import{u as bt}from"./useWaveformController.DbWw5MEk.js";import{I as St}from"./InputInstructions.DbssY6d4.js";import{u as Et,T as It}from"./useTextInputAutoExpand.DDBezxks.js";import{i as zt}from"./inputUtils.CptNuJwn.js";import{T as Rt}from"./TableChart.esm.DHKzVs3a.js";import{E as Vt}from"./ErrorOutline.esm.D71F8ziR.js";import{U as Te}from"./UploadFileInfo.Dr-zDST7.js";import"./base-input.Cs-E6S71.js";var De=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),r.createElement("path",{d:"M14 17H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}))});De.displayName="Article";var Ue=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}))});Ue.displayName="Code";var He=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"}))});He.displayName="Description";var Le=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M9.17 6l2 2H20v10H4V6h5.17M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"}))});Le.displayName="Folder";var Ne=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"}))});Ne.displayName="Image";var Be=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 3l.01 10.55c-.59-.34-1.27-.55-2-.55a4.001 4.001 0 100 8c2.22 0 3.99-1.79 3.99-4V7h4V3h-6zm-1.99 16c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"}))});Be.displayName="MusicNote";var We=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm-1-9c0-.55.45-1 1-1s1 .45 1 1v6c0 .55-.45 1-1 1s-1-.45-1-1V5zm6 6c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});We.displayName="MicNone";var Pe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M15 8v8H5V8h10m1-2H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4V7c0-.55-.45-1-1-1z"}))});Pe.displayName="Videocam";var Oe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z"}))});Oe.displayName="Add";var $e=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M13 19V7.83l4.88 4.88c.39.39 1.03.39 1.42 0a.996.996 0 000-1.41l-6.59-6.59a.996.996 0 00-1.41 0l-6.6 6.58a.996.996 0 101.41 1.41L11 7.83V19c0 .55.45 1 1 1s1-.45 1-1z"}))});$e.displayName="ArrowUpward";var Xe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm4.29 12.89a.996.996 0 11-1.41 1.41L12 13.41 9.11 16.3a.996.996 0 11-1.41-1.41L10.59 12 7.71 9.11A.996.996 0 119.12 7.7L12 10.59l2.89-2.89a.996.996 0 111.41 1.41L13.41 12l2.88 2.89z"}))});Xe.displayName="Cancel";var je=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M18 6.7l-8.48 8.48-3.54-3.54a.996.996 0 10-1.41 1.41l4.24 4.24c.39.39 1.02.39 1.41 0l9.18-9.18a.999.999 0 00-.01-1.42c-.37-.38-1-.38-1.39.01z"}))});je.displayName="Check";var _e=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M18.3 5.71a.996.996 0 00-1.41 0L12 10.59 7.11 5.7A.996.996 0 105.7 7.11L10.59 12 5.7 16.89a.996.996 0 101.41 1.41L12 13.41l4.89 4.89a.996.996 0 101.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"}))});_e.displayName="Close";var Ke=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm0 4c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"}))});Ke.displayName="ErrorOutline";const _=ct.getLogger("ChatInput"),At=m("div",{target:"e15xmbo00"})({position:"relative",display:"flex",flexDirection:"column"}),Ft=m("div",{target:"e15xmbo01"})(({theme:e})=>({backgroundColor:e.colors.secondaryBg,border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.widgetBorderColor??e.colors.transparent,position:"relative",display:"flex",flexDirection:"column",alignItems:"stretch",flex:1,paddingTop:e.spacing.md,paddingBottom:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg,gap:e.spacing.sm,borderRadius:e.radii.default,boxSizing:"border-box",":focus-within":{borderColor:e.colors.primary}})),Mt=m("div",{target:"e15xmbo02"})(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing.sm})),kt=m("div",{target:"e15xmbo03"})(({theme:e,isStacked:t})=>({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",gap:e.spacing.sm,flexWrap:t?"wrap":"nowrap"})),Tt=m("div",{target:"e15xmbo04"})(({isStacked:e})=>({flex:e?"none":1,width:e?"100%":"auto",order:e?-1:0,display:"flex",alignItems:"center",minWidth:0})),Dt=m("div",{target:"e15xmbo05"})(({theme:e})=>({display:"flex",flexDirection:"row",flexShrink:0,gap:e.spacing.sm,alignItems:"center"})),Ut=m("div",{target:"e15xmbo06"})(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing.sm,alignItems:"center"})),Ht=m("div",{target:"e15xmbo07"})(({theme:e})=>({position:"absolute",top:e.spacing.twoXS,right:e.spacing.lg,color:e.colors.fadedText60,fontSize:e.fontSizes.twoSm,textAlign:"right",whiteSpace:"nowrap",pointerEvents:"auto",cursor:"text",zIndex:e.zIndices.priority,"& .stChatInputInstructions":{position:"static"}})),k=m("button",{target:"e15xmbo08"})(({theme:e,disabled:t,hasError:o,primary:p})=>{if(p)return{border:"none",backgroundColor:t?e.colors.darkenedBgMix15:e.colors.primary,borderRadius:e.radii.button,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.xs,width:e.sizes.chatInputPrimaryButtonSize,height:e.sizes.chatInputPrimaryButtonSize,color:t?e.colors.fadedText40:e.colors.white,cursor:t?"not-allowed":"pointer",transition:"background-color 200ms ease","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{boxShadow:e.shadows.focusRing},"&:hover":{backgroundColor:t?e.colors.darkenedBgMix15:e.colors.primary}};const l=()=>o?e.colors.redTextColor:t?e.colors.fadedText40:e.colors.fadedText60;return{border:"none",backgroundColor:e.colors.transparent,borderRadius:e.radii.default,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.none,color:l(),pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{boxShadow:e.shadows.focusRing},"&:hover":{color:o?e.colors.redColor:e.colors.bodyText},"&:active":{color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:e.colors.transparent,borderColor:e.colors.transparent,color:e.colors.fadedText40,cursor:"not-allowed"},"& svg":{width:e.iconSizes.lg,height:e.iconSizes.lg}}}),Lt=m("div",{target:"e15xmbo09"})(({isRecording:e})=>({display:e?"flex":"none",flex:1,alignItems:"center",minWidth:0})),Nt=m("div",{target:"e15xmbo010"})(({theme:e})=>({position:"relative",width:"100%",height:e.sizes.chatInputPrimaryButtonSize,borderRadius:e.radii.default,overflow:"hidden","& > div":{position:"absolute",inset:0}})),Ye=(e,t)=>t===b.Directory?{...e,webkitdirectory:"",multiple:!0}:e,Bt=(e,t)=>{if(!t||t.length===0)return!0;const o=e.name.toLowerCase(),p=o.lastIndexOf(".");if(p===-1||p===o.length-1)return t.some(d=>d===""||d===".");const l=o.substring(p),w=o.substring(p+1);return t.some(d=>{const v=d.toLowerCase();return v.startsWith(".")?l===v:w===v})},Wt=(e,t)=>Bt(e,t)?{isValid:!0}:{isValid:!1,errorMessage:`${e.type||"This type of"} files are not allowed.`},de=e=>{switch(e){case b.None:return"a file";case b.Single:return"a file";case b.Multiple:return"files";case b.Directory:return"a directory";default:return Fe(e),"a file"}},Pt=m("div",{target:"e1lsn30a0"})(({theme:e})=>({backgroundColor:e.colors.transparent,position:"absolute",inset:0,zIndex:e.zIndices.priority,borderRadius:e.radii.chatInput})),Ot=m("div",{target:"e1lsn30a1"})(({theme:e})=>({position:"absolute",inset:0,border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.primary,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,color:e.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:e.fontWeights.bold,pointerEvents:"none",zIndex:e.zIndices.priority})),$t=m("div",{target:"e1lsn30a2"})(({disabled:e})=>({pointerEvents:e?"none":"auto"})),Xt=m("div",{target:"e1lsn30a3"})(({theme:e})=>({lineHeight:e.lineHeights.tight})),jt=m("div",{target:"e1lsn30a4"})(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing.sm})),_t=m("div",{target:"e1lsn30a5"})({flex:"0 0 auto",maxWidth:"100%"}),Kt=m("div",{target:"e1lsn30a6"})(({theme:e,isError:t,isClickable:o})=>({position:"relative",display:"inline-flex",alignItems:"center",width:"fit-content",minWidth:"9rem",maxWidth:"100%",backgroundColor:t?e.colors.redBackgroundColor:e.colors.bgColor,padding:e.spacing.twoXS,paddingRight:e.spacing.twoXL,borderRadius:e.radii.default,gap:e.spacing.sm,cursor:o?"pointer":"default"})),Yt=m("div",{target:"e1lsn30a7"})({display:"flex",flexDirection:"column",minWidth:0}),Gt=m("div",{target:"e1lsn30a8"})(({theme:e,fileStatus:t})=>({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:e.radii.default,width:e.sizes.chatInputFileIconSize,height:e.sizes.chatInputFileIconSize,flexShrink:0,overflow:"hidden",...t==="uploaded"&&{backgroundColor:e.colors.bodyText,color:e.colors.bgColor},...t==="uploading"&&{backgroundColor:e.colors.fadedText10,color:e.colors.fadedText60},...t==="error"&&{backgroundColor:e.colors.redBackgroundColor,color:e.colors.redTextColor}})),qt=m("img",{target:"e1lsn30a9"})({width:"100%",height:"100%",objectFit:"cover"}),Qt=m("div",{target:"e1lsn30a10"})(({theme:e,fileStatus:t})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t.type==="uploading"?e.colors.fadedText60:e.colors.bodyText})),Jt=m("div",{target:"e1lsn30a11"})(({theme:e})=>({color:e.colors.fadedText60,fontSize:e.fontSizes.sm})),Zt=m("small",{target:"e1lsn30a12"})(({theme:e,isError:t})=>({position:"absolute",top:e.spacing.twoXS,right:e.spacing.twoXS,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0,"& button":{display:"flex",alignItems:"center",justifyContent:"center",width:"fit-content",height:"fit-content",minHeight:"unset",minWidth:"unset",maxHeight:"unset",maxWidth:"unset",borderRadius:"50%",backgroundColor:"transparent",color:t?e.colors.redTextColor:e.colors.fadedText60,padding:0,overflow:"hidden",boxSizing:"border-box",lineHeight:0,"&:hover":{backgroundColor:"transparent",color:t?e.colors.redColor:e.colors.bodyText}}})),er=m("span",{target:"e1lsn30a13"})({position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}),tr=({onDrop:e,multiple:t,accept:o,maxSize:p,acceptFile:l,disabled:w})=>{const{getRootProps:d,getInputProps:v}=ke({onDrop:e,multiple:t,accept:o,maxSize:p,useFsAccessApi:!1}),C=Ye(v(),l),c=d({tabIndex:-1});return A($t,{"data-testid":"stChatInputFileUploadButton",disabled:w,...c,children:[a("input",{...C}),a(pe,{content:`Upload or drag and drop ${de(l)}`,placement:ue.TOP,onMouseEnterDelay:500,children:a(k,{type:"button",disabled:w,"aria-label":`Upload ${de(l)}`,children:a(V,{content:Oe,size:"xl",color:"inherit"})})})]})},rr=r.memo(tr),or=({getRootProps:e,getInputProps:t,acceptFile:o})=>{const p=Ye(t(),o);return A(K,{children:[a(Pt,{...e(),children:a("input",{...p})}),a(Ot,{children:`Drag and drop ${de(o)} here`})]})},nr=r.memo(or),Ge=new Set(["jpg","jpeg","png","gif","webp","svg","bmp"]),ar=new Set(["pdf"]),ir=new Set(["csv","tsv","xlsx","xls"]),sr=new Set(["txt","md","json","xml","yaml","yml"]),lr=new Set(["py","js","ts","jsx","tsx","css","html","java","cpp","c","go","rs","rb","php","swift","kt","scala","sh","bash","sql"]),cr=new Set(["mp3","wav","m4a","ogg","flac","aac"]),dr=new Set(["mp4","webm","mov","avi","mkv","wmv"]),ur=new Set(["zip","tar","gz","rar","7z","bz2"]);function qe(e){const t=e.lastIndexOf(".");return t===-1||t===e.length-1?"":e.slice(t+1).toLowerCase()}function pr(e){const t=qe(e);return Ge.has(t)?Ne:ar.has(t)?De:ir.has(t)?Rt:sr.has(t)?He:lr.has(t)?Ue:cr.has(t)?Be:dr.has(t)?Pe:ur.has(t)?Le:Ct}function gr(e){const t=qe(e);return Ge.has(t)}const fr=20;function hr(e,t=fr){if(e.length<=t)return e;const o=e.lastIndexOf(".");if(!(o>0&&o<e.length-1)){const f=Math.floor((t-3)/2),g=f>0?e.slice(-f):"";return`${e.slice(0,f)}...${g}`}const l=e.slice(o),w=e.slice(0,o),d=t-l.length-3;if(d<=0){const f=Math.floor((t-3)/2),g=f>0?e.slice(-f):"";return`${e.slice(0,f)}...${g}`}const v=Math.ceil(d/2),C=Math.floor(d/2),c=C>0?w.slice(-C):"";return`${w.slice(0,v)}...${c}${l}`}function mr(e,t){const o=r.useMemo(()=>!e||!gr(t)?null:URL.createObjectURL(e),[e,t]);return r.useEffect(()=>()=>{o&&URL.revokeObjectURL(o)},[o]),o}const wr=({fileInfo:e,imagePreviewUrl:t})=>{const{type:o}=e.status;switch(o){case"uploading":return a(Me,{iconValue:"spinner",testid:"stChatInputFileIconSpinner",size:"lg"});case"error":return a(V,{content:Vt,size:"lg",testid:"stChatInputFileIconError"});case"uploaded":return t?a(qt,{src:t,alt:e.name,"data-testid":"stChatInputFileImagePreview"}):a(V,{content:pr(e.name),size:"lg"});default:return Fe(o),null}},vr=({fileInfo:e,onDelete:t,onRetry:o})=>{const p=e.status.type,l=p==="error",w=p==="uploading",d=l&&o!==void 0&&e.file!==void 0,v=r.useId(),C=mr(e.file,e.name),c=e.status.type==="error"?e.status.errorMessage:"Upload failed",f=r.useCallback(()=>{d&&o(e)},[d,o,e]),g=r.useCallback(x=>{d&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),o(e))},[d,o,e]),h=r.useCallback(x=>{x.stopPropagation(),t(e.id)},[t,e.id]),T=w?`Cancel upload of ${e.name}`:`Remove ${e.name}`,G=Ve(e.size,Y.Byte),W=`${e.name}, ${G}`,D=A(Kt,{className:"stChatInputFile","data-testid":"stChatInputFile",isError:l,isClickable:d,onClick:d?f:void 0,onKeyDown:d?g:void 0,title:d?"Click to retry upload":void 0,role:d?"button":void 0,tabIndex:d?0:void 0,"aria-label":W,"aria-invalid":l||void 0,"aria-describedby":l?v:void 0,children:[a(Gt,{fileStatus:p,children:a(wr,{fileInfo:e,imagePreviewUrl:C})}),A(Yt,{children:[a(Qt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:e.name,fileStatus:e.status,children:hr(e.name)}),a(Jt,{children:Ve(e.size,Y.Byte)})]}),a(Zt,{"data-testid":"stChatInputDeleteBtn",isError:l,children:a(dt,{onClick:h,kind:ut.MINIMAL,"aria-label":T,children:a(V,{content:Xe,size:"md"})})}),l&&A(er,{id:v,role:"alert",children:["Error: ",c]})]});return l?a(pe,{content:c,placement:ue.TOP,error:!0,children:D}):D},Cr=r.memo(vr),xr=({items:e,onDelete:t,onRetry:o})=>a(Xt,{"data-testid":"stChatUploadedFiles",children:a(jt,{children:e.map(p=>a(_t,{children:a(Cr,{fileInfo:p,onDelete:t,onRetry:o})},p.id))})}),yr=r.memo(xr),br=(e,t,o)=>{const p=[],l=[];return e.forEach(w=>{if(w.size>o){l.push({file:w,errors:[{code:ce.FileTooLarge,message:`File is too large. Maximum size is ${o} bytes.`}]});return}const d=Wt(w,t.fileType);if(!d.isValid){l.push({file:w,errors:[{code:ce.FileInvalidType,message:d.errorMessage||"File type not allowed."}]});return}p.push(w)}),{accepted:p,rejected:l}},Sr=({acceptMultipleFiles:e,maxFileSize:t,uploadClient:o,uploadFile:p,addFiles:l,getNextLocalFileId:w,deleteExistingFiles:d,onUploadComplete:v,element:C})=>(c,f)=>{if(c.length>0){const{accepted:g,rejected:h}=br(c,C,t);c=g,f=[...f,...h]}if(!e&&c.length===0&&f.length>1){const g=f.findIndex(h=>h.errors?.[0].code===ce.TooManyFiles);g>=0&&(c.push(f[g].file),f.splice(g,1))}if(!e&&c.length>0&&d(),o.fetchFileURLs(c).then(g=>{pt(g,c).forEach(([h,T])=>{p(h,T)})}).catch(g=>{l(c.map(h=>new Te(h.name,h.size,w(),{type:"error",errorMessage:g},h)))}),f.length>0){const g=f.map(h=>xt(h,w(),t));l(g)}v()},Er=({getNextLocalFileId:e,addFiles:t,updateFile:o,uploadClient:p,element:l,onUploadProgress:w,onUploadComplete:d})=>(v,C)=>{const c=C.webkitRelativePath||C.name,f=new AbortController,g=new Te(c,C.size,e(),{type:"uploading",abortController:f,progress:1},C);t([g]),p.uploadFile({formId:"",...l},v.uploadUrl,C,h=>w(h,g.id),f.signal).then(()=>d(g.id,v)).catch(h=>{h instanceof DOMException&&h.name==="AbortError"||o(g.id,g.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})};function Ir(e,t,o){return{Root:{style:{minHeight:e.sizes.chatInputTextareaMinHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0",...o}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:e.fontWeights.normal,lineHeight:e.lineHeights.inputWidget,"::placeholder":{color:e.colors.fadedText60},height:t.isExtended?t.height:"auto",maxHeight:t.maxHeight,overflowY:"auto",paddingLeft:e.spacing.none,paddingRight:e.spacing.none,paddingBottom:e.spacing.twoXS,paddingTop:e.spacing.twoXS,width:"100%"}}}}const se=(e,t,o)=>o.map(p=>p.id===e?t:p),le=(e,t)=>t.find(o=>o.id===e);function zr({disabled:e,element:t,widgetMgr:o,fragmentId:p,uploadClient:l}){const w=gt(),{placeholder:d,maxChars:v}=t,C=r.useRef(0),c=r.useRef(null),f=r.useRef(!1),g=r.useRef(null),h=r.useRef(null),{width:T,elementRef:G}=ft(),{innerWidth:W,innerHeight:D}=ht(),[x,q]=r.useState(t.default),[z,F]=r.useState([]),[U,Q]=r.useState(!1),[H,ge]=r.useState(!1),[J,L]=r.useState(null),[M,Z]=r.useState(!1),[Qe,fe]=r.useState(0),ee=t.acceptAudio??!1;r.useEffect(()=>()=>{h.current&&h.current.abort()},[]);const P=Et({textareaRef:c,dependencies:[d,M]}),O=r.useRef(""),$=r.useRef(0),te=r.useRef(null),he=r.useRef(null),N=r.useCallback(n=>{const i=getComputedStyle(n);O.current=`${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;const u=parseFloat(i.paddingLeft)||0,s=parseFloat(i.paddingRight)||0;$.current=n.clientWidth-u-s},[]);r.useLayoutEffect(()=>{const n=c.current;if(!n)return;N(n);const i=new ResizeObserver(()=>N(n));return i.observe(n),()=>i.disconnect()},[N,M]),r.useEffect(()=>{if(x===""){Z(!1);return}if(M)return;const n=c.current;if(!n||(($.current<=0||!O.current)&&N(n),$.current<=0||!O.current))return;te.current||(te.current=document.createElement("canvas"),he.current=te.current.getContext("2d"));const i=he.current;i&&(i.font=O.current,i.measureText(x).width>$.current-10&&Z(!0))},[x,M,N]);const X=r.useMemo(()=>z.some(n=>n.status.type==="uploading")?!1:x!==""||z.length>0,[z,x]),I=mt(t.acceptFile),re=yt(t.maxUploadSizeMb,Y.Megabyte,Y.Byte),me=r.useCallback(n=>F(i=>[...i,...n]),[]),we=r.useCallback(n=>{n.status.type==="uploading"&&n.status.abortController.abort(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&l.deleteFile(n.status.fileUrls.deleteUrl).catch(i=>{_.error("Failed to delete file from server:",i)})},[l]),ve=r.useCallback(n=>{F(i=>{const u=le(n,i);if(ie(u))return i;we(u);const s=i.filter(y=>y.id!==n);return s.length===0&&fe(y=>y+1),s})},[we]),oe=r.useRef(null),Je=r.useCallback(n=>{!n.file||n.status.type!=="error"||(F(i=>i.filter(u=>u.id!==n.id)),oe.current&&oe.current([n.file],[]))},[]),Ce=r.useCallback(()=>{const n=z.filter(i=>i.status.type==="uploaded").map(i=>{const{name:u,size:s,status:y}=i,{fileId:ae,fileUrls:lt}=y;return new Re({fileId:ae,fileUrls:lt,name:u,size:s})});return new wt({uploadedFileInfo:n})},[z]),xe=()=>C.current++,ne=Sr({acceptMultipleFiles:I===b.Multiple||I===b.Directory,maxFileSize:re,uploadClient:l,uploadFile:Er({getNextLocalFileId:xe,addFiles:me,updateFile:(n,i)=>{F(u=>se(n,i,u))},uploadClient:l,element:t,onUploadProgress:(n,i)=>{F(u=>{const s=le(i,u);if(ie(s)||s.status.type!=="uploading")return u;const y=Math.round(n.loaded*100/n.total);return s.status.progress===y?u:se(i,s.setStatus({type:"uploading",abortController:s.status.abortController,progress:y}),u)})},onUploadComplete:(n,i)=>{F(u=>{const s=le(n,u);return ie(s)||s.status.type!=="uploading"?u:se(s.id,s.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}),u)})}}),addFiles:me,getNextLocalFileId:xe,deleteExistingFiles:()=>z.forEach(n=>ve(n.id)),onUploadComplete:()=>{c.current&&c.current.focus()},element:t});oe.current=ne;const{getRootProps:Ze,getInputProps:et}=ke({onDrop:ne,multiple:I===b.Multiple||I===b.Directory,accept:Ae(t.fileType),maxSize:re,useFsAccessApi:!1}),j=r.useCallback(n=>{if(c.current&&c.current.focus(),!X&&!n||e)return;const i=Ce(),u={data:x,fileUploaderState:i,audioFileInfo:n};o.setChatInputValue(t,u,{fromUi:!0},p),z.length>0&&fe(s=>s+1),F([]),q(""),Z(!1),P.clearScrollHeight()},[X,e,x,z.length,Ce,o,t,p,P]),ye=r.useCallback(async n=>{const i=new Date().toISOString().replace(/[:.]/g,"-"),u=new File([n],`audio-${i}.wav`,{type:"audio/wav"});try{ge(!0);const s=await l.fetchFileURLs([u]);if(s.length===0)throw new Error("Failed to get upload URL for audio file");const y=s[0];h.current=new AbortController,await l.uploadFile({formId:"",...t},y.uploadUrl,u,()=>{},h.current.signal);const ae=new Re({fileId:y.fileId,fileUrls:y,name:u.name,size:u.size});j(ae)}catch(s){const y="Recording failed";_.error("Audio upload failed:",s),L(y),c.current&&c.current.focus()}finally{ge(!1)}},[l,t,j]),tt=r.useMemo(()=>({onApprove:ye,onPermissionDenied:()=>{const n="Microphone access denied";L(n),_.error("Permission denied:",n)},onError:n=>{L("Recording failed"),_.error("Recording error:",n)},onRecordStart:()=>{L(null)}}),[ye]),R=bt({containerRef:g,sampleRate:t.audioSampleRate??void 0,events:tt}),be=r.useCallback(()=>{j()},[j]),rt=n=>{const{metaKey:i,ctrlKey:u,shiftKey:s}=n;zt(n)&&!s&&!u&&!i&&(n.preventDefault(),be())},ot=n=>{const{value:i}=n.target;v!==0&&i.length>v||(q(i),P.updateScrollHeight(),J&&L(null))},Se=r.useCallback(async n=>{n.preventDefault(),n.stopPropagation(),!(!ee||e||R.state==="recording")&&await R.start()},[ee,e,R]),nt=r.useCallback(()=>{R.cancel(),c.current&&c.current.focus()},[R]),Ee=r.useCallback(async()=>{const{blob:n}=await R.stop();await R.approve(n)},[R]),Ie=r.useCallback(n=>{Se(n)},[Se]),at=r.useCallback(()=>{Ee()},[Ee]),it=r.useCallback(()=>{c.current&&c.current.focus()},[]);r.useEffect(()=>{if(t.setValue&&!f.current){f.current=!0;const n=t.value||"";q(n)}},[t.setValue,t.value]),r.useEffect(()=>{f.current=!1},[t]),r.useEffect(()=>{const n=s=>{s.preventDefault(),s.stopPropagation(),!U&&s.dataTransfer?.types.includes("Files")&&Q(!0)},i=s=>{s.preventDefault(),s.stopPropagation(),U&&(s.clientX<=0&&s.clientY<=0||s.clientX>=W&&s.clientY>=D)&&Q(!1)},u=s=>{s.preventDefault(),s.stopPropagation(),U&&Q(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",u),window.addEventListener("dragleave",i),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",u),window.removeEventListener("dragleave",i)}},[U,W,D]);const st=I!==b.None&&U,B=R.state==="recording",ze=!B&&T>vt(w.breakpoints.hideWidgetDetails)&&v>0;return a(At,{className:"stChatInput","data-testid":"stChatInput",ref:G,children:A(Ft,{children:[ze&&a(Ht,{onClick:it,id:"stChatInputInstructions",children:a(St,{dirty:X,value:x,maxLength:v,type:"chat",inForm:!1,className:"stChatInputInstructions"})}),st&&a(nr,{getRootProps:Ze,getInputProps:et,acceptFile:I}),I!==b.None&&z.length>0&&a(Mt,{children:a(yr,{items:[...z],onDelete:ve,onRetry:Je})}),A(kt,{isStacked:M,children:[a(Dt,{children:I!==b.None&&!B&&a(rr,{onDrop:ne,multiple:I===b.Multiple||I===b.Directory,accept:Ae(t.fileType),maxSize:re,acceptFile:I,disabled:e},Qe)}),a(Lt,{isRecording:B,children:a(Nt,{ref:g})}),!B&&a(Tt,{isStacked:M,children:a(It,{inputRef:c,value:x,placeholder:d,onChange:ot,onKeyDown:rt,"aria-label":d,disabled:e,rows:1,"aria-describedby":ze?"stChatInputInstructions":void 0,overrides:Ir(w,P,{width:"100%"})})}),a(Ut,{children:B?A(K,{children:[a(k,{onClick:nt,disabled:e,"data-testid":"stChatInputCancelButton","aria-label":"Cancel recording",children:a(V,{content:_e,size:"lg",color:"inherit"})}),a(k,{onClick:at,disabled:e||H,"data-testid":"stChatInputApproveButton","aria-label":"Submit recording",children:H?a(Me,{size:"lg",iconValue:"spinner"}):a(V,{content:je,size:"lg",color:"inherit"})})]}):A(K,{children:[ee&&a(K,{children:J?a(pe,{content:J,placement:ue.TOP,error:!0,children:a(k,{onClick:Ie,disabled:e||H,hasError:!0,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:a(V,{content:Ke,size:"xl",color:"inherit"})})}):a(k,{onClick:Ie,disabled:e||H,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:a(V,{content:We,size:"xl",color:"inherit"})})}),a(k,{onClick:be,disabled:!X||e||H,"data-testid":"stChatInputSubmitButton","aria-label":"Send message",primary:!0,children:a(V,{content:$e,size:"lg",color:"inherit"})})]})})]})]})})}const Lr=r.memo(zr);export{Lr as default};
1
+ import{r,E as S,_ as E,V as ct,z as m,cx as b,cv as Fe,o as A,j as a,P as ue,ax as V,ay as pe,$ as K,b as dt,B as ut,Y as Me,bY as pt,l as gt,k as ft,b6 as ht,cy as mt,e as ie,bR as Re,bS as wt,aa as vt}from"./index.CPc_uZux.js";import{u as ke,I as Ct,g as Ve,F as Y,E as ce,b as xt,s as yt,a as Ae}from"./FileHelper.DqvW90pm.js";import{u as bt}from"./useWaveformController.B0olyXLQ.js";import{I as St}from"./InputInstructions.CdzsN_Va.js";import{u as Et,T as It}from"./useTextInputAutoExpand.BIApLJKn.js";import{i as zt}from"./inputUtils.CptNuJwn.js";import{T as Rt}from"./TableChart.esm.CzJtGIR-.js";import{E as Vt}from"./ErrorOutline.esm.DC6KVDKK.js";import{U as Te}from"./UploadFileInfo.Dr-zDST7.js";import"./base-input.Q-zJLgRK.js";var De=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),r.createElement("path",{d:"M14 17H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}))});De.displayName="Article";var Ue=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}))});Ue.displayName="Code";var He=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"}))});He.displayName="Description";var Le=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M9.17 6l2 2H20v10H4V6h5.17M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"}))});Le.displayName="Folder";var Ne=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"}))});Ne.displayName="Image";var Be=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 3l.01 10.55c-.59-.34-1.27-.55-2-.55a4.001 4.001 0 100 8c2.22 0 3.99-1.79 3.99-4V7h4V3h-6zm-1.99 16c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"}))});Be.displayName="MusicNote";var We=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm-1-9c0-.55.45-1 1-1s1 .45 1 1v6c0 .55-.45 1-1 1s-1-.45-1-1V5zm6 6c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});We.displayName="MicNone";var Pe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M15 8v8H5V8h10m1-2H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4V7c0-.55-.45-1-1-1z"}))});Pe.displayName="Videocam";var Oe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z"}))});Oe.displayName="Add";var $e=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M13 19V7.83l4.88 4.88c.39.39 1.03.39 1.42 0a.996.996 0 000-1.41l-6.59-6.59a.996.996 0 00-1.41 0l-6.6 6.58a.996.996 0 101.41 1.41L11 7.83V19c0 .55.45 1 1 1s1-.45 1-1z"}))});$e.displayName="ArrowUpward";var Xe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm4.29 12.89a.996.996 0 11-1.41 1.41L12 13.41 9.11 16.3a.996.996 0 11-1.41-1.41L10.59 12 7.71 9.11A.996.996 0 119.12 7.7L12 10.59l2.89-2.89a.996.996 0 111.41 1.41L13.41 12l2.88 2.89z"}))});Xe.displayName="Cancel";var je=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M18 6.7l-8.48 8.48-3.54-3.54a.996.996 0 10-1.41 1.41l4.24 4.24c.39.39 1.02.39 1.41 0l9.18-9.18a.999.999 0 00-.01-1.42c-.37-.38-1-.38-1.39.01z"}))});je.displayName="Check";var _e=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M18.3 5.71a.996.996 0 00-1.41 0L12 10.59 7.11 5.7A.996.996 0 105.7 7.11L10.59 12 5.7 16.89a.996.996 0 101.41 1.41L12 13.41l4.89 4.89a.996.996 0 101.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"}))});_e.displayName="Close";var Ke=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm0 4c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"}))});Ke.displayName="ErrorOutline";const _=ct.getLogger("ChatInput"),At=m("div",{target:"e15xmbo00"})({position:"relative",display:"flex",flexDirection:"column"}),Ft=m("div",{target:"e15xmbo01"})(({theme:e})=>({backgroundColor:e.colors.secondaryBg,border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.widgetBorderColor??e.colors.transparent,position:"relative",display:"flex",flexDirection:"column",alignItems:"stretch",flex:1,paddingTop:e.spacing.md,paddingBottom:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg,gap:e.spacing.sm,borderRadius:e.radii.default,boxSizing:"border-box",":focus-within":{borderColor:e.colors.primary}})),Mt=m("div",{target:"e15xmbo02"})(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing.sm})),kt=m("div",{target:"e15xmbo03"})(({theme:e,isStacked:t})=>({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",gap:e.spacing.sm,flexWrap:t?"wrap":"nowrap"})),Tt=m("div",{target:"e15xmbo04"})(({isStacked:e})=>({flex:e?"none":1,width:e?"100%":"auto",order:e?-1:0,display:"flex",alignItems:"center",minWidth:0})),Dt=m("div",{target:"e15xmbo05"})(({theme:e})=>({display:"flex",flexDirection:"row",flexShrink:0,gap:e.spacing.sm,alignItems:"center"})),Ut=m("div",{target:"e15xmbo06"})(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing.sm,alignItems:"center"})),Ht=m("div",{target:"e15xmbo07"})(({theme:e})=>({position:"absolute",top:e.spacing.twoXS,right:e.spacing.lg,color:e.colors.fadedText60,fontSize:e.fontSizes.twoSm,textAlign:"right",whiteSpace:"nowrap",pointerEvents:"auto",cursor:"text",zIndex:e.zIndices.priority,"& .stChatInputInstructions":{position:"static"}})),k=m("button",{target:"e15xmbo08"})(({theme:e,disabled:t,hasError:o,primary:p})=>{if(p)return{border:"none",backgroundColor:t?e.colors.darkenedBgMix15:e.colors.primary,borderRadius:e.radii.button,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.xs,width:e.sizes.chatInputPrimaryButtonSize,height:e.sizes.chatInputPrimaryButtonSize,color:t?e.colors.fadedText40:e.colors.white,cursor:t?"not-allowed":"pointer",transition:"background-color 200ms ease","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{boxShadow:e.shadows.focusRing},"&:hover":{backgroundColor:t?e.colors.darkenedBgMix15:e.colors.primary}};const l=()=>o?e.colors.redTextColor:t?e.colors.fadedText40:e.colors.fadedText60;return{border:"none",backgroundColor:e.colors.transparent,borderRadius:e.radii.default,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.none,color:l(),pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{boxShadow:e.shadows.focusRing},"&:hover":{color:o?e.colors.redColor:e.colors.bodyText},"&:active":{color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:e.colors.transparent,borderColor:e.colors.transparent,color:e.colors.fadedText40,cursor:"not-allowed"},"& svg":{width:e.iconSizes.lg,height:e.iconSizes.lg}}}),Lt=m("div",{target:"e15xmbo09"})(({isRecording:e})=>({display:e?"flex":"none",flex:1,alignItems:"center",minWidth:0})),Nt=m("div",{target:"e15xmbo010"})(({theme:e})=>({position:"relative",width:"100%",height:e.sizes.chatInputPrimaryButtonSize,borderRadius:e.radii.default,overflow:"hidden","& > div":{position:"absolute",inset:0}})),Ye=(e,t)=>t===b.Directory?{...e,webkitdirectory:"",multiple:!0}:e,Bt=(e,t)=>{if(!t||t.length===0)return!0;const o=e.name.toLowerCase(),p=o.lastIndexOf(".");if(p===-1||p===o.length-1)return t.some(d=>d===""||d===".");const l=o.substring(p),w=o.substring(p+1);return t.some(d=>{const v=d.toLowerCase();return v.startsWith(".")?l===v:w===v})},Wt=(e,t)=>Bt(e,t)?{isValid:!0}:{isValid:!1,errorMessage:`${e.type||"This type of"} files are not allowed.`},de=e=>{switch(e){case b.None:return"a file";case b.Single:return"a file";case b.Multiple:return"files";case b.Directory:return"a directory";default:return Fe(e),"a file"}},Pt=m("div",{target:"e1lsn30a0"})(({theme:e})=>({backgroundColor:e.colors.transparent,position:"absolute",inset:0,zIndex:e.zIndices.priority,borderRadius:e.radii.chatInput})),Ot=m("div",{target:"e1lsn30a1"})(({theme:e})=>({position:"absolute",inset:0,border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.primary,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,color:e.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:e.fontWeights.bold,pointerEvents:"none",zIndex:e.zIndices.priority})),$t=m("div",{target:"e1lsn30a2"})(({disabled:e})=>({pointerEvents:e?"none":"auto"})),Xt=m("div",{target:"e1lsn30a3"})(({theme:e})=>({lineHeight:e.lineHeights.tight})),jt=m("div",{target:"e1lsn30a4"})(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing.sm})),_t=m("div",{target:"e1lsn30a5"})({flex:"0 0 auto",maxWidth:"100%"}),Kt=m("div",{target:"e1lsn30a6"})(({theme:e,isError:t,isClickable:o})=>({position:"relative",display:"inline-flex",alignItems:"center",width:"fit-content",minWidth:"9rem",maxWidth:"100%",backgroundColor:t?e.colors.redBackgroundColor:e.colors.bgColor,padding:e.spacing.twoXS,paddingRight:e.spacing.twoXL,borderRadius:e.radii.default,gap:e.spacing.sm,cursor:o?"pointer":"default"})),Yt=m("div",{target:"e1lsn30a7"})({display:"flex",flexDirection:"column",minWidth:0}),Gt=m("div",{target:"e1lsn30a8"})(({theme:e,fileStatus:t})=>({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:e.radii.default,width:e.sizes.chatInputFileIconSize,height:e.sizes.chatInputFileIconSize,flexShrink:0,overflow:"hidden",...t==="uploaded"&&{backgroundColor:e.colors.bodyText,color:e.colors.bgColor},...t==="uploading"&&{backgroundColor:e.colors.fadedText10,color:e.colors.fadedText60},...t==="error"&&{backgroundColor:e.colors.redBackgroundColor,color:e.colors.redTextColor}})),qt=m("img",{target:"e1lsn30a9"})({width:"100%",height:"100%",objectFit:"cover"}),Jt=m("div",{target:"e1lsn30a10"})(({theme:e,fileStatus:t})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t.type==="uploading"?e.colors.fadedText60:e.colors.bodyText})),Qt=m("div",{target:"e1lsn30a11"})(({theme:e})=>({color:e.colors.fadedText60,fontSize:e.fontSizes.sm})),Zt=m("small",{target:"e1lsn30a12"})(({theme:e,isError:t})=>({position:"absolute",top:e.spacing.twoXS,right:e.spacing.twoXS,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0,"& button":{display:"flex",alignItems:"center",justifyContent:"center",width:"fit-content",height:"fit-content",minHeight:"unset",minWidth:"unset",maxHeight:"unset",maxWidth:"unset",borderRadius:"50%",backgroundColor:"transparent",color:t?e.colors.redTextColor:e.colors.fadedText60,padding:0,overflow:"hidden",boxSizing:"border-box",lineHeight:0,"&:hover":{backgroundColor:"transparent",color:t?e.colors.redColor:e.colors.bodyText}}})),er=m("span",{target:"e1lsn30a13"})({position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}),tr=({onDrop:e,multiple:t,accept:o,maxSize:p,acceptFile:l,disabled:w})=>{const{getRootProps:d,getInputProps:v}=ke({onDrop:e,multiple:t,accept:o,maxSize:p,useFsAccessApi:!1}),C=Ye(v(),l),c=d({tabIndex:-1});return A($t,{"data-testid":"stChatInputFileUploadButton",disabled:w,...c,children:[a("input",{...C}),a(pe,{content:`Upload or drag and drop ${de(l)}`,placement:ue.TOP,onMouseEnterDelay:500,children:a(k,{type:"button",disabled:w,"aria-label":`Upload ${de(l)}`,children:a(V,{content:Oe,size:"xl",color:"inherit"})})})]})},rr=r.memo(tr),or=({getRootProps:e,getInputProps:t,acceptFile:o})=>{const p=Ye(t(),o);return A(K,{children:[a(Pt,{...e(),children:a("input",{...p})}),a(Ot,{children:`Drag and drop ${de(o)} here`})]})},nr=r.memo(or),Ge=new Set(["jpg","jpeg","png","gif","webp","svg","bmp"]),ar=new Set(["pdf"]),ir=new Set(["csv","tsv","xlsx","xls"]),sr=new Set(["txt","md","json","xml","yaml","yml"]),lr=new Set(["py","js","ts","jsx","tsx","css","html","java","cpp","c","go","rs","rb","php","swift","kt","scala","sh","bash","sql"]),cr=new Set(["mp3","wav","m4a","ogg","flac","aac"]),dr=new Set(["mp4","webm","mov","avi","mkv","wmv"]),ur=new Set(["zip","tar","gz","rar","7z","bz2"]);function qe(e){const t=e.lastIndexOf(".");return t===-1||t===e.length-1?"":e.slice(t+1).toLowerCase()}function pr(e){const t=qe(e);return Ge.has(t)?Ne:ar.has(t)?De:ir.has(t)?Rt:sr.has(t)?He:lr.has(t)?Ue:cr.has(t)?Be:dr.has(t)?Pe:ur.has(t)?Le:Ct}function gr(e){const t=qe(e);return Ge.has(t)}const fr=20;function hr(e,t=fr){if(e.length<=t)return e;const o=e.lastIndexOf(".");if(!(o>0&&o<e.length-1)){const f=Math.floor((t-3)/2),g=f>0?e.slice(-f):"";return`${e.slice(0,f)}...${g}`}const l=e.slice(o),w=e.slice(0,o),d=t-l.length-3;if(d<=0){const f=Math.floor((t-3)/2),g=f>0?e.slice(-f):"";return`${e.slice(0,f)}...${g}`}const v=Math.ceil(d/2),C=Math.floor(d/2),c=C>0?w.slice(-C):"";return`${w.slice(0,v)}...${c}${l}`}function mr(e,t){const o=r.useMemo(()=>!e||!gr(t)?null:URL.createObjectURL(e),[e,t]);return r.useEffect(()=>()=>{o&&URL.revokeObjectURL(o)},[o]),o}const wr=({fileInfo:e,imagePreviewUrl:t})=>{const{type:o}=e.status;switch(o){case"uploading":return a(Me,{iconValue:"spinner",testid:"stChatInputFileIconSpinner",size:"lg"});case"error":return a(V,{content:Vt,size:"lg",testid:"stChatInputFileIconError"});case"uploaded":return t?a(qt,{src:t,alt:e.name,"data-testid":"stChatInputFileImagePreview"}):a(V,{content:pr(e.name),size:"lg"});default:return Fe(o),null}},vr=({fileInfo:e,onDelete:t,onRetry:o})=>{const p=e.status.type,l=p==="error",w=p==="uploading",d=l&&o!==void 0&&e.file!==void 0,v=r.useId(),C=mr(e.file,e.name),c=e.status.type==="error"?e.status.errorMessage:"Upload failed",f=r.useCallback(()=>{d&&o(e)},[d,o,e]),g=r.useCallback(x=>{d&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),o(e))},[d,o,e]),h=r.useCallback(x=>{x.stopPropagation(),t(e.id)},[t,e.id]),T=w?`Cancel upload of ${e.name}`:`Remove ${e.name}`,G=Ve(e.size,Y.Byte),W=`${e.name}, ${G}`,D=A(Kt,{className:"stChatInputFile","data-testid":"stChatInputFile",isError:l,isClickable:d,onClick:d?f:void 0,onKeyDown:d?g:void 0,title:d?"Click to retry upload":void 0,role:d?"button":void 0,tabIndex:d?0:void 0,"aria-label":W,"aria-invalid":l||void 0,"aria-describedby":l?v:void 0,children:[a(Gt,{fileStatus:p,children:a(wr,{fileInfo:e,imagePreviewUrl:C})}),A(Yt,{children:[a(Jt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:e.name,fileStatus:e.status,children:hr(e.name)}),a(Qt,{children:Ve(e.size,Y.Byte)})]}),a(Zt,{"data-testid":"stChatInputDeleteBtn",isError:l,children:a(dt,{onClick:h,kind:ut.MINIMAL,"aria-label":T,children:a(V,{content:Xe,size:"md"})})}),l&&A(er,{id:v,role:"alert",children:["Error: ",c]})]});return l?a(pe,{content:c,placement:ue.TOP,error:!0,children:D}):D},Cr=r.memo(vr),xr=({items:e,onDelete:t,onRetry:o})=>a(Xt,{"data-testid":"stChatUploadedFiles",children:a(jt,{children:e.map(p=>a(_t,{children:a(Cr,{fileInfo:p,onDelete:t,onRetry:o})},p.id))})}),yr=r.memo(xr),br=(e,t,o)=>{const p=[],l=[];return e.forEach(w=>{if(w.size>o){l.push({file:w,errors:[{code:ce.FileTooLarge,message:`File is too large. Maximum size is ${o} bytes.`}]});return}const d=Wt(w,t.fileType);if(!d.isValid){l.push({file:w,errors:[{code:ce.FileInvalidType,message:d.errorMessage||"File type not allowed."}]});return}p.push(w)}),{accepted:p,rejected:l}},Sr=({acceptMultipleFiles:e,maxFileSize:t,uploadClient:o,uploadFile:p,addFiles:l,getNextLocalFileId:w,deleteExistingFiles:d,onUploadComplete:v,element:C})=>(c,f)=>{if(c.length>0){const{accepted:g,rejected:h}=br(c,C,t);c=g,f=[...f,...h]}if(!e&&c.length===0&&f.length>1){const g=f.findIndex(h=>h.errors?.[0].code===ce.TooManyFiles);g>=0&&(c.push(f[g].file),f.splice(g,1))}if(!e&&c.length>0&&d(),o.fetchFileURLs(c).then(g=>{pt(g,c).forEach(([h,T])=>{p(h,T)})}).catch(g=>{l(c.map(h=>new Te(h.name,h.size,w(),{type:"error",errorMessage:g},h)))}),f.length>0){const g=f.map(h=>xt(h,w(),t));l(g)}v()},Er=({getNextLocalFileId:e,addFiles:t,updateFile:o,uploadClient:p,element:l,onUploadProgress:w,onUploadComplete:d})=>(v,C)=>{const c=C.webkitRelativePath||C.name,f=new AbortController,g=new Te(c,C.size,e(),{type:"uploading",abortController:f,progress:1},C);t([g]),p.uploadFile({formId:"",...l},v.uploadUrl,C,h=>w(h,g.id),f.signal).then(()=>d(g.id,v)).catch(h=>{h instanceof DOMException&&h.name==="AbortError"||o(g.id,g.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})};function Ir(e,t,o){return{Root:{style:{minHeight:e.sizes.chatInputTextareaMinHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0",...o}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:e.fontWeights.normal,lineHeight:e.lineHeights.inputWidget,"::placeholder":{color:e.colors.fadedText60},height:t.isExtended?t.height:"auto",maxHeight:t.maxHeight,overflowY:"auto",paddingLeft:e.spacing.none,paddingRight:e.spacing.none,paddingBottom:e.spacing.twoXS,paddingTop:e.spacing.twoXS,width:"100%"}}}}const se=(e,t,o)=>o.map(p=>p.id===e?t:p),le=(e,t)=>t.find(o=>o.id===e);function zr({disabled:e,element:t,widgetMgr:o,fragmentId:p,uploadClient:l}){const w=gt(),{placeholder:d,maxChars:v}=t,C=r.useRef(0),c=r.useRef(null),f=r.useRef(!1),g=r.useRef(null),h=r.useRef(null),{width:T,elementRef:G}=ft(),{innerWidth:W,innerHeight:D}=ht(),[x,q]=r.useState(t.default),[z,F]=r.useState([]),[U,J]=r.useState(!1),[H,ge]=r.useState(!1),[Q,L]=r.useState(null),[M,Z]=r.useState(!1),[Je,fe]=r.useState(0),ee=t.acceptAudio??!1;r.useEffect(()=>()=>{h.current&&h.current.abort()},[]);const P=Et({textareaRef:c,dependencies:[d,M]}),O=r.useRef(""),$=r.useRef(0),te=r.useRef(null),he=r.useRef(null),N=r.useCallback(n=>{const i=getComputedStyle(n);O.current=`${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;const u=parseFloat(i.paddingLeft)||0,s=parseFloat(i.paddingRight)||0;$.current=n.clientWidth-u-s},[]);r.useLayoutEffect(()=>{const n=c.current;if(!n)return;N(n);const i=new ResizeObserver(()=>N(n));return i.observe(n),()=>i.disconnect()},[N,M]),r.useEffect(()=>{if(x===""){Z(!1);return}if(M)return;const n=c.current;if(!n||(($.current<=0||!O.current)&&N(n),$.current<=0||!O.current))return;te.current||(te.current=document.createElement("canvas"),he.current=te.current.getContext("2d"));const i=he.current;i&&(i.font=O.current,i.measureText(x).width>$.current-10&&Z(!0))},[x,M,N]);const X=r.useMemo(()=>z.some(n=>n.status.type==="uploading")?!1:x!==""||z.length>0,[z,x]),I=mt(t.acceptFile),re=yt(t.maxUploadSizeMb,Y.Megabyte,Y.Byte),me=r.useCallback(n=>F(i=>[...i,...n]),[]),we=r.useCallback(n=>{n.status.type==="uploading"&&n.status.abortController.abort(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&l.deleteFile(n.status.fileUrls.deleteUrl).catch(i=>{_.error("Failed to delete file from server:",i)})},[l]),ve=r.useCallback(n=>{F(i=>{const u=le(n,i);if(ie(u))return i;we(u);const s=i.filter(y=>y.id!==n);return s.length===0&&fe(y=>y+1),s})},[we]),oe=r.useRef(null),Qe=r.useCallback(n=>{!n.file||n.status.type!=="error"||(F(i=>i.filter(u=>u.id!==n.id)),oe.current&&oe.current([n.file],[]))},[]),Ce=r.useCallback(()=>{const n=z.filter(i=>i.status.type==="uploaded").map(i=>{const{name:u,size:s,status:y}=i,{fileId:ae,fileUrls:lt}=y;return new Re({fileId:ae,fileUrls:lt,name:u,size:s})});return new wt({uploadedFileInfo:n})},[z]),xe=()=>C.current++,ne=Sr({acceptMultipleFiles:I===b.Multiple||I===b.Directory,maxFileSize:re,uploadClient:l,uploadFile:Er({getNextLocalFileId:xe,addFiles:me,updateFile:(n,i)=>{F(u=>se(n,i,u))},uploadClient:l,element:t,onUploadProgress:(n,i)=>{F(u=>{const s=le(i,u);if(ie(s)||s.status.type!=="uploading")return u;const y=Math.round(n.loaded*100/n.total);return s.status.progress===y?u:se(i,s.setStatus({type:"uploading",abortController:s.status.abortController,progress:y}),u)})},onUploadComplete:(n,i)=>{F(u=>{const s=le(n,u);return ie(s)||s.status.type!=="uploading"?u:se(s.id,s.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}),u)})}}),addFiles:me,getNextLocalFileId:xe,deleteExistingFiles:()=>z.forEach(n=>ve(n.id)),onUploadComplete:()=>{c.current&&c.current.focus()},element:t});oe.current=ne;const{getRootProps:Ze,getInputProps:et}=ke({onDrop:ne,multiple:I===b.Multiple||I===b.Directory,accept:Ae(t.fileType),maxSize:re,useFsAccessApi:!1}),j=r.useCallback(n=>{if(c.current&&c.current.focus(),!X&&!n||e)return;const i=Ce(),u={data:x,fileUploaderState:i,audioFileInfo:n};o.setChatInputValue(t,u,{fromUi:!0},p),z.length>0&&fe(s=>s+1),F([]),q(""),Z(!1),P.clearScrollHeight()},[X,e,x,z.length,Ce,o,t,p,P]),ye=r.useCallback(async n=>{const i=new Date().toISOString().replace(/[:.]/g,"-"),u=new File([n],`audio-${i}.wav`,{type:"audio/wav"});try{ge(!0);const s=await l.fetchFileURLs([u]);if(s.length===0)throw new Error("Failed to get upload URL for audio file");const y=s[0];h.current=new AbortController,await l.uploadFile({formId:"",...t},y.uploadUrl,u,()=>{},h.current.signal);const ae=new Re({fileId:y.fileId,fileUrls:y,name:u.name,size:u.size});j(ae)}catch(s){const y="Recording failed";_.error("Audio upload failed:",s),L(y),c.current&&c.current.focus()}finally{ge(!1)}},[l,t,j]),tt=r.useMemo(()=>({onApprove:ye,onPermissionDenied:()=>{const n="Microphone access denied";L(n),_.error("Permission denied:",n)},onError:n=>{L("Recording failed"),_.error("Recording error:",n)},onRecordStart:()=>{L(null)}}),[ye]),R=bt({containerRef:g,sampleRate:t.audioSampleRate??void 0,events:tt}),be=r.useCallback(()=>{j()},[j]),rt=n=>{const{metaKey:i,ctrlKey:u,shiftKey:s}=n;zt(n)&&!s&&!u&&!i&&(n.preventDefault(),be())},ot=n=>{const{value:i}=n.target;v!==0&&i.length>v||(q(i),P.updateScrollHeight(),Q&&L(null))},Se=r.useCallback(async n=>{n.preventDefault(),n.stopPropagation(),!(!ee||e||R.state==="recording")&&await R.start()},[ee,e,R]),nt=r.useCallback(()=>{R.cancel(),c.current&&c.current.focus()},[R]),Ee=r.useCallback(async()=>{const{blob:n}=await R.stop();await R.approve(n)},[R]),Ie=r.useCallback(n=>{Se(n)},[Se]),at=r.useCallback(()=>{Ee()},[Ee]),it=r.useCallback(()=>{c.current&&c.current.focus()},[]);r.useEffect(()=>{if(t.setValue&&!f.current){f.current=!0;const n=t.value||"";q(n)}},[t.setValue,t.value]),r.useEffect(()=>{f.current=!1},[t]),r.useEffect(()=>{const n=s=>{s.preventDefault(),s.stopPropagation(),!U&&s.dataTransfer?.types.includes("Files")&&J(!0)},i=s=>{s.preventDefault(),s.stopPropagation(),U&&(s.clientX<=0&&s.clientY<=0||s.clientX>=W&&s.clientY>=D)&&J(!1)},u=s=>{s.preventDefault(),s.stopPropagation(),U&&J(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",u),window.addEventListener("dragleave",i),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",u),window.removeEventListener("dragleave",i)}},[U,W,D]);const st=I!==b.None&&U,B=R.state==="recording",ze=!B&&T>vt(w.breakpoints.hideWidgetDetails)&&v>0;return a(At,{className:"stChatInput","data-testid":"stChatInput",ref:G,children:A(Ft,{children:[ze&&a(Ht,{onClick:it,id:"stChatInputInstructions",children:a(St,{dirty:X,value:x,maxLength:v,type:"chat",inForm:!1,className:"stChatInputInstructions"})}),st&&a(nr,{getRootProps:Ze,getInputProps:et,acceptFile:I}),I!==b.None&&z.length>0&&a(Mt,{children:a(yr,{items:[...z],onDelete:ve,onRetry:Qe})}),A(kt,{isStacked:M,children:[a(Dt,{children:I!==b.None&&!B&&a(rr,{onDrop:ne,multiple:I===b.Multiple||I===b.Directory,accept:Ae(t.fileType),maxSize:re,acceptFile:I,disabled:e},Je)}),a(Lt,{isRecording:B,children:a(Nt,{ref:g})}),!B&&a(Tt,{isStacked:M,children:a(It,{inputRef:c,value:x,placeholder:d,onChange:ot,onKeyDown:rt,"aria-label":d,disabled:e,rows:1,"aria-describedby":ze?"stChatInputInstructions":void 0,overrides:Ir(w,P,{width:"100%"})})}),a(Ut,{children:B?A(K,{children:[a(k,{onClick:nt,disabled:e,"data-testid":"stChatInputCancelButton","aria-label":"Cancel recording",children:a(V,{content:_e,size:"lg",color:"inherit"})}),a(k,{onClick:at,disabled:e||H,"data-testid":"stChatInputApproveButton","aria-label":"Submit recording",children:H?a(Me,{size:"lg",iconValue:"spinner"}):a(V,{content:je,size:"lg",color:"inherit"})})]}):A(K,{children:[ee&&a(K,{children:Q?a(pe,{content:Q,placement:ue.TOP,error:!0,children:a(k,{onClick:Ie,disabled:e||H,hasError:!0,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:a(V,{content:Ke,size:"xl",color:"inherit"})})}):a(k,{onClick:Ie,disabled:e||H,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:a(V,{content:We,size:"xl",color:"inherit"})})}),a(k,{onClick:be,disabled:!X||e||H,"data-testid":"stChatInputSubmitButton","aria-label":"Send message",primary:!0,children:a(V,{content:$e,size:"lg",color:"inherit"})})]})})]})]})})}const Lr=r.memo(zr);export{Lr as default};