0x8a367d0f…028dsent to0x9c9a9c84…bf56·#25,806,608·view on Etherscan
)continue;let Js=z(1.06,.76+Je(an)*.23+et*.05+At*f.flutter*.12+xn*sn*.16+ds[j]),Lo=Ke*Js,Za=$t+(Ke-Lo)/2,el=B[j]*fe+Za,tl=Y[j]*fe+Za;u.globalAlpha=js,u.fillStyle=`rgb(${Ks} ${Zs} ${Qs})`;let Qa=(b(Zt)*.5+et*.24)*an;Qa>.12?(u.shadowBlur=Qa*5*qn,u.shadowColor=Zt>=0?Ns:Fs):u.shadowBlur=0,Ha(u,el,tl,Lo,z(f.cornerSize*qn,Lo*.2))}u.globalAlpha=1,u.shadowBlur=0,Yn=n}let kr,So=0,Vn,vr=!1,Ao=-1/0,Gs=Number.isFinite(t.maxFps)&&t.maxFps>0?1e3/t.maxFps:0;function Ga(n){vr&&(kr??(kr=n),n-Ao>=Gs-1&&(Ao=n,_a(So+n-kr)),Vn=i.requestAnimationFrame(Ga))}let Mo=n=>{ce.set("token",$(n,ln,En)),s(new URLSearchParams(ce))},$a=n=>{ce.delete("progress"),n<0?ce.delete("stage"):ce.set("stage",Bn[n]),s(new URLSearchParams(ce))},za=n=>{pe=null,It=null,qt=1,Xn=null,bo=0,Ge=n,Ut=-1,wn=-2,bn="";let r=he[n<0?0:n];for(let p=0;p<q;p+=1)wt[p]=r[p]?1:0;$n.fill(0),zn.fill(0),Yn=void 0,n<0&&(kr=void 0,So=0)},$s=n=>{So=M(0,Number(n)||0),kr=void 0},zs=n=>{let r=n>=0&&n<he.length?n:-1,p=pe?.phase==="settle"?pe.stage:pe?.source??(Ge<0?xr:Ge),y=wo(he[p]);if(r<0){if(pe===null&&Ge<0)return;Rr(p,(p+1)%he.length,!0,y);return}pe===null&&Ge===r||Rr(p,r,!1,y)},Ys=(n,r)=>{let p=r<0,y=p?0:r>=0&&r<he.length?r:0,A=Er(n,he[y]);for(let R=0;R<q;R+=1)wt[R]=A[R]?1:0;$n.fill(0),zn.fill(0),Yn=void 0,Rr(y,y,p,A,void 0,!1,!0)},Xs=n=>{let r=pe?.phase==="settle"?pe.stage:pe?.source??(Ge<0?xr:Ge),p=wo(he[r]),y=Er(n,p);Rr(r,r,!1,p,y,!0,!0)},xo=i.location.origin==="null"?"*":i.location.origin,Eo=t.parentTarget||i.parent,Ya=()=>{_e?Eo.postMessage({type:"metamorphosis-select",tokenId:nt},xo):t.onSelect?t.onSelect(nt):Mo(nt+1)},Xa=n=>{if(_e){(n.key>="0"&&n.key<="3"||n.key==="ArrowRight"||n.key==="ArrowLeft")&&Eo.postMessage({type:"metamorphosis-key",key:n.key,tokenId:nt},xo);return}n.key==="ArrowRight"&&Mo(nt+1),n.key==="ArrowLeft"&&Mo(nt-1),n.key>="1"&&n.key<="3"&&$a(parseInt(n.key,10)-1),n.key==="0"&&$a(-1)},Va=n=>{if(n.origin!==i.location.origin||n.data?.type!=="metamorphosis-stage")return;let r=parseInt(n.data.stage,10);za(r>=0&&r<he.length?r:-1)};e.addEventListener("click",Ya),t.keyboard!==!1&&i.addEventListener("keydown",Xa),_e&&i.addEventListener("message",Va);let qa=Ra(Ds),ja=()=>{Dt||vr||(vr=!0,Ao=-1/0,Vn=i.requestAnimationFrame(Ga))},Ka=()=>{vr=!1,Vn!==void 0&&(i.cancelAnimationFrame(Vn),Vn=void 0)},Ro=Object.freeze({version:Fr,size:d,maxTokenId:En,mintData:mt,genome:f,states:he,stageMetrics:ot,phenotypeTraits:Vt,transitionMode:Ze,validatedMotion:st,motionTraits:ho,cellLifeProfile:us,echoMode:Rt,echoName:oo,transitions:_n,kineticPhrases:lt,metadata:qa,render:_a,snapshot:()=>Uint8Array.from(wo(he[xr]),Number),resize:Se,setStage:za,setClock:$s,transitionToStage:zs,transitionFromState:Ys,transitionToState:Xs,start:ja,stop:Ka,destroy:()=>{Ka(),e.removeEventListener("click",Ya),i.removeEventListener("resize",Se),i.removeEventListener("keydown",Xa),i.removeEventListener("message",Va),i.metamorphosis===Ro&&delete i.metamorphosis},get stage(){return Ge<0?null:Bn[Ge]}});return t.exposeGlobal!==!1&&(i.metamorphosis=Ro),_e&&Eo.postMessage({type:"metamorphosis-ready",analysis:Dt,...qa},xo),ja(),Ro}var qe=`0x${"0".repeat(64)}`,ll=Object.freeze(["caterpillar","pupa","butterfly"]),cl=new Set(["unawakened","dormant",...ll,"cycle","metamorphosis","full-lifecycle","proof","current"]);function Rn(t){if(!t||typeof t!="object")throw new TypeError("genome adapter requires the complete tuple");let e=Number(t.tokenId);if(!Number.isSafeInteger(e)||e<1||e>1e4)throw new RangeError("tokenId must be an integer in 1..10000");let o=No(t.lineageSeed,"lineageSeed"),i=No(t.pupaSeed,"pupaSeed"),u=No(t.finalSeed,"finalSeed");if(o===qe&&i!==qe)throw new TypeError("pupaSeed cannot exist before lineageSeed");if(i===qe&&u!==qe)throw new TypeError("finalSeed cannot exist before pupaSeed");return Object.freeze({tokenId:e,lineageSeed:o,pupaSeed:i,finalSeed:u})}function Fo(t){let e=Rn(t);if(e.lineageSeed===qe)return Object.freeze(["unawakened"]);let o=["dormant","caterpillar"];return e.pupaSeed!==qe&&o.push("pupa"),e.finalSeed!==qe&&o.push("butterfly"),Object.freeze(o)}function Io(t,e){let o=String(e).toLowerCase();if(!cl.has(o))return!1;let i=Fo(t);return o==="current"?!0:o==="cycle"||o==="metamorphosis"||o==="full-lifecycle"||o==="proof"?i.includes("butterfly"):i.includes(o)}function Oo(t){return Fo(t).at(-1)}function No(t,e){let o=String(t??"").toLowerCase();if(!/^0x[0-9a-f]{64}$/.test(o))throw new TypeError(`${e} must be exactly 32 bytes`);return o}var dl=document.documentElement,Bt=dl.dataset,Qt=Object.freeze({collectionSize:1,slotScoped:!0,families:[{id:+Bt.catalogFamilyId,name:Bt.catalogFamilyName,rarity:Bt.catalogFamilyRarity,pupaHeight:+Bt.catalogPupaHeight,prototypeCount:+Bt.catalogPrototypeCount,diversity:+Bt.catalogDiversity,slotStart:0,targetCount:1,prototypeOffset:0}],recipes:Bt.catalogRecipes,variants:Bt.catalogVariants,caterpillars:Bt.catalogCaterpillars,pupae:Bt.catalogPupae});var fl=[[1,1,1,1],[1,.95,.76,1.16],[1.16,.86,.76,.82],[.88,1.06,1.16,1.16],[1.16,1.12,.7,.82],[1,1,1,1],[.84,1.18,.82,1.12],[1.18,.72,1.15,.72],[.88,.9,.95,.9],[1.04,1,1,1]];function ii(t,e){let o=Array(961).fill(!1),i=t.style,u=t.pattern,l=pl(Math.round(t.bodyLength*.8+e*.2),8,26),m=t.wingSpan,w=t.upperY,a=t.upperWidth,s=t.upperHeight,c=t.lowerY,d=t.lowerWidth,h=t.lowerHeight,C=t.wingLobes,b=t.upperX,H=t.lowerX,[x,Z,T,K]=fl[i];t.architecture===1?(x*=1.12,T*=.86):t.architecture===2?(x*=.86,T*=1.16):t.architecture===3?(x*=.82,T*=.78,Z*=1.22,K*=1.18):t.architecture===4?(x*=1.16,T*=1.12,Z*=.86,K*=.9):t.architecture===5?(Z*=1.18,K*=.82):t.architecture===6?(x*=1.08,K*=1.15):t.architecture===7&&(Z*=1.12,K*=1.12);for(let k=1;k<30;k+=1)for(let ne=1;ne<=m;ne+=1){let Q=1+t.lobeDepth*Math.cos((k-w)/s*C*Math.PI+i),g=1+t.lobeDepth*Math.sin((k-c)/h*C*Math.PI+i*.7),q=Math.abs((ne-m*b)/(m*a*x*Q))**t.upperExponent+Math.abs((k-w)/(s*Z))**t.upperExponent,ye=Math.abs((ne-m*H)/(m*d*T*g))**t.lowerExponent+Math.abs((k-c)/(h*K))**t.lowerExponent,Ae=q<=1,Te=ye<=1,B=(w+c)/2,Y=ne>m*(.74-t.wingNotch*.3)&&Math.abs(k-B)<t.wingNotch*(i===6?3.2:2.5),Ve=Math.abs(k-(w+.7+t.veinSlope*(ne-1)))<.58,Me=Math.abs(k-(c-.7-t.veinSlope*(ne-1)))<.58,De=Ae&&q>.76||Te&&ye>.76,we=Math.max(2,Math.round(7/t.wingBands)),Fe=(k+Math.round(ne*(t.veinSlope+1.25))+i)%we===0,be=ml(Cn(15-ne,k),79,17,t.noise),Pe=(k+ne+i)%2===0,Se=Ae&&q>.22&&q<.52||Te&&ye>.2&&ye<.5,$=Ae&&q>.06&&q<.18||Te&&ye>.05&&ye<.16,We=m*(.46+i%3*.08),Je=w+(i%2?.7:-.35),le=Math.hypot((ne-We)/1.7,(k-Je)/1.4)<1,ce=ne===1||Ve||Me,_e=ce||De||be>t.wingHoles;u===1||i===5?_e=ce||De||Se:u===2?_e=ce||De||Se||$:u===3?_e=ce||De||Fe:u===4?_e=ce||De||Pe:u===5?_e=ce||De||Se&&Pe:u===6?_e=ce||De||!le&&be>t.wingHoles*.72:u===7?_e=ce||De||(Ae?be>.3:Fe):u===8?_e=ce||De||(Te?be>.3:Se):u===9&&(_e=ce||De||be>.7),(Ae||Te)&&!Y&&_e&&(Yt(o,15-ne,k),Yt(o,15+ne,k))}let M=Math.round(15-(l-1)/2),z=M+l-1;for(let k=M;k<=z;k+=1)Yt(o,15,k),t.bodyWidth&&k>M+2&&k<z-2&&(k+i)%2===0&&(Yt(o,14,k),Yt(o,16,k));for(let k=1;k<=t.antennaLength;k+=1){let ne=M-k,Q=1+Math.floor(k*.72);Yt(o,15-Q,ne),Yt(o,15+Q,ne)}let ee=Math.max(2,Math.round(m*(i===1?.62:i===3?.38:.5)));for(let k of[-1,1]){let ne=15+k*ee,Q=Math.min(29,z);for(;Q>M&&!o[Cn(ne,Q)];)Q-=1;let g=t.tailLength+(i===1||i===3?2:0)+(t.mutation===3?2:0);for(let q=1;q<=g;q+=1){let ye=i===3?Math.floor(q/3)*k:0;Yt(o,ne+ye,Q+q)}}return hl(o)}function hl(t){let e=ai(t),o=31,i=31,u=-1,l=-1;if(e.forEach((s,c)=>{if(s){let d=c%31,h=Math.floor(c/31);o=Math.min(o,d),u=Math.max(u,d),i=Math.min(i,h),l=Math.max(l,h)}}),u<0)return e;let m=Math.round(15-(o+u)/2),w=Math.round(15-(i+l)/2),a=Array(961).fill(!1);return e.forEach((s,c)=>{s&&Yt(a,c%31+m,Math.floor(c/31)+w)}),a[Cn(15,15)]=!0,ai(a)}function ai(t){let e=Array(961).fill(!1),o=[Cn(15,15)];for(e[o[0]]=!0;o.length;){let i=o.pop(),u=i%31,l=Math.floor(i/31);for(let m=-1;m<=1;m+=1)for(let w=-1;w<=1;w+=1){let a=u+w,s=l+m;if((w||m)&&a>=0&&a<31&&s>=0&&s<31){let c=Cn(a,s);t[c]&&!e[c]&&(e[c]=!0,o.push(c))}}}return t.map((i,u)=>i&&e[u])}function Yt(t,e,o){e>=1&&e<30&&o>=1&&o<30&&(t[Cn(e,o)]=!0)}function Cn(t,e){return e*31+t}function pl(t,e=0,o=1){return Math.min(o,Math.max(e,t))}function ml(t,e,o,i){let u=Math.sin((t+17.31)*127.1+e*311.7+o*91.9+i*.731)*43758.5453;return u-Math.floor(u)}var li=["style","pattern","wingSpan","upperX","upperWidth","upperY","upperHeight","upperExponent","lowerX","lowerWidth","lowerY","lowerHeight","lowerExponent","wingHoles","wingNotch","veinSlope","wingLobes","lobeDepth","wingBands","bodyLength","bodyWidth","tailLength","antennaLength","mutation","architecture","noise"],ci=new Set(["upperX","upperWidth","upperY","upperHeight","upperExponent","lowerX","lowerWidth","lowerY","lowerHeight","lowerExponent","wingHoles","wingNotch","veinSlope","lobeDepth"]),gl=new Set([0,1,20,24]),cn=Br(Qt.recipes),yl=Br(Qt.variants),bl=Br(Qt.caterpillars),wl=Br(Qt.pupae),tr=Ur(cn),Sl=Ur(yl),Al=Ur(bl),Ml=Ur(wl),xl=Qt.families??El(),Bo=Qt.slotScoped===!0;function ui(t){let e=nr(t);if(e===null)throw new RangeError("Invalid art seed");return e}function nr(t){if(Bo)return 0;let e=String(t).replace(/^0x/,"").padStart(64,"0"),o=Number.parseInt(e.slice(0,4),16);return o<1||o>Qt.collectionSize?null:o-1}function Uo(t,e){let o=ui(t),i=e==="caterpillar"?Al:Ml,u=e==="caterpillar"?2e6:3e6,l=i.getUint16((Bo?0:o)*2),m=u+l;return{genome:kl(m),tokenId:(l-1)%1e4+1,slot:o}}function di(t){let e=ui(t),o=xl.find(w=>e>=w.slotStart&&e<w.slotStart+w.targetCount);if(!o)throw new RangeError("Art slot is outside the family catalog");let i=Sl.getUint16((Bo?0:e)*2),u=Array.from({length:o.prototypeCount},(w,a)=>Cl(o.prototypeOffset+a*56)),l=Rl(o,u,i),m=Uint8Array.from(ii(l,o.pupaHeight),Number);return{slot:e,family:o,nonce:i,genome:l,mask:m,metrics:vl(m)}}function El(){let t=["Common","Uncommon","Rare","Very rare","Exceptional","Unique"];return Array.from({length:42},(e,o)=>{let i=o*32,u="";for(let l=0;l<16&&cn[i+l];l+=1)u+=String.fromCharCode(cn[i+l]);return{id:o,name:u,rarity:t[cn[i+16]],pupaHeight:cn[i+17],prototypeCount:cn[i+18],diversity:cn[i+19],slotStart:tr.getUint16(i+20),targetCount:tr.getUint16(i+22),prototypeOffset:tr.getUint16(i+24)}})}function Rl(t,e,o){if(e.length===1)return{...e[0]};let i=Pl(Ll(t.id,o)),u=e.length,l=e[Jt(i)%u],m=e[Jt(i)%u],w=e[Jt(i)%u],a=e[Jt(i)%u],s=Jt(i)%1001,c=Number(Jt(i)%2001)-1e3,d=Jt(i)&1,h={};for(let C=0;C<25;C+=1){let b=li[C],H=Or(b,l[b]),x=Or(b,m[b]),Z=Or(b,w[b]),T=Or(b,a[b]),K=gl.has(C)?d?x:H:H+si((x-H)*s,1e3)+si((Z-T)*c*t.diversity*17,1e7);h[b]=fi(b,K)}return h.noise=Jt(i)|0,h}function Cl(t){let e={};for(let o=0;o<25;o+=1){let i=li[o];e[i]=fi(i,tr.getInt16(t+o*2))}return e.noise=tr.getInt32(t+50),e}function kl(t){let e=(t^2654435769)>>>0,o="0x";for(let i=0;i<8;i+=1)e=Tl(e+Math.imul(i,1831565813)>>>0),o+=e.toString(16).padStart(8,"0");return o}function vl(t){let e=0,o=31,i=31,u=-1,l=-1,m=0,w=0;for(let h=0;h<t.length;h+=1){let C=h%31,b=Math.floor(h/31);if(t[h]){e+=1,o=Math.min(o,C),i=Math.min(i,b),u=Math.max(u,C),l=Math.max(l,b);for(let[H,x]of[[-1,0],[1,0],[0,-1],[0,1]]){let Z=C+H,T=b+x;(Z<0||Z>=31||T<0||T>=31||!t[T*31+Z])&&(m+=1)}}else{let H=0;for(let x=-1;x<=1;x+=1)for(let Z=-1;Z<=1;Z+=1){let T=C+Z,K=b+x;(Z||x)&&T>=0&&T<31&&K>=0&&K<31&&t[K*31+T]&&(H+=1)}H>=6&&(w+=1)}}let a=u-o+1,s=l-i+1,c=[];for(let h=i;h<=l;h+=1){let C=0;for(let b=0;b<31;b+=1)t[h*31+b]&&(C+=1);c.push(C)}let d=c.reduce((h,C,b)=>h+(b?Math.abs(C-c[b-1]):0),0);return{active:e,width:a,height:s,aspect:a/s,density:e/(a*s),perimeter:m,voids:w,rowVariation:d}}function Ll(t,e){let o=new Uint8Array(22),i=new DataView(o.buffer);return i.setUint16(0,t),i.setUint16(2,e),new TextEncoder().encode("morphogen-variant").forEach((u,l)=>{o[4+l]=u}),o}function Pl(t){let e=1779033703,o=3144134277,i=1013904242,u=2773480762;for(let l of t){let m=(o^Math.imul(e^l,597399067))>>>0,w=(i^Math.imul(o^l,2869860233))>>>0,a=(u^Math.imul(i^l,951274213))>>>0,s=(m^Math.imul(u^l,2716044179))>>>0;e=m,o=w,i=a,u=s}return e=Math.imul(i^e>>>18,597399067)>>>0,o=Math.imul(u^o>>>22,2869860233)>>>0,i=Math.imul(e^i>>>17,951274213)>>>0,u=Math.imul(o^u>>>19,2716044179)>>>0,{a:(e^o^i^u)>>>0,b:(o^e)>>>0,c:(i^e)>>>0,d:(u^e)>>>0}}function Jt(t){let e=t.a+t.b+t.d>>>0;return t.d=t.d+1>>>0,t.a=(t.b^t.b>>>9)>>>0,t.b=t.c+(t.c<<3)>>>0,t.c=(t.c<<21|t.c>>>11)+e>>>0,e}function Tl(t){let e=t>>>0;return e^=e>>>16,e=Math.imul(e,2146121005),e^=e>>>15,e=Math.imul(e,2221713035),e^=e>>>16,e>>>0}function Or(t,e){return t==="noise"?Number(e)|0:Math.round(Number(e)*(ci.has(t)?100:1))}function fi(t,e){return e/(ci.has(t)?100:1)}function si(t,e){return t<0?Math.ceil(t/e):Math.floor(t/e)}function Br(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function Ur(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}var Hr=se,Dl=Jn;var Wo=["caterpillar","pupa","butterfly"],rr=new Map,Nl=512,or=new Map,Fl=32;function ar(t,e=gi(t)){let o=Math.max(1,Math.min(1e4,Math.trunc(e))),i=`${o}:${t.toLowerCase()}`,u=rr.get(i);if(u)return u;let l=Qn(t,o,!0),m=yi(),w=er({canvas:m.canvas,rootElement:m.root,surfaceElement:m.surface,search:l,keyboard:!1,updateTitle:!1,exposeGlobal:!1,generateOnly:!0}),a=w,s=w.metadata,c=Object.fromEntries(Wo.map((b,H)=>[b,w.stageMetrics[H]])),d=Object.fromEntries(Wo.map((b,H)=>[b,Uint8Array.from(w.states[H]??[],Number)])),h=c.butterfly,C={genome:t,tokenId:o,cellCornerSize:a.genome.cornerSize,motion:s.motion,search:l,palette:{name:s.palette,background:s.colors.background,dormant:Ho(s.colors.resting),active:Ho(s.colors.resting),secondary:Ho(s.colors.birth)},traits:{...s.construction,rarity:Il(s.rarity),palette:s.palette,temperament:s.motion?.temperament??"Quiescent",cadence:s.cadence,completionPulse:s.completionPulse,symmetry:"Bilateral",complexity:Math.round(h.active+h.perimeter*.5+h.voids*3+h.rowVariation),butterflyCells:h.active,span:h.width,density:Math.round(h.density*100),caterpillarProfile:s.phenotype.caterpillar.profile,pupaProfile:s.phenotype.pupa.profile,butterflySurface:s.phenotype.butterfly.surface},masks:d,metrics:c,metadata:s};return rr.set(i,C),rr.size>Nl&&rr.delete(rr.keys().next().value),C}function hi(t){let e=Rn(t);if(e.lineageSeed===qe)return null;let o=nr(e.lineageSeed)!==null&&(e.pupaSeed===qe||nr(e.pupaSeed)!==null)&&(e.finalSeed===qe||nr(e.finalSeed)!==null),i=o?Uo(e.lineageSeed,"caterpillar"):null,u=i?ar(i.genome,i.tokenId):ar(e.lineageSeed,e.tokenId),l=e.pupaSeed===qe?null:o?(()=>{let h=Uo(e.pupaSeed,"pupa");return ar(h.genome,h.tokenId)})():ar(e.pupaSeed,e.tokenId),m=e.finalSeed===qe?null:ar(e.finalSeed,e.tokenId),w=l??u,a=m??w,s=e.finalSeed===qe||!o?null:di(e.finalSeed),c=s?.mask??a.masks.butterfly,d=s?.metrics??a.metrics.butterfly;return{...a,genome:e.lineageSeed,cellCornerSize:u.cellCornerSize,motion:u.motion,search:u.search,palette:u.palette,traits:{...u.traits,...s?{family:s.family.name,rarity:s.family.rarity}:{},chrysalis:w.traits.chrysalis,casing:w.traits.casing,adornment:w.traits.adornment,wingform:s?.family.name??a.traits.wingform,markings:s?`Variant ${s.nonce}`:a.traits.markings,complexity:Math.round(d.active+d.perimeter*.5+d.voids*3+d.rowVariation),butterflyCells:d.active,span:d.width,density:Math.round(d.density*100),completionPulse:u.traits.completionPulse},masks:{caterpillar:u.masks.caterpillar,pupa:w.masks.pupa,butterfly:c},metrics:{caterpillar:u.metrics.caterpillar,pupa:w.metrics.pupa,butterfly:d},metadata:{...a.metadata,palette:u.metadata.palette,cadence:u.metadata.cadence,completionPulse:u.metadata.completionPulse,colors:u.metadata.colors,motion:u.metadata.motion,construction:{silhouette:u.traits.silhouette,cuticle:u.traits.cuticle,appendages:u.traits.appendages,chrysalis:w.traits.chrysalis,casing:w.traits.casing,adornment:w.traits.adornment,wingform:s?.family.name??a.traits.wingform,markings:s?`Variant ${s.nonce}`:a.traits.markings},phenotype:{caterpillar:u.metadata.phenotype.caterpillar,pupa:w.metadata.phenotype.pupa,butterfly:a.metadata.phenotype.butterfly}}}}function kn(t,e=gi(t),o="morphogenesis",i){let u=Math.max(1,Math.min(1e4,Math.trunc(e))),l=mi(i),m=`${o}:${l??"auto"}:${u}:${t.toLowerCase()}`,w=or.get(m);if(w)return w;let a=yi(),s=er({canvas:a.canvas,rootElement:a.root,surfaceElement:a.surface,search:pi(Qn(t,u,!0),o,l),keyboard:!1,updateTitle:!1,exposeGlobal:!1}),c=s,d={transitions:c.transitions.map(h=>h.map(C=>Uint8Array.from(C,Number))),generationCount:c.genome.generationCount,holdDuration:c.genome.hold,transitionDuration:c.genome.transition,pulseRate:c.genome.pulseRate,pulseDepth:c.genome.pulseDepth,stagger:c.genome.stagger,trail:c.genome.trail,flutter:c.genome.flutter,direction:c.genome.kineticDirection,phase:c.genome.kineticPhase,cornerSize:c.genome.cornerSize,echoMode:c.echoMode,echoName:c.echoName,motion:c.metadata.motion};return s.destroy(),or.set(m,d),or.size>Fl&&or.delete(or.keys().next().value),d}function vn(t,e,o,i="morphogenesis",u,l){let m=mi(u);return er({canvas:t,rootElement:t,surfaceElement:t,search:pi(e.search.replace("&analysis=1",""),i,m),keyboard:!1,updateTitle:!1,exposeGlobal:!1,lifecycleStates:Wo.map(a=>e.masks[a]),...l,onSelect:()=>{},...o?{onStageChange:o}:{}})}function pi(t,e,o){let i=new URLSearchParams(t.startsWith("?")?t.slice(1):t);return e==="legacy"?i.set("transition","validated"):i.delete("transition"),o!==void 0&&i.set("echo",String(o)),`?${i}`}function mi(t){if(!Number.isFinite(t))return;let e=Math.trunc(t);return e>=0&&e<Dl.length?e:void 0}function gi(t){let e=t.slice(-8)||"0";return Number.parseInt(e,16)%1e4+1}function Il(t){return["Common","Uncommon","Rare","Relic","Mythic","Apotheosis","Genesis"].includes(t)?t:"Common"}function Ho(t){return`rgb(${t.join(" ")})`}function yi(){class t{beginPath(){}clearRect(){}drawImage(){}fill(){}roundRect(){}setTransform(){}}class e{constructor(w){ae(this,"ownerDocument");ae(this,"classList",{toggle(){}});ae(this,"dataset",{});ae(this,"style",{});this.ownerDocument=w}addEventListener(){}removeEventListener(){}setAttribute(){}getBoundingClientRect(){return{width:360}}getContext(){return new t}}let i={defaultView:{devicePixelRatio:1,location:{origin:"http://127.0.0.1:3000",search:""},parent:{postMessage(){}},addEventListener(){},removeEventListener(){},requestAnimationFrame(){return 1},cancelAnimationFrame(){}},title:""},u=new e(i),l=new e(i);return i.documentElement=u,i.body=l,i.createElement=()=>new e(i),{canvas:new e(i),root:u,surface:l}}var _r=100,_o=6,en=se*se,Wr=Math.floor(se/2),Xt=2,Ol=310,Bl=540,Ul=118;function Gr(t){return{seed:t>>>0,generation:0,layers:Array.from({length:_o},(e,o)=>Hl(t,o))}}function ir(t){let e=t.generation;return{seed:t.seed,generation:e+1,layers:t.layers.map((o,i)=>(i+e)%_o===0?Wl(o,t.seed,i,e):o)}}function dn(t){return Gl(t.layers,t.seed,t.generation)}function Go(t,e){let o=Gr(t),i=Math.max(0,Math.trunc(e));for(;o.generation<i;)o=ir(o);return dn(o)}function bi(t,e=se){if(t.length!==e*e)throw new RangeError("Conway state does not match its grid size");let o=new Uint8Array(t.length);for(let i=0;i<t.length;i+=1){let u=i%e,l=Math.floor(i/e),m=0;for(let a=-1;a<=1;a+=1)for(let s=-1;s<=1;s+=1){if(s===0&&a===0)continue;let c=(u+s+e)%e,d=(l+a+e)%e;m+=t[d*e+c]}let w=t[i]===1;o[i]=m===3||w&&m===2?1:0}return o}function Hl(t,e){let o=new Uint8Array(en),i=un(t^Math.imul(e+1,2654435769));for(let u=0;u<en;u+=1){let l=u%se,m=Math.floor(u/se);if(!$r(l,m))continue;let w=(l-Wr)/Math.max(1,Wr-Xt),a=(m-Wr)/Math.max(1,Wr-Xt),s=.68+Math.exp(-(w*w*1.4+a*a*1.15)*1.8)*.32,c=(.255+((i>>>24)/255-.5)*.035)*s,d=un(i+Math.imul(u+1,2246822507))/4294967295;o[u]=d<c?1:0}return o}function Wl(t,e,o,i){let u=bi(t);zl(u);let l=Yl(t,u),m=wi(u),w=un(e^Math.imul(o+1,2135587861)),a=Math.max(0,Ul+(w&15)-m),s=Si(Math.ceil(a/9)+(l<28?5:1),1,14);for(let c=0;c<s;c+=1)_l(u,w,i,c);return u}function _l(t,e,o,i){let u=un(e+Math.imul(o+1,2654435769)+Math.imul(i+1,2246822507)),l=un(u^3266489909),m=se-Xt*2,w=Xt+u%m,a=Xt+l%m,s=u>>>28&3,c=[[0,0],[1,0],[-1,1],[0,1],[0,2]];for(let[d,h]of c){let C=d,b=h;for(let Z=0;Z<s;Z+=1)[C,b]=[-b,C];let H=w+C,x=a+b;$r(H,x)&&(t[x*se+H]=1)}}function Gl(t,e,o){let i=new Uint8Array(en);for(let m=0;m<en;m+=1){let w=0;for(let a of t)w^=a[m];i[m]=w}let u=390+e%61,l=Math.round(Si(u+Math.sin(o*.17+(e&255)/255*Math.PI*2)*18,Ol,Bl));return $l(i,t,e,o,l),i}function $l(t,e,o,i,u){let l=wi(t),m=un(o+Math.imul(i+1,374761393))%en,w=37+un(o^i)%23*2;for(let a=0;a<en*2&&l!==u;a+=1){let s=(m+a*w)%en,c=s%se,d=Math.floor(s/se);if($r(c,d))if(l<u){if(t[s]||!e.some(h=>h[s]))continue;t[s]=1,l+=1}else{if(!t[s])continue;t[s]=0,l-=1}}}function zl(t){for(let e=0;e<en;e+=1){let o=e%se,i=Math.floor(e/se);$r(o,i)||(t[e]=0)}}function $r(t,e){return t>=Xt&&t<se-Xt&&e>=Xt&&e<se-Xt}function wi(t){let e=0;for(let o of t)e+=o;return e}function Yl(t,e){let o=0;for(let i=0;i<t.length;i+=1)o+=t[i]===e[i]?0:1;return o}function un(t){let e=t>>>0;return e^=e>>>16,e=Math.imul(e,2146121005),e^=e>>>15,e=Math.imul(e,2221713035),(e^e>>>16)>>>0}function Si(t,e,o){return Math.max(e,Math.min(o,t))}var zo="#e8e8e8",Yo="#0a0a0a",Ai=_r;var He=se*se,tn=Math.floor(se/2),Xl=38,Vl=3,ql=32,Yr=Xl*Vl,sr=new Map;function Tn(t,e,o,i={background:zo,cell:Yo},u={}){let l=t.getContext("2d");if(!l)throw new Error("The dormant renderer requires a 2D canvas context");let m=Ql(e,o),w=Float32Array.from(m.frames[0],Number),a=new Float32Array(He),s=new Float32Array(He),c=0,d,h=0,C,b=!1,H=m.frames[0].slice(),x=null,Z=null,T={...i},K=-1/0,M=u.maxFps&&u.maxFps>0?1e3/u.maxFps:0,z=jl($o(e,o,73)),ee=Kl($o(e,o,131)),k=B=>{c=Math.max(0,B);let Y=c/Ai,Ve=Math.floor(Y),Me=Ln(Ve),De=Y-Ve;if(x?.mode==="field"&&x.fieldTargetProvider){let $=x.fieldTargetProvider();x.board=fn($.state,x.board),x.fieldTargetLight=zr($.light)}if(x?.fieldSourceProvider){let $=x.fieldSourceProvider();x.mode==="field"?x.sourceBoard=fn($.state,x.sourceBoard):x.fieldBoard=fn($.state,x.fieldBoard??x.sourceBoard),x.fieldSourceLight=zr($.light)}let we=x?hn((c-x.startedAt)/x.duration):1,Fe=$=>{let We=x?.fieldBoard??Z??$;return x?Zl(We,x,z,we):We};H=Fe(m.frames[Ln(Me+(De>=.5?1:0))]).slice();let be=d===void 0?0:Math.abs(c-d),Pe=d===void 0||be>250,Se=Pe?1/60:Math.min(be/1e3,.05);ec(t,l,Fe(m.frames[Ln(Me-1)]),Fe(m.frames[Me]),Fe(m.frames[Ln(Me+1)]),Fe(m.frames[Ln(Me+2)]),De,Me,c,Se,Pe,w,a,m,ee,T,x,we,z,s),x&&we>=1&&(Z=x.mode==="from"?x.fieldBoard?.slice()??null:x.board.slice(),x=null),d=c},ne=()=>{let B=Math.max(1,t.getBoundingClientRect().width),Y=Math.min(window.devicePixelRatio||1,u.maxPixelRatio??2);t.width=Math.round(B*Y),t.height=Math.round(B*Y),d=void 0,k(c)},Q=B=>{b&&(h===0&&(h=B-c),B-K>=M-1&&(K=B,k(B-h)),C=window.requestAnimationFrame(Q))},g=()=>{b||(b=!0,h=0,K=-1/0,C=window.requestAnimationFrame(Q))},q=()=>{b=!1,C!==void 0&&window.cancelAnimationFrame(C),C=void 0},ye=(B,Y,Ve,Me,De,we,Fe=!1)=>{Me&&(T=Me);let be=fn(Y,H),Pe=we?fn(we,m.frames[0]):null,Se=x,$=Se?Se.handoffDepth+1:0,We=Uint8Array.from(w,Ze=>Ze>=.34?1:0),Je=Se?hn(pt((c-Se.startedAt)/Se.duration,0,1)):1,le=Uint8Array.from({length:He},(Ze,Nt)=>Se?Se.mode==="field"?0:Je>=Pn(Se,z,Nt)?Se.mode==="from"?1:0:Se.sourceDormant[Nt]:B==="to"?1:0),ce=B==="to"&&Se?.mode==="from"&&Mi(Se.board,be),_e=ce&&Mi(H,be),bt=ce?Je:1,Dt=ce?_e?1:Math.max(16,Ve*bt):Math.max(1,Ve),st=Se&&!ce?Math.max(650,Dt/(1+$*.7)):Dt;if(x={mode:B,hando