@stlite/desktop 0.96.0 → 0.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/bin/dump_artifacts.js +1 -1
- package/build/assets/{ErrorOutline.esm-_LuTQzkr-BFWi9Uuj.js → ErrorOutline.esm-lsdlHF0t-DG4LSxex.js} +1 -1
- package/build/assets/{FileDownload.esm-CUqXYNk4-DieQ2Qle.js → FileDownload.esm-B67hf_fm-CYQKuYJG.js} +1 -1
- package/build/assets/FileHelper-CfZ5yPb2-CNHTcjh9.js +5 -0
- package/build/assets/{FormClearHelper-C58X4iX0-CI3cpm91.js → FormClearHelper-XrLdNEJa-DVEjd1cV.js} +1 -1
- package/build/assets/{InputInstructions-BSpH125g-CSupbuK3.js → InputInstructions-UPXPLzmg-Q7bu80af.js} +2 -2
- package/build/assets/Particles-BG5hjQKX-C7A0Knla.js +1 -0
- package/build/assets/{ProgressBar-CQHaVJeY-Bo6RDYz5.js → ProgressBar-E3DTwBEC-BjaNqN1B.js} +2 -2
- package/build/assets/StreamlitSyntaxHighlighter-CzihVVQU-DKtwdTjA.js +9 -0
- package/build/assets/TableChart.esm-DTCdMC22-C2aHYx-P.js +1 -0
- package/build/assets/Toolbar-DencJ98c--L3IVNu_.js +1 -0
- package/build/assets/UploadFileInfo-DdcsXhjv-m2CBXl3F.js +1 -0
- package/build/assets/WidgetLabelHelpIconInline-DFAc7fKv-BB1k3kRL.js +1 -0
- package/build/assets/_baseAssignValue-D2hePX0_-CX8WO6Yp.js +1 -0
- package/build/assets/{base-input-CAXjxi6E-LJzeEbPm.js → base-input-BPl9JMAl-yC1GT4Gd.js} +3 -3
- package/build/assets/{checkbox-OEhCo8NJ-C1rXZb97.js → checkbox-BCtTdZut-CgBE95kP.js} +2 -2
- package/build/assets/createDownloadLinkElement-D-zJ1ZGH-MUElf4MM.js +1 -0
- package/build/assets/createSuper-Csct9QVD-vLz3pY3G.js +1 -0
- package/build/assets/data-grid-overlay-editor-58Vv1cYM-BTQbyoqC.js +1 -0
- package/build/assets/{downloader-DcCTL3Wz-Dj-02g6N.js → downloader-DcCTL3Wz-CCWe5qlA.js} +1 -1
- package/build/assets/{embed-DJe7ZhON-C4OnDOK-.js → embed-4M_Y1tyc-DYkZAF8O.js} +14 -14
- package/build/assets/{es6--XPcqeHG-2BbC2xK9.js → es6--XPcqeHG-7ATg0sOb.js} +2 -2
- package/build/assets/formatMoment-DEtsTHwA-BeQagUzn.js +1 -0
- package/build/assets/formatNumber-ep44bWil-jKcj-W8C.js +1 -0
- package/build/assets/iconPosition-D6yC8Xnj-BF1h45AJ.js +1 -0
- package/build/assets/iframeResizer.contentWindow-nTwp-zqr-CtsMNeCZ.js +1 -0
- package/build/assets/index--TzMnXzp-DAvnEXlj.js +1 -0
- package/build/assets/index--qHBza9B-Cw3TTMgu.js +1 -0
- package/build/assets/index-B-mlHTWW-DxFrd5NG.js +1 -0
- package/build/assets/{index-Cbq5ClnA-Ct1ftt5G.js → index-B-vlNoRi-Cx4hHKp7.js} +1 -1
- package/build/assets/{index-CF9SDiIL-0Yw8O39Y.js → index-B7jXK8tg-DQuHfWI9.js} +1 -1
- package/build/assets/index-BFmSYBo1-C1-2gL1R.js +2 -0
- package/build/assets/{index-Cp-N8m1m-CSwdpflI.js → index-BIskStic-GEaJjVf4.js} +3 -3
- package/build/assets/index-BmOxzNZt-CNMeXzFc.js +1 -0
- package/build/assets/{index-DfPnrVLL-B6NKOBTt.js → index-BmPxToPj-BM0EGyRT.js} +1 -1
- package/build/assets/index-BmXuG0WA-D_Ql4e0d.js +3 -0
- package/build/assets/index-BtV4cH-G-DZqE8EFk.js +1 -0
- package/build/assets/index-BwXCTp7d-CbCsXHhb.js +6 -0
- package/build/assets/index-BwaRZjpn-BcW7Mc-p.js +1 -0
- package/build/assets/index-BzkAb_Ru-BoJQq1Du.js +1 -0
- package/build/assets/{index-NPM6VaN3-C-0cbqN2.js → index-C5pyI-9n-BoqvCp9L.js} +1 -1
- package/build/assets/index-CHTMxzEE-CdrOqTD2.js +1 -0
- package/build/assets/index-CJJUSpBk-Cjx3_stH.js +2 -0
- package/build/assets/{index-Bck9VlwE-zB2PlFuX.js → index-CWwI7Day-CBbcYz7C.js} +3 -3
- package/build/assets/{index-DttfDE80-GomZzukD.js → index-CYKyPdc--DXQt2pbH.js} +1 -1
- package/build/assets/index-CYavJtAA-CEB9mFy5.js +11 -0
- package/build/assets/index-C_AtJDfm-C2sFKVUp.js +1 -0
- package/build/assets/index-Cc93rxqK-qmLHI1ce.js +1 -0
- package/build/assets/index-CgwImjw9-vhGwcoU0.js +1 -0
- package/build/assets/{index-CY18be0x-Bq4JW-41.js → index-CiGWj_Vp-n6pbS_He.js} +1 -1
- package/build/assets/index-Cp9lKUfY-DCgJbJZE.js +1 -0
- package/build/assets/index-CrLOtTTY-_bXB7Npw.js +2 -0
- package/build/assets/{index-BHN72E4J-BztQAHMJ.js → index-CuAftQdk-D76l7Kt4.js} +1 -1
- package/build/assets/{index-R0bDPfYF-CRQIdCoC.js → index-D0DUjycF-DZpBbVrj.js} +2 -2
- package/build/assets/index-D1pkaPju-DGUZOgpo.js +1 -0
- package/build/assets/index-D6IEgvdJ-B-rltr1-.js +1 -0
- package/build/assets/index-D9TZavtE.css +1 -0
- package/build/assets/{index-BwqdV017-BaIzlXlX.js → index-DQ7wfL_P-DAp2jN40.js} +2 -2
- package/build/assets/{index-BrYfiXJ9-D7No2wma.js → index-DR-j-FYy-DJdOMdE8.js} +1 -1
- package/build/assets/index-DUNdG0N4-BKyH_Fci.js +2 -0
- package/build/assets/index-Df-1Z3LJ-bsVAaBS1.js +1 -0
- package/build/assets/index-Dfye6cAn-CH-9suNF.js +1 -0
- package/build/assets/index-DhMU6AlU-DzPhysZa.js +3789 -0
- package/build/assets/index-DjAHjI25-oZ9XAxp1.js +27 -0
- package/build/assets/index-DlPzHASD-B0KSeIYY.js +1 -0
- package/build/assets/index-DrLK8ov3-Stod2ydK.js +2 -0
- package/build/assets/index-DtFJwl5H-Dn2VZIyI.js +1 -0
- package/build/assets/{index-CJA4Tdig-Rs7zFCTh.js → index-DuZXLtJ1-BxktJ87b.js} +1 -1
- package/build/assets/index-H5hDyygX-DMvEgj-E.js +1 -0
- package/build/assets/index-LD7yKakY-9tfSlqzu.js +1 -0
- package/build/assets/index-LeNVxf2A-B46Z4XAZ.js +1 -0
- package/build/assets/index-QsvFitQg-IS60zSNc.js +1 -0
- package/build/assets/index-YCKUmi7k-wKVbmOTE.js +1 -0
- package/build/assets/index-f_0uAugs-KaRkqnk8.js +1 -0
- package/build/assets/index-nhNM5UeG.js +185 -0
- package/build/assets/index-pi_S-NOw-DHRw2FEx.js +198 -0
- package/build/assets/index-saRTHQRt-Cep0ox_U.js +1 -0
- package/build/assets/{input-5gXdrXd2-J6HaBKjM.js → input-BZGQFBY5-B-EqzVpf.js} +2 -2
- package/build/assets/{main-DvFfgny--BkQIK2a9.js → main-DD_nsVBV-B-nG1zNN.js} +1 -1
- package/build/assets/{memory-B3L1Fctl-mli5o0A1.js → memory-B3L1Fctl-Dwxd_AN8.js} +1 -1
- package/build/assets/number-overlay-editor--_WCmOH8-DebLrQQ4.js +9 -0
- package/build/assets/numbro-CBbENDeu-C6X7Pww4.js +1 -0
- package/build/assets/{pandasStylerUtils-BvB3vP-L-D9viw-G9.js → pandasStylerUtils-DlCnQunN-DDd07kWa.js} +1 -1
- package/build/assets/possibleConstructorReturn-i7eTFBhJ-BnzuGOIJ.js +1 -0
- package/build/assets/record-CvRL89xC-Cpipd1Kv.js +1 -0
- package/build/assets/{sandbox-ChAzL-i--CSnZJIg8.js → sandbox-ChAzL-i--CrJOWfYj.js} +1 -1
- package/build/assets/{styled-components-DkuYntx5-DrGZZlKf.js → styled-components-Dq_iSDU9-i1eh3pWs.js} +1 -1
- package/build/assets/{timepicker-BMxsIjZb-Uq5-wJ6H.js → timepicker-CL-801So-Sc5MVKGZ.js} +3 -3
- package/build/assets/toConsumableArray-CCohTQYb-ClE5WF0y.js +3 -0
- package/build/assets/uniqueId-CWWNkcH4-CJJowNJ2.js +1 -0
- package/build/assets/{useBasicWidgetState-CzHHKP20-CGMCneWD.js → useBasicWidgetState-BYeS5Lnw-COvJBdtg.js} +1 -1
- package/build/assets/{useIntlLocale-5C0LAQxq-ow_F-T5t.js → useIntlLocale-D1zv6Q2y-BpOVDRdF.js} +9 -9
- package/build/assets/{useTextInputAutoExpand-BMCOrWKx-DmoV3o2_.js → useTextInputAutoExpand-DEesfW0v-Cv12Lx8Q.js} +2 -2
- package/build/assets/{useUpdateUiValue-BtVkPggP-4VTS40xs.js → useUpdateUiValue-DDoOKBFH-DrpUtoEl.js} +1 -1
- package/build/assets/{useWaveformController-DuJh2iwj-BQGl9KsR.js → useWaveformController-Betfr4kn-B9JLTJ93.js} +1 -1
- package/build/assets/wavesurfer.esm-idh1jvYE-D4Wwdy60.js +74 -0
- package/build/assets/withCalculatedWidth-ZZ9bYZZd-CtbnrMaD.js +1 -0
- package/build/assets/{withFullScreenWrapper-wajYPLRg-e8FnO2xN.js → withFullScreenWrapper-B-PKqZVg-DWJ8sEV7.js} +1 -1
- package/build/index.html +2 -2
- package/package.json +3 -3
- package/wheels/streamlit-1.53.1-cp313-none-any.whl +0 -0
- package/build/assets/FileHelper-DbeeBEs5-Co0d-OBP.js +0 -5
- package/build/assets/Particles-6ak5Hlgw-4VTgCETZ.js +0 -1
- package/build/assets/StreamlitSyntaxHighlighter-DSYWFRjz-B77VB7yz.js +0 -8
- package/build/assets/Toolbar-Cr9ArNQU-D5-awBnv.js +0 -1
- package/build/assets/UploadFileInfo-B5SttewO-BfvME59S.js +0 -1
- package/build/assets/_baseAssignValue-3fAevQ7t-BOcc6F75.js +0 -1
- package/build/assets/createDownloadLinkElement-CbRjLJ8e-NbV49OP9.js +0 -1
- package/build/assets/createSuper-bIcQlS98-B8MWK81T.js +0 -1
- package/build/assets/data-grid-overlay-editor-DbHL3o_S-CiO7EIHu.js +0 -1
- package/build/assets/iframeResizer.contentWindow-9ByjY9IM-BBpPzlnE.js +0 -1
- package/build/assets/index-10RiWKwV-Cn-PcXb4.js +0 -3
- package/build/assets/index-47jAZmzN-8ZV_muwb.js +0 -1
- package/build/assets/index-99W3Zegr-DhiLonYo.js +0 -1
- package/build/assets/index-BGCCnxH2-jQwb1QhH.js +0 -1
- package/build/assets/index-BSOGSXpv-Bd9gyoUy.js +0 -27
- package/build/assets/index-BVhYQGzc-Do7aV0dQ.js +0 -1
- package/build/assets/index-BVuioNdm-CVDd_GaD.js +0 -1
- package/build/assets/index-BYGDMULw-4dwQq_lE.js +0 -1
- package/build/assets/index-B_94eI3S-ADuW4ppz.js +0 -6
- package/build/assets/index-Bdi0ug4X.js +0 -181
- package/build/assets/index-C6MBr137-B6bz_i6a.js +0 -1
- package/build/assets/index-CAtZcI5--D0BcKLsl.js +0 -2
- package/build/assets/index-CFA5JkEa-DUK-7VD7.js +0 -1
- package/build/assets/index-CaWaI2PT-DvorZu2G.js +0 -2
- package/build/assets/index-CceTm1nk-D-m7sDsR.js +0 -1
- package/build/assets/index-CucLKMvI-CdFsTlcF.js +0 -1
- package/build/assets/index-CxZCITs0-CLi85oo1.js +0 -1
- package/build/assets/index-D3vT_IC--BZlisRXs.js +0 -3789
- package/build/assets/index-D5L-gN8f-Bny7-WhK.js +0 -11
- package/build/assets/index-D7zRUNKG-2cwkh8qP.js +0 -1
- package/build/assets/index-D8RPh1xj-BLIXkU4c.js +0 -1
- package/build/assets/index-DNE2UpRK-CMtd92Tg.js +0 -1
- package/build/assets/index-D_5mY4iN-C3O2lE89.js +0 -1
- package/build/assets/index-DnTjZ9IR.css +0 -1
- package/build/assets/index-Do4wh7Iw-cPdQGRDQ.js +0 -1
- package/build/assets/index-DwedDN1c-C-Y3cCQP.js +0 -1
- package/build/assets/index-Fvxtopfe-CxLnCat0.js +0 -1
- package/build/assets/index-G4vqu33f-DO7BfNY6.js +0 -1
- package/build/assets/index-KWOwopwF-CN_5PcLU.js +0 -2
- package/build/assets/index-Q4xI4OhR-D81jje-l.js +0 -1
- package/build/assets/index-R1QyBsfg-tcyjJ4fb.js +0 -1
- package/build/assets/index-YOustUZZ-CX09XTf8.js +0 -2
- package/build/assets/index-b6W2ubHd-BapgUWLx.js +0 -1
- package/build/assets/index-h-ZgFEXT-DdL6EMUv.js +0 -2
- package/build/assets/index-lGTf3abu-B6CGTEed.js +0 -1
- package/build/assets/index-nXfHwIms-cOwCevci.js +0 -198
- package/build/assets/index-tU7dWFCN-DURbp79P.js +0 -1
- package/build/assets/inherits-Byw8NQvD-DdaLbWVP.js +0 -1
- package/build/assets/number-overlay-editor-BQ0qCmxT-5g_cUv4i.js +0 -9
- package/build/assets/record-DJsfODTt-CK8X1liM.js +0 -1
- package/build/assets/slicedToArray-CrkrjOeW-7_omneg6.js +0 -2
- package/build/assets/toConsumableArray-BpgQ3N5A-AHKfFeLf.js +0 -2
- package/build/assets/uniqueId-BrCTHDA7-CGglDaT_.js +0 -1
- package/build/assets/unsupportedIterableToArray-CFN3yOc2-C4SckrTc.js +0 -1
- package/build/assets/wavesurfer.esm-CzjpjtNs-CtBzisOM.js +0 -74
- package/build/assets/withCalculatedWidth-C0lBnc3E-BAFtxM9t.js +0 -1
- package/wheels/streamlit-1.52.2-cp313-none-any.whl +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
1
|
+
import{L as A,r as u,br as g,bs as F,bY as R,c4 as _,c5 as C}from"./index-nhNM5UeG.js";import{A as z,D as I,V as D,t as B}from"./base-input-BPl9JMAl-yC1GT4Gd.js";function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?w(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v=g("div",function(e){return l(l({},z(l(l({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})});v.displayName="StyledTextAreaRoot";v.displayName="StyledTextAreaRoot";var O=g("div",function(e){return I(l({$positive:!1},e))});O.displayName="StyledTextareaContainer";O.displayName="StyledTextareaContainer";var j=g("textarea",function(e){return l(l({},D(e)),{},{resize:e.$resize||"none"})});j.displayName="StyledTextarea";j.displayName="StyledTextarea";function h(e){"@babel/helpers - typeof";return h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(e)}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y.apply(this,arguments)}function k(e,t){return K(e)||U(e,t)||q(e,t)||L()}function L(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q(e,t){if(e){if(typeof e=="string")return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(e,t)}}function S(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function U(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,s;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(c){a=!0,s=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function K(e){if(Array.isArray(e))return e}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e,t,r){return t&&V(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Z(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},m(e,t)}function G(e){var t=Q();return function(){var r=b(e),n;if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return J(this,n)}}function J(e,t){if(t&&(h(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Q(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},b(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var W=(function(e){Z(r,e);var t=G(r);function r(){var n;M(this,r);for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=t.call.apply(t,[this].concat(a)),p(f(n),"state",{isFocused:n.props.autoFocus||!1}),p(f(n),"onFocus",function(s){n.setState({isFocused:!0}),n.props.onFocus(s)}),p(f(n),"onBlur",function(s){n.setState({isFocused:!1}),n.props.onBlur(s)}),n}return Y(r,[{key:"render",value:function(){var n=this.props.overrides,o=n===void 0?{}:n,a=F(o.Root,v),i=k(a,2),s=i[0],c=i[1],d=R({Input:{component:j},InputContainer:{component:O}},o);return u.createElement(s,y({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},c),u.createElement(B,y({},this.props,{type:C.textarea,overrides:d,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}]),r})(u.Component);p(W,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:_.default});const X=6.5,P=1,ee=e=>{let t=0;const{current:r}=e;return r&&(r.style.height="auto",t=r.scrollHeight,r.style.height=""),t},te=(e,t,r)=>e>0&&r.current?Math.abs(e-t)>P:!1,re=(e,t)=>{if(e.current&&t.current){const{offsetHeight:r}=e.current;t.current.minHeight=r,t.current.maxHeight=r*X}},ne=(e,t,r)=>e?`${t+P}px`:r?String(r):"",oe=e=>e?`${e}px`:"",ue=({textareaRef:e,dependencies:t=[]})=>{const r=A(),n=u.useRef({minHeight:0,maxHeight:0}),[o,a]=u.useState(0),[i,s]=u.useState(!1),c=u.useCallback(()=>{a(ee(e))},[e,a]),d=u.useCallback(()=>{a(0)},[a]);u.useLayoutEffect(()=>{e.current&&re(e,n)},[e]),u.useLayoutEffect(()=>{const{minHeight:H}=n.current;s(te(o,H,e))},[o,e]),u.useLayoutEffect(()=>{c()},[e,c,...t]);const{maxHeight:x}=n.current,E=r.sizes.minElementHeight,$=ne(i,o,E),T=oe(x);return{isExtended:i,height:$,maxHeight:T,updateScrollHeight:c,clearScrollHeight:d}};export{ue as p,W as r};
|
package/build/assets/{useUpdateUiValue-BtVkPggP-4VTS40xs.js → useUpdateUiValue-DDoOKBFH-DrpUtoEl.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,
|
|
1
|
+
import{r as c,cG as m}from"./index-nhNM5UeG.js";import{r as n}from"./inputUtils-DCYiajnz-DsrlAoKH.js";function p({formId:t,maxChars:e,setDirty:r,setUiValue:o,setValueWithSource:i,additionalAction:a}){return c.useCallback(u=>{const{value:l}=u.target;e!==0&&l.length>e||(r(!0),o(l),m({formId:t})&&i({value:l,fromUi:!0}),a&&a())},[t,e,r,o,i,a])}function b(t,e,r,o,i,a=!1){return c.useCallback(u=>{const l=a?u.metaKey||u.ctrlKey:!0;!n(u)||!l||(u.preventDefault(),r&&e(),o.allowFormEnterToSubmit(t)&&o.submitForm(t,i))},[t,i,r,e,o,a])}function d(t,e,r,o){c.useEffect(()=>{o||t!==e&&r(t)},[t,e,o,r])}export{p as a,b as c,d as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as G,r as i,bH as j,as as Q,bI as M}from"./index-Bdi0ug4X.js";async function X(c,e=16e3){if(!c||c.size===0)throw new Error("Invalid or empty blob provided");if(!window.AudioContext)throw new Error("AudioContext not supported in this browser");const n=new AudioContext;try{const s=await c.arrayBuffer(),r=await n.decodeAudioData(s),o=e??r.sampleRate,u=await Y(r,o);return Z(u,o)}finally{n.close()}}async function Y(c,e){const{duration:n,numberOfChannels:s,sampleRate:r}=c,o=Math.ceil(n*e);if(!window.OfflineAudioContext)throw new Error("OfflineAudioContext not supported");const u=new OfflineAudioContext(1,o,e),y=u.createBufferSource();if(y.buffer=c,s>1){const v=u.createChannelSplitter(s),p=u.createChannelMerger(1);y.connect(v);for(let l=0;l<s;l++){const d=u.createGain();d.gain.value=1/s,v.connect(d,l),d.connect(p,0,0)}p.connect(u.destination)}else y.connect(u.destination);y.start(0);try{return await u.startRendering()}catch(v){throw new Error(`Failed to resample audio from ${r}Hz to ${e}Hz: ${v instanceof Error?v.message:String(v)}`)}}function Z(c,e){const n=c.length,s=n*2+44,r=new ArrayBuffer(s),o=new DataView(r),u=c.getChannelData(0),y=(p,l)=>{for(let d=0;d<l.length;d++)o.setUint8(p+d,l.charCodeAt(d))};y(0,"RIFF"),o.setUint32(4,s-8,!0),y(8,"WAVE"),y(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,e,!0),o.setUint32(28,e*2,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),y(36,"data"),o.setUint32(40,n*2,!0);let v=44;for(let p=0;p<n;p++){const l=Math.max(-1,Math.min(1,u[p]));o.setInt16(v,l*32767,!0),v+=2}return new Blob([r],{type:"audio/wav"})}class _{constructor(){this.wavesurfer=null,this.currentBlobUrl=null,this.events={},this.isPlaying=!1}initialize(e){this.wavesurfer=e,this.setupEventListeners()}setupEventListeners(){this.wavesurfer&&(this.teardownEventListeners(),this.handleTimeUpdate=e=>{this.events.onTimeUpdate?.(e*1e3)},this.handlePause=()=>{this.isPlaying=!1,this.events.onPause?.()},this.handlePlay=()=>{this.isPlaying=!0,this.events.onPlay?.()},this.handleFinish=()=>{this.isPlaying=!1,this.events.onFinish?.()},this.handleReady=()=>{this.events.onReady?.()},this.handleError=e=>{const n=e instanceof Error?e:new Error(String(e));this.events.onError?.(n)},this.wavesurfer.on("timeupdate",this.handleTimeUpdate),this.wavesurfer.on("pause",this.handlePause),this.wavesurfer.on("play",this.handlePlay),this.wavesurfer.on("finish",this.handleFinish),this.wavesurfer.on("ready",this.handleReady),this.wavesurfer.on("error",this.handleError))}setEventHandlers(e){this.events=e}async load(e){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");this.cleanupPreviousUrl();let n,s=null;try{if(e instanceof Blob)s=URL.createObjectURL(e),n=s;else if(e instanceof ArrayBuffer){const r=new Blob([e]);s=URL.createObjectURL(r),n=s}else n=e;this.currentBlobUrl=s,await this.wavesurfer.load(n)}catch(r){throw this.cleanupPreviousUrl(),r}}async play(){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");await this.wavesurfer.play()}pause(){this.wavesurfer&&this.wavesurfer.pause()}getDuration(){return this.wavesurfer?this.wavesurfer.getDuration()*1e3:0}getCurrentTime(){return this.wavesurfer?this.wavesurfer.getCurrentTime()*1e3:0}getIsPlaying(){return this.isPlaying}seekToStart(){this.wavesurfer&&this.wavesurfer.seekTo(0)}cleanupPreviousUrl(){this.currentBlobUrl&&(URL.revokeObjectURL(this.currentBlobUrl),this.currentBlobUrl=null)}destroy(){this.pause(),this.cleanupPreviousUrl(),this.wavesurfer&&(this.teardownEventListeners(),this.wavesurfer.empty(),this.wavesurfer=null),this.events={},this.isPlaying=!1,this.handleTimeUpdate=void 0,this.handlePause=void 0,this.handlePlay=void 0,this.handleFinish=void 0,this.handleReady=void 0,this.handleError=void 0}teardownEventListeners(){this.wavesurfer&&(this.handleTimeUpdate&&(this.wavesurfer.un("timeupdate",this.handleTimeUpdate),this.handleTimeUpdate=void 0),this.handlePause&&(this.wavesurfer.un("pause",this.handlePause),this.handlePause=void 0),this.handlePlay&&(this.wavesurfer.un("play",this.handlePlay),this.handlePlay=void 0),this.handleFinish&&(this.wavesurfer.un("finish",this.handleFinish),this.handleFinish=void 0),this.handleReady&&(this.wavesurfer.un("ready",this.handleReady),this.handleReady=void 0),this.handleError&&(this.wavesurfer.un("error",this.handleError),this.handleError=void 0))}}function F(c){return c.name==="NotAllowedError"||c.name==="PermissionDeniedError"||c.message?.toLowerCase().includes("permission denied")}class q{constructor(e={}){this.wavesurfer=null,this.recordPlugin=null,this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null,this.events={},this.options=e}initialize(e,n){this.wavesurfer=e;try{const s={renderRecordedAudio:!1,mimeType:"audio/webm"};this.recordPlugin=e.registerPlugin(n.create(s)),this.setupEventListeners()}catch(s){const r=s instanceof Error?s:new Error(String(s));throw F(r)?(this.events.onPermissionDenied?.(),new Error("Microphone permission denied")):(this.events.onError?.(r),r)}}setupEventListeners(){this.recordPlugin&&(this.recordPlugin.on("record-start",()=>{this.isRecording=!0,this.events.onRecordStart?.()}),this.recordPlugin.on("record-end",e=>{this.isRecording=!1,this.events.onRecordEnd?.(e),this.recordEndResolve&&e&&e.size>0?(this.recordEndResolve(e),this.recordEndResolve=null,this.recordEndReject=null):this.recordEndReject?(this.recordEndReject(new Error("Invalid or empty recording")),this.recordEndResolve=null,this.recordEndReject=null):(this.recordEndResolve=null,this.recordEndReject=null)}),this.recordPlugin.on("record-progress",e=>{this.events.onRecordProgress?.(e)}))}setEventHandlers(e){this.events=e}async startRecording(){if(!this.recordPlugin)throw new Error("Record plugin not initialized");if(this.isRecording)return;const e=typeof this.options.sampleRate=="number"?this.options.sampleRate:void 0,n={};e!==void 0&&(n.sampleRate={ideal:e}),await this.startRecordingWithConstraints(n,e!==void 0)}async startRecordingWithConstraints(e,n){if(!this.recordPlugin)throw new Error("Record plugin not initialized");try{const s=Object.keys(e).length?e:void 0;await this.recordPlugin.startRecording(s)}catch(s){const r=s instanceof Error?s:new Error(String(s));if(F(r))throw this.events.onPermissionDenied?.(),new Error("Microphone permission denied");if(n&&(r.name==="OverconstrainedError"||r.name==="NotReadableError")){this.options.sampleRate=void 0,await this.startRecordingWithConstraints({},!1);return}throw this.events.onError?.(r),r}}async stopRecording(){if(!this.recordPlugin||!this.isRecording)throw new Error("Not currently recording");try{return new Promise((e,n)=>{this.recordEndResolve=e,this.recordEndReject=n,this.recordPlugin?.stopRecording()})}catch(e){const n=e instanceof Error?e:new Error(String(e));throw this.events.onError?.(n),n}}cancelRecording(){this.recordPlugin&&this.isRecording&&(this.recordPlugin.stopRecording(),this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null)}destroy(){this.cancelRecording(),this.recordPlugin&&(this.recordPlugin.destroy(),this.recordPlugin=null),this.wavesurfer=null,this.events={}}}const J=4,K=4,ee=8,re=0,te=16e3;function se({containerRef:c,sampleRate:e,events:n,waveformPadding:s=0}){const r=G(),[o,u]=i.useState("idle"),[y,v]=i.useState(null),[p,l]=i.useState(!1),d=i.useRef(null),g=i.useRef(null),a=i.useRef(null),h=i.useRef(n),z=i.useRef(!1),A=i.useRef(!1),E=i.useRef(new Set),P=i.useRef(!1),b=e===void 0?te:e,k=i.useCallback(()=>{E.current.clear(),l(!1),g.current&&(g.current.destroy(),g.current=null),a.current&&(a.current.destroy(),a.current=null),d.current&&(d.current.destroy(),d.current=null),z.current=!1,P.current=!1,u("idle"),v(null)},[]),O=i.useCallback(()=>{const t=Array.from(E.current);E.current.clear(),t.forEach(f=>{f.resolve()})},[]),L=i.useCallback(t=>{l(!1);const f=Array.from(E.current);E.current.clear(),f.forEach(w=>{w.reject(t)})},[]),U=i.useCallback(t=>{const f={onPlay:()=>{l(!0),h.current.onPlaybackPlay?.()},onPause:()=>{l(!1),h.current.onPlaybackPause?.()},onFinish:()=>{l(!1),h.current.onPlaybackFinish?.()},onReady:()=>{O()},onError:w=>{l(!1),L(w),h.current.onError?.(w)}};t.setEventHandlers(f)},[O,L]);i.useEffect(()=>{h.current=n,a.current&&U(a.current)},[n,U]);const T=i.useCallback(async()=>{if(!(z.current||A.current||!c.current)){A.current=!0;try{const[t,f]=await Promise.all([j(()=>import("./wavesurfer.esm-CzjpjtNs-CtBzisOM.js"),[]),j(()=>import("./record-DJsfODTt-CK8X1liM.js"),[])]),w=t.default,S=f.default,C=w.create({container:c.current,waveColor:r.colors.primary,progressColor:r.colors.bodyText,height:s>0?Q(r.sizes.largestElementHeight)-2*s:"auto",barWidth:J,barGap:K,barRadius:ee,cursorWidth:re,interact:!0});d.current=C,P.current=!1;const m=new q({sampleRate:b});m.initialize(C,S),m.setEventHandlers({onRecordProgress:B=>{h.current.onProgressMs?.(B)},onPermissionDenied:()=>{h.current.onPermissionDenied(),u("idle")},onError:B=>{h.current.onError(B),u("idle")}}),g.current=m;const R=new _;R.initialize(C),a.current=R,U(R),z.current=!0}catch(t){const f=t instanceof Error?t:new Error(String(t));h.current.onError?.(f)}finally{A.current=!1}}},[c,r,b,U,s]);i.useEffect(()=>(T(),()=>{k()}),[k,T]),i.useEffect(()=>{const t=d.current;if(t){if(o==="recording"){t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary});return}if(P.current){t.setOptions({interact:!0,waveColor:M(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText});return}t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.bodyText})}},[o,r.colors.bodyText,r.colors.fadedText40,r.colors.primary,r.colors.secondaryBg]);const H=i.useCallback(async()=>{if(o!=="recording"){if(z.current||await T(),!g.current)throw new Error("Record backend not initialized");d.current&&d.current.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary}),P.current=!1,await g.current.startRecording(),u("recording"),v(null),l(!1),h.current.onRecordStart?.()}},[o,T,r.colors.primary]),D=i.useCallback(()=>{a.current&&d.current&&(a.current.destroy(),a.current=new _,a.current.initialize(d.current),E.current.clear(),l(!1),U(a.current)),P.current=!1},[U]),x=i.useCallback(()=>{a.current?.seekToStart(),l(!1),P.current=!0,d.current&&d.current.setOptions({interact:!0,waveColor:M(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText})},[r.colors.bodyText,r.colors.fadedText40,r.colors.secondaryBg]),I=i.useCallback(async()=>{if(o!=="recording")throw new Error("Not currently recording");if(!g.current||!a.current)throw new Error("Backends not initialized");try{const t=await g.current.stopRecording();v(t),await new Promise((S,C)=>{if(!a.current){C(new Error("Player not initialized"));return}const m={resolve:()=>{E.current.delete(m),S()},reject:R=>{E.current.delete(m),C(R)}};E.current.add(m),a.current.load(t).catch(R=>{E.current.delete(m),C(R instanceof Error?R:new Error(String(R)))})}),u("idle"),l(!1),x();const f={durationMs:a.current?.getDuration()??0,sampleRate:typeof b=="number"?b:null,mimeType:t.type||"audio/webm",size:t.size},w={blob:t,meta:f};return h.current.onRecordReady?.(t),w}catch(t){const f=t instanceof Error?t:new Error(String(t));return l(!1),u("idle"),h.current.onError(f),{blob:new Blob,meta:{durationMs:0,sampleRate:null,mimeType:"audio/webm",size:0}}}},[o,x,b]),W=i.useCallback(async t=>{const f=t??y;if(!f){const w=new Error("No recorded audio to approve");h.current.onError(w);return}try{const w=await X(f,b);await h.current.onApprove?.(w),v(null),u("idle")}catch(w){const S=w instanceof Error?w:new Error(String(w));h.current.onError(S)}},[y,b]),N=i.useCallback(()=>{o==="recording"&&g.current?.cancelRecording(),D(),v(null),u("idle"),l(!1),P.current=!1,h.current.onCancel?.()},[o,D]),V=i.useMemo(()=>({isPlaying:()=>a.current?.getIsPlaying()??!1,play:async()=>{if(!a.current)throw new Error("Player not initialized");await a.current.play()},pause:()=>{a.current?.pause()},load:async t=>{if(z.current||await T(),!a.current)throw new Error("Player not initialized");await a.current.load(t),x()},getCurrentTimeMs:()=>a.current?.getCurrentTime()??0,getDurationMs:()=>a.current?.getDuration()??0}),[x,T]),$=i.useCallback(t=>{h.current=t},[]);return i.useEffect(()=>()=>{k()},[k]),{state:o,isPlaybackPlaying:p,mountRef:c,start:H,stop:I,approve:W,cancel:N,destroy:k,playback:V,setEventHandlers:$}}export{se as c};
|
|
1
|
+
import{L as $,r as i,bG as j,ar as Q,bH as M}from"./index-nhNM5UeG.js";async function X(c,e=16e3){if(!c||c.size===0)throw new Error("Invalid or empty blob provided");if(!window.AudioContext)throw new Error("AudioContext not supported in this browser");const n=new AudioContext;try{const s=await c.arrayBuffer(),r=await n.decodeAudioData(s),o=e??r.sampleRate,u=await Y(r,o);return Z(u,o)}finally{n.close()}}async function Y(c,e){const{duration:n,numberOfChannels:s,sampleRate:r}=c,o=Math.ceil(n*e);if(!window.OfflineAudioContext)throw new Error("OfflineAudioContext not supported");const u=new OfflineAudioContext(1,o,e),y=u.createBufferSource();if(y.buffer=c,s>1){const v=u.createChannelSplitter(s),p=u.createChannelMerger(1);y.connect(v);for(let l=0;l<s;l++){const d=u.createGain();d.gain.value=1/s,v.connect(d,l),d.connect(p,0,0)}p.connect(u.destination)}else y.connect(u.destination);y.start(0);try{return await u.startRendering()}catch(v){throw new Error(`Failed to resample audio from ${r}Hz to ${e}Hz: ${v instanceof Error?v.message:String(v)}`)}}function Z(c,e){const n=c.length,s=n*2+44,r=new ArrayBuffer(s),o=new DataView(r),u=c.getChannelData(0),y=(p,l)=>{for(let d=0;d<l.length;d++)o.setUint8(p+d,l.charCodeAt(d))};y(0,"RIFF"),o.setUint32(4,s-8,!0),y(8,"WAVE"),y(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,e,!0),o.setUint32(28,e*2,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),y(36,"data"),o.setUint32(40,n*2,!0);let v=44;for(let p=0;p<n;p++){const l=Math.max(-1,Math.min(1,u[p]));o.setInt16(v,l*32767,!0),v+=2}return new Blob([r],{type:"audio/wav"})}class _{constructor(){this.wavesurfer=null,this.currentBlobUrl=null,this.events={},this.isPlaying=!1}initialize(e){this.wavesurfer=e,this.setupEventListeners()}setupEventListeners(){this.wavesurfer&&(this.teardownEventListeners(),this.handleTimeUpdate=e=>{this.events.onTimeUpdate?.(e*1e3)},this.handlePause=()=>{this.isPlaying=!1,this.events.onPause?.()},this.handlePlay=()=>{this.isPlaying=!0,this.events.onPlay?.()},this.handleFinish=()=>{this.isPlaying=!1,this.events.onFinish?.()},this.handleReady=()=>{this.events.onReady?.()},this.handleError=e=>{const n=e instanceof Error?e:new Error(String(e));this.events.onError?.(n)},this.wavesurfer.on("timeupdate",this.handleTimeUpdate),this.wavesurfer.on("pause",this.handlePause),this.wavesurfer.on("play",this.handlePlay),this.wavesurfer.on("finish",this.handleFinish),this.wavesurfer.on("ready",this.handleReady),this.wavesurfer.on("error",this.handleError))}setEventHandlers(e){this.events=e}async load(e){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");this.cleanupPreviousUrl();let n,s=null;try{if(e instanceof Blob)s=URL.createObjectURL(e),n=s;else if(e instanceof ArrayBuffer){const r=new Blob([e]);s=URL.createObjectURL(r),n=s}else n=e;this.currentBlobUrl=s,await this.wavesurfer.load(n)}catch(r){throw this.cleanupPreviousUrl(),r}}async play(){if(!this.wavesurfer)throw new Error("WaveSurfer not initialized");await this.wavesurfer.play()}pause(){this.wavesurfer&&this.wavesurfer.pause()}getDuration(){return this.wavesurfer?this.wavesurfer.getDuration()*1e3:0}getCurrentTime(){return this.wavesurfer?this.wavesurfer.getCurrentTime()*1e3:0}getIsPlaying(){return this.isPlaying}seekToStart(){this.wavesurfer&&this.wavesurfer.seekTo(0)}cleanupPreviousUrl(){this.currentBlobUrl&&(URL.revokeObjectURL(this.currentBlobUrl),this.currentBlobUrl=null)}destroy(){this.pause(),this.cleanupPreviousUrl(),this.wavesurfer&&(this.teardownEventListeners(),this.wavesurfer.empty(),this.wavesurfer=null),this.events={},this.isPlaying=!1,this.handleTimeUpdate=void 0,this.handlePause=void 0,this.handlePlay=void 0,this.handleFinish=void 0,this.handleReady=void 0,this.handleError=void 0}teardownEventListeners(){this.wavesurfer&&(this.handleTimeUpdate&&(this.wavesurfer.un("timeupdate",this.handleTimeUpdate),this.handleTimeUpdate=void 0),this.handlePause&&(this.wavesurfer.un("pause",this.handlePause),this.handlePause=void 0),this.handlePlay&&(this.wavesurfer.un("play",this.handlePlay),this.handlePlay=void 0),this.handleFinish&&(this.wavesurfer.un("finish",this.handleFinish),this.handleFinish=void 0),this.handleReady&&(this.wavesurfer.un("ready",this.handleReady),this.handleReady=void 0),this.handleError&&(this.wavesurfer.un("error",this.handleError),this.handleError=void 0))}}function F(c){return c.name==="NotAllowedError"||c.name==="PermissionDeniedError"||c.message?.toLowerCase().includes("permission denied")}class q{constructor(e={}){this.wavesurfer=null,this.recordPlugin=null,this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null,this.events={},this.options=e}initialize(e,n){this.wavesurfer=e;try{const s={renderRecordedAudio:!1,mimeType:"audio/webm"};this.recordPlugin=e.registerPlugin(n.create(s)),this.setupEventListeners()}catch(s){const r=s instanceof Error?s:new Error(String(s));throw F(r)?(this.events.onPermissionDenied?.(),new Error("Microphone permission denied")):(this.events.onError?.(r),r)}}setupEventListeners(){this.recordPlugin&&(this.recordPlugin.on("record-start",()=>{this.isRecording=!0,this.events.onRecordStart?.()}),this.recordPlugin.on("record-end",e=>{this.isRecording=!1,this.events.onRecordEnd?.(e),this.recordEndResolve&&e&&e.size>0?(this.recordEndResolve(e),this.recordEndResolve=null,this.recordEndReject=null):this.recordEndReject?(this.recordEndReject(new Error("Invalid or empty recording")),this.recordEndResolve=null,this.recordEndReject=null):(this.recordEndResolve=null,this.recordEndReject=null)}),this.recordPlugin.on("record-progress",e=>{this.events.onRecordProgress?.(e)}))}setEventHandlers(e){this.events=e}async startRecording(){if(!this.recordPlugin)throw new Error("Record plugin not initialized");if(this.isRecording)return;const e=typeof this.options.sampleRate=="number"?this.options.sampleRate:void 0,n={};e!==void 0&&(n.sampleRate={ideal:e}),await this.startRecordingWithConstraints(n,e!==void 0)}async startRecordingWithConstraints(e,n){if(!this.recordPlugin)throw new Error("Record plugin not initialized");try{const s=Object.keys(e).length?e:void 0;await this.recordPlugin.startRecording(s)}catch(s){const r=s instanceof Error?s:new Error(String(s));if(F(r))throw this.events.onPermissionDenied?.(),new Error("Microphone permission denied");if(n&&(r.name==="OverconstrainedError"||r.name==="NotReadableError")){this.options.sampleRate=void 0,await this.startRecordingWithConstraints({},!1);return}throw this.events.onError?.(r),r}}async stopRecording(){if(!this.recordPlugin||!this.isRecording)throw new Error("Not currently recording");try{return await new Promise((e,n)=>{this.recordEndResolve=e,this.recordEndReject=n,this.recordPlugin?.stopRecording()})}catch(e){const n=e instanceof Error?e:new Error(String(e));throw this.events.onError?.(n),n}}cancelRecording(){this.recordPlugin&&this.isRecording&&(this.recordPlugin.stopRecording(),this.isRecording=!1,this.recordEndResolve=null,this.recordEndReject=null)}destroy(){this.cancelRecording(),this.recordPlugin&&(this.recordPlugin.destroy(),this.recordPlugin=null),this.wavesurfer=null,this.events={}}}const J=4,K=4,ee=8,re=0,te=16e3;function se({containerRef:c,sampleRate:e,events:n,waveformPadding:s=0}){const r=$(),[o,u]=i.useState("idle"),[y,v]=i.useState(null),[p,l]=i.useState(!1),d=i.useRef(null),g=i.useRef(null),a=i.useRef(null),h=i.useRef(n),z=i.useRef(!1),A=i.useRef(!1),E=i.useRef(new Set),P=i.useRef(!1),b=e===void 0?te:e,k=i.useCallback(()=>{E.current.clear(),l(!1),g.current&&(g.current.destroy(),g.current=null),a.current&&(a.current.destroy(),a.current=null),d.current&&(d.current.destroy(),d.current=null),z.current=!1,P.current=!1,u("idle"),v(null)},[]),L=i.useCallback(()=>{const t=Array.from(E.current);E.current.clear(),t.forEach(f=>{f.resolve()})},[]),O=i.useCallback(t=>{l(!1);const f=Array.from(E.current);E.current.clear(),f.forEach(w=>{w.reject(t)})},[]),U=i.useCallback(t=>{const f={onPlay:()=>{l(!0),h.current.onPlaybackPlay?.()},onPause:()=>{l(!1),h.current.onPlaybackPause?.()},onFinish:()=>{l(!1),h.current.onPlaybackFinish?.()},onReady:()=>{L()},onError:w=>{l(!1),O(w),h.current.onError?.(w)}};t.setEventHandlers(f)},[L,O]);i.useEffect(()=>{h.current=n,a.current&&U(a.current)},[n,U]);const T=i.useCallback(async()=>{if(!(z.current||A.current||!c.current)){A.current=!0;try{const[t,f]=await Promise.all([j(()=>import("./wavesurfer.esm-idh1jvYE-D4Wwdy60.js"),[]),j(()=>import("./record-CvRL89xC-Cpipd1Kv.js"),[])]),w=t.default,S=f.default,C=w.create({container:c.current,waveColor:r.colors.primary,progressColor:r.colors.bodyText,height:s>0?Q(r.sizes.largestElementHeight)-2*s:"auto",barWidth:J,barGap:K,barRadius:ee,cursorWidth:re,interact:!0});d.current=C,P.current=!1;const m=new q({sampleRate:b});m.initialize(C,S),m.setEventHandlers({onRecordProgress:B=>{h.current.onProgressMs?.(B)},onPermissionDenied:()=>{h.current.onPermissionDenied(),u("idle")},onError:B=>{h.current.onError(B),u("idle")}}),g.current=m;const R=new _;R.initialize(C),a.current=R,U(R),z.current=!0}catch(t){const f=t instanceof Error?t:new Error(String(t));h.current.onError?.(f)}finally{A.current=!1}}},[c,r,b,U,s]);i.useEffect(()=>(T(),()=>{k()}),[k,T]),i.useEffect(()=>{const t=d.current;if(t){if(o==="recording"){t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary});return}if(P.current){t.setOptions({interact:!0,waveColor:M(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText});return}t.setOptions({waveColor:r.colors.primary,progressColor:r.colors.bodyText})}},[o,r.colors.bodyText,r.colors.fadedText40,r.colors.primary,r.colors.secondaryBg]);const H=i.useCallback(async()=>{if(o!=="recording"){if(z.current||await T(),!g.current)throw new Error("Record backend not initialized");d.current&&d.current.setOptions({waveColor:r.colors.primary,progressColor:r.colors.primary}),P.current=!1,await g.current.startRecording(),u("recording"),v(null),l(!1),h.current.onRecordStart?.()}},[o,T,r.colors.primary]),D=i.useCallback(()=>{a.current&&d.current&&(a.current.destroy(),a.current=new _,a.current.initialize(d.current),E.current.clear(),l(!1),U(a.current)),P.current=!1},[U]),x=i.useCallback(()=>{a.current?.seekToStart(),l(!1),P.current=!0,d.current&&d.current.setOptions({interact:!0,waveColor:M(r.colors.fadedText40,r.colors.secondaryBg),progressColor:r.colors.bodyText})},[r.colors.bodyText,r.colors.fadedText40,r.colors.secondaryBg]),I=i.useCallback(async()=>{if(o!=="recording")throw new Error("Not currently recording");if(!g.current||!a.current)throw new Error("Backends not initialized");try{const t=await g.current.stopRecording();v(t),await new Promise((S,C)=>{if(!a.current){C(new Error("Player not initialized"));return}const m={resolve:()=>{E.current.delete(m),S()},reject:R=>{E.current.delete(m),C(R)}};E.current.add(m),a.current.load(t).catch(R=>{E.current.delete(m),C(R instanceof Error?R:new Error(String(R)))})}),u("idle"),l(!1),x();const f={durationMs:a.current?.getDuration()??0,sampleRate:typeof b=="number"?b:null,mimeType:t.type||"audio/webm",size:t.size},w={blob:t,meta:f};return h.current.onRecordReady?.(t),w}catch(t){const f=t instanceof Error?t:new Error(String(t));return l(!1),u("idle"),h.current.onError(f),{blob:new Blob,meta:{durationMs:0,sampleRate:null,mimeType:"audio/webm",size:0}}}},[o,x,b]),W=i.useCallback(async t=>{const f=t??y;if(!f){const w=new Error("No recorded audio to approve");h.current.onError(w);return}try{const w=await X(f,b);await h.current.onApprove?.(w),v(null),u("idle")}catch(w){const S=w instanceof Error?w:new Error(String(w));h.current.onError(S)}},[y,b]),N=i.useCallback(()=>{o==="recording"&&g.current?.cancelRecording(),D(),v(null),u("idle"),l(!1),P.current=!1,h.current.onCancel?.()},[o,D]),V=i.useMemo(()=>({isPlaying:()=>a.current?.getIsPlaying()??!1,play:async()=>{if(!a.current)throw new Error("Player not initialized");await a.current.play()},pause:()=>{a.current?.pause()},load:async t=>{if(z.current||await T(),!a.current)throw new Error("Player not initialized");await a.current.load(t),x()},getCurrentTimeMs:()=>a.current?.getCurrentTime()??0,getDurationMs:()=>a.current?.getDuration()??0}),[x,T]),G=i.useCallback(t=>{h.current=t},[]);return i.useEffect(()=>()=>{k()},[k]),{state:o,isPlaybackPlaying:p,mountRef:c,start:H,stop:I,approve:W,cancel:N,destroy:k,playback:V,setEventHandlers:G}}export{se as c};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
function x(c,t,e,i){return new(e||(e=Promise))(function(s,n){function r(o){try{l(i.next(o))}catch(h){n(h)}}function a(o){try{l(i.throw(o))}catch(h){n(h)}}function l(o){var h;o.done?s(o.value):(h=o.value,h instanceof e?h:new e(function(p){p(h)})).then(r,a)}l((i=i.apply(c,t||[])).next())})}class H{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),i?.once){const s=(...n)=>{this.un(t,s),e(...n)};return this.listeners[t].add(s),()=>this.un(t,s)}return this.listeners[t].add(e),()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}}const N={decode:function(c,t){return x(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});try{return yield e.decodeAudioData(c)}finally{e.close()}})},createBuffer:function(c,t){if(!c||c.length===0)throw new Error("channelData must be a non-empty array");if(t<=0)throw new Error("duration must be greater than 0");if(typeof c[0]=="number"&&(c=[c]),!c[0]||c[0].length===0)throw new Error("channelData must contain non-empty channel arrays");(function(i){const s=i[0];if(s.some(n=>n>1||n<-1)){const n=s.length;let r=0;for(let a=0;a<n;a++){const l=Math.abs(s[a]);l>r&&(r=l)}for(const a of i)for(let l=0;l<n;l++)a[l]/=r}})(c);const e=c.map(i=>i instanceof Float32Array?i:Float32Array.from(i));return{duration:t,length:e[0].length,sampleRate:e[0].length/t,numberOfChannels:e.length,getChannelData:i=>{const s=e[i];if(!s)throw new Error(`Channel ${i} not found`);return s},copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function G(c,t){const e=t.xmlns?document.createElementNS(t.xmlns,c):document.createElement(c);for(const[i,s]of Object.entries(t))if(i==="children"&&s)for(const[n,r]of Object.entries(s))r instanceof Node?e.appendChild(r):typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(G(n,r));else i==="style"?Object.assign(e.style,s):i==="textContent"?e.textContent=s:e.setAttribute(i,s.toString());return e}function F(c,t,e){const i=G(c,t||{});return e?.appendChild(i),i}var K=Object.freeze({__proto__:null,createElement:F,default:F});const Q={fetchBlob:function(c,t,e){return x(this,void 0,void 0,function*(){const i=yield fetch(c,e);if(i.status>=400)throw new Error(`Failed to fetch ${c}: ${i.status} (${i.statusText})`);return(function(s,n){x(this,void 0,void 0,function*(){if(!s.body||!s.headers)return;const r=s.body.getReader(),a=Number(s.headers.get("Content-Length"))||0;let l=0;const o=h=>{l+=h?.length||0;const p=Math.round(l/a*100);n(p)};try{for(;;){const h=yield r.read();if(h.done)break;o(h.value)}}catch(h){console.warn("Progress tracking error:",h)}})})(i.clone(),t),i.blob()})}};function C(c){let t=c;const e=new Set;return{get value(){return t},set(i){Object.is(t,i)||(t=i,e.forEach(s=>s(t)))},update(i){this.set(i(t))},subscribe:i=>(e.add(i),()=>e.delete(i))}}function A(c,t){const e=C(c());return t.forEach(i=>i.subscribe(()=>{const s=c();Object.is(e.value,s)||e.set(s)})),{get value(){return e.value},subscribe:i=>e.subscribe(i)}}function _(c,t){let e;const i=()=>{e&&(e(),e=void 0),e=c()},s=t.map(n=>n.subscribe(i));return i(),()=>{e&&(e(),e=void 0),s.forEach(n=>n())}}class tt extends H{get isPlayingSignal(){return this._isPlaying}get currentTimeSignal(){return this._currentTime}get durationSignal(){return this._duration}get volumeSignal(){return this._volume}get mutedSignal(){return this._muted}get playbackRateSignal(){return this._playbackRate}get seekingSignal(){return this._seeking}constructor(t){super(),this.isExternalMedia=!1,this.reactiveMediaEventCleanups=[],t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),this._isPlaying=C(!1),this._currentTime=C(0),this._duration=C(0),this._volume=C(this.media.volume),this._muted=C(this.media.muted),this._playbackRate=C(this.media.playbackRate||1),this._seeking=C(!1),this.setupReactiveMediaEvents(),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}setupReactiveMediaEvents(){this.reactiveMediaEventCleanups.push(this.onMediaEvent("play",()=>{this._isPlaying.set(!0)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("pause",()=>{this._isPlaying.set(!1)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("ended",()=>{this._isPlaying.set(!1)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("timeupdate",()=>{this._currentTime.set(this.media.currentTime)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("durationchange",()=>{this._duration.set(this.media.duration||0)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("loadedmetadata",()=>{this._duration.set(this.media.duration||0)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("seeking",()=>{this._seeking.set(!0)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("seeked",()=>{this._seeking.set(!1)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("volumechange",()=>{this._volume.set(this.media.volume),this._muted.set(this.media.muted)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("ratechange",()=>{this._playbackRate.set(this.media.playbackRate)}))}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 s=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(i&&this.media.removeAttribute("src"),s||t)try{this.media.src=s}catch{this.media.src=t}}destroy(){this.reactiveMediaEventCleanups.forEach(t=>t()),this.reactiveMediaEventCleanups=[],this.isExternalMedia||(this.media.pause(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load(),this.media.remove())}setMediaElement(t){this.reactiveMediaEventCleanups.forEach(e=>e()),this.reactiveMediaEventCleanups=[],this.media=t,this.setupReactiveMediaEvents()}play(){return x(this,void 0,void 0,function*(){try{return yield this.media.play()}catch(t){if(t instanceof DOMException&&t.name==="AbortError")return;throw t}})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}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){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}function et({maxTop:c,maxBottom:t,halfHeight:e,vScale:i,barMinHeight:s=0,barAlign:n}){let r=Math.round(c*e*i),a=r+Math.round(t*e*i)||1;return a<s&&(a=s,n||(r=a/2)),{topHeight:r,totalHeight:a}}function it({barAlign:c,halfHeight:t,topHeight:e,totalHeight:i,canvasHeight:s}){return c==="top"?0:c==="bottom"?s-i:t-e}function X(c,t,e){const i=t-c.left,s=e-c.top;return[i/c.width,s/c.height]}function U(c){return!!(c.barWidth||c.barGap||c.barAlign)}function V(c,t){if(!U(t))return c;const e=t.barWidth||.5,i=e+(t.barGap||e/2);return i===0?c:Math.floor(c/i)*i}function q({scrollLeft:c,totalWidth:t,numCanvases:e}){if(t===0)return[0];const i=c/t,s=Math.floor(i*e);return[s-1,s,s+1]}function Y(c){const t=c._cleanup;typeof t=="function"&&t()}function st(c){const t=C({scrollLeft:c.scrollLeft,scrollWidth:c.scrollWidth,clientWidth:c.clientWidth}),e=A(()=>(function(n){const{scrollLeft:r,scrollWidth:a,clientWidth:l}=n;if(a===0)return{startX:0,endX:1};const o=r/a,h=(r+l)/a;return{startX:Math.max(0,Math.min(1,o)),endX:Math.max(0,Math.min(1,h))}})(t.value),[t]),i=A(()=>(function(n){return{left:n.scrollLeft,right:n.scrollLeft+n.clientWidth}})(t.value),[t]),s=()=>{t.set({scrollLeft:c.scrollLeft,scrollWidth:c.scrollWidth,clientWidth:c.clientWidth})};return c.addEventListener("scroll",s,{passive:!0}),{scrollData:t,percentages:e,bounds:i,cleanup:()=>{c.removeEventListener("scroll",s),Y(t)}}}class nt extends H{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.dragStream=null,this.scrollStream=null,this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[s,n]=this.initHtml();i.appendChild(s),this.container=s,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(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){this.wrapper.addEventListener("click",e=>{const i=this.wrapper.getBoundingClientRect(),[s,n]=X(i,e.clientX,e.clientY);this.emit("click",s,n)}),this.wrapper.addEventListener("dblclick",e=>{const i=this.wrapper.getBoundingClientRect(),[s,n]=X(i,e.clientX,e.clientY);this.emit("dblclick",s,n)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollStream=st(this.scrollContainer);const t=_(()=>{const{startX:e,endX:i}=this.scrollStream.percentages.value,{left:s,right:n}=this.scrollStream.bounds.value;this.emit("scroll",e,i,s,n)},[this.scrollStream.percentages,this.scrollStream.bounds]);if(this.subscriptions.push(t),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender(),this.emit("resize"))}initDrag(){if(this.dragStream)return;this.dragStream=(function(e,i={}){const{threshold:s=3,mouseButton:n=0,touchDelay:r=100}=i,a=C(null),l=new Map,o=matchMedia("(pointer: coarse)").matches;let h=()=>{};const p=d=>{if(d.button!==n||(l.set(d.pointerId,d),l.size>1))return;let m=d.clientX,u=d.clientY,g=!1;const v=Date.now(),P=e.getBoundingClientRect(),{left:E,top:k}=P,w=b=>{if(b.defaultPrevented||l.size>1||o&&Date.now()-v<r)return;const R=b.clientX,D=b.clientY,W=R-m,L=D-u;(g||Math.abs(W)>s||Math.abs(L)>s)&&(b.preventDefault(),b.stopPropagation(),g||(a.set({type:"start",x:m-E,y:u-k}),g=!0),a.set({type:"move",x:R-E,y:D-k,deltaX:W,deltaY:L}),m=R,u=D)},S=b=>{if(l.delete(b.pointerId),g){const R=b.clientX,D=b.clientY;a.set({type:"end",x:R-E,y:D-k})}h()},y=b=>{l.delete(b.pointerId),b.relatedTarget&&b.relatedTarget!==document.documentElement||S(b)},M=b=>{g&&(b.stopPropagation(),b.preventDefault())},T=b=>{b.defaultPrevented||l.size>1||g&&b.preventDefault()};document.addEventListener("pointermove",w),document.addEventListener("pointerup",S),document.addEventListener("pointerout",y),document.addEventListener("pointercancel",y),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("click",M,{capture:!0}),h=()=>{document.removeEventListener("pointermove",w),document.removeEventListener("pointerup",S),document.removeEventListener("pointerout",y),document.removeEventListener("pointercancel",y),document.removeEventListener("touchmove",T),setTimeout(()=>{document.removeEventListener("click",M,{capture:!0})},10)}};return e.addEventListener("pointerdown",p),{signal:a,cleanup:()=>{h(),e.removeEventListener("pointerdown",p),l.clear(),Y(a)}}})(this.wrapper);const t=_(()=>{const e=this.dragStream.signal.value;if(!e)return;const i=this.wrapper.getBoundingClientRect().width,s=(n=e.x/i)<0?0:n>1?1:n;var n;e.type==="start"?(this.isDragging=!0,this.emit("dragstart",s)):e.type==="move"?this.emit("drag",s):e.type==="end"&&(this.isDragging=!1,this.emit("dragend",s))},[this.dragStream.signal]);this.subscriptions.push(t)}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
|
|
2
|
+
<style${i?` nonce="${i}"`:""}>
|
|
3
|
+
:host {
|
|
4
|
+
user-select: none;
|
|
5
|
+
min-width: 1px;
|
|
6
|
+
}
|
|
7
|
+
:host audio {
|
|
8
|
+
display: block;
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
:host .scroll {
|
|
12
|
+
overflow-x: auto;
|
|
13
|
+
overflow-y: hidden;
|
|
14
|
+
width: 100%;
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
:host .noScrollbar {
|
|
18
|
+
scrollbar-color: transparent;
|
|
19
|
+
scrollbar-width: none;
|
|
20
|
+
}
|
|
21
|
+
:host .noScrollbar::-webkit-scrollbar {
|
|
22
|
+
display: none;
|
|
23
|
+
-webkit-appearance: none;
|
|
24
|
+
}
|
|
25
|
+
:host .wrapper {
|
|
26
|
+
position: relative;
|
|
27
|
+
overflow: visible;
|
|
28
|
+
z-index: 2;
|
|
29
|
+
}
|
|
30
|
+
:host .canvases {
|
|
31
|
+
min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
}
|
|
34
|
+
:host .canvases > div {
|
|
35
|
+
position: relative;
|
|
36
|
+
}
|
|
37
|
+
:host canvas {
|
|
38
|
+
display: block;
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: 0;
|
|
41
|
+
image-rendering: pixelated;
|
|
42
|
+
}
|
|
43
|
+
:host .progress {
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
position: absolute;
|
|
46
|
+
z-index: 2;
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
width: 0;
|
|
50
|
+
height: 100%;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
}
|
|
53
|
+
:host .progress > div {
|
|
54
|
+
position: relative;
|
|
55
|
+
}
|
|
56
|
+
:host .cursor {
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
position: absolute;
|
|
59
|
+
z-index: 5;
|
|
60
|
+
top: 0;
|
|
61
|
+
left: 0;
|
|
62
|
+
height: 100%;
|
|
63
|
+
border-radius: 2px;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
66
|
+
|
|
67
|
+
<div class="scroll" part="scroll">
|
|
68
|
+
<div class="wrapper" part="wrapper">
|
|
69
|
+
<div class="canvases" part="canvases"></div>
|
|
70
|
+
<div class="progress" part="progress"></div>
|
|
71
|
+
<div class="cursor" part="cursor"></div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
`,[t,e]}setOptions(t){var e;if(this.options.container!==t.container){const i=this.parentFromOptionsContainer(t.container);i.appendChild(this.container),this.parent=i}t.dragToSeek===!0||typeof this.options.dragToSeek=="object"?this.initDrag():((e=this.dragStream)===null||e===void 0||e.cleanup(),this.dragStream=null),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;this.subscriptions.forEach(e=>e()),this.container.remove(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),(t=this.unsubscribeOnScroll)===null||t===void 0||t.forEach(e=>e()),this.unsubscribeOnScroll=[],this.dragStream&&(this.dragStream.cleanup(),this.dragStream=null),this.scrollStream&&(this.scrollStream.cleanup(),this.scrollStream=null)}createDelay(t=10){let e,i;const s=()=>{e&&(clearTimeout(e),e=void 0),i&&(i(),i=void 0)};return this.timeouts.push(s),()=>new Promise((n,r)=>{s(),i=r,e=setTimeout(()=>{e=void 0,i=void 0,n()},t)})}getHeight(t,e){var i;const s=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;return(function({optionsHeight:n,optionsSplitChannels:r,parentHeight:a,numberOfChannels:l,defaultHeight:o=128}){if(n==null)return o;const h=Number(n);if(!isNaN(h))return h;if(n==="auto"){const p=a||o;return r?.every(d=>!d.overlay)?p/l:p}return o})({optionsHeight:t,optionsSplitChannels:e,parentHeight:this.parent.clientHeight,numberOfChannels:s,defaultHeight:128})}convertColorValues(t,e){return(function(i,s,n){if(!Array.isArray(i))return i||"";if(i.length===0)return"#999";if(i.length<2)return i[0]||"";const r=document.createElement("canvas"),a=r.getContext("2d"),l=n??r.height*s,o=a.createLinearGradient(0,0,0,l||s),h=1/(i.length-1);return i.forEach((p,d)=>{o.addColorStop(d*h,p)}),o})(t,this.getPixelRatio(),e?.canvas.height)}getPixelRatio(){return t=window.devicePixelRatio,Math.max(1,t||1);var t}renderBarWaveform(t,e,i,s){const{width:n,height:r}=i.canvas,{halfHeight:a,barWidth:l,barRadius:o,barIndexScale:h,barSpacing:p,barMinHeight:d}=(function({width:u,height:g,length:v,options:P,pixelRatio:E}){const k=g/2,w=P.barWidth?P.barWidth*E:1,S=P.barGap?P.barGap*E:P.barWidth?w/2:0,y=w+S||1;return{halfHeight:k,barWidth:w,barGap:S,barRadius:P.barRadius||0,barMinHeight:P.barMinHeight?P.barMinHeight*E:0,barIndexScale:v>0?u/y/v:0,barSpacing:y}})({width:n,height:r,length:(t[0]||[]).length,options:e,pixelRatio:this.getPixelRatio()}),m=(function({channelData:u,barIndexScale:g,barSpacing:v,barWidth:P,halfHeight:E,vScale:k,canvasHeight:w,barAlign:S,barMinHeight:y}){const M=u[0]||[],T=u[1]||M,b=M.length,R=[];let D=0,W=0,L=0;for(let f=0;f<=b;f++){const O=Math.round(f*g);if(O>D){const{topHeight:Z,totalHeight:j}=et({maxTop:W,maxBottom:L,halfHeight:E,vScale:k,barMinHeight:y,barAlign:S}),J=it({barAlign:S,halfHeight:E,topHeight:Z,totalHeight:j,canvasHeight:w});R.push({x:D*v,y:J,width:P,height:j}),D=O,W=0,L=0}const I=Math.abs(M[f]||0),$=Math.abs(T[f]||0);I>W&&(W=I),$>L&&(L=$)}return R})({channelData:t,barIndexScale:h,barSpacing:p,barWidth:l,halfHeight:a,vScale:s,canvasHeight:r,barAlign:e.barAlign,barMinHeight:d});i.beginPath();for(const u of m)o&&"roundRect"in i?i.roundRect(u.x,u.y,u.width,u.height,o):i.rect(u.x,u.y,u.width,u.height);i.fill(),i.closePath()}renderLineWaveform(t,e,i,s){const{width:n,height:r}=i.canvas,a=(function({channelData:l,width:o,height:h,vScale:p}){const d=h/2,m=l[0]||[];return[m,l[1]||m].map((u,g)=>{const v=u.length,P=v?o/v:0,E=d,k=g===0?-1:1,w=[{x:0,y:E}];let S=0,y=0;for(let M=0;M<=v;M++){const T=Math.round(M*P);if(T>S){const R=E+(Math.round(y*d*p)||1)*k;w.push({x:S,y:R}),S=T,y=0}const b=Math.abs(u[M]||0);b>y&&(y=b)}return w.push({x:S,y:E}),w})})({channelData:t,width:n,height:r,vScale:s});i.beginPath();for(const l of a)if(l.length){i.moveTo(l[0].x,l[0].y);for(let o=1;o<l.length;o++){const h=l[o];i.lineTo(h.x,h.y)}}i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor,i),e.renderFunction)return void e.renderFunction(t,i);const s=(function({channelData:n,barHeight:r,normalize:a,maxPeak:l}){var o;const h=r||1;if(!a)return h;const p=n[0];if(!p||p.length===0)return h;let d=l??0;if(!l)for(let m=0;m<p.length;m++){const u=(o=p[m])!==null&&o!==void 0?o:0,g=Math.abs(u);g>d&&(d=g)}return d?h/d:h})({channelData:t,barHeight:e.barHeight,normalize:e.normalize,maxPeak:e.maxPeak});U(e)?this.renderBarWaveform(t,e,i,s):this.renderLineWaveform(t,e,i,s)}renderSingleCanvas(t,e,i,s,n,r,a){const l=this.getPixelRatio(),o=document.createElement("canvas");o.width=Math.round(i*l),o.height=Math.round(s*l),o.style.width=`${i}px`,o.style.height=`${s}px`,o.style.left=`${Math.round(n)}px`,r.appendChild(o);const h=o.getContext("2d");if(e.renderFunction?(h.fillStyle=this.convertColorValues(e.waveColor,h),e.renderFunction(t,h)):this.renderWaveform(t,e,h),o.width>0&&o.height>0){const p=o.cloneNode(),d=p.getContext("2d");d.drawImage(o,0,0),d.globalCompositeOperation="source-in",d.fillStyle=this.convertColorValues(e.progressColor,d),d.fillRect(0,0,o.width,o.height),a.appendChild(p)}}renderMultiCanvas(t,e,i,s,n,r){const a=this.getPixelRatio(),{clientWidth:l}=this.scrollContainer,o=i/a,h=(function({clientWidth:u,totalWidth:g,options:v}){return V(Math.min(8e3,u,g),v)})({clientWidth:l,totalWidth:o,options:e});let p={};if(h===0)return;const d=u=>{if(u<0||u>=m||p[u])return;p[u]=!0;const g=u*h;let v=Math.min(o-g,h);if(v=V(v,e),v<=0)return;const P=(function({channelData:E,offset:k,clampedWidth:w,totalWidth:S}){return E.map(y=>{const M=Math.floor(k/S*y.length),T=Math.floor((k+w)/S*y.length);return y.slice(M,T)})})({channelData:t,offset:g,clampedWidth:v,totalWidth:o});this.renderSingleCanvas(P,e,v,s,g,n,r)},m=Math.ceil(o/h);if(!this.isScrollable){for(let u=0;u<m;u++)d(u);return}if(q({scrollLeft:this.scrollContainer.scrollLeft,totalWidth:o,numCanvases:m}).forEach(u=>d(u)),m>1){const u=this.on("scroll",()=>{const{scrollLeft:g}=this.scrollContainer;Object.keys(p).length>10&&(n.innerHTML="",r.innerHTML="",p={}),q({scrollLeft:g,totalWidth:o,numCanvases:m}).forEach(v=>d(v))});this.unsubscribeOnScroll.push(u)}}renderChannel(t,e,i,s){var{overlay:n}=e,r=(function(h,p){var d={};for(var m in h)Object.prototype.hasOwnProperty.call(h,m)&&p.indexOf(m)<0&&(d[m]=h[m]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function"){var u=0;for(m=Object.getOwnPropertySymbols(h);u<m.length;u++)p.indexOf(m[u])<0&&Object.prototype.propertyIsEnumerable.call(h,m[u])&&(d[m[u]]=h[m[u]])}return d})(e,["overlay"]);const a=document.createElement("div"),l=this.getHeight(r.height,r.splitChannels);a.style.height=`${l}px`,n&&s>0&&(a.style.marginTop=`-${l}px`),this.canvasWrapper.style.minHeight=`${l}px`,this.canvasWrapper.appendChild(a);const o=a.cloneNode();this.progressWrapper.appendChild(o),this.renderMultiCanvas(t,r,i,l,a,o)}render(t){return x(this,void 0,void 0,function*(){var e;this.timeouts.forEach(o=>o()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const i=this.getPixelRatio(),s=this.scrollContainer.clientWidth,{scrollWidth:n,isScrollable:r,useParentWidth:a,width:l}=(function({duration:o,minPxPerSec:h=0,parentWidth:p,fillParent:d,pixelRatio:m}){const u=Math.ceil(o*h),g=u>p,v=!!(d&&!g);return{scrollWidth:u,isScrollable:g,useParentWidth:v,width:(v?p:u)*m}})({duration:t.duration,minPxPerSec:this.options.minPxPerSec||0,parentWidth:s,fillParent:this.options.fillParent,pixelRatio:i});if(this.isScrollable=r,this.wrapper.style.width=a?"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 o=0;o<t.numberOfChannels;o++){const h=Object.assign(Object.assign({},this.options),(e=this.options.splitChannels)===null||e===void 0?void 0:e[o]);this.renderChannel([t.getChannelData(o)],h,l,o)}else{const o=[t.getChannelData(0)];t.numberOfChannels>1&&o.push(t.getChannelData(1)),this.renderChannel(o,this.options,l,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(i=>i()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:e}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:i}=this.progressWrapper.getBoundingClientRect(),s=(function(n){const r=2*n;return(r<0?Math.floor(r):Math.ceil(r))/2})(i-e);this.scrollContainer.scrollLeft+=s}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:i,scrollWidth:s,clientWidth:n}=this.scrollContainer,r=t*s,a=i,l=i+n,o=n/2;if(this.isDragging)r+30>l?this.scrollContainer.scrollLeft+=30:r-30<a&&(this.scrollContainer.scrollLeft-=30);else{(r<a||r>l)&&(this.scrollContainer.scrollLeft=r-(this.options.autoCenter?o:0));const h=r-i-o;e&&this.options.autoCenter&&h>0&&(this.scrollContainer.scrollLeft+=h)}}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=this.options.cursorWidth?`translateX(-${t*this.options.cursorWidth}px)`:"",this.isScrollable&&this.options.autoScroll&&this.audioData&&this.audioData.duration>0&&this.scrollIntoView(t,e)}exportImage(t,e,i){return x(this,void 0,void 0,function*(){const s=this.canvasWrapper.querySelectorAll("canvas");if(!s.length)throw new Error("No waveform data");if(i==="dataURL"){const n=Array.from(s).map(r=>r.toDataURL(t,e));return Promise.resolve(n)}return Promise.all(Array.from(s).map(n=>new Promise((r,a)=>{n.toBlob(l=>{l?r(l):a(new Error("Could not export image"))},t,e)})))})}}class rt extends H{constructor(){super(...arguments),this.animationFrameId=null,this.isRunning=!1}start(){if(this.isRunning)return;this.isRunning=!0;const t=()=>{this.isRunning&&(this.emit("tick"),this.animationFrameId=requestAnimationFrame(t))};t()}stop(){this.isRunning=!1,this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.stop()}}class B extends H{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playbackPosition=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 x(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())}).catch(e=>{console.error("WebAudioPlayer load error:",e)})}_play(){if(!this.paused)return;this.paused=!1,this.bufferNode&&(this.bufferNode.onended=null,this.bufferNode.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 t=this.playbackPosition;(t>=this.duration||t<0)&&(t=0,this.playbackPosition=0),this.bufferNode.start(this.audioContext.currentTime,t),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playbackPosition+=(this.audioContext.currentTime-this.playStartTime)*this._playbackRate}play(){return x(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const e=t-this.currentTime,i=this.bufferNode;i?.stop(this.audioContext.currentTime+e),i?.addEventListener("ended",()=>{i===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return x(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){const e=!this.paused;e&&this._pause(),this._playbackRate=t,e&&this._play(),this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return this.paused?this.playbackPosition:this.playbackPosition+(this.audioContext.currentTime-this.playStartTime)*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playbackPosition=t,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return(t=this._duration)!==null&&t!==void 0?t:((e=this.buffer)===null||e===void 0?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}removeAttribute(t){switch(t){case"src":this.src="";break;case"playbackRate":this.playbackRate=0;break;case"currentTime":this.currentTime=0;break;case"duration":this.duration=0;break;case"volume":this.volume=0;break;case"muted":this.muted=!1}}}const ot={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class z extends tt{static create(t){return new z(t)}getState(){return this.wavesurferState}getRenderer(){return this.renderer}constructor(t){const e=t.media||(t.backend==="WebAudio"?new B:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.reactiveCleanups=[],this.options=Object.assign({},ot,t);const{state:i,actions:s}=(function(a){var l,o,h,p,d,m;const u=(l=a?.currentTime)!==null&&l!==void 0?l:C(0),g=(o=a?.duration)!==null&&o!==void 0?o:C(0),v=(h=a?.isPlaying)!==null&&h!==void 0?h:C(!1),P=(p=a?.isSeeking)!==null&&p!==void 0?p:C(!1),E=(d=a?.volume)!==null&&d!==void 0?d:C(1),k=(m=a?.playbackRate)!==null&&m!==void 0?m:C(1),w=C(null),S=C(null),y=C(""),M=C(0),T=C(0),b=A(()=>!v.value,[v]),R=A(()=>w.value!==null,[w]),D=A(()=>R.value&&g.value>0,[R,g]),W=A(()=>u.value,[u]),L=A(()=>g.value>0?u.value/g.value:0,[u,g]);return{state:{currentTime:u,duration:g,isPlaying:v,isPaused:b,isSeeking:P,volume:E,playbackRate:k,audioBuffer:w,peaks:S,url:y,zoom:M,scrollPosition:T,canPlay:R,isReady:D,progress:W,progressPercent:L},actions:{setCurrentTime:f=>{const O=Math.max(0,Math.min(g.value||1/0,f));u.set(O)},setDuration:f=>{g.set(Math.max(0,f))},setPlaying:f=>{v.set(f)},setSeeking:f=>{P.set(f)},setVolume:f=>{const O=Math.max(0,Math.min(1,f));E.set(O)},setPlaybackRate:f=>{const O=Math.max(.1,Math.min(16,f));k.set(O)},setAudioBuffer:f=>{w.set(f),f&&g.set(f.duration)},setPeaks:f=>{S.set(f)},setUrl:f=>{y.set(f)},setZoom:f=>{M.set(Math.max(0,f))},setScrollPosition:f=>{T.set(Math.max(0,f))}}}})({isPlaying:this.isPlayingSignal,currentTime:this.currentTimeSignal,duration:this.durationSignal,volume:this.volumeSignal,playbackRate:this.playbackRateSignal,isSeeking:this.seekingSignal});this.wavesurferState=i,this.wavesurferActions=s,this.timer=new rt;const n=e?void 0:this.getMediaElement();this.renderer=new nt(this.options,n),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initReactiveState(),this.initPlugins();const r=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:a,duration:l}=this.options;(r||a&&l)&&this.load(r,a,l).catch(o=>{this.emit("error",o instanceof Error?o:new Error(String(o)))})})}updateProgress(t=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),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initReactiveState(){this.reactiveCleanups.push((function(t,e){const i=[];i.push(_(()=>{const r=t.isPlaying.value;e.emit(r?"play":"pause")},[t.isPlaying])),i.push(_(()=>{const r=t.currentTime.value;e.emit("timeupdate",r),t.isPlaying.value&&e.emit("audioprocess",r)},[t.currentTime,t.isPlaying])),i.push(_(()=>{t.isSeeking.value&&e.emit("seeking",t.currentTime.value)},[t.isSeeking,t.currentTime]));let s=!1;i.push(_(()=>{t.isReady.value&&!s&&(s=!0,e.emit("ready",t.duration.value))},[t.isReady,t.duration]));let n=!1;return i.push(_(()=>{const r=t.isPlaying.value,a=t.currentTime.value,l=t.duration.value,o=l>0&&a>=l;n&&!r&&o&&e.emit("finish"),n=r&&o},[t.isPlaying,t.currentTime,t.duration])),i.push(_(()=>{const r=t.zoom.value;r>0&&e.emit("zoom",r)},[t.zoom])),()=>{i.forEach(r=>r())}})(this.wavesurferState,{emit:this.emit.bind(this)}))}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.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}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,s)=>{const n=this.getDuration();this.emit("scroll",t*n,e*n,i,s)}),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)}),this.renderer.on("resize",()=>{this.emit("resize")}));{let t;const e=this.renderer.on("drag",i=>{var s;if(!this.options.interact)return;this.renderer.renderProgress(i),clearTimeout(t);let n=0;const r=this.options.dragToSeek;this.isPlaying()?n=0:r===!0?n=200:r&&typeof r=="object"&&(n=(s=r.debounceTime)!==null&&s!==void 0?s:200),t=setTimeout(()=>{this.seekTo(i)},n),this.emit("interaction",i*this.getDuration()),this.emit("drag",i)});this.subscriptions.push(()=>{clearTimeout(t),e()})}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(e=>{this.registerPlugin(e)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=N.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=N.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){if(this.plugins.includes(t))return t;t._init(this),this.plugins.push(t);const e=t.once("destroy",()=>{this.plugins=this.plugins.filter(i=>i!==t),this.subscriptions=this.subscriptions.filter(i=>i!==e)});return this.subscriptions.push(e),t}unregisterPlugin(t){this.plugins=this.plugins.filter(e=>e!==t),t.destroy()}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,s){return x(this,void 0,void 0,function*(){var n;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=null,!e&&!i){const a=this.options.fetchParams||{};window.AbortController&&!a.signal&&(this.abortController=new AbortController,a.signal=this.abortController.signal);const l=h=>this.emit("loading",h);e=yield Q.fetchBlob(t,l,a);const o=this.options.blobMimeType;o&&(e=new Blob([e],{type:o}))}this.setSrc(t,e);const r=yield new Promise(a=>{const l=s||this.getDuration();l?a(l):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>a(this.getDuration()),{once:!0}))});if(!t&&!e){const a=this.getMediaElement();a instanceof B&&(a.duration=r)}if(i)this.decodedData=N.createBuffer(i,r||0);else if(e){const a=yield e.arrayBuffer();this.decodedData=yield N.decode(a,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 x(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,e,i)}catch(s){throw this.emit("error",s),s}})}loadBlob(t,e,i){return x(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,e,i)}catch(s){throw this.emit("error",s),s}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:i=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const s=Math.min(t,this.decodedData.numberOfChannels),n=[];for(let r=0;r<s;r++){const a=this.decodedData.getChannelData(r),l=[],o=a.length/e;for(let h=0;h<e;h++){const p=a.slice(Math.floor(h*o),Math.ceil((h+1)*o));let d=0;for(let m=0;m<p.length;m++){const u=p[m];Math.abs(u)>Math.abs(d)&&(d=u)}l.push(Math.round(d*i)/i)}n.push(l)}return n}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}play(t,e){const i=Object.create(null,{play:{get:()=>super.play}});return x(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const s=yield i.play.call(this);return e!=null&&(this.media instanceof B?this.media.stopAt(e):this.stopAtPosition=e),s})}playPause(){return x(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 x(this,arguments,void 0,function*(t="image/png",e=1,i="dataURL"){return this.renderer.exportImage(t,e,i)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(e=>e.destroy()),this.subscriptions.forEach(e=>e()),this.unsubscribePlayerEvents(),this.reactiveCleanups.forEach(e=>e()),this.reactiveCleanups=[],this.timer.destroy(),this.renderer.destroy(),super.destroy()}}z.BasePlugin=class extends H{constructor(c){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=c}onInit(){}_init(c){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=c,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(c=>c()),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}},z.dom=K;export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bk as o,H as r,k as t,ai as c}from"./index-nhNM5UeG.js";const l=s=>{const e=a=>{const{width:i,elementRef:n}=r();return t.jsx(c,{ref:n,children:t.jsx(s,{...a,width:i})})};return e.displayName=`withCalculatedWidth(${s.displayName||s.name})`,o(e,s)};export{l as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bk as p,k as c,r as n,L as f,H as h,y as x,bl as g,bm as y}from"./index-nhNM5UeG.js";const m=n.createContext(null);m.displayName="ElementFullscreenContext";const C=x("div",{target:"elp1w7k0"})(({theme:e,isExpanded:t})=>({width:"100%",height:"100%",...t?{position:"fixed",top:0,left:0,bottom:0,right:0,background:e.colors.bgColor,zIndex:e.zIndices.fullscreenWrapper,padding:e.spacing.md,paddingTop:e.sizes.fullScreenHeaderHeight,overflow:"auto",display:"flex",alignItems:"center",justifyContent:"center"}:{}}),""),b=()=>{const{setFullScreen:e}=n.useContext(g),[t,s]=n.useState(!1),{fullHeight:d,fullWidth:i}=y(),o=n.useCallback(a=>{s(a),e(a)},[e]),r=n.useCallback(()=>{document.body.style.overflow="hidden",o(!0)},[o]),l=n.useCallback(()=>{document.body.style.overflow="unset",o(!1)},[o]),u=n.useCallback(a=>{a.keyCode===27&&t&&l()},[l,t]);return n.useEffect(()=>(document.addEventListener("keydown",u,!1),()=>{document.removeEventListener("keydown",u,!1)}),[u]),n.useMemo(()=>({expanded:t,zoomIn:r,zoomOut:l,fullHeight:d,fullWidth:i}),[t,r,l,d,i])},w=({children:e})=>{const t=f(),{expanded:s,fullHeight:d,fullWidth:i,zoomIn:o,zoomOut:r}=b(),{width:l,elementRef:u}=h(),a=n.useMemo(()=>({width:s?i:l,height:s?d:void 0,expanded:s,expand:o,collapse:r}),[s,d,i,l,o,r]);return c.jsx(m.Provider,{value:a,children:c.jsx(C,{ref:u,isExpanded:s,"data-testid":"stFullScreenFrame",theme:t,children:e})})};function v(e){const t=s=>c.jsx(w,{children:c.jsx(e,{...s})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,p(t,e)}export{m as d,v};
|
package/build/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
7
|
<title>Stlite Desktop</title>
|
|
8
8
|
<!-- The Content-Security-Policy setting will be injected at build time. See vite.config.js. -->
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-nhNM5UeG.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-D9TZavtE.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stlite/desktop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@emotion/babel-plugin": "^11.13.5",
|
|
66
66
|
"@eslint/js": "^9.39.1",
|
|
67
67
|
"@stlite/common": "^0.90.1",
|
|
68
|
-
"@stlite/kernel": "^0.
|
|
69
|
-
"@stlite/react": "^1.
|
|
68
|
+
"@stlite/kernel": "^0.100.0",
|
|
69
|
+
"@stlite/react": "^1.4.0",
|
|
70
70
|
"@stlite/tooling": "^0.90.0",
|
|
71
71
|
"@types/react": "^18.2.0",
|
|
72
72
|
"@types/react-dom": "^18.2.0",
|
|
Binary file
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{r,bW as z,y as bi,bX as hi,Q as yi,I as Xa,_ as Za,bY as d}from"./index-Bdi0ug4X.js";import{t as wi}from"./UploadFileInfo-B5SttewO-BfvME59S.js";var ki=r.forwardRef(function(a,i){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(Xa,Za({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},a,{ref:i}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}))});ki.displayName="Clear";var ji=r.forwardRef(function(a,i){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(Xa,Za({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},a,{ref:i}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"}))});ji.displayName="InsertDriveFile";const zi=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function F(a,i,t){const n=Di(a),{webkitRelativePath:p}=a,o=typeof i=="string"?i:typeof p=="string"&&p.length>0?p:`./${a.name}`;return typeof n.path!="string"&&La(n,"path",o),La(n,"relativePath",o),n}function Di(a){const{name:i}=a;if(i&&i.lastIndexOf(".")!==-1&&!a.type){const t=i.split(".").pop().toLowerCase(),n=zi.get(t);n&&Object.defineProperty(a,"type",{value:n,writable:!1,configurable:!1,enumerable:!0})}return a}function La(a,i,t){Object.defineProperty(a,i,{value:t,writable:!1,configurable:!1,enumerable:!0})}const Ei=[".DS_Store","Thumbs.db"];function Oi(a){return z(this,void 0,void 0,function*(){return Q(a)&&Ai(a.dataTransfer)?Pi(a.dataTransfer,a.type):Fi(a)?qi(a):Array.isArray(a)&&a.every(i=>"getFile"in i&&typeof i.getFile=="function")?Si(a):[]})}function Ai(a){return Q(a)}function Fi(a){return Q(a)&&Q(a.target)}function Q(a){return typeof a=="object"&&a!==null}function qi(a){return fa(a.target.files).map(i=>F(i))}function Si(a){return z(this,void 0,void 0,function*(){return(yield Promise.all(a.map(i=>i.getFile()))).map(i=>F(i))})}function Pi(a,i){return z(this,void 0,void 0,function*(){if(a.items){const t=fa(a.items).filter(p=>p.kind==="file");if(i!=="drop")return t;const n=yield Promise.all(t.map(Ci));return Ba(Ja(n))}return Ba(fa(a.files).map(t=>F(t)))})}function Ba(a){return a.filter(i=>Ei.indexOf(i.name)===-1)}function fa(a){if(a===null)return[];const i=[];for(let t=0;t<a.length;t++){const n=a[t];i.push(n)}return i}function Ci(a){if(typeof a.webkitGetAsEntry!="function")return $a(a);const i=a.webkitGetAsEntry();return i&&i.isDirectory?ai(i):$a(a,i)}function Ja(a){return a.reduce((i,t)=>[...i,...Array.isArray(t)?Ja(t):[t]],[])}function $a(a,i){return z(this,void 0,void 0,function*(){var t;if(globalThis.isSecureContext&&typeof a.getAsFileSystemHandle=="function"){const p=yield a.getAsFileSystemHandle();if(p===null)throw new Error(`${a} is not a File`);if(p!==void 0){const o=yield p.getFile();return o.handle=p,F(o)}}const n=a.getAsFile();if(!n)throw new Error(`${a} is not a File`);return F(n,(t=i?.fullPath)!==null&&t!==void 0?t:void 0)})}function Ri(a){return z(this,void 0,void 0,function*(){return a.isDirectory?ai(a):Ii(a)})}function ai(a){const i=a.createReader();return new Promise((t,n)=>{const p=[];function o(){i.readEntries(l=>z(this,void 0,void 0,function*(){if(l.length){const c=Promise.all(l.map(Ri));p.push(c),o()}else try{const c=yield Promise.all(p);t(c)}catch(c){n(c)}}),l=>{n(l)})}o()})}function Ii(a){return z(this,void 0,void 0,function*(){return new Promise((i,t)=>{a.file(n=>{const p=F(n,a.fullPath);i(p)},n=>{t(n)})})})}var va={},Ka;function Mi(){return Ka||(Ka=1,va.__esModule=!0,va.default=function(a,i){if(a&&i){var t=Array.isArray(i)?i:i.split(",");if(t.length===0)return!0;var n=a.name||"",p=(a.type||"").toLowerCase(),o=p.replace(/\/.*$/,"");return t.some(function(l){var c=l.trim().toLowerCase();return c.charAt(0)==="."?n.toLowerCase().endsWith(c):c.endsWith("/*")?o===c.replace(/\/.*$/,""):p===c})}return!0}),va}var Ti=Mi();const ua=bi(Ti);function Ha(a){return Bi(a)||Li(a)||ti(a)||_i()}function _i(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Li(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function Bi(a){if(Array.isArray(a))return ga(a)}function Ua(a,i){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);i&&(n=n.filter(function(p){return Object.getOwnPropertyDescriptor(a,p).enumerable})),t.push.apply(t,n)}return t}function Va(a){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?Ua(Object(t),!0).forEach(function(n){ii(a,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):Ua(Object(t)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(t,n))})}return a}function ii(a,i,t){return i in a?Object.defineProperty(a,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[i]=t,a}function B(a,i){return Hi(a)||Ki(a,i)||ti(a,i)||$i()}function $i(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ti(a,i){if(a){if(typeof a=="string")return ga(a,i);var t=Object.prototype.toString.call(a).slice(8,-1);if(t==="Object"&&a.constructor&&(t=a.constructor.name),t==="Map"||t==="Set")return Array.from(a);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ga(a,i)}}function ga(a,i){(i==null||i>a.length)&&(i=a.length);for(var t=0,n=new Array(i);t<i;t++)n[t]=a[t];return n}function Ki(a,i){var t=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(t!=null){var n=[],p=!0,o=!1,l,c;try{for(t=t.call(a);!(p=(l=t.next()).done)&&(n.push(l.value),!(i&&n.length===i));p=!0);}catch(f){o=!0,c=f}finally{try{!p&&t.return!=null&&t.return()}finally{if(o)throw c}}return n}}function Hi(a){if(Array.isArray(a))return a}var Ui=typeof ua=="function"?ua:ua.default,ni="file-invalid-type",Vi="file-too-large",Wi="file-too-small",ei="too-many-files",jt={FileInvalidType:ni,TooManyFiles:ei},Gi=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",i=a.split(","),t=i.length>1?"one of ".concat(i.join(", ")):i[0];return{code:ni,message:"File type must be ".concat(t)}},Wa=function(a){return{code:Vi,message:"File is larger than ".concat(a," ").concat(a===1?"byte":"bytes")}},Ga=function(a){return{code:Wi,message:"File is smaller than ".concat(a," ").concat(a===1?"byte":"bytes")}},Ni={code:ei,message:"Too many files"};function pi(a,i){var t=a.type==="application/x-moz-file"||Ui(a,i);return[t,t?null:Gi(i)]}function oi(a,i,t){if(j(a.size))if(j(i)&&j(t)){if(a.size>t)return[!1,Wa(t)];if(a.size<i)return[!1,Ga(i)]}else{if(j(i)&&a.size<i)return[!1,Ga(i)];if(j(t)&&a.size>t)return[!1,Wa(t)]}return[!0,null]}function j(a){return a!=null}function Qi(a){var i=a.files,t=a.accept,n=a.minSize,p=a.maxSize,o=a.multiple,l=a.maxFiles,c=a.validator;return!o&&i.length>1||o&&l>=1&&i.length>l?!1:i.every(function(f){var q=pi(f,t),S=B(q,1),P=S[0],C=oi(f,n,p),R=B(C,1),I=R[0],M=c?c(f):null;return P&&I&&!M})}function Y(a){return typeof a.isPropagationStopped=="function"?a.isPropagationStopped():typeof a.cancelBubble<"u"?a.cancelBubble:!1}function N(a){return a.dataTransfer?Array.prototype.some.call(a.dataTransfer.types,function(i){return i==="Files"||i==="application/x-moz-file"}):!!a.target&&!!a.target.files}function Na(a){a.preventDefault()}function Yi(a){return a.indexOf("MSIE")!==-1||a.indexOf("Trident/")!==-1}function Xi(a){return a.indexOf("Edge/")!==-1}function Zi(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Yi(a)||Xi(a)}function y(){for(var a=arguments.length,i=new Array(a),t=0;t<a;t++)i[t]=arguments[t];return function(n){for(var p=arguments.length,o=new Array(p>1?p-1:0),l=1;l<p;l++)o[l-1]=arguments[l];return i.some(function(c){return!Y(n)&&c&&c.apply(void 0,[n].concat(o)),Y(n)})}}function Ji(){return"showOpenFilePicker"in window}function at(a){if(j(a)){var i=Object.entries(a).filter(function(t){var n=B(t,2),p=n[0],o=n[1],l=!0;return li(p)||(console.warn('Skipped "'.concat(p,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),l=!1),(!Array.isArray(o)||!o.every(ci))&&(console.warn('Skipped "'.concat(p,'" because an invalid file extension was provided.')),l=!1),l}).reduce(function(t,n){var p=B(n,2),o=p[0],l=p[1];return Va(Va({},t),{},ii({},o,l))},{});return[{description:"Files",accept:i}]}return a}function it(a){if(j(a))return Object.entries(a).reduce(function(i,t){var n=B(t,2),p=n[0],o=n[1];return[].concat(Ha(i),[p],Ha(o))},[]).filter(function(i){return li(i)||ci(i)}).join(",")}function tt(a){return a instanceof DOMException&&(a.name==="AbortError"||a.code===a.ABORT_ERR)}function nt(a){return a instanceof DOMException&&(a.name==="SecurityError"||a.code===a.SECURITY_ERR)}function li(a){return a==="audio/*"||a==="video/*"||a==="image/*"||a==="text/*"||a==="application/*"||/\w+\/[-+.\w]+/g.test(a)}function ci(a){return/^.*\.[\w]+$/.test(a)}var et=["children"],pt=["open"],ot=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],lt=["refKey","onChange","onClick"];function ct(a){return dt(a)||st(a)||ri(a)||rt()}function rt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function st(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function dt(a){if(Array.isArray(a))return ba(a)}function xa(a,i){return ut(a)||vt(a,i)||ri(a,i)||mt()}function mt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
5
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ri(a,i){if(a){if(typeof a=="string")return ba(a,i);var t=Object.prototype.toString.call(a).slice(8,-1);if(t==="Object"&&a.constructor&&(t=a.constructor.name),t==="Map"||t==="Set")return Array.from(a);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ba(a,i)}}function ba(a,i){(i==null||i>a.length)&&(i=a.length);for(var t=0,n=new Array(i);t<i;t++)n[t]=a[t];return n}function vt(a,i){var t=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(t!=null){var n=[],p=!0,o=!1,l,c;try{for(t=t.call(a);!(p=(l=t.next()).done)&&(n.push(l.value),!(i&&n.length===i));p=!0);}catch(f){o=!0,c=f}finally{try{!p&&t.return!=null&&t.return()}finally{if(o)throw c}}return n}}function ut(a){if(Array.isArray(a))return a}function Qa(a,i){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);i&&(n=n.filter(function(p){return Object.getOwnPropertyDescriptor(a,p).enumerable})),t.push.apply(t,n)}return t}function m(a){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?Qa(Object(t),!0).forEach(function(n){ha(a,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):Qa(Object(t)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(t,n))})}return a}function ha(a,i,t){return i in a?Object.defineProperty(a,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[i]=t,a}function X(a,i){if(a==null)return{};var t=xt(a,i),n,p;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(a);for(p=0;p<o.length;p++)n=o[p],!(i.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(a,n)&&(t[n]=a[n])}return t}function xt(a,i){if(a==null)return{};var t={},n=Object.keys(a),p,o;for(o=0;o<n.length;o++)p=n[o],!(i.indexOf(p)>=0)&&(t[p]=a[p]);return t}var ka=r.forwardRef(function(a,i){var t=a.children,n=X(a,et),p=ft(n),o=p.open,l=X(p,pt);return r.useImperativeHandle(i,function(){return{open:o}},[o]),yi.createElement(r.Fragment,null,t(m(m({},l),{},{open:o})))});ka.displayName="Dropzone";var si={disabled:!1,getFilesFromEvent:Oi,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};ka.defaultProps=si;ka.propTypes={children:d.func,accept:d.objectOf(d.arrayOf(d.string)),multiple:d.bool,preventDropOnDocument:d.bool,noClick:d.bool,noKeyboard:d.bool,noDrag:d.bool,noDragEventsBubbling:d.bool,minSize:d.number,maxSize:d.number,maxFiles:d.number,disabled:d.bool,getFilesFromEvent:d.func,onFileDialogCancel:d.func,onFileDialogOpen:d.func,useFsAccessApi:d.bool,autoFocus:d.bool,onDragEnter:d.func,onDragLeave:d.func,onDragOver:d.func,onDrop:d.func,onDropAccepted:d.func,onDropRejected:d.func,onError:d.func,validator:d.func};var ya={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function ft(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=m(m({},si),a),t=i.accept,n=i.disabled,p=i.getFilesFromEvent,o=i.maxSize,l=i.minSize,c=i.multiple,f=i.maxFiles,q=i.onDragEnter,S=i.onDragLeave,P=i.onDragOver,C=i.onDrop,R=i.onDropAccepted,I=i.onDropRejected,M=i.onFileDialogCancel,J=i.onFileDialogOpen,ja=i.useFsAccessApi,za=i.autoFocus,aa=i.preventDropOnDocument,Da=i.noClick,ia=i.noKeyboard,Ea=i.noDrag,w=i.noDragEventsBubbling,ta=i.onError,T=i.validator,_=r.useMemo(function(){return it(t)},[t]),Oa=r.useMemo(function(){return at(t)},[t]),na=r.useMemo(function(){return typeof J=="function"?J:Ya},[J]),$=r.useMemo(function(){return typeof M=="function"?M:Ya},[M]),x=r.useRef(null),h=r.useRef(null),mi=r.useReducer(gt,ya),Aa=xa(mi,2),ea=Aa[0],g=Aa[1],vi=ea.isFocused,Fa=ea.isFileDialogActive,K=r.useRef(typeof window<"u"&&window.isSecureContext&&ja&&Ji()),qa=function(){!K.current&&Fa&&setTimeout(function(){if(h.current){var e=h.current.files;e.length||(g({type:"closeDialog"}),$())}},300)};r.useEffect(function(){return window.addEventListener("focus",qa,!1),function(){window.removeEventListener("focus",qa,!1)}},[h,Fa,$,K]);var D=r.useRef([]),Sa=function(e){x.current&&x.current.contains(e.target)||(e.preventDefault(),D.current=[])};r.useEffect(function(){return aa&&(document.addEventListener("dragover",Na,!1),document.addEventListener("drop",Sa,!1)),function(){aa&&(document.removeEventListener("dragover",Na),document.removeEventListener("drop",Sa))}},[x,aa]),r.useEffect(function(){return!n&&za&&x.current&&x.current.focus(),function(){}},[x,za,n]);var k=r.useCallback(function(e){ta?ta(e):console.error(e)},[ta]),Pa=r.useCallback(function(e){e.preventDefault(),e.persist(),W(e),D.current=[].concat(ct(D.current),[e.target]),N(e)&&Promise.resolve(p(e)).then(function(s){if(!(Y(e)&&!w)){var v=s.length,u=v>0&&Qi({files:s,accept:_,minSize:l,maxSize:o,multiple:c,maxFiles:f,validator:T}),b=v>0&&!u;g({isDragAccept:u,isDragReject:b,isDragActive:!0,type:"setDraggedFiles"}),q&&q(e)}}).catch(function(s){return k(s)})},[p,q,k,w,_,l,o,c,f,T]),Ca=r.useCallback(function(e){e.preventDefault(),e.persist(),W(e);var s=N(e);if(s&&e.dataTransfer)try{e.dataTransfer.dropEffect="copy"}catch{}return s&&P&&P(e),!1},[P,w]),Ra=r.useCallback(function(e){e.preventDefault(),e.persist(),W(e);var s=D.current.filter(function(u){return x.current&&x.current.contains(u)}),v=s.indexOf(e.target);v!==-1&&s.splice(v,1),D.current=s,!(s.length>0)&&(g({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),N(e)&&S&&S(e))},[x,S,w]),H=r.useCallback(function(e,s){var v=[],u=[];e.forEach(function(b){var L=pi(b,_),A=xa(L,2),oa=A[0],la=A[1],ca=oi(b,l,o),G=xa(ca,2),ra=G[0],sa=G[1],da=T?T(b):null;if(oa&&ra&&!da)v.push(b);else{var ma=[la,sa];da&&(ma=ma.concat(da)),u.push({file:b,errors:ma.filter(function(gi){return gi})})}}),(!c&&v.length>1||c&&f>=1&&v.length>f)&&(v.forEach(function(b){u.push({file:b,errors:[Ni]})}),v.splice(0)),g({acceptedFiles:v,fileRejections:u,isDragReject:u.length>0,type:"setFiles"}),C&&C(v,u,s),u.length>0&&I&&I(u,s),v.length>0&&R&&R(v,s)},[g,c,_,l,o,f,C,R,I,T]),U=r.useCallback(function(e){e.preventDefault(),e.persist(),W(e),D.current=[],N(e)&&Promise.resolve(p(e)).then(function(s){Y(e)&&!w||H(s,e)}).catch(function(s){return k(s)}),g({type:"reset"})},[p,H,k,w]),E=r.useCallback(function(){if(K.current){g({type:"openDialog"}),na();var e={multiple:c,types:Oa};window.showOpenFilePicker(e).then(function(s){return p(s)}).then(function(s){H(s,null),g({type:"closeDialog"})}).catch(function(s){tt(s)?($(s),g({type:"closeDialog"})):nt(s)?(K.current=!1,h.current?(h.current.value=null,h.current.click()):k(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):k(s)});return}h.current&&(g({type:"openDialog"}),na(),h.current.value=null,h.current.click())},[g,na,$,ja,H,k,Oa,c]),Ia=r.useCallback(function(e){!x.current||!x.current.isEqualNode(e.target)||(e.key===" "||e.key==="Enter"||e.keyCode===32||e.keyCode===13)&&(e.preventDefault(),E())},[x,E]),Ma=r.useCallback(function(){g({type:"focus"})},[]),Ta=r.useCallback(function(){g({type:"blur"})},[]),_a=r.useCallback(function(){Da||(Zi()?setTimeout(E,0):E())},[Da,E]),O=function(e){return n?null:e},pa=function(e){return ia?null:O(e)},V=function(e){return Ea?null:O(e)},W=function(e){w&&e.stopPropagation()},ui=r.useMemo(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=e.refKey,v=s===void 0?"ref":s,u=e.role,b=e.onKeyDown,L=e.onFocus,A=e.onBlur,oa=e.onClick,la=e.onDragEnter,ca=e.onDragOver,G=e.onDragLeave,ra=e.onDrop,sa=X(e,ot);return m(m(ha({onKeyDown:pa(y(b,Ia)),onFocus:pa(y(L,Ma)),onBlur:pa(y(A,Ta)),onClick:O(y(oa,_a)),onDragEnter:V(y(la,Pa)),onDragOver:V(y(ca,Ca)),onDragLeave:V(y(G,Ra)),onDrop:V(y(ra,U)),role:typeof u=="string"&&u!==""?u:"presentation"},v,x),!n&&!ia?{tabIndex:0}:{}),sa)}},[x,Ia,Ma,Ta,_a,Pa,Ca,Ra,U,ia,Ea,n]),xi=r.useCallback(function(e){e.stopPropagation()},[]),fi=r.useMemo(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=e.refKey,v=s===void 0?"ref":s,u=e.onChange,b=e.onClick,L=X(e,lt),A=ha({accept:_,multiple:c,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:O(y(u,U)),onClick:O(y(b,xi)),tabIndex:-1},v,h);return m(m({},A),L)}},[h,t,c,U,n]);return m(m({},ea),{},{isFocused:vi&&!n,getRootProps:ui,getInputProps:fi,rootRef:x,inputRef:h,open:O(E)})}function gt(a,i){switch(i.type){case"focus":return m(m({},a),{},{isFocused:!0});case"blur":return m(m({},a),{},{isFocused:!1});case"openDialog":return m(m({},ya),{},{isFileDialogActive:!0});case"closeDialog":return m(m({},a),{},{isFileDialogActive:!1});case"setDraggedFiles":return m(m({},a),{},{isDragActive:i.isDragActive,isDragAccept:i.isDragAccept,isDragReject:i.isDragReject});case"setFiles":return m(m({},a),{},{acceptedFiles:i.acceptedFiles,fileRejections:i.fileRejections,isDragReject:i.isDragReject});case"reset":return m({},ya);default:return a}}function Ya(){}const bt="application/streamlit";function zt(a){const i={};return i[bt]=a,a.length?i:void 0}var ht=(a=>(a.Gigabyte="gb",a.Megabyte="mb",a.Kilobyte="kb",a.Byte="b",a))(ht||{});const wa=hi()?1024:1e3,Z=["gb","mb","kb","b"],di=(a,i,t=1)=>{if(i||(i="b"),t<0&&(t=0),a<0)throw new Error("Size must be greater than or equal to 0");const n=Z.indexOf(i),p=a/wa;return n&&a>wa/2?di(p,Z[n-1],t):`${a.toFixed(t)}${i.toUpperCase()}`},Dt=(a,i,t)=>{if(a<0)throw Error("Size must be 0 or greater");const n=Z.findIndex(c=>c===i),p=Z.findIndex(c=>c===t);if(n===-1||p===-1)throw Error("Unexpected byte unit provided");if(n===p)return a;const o=Math.abs(n-p),l=wa**o;return n>p?a/l:a*l},yt=(a,i,t)=>{switch(a){case"file-too-large":return`File must be ${di(t,"b")} or smaller.`;case"file-invalid-type":return`${i.type} files are not allowed.`;case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},Et=(a,i,t)=>{const{file:n,errors:p}=a,o=n.webkitRelativePath||n.name;return new wi(o,n.size,i,{type:"error",errorMessage:p.map(l=>yt(l.code,n,t)).join(" ")})};export{ht as A,Et as C,ft as D,ka as E,jt as I,ji as P,zt as S,ki as _,di as f,Dt as q};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,aK as d,aL as l,m as s,a0 as u,A as x,B as C}from"./index-Bdi0ug4X.js";const h=({children:e})=>{const t=r.useContext(d)?.();return t?l.createPortal(e,t):s.jsx(s.Fragment,{children:e})},y=C("div",{target:"ecnfqzf0"})({name:"my9yfq",styles:"@media print{display:none;}"}),f=({className:e,scriptRunId:t,numParticles:a,numParticleTypes:o,ParticleComponent:n})=>{const{resourceCrossOriginMode:i}=r.useContext(u),c=r.useMemo(()=>x(a).map(()=>Math.floor(Math.random()*o)),[a,o]);return s.jsx(y,{className:e,"data-testid":e,children:c.map((m,p)=>s.jsx(n,{particleType:m,resourceCrossOriginMode:i},t+p))})},M=r.memo(f);export{M as C,h as v};
|