@gui-chat-plugin/music 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{samples-msJuWhn1.cjs → samples-C7yx0MNo.cjs} +1 -1
- package/dist/style.css +2 -2
- package/dist/vue.cjs +4 -1
- package/dist/vue.js +4415 -53
- package/package.json +15 -15
- /package/dist/{samples-C8a37dDP.js → samples-CxTlaIMB.js} +0 -0
package/README.md
CHANGED
|
@@ -98,3 +98,8 @@ Try these prompts to test the plugin:
|
|
|
98
98
|
## License
|
|
99
99
|
|
|
100
100
|
MIT
|
|
101
|
+
|
|
102
|
+
## Related
|
|
103
|
+
|
|
104
|
+
- Protocol spec: [gui-chat-protocol](https://github.com/receptron/gui-chat-protocol)
|
|
105
|
+
- Reference implementations using this protocol: [mulmoclaude](https://github.com/receptron/mulmoclaude) · [MulmoChat](https://github.com/receptron/MulmoChat)
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-C7yx0MNo.cjs");require("./vue.cjs"),exports.TOOL_DEFINITION=e.r,exports.TOOL_NAME=e.i,exports.samples=e.t,exports.showMusic=e.n;
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "./samples-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./samples-CxTlaIMB.js";
|
|
2
2
|
export { n as TOOL_DEFINITION, e as TOOL_NAME, r as samples, t as showMusic };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-C7yx0MNo.cjs");require("./core.cjs"),require("./vue.cjs"),exports.TOOL_DEFINITION=e.r,exports.TOOL_NAME=e.i,exports.samples=e.t,exports.showMusic=e.n;
|
package/dist/index.js
CHANGED
|
@@ -91,4 +91,4 @@ var e=`showMusic`,t={type:`function`,name:e,description:`Display sheet music fro
|
|
|
91
91
|
</note>
|
|
92
92
|
</measure>
|
|
93
93
|
</part>
|
|
94
|
-
</score-partwise>`,title:`C Major Scale`}}];Object.defineProperty(exports
|
|
94
|
+
</score-partwise>`,title:`C Major Scale`}}];Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
package/dist/style.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! tailwindcss v4.2
|
|
2
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--color-green-600:oklch(62.7% .194 149.214);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-700:oklch(45.7% .24 277.023);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-600:oklch(55.8% .288 302.321);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.end{inset-inline-end:var(--spacing)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing) * 1)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.contents{display:contents}.flex{display:flex}.h-\[600px\]{height:600px}.h-full{height:100%}.min-h-full{min-height:100%}.w-20{width:calc(var(--spacing) * 20)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.flex-1{flex:1}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-600{border-color:var(--color-gray-600)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-green-600{background-color:var(--color-green-600)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-purple-50{background-color:var(--color-purple-50)}.bg-red-500{background-color:var(--color-red-500)}.bg-white{background-color:var(--color-white)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-8{padding:calc(var(--spacing) * 8)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-gray-200{color:var(--color-gray-200)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-indigo-700{color:var(--color-indigo-700)}.text-purple-600{color:var(--color-purple-600)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}@media (hover:hover){.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-300:disabled{background-color:var(--color-gray-300)}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
|
|
1
|
+
/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--color-green-600:oklch(62.7% .194 149.214);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-700:oklch(45.7% .24 277.023);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-600:oklch(55.8% .288 302.321);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.mx-auto{margin-inline:auto}.mt-1{margin-top:var(--spacing)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.contents{display:contents}.flex{display:flex}.h-\[600px\]{height:600px}.h-full{height:100%}.min-h-full{min-height:100%}.w-20{width:calc(var(--spacing) * 20)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.flex-1{flex:1}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:var(--spacing)}.gap-2{gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-600{border-color:var(--color-gray-600)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-green-600{background-color:var(--color-green-600)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-purple-50{background-color:var(--color-purple-50)}.bg-red-500{background-color:var(--color-red-500)}.bg-white{background-color:var(--color-white)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-8{padding:calc(var(--spacing) * 8)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-1{padding-block:var(--spacing)}.py-2{padding-block:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-gray-200{color:var(--color-gray-200)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-indigo-700{color:var(--color-indigo-700)}.text-purple-600{color:var(--color-purple-600)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}@media (hover:hover){.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-300:disabled{background-color:var(--color-gray-300)}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
|
|
3
3
|
/*$vite$:1*/
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./samples-msJuWhn1.cjs`);let l=require(`vue`),u=require(`opensheetmusicdisplay`),d=require(`@isamu/osmd-audio-player`);d=s(d,1);let f=require(`jspdf`),p=require(`svg2pdf.js`);var m={class:`w-full h-full overflow-y-auto`},h={class:`min-h-full flex flex-col p-4`},g={key:0,class:`mb-4 text-center`},_={class:`text-2xl font-bold text-gray-900`},v={class:`mb-4 flex gap-2 items-center justify-center`},y=[`disabled`],b={class:`text-xl`},x=[`disabled`],S={class:`flex items-center gap-2`},C=(0,l.defineComponent)({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},setup(e){let t=e,n=(0,l.ref)(null),r=null,i=null,a=(0,l.ref)(!1),o=(0,l.ref)(!1),s=(0,l.ref)(!1),c=(0,l.ref)(200),C=(0,l.ref)(!1),w=(0,l.ref)(!1),T=async()=>{if(!(!n.value||!t.selectedResult.data?.musicXML))try{n.value.innerHTML=``,a.value=!1,o.value=!1,r=new u.OpenSheetMusicDisplay(n.value,{autoResize:!0,backend:`svg`,drawTitle:!1,followCursor:!0}),await r.load(t.selectedResult.data.musicXML),await r.render(),i||=new d.default,await i.loadScore(r);let e=r.Sheet?.SourceMeasures?.[0]?.TempoExpressions;if(e&&e.length>0){let t=e[0],n=t.TempoInBpm||t.tempoInBpm;n&&(c.value=n)}i.on(`iteration`,e=>{!C.value&&e&&e.length===0&&(i.stop(),o.value=!1)}),a.value=!0}catch(e){console.error(`Error rendering music:`,e),n.value&&(n.value.innerHTML=`<div class="text-red-500">Error rendering sheet music: ${e instanceof Error?e.message:`Unknown error`}</div>`)}},E=async()=>{if(!n.value||!a.value)return;let e=n.value.querySelector(`svg`);if(e){s.value=!0;try{let n=e.viewBox.baseVal.width||e.clientWidth,r=e.viewBox.baseVal.height||e.clientHeight,i=new f.jsPDF({orientation:n>r?`landscape`:`portrait`,unit:`pt`,format:`a4`}),a=i.internal.pageSize.getWidth(),o=i.internal.pageSize.getHeight(),s=Math.min(a/n,o/r),c=n*s,l=r*s;await(0,p.svg2pdf)(e,i,{x:(a-c)/2,y:(o-l)/2,width:c,height:l});let u=`${(t.selectedResult.title||`sheet-music`).replace(/[^a-zA-Z0-9]/g,`_`)}.pdf`;i.save(u)}catch(e){console.error(`Error exporting PDF:`,e)}finally{s.value=!1}}},D=async()=>{!i||!a.value||(i.setBpm(Math.max(30,Math.min(300,c.value))),i.metronomeVolume=w.value?.7:0,i.isLooping=C.value,await i.play(),o.value=!0)},O=()=>{i&&(i.stop(),o.value=!1)};return(0,l.watch)(c,()=>{i&&i.setBpm(Math.max(30,Math.min(300,c.value)))}),(0,l.watch)(C,()=>{i&&(i.isLooping=C.value)}),(0,l.watch)(w,()=>{i&&(i.metronomeVolume=w.value?.7:0)}),(0,l.onMounted)(()=>{T()}),(0,l.watch)(()=>t.selectedResult.data?.musicXML,()=>{T()}),(0,l.onUnmounted)(()=>{i&&i.stop()}),(t,r)=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,m,[(0,l.createElementVNode)(`div`,h,[e.selectedResult.title?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,g,[(0,l.createElementVNode)(`h2`,_,(0,l.toDisplayString)(e.selectedResult.title),1)])):(0,l.createCommentVNode)(``,!0),(0,l.createElementVNode)(`div`,v,[(0,l.createElementVNode)(`button`,{onClick:r[0]||=e=>o.value?O():D(),disabled:!a.value,class:(0,l.normalizeClass)([`px-4 py-2 text-white rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1`,o.value?`bg-red-500`:`bg-blue-500`])},[(0,l.createElementVNode)(`span`,b,(0,l.toDisplayString)(o.value?`⏹`:`▶`),1),(0,l.createTextVNode)(` `+(0,l.toDisplayString)(o.value?`Stop`:`Play`),1)],10,y),(0,l.createElementVNode)(`button`,{onClick:E,disabled:!a.value||s.value,class:`px-4 py-2 text-white bg-green-600 rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1`},[r[2]||=(0,l.createElementVNode)(`span`,{class:`text-xl`},`⬇`,-1),(0,l.createTextVNode)(` `+(0,l.toDisplayString)(s.value?`Exporting...`:`PDF`),1)],8,x),(0,l.createElementVNode)(`label`,S,[r[3]||=(0,l.createTextVNode)(` Tempo `,-1),(0,l.withDirectives)((0,l.createElementVNode)(`input`,{"onUpdate:modelValue":r[1]||=e=>c.value=e,type:`number`,min:`30`,max:`300`,class:`w-20 px-2 py-1 border border-gray-300 rounded`},null,512),[[l.vModelText,c.value,void 0,{number:!0}]]),r[4]||=(0,l.createTextVNode)(` bpm `,-1)])]),(0,l.createElementVNode)(`div`,{ref_key:`musicContainer`,ref:n,class:`flex-1 flex items-center justify-center bg-white rounded-lg p-4`},null,512)])]))}}),w={class:`text-center p-4 bg-purple-50 rounded`},T={key:0,class:`text-xs text-gray-600 mt-1 truncate`},E=(0,l.defineComponent)({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,w,[n[0]||=(0,l.createElementVNode)(`div`,{class:`text-purple-600 font-medium`},`🎵 Sheet Music`,-1),e.result.title?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,T,(0,l.toDisplayString)(e.result.title),1)):(0,l.createCommentVNode)(``,!0)]))}}),D={toolDefinition:c.r,execute:c.n,generatingMessage:`Rendering sheet music...`,isEnabled:()=>!0,viewComponent:C,previewComponent:E,samples:c.t},O={plugin:D};exports.TOOL_DEFINITION=c.r,exports.default=O,exports.executeMusic=c.n,exports.plugin=D;
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);const f=require("./samples-C7yx0MNo.cjs");let p=require("vue"),m=require("opensheetmusicdisplay"),h=require("jspdf"),g=require("svg2pdf.js");var _=class{constructor(){this.steps=[]}[Symbol.iterator](){return this.steps.values()}createStep(e){let t=this.steps.find(t=>t.tick===e);return t||(t={tick:e,notes:[]},this.steps.push(t)),t}addNote(e,t){(this.steps.find(t=>t.tick===e)??this.createStep(e)).notes.push(t)}delete(e){let t=this.steps.findIndex(t=>t.tick===e.tick);t!=null&&this.steps.splice(t,1)}sort(){return this.steps.sort((e,t)=>e.tick-t.tick),this}getFirstEmptyTick(){return this.sort().steps.filter(e=>!e.notes.length)[0].tick}},v=class{constructor(e,t,n){this.stepQueue=new _,this.stepQueueIndex=0,this.scheduledTicks=new Set,this.currentTick=0,this.currentTickTimestamp=0,this.audioContextStartTime=0,this.schedulerIntervalHandle=null,this.scheduleInterval=200,this.schedulePeriod=500,this.tickDenominator=1024,this.lastTickOffset=300,this.playing=!1,this.noteSchedulingCallback=n,this.wholeNoteLength=e,this.audioContext=t}get schedulePeriodTicks(){return this.schedulePeriod/this.tickDuration}get audioContextTime(){return this.audioContext?(this.audioContext.currentTime-this.audioContextStartTime)*1e3:0}get tickDuration(){return this.wholeNoteLength/this.tickDenominator}get calculatedTick(){return this.currentTick+Math.round((this.audioContextTime-this.currentTickTimestamp)/this.tickDuration)}start(){this.playing=!0,this.stepQueue.sort(),this.audioContextStartTime=this.audioContext.currentTime,this.currentTickTimestamp=this.audioContextTime,this.schedulerIntervalHandle||=window.setInterval(()=>this.scheduleIterationStep(),this.scheduleInterval)}setIterationStep(e){e=Math.min(this.stepQueue.steps.length-1,e),this.stepQueueIndex=e,this.currentTick=this.stepQueue.steps[this.stepQueueIndex].tick}pause(){this.playing=!1}resume(){this.playing=!0,this.currentTickTimestamp=this.audioContextTime}reset(){this.playing=!1,this.currentTick=0,this.currentTickTimestamp=0,this.stepQueueIndex=0,clearInterval(this.scheduleInterval),this.schedulerIntervalHandle=null}loadNotes(e){let t=this.lastTickOffset;this.stepQueue.steps.length>0&&(t=this.stepQueue.getFirstEmptyTick());for(let n of e)if(!n.IsGrace)for(let e of n.Notes)this.stepQueue.addNote(t,e),this.stepQueue.createStep(t+e.Length.RealValue*this.tickDenominator)}scheduleIterationStep(){if(!this.playing)return;this.currentTick=this.calculatedTick,this.currentTickTimestamp=this.audioContextTime;let e=this.stepQueue.steps[this.stepQueueIndex]?.tick;for(;this.nextTickAvailableAndWithinSchedulePeriod(e);){let t=this.stepQueue.steps[this.stepQueueIndex],n=(t.tick-this.currentTick)*this.tickDuration;n<0&&(n=0),this.scheduledTicks.add(t.tick),this.noteSchedulingCallback(n/1e3,t.notes),this.stepQueueIndex++,e=this.stepQueue.steps[this.stepQueueIndex]?.tick}for(let e of this.scheduledTicks)e<=this.currentTick&&this.scheduledTicks.delete(e)}nextTickAvailableAndWithinSchedulePeriod(e){return e&&this.currentTickTimestamp+(e-this.currentTick)*this.tickDuration<=this.currentTickTimestamp+this.schedulePeriod}},y;(function(e){e[e.None=0]=`None`,e[e.Staccato=1]=`Staccato`,e[e.Legato=2]=`Legato`})(y||={});var b=[[0,`Acoustic Grand Piano`],[1,`Bright Acoustic Piano`],[2,`Electric Grand Piano`],[3,`Honky-tonk Piano`],[4,`Electric Piano 1`],[5,`Electric Piano 2`],[6,`Harpsichord`],[7,`Clavi`],[8,`Celesta`],[9,`Glockenspiel`],[10,`Music Box`],[11,`Vibraphone`],[12,`Marimba`],[13,`Xylophone`],[14,`Tubular Bells`],[15,`Dulcimer`],[16,`Drawbar Organ`],[17,`Percussive Organ`],[18,`Rock Organ`],[19,`Church Organ`],[20,`Reed Organ`],[21,`Accordion`],[22,`Harmonica`],[23,`Tango Accordion`],[24,`Acoustic Guitar (nylon)`],[25,`Acoustic Guitar (steel)`],[26,`Electric Guitar (jazz)`],[27,`Electric Guitar (clean)`],[28,`Electric Guitar (muted)`],[29,`Overdriven Guitar`],[30,`Distortion Guitar`],[31,`Guitar harmonics`],[32,`Acoustic Bass`],[33,`Electric Bass (finger)`],[34,`Electric Bass (pick)`],[35,`Fretless Bass`],[36,`Slap Bass 1`],[37,`Slap Bass 2`],[38,`Synth Bass 1`],[39,`Synth Bass 2`],[40,`Violin`],[41,`Viola`],[42,`Cello`],[43,`Contrabass`],[44,`Tremolo Strings`],[45,`Pizzicato Strings`],[46,`Orchestral Harp`],[47,`Timpani`],[48,`String Ensemble 1`],[49,`String Ensemble 2`],[50,`SynthStrings 1`],[51,`SynthStrings 2`],[52,`Choir Aahs`],[53,`Voice Oohs`],[54,`Synth Choir`],[55,`Orchestra Hit`],[56,`Trumpet`],[57,`Trombone`],[58,`Tuba`],[59,`Muted Trumpet`],[60,`French Horn`],[61,`Brass Section`],[62,`SynthBrass 1`],[63,`SynthBrass 2`],[64,`Soprano Sax`],[65,`Alto Sax`],[66,`Tenor Sax`],[67,`Baritone Sax`],[68,`Oboe`],[69,`English Horn`],[70,`Bassoon`],[71,`Clarinet`],[72,`Piccolo`],[73,`Flute`],[74,`Recorder`],[75,`Pan Flute`],[76,`Blown Bottle`],[77,`Shakuhachi`],[78,`Whistle`],[79,`Ocarina`],[80,`Lead 1 (square)`],[81,`Lead 2 (sawtooth)`],[82,`Lead 3 (calliope)`],[83,`Lead 4 (chiff)`],[84,`Lead 5 (charang)`],[85,`Lead 6 (voice)`],[86,`Lead 7 (fifths)`],[87,`Lead 8 (bass + lead)`],[88,`Pad 1 (new age)`],[89,`Pad 2 (warm)`],[90,`Pad 3 (polysynth)`],[91,`Pad 4 (choir)`],[92,`Pad 5 (bowed)`],[93,`Pad 6 (metallic)`],[94,`Pad 7 (halo)`],[95,`Pad 8 (sweep)`],[96,`FX 1 (rain)`],[97,`FX 2 (soundtrack)`],[98,`FX 3 (crystal)`],[99,`FX 4 (atmosphere)`],[100,`FX 5 (brightness)`],[101,`FX 6 (goblins)`],[102,`FX 7 (echoes)`],[103,`FX 8 (sci-fi)`],[104,`Sitar`],[105,`Banjo`],[106,`Shamisen`],[107,`Koto`],[108,`Kalimba`],[109,`Bag pipe`],[110,`Fiddle`],[111,`Shanai`],[112,`Tinkle Bell`],[113,`Agogo`],[114,`Steel Drums`],[115,`Woodblock`],[116,`Taiko Drum`],[117,`Melodic Tom`],[118,`Synth Drum`],[119,`Reverse Cymbal`],[120,`Guitar Fret Noise`],[121,`Breath Noise`],[122,`Seashore`],[123,`Bird Tweet`],[124,`Telephone Ring`],[125,`Helicopter`],[126,`Applause`],[127,`Gunshot`]],x=`accordion.acoustic_bass.acoustic_grand_piano.acoustic_guitar_nylon.acoustic_guitar_steel.agogo.alto_sax.applause.bagpipe.banjo.baritone_sax.bassoon.bird_tweet.blown_bottle.brass_section.breath_noise.bright_acoustic_piano.celesta.cello.choir_aahs.church_organ.clarinet.clavinet.contrabass.distortion_guitar.drawbar_organ.dulcimer.electric_bass_finger.electric_bass_pick.electric_grand_piano.electric_guitar_clean.electric_guitar_jazz.electric_guitar_muted.electric_piano_1.electric_piano_2.english_horn.fiddle.flute.french_horn.fretless_bass.fx_1_rain.fx_2_soundtrack.fx_3_crystal.fx_4_atmosphere.fx_5_brightness.fx_6_goblins.fx_7_echoes.fx_8_scifi.glockenspiel.guitar_fret_noise.guitar_harmonics.gunshot.harmonica.harpsichord.helicopter.honkytonk_piano.kalimba.koto.lead_1_square.lead_2_sawtooth.lead_3_calliope.lead_4_chiff.lead_5_charang.lead_6_voice.lead_7_fifths.lead_8_bass__lead.marimba.melodic_tom.music_box.muted_trumpet.oboe.ocarina.orchestra_hit.orchestral_harp.overdriven_guitar.pad_1_new_age.pad_2_warm.pad_3_polysynth.pad_4_choir.pad_5_bowed.pad_6_metallic.pad_7_halo.pad_8_sweep.pan_flute.percussive_organ.piccolo.pizzicato_strings.recorder.reed_organ.reverse_cymbal.rock_organ.seashore.shakuhachi.shamisen.shanai.sitar.slap_bass_1.slap_bass_2.soprano_sax.steel_drums.string_ensemble_1.string_ensemble_2.synth_bass_1.synth_bass_2.synth_brass_1.synth_brass_2.synth_choir.synth_drum.synth_strings_1.synth_strings_2.taiko_drum.tango_accordion.telephone_ring.tenor_sax.timpani.tinkle_bell.tremolo_strings.trombone.trumpet.tuba.tubular_bells.vibraphone.viola.violin.voice_oohs.whistle.woodblock.xylophone`.split(`.`),S=s(((e,t)=>{function n(e){return e>64&&e<91?e-65:e>96&&e<123?e-71:e>47&&e<58?e+4:e===43?62:e===47?63:0}function r(e,t){for(var r=e.replace(/[^A-Za-z0-9\+\/]/g,``),i=r.length,a=t?Math.ceil((i*3+1>>2)/t)*t:i*3+1>>2,o=new Uint8Array(a),s,c,l=0,u=0,d=0;d<i;d++)if(c=d&3,l|=n(r.charCodeAt(d))<<18-6*c,c===3||i-d===1){for(s=0;s<3&&u<a;s++,u++)o[u]=l>>>(16>>>s&24)&255;l=0}return o}t.exports={decode:r}})),C=s(((e,t)=>{t.exports=function(e,t){return new Promise(function(n,r){var i=new XMLHttpRequest;t&&(i.responseType=t),i.open(`GET`,e),i.onload=function(){i.status===200?n(i.response):r(Error(i.statusText))},i.onerror=function(){r(Error(`Network Error`))},i.send()})}})),w=s(((e,t)=>{var n=S(),r=C();function i(e){return function(t){return typeof t==`string`&&e.test(t)}}function a(e,t){return typeof e==`string`?e+t:typeof e==`function`?e(t):t}function o(e,t,n,r){var i=s(t)?c:l(t)?u:d(t)?f:p(t)?m:h(t)?g:_(t)?v:y(t)?b:x(t)?w:null;return i?i(e,t,n||{}):r?Promise.resolve(r):Promise.reject(`Source not valid (`+t+`)`)}o.fetch=r;function s(e){return e instanceof ArrayBuffer}function c(e,t,n){return new Promise(function(n,r){e.decodeAudioData(t,function(e){n(e)},function(){r(`Can't decode audio data (`+t.slice(0,30)+`...)`)})})}var l=i(/\.(mp3|wav|ogg)(\?.*)?$/i);function u(e,t,n){var r=a(n.from,t);return o(e,o.fetch(r,`arraybuffer`),n)}function d(e){return e&&typeof e.then==`function`}function f(e,t,n){return t.then(function(t){return o(e,t,n)})}var p=Array.isArray;function m(e,t,n){return Promise.all(t.map(function(t){return o(e,t,n,t)}))}function h(e){return e&&typeof e==`object`}function g(e,t,n){var r={},i=Object.keys(t).map(function(i){if(n.only&&n.only.indexOf(i)===-1)return null;var a=t[i];return o(e,a,n,a).then(function(e){r[i]=e})});return Promise.all(i).then(function(){return r})}var _=i(/\.json(\?.*)?$/i);function v(e,t,n){var r=a(n.from,t);return o(e,o.fetch(r,`text`).then(JSON.parse),n)}var y=i(/^data:audio/);function b(e,t,r){var i=t.indexOf(`,`);return o(e,n.decode(t.slice(i+1)).buffer,r)}var x=i(/\.js(\?.*)?$/i);function w(e,t,n){var r=a(n.from,t);return o(e,o.fetch(r,`text`).then(T),n)}function T(e){var t=e.indexOf(`MIDI.Soundfont.`);if(t<0)throw Error(`Invalid MIDI.js Soundfont format`);t=e.indexOf(`=`,t)+2;var n=e.lastIndexOf(`,`);return JSON.parse(e.slice(t,n)+`}`)}typeof t==`object`&&t.exports&&(t.exports=o),typeof window<`u`&&(window.loadAudio=o)})),T=s(((e,t)=>{t.exports=n;function n(e){var t=e.createGain(),n=t._voltage=a(e),i=o(n),s=o(n),c=o(n);return t._startAmount=o(s),t._endAmount=o(c),t._multiplier=o(i),t._multiplier.connect(t),t._startAmount.connect(t),t._endAmount.connect(t),t.value=i.gain,t.startValue=s.gain,t.endValue=c.gain,t.startValue.value=0,t.endValue.value=0,Object.defineProperties(t,r),t}var r={attack:{value:0,writable:!0},decay:{value:0,writable:!0},sustain:{value:1,writable:!0},release:{value:0,writable:!0},getReleaseDuration:{value:function(){return this.release}},start:{value:function(e){var t=this._multiplier.gain,n=this._startAmount.gain,r=this._endAmount.gain;this._voltage.start(e),this._decayFrom=this._decayFrom=e+this.attack,this._startedAt=e;var i=this.sustain;t.cancelScheduledValues(e),n.cancelScheduledValues(e),r.cancelScheduledValues(e),r.setValueAtTime(0,e),this.attack?(t.setValueAtTime(0,e),t.linearRampToValueAtTime(1,e+this.attack),n.setValueAtTime(1,e),n.linearRampToValueAtTime(0,e+this.attack)):(t.setValueAtTime(1,e),n.setValueAtTime(0,e)),this.decay&&t.setTargetAtTime(i,this._decayFrom,s(this.decay))}},stop:{value:function(e,t){t&&(e-=this.release);var n=e+this.release;if(this.release){var r=this._multiplier.gain,i=this._startAmount.gain,a=this._endAmount.gain;r.cancelScheduledValues(e),i.cancelScheduledValues(e),a.cancelScheduledValues(e);var o=s(this.release);if(this.attack&&e<this._decayFrom){var l=c(0,1,this._startedAt,this._decayFrom,e);r.linearRampToValueAtTime(l,e),i.linearRampToValueAtTime(1-l,e),i.setTargetAtTime(0,e,o)}a.setTargetAtTime(1,e,o),r.setTargetAtTime(0,e,o)}return this._voltage.stop(n),n}},onended:{get:function(){return this._voltage.onended},set:function(e){this._voltage.onended=e}}},i=new Float32Array([1,1]);function a(e){var t=e.createBufferSource(),n=e.createBuffer(1,2,e.sampleRate);return n.getChannelData(0).set(i),t.buffer=n,t.loop=!0,t}function o(e){var t=e.context.createGain();return e.connect(t),t}function s(e){return Math.log(e+1)/Math.log(100)}function c(e,t,n,r,i){var a=t-e,o=r-n,s=e+(i-n)/o*a;return s<=e&&(s=e),s>=t&&(s=t),s}})),E=s(((e,t)=>{var n=T(),r={},i={gain:1,attack:.01,decay:.1,sustain:.9,release:.3,loop:!1,cents:0,loopStart:0,loopEnd:0};function a(e,t,n){var a=!1,o=0,s={},u=e.createGain();u.gain.value=1;var d=Object.assign({},i,n),f={context:e,out:u,opts:d};return t instanceof AudioBuffer?f.buffer=t:f.buffers=t,f.start=function(t,n,i){if(f.buffer&&t!==null)return f.start(null,t,n);var o=t?f.buffers[t]:f.buffer;if(!o){console.warn(`Buffer `+t+` not found.`);return}else if(!a){console.warn(`SamplePlayer not connected to any node.`);return}var s=i||r;n=Math.max(e.currentTime,n||0),f.emit(`start`,n,t,s);var c=m(t,o,s);return c.id=p(t,c),c.env.start(n),c.source.start(n),f.emit(`started`,n,c.id,c),s.duration&&c.stop(n+s.duration),c},f.play=function(e,t,n){return f.start(e,t,n)},f.stop=function(e,t){var n;return t||=Object.keys(s),t.map(function(t){return n=s[t],n?(n.stop(e),n.id):null})},f.connect=function(e){return a=!0,u.connect(e),f},f.emit=function(e,t,n,r){f.onevent&&f.onevent(e,t,n,r);var i=f[`on`+e];i&&i(t,n,r)},f;function p(t,n){return n.id=o++,s[n.id]=n,n.source.onended=function(){var t=e.currentTime;n.source.disconnect(),n.env.disconnect(),n.disconnect(),f.emit(`ended`,t,n.id,n)},n.id}function m(t,n,r){var i=e.createGain();return i.gain.value=0,i.connect(u),i.env=c(e,r,d),i.env.connect(i.gain),i.source=e.createBufferSource(),i.source.buffer=n,i.source.connect(i),i.source.loop=r.loop||d.loop,i.source.playbackRate.value=l(r.cents||d.cents),i.source.loopStart=r.loopStart||d.loopStart,i.source.loopEnd=r.loopEnd||d.loopEnd,i.stop=function(n){var r=n||e.currentTime;f.emit(`stop`,r,t);var a=i.env.stop(r);i.source.stop(a)},i}}function o(e){return typeof e==`number`}var s=[`attack`,`decay`,`sustain`,`release`];function c(e,t,r){var i=n(e),a=t.adsr||r.adsr;return s.forEach(function(e,n){a?i[e]=a[n]:i[e]=t[e]||r[e]}),i.value.value=o(t.gain)?t.gain:o(r.gain)?r.gain:1,i}function l(e){return e?2**(e/1200):1}t.exports=a})),D=s(((e,t)=>{t.exports=function(e){return e.on=function(t,r){if(arguments.length===1&&typeof t==`function`)return e.on(`event`,t);var i=`on`+t,a=e[i];return e[i]=a?n(a,r):r,e},e};function n(e,t){return function(n,r,i,a){e(n,r,i,a),t(n,r,i,a)}}})),O=s(((e,t)=>{var n=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function r(){return n}var i=[0,2,4,5,7,9,11];function a(e,t,r){if(typeof e!=`string`)return null;var a=n.exec(e);if(!a||!t&&a[4])return null;var s={letter:a[1].toUpperCase(),acc:a[2].replace(/x/g,`##`)};return s.pc=s.letter+s.acc,s.step=(s.letter.charCodeAt(0)+3)%7,s.alt=s.acc[0]===`b`?-s.acc.length:s.acc.length,s.chroma=i[s.step]+s.alt,a[3]&&(s.oct=+a[3],s.midi=s.chroma+12*(s.oct+1),s.freq=o(s.midi,r)),t&&(s.tonicOf=a[4]),s}function o(e,t){return 2**((e-69)/12)*(t||440)}var s={parse:a,regex:r,midiToFreq:o};[`letter`,`acc`,`pc`,`step`,`alt`,`chroma`,`oct`,`midi`,`freq`].forEach(function(e){s[e]=function(t){var n=a(t);return n&&n[e]!==void 0?n[e]:null}}),t.exports=s})),k=s(((e,t)=>{var n=O(),r=function(e){return e!==null&&e!==[]&&e>=0&&e<129},i=function(e){return r(e)?+e:n.midi(e)};t.exports=function(e){if(e.buffers){var t=e.opts.map,n=typeof t==`function`?t:i,r=function(e){return e?n(e)||e:null};e.buffers=a(e.buffers,r);var o=e.start;e.start=function(e,t,n){var i=r(e),a=i%1;return a&&(i=Math.floor(i),n=Object.assign(n||{},{cents:Math.floor(a*100)})),o(i,t,n)}}return e};function a(e,t){return Object.keys(e).reduce(function(n,r){return n[t(r)]=e[r],n},{})}})),A=s(((e,t)=>{var n=Array.isArray,r=function(e){return e&&typeof e==`object`},i={};t.exports=function(e){return e.schedule=function(t,a){var o=e.context.currentTime,s=t<o?o:t;e.emit(`schedule`,s,a);var c,l,u,d;return a.map(function(t){if(t)n(t)?(c=t[0],l=t[1]):(c=t.time,l=t);else return null;return r(l)?(u=l.name||l.key||l.note||l.midi||null,d=l):(u=l,d=i),e.start(u,s+(c||0),d)})},e}})),j=s(((e,t)=>{(function(n){if(typeof e==`object`&&t!==void 0)t.exports=n();else if(typeof define==`function`&&define.amd)define([],n);else{var r=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this;r.midimessage=n()}})(function(){return function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var c=typeof require==`function`&&require;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var l=Error(`Cannot find module '`+o+`'`);throw l.code=`MODULE_NOT_FOUND`,l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){var n=t[o][1][e];return i(n||e)},u,u.exports,e,t,n,r)}return n[o].exports}for(var a=typeof require==`function`&&require,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){function t(e){if(this._event=e,this._data=e.data,this.receivedTime=e.receivedTime,this._data&&this._data.length<2){console.warn(`Illegal MIDI message of length`,this._data.length);return}switch(this._messageCode=e.data[0]&240,this.channel=e.data[0]&15,this._messageCode){case 128:this.messageType=`noteoff`,this.key=e.data[1]&127,this.velocity=e.data[2]&127;break;case 144:this.messageType=`noteon`,this.key=e.data[1]&127,this.velocity=e.data[2]&127;break;case 160:this.messageType=`keypressure`,this.key=e.data[1]&127,this.pressure=e.data[2]&127;break;case 176:this.messageType=`controlchange`,this.controllerNumber=e.data[1]&127,this.controllerValue=e.data[2]&127,this.controllerNumber===120&&this.controllerValue===0?this.channelModeMessage=`allsoundoff`:this.controllerNumber===121?this.channelModeMessage=`resetallcontrollers`:this.controllerNumber===122?this.controllerValue===0?this.channelModeMessage=`localcontroloff`:this.channelModeMessage=`localcontrolon`:this.controllerNumber===123&&this.controllerValue===0?this.channelModeMessage=`allnotesoff`:this.controllerNumber===124&&this.controllerValue===0?this.channelModeMessage=`omnimodeoff`:this.controllerNumber===125&&this.controllerValue===0?this.channelModeMessage=`omnimodeon`:this.controllerNumber===126?this.channelModeMessage=`monomodeon`:this.controllerNumber===127&&(this.channelModeMessage=`polymodeon`);break;case 192:this.messageType=`programchange`,this.program=e.data[1];break;case 208:this.messageType=`channelpressure`,this.pressure=e.data[1]&127;break;case 224:this.messageType=`pitchbendchange`;var t=e.data[2]&127,n=e.data[1]&127;this.pitchBend=(t<<8)+n;break}}return new t(e)},t.exports=n.default},{}]},{},[1])(1)})})),ee=s(((e,t)=>{var n=j();t.exports=function(e){return e.listenToMidi=function(t,r){var i={},a=r||{},o=a.gain||function(e){return e/127};return t.onmidimessage=function(t){var r=t.messageType?t:n(t);if(r.messageType===`noteon`&&r.velocity===0&&(r.messageType=`noteoff`),!(a.channel&&r.channel!==a.channel))switch(r.messageType){case`noteon`:i[r.key]=e.play(r.key,0,{gain:o(r.velocity)});break;case`noteoff`:i[r.key]&&(i[r.key].stop(),delete i[r.key]);break}},e},e}})),te=s(((e,t)=>{var n=E(),r=D(),i=k(),a=A(),o=ee();function s(e,t,s){return o(a(i(r(n(e,t,s)))))}typeof t==`object`&&t.exports&&(t.exports=s),typeof window<`u`&&(window.SamplePlayer=s)})),ne=c({acc:()=>me,alt:()=>_e,build:()=>ue,chroma:()=>ve,freq:()=>fe,letter:()=>pe,midi:()=>de,oct:()=>ye,parse:()=>N,pc:()=>he,regex:()=>se,step:()=>ge});function re(e,t){return Array(t+1).join(e)}function ie(e){return typeof e==`number`}function M(e){return typeof e==`string`}function ae(e){return e!==void 0}function oe(e,t){return 2**((e-69)/12)*(t||440)}function se(){return be}function N(e,t,n){if(typeof e!=`string`)return null;var r=be.exec(e);if(!r||!t&&r[4])return null;var i={letter:r[1].toUpperCase(),acc:r[2].replace(/x/g,`##`)};i.pc=i.letter+i.acc,i.step=(i.letter.charCodeAt(0)+3)%7,i.alt=i.acc[0]===`b`?-i.acc.length:i.acc.length;var a=xe[i.step]+i.alt;return i.chroma=a<0?12+a:a%12,r[3]&&(i.oct=+r[3],i.midi=a+12*(i.oct+1),i.freq=oe(i.midi,n)),t&&(i.tonicOf=r[4]),i}function ce(e){return ie(e)?e<0?re(`b`,-e):re(`#`,e):``}function le(e){return ie(e)?``+e:``}function ue(e,t,n){return e==null?null:e.step?ue(e.step,e.alt,e.oct):e<0||e>6?null:Se.charAt(e)+ce(t)+le(n)}function de(e){if((ie(e)||M(e))&&e>=0&&e<128)return+e;var t=N(e);return t&&ae(t.midi)?t.midi:null}function fe(e,t){var n=de(e);return n===null?null:oe(n,t)}function pe(e){return(N(e)||{}).letter}function me(e){return(N(e)||{}).acc}function he(e){return(N(e)||{}).pc}function ge(e){return(N(e)||{}).step}function _e(e){return(N(e)||{}).alt}function ve(e){return(N(e)||{}).chroma}function ye(e){return(N(e)||{}).oct}var be,xe,Se,Ce=o((()=>{be=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/,xe=[0,2,4,5,7,9,11],Se=`CDEFGAB`})),we=s(((e,t)=>{var n=(Ce(),d(ne));function r(e,t){if(console.warn(`new Soundfont() is deprected`),console.log(`Please use Soundfont.instrument() instead of new Soundfont().instrument()`),!(this instanceof r))return new r(e);this.nameToUrl=t||r.nameToUrl,this.ctx=e,this.instruments={},this.promises=[]}r.prototype.onready=function(e){console.warn(`deprecated API`),console.log(`Please use Promise.all(Soundfont.instrument(), Soundfont.instrument()).then() instead of new Soundfont().onready()`),Promise.all(this.promises).then(e)},r.prototype.instrument=function(e,t){console.warn(`new Soundfont().instrument() is deprecated.`),console.log(`Please use Soundfont.instrument() instead.`);var n=this.ctx;if(e||=`default`,e in this.instruments)return this.instruments[e];var i={name:e,play:a(n,t)};if(this.instruments[e]=i,e!=="default"){var o=r.instrument(n,e,t).then(function(e){return i.play=e.play,i});this.promises.push(o),i.onready=function(e){console.warn(`onready is deprecated. Use Soundfont.instrument().then()`),o.then(e)}}else i.onready=function(e){console.warn(`onready is deprecated. Use Soundfont.instrument().then()`),e()};return i};function i(e,t,n){return console.warn(`Soundfont.loadBuffers is deprecate.`),console.log(`Use Soundfont.instrument(..) and get buffers properties from the result.`),r.instrument(e,t,n).then(function(e){return e.buffers})}r.loadBuffers=i;function a(e,t){return t||={},function(r,i,a,o){console.warn(`The oscillator player is deprecated.`),console.log(`Starting with version 0.9.0 you will have to wait until the soundfont is loaded to play sounds.`);var s=r>0&&r<129?+r:n.midi(r),c=s?n.midiToFreq(s,440):null;if(c){a||=.2,o||={};var l=o.destination||t.destination||e.destination,u=o.vcoType||t.vcoType||`sine`,d=o.gain||t.gain||.4,f=e.createOscillator();f.type=u,f.frequency.value=c;var p=e.createGain();return p.gain.value=d,f.connect(p),p.connect(l),f.start(i),a>0&&f.stop(i+a),f}}}r.noteToMidi=n.midi,t.exports=r})),Te=u(s(((e,t)=>{var n=w(),r=te();function i(e,t,s){if(arguments.length===1)return function(t,n){return i(e,t,n)};var c=s||{},l=c.isSoundfontURL||a,u=c.nameToUrl||o,d=l(t)?t:u(t,c.soundfont,c.format);return n(e,d,{only:c.only||c.notes}).then(function(n){var i=r(e,n,c).connect(c.destination?c.destination:e.destination);return i.url=d,i.name=t,i})}function a(e){return/\.js(\?.*)?$/i.test(e)}function o(e,t,n){return n=n===`ogg`?n:`mp3`,t=t===`FluidR3_GM`?t:`MusyngKite`,`https://gleitz.github.io/midi-js-soundfonts/`+t+`/`+e+`-`+n+`.js`}var s=we();s.instrument=i,s.nameToUrl=o,typeof t==`object`&&t.exports&&(t.exports=s),typeof window<`u`&&(window.Soundfont=s)}))(),1),Ee=class{constructor(){this.players=new Map,this.instruments=b.filter(e=>x.includes(this.getSoundfontInstrumentName(e[1]))).map(e=>({midiId:e[0],name:e[1],loaded:!1}))}init(e){this.audioContext=e}async load(e){let t=this.instruments.find(t=>t.midiId===e);if(!t)throw Error(`SoundfontPlayer does not support midi instrument ID `+e);if(this.players.has(e))return;let n=await Te.instrument(this.audioContext,this.getSoundfontInstrumentName(t.name));this.players.set(e,n)}stop(e){this.players.has(e)&&this.players.get(e).stop()}schedule(e,t,n){this.verifyPlayerLoaded(e),this.applyDynamics(n),this.players.get(e).schedule(t,n)}applyDynamics(e){for(let t of e)t.articulation===y.Staccato&&(t.gain=Math.max(t.gain+.3,t.gain*1.3),t.duration=Math.min(t.duration*.4,.4))}verifyPlayerLoaded(e){if(!this.players.has(e))throw Error(`No soundfont player loaded for midi instrument `+e)}getSoundfontInstrumentName(e){return e.toLowerCase().replace(/\s+/g,`_`)}};function De(e){return e.ParentVoiceEntry.isStaccato()?y.Staccato:y.None}function Oe(e,t){let n=e.Length.RealValue*t;return e.NoteTie&&(Object.is(e.NoteTie.StartNote,e)&&e.NoteTie.Notes[1]?n+=e.NoteTie.Notes[1].Length.RealValue*t:n=0),n}function ke(e){return e.ParentVoiceEntry.ParentVoice.Volume}var Ae=class{constructor(){this.subscribers=new Map}on(e,t){this.subscribers.get(e)||this.subscribers.set(e,[]),this.subscribers.get(e).push(t)}emit(e,...t){let n=this.subscribers.get(e)||[];for(let e of n)e(...t)}},je=s(((e,t)=>{function n(e){if(Array.isArray(e))return e}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Me=s(((e,t)=>{function n(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Ne=s(((e,t)=>{function n(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Pe=s(((e,t)=>{var n=Ne();function r(e,t){if(e){if(typeof e==`string`)return n(e,t);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),Fe=s(((e,t)=>{function n(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Ie=s(((e,t)=>{var n=je(),r=Me(),i=Pe(),a=Fe();function o(e,t){return n(e)||r(e,t)||i(e,t)||a()}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports})),Le=s(((e,t)=>{function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Re=s(((e,t)=>{function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),ze=s(((e,t)=>{var n=Re().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),Be=s(((e,t)=>{var n=Re().default,r=ze();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),Ve=s(((e,t)=>{var n=Be();function r(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,`value`in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),He=s(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e,Ie(),Le(),Ve()):typeof define==`function`&&define.amd?define([`exports`,`@babel/runtime/helpers/slicedToArray`,`@babel/runtime/helpers/classCallCheck`,`@babel/runtime/helpers/createClass`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n.automationEvents={},n._slicedToArray,n._classCallCheck,n._createClass))})(e,(function(e,t,n,r){"use strict";var i=function(e,t,n){return{endTime:t,insertTime:n,type:`exponentialRampToValue`,value:e}},a=function(e,t,n){return{endTime:t,insertTime:n,type:`linearRampToValue`,value:e}},o=function(e,t){return{startTime:t,type:`setValue`,value:e}},s=function(e,t,n){return{duration:n,startTime:t,type:`setValueCurve`,values:e}},c=function(e,t,n){var r=n.startTime,i=n.target,a=n.timeConstant;return i+(t-i)*Math.exp((r-e)/a)},l=function(e){return e.type===`exponentialRampToValue`},u=function(e){return e.type===`linearRampToValue`},d=function(e){return l(e)||u(e)},f=function(e){return e.type===`setValue`},p=function(e){return e.type===`setValueCurve`},m=function(e,t,n,r){var i=e[t];return i===void 0?r:d(i)||f(i)?i.value:p(i)?i.values[i.values.length-1]:c(n,m(e,t-1,i.startTime,r),i)},h=function(e,t,n,r,i){return n===void 0?[r.insertTime,i]:d(n)?[n.endTime,n.value]:f(n)?[n.startTime,n.value]:p(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,m(e,t-1,n.startTime,i)]},g=function(e){return e.type===`cancelAndHold`},_=function(e){return e.type===`cancelScheduledValues`},v=function(e){return g(e)||_(e)?e.cancelTime:l(e)||u(e)?e.endTime:e.startTime},y=function(e,t,n,r){var i=r.endTime,a=r.value;return n===a?a:0<n&&0<a||n<0&&a<0?n*(a/n)**+((e-t)/(i-t)):e<i?n:a},b=function(e,t,n,r){var i=r.endTime,a=r.value;return n+(e-t)/(i-t)*(a-n)},x=function(e,t){var n=Math.floor(t),r=Math.ceil(t);return n===r?e[n]:(1-(t-n))*e[n]+(1-(r-t))*e[r]},S=function(e,t){var n=t.duration,r=t.startTime,i=t.values;return x(i,(e-r)/n*(i.length-1))},C=function(e){return e.type===`setTarget`};e.AutomationEventList=function(){function e(t){n(this,e),this._automationEvents=[],this._currenTime=0,this._defaultValue=t}return r(e,[{key:Symbol.iterator,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:`add`,value:function(e){var t=v(e);if(g(e)||_(e)){var n=this._automationEvents.findIndex(function(n){return _(e)&&p(n)?n.startTime+n.duration>=t:v(n)>=t}),r=this._automationEvents[n];if(n!==-1&&(this._automationEvents=this._automationEvents.slice(0,n)),g(e)){var c=this._automationEvents[this._automationEvents.length-1];if(r!==void 0&&d(r)){if(c!==void 0&&C(c))throw Error(`The internal list is malformed.`);var f=c===void 0?r.insertTime:p(c)?c.startTime+c.duration:v(c),m=c===void 0?this._defaultValue:p(c)?c.values[c.values.length-1]:c.value,h=l(r)?y(t,f,m,r):b(t,f,m,r),x=l(r)?i(h,t,this._currenTime):a(h,t,this._currenTime);this._automationEvents.push(x)}if(c!==void 0&&C(c)&&this._automationEvents.push(o(this.getValue(t),t)),c!==void 0&&p(c)&&c.startTime+c.duration>t){var S=t-c.startTime,w=(c.values.length-1)/c.duration,T=Math.max(2,1+Math.ceil(S*w)),E=S/(T-1)*w,D=c.values.slice(0,T);if(E<1)for(var O=1;O<T;O+=1){var k=E*O%1;D[O]=c.values[O-1]*(1-k)+c.values[O]*k}this._automationEvents[this._automationEvents.length-1]=s(D,c.startTime,S)}}}else{var A=this._automationEvents.findIndex(function(e){return v(e)>t}),j=A===-1?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[A-1];if(j!==void 0&&p(j)&&v(j)+j.duration>t)return!1;var ee=l(e)?i(e.value,e.endTime,this._currenTime):u(e)?a(e.value,t,this._currenTime):e;if(A===-1)this._automationEvents.push(ee);else{if(p(e)&&t+e.duration>v(this._automationEvents[A]))return!1;this._automationEvents.splice(A,0,ee)}}return!0}},{key:`flush`,value:function(e){var t=this._automationEvents.findIndex(function(t){return v(t)>e});if(t>1){var n=this._automationEvents.slice(t-1),r=n[0];C(r)&&n.unshift(o(m(this._automationEvents,t-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=n}}},{key:`getValue`,value:function(e){if(this._automationEvents.length===0)return this._defaultValue;var n=this._automationEvents.findIndex(function(t){return v(t)>e}),r=this._automationEvents[n],i=(n===-1?this._automationEvents.length:n)-1,a=this._automationEvents[i];if(a!==void 0&&C(a)&&(r===void 0||!d(r)||r.insertTime>e))return c(e,m(this._automationEvents,i-1,a.startTime,this._defaultValue),a);if(a!==void 0&&f(a)&&(r===void 0||!d(r)))return a.value;if(a!==void 0&&p(a)&&(r===void 0||!d(r)||a.startTime+a.duration>e))return e<a.startTime+a.duration?S(e,a):a.values[a.values.length-1];if(a!==void 0&&d(a)&&(r===void 0||!d(r)))return a.value;if(r!==void 0&&l(r)){var o=t(h(this._automationEvents,i,a,r,this._defaultValue),2),s=o[0],g=o[1];return y(e,s,g,r)}if(r!==void 0&&u(r)){var _=t(h(this._automationEvents,i,a,r,this._defaultValue),2),x=_[0],w=_[1];return b(e,x,w,r)}return this._defaultValue}}])}(),e.createCancelAndHoldAutomationEvent=function(e){return{cancelTime:e,type:`cancelAndHold`}},e.createCancelScheduledValuesAutomationEvent=function(e){return{cancelTime:e,type:`cancelScheduledValues`}},e.createExponentialRampToValueAutomationEvent=function(e,t){return{endTime:t,type:`exponentialRampToValue`,value:e}},e.createLinearRampToValueAutomationEvent=function(e,t){return{endTime:t,type:`linearRampToValue`,value:e}},e.createSetTargetAutomationEvent=function(e,t,n){return{startTime:t,target:e,timeConstant:n,type:`setTarget`}},e.createSetValueAutomationEvent=o,e.createSetValueCurveAutomationEvent=s}))}))(),Ue=()=>new DOMException(``,`AbortError`),We=e=>(t,n,[r,i,a],o)=>{e(t[i],[n,r,a],e=>e[0]===n&&e[1]===r,o)},Ge=e=>(t,n,r)=>{let i=[];for(let e=0;e<r.numberOfInputs;e+=1)i.push(new Set);e.set(t,{activeInputs:i,outputs:new Set,passiveInputs:new WeakMap,renderer:n})},Ke=e=>(t,n)=>{e.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:n})},qe=new WeakSet,Je=new WeakMap,Ye=new WeakMap,Xe=new WeakMap,Ze=new WeakMap,Qe=new WeakMap,$e=new WeakMap,et=new WeakMap,tt=new WeakMap,nt={construct(){return nt}},rt=e=>{try{new new Proxy(e,nt)}catch{return!1}return!0},it=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,at=(e,t)=>{let n=[],r=e.replace(/^[\s]+/,``),i=r.match(it);for(;i!==null;){let e=i[1].slice(1,-1),a=i[0].replace(/([\s]+)?;?$/,``).replace(e,new URL(e,t).toString());n.push(a),r=r.slice(i[0].length).replace(/^[\s]+/,``),i=r.match(it)}return[n.join(`;`),r]},ot=e=>{if(e!==void 0&&!Array.isArray(e))throw TypeError(`The parameterDescriptors property of given value for processorCtor is not an array.`)},st=e=>{if(!rt(e))throw TypeError(`The given value for processorCtor should be a constructor.`);if(e.prototype===null||typeof e.prototype!=`object`)throw TypeError(`The given value for processorCtor should have a prototype.`)},ct=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{let p=0;return(m,h,g={credentials:`omit`})=>{let _=u.get(m);if(_!==void 0&&_.has(h))return Promise.resolve();let v=l.get(m);if(v!==void 0){let e=v.get(h);if(e!==void 0)return e}let y=a(m),b=y.audioWorklet===void 0?i(h).then(([e,t])=>{let[r,i]=at(e,t);return n(`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}
|
|
3
|
+
})})(window,'_AWGS')`)}).then(()=>{let e=f._AWGS.pop();if(e===void 0)throw SyntaxError();r(y.currentTime,y.sampleRate,()=>e(class{},void 0,(e,n)=>{if(e.trim()===``)throw t();let r=tt.get(y);if(r!==void 0){if(r.has(e))throw t();st(n),ot(n.parameterDescriptors),r.set(e,n)}else st(n),ot(n.parameterDescriptors),tt.set(y,new Map([[e,n]]))},y.sampleRate,void 0,void 0))}):Promise.all([i(h),Promise.resolve(e(d,d))]).then(([[e,t],n])=>{let r=p+1;p=r;let[i,a]=at(e,t),l=`${i};((AudioWorkletProcessor,registerProcessor)=>{${a}
|
|
4
|
+
})(${n?`AudioWorkletProcessor`:`class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}`},(n,p)=>registerProcessor(n,class extends p{${n?``:`__c = (a) => a.forEach(e=>this.__b.add(e.buffer));`}process(i,o,p){${n?``:`i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));`}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${r}',class extends AudioWorkletProcessor{process(){return !1}})`,u=new Blob([l],{type:`application/javascript; charset=utf-8`}),d=URL.createObjectURL(u);return y.audioWorklet.addModule(d,g).then(()=>{if(s(y))return y;let e=o(y);return e.audioWorklet.addModule(d,g).then(()=>e)}).then(e=>{if(c===null)throw SyntaxError();try{new c(e,`__sac${r}`)}catch{throw SyntaxError()}}).finally(()=>URL.revokeObjectURL(d))});return v===void 0?l.set(m,new Map([[h,b]])):v.set(h,b),b.then(()=>{let e=u.get(m);e===void 0?u.set(m,new Set([h])):e.add(h)}).finally(()=>{let e=l.get(m);e!==void 0&&e.delete(h)}),b}},lt=(e,t)=>{let n=e.get(t);if(n===void 0)throw Error(`A value with the given key could not be found.`);return n},ut=(e,t)=>{let n=Array.from(e).filter(t);if(n.length>1)throw Error(`More than one element was found.`);if(n.length===0)throw Error(`No element was found.`);let[r]=n;return e.delete(r),r},dt=(e,t,n,r)=>{let i=lt(e,t),a=ut(i,e=>e[0]===n&&e[1]===r);return i.size===0&&e.delete(t),a},ft=e=>lt($e,e),pt=e=>{if(qe.has(e))throw Error(`The AudioNode is already stored.`);qe.add(e),ft(e).forEach(e=>e(!0))},mt=e=>`port`in e,ht=e=>{if(!qe.has(e))throw Error(`The AudioNode is not stored.`);qe.delete(e),ft(e).forEach(e=>e(!1))},gt=(e,t)=>{!mt(e)&&t.every(e=>e.size===0)&&ht(e)},_t=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{let p=new WeakMap;return(m,h,g,_,v)=>{let{activeInputs:y,passiveInputs:b}=a(h),{outputs:x}=a(m),S=s(m),C=a=>{let s=c(h),l=c(m);if(a){let t=dt(b,m,g,_);e(y,m,t,!1),!v&&!d(m)&&n(l,s,g,_),f(h)&&pt(h)}else{let e=r(y,m,g,_);t(b,_,e,!1),!v&&!d(m)&&i(l,s,g,_);let n=o(h);if(n===0)u(h)&>(h,y);else{let e=p.get(h);e!==void 0&&clearTimeout(e),p.set(h,setTimeout(()=>{u(h)&>(h,y)},n*1e3))}}};return l(x,[h,g,_],e=>e[0]===h&&e[1]===g&&e[2]===_,!0)?(S.add(C),u(m)?e(y,m,[g,_,C],!0):t(b,_,[m,g,C],!0),!0):!1}},vt=e=>(t,n,[r,i,a],o)=>{let s=t.get(r);s===void 0?t.set(r,new Set([[i,n,a]])):e(s,[i,n,a],e=>e[0]===i&&e[1]===n,o)},yt=e=>(t,n)=>{let r=e(t,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,gain:0});n.connect(r).connect(t.destination);let i=()=>{n.removeEventListener(`ended`,i),n.disconnect(r),r.disconnect()};n.addEventListener(`ended`,i)},bt={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},xt=(e,t,n,r,i,a)=>class extends e{constructor(e,n){let o=i(e),s=r(o,{...bt,...n}),c=a(o)?t():null;super(e,!1,s,c),this._nativeAnalyserNode=s}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(e){this._nativeAnalyserNode.fftSize=e}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(e){let t=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=e,!(e>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=t,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(e){let t=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=e,!(this._nativeAnalyserNode.maxDecibels>e))throw this._nativeAnalyserNode.minDecibels=t,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(e){this._nativeAnalyserNode.smoothingTimeConstant=e}getByteFrequencyData(e){this._nativeAnalyserNode.getByteFrequencyData(e)}getByteTimeDomainData(e){this._nativeAnalyserNode.getByteTimeDomainData(e)}getFloatFrequencyData(e){this._nativeAnalyserNode.getFloatFrequencyData(e)}getFloatTimeDomainData(e){this._nativeAnalyserNode.getFloatTimeDomainData(e)}},P=(e,t)=>e.context===t,St=(e,t,n)=>()=>{let r=new WeakMap,i=async(i,a)=>{let o=t(i);return P(o,a)||(o=e(a,{channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,fftSize:o.fftSize,maxDecibels:o.maxDecibels,minDecibels:o.minDecibels,smoothingTimeConstant:o.smoothingTimeConstant})),r.set(a,o),await n(i,a,o),o};return{render(e,t){let n=r.get(t);return n===void 0?i(e,t):Promise.resolve(n)}}},Ct=e=>{try{e.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},wt=()=>new DOMException(``,`IndexSizeError`),Tt=e=>{e.getChannelData=(t=>n=>{try{return t.call(e,n)}catch(e){throw e.code===12?wt():e}})(e.getChannelData)},Et={numberOfChannels:1},Dt=(e,t,n,r,i,a,o,s)=>{let c=null;return class l{constructor(l){if(i===null)throw Error(`Missing the native OfflineAudioContext constructor.`);let{length:u,numberOfChannels:d,sampleRate:f}={...Et,...l};c===null&&(c=new i(1,1,44100));let p=r!==null&&t(a,a)?new r({length:u,numberOfChannels:d,sampleRate:f}):c.createBuffer(d,u,f);if(p.numberOfChannels===0)throw n();return typeof p.copyFromChannel==`function`?t(Ct,()=>Ct(p))||s(p):(o(p),Tt(p)),e.add(p),p}static[Symbol.hasInstance](t){return typeof t==`object`&&!!t&&Object.getPrototypeOf(t)===l.prototype||e.has(t)}}},F=-34028234663852886e22,I=34028234663852886e22,L=e=>qe.has(e),Ot={buffer:null,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,loop:!1,loopEnd:0,loopStart:0,playbackRate:1},kt=(e,t,n,r,i,a,o,s)=>class extends e{constructor(e,r){let s=a(e),c={...Ot,...r},l=i(s,c),u=o(s),d=u?t():null;super(e,!1,l,d),this._audioBufferSourceNodeRenderer=d,this._isBufferNullified=!1,this._isBufferSet=c.buffer!==null,this._nativeAudioBufferSourceNode=l,this._onended=null,this._playbackRate=n(this,u,l.playbackRate,I,F)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(e){if(this._nativeAudioBufferSourceNode.buffer=e,e!==null){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(e){this._nativeAudioBufferSourceNode.loop=e}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(e){this._nativeAudioBufferSourceNode.loopEnd=e}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(e){this._nativeAudioBufferSourceNode.loopStart=e}get onended(){return this._onended}set onended(e){let t=typeof e==`function`?s(this,e):null;this._nativeAudioBufferSourceNode.onended=t;let n=this._nativeAudioBufferSourceNode.onended;this._onended=n!==null&&n===t?e:n}get playbackRate(){return this._playbackRate}start(e=0,t=0,n){if(this._nativeAudioBufferSourceNode.start(e,t,n),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.start=n===void 0?[e,t]:[e,t,n]),this.context.state!==`closed`){pt(this);let e=()=>{this._nativeAudioBufferSourceNode.removeEventListener(`ended`,e),L(this)&&ht(this)};this._nativeAudioBufferSourceNode.addEventListener(`ended`,e)}}stop(e=0){this._nativeAudioBufferSourceNode.stop(e),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.stop=e)}},At=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=null,s=null,c=async(c,l)=>{let u=n(c),d=P(u,l);return d||(u=t(l,{buffer:u.buffer,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,loop:u.loop,loopEnd:u.loopEnd,loopStart:u.loopStart,playbackRate:u.playbackRate.value}),o!==null&&u.start(...o),s!==null&&u.stop(s)),a.set(l,u),d?await e(l,c.playbackRate,u.playbackRate):await r(l,c.playbackRate,u.playbackRate),await i(c,l,u),u};return{set start(e){o=e},set stop(e){s=e},render(e,t){let n=a.get(t);return n===void 0?c(e,t):Promise.resolve(n)}}},jt=e=>`playbackRate`in e,Mt=e=>`frequency`in e&&`gain`in e,Nt=e=>`offset`in e,Pt=e=>!(`frequency`in e)&&`gain`in e,Ft=e=>`detune`in e&&`frequency`in e&&!(`gain`in e),It=e=>`pan`in e,R=e=>lt(Je,e),Lt=e=>lt(Xe,e),Rt=(e,t)=>{let{activeInputs:n}=R(e);n.forEach(n=>n.forEach(([n])=>{t.includes(e)||Rt(n,[...t,e])}));let r=jt(e)?[e.playbackRate]:mt(e)?Array.from(e.parameters.values()):Mt(e)?[e.Q,e.detune,e.frequency,e.gain]:Nt(e)?[e.offset]:Pt(e)?[e.gain]:Ft(e)?[e.detune,e.frequency]:It(e)?[e.pan]:[];for(let e of r){let n=Lt(e);n!==void 0&&n.activeInputs.forEach(([e])=>Rt(e,t))}L(e)&&ht(e)},zt=e=>{Rt(e.destination,[])},Bt=e=>e===void 0||typeof e==`number`||typeof e==`string`&&(e===`balanced`||e===`interactive`||e===`playback`),Vt=(e,t,n,r,i,a,o,s,c)=>class extends e{constructor(e={}){if(c===null)throw Error(`Missing the native AudioContext constructor.`);let t;try{t=new c(e)}catch(e){throw e.code===12&&e.message===`sampleRate is not in range`?n():e}if(t===null)throw r();if(!Bt(e.latencyHint))throw TypeError(`The provided value '${e.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(e.sampleRate!==void 0&&t.sampleRate!==e.sampleRate)throw n();super(t,2);let{latencyHint:i}=e,{sampleRate:a}=t;if(this._baseLatency=typeof t.baseLatency==`number`?t.baseLatency:i===`balanced`?512/a:i===`interactive`||i===void 0?256/a:i===`playback`?1024/a:Math.max(2,Math.min(128,Math.round(i*a/128)))*128/a,this._nativeAudioContext=t,c.name===`webkitAudioContext`?(this._nativeGainNode=t.createGain(),this._nativeOscillatorNode=t.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(t.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,t.state===`running`){this._state=`suspended`;let e=()=>{this._state===`suspended`&&(this._state=null),t.removeEventListener(`statechange`,e)};t.addEventListener(`statechange`,e)}}get baseLatency(){return this._baseLatency}get state(){return this._state===null?this._nativeAudioContext.state:this._state}close(){return this.state===`closed`?this._nativeAudioContext.close().then(()=>{throw t()}):(this._state===`suspended`&&(this._state=null),this._nativeAudioContext.close().then(()=>{this._nativeGainNode!==null&&this._nativeOscillatorNode!==null&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),zt(this)}))}createMediaElementSource(e){return new i(this,{mediaElement:e})}createMediaStreamDestination(){return new a(this)}createMediaStreamSource(e){return new o(this,{mediaStream:e})}createMediaStreamTrackSource(e){return new s(this,{mediaStreamTrack:e})}resume(){return this._state===`suspended`?new Promise((e,t)=>{let n=()=>{this._nativeAudioContext.removeEventListener(`statechange`,n),this._nativeAudioContext.state===`running`?e():this.resume().then(e,t)};this._nativeAudioContext.addEventListener(`statechange`,n)}):this._nativeAudioContext.resume().catch(e=>{throw e===void 0||e.code===15?t():e})}suspend(){return this._nativeAudioContext.suspend().catch(e=>{throw e===void 0?t():e})}},Ht=(e,t,n,r,i,a,o,s)=>class extends e{constructor(e,n){let r=a(e),c=o(r),l=i(r,n,c),u=c?t(s):null;super(e,!1,l,u),this._isNodeOfNativeOfflineAudioContext=c,this._nativeAudioDestinationNode=l}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(e>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=e}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=e}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}},Ut=e=>{let t=new WeakMap,n=async(n,r)=>{let i=r.destination;return t.set(r,i),await e(n,r,i),i};return{render(e,r){let i=t.get(r);return i===void 0?n(e,r):Promise.resolve(i)}}},Wt=(e,t,n,r,i,a,o,s)=>(c,l)=>{let u=l.listener,{forwardX:d,forwardY:f,forwardZ:p,positionX:m,positionY:h,positionZ:g,upX:_,upY:v,upZ:y}=u.forwardX===void 0?(()=>{let d=new Float32Array(1),f=t(l,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:9}),p=o(l),m=!1,h=[0,0,-1,0,1,0],g=[0,0,0],_=()=>{if(m)return;m=!0;let e=r(l,256,9,0);e.onaudioprocess=({inputBuffer:e})=>{let t=[a(e,d,0),a(e,d,1),a(e,d,2),a(e,d,3),a(e,d,4),a(e,d,5)];t.some((e,t)=>e!==h[t])&&(u.setOrientation(...t),h=t);let n=[a(e,d,6),a(e,d,7),a(e,d,8)];n.some((e,t)=>e!==g[t])&&(u.setPosition(...n),g=n)},f.connect(e)},v=e=>t=>{t!==h[e]&&(h[e]=t,u.setOrientation(...h))},y=e=>t=>{t!==g[e]&&(g[e]=t,u.setPosition(...g))},b=(t,r,a)=>{let o=n(l,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,offset:r});o.connect(f,0,t),o.start(),Object.defineProperty(o.offset,"defaultValue",{get(){return r}});let u=e({context:c},p,o.offset,I,F);return s(u,`value`,e=>()=>e.call(u),e=>t=>{try{e.call(u,t)}catch(e){if(e.code!==9)throw e}_(),p&&a(t)}),u.cancelAndHoldAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.cancelAndHoldAtTime),u.cancelScheduledValues=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.cancelScheduledValues),u.exponentialRampToValueAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.exponentialRampToValueAtTime),u.linearRampToValueAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.linearRampToValueAtTime),u.setTargetAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.setTargetAtTime),u.setValueAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.setValueAtTime),u.setValueCurveAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.setValueCurveAtTime),u};return{forwardX:b(0,0,v(0)),forwardY:b(1,0,v(1)),forwardZ:b(2,-1,v(2)),positionX:b(6,0,y(0)),positionY:b(7,0,y(1)),positionZ:b(8,0,y(2)),upX:b(3,0,v(3)),upY:b(4,1,v(4)),upZ:b(5,0,v(5))}})():u;return{get forwardX(){return d},get forwardY(){return f},get forwardZ(){return p},get positionX(){return m},get positionY(){return h},get positionZ(){return g},get upX(){return _},get upY(){return v},get upZ(){return y}}},Gt=e=>`context`in e,Kt=e=>Gt(e[0]),qt=(e,t,n,r)=>{for(let t of e)if(n(t)){if(r)return!1;throw Error(`The set contains at least one similar element.`)}return e.add(t),!0},Jt=(e,t,[n,r],i)=>{qt(e,[t,n,r],e=>e[0]===t&&e[1]===n,i)},Yt=(e,[t,n,r],i)=>{let a=e.get(t);a===void 0?e.set(t,new Set([[n,r]])):qt(a,[n,r],e=>e[0]===n,i)},Xt=e=>`inputs`in e,Zt=(e,t,n,r)=>{if(Xt(t)){let i=t.inputs[r];return e.connect(i,n,0),[i,n,0]}return e.connect(t,n,r),[t,n,r]},Qt=(e,t,n)=>{for(let r of e)if(r[0]===t&&r[1]===n)return e.delete(r),r;return null},$t=(e,t,n)=>ut(e,e=>e[0]===t&&e[1]===n),en=(e,t)=>{if(!ft(e).delete(t))throw Error(`Missing the expected event listener.`)},tn=(e,t,n)=>{let r=lt(e,t),i=ut(r,e=>e[0]===n);return r.size===0&&e.delete(t),i},nn=(e,t,n,r)=>{Xt(t)?e.disconnect(t.inputs[r],n,0):e.disconnect(t,n,r)},z=e=>lt(Ye,e),rn=e=>lt(Ze,e),an=e=>et.has(e),on=e=>!qe.has(e),sn=(e,t)=>new Promise(n=>{if(t!==null)n(!0);else{let t=e.createScriptProcessor(256,1,1),r=e.createGain(),i=e.createBuffer(1,2,44100),a=i.getChannelData(0);a[0]=1,a[1]=1;let o=e.createBufferSource();o.buffer=i,o.loop=!0,o.connect(t).connect(e.destination),o.connect(r),o.disconnect(r),t.onaudioprocess=r=>{let i=r.inputBuffer.getChannelData(0);Array.prototype.some.call(i,e=>e===1)?n(!0):n(!1),o.stop(),t.onaudioprocess=null,o.disconnect(t),t.disconnect(e.destination)},o.start()}}),cn=(e,t)=>{let n=new Map;for(let t of e)for(let e of t){let t=n.get(e);n.set(e,t===void 0?1:t+1)}n.forEach((e,n)=>t(n,e))},ln=e=>`context`in e,un=e=>{let t=new Map;e.connect=(e=>(n,r=0,i=0)=>{let a=ln(n)?e(n,r,i):e(n,r),o=t.get(n);return o===void 0?t.set(n,[{input:i,output:r}]):o.every(e=>e.input!==i||e.output!==r)&&o.push({input:i,output:r}),a})(e.connect.bind(e)),e.disconnect=(n=>(r,i,a)=>{if(n.apply(e),r===void 0)t.clear();else if(typeof r==`number`)for(let[e,n]of t){let i=n.filter(e=>e.output!==r);i.length===0?t.delete(e):t.set(e,i)}else if(t.has(r))if(i===void 0)t.delete(r);else{let e=t.get(r);if(e!==void 0){let n=e.filter(e=>e.output!==i&&(e.input!==a||a===void 0));n.length===0?t.delete(r):t.set(r,n)}}for(let[n,r]of t)r.forEach(t=>{ln(n)?e.connect(n,t.output,t.input):e.connect(n,t.output)})})(e.disconnect)},dn=(e,t,n,r)=>{let{activeInputs:i,passiveInputs:a}=Lt(t),{outputs:o}=R(e),s=ft(e),c=o=>{let s=z(e),c=rn(t);if(o){let t=tn(a,e,n);Jt(i,e,t,!1),!r&&!an(e)&&s.connect(c,n)}else{let t=$t(i,e,n);Yt(a,t,!1),!r&&!an(e)&&s.disconnect(c,n)}};return qt(o,[t,n],e=>e[0]===t&&e[1]===n,!0)?(s.add(c),L(e)?Jt(i,e,[n,c],!0):Yt(a,[e,n,c],!0),!0):!1},fn=(e,t,n,r)=>{let{activeInputs:i,passiveInputs:a}=R(t),o=Qt(i[r],e,n);return o===null?[dt(a,e,n,r)[2],!1]:[o[2],!0]},pn=(e,t,n)=>{let{activeInputs:r,passiveInputs:i}=Lt(t),a=Qt(r,e,n);return a===null?[tn(i,e,n)[1],!1]:[a[2],!0]},mn=(e,t,n,r,i)=>{let[a,o]=fn(e,n,r,i);if(a!==null&&(en(e,a),o&&!t&&!an(e)&&nn(z(e),z(n),r,i)),L(n)){let{activeInputs:e}=R(n);gt(n,e)}},hn=(e,t,n,r)=>{let[i,a]=pn(e,n,r);i!==null&&(en(e,i),a&&!t&&!an(e)&&z(e).disconnect(rn(n),r))},gn=(e,t)=>{let n=R(e),r=[];for(let i of n.outputs)Kt(i)?mn(e,t,...i):hn(e,t,...i),r.push(i[0]);return n.outputs.clear(),r},_n=(e,t,n)=>{let r=R(e),i=[];for(let a of r.outputs)a[1]===n&&(Kt(a)?mn(e,t,...a):hn(e,t,...a),i.push(a[0]),r.outputs.delete(a));return i},vn=(e,t,n,r,i)=>{let a=R(e);return Array.from(a.outputs).filter(e=>e[0]===n&&(r===void 0||e[1]===r)&&(i===void 0||e[2]===i)).map(n=>(Kt(n)?mn(e,t,...n):hn(e,t,...n),a.outputs.delete(n),n[0]))},yn=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)=>class extends l{constructor(t,r,i,a){super(i),this._context=t,this._nativeAudioNode=i;let o=u(t);d(o)&&!0!==n(sn,()=>sn(o,h))&&un(i),Ye.set(this,i),$e.set(this,new Set),t.state!==`closed`&&r&&pt(this),e(this,a,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(e){this._nativeAudioNode.channelCount=e}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(e){this._nativeAudioNode.channelCountMode=e}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(e){this._nativeAudioNode.channelInterpretation=e}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(e,n=0,s=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();let l=m(u(this._context));if(f(e)||p(e))throw a();if(Gt(e)){let i=z(e);try{let t=Zt(this._nativeAudioNode,i,n,s),r=on(this);(l||r)&&this._nativeAudioNode.disconnect(...t),this.context.state!==`closed`&&!r&&on(e)&&pt(e)}catch(e){throw e.code===12?a():e}return t(this,e,n,s,l)&&cn(c([this],e),r(l)),e}let d=rn(e);if(d.name===`playbackRate`&&d.maxValue===1024)throw o();try{this._nativeAudioNode.connect(d,n),(l||on(this))&&this._nativeAudioNode.disconnect(d,n)}catch(e){throw e.code===12?a():e}dn(this,e,n,l)&&cn(c([this],e),r(l))}disconnect(e,t,n){let r,o=m(u(this._context));if(e===void 0)r=gn(this,o);else if(typeof e==`number`){if(e<0||e>=this.numberOfOutputs)throw i();r=_n(this,o,e)}else{if(t!==void 0&&(t<0||t>=this.numberOfOutputs)||Gt(e)&&n!==void 0&&(n<0||n>=e.numberOfInputs))throw i();if(r=vn(this,o,e,t,n),r.length===0)throw a()}for(let e of r)cn(c([this],e),s)}},bn=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>(p,m,h,g=null,_=null)=>{let v=h.value,y=new He.AutomationEventList(v),b=m?r(y):null,x={get defaultValue(){return v},get maxValue(){return g===null?h.maxValue:g},get minValue(){return _===null?h.minValue:_},get value(){return h.value},set value(e){h.value=e,x.setValueAtTime(e,p.context.currentTime)},cancelAndHoldAtTime(e){if(typeof h.cancelAndHoldAtTime==`function`)b===null&&y.flush(p.context.currentTime),y.add(i(e)),h.cancelAndHoldAtTime(e);else{let t=Array.from(y).pop();b===null&&y.flush(p.context.currentTime),y.add(i(e));let n=Array.from(y).pop();h.cancelScheduledValues(e),t!==n&&n!==void 0&&(n.type===`exponentialRampToValue`?h.exponentialRampToValueAtTime(n.value,n.endTime):n.type===`linearRampToValue`?h.linearRampToValueAtTime(n.value,n.endTime):n.type===`setValue`?h.setValueAtTime(n.value,n.startTime):n.type===`setValueCurve`&&h.setValueCurveAtTime(n.values,n.startTime,n.duration))}return x},cancelScheduledValues(e){return b===null&&y.flush(p.context.currentTime),y.add(a(e)),h.cancelScheduledValues(e),x},exponentialRampToValueAtTime(e,t){if(e===0||!Number.isFinite(t)||t<0)throw RangeError();let n=p.context.currentTime;return b===null&&y.flush(n),Array.from(y).length===0&&(y.add(l(v,n)),h.setValueAtTime(v,n)),y.add(o(e,t)),h.exponentialRampToValueAtTime(e,t),x},linearRampToValueAtTime(e,t){let n=p.context.currentTime;return b===null&&y.flush(n),Array.from(y).length===0&&(y.add(l(v,n)),h.setValueAtTime(v,n)),y.add(s(e,t)),h.linearRampToValueAtTime(e,t),x},setTargetAtTime(e,t,n){return b===null&&y.flush(p.context.currentTime),y.add(c(e,t,n)),h.setTargetAtTime(e,t,n),x},setValueAtTime(e,t){return b===null&&y.flush(p.context.currentTime),y.add(l(e,t)),h.setValueAtTime(e,t),x},setValueCurveAtTime(e,t,n){let r=e instanceof Float32Array?e:new Float32Array(e);if(d!==null&&d.name===`webkitAudioContext`){let e=t+n,i=p.context.sampleRate,a=Math.ceil(t*i),o=Math.floor(e*i),s=o-a,c=new Float32Array(s);for(let e=0;e<s;e+=1){let o=(r.length-1)/n*((a+e)/i-t),s=Math.floor(o),l=Math.ceil(o);c[e]=s===l?r[s]:(1-(o-s))*r[s]+(1-(l-o))*r[l]}b===null&&y.flush(p.context.currentTime),y.add(u(c,t,n)),h.setValueCurveAtTime(c,t,n);let l=o/i;l<e&&f(x,c[c.length-1],l),f(x,r[r.length-1],e)}else b===null&&y.flush(p.context.currentTime),y.add(u(r,t,n)),h.setValueCurveAtTime(r,t,n);return x}};return n.set(x,h),t.set(x,p),e(x,b),x},xn=e=>({replay(t){for(let n of e)if(n.type===`exponentialRampToValue`){let{endTime:e,value:r}=n;t.exponentialRampToValueAtTime(r,e)}else if(n.type===`linearRampToValue`){let{endTime:e,value:r}=n;t.linearRampToValueAtTime(r,e)}else if(n.type===`setTarget`){let{startTime:e,target:r,timeConstant:i}=n;t.setTargetAtTime(r,e,i)}else if(n.type===`setValue`){let{startTime:e,value:r}=n;t.setValueAtTime(r,e)}else if(n.type===`setValueCurve`){let{duration:e,startTime:r,values:i}=n;t.setValueCurveAtTime(i,r,e)}else throw Error(`Can't apply an unknown automation.`)}}),Sn=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y)=>class extends m{constructor(t,n){super(t,n),this._nativeContext=t,this._audioWorklet=e===void 0?void 0:{addModule:(t,n)=>e(this,t,n)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new t(this)}createBiquadFilter(){return new i(this)}createBuffer(e,t,r){return new n({length:t,numberOfChannels:e,sampleRate:r})}createBufferSource(){return new r(this)}createChannelMerger(e=6){return new a(this,{numberOfInputs:e})}createChannelSplitter(e=6){return new o(this,{numberOfOutputs:e})}createConstantSource(){return new s(this)}createConvolver(){return new c(this)}createDelay(e=1){return new u(this,{maxDelayTime:e})}createDynamicsCompressor(){return new d(this)}createGain(){return new f(this)}createIIRFilter(e,t){return new p(this,{feedback:t,feedforward:e})}createOscillator(){return new h(this)}createPanner(){return new g(this)}createPeriodicWave(e,t,n={disableNormalization:!1}){return new _(this,{...n,imag:t,real:e})}createStereoPanner(){return new v(this)}createWaveShaper(){return new y(this)}decodeAudioData(e,t,n){return l(this._nativeContext,e).then(e=>(typeof t==`function`&&t(e),e),e=>{throw typeof n==`function`&&n(e),e})}},Cn={Q:1,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,detune:0,frequency:350,gain:0,type:`lowpass`},wn=(e,t,n,r,i,a,o,s)=>class extends e{constructor(e,r){let c=a(e),l=i(c,{...Cn,...r}),u=o(c),d=u?n():null;super(e,!1,l,d),this._Q=t(this,u,l.Q,I,F),this._detune=t(this,u,l.detune,1200*Math.log2(I),-1200*Math.log2(I)),this._frequency=t(this,u,l.frequency,e.sampleRate/2,0),this._gain=t(this,u,l.gain,40*Math.log10(I),F),this._nativeBiquadFilterNode=l,s(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(e){this._nativeBiquadFilterNode.type=e}getFrequencyResponse(e,t,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(e,t,n)}catch(e){throw e.code===11?r():e}if(e.length!==t.length||t.length!==n.length)throw r()}},Tn=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=async(o,s)=>{let c=n(o),l=P(c,s);return l||(c=t(s,{Q:c.Q.value,channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,detune:c.detune.value,frequency:c.frequency.value,gain:c.gain.value,type:c.type})),a.set(s,c),l?(await e(s,o.Q,c.Q),await e(s,o.detune,c.detune),await e(s,o.frequency,c.frequency),await e(s,o.gain,c.gain)):(await r(s,o.Q,c.Q),await r(s,o.detune,c.detune),await r(s,o.frequency,c.frequency),await r(s,o.gain,c.gain)),await i(o,s,c),c};return{render(e,t){let n=a.get(t);return n===void 0?o(e,t):Promise.resolve(n)}}},En=(e,t)=>(n,r)=>{let i=t.get(n);if(i!==void 0)return i;let a=e.get(n);if(a!==void 0)return a;try{let i=r();return i instanceof Promise?(e.set(n,i),i.catch(()=>!1).then(r=>(e.delete(n),t.set(n,r),r))):(t.set(n,i),i)}catch{return t.set(n,!1),!1}},Dn={channelCount:1,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:6},On=(e,t,n,r,i)=>class extends e{constructor(e,a){let o=r(e),s=n(o,{...Dn,...a}),c=i(o)?t():null;super(e,!1,s,c)}},kn=(e,t,n)=>()=>{let r=new WeakMap,i=async(i,a)=>{let o=t(i);return P(o,a)||(o=e(a,{channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfInputs:o.numberOfInputs})),r.set(a,o),await n(i,a,o),o};return{render(e,t){let n=r.get(t);return n===void 0?i(e,t):Promise.resolve(n)}}},An={channelCount:6,channelCountMode:`explicit`,channelInterpretation:`discrete`,numberOfOutputs:6},jn=(e,t,n,r,i,a)=>class extends e{constructor(e,o){let s=r(e),c=n(s,a({...An,...o})),l=i(s)?t():null;super(e,!1,c,l)}},Mn=(e,t,n)=>()=>{let r=new WeakMap,i=async(i,a)=>{let o=t(i);return P(o,a)||(o=e(a,{channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfOutputs:o.numberOfOutputs})),r.set(a,o),await n(i,a,o),o};return{render(e,t){let n=r.get(t);return n===void 0?i(e,t):Promise.resolve(n)}}},Nn=e=>(t,n,r)=>e(n,t,r),Pn=e=>(t,n)=>{let r=e(t,{buffer:null,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,loop:!1,loopEnd:0,loopStart:0,playbackRate:1});return r.buffer=t.createBuffer(1,2,44100),r.loop=!0,r.connect(n),r.start(),()=>{r.stop(),r.disconnect(n)}},Fn={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,offset:1},In=(e,t,n,r,i,a,o)=>class extends e{constructor(e,o){let s=i(e),c=r(s,{...Fn,...o}),l=a(s),u=l?n():null;super(e,!1,c,u),this._constantSourceNodeRenderer=u,this._nativeConstantSourceNode=c,this._offset=t(this,l,c.offset,I,F),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(e){let t=typeof e==`function`?o(this,e):null;this._nativeConstantSourceNode.onended=t;let n=this._nativeConstantSourceNode.onended;this._onended=n!==null&&n===t?e:n}start(e=0){if(this._nativeConstantSourceNode.start(e),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.start=e),this.context.state!==`closed`){pt(this);let e=()=>{this._nativeConstantSourceNode.removeEventListener(`ended`,e),L(this)&&ht(this)};this._nativeConstantSourceNode.addEventListener(`ended`,e)}}stop(e=0){this._nativeConstantSourceNode.stop(e),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.stop=e)}},Ln=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=null,s=null,c=async(c,l)=>{let u=n(c),d=P(u,l);return d||(u=t(l,{channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,offset:u.offset.value}),o!==null&&u.start(o),s!==null&&u.stop(s)),a.set(l,u),d?await e(l,c.offset,u.offset):await r(l,c.offset,u.offset),await i(c,l,u),u};return{set start(e){o=e},set stop(e){s=e},render(e,t){let n=a.get(t);return n===void 0?c(e,t):Promise.resolve(n)}}},Rn=e=>t=>(e[0]=t,e[0]),zn={buffer:null,channelCount:2,channelCountMode:`clamped-max`,channelInterpretation:`speakers`,disableNormalization:!1},Bn=(e,t,n,r,i,a)=>class extends e{constructor(e,o){let s=r(e),c={...zn,...o},l=n(s,c),u=i(s)?t():null;super(e,!1,l,u),this._isBufferNullified=!1,this._nativeConvolverNode=l,c.buffer!==null&&a(this,c.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(e){if(this._nativeConvolverNode.buffer=e,e===null&&this._nativeConvolverNode.buffer!==null){let e=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=e.createBuffer(1,1,e.sampleRate),this._isBufferNullified=!0,a(this,0)}else this._isBufferNullified=!1,a(this,this._nativeConvolverNode.buffer===null?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(e){this._nativeConvolverNode.normalize=e}},Vn=(e,t,n)=>()=>{let r=new WeakMap,i=async(i,a)=>{let o=t(i);return P(o,a)||(o=e(a,{buffer:o.buffer,channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,disableNormalization:!o.normalize})),r.set(a,o),Xt(o)?await n(i,a,o.inputs[0]):await n(i,a,o),o};return{render(e,t){let n=r.get(t);return n===void 0?i(e,t):Promise.resolve(n)}}},Hn=()=>new DOMException(``,`DataCloneError`),Un=e=>{let{port1:t,port2:n}=new MessageChannel;return new Promise(r=>{let i=()=>{n.onmessage=null,t.close(),n.close(),r()};n.onmessage=()=>i();try{t.postMessage(e,[e])}catch{}finally{i()}})},Wn=(e,t,n,r,i,a,o,s,c,l,u)=>(d,f)=>{let p=o(d)?d:a(d);if(i.has(f)){let e=n();return Promise.reject(e)}try{i.add(f)}catch{}return t(c,()=>c(p))?p.decodeAudioData(f).then(n=>(Un(f).catch(()=>{}),t(s,()=>s(n))||u(n),e.add(n),n)):new Promise((t,n)=>{let i=async()=>{try{await Un(f)}catch{}},a=e=>{n(e),i()};try{p.decodeAudioData(f,n=>{typeof n.copyFromChannel!=`function`&&(l(n),Tt(n)),e.add(n),i().then(()=>t(n))},e=>{a(e===null?r():e)})}catch(e){a(e)}})},Gn=(e,t,n,r,i,a,o,s)=>(c,l)=>{let u=t.get(c);if(u===void 0)throw Error(`Missing the expected cycle count.`);let d=s(a(c.context));if(u===l){if(t.delete(c),!d&&o(c)){let t=r(c),{outputs:a}=n(c);for(let n of a)if(Kt(n))e(t,r(n[0]),n[1],n[2]);else{let e=i(n[0]);t.connect(e,n[1])}}}else t.set(c,u-l)},Kn={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,delayTime:0,maxDelayTime:1},qn=(e,t,n,r,i,a,o)=>class extends e{constructor(e,s){let c=i(e),l={...Kn,...s},u=r(c,l),d=a(c),f=d?n(l.maxDelayTime):null;super(e,!1,u,f),this._delayTime=t(this,d,u.delayTime),o(this,l.maxDelayTime)}get delayTime(){return this._delayTime}},Jn=(e,t,n,r,i)=>a=>{let o=new WeakMap,s=async(s,c)=>{let l=n(s),u=P(l,c);return u||(l=t(c,{channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,delayTime:l.delayTime.value,maxDelayTime:a})),o.set(c,l),u?await e(c,s.delayTime,l.delayTime):await r(c,s.delayTime,l.delayTime),await i(s,c,l),l};return{render(e,t){let n=o.get(t);return n===void 0?s(e,t):Promise.resolve(n)}}},Yn=e=>(t,n,r,i)=>e(t[i],e=>e[0]===n&&e[1]===r),Xn=e=>`delayTime`in e,Zn=(e,t,n)=>function r(i,a){let o=Gt(a)?a:n(e,a);if(Xn(o))return[];if(i[0]===o)return[i];if(i.includes(o))return[];let{outputs:s}=t(o);return Array.from(s).map(e=>r([...i,o],e[0])).reduce((e,t)=>e.concat(t),[])},Qn={attack:.003,channelCount:2,channelCountMode:`clamped-max`,channelInterpretation:`speakers`,knee:30,ratio:12,release:.25,threshold:-24},$n=(e,t,n,r,i,a,o,s)=>class extends e{constructor(e,i){let c=a(e),l=r(c,{...Qn,...i}),u=o(c),d=u?n():null;super(e,!1,l,d),this._attack=t(this,u,l.attack),this._knee=t(this,u,l.knee),this._nativeDynamicsCompressorNode=l,this._ratio=t(this,u,l.ratio),this._release=t(this,u,l.release),this._threshold=t(this,u,l.threshold),s(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(e){let t=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=e,e>2)throw this._nativeDynamicsCompressorNode.channelCount=t,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(e){let t=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=e,e===`max`)throw this._nativeDynamicsCompressorNode.channelCountMode=t,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return typeof this._nativeDynamicsCompressorNode.reduction.value==`number`?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}},er=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=async(o,s)=>{let c=n(o),l=P(c,s);return l||(c=t(s,{attack:c.attack.value,channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,knee:c.knee.value,ratio:c.ratio.value,release:c.release.value,threshold:c.threshold.value})),a.set(s,c),l?(await e(s,o.attack,c.attack),await e(s,o.knee,c.knee),await e(s,o.ratio,c.ratio),await e(s,o.release,c.release),await e(s,o.threshold,c.threshold)):(await r(s,o.attack,c.attack),await r(s,o.knee,c.knee),await r(s,o.ratio,c.ratio),await r(s,o.release,c.release),await r(s,o.threshold,c.threshold)),await i(o,s,c),c};return{render(e,t){let n=a.get(t);return n===void 0?o(e,t):Promise.resolve(n)}}},tr=()=>new DOMException(``,`EncodingError`),nr=e=>t=>new Promise((n,r)=>{if(e===null){r(SyntaxError());return}let i=e.document.head;if(i===null)r(SyntaxError());else{let a=e.document.createElement(`script`),o=new Blob([t],{type:`application/javascript`}),s=URL.createObjectURL(o),c=e.onerror,l=()=>{e.onerror=c,URL.revokeObjectURL(s)};e.onerror=(t,n,i,a,o)=>{if(n===s||n===e.location.href&&i===1&&a===1)return l(),r(o),!1;if(c!==null)return c(t,n,i,a,o)},a.onerror=()=>{l(),r(SyntaxError())},a.onload=()=>{l(),n()},a.src=s,a.type=`module`,i.appendChild(a)}}),rr=e=>class{constructor(e){this._nativeEventTarget=e,this._listeners=new WeakMap}addEventListener(t,n,r){if(n!==null){let i=this._listeners.get(n);i===void 0&&(i=e(this,n),typeof n==`function`&&this._listeners.set(n,i)),this._nativeEventTarget.addEventListener(t,i,r)}}dispatchEvent(e){return this._nativeEventTarget.dispatchEvent(e)}removeEventListener(e,t,n){let r=t===null?void 0:this._listeners.get(t);this._nativeEventTarget.removeEventListener(e,r===void 0?null:r,n)}},ir=e=>(t,n,r)=>{Object.defineProperties(e,{currentFrame:{configurable:!0,get(){return Math.round(t*n)}},currentTime:{configurable:!0,get(){return t}}});try{return r()}finally{e!==null&&(delete e.currentFrame,delete e.currentTime)}},ar=e=>async t=>{try{let e=await fetch(t);if(e.ok)return[await e.text(),e.url]}catch{}throw e()},or={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,gain:1},sr=(e,t,n,r,i,a)=>class extends e{constructor(e,o){let s=i(e),c=r(s,{...or,...o}),l=a(s),u=l?n():null;super(e,!1,c,u),this._gain=t(this,l,c.gain,I,F)}get gain(){return this._gain}},cr=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=async(o,s)=>{let c=n(o),l=P(c,s);return l||(c=t(s,{channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,gain:c.gain.value})),a.set(s,c),l?await e(s,o.gain,c.gain):await r(s,o.gain,c.gain),await i(o,s,c),c};return{render(e,t){let n=a.get(t);return n===void 0?o(e,t):Promise.resolve(n)}}},lr=e=>t=>{let n=e(t);if(n.renderer===null)throw Error(`Missing the renderer of the given AudioNode in the audio graph.`);return n.renderer},ur=e=>t=>e.get(t)??0,dr=e=>t=>{let n=e(t);if(n.renderer===null)throw Error(`Missing the renderer of the given AudioParam in the audio graph.`);return n.renderer},B=()=>new DOMException(``,`InvalidStateError`),fr=e=>t=>{let n=e.get(t);if(n===void 0)throw B();return n},pr=(e,t)=>n=>{let r=e.get(n);if(r!==void 0)return r;if(t===null)throw Error(`Missing the native OfflineAudioContext constructor.`);return r=new t(1,1,44100),e.set(n,r),r},mr=()=>new DOMException(``,`InvalidAccessError`),hr=e=>{e.getFrequencyResponse=(t=>(n,r,i)=>{if(n.length!==r.length||r.length!==i.length)throw mr();return t.call(e,n,r,i)})(e.getFrequencyResponse)},gr={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`},_r=(e,t,n,r,i,a)=>class extends e{constructor(e,o){let s=r(e),c=i(s),l={...gr,...o},u=t(s,c?null:e.baseLatency,l),d=c?n(l.feedback,l.feedforward):null;super(e,!1,u,d),hr(u),this._nativeIIRFilterNode=u,a(this,1)}getFrequencyResponse(e,t,n){return this._nativeIIRFilterNode.getFrequencyResponse(e,t,n)}},vr=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=l.length,f=s;for(let s=0;s<d;s+=1){let d=n[0]*l[s];for(let t=1;t<i;t+=1){let r=f-t&c-1;d+=n[t]*a[r],d-=e[t]*o[r]}for(let e=i;e<r;e+=1)d+=n[e]*a[f-e&c-1];for(let n=i;n<t;n+=1)d-=e[n]*o[f-n&c-1];a[f]=l[s],o[f]=d,f=f+1&c-1,u[s]=d}return f},yr=(e,t,n,r)=>{let i=n instanceof Float64Array?n:new Float64Array(n),a=r instanceof Float64Array?r:new Float64Array(r),o=i.length,s=a.length,c=Math.min(o,s);if(i[0]!==1){for(let e=0;e<o;e+=1)a[e]/=i[0];for(let e=1;e<s;e+=1)i[e]/=i[0]}let l=new Float32Array(32),u=new Float32Array(32),d=t.createBuffer(e.numberOfChannels,e.length,e.sampleRate),f=e.numberOfChannels;for(let t=0;t<f;t+=1){let n=e.getChannelData(t),r=d.getChannelData(t);l.fill(0),u.fill(0),vr(i,o,a,s,c,l,u,0,32,n,r)}return d},br=(e,t,n,r,i)=>(a,o)=>{let s=new WeakMap,c=null,l=async(l,u)=>{let d=null,f=t(l),p=P(f,u);if(u.createIIRFilter===void 0?d=e(u,{buffer:null,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):p||(f=u.createIIRFilter(o,a)),s.set(u,d===null?f:d),d!==null){if(c===null){if(n===null)throw Error(`Missing the native OfflineAudioContext constructor.`);let e=new n(l.context.destination.channelCount,l.context.length,u.sampleRate);c=(async()=>(await r(l,e,e.destination),yr(await i(e),u,a,o)))()}let e=await c;return d.buffer=e,d.start(0),d}return await r(l,u,f),f};return{render(e,t){let n=s.get(t);return n===void 0?l(e,t):Promise.resolve(n)}}},xr=(e,t,n,r,i,a)=>o=>(s,c)=>{let l=e.get(s);if(l===void 0){if(!o&&a(s)){let e=r(s),{outputs:a}=n(s);for(let n of a)if(Kt(n))t(e,r(n[0]),n[1],n[2]);else{let t=i(n[0]);e.disconnect(t,n[1])}}e.set(s,c)}else e.set(s,l+c)},Sr=e=>t=>e!==null&&t instanceof e,Cr=e=>t=>e!==null&&typeof e.AudioNode==`function`&&t instanceof e.AudioNode,wr=e=>t=>e!==null&&typeof e.AudioParam==`function`&&t instanceof e.AudioParam,Tr=(e,t)=>n=>e(n)||t(n),Er=e=>t=>e!==null&&t instanceof e,Dr=e=>e!==null&&e.isSecureContext,Or=(e,t,n,r)=>class extends e{constructor(e,i){let a=n(e),o=t(a,i);if(r(a))throw TypeError();super(e,!0,o,null),this._nativeMediaElementAudioSourceNode=o}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}},kr={channelCount:2,channelCountMode:`explicit`,channelInterpretation:`speakers`},Ar=(e,t,n,r)=>class extends e{constructor(e,i){let a=n(e);if(r(a))throw TypeError();let o=t(a,{...kr,...i});super(e,!1,o,null),this._nativeMediaStreamAudioDestinationNode=o}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}},jr=(e,t,n,r)=>class extends e{constructor(e,i){let a=n(e),o=t(a,i);if(r(a))throw TypeError();super(e,!0,o,null),this._nativeMediaStreamAudioSourceNode=o}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}},Mr=(e,t,n)=>class extends e{constructor(e,r){let i=t(n(e),r);super(e,!0,i,null)}},Nr=(e,t,n,r,i,a)=>class extends n{constructor(n,a){super(n),this._nativeContext=n,Qe.set(this,n),r(n)&&i.set(n,new Set),this._destination=new e(this,a),this._listener=t(this,n),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(e){let t=typeof e==`function`?a(this,e):null;this._nativeContext.onstatechange=t;let n=this._nativeContext.onstatechange;this._onstatechange=n!==null&&n===t?e:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}},Pr=e=>{let t=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{let n=e.decodeAudioData(t.buffer,()=>{});return n===void 0?!1:(n.catch(()=>{}),!0)}catch{}return!1},Fr=(e,t)=>(n,r,i)=>{let a=new Set;return n.connect=(i=>(o,s=0,c=0)=>{let l=a.size===0;if(t(o))return i.call(n,o,s,c),e(a,[o,s,c],e=>e[0]===o&&e[1]===s&&e[2]===c,!0),l&&r(),o;i.call(n,o,s),e(a,[o,s],e=>e[0]===o&&e[1]===s,!0),l&&r()})(n.connect),n.disconnect=(e=>(r,o,s)=>{let c=a.size>0;if(r===void 0)e.apply(n),a.clear();else if(typeof r==`number`){e.call(n,r);for(let e of a)e[1]===r&&a.delete(e)}else{t(r)?e.call(n,r,o,s):e.call(n,r,o);for(let e of a)e[0]===r&&(o===void 0||e[1]===o)&&(s===void 0||e[2]===s)&&a.delete(e)}let l=a.size===0;c&&l&&i()})(n.disconnect),n},V=(e,t,n)=>{let r=t[n];r!==void 0&&r!==e[n]&&(e[n]=r)},H=(e,t)=>{V(e,t,`channelCount`),V(e,t,`channelCountMode`),V(e,t,`channelInterpretation`)},Ir=e=>typeof e.getFloatTimeDomainData==`function`,Lr=e=>{e.getFloatTimeDomainData=t=>{let n=new Uint8Array(t.length);e.getByteTimeDomainData(n);let r=Math.max(n.length,e.fftSize);for(let e=0;e<r;e+=1)t[e]=(n[e]-128)*.0078125;return t}},Rr=(e,t)=>(n,r)=>{let i=n.createAnalyser();if(H(i,r),!(r.maxDecibels>r.minDecibels))throw t();return V(i,r,`fftSize`),V(i,r,`maxDecibels`),V(i,r,`minDecibels`),V(i,r,`smoothingTimeConstant`),e(Ir,()=>Ir(i))||Lr(i),i},zr=e=>e===null?null:e.hasOwnProperty(`AudioBuffer`)?e.AudioBuffer:null,U=(e,t,n)=>{let r=t[n];r!==void 0&&r!==e[n].value&&(e[n].value=r)},Br=e=>{e.start=(t=>{let n=!1;return(r=0,i=0,a)=>{if(n)throw B();t.call(e,r,i,a),n=!0}})(e.start)},Vr=e=>{e.start=(t=>(n=0,r=0,i)=>{if(typeof i==`number`&&i<0||r<0||n<0)throw RangeError(`The parameters can't be negative.`);t.call(e,n,r,i)})(e.start)},Hr=e=>{e.stop=(t=>(n=0)=>{if(n<0)throw RangeError(`The parameter can't be negative.`);t.call(e,n)})(e.stop)},Ur=(e,t,n,r,i,a,o,s,c,l,u)=>(d,f)=>{let p=d.createBufferSource();return H(p,f),U(p,f,`playbackRate`),V(p,f,`buffer`),V(p,f,`loop`),V(p,f,`loopEnd`),V(p,f,`loopStart`),t(n,()=>n(d))||Br(p),t(r,()=>r(d))||c(p),t(i,()=>i(d))||l(p,d),t(a,()=>a(d))||Vr(p),t(o,()=>o(d))||u(p,d),t(s,()=>s(d))||Hr(p),e(d,p),p},Wr=e=>e===null?null:e.hasOwnProperty(`AudioContext`)?e.AudioContext:e.hasOwnProperty(`webkitAudioContext`)?e.webkitAudioContext:null,Gr=(e,t)=>(n,r,i)=>{let a=n.destination;if(a.channelCount!==r)try{a.channelCount=r}catch{}i&&a.channelCountMode!==`explicit`&&(a.channelCountMode=`explicit`),a.maxChannelCount===0&&Object.defineProperty(a,"maxChannelCount",{value:r});let o=e(n,{channelCount:r,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,gain:1});return t(o,`channelCount`,e=>()=>e.call(o),e=>t=>{e.call(o,t);try{a.channelCount=t}catch(e){if(t>a.maxChannelCount)throw e}}),t(o,`channelCountMode`,e=>()=>e.call(o),e=>t=>{e.call(o,t),a.channelCountMode=t}),t(o,`channelInterpretation`,e=>()=>e.call(o),e=>t=>{e.call(o,t),a.channelInterpretation=t}),Object.defineProperty(o,"maxChannelCount",{get:()=>a.maxChannelCount}),o.connect(a),o},Kr=e=>e===null?null:e.hasOwnProperty(`AudioWorkletNode`)?e.AudioWorkletNode:null,qr=(e,t)=>e===null?512:Math.max(512,Math.min(16384,2**Math.round(Math.log2(e*t)))),Jr=(e,t)=>{let n=e.createBiquadFilter();return H(n,t),U(n,t,`Q`),U(n,t,`detune`),U(n,t,`frequency`),U(n,t,`gain`),V(n,t,`type`),n},Yr=(e,t)=>(n,r)=>{let i=n.createChannelMerger(r.numberOfInputs);return e!==null&&e.name===`webkitAudioContext`&&t(n,i),H(i,r),i},Xr=e=>{let t=e.numberOfOutputs;Object.defineProperty(e,"channelCount",{get:()=>t,set:e=>{if(e!==t)throw B()}}),Object.defineProperty(e,"channelCountMode",{get:()=>`explicit`,set:e=>{if(e!==`explicit`)throw B()}}),Object.defineProperty(e,"channelInterpretation",{get:()=>`discrete`,set:e=>{if(e!==`discrete`)throw B()}})},Zr=(e,t)=>{let n=e.createChannelSplitter(t.numberOfOutputs);return H(n,t),Xr(n),n},Qr=(e,t,n,r,i)=>(a,o)=>{if(a.createConstantSource===void 0)return n(a,o);let s=a.createConstantSource();return H(s,o),U(s,o,`offset`),t(r,()=>r(a))||Vr(s),t(i,()=>i(a))||Hr(s),e(a,s),s},$r=(e,t)=>(e.connect=t.connect.bind(t),e.disconnect=t.disconnect.bind(t),e),ei=(e,t,n,r)=>(i,{offset:a,...o})=>{let s=i.createBuffer(1,2,44100),c=t(i,{buffer:null,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),l=n(i,{...o,gain:a}),u=s.getChannelData(0);return u[0]=1,u[1]=1,c.buffer=s,c.loop=!0,e(i,c),r($r({get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(e){l.channelCount=e},get channelCountMode(){return l.channelCountMode},set channelCountMode(e){l.channelCountMode=e},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(e){l.channelInterpretation=e},get context(){return l.context},get inputs(){return[]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get offset(){return l.gain},get onended(){return c.onended},set onended(e){c.onended=e},addEventListener(...e){return c.addEventListener(e[0],e[1],e[2])},dispatchEvent(...e){return c.dispatchEvent(e[0])},removeEventListener(...e){return c.removeEventListener(e[0],e[1],e[2])},start(e=0){c.start.call(c,e)},stop(e=0){c.stop.call(c,e)}},l),()=>c.connect(l),()=>c.disconnect(l))},ti=(e,t)=>(n,r)=>{let i=n.createConvolver();if(H(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),V(i,r,`buffer`),r.channelCount>2||(t(i,`channelCount`,e=>()=>e.call(i),t=>n=>{if(n>2)throw e();return t.call(i,n)}),r.channelCountMode===`max`))throw e();return t(i,`channelCountMode`,e=>()=>e.call(i),t=>n=>{if(n===`max`)throw e();return t.call(i,n)}),i},ni=(e,t)=>{let n=e.createDelay(t.maxDelayTime);return H(n,t),U(n,t,`delayTime`),n},ri=e=>(t,n)=>{let r=t.createDynamicsCompressor();if(H(r,n),n.channelCount>2||n.channelCountMode===`max`)throw e();return U(r,n,`attack`),U(r,n,`knee`),U(r,n,`ratio`),U(r,n,`release`),U(r,n,`threshold`),r},W=(e,t)=>{let n=e.createGain();return H(n,t),U(n,t,`gain`),n},ii=e=>(t,n,r)=>{if(t.createIIRFilter===void 0)return e(t,n,r);let i=t.createIIRFilter(r.feedforward,r.feedback);return H(i,r),i};function ai(e,t){let n=t[0]*t[0]+t[1]*t[1];return[(e[0]*t[0]+e[1]*t[1])/n,(e[1]*t[0]-e[0]*t[1])/n]}function oi(e,t){return[e[0]*t[0]-e[1]*t[1],e[0]*t[1]+e[1]*t[0]]}function si(e,t){let n=[0,0];for(let r=e.length-1;r>=0;--r)n=oi(n,t),n[0]+=e[r];return n}var ci=(e,t,n,r)=>(i,a,{channelCount:o,channelCountMode:s,channelInterpretation:c,feedback:l,feedforward:u})=>{let d=qr(a,i.sampleRate),f=l instanceof Float64Array?l:new Float64Array(l),p=u instanceof Float64Array?u:new Float64Array(u),m=f.length,h=p.length,g=Math.min(m,h);if(m===0||m>20)throw r();if(f[0]===0)throw t();if(h===0||h>20)throw r();if(p[0]===0)throw t();if(f[0]!==1){for(let e=0;e<h;e+=1)p[e]/=f[0];for(let e=1;e<m;e+=1)f[e]/=f[0]}let _=n(i,d,o,o);_.channelCount=o,_.channelCountMode=s,_.channelInterpretation=c;let v=[],y=[],b=[];for(let e=0;e<o;e+=1){v.push(0);let e=new Float32Array(32),t=new Float32Array(32);e.fill(0),t.fill(0),y.push(e),b.push(t)}_.onaudioprocess=e=>{let t=e.inputBuffer,n=e.outputBuffer,r=t.numberOfChannels;for(let e=0;e<r;e+=1){let r=t.getChannelData(e),i=n.getChannelData(e);v[e]=vr(f,m,p,h,g,y[e],b[e],v[e],32,r,i)}};let x=i.sampleRate/2;return $r({get bufferSize(){return d},get channelCount(){return _.channelCount},set channelCount(e){_.channelCount=e},get channelCountMode(){return _.channelCountMode},set channelCountMode(e){_.channelCountMode=e},get channelInterpretation(){return _.channelInterpretation},set channelInterpretation(e){_.channelInterpretation=e},get context(){return _.context},get inputs(){return[_]},get numberOfInputs(){return _.numberOfInputs},get numberOfOutputs(){return _.numberOfOutputs},addEventListener(...e){return _.addEventListener(e[0],e[1],e[2])},dispatchEvent(...e){return _.dispatchEvent(e[0])},getFrequencyResponse(t,n,r){if(t.length!==n.length||n.length!==r.length)throw e();let i=t.length;for(let e=0;e<i;e+=1){let i=-Math.PI*(t[e]/x),a=[Math.cos(i),Math.sin(i)],o=ai(si(p,a),si(f,a));n[e]=Math.sqrt(o[0]*o[0]+o[1]*o[1]),r[e]=Math.atan2(o[1],o[0])}},removeEventListener(...e){return _.removeEventListener(e[0],e[1],e[2])}},_)},li=(e,t)=>e.createMediaElementSource(t.mediaElement),ui=(e,t)=>{let n=e.createMediaStreamDestination();return H(n,t),n.numberOfOutputs===1&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n},di=(e,{mediaStream:t})=>{let n=t.getAudioTracks();n.sort((e,t)=>e.id<t.id?-1:+(e.id>t.id));let r=n.slice(0,1),i=e.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(i,"mediaStream",{value:t}),i},fi=(e,t)=>(n,{mediaStreamTrack:r})=>{if(typeof n.createMediaStreamTrackSource==`function`)return n.createMediaStreamTrackSource(r);let i=new MediaStream([r]),a=n.createMediaStreamSource(i);if(r.kind!==`audio`)throw e();if(t(n))throw TypeError();return a},pi=e=>e===null?null:e.hasOwnProperty(`OfflineAudioContext`)?e.OfflineAudioContext:e.hasOwnProperty(`webkitOfflineAudioContext`)?e.webkitOfflineAudioContext:null,mi=(e,t,n,r,i,a)=>(o,s)=>{let c=o.createOscillator();return H(c,s),U(c,s,`detune`),U(c,s,`frequency`),s.periodicWave===void 0?V(c,s,`type`):c.setPeriodicWave(s.periodicWave),t(n,()=>n(o))||Vr(c),t(r,()=>r(o))||a(c,o),t(i,()=>i(o))||Hr(c),e(o,c),c},hi=e=>(t,n)=>{let r=t.createPanner();return r.orientationX===void 0?e(t,n):(H(r,n),U(r,n,`orientationX`),U(r,n,`orientationY`),U(r,n,`orientationZ`),U(r,n,`positionX`),U(r,n,`positionY`),U(r,n,`positionZ`),V(r,n,`coneInnerAngle`),V(r,n,`coneOuterAngle`),V(r,n,`coneOuterGain`),V(r,n,`distanceModel`),V(r,n,`maxDistance`),V(r,n,`panningModel`),V(r,n,`refDistance`),V(r,n,`rolloffFactor`),r)},gi=(e,t,n,r,i,a,o,s,c,l)=>(u,{coneInnerAngle:d,coneOuterAngle:f,coneOuterGain:p,distanceModel:m,maxDistance:h,orientationX:g,orientationY:_,orientationZ:v,panningModel:y,positionX:b,positionY:x,positionZ:S,refDistance:C,rolloffFactor:w,...T})=>{let E=u.createPanner();if(T.channelCount>2||T.channelCountMode===`max`)throw o();H(E,T);let D={channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`},O=n(u,{...D,channelInterpretation:`speakers`,numberOfInputs:6}),k=r(u,{...T,gain:1}),A=r(u,{...D,gain:1}),j=r(u,{...D,gain:0}),ee=r(u,{...D,gain:0}),te=r(u,{...D,gain:0}),ne=r(u,{...D,gain:0}),re=r(u,{...D,gain:0}),ie=i(u,256,6,1),M=a(u,{...D,curve:new Float32Array([1,1]),oversample:`none`}),ae=[g,_,v],oe=[b,x,S],se=new Float32Array(1);ie.onaudioprocess=({inputBuffer:e})=>{let t=[c(e,se,0),c(e,se,1),c(e,se,2)];t.some((e,t)=>e!==ae[t])&&(E.setOrientation(...t),ae=t);let n=[c(e,se,3),c(e,se,4),c(e,se,5)];n.some((e,t)=>e!==oe[t])&&(E.setPosition(...n),oe=n)},Object.defineProperty(j.gain,"defaultValue",{get:()=>0}),Object.defineProperty(ee.gain,"defaultValue",{get:()=>0}),Object.defineProperty(te.gain,"defaultValue",{get:()=>0}),Object.defineProperty(ne.gain,"defaultValue",{get:()=>0}),Object.defineProperty(re.gain,"defaultValue",{get:()=>0});let N={get bufferSize(){},get channelCount(){return E.channelCount},set channelCount(e){if(e>2)throw o();k.channelCount=e,E.channelCount=e},get channelCountMode(){return E.channelCountMode},set channelCountMode(e){if(e===`max`)throw o();k.channelCountMode=e,E.channelCountMode=e},get channelInterpretation(){return E.channelInterpretation},set channelInterpretation(e){k.channelInterpretation=e,E.channelInterpretation=e},get coneInnerAngle(){return E.coneInnerAngle},set coneInnerAngle(e){E.coneInnerAngle=e},get coneOuterAngle(){return E.coneOuterAngle},set coneOuterAngle(e){E.coneOuterAngle=e},get coneOuterGain(){return E.coneOuterGain},set coneOuterGain(e){if(e<0||e>1)throw t();E.coneOuterGain=e},get context(){return E.context},get distanceModel(){return E.distanceModel},set distanceModel(e){E.distanceModel=e},get inputs(){return[k]},get maxDistance(){return E.maxDistance},set maxDistance(e){if(e<0)throw RangeError();E.maxDistance=e},get numberOfInputs(){return E.numberOfInputs},get numberOfOutputs(){return E.numberOfOutputs},get orientationX(){return A.gain},get orientationY(){return j.gain},get orientationZ(){return ee.gain},get panningModel(){return E.panningModel},set panningModel(e){E.panningModel=e},get positionX(){return te.gain},get positionY(){return ne.gain},get positionZ(){return re.gain},get refDistance(){return E.refDistance},set refDistance(e){if(e<0)throw RangeError();E.refDistance=e},get rolloffFactor(){return E.rolloffFactor},set rolloffFactor(e){if(e<0)throw RangeError();E.rolloffFactor=e},addEventListener(...e){return k.addEventListener(e[0],e[1],e[2])},dispatchEvent(...e){return k.dispatchEvent(e[0])},removeEventListener(...e){return k.removeEventListener(e[0],e[1],e[2])}};return d!==N.coneInnerAngle&&(N.coneInnerAngle=d),f!==N.coneOuterAngle&&(N.coneOuterAngle=f),p!==N.coneOuterGain&&(N.coneOuterGain=p),m!==N.distanceModel&&(N.distanceModel=m),h!==N.maxDistance&&(N.maxDistance=h),g!==N.orientationX.value&&(N.orientationX.value=g),_!==N.orientationY.value&&(N.orientationY.value=_),v!==N.orientationZ.value&&(N.orientationZ.value=v),y!==N.panningModel&&(N.panningModel=y),b!==N.positionX.value&&(N.positionX.value=b),x!==N.positionY.value&&(N.positionY.value=x),S!==N.positionZ.value&&(N.positionZ.value=S),C!==N.refDistance&&(N.refDistance=C),w!==N.rolloffFactor&&(N.rolloffFactor=w),(ae[0]!==1||ae[1]!==0||ae[2]!==0)&&E.setOrientation(...ae),(oe[0]!==0||oe[1]!==0||oe[2]!==0)&&E.setPosition(...oe),l($r(N,E),()=>{k.connect(E),e(k,M,0,0),M.connect(A).connect(O,0,0),M.connect(j).connect(O,0,1),M.connect(ee).connect(O,0,2),M.connect(te).connect(O,0,3),M.connect(ne).connect(O,0,4),M.connect(re).connect(O,0,5),O.connect(ie).connect(u.destination)},()=>{k.disconnect(E),s(k,M,0,0),M.disconnect(A),A.disconnect(O),M.disconnect(j),j.disconnect(O),M.disconnect(ee),ee.disconnect(O),M.disconnect(te),te.disconnect(O),M.disconnect(ne),ne.disconnect(O),M.disconnect(re),re.disconnect(O),O.disconnect(ie),ie.disconnect(u.destination)})},_i=e=>(t,{disableNormalization:n,imag:r,real:i})=>{let a=r instanceof Float32Array?r:new Float32Array(r),o=i instanceof Float32Array?i:new Float32Array(i),s=t.createPeriodicWave(o,a,{disableNormalization:n});if(Array.from(r).length<2)throw e();return s},vi=(e,t,n,r)=>e.createScriptProcessor(t,n,r),yi=(e,t)=>(n,r)=>{let i=r.channelCountMode;if(i===`clamped-max`)throw t();if(n.createStereoPanner===void 0)return e(n,r);let a=n.createStereoPanner();return H(a,r),U(a,r,`pan`),Object.defineProperty(a,"channelCountMode",{get:()=>i,set:e=>{if(e!==i)throw t()}}),a},bi=(e,t,n,r,i,a)=>{let o=16385,s=new Float32Array([1,1]),c=Math.PI/2,l={channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`},u={...l,oversample:`none`},d=(e,t,i,a)=>{let d=new Float32Array(o),f=new Float32Array(o);for(let e=0;e<o;e+=1){let t=e/(o-1)*c;d[e]=Math.cos(t),f[e]=Math.sin(t)}let p=n(e,{...l,gain:0}),m=r(e,{...u,curve:d}),h=r(e,{...u,curve:s}),g=n(e,{...l,gain:0}),_=r(e,{...u,curve:f});return{connectGraph(){t.connect(p),t.connect(h.inputs===void 0?h:h.inputs[0]),t.connect(g),h.connect(i),i.connect(m.inputs===void 0?m:m.inputs[0]),i.connect(_.inputs===void 0?_:_.inputs[0]),m.connect(p.gain),_.connect(g.gain),p.connect(a,0,0),g.connect(a,0,1)},disconnectGraph(){t.disconnect(p),t.disconnect(h.inputs===void 0?h:h.inputs[0]),t.disconnect(g),h.disconnect(i),i.disconnect(m.inputs===void 0?m:m.inputs[0]),i.disconnect(_.inputs===void 0?_:_.inputs[0]),m.disconnect(p.gain),_.disconnect(g.gain),p.disconnect(a,0,0),g.disconnect(a,0,1)}}},f=(e,i,a,d)=>{let f=new Float32Array(o),p=new Float32Array(o),m=new Float32Array(o),h=new Float32Array(o),g=8192;for(let e=0;e<o;e+=1)if(e>g){let t=(e-g)/(o-1-g)*c;f[e]=Math.cos(t),p[e]=Math.sin(t),m[e]=0,h[e]=1}else{let t=e/(o-1-g)*c;f[e]=1,p[e]=0,m[e]=Math.cos(t),h[e]=Math.sin(t)}let _=t(e,{channelCount:2,channelCountMode:`explicit`,channelInterpretation:`discrete`,numberOfOutputs:2}),v=n(e,{...l,gain:0}),y=r(e,{...u,curve:f}),b=n(e,{...l,gain:0}),x=r(e,{...u,curve:p}),S=r(e,{...u,curve:s}),C=n(e,{...l,gain:0}),w=r(e,{...u,curve:m}),T=n(e,{...l,gain:0}),E=r(e,{...u,curve:h});return{connectGraph(){i.connect(_),i.connect(S.inputs===void 0?S:S.inputs[0]),_.connect(v,0),_.connect(b,0),_.connect(C,1),_.connect(T,1),S.connect(a),a.connect(y.inputs===void 0?y:y.inputs[0]),a.connect(x.inputs===void 0?x:x.inputs[0]),a.connect(w.inputs===void 0?w:w.inputs[0]),a.connect(E.inputs===void 0?E:E.inputs[0]),y.connect(v.gain),x.connect(b.gain),w.connect(C.gain),E.connect(T.gain),v.connect(d,0,0),C.connect(d,0,0),b.connect(d,0,1),T.connect(d,0,1)},disconnectGraph(){i.disconnect(_),i.disconnect(S.inputs===void 0?S:S.inputs[0]),_.disconnect(v,0),_.disconnect(b,0),_.disconnect(C,1),_.disconnect(T,1),S.disconnect(a),a.disconnect(y.inputs===void 0?y:y.inputs[0]),a.disconnect(x.inputs===void 0?x:x.inputs[0]),a.disconnect(w.inputs===void 0?w:w.inputs[0]),a.disconnect(E.inputs===void 0?E:E.inputs[0]),y.disconnect(v.gain),x.disconnect(b.gain),w.disconnect(C.gain),E.disconnect(T.gain),v.disconnect(d,0,0),C.disconnect(d,0,0),b.disconnect(d,0,1),T.disconnect(d,0,1)}}},p=(e,t,n,r,a)=>{if(t===1)return d(e,n,r,a);if(t===2)return f(e,n,r,a);throw i()};return(t,{channelCount:r,channelCountMode:o,pan:s,...c})=>{if(o===`max`)throw i();let l=e(t,{...c,channelCount:1,channelCountMode:o,numberOfInputs:2}),u=n(t,{...c,channelCount:r,channelCountMode:o,gain:1}),d=n(t,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,gain:s}),{connectGraph:f,disconnectGraph:m}=p(t,r,u,d,l);Object.defineProperty(d.gain,"defaultValue",{get:()=>0}),Object.defineProperty(d.gain,"maxValue",{get:()=>1}),Object.defineProperty(d.gain,"minValue",{get:()=>-1});let h={get bufferSize(){},get channelCount(){return u.channelCount},set channelCount(e){u.channelCount!==e&&(g&&m(),{connectGraph:f,disconnectGraph:m}=p(t,e,u,d,l),g&&f()),u.channelCount=e},get channelCountMode(){return u.channelCountMode},set channelCountMode(e){if(e===`clamped-max`||e===`max`)throw i();u.channelCountMode=e},get channelInterpretation(){return u.channelInterpretation},set channelInterpretation(e){u.channelInterpretation=e},get context(){return u.context},get inputs(){return[u]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return u.numberOfOutputs},get pan(){return d.gain},addEventListener(...e){return u.addEventListener(e[0],e[1],e[2])},dispatchEvent(...e){return u.dispatchEvent(e[0])},removeEventListener(...e){return u.removeEventListener(e[0],e[1],e[2])}},g=!1;return a($r(h,l),()=>{f(),g=!0},()=>{m(),g=!1})}},xi=(e,t,n,r,i,a,o)=>(s,c)=>{let l=s.createWaveShaper();if(a!==null&&a.name===`webkitAudioContext`&&s.createGain().gain.automationRate===void 0)return n(s,c);H(l,c);let u=c.curve===null||c.curve instanceof Float32Array?c.curve:new Float32Array(c.curve);if(u!==null&&u.length<2)throw t();V(l,{curve:u},`curve`),V(l,c,`oversample`);let d=null,f=!1;return o(l,`curve`,e=>()=>e.call(l),t=>n=>(t.call(l,n),f&&(r(n)&&d===null?d=e(s,l):!r(n)&&d!==null&&(d(),d=null)),n)),i(l,()=>{f=!0,r(l.curve)&&(d=e(s,l))},()=>{f=!1,d!==null&&(d(),d=null)})},Si=(e,t,n,r,i)=>(a,{curve:o,oversample:s,...c})=>{let l=a.createWaveShaper(),u=a.createWaveShaper();H(l,c),H(u,c);let d=n(a,{...c,gain:1}),f=n(a,{...c,gain:-1}),p=n(a,{...c,gain:1}),m=n(a,{...c,gain:-1}),h=null,g=!1,_=null,v={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(e){d.channelCount=e,f.channelCount=e,l.channelCount=e,p.channelCount=e,u.channelCount=e,m.channelCount=e},get channelCountMode(){return l.channelCountMode},set channelCountMode(e){d.channelCountMode=e,f.channelCountMode=e,l.channelCountMode=e,p.channelCountMode=e,u.channelCountMode=e,m.channelCountMode=e},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(e){d.channelInterpretation=e,f.channelInterpretation=e,l.channelInterpretation=e,p.channelInterpretation=e,u.channelInterpretation=e,m.channelInterpretation=e},get context(){return l.context},get curve(){return _},set curve(n){if(n!==null&&n.length<2)throw t();if(n===null)l.curve=n,u.curve=n;else{let e=n.length,t=new Float32Array(e+2-e%2),r=new Float32Array(e+2-e%2);t[0]=n[0],r[0]=-n[e-1];let i=Math.ceil((e+1)/2),a=(e+1)/2-1;for(let o=1;o<i;o+=1){let s=o/i*a,c=Math.floor(s),l=Math.ceil(s);t[o]=c===l?n[c]:(1-(s-c))*n[c]+(1-(l-s))*n[l],r[o]=c===l?-n[e-1-c]:-((1-(s-c))*n[e-1-c])-(1-(l-s))*n[e-1-l]}t[i]=e%2==1?n[i-1]:(n[i-2]+n[i-1])/2,l.curve=t,u.curve=r}_=n,g&&(r(_)&&h===null?h=e(a,d):h!==null&&(h(),h=null))},get inputs(){return[d]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get oversample(){return l.oversample},set oversample(e){l.oversample=e,u.oversample=e},addEventListener(...e){return d.addEventListener(e[0],e[1],e[2])},dispatchEvent(...e){return d.dispatchEvent(e[0])},removeEventListener(...e){return d.removeEventListener(e[0],e[1],e[2])}};return o!==null&&(v.curve=o instanceof Float32Array?o:new Float32Array(o)),s!==v.oversample&&(v.oversample=s),i($r(v,p),()=>{d.connect(l).connect(p),d.connect(f).connect(u).connect(m).connect(p),g=!0,r(_)&&(h=e(a,d))},()=>{d.disconnect(l),l.disconnect(p),d.disconnect(f),f.disconnect(u),u.disconnect(m),m.disconnect(p),g=!1,h!==null&&(h(),h=null)})},G=()=>new DOMException(``,`NotSupportedError`),Ci={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,detune:0,frequency:440,periodicWave:void 0,type:`sine`},wi=(e,t,n,r,i,a,o)=>class extends e{constructor(e,o){let s=i(e),c={...Ci,...o},l=n(s,c),u=a(s),d=u?r():null,f=e.sampleRate/2;super(e,!1,l,d),this._detune=t(this,u,l.detune,153600,-153600),this._frequency=t(this,u,l.frequency,f,-f),this._nativeOscillatorNode=l,this._onended=null,this._oscillatorNodeRenderer=d,this._oscillatorNodeRenderer!==null&&c.periodicWave!==void 0&&(this._oscillatorNodeRenderer.periodicWave=c.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(e){let t=typeof e==`function`?o(this,e):null;this._nativeOscillatorNode.onended=t;let n=this._nativeOscillatorNode.onended;this._onended=n!==null&&n===t?e:n}get type(){return this._nativeOscillatorNode.type}set type(e){this._nativeOscillatorNode.type=e,this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(e){this._nativeOscillatorNode.setPeriodicWave(e),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=e)}start(e=0){if(this._nativeOscillatorNode.start(e),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.start=e),this.context.state!==`closed`){pt(this);let e=()=>{this._nativeOscillatorNode.removeEventListener(`ended`,e),L(this)&&ht(this)};this._nativeOscillatorNode.addEventListener(`ended`,e)}}stop(e=0){this._nativeOscillatorNode.stop(e),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.stop=e)}},Ti=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=null,s=null,c=null,l=async(l,u)=>{let d=n(l),f=P(d,u);return f||(d=t(u,{channelCount:d.channelCount,channelCountMode:d.channelCountMode,channelInterpretation:d.channelInterpretation,detune:d.detune.value,frequency:d.frequency.value,periodicWave:o===null?void 0:o,type:d.type}),s!==null&&d.start(s),c!==null&&d.stop(c)),a.set(u,d),f?(await e(u,l.detune,d.detune),await e(u,l.frequency,d.frequency)):(await r(u,l.detune,d.detune),await r(u,l.frequency,d.frequency)),await i(l,u,d),d};return{set periodicWave(e){o=e},set start(e){s=e},set stop(e){c=e},render(e,t){let n=a.get(t);return n===void 0?l(e,t):Promise.resolve(n)}}},Ei={channelCount:2,channelCountMode:`clamped-max`,channelInterpretation:`speakers`,coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:`inverse`,maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:`equalpower`,positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},Di=(e,t,n,r,i,a,o)=>class extends e{constructor(e,s){let c=i(e),l=n(c,{...Ei,...s}),u=a(c),d=u?r():null;super(e,!1,l,d),this._nativePannerNode=l,this._orientationX=t(this,u,l.orientationX,I,F),this._orientationY=t(this,u,l.orientationY,I,F),this._orientationZ=t(this,u,l.orientationZ,I,F),this._positionX=t(this,u,l.positionX,I,F),this._positionY=t(this,u,l.positionY,I,F),this._positionZ=t(this,u,l.positionZ,I,F),o(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(e){this._nativePannerNode.coneInnerAngle=e}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(e){this._nativePannerNode.coneOuterAngle=e}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(e){this._nativePannerNode.coneOuterGain=e}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(e){this._nativePannerNode.distanceModel=e}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(e){this._nativePannerNode.maxDistance=e}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(e){this._nativePannerNode.panningModel=e}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(e){this._nativePannerNode.refDistance=e}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(e){this._nativePannerNode.rolloffFactor=e}},Oi=(e,t,n,r,i,a,o,s,c,l)=>()=>{let u=new WeakMap,d=null,f=async(f,p)=>{let m=null,h=a(f),g={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation},_={...g,coneInnerAngle:h.coneInnerAngle,coneOuterAngle:h.coneOuterAngle,coneOuterGain:h.coneOuterGain,distanceModel:h.distanceModel,maxDistance:h.maxDistance,panningModel:h.panningModel,refDistance:h.refDistance,rolloffFactor:h.rolloffFactor},v=P(h,p);if(`bufferSize`in h?m=r(p,{...g,gain:1}):v||(h=i(p,{..._,orientationX:h.orientationX.value,orientationY:h.orientationY.value,orientationZ:h.orientationZ.value,positionX:h.positionX.value,positionY:h.positionY.value,positionZ:h.positionZ.value})),u.set(p,m===null?h:m),m!==null){if(d===null){if(o===null)throw Error(`Missing the native OfflineAudioContext constructor.`);let e=new o(6,f.context.length,p.sampleRate),r=t(e,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:6});r.connect(e.destination),d=(async()=>{let t=await Promise.all([f.orientationX,f.orientationY,f.orientationZ,f.positionX,f.positionY,f.positionZ].map(async(t,r)=>{let i=n(e,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,offset:+(r===0)});return await s(e,t,i.offset),i}));for(let e=0;e<6;e+=1)t[e].connect(r,0,e),t[e].start(0);return l(e)})()}let e=await d,a=r(p,{...g,gain:1});await c(f,p,a);let u=[];for(let t=0;t<e.numberOfChannels;t+=1)u.push(e.getChannelData(t));let h=[u[0][0],u[1][0],u[2][0]],v=[u[3][0],u[4][0],u[5][0]],y=r(p,{...g,gain:1}),b=i(p,{..._,orientationX:h[0],orientationY:h[1],orientationZ:h[2],positionX:v[0],positionY:v[1],positionZ:v[2]});a.connect(y).connect(b.inputs[0]),b.connect(m);for(let t=128;t<e.length;t+=128){let e=[u[0][t],u[1][t],u[2][t]],n=[u[3][t],u[4][t],u[5][t]];if(e.some((e,t)=>e!==h[t])||n.some((e,t)=>e!==v[t])){h=e,v=n;let o=t/p.sampleRate;y.gain.setValueAtTime(0,o),y=r(p,{...g,gain:0}),b=i(p,{..._,orientationX:h[0],orientationY:h[1],orientationZ:h[2],positionX:v[0],positionY:v[1],positionZ:v[2]}),y.gain.setValueAtTime(1,o),a.connect(y).connect(b.inputs[0]),b.connect(m)}}return m}return v?(await e(p,f.orientationX,h.orientationX),await e(p,f.orientationY,h.orientationY),await e(p,f.orientationZ,h.orientationZ),await e(p,f.positionX,h.positionX),await e(p,f.positionY,h.positionY),await e(p,f.positionZ,h.positionZ)):(await s(p,f.orientationX,h.orientationX),await s(p,f.orientationY,h.orientationY),await s(p,f.orientationZ,h.orientationZ),await s(p,f.positionX,h.positionX),await s(p,f.positionY,h.positionY),await s(p,f.positionZ,h.positionZ)),Xt(h)?await c(f,p,h.inputs[0]):await c(f,p,h),h};return{render(e,t){let n=u.get(t);return n===void 0?f(e,t):Promise.resolve(n)}}},ki={disableNormalization:!1},Ai=(e,t,n,r)=>class i{constructor(i,a){let o=e(t(i),r({...ki,...a}));return n.add(o),o}static[Symbol.hasInstance](e){return typeof e==`object`&&!!e&&Object.getPrototypeOf(e)===i.prototype||n.has(e)}},ji=(e,t)=>(n,r,i)=>(e(r).replay(i),t(r,n,i)),Mi=(e,t,n)=>async(r,i,a)=>{let o=e(r);await Promise.all(o.activeInputs.map((e,o)=>Array.from(e).map(async([e,s])=>{let c=await t(e).render(e,i),l=r.context.destination;!n(e)&&(r!==l||!n(r))&&c.connect(a,s,o)})).reduce((e,t)=>[...e,...t],[]))},Ni=(e,t,n)=>async(r,i,a)=>{let o=t(r);await Promise.all(Array.from(o.activeInputs).map(async([t,r])=>{let o=await e(t).render(t,i);n(t)||o.connect(a,r)}))},Pi=(e,t,n,r)=>i=>e(Pr,()=>Pr(i))?Promise.resolve(e(r,r)).then(e=>{if(!e){let e=n(i,512,0,1);i.oncomplete=()=>{e.onaudioprocess=null,e.disconnect()},e.onaudioprocess=()=>i.currentTime,e.connect(i.destination)}return i.startRendering()}):new Promise(e=>{let n=t(i,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,gain:0});i.oncomplete=t=>{n.disconnect(),e(t.renderedBuffer)},n.connect(i.destination),i.startRendering()}),Fi=e=>(t,n)=>e.set(t,n),Ii={channelCount:2,channelCountMode:`explicit`,channelInterpretation:`speakers`,pan:0},Li=(e,t,n,r,i,a)=>class extends e{constructor(e,o){let s=i(e),c=n(s,{...Ii,...o}),l=a(s),u=l?r():null;super(e,!1,c,u),this._pan=t(this,l,c.pan)}get pan(){return this._pan}},Ri=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=async(o,s)=>{let c=n(o),l=P(c,s);return l||(c=t(s,{channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,pan:c.pan.value})),a.set(s,c),l?await e(s,o.pan,c.pan):await r(s,o.pan,c.pan),Xt(c)?await i(o,s,c.inputs[0]):await i(o,s,c),c};return{render(e,t){let n=a.get(t);return n===void 0?o(e,t):Promise.resolve(n)}}},zi=e=>()=>{if(e===null)return!1;try{new e({length:1,sampleRate:44100})}catch{return!1}return!0},Bi=(e,t)=>async()=>{if(e===null)return!0;if(t===null)return!1;let n=new Blob([`class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)`],{type:`application/javascript; charset=utf-8`}),r=new t(1,128,44100),i=URL.createObjectURL(n),a=!1,o=!1;try{await r.audioWorklet.addModule(i);let t=new e(r,`a`,{numberOfOutputs:0}),n=r.createOscillator();t.port.onmessage=()=>a=!0,t.onprocessorerror=()=>o=!0,n.connect(t),n.start(0),await r.startRendering(),await new Promise(e=>setTimeout(e))}catch{}finally{URL.revokeObjectURL(i)}return a&&!o},Vi=(e,t)=>()=>{if(t===null)return Promise.resolve(!1);let n=new t(1,1,44100),r=e(n,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,gain:0});return new Promise(e=>{n.oncomplete=()=>{r.disconnect(),e(n.currentTime!==0)},n.startRendering()})},Hi=()=>new DOMException(``,`UnknownError`),Ui={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,curve:null,oversample:`none`},Wi=(e,t,n,r,i,a,o)=>class extends e{constructor(e,t){let s=i(e),c=n(s,{...Ui,...t}),l=a(s)?r():null;super(e,!0,c,l),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,o(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(e){if(e===null)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(e.length<2)throw t();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=e}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(e){this._nativeWaveShaperNode.oversample=e}},Gi=(e,t,n)=>()=>{let r=new WeakMap,i=async(i,a)=>{let o=t(i);return P(o,a)||(o=e(a,{channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,curve:o.curve,oversample:o.oversample})),r.set(a,o),Xt(o)?await n(i,a,o.inputs[0]):await n(i,a,o),o};return{render(e,t){let n=r.get(t);return n===void 0?i(e,t):Promise.resolve(n)}}},Ki=()=>typeof window>`u`?null:window,qi=(e,t)=>n=>{n.copyFromChannel=(r,i,a=0)=>{let o=e(a),s=e(i);if(s>=n.numberOfChannels)throw t();let c=n.length,l=n.getChannelData(s),u=r.length;for(let e=o<0?-o:0;e+o<c&&e<u;e+=1)r[e]=l[e+o]},n.copyToChannel=(r,i,a=0)=>{let o=e(a),s=e(i);if(s>=n.numberOfChannels)throw t();let c=n.length,l=n.getChannelData(s),u=r.length;for(let e=o<0?-o:0;e+o<c&&e<u;e+=1)l[e+o]=r[e]}},Ji=e=>t=>{t.copyFromChannel=(n=>(r,i,a=0)=>{let o=e(a),s=e(i);if(o<t.length)return n.call(t,r,s,o)})(t.copyFromChannel),t.copyToChannel=(n=>(r,i,a=0)=>{let o=e(a),s=e(i);if(o<t.length)return n.call(t,r,s,o)})(t.copyToChannel)},Yi=e=>(t,n)=>{let r=n.createBuffer(1,1,44100);t.buffer===null&&(t.buffer=r),e(t,`buffer`,e=>()=>{let n=e.call(t);return n===r?null:n},e=>n=>e.call(t,n===null?r:n))},Xi=(e,t)=>(n,r)=>{r.channelCount=1,r.channelCountMode=`explicit`,Object.defineProperty(r,"channelCount",{get:()=>1,set:()=>{throw e()}}),Object.defineProperty(r,"channelCountMode",{get:()=>`explicit`,set:()=>{throw e()}});let i=n.createBufferSource();t(r,()=>{let e=r.numberOfInputs;for(let t=0;t<e;t+=1)i.connect(r,0,t)},()=>i.disconnect(r))},Zi=(e,t,n)=>e.copyFromChannel===void 0?e.getChannelData(n)[0]:(e.copyFromChannel(t,n),t[0]),Qi=e=>{if(e===null)return!1;let t=e.length;return t%2==0?e[t/2-1]+e[t/2]!==0:e[Math.floor(t/2)]!==0},$i=(e,t,n,r)=>{let i=e;for(;!i.hasOwnProperty(t);)i=Object.getPrototypeOf(i);let{get:a,set:o}=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,{get:n(a),set:r(o)})},ea=e=>({...e,channelCount:e.numberOfOutputs}),ta=e=>{let{imag:t,real:n}=e;return t===void 0?n===void 0?{...e,imag:[0,0],real:[0,0]}:{...e,imag:Array.from(n,()=>0),real:n}:n===void 0?{...e,imag:t,real:Array.from(t,()=>0)}:{...e,imag:t,real:n}},na=(e,t,n)=>{try{e.setValueAtTime(t,n)}catch(r){if(r.code!==9)throw r;na(e,t,n+1e-7)}},ra=e=>{let t=e.createBufferSource();t.start();try{t.start()}catch{return!0}return!1},ia=e=>{let t=e.createBufferSource();t.buffer=e.createBuffer(1,1,44100);try{t.start(0,1)}catch{return!1}return!0},aa=e=>{let t=e.createBufferSource();t.start();try{t.stop()}catch{return!1}return!0},oa=e=>{let t=e.createOscillator();try{t.start(-1)}catch(e){return e instanceof RangeError}return!1},sa=e=>{let t=e.createBuffer(1,1,44100),n=e.createBufferSource();n.buffer=t,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},ca=e=>{let t=e.createOscillator();try{t.stop(-1)}catch(e){return e instanceof RangeError}return!1},la=e=>{e.start=(t=>(n=0,r=0,i)=>{let a=e.buffer,o=a===null?r:Math.min(a.duration,r);a!==null&&o>a.duration-.5/e.context.sampleRate?t.call(e,n,0,0):t.call(e,n,o,i)})(e.start)},ua=(e,t)=>{let n=t.createGain();e.connect(n);let r=(t=>()=>{t.call(e,n),e.removeEventListener(`ended`,r)})(e.disconnect);e.addEventListener(`ended`,r),$r(e,n),e.stop=(t=>{let r=!1;return(i=0)=>{if(r)try{t.call(e,i)}catch{n.gain.setValueAtTime(0,i)}else t.call(e,i),r=!0}})(e.stop)},da=(e,t)=>n=>{let r={value:e};return Object.defineProperties(n,{currentTarget:r,target:r}),typeof t==`function`?t.call(e,n):t.handleEvent.call(e,n)},fa=We(qt),pa=vt(qt),ma=Yn(ut),ha=new WeakMap,ga=ur(ha),K=En(new Map,new WeakMap),q=Ki(),_a=Rr(K,wt),va=lr(R),J=Mi(R,va,an),ya=St(_a,z,J),Y=fr(Qe),ba=pi(q),X=Er(ba),xa=new WeakMap,Sa=rr(da),Ca=Wr(q),wa=Sr(Ca),Ta=Cr(q),Ea=wr(q),Da=Kr(q),Z=yn(Ge(Je),_t(fa,pa,Zt,ma,nn,R,ga,ft,z,qt,L,an,on),K,xr(et,nn,R,z,rn,L),wt,mr,G,Gn(Zt,et,R,z,rn,Y,L,X),Zn(xa,R,lt),Sa,Y,wa,Ta,Ea,X,Da),Oa=xt(Z,ya,wt,_a,Y,X),ka=new WeakSet,Aa=zr(q),ja=Rn(new Uint32Array(1)),Ma=qi(ja,wt),Na=Ji(ja),Pa=Dt(ka,K,G,Aa,ba,zi(Aa),Ma,Na),Fa=yt(W),Ia=Ni(va,Lt,an),La=Nn(Ia),Ra=Ur(Fa,K,ra,ia,aa,oa,sa,ca,la,Yi($i),ua),za=ji(dr(Lt),Ia),Ba=At(La,Ra,z,za,J),Q=bn(Ke(Xe),xa,Ze,xn,He.createCancelAndHoldAutomationEvent,He.createCancelScheduledValuesAutomationEvent,He.createExponentialRampToValueAutomationEvent,He.createLinearRampToValueAutomationEvent,He.createSetTargetAutomationEvent,He.createSetValueAutomationEvent,He.createSetValueCurveAutomationEvent,Ca,na),Va=kt(Z,Ba,Q,B,Ra,Y,X,da),Ha=Ht(Z,Ut,wt,B,Gr(W,$i),Y,X,J),Ua=Tn(La,Jr,z,za,J),Wa=Fi(ha),Ga=wn(Z,Q,Ua,mr,Jr,Y,X,Wa),Ka=Fr(qt,Ta),qa=Yr(Ca,Xi(B,Ka)),Ja=On(Z,kn(qa,z,J),qa,Y,X),Ya=jn(Z,Mn(Zr,z,J),Zr,Y,X,ea),Xa=Qr(Fa,K,ei(Fa,Ra,W,Ka),oa,ca),Za=In(Z,Q,Ln(La,Xa,z,za,J),Xa,Y,X,da),Qa=ti(G,$i),$a=Bn(Z,Vn(Qa,z,J),Qa,Y,X,Wa),eo=qn(Z,Q,Jn(La,ni,z,za,J),ni,Y,X,Wa),to=ri(G),no=$n(Z,Q,er(La,to,z,za,J),to,G,Y,X,Wa),ro=sr(Z,Q,cr(La,W,z,za,J),W,Y,X),io=ci(mr,B,vi,G),ao=Pi(K,W,vi,Vi(W,ba)),oo=br(Ra,z,ba,J,ao),so=_r(Z,ii(io),oo,Y,X,Wa),co=Nr(Ha,Wt(Q,qa,Xa,vi,G,Zi,X,$i),Sa,X,new WeakMap,da),lo=mi(Fa,K,oa,sa,ca,ua),uo=wi(Z,Q,lo,Ti(La,lo,z,za,J),Y,X,da),fo=Pn(Ra),po=xi(fo,B,Si(fo,B,W,Qi,Ka),Qi,Ka,Ca,$i),mo=hi(gi(Zt,B,qa,W,vi,po,G,nn,Zi,Ka)),ho=Di(Z,Q,mo,Oi(La,qa,Xa,W,mo,z,ba,za,J,ao),Y,X,Wa),go=Ai(_i(wt),Y,new WeakSet,ta),_o=yi(bi(qa,Zr,W,po,G,Ka),G),vo=Li(Z,Q,_o,Ri(La,_o,z,za,J),Y,X),yo=Wi(Z,B,po,Gi(po,z,J),Y,X,Wa),bo=Dr(q),xo=ir(q),So=pr(new WeakMap,ba),Co=bo?ct(K,G,nr(q),xo,ar(Ue),Y,So,X,Da,new WeakMap,new WeakMap,Bi(Da,ba),q):void 0,wo=Tr(wa,X),To=Vt(Sn(Co,Oa,Pa,Va,Ga,Ja,Ya,Za,$a,Wn(ka,K,Hn,tr,new WeakSet,Y,wo,Ct,Pr,Ma,Na),eo,no,ro,so,co,uo,ho,go,vo,yo),B,G,Hi,Or(Z,li,Y,X),Ar(Z,ui,Y,X),jr(Z,di,Y,X),Mr(Z,fi(B,X),Y),Ca),$;(function(e){e.INIT=`INIT`,e.PLAYING=`PLAYING`,e.STOPPED=`STOPPED`,e.PAUSED=`PAUSED`})($||={});var Eo;(function(e){e.STATE_CHANGE=`state-change`,e.ITERATION=`iteration`})(Eo||={});var Do=class{constructor(e=new To,t=new Ee){this.defaultBpm=100,this.scoreInstruments=[],this.ready=!1,this.ac=e,this.ac.suspend(),this.instrumentPlayer=t,this.instrumentPlayer.init(this.ac),this.availableInstruments=this.instrumentPlayer.instruments,this.events=new Ae,this.cursor=null,this.sheet=null,this.scheduler=null,this.iterationSteps=0,this.currentIterationStep=0,this.timeoutHandles=[],this.playbackSettings={bpm:this.defaultBpm,masterVolume:1},this.setState($.INIT)}get wholeNoteLength(){return Math.round(60/this.playbackSettings.bpm*4e3)}getPlaybackInstrument(e){if(!this.sheet)return null;let t=this.sheet.Instruments.flatMap(e=>e.Voices).find(t=>t.VoiceId===e);return this.availableInstruments.find(e=>e.midiId===t.midiInstrumentId)}async setInstrument(e,t){await this.instrumentPlayer.load(t),e.midiInstrumentId=t}async loadScore(e){this.ready=!1,this.sheet=e.Sheet,this.scoreInstruments=this.sheet.Instruments,this.cursor=e.cursor,this.sheet.HasBPMInfo&&this.setBpm(this.sheet.DefaultStartTempoInBpm),await this.loadInstruments(),this.initInstruments(),this.scheduler=new v(this.wholeNoteLength,this.ac,(e,t)=>this.notePlaybackCallback(e,t)),this.countAndSetIterationSteps(),this.ready=!0,this.setState($.STOPPED)}initInstruments(){for(let e of this.sheet.Instruments)for(let t of e.Voices)t.midiInstrumentId=e.MidiInstrumentId}async loadInstruments(){let e=[];for(let t of this.sheet.Instruments)this.availableInstruments.find(e=>e.midiId===t.MidiInstrumentId)??this.fallbackToPiano(t),e.push(this.instrumentPlayer.load(t.MidiInstrumentId));await Promise.all(e)}fallbackToPiano(e){if(console.warn(`Can't find playback instrument for midiInstrumentId ${e.MidiInstrumentId}. Falling back to piano`),e.MidiInstrumentId=0,this.availableInstruments.find(e=>e.midiId===0)==null)throw Error(`Piano fallback failed, grand piano not supported`)}async play(){await this.ac.resume(),(this.state===$.INIT||this.state===$.STOPPED)&&this.cursor.show(),this.setState($.PLAYING),this.scheduler.start()}async stop(){this.setState($.STOPPED),this.stopPlayers(),this.clearTimeouts(),this.scheduler.reset(),this.cursor.reset(),this.currentIterationStep=0,this.cursor.hide()}pause(){this.setState($.PAUSED),this.ac.suspend(),this.stopPlayers(),this.scheduler.setIterationStep(this.currentIterationStep),this.scheduler.pause(),this.clearTimeouts()}jumpToStep(e){for(this.pause(),this.currentIterationStep>e&&(this.cursor.reset(),this.currentIterationStep=0);this.currentIterationStep<e;)this.cursor.next(),++this.currentIterationStep;let t=this.currentIterationStep;this.currentIterationStep>0&&this.currentIterationStep<this.iterationSteps&&++t,this.scheduler.setIterationStep(t)}setBpm(e){this.playbackSettings.bpm=e,this.scheduler&&(this.scheduler.wholeNoteLength=this.wholeNoteLength)}on(e,t){this.events.on(e,t)}countAndSetIterationSteps(){this.cursor.reset();let e=0;for(;!this.cursor.Iterator.EndReached;)this.cursor.Iterator.CurrentVoiceEntries&&this.scheduler.loadNotes(this.cursor.Iterator.CurrentVoiceEntries),this.cursor.next(),++e;this.iterationSteps=e,this.cursor.reset()}notePlaybackCallback(e,t){if(this.state!==$.PLAYING)return;let n=new Map;for(let e of t){if(e.isRest())continue;let t=Oe(e,this.wholeNoteLength);if(t===0)continue;let r=ke(e),i=De(e),a=e.ParentVoiceEntry.ParentVoice.midiInstrumentId,o=e.ParentVoiceEntry.ParentVoice.Parent.SubInstruments[0].fixedKey||0;n.has(a)||n.set(a,[]),n.get(a).push({note:e.halfTone-o*12,duration:t/1e3,gain:r,articulation:i})}for(let[t,r]of n)this.instrumentPlayer.schedule(t,this.ac.currentTime+e,r);this.timeoutHandles.push(window.setTimeout(()=>this.iterationCallback(),Math.max(0,e*1e3-35)),window.setTimeout(()=>this.events.emit(Eo.ITERATION,t),e*1e3))}setState(e){this.state=e,this.events.emit(Eo.STATE_CHANGE,e)}stopPlayers(){for(let e of this.sheet.Instruments)for(let t of e.Voices)this.instrumentPlayer.stop(t.midiInstrumentId)}clearTimeouts(){for(let e of this.timeoutHandles)clearTimeout(e);this.timeoutHandles=[]}iterationCallback(){this.state===$.PLAYING&&(this.currentIterationStep>0&&this.cursor.next(),++this.currentIterationStep)}},Oo={class:`w-full h-full overflow-y-auto`},ko={class:`min-h-full flex flex-col p-4`},Ao={key:0,class:`mb-4 text-center`},jo={class:`text-2xl font-bold text-gray-900`},Mo={class:`mb-4 flex gap-2 items-center justify-center`},No=[`disabled`],Po={class:`text-xl`},Fo=[`disabled`],Io={class:`flex items-center gap-2`},Lo=(0,p.defineComponent)({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},setup(e){let t=e,n=(0,p.ref)(null),r=null,i=null,a=(0,p.ref)(!1),o=(0,p.ref)(!1),s=(0,p.ref)(!1),c=(0,p.ref)(200),l=(0,p.ref)(!1),u=(0,p.ref)(!1),d=async()=>{if(!(!n.value||!t.selectedResult.data?.musicXML))try{n.value.innerHTML=``,a.value=!1,o.value=!1,r=new m.OpenSheetMusicDisplay(n.value,{autoResize:!0,backend:`svg`,drawTitle:!1,followCursor:!0}),await r.load(t.selectedResult.data.musicXML),await r.render(),i||=new Do,await i.loadScore(r);let e=r.Sheet?.SourceMeasures?.[0]?.TempoExpressions;if(e&&e.length>0){let t=e[0],n=t.TempoInBpm||t.tempoInBpm;n&&(c.value=n)}i.on(`iteration`,e=>{!l.value&&e&&e.length===0&&(i.stop(),o.value=!1)}),a.value=!0}catch(e){console.error(`Error rendering music:`,e),n.value&&(n.value.innerHTML=`<div class="text-red-500">Error rendering sheet music: ${e instanceof Error?e.message:`Unknown error`}</div>`)}},f=async()=>{if(!n.value||!a.value)return;let e=n.value.querySelector(`svg`);if(e){s.value=!0;try{let n=e.viewBox.baseVal.width||e.clientWidth,r=e.viewBox.baseVal.height||e.clientHeight,i=new h.jsPDF({orientation:n>r?`landscape`:`portrait`,unit:`pt`,format:`a4`}),a=i.internal.pageSize.getWidth(),o=i.internal.pageSize.getHeight(),s=Math.min(a/n,o/r),c=n*s,l=r*s;await(0,g.svg2pdf)(e,i,{x:(a-c)/2,y:(o-l)/2,width:c,height:l});let u=`${(t.selectedResult.title||`sheet-music`).replace(/[^a-zA-Z0-9]/g,`_`)}.pdf`;i.save(u)}catch(e){console.error(`Error exporting PDF:`,e)}finally{s.value=!1}}},_=async()=>{!i||!a.value||(i.setBpm(Math.max(30,Math.min(300,c.value))),i.metronomeVolume=u.value?.7:0,i.isLooping=l.value,await i.play(),o.value=!0)},v=()=>{i&&(i.stop(),o.value=!1)};return(0,p.watch)(c,()=>{i&&i.setBpm(Math.max(30,Math.min(300,c.value)))}),(0,p.watch)(l,()=>{i&&(i.isLooping=l.value)}),(0,p.watch)(u,()=>{i&&(i.metronomeVolume=u.value?.7:0)}),(0,p.onMounted)(()=>{d()}),(0,p.watch)(()=>t.selectedResult.data?.musicXML,()=>{d()}),(0,p.onUnmounted)(()=>{i&&i.stop()}),(t,r)=>((0,p.openBlock)(),(0,p.createElementBlock)(`div`,Oo,[(0,p.createElementVNode)(`div`,ko,[e.selectedResult.title?((0,p.openBlock)(),(0,p.createElementBlock)(`div`,Ao,[(0,p.createElementVNode)(`h2`,jo,(0,p.toDisplayString)(e.selectedResult.title),1)])):(0,p.createCommentVNode)(``,!0),(0,p.createElementVNode)(`div`,Mo,[(0,p.createElementVNode)(`button`,{onClick:r[0]||=e=>o.value?v():_(),disabled:!a.value,class:(0,p.normalizeClass)([`px-4 py-2 text-white rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1`,o.value?`bg-red-500`:`bg-blue-500`])},[(0,p.createElementVNode)(`span`,Po,(0,p.toDisplayString)(o.value?`⏹`:`▶`),1),(0,p.createTextVNode)(` `+(0,p.toDisplayString)(o.value?`Stop`:`Play`),1)],10,No),(0,p.createElementVNode)(`button`,{onClick:f,disabled:!a.value||s.value,class:`px-4 py-2 text-white bg-green-600 rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1`},[r[2]||=(0,p.createElementVNode)(`span`,{class:`text-xl`},`⬇`,-1),(0,p.createTextVNode)(` `+(0,p.toDisplayString)(s.value?`Exporting...`:`PDF`),1)],8,Fo),(0,p.createElementVNode)(`label`,Io,[r[3]||=(0,p.createTextVNode)(` Tempo `,-1),(0,p.withDirectives)((0,p.createElementVNode)(`input`,{"onUpdate:modelValue":r[1]||=e=>c.value=e,type:`number`,min:`30`,max:`300`,class:`w-20 px-2 py-1 border border-gray-300 rounded`},null,512),[[p.vModelText,c.value,void 0,{number:!0}]]),r[4]||=(0,p.createTextVNode)(` bpm `,-1)])]),(0,p.createElementVNode)(`div`,{ref_key:`musicContainer`,ref:n,class:`flex-1 flex items-center justify-center bg-white rounded-lg p-4`},null,512)])]))}}),Ro={class:`text-center p-4 bg-purple-50 rounded`},zo={key:0,class:`text-xs text-gray-600 mt-1 truncate`},Bo=(0,p.defineComponent)({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>((0,p.openBlock)(),(0,p.createElementBlock)(`div`,Ro,[n[0]||=(0,p.createElementVNode)(`div`,{class:`text-purple-600 font-medium`},`🎵 Sheet Music`,-1),e.result.title?((0,p.openBlock)(),(0,p.createElementBlock)(`div`,zo,(0,p.toDisplayString)(e.result.title),1)):(0,p.createCommentVNode)(``,!0)]))}}),Vo={toolDefinition:f.r,execute:f.n,generatingMessage:`Rendering sheet music...`,isEnabled:()=>!0,viewComponent:Lo,previewComponent:Bo,samples:f.t},Ho={plugin:Vo};exports.TOOL_DEFINITION=f.r,exports.default=Ho,exports.executeMusic=f.n,exports.plugin=Vo,exports.t=d;
|