streamlit-nightly 1.52.3.dev20260112__py3-none-any.whl → 1.53.1.dev20260114__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 -1
- streamlit/auth_util.py +1 -1
- streamlit/cli_util.py +1 -1
- streamlit/commands/logo.py +2 -0
- streamlit/commands/page_config.py +16 -16
- streamlit/components/v2/__init__.py +2 -2
- streamlit/components/v2/bidi_component/main.py +2 -2
- streamlit/connections/base_connection.py +16 -4
- streamlit/connections/snowflake_connection.py +255 -206
- streamlit/dataframe_util.py +1 -3
- streamlit/elements/arrow.py +5 -1
- streamlit/elements/form.py +2 -2
- streamlit/elements/lib/color_util.py +1 -1
- streamlit/elements/lib/image_utils.py +1 -1
- streamlit/elements/metric.py +49 -48
- streamlit/elements/vega_charts.py +4 -1
- streamlit/elements/widgets/button.py +9 -9
- streamlit/elements/widgets/chat.py +5 -9
- streamlit/elements/widgets/data_editor.py +3 -3
- streamlit/elements/widgets/file_uploader.py +10 -11
- streamlit/elements/widgets/multiselect.py +1 -1
- streamlit/elements/widgets/select_slider.py +4 -0
- streamlit/elements/widgets/time_widgets.py +1 -1
- streamlit/elements/write.py +1 -2
- streamlit/errors.py +2 -0
- streamlit/external/langchain/streamlit_callback_handler.py +1 -1
- streamlit/proto/Alert_pb2.pyi +31 -31
- streamlit/proto/AppPage_pb2.pyi +30 -30
- streamlit/proto/ArrowData_pb2.pyi +15 -15
- streamlit/proto/ArrowNamedDataSet_pb2.pyi +25 -25
- streamlit/proto/ArrowVegaLiteChart_pb2.pyi +45 -45
- streamlit/proto/Arrow_pb2.pyi +126 -97
- streamlit/proto/AudioInput_pb2.pyi +39 -39
- streamlit/proto/Audio_pb2.pyi +39 -39
- streamlit/proto/AuthRedirect_pb2.pyi +15 -15
- streamlit/proto/AutoRerun_pb2.pyi +18 -18
- streamlit/proto/BackMsg_pb2.pyi +64 -64
- streamlit/proto/Balloons_pb2.pyi +15 -15
- streamlit/proto/BidiComponent_pb2.pyi +100 -100
- streamlit/proto/Block_pb2.pyi +295 -264
- streamlit/proto/BokehChart_pb2.pyi +21 -21
- streamlit/proto/ButtonGroup_pb2.pyi +96 -96
- streamlit/proto/ButtonLikeIconPosition_pb2.pyi +12 -12
- streamlit/proto/Button_pb2.pyi +63 -50
- streamlit/proto/CameraInput_pb2.pyi +34 -34
- streamlit/proto/ChatInput_pb2.pyi +63 -63
- streamlit/proto/Checkbox_pb2.pyi +49 -49
- streamlit/proto/ClientState_pb2.pyi +85 -85
- streamlit/proto/Code_pb2.pyi +41 -28
- streamlit/proto/ColorPicker_pb2.pyi +43 -43
- streamlit/proto/Common_pb2.pyi +175 -175
- streamlit/proto/Components_pb2.pyi +110 -110
- streamlit/proto/DataFrame_pb2.pyi +209 -209
- streamlit/proto/DateInput_pb2.pyi +59 -59
- streamlit/proto/DateTimeInput_pb2.pyi +62 -62
- streamlit/proto/DeckGlJsonChart_pb2.pyi +91 -56
- streamlit/proto/Delta_pb2.pyi +44 -44
- streamlit/proto/DocString_pb2.pyi +51 -51
- streamlit/proto/DownloadButton_pb2.pyi +59 -59
- streamlit/proto/Element_pb2.pyi +319 -319
- streamlit/proto/Empty_pb2.pyi +10 -10
- streamlit/proto/Exception_pb2.pyi +37 -37
- streamlit/proto/Favicon_pb2.pyi +15 -15
- streamlit/proto/FileUploader_pb2.pyi +49 -49
- streamlit/proto/ForwardMsg_pb2.pyi +176 -170
- streamlit/proto/GapSize_pb2.pyi +23 -23
- streamlit/proto/GitInfo_pb2.pyi +37 -37
- streamlit/proto/GraphVizChart_pb2.pyi +38 -25
- streamlit/proto/Heading_pb2.pyi +30 -30
- streamlit/proto/HeightConfig_pb2.pyi +31 -31
- streamlit/proto/Html_pb2.pyi +18 -18
- streamlit/proto/IFrame_pb2.pyi +76 -47
- streamlit/proto/Image_pb2.pyi +49 -36
- streamlit/proto/Json_pb2.pyi +25 -25
- streamlit/proto/LabelVisibilityMessage_pb2.pyi +18 -18
- streamlit/proto/LinkButton_pb2.pyi +43 -43
- streamlit/proto/Logo_pb2.pyi +24 -24
- streamlit/proto/Markdown_pb2.pyi +30 -30
- streamlit/proto/Metric_pb2.pyi +59 -59
- streamlit/proto/MetricsEvent_pb2.pyi +171 -171
- streamlit/proto/MultiSelect_pb2.pyi +72 -66
- streamlit/proto/NamedDataSet_pb2.pyi +25 -25
- streamlit/proto/Navigation_pb2.pyi +35 -35
- streamlit/proto/NewSession_pb2.pyi +511 -498
- streamlit/proto/NumberInput_pb2.pyi +79 -79
- streamlit/proto/PageConfig_pb2.pyi +71 -71
- streamlit/proto/PageInfo_pb2.pyi +15 -15
- streamlit/proto/PageLink_pb2.pyi +47 -47
- streamlit/proto/PageNotFound_pb2.pyi +15 -15
- streamlit/proto/PageProfile_pb2.pyi +85 -85
- streamlit/proto/PagesChanged_pb2.pyi +19 -19
- streamlit/proto/ParentMessage_pb2.pyi +15 -15
- streamlit/proto/PlotlyChart_pb2.pyi +79 -64
- streamlit/proto/Progress_pb2.pyi +18 -18
- streamlit/proto/Radio_pb2.pyi +62 -62
- streamlit/proto/RootContainer_pb2.pyi +12 -12
- streamlit/proto/Selectbox_pb2.pyi +80 -70
- streamlit/proto/SessionEvent_pb2.pyi +27 -27
- streamlit/proto/SessionStatus_pb2.pyi +18 -18
- streamlit/proto/Skeleton_pb2.pyi +25 -25
- streamlit/proto/Slider_pb2.pyi +74 -74
- streamlit/proto/Snow_pb2.pyi +15 -15
- streamlit/proto/Space_pb2.pyi +10 -10
- streamlit/proto/Spinner_pb2.pyi +21 -21
- streamlit/proto/TextAlignmentConfig_pb2.pyi +18 -18
- streamlit/proto/TextArea_pb2.pyi +72 -59
- streamlit/proto/TextInput_pb2.pyi +67 -67
- streamlit/proto/Text_pb2.pyi +18 -18
- streamlit/proto/TimeInput_pb2.pyi +52 -52
- streamlit/proto/Toast_pb2.pyi +25 -25
- streamlit/proto/Transient_pb2.pyi +19 -19
- streamlit/proto/VegaLiteChart_pb2.pyi +32 -32
- streamlit/proto/Video_pb2.pyi +65 -65
- streamlit/proto/WidgetStates_pb2.pyi +91 -85
- streamlit/proto/WidthConfig_pb2.pyi +31 -31
- streamlit/proto/openmetrics_data_model_pb2.pyi +269 -269
- streamlit/runtime/app_session.py +1 -1
- streamlit/runtime/caching/cache_data_api.py +25 -21
- streamlit/runtime/caching/cache_resource_api.py +69 -41
- streamlit/runtime/connection_factory.py +67 -41
- streamlit/runtime/credentials.py +2 -2
- streamlit/runtime/metrics_util.py +3 -3
- streamlit/runtime/secrets.py +1 -1
- streamlit/runtime/stats.py +1 -3
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +304 -304
- streamlit/static/static/js/{ErrorOutline.esm.BjVqd_6R.js → ErrorOutline.esm.BAZUU4id.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.DJCSsghl.js → FileDownload.esm.C6tTTniR.js} +1 -1
- streamlit/static/static/js/{FileHelper.C---TH7o.js → FileHelper.BOHlwlc9.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.C-6BC487.js → FormClearHelper.D4lty7rT.js} +1 -1
- streamlit/static/static/js/{InputInstructions.sxc3InCI.js → InputInstructions.BWw9lhud.js} +1 -1
- streamlit/static/static/js/{Particles.S8yD7iW-.js → Particles.BDi7fIn-.js} +1 -1
- streamlit/static/static/js/{ProgressBar.BiYsyZCC.js → ProgressBar.DCHh4N3P.js} +1 -1
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.9jZF8jX1.js → StreamlitSyntaxHighlighter.BRydQwEj.js} +1 -1
- streamlit/static/static/js/{TableChart.esm.BdA4Q1rZ.js → TableChart.esm.7KFX5I_G.js} +1 -1
- streamlit/static/static/js/{Toolbar.B9DaaDfN.js → Toolbar.guIuiwEF.js} +1 -1
- streamlit/static/static/js/{WidgetLabelHelpIconInline.DxODTLS2.js → WidgetLabelHelpIconInline.CzodezAH.js} +1 -1
- streamlit/static/static/js/{base-input.Gf1cKuQR.js → base-input.Cg7NpsfS.js} +1 -1
- streamlit/static/static/js/{checkbox.CnoNruf3.js → checkbox.Bs20OTna.js} +1 -1
- streamlit/static/static/js/{createDownloadLinkElement.B48AepiL.js → createDownloadLinkElement.DSqCyu38.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.Cmdq9aqU.js → data-grid-overlay-editor.Ch4SqNfY.js} +1 -1
- streamlit/static/static/js/{downloader.CQLoQdMX.js → downloader.Oj5CTGJA.js} +1 -1
- streamlit/static/static/js/{embed.oKwocwU8.js → embed.CqzzUq73.js} +1 -1
- streamlit/static/static/js/{es6.BRxlY_y5.js → es6.CYrlw0Vn.js} +2 -2
- streamlit/static/static/js/{formatNumber.DaagZyZe.js → formatNumber.CT_v8e75.js} +1 -1
- streamlit/static/static/js/{iconPosition.Q3hNvmK4.js → iconPosition.DPAvXTmd.js} +1 -1
- streamlit/static/static/js/{iframeResizer.contentWindow.B6EBvI9L.js → iframeResizer.contentWindow.T4DvQsIf.js} +1 -1
- streamlit/static/static/js/{index.BoX8d5rK.js → index.AGYZDQZm.js} +1 -1
- streamlit/static/static/js/{index.KtjGDGY5.js → index.B3HdcUdo.js} +1 -1
- streamlit/static/static/js/{index.B9kZB0o1.js → index.B8ZZdPqF.js} +1 -1
- streamlit/static/static/js/{index.CFCBhOfx.js → index.B9Oowxt8.js} +1 -1
- streamlit/static/static/js/{index.CCQ5p_WC.js → index.BEzgNZOm.js} +1 -1
- streamlit/static/static/js/{index.D1pK_Vw2.js → index.BJnWg9Jq.js} +1 -1
- streamlit/static/static/js/{index.na9UBuse.js → index.BPxuKK0S.js} +1 -1
- streamlit/static/static/js/{index.QTaWooav.js → index.BTA0d5oq.js} +1 -1
- streamlit/static/static/js/{index.pU9mQeVC.js → index.BTqav7_K.js} +1 -1
- streamlit/static/static/js/{index.BXEC4cf3.js → index.BZ8xp-w9.js} +1 -1
- streamlit/static/static/js/{index.BF23fbfs.js → index.BoWBzl6h.js} +1 -1
- streamlit/static/static/js/index.Bqgt60FU.js +1 -0
- streamlit/static/static/js/{index.Dh5SAThV.js → index.BsYYrijt.js} +1 -1
- streamlit/static/static/js/{index.19_qtO6t.js → index.CGRIbGGV.js} +1 -1
- streamlit/static/static/js/{index.CSfsEKCF.js → index.CJQq5LcR.js} +1 -1
- streamlit/static/static/js/{index.Fu73QtkD.js → index.CPYB1awG.js} +1 -1
- streamlit/static/static/js/{index.BzwlrgZO.js → index.CVKk1nkB.js} +1 -1
- streamlit/static/static/js/{index.B03eQZoH.js → index.CVXiBeDI.js} +1 -1
- streamlit/static/static/js/{index.BRfGUOQ-.js → index.CXVpBAvU.js} +4 -4
- streamlit/static/static/js/{index.slgxPafU.js → index.Cfe-tCQJ.js} +1 -1
- streamlit/static/static/js/{index.D6X2coHR.js → index.ClFk8x0U.js} +1 -1
- streamlit/static/static/js/{index.WXybx2Xq.js → index.CnXxoVEM.js} +1 -1
- streamlit/static/static/js/{index.j4fnjyHo.js → index.Cw4eSvJ7.js} +1 -1
- streamlit/static/static/js/{index.KN1VmyYN.js → index.D6HCANv6.js} +1 -1
- streamlit/static/static/js/{index.CP-hoxJM.js → index.D7KbBAWb.js} +1 -1
- streamlit/static/static/js/{index.CCFwVy90.js → index.D84XHt50.js} +1 -1
- streamlit/static/static/js/{index.BkSwGJoh.js → index.DL_Ooizi.js} +1 -1
- streamlit/static/static/js/{index.QHnxuesF.js → index.DNyw7S7Z.js} +1 -1
- streamlit/static/static/js/{index.BAI9aHCq.js → index.DPlPEuq6.js} +1 -1
- streamlit/static/static/js/{index.CJ4oJe0V.js → index.DQzRwgrT.js} +1 -1
- streamlit/static/static/js/{index.CVlg41MB.js → index.DXRGd--0.js} +1 -1
- streamlit/static/static/js/{index.CIbgt5wY.js → index.DZDt5hYD.js} +1 -1
- streamlit/static/static/js/{index.BVT89mQw.js → index.DesNeXSA.js} +1 -1
- streamlit/static/static/js/{index.Boa0Egng.js → index.Dg9k4R8B.js} +1 -1
- streamlit/static/static/js/{index.43b777iP.js → index.Do9A7QCt.js} +1 -1
- streamlit/static/static/js/{index.DJ7P09eb.js → index.DrSH3pK3.js} +1 -1
- streamlit/static/static/js/{index.OpATzEaW.js → index.Dtd5z2rM.js} +1 -1
- streamlit/static/static/js/{index.BnfTPrHb.js → index.DzldU3Hy.js} +1 -1
- streamlit/static/static/js/{index.C0fSEz-3.js → index.GZi6GTJa.js} +1 -1
- streamlit/static/static/js/{index.CYE7b5Du.js → index.LOA31DFn.js} +1 -1
- streamlit/static/static/js/{index.Ca7MUNWJ.js → index.MtwRNvlS.js} +1 -1
- streamlit/static/static/js/{index.BbSFVZ3p.js → index.XHtvnZ0-.js} +1 -1
- streamlit/static/static/js/{index.CvIqsWy1.js → index.Yj6vcyFD.js} +1 -1
- streamlit/static/static/js/{index.BGBTkulf.js → index.b-MrPulo.js} +1 -1
- streamlit/static/static/js/{index.DGYHxruh.js → index.hcUYvTqs.js} +1 -1
- streamlit/static/static/js/{index.CvB9JBqS.js → index.tLZuZM89.js} +6 -6
- streamlit/static/static/js/{index.Xg-Qttib.js → index.wngeYhKj.js} +1 -1
- streamlit/static/static/js/{index.whRT3Vm3.js → index.xCV2qwtw.js} +1 -1
- streamlit/static/static/js/{input.CPzINTl-.js → input.CYXuTqoa.js} +1 -1
- streamlit/static/static/js/{main.DSPn8dUe.js → main.BE-siVKv.js} +1 -1
- streamlit/static/static/js/{memory.CfD8IGoU.js → memory.V554ztRg.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.4Ae0qegV.js → number-overlay-editor.BiUTOXIl.js} +1 -1
- streamlit/static/static/js/{pandasStylerUtils.D2EjZ7k6.js → pandasStylerUtils.Dej3Tstq.js} +1 -1
- streamlit/static/static/js/{sandbox.C6vcPIm0.js → sandbox.gpd7KGMo.js} +1 -1
- streamlit/static/static/js/{styled-components.BBmp8buj.js → styled-components.Coj4dr6D.js} +1 -1
- streamlit/static/static/js/{throttle.BPcPpy-S.js → throttle.gZUdtYp7.js} +1 -1
- streamlit/static/static/js/{timepicker.ryzkTs2C.js → timepicker.B-Y4aU15.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.Dg1nDaB_.js → toConsumableArray.CcKcKvEd.js} +1 -1
- streamlit/static/static/js/uniqueId.PRn3V1WU.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.A4U5lzAm.js → useBasicWidgetState.D-fc_aIL.js} +1 -1
- streamlit/static/static/js/{useIntlLocale.DWJgLlNz.js → useIntlLocale.CY32IeNt.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.BrBonw8t.js → useTextInputAutoExpand.C0jK7TwF.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.BkOWyNVX.js → useUpdateUiValue.CDQloDgB.js} +1 -1
- streamlit/static/static/js/{useWaveformController.CBlvXlgZ.js → useWaveformController.BLEIAIDo.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.D4cpOyNe.js → withCalculatedWidth.B3oSlRC0.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BMim3w94.js → withFullScreenWrapper.Cw_ebNmr.js} +1 -1
- streamlit/testing/v1/app_test.py +1 -1
- streamlit/user_info.py +225 -166
- streamlit/web/server/starlette/starlette_routes.py +1 -3
- streamlit/web/server/stats_request_handler.py +1 -3
- {streamlit_nightly-1.52.3.dev20260112.dist-info → streamlit_nightly-1.53.1.dev20260114.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.52.3.dev20260112.dist-info → streamlit_nightly-1.53.1.dev20260114.dist-info}/RECORD +223 -223
- streamlit/static/static/js/index.CrPjcPY1.js +0 -1
- streamlit/static/static/js/uniqueId.BFHzT5KQ.js +0 -1
- {streamlit_nightly-1.52.3.dev20260112.data → streamlit_nightly-1.53.1.dev20260114.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.52.3.dev20260112.dist-info → streamlit_nightly-1.53.1.dev20260114.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.52.3.dev20260112.dist-info → streamlit_nightly-1.53.1.dev20260114.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.52.3.dev20260112.dist-info → streamlit_nightly-1.53.1.dev20260114.dist-info}/top_level.txt +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,E as G,_ as Z,F as V,be as C,e as h,n as J,W as dt,l as pt,k as ft,aa as mt,ab as k,o as B,j as d,p as bt,ac as ht,ad as gt,ae as yt,Z as It,az as j}from"./index.
|
|
1
|
+
import{r as a,E as G,_ as Z,F as V,be as C,e as h,n as J,W as dt,l as pt,k as ft,aa as mt,ab as k,o as B,j as d,p as bt,ac as ht,ad as gt,ae as yt,Z as It,az as j}from"./index.CXVpBAvU.js";import{I as Ct}from"./InputInstructions.BWw9lhud.js";import{u as Tt}from"./useBasicWidgetState.D-fc_aIL.js";import{s as St}from"./sprintf.DpPCfzXw.js";import{u as wt}from"./uniqueId.PRn3V1WU.js";import{I as vt}from"./input.CYXuTqoa.js";import"./FormClearHelper.D4lty7rT.js";import"./base-input.Cg7NpsfS.js";var Q=a.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(G,Z({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),a.createElement("path",{d:"M0 3v2h8V3H0z"}))});Q.displayName="Minus";var Y=a.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(G,Z({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),a.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Y.displayName="Plus";const xt=V("div",{target:"eaeic2i0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor??t.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}})),Dt=V("div",{target:"eaeic2i1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),K=V("button",{target:"eaeic2i2"})(({theme:t})=>({margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:t.sizes.numberInputControlsWidth,justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),kt=V("div",{target:"eaeic2i3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),Vt=dt.getLogger("NumberInput");function Nt(t){return h(t)||t===""?void 0:t}const tt=t=>{const e=t.toString();if(e.includes("e-")){const r=e.match(/(\d+(?:\.\d+)?)e-(\d+)/);if(r){const s=(r[1]?.split(".")[1]||"").length,n=parseInt(r[2],10);return s+n}return 0}return(e.split(".")[1]||"").length},_=({value:t,format:e,step:r,dataType:s})=>{if(h(t))return null;let n=Nt(e);if(h(n)&&J(r)&&s===C.DataType.FLOAT&&r!==0){const l=tt(r);l>0&&(n=`%0.${l}f`)}if(h(n))return t.toString();try{return St.sprintf(n,t)}catch(l){return Vt.warn(`Error in sprintf(${n}, ${t}): ${l}`),String(t)}},Et=(t,e,r)=>h(t)?!1:t-e>=r,Ft=(t,e,r)=>h(t)?!1:t+e<=r,X=(t,e,r)=>{const s=tt(e);if(s===0)switch(r){case"add":return t+e;case"subtract":return t-e}const n=Math.pow(10,s),l=Math.round(t*n),p=Math.round(e*n);switch(r){case"add":return(l+p)/n;case"subtract":return(l-p)/n}},Rt=({step:t,dataType:e})=>t||(e===C.DataType.INT?1:.01);function q(t,e){return e.dataType===C.DataType.INT?t.getIntValue(e):t.getDoubleValue(e)}function Wt(t){return t.default??null}function zt(t){return t.value??t.default??null}function Bt(t,e,r,s){switch(t.dataType){case C.DataType.INT:e.setIntValue(t,r.value,{fromUi:r.fromUi},s);break;case C.DataType.FLOAT:e.setDoubleValue(t,r.value,{fromUi:r.fromUi},s);break;default:throw new Error("Invalid data type")}}const Lt=({disabled:t,element:e,widgetMgr:r,fragmentId:s})=>{const n=pt(),{dataType:l,formId:p,default:T,format:N,icon:E,min:g,max:y}=e,{width:L,elementRef:et}=ft(),c=a.useMemo(()=>Rt({step:e.step,dataType:e.dataType}),[e.step,e.dataType]),I=a.useCallback(o=>_({value:o,dataType:l,format:N,step:c}),[l,N,c]),[f,w]=a.useState(!1),[b,S]=a.useState(()=>{const o=q(r,e)??T??null;return _({value:o,dataType:l,format:N,step:c})}),[P,U]=Tt({getStateFromWidgetMgr:q,getDefaultStateFromProto:Wt,getCurrStateFromProto:zt,updateWidgetMgrState:Bt,element:e,widgetMgr:r,fragmentId:s,onFormCleared:a.useCallback(()=>{const o=T??null;w(!1),S(I(o))},[T,I])}),[A,H]=a.useState(!1),F=a.useRef(null),[$]=a.useState(()=>wt("number_input_")),M=mt({formId:p}),nt=M?r.allowFormEnterToSubmit(p):f,rt=A&&L>k(n.breakpoints.hideWidgetDetails);a.useEffect(()=>{f||S(I(P))},[P,f,I]);const m=a.useCallback(({value:o,fromUi:i})=>{if(J(o)&&(g>o||o>y)){F.current?.reportValidity();return}const D=o??T??null;U({value:D,fromUi:i}),w(!1),S(I(D))},[g,y,T,I,U]),ot=a.useCallback(()=>{H(!0)},[]);a.useEffect(()=>{const o=F.current;if(o){const i=D=>{D.preventDefault()};return o.addEventListener("wheel",i),()=>{o.removeEventListener("wheel",i)}}},[]);const R=h(e.default)&&!t,at=a.useCallback(o=>{const{value:i}=o.target;i===""?(w(!0),S(null)):(w(!0),S(i))},[]),u=a.useMemo(()=>{if(b===null||b==="")return null;if(e.dataType===C.DataType.INT){const i=parseInt(b,10);return isNaN(i)?null:i}const o=parseFloat(b);return isNaN(o)?null:o},[b,e.dataType]),v=Et(u,c,g),x=Ft(u,c,y),st=a.useCallback(()=>{f&&m({value:u,fromUi:!0}),H(!1)},[f,u,m]),W=a.useCallback(()=>{if(x){const o=X(u??g,c,"add");m({value:o,fromUi:!0})}},[u,g,c,x,m]),z=a.useCallback(()=>{if(v){const o=X(u??y,c,"subtract");m({value:o,fromUi:!0})}},[u,y,c,v,m]),it=a.useCallback(o=>{const{key:i}=o;switch(i){case"ArrowUp":o.preventDefault(),W();break;case"ArrowDown":o.preventDefault(),z();break}},[W,z]),lt=a.useCallback(o=>{o.key==="Enter"&&(f&&m({value:u,fromUi:!0}),r.allowFormEnterToSubmit(p)&&r.submitForm(p,s))},[f,u,m,r,p,s]),ct=k(n.iconSizes.lg)+2*k(n.spacing.twoXS),O=k(n.breakpoints.hideNumberInputControls),ut=E?O+ct:O;return B("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:et,children:[d(gt,{label:e.label,disabled:t,labelVisibility:bt(e.labelVisibility?.value),htmlFor:$,children:e.help&&d(ht,{content:e.help,label:e.label})}),B(xt,{className:A?"focused":"","data-testid":"stNumberInputContainer",children:[d(vt,{type:"number",inputRef:F,value:b??"",placeholder:e.placeholder,onBlur:st,onFocus:ot,onChange:at,onKeyPress:lt,onKeyDown:it,clearable:R,clearOnEscape:R,disabled:t,"aria-label":e.label,startEnhancer:e.icon&&d(It,{"data-testid":"stNumberInputIcon",iconValue:e.icon,size:"lg"}),id:$,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:n.colors.grayTextColor,padding:n.spacing.threeXS,height:n.sizes.clearIconSize,width:n.sizes.clearIconSize,":hover":{fill:n.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:c,min:g,max:y,type:"number",inputMode:""},style:{fontWeight:n.fontWeights.normal,lineHeight:n.lineHeights.inputWidget,paddingRight:n.spacing.sm,paddingLeft:n.spacing.md,paddingBottom:n.spacing.sm,paddingTop:n.spacing.sm,"::placeholder":{color:n.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:E?n.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:n.iconSizes.lg,color:yt(E)?n.colors.fadedText60:"inherit"}}}}),L>ut&&B(Dt,{children:[d(K,{"data-testid":"stNumberInputStepDown",onClick:z,disabled:!v||t,tabIndex:-1,children:d(j,{content:Q,size:"xs",color:v?"inherit":n.colors.fadedText40})}),d(K,{"data-testid":"stNumberInputStepUp",onClick:W,disabled:!x||t,tabIndex:-1,children:d(j,{content:Y,size:"xs",color:x?"inherit":n.colors.fadedText40})})]})]}),rt&&d(kt,{clearable:R,children:d(Ct,{dirty:f,value:b??"",inForm:M,allowEnterToSubmit:nt})})]})},Kt=a.memo(Lt);export{Kt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as f,r as a,l as m,o as x,j as i,Z as v,q as L,$ as r,a0 as R,m as C,n as k,a1 as B,a2 as E}from"./index.
|
|
1
|
+
import{F as f,r as a,l as m,o as x,j as i,Z as v,q as L,$ as r,a0 as R,m as C,n as k,a1 as B,a2 as E}from"./index.CXVpBAvU.js";const z=f("button",{target:"e1a81sb30"})(({theme:o})=>({fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,color:o.colors.fadedText60,backgroundColor:o.colors.transparent,fontFamily:"inherit",margin:o.spacing.none,border:"none",boxShadow:"none",padding:o.spacing.none,"&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:o.colors.primary}})),H=f("div",{target:"e1a81sb31"})(({theme:o})=>({display:"flex",flexDirection:"row",gap:o.spacing.lg,"> span":{marginTop:o.spacing.twoXS}})),D=f("div",{target:"e1a81sb32"})(({theme:o})=>({display:"flex",flexDirection:"column",gap:o.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,div:{display:"inline-flex"}}));function M(o){const t=C(o);return{Body:{props:{"data-testid":"stToast",className:"stToast"},style:{display:"flex",flexDirection:"row",gap:o.spacing.md,width:o.sizes.toastWidth,marginTop:o.spacing.sm,borderTopLeftRadius:o.radii.default,borderTopRightRadius:o.radii.default,borderBottomLeftRadius:o.radii.default,borderBottomRightRadius:o.radii.default,paddingTop:o.spacing.lg,paddingBottom:o.spacing.lg,paddingLeft:o.spacing.twoXL,paddingRight:o.spacing.twoXL,backgroundColor:o.colors.bgColor,filter:t?"brightness(0.98)":"brightness(1.2)",color:o.colors.bodyText,boxShadow:t?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:o.colors.fadedText40,width:o.fontSizes.lg,height:o.fontSizes.lg,marginRight:`calc(-1 * ${o.spacing.lg} / 2)`,":hover":{color:o.colors.bodyText}}}}}function I(o){if(o.length>104){let s=o.replace(/^(.{104}[^\s]*).*/,"$1");return s.length>104&&(s=s.substring(0,104).split(" ").slice(0,-1).join(" ")),s.trim()}return o}function j({element:o}){const{body:t,icon:s,duration:d}=o,n=m(),c=I(t),l=t!==c,[e,T]=a.useState(!l),[b,S]=a.useState(0),y=a.useCallback(()=>{T(!e)},[e]),g=a.useMemo(()=>M(n),[n]),p=a.useMemo(()=>x(H,{expanded:e,children:[s&&i(v,{iconValue:s,size:"xl",testid:"stToastDynamicIcon"}),x(D,{children:[i(L,{source:e?t:c,allowHTML:!1,isToast:!0}),l&&i(z,{"data-testid":"stToastViewButton",onClick:y,children:e?"view less":"view more"})]})]}),[l,e,t,s,c,y]);a.useEffect(()=>{if(n.inSidebar)return;const w=k(d)?d===0?0:d*1e3:4e3,u=r.info(p,{overrides:{...g},autoHideDuration:w});return S(u),()=>{r.update(u,{overrides:{Body:{style:{display:"none"}}}}),r.clear(u)}},[]),a.useEffect(()=>{r.update(b,{children:p,overrides:{...g}})},[b,p,g]);const h=i(E,{kind:B.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information."});return i(R,{children:n.inSidebar&&h})}const O=a.memo(j);export{O as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as Bt,c_ as Er,d0 as ef,cZ as tf,d8 as At,ah as uh,d9 as gs,da as wN,cX as j2,c$ as ku,db as ap,dc as H2,_ as KR,j as Gf,a0 as TN,F as ZR,m as YR,X as QR,dd as rC,bj as EN,L as CN,l as SN,o as nC,cu as IN,de as iC}from"./index.
|
|
1
|
+
import{r as Bt,c_ as Er,d0 as ef,cZ as tf,d8 as At,ah as uh,d9 as gs,da as wN,cX as j2,c$ as ku,db as ap,dc as H2,_ as KR,j as Gf,a0 as TN,F as ZR,m as YR,X as QR,dd as rC,bj as EN,L as CN,l as SN,o as nC,cu as IN,de as iC}from"./index.CXVpBAvU.js";import{_ as BN,C as PN}from"./toConsumableArray.CcKcKvEd.js";import{E as e4,w as MN}from"./withFullScreenWrapper.Cw_ebNmr.js";import{a as RN,T as ON}from"./Toolbar.guIuiwEF.js";import{l as d1}from"./index.8HslT92O.js";import{a as DN}from"./useBasicWidgetState.D-fc_aIL.js";import{u as FN,s as LN}from"./threshold.CUNQbqMA.js";import"./FormClearHelper.D4lty7rT.js";import"./value.DaKxGC7O.js";function kN(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in r)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(r,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}function sC(r,e){if(!r)throw new Error(e||"loader assertion failed.")}const t4=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),oC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);oC&&parseFloat(oC[1]);const aC=globalThis,lC=globalThis.process||{},NN=globalThis.navigator||{};function r4(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;const t=typeof navigator<"u"&&navigator.userAgent;return!!(t&&t.indexOf("Electron")>=0)}function fh(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||r4()}function UN(r){return fh()?r4()?"Electron":(NN.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const n4="4.1.0";function zN(r){try{const e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}class VN{constructor(e,t,n="sessionStorage"){this.storage=zN(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function GN(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function jN(r,e=8){const t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var Dm;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Dm||(Dm={}));const HN=10;function cC(r){return typeof r!="string"?r:(r=r.toUpperCase(),Dm[r]||Dm.WHITE)}function WN(r,e,t){return!fh&&typeof r=="string"&&(e&&(r=`\x1B[${cC(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${cC(t)+HN}m${r}\x1B[49m`)),r}function $N(r,e=["constructor"]){const t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),i=r;for(const s of n){const o=i[s];typeof o=="function"&&(e.find(l=>s===l)||(i[s]=o.bind(r)))}}function W2(r,e){if(!r)throw new Error("Assertion failed")}function ld(){let r;if(fh()&&aC.performance)r=aC?.performance?.now?.();else if("hrtime"in lC){const e=lC?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}const cd={debug:fh()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},XN={enabled:!0,level:0};function ud(){}const uC={},fC={once:!0};class wp{constructor({id:e}={id:""}){this.VERSION=n4,this._startTs=ld(),this._deltaTs=ld(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new VN(`__probe-${this.id}__`,XN),this.timeStamp(`${this.id} started`),$N(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((ld()-this._startTs).toPrecision(10))}getDelta(){return Number((ld()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,cd.warn,arguments,fC)}error(e){return this._getLogFunction(0,e,cd.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,cd.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,cd.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,cd.debug||cd.info,arguments,fC)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||ud,n&&[n],{tag:JN(t)}):ud}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||ud)}group(e,t,n={collapsed:!1}){const i=hC({logLevel:e,message:t,opts:n}),{collapsed:s}=n;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||ud)}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=i4(e)}_getLogFunction(e,t,n,i,s){if(this._shouldLog(e)){s=hC({logLevel:e,message:t,args:i,opts:s}),n=n||s.method,W2(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=ld();const o=s.tag||s.message;if(s.once&&o)if(!uC[o])uC[o]=ld();else return ud;return t=qN(this.id,s.message,s),n.bind(console,t,...s.args)}return ud}}wp.VERSION=n4;function i4(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return W2(Number.isFinite(e)&&e>=0),e}function hC(r){const{logLevel:e,message:t}=r;r.logLevel=i4(e);const n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break}typeof r.message=="function"&&(r.message=r.message());const i=typeof r.message;return W2(i==="string"||i==="object"),Object.assign(r,{args:n},r.opts)}function qN(r,e,t){if(typeof e=="string"){const n=t.time?jN(GN(t.total)):"";e=t.time?`${r}: ${n} ${e}`:`${r}: ${e}`,e=WN(e,t.color,t.background)}return e}function JN(r){for(const e in r)for(const t in r[e])return t||"untitled";return"empty"}globalThis.probe={};const s4=new wp({id:"@probe.gl/log"}),Qy="4.3.3",KN=Qy[0]>="0"&&Qy[0]<="9"?`v${Qy}`:"";function ZN(){const r=new wp({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=r,globalThis.loaders.version=KN,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=r,r}const YN=ZN();function QN(r,e){return o4(r||{},e)}function o4(r,e,t=0){if(t>3)return e;const n={...r};for(const[i,s]of Object.entries(e))s&&typeof s=="object"&&!Array.isArray(s)?n[i]=o4(n[i]||{},e[i],t+1):n[i]=e[i];return n}const e5="latest";function t5(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}const r5=t5();function qu(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}const Kf=typeof process!="object"||String(process)!=="[object process]"||process.browser,n5=typeof window<"u"&&typeof window.orientation<"u",dC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);dC&&parseFloat(dC[1]);class i5{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,t){this.name=e,this.workerThread=t,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){qu(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){qu(this.isRunning),this.isRunning=!1,this._reject(e)}}class ev{terminate(){}}const tv=new Map;function s5(r){qu(r.source&&!r.url||!r.source&&r.url);let e=tv.get(r.source||r.url);return e||(r.url&&(e=o5(r.url),tv.set(r.url,e)),r.source&&(e=a4(r.source),tv.set(r.source,e))),qu(e),e}function o5(r){if(!r.startsWith("http"))return r;const e=a5(r);return a4(e)}function a4(r){const e=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(e)}function a5(r){return`try {
|
|
2
2
|
importScripts('${r}');
|
|
3
3
|
} catch (error) {
|
|
4
4
|
console.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aE as A,aF as p,aG as y,aH as d,aI as j,aJ as C}from"./index.
|
|
1
|
+
import{aE as A,aF as p,aG as y,aH as d,aI as j,aJ as C}from"./index.CXVpBAvU.js";const m=/[#.]/g;function x(r,e){const n=r||"",t={};let i=0,o,f;for(;i<n.length;){m.lastIndex=i;const a=m.exec(n),s=n.slice(i,a?a.index:n.length);s&&(o?o==="#"?t.id=s:Array.isArray(t.className)?t.className.push(s):t.className=[s]:f=s,i+=s.length),a&&(o=a[0],i++)}return{type:"element",tagName:f||e||"div",properties:t,children:[]}}function u(r,e,n){const t=n?G(n):void 0;function i(o,f,...a){let s;if(o==null){s={type:"root",children:[]};const c=f;a.unshift(c)}else{s=x(o,e);const c=s.tagName.toLowerCase(),g=t?t.get(c):void 0;if(s.tagName=g||c,S(f))a.unshift(f);else for(const[N,b]of Object.entries(f))M(r,s.properties,N,b)}for(const c of a)l(s.children,c);return s.type==="element"&&s.tagName==="template"&&(s.content={type:"root",children:s.children},s.children=[]),s}return i}function S(r){if(r===null||typeof r!="object"||Array.isArray(r))return!0;if(typeof r.type!="string")return!1;const e=r,n=Object.keys(r);for(const t of n){const i=e[t];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const o=i;for(const f of o)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in r&&Array.isArray(r.children))}function M(r,e,n,t){const i=A(r,n);let o;if(t!=null){if(typeof t=="number"){if(Number.isNaN(t))return;o=t}else typeof t=="boolean"?o=t:typeof t=="string"?i.spaceSeparated?o=p(t):i.commaSeparated?o=y(t):i.commaOrSpaceSeparated?o=p(y(t).join(" ")):o=h(i,i.property,t):Array.isArray(t)?o=[...t]:o=i.property==="style"?w(t):String(t);if(Array.isArray(o)){const f=[];for(const a of o)f.push(h(i,i.property,a));o=f}i.property==="className"&&Array.isArray(e.className)&&(o=e.className.concat(o)),e[i.property]=o}}function l(r,e){if(e!=null)if(typeof e=="number"||typeof e=="string")r.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)l(r,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?l(r,e.children):r.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function h(r,e,n){if(typeof n=="string"){if(r.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((r.boolean||r.overloadedBoolean)&&(n===""||d(n)===d(e)))return!0}return n}function w(r){const e=[];for(const[n,t]of Object.entries(r))e.push([n,t].join(": "));return e.join("; ")}function G(r){const e=new Map;for(const n of r)e.set(n.toLowerCase(),n);return e}const L=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],O=u(j,"div"),k=u(C,"g",L);export{O as h,k as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,L,I as M,B as w,u as T,o as U,j as u,b as A,c as P,D as j,a as N,J as Y}from"./index.
|
|
1
|
+
import{r as o,L,I as M,B as w,u as T,o as U,j as u,b as A,c as P,D as j,a as N,J as Y}from"./index.CXVpBAvU.js";import{m as z}from"./iconPosition.DPAvXTmd.js";import{c as R}from"./createDownloadLinkElement.DSqCyu38.js";function F(S){const{disabled:i,element:r,widgetMgr:B,endpoints:t,fragmentId:g}=S,{help:v,label:x,icon:I,ignoreRerun:h,type:p,url:k,deferredFileId:n}=r,b=r.shortcut?r.shortcut:void 0,[C,f]=o.useState(!1),[l,s]=o.useState(null),{enforceDownloadInNewTab:d=!1}=o.useContext(L),{requestDeferredFile:D}=o.useContext(M);let m=w.SECONDARY;p==="primary"?m=w.PRIMARY:p==="tertiary"&&(m=w.TERTIARY);const c=o.useMemo(()=>t.buildDownloadUrl(k),[t,k]);o.useEffect(()=>{n?.length||t.checkSourceUrlResponse(c,"Download Button")},[c,t,n]);const E=o.useCallback(async()=>{if(!D||!n){s("Deferred download not properly configured");return}f(!0),s(null);try{const e=await D(n);if(e.errorMsg){s(e.errorMsg),f(!1);return}const a=t.buildDownloadUrl(e.url);t.checkSourceUrlResponse(a,"Download Button"),R({filename:"",url:a,enforceDownloadInNewTab:d}).click()}catch(e){const a=e instanceof Error?e.message:"Download failed";s(a)}finally{f(!1)}},[D,n,t,d]),y=o.useCallback(()=>{if(i)return;h||B.setTriggerValue(r,{fromUi:!0},g),!!n?.length?E():R({filename:"",url:c,enforceDownloadInNewTab:d}).click()},[i,h,B,r,g,n,E,c,d]);return T({shortcut:b,disabled:i,onActivate:y}),o.useEffect(()=>{if(l){const e=setTimeout(()=>s(null),5e3);return()=>clearTimeout(e)}},[l]),U("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:[u(N,{help:v,containerWidth:!0,children:u(A,{kind:m,size:P.SMALL,disabled:i||C,onClick:y,containerWidth:!0,children:u(j,{icon:C?"spinner":I,iconPosition:z(r.iconPosition),label:x,shortcut:b})})}),l&&u(Y,{"data-testid":"stDownloadButtonError",children:l})]})}const O=o.memo(F);export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,E as S,_ as A,b0 as o,m as D,b1 as j,F as c,b2 as H,aC as v,l as P,k as G,o as f,j as l,p as F,q as b,P as q,az as U,b3 as X,ab as Y}from"./index.
|
|
1
|
+
import{r as a,E as S,_ as A,b0 as o,m as D,b1 as j,F as c,b2 as H,aC as v,l as P,k as G,o as f,j as l,p as F,q as b,P as q,az as U,b3 as X,ab as Y}from"./index.CXVpBAvU.js";import{e as J,S as K,a as Q,b as Z}from"./embed.CqzzUq73.js";import{W as ee}from"./WidgetLabelHelpIconInline.CzodezAH.js";import{i as L,f as re}from"./formatNumber.CT_v8e75.js";import"./threshold.CUNQbqMA.js";import"./value.DaKxGC7O.js";import"./timer.BZio6gjG.js";import"./numbro.B9_PXfzp.js";import"./sprintf.DpPCfzXw.js";var z=a.forwardRef(function(e,r){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(S,A({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),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"}))});z.displayName="ArrowDownward";var h=a.forwardRef(function(e,r){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(S,A({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),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"}))});h.displayName="ArrowUpward";function k(e,r){switch(r){case o.MetricColor.RED:return e.colors.redColor;case o.MetricColor.GREEN:return e.colors.greenColor;case o.MetricColor.ORANGE:return e.colors.orangeColor;case o.MetricColor.YELLOW:return e.colors.yellowColor;case o.MetricColor.BLUE:return e.colors.blueColor;case o.MetricColor.VIOLET:return e.colors.violetColor;case o.MetricColor.PRIMARY:return e.colors.primary;default:return e.colors.grayColor}}function V(e,r){const t=D(e);switch(r){case o.MetricColor.RED:return e.colors.redBackgroundColor;case o.MetricColor.GREEN:return e.colors.greenBackgroundColor;case o.MetricColor.ORANGE:return e.colors.orangeBackgroundColor;case o.MetricColor.YELLOW:return e.colors.yellowBackgroundColor;case o.MetricColor.BLUE:return e.colors.blueBackgroundColor;case o.MetricColor.VIOLET:return e.colors.violetBackgroundColor;case o.MetricColor.PRIMARY:return j(e.colors.primary,t?.9:.7);default:return e.colors.grayBackgroundColor}}function oe(e,r){switch(r){case o.MetricColor.RED:return e.colors.redTextColor;case o.MetricColor.GREEN:return e.colors.greenTextColor;case o.MetricColor.ORANGE:return e.colors.orangeTextColor;case o.MetricColor.YELLOW:return e.colors.yellowTextColor;case o.MetricColor.BLUE:return e.colors.blueTextColor;case o.MetricColor.VIOLET:return e.colors.violetTextColor;case o.MetricColor.PRIMARY:return e.colors.primary;default:return e.colors.grayTextColor}}const te=c("div",{target:"e132k71j0"})(({theme:e,showBorder:r})=>({height:"100%",...r&&{border:`${e.sizes.borderWidth} solid ${e.colors.borderColor}`,borderRadius:e.radii.default,overflow:"hidden"}})),ie=c("div",{target:"e132k71j1"})(({theme:e,showBorder:r})=>({...r&&{padding:`calc(${e.spacing.lg} - ${e.sizes.borderWidth})`}})),le=c("div",{target:"e132k71j2"})(({theme:e,showBorder:r})=>({marginTop:r?void 0:e.spacing.lg,marginBottom:r?e.spacing.twoXL:void 0})),x=c("div",{target:"e132k71j3"})(({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"}}})),ae=c(H,{target:"e132k71j4"})(({visibility:e})=>({marginBottom:0,display:e===v.Collapsed?"none":"grid",gridTemplateColumns:e===v.Collapsed?"initial":"auto 1fr",visibility:e===v.Hidden?"hidden":"visible"})),ne=c("div",{target:"e132k71j5"})(({theme:e})=>({fontSize:e.fontSizes.threeXL,color:e.colors.bodyText,paddingBottom:e.spacing.twoXS})),se=c("div",{target:"e132k71j6"})(({theme:e,metricColor:r,showArrow:t})=>({color:oe(e,r),backgroundColor:V(e,r),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}`,...t&&{paddingLeft:e.spacing.twoXS}})),ce=1e3;function R(e,r){try{return re(Number(e),r)}catch{return e}}function de(e,r,t,i,p){const n=`metric_chart_${Math.random().toString(36).slice(2,10)}`,m=e.length===1?[e[0],e[0]]:e,s={$schema:"https://vega.github.io/schema/vega-lite/v5.json",width:Math.round(t),height:Math.round(Y("3.5rem")),data:{values:m.map((M,g)=>({x:g,y:M}))},layer:[{name:`${n}_mark`,mark:{type:"line",...r===o.ChartType.LINE&&{type:"line",strokeCap:"round",strokeWidth:i.sizes.metricStrokeWidth},...r===o.ChartType.BAR&&{type:"bar",cornerRadius:parseFloat(i.radii.full)},...r===o.ChartType.AREA&&{type:"area",color:V(i,p),opacity:1,line:{color:k(i,p),opacity:1,strokeWidth:i.sizes.metricStrokeWidth,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>ce?"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},...r===o.ChartType.BAR&&{padding:{left:0,right:0,top:2,bottom:2}},mark:{tooltip:{content:"encoding"},color:k(i,p)}}};return s.config=Q(s.config,i),s}function ue({element:e}){const r=P(),t=a.useRef(null),{width:i,elementRef:p}=G(),{MetricDirection:C}=o,{body:n,label:m,delta:s,direction:M,color:g,labelVisibility:B,help:E,showBorder:w,chartData:d,chartType:T,format:y}=e,N=y&&L(n)?R(n,y):n,I=y&&s&&L(s)?R(s,y):s;let u=null;switch(M){case C.DOWN:u=z;break;case C.UP:u=h;break;case C.NONE:break}const W="0 threeXS 0 0",$=s!=="";return a.useEffect(()=>{if(d&&d.length>0&&t.current&&i>0){const O=de(d,T,i,r,g);J(t.current,O,{actions:!1,renderer:"svg",ast:!0,expr:Z,tooltip:{theme:"custom",formatTooltip:_=>`${_.y}`}})}},[d,g,r,i,T,t]),f(te,{className:"stMetric","data-testid":"stMetric",showBorder:w,children:[f(ie,{showBorder:w,children:[f(ae,{"data-testid":"stMetricLabel",visibility:F(B?.value),children:[l(x,{children:l(b,{source:m,allowHTML:!1,isLabel:!0})}),E&&l(ee,{content:E,placement:q.TOP_RIGHT,label:m})]}),l(ne,{"data-testid":"stMetricValue",children:l(x,{children:l(b,{source:N,allowHTML:!1,isLabel:!0,inheritFont:!0})})}),$&&f(se,{"data-testid":"stMetricDelta",metricColor:g,showArrow:u!==null,children:[u&&l(U,{testid:u===h?"stMetricDeltaIcon-Up":"stMetricDeltaIcon-Down",content:u,size:"md",margin:W}),l(x,{children:l(b,{source:I,allowHTML:!1,isLabel:!0,inheritFont:!0})})]})]}),d&&d.length>0&&f("div",{ref:p,children:[l(X,{styles:[K]}),l(le,{ref:t,"data-testid":"stMetricChart",showBorder:w})]})]})}const be=a.memo(ue);export{be as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as W,aC as O,F as _,r as i,k as $,l as q,aa as S,ab as G,o as M,j as c,ac as N,ad as J,af as Q}from"./index.
|
|
1
|
+
import{p as W,aC as O,F as _,r as i,k as $,l as q,aa as S,ab as G,o as M,j as c,ac as N,ad as J,af as Q}from"./index.CXVpBAvU.js";import{I as X}from"./InputInstructions.BWw9lhud.js";import{u as Y}from"./useBasicWidgetState.D-fc_aIL.js";import{u as Z,a as tt,b as et}from"./useUpdateUiValue.CDQloDgB.js";import{u as ot,T as at}from"./useTextInputAutoExpand.C0jK7TwF.js";import{u as it}from"./uniqueId.PRn3V1WU.js";import"./FormClearHelper.D4lty7rT.js";import"./inputUtils.CptNuJwn.js";import"./base-input.Cg7NpsfS.js";const st=(e,t)=>{let a="auto";if(e.heightConfig?.useStretch)a="100%";else if(e.heightConfig?.pixelHeight&&e.heightConfig.pixelHeight>0){const s=W(t.labelVisibility?.value)===O.Collapsed?2:30,l=e.heightConfig.pixelHeight-s;a=`${Math.max(0,l)}px`}return a},rt=_("div",{target:"e1tmb1p40"})({height:"100%",display:"flex",flexDirection:"column"}),T=(e,t)=>e.getStringValue(t)??t.default??null,lt=e=>e.default??null,nt=e=>e.value??null,dt=(e,t,a,s)=>{t.setStringValue(e,a.value,{fromUi:a.fromUi},s)},ut=({disabled:e,element:t,widgetMgr:a,fragmentId:s,outerElement:l})=>{const h=i.useRef(it("text_area_")).current,{width:y,elementRef:V}=$(),[r,g]=i.useState(!1),[I,x]=i.useState(!1),n=l.heightConfig?.useContent??!1,v=l.heightConfig?.useStretch??!1,F=st(l,t),C=i.useRef(null),[d,p]=i.useState(()=>T(a,t)??null),A=i.useCallback(()=>{p(t.default??null),g(!0)},[t]),[R,f]=Y({getStateFromWidgetMgr:T,getDefaultStateFromProto:lt,getCurrStateFromProto:nt,updateWidgetMgrState:dt,element:t,widgetMgr:a,fragmentId:s,onFormCleared:A});Z(R,d,p,r);const o=q(),{height:k,maxHeight:L,updateScrollHeight:H}=ot({textareaRef:C,dependencies:[t.placeholder]}),m=i.useCallback(()=>{g(!1),f({value:d,fromUi:!0})},[d,f]),z=i.useCallback(()=>{r&&m(),x(!1)},[r,m]),B=i.useCallback(()=>{x(!0)},[]),D=i.useCallback(()=>{n&&H()},[n,H]),E=tt({formId:t.formId,maxChars:t.maxChars,setDirty:g,setUiValue:p,setValueWithSource:f,additionalAction:D}),U=et(t.formId,m,r,a,s,!0),{placeholder:P,formId:b}=t,j=S({formId:b})?a.allowFormEnterToSubmit(b):r,w=I&&y>G(o.breakpoints.hideWidgetDetails);return M(rt,{className:"stTextArea","data-testid":"stTextArea",ref:V,children:[c(J,{label:t.label,disabled:e,labelVisibility:W(t.labelVisibility?.value),htmlFor:h,children:t.help&&c(N,{content:t.help,label:t.label})}),c(at,{inputRef:n?C:void 0,value:d??"",placeholder:P,onBlur:z,onFocus:B,onChange:E,onKeyDown:U,"aria-label":t.label,disabled:e,id:h,overrides:{Input:{style:{fontWeight:o.fontWeights.normal,lineHeight:o.lineHeights.inputWidget,height:n?k:F,maxHeight:n?L:"",minHeight:o.sizes.largestElementHeight,resize:v?"none":"vertical",paddingRight:o.spacing.md,paddingLeft:o.spacing.md,paddingBottom:o.spacing.md,paddingTop:o.spacing.md,"::placeholder":{color:o.colors.fadedText60}}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:({$isFocused:K})=>{const u=Q(o.colors,K);return{borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,borderTopColor:u,borderRightColor:u,borderBottomColor:u,borderLeftColor:u,flexGrow:1}}}}}),w&&c(X,{dirty:r,value:d??"",maxLength:t.maxChars,type:"multiline",inForm:S({formId:b}),allowEnterToSubmit:j})]})},Ht=i.memo(ut);export{Ht as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,E as S,_ as z,W as dt,F as m,aj as Re,cw as b,cu as Me,o as A,j as a,P as ue,az as V,aA as pe,a0 as K,b as ut,B as pt,Z as Te,bX as gt,l as ft,k as ht,b8 as mt,cx as wt,e as ie,bS as Ve,bT as vt,ab as Ct}from"./index.CXVpBAvU.js";import{u as ke,I as yt,g as Ae,F as G,E as ce,b as xt,s as bt,a as Fe}from"./FileHelper.BOHlwlc9.js";import{u as St}from"./useWaveformController.BLEIAIDo.js";import{I as zt}from"./InputInstructions.BWw9lhud.js";import{u as Et,T as It}from"./useTextInputAutoExpand.C0jK7TwF.js";import{i as Rt}from"./inputUtils.CptNuJwn.js";import{T as Vt}from"./TableChart.esm.7KFX5I_G.js";import{E as At}from"./ErrorOutline.esm.BAZUU4id.js";import{U as De}from"./UploadFileInfo.Dr-zDST7.js";import"./base-input.Cg7NpsfS.js";var Ue=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),r.createElement("path",{d:"M14 17H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}))});Ue.displayName="Article";var He=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}))});He.displayName="Code";var Le=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"}))});Le.displayName="Description";var Be=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M9.17 6l2 2H20v10H4V6h5.17M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"}))});Be.displayName="Folder";var Ne=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"}))});Ne.displayName="Image";var We=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 3l.01 10.55c-.59-.34-1.27-.55-2-.55a4.001 4.001 0 100 8c2.22 0 3.99-1.79 3.99-4V7h4V3h-6zm-1.99 16c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"}))});We.displayName="MusicNote";var Pe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm-1-9c0-.55.45-1 1-1s1 .45 1 1v6c0 .55-.45 1-1 1s-1-.45-1-1V5zm6 6c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});Pe.displayName="MicNone";var Oe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M15 8v8H5V8h10m1-2H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4V7c0-.55-.45-1-1-1z"}))});Oe.displayName="Videocam";var $e=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z"}))});$e.displayName="Add";var Xe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M13 19V7.83l4.88 4.88c.39.39 1.03.39 1.42 0a.996.996 0 000-1.41l-6.59-6.59a.996.996 0 00-1.41 0l-6.6 6.58a.996.996 0 101.41 1.41L11 7.83V19c0 .55.45 1 1 1s1-.45 1-1z"}))});Xe.displayName="ArrowUpward";var je=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm4.29 12.89a.996.996 0 11-1.41 1.41L12 13.41 9.11 16.3a.996.996 0 11-1.41-1.41L10.59 12 7.71 9.11A.996.996 0 119.12 7.7L12 10.59l2.89-2.89a.996.996 0 111.41 1.41L13.41 12l2.88 2.89z"}))});je.displayName="Cancel";var _e=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M18 6.7l-8.48 8.48-3.54-3.54a.996.996 0 10-1.41 1.41l4.24 4.24c.39.39 1.02.39 1.41 0l9.18-9.18a.999.999 0 00-.01-1.42c-.37-.38-1-.38-1.39.01z"}))});_e.displayName="Check";var Ke=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M18.3 5.71a.996.996 0 00-1.41 0L12 10.59 7.11 5.7A.996.996 0 105.7 7.11L10.59 12 5.7 16.89a.996.996 0 101.41 1.41L12 13.41l4.89 4.89a.996.996 0 101.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"}))});Ke.displayName="Close";var Ge=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(S,z({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm0 4c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"}))});Ge.displayName="ErrorOutline";const _=dt.getLogger("ChatInput"),Ft=m("div",{target:"e5ztmp70"})({position:"relative",display:"flex",flexDirection:"column"}),Mt=m("div",{target:"e5ztmp71"})(({theme:e})=>({backgroundColor:e.colors.secondaryBg,border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.widgetBorderColor??e.colors.transparent,position:"relative",display:"flex",flexDirection:"column",alignItems:"stretch",flex:1,paddingTop:e.spacing.md,paddingBottom:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg,gap:e.spacing.sm,borderRadius:e.radii.default,boxSizing:"border-box",":focus-within":{borderColor:e.colors.primary}})),Tt=m("div",{target:"e5ztmp72"})(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing.sm})),kt=m("div",{target:"e5ztmp73"})(({theme:e,isStacked:t})=>({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",gap:e.spacing.sm,flexWrap:t?"wrap":"nowrap"})),Dt=m("div",{target:"e5ztmp74"})(({isStacked:e})=>({flex:e?"none":1,width:e?"100%":"auto",order:e?-1:0,display:"flex",alignItems:"center",minWidth:0})),Ut=m("div",{target:"e5ztmp75"})(({theme:e})=>({display:"flex",flexDirection:"row",flexShrink:0,gap:e.spacing.sm,alignItems:"center"})),Ht=m("div",{target:"e5ztmp76"})(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing.sm,alignItems:"center"})),Lt=m("div",{target:"e5ztmp77"})(({theme:e})=>({position:"absolute",top:e.spacing.twoXS,right:e.spacing.lg,color:e.colors.fadedText60,fontSize:e.fontSizes.twoSm,textAlign:"right",whiteSpace:"nowrap",pointerEvents:"auto",cursor:"text",zIndex:e.zIndices.priority,"& .stChatInputInstructions":{position:"static"}})),T=m("button",{target:"e5ztmp78"})(({theme:e,disabled:t,hasError:o,primary:p})=>{if(p)return{border:"none",backgroundColor:t?e.colors.darkenedBgMix15:e.colors.primary,borderRadius:e.radii.button,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.xs,width:e.sizes.chatInputPrimaryButtonSize,height:e.sizes.chatInputPrimaryButtonSize,color:t?e.colors.fadedText40:e.colors.white,cursor:t?"not-allowed":"pointer",transition:"background-color 200ms ease","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{boxShadow:Re(e)},"&:hover":{backgroundColor:t?e.colors.darkenedBgMix15:e.colors.primary}};const l=()=>o?e.colors.redTextColor:t?e.colors.fadedText40:e.colors.fadedText60;return{border:"none",backgroundColor:e.colors.transparent,borderRadius:e.radii.default,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.none,color:l(),pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{boxShadow:Re(e)},"&:hover":{color:o?e.colors.redColor:e.colors.bodyText},"&:active":{color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:e.colors.transparent,borderColor:e.colors.transparent,color:e.colors.fadedText40,cursor:"not-allowed"},"& svg":{width:e.iconSizes.lg,height:e.iconSizes.lg}}}),Bt=m("div",{target:"e5ztmp79"})(({isRecording:e})=>({display:e?"flex":"none",flex:1,alignItems:"center",minWidth:0})),Nt=m("div",{target:"e5ztmp710"})(({theme:e})=>({position:"relative",width:"100%",height:e.sizes.chatInputPrimaryButtonSize,borderRadius:e.radii.default,overflow:"hidden","& > div":{position:"absolute",inset:0}})),Ye=(e,t)=>t===b.Directory?{...e,webkitdirectory:"",multiple:!0}:e,Wt=(e,t)=>{if(!t||t.length===0)return!0;const o=e.name.toLowerCase(),p=o.lastIndexOf(".");if(p===-1||p===o.length-1)return t.some(d=>d===""||d===".");const l=o.substring(p),w=o.substring(p+1);return t.some(d=>{const v=d.toLowerCase();return v.startsWith(".")?l===v:w===v})},Pt=(e,t)=>Wt(e,t)?{isValid:!0}:{isValid:!1,errorMessage:`${e.type||"This type of"} files are not allowed.`},de=e=>{switch(e){case b.None:return"a file";case b.Single:return"a file";case b.Multiple:return"files";case b.Directory:return"a directory";default:return Me(e),"a file"}},Ot=m("div",{target:"e1lsn30a0"})(({theme:e})=>({backgroundColor:e.colors.transparent,position:"absolute",inset:0,zIndex:e.zIndices.priority,borderRadius:e.radii.chatInput})),$t=m("div",{target:"e1lsn30a1"})(({theme:e})=>({position:"absolute",inset:0,border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.primary,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,color:e.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:e.fontWeights.bold,pointerEvents:"none",zIndex:e.zIndices.priority})),Xt=m("div",{target:"e1lsn30a2"})(({disabled:e})=>({pointerEvents:e?"none":"auto"})),jt=m("div",{target:"e1lsn30a3"})(({theme:e})=>({lineHeight:e.lineHeights.tight})),_t=m("div",{target:"e1lsn30a4"})(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing.sm})),Kt=m("div",{target:"e1lsn30a5"})({flex:"0 0 auto",maxWidth:"100%"}),Gt=m("div",{target:"e1lsn30a6"})(({theme:e,isError:t,isClickable:o})=>({position:"relative",display:"inline-flex",alignItems:"center",width:"fit-content",minWidth:"9rem",maxWidth:"100%",backgroundColor:t?e.colors.redBackgroundColor:e.colors.bgColor,padding:e.spacing.twoXS,paddingRight:e.spacing.twoXL,borderRadius:e.radii.default,gap:e.spacing.sm,cursor:o?"pointer":"default"})),Yt=m("div",{target:"e1lsn30a7"})({display:"flex",flexDirection:"column",minWidth:0}),qt=m("div",{target:"e1lsn30a8"})(({theme:e,fileStatus:t})=>({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:e.radii.default,width:e.sizes.chatInputFileIconSize,height:e.sizes.chatInputFileIconSize,flexShrink:0,overflow:"hidden",...t==="uploaded"&&{backgroundColor:e.colors.bodyText,color:e.colors.bgColor},...t==="uploading"&&{backgroundColor:e.colors.fadedText10,color:e.colors.fadedText60},...t==="error"&&{backgroundColor:e.colors.redBackgroundColor,color:e.colors.redTextColor}})),Zt=m("img",{target:"e1lsn30a9"})({width:"100%",height:"100%",objectFit:"cover"}),Jt=m("div",{target:"e1lsn30a10"})(({theme:e,fileStatus:t})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t.type==="uploading"?e.colors.fadedText60:e.colors.bodyText})),Qt=m("div",{target:"e1lsn30a11"})(({theme:e})=>({color:e.colors.fadedText60,fontSize:e.fontSizes.sm})),er=m("small",{target:"e1lsn30a12"})(({theme:e,isError:t})=>({position:"absolute",top:e.spacing.twoXS,right:e.spacing.twoXS,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0,"& button":{display:"flex",alignItems:"center",justifyContent:"center",width:"fit-content",height:"fit-content",minHeight:"unset",minWidth:"unset",maxHeight:"unset",maxWidth:"unset",borderRadius:"50%",backgroundColor:"transparent",color:t?e.colors.redTextColor:e.colors.fadedText60,padding:0,overflow:"hidden",boxSizing:"border-box",lineHeight:0,"&:hover":{backgroundColor:"transparent",color:t?e.colors.redColor:e.colors.bodyText}}})),tr=m("span",{target:"e1lsn30a13"})({position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}),rr=({onDrop:e,multiple:t,accept:o,maxSize:p,acceptFile:l,disabled:w})=>{const{getRootProps:d,getInputProps:v}=ke({onDrop:e,multiple:t,accept:o,maxSize:p,useFsAccessApi:!1}),C=Ye(v(),l),c=d({tabIndex:-1});return A(Xt,{"data-testid":"stChatInputFileUploadButton",disabled:w,...c,children:[a("input",{...C}),a(pe,{content:`Upload or drag and drop ${de(l)}`,placement:ue.TOP,onMouseEnterDelay:500,children:a(T,{type:"button",disabled:w,"aria-label":`Upload ${de(l)}`,children:a(V,{content:$e,size:"xl",color:"inherit"})})})]})},or=r.memo(rr),nr=({getRootProps:e,getInputProps:t,acceptFile:o})=>{const p=Ye(t(),o);return A(K,{children:[a(Ot,{...e(),children:a("input",{...p})}),a($t,{children:`Drag and drop ${de(o)} here`})]})},ar=r.memo(nr),qe=new Set(["jpg","jpeg","png","gif","webp","svg","bmp"]),ir=new Set(["pdf"]),sr=new Set(["csv","tsv","xlsx","xls"]),lr=new Set(["txt","md","json","xml","yaml","yml"]),cr=new Set(["py","js","ts","jsx","tsx","css","html","java","cpp","c","go","rs","rb","php","swift","kt","scala","sh","bash","sql"]),dr=new Set(["mp3","wav","m4a","ogg","flac","aac"]),ur=new Set(["mp4","webm","mov","avi","mkv","wmv"]),pr=new Set(["zip","tar","gz","rar","7z","bz2"]);function Ze(e){const t=e.lastIndexOf(".");return t===-1||t===e.length-1?"":e.slice(t+1).toLowerCase()}function gr(e){const t=Ze(e);return qe.has(t)?Ne:ir.has(t)?Ue:sr.has(t)?Vt:lr.has(t)?Le:cr.has(t)?He:dr.has(t)?We:ur.has(t)?Oe:pr.has(t)?Be:yt}function fr(e){const t=Ze(e);return qe.has(t)}const hr=20;function mr(e,t=hr){if(e.length<=t)return e;const o=e.lastIndexOf(".");if(!(o>0&&o<e.length-1)){const f=Math.floor((t-3)/2),g=f>0?e.slice(-f):"";return`${e.slice(0,f)}...${g}`}const l=e.slice(o),w=e.slice(0,o),d=t-l.length-3;if(d<=0){const f=Math.floor((t-3)/2),g=f>0?e.slice(-f):"";return`${e.slice(0,f)}...${g}`}const v=Math.ceil(d/2),C=Math.floor(d/2),c=C>0?w.slice(-C):"";return`${w.slice(0,v)}...${c}${l}`}function wr(e,t){const o=r.useMemo(()=>!e||!fr(t)?null:URL.createObjectURL(e),[e,t]);return r.useEffect(()=>()=>{o&&URL.revokeObjectURL(o)},[o]),o}const vr=({fileInfo:e,imagePreviewUrl:t})=>{const{type:o}=e.status;switch(o){case"uploading":return a(Te,{iconValue:"spinner",testid:"stChatInputFileIconSpinner",size:"lg"});case"error":return a(V,{content:At,size:"lg",testid:"stChatInputFileIconError"});case"uploaded":return t?a(Zt,{src:t,alt:e.name,"data-testid":"stChatInputFileImagePreview"}):a(V,{content:gr(e.name),size:"lg"});default:return Me(o),null}},Cr=({fileInfo:e,onDelete:t,onRetry:o})=>{const p=e.status.type,l=p==="error",w=p==="uploading",d=l&&o!==void 0&&e.file!==void 0,v=r.useId(),C=wr(e.file,e.name),c=e.status.type==="error"?e.status.errorMessage:"Upload failed",f=r.useCallback(()=>{d&&o(e)},[d,o,e]),g=r.useCallback(y=>{d&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),o(e))},[d,o,e]),h=r.useCallback(y=>{y.stopPropagation(),t(e.id)},[t,e.id]),k=w?`Cancel upload of ${e.name}`:`Remove ${e.name}`,Y=Ae(e.size,G.Byte),W=`${e.name}, ${Y}`,D=A(Gt,{className:"stChatInputFile","data-testid":"stChatInputFile",isError:l,isClickable:d,onClick:d?f:void 0,onKeyDown:d?g:void 0,title:d?"Click to retry upload":void 0,role:d?"button":void 0,tabIndex:d?0:void 0,"aria-label":W,"aria-invalid":l||void 0,"aria-describedby":l?v:void 0,children:[a(qt,{fileStatus:p,children:a(vr,{fileInfo:e,imagePreviewUrl:C})}),A(Yt,{children:[a(Jt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:e.name,fileStatus:e.status,children:mr(e.name)}),a(Qt,{children:Ae(e.size,G.Byte)})]}),a(er,{"data-testid":"stChatInputDeleteBtn",isError:l,children:a(ut,{onClick:h,kind:pt.MINIMAL,"aria-label":k,children:a(V,{content:je,size:"md"})})}),l&&A(tr,{id:v,role:"alert",children:["Error: ",c]})]});return l?a(pe,{content:c,placement:ue.TOP,error:!0,children:D}):D},yr=r.memo(Cr),xr=({items:e,onDelete:t,onRetry:o})=>a(jt,{"data-testid":"stChatUploadedFiles",children:a(_t,{children:e.map(p=>a(Kt,{children:a(yr,{fileInfo:p,onDelete:t,onRetry:o})},p.id))})}),br=r.memo(xr),Sr=(e,t,o)=>{const p=[],l=[];return e.forEach(w=>{if(w.size>o){l.push({file:w,errors:[{code:ce.FileTooLarge,message:`File is too large. Maximum size is ${o} bytes.`}]});return}const d=Pt(w,t.fileType);if(!d.isValid){l.push({file:w,errors:[{code:ce.FileInvalidType,message:d.errorMessage||"File type not allowed."}]});return}p.push(w)}),{accepted:p,rejected:l}},zr=({acceptMultipleFiles:e,maxFileSize:t,uploadClient:o,uploadFile:p,addFiles:l,getNextLocalFileId:w,deleteExistingFiles:d,onUploadComplete:v,element:C})=>(c,f)=>{if(c.length>0){const{accepted:g,rejected:h}=Sr(c,C,t);c=g,f=[...f,...h]}if(!e&&c.length===0&&f.length>1){const g=f.findIndex(h=>h.errors?.[0].code===ce.TooManyFiles);g>=0&&(c.push(f[g].file),f.splice(g,1))}if(!e&&c.length>0&&d(),o.fetchFileURLs(c).then(g=>{gt(g,c).forEach(([h,k])=>{p(h,k)})}).catch(g=>{l(c.map(h=>new De(h.name,h.size,w(),{type:"error",errorMessage:g},h)))}),f.length>0){const g=f.map(h=>xt(h,w(),t));l(g)}v()},Er=({getNextLocalFileId:e,addFiles:t,updateFile:o,uploadClient:p,element:l,onUploadProgress:w,onUploadComplete:d})=>(v,C)=>{const c=C.webkitRelativePath||C.name,f=new AbortController,g=new De(c,C.size,e(),{type:"uploading",abortController:f,progress:1},C);t([g]),p.uploadFile({formId:"",...l},v.uploadUrl,C,h=>w(h,g.id),f.signal).then(()=>d(g.id,v)).catch(h=>{h instanceof DOMException&&h.name==="AbortError"||o(g.id,g.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})};function Ir(e,t,o){return{Root:{style:{minHeight:e.sizes.chatInputTextareaMinHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0",...o}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:e.fontWeights.normal,lineHeight:e.lineHeights.inputWidget,"::placeholder":{color:e.colors.fadedText60},height:t.isExtended?t.height:"auto",maxHeight:t.maxHeight,overflowY:"auto",paddingLeft:e.spacing.none,paddingRight:e.spacing.none,paddingBottom:e.spacing.twoXS,paddingTop:e.spacing.twoXS,width:"100%"}}}}const se=(e,t,o)=>o.map(p=>p.id===e?t:p),le=(e,t)=>t.find(o=>o.id===e);function Rr({disabled:e,element:t,widgetMgr:o,fragmentId:p,uploadClient:l}){const w=ft(),{placeholder:d,maxChars:v}=t,C=r.useRef(0),c=r.useRef(null),f=r.useRef(!1),g=r.useRef(null),h=r.useRef(null),{width:k,elementRef:Y}=ht(),{innerWidth:W,innerHeight:D}=mt(),[y,q]=r.useState(t.default),[I,F]=r.useState([]),[U,Z]=r.useState(!1),[H,ge]=r.useState(!1),[J,L]=r.useState(null),[M,Q]=r.useState(!1),[Je,fe]=r.useState(0),ee=t.acceptAudio??!1;r.useEffect(()=>()=>{h.current&&h.current.abort()},[]);const P=Et({textareaRef:c,dependencies:[d,M]}),O=r.useRef(""),$=r.useRef(0),te=r.useRef(null),he=r.useRef(null),B=r.useCallback(n=>{const i=getComputedStyle(n);O.current=`${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;const u=parseFloat(i.paddingLeft)||0,s=parseFloat(i.paddingRight)||0;$.current=n.clientWidth-u-s},[]);r.useLayoutEffect(()=>{const n=c.current;if(!n)return;B(n);const i=new ResizeObserver(()=>B(n));return i.observe(n),()=>i.disconnect()},[B,M]),r.useEffect(()=>{if(y===""){Q(!1);return}if(M)return;const n=c.current;if(!n||(($.current<=0||!O.current)&&B(n),$.current<=0||!O.current))return;te.current||(te.current=document.createElement("canvas"),he.current=te.current.getContext("2d"));const i=he.current;i&&(i.font=O.current,i.measureText(y).width>$.current-10&&Q(!0))},[y,M,B]);const X=r.useMemo(()=>I.some(n=>n.status.type==="uploading")?!1:y!==""||I.length>0,[I,y]),E=wt(t.acceptFile),re=bt(t.maxUploadSizeMb,G.Megabyte,G.Byte),me=r.useCallback(n=>F(i=>[...i,...n]),[]),we=r.useCallback(n=>{n.status.type==="uploading"&&n.status.abortController.abort(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&l.deleteFile(n.status.fileUrls.deleteUrl).catch(i=>{_.error("Failed to delete file from server:",i)})},[l]),ve=r.useCallback(n=>{F(i=>{const u=le(n,i);if(ie(u))return i;we(u);const s=i.filter(x=>x.id!==n);return s.length===0&&fe(x=>x+1),s})},[we]),oe=r.useRef(null),Qe=r.useCallback(n=>{!n.file||n.status.type!=="error"||(F(i=>i.filter(u=>u.id!==n.id)),oe.current&&oe.current([n.file],[]))},[]),Ce=r.useCallback(()=>{const n=I.filter(i=>i.status.type==="uploaded").map(i=>{const{name:u,size:s,status:x}=i,{fileId:ae,fileUrls:ct}=x;return new Ve({fileId:ae,fileUrls:ct,name:u,size:s})});return new vt({uploadedFileInfo:n})},[I]),ye=()=>C.current++,ne=zr({acceptMultipleFiles:E===b.Multiple||E===b.Directory,maxFileSize:re,uploadClient:l,uploadFile:Er({getNextLocalFileId:ye,addFiles:me,updateFile:(n,i)=>{F(u=>se(n,i,u))},uploadClient:l,element:t,onUploadProgress:(n,i)=>{F(u=>{const s=le(i,u);if(ie(s)||s.status.type!=="uploading")return u;const x=Math.round(n.loaded*100/n.total);return s.status.progress===x?u:se(i,s.setStatus({type:"uploading",abortController:s.status.abortController,progress:x}),u)})},onUploadComplete:(n,i)=>{F(u=>{const s=le(n,u);return ie(s)||s.status.type!=="uploading"?u:se(s.id,s.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}),u)})}}),addFiles:me,getNextLocalFileId:ye,deleteExistingFiles:()=>I.forEach(n=>ve(n.id)),onUploadComplete:()=>{c.current&&c.current.focus()},element:t});oe.current=ne;const{getRootProps:et,getInputProps:tt}=ke({onDrop:ne,multiple:E===b.Multiple||E===b.Directory,accept:Fe(t.fileType),maxSize:re,useFsAccessApi:!1}),j=r.useCallback(n=>{if(c.current&&c.current.focus(),!X&&!n||e)return;const i=Ce(),u={data:y,fileUploaderState:i,audioFileInfo:n};o.setChatInputValue(t,u,{fromUi:!0},p),I.length>0&&fe(s=>s+1),F([]),q(""),Q(!1),P.clearScrollHeight()},[X,e,y,I.length,Ce,o,t,p,P]),xe=r.useCallback(async n=>{const i=new Date().toISOString().replace(/[:.]/g,"-"),u=new File([n],`audio-${i}.wav`,{type:"audio/wav"});try{ge(!0);const s=await l.fetchFileURLs([u]);if(s.length===0)throw new Error("Failed to get upload URL for audio file");const x=s[0];h.current=new AbortController,await l.uploadFile({formId:"",...t},x.uploadUrl,u,()=>{},h.current.signal);const ae=new Ve({fileId:x.fileId,fileUrls:x,name:u.name,size:u.size});j(ae)}catch(s){const x="Recording failed";_.error("Audio upload failed:",s),L(x),c.current&&c.current.focus()}finally{ge(!1)}},[l,t,j]),rt=r.useMemo(()=>({onApprove:xe,onPermissionDenied:()=>{const n="Microphone access denied";L(n),_.error("Permission denied:",n)},onError:n=>{L("Recording failed"),_.error("Recording error:",n)},onRecordStart:()=>{L(null)}}),[xe]),R=St({containerRef:g,sampleRate:t.audioSampleRate??void 0,events:rt}),be=r.useCallback(()=>{j()},[j]),ot=n=>{const{metaKey:i,ctrlKey:u,shiftKey:s}=n;Rt(n)&&!s&&!u&&!i&&(n.preventDefault(),be())},nt=n=>{const{value:i}=n.target;v!==0&&i.length>v||(q(i),P.updateScrollHeight(),J&&L(null))},Se=r.useCallback(async n=>{n.preventDefault(),n.stopPropagation(),!(!ee||e||R.state==="recording")&&await R.start()},[ee,e,R]),at=r.useCallback(()=>{R.cancel(),c.current&&c.current.focus()},[R]),ze=r.useCallback(async()=>{const{blob:n}=await R.stop();await R.approve(n)},[R]),Ee=r.useCallback(n=>{Se(n)},[Se]),it=r.useCallback(()=>{ze()},[ze]),st=r.useCallback(()=>{c.current&&c.current.focus()},[]);r.useEffect(()=>{if(t.setValue&&!f.current){f.current=!0;const n=t.value||"";q(n)}},[t.setValue,t.value]),r.useEffect(()=>{f.current=!1},[t]),r.useEffect(()=>{const n=s=>{s.preventDefault(),s.stopPropagation(),!U&&s.dataTransfer?.types.includes("Files")&&Z(!0)},i=s=>{s.preventDefault(),s.stopPropagation(),U&&(s.clientX<=0&&s.clientY<=0||s.clientX>=W&&s.clientY>=D)&&Z(!1)},u=s=>{s.preventDefault(),s.stopPropagation(),U&&Z(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",u),window.addEventListener("dragleave",i),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",u),window.removeEventListener("dragleave",i)}},[U,W,D]);const lt=E!==b.None&&U,N=R.state==="recording",Ie=!N&&k>Ct(w.breakpoints.hideWidgetDetails)&&v>0;return a(Ft,{className:"stChatInput","data-testid":"stChatInput",ref:Y,children:A(Mt,{children:[Ie&&a(Lt,{onClick:st,id:"stChatInputInstructions",children:a(zt,{dirty:X,value:y,maxLength:v,type:"chat",inForm:!1,className:"stChatInputInstructions"})}),lt&&a(ar,{getRootProps:et,getInputProps:tt,acceptFile:E}),E!==b.None&&I.length>0&&a(Tt,{children:a(br,{items:[...I],onDelete:ve,onRetry:Qe})}),A(kt,{isStacked:M,children:[a(Ut,{children:E!==b.None&&!N&&a(or,{onDrop:ne,multiple:E===b.Multiple||E===b.Directory,accept:Fe(t.fileType),maxSize:re,acceptFile:E,disabled:e},Je)}),a(Bt,{isRecording:N,children:a(Nt,{ref:g})}),!N&&a(Dt,{isStacked:M,children:a(It,{inputRef:c,value:y,placeholder:d,onChange:nt,onKeyDown:ot,"aria-label":d,disabled:e,rows:1,"aria-describedby":Ie?"stChatInputInstructions":void 0,overrides:Ir(w,P,{width:"100%"})})}),a(Ht,{children:N?A(K,{children:[a(T,{onClick:at,disabled:e,"data-testid":"stChatInputCancelButton","aria-label":"Cancel recording",children:a(V,{content:Ke,size:"lg",color:"inherit"})}),a(T,{onClick:it,disabled:e||H,"data-testid":"stChatInputApproveButton","aria-label":"Submit recording",children:H?a(Te,{size:"lg",iconValue:"spinner"}):a(V,{content:_e,size:"lg",color:"inherit"})})]}):A(K,{children:[ee&&a(K,{children:J?a(pe,{content:J,placement:ue.TOP,error:!0,children:a(T,{onClick:Ee,disabled:e||H,hasError:!0,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:a(V,{content:Ge,size:"xl",color:"inherit"})})}):a(T,{onClick:Ee,disabled:e||H,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:a(V,{content:Pe,size:"xl",color:"inherit"})})}),a(T,{onClick:be,disabled:!X||e||H,"data-testid":"stChatInputSubmitButton","aria-label":"Send message",primary:!0,children:a(V,{content:Xe,size:"lg",color:"inherit"})})]})})]})]})})}const Br=r.memo(Rr);export{Br as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{W as Q,e as Z,bw as me,bx as ge,F as he,r as d,l as ye,by as V,al as _,j as A,aO as pe,bz as H,bA as Ee,a1 as be,a2 as Fe,o as Ce,a0 as we,aN as Se,n as Ne,S as Oe}from"./index.BRfGUOQ-.js";import{bB as nr}from"./index.BRfGUOQ-.js";import{w as Ae}from"./withCalculatedWidth.D4cpOyNe.js";import{C as W,a as Y}from"./urls.BwSlolu9.js";import{D as Re,a as Ie}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 Te(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 xe(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return Te(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 $e=e=>e==null,Me=e=>encodeURIComponent(e).replaceAll(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),x=Symbol("encodeFragmentIdentifier");function Le(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 je(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?Me(e):encodeURIComponent(e):e}function h(e,r){return r.decode?xe(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 De(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 U(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=je(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&&$e(e[o])||r.skipEmptyString&&e[o]==="",n=Le(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:$(U(e),r),...r&&r.parseFragmentIdentifier&&n?{fragmentIdentifier:h(n,r)}:{}}}function oe(e,r){r={encode:!0,strict:!0,[x]:!0,...r};const t=ne(e.url).split("?")[0]||"",n=U(e.url),a={...$(n,{sort:!1,...r}),...e.query};let s=ae(a,r);s&&=`?${s}`;let o=De(e.url);if(typeof e.fragmentIdentifier=="string"){const i=new URL(t);i.hash=e.fragmentIdentifier,o=r[x]?i.hash:`#${e.fragmentIdentifier}`}return`${t}${s}${o}`}function ie(e,r,t){t={parseFragmentIdentifier:!0,[x]:!1,...t};const{url:n,query:a,fragmentIdentifier:s}=se(e,t);return oe({url:n,query:Ue(a,r),fragmentIdentifier:s},t)}function Pe(e,r,t){const n=Array.isArray(r)?a=>!r.includes(a):(a,s)=>!r(a,s);return ie(e,n,t)}const ke=Object.freeze(Object.defineProperty({__proto__:null,exclude:Pe,extract:U,parse:$,parseUrl:se,pick:ie,stringify:ae,stringifyUrl:oe},Symbol.toStringTag,{value:"Module"}));var S=(function(e){return e.COMPONENT_READY="streamlit:componentReady",e.SET_COMPONENT_VALUE="streamlit:setComponentValue",e.SET_FRAME_HEIGHT="streamlit:setFrameHeight",e})({}),Ve=(function(e){return e.RENDER="streamlit:render",e})({});const He=1,F=Q.getLogger("componentUtils");function We(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 S.COMPONENT_READY:{const{apiVersion:y}=t;y!==He?o(new Error(`Unrecognized component API version: '${y}'`)):i();break}case S.SET_COMPONENT_VALUE:u?Ge(K(t,"value"),t.dataType,{fromUi:!0},a,s,f):F.warn(`Got ${r} before ${S.COMPONENT_READY}!`);break;case S.SET_FRAME_HEIGHT:u?l(K(t,"height")):F.warn(`Got ${r} before ${S.COMPONENT_READY}!`);break;default:F.warn(`Unrecognized ComponentBackMsgType: ${r}`)}}}function Ye(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:Ve.RENDER,args:e,dfs:r,disabled:t,theme:{...me(n),font:n.genericFonts.bodyFont}},"*")}function Ge(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 Be=he("iframe",{target:"edxyb2x0"})(({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 qe(e,r,t){let n;Ne(t)&&t!==""?n=t:n=r.getComponentURL(e,"index.html");const a=Oe.CUSTOM_COMPONENT_CLIENT_ID,s=new URL(window.location.href);return n=ke.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.
|
|
1
|
+
import{W as Q,e as Z,bw as me,bx as ge,F as he,r as d,l as ye,by as V,al as _,j as A,aO as pe,bz as H,bA as Ee,a1 as be,a2 as Fe,o as Ce,a0 as we,aN as Se,n as Ne,S as Oe}from"./index.CXVpBAvU.js";import{bB as nr}from"./index.CXVpBAvU.js";import{w as Ae}from"./withCalculatedWidth.B3oSlRC0.js";import{C as W,a as Y}from"./urls.BwSlolu9.js";import{D as Re,a as Ie}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 Te(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 xe(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return Te(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 $e=e=>e==null,Me=e=>encodeURIComponent(e).replaceAll(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),x=Symbol("encodeFragmentIdentifier");function Le(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 je(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?Me(e):encodeURIComponent(e):e}function h(e,r){return r.decode?xe(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 De(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 U(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=je(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&&$e(e[o])||r.skipEmptyString&&e[o]==="",n=Le(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:$(U(e),r),...r&&r.parseFragmentIdentifier&&n?{fragmentIdentifier:h(n,r)}:{}}}function oe(e,r){r={encode:!0,strict:!0,[x]:!0,...r};const t=ne(e.url).split("?")[0]||"",n=U(e.url),a={...$(n,{sort:!1,...r}),...e.query};let s=ae(a,r);s&&=`?${s}`;let o=De(e.url);if(typeof e.fragmentIdentifier=="string"){const i=new URL(t);i.hash=e.fragmentIdentifier,o=r[x]?i.hash:`#${e.fragmentIdentifier}`}return`${t}${s}${o}`}function ie(e,r,t){t={parseFragmentIdentifier:!0,[x]:!1,...t};const{url:n,query:a,fragmentIdentifier:s}=se(e,t);return oe({url:n,query:Ue(a,r),fragmentIdentifier:s},t)}function Pe(e,r,t){const n=Array.isArray(r)?a=>!r.includes(a):(a,s)=>!r(a,s);return ie(e,n,t)}const ke=Object.freeze(Object.defineProperty({__proto__:null,exclude:Pe,extract:U,parse:$,parseUrl:se,pick:ie,stringify:ae,stringifyUrl:oe},Symbol.toStringTag,{value:"Module"}));var S=(function(e){return e.COMPONENT_READY="streamlit:componentReady",e.SET_COMPONENT_VALUE="streamlit:setComponentValue",e.SET_FRAME_HEIGHT="streamlit:setFrameHeight",e})({}),Ve=(function(e){return e.RENDER="streamlit:render",e})({});const He=1,F=Q.getLogger("componentUtils");function We(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 S.COMPONENT_READY:{const{apiVersion:y}=t;y!==He?o(new Error(`Unrecognized component API version: '${y}'`)):i();break}case S.SET_COMPONENT_VALUE:u?Ge(K(t,"value"),t.dataType,{fromUi:!0},a,s,f):F.warn(`Got ${r} before ${S.COMPONENT_READY}!`);break;case S.SET_FRAME_HEIGHT:u?l(K(t,"height")):F.warn(`Got ${r} before ${S.COMPONENT_READY}!`);break;default:F.warn(`Unrecognized ComponentBackMsgType: ${r}`)}}}function Ye(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:Ve.RENDER,args:e,dfs:r,disabled:t,theme:{...me(n),font:n.genericFonts.bodyFont}},"*")}function Ge(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 Be=he("iframe",{target:"edxyb2x0"})(({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 qe(e,r,t){let n;Ne(t)&&t!==""?n=t:n=r.getComponentURL(e,"index.html");const a=Oe.CUSTOM_COMPONENT_CLIENT_ID,s=new URL(window.location.href);return n=ke.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
2
|
The app is attempting to load the component from **${r}**,
|
|
3
3
|
and hasn't received its \`Streamlit.setComponentReady()\` message.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as Ye}from"./index.bsVAaBS1.js";import{s as Ca,h as qa}from"./index.
|
|
1
|
+
import{w as Ye}from"./index.bsVAaBS1.js";import{s as Ca,h as qa}from"./index.BTA0d5oq.js";import{bt as Ea,bu as Ia,bv as Ra}from"./index.CXVpBAvU.js";class o0{constructor(e,t,a){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=a}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new o0(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class m0{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new m0(t,o0.range(this,e))}}class z{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var a="KaTeX parse error: "+e,n,s,o=t&&t.loc;if(o&&o.start<=o.end){var h=o.lexer.input;n=o.start,s=o.end,n===h.length?a+=" at end of input: ":a+=" at position "+(n+1)+": ";var m=h.slice(n,s).replace(/[^]/g,"$&̲"),p;n>15?p="…"+h.slice(n-15,n):p=h.slice(0,n);var g;s+15<h.length?g=h.slice(s,s+15)+"…":g=h.slice(s),a+=p+m+g}var b=new Error(a);return b.name="ParseError",b.__proto__=z.prototype,b.position=n,n!=null&&s!=null&&(b.length=s-n),b.rawMessage=e,b}}z.prototype.__proto__=Error.prototype;var Oa=function(e,t){return e===void 0?t:e},Fa=/([A-Z])/g,La=function(e){return e.replace(Fa,"-$1").toLowerCase()},Ha={"&":"&",">":">","<":"<",'"':""","'":"'"},Pa=/[&><"']/g;function Va(r){return String(r).replace(Pa,e=>Ha[e])}var Tr=function r(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?r(e.body[0]):e:e.type==="font"?r(e.body):e},Ga=function(e){var t=Tr(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},Ua=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Ya=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},V={deflt:Oa,escape:Va,hyphenate:La,getBaseElem:Tr,isCharacterBox:Ga,protocolFromUrl:Ya},Ae={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function $a(r){if(r.default)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class vt{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var t in Ae)if(Ae.hasOwnProperty(t)){var a=Ae[t];this[t]=e[t]!==void 0?a.processor?a.processor(e[t]):e[t]:$a(a)}}reportNonstrict(e,t,a){var n=this.strict;if(typeof n=="function"&&(n=n(e,t,a)),!(!n||n==="ignore")){if(n===!0||n==="error")throw new z("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),a);n==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+n+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,a){var n=this.strict;if(typeof n=="function")try{n=n(e,t,a)}catch{n="error"}return!n||n==="ignore"?!1:n===!0||n==="error"?!0:n==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+n+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var t=V.protocolFromUrl(e.url);if(t==null)return!1;e.protocol=t}var a=typeof this.trust=="function"?this.trust(e):this.trust;return!!a}}class F0{constructor(e,t,a){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=a}sup(){return y0[Xa[this.id]]}sub(){return y0[Wa[this.id]]}fracNum(){return y0[ja[this.id]]}fracDen(){return y0[Za[this.id]]}cramp(){return y0[Ka[this.id]]}text(){return y0[Ja[this.id]]}isTight(){return this.size>=2}}var gt=0,Be=1,te=2,B0=3,oe=4,f0=5,re=6,n0=7,y0=[new F0(gt,0,!1),new F0(Be,0,!0),new F0(te,1,!1),new F0(B0,1,!0),new F0(oe,2,!1),new F0(f0,2,!0),new F0(re,3,!1),new F0(n0,3,!0)],Xa=[oe,f0,oe,f0,re,n0,re,n0],Wa=[f0,f0,f0,f0,n0,n0,n0,n0],ja=[te,B0,oe,f0,re,n0,re,n0],Za=[B0,B0,f0,f0,n0,n0,n0,n0],Ka=[Be,Be,B0,B0,f0,f0,n0,n0],Ja=[gt,Be,te,B0,te,B0,te,B0],E={DISPLAY:y0[gt],TEXT:y0[te],SCRIPT:y0[oe],SCRIPTSCRIPT:y0[re]},st=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Qa(r){for(var e=0;e<st.length;e++)for(var t=st[e],a=0;a<t.blocks.length;a++){var n=t.blocks[a];if(r>=n[0]&&r<=n[1])return t.name}return null}var Te=[];st.forEach(r=>r.blocks.forEach(e=>Te.push(...e)));function Br(r){for(var e=0;e<Te.length;e+=2)if(r>=Te[e]&&r<=Te[e+1])return!0;return!1}var ee=80,_a=function(e,t){return"M95,"+(622+e+t)+`
|
|
2
2
|
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
3
3
|
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
4
4
|
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{an as Ze,ao as Q,r as _,bU as vt,ap as mt,x as J,bq as bt,br as yt,F as oe,aj as Ne,l as Tt,bV as kt,j as Z,q as Ie,o as xe,p as Ot,ac as wt,ad as Rt,bW as de}from"./index.BRfGUOQ-.js";import{h as St}from"./moment.C7qA8nIE.js";import{w as Mt}from"./withCalculatedWidth.D4cpOyNe.js";import{u as $t}from"./useBasicWidgetState.A4U5lzAm.js";import{f as _t}from"./formatMoment.C6Hwn6X5.js";import{f as Et}from"./formatNumber.DaagZyZe.js";import"./FormClearHelper.C-6BC487.js";import"./numbro.B9_PXfzp.js";import"./sprintf.DpPCfzXw.js";var ue={},H={},ce={},le={},Ue;function De(){if(Ue)return le;Ue=1,Object.defineProperty(le,"__esModule",{value:!0}),le.Direction=void 0;var e;return(function(r){r.Right="to right",r.Left="to left",r.Down="to bottom",r.Up="to top"})(e||(le.Direction=e={})),le}var He;function Ge(){return He||(He=1,(function(e){var r=ce&&ce.__spreadArray||function(i,o,u){if(u||arguments.length===2)for(var g=0,m=o.length,p;g<m;g++)(p||!(g in o))&&(p||(p=Array.prototype.slice.call(o,0,g)),p[g]=o[g]);return i.concat(p||Array.prototype.slice.call(o))};Object.defineProperty(e,"__esModule",{value:!0}),e.isIOS=e.useThumbOverlap=e.assertUnreachable=e.voidFn=e.getTrackBackground=e.replaceAt=e.schd=e.translate=e.getClosestThumbIndex=e.translateThumbs=e.getPaddingAndBorder=e.getMargin=e.checkInitialOverlap=e.checkValuesAgainstBoundaries=e.checkBoundaries=e.isVertical=e.relativeValue=e.normalizeValue=e.isStepDivisible=e.isTouchEvent=e.getStepDecimals=void 0;var n=Ze(),s=De(),v=function(i){var o=i.toString().split(".")[1];return o?o.length:0};e.getStepDecimals=v;function S(i){return i.touches&&i.touches.length||i.changedTouches&&i.changedTouches.length}e.isTouchEvent=S;function l(i,o,u){var g=(o-i)/u,m=8,p=Number(g.toFixed(m));return parseInt(p.toString(),10)===p}e.isStepDivisible=l;function h(i,o,u,g,m,p,b){var $=1e11;if(i=Math.round(i*$)/$,!p){var D=b[o-1],E=b[o+1];if(D&&D>i)return D;if(E&&E<i)return E}if(i>g)return g;if(i<u)return u;var U=Math.floor(i*$-u*$)%Math.floor(m*$),z=Math.floor(i*$-Math.abs(U)),W=U===0?i:z/$,L=Math.abs(U/$)<m/2?W:W+m,A=(0,e.getStepDecimals)(m);return parseFloat(L.toFixed(A))}e.normalizeValue=h;function F(i,o,u){return(i-o)/(u-o)}e.relativeValue=F;function j(i){return i===s.Direction.Up||i===s.Direction.Down}e.isVertical=j;function V(i,o,u){if(o>=u)throw new RangeError("min (".concat(o,") is equal/bigger than max (").concat(u,")"));if(i<o)throw new RangeError("value (".concat(i,") is smaller than min (").concat(o,")"));if(i>u)throw new RangeError("value (".concat(i,") is bigger than max (").concat(u,")"))}e.checkBoundaries=V;function I(i,o,u){return i<o?o:i>u?u:i}e.checkValuesAgainstBoundaries=I;function T(i){if(!(i.length<2)&&!i.slice(1).every(function(o,u){return i[u]<=o}))throw new RangeError("values={[".concat(i,"]} needs to be sorted when allowOverlap={false}"))}e.checkInitialOverlap=T;function d(i){var o=window.getComputedStyle(i);return{top:parseInt(o["margin-top"],10),bottom:parseInt(o["margin-bottom"],10),left:parseInt(o["margin-left"],10),right:parseInt(o["margin-right"],10)}}e.getMargin=d;function t(i){var o=window.getComputedStyle(i);return{top:parseInt(o["padding-top"],10)+parseInt(o["border-top-width"],10),bottom:parseInt(o["padding-bottom"],10)+parseInt(o["border-bottom-width"],10),left:parseInt(o["padding-left"],10)+parseInt(o["border-left-width"],10),right:parseInt(o["padding-right"],10)+parseInt(o["border-right-width"],10)}}e.getPaddingAndBorder=t;function a(i,o,u){var g=u?-1:1;i.forEach(function(m,p){return f(m,g*o[p].x,o[p].y)})}e.translateThumbs=a;function c(i,o,u,g){for(var m=0,p=B(i[0],o,u,g),b=1;b<i.length;b++){var $=B(i[b],o,u,g);$<p&&(p=$,m=b)}return m}e.getClosestThumbIndex=c;function f(i,o,u){i.style.transform="translate(".concat(o,"px, ").concat(u,"px)")}e.translate=f;var y=function(i){var o=[],u=null,g=function(){for(var m=[],p=0;p<arguments.length;p++)m[p]=arguments[p];o=m,!u&&(u=requestAnimationFrame(function(){u=null,i.apply(void 0,o)}))};return g};e.schd=y;function k(i,o,u){var g=i.slice(0);return g[o]=u,g}e.replaceAt=k;function x(i){var o=i.values,u=i.colors,g=i.min,m=i.max,p=i.direction,b=p===void 0?s.Direction.Right:p,$=i.rtl,D=$===void 0?!1:$;D&&b===s.Direction.Right?b=s.Direction.Left:D&&s.Direction.Left&&(b=s.Direction.Right);var E=o.slice(0).sort(function(z,W){return z-W}).map(function(z){return(z-g)/(m-g)*100}),U=E.reduce(function(z,W,L){return"".concat(z,", ").concat(u[L]," ").concat(W,"%, ").concat(u[L+1]," ").concat(W,"%")},"");return"linear-gradient(".concat(b,", ").concat(u[0]," 0%").concat(U,", ").concat(u[u.length-1]," 100%)")}e.getTrackBackground=x;function O(){}e.voidFn=O;function w(i){throw new Error("Didn't expect to get here")}e.assertUnreachable=w;var M=function(i,o,u,g,m){m===void 0&&(m=function(b){return b});var p=Math.ceil(r([i],Array.from(i.children),!0).reduce(function(b,$){var D=Math.ceil($.getBoundingClientRect().width);if($.innerText&&$.innerText.includes(u)&&$.childElementCount===0){var E=$.cloneNode(!0);E.innerHTML=m(o.toFixed(g)),E.style.visibility="hidden",document.body.appendChild(E),D=Math.ceil(E.getBoundingClientRect().width),document.body.removeChild(E)}return D>b?D:b},i.getBoundingClientRect().width));return p},P=function(i,o,u,g,m,p,b){b===void 0&&(b=function(E){return E});var $=[],D=function(E){var U=M(u[E],g[E],m,p,b),z=o[E].x;o.forEach(function(W,L){var A=W.x,G=M(u[L],g[L],m,p,b);E!==L&&(z>=A&&z<=A+G||z+U>=A&&z+U<=A+G)&&($.includes(L)||($.push(E),$.push(L),$=r(r([],$,!0),[E,L],!1),D(L)))})};return D(i),Array.from(new Set($.sort()))},R=function(i,o,u,g,m,p){g===void 0&&(g=.1),m===void 0&&(m=" - "),p===void 0&&(p=function(L){return L});var b=(0,e.getStepDecimals)(g),$=(0,n.useState)({}),D=$[0],E=$[1],U=(0,n.useState)(p(o[u].toFixed(b))),z=U[0],W=U[1];return(0,n.useEffect)(function(){if(i){var L=i.getThumbs();if(L.length<1)return;var A={},G=i.getOffsets(),ne=P(u,G,L,o,m,b,p),he=p(o[u].toFixed(b));if(ne.length){var ee=ne.reduce(function(te,se,me,be){return te.length?r(r([],te,!0),[G[be[me]].x],!1):[G[be[me]].x]},[]);if(Math.min.apply(Math,ee)===G[u].x){var ge=[];ne.forEach(function(te){ge.push(o[te].toFixed(b))}),he=Array.from(new Set(ge.sort(function(te,se){return parseFloat(te)-parseFloat(se)}))).map(p).join(m);var pe=Math.min.apply(Math,ee),ve=Math.max.apply(Math,ee),Ee=L[ne[ee.indexOf(ve)]].getBoundingClientRect().width;A.left="".concat(Math.abs(pe-(ve+Ee))/2,"px"),A.transform="translate(-50%, 0)"}else A.visibility="hidden"}W(he),E(A)}},[i,o]),[z,D]};e.useThumbOverlap=R;function B(i,o,u,g){var m=i.getBoundingClientRect(),p=m.left,b=m.top,$=m.width,D=m.height;return j(g)?Math.abs(u-(b+D/2)):Math.abs(o-(p+$/2))}var C=function(){var i,o=((i=navigator.userAgentData)===null||i===void 0?void 0:i.platform)||navigator.platform;return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(o)||navigator.userAgent.includes("Mac")&&"ontouchend"in document};e.isIOS=C})(ce)),ce}var We;function It(){if(We)return H;We=1;var e=H&&H.__extends||(function(){var I=function(T,d){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(t[c]=a[c])},I(T,d)};return function(T,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");I(T,d);function t(){this.constructor=T}T.prototype=d===null?Object.create(d):(t.prototype=d.prototype,new t)}})(),r=H&&H.__createBinding||(Object.create?(function(I,T,d,t){t===void 0&&(t=d);var a=Object.getOwnPropertyDescriptor(T,d);(!a||("get"in a?!T.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return T[d]}}),Object.defineProperty(I,t,a)}):(function(I,T,d,t){t===void 0&&(t=d),I[t]=T[d]})),n=H&&H.__setModuleDefault||(Object.create?(function(I,T){Object.defineProperty(I,"default",{enumerable:!0,value:T})}):function(I,T){I.default=T}),s=H&&H.__importStar||function(I){if(I&&I.__esModule)return I;var T={};if(I!=null)for(var d in I)d!=="default"&&Object.prototype.hasOwnProperty.call(I,d)&&r(T,I,d);return n(T,I),T},v=H&&H.__spreadArray||function(I,T,d){if(d||arguments.length===2)for(var t=0,a=T.length,c;t<a;t++)(c||!(t in T))&&(c||(c=Array.prototype.slice.call(T,0,t)),c[t]=T[t]);return I.concat(c||Array.prototype.slice.call(T))};Object.defineProperty(H,"__esModule",{value:!0});var S=s(Ze()),l=Ge(),h=De(),F=["ArrowRight","ArrowUp","k","PageUp"],j=["ArrowLeft","ArrowDown","j","PageDown"],V=(function(I){e(T,I);function T(d){var t=I.call(this,d)||this;if(t.trackRef=S.createRef(),t.thumbRefs=[],t.state={draggedTrackPos:[-1,-1],draggedThumbIndex:-1,thumbZIndexes:new Array(t.props.values.length).fill(0).map(function(a,c){return c}),isChanged:!1,markOffsets:[]},t.getOffsets=function(){var a=t.props,c=a.direction,f=a.values,y=a.min,k=a.max,x=t.trackRef.current;if(!x)return console.warn("No track element found."),[];var O=x.getBoundingClientRect(),w=(0,l.getPaddingAndBorder)(x);return t.getThumbs().map(function(M,P){var R={x:0,y:0},B=M.getBoundingClientRect(),C=(0,l.getMargin)(M);switch(c){case h.Direction.Right:return R.x=(C.left+w.left)*-1,R.y=((B.height-O.height)/2+w.top)*-1,R.x+=O.width*(0,l.relativeValue)(f[P],y,k)-B.width/2,R;case h.Direction.Left:return R.x=(C.right+w.right)*-1,R.y=((B.height-O.height)/2+w.top)*-1,R.x+=O.width-O.width*(0,l.relativeValue)(f[P],y,k)-B.width/2,R;case h.Direction.Up:return R.x=((B.width-O.width)/2+C.left+w.left)*-1,R.y=-w.left,R.y+=O.height-O.height*(0,l.relativeValue)(f[P],y,k)-B.height/2,R;case h.Direction.Down:return R.x=((B.width-O.width)/2+C.left+w.left)*-1,R.y=-w.left,R.y+=O.height*(0,l.relativeValue)(f[P],y,k)-B.height/2,R;default:return(0,l.assertUnreachable)(c)}})},t.getThumbs=function(){return t.trackRef&&t.trackRef.current?Array.from(t.trackRef.current.children).filter(function(a){return a.hasAttribute("aria-valuenow")}):(console.warn("No thumbs found in the track container. Did you forget to pass & spread the `props` param in renderTrack?"),[])},t.getTargetIndex=function(a){return t.getThumbs().findIndex(function(c){return c===a.target||c.contains(a.target)})},t.addTouchEvents=function(a){document.addEventListener("touchmove",t.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",t.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",t.schdOnEnd,{passive:!1})},t.addMouseEvents=function(a){document.addEventListener("mousemove",t.schdOnMouseMove),document.addEventListener("mouseup",t.schdOnEnd)},t.onMouseDownTrack=function(a){var c;if(!(a.button!==0||(0,l.isIOS)()))if(a.persist(),a.preventDefault(),t.addMouseEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(y){var k;return(k=y.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return t.onMove(a.clientX,a.clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(y){return y.current}),a.clientX,a.clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.clientX,a.clientY)})}},t.onResize=function(){(0,l.translateThumbs)(t.getThumbs(),t.getOffsets(),t.props.rtl),t.calculateMarkOffsets()},t.onTouchStartTrack=function(a){var c;if(a.persist(),t.addTouchEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(y){var k;return(k=y.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(y){return y.current}),a.touches[0].clientX,a.touches[0].clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},t.onMouseOrTouchStart=function(a){if(!t.props.disabled){var c=(0,l.isTouchEvent)(a);if(!(!c&&a.button!==0)){var f=t.getTargetIndex(a);f!==-1&&(c?t.addTouchEvents(a):t.addMouseEvents(a),t.setState({draggedThumbIndex:f,thumbZIndexes:t.state.thumbZIndexes.map(function(y,k){return k===f?Math.max.apply(Math,t.state.thumbZIndexes):y<=t.state.thumbZIndexes[f]?y:y-1})}))}}},t.onMouseMove=function(a){a.preventDefault(),t.onMove(a.clientX,a.clientY)},t.onTouchMove=function(a){a.preventDefault(),t.onMove(a.touches[0].clientX,a.touches[0].clientY)},t.onKeyDown=function(a){var c=t.props,f=c.values,y=c.onChange,k=c.step,x=c.rtl,O=c.direction,w=t.state.isChanged,M=t.getTargetIndex(a.nativeEvent),P=x||O===h.Direction.Left||O===h.Direction.Down?-1:1;M!==-1&&(F.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),y((0,l.replaceAt)(f,M,t.normalizeValue(f[M]+P*(a.key==="PageUp"?k*10:k),M)))):j.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),y((0,l.replaceAt)(f,M,t.normalizeValue(f[M]-P*(a.key==="PageDown"?k*10:k),M)))):a.key==="Tab"?t.setState({draggedThumbIndex:-1},function(){w&&t.fireOnFinalChange()}):w&&t.fireOnFinalChange())},t.onKeyUp=function(a){var c=t.state.isChanged;t.setState({draggedThumbIndex:-1},function(){c&&t.fireOnFinalChange()})},t.onMove=function(a,c){var f=t.state,y=f.draggedThumbIndex,k=f.draggedTrackPos,x=t.props,O=x.direction,w=x.min,M=x.max,P=x.onChange,R=x.values,B=x.step,C=x.rtl;if(y===-1&&k[0]===-1&&k[1]===-1)return null;var i=t.trackRef.current;if(!i)return null;var o=i.getBoundingClientRect(),u=(0,l.isVertical)(O)?o.height:o.width;if(k[0]!==-1&&k[1]!==-1){var g=a-k[0],m=c-k[1],p=0;switch(O){case h.Direction.Right:case h.Direction.Left:p=g/u*(M-w);break;case h.Direction.Down:case h.Direction.Up:p=m/u*(M-w);break;default:(0,l.assertUnreachable)(O)}if(C&&(p*=-1),Math.abs(p)>=B/2){for(var b=0;b<t.thumbRefs.length;b++){if(R[b]===M&&Math.sign(p)===1||R[b]===w&&Math.sign(p)===-1)return;var $=R[b]+p;$>M?p=M-R[b]:$<w&&(p=w-R[b])}for(var D=R.slice(0),b=0;b<t.thumbRefs.length;b++)D=(0,l.replaceAt)(D,b,t.normalizeValue(R[b]+p,b));t.setState({draggedTrackPos:[a,c]}),P(D)}}else{var E=0;switch(O){case h.Direction.Right:E=(a-o.left)/u*(M-w)+w;break;case h.Direction.Left:E=(u-(a-o.left))/u*(M-w)+w;break;case h.Direction.Down:E=(c-o.top)/u*(M-w)+w;break;case h.Direction.Up:E=(u-(c-o.top))/u*(M-w)+w;break;default:(0,l.assertUnreachable)(O)}C&&(E=M+w-E),Math.abs(R[y]-E)>=B/2&&P((0,l.replaceAt)(R,y,t.normalizeValue(E,y)))}},t.normalizeValue=function(a,c){var f=t.props,y=f.min,k=f.max,x=f.step,O=f.allowOverlap,w=f.values;return(0,l.normalizeValue)(a,c,y,k,x,O,w)},t.onEnd=function(a){if(a.preventDefault(),document.removeEventListener("mousemove",t.schdOnMouseMove),document.removeEventListener("touchmove",t.schdOnTouchMove),document.removeEventListener("mouseup",t.schdOnEnd),document.removeEventListener("touchend",t.schdOnEnd),document.removeEventListener("touchcancel",t.schdOnEnd),t.state.draggedThumbIndex===-1&&t.state.draggedTrackPos[0]===-1&&t.state.draggedTrackPos[1]===-1)return null;t.setState({draggedThumbIndex:-1,draggedTrackPos:[-1,-1]},function(){t.fireOnFinalChange()})},t.fireOnFinalChange=function(){t.setState({isChanged:!1});var a=t.props,c=a.onFinalChange,f=a.values;c&&c(f)},t.updateMarkRefs=function(a){if(!a.renderMark){t.numOfMarks=void 0,t.markRefs=void 0;return}t.numOfMarks=(a.max-a.min)/t.props.step,t.markRefs=[];for(var c=0;c<t.numOfMarks+1;c++)t.markRefs[c]=S.createRef()},t.calculateMarkOffsets=function(){if(!(!t.props.renderMark||!t.trackRef||!t.numOfMarks||!t.markRefs||t.trackRef.current===null)){for(var a=window.getComputedStyle(t.trackRef.current),c=parseInt(a.width,10),f=parseInt(a.height,10),y=parseInt(a.paddingLeft,10),k=parseInt(a.paddingTop,10),x=[],O=0;O<t.numOfMarks+1;O++){var w=9999,M=9999;if(t.markRefs[O].current){var P=t.markRefs[O].current.getBoundingClientRect();w=P.height,M=P.width}t.props.direction===h.Direction.Left||t.props.direction===h.Direction.Right?x.push([Math.round(c/t.numOfMarks*O+y-M/2),-Math.round((w-f)/2)]):x.push([Math.round(f/t.numOfMarks*O+k-w/2),-Math.round((M-c)/2)])}t.setState({markOffsets:x})}},d.step===0)throw new Error('"step" property should be a positive number');return t.schdOnMouseMove=(0,l.schd)(t.onMouseMove),t.schdOnTouchMove=(0,l.schd)(t.onTouchMove),t.schdOnEnd=(0,l.schd)(t.onEnd),t.thumbRefs=d.values.map(function(){return S.createRef()}),t.updateMarkRefs(d),t}return T.prototype.componentDidMount=function(){var d=this,t=this.props,a=t.values,c=t.min,f=t.step;this.resizeObserver=window.ResizeObserver?new window.ResizeObserver(this.onResize):{observe:function(){return window.addEventListener("resize",d.onResize)},unobserve:function(){return window.removeEventListener("resize",d.onResize)}},document.addEventListener("touchstart",this.onMouseOrTouchStart,{passive:!1}),document.addEventListener("mousedown",this.onMouseOrTouchStart,{passive:!1}),!this.props.allowOverlap&&(0,l.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(y){return(0,l.checkBoundaries)(y,d.props.min,d.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(y){(0,l.isStepDivisible)(c,y,f)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")})},T.prototype.componentDidUpdate=function(d,t){var a=this.props,c=a.max,f=a.min,y=a.step,k=a.values,x=a.rtl;(d.max!==c||d.min!==f||d.step!==y)&&this.updateMarkRefs(this.props),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),x),(d.max!==c||d.min!==f||d.step!==y||t.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),k.forEach(function(O){(0,l.isStepDivisible)(f,O,y)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")}))},T.prototype.componentWillUnmount=function(){var d={passive:!1};document.removeEventListener("mousedown",this.onMouseOrTouchStart,d),document.removeEventListener("mousemove",this.schdOnMouseMove),document.removeEventListener("touchmove",this.schdOnTouchMove),document.removeEventListener("touchstart",this.onMouseOrTouchStart),document.removeEventListener("mouseup",this.schdOnEnd),document.removeEventListener("touchend",this.schdOnEnd),this.resizeObserver.unobserve(this.trackRef.current)},T.prototype.render=function(){var d=this,t=this.props,a=t.label,c=t.labelledBy,f=t.renderTrack,y=t.renderThumb,k=t.renderMark,x=k===void 0?function(){return null}:k,O=t.values,w=t.min,M=t.max,P=t.allowOverlap,R=t.disabled,B=this.state,C=B.draggedThumbIndex,i=B.thumbZIndexes,o=B.markOffsets;return f({props:{style:{transform:"scale(1)",cursor:C>-1?"grabbing":this.props.draggableTrack?(0,l.isVertical)(this.props.direction)?"ns-resize":"ew-resize":O.length===1&&!R?"pointer":"inherit"},onMouseDown:R?l.voidFn:this.onMouseDownTrack,onTouchStart:R?l.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:R,children:v(v([],o.map(function(u,g,m){return x({props:{style:d.props.direction===h.Direction.Left||d.props.direction===h.Direction.Right?{position:"absolute",left:"".concat(u[0],"px"),marginTop:"".concat(u[1],"px")}:{position:"absolute",top:"".concat(u[0],"px"),marginLeft:"".concat(u[1],"px")},key:"mark".concat(g),ref:d.markRefs[g]},index:g})}),!0),O.map(function(u,g){var m=d.state.draggedThumbIndex===g;return y({index:g,value:u,isDragged:m,props:{style:{position:"absolute",zIndex:i[g],cursor:R?"inherit":m?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:g,tabIndex:R?void 0:0,"aria-valuemax":P?M:O[g+1]||M,"aria-valuemin":P?w:O[g-1]||w,"aria-valuenow":u,draggable:!1,ref:d.thumbRefs[g],"aria-label":a,"aria-labelledby":c,role:"slider",onKeyDown:R?l.voidFn:d.onKeyDown,onKeyUp:R?l.voidFn:d.onKeyUp}})}),!0)})},T.defaultProps={label:"Accessibility label",labelledBy:null,step:1,direction:h.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},T})(S.Component);return H.default=V,H}var qe;function xt(){return qe||(qe=1,(function(e){var r=ue&&ue.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.checkValuesAgainstBoundaries=e.relativeValue=e.useThumbOverlap=e.Direction=e.getTrackBackground=e.Range=void 0;var n=r(It());e.Range=n.default;var s=Ge();Object.defineProperty(e,"getTrackBackground",{enumerable:!0,get:function(){return s.getTrackBackground}}),Object.defineProperty(e,"useThumbOverlap",{enumerable:!0,get:function(){return s.useThumbOverlap}}),Object.defineProperty(e,"relativeValue",{enumerable:!0,get:function(){return s.relativeValue}}),Object.defineProperty(e,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return s.checkValuesAgainstBoundaries}});var v=De();Object.defineProperty(e,"Direction",{enumerable:!0,get:function(){return v.Direction}})})(ue)),ue}var Je=xt();function Ke(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),n.push.apply(n,s)}return n}function Te(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Ke(Object(n),!0).forEach(function(s){Dt(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Dt(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var ke=Q("div",{position:"relative",width:"100%"});ke.displayName="Root";ke.displayName="Root";ke.displayName="StyledRoot";var Oe=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$disabled,S=e.$isDragged,l=r.sizing,h="inherit";return v?h="not-allowed":S?h="grabbing":s.length===1&&(h="pointer"),{paddingTop:l.scale600,paddingBottom:l.scale600,paddingRight:l.scale600,paddingLeft:l.scale600,display:"flex",cursor:h,backgroundColor:r.colors.sliderTrackFill}});Oe.displayName="Track";Oe.displayName="Track";Oe.displayName="StyledTrack";var fe=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$min,S=e.$max,l=e.$disabled,h=r.colors,F=r.borders,j=r.direction,V=r.borders.useRoundedCorners?F.radius100:0;return{borderTopLeftRadius:V,borderTopRightRadius:V,borderBottomRightRadius:V,borderBottomLeftRadius:V,background:Je.getTrackBackground({values:s,colors:s.length===1?[l?h.borderOpaque:h.primary,l?h.backgroundSecondary:h.borderOpaque]:[l?h.backgroundSecondary:h.borderOpaque,l?h.borderOpaque:h.primary,l?h.backgroundSecondary:h.borderOpaque],min:v||0,max:S||0,rtl:j==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:l?"not-allowed":"inherit"}});fe.displayName="InnerTrack";fe.displayName="InnerTrack";fe.displayName="StyledInnerTrack";var we=Q("div",function(e){return{width:"4px",height:"2px",backgroundColor:e.$theme.colors.backgroundPrimary,marginLeft:"16px"}});we.displayName="Mark";we.displayName="Mark";we.displayName="StyledMark";var Re=Q("div",function(e){return Te(Te({},e.$theme.typography.font200),{},{color:e.$theme.colors.contentPrimary})});Re.displayName="Tick";Re.displayName="Tick";Re.displayName="StyledTick";var Se=Q("div",function(e){var r=e.$theme,n=r.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:n.scale600,paddingLeft:n.scale600,paddingBottom:n.scale400}});Se.displayName="TickBar";Se.displayName="TickBar";Se.displayName="StyledTickBar";var Me=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$thumbIndex,S=e.$disabled,l=s.length===2&&v===0,h=s.length===2&&v===1;return r.direction==="rtl"&&(h||l)&&(l=!l,h=!h),{height:"24px",width:"24px",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:S?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleFill,outline:"none",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(r.colors.accent):"0 1px 4px rgba(0, 0, 0, 0.12)",cursor:S?"not-allowed":"inherit"}});Me.displayName="Thumb";Me.displayName="Thumb";Me.displayName="StyledThumb";var $e=Q("div",function(e){var r=e.$disabled,n=e.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill}});$e.displayName="InnerThumb";$e.displayName="InnerThumb";$e.displayName="StyledInnerThumb";var _e=Q("div",function(e){var r=e.$disabled,n=e.$theme;return Te(Te({position:"absolute",top:"-".concat(n.sizing.scale1400)},n.typography.font200),{},{backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill,color:n.colors.contentInversePrimary,paddingLeft:n.sizing.scale600,paddingRight:n.sizing.scale600,paddingTop:n.sizing.scale500,paddingBottom:n.sizing.scale500,borderBottomLeftRadius:"48px",borderBottomRightRadius:"48px",borderTopLeftRadius:"48px",borderTopRightRadius:"48px",whiteSpace:"nowrap"})});_e.displayName="ThumbValue";_e.displayName="ThumbValue";_e.displayName="StyledThumbValue";function Xe(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),n.push.apply(n,s)}return n}function Ct(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Xe(Object(n),!0).forEach(function(s){Pt(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Pt(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function X(){return X=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},X.apply(this,arguments)}function K(e,r){return Ft(e)||At(e,r)||Lt(e,r)||Bt()}function Bt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{an as Ze,ao as Q,r as _,bU as vt,ap as mt,x as J,bq as bt,br as yt,F as oe,aj as Ne,l as Tt,bV as kt,j as Z,q as Ie,o as xe,p as Ot,ac as wt,ad as Rt,bW as de}from"./index.CXVpBAvU.js";import{h as St}from"./moment.C7qA8nIE.js";import{w as Mt}from"./withCalculatedWidth.B3oSlRC0.js";import{u as $t}from"./useBasicWidgetState.D-fc_aIL.js";import{f as _t}from"./formatMoment.C6Hwn6X5.js";import{f as Et}from"./formatNumber.CT_v8e75.js";import"./FormClearHelper.D4lty7rT.js";import"./numbro.B9_PXfzp.js";import"./sprintf.DpPCfzXw.js";var ue={},H={},ce={},le={},Ue;function De(){if(Ue)return le;Ue=1,Object.defineProperty(le,"__esModule",{value:!0}),le.Direction=void 0;var e;return(function(r){r.Right="to right",r.Left="to left",r.Down="to bottom",r.Up="to top"})(e||(le.Direction=e={})),le}var He;function Ge(){return He||(He=1,(function(e){var r=ce&&ce.__spreadArray||function(i,o,u){if(u||arguments.length===2)for(var g=0,m=o.length,p;g<m;g++)(p||!(g in o))&&(p||(p=Array.prototype.slice.call(o,0,g)),p[g]=o[g]);return i.concat(p||Array.prototype.slice.call(o))};Object.defineProperty(e,"__esModule",{value:!0}),e.isIOS=e.useThumbOverlap=e.assertUnreachable=e.voidFn=e.getTrackBackground=e.replaceAt=e.schd=e.translate=e.getClosestThumbIndex=e.translateThumbs=e.getPaddingAndBorder=e.getMargin=e.checkInitialOverlap=e.checkValuesAgainstBoundaries=e.checkBoundaries=e.isVertical=e.relativeValue=e.normalizeValue=e.isStepDivisible=e.isTouchEvent=e.getStepDecimals=void 0;var n=Ze(),s=De(),v=function(i){var o=i.toString().split(".")[1];return o?o.length:0};e.getStepDecimals=v;function S(i){return i.touches&&i.touches.length||i.changedTouches&&i.changedTouches.length}e.isTouchEvent=S;function l(i,o,u){var g=(o-i)/u,m=8,p=Number(g.toFixed(m));return parseInt(p.toString(),10)===p}e.isStepDivisible=l;function h(i,o,u,g,m,p,b){var $=1e11;if(i=Math.round(i*$)/$,!p){var D=b[o-1],E=b[o+1];if(D&&D>i)return D;if(E&&E<i)return E}if(i>g)return g;if(i<u)return u;var U=Math.floor(i*$-u*$)%Math.floor(m*$),z=Math.floor(i*$-Math.abs(U)),W=U===0?i:z/$,L=Math.abs(U/$)<m/2?W:W+m,A=(0,e.getStepDecimals)(m);return parseFloat(L.toFixed(A))}e.normalizeValue=h;function F(i,o,u){return(i-o)/(u-o)}e.relativeValue=F;function j(i){return i===s.Direction.Up||i===s.Direction.Down}e.isVertical=j;function V(i,o,u){if(o>=u)throw new RangeError("min (".concat(o,") is equal/bigger than max (").concat(u,")"));if(i<o)throw new RangeError("value (".concat(i,") is smaller than min (").concat(o,")"));if(i>u)throw new RangeError("value (".concat(i,") is bigger than max (").concat(u,")"))}e.checkBoundaries=V;function I(i,o,u){return i<o?o:i>u?u:i}e.checkValuesAgainstBoundaries=I;function T(i){if(!(i.length<2)&&!i.slice(1).every(function(o,u){return i[u]<=o}))throw new RangeError("values={[".concat(i,"]} needs to be sorted when allowOverlap={false}"))}e.checkInitialOverlap=T;function d(i){var o=window.getComputedStyle(i);return{top:parseInt(o["margin-top"],10),bottom:parseInt(o["margin-bottom"],10),left:parseInt(o["margin-left"],10),right:parseInt(o["margin-right"],10)}}e.getMargin=d;function t(i){var o=window.getComputedStyle(i);return{top:parseInt(o["padding-top"],10)+parseInt(o["border-top-width"],10),bottom:parseInt(o["padding-bottom"],10)+parseInt(o["border-bottom-width"],10),left:parseInt(o["padding-left"],10)+parseInt(o["border-left-width"],10),right:parseInt(o["padding-right"],10)+parseInt(o["border-right-width"],10)}}e.getPaddingAndBorder=t;function a(i,o,u){var g=u?-1:1;i.forEach(function(m,p){return f(m,g*o[p].x,o[p].y)})}e.translateThumbs=a;function c(i,o,u,g){for(var m=0,p=B(i[0],o,u,g),b=1;b<i.length;b++){var $=B(i[b],o,u,g);$<p&&(p=$,m=b)}return m}e.getClosestThumbIndex=c;function f(i,o,u){i.style.transform="translate(".concat(o,"px, ").concat(u,"px)")}e.translate=f;var y=function(i){var o=[],u=null,g=function(){for(var m=[],p=0;p<arguments.length;p++)m[p]=arguments[p];o=m,!u&&(u=requestAnimationFrame(function(){u=null,i.apply(void 0,o)}))};return g};e.schd=y;function k(i,o,u){var g=i.slice(0);return g[o]=u,g}e.replaceAt=k;function x(i){var o=i.values,u=i.colors,g=i.min,m=i.max,p=i.direction,b=p===void 0?s.Direction.Right:p,$=i.rtl,D=$===void 0?!1:$;D&&b===s.Direction.Right?b=s.Direction.Left:D&&s.Direction.Left&&(b=s.Direction.Right);var E=o.slice(0).sort(function(z,W){return z-W}).map(function(z){return(z-g)/(m-g)*100}),U=E.reduce(function(z,W,L){return"".concat(z,", ").concat(u[L]," ").concat(W,"%, ").concat(u[L+1]," ").concat(W,"%")},"");return"linear-gradient(".concat(b,", ").concat(u[0]," 0%").concat(U,", ").concat(u[u.length-1]," 100%)")}e.getTrackBackground=x;function O(){}e.voidFn=O;function w(i){throw new Error("Didn't expect to get here")}e.assertUnreachable=w;var M=function(i,o,u,g,m){m===void 0&&(m=function(b){return b});var p=Math.ceil(r([i],Array.from(i.children),!0).reduce(function(b,$){var D=Math.ceil($.getBoundingClientRect().width);if($.innerText&&$.innerText.includes(u)&&$.childElementCount===0){var E=$.cloneNode(!0);E.innerHTML=m(o.toFixed(g)),E.style.visibility="hidden",document.body.appendChild(E),D=Math.ceil(E.getBoundingClientRect().width),document.body.removeChild(E)}return D>b?D:b},i.getBoundingClientRect().width));return p},P=function(i,o,u,g,m,p,b){b===void 0&&(b=function(E){return E});var $=[],D=function(E){var U=M(u[E],g[E],m,p,b),z=o[E].x;o.forEach(function(W,L){var A=W.x,G=M(u[L],g[L],m,p,b);E!==L&&(z>=A&&z<=A+G||z+U>=A&&z+U<=A+G)&&($.includes(L)||($.push(E),$.push(L),$=r(r([],$,!0),[E,L],!1),D(L)))})};return D(i),Array.from(new Set($.sort()))},R=function(i,o,u,g,m,p){g===void 0&&(g=.1),m===void 0&&(m=" - "),p===void 0&&(p=function(L){return L});var b=(0,e.getStepDecimals)(g),$=(0,n.useState)({}),D=$[0],E=$[1],U=(0,n.useState)(p(o[u].toFixed(b))),z=U[0],W=U[1];return(0,n.useEffect)(function(){if(i){var L=i.getThumbs();if(L.length<1)return;var A={},G=i.getOffsets(),ne=P(u,G,L,o,m,b,p),he=p(o[u].toFixed(b));if(ne.length){var ee=ne.reduce(function(te,se,me,be){return te.length?r(r([],te,!0),[G[be[me]].x],!1):[G[be[me]].x]},[]);if(Math.min.apply(Math,ee)===G[u].x){var ge=[];ne.forEach(function(te){ge.push(o[te].toFixed(b))}),he=Array.from(new Set(ge.sort(function(te,se){return parseFloat(te)-parseFloat(se)}))).map(p).join(m);var pe=Math.min.apply(Math,ee),ve=Math.max.apply(Math,ee),Ee=L[ne[ee.indexOf(ve)]].getBoundingClientRect().width;A.left="".concat(Math.abs(pe-(ve+Ee))/2,"px"),A.transform="translate(-50%, 0)"}else A.visibility="hidden"}W(he),E(A)}},[i,o]),[z,D]};e.useThumbOverlap=R;function B(i,o,u,g){var m=i.getBoundingClientRect(),p=m.left,b=m.top,$=m.width,D=m.height;return j(g)?Math.abs(u-(b+D/2)):Math.abs(o-(p+$/2))}var C=function(){var i,o=((i=navigator.userAgentData)===null||i===void 0?void 0:i.platform)||navigator.platform;return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(o)||navigator.userAgent.includes("Mac")&&"ontouchend"in document};e.isIOS=C})(ce)),ce}var We;function It(){if(We)return H;We=1;var e=H&&H.__extends||(function(){var I=function(T,d){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(t[c]=a[c])},I(T,d)};return function(T,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");I(T,d);function t(){this.constructor=T}T.prototype=d===null?Object.create(d):(t.prototype=d.prototype,new t)}})(),r=H&&H.__createBinding||(Object.create?(function(I,T,d,t){t===void 0&&(t=d);var a=Object.getOwnPropertyDescriptor(T,d);(!a||("get"in a?!T.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return T[d]}}),Object.defineProperty(I,t,a)}):(function(I,T,d,t){t===void 0&&(t=d),I[t]=T[d]})),n=H&&H.__setModuleDefault||(Object.create?(function(I,T){Object.defineProperty(I,"default",{enumerable:!0,value:T})}):function(I,T){I.default=T}),s=H&&H.__importStar||function(I){if(I&&I.__esModule)return I;var T={};if(I!=null)for(var d in I)d!=="default"&&Object.prototype.hasOwnProperty.call(I,d)&&r(T,I,d);return n(T,I),T},v=H&&H.__spreadArray||function(I,T,d){if(d||arguments.length===2)for(var t=0,a=T.length,c;t<a;t++)(c||!(t in T))&&(c||(c=Array.prototype.slice.call(T,0,t)),c[t]=T[t]);return I.concat(c||Array.prototype.slice.call(T))};Object.defineProperty(H,"__esModule",{value:!0});var S=s(Ze()),l=Ge(),h=De(),F=["ArrowRight","ArrowUp","k","PageUp"],j=["ArrowLeft","ArrowDown","j","PageDown"],V=(function(I){e(T,I);function T(d){var t=I.call(this,d)||this;if(t.trackRef=S.createRef(),t.thumbRefs=[],t.state={draggedTrackPos:[-1,-1],draggedThumbIndex:-1,thumbZIndexes:new Array(t.props.values.length).fill(0).map(function(a,c){return c}),isChanged:!1,markOffsets:[]},t.getOffsets=function(){var a=t.props,c=a.direction,f=a.values,y=a.min,k=a.max,x=t.trackRef.current;if(!x)return console.warn("No track element found."),[];var O=x.getBoundingClientRect(),w=(0,l.getPaddingAndBorder)(x);return t.getThumbs().map(function(M,P){var R={x:0,y:0},B=M.getBoundingClientRect(),C=(0,l.getMargin)(M);switch(c){case h.Direction.Right:return R.x=(C.left+w.left)*-1,R.y=((B.height-O.height)/2+w.top)*-1,R.x+=O.width*(0,l.relativeValue)(f[P],y,k)-B.width/2,R;case h.Direction.Left:return R.x=(C.right+w.right)*-1,R.y=((B.height-O.height)/2+w.top)*-1,R.x+=O.width-O.width*(0,l.relativeValue)(f[P],y,k)-B.width/2,R;case h.Direction.Up:return R.x=((B.width-O.width)/2+C.left+w.left)*-1,R.y=-w.left,R.y+=O.height-O.height*(0,l.relativeValue)(f[P],y,k)-B.height/2,R;case h.Direction.Down:return R.x=((B.width-O.width)/2+C.left+w.left)*-1,R.y=-w.left,R.y+=O.height*(0,l.relativeValue)(f[P],y,k)-B.height/2,R;default:return(0,l.assertUnreachable)(c)}})},t.getThumbs=function(){return t.trackRef&&t.trackRef.current?Array.from(t.trackRef.current.children).filter(function(a){return a.hasAttribute("aria-valuenow")}):(console.warn("No thumbs found in the track container. Did you forget to pass & spread the `props` param in renderTrack?"),[])},t.getTargetIndex=function(a){return t.getThumbs().findIndex(function(c){return c===a.target||c.contains(a.target)})},t.addTouchEvents=function(a){document.addEventListener("touchmove",t.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",t.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",t.schdOnEnd,{passive:!1})},t.addMouseEvents=function(a){document.addEventListener("mousemove",t.schdOnMouseMove),document.addEventListener("mouseup",t.schdOnEnd)},t.onMouseDownTrack=function(a){var c;if(!(a.button!==0||(0,l.isIOS)()))if(a.persist(),a.preventDefault(),t.addMouseEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(y){var k;return(k=y.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return t.onMove(a.clientX,a.clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(y){return y.current}),a.clientX,a.clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.clientX,a.clientY)})}},t.onResize=function(){(0,l.translateThumbs)(t.getThumbs(),t.getOffsets(),t.props.rtl),t.calculateMarkOffsets()},t.onTouchStartTrack=function(a){var c;if(a.persist(),t.addTouchEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(y){var k;return(k=y.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(y){return y.current}),a.touches[0].clientX,a.touches[0].clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},t.onMouseOrTouchStart=function(a){if(!t.props.disabled){var c=(0,l.isTouchEvent)(a);if(!(!c&&a.button!==0)){var f=t.getTargetIndex(a);f!==-1&&(c?t.addTouchEvents(a):t.addMouseEvents(a),t.setState({draggedThumbIndex:f,thumbZIndexes:t.state.thumbZIndexes.map(function(y,k){return k===f?Math.max.apply(Math,t.state.thumbZIndexes):y<=t.state.thumbZIndexes[f]?y:y-1})}))}}},t.onMouseMove=function(a){a.preventDefault(),t.onMove(a.clientX,a.clientY)},t.onTouchMove=function(a){a.preventDefault(),t.onMove(a.touches[0].clientX,a.touches[0].clientY)},t.onKeyDown=function(a){var c=t.props,f=c.values,y=c.onChange,k=c.step,x=c.rtl,O=c.direction,w=t.state.isChanged,M=t.getTargetIndex(a.nativeEvent),P=x||O===h.Direction.Left||O===h.Direction.Down?-1:1;M!==-1&&(F.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),y((0,l.replaceAt)(f,M,t.normalizeValue(f[M]+P*(a.key==="PageUp"?k*10:k),M)))):j.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),y((0,l.replaceAt)(f,M,t.normalizeValue(f[M]-P*(a.key==="PageDown"?k*10:k),M)))):a.key==="Tab"?t.setState({draggedThumbIndex:-1},function(){w&&t.fireOnFinalChange()}):w&&t.fireOnFinalChange())},t.onKeyUp=function(a){var c=t.state.isChanged;t.setState({draggedThumbIndex:-1},function(){c&&t.fireOnFinalChange()})},t.onMove=function(a,c){var f=t.state,y=f.draggedThumbIndex,k=f.draggedTrackPos,x=t.props,O=x.direction,w=x.min,M=x.max,P=x.onChange,R=x.values,B=x.step,C=x.rtl;if(y===-1&&k[0]===-1&&k[1]===-1)return null;var i=t.trackRef.current;if(!i)return null;var o=i.getBoundingClientRect(),u=(0,l.isVertical)(O)?o.height:o.width;if(k[0]!==-1&&k[1]!==-1){var g=a-k[0],m=c-k[1],p=0;switch(O){case h.Direction.Right:case h.Direction.Left:p=g/u*(M-w);break;case h.Direction.Down:case h.Direction.Up:p=m/u*(M-w);break;default:(0,l.assertUnreachable)(O)}if(C&&(p*=-1),Math.abs(p)>=B/2){for(var b=0;b<t.thumbRefs.length;b++){if(R[b]===M&&Math.sign(p)===1||R[b]===w&&Math.sign(p)===-1)return;var $=R[b]+p;$>M?p=M-R[b]:$<w&&(p=w-R[b])}for(var D=R.slice(0),b=0;b<t.thumbRefs.length;b++)D=(0,l.replaceAt)(D,b,t.normalizeValue(R[b]+p,b));t.setState({draggedTrackPos:[a,c]}),P(D)}}else{var E=0;switch(O){case h.Direction.Right:E=(a-o.left)/u*(M-w)+w;break;case h.Direction.Left:E=(u-(a-o.left))/u*(M-w)+w;break;case h.Direction.Down:E=(c-o.top)/u*(M-w)+w;break;case h.Direction.Up:E=(u-(c-o.top))/u*(M-w)+w;break;default:(0,l.assertUnreachable)(O)}C&&(E=M+w-E),Math.abs(R[y]-E)>=B/2&&P((0,l.replaceAt)(R,y,t.normalizeValue(E,y)))}},t.normalizeValue=function(a,c){var f=t.props,y=f.min,k=f.max,x=f.step,O=f.allowOverlap,w=f.values;return(0,l.normalizeValue)(a,c,y,k,x,O,w)},t.onEnd=function(a){if(a.preventDefault(),document.removeEventListener("mousemove",t.schdOnMouseMove),document.removeEventListener("touchmove",t.schdOnTouchMove),document.removeEventListener("mouseup",t.schdOnEnd),document.removeEventListener("touchend",t.schdOnEnd),document.removeEventListener("touchcancel",t.schdOnEnd),t.state.draggedThumbIndex===-1&&t.state.draggedTrackPos[0]===-1&&t.state.draggedTrackPos[1]===-1)return null;t.setState({draggedThumbIndex:-1,draggedTrackPos:[-1,-1]},function(){t.fireOnFinalChange()})},t.fireOnFinalChange=function(){t.setState({isChanged:!1});var a=t.props,c=a.onFinalChange,f=a.values;c&&c(f)},t.updateMarkRefs=function(a){if(!a.renderMark){t.numOfMarks=void 0,t.markRefs=void 0;return}t.numOfMarks=(a.max-a.min)/t.props.step,t.markRefs=[];for(var c=0;c<t.numOfMarks+1;c++)t.markRefs[c]=S.createRef()},t.calculateMarkOffsets=function(){if(!(!t.props.renderMark||!t.trackRef||!t.numOfMarks||!t.markRefs||t.trackRef.current===null)){for(var a=window.getComputedStyle(t.trackRef.current),c=parseInt(a.width,10),f=parseInt(a.height,10),y=parseInt(a.paddingLeft,10),k=parseInt(a.paddingTop,10),x=[],O=0;O<t.numOfMarks+1;O++){var w=9999,M=9999;if(t.markRefs[O].current){var P=t.markRefs[O].current.getBoundingClientRect();w=P.height,M=P.width}t.props.direction===h.Direction.Left||t.props.direction===h.Direction.Right?x.push([Math.round(c/t.numOfMarks*O+y-M/2),-Math.round((w-f)/2)]):x.push([Math.round(f/t.numOfMarks*O+k-w/2),-Math.round((M-c)/2)])}t.setState({markOffsets:x})}},d.step===0)throw new Error('"step" property should be a positive number');return t.schdOnMouseMove=(0,l.schd)(t.onMouseMove),t.schdOnTouchMove=(0,l.schd)(t.onTouchMove),t.schdOnEnd=(0,l.schd)(t.onEnd),t.thumbRefs=d.values.map(function(){return S.createRef()}),t.updateMarkRefs(d),t}return T.prototype.componentDidMount=function(){var d=this,t=this.props,a=t.values,c=t.min,f=t.step;this.resizeObserver=window.ResizeObserver?new window.ResizeObserver(this.onResize):{observe:function(){return window.addEventListener("resize",d.onResize)},unobserve:function(){return window.removeEventListener("resize",d.onResize)}},document.addEventListener("touchstart",this.onMouseOrTouchStart,{passive:!1}),document.addEventListener("mousedown",this.onMouseOrTouchStart,{passive:!1}),!this.props.allowOverlap&&(0,l.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(y){return(0,l.checkBoundaries)(y,d.props.min,d.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(y){(0,l.isStepDivisible)(c,y,f)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")})},T.prototype.componentDidUpdate=function(d,t){var a=this.props,c=a.max,f=a.min,y=a.step,k=a.values,x=a.rtl;(d.max!==c||d.min!==f||d.step!==y)&&this.updateMarkRefs(this.props),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),x),(d.max!==c||d.min!==f||d.step!==y||t.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),k.forEach(function(O){(0,l.isStepDivisible)(f,O,y)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")}))},T.prototype.componentWillUnmount=function(){var d={passive:!1};document.removeEventListener("mousedown",this.onMouseOrTouchStart,d),document.removeEventListener("mousemove",this.schdOnMouseMove),document.removeEventListener("touchmove",this.schdOnTouchMove),document.removeEventListener("touchstart",this.onMouseOrTouchStart),document.removeEventListener("mouseup",this.schdOnEnd),document.removeEventListener("touchend",this.schdOnEnd),this.resizeObserver.unobserve(this.trackRef.current)},T.prototype.render=function(){var d=this,t=this.props,a=t.label,c=t.labelledBy,f=t.renderTrack,y=t.renderThumb,k=t.renderMark,x=k===void 0?function(){return null}:k,O=t.values,w=t.min,M=t.max,P=t.allowOverlap,R=t.disabled,B=this.state,C=B.draggedThumbIndex,i=B.thumbZIndexes,o=B.markOffsets;return f({props:{style:{transform:"scale(1)",cursor:C>-1?"grabbing":this.props.draggableTrack?(0,l.isVertical)(this.props.direction)?"ns-resize":"ew-resize":O.length===1&&!R?"pointer":"inherit"},onMouseDown:R?l.voidFn:this.onMouseDownTrack,onTouchStart:R?l.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:R,children:v(v([],o.map(function(u,g,m){return x({props:{style:d.props.direction===h.Direction.Left||d.props.direction===h.Direction.Right?{position:"absolute",left:"".concat(u[0],"px"),marginTop:"".concat(u[1],"px")}:{position:"absolute",top:"".concat(u[0],"px"),marginLeft:"".concat(u[1],"px")},key:"mark".concat(g),ref:d.markRefs[g]},index:g})}),!0),O.map(function(u,g){var m=d.state.draggedThumbIndex===g;return y({index:g,value:u,isDragged:m,props:{style:{position:"absolute",zIndex:i[g],cursor:R?"inherit":m?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:g,tabIndex:R?void 0:0,"aria-valuemax":P?M:O[g+1]||M,"aria-valuemin":P?w:O[g-1]||w,"aria-valuenow":u,draggable:!1,ref:d.thumbRefs[g],"aria-label":a,"aria-labelledby":c,role:"slider",onKeyDown:R?l.voidFn:d.onKeyDown,onKeyUp:R?l.voidFn:d.onKeyUp}})}),!0)})},T.defaultProps={label:"Accessibility label",labelledBy:null,step:1,direction:h.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},T})(S.Component);return H.default=V,H}var qe;function xt(){return qe||(qe=1,(function(e){var r=ue&&ue.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.checkValuesAgainstBoundaries=e.relativeValue=e.useThumbOverlap=e.Direction=e.getTrackBackground=e.Range=void 0;var n=r(It());e.Range=n.default;var s=Ge();Object.defineProperty(e,"getTrackBackground",{enumerable:!0,get:function(){return s.getTrackBackground}}),Object.defineProperty(e,"useThumbOverlap",{enumerable:!0,get:function(){return s.useThumbOverlap}}),Object.defineProperty(e,"relativeValue",{enumerable:!0,get:function(){return s.relativeValue}}),Object.defineProperty(e,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return s.checkValuesAgainstBoundaries}});var v=De();Object.defineProperty(e,"Direction",{enumerable:!0,get:function(){return v.Direction}})})(ue)),ue}var Je=xt();function Ke(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),n.push.apply(n,s)}return n}function Te(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Ke(Object(n),!0).forEach(function(s){Dt(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Dt(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var ke=Q("div",{position:"relative",width:"100%"});ke.displayName="Root";ke.displayName="Root";ke.displayName="StyledRoot";var Oe=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$disabled,S=e.$isDragged,l=r.sizing,h="inherit";return v?h="not-allowed":S?h="grabbing":s.length===1&&(h="pointer"),{paddingTop:l.scale600,paddingBottom:l.scale600,paddingRight:l.scale600,paddingLeft:l.scale600,display:"flex",cursor:h,backgroundColor:r.colors.sliderTrackFill}});Oe.displayName="Track";Oe.displayName="Track";Oe.displayName="StyledTrack";var fe=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$min,S=e.$max,l=e.$disabled,h=r.colors,F=r.borders,j=r.direction,V=r.borders.useRoundedCorners?F.radius100:0;return{borderTopLeftRadius:V,borderTopRightRadius:V,borderBottomRightRadius:V,borderBottomLeftRadius:V,background:Je.getTrackBackground({values:s,colors:s.length===1?[l?h.borderOpaque:h.primary,l?h.backgroundSecondary:h.borderOpaque]:[l?h.backgroundSecondary:h.borderOpaque,l?h.borderOpaque:h.primary,l?h.backgroundSecondary:h.borderOpaque],min:v||0,max:S||0,rtl:j==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:l?"not-allowed":"inherit"}});fe.displayName="InnerTrack";fe.displayName="InnerTrack";fe.displayName="StyledInnerTrack";var we=Q("div",function(e){return{width:"4px",height:"2px",backgroundColor:e.$theme.colors.backgroundPrimary,marginLeft:"16px"}});we.displayName="Mark";we.displayName="Mark";we.displayName="StyledMark";var Re=Q("div",function(e){return Te(Te({},e.$theme.typography.font200),{},{color:e.$theme.colors.contentPrimary})});Re.displayName="Tick";Re.displayName="Tick";Re.displayName="StyledTick";var Se=Q("div",function(e){var r=e.$theme,n=r.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:n.scale600,paddingLeft:n.scale600,paddingBottom:n.scale400}});Se.displayName="TickBar";Se.displayName="TickBar";Se.displayName="StyledTickBar";var Me=Q("div",function(e){var r=e.$theme,n=e.$value,s=n===void 0?[]:n,v=e.$thumbIndex,S=e.$disabled,l=s.length===2&&v===0,h=s.length===2&&v===1;return r.direction==="rtl"&&(h||l)&&(l=!l,h=!h),{height:"24px",width:"24px",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:S?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleFill,outline:"none",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(r.colors.accent):"0 1px 4px rgba(0, 0, 0, 0.12)",cursor:S?"not-allowed":"inherit"}});Me.displayName="Thumb";Me.displayName="Thumb";Me.displayName="StyledThumb";var $e=Q("div",function(e){var r=e.$disabled,n=e.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill}});$e.displayName="InnerThumb";$e.displayName="InnerThumb";$e.displayName="StyledInnerThumb";var _e=Q("div",function(e){var r=e.$disabled,n=e.$theme;return Te(Te({position:"absolute",top:"-".concat(n.sizing.scale1400)},n.typography.font200),{},{backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill,color:n.colors.contentInversePrimary,paddingLeft:n.sizing.scale600,paddingRight:n.sizing.scale600,paddingTop:n.sizing.scale500,paddingBottom:n.sizing.scale500,borderBottomLeftRadius:"48px",borderBottomRightRadius:"48px",borderTopLeftRadius:"48px",borderTopRightRadius:"48px",whiteSpace:"nowrap"})});_e.displayName="ThumbValue";_e.displayName="ThumbValue";_e.displayName="StyledThumbValue";function Xe(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),n.push.apply(n,s)}return n}function Ct(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Xe(Object(n),!0).forEach(function(s){Pt(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Pt(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function X(){return X=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},X.apply(this,arguments)}function K(e,r){return Ft(e)||At(e,r)||Lt(e,r)||Bt()}function Bt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lt(e,r){if(e){if(typeof e=="string")return Ye(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ye(e,r)}}function Ye(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,s=new Array(r);n<r;n++)s[n]=e[n];return s}function At(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s=[],v=!0,S=!1,l,h;try{for(n=n.call(e);!(v=(l=n.next()).done)&&(s.push(l.value),!(r&&s.length===r));v=!0);}catch(F){S=!0,h=F}finally{try{!v&&n.return!=null&&n.return()}finally{if(S)throw h}}return s}}function Ft(e){if(Array.isArray(e))return e}var jt=function(r){if(r.length>2||r.length===0)throw new Error("the value prop represents positions of thumbs, so its length can be only one or two");return r};function Vt(e){var r=e.overrides,n=r===void 0?{}:r,s=e.disabled,v=s===void 0?!1:s,S=e.marks,l=S===void 0?!1:S,h=e.onChange,F=h===void 0?function(){}:h,j=e.onFinalChange,V=j===void 0?function(){}:j,I=e.min,T=I===void 0?0:I,d=e.max,t=d===void 0?100:d,a=e.step,c=a===void 0?1:a,f=e.persistentThumb,y=f===void 0?!1:f,k=e.valueToLabel,x=k===void 0?function(Y){return Y}:k,O=e.value,w=_.useContext(vt),M=_.useState(!1),P=K(M,2),R=P[0],B=P[1],C=_.useState(!1),i=K(C,2),o=i[0],u=i[1],g=_.useState(!1),m=K(g,2),p=m[0],b=m[1],$=_.useState(-1),D=K($,2),E=D[0],U=D[1],z=_.useCallback(function(Y){mt(Y)&&b(!0);var N=Y.target.parentNode.firstChild===Y.target?0:1;U(N)},[]),W=_.useCallback(function(Y){p!==!1&&b(!1),U(-1)},[]),L=jt(O),A={$disabled:v,$step:c,$min:T,$max:t,$marks:l,$value:L,$isFocusVisible:p},G=J(n.Root,ke),ne=K(G,2),he=ne[0],ee=ne[1],ge=J(n.Track,Oe),pe=K(ge,2),ve=pe[0],Ee=pe[1],te=J(n.InnerTrack,fe),se=K(te,2),me=se[0],be=se[1],Qe=J(n.Thumb,Me),Ce=K(Qe,2),et=Ce[0],tt=Ce[1],rt=J(n.InnerThumb,$e),Pe=K(rt,2),nt=Pe[0],at=Pe[1],it=J(n.ThumbValue,_e),Be=K(it,2),ot=Be[0],st=Be[1],ut=J(n.Tick,Re),Le=K(ut,2),Ae=Le[0],Fe=Le[1],ct=J(n.TickBar,Se),je=K(ct,2),lt=je[0],dt=je[1],ft=J(n.Mark,we),Ve=K(ft,2),ht=Ve[0],gt=Ve[1];return _.createElement(he,X({"data-baseweb":"slider"},A,ee,{onFocus:yt(ee,z),onBlur:bt(ee,W)}),_.createElement(Je.Range,X({step:c,min:T,max:t,values:L,disabled:v,onChange:function(N){return F({value:N})},onFinalChange:function(N){return V({value:N})},rtl:w.direction==="rtl",renderTrack:function(N){var re=N.props,q=N.children,ae=N.isDragged;return _.createElement(ve,X({onMouseDown:re.onMouseDown,onTouchStart:re.onTouchStart,$isDragged:ae},A,Ee),_.createElement(me,X({$isDragged:ae,ref:re.ref},A,be),q))},renderThumb:function(N){var re=N.props,q=N.index,ae=N.isDragged,ze=y||(!!q&&o||!q&&R||ae)&&!v;return _.createElement(et,X({},re,{onMouseEnter:function(){q===0?B(!0):u(!0)},onMouseLeave:function(){q===0?B(!1):u(!1)},$thumbIndex:q,$isDragged:ae,style:Ct({},re.style)},A,tt,{$isFocusVisible:p&&E===q}),ze&&_.createElement(ot,X({$thumbIndex:q,$isDragged:ae},A,st),x(L[q])),ze&&_.createElement(nt,X({$thumbIndex:q,$isDragged:ae},A,at)))}},l?{renderMark:function(N){var re=N.props,q=N.index;return _.createElement(ht,X({$markIndex:q},re,A,gt))}}:{})),_.createElement(lt,X({},A,dt),_.createElement(Ae,X({},A,Fe),x(T)),_.createElement(Ae,X({},A,Fe),x(t))))}const zt=oe("div",{target:"e19ax2tf0"})({position:"relative",":focus-within:has(:focus-visible)":{"--slider-focused":1}}),Nt=oe("div",{target:"e19ax2tf1"})(({disabled:e,theme:r,isDragged:n})=>({alignItems:"center",backgroundColor:e?r.colors.gray60:r.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",display:"flex",justifyContent:"center",height:r.sizes.sliderThumb,width:r.sizes.sliderThumb,boxShadow:n?Ne(r):"none",":focus":{outline:"none"},":focus-visible":{boxShadow:Ne(r)}})),Ut=oe("div",{target:"e19ax2tf2"})(({disabled:e,theme:r})=>({fontFamily:r.genericFonts.bodyFont,fontSize:r.fontSizes.sm,color:e?r.colors.gray60:r.colors.primary,top:"-1.6em",position:"absolute",whiteSpace:"nowrap",backgroundColor:r.colors.transparent,lineHeight:r.lineHeights.base,fontWeight:r.fontWeights.normal,pointerEvents:"none"})),Ht=oe("div",{target:"e19ax2tf3"})({flex:1}),Wt=oe("div",{target:"e19ax2tf4"})(({theme:e})=>({position:"absolute",height:e.spacing.twoXS,left:`calc(${e.sizes.sliderThumb} / 2)`,right:`calc(${e.sizes.sliderThumb} / 2)`})),qt=oe("div",{target:"e19ax2tf5"})(({theme:e,isHovered:r,isDisabled:n})=>({position:"absolute",left:0,right:0,top:"100%",display:"flex",justifyContent:"space-between",pointerEvents:"none",marginTop:`-${e.spacing.md}`,fontSize:e.fontSizes.sm,lineHeight:e.lineHeights.base,fontWeight:e.fontWeights.normal,color:n?e.colors.fadedText40:e.colors.fadedText60,opacity:r?1:"var(--slider-focused, 0)",transition:r?"none":"opacity 300ms 200ms"}));function Kt({minLabel:e,maxLabel:r,isHovered:n,isDisabled:s}){return xe(qt,{"data-testid":"stSliderTickBar",isHovered:n,isDisabled:s,children:[Z(Ie,{source:e,allowHTML:!1,inheritFont:!0,isLabel:!0}),Z(Ie,{source:r,allowHTML:!1,inheritFont:!0,isLabel:!0})]})}function Xt({disabled:e,element:r,widgetMgr:n,fragmentId:s}){const[v,S]=$t({getStateFromWidgetMgr:Yt,getDefaultStateFromProto:Zt,getCurrStateFromProto:Gt,updateWidgetMgrState:Jt,element:r,widgetMgr:n,fragmentId:s}),[l,h]=_.useState(v),[F,j]=_.useState(!1),[V,I]=_.useState(!1),T=_.useCallback(()=>j(!0),[]),d=_.useCallback(()=>j(!1),[]),t=_.useRef(null),[a]=_.useState([]),[c]=_.useState([]),f=Tt(),y=_.useRef(r);y.current=r;const k=l.map(C=>ye(C,r)),x=ye(r.min,r),O=ye(r.max,r);_.useEffect(()=>{h(v)},[v]);const w=_.useCallback(({value:C})=>{S({value:C,fromUi:!0}),I(!1)},[S]),M=_.useCallback(({value:C})=>{h(C),I(!0)},[]),P=_.useCallback(_.forwardRef(function(i,o){const{$thumbIndex:u,$value:g}=i,m=u||0;a[m]=o,c[m]||=_.createRef();const p=kt(i,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),b=y.current,D=(g??[b.min])[m]??b.min,E=ye(D,b);return Z(Nt,{...p,disabled:i.$disabled===!0,isDragged:i.$isDragged===!0,ref:a[m],"aria-valuetext":E,"aria-label":b.label,children:Z(Ut,{"data-testid":"stSliderThumbValue",disabled:i.$disabled===!0,ref:c[m],children:Z(Ie,{source:E,allowHTML:!1,inheritFont:!0,isLabel:!0})})})}),[]);_.useLayoutEffect(()=>{a.forEach((m,p)=>{m.current&&m.current.setAttribute("aria-valuetext",k[p])});const C=t.current??null,i=a[0].current,o=a[1]?.current,u=c[0].current,g=c[1]?.current;rr(C,i,o,u,g)});const R=_.useCallback(({$disabled:C})=>({height:f.spacing.twoXS,...C?{background:f.colors.darkenedBgMix25}:{}}),[f.colors.darkenedBgMix25,f.spacing.twoXS]),B=_.useCallback(_.forwardRef(function(i,o){const{children:u,...g}=i;return xe(Ht,{children:[Z(Wt,{ref:o,children:u}),Z(fe,{...g,style:R({$disabled:i.$disabled})})]})}),[]);return xe(zt,{ref:t,className:"stSlider","data-testid":"stSlider",onMouseEnter:T,onMouseLeave:d,children:[Z(Rt,{label:r.label,disabled:e,labelVisibility:Ot(r.labelVisibility?.value),children:r.help&&Z(wt,{content:r.help,label:r.label})}),Z(Vt,{min:r.min,max:r.max,step:r.step,value:tr(l,r),onChange:M,onFinalChange:w,disabled:e,overrides:{Thumb:P,Track:{style:{backgroundColor:"none !important",paddingLeft:f.spacing.none,paddingRight:f.spacing.none,paddingTop:`calc((${f.sizes.minElementHeight} - ${f.spacing.twoXS}) / 2)`,paddingBottom:`calc((${f.sizes.minElementHeight} - ${f.spacing.twoXS}) / 2)`}},InnerTrack:B,TickBar:{component:Kt,props:{minLabel:x,maxLabel:O,isHovered:F||V,isDisabled:e}}}})]})}function Yt(e,r){return e.getDoubleArrayValue(r)}function Zt(e){return e.default}function Gt(e){return e.value}function Jt(e,r,n,s){r.setDoubleArrayValue(e,n.value,{fromUi:n.fromUi},s)}function Qt(e){const{dataType:r}=e;return r===de.DataType.DATETIME||r===de.DataType.DATE||r===de.DataType.TIME}function er(e){const{dataType:r}=e;return r===de.DataType.DATE?"date":r===de.DataType.TIME?"time":"datetime"}function ye(e,r){const{format:n,options:s}=r;if(s.length>0)return s[e]??"";if(Qt(r)){const v=St.utc(e/1e3);return _t(v,n,er(r))}return Et(e,n)}function tr(e,r){const{min:n,max:s}=r;let v=e[0],S=e.length>1?e[1]:e[0];return v>S&&(v=S),v<n&&(v=n),v>s&&(v=s),S<n&&(S=n),S>s&&(S=s),e.length>1?[v,S]:[v]}function rr(e,r,n,s,v){!e||!r||!s||(ie(e,r,s),n&&v&&(ie(e,n,v),nr(e,r,n,s,v)))}function ie(e,r,n){const s=e.getBoundingClientRect(),v=r.getBoundingClientRect(),S=n.getBoundingClientRect(),l=v.left+v.width/2,h=l-S.width/2<s.left,F=l+S.width/2>s.right;n.style.left=h?"0":"",n.style.right=F?"0":""}function nr(e,r,n,s,v){const l=e.getBoundingClientRect(),h=r.getBoundingClientRect(),F=n.getBoundingClientRect(),j=s.getBoundingClientRect(),V=v.getBoundingClientRect(),I=l.left+l.width/2,T=h.left+h.width/2,d=F.left+F.width/2,t=T-j.width/2>=l.left,a=d+V.width/2<=l.right,c=h.left-j.width>=l.left,f=F.right+V.width<=l.right,y=t?j.width/2:j.width,k=a?V.width/2:V.width,x=T+y;if(d-k-x>24){ie(e,r,s),ie(e,n,v);return}if(c&&f){s.style.left="",s.style.right=`${Math.round(h.width)}px`,v.style.left=`${Math.round(F.width)}px`,v.style.right="";return}T<I?(ie(e,r,s),v.style.left=`${Math.round(T+y+24-d)}px`,v.style.right=""):(ie(e,n,v),s.style.left="",s.style.right=`${-Math.round(d-k-24-T)}px`)}const hr=Mt(_.memo(Xt));export{hr as default};
|