@stlite/desktop 0.97.0 → 0.98.1
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.
- package/CHANGELOG.md +14 -0
- package/bin/dump_artifacts.js +1 -1
- package/build/assets/9897c61aa169e10d-BSbTZIlv.woff2 +0 -0
- package/build/assets/{ErrorOutline.esm-lsdlHF0t-DG4LSxex.js → ErrorOutline.esm-DV80JhHP-XkDmlp3T.js} +1 -1
- package/build/assets/{FileDownload.esm-B67hf_fm-CYQKuYJG.js → FileDownload.esm-Bg0DSX1Z-tYB-VhDd.js} +1 -1
- package/build/assets/{FileHelper-CfZ5yPb2-CNHTcjh9.js → FileHelper-6E1AHofU-qrMXF9BJ.js} +5 -5
- package/build/assets/{FormClearHelper-XrLdNEJa-DVEjd1cV.js → FormClearHelper-CbmTijuR-BhfBTvx4.js} +1 -1
- package/build/assets/InputInstructions-GG_DznKT-BTS6NlIa.js +5 -0
- package/build/assets/Particles-ByFZ9kUC-B_aeMYcp.js +1 -0
- package/build/assets/{ProgressBar-E3DTwBEC-BjaNqN1B.js → ProgressBar-uLtuFXoi-C547ZD3U.js} +2 -2
- package/build/assets/{StreamlitSyntaxHighlighter-CzihVVQU-DKtwdTjA.js → StreamlitSyntaxHighlighter-0BOUSobY-CgsoE1gN.js} +7 -7
- package/build/assets/{TableChart.esm-DTCdMC22-C2aHYx-P.js → TableChart.esm-CoMoidiP-DrT_rrb0.js} +1 -1
- package/build/assets/WidgetLabel-CoLw86qs-CNbX-e3H.js +1 -0
- package/build/assets/WidgetLabelHelpIcon-DGQ_r-QQ-BpBcjxpA.js +1 -0
- package/build/assets/WidgetLabelHelpIconInline-CBvJmNo2-CLxNkiVd.js +1 -0
- package/build/assets/{_baseAssignValue-D2hePX0_-CX8WO6Yp.js → _baseAssignValue-DQhmkaDt-Bl1quFU6.js} +1 -1
- package/build/assets/assertThisInitialized-C1dAyb4j-CzYfxWZp.js +1 -0
- package/build/assets/{base-input-BPl9JMAl-yC1GT4Gd.js → base-input-BdLA32iO-A9B9vy_-.js} +4 -4
- package/build/assets/{checkbox-BCtTdZut-CgBE95kP.js → checkbox-DFREjf9t-Bj1xZr4O.js} +2 -2
- package/build/assets/constants-Dj7RTpUo-BGkidDJo.js +2 -0
- package/build/assets/{createDownloadLinkElement-D-zJ1ZGH-MUElf4MM.js → createDownloadLinkElement-DdPyJxB4-BwUogbJk.js} +1 -1
- package/build/assets/{createSuper-Csct9QVD-vLz3pY3G.js → createSuper-BZpABwIl-CzqIX_hj.js} +1 -1
- package/build/assets/data-grid-overlay-editor-QHhShSfm-3TuDDPoi.js +1 -0
- package/build/assets/{downloader-DcCTL3Wz-CCWe5qlA.js → downloader-DcCTL3Wz-BV_PV8FK.js} +1 -1
- package/build/assets/embed-DsUNNyuf-iklb31Eb.js +193 -0
- package/build/assets/{es6--XPcqeHG-7ATg0sOb.js → es6--XPcqeHG-CHWR2W_o.js} +2 -2
- package/build/assets/formatNumber-C0_e-CAH-GlcLbdL6.js +1 -0
- package/build/assets/{iconPosition-D6yC8Xnj-BF1h45AJ.js → iconPosition-DC20xXN5-Dq1FtUtw.js} +1 -1
- package/build/assets/{iframeResizer.contentWindow-nTwp-zqr-CtsMNeCZ.js → iframeResizer.contentWindow-CK2JqAeV-DqbaJEzN.js} +1 -1
- package/build/assets/index-9BL32MjC-d0WHvbzb.js +1 -0
- package/build/assets/{index-DUNdG0N4-BKyH_Fci.js → index-B0C1EJi--C9vASPz3.js} +1 -1
- package/build/assets/{index-BmOxzNZt-CNMeXzFc.js → index-B4B1qPeD-B4iZ3Hle.js} +1 -1
- package/build/assets/index-B5UL-R7r-CWJT9KeA.js +1 -0
- package/build/assets/{index-B7jXK8tg-DQuHfWI9.js → index-BGnBFvx7-CovA4PPU.js} +1 -1
- package/build/assets/index-BLF4SOe9-BATezQGi.js +1 -0
- package/build/assets/index-BVqn7psP-DOIOIfGO.js +1 -0
- package/build/assets/index-BWXbSx5b-3ZGL6YOx.js +9 -0
- package/build/assets/index-BWq44yej-BLlqoxJR.js +2 -0
- package/build/assets/{index-DjAHjI25-oZ9XAxp1.js → index-BXKF9Na4-e8_T7zol.js} +4 -4
- package/build/assets/{index-f_0uAugs-KaRkqnk8.js → index-BYY96E5j-Bp1H9cgU.js} +1 -1
- package/build/assets/index-BZJBZSAA-DFqiOZai.js +2 -0
- package/build/assets/index-BjrlCNX2-LTYqrHHV.js +1 -0
- package/build/assets/index-BmK3aM70-BtZtyb9b.js +2 -0
- package/build/assets/index-BuOHAFyU-CgkpNrjG.js +1 -0
- package/build/assets/index-BwVivyUp-BMVGZ9_Q.js +1 -0
- package/build/assets/index-C2tfS9CH-BRrFBwHT.js +3 -0
- package/build/assets/index-CDQEgcT1-DtNnQE5Q.js +3 -0
- package/build/assets/index-CKw_lXVb-3dsfAMaj.js +9 -0
- package/build/assets/index-CSHbNsrd-CaeMETbK.js +1 -0
- package/build/assets/index-CStypS2h-ZcgczjKg.js +1 -0
- package/build/assets/index-CTUrfAxj--v8quZkn.js +2 -0
- package/build/assets/{index-CiGWj_Vp-n6pbS_He.js → index-CYGEb27Q-2USI782v.js} +1 -1
- package/build/assets/index-CZIHO3Hi-CIp8gy8I.js +1 -0
- package/build/assets/index-Cqst7YJT-C9v2_kdG.js +1 -0
- package/build/assets/index-CrKJRmJv-Bg5NDALn.js +1 -0
- package/build/assets/{index-BmPxToPj-BM0EGyRT.js → index-CxYiRuXO-CRK1FQiS.js} +1 -1
- package/build/assets/{index-CYKyPdc--DXQt2pbH.js → index-CzaX93h_-B-_1QLd4.js} +1 -1
- package/build/assets/index-D52Jf8Ey-SgTlRv8T.js +1 -0
- package/build/assets/{index-DuZXLtJ1-BxktJ87b.js → index-D8-_3_8b-1KPkAAUR.js} +1 -1
- package/build/assets/index-D84Izf2I-C_zQnNB2.js +1 -0
- package/build/assets/{index-D1pkaPju-DGUZOgpo.js → index-DCNthJH_-DBm0ode_.js} +1 -1
- package/build/assets/index-DKp3_2FO-qvF0epur.js +1 -0
- package/build/assets/{index-DQ7wfL_P-DAp2jN40.js → index-DXEnufEK-CPeh905k.js} +2 -2
- package/build/assets/index-Dd99Pbav-BGjrs667.js +1 -0
- package/build/assets/index-DegoUuPm.js +171 -0
- package/build/assets/index-DlNfwH7j-Ciae2OLh.js +3789 -0
- package/build/assets/index-DnMeTGk7-X2HPuQXI.js +17 -0
- package/build/assets/index-DpazIH3n-D6BMkmZF.js +1 -0
- package/build/assets/{index-D0DUjycF-DZpBbVrj.js → index-DuHJMwJD-Bsr8Y8w7.js} +1 -1
- package/build/assets/index-DuuHtz-x-Caurorud.js +3 -0
- package/build/assets/{index-BIskStic-GEaJjVf4.js → index-Dxtfs80M-s0TmhiEk.js} +213 -213
- package/build/assets/index-LfSwL_C3-BhFtSxQv.js +1 -0
- package/build/assets/{index-H5hDyygX-DMvEgj-E.js → index-SfqmeEwF-Dq9F6PRu.js} +1 -1
- package/build/assets/index-Zh4mTo6Q-BW_atvXh.js +1 -0
- package/build/assets/index-dDzvj0X4-DcwcRJ2U.js +1 -0
- package/build/assets/index-ebIdPrk5-uPj-BdYi.js +1 -0
- package/build/assets/index-glyZT6vh-DgW3Iulb.js +11 -0
- package/build/assets/index-hpzROwMA-mo9c0M0y.js +1 -0
- package/build/assets/index-rCmWIVzf.css +1 -0
- package/build/assets/index-t2JVnYeR-CxNAko6c.js +198 -0
- package/build/assets/{input-BZGQFBY5-B-EqzVpf.js → input-vJKt6Tqs-D1h27UxA.js} +2 -2
- package/build/assets/{main-DD_nsVBV-B-nG1zNN.js → main-B1Ej7gwo-CcTKNe5S.js} +1 -1
- package/build/assets/{memory-B3L1Fctl-Dwxd_AN8.js → memory-B3L1Fctl-Cn5y4VWL.js} +1 -1
- package/build/assets/number-overlay-editor-DJYV-edd-B_O-Ktcq.js +9 -0
- package/build/assets/{pandasStylerUtils-DlCnQunN-DDd07kWa.js → pandasStylerUtils-GHHHScPD-CTKMoUtV.js} +1 -1
- package/build/assets/possibleConstructorReturn-E3G46ZYb-Lz9Rlt8w.js +1 -0
- package/build/assets/{sandbox-ChAzL-i--CrJOWfYj.js → sandbox-ChAzL-i--BIq4nttm.js} +1 -1
- package/build/assets/select-Pj-68ff--fhVXPkd8.js +14 -0
- package/build/assets/sprintfjs-BB1ejNgh-D_XlFCD8.js +1 -0
- package/build/assets/styled-components-BF-9yHWP-Fq0Myn8O.js +1 -0
- package/build/assets/styled-components-BPyosp2h-CHa8nolL.js +1 -0
- package/build/assets/styled-components-UJ_u5XUO-B68esmwJ.js +1 -0
- package/build/assets/{timepicker-CL-801So-Sc5MVKGZ.js → timepicker-BJ4MpQyD-d8465QWp.js} +3 -3
- package/build/assets/{toConsumableArray-CCohTQYb-ClE5WF0y.js → toConsumableArray-fI4JT57_-CqtYDc1p.js} +3 -3
- package/build/assets/uniqueId-DvP0IaTe-DffbsNAr.js +1 -0
- package/build/assets/useBasicWidgetState-JbPrIror-Bu87DmaN.js +1 -0
- package/build/assets/{useIntlLocale-D1zv6Q2y-BpOVDRdF.js → useIntlLocale-CYWMTZ3s-Bfz8l4j_.js} +9 -9
- package/build/assets/useSelectCommon-DTdQ2TWs-DMezB-1T.js +1 -0
- package/build/assets/useTextInputAutoExpand-DKFPNBDa-Cb0YY3m0.js +2 -0
- package/build/assets/{useUpdateUiValue-DDoOKBFH-DrpUtoEl.js → useUpdateUiValue-DMih0kWV-BWZ6Saew.js} +1 -1
- package/build/assets/useWaveformController-BeUcMXLl-DLfXFMqt.js +1 -0
- package/build/assets/withCalculatedWidth-Du6RrD8E-CIxv0z4S.js +1 -0
- package/build/assets/withFullScreenWrapper-uh7txjJc-CYEgnXN4.js +1 -0
- package/build/index.html +2 -2
- package/package.json +4 -4
- package/wheels/stlite_lib-0.1.0-py3-none-any.whl +0 -0
- package/wheels/streamlit-1.55.0-cp313-none-any.whl +0 -0
- package/build/assets/7249f9261aa0c06e-C7IFxh57.woff2 +0 -0
- package/build/assets/InputInstructions-UPXPLzmg-Q7bu80af.js +0 -5
- package/build/assets/Particles-BG5hjQKX-C7A0Knla.js +0 -1
- package/build/assets/Toolbar-DencJ98c--L3IVNu_.js +0 -1
- package/build/assets/WidgetLabelHelpIconInline-DFAc7fKv-BB1k3kRL.js +0 -1
- package/build/assets/data-grid-overlay-editor-58Vv1cYM-BTQbyoqC.js +0 -1
- package/build/assets/embed-4M_Y1tyc-DYkZAF8O.js +0 -195
- package/build/assets/formatNumber-ep44bWil-jKcj-W8C.js +0 -1
- package/build/assets/index--TzMnXzp-DAvnEXlj.js +0 -1
- package/build/assets/index--qHBza9B-Cw3TTMgu.js +0 -1
- package/build/assets/index-B-mlHTWW-DxFrd5NG.js +0 -1
- package/build/assets/index-B-vlNoRi-Cx4hHKp7.js +0 -1
- package/build/assets/index-BFmSYBo1-C1-2gL1R.js +0 -2
- package/build/assets/index-BmXuG0WA-D_Ql4e0d.js +0 -3
- package/build/assets/index-BtV4cH-G-DZqE8EFk.js +0 -1
- package/build/assets/index-BwXCTp7d-CbCsXHhb.js +0 -6
- package/build/assets/index-BwaRZjpn-BcW7Mc-p.js +0 -1
- package/build/assets/index-BzkAb_Ru-BoJQq1Du.js +0 -1
- package/build/assets/index-C5pyI-9n-BoqvCp9L.js +0 -3
- package/build/assets/index-CHTMxzEE-CdrOqTD2.js +0 -1
- package/build/assets/index-CJJUSpBk-Cjx3_stH.js +0 -2
- package/build/assets/index-CWwI7Day-CBbcYz7C.js +0 -3
- package/build/assets/index-CYavJtAA-CEB9mFy5.js +0 -11
- package/build/assets/index-C_AtJDfm-C2sFKVUp.js +0 -1
- package/build/assets/index-Cc93rxqK-qmLHI1ce.js +0 -1
- package/build/assets/index-CgwImjw9-vhGwcoU0.js +0 -1
- package/build/assets/index-Cp9lKUfY-DCgJbJZE.js +0 -1
- package/build/assets/index-CrLOtTTY-_bXB7Npw.js +0 -2
- package/build/assets/index-CuAftQdk-D76l7Kt4.js +0 -17
- package/build/assets/index-D6IEgvdJ-B-rltr1-.js +0 -1
- package/build/assets/index-D9TZavtE.css +0 -1
- package/build/assets/index-DR-j-FYy-DJdOMdE8.js +0 -9
- package/build/assets/index-Dfye6cAn-CH-9suNF.js +0 -1
- package/build/assets/index-DhMU6AlU-DzPhysZa.js +0 -3789
- package/build/assets/index-DlPzHASD-B0KSeIYY.js +0 -1
- package/build/assets/index-DrLK8ov3-Stod2ydK.js +0 -2
- package/build/assets/index-DtFJwl5H-Dn2VZIyI.js +0 -1
- package/build/assets/index-LD7yKakY-9tfSlqzu.js +0 -1
- package/build/assets/index-LeNVxf2A-B46Z4XAZ.js +0 -1
- package/build/assets/index-QsvFitQg-IS60zSNc.js +0 -1
- package/build/assets/index-YCKUmi7k-wKVbmOTE.js +0 -1
- package/build/assets/index-nhNM5UeG.js +0 -185
- package/build/assets/index-pi_S-NOw-DHRw2FEx.js +0 -198
- package/build/assets/index-saRTHQRt-Cep0ox_U.js +0 -1
- package/build/assets/number-overlay-editor--_WCmOH8-DebLrQQ4.js +0 -9
- package/build/assets/possibleConstructorReturn-i7eTFBhJ-BnzuGOIJ.js +0 -1
- package/build/assets/sprintf-D5E86llw-6tzWM3a-.js +0 -1
- package/build/assets/styled-components-Dq_iSDU9-i1eh3pWs.js +0 -1
- package/build/assets/uniqueId-CWWNkcH4-CJJowNJ2.js +0 -1
- package/build/assets/useBasicWidgetState-BYeS5Lnw-COvJBdtg.js +0 -1
- package/build/assets/useTextInputAutoExpand-DEesfW0v-Cv12Lx8Q.js +0 -2
- package/build/assets/useWaveformController-Betfr4kn-B9JLTJ93.js +0 -1
- package/build/assets/withCalculatedWidth-ZZ9bYZZd-CtbnrMaD.js +0 -1
- package/build/assets/withFullScreenWrapper-B-PKqZVg-DWJ8sEV7.js +0 -1
- package/wheels/streamlit-1.53.1-cp313-none-any.whl +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,L as st,H as ct,bm as dt,bE as ut,E as pt,j as ne,aT as Ee,aS as ft,bF as y,ar as ht,k as i,y as h,aq as V,ae as Fe,bn as ce,ap as de,aR as mt,af as Se,F as C,_ as z,$ as ke,aU as gt,ag as xt}from"./index-nhNM5UeG.js";import{S as wt,E as K,j as Me,I as Re,P as le,T as vt,v as Ve,a as bt}from"./FileHelper-CfZ5yPb2-CNHTcjh9.js";import{c as yt}from"./useWaveformController-Betfr4kn-B9JLTJ93.js";import{e as Ct}from"./InputInstructions-UPXPLzmg-Q7bu80af.js";import{p as zt,r as jt}from"./useTextInputAutoExpand-DEesfW0v-Cv12Lx8Q.js";import{r as Et}from"./inputUtils-DCYiajnz-DsrlAoKH.js";import{c as St}from"./TableChart.esm-DTCdMC22-C2aHYx-P.js";import{i as Rt}from"./ErrorOutline.esm-lsdlHF0t-DG4LSxex.js";import{t as Ae}from"./UploadFileInfo-DdcsXhjv-m2CBXl3F.js";import"./base-input-BPl9JMAl-yC1GT4Gd.js";var He=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});He.displayName="Article";var Le=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});Le.displayName="Code";var Te=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});Te.displayName="Description";var Be=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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 Ue=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});Ue.displayName="Image";var De=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});De.displayName="MusicNote";var Pe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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 Ne=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});Ne.displayName="Videocam";var $e=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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 We=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});We.displayName="ArrowUpward";var Ie=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});Ie.displayName="Cancel";var Oe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});Oe.displayName="Check";var Xe=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});Xe.displayName="Close";var Ke=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(C,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"}))});Ke.displayName="ErrorOutline";const X=pt.getLogger("ChatInput"),Vt=h("div",{target:"e1d2x3se10"})({name:"16hjiy4",styles:"position:relative;display:flex;flex-direction:column"}),Ft=h("div",{target:"e1d2x3se9"})(({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}}),""),kt=h("div",{target:"e1d2x3se8"})(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing.sm}),""),Mt=h("div",{target:"e1d2x3se7"})(({theme:e,isStacked:t})=>({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",gap:e.spacing.sm,flexWrap:t?"wrap":"nowrap"}),""),At=h("div",{target:"e1d2x3se6"})(({isStacked:e})=>({flex:e?"none":1,width:e?"100%":"auto",order:e?-1:0,display:"flex",alignItems:"center",minWidth:0}),""),Ht=h("div",{target:"e1d2x3se5"})(({theme:e})=>({display:"flex",flexDirection:"row",flexShrink:0,gap:e.spacing.sm,alignItems:"center"}),""),Lt=h("div",{target:"e1d2x3se4"})(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing.sm,alignItems:"center"}),""),Tt=h("div",{target:"e1d2x3se3"})(({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"}}),""),M=h("button",{target:"e1d2x3se2"})(({theme:e,disabled:t,hasError:o,primary:d})=>{if(d)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:Se(e)},"&:hover":{backgroundColor:t?e.colors.darkenedBgMix15:e.colors.primary}};const c=()=>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:c(),pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{boxShadow:Se(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=h("div",{target:"e1d2x3se1"})(({isRecording:e})=>({display:e?"flex":"none",flex:1,alignItems:"center",minWidth:0}),""),Ut=h("div",{target:"e1d2x3se0"})(({theme:e})=>({position:"relative",width:"100%",height:e.sizes.chatInputPrimaryButtonSize,borderRadius:e.radii.default,overflow:"hidden","& > div":{position:"absolute",inset:0}}),""),Ze=(e,t)=>t===y.Directory?{...e,webkitdirectory:"",multiple:!0}:e,Dt=(e,t)=>{if(!t||t.length===0)return!0;const o=e.name.toLowerCase(),d=o.lastIndexOf(".");if(d===-1||d===o.length-1)return t.some(p=>p===""||p===".");const c=o.substring(d),m=o.substring(d+1);return t.some(p=>{const x=p.toLowerCase();return x.startsWith(".")?c===x:m===x})},Pt=(e,t)=>Dt(e,t)?{isValid:!0}:{isValid:!1,errorMessage:`${e.type||"This type of"} files are not allowed.`},se=e=>{switch(e){case y.None:return"a file";case y.Single:return"a file";case y.Multiple:return"files";case y.Directory:return"a directory";default:return ke(e),"a file"}},Nt=h("div",{target:"e3id6jz13"})(({theme:e})=>({backgroundColor:e.colors.transparent,position:"absolute",inset:0,zIndex:e.zIndices.priority,borderRadius:e.radii.chatInput}),""),$t=h("div",{target:"e3id6jz12"})(({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}),""),Wt=h("div",{target:"e3id6jz11"})(({disabled:e})=>({pointerEvents:e?"none":"auto"}),""),It=h("div",{target:"e3id6jz10"})(({theme:e})=>({lineHeight:e.lineHeights.tight}),""),Ot=h("div",{target:"e3id6jz9"})(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing.sm}),""),Xt=h("div",{target:"e3id6jz8"})({name:"193lomy",styles:"flex:0 0 auto;max-width:100%"}),Kt=h("div",{target:"e3id6jz7"})(({theme:e,isError:t,isClickable:o})=>({position:"relative",display:"inline-flex",alignItems:"center",width:"fit-content",minWidth:"9rem",maxWidth:"11rem",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"}),""),Zt=h("div",{target:"e3id6jz6"})({name:"1ojnsow",styles:"display:flex;flex-direction:column;min-width:0"}),Yt=h("div",{target:"e3id6jz5"})(({theme:e,fileStatus:t})=>({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:e.radii.default,width:e.sizes.chatInputFileIconSize,height:e.sizes.chatInputFileIconSize,flexShrink:0,overflow:"hidden",...t==="uploaded"&&{backgroundColor:e.colors.bodyText,color:e.colors.bgColor},...t==="uploading"&&{backgroundColor:e.colors.fadedText10,color:e.colors.fadedText60},...t==="error"&&{backgroundColor:e.colors.redBackgroundColor,color:e.colors.redTextColor}}),""),qt=h("img",{target:"e3id6jz4"})({name:"4uwt2b",styles:"width:100%;height:100%;object-fit:cover"}),_t=h("div",{target:"e3id6jz3"})(({theme:e,fileStatus:t})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t.type==="uploading"?e.colors.fadedText60:e.colors.bodyText}),""),Gt=h("div",{target:"e3id6jz2"})(({theme:e})=>({color:e.colors.fadedText60,fontSize:e.fontSizes.sm}),""),Qt=h("small",{target:"e3id6jz1"})(({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}}}),""),Jt=h("span",{target:"e3id6jz0"})({name:"1dja9su",styles:"position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0"}),er=({onDrop:e,multiple:t,accept:o,maxSize:d,acceptFile:c,disabled:m})=>{const{getRootProps:p,getInputProps:x}=Me({onDrop:e,multiple:t,accept:o,maxSize:d,useFsAccessApi:!1}),v=Ze(x(),c),s=p({tabIndex:-1});return i.jsxs(Wt,{"data-testid":"stChatInputFileUploadButton",disabled:m,...s,children:[i.jsx("input",{...v}),i.jsx(ce,{content:`Upload or drag and drop ${se(c)}`,placement:de.TOP,onMouseEnterDelay:500,children:i.jsx(M,{type:"button",disabled:m,"aria-label":`Upload ${se(c)}`,children:i.jsx(V,{content:$e,size:"xl",color:"inherit"})})})]})},tr=r.memo(er),rr=({getRootProps:e,getInputProps:t,acceptFile:o})=>{const d=Ze(t(),o);return i.jsxs(i.Fragment,{children:[i.jsx(Nt,{...e(),children:i.jsx("input",{...d})}),i.jsx($t,{children:`Drag and drop ${se(o)} here`})]})},or=r.memo(rr),Ye=new Set(["jpg","jpeg","png","gif","webp","svg","bmp"]),nr=new Set(["pdf"]),ir=new Set(["csv","tsv","xlsx","xls"]),ar=new Set(["txt","md","json","xml","yaml","yml"]),lr=new Set(["py","js","ts","jsx","tsx","css","html","java","cpp","c","go","rs","rb","php","swift","kt","scala","sh","bash","sql"]),sr=new Set(["mp3","wav","m4a","ogg","flac","aac"]),cr=new Set(["mp4","webm","mov","avi","mkv","wmv"]),dr=new Set(["zip","tar","gz","rar","7z","bz2"]);function qe(e){const t=e.lastIndexOf(".");return t===-1||t===e.length-1?"":e.slice(t+1).toLowerCase()}function ur(e){const t=qe(e);return Ye.has(t)?Ue:nr.has(t)?He:ir.has(t)?St:ar.has(t)?Te:lr.has(t)?Le:sr.has(t)?De:cr.has(t)?Ne:dr.has(t)?Be:bt}function pr(e){const t=qe(e);return Ye.has(t)}const fr=16;function hr(e,t=fr){if(e.length<=t)return e;const o=e.lastIndexOf(".");if(!(o>0&&o<e.length-1)){const s=Math.floor((t-3)/2),w=s>0?e.slice(-s):"";return`${e.slice(0,s)}...${w}`}const d=e.slice(o),c=e.slice(0,o),m=t-d.length-3;if(m<=0){const s=Math.floor((t-3)/2),w=s>0?e.slice(-s):"";return`${e.slice(0,s)}...${w}`}const p=Math.ceil(m/2),x=Math.floor(m/2),v=x>0?c.slice(-x):"";return`${c.slice(0,p)}...${v}${d}`}function mr(e,t){const o=r.useMemo(()=>!e||!pr(t)?null:URL.createObjectURL(e),[e,t]);return r.useEffect(()=>()=>{o&&URL.revokeObjectURL(o)},[o]),o}const gr=({fileInfo:e,imagePreviewUrl:t})=>{const{type:o}=e.status;switch(o){case"uploading":return i.jsx(Fe,{iconValue:"spinner",testid:"stChatInputFileIconSpinner",size:"lg"});case"error":return i.jsx(V,{content:Rt,size:"lg",testid:"stChatInputFileIconError"});case"uploaded":return t?i.jsx(qt,{src:t,alt:e.name,"data-testid":"stChatInputFileImagePreview"}):i.jsx(V,{content:ur(e.name),size:"lg"});default:return ke(o),null}},xr=({fileInfo:e,onDelete:t,onRetry:o})=>{const d=e.status.type,c=d==="error",m=d==="uploading",p=c&&o!==void 0&&e.file!==void 0,x=r.useId(),v=mr(e.file,e.name),s=e.status.type==="error"?e.status.errorMessage:"Upload failed",w=r.useCallback(()=>{p&&o(e)},[p,o,e]),g=r.useCallback(b=>{p&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),o(e))},[p,o,e]),f=r.useCallback(b=>{b.stopPropagation(),t(e.id)},[t,e.id]),A=m?`Cancel upload of ${e.name}`:`Remove ${e.name}`,Z=Ve(e.size,K.Byte),P=`${e.name}, ${Z}`,H=i.jsxs(Kt,{className:"stChatInputFile","data-testid":"stChatInputFile",isError:c,isClickable:p,onClick:p?w:void 0,onKeyDown:p?g:void 0,title:p?"Click to retry upload":void 0,role:p?"button":void 0,tabIndex:p?0:void 0,"aria-label":P,"aria-invalid":c||void 0,"aria-describedby":c?x:void 0,children:[i.jsx(Yt,{fileStatus:d,children:i.jsx(gr,{fileInfo:e,imagePreviewUrl:v})}),i.jsxs(Zt,{children:[i.jsx(_t,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:e.name,fileStatus:e.status,children:hr(e.name)}),i.jsx(Gt,{children:Ve(e.size,K.Byte)})]}),i.jsx(Qt,{"data-testid":"stChatInputDeleteBtn",isError:c,children:i.jsx(gt,{onClick:f,kind:xt.MINIMAL,"aria-label":A,children:i.jsx(V,{content:Ie,size:"md"})})}),c&&i.jsxs(Jt,{id:x,role:"alert",children:["Error: ",s]})]});return c?i.jsx(ce,{content:s,placement:de.TOP,error:!0,children:H}):H},wr=r.memo(xr),vr=({items:e,onDelete:t,onRetry:o})=>i.jsx(It,{"data-testid":"stChatUploadedFiles",children:i.jsx(Ot,{children:e.map(d=>i.jsx(Xt,{children:i.jsx(wr,{fileInfo:d,onDelete:t,onRetry:o})},d.id))})}),br=r.memo(vr),yr=(e,t,o)=>{const d=[],c=[];return e.forEach(m=>{if(m.size>o){c.push({file:m,errors:[{code:le.FileTooLarge,message:`File is too large. Maximum size is ${o} bytes.`}]});return}const p=Pt(m,t.fileType);if(!p.isValid){c.push({file:m,errors:[{code:le.FileInvalidType,message:p.errorMessage||"File type not allowed."}]});return}d.push(m)}),{accepted:d,rejected:c}},Cr=({acceptMultipleFiles:e,maxFileSize:t,uploadClient:o,uploadFile:d,addFiles:c,getNextLocalFileId:m,deleteExistingFiles:p,onUploadComplete:x,element:v})=>(s,w)=>{if(s.length>0){const{accepted:g,rejected:f}=yr(s,v,t);s=g,w=[...w,...f]}if(!e&&s.length===0&&w.length>1){const g=w.findIndex(f=>f.errors?.[0].code===le.TooManyFiles);g>=0&&(s.push(w[g].file),w.splice(g,1))}if(!e&&s.length>0&&p(),o.fetchFileURLs(s).then(g=>{mt(g,s).forEach(([f,A])=>{d(f,A)})}).catch(g=>{c(s.map(f=>new Ae(f.name,f.size,m(),{type:"error",errorMessage:g},f)))}),w.length>0){const g=w.map(f=>vt(f,m(),t));c(g)}x()},zr=({getNextLocalFileId:e,addFiles:t,updateFile:o,uploadClient:d,element:c,onUploadProgress:m,onUploadComplete:p})=>(x,v)=>{const s=v.webkitRelativePath||v.name,w=new AbortController,g=new Ae(s,v.size,e(),{type:"uploading",abortController:w,progress:1},v);t([g]),d.uploadFile({formId:"",...c},x.uploadUrl,v,f=>m(f,g.id),w.signal).then(()=>p(g.id,x)).catch(f=>{f instanceof DOMException&&f.name==="AbortError"||o(g.id,g.setStatus({type:"error",errorMessage:f?f.toString():"Unknown error"}))})};function jr(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 ie=(e,t,o)=>o.map(d=>d.id===e?t:d),ae=(e,t)=>t.find(o=>o.id===e);function Er({disabled:e,element:t,widgetMgr:o,fragmentId:d,uploadClient:c}){const m=st(),{placeholder:p,maxChars:x}=t,v=r.useRef(0),s=r.useRef(null),w=r.useRef(!1),g=r.useRef(null),f=r.useRef(null),{width:A,elementRef:Z}=ct(),{innerWidth:P,innerHeight:H}=dt(),[b,Y]=r.useState(t.default),[S,F]=r.useState([]),[L,q]=r.useState(!1),[T,ue]=r.useState(!1),[_,B]=r.useState(null),[k,G]=r.useState(!1),[_e,pe]=r.useState(0),Q=t.acceptAudio??!1;r.useEffect(()=>()=>{f.current&&f.current.abort()},[]);const N=zt({textareaRef:s,dependencies:[p,k]}),$=r.useRef(""),W=r.useRef(0),J=r.useRef(null),fe=r.useRef(null),U=r.useCallback(n=>{const a=getComputedStyle(n);$.current=`${a.fontWeight} ${a.fontSize} ${a.fontFamily}`;const u=parseFloat(a.paddingLeft)||0,l=parseFloat(a.paddingRight)||0;W.current=n.clientWidth-u-l},[]);r.useLayoutEffect(()=>{const n=s.current;if(!n)return;U(n);const a=new ResizeObserver(()=>U(n));return a.observe(n),()=>a.disconnect()},[U,k]),r.useEffect(()=>{if(b===""){G(!1);return}if(k)return;const n=s.current;if(!n||((W.current<=0||!$.current)&&U(n),W.current<=0||!$.current))return;J.current||(J.current=document.createElement("canvas"),fe.current=J.current.getContext("2d"));const a=fe.current;a&&(a.font=$.current,a.measureText(b).width>W.current-10&&G(!0))},[b,k,U]);const I=r.useMemo(()=>S.some(n=>n.status.type==="uploading")?!1:b!==""||S.length>0,[S,b]),E=ut(t.acceptFile),ee=wt(t.maxUploadSizeMb,K.Megabyte,K.Byte),he=r.useCallback(n=>F(a=>[...a,...n]),[]),me=r.useCallback(n=>{n.status.type==="uploading"&&n.status.abortController.abort(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&c.deleteFile(n.status.fileUrls.deleteUrl).catch(a=>{X.error("Failed to delete file from server:",a)})},[c]),ge=r.useCallback(n=>{F(a=>{const u=ae(n,a);if(ne(u))return a;me(u);const l=a.filter(j=>j.id!==n);return l.length===0&&pe(j=>j+1),l})},[me]),te=r.useRef(null),Ge=r.useCallback(n=>{!n.file||n.status.type!=="error"||(F(a=>a.filter(u=>u.id!==n.id)),te.current&&te.current([n.file],[]))},[]),xe=r.useCallback(()=>{const n=S.filter(a=>a.status.type==="uploaded").map(a=>{const{name:u,size:l,status:j}=a,{fileId:oe,fileUrls:lt}=j;return new Ee({fileId:oe,fileUrls:lt,name:u,size:l})});return new ft({uploadedFileInfo:n})},[S]),we=()=>v.current++,re=Cr({acceptMultipleFiles:E===y.Multiple||E===y.Directory,maxFileSize:ee,uploadClient:c,uploadFile:zr({getNextLocalFileId:we,addFiles:he,updateFile:(n,a)=>{F(u=>ie(n,a,u))},uploadClient:c,element:t,onUploadProgress:(n,a)=>{F(u=>{const l=ae(a,u);if(ne(l)||l.status.type!=="uploading")return u;const j=Math.round(n.loaded*100/n.total);return l.status.progress===j?u:ie(a,l.setStatus({type:"uploading",abortController:l.status.abortController,progress:j}),u)})},onUploadComplete:(n,a)=>{F(u=>{const l=ae(n,u);return ne(l)||l.status.type!=="uploading"?u:ie(l.id,l.setStatus({type:"uploaded",fileId:a.fileId,fileUrls:a}),u)})}}),addFiles:he,getNextLocalFileId:we,deleteExistingFiles:()=>S.forEach(n=>ge(n.id)),onUploadComplete:()=>{s.current&&s.current.focus()},element:t});te.current=re;const{getRootProps:Qe,getInputProps:Je}=Me({onDrop:re,multiple:E===y.Multiple||E===y.Directory,accept:Re(t.fileType),maxSize:ee,useFsAccessApi:!1}),O=r.useCallback(n=>{if(s.current&&s.current.focus(),!I&&!n||e)return;const a=xe(),u={data:b,fileUploaderState:a,audioFileInfo:n};o.setChatInputValue(t,u,{fromUi:!0},d),S.length>0&&pe(l=>l+1),F([]),Y(""),G(!1),N.clearScrollHeight()},[I,e,b,S.length,xe,o,t,d,N]),ve=r.useCallback(async n=>{const a=new Date().toISOString().replace(/[:.]/g,"-"),u=new File([n],`audio-${a}.wav`,{type:"audio/wav"});try{ue(!0);const l=await c.fetchFileURLs([u]);if(l.length===0)throw new Error("Failed to get upload URL for audio file");const j=l[0];f.current=new AbortController,await c.uploadFile({formId:"",...t},j.uploadUrl,u,()=>{},f.current.signal);const oe=new Ee({fileId:j.fileId,fileUrls:j,name:u.name,size:u.size});O(oe)}catch(l){X.error("Audio upload failed:",l),B("Recording failed"),s.current&&s.current.focus()}finally{ue(!1)}},[c,t,O]),et=r.useMemo(()=>({onApprove:ve,onPermissionDenied:()=>{const n="Microphone access denied";B(n),X.error("Permission denied:",n)},onError:n=>{B("Recording failed"),X.error("Recording error:",n)},onRecordStart:()=>{B(null)}}),[ve]),R=yt({containerRef:g,sampleRate:t.audioSampleRate??void 0,events:et}),be=r.useCallback(()=>{O()},[O]),tt=n=>{const{metaKey:a,ctrlKey:u,shiftKey:l}=n;Et(n)&&!l&&!u&&!a&&(n.preventDefault(),be())},rt=n=>{const{value:a}=n.target;x!==0&&a.length>x||(Y(a),N.updateScrollHeight(),_&&B(null))},ye=r.useCallback(async n=>{n.preventDefault(),n.stopPropagation(),!(!Q||e||R.state==="recording")&&await R.start()},[Q,e,R]),ot=r.useCallback(()=>{R.cancel(),s.current&&s.current.focus()},[R]),Ce=r.useCallback(async()=>{const{blob:n}=await R.stop();await R.approve(n)},[R]),ze=r.useCallback(n=>{ye(n)},[ye]),nt=r.useCallback(()=>{Ce()},[Ce]),it=r.useCallback(()=>{s.current&&s.current.focus()},[]);r.useEffect(()=>{if(t.setValue&&!w.current){w.current=!0;const n=t.value||"";Y(n)}},[t.setValue,t.value]),r.useEffect(()=>{w.current=!1},[t]),r.useEffect(()=>{const n=l=>{l.preventDefault(),l.stopPropagation(),!L&&l.dataTransfer?.types.includes("Files")&&q(!0)},a=l=>{l.preventDefault(),l.stopPropagation(),L&&(l.clientX<=0&&l.clientY<=0||l.clientX>=P&&l.clientY>=H)&&q(!1)},u=l=>{l.preventDefault(),l.stopPropagation(),L&&q(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",u),window.addEventListener("dragleave",a),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",u),window.removeEventListener("dragleave",a)}},[L,P,H]);const at=E!==y.None&&L,D=R.state==="recording",je=!D&&A>ht(m.breakpoints.hideWidgetDetails)&&x>0;return i.jsx(Vt,{className:"stChatInput","data-testid":"stChatInput",ref:Z,children:i.jsxs(Ft,{children:[je&&i.jsx(Tt,{onClick:it,id:"stChatInputInstructions",children:i.jsx(Ct,{dirty:I,value:b,maxLength:x,type:"chat",inForm:!1,className:"stChatInputInstructions"})}),at&&i.jsx(or,{getRootProps:Qe,getInputProps:Je,acceptFile:E}),E!==y.None&&S.length>0&&i.jsx(kt,{children:i.jsx(br,{items:[...S],onDelete:ge,onRetry:Ge})}),i.jsxs(Mt,{isStacked:k,children:[i.jsx(Ht,{children:E!==y.None&&!D&&i.jsx(tr,{onDrop:re,multiple:E===y.Multiple||E===y.Directory,accept:Re(t.fileType),maxSize:ee,acceptFile:E,disabled:e},_e)}),i.jsx(Bt,{isRecording:D,children:i.jsx(Ut,{ref:g})}),!D&&i.jsx(At,{isStacked:k,children:i.jsx(jt,{inputRef:s,value:b,placeholder:p,onChange:rt,onKeyDown:tt,"aria-label":p,disabled:e,rows:1,"aria-describedby":je?"stChatInputInstructions":void 0,overrides:jr(m,N,{width:"100%"})})}),i.jsx(Lt,{children:D?i.jsxs(i.Fragment,{children:[i.jsx(M,{onClick:ot,disabled:e,"data-testid":"stChatInputCancelButton","aria-label":"Cancel recording",children:i.jsx(V,{content:Xe,size:"lg",color:"inherit"})}),i.jsx(M,{onClick:nt,disabled:e||T,"data-testid":"stChatInputApproveButton","aria-label":"Submit recording",children:T?i.jsx(Fe,{size:"lg",iconValue:"spinner"}):i.jsx(V,{content:Oe,size:"lg",color:"inherit"})})]}):i.jsxs(i.Fragment,{children:[Q&&i.jsx(i.Fragment,{children:_?i.jsx(ce,{content:_,placement:de.TOP,error:!0,children:i.jsx(M,{onClick:ze,disabled:e||T,hasError:!0,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:i.jsx(V,{content:Ke,size:"xl",color:"inherit"})})}):i.jsx(M,{onClick:ze,disabled:e||T,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:i.jsx(V,{content:Pe,size:"xl",color:"inherit"})})}),i.jsx(M,{onClick:be,disabled:!I||e||T,"data-testid":"stChatInputSubmitButton","aria-label":"Send message",primary:!0,children:i.jsx(V,{content:We,size:"lg",color:"inherit"})})]})})]})]})})}const Br=r.memo(Er);export{Br as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{r as R,Q as Y}from"./index-nhNM5UeG.js";import{a as Re}from"./index-pi_S-NOw-DHRw2FEx.js";import"./withFullScreenWrapper-B-PKqZVg-DWJ8sEV7.js";import"./Toolbar-DencJ98c--L3IVNu_.js";import"./FormClearHelper-XrLdNEJa-DVEjd1cV.js";import"./moment-CU6QKNej-DcQX_LE0.js";import"./pandasStylerUtils-DlCnQunN-DDd07kWa.js";import"./numbro-CBbENDeu-C6X7Pww4.js";import"./_baseIndexOf-OsCSwRmV--aVpkM1d.js";import"./_baseAssignValue-D2hePX0_-CX8WO6Yp.js";import"./index-CVld_lKx-CBWAU0gM.js";import"./main-DD_nsVBV-B-nG1zNN.js";import"./toConsumableArray-CCohTQYb-ClE5WF0y.js";import"./possibleConstructorReturn-i7eTFBhJ-BnzuGOIJ.js";import"./createSuper-Csct9QVD-vLz3pY3G.js";import"./formatNumber-ep44bWil-jKcj-W8C.js";import"./sprintf-D5E86llw-6tzWM3a-.js";import"./formatMoment-DEtsTHwA-BeQagUzn.js";import"./checkbox-BCtTdZut-CgBE95kP.js";import"./createDownloadLinkElement-D-zJ1ZGH-MUElf4MM.js";import"./FileDownload.esm-B67hf_fm-CYQKuYJG.js";const je=Re("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function he(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var re;(function(e){e.event="event",e.props="prop"})(re||(re={}));function H(){}function Be(e){var t,r=void 0;return function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t&&n.length===t.length&&n.every(function(u,l){return u===t[l]})||(t=n,r=e.apply(void 0,n)),r}}function ae(e){return!!(e||"").match(/\d/)}function X(e){return e==null}function Fe(e){return typeof e=="number"&&isNaN(e)}function Se(e){return X(e)||Fe(e)||typeof e=="number"&&!isFinite(e)}function be(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Me(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function ke(e,t,r){var n=Me(r),a=e.search(/[1-9]/);return a=a===-1?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}function We(e){var t=R.useRef(e);t.current=e;var r=R.useRef(function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t.current.apply(t,n)});return r.current}function fe(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var a=e.split("."),u=a[0],l=a[1]||"";return{beforeDecimal:u,afterDecimal:l,hasNegation:r,addNegation:n}}function Ke(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return(t?"-":"")+n+(a?"."+a:"")}function ye(e,t,r){for(var n="",a=r?"0":"",u=0;u<=t-1;u++)n+=e[u]||a;return n}function de(e,t){return Array(t+1).join(e)}function Ve(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],u=n[1];if(u=Number(u),!u)return r+a;a=a.replace(".","");var l=1+u,g=a.length;return l<0?a="0."+de("0",Math.abs(l))+a:l>=g?a=a+de("0",l-g):a=(a.substring(0,l)||"0")+"."+a.substring(l),r+a}function me(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=fe(e),u=a.beforeDecimal,l=a.afterDecimal,g=a.hasNegation,h=parseFloat("0."+(l||"0")),S=l.length<=t?"0."+l:h.toFixed(t),p=S.split("."),v=u;u&&Number(p[0])&&(v=u.split("").reverse().reduce(function(O,E,m){return O.length>m?(Number(O[0])+Number(E)).toString()+O.substring(1,O.length):E+O},p[0]));var V=ye(p[1]||"",t,r),b=g?"-":"",c=n?".":"";return""+b+v+c+V}function $(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var we=Be(function(e,t){for(var r=0,n=0,a=e.length,u=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[u-1-n]&&u-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:u-n}}}),Le=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Pe(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function Ue(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function _e(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function qe(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,u,l){l===void 0&&(l=qe);var g=a.findIndex(function(K){return K}),h=e.slice(0,g);!t&&!r.startsWith(h)&&(t=h,r=h+r,n=n+h.length);for(var S=r.length,p=e.length,v={},V=new Array(S),b=0;b<S;b++){V[b]=-1;for(var c=0,O=p;c<O;c++){var E=l({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:b,formattedValueIndex:c});if(E&&v[c]!==!0){V[b]=c,v[c]=!0;break}}}for(var m=n;m<S&&(V[m]===-1||!u(r[m]));)m++;var j=m===S||V[m]===-1?p:V[m];for(m=n-1;m>0&&V[m]===-1;)m--;var B=m===-1||V[m]===-1?0:V[m]+1;return B>j?j:n-B<j-n?B:j}function ge(e,t,r,n){var a=e.length;if(t=Pe(t,0,a),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function He(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(ae(e[r])||ae(e[r-1]));return t}function xe(e,t,r,n,a,u){u===void 0&&(u=H);var l=We(function(c,O){var E,m;return Se(c)?(m="",E=""):typeof c=="number"||O?(m=typeof c=="number"?Ve(c):c,E=n(m)):(m=a(c,void 0),E=n(m)),{formattedValue:E,numAsString:m}}),g=R.useState(function(){return l(X(e)?t:e,r)}),h=g[0],S=g[1],p=function(c,O){c.formattedValue!==h.formattedValue&&S({formattedValue:c.formattedValue,numAsString:c.value}),u(c,O)},v=e,V=r;X(e)&&(v=h.numAsString,V=!0);var b=l(v,V);return R.useMemo(function(){S(b)},[b.formattedValue]),[h,p]}function Ze(e){return e.replace(/[^0-9]/g,"")}function Je(e){return e}function $e(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,a=e.renderText,u=e.getInputRef,l=e.format;l===void 0&&(l=Je);var g=e.removeFormatting;g===void 0&&(g=Ze);var h=e.defaultValue,S=e.valueIsNumericString,p=e.onValueChange,v=e.isAllowed,V=e.onChange;V===void 0&&(V=H);var b=e.onKeyDown;b===void 0&&(b=H);var c=e.onMouseUp;c===void 0&&(c=H);var O=e.onFocus;O===void 0&&(O=H);var E=e.onBlur;E===void 0&&(E=H);var m=e.value,j=e.getCaretBoundary;j===void 0&&(j=He);var B=e.isValidInputCharacter;B===void 0&&(B=ae);var K=e.isCharacterSame,M=he(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),Z=xe(m,h,!!S,l,g,p),L=Z[0],w=L.formattedValue,k=L.numAsString,J=Z[1],W=R.useRef(),U=R.useRef({formattedValue:w,numAsString:k}),_=function(o,i){U.current={formattedValue:o.formattedValue,numAsString:o.value},J(o,i)},z=R.useState(!1),ee=z[0],d=z[1],s=R.useRef(null),x=R.useRef({setCaretTimeout:null,focusTimeout:null});R.useEffect(function(){return d(!0),function(){clearTimeout(x.current.setCaretTimeout),clearTimeout(x.current.focusTimeout)}},[]);var A=l,C=function(o,i){var f=parseFloat(i);return{formattedValue:o,value:i,floatValue:isNaN(f)?void 0:f}},T=function(o,i,f){o.selectionStart===0&&o.selectionEnd===o.value.length||($(o,i),x.current.setCaretTimeout=setTimeout(function(){o.value===f&&o.selectionStart!==i&&$(o,i)},0))},I=function(o,i,f){return ge(o,i,j(o),f)},Q=function(o,i,f){var D=j(i),F=Ge(i,w,o,f,D,B,K);return F=ge(i,F,D),F},oe=function(o){var i=o.formattedValue;i===void 0&&(i="");var f=o.input,D=o.source,F=o.event,N=o.numAsString,y;if(f){var P=o.inputValue||f.value,q=ce(f);f.value=i,y=Q(P,i,q),y!==void 0&&T(f,y,i)}i!==w&&_(C(i,N),{event:F,source:D})};R.useEffect(function(){var o=U.current,i=o.formattedValue,f=o.numAsString;(w!==i||k!==f)&&_(C(w,k),{event:void 0,source:re.props})},[w,k]);var te=s.current?ce(s.current):void 0,ne=typeof window<"u"?R.useLayoutEffect:R.useEffect;ne(function(){var o=s.current;if(w!==U.current.formattedValue&&o){var i=Q(U.current.formattedValue,w,te);o.value=w,T(o,i,w)}},[w]);var ie=function(o,i,f){var D=i.target,F=W.current?Le(W.current,D.selectionEnd):we(w,o),N=Object.assign(Object.assign({},F),{lastValue:w}),y=g(o,N),P=A(y);if(y=g(P,void 0),v&&!v(C(P,y))){var q=i.target,G=ce(q),se=Q(o,w,G);return q.value=w,T(q,se,w),!1}return oe({formattedValue:P,numAsString:y,inputValue:o,event:i,source:f,input:i.target}),!0},le=function(o,i){i===void 0&&(i=0);var f=o.selectionStart,D=o.selectionEnd;W.current={selectionStart:f,selectionEnd:D+i}},Ne=function(o){var i=o.target,f=i.value,D=ie(f,o,re.event);D&&V(o),W.current=void 0},Oe=function(o){var i=o.target,f=o.key,D=i.selectionStart,F=i.selectionEnd,N=i.value;N===void 0&&(N="");var y;f==="ArrowLeft"||f==="Backspace"?y=Math.max(D-1,0):f==="ArrowRight"?y=Math.min(D+1,N.length):f==="Delete"&&(y=D);var P=0;f==="Delete"&&D===F&&(P=1);var q=f==="ArrowLeft"||f==="ArrowRight";if(y===void 0||D!==F&&!q){b(o),le(i,P);return}var G=y;if(q){var se=f==="ArrowLeft"?"left":"right";G=I(N,y,se),G!==y&&o.preventDefault()}else f==="Delete"&&!B(N[y])?G=I(N,y,"right"):f==="Backspace"&&!B(N[y])&&(G=I(N,y,"left"));G!==y&&T(i,G,N),b(o),le(i,P)},Ee=function(o){var i=o.target,f=function(){var D=i.selectionStart,F=i.selectionEnd,N=i.value;if(N===void 0&&(N=""),D===F){var y=I(N,D);y!==D&&T(i,y,N)}};f(),requestAnimationFrame(function(){f()}),c(o),le(i)},Te=function(o){o.persist&&o.persist();var i=o.target,f=o.currentTarget;s.current=i,x.current.focusTimeout=setTimeout(function(){var D=i.selectionStart,F=i.selectionEnd,N=i.value;N===void 0&&(N="");var y=I(N,D);y!==D&&!(D===0&&F===N.length)&&T(i,y,N),O(Object.assign(Object.assign({},o),{currentTarget:f}))},0)},Ae=function(o){s.current=null,clearTimeout(x.current.focusTimeout),clearTimeout(x.current.setCaretTimeout),E(o)},Ce=ee&&Ue()?"numeric":void 0,ve=Object.assign({inputMode:Ce},M,{type:t,value:w,onChange:Ne,onKeyDown:Oe,onMouseUp:Ee,onFocus:Te,onBlur:Ae});if(r==="text")return a?Y.createElement(Y.Fragment,null,a(w,M)||null):Y.createElement("span",Object.assign({},M,{ref:u}),w);if(n){var Ie=n;return Y.createElement(Ie,Object.assign({},ve,{ref:u}))}return Y.createElement("input",Object.assign({},ve,{ref:u}))}function pe(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;a===void 0&&(a="");var u=t.suffix;u===void 0&&(u="");var l=t.allowNegative,g=t.thousandsGroupStyle;if(g===void 0&&(g="thousand"),e===""||e==="-")return e;var h=ue(t),S=h.thousandSeparator,p=h.decimalSeparator,v=r!==0&&e.indexOf(".")!==-1||r&&n,V=fe(e,l),b=V.beforeDecimal,c=V.afterDecimal,O=V.addNegation;return r!==void 0&&(c=ye(c,r,!!n)),S&&(b=ke(b,S,g)),a&&(b=a+b),u&&(c=c+u),O&&(b="-"+b),e=b+(v&&p||"")+c,e}function ue(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function ze(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),u=n.test(e);return e=e.replace(/-/g,""),a&&!u&&t&&(e="-"+e),e}function Qe(e,t){return new RegExp("(^-)|[0-9]|"+be(e),"g")}function Ye(e,t,r){return e===""?!0:!t?.match(/\d/)&&!r?.match(/\d/)&&typeof e=="string"&&!isNaN(Number(e))}function Xe(e,t,r){var n;t===void 0&&(t=_e(e));var a=r.allowNegative,u=r.prefix;u===void 0&&(u="");var l=r.suffix;l===void 0&&(l="");var g=r.decimalScale,h=t.from,S=t.to,p=S.start,v=S.end,V=ue(r),b=V.allowedDecimalSeparators,c=V.decimalSeparator,O=e[v]===c;if(ae(e)&&(e===u||e===l)&&t.lastValue==="")return e;if(v-p===1&&b.indexOf(e[p])!==-1){var E=g===0?"":c;e=e.substring(0,p)+E+e.substring(p+1,e.length)}var m=function(s,x,A){var C=!1,T=!1;u.startsWith("-")?C=!1:s.startsWith("--")?(C=!1,T=!0):l.startsWith("-")&&s.length===l.length?C=!1:s[0]==="-"&&(C=!0);var I=C?1:0;return T&&(I=2),I&&(s=s.substring(I),x-=I,A-=I),{value:s,start:x,end:A,hasNegation:C}},j=m(e,p,v),B=j.hasNegation;n=j,e=n.value,p=n.start,v=n.end;var K=m(t.lastValue,h.start,h.end),M=K.start,Z=K.end,L=K.value,w=e.substring(p,v);e.length&&L.length&&(M>L.length-l.length||Z<u.length)&&!(w&&l.startsWith(w))&&(e=L);var k=0;e.startsWith(u)?k+=u.length:p<u.length&&(k=p),e=e.substring(k),v-=k;var J=e.length,W=e.length-l.length;e.endsWith(l)?J=W:(v>W||v>e.length-l.length)&&(J=v),e=e.substring(0,J),e=ze(B?"-"+e:e,a),e=(e.match(Qe(c))||[]).join("");var U=e.indexOf(c);e=e.replace(new RegExp(be(c),"g"),function(s,x){return x===U?".":""});var _=fe(e,a),z=_.beforeDecimal,ee=_.afterDecimal,d=_.addNegation;return S.end-S.start<h.end-h.start&&z===""&&O&&!parseFloat(ee)&&(e=d?"-":""),e}function et(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var a=Array.from({length:e.length+1}).map(function(){return!0}),u=e[0]==="-";a.fill(!1,0,r.length+(u?1:0));var l=e.length;return a.fill(!1,l-n.length+1,l+1),a}function tt(e){var t=ue(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var u=e.allowNegative;if(u===void 0&&(u=!0),r===n)throw new Error(`
|
|
2
|
-
Decimal separator can't be same as thousand separator.
|
|
3
|
-
thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
4
|
-
decimalSeparator: `+n+` (default value for decimalSeparator is .)
|
|
5
|
-
`);return a.startsWith("-")&&u&&(console.error(`
|
|
6
|
-
Prefix can't start with '-' when allowNegative is true.
|
|
7
|
-
prefix: `+a+`
|
|
8
|
-
allowNegative: `+u+`
|
|
9
|
-
`),u=!1),Object.assign(Object.assign({},e),{allowNegative:u})}function rt(e){e=tt(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,a=e.onKeyDown;a===void 0&&(a=H);var u=e.onBlur;u===void 0&&(u=H);var l=e.thousandSeparator,g=e.decimalScale,h=e.fixedDecimalScale,S=e.prefix;S===void 0&&(S="");var p=e.defaultValue,v=e.value,V=e.valueIsNumericString,b=e.onValueChange,c=he(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),O=ue(e),E=O.decimalSeparator,m=O.allowedDecimalSeparators,j=function(d){return pe(d,e)},B=function(d,s){return Xe(d,s,e)},K=X(v)?p:v,M=V??Ye(K,S,t);X(v)?X(p)||(M=M||typeof p=="number"):M=M||typeof v=="number";var Z=function(d){return Se(d)?d:(typeof d=="number"&&(d=Ve(d)),M&&typeof g=="number"?me(d,g,!!h):d)},L=xe(Z(v),Z(p),!!M,j,B,b),w=L[0],k=w.numAsString,J=w.formattedValue,W=L[1],U=function(d){var s=d.target,x=d.key,A=s.selectionStart,C=s.selectionEnd,T=s.value;if(T===void 0&&(T=""),(x==="Backspace"||x==="Delete")&&C<S.length){d.preventDefault();return}if(A!==C){a(d);return}x==="Backspace"&&T[0]==="-"&&A===S.length+1&&r&&$(s,1),g&&h&&(x==="Backspace"&&T[A-1]===E?($(s,A-1),d.preventDefault()):x==="Delete"&&T[A]===E&&d.preventDefault()),m?.includes(x)&&T[A]===E&&$(s,A+1);var I=l===!0?",":l;x==="Backspace"&&T[A-1]===I&&$(s,A-1),x==="Delete"&&T[A]===I&&$(s,A+1),a(d)},_=function(d){var s=k;if(s.match(/\d/g)||(s=""),n||(s=Ke(s)),h&&g&&(s=me(s,g,h)),s!==k){var x=pe(s,e);W({formattedValue:x,value:s,floatValue:parseFloat(s)},{event:d,source:re.event})}u(d)},z=function(d){return d===E?!0:ae(d)},ee=function(d){var s=d.currentValue,x=d.lastValue,A=d.formattedValue,C=d.currentValueIndex,T=d.formattedValueIndex,I=s[C],Q=A[T],oe=we(x,s),te=oe.to,ne=function(ie){return B(ie).indexOf(".")+S.length};return v===0&&h&&g&&s[te.start]===E&&ne(s)<C&&ne(A)>T?!1:C>=te.start&&C<te.end&&m&&m.includes(I)&&Q===E?!0:I===Q};return Object.assign(Object.assign({},c),{value:J,valueIsNumericString:!1,isValidInputCharacter:z,isCharacterSame:ee,onValueChange:W,format:j,removeFormatting:B,getCaretBoundary:function(d){return et(d,e)},onKeyDown:U,onBlur:_})}function at(e){var t=rt(e);return Y.createElement($e,Object.assign({},t))}function De(){return Intl.NumberFormat()?.formatToParts(1.1)?.find(e=>e.type==="decimal")?.value??"."}function nt(){return De()==="."?",":"."}const Ot=e=>{const{value:t,onChange:r,disabled:n,highlight:a,validatedSelection:u,fixedDecimals:l,allowNegative:g,thousandSeparator:h,decimalSeparator:S}=e,p=R.useRef();return R.useLayoutEffect(()=>{if(u!==void 0){const v=typeof u=="number"?[u,null]:u;p.current?.setSelectionRange(v[0],v[1])}},[u]),R.createElement(je,null,R.createElement(at,{autoFocus:!0,getInputRef:p,className:"gdg-input",onFocus:v=>v.target.setSelectionRange(a?0:v.target.value.length,v.target.value.length),disabled:n===!0,decimalScale:l,allowNegative:g,thousandSeparator:h??nt(),decimalSeparator:S??De(),value:Object.is(t,-0)?"-":t??"",onValueChange:r}))};export{Ot as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bR as a,bS as f,bT as c,a6 as l}from"./index-nhNM5UeG.js";function o(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t){if(e){if(typeof e=="string")return o(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function b(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(e)}function O(e,t){if(t&&(c(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}export{d as _,b,O as d,u as i,s as l,o as n,y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var k={},w;function v(){return w||(w=1,(function(h){(function(){var s={not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function u(n){return m(_(n),arguments)}function x(n,o){return u.apply(null,[n].concat(o||[]))}function m(n,o){var t=1,c=n.length,e,p="",a,i,r,f,g,y,b,l;for(a=0;a<c;a++)if(typeof n[a]=="string")p+=n[a];else if(typeof n[a]=="object"){if(r=n[a],r.keys)for(e=o[t],i=0;i<r.keys.length;i++){if(e==null)throw new Error(u('[sprintf] Cannot access property "%s" of undefined value "%s"',r.keys[i],r.keys[i-1]));e=e[r.keys[i]]}else r.param_no?e=o[r.param_no]:e=o[t++];if(s.not_type.test(r.type)&&s.not_primitive.test(r.type)&&e instanceof Function&&(e=e()),s.numeric_arg.test(r.type)&&typeof e!="number"&&isNaN(e))throw new TypeError(u("[sprintf] expecting number but found %T",e));switch(s.number.test(r.type)&&(b=e>=0),r.type){case"b":e=parseInt(e,10).toString(2);break;case"c":e=String.fromCharCode(parseInt(e,10));break;case"d":case"i":e=parseInt(e,10);break;case"j":e=JSON.stringify(e,null,r.width?parseInt(r.width):0);break;case"e":e=r.precision?parseFloat(e).toExponential(r.precision):parseFloat(e).toExponential();break;case"f":e=r.precision?parseFloat(e).toFixed(r.precision):parseFloat(e);break;case"g":e=r.precision?String(Number(e.toPrecision(r.precision))):parseFloat(e);break;case"o":e=(parseInt(e,10)>>>0).toString(8);break;case"s":e=String(e),e=r.precision?e.substring(0,r.precision):e;break;case"t":e=String(!!e),e=r.precision?e.substring(0,r.precision):e;break;case"T":e=Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),e=r.precision?e.substring(0,r.precision):e;break;case"u":e=parseInt(e,10)>>>0;break;case"v":e=e.valueOf(),e=r.precision?e.substring(0,r.precision):e;break;case"x":e=(parseInt(e,10)>>>0).toString(16);break;case"X":e=(parseInt(e,10)>>>0).toString(16).toUpperCase();break}s.json.test(r.type)?p+=e:(s.number.test(r.type)&&(!b||r.sign)?(l=b?"+":"-",e=e.toString().replace(s.sign,"")):l="",g=r.pad_char?r.pad_char==="0"?"0":r.pad_char.charAt(1):" ",y=r.width-(l+e).length,f=r.width&&y>0?g.repeat(y):"",p+=r.align?l+e+f:g==="0"?l+f+e:f+l+e)}return p}var d=Object.create(null);function _(n){if(d[n])return d[n];for(var o=n,t,c=[],e=0;o;){if((t=s.text.exec(o))!==null)c.push(t[0]);else if((t=s.modulo.exec(o))!==null)c.push("%");else if((t=s.placeholder.exec(o))!==null){if(t[2]){e|=1;var p=[],a=t[2],i=[];if((i=s.key.exec(a))!==null)for(p.push(i[1]);(a=a.substring(i[0].length))!=="";)if((i=s.key_access.exec(a))!==null)p.push(i[1]);else if((i=s.index_access.exec(a))!==null)p.push(i[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");t[2]=p}else e|=2;if(e===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");c.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");o=o.substring(t[0].length)}return d[n]=c}h.sprintf=u,h.vsprintf=x,typeof window<"u"&&(window.sprintf=u,window.vsprintf=x)})()})(k)),k}var S=v();export{S as _};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{y as o,cq as t,cr as a}from"./index-nhNM5UeG.js";const g=o("div",{target:"e1ipygm11"})({name:"1ucqwki",styles:"position:absolute;top:50%;right:2.05em"}),s=o(a,{shouldForwardProp:t,target:"e1ipygm10"})(({theme:i,$isHighlighted:e})=>({paddingRight:i.spacing.lg,paddingLeft:i.spacing.lg,paddingTop:i.spacing.sm,paddingBottom:i.spacing.sm,background:e?i.colors.darkenedBgMix15:void 0,"&:hover, &:active, &:focus-visible":{background:i.colors.darkenedBgMix15}}),"");export{s as g,g as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bf as n}from"./index-nhNM5UeG.js";var o=0;function f(r){var t=++o;return n(r)+t}export{f as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,j as c}from"./index-nhNM5UeG.js";import{m as s}from"./FormClearHelper-XrLdNEJa-DVEjd1cV.js";function M({getStateFromWidgetMgr:f,getDefaultState:a,updateWidgetMgrState:l,element:t,widgetMgr:e,fragmentId:m,onFormCleared:n}){const[d,i]=o.useState(()=>f(e,t)??a(e,t)),[g,r]=o.useState({value:d,fromUi:!1});o.useEffect(()=>{c(g)||(r(null),i(g.value),l(t,e,g,m))},[g,l,t,e,m]);const u=o.useCallback(()=>{r({value:a(e,t),fromUi:!0}),n?.()},[r,t,a,e,n]);return s({widgetMgr:e,element:t,onFormCleared:u}),[d,r]}function C({getStateFromWidgetMgr:f,getDefaultStateFromProto:a,getCurrStateFromProto:l,updateWidgetMgrState:t,element:e,widgetMgr:m,fragmentId:n,onFormCleared:d}){const i=o.useCallback((u,S)=>a(S),[a]),[g,r]=M({getStateFromWidgetMgr:f,getDefaultState:i,updateWidgetMgrState:t,element:e,widgetMgr:m,fragmentId:n,onFormCleared:d});return o.useEffect(()=>{e.setValue&&(e.setValue=!1,r({value:l(e),fromUi:!1}))},[e,l,r]),[g,r]}export{C as S,M as U};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{L as A,r as u,br as g,bs as F,bY as R,c4 as _,c5 as C}from"./index-nhNM5UeG.js";import{A as z,D as I,V as D,t as B}from"./base-input-BPl9JMAl-yC1GT4Gd.js";function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?w(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v=g("div",function(e){return l(l({},z(l(l({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})});v.displayName="StyledTextAreaRoot";v.displayName="StyledTextAreaRoot";var O=g("div",function(e){return I(l({$positive:!1},e))});O.displayName="StyledTextareaContainer";O.displayName="StyledTextareaContainer";var j=g("textarea",function(e){return l(l({},D(e)),{},{resize:e.$resize||"none"})});j.displayName="StyledTextarea";j.displayName="StyledTextarea";function h(e){"@babel/helpers - typeof";return h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(e)}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y.apply(this,arguments)}function k(e,t){return K(e)||U(e,t)||q(e,t)||L()}function L(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q(e,t){if(e){if(typeof e=="string")return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(e,t)}}function S(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function U(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,s;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(c){a=!0,s=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function K(e){if(Array.isArray(e))return e}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e,t,r){return t&&V(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Z(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},m(e,t)}function G(e){var t=Q();return function(){var r=b(e),n;if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return J(this,n)}}function J(e,t){if(t&&(h(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Q(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},b(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var W=(function(e){Z(r,e);var t=G(r);function r(){var n;M(this,r);for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=t.call.apply(t,[this].concat(a)),p(f(n),"state",{isFocused:n.props.autoFocus||!1}),p(f(n),"onFocus",function(s){n.setState({isFocused:!0}),n.props.onFocus(s)}),p(f(n),"onBlur",function(s){n.setState({isFocused:!1}),n.props.onBlur(s)}),n}return Y(r,[{key:"render",value:function(){var n=this.props.overrides,o=n===void 0?{}:n,a=F(o.Root,v),i=k(a,2),s=i[0],c=i[1],d=R({Input:{component:j},InputContainer:{component:O}},o);return u.createElement(s,y({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},c),u.createElement(B,y({},this.props,{type:C.textarea,overrides:d,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}]),r})(u.Component);p(W,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:_.default});const X=6.5,P=1,ee=e=>{let t=0;const{current:r}=e;return r&&(r.style.height="auto",t=r.scrollHeight,r.style.height=""),t},te=(e,t,r)=>e>0&&r.current?Math.abs(e-t)>P:!1,re=(e,t)=>{if(e.current&&t.current){const{offsetHeight:r}=e.current;t.current.minHeight=r,t.current.maxHeight=r*X}},ne=(e,t,r)=>e?`${t+P}px`:r?String(r):"",oe=e=>e?`${e}px`:"",ue=({textareaRef:e,dependencies:t=[]})=>{const r=A(),n=u.useRef({minHeight:0,maxHeight:0}),[o,a]=u.useState(0),[i,s]=u.useState(!1),c=u.useCallback(()=>{a(ee(e))},[e,a]),d=u.useCallback(()=>{a(0)},[a]);u.useLayoutEffect(()=>{e.current&&re(e,n)},[e]),u.useLayoutEffect(()=>{const{minHeight:H}=n.current;s(te(o,H,e))},[o,e]),u.useLayoutEffect(()=>{c()},[e,c,...t]);const{maxHeight:x}=n.current,E=r.sizes.minElementHeight,$=ne(i,o,E),T=oe(x);return{isExtended:i,height:$,maxHeight:T,updateScrollHeight:c,clearScrollHeight:d}};export{ue as p,W as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{L as $,r as i,bG as j,ar as Q,bH as M}from"./index-nhNM5UeG.js";async function X(c,e=16e3){if(!c||c.size===0)throw new Error("Invalid or empty blob provided");if(!window.AudioContext)throw new Error("AudioContext not supported in this browser");const n=new AudioContext;try{const s=await c.arrayBuffer(),r=await n.decodeAudioData(s),o=e??r.sampleRate,u=await Y(r,o);return Z(u,o)}finally{n.close()}}async function Y(c,e){const{duration:n,numberOfChannels:s,sampleRate:r}=c,o=Math.ceil(n*e);if(!window.OfflineAudioContext)throw new Error("OfflineAudioContext not supported");const u=new OfflineAudioContext(1,o,e),y=u.createBufferSource();if(y.buffer=c,s>1){const v=u.createChannelSplitter(s),p=u.createChannelMerger(1);y.connect(v);for(let l=0;l<s;l++){const d=u.createGain();d.gain.value=1/s,v.connect(d,l),d.connect(p,0,0)}p.connect(u.destination)}else y.connect(u.destination);y.start(0);try{return await u.startRendering()}catch(v){throw new Error(`Failed to resample audio from ${r}Hz to ${e}Hz: ${v instanceof Error?v.message:String(v)}`)}}function Z(c,e){const n=c.length,s=n*2+44,r=new ArrayBuffer(s),o=new DataView(r),u=c.getChannelData(0),y=(p,l)=>{for(let d=0;d<l.length;d++)o.setUint8(p+d,l.charCodeAt(d))};y(0,"RIFF"),o.setUint32(4,s-8,!0),y(8,"WAVE"),y(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,e,!0),o.setUint32(28,e*2,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),y(36,"data"),o.setUint32(40,n*2,!0);let v=44;for(let p=0;p<n;p++){const l=Math.max(-1,Math.min(1,u[p]));o.setInt16(v,l*32767,!0),v+=2}return new Blob([r],{type:"audio/wav"})}class _{constructor(){this.wavesurfer=null,this.currentBlobUrl=null,this.events={},this.isPlaying=!1}initialize(e){this.wavesurfer=e,this.setupEventListeners()}setupEventListeners(){this.wavesurfer&&(this.teardownEventListeners(),this.handleTimeUpdate=e=>{this.events.onTimeUpdate?.(e*1e3)},this.handlePause=()=>{this.isPlaying=!1,this.events.onPause?.()},this.handlePlay=()=>{this.isPlaying=!0,this.events.onPlay?.()},this.handleFinish=()=>{this.isPlaying=!1,this.events.onFinish?.()},this.handleReady=()=>{this.events.onReady?.()},this.handleError=e=>{const n=e instanceof Error?e:new Error(String(e));this.events.onError?.(n)},this.wavesurfer.on("timeupdate",this.handleTimeUpdate),this.wavesurfer.on("pause",this.handlePause),this.wavesurfer.on("play",this.handlePlay),this.wavesurfer.on("finish",this.handleFinish),this.wavesurfer.on("ready",this.handleReady),this.wavesurfer.on("error",this.handleError))}setEventHandlers(e){this.events=e}async load(e){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");this.cleanupPreviousUrl();let n,s=null;try{if(e instanceof Blob)s=URL.createObjectURL(e),n=s;else if(e instanceof ArrayBuffer){const r=new Blob([e]);s=URL.createObjectURL(r),n=s}else n=e;this.currentBlobUrl=s,await this.wavesurfer.load(n)}catch(r){throw this.cleanupPreviousUrl(),r}}async play(){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");await this.wavesurfer.play()}pause(){this.wavesurfer&&this.wavesurfer.pause()}getDuration(){return this.wavesurfer?this.wavesurfer.getDuration()*1e3:0}getCurrentTime(){return this.wavesurfer?this.wavesurfer.getCurrentTime()*1e3:0}getIsPlaying(){return this.isPlaying}seekToStart(){this.wavesurfer&&this.wavesurfer.seekTo(0)}cleanupPreviousUrl(){this.currentBlobUrl&&(URL.revokeObjectURL(this.currentBlobUrl),this.currentBlobUrl=null)}destroy(){this.pause(),this.cleanupPreviousUrl(),this.wavesurfer&&(this.teardownEventListeners(),this.wavesurfer.empty(),this.wavesurfer=null),this.events={},this.isPlaying=!1,this.handleTimeUpdate=void 0,this.handlePause=void 0,this.handlePlay=void 0,this.handleFinish=void 0,this.handleReady=void 0,this.handleError=void 0}teardownEventListeners(){this.wavesurfer&&(this.handleTimeUpdate&&(this.wavesurfer.un("timeupdate",this.handleTimeUpdate),this.handleTimeUpdate=void 0),this.handlePause&&(this.wavesurfer.un("pause",this.handlePause),this.handlePause=void 0),this.handlePlay&&(this.wavesurfer.un("play",this.handlePlay),this.handlePlay=void 0),this.handleFinish&&(this.wavesurfer.un("finish",this.handleFinish),this.handleFinish=void 0),this.handleReady&&(this.wavesurfer.un("ready",this.handleReady),this.handleReady=void 0),this.handleError&&(this.wavesurfer.un("error",this.handleError),this.handleError=void 0))}}function F(c){return c.name==="NotAllowedError"||c.name==="PermissionDeniedError"||c.message?.toLowerCase().includes("permission denied")}class q{constructor(e={}){this.wavesurfer=null,this.recordPlugin=null,this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null,this.events={},this.options=e}initialize(e,n){this.wavesurfer=e;try{const s={renderRecordedAudio:!1,mimeType:"audio/webm"};this.recordPlugin=e.registerPlugin(n.create(s)),this.setupEventListeners()}catch(s){const r=s instanceof Error?s:new Error(String(s));throw F(r)?(this.events.onPermissionDenied?.(),new Error("Microphone permission denied")):(this.events.onError?.(r),r)}}setupEventListeners(){this.recordPlugin&&(this.recordPlugin.on("record-start",()=>{this.isRecording=!0,this.events.onRecordStart?.()}),this.recordPlugin.on("record-end",e=>{this.isRecording=!1,this.events.onRecordEnd?.(e),this.recordEndResolve&&e&&e.size>0?(this.recordEndResolve(e),this.recordEndResolve=null,this.recordEndReject=null):this.recordEndReject?(this.recordEndReject(new Error("Invalid or empty recording")),this.recordEndResolve=null,this.recordEndReject=null):(this.recordEndResolve=null,this.recordEndReject=null)}),this.recordPlugin.on("record-progress",e=>{this.events.onRecordProgress?.(e)}))}setEventHandlers(e){this.events=e}async startRecording(){if(!this.recordPlugin)throw new Error("Record plugin not initialized");if(this.isRecording)return;const e=typeof this.options.sampleRate=="number"?this.options.sampleRate:void 0,n={};e!==void 0&&(n.sampleRate={ideal:e}),await this.startRecordingWithConstraints(n,e!==void 0)}async startRecordingWithConstraints(e,n){if(!this.recordPlugin)throw new Error("Record plugin not initialized");try{const s=Object.keys(e).length?e:void 0;await this.recordPlugin.startRecording(s)}catch(s){const r=s instanceof Error?s:new Error(String(s));if(F(r))throw this.events.onPermissionDenied?.(),new Error("Microphone permission denied");if(n&&(r.name==="OverconstrainedError"||r.name==="NotReadableError")){this.options.sampleRate=void 0,await this.startRecordingWithConstraints({},!1);return}throw this.events.onError?.(r),r}}async stopRecording(){if(!this.recordPlugin||!this.isRecording)throw new Error("Not currently recording");try{return await new Promise((e,n)=>{this.recordEndResolve=e,this.recordEndReject=n,this.recordPlugin?.stopRecording()})}catch(e){const n=e instanceof Error?e:new Error(String(e));throw this.events.onError?.(n),n}}cancelRecording(){this.recordPlugin&&this.isRecording&&(this.recordPlugin.stopRecording(),this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null)}destroy(){this.cancelRecording(),this.recordPlugin&&(this.recordPlugin.destroy(),this.recordPlugin=null),this.wavesurfer=null,this.events={}}}const J=4,K=4,ee=8,re=0,te=16e3;function se({containerRef:c,sampleRate:e,events:n,waveformPadding:s=0}){const r=$(),[o,u]=i.useState("idle"),[y,v]=i.useState(null),[p,l]=i.useState(!1),d=i.useRef(null),g=i.useRef(null),a=i.useRef(null),h=i.useRef(n),z=i.useRef(!1),A=i.useRef(!1),E=i.useRef(new Set),P=i.useRef(!1),b=e===void 0?te:e,k=i.useCallback(()=>{E.current.clear(),l(!1),g.current&&(g.current.destroy(),g.current=null),a.current&&(a.current.destroy(),a.current=null),d.current&&(d.current.destroy(),d.current=null),z.current=!1,P.current=!1,u("idle"),v(null)},[]),L=i.useCallback(()=>{const t=Array.from(E.current);E.current.clear(),t.forEach(f=>{f.resolve()})},[]),O=i.useCallback(t=>{l(!1);const f=Array.from(E.current);E.current.clear(),f.forEach(w=>{w.reject(t)})},[]),U=i.useCallback(t=>{const f={onPlay:()=>{l(!0),h.current.onPlaybackPlay?.()},onPause:()=>{l(!1),h.current.onPlaybackPause?.()},onFinish:()=>{l(!1),h.current.onPlaybackFinish?.()},onReady:()=>{L()},onError:w=>{l(!1),O(w),h.current.onError?.(w)}};t.setEventHandlers(f)},[L,O]);i.useEffect(()=>{h.current=n,a.current&&U(a.current)},[n,U]);const T=i.useCallback(async()=>{if(!(z.current||A.current||!c.current)){A.current=!0;try{const[t,f]=await Promise.all([j(()=>import("./wavesurfer.esm-idh1jvYE-D4Wwdy60.js"),[]),j(()=>import("./record-CvRL89xC-Cpipd1Kv.js"),[])]),w=t.default,S=f.default,C=w.create({container:c.current,waveColor:r.colors.primary,progressColor:r.colors.bodyText,height:s>0?Q(r.sizes.largestElementHeight)-2*s:"auto",barWidth:J,barGap:K,barRadius:ee,cursorWidth:re,interact:!0});d.current=C,P.current=!1;const m=new q({sampleRate:b});m.initialize(C,S),m.setEventHandlers({onRecordProgress:B=>{h.current.onProgressMs?.(B)},onPermissionDenied:()=>{h.current.onPermissionDenied(),u("idle")},onError:B=>{h.current.onError(B),u("idle")}}),g.current=m;const R=new _;R.initialize(C),a.current=R,U(R),z.current=!0}catch(t){const f=t instanceof Error?t:new Error(String(t));h.current.onError?.(f)}finally{A.current=!1}}},[c,r,b,U,s]);i.useEffect(()=>(T(),()=>{k()}),[k,T]),i.useEffect(()=>{const t=d.current;if(t){if(o==="recording"){t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary});return}if(P.current){t.setOptions({interact:!0,waveColor:M(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText});return}t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.bodyText})}},[o,r.colors.bodyText,r.colors.fadedText40,r.colors.primary,r.colors.secondaryBg]);const H=i.useCallback(async()=>{if(o!=="recording"){if(z.current||await T(),!g.current)throw new Error("Record backend not initialized");d.current&&d.current.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary}),P.current=!1,await g.current.startRecording(),u("recording"),v(null),l(!1),h.current.onRecordStart?.()}},[o,T,r.colors.primary]),D=i.useCallback(()=>{a.current&&d.current&&(a.current.destroy(),a.current=new _,a.current.initialize(d.current),E.current.clear(),l(!1),U(a.current)),P.current=!1},[U]),x=i.useCallback(()=>{a.current?.seekToStart(),l(!1),P.current=!0,d.current&&d.current.setOptions({interact:!0,waveColor:M(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText})},[r.colors.bodyText,r.colors.fadedText40,r.colors.secondaryBg]),I=i.useCallback(async()=>{if(o!=="recording")throw new Error("Not currently recording");if(!g.current||!a.current)throw new Error("Backends not initialized");try{const t=await g.current.stopRecording();v(t),await new Promise((S,C)=>{if(!a.current){C(new Error("Player not initialized"));return}const m={resolve:()=>{E.current.delete(m),S()},reject:R=>{E.current.delete(m),C(R)}};E.current.add(m),a.current.load(t).catch(R=>{E.current.delete(m),C(R instanceof Error?R:new Error(String(R)))})}),u("idle"),l(!1),x();const f={durationMs:a.current?.getDuration()??0,sampleRate:typeof b=="number"?b:null,mimeType:t.type||"audio/webm",size:t.size},w={blob:t,meta:f};return h.current.onRecordReady?.(t),w}catch(t){const f=t instanceof Error?t:new Error(String(t));return l(!1),u("idle"),h.current.onError(f),{blob:new Blob,meta:{durationMs:0,sampleRate:null,mimeType:"audio/webm",size:0}}}},[o,x,b]),W=i.useCallback(async t=>{const f=t??y;if(!f){const w=new Error("No recorded audio to approve");h.current.onError(w);return}try{const w=await X(f,b);await h.current.onApprove?.(w),v(null),u("idle")}catch(w){const S=w instanceof Error?w:new Error(String(w));h.current.onError(S)}},[y,b]),N=i.useCallback(()=>{o==="recording"&&g.current?.cancelRecording(),D(),v(null),u("idle"),l(!1),P.current=!1,h.current.onCancel?.()},[o,D]),V=i.useMemo(()=>({isPlaying:()=>a.current?.getIsPlaying()??!1,play:async()=>{if(!a.current)throw new Error("Player not initialized");await a.current.play()},pause:()=>{a.current?.pause()},load:async t=>{if(z.current||await T(),!a.current)throw new Error("Player not initialized");await a.current.load(t),x()},getCurrentTimeMs:()=>a.current?.getCurrentTime()??0,getDurationMs:()=>a.current?.getDuration()??0}),[x,T]),G=i.useCallback(t=>{h.current=t},[]);return i.useEffect(()=>()=>{k()},[k]),{state:o,isPlaybackPlaying:p,mountRef:c,start:H,stop:I,approve:W,cancel:N,destroy:k,playback:V,setEventHandlers:G}}export{se as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bk as o,H as r,k as t,ai as c}from"./index-nhNM5UeG.js";const l=s=>{const e=a=>{const{width:i,elementRef:n}=r();return t.jsx(c,{ref:n,children:t.jsx(s,{...a,width:i})})};return e.displayName=`withCalculatedWidth(${s.displayName||s.name})`,o(e,s)};export{l as o};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bk as p,k as c,r as n,L as f,H as h,y as x,bl as g,bm as y}from"./index-nhNM5UeG.js";const m=n.createContext(null);m.displayName="ElementFullscreenContext";const C=x("div",{target:"elp1w7k0"})(({theme:e,isExpanded:t})=>({width:"100%",height:"100%",...t?{position:"fixed",top:0,left:0,bottom:0,right:0,background:e.colors.bgColor,zIndex:e.zIndices.fullscreenWrapper,padding:e.spacing.md,paddingTop:e.sizes.fullScreenHeaderHeight,overflow:"auto",display:"flex",alignItems:"center",justifyContent:"center"}:{}}),""),b=()=>{const{setFullScreen:e}=n.useContext(g),[t,s]=n.useState(!1),{fullHeight:d,fullWidth:i}=y(),o=n.useCallback(a=>{s(a),e(a)},[e]),r=n.useCallback(()=>{document.body.style.overflow="hidden",o(!0)},[o]),l=n.useCallback(()=>{document.body.style.overflow="unset",o(!1)},[o]),u=n.useCallback(a=>{a.keyCode===27&&t&&l()},[l,t]);return n.useEffect(()=>(document.addEventListener("keydown",u,!1),()=>{document.removeEventListener("keydown",u,!1)}),[u]),n.useMemo(()=>({expanded:t,zoomIn:r,zoomOut:l,fullHeight:d,fullWidth:i}),[t,r,l,d,i])},w=({children:e})=>{const t=f(),{expanded:s,fullHeight:d,fullWidth:i,zoomIn:o,zoomOut:r}=b(),{width:l,elementRef:u}=h(),a=n.useMemo(()=>({width:s?i:l,height:s?d:void 0,expanded:s,expand:o,collapse:r}),[s,d,i,l,o,r]);return c.jsx(m.Provider,{value:a,children:c.jsx(C,{ref:u,isExpanded:s,"data-testid":"stFullScreenFrame",theme:t,children:e})})};function v(e){const t=s=>c.jsx(w,{children:c.jsx(e,{...s})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,p(t,e)}export{m as d,v};
|
|
Binary file
|