streamlit 1.51.0__py3-none-any.whl → 1.52.0__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.
- streamlit/__init__.py +1 -0
- streamlit/commands/execution_control.py +89 -14
- streamlit/components/v1/component_arrow.py +7 -7
- streamlit/components/v2/__init__.py +59 -3
- streamlit/components/v2/bidi_component/main.py +161 -13
- streamlit/components/v2/bidi_component/serialization.py +13 -6
- streamlit/components/v2/component_manager.py +11 -3
- streamlit/components/v2/component_registry.py +18 -1
- streamlit/components/v2/types.py +2 -2
- streamlit/connections/snowflake_connection.py +1 -1
- streamlit/connections/snowpark_connection.py +1 -1
- streamlit/dataframe_util.py +18 -18
- streamlit/delta_generator.py +7 -0
- streamlit/delta_generator_singletons.py +8 -14
- streamlit/elements/alert.py +16 -0
- streamlit/elements/arrow.py +36 -6
- streamlit/elements/bokeh_chart.py +10 -78
- streamlit/elements/code.py +2 -2
- streamlit/elements/deck_gl_json_chart.py +1 -1
- streamlit/elements/exception.py +1 -1
- streamlit/elements/form.py +27 -0
- streamlit/elements/heading.py +60 -5
- streamlit/elements/html.py +13 -2
- streamlit/elements/image.py +1 -1
- streamlit/elements/layouts.py +28 -22
- streamlit/elements/lib/built_in_chart_utils.py +49 -16
- streamlit/elements/lib/color_util.py +1 -1
- streamlit/elements/lib/column_config_utils.py +6 -5
- streamlit/elements/lib/layout_utils.py +50 -0
- streamlit/elements/lib/pandas_styler_utils.py +17 -9
- streamlit/elements/lib/shortcut_utils.py +152 -0
- streamlit/elements/markdown.py +50 -3
- streamlit/elements/metric.py +31 -1
- streamlit/elements/plotly_chart.py +75 -6
- streamlit/elements/spinner.py +1 -1
- streamlit/elements/text.py +20 -3
- streamlit/elements/toast.py +2 -0
- streamlit/elements/vega_charts.py +17 -1
- streamlit/elements/widgets/audio_input.py +8 -7
- streamlit/elements/widgets/button.py +279 -40
- streamlit/elements/widgets/button_group.py +27 -2
- streamlit/elements/widgets/camera_input.py +1 -1
- streamlit/elements/widgets/chat.py +300 -42
- streamlit/elements/widgets/color_picker.py +7 -0
- streamlit/elements/widgets/data_editor.py +68 -28
- streamlit/elements/widgets/file_uploader.py +4 -1
- streamlit/elements/widgets/number_input.py +2 -0
- streamlit/elements/widgets/text_widgets.py +2 -0
- streamlit/elements/widgets/time_widgets.py +581 -9
- streamlit/errors.py +22 -0
- streamlit/git_util.py +1 -1
- streamlit/navigation/page.py +7 -0
- streamlit/net_util.py +2 -2
- streamlit/proto/Alert_pb2.pyi +3 -3
- streamlit/proto/AppPage_pb2.pyi +7 -1
- streamlit/proto/ArrowData_pb2.pyi +7 -1
- streamlit/proto/ArrowNamedDataSet_pb2.pyi +7 -1
- streamlit/proto/ArrowVegaLiteChart_pb2.pyi +7 -1
- streamlit/proto/Arrow_pb2.py +10 -10
- streamlit/proto/Arrow_pb2.pyi +19 -12
- streamlit/proto/AudioInput_pb2.pyi +7 -1
- streamlit/proto/Audio_pb2.pyi +7 -1
- streamlit/proto/AuthRedirect_pb2.pyi +7 -1
- streamlit/proto/AutoRerun_pb2.pyi +7 -1
- streamlit/proto/BackMsg_pb2.py +4 -2
- streamlit/proto/BackMsg_pb2.pyi +34 -4
- streamlit/proto/Balloons_pb2.pyi +7 -1
- streamlit/proto/BidiComponent_pb2.pyi +10 -4
- streamlit/proto/Block_pb2.pyi +35 -35
- streamlit/proto/BokehChart_pb2.pyi +7 -1
- streamlit/proto/ButtonGroup_pb2.pyi +9 -9
- streamlit/proto/Button_pb2.py +2 -2
- streamlit/proto/Button_pb2.pyi +11 -2
- streamlit/proto/CameraInput_pb2.pyi +7 -1
- streamlit/proto/ChatInput_pb2.py +6 -6
- streamlit/proto/ChatInput_pb2.pyi +18 -6
- streamlit/proto/Checkbox_pb2.pyi +3 -3
- streamlit/proto/ClientState_pb2.pyi +10 -4
- streamlit/proto/Code_pb2.pyi +7 -1
- streamlit/proto/ColorPicker_pb2.pyi +7 -1
- streamlit/proto/Common_pb2.py +3 -3
- streamlit/proto/Common_pb2.pyi +35 -23
- streamlit/proto/Components_pb2.pyi +19 -13
- streamlit/proto/DataFrame_pb2.pyi +55 -49
- streamlit/proto/DateInput_pb2.pyi +7 -1
- streamlit/proto/DateTimeInput_pb2.py +28 -0
- streamlit/proto/DateTimeInput_pb2.pyi +92 -0
- streamlit/proto/DeckGlJsonChart_pb2.pyi +3 -3
- streamlit/proto/Delta_pb2.pyi +7 -1
- streamlit/proto/DocString_pb2.pyi +10 -4
- streamlit/proto/DownloadButton_pb2.py +2 -2
- streamlit/proto/DownloadButton_pb2.pyi +16 -2
- streamlit/proto/Element_pb2.py +5 -3
- streamlit/proto/Element_pb2.pyi +23 -5
- streamlit/proto/Empty_pb2.pyi +7 -1
- streamlit/proto/Exception_pb2.pyi +7 -1
- streamlit/proto/Favicon_pb2.pyi +7 -1
- streamlit/proto/FileUploader_pb2.pyi +7 -1
- streamlit/proto/ForwardMsg_pb2.py +12 -10
- streamlit/proto/ForwardMsg_pb2.pyi +42 -15
- streamlit/proto/GapSize_pb2.pyi +4 -4
- streamlit/proto/GitInfo_pb2.pyi +3 -3
- streamlit/proto/GraphVizChart_pb2.pyi +7 -1
- streamlit/proto/Heading_pb2.pyi +7 -1
- streamlit/proto/HeightConfig_pb2.pyi +7 -1
- streamlit/proto/Html_pb2.py +2 -2
- streamlit/proto/Html_pb2.pyi +11 -2
- streamlit/proto/IFrame_pb2.pyi +7 -1
- streamlit/proto/Image_pb2.pyi +10 -4
- streamlit/proto/Json_pb2.pyi +7 -1
- streamlit/proto/LabelVisibilityMessage_pb2.pyi +3 -3
- streamlit/proto/LinkButton_pb2.py +2 -2
- streamlit/proto/LinkButton_pb2.pyi +15 -2
- streamlit/proto/Logo_pb2.pyi +7 -1
- streamlit/proto/Markdown_pb2.pyi +3 -3
- streamlit/proto/Metric_pb2.pyi +7 -7
- streamlit/proto/MetricsEvent_pb2.pyi +10 -4
- streamlit/proto/MultiSelect_pb2.pyi +7 -1
- streamlit/proto/NamedDataSet_pb2.pyi +7 -1
- streamlit/proto/Navigation_pb2.pyi +3 -3
- streamlit/proto/NewSession_pb2.pyi +40 -40
- streamlit/proto/NumberInput_pb2.pyi +3 -3
- streamlit/proto/PageConfig_pb2.pyi +7 -7
- streamlit/proto/PageInfo_pb2.pyi +7 -1
- streamlit/proto/PageLink_pb2.py +2 -2
- streamlit/proto/PageLink_pb2.pyi +11 -2
- streamlit/proto/PageNotFound_pb2.pyi +7 -1
- streamlit/proto/PageProfile_pb2.pyi +13 -7
- streamlit/proto/PagesChanged_pb2.pyi +7 -1
- streamlit/proto/ParentMessage_pb2.pyi +7 -1
- streamlit/proto/PlotlyChart_pb2.pyi +6 -6
- streamlit/proto/Progress_pb2.pyi +7 -1
- streamlit/proto/Radio_pb2.pyi +7 -1
- streamlit/proto/RootContainer_pb2.pyi +1 -1
- streamlit/proto/Selectbox_pb2.pyi +7 -1
- streamlit/proto/SessionEvent_pb2.pyi +7 -1
- streamlit/proto/SessionStatus_pb2.pyi +7 -1
- streamlit/proto/Skeleton_pb2.pyi +3 -3
- streamlit/proto/Slider_pb2.pyi +5 -5
- streamlit/proto/Snow_pb2.pyi +7 -1
- streamlit/proto/Space_pb2.pyi +7 -1
- streamlit/proto/Spinner_pb2.pyi +7 -1
- streamlit/proto/TextAlignmentConfig_pb2.py +29 -0
- streamlit/proto/TextAlignmentConfig_pb2.pyi +68 -0
- streamlit/proto/TextArea_pb2.pyi +7 -1
- streamlit/proto/TextInput_pb2.pyi +3 -3
- streamlit/proto/Text_pb2.pyi +7 -1
- streamlit/proto/TimeInput_pb2.pyi +7 -1
- streamlit/proto/Toast_pb2.pyi +7 -1
- streamlit/proto/VegaLiteChart_pb2.pyi +7 -1
- streamlit/proto/Video_pb2.pyi +6 -6
- streamlit/proto/WidgetStates_pb2.pyi +10 -4
- streamlit/proto/WidthConfig_pb2.pyi +7 -1
- streamlit/proto/openmetrics_data_model_pb2.pyi +52 -52
- streamlit/runtime/app_session.py +38 -1
- streamlit/runtime/caching/cache_data_api.py +1 -1
- streamlit/runtime/caching/cache_resource_api.py +2 -2
- streamlit/runtime/caching/cache_utils.py +1 -1
- streamlit/runtime/caching/hashing.py +1 -1
- streamlit/runtime/download_data_util.py +53 -0
- streamlit/runtime/forward_msg_queue.py +1 -0
- streamlit/runtime/media_file_manager.py +178 -2
- streamlit/runtime/metrics_util.py +87 -3
- streamlit/runtime/scriptrunner/script_runner.py +3 -1
- streamlit/runtime/state/query_params.py +80 -29
- streamlit/runtime/state/session_state.py +2 -2
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +530 -229
- streamlit/static/static/js/{ErrorOutline.esm.YoJdlW1p.js → ErrorOutline.esm.ZJDbmVTx.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Ddx8VEYy.js → FileDownload.esm.Dx0vI3vH.js} +1 -1
- streamlit/static/static/js/{FileHelper.90EtOmj9.js → FileHelper.B7Ero7qQ.js} +3 -3
- streamlit/static/static/js/{FormClearHelper.BB1Km6eP.js → FormClearHelper.CG2XN1_g.js} +1 -1
- streamlit/static/static/js/IFrameUtil.DefezniK.js +1 -0
- streamlit/static/static/js/InputInstructions.Cj5-1zf6.js +1 -0
- streamlit/static/static/js/Particles.BfWfv0Aw.js +1 -0
- streamlit/static/static/js/{ProgressBar.DLY8H6nE.js → ProgressBar.CGQ8OgfO.js} +2 -2
- streamlit/static/static/js/StreamlitSyntaxHighlighter.DTKLpwhl.js +20 -0
- streamlit/static/static/js/{Toolbar.D8nHCkuz.js → Toolbar.B2qFUmd9.js} +1 -1
- streamlit/static/static/js/_arrayIncludes.B19Iyn2B.js +1 -0
- streamlit/static/static/js/_baseIndexOf.BTknn6Gb.js +1 -0
- streamlit/static/static/js/{base-input.CJGiNqed.js → base-input.o9tL8MDP.js} +4 -4
- streamlit/static/static/js/{checkbox.Cpdd482O.js → checkbox.0BeV1IBL.js} +1 -1
- streamlit/static/static/js/{createSuper.CuQIogbW.js → createSuper.RBO59fEm.js} +1 -1
- streamlit/static/static/js/data-grid-overlay-editor.CiTkUy0t.js +1 -0
- streamlit/static/static/js/{downloader.CN0K7xlu.js → downloader.DwNZg3Mw.js} +1 -1
- streamlit/static/static/js/embed.XT9xNd3F.js +195 -0
- streamlit/static/static/js/{es6.BJcsVXQ0.js → es6.x9KsYQg-.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.XzUvQqcZ.js → iframeResizer.contentWindow.ZVXpMPi0.js} +1 -1
- streamlit/static/static/js/index.5VPOamri.js +1 -0
- streamlit/static/static/js/index.8HslT92O.js +14 -0
- streamlit/static/static/js/index.AnXMIBz3.js +7 -0
- streamlit/static/static/js/index.B0yp3bM1.js +6 -0
- streamlit/static/static/js/index.B1fRb5wF.js +1 -0
- streamlit/static/static/js/index.B527JZdO.js +3 -0
- streamlit/static/static/js/index.BHgV-yW4.js +1 -0
- streamlit/static/static/js/index.BQr-XwGV.js +1 -0
- streamlit/static/static/js/index.BTtmaLDB.js +1 -0
- streamlit/static/static/js/index.BWB_91TA.js +1 -0
- streamlit/static/static/js/index.BfEKaEmw.js +1 -0
- streamlit/static/static/js/index.BfXjTO8b.js +1 -0
- streamlit/static/static/js/index.Bjy4NRu9.js +3 -0
- streamlit/static/static/js/index.Bu5JWpT_.js +1 -0
- streamlit/static/static/js/index.BuCx76ZV.js +1 -0
- streamlit/static/static/js/index.BxjzhVUb.js +2 -0
- streamlit/static/static/js/index.By55VdPY.js +1 -0
- streamlit/static/static/js/index.CF5MxTbK.js +1 -0
- streamlit/static/static/js/index.CLmq_z9K.js +1 -0
- streamlit/static/static/js/index.CNH4rdSz.js +1 -0
- streamlit/static/static/js/{index.D3GPA5k4.js → index.CTgm_-jO.js} +9 -40
- streamlit/static/static/js/index.C_rK-Swb.js +188 -0
- streamlit/static/static/js/index.CjozwSzS.js +1 -0
- streamlit/static/static/js/{index.DOFlg3dS.js → index.CkGVt6-G.js} +1 -1
- streamlit/static/static/js/index.CuvXOyER.js +2 -0
- streamlit/static/static/js/{index.B_dWA3vd.js → index.CyUHWoCC.js} +2 -2
- streamlit/static/static/js/index.CyroQtI4.js +2 -0
- streamlit/static/static/js/index.D6HmkoDm.js +263 -0
- streamlit/static/static/js/index.DAqCNvsO.js +1 -0
- streamlit/static/static/js/index.DB_w_CZQ.js +1 -0
- streamlit/static/static/js/index.DBalctjj.js +2 -0
- streamlit/static/static/js/index.DK0RFJUG.js +11 -0
- streamlit/static/static/js/index.DMxc2XFp.js +151 -0
- streamlit/static/static/js/index.DO5utP74.js +2 -0
- streamlit/static/static/js/index.DS7lf09n.js +1 -0
- streamlit/static/static/js/index.DWexTVLY.js +1 -0
- streamlit/static/static/js/index.DXxnU5ej.js +1 -0
- streamlit/static/static/js/index.DcU3uDvB.js +2 -0
- streamlit/static/static/js/index.DlltaH7J.js +1 -0
- streamlit/static/static/js/index.DpNTZz82.js +27 -0
- streamlit/static/static/js/index.Dr9HIhQw.js +1 -0
- streamlit/static/static/js/index.DsgAU5lc.js +1 -0
- streamlit/static/static/js/{index.DPUXkcQL.js → index.KfXqjDYy.js} +1 -1
- streamlit/static/static/js/index.PaidgjCs.js +1 -0
- streamlit/static/static/js/index.RJZuWCGA.js +1 -0
- streamlit/static/static/js/{index.CxIUUfab.js → index.hbeqcRTn.js} +53 -122
- streamlit/static/static/js/index.q5hIQwAY.js +1 -0
- streamlit/static/static/js/index.rORSX6IW.js +1 -0
- streamlit/static/static/js/index.uSX757_v.js +1 -0
- streamlit/static/static/js/index.x_QRaLMd.js +1 -0
- streamlit/static/static/js/{input.D4MN_FzN.js → input.D5oh9-aB.js} +2 -2
- streamlit/static/static/js/main.q9oGOg0H.js +13 -0
- streamlit/static/static/js/{memory.DrZjtdGT.js → memory.5kCSFUJS.js} +1 -1
- streamlit/static/static/js/moment.C3j7ZXd7.js +4 -0
- streamlit/static/static/js/number-overlay-editor.Cn_LsK8N.js +9 -0
- streamlit/static/static/js/pandasStylerUtils.BqhXt51_.js +1 -0
- streamlit/static/static/js/{possibleConstructorReturn.exeeJQEP.js → possibleConstructorReturn.DD9NK1Z8.js} +1 -1
- streamlit/static/static/js/{sandbox.ClO3IuUr.js → sandbox.DACSyz29.js} +1 -1
- streamlit/static/static/js/styled-components.C3R090At.js +1 -0
- streamlit/static/static/js/threshold.Q1mXg5rX.js +1 -0
- streamlit/static/static/js/throttle.B0GR3Iyz.js +1 -0
- streamlit/static/static/js/{timepicker.DAhu-vcF.js → timepicker.BdhzPxrv.js} +1 -1
- streamlit/static/static/js/timer.C2hYhUse.js +1 -0
- streamlit/static/static/js/{toConsumableArray.DNbljYEC.js → toConsumableArray.Db2pdqM2.js} +1 -1
- streamlit/static/static/js/uniqueId.CtqIr-Yh.js +1 -0
- streamlit/static/static/js/urls.BwSlolu9.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.D6sOH6oI.js → useBasicWidgetState.Bfp6TnSw.js} +1 -1
- streamlit/static/static/js/useIntlLocale.hRV75Xgj.js +12 -0
- streamlit/static/static/js/{useTextInputAutoExpand.4u3_GcuN.js → useTextInputAutoExpand.QepX7n8Y.js} +1 -1
- streamlit/static/static/js/useUpdateUiValue.DHx8TzX6.js +1 -0
- streamlit/static/static/js/useWaveformController.WxVzpzEX.js +1 -0
- streamlit/static/static/js/value.B4vHRSi7.js +1 -0
- streamlit/static/static/js/withCalculatedWidth.DcKeRSWJ.js +1 -0
- streamlit/static/static/js/withFullScreenWrapper.CrHddARq.js +1 -0
- streamlit/string_util.py +8 -1
- streamlit/testing/v1/app_test.py +15 -0
- streamlit/testing/v1/element_tree.py +62 -0
- streamlit/web/bootstrap.py +24 -0
- streamlit/web/server/oauth_authlib_routes.py +5 -2
- streamlit/web/server/upload_file_request_handler.py +16 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.0.dist-info}/METADATA +9 -5
- {streamlit-1.51.0.dist-info → streamlit-1.52.0.dist-info}/RECORD +274 -239
- streamlit/static/static/js/InputInstructions.jhH15PqV.js +0 -1
- streamlit/static/static/js/Particles.DUsputn1.js +0 -1
- streamlit/static/static/js/data-grid-overlay-editor.2Ufgxc6y.js +0 -1
- streamlit/static/static/js/index.B1ZQh4P1.js +0 -1
- streamlit/static/static/js/index.BKstZk0M.js +0 -27
- streamlit/static/static/js/index.BMcFsUee.js +0 -1
- streamlit/static/static/js/index.BR-IdcTb.js +0 -2
- streamlit/static/static/js/index.BgnZEMVh.js +0 -1
- streamlit/static/static/js/index.BohqXifI.js +0 -1
- streamlit/static/static/js/index.Br5nxKNj.js +0 -2
- streamlit/static/static/js/index.BrIKVbNc.js +0 -3
- streamlit/static/static/js/index.BtWUPzle.js +0 -1
- streamlit/static/static/js/index.C0RLraek.js +0 -1
- streamlit/static/static/js/index.CAIjskgG.js +0 -1
- streamlit/static/static/js/index.CAj-7vWz.js +0 -949
- streamlit/static/static/js/index.CMtEit2O.js +0 -1
- streamlit/static/static/js/index.CkRlykEE.js +0 -12
- streamlit/static/static/js/index.CmN3FXfI.js +0 -1617
- streamlit/static/static/js/index.CwbFI1_-.js +0 -1
- streamlit/static/static/js/index.D2KPNy7e.js +0 -1
- streamlit/static/static/js/index.DGAh7DMq.js +0 -1
- streamlit/static/static/js/index.DKb_NvmG.js +0 -197
- streamlit/static/static/js/index.DMqgUYKq.js +0 -1
- streamlit/static/static/js/index.DX1xY89g.js +0 -1
- streamlit/static/static/js/index.DYATBCsq.js +0 -2
- streamlit/static/static/js/index.DaSmGJ76.js +0 -3
- streamlit/static/static/js/index.Dd7bMeLP.js +0 -1
- streamlit/static/static/js/index.DjmmgI5U.js +0 -1
- streamlit/static/static/js/index.Dq56CyM2.js +0 -1
- streamlit/static/static/js/index.DuiXaS5_.js +0 -7
- streamlit/static/static/js/index.DvFidMLe.js +0 -2
- streamlit/static/static/js/index.DwkhC5Pc.js +0 -1
- streamlit/static/static/js/index.Q-3sFn1v.js +0 -1
- streamlit/static/static/js/index.QJ5QO9sJ.js +0 -1
- streamlit/static/static/js/index.VwTaeety.js +0 -1
- streamlit/static/static/js/index.YOqQbeX8.js +0 -1
- streamlit/static/static/js/number-overlay-editor.DRwAw1In.js +0 -9
- streamlit/static/static/js/uniqueId.oG4Gvj1v.js +0 -1
- streamlit/static/static/js/useUpdateUiValue.F2R3eTeR.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.zothJIsI.js +0 -1
- {streamlit-1.51.0.data → streamlit-1.52.0.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.0.dist-info}/WHEEL +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.0.dist-info}/entry_points.txt +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.0.dist-info}/top_level.txt +0 -0
|
@@ -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.DMxc2XFp.js";import{w as ae,E as ie}from"./withFullScreenWrapper.CrHddARq.js";import{a as k,S as _,T as ce}from"./Toolbar.B2qFUmd9.js";import{R as le}from"./index.C_rK-Swb.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.XT9xNd3F.js";import{u as ge}from"./FormClearHelper.CG2XN1_g.js";import"./moment.C3j7ZXd7.js";import"./pandasStylerUtils.BqhXt51_.js";import"./_baseIndexOf.BTknn6Gb.js";import"./sprintf.D7DtBTRn.js";import"./index.8HslT92O.js";import"./main.q9oGOg0H.js";import"./throttle.B0GR3Iyz.js";import"./checkbox.0BeV1IBL.js";import"./createDownloadLinkElement.ZaXNnPK4.js";import"./toConsumableArray.Db2pdqM2.js";import"./possibleConstructorReturn.DD9NK1Z8.js";import"./createSuper.RBO59fEm.js";import"./FileDownload.esm.Dx0vI3vH.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 @@
|
|
|
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.DMxc2XFp.js";import{e as j,S as G,a as U,b as J}from"./embed.XT9xNd3F.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,2 @@
|
|
|
1
|
+
import{x as d,r as c,g as m,V as g,W as y,j as t,X as f,k as h}from"./index.DMxc2XFp.js";import{l as b}from"./index.8HslT92O.js";import{R as u}from"./main.q9oGOg0H.js";const S=d("div",{target:"ec2buac0"})(({theme:o})=>({overflowY:"auto",".react-json-view .copy-icon svg":{fontSize:"1em !important",marginRight:`${o.spacing.threeXS} !important`,verticalAlign:"middle !important"}}));function C({element:o}){const e=m(),{copyToClipboard:n}=g(),i=c.useCallback(a=>{n(JSON.stringify(a.src))},[n]);let s;try{s=JSON.parse(o.body)}catch(a){const r=y(a);try{s=b.parse(o.body)}catch{const l=parseInt(r.message.replace(/[^0-9]/g,""),10);return r.message+=`
|
|
2
|
+
${o.body.substring(0,l+1)} ← here`,t(f,{name:"Json Parse Error",message:r.message})}}const p=h(e)?"rjv-default":"monokai";return t(S,{className:"stJson","data-testid":"stJson",children:t(u,{src:s,collapsed:o.maxExpandDepth??!o.expanded,displayDataTypes:!1,displayObjectSize:!1,name:!1,theme:p,enableClipboard:i,style:{fontFamily:e.genericFonts.codeFont,fontSize:e.fontSizes.codeFontSize,fontWeight:e.fontWeights.code,backgroundColor:e.colors.bgColor,whiteSpace:"pre-wrap"}})})}const v=c.memo(C);export{v 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.DMxc2XFp.js";import{by as tr}from"./index.DMxc2XFp.js";import{w as Se}from"./withCalculatedWidth.DcKeRSWJ.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};
|