From 59487b2678a55740c92c40401e8c183610c6f9db Mon Sep 17 00:00:00 2001 From: Bubobubobubobubo Date: Fri, 22 Sep 2023 16:59:34 +0000 Subject: [PATCH] deploy: c0e79ed704652eb8d2a5beed6d697e78a5fb4222 --- assets/{index-164cb80c.js => index-3490153d.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-164cb80c.js => index-3490153d.js} (97%) diff --git a/assets/index-164cb80c.js b/assets/index-3490153d.js similarity index 97% rename from assets/index-164cb80c.js rename to assets/index-3490153d.js index 107fe56..52cb81f 100644 --- a/assets/index-164cb80c.js +++ b/assets/index-3490153d.js @@ -2365,7 +2365,7 @@ I won't teach you how to play with Hydra. You can find some great resources on t `+c.line+" | "+_+` `+m+" | "+t("",l.column-1," ")+t("",A,"^")}else a+=` at `+u}return a},e.buildMessage=function(i,a){var s={literal:function(_){return'"'+l(_.text)+'"'},class:function(_){var b=_.parts.map(function(A){return Array.isArray(A)?c(A[0])+"-"+c(A[1]):c(A)});return"["+(_.inverted?"^":"")+b.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(_){return _.description}};function o(_){return _.charCodeAt(0).toString(16).toUpperCase()}function l(_){return _.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(b){return"\\x0"+o(b)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(b){return"\\x"+o(b)})}function c(_){return _.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(b){return"\\x0"+o(b)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(b){return"\\x"+o(b)})}function u(_){return s[_.type](_)}function p(_){var b=_.map(u),A,R;if(b.sort(),b.length>0){for(A=1,R=1;A>",ne="<<",re="<",ee=">",M="_",$="?",j="r",X="#",ce="b",le="iii",Oe="ii",ke="iv",Me="i",Ee="vii",Ie="vi",ue="v",De=/^[0-9]/,Ze=/^[ \n\r\t]/,Ve=/^[mklpdcwyhnqaefsxtgujzo]/,et=/^[a-zA-Z0-9\-*+]/,nt=/^[A-G]/,Ke=/^[bs]/,mt=lt("-",!1),it=Nn([["0","9"]],!1,!1),Ct=lt(".",!1),Nt=Pa("whitespace"),st=Nn([" ",` -`,"\r"," "],!1,!1),Ge=lt(",",!1),Tr=lt("|",!1),pt=Nn(["m","k","l","p","d","c","w","y","h","n","q","a","e","f","s","x","t","g","u","j","z","o"],!1,!1),We=lt("(",!1),hr=lt(":",!1),qt=lt(")",!1),fr=lt("[:",!1),W=lt("]",!1),_e=lt("[",!1),Le=lt("{",!1),xe=lt("}",!1),rt=lt("+",!1),Ne=lt("*",!1),$t=lt("/",!1),ht=lt("%",!1),Ot=lt("^",!1),Jr=lt("&",!1),gt=lt(">>",!1),Zt=lt("<<",!1),yt=lt("<",!1),$e=lt(">",!1),vr=lt("_",!1),jn=lt("?",!1),ft=lt("r",!1),xr=lt("#",!1),mr=lt("b",!1),Oi=Nn([["a","z"],["A","Z"],["0","9"],"-","*","+"],!1,!1),Rn=Nn([["A","G"]],!1,!1),Qt=Nn(["b","s"],!1,!1),hn=lt("iii",!1),zi=lt("ii",!1),Ei=lt("iv",!1),Hi=lt("i",!1),en=lt("vii",!1),Jn=lt("vi",!1),fn=lt("v",!1),Wt=function(y){return y.filter(P=>P)},bi=function(){return parseFloat(gr())},Ti=function(){return parseInt(gr())},q=function(){return parseInt(gr())},ie=function(){},de=function(){return jM[gr()]},ge=function(y){return y.filter(P=>P)},Ce=function(y,P){return P?Pe(QO,{item:y,times:P}):Pe(qO,{items:y})},qe=function(y){return y},Be=function(y,P,Q){return Pe(hP,{left:y,operation:P,right:Q})},At=function(y,P){return Pe(pP,{items:y,times:P})},Cr=function(y){return Pe(KA,{items:y})},Fr=function(y){return y.map(P=>typeof P=="number"?P:void 0)},Aa=function(){return Math.ceil(XA(gr()))},Wi=function(y){var P=y.filter(Q=>Q).map(Q=>Pe(di,{pitch:Q[0]},Q.toString()));return Pe(qO,{items:P})},Ts=function(y){return y},Yr=function(){},vs=function(y){return Pe(Lg,{items:y})},Ra=function(y){return Pe(uP,{octave:y})},Ia=function(){return gr().split("").reduce((y,P)=>y+(P==="^"?1:-1),0)},Cs=function(){return Pe($O,{seededRandom:a.seededRandom})},Na=function(y,P){return Pe($O,{min:y,max:P,seededRandom:a.seededRandom})},ys=function(y,P){return Pe(QO,{item:y,times:P})},wa=function(y){return Pe(dP,{duration:y})},kr=function(y){return Pe(Em,{duration:y})},As=function(y,P,Q,K){const oe=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return Pe(di,{duration:P,pitch:K,octave:oe,add:Q})},Rs=function(y){return y.reduce((P,Q)=>P+(Q==="#"?1:-1),0)},Da=function(y,P,Q,K){const oe=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return Pe(va,{pitches:[P].concat(Q),inversion:K,octave:oe})},xa=function(){return gr()},Is=function(y){return y},ka=function(){return gr()},Ns=function(y,P,Q,K,oe){const me=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",we=a.nodeOptions.key?a.nodeOptions.key:"C",ut=TP(K,Q,me,y,P),Rt=P||a.nodeOptions.duration,Vt=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return Pe(va,{duration:Rt,octave:Vt,pitches:ut,chordName:K,inversion:oe,scaleName:me,key:we})},La=function(y,P,Q,K,oe){const me=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",we=a.nodeOptions.key?a.nodeOptions.key:"C",ut=y?a.nodeOptions.octave+y:a.nodeOptions.octave,Rt=P||a.nodeOptions.duration;return Pe(cP,{duration:Rt,roman:Q,octave:ut,chordName:K,inversion:oe,scaleName:me,key:we})},ws=function(y,P,Q){const K=y?a.nodeOptions.octave+y:a.nodeOptions.octave,oe=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",me=a.nodeOptions.key?a.nodeOptions.key:"C",we=wP(Q,me,oe);return P||a.nodeOptions.duration,Pe(di,{duration:P,pitch:we.pc,octave:we.octave+K,add:we.add,scaleName:oe,key:me})},N=0,Je=0,_t=[{line:1,column:1}],Lr=0,In=[],ve=0,Te={},vi;if("startRule"in a){if(!(a.startRule in l))throw new Error(`Can't start parsing from rule "`+a.startRule+'".');c=l[a.startRule]}function gr(){return i.substring(Je,N)}function Ma(){return wn(Je,N)}function lt(y,P){return{type:"literal",text:y,ignoreCase:P}}function Nn(y,P,Q){return{type:"class",parts:y,inverted:P,ignoreCase:Q}}function Ci(){return{type:"end"}}function Pa(y){return{type:"other",description:y}}function ei(y){var P=_t[y],Q;if(P)return P;for(Q=y-1;!_t[Q];)Q--;for(P=_t[Q],P={line:P.line,column:P.column};QLr&&(Lr=N,In=[]),In.push(y))}function Xi(y,P,Q){return new e(e.buildMessage(y,P),y,P,Q)}function Dn(){var y,P,Q=N*41+0,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,P=Zi(),P!==s&&(Je=y,P=Wt(P)),y=P,Te[Q]={nextPos:N,result:y},y)}function sr(){var y,P,Q,K,oe,me,we,ut=N*41+1,Rt=Te[ut];if(Rt)return N=Rt.nextPos,Rt.result;for(y=N,P=N,i.charCodeAt(N)===45?(Q=u,N++):(Q=s,ve===0&&Ae(mt)),Q===s&&(Q=null),K=[],De.test(i.charAt(N))?(oe=i.charAt(N),N++):(oe=s,ve===0&&Ae(it));oe!==s;)K.push(oe),De.test(i.charAt(N))?(oe=i.charAt(N),N++):(oe=s,ve===0&&Ae(it));if(i.charCodeAt(N)===46?(oe=p,N++):(oe=s,ve===0&&Ae(Ct)),oe!==s){if(me=[],De.test(i.charAt(N))?(we=i.charAt(N),N++):(we=s,ve===0&&Ae(it)),we!==s)for(;we!==s;)me.push(we),De.test(i.charAt(N))?(we=i.charAt(N),N++):(we=s,ve===0&&Ae(it));else me=s;me!==s?(Q=[Q,K,oe,me],P=Q):(N=P,P=s)}else N=P,P=s;if(P===s)if(P=N,i.charCodeAt(N)===46?(Q=p,N++):(Q=s,ve===0&&Ae(Ct)),Q!==s){if(K=[],De.test(i.charAt(N))?(oe=i.charAt(N),N++):(oe=s,ve===0&&Ae(it)),oe!==s)for(;oe!==s;)K.push(oe),De.test(i.charAt(N))?(oe=i.charAt(N),N++):(oe=s,ve===0&&Ae(it));else K=s;K!==s?(Q=[Q,K],P=Q):(N=P,P=s)}else N=P,P=s;return P!==s&&(Je=y,P=bi()),y=P,Te[ut]={nextPos:N,result:y},y}function ti(){var y,P,Q=N*41+2,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,i.charCodeAt(N)===45?N++:ve===0&&Ae(mt),De.test(i.charAt(N))?(P=i.charAt(N),N++):(P=s,ve===0&&Ae(it)),P!==s?(Je=y,y=Ti()):(N=y,y=s),Te[Q]={nextPos:N,result:y},y)}function _r(){var y,P,Q,K=N*41+3,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,i.charCodeAt(N)===45?N++:ve===0&&Ae(mt),P=[],De.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(it)),Q!==s)for(;Q!==s;)P.push(Q),De.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(it));else P=s;return P!==s?(Je=y,y=q()):(N=y,y=s),Te[K]={nextPos:N,result:y},y}function ri(){var y,P,Q=N*41+4,K=Te[Q];return K?(N=K.nextPos,K.result):(ve++,y=N,Ze.test(i.charAt(N))?(P=i.charAt(N),N++):(P=s,ve===0&&Ae(st)),P!==s&&(Je=y,P=ie()),y=P,ve--,y===s&&(P=s,ve===0&&Ae(Nt)),Te[Q]={nextPos:N,result:y},y)}function Ho(){var y,P,Q=N*41+9,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,Ve.test(i.charAt(N))?(P=i.charAt(N),N++):(P=s,ve===0&&Ae(pt)),P!==s&&(Je=y,P=de()),y=P,Te[Q]={nextPos:N,result:y},y)}function ni(){var y,P=N*41+10,Q=Te[P];return Q?(N=Q.nextPos,Q.result):(y=Ho(),y===s&&(y=sr()),Te[P]={nextPos:N,result:y},y)}function Zi(){var y,P,Q,K=N*41+11,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,P=[],Q=C(),Q===s&&(Q=Ds(),Q===s&&(Q=ks(),Q===s&&(Q=Ki(),Q===s&&(Q=xs(),Q===s&&(Q=Ji(),Q===s&&(Q=d())))))),Q!==s)for(;Q!==s;)P.push(Q),Q=C(),Q===s&&(Q=Ds(),Q===s&&(Q=ks(),Q===s&&(Q=Ki(),Q===s&&(Q=xs(),Q===s&&(Q=Ji(),Q===s&&(Q=d()))))));else P=s;return P!==s&&(Je=y,P=ge(P)),y=P,Te[K]={nextPos:N,result:y},y}function Ki(){var y,P,Q,K,oe,me=N*41+12,we=Te[me];return we?(N=we.nextPos,we.result):(y=N,i.charCodeAt(N)===40?(P=b,N++):(P=s,ve===0&&Ae(We)),P!==s?(i.charCodeAt(N)===58?N++:ve===0&&Ae(hr),Q=Zi(),Q!==s?(K=Wo(),K===s&&(K=null),i.charCodeAt(N)===41?(oe=R,N++):(oe=s,ve===0&&Ae(qt)),oe!==s?(Je=y,y=Ce(Q,K)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[me]={nextPos:N,result:y},y)}function Wo(){var y,P,Q,K=N*41+13,oe=Te[K];return oe?(N=oe.nextPos,oe.result):(y=N,i.charCodeAt(N)===58?(P=A,N++):(P=s,ve===0&&Ae(hr)),P!==s?(Q=_r(),Q!==s?(Je=y,y=qe(Q)):(N=y,y=s)):(N=y,y=s),Te[K]={nextPos:N,result:y},y)}function Ds(){var y,P,Q,K,oe=N*41+14,me=Te[oe];return me?(N=me.nextPos,me.result):(y=N,P=Ki(),P!==s?(Q=Ms(),Q!==s?(K=Ki(),K!==s?(Je=y,y=Be(P,Q,K)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[oe]={nextPos:N,result:y},y)}function xs(){var y,P,Q,K,oe,me=N*41+15,we=Te[me];return we?(N=we.nextPos,we.result):(y=N,i.substr(N,2)===k?(P=k,N+=2):(P=s,ve===0&&Ae(fr)),P!==s?(Q=Zi(),Q!==s?(K=Wo(),K===s&&(K=null),i.charCodeAt(N)===93?(oe=Y,N++):(oe=s,ve===0&&Ae(W)),oe!==s?(Je=y,y=At(Q,K)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[me]={nextPos:N,result:y},y)}function ks(){var y,P,Q,K,oe=N*41+16,me=Te[oe];return me?(N=me.nextPos,me.result):(y=N,i.charCodeAt(N)===91?(P=Z,N++):(P=s,ve===0&&Ae(_e)),P!==s?(Q=Zi(),Q!==s?(i.charCodeAt(N)===93?(K=Y,N++):(K=s,ve===0&&Ae(W)),K!==s?(Je=y,y=Cr(Q)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[oe]={nextPos:N,result:y},y)}function ji(){var y,P=N*41+17,Q=Te[P];return Q?(N=Q.nextPos,Q.result):(y=_r(),y===s&&(y=ti()),Te[P]={nextPos:N,result:y},y)}function Ba(){var y,P,Q,K=N*41+18,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,P=[],Q=Ls(),Q===s&&(Q=ji()),Q!==s)for(;Q!==s;)P.push(Q),Q=Ls(),Q===s&&(Q=ji());else P=s;return P!==s&&(Je=y,P=Fr(P)),y=P,Te[K]={nextPos:N,result:y},y}function Ls(){var y,P,Q,K,oe=N*41+19,me=Te[oe];return me?(N=me.nextPos,me.result):(y=N,i.charCodeAt(N)===40?N++:ve===0&&Ae(We),P=ji(),P!==s?(Q=Ms(),Q!==s?(K=Ba(),K!==s?(i.charCodeAt(N)===41?N++:ve===0&&Ae(qt),Je=y,y=Aa()):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[oe]={nextPos:N,result:y},y)}function Xo(){var y,P,Q,K,oe=N*41+20,me=Te[oe];if(me)return N=me.nextPos,me.result;if(y=N,i.charCodeAt(N)===123?(P=h,N++):(P=s,ve===0&&Ae(Le)),P!==s){if(Q=[],K=Ba(),K===s&&(K=ri()),K!==s)for(;K!==s;)Q.push(K),K=Ba(),K===s&&(K=ri());else Q=s;Q!==s?(i.charCodeAt(N)===125?(K=E,N++):(K=s,ve===0&&Ae(xe)),K!==s?(Je=y,y=Wi(Q)):(N=y,y=s)):(N=y,y=s)}else N=y,y=s;return Te[oe]={nextPos:N,result:y},y}function Ms(){var y,P=N*41+21,Q=Te[P];return Q?(N=Q.nextPos,Q.result):(i.charCodeAt(N)===43?(y=S,N++):(y=s,ve===0&&Ae(rt)),y===s&&(i.charCodeAt(N)===45?(y=u,N++):(y=s,ve===0&&Ae(mt)),y===s&&(i.charCodeAt(N)===42?(y=I,N++):(y=s,ve===0&&Ae(Ne)),y===s&&(i.charCodeAt(N)===47?(y=x,N++):(y=s,ve===0&&Ae($t)),y===s&&(i.charCodeAt(N)===37?(y=w,N++):(y=s,ve===0&&Ae(ht)),y===s&&(i.charCodeAt(N)===94?(y=L,N++):(y=s,ve===0&&Ae(Ot)),y===s&&(i.charCodeAt(N)===124?(y=_,N++):(y=s,ve===0&&Ae(Tr)),y===s&&(i.charCodeAt(N)===38?(y=G,N++):(y=s,ve===0&&Ae(Jr)),y===s&&(i.substr(N,2)===te?(y=te,N+=2):(y=s,ve===0&&Ae(gt)),y===s&&(i.substr(N,2)===ne?(y=ne,N+=2):(y=s,ve===0&&Ae(Zt))))))))))),Te[P]={nextPos:N,result:y},y)}function Ji(){var y,P,Q=N*41+22,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,P=U(),P===s&&(P=ye(),P===s&&(P=ae(),P===s&&(P=Se(),P===s&&(P=z(),P===s&&(P=B(),P===s&&(P=f(),P===s&&(P=ri(),P===s&&(P=D(),P===s&&(P=O(),P===s&&(P=v(),P===s&&(P=Ki(),P===s&&(P=Xo(),P===s&&(P=$c()))))))))))))),P!==s&&(Je=y,P=Ts(P)),y=P,Te[Q]={nextPos:N,result:y},y)}function $c(){var y,P,Q=N*41+23,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,i.charCodeAt(N)===124?(P=_,N++):(P=s,ve===0&&Ae(Tr)),P!==s&&(Je=y,P=Yr()),y=P,Te[Q]={nextPos:N,result:y},y)}function d(){var y,P,Q,K,oe=N*41+24,me=Te[oe];return me?(N=me.nextPos,me.result):(y=N,i.charCodeAt(N)===60?(P=re,N++):(P=s,ve===0&&Ae(yt)),P!==s?(Q=Zi(),Q!==s?(i.charCodeAt(N)===62?(K=ee,N++):(K=s,ve===0&&Ae($e)),K!==s?(Je=y,y=vs(Q)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[oe]={nextPos:N,result:y},y)}function f(){var y,P,Q=N*41+25,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,P=g(),P!==s&&(Je=y,P=Ra(P)),y=P,Te[Q]={nextPos:N,result:y},y)}function g(){var y,P,Q,K=N*41+26,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,P=[],i.charCodeAt(N)===94?(Q=L,N++):(Q=s,ve===0&&Ae(Ot)),Q===s&&(i.charCodeAt(N)===95?(Q=M,N++):(Q=s,ve===0&&Ae(vr))),Q!==s)for(;Q!==s;)P.push(Q),i.charCodeAt(N)===94?(Q=L,N++):(Q=s,ve===0&&Ae(Ot)),Q===s&&(i.charCodeAt(N)===95?(Q=M,N++):(Q=s,ve===0&&Ae(vr)));else P=s;return P!==s&&(Je=y,P=Ia()),y=P,Te[K]={nextPos:N,result:y},y}function O(){var y,P,Q=N*41+27,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,i.charCodeAt(N)===63?(P=$,N++):(P=s,ve===0&&Ae(jn)),P!==s&&(Je=y,P=Cs()),y=P,Te[Q]={nextPos:N,result:y},y)}function v(){var y,P,Q,K,oe,me,we=N*41+28,ut=Te[we];return ut?(N=ut.nextPos,ut.result):(y=N,i.charCodeAt(N)===40?(P=b,N++):(P=s,ve===0&&Ae(We)),P!==s?(Q=ti(),Q!==s?(i.charCodeAt(N)===44?(K=m,N++):(K=s,ve===0&&Ae(Ge)),K!==s?(oe=ti(),oe!==s?(i.charCodeAt(N)===41?(me=R,N++):(me=s,ve===0&&Ae(qt)),me!==s?(Je=y,y=Na(Q,oe)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[we]={nextPos:N,result:y},y)}function C(){var y,P,Q,K,oe,me,we=N*41+29,ut=Te[we];return ut?(N=ut.nextPos,ut.result):(y=N,P=Ji(),P!==s?(i.charCodeAt(N)===58?(Q=A,N++):(Q=s,ve===0&&Ae(hr)),Q!==s?(K=_r(),K!==s?(oe=N,ve++,i.charCodeAt(N)===41?(me=R,N++):(me=s,ve===0&&Ae(qt)),me===s&&(i.charCodeAt(N)===93?(me=Y,N++):(me=s,ve===0&&Ae(W))),ve--,me===s?oe=void 0:(N=oe,oe=s),oe!==s?(Je=y,y=ys(P,K)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[we]={nextPos:N,result:y},y)}function D(){var y,P,Q=N*41+30,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,P=ni(),P!==s&&(Je=y,P=wa(P)),y=P,Te[Q]={nextPos:N,result:y},y)}function U(){var y,P,Q,K=N*41+31,oe=Te[K];return oe?(N=oe.nextPos,oe.result):(y=N,P=ni(),P===s&&(P=null),i.charCodeAt(N)===114?(Q=j,N++):(Q=s,ve===0&&Ae(ft)),Q!==s?(Je=y,y=kr(P)):(N=y,y=s),Te[K]={nextPos:N,result:y},y)}function B(){var y,P,Q,K,oe,me=N*41+32,we=Te[me];return we?(N=we.nextPos,we.result):(y=N,P=g(),P===s&&(P=null),Q=ni(),Q===s&&(Q=null),K=H(),K===s&&(K=null),oe=ti(),oe!==s?(Je=y,y=As(P,Q,K,oe)):(N=y,y=s),Te[me]={nextPos:N,result:y},y)}function H(){var y,P,Q,K=N*41+33,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,P=[],i.charCodeAt(N)===35?(Q=X,N++):(Q=s,ve===0&&Ae(xr)),Q===s&&(i.charCodeAt(N)===98?(Q=ce,N++):(Q=s,ve===0&&Ae(mr))),Q!==s)for(;Q!==s;)P.push(Q),i.charCodeAt(N)===35?(Q=X,N++):(Q=s,ve===0&&Ae(xr)),Q===s&&(i.charCodeAt(N)===98?(Q=ce,N++):(Q=s,ve===0&&Ae(mr)));else P=s;return P!==s&&(Je=y,P=Rs(P)),y=P,Te[K]={nextPos:N,result:y},y}function z(){var y,P,Q,K,oe,me=N*41+34,we=Te[me];if(we)return N=we.nextPos,we.result;if(y=N,P=g(),P===s&&(P=null),Q=B(),Q!==s){if(K=[],oe=B(),oe!==s)for(;oe!==s;)K.push(oe),oe=B();else K=s;K!==s?(oe=he(),oe===s&&(oe=null),Je=y,y=Da(P,Q,K,oe)):(N=y,y=s)}else N=y,y=s;return Te[me]={nextPos:N,result:y},y}function pe(){var y,P,Q,K=N*41+35,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,P=[],et.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(Oi)),Q!==s)for(;Q!==s;)P.push(Q),et.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(Oi));else P=s;return P!==s&&(Je=y,P=xa()),y=P,Te[K]={nextPos:N,result:y},y}function he(){var y,P,Q,K=N*41+36,oe=Te[K];return oe?(N=oe.nextPos,oe.result):(y=N,i.charCodeAt(N)===37?(P=w,N++):(P=s,ve===0&&Ae(ht)),P!==s?(Q=_r(),Q!==s?(Je=y,y=Is(Q)):(N=y,y=s)):(N=y,y=s),Te[K]={nextPos:N,result:y},y)}function se(){var y,P,Q=N*41+37,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,nt.test(i.charAt(N))?(P=i.charAt(N),N++):(P=s,ve===0&&Ae(Rn)),P!==s?(Ke.test(i.charAt(N))?(i.charAt(N),N++):ve===0&&Ae(Qt),Je=y,y=ka()):(N=y,y=s),Te[Q]={nextPos:N,result:y},y)}function ae(){var y,P,Q,K,oe,me,we=N*41+38,ut=Te[we];return ut?(N=ut.nextPos,ut.result):(y=N,P=g(),P===s&&(P=null),Q=ni(),Q===s&&(Q=null),K=se(),K!==s?(i.charCodeAt(N)===94?N++:ve===0&&Ae(Ot),oe=pe(),oe!==s?(me=he(),me===s&&(me=null),Je=y,y=Ns(P,Q,K,oe,me)):(N=y,y=s)):(N=y,y=s),Te[we]={nextPos:N,result:y},y)}function ye(){var y,P,Q,K,oe,me,we=N*41+39,ut=Te[we];return ut?(N=ut.nextPos,ut.result):(y=N,P=g(),P===s&&(P=null),Q=ni(),Q===s&&(Q=null),i.substr(N,3)===le?(K=le,N+=3):(K=s,ve===0&&Ae(hn)),K===s&&(i.substr(N,2)===Oe?(K=Oe,N+=2):(K=s,ve===0&&Ae(zi)),K===s&&(i.substr(N,2)===ke?(K=ke,N+=2):(K=s,ve===0&&Ae(Ei)),K===s&&(i.charCodeAt(N)===105?(K=Me,N++):(K=s,ve===0&&Ae(Hi)),K===s&&(i.substr(N,3)===Ee?(K=Ee,N+=3):(K=s,ve===0&&Ae(en)),K===s&&(i.substr(N,2)===Ie?(K=Ie,N+=2):(K=s,ve===0&&Ae(Jn)),K===s&&(i.charCodeAt(N)===118?(K=ue,N++):(K=s,ve===0&&Ae(fn)))))))),K!==s?(i.charCodeAt(N)===94?N++:ve===0&&Ae(Ot),oe=pe(),oe===s&&(oe=null),me=he(),me===s&&(me=null),Je=y,y=La(P,Q,K,oe,me)):(N=y,y=s),Te[we]={nextPos:N,result:y},y)}function Se(){var y,P,Q,K,oe=N*41+40,me=Te[oe];return me?(N=me.nextPos,me.result):(y=N,P=g(),P===s&&(P=null),Q=ni(),Q===s&&(Q=null),K=se(),K!==s?(Je=y,y=ws(P,Q,K)):(N=y,y=s),Te[oe]={nextPos:N,result:y},y)}var ze=a.nodeOptions||{};function Pe(y,P,Q=void 0){P.text=Q||gr(),P.location=Ma();for(var K in ze)(P[K]===void 0||P[K]===null)&&(P[K]=ze[K]);return new y(P)}if(vi=c(),vi!==s&&N===i.length)return vi;throw vi!==s&&Ne.collect("pitch"))}notes(){return this.evaluated.map(e=>e.collect("note"))}freqs(){return this.evaluated.map(e=>e.collect("freq"))}durations(){return this.evaluated.map(e=>e.collect("duration"))}retrograde(){return this.evaluated=this.evaluated.reverse(),this}scale(e){return this.applyOptions({scale:e}),this}key(e){return this.applyOptions({key:e}),this}octave(e){return this.applyOptions({octave:e}),this}invert(e){return this.applyOptions({inversion:e}),this}isInOptions(e,t){return this.options.nodeOptions&&this.options.nodeOptions[e]===t}atLast(){return this.index+1>=this.evaluated.length*this.redo}clone(){return zn(this)}notStarted(){return this.index<0}peek(){return this.evaluated[this.index-1||0]}hasStarted(){return this.index>=0}next(){this.index<0&&(this.index=0);const e=this.evaluated[this.index%this.evaluated.length];return this.index++,this.counter++,this.redo>0&&this.index>=this.evaluated.length*this.redo&&(this.index=0,this.evaluated=this.evaluate(this.values)),e}applyOptions(e={}){this.evaluated=this.evaluate(this.evaluated,e),this.applyTransformations()}applyTransformations(){var e;(e=this.globalOptions)!=null&&e.retrograde&&(this.evaluated=this.evaluated.reverse())}update(){return this.evaluated=this.evaluate(this.values),this.applyTransformations(),this}evaluate(e,t={}){let r=e.map(i=>i.evaluate(t)).flat(1/0).filter(i=>i!==void 0);if(t.subdivisions){const i=t.duration?t.duration:WA;r=iR(r,i)}return r}totalDuration(){return this.evaluated.reduce((t,r)=>t+r.collect("duration"),0)}lead(){let e=this.evaluated.findIndex(t=>t instanceof va);if(e>=0){for(let t=e+1;t<=this.evaluated.length;t++)if(this.evaluated[t]instanceof va){const r=this.evaluated[e],i=this.evaluated[t],a=xP(r.notes(),i.notes()),s=zn(i);s.voiceLeadFromNotes(a,this.options.nodeOptions),this.evaluated[t]=s,e=t}}return this}}const iR=(n,e)=>{const t=n.length,r=e/t;return n.map(a=>a instanceof KA?iR(a.items,r):(a.duration=r,a)).flat(1/0)},MP=n=>{let e={};return lP.forEach(t=>{if(n[t]!==void 0){const r=n[t];e[t]=r,delete n[t]}}),e};class PP{constructor(){T(this,"midiAccess",null);T(this,"midiOutputs",[]);T(this,"currentOutputIndex",0);T(this,"scheduledNotes",{});this.initializeMidiAccess()}async initializeMidiAccess(){try{this.midiAccess=await navigator.requestMIDIAccess(),this.midiOutputs=Array.from(this.midiAccess.outputs.values()),this.midiOutputs.length===0&&(console.warn("No MIDI outputs available."),this.currentOutputIndex=-1)}catch(e){console.error("Failed to initialize MIDI:",e)}}getCurrentMidiPort(){return this.midiOutputs.length>0&&this.currentOutputIndex>=0&&this.currentOutputIndex0&&this.currentOutputIndex>=0&&this.currentOutputIndex=this.midiOutputs.length?(console.error(`Invalid MIDI output index. Index must be in the range 0-${this.midiOutputs.length-1}.`),this.currentOutputIndex):e;{const t=this.midiOutputs.findIndex(r=>r.name===e);return t!==-1?t:(console.error(`MIDI output "${e}" not found.`),this.currentOutputIndex)}}listMidiOutputs(){let e="Available MIDI Outputs: ";return this.midiOutputs.forEach((t,r)=>{e+=`(${r+1}) ${t.name} `}),e}sendMidiNote(e,t,r,i,a=this.currentOutputIndex,s=void 0){typeof a=="string"&&(a=this.getMidiOutputIndex(a));const o=this.midiOutputs[a];if(e=Math.min(Math.max(e,0),127),o){const l=[144+t,e,r],c=[128+t,e,0];o.send(l),s&&this.sendPitchBend(s,t,a);const u=setTimeout(()=>{o.send(c),s&&this.sendPitchBend(8192,t,a),delete this.scheduledNotes[e]},(i-.02)*1e3);this.scheduledNotes[e]=u}else console.error("MIDI output not available.")}sendSysExMessage(e){const t=this.midiOutputs[this.currentOutputIndex];t?t.send(e):console.error("MIDI output not available.")}sendPitchBend(e,t,r=this.currentOutputIndex){(e<0||e>16383)&&console.error("Invalid pitch bend value. Value must be in the range 0-16383."),(t<0||t>15)&&console.error("Invalid MIDI channel. Channel must be in the range 0-15."),typeof r=="string"&&(r=this.getMidiOutputIndex(r));const i=this.midiOutputs[r];if(i){const a=e&127,s=e>>7&127;i.send([224|t,a,s])}else console.error("MIDI output not available.")}sendProgramChange(e,t){const r=this.midiOutputs[this.currentOutputIndex];r?r.send([192+t,e]):console.error("MIDI output not available.")}sendMidiControlChange(e,t,r){const i=this.midiOutputs[this.currentOutputIndex];i?i.send([176+r,e,t]):console.error("MIDI output not available.")}panic(){const e=this.midiOutputs[this.currentOutputIndex];if(e){for(const t in this.scheduledNotes){const r=this.scheduledNotes[t];clearTimeout(r),e.send([128,parseInt(t),0])}this.scheduledNotes={}}else console.error("MIDI output not available.")}}class BP{constructor(e,t,r){T(this,"min");T(this,"max");T(this,"wrap");T(this,"position");this.min=e,this.max=t,this.wrap=r,this.position=0}step(){const e=Math.floor(Math.random()*3)-1;this.position+=e,this.wrap?this.position>this.max?this.position=this.min:this.positionthis.max&&(this.position=this.max)}getPosition(){return this.position}toggleWrap(e){this.wrap=e}}class Bg{constructor(e){T(this,"seedValue");T(this,"randomGen",Math.random);T(this,"app");T(this,"values",{});T(this,"odds",(e,t)=>this.randomGen()this);T(this,"almostNever",e=>this.odds(.025,e));T(this,"rarely",e=>this.odds(.1,e));T(this,"scarcely",e=>this.odds(.25,e));T(this,"sometimes",e=>this.odds(.5,e));T(this,"often",e=>this.odds(.75,e));T(this,"frequently",e=>this.odds(.9,e));T(this,"almostAlways",e=>this.odds(.985,e));T(this,"always",e=>this.modify(e));T(this,"modify",e=>e(this));T(this,"seed",e=>(this.seedValue=e.toString(),this.randomGen=this.app.api.localSeededRandom(this.seedValue),this));T(this,"clear",()=>(this.app.api.clearLocalSeed(this.seedValue),this));T(this,"apply",e=>this.modify(e));T(this,"length",e=>(this.values.length=e,this));this.app=e,this.app.api.currentSeed&&(this.randomGen=this.app.api.randomGen)}}class aR extends Bg{constructor(t){super(t);T(this,"octave",t=>(this.values.octave=t,this.update(),this));T(this,"key",t=>(this.values.key=t,this.update(),this));T(this,"scale",t=>(xg(t)?(this.values.scaleName=t,this.values.parsedScale=hi(t)):this.values.parsedScale=kg(t),this.update(),this));T(this,"freq",t=>{this.values.freq=t;const r=fP(t);return r%1!==0?(this.values.note=Math.floor(r),this.values.bend=jA(r)[1]):this.values.note=r,this});T(this,"update",()=>{})}}let Ar=[],UP=(n,e)=>{let t,r=[],i={lc:0,l:e||0,value:n,set(a){i.value=a,i.notify()},get(){return i.lc||i.listen(()=>{})(),i.value},notify(a){t=r;let s=!Ar.length;for(let o=0;o{r===t&&(r=r.slice());let o=r.indexOf(a);~o&&(r.splice(o,2),i.lc--,i.lc||i.off())}},subscribe(a,s){let o=i.listen(a,s);return a(i.value),o},off(){}};return i},FP=(n={})=>{let e=UP(n);return e.setKey=function(t,r){typeof r>"u"?t in e.value&&(e.value={...e.value},delete e.value[t],e.notify(t)):e.value[t]!==r&&(e.value={...e.value,[t]:r},e.notify(t))},e};if(typeof DelayNode<"u"){class n extends DelayNode{constructor(t,r,i,a){super(t),r=Math.abs(r),this.delayTime.value=i;const s=t.createGain();s.gain.value=Math.min(Math.abs(a),.995),this.feedback=s.gain;const o=t.createGain();return o.gain.value=r,this.delayGain=o,this.connect(s),this.connect(o),s.connect(this),this.connect=l=>o.connect(l),this}start(t){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,t+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(e,t,r){return new n(this,e,t,r)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(n,e=1){const t=this.sampleRate*n,r=this.createBuffer(e,t,this.sampleRate),i=r.getChannelData(0);for(let a=0;a(e.buffer=this.impulseResponse(t),e.duration=n,e),e.setDuration(n),e});var VO={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class n extends GainNode{constructor(t,r){if(super(t),!VO[r])throw new Error("vowel: unknown vowel "+r);const{gains:i,qs:a,freqs:s}=VO[r],o=t.createGain();for(let l=0;l<5;l++){const c=t.createGain();c.gain.value=i[l];const u=t.createBiquadFilter();u.type="bandpass",u.Q.value=a[l],u.frequency.value=s[l],this.connect(u),u.connect(c),c.connect(o)}return o.gain.value=8,this.connect=l=>o.connect(l),this}}AudioContext.prototype.createVowelFilter=function(e){return new n(this,e)}}const YP=n=>{var i;if(typeof n!="string")return[];const[e,t="",r]=((i=n.match(/^([a-gA-G])([#bsf]*)([0-9]*)$/))==null?void 0:i.slice(1))||[];return e?[e,t,r?Number(r):void 0]:[]},GP={c:0,d:2,e:4,f:5,g:7,a:9,b:11},$P={"#":1,b:-1,s:1,f:-1},Uc=(n,e=3)=>{const[t,r,i=e]=YP(n);if(!t)throw new Error('not a note: "'+n+'"');const a=GP[t.toLowerCase()],s=(r==null?void 0:r.split("").reduce((o,l)=>o+$P[l],0))||0;return(Number(i)+1)*12+a+s},sR=n=>Math.pow(2,(n-69)/12)*440,Tm=(n,e,t)=>Math.min(Math.max(n,e),t),QP=n=>12*Math.log(n/440)/Math.LN2+69,qP=(n,e)=>{if(typeof n!="object")throw new Error("valueToMidi: expected object value");let{freq:t,note:r}=n;if(typeof t=="number")return QP(t);if(typeof r=="string")return Uc(r);if(typeof r=="number")return r;if(!e)throw new Error("valueToMidi: expected freq or note to be set");return e},VP="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgY29uc3Qgb3V0cHV0ID0gb3V0cHV0c1swXTsKICAgIGNvbnN0IGNvYXJzZSA9IHBhcmFtZXRlcnMuY29hcnNlOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBvdXRwdXRbMF1bMF0gPSBpbnB1dFswXVswXTsKICAgICAgZm9yIChsZXQgbiA9IDE7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgIGZvciAobGV0IG8gPSAwOyBvIDwgb3V0cHV0Lmxlbmd0aDsgbysrKSB7CiAgICAgICAgICBvdXRwdXRbb11bbl0gPSBuICUgY29hcnNlID09IDAgPyBpbnB1dFswXVtuXSA6IG91dHB1dFtvXVtuIC0gMV07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ2NvYXJzZS1wcm9jZXNzb3InLCBDb2Fyc2VQcm9jZXNzb3IpOwoKY2xhc3MgQ3J1c2hQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ2NydXNoJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm9jZXNzb3IpOwoKY2xhc3MgU2hhcGVQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ3NoYXBlJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBzaGFwZTAgPSBwYXJhbWV0ZXJzLnNoYXBlWzBdOwogICAgY29uc3Qgc2hhcGUxID0gc2hhcGUwIDwgMSA/IHNoYXBlMCA6IDEuMCAtIDRlLTEwOwogICAgY29uc3Qgc2hhcGUgPSAoMi4wICogc2hhcGUxKSAvICgxLjAgLSBzaGFwZTEpOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK";function gc(n){const e=Ht().createGain();return e.gain.value=n,e}const vm=(n,e,t,r,i,a)=>{const s=Ht().createGain();return s.gain.setValueAtTime(0,a),s.gain.linearRampToValueAtTime(i,a+n),s.gain.linearRampToValueAtTime(t*i,a+n+e),{node:s,stop:o=>{s.gain.setValueAtTime(t*i,o),s.gain.linearRampToValueAtTime(0,o+r)}}},zP=(n,e,t,r,i,a)=>{t=Math.max(.001,t),i=Math.max(.001,i);const s=Ht().createGain();return s.gain.setValueAtTime(1e-4,a),s.gain.exponentialRampToValueAtTime(i,a+n),s.gain.exponentialRampToValueAtTime(t*i,a+n+e),{node:s,stop:o=>{s.gain.exponentialRampToValueAtTime(1e-4,o+r)}}},HP=(n,e,t,r,i,a,s,o,l)=>{const c=s-a,u=a+c,p=a+r*c;n.setValueAtTime(a,o),n.linearRampToValueAtTime(u,o+e),n.linearRampToValueAtTime(p,o+e+t),n.setValueAtTime(p,l),n.linearRampToValueAtTime(a,l+Math.max(i,.1))};function Iu(n,e,t,r,i,a,s,o,l,c,u,p=.5){const m=n.createBiquadFilter();if(m.type=e,m.Q.value=r,m.frequency.value=t,!isNaN(l)&&l!==0){const _=l*p,b=Tm(2**-_*t,0,2e4),A=Tm(2**(l-_)*t,0,2e4);return HP(m.frequency,i,a,s,o,b,A,c,u),m}return m}let WP=n=>console.log(n);const _s=(...n)=>WP(...n),Ug=FP();function Fg(n,e,t={}){Ug.setKey(n,{onTrigger:e,data:t})}function zO(n){return Ug.get()[n]}let Nu;const Ht=()=>(Nu||(Nu=new AudioContext),Nu);let Ol;const Yg=()=>{const n=Ht();return Ol||(Ol=n.createGain(),Ol.connect(n.destination)),Ol};let wu;function XP(){return wu||(wu=Ht().audioWorklet.addModule(VP),wu)}function Du(n,e,t){const r=new AudioWorkletNode(n,e);return Object.entries(t).forEach(([i,a])=>{r.parameters.get(i).value=a}),r}async function ZP(n={}){const{disableWorklets:e=!1}=n;typeof window<"u"&&(await Ht().resume(),e?console.log("disableWorklets: AudioWorklet effects coarse, crush and shape are skipped!"):await XP().catch(t=>{console.warn("could not load AudioWorklet effects coarse, crush and shape",t)}))}async function KP(n){return new Promise(e=>{document.addEventListener("click",async function t(){await ZP(n),e(),document.removeEventListener("click",t)})})}let ra={};function jP(n,e,t,r){var i;if(t=Tm(t,0,.98),!ra[n]){const a=Ht().createFeedbackDelay(1,e,t);(i=a.start)==null||i.call(a,r),a.connect(Yg()),ra[n]=a}return ra[n].delayTime.value!==e&&ra[n].delayTime.setValueAtTime(e,r),ra[n].feedback.value!==t&&ra[n].feedback.setValueAtTime(t,r),ra[n]}let na={};function JP(n,e=2){if(!na[n]){const t=Ht().createReverb(e);t.connect(Yg()),na[n]=t}return na[n].duration!==e&&(na[n]=na[n].setDuration(e),na[n].duration=e),na[n]}let ia;function e3(n=2048){if(!ia){const e=Ht().createAnalyser();e.fftSize=n,ia=e,new Float32Array(ia.frequencyBinCount)}return ia.fftSize!==n&&(ia.fftSize=n,new Float32Array(ia.frequencyBinCount)),ia}function xu(n,e,t){const r=gc(t);return n.connect(r),r.connect(e),r}const HO=async(n,e,t)=>{const r=Ht();if(typeof n!="object")throw new Error(`expected hap.value to be an object, but got "${n}". Hint: append .note() or .s() to the end`,"error");n.duration=t;let i=r.currentTime+e,{s:a="triangle",bank:s,source:o,gain:l=.8,ftype:c="12db",fanchor:u=.5,cutoff:p,lpenv:m,lpattack:_=.01,lpdecay:b=.01,lpsustain:A=1,lprelease:R=.01,resonance:k=1,hpenv:Y,hcutoff:Z,hpattack:h=.01,hpdecay:E=.01,hpsustain:S=1,hprelease:I=.01,hresonance:x=1,bpenv:w,bandf:L,bpattack:G=.01,bpdecay:te=.01,bpsustain:ne=1,bprelease:re=.01,bandq:ee=1,coarse:M,crush:$,shape:j,pan:X,vowel:ce,delay:le=0,delayfeedback:Oe=.5,delaytime:ke=.25,orbit:Me=1,room:Ee,size:Ie=2,velocity:ue=1,analyze:De,fft:Ze=8}=n;l*=ue;let Ve=[];const et=()=>{Ve.forEach(st=>st==null?void 0:st.disconnect())};s&&a&&(a=`${s}_${a}`);let nt;if(o)nt=o(i,n,t);else if(zO(a)){const{onTrigger:st}=zO(a),Ge=await st(i,n,et);Ge&&(nt=Ge.node,Ge.stop(i+t))}else throw new Error(`sound ${a} not found! Is it loaded?`);if(!nt)return;if(r.currentTime>i){_s("[webaudio] skip hap: still loading",r.currentTime-i);return}const Ke=[];if(Ke.push(nt),Ke.push(gc(l)),p!==void 0){let st=()=>Iu(r,"lowpass",p,k,_,b,A,R,m,i,i+t,u);Ke.push(st()),c==="24db"&&Ke.push(st())}if(Z!==void 0){let st=()=>Iu(r,"highpass",Z,x,h,E,S,I,Y,i,i+t,u);Ke.push(st()),c==="24db"&&Ke.push(st())}if(L!==void 0){let st=()=>Iu(r,"bandpass",L,ee,G,te,ne,re,w,i,i+t,u);Ke.push(st()),c==="24db"&&Ke.push(st())}if(ce!==void 0){const st=r.createVowelFilter(ce);Ke.push(st)}if(M!==void 0&&Ke.push(Du(r,"coarse-processor",{coarse:M})),$!==void 0&&Ke.push(Du(r,"crush-processor",{crush:$})),j!==void 0&&Ke.push(Du(r,"shape-processor",{shape:j})),X!==void 0){const st=r.createStereoPanner();st.pan.value=2*X-1,Ke.push(st)}const mt=gc(1);Ke.push(mt),mt.connect(Yg());let it;if(le>0&&ke>0&&Oe>0){const st=jP(Me,ke,Oe,i);it=xu(mt,st,le)}let Ct;if(Ee>0&&Ie>0){const st=JP(Me,Ie);Ct=xu(mt,st,Ee)}let Nt;if(De){const st=e3(2**(Ze+5));Nt=xu(mt,st,De)}Ke.slice(1).reduce((st,Ge)=>st.connect(Ge),Ke[0]),Ve=Ke.concat([it,Ct,Nt])},ku={};function t3(n,e){var t=e?1e3:1024;if(n=t);return n.toFixed(1)+" "+r[i]}const r3=async(n,e,t,r,i,a,s)=>{let o=0;i!==void 0&&t!==void 0&&_s("[sampler] hap has note and freq. ignoring note","warning");let l=qP({freq:i,note:t},36);o=l-36;const c=Ht();let u;if(Array.isArray(a))u=a[e%a.length];else{const b=R=>Uc(R)-l,A=Object.keys(a).filter(R=>!R.startsWith("_")).reduce((R,k,Y)=>!R||Math.abs(b(k)){const i=t?`sound "${t}:${r}"`:"sample";if(!ku[n]){_s(`[sampler] load ${i}..`,"load-sample",{url:n});const a=Date.now();ku[n]=fetch(n).then(s=>s.arrayBuffer()).then(async s=>{const o=Date.now()-a,l=t3(s.byteLength);return _s(`[sampler] load ${i}... done! loaded ${l} in ${o}ms`,"loaded-sample",{url:n}),await e.decodeAudioData(s)})}return ku[n]};function i3(n){const e=Ht(),t=e.createBuffer(n.numberOfChannels,n.length,e.sampleRate);for(let r=0;rObject.entries(n).forEach(([r,i])=>{if(typeof i=="string"&&(i=[i]),typeof i!="object")throw new Error("wrong sample map format for "+r);t=i._base||t;const a=s=>(t+s).replace("github:","https://raw.githubusercontent.com/");Array.isArray(i)?i=i.map(a):i=Object.fromEntries(Object.entries(i).map(([s,o])=>[s,(typeof o=="string"?[o]:o).map(a)])),e(r,i)});let s3={};function o3(n){const e=Object.entries(s3).find(([t])=>n.startsWith(t));if(e)return e[1]}const za=async(n,e=n._base||"",t={})=>{if(typeof n=="string"){const a=o3(n);if(a)return a(n);if(n.startsWith("github:")){let[o,l]=n.split("github:");l=l.endsWith("/")?l.slice(0,-1):l,n=`https://raw.githubusercontent.com/${l}/strudel.json`}if(typeof fetch!="function")return;const s=n.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(n).then(o=>o.json()).then(o=>za(o,e||o._base||s,t)).catch(o=>{throw console.error(o),new Error(`error loading "${n}"`)})}const{prebake:r,tag:i}=t;a3(n,(a,s)=>Fg(a,(o,l,c)=>l3(o,l,c,s),{type:"sample",samples:s,baseUrl:e,prebake:r,tag:i}),e)},WO=[];async function l3(n,e,t,r,i){let{s:a,freq:s,unit:o,nudge:l=0,cut:c,loop:u,clip:p=void 0,n:m=0,note:_,speed:b=1,loopBegin:A=0,begin:R=0,loopEnd:k=1,end:Y=1}=e;if(b===0)return;u=a.startsWith("wt_")?1:e.loop;const Z=Ht(),{attack:h=.001,decay:E=.001,sustain:S=1,release:I=.001}=e,x=n+l,w=await r3(a,m,_,b,s,r,i);if(Z.currentTime>n){_s(`[sampler] still loading sound "${a}:${m}"`,"highlight");return}if(!w){_s(`[sampler] could not load "${a}:${m}"`,"error");return}w.playbackRate.value=Math.abs(b)*w.playbackRate.value,o==="c"&&(w.playbackRate.value=w.playbackRate.value*w.buffer.duration*1);const L=R*w.buffer.duration;u&&(w.loop=!0,w.loopStart=A*w.buffer.duration-L,w.loopEnd=k*w.buffer.duration-L),w.start(x,L);const{node:G,stop:te}=vm(h,E,S,I,1,n);w.connect(G);const ne=Z.createGain();G.connect(ne),w.onended=function(){w.disconnect(),G.disconnect(),ne.disconnect(),t()};const re={node:ne,bufferSource:w,stop:(ee,M=p===void 0&&u===void 0)=>{let $=ee;if(M){const j=w.buffer.duration/w.playbackRate.value;$=n+(Y-R)*j}w.stop($+I),te($)}};if(c!==void 0){const ee=WO[c];ee&&(ee.node.gain.setValueAtTime(1,x),ee.node.gain.linearRampToValueAtTime(0,x+.01)),WO[c]=re}return re}const c3=(n,e=1,t="sine")=>{const r=Ht(),i=r.createOscillator();i.type=t,i.frequency.value=n,i.start();const a=new GainNode(r,{gain:e});return i.connect(a),{node:a,stop:s=>i.stop(s)}},u3=(n,e,t,r="sine")=>{const i=n.frequency.value*e,a=i*t;return c3(i,a,r)};function d3(){["sine","square","triangle","sawtooth"].forEach(n=>{Fg(n,(e,t,r)=>{let{attack:i=.001,decay:a=.05,sustain:s=.6,release:o=.01,fmh:l=1,fmi:c,fmenv:u="lin",fmattack:p,fmdecay:m,fmsustain:_,fmrelease:b,fmvelocity:A,fmwave:R="sine",vib:k=0,vibmod:Y=.5}=t,{n:Z,note:h,freq:E}=t;h=h||36,typeof h=="string"&&(h=Uc(h)),!E&&typeof h=="number"&&(E=sR(h));const{node:S,stop:I}=h3({t:e,s:n,freq:E,vib:k,vibmod:Y,partials:Z});let x,w;if(c){const{node:ne,stop:re}=u3(S,l,c,R);[p,m,_,b,A].find(ee=>ee!==void 0)?(p=p??.001,m=m??.001,_=_??1,b=b??.001,A=A??1,w=vm(p,m,_,b,A,e),u==="exp"&&(w=zP(p,m,_,b,A,e),w.node.maxValue=c*2,w.node.minValue=1e-5),ne.connect(w.node),w.node.connect(S.frequency)):ne.connect(S.frequency),x=re}const L=gc(.3),{node:G,stop:te}=vm(i,a,s,o,1,e);return S.onended=()=>{S.disconnect(),L.disconnect(),r()},{node:S.connect(L).connect(G),stop:ne=>{te(ne),w==null||w.stop(ne);let re=ne+o;I(re),x==null||x(re)}}},{type:"synth",prebake:!0})})}function p3(n,e){const t=new Float32Array(n+1),r=new Float32Array(n+1),i=Ht(),a=i.createOscillator(),s={sawtooth:c=>1/c,square:c=>c%2===0?0:1/c,triangle:c=>c%2===0?0:1/(c*c)};if(!s[e])throw new Error(`unknown wave type ${e}`);t[0]=0,r[0]=0;let o=1;for(;o<=n;)t[o]=s[e](o),r[o]=0,o++;const l=i.createPeriodicWave(t,r);return a.setPeriodicWave(l),a}function h3({s:n,freq:e,t,vib:r,vibmod:i,partials:a}){let s;!a||n==="sine"?(s=Ht().createOscillator(),s.type=n||"triangle"):s=p3(a,n),s.frequency.value=Number(e),s.start(t);let o;if(r>0){o=Ht().createOscillator(),o.frequency.value=r;const l=Ht().createGain();l.gain.value=i*100,o.connect(l),l.connect(s.detune),o.start(t)}return{node:s,stop:l=>{o==null||o.stop(l),s.stop(l)}}}function f3(n=1,e=.05,t=220,r=0,i=0,a=.1,s=0,o=1,l=0,c=0,u=0,p=0,m=0,_=0,b=0,A=0,R=0,k=1,Y=0,Z=0){let h=Math.PI*2,E=Ht().sampleRate,S=X=>X>0?1:-1,I=l*=500*h/E/E,x=t*=(1+e*2*Math.random()-e)*h/E,w=[],L=0,G=0,te=0,ne=1,re=0,ee=0,M=0,$,j;for(r=r*E+9,Y*=E,i*=E,a*=E,R*=E,c*=500*h/E**3,b*=h/E,u*=h/E,p*=E,m=m*E|0,j=r+Y+i+a+R|0;te1?s>2?s>3?Math.sin((L%h)**3):Math.max(Math.min(Math.tan(L),1),-1):1-(2*L/h%2+2)%2:1-4*Math.abs(Math.round(L/h)-L/h):Math.sin(L),M=(m?1-Z+Z*Math.sin(h*te/m):1)*S(M)*Math.abs(M)**o*n*1*(tete?0:(tep&&(t+=u,x+=u,ne=0),m&&!(++re%m)&&(t=x,l=I,ne||(ne=1));return w}const m3=(n,e)=>{let{s:t,note:r=36,freq:i,zrand:a=0,attack:s=0,decay:o=0,sustain:l=.8,release:c=.1,curve:u=1,slide:p=0,deltaSlide:m=0,pitchJump:_=0,pitchJumpTime:b=0,lfo:A=0,noise:R=0,zmod:k=0,zcrush:Y=0,zdelay:Z=0,tremolo:h=0,duration:E=.2,zzfx:S}=n;const I=Math.max(E-s-o,0);typeof r=="string"&&(r=Uc(r)),!i&&typeof r=="number"&&(i=sR(r)),t=t.replace("z_","");const x=["sine","triangle","sawtooth","tan","noise"].indexOf(t)||0;u=t==="square"?0:u;const w=f3(...S||[.25,a,i,s,I,c,x,u,p,m,_,b,A,R,k,Y,Z,l,o,h]),L=Ht(),G=L.createBuffer(1,w.length,L.sampleRate);G.getChannelData(0).set(w);const te=Ht().createBufferSource();return te.buffer=G,te.start(e),{node:te}};function g3(){["zzfx","z_sine","z_sawtooth","z_triangle","z_square","z_tan","z_noise"].forEach(n=>{Fg(n,(e,t,r)=>{const{node:i}=m3({s:n,...t},e);return i.onended=()=>{i.disconnect(),r()},{node:i,stop:()=>{}}},{type:"synth",prebake:!0})})}class Cm extends aR{constructor(t,r){super(r);T(this,"volume",t=>this.updateValue("volume",t));T(this,"vol",this.volume);T(this,"zrand",t=>this.updateValue("zrand",t));T(this,"curve",t=>this.updateValue("curve",t));T(this,"slide",t=>this.updateValue("slide",t));T(this,"sld",this.slide);T(this,"deltaSlide",t=>this.updateValue("deltaSlide",t));T(this,"dslide",this.deltaSlide);T(this,"pitchJump",t=>this.updateValue("pitchJump",t));T(this,"pj",this.pitchJump);T(this,"pitchJumpTime",t=>this.updateValue("pitchJumpTime",t));T(this,"pjt",this.pitchJumpTime);T(this,"lfo",t=>this.updateValue("lfo",t));T(this,"noise",t=>this.updateValue("noise",t));T(this,"zmod",t=>this.updateValue("zmod",t));T(this,"zcrush",t=>this.updateValue("zcrush",t));T(this,"zdelay",t=>this.updateValue("zdelay",t));T(this,"sustainVolume",t=>this.updateValue("sustainVolume",t));T(this,"tremolo",t=>this.updateValue("tremolo",t));T(this,"dur",t=>this.updateValue("dur",t));T(this,"zzfx",t=>this.updateValue("zzfx",t));T(this,"fmi",t=>this.updateValue("fmi",t));T(this,"fmh",t=>this.updateValue("fmh",t));T(this,"fmenv",t=>this.updateValue("fmenv",t));T(this,"fmattack",t=>this.updateValue("fmattack",t));T(this,"fmatk",this.fmattack);T(this,"fmdecay",t=>this.updateValue("fmdecay",t));T(this,"fmdec",this.fmdecay);T(this,"fmsustain",t=>this.updateValue("fmsustain",t));T(this,"fmsus",this.fmsustain);T(this,"fmrelease",t=>this.updateValue("fmrelease",t));T(this,"fmrel",this.fmrelease);T(this,"fmvelocity",t=>this.updateValue("fmvelocity",t));T(this,"fmvel",this.fmvelocity);T(this,"fmwave",t=>this.updateValue("fmwave",t));T(this,"fmw",this.fmwave);T(this,"ftype",t=>this.updateValue("ftype",t));T(this,"fanchor",t=>this.updateValue("fanchor",t));T(this,"attack",t=>this.updateValue("attack",t));T(this,"atk",this.attack);T(this,"decay",t=>this.updateValue("decay",t));T(this,"dec",this.decay);T(this,"sustain",t=>this.updateValue("sustain",t));T(this,"sus",this.sustain);T(this,"release",t=>this.updateValue("release",t));T(this,"rel",this.release);T(this,"adsr",(t,r,i,a)=>(this.attack(t),this.decay(r),this.sustain(i),this.release(a),this));T(this,"lpenv",t=>this.updateValue("lpenv",t));T(this,"lpe",t=>this.updateValue("lpenv",t));T(this,"lpattack",t=>this.updateValue("lpattack",t));T(this,"lpa",this.lpattack);T(this,"lpdecay",t=>this.updateValue("lpdecay",t));T(this,"lpd",this.lpdecay);T(this,"lpsustain",t=>this.updateValue("lpsustain",t));T(this,"lps",this.lpsustain);T(this,"lprelease",t=>this.updateValue("lprelease",t));T(this,"lpr",this.lprelease);T(this,"cutoff",t=>this.updateValue("cutoff",t));T(this,"lpf",this.cutoff);T(this,"resonance",t=>this.updateValue("resonance",Math.min(Math.max(t,0),50)));T(this,"lpq",this.resonance);T(this,"lpadsr",(t,r,i,a,s)=>(this.lpenv(t),this.lpattack(r),this.lpdecay(i),this.lpsustain(a),this.lprelease(s),this));T(this,"hpenv",t=>this.updateValue("hpenv",t));T(this,"hpe",t=>this.updateValue("hpe",t));T(this,"hpattack",t=>this.updateValue("hpattack",t));T(this,"hpa",this.hpattack);T(this,"hpdecay",t=>this.updateValue("hpdecay",t));T(this,"hpd",this.hpdecay);T(this,"hpsustain",t=>this.updateValue("hpsustain",t));T(this,"hpsus",this.hpsustain);T(this,"hprelease",t=>this.updateValue("hprelease",t));T(this,"hpr",this.hprelease);T(this,"hcutoff",t=>this.updateValue("hcutoff",t));T(this,"hpf",this.hcutoff);T(this,"hresonance",t=>this.updateValue("hresonance",t));T(this,"hpq",this.hresonance);T(this,"hpadsr",(t,r,i,a,s)=>(this.hpenv(t),this.hpattack(r),this.hpdecay(i),this.hpsustain(a),this.hprelease(s),this));T(this,"bpenv",t=>this.updateValue("bpenv",t));T(this,"bpe",t=>this.updateValue("bpe",t));T(this,"bpattack",t=>this.updateValue("bpattack",t));T(this,"bpa",this.bpattack);T(this,"bpdecay",t=>this.updateValue("bpdecay",t));T(this,"bpd",this.bpdecay);T(this,"bpsustain",t=>this.updateValue("bpsustain",t));T(this,"bps",this.bpsustain);T(this,"bprelease",t=>this.updateValue("bprelease",t));T(this,"bpr",this.bprelease);T(this,"bandf",t=>this.updateValue("bandf",t));T(this,"bpf",this.bandf);T(this,"bandq",t=>this.updateValue("bandq",t));T(this,"bpq",this.bandq);T(this,"bpadsr",(t,r,i,a,s)=>(this.bpenv(t),this.bpattack(r),this.bpdecay(i),this.bpsustain(a),this.bprelease(s),this));T(this,"freq",t=>this.updateValue("freq",t));T(this,"f",this.freq);T(this,"vib",t=>this.updateValue("vib",t));T(this,"vibmod",t=>this.updateValue("vibmod",t));T(this,"fm",t=>{if(typeof t=="number")this.values.fmi=t;else{let r=t.split(":");this.values.fmi=parseFloat(r[0]),r.length>1&&(this.values.fmh=parseFloat(r[1]))}return this});T(this,"loop",t=>this.updateValue("loop",t));T(this,"loopBegin",t=>this.updateValue("loopBegin",t));T(this,"loopEnd",t=>this.updateValue("loopEnd",t));T(this,"begin",t=>this.updateValue("begin",t));T(this,"end",t=>this.updateValue("end",t));T(this,"gain",t=>this.updateValue("gain",t));T(this,"dbgain",t=>this.updateValue("gain",Math.min(Math.pow(10,t/20),10)));T(this,"db",this.dbgain);T(this,"velocity",t=>this.updateValue("velocity",t));T(this,"vel",this.velocity);T(this,"pan",t=>this.updateValue("pan",t));T(this,"sound",t=>this.updateValue("s",t));T(this,"chord",(t,...r)=>(typeof t=="string"?t=yP(t).map(a=>({note:a,freq:$n(a)})):t instanceof Array&&typeof t[0]=="number"?t=t.map(i=>({note:i,freq:$n(i)})):typeof t=="number"&&r.length>0&&(t=[t,...r].map(i=>({note:i,freq:$n(i)}))),this.updateValue("chord",t)));T(this,"invert",(t=0)=>{if(this.values.chord){let r=this.values.chord.map(a=>a.note);r=t<0?[...r].reverse():r;for(let a=0;a({note:a,freq:$n(a)}));return this.updateValue("chord",i)}else return this});T(this,"snd",this.sound);T(this,"nudge",t=>this.updateValue("nudge",t));T(this,"cut",t=>this.updateValue("cut",t));T(this,"clip",t=>this.updateValue("clip",t));T(this,"n",t=>this.updateValue("n",t));T(this,"note",t=>typeof t=="string"?this.updateValue("note",Kn(t)):this.updateValue("note",t));T(this,"speed",t=>this.updateValue("speed",t));T(this,"spd",this.speed);T(this,"coarse",t=>this.updateValue("coarse",t));T(this,"crush",t=>this.updateValue("crush",t));T(this,"shape",t=>this.updateValue("shape",t));T(this,"vowel",t=>this.updateValue("vowel",t));T(this,"vow",this.vowel);T(this,"delay",t=>this.updateValue("delay",t));T(this,"del",this.delay);T(this,"delayfeedback",t=>this.updateValue("delayfeedback",t));T(this,"delayfb",this.delayfeedback);T(this,"delaytime",t=>this.updateValue("delaytime",t));T(this,"delayt",this.delaytime);T(this,"orbit",t=>this.updateValue("orbit",t));T(this,"o",this.orbit);T(this,"room",t=>this.updateValue("room",t));T(this,"rm",this.room);T(this,"size",t=>this.updateValue("size",t));T(this,"sz",this.size);T(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});T(this,"update",()=>{const[t,r]=Mg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.freq=$n(t)});T(this,"out",()=>{this.values.chord?this.values.chord.forEach(t=>{const r={...this.values};r.freq=t.freq,HO(r,.25,this.values.dur)}):HO(this.values,.25,this.values.dur)});this.app=r,typeof t=="string"?t.includes(":")?this.values={s:t.split(":")[0],n:t.split(":")[1],dur:r.clock.convertPulseToSecond(r.clock.ppqn)}:this.values={s:t,dur:.5}:this.values=t}updateValue(t,r){return this.values[t]=r,this}}class ym extends aR{constructor(t,r){super(r);T(this,"midiConnection");T(this,"chord",t=>(this.values.chord=t,this));T(this,"note",t=>(this.values.note=t,this));T(this,"sustain",t=>(this.values.sustain=t,this));T(this,"channel",t=>(this.values.channel=t,this));T(this,"port",t=>(this.values.port=this.midiConnection.getMidiOutputIndex(t),this));T(this,"add",t=>(this.values.note+=t,this));T(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});T(this,"bend",t=>(this.values.bend=t,this));T(this,"random",(t=0,r=127)=>(t=Math.min(Math.max(t,0),127),r=Math.min(Math.max(r,0),127),this.values.note=Math.floor(this.randomGen()*(r-t+1))+t,this));T(this,"update",()=>{const[t,r]=Mg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.note=t,this.values.freq=$n(t),r&&(this.values.bend=r)});T(this,"out",()=>{function t(r,i){const a=i.values.channel?i.values.channel:0,s=i.values.velocity?i.values.velocity:100,o=i.values.sustain?i.values.sustain*i.app.clock.pulse_duration*i.app.api.ppqn():i.app.clock.pulse_duration*i.app.api.ppqn(),l=i.values.bend?i.values.bend:void 0,c=i.values.port?i.midiConnection.getMidiOutputIndex(i.values.port):i.midiConnection.getCurrentMidiPortIndex();i.midiConnection.sendMidiNote(r,a,s,o,c,l)}if(this.values.chord)this.values.chord.forEach(r=>{t(r,this)});else{const r=this.values.note?this.values.note:60;t(r,this)}});this.app=r,typeof t=="number"?this.values.note=t:this.values=t,this.midiConnection=r.api.MidiConnection}}const Hs=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,oR=new Set,Am=typeof process=="object"&&process?process:{},lR=(n,e,t,r)=>{typeof Am.emitWarning=="function"?Am.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)};let _c=globalThis.AbortController,XO=globalThis.AbortSignal;var FT;if(typeof _c>"u"){XO=class{constructor(){T(this,"onabort");T(this,"_onabort",[]);T(this,"reason");T(this,"aborted",!1)}addEventListener(r,i){this._onabort.push(i)}},_c=class{constructor(){T(this,"signal",new XO);e()}abort(r){var i,a;if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(const s of this.signal._onabort)s(r);(a=(i=this.signal).onabort)==null||a.call(i,r)}}};let n=((FT=Am.env)==null?void 0:FT.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{n&&(n=!1,lR("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}const _3=n=>!oR.has(n),Ni=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),cR=n=>Ni(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ml:null:null;class Ml extends Array{constructor(e){super(e),this.fill(0)}}var ts;const oa=class oa{constructor(e,t){T(this,"heap");T(this,"length");if(!V(oa,ts))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){const t=cR(e);if(!t)return[];Xe(oa,ts,!0);const r=new oa(e,t);return Xe(oa,ts,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};ts=new WeakMap,ot(oa,ts,!1);let Rm=oa;var _n,Qr,Sn,On,rs,Kt,En,jt,kt,at,Rr,qr,Sr,ir,bn,ar,si,oi,Tn,vn,Mi,Ir,ko,Nm,fa,li,Lo,Vr,Tc,uR,ma,ns,Mo,Pn,wi,Bn,Di,Po,wm,is,Pl,as,Bl,wt,Pt,Bo,Dm,ga,no;const Xg=class Xg{constructor(e){ot(this,ko);ot(this,Tc);ot(this,Pn);ot(this,Bn);ot(this,Po);ot(this,is);ot(this,as);ot(this,wt);ot(this,Bo);ot(this,ga);ot(this,_n,void 0);ot(this,Qr,void 0);ot(this,Sn,void 0);ot(this,On,void 0);ot(this,rs,void 0);T(this,"ttl");T(this,"ttlResolution");T(this,"ttlAutopurge");T(this,"updateAgeOnGet");T(this,"updateAgeOnHas");T(this,"allowStale");T(this,"noDisposeOnSet");T(this,"noUpdateTTL");T(this,"maxEntrySize");T(this,"sizeCalculation");T(this,"noDeleteOnFetchRejection");T(this,"noDeleteOnStaleGet");T(this,"allowStaleOnFetchAbort");T(this,"allowStaleOnFetchRejection");T(this,"ignoreFetchAbort");ot(this,Kt,void 0);ot(this,En,void 0);ot(this,jt,void 0);ot(this,kt,void 0);ot(this,at,void 0);ot(this,Rr,void 0);ot(this,qr,void 0);ot(this,Sr,void 0);ot(this,ir,void 0);ot(this,bn,void 0);ot(this,ar,void 0);ot(this,si,void 0);ot(this,oi,void 0);ot(this,Tn,void 0);ot(this,vn,void 0);ot(this,Mi,void 0);ot(this,Ir,void 0);ot(this,fa,()=>{});ot(this,li,()=>{});ot(this,Lo,()=>{});ot(this,Vr,()=>!1);ot(this,ma,e=>{});ot(this,ns,(e,t,r)=>{});ot(this,Mo,(e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});const{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:l,dispose:c,disposeAfter:u,noDisposeOnSet:p,noUpdateTTL:m,maxSize:_=0,maxEntrySize:b=0,sizeCalculation:A,fetchMethod:R,noDeleteOnFetchRejection:k,noDeleteOnStaleGet:Y,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:h,ignoreFetchAbort:E}=e;if(t!==0&&!Ni(t))throw new TypeError("max option must be a nonnegative integer");const S=t?cR(t):Array;if(!S)throw new Error("invalid max value: "+t);if(Xe(this,_n,t),Xe(this,Qr,_),this.maxEntrySize=b||V(this,Qr),this.sizeCalculation=A,this.sizeCalculation){if(!V(this,Qr)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(R!==void 0&&typeof R!="function")throw new TypeError("fetchMethod must be a function if specified");if(Xe(this,rs,R),Xe(this,Mi,!!R),Xe(this,jt,new Map),Xe(this,kt,new Array(t).fill(void 0)),Xe(this,at,new Array(t).fill(void 0)),Xe(this,Rr,new S(t)),Xe(this,qr,new S(t)),Xe(this,Sr,0),Xe(this,ir,0),Xe(this,bn,Rm.create(t)),Xe(this,Kt,0),Xe(this,En,0),typeof c=="function"&&Xe(this,Sn,c),typeof u=="function"?(Xe(this,On,u),Xe(this,ar,[])):(Xe(this,On,void 0),Xe(this,ar,void 0)),Xe(this,vn,!!V(this,Sn)),Xe(this,Ir,!!V(this,On)),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!k,this.allowStaleOnFetchRejection=!!Z,this.allowStaleOnFetchAbort=!!h,this.ignoreFetchAbort=!!E,this.maxEntrySize!==0){if(V(this,Qr)!==0&&!Ni(V(this,Qr)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ni(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");He(this,Tc,uR).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!Y,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Ni(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Ni(this.ttl))throw new TypeError("ttl must be a positive integer if specified");He(this,ko,Nm).call(this)}if(V(this,_n)===0&&this.ttl===0&&V(this,Qr)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!V(this,_n)&&!V(this,Qr)){const I="LRU_CACHE_UNBOUNDED";_3(I)&&(oR.add(I),lR("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",I,Xg))}}static unsafeExposeInternals(e){return{starts:V(e,oi),ttls:V(e,Tn),sizes:V(e,si),keyMap:V(e,jt),keyList:V(e,kt),valList:V(e,at),next:V(e,Rr),prev:V(e,qr),get head(){return V(e,Sr)},get tail(){return V(e,ir)},free:V(e,bn),isBackgroundFetch:t=>{var r;return He(r=e,wt,Pt).call(r,t)},backgroundFetch:(t,r,i,a)=>{var s;return He(s=e,as,Bl).call(s,t,r,i,a)},moveToTail:t=>{var r;return He(r=e,ga,no).call(r,t)},indexes:t=>{var r;return He(r=e,Pn,wi).call(r,t)},rindexes:t=>{var r;return He(r=e,Bn,Di).call(r,t)},isStale:t=>{var r;return V(r=e,Vr).call(r,t)}}}get max(){return V(this,_n)}get maxSize(){return V(this,Qr)}get calculatedSize(){return V(this,En)}get size(){return V(this,Kt)}get fetchMethod(){return V(this,rs)}get dispose(){return V(this,Sn)}get disposeAfter(){return V(this,On)}getRemainingTTL(e){return V(this,jt).has(e)?1/0:0}*entries(){for(const e of He(this,Pn,wi).call(this))V(this,at)[e]!==void 0&&V(this,kt)[e]!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield[V(this,kt)[e],V(this,at)[e]])}*rentries(){for(const e of He(this,Bn,Di).call(this))V(this,at)[e]!==void 0&&V(this,kt)[e]!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield[V(this,kt)[e],V(this,at)[e]])}*keys(){for(const e of He(this,Pn,wi).call(this)){const t=V(this,kt)[e];t!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield t)}}*rkeys(){for(const e of He(this,Bn,Di).call(this)){const t=V(this,kt)[e];t!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield t)}}*values(){for(const e of He(this,Pn,wi).call(this))V(this,at)[e]!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield V(this,at)[e])}*rvalues(){for(const e of He(this,Bn,Di).call(this))V(this,at)[e]!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield V(this,at)[e])}[Symbol.iterator](){return this.entries()}find(e,t={}){for(const r of He(this,Pn,wi).call(this)){const i=V(this,at)[r],a=He(this,wt,Pt).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,V(this,kt)[r],this))return this.get(V(this,kt)[r],t)}}forEach(e,t=this){for(const r of He(this,Pn,wi).call(this)){const i=V(this,at)[r],a=He(this,wt,Pt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,V(this,kt)[r],this)}}rforEach(e,t=this){for(const r of He(this,Bn,Di).call(this)){const i=V(this,at)[r],a=He(this,wt,Pt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,V(this,kt)[r],this)}}purgeStale(){let e=!1;for(const t of He(this,Bn,Di).call(this,{allowStale:!0}))V(this,Vr).call(this,t)&&(this.delete(V(this,kt)[t]),e=!0);return e}dump(){const e=[];for(const t of He(this,Pn,wi).call(this,{allowStale:!0})){const r=V(this,kt)[t],i=V(this,at)[t],a=He(this,wt,Pt).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||r===void 0)continue;const s={value:a};if(V(this,Tn)&&V(this,oi)){s.ttl=V(this,Tn)[t];const o=Hs.now()-V(this,oi)[t];s.start=Math.floor(Date.now()-o)}V(this,si)&&(s.size=V(this,si)[t]),e.unshift([r,s])}return e}load(e){this.clear();for(const[t,r]of e){if(r.start){const i=Date.now()-r.start;r.start=Hs.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){var m,_,b,A,R;if(t===void 0)return this.delete(e),this;const{ttl:i=this.ttl,start:a,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:l}=r;let{noUpdateTTL:c=this.noUpdateTTL}=r;const u=V(this,Mo).call(this,e,t,r.size||0,o);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.delete(e),this;let p=V(this,Kt)===0?void 0:V(this,jt).get(e);if(p===void 0)p=V(this,Kt)===0?V(this,ir):V(this,bn).length!==0?V(this,bn).pop():V(this,Kt)===V(this,_n)?He(this,is,Pl).call(this,!1):V(this,Kt),V(this,kt)[p]=e,V(this,at)[p]=t,V(this,jt).set(e,p),V(this,Rr)[V(this,ir)]=p,V(this,qr)[p]=V(this,ir),Xe(this,ir,p),Zo(this,Kt)._++,V(this,ns).call(this,p,u,l),l&&(l.set="add"),c=!1;else{He(this,ga,no).call(this,p);const k=V(this,at)[p];if(t!==k){if(V(this,Mi)&&He(this,wt,Pt).call(this,k)){k.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:Y}=k;Y!==void 0&&!s&&(V(this,vn)&&((m=V(this,Sn))==null||m.call(this,Y,e,"set")),V(this,Ir)&&((_=V(this,ar))==null||_.push([Y,e,"set"])))}else s||(V(this,vn)&&((b=V(this,Sn))==null||b.call(this,k,e,"set")),V(this,Ir)&&((A=V(this,ar))==null||A.push([k,e,"set"])));if(V(this,ma).call(this,p),V(this,ns).call(this,p,u,l),V(this,at)[p]=t,l){l.set="replace";const Y=k&&He(this,wt,Pt).call(this,k)?k.__staleWhileFetching:k;Y!==void 0&&(l.oldValue=Y)}}else l&&(l.set="update")}if(i!==0&&!V(this,Tn)&&He(this,ko,Nm).call(this),V(this,Tn)&&(c||V(this,Lo).call(this,p,i,a),l&&V(this,li).call(this,l,p)),!s&&V(this,Ir)&&V(this,ar)){const k=V(this,ar);let Y;for(;Y=k==null?void 0:k.shift();)(R=V(this,On))==null||R.call(this,...Y)}return this}pop(){var e;try{for(;V(this,Kt);){const t=V(this,at)[V(this,Sr)];if(He(this,is,Pl).call(this,!0),He(this,wt,Pt).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(V(this,Ir)&&V(this,ar)){const t=V(this,ar);let r;for(;r=t==null?void 0:t.shift();)(e=V(this,On))==null||e.call(this,...r)}}}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,a=V(this,jt).get(e);if(a!==void 0){const s=V(this,at)[a];if(He(this,wt,Pt).call(this,s)&&s.__staleWhileFetching===void 0)return!1;if(V(this,Vr).call(this,a))i&&(i.has="stale",V(this,li).call(this,i,a));else return r&&V(this,fa).call(this,a),i&&(i.has="hit",V(this,li).call(this,i,a)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,i=V(this,jt).get(e);if(i!==void 0&&(r||!V(this,Vr).call(this,i))){const a=V(this,at)[i];return He(this,wt,Pt).call(this,a)?a.__staleWhileFetching:a}}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:_=this.ignoreFetchAbort,allowStaleOnFetchAbort:b=this.allowStaleOnFetchAbort,context:A,forceRefresh:R=!1,status:k,signal:Y}=t;if(!V(this,Mi))return k&&(k.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:k});const Z={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:s,noDisposeOnSet:o,size:l,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:b,ignoreFetchAbort:_,status:k,signal:Y};let h=V(this,jt).get(e);if(h===void 0){k&&(k.fetch="miss");const E=He(this,as,Bl).call(this,e,h,Z,A);return E.__returned=E}else{const E=V(this,at)[h];if(He(this,wt,Pt).call(this,E)){const L=r&&E.__staleWhileFetching!==void 0;return k&&(k.fetch="inflight",L&&(k.returnedStale=!0)),L?E.__staleWhileFetching:E.__returned=E}const S=V(this,Vr).call(this,h);if(!R&&!S)return k&&(k.fetch="hit"),He(this,ga,no).call(this,h),i&&V(this,fa).call(this,h),k&&V(this,li).call(this,k,h),E;const I=He(this,as,Bl).call(this,e,h,Z,A),w=I.__staleWhileFetching!==void 0&&r;return k&&(k.fetch=S?"stale":"refresh",w&&S&&(k.returnedStale=!0)),w?I.__staleWhileFetching:I.__returned=I}}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:s}=t,o=V(this,jt).get(e);if(o!==void 0){const l=V(this,at)[o],c=He(this,wt,Pt).call(this,l);return s&&V(this,li).call(this,s,o),V(this,Vr).call(this,o)?(s&&(s.get="stale"),c?(s&&r&&l.__staleWhileFetching!==void 0&&(s.returnedStale=!0),r?l.__staleWhileFetching:void 0):(a||this.delete(e),s&&r&&(s.returnedStale=!0),r?l:void 0)):(s&&(s.get="hit"),c?l.__staleWhileFetching:(He(this,ga,no).call(this,o),i&&V(this,fa).call(this,o),l))}else s&&(s.get="miss")}delete(e){var r,i,a,s;let t=!1;if(V(this,Kt)!==0){const o=V(this,jt).get(e);if(o!==void 0)if(t=!0,V(this,Kt)===1)this.clear();else{V(this,ma).call(this,o);const l=V(this,at)[o];He(this,wt,Pt).call(this,l)?l.__abortController.abort(new Error("deleted")):(V(this,vn)||V(this,Ir))&&(V(this,vn)&&((r=V(this,Sn))==null||r.call(this,l,e,"delete")),V(this,Ir)&&((i=V(this,ar))==null||i.push([l,e,"delete"]))),V(this,jt).delete(e),V(this,kt)[o]=void 0,V(this,at)[o]=void 0,o===V(this,ir)?Xe(this,ir,V(this,qr)[o]):o===V(this,Sr)?Xe(this,Sr,V(this,Rr)[o]):(V(this,Rr)[V(this,qr)[o]]=V(this,Rr)[o],V(this,qr)[V(this,Rr)[o]]=V(this,qr)[o]),Zo(this,Kt)._--,V(this,bn).push(o)}}if(V(this,Ir)&&((a=V(this,ar))!=null&&a.length)){const o=V(this,ar);let l;for(;l=o==null?void 0:o.shift();)(s=V(this,On))==null||s.call(this,...l)}return t}clear(){var e,t,r;for(const i of He(this,Bn,Di).call(this,{allowStale:!0})){const a=V(this,at)[i];if(He(this,wt,Pt).call(this,a))a.__abortController.abort(new Error("deleted"));else{const s=V(this,kt)[i];V(this,vn)&&((e=V(this,Sn))==null||e.call(this,a,s,"delete")),V(this,Ir)&&((t=V(this,ar))==null||t.push([a,s,"delete"]))}}if(V(this,jt).clear(),V(this,at).fill(void 0),V(this,kt).fill(void 0),V(this,Tn)&&V(this,oi)&&(V(this,Tn).fill(0),V(this,oi).fill(0)),V(this,si)&&V(this,si).fill(0),Xe(this,Sr,0),Xe(this,ir,0),V(this,bn).length=0,Xe(this,En,0),Xe(this,Kt,0),V(this,Ir)&&V(this,ar)){const i=V(this,ar);let a;for(;a=i==null?void 0:i.shift();)(r=V(this,On))==null||r.call(this,...a)}}};_n=new WeakMap,Qr=new WeakMap,Sn=new WeakMap,On=new WeakMap,rs=new WeakMap,Kt=new WeakMap,En=new WeakMap,jt=new WeakMap,kt=new WeakMap,at=new WeakMap,Rr=new WeakMap,qr=new WeakMap,Sr=new WeakMap,ir=new WeakMap,bn=new WeakMap,ar=new WeakMap,si=new WeakMap,oi=new WeakMap,Tn=new WeakMap,vn=new WeakMap,Mi=new WeakMap,Ir=new WeakMap,ko=new WeakSet,Nm=function(){const e=new Ml(V(this,_n)),t=new Ml(V(this,_n));Xe(this,Tn,e),Xe(this,oi,t),Xe(this,Lo,(a,s,o=Hs.now())=>{if(t[a]=s!==0?o:0,e[a]=s,s!==0&&this.ttlAutopurge){const l=setTimeout(()=>{V(this,Vr).call(this,a)&&this.delete(V(this,kt)[a])},s+1);l.unref&&l.unref()}}),Xe(this,fa,a=>{t[a]=e[a]!==0?Hs.now():0}),Xe(this,li,(a,s)=>{if(e[s]){const o=e[s],l=t[s];a.ttl=o,a.start=l,a.now=r||i();const c=a.now-l;a.remainingTTL=o-c}});let r=0;const i=()=>{const a=Hs.now();if(this.ttlResolution>0){r=a;const s=setTimeout(()=>r=0,this.ttlResolution);s.unref&&s.unref()}return a};this.getRemainingTTL=a=>{const s=V(this,jt).get(a);if(s===void 0)return 0;const o=e[s],l=t[s];if(o===0||l===0)return 1/0;const c=(r||i())-l;return o-c},Xe(this,Vr,a=>e[a]!==0&&t[a]!==0&&(r||i())-t[a]>e[a])},fa=new WeakMap,li=new WeakMap,Lo=new WeakMap,Vr=new WeakMap,Tc=new WeakSet,uR=function(){const e=new Ml(V(this,_n));Xe(this,En,0),Xe(this,si,e),Xe(this,ma,t=>{Xe(this,En,V(this,En)-e[t]),e[t]=0}),Xe(this,Mo,(t,r,i,a)=>{if(He(this,wt,Pt).call(this,r))return 0;if(!Ni(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(r,t),!Ni(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i}),Xe(this,ns,(t,r,i)=>{if(e[t]=r,V(this,Qr)){const a=V(this,Qr)-e[t];for(;V(this,En)>a;)He(this,is,Pl).call(this,!0)}Xe(this,En,V(this,En)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=V(this,En))})},ma=new WeakMap,ns=new WeakMap,Mo=new WeakMap,Pn=new WeakSet,wi=function*({allowStale:e=this.allowStale}={}){if(V(this,Kt))for(let t=V(this,ir);!(!He(this,Po,wm).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,Sr)));)t=V(this,qr)[t]},Bn=new WeakSet,Di=function*({allowStale:e=this.allowStale}={}){if(V(this,Kt))for(let t=V(this,Sr);!(!He(this,Po,wm).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,ir)));)t=V(this,Rr)[t]},Po=new WeakSet,wm=function(e){return e!==void 0&&V(this,jt).get(V(this,kt)[e])===e},is=new WeakSet,Pl=function(e){var a,s;const t=V(this,Sr),r=V(this,kt)[t],i=V(this,at)[t];return V(this,Mi)&&He(this,wt,Pt).call(this,i)?i.__abortController.abort(new Error("evicted")):(V(this,vn)||V(this,Ir))&&(V(this,vn)&&((a=V(this,Sn))==null||a.call(this,i,r,"evict")),V(this,Ir)&&((s=V(this,ar))==null||s.push([i,r,"evict"]))),V(this,ma).call(this,t),e&&(V(this,kt)[t]=void 0,V(this,at)[t]=void 0,V(this,bn).push(t)),V(this,Kt)===1?(Xe(this,Sr,Xe(this,ir,0)),V(this,bn).length=0):Xe(this,Sr,V(this,Rr)[t]),V(this,jt).delete(r),Zo(this,Kt)._--,t},as=new WeakSet,Bl=function(e,t,r,i){const a=t===void 0?void 0:V(this,at)[t];if(He(this,wt,Pt).call(this,a))return a;const s=new _c,{signal:o}=r;o==null||o.addEventListener("abort",()=>s.abort(o.reason),{signal:s.signal});const l={signal:s.signal,options:r,context:i},c=(A,R=!1)=>{const{aborted:k}=s.signal,Y=r.ignoreFetchAbort&&A!==void 0;if(r.status&&(k&&!R?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,Y&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),k&&!Y&&!R)return p(s.signal.reason);const Z=_;return V(this,at)[t]===_&&(A===void 0?Z.__staleWhileFetching?V(this,at)[t]=Z.__staleWhileFetching:this.delete(e):(r.status&&(r.status.fetchUpdated=!0),this.set(e,A,l.options))),A},u=A=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=A),p(A)),p=A=>{const{aborted:R}=s.signal,k=R&&r.allowStaleOnFetchAbort,Y=k||r.allowStaleOnFetchRejection,Z=Y||r.noDeleteOnFetchRejection,h=_;if(V(this,at)[t]===_&&(!Z||h.__staleWhileFetching===void 0?this.delete(e):k||(V(this,at)[t]=h.__staleWhileFetching)),Y)return r.status&&h.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),h.__staleWhileFetching;if(h.__returned===h)throw A},m=(A,R)=>{var Y;const k=(Y=V(this,rs))==null?void 0:Y.call(this,e,a,l);k&&k instanceof Promise&&k.then(Z=>A(Z===void 0?void 0:Z),R),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(A(void 0),r.allowStaleOnFetchAbort&&(A=Z=>c(Z,!0)))})};r.status&&(r.status.fetchDispatched=!0);const _=new Promise(m).then(c,u),b=Object.assign(_,{__abortController:s,__staleWhileFetching:a,__returned:void 0});return t===void 0?(this.set(e,b,{...l.options,status:void 0}),t=V(this,jt).get(e)):V(this,at)[t]=b,b},wt=new WeakSet,Pt=function(e){if(!V(this,Mi))return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof _c},Bo=new WeakSet,Dm=function(e,t){V(this,qr)[t]=e,V(this,Rr)[e]=t},ga=new WeakSet,no=function(e){e!==V(this,ir)&&(e===V(this,Sr)?Xe(this,Sr,V(this,Rr)[e]):He(this,Bo,Dm).call(this,V(this,qr)[e],V(this,Rr)[e]),He(this,Bo,Dm).call(this,V(this,ir),e),Xe(this,ir,e))};let Im=Xg;const uo=class uo{constructor(){T(this,"_fallbackMethod",()=>uo.createSkipProxy());T(this,"out",()=>{})}};T(uo,"createSkipProxy",()=>{const e=new uo;return new Proxy(e,{get(t,r,i){return typeof t[r]>"u"?t._fallbackMethod:t[r]},set(t,r,i,a){return!1}})});let Sc=uo;const po=class po extends Bg{constructor(t,r){super(r);T(this,"_fallbackMethod",()=>po.createRestProxy(this.values.length,this.app));T(this,"out",()=>{});this.values.length=t}};T(po,"createRestProxy",(t,r)=>{const i=new po(t,r);return new Proxy(i,{get(a,s,o){return typeof a[s]>"u"?a._fallbackMethod:a[s]},set(a,s,o,l){return!1}})});let Oc=po;class S3 extends Bg{constructor(t,r,i){super(i);T(this,"input");T(this,"ziffers");T(this,"initCallTime",0);T(this,"startCallTime",0);T(this,"lastCallTime",0);T(this,"waitTime",0);T(this,"startBeat",0);T(this,"played",!1);T(this,"current");T(this,"retro",!1);T(this,"index",-1);T(this,"zid","");T(this,"options",{});T(this,"skipIndex",0);T(this,"endTime",0);T(this,"next",()=>(this.current=this.ziffers.next(),this.played=!0,this.current));T(this,"pulseToSecond",t=>this.app.clock.convertPulseToSecond(t));T(this,"firstRun",()=>this.notStarted());T(this,"atTheBeginning",()=>this.skipIndex===0&&this.ziffers.index<=0);T(this,"origin",()=>this.app.clock.pulses_since_origin+1);T(this,"pulse",()=>this.app.clock.time_position.pulse);T(this,"beat",()=>this.app.clock.time_position.beat);T(this,"nextBeat",()=>this.app.clock.next_beat_in_ticks);T(this,"nextBeatInTicks",()=>this.app.clock.next_beat_in_ticks);T(this,"areWeThereYet",()=>{this.app.clock.pulses_since_origin=this.nextBeatInTicks())&&this.origin()>=this.waitTime,r=this.current&&this.pulseToSecond(this.origin())>=this.pulseToSecond(this.lastCallTime)+this.pulseToSecond(this.current.duration*4*this.app.clock.ppqn)&&this.origin()>=this.waitTime,i=t||r;return this.skipIndex=i?0:this.skipIndex+1,this.index=i?this.index+1:this.index,i&&this.notStarted()&&(this.initCallTime=this.app.clock.pulses_since_origin),this.atTheBeginning()&&(this.startCallTime=this.app.clock.pulses_since_origin),i});T(this,"lead",()=>this.voiceleading());T(this,"invert",t=>(this.atTheBeginning()&&this.ziffers.invert(t),this));T(this,"out",()=>{});this.app=i,this.input=t,this.options=r,this.ziffers=new LP(t,r)}get ticks(){return this.ziffers.duration*4*this.app.clock.ppqn}nextEndTime(){return this.startCallTime+this.ticks}updateLastCallTime(){(this.notStarted()||this.played)&&(this.lastCallTime=this.app.clock.pulses_since_origin,this.played=!1)}notStarted(){return this.ziffers.notStarted()}sound(t){if(this.areWeThereYet()){const r=this.next(),i=this.app.clock.convertPulseToSecond(r.duration*4*this.app.clock.ppqn);if(r instanceof di){const a=r.getExisting("freq","pitch","key","scale","octave","parsedScale");return a.dur=i,new Cm(a,this.app).sound(t)}else if(r instanceof va){const a=r.pitches.map(s=>s.getExisting("freq","pitch","key","scale","octave","parsedScale"));return new Cm({dur:i},this.app).chord(a).sound(t)}else if(r instanceof Em)return Oc.createRestProxy(r.duration,this.app)}else return Sc.createSkipProxy()}midi(t=void 0){if(this.areWeThereYet()){const r=this.next(),i=r.getExisting("note","pitch","bend","key","scale","octave","parsedScale");if(r instanceof di){const a=new ym(i,this.app);return t?a.note(t):a}else{if(r instanceof Em)return Oc.createRestProxy(r.duration,this.app);if(r instanceof va){const a=r.notes();return new ym(i,this.app).chord(a)}}}else return Sc.createSkipProxy()}scale(t){return this.atTheBeginning()&&this.ziffers.scale(t),this}key(t){return this.atTheBeginning()&&this.ziffers.key(t),this}octave(t){return this.atTheBeginning()&&this.ziffers.octave(t),this}voiceleading(){return this.atTheBeginning()&&this.ziffers.lead(),this}retrograde(){return this.atTheBeginning()&&this.ziffers.retrograde(),this}wait(t){if(this.atTheBeginning()){if(typeof t=="function"){const r=this.app.api.patternCache.get(t.name);return r&&(this.waitTime=r.nextEndTime()),this}this.waitTime=this.origin()+Math.ceil(t*4*this.app.clock.ppqn)}return this}sync(t){if(this.atTheBeginning()&&this.notStarted()){const r=this.app.clock.pulses_since_origin,i=typeof t=="function"?t.name:t;if(r>0){const a=this.app.api.patternCache.get(i);if(a){const s=a.ziffers.duration,o=a.startCallTime,l=s*4*this.app.clock.ppqn;this.waitTime=o+l}}}return this}}const O3=n=>n[0]==="{"&&n[n.length-1]==="}",Ws=(n,e)=>{if(O3(n)){const t=JSON.parse(n);return JSON.stringify({...t,...e})}else return JSON.stringify({...e,text:n})},E3=n=>{String.prototype.speak=function(){const e=JSON.parse(this.valueOf());new dR({...e,text:e.text}).speak().then(()=>{}).catch(t=>{console.log("Error speaking:",t)})},String.prototype.rate=function(e){return Ws(this.valueOf(),{rate:e})},String.prototype.pitch=function(e){return Ws(this.valueOf(),{pitch:e})},String.prototype.lang=function(e){return Ws(this.valueOf(),{lang:e})},String.prototype.volume=function(e){return Ws(this.valueOf(),{volume:e})},String.prototype.voice=function(e){return Ws(this.valueOf(),{voice:e})},String.prototype.z=function(e={}){return n.z(this.valueOf(),e)},String.prototype.z0=function(e={}){return n.z0(this.valueOf(),e)},String.prototype.z1=function(e={}){return n.z1(this.valueOf(),e)},String.prototype.z2=function(e={}){return n.z2(this.valueOf(),e)},String.prototype.z3=function(e={}){return n.z3(this.valueOf(),e)},String.prototype.z4=function(e={}){return n.z4(this.valueOf(),e)},String.prototype.z5=function(e={}){return n.z5(this.valueOf(),e)},String.prototype.z6=function(e={}){return n.z6(this.valueOf(),e)},String.prototype.z7=function(e={}){return n.z7(this.valueOf(),e)},String.prototype.z8=function(e={}){return n.z8(this.valueOf(),e)},String.prototype.z9=function(e={}){return n.z9(this.valueOf(),e)},String.prototype.z10=function(e={}){return n.z10(this.valueOf(),e)},String.prototype.z11=function(e={}){return n.z11(this.valueOf(),e)},String.prototype.z12=function(e={}){return n.z12(this.valueOf(),e)},String.prototype.z13=function(e={}){return n.z13(this.valueOf(),e)},String.prototype.z14=function(e={}){return n.z14(this.valueOf(),e)},String.prototype.z15=function(e={}){return n.z15(this.valueOf(),e)},String.prototype.z16=function(e={}){return n.z16(this.valueOf(),e)},String.prototype.note=function(){try{return parseInt(this.valueOf())}catch{return Kn(this.valueOf())}}};let Lu;class dR{constructor(e){T(this,"speak",()=>new Promise((e,t)=>{if(this.options.text){const r=window.speechSynthesis;r.speaking&&r.cancel();const i=new SpeechSynthesisUtterance(this.options.text);i.rate=this.options.rate||1,i.pitch=this.options.pitch||1,i.volume=this.options.volume||1,this.options.voice&&(i.voice=r.getVoices()[this.options.voice]),this.options.lang&&(this.options.lang.length===2?i.lang=`${this.options.lang}-${this.options.lang.toUpperCase()}`:this.options.lang.length===5?i.lang=this.options.lang:i.lang="en-US"),i.onend=()=>{e()},i.onerror=a=>{t(a)},r.speaking?(r.cancel(),Lu&&clearTimeout(Lu),Lu=setTimeout(()=>{r.speak(i)},200)):r.speak(i)}else t("No text provided")}));this.options=e}}async function ZO(){return Promise.all([KP(),za("github:tidalcycles/Dirt-Samples/master").then(()=>d3()),g3(),za("github:Bubobubobubobubo/Dough-Samples/main"),za("github:Bubobubobubobubo/Dough-Amiga/main"),za("github:Bubobubobubobubo/Dough-Waveforms/main")])}class b3{constructor(e){T(this,"variables",{});T(this,"codeExamples",{});T(this,"counters",{});T(this,"_drunk",new BP(-100,100,!1));T(this,"randomGen",Math.random);T(this,"currentSeed");T(this,"localSeeds",new Map);T(this,"patternCache",new Im({max:1e3,ttl:1e3*60*5}));T(this,"errorTimeoutID",0);T(this,"printTimeoutID",0);T(this,"MidiConnection",new PP);T(this,"load");T(this,"_loadUniverseFromInterface",e=>{this.app.loadUniverse(e),this.app.openBuffersModal()});T(this,"_deleteUniverseFromInterface",e=>{delete this.app.universes[e],this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});T(this,"_playDocExample",e=>{let t=this.app.universes[this.app.selected_universe];this.app.exampleIsPlaying=!0,t.example?t.example.candidate=e||this.app.selectedExample:(t.example={candidate:"",committed:"",evaluations:0},t.example.candidate=e||this.app.selectedExample),this.play()});T(this,"_stopDocExample",()=>{let e=this.app.universes[this.app.selected_universe];(e==null?void 0:e.example)!==void 0&&(this.app.exampleIsPlaying=!1,e.example.candidate="",e.example.committed=""),this.pause()});T(this,"_playDocExampleOnce",e=>{let t=this.app.universes[this.app.selected_universe];(t==null?void 0:t.example)!==void 0&&(t.example.candidate="",t.example.committed=""),this.play(),this.app.exampleIsPlaying=!0,zM(this.app,e)});T(this,"_all_samples",()=>Ug.get());T(this,"_reportError",e=>{console.log(e),clearTimeout(this.errorTimeoutID),clearTimeout(this.printTimeoutID),this.app.error_line.innerHTML=e,this.app.error_line.style.color="color-red-800",this.app.error_line.classList.remove("hidden"),this.errorTimeoutID=setTimeout(()=>this.app.error_line.classList.add("hidden"),2e3)});T(this,"_logMessage",e=>{console.log(e),clearTimeout(this.printTimeoutID),clearTimeout(this.errorTimeoutID),this.app.error_line.innerHTML=e,this.app.error_line.style.color="white",this.app.error_line.classList.remove("hidden"),this.printTimeoutID=setTimeout(()=>this.app.error_line.classList.add("hidden"),4e3)});T(this,"time",()=>this.app.audioContext.currentTime);T(this,"play",()=>{this.app.setButtonHighlighting("play",!0),this.app.clock.start()});T(this,"pause",()=>{this.app.setButtonHighlighting("pause",!0),this.app.clock.pause()});T(this,"stop",()=>{this.app.setButtonHighlighting("stop",!0),this.app.clock.stop()});T(this,"silence",this.stop);T(this,"hush",this.stop);T(this,"warp",e=>{this.app.clock.tick=e,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e)});T(this,"beat_warp",e=>{this.app.clock.tick=e*this.app.clock.ppqn,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e*this.app.clock.ppqn)});T(this,"onmousemove",e=>{this.app._mouseX=e.pageX,this.app._mouseY=e.pageY});T(this,"mouseX",()=>this.app._mouseX);T(this,"mouseY",()=>this.app._mouseY);T(this,"noteX",()=>Math.floor(this.app._mouseX/document.body.clientWidth*127));T(this,"noteY",()=>Math.floor(this.app._mouseY/document.body.clientHeight*127));T(this,"script",(...e)=>{e.forEach(t=>{es(this.app,this.app.universes[this.app.selected_universe].locals[t])})});T(this,"s",this.script);T(this,"clear_script",e=>{this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}});T(this,"cs",this.clear_script);T(this,"copy_script",(e,t)=>{this.app.universes[this.app.selected_universe].locals[t]=this.app.universes[this.app.selected_universe].locals[e]});T(this,"cps",this.copy_script);T(this,"midi_outputs",()=>{this._logMessage(this.MidiConnection.listMidiOutputs())});T(this,"midi_output",e=>{e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())});T(this,"midi",(e=60,t,r)=>(t!==void 0&&(typeof e=="number"&&(e={note:e}),e.velocity=t),r!==void 0&&(typeof e=="number"&&(e={note:e}),e.channel=r),new ym(e,this.app)));T(this,"sysex",e=>{this.MidiConnection.sendSysExMessage(e)});T(this,"pitch_bend",(e,t)=>{this.MidiConnection.sendPitchBend(e,t)});T(this,"program_change",(e,t)=>{this.MidiConnection.sendProgramChange(e,t)});T(this,"midi_clock",()=>{this.MidiConnection.sendMidiClock()});T(this,"control_change",({control:e=20,value:t=0,channel:r=0})=>{this.MidiConnection.sendMidiControlChange(e,t,r)});T(this,"midi_panic",()=>{this.MidiConnection.panic()});T(this,"generateCacheKey",(...e)=>e.map(t=>JSON.stringify(t)).join(","));T(this,"z",(e,t={},r="")=>{const i="z"+r.toString(),a=r===""?this.generateCacheKey(e,t):i;let s;return this.app.api.patternCache.has(a)&&(s=this.app.api.patternCache.get(a),s.input!==e&&(s=void 0)),s||(s=new S3(e,t,this.app),this.app.api.patternCache.set(a,s)),typeof r=="number"&&(s.zid=i),s.updateLastCallTime(),r!==""&&s.sync("z0"),s});T(this,"z0",(e,t={})=>this.z(e,t,0));T(this,"z1",(e,t={})=>this.z(e,t,1));T(this,"z2",(e,t={})=>this.z(e,t,2));T(this,"z3",(e,t={})=>this.z(e,t,3));T(this,"z4",(e,t={})=>this.z(e,t,4));T(this,"z5",(e,t={})=>this.z(e,t,5));T(this,"z6",(e,t={})=>this.z(e,t,6));T(this,"z7",(e,t={})=>this.z(e,t,7));T(this,"z8",(e,t={})=>this.z(e,t,8));T(this,"z9",(e,t={})=>this.z(e,t,9));T(this,"z10",(e,t={})=>this.z(e,t,10));T(this,"z11",(e,t={})=>this.z(e,t,11));T(this,"z12",(e,t={})=>this.z(e,t,12));T(this,"z13",(e,t={})=>this.z(e,t,13));T(this,"z14",(e,t={})=>this.z(e,t,14));T(this,"z15",(e,t={})=>this.z(e,t,15));T(this,"z16",(e,t={})=>this.z(e,t,16));T(this,"counter",(e,t,r)=>(e in this.counters?(this.counters[e].limit!==t&&(this.counters[e].value=0,this.counters[e].limit=t),this.counters[e].step!==r&&(this.counters[e].step=r??this.counters[e].step),this.counters[e].value+=this.counters[e].step,this.counters[e].limit!==void 0&&this.counters[e].value>this.counters[e].limit&&(this.counters[e].value=0)):this.counters[e]={value:0,step:r??1,limit:t},this.counters[e].value));T(this,"$",this.counter);T(this,"i",e=>e!==void 0?(this.app.universes[this.app.selected_universe].global.evaluations=e,this.app.universes[this.app.selected_universe]):this.app.universes[this.app.selected_universe].global.evaluations);T(this,"drunk",e=>e!==void 0?(this._drunk.position=e,this._drunk.getPosition()):(this._drunk.step(),this._drunk.getPosition()));T(this,"drunk_max",e=>{this._drunk.max=e});T(this,"drunk_min",e=>{this._drunk.min=e});T(this,"drunk_wrap",e=>{this._drunk.toggleWrap(e)});T(this,"variable",(e,t)=>typeof e=="string"&&t===void 0?this.variables[e]:(this.variables[e]=t,this.variables[e]));T(this,"v",this.variable);T(this,"delete_variable",e=>{delete this.variables[e]});T(this,"dv",this.delete_variable);T(this,"clear_variables",()=>{this.variables={}});T(this,"cv",this.clear_variables);T(this,"randI",(e,t)=>Math.floor(this.randomGen()*(t-e+1))+e);T(this,"rand",(e,t)=>this.randomGen()*(t-e)+e);T(this,"irand",this.randI);T(this,"rI",this.randI);T(this,"r",this.rand);T(this,"ir",this.randI);T(this,"seed",e=>{typeof e=="number"&&(e=e.toString()),this.currentSeed!==e&&(this.currentSeed=e,this.randomGen=Om(e))});T(this,"localSeededRandom",e=>{if(typeof e=="number"&&(e=e.toString()),this.localSeeds.has(e))return this.localSeeds.get(e);const t=Om(e);return this.localSeeds.set(e,t),t});T(this,"clearLocalSeed",(e=void 0)=>{e&&this.localSeeds.delete(e.toString()),this.localSeeds.clear()});T(this,"quantize",(e,t)=>{if(t.length===0)return e;let r=t[0];return t.forEach(i=>{Math.abs(i-e)Math.min(Math.max(e,t),r));T(this,"cmp",this.clamp);T(this,"bpm",e=>e===void 0?this.app.clock.bpm:((e<1||e>500)&&console.log(`Setting bpm to ${e}`),this.app.clock.bpm=e,e));T(this,"tempo",this.bpm);T(this,"bpb",e=>e===void 0?this.app.clock.time_signature[0]:(e<1&&console.log(`Setting bpb to ${e}`),this.app.clock.time_signature[0]=e,e));T(this,"ppqn",e=>e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e));T(this,"time_signature",(e,t)=>{this.app.clock.time_signature=[e,t]});T(this,"prob",e=>this.randomGen()*100this.randomGen()>.5);T(this,"odds",(e,t=1)=>this.randomGen()!1);T(this,"almostNever",(e=1)=>this.randomGen()<.025*this.ppqn()/(this.ppqn()*e));T(this,"rarely",(e=1)=>this.randomGen()<.1*this.ppqn()/(this.ppqn()*e));T(this,"scarcely",(e=1)=>this.randomGen()<.25*this.ppqn()/(this.ppqn()*e));T(this,"sometimes",(e=1)=>this.randomGen()<.5*this.ppqn()/(this.ppqn()*e));T(this,"often",(e=1)=>this.randomGen()<.75*this.ppqn()/(this.ppqn()*e));T(this,"frequently",(e=1)=>this.randomGen()<.9*this.ppqn()/(this.ppqn()*e));T(this,"almostAlways",(e=1)=>this.randomGen()<.985*this.ppqn()/(this.ppqn()*e));T(this,"always",(e=1)=>!0);T(this,"dice",e=>Math.floor(this.randomGen()*e)+1);T(this,"cbar",()=>this.app.clock.time_position.bar+1);T(this,"ctick",()=>this.app.clock.tick+1);T(this,"cpulse",()=>this.app.clock.time_position.pulse+1);T(this,"cbeat",()=>this.app.clock.time_position.beat+1);T(this,"ebeat",()=>this.app.clock.beats_since_origin+1);T(this,"epulse",()=>this.app.clock.pulses_since_origin+1);T(this,"nominator",()=>this.app.clock.time_signature[0]);T(this,"meter",()=>this.app.clock.time_signature[1]);T(this,"denominator",this.meter);T(this,"beat",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%Math.floor(r*this.ppqn())===0).some(r=>r===!0));T(this,"pulse",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%r===0).some(r=>r===!0));T(this,"flip",(e,t=50)=>{const r=this.app.clock.pulses_since_origin,i=Math.floor(e*this.ppqn()),a=Math.floor(t/100*i);return r%i{const t=this.app.clock.time_position.bar;return Math.floor(t/e)%2===0});T(this,"onbar",(e,t=this.app.clock.time_signature[0])=>{let r=this.app.clock.time_position.bar%t+1;return typeof e=="number"?e===r:e.some(i=>i==r)});T(this,"onbeat",(...e)=>{let t=[];return e.forEach(r=>{let i=r%this.nominator()||this.nominator(),a=Math.floor(i);a=a==0?this.nominator():a;let s=Math.floor((i-a)*this.ppqn()+1);s<=0&&(s=s+this.ppqn()*this.nominator()),t.push(a===this.cbeat()&&this.cpulse()===s)}),t.some(r=>r==!0)});T(this,"oncount",(e,t)=>{typeof e=="number"&&(e=[e]);const r=this.app.clock.pulses_since_origin;let i=[];return e.forEach(a=>{a=a<1?0:a-1;const s=Math.ceil(a*this.ppqn()),o=r%(this.ppqn()*t);return i.push(o===s)}),i.some(a=>a==!0)});T(this,"oneuclid",(e,t,r=0)=>{const a=this._euclidean_cycle(e,t,r).reduce((s,o,l)=>(o&&s.push(l+1),s),[]);return this.oncount(a,t)});T(this,"delay",(e,t)=>{setTimeout(t,e)});T(this,"delayr",(e,t,r)=>{[...Array(t).keys()].map(a=>e*a).forEach((a,s)=>{setTimeout(r,a)})});T(this,"euclid",(e,t,r,i=0)=>this._euclidean_cycle(t,r,i)[e%r]);T(this,"ec",this.euclid);T(this,"rhythm",(e,t,r,i=0)=>this.beat(e)&&this._euclidean_cycle(t,r,i).beat(e));T(this,"bin",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return i[e%i.length]});T(this,"binrhythm",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return this.beat(e)&&i.beat(e)});T(this,"line",(e,t,r=1)=>{const i=[];if(t>e&&r>0||tMath.sin(this.app.clock.ctx.currentTime*Math.PI*2*e)+t);T(this,"usine",(e=1,t=0)=>(this.sine(e,t)+1)/2);T(this,"saw",(e=1,t=0)=>this.app.clock.ctx.currentTime*e%1*2-1+t);T(this,"usaw",(e=1,t=0)=>(this.saw(e,t)+1)/2);T(this,"triangle",(e=1,t=0)=>Math.abs(this.saw(e,t))*2-1);T(this,"utriangle",(e=1,t=0)=>(this.triangle(e,t)+1)/2);T(this,"square",(e=1,t=0,r=.5)=>{const i=1/e;return(Date.now()/1e3+t)%i/i(this.square(e,t,r)+1)/2);T(this,"noise",()=>this.randomGen()*2-1);T(this,"min",(...e)=>Math.min(...e));T(this,"max",(...e)=>Math.max(...e));T(this,"mean",(...e)=>e.reduce((r,i)=>r+i,0)/e.length);T(this,"limit",(e,t,r)=>Math.min(Math.max(e,t),r));T(this,"abs",Math.abs);T(this,"speak",(e,t="en-US",r=0,i=1,a=1)=>{new dR({text:e,lang:t,voice:r,rate:i,pitch:a}).speak().then(()=>{}).catch(o=>{console.log(o)})});T(this,"stop_hydra",()=>{this.app.hydra.hush()});T(this,"sound",e=>new Cm(e,this.app));T(this,"snd",this.sound);T(this,"samples",za);T(this,"log",e=>{console.log(e),this._logMessage(e)});T(this,"scale",Pg);T(this,"rate",e=>{});T(this,"divseq",(...e)=>{const t=e[0],r=e.slice(1),i=this.app.clock.pulses_since_origin,a=Math.floor(i/Math.floor(t*this.ppqn()));return r[a%r.length]});T(this,"seqbeat",(...e)=>e[this.app.clock.time_position.beat%e.length]);T(this,"seqbar",(...e)=>e[(this.app.clock.time_position.bar+1)%e.length]);this.app=e}_euclidean_cycle(e,t,r=0){if(e==t)return Array.from({length:t},()=>!0);function i(o,l){const c=o.length,u=(l+1)%c;return o[l]>o[u]}if(e>=t)return[!0];const a=Array.from({length:t},(o,l)=>(e*(l-1)%t+t)%t);let s=a.map((o,l)=>i(a,l));return r!=0&&(s=s.slice(r).concat(s.slice(0,r))),s}}const T3=n=>{Array.prototype.in=function(e){return this.includes(e)},Array.prototype.square=function(){return this.map(e=>e*e)},Array.prototype.sqrt=function(){if(this.some(e=>e<0))throw new Error("Cannot take square root of negative number");return this.map(e=>Math.sqrt(e))},Array.prototype.add=function(e){return this.map(t=>t+e)},Array.prototype.sub=function(e){return this.map(t=>t-e)},Array.prototype.mult=function(e){return this.map(t=>t*e)},Array.prototype.div=function(e){if(e===0)throw new Error("Division by zero");return this.map(t=>t/e)},Array.prototype.pick=function(){return this[Math.floor(n.randomGen()*this.length)]},Array.prototype.gen=function(e,t,r){return r<1?[]:Array.from({length:r},()=>Math.floor(n.randomGen()*(t-e+1))+e)},Array.prototype.bar=function(){return this[n.app.clock.time_position.bar%this.length]},Array.prototype.pulse=function(){return this[n.app.clock.time_position.pulse%this.length]},Array.prototype.beat=function(e=1){const t=e,r=n.app.clock.pulses_since_origin,i=Math.floor(r/Math.floor(t*n.ppqn()));return this[i%this.length]},Array.prototype.shuffle=function(){let e=this.length,t;for(;e!==0;)t=Math.floor(n.randomGen()*e),e--,[this[e],this[t]]=[this[t],this[e]];return this},Array.prototype.rotate=function(e){const t=this.length;if(e<0)e=t+e%t;else if(e>0)e=e%t;else return this;const r=this.splice(-e,e);return this.unshift(...r),this},Array.prototype.unique=function(){const e=new Set;let t=0;for(let r=0;r100)throw new Error("Amount should be between 0 and 100");if(this.length<=1)return this;for(let t=0;t1)this.splice(t,1);else return this;else t++;return this},Array.prototype.repeatAll=function(e=1){if(e<1)throw new Error("Amount should be at least 1");let t=[];for(let r=0;r(i%a+a)%a,r=eR(zo(n));return this.map(i=>{const a=Math.floor(i/r.length)*12;return r[t(i,r.length)]+e+a})};Array.prototype.scaleArp=function(n="major",e=0){const t=eR(zo(n));let r=[];e=e>t.length?t.length:e,e=e==0?t.length:e;for(let i=0;i>1|(Mt&21845)<<1;Ri=(Ri&52428)>>2|(Ri&13107)<<2,Ri=(Ri&61680)>>4|(Ri&3855)<<4,Lm[Mt]=((Ri&65280)>>8|(Ri&255)<<8)>>1}var Hn=function(n,e,t){for(var r=n.length,i=0,a=new Kr(e);i>l]=c}else for(o=new Kr(r),i=0;i>15-n[i]);return o},qi=new ur(288);for(var Mt=0;Mt<144;++Mt)qi[Mt]=8;for(var Mt=144;Mt<256;++Mt)qi[Mt]=9;for(var Mt=256;Mt<280;++Mt)qi[Mt]=7;for(var Mt=280;Mt<288;++Mt)qi[Mt]=8;var wo=new ur(32);for(var Mt=0;Mt<32;++Mt)wo[Mt]=5;var C3=Hn(qi,9,0),y3=Hn(qi,9,1),A3=Hn(wo,5,0),R3=Hn(wo,5,1),Mu=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},gn=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},Pu=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},$g=function(n){return(n+7)/8|0},Qg=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new ur(t-e);return r.set(n.subarray(e,t)),r},I3=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Mr=function(n,e,t){var r=new Error(e||I3[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Mr),!t)throw r;return r},qg=function(n,e,t,r){var i=n.length,a=r?r.length:0;if(!i||e.f&&!e.l)return t||new ur(0);var s=!t||e.i!=2,o=e.i;t||(t=new ur(i*3));var l=function(Ve){var et=t.length;if(Ve>et){var nt=new ur(Math.max(et*2,Ve));nt.set(t),t=nt}},c=e.f||0,u=e.p||0,p=e.b||0,m=e.l,_=e.d,b=e.m,A=e.n,R=i*8;do{if(!m){c=gn(n,u,1);var k=gn(n,u+1,3);if(u+=3,k)if(k==1)m=y3,_=R3,b=9,A=5;else if(k==2){var E=gn(n,u,31)+257,S=gn(n,u+10,15)+4,I=E+gn(n,u+5,31)+1;u+=14;for(var x=new ur(I),w=new ur(19),L=0;L>4;if(Y<16)x[L++]=Y;else{var ee=0,M=0;for(Y==16?(M=3+gn(n,u,3),u+=2,ee=x[L-1]):Y==17?(M=3+gn(n,u,7),u+=3):Y==18&&(M=11+gn(n,u,127),u+=7);M--;)x[L++]=ee}}var $=x.subarray(0,E),j=x.subarray(E);b=Mu($),A=Mu(j),m=Hn($,b,1),_=Hn(j,A,1)}else Mr(1);else{var Y=$g(u)+4,Z=n[Y-4]|n[Y-3]<<8,h=Y+Z;if(h>i){o&&Mr(0);break}s&&l(p+Z),t.set(n.subarray(Y,h),p),e.b=p+=Z,e.p=u=h*8,e.f=c;continue}if(u>R){o&&Mr(0);break}}s&&l(p+131072);for(var X=(1<>4;if(u+=ee&15,u>R){o&&Mr(0);break}if(ee||Mr(2),Oe<256)t[p++]=Oe;else if(Oe==256){le=u,m=null;break}else{var ke=Oe-254;if(Oe>264){var L=Oe-257,Me=Fc[L];ke=gn(n,u,(1<>4;Ee||Mr(3),u+=Ee&15;var j=v3[Ie];if(Ie>3){var Me=Yc[Ie];j+=Pu(n,u)&(1<R){o&&Mr(0);break}s&&l(p+131072);var ue=p+ke;if(p>8},Xs=function(n,e,t){t<<=e&7;var r=e/8|0;n[r]|=t,n[r+1]|=t>>8,n[r+2]|=t>>16},Bu=function(n,e){for(var t=[],r=0;rm&&(m=a[r].s);var _=new Kr(m+1),b=Mm(t[u-1],_,0);if(b>e){var r=0,A=0,R=b-e,k=1<e)A+=k-(1<>=R;A>0;){var Z=a[r].s;_[Z]=0&&A;--r){var h=a[r].s;_[h]==e&&(--_[h],++A)}b=e}return{t:new ur(_),l:b}},Mm=function(n,e,t){return n.s==-1?Math.max(Mm(n.l,e,t+1),Mm(n.r,e,t+1)):e[n.s]=t},jO=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new Kr(++e),r=0,i=n[0],a=1,s=function(l){t[r++]=l},o=1;o<=e;++o)if(n[o]==i&&o!=e)++a;else{if(!i&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(i),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(i);a=1,i=n[o]}return{c:t.subarray(0,r),n:e}},Zs=function(n,e){for(var t=0,r=0;r>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var a=0;a4&&!L[xm[te-1]];--te);var ne=c+5<<3,re=Zs(i,qi)+Zs(a,wo)+s,ee=Zs(i,m)+Zs(a,A)+s+14+3*te+Zs(I,L)+2*I[16]+3*I[17]+7*I[18];if(l>=0&&ne<=re&&ne<=ee)return gR(e,u,n.subarray(l,l+c));var M,$,j,X;if(ii(e,u,1+(ee15&&(ii(e,u,ke[x]>>5&127),u+=ke[x]>>12)}}else M=C3,$=qi,j=A3,X=wo;for(var x=0;x255){var Me=Ee>>18&31;Xs(e,u,M[Me+257]),u+=$[Me+257],Me>7&&(ii(e,u,Ee>>23&31),u+=Fc[Me]);var Ie=Ee&31;Xs(e,u,j[Ie]),u+=X[Ie],Ie>3&&(Xs(e,u,Ee>>5&8191),u+=Yc[Ie])}else Xs(e,u,M[Ee]),u+=$[Ee]}return Xs(e,u,M[256]),u+$[256]},N3=new Gg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),_R=new ur(0),w3=function(n,e,t,r,i,a){var s=a.z||n.length,o=new ur(r+s+5*(1+Math.ceil(s/7e3))+i),l=o.subarray(r,o.length-i),c=a.l,u=(a.r||0)&7;if(e){u&&(l[0]=a.r>>3);for(var p=N3[e-1],m=p>>13,_=p&8191,b=(1<7e3||L>24576)&&(M>423||!c)){u=JO(n,l,0,h,E,S,x,L,te,w-te,u),L=I=x=0,te=w;for(var $=0;$<286;++$)E[$]=0;for(var $=0;$<30;++$)S[$]=0}var j=2,X=0,ce=_,le=re-ee&32767;if(M>2&&ne==Z(w-le))for(var Oe=Math.min(m,M)-1,ke=Math.min(32767,w),Me=Math.min(258,M);le<=ke&&--ce&&re!=ee;){if(n[w+j]==n[w+j-le]){for(var Ee=0;Eej){if(j=Ee,X=le,Ee>Oe)break;for(var Ie=Math.min(le,Ee-2),ue=0,$=0;$ue&&(ue=Ve,ee=De)}}}re=ee,ee=A[re],le+=re-ee&32767}if(X){h[L++]=268435456|km[j]<<18|KO[X];var et=km[j]&31,nt=KO[X]&31;x+=Fc[et]+Yc[nt],++E[257+et],++S[nt],G=w+j,++I}else h[L++]=n[w],++E[n[w]]}}for(w=Math.max(w,G);w=s&&(l[u/8|0]=c,Ke=s),u=gR(l,u+1,n.subarray(w,Ke))}a.i=s}return Qg(o,0,r+$g(u)+i)},D3=function(){for(var n=new Int32Array(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(t&1&&-306674912)^t>>>1;n[e]=t}return n}(),x3=function(){var n=-1;return{p:function(e){for(var t=n,r=0;r>>8;n=t},d:function(){return~n}}},k3=function(n,e,t,r,i){if(!i&&(i={l:1},e.dictionary)){var a=e.dictionary.subarray(-32768),s=new ur(a.length+n.length);s.set(a),s.set(n,a.length),n=s,i.w=a.length}return w3(n,e.level==null?6:e.level,e.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):12+e.mem,t,r,i)},Pm=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},L3=function(n,e){var t=e.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=e.level<2?4:e.level==9?2:0,n[9]=3,e.mtime!=0&&Pm(n,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){n[3]=8;for(var r=0;r<=t.length;++r)n[r+10]=t.charCodeAt(r)}},M3=function(n){(n[0]!=31||n[1]!=139||n[2]!=8)&&Mr(6,"invalid gzip data");var e=n[3],t=10;e&4&&(t+=(n[10]|n[11]<<8)+2);for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!n[t++]);return t+(e&2)},P3=function(n){var e=n.length;return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0},B3=function(n){return 10+(n.filename?n.filename.length+1:0)},U3=function(n,e){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Mr(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&Mr(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function F3(n,e){return qg(n,{i:2},e&&e.out,e&&e.dictionary)}function Y3(n,e){e||(e={});var t=x3(),r=n.length;t.p(n);var i=k3(n,e,B3(e),8),a=i.length;return L3(i,e),Pm(i,a-8,t.d()),Pm(i,a-4,r),i}function G3(n,e){var t=M3(n);return t+8>n.length&&Mr(6,"invalid gzip data"),qg(n.subarray(t,-8),{i:2},e&&e.out||new ur(P3(n)),e&&e.dictionary)}function $3(n,e){return qg(n.subarray(U3(n,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function Q3(n,e){return n[0]==31&&n[1]==139&&n[2]==8?G3(n,e):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?F3(n,e):$3(n,e)}var Bm=typeof TextDecoder<"u"&&new TextDecoder,q3=0;try{Bm.decode(_R,{stream:!0}),q3=1}catch{}var V3=function(n){for(var e="",t=0;;){var r=n[t++],i=(r>127)+(r>223)+(r>239);if(t+i>n.length)return{s:e,r:Qg(n,t-1)};i?i==3?(r=((r&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?e+=String.fromCharCode((r&31)<<6|n[t++]&63):e+=String.fromCharCode((r&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(r)}};function z3(n,e){if(e){for(var t="",r=0;r (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,describe:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,describe:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",describe:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,describe:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,describe:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,describe:"Support for HTML Tag escaping. ex:
foo
",type:"boolean"},emoji:{defaultValue:!1,describe:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,describe:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},ellipsis:{defaultValue:!0,describe:"Replaces three dots with the ellipsis unicode character",type:"boolean"},completeHTMLDocument:{defaultValue:!1,describe:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,describe:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,describe:"Split adjacent blockquote blocks",type:"boolean"}};if(h===!1)return JSON.parse(JSON.stringify(E));var S={};for(var I in E)E.hasOwnProperty(I)&&(S[I]=E[I].defaultValue);return S}function t(){var h=e(!0),E={};for(var S in h)h.hasOwnProperty(S)&&(E[S]=!0);return E}var r={},i={},a={},s=e(!0),o="vanilla",l={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:e(!0),allOn:t()};r.helper={},r.extensions={},r.setOption=function(h,E){return s[h]=E,this},r.getOption=function(h){return s[h]},r.getOptions=function(){return s},r.resetOptions=function(){s=e(!0)},r.setFlavor=function(h){if(!l.hasOwnProperty(h))throw Error(h+" flavor was not found");r.resetOptions();var E=l[h];o=h;for(var S in E)E.hasOwnProperty(S)&&(s[S]=E[S])},r.getFlavor=function(){return o},r.getFlavorOptions=function(h){if(l.hasOwnProperty(h))return l[h]},r.getDefaultOptions=function(h){return e(h)},r.subParser=function(h,E){if(r.helper.isString(h))if(typeof E<"u")i[h]=E;else{if(i.hasOwnProperty(h))return i[h];throw Error("SubParser named "+h+" not registered!")}},r.extension=function(h,E){if(!r.helper.isString(h))throw Error("Extension 'name' must be a string");if(h=r.helper.stdExtName(h),r.helper.isUndefined(E)){if(!a.hasOwnProperty(h))throw Error("Extension named "+h+" is not registered!");return a[h]}else{typeof E=="function"&&(E=E()),r.helper.isArray(E)||(E=[E]);var S=c(E,h);if(S.valid)a[h]=E;else throw Error(S.error)}},r.getAllExtensions=function(){return a},r.removeExtension=function(h){delete a[h]},r.resetExtensions=function(){a={}};function c(h,E){var S=E?"Error in "+E+" extension->":"Error in unnamed extension",I={valid:!0,error:""};r.helper.isArray(h)||(h=[h]);for(var x=0;x"u"},r.helper.forEach=function(h,E){if(r.helper.isUndefined(h))throw new Error("obj param is required");if(r.helper.isUndefined(E))throw new Error("callback param is required");if(!r.helper.isFunction(E))throw new Error("callback param must be a function/closure");if(typeof h.forEach=="function")h.forEach(E);else if(r.helper.isArray(h))for(var S=0;S").replace(/&/g,"&")};var p=function(h,E,S,I){var x=I||"",w=x.indexOf("g")>-1,L=new RegExp(E+"|"+S,"g"+x.replace(/g/g,"")),G=new RegExp(E,x.replace(/g/g,"")),te=[],ne,re,ee,M,$;do for(ne=0;ee=L.exec(h);)if(G.test(ee[0]))ne++||(re=L.lastIndex,M=re-ee[0].length);else if(ne&&!--ne){$=ee.index+ee[0].length;var j={left:{start:M,end:re},match:{start:re,end:ee.index},right:{start:ee.index,end:$},wholeMatch:{start:M,end:$}};if(te.push(j),!w)return te}while(ne&&(L.lastIndex=re));return te};r.helper.matchRecursiveRegExp=function(h,E,S,I){for(var x=p(h,E,S,I),w=[],L=0;L0){var ne=[];L[0].wholeMatch.start!==0&&ne.push(h.slice(0,L[0].wholeMatch.start));for(var re=0;re=0?I+(S||0):I},r.helper.splitAtIndex=function(h,E){if(!r.helper.isString(h))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[h.substring(0,E),h.substring(E)]},r.helper.encodeEmailAddress=function(h){var E=[function(S){return"&#"+S.charCodeAt(0)+";"},function(S){return"&#x"+S.charCodeAt(0).toString(16)+";"},function(S){return S}];return h=h.replace(/./g,function(S){if(S==="@")S=E[Math.floor(Math.random()*2)](S);else{var I=Math.random();S=I>.9?E[2](S):I>.45?E[1](S):E[0](S)}return S}),h},r.helper.padEnd=function(E,S,I){return S=S>>0,I=String(I||" "),E.length>S?String(E):(S=S-E.length,S>I.length&&(I+=I.repeat(S/I.length)),String(E)+I.slice(0,S))},typeof console>"u"&&(console={warn:function(h){alert(h)},log:function(h){alert(h)},error:function(h){throw h}}),r.helper.regexes={asteriskDashAndColon:/([*_:~])/g},r.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:`S`},r.Converter=function(h){var E={},S=[],I=[],x={},w=o,L={parsed:{},raw:"",format:""};G();function G(){h=h||{};for(var M in s)s.hasOwnProperty(M)&&(E[M]=s[M]);if(typeof h=="object")for(var $ in h)h.hasOwnProperty($)&&(E[$]=h[$]);else throw Error("Converter expects the passed parameter to be an object, but "+typeof h+" was passed instead.");E.extensions&&r.helper.forEach(E.extensions,te)}function te(M,$){if($=$||null,r.helper.isString(M))if(M=r.helper.stdExtName(M),$=M,r.extensions[M]){console.warn("DEPRECATION WARNING: "+M+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),ne(r.extensions[M],M);return}else if(!r.helper.isUndefined(a[M]))M=a[M];else throw Error('Extension "'+M+'" could not be loaded. It was either not found or is not a valid extension.');typeof M=="function"&&(M=M()),r.helper.isArray(M)||(M=[M]);var j=c(M,$);if(!j.valid)throw Error(j.error);for(var X=0;X>",!1),Zt=lt("<<",!1),yt=lt("<",!1),$e=lt(">",!1),vr=lt("_",!1),jn=lt("?",!1),ft=lt("r",!1),xr=lt("#",!1),mr=lt("b",!1),Oi=Nn([["a","z"],["A","Z"],["0","9"],"-","*","+"],!1,!1),Rn=Nn([["A","G"]],!1,!1),Qt=Nn(["b","s"],!1,!1),hn=lt("iii",!1),zi=lt("ii",!1),Ei=lt("iv",!1),Hi=lt("i",!1),en=lt("vii",!1),Jn=lt("vi",!1),fn=lt("v",!1),Wt=function(y){return y.filter(P=>P)},bi=function(){return parseFloat(gr())},Ti=function(){return parseInt(gr())},q=function(){return parseInt(gr())},ie=function(){},de=function(){return jM[gr()]},ge=function(y){return y.filter(P=>P)},Ce=function(y,P){return P?Pe(QO,{item:y,times:P}):Pe(qO,{items:y})},qe=function(y){return y},Be=function(y,P,Q){return Pe(hP,{left:y,operation:P,right:Q})},At=function(y,P){return Pe(pP,{items:y,times:P})},Cr=function(y){return Pe(KA,{items:y})},Fr=function(y){return y.map(P=>typeof P=="number"?P:void 0)},Aa=function(){return Math.ceil(XA(gr()))},Wi=function(y){var P=y.filter(Q=>Q).map(Q=>Pe(di,{pitch:Q[0]},Q.toString()));return Pe(qO,{items:P})},Ts=function(y){return y},Yr=function(){},vs=function(y){return Pe(Lg,{items:y})},Ra=function(y){return Pe(uP,{octave:y})},Ia=function(){return gr().split("").reduce((y,P)=>y+(P==="^"?1:-1),0)},Cs=function(){return Pe($O,{seededRandom:a.seededRandom})},Na=function(y,P){return Pe($O,{min:y,max:P,seededRandom:a.seededRandom})},ys=function(y,P){return Pe(QO,{item:y,times:P})},wa=function(y){return Pe(dP,{duration:y})},kr=function(y){return Pe(Em,{duration:y})},As=function(y,P,Q,K){const oe=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return Pe(di,{duration:P,pitch:K,octave:oe,add:Q})},Rs=function(y){return y.reduce((P,Q)=>P+(Q==="#"?1:-1),0)},Da=function(y,P,Q,K){const oe=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return Pe(va,{pitches:[P].concat(Q),inversion:K,octave:oe})},xa=function(){return gr()},Is=function(y){return y},ka=function(){return gr()},Ns=function(y,P,Q,K,oe){const me=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",we=a.nodeOptions.key?a.nodeOptions.key:"C",ut=TP(K,Q,me,y,P),Rt=P||a.nodeOptions.duration,Vt=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return Pe(va,{duration:Rt,octave:Vt,pitches:ut,chordName:K,inversion:oe,scaleName:me,key:we})},La=function(y,P,Q,K,oe){const me=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",we=a.nodeOptions.key?a.nodeOptions.key:"C",ut=y?a.nodeOptions.octave+y:a.nodeOptions.octave,Rt=P||a.nodeOptions.duration;return Pe(cP,{duration:Rt,roman:Q,octave:ut,chordName:K,inversion:oe,scaleName:me,key:we})},ws=function(y,P,Q){const K=y?a.nodeOptions.octave+y:a.nodeOptions.octave,oe=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",me=a.nodeOptions.key?a.nodeOptions.key:"C",we=wP(Q,me,oe);return P||a.nodeOptions.duration,Pe(di,{duration:P,pitch:we.pc,octave:we.octave+K,add:we.add,scaleName:oe,key:me})},N=0,Je=0,_t=[{line:1,column:1}],Lr=0,In=[],ve=0,Te={},vi;if("startRule"in a){if(!(a.startRule in l))throw new Error(`Can't start parsing from rule "`+a.startRule+'".');c=l[a.startRule]}function gr(){return i.substring(Je,N)}function Ma(){return wn(Je,N)}function lt(y,P){return{type:"literal",text:y,ignoreCase:P}}function Nn(y,P,Q){return{type:"class",parts:y,inverted:P,ignoreCase:Q}}function Ci(){return{type:"end"}}function Pa(y){return{type:"other",description:y}}function ei(y){var P=_t[y],Q;if(P)return P;for(Q=y-1;!_t[Q];)Q--;for(P=_t[Q],P={line:P.line,column:P.column};QLr&&(Lr=N,In=[]),In.push(y))}function Xi(y,P,Q){return new e(e.buildMessage(y,P),y,P,Q)}function Dn(){var y,P,Q=N*41+0,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,P=Zi(),P!==s&&(Je=y,P=Wt(P)),y=P,Te[Q]={nextPos:N,result:y},y)}function sr(){var y,P,Q,K,oe,me,we,ut=N*41+1,Rt=Te[ut];if(Rt)return N=Rt.nextPos,Rt.result;for(y=N,P=N,i.charCodeAt(N)===45?(Q=u,N++):(Q=s,ve===0&&Ae(mt)),Q===s&&(Q=null),K=[],De.test(i.charAt(N))?(oe=i.charAt(N),N++):(oe=s,ve===0&&Ae(it));oe!==s;)K.push(oe),De.test(i.charAt(N))?(oe=i.charAt(N),N++):(oe=s,ve===0&&Ae(it));if(i.charCodeAt(N)===46?(oe=p,N++):(oe=s,ve===0&&Ae(Ct)),oe!==s){if(me=[],De.test(i.charAt(N))?(we=i.charAt(N),N++):(we=s,ve===0&&Ae(it)),we!==s)for(;we!==s;)me.push(we),De.test(i.charAt(N))?(we=i.charAt(N),N++):(we=s,ve===0&&Ae(it));else me=s;me!==s?(Q=[Q,K,oe,me],P=Q):(N=P,P=s)}else N=P,P=s;if(P===s)if(P=N,i.charCodeAt(N)===46?(Q=p,N++):(Q=s,ve===0&&Ae(Ct)),Q!==s){if(K=[],De.test(i.charAt(N))?(oe=i.charAt(N),N++):(oe=s,ve===0&&Ae(it)),oe!==s)for(;oe!==s;)K.push(oe),De.test(i.charAt(N))?(oe=i.charAt(N),N++):(oe=s,ve===0&&Ae(it));else K=s;K!==s?(Q=[Q,K],P=Q):(N=P,P=s)}else N=P,P=s;return P!==s&&(Je=y,P=bi()),y=P,Te[ut]={nextPos:N,result:y},y}function ti(){var y,P,Q=N*41+2,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,i.charCodeAt(N)===45?N++:ve===0&&Ae(mt),De.test(i.charAt(N))?(P=i.charAt(N),N++):(P=s,ve===0&&Ae(it)),P!==s?(Je=y,y=Ti()):(N=y,y=s),Te[Q]={nextPos:N,result:y},y)}function _r(){var y,P,Q,K=N*41+3,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,i.charCodeAt(N)===45?N++:ve===0&&Ae(mt),P=[],De.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(it)),Q!==s)for(;Q!==s;)P.push(Q),De.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(it));else P=s;return P!==s?(Je=y,y=q()):(N=y,y=s),Te[K]={nextPos:N,result:y},y}function ri(){var y,P,Q=N*41+4,K=Te[Q];return K?(N=K.nextPos,K.result):(ve++,y=N,Ze.test(i.charAt(N))?(P=i.charAt(N),N++):(P=s,ve===0&&Ae(st)),P!==s&&(Je=y,P=ie()),y=P,ve--,y===s&&(P=s,ve===0&&Ae(Nt)),Te[Q]={nextPos:N,result:y},y)}function Ho(){var y,P,Q=N*41+9,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,Ve.test(i.charAt(N))?(P=i.charAt(N),N++):(P=s,ve===0&&Ae(pt)),P!==s&&(Je=y,P=de()),y=P,Te[Q]={nextPos:N,result:y},y)}function ni(){var y,P=N*41+10,Q=Te[P];return Q?(N=Q.nextPos,Q.result):(y=Ho(),y===s&&(y=sr()),Te[P]={nextPos:N,result:y},y)}function Zi(){var y,P,Q,K=N*41+11,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,P=[],Q=C(),Q===s&&(Q=Ds(),Q===s&&(Q=ks(),Q===s&&(Q=Ki(),Q===s&&(Q=xs(),Q===s&&(Q=Ji(),Q===s&&(Q=d())))))),Q!==s)for(;Q!==s;)P.push(Q),Q=C(),Q===s&&(Q=Ds(),Q===s&&(Q=ks(),Q===s&&(Q=Ki(),Q===s&&(Q=xs(),Q===s&&(Q=Ji(),Q===s&&(Q=d()))))));else P=s;return P!==s&&(Je=y,P=ge(P)),y=P,Te[K]={nextPos:N,result:y},y}function Ki(){var y,P,Q,K,oe,me=N*41+12,we=Te[me];return we?(N=we.nextPos,we.result):(y=N,i.charCodeAt(N)===40?(P=b,N++):(P=s,ve===0&&Ae(We)),P!==s?(i.charCodeAt(N)===58?N++:ve===0&&Ae(hr),Q=Zi(),Q!==s?(K=Wo(),K===s&&(K=null),i.charCodeAt(N)===41?(oe=R,N++):(oe=s,ve===0&&Ae(qt)),oe!==s?(Je=y,y=Ce(Q,K)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[me]={nextPos:N,result:y},y)}function Wo(){var y,P,Q,K=N*41+13,oe=Te[K];return oe?(N=oe.nextPos,oe.result):(y=N,i.charCodeAt(N)===58?(P=A,N++):(P=s,ve===0&&Ae(hr)),P!==s?(Q=_r(),Q!==s?(Je=y,y=qe(Q)):(N=y,y=s)):(N=y,y=s),Te[K]={nextPos:N,result:y},y)}function Ds(){var y,P,Q,K,oe=N*41+14,me=Te[oe];return me?(N=me.nextPos,me.result):(y=N,P=Ki(),P!==s?(Q=Ms(),Q!==s?(K=Ki(),K!==s?(Je=y,y=Be(P,Q,K)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[oe]={nextPos:N,result:y},y)}function xs(){var y,P,Q,K,oe,me=N*41+15,we=Te[me];return we?(N=we.nextPos,we.result):(y=N,i.substr(N,2)===k?(P=k,N+=2):(P=s,ve===0&&Ae(fr)),P!==s?(Q=Zi(),Q!==s?(K=Wo(),K===s&&(K=null),i.charCodeAt(N)===93?(oe=Y,N++):(oe=s,ve===0&&Ae(W)),oe!==s?(Je=y,y=At(Q,K)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[me]={nextPos:N,result:y},y)}function ks(){var y,P,Q,K,oe=N*41+16,me=Te[oe];return me?(N=me.nextPos,me.result):(y=N,i.charCodeAt(N)===91?(P=Z,N++):(P=s,ve===0&&Ae(_e)),P!==s?(Q=Zi(),Q!==s?(i.charCodeAt(N)===93?(K=Y,N++):(K=s,ve===0&&Ae(W)),K!==s?(Je=y,y=Cr(Q)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[oe]={nextPos:N,result:y},y)}function ji(){var y,P=N*41+17,Q=Te[P];return Q?(N=Q.nextPos,Q.result):(y=_r(),y===s&&(y=ti()),Te[P]={nextPos:N,result:y},y)}function Ba(){var y,P,Q,K=N*41+18,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,P=[],Q=Ls(),Q===s&&(Q=ji()),Q!==s)for(;Q!==s;)P.push(Q),Q=Ls(),Q===s&&(Q=ji());else P=s;return P!==s&&(Je=y,P=Fr(P)),y=P,Te[K]={nextPos:N,result:y},y}function Ls(){var y,P,Q,K,oe=N*41+19,me=Te[oe];return me?(N=me.nextPos,me.result):(y=N,i.charCodeAt(N)===40?N++:ve===0&&Ae(We),P=ji(),P!==s?(Q=Ms(),Q!==s?(K=Ba(),K!==s?(i.charCodeAt(N)===41?N++:ve===0&&Ae(qt),Je=y,y=Aa()):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[oe]={nextPos:N,result:y},y)}function Xo(){var y,P,Q,K,oe=N*41+20,me=Te[oe];if(me)return N=me.nextPos,me.result;if(y=N,i.charCodeAt(N)===123?(P=h,N++):(P=s,ve===0&&Ae(Le)),P!==s){if(Q=[],K=Ba(),K===s&&(K=ri()),K!==s)for(;K!==s;)Q.push(K),K=Ba(),K===s&&(K=ri());else Q=s;Q!==s?(i.charCodeAt(N)===125?(K=E,N++):(K=s,ve===0&&Ae(xe)),K!==s?(Je=y,y=Wi(Q)):(N=y,y=s)):(N=y,y=s)}else N=y,y=s;return Te[oe]={nextPos:N,result:y},y}function Ms(){var y,P=N*41+21,Q=Te[P];return Q?(N=Q.nextPos,Q.result):(i.charCodeAt(N)===43?(y=S,N++):(y=s,ve===0&&Ae(rt)),y===s&&(i.charCodeAt(N)===45?(y=u,N++):(y=s,ve===0&&Ae(mt)),y===s&&(i.charCodeAt(N)===42?(y=I,N++):(y=s,ve===0&&Ae(Ne)),y===s&&(i.charCodeAt(N)===47?(y=x,N++):(y=s,ve===0&&Ae($t)),y===s&&(i.charCodeAt(N)===37?(y=w,N++):(y=s,ve===0&&Ae(ht)),y===s&&(i.charCodeAt(N)===94?(y=L,N++):(y=s,ve===0&&Ae(Ot)),y===s&&(i.charCodeAt(N)===124?(y=_,N++):(y=s,ve===0&&Ae(Tr)),y===s&&(i.charCodeAt(N)===38?(y=G,N++):(y=s,ve===0&&Ae(Jr)),y===s&&(i.substr(N,2)===te?(y=te,N+=2):(y=s,ve===0&&Ae(gt)),y===s&&(i.substr(N,2)===ne?(y=ne,N+=2):(y=s,ve===0&&Ae(Zt))))))))))),Te[P]={nextPos:N,result:y},y)}function Ji(){var y,P,Q=N*41+22,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,P=U(),P===s&&(P=ye(),P===s&&(P=ae(),P===s&&(P=Se(),P===s&&(P=z(),P===s&&(P=B(),P===s&&(P=f(),P===s&&(P=ri(),P===s&&(P=D(),P===s&&(P=O(),P===s&&(P=v(),P===s&&(P=Ki(),P===s&&(P=Xo(),P===s&&(P=$c()))))))))))))),P!==s&&(Je=y,P=Ts(P)),y=P,Te[Q]={nextPos:N,result:y},y)}function $c(){var y,P,Q=N*41+23,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,i.charCodeAt(N)===124?(P=_,N++):(P=s,ve===0&&Ae(Tr)),P!==s&&(Je=y,P=Yr()),y=P,Te[Q]={nextPos:N,result:y},y)}function d(){var y,P,Q,K,oe=N*41+24,me=Te[oe];return me?(N=me.nextPos,me.result):(y=N,i.charCodeAt(N)===60?(P=re,N++):(P=s,ve===0&&Ae(yt)),P!==s?(Q=Zi(),Q!==s?(i.charCodeAt(N)===62?(K=ee,N++):(K=s,ve===0&&Ae($e)),K!==s?(Je=y,y=vs(Q)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[oe]={nextPos:N,result:y},y)}function f(){var y,P,Q=N*41+25,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,P=g(),P!==s&&(Je=y,P=Ra(P)),y=P,Te[Q]={nextPos:N,result:y},y)}function g(){var y,P,Q,K=N*41+26,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,P=[],i.charCodeAt(N)===94?(Q=L,N++):(Q=s,ve===0&&Ae(Ot)),Q===s&&(i.charCodeAt(N)===95?(Q=M,N++):(Q=s,ve===0&&Ae(vr))),Q!==s)for(;Q!==s;)P.push(Q),i.charCodeAt(N)===94?(Q=L,N++):(Q=s,ve===0&&Ae(Ot)),Q===s&&(i.charCodeAt(N)===95?(Q=M,N++):(Q=s,ve===0&&Ae(vr)));else P=s;return P!==s&&(Je=y,P=Ia()),y=P,Te[K]={nextPos:N,result:y},y}function O(){var y,P,Q=N*41+27,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,i.charCodeAt(N)===63?(P=$,N++):(P=s,ve===0&&Ae(jn)),P!==s&&(Je=y,P=Cs()),y=P,Te[Q]={nextPos:N,result:y},y)}function v(){var y,P,Q,K,oe,me,we=N*41+28,ut=Te[we];return ut?(N=ut.nextPos,ut.result):(y=N,i.charCodeAt(N)===40?(P=b,N++):(P=s,ve===0&&Ae(We)),P!==s?(Q=ti(),Q!==s?(i.charCodeAt(N)===44?(K=m,N++):(K=s,ve===0&&Ae(Ge)),K!==s?(oe=ti(),oe!==s?(i.charCodeAt(N)===41?(me=R,N++):(me=s,ve===0&&Ae(qt)),me!==s?(Je=y,y=Na(Q,oe)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[we]={nextPos:N,result:y},y)}function C(){var y,P,Q,K,oe,me,we=N*41+29,ut=Te[we];return ut?(N=ut.nextPos,ut.result):(y=N,P=Ji(),P!==s?(i.charCodeAt(N)===58?(Q=A,N++):(Q=s,ve===0&&Ae(hr)),Q!==s?(K=_r(),K!==s?(oe=N,ve++,i.charCodeAt(N)===41?(me=R,N++):(me=s,ve===0&&Ae(qt)),me===s&&(i.charCodeAt(N)===93?(me=Y,N++):(me=s,ve===0&&Ae(W))),ve--,me===s?oe=void 0:(N=oe,oe=s),oe!==s?(Je=y,y=ys(P,K)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[we]={nextPos:N,result:y},y)}function D(){var y,P,Q=N*41+30,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,P=ni(),P!==s&&(Je=y,P=wa(P)),y=P,Te[Q]={nextPos:N,result:y},y)}function U(){var y,P,Q,K=N*41+31,oe=Te[K];return oe?(N=oe.nextPos,oe.result):(y=N,P=ni(),P===s&&(P=null),i.charCodeAt(N)===114?(Q=j,N++):(Q=s,ve===0&&Ae(ft)),Q!==s?(Je=y,y=kr(P)):(N=y,y=s),Te[K]={nextPos:N,result:y},y)}function B(){var y,P,Q,K,oe,me=N*41+32,we=Te[me];return we?(N=we.nextPos,we.result):(y=N,P=g(),P===s&&(P=null),Q=ni(),Q===s&&(Q=null),K=H(),K===s&&(K=null),oe=ti(),oe!==s?(Je=y,y=As(P,Q,K,oe)):(N=y,y=s),Te[me]={nextPos:N,result:y},y)}function H(){var y,P,Q,K=N*41+33,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,P=[],i.charCodeAt(N)===35?(Q=X,N++):(Q=s,ve===0&&Ae(xr)),Q===s&&(i.charCodeAt(N)===98?(Q=ce,N++):(Q=s,ve===0&&Ae(mr))),Q!==s)for(;Q!==s;)P.push(Q),i.charCodeAt(N)===35?(Q=X,N++):(Q=s,ve===0&&Ae(xr)),Q===s&&(i.charCodeAt(N)===98?(Q=ce,N++):(Q=s,ve===0&&Ae(mr)));else P=s;return P!==s&&(Je=y,P=Rs(P)),y=P,Te[K]={nextPos:N,result:y},y}function z(){var y,P,Q,K,oe,me=N*41+34,we=Te[me];if(we)return N=we.nextPos,we.result;if(y=N,P=g(),P===s&&(P=null),Q=B(),Q!==s){if(K=[],oe=B(),oe!==s)for(;oe!==s;)K.push(oe),oe=B();else K=s;K!==s?(oe=he(),oe===s&&(oe=null),Je=y,y=Da(P,Q,K,oe)):(N=y,y=s)}else N=y,y=s;return Te[me]={nextPos:N,result:y},y}function pe(){var y,P,Q,K=N*41+35,oe=Te[K];if(oe)return N=oe.nextPos,oe.result;if(y=N,P=[],et.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(Oi)),Q!==s)for(;Q!==s;)P.push(Q),et.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(Oi));else P=s;return P!==s&&(Je=y,P=xa()),y=P,Te[K]={nextPos:N,result:y},y}function he(){var y,P,Q,K=N*41+36,oe=Te[K];return oe?(N=oe.nextPos,oe.result):(y=N,i.charCodeAt(N)===37?(P=w,N++):(P=s,ve===0&&Ae(ht)),P!==s?(Q=_r(),Q!==s?(Je=y,y=Is(Q)):(N=y,y=s)):(N=y,y=s),Te[K]={nextPos:N,result:y},y)}function se(){var y,P,Q=N*41+37,K=Te[Q];return K?(N=K.nextPos,K.result):(y=N,nt.test(i.charAt(N))?(P=i.charAt(N),N++):(P=s,ve===0&&Ae(Rn)),P!==s?(Ke.test(i.charAt(N))?(i.charAt(N),N++):ve===0&&Ae(Qt),Je=y,y=ka()):(N=y,y=s),Te[Q]={nextPos:N,result:y},y)}function ae(){var y,P,Q,K,oe,me,we=N*41+38,ut=Te[we];return ut?(N=ut.nextPos,ut.result):(y=N,P=g(),P===s&&(P=null),Q=ni(),Q===s&&(Q=null),K=se(),K!==s?(i.charCodeAt(N)===94?N++:ve===0&&Ae(Ot),oe=pe(),oe!==s?(me=he(),me===s&&(me=null),Je=y,y=Ns(P,Q,K,oe,me)):(N=y,y=s)):(N=y,y=s),Te[we]={nextPos:N,result:y},y)}function ye(){var y,P,Q,K,oe,me,we=N*41+39,ut=Te[we];return ut?(N=ut.nextPos,ut.result):(y=N,P=g(),P===s&&(P=null),Q=ni(),Q===s&&(Q=null),i.substr(N,3)===le?(K=le,N+=3):(K=s,ve===0&&Ae(hn)),K===s&&(i.substr(N,2)===Oe?(K=Oe,N+=2):(K=s,ve===0&&Ae(zi)),K===s&&(i.substr(N,2)===ke?(K=ke,N+=2):(K=s,ve===0&&Ae(Ei)),K===s&&(i.charCodeAt(N)===105?(K=Me,N++):(K=s,ve===0&&Ae(Hi)),K===s&&(i.substr(N,3)===Ee?(K=Ee,N+=3):(K=s,ve===0&&Ae(en)),K===s&&(i.substr(N,2)===Ie?(K=Ie,N+=2):(K=s,ve===0&&Ae(Jn)),K===s&&(i.charCodeAt(N)===118?(K=ue,N++):(K=s,ve===0&&Ae(fn)))))))),K!==s?(i.charCodeAt(N)===94?N++:ve===0&&Ae(Ot),oe=pe(),oe===s&&(oe=null),me=he(),me===s&&(me=null),Je=y,y=La(P,Q,K,oe,me)):(N=y,y=s),Te[we]={nextPos:N,result:y},y)}function Se(){var y,P,Q,K,oe=N*41+40,me=Te[oe];return me?(N=me.nextPos,me.result):(y=N,P=g(),P===s&&(P=null),Q=ni(),Q===s&&(Q=null),K=se(),K!==s?(Je=y,y=ws(P,Q,K)):(N=y,y=s),Te[oe]={nextPos:N,result:y},y)}var ze=a.nodeOptions||{};function Pe(y,P,Q=void 0){P.text=Q||gr(),P.location=Ma();for(var K in ze)(P[K]===void 0||P[K]===null)&&(P[K]=ze[K]);return new y(P)}if(vi=c(),vi!==s&&N===i.length)return vi;throw vi!==s&&Ne.collect("pitch"))}notes(){return this.evaluated.map(e=>e.collect("note"))}freqs(){return this.evaluated.map(e=>e.collect("freq"))}durations(){return this.evaluated.map(e=>e.collect("duration"))}retrograde(){return this.evaluated=this.evaluated.reverse(),this}scale(e){return this.applyOptions({scale:e}),this}key(e){return this.applyOptions({key:e}),this}octave(e){return this.applyOptions({octave:e}),this}invert(e){return this.applyOptions({inversion:e}),this}isInOptions(e,t){return this.options.nodeOptions&&this.options.nodeOptions[e]===t}atLast(){return this.index+1>=this.evaluated.length*this.redo}clone(){return zn(this)}notStarted(){return this.index<0}peek(){return this.evaluated[this.index-1||0]}hasStarted(){return this.index>=0}next(){this.index<0&&(this.index=0);const e=this.evaluated[this.index%this.evaluated.length];return this.index++,this.counter++,this.redo>0&&this.index>=this.evaluated.length*this.redo&&(this.index=0,this.evaluated=this.evaluate(this.values)),e}applyOptions(e={}){this.evaluated=this.evaluate(this.evaluated,e),this.applyTransformations()}applyTransformations(){var e;(e=this.globalOptions)!=null&&e.retrograde&&(this.evaluated=this.evaluated.reverse())}update(){return this.evaluated=this.evaluate(this.values),this.applyTransformations(),this}evaluate(e,t={}){let r=e.map(i=>i.evaluate(t)).flat(1/0).filter(i=>i!==void 0);if(t.subdivisions){const i=t.duration?t.duration:WA;r=iR(r,i)}return r}totalDuration(){return this.evaluated.reduce((t,r)=>t+r.collect("duration"),0)}lead(){let e=this.evaluated.findIndex(t=>t instanceof va);if(e>=0){for(let t=e+1;t<=this.evaluated.length;t++)if(this.evaluated[t]instanceof va){const r=this.evaluated[e],i=this.evaluated[t],a=xP(r.notes(),i.notes()),s=zn(i);s.voiceLeadFromNotes(a,this.options.nodeOptions),this.evaluated[t]=s,e=t}}return this}}const iR=(n,e)=>{const t=n.length,r=e/t;return n.map(a=>a instanceof KA?iR(a.items,r):(a.duration=r,a)).flat(1/0)},MP=n=>{let e={};return lP.forEach(t=>{if(n[t]!==void 0){const r=n[t];e[t]=r,delete n[t]}}),e};class PP{constructor(){T(this,"midiAccess",null);T(this,"midiOutputs",[]);T(this,"currentOutputIndex",0);T(this,"scheduledNotes",{});this.initializeMidiAccess()}async initializeMidiAccess(){try{this.midiAccess=await navigator.requestMIDIAccess(),this.midiOutputs=Array.from(this.midiAccess.outputs.values()),this.midiOutputs.length===0&&(console.warn("No MIDI outputs available."),this.currentOutputIndex=-1)}catch(e){console.error("Failed to initialize MIDI:",e)}}getCurrentMidiPort(){return this.midiOutputs.length>0&&this.currentOutputIndex>=0&&this.currentOutputIndex0&&this.currentOutputIndex>=0&&this.currentOutputIndex=this.midiOutputs.length?(console.error(`Invalid MIDI output index. Index must be in the range 0-${this.midiOutputs.length-1}.`),this.currentOutputIndex):e;{const t=this.midiOutputs.findIndex(r=>r.name===e);return t!==-1?t:(console.error(`MIDI output "${e}" not found.`),this.currentOutputIndex)}}listMidiOutputs(){let e="Available MIDI Outputs: ";return this.midiOutputs.forEach((t,r)=>{e+=`(${r+1}) ${t.name} `}),e}sendMidiNote(e,t,r,i,a=this.currentOutputIndex,s=void 0){typeof a=="string"&&(a=this.getMidiOutputIndex(a));const o=this.midiOutputs[a];if(e=Math.min(Math.max(e,0),127),o){const l=[144+t,e,r],c=[128+t,e,0];o.send(l),s&&this.sendPitchBend(s,t,a);const u=setTimeout(()=>{o.send(c),s&&this.sendPitchBend(8192,t,a),delete this.scheduledNotes[e]},(i-.02)*1e3);this.scheduledNotes[e]=u}else console.error("MIDI output not available.")}sendSysExMessage(e){const t=this.midiOutputs[this.currentOutputIndex];t?t.send(e):console.error("MIDI output not available.")}sendPitchBend(e,t,r=this.currentOutputIndex){(e<0||e>16383)&&console.error("Invalid pitch bend value. Value must be in the range 0-16383."),(t<0||t>15)&&console.error("Invalid MIDI channel. Channel must be in the range 0-15."),typeof r=="string"&&(r=this.getMidiOutputIndex(r));const i=this.midiOutputs[r];if(i){const a=e&127,s=e>>7&127;i.send([224|t,a,s])}else console.error("MIDI output not available.")}sendProgramChange(e,t){const r=this.midiOutputs[this.currentOutputIndex];r?r.send([192+t,e]):console.error("MIDI output not available.")}sendMidiControlChange(e,t,r){const i=this.midiOutputs[this.currentOutputIndex];i?i.send([176+r,e,t]):console.error("MIDI output not available.")}panic(){const e=this.midiOutputs[this.currentOutputIndex];if(e){for(const t in this.scheduledNotes){const r=this.scheduledNotes[t];clearTimeout(r),e.send([128,parseInt(t),0])}this.scheduledNotes={}}else console.error("MIDI output not available.")}}class BP{constructor(e,t,r){T(this,"min");T(this,"max");T(this,"wrap");T(this,"position");this.min=e,this.max=t,this.wrap=r,this.position=0}step(){const e=Math.floor(Math.random()*3)-1;this.position+=e,this.wrap?this.position>this.max?this.position=this.min:this.positionthis.max&&(this.position=this.max)}getPosition(){return this.position}toggleWrap(e){this.wrap=e}}class Bg{constructor(e){T(this,"seedValue");T(this,"randomGen",Math.random);T(this,"app");T(this,"values",{});T(this,"odds",(e,t)=>this.randomGen()this);T(this,"almostNever",e=>this.odds(.025,e));T(this,"rarely",e=>this.odds(.1,e));T(this,"scarcely",e=>this.odds(.25,e));T(this,"sometimes",e=>this.odds(.5,e));T(this,"often",e=>this.odds(.75,e));T(this,"frequently",e=>this.odds(.9,e));T(this,"almostAlways",e=>this.odds(.985,e));T(this,"always",e=>this.modify(e));T(this,"modify",e=>e(this));T(this,"seed",e=>(this.seedValue=e.toString(),this.randomGen=this.app.api.localSeededRandom(this.seedValue),this));T(this,"clear",()=>(this.app.api.clearLocalSeed(this.seedValue),this));T(this,"apply",e=>this.modify(e));T(this,"length",e=>(this.values.length=e,this));this.app=e,this.app.api.currentSeed&&(this.randomGen=this.app.api.randomGen)}}class aR extends Bg{constructor(t){super(t);T(this,"octave",t=>(this.values.octave=t,this.update(),this));T(this,"key",t=>(this.values.key=t,this.update(),this));T(this,"scale",t=>(xg(t)?(this.values.scaleName=t,this.values.parsedScale=hi(t)):this.values.parsedScale=kg(t),this.update(),this));T(this,"freq",t=>{this.values.freq=t;const r=fP(t);return r%1!==0?(this.values.note=Math.floor(r),this.values.bend=jA(r)[1]):this.values.note=r,this});T(this,"update",()=>{})}}let Ar=[],UP=(n,e)=>{let t,r=[],i={lc:0,l:e||0,value:n,set(a){i.value=a,i.notify()},get(){return i.lc||i.listen(()=>{})(),i.value},notify(a){t=r;let s=!Ar.length;for(let o=0;o{r===t&&(r=r.slice());let o=r.indexOf(a);~o&&(r.splice(o,2),i.lc--,i.lc||i.off())}},subscribe(a,s){let o=i.listen(a,s);return a(i.value),o},off(){}};return i},FP=(n={})=>{let e=UP(n);return e.setKey=function(t,r){typeof r>"u"?t in e.value&&(e.value={...e.value},delete e.value[t],e.notify(t)):e.value[t]!==r&&(e.value={...e.value,[t]:r},e.notify(t))},e};if(typeof DelayNode<"u"){class n extends DelayNode{constructor(t,r,i,a){super(t),r=Math.abs(r),this.delayTime.value=i;const s=t.createGain();s.gain.value=Math.min(Math.abs(a),.995),this.feedback=s.gain;const o=t.createGain();return o.gain.value=r,this.delayGain=o,this.connect(s),this.connect(o),s.connect(this),this.connect=l=>o.connect(l),this}start(t){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,t+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(e,t,r){return new n(this,e,t,r)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(n,e=1){const t=this.sampleRate*n,r=this.createBuffer(e,t,this.sampleRate),i=r.getChannelData(0);for(let a=0;a(e.buffer=this.impulseResponse(t),e.duration=n,e),e.setDuration(n),e});var VO={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class n extends GainNode{constructor(t,r){if(super(t),!VO[r])throw new Error("vowel: unknown vowel "+r);const{gains:i,qs:a,freqs:s}=VO[r],o=t.createGain();for(let l=0;l<5;l++){const c=t.createGain();c.gain.value=i[l];const u=t.createBiquadFilter();u.type="bandpass",u.Q.value=a[l],u.frequency.value=s[l],this.connect(u),u.connect(c),c.connect(o)}return o.gain.value=8,this.connect=l=>o.connect(l),this}}AudioContext.prototype.createVowelFilter=function(e){return new n(this,e)}}const YP=n=>{var i;if(typeof n!="string")return[];const[e,t="",r]=((i=n.match(/^([a-gA-G])([#bsf]*)([0-9]*)$/))==null?void 0:i.slice(1))||[];return e?[e,t,r?Number(r):void 0]:[]},GP={c:0,d:2,e:4,f:5,g:7,a:9,b:11},$P={"#":1,b:-1,s:1,f:-1},Uc=(n,e=3)=>{const[t,r,i=e]=YP(n);if(!t)throw new Error('not a note: "'+n+'"');const a=GP[t.toLowerCase()],s=(r==null?void 0:r.split("").reduce((o,l)=>o+$P[l],0))||0;return(Number(i)+1)*12+a+s},sR=n=>Math.pow(2,(n-69)/12)*440,Tm=(n,e,t)=>Math.min(Math.max(n,e),t),QP=n=>12*Math.log(n/440)/Math.LN2+69,qP=(n,e)=>{if(typeof n!="object")throw new Error("valueToMidi: expected object value");let{freq:t,note:r}=n;if(typeof t=="number")return QP(t);if(typeof r=="string")return Uc(r);if(typeof r=="number")return r;if(!e)throw new Error("valueToMidi: expected freq or note to be set");return e},VP="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgY29uc3Qgb3V0cHV0ID0gb3V0cHV0c1swXTsKICAgIGNvbnN0IGNvYXJzZSA9IHBhcmFtZXRlcnMuY29hcnNlOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBvdXRwdXRbMF1bMF0gPSBpbnB1dFswXVswXTsKICAgICAgZm9yIChsZXQgbiA9IDE7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgIGZvciAobGV0IG8gPSAwOyBvIDwgb3V0cHV0Lmxlbmd0aDsgbysrKSB7CiAgICAgICAgICBvdXRwdXRbb11bbl0gPSBuICUgY29hcnNlID09IDAgPyBpbnB1dFswXVtuXSA6IG91dHB1dFtvXVtuIC0gMV07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ2NvYXJzZS1wcm9jZXNzb3InLCBDb2Fyc2VQcm9jZXNzb3IpOwoKY2xhc3MgQ3J1c2hQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ2NydXNoJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm9jZXNzb3IpOwoKY2xhc3MgU2hhcGVQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ3NoYXBlJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBzaGFwZTAgPSBwYXJhbWV0ZXJzLnNoYXBlWzBdOwogICAgY29uc3Qgc2hhcGUxID0gc2hhcGUwIDwgMSA/IHNoYXBlMCA6IDEuMCAtIDRlLTEwOwogICAgY29uc3Qgc2hhcGUgPSAoMi4wICogc2hhcGUxKSAvICgxLjAgLSBzaGFwZTEpOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK";function gc(n){const e=Ht().createGain();return e.gain.value=n,e}const vm=(n,e,t,r,i,a)=>{const s=Ht().createGain();return s.gain.setValueAtTime(0,a),s.gain.linearRampToValueAtTime(i,a+n),s.gain.linearRampToValueAtTime(t*i,a+n+e),{node:s,stop:o=>{s.gain.setValueAtTime(t*i,o),s.gain.linearRampToValueAtTime(0,o+r)}}},zP=(n,e,t,r,i,a)=>{t=Math.max(.001,t),i=Math.max(.001,i);const s=Ht().createGain();return s.gain.setValueAtTime(1e-4,a),s.gain.exponentialRampToValueAtTime(i,a+n),s.gain.exponentialRampToValueAtTime(t*i,a+n+e),{node:s,stop:o=>{s.gain.exponentialRampToValueAtTime(1e-4,o+r)}}},HP=(n,e,t,r,i,a,s,o,l)=>{const c=s-a,u=a+c,p=a+r*c;n.setValueAtTime(a,o),n.linearRampToValueAtTime(u,o+e),n.linearRampToValueAtTime(p,o+e+t),n.setValueAtTime(p,l),n.linearRampToValueAtTime(a,l+Math.max(i,.1))};function Iu(n,e,t,r,i,a,s,o,l,c,u,p=.5){const m=n.createBiquadFilter();if(m.type=e,m.Q.value=r,m.frequency.value=t,!isNaN(l)&&l!==0){const _=l*p,b=Tm(2**-_*t,0,2e4),A=Tm(2**(l-_)*t,0,2e4);return HP(m.frequency,i,a,s,o,b,A,c,u),m}return m}let WP=n=>console.log(n);const _s=(...n)=>WP(...n),Ug=FP();function Fg(n,e,t={}){Ug.setKey(n,{onTrigger:e,data:t})}function zO(n){return Ug.get()[n]}let Nu;const Ht=()=>(Nu||(Nu=new AudioContext),Nu);let Ol;const Yg=()=>{const n=Ht();return Ol||(Ol=n.createGain(),Ol.connect(n.destination)),Ol};let wu;function XP(){return wu||(wu=Ht().audioWorklet.addModule(VP),wu)}function Du(n,e,t){const r=new AudioWorkletNode(n,e);return Object.entries(t).forEach(([i,a])=>{r.parameters.get(i).value=a}),r}async function ZP(n={}){const{disableWorklets:e=!1}=n;typeof window<"u"&&(await Ht().resume(),e?console.log("disableWorklets: AudioWorklet effects coarse, crush and shape are skipped!"):await XP().catch(t=>{console.warn("could not load AudioWorklet effects coarse, crush and shape",t)}))}async function KP(n){return new Promise(e=>{document.addEventListener("click",async function t(){await ZP(n),e(),document.removeEventListener("click",t)})})}let ra={};function jP(n,e,t,r){var i;if(t=Tm(t,0,.98),!ra[n]){const a=Ht().createFeedbackDelay(1,e,t);(i=a.start)==null||i.call(a,r),a.connect(Yg()),ra[n]=a}return ra[n].delayTime.value!==e&&ra[n].delayTime.setValueAtTime(e,r),ra[n].feedback.value!==t&&ra[n].feedback.setValueAtTime(t,r),ra[n]}let na={};function JP(n,e=2){if(!na[n]){const t=Ht().createReverb(e);t.connect(Yg()),na[n]=t}return na[n].duration!==e&&(na[n]=na[n].setDuration(e),na[n].duration=e),na[n]}let ia;function e3(n=2048){if(!ia){const e=Ht().createAnalyser();e.fftSize=n,ia=e,new Float32Array(ia.frequencyBinCount)}return ia.fftSize!==n&&(ia.fftSize=n,new Float32Array(ia.frequencyBinCount)),ia}function xu(n,e,t){const r=gc(t);return n.connect(r),r.connect(e),r}const HO=async(n,e,t)=>{const r=Ht();if(typeof n!="object")throw new Error(`expected hap.value to be an object, but got "${n}". Hint: append .note() or .s() to the end`,"error");n.duration=t;let i=r.currentTime+e,{s:a="triangle",bank:s,source:o,gain:l=.8,ftype:c="12db",fanchor:u=.5,cutoff:p,lpenv:m,lpattack:_=.01,lpdecay:b=.01,lpsustain:A=1,lprelease:R=.01,resonance:k=1,hpenv:Y,hcutoff:Z,hpattack:h=.01,hpdecay:E=.01,hpsustain:S=1,hprelease:I=.01,hresonance:x=1,bpenv:w,bandf:L,bpattack:G=.01,bpdecay:te=.01,bpsustain:ne=1,bprelease:re=.01,bandq:ee=1,coarse:M,crush:$,shape:j,pan:X,vowel:ce,delay:le=0,delayfeedback:Oe=.5,delaytime:ke=.25,orbit:Me=1,room:Ee,size:Ie=2,velocity:ue=1,analyze:De,fft:Ze=8}=n;l*=ue;let Ve=[];const et=()=>{Ve.forEach(st=>st==null?void 0:st.disconnect())};s&&a&&(a=`${s}_${a}`);let nt;if(o)nt=o(i,n,t);else if(zO(a)){const{onTrigger:st}=zO(a),Ge=await st(i,n,et);Ge&&(nt=Ge.node,Ge.stop(i+t))}else throw new Error(`sound ${a} not found! Is it loaded?`);if(!nt)return;if(r.currentTime>i){_s("[webaudio] skip hap: still loading",r.currentTime-i);return}const Ke=[];if(Ke.push(nt),Ke.push(gc(l)),p!==void 0){let st=()=>Iu(r,"lowpass",p,k,_,b,A,R,m,i,i+t,u);Ke.push(st()),c==="24db"&&Ke.push(st())}if(Z!==void 0){let st=()=>Iu(r,"highpass",Z,x,h,E,S,I,Y,i,i+t,u);Ke.push(st()),c==="24db"&&Ke.push(st())}if(L!==void 0){let st=()=>Iu(r,"bandpass",L,ee,G,te,ne,re,w,i,i+t,u);Ke.push(st()),c==="24db"&&Ke.push(st())}if(ce!==void 0){const st=r.createVowelFilter(ce);Ke.push(st)}if(M!==void 0&&Ke.push(Du(r,"coarse-processor",{coarse:M})),$!==void 0&&Ke.push(Du(r,"crush-processor",{crush:$})),j!==void 0&&Ke.push(Du(r,"shape-processor",{shape:j})),X!==void 0){const st=r.createStereoPanner();st.pan.value=2*X-1,Ke.push(st)}const mt=gc(1);Ke.push(mt),mt.connect(Yg());let it;if(le>0&&ke>0&&Oe>0){const st=jP(Me,ke,Oe,i);it=xu(mt,st,le)}let Ct;if(Ee>0&&Ie>0){const st=JP(Me,Ie);Ct=xu(mt,st,Ee)}let Nt;if(De){const st=e3(2**(Ze+5));Nt=xu(mt,st,De)}Ke.slice(1).reduce((st,Ge)=>st.connect(Ge),Ke[0]),Ve=Ke.concat([it,Ct,Nt])},ku={};function t3(n,e){var t=e?1e3:1024;if(n=t);return n.toFixed(1)+" "+r[i]}const r3=async(n,e,t,r,i,a,s)=>{let o=0;i!==void 0&&t!==void 0&&_s("[sampler] hap has note and freq. ignoring note","warning");let l=qP({freq:i,note:t},36);o=l-36;const c=Ht();let u;if(Array.isArray(a))u=a[e%a.length];else{const b=R=>Uc(R)-l,A=Object.keys(a).filter(R=>!R.startsWith("_")).reduce((R,k,Y)=>!R||Math.abs(b(k)){const i=t?`sound "${t}:${r}"`:"sample";if(!ku[n]){_s(`[sampler] load ${i}..`,"load-sample",{url:n});const a=Date.now();ku[n]=fetch(n).then(s=>s.arrayBuffer()).then(async s=>{const o=Date.now()-a,l=t3(s.byteLength);return _s(`[sampler] load ${i}... done! loaded ${l} in ${o}ms`,"loaded-sample",{url:n}),await e.decodeAudioData(s)})}return ku[n]};function i3(n){const e=Ht(),t=e.createBuffer(n.numberOfChannels,n.length,e.sampleRate);for(let r=0;rObject.entries(n).forEach(([r,i])=>{if(typeof i=="string"&&(i=[i]),typeof i!="object")throw new Error("wrong sample map format for "+r);t=i._base||t;const a=s=>(t+s).replace("github:","https://raw.githubusercontent.com/");Array.isArray(i)?i=i.map(a):i=Object.fromEntries(Object.entries(i).map(([s,o])=>[s,(typeof o=="string"?[o]:o).map(a)])),e(r,i)});let s3={};function o3(n){const e=Object.entries(s3).find(([t])=>n.startsWith(t));if(e)return e[1]}const za=async(n,e=n._base||"",t={})=>{if(typeof n=="string"){const a=o3(n);if(a)return a(n);if(n.startsWith("github:")){let[o,l]=n.split("github:");l=l.endsWith("/")?l.slice(0,-1):l,n=`https://raw.githubusercontent.com/${l}/strudel.json`}if(typeof fetch!="function")return;const s=n.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(n).then(o=>o.json()).then(o=>za(o,e||o._base||s,t)).catch(o=>{throw console.error(o),new Error(`error loading "${n}"`)})}const{prebake:r,tag:i}=t;a3(n,(a,s)=>Fg(a,(o,l,c)=>l3(o,l,c,s),{type:"sample",samples:s,baseUrl:e,prebake:r,tag:i}),e)},WO=[];async function l3(n,e,t,r,i){let{s:a,freq:s,unit:o,nudge:l=0,cut:c,loop:u,clip:p=void 0,n:m=0,note:_,speed:b=1,loopBegin:A=0,begin:R=0,loopEnd:k=1,end:Y=1}=e;if(b===0)return;u=a.startsWith("wt_")?1:e.loop;const Z=Ht(),{attack:h=.001,decay:E=.001,sustain:S=1,release:I=.001}=e,x=n+l,w=await r3(a,m,_,b,s,r,i);if(Z.currentTime>n){_s(`[sampler] still loading sound "${a}:${m}"`,"highlight");return}if(!w){_s(`[sampler] could not load "${a}:${m}"`,"error");return}w.playbackRate.value=Math.abs(b)*w.playbackRate.value,o==="c"&&(w.playbackRate.value=w.playbackRate.value*w.buffer.duration*1);const L=R*w.buffer.duration;u&&(w.loop=!0,w.loopStart=A*w.buffer.duration-L,w.loopEnd=k*w.buffer.duration-L),w.start(x,L);const{node:G,stop:te}=vm(h,E,S,I,1,n);w.connect(G);const ne=Z.createGain();G.connect(ne),w.onended=function(){w.disconnect(),G.disconnect(),ne.disconnect(),t()};const re={node:ne,bufferSource:w,stop:(ee,M=p===void 0&&u===void 0)=>{let $=ee;if(M){const j=w.buffer.duration/w.playbackRate.value;$=n+(Y-R)*j}w.stop($+I),te($)}};if(c!==void 0){const ee=WO[c];ee&&(ee.node.gain.setValueAtTime(1,x),ee.node.gain.linearRampToValueAtTime(0,x+.01)),WO[c]=re}return re}const c3=(n,e=1,t="sine")=>{const r=Ht(),i=r.createOscillator();i.type=t,i.frequency.value=n,i.start();const a=new GainNode(r,{gain:e});return i.connect(a),{node:a,stop:s=>i.stop(s)}},u3=(n,e,t,r="sine")=>{const i=n.frequency.value*e,a=i*t;return c3(i,a,r)};function d3(){["sine","square","triangle","sawtooth"].forEach(n=>{Fg(n,(e,t,r)=>{let{attack:i=.001,decay:a=.05,sustain:s=.6,release:o=.01,fmh:l=1,fmi:c,fmenv:u="lin",fmattack:p,fmdecay:m,fmsustain:_,fmrelease:b,fmvelocity:A,fmwave:R="sine",vib:k=0,vibmod:Y=.5}=t,{n:Z,note:h,freq:E}=t;h=h||36,typeof h=="string"&&(h=Uc(h)),!E&&typeof h=="number"&&(E=sR(h));const{node:S,stop:I}=h3({t:e,s:n,freq:E,vib:k,vibmod:Y,partials:Z});let x,w;if(c){const{node:ne,stop:re}=u3(S,l,c,R);[p,m,_,b,A].find(ee=>ee!==void 0)?(p=p??.001,m=m??.001,_=_??1,b=b??.001,A=A??1,w=vm(p,m,_,b,A,e),u==="exp"&&(w=zP(p,m,_,b,A,e),w.node.maxValue=c*2,w.node.minValue=1e-5),ne.connect(w.node),w.node.connect(S.frequency)):ne.connect(S.frequency),x=re}const L=gc(.3),{node:G,stop:te}=vm(i,a,s,o,1,e);return S.onended=()=>{S.disconnect(),L.disconnect(),r()},{node:S.connect(L).connect(G),stop:ne=>{te(ne),w==null||w.stop(ne);let re=ne+o;I(re),x==null||x(re)}}},{type:"synth",prebake:!0})})}function p3(n,e){const t=new Float32Array(n+1),r=new Float32Array(n+1),i=Ht(),a=i.createOscillator(),s={sawtooth:c=>1/c,square:c=>c%2===0?0:1/c,triangle:c=>c%2===0?0:1/(c*c)};if(!s[e])throw new Error(`unknown wave type ${e}`);t[0]=0,r[0]=0;let o=1;for(;o<=n;)t[o]=s[e](o),r[o]=0,o++;const l=i.createPeriodicWave(t,r);return a.setPeriodicWave(l),a}function h3({s:n,freq:e,t,vib:r,vibmod:i,partials:a}){let s;!a||n==="sine"?(s=Ht().createOscillator(),s.type=n||"triangle"):s=p3(a,n),s.frequency.value=Number(e),s.start(t);let o;if(r>0){o=Ht().createOscillator(),o.frequency.value=r;const l=Ht().createGain();l.gain.value=i*100,o.connect(l),l.connect(s.detune),o.start(t)}return{node:s,stop:l=>{o==null||o.stop(l),s.stop(l)}}}function f3(n=1,e=.05,t=220,r=0,i=0,a=.1,s=0,o=1,l=0,c=0,u=0,p=0,m=0,_=0,b=0,A=0,R=0,k=1,Y=0,Z=0){let h=Math.PI*2,E=Ht().sampleRate,S=X=>X>0?1:-1,I=l*=500*h/E/E,x=t*=(1+e*2*Math.random()-e)*h/E,w=[],L=0,G=0,te=0,ne=1,re=0,ee=0,M=0,$,j;for(r=r*E+9,Y*=E,i*=E,a*=E,R*=E,c*=500*h/E**3,b*=h/E,u*=h/E,p*=E,m=m*E|0,j=r+Y+i+a+R|0;te1?s>2?s>3?Math.sin((L%h)**3):Math.max(Math.min(Math.tan(L),1),-1):1-(2*L/h%2+2)%2:1-4*Math.abs(Math.round(L/h)-L/h):Math.sin(L),M=(m?1-Z+Z*Math.sin(h*te/m):1)*S(M)*Math.abs(M)**o*n*1*(tete?0:(tep&&(t+=u,x+=u,ne=0),m&&!(++re%m)&&(t=x,l=I,ne||(ne=1));return w}const m3=(n,e)=>{let{s:t,note:r=36,freq:i,zrand:a=0,attack:s=0,decay:o=0,sustain:l=.8,release:c=.1,curve:u=1,slide:p=0,deltaSlide:m=0,pitchJump:_=0,pitchJumpTime:b=0,lfo:A=0,noise:R=0,zmod:k=0,zcrush:Y=0,zdelay:Z=0,tremolo:h=0,duration:E=.2,zzfx:S}=n;const I=Math.max(E-s-o,0);typeof r=="string"&&(r=Uc(r)),!i&&typeof r=="number"&&(i=sR(r)),t=t.replace("z_","");const x=["sine","triangle","sawtooth","tan","noise"].indexOf(t)||0;u=t==="square"?0:u;const w=f3(...S||[.25,a,i,s,I,c,x,u,p,m,_,b,A,R,k,Y,Z,l,o,h]),L=Ht(),G=L.createBuffer(1,w.length,L.sampleRate);G.getChannelData(0).set(w);const te=Ht().createBufferSource();return te.buffer=G,te.start(e),{node:te}};function g3(){["zzfx","z_sine","z_sawtooth","z_triangle","z_square","z_tan","z_noise"].forEach(n=>{Fg(n,(e,t,r)=>{const{node:i}=m3({s:n,...t},e);return i.onended=()=>{i.disconnect(),r()},{node:i,stop:()=>{}}},{type:"synth",prebake:!0})})}class Cm extends aR{constructor(t,r){super(r);T(this,"volume",t=>this.updateValue("volume",t));T(this,"vol",this.volume);T(this,"zrand",t=>this.updateValue("zrand",t));T(this,"curve",t=>this.updateValue("curve",t));T(this,"slide",t=>this.updateValue("slide",t));T(this,"sld",this.slide);T(this,"deltaSlide",t=>this.updateValue("deltaSlide",t));T(this,"dslide",this.deltaSlide);T(this,"pitchJump",t=>this.updateValue("pitchJump",t));T(this,"pj",this.pitchJump);T(this,"pitchJumpTime",t=>this.updateValue("pitchJumpTime",t));T(this,"pjt",this.pitchJumpTime);T(this,"lfo",t=>this.updateValue("lfo",t));T(this,"noise",t=>this.updateValue("noise",t));T(this,"zmod",t=>this.updateValue("zmod",t));T(this,"zcrush",t=>this.updateValue("zcrush",t));T(this,"zdelay",t=>this.updateValue("zdelay",t));T(this,"sustainVolume",t=>this.updateValue("sustainVolume",t));T(this,"tremolo",t=>this.updateValue("tremolo",t));T(this,"dur",t=>this.updateValue("dur",t));T(this,"zzfx",t=>this.updateValue("zzfx",t));T(this,"fmi",t=>this.updateValue("fmi",t));T(this,"fmh",t=>this.updateValue("fmh",t));T(this,"fmenv",t=>this.updateValue("fmenv",t));T(this,"fmattack",t=>this.updateValue("fmattack",t));T(this,"fmatk",this.fmattack);T(this,"fmdecay",t=>this.updateValue("fmdecay",t));T(this,"fmdec",this.fmdecay);T(this,"fmsustain",t=>this.updateValue("fmsustain",t));T(this,"fmsus",this.fmsustain);T(this,"fmrelease",t=>this.updateValue("fmrelease",t));T(this,"fmrel",this.fmrelease);T(this,"fmvelocity",t=>this.updateValue("fmvelocity",t));T(this,"fmvel",this.fmvelocity);T(this,"fmwave",t=>this.updateValue("fmwave",t));T(this,"fmw",this.fmwave);T(this,"ftype",t=>this.updateValue("ftype",t));T(this,"fanchor",t=>this.updateValue("fanchor",t));T(this,"attack",t=>this.updateValue("attack",t));T(this,"atk",this.attack);T(this,"decay",t=>this.updateValue("decay",t));T(this,"dec",this.decay);T(this,"sustain",t=>this.updateValue("sustain",t));T(this,"sus",this.sustain);T(this,"release",t=>this.updateValue("release",t));T(this,"rel",this.release);T(this,"adsr",(t,r,i,a)=>(this.attack(t),this.decay(r),this.sustain(i),this.release(a),this));T(this,"lpenv",t=>this.updateValue("lpenv",t));T(this,"lpe",t=>this.updateValue("lpenv",t));T(this,"lpattack",t=>this.updateValue("lpattack",t));T(this,"lpa",this.lpattack);T(this,"lpdecay",t=>this.updateValue("lpdecay",t));T(this,"lpd",this.lpdecay);T(this,"lpsustain",t=>this.updateValue("lpsustain",t));T(this,"lps",this.lpsustain);T(this,"lprelease",t=>this.updateValue("lprelease",t));T(this,"lpr",this.lprelease);T(this,"cutoff",t=>this.updateValue("cutoff",t));T(this,"lpf",this.cutoff);T(this,"resonance",t=>this.updateValue("resonance",Math.min(Math.max(t,0),50)));T(this,"lpq",this.resonance);T(this,"lpadsr",(t,r,i,a,s)=>(this.lpenv(t),this.lpattack(r),this.lpdecay(i),this.lpsustain(a),this.lprelease(s),this));T(this,"hpenv",t=>this.updateValue("hpenv",t));T(this,"hpe",t=>this.updateValue("hpe",t));T(this,"hpattack",t=>this.updateValue("hpattack",t));T(this,"hpa",this.hpattack);T(this,"hpdecay",t=>this.updateValue("hpdecay",t));T(this,"hpd",this.hpdecay);T(this,"hpsustain",t=>this.updateValue("hpsustain",t));T(this,"hpsus",this.hpsustain);T(this,"hprelease",t=>this.updateValue("hprelease",t));T(this,"hpr",this.hprelease);T(this,"hcutoff",t=>this.updateValue("hcutoff",t));T(this,"hpf",this.hcutoff);T(this,"hresonance",t=>this.updateValue("hresonance",t));T(this,"hpq",this.hresonance);T(this,"hpadsr",(t,r,i,a,s)=>(this.hpenv(t),this.hpattack(r),this.hpdecay(i),this.hpsustain(a),this.hprelease(s),this));T(this,"bpenv",t=>this.updateValue("bpenv",t));T(this,"bpe",t=>this.updateValue("bpe",t));T(this,"bpattack",t=>this.updateValue("bpattack",t));T(this,"bpa",this.bpattack);T(this,"bpdecay",t=>this.updateValue("bpdecay",t));T(this,"bpd",this.bpdecay);T(this,"bpsustain",t=>this.updateValue("bpsustain",t));T(this,"bps",this.bpsustain);T(this,"bprelease",t=>this.updateValue("bprelease",t));T(this,"bpr",this.bprelease);T(this,"bandf",t=>this.updateValue("bandf",t));T(this,"bpf",this.bandf);T(this,"bandq",t=>this.updateValue("bandq",t));T(this,"bpq",this.bandq);T(this,"bpadsr",(t,r,i,a,s)=>(this.bpenv(t),this.bpattack(r),this.bpdecay(i),this.bpsustain(a),this.bprelease(s),this));T(this,"freq",t=>this.updateValue("freq",t));T(this,"f",this.freq);T(this,"vib",t=>this.updateValue("vib",t));T(this,"vibmod",t=>this.updateValue("vibmod",t));T(this,"fm",t=>{if(typeof t=="number")this.values.fmi=t;else{let r=t.split(":");this.values.fmi=parseFloat(r[0]),r.length>1&&(this.values.fmh=parseFloat(r[1]))}return this});T(this,"loop",t=>this.updateValue("loop",t));T(this,"loopBegin",t=>this.updateValue("loopBegin",t));T(this,"loopEnd",t=>this.updateValue("loopEnd",t));T(this,"begin",t=>this.updateValue("begin",t));T(this,"end",t=>this.updateValue("end",t));T(this,"gain",t=>this.updateValue("gain",t));T(this,"dbgain",t=>this.updateValue("gain",Math.min(Math.pow(10,t/20),10)));T(this,"db",this.dbgain);T(this,"velocity",t=>this.updateValue("velocity",t));T(this,"vel",this.velocity);T(this,"pan",t=>this.updateValue("pan",t));T(this,"sound",t=>this.updateValue("s",t));T(this,"chord",(t,...r)=>(typeof t=="string"?t=yP(t).map(a=>({note:a,freq:$n(a)})):t instanceof Array&&typeof t[0]=="number"?t=t.map(i=>({note:i,freq:$n(i)})):typeof t=="number"&&r.length>0&&(t=[t,...r].map(i=>({note:i,freq:$n(i)}))),this.updateValue("chord",t)));T(this,"invert",(t=0)=>{if(this.values.chord){let r=this.values.chord.map(a=>a.note);r=t<0?[...r].reverse():r;for(let a=0;a({note:a,freq:$n(a)}));return this.updateValue("chord",i)}else return this});T(this,"snd",this.sound);T(this,"nudge",t=>this.updateValue("nudge",t));T(this,"cut",t=>this.updateValue("cut",t));T(this,"clip",t=>this.updateValue("clip",t));T(this,"n",t=>this.updateValue("n",t));T(this,"note",t=>typeof t=="string"?this.updateValue("note",Kn(t)):this.updateValue("note",t));T(this,"speed",t=>this.updateValue("speed",t));T(this,"spd",this.speed);T(this,"coarse",t=>this.updateValue("coarse",t));T(this,"crush",t=>this.updateValue("crush",t));T(this,"shape",t=>this.updateValue("shape",t));T(this,"vowel",t=>this.updateValue("vowel",t));T(this,"vow",this.vowel);T(this,"delay",t=>this.updateValue("delay",t));T(this,"del",this.delay);T(this,"delayfeedback",t=>this.updateValue("delayfeedback",t));T(this,"delayfb",this.delayfeedback);T(this,"delaytime",t=>this.updateValue("delaytime",t));T(this,"delayt",this.delaytime);T(this,"orbit",t=>this.updateValue("orbit",t));T(this,"o",this.orbit);T(this,"room",t=>this.updateValue("room",t));T(this,"rm",this.room);T(this,"size",t=>this.updateValue("size",t));T(this,"sz",this.size);T(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});T(this,"update",()=>{const[t,r]=Mg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.freq=$n(t)});T(this,"out",()=>{this.values.chord?this.values.chord.forEach(t=>{const r={...this.values};r.freq=t.freq,HO(r,.25,this.values.dur)}):HO(this.values,.25,this.values.dur)});this.app=r,typeof t=="string"?t.includes(":")?this.values={s:t.split(":")[0],n:t.split(":")[1],dur:r.clock.convertPulseToSecond(r.clock.ppqn)}:this.values={s:t,dur:.5}:this.values=t}updateValue(t,r){return this.values[t]=r,this}}class ym extends aR{constructor(t,r){super(r);T(this,"midiConnection");T(this,"chord",t=>(this.values.chord=t,this));T(this,"note",t=>(this.values.note=t,this));T(this,"sustain",t=>(this.values.sustain=t,this));T(this,"channel",t=>(this.values.channel=t,this));T(this,"port",t=>(this.values.port=this.midiConnection.getMidiOutputIndex(t),this));T(this,"add",t=>(this.values.note+=t,this));T(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});T(this,"bend",t=>(this.values.bend=t,this));T(this,"random",(t=0,r=127)=>(t=Math.min(Math.max(t,0),127),r=Math.min(Math.max(r,0),127),this.values.note=Math.floor(this.randomGen()*(r-t+1))+t,this));T(this,"update",()=>{const[t,r]=Mg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.note=t,this.values.freq=$n(t),r&&(this.values.bend=r)});T(this,"out",()=>{function t(r,i){const a=i.values.channel?i.values.channel:0,s=i.values.velocity?i.values.velocity:100,o=i.values.sustain?i.values.sustain*i.app.clock.pulse_duration*i.app.api.ppqn():i.app.clock.pulse_duration*i.app.api.ppqn(),l=i.values.bend?i.values.bend:void 0,c=i.values.port?i.midiConnection.getMidiOutputIndex(i.values.port):i.midiConnection.getCurrentMidiPortIndex();i.midiConnection.sendMidiNote(r,a,s,o,c,l)}if(this.values.chord)this.values.chord.forEach(r=>{t(r,this)});else{const r=this.values.note?this.values.note:60;t(r,this)}});this.app=r,typeof t=="number"?this.values.note=t:this.values=t,this.midiConnection=r.api.MidiConnection}}const Hs=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,oR=new Set,Am=typeof process=="object"&&process?process:{},lR=(n,e,t,r)=>{typeof Am.emitWarning=="function"?Am.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)};let _c=globalThis.AbortController,XO=globalThis.AbortSignal;var FT;if(typeof _c>"u"){XO=class{constructor(){T(this,"onabort");T(this,"_onabort",[]);T(this,"reason");T(this,"aborted",!1)}addEventListener(r,i){this._onabort.push(i)}},_c=class{constructor(){T(this,"signal",new XO);e()}abort(r){var i,a;if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(const s of this.signal._onabort)s(r);(a=(i=this.signal).onabort)==null||a.call(i,r)}}};let n=((FT=Am.env)==null?void 0:FT.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{n&&(n=!1,lR("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}const _3=n=>!oR.has(n),Ni=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),cR=n=>Ni(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ml:null:null;class Ml extends Array{constructor(e){super(e),this.fill(0)}}var ts;const oa=class oa{constructor(e,t){T(this,"heap");T(this,"length");if(!V(oa,ts))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){const t=cR(e);if(!t)return[];Xe(oa,ts,!0);const r=new oa(e,t);return Xe(oa,ts,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};ts=new WeakMap,ot(oa,ts,!1);let Rm=oa;var _n,Qr,Sn,On,rs,Kt,En,jt,kt,at,Rr,qr,Sr,ir,bn,ar,si,oi,Tn,vn,Mi,Ir,ko,Nm,fa,li,Lo,Vr,Tc,uR,ma,ns,Mo,Pn,wi,Bn,Di,Po,wm,is,Pl,as,Bl,wt,Pt,Bo,Dm,ga,no;const Xg=class Xg{constructor(e){ot(this,ko);ot(this,Tc);ot(this,Pn);ot(this,Bn);ot(this,Po);ot(this,is);ot(this,as);ot(this,wt);ot(this,Bo);ot(this,ga);ot(this,_n,void 0);ot(this,Qr,void 0);ot(this,Sn,void 0);ot(this,On,void 0);ot(this,rs,void 0);T(this,"ttl");T(this,"ttlResolution");T(this,"ttlAutopurge");T(this,"updateAgeOnGet");T(this,"updateAgeOnHas");T(this,"allowStale");T(this,"noDisposeOnSet");T(this,"noUpdateTTL");T(this,"maxEntrySize");T(this,"sizeCalculation");T(this,"noDeleteOnFetchRejection");T(this,"noDeleteOnStaleGet");T(this,"allowStaleOnFetchAbort");T(this,"allowStaleOnFetchRejection");T(this,"ignoreFetchAbort");ot(this,Kt,void 0);ot(this,En,void 0);ot(this,jt,void 0);ot(this,kt,void 0);ot(this,at,void 0);ot(this,Rr,void 0);ot(this,qr,void 0);ot(this,Sr,void 0);ot(this,ir,void 0);ot(this,bn,void 0);ot(this,ar,void 0);ot(this,si,void 0);ot(this,oi,void 0);ot(this,Tn,void 0);ot(this,vn,void 0);ot(this,Mi,void 0);ot(this,Ir,void 0);ot(this,fa,()=>{});ot(this,li,()=>{});ot(this,Lo,()=>{});ot(this,Vr,()=>!1);ot(this,ma,e=>{});ot(this,ns,(e,t,r)=>{});ot(this,Mo,(e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});const{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:l,dispose:c,disposeAfter:u,noDisposeOnSet:p,noUpdateTTL:m,maxSize:_=0,maxEntrySize:b=0,sizeCalculation:A,fetchMethod:R,noDeleteOnFetchRejection:k,noDeleteOnStaleGet:Y,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:h,ignoreFetchAbort:E}=e;if(t!==0&&!Ni(t))throw new TypeError("max option must be a nonnegative integer");const S=t?cR(t):Array;if(!S)throw new Error("invalid max value: "+t);if(Xe(this,_n,t),Xe(this,Qr,_),this.maxEntrySize=b||V(this,Qr),this.sizeCalculation=A,this.sizeCalculation){if(!V(this,Qr)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(R!==void 0&&typeof R!="function")throw new TypeError("fetchMethod must be a function if specified");if(Xe(this,rs,R),Xe(this,Mi,!!R),Xe(this,jt,new Map),Xe(this,kt,new Array(t).fill(void 0)),Xe(this,at,new Array(t).fill(void 0)),Xe(this,Rr,new S(t)),Xe(this,qr,new S(t)),Xe(this,Sr,0),Xe(this,ir,0),Xe(this,bn,Rm.create(t)),Xe(this,Kt,0),Xe(this,En,0),typeof c=="function"&&Xe(this,Sn,c),typeof u=="function"?(Xe(this,On,u),Xe(this,ar,[])):(Xe(this,On,void 0),Xe(this,ar,void 0)),Xe(this,vn,!!V(this,Sn)),Xe(this,Ir,!!V(this,On)),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!k,this.allowStaleOnFetchRejection=!!Z,this.allowStaleOnFetchAbort=!!h,this.ignoreFetchAbort=!!E,this.maxEntrySize!==0){if(V(this,Qr)!==0&&!Ni(V(this,Qr)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ni(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");He(this,Tc,uR).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!Y,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Ni(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Ni(this.ttl))throw new TypeError("ttl must be a positive integer if specified");He(this,ko,Nm).call(this)}if(V(this,_n)===0&&this.ttl===0&&V(this,Qr)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!V(this,_n)&&!V(this,Qr)){const I="LRU_CACHE_UNBOUNDED";_3(I)&&(oR.add(I),lR("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",I,Xg))}}static unsafeExposeInternals(e){return{starts:V(e,oi),ttls:V(e,Tn),sizes:V(e,si),keyMap:V(e,jt),keyList:V(e,kt),valList:V(e,at),next:V(e,Rr),prev:V(e,qr),get head(){return V(e,Sr)},get tail(){return V(e,ir)},free:V(e,bn),isBackgroundFetch:t=>{var r;return He(r=e,wt,Pt).call(r,t)},backgroundFetch:(t,r,i,a)=>{var s;return He(s=e,as,Bl).call(s,t,r,i,a)},moveToTail:t=>{var r;return He(r=e,ga,no).call(r,t)},indexes:t=>{var r;return He(r=e,Pn,wi).call(r,t)},rindexes:t=>{var r;return He(r=e,Bn,Di).call(r,t)},isStale:t=>{var r;return V(r=e,Vr).call(r,t)}}}get max(){return V(this,_n)}get maxSize(){return V(this,Qr)}get calculatedSize(){return V(this,En)}get size(){return V(this,Kt)}get fetchMethod(){return V(this,rs)}get dispose(){return V(this,Sn)}get disposeAfter(){return V(this,On)}getRemainingTTL(e){return V(this,jt).has(e)?1/0:0}*entries(){for(const e of He(this,Pn,wi).call(this))V(this,at)[e]!==void 0&&V(this,kt)[e]!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield[V(this,kt)[e],V(this,at)[e]])}*rentries(){for(const e of He(this,Bn,Di).call(this))V(this,at)[e]!==void 0&&V(this,kt)[e]!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield[V(this,kt)[e],V(this,at)[e]])}*keys(){for(const e of He(this,Pn,wi).call(this)){const t=V(this,kt)[e];t!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield t)}}*rkeys(){for(const e of He(this,Bn,Di).call(this)){const t=V(this,kt)[e];t!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield t)}}*values(){for(const e of He(this,Pn,wi).call(this))V(this,at)[e]!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield V(this,at)[e])}*rvalues(){for(const e of He(this,Bn,Di).call(this))V(this,at)[e]!==void 0&&!He(this,wt,Pt).call(this,V(this,at)[e])&&(yield V(this,at)[e])}[Symbol.iterator](){return this.entries()}find(e,t={}){for(const r of He(this,Pn,wi).call(this)){const i=V(this,at)[r],a=He(this,wt,Pt).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,V(this,kt)[r],this))return this.get(V(this,kt)[r],t)}}forEach(e,t=this){for(const r of He(this,Pn,wi).call(this)){const i=V(this,at)[r],a=He(this,wt,Pt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,V(this,kt)[r],this)}}rforEach(e,t=this){for(const r of He(this,Bn,Di).call(this)){const i=V(this,at)[r],a=He(this,wt,Pt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,V(this,kt)[r],this)}}purgeStale(){let e=!1;for(const t of He(this,Bn,Di).call(this,{allowStale:!0}))V(this,Vr).call(this,t)&&(this.delete(V(this,kt)[t]),e=!0);return e}dump(){const e=[];for(const t of He(this,Pn,wi).call(this,{allowStale:!0})){const r=V(this,kt)[t],i=V(this,at)[t],a=He(this,wt,Pt).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||r===void 0)continue;const s={value:a};if(V(this,Tn)&&V(this,oi)){s.ttl=V(this,Tn)[t];const o=Hs.now()-V(this,oi)[t];s.start=Math.floor(Date.now()-o)}V(this,si)&&(s.size=V(this,si)[t]),e.unshift([r,s])}return e}load(e){this.clear();for(const[t,r]of e){if(r.start){const i=Date.now()-r.start;r.start=Hs.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){var m,_,b,A,R;if(t===void 0)return this.delete(e),this;const{ttl:i=this.ttl,start:a,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:l}=r;let{noUpdateTTL:c=this.noUpdateTTL}=r;const u=V(this,Mo).call(this,e,t,r.size||0,o);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.delete(e),this;let p=V(this,Kt)===0?void 0:V(this,jt).get(e);if(p===void 0)p=V(this,Kt)===0?V(this,ir):V(this,bn).length!==0?V(this,bn).pop():V(this,Kt)===V(this,_n)?He(this,is,Pl).call(this,!1):V(this,Kt),V(this,kt)[p]=e,V(this,at)[p]=t,V(this,jt).set(e,p),V(this,Rr)[V(this,ir)]=p,V(this,qr)[p]=V(this,ir),Xe(this,ir,p),Zo(this,Kt)._++,V(this,ns).call(this,p,u,l),l&&(l.set="add"),c=!1;else{He(this,ga,no).call(this,p);const k=V(this,at)[p];if(t!==k){if(V(this,Mi)&&He(this,wt,Pt).call(this,k)){k.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:Y}=k;Y!==void 0&&!s&&(V(this,vn)&&((m=V(this,Sn))==null||m.call(this,Y,e,"set")),V(this,Ir)&&((_=V(this,ar))==null||_.push([Y,e,"set"])))}else s||(V(this,vn)&&((b=V(this,Sn))==null||b.call(this,k,e,"set")),V(this,Ir)&&((A=V(this,ar))==null||A.push([k,e,"set"])));if(V(this,ma).call(this,p),V(this,ns).call(this,p,u,l),V(this,at)[p]=t,l){l.set="replace";const Y=k&&He(this,wt,Pt).call(this,k)?k.__staleWhileFetching:k;Y!==void 0&&(l.oldValue=Y)}}else l&&(l.set="update")}if(i!==0&&!V(this,Tn)&&He(this,ko,Nm).call(this),V(this,Tn)&&(c||V(this,Lo).call(this,p,i,a),l&&V(this,li).call(this,l,p)),!s&&V(this,Ir)&&V(this,ar)){const k=V(this,ar);let Y;for(;Y=k==null?void 0:k.shift();)(R=V(this,On))==null||R.call(this,...Y)}return this}pop(){var e;try{for(;V(this,Kt);){const t=V(this,at)[V(this,Sr)];if(He(this,is,Pl).call(this,!0),He(this,wt,Pt).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(V(this,Ir)&&V(this,ar)){const t=V(this,ar);let r;for(;r=t==null?void 0:t.shift();)(e=V(this,On))==null||e.call(this,...r)}}}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,a=V(this,jt).get(e);if(a!==void 0){const s=V(this,at)[a];if(He(this,wt,Pt).call(this,s)&&s.__staleWhileFetching===void 0)return!1;if(V(this,Vr).call(this,a))i&&(i.has="stale",V(this,li).call(this,i,a));else return r&&V(this,fa).call(this,a),i&&(i.has="hit",V(this,li).call(this,i,a)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,i=V(this,jt).get(e);if(i!==void 0&&(r||!V(this,Vr).call(this,i))){const a=V(this,at)[i];return He(this,wt,Pt).call(this,a)?a.__staleWhileFetching:a}}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:_=this.ignoreFetchAbort,allowStaleOnFetchAbort:b=this.allowStaleOnFetchAbort,context:A,forceRefresh:R=!1,status:k,signal:Y}=t;if(!V(this,Mi))return k&&(k.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:k});const Z={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:s,noDisposeOnSet:o,size:l,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:b,ignoreFetchAbort:_,status:k,signal:Y};let h=V(this,jt).get(e);if(h===void 0){k&&(k.fetch="miss");const E=He(this,as,Bl).call(this,e,h,Z,A);return E.__returned=E}else{const E=V(this,at)[h];if(He(this,wt,Pt).call(this,E)){const L=r&&E.__staleWhileFetching!==void 0;return k&&(k.fetch="inflight",L&&(k.returnedStale=!0)),L?E.__staleWhileFetching:E.__returned=E}const S=V(this,Vr).call(this,h);if(!R&&!S)return k&&(k.fetch="hit"),He(this,ga,no).call(this,h),i&&V(this,fa).call(this,h),k&&V(this,li).call(this,k,h),E;const I=He(this,as,Bl).call(this,e,h,Z,A),w=I.__staleWhileFetching!==void 0&&r;return k&&(k.fetch=S?"stale":"refresh",w&&S&&(k.returnedStale=!0)),w?I.__staleWhileFetching:I.__returned=I}}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:s}=t,o=V(this,jt).get(e);if(o!==void 0){const l=V(this,at)[o],c=He(this,wt,Pt).call(this,l);return s&&V(this,li).call(this,s,o),V(this,Vr).call(this,o)?(s&&(s.get="stale"),c?(s&&r&&l.__staleWhileFetching!==void 0&&(s.returnedStale=!0),r?l.__staleWhileFetching:void 0):(a||this.delete(e),s&&r&&(s.returnedStale=!0),r?l:void 0)):(s&&(s.get="hit"),c?l.__staleWhileFetching:(He(this,ga,no).call(this,o),i&&V(this,fa).call(this,o),l))}else s&&(s.get="miss")}delete(e){var r,i,a,s;let t=!1;if(V(this,Kt)!==0){const o=V(this,jt).get(e);if(o!==void 0)if(t=!0,V(this,Kt)===1)this.clear();else{V(this,ma).call(this,o);const l=V(this,at)[o];He(this,wt,Pt).call(this,l)?l.__abortController.abort(new Error("deleted")):(V(this,vn)||V(this,Ir))&&(V(this,vn)&&((r=V(this,Sn))==null||r.call(this,l,e,"delete")),V(this,Ir)&&((i=V(this,ar))==null||i.push([l,e,"delete"]))),V(this,jt).delete(e),V(this,kt)[o]=void 0,V(this,at)[o]=void 0,o===V(this,ir)?Xe(this,ir,V(this,qr)[o]):o===V(this,Sr)?Xe(this,Sr,V(this,Rr)[o]):(V(this,Rr)[V(this,qr)[o]]=V(this,Rr)[o],V(this,qr)[V(this,Rr)[o]]=V(this,qr)[o]),Zo(this,Kt)._--,V(this,bn).push(o)}}if(V(this,Ir)&&((a=V(this,ar))!=null&&a.length)){const o=V(this,ar);let l;for(;l=o==null?void 0:o.shift();)(s=V(this,On))==null||s.call(this,...l)}return t}clear(){var e,t,r;for(const i of He(this,Bn,Di).call(this,{allowStale:!0})){const a=V(this,at)[i];if(He(this,wt,Pt).call(this,a))a.__abortController.abort(new Error("deleted"));else{const s=V(this,kt)[i];V(this,vn)&&((e=V(this,Sn))==null||e.call(this,a,s,"delete")),V(this,Ir)&&((t=V(this,ar))==null||t.push([a,s,"delete"]))}}if(V(this,jt).clear(),V(this,at).fill(void 0),V(this,kt).fill(void 0),V(this,Tn)&&V(this,oi)&&(V(this,Tn).fill(0),V(this,oi).fill(0)),V(this,si)&&V(this,si).fill(0),Xe(this,Sr,0),Xe(this,ir,0),V(this,bn).length=0,Xe(this,En,0),Xe(this,Kt,0),V(this,Ir)&&V(this,ar)){const i=V(this,ar);let a;for(;a=i==null?void 0:i.shift();)(r=V(this,On))==null||r.call(this,...a)}}};_n=new WeakMap,Qr=new WeakMap,Sn=new WeakMap,On=new WeakMap,rs=new WeakMap,Kt=new WeakMap,En=new WeakMap,jt=new WeakMap,kt=new WeakMap,at=new WeakMap,Rr=new WeakMap,qr=new WeakMap,Sr=new WeakMap,ir=new WeakMap,bn=new WeakMap,ar=new WeakMap,si=new WeakMap,oi=new WeakMap,Tn=new WeakMap,vn=new WeakMap,Mi=new WeakMap,Ir=new WeakMap,ko=new WeakSet,Nm=function(){const e=new Ml(V(this,_n)),t=new Ml(V(this,_n));Xe(this,Tn,e),Xe(this,oi,t),Xe(this,Lo,(a,s,o=Hs.now())=>{if(t[a]=s!==0?o:0,e[a]=s,s!==0&&this.ttlAutopurge){const l=setTimeout(()=>{V(this,Vr).call(this,a)&&this.delete(V(this,kt)[a])},s+1);l.unref&&l.unref()}}),Xe(this,fa,a=>{t[a]=e[a]!==0?Hs.now():0}),Xe(this,li,(a,s)=>{if(e[s]){const o=e[s],l=t[s];a.ttl=o,a.start=l,a.now=r||i();const c=a.now-l;a.remainingTTL=o-c}});let r=0;const i=()=>{const a=Hs.now();if(this.ttlResolution>0){r=a;const s=setTimeout(()=>r=0,this.ttlResolution);s.unref&&s.unref()}return a};this.getRemainingTTL=a=>{const s=V(this,jt).get(a);if(s===void 0)return 0;const o=e[s],l=t[s];if(o===0||l===0)return 1/0;const c=(r||i())-l;return o-c},Xe(this,Vr,a=>e[a]!==0&&t[a]!==0&&(r||i())-t[a]>e[a])},fa=new WeakMap,li=new WeakMap,Lo=new WeakMap,Vr=new WeakMap,Tc=new WeakSet,uR=function(){const e=new Ml(V(this,_n));Xe(this,En,0),Xe(this,si,e),Xe(this,ma,t=>{Xe(this,En,V(this,En)-e[t]),e[t]=0}),Xe(this,Mo,(t,r,i,a)=>{if(He(this,wt,Pt).call(this,r))return 0;if(!Ni(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(r,t),!Ni(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i}),Xe(this,ns,(t,r,i)=>{if(e[t]=r,V(this,Qr)){const a=V(this,Qr)-e[t];for(;V(this,En)>a;)He(this,is,Pl).call(this,!0)}Xe(this,En,V(this,En)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=V(this,En))})},ma=new WeakMap,ns=new WeakMap,Mo=new WeakMap,Pn=new WeakSet,wi=function*({allowStale:e=this.allowStale}={}){if(V(this,Kt))for(let t=V(this,ir);!(!He(this,Po,wm).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,Sr)));)t=V(this,qr)[t]},Bn=new WeakSet,Di=function*({allowStale:e=this.allowStale}={}){if(V(this,Kt))for(let t=V(this,Sr);!(!He(this,Po,wm).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,ir)));)t=V(this,Rr)[t]},Po=new WeakSet,wm=function(e){return e!==void 0&&V(this,jt).get(V(this,kt)[e])===e},is=new WeakSet,Pl=function(e){var a,s;const t=V(this,Sr),r=V(this,kt)[t],i=V(this,at)[t];return V(this,Mi)&&He(this,wt,Pt).call(this,i)?i.__abortController.abort(new Error("evicted")):(V(this,vn)||V(this,Ir))&&(V(this,vn)&&((a=V(this,Sn))==null||a.call(this,i,r,"evict")),V(this,Ir)&&((s=V(this,ar))==null||s.push([i,r,"evict"]))),V(this,ma).call(this,t),e&&(V(this,kt)[t]=void 0,V(this,at)[t]=void 0,V(this,bn).push(t)),V(this,Kt)===1?(Xe(this,Sr,Xe(this,ir,0)),V(this,bn).length=0):Xe(this,Sr,V(this,Rr)[t]),V(this,jt).delete(r),Zo(this,Kt)._--,t},as=new WeakSet,Bl=function(e,t,r,i){const a=t===void 0?void 0:V(this,at)[t];if(He(this,wt,Pt).call(this,a))return a;const s=new _c,{signal:o}=r;o==null||o.addEventListener("abort",()=>s.abort(o.reason),{signal:s.signal});const l={signal:s.signal,options:r,context:i},c=(A,R=!1)=>{const{aborted:k}=s.signal,Y=r.ignoreFetchAbort&&A!==void 0;if(r.status&&(k&&!R?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,Y&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),k&&!Y&&!R)return p(s.signal.reason);const Z=_;return V(this,at)[t]===_&&(A===void 0?Z.__staleWhileFetching?V(this,at)[t]=Z.__staleWhileFetching:this.delete(e):(r.status&&(r.status.fetchUpdated=!0),this.set(e,A,l.options))),A},u=A=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=A),p(A)),p=A=>{const{aborted:R}=s.signal,k=R&&r.allowStaleOnFetchAbort,Y=k||r.allowStaleOnFetchRejection,Z=Y||r.noDeleteOnFetchRejection,h=_;if(V(this,at)[t]===_&&(!Z||h.__staleWhileFetching===void 0?this.delete(e):k||(V(this,at)[t]=h.__staleWhileFetching)),Y)return r.status&&h.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),h.__staleWhileFetching;if(h.__returned===h)throw A},m=(A,R)=>{var Y;const k=(Y=V(this,rs))==null?void 0:Y.call(this,e,a,l);k&&k instanceof Promise&&k.then(Z=>A(Z===void 0?void 0:Z),R),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(A(void 0),r.allowStaleOnFetchAbort&&(A=Z=>c(Z,!0)))})};r.status&&(r.status.fetchDispatched=!0);const _=new Promise(m).then(c,u),b=Object.assign(_,{__abortController:s,__staleWhileFetching:a,__returned:void 0});return t===void 0?(this.set(e,b,{...l.options,status:void 0}),t=V(this,jt).get(e)):V(this,at)[t]=b,b},wt=new WeakSet,Pt=function(e){if(!V(this,Mi))return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof _c},Bo=new WeakSet,Dm=function(e,t){V(this,qr)[t]=e,V(this,Rr)[e]=t},ga=new WeakSet,no=function(e){e!==V(this,ir)&&(e===V(this,Sr)?Xe(this,Sr,V(this,Rr)[e]):He(this,Bo,Dm).call(this,V(this,qr)[e],V(this,Rr)[e]),He(this,Bo,Dm).call(this,V(this,ir),e),Xe(this,ir,e))};let Im=Xg;const uo=class uo{constructor(){T(this,"_fallbackMethod",()=>uo.createSkipProxy());T(this,"out",()=>{})}};T(uo,"createSkipProxy",()=>{const e=new uo;return new Proxy(e,{get(t,r,i){return typeof t[r]>"u"?t._fallbackMethod:t[r]},set(t,r,i,a){return!1}})});let Sc=uo;const po=class po extends Bg{constructor(t,r){super(r);T(this,"_fallbackMethod",()=>po.createRestProxy(this.values.length,this.app));T(this,"out",()=>{});this.values.length=t}};T(po,"createRestProxy",(t,r)=>{const i=new po(t,r);return new Proxy(i,{get(a,s,o){return typeof a[s]>"u"?a._fallbackMethod:a[s]},set(a,s,o,l){return!1}})});let Oc=po;class S3 extends Bg{constructor(t,r,i){super(i);T(this,"input");T(this,"ziffers");T(this,"initCallTime",0);T(this,"startCallTime",0);T(this,"lastCallTime",0);T(this,"waitTime",0);T(this,"startBeat",0);T(this,"played",!1);T(this,"current");T(this,"retro",!1);T(this,"index",-1);T(this,"zid","");T(this,"options",{});T(this,"skipIndex",0);T(this,"endTime",0);T(this,"next",()=>(this.current=this.ziffers.next(),this.played=!0,this.current));T(this,"pulseToSecond",t=>this.app.clock.convertPulseToSecond(t));T(this,"firstRun",()=>this.notStarted());T(this,"atTheBeginning",()=>this.skipIndex===0&&this.ziffers.index<=0);T(this,"origin",()=>this.app.clock.pulses_since_origin+1);T(this,"pulse",()=>this.app.clock.time_position.pulse);T(this,"beat",()=>this.app.clock.time_position.beat);T(this,"nextBeat",()=>this.app.clock.next_beat_in_ticks);T(this,"nextBeatInTicks",()=>this.app.clock.next_beat_in_ticks);T(this,"areWeThereYet",()=>{this.app.clock.pulses_since_origin=this.nextBeatInTicks())&&this.origin()>=this.waitTime,r=this.current&&this.pulseToSecond(this.origin())>=this.pulseToSecond(this.lastCallTime)+this.pulseToSecond(this.current.duration*4*this.app.clock.ppqn)&&this.origin()>=this.waitTime,i=t||r;return this.skipIndex=i?0:this.skipIndex+1,this.index=i?this.index+1:this.index,i&&this.notStarted()&&(this.initCallTime=this.app.clock.pulses_since_origin),this.atTheBeginning()&&(this.startCallTime=this.app.clock.pulses_since_origin),i});T(this,"lead",()=>this.voiceleading());T(this,"invert",t=>(this.atTheBeginning()&&this.ziffers.invert(t),this));T(this,"out",()=>{});this.app=i,this.input=t,this.options=r,this.ziffers=new LP(t,r)}get ticks(){return this.ziffers.duration*4*this.app.clock.ppqn}nextEndTime(){return this.startCallTime+this.ticks}updateLastCallTime(){(this.notStarted()||this.played)&&(this.lastCallTime=this.app.clock.pulses_since_origin,this.played=!1)}notStarted(){return this.ziffers.notStarted()}sound(t){if(this.areWeThereYet()){const r=this.next(),i=this.app.clock.convertPulseToSecond(r.duration*4*this.app.clock.ppqn);if(r instanceof di){const a=r.getExisting("freq","pitch","key","scale","octave","parsedScale");return a.dur=i,new Cm(a,this.app).sound(t)}else if(r instanceof va){const a=r.pitches.map(s=>s.getExisting("freq","pitch","key","scale","octave","parsedScale"));return new Cm({dur:i},this.app).chord(a).sound(t)}else if(r instanceof Em)return Oc.createRestProxy(r.duration,this.app)}else return Sc.createSkipProxy()}midi(t=void 0){if(this.areWeThereYet()){const r=this.next(),i=r.getExisting("note","pitch","bend","key","scale","octave","parsedScale");if(r instanceof di){const a=new ym(i,this.app);return t?a.note(t):a}else{if(r instanceof Em)return Oc.createRestProxy(r.duration,this.app);if(r instanceof va){const a=r.notes();return new ym(i,this.app).chord(a)}}}else return Sc.createSkipProxy()}scale(t){return this.atTheBeginning()&&this.ziffers.scale(t),this}key(t){return this.atTheBeginning()&&this.ziffers.key(t),this}octave(t){return this.atTheBeginning()&&this.ziffers.octave(t),this}voiceleading(){return this.atTheBeginning()&&this.ziffers.lead(),this}retrograde(){return this.atTheBeginning()&&this.ziffers.retrograde(),this}wait(t){if(this.atTheBeginning()){if(typeof t=="function"){const r=this.app.api.patternCache.get(t.name);return r&&(this.waitTime=r.nextEndTime()),this}this.waitTime=this.origin()+Math.ceil(t*4*this.app.clock.ppqn)}return this}sync(t){if(this.atTheBeginning()&&this.notStarted()){const r=this.app.clock.pulses_since_origin,i=typeof t=="function"?t.name:t;if(r>0){const a=this.app.api.patternCache.get(i);if(a){const s=a.ziffers.duration,o=a.startCallTime,l=s*4*this.app.clock.ppqn;this.waitTime=o+l}}}return this}}const O3=n=>n[0]==="{"&&n[n.length-1]==="}",Ws=(n,e)=>{if(O3(n)){const t=JSON.parse(n);return JSON.stringify({...t,...e})}else return JSON.stringify({...e,text:n})},E3=n=>{String.prototype.speak=function(){const e=JSON.parse(this.valueOf());new dR({...e,text:e.text}).speak().then(()=>{}).catch(t=>{console.log("Error speaking:",t)})},String.prototype.rate=function(e){return Ws(this.valueOf(),{rate:e})},String.prototype.pitch=function(e){return Ws(this.valueOf(),{pitch:e})},String.prototype.lang=function(e){return Ws(this.valueOf(),{lang:e})},String.prototype.volume=function(e){return Ws(this.valueOf(),{volume:e})},String.prototype.voice=function(e){return Ws(this.valueOf(),{voice:e})},String.prototype.z=function(e={}){return n.z(this.valueOf(),e)},String.prototype.z0=function(e={}){return n.z0(this.valueOf(),e)},String.prototype.z1=function(e={}){return n.z1(this.valueOf(),e)},String.prototype.z2=function(e={}){return n.z2(this.valueOf(),e)},String.prototype.z3=function(e={}){return n.z3(this.valueOf(),e)},String.prototype.z4=function(e={}){return n.z4(this.valueOf(),e)},String.prototype.z5=function(e={}){return n.z5(this.valueOf(),e)},String.prototype.z6=function(e={}){return n.z6(this.valueOf(),e)},String.prototype.z7=function(e={}){return n.z7(this.valueOf(),e)},String.prototype.z8=function(e={}){return n.z8(this.valueOf(),e)},String.prototype.z9=function(e={}){return n.z9(this.valueOf(),e)},String.prototype.z10=function(e={}){return n.z10(this.valueOf(),e)},String.prototype.z11=function(e={}){return n.z11(this.valueOf(),e)},String.prototype.z12=function(e={}){return n.z12(this.valueOf(),e)},String.prototype.z13=function(e={}){return n.z13(this.valueOf(),e)},String.prototype.z14=function(e={}){return n.z14(this.valueOf(),e)},String.prototype.z15=function(e={}){return n.z15(this.valueOf(),e)},String.prototype.z16=function(e={}){return n.z16(this.valueOf(),e)},String.prototype.note=function(){try{return parseInt(this.valueOf())}catch{return Kn(this.valueOf())}}};let Lu;class dR{constructor(e){T(this,"speak",()=>new Promise((e,t)=>{if(this.options.text){const r=window.speechSynthesis;r.speaking&&r.cancel();const i=new SpeechSynthesisUtterance(this.options.text);i.rate=this.options.rate||1,i.pitch=this.options.pitch||1,i.volume=this.options.volume||1,this.options.voice&&(i.voice=r.getVoices()[this.options.voice]),this.options.lang&&(this.options.lang.length===2?i.lang=`${this.options.lang}-${this.options.lang.toUpperCase()}`:this.options.lang.length===5?i.lang=this.options.lang:i.lang="en-US"),i.onend=()=>{e()},i.onerror=a=>{t(a)},r.speaking?(r.cancel(),Lu&&clearTimeout(Lu),Lu=setTimeout(()=>{r.speak(i)},200)):r.speak(i)}else t("No text provided")}));this.options=e}}async function ZO(){return Promise.all([KP(),za("github:tidalcycles/Dirt-Samples/master").then(()=>d3()),g3(),za("github:Bubobubobubobubo/Dough-Samples/main"),za("github:Bubobubobubobubo/Dough-Amiga/main"),za("github:Bubobubobubobubo/Dough-Waveforms/main")])}class b3{constructor(e){T(this,"variables",{});T(this,"codeExamples",{});T(this,"counters",{});T(this,"_drunk",new BP(-100,100,!1));T(this,"randomGen",Math.random);T(this,"currentSeed");T(this,"localSeeds",new Map);T(this,"patternCache",new Im({max:1e3,ttl:1e3*60*5}));T(this,"errorTimeoutID",0);T(this,"printTimeoutID",0);T(this,"MidiConnection",new PP);T(this,"load");T(this,"_loadUniverseFromInterface",e=>{this.app.loadUniverse(e),this.app.openBuffersModal()});T(this,"_deleteUniverseFromInterface",e=>{delete this.app.universes[e],this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});T(this,"_playDocExample",e=>{let t=this.app.universes[this.app.selected_universe];this.app.exampleIsPlaying=!0,t.example?t.example.candidate=e||this.app.selectedExample:(t.example={candidate:"",committed:"",evaluations:0},t.example.candidate=e||this.app.selectedExample),this.play()});T(this,"_stopDocExample",()=>{let e=this.app.universes[this.app.selected_universe];(e==null?void 0:e.example)!==void 0&&(this.app.exampleIsPlaying=!1,e.example.candidate="",e.example.committed=""),this.pause()});T(this,"_playDocExampleOnce",e=>{let t=this.app.universes[this.app.selected_universe];(t==null?void 0:t.example)!==void 0&&(t.example.candidate="",t.example.committed=""),this.play(),this.app.exampleIsPlaying=!0,zM(this.app,e)});T(this,"_all_samples",()=>Ug.get());T(this,"_reportError",e=>{console.log(e),clearTimeout(this.errorTimeoutID),clearTimeout(this.printTimeoutID),this.app.error_line.innerHTML=e,this.app.error_line.style.color="color-red-800",this.app.error_line.classList.remove("hidden"),this.errorTimeoutID=setTimeout(()=>this.app.error_line.classList.add("hidden"),2e3)});T(this,"_logMessage",e=>{console.log(e),clearTimeout(this.printTimeoutID),clearTimeout(this.errorTimeoutID),this.app.error_line.innerHTML=e,this.app.error_line.style.color="white",this.app.error_line.classList.remove("hidden"),this.printTimeoutID=setTimeout(()=>this.app.error_line.classList.add("hidden"),4e3)});T(this,"time",()=>this.app.audioContext.currentTime);T(this,"play",()=>{this.app.setButtonHighlighting("play",!0),this.app.clock.start()});T(this,"pause",()=>{this.app.setButtonHighlighting("pause",!0),this.app.clock.pause()});T(this,"stop",()=>{this.app.setButtonHighlighting("stop",!0),this.app.clock.stop()});T(this,"silence",this.stop);T(this,"hush",this.stop);T(this,"warp",e=>{this.app.clock.tick=e,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e)});T(this,"beat_warp",e=>{this.app.clock.tick=e*this.app.clock.ppqn,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e*this.app.clock.ppqn)});T(this,"onmousemove",e=>{this.app._mouseX=e.pageX,this.app._mouseY=e.pageY});T(this,"mouseX",()=>this.app._mouseX);T(this,"mouseY",()=>this.app._mouseY);T(this,"noteX",()=>Math.floor(this.app._mouseX/document.body.clientWidth*127));T(this,"noteY",()=>Math.floor(this.app._mouseY/document.body.clientHeight*127));T(this,"script",(...e)=>{e.forEach(t=>{es(this.app,this.app.universes[this.app.selected_universe].locals[t])})});T(this,"s",this.script);T(this,"clear_script",e=>{this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}});T(this,"cs",this.clear_script);T(this,"copy_script",(e,t)=>{this.app.universes[this.app.selected_universe].locals[t]=this.app.universes[this.app.selected_universe].locals[e]});T(this,"cps",this.copy_script);T(this,"midi_outputs",()=>{this._logMessage(this.MidiConnection.listMidiOutputs())});T(this,"midi_output",e=>{e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())});T(this,"midi",(e=60,t,r)=>(t!==void 0&&(typeof e=="number"&&(e={note:e}),e.velocity=t),r!==void 0&&(typeof e=="number"&&(e={note:e}),e.channel=r),new ym(e,this.app)));T(this,"sysex",e=>{this.MidiConnection.sendSysExMessage(e)});T(this,"pitch_bend",(e,t)=>{this.MidiConnection.sendPitchBend(e,t)});T(this,"program_change",(e,t)=>{this.MidiConnection.sendProgramChange(e,t)});T(this,"midi_clock",()=>{this.MidiConnection.sendMidiClock()});T(this,"control_change",({control:e=20,value:t=0,channel:r=0})=>{this.MidiConnection.sendMidiControlChange(e,t,r)});T(this,"midi_panic",()=>{this.MidiConnection.panic()});T(this,"generateCacheKey",(...e)=>e.map(t=>JSON.stringify(t)).join(","));T(this,"z",(e,t={},r="")=>{const i="z"+r.toString(),a=r===""?this.generateCacheKey(e,t):i;let s;return this.app.api.patternCache.has(a)&&(s=this.app.api.patternCache.get(a),s.input!==e&&(s=void 0)),s||(s=new S3(e,t,this.app),this.app.api.patternCache.set(a,s)),typeof r=="number"&&(s.zid=i),s.updateLastCallTime(),r!==""&&s.sync("z0"),s});T(this,"z0",(e,t={})=>this.z(e,t,0));T(this,"z1",(e,t={})=>this.z(e,t,1));T(this,"z2",(e,t={})=>this.z(e,t,2));T(this,"z3",(e,t={})=>this.z(e,t,3));T(this,"z4",(e,t={})=>this.z(e,t,4));T(this,"z5",(e,t={})=>this.z(e,t,5));T(this,"z6",(e,t={})=>this.z(e,t,6));T(this,"z7",(e,t={})=>this.z(e,t,7));T(this,"z8",(e,t={})=>this.z(e,t,8));T(this,"z9",(e,t={})=>this.z(e,t,9));T(this,"z10",(e,t={})=>this.z(e,t,10));T(this,"z11",(e,t={})=>this.z(e,t,11));T(this,"z12",(e,t={})=>this.z(e,t,12));T(this,"z13",(e,t={})=>this.z(e,t,13));T(this,"z14",(e,t={})=>this.z(e,t,14));T(this,"z15",(e,t={})=>this.z(e,t,15));T(this,"z16",(e,t={})=>this.z(e,t,16));T(this,"counter",(e,t,r)=>(e in this.counters?(this.counters[e].limit!==t&&(this.counters[e].value=0,this.counters[e].limit=t),this.counters[e].step!==r&&(this.counters[e].step=r??this.counters[e].step),this.counters[e].value+=this.counters[e].step,this.counters[e].limit!==void 0&&this.counters[e].value>this.counters[e].limit&&(this.counters[e].value=0)):this.counters[e]={value:0,step:r??1,limit:t},this.counters[e].value));T(this,"$",this.counter);T(this,"i",e=>e!==void 0?(this.app.universes[this.app.selected_universe].global.evaluations=e,this.app.universes[this.app.selected_universe]):this.app.universes[this.app.selected_universe].global.evaluations);T(this,"drunk",e=>e!==void 0?(this._drunk.position=e,this._drunk.getPosition()):(this._drunk.step(),this._drunk.getPosition()));T(this,"drunk_max",e=>{this._drunk.max=e});T(this,"drunk_min",e=>{this._drunk.min=e});T(this,"drunk_wrap",e=>{this._drunk.toggleWrap(e)});T(this,"variable",(e,t)=>typeof e=="string"&&t===void 0?this.variables[e]:(this.variables[e]=t,this.variables[e]));T(this,"v",this.variable);T(this,"delete_variable",e=>{delete this.variables[e]});T(this,"dv",this.delete_variable);T(this,"clear_variables",()=>{this.variables={}});T(this,"cv",this.clear_variables);T(this,"randI",(e,t)=>Math.floor(this.randomGen()*(t-e+1))+e);T(this,"rand",(e,t)=>this.randomGen()*(t-e)+e);T(this,"irand",this.randI);T(this,"rI",this.randI);T(this,"r",this.rand);T(this,"ir",this.randI);T(this,"seed",e=>{typeof e=="number"&&(e=e.toString()),this.currentSeed!==e&&(this.currentSeed=e,this.randomGen=Om(e))});T(this,"localSeededRandom",e=>{if(typeof e=="number"&&(e=e.toString()),this.localSeeds.has(e))return this.localSeeds.get(e);const t=Om(e);return this.localSeeds.set(e,t),t});T(this,"clearLocalSeed",(e=void 0)=>{e&&this.localSeeds.delete(e.toString()),this.localSeeds.clear()});T(this,"quantize",(e,t)=>{if(t.length===0)return e;let r=t[0];return t.forEach(i=>{Math.abs(i-e)Math.min(Math.max(e,t),r));T(this,"cmp",this.clamp);T(this,"bpm",e=>e===void 0?this.app.clock.bpm:((e<1||e>500)&&console.log(`Setting bpm to ${e}`),this.app.clock.bpm=e,e));T(this,"tempo",this.bpm);T(this,"bpb",e=>e===void 0?this.app.clock.time_signature[0]:(e<1&&console.log(`Setting bpb to ${e}`),this.app.clock.time_signature[0]=e,e));T(this,"ppqn",e=>e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e));T(this,"time_signature",(e,t)=>{this.app.clock.time_signature=[e,t]});T(this,"prob",e=>this.randomGen()*100this.randomGen()>.5);T(this,"odds",(e,t=1)=>this.randomGen()!1);T(this,"almostNever",(e=1)=>this.randomGen()<.025*this.ppqn()/(this.ppqn()*e));T(this,"rarely",(e=1)=>this.randomGen()<.1*this.ppqn()/(this.ppqn()*e));T(this,"scarcely",(e=1)=>this.randomGen()<.25*this.ppqn()/(this.ppqn()*e));T(this,"sometimes",(e=1)=>this.randomGen()<.5*this.ppqn()/(this.ppqn()*e));T(this,"often",(e=1)=>this.randomGen()<.75*this.ppqn()/(this.ppqn()*e));T(this,"frequently",(e=1)=>this.randomGen()<.9*this.ppqn()/(this.ppqn()*e));T(this,"almostAlways",(e=1)=>this.randomGen()<.985*this.ppqn()/(this.ppqn()*e));T(this,"always",(e=1)=>!0);T(this,"dice",e=>Math.floor(this.randomGen()*e)+1);T(this,"cbar",()=>this.app.clock.time_position.bar+1);T(this,"ctick",()=>this.app.clock.tick+1);T(this,"cpulse",()=>this.app.clock.time_position.pulse+1);T(this,"cbeat",()=>this.app.clock.time_position.beat+1);T(this,"ebeat",()=>this.app.clock.beats_since_origin+1);T(this,"epulse",()=>this.app.clock.pulses_since_origin+1);T(this,"nominator",()=>this.app.clock.time_signature[0]);T(this,"meter",()=>this.app.clock.time_signature[1]);T(this,"denominator",this.meter);T(this,"beat",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%Math.floor(r*this.ppqn())===0).some(r=>r===!0));T(this,"b",this.beat);T(this,"pulse",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%r===0).some(r=>r===!0));T(this,"flip",(e,t=50)=>{const r=this.app.clock.pulses_since_origin,i=Math.floor(e*this.ppqn()),a=Math.floor(t/100*i);return r%i{const t=this.app.clock.time_position.bar;return Math.floor(t/e)%2===0});T(this,"onbar",(e,t=this.app.clock.time_signature[0])=>{let r=this.app.clock.time_position.bar%t+1;return typeof e=="number"?e===r:e.some(i=>i==r)});T(this,"onbeat",(...e)=>{let t=[];return e.forEach(r=>{let i=r%this.nominator()||this.nominator(),a=Math.floor(i);a=a==0?this.nominator():a;let s=Math.floor((i-a)*this.ppqn()+1);s<=0&&(s=s+this.ppqn()*this.nominator()),t.push(a===this.cbeat()&&this.cpulse()===s)}),t.some(r=>r==!0)});T(this,"oncount",(e,t)=>{typeof e=="number"&&(e=[e]);const r=this.app.clock.pulses_since_origin;let i=[];return e.forEach(a=>{a=a<1?0:a-1;const s=Math.ceil(a*this.ppqn()),o=r%(this.ppqn()*t);return i.push(o===s)}),i.some(a=>a==!0)});T(this,"oneuclid",(e,t,r=0)=>{const a=this._euclidean_cycle(e,t,r).reduce((s,o,l)=>(o&&s.push(l+1),s),[]);return this.oncount(a,t)});T(this,"delay",(e,t)=>{setTimeout(t,e)});T(this,"delayr",(e,t,r)=>{[...Array(t).keys()].map(a=>e*a).forEach((a,s)=>{setTimeout(r,a)})});T(this,"euclid",(e,t,r,i=0)=>this._euclidean_cycle(t,r,i)[e%r]);T(this,"ec",this.euclid);T(this,"rhythm",(e,t,r,i=0)=>this.beat(e)&&this._euclidean_cycle(t,r,i).beat(e));T(this,"bin",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return i[e%i.length]});T(this,"binrhythm",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return this.beat(e)&&i.beat(e)});T(this,"line",(e,t,r=1)=>{const i=[];if(t>e&&r>0||tMath.sin(this.app.clock.ctx.currentTime*Math.PI*2*e)+t);T(this,"usine",(e=1,t=0)=>(this.sine(e,t)+1)/2);T(this,"saw",(e=1,t=0)=>this.app.clock.ctx.currentTime*e%1*2-1+t);T(this,"usaw",(e=1,t=0)=>(this.saw(e,t)+1)/2);T(this,"triangle",(e=1,t=0)=>Math.abs(this.saw(e,t))*2-1);T(this,"utriangle",(e=1,t=0)=>(this.triangle(e,t)+1)/2);T(this,"square",(e=1,t=0,r=.5)=>{const i=1/e;return(Date.now()/1e3+t)%i/i(this.square(e,t,r)+1)/2);T(this,"noise",()=>this.randomGen()*2-1);T(this,"min",(...e)=>Math.min(...e));T(this,"max",(...e)=>Math.max(...e));T(this,"mean",(...e)=>e.reduce((r,i)=>r+i,0)/e.length);T(this,"limit",(e,t,r)=>Math.min(Math.max(e,t),r));T(this,"abs",Math.abs);T(this,"speak",(e,t="en-US",r=0,i=1,a=1)=>{new dR({text:e,lang:t,voice:r,rate:i,pitch:a}).speak().then(()=>{}).catch(o=>{console.log(o)})});T(this,"stop_hydra",()=>{this.app.hydra.hush()});T(this,"sound",e=>new Cm(e,this.app));T(this,"snd",this.sound);T(this,"samples",za);T(this,"log",e=>{console.log(e),this._logMessage(e)});T(this,"scale",Pg);T(this,"rate",e=>{});T(this,"divseq",(...e)=>{const t=e[0],r=e.slice(1),i=this.app.clock.pulses_since_origin,a=Math.floor(i/Math.floor(t*this.ppqn()));return r[a%r.length]});T(this,"seqbeat",(...e)=>e[this.app.clock.time_position.beat%e.length]);T(this,"seqbar",(...e)=>e[(this.app.clock.time_position.bar+1)%e.length]);this.app=e}_euclidean_cycle(e,t,r=0){if(e==t)return Array.from({length:t},()=>!0);function i(o,l){const c=o.length,u=(l+1)%c;return o[l]>o[u]}if(e>=t)return[!0];const a=Array.from({length:t},(o,l)=>(e*(l-1)%t+t)%t);let s=a.map((o,l)=>i(a,l));return r!=0&&(s=s.slice(r).concat(s.slice(0,r))),s}}const T3=n=>{Array.prototype.in=function(e){return this.includes(e)},Array.prototype.square=function(){return this.map(e=>e*e)},Array.prototype.sqrt=function(){if(this.some(e=>e<0))throw new Error("Cannot take square root of negative number");return this.map(e=>Math.sqrt(e))},Array.prototype.add=function(e){return this.map(t=>t+e)},Array.prototype.sub=function(e){return this.map(t=>t-e)},Array.prototype.mult=function(e){return this.map(t=>t*e)},Array.prototype.div=function(e){if(e===0)throw new Error("Division by zero");return this.map(t=>t/e)},Array.prototype.pick=function(){return this[Math.floor(n.randomGen()*this.length)]},Array.prototype.gen=function(e,t,r){return r<1?[]:Array.from({length:r},()=>Math.floor(n.randomGen()*(t-e+1))+e)},Array.prototype.bar=function(){return this[n.app.clock.time_position.bar%this.length]},Array.prototype.pulse=function(){return this[n.app.clock.time_position.pulse%this.length]},Array.prototype.beat=function(e=1){const t=e,r=n.app.clock.pulses_since_origin,i=Math.floor(r/Math.floor(t*n.ppqn()));return this[i%this.length]},Array.prototype.b=Array.prototype.beat,Array.prototype.shuffle=function(){let e=this.length,t;for(;e!==0;)t=Math.floor(n.randomGen()*e),e--,[this[e],this[t]]=[this[t],this[e]];return this},Array.prototype.rotate=function(e){const t=this.length;if(e<0)e=t+e%t;else if(e>0)e=e%t;else return this;const r=this.splice(-e,e);return this.unshift(...r),this},Array.prototype.unique=function(){const e=new Set;let t=0;for(let r=0;r100)throw new Error("Amount should be between 0 and 100");if(this.length<=1)return this;for(let t=0;t1)this.splice(t,1);else return this;else t++;return this},Array.prototype.repeatAll=function(e=1){if(e<1)throw new Error("Amount should be at least 1");let t=[];for(let r=0;r(i%a+a)%a,r=eR(zo(n));return this.map(i=>{const a=Math.floor(i/r.length)*12;return r[t(i,r.length)]+e+a})};Array.prototype.scaleArp=function(n="major",e=0){const t=eR(zo(n));let r=[];e=e>t.length?t.length:e,e=e==0?t.length:e;for(let i=0;i>1|(Mt&21845)<<1;Ri=(Ri&52428)>>2|(Ri&13107)<<2,Ri=(Ri&61680)>>4|(Ri&3855)<<4,Lm[Mt]=((Ri&65280)>>8|(Ri&255)<<8)>>1}var Hn=function(n,e,t){for(var r=n.length,i=0,a=new Kr(e);i>l]=c}else for(o=new Kr(r),i=0;i>15-n[i]);return o},qi=new ur(288);for(var Mt=0;Mt<144;++Mt)qi[Mt]=8;for(var Mt=144;Mt<256;++Mt)qi[Mt]=9;for(var Mt=256;Mt<280;++Mt)qi[Mt]=7;for(var Mt=280;Mt<288;++Mt)qi[Mt]=8;var wo=new ur(32);for(var Mt=0;Mt<32;++Mt)wo[Mt]=5;var C3=Hn(qi,9,0),y3=Hn(qi,9,1),A3=Hn(wo,5,0),R3=Hn(wo,5,1),Mu=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},gn=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},Pu=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},$g=function(n){return(n+7)/8|0},Qg=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new ur(t-e);return r.set(n.subarray(e,t)),r},I3=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Mr=function(n,e,t){var r=new Error(e||I3[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Mr),!t)throw r;return r},qg=function(n,e,t,r){var i=n.length,a=r?r.length:0;if(!i||e.f&&!e.l)return t||new ur(0);var s=!t||e.i!=2,o=e.i;t||(t=new ur(i*3));var l=function(Ve){var et=t.length;if(Ve>et){var nt=new ur(Math.max(et*2,Ve));nt.set(t),t=nt}},c=e.f||0,u=e.p||0,p=e.b||0,m=e.l,_=e.d,b=e.m,A=e.n,R=i*8;do{if(!m){c=gn(n,u,1);var k=gn(n,u+1,3);if(u+=3,k)if(k==1)m=y3,_=R3,b=9,A=5;else if(k==2){var E=gn(n,u,31)+257,S=gn(n,u+10,15)+4,I=E+gn(n,u+5,31)+1;u+=14;for(var x=new ur(I),w=new ur(19),L=0;L>4;if(Y<16)x[L++]=Y;else{var ee=0,M=0;for(Y==16?(M=3+gn(n,u,3),u+=2,ee=x[L-1]):Y==17?(M=3+gn(n,u,7),u+=3):Y==18&&(M=11+gn(n,u,127),u+=7);M--;)x[L++]=ee}}var $=x.subarray(0,E),j=x.subarray(E);b=Mu($),A=Mu(j),m=Hn($,b,1),_=Hn(j,A,1)}else Mr(1);else{var Y=$g(u)+4,Z=n[Y-4]|n[Y-3]<<8,h=Y+Z;if(h>i){o&&Mr(0);break}s&&l(p+Z),t.set(n.subarray(Y,h),p),e.b=p+=Z,e.p=u=h*8,e.f=c;continue}if(u>R){o&&Mr(0);break}}s&&l(p+131072);for(var X=(1<>4;if(u+=ee&15,u>R){o&&Mr(0);break}if(ee||Mr(2),Oe<256)t[p++]=Oe;else if(Oe==256){le=u,m=null;break}else{var ke=Oe-254;if(Oe>264){var L=Oe-257,Me=Fc[L];ke=gn(n,u,(1<>4;Ee||Mr(3),u+=Ee&15;var j=v3[Ie];if(Ie>3){var Me=Yc[Ie];j+=Pu(n,u)&(1<R){o&&Mr(0);break}s&&l(p+131072);var ue=p+ke;if(p>8},Xs=function(n,e,t){t<<=e&7;var r=e/8|0;n[r]|=t,n[r+1]|=t>>8,n[r+2]|=t>>16},Bu=function(n,e){for(var t=[],r=0;rm&&(m=a[r].s);var _=new Kr(m+1),b=Mm(t[u-1],_,0);if(b>e){var r=0,A=0,R=b-e,k=1<e)A+=k-(1<>=R;A>0;){var Z=a[r].s;_[Z]=0&&A;--r){var h=a[r].s;_[h]==e&&(--_[h],++A)}b=e}return{t:new ur(_),l:b}},Mm=function(n,e,t){return n.s==-1?Math.max(Mm(n.l,e,t+1),Mm(n.r,e,t+1)):e[n.s]=t},jO=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new Kr(++e),r=0,i=n[0],a=1,s=function(l){t[r++]=l},o=1;o<=e;++o)if(n[o]==i&&o!=e)++a;else{if(!i&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(i),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(i);a=1,i=n[o]}return{c:t.subarray(0,r),n:e}},Zs=function(n,e){for(var t=0,r=0;r>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var a=0;a4&&!L[xm[te-1]];--te);var ne=c+5<<3,re=Zs(i,qi)+Zs(a,wo)+s,ee=Zs(i,m)+Zs(a,A)+s+14+3*te+Zs(I,L)+2*I[16]+3*I[17]+7*I[18];if(l>=0&&ne<=re&&ne<=ee)return gR(e,u,n.subarray(l,l+c));var M,$,j,X;if(ii(e,u,1+(ee15&&(ii(e,u,ke[x]>>5&127),u+=ke[x]>>12)}}else M=C3,$=qi,j=A3,X=wo;for(var x=0;x255){var Me=Ee>>18&31;Xs(e,u,M[Me+257]),u+=$[Me+257],Me>7&&(ii(e,u,Ee>>23&31),u+=Fc[Me]);var Ie=Ee&31;Xs(e,u,j[Ie]),u+=X[Ie],Ie>3&&(Xs(e,u,Ee>>5&8191),u+=Yc[Ie])}else Xs(e,u,M[Ee]),u+=$[Ee]}return Xs(e,u,M[256]),u+$[256]},N3=new Gg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),_R=new ur(0),w3=function(n,e,t,r,i,a){var s=a.z||n.length,o=new ur(r+s+5*(1+Math.ceil(s/7e3))+i),l=o.subarray(r,o.length-i),c=a.l,u=(a.r||0)&7;if(e){u&&(l[0]=a.r>>3);for(var p=N3[e-1],m=p>>13,_=p&8191,b=(1<7e3||L>24576)&&(M>423||!c)){u=JO(n,l,0,h,E,S,x,L,te,w-te,u),L=I=x=0,te=w;for(var $=0;$<286;++$)E[$]=0;for(var $=0;$<30;++$)S[$]=0}var j=2,X=0,ce=_,le=re-ee&32767;if(M>2&&ne==Z(w-le))for(var Oe=Math.min(m,M)-1,ke=Math.min(32767,w),Me=Math.min(258,M);le<=ke&&--ce&&re!=ee;){if(n[w+j]==n[w+j-le]){for(var Ee=0;Eej){if(j=Ee,X=le,Ee>Oe)break;for(var Ie=Math.min(le,Ee-2),ue=0,$=0;$ue&&(ue=Ve,ee=De)}}}re=ee,ee=A[re],le+=re-ee&32767}if(X){h[L++]=268435456|km[j]<<18|KO[X];var et=km[j]&31,nt=KO[X]&31;x+=Fc[et]+Yc[nt],++E[257+et],++S[nt],G=w+j,++I}else h[L++]=n[w],++E[n[w]]}}for(w=Math.max(w,G);w=s&&(l[u/8|0]=c,Ke=s),u=gR(l,u+1,n.subarray(w,Ke))}a.i=s}return Qg(o,0,r+$g(u)+i)},D3=function(){for(var n=new Int32Array(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(t&1&&-306674912)^t>>>1;n[e]=t}return n}(),x3=function(){var n=-1;return{p:function(e){for(var t=n,r=0;r>>8;n=t},d:function(){return~n}}},k3=function(n,e,t,r,i){if(!i&&(i={l:1},e.dictionary)){var a=e.dictionary.subarray(-32768),s=new ur(a.length+n.length);s.set(a),s.set(n,a.length),n=s,i.w=a.length}return w3(n,e.level==null?6:e.level,e.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):12+e.mem,t,r,i)},Pm=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},L3=function(n,e){var t=e.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=e.level<2?4:e.level==9?2:0,n[9]=3,e.mtime!=0&&Pm(n,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){n[3]=8;for(var r=0;r<=t.length;++r)n[r+10]=t.charCodeAt(r)}},M3=function(n){(n[0]!=31||n[1]!=139||n[2]!=8)&&Mr(6,"invalid gzip data");var e=n[3],t=10;e&4&&(t+=(n[10]|n[11]<<8)+2);for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!n[t++]);return t+(e&2)},P3=function(n){var e=n.length;return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0},B3=function(n){return 10+(n.filename?n.filename.length+1:0)},U3=function(n,e){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Mr(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&Mr(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function F3(n,e){return qg(n,{i:2},e&&e.out,e&&e.dictionary)}function Y3(n,e){e||(e={});var t=x3(),r=n.length;t.p(n);var i=k3(n,e,B3(e),8),a=i.length;return L3(i,e),Pm(i,a-8,t.d()),Pm(i,a-4,r),i}function G3(n,e){var t=M3(n);return t+8>n.length&&Mr(6,"invalid gzip data"),qg(n.subarray(t,-8),{i:2},e&&e.out||new ur(P3(n)),e&&e.dictionary)}function $3(n,e){return qg(n.subarray(U3(n,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function Q3(n,e){return n[0]==31&&n[1]==139&&n[2]==8?G3(n,e):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?F3(n,e):$3(n,e)}var Bm=typeof TextDecoder<"u"&&new TextDecoder,q3=0;try{Bm.decode(_R,{stream:!0}),q3=1}catch{}var V3=function(n){for(var e="",t=0;;){var r=n[t++],i=(r>127)+(r>223)+(r>239);if(t+i>n.length)return{s:e,r:Qg(n,t-1)};i?i==3?(r=((r&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?e+=String.fromCharCode((r&31)<<6|n[t++]&63):e+=String.fromCharCode((r&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(r)}};function z3(n,e){if(e){for(var t="",r=0;r (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,describe:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,describe:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",describe:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,describe:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,describe:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,describe:"Support for HTML Tag escaping. ex:
foo
",type:"boolean"},emoji:{defaultValue:!1,describe:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,describe:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},ellipsis:{defaultValue:!0,describe:"Replaces three dots with the ellipsis unicode character",type:"boolean"},completeHTMLDocument:{defaultValue:!1,describe:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,describe:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,describe:"Split adjacent blockquote blocks",type:"boolean"}};if(h===!1)return JSON.parse(JSON.stringify(E));var S={};for(var I in E)E.hasOwnProperty(I)&&(S[I]=E[I].defaultValue);return S}function t(){var h=e(!0),E={};for(var S in h)h.hasOwnProperty(S)&&(E[S]=!0);return E}var r={},i={},a={},s=e(!0),o="vanilla",l={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:e(!0),allOn:t()};r.helper={},r.extensions={},r.setOption=function(h,E){return s[h]=E,this},r.getOption=function(h){return s[h]},r.getOptions=function(){return s},r.resetOptions=function(){s=e(!0)},r.setFlavor=function(h){if(!l.hasOwnProperty(h))throw Error(h+" flavor was not found");r.resetOptions();var E=l[h];o=h;for(var S in E)E.hasOwnProperty(S)&&(s[S]=E[S])},r.getFlavor=function(){return o},r.getFlavorOptions=function(h){if(l.hasOwnProperty(h))return l[h]},r.getDefaultOptions=function(h){return e(h)},r.subParser=function(h,E){if(r.helper.isString(h))if(typeof E<"u")i[h]=E;else{if(i.hasOwnProperty(h))return i[h];throw Error("SubParser named "+h+" not registered!")}},r.extension=function(h,E){if(!r.helper.isString(h))throw Error("Extension 'name' must be a string");if(h=r.helper.stdExtName(h),r.helper.isUndefined(E)){if(!a.hasOwnProperty(h))throw Error("Extension named "+h+" is not registered!");return a[h]}else{typeof E=="function"&&(E=E()),r.helper.isArray(E)||(E=[E]);var S=c(E,h);if(S.valid)a[h]=E;else throw Error(S.error)}},r.getAllExtensions=function(){return a},r.removeExtension=function(h){delete a[h]},r.resetExtensions=function(){a={}};function c(h,E){var S=E?"Error in "+E+" extension->":"Error in unnamed extension",I={valid:!0,error:""};r.helper.isArray(h)||(h=[h]);for(var x=0;x"u"},r.helper.forEach=function(h,E){if(r.helper.isUndefined(h))throw new Error("obj param is required");if(r.helper.isUndefined(E))throw new Error("callback param is required");if(!r.helper.isFunction(E))throw new Error("callback param must be a function/closure");if(typeof h.forEach=="function")h.forEach(E);else if(r.helper.isArray(h))for(var S=0;S").replace(/&/g,"&")};var p=function(h,E,S,I){var x=I||"",w=x.indexOf("g")>-1,L=new RegExp(E+"|"+S,"g"+x.replace(/g/g,"")),G=new RegExp(E,x.replace(/g/g,"")),te=[],ne,re,ee,M,$;do for(ne=0;ee=L.exec(h);)if(G.test(ee[0]))ne++||(re=L.lastIndex,M=re-ee[0].length);else if(ne&&!--ne){$=ee.index+ee[0].length;var j={left:{start:M,end:re},match:{start:re,end:ee.index},right:{start:ee.index,end:$},wholeMatch:{start:M,end:$}};if(te.push(j),!w)return te}while(ne&&(L.lastIndex=re));return te};r.helper.matchRecursiveRegExp=function(h,E,S,I){for(var x=p(h,E,S,I),w=[],L=0;L0){var ne=[];L[0].wholeMatch.start!==0&&ne.push(h.slice(0,L[0].wholeMatch.start));for(var re=0;re=0?I+(S||0):I},r.helper.splitAtIndex=function(h,E){if(!r.helper.isString(h))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[h.substring(0,E),h.substring(E)]},r.helper.encodeEmailAddress=function(h){var E=[function(S){return"&#"+S.charCodeAt(0)+";"},function(S){return"&#x"+S.charCodeAt(0).toString(16)+";"},function(S){return S}];return h=h.replace(/./g,function(S){if(S==="@")S=E[Math.floor(Math.random()*2)](S);else{var I=Math.random();S=I>.9?E[2](S):I>.45?E[1](S):E[0](S)}return S}),h},r.helper.padEnd=function(E,S,I){return S=S>>0,I=String(I||" "),E.length>S?String(E):(S=S-E.length,S>I.length&&(I+=I.repeat(S/I.length)),String(E)+I.slice(0,S))},typeof console>"u"&&(console={warn:function(h){alert(h)},log:function(h){alert(h)},error:function(h){throw h}}),r.helper.regexes={asteriskDashAndColon:/([*_:~])/g},r.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:`S`},r.Converter=function(h){var E={},S=[],I=[],x={},w=o,L={parsed:{},raw:"",format:""};G();function G(){h=h||{};for(var M in s)s.hasOwnProperty(M)&&(E[M]=s[M]);if(typeof h=="object")for(var $ in h)h.hasOwnProperty($)&&(E[$]=h[$]);else throw Error("Converter expects the passed parameter to be an object, but "+typeof h+" was passed instead.");E.extensions&&r.helper.forEach(E.extensions,te)}function te(M,$){if($=$||null,r.helper.isString(M))if(M=r.helper.stdExtName(M),$=M,r.extensions[M]){console.warn("DEPRECATION WARNING: "+M+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),ne(r.extensions[M],M);return}else if(!r.helper.isUndefined(a[M]))M=a[M];else throw Error('Extension "'+M+'" could not be loaded. It was either not found or is not a valid extension.');typeof M=="function"&&(M=M()),r.helper.isArray(M)||(M=[M]);var j=c(M,$);if(!j.valid)throw Error(j.error);for(var X=0;X - +