streamlit-nightly 1.53.2.dev20260127__py3-none-any.whl → 1.53.2.dev20260131__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/config.py +14 -2
- streamlit/config_util.py +63 -8
- streamlit/elements/deck_gl_json_chart.py +5 -1
- streamlit/elements/lib/built_in_chart_utils.py +24 -4
- streamlit/elements/lib/color_util.py +20 -1
- streamlit/elements/vega_charts.py +24 -4
- streamlit/proto/Alert_pb2.py +2 -3
- streamlit/proto/AppPage_pb2.py +2 -3
- streamlit/proto/ArrowData_pb2.py +2 -3
- streamlit/proto/ArrowNamedDataSet_pb2.py +2 -3
- streamlit/proto/ArrowVegaLiteChart_pb2.py +2 -3
- streamlit/proto/Arrow_pb2.py +11 -18
- streamlit/proto/Arrow_pb2.pyi +1 -42
- streamlit/proto/AudioInput_pb2.py +2 -3
- streamlit/proto/Audio_pb2.py +2 -3
- streamlit/proto/AuthRedirect_pb2.py +2 -3
- streamlit/proto/AutoRerun_pb2.py +2 -3
- streamlit/proto/BackMsg_pb2.py +2 -3
- streamlit/proto/Balloons_pb2.py +2 -3
- streamlit/proto/BidiComponent_pb2.py +2 -3
- streamlit/proto/Block_pb2.py +36 -43
- streamlit/proto/Block_pb2.pyi +3 -48
- streamlit/proto/BokehChart_pb2.py +2 -3
- streamlit/proto/ButtonGroup_pb2.py +2 -3
- streamlit/proto/ButtonLikeIconPosition_pb2.py +2 -3
- streamlit/proto/Button_pb2.py +3 -6
- streamlit/proto/Button_pb2.pyi +1 -18
- streamlit/proto/CameraInput_pb2.py +2 -3
- streamlit/proto/ChatInput_pb2.py +5 -8
- streamlit/proto/ChatInput_pb2.pyi +1 -17
- streamlit/proto/Checkbox_pb2.py +2 -3
- streamlit/proto/ClientState_pb2.py +2 -3
- streamlit/proto/Code_pb2.py +3 -6
- streamlit/proto/Code_pb2.pyi +1 -18
- streamlit/proto/ColorPicker_pb2.py +2 -3
- streamlit/proto/Common_pb2.py +7 -8
- streamlit/proto/Common_pb2.pyi +2 -10
- streamlit/proto/Components_pb2.py +2 -3
- streamlit/proto/DateInput_pb2.py +2 -3
- streamlit/proto/DateTimeInput_pb2.py +2 -3
- streamlit/proto/DeckGlJsonChart_pb2.py +5 -12
- streamlit/proto/DeckGlJsonChart_pb2.pyi +1 -54
- streamlit/proto/Delta_pb2.py +4 -6
- streamlit/proto/Delta_pb2.pyi +5 -14
- streamlit/proto/DocString_pb2.py +2 -3
- streamlit/proto/DownloadButton_pb2.py +2 -3
- streamlit/proto/Element_pb2.py +4 -7
- streamlit/proto/Element_pb2.pyi +3 -23
- streamlit/proto/Empty_pb2.py +2 -3
- streamlit/proto/Exception_pb2.py +2 -3
- streamlit/proto/Favicon_pb2.py +2 -3
- streamlit/proto/FileUploader_pb2.py +2 -3
- streamlit/proto/ForwardMsg_pb2.py +12 -18
- streamlit/proto/ForwardMsg_pb2.pyi +4 -48
- streamlit/proto/GapSize_pb2.py +2 -3
- streamlit/proto/GitInfo_pb2.py +2 -3
- streamlit/proto/GraphVizChart_pb2.py +3 -6
- streamlit/proto/GraphVizChart_pb2.pyi +1 -18
- streamlit/proto/Heading_pb2.py +2 -3
- streamlit/proto/HeightConfig_pb2.py +2 -3
- streamlit/proto/Html_pb2.py +2 -3
- streamlit/proto/IFrame_pb2.py +3 -10
- streamlit/proto/IFrame_pb2.pyi +1 -42
- streamlit/proto/Image_pb2.py +3 -6
- streamlit/proto/Image_pb2.pyi +1 -18
- streamlit/proto/Json_pb2.py +2 -3
- streamlit/proto/LabelVisibilityMessage_pb2.py +2 -3
- streamlit/proto/LinkButton_pb2.py +2 -3
- streamlit/proto/Logo_pb2.py +2 -3
- streamlit/proto/Markdown_pb2.py +2 -3
- streamlit/proto/Metric_pb2.py +2 -3
- streamlit/proto/MetricsEvent_pb2.py +2 -3
- streamlit/proto/MultiSelect_pb2.py +3 -6
- streamlit/proto/MultiSelect_pb2.pyi +1 -11
- streamlit/proto/Navigation_pb2.py +2 -3
- streamlit/proto/NewSession_pb2.py +27 -26
- streamlit/proto/NewSession_pb2.pyi +24 -12
- streamlit/proto/NumberInput_pb2.py +2 -3
- streamlit/proto/PageConfig_pb2.py +2 -3
- streamlit/proto/PageInfo_pb2.py +2 -3
- streamlit/proto/PageLink_pb2.py +2 -3
- streamlit/proto/PageNotFound_pb2.py +2 -3
- streamlit/proto/PageProfile_pb2.py +2 -3
- streamlit/proto/ParentMessage_pb2.py +2 -3
- streamlit/proto/PlotlyChart_pb2.py +5 -10
- streamlit/proto/PlotlyChart_pb2.pyi +1 -58
- streamlit/proto/Progress_pb2.py +2 -3
- streamlit/proto/Radio_pb2.py +3 -6
- streamlit/proto/Radio_pb2.pyi +2 -19
- streamlit/proto/RootContainer_pb2.py +2 -3
- streamlit/proto/Selectbox_pb2.py +3 -6
- streamlit/proto/Selectbox_pb2.pyi +2 -19
- streamlit/proto/SessionEvent_pb2.py +2 -3
- streamlit/proto/SessionStatus_pb2.py +2 -3
- streamlit/proto/Skeleton_pb2.py +2 -3
- streamlit/proto/Slider_pb2.py +2 -3
- streamlit/proto/Snow_pb2.py +2 -3
- streamlit/proto/Space_pb2.py +2 -3
- streamlit/proto/Spinner_pb2.py +2 -3
- streamlit/proto/TextAlignmentConfig_pb2.py +2 -3
- streamlit/proto/TextArea_pb2.py +3 -6
- streamlit/proto/TextArea_pb2.pyi +1 -18
- streamlit/proto/TextInput_pb2.py +2 -3
- streamlit/proto/Text_pb2.py +2 -3
- streamlit/proto/TimeInput_pb2.py +2 -3
- streamlit/proto/Toast_pb2.py +2 -3
- streamlit/proto/Transient_pb2.py +2 -3
- streamlit/proto/Video_pb2.py +2 -3
- streamlit/proto/WidgetStates_pb2.py +2 -3
- streamlit/proto/WidthConfig_pb2.py +2 -3
- streamlit/proto/openmetrics_data_model_pb2.py +2 -3
- streamlit/runtime/app_session.py +19 -0
- streamlit/runtime/runtime.py +0 -4
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +296 -296
- streamlit/static/static/js/{ErrorOutline.esm.DiaGWPsE.js → ErrorOutline.esm.DC6KVDKK.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.D-Qgpk5d.js → FileDownload.esm.Z9hRQIHi.js} +1 -1
- streamlit/static/static/js/{FileHelper.DmtDDGp0.js → FileHelper.DqvW90pm.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.BM3uDLnU.js → FormClearHelper.DTFnX0js.js} +1 -1
- streamlit/static/static/js/{InputInstructions.B2YZ5Lle.js → InputInstructions.CdzsN_Va.js} +1 -1
- streamlit/static/static/js/{Particles.BzfZrl-0.js → Particles.12xFSjcn.js} +1 -1
- streamlit/static/static/js/{ProgressBar.DWErD3j3.js → ProgressBar.Dg-oMbWg.js} +1 -1
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.DB31rUPf.js → StreamlitSyntaxHighlighter.rbzmcipw.js} +1 -1
- streamlit/static/static/js/{TableChart.esm.D3oUYYYd.js → TableChart.esm.CzJtGIR-.js} +1 -1
- streamlit/static/static/js/{Toolbar.CPyjMABY.js → Toolbar.COH7NaOE.js} +1 -1
- streamlit/static/static/js/{WidgetLabelHelpIconInline.C1NBCx-y.js → WidgetLabelHelpIconInline.Dlc8f0Ji.js} +1 -1
- streamlit/static/static/js/{base-input.C_CrNgNd.js → base-input.Q-zJLgRK.js} +4 -4
- streamlit/static/static/js/{checkbox.S6O8DPFl.js → checkbox.BKgWNdeI.js} +1 -1
- streamlit/static/static/js/{createDownloadLinkElement.B-5tIJBw.js → createDownloadLinkElement.6oO-YlYv.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.BW5aAEJN.js → data-grid-overlay-editor.CO0xdNiG.js} +1 -1
- streamlit/static/static/js/{downloader.BswLlj7p.js → downloader.BBXcXdX1.js} +1 -1
- streamlit/static/static/js/{embed.QjYZXbaW.js → embed.CJzOXYBF.js} +1 -1
- streamlit/static/static/js/{es6.Dm_kl6Cp.js → es6.CdxPQzwJ.js} +2 -2
- streamlit/static/static/js/{formatNumber.CH39oSMw.js → formatNumber.DB5irY8c.js} +1 -1
- streamlit/static/static/js/{iconPosition.Dp9f2jam.js → iconPosition.BVScIr6G.js} +1 -1
- streamlit/static/static/js/{iframeResizer.contentWindow.DOprY46-.js → iframeResizer.contentWindow.D_QHVqPM.js} +1 -1
- streamlit/static/static/js/{index.CAzk7fUP.js → index.6DFY6LUF.js} +1 -1
- streamlit/static/static/js/{index.BBVcEzWu.js → index.B80gSxrS.js} +1 -1
- streamlit/static/static/js/{index.6UQ__fP7.js → index.BDtN2n7T.js} +1 -1
- streamlit/static/static/js/{index.BYjec3-R.js → index.BED2_zc7.js} +1 -1
- streamlit/static/static/js/{index.DMwRlpNi.js → index.BQnLeHnr.js} +1 -1
- streamlit/static/static/js/{index.s9zpEF8P.js → index.BSYebegS.js} +1 -1
- streamlit/static/static/js/{index.6OwBTJdz.js → index.BSpYHDvk.js} +1 -1
- streamlit/static/static/js/{index.BUbgW8RJ.js → index.BiCbrx53.js} +1 -1
- streamlit/static/static/js/{index.CYxcFtYt.js → index.Biyf9aUg.js} +1 -1
- streamlit/static/static/js/{index.BQu5Qf_i.js → index.BqbKiDp2.js} +1 -1
- streamlit/static/static/js/{index.BcUwq6kI.js → index.BqxwnMem.js} +1 -1
- streamlit/static/static/js/{index.CDZffl1q.js → index.BtOoVQt7.js} +1 -1
- streamlit/static/static/js/{index.C57ViuAX.js → index.BxMkW82k.js} +1 -1
- streamlit/static/static/js/{index.DypwtfIh.js → index.BxQxTpWl.js} +1 -1
- streamlit/static/static/js/{index.BaKZ4ira.js → index.C5oqIM3a.js} +1 -1
- streamlit/static/static/js/{index.tjRGlTlQ.js → index.CBE2cIbj.js} +1 -1
- streamlit/static/static/js/{index.Cb7V19H9.js → index.CE2WIFD1.js} +1 -1
- streamlit/static/static/js/{index.lMhsw-5K.js → index.CPc_uZux.js} +50 -50
- streamlit/static/static/js/{index.CfXTal6g.js → index.CUYi3FrD.js} +1 -1
- streamlit/static/static/js/index.Cpu2p5bH.js +1 -0
- streamlit/static/static/js/{index.OI2eh_me.js → index.CrY1BsL3.js} +1 -1
- streamlit/static/static/js/{index.B9XI6y3j.js → index.CtbETWQK.js} +1 -1
- streamlit/static/static/js/{index.6iOQDEVC.js → index.CvtybR-u.js} +1 -1
- streamlit/static/static/js/{index.DK9Im19R.js → index.CxoREvnF.js} +1 -1
- streamlit/static/static/js/{index.DsZNm1_D.js → index.D6OexhdL.js} +1 -1
- streamlit/static/static/js/{index.Ci3x7GcT.js → index.D9v2Y8Gk.js} +1 -1
- streamlit/static/static/js/{index.BFxjXeYb.js → index.DAfIQKfP.js} +1 -1
- streamlit/static/static/js/index.DAnczAW2.js +2 -0
- streamlit/static/static/js/{index.D1tkD8Lg.js → index.DAyGxxdm.js} +1 -1
- streamlit/static/static/js/{index.BNsCI-Q1.js → index.DCe7fo-m.js} +1 -1
- streamlit/static/static/js/{index.B6Sk5Jwr.js → index.DNfyKqhQ.js} +1 -1
- streamlit/static/static/js/{index.BlgpfTUq.js → index.DRoJNzFX.js} +1 -1
- streamlit/static/static/js/{index.CkSzTTpO.js → index.DU68jVpM.js} +54 -54
- streamlit/static/static/js/{index.TTO_Lb69.js → index.DZmBuE3z.js} +2 -2
- streamlit/static/static/js/{index.Cw5Xlisw.js → index.DhRAGiPR.js} +1 -1
- streamlit/static/static/js/{index.BUOjbZl6.js → index.DrcbvB2t.js} +1 -1
- streamlit/static/static/js/{index.wKGUZfH4.js → index.Dud7RRHc.js} +1 -1
- streamlit/static/static/js/{index.BxtweGcn.js → index.DyXcT2tD.js} +1 -1
- streamlit/static/static/js/{index.X1r5cenD.js → index.DyfvmNCy.js} +222 -222
- streamlit/static/static/js/{index.JKOtpaMf.js → index.GieKl4BG.js} +1 -1
- streamlit/static/static/js/{index.CuJ82OKQ.js → index.YULCxEtm.js} +1 -1
- streamlit/static/static/js/{index.-7yn3zqE.js → index._1zqETQ9.js} +2 -2
- streamlit/static/static/js/{index.gsc49XzN.js → index.bQJYmJ2T.js} +1 -1
- streamlit/static/static/js/{index.BlchQrZL.js → index.iXh5nbLZ.js} +1 -1
- streamlit/static/static/js/index.mSdC1FV6.js +1 -0
- streamlit/static/static/js/{index.DoRYpzHm.js → index.nL1fkE1D.js} +1 -1
- streamlit/static/static/js/{index.4QSKV4yi.js → index.tuFFlbxa.js} +1 -1
- streamlit/static/static/js/{index.Bwaj-9Zv.js → index.y-pa6LIX.js} +1 -1
- streamlit/static/static/js/{input.CIKqvWjB.js → input.BcC6sPE_.js} +1 -1
- streamlit/static/static/js/{main.BkNqoTrd.js → main.TU5_aabd.js} +1 -1
- streamlit/static/static/js/{memory.DNcbFok2.js → memory.By_OTlI4.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.DwjiYKav.js → number-overlay-editor.FSRaRpbU.js} +1 -1
- streamlit/static/static/js/{pandasStylerUtils.BSc50we3.js → pandasStylerUtils.3IiIKU9-.js} +1 -1
- streamlit/static/static/js/{sandbox.DJL9Gdcf.js → sandbox.DnxTbWzV.js} +1 -1
- streamlit/static/static/js/{styled-components.D4jE1G9j.js → styled-components.BeEcZ0vW.js} +1 -1
- streamlit/static/static/js/{throttle.dHeXiPIK.js → throttle.emUyC44c.js} +1 -1
- streamlit/static/static/js/{timepicker.CIpoSUyW.js → timepicker.DZ_ZufYF.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.AOXQx2YY.js → toConsumableArray.DDV1bN1-.js} +1 -1
- streamlit/static/static/js/uniqueId.DTwvAE-J.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.BwQxG7iA.js → useBasicWidgetState.DvpdEDYZ.js} +1 -1
- streamlit/static/static/js/{useIntlLocale.JXPZPWaJ.js → useIntlLocale.BBDLbTq9.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.CD_nhoE_.js → useTextInputAutoExpand.BIApLJKn.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.Cl1Y22Ao.js → useUpdateUiValue.DQ4RuJNC.js} +1 -1
- streamlit/static/static/js/{useWaveformController.DJhScSDn.js → useWaveformController.B0olyXLQ.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.CrAfFzO9.js → withCalculatedWidth.DYeqePuh.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.EdE3zOz5.js → withFullScreenWrapper.DtkUCO_d.js} +1 -1
- streamlit/testing/v1/element_tree.py +16 -2
- streamlit/web/bootstrap.py +5 -2
- streamlit/web/server/server.py +0 -1
- streamlit/web/server/server_util.py +22 -0
- streamlit/web/server/starlette/starlette_app.py +0 -1
- {streamlit_nightly-1.53.2.dev20260127.dist-info → streamlit_nightly-1.53.2.dev20260131.dist-info}/METADATA +10 -25
- {streamlit_nightly-1.53.2.dev20260127.dist-info → streamlit_nightly-1.53.2.dev20260131.dist-info}/RECORD +212 -221
- streamlit/proto/DataFrame_pb2.py +0 -56
- streamlit/proto/DataFrame_pb2.pyi +0 -430
- streamlit/proto/NamedDataSet_pb2.py +0 -28
- streamlit/proto/NamedDataSet_pb2.pyi +0 -67
- streamlit/proto/PagesChanged_pb2.py +0 -28
- streamlit/proto/PagesChanged_pb2.pyi +0 -55
- streamlit/proto/VegaLiteChart_pb2.py +0 -29
- streamlit/proto/VegaLiteChart_pb2.pyi +0 -79
- streamlit/static/static/js/index.B0Wcvg8a.js +0 -2
- streamlit/static/static/js/index.CivdhE_9.js +0 -1
- streamlit/static/static/js/index.DTUAvbJ0.js +0 -1
- streamlit/static/static/js/uniqueId.DRPc21MO.js +0 -1
- streamlit_nightly-1.53.2.dev20260127.data/scripts/streamlit.cmd +0 -16
- {streamlit_nightly-1.53.2.dev20260127.dist-info → streamlit_nightly-1.53.2.dev20260131.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.53.2.dev20260127.dist-info → streamlit_nightly-1.53.2.dev20260131.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.53.2.dev20260127.dist-info → streamlit_nightly-1.53.2.dev20260131.dist-info}/top_level.txt +0 -0
streamlit/static/static/js/{useWaveformController.DJhScSDn.js → useWaveformController.B0olyXLQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as Z,r as i,aP as M,aa as $,aQ as O}from"./index.lMhsw-5K.js";async function q(l,e=16e3){if(!l||l.size===0)throw new Error("Invalid or empty blob provided");if(!window.AudioContext)throw new Error("AudioContext not supported in this browser");const o=new AudioContext;try{const n=await l.arrayBuffer(),r=await o.decodeAudioData(n),d=e??r.sampleRate,s=await Q(r,d);return J(s,d)}finally{o.close()}}async function Q(l,e){const{duration:o,numberOfChannels:n,sampleRate:r}=l,d=Math.ceil(o*e);if(!window.OfflineAudioContext)throw new Error("OfflineAudioContext not supported");const s=new OfflineAudioContext(1,d,e),p=s.createBufferSource();if(p.buffer=l,n>1){const h=s.createChannelSplitter(n),m=s.createChannelMerger(1);p.connect(h);for(let c=0;c<n;c++){const u=s.createGain();u.gain.value=1/n,h.connect(u,c),u.connect(m,0,0)}m.connect(s.destination)}else p.connect(s.destination);p.start(0);try{return await s.startRendering()}catch(h){throw new Error(`Failed to resample audio from ${r}Hz to ${e}Hz: ${h instanceof Error?h.message:String(h)}`)}}function J(l,e){const n=l.length,r=n*2+44,d=new ArrayBuffer(r),s=new DataView(d),p=l.getChannelData(0),h=(c,u)=>{for(let y=0;y<u.length;y++)s.setUint8(c+y,u.charCodeAt(y))};h(0,"RIFF"),s.setUint32(4,r-8,!0),h(8,"WAVE"),h(12,"fmt "),s.setUint32(16,16,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,e,!0),s.setUint32(28,e*2,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0),h(36,"data"),s.setUint32(40,n*2,!0);let m=44;for(let c=0;c<n;c++){const u=Math.max(-1,Math.min(1,p[c]));s.setInt16(m,u*32767,!0),m+=2}return new Blob([d],{type:"audio/wav"})}class W{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 o=e instanceof Error?e:new Error(String(e));this.events.onError?.(o)},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 o,n=null;try{if(e instanceof Blob)n=URL.createObjectURL(e),o=n;else if(e instanceof ArrayBuffer){const r=new Blob([e]);n=URL.createObjectURL(r),o=n}else o=e;this.currentBlobUrl=n,await this.wavesurfer.load(o)}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 I(l){return l.name==="NotAllowedError"||l.name==="PermissionDeniedError"||l.message?.toLowerCase().includes("permission denied")}class K{constructor(e={}){this.wavesurfer=null,this.recordPlugin=null,this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null,this.events={},this.options=e}initialize(e,o){this.wavesurfer=e;try{const n={renderRecordedAudio:!1,mimeType:"audio/webm"};this.recordPlugin=e.registerPlugin(o.create(n)),this.setupEventListeners()}catch(n){const r=n instanceof Error?n:new Error(String(n));throw I(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,o={};e!==void 0&&(o.sampleRate={ideal:e}),await this.startRecordingWithConstraints(o,e!==void 0)}async startRecordingWithConstraints(e,o){if(!this.recordPlugin)throw new Error("Record plugin not initialized");try{const n=Object.keys(e).length?e:void 0;await this.recordPlugin.startRecording(n)}catch(n){const r=n instanceof Error?n:new Error(String(n));if(I(r))throw this.events.onPermissionDenied?.(),new Error("Microphone permission denied");if(o&&(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,o)=>{this.recordEndResolve=e,this.recordEndReject=o,this.recordPlugin?.stopRecording()})}catch(e){const o=e instanceof Error?e:new Error(String(e));throw this.events.onError?.(o),o}}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 X=4,Y=4,ee=8,re=0,te=16e3;function se({containerRef:l,sampleRate:e,events:o,waveformPadding:n=0}){const r=Z(),[d,s]=i.useState("idle"),[p,h]=i.useState(null),[m,c]=i.useState(!1),u=i.useRef(null),y=i.useRef(null),a=i.useRef(null),f=i.useRef(o),S=i.useRef(!1),D=i.useRef(!1),E=i.useRef(new Set),P=i.useRef(!1),b=e===void 0?te:e,A=i.useCallback(()=>{E.current.clear(),c(!1),y.current&&(y.current.destroy(),y.current=null),a.current&&(a.current.destroy(),a.current=null),u.current&&(u.current.destroy(),u.current=null),S.current=!1,P.current=!1,s("idle"),h(null)},[]),x=i.useCallback(()=>{const t=Array.from(E.current);E.current.clear(),t.forEach(w=>{w.resolve()})},[]),_=i.useCallback(t=>{c(!1);const w=Array.from(E.current);E.current.clear(),w.forEach(v=>{v.reject(t)})},[]),T=i.useCallback(t=>{const w={onPlay:()=>{c(!0),f.current.onPlaybackPlay?.()},onPause:()=>{c(!1),f.current.onPlaybackPause?.()},onFinish:()=>{c(!1),f.current.onPlaybackFinish?.()},onReady:()=>{x()},onError:v=>{c(!1),_(v),f.current.onError?.(v)}};t.setEventHandlers(w)},[x,_]);i.useEffect(()=>{f.current=o,a.current&&T(a.current)},[o,T]);const U=i.useCallback(async()=>{if(!(S.current||D.current||!l.current)){D.current=!0;try{const[t,w]=await Promise.all([M(()=>import("./wavesurfer.esm.D1Sty35j.js"),[],import.meta.url),M(()=>import("./record.DytFsBUt.js"),[],import.meta.url)]),v=t.default,B=w.default,k=v.create({container:l.current,waveColor:r.colors.primary,progressColor:r.colors.bodyText,height:n>0?$(r.sizes.largestElementHeight)-2*n:"auto",barWidth:X,barGap:Y,barRadius:ee,cursorWidth:re,interact:!0});u.current=k,P.current=!1;const C=new K({sampleRate:b});C.initialize(k,B),C.setEventHandlers({onRecordProgress:R=>{f.current.onProgressMs?.(R)},onPermissionDenied:()=>{f.current.onPermissionDenied(),s("idle")},onError:R=>{f.current.onError(R),s("idle")}}),y.current=C;const g=new W;g.initialize(k),a.current=g,T(g),S.current=!0}catch(t){const w=t instanceof Error?t:new Error(String(t));f.current.onError?.(w)}finally{D.current=!1}}},[l,r,b,T,n]);i.useEffect(()=>(U(),()=>{A()}),[A,U]),i.useEffect(()=>{const t=u.current;if(t){if(d==="recording"){t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary});return}if(P.current){t.setOptions({interact:!0,waveColor:O(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText});return}t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.bodyText})}},[d,r.colors.bodyText,r.colors.fadedText40,r.colors.primary,r.colors.secondaryBg]);const F=i.useCallback(async()=>{if(d!=="recording"){if(S.current||await U(),!y.current)throw new Error("Record backend not initialized");u.current&&u.current.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary}),P.current=!1,await y.current.startRecording(),s("recording"),h(null),c(!1),f.current.onRecordStart?.()}},[d,U,r.colors.primary]),L=i.useCallback(()=>{a.current&&u.current&&(a.current.destroy(),a.current=new W,a.current.initialize(u.current),E.current.clear(),c(!1),T(a.current)),P.current=!1},[T]),z=i.useCallback(()=>{a.current?.seekToStart(),c(!1),P.current=!0,u.current&&u.current.setOptions({interact:!0,waveColor:O(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText})},[r.colors.bodyText,r.colors.fadedText40,r.colors.secondaryBg]),H=i.useCallback(async()=>{if(d!=="recording")throw new Error("Not currently recording");if(!y.current||!a.current)throw new Error("Backends not initialized");try{const t=await y.current.stopRecording();h(t),await new Promise((k,C)=>{if(!a.current){C(new Error("Player not initialized"));return}const g={resolve:()=>{E.current.delete(g),k()},reject:R=>{E.current.delete(g),C(R)}};E.current.add(g),a.current.load(t).catch(R=>{E.current.delete(g),C(R instanceof Error?R:new Error(String(R)))})}),s("idle"),c(!1),z();const v={durationMs:a.current?.getDuration()??0,sampleRate:typeof b=="number"?b:null,mimeType:t.type||"audio/webm",size:t.size},B={blob:t,meta:v};return f.current.onRecordReady?.(t),B}catch(t){const w=t instanceof Error?t:new Error(String(t));return c(!1),s("idle"),f.current.onError(w),{blob:new Blob,meta:{durationMs:0,sampleRate:null,mimeType:"audio/webm",size:0}}}},[d,z,b]),j=i.useCallback(async t=>{const w=t??p;if(!w){const v=new Error("No recorded audio to approve");f.current.onError(v);return}try{const v=await q(w,b);await f.current.onApprove?.(v),h(null),s("idle")}catch(v){const B=v instanceof Error?v:new Error(String(v));f.current.onError(B)}},[p,b]),N=i.useCallback(()=>{d==="recording"&&y.current?.cancelRecording(),L(),h(null),s("idle"),c(!1),P.current=!1,f.current.onCancel?.()},[d,L]),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(S.current||await U(),!a.current)throw new Error("Player not initialized");await a.current.load(t),z()},getCurrentTimeMs:()=>a.current?.getCurrentTime()??0,getDurationMs:()=>a.current?.getDuration()??0}),[z,U]),G=i.useCallback(t=>{f.current=t},[]);return i.useEffect(()=>()=>{A()},[A]),{state:d,isPlaybackPlaying:m,mountRef:l,start:F,stop:H,approve:j,cancel:N,destroy:A,playback:V,setEventHandlers:G}}export{se as u};
|
|
1
|
+
import{l as Z,r as i,aP as M,aa as $,aQ as O}from"./index.CPc_uZux.js";async function q(l,e=16e3){if(!l||l.size===0)throw new Error("Invalid or empty blob provided");if(!window.AudioContext)throw new Error("AudioContext not supported in this browser");const o=new AudioContext;try{const n=await l.arrayBuffer(),r=await o.decodeAudioData(n),d=e??r.sampleRate,s=await Q(r,d);return J(s,d)}finally{o.close()}}async function Q(l,e){const{duration:o,numberOfChannels:n,sampleRate:r}=l,d=Math.ceil(o*e);if(!window.OfflineAudioContext)throw new Error("OfflineAudioContext not supported");const s=new OfflineAudioContext(1,d,e),p=s.createBufferSource();if(p.buffer=l,n>1){const h=s.createChannelSplitter(n),m=s.createChannelMerger(1);p.connect(h);for(let c=0;c<n;c++){const u=s.createGain();u.gain.value=1/n,h.connect(u,c),u.connect(m,0,0)}m.connect(s.destination)}else p.connect(s.destination);p.start(0);try{return await s.startRendering()}catch(h){throw new Error(`Failed to resample audio from ${r}Hz to ${e}Hz: ${h instanceof Error?h.message:String(h)}`)}}function J(l,e){const n=l.length,r=n*2+44,d=new ArrayBuffer(r),s=new DataView(d),p=l.getChannelData(0),h=(c,u)=>{for(let y=0;y<u.length;y++)s.setUint8(c+y,u.charCodeAt(y))};h(0,"RIFF"),s.setUint32(4,r-8,!0),h(8,"WAVE"),h(12,"fmt "),s.setUint32(16,16,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,e,!0),s.setUint32(28,e*2,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0),h(36,"data"),s.setUint32(40,n*2,!0);let m=44;for(let c=0;c<n;c++){const u=Math.max(-1,Math.min(1,p[c]));s.setInt16(m,u*32767,!0),m+=2}return new Blob([d],{type:"audio/wav"})}class W{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 o=e instanceof Error?e:new Error(String(e));this.events.onError?.(o)},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 o,n=null;try{if(e instanceof Blob)n=URL.createObjectURL(e),o=n;else if(e instanceof ArrayBuffer){const r=new Blob([e]);n=URL.createObjectURL(r),o=n}else o=e;this.currentBlobUrl=n,await this.wavesurfer.load(o)}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 I(l){return l.name==="NotAllowedError"||l.name==="PermissionDeniedError"||l.message?.toLowerCase().includes("permission denied")}class K{constructor(e={}){this.wavesurfer=null,this.recordPlugin=null,this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null,this.events={},this.options=e}initialize(e,o){this.wavesurfer=e;try{const n={renderRecordedAudio:!1,mimeType:"audio/webm"};this.recordPlugin=e.registerPlugin(o.create(n)),this.setupEventListeners()}catch(n){const r=n instanceof Error?n:new Error(String(n));throw I(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,o={};e!==void 0&&(o.sampleRate={ideal:e}),await this.startRecordingWithConstraints(o,e!==void 0)}async startRecordingWithConstraints(e,o){if(!this.recordPlugin)throw new Error("Record plugin not initialized");try{const n=Object.keys(e).length?e:void 0;await this.recordPlugin.startRecording(n)}catch(n){const r=n instanceof Error?n:new Error(String(n));if(I(r))throw this.events.onPermissionDenied?.(),new Error("Microphone permission denied");if(o&&(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,o)=>{this.recordEndResolve=e,this.recordEndReject=o,this.recordPlugin?.stopRecording()})}catch(e){const o=e instanceof Error?e:new Error(String(e));throw this.events.onError?.(o),o}}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 X=4,Y=4,ee=8,re=0,te=16e3;function se({containerRef:l,sampleRate:e,events:o,waveformPadding:n=0}){const r=Z(),[d,s]=i.useState("idle"),[p,h]=i.useState(null),[m,c]=i.useState(!1),u=i.useRef(null),y=i.useRef(null),a=i.useRef(null),f=i.useRef(o),S=i.useRef(!1),D=i.useRef(!1),E=i.useRef(new Set),P=i.useRef(!1),b=e===void 0?te:e,A=i.useCallback(()=>{E.current.clear(),c(!1),y.current&&(y.current.destroy(),y.current=null),a.current&&(a.current.destroy(),a.current=null),u.current&&(u.current.destroy(),u.current=null),S.current=!1,P.current=!1,s("idle"),h(null)},[]),x=i.useCallback(()=>{const t=Array.from(E.current);E.current.clear(),t.forEach(w=>{w.resolve()})},[]),_=i.useCallback(t=>{c(!1);const w=Array.from(E.current);E.current.clear(),w.forEach(v=>{v.reject(t)})},[]),T=i.useCallback(t=>{const w={onPlay:()=>{c(!0),f.current.onPlaybackPlay?.()},onPause:()=>{c(!1),f.current.onPlaybackPause?.()},onFinish:()=>{c(!1),f.current.onPlaybackFinish?.()},onReady:()=>{x()},onError:v=>{c(!1),_(v),f.current.onError?.(v)}};t.setEventHandlers(w)},[x,_]);i.useEffect(()=>{f.current=o,a.current&&T(a.current)},[o,T]);const U=i.useCallback(async()=>{if(!(S.current||D.current||!l.current)){D.current=!0;try{const[t,w]=await Promise.all([M(()=>import("./wavesurfer.esm.D1Sty35j.js"),[],import.meta.url),M(()=>import("./record.DytFsBUt.js"),[],import.meta.url)]),v=t.default,B=w.default,k=v.create({container:l.current,waveColor:r.colors.primary,progressColor:r.colors.bodyText,height:n>0?$(r.sizes.largestElementHeight)-2*n:"auto",barWidth:X,barGap:Y,barRadius:ee,cursorWidth:re,interact:!0});u.current=k,P.current=!1;const C=new K({sampleRate:b});C.initialize(k,B),C.setEventHandlers({onRecordProgress:R=>{f.current.onProgressMs?.(R)},onPermissionDenied:()=>{f.current.onPermissionDenied(),s("idle")},onError:R=>{f.current.onError(R),s("idle")}}),y.current=C;const g=new W;g.initialize(k),a.current=g,T(g),S.current=!0}catch(t){const w=t instanceof Error?t:new Error(String(t));f.current.onError?.(w)}finally{D.current=!1}}},[l,r,b,T,n]);i.useEffect(()=>(U(),()=>{A()}),[A,U]),i.useEffect(()=>{const t=u.current;if(t){if(d==="recording"){t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary});return}if(P.current){t.setOptions({interact:!0,waveColor:O(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText});return}t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.bodyText})}},[d,r.colors.bodyText,r.colors.fadedText40,r.colors.primary,r.colors.secondaryBg]);const F=i.useCallback(async()=>{if(d!=="recording"){if(S.current||await U(),!y.current)throw new Error("Record backend not initialized");u.current&&u.current.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary}),P.current=!1,await y.current.startRecording(),s("recording"),h(null),c(!1),f.current.onRecordStart?.()}},[d,U,r.colors.primary]),L=i.useCallback(()=>{a.current&&u.current&&(a.current.destroy(),a.current=new W,a.current.initialize(u.current),E.current.clear(),c(!1),T(a.current)),P.current=!1},[T]),z=i.useCallback(()=>{a.current?.seekToStart(),c(!1),P.current=!0,u.current&&u.current.setOptions({interact:!0,waveColor:O(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText})},[r.colors.bodyText,r.colors.fadedText40,r.colors.secondaryBg]),H=i.useCallback(async()=>{if(d!=="recording")throw new Error("Not currently recording");if(!y.current||!a.current)throw new Error("Backends not initialized");try{const t=await y.current.stopRecording();h(t),await new Promise((k,C)=>{if(!a.current){C(new Error("Player not initialized"));return}const g={resolve:()=>{E.current.delete(g),k()},reject:R=>{E.current.delete(g),C(R)}};E.current.add(g),a.current.load(t).catch(R=>{E.current.delete(g),C(R instanceof Error?R:new Error(String(R)))})}),s("idle"),c(!1),z();const v={durationMs:a.current?.getDuration()??0,sampleRate:typeof b=="number"?b:null,mimeType:t.type||"audio/webm",size:t.size},B={blob:t,meta:v};return f.current.onRecordReady?.(t),B}catch(t){const w=t instanceof Error?t:new Error(String(t));return c(!1),s("idle"),f.current.onError(w),{blob:new Blob,meta:{durationMs:0,sampleRate:null,mimeType:"audio/webm",size:0}}}},[d,z,b]),j=i.useCallback(async t=>{const w=t??p;if(!w){const v=new Error("No recorded audio to approve");f.current.onError(v);return}try{const v=await q(w,b);await f.current.onApprove?.(v),h(null),s("idle")}catch(v){const B=v instanceof Error?v:new Error(String(v));f.current.onError(B)}},[p,b]),N=i.useCallback(()=>{d==="recording"&&y.current?.cancelRecording(),L(),h(null),s("idle"),c(!1),P.current=!1,f.current.onCancel?.()},[d,L]),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(S.current||await U(),!a.current)throw new Error("Player not initialized");await a.current.load(t),z()},getCurrentTimeMs:()=>a.current?.getCurrentTime()??0,getDurationMs:()=>a.current?.getDuration()??0}),[z,U]),G=i.useCallback(t=>{f.current=t},[]);return i.useEffect(()=>()=>{A()},[A]),{state:d,isPlaybackPlaying:m,mountRef:l,start:F,stop:H,approve:j,cancel:N,destroy:A,playback:V,setEventHandlers:G}}export{se as u};
|
streamlit/static/static/js/{withCalculatedWidth.CrAfFzO9.js → withCalculatedWidth.DYeqePuh.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as l,k as h,j as s,d as n}from"./index.
|
|
1
|
+
import{h as l,k as h,j as s,d as n}from"./index.CPc_uZux.js";const o=t=>{const a=e=>{const{width:i,elementRef:c}=h();return s(n,{ref:c,children:s(t,{...e,width:i})})};return a.displayName=`withCalculatedWidth(${t.displayName||t.name})`,l(a,t)};export{o as w};
|
streamlit/static/static/js/{withFullScreenWrapper.EdE3zOz5.js → withFullScreenWrapper.DtkUCO_d.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,z as f,b5 as p,b6 as h,l as x,k as y,j as i,h as g}from"./index.
|
|
1
|
+
import{r as n,z as f,b5 as p,b6 as h,l as x,k as y,j as i,h as g}from"./index.CPc_uZux.js";const m=n.createContext(null);m.displayName="ElementFullscreenContext";const w=f("div",{target:"e5bcvgj0"})(({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"}:{}})),C=()=>{const{setFullScreen:e}=n.useContext(p),[t,s]=n.useState(!1),{fullHeight:a,fullWidth:c}=h(),l=n.useCallback(r=>{s(r),e(r)},[e]),u=n.useCallback(()=>{document.body.style.overflow="hidden",l(!0)},[l]),o=n.useCallback(()=>{document.body.style.overflow="unset",l(!1)},[l]),d=n.useCallback(r=>{r.keyCode===27&&t&&o()},[o,t]);return n.useEffect(()=>(document.addEventListener("keydown",d,!1),()=>{document.removeEventListener("keydown",d,!1)}),[d]),n.useMemo(()=>({expanded:t,zoomIn:u,zoomOut:o,fullHeight:a,fullWidth:c}),[t,u,o,a,c])},b=({children:e})=>{const t=x(),{expanded:s,fullHeight:a,fullWidth:c,zoomIn:l,zoomOut:u}=C(),{width:o,elementRef:d}=y(),r=n.useMemo(()=>({width:s?c:o,height:s?a:void 0,expanded:s,expand:l,collapse:u}),[s,a,c,o,l,u]);return i(m.Provider,{value:r,children:i(w,{ref:d,isExpanded:s,"data-testid":"stFullScreenFrame",theme:t,children:e})})};function S(e){const t=s=>i(b,{children:i(e,{...s})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,g(t,e)}export{m as E,S as w};
|
|
@@ -25,6 +25,7 @@ from datetime import date, datetime, time, timedelta
|
|
|
25
25
|
from typing import (
|
|
26
26
|
TYPE_CHECKING,
|
|
27
27
|
Any,
|
|
28
|
+
ClassVar,
|
|
28
29
|
Generic,
|
|
29
30
|
TypeAlias,
|
|
30
31
|
TypeVar,
|
|
@@ -47,6 +48,7 @@ from streamlit.elements.widgets.time_widgets import (
|
|
|
47
48
|
)
|
|
48
49
|
from streamlit.proto.Alert_pb2 import Alert as AlertProto
|
|
49
50
|
from streamlit.proto.Checkbox_pb2 import Checkbox as CheckboxProto
|
|
51
|
+
from streamlit.proto.GapSize_pb2 import GapSize
|
|
50
52
|
from streamlit.proto.Markdown_pb2 import Markdown as MarkdownProto
|
|
51
53
|
from streamlit.proto.Slider_pb2 import Slider as SliderProto
|
|
52
54
|
from streamlit.proto.WidgetStates_pb2 import WidgetState, WidgetStates
|
|
@@ -1836,7 +1838,19 @@ class Column(Block):
|
|
|
1836
1838
|
type: str = field(repr=False)
|
|
1837
1839
|
proto: BlockProto.Column = field(repr=False)
|
|
1838
1840
|
weight: float
|
|
1839
|
-
gap: str
|
|
1841
|
+
gap: str | None
|
|
1842
|
+
|
|
1843
|
+
# Mapping from GapSize enum to string
|
|
1844
|
+
_GAP_SIZE_TO_STRING: ClassVar[dict[int, str | None]] = {
|
|
1845
|
+
GapSize.NONE: None,
|
|
1846
|
+
GapSize.XXSMALL: "xxsmall",
|
|
1847
|
+
GapSize.XSMALL: "xsmall",
|
|
1848
|
+
GapSize.SMALL: "small",
|
|
1849
|
+
GapSize.MEDIUM: "medium",
|
|
1850
|
+
GapSize.LARGE: "large",
|
|
1851
|
+
GapSize.XLARGE: "xlarge",
|
|
1852
|
+
GapSize.XXLARGE: "xxlarge",
|
|
1853
|
+
}
|
|
1840
1854
|
|
|
1841
1855
|
def __init__(
|
|
1842
1856
|
self,
|
|
@@ -1848,7 +1862,7 @@ class Column(Block):
|
|
|
1848
1862
|
self.root = root
|
|
1849
1863
|
self.type = "column"
|
|
1850
1864
|
self.weight = proto.weight
|
|
1851
|
-
self.gap = proto.
|
|
1865
|
+
self.gap = self._GAP_SIZE_TO_STRING.get(proto.gap_config.gap_size)
|
|
1852
1866
|
|
|
1853
1867
|
|
|
1854
1868
|
@dataclass(repr=False)
|
streamlit/web/bootstrap.py
CHANGED
|
@@ -139,7 +139,7 @@ def _on_server_start(server: Server) -> None:
|
|
|
139
139
|
if server_address_is_unix_socket():
|
|
140
140
|
# Don't open browser when server address is an unix socket
|
|
141
141
|
return
|
|
142
|
-
addr = config.get_option("server.address")
|
|
142
|
+
addr = server_util.get_display_address(config.get_option("server.address"))
|
|
143
143
|
else:
|
|
144
144
|
addr = "localhost"
|
|
145
145
|
|
|
@@ -246,8 +246,11 @@ def _print_url(is_running_hello: bool) -> None:
|
|
|
246
246
|
]
|
|
247
247
|
|
|
248
248
|
elif (
|
|
249
|
-
config.is_manually_set("server.address")
|
|
249
|
+
config.is_manually_set("server.address")
|
|
250
|
+
and not server_address_is_unix_socket()
|
|
251
|
+
and config.get_option("server.address") not in {"0.0.0.0", "::"} # noqa: S104
|
|
250
252
|
):
|
|
253
|
+
# Non-wildcard specific address - show single URL
|
|
251
254
|
named_urls = [
|
|
252
255
|
("URL", server_util.get_url(config.get_option("server.address"))),
|
|
253
256
|
]
|
streamlit/web/server/server.py
CHANGED
|
@@ -310,7 +310,6 @@ class Server:
|
|
|
310
310
|
self._runtime = Runtime(
|
|
311
311
|
RuntimeConfig(
|
|
312
312
|
script_path=main_script_path,
|
|
313
|
-
command_line=None,
|
|
314
313
|
media_file_storage=media_file_storage,
|
|
315
314
|
uploaded_file_manager=uploaded_file_mgr,
|
|
316
315
|
cache_storage_manager=create_default_cache_storage_manager(),
|
|
@@ -137,6 +137,28 @@ def _get_server_address_if_manually_set() -> str | None:
|
|
|
137
137
|
return None
|
|
138
138
|
|
|
139
139
|
|
|
140
|
+
def get_display_address(address: str) -> str:
|
|
141
|
+
"""Get a display-friendly address for URLs shown to users.
|
|
142
|
+
|
|
143
|
+
Wildcard addresses like "0.0.0.0" (all IPv4) or "::" (all interfaces)
|
|
144
|
+
are not valid browser addresses on all platforms. This translates
|
|
145
|
+
them to "localhost" for display purposes.
|
|
146
|
+
|
|
147
|
+
Parameters
|
|
148
|
+
----------
|
|
149
|
+
address
|
|
150
|
+
The server address (IP or hostname).
|
|
151
|
+
|
|
152
|
+
Returns
|
|
153
|
+
-------
|
|
154
|
+
str
|
|
155
|
+
Address suitable for display. Wildcards become "localhost".
|
|
156
|
+
"""
|
|
157
|
+
if address in {"0.0.0.0", "::"}: # noqa: S104
|
|
158
|
+
return "localhost"
|
|
159
|
+
return address
|
|
160
|
+
|
|
161
|
+
|
|
140
162
|
def make_url_path_regex(
|
|
141
163
|
*path: str,
|
|
142
164
|
trailing_slash: Literal["optional", "required", "prohibited"] = "optional",
|
|
@@ -417,7 +417,6 @@ class App:
|
|
|
417
417
|
return Runtime(
|
|
418
418
|
RuntimeConfig(
|
|
419
419
|
script_path=str(script_path),
|
|
420
|
-
command_line=None,
|
|
421
420
|
media_file_storage=media_file_storage,
|
|
422
421
|
uploaded_file_manager=uploaded_file_mgr,
|
|
423
422
|
cache_storage_manager=create_default_cache_storage_manager(),
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: streamlit-nightly
|
|
3
|
-
Version: 1.53.2.
|
|
3
|
+
Version: 1.53.2.dev20260131
|
|
4
4
|
Summary: A faster way to build and share data apps
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Author-email: Snowflake Inc <hello@streamlit.io>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://streamlit.io
|
|
8
|
+
Project-URL: Documentation, https://docs.streamlit.io/
|
|
9
9
|
Project-URL: Source Code, https://github.com/streamlit/streamlit
|
|
10
10
|
Project-URL: Bug Tracker, https://github.com/streamlit/streamlit/issues
|
|
11
|
-
Project-URL: Release
|
|
12
|
-
Project-URL: Documentation, https://docs.streamlit.io/
|
|
11
|
+
Project-URL: Release Notes, https://docs.streamlit.io/develop/quick-reference/changelog
|
|
13
12
|
Project-URL: Community, https://discuss.streamlit.io/
|
|
14
|
-
Project-URL: Twitter, https://twitter.com/streamlit
|
|
15
13
|
Classifier: Development Status :: 5 - Production/Stable
|
|
16
14
|
Classifier: Environment :: Console
|
|
17
15
|
Classifier: Environment :: Web Environment
|
|
18
16
|
Classifier: Intended Audience :: Developers
|
|
19
17
|
Classifier: Intended Audience :: Science/Research
|
|
20
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
21
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -35,20 +32,20 @@ Requires-Dist: altair!=5.4.0,!=5.4.1,<7,>=4.0
|
|
|
35
32
|
Requires-Dist: blinker<2,>=1.5.0
|
|
36
33
|
Requires-Dist: cachetools<7,>=5.5
|
|
37
34
|
Requires-Dist: click<9,>=7.0
|
|
35
|
+
Requires-Dist: gitpython!=3.1.19,<4,>=3.0.7
|
|
38
36
|
Requires-Dist: numpy<3,>=1.23
|
|
39
37
|
Requires-Dist: packaging>=20
|
|
40
38
|
Requires-Dist: pandas<3,>=1.4.0
|
|
41
39
|
Requires-Dist: pillow<13,>=7.1.0
|
|
40
|
+
Requires-Dist: pydeck<1,>=0.8.0b4
|
|
42
41
|
Requires-Dist: protobuf<7,>=3.20
|
|
43
42
|
Requires-Dist: pyarrow>=7.0
|
|
44
43
|
Requires-Dist: requests<3,>=2.27
|
|
45
44
|
Requires-Dist: tenacity<10,>=8.1.0
|
|
46
45
|
Requires-Dist: toml<2,>=0.10.1
|
|
46
|
+
Requires-Dist: tornado!=6.5.0,<7,>=6.0.3
|
|
47
47
|
Requires-Dist: typing-extensions<5,>=4.10.0
|
|
48
48
|
Requires-Dist: watchdog<7,>=2.1.5; platform_system != "Darwin"
|
|
49
|
-
Requires-Dist: gitpython!=3.1.19,<4,>=3.0.7
|
|
50
|
-
Requires-Dist: pydeck<1,>=0.8.0b4
|
|
51
|
-
Requires-Dist: tornado!=6.5.0,<7,>=6.0.3
|
|
52
49
|
Provides-Extra: snowflake
|
|
53
50
|
Requires-Dist: snowflake-snowpark-python[modin]>=1.17.0; python_version < "3.12" and extra == "snowflake"
|
|
54
51
|
Requires-Dist: snowflake-connector-python>=3.3.0; python_version < "3.12" and extra == "snowflake"
|
|
@@ -72,23 +69,11 @@ Provides-Extra: sql
|
|
|
72
69
|
Requires-Dist: SQLAlchemy>=2.0.0; extra == "sql"
|
|
73
70
|
Provides-Extra: performance
|
|
74
71
|
Requires-Dist: orjson>=3.5.0; extra == "performance"
|
|
75
|
-
Requires-Dist: uvloop>=0.15.2; (sys_platform != "win32" and
|
|
72
|
+
Requires-Dist: uvloop>=0.15.2; (sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy") and extra == "performance"
|
|
76
73
|
Requires-Dist: httptools>=0.6.3; extra == "performance"
|
|
77
74
|
Provides-Extra: all
|
|
78
75
|
Requires-Dist: streamlit[auth,charts,pdf,performance,snowflake,sql]; extra == "all"
|
|
79
76
|
Requires-Dist: rich>=11.0.0; extra == "all"
|
|
80
|
-
Dynamic: author
|
|
81
|
-
Dynamic: author-email
|
|
82
|
-
Dynamic: classifier
|
|
83
|
-
Dynamic: description
|
|
84
|
-
Dynamic: description-content-type
|
|
85
|
-
Dynamic: home-page
|
|
86
|
-
Dynamic: license
|
|
87
|
-
Dynamic: project-url
|
|
88
|
-
Dynamic: provides-extra
|
|
89
|
-
Dynamic: requires-dist
|
|
90
|
-
Dynamic: requires-python
|
|
91
|
-
Dynamic: summary
|
|
92
77
|
|
|
93
78
|
<br>
|
|
94
79
|
|