streamlit 1.51.0__py3-none-any.whl → 1.52.1__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 (314) hide show
  1. streamlit/__init__.py +1 -0
  2. streamlit/commands/execution_control.py +89 -14
  3. streamlit/components/v1/component_arrow.py +7 -7
  4. streamlit/components/v2/__init__.py +59 -3
  5. streamlit/components/v2/bidi_component/main.py +161 -13
  6. streamlit/components/v2/bidi_component/serialization.py +13 -6
  7. streamlit/components/v2/component_manager.py +11 -3
  8. streamlit/components/v2/component_registry.py +18 -1
  9. streamlit/components/v2/types.py +2 -2
  10. streamlit/connections/snowflake_connection.py +1 -1
  11. streamlit/connections/snowpark_connection.py +1 -1
  12. streamlit/dataframe_util.py +18 -18
  13. streamlit/delta_generator.py +7 -0
  14. streamlit/delta_generator_singletons.py +8 -14
  15. streamlit/elements/alert.py +16 -0
  16. streamlit/elements/arrow.py +36 -6
  17. streamlit/elements/bokeh_chart.py +10 -78
  18. streamlit/elements/code.py +2 -2
  19. streamlit/elements/deck_gl_json_chart.py +1 -1
  20. streamlit/elements/exception.py +1 -1
  21. streamlit/elements/form.py +27 -0
  22. streamlit/elements/heading.py +60 -5
  23. streamlit/elements/html.py +13 -2
  24. streamlit/elements/image.py +1 -1
  25. streamlit/elements/layouts.py +28 -22
  26. streamlit/elements/lib/built_in_chart_utils.py +49 -16
  27. streamlit/elements/lib/color_util.py +1 -1
  28. streamlit/elements/lib/column_config_utils.py +6 -5
  29. streamlit/elements/lib/layout_utils.py +50 -0
  30. streamlit/elements/lib/pandas_styler_utils.py +17 -9
  31. streamlit/elements/lib/shortcut_utils.py +152 -0
  32. streamlit/elements/markdown.py +50 -3
  33. streamlit/elements/metric.py +31 -1
  34. streamlit/elements/plotly_chart.py +75 -6
  35. streamlit/elements/spinner.py +1 -1
  36. streamlit/elements/text.py +20 -3
  37. streamlit/elements/toast.py +2 -0
  38. streamlit/elements/vega_charts.py +17 -1
  39. streamlit/elements/widgets/audio_input.py +8 -7
  40. streamlit/elements/widgets/button.py +279 -40
  41. streamlit/elements/widgets/button_group.py +27 -2
  42. streamlit/elements/widgets/camera_input.py +1 -1
  43. streamlit/elements/widgets/chat.py +300 -42
  44. streamlit/elements/widgets/color_picker.py +7 -0
  45. streamlit/elements/widgets/data_editor.py +68 -28
  46. streamlit/elements/widgets/file_uploader.py +4 -1
  47. streamlit/elements/widgets/number_input.py +2 -0
  48. streamlit/elements/widgets/text_widgets.py +2 -0
  49. streamlit/elements/widgets/time_widgets.py +581 -9
  50. streamlit/errors.py +22 -0
  51. streamlit/git_util.py +1 -1
  52. streamlit/navigation/page.py +7 -0
  53. streamlit/net_util.py +2 -2
  54. streamlit/proto/Alert_pb2.pyi +3 -3
  55. streamlit/proto/AppPage_pb2.pyi +7 -1
  56. streamlit/proto/ArrowData_pb2.pyi +7 -1
  57. streamlit/proto/ArrowNamedDataSet_pb2.pyi +7 -1
  58. streamlit/proto/ArrowVegaLiteChart_pb2.pyi +7 -1
  59. streamlit/proto/Arrow_pb2.py +10 -10
  60. streamlit/proto/Arrow_pb2.pyi +19 -12
  61. streamlit/proto/AudioInput_pb2.pyi +7 -1
  62. streamlit/proto/Audio_pb2.pyi +7 -1
  63. streamlit/proto/AuthRedirect_pb2.pyi +7 -1
  64. streamlit/proto/AutoRerun_pb2.pyi +7 -1
  65. streamlit/proto/BackMsg_pb2.py +4 -2
  66. streamlit/proto/BackMsg_pb2.pyi +34 -4
  67. streamlit/proto/Balloons_pb2.pyi +7 -1
  68. streamlit/proto/BidiComponent_pb2.pyi +10 -4
  69. streamlit/proto/Block_pb2.pyi +35 -35
  70. streamlit/proto/BokehChart_pb2.pyi +7 -1
  71. streamlit/proto/ButtonGroup_pb2.pyi +9 -9
  72. streamlit/proto/Button_pb2.py +2 -2
  73. streamlit/proto/Button_pb2.pyi +11 -2
  74. streamlit/proto/CameraInput_pb2.pyi +7 -1
  75. streamlit/proto/ChatInput_pb2.py +6 -6
  76. streamlit/proto/ChatInput_pb2.pyi +18 -6
  77. streamlit/proto/Checkbox_pb2.pyi +3 -3
  78. streamlit/proto/ClientState_pb2.pyi +10 -4
  79. streamlit/proto/Code_pb2.pyi +7 -1
  80. streamlit/proto/ColorPicker_pb2.pyi +7 -1
  81. streamlit/proto/Common_pb2.py +3 -3
  82. streamlit/proto/Common_pb2.pyi +35 -23
  83. streamlit/proto/Components_pb2.pyi +19 -13
  84. streamlit/proto/DataFrame_pb2.pyi +55 -49
  85. streamlit/proto/DateInput_pb2.pyi +7 -1
  86. streamlit/proto/DateTimeInput_pb2.py +28 -0
  87. streamlit/proto/DateTimeInput_pb2.pyi +92 -0
  88. streamlit/proto/DeckGlJsonChart_pb2.pyi +3 -3
  89. streamlit/proto/Delta_pb2.pyi +7 -1
  90. streamlit/proto/DocString_pb2.pyi +10 -4
  91. streamlit/proto/DownloadButton_pb2.py +2 -2
  92. streamlit/proto/DownloadButton_pb2.pyi +16 -2
  93. streamlit/proto/Element_pb2.py +5 -3
  94. streamlit/proto/Element_pb2.pyi +23 -5
  95. streamlit/proto/Empty_pb2.pyi +7 -1
  96. streamlit/proto/Exception_pb2.pyi +7 -1
  97. streamlit/proto/Favicon_pb2.pyi +7 -1
  98. streamlit/proto/FileUploader_pb2.pyi +7 -1
  99. streamlit/proto/ForwardMsg_pb2.py +12 -10
  100. streamlit/proto/ForwardMsg_pb2.pyi +42 -15
  101. streamlit/proto/GapSize_pb2.pyi +4 -4
  102. streamlit/proto/GitInfo_pb2.pyi +3 -3
  103. streamlit/proto/GraphVizChart_pb2.pyi +7 -1
  104. streamlit/proto/Heading_pb2.pyi +7 -1
  105. streamlit/proto/HeightConfig_pb2.pyi +7 -1
  106. streamlit/proto/Html_pb2.py +2 -2
  107. streamlit/proto/Html_pb2.pyi +11 -2
  108. streamlit/proto/IFrame_pb2.pyi +7 -1
  109. streamlit/proto/Image_pb2.pyi +10 -4
  110. streamlit/proto/Json_pb2.pyi +7 -1
  111. streamlit/proto/LabelVisibilityMessage_pb2.pyi +3 -3
  112. streamlit/proto/LinkButton_pb2.py +2 -2
  113. streamlit/proto/LinkButton_pb2.pyi +15 -2
  114. streamlit/proto/Logo_pb2.pyi +7 -1
  115. streamlit/proto/Markdown_pb2.pyi +3 -3
  116. streamlit/proto/Metric_pb2.pyi +7 -7
  117. streamlit/proto/MetricsEvent_pb2.pyi +10 -4
  118. streamlit/proto/MultiSelect_pb2.pyi +7 -1
  119. streamlit/proto/NamedDataSet_pb2.pyi +7 -1
  120. streamlit/proto/Navigation_pb2.pyi +3 -3
  121. streamlit/proto/NewSession_pb2.pyi +40 -40
  122. streamlit/proto/NumberInput_pb2.pyi +3 -3
  123. streamlit/proto/PageConfig_pb2.pyi +7 -7
  124. streamlit/proto/PageInfo_pb2.pyi +7 -1
  125. streamlit/proto/PageLink_pb2.py +2 -2
  126. streamlit/proto/PageLink_pb2.pyi +11 -2
  127. streamlit/proto/PageNotFound_pb2.pyi +7 -1
  128. streamlit/proto/PageProfile_pb2.pyi +13 -7
  129. streamlit/proto/PagesChanged_pb2.pyi +7 -1
  130. streamlit/proto/ParentMessage_pb2.pyi +7 -1
  131. streamlit/proto/PlotlyChart_pb2.pyi +6 -6
  132. streamlit/proto/Progress_pb2.pyi +7 -1
  133. streamlit/proto/Radio_pb2.pyi +7 -1
  134. streamlit/proto/RootContainer_pb2.pyi +1 -1
  135. streamlit/proto/Selectbox_pb2.pyi +7 -1
  136. streamlit/proto/SessionEvent_pb2.pyi +7 -1
  137. streamlit/proto/SessionStatus_pb2.pyi +7 -1
  138. streamlit/proto/Skeleton_pb2.pyi +3 -3
  139. streamlit/proto/Slider_pb2.pyi +5 -5
  140. streamlit/proto/Snow_pb2.pyi +7 -1
  141. streamlit/proto/Space_pb2.pyi +7 -1
  142. streamlit/proto/Spinner_pb2.pyi +7 -1
  143. streamlit/proto/TextAlignmentConfig_pb2.py +29 -0
  144. streamlit/proto/TextAlignmentConfig_pb2.pyi +68 -0
  145. streamlit/proto/TextArea_pb2.pyi +7 -1
  146. streamlit/proto/TextInput_pb2.pyi +3 -3
  147. streamlit/proto/Text_pb2.pyi +7 -1
  148. streamlit/proto/TimeInput_pb2.pyi +7 -1
  149. streamlit/proto/Toast_pb2.pyi +7 -1
  150. streamlit/proto/VegaLiteChart_pb2.pyi +7 -1
  151. streamlit/proto/Video_pb2.pyi +6 -6
  152. streamlit/proto/WidgetStates_pb2.pyi +10 -4
  153. streamlit/proto/WidthConfig_pb2.pyi +7 -1
  154. streamlit/proto/openmetrics_data_model_pb2.pyi +52 -52
  155. streamlit/runtime/app_session.py +38 -1
  156. streamlit/runtime/caching/cache_data_api.py +1 -1
  157. streamlit/runtime/caching/cache_resource_api.py +2 -2
  158. streamlit/runtime/caching/cache_utils.py +1 -1
  159. streamlit/runtime/caching/hashing.py +1 -1
  160. streamlit/runtime/download_data_util.py +53 -0
  161. streamlit/runtime/forward_msg_queue.py +1 -0
  162. streamlit/runtime/media_file_manager.py +178 -2
  163. streamlit/runtime/metrics_util.py +87 -3
  164. streamlit/runtime/scriptrunner/script_runner.py +3 -1
  165. streamlit/runtime/state/query_params.py +80 -29
  166. streamlit/runtime/state/session_state.py +2 -2
  167. streamlit/static/index.html +1 -1
  168. streamlit/static/manifest.json +530 -229
  169. streamlit/static/static/js/{ErrorOutline.esm.YoJdlW1p.js → ErrorOutline.esm.sMJdFExW.js} +1 -1
  170. streamlit/static/static/js/{FileDownload.esm.Ddx8VEYy.js → FileDownload.esm.CV-WYqBn.js} +1 -1
  171. streamlit/static/static/js/{FileHelper.90EtOmj9.js → FileHelper.5nCh9KDY.js} +3 -3
  172. streamlit/static/static/js/{FormClearHelper.BB1Km6eP.js → FormClearHelper.-9RbsnV0.js} +1 -1
  173. streamlit/static/static/js/IFrameUtil.DefezniK.js +1 -0
  174. streamlit/static/static/js/InputInstructions.2R3tBtW9.js +1 -0
  175. streamlit/static/static/js/Particles.DDHoXFxh.js +1 -0
  176. streamlit/static/static/js/{ProgressBar.DLY8H6nE.js → ProgressBar.BxmfHxKu.js} +2 -2
  177. streamlit/static/static/js/StreamlitSyntaxHighlighter.BFWV0oqR.js +20 -0
  178. streamlit/static/static/js/{Toolbar.D8nHCkuz.js → Toolbar.DMgU0Vgw.js} +1 -1
  179. streamlit/static/static/js/_arrayIncludes.B19Iyn2B.js +1 -0
  180. streamlit/static/static/js/_baseIndexOf.BTknn6Gb.js +1 -0
  181. streamlit/static/static/js/{base-input.CJGiNqed.js → base-input.BXTqYbyG.js} +4 -4
  182. streamlit/static/static/js/{checkbox.Cpdd482O.js → checkbox.5xWaqPqm.js} +1 -1
  183. streamlit/static/static/js/{createSuper.CuQIogbW.js → createSuper.OIgV8wc-.js} +1 -1
  184. streamlit/static/static/js/data-grid-overlay-editor.B4RIu9cw.js +1 -0
  185. streamlit/static/static/js/{downloader.CN0K7xlu.js → downloader.DwCJck8O.js} +1 -1
  186. streamlit/static/static/js/embed.HKcgTiLB.js +195 -0
  187. streamlit/static/static/js/{es6.BJcsVXQ0.js → es6.4AP97RGk.js} +2 -2
  188. streamlit/static/static/js/{iframeResizer.contentWindow.XzUvQqcZ.js → iframeResizer.contentWindow.BZAsvL9q.js} +1 -1
  189. streamlit/static/static/js/index.-3selq_5.js +2 -0
  190. streamlit/static/static/js/index.1ylynMAS.js +7 -0
  191. streamlit/static/static/js/{index.CxIUUfab.js → index.6UunrySF.js} +53 -122
  192. streamlit/static/static/js/index.8HslT92O.js +14 -0
  193. streamlit/static/static/js/index.B0TPxAZ1.js +1 -0
  194. streamlit/static/static/js/index.B0yp3bM1.js +6 -0
  195. streamlit/static/static/js/index.BHWBaOWH.js +1 -0
  196. streamlit/static/static/js/index.BJas6XzW.js +1 -0
  197. streamlit/static/static/js/index.BKIlG7Ng.js +3 -0
  198. streamlit/static/static/js/index.BMU6zZRk.js +1 -0
  199. streamlit/static/static/js/index.BNMLO-0p.js +2 -0
  200. streamlit/static/static/js/index.BPmBNTel.js +1 -0
  201. streamlit/static/static/js/index.BVuohWM1.js +1 -0
  202. streamlit/static/static/js/index.B_AvdOKC.js +1 -0
  203. streamlit/static/static/js/index.BjQIH-3U.js +1 -0
  204. streamlit/static/static/js/index.BrqtKtSu.js +2 -0
  205. streamlit/static/static/js/index.Buc7XrOl.js +188 -0
  206. streamlit/static/static/js/index.CIC9pLsG.js +2 -0
  207. streamlit/static/static/js/index.CP2YZ73v.js +1 -0
  208. streamlit/static/static/js/index.CSbah0y4.js +27 -0
  209. streamlit/static/static/js/index.CbiYVMT1.js +1 -0
  210. streamlit/static/static/js/index.CbxllBj8.js +1 -0
  211. streamlit/static/static/js/index.Cd1D2eGF.js +263 -0
  212. streamlit/static/static/js/index.Ckcqwai8.js +2 -0
  213. streamlit/static/static/js/index.CqTPbV5Y.js +151 -0
  214. streamlit/static/static/js/index.CxXo5UKy.js +1 -0
  215. streamlit/static/static/js/index.CxbL5FgL.js +1 -0
  216. streamlit/static/static/js/index.D52dMvK5.js +1 -0
  217. streamlit/static/static/js/index.DBUdji-9.js +3 -0
  218. streamlit/static/static/js/index.DMU3coc2.js +1 -0
  219. streamlit/static/static/js/index.DN4sfQLP.js +1 -0
  220. streamlit/static/static/js/{index.DPUXkcQL.js → index.DRDE9rnx.js} +1 -1
  221. streamlit/static/static/js/{index.B_dWA3vd.js → index.DY9Ac89e.js} +2 -2
  222. streamlit/static/static/js/index.DYKCsDvl.js +1 -0
  223. streamlit/static/static/js/index.Da9gznCC.js +1 -0
  224. streamlit/static/static/js/index.DfIRibXG.js +1 -0
  225. streamlit/static/static/js/{index.D3GPA5k4.js → index.Dg5zbEp2.js} +9 -40
  226. streamlit/static/static/js/index.Di9I2cid.js +1 -0
  227. streamlit/static/static/js/index.DkpEv0uV.js +1 -0
  228. streamlit/static/static/js/index.DwJ9Vhsl.js +1 -0
  229. streamlit/static/static/js/index.L7erTnMm.js +1 -0
  230. streamlit/static/static/js/{index.DOFlg3dS.js → index.NaDyAN1s.js} +1 -1
  231. streamlit/static/static/js/index.RNTPpVde.js +1 -0
  232. streamlit/static/static/js/index.VFDFuf_7.js +1 -0
  233. streamlit/static/static/js/index.W-bl3NDo.js +1 -0
  234. streamlit/static/static/js/index.XYozEjwK.js +1 -0
  235. streamlit/static/static/js/index.oyLQ4pue.js +1 -0
  236. streamlit/static/static/js/index.q4fLUQtC.js +11 -0
  237. streamlit/static/static/js/index.q9puCQgK.js +2 -0
  238. streamlit/static/static/js/index.xZBTXGNC.js +1 -0
  239. streamlit/static/static/js/{input.D4MN_FzN.js → input.CcvrgErO.js} +2 -2
  240. streamlit/static/static/js/main.eVHOp4Th.js +13 -0
  241. streamlit/static/static/js/{memory.DrZjtdGT.js → memory.Ck_sLv5Y.js} +1 -1
  242. streamlit/static/static/js/moment.C3j7ZXd7.js +4 -0
  243. streamlit/static/static/js/number-overlay-editor.DgcLMWOy.js +9 -0
  244. streamlit/static/static/js/pandasStylerUtils.DqP0h70z.js +1 -0
  245. streamlit/static/static/js/{possibleConstructorReturn.exeeJQEP.js → possibleConstructorReturn.C_51n46K.js} +1 -1
  246. streamlit/static/static/js/{sandbox.ClO3IuUr.js → sandbox.Q-g3QIZJ.js} +1 -1
  247. streamlit/static/static/js/styled-components.e0V96rJw.js +1 -0
  248. streamlit/static/static/js/threshold.Q1mXg5rX.js +1 -0
  249. streamlit/static/static/js/throttle.D3b5WILl.js +1 -0
  250. streamlit/static/static/js/{timepicker.DAhu-vcF.js → timepicker.Bpn70xGc.js} +1 -1
  251. streamlit/static/static/js/timer.C2hYhUse.js +1 -0
  252. streamlit/static/static/js/{toConsumableArray.DNbljYEC.js → toConsumableArray.DIN_ys1J.js} +1 -1
  253. streamlit/static/static/js/uniqueId.B27POWT6.js +1 -0
  254. streamlit/static/static/js/urls.BwSlolu9.js +1 -0
  255. streamlit/static/static/js/{useBasicWidgetState.D6sOH6oI.js → useBasicWidgetState.DA3_qaXD.js} +1 -1
  256. streamlit/static/static/js/useIntlLocale.BSq6SANa.js +12 -0
  257. streamlit/static/static/js/{useTextInputAutoExpand.4u3_GcuN.js → useTextInputAutoExpand.ytEW5QmA.js} +1 -1
  258. streamlit/static/static/js/useUpdateUiValue.DOxWBNiI.js +1 -0
  259. streamlit/static/static/js/useWaveformController.BCmk6WLk.js +1 -0
  260. streamlit/static/static/js/value.B4vHRSi7.js +1 -0
  261. streamlit/static/static/js/withCalculatedWidth.ChdrMItN.js +1 -0
  262. streamlit/static/static/js/withFullScreenWrapper.7j_lzlaF.js +1 -0
  263. streamlit/string_util.py +8 -1
  264. streamlit/testing/v1/app_test.py +15 -0
  265. streamlit/testing/v1/element_tree.py +62 -0
  266. streamlit/web/bootstrap.py +24 -0
  267. streamlit/web/server/oauth_authlib_routes.py +5 -2
  268. streamlit/web/server/upload_file_request_handler.py +16 -0
  269. {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/METADATA +9 -5
  270. {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/RECORD +274 -239
  271. streamlit/static/static/js/InputInstructions.jhH15PqV.js +0 -1
  272. streamlit/static/static/js/Particles.DUsputn1.js +0 -1
  273. streamlit/static/static/js/data-grid-overlay-editor.2Ufgxc6y.js +0 -1
  274. streamlit/static/static/js/index.B1ZQh4P1.js +0 -1
  275. streamlit/static/static/js/index.BKstZk0M.js +0 -27
  276. streamlit/static/static/js/index.BMcFsUee.js +0 -1
  277. streamlit/static/static/js/index.BR-IdcTb.js +0 -2
  278. streamlit/static/static/js/index.BgnZEMVh.js +0 -1
  279. streamlit/static/static/js/index.BohqXifI.js +0 -1
  280. streamlit/static/static/js/index.Br5nxKNj.js +0 -2
  281. streamlit/static/static/js/index.BrIKVbNc.js +0 -3
  282. streamlit/static/static/js/index.BtWUPzle.js +0 -1
  283. streamlit/static/static/js/index.C0RLraek.js +0 -1
  284. streamlit/static/static/js/index.CAIjskgG.js +0 -1
  285. streamlit/static/static/js/index.CAj-7vWz.js +0 -949
  286. streamlit/static/static/js/index.CMtEit2O.js +0 -1
  287. streamlit/static/static/js/index.CkRlykEE.js +0 -12
  288. streamlit/static/static/js/index.CmN3FXfI.js +0 -1617
  289. streamlit/static/static/js/index.CwbFI1_-.js +0 -1
  290. streamlit/static/static/js/index.D2KPNy7e.js +0 -1
  291. streamlit/static/static/js/index.DGAh7DMq.js +0 -1
  292. streamlit/static/static/js/index.DKb_NvmG.js +0 -197
  293. streamlit/static/static/js/index.DMqgUYKq.js +0 -1
  294. streamlit/static/static/js/index.DX1xY89g.js +0 -1
  295. streamlit/static/static/js/index.DYATBCsq.js +0 -2
  296. streamlit/static/static/js/index.DaSmGJ76.js +0 -3
  297. streamlit/static/static/js/index.Dd7bMeLP.js +0 -1
  298. streamlit/static/static/js/index.DjmmgI5U.js +0 -1
  299. streamlit/static/static/js/index.Dq56CyM2.js +0 -1
  300. streamlit/static/static/js/index.DuiXaS5_.js +0 -7
  301. streamlit/static/static/js/index.DvFidMLe.js +0 -2
  302. streamlit/static/static/js/index.DwkhC5Pc.js +0 -1
  303. streamlit/static/static/js/index.Q-3sFn1v.js +0 -1
  304. streamlit/static/static/js/index.QJ5QO9sJ.js +0 -1
  305. streamlit/static/static/js/index.VwTaeety.js +0 -1
  306. streamlit/static/static/js/index.YOqQbeX8.js +0 -1
  307. streamlit/static/static/js/number-overlay-editor.DRwAw1In.js +0 -9
  308. streamlit/static/static/js/uniqueId.oG4Gvj1v.js +0 -1
  309. streamlit/static/static/js/useUpdateUiValue.F2R3eTeR.js +0 -1
  310. streamlit/static/static/js/withFullScreenWrapper.zothJIsI.js +0 -1
  311. {streamlit-1.51.0.data → streamlit-1.52.1.data}/scripts/streamlit.cmd +0 -0
  312. {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/WHEEL +0 -0
  313. {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/entry_points.txt +0 -0
  314. {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
1
+ import{x as a,r as t,n as i,j as d,e}from"./index.CqTPbV5Y.js";import{D as c,a as l}from"./IFrameUtil.DefezniK.js";const m=a("iframe",{target:"evfee5y0"})(({theme:o,disableScrolling:r})=>({width:"100%",height:"100%",colorScheme:"normal",border:"none",padding:o.spacing.none,margin:o.spacing.none,overflow:r?"hidden":void 0}));function n(o){return e(o)||o===""?void 0:o}function f({element:o}){const r=n(o.src),s=i(r)?void 0:n(o.srcdoc);return d(m,{className:"stIFrame","data-testid":"stIFrame",allow:l,disableScrolling:!o.scrolling,src:r,srcDoc:s,scrolling:o.scrolling?"auto":"no",sandbox:c,title:"st.iframe",tabIndex:o.tabIndex??void 0})}const F=t.memo(f);export{F as default};
@@ -0,0 +1 @@
1
+ import{r,E as q,_ as M,x as E,b7 as T,e as h,n as Q,Q as de,g as pe,f as fe,aa as me,aI as _,l as W,j as u,m as be,ab as ge,T as he,P as ye,ac as Ie,ad as Te,Z as Ce,ax as X}from"./index.CqTPbV5Y.js";import{I as we}from"./InputInstructions.2R3tBtW9.js";import{u as Se}from"./FormClearHelper.-9RbsnV0.js";import{s as ve}from"./sprintf.D7DtBTRn.js";import{u as Ve}from"./uniqueId.B27POWT6.js";import{I as xe}from"./input.CcvrgErO.js";import"./base-input.BXTqYbyG.js";var Z=r.forwardRef(function(e,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(q,M({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),r.createElement("path",{d:"M0 3v2h8V3H0z"}))});Z.displayName="Minus";var J=r.forwardRef(function(e,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(q,M({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),r.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});J.displayName="Plus";const ke=E("div",{target:"eaba2yi0"})(({theme:e})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:e.sizes.minElementHeight,borderWidth:e.sizes.borderWidth,borderStyle:"solid",borderColor:e.colors.widgetBorderColor??e.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:e.radii.default,overflow:"hidden","&.focused":{borderColor:e.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:e.spacing.none}}})),De=E("div",{target:"eaba2yi1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),G=E("button",{target:"eaba2yi2"})(({theme:e})=>({margin:e.spacing.none,border:"none",height:e.sizes.full,display:"flex",alignItems:"center",width:e.sizes.numberInputControlsWidth,justifyContent:"center",color:e.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:e.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:e.colors.white,backgroundColor:e.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:disabled":{cursor:"not-allowed",color:e.colors.fadedText40}})),Ee=E("div",{target:"eaba2yi3"})(({theme:e,clearable:t})=>({position:"absolute",marginRight:e.spacing.twoXS,left:0,right:`calc(${e.sizes.numberInputControlsWidth} * 2 + ${t?"1em":"0em"})`})),Re=de.getLogger("NumberInput");function Ne(e){return h(e)||e===""?void 0:e}const D=({value:e,format:t,step:a,dataType:m})=>{if(h(e))return null;let o=Ne(t);if(h(o)&&Q(a)){const i=a.toString();m===T.DataType.FLOAT&&a!==0&&i.includes(".")&&(o=`%0.${i.split(".")[1].length}f`)}if(h(o))return e.toString();try{return ve.sprintf(o,e)}catch(i){return Re.warn(`Error in sprintf(${o}, ${e}): ${i}`),String(e)}},Fe=(e,t,a)=>h(e)?!1:e-t>=a,ze=(e,t,a)=>h(e)?!1:e+t<=a,We=e=>(e.element.dataType===T.DataType.INT?e.widgetMgr.getIntValue(e.element):e.widgetMgr.getDoubleValue(e.element))??e.element.default??null,K=({step:e,dataType:t})=>e||(t===T.DataType.INT?1:.01),Le=({disabled:e,element:t,widgetMgr:a,fragmentId:m})=>{const o=pe(),{dataType:i,id:v,formId:f,default:L,format:b,icon:R,min:y,max:I}=t,{width:B,elementRef:Y}=fe(),[s,ee]=r.useState(()=>K(t)),P=We({element:t,widgetMgr:a}),[g,C]=r.useState(!1),[l,w]=r.useState(P),[U,H]=r.useState(!1),V=r.useRef(null),A=r.useRef(Ve("number_input_")),[$,S]=r.useState(()=>D({value:P,dataType:i,format:b,step:s})),x=Fe(l,s,y),k=ze(l,s,I),O=me({formId:f}),te=O?a.allowFormEnterToSubmit(f):g,oe=U&&B>o.breakpoints.hideWidgetDetails;r.useEffect(()=>{ee(K({step:t.step,dataType:t.dataType}))},[t.dataType,t.step]),r.useEffect(()=>{g||S(D({value:l,dataType:i,format:b,step:s}))},[i,b,s]);const d=r.useCallback(({value:n,source:c})=>{if(Q(n)&&(y>n||n>I))V.current?.reportValidity();else{const p=n??L??null;switch(i){case T.DataType.INT:a.setIntValue({id:v,formId:f},p,c,m);break;case T.DataType.FLOAT:a.setDoubleValue({id:v,formId:f},p,c,m);break;default:throw new Error("Invalid data type")}C(!1),w(p),S(D({value:p,dataType:i,format:b,step:s}))}},[y,I,V,a,m,s,i,v,f,L,b]),re=r.useCallback(()=>{g&&d({value:l,source:{fromUi:!0}}),H(!1)},[g,l,d]),ne=r.useCallback(()=>{H(!0)},[]),j=r.useCallback(()=>{const{value:n}=t;t.setValue=!1,w(n??null),S(D({value:n??null,dataType:i,format:b,step:s})),d({value:n??null,source:{fromUi:!1}})},[t,s,d,i,b]);r.useEffect(()=>{t.setValue?j():d({value:l,source:{fromUi:!1}});const n=V.current;if(n){const c=p=>{p.preventDefault()};return n.addEventListener("wheel",c),()=>{n.removeEventListener("wheel",c)}}},[]),t.setValue&&j();const N=h(t.default)&&!e,ae=r.useCallback(()=>{const n=t.default??null;w(n),d({value:n,source:{fromUi:!0}})},[t]);Se({element:t,widgetMgr:a,onFormCleared:ae});const se=n=>{const{value:c}=n.target;if(c==="")C(!0),w(null),S(null);else{let p;t.dataType===T.DataType.INT?p=parseInt(c,10):p=parseFloat(c),C(!0),w(p),S(c)}},F=r.useCallback(()=>{k&&(C(!0),d({value:(l??y)+s,source:{fromUi:!0}}))},[l,y,s,k]),z=r.useCallback(()=>{x&&(C(!0),d({value:(l??I)-s,source:{fromUi:!0}}))},[l,I,s,x]),ie=r.useCallback(n=>{const{key:c}=n;switch(c){case"ArrowUp":n.preventDefault(),F();break;case"ArrowDown":n.preventDefault(),z();break}},[F,z]),le=r.useCallback(n=>{n.key==="Enter"&&(g&&d({value:l,source:{fromUi:!0}}),a.allowFormEnterToSubmit(f)&&a.submitForm(f,m))},[g,l,d,a,f,m]),ce=_(o.iconSizes.lg)+2*_(o.spacing.twoXS),ue=R?o.breakpoints.hideNumberInputControls+ce:o.breakpoints.hideNumberInputControls;return W("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:Y,children:[u(Ie,{label:t.label,disabled:e,labelVisibility:be(t.labelVisibility?.value),htmlFor:A.current,children:t.help&&u(ge,{children:u(he,{content:t.help,placement:ye.TOP_RIGHT})})}),W(ke,{className:U?"focused":"","data-testid":"stNumberInputContainer",children:[u(xe,{type:"number",inputRef:V,value:$??"",placeholder:t.placeholder,onBlur:re,onFocus:ne,onChange:se,onKeyPress:le,onKeyDown:ie,clearable:N,clearOnEscape:N,disabled:e,"aria-label":t.label,startEnhancer:t.icon&&u(Ce,{"data-testid":"stNumberInputIcon",iconValue:t.icon,size:"lg"}),id:A.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.grayTextColor,padding:o.spacing.threeXS,height:o.sizes.clearIconSize,width:o.sizes.clearIconSize,":hover":{fill:o.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:y,max:I,type:"number",inputMode:""},style:{fontWeight:o.fontWeights.normal,lineHeight:o.lineHeights.inputWidget,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm,"::placeholder":{color:o.colors.fadedText60}}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0,paddingLeft:R?o.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:o.iconSizes.lg,color:Te(R)?o.colors.fadedText60:"inherit"}}}}),B>ue&&W(De,{children:[u(G,{"data-testid":"stNumberInputStepDown",onClick:z,disabled:!x||e,tabIndex:-1,children:u(X,{content:Z,size:"xs",color:x?"inherit":o.colors.fadedText40})}),u(G,{"data-testid":"stNumberInputStepUp",onClick:F,disabled:!k||e,tabIndex:-1,children:u(X,{content:J,size:"xs",color:k?"inherit":o.colors.fadedText40})})]})]}),oe&&u(Ee,{clearable:N,children:u(we,{dirty:g,value:$??"",inForm:O,allowEnterToSubmit:te})})]})},je=r.memo(Le);export{je as default};
@@ -0,0 +1 @@
1
+ import{r as o,E as T,_ as V,Q as $e,cj as v,ck as me,x as g,l as F,j as a,P as Q,b as ye,B as Ce,ax as z,T as We,a0 as H,g as Z,ay as we,Z as ve,bU as Ne,k as Pe,f as Oe,b1 as qe,cl as Ke,e as j,bM as he,bN as Xe}from"./index.CqTPbV5Y.js";import{g as je,C as Ge,I as Ye,F as _,E as xe,b as _e,s as Qe,u as Ze,a as Je}from"./FileHelper.5nCh9KDY.js";import{u as et}from"./useWaveformController.BCmk6WLk.js";import{I as tt}from"./InputInstructions.2R3tBtW9.js";import{u as ot,T as rt}from"./useTextInputAutoExpand.ytEW5QmA.js";import{i as nt}from"./inputUtils.CptNuJwn.js";import{E as at}from"./ErrorOutline.esm.sMJdFExW.js";import{U as be}from"./UploadFileInfo.C-jY39rj.js";import"./base-input.BXTqYbyG.js";var Ie=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(T,V({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),o.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});Ie.displayName="AttachFile";var Ee=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(T,V({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),o.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"}))});Ee.displayName="Check";var ze=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(T,V({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),o.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"}))});ze.displayName="Close";var Se=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(T,V({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("rect",{width:24,height:24,fill:"none"}),o.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"}))});Se.displayName="ErrorOutline";var Fe=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(T,V({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("rect",{width:24,height:24,fill:"none"}),o.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 3z"}),o.createElement("path",{d:"M17.91 11c-.49 0-.9.36-.98.85C16.52 14.21 14.47 16 12 16s-4.52-1.79-4.93-4.15a.998.998 0 00-.98-.85c-.61 0-1.09.54-1 1.14.49 3 2.89 5.34 5.91 5.78V20c0 .55.45 1 1 1s1-.45 1-1v-2.08c3.02-.44 5.42-2.78 5.91-5.78.1-.6-.39-1.14-1-1.14z"}))});Fe.displayName="Mic";var Ue=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(T,V({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("rect",{width:24,height:24,fill:"none"}),o.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});Ue.displayName="Send";const N=$e.getLogger("ChatInput"),Re=(e,t)=>t===v.Directory?{...e,webkitdirectory:"",multiple:!0}:e,it=(e,t)=>{if(!t||t.length===0)return!0;const n=e.name.toLowerCase(),l=n.lastIndexOf(".");if(l===-1||l===n.length-1)return t.some(m=>m===""||m===".");const u=n.substring(l),c=n.substring(l+1);return t.some(m=>{const C=m.toLowerCase();return C.startsWith(".")?u===C:c===C})},st=(e,t)=>it(e,t)?{isValid:!0}:{isValid:!1,errorMessage:`${e.type||"This type of"} files are not allowed.`},De=e=>{switch(e){case v.None:return"a file";case v.Single:return"a file";case v.Multiple:return"files";case v.Directory:return"a directory";default:return me(e),"a file"}},lt=g("div",{target:"e15560op0"})(({theme:e,height:t})=>({backgroundColor:e.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${e.sizes.emptyDropdownHeight}, ${t})`,width:"100%",zIndex:e.zIndices.priority})),ct=g("div",{target:"e15560op1"})(({theme:e,height:t})=>({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",height:t,width:"100%",fontWeight:e.fontWeights.bold})),dt=g("div",{target:"e15560op2"})(({theme:e,disabled:t})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${e.sizes.borderWidth}`,cursor:t?"not-allowed":"auto"})),ut=g("div",{target:"e15560op3"})(({disabled:e})=>({pointerEvents:e?"none":"auto"})),pt=g("div",{target:"e15560op4"})(({theme:e})=>({marginTop:"0.625em",marginLeft:e.spacing.sm,height:e.spacing.xl,width:e.sizes.borderWidth,backgroundColor:e.colors.fadedText20})),gt=g("div",{target:"e15560op5"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,overflowX:"auto"})),ft=g("div",{target:"e15560op6"})({display:"flex"}),ht=g("div",{target:"e15560op7"})({flex:"0 0 auto"}),mt=g("div",{target:"e15560op8"})(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing.sm,gap:e.spacing.twoXS})),yt=g("div",{target:"e15560op9"})(({theme:e})=>({color:e.colors.fadedText60})),Ct=g("div",{target:"e15560op10"})(({theme:e,fileStatus:t})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t.type==="uploaded"?e.colors.bodyText:e.colors.fadedText60})),wt=g("div",{target:"e15560op11"})(({theme:e})=>({marginRight:e.spacing.md,color:e.colors.fadedText60})),vt=g("small",{target:"e15560op12"})(({theme:e})=>({display:"flex",alignItems:"center",maxHeight:e.sizes.smallElementHeight,color:e.colors.fadedText60,"& :hover":{color:e.colors.bodyText}})),xt=({getRootProps:e,getInputProps:t,acceptFile:n,disabled:l,theme:u})=>{const c=Re(t(),n);return F(dt,{disabled:l,children:[F(ut,{"data-testid":"stChatInputFileUploadButton",disabled:l,...e(),children:[a("input",{...c}),a(We,{content:`Upload or drag and drop ${De(n)}`,placement:Q.TOP,onMouseEnterDelay:500,children:a(ye,{kind:Ce.MINIMAL,disabled:l,children:a(z,{content:Ie,size:"lg",color:l?u.colors.fadedText40:u.colors.fadedText60})})})]}),a(pt,{})]})},bt=o.memo(xt),It=({getRootProps:e,getInputProps:t,acceptFile:n,inputHeight:l})=>{const u=Re(t(),n);return F(H,{children:[a(lt,{height:l,...e(),children:a("input",{...u})}),a(ct,{height:l,children:`Drag and drop ${De(n)} here`})]})},Et=o.memo(It);function zt({children:e,content:t}){const n=Z();return a(we,{content:t,placement:Q.TOP,overrides:{Body:{style:{top:`-${n.sizes.minElementHeight}`}}},children:e})}const St=({fileInfo:e})=>{const t=Z(),{type:n}=e.status;switch(n){case"uploading":return a(ve,{iconValue:"spinner",testid:"stChatInputFileIconSpinner",size:"lg"});case"error":return a(zt,{content:e.status.errorMessage,children:a(z,{color:t.colors.redTextColor,content:at,size:"lg"})});case"uploaded":return a(z,{content:Ye,size:"lg"});default:return me(n),null}},Ft=({fileInfo:e,onDelete:t})=>F(mt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[a(yt,{children:a(St,{fileInfo:e})}),a(Ct,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:e.name,fileStatus:e.status,children:e.name}),a(wt,{children:je(e.size,_.Byte)}),a(vt,{"data-testid":"stChatInputDeleteBtn",children:a(ye,{onClick:()=>t(e.id),kind:Ce.MINIMAL,children:a(z,{content:Ge,size:"lg"})})})]}),Ut=o.memo(Ft),Rt=({items:e,onDelete:t})=>a(gt,{"data-testid":"stChatUploadedFiles",children:a(ft,{children:e.map(n=>a(ht,{children:a(Ut,{fileInfo:n,onDelete:t})},n.id))})}),Dt=o.memo(Rt),Tt=(e,t)=>{const n=[],l=[];return e.forEach(u=>{const c=st(u,t.fileType);c.isValid?n.push(u):l.push({file:u,errors:[{code:xe.FileInvalidType,message:c.errorMessage||"File type not allowed."}]})}),{accepted:n,rejected:l}},Vt=({acceptMultipleFiles:e,acceptDirectoryFiles:t,maxFileSize:n,uploadClient:l,uploadFile:u,addFiles:c,getNextLocalFileId:m,deleteExistingFiles:C,onUploadComplete:S,element:w})=>(h,f)=>{if(t&&h.length>0){const{accepted:p,rejected:x}=Tt(h,w);h=p,f=[...f,...x]}if(!e&&h.length===0&&f.length>1){const p=f.findIndex(x=>x.errors?.[0].code===xe.TooManyFiles);p>=0&&(h.push(f[p].file),f.splice(p,1))}if(!e&&h.length>0&&C(),l.fetchFileURLs(h).then(p=>{Ne(p,h).forEach(([x,P])=>{u(x,P)})}).catch(p=>{c(h.map(x=>new be(x.name,x.size,m(),{type:"error",errorMessage:p})))}),f.length>0){const p=f.map(x=>_e(x,m(),n));c(p)}S()},Mt=({getNextLocalFileId:e,addFiles:t,updateFile:n,uploadClient:l,element:u,onUploadProgress:c,onUploadComplete:m})=>(C,S)=>{const w=S.webkitRelativePath||S.name,h=new AbortController,f=new be(w,S.size,e(),{type:"uploading",abortController:h,progress:1});t([f]),l.uploadFile({formId:"",...u},C.uploadUrl,S,p=>c(p,f.id),h.signal).then(()=>m(f.id,C)).catch(p=>{p instanceof DOMException&&p.name==="AbortError"||n(f.id,f.setStatus({type:"error",errorMessage:p?p.toString():"Unknown error"}))})},At=g("div",{target:"eyzqfg10"})("border:none;position:relative;display:flex;"),Bt=g("div",{target:"eyzqfg11"})(({theme:e,extended:t})=>({border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.widgetBorderColor??e.colors.transparent,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",paddingLeft:e.spacing.lg,maxHeight:t?"none":e.sizes.minElementHeight,gap:e.spacing.sm,overflow:"hidden",":focus-within":{borderColor:e.colors.primary}})),L=g("button",{target:"eyzqfg12"})(({theme:e,disabled:t,extended:n,hasError:l})=>{const u=Pe(e),[c,m]=u?[e.colors.gray60,e.colors.gray80]:[e.colors.gray80,e.colors.gray40],C=()=>l?e.colors.redTextColor:t?c:m;return{border:"none",backgroundColor:e.colors.transparent,borderTopRightRadius:n?"0":e.radii.chatInput,borderTopLeftRadius:n?e.radii.default:"0",borderBottomRightRadius:e.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.sm,color:C(),pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:u?e.colors.gray10:e.colors.gray90},"&:hover":{color:l?e.colors.red70:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:e.colors.transparent,borderColor:e.colors.transparent,color:e.colors.gray60,cursor:"not-allowed"}}}),kt=g("div",{target:"eyzqfg13"})(({theme:e,isRecording:t})=>({display:"flex",alignItems:t?"center":"flex-end",height:"100%",position:t?"static":"absolute",right:t?void 0:0,bottom:t?void 0:0,marginBottom:t?0:`-${e.sizes.borderWidth}`,pointerEvents:"none",gap:0,paddingRight:t?e.spacing.sm:0})),Lt=g("div",{target:"eyzqfg14"})(({theme:e,acceptAudio:t})=>({position:"absolute",bottom:"0px",right:t?`calc(2 * (${e.iconSizes.xl} + 2 * ${e.spacing.sm}) + 2 * ${e.spacing.sm})`:`calc(${e.iconSizes.xl} + 2 * ${e.spacing.sm} + ${e.spacing.sm})`})),Ht=g("div",{target:"eyzqfg15"})(({isRecording:e})=>({display:e?"flex":"none",flex:e?1:void 0,alignItems:"center",minWidth:0})),$t=g("div",{target:"eyzqfg16"})(({theme:e})=>({position:"relative",width:"100%",minHeight:e.sizes.minElementHeight,borderRadius:e.radii.default,overflow:"hidden","& > div":{position:"absolute",inset:0}})),G=(e,t,n)=>n.map(l=>l.id===e?t:l),Y=(e,t)=>t.find(n=>n.id===e);function Wt({disabled:e,element:t,widgetMgr:n,fragmentId:l,uploadClient:u}){const c=Z(),{placeholder:m,maxChars:C}=t,S=o.useRef(0),w=o.useRef(null),h=o.useRef(!1),f=o.useRef(null),p=o.useRef(null),{width:x,elementRef:P}=Oe(),{innerWidth:J,innerHeight:ee}=qe(),[R,O]=o.useState(t.default),[U,D]=o.useState([]),[M,q]=o.useState(!1),[A,te]=o.useState(!1),[K,B]=o.useState(null),k=t.acceptAudio??!1;o.useEffect(()=>()=>{p.current&&p.current.abort()},[]);const b=ot({textareaRef:w,dependencies:[m]}),$=o.useMemo(()=>U.some(r=>r.status.type==="uploading")?!1:R!==""||U.length>0,[U,R]),E=Ke(t.acceptFile),oe=Qe(t.maxUploadSizeMb,_.Megabyte,_.Byte),re=o.useCallback(r=>D(s=>[...s,...r]),[]),ne=o.useCallback(r=>{r.status.type==="uploading"&&r.status.abortController.abort(),r.status.type==="uploaded"&&r.status.fileUrls.deleteUrl&&u.deleteFile(r.status.fileUrls.deleteUrl).catch(s=>{N.error("Failed to delete file from server:",s)})},[u]),ae=o.useCallback(r=>{D(s=>{const d=Y(r,s);return j(d)?s:(ne(d),s.filter(i=>i.id!==r))})},[ne]),ie=o.useCallback(()=>{const r=U.filter(s=>s.status.type==="uploaded").map(s=>{const{name:d,size:i,status:I}=s,{fileId:X,fileUrls:He}=I;return new he({fileId:X,fileUrls:He,name:d,size:i})});return new Xe({uploadedFileInfo:r})},[U]),se=()=>S.current++,Te=Vt({acceptMultipleFiles:E===v.Multiple||E===v.Directory,acceptDirectoryFiles:E===v.Directory,maxFileSize:oe,uploadClient:u,uploadFile:Mt({getNextLocalFileId:se,addFiles:re,updateFile:(r,s)=>{D(d=>G(r,s,d))},uploadClient:u,element:t,onUploadProgress:(r,s)=>{D(d=>{const i=Y(s,d);if(j(i)||i.status.type!=="uploading")return d;const I=Math.round(r.loaded*100/r.total);return i.status.progress===I?d:G(s,i.setStatus({type:"uploading",abortController:i.status.abortController,progress:I}),d)})},onUploadComplete:(r,s)=>{D(d=>{const i=Y(r,d);return j(i)||i.status.type!=="uploading"?d:G(i.id,i.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}),d)})}}),addFiles:re,getNextLocalFileId:se,deleteExistingFiles:()=>U.forEach(r=>ae(r.id)),onUploadComplete:()=>{w.current&&w.current.focus()},element:t}),{getRootProps:le,getInputProps:ce}=Ze({onDrop:Te,multiple:E===v.Multiple||E===v.Directory,accept:Je(t.fileType),maxSize:oe}),W=o.useCallback(r=>{if(w.current&&w.current.focus(),!$&&!r||e)return;const s=ie(),d={data:R,fileUploaderState:s,audioFileInfo:r};n.setChatInputValue(t,d,{fromUi:!0},l),D([]),O(""),b.clearScrollHeight()},[$,e,R,ie,n,t,l,b]),de=o.useCallback(async r=>{const s=new Date().toISOString().replace(/[:.]/g,"-"),d=new File([r],`audio-${s}.wav`,{type:"audio/wav"});try{te(!0);const i=await u.fetchFileURLs([d]);if(i.length===0)throw new Error("Failed to get upload URL for audio file");const I=i[0];p.current=new AbortController,await u.uploadFile({formId:"",...t},I.uploadUrl,d,()=>{},p.current.signal);const X=new he({fileId:I.fileId,fileUrls:I,name:d.name,size:d.size});W(X)}catch(i){const I="Recording failed";N.error("Audio upload failed:",i),B(I),w.current&&w.current.focus()}finally{te(!1)}},[u,t,W]),Ve=o.useMemo(()=>({onApprove:de,onPermissionDenied:()=>{const r="Microphone access denied";B(r),N.error("Permission denied:",r)},onError:r=>{B("Recording failed"),N.error("Recording error:",r)},onRecordStart:()=>{B(null)}}),[de]),y=et({containerRef:f,sampleRate:t.audioSampleRate??void 0,events:Ve}),ue=o.useCallback(()=>{W()},[W]),Me=r=>{const{metaKey:s,ctrlKey:d,shiftKey:i}=r;nt(r)&&!i&&!d&&!s&&(r.preventDefault(),ue())},Ae=r=>{const{value:s}=r.target;C!==0&&s.length>C||(O(s),b.updateScrollHeight(),K&&B(null))},pe=o.useCallback(async r=>{r.preventDefault(),r.stopPropagation(),!(!k||e||y.state==="recording")&&await y.start()},[k,e,y]),Be=o.useCallback(()=>{y.cancel(),w.current&&w.current.focus()},[y]),ge=o.useCallback(async()=>{const{blob:r}=await y.stop();await y.approve(r)},[y]),fe=o.useCallback(r=>{pe(r)},[pe]),ke=o.useCallback(()=>{ge()},[ge]);o.useEffect(()=>{if(t.setValue&&!h.current){h.current=!0;const r=t.value||"";O(r)}},[t.setValue,t.value]),o.useEffect(()=>{h.current=!1},[t]),o.useEffect(()=>{const r=i=>{i.preventDefault(),i.stopPropagation(),!M&&i.dataTransfer?.types.includes("Files")&&q(!0)},s=i=>{i.preventDefault(),i.stopPropagation(),M&&(i.clientX<=0&&i.clientY<=0||i.clientX>=J&&i.clientY>=ee)&&q(!1)},d=i=>{i.preventDefault(),i.stopPropagation(),M&&q(!1)};return window.addEventListener("dragover",r),window.addEventListener("drop",d),window.addEventListener("dragleave",s),()=>{window.removeEventListener("dragover",r),window.removeEventListener("drop",d),window.removeEventListener("dragleave",s)}},[M,J,ee]);const Le=E!==v.None&&M;return F(H,{children:[E===v.None?null:a(Dt,{items:[...U],onDelete:ae}),a(At,{className:"stChatInput","data-testid":"stChatInput",ref:P,children:Le?a(Et,{getRootProps:le,getInputProps:ce,acceptFile:E,inputHeight:b.height}):F(Bt,{extended:b.isExtended||y.state==="recording",children:[a(Ht,{isRecording:y.state==="recording",children:a($t,{ref:f})}),E===v.None||y.state==="recording"?null:a(bt,{getRootProps:le,getInputProps:ce,acceptFile:E,disabled:e,theme:c}),y.state!=="recording"&&a(rt,{inputRef:w,value:R,placeholder:m,onChange:Ae,onKeyDown:Me,"aria-label":m,disabled:e,rows:1,overrides:{Root:{style:{minHeight:c.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:c.fontWeights.normal,lineHeight:c.lineHeights.inputWidget,"::placeholder":{color:c.colors.fadedText60},height:b.height,maxHeight:b.maxHeight,paddingLeft:c.spacing.none,paddingBottom:c.spacing.sm,paddingTop:c.spacing.sm,paddingRight:k?`calc(2 * (${c.iconSizes.xl} + 2 * ${c.spacing.sm}))`:`calc(${c.iconSizes.xl} + 2 * ${c.spacing.sm} + ${c.spacing.sm})`}}}}),y.state!=="recording"&&x>c.breakpoints.hideWidgetDetails&&a(Lt,{acceptAudio:k,children:a(tt,{dirty:$,value:R,maxLength:C,type:"chat",inForm:!1})}),a(kt,{isRecording:y.state==="recording",children:y.state==="recording"?F(H,{children:[a(L,{onClick:Be,disabled:e,extended:b.isExtended,"data-testid":"stChatInputCancelButton",children:a(z,{content:ze,size:"lg",color:"inherit"})}),a(L,{onClick:ke,disabled:e||A,extended:b.isExtended,"data-testid":"stChatInputApproveButton",children:A?a(ve,{size:"lg",iconValue:"spinner"}):a(z,{content:Ee,size:"lg",color:"inherit"})})]}):F(H,{children:[k&&a(H,{children:K?a(we,{content:K,placement:Q.TOP,error:!0,children:a(L,{onClick:fe,disabled:e||A,extended:b.isExtended,hasError:!0,"data-testid":"stChatInputMicButton",children:a(z,{content:Se,size:"xl",color:"inherit"})})}):a(L,{onClick:fe,disabled:e||A,extended:b.isExtended,"data-testid":"stChatInputMicButton",children:a(z,{content:Fe,size:"xl",color:"inherit"})})}),a(L,{onClick:ue,disabled:!$||e||A,extended:b.isExtended,"data-testid":"stChatInputSubmitButton",children:a(z,{content:Ue,size:"xl",color:"inherit"})})]})})]})})]})}const _t=o.memo(Wt);export{_t as default};
@@ -0,0 +1 @@
1
+ import{r as c,B as s,u as d,j as a,a as B,b as h,c as m,D as p,d as f}from"./index.CqTPbV5Y.js";function g(l){const{disabled:e,element:t,widgetMgr:n,fragmentId:r}=l,i=t.shortcut?t.shortcut:void 0;let o=s.SECONDARY;t.type==="primary"?o=s.PRIMARY:t.type==="tertiary"&&(o=s.TERTIARY);const u=c.useCallback(()=>{e||n.setTriggerValue(t,{fromUi:!0},r)},[e,n,t,r]);return d({shortcut:i,disabled:e,onActivate:u}),a(f,{className:"stButton","data-testid":"stButton",children:a(B,{help:t.help,containerWidth:!0,children:a(h,{kind:o,size:m.SMALL,disabled:e,containerWidth:!0,onClick:u,children:a(p,{icon:t.icon,label:t.label,shortcut:i})})})})}const R=c.memo(g);export{R as default};
@@ -1 +1 @@
1
- import{s as l,r as i,v as A,j as f,w as g}from"./index.CAj-7vWz.js";const T=l("div",{target:"ea9qfvi0"})(()=>({lineHeight:0})),y=l("audio",{target:"ea9qfvi1"})(({theme:t})=>({width:"100%",height:t.sizes.minElementHeight,margin:0,padding:0})),h=g.getLogger("Audio");function L({element:t,endpoints:a,elementMgr:u}){const o=i.useRef(null),{startTime:n,endTime:d,loop:s,autoplay:p}=t,E=i.useMemo(()=>{if(!t.id)return!0;const e=u.getElementState(t.id,"preventAutoplay");return e||u.setElementState(t.id,"preventAutoplay",!0),e??!1},[t.id,u]);i.useEffect(()=>{o.current&&(o.current.currentTime=n)},[n]),i.useEffect(()=>{const e=o.current,r=()=>{e&&(e.currentTime=t.startTime)};return e&&e.addEventListener("loadedmetadata",r),()=>{e&&e.removeEventListener("loadedmetadata",r)}},[t]),i.useEffect(()=>{const e=o.current;if(!e)return;let r=!1;const c=()=>{d>0&&e.currentTime>=d&&(s?(e.currentTime=n||0,e.play()):r||(r=!0,e.pause()))};return d>0&&e.addEventListener("timeupdate",c),()=>{e&&d>0&&e.removeEventListener("timeupdate",c)}},[d,s,n]),i.useEffect(()=>{const e=o.current;if(!e)return;const r=()=>{s&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",r),()=>{e&&e.removeEventListener("ended",r)}},[s,n]);const m=A(t.url),v=a.buildMediaURL(t.url);return f(T,{children:f(y,{className:"stAudio","data-testid":"stAudio",ref:o,controls:!0,autoPlay:p&&!E,src:v,onError:e=>{const r=e.currentTarget.src;h.error(`Client Error: Audio source error - ${r}`),a.sendClientErrorToHost("Audio","Audio source failed to load","onerror triggered",r)},crossOrigin:m})})}const C=i.memo(L);export{C as default};
1
+ import{x as l,r as i,O as v,j as f,Q as g}from"./index.CqTPbV5Y.js";const T=l("div",{target:"ea9qfvi0"})(()=>({lineHeight:0})),y=l("audio",{target:"ea9qfvi1"})(({theme:t})=>({width:"100%",height:t.sizes.minElementHeight,margin:0,padding:0})),h=g.getLogger("Audio");function L({element:t,endpoints:a,elementMgr:s}){const o=i.useRef(null),{startTime:n,endTime:d,loop:u,autoplay:p}=t,E=i.useMemo(()=>{if(!t.id)return!0;const e=s.getElementState(t.id,"preventAutoplay");return e||s.setElementState(t.id,"preventAutoplay",!0),e??!1},[t.id,s]);i.useEffect(()=>{o.current&&(o.current.currentTime=n)},[n]),i.useEffect(()=>{const e=o.current,r=()=>{e&&(e.currentTime=t.startTime)};return e&&e.addEventListener("loadedmetadata",r),()=>{e&&e.removeEventListener("loadedmetadata",r)}},[t]),i.useEffect(()=>{const e=o.current;if(!e)return;let r=!1;const c=()=>{d>0&&e.currentTime>=d&&(u?(e.currentTime=n||0,e.play()):r||(r=!0,e.pause()))};return d>0&&e.addEventListener("timeupdate",c),()=>{e&&d>0&&e.removeEventListener("timeupdate",c)}},[d,u,n]),i.useEffect(()=>{const e=o.current;if(!e)return;const r=()=>{u&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",r),()=>{e&&e.removeEventListener("ended",r)}},[u,n]);const m=v(t.url),A=a.buildMediaURL(t.url);return f(T,{children:f(y,{className:"stAudio","data-testid":"stAudio",ref:o,controls:!0,autoPlay:p&&!E,src:A,onError:e=>{const r=e.currentTarget.src;h.error(`Client Error: Audio source error - ${r}`),a.sendClientErrorToHost("Audio","Audio source failed to load","onerror triggered",r)},crossOrigin:m})})}const C=i.memo(L);export{C as default};
@@ -0,0 +1 @@
1
+ import{r as p,g as x,k as T,j as n,l as C,m as y,S,o as L,T as W,P as B,p as w,t as R,C as E,q as P}from"./index.CqTPbV5Y.js";import{u as $}from"./useBasicWidgetState.DA3_qaXD.js";import{S as v,L as X,a as m}from"./checkbox.5xWaqPqm.js";import"./FormClearHelper.-9RbsnV0.js";function H({element:t,disabled:a,widgetMgr:s,fragmentId:d}){const[f,g]=$({getStateFromWidgetMgr:M,getDefaultStateFromProto:V,getCurrStateFromProto:I,updateWidgetMgrState:j,element:t,widgetMgr:s,fragmentId:d}),k=p.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),e=x(),{colors:o,spacing:h,sizes:r}=e,u=T(e),b=a?o.fadedText40:o.bodyText;return n(P,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:n(v,{checked:f,disabled:a,onChange:k,"aria-label":t.label,checkmarkType:t.type===E.StyleType.TOGGLE?m.toggle:m.default,labelPlacement:X.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?o.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=u?o.bgColor:o.bodyText;return a&&(c=u?o.gray70:o.gray90),{width:`calc(${r.checkbox} - ${e.spacing.twoXS})`,height:`calc(${r.checkbox} - ${e.spacing.twoXS})`,transform:i?`translateX(${r.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=o.fadedText40;return c&&!a&&(l=o.fadedText20),i&&!a&&(l=o.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:e.spacing.twoXS,paddingLeft:e.spacing.threeXS,paddingRight:e.spacing.threeXS,width:`calc(2 * ${r.checkbox})`,minWidth:`calc(2 * ${r.checkbox})`,height:r.checkbox,minHeight:r.checkbox,borderBottomLeftRadius:e.radii.full,borderTopLeftRadius:e.radii.full,borderBottomRightRadius:e.radii.full,borderTopRightRadius:e.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?o.primary:o.fadedText40;return{outline:0,width:r.checkbox,height:r.checkbox,marginTop:e.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?`0 0 0 0.2rem ${R(o.primary,.5)}`:"",borderLeftWidth:r.borderWidth,borderRightWidth:r.borderWidth,borderTopWidth:r.borderWidth,borderBottomWidth:r.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:e.lineHeights.small,paddingLeft:e.spacing.sm,position:"relative",color:b}}},children:C(w,{visibility:y(t.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[n(S,{source:t.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),t.help&&n(L,{color:b,children:n(W,{content:t.help,placement:B.TOP_RIGHT})})]})})})}function M(t,a){return t.getBoolValue(a)}function V(t){return t.default??null}function I(t){return t.value??null}function j(t,a,s,d){a.setBoolValue(t,s.value,{fromUi:s.fromUi},d)}const z=p.memo(H);export{z as default};
@@ -0,0 +1 @@
1
+ import{r as a,E as C,_ as E,x as s,aC as k,aA as x,aD as z,aE as I,g as D,f as W,aF as m,l,j as r,m as H,S as B,T as N,P as O,o as P,ax as X,aG as q,aH as T,aI as F}from"./index.CqTPbV5Y.js";import{e as j,S as G,a as U,b as J}from"./embed.HKcgTiLB.js";import"./threshold.Q1mXg5rX.js";import"./value.B4vHRSi7.js";import"./timer.C2hYhUse.js";var A=a.forwardRef(function(e,t){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(C,E({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),a.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),a.createElement("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}))});A.displayName="ArrowDownward";var b=a.forwardRef(function(e,t){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(C,E({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),a.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),a.createElement("path",{d:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}))});b.displayName="ArrowUpward";const K=s("div",{target:"exsm2dv0"})(({theme:e,showBorder:t})=>({height:"100%",...t&&{border:`${e.sizes.borderWidth} solid ${e.colors.borderColor}`,borderRadius:e.radii.default,overflow:"hidden"}})),Q=s("div",{target:"exsm2dv1"})(({theme:e,showBorder:t})=>({...t&&{padding:`calc(${e.spacing.lg} - ${e.sizes.borderWidth})`}})),Y=s("div",{target:"exsm2dv2"})(({theme:e,showBorder:t})=>({marginTop:t?void 0:e.spacing.lg,marginBottom:t?e.spacing.twoXL:void 0})),w=s("div",{target:"exsm2dv3"})(({theme:e})=>({overflowWrap:"normal",textOverflow:"ellipsis",width:"100%",overflow:"hidden",whiteSpace:"nowrap",fontFamily:e.genericFonts.bodyFont,lineHeight:"normal",verticalAlign:"middle","& > div":{overflow:"hidden","& > p":{textOverflow:"ellipsis",overflow:"hidden"}}})),Z=s(k,{target:"exsm2dv4"})(({visibility:e})=>({marginBottom:0,display:e===x.Collapsed?"none":"grid",gridTemplateColumns:e===x.Collapsed?"initial":"auto 1fr",visibility:e===x.Hidden?"hidden":"visible"})),ee=s("div",{target:"exsm2dv5"})(({theme:e})=>({fontSize:e.fontSizes.threeXL,color:e.colors.bodyText,paddingBottom:e.spacing.twoXS})),te=s("div",{target:"exsm2dv6"})(({theme:e,metricColor:t,showArrow:i})=>({color:I(e,t),backgroundColor:z(e,t),fontSize:e.fontSizes.sm,display:"inline-flex",flexDirection:"row",alignItems:"center",fontWeight:e.fontWeights.normal,borderRadius:e.radii.full,maxWidth:"100%",padding:`${e.spacing.threeXS} ${e.spacing.xs} ${e.spacing.threeXS} ${e.spacing.xs}`,...i&&{paddingLeft:e.spacing.twoXS}})),ie=1e3;function ae(e,t,i,o,f){const n=`metric_chart_${Math.random().toString(36).slice(2,10)}`,h=e.length===1?[e[0],e[0]]:e,d={$schema:"https://vega.github.io/schema/vega-lite/v5.json",width:Math.round(i),height:Math.round(F("3.5rem")),data:{values:h.map((v,g)=>({x:g,y:v}))},layer:[{name:`${n}_mark`,mark:{type:"line",...t===m.ChartType.LINE&&{type:"line",strokeCap:"round",strokeWidth:2},...t===m.ChartType.BAR&&{type:"bar",cornerRadius:parseFloat(o.radii.full)},...t===m.ChartType.AREA&&{type:"area",color:z(o,f),opacity:1,line:{color:T(o,f),opacity:1,strokeWidth:2,strokeCap:"round"}}},encoding:{x:{field:"x",type:"quantitative",axis:null,scale:{zero:!1,nice:!1}},y:{field:"y",type:"quantitative",axis:null,scale:{zero:!1,nice:!1}}}},{name:`${n}_points`,mark:{type:"point",opacity:0},encoding:{x:{field:"x",type:"quantitative",axis:null,scale:{zero:!1,nice:!1}},y:{field:"y",type:"quantitative",axis:null,scale:{zero:!1,nice:!1}}},params:[{name:`${n}_hover_selection`,select:{type:"point",encodings:["x"],nearest:!0,on:e.length>ie?"mousemove{16}":"mousemove",clear:"mouseleave"}}]},{name:`${n}_highlighted_points`,transform:[{filter:{param:`${n}_hover_selection`,empty:!1}}],mark:{type:"point",filled:!0,size:65,tooltip:!0},encoding:{x:{field:"x",type:"quantitative",axis:null,scale:{zero:!1,nice:!1}},y:{field:"y",type:"quantitative",axis:null,scale:{zero:!1,nice:!1}}}}],config:{view:{stroke:null},padding:{left:-3,right:-3,top:2,bottom:2},...t===m.ChartType.BAR&&{padding:{left:0,right:0,top:2,bottom:2}},mark:{tooltip:{content:"encoding"},color:T(o,f)}}};return d.config=U(d.config,o),d}function oe({element:e}){const t=D(),i=a.useRef(null),{width:o,elementRef:f}=W(),{MetricDirection:u}=m,{body:n,label:h,delta:d,direction:v,color:g,labelVisibility:L,help:M,showBorder:y,chartData:c,chartType:S}=e;let p=null;switch(v){case u.DOWN:p=A;break;case u.UP:p=b;break}const $="0 threeXS 0 0",R=d!=="";return a.useEffect(()=>{if(c&&c.length>0&&i.current&&o>0){const V=ae(c,S,o,t,g);j(i.current,V,{actions:!1,renderer:"svg",ast:!0,expr:J,tooltip:{theme:"custom",formatTooltip:_=>`${_.y}`}})}},[c,g,t,o,S,i]),l(K,{className:"stMetric","data-testid":"stMetric",showBorder:y,children:[l(Q,{showBorder:y,children:[l(Z,{"data-testid":"stMetricLabel",visibility:H(L?.value),children:[r(w,{children:r(B,{source:h,allowHTML:!1,isLabel:!0})}),M&&r(P,{children:r(N,{content:M,placement:O.TOP_RIGHT})})]}),r(ee,{"data-testid":"stMetricValue",children:l(w,{children:[" ",n," "]})}),R&&l(te,{"data-testid":"stMetricDelta",metricColor:g,showArrow:p!==null,children:[p&&r(X,{testid:p===b?"stMetricDeltaIcon-Up":"stMetricDeltaIcon-Down",content:p,size:"md",margin:$}),l(w,{children:[" ",d," "]})]})]}),c&&c.length>0&&l("div",{ref:f,children:[r(q,{styles:[G]}),r(Y,{ref:i,"data-testid":"stMetricChart",showBorder:y})]})]})}const ce=a.memo(oe);export{ce as default};
@@ -0,0 +1 @@
1
+ import{get as O}from"./index.DfIRibXG.js";import{I as P}from"./index.CqTPbV5Y.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};
@@ -0,0 +1 @@
1
+ import{av as U,j as u,aw as _,ae as z,P as h,ax as $,S as G,ay as X,k as Z,e as q,r as s,g as J,az as K,L as Q,l as oo,m as to,ab as ro,T as eo,ac as no}from"./index.CqTPbV5Y.js";import{h as x}from"./moment.C3j7ZXd7.js";import{u as ao,D as so,a as io}from"./useIntlLocale.BSq6SANa.js";import{u as lo}from"./useBasicWidgetState.DA3_qaXD.js";import{S as co}from"./styled-components.e0V96rJw.js";import{E as po}from"./ErrorOutline.esm.sMJdFExW.js";import"./timepicker.Bpn70xGc.js";import"./possibleConstructorReturn.C_51n46K.js";import"./createSuper.OIgV8wc-.js";import"./input.CcvrgErO.js";import"./base-input.BXTqYbyG.js";import"./FormClearHelper.-9RbsnV0.js";const go=({theme:o,isInSidebar:t,step:r,minTime:c,maxTime:f,disabled:p,clearable:g,error:e})=>({Popover:{props:{ignoreBoundary:t,placement:_.bottomLeft,overrides:{Body:{style:{marginTop:o.spacing.px}}}}},CalendarContainer:{style:{fontSize:o.fontSizes.sm,paddingRight:o.spacing.sm,paddingLeft:o.spacing.sm,paddingBottom:o.spacing.none,paddingTop:o.spacing.sm}},Week:{style:{fontSize:o.fontSizes.sm}},Day:{style:({$pseudoHighlighted:i,$pseudoSelected:a,$selected:C,$isHovered:y})=>({fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,"::before":{backgroundColor:C||a||i||y?`${o.colors.darkenedBgMix15} !important`:o.colors.transparent},"::after":{borderColor:o.colors.transparent},...Z(o)&&y&&a&&!C?{color:o.colors.secondaryBg}:{}})},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:o.colors.transparent},":focus":{backgroundColor:o.colors.transparent,outline:0}})},NextButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:o.colors.transparent},":focus":{backgroundColor:o.colors.transparent,outline:0}})},Input:{props:{maskChar:null,endEnhancer:e&&u(X,{content:u(G,{source:e,allowHTML:!1}),placement:h.TOP_RIGHT,error:!0,children:u($,{content:po,size:"lg"})}),overrides:{EndEnhancer:{style:{color:e?o.colors.redTextColor:o.colors.grayTextColor,backgroundColor:o.colors.transparent}},Root:{style:({$isFocused:i})=>{const a=z(o.colors,i);return{borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,paddingRight:o.spacing.twoXS,borderTopColor:a,borderRightColor:a,borderBottomColor:a,borderLeftColor:a,...e&&{backgroundColor:o.colors.redBackgroundColor}}}},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.grayTextColor,padding:o.spacing.threeXS,height:o.sizes.clearIconSize,width:o.sizes.clearIconSize,":hover":{fill:o.colors.bodyText}}}}}},InputContainer:{style:{backgroundColor:"transparent"}},Input:{style:{fontWeight:o.fontWeights.normal,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm,lineHeight:o.lineHeights.inputWidget,"::placeholder":{color:o.colors.fadedText60},...e&&{color:o.colors.redTextColor}},props:{"data-testid":"stDateTimeInputField"}}}}},TimeSelectContainer:{style:{paddingTop:o.spacing.none,paddingBottom:o.spacing.none}},TimeSelectFormControl:{style:{marginBottom:o.spacing.none},props:{overrides:{Label:{component:()=>null}}}},TimeSelect:{props:{step:r,format:"24",disabled:p,nullable:g,minTime:c,maxTime:f,overrides:{Select:{props:{disabled:p,overrides:{ControlContainer:{style:({$isFocused:i})=>{const a=z(o.colors,i);return{height:o.sizes.minElementHeight,borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,borderTopColor:a,borderRightColor:a,borderBottomColor:a,borderLeftColor:a}}},IconsContainer:{style:()=>({paddingRight:o.spacing.sm})},ValueContainer:{style:()=>({lineHeight:o.lineHeights.inputWidget,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm})},SingleValue:{style:{fontWeight:o.fontWeights.normal},props:{"data-testid":"stDateTimeInputTimeDisplay"}},Dropdown:{style:()=>({paddingTop:o.spacing.none,paddingBottom:o.spacing.none,boxShadow:"none",maxHeight:o.sizes.maxDropdownHeight})},DropdownListItem:{component:co},Popover:{props:{ignoreBoundary:t,overrides:{Body:{style:()=>({marginTop:o.spacing.px})}}}},Placeholder:{style:()=>({color:o.colors.fadedText60})},SelectArrow:{component:U,props:{overrides:{Svg:{style:()=>({width:o.iconSizes.xl,height:o.iconSizes.xl})}}}}}}}}}}}),k="YYYY/MM/DD, HH:mm",uo=(o,t)=>{const r=o.getStringArrayValue(t);return r&&r.length>0?r[0]:null},fo=o=>o.default?.length?o.default[0]:null,mo=o=>o.value?.length?o.value[0]:null,M=o=>{let t;if(Array.isArray(o)?t=o.find(c=>c instanceof Date):t=o,!t||Number.isNaN(t.getTime()))return null;const r=new Date(t.getTime());return r.setSeconds(0,0),r},b=o=>{if(q(o)||o==="")return null;const t=x(o,k,!0);return t.isValid()?M(t.toDate()):null},I=(o,t)=>o.getFullYear()===t.getFullYear()&&o.getMonth()===t.getMonth()&&o.getDate()===t.getDate(),B=(o,t)=>{const r=new Date(o.getTime());return r.setHours(t.getHours(),t.getMinutes(),0,0),r},bo=(o,t,r,c)=>{const f=b(o.min),p=b(o.max),g=e=>{t.setStringArrayValue(o,e?[e]:[],{fromUi:r.fromUi},c)};if(r.value){const e=b(r.value);if(e){f&&e<f||p&&e>p||g(r.value);return}}g(r.value)};function To({disabled:o,element:t,widgetMgr:r,fragmentId:c}){const f=J(),p=s.useContext(K),g=s.useRef(null),[e,i]=lo({getStateFromWidgetMgr:uo,getDefaultStateFromProto:fo,getCurrStateFromProto:mo,updateWidgetMgrState:bo,element:t,widgetMgr:r,fragmentId:c}),{locale:a}=s.useContext(Q),C=ao(a),y=t.step?Number(t.step):900,l=s.useMemo(()=>b(t.min),[t.min]),d=s.useMemo(()=>b(t.max),[t.max]),T=s.useMemo(()=>b(e),[e]),[n,v]=s.useState(T),[H,L]=s.useState(T);T!==H&&(v(T),L(T));const P=l??void 0,V=d??void 0,E=s.useMemo(()=>{if(!(!n||!l))return I(n,l)?B(n,l):void 0},[n,l]),R=s.useMemo(()=>{if(!(!n||!d))return I(n,d)?B(n,d):void 0},[n,d]),w=t.format.replaceAll(/[a-zA-Z]/g,"9"),D=`${t.format.replaceAll("Y","y").replaceAll("D","d")}, HH:mm`,A=`${w}, 99:99`,F=`${t.format}, HH:MM`,W=(t.default&&t.default.length>0?t.default[0]:"").length===0&&!o,O=s.useMemo(()=>{if(!n)return null;if(l&&n<l||d&&n>d){const m=x(l).format(D),S=x(d).format(D);return`**Error**: Date and time set outside allowed range. Please select a date and time between ${m} and ${S}.`}return null},[n,l,d,D]),N=s.useCallback(({date:m})=>{const S=M(m);v(S),g.current?.open?.()},[]),Y=s.useCallback(()=>{const m=n?x(n).format(k):null;m!==e&&i({value:m,fromUi:!0})},[n,e,i]),j=go({theme:f,isInSidebar:p,step:y,minTime:E,maxTime:R,disabled:o,clearable:W,error:O});return oo("div",{className:"stDateTimeInput","data-testid":"stDateTimeInput",children:[u(no,{label:t.label,disabled:o,labelVisibility:to(t.labelVisibility?.value),children:t.help&&u(ro,{children:u(eo,{content:t.help,placement:h.TOP_RIGHT})})}),u(io,{ref:g,locale:C,density:so.high,value:n,onChange:N,onClose:Y,minDate:P,maxDate:V,disabled:o,timeSelectStart:!0,formatString:D,mask:A,placeholder:F,clearable:W,overrides:j,"aria-label":t.label})]})}const Lo=s.memo(To);export{Lo as default};
@@ -0,0 +1 @@
1
+ import{r as s,E as G,_ as P,g as Q,e as I,N as K,M as Y,bj as L,bk as M,bl as Z,bm as q,n as H,bn as j,Q as U,R as ee,f as te,b3 as ne,bo as re,j as A,l as se,aG as oe}from"./index.CqTPbV5Y.js";import{w as ae,E as ie}from"./withFullScreenWrapper.7j_lzlaF.js";import{a as k,S as _,T as ce}from"./Toolbar.DMgU0Vgw.js";import{R as le}from"./index.Buc7XrOl.js";import{a as J,c as ue,b as fe,e as de,t as me,S as he,d as pe}from"./embed.HKcgTiLB.js";import{u as ge}from"./FormClearHelper.-9RbsnV0.js";import"./moment.C3j7ZXd7.js";import"./pandasStylerUtils.DqP0h70z.js";import"./_baseIndexOf.BTknn6Gb.js";import"./sprintf.D7DtBTRn.js";import"./index.8HslT92O.js";import"./main.eVHOp4Th.js";import"./throttle.D3b5WILl.js";import"./checkbox.5xWaqPqm.js";import"./createDownloadLinkElement.ZaXNnPK4.js";import"./toConsumableArray.DIN_ys1J.js";import"./possibleConstructorReturn.C_51n46K.js";import"./createSuper.OIgV8wc-.js";import"./FileDownload.esm.CV-WYqBn.js";import"./_arrayIncludes.B19Iyn2B.js";import"./threshold.Q1mXg5rX.js";import"./value.B4vHRSi7.js";import"./timer.C2hYhUse.js";var B=s.forwardRef(function(n,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(G,P({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},n,{ref:t}),s.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),s.createElement("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM7 10h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"}))});B.displayName="InsertChart";var $=s.forwardRef(function(n,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(G,P({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},n,{ref:t}),s.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),s.createElement("path",{d:"M20 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v3H5V5h15zm-5 14h-5v-9h5v9zM5 10h3v9H5v-9zm12 9v-9h3v9h-3z"}))});$.displayName="TableChart";const Se=20;function ye(n){"params"in n&&"encoding"in n&&n.params.forEach(t=>{"select"in t&&(["interval","point"].includes(t.select)&&(t.select={type:t.select}),"type"in t.select&&t.select.type==="point"&&!("encodings"in t.select)&&I(t.select.encodings)&&(t.select.encodings=Object.keys(n.encoding)))})}const be=(n,t,o,r,u,c,l,h)=>{const e=JSON.parse(n);if(r==="streamlit"?e.config=J(e.config,c):e.usermeta?.embedOptions?.theme==="streamlit"?(e.config=J(e.config,c),e.usermeta.embedOptions.theme=void 0):e.config=ue(e.config,c),e.title&&(typeof e.title=="string"&&(e.title={text:e.title}),e.title.limit=e.title.limit??Math.max(l-40,0)),o&&(e.height=h),t&&(e.width=l,"vconcat"in e&&e.vconcat.forEach(f=>{f.width=l})),e.padding||(e.padding={}),I(e.padding.bottom)&&(e.padding.bottom=Se),e.datasets)throw new Error("Datasets should not be passed as part of the spec");return u.length>0&&ye(e),e},we=(n,t,o,r,u)=>{const c=Q(),{id:l,formId:h,spec:e,data:f,datasets:a,vegaLiteTheme:d,selectionMode:i}=n,p=s.useMemo(()=>i,[JSON.stringify(i)]),S=s.useMemo(()=>be(e,r,u,d,p,c,t,o),[e,r,u,d,p,c,t,o]);return{id:l,formId:h,vegaLiteTheme:d,spec:S,selectionMode:p,data:f,datasets:a,useContainerWidth:r}},Ce={DATAFRAME_INDEX:"(index)"};function Ee(n){return!n||n.dimensions.numDataRows===0?null:z(n)}function Ve(n){const t=F(n);if(I(t))return null;const o={};for(const[r,u]of Object.entries(t))o[r]=z(u);return o}function F(n){if(n?.length===0)return null;const t={};return n.forEach(o=>{if(!o)return;const r=o.hasName?o.name:null;t[r]=o.data}),t}function z(n,t=0){if(n.dimensions.numDataRows===0)return[];const o=[],{numDataRows:r,numDataColumns:u,numIndexColumns:c}=n.dimensions,l=n.columnTypes[0]??void 0,h=l&&l.type===K.INDEX&&(Y(l)||L(l)||M(l));for(let e=t;e<r;e++){const f={};if(h){const{content:a}=n.getCell(e,0);f[Ce.DATAFRAME_INDEX]=typeof a=="bigint"?Number(a):a}for(let a=0;a<u;a++){const d=a+c,{content:i,contentType:p}=n.getCell(e,d);if((i instanceof Date||typeof i=="number"&&Number.isFinite(i))&&(L(p)||M(p))&&!Z(p)){const S=new Date(i).getTimezoneOffset()*60*1e3;f[n.columnNames[0][d]]=i.valueOf()+S}else f[n.columnNames[0][d]]=typeof i=="bigint"?Number(i):i}o.push(f)}return o}const ve=150,De=U.getLogger("useVegaLiteSelections"),Ne=(n,t,o)=>{const{id:r,formId:u,selectionMode:c}=n,l=s.useCallback(e=>{c.forEach(a=>{e.addSignalListener(a,q(ve,(d,i)=>{const p=e.getState({data:(C,O)=>c.some(g=>`${g}_store`===C),recurse:!1});H(p)&&t.setElementState(r,"viewState",p);let S=i;"vlPoint"in i&&"or"in i.vlPoint&&(S=i.vlPoint.or);const D={id:r,formId:u},V=JSON.parse(t.getStringValue(D)||"{}"),v={selection:{...V?.selection||{},[d]:S||{}}};j(V,v)||t.setStringValue(D,JSON.stringify(v),{fromUi:!0},o)}))});const f=t.getElementState(r,"viewState");if(H(f))try{return e.setState(f)}catch(a){De.warn("Failed to restore view state",a)}return e},[r,c,t,u,o]),h=s.useCallback(()=>{const e={selection:{}};c.forEach(i=>{e.selection[i]={}});const f={id:r,formId:u},a=t.getStringValue(f),d=a?JSON.parse(a):e;j(d,e)||t.setStringValue(f,JSON.stringify(e),{fromUi:!0},o)},[r,u,o,c,t]);return{maybeConfigureSelections:l,onFormCleared:h}},W="source",Te=U.getLogger("useVegaEmbed");function Oe(n,t,o){const r=s.useRef(null),u=s.useRef(null),c=s.useRef(W),l=s.useRef(null),h=s.useRef([]),e=s.useRef(null),f=s.useRef([]),[a,d]=s.useState(!1),{maybeConfigureSelections:i,onFormCleared:p}=Ne(n,t,o);ge({widgetMgr:t,element:n,onFormCleared:p});const{data:S,datasets:D}=n;s.useEffect(()=>{e.current=S,f.current=D,r.current===null&&(l.current=S,h.current=D)},[S,D]);const V=s.useCallback(()=>{u.current&&u.current(),u.current=null,r.current=null},[]),v=s.useCallback(async(g,y)=>{if(g.current===null)throw new Error("Element missing.");d(!0);try{V();const b={ast:!0,expr:fe,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:w,view:T,finalize:E}=await de(g.current,y,b);r.current=i(T),u.current=E;const m=Ve(f.current),N=m?Object.keys(m):[];if(N.length===1){const[x]=N;c.current=x}else N.length===0&&w.data&&(c.current=W);const R=Ee(e.current);if(R&&r.current.insert(c.current,R),m)for(const[x,X]of Object.entries(m))r.current.insert(x,X);return await r.current.runAsync(),await r.current.resize().runAsync(),l.current=e.current,h.current=f.current,r.current}finally{d(!1)}},[V,i]),C=s.useCallback((g,y,b,w)=>{if(!w||w.dimensions.numDataRows===0){try{g.remove(y,me)}catch{}return}if(!b||b.dimensions.numDataRows===0){g.insert(y,z(w));return}w.hash!==b.hash&&(g.data(y,z(w)),Te.info(`Had to clear the ${y} dataset before inserting data through Vega view.`))},[]),O=s.useCallback(async(g,y)=>{if(r.current===null||a)return null;const b=l.current,w=h.current;(b||g)&&C(r.current,c.current,b,g);const T=F(w)??{},E=F(y)??{};for(const[m,N]of Object.entries(E)){const R=m||c.current,x=T[R];C(r.current,R,x,N)}for(const m of Object.keys(T))!Object.hasOwn(E,m)&&m!==c.current&&C(r.current,m,null,null);return await r.current?.resize().runAsync(),l.current=g,h.current=y,r.current},[C,a]);return{createView:v,updateView:O,finalizeView:V}}function Ae(n){try{const t=typeof n=="string"?JSON.parse(n):n;return!!(t.facet||t.encoding?.row||t.encoding?.column||t.encoding?.facet)}catch{return!1}}const Re=({disableFullscreenMode:n,element:t,fragmentId:o,widgetMgr:r,widthConfig:u,heightConfig:c})=>{const[l,h]=s.useState(!1),[e,f]=s.useState(!1),{expanded:a,height:d,width:i,expand:p,collapse:S}=ee(ie),{width:D,height:V,elementRef:v}=te([l],0),C=ne(u)||t.useContainerWidth,O=re(c),g=Ae(t.spec),y=we(t,g?i??0:D,(a?d:V)??0,a?!0:C,a?!0:O),{createView:b,updateView:w,finalizeView:T}=Oe(y,r,o),{data:E,datasets:m,spec:N}=y;return s.useLayoutEffect(()=>(v.current!==null&&b(v,N),T),[b,T,N,i,d,l,v]),s.useEffect(()=>{w(E,m)},[E,m]),s.useEffect(()=>{E||m?.[0]?.data?f(!0):f(!1)},[E,m]),l?A(le,{data:E??m[0]?.data,height:d??V??void 0,width:u??void 0,customToolbarActions:[A(k,{label:"Show chart",icon:B,onClick:()=>{h(!1)}},"show-chart")]}):se(_,{height:O?a?d:"100%":d,useContainerWidth:a?!0:C,children:[A(ce,{target:_,isFullScreen:a,onExpand:p,onCollapse:S,disableFullscreenMode:n,children:e&&A(k,{label:"Show data",icon:$,onClick:()=>{h(!0)}})}),A(oe,{styles:[he]}),A(pe,{"data-testid":"stVegaLiteChart",className:"stVegaLiteChart",useContainerWidth:C,useContainerHeight:O,ref:v})]})},xe=ae(Re),tt=s.memo(xe);export{he as StyledVegaLiteChartTooltips,J as applyStreamlitTheme,tt as default};
@@ -0,0 +1,11 @@
1
+ import{Q,e as Z,bt as me,bu as ge,x as he,r as d,g as ye,bv as V,aj as I,j as A,X as pe,bw as H,bx as Ee,a1 as be,a2 as Fe,l as Ce,a0 as we,W as Ne,n as Oe}from"./index.CqTPbV5Y.js";import{by as tr}from"./index.CqTPbV5Y.js";import{w as Se}from"./withCalculatedWidth.ChdrMItN.js";import{C as W,a as Y}from"./urls.BwSlolu9.js";import{D as Ae,a as Re}from"./IFrameUtil.DefezniK.js";const v="%[a-f0-9]{2}",G=new RegExp("("+v+")|([^%]+?)","gi"),B=new RegExp("("+v+")+","gi");function T(e,r){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;r=r||1;const t=e.slice(0,r),n=e.slice(r);return Array.prototype.concat.call([],T(t),T(n))}function _e(e){try{return decodeURIComponent(e)}catch{let r=e.match(G)||[];for(let t=1;t<r.length;t++)e=T(r,t).join(""),r=e.match(G)||[];return e}}function Ie(e){const r={"%FE%FF":"��","%FF%FE":"��"};let t=B.exec(e);for(;t;){try{r[t[0]]=decodeURIComponent(t[0])}catch{const a=_e(t[0]);a!==t[0]&&(r[t[0]]=a)}t=B.exec(e)}r["%C2"]="�";const n=Object.keys(r);for(const a of n)e=e.replace(new RegExp(a,"g"),r[a]);return e}function Te(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return Ie(e)}}function Ue(e,r){const t={};if(Array.isArray(r))for(const n of r){const a=Object.getOwnPropertyDescriptor(e,n);a?.enumerable&&Object.defineProperty(t,n,a)}else for(const n of Reflect.ownKeys(e)){const a=Object.getOwnPropertyDescriptor(e,n);if(a.enumerable){const s=e[n];r(n,s,e)&&Object.defineProperty(t,n,a)}}return t}function ee(e,r){if(!(typeof e=="string"&&typeof r=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e===""||r==="")return[];const t=e.indexOf(r);return t===-1?[]:[e.slice(0,t),e.slice(t+r.length)]}const xe=e=>e==null,$e=e=>encodeURIComponent(e).replaceAll(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),U=Symbol("encodeFragmentIdentifier");function Me(e){switch(e.arrayFormat){case"index":return r=>(t,n)=>{const a=t.length;return n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[c(r,e),"[",a,"]"].join("")]:[...t,[c(r,e),"[",c(a,e),"]=",c(n,e)].join("")]};case"bracket":return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[c(r,e),"[]"].join("")]:[...t,[c(r,e),"[]=",c(n,e)].join("")];case"colon-list-separator":return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[c(r,e),":list="].join("")]:[...t,[c(r,e),":list=",c(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const r=e.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(n,a)=>a===void 0||e.skipNull&&a===null||e.skipEmptyString&&a===""?n:(a=a===null?"":a,n.length===0?[[c(t,e),r,c(a,e)].join("")]:[[n,c(a,e)].join(e.arrayFormatSeparator)])}default:return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,c(r,e)]:[...t,[c(r,e),"=",c(n,e)].join("")]}}function Le(e){let r;switch(e.arrayFormat){case"index":return(t,n,a)=>{if(r=/\[(\d*)]$/.exec(t),t=t.replace(/\[\d*]$/,""),!r){a[t]=n;return}a[t]===void 0&&(a[t]={}),a[t][r[1]]=n};case"bracket":return(t,n,a)=>{if(r=/(\[])$/.exec(t),t=t.replace(/\[]$/,""),!r){a[t]=n;return}if(a[t]===void 0){a[t]=[n];return}a[t]=[...a[t],n]};case"colon-list-separator":return(t,n,a)=>{if(r=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!r){a[t]=n;return}if(a[t]===void 0){a[t]=[n];return}a[t]=[...a[t],n]};case"comma":case"separator":return(t,n,a)=>{const o=typeof n=="string"&&n.includes(e.arrayFormatSeparator)?n.split(e.arrayFormatSeparator).map(i=>h(i,e)):n===null?n:h(n,e);a[t]=o};case"bracket-separator":return(t,n,a)=>{const s=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!s){a[t]=n&&h(n,e);return}const o=n===null?[]:h(n,e).split(e.arrayFormatSeparator);if(a[t]===void 0){a[t]=o;return}a[t]=[...a[t],...o]};default:return(t,n,a)=>{if(a[t]===void 0){a[t]=n;return}a[t]=[...[a[t]].flat(),n]}}}function re(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function c(e,r){return r.encode?r.strict?$e(e):encodeURIComponent(e):e}function h(e,r){return r.decode?Te(e):e}function te(e){return Array.isArray(e)?e.sort():typeof e=="object"?te(Object.keys(e)).sort((r,t)=>Number(r)-Number(t)).map(r=>e[r]):e}function ne(e){const r=e.indexOf("#");return r!==-1&&(e=e.slice(0,r)),e}function je(e){let r="";const t=e.indexOf("#");return t!==-1&&(r=e.slice(t)),r}function q(e,r,t){return t==="string"&&typeof e=="string"?e:typeof t=="function"&&typeof e=="string"?t(e):t==="boolean"&&e===null?!0:t==="boolean"&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")?e.toLowerCase()==="true":t==="boolean"&&e!==null&&(e.toLowerCase()==="1"||e.toLowerCase()==="0")?e.toLowerCase()==="1":t==="string[]"&&r.arrayFormat!=="none"&&typeof e=="string"?[e]:t==="number[]"&&r.arrayFormat!=="none"&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?[Number(e)]:t==="number"&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?Number(e):r.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")?e.toLowerCase()==="true":r.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?Number(e):e}function x(e){e=ne(e);const r=e.indexOf("?");return r===-1?"":e.slice(r+1)}function $(e,r){r={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...r},re(r.arrayFormatSeparator);const t=Le(r),n=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return n;for(const a of e.split("&")){if(a==="")continue;const s=r.decode?a.replaceAll("+"," "):a;let[o,i]=ee(s,"=");o===void 0&&(o=s),i=i===void 0?null:["comma","separator","bracket-separator"].includes(r.arrayFormat)?i:h(i,r),t(h(o,r),i,n)}for(const[a,s]of Object.entries(n))if(typeof s=="object"&&s!==null&&r.types[a]!=="string")for(const[o,i]of Object.entries(s)){const l=r.types[a],f=typeof l=="function"?l:l?l.replace("[]",""):void 0;s[o]=q(i,r,f)}else typeof s=="object"&&s!==null&&r.types[a]==="string"?n[a]=Object.values(s).join(r.arrayFormatSeparator):n[a]=q(s,r,r.types[a]);return r.sort===!1?n:(r.sort===!0?Object.keys(n).sort():Object.keys(n).sort(r.sort)).reduce((a,s)=>{const o=n[s];return a[s]=o&&typeof o=="object"&&!Array.isArray(o)?te(o):o,a},Object.create(null))}function ae(e,r){if(!e)return"";r={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...r},re(r.arrayFormatSeparator);const t=o=>r.skipNull&&xe(e[o])||r.skipEmptyString&&e[o]==="",n=Me(r),a={};for(const[o,i]of Object.entries(e))t(o)||(a[o]=i);const s=Object.keys(a);return r.sort!==!1&&s.sort(r.sort),s.map(o=>{let i=e[o];if(r.replacer&&(i=r.replacer(o,i),i===void 0)||i===void 0)return"";if(i===null)return c(o,r);if(Array.isArray(i)){if(i.length===0&&r.arrayFormat==="bracket-separator")return c(o,r)+"[]";let l=i;return r.replacer&&(l=i.map((f,u)=>r.replacer(`${o}[${u}]`,f)).filter(f=>f!==void 0)),l.reduce(n(o),[]).join("&")}return c(o,r)+"="+c(i,r)}).filter(o=>o.length>0).join("&")}function se(e,r){r={decode:!0,...r};let[t,n]=ee(e,"#");return t===void 0&&(t=e),{url:t?.split("?")?.[0]??"",query:$(x(e),r),...r&&r.parseFragmentIdentifier&&n?{fragmentIdentifier:h(n,r)}:{}}}function oe(e,r){r={encode:!0,strict:!0,[U]:!0,...r};const t=ne(e.url).split("?")[0]||"",n=x(e.url),a={...$(n,{sort:!1,...r}),...e.query};let s=ae(a,r);s&&=`?${s}`;let o=je(e.url);if(typeof e.fragmentIdentifier=="string"){const i=new URL(t);i.hash=e.fragmentIdentifier,o=r[U]?i.hash:`#${e.fragmentIdentifier}`}return`${t}${s}${o}`}function ie(e,r,t){t={parseFragmentIdentifier:!0,[U]:!1,...t};const{url:n,query:a,fragmentIdentifier:s}=se(e,t);return oe({url:n,query:Ue(a,r),fragmentIdentifier:s},t)}function De(e,r,t){const n=Array.isArray(r)?a=>!r.includes(a):(a,s)=>!r(a,s);return ie(e,n,t)}const Pe=Object.freeze(Object.defineProperty({__proto__:null,exclude:De,extract:x,parse:$,parseUrl:se,pick:ie,stringify:ae,stringifyUrl:oe},Symbol.toStringTag,{value:"Module"}));var N=function(e){return e.COMPONENT_READY="streamlit:componentReady",e.SET_COMPONENT_VALUE="streamlit:setComponentValue",e.SET_FRAME_HEIGHT="streamlit:setFrameHeight",e}({}),ke=function(e){return e.RENDER="streamlit:render",e}({});const Ve=1,F=Q.getLogger("componentUtils");function He(e){return(r,t)=>{if(!e.current)return;const{isReady:n,element:a,widgetMgr:s,setComponentError:o,componentReadyCallback:i,frameHeightCallback:l,fragmentId:f}=e.current,u=n();switch(r){case N.COMPONENT_READY:{const{apiVersion:y}=t;y!==Ve?o(new Error(`Unrecognized component API version: '${y}'`)):i();break}case N.SET_COMPONENT_VALUE:u?Ye(K(t,"value"),t.dataType,{fromUi:!0},a,s,f):F.warn(`Got ${r} before ${N.COMPONENT_READY}!`);break;case N.SET_FRAME_HEIGHT:u?l(K(t,"height")):F.warn(`Got ${r} before ${N.COMPONENT_READY}!`);break;default:F.warn(`Unrecognized ComponentBackMsgType: ${r}`)}}}function We(e,r){const t=JSON.parse(e),n=[];for(const a of r){const{key:s}=a;switch(a.value?.toLowerCase()){case"arrowdataframe":n.push({key:s,value:ge.toObject(a.arrowDataframe)});break;case"bytes":t[s]=a.bytes;break;default:throw new Error(`Unrecognized SpecialArg type: ${a.value}`)}}return[t,n]}function z(e,r,t,n,a){if(!a){F.warn("Can't send ForwardMsg; missing our iframe!");return}if(Z(a.contentWindow)){F.warn("Can't send ForwardMsg; iframe has no contentWindow!");return}a.contentWindow.postMessage({type:ke.RENDER,args:e,dfs:r,disabled:t,theme:{...me(n),font:n.genericFonts.bodyFont}},"*")}function Ye(e,r,t,n,a,s){if(e===void 0){F.warn("handleSetComponentValue: missing 'value' prop");return}switch(r){case"dataframe":a.setArrowValue(n,e,t,s);break;case"bytes":a.setBytesValue(n,e,t,s);break;default:a.setJsonValue(n,e,t,s)}}function K(e,r,t=void 0){return Object.hasOwn(e,r)?e[r]:t}const Ge=he("iframe",{target:"e1begtbc0"})(({theme:e,componentReady:r})=>({colorScheme:"normal",border:"none",padding:e.spacing.none,margin:e.spacing.none,display:r?"initial":"none"})),R=Q.getLogger("ComponentInstance"),J=6e4;function Be(e,r,t){let n;Oe(t)&&t!==""?n=t:n=r.getComponentURL(e,"index.html");const a=window.__streamlit?.CUSTOM_COMPONENT_CLIENT_ID,s=new URL(window.location.href);return n=Pe.stringifyUrl({url:n,query:{streamlitUrl:s.origin+s.pathname,...a&&{__streamlit_parent_client_id:a}}}),n}function X(e,r){let t;return r&&r!==""?t=`Your app is having trouble loading the **${e}** component.
2
+ The app is attempting to load the component from **${r}**,
3
+ and hasn't received its \`Streamlit.setComponentReady()\` message.
4
+
5
+ If this is a development build, have you started the dev server?
6
+
7
+ For more troubleshooting help, please see the [Streamlit Component docs](${W}) or visit our [forums](${Y}).`:t=`Your app is having trouble loading the **${e}** component.
8
+
9
+ If this is an installed component that works locally, the app may be having trouble accessing the component frontend assets due to network latency or proxy settings in your app deployment.
10
+
11
+ For more troubleshooting help, please see the [Streamlit Component docs](${W}) or visit our [forums](${Y}).`,t}function qe(e,r,t,n){if(!n)try{return We(e,r)}catch(a){const s=Ne(a);t(s)}return[{},[]]}function ze(e,r){return e===r||e.length===r.length&&e.every((t,n)=>{const a=r[n];return t.key===a.key&&t.value===a.value})}function Ke(e){const r=ye(),[t,n]=d.useState(),{disabled:a,element:s,widgetMgr:o,width:i,fragmentId:l,componentRegistry:f}=e,{componentName:u,jsonArgs:y,specialArgs:ce,url:O}=s,[_,M]=qe(y,ce,n,t),C=d.useMemo(()=>Be(u,f,O),[u,f,O]),m=d.useRef({args:{},dataframeArgs:[]}),L=ze(m.current.dataframeArgs,M);m.current.args=_,m.current.dataframeArgs=M;const[w,j]=d.useState(),[p,fe]=d.useState(()=>isNaN(_.height)?void 0:_.height),g=d.useRef(!1),E=d.useRef(null),D=d.useRef(),{clear:P}=V(()=>R.warn(X(u,O)),J/4),{clear:k}=V(()=>{I.flushSync(()=>{j(!0)})},J);if(d.useEffect(()=>{f.checkSourceUrlResponse(C,u)},[C,u,f]),d.useEffect(()=>{w&&!g.current&&(R.error(`Client Error: Custom Component ${u} timeout error`),f.sendTimeoutError(C,u))},[w,C,u,f]),d.useEffect(()=>{g.current&&z(m.current.args,m.current.dataframeArgs,a,r,E.current??void 0)},[a,p,L,y,r,i]),d.useEffect(()=>{const b=S=>{if(S===void 0){R.warn("handleSetFrameHeight: missing 'height' prop");return}if(S!==p){if(Z(E.current)){R.warn("handleSetFrameHeight: missing our iframeRef!");return}E.current.height=S.toString(),I.flushSync(()=>{fe(S)})}},le=()=>{z(m.current.args,m.current.dataframeArgs,a,r,E.current??void 0),P(),k(),g.current=!0,I.flushSync(()=>{j(!1)})};D.current={isReady:()=>g.current,element:s,widgetMgr:o,setComponentError:n,componentReadyCallback:le,frameHeightCallback:b,fragmentId:l}},[u,a,s,p,L,w,y,r,o,k,P,l]),d.useEffect(()=>{const b=E.current?.contentWindow??void 0;if(b)return f.registerListener(b,He(D)),()=>{b&&f.deregisterListener(b)}},[f,u]),t)return A(pe,{name:t.name,message:t.message});const ue=!g.current&&!w&&p!==0&&A(Ee,{element:H.create({height:p,style:H.SkeletonStyle.ELEMENT})}),de=!g.current&&w?A(Fe,{body:X(u,O),kind:be.WARNING}):null;return Ce(we,{children:[ue,de,A(Ge,{className:"stCustomComponentV1","data-testid":"stCustomComponentV1",allow:Re,ref:E,src:C,width:i,height:p??0,scrolling:"no",sandbox:Ae,title:u,componentReady:g.current,tabIndex:s.tabIndex??void 0})]})}const ve=Se(d.memo(Ke));export{ve as ComponentInstance,tr as ComponentRegistry};
@@ -0,0 +1,2 @@
1
+ import{H as _,r as u,Q as ao,ct as O,ck as co,W as io,g as lo,j as m,R as I,cu as fo,x as D,X as H}from"./index.CqTPbV5Y.js";function go(o,e,r,t){for(var n=-1,s=o==null?0:o.length;++n<s;)r=e(r,o[n],n,o);return r}function Co(o){return function(e){return o?.[e]}}var xo={À:"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"},po=Co(xo),mo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bo="\\u0300-\\u036f",ho="\\ufe20-\\ufe2f",Ro="\\u20d0-\\u20ff",So=bo+ho+Ro,yo="["+So+"]",Eo=RegExp(yo,"g");function vo(o){return o=_(o),o&&o.replace(mo,po).replace(Eo,"")}var wo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Bo(o){return o.match(wo)||[]}var Fo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function ko(o){return Fo.test(o)}var V="\\ud800-\\udfff",To="\\u0300-\\u036f",Ao="\\ufe20-\\ufe2f",Uo="\\u20d0-\\u20ff",Io=To+Ao+Uo,J="\\u2700-\\u27bf",Z="a-z\\xdf-\\xf6\\xf8-\\xff",zo="\\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",Wo="\\ufe0e\\ufe0f",Y=zo+Lo+Oo+Mo,q="['’]",M="["+Y+"]",jo="["+Io+"]",K="\\d+",$o="["+J+"]",X="["+Z+"]",Q="[^"+V+Y+K+J+Z+G+"]",No="\\ud83c[\\udffb-\\udfff]",Po="(?:"+jo+"|"+No+")",_o="[^"+V+"]",oo="(?:\\ud83c[\\udde6-\\uddff]){2}",eo="[\\ud800-\\udbff][\\udc00-\\udfff]",w="["+G+"]",Do="\\u200d",W="(?:"+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="["+Wo+"]?",Vo="(?:"+Do+"(?:"+[_o,oo,eo].join("|")+")"+to+ro+")*",Jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Zo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Go=to+ro+Vo,Yo="(?:"+[$o,oo,eo].join("|")+")"+Go,qo=RegExp([w+"?"+X+"+"+j+"(?="+[M,w,"$"].join("|")+")",Ho+"+"+$+"(?="+[M,w+W,"$"].join("|")+")",w+"?"+W+"+"+j,w+"+"+$,Zo,Jo,K,Yo].join("|"),"g");function Ko(o){return o.match(qo)||[]}function Xo(o,e,r){return o=_(o),e=e,e===void 0?ko(o)?Ko(o):Bo(o):o.match(e)||[]}var Qo="['’]",oe=RegExp(Qo,"g");function ee(o){return function(e){return go(Xo(vo(e).replace(oe,"")),o,"")}}var re=ee(function(o,e,r){return o+(r?"-":"")+e.toLowerCase()});const F=u.createContext(null);F.displayName="BidiComponentContext";const B=ao.getLogger("BidiComponent"),N="__",A="__streamlit_arrow_ref__",te="$$STREAMLIT_INTERNAL_KEY",ne=(o,e)=>{if(o&&typeof o=="object"&&!Array.isArray(o)){if(typeof o[A]=="string"){const t=o[A],n=e[t];if(n)try{return O(n)}catch{return null}return null}const r={};for(const[t,n]of Object.entries(o))if(n&&typeof n=="object"&&!Array.isArray(n)&&typeof n[A]=="string"){const s=n[A],a=e[s];if(a)try{r[t]=O(a)}catch{r[t]=null}else r[t]=null}else r[t]=n;return r}return o},se=({arrowBlobs:o,arrowData:e,bytes:r,data:t,json:n,mixedJson:s})=>{switch(t){case"json":return n?JSON.parse(n):null;case"arrowData":return e??null;case"bytes":return r??null;case"mixed":{if(s&&o&&s){const a=JSON.parse(s),i={};return o&&Object.entries(o).forEach(([f,l])=>{l?.data&&(i[f]=l.data)}),ne(a,i)}return null}case"any":case void 0:return null;default:co(t)}},ue=(o,e="--st")=>{const r={};return Object.entries(o).forEach(([t,n])=>{const s=re(t),a=`${e}-${s}`;if(typeof n=="boolean"){r[a]=n?"1":"0";return}r[a]=String(n)}),r},ae=o=>({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:[o.fontSizes.h1FontSize,o.fontSizes.h2FontSize,o.fontSizes.h3FontSize,o.fontSizes.h4FontSize,o.fontSizes.h5FontSize,o.fontSizes.h6FontSize],headingFontWeights:[o.fontWeights.h1FontWeight,o.fontWeights.h2FontWeight,o.fontWeights.h3FontWeight,o.fontWeights.h4FontWeight,o.fontWeights.h5FontWeight,o.fontWeights.h6FontWeight],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,headingColor:o.colors.headingColor,borderColorLight:o.colors.borderColorLight,codeTextColor:o.colors.codeTextColor,widgetBorderColor:o.colors.widgetBorderColor,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}),ce=u.memo(({element:o,children:e,widgetMgr:r,fragmentId:t,componentRegistry:n})=>{const{arrowData:s,bytes:a,componentName:i,cssContent:f,cssSourcePath:l,data:d,htmlContent:c,id:S,jsContent:b,json:x,jsSourcePath:p,mixed:g}=o,y=u.useMemo(()=>({id:o.id,formId:o.formId}),[o.id,o.formId]),k=u.useCallback(()=>{const v=r.getJsonValue(y);if(!v)return{};try{return JSON.parse(v)}catch(z){const R=io(z);return B.warn("Failed to parse widget JSON value; returning empty object.",{widgetId:y.id,formId:y.formId,error:R.message}),{}}},[y,r]),T=u.useMemo(()=>se({arrowBlobs:g?.arrowBlobs||void 0,arrowData:s?.data||void 0,bytes:a,data:d,json:x,mixedJson:g?.json||void 0}),[d,x,s?.data,a,g?.json,g?.arrowBlobs]),h=lo(),E=u.useMemo(()=>ae(h),[h]),C=u.useMemo(()=>({componentName:i,componentRegistry:n,cssContent:f?.trim(),cssSourcePath:l||void 0,data:T,fragmentId:t,getWidgetValue:k,htmlContent:c?.trim(),id:S,formId:o.formId||void 0,jsContent:b||void 0,jsSourcePath:p||void 0,theme:E,widgetMgr:r}),[i,n,f,l,t,k,c,S,o.formId,b,p,T,E,r]);return m(F.Provider,{value:C,children:e})}),no=(o,e)=>{if(o instanceof Error)return o;const r=e?`${e}: ${String(o)}`:String(o);return new Error(r)},U=(o,e,r)=>{const t=no(o,r);B.error(`BidiComponent Error: ${t.message}`,o),e(t)},ie=(o,e)=>{try{const t=document.createRange().createContextualFragment(o);e.appendChild(t)}catch(r){B.warn("createContextualFragment failed, falling back to innerHTML",r),e.innerHTML=o}},so=({containerRef:o,setError:e,skip:r=!1})=>{const t=u.useRef(null),{htmlContent:n,cssContent:s,cssSourcePath:a,componentName:i,componentRegistry:{getBidiComponentURL:f}}=I(F),l=u.useMemo(()=>{if(a)return f(i,a)},[i,a,f]);return u.useEffect(()=>{if(r)return;const d=o.current;if(d)try{if(t.current?.parentNode===d&&d.removeChild(t.current),t.current=document.createElement("div"),n){const c=document.createElement("div");ie(n,c),t.current.appendChild(c)}if(s){const c=document.createElement("style");c.textContent=s,t.current.appendChild(c)}else if(l){const c=document.createElement("link");c.href=l,c.rel="stylesheet",c.onerror=()=>{U(new Error(`Failed to load CSS from ${l}`),e)},t.current.appendChild(c)}d.appendChild(t.current)}catch(c){U(c,e,"Failed to process HTML/CSS content")}},[n,s,o,l,e,r]),t};class le{constructor(){this.hashSeed=2166136261,this.hashPrime=16777619,this.cache=new Map}computeHash(e){let r=this.hashSeed;for(let t=0;t<e.length;t++)r^=e.charCodeAt(t),r=Math.imul(r>>>0,this.hashPrime)>>>0;return(r>>>0).toString(16)}getOrCreateUrlForJs(e,r){const t=this.computeHash(e),n=this.cache.get(t);if(n)return{url:n,hash:t};const s=`${e}
2
+ //# sourceURL=${r}-${t}.js`,a=new Blob([s],{type:"text/javascript"}),i=URL.createObjectURL(a);return this.cache.set(t,i),{url:i,hash:t}}}const de=new le,fe="events";function ge(o){if(o.includes(N))throw new Error("Base component id must not contain the delimiter sequence");return`${te}_${o}${N}${fe}`}const P=async({componentId:o,componentIdForWidgetMgr:e,componentName:r,data:t,formId:n,fragmentId:s,getWidgetValue:a,moduleUrl:i,parentElement:f,widgetMgr:l})=>{const d=await import(i);if(!d)throw new Error("JS module does not exist.");if(!d.default||typeof d.default!="function")throw new Error("JS module does not have a default export function.");const c=(b,x)=>{let p={};try{p={...a(),[b]:x}}catch(g){B.error(`Failed to get existing value for ${b}`,g),p={[b]:x}}l.setJsonValue({id:e,formId:n},p,{fromUi:!0},s)},S=(b,x)=>{if(n){B.warn("BidiComponent: setTriggerValue ignored inside st.form. Triggers are not allowed in forms; use setStateValue and form submit instead.");return}const p=ge(e);l.setTriggerValue({id:p,formId:n},{fromUi:!0},s,{event:b,value:x})};return d.default({name:r,data:t,key:o,parentElement:f,setStateValue:c,setTriggerValue:S})},uo=({containerRef:o,setError:e,skip:r=!1})=>{const n=`st-bidi-component-${u.useMemo(()=>fo(),[])}`,{componentName:s,data:a,formId:i,fragmentId:f,getWidgetValue:l,id:d,jsContent:c,jsSourcePath:S,theme:b,widgetMgr:x,componentRegistry:{getBidiComponentURL:p}}=I(F),g=u.useMemo(()=>{if(S)return p(s,S)},[s,S,p]),y=u.useRef(),k=u.useRef(),T=u.useRef(!1);u.useEffect(()=>{const{current:h}=o;if(r||!c&&!g||!h)return;(async()=>{try{if(c){const{url:C}=de.getOrCreateUrlForJs(c,`st-bidi-${s}`);y.current=await P({componentId:n,componentIdForWidgetMgr:d,componentName:s,data:a,formId:i,fragmentId:f,getWidgetValue:l,moduleUrl:C,parentElement:h,widgetMgr:x})}else if(g){const C=g;try{await new Promise((v,z)=>{const R=document.createElement("script");R.type="module",R.src=C,R.async=!0,R.onload=()=>v(),R.onerror=()=>z(new Error(`Failed to load script from ${g}`)),document.head.appendChild(R),k.current=R}),y.current=await P({componentId:n,componentIdForWidgetMgr:d,componentName:s,data:a,formId:i,fragmentId:f,getWidgetValue:l,moduleUrl:C,parentElement:h,widgetMgr:x})}catch(v){throw no(v,`Failed to load or execute script from ${g}`)}}}catch(C){T.current||U(C,e)}})()},[n,s,o,a,i,f,l,d,c,g,e,r,x,b]),u.useEffect(()=>()=>{T.current=!0;const h=y.current;h&&Promise.resolve(h).then(C=>{C?.()}).catch(C=>{B.error("Failed to run custom component cleanup",C)});const E=k.current;E?.parentNode&&E.parentNode.removeChild(E)},[])},Ce=D("div",{target:"e10xsstg0"})(({cssCustomProperties:o})=>({...o,display:"contents"})),L=D("div",{target:"e10xsstg1"})({width:"100%",height:"100%"}),xe=u.memo(()=>{const o=u.useRef(null),e=u.useRef(null),[r,t]=u.useState(!1),[n,s]=u.useState(null),{id:a}=I(F);u.useEffect(()=>{if(o.current)try{if(o.current.shadowRoot){e.current=o.current.shadowRoot,t(!0);return}e.current=o.current.attachShadow({mode:"open"}),t(!0)}catch(f){U(f,s,"Failed to create shadow DOM")}},[a]);const i=!r||!!n;return so({containerRef:e,setError:s,skip:i}),uo({containerRef:e,setError:s,skip:i}),n?m(H,{name:"BidiComponent Error",message:n.message,stack:n.stack}):m(L,{ref:o,"data-testid":"stBidiComponentIsolated"})}),pe=u.memo(()=>{const o=u.useRef(null),[e,r]=u.useState(null),t=!!e;return so({containerRef:o,setError:r,skip:t}),uo({containerRef:o,setError:r,skip:t}),e?m(H,{name:"BidiComponent Error",message:e.message,stack:e.stack}):m(L,{ref:o,"data-testid":"stBidiComponentRegular"})}),me=({children:o})=>{const{theme:e}=I(F),r=u.useMemo(()=>ue(e),[e]);return m(Ce,{cssCustomProperties:r,children:o})},be=({element:o,widgetMgr:e,fragmentId:r,componentRegistry:t})=>{const{isolateStyles:n}=o;return m(ce,{element:o,widgetMgr:e,fragmentId:r,componentRegistry:t,children:m(L,{className:"stBidiComponent",children:m(me,{children:n?m(xe,{}):m(pe,{})})})})},Re=u.memo(be);export{F as BidiComponentContext,Re as default};
@@ -0,0 +1 @@
1
+ import{r as n,E as V,_ as M,x as p,aI as be,l as S,j as l,ax as I,b as L,c as we,B as k,h as Ue,a0 as ve,f as ze,aj as ee,bn as Ce,e as D,bU as Ie,m as Be,ab as Ee,T as De,P as Le,ac as ke,bM as Pe,bN as Ve}from"./index.CqTPbV5Y.js";import{u as Me}from"./FormClearHelper.-9RbsnV0.js";import{g as oe,F as P,a as Te,D as Re,I as Ne,C as Ae,s as We,b as He}from"./FileHelper.5nCh9KDY.js";import{S as $e,P as je}from"./ProgressBar.BxmfHxKu.js";import{U as j}from"./UploadFileInfo.C-jY39rj.js";const Xe=e=>{const t=n.useRef();return n.useEffect(()=>{t.current=e},[e]),t.current};var ne=n.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(V,M({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),n.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z"}))});ne.displayName="ChevronLeft";var ae=n.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(V,M({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),n.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z"}))});ae.displayName="ChevronRight";var se=n.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(V,M({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),n.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});se.displayName="CloudUpload";var le=n.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(V,M({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});le.displayName="Error";const ie=p("section",{target:"e16n7gab0"})(({isDisabled:e,theme:t})=>({display:"flex",gap:t.spacing.lg,alignItems:"center",padding:t.spacing.lg,backgroundColor:t.colors.secondaryBg,borderRadius:t.radii.default,border:t.colors.widgetBorderColor?`${t.sizes.borderWidth} solid ${t.colors.widgetBorderColor}`:void 0,height:t.sizes.largestElementHeight,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${t.colors.primary}`},cursor:e?"not-allowed":"pointer"})),Oe=p("div",{target:"e16n7gab1"})(({theme:e})=>({marginRight:"auto",alignItems:"center",display:"flex",gap:e.spacing.lg,minWidth:0,width:"100%"})),re=p("span",{target:"e16n7gab2"})(({theme:e})=>({color:e.colors.darkenedBgMix100})),ce=p("span",{target:"e16n7gab3"})(({theme:e,disabled:t})=>({color:t?e.colors.fadedText40:e.colors.bodyText})),_e=p("span",{target:"e16n7gab4"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.sm,color:t?e.colors.fadedText40:e.colors.fadedText60,display:"block",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",maxWidth:"100%"})),qe=p("div",{target:"e16n7gab5"})({display:"flex",flexDirection:"column",minWidth:0,maxWidth:"100%"}),Ge=p("span",{target:"e16n7gab6"})({whiteSpace:"nowrap"}),de=p("div",{target:"e16n7gab7"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg})),Ke=p("ul",{target:"e16n7gab8"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none})),pe=p("li",{target:"e16n7gab9"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none})),ue=p("div",{target:"e16n7gab10"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"})),ge=p("div",{target:"e16n7gab11"})(({theme:e,disabled:t})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t?e.colors.fadedText40:e.colors.bodyText})),fe=p("div",{target:"e16n7gab12"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS})),Ye=p("span",{target:"e16n7gab13"})(({theme:e})=>({marginRight:e.spacing.twoXS})),Je=p("div",{target:"e16n7gab14"})(({theme:e,disabled:t})=>({display:"flex",padding:e.spacing.twoXS,color:t?e.colors.fadedText40:e.colors.darkenedBgMix100})),he=p("small",{target:"e16n7gab15"})(({theme:e})=>({color:e.colors.redTextColor,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"})),Fe=p("span",{target:"e16n7gab16"})({}),Qe=e=>({[ie]:{display:"flex",flexDirection:"column",alignItems:"flex-start",height:"auto",gap:e.spacing.sm},[re]:{display:"none"},[ce]:{marginBottom:e.spacing.twoXS},[de]:{paddingRight:e.spacing.lg},[fe]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[ge]:{width:e.sizes.full},[ue]:{flexDirection:"column"},[he]:{height:"auto",whiteSpace:"initial"},[Fe]:{display:"none"},[pe]:{margin:e.spacing.none,padding:e.spacing.none}}),Ze=p("div",{target:"e16n7gab17"})(({theme:e,width:t})=>{if(t<be("23rem"))return Qe(e)}),et=({multiple:e,acceptedExtensions:t,maxSizeBytes:o,acceptDirectory:i=!1,disabled:d})=>{const x=()=>i?"directories":e?"files":"file",c=()=>t.length?` • ${t.map(y=>y.replace(/^\./,"").toUpperCase()).join(", ")}`:null,F=()=>`Limit ${oe(o,P.Byte,0)} per file`;return S(Oe,{"data-testid":"stFileUploaderDropzoneInstructions",children:[l(re,{children:l(I,{content:se,size:"threeXL"})}),S(qe,{children:[S(ce,{disabled:d,children:["Drag and drop ",x()," here"]}),S(_e,{disabled:d,children:[F(),c()]})]})]})},tt=n.memo(et),ot=({onDrop:e,multiple:t,acceptedExtensions:o,maxSizeBytes:i,disabled:d,label:x,acceptDirectory:c=!1})=>l(Re,{onDrop:e,multiple:t,accept:Te(o),maxSize:i,disabled:d,useFsAccessApi:!1,children:({getRootProps:F,getInputProps:y})=>{const U=y({multiple:t||!!c});return S(ie,{...F(),"data-testid":"stFileUploaderDropzone",isDisabled:d,"aria-label":x,"aria-disabled":d,children:[l("input",{"data-testid":"stFileUploaderDropzoneInput",...U,...c&&{webkitdirectory:""}}),l(tt,{multiple:t,acceptedExtensions:o,maxSizeBytes:i,acceptDirectory:c,disabled:d}),l(Ge,{children:l(L,{kind:k.SECONDARY,disabled:d,size:we.SMALL,children:c?"Browse directories":"Browse files"})})]})}}),nt=n.memo(ot),me=p("small",{target:"ek5bcwe0"})(({kind:e,disabled:t,theme:o})=>{const{redTextColor:i,fadedText60:d,fadedText40:x}=o.colors;let c=d;return t&&(c=x),e==="danger"&&(c=i),{color:c,fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.tight}}),at=({fileInfo:e,disabled:t})=>e.status.type==="uploading"?l(je,{value:e.status.progress,size:$e.SMALL}):e.status.type==="error"?S(he,{children:[l(Ye,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),l(Fe,{children:l(I,{content:le,size:"lg"})})]}):e.status.type==="uploaded"?l(me,{disabled:t,children:oe(e.size,P.Byte)}):null,st=({fileInfo:e,onDelete:t,disabled:o})=>S(fe,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[l(Je,{disabled:o,children:l(I,{content:Ne,size:"twoXL"})}),S(ue,{className:"stFileUploaderFileData",children:[l(ge,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,disabled:o,children:e.name}),l(at,{fileInfo:e,disabled:o})]}),l("div",{"data-testid":"stFileUploaderDeleteBtn",children:l(L,{onClick:()=>t(e.id),kind:k.MINIMAL,disabled:o,"aria-label":`Remove ${e.name}`,children:l(I,{content:Ae,size:"lg"})})})]}),lt=n.memo(st),it=p("div",{target:"egc9vxm0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS})),rt=p("div",{target:"egc9vxm1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40})),ct=({currentPage:e,totalPages:t,onNext:o,onPrevious:i})=>S(it,{"data-testid":"stFileUploaderPagination",children:[l(me,{children:`Showing page ${e} of ${t}`}),S(rt,{children:[l(L,{onClick:i,kind:k.MINIMAL,children:l(I,{content:ne,size:"xl"})}),l(L,{onClick:o,kind:k.MINIMAL,children:l(I,{content:ae,size:"xl"})})]})]}),dt=n.memo(ct),te=(e,t)=>Math.ceil(e.length/t),pt=e=>Ue(({pageSize:o,items:i,resetOnAdd:d,...x})=>{const[c,F]=n.useState(0),[y,U]=n.useState(()=>te(i,o)),u=Xe(i);n.useEffect(()=>{u&&u.length!==i.length&&U(te(i,o)),u&&u.length<i.length?d&&F(0):c+1>=y&&F(y-1)},[i,c,o,u,d,y]);const B=()=>{F(Math.min(c+1,y-1))},v=()=>{F(Math.max(0,c-1))},T=i.slice(c*o,c*o+o);return S(ve,{children:[l(e,{items:T,...x}),i.length>o?l(dt,{pageSize:o,totalPages:y,currentPage:c+1,onNext:B,onPrevious:v}):null]})},e),ut=({items:e,onDelete:t,disabled:o})=>l(Ke,{children:e.map(i=>l(pe,{children:l(lt,{fileInfo:i,onDelete:t,disabled:o})},i.id))}),gt=pt(ut),ft=e=>l(de,{children:l(gt,{...e})}),ht=n.memo(ft),Ft=(e,t)=>{const o=t.getFileUploaderStateValue(e);if(D(o))return{files:[],nextLocalId:1};const{uploadedFileInfo:i}=o;if(D(i)||i.length===0)return{files:[],nextLocalId:1};let d=1;return{files:i.map(c=>{const F=c.name,y=c.size,U=c.fileId,u=c.fileUrls,B=new j(F,y,d,{type:"uploaded",fileId:U,fileUrls:u});return d+=1,B}),nextLocalId:d}},$=e=>{const t=e.filter(o=>o.status.type==="uploaded").map(o=>{const{name:i,size:d,status:x}=o,{fileId:c,fileUrls:F}=x;return new Pe({fileId:c,fileUrls:F,name:i,size:d})});return new Ve({uploadedFileInfo:t})},mt=({disabled:e,element:t,widgetMgr:o,uploadClient:i,fragmentId:d})=>{const{width:x,elementRef:c}=ze(),{files:F,nextLocalId:y}=n.useMemo(()=>Ft(t,o),[t,o]),U=n.useRef(y),[u,B]=n.useState(()=>F),v=n.useRef(u);n.useEffect(()=>{v.current=u},[u]);const[T,X]=n.useState(!1),E=n.useCallback(()=>{const a=U.current;return U.current+=1,a},[]),R=n.useMemo(()=>{const a=t.maxUploadSizeMb;return We(a,P.Megabyte,P.Byte)},[t.maxUploadSizeMb]),w=n.useCallback(a=>{ee.flushSync(()=>{B(s=>{const r=typeof a=="function"?a(s):a;return v.current=r,r})})},[]),N=n.useCallback(a=>{ee.flushSync(()=>{X(a)})},[X]),O=n.useCallback(a=>{w(s=>[...s,a])},[w]),A=n.useCallback(a=>{a.length!==0&&w(s=>[...s,...a])},[w]),_=n.useCallback(a=>{w(s=>s.filter(r=>r.id!==a))},[w]),z=n.useCallback((a,s)=>{w(r=>r.map(g=>g.id===a?s:g))},[w]),C=n.useCallback(a=>v.current.find(s=>s.id===a),[]),q=u.some(a=>a.status.type==="uploading")||T?"updating":"ready";n.useEffect(()=>{o.getFileUploaderStateValue(t)===void 0&&o.setFileUploaderStateValue(t,$(v.current),{fromUi:!1},d)},[o,t,d]),n.useEffect(()=>{if(q!=="ready")return;const a=$(u),s=o.getFileUploaderStateValue(t);Ce(a,s)||o.setFileUploaderStateValue(t,a,{fromUi:!0},d)},[q,u,o,t,d]);const ye=n.useCallback(()=>{w(()=>[]);const a=$([]);o.setFileUploaderStateValue(t,a,{fromUi:!0},d)},[t,d,w,o]);Me({element:t,widgetMgr:o,onFormCleared:ye});const G=n.useCallback(a=>{const s=t.type;if(!s||s.length===0)return!0;const r=a.name.toLowerCase();return s.some(g=>r.endsWith(g.toLowerCase()))},[t.type]),K=n.useCallback(a=>{const s=[],r=[];return a.forEach(g=>{G(g)?s.push(g):r.push({file:g,errors:[{code:"file-invalid-type",message:`${g.type} files are not allowed.`}]})}),{accepted:s,rejected:r}},[G]),Y=n.useCallback((a,s)=>{const r=C(a);D(r)||r.status.type!=="uploading"||z(r.id,r.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},[C,z]),J=n.useCallback((a,s)=>{const r=C(s);if(D(r)||r.status.type!=="uploading")return;const g=Math.round(a.loaded*100/a.total);r.status.progress!==g&&z(s,r.setStatus({type:"uploading",abortController:r.status.abortController,progress:g}))},[C,z]),Q=n.useCallback((a,s)=>{const r=new AbortController,g=s.webkitRelativePath||s.name,f=new j(g,s.size,E(),{type:"uploading",abortController:r,progress:1});O(f),i.uploadFile(t,a.uploadUrl,s,h=>J(h,f.id),r.signal).then(()=>Y(f.id,a)).catch(h=>{h instanceof DOMException&&h.name==="AbortError"||z(f.id,f.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},[O,t,E,Y,J,z,i]),W=n.useCallback(a=>{if(e)return;const s=C(a);D(s)||(s.status.type==="uploading"&&s.status.abortController.abort(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&i.deleteFile(s.status.fileUrls.deleteUrl),_(a))},[e,C,_,i]),xe=n.useCallback((a,s)=>{const{multipleFiles:r}=t,g=!!t.acceptDirectory;let f=[...a],h=[...s];if(g&&f.length>0){const{accepted:b,rejected:m}=K(f);f=b,h=[...h,...m]}if(!r&&f.length===0&&h.length>1){const b=h.findIndex(m=>m.errors.length===1&&m.errors[0].code==="too-many-files");b>=0&&(f.push(h[b].file),h.splice(b,1))}if(i.fetchFileURLs(f).then(b=>{if(!r&&f.length>0){const m=v.current.find(H=>H.status.type!=="error");if(m){N(!0);try{W(m.id)}finally{N(!1)}}}Ie(b,f).forEach(([m,H])=>{Q(m,H)})}).catch(b=>{A(f.map(m=>new j(m.name,m.size,E(),{type:"error",errorMessage:b})))}),h.length>0){const b=h.map(m=>He(m,E(),R));A(b)}},[A,W,t,K,R,E,i,Q,N]),Z=n.useMemo(()=>u.slice().reverse(),[u]),Se=t.type;return S(Ze,{className:"stFileUploader","data-testid":"stFileUploader",width:x,ref:c,children:[l(ke,{label:t.label,disabled:e,labelVisibility:Be(t.labelVisibility?.value),children:t.help&&l(Ee,{children:l(De,{content:t.help,placement:Le.TOP_RIGHT})})}),l(nt,{onDrop:xe,multiple:t.multipleFiles,acceptedExtensions:Se,maxSizeBytes:R,label:t.label,disabled:e,acceptDirectory:!!t.acceptDirectory}),Z.length>0&&l(ht,{items:Z,pageSize:3,onDelete:W,resetOnAdd:!0,disabled:e})]})},Ut=n.memo(mt);export{Ut as default};
@@ -1,2 +1,2 @@
1
- import{o as v,r as l,p as k,q as S,A as p}from"./index.CAj-7vWz.js";import{R as C,I as w,g as J,B as M}from"./base-input.CJGiNqed.js";function _(e){"@babel/helpers - typeof";return _=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},_(e)}var U=["Root","StartEnhancer","EndEnhancer"],Z=["startEnhancer","endEnhancer","overrides"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function O(e,t){return V(e)||Q(e,t)||K(e,t)||G()}function G(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K(e,t){if(e){if(typeof e=="string")return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j(e,t)}}function j(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Q(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,u;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(b){a=!0,u=b}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}return n}}function V(e){if(Array.isArray(e))return e}function I(e,t){if(e==null)return{};var r=X(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function te(e,t,r){return t&&ee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function re(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&&m(e,t)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},m(e,t)}function ne(e){var t=ae();return function(){var n=h(e),o;if(t){var a=h(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return oe(this,o)}}function oe(e,t){if(t&&(_(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(){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 h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},h(e)}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ie=function(e){re(r,e);var t=ne(r);function r(){var n;Y(this,r);for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=t.call.apply(t,[this].concat(a)),d(y(n),"state",{isFocused:n.props.autoFocus||!1}),d(y(n),"onFocus",function(u){n.setState({isFocused:!0}),n.props.onFocus(u)}),d(y(n),"onBlur",function(u){n.setState({isFocused:!1}),n.props.onBlur(u)}),n}return te(r,[{key:"render",value:function(){var o=this.props,a=o.startEnhancer,i=o.endEnhancer,u=o.overrides,b=u.Root,A=u.StartEnhancer,B=u.EndEnhancer,F=I(u,U),T=I(o,Z),x=v(b,C),g=O(x,2),$=g[0],N=g[1],D=v(A,w),E=O(D,2),W=E[0],q=E[1],z=v(B,w),P=O(z,2),H=P[0],L=P[1],c=J(this.props,this.state);return l.createElement($,f({"data-baseweb":"input"},c,N,{$adjoined:R(a,i),$hasIconTrailing:this.props.clearable||this.props.type=="password"}),s(a)&&l.createElement(W,f({},c,q,{$position:S.start}),typeof a=="function"?a(c):a),l.createElement(M,f({},T,{overrides:F,adjoined:R(a,i),onFocus:this.onFocus,onBlur:this.onBlur})),s(i)&&l.createElement(H,f({},c,L,{$position:S.end}),typeof i=="function"?i(c):i))}}]),r}(l.Component);d(ie,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:k.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});function R(e,t){return s(e)&&s(t)?p.both:s(e)?p.left:s(t)?p.right:p.none}function s(e){return!!(e||e===0)}export{ie as I};
1
+ import{s as v,r as l,v as q,w,A as p}from"./index.CqTPbV5Y.js";import{R as C,I as S,g as J,B as M}from"./base-input.BXTqYbyG.js";function _(e){"@babel/helpers - typeof";return _=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},_(e)}var U=["Root","StartEnhancer","EndEnhancer"],Z=["startEnhancer","endEnhancer","overrides"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function O(e,t){return V(e)||Q(e,t)||K(e,t)||G()}function G(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K(e,t){if(e){if(typeof e=="string")return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j(e,t)}}function j(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Q(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,u;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(b){a=!0,u=b}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}return n}}function V(e){if(Array.isArray(e))return e}function I(e,t){if(e==null)return{};var r=X(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function te(e,t,r){return t&&ee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function re(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&&m(e,t)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},m(e,t)}function ne(e){var t=ae();return function(){var n=h(e),o;if(t){var a=h(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return oe(this,o)}}function oe(e,t){if(t&&(_(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(){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 h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},h(e)}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ie=function(e){re(r,e);var t=ne(r);function r(){var n;Y(this,r);for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=t.call.apply(t,[this].concat(a)),d(y(n),"state",{isFocused:n.props.autoFocus||!1}),d(y(n),"onFocus",function(u){n.setState({isFocused:!0}),n.props.onFocus(u)}),d(y(n),"onBlur",function(u){n.setState({isFocused:!1}),n.props.onBlur(u)}),n}return te(r,[{key:"render",value:function(){var o=this.props,a=o.startEnhancer,i=o.endEnhancer,u=o.overrides,b=u.Root,A=u.StartEnhancer,B=u.EndEnhancer,F=I(u,U),T=I(o,Z),x=v(b,C),g=O(x,2),$=g[0],N=g[1],D=v(A,S),E=O(D,2),W=E[0],z=E[1],H=v(B,S),P=O(H,2),L=P[0],k=P[1],c=J(this.props,this.state);return l.createElement($,f({"data-baseweb":"input"},c,N,{$adjoined:R(a,i),$hasIconTrailing:this.props.clearable||this.props.type=="password"}),s(a)&&l.createElement(W,f({},c,z,{$position:w.start}),typeof a=="function"?a(c):a),l.createElement(M,f({},T,{overrides:F,adjoined:R(a,i),onFocus:this.onFocus,onBlur:this.onBlur})),s(i)&&l.createElement(L,f({},c,k,{$position:w.end}),typeof i=="function"?i(c):i))}}]),r}(l.Component);d(ie,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:q.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});function R(e,t){return s(e)&&s(t)?p.both:s(e)?p.left:s(t)?p.right:p.none}function s(e){return!!(e||e===0)}export{ie as I};