diff --git a/assets/index-312bb33b.js b/assets/index-8610a2d4.js similarity index 95% rename from assets/index-312bb33b.js rename to assets/index-8610a2d4.js index 6b5f72f..d1ce945 100644 --- a/assets/index-312bb33b.js +++ b/assets/index-8610a2d4.js @@ -2280,7 +2280,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=">",P="_",$="?",K="r",X="#",ce="b",oe="iii",Oe="ii",ke="iv",Me="i",Ee="vii",Ne="vi",ue="v",De=/^[0-9]/,Ze=/^[ \n\r\t]/,Ve=/^[mklpdcwyhnqaefsxtgujzo]/,et=/^[a-zA-Z0-9\-*+]/,nt=/^[A-G]/,Ke=/^[bs]/,mt=ct("-",!1),it=Nn([["0","9"]],!1,!1),Ct=ct(".",!1),Nt=La("whitespace"),ot=Nn([" ",` -`,"\r"," "],!1,!1),Ge=ct(",",!1),Tr=ct("|",!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=ct("(",!1),hr=ct(":",!1),qt=ct(")",!1),fr=ct("[:",!1),W=ct("]",!1),_e=ct("[",!1),Le=ct("{",!1),xe=ct("}",!1),rt=ct("+",!1),we=ct("*",!1),$t=ct("/",!1),ht=ct("%",!1),Ot=ct("^",!1),Jr=ct("&",!1),gt=ct(">>",!1),Zt=ct("<<",!1),yt=ct("<",!1),$e=ct(">",!1),vr=ct("_",!1),jn=ct("?",!1),ft=ct("r",!1),xr=ct("#",!1),mr=ct("b",!1),_i=Nn([["a","z"],["A","Z"],["0","9"],"-","*","+"],!1,!1),Rn=Nn([["A","G"]],!1,!1),Qt=Nn(["b","s"],!1,!1),hn=ct("iii",!1),qi=ct("ii",!1),Si=ct("iv",!1),Vi=ct("i",!1),en=ct("vii",!1),Jn=ct("vi",!1),fn=ct("v",!1),Wt=function(y){return y.filter(M=>M)},Oi=function(){return parseFloat(gr())},Ei=function(){return parseInt(gr())},q=function(){return parseInt(gr())},ie=function(){},de=function(){return KM[gr()]},ge=function(y){return y.filter(M=>M)},Ce=function(y,M){return M?Pe(GO,{item:y,times:M}):Pe($O,{items:y})},qe=function(y){return y},Be=function(y,M,Q){return Pe(pP,{left:y,operation:M,right:Q})},At=function(y,M){return Pe(dP,{items:y,times:M})},Cr=function(y){return Pe(XA,{items:y})},Fr=function(y){return y.map(M=>typeof M=="number"?M:void 0)},Ca=function(){return Math.ceil(zA(gr()))},Hi=function(y){var M=y.filter(Q=>Q).map(Q=>Pe(ui,{pitch:Q[0]},Q.toString()));return Pe($O,{items:M})},Ts=function(y){return y},Yr=function(){},vs=function(y){return Pe(xg,{items:y})},ya=function(y){return Pe(cP,{octave:y})},Aa=function(){return gr().split("").reduce((y,M)=>y+(M==="^"?1:-1),0)},Cs=function(){return Pe(YO,{seededRandom:a.seededRandom})},Ra=function(y,M){return Pe(YO,{min:y,max:M,seededRandom:a.seededRandom})},ys=function(y,M){return Pe(GO,{item:y,times:M})},Ia=function(y){return Pe(uP,{duration:y})},kr=function(y){return Pe(Sm,{duration:y})},As=function(y,M,Q,j){const le=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return Pe(ui,{duration:M,pitch:j,octave:le,add:Q})},Rs=function(y){return y.reduce((M,Q)=>M+(Q==="#"?1:-1),0)},Na=function(y,M,Q,j,le){const fe=y?a.nodeOptions.octave+y:a.nodeOptions.octave,Re=M||a.nodeOptions.duration;return Pe(ba,{pitches:[Q].concat(j),inversion:le,duration:Re,octave:fe})},wa=function(){return gr()},Is=function(y){return y},Da=function(){return gr()},Ns=function(y,M,Q,j,le){const fe=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",Re=a.nodeOptions.key?a.nodeOptions.key:"C",st=bP(j,Q,fe,y,M),Rt=M||a.nodeOptions.duration,Vt=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return Pe(ba,{duration:Rt,octave:Vt,pitches:st,chordName:j,inversion:le,scaleName:fe,key:Re})},xa=function(y,M,Q,j,le){const fe=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",Re=a.nodeOptions.key?a.nodeOptions.key:"C",st=y?a.nodeOptions.octave+y:a.nodeOptions.octave,Rt=M||a.nodeOptions.duration;return Pe(lP,{duration:Rt,roman:Q,octave:st,chordName:j,inversion:le,scaleName:fe,key:Re})},ws=function(y,M,Q){const j=y?a.nodeOptions.octave+y:a.nodeOptions.octave,le=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",fe=a.nodeOptions.key?a.nodeOptions.key:"C",Re=IP(Q,fe,le);return M||a.nodeOptions.duration,Pe(ui,{duration:M,pitch:Re.pc,octave:Re.octave+j,add:Re.add,scaleName:le,key:fe})},N=0,Je=0,_t=[{line:1,column:1}],Lr=0,In=[],ve=0,Te={},bi;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 ka(){return wn(Je,N)}function ct(y,M){return{type:"literal",text:y,ignoreCase:M}}function Nn(y,M,Q){return{type:"class",parts:y,inverted:M,ignoreCase:Q}}function Ti(){return{type:"end"}}function La(y){return{type:"other",description:y}}function ei(y){var M=_t[y],Q;if(M)return M;for(Q=y-1;!_t[Q];)Q--;for(M=_t[Q],M={line:M.line,column:M.column};QLr&&(Lr=N,In=[]),In.push(y))}function zi(y,M,Q){return new e(e.buildMessage(y,M),y,M,Q)}function Dn(){var y,M,Q=N*40+0,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,M=Wi(),M!==s&&(Je=y,M=Wt(M)),y=M,Te[Q]={nextPos:N,result:y},y)}function sr(){var y,M,Q,j,le,fe,Re,st=N*40+1,Rt=Te[st];if(Rt)return N=Rt.nextPos,Rt.result;for(y=N,M=N,i.charCodeAt(N)===45?(Q=u,N++):(Q=s,ve===0&&Ae(mt)),Q===s&&(Q=null),j=[],De.test(i.charAt(N))?(le=i.charAt(N),N++):(le=s,ve===0&&Ae(it));le!==s;)j.push(le),De.test(i.charAt(N))?(le=i.charAt(N),N++):(le=s,ve===0&&Ae(it));if(i.charCodeAt(N)===46?(le=p,N++):(le=s,ve===0&&Ae(Ct)),le!==s){if(fe=[],De.test(i.charAt(N))?(Re=i.charAt(N),N++):(Re=s,ve===0&&Ae(it)),Re!==s)for(;Re!==s;)fe.push(Re),De.test(i.charAt(N))?(Re=i.charAt(N),N++):(Re=s,ve===0&&Ae(it));else fe=s;fe!==s?(Q=[Q,j,le,fe],M=Q):(N=M,M=s)}else N=M,M=s;if(M===s)if(M=N,i.charCodeAt(N)===46?(Q=p,N++):(Q=s,ve===0&&Ae(Ct)),Q!==s){if(j=[],De.test(i.charAt(N))?(le=i.charAt(N),N++):(le=s,ve===0&&Ae(it)),le!==s)for(;le!==s;)j.push(le),De.test(i.charAt(N))?(le=i.charAt(N),N++):(le=s,ve===0&&Ae(it));else j=s;j!==s?(Q=[Q,j],M=Q):(N=M,M=s)}else N=M,M=s;return M!==s&&(Je=y,M=Oi()),y=M,Te[st]={nextPos:N,result:y},y}function ti(){var y,M,Q=N*40+2,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,i.charCodeAt(N)===45?N++:ve===0&&Ae(mt),De.test(i.charAt(N))?(M=i.charAt(N),N++):(M=s,ve===0&&Ae(it)),M!==s?(Je=y,y=Ei()):(N=y,y=s),Te[Q]={nextPos:N,result:y},y)}function _r(){var y,M,Q,j=N*40+3,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,i.charCodeAt(N)===45?N++:ve===0&&Ae(mt),M=[],De.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(it)),Q!==s)for(;Q!==s;)M.push(Q),De.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(it));else M=s;return M!==s?(Je=y,y=q()):(N=y,y=s),Te[j]={nextPos:N,result:y},y}function ri(){var y,M,Q=N*40+4,j=Te[Q];return j?(N=j.nextPos,j.result):(ve++,y=N,Ze.test(i.charAt(N))?(M=i.charAt(N),N++):(M=s,ve===0&&Ae(ot)),M!==s&&(Je=y,M=ie()),y=M,ve--,y===s&&(M=s,ve===0&&Ae(Nt)),Te[Q]={nextPos:N,result:y},y)}function Ho(){var y,M,Q=N*40+8,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,Ve.test(i.charAt(N))?(M=i.charAt(N),N++):(M=s,ve===0&&Ae(pt)),M!==s&&(Je=y,M=de()),y=M,Te[Q]={nextPos:N,result:y},y)}function xn(){var y,M=N*40+9,Q=Te[M];return Q?(N=Q.nextPos,Q.result):(y=Ho(),y===s&&(y=sr()),Te[M]={nextPos:N,result:y},y)}function Wi(){var y,M,Q,j=N*40+10,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,M=[],Q=C(),Q===s&&(Q=Ds(),Q===s&&(Q=ks(),Q===s&&(Q=Xi(),Q===s&&(Q=xs(),Q===s&&(Q=Ki(),Q===s&&(Q=d())))))),Q!==s)for(;Q!==s;)M.push(Q),Q=C(),Q===s&&(Q=Ds(),Q===s&&(Q=ks(),Q===s&&(Q=Xi(),Q===s&&(Q=xs(),Q===s&&(Q=Ki(),Q===s&&(Q=d()))))));else M=s;return M!==s&&(Je=y,M=ge(M)),y=M,Te[j]={nextPos:N,result:y},y}function Xi(){var y,M,Q,j,le,fe=N*40+11,Re=Te[fe];return Re?(N=Re.nextPos,Re.result):(y=N,i.charCodeAt(N)===40?(M=b,N++):(M=s,ve===0&&Ae(We)),M!==s?(i.charCodeAt(N)===58?N++:ve===0&&Ae(hr),Q=Wi(),Q!==s?(j=zo(),j===s&&(j=null),i.charCodeAt(N)===41?(le=R,N++):(le=s,ve===0&&Ae(qt)),le!==s?(Je=y,y=Ce(Q,j)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[fe]={nextPos:N,result:y},y)}function zo(){var y,M,Q,j=N*40+12,le=Te[j];return le?(N=le.nextPos,le.result):(y=N,i.charCodeAt(N)===58?(M=A,N++):(M=s,ve===0&&Ae(hr)),M!==s?(Q=_r(),Q!==s?(Je=y,y=qe(Q)):(N=y,y=s)):(N=y,y=s),Te[j]={nextPos:N,result:y},y)}function Ds(){var y,M,Q,j,le=N*40+13,fe=Te[le];return fe?(N=fe.nextPos,fe.result):(y=N,M=Xi(),M!==s?(Q=Ms(),Q!==s?(j=Xi(),j!==s?(Je=y,y=Be(M,Q,j)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[le]={nextPos:N,result:y},y)}function xs(){var y,M,Q,j,le,fe=N*40+14,Re=Te[fe];return Re?(N=Re.nextPos,Re.result):(y=N,i.substr(N,2)===k?(M=k,N+=2):(M=s,ve===0&&Ae(fr)),M!==s?(Q=Wi(),Q!==s?(j=zo(),j===s&&(j=null),i.charCodeAt(N)===93?(le=Y,N++):(le=s,ve===0&&Ae(W)),le!==s?(Je=y,y=At(Q,j)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[fe]={nextPos:N,result:y},y)}function ks(){var y,M,Q,j,le=N*40+15,fe=Te[le];return fe?(N=fe.nextPos,fe.result):(y=N,i.charCodeAt(N)===91?(M=Z,N++):(M=s,ve===0&&Ae(_e)),M!==s?(Q=Wi(),Q!==s?(i.charCodeAt(N)===93?(j=Y,N++):(j=s,ve===0&&Ae(W)),j!==s?(Je=y,y=Cr(Q)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[le]={nextPos:N,result:y},y)}function Zi(){var y,M=N*40+16,Q=Te[M];return Q?(N=Q.nextPos,Q.result):(y=_r(),y===s&&(y=ti()),Te[M]={nextPos:N,result:y},y)}function Ma(){var y,M,Q,j=N*40+17,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,M=[],Q=Ls(),Q===s&&(Q=Zi()),Q!==s)for(;Q!==s;)M.push(Q),Q=Ls(),Q===s&&(Q=Zi());else M=s;return M!==s&&(Je=y,M=Fr(M)),y=M,Te[j]={nextPos:N,result:y},y}function Ls(){var y,M,Q,j,le=N*40+18,fe=Te[le];return fe?(N=fe.nextPos,fe.result):(y=N,i.charCodeAt(N)===40?N++:ve===0&&Ae(We),M=Zi(),M!==s?(Q=Ms(),Q!==s?(j=Ma(),j!==s?(i.charCodeAt(N)===41?N++:ve===0&&Ae(qt),Je=y,y=Ca()):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[le]={nextPos:N,result:y},y)}function Wo(){var y,M,Q,j,le=N*40+19,fe=Te[le];if(fe)return N=fe.nextPos,fe.result;if(y=N,i.charCodeAt(N)===123?(M=h,N++):(M=s,ve===0&&Ae(Le)),M!==s){if(Q=[],j=Ma(),j===s&&(j=ri()),j!==s)for(;j!==s;)Q.push(j),j=Ma(),j===s&&(j=ri());else Q=s;Q!==s?(i.charCodeAt(N)===125?(j=E,N++):(j=s,ve===0&&Ae(xe)),j!==s?(Je=y,y=Hi(Q)):(N=y,y=s)):(N=y,y=s)}else N=y,y=s;return Te[le]={nextPos:N,result:y},y}function Ms(){var y,M=N*40+20,Q=Te[M];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(we)),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[M]={nextPos:N,result:y},y)}function Ki(){var y,M,Q=N*40+21,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,M=U(),M===s&&(M=ae(),M===s&&(M=Se(),M===s&&(M=ye(),M===s&&(M=H(),M===s&&(M=B(),M===s&&(M=f(),M===s&&(M=ri(),M===s&&(M=D(),M===s&&(M=O(),M===s&&(M=T(),M===s&&(M=Xi(),M===s&&(M=Wo(),M===s&&(M=Yc()))))))))))))),M!==s&&(Je=y,M=Ts(M)),y=M,Te[Q]={nextPos:N,result:y},y)}function Yc(){var y,M,Q=N*40+22,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,i.charCodeAt(N)===124?(M=_,N++):(M=s,ve===0&&Ae(Tr)),M!==s&&(Je=y,M=Yr()),y=M,Te[Q]={nextPos:N,result:y},y)}function d(){var y,M,Q,j,le=N*40+23,fe=Te[le];return fe?(N=fe.nextPos,fe.result):(y=N,i.charCodeAt(N)===60?(M=re,N++):(M=s,ve===0&&Ae(yt)),M!==s?(Q=Wi(),Q!==s?(i.charCodeAt(N)===62?(j=ee,N++):(j=s,ve===0&&Ae($e)),j!==s?(Je=y,y=vs(Q)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[le]={nextPos:N,result:y},y)}function f(){var y,M,Q=N*40+24,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,M=g(),M!==s&&(Je=y,M=ya(M)),y=M,Te[Q]={nextPos:N,result:y},y)}function g(){var y,M,Q,j=N*40+25,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,M=[],i.charCodeAt(N)===94?(Q=L,N++):(Q=s,ve===0&&Ae(Ot)),Q===s&&(i.charCodeAt(N)===95?(Q=P,N++):(Q=s,ve===0&&Ae(vr))),Q!==s)for(;Q!==s;)M.push(Q),i.charCodeAt(N)===94?(Q=L,N++):(Q=s,ve===0&&Ae(Ot)),Q===s&&(i.charCodeAt(N)===95?(Q=P,N++):(Q=s,ve===0&&Ae(vr)));else M=s;return M!==s&&(Je=y,M=Aa()),y=M,Te[j]={nextPos:N,result:y},y}function O(){var y,M,Q=N*40+26,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,i.charCodeAt(N)===63?(M=$,N++):(M=s,ve===0&&Ae(jn)),M!==s&&(Je=y,M=Cs()),y=M,Te[Q]={nextPos:N,result:y},y)}function T(){var y,M,Q,j,le,fe,Re=N*40+27,st=Te[Re];return st?(N=st.nextPos,st.result):(y=N,i.charCodeAt(N)===40?(M=b,N++):(M=s,ve===0&&Ae(We)),M!==s?(Q=ti(),Q!==s?(i.charCodeAt(N)===44?(j=m,N++):(j=s,ve===0&&Ae(Ge)),j!==s?(le=ti(),le!==s?(i.charCodeAt(N)===41?(fe=R,N++):(fe=s,ve===0&&Ae(qt)),fe!==s?(Je=y,y=Ra(Q,le)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[Re]={nextPos:N,result:y},y)}function C(){var y,M,Q,j,le,fe,Re=N*40+28,st=Te[Re];return st?(N=st.nextPos,st.result):(y=N,M=Ki(),M!==s?(i.charCodeAt(N)===58?(Q=A,N++):(Q=s,ve===0&&Ae(hr)),Q!==s?(j=_r(),j!==s?(le=N,ve++,i.charCodeAt(N)===41?(fe=R,N++):(fe=s,ve===0&&Ae(qt)),fe===s&&(i.charCodeAt(N)===93?(fe=Y,N++):(fe=s,ve===0&&Ae(W))),ve--,fe===s?le=void 0:(N=le,le=s),le!==s?(Je=y,y=ys(M,j)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[Re]={nextPos:N,result:y},y)}function D(){var y,M,Q=N*40+29,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,M=xn(),M!==s&&(Je=y,M=Ia(M)),y=M,Te[Q]={nextPos:N,result:y},y)}function U(){var y,M,Q,j=N*40+30,le=Te[j];return le?(N=le.nextPos,le.result):(y=N,M=xn(),M===s&&(M=null),i.charCodeAt(N)===114?(Q=K,N++):(Q=s,ve===0&&Ae(ft)),Q!==s?(Je=y,y=kr(M)):(N=y,y=s),Te[j]={nextPos:N,result:y},y)}function B(){var y,M,Q,j,le,fe=N*40+31,Re=Te[fe];return Re?(N=Re.nextPos,Re.result):(y=N,M=g(),M===s&&(M=null),Q=xn(),Q===s&&(Q=null),j=z(),j===s&&(j=null),le=ti(),le!==s?(Je=y,y=As(M,Q,j,le)):(N=y,y=s),Te[fe]={nextPos:N,result:y},y)}function z(){var y,M,Q,j=N*40+32,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,M=[],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;)M.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 M=s;return M!==s&&(Je=y,M=Rs(M)),y=M,Te[j]={nextPos:N,result:y},y}function H(){var y,M,Q,j,le,fe,Re=N*40+33,st=Te[Re];if(st)return N=st.nextPos,st.result;if(y=N,M=g(),M===s&&(M=null),Q=xn(),Q===s&&(Q=null),j=B(),j!==s){if(le=[],fe=B(),fe!==s)for(;fe!==s;)le.push(fe),fe=B();else le=s;le!==s?(fe=he(),fe===s&&(fe=null),Je=y,y=Na(M,Q,j,le,fe)):(N=y,y=s)}else N=y,y=s;return Te[Re]={nextPos:N,result:y},y}function pe(){var y,M,Q,j=N*40+34,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,M=[],et.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(_i)),Q!==s)for(;Q!==s;)M.push(Q),et.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(_i));else M=s;return M!==s&&(Je=y,M=wa()),y=M,Te[j]={nextPos:N,result:y},y}function he(){var y,M,Q,j=N*40+35,le=Te[j];return le?(N=le.nextPos,le.result):(y=N,i.charCodeAt(N)===37?(M=w,N++):(M=s,ve===0&&Ae(ht)),M!==s?(Q=_r(),Q!==s?(Je=y,y=Is(Q)):(N=y,y=s)):(N=y,y=s),Te[j]={nextPos:N,result:y},y)}function se(){var y,M,Q=N*40+36,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,nt.test(i.charAt(N))?(M=i.charAt(N),N++):(M=s,ve===0&&Ae(Rn)),M!==s?(Ke.test(i.charAt(N))?(i.charAt(N),N++):ve===0&&Ae(Qt),Je=y,y=Da()):(N=y,y=s),Te[Q]={nextPos:N,result:y},y)}function ae(){var y,M,Q,j,le,fe,Re=N*40+37,st=Te[Re];return st?(N=st.nextPos,st.result):(y=N,M=g(),M===s&&(M=null),Q=xn(),Q===s&&(Q=null),j=se(),j!==s?(i.charCodeAt(N)===94?N++:ve===0&&Ae(Ot),le=pe(),le!==s?(fe=he(),fe===s&&(fe=null),Je=y,y=Ns(M,Q,j,le,fe)):(N=y,y=s)):(N=y,y=s),Te[Re]={nextPos:N,result:y},y)}function ye(){var y,M,Q,j,le,fe,Re=N*40+38,st=Te[Re];return st?(N=st.nextPos,st.result):(y=N,M=g(),M===s&&(M=null),Q=xn(),Q===s&&(Q=null),i.substr(N,3)===oe?(j=oe,N+=3):(j=s,ve===0&&Ae(hn)),j===s&&(i.substr(N,2)===Oe?(j=Oe,N+=2):(j=s,ve===0&&Ae(qi)),j===s&&(i.substr(N,2)===ke?(j=ke,N+=2):(j=s,ve===0&&Ae(Si)),j===s&&(i.charCodeAt(N)===105?(j=Me,N++):(j=s,ve===0&&Ae(Vi)),j===s&&(i.substr(N,3)===Ee?(j=Ee,N+=3):(j=s,ve===0&&Ae(en)),j===s&&(i.substr(N,2)===Ne?(j=Ne,N+=2):(j=s,ve===0&&Ae(Jn)),j===s&&(i.charCodeAt(N)===118?(j=ue,N++):(j=s,ve===0&&Ae(fn)))))))),j!==s?(i.charCodeAt(N)===94?N++:ve===0&&Ae(Ot),le=pe(),le===s&&(le=null),fe=he(),fe===s&&(fe=null),Je=y,y=xa(M,Q,j,le,fe)):(N=y,y=s),Te[Re]={nextPos:N,result:y},y)}function Se(){var y,M,Q,j,le=N*40+39,fe=Te[le];return fe?(N=fe.nextPos,fe.result):(y=N,M=g(),M===s&&(M=null),Q=xn(),Q===s&&(Q=null),j=se(),j!==s?(Je=y,y=ws(M,Q,j)):(N=y,y=s),Te[le]={nextPos:N,result:y},y)}var He=a.nodeOptions||{};function Pe(y,M,Q=void 0){M.text=Q||gr(),M.location=ka();for(var j in He)(M[j]===void 0||M[j]===null)&&(M[j]=He[j]);return new y(M)}if(bi=c(),bi!==s&&N===i.length)return bi;throw bi!==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 Hn(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:HA;r=nR(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 ba);if(e>=0){for(let t=e+1;t<=this.evaluated.length;t++)if(this.evaluated[t]instanceof ba){const r=this.evaluated[e],i=this.evaluated[t],a=wP(r.notes(),i.notes()),s=Hn(i);s.voiceLeadFromNotes(a,this.options.nodeOptions),this.evaluated[t]=s,e=t}}return this}}const nR=(n,e)=>{const t=n.length,r=e/t;return n.map(a=>a instanceof XA?nR(a.items,r):(a.duration=r,a)).flat(1/0)},kP=n=>{let e={};return oP.forEach(t=>{if(n[t]!==void 0){const r=n[t];e[t]=r,delete n[t]}}),e};class LP{constructor(){v(this,"midiAccess",null);v(this,"midiOutputs",[]);v(this,"currentOutputIndex",0);v(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 MP{constructor(e,t,r){v(this,"min");v(this,"max");v(this,"wrap");v(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}}const PP={major:[0,2,4,5,7,9,11],naturalMinor:[0,2,3,5,7,8,10],harmonicMinor:[0,2,3,5,7,8,11],melodicMinor:[0,2,3,5,7,9,11],dorian:[0,2,3,5,7,9,10],phrygian:[0,1,3,5,7,8,10],lydian:[0,2,4,6,7,9,11],mixolydian:[0,2,4,5,7,9,10],aeolian:[0,2,3,5,7,8,10],locrian:[0,1,3,5,6,8,10],wholeTone:[0,2,4,6,8,10],majorPentatonic:[0,2,4,7,9],minorPentatonic:[0,3,5,7,10],chromatic:[0,1,2,3,4,5,6,7,8,9,10,11],blues:[0,3,5,6,7,10],diminished:[0,2,3,5,6,8,9,11],neapolitanMinor:[0,1,3,5,7,8,11],neapolitanMajor:[0,1,3,5,7,9,11],enigmatic:[0,1,4,6,8,10,11],doubleHarmonic:[0,1,4,5,7,8,11],octatonic:[0,2,3,5,6,8,9,11],bebopDominant:[0,2,4,5,7,9,10,11],bebopMajor:[0,2,4,5,7,8,9,11],bebopMinor:[0,2,3,5,7,8,9,11],bebopDorian:[0,2,3,4,5,7,9,10],harmonicMajor:[0,2,4,5,7,8,11],hungarianMinor:[0,2,3,6,7,8,11],hungarianMajor:[0,3,4,6,7,9,10],oriental:[0,1,4,5,6,9,10],romanianMinor:[0,2,3,6,7,9,10],spanishGypsy:[0,1,4,5,7,8,10],jewish:[0,1,4,5,7,8,10],hindu:[0,2,4,5,7,8,10],japanese:[0,1,5,7,8],hirajoshi:[0,2,3,7,8],kumoi:[0,2,3,7,9],inSen:[0,1,5,7,10],iwato:[0,1,5,6,10],yo:[0,2,5,7,9],minorBlues:[0,3,5,6,7,10],algerian:[0,2,3,5,6,7,8,11],augmented:[0,3,4,7,8,11],balinese:[0,1,3,7,8],byzantine:[0,1,4,5,7,8,11],chinese:[0,4,6,7,11],egyptian:[0,2,5,7,10],eightToneSpanish:[0,1,3,4,5,6,8,10],hawaiian:[0,2,3,5,7,9,10],hindustan:[0,2,4,5,7,8,10],persian:[0,1,4,5,6,8,11],eastIndianPurvi:[0,1,4,6,7,8,11],orientalA:[0,1,4,5,6,9,10]};function BP(n,e="major",t=4){const r=PP[e];if(!r)throw new Error(`Unknown scale ${e}`);let i=n%r.length;i<0&&(i+=r.length);let a=Math.floor(n/r.length);return 60+(t+a)*12+r[i]}class Mg{constructor(e){v(this,"seedValue");v(this,"randomGen",Math.random);v(this,"app");v(this,"values",{});v(this,"odds",(e,t)=>this.randomGen()this);v(this,"almostNever",e=>this.odds(.025,e));v(this,"rarely",e=>this.odds(.1,e));v(this,"scarcely",e=>this.odds(.25,e));v(this,"sometimes",e=>this.odds(.5,e));v(this,"often",e=>this.odds(.75,e));v(this,"frequently",e=>this.odds(.9,e));v(this,"almostAlways",e=>this.odds(.985,e));v(this,"always",e=>this.modify(e));v(this,"modify",e=>e(this));v(this,"seed",e=>(this.seedValue=e.toString(),this.randomGen=this.app.api.localSeededRandom(this.seedValue),this));v(this,"clear",()=>(this.app.api.clearLocalSeed(this.seedValue),this));v(this,"apply",e=>this.modify(e));v(this,"length",e=>(this.values.length=e,this));this.app=e,this.app.api.currentSeed&&(this.randomGen=this.app.api.randomGen)}}class iR extends Mg{constructor(t){super(t);v(this,"octave",t=>(this.values.octave=t,this.update(),this));v(this,"key",t=>(this.values.key=t,this.update(),this));v(this,"scale",t=>(wg(t)?(this.values.scaleName=t,this.values.parsedScale=Xn(t)):this.values.parsedScale=Dg(t),this.update(),this));v(this,"freq",t=>{this.values.freq=t;const r=hP(t);return r%1!==0?(this.values.note=Math.floor(r),this.values.bend=ZA(r)[1]):this.values.note=r,this});v(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 QO={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),!QO[r])throw new Error("vowel: unknown vowel "+r);const{gains:i,qs:a,freqs:s}=QO[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},Pc=(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},aR=n=>Math.pow(2,(n-69)/12)*440,Em=(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 Pc(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 mc(n){const e=zt().createGain();return e.gain.value=n,e}const bm=(n,e,t,r,i,a)=>{const s=zt().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)}}},HP=(n,e,t,r,i,a)=>{t=Math.max(.001,t),i=Math.max(.001,i);const s=zt().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)}}},zP=(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 Au(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=Em(2**-_*t,0,2e4),A=Em(2**(l-_)*t,0,2e4);return zP(m.frequency,i,a,s,o,b,A,c,u),m}return m}let WP=n=>console.log(n);const gs=(...n)=>WP(...n),Pg=FP();function Bg(n,e,t={}){Pg.setKey(n,{onTrigger:e,data:t})}function qO(n){return Pg.get()[n]}let Ru;const zt=()=>(Ru||(Ru=new AudioContext),Ru);let Sl;const Ug=()=>{const n=zt();return Sl||(Sl=n.createGain(),Sl.connect(n.destination)),Sl};let Iu;function XP(){return Iu||(Iu=zt().audioWorklet.addModule(VP),Iu)}function Nu(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 zt().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 ea={};function jP(n,e,t,r){var i;if(t=Em(t,0,.98),!ea[n]){const a=zt().createFeedbackDelay(1,e,t);(i=a.start)==null||i.call(a,r),a.connect(Ug()),ea[n]=a}return ea[n].delayTime.value!==e&&ea[n].delayTime.setValueAtTime(e,r),ea[n].feedback.value!==t&&ea[n].feedback.setValueAtTime(t,r),ea[n]}let ta={};function JP(n,e=2){if(!ta[n]){const t=zt().createReverb(e);t.connect(Ug()),ta[n]=t}return ta[n].duration!==e&&(ta[n]=ta[n].setDuration(e),ta[n].duration=e),ta[n]}let ra;function e3(n=2048){if(!ra){const e=zt().createAnalyser();e.fftSize=n,ra=e,new Float32Array(ra.frequencyBinCount)}return ra.fftSize!==n&&(ra.fftSize=n,new Float32Array(ra.frequencyBinCount)),ra}function wu(n,e,t){const r=mc(t);return n.connect(r),r.connect(e),r}const VO=async(n,e,t)=>{const r=zt();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:P,crush:$,shape:K,pan:X,vowel:ce,delay:oe=0,delayfeedback:Oe=.5,delaytime:ke=.25,orbit:Me=1,room:Ee,size:Ne=2,velocity:ue=1,analyze:De,fft:Ze=8}=n;l*=ue;let Ve=[];const et=()=>{Ve.forEach(ot=>ot==null?void 0:ot.disconnect())};s&&a&&(a=`${s}_${a}`);let nt;if(o)nt=o(i,n,t);else if(qO(a)){const{onTrigger:ot}=qO(a),Ge=await ot(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){gs("[webaudio] skip hap: still loading",r.currentTime-i);return}const Ke=[];if(Ke.push(nt),Ke.push(mc(l)),p!==void 0){let ot=()=>Au(r,"lowpass",p,k,_,b,A,R,m,i,i+t,u);Ke.push(ot()),c==="24db"&&Ke.push(ot())}if(Z!==void 0){let ot=()=>Au(r,"highpass",Z,x,h,E,S,I,Y,i,i+t,u);Ke.push(ot()),c==="24db"&&Ke.push(ot())}if(L!==void 0){let ot=()=>Au(r,"bandpass",L,ee,G,te,ne,re,w,i,i+t,u);Ke.push(ot()),c==="24db"&&Ke.push(ot())}if(ce!==void 0){const ot=r.createVowelFilter(ce);Ke.push(ot)}if(P!==void 0&&Ke.push(Nu(r,"coarse-processor",{coarse:P})),$!==void 0&&Ke.push(Nu(r,"crush-processor",{crush:$})),K!==void 0&&Ke.push(Nu(r,"shape-processor",{shape:K})),X!==void 0){const ot=r.createStereoPanner();ot.pan.value=2*X-1,Ke.push(ot)}const mt=mc(1);Ke.push(mt),mt.connect(Ug());let it;if(oe>0&&ke>0&&Oe>0){const ot=jP(Me,ke,Oe,i);it=wu(mt,ot,oe)}let Ct;if(Ee>0&&Ne>0){const ot=JP(Me,Ne);Ct=wu(mt,ot,Ee)}let Nt;if(De){const ot=e3(2**(Ze+5));Nt=wu(mt,ot,De)}Ke.slice(1).reduce((ot,Ge)=>ot.connect(Ge),Ke[0]),Ve=Ke.concat([it,Ct,Nt])},Du={};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&&gs("[sampler] hap has note and freq. ignoring note","warning");let l=qP({freq:i,note:t},36);o=l-36;const c=zt();let u;if(Array.isArray(a))u=a[e%a.length];else{const b=R=>Pc(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(!Du[n]){gs(`[sampler] load ${i}..`,"load-sample",{url:n});const a=Date.now();Du[n]=fetch(n).then(s=>s.arrayBuffer()).then(async s=>{const o=Date.now()-a,l=t3(s.byteLength);return gs(`[sampler] load ${i}... done! loaded ${l} in ${o}ms`,"loaded-sample",{url:n}),await e.decodeAudioData(s)})}return Du[n]};function i3(n){const e=zt(),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 qa=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=>qa(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)=>Bg(a,(o,l,c)=>l3(o,l,c,s),{type:"sample",samples:s,baseUrl:e,prebake:r,tag:i}),e)},HO=[];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=zt(),{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){gs(`[sampler] still loading sound "${a}:${m}"`,"highlight");return}if(!w){gs(`[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}=bm(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,P=p===void 0&&u===void 0)=>{let $=ee;if(P){const K=w.buffer.duration/w.playbackRate.value;$=n+(Y-R)*K}w.stop($+I),te($)}};if(c!==void 0){const ee=HO[c];ee&&(ee.node.gain.setValueAtTime(1,x),ee.node.gain.linearRampToValueAtTime(0,x+.01)),HO[c]=re}return re}const c3=(n,e=1,t="sine")=>{const r=zt(),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=>{Bg(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=Pc(h)),!E&&typeof h=="number"&&(E=aR(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=bm(p,m,_,b,A,e),u==="exp"&&(w=HP(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=mc(.3),{node:G,stop:te}=bm(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=zt(),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=zt().createOscillator(),s.type=n||"triangle"):s=p3(a,n),s.frequency.value=Number(e),s.start(t);let o;if(r>0){o=zt().createOscillator(),o.frequency.value=r;const l=zt().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=zt().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,P=0,$,K;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,K=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),P=(m?1-Z+Z*Math.sin(h*te/m):1)*S(P)*Math.abs(P)**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=Pc(r)),!i&&typeof r=="number"&&(i=aR(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=zt(),G=L.createBuffer(1,w.length,L.sampleRate);G.getChannelData(0).set(w);const te=zt().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=>{Bg(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 Tm extends iR{constructor(t,r){super(r);v(this,"volume",t=>this.updateValue("volume",t));v(this,"vol",this.volume);v(this,"zrand",t=>this.updateValue("zrand",t));v(this,"curve",t=>this.updateValue("curve",t));v(this,"slide",t=>this.updateValue("slide",t));v(this,"sld",this.slide);v(this,"deltaSlide",t=>this.updateValue("deltaSlide",t));v(this,"dslide",this.deltaSlide);v(this,"pitchJump",t=>this.updateValue("pitchJump",t));v(this,"pj",this.pitchJump);v(this,"pitchJumpTime",t=>this.updateValue("pitchJumpTime",t));v(this,"pjt",this.pitchJumpTime);v(this,"lfo",t=>this.updateValue("lfo",t));v(this,"noise",t=>this.updateValue("noise",t));v(this,"zmod",t=>this.updateValue("zmod",t));v(this,"zcrush",t=>this.updateValue("zcrush",t));v(this,"zdelay",t=>this.updateValue("zdelay",t));v(this,"sustainVolume",t=>this.updateValue("sustainVolume",t));v(this,"tremolo",t=>this.updateValue("tremolo",t));v(this,"dur",t=>this.updateValue("dur",t));v(this,"zzfx",t=>this.updateValue("zzfx",t));v(this,"fmi",t=>this.updateValue("fmi",t));v(this,"fmh",t=>this.updateValue("fmh",t));v(this,"fmenv",t=>this.updateValue("fmenv",t));v(this,"fmattack",t=>this.updateValue("fmattack",t));v(this,"fmatk",this.fmattack);v(this,"fmdecay",t=>this.updateValue("fmdecay",t));v(this,"fmdec",this.fmdecay);v(this,"fmsustain",t=>this.updateValue("fmsustain",t));v(this,"fmsus",this.fmsustain);v(this,"fmrelease",t=>this.updateValue("fmrelease",t));v(this,"fmrel",this.fmrelease);v(this,"fmvelocity",t=>this.updateValue("fmvelocity",t));v(this,"fmvel",this.fmvelocity);v(this,"fmwave",t=>this.updateValue("fmwave",t));v(this,"fmw",this.fmwave);v(this,"ftype",t=>this.updateValue("ftype",t));v(this,"fanchor",t=>this.updateValue("fanchor",t));v(this,"attack",t=>this.updateValue("attack",t));v(this,"atk",this.attack);v(this,"decay",t=>this.updateValue("decay",t));v(this,"dec",this.decay);v(this,"sustain",t=>this.updateValue("sustain",t));v(this,"sus",this.sustain);v(this,"release",t=>this.updateValue("release",t));v(this,"rel",this.release);v(this,"adsr",(t,r,i,a)=>(this.attack(t),this.decay(r),this.sustain(i),this.release(a),this));v(this,"lpenv",t=>this.updateValue("lpenv",t));v(this,"lpe",t=>this.updateValue("lpenv",t));v(this,"lpattack",t=>this.updateValue("lpattack",t));v(this,"lpa",this.lpattack);v(this,"lpdecay",t=>this.updateValue("lpdecay",t));v(this,"lpd",this.lpdecay);v(this,"lpsustain",t=>this.updateValue("lpsustain",t));v(this,"lps",this.lpsustain);v(this,"lprelease",t=>this.updateValue("lprelease",t));v(this,"lpr",this.lprelease);v(this,"cutoff",t=>this.updateValue("cutoff",t));v(this,"lpf",this.cutoff);v(this,"resonance",t=>this.updateValue("resonance",Math.min(Math.max(t,0),50)));v(this,"lpq",this.resonance);v(this,"lpadsr",(t,r,i,a,s)=>(this.lpenv(t),this.lpattack(r),this.lpdecay(i),this.lpsustain(a),this.lprelease(s),this));v(this,"hpenv",t=>this.updateValue("hpenv",t));v(this,"hpe",t=>this.updateValue("hpe",t));v(this,"hpattack",t=>this.updateValue("hpattack",t));v(this,"hpa",this.hpattack);v(this,"hpdecay",t=>this.updateValue("hpdecay",t));v(this,"hpd",this.hpdecay);v(this,"hpsustain",t=>this.updateValue("hpsustain",t));v(this,"hpsus",this.hpsustain);v(this,"hprelease",t=>this.updateValue("hprelease",t));v(this,"hpr",this.hprelease);v(this,"hcutoff",t=>this.updateValue("hcutoff",t));v(this,"hpf",this.hcutoff);v(this,"hresonance",t=>this.updateValue("hresonance",t));v(this,"hpq",this.hresonance);v(this,"hpadsr",(t,r,i,a,s)=>(this.hpenv(t),this.hpattack(r),this.hpdecay(i),this.hpsustain(a),this.hprelease(s),this));v(this,"bpenv",t=>this.updateValue("bpenv",t));v(this,"bpe",t=>this.updateValue("bpe",t));v(this,"bpattack",t=>this.updateValue("bpattack",t));v(this,"bpa",this.bpattack);v(this,"bpdecay",t=>this.updateValue("bpdecay",t));v(this,"bpd",this.bpdecay);v(this,"bpsustain",t=>this.updateValue("bpsustain",t));v(this,"bps",this.bpsustain);v(this,"bprelease",t=>this.updateValue("bprelease",t));v(this,"bpr",this.bprelease);v(this,"bandf",t=>this.updateValue("bandf",t));v(this,"bpf",this.bandf);v(this,"bandq",t=>this.updateValue("bandq",t));v(this,"bpq",this.bandq);v(this,"bpadsr",(t,r,i,a,s)=>(this.bpenv(t),this.bpattack(r),this.bpdecay(i),this.bpsustain(a),this.bprelease(s),this));v(this,"freq",t=>this.updateValue("freq",t));v(this,"f",this.freq);v(this,"vib",t=>this.updateValue("vib",t));v(this,"vibmod",t=>this.updateValue("vibmod",t));v(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});v(this,"loop",t=>this.updateValue("loop",t));v(this,"loopBegin",t=>this.updateValue("loopBegin",t));v(this,"loopEnd",t=>this.updateValue("loopEnd",t));v(this,"begin",t=>this.updateValue("begin",t));v(this,"end",t=>this.updateValue("end",t));v(this,"gain",t=>this.updateValue("gain",t));v(this,"dbgain",t=>this.updateValue("gain",Math.min(Math.pow(10,t/20),10)));v(this,"db",this.dbgain);v(this,"velocity",t=>this.updateValue("velocity",t));v(this,"vel",this.velocity);v(this,"pan",t=>this.updateValue("pan",t));v(this,"sound",t=>this.updateValue("s",t));v(this,"chord",t=>this.updateValue("chord",t));v(this,"snd",this.sound);v(this,"nudge",t=>this.updateValue("nudge",t));v(this,"cut",t=>this.updateValue("cut",t));v(this,"clip",t=>this.updateValue("clip",t));v(this,"n",t=>this.updateValue("n",t));v(this,"note",t=>this.updateValue("note",t));v(this,"speed",t=>this.updateValue("speed",t));v(this,"spd",this.speed);v(this,"coarse",t=>this.updateValue("coarse",t));v(this,"crush",t=>this.updateValue("crush",t));v(this,"shape",t=>this.updateValue("shape",t));v(this,"vowel",t=>this.updateValue("vowel",t));v(this,"vow",this.vowel);v(this,"delay",t=>this.updateValue("delay",t));v(this,"del",this.delay);v(this,"delayfeedback",t=>this.updateValue("delayfeedback",t));v(this,"delayfb",this.delayfeedback);v(this,"delaytime",t=>this.updateValue("delaytime",t));v(this,"delayt",this.delaytime);v(this,"orbit",t=>this.updateValue("orbit",t));v(this,"o",this.orbit);v(this,"room",t=>this.updateValue("room",t));v(this,"rm",this.room);v(this,"size",t=>this.updateValue("size",t));v(this,"sz",this.size);v(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});v(this,"update",()=>{const[t,r]=kg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.freq=ms(t)});v(this,"out",()=>{this.values.chord?this.values.chord.forEach(t=>{const r={...this.values};r.freq=t.freq,VO(r,this.values.dur*2,this.values.dur)}):VO(this.values,this.values.dur*2,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 vm extends iR{constructor(t,r){super(r);v(this,"midiConnection");v(this,"chord",t=>(this.values.chord=t,this));v(this,"note",t=>(this.values.note=t,this));v(this,"sustain",t=>(this.values.sustain=t,this));v(this,"channel",t=>(this.values.channel=t,this));v(this,"port",t=>(this.values.port=this.midiConnection.getMidiOutputIndex(t),this));v(this,"add",t=>(this.values.note+=t,this));v(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});v(this,"bend",t=>(this.values.bend=t,this));v(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));v(this,"update",()=>{const[t,r]=kg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.note=t,this.values.freq=ms(t),r&&(this.values.bend=r)});v(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 zs=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,sR=new Set,Cm=typeof process=="object"&&process?process:{},oR=(n,e,t,r)=>{typeof Cm.emitWarning=="function"?Cm.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)};let gc=globalThis.AbortController,zO=globalThis.AbortSignal;var BT;if(typeof gc>"u"){zO=class{constructor(){v(this,"onabort");v(this,"_onabort",[]);v(this,"reason");v(this,"aborted",!1)}addEventListener(r,i){this._onabort.push(i)}},gc=class{constructor(){v(this,"signal",new zO);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=((BT=Cm.env)==null?void 0:BT.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{n&&(n=!1,oR("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=>!sR.has(n),Ri=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),lR=n=>Ri(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ll:null:null;class Ll extends Array{constructor(e){super(e),this.fill(0)}}var Ja;const aa=class aa{constructor(e,t){v(this,"heap");v(this,"length");if(!V(aa,Ja))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){const t=lR(e);if(!t)return[];Xe(aa,Ja,!0);const r=new aa(e,t);return Xe(aa,Ja,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};Ja=new WeakMap,lt(aa,Ja,!1);let ym=aa;var _n,Qr,Sn,On,es,Kt,En,jt,kt,at,Rr,qr,Sr,ir,bn,ar,ai,si,Tn,vn,ki,Ir,ko,Rm,pa,oi,Lo,Vr,bc,cR,ha,ts,Mo,Bn,Ii,Un,Ni,Po,Im,rs,Ml,ns,Pl,wt,Pt,Bo,Nm,fa,no;const zg=class zg{constructor(e){lt(this,ko);lt(this,bc);lt(this,Bn);lt(this,Un);lt(this,Po);lt(this,rs);lt(this,ns);lt(this,wt);lt(this,Bo);lt(this,fa);lt(this,_n,void 0);lt(this,Qr,void 0);lt(this,Sn,void 0);lt(this,On,void 0);lt(this,es,void 0);v(this,"ttl");v(this,"ttlResolution");v(this,"ttlAutopurge");v(this,"updateAgeOnGet");v(this,"updateAgeOnHas");v(this,"allowStale");v(this,"noDisposeOnSet");v(this,"noUpdateTTL");v(this,"maxEntrySize");v(this,"sizeCalculation");v(this,"noDeleteOnFetchRejection");v(this,"noDeleteOnStaleGet");v(this,"allowStaleOnFetchAbort");v(this,"allowStaleOnFetchRejection");v(this,"ignoreFetchAbort");lt(this,Kt,void 0);lt(this,En,void 0);lt(this,jt,void 0);lt(this,kt,void 0);lt(this,at,void 0);lt(this,Rr,void 0);lt(this,qr,void 0);lt(this,Sr,void 0);lt(this,ir,void 0);lt(this,bn,void 0);lt(this,ar,void 0);lt(this,ai,void 0);lt(this,si,void 0);lt(this,Tn,void 0);lt(this,vn,void 0);lt(this,ki,void 0);lt(this,Ir,void 0);lt(this,pa,()=>{});lt(this,oi,()=>{});lt(this,Lo,()=>{});lt(this,Vr,()=>!1);lt(this,ha,e=>{});lt(this,ts,(e,t,r)=>{});lt(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&&!Ri(t))throw new TypeError("max option must be a nonnegative integer");const S=t?lR(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,es,R),Xe(this,ki,!!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,ym.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&&!Ri(V(this,Qr)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ri(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");ze(this,bc,cR).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!Y,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Ri(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Ri(this.ttl))throw new TypeError("ttl must be a positive integer if specified");ze(this,ko,Rm).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)&&(sR.add(I),oR("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",I,zg))}}static unsafeExposeInternals(e){return{starts:V(e,si),ttls:V(e,Tn),sizes:V(e,ai),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 ze(r=e,wt,Pt).call(r,t)},backgroundFetch:(t,r,i,a)=>{var s;return ze(s=e,ns,Pl).call(s,t,r,i,a)},moveToTail:t=>{var r;return ze(r=e,fa,no).call(r,t)},indexes:t=>{var r;return ze(r=e,Bn,Ii).call(r,t)},rindexes:t=>{var r;return ze(r=e,Un,Ni).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,es)}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 ze(this,Bn,Ii).call(this))V(this,at)[e]!==void 0&&V(this,kt)[e]!==void 0&&!ze(this,wt,Pt).call(this,V(this,at)[e])&&(yield[V(this,kt)[e],V(this,at)[e]])}*rentries(){for(const e of ze(this,Un,Ni).call(this))V(this,at)[e]!==void 0&&V(this,kt)[e]!==void 0&&!ze(this,wt,Pt).call(this,V(this,at)[e])&&(yield[V(this,kt)[e],V(this,at)[e]])}*keys(){for(const e of ze(this,Bn,Ii).call(this)){const t=V(this,kt)[e];t!==void 0&&!ze(this,wt,Pt).call(this,V(this,at)[e])&&(yield t)}}*rkeys(){for(const e of ze(this,Un,Ni).call(this)){const t=V(this,kt)[e];t!==void 0&&!ze(this,wt,Pt).call(this,V(this,at)[e])&&(yield t)}}*values(){for(const e of ze(this,Bn,Ii).call(this))V(this,at)[e]!==void 0&&!ze(this,wt,Pt).call(this,V(this,at)[e])&&(yield V(this,at)[e])}*rvalues(){for(const e of ze(this,Un,Ni).call(this))V(this,at)[e]!==void 0&&!ze(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 ze(this,Bn,Ii).call(this)){const i=V(this,at)[r],a=ze(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 ze(this,Bn,Ii).call(this)){const i=V(this,at)[r],a=ze(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 ze(this,Un,Ni).call(this)){const i=V(this,at)[r],a=ze(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 ze(this,Un,Ni).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 ze(this,Bn,Ii).call(this,{allowStale:!0})){const r=V(this,kt)[t],i=V(this,at)[t],a=ze(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,si)){s.ttl=V(this,Tn)[t];const o=zs.now()-V(this,si)[t];s.start=Math.floor(Date.now()-o)}V(this,ai)&&(s.size=V(this,ai)[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=zs.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)?ze(this,rs,Ml).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),Xo(this,Kt)._++,V(this,ts).call(this,p,u,l),l&&(l.set="add"),c=!1;else{ze(this,fa,no).call(this,p);const k=V(this,at)[p];if(t!==k){if(V(this,ki)&&ze(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,ha).call(this,p),V(this,ts).call(this,p,u,l),V(this,at)[p]=t,l){l.set="replace";const Y=k&&ze(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)&&ze(this,ko,Rm).call(this),V(this,Tn)&&(c||V(this,Lo).call(this,p,i,a),l&&V(this,oi).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(ze(this,rs,Ml).call(this,!0),ze(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(ze(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,oi).call(this,i,a));else return r&&V(this,pa).call(this,a),i&&(i.has="hit",V(this,oi).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 ze(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,ki))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=ze(this,ns,Pl).call(this,e,h,Z,A);return E.__returned=E}else{const E=V(this,at)[h];if(ze(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"),ze(this,fa,no).call(this,h),i&&V(this,pa).call(this,h),k&&V(this,oi).call(this,k,h),E;const I=ze(this,ns,Pl).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=ze(this,wt,Pt).call(this,l);return s&&V(this,oi).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:(ze(this,fa,no).call(this,o),i&&V(this,pa).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,ha).call(this,o);const l=V(this,at)[o];ze(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]),Xo(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 ze(this,Un,Ni).call(this,{allowStale:!0})){const a=V(this,at)[i];if(ze(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,si)&&(V(this,Tn).fill(0),V(this,si).fill(0)),V(this,ai)&&V(this,ai).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,es=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,ai=new WeakMap,si=new WeakMap,Tn=new WeakMap,vn=new WeakMap,ki=new WeakMap,Ir=new WeakMap,ko=new WeakSet,Rm=function(){const e=new Ll(V(this,_n)),t=new Ll(V(this,_n));Xe(this,Tn,e),Xe(this,si,t),Xe(this,Lo,(a,s,o=zs.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,pa,a=>{t[a]=e[a]!==0?zs.now():0}),Xe(this,oi,(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=zs.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])},pa=new WeakMap,oi=new WeakMap,Lo=new WeakMap,Vr=new WeakMap,bc=new WeakSet,cR=function(){const e=new Ll(V(this,_n));Xe(this,En,0),Xe(this,ai,e),Xe(this,ha,t=>{Xe(this,En,V(this,En)-e[t]),e[t]=0}),Xe(this,Mo,(t,r,i,a)=>{if(ze(this,wt,Pt).call(this,r))return 0;if(!Ri(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(r,t),!Ri(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,ts,(t,r,i)=>{if(e[t]=r,V(this,Qr)){const a=V(this,Qr)-e[t];for(;V(this,En)>a;)ze(this,rs,Ml).call(this,!0)}Xe(this,En,V(this,En)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=V(this,En))})},ha=new WeakMap,ts=new WeakMap,Mo=new WeakMap,Bn=new WeakSet,Ii=function*({allowStale:e=this.allowStale}={}){if(V(this,Kt))for(let t=V(this,ir);!(!ze(this,Po,Im).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,Sr)));)t=V(this,qr)[t]},Un=new WeakSet,Ni=function*({allowStale:e=this.allowStale}={}){if(V(this,Kt))for(let t=V(this,Sr);!(!ze(this,Po,Im).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,ir)));)t=V(this,Rr)[t]},Po=new WeakSet,Im=function(e){return e!==void 0&&V(this,jt).get(V(this,kt)[e])===e},rs=new WeakSet,Ml=function(e){var a,s;const t=V(this,Sr),r=V(this,kt)[t],i=V(this,at)[t];return V(this,ki)&&ze(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,ha).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),Xo(this,Kt)._--,t},ns=new WeakSet,Pl=function(e,t,r,i){const a=t===void 0?void 0:V(this,at)[t];if(ze(this,wt,Pt).call(this,a))return a;const s=new gc,{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,es))==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,ki))return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof gc},Bo=new WeakSet,Nm=function(e,t){V(this,qr)[t]=e,V(this,Rr)[e]=t},fa=new WeakSet,no=function(e){e!==V(this,ir)&&(e===V(this,Sr)?Xe(this,Sr,V(this,Rr)[e]):ze(this,Bo,Nm).call(this,V(this,qr)[e],V(this,Rr)[e]),ze(this,Bo,Nm).call(this,V(this,ir),e),Xe(this,ir,e))};let Am=zg;const uo=class uo{constructor(){v(this,"_fallbackMethod",()=>uo.createSkipProxy());v(this,"out",()=>{})}};v(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 _c=uo;const po=class po extends Mg{constructor(t,r){super(r);v(this,"_fallbackMethod",()=>po.createRestProxy(this.values.length,this.app));v(this,"out",()=>{});this.values.length=t}};v(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 Sc=po;class S3 extends Mg{constructor(t,r,i){super(i);v(this,"input");v(this,"ziffers");v(this,"initCallTime",0);v(this,"startCallTime",0);v(this,"lastCallTime",0);v(this,"waitTime",0);v(this,"startBeat",0);v(this,"played",!1);v(this,"current");v(this,"retro",!1);v(this,"index",-1);v(this,"zid","");v(this,"options",{});v(this,"skipIndex",0);v(this,"endTime",0);v(this,"next",()=>(this.current=this.ziffers.next(),this.played=!0,this.current));v(this,"pulseToSecond",t=>this.app.clock.convertPulseToSecond(t));v(this,"firstRun",()=>this.notStarted());v(this,"atTheBeginning",()=>this.skipIndex===0&&this.ziffers.index<=0);v(this,"origin",()=>this.app.clock.pulses_since_origin+1);v(this,"pulse",()=>this.app.clock.time_position.pulse);v(this,"beat",()=>this.app.clock.time_position.beat);v(this,"nextBeat",()=>this.app.clock.next_beat_in_ticks);v(this,"nextBeatInTicks",()=>this.app.clock.next_beat_in_ticks);v(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});v(this,"lead",()=>this.voiceleading());v(this,"invert",t=>(this.atTheBeginning()&&this.ziffers.invert(t),this));v(this,"out",()=>{});this.app=i,this.input=t,this.options=r,this.ziffers=new xP(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 ui){const a=r.getExisting("freq","pitch","key","scale","octave","parsedScale");return a.dur=i,new Tm(a,this.app).sound(t)}else if(r instanceof ba){const a=r.pitches.map(s=>s.getExisting("freq","pitch","key","scale","octave","parsedScale"));return new Tm({dur:i},this.app).chord(a).sound(t)}else if(r instanceof Sm)return Sc.createRestProxy(r.duration,this.app)}else return _c.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 ui){const a=new vm(i,this.app);return t?a.note(t):a}else{if(r instanceof Sm)return Sc.createRestProxy(r.duration,this.app);if(r instanceof ba){const a=r.notes();return new vm(i,this.app).chord(a)}}}else return _c.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 uR({...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(){return n.z(this.valueOf())}};let xu;class uR{constructor(e){v(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(),xu&&clearTimeout(xu),xu=setTimeout(()=>{r.speak(i)},200)):r.speak(i)}else t("No text provided")}));this.options=e}}async function WO(){return Promise.all([KP(),qa("github:tidalcycles/Dirt-Samples/master").then(()=>d3()),g3(),qa("github:Bubobubobubobubo/Dough-Samples/main"),qa("github:Bubobubobubobubo/Dough-Amiga/main"),qa("github:Bubobubobubobubo/Dough-Waveforms/main")])}class b3{constructor(e){v(this,"variables",{});v(this,"codeExamples",{});v(this,"counters",{});v(this,"_drunk",new MP(-100,100,!1));v(this,"randomGen",Math.random);v(this,"currentSeed");v(this,"localSeeds",new Map);v(this,"patternCache",new Am({max:1e3,ttl:1e3*60*5}));v(this,"errorTimeoutID",0);v(this,"printTimeoutID",0);v(this,"MidiConnection",new LP);v(this,"load");v(this,"_loadUniverseFromInterface",e=>{this.app.loadUniverse(e),this.app.openBuffersModal()});v(this,"_deleteUniverseFromInterface",e=>{delete this.app.universes[e],this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});v(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()});v(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()});v(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,VM(this.app,e)});v(this,"_all_samples",()=>Pg.get());v(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)});v(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)});v(this,"time",()=>this.app.audioContext.currentTime);v(this,"play",()=>{this.app.setButtonHighlighting("play",!0),this.app.clock.start()});v(this,"pause",()=>{this.app.setButtonHighlighting("pause",!0),this.app.clock.pause()});v(this,"stop",()=>{this.app.setButtonHighlighting("stop",!0),this.app.clock.stop()});v(this,"silence",this.stop);v(this,"hush",this.stop);v(this,"warp",e=>{this.app.clock.tick=e,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e)});v(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)});v(this,"onmousemove",e=>{this.app._mouseX=e.pageX,this.app._mouseY=e.pageY});v(this,"mouseX",()=>this.app._mouseX);v(this,"mouseY",()=>this.app._mouseY);v(this,"noteX",()=>Math.floor(this.app._mouseX/document.body.clientWidth*127));v(this,"noteY",()=>Math.floor(this.app._mouseY/document.body.clientHeight*127));v(this,"script",(...e)=>{e.forEach(t=>{ja(this.app,this.app.universes[this.app.selected_universe].locals[t])})});v(this,"s",this.script);v(this,"clear_script",e=>{this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}});v(this,"cs",this.clear_script);v(this,"copy_script",(e,t)=>{this.app.universes[this.app.selected_universe].locals[t]=this.app.universes[this.app.selected_universe].locals[e]});v(this,"cps",this.copy_script);v(this,"midi_outputs",()=>{this._logMessage(this.MidiConnection.listMidiOutputs())});v(this,"midi_output",e=>{e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())});v(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 vm(e,this.app)));v(this,"sysex",e=>{this.MidiConnection.sendSysExMessage(e)});v(this,"pitch_bend",(e,t)=>{this.MidiConnection.sendPitchBend(e,t)});v(this,"program_change",(e,t)=>{this.MidiConnection.sendProgramChange(e,t)});v(this,"midi_clock",()=>{this.MidiConnection.sendMidiClock()});v(this,"control_change",({control:e=20,value:t=0,channel:r=0})=>{this.MidiConnection.sendMidiControlChange(e,t,r)});v(this,"midi_panic",()=>{this.MidiConnection.panic()});v(this,"generateCacheKey",(...e)=>e.map(t=>JSON.stringify(t)).join(","));v(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});v(this,"z0",(e,t={})=>this.z(e,t,0));v(this,"z1",(e,t={})=>this.z(e,t,1));v(this,"z2",(e,t={})=>this.z(e,t,2));v(this,"z3",(e,t={})=>this.z(e,t,3));v(this,"z4",(e,t={})=>this.z(e,t,4));v(this,"z5",(e,t={})=>this.z(e,t,5));v(this,"z6",(e,t={})=>this.z(e,t,6));v(this,"z7",(e,t={})=>this.z(e,t,7));v(this,"z8",(e,t={})=>this.z(e,t,8));v(this,"z9",(e,t={})=>this.z(e,t,9));v(this,"z10",(e,t={})=>this.z(e,t,10));v(this,"z11",(e,t={})=>this.z(e,t,11));v(this,"z12",(e,t={})=>this.z(e,t,12));v(this,"z13",(e,t={})=>this.z(e,t,13));v(this,"z14",(e,t={})=>this.z(e,t,14));v(this,"z15",(e,t={})=>this.z(e,t,15));v(this,"z16",(e,t={})=>this.z(e,t,16));v(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));v(this,"$",this.counter);v(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);v(this,"drunk",e=>e!==void 0?(this._drunk.position=e,this._drunk.getPosition()):(this._drunk.step(),this._drunk.getPosition()));v(this,"drunk_max",e=>{this._drunk.max=e});v(this,"drunk_min",e=>{this._drunk.min=e});v(this,"drunk_wrap",e=>{this._drunk.toggleWrap(e)});v(this,"variable",(e,t)=>typeof e=="string"&&t===void 0?this.variables[e]:(this.variables[e]=t,this.variables[e]));v(this,"v",this.variable);v(this,"delete_variable",e=>{delete this.variables[e]});v(this,"dv",this.delete_variable);v(this,"clear_variables",()=>{this.variables={}});v(this,"cv",this.clear_variables);v(this,"randI",(e,t)=>Math.floor(this.randomGen()*(t-e+1))+e);v(this,"rand",(e,t)=>this.randomGen()*(t-e)+e);v(this,"irand",this.randI);v(this,"rI",this.randI);v(this,"r",this.rand);v(this,"ir",this.randI);v(this,"seed",e=>{typeof e=="number"&&(e=e.toString()),this.currentSeed!==e&&(this.currentSeed=e,this.randomGen=_m(e))});v(this,"localSeededRandom",e=>{if(typeof e=="number"&&(e=e.toString()),this.localSeeds.has(e))return this.localSeeds.get(e);const t=_m(e);return this.localSeeds.set(e,t),t});v(this,"clearLocalSeed",(e=void 0)=>{e&&this.localSeeds.delete(e.toString()),this.localSeeds.clear()});v(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));v(this,"cmp",this.clamp);v(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));v(this,"tempo",this.bpm);v(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));v(this,"ppqn",e=>e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e));v(this,"time_signature",(e,t)=>{this.app.clock.time_signature=[e,t]});v(this,"prob",e=>this.randomGen()*100this.randomGen()>.5);v(this,"odds",(e,t=1)=>this.randomGen()!1);v(this,"almostNever",(e=1)=>this.randomGen()<.025*this.ppqn()/(this.ppqn()*e));v(this,"rarely",(e=1)=>this.randomGen()<.1*this.ppqn()/(this.ppqn()*e));v(this,"scarcely",(e=1)=>this.randomGen()<.25*this.ppqn()/(this.ppqn()*e));v(this,"sometimes",(e=1)=>this.randomGen()<.5*this.ppqn()/(this.ppqn()*e));v(this,"often",(e=1)=>this.randomGen()<.75*this.ppqn()/(this.ppqn()*e));v(this,"frequently",(e=1)=>this.randomGen()<.9*this.ppqn()/(this.ppqn()*e));v(this,"almostAlways",(e=1)=>this.randomGen()<.985*this.ppqn()/(this.ppqn()*e));v(this,"always",(e=1)=>!0);v(this,"dice",e=>Math.floor(this.randomGen()*e)+1);v(this,"cbar",()=>this.app.clock.time_position.bar+1);v(this,"ctick",()=>this.app.clock.tick+1);v(this,"cpulse",()=>this.app.clock.time_position.pulse+1);v(this,"cbeat",()=>this.app.clock.time_position.beat+1);v(this,"ebeat",()=>this.app.clock.beats_since_origin+1);v(this,"epulse",()=>this.app.clock.pulses_since_origin+1);v(this,"nominator",()=>this.app.clock.time_signature[0]);v(this,"meter",()=>this.app.clock.time_signature[1]);v(this,"denominator",this.meter);v(this,"beat",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%Math.floor(r*this.ppqn())===0).some(r=>r===!0));v(this,"pulse",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%r===0).some(r=>r===!0));v(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});v(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)});v(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)});v(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)});v(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)});v(this,"delay",(e,t)=>{setTimeout(t,e)});v(this,"delayr",(e,t,r)=>{[...Array(t).keys()].map(a=>e*a).forEach((a,s)=>{setTimeout(r,a)})});v(this,"euclid",(e,t,r,i=0)=>this._euclidean_cycle(t,r,i)[e%r]);v(this,"ec",this.euclid);v(this,"rhythm",(e,t,r,i=0)=>this.beat(e)&&this._euclidean_cycle(t,r,i).beat(e));v(this,"bin",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return i[e%i.length]});v(this,"binrhythm",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return this.beat(e)&&i.beat(e)});v(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);v(this,"usine",(e=1,t=0)=>(this.sine(e,t)+1)/2);v(this,"saw",(e=1,t=0)=>this.app.clock.ctx.currentTime*e%1*2-1+t);v(this,"usaw",(e=1,t=0)=>(this.saw(e,t)+1)/2);v(this,"triangle",(e=1,t=0)=>Math.abs(this.saw(e,t))*2-1);v(this,"utriangle",(e=1,t=0)=>(this.triangle(e,t)+1)/2);v(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);v(this,"noise",()=>this.randomGen()*2-1);v(this,"min",(...e)=>Math.min(...e));v(this,"max",(...e)=>Math.max(...e));v(this,"mean",(...e)=>e.reduce((r,i)=>r+i,0)/e.length);v(this,"limit",(e,t,r)=>Math.min(Math.max(e,t),r));v(this,"abs",Math.abs);v(this,"speak",(e,t="en-US",r=0,i=1,a=1)=>{new uR({text:e,lang:t,voice:r,rate:i,pitch:a}).speak().then(()=>{}).catch(o=>{console.log(o)})});v(this,"stop_hydra",()=>{this.app.hydra.hush()});v(this,"sound",e=>new Tm(e,this.app));v(this,"snd",this.sound);v(this,"samples",qa);v(this,"log",e=>{console.log(e),this._logMessage(e)});v(this,"scale",BP);v(this,"rate",e=>{});v(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]});v(this,"seqbeat",(...e)=>e[this.app.clock.time_position.beat%e.length]);v(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>1|(Mt&21845)<<1;yi=(yi&52428)>>2|(yi&13107)<<2,yi=(yi&61680)>>4|(yi&3855)<<4,xm[Mt]=((yi&65280)>>8|(yi&255)<<8)>>1}var zn=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},$i=new ur(288);for(var Mt=0;Mt<144;++Mt)$i[Mt]=8;for(var Mt=144;Mt<256;++Mt)$i[Mt]=9;for(var Mt=256;Mt<280;++Mt)$i[Mt]=7;for(var Mt=280;Mt<288;++Mt)$i[Mt]=8;var wo=new ur(32);for(var Mt=0;Mt<32;++Mt)wo[Mt]=5;var C3=zn($i,9,0),y3=zn($i,9,1),A3=zn(wo,5,0),R3=zn(wo,5,1),ku=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},Lu=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Yg=function(n){return(n+7)/8|0},Gg=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},$g=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,P=0;for(Y==16?(P=3+gn(n,u,3),u+=2,ee=x[L-1]):Y==17?(P=3+gn(n,u,7),u+=3):Y==18&&(P=11+gn(n,u,127),u+=7);P--;)x[L++]=ee}}var $=x.subarray(0,E),K=x.subarray(E);b=ku($),A=ku(K),m=zn($,b,1),_=zn(K,A,1)}else Mr(1);else{var Y=Yg(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){oe=u,m=null;break}else{var ke=Oe-254;if(Oe>264){var L=Oe-257,Me=Bc[L];ke=gn(n,u,(1<>4;Ee||Mr(3),u+=Ee&15;var K=v3[Ne];if(Ne>3){var Me=Uc[Ne];K+=Lu(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},Mu=function(n,e){for(var t=[],r=0;rm&&(m=a[r].s);var _=new Kr(m+1),b=km(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}},km=function(n,e,t){return n.s==-1?Math.max(km(n.l,e,t+1),km(n.r,e,t+1)):e[n.s]=t},ZO=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[wm[te-1]];--te);var ne=c+5<<3,re=Zs(i,$i)+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 mR(e,u,n.subarray(l,l+c));var P,$,K,X;if(ni(e,u,1+(ee15&&(ni(e,u,ke[x]>>5&127),u+=ke[x]>>12)}}else P=C3,$=$i,K=A3,X=wo;for(var x=0;x255){var Me=Ee>>18&31;Xs(e,u,P[Me+257]),u+=$[Me+257],Me>7&&(ni(e,u,Ee>>23&31),u+=Bc[Me]);var Ne=Ee&31;Xs(e,u,K[Ne]),u+=X[Ne],Ne>3&&(Xs(e,u,Ee>>5&8191),u+=Uc[Ne])}else Xs(e,u,P[Ee]),u+=$[Ee]}return Xs(e,u,P[256]),u+$[256]},N3=new Fg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gR=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)&&(P>423||!c)){u=KO(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 K=2,X=0,ce=_,oe=re-ee&32767;if(P>2&&ne==Z(w-oe))for(var Oe=Math.min(m,P)-1,ke=Math.min(32767,w),Me=Math.min(258,P);oe<=ke&&--ce&&re!=ee;){if(n[w+K]==n[w+K-oe]){for(var Ee=0;EeK){if(K=Ee,X=oe,Ee>Oe)break;for(var Ne=Math.min(oe,Ee-2),ue=0,$=0;$ue&&(ue=Ve,ee=De)}}}re=ee,ee=A[re],oe+=re-ee&32767}if(X){h[L++]=268435456|Dm[K]<<18|XO[X];var et=Dm[K]&31,nt=XO[X]&31;x+=Bc[et]+Uc[nt],++E[257+et],++S[nt],G=w+K,++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=mR(l,u+1,n.subarray(w,Ke))}a.i=s}return Gg(o,0,r+Yg(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)},Lm=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&&Lm(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 $g(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),Lm(i,a-8,t.d()),Lm(i,a-4,r),i}function G3(n,e){var t=M3(n);return t+8>n.length&&Mr(6,"invalid gzip data"),$g(n.subarray(t,-8),{i:2},e&&e.out||new ur(P3(n)),e&&e.dictionary)}function $3(n,e){return $g(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 Mm=typeof TextDecoder<"u"&&new TextDecoder,q3=0;try{Mm.decode(gR,{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:Gg(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 H3(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,P,$;do for(ne=0;ee=L.exec(h);)if(G.test(ee[0]))ne++||(re=L.lastIndex,P=re-ee[0].length);else if(ne&&!--ne){$=ee.index+ee[0].length;var K={left:{start:P,end:re},match:{start:re,end:ee.index},right:{start:ee.index,end:$},wholeMatch:{start:P,end:$}};if(te.push(K),!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 P in s)s.hasOwnProperty(P)&&(E[P]=s[P]);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(P,$){if($=$||null,r.helper.isString(P))if(P=r.helper.stdExtName(P),$=P,r.extensions[P]){console.warn("DEPRECATION WARNING: "+P+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),ne(r.extensions[P],P);return}else if(!r.helper.isUndefined(a[P]))P=a[P];else throw Error('Extension "'+P+'" could not be loaded. It was either not found or is not a valid extension.');typeof P=="function"&&(P=P()),r.helper.isArray(P)||(P=[P]);var K=c(P,$);if(!K.valid)throw Error(K.error);for(var X=0;X>",!1),Zt=ct("<<",!1),yt=ct("<",!1),$e=ct(">",!1),vr=ct("_",!1),jn=ct("?",!1),ft=ct("r",!1),xr=ct("#",!1),mr=ct("b",!1),_i=Nn([["a","z"],["A","Z"],["0","9"],"-","*","+"],!1,!1),Rn=Nn([["A","G"]],!1,!1),Qt=Nn(["b","s"],!1,!1),hn=ct("iii",!1),qi=ct("ii",!1),Si=ct("iv",!1),Vi=ct("i",!1),en=ct("vii",!1),Jn=ct("vi",!1),fn=ct("v",!1),Wt=function(y){return y.filter(M=>M)},Oi=function(){return parseFloat(gr())},Ei=function(){return parseInt(gr())},q=function(){return parseInt(gr())},ie=function(){},de=function(){return KM[gr()]},ge=function(y){return y.filter(M=>M)},Ce=function(y,M){return M?Pe(GO,{item:y,times:M}):Pe($O,{items:y})},qe=function(y){return y},Be=function(y,M,Q){return Pe(pP,{left:y,operation:M,right:Q})},At=function(y,M){return Pe(dP,{items:y,times:M})},Cr=function(y){return Pe(XA,{items:y})},Fr=function(y){return y.map(M=>typeof M=="number"?M:void 0)},Ca=function(){return Math.ceil(zA(gr()))},Hi=function(y){var M=y.filter(Q=>Q).map(Q=>Pe(ui,{pitch:Q[0]},Q.toString()));return Pe($O,{items:M})},Ts=function(y){return y},Yr=function(){},vs=function(y){return Pe(xg,{items:y})},ya=function(y){return Pe(cP,{octave:y})},Aa=function(){return gr().split("").reduce((y,M)=>y+(M==="^"?1:-1),0)},Cs=function(){return Pe(YO,{seededRandom:a.seededRandom})},Ra=function(y,M){return Pe(YO,{min:y,max:M,seededRandom:a.seededRandom})},ys=function(y,M){return Pe(GO,{item:y,times:M})},Ia=function(y){return Pe(uP,{duration:y})},kr=function(y){return Pe(Sm,{duration:y})},As=function(y,M,Q,j){const le=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return Pe(ui,{duration:M,pitch:j,octave:le,add:Q})},Rs=function(y){return y.reduce((M,Q)=>M+(Q==="#"?1:-1),0)},Na=function(y,M,Q,j,le){const fe=y?a.nodeOptions.octave+y:a.nodeOptions.octave,Re=M||a.nodeOptions.duration;return Pe(ba,{pitches:[Q].concat(j),inversion:le,duration:Re,octave:fe})},wa=function(){return gr()},Is=function(y){return y},Da=function(){return gr()},Ns=function(y,M,Q,j,le){const fe=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",Re=a.nodeOptions.key?a.nodeOptions.key:"C",st=bP(j,Q,fe,y,M),Rt=M||a.nodeOptions.duration,Vt=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return Pe(ba,{duration:Rt,octave:Vt,pitches:st,chordName:j,inversion:le,scaleName:fe,key:Re})},xa=function(y,M,Q,j,le){const fe=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",Re=a.nodeOptions.key?a.nodeOptions.key:"C",st=y?a.nodeOptions.octave+y:a.nodeOptions.octave,Rt=M||a.nodeOptions.duration;return Pe(lP,{duration:Rt,roman:Q,octave:st,chordName:j,inversion:le,scaleName:fe,key:Re})},ws=function(y,M,Q){const j=y?a.nodeOptions.octave+y:a.nodeOptions.octave,le=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",fe=a.nodeOptions.key?a.nodeOptions.key:"C",Re=IP(Q,fe,le);return M||a.nodeOptions.duration,Pe(ui,{duration:M,pitch:Re.pc,octave:Re.octave+j,add:Re.add,scaleName:le,key:fe})},N=0,Je=0,_t=[{line:1,column:1}],Lr=0,In=[],ve=0,Te={},bi;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 ka(){return wn(Je,N)}function ct(y,M){return{type:"literal",text:y,ignoreCase:M}}function Nn(y,M,Q){return{type:"class",parts:y,inverted:M,ignoreCase:Q}}function Ti(){return{type:"end"}}function La(y){return{type:"other",description:y}}function ei(y){var M=_t[y],Q;if(M)return M;for(Q=y-1;!_t[Q];)Q--;for(M=_t[Q],M={line:M.line,column:M.column};QLr&&(Lr=N,In=[]),In.push(y))}function zi(y,M,Q){return new e(e.buildMessage(y,M),y,M,Q)}function Dn(){var y,M,Q=N*40+0,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,M=Wi(),M!==s&&(Je=y,M=Wt(M)),y=M,Te[Q]={nextPos:N,result:y},y)}function sr(){var y,M,Q,j,le,fe,Re,st=N*40+1,Rt=Te[st];if(Rt)return N=Rt.nextPos,Rt.result;for(y=N,M=N,i.charCodeAt(N)===45?(Q=u,N++):(Q=s,ve===0&&Ae(mt)),Q===s&&(Q=null),j=[],De.test(i.charAt(N))?(le=i.charAt(N),N++):(le=s,ve===0&&Ae(it));le!==s;)j.push(le),De.test(i.charAt(N))?(le=i.charAt(N),N++):(le=s,ve===0&&Ae(it));if(i.charCodeAt(N)===46?(le=p,N++):(le=s,ve===0&&Ae(Ct)),le!==s){if(fe=[],De.test(i.charAt(N))?(Re=i.charAt(N),N++):(Re=s,ve===0&&Ae(it)),Re!==s)for(;Re!==s;)fe.push(Re),De.test(i.charAt(N))?(Re=i.charAt(N),N++):(Re=s,ve===0&&Ae(it));else fe=s;fe!==s?(Q=[Q,j,le,fe],M=Q):(N=M,M=s)}else N=M,M=s;if(M===s)if(M=N,i.charCodeAt(N)===46?(Q=p,N++):(Q=s,ve===0&&Ae(Ct)),Q!==s){if(j=[],De.test(i.charAt(N))?(le=i.charAt(N),N++):(le=s,ve===0&&Ae(it)),le!==s)for(;le!==s;)j.push(le),De.test(i.charAt(N))?(le=i.charAt(N),N++):(le=s,ve===0&&Ae(it));else j=s;j!==s?(Q=[Q,j],M=Q):(N=M,M=s)}else N=M,M=s;return M!==s&&(Je=y,M=Oi()),y=M,Te[st]={nextPos:N,result:y},y}function ti(){var y,M,Q=N*40+2,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,i.charCodeAt(N)===45?N++:ve===0&&Ae(mt),De.test(i.charAt(N))?(M=i.charAt(N),N++):(M=s,ve===0&&Ae(it)),M!==s?(Je=y,y=Ei()):(N=y,y=s),Te[Q]={nextPos:N,result:y},y)}function _r(){var y,M,Q,j=N*40+3,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,i.charCodeAt(N)===45?N++:ve===0&&Ae(mt),M=[],De.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(it)),Q!==s)for(;Q!==s;)M.push(Q),De.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(it));else M=s;return M!==s?(Je=y,y=q()):(N=y,y=s),Te[j]={nextPos:N,result:y},y}function ri(){var y,M,Q=N*40+4,j=Te[Q];return j?(N=j.nextPos,j.result):(ve++,y=N,Ze.test(i.charAt(N))?(M=i.charAt(N),N++):(M=s,ve===0&&Ae(ot)),M!==s&&(Je=y,M=ie()),y=M,ve--,y===s&&(M=s,ve===0&&Ae(Nt)),Te[Q]={nextPos:N,result:y},y)}function Ho(){var y,M,Q=N*40+8,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,Ve.test(i.charAt(N))?(M=i.charAt(N),N++):(M=s,ve===0&&Ae(pt)),M!==s&&(Je=y,M=de()),y=M,Te[Q]={nextPos:N,result:y},y)}function xn(){var y,M=N*40+9,Q=Te[M];return Q?(N=Q.nextPos,Q.result):(y=Ho(),y===s&&(y=sr()),Te[M]={nextPos:N,result:y},y)}function Wi(){var y,M,Q,j=N*40+10,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,M=[],Q=C(),Q===s&&(Q=Ds(),Q===s&&(Q=ks(),Q===s&&(Q=Xi(),Q===s&&(Q=xs(),Q===s&&(Q=Ki(),Q===s&&(Q=d())))))),Q!==s)for(;Q!==s;)M.push(Q),Q=C(),Q===s&&(Q=Ds(),Q===s&&(Q=ks(),Q===s&&(Q=Xi(),Q===s&&(Q=xs(),Q===s&&(Q=Ki(),Q===s&&(Q=d()))))));else M=s;return M!==s&&(Je=y,M=ge(M)),y=M,Te[j]={nextPos:N,result:y},y}function Xi(){var y,M,Q,j,le,fe=N*40+11,Re=Te[fe];return Re?(N=Re.nextPos,Re.result):(y=N,i.charCodeAt(N)===40?(M=b,N++):(M=s,ve===0&&Ae(We)),M!==s?(i.charCodeAt(N)===58?N++:ve===0&&Ae(hr),Q=Wi(),Q!==s?(j=zo(),j===s&&(j=null),i.charCodeAt(N)===41?(le=R,N++):(le=s,ve===0&&Ae(qt)),le!==s?(Je=y,y=Ce(Q,j)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[fe]={nextPos:N,result:y},y)}function zo(){var y,M,Q,j=N*40+12,le=Te[j];return le?(N=le.nextPos,le.result):(y=N,i.charCodeAt(N)===58?(M=A,N++):(M=s,ve===0&&Ae(hr)),M!==s?(Q=_r(),Q!==s?(Je=y,y=qe(Q)):(N=y,y=s)):(N=y,y=s),Te[j]={nextPos:N,result:y},y)}function Ds(){var y,M,Q,j,le=N*40+13,fe=Te[le];return fe?(N=fe.nextPos,fe.result):(y=N,M=Xi(),M!==s?(Q=Ms(),Q!==s?(j=Xi(),j!==s?(Je=y,y=Be(M,Q,j)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[le]={nextPos:N,result:y},y)}function xs(){var y,M,Q,j,le,fe=N*40+14,Re=Te[fe];return Re?(N=Re.nextPos,Re.result):(y=N,i.substr(N,2)===k?(M=k,N+=2):(M=s,ve===0&&Ae(fr)),M!==s?(Q=Wi(),Q!==s?(j=zo(),j===s&&(j=null),i.charCodeAt(N)===93?(le=Y,N++):(le=s,ve===0&&Ae(W)),le!==s?(Je=y,y=At(Q,j)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[fe]={nextPos:N,result:y},y)}function ks(){var y,M,Q,j,le=N*40+15,fe=Te[le];return fe?(N=fe.nextPos,fe.result):(y=N,i.charCodeAt(N)===91?(M=Z,N++):(M=s,ve===0&&Ae(_e)),M!==s?(Q=Wi(),Q!==s?(i.charCodeAt(N)===93?(j=Y,N++):(j=s,ve===0&&Ae(W)),j!==s?(Je=y,y=Cr(Q)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[le]={nextPos:N,result:y},y)}function Zi(){var y,M=N*40+16,Q=Te[M];return Q?(N=Q.nextPos,Q.result):(y=_r(),y===s&&(y=ti()),Te[M]={nextPos:N,result:y},y)}function Ma(){var y,M,Q,j=N*40+17,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,M=[],Q=Ls(),Q===s&&(Q=Zi()),Q!==s)for(;Q!==s;)M.push(Q),Q=Ls(),Q===s&&(Q=Zi());else M=s;return M!==s&&(Je=y,M=Fr(M)),y=M,Te[j]={nextPos:N,result:y},y}function Ls(){var y,M,Q,j,le=N*40+18,fe=Te[le];return fe?(N=fe.nextPos,fe.result):(y=N,i.charCodeAt(N)===40?N++:ve===0&&Ae(We),M=Zi(),M!==s?(Q=Ms(),Q!==s?(j=Ma(),j!==s?(i.charCodeAt(N)===41?N++:ve===0&&Ae(qt),Je=y,y=Ca()):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[le]={nextPos:N,result:y},y)}function Wo(){var y,M,Q,j,le=N*40+19,fe=Te[le];if(fe)return N=fe.nextPos,fe.result;if(y=N,i.charCodeAt(N)===123?(M=h,N++):(M=s,ve===0&&Ae(Le)),M!==s){if(Q=[],j=Ma(),j===s&&(j=ri()),j!==s)for(;j!==s;)Q.push(j),j=Ma(),j===s&&(j=ri());else Q=s;Q!==s?(i.charCodeAt(N)===125?(j=E,N++):(j=s,ve===0&&Ae(xe)),j!==s?(Je=y,y=Hi(Q)):(N=y,y=s)):(N=y,y=s)}else N=y,y=s;return Te[le]={nextPos:N,result:y},y}function Ms(){var y,M=N*40+20,Q=Te[M];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(we)),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[M]={nextPos:N,result:y},y)}function Ki(){var y,M,Q=N*40+21,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,M=U(),M===s&&(M=ae(),M===s&&(M=Se(),M===s&&(M=ye(),M===s&&(M=H(),M===s&&(M=B(),M===s&&(M=f(),M===s&&(M=ri(),M===s&&(M=D(),M===s&&(M=O(),M===s&&(M=T(),M===s&&(M=Xi(),M===s&&(M=Wo(),M===s&&(M=Yc()))))))))))))),M!==s&&(Je=y,M=Ts(M)),y=M,Te[Q]={nextPos:N,result:y},y)}function Yc(){var y,M,Q=N*40+22,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,i.charCodeAt(N)===124?(M=_,N++):(M=s,ve===0&&Ae(Tr)),M!==s&&(Je=y,M=Yr()),y=M,Te[Q]={nextPos:N,result:y},y)}function d(){var y,M,Q,j,le=N*40+23,fe=Te[le];return fe?(N=fe.nextPos,fe.result):(y=N,i.charCodeAt(N)===60?(M=re,N++):(M=s,ve===0&&Ae(yt)),M!==s?(Q=Wi(),Q!==s?(i.charCodeAt(N)===62?(j=ee,N++):(j=s,ve===0&&Ae($e)),j!==s?(Je=y,y=vs(Q)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[le]={nextPos:N,result:y},y)}function f(){var y,M,Q=N*40+24,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,M=g(),M!==s&&(Je=y,M=ya(M)),y=M,Te[Q]={nextPos:N,result:y},y)}function g(){var y,M,Q,j=N*40+25,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,M=[],i.charCodeAt(N)===94?(Q=L,N++):(Q=s,ve===0&&Ae(Ot)),Q===s&&(i.charCodeAt(N)===95?(Q=P,N++):(Q=s,ve===0&&Ae(vr))),Q!==s)for(;Q!==s;)M.push(Q),i.charCodeAt(N)===94?(Q=L,N++):(Q=s,ve===0&&Ae(Ot)),Q===s&&(i.charCodeAt(N)===95?(Q=P,N++):(Q=s,ve===0&&Ae(vr)));else M=s;return M!==s&&(Je=y,M=Aa()),y=M,Te[j]={nextPos:N,result:y},y}function O(){var y,M,Q=N*40+26,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,i.charCodeAt(N)===63?(M=$,N++):(M=s,ve===0&&Ae(jn)),M!==s&&(Je=y,M=Cs()),y=M,Te[Q]={nextPos:N,result:y},y)}function T(){var y,M,Q,j,le,fe,Re=N*40+27,st=Te[Re];return st?(N=st.nextPos,st.result):(y=N,i.charCodeAt(N)===40?(M=b,N++):(M=s,ve===0&&Ae(We)),M!==s?(Q=ti(),Q!==s?(i.charCodeAt(N)===44?(j=m,N++):(j=s,ve===0&&Ae(Ge)),j!==s?(le=ti(),le!==s?(i.charCodeAt(N)===41?(fe=R,N++):(fe=s,ve===0&&Ae(qt)),fe!==s?(Je=y,y=Ra(Q,le)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[Re]={nextPos:N,result:y},y)}function C(){var y,M,Q,j,le,fe,Re=N*40+28,st=Te[Re];return st?(N=st.nextPos,st.result):(y=N,M=Ki(),M!==s?(i.charCodeAt(N)===58?(Q=A,N++):(Q=s,ve===0&&Ae(hr)),Q!==s?(j=_r(),j!==s?(le=N,ve++,i.charCodeAt(N)===41?(fe=R,N++):(fe=s,ve===0&&Ae(qt)),fe===s&&(i.charCodeAt(N)===93?(fe=Y,N++):(fe=s,ve===0&&Ae(W))),ve--,fe===s?le=void 0:(N=le,le=s),le!==s?(Je=y,y=ys(M,j)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s)):(N=y,y=s),Te[Re]={nextPos:N,result:y},y)}function D(){var y,M,Q=N*40+29,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,M=xn(),M!==s&&(Je=y,M=Ia(M)),y=M,Te[Q]={nextPos:N,result:y},y)}function U(){var y,M,Q,j=N*40+30,le=Te[j];return le?(N=le.nextPos,le.result):(y=N,M=xn(),M===s&&(M=null),i.charCodeAt(N)===114?(Q=K,N++):(Q=s,ve===0&&Ae(ft)),Q!==s?(Je=y,y=kr(M)):(N=y,y=s),Te[j]={nextPos:N,result:y},y)}function B(){var y,M,Q,j,le,fe=N*40+31,Re=Te[fe];return Re?(N=Re.nextPos,Re.result):(y=N,M=g(),M===s&&(M=null),Q=xn(),Q===s&&(Q=null),j=z(),j===s&&(j=null),le=ti(),le!==s?(Je=y,y=As(M,Q,j,le)):(N=y,y=s),Te[fe]={nextPos:N,result:y},y)}function z(){var y,M,Q,j=N*40+32,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,M=[],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;)M.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 M=s;return M!==s&&(Je=y,M=Rs(M)),y=M,Te[j]={nextPos:N,result:y},y}function H(){var y,M,Q,j,le,fe,Re=N*40+33,st=Te[Re];if(st)return N=st.nextPos,st.result;if(y=N,M=g(),M===s&&(M=null),Q=xn(),Q===s&&(Q=null),j=B(),j!==s){if(le=[],fe=B(),fe!==s)for(;fe!==s;)le.push(fe),fe=B();else le=s;le!==s?(fe=he(),fe===s&&(fe=null),Je=y,y=Na(M,Q,j,le,fe)):(N=y,y=s)}else N=y,y=s;return Te[Re]={nextPos:N,result:y},y}function pe(){var y,M,Q,j=N*40+34,le=Te[j];if(le)return N=le.nextPos,le.result;if(y=N,M=[],et.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(_i)),Q!==s)for(;Q!==s;)M.push(Q),et.test(i.charAt(N))?(Q=i.charAt(N),N++):(Q=s,ve===0&&Ae(_i));else M=s;return M!==s&&(Je=y,M=wa()),y=M,Te[j]={nextPos:N,result:y},y}function he(){var y,M,Q,j=N*40+35,le=Te[j];return le?(N=le.nextPos,le.result):(y=N,i.charCodeAt(N)===37?(M=w,N++):(M=s,ve===0&&Ae(ht)),M!==s?(Q=_r(),Q!==s?(Je=y,y=Is(Q)):(N=y,y=s)):(N=y,y=s),Te[j]={nextPos:N,result:y},y)}function se(){var y,M,Q=N*40+36,j=Te[Q];return j?(N=j.nextPos,j.result):(y=N,nt.test(i.charAt(N))?(M=i.charAt(N),N++):(M=s,ve===0&&Ae(Rn)),M!==s?(Ke.test(i.charAt(N))?(i.charAt(N),N++):ve===0&&Ae(Qt),Je=y,y=Da()):(N=y,y=s),Te[Q]={nextPos:N,result:y},y)}function ae(){var y,M,Q,j,le,fe,Re=N*40+37,st=Te[Re];return st?(N=st.nextPos,st.result):(y=N,M=g(),M===s&&(M=null),Q=xn(),Q===s&&(Q=null),j=se(),j!==s?(i.charCodeAt(N)===94?N++:ve===0&&Ae(Ot),le=pe(),le!==s?(fe=he(),fe===s&&(fe=null),Je=y,y=Ns(M,Q,j,le,fe)):(N=y,y=s)):(N=y,y=s),Te[Re]={nextPos:N,result:y},y)}function ye(){var y,M,Q,j,le,fe,Re=N*40+38,st=Te[Re];return st?(N=st.nextPos,st.result):(y=N,M=g(),M===s&&(M=null),Q=xn(),Q===s&&(Q=null),i.substr(N,3)===oe?(j=oe,N+=3):(j=s,ve===0&&Ae(hn)),j===s&&(i.substr(N,2)===Oe?(j=Oe,N+=2):(j=s,ve===0&&Ae(qi)),j===s&&(i.substr(N,2)===ke?(j=ke,N+=2):(j=s,ve===0&&Ae(Si)),j===s&&(i.charCodeAt(N)===105?(j=Me,N++):(j=s,ve===0&&Ae(Vi)),j===s&&(i.substr(N,3)===Ee?(j=Ee,N+=3):(j=s,ve===0&&Ae(en)),j===s&&(i.substr(N,2)===Ne?(j=Ne,N+=2):(j=s,ve===0&&Ae(Jn)),j===s&&(i.charCodeAt(N)===118?(j=ue,N++):(j=s,ve===0&&Ae(fn)))))))),j!==s?(i.charCodeAt(N)===94?N++:ve===0&&Ae(Ot),le=pe(),le===s&&(le=null),fe=he(),fe===s&&(fe=null),Je=y,y=xa(M,Q,j,le,fe)):(N=y,y=s),Te[Re]={nextPos:N,result:y},y)}function Se(){var y,M,Q,j,le=N*40+39,fe=Te[le];return fe?(N=fe.nextPos,fe.result):(y=N,M=g(),M===s&&(M=null),Q=xn(),Q===s&&(Q=null),j=se(),j!==s?(Je=y,y=ws(M,Q,j)):(N=y,y=s),Te[le]={nextPos:N,result:y},y)}var He=a.nodeOptions||{};function Pe(y,M,Q=void 0){M.text=Q||gr(),M.location=ka();for(var j in He)(M[j]===void 0||M[j]===null)&&(M[j]=He[j]);return new y(M)}if(bi=c(),bi!==s&&N===i.length)return bi;throw bi!==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 Hn(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:HA;r=nR(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 ba);if(e>=0){for(let t=e+1;t<=this.evaluated.length;t++)if(this.evaluated[t]instanceof ba){const r=this.evaluated[e],i=this.evaluated[t],a=wP(r.notes(),i.notes()),s=Hn(i);s.voiceLeadFromNotes(a,this.options.nodeOptions),this.evaluated[t]=s,e=t}}return this}}const nR=(n,e)=>{const t=n.length,r=e/t;return n.map(a=>a instanceof XA?nR(a.items,r):(a.duration=r,a)).flat(1/0)},kP=n=>{let e={};return oP.forEach(t=>{if(n[t]!==void 0){const r=n[t];e[t]=r,delete n[t]}}),e};class LP{constructor(){v(this,"midiAccess",null);v(this,"midiOutputs",[]);v(this,"currentOutputIndex",0);v(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 MP{constructor(e,t,r){v(this,"min");v(this,"max");v(this,"wrap");v(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}}const PP={major:[0,2,4,5,7,9,11],naturalMinor:[0,2,3,5,7,8,10],harmonicMinor:[0,2,3,5,7,8,11],melodicMinor:[0,2,3,5,7,9,11],dorian:[0,2,3,5,7,9,10],phrygian:[0,1,3,5,7,8,10],lydian:[0,2,4,6,7,9,11],mixolydian:[0,2,4,5,7,9,10],aeolian:[0,2,3,5,7,8,10],locrian:[0,1,3,5,6,8,10],wholeTone:[0,2,4,6,8,10],majorPentatonic:[0,2,4,7,9],minorPentatonic:[0,3,5,7,10],chromatic:[0,1,2,3,4,5,6,7,8,9,10,11],blues:[0,3,5,6,7,10],diminished:[0,2,3,5,6,8,9,11],neapolitanMinor:[0,1,3,5,7,8,11],neapolitanMajor:[0,1,3,5,7,9,11],enigmatic:[0,1,4,6,8,10,11],doubleHarmonic:[0,1,4,5,7,8,11],octatonic:[0,2,3,5,6,8,9,11],bebopDominant:[0,2,4,5,7,9,10,11],bebopMajor:[0,2,4,5,7,8,9,11],bebopMinor:[0,2,3,5,7,8,9,11],bebopDorian:[0,2,3,4,5,7,9,10],harmonicMajor:[0,2,4,5,7,8,11],hungarianMinor:[0,2,3,6,7,8,11],hungarianMajor:[0,3,4,6,7,9,10],oriental:[0,1,4,5,6,9,10],romanianMinor:[0,2,3,6,7,9,10],spanishGypsy:[0,1,4,5,7,8,10],jewish:[0,1,4,5,7,8,10],hindu:[0,2,4,5,7,8,10],japanese:[0,1,5,7,8],hirajoshi:[0,2,3,7,8],kumoi:[0,2,3,7,9],inSen:[0,1,5,7,10],iwato:[0,1,5,6,10],yo:[0,2,5,7,9],minorBlues:[0,3,5,6,7,10],algerian:[0,2,3,5,6,7,8,11],augmented:[0,3,4,7,8,11],balinese:[0,1,3,7,8],byzantine:[0,1,4,5,7,8,11],chinese:[0,4,6,7,11],egyptian:[0,2,5,7,10],eightToneSpanish:[0,1,3,4,5,6,8,10],hawaiian:[0,2,3,5,7,9,10],hindustan:[0,2,4,5,7,8,10],persian:[0,1,4,5,6,8,11],eastIndianPurvi:[0,1,4,6,7,8,11],orientalA:[0,1,4,5,6,9,10]};function BP(n,e="major",t=4){const r=PP[e];if(!r)throw new Error(`Unknown scale ${e}`);let i=n%r.length;i<0&&(i+=r.length);let a=Math.floor(n/r.length);return 60+(t+a)*12+r[i]}class Mg{constructor(e){v(this,"seedValue");v(this,"randomGen",Math.random);v(this,"app");v(this,"values",{});v(this,"odds",(e,t)=>this.randomGen()this);v(this,"almostNever",e=>this.odds(.025,e));v(this,"rarely",e=>this.odds(.1,e));v(this,"scarcely",e=>this.odds(.25,e));v(this,"sometimes",e=>this.odds(.5,e));v(this,"often",e=>this.odds(.75,e));v(this,"frequently",e=>this.odds(.9,e));v(this,"almostAlways",e=>this.odds(.985,e));v(this,"always",e=>this.modify(e));v(this,"modify",e=>e(this));v(this,"seed",e=>(this.seedValue=e.toString(),this.randomGen=this.app.api.localSeededRandom(this.seedValue),this));v(this,"clear",()=>(this.app.api.clearLocalSeed(this.seedValue),this));v(this,"apply",e=>this.modify(e));v(this,"length",e=>(this.values.length=e,this));this.app=e,this.app.api.currentSeed&&(this.randomGen=this.app.api.randomGen)}}class iR extends Mg{constructor(t){super(t);v(this,"octave",t=>(this.values.octave=t,this.update(),this));v(this,"key",t=>(this.values.key=t,this.update(),this));v(this,"scale",t=>(wg(t)?(this.values.scaleName=t,this.values.parsedScale=Xn(t)):this.values.parsedScale=Dg(t),this.update(),this));v(this,"freq",t=>{this.values.freq=t;const r=hP(t);return r%1!==0?(this.values.note=Math.floor(r),this.values.bend=ZA(r)[1]):this.values.note=r,this});v(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 QO={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),!QO[r])throw new Error("vowel: unknown vowel "+r);const{gains:i,qs:a,freqs:s}=QO[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},Pc=(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},aR=n=>Math.pow(2,(n-69)/12)*440,Em=(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 Pc(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 mc(n){const e=zt().createGain();return e.gain.value=n,e}const bm=(n,e,t,r,i,a)=>{const s=zt().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)}}},HP=(n,e,t,r,i,a)=>{t=Math.max(.001,t),i=Math.max(.001,i);const s=zt().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)}}},zP=(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 Au(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=Em(2**-_*t,0,2e4),A=Em(2**(l-_)*t,0,2e4);return zP(m.frequency,i,a,s,o,b,A,c,u),m}return m}let WP=n=>console.log(n);const gs=(...n)=>WP(...n),Pg=FP();function Bg(n,e,t={}){Pg.setKey(n,{onTrigger:e,data:t})}function qO(n){return Pg.get()[n]}let Ru;const zt=()=>(Ru||(Ru=new AudioContext),Ru);let Sl;const Ug=()=>{const n=zt();return Sl||(Sl=n.createGain(),Sl.connect(n.destination)),Sl};let Iu;function XP(){return Iu||(Iu=zt().audioWorklet.addModule(VP),Iu)}function Nu(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 zt().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 ea={};function jP(n,e,t,r){var i;if(t=Em(t,0,.98),!ea[n]){const a=zt().createFeedbackDelay(1,e,t);(i=a.start)==null||i.call(a,r),a.connect(Ug()),ea[n]=a}return ea[n].delayTime.value!==e&&ea[n].delayTime.setValueAtTime(e,r),ea[n].feedback.value!==t&&ea[n].feedback.setValueAtTime(t,r),ea[n]}let ta={};function JP(n,e=2){if(!ta[n]){const t=zt().createReverb(e);t.connect(Ug()),ta[n]=t}return ta[n].duration!==e&&(ta[n]=ta[n].setDuration(e),ta[n].duration=e),ta[n]}let ra;function e3(n=2048){if(!ra){const e=zt().createAnalyser();e.fftSize=n,ra=e,new Float32Array(ra.frequencyBinCount)}return ra.fftSize!==n&&(ra.fftSize=n,new Float32Array(ra.frequencyBinCount)),ra}function wu(n,e,t){const r=mc(t);return n.connect(r),r.connect(e),r}const VO=async(n,e,t)=>{const r=zt();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:P,crush:$,shape:K,pan:X,vowel:ce,delay:oe=0,delayfeedback:Oe=.5,delaytime:ke=.25,orbit:Me=1,room:Ee,size:Ne=2,velocity:ue=1,analyze:De,fft:Ze=8}=n;l*=ue;let Ve=[];const et=()=>{Ve.forEach(ot=>ot==null?void 0:ot.disconnect())};s&&a&&(a=`${s}_${a}`);let nt;if(o)nt=o(i,n,t);else if(qO(a)){const{onTrigger:ot}=qO(a),Ge=await ot(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){gs("[webaudio] skip hap: still loading",r.currentTime-i);return}const Ke=[];if(Ke.push(nt),Ke.push(mc(l)),p!==void 0){let ot=()=>Au(r,"lowpass",p,k,_,b,A,R,m,i,i+t,u);Ke.push(ot()),c==="24db"&&Ke.push(ot())}if(Z!==void 0){let ot=()=>Au(r,"highpass",Z,x,h,E,S,I,Y,i,i+t,u);Ke.push(ot()),c==="24db"&&Ke.push(ot())}if(L!==void 0){let ot=()=>Au(r,"bandpass",L,ee,G,te,ne,re,w,i,i+t,u);Ke.push(ot()),c==="24db"&&Ke.push(ot())}if(ce!==void 0){const ot=r.createVowelFilter(ce);Ke.push(ot)}if(P!==void 0&&Ke.push(Nu(r,"coarse-processor",{coarse:P})),$!==void 0&&Ke.push(Nu(r,"crush-processor",{crush:$})),K!==void 0&&Ke.push(Nu(r,"shape-processor",{shape:K})),X!==void 0){const ot=r.createStereoPanner();ot.pan.value=2*X-1,Ke.push(ot)}const mt=mc(1);Ke.push(mt),mt.connect(Ug());let it;if(oe>0&&ke>0&&Oe>0){const ot=jP(Me,ke,Oe,i);it=wu(mt,ot,oe)}let Ct;if(Ee>0&&Ne>0){const ot=JP(Me,Ne);Ct=wu(mt,ot,Ee)}let Nt;if(De){const ot=e3(2**(Ze+5));Nt=wu(mt,ot,De)}Ke.slice(1).reduce((ot,Ge)=>ot.connect(Ge),Ke[0]),Ve=Ke.concat([it,Ct,Nt])},Du={};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&&gs("[sampler] hap has note and freq. ignoring note","warning");let l=qP({freq:i,note:t},36);o=l-36;const c=zt();let u;if(Array.isArray(a))u=a[e%a.length];else{const b=R=>Pc(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(!Du[n]){gs(`[sampler] load ${i}..`,"load-sample",{url:n});const a=Date.now();Du[n]=fetch(n).then(s=>s.arrayBuffer()).then(async s=>{const o=Date.now()-a,l=t3(s.byteLength);return gs(`[sampler] load ${i}... done! loaded ${l} in ${o}ms`,"loaded-sample",{url:n}),await e.decodeAudioData(s)})}return Du[n]};function i3(n){const e=zt(),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 qa=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=>qa(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)=>Bg(a,(o,l,c)=>l3(o,l,c,s),{type:"sample",samples:s,baseUrl:e,prebake:r,tag:i}),e)},HO=[];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=zt(),{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){gs(`[sampler] still loading sound "${a}:${m}"`,"highlight");return}if(!w){gs(`[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}=bm(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,P=p===void 0&&u===void 0)=>{let $=ee;if(P){const K=w.buffer.duration/w.playbackRate.value;$=n+(Y-R)*K}w.stop($+I),te($)}};if(c!==void 0){const ee=HO[c];ee&&(ee.node.gain.setValueAtTime(1,x),ee.node.gain.linearRampToValueAtTime(0,x+.01)),HO[c]=re}return re}const c3=(n,e=1,t="sine")=>{const r=zt(),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=>{Bg(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=Pc(h)),!E&&typeof h=="number"&&(E=aR(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=bm(p,m,_,b,A,e),u==="exp"&&(w=HP(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=mc(.3),{node:G,stop:te}=bm(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=zt(),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=zt().createOscillator(),s.type=n||"triangle"):s=p3(a,n),s.frequency.value=Number(e),s.start(t);let o;if(r>0){o=zt().createOscillator(),o.frequency.value=r;const l=zt().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=zt().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,P=0,$,K;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,K=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),P=(m?1-Z+Z*Math.sin(h*te/m):1)*S(P)*Math.abs(P)**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=Pc(r)),!i&&typeof r=="number"&&(i=aR(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=zt(),G=L.createBuffer(1,w.length,L.sampleRate);G.getChannelData(0).set(w);const te=zt().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=>{Bg(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 Tm extends iR{constructor(t,r){super(r);v(this,"volume",t=>this.updateValue("volume",t));v(this,"vol",this.volume);v(this,"zrand",t=>this.updateValue("zrand",t));v(this,"curve",t=>this.updateValue("curve",t));v(this,"slide",t=>this.updateValue("slide",t));v(this,"sld",this.slide);v(this,"deltaSlide",t=>this.updateValue("deltaSlide",t));v(this,"dslide",this.deltaSlide);v(this,"pitchJump",t=>this.updateValue("pitchJump",t));v(this,"pj",this.pitchJump);v(this,"pitchJumpTime",t=>this.updateValue("pitchJumpTime",t));v(this,"pjt",this.pitchJumpTime);v(this,"lfo",t=>this.updateValue("lfo",t));v(this,"noise",t=>this.updateValue("noise",t));v(this,"zmod",t=>this.updateValue("zmod",t));v(this,"zcrush",t=>this.updateValue("zcrush",t));v(this,"zdelay",t=>this.updateValue("zdelay",t));v(this,"sustainVolume",t=>this.updateValue("sustainVolume",t));v(this,"tremolo",t=>this.updateValue("tremolo",t));v(this,"dur",t=>this.updateValue("dur",t));v(this,"zzfx",t=>this.updateValue("zzfx",t));v(this,"fmi",t=>this.updateValue("fmi",t));v(this,"fmh",t=>this.updateValue("fmh",t));v(this,"fmenv",t=>this.updateValue("fmenv",t));v(this,"fmattack",t=>this.updateValue("fmattack",t));v(this,"fmatk",this.fmattack);v(this,"fmdecay",t=>this.updateValue("fmdecay",t));v(this,"fmdec",this.fmdecay);v(this,"fmsustain",t=>this.updateValue("fmsustain",t));v(this,"fmsus",this.fmsustain);v(this,"fmrelease",t=>this.updateValue("fmrelease",t));v(this,"fmrel",this.fmrelease);v(this,"fmvelocity",t=>this.updateValue("fmvelocity",t));v(this,"fmvel",this.fmvelocity);v(this,"fmwave",t=>this.updateValue("fmwave",t));v(this,"fmw",this.fmwave);v(this,"ftype",t=>this.updateValue("ftype",t));v(this,"fanchor",t=>this.updateValue("fanchor",t));v(this,"attack",t=>this.updateValue("attack",t));v(this,"atk",this.attack);v(this,"decay",t=>this.updateValue("decay",t));v(this,"dec",this.decay);v(this,"sustain",t=>this.updateValue("sustain",t));v(this,"sus",this.sustain);v(this,"release",t=>this.updateValue("release",t));v(this,"rel",this.release);v(this,"adsr",(t,r,i,a)=>(this.attack(t),this.decay(r),this.sustain(i),this.release(a),this));v(this,"lpenv",t=>this.updateValue("lpenv",t));v(this,"lpe",t=>this.updateValue("lpenv",t));v(this,"lpattack",t=>this.updateValue("lpattack",t));v(this,"lpa",this.lpattack);v(this,"lpdecay",t=>this.updateValue("lpdecay",t));v(this,"lpd",this.lpdecay);v(this,"lpsustain",t=>this.updateValue("lpsustain",t));v(this,"lps",this.lpsustain);v(this,"lprelease",t=>this.updateValue("lprelease",t));v(this,"lpr",this.lprelease);v(this,"cutoff",t=>this.updateValue("cutoff",t));v(this,"lpf",this.cutoff);v(this,"resonance",t=>this.updateValue("resonance",Math.min(Math.max(t,0),50)));v(this,"lpq",this.resonance);v(this,"lpadsr",(t,r,i,a,s)=>(this.lpenv(t),this.lpattack(r),this.lpdecay(i),this.lpsustain(a),this.lprelease(s),this));v(this,"hpenv",t=>this.updateValue("hpenv",t));v(this,"hpe",t=>this.updateValue("hpe",t));v(this,"hpattack",t=>this.updateValue("hpattack",t));v(this,"hpa",this.hpattack);v(this,"hpdecay",t=>this.updateValue("hpdecay",t));v(this,"hpd",this.hpdecay);v(this,"hpsustain",t=>this.updateValue("hpsustain",t));v(this,"hpsus",this.hpsustain);v(this,"hprelease",t=>this.updateValue("hprelease",t));v(this,"hpr",this.hprelease);v(this,"hcutoff",t=>this.updateValue("hcutoff",t));v(this,"hpf",this.hcutoff);v(this,"hresonance",t=>this.updateValue("hresonance",t));v(this,"hpq",this.hresonance);v(this,"hpadsr",(t,r,i,a,s)=>(this.hpenv(t),this.hpattack(r),this.hpdecay(i),this.hpsustain(a),this.hprelease(s),this));v(this,"bpenv",t=>this.updateValue("bpenv",t));v(this,"bpe",t=>this.updateValue("bpe",t));v(this,"bpattack",t=>this.updateValue("bpattack",t));v(this,"bpa",this.bpattack);v(this,"bpdecay",t=>this.updateValue("bpdecay",t));v(this,"bpd",this.bpdecay);v(this,"bpsustain",t=>this.updateValue("bpsustain",t));v(this,"bps",this.bpsustain);v(this,"bprelease",t=>this.updateValue("bprelease",t));v(this,"bpr",this.bprelease);v(this,"bandf",t=>this.updateValue("bandf",t));v(this,"bpf",this.bandf);v(this,"bandq",t=>this.updateValue("bandq",t));v(this,"bpq",this.bandq);v(this,"bpadsr",(t,r,i,a,s)=>(this.bpenv(t),this.bpattack(r),this.bpdecay(i),this.bpsustain(a),this.bprelease(s),this));v(this,"freq",t=>this.updateValue("freq",t));v(this,"f",this.freq);v(this,"vib",t=>this.updateValue("vib",t));v(this,"vibmod",t=>this.updateValue("vibmod",t));v(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});v(this,"loop",t=>this.updateValue("loop",t));v(this,"loopBegin",t=>this.updateValue("loopBegin",t));v(this,"loopEnd",t=>this.updateValue("loopEnd",t));v(this,"begin",t=>this.updateValue("begin",t));v(this,"end",t=>this.updateValue("end",t));v(this,"gain",t=>this.updateValue("gain",t));v(this,"dbgain",t=>this.updateValue("gain",Math.min(Math.pow(10,t/20),10)));v(this,"db",this.dbgain);v(this,"velocity",t=>this.updateValue("velocity",t));v(this,"vel",this.velocity);v(this,"pan",t=>this.updateValue("pan",t));v(this,"sound",t=>this.updateValue("s",t));v(this,"chord",t=>this.updateValue("chord",t));v(this,"snd",this.sound);v(this,"nudge",t=>this.updateValue("nudge",t));v(this,"cut",t=>this.updateValue("cut",t));v(this,"clip",t=>this.updateValue("clip",t));v(this,"n",t=>this.updateValue("n",t));v(this,"note",t=>this.updateValue("note",t));v(this,"speed",t=>this.updateValue("speed",t));v(this,"spd",this.speed);v(this,"coarse",t=>this.updateValue("coarse",t));v(this,"crush",t=>this.updateValue("crush",t));v(this,"shape",t=>this.updateValue("shape",t));v(this,"vowel",t=>this.updateValue("vowel",t));v(this,"vow",this.vowel);v(this,"delay",t=>this.updateValue("delay",t));v(this,"del",this.delay);v(this,"delayfeedback",t=>this.updateValue("delayfeedback",t));v(this,"delayfb",this.delayfeedback);v(this,"delaytime",t=>this.updateValue("delaytime",t));v(this,"delayt",this.delaytime);v(this,"orbit",t=>this.updateValue("orbit",t));v(this,"o",this.orbit);v(this,"room",t=>this.updateValue("room",t));v(this,"rm",this.room);v(this,"size",t=>this.updateValue("size",t));v(this,"sz",this.size);v(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});v(this,"update",()=>{const[t,r]=kg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.freq=ms(t)});v(this,"out",()=>{this.values.chord?this.values.chord.forEach(t=>{const r={...this.values};r.freq=t.freq,VO(r,.25,this.values.dur)}):VO(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 vm extends iR{constructor(t,r){super(r);v(this,"midiConnection");v(this,"chord",t=>(this.values.chord=t,this));v(this,"note",t=>(this.values.note=t,this));v(this,"sustain",t=>(this.values.sustain=t,this));v(this,"channel",t=>(this.values.channel=t,this));v(this,"port",t=>(this.values.port=this.midiConnection.getMidiOutputIndex(t),this));v(this,"add",t=>(this.values.note+=t,this));v(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});v(this,"bend",t=>(this.values.bend=t,this));v(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));v(this,"update",()=>{const[t,r]=kg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.note=t,this.values.freq=ms(t),r&&(this.values.bend=r)});v(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 zs=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,sR=new Set,Cm=typeof process=="object"&&process?process:{},oR=(n,e,t,r)=>{typeof Cm.emitWarning=="function"?Cm.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)};let gc=globalThis.AbortController,zO=globalThis.AbortSignal;var BT;if(typeof gc>"u"){zO=class{constructor(){v(this,"onabort");v(this,"_onabort",[]);v(this,"reason");v(this,"aborted",!1)}addEventListener(r,i){this._onabort.push(i)}},gc=class{constructor(){v(this,"signal",new zO);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=((BT=Cm.env)==null?void 0:BT.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{n&&(n=!1,oR("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=>!sR.has(n),Ri=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),lR=n=>Ri(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ll:null:null;class Ll extends Array{constructor(e){super(e),this.fill(0)}}var Ja;const aa=class aa{constructor(e,t){v(this,"heap");v(this,"length");if(!V(aa,Ja))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){const t=lR(e);if(!t)return[];Xe(aa,Ja,!0);const r=new aa(e,t);return Xe(aa,Ja,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};Ja=new WeakMap,lt(aa,Ja,!1);let ym=aa;var _n,Qr,Sn,On,es,Kt,En,jt,kt,at,Rr,qr,Sr,ir,bn,ar,ai,si,Tn,vn,ki,Ir,ko,Rm,pa,oi,Lo,Vr,bc,cR,ha,ts,Mo,Bn,Ii,Un,Ni,Po,Im,rs,Ml,ns,Pl,wt,Pt,Bo,Nm,fa,no;const zg=class zg{constructor(e){lt(this,ko);lt(this,bc);lt(this,Bn);lt(this,Un);lt(this,Po);lt(this,rs);lt(this,ns);lt(this,wt);lt(this,Bo);lt(this,fa);lt(this,_n,void 0);lt(this,Qr,void 0);lt(this,Sn,void 0);lt(this,On,void 0);lt(this,es,void 0);v(this,"ttl");v(this,"ttlResolution");v(this,"ttlAutopurge");v(this,"updateAgeOnGet");v(this,"updateAgeOnHas");v(this,"allowStale");v(this,"noDisposeOnSet");v(this,"noUpdateTTL");v(this,"maxEntrySize");v(this,"sizeCalculation");v(this,"noDeleteOnFetchRejection");v(this,"noDeleteOnStaleGet");v(this,"allowStaleOnFetchAbort");v(this,"allowStaleOnFetchRejection");v(this,"ignoreFetchAbort");lt(this,Kt,void 0);lt(this,En,void 0);lt(this,jt,void 0);lt(this,kt,void 0);lt(this,at,void 0);lt(this,Rr,void 0);lt(this,qr,void 0);lt(this,Sr,void 0);lt(this,ir,void 0);lt(this,bn,void 0);lt(this,ar,void 0);lt(this,ai,void 0);lt(this,si,void 0);lt(this,Tn,void 0);lt(this,vn,void 0);lt(this,ki,void 0);lt(this,Ir,void 0);lt(this,pa,()=>{});lt(this,oi,()=>{});lt(this,Lo,()=>{});lt(this,Vr,()=>!1);lt(this,ha,e=>{});lt(this,ts,(e,t,r)=>{});lt(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&&!Ri(t))throw new TypeError("max option must be a nonnegative integer");const S=t?lR(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,es,R),Xe(this,ki,!!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,ym.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&&!Ri(V(this,Qr)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ri(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");ze(this,bc,cR).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!Y,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Ri(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Ri(this.ttl))throw new TypeError("ttl must be a positive integer if specified");ze(this,ko,Rm).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)&&(sR.add(I),oR("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",I,zg))}}static unsafeExposeInternals(e){return{starts:V(e,si),ttls:V(e,Tn),sizes:V(e,ai),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 ze(r=e,wt,Pt).call(r,t)},backgroundFetch:(t,r,i,a)=>{var s;return ze(s=e,ns,Pl).call(s,t,r,i,a)},moveToTail:t=>{var r;return ze(r=e,fa,no).call(r,t)},indexes:t=>{var r;return ze(r=e,Bn,Ii).call(r,t)},rindexes:t=>{var r;return ze(r=e,Un,Ni).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,es)}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 ze(this,Bn,Ii).call(this))V(this,at)[e]!==void 0&&V(this,kt)[e]!==void 0&&!ze(this,wt,Pt).call(this,V(this,at)[e])&&(yield[V(this,kt)[e],V(this,at)[e]])}*rentries(){for(const e of ze(this,Un,Ni).call(this))V(this,at)[e]!==void 0&&V(this,kt)[e]!==void 0&&!ze(this,wt,Pt).call(this,V(this,at)[e])&&(yield[V(this,kt)[e],V(this,at)[e]])}*keys(){for(const e of ze(this,Bn,Ii).call(this)){const t=V(this,kt)[e];t!==void 0&&!ze(this,wt,Pt).call(this,V(this,at)[e])&&(yield t)}}*rkeys(){for(const e of ze(this,Un,Ni).call(this)){const t=V(this,kt)[e];t!==void 0&&!ze(this,wt,Pt).call(this,V(this,at)[e])&&(yield t)}}*values(){for(const e of ze(this,Bn,Ii).call(this))V(this,at)[e]!==void 0&&!ze(this,wt,Pt).call(this,V(this,at)[e])&&(yield V(this,at)[e])}*rvalues(){for(const e of ze(this,Un,Ni).call(this))V(this,at)[e]!==void 0&&!ze(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 ze(this,Bn,Ii).call(this)){const i=V(this,at)[r],a=ze(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 ze(this,Bn,Ii).call(this)){const i=V(this,at)[r],a=ze(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 ze(this,Un,Ni).call(this)){const i=V(this,at)[r],a=ze(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 ze(this,Un,Ni).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 ze(this,Bn,Ii).call(this,{allowStale:!0})){const r=V(this,kt)[t],i=V(this,at)[t],a=ze(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,si)){s.ttl=V(this,Tn)[t];const o=zs.now()-V(this,si)[t];s.start=Math.floor(Date.now()-o)}V(this,ai)&&(s.size=V(this,ai)[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=zs.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)?ze(this,rs,Ml).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),Xo(this,Kt)._++,V(this,ts).call(this,p,u,l),l&&(l.set="add"),c=!1;else{ze(this,fa,no).call(this,p);const k=V(this,at)[p];if(t!==k){if(V(this,ki)&&ze(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,ha).call(this,p),V(this,ts).call(this,p,u,l),V(this,at)[p]=t,l){l.set="replace";const Y=k&&ze(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)&&ze(this,ko,Rm).call(this),V(this,Tn)&&(c||V(this,Lo).call(this,p,i,a),l&&V(this,oi).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(ze(this,rs,Ml).call(this,!0),ze(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(ze(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,oi).call(this,i,a));else return r&&V(this,pa).call(this,a),i&&(i.has="hit",V(this,oi).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 ze(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,ki))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=ze(this,ns,Pl).call(this,e,h,Z,A);return E.__returned=E}else{const E=V(this,at)[h];if(ze(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"),ze(this,fa,no).call(this,h),i&&V(this,pa).call(this,h),k&&V(this,oi).call(this,k,h),E;const I=ze(this,ns,Pl).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=ze(this,wt,Pt).call(this,l);return s&&V(this,oi).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:(ze(this,fa,no).call(this,o),i&&V(this,pa).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,ha).call(this,o);const l=V(this,at)[o];ze(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]),Xo(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 ze(this,Un,Ni).call(this,{allowStale:!0})){const a=V(this,at)[i];if(ze(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,si)&&(V(this,Tn).fill(0),V(this,si).fill(0)),V(this,ai)&&V(this,ai).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,es=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,ai=new WeakMap,si=new WeakMap,Tn=new WeakMap,vn=new WeakMap,ki=new WeakMap,Ir=new WeakMap,ko=new WeakSet,Rm=function(){const e=new Ll(V(this,_n)),t=new Ll(V(this,_n));Xe(this,Tn,e),Xe(this,si,t),Xe(this,Lo,(a,s,o=zs.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,pa,a=>{t[a]=e[a]!==0?zs.now():0}),Xe(this,oi,(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=zs.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])},pa=new WeakMap,oi=new WeakMap,Lo=new WeakMap,Vr=new WeakMap,bc=new WeakSet,cR=function(){const e=new Ll(V(this,_n));Xe(this,En,0),Xe(this,ai,e),Xe(this,ha,t=>{Xe(this,En,V(this,En)-e[t]),e[t]=0}),Xe(this,Mo,(t,r,i,a)=>{if(ze(this,wt,Pt).call(this,r))return 0;if(!Ri(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(r,t),!Ri(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,ts,(t,r,i)=>{if(e[t]=r,V(this,Qr)){const a=V(this,Qr)-e[t];for(;V(this,En)>a;)ze(this,rs,Ml).call(this,!0)}Xe(this,En,V(this,En)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=V(this,En))})},ha=new WeakMap,ts=new WeakMap,Mo=new WeakMap,Bn=new WeakSet,Ii=function*({allowStale:e=this.allowStale}={}){if(V(this,Kt))for(let t=V(this,ir);!(!ze(this,Po,Im).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,Sr)));)t=V(this,qr)[t]},Un=new WeakSet,Ni=function*({allowStale:e=this.allowStale}={}){if(V(this,Kt))for(let t=V(this,Sr);!(!ze(this,Po,Im).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,ir)));)t=V(this,Rr)[t]},Po=new WeakSet,Im=function(e){return e!==void 0&&V(this,jt).get(V(this,kt)[e])===e},rs=new WeakSet,Ml=function(e){var a,s;const t=V(this,Sr),r=V(this,kt)[t],i=V(this,at)[t];return V(this,ki)&&ze(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,ha).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),Xo(this,Kt)._--,t},ns=new WeakSet,Pl=function(e,t,r,i){const a=t===void 0?void 0:V(this,at)[t];if(ze(this,wt,Pt).call(this,a))return a;const s=new gc,{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,es))==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,ki))return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof gc},Bo=new WeakSet,Nm=function(e,t){V(this,qr)[t]=e,V(this,Rr)[e]=t},fa=new WeakSet,no=function(e){e!==V(this,ir)&&(e===V(this,Sr)?Xe(this,Sr,V(this,Rr)[e]):ze(this,Bo,Nm).call(this,V(this,qr)[e],V(this,Rr)[e]),ze(this,Bo,Nm).call(this,V(this,ir),e),Xe(this,ir,e))};let Am=zg;const uo=class uo{constructor(){v(this,"_fallbackMethod",()=>uo.createSkipProxy());v(this,"out",()=>{})}};v(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 _c=uo;const po=class po extends Mg{constructor(t,r){super(r);v(this,"_fallbackMethod",()=>po.createRestProxy(this.values.length,this.app));v(this,"out",()=>{});this.values.length=t}};v(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 Sc=po;class S3 extends Mg{constructor(t,r,i){super(i);v(this,"input");v(this,"ziffers");v(this,"initCallTime",0);v(this,"startCallTime",0);v(this,"lastCallTime",0);v(this,"waitTime",0);v(this,"startBeat",0);v(this,"played",!1);v(this,"current");v(this,"retro",!1);v(this,"index",-1);v(this,"zid","");v(this,"options",{});v(this,"skipIndex",0);v(this,"endTime",0);v(this,"next",()=>(this.current=this.ziffers.next(),this.played=!0,this.current));v(this,"pulseToSecond",t=>this.app.clock.convertPulseToSecond(t));v(this,"firstRun",()=>this.notStarted());v(this,"atTheBeginning",()=>this.skipIndex===0&&this.ziffers.index<=0);v(this,"origin",()=>this.app.clock.pulses_since_origin+1);v(this,"pulse",()=>this.app.clock.time_position.pulse);v(this,"beat",()=>this.app.clock.time_position.beat);v(this,"nextBeat",()=>this.app.clock.next_beat_in_ticks);v(this,"nextBeatInTicks",()=>this.app.clock.next_beat_in_ticks);v(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});v(this,"lead",()=>this.voiceleading());v(this,"invert",t=>(this.atTheBeginning()&&this.ziffers.invert(t),this));v(this,"out",()=>{});this.app=i,this.input=t,this.options=r,this.ziffers=new xP(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 ui){const a=r.getExisting("freq","pitch","key","scale","octave","parsedScale");return a.dur=i,new Tm(a,this.app).sound(t)}else if(r instanceof ba){const a=r.pitches.map(s=>s.getExisting("freq","pitch","key","scale","octave","parsedScale"));return new Tm({dur:i},this.app).chord(a).sound(t)}else if(r instanceof Sm)return Sc.createRestProxy(r.duration,this.app)}else return _c.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 ui){const a=new vm(i,this.app);return t?a.note(t):a}else{if(r instanceof Sm)return Sc.createRestProxy(r.duration,this.app);if(r instanceof ba){const a=r.notes();return new vm(i,this.app).chord(a)}}}else return _c.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 uR({...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(){return n.z(this.valueOf())}};let xu;class uR{constructor(e){v(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(),xu&&clearTimeout(xu),xu=setTimeout(()=>{r.speak(i)},200)):r.speak(i)}else t("No text provided")}));this.options=e}}async function WO(){return Promise.all([KP(),qa("github:tidalcycles/Dirt-Samples/master").then(()=>d3()),g3(),qa("github:Bubobubobubobubo/Dough-Samples/main"),qa("github:Bubobubobubobubo/Dough-Amiga/main"),qa("github:Bubobubobubobubo/Dough-Waveforms/main")])}class b3{constructor(e){v(this,"variables",{});v(this,"codeExamples",{});v(this,"counters",{});v(this,"_drunk",new MP(-100,100,!1));v(this,"randomGen",Math.random);v(this,"currentSeed");v(this,"localSeeds",new Map);v(this,"patternCache",new Am({max:1e3,ttl:1e3*60*5}));v(this,"errorTimeoutID",0);v(this,"printTimeoutID",0);v(this,"MidiConnection",new LP);v(this,"load");v(this,"_loadUniverseFromInterface",e=>{this.app.loadUniverse(e),this.app.openBuffersModal()});v(this,"_deleteUniverseFromInterface",e=>{delete this.app.universes[e],this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});v(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()});v(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()});v(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,VM(this.app,e)});v(this,"_all_samples",()=>Pg.get());v(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)});v(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)});v(this,"time",()=>this.app.audioContext.currentTime);v(this,"play",()=>{this.app.setButtonHighlighting("play",!0),this.app.clock.start()});v(this,"pause",()=>{this.app.setButtonHighlighting("pause",!0),this.app.clock.pause()});v(this,"stop",()=>{this.app.setButtonHighlighting("stop",!0),this.app.clock.stop()});v(this,"silence",this.stop);v(this,"hush",this.stop);v(this,"warp",e=>{this.app.clock.tick=e,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e)});v(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)});v(this,"onmousemove",e=>{this.app._mouseX=e.pageX,this.app._mouseY=e.pageY});v(this,"mouseX",()=>this.app._mouseX);v(this,"mouseY",()=>this.app._mouseY);v(this,"noteX",()=>Math.floor(this.app._mouseX/document.body.clientWidth*127));v(this,"noteY",()=>Math.floor(this.app._mouseY/document.body.clientHeight*127));v(this,"script",(...e)=>{e.forEach(t=>{ja(this.app,this.app.universes[this.app.selected_universe].locals[t])})});v(this,"s",this.script);v(this,"clear_script",e=>{this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}});v(this,"cs",this.clear_script);v(this,"copy_script",(e,t)=>{this.app.universes[this.app.selected_universe].locals[t]=this.app.universes[this.app.selected_universe].locals[e]});v(this,"cps",this.copy_script);v(this,"midi_outputs",()=>{this._logMessage(this.MidiConnection.listMidiOutputs())});v(this,"midi_output",e=>{e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())});v(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 vm(e,this.app)));v(this,"sysex",e=>{this.MidiConnection.sendSysExMessage(e)});v(this,"pitch_bend",(e,t)=>{this.MidiConnection.sendPitchBend(e,t)});v(this,"program_change",(e,t)=>{this.MidiConnection.sendProgramChange(e,t)});v(this,"midi_clock",()=>{this.MidiConnection.sendMidiClock()});v(this,"control_change",({control:e=20,value:t=0,channel:r=0})=>{this.MidiConnection.sendMidiControlChange(e,t,r)});v(this,"midi_panic",()=>{this.MidiConnection.panic()});v(this,"generateCacheKey",(...e)=>e.map(t=>JSON.stringify(t)).join(","));v(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});v(this,"z0",(e,t={})=>this.z(e,t,0));v(this,"z1",(e,t={})=>this.z(e,t,1));v(this,"z2",(e,t={})=>this.z(e,t,2));v(this,"z3",(e,t={})=>this.z(e,t,3));v(this,"z4",(e,t={})=>this.z(e,t,4));v(this,"z5",(e,t={})=>this.z(e,t,5));v(this,"z6",(e,t={})=>this.z(e,t,6));v(this,"z7",(e,t={})=>this.z(e,t,7));v(this,"z8",(e,t={})=>this.z(e,t,8));v(this,"z9",(e,t={})=>this.z(e,t,9));v(this,"z10",(e,t={})=>this.z(e,t,10));v(this,"z11",(e,t={})=>this.z(e,t,11));v(this,"z12",(e,t={})=>this.z(e,t,12));v(this,"z13",(e,t={})=>this.z(e,t,13));v(this,"z14",(e,t={})=>this.z(e,t,14));v(this,"z15",(e,t={})=>this.z(e,t,15));v(this,"z16",(e,t={})=>this.z(e,t,16));v(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));v(this,"$",this.counter);v(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);v(this,"drunk",e=>e!==void 0?(this._drunk.position=e,this._drunk.getPosition()):(this._drunk.step(),this._drunk.getPosition()));v(this,"drunk_max",e=>{this._drunk.max=e});v(this,"drunk_min",e=>{this._drunk.min=e});v(this,"drunk_wrap",e=>{this._drunk.toggleWrap(e)});v(this,"variable",(e,t)=>typeof e=="string"&&t===void 0?this.variables[e]:(this.variables[e]=t,this.variables[e]));v(this,"v",this.variable);v(this,"delete_variable",e=>{delete this.variables[e]});v(this,"dv",this.delete_variable);v(this,"clear_variables",()=>{this.variables={}});v(this,"cv",this.clear_variables);v(this,"randI",(e,t)=>Math.floor(this.randomGen()*(t-e+1))+e);v(this,"rand",(e,t)=>this.randomGen()*(t-e)+e);v(this,"irand",this.randI);v(this,"rI",this.randI);v(this,"r",this.rand);v(this,"ir",this.randI);v(this,"seed",e=>{typeof e=="number"&&(e=e.toString()),this.currentSeed!==e&&(this.currentSeed=e,this.randomGen=_m(e))});v(this,"localSeededRandom",e=>{if(typeof e=="number"&&(e=e.toString()),this.localSeeds.has(e))return this.localSeeds.get(e);const t=_m(e);return this.localSeeds.set(e,t),t});v(this,"clearLocalSeed",(e=void 0)=>{e&&this.localSeeds.delete(e.toString()),this.localSeeds.clear()});v(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));v(this,"cmp",this.clamp);v(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));v(this,"tempo",this.bpm);v(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));v(this,"ppqn",e=>e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e));v(this,"time_signature",(e,t)=>{this.app.clock.time_signature=[e,t]});v(this,"prob",e=>this.randomGen()*100this.randomGen()>.5);v(this,"odds",(e,t=1)=>this.randomGen()!1);v(this,"almostNever",(e=1)=>this.randomGen()<.025*this.ppqn()/(this.ppqn()*e));v(this,"rarely",(e=1)=>this.randomGen()<.1*this.ppqn()/(this.ppqn()*e));v(this,"scarcely",(e=1)=>this.randomGen()<.25*this.ppqn()/(this.ppqn()*e));v(this,"sometimes",(e=1)=>this.randomGen()<.5*this.ppqn()/(this.ppqn()*e));v(this,"often",(e=1)=>this.randomGen()<.75*this.ppqn()/(this.ppqn()*e));v(this,"frequently",(e=1)=>this.randomGen()<.9*this.ppqn()/(this.ppqn()*e));v(this,"almostAlways",(e=1)=>this.randomGen()<.985*this.ppqn()/(this.ppqn()*e));v(this,"always",(e=1)=>!0);v(this,"dice",e=>Math.floor(this.randomGen()*e)+1);v(this,"cbar",()=>this.app.clock.time_position.bar+1);v(this,"ctick",()=>this.app.clock.tick+1);v(this,"cpulse",()=>this.app.clock.time_position.pulse+1);v(this,"cbeat",()=>this.app.clock.time_position.beat+1);v(this,"ebeat",()=>this.app.clock.beats_since_origin+1);v(this,"epulse",()=>this.app.clock.pulses_since_origin+1);v(this,"nominator",()=>this.app.clock.time_signature[0]);v(this,"meter",()=>this.app.clock.time_signature[1]);v(this,"denominator",this.meter);v(this,"beat",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%Math.floor(r*this.ppqn())===0).some(r=>r===!0));v(this,"pulse",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%r===0).some(r=>r===!0));v(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});v(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)});v(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)});v(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)});v(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)});v(this,"delay",(e,t)=>{setTimeout(t,e)});v(this,"delayr",(e,t,r)=>{[...Array(t).keys()].map(a=>e*a).forEach((a,s)=>{setTimeout(r,a)})});v(this,"euclid",(e,t,r,i=0)=>this._euclidean_cycle(t,r,i)[e%r]);v(this,"ec",this.euclid);v(this,"rhythm",(e,t,r,i=0)=>this.beat(e)&&this._euclidean_cycle(t,r,i).beat(e));v(this,"bin",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return i[e%i.length]});v(this,"binrhythm",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return this.beat(e)&&i.beat(e)});v(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);v(this,"usine",(e=1,t=0)=>(this.sine(e,t)+1)/2);v(this,"saw",(e=1,t=0)=>this.app.clock.ctx.currentTime*e%1*2-1+t);v(this,"usaw",(e=1,t=0)=>(this.saw(e,t)+1)/2);v(this,"triangle",(e=1,t=0)=>Math.abs(this.saw(e,t))*2-1);v(this,"utriangle",(e=1,t=0)=>(this.triangle(e,t)+1)/2);v(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);v(this,"noise",()=>this.randomGen()*2-1);v(this,"min",(...e)=>Math.min(...e));v(this,"max",(...e)=>Math.max(...e));v(this,"mean",(...e)=>e.reduce((r,i)=>r+i,0)/e.length);v(this,"limit",(e,t,r)=>Math.min(Math.max(e,t),r));v(this,"abs",Math.abs);v(this,"speak",(e,t="en-US",r=0,i=1,a=1)=>{new uR({text:e,lang:t,voice:r,rate:i,pitch:a}).speak().then(()=>{}).catch(o=>{console.log(o)})});v(this,"stop_hydra",()=>{this.app.hydra.hush()});v(this,"sound",e=>new Tm(e,this.app));v(this,"snd",this.sound);v(this,"samples",qa);v(this,"log",e=>{console.log(e),this._logMessage(e)});v(this,"scale",BP);v(this,"rate",e=>{});v(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]});v(this,"seqbeat",(...e)=>e[this.app.clock.time_position.beat%e.length]);v(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>1|(Mt&21845)<<1;yi=(yi&52428)>>2|(yi&13107)<<2,yi=(yi&61680)>>4|(yi&3855)<<4,xm[Mt]=((yi&65280)>>8|(yi&255)<<8)>>1}var zn=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},$i=new ur(288);for(var Mt=0;Mt<144;++Mt)$i[Mt]=8;for(var Mt=144;Mt<256;++Mt)$i[Mt]=9;for(var Mt=256;Mt<280;++Mt)$i[Mt]=7;for(var Mt=280;Mt<288;++Mt)$i[Mt]=8;var wo=new ur(32);for(var Mt=0;Mt<32;++Mt)wo[Mt]=5;var C3=zn($i,9,0),y3=zn($i,9,1),A3=zn(wo,5,0),R3=zn(wo,5,1),ku=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},Lu=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Yg=function(n){return(n+7)/8|0},Gg=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},$g=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,P=0;for(Y==16?(P=3+gn(n,u,3),u+=2,ee=x[L-1]):Y==17?(P=3+gn(n,u,7),u+=3):Y==18&&(P=11+gn(n,u,127),u+=7);P--;)x[L++]=ee}}var $=x.subarray(0,E),K=x.subarray(E);b=ku($),A=ku(K),m=zn($,b,1),_=zn(K,A,1)}else Mr(1);else{var Y=Yg(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){oe=u,m=null;break}else{var ke=Oe-254;if(Oe>264){var L=Oe-257,Me=Bc[L];ke=gn(n,u,(1<>4;Ee||Mr(3),u+=Ee&15;var K=v3[Ne];if(Ne>3){var Me=Uc[Ne];K+=Lu(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},Mu=function(n,e){for(var t=[],r=0;rm&&(m=a[r].s);var _=new Kr(m+1),b=km(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}},km=function(n,e,t){return n.s==-1?Math.max(km(n.l,e,t+1),km(n.r,e,t+1)):e[n.s]=t},ZO=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[wm[te-1]];--te);var ne=c+5<<3,re=Zs(i,$i)+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 mR(e,u,n.subarray(l,l+c));var P,$,K,X;if(ni(e,u,1+(ee15&&(ni(e,u,ke[x]>>5&127),u+=ke[x]>>12)}}else P=C3,$=$i,K=A3,X=wo;for(var x=0;x255){var Me=Ee>>18&31;Xs(e,u,P[Me+257]),u+=$[Me+257],Me>7&&(ni(e,u,Ee>>23&31),u+=Bc[Me]);var Ne=Ee&31;Xs(e,u,K[Ne]),u+=X[Ne],Ne>3&&(Xs(e,u,Ee>>5&8191),u+=Uc[Ne])}else Xs(e,u,P[Ee]),u+=$[Ee]}return Xs(e,u,P[256]),u+$[256]},N3=new Fg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gR=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)&&(P>423||!c)){u=KO(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 K=2,X=0,ce=_,oe=re-ee&32767;if(P>2&&ne==Z(w-oe))for(var Oe=Math.min(m,P)-1,ke=Math.min(32767,w),Me=Math.min(258,P);oe<=ke&&--ce&&re!=ee;){if(n[w+K]==n[w+K-oe]){for(var Ee=0;EeK){if(K=Ee,X=oe,Ee>Oe)break;for(var Ne=Math.min(oe,Ee-2),ue=0,$=0;$ue&&(ue=Ve,ee=De)}}}re=ee,ee=A[re],oe+=re-ee&32767}if(X){h[L++]=268435456|Dm[K]<<18|XO[X];var et=Dm[K]&31,nt=XO[X]&31;x+=Bc[et]+Uc[nt],++E[257+et],++S[nt],G=w+K,++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=mR(l,u+1,n.subarray(w,Ke))}a.i=s}return Gg(o,0,r+Yg(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)},Lm=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&&Lm(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 $g(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),Lm(i,a-8,t.d()),Lm(i,a-4,r),i}function G3(n,e){var t=M3(n);return t+8>n.length&&Mr(6,"invalid gzip data"),$g(n.subarray(t,-8),{i:2},e&&e.out||new ur(P3(n)),e&&e.dictionary)}function $3(n,e){return $g(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 Mm=typeof TextDecoder<"u"&&new TextDecoder,q3=0;try{Mm.decode(gR,{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:Gg(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 H3(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,P,$;do for(ne=0;ee=L.exec(h);)if(G.test(ee[0]))ne++||(re=L.lastIndex,P=re-ee[0].length);else if(ne&&!--ne){$=ee.index+ee[0].length;var K={left:{start:P,end:re},match:{start:re,end:ee.index},right:{start:ee.index,end:$},wholeMatch:{start:P,end:$}};if(te.push(K),!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 P in s)s.hasOwnProperty(P)&&(E[P]=s[P]);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(P,$){if($=$||null,r.helper.isString(P))if(P=r.helper.stdExtName(P),$=P,r.extensions[P]){console.warn("DEPRECATION WARNING: "+P+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),ne(r.extensions[P],P);return}else if(!r.helper.isUndefined(a[P]))P=a[P];else throw Error('Extension "'+P+'" could not be loaded. It was either not found or is not a valid extension.');typeof P=="function"&&(P=P()),r.helper.isArray(P)||(P=[P]);var K=c(P,$);if(!K.valid)throw Error(K.error);for(var X=0;X - +