streamlit-nightly 1.39.1.dev20241022__py2.py3-none-any.whl → 1.39.1.dev20241023__py2.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/static/asset-manifest.json +4 -4
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{3224.86a6ba35.chunk.js → 3224.a04b49ba.chunk.js} +1 -1
- streamlit/static/static/js/9993.5b55b4c2.chunk.js +1 -0
- streamlit/static/static/js/{main.b154eb39.js → main.c508d2af.js} +4 -4
- streamlit/web/server/component_request_handler.py +1 -1
- {streamlit_nightly-1.39.1.dev20241022.dist-info → streamlit_nightly-1.39.1.dev20241023.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.39.1.dev20241022.dist-info → streamlit_nightly-1.39.1.dev20241023.dist-info}/RECORD +13 -13
- streamlit/static/static/js/6073.192808c1.chunk.js +0 -1
- /streamlit/static/static/js/{main.b154eb39.js.LICENSE.txt → main.c508d2af.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.39.1.dev20241022.data → streamlit_nightly-1.39.1.dev20241023.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.39.1.dev20241022.dist-info → streamlit_nightly-1.39.1.dev20241023.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.39.1.dev20241022.dist-info → streamlit_nightly-1.39.1.dev20241023.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.39.1.dev20241022.dist-info → streamlit_nightly-1.39.1.dev20241023.dist-info}/top_level.txt +0 -0
@@ -51,7 +51,7 @@ class ComponentRequestHandler(tornado.web.RequestHandler):
|
|
51
51
|
# follow symlinks to get an accurate normalized path
|
52
52
|
component_root = os.path.realpath(component_root)
|
53
53
|
filename = "/".join(parts[1:])
|
54
|
-
abspath = os.path.
|
54
|
+
abspath = os.path.normpath(os.path.join(component_root, filename))
|
55
55
|
|
56
56
|
# Do NOT expose anything outside of the component root.
|
57
57
|
if os.path.commonpath([component_root, abspath]) != component_root:
|
@@ -347,9 +347,9 @@ streamlit/runtime/state/safe_session_state.py,sha256=WLFFyMtP4F19TWWBarKtSP942Ie
|
|
347
347
|
streamlit/runtime/state/session_state.py,sha256=SMBWsSZY29jAgL3QfX4xvJr9aLCNrHHUz9AmosX7FlQ,28850
|
348
348
|
streamlit/runtime/state/session_state_proxy.py,sha256=IWF43f6UWL4KyxNWF3aTv1sbykNI2hI5UsPF2UIfpdE,5524
|
349
349
|
streamlit/runtime/state/widgets.py,sha256=r5XOgHBh9AqS52rgKGgDXFGnkdY6ObUJBSSUBqkzTK8,5319
|
350
|
-
streamlit/static/asset-manifest.json,sha256=
|
350
|
+
streamlit/static/asset-manifest.json,sha256=CNJn1RSOkjut-FCjpU4q_-O6pkWiOeoe6XhUCIvgM4M,14713
|
351
351
|
streamlit/static/favicon.png,sha256=if5cVgw7azxKOvV5FpGixga7JLn23rfnHcy1CdWI1-E,1019
|
352
|
-
streamlit/static/index.html,sha256=
|
352
|
+
streamlit/static/index.html,sha256=6cTxuh8m_7tMkJhWoYVBJoY27Hq6B9b5ofg45X7VSUg,891
|
353
353
|
streamlit/static/static/css/4096.8b8f33d6.chunk.css,sha256=4m2lbj1eVFXSaGCRBHZNhqyRz-4Ce9KogjJPxIq6On8,33275
|
354
354
|
streamlit/static/static/css/9943.d452238e.chunk.css,sha256=B69nSRvppH7uO-_kso_XSGce7SJOCm8ZD1GB9g6fttA,12038
|
355
355
|
streamlit/static/static/css/main.5513bd04.css,sha256=9vuriEsFvHDyAwsI3vtBY9PNL8UOjqGwWZ4lZHsdFzw,29356
|
@@ -361,7 +361,7 @@ streamlit/static/static/js/1674.86aea8e0.chunk.js.LICENSE.txt,sha256=426lVBKMW2F
|
|
361
361
|
streamlit/static/static/js/223.2359dae5.chunk.js,sha256=QSBOzn0nC-VViJW5bSdwAWp_7VI-_JgELrhMQdM-aEM,15452
|
362
362
|
streamlit/static/static/js/245.f99a075b.chunk.js,sha256=Uh-JbxYM-u3OWNz4ic9QpO1-ctFk64sER5Y61FUIYwQ,16029
|
363
363
|
streamlit/static/static/js/2627.2462a014.chunk.js,sha256=PdOFzDOJSqybqqZpNdX3C-QzWLq7SuVcMjhY--a7mJA,21253
|
364
|
-
streamlit/static/static/js/3224.
|
364
|
+
streamlit/static/static/js/3224.a04b49ba.chunk.js,sha256=0z1RX1ZDDy4egCCqcr6N5sbOFXnh-CxxuZ5qwL5yW1k,15373
|
365
365
|
streamlit/static/static/js/3389.71902a75.chunk.js,sha256=rmAaytiYyUUn62JwB0cWuq8XlufugjELi3FkHfwri0Y,2263290
|
366
366
|
streamlit/static/static/js/3391.7aba08a0.chunk.js,sha256=UwAjzqpjIayXO5WqVNvDCtg4KTmFpaOtpPSVLJYSTWA,2177
|
367
367
|
streamlit/static/static/js/3471.de4b25a2.chunk.js,sha256=v46A9eVjvhxYsBZ6SFG6wRg94XAccGQn6xA3q7sIluE,2698
|
@@ -384,7 +384,6 @@ streamlit/static/static/js/5764.5a55e5be.chunk.js,sha256=EXfo-JRIKlOsXU91rI9-4Nu
|
|
384
384
|
streamlit/static/static/js/5828.f8572ba4.chunk.js,sha256=KrgzrwMJj70Ou4vPwvpeUEd-E7fKQUKUGK_y6wGkEf8,2272
|
385
385
|
streamlit/static/static/js/583.61ac7fde.chunk.js,sha256=ZNm9WsrrmRUjAJPKbaBwKDxJeXYgp3Prip_YtHMU3Nc,3252
|
386
386
|
streamlit/static/static/js/5849.e92568db.chunk.js,sha256=2ay_pWGuk6Y26KeBbfMGqGzOJWBCpuqN9Y3MGN8CPG0,22834
|
387
|
-
streamlit/static/static/js/6073.192808c1.chunk.js,sha256=aFAGqEXyyLDqeR2G2rAkMhZQQEKpY643ew439AWBMFg,40343
|
388
387
|
streamlit/static/static/js/6088.cf24e25c.chunk.js,sha256=7rVWAzP5oDH4aAJrS-YpRYeFTUIz_40aKJcgHhlxoqU,21141
|
389
388
|
streamlit/static/static/js/6141.d2879825.chunk.js,sha256=1thDcPIyU3rnFInTd2gUU4O0XqpLVqANd1G4tbvESJE,1190
|
390
389
|
streamlit/static/static/js/6198.956025ac.chunk.js,sha256=M8auCVk5IHkZg39jS43Ix7QyPAx87dv0MyXhEPkAlmc,3660955
|
@@ -419,8 +418,9 @@ streamlit/static/static/js/9528.a58c0ad2.chunk.js,sha256=LCX8VwyKfm9gr9lIAvz5d-8
|
|
419
418
|
streamlit/static/static/js/954.88014372.chunk.js,sha256=iM-oVcorvEnZJzzEem6IrtXG6U63FfXPupeoIxFK92U,8769
|
420
419
|
streamlit/static/static/js/9923.2bb9616f.chunk.js,sha256=EtTxhVpm_jY8E23uFAg-00WCnbvi1zXVRAky8JxbMaI,3579
|
421
420
|
streamlit/static/static/js/9943.54dc52f7.chunk.js,sha256=__dBNdmwDa6eZ3IwppDYRvXWnBWfwKeRHCvHl6imidw,49465
|
422
|
-
streamlit/static/static/js/
|
423
|
-
streamlit/static/static/js/main.
|
421
|
+
streamlit/static/static/js/9993.5b55b4c2.chunk.js,sha256=uJI1SGarpF5Lc12L6nzoWCAPNtWOYmW6m6pf4tt_RkI,40386
|
422
|
+
streamlit/static/static/js/main.c508d2af.js,sha256=6GU-aCGM7BYXBoWjd9eyfiEUc123ltXRIHCIWQ5G5fo,4481463
|
423
|
+
streamlit/static/static/js/main.c508d2af.js.LICENSE.txt,sha256=vcwWCW5VNoALG8YyhU5k8oDUNAwYisMZfiZ8X1cvtWk,4730
|
424
424
|
streamlit/static/static/media/KaTeX_AMS-Regular.73ea273a72f4aca30ca5.woff2,sha256=DN04fJWQoan5eUVgAi27WWVKfYbxh6oMgUla1C06cwg,28076
|
425
425
|
streamlit/static/static/media/KaTeX_AMS-Regular.853be92419a6c3766b9a.ttf,sha256=aFNIQLz90r_7bw6N60hoTdAefwTqKBMmdXevuQbeHRM,63632
|
426
426
|
streamlit/static/static/media/KaTeX_AMS-Regular.d562e886c52f12660a41.woff,sha256=MNqR6EyJP4deJSaJ-uvcWQsocRReitx_mp1NvYzgslE,33516
|
@@ -534,7 +534,7 @@ streamlit/web/cli.py,sha256=a5d_KIyFsOI2bzE8pPcyVhIvbt5jlxT850RKfquyYuU,11268
|
|
534
534
|
streamlit/web/server/__init__.py,sha256=w4TFcV0OjM5zx8ej7oThRIyB6gq3kqdt45XBk1zkRWo,1080
|
535
535
|
streamlit/web/server/app_static_file_handler.py,sha256=HQwZXzv2LMv0Kuq9gQYfHCS7midNJWj5us7Dt1UOvUY,3110
|
536
536
|
streamlit/web/server/browser_websocket_handler.py,sha256=rcOCOfzs1cgkipT-8drKBVdxMsJDwihRccaOea3KYqU,7950
|
537
|
-
streamlit/web/server/component_request_handler.py,sha256=
|
537
|
+
streamlit/web/server/component_request_handler.py,sha256=nPgLavJe4Guk49YvlSkTc-wfJhY6EaJBd96UD6aMBqc,4415
|
538
538
|
streamlit/web/server/media_file_handler.py,sha256=2KfzPnMN1RstMtI4fs0PD0vFiFrWMyKL0q7LfWJLYZ4,5270
|
539
539
|
streamlit/web/server/routes.py,sha256=dylD7VM9cyd6znQew1cCGHdSJx1zJ-JSXLhqMzqmpjs,10263
|
540
540
|
streamlit/web/server/server.py,sha256=OV1rZto9AmAOGllVoc4N25ZCPDSaERNJQOTKmrWwtZs,15398
|
@@ -542,9 +542,9 @@ streamlit/web/server/server_util.py,sha256=ioIHkXNlA_ujj2Q3isziM8r5glKxgK2JZRoCD
|
|
542
542
|
streamlit/web/server/stats_request_handler.py,sha256=e144zIhzLTB1PN4CwTCxElCoWMuo9IsBEPex2exHCQ0,3641
|
543
543
|
streamlit/web/server/upload_file_request_handler.py,sha256=ftyKpARrUjOpRcFETIXuoTyOG_mo-ToOw5NI0y_W4lE,5003
|
544
544
|
streamlit/web/server/websocket_headers.py,sha256=uUxypj04ondEC4ocBiYCndX_N06Zwe1Mt690Vupe08Y,2232
|
545
|
-
streamlit_nightly-1.39.1.
|
546
|
-
streamlit_nightly-1.39.1.
|
547
|
-
streamlit_nightly-1.39.1.
|
548
|
-
streamlit_nightly-1.39.1.
|
549
|
-
streamlit_nightly-1.39.1.
|
550
|
-
streamlit_nightly-1.39.1.
|
545
|
+
streamlit_nightly-1.39.1.dev20241023.data/scripts/streamlit.cmd,sha256=ZEYM3vBJSp-k7vwSJ3ba5NzEk9-qHdSeLvGYAAe1mMw,676
|
546
|
+
streamlit_nightly-1.39.1.dev20241023.dist-info/METADATA,sha256=3spvH3I7YXJ_KAA8434j36JlnOfSB3kGA63H7xRDmyI,8512
|
547
|
+
streamlit_nightly-1.39.1.dev20241023.dist-info/WHEEL,sha256=TJ49d73sNs10F0aze1W_bTW2P_X7-F4YXOlBqoqA-jY,109
|
548
|
+
streamlit_nightly-1.39.1.dev20241023.dist-info/entry_points.txt,sha256=uNJ4DwGNXEhOK0USwSNanjkYyR-Bk7eYQbJFDrWyOgY,53
|
549
|
+
streamlit_nightly-1.39.1.dev20241023.dist-info/top_level.txt,sha256=V3FhKbm7G2LnR0s4SytavrjIPNIhvcsAGXfYHAwtQzw,10
|
550
|
+
streamlit_nightly-1.39.1.dev20241023.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[6073],{95241:(t,e,i)=>{i.d(e,{e:()=>o});var r=i(68102),n=i(58878),s=i(68622),o=n.forwardRef((function(t,e){return n.createElement(s.I,(0,r.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),n.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),n.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}))}));o.displayName="Delete"},50248:(t,e,i)=>{i.d(e,{f:()=>o});var r=i(68102),n=i(58878),s=i(68622),o=n.forwardRef((function(t,e){return n.createElement(s.I,(0,r.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),n.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),n.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"}))}));o.displayName="Download"},12274:(t,e,i)=>{i.d(e,{g:()=>o});var r=i(68102),n=i(58878),s=i(68622),o=n.forwardRef((function(t,e){return n.createElement(s.I,(0,r.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),n.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),n.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))}));o.displayName="Fullscreen"},63186:(t,e,i)=>{i.d(e,{Q:()=>o});var r=i(68102),n=i(58878),s=i(68622),o=n.forwardRef((function(t,e){return n.createElement(s.I,(0,r.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),n.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),n.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}))}));o.displayName="FullscreenExit"},96626:(t,e,i)=>{i.d(e,{G:()=>o});var r=i(68102),n=i(58878),s=i(68622),o=n.forwardRef((function(t,e){return n.createElement(s.I,(0,r.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),n.createElement("g",{fill:"none"},n.createElement("rect",{width:24,height:24}),n.createElement("rect",{width:24,height:24}),n.createElement("rect",{width:24,height:24})),n.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),n.createElement("path",{d:"M17 11c0 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"}))}));o.displayName="Mic"},37789:(t,e,i)=>{i.d(e,{v:()=>o});var r=i(68102),n=i(58878),s=i(68622),o=n.forwardRef((function(t,e){return n.createElement(s.I,(0,r.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))}));o.displayName="Pause"},14757:(t,e,i)=>{i.d(e,{S:()=>o});var r=i(68102),n=i(58878),s=i(68622),o=n.forwardRef((function(t,e){return n.createElement(s.I,(0,r.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))}));o.displayName="PlayArrow"},88685:(t,e,i)=>{i.d(e,{C:()=>o});var r=i(68102),n=i(58878),s=i(68622),o=n.forwardRef((function(t,e){return n.createElement(s.I,(0,r.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),n.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),n.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))}));o.displayName="Refresh"},34783:(t,e,i)=>{i.d(e,{X:()=>o});var r=i(68102),n=i(58878),s=i(68622),o=n.forwardRef((function(t,e){return n.createElement(s.I,(0,r.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),n.createElement("g",{fill:"none"},n.createElement("rect",{width:24,height:24}),n.createElement("rect",{width:24,height:24})),n.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))}));o.displayName="StopCircle"},56146:(t,e,i)=>{function r(t,e,i,r){return new(i||(i=Promise))((function(n,s){function o(t){try{h(r.next(t))}catch(t){s(t)}}function a(t){try{h(r.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((r=r.apply(t,e||[])).next())}))}i.d(e,{A:()=>h}),"function"==typeof SuppressedError&&SuppressedError;class n{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),null==i?void 0:i.once){const i=()=>{this.un(t,i),this.un(t,e)};return this.on(t,i),i}return()=>this.un(t,e)}un(t,e){var i;null===(i=this.listeners[t])||void 0===i||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];this.listeners[t]&&this.listeners[t].forEach((t=>t(...i)))}}class s extends n{constructor(t){super(),this.subscriptions=[],this.options=t}onInit(){}_init(t){this.wavesurfer=t,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((t=>t()))}}class o extends n{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",(()=>{requestAnimationFrame((()=>{this.emit("tick")}))})),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}const a=["audio/webm","audio/wav","audio/mpeg","audio/mp4","audio/mp3"];class h extends s{constructor(t){var e,i,r,n,s;super(Object.assign(Object.assign({},t),{audioBitsPerSecond:null!==(e=t.audioBitsPerSecond)&&void 0!==e?e:128e3,scrollingWaveform:null!==(i=t.scrollingWaveform)&&void 0!==i&&i,scrollingWaveformWindow:null!==(r=t.scrollingWaveformWindow)&&void 0!==r?r:5,renderRecordedAudio:null===(n=t.renderRecordedAudio)||void 0===n||n,mediaRecorderTimeslice:null!==(s=t.mediaRecorderTimeslice)&&void 0!==s?s:void 0})),this.stream=null,this.mediaRecorder=null,this.dataWindow=null,this.isWaveformPaused=!1,this.lastStartTime=0,this.lastDuration=0,this.duration=0,this.timer=new o,this.subscriptions.push(this.timer.on("tick",(()=>{const t=performance.now()-this.lastStartTime;this.duration=this.isPaused()?this.duration:this.lastDuration+t,this.emit("record-progress",this.duration)})))}static create(t){return new h(t||{})}renderMicStream(t){const e=new AudioContext,i=e.createMediaStreamSource(t),r=e.createAnalyser();i.connect(r);const n=r.frequencyBinCount,s=new Float32Array(n);let o;const a=Math.floor((this.options.scrollingWaveformWindow||0)*e.sampleRate),h=()=>{var t;if(this.isWaveformPaused)return void(o=requestAnimationFrame(h));if(r.getFloatTimeDomainData(s),this.options.scrollingWaveform){const t=Math.min(a,this.dataWindow?this.dataWindow.length+n:n),e=new Float32Array(a);if(this.dataWindow){const i=Math.max(0,a-this.dataWindow.length);e.set(this.dataWindow.slice(-t+n),i)}e.set(s,a-n),this.dataWindow=e}else this.dataWindow=s;const e=this.options.scrollingWaveformWindow;this.wavesurfer&&(null!==(t=this.originalOptions)&&void 0!==t||(this.originalOptions={cursorWidth:this.wavesurfer.options.cursorWidth,interact:this.wavesurfer.options.interact}),this.wavesurfer.options.cursorWidth=0,this.wavesurfer.options.interact=!1,this.wavesurfer.load("",[this.dataWindow],e)),o=requestAnimationFrame(h)};return h(),{onDestroy:()=>{cancelAnimationFrame(o),null==i||i.disconnect(),null==e||e.close()},onEnd:()=>{this.isWaveformPaused=!0,cancelAnimationFrame(o),this.stopMic()}}}startMic(t){return r(this,void 0,void 0,(function*(){let e;try{e=yield navigator.mediaDevices.getUserMedia({audio:!(null==t?void 0:t.deviceId)||{deviceId:t.deviceId}})}catch(e){throw new Error("Error accessing the microphone: "+e.message)}const{onDestroy:i,onEnd:r}=this.renderMicStream(e);return this.subscriptions.push(this.once("destroy",i)),this.subscriptions.push(this.once("record-end",r)),this.stream=e,e}))}stopMic(){this.stream&&(this.stream.getTracks().forEach((t=>t.stop())),this.stream=null,this.mediaRecorder=null)}startRecording(t){return r(this,void 0,void 0,(function*(){const e=this.stream||(yield this.startMic(t));this.dataWindow=null;const i=this.mediaRecorder||new MediaRecorder(e,{mimeType:this.options.mimeType||a.find((t=>MediaRecorder.isTypeSupported(t))),audioBitsPerSecond:this.options.audioBitsPerSecond});this.mediaRecorder=i,this.stopRecording();const r=[];i.ondataavailable=t=>{t.data.size>0&&r.push(t.data),this.emit("record-data-available",t.data)};const n=t=>{var e;const n=new Blob(r,{type:i.mimeType});this.emit(t,n),this.options.renderRecordedAudio&&(this.applyOriginalOptionsIfNeeded(),null===(e=this.wavesurfer)||void 0===e||e.load(URL.createObjectURL(n)))};i.onpause=()=>n("record-pause"),i.onstop=()=>n("record-end"),i.start(this.options.mediaRecorderTimeslice),this.lastStartTime=performance.now(),this.lastDuration=0,this.duration=0,this.isWaveformPaused=!1,this.timer.start(),this.emit("record-start")}))}getDuration(){return this.duration}isRecording(){var t;return"recording"===(null===(t=this.mediaRecorder)||void 0===t?void 0:t.state)}isPaused(){var t;return"paused"===(null===(t=this.mediaRecorder)||void 0===t?void 0:t.state)}isActive(){var t;return"inactive"!==(null===(t=this.mediaRecorder)||void 0===t?void 0:t.state)}stopRecording(){var t;this.isActive()&&(null===(t=this.mediaRecorder)||void 0===t||t.stop(),this.timer.stop())}pauseRecording(){var t,e;this.isRecording()&&(this.isWaveformPaused=!0,null===(t=this.mediaRecorder)||void 0===t||t.requestData(),null===(e=this.mediaRecorder)||void 0===e||e.pause(),this.timer.stop(),this.lastDuration=this.duration)}resumeRecording(){var t;this.isPaused()&&(this.isWaveformPaused=!1,null===(t=this.mediaRecorder)||void 0===t||t.resume(),this.timer.start(),this.lastStartTime=performance.now(),this.emit("record-resume"))}static getAvailableAudioDevices(){return r(this,void 0,void 0,(function*(){return navigator.mediaDevices.enumerateDevices().then((t=>t.filter((t=>"audioinput"===t.kind))))}))}destroy(){this.applyOriginalOptionsIfNeeded(),super.destroy(),this.stopRecording(),this.stopMic()}applyOriginalOptionsIfNeeded(){this.wavesurfer&&this.originalOptions&&(this.wavesurfer.options.cursorWidth=this.originalOptions.cursorWidth,this.wavesurfer.options.interact=this.originalOptions.interact,delete this.originalOptions)}}},19613:(t,e,i)=>{function r(t,e,i,r){return new(i||(i=Promise))((function(n,s){function o(t){try{h(r.next(t))}catch(t){s(t)}}function a(t){try{h(r.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((r=r.apply(t,e||[])).next())}))}i.d(e,{A:()=>v}),"function"==typeof SuppressedError&&SuppressedError;class n{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),null==i?void 0:i.once){const i=()=>{this.un(t,i),this.un(t,e)};return this.on(t,i),i}return()=>this.un(t,e)}un(t,e){var i;null===(i=this.listeners[t])||void 0===i||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];this.listeners[t]&&this.listeners[t].forEach((t=>t(...i)))}}const s={decode:function(t,e){return r(this,void 0,void 0,(function*(){const i=new AudioContext({sampleRate:e});return i.decodeAudioData(t).finally((()=>i.close()))}))},createBuffer:function(t,e){return"number"==typeof t[0]&&(t=[t]),function(t){const e=t[0];if(e.some((t=>t>1||t<-1))){const i=e.length;let r=0;for(let t=0;t<i;t++){const i=Math.abs(e[t]);i>r&&(r=i)}for(const e of t)for(let t=0;t<i;t++)e[t]/=r}}(t),{duration:e,length:t[0].length,sampleRate:t[0].length/e,numberOfChannels:t.length,getChannelData:e=>null==t?void 0:t[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function o(t,e){const i=e.xmlns?document.createElementNS(e.xmlns,t):document.createElement(t);for(const[r,n]of Object.entries(e))if("children"===r)for(const[t,s]of Object.entries(e))"string"==typeof s?i.appendChild(document.createTextNode(s)):i.appendChild(o(t,s));else"style"===r?Object.assign(i.style,n):"textContent"===r?i.textContent=n:i.setAttribute(r,n.toString());return i}function a(t,e,i){const r=o(t,e||{});return null==i||i.appendChild(r),r}var h=Object.freeze({__proto__:null,createElement:a,default:a});const l={fetchBlob:function(t,e,i){return r(this,void 0,void 0,(function*(){const n=yield fetch(t,i);if(n.status>=400)throw new Error(`Failed to fetch ${t}: ${n.status} (${n.statusText})`);return function(t,e){r(this,void 0,void 0,(function*(){if(!t.body||!t.headers)return;const i=t.body.getReader(),n=Number(t.headers.get("Content-Length"))||0;let s=0;const o=t=>r(this,void 0,void 0,(function*(){s+=(null==t?void 0:t.length)||0;const i=Math.round(s/n*100);e(i)})),a=()=>r(this,void 0,void 0,(function*(){let t;try{t=yield i.read()}catch(t){return}t.done||(o(t.value),yield a())}));a()}))}(n.clone(),e),n.blob()}))}};class d extends n{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),null!=t.playbackRate&&this.onMediaEvent("canplay",(()=>{null!=t.playbackRate&&(this.media.playbackRate=t.playbackRate)}),{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return""!==this.media.canPlayType(t)}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const r=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;try{this.media.src=r}catch(e){this.media.src=t}}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(t){this.media=t}play(){return r(this,void 0,void 0,(function*(){return this.media.play()}))}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=t}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){null!=e&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class c extends n{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[r,n]=this.initHtml();i.appendChild(r),this.container=r,this.scrollContainer=n.querySelector(".scroll"),this.wrapper=n.querySelector(".wrapper"),this.canvasWrapper=n.querySelector(".canvases"),this.progressWrapper=n.querySelector(".progress"),this.cursor=n.querySelector(".cursor"),e&&n.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if("string"==typeof t?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=t=>{const e=this.wrapper.getBoundingClientRect(),i=t.clientX-e.left,r=t.clientY-e.top;return[i/e.width,r/e.height]};if(this.wrapper.addEventListener("click",(e=>{const[i,r]=t(e);this.emit("click",i,r)})),this.wrapper.addEventListener("dblclick",(e=>{const[i,r]=t(e);this.emit("dblclick",i,r)})),!0!==this.options.dragToSeek&&"object"!=typeof this.options.dragToSeek||this.initDrag(),this.scrollContainer.addEventListener("scroll",(()=>{const{scrollLeft:t,scrollWidth:e,clientWidth:i}=this.scrollContainer,r=t/e,n=(t+i)/e;this.emit("scroll",r,n,t,t+i)})),"function"==typeof ResizeObserver){const t=this.createDelay(100);this.resizeObserver=new ResizeObserver((()=>{t().then((()=>this.onContainerResize())).catch((()=>{}))})),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&"auto"!==this.options.height||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:100;if(!t)return()=>{};const a=matchMedia("(pointer: coarse)").matches;let h=()=>{};const l=l=>{if(l.button!==s)return;l.preventDefault(),l.stopPropagation();let d=l.clientX,c=l.clientY,u=!1;const p=Date.now(),m=r=>{if(r.preventDefault(),r.stopPropagation(),a&&Date.now()-p<o)return;const s=r.clientX,h=r.clientY,l=s-d,m=h-c;if(u||Math.abs(l)>n||Math.abs(m)>n){const r=t.getBoundingClientRect(),{left:n,top:o}=r;u||(null==i||i(d-n,c-o),u=!0),e(l,m,s-n,h-o),d=s,c=h}},v=e=>{if(u){const i=e.clientX,n=e.clientY,s=t.getBoundingClientRect(),{left:o,top:a}=s;null==r||r(i-o,n-a)}h()},f=t=>{t.relatedTarget&&t.relatedTarget!==document.documentElement||v(t)},g=t=>{u&&(t.stopPropagation(),t.preventDefault())},b=t=>{u&&t.preventDefault()};document.addEventListener("pointermove",m),document.addEventListener("pointerup",v),document.addEventListener("pointerout",f),document.addEventListener("pointercancel",f),document.addEventListener("touchmove",b,{passive:!1}),document.addEventListener("click",g,{capture:!0}),h=()=>{document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",v),document.removeEventListener("pointerout",f),document.removeEventListener("pointercancel",f),document.removeEventListener("touchmove",b),setTimeout((()=>{document.removeEventListener("click",g,{capture:!0})}),10)}};return t.addEventListener("pointerdown",l),()=>{h(),t.removeEventListener("pointerdown",l)}}(this.wrapper,((t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))}),(t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}),(t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))})))}getHeight(t,e){var i;const r=(null===(i=this.audioData)||void 0===i?void 0:i.numberOfChannels)||1;if(null==t)return 128;if(!isNaN(Number(t)))return Number(t);if("auto"===t){const t=this.parent.clientHeight||128;return(null==e?void 0:e.every((t=>!t.overlay)))?t/r:t}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"});return e.innerHTML=`\n <style>\n :host {\n user-select: none;\n min-width: 1px;\n }\n :host audio {\n display: block;\n width: 100%;\n }\n :host .scroll {\n overflow-x: auto;\n overflow-y: hidden;\n width: 100%;\n position: relative;\n }\n :host .noScrollbar {\n scrollbar-color: transparent;\n scrollbar-width: none;\n }\n :host .noScrollbar::-webkit-scrollbar {\n display: none;\n -webkit-appearance: none;\n }\n :host .wrapper {\n position: relative;\n overflow: visible;\n z-index: 2;\n }\n :host .canvases {\n min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px;\n }\n :host .canvases > div {\n position: relative;\n }\n :host canvas {\n display: block;\n position: absolute;\n top: 0;\n image-rendering: pixelated;\n }\n :host .progress {\n pointer-events: none;\n position: absolute;\n z-index: 2;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n overflow: hidden;\n }\n :host .progress > div {\n position: relative;\n }\n :host .cursor {\n pointer-events: none;\n position: absolute;\n z-index: 5;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: 2px;\n }\n </style>\n\n <div class="scroll" part="scroll">\n <div class="wrapper" part="wrapper">\n <div class="canvases" part="canvases"></div>\n <div class="progress" part="progress"></div>\n <div class="cursor" part="cursor"></div>\n </div>\n </div>\n `,[t,e]}setOptions(t){if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}!0!==t.dragToSeek&&"object"!=typeof this.options.dragToSeek||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,i=e*t;this.setScroll(i)}destroy(){var t,e;this.subscriptions.forEach((t=>t())),this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(e=this.unsubscribeOnScroll)||void 0===e||e.call(this)}createDelay(){let t,e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const r=()=>{t&&clearTimeout(t),e&&e()};return this.timeouts.push(r),()=>new Promise(((n,s)=>{r(),e=s,t=setTimeout((()=>{t=void 0,e=void 0,n()}),i)}))}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const e=document.createElement("canvas"),i=e.getContext("2d"),r=e.height*(window.devicePixelRatio||1),n=i.createLinearGradient(0,0,0,r),s=1/(t.length-1);return t.forEach(((t,e)=>{const i=e*s;n.addColorStop(i,t)})),n}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,e,i,r){const n=t[0],s=t[1]||t[0],o=n.length,{width:a,height:h}=i.canvas,l=h/2,d=this.getPixelRatio(),c=e.barWidth?e.barWidth*d:1,u=e.barGap?e.barGap*d:e.barWidth?c/2:0,p=e.barRadius||0,m=a/(c+u)/o,v=p&&"roundRect"in i?"roundRect":"rect";i.beginPath();let f=0,g=0,b=0;for(let y=0;y<=o;y++){const t=Math.round(y*m);if(t>f){const n=Math.round(g*l*r),s=n+Math.round(b*l*r)||1;let o=l-n;"top"===e.barAlign?o=0:"bottom"===e.barAlign&&(o=h-s),i[v](f*(c+u),o,c,s,p),f=t,g=0,b=0}const o=Math.abs(n[y]||0),a=Math.abs(s[y]||0);o>g&&(g=o),a>b&&(b=a)}i.fill(),i.closePath()}renderLineWaveform(t,e,i,r){const n=e=>{const n=t[e]||t[0],s=n.length,{height:o}=i.canvas,a=o/2,h=i.canvas.width/s;i.moveTo(0,a);let l=0,d=0;for(let t=0;t<=s;t++){const s=Math.round(t*h);if(s>l){const t=a+(Math.round(d*a*r)||1)*(0===e?-1:1);i.lineTo(l,t),l=s,d=0}const o=Math.abs(n[t]||0);o>d&&(d=o)}i.lineTo(l,a)};i.beginPath(),n(0),n(1),i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor),e.renderFunction)return void e.renderFunction(t,i);let r=e.barHeight||1;if(e.normalize){const e=Array.from(t[0]).reduce(((t,e)=>Math.max(t,Math.abs(e))),0);r=e?1/e:1}e.barWidth||e.barGap||e.barAlign?this.renderBarWaveform(t,e,i,r):this.renderLineWaveform(t,e,i,r)}renderSingleCanvas(t,e,i,r,n,s,o){const a=this.getPixelRatio(),h=document.createElement("canvas");h.width=Math.round(i*a),h.height=Math.round(r*a),h.style.width=`${i}px`,h.style.height=`${r}px`,h.style.left=`${Math.round(n)}px`,s.appendChild(h);const l=h.getContext("2d");if(this.renderWaveform(t,e,l),h.width>0&&h.height>0){const t=h.cloneNode(),i=t.getContext("2d");i.drawImage(h,0,0),i.globalCompositeOperation="source-in",i.fillStyle=this.convertColorValues(e.progressColor),i.fillRect(0,0,h.width,h.height),o.appendChild(t)}}renderMultiCanvas(t,e,i,r,n,s){const o=this.getPixelRatio(),{clientWidth:a}=this.scrollContainer;if(a*o>=i)return void this.renderSingleCanvas(t,e,a,r,0,n,s);const h=i/o;let l=Math.min(c.MAX_CANVAS_WIDTH,a,h),d={};if(e.barWidth||e.barGap){const t=e.barWidth||.5,i=t+(e.barGap||t/2);l%i!=0&&(l=Math.floor(l/i)*i)}const u=i=>{if(i<0||i>=p)return;if(d[i])return;d[i]=!0;const o=i*l,a=Math.min(h-o,l);if(a<=0)return;const c=t.map((t=>{const e=Math.floor(o/h*t.length),i=Math.floor((o+a)/h*t.length);return t.slice(e,i)}));this.renderSingleCanvas(c,e,a,r,o,n,s)},p=Math.ceil(h/l),m=this.scrollContainer.scrollLeft/h,v=Math.floor(m*p);u(v-1),u(v),u(v+1),p>1&&(this.unsubscribeOnScroll=this.on("scroll",(()=>{const{scrollLeft:t}=this.scrollContainer,e=Math.floor(t/h*p);Object.keys(d).length>c.MAX_NODES&&(n.innerHTML="",s.innerHTML="",d={}),u(e-1),u(e),u(e+1)})))}renderChannel(t,e,i,r){var{overlay:n}=e,s=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i}(e,["overlay"]);const o=document.createElement("div"),a=this.getHeight(s.height,s.splitChannels);o.style.height=`${a}px`,n&&r>0&&(o.style.marginTop=`-${a}px`),this.canvasWrapper.style.minHeight=`${a}px`,this.canvasWrapper.appendChild(o);const h=o.cloneNode();this.progressWrapper.appendChild(h),this.renderMultiCanvas(t,s,i,a,o,h)}render(t){return r(this,void 0,void 0,(function*(){var e;this.timeouts.forEach((t=>t())),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",null!=this.options.width&&(this.scrollContainer.style.width="number"==typeof this.options.width?`${this.options.width}px`:this.options.width);const i=this.getPixelRatio(),r=this.scrollContainer.clientWidth,n=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=n>r;const s=this.options.fillParent&&!this.isScrollable,o=(s?r:n)*i;if(this.wrapper.style.width=s?"100%":`${n}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let a=0;a<t.numberOfChannels;a++){const i=Object.assign(Object.assign({},this.options),null===(e=this.options.splitChannels)||void 0===e?void 0:e[a]);this.renderChannel([t.getChannelData(a)],i,o,a)}else{const e=[t.getChannelData(0)];t.numberOfChannels>1&&e.push(t.getChannelData(1)),this.renderChannel(e,this.options,o,0)}Promise.resolve().then((()=>this.emit("rendered")))}))}reRender(){var t;if(null===(t=this.unsubscribeOnScroll)||void 0===t||t.call(this),delete this.unsubscribeOnScroll,!this.audioData)return;const{scrollWidth:e}=this.scrollContainer,{right:i}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&e!==this.scrollContainer.scrollWidth){const{right:t}=this.progressWrapper.getBoundingClientRect();let e=t-i;e*=2,e=e<0?Math.floor(e):Math.ceil(e),e/=2,this.scrollContainer.scrollLeft+=e}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{scrollLeft:i,scrollWidth:r,clientWidth:n}=this.scrollContainer,s=t*r,o=i,a=i+n,h=n/2;if(this.isDragging){const t=30;s+t>a?this.scrollContainer.scrollLeft+=t:s-t<o&&(this.scrollContainer.scrollLeft-=t)}else{(s<o||s>a)&&(this.scrollContainer.scrollLeft=s-(this.options.autoCenter?h:0));const t=s-i-h;e&&this.options.autoCenter&&t>0&&(this.scrollContainer.scrollLeft+=Math.min(t,10))}{const t=this.scrollContainer.scrollLeft,e=t/r,i=(t+n)/r;this.emit("scroll",e,i,t,t+n)}}renderProgress(t,e){if(isNaN(t))return;const i=100*t;this.canvasWrapper.style.clipPath=`polygon(${i}% 0, 100% 0, 100% 100%, ${i}% 100%)`,this.progressWrapper.style.width=`${i}%`,this.cursor.style.left=`${i}%`,this.cursor.style.transform=`translateX(-${100===Math.round(i)?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,e)}exportImage(t,e,i){return r(this,void 0,void 0,(function*(){const r=this.canvasWrapper.querySelectorAll("canvas");if(!r.length)throw new Error("No waveform data");if("dataURL"===i){const i=Array.from(r).map((i=>i.toDataURL(t,e)));return Promise.resolve(i)}return Promise.all(Array.from(r).map((i=>new Promise(((r,n)=>{i.toBlob((t=>{t?r(t):n(new Error("Could not export image"))}),t,e)})))))}))}}c.MAX_CANVAS_WIDTH=8e3,c.MAX_NODES=10;class u extends n{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",(()=>{requestAnimationFrame((()=>{this.emit("tick")}))})),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class p extends n{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new AudioContext;super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return r(this,void 0,void 0,(function*(){}))}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then((e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()})).then((e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e))).then((e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())}))}_play(){var t;if(!this.paused)return;this.paused=!1,null===(t=this.bufferNode)||void 0===t||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let e=this.playedDuration*this._playbackRate;e>=this.duration&&(e=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,e),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,null===(t=this.bufferNode)||void 0===t||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return r(this,void 0,void 0,(function*(){this.paused&&(this._play(),this.emit("play"))}))}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){var e,i;const r=t-this.currentTime;null===(e=this.bufferNode)||void 0===e||e.stop(this.audioContext.currentTime+r),null===(i=this.bufferNode)||void 0===i||i.addEventListener("ended",(()=>{this.bufferNode=null,this.pause()}),{once:!0})}setSinkId(t){return r(this,void 0,void 0,(function*(){return this.audioContext.setSinkId(t)}))}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playedDuration=t/this._playbackRate,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return null!==(t=this._duration)&&void 0!==t?t:(null===(e=this.buffer)||void 0===e?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const e=this.buffer.numberOfChannels;for(let i=0;i<e;i++)t.push(this.buffer.getChannelData(i));return t}}const m={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class v extends d{static create(t){return new v(t)}constructor(t){const e=t.media||("WebAudio"===t.backend?new p:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},m,t),this.timer=new u;const i=e?void 0:this.getMediaElement();this.renderer=new c(this.options,i),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const r=this.options.url||this.getSrc()||"";Promise.resolve().then((()=>{this.emit("init");const{peaks:t,duration:e}=this.options;(r||t&&e)&&this.load(r,t,e).catch((()=>null))}))}updateProgress(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getCurrentTime();return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",(()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t)}})))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",(()=>{const t=this.updateProgress();this.emit("timeupdate",t)})),this.onMediaEvent("play",(()=>{this.emit("play"),this.timer.start()})),this.onMediaEvent("pause",(()=>{this.emit("pause"),this.timer.stop()})),this.onMediaEvent("emptied",(()=>{this.timer.stop()})),this.onMediaEvent("ended",(()=>{this.emit("finish")})),this.onMediaEvent("seeking",(()=>{this.emit("seeking",this.getCurrentTime())})),this.onMediaEvent("error",(t=>{this.emit("error",t.error)})))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",((t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))})),this.renderer.on("dblclick",((t,e)=>{this.emit("dblclick",t,e)})),this.renderer.on("scroll",((t,e,i,r)=>{const n=this.getDuration();this.emit("scroll",t*n,e*n,i,r)})),this.renderer.on("render",(()=>{this.emit("redraw")})),this.renderer.on("rendered",(()=>{this.emit("redrawcomplete")})),this.renderer.on("dragstart",(t=>{this.emit("dragstart",t)})),this.renderer.on("dragend",(t=>{this.emit("dragend",t)})));{let t;this.subscriptions.push(this.renderer.on("drag",(e=>{if(!this.options.interact)return;let i;this.renderer.renderProgress(e),clearTimeout(t),this.isPlaying()?i=0:!0===this.options.dragToSeek?i=200:"object"==typeof this.options.dragToSeek&&void 0!==this.options.dragToSeek&&(i=this.options.dragToSeek.debounceTime),t=setTimeout((()=>{this.seekTo(e)}),i),this.emit("interaction",e*this.getDuration()),this.emit("drag",e)})))}}initPlugins(){var t;(null===(t=this.options.plugins)||void 0===t?void 0:t.length)&&this.options.plugins.forEach((t=>{this.registerPlugin(t)}))}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach((t=>t())),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),null!=t.mediaControls&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){return t._init(this),this.plugins.push(t),this.subscriptions.push(t.once("destroy",(()=>{this.plugins=this.plugins.filter((e=>e!==t))}))),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,i,n){return r(this,void 0,void 0,(function*(){var r;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,!e&&!i){const i=this.options.fetchParams||{};window.AbortController&&!i.signal&&(this.abortController=new AbortController,i.signal=null===(r=this.abortController)||void 0===r?void 0:r.signal);const n=t=>this.emit("loading",t);e=yield l.fetchBlob(t,n,i)}this.setSrc(t,e);const o=yield new Promise((t=>{const e=n||this.getDuration();e?t(e):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",(()=>t(this.getDuration())),{once:!0}))}));if(!t&&!e){const t=this.getMediaElement();t instanceof p&&(t.duration=o)}if(i)this.decodedData=s.createBuffer(i,o||0);else if(e){const t=yield e.arrayBuffer();this.decodedData=yield s.decode(t,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())}))}load(t,e,i){return r(this,void 0,void 0,(function*(){try{return yield this.loadAudio(t,void 0,e,i)}catch(r){throw this.emit("error",r),r}}))}loadBlob(t,e,i){return r(this,void 0,void 0,(function*(){try{return yield this.loadAudio("",t,e,i)}catch(r){throw this.emit("error",r),r}}))}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks(){let{channels:t=2,maxLength:e=8e3,precision:i=1e4}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.decodedData)throw new Error("The audio has not been decoded yet");const r=Math.min(t,this.decodedData.numberOfChannels),n=[];for(let s=0;s<r;s++){const t=this.decodedData.getChannelData(s),r=[],o=t.length/e;for(let n=0;n<e;n++){const e=t.slice(Math.floor(n*o),Math.ceil((n+1)*o));let s=0;for(let t=0;t<e.length;t++){const i=e[t];Math.abs(i)>Math.abs(s)&&(s=i)}r.push(Math.round(s*i)/i)}n.push(r)}return n}getDuration(){let t=super.getDuration()||0;return 0!==t&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}playPause(){return r(this,void 0,void 0,(function*(){return this.isPlaying()?this.pause():this.play()}))}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return r(this,arguments,void 0,(function(){var t=this;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"dataURL";return function*(){return t.renderer.exportImage(e,i,r)}()}))}destroy(){var t;this.emit("destroy"),null===(t=this.abortController)||void 0===t||t.abort(),this.plugins.forEach((t=>t.destroy())),this.subscriptions.forEach((t=>t())),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}v.BasePlugin=class extends n{constructor(t){super(),this.subscriptions=[],this.options=t}onInit(){}_init(t){this.wavesurfer=t,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((t=>t()))}},v.dom=h}}]);
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|