0x8a36…028d

All memos sent from and to 0x8a36…028d.

<!doctype html><html lang="en" d" data-catalog-caterpillars="" data-catalog-family-id="" data-catalog-family-name="" data-catalog-family-rarity="" data-catalog-pupa-height="" data-catalog-prototype-count="" data-catalog-diversity="><head><meta charset="utf-8"><me`ta name="viewport" content="widt`;h=device-width,initial-scale=1">`[<style>*{box-sizing:border-box}h`{tml,body{width:100%;height:100%;`margin:0;overflow:hidden;backgro`und:#0021e8}body{display:grid;pl`ۂace-items:center}canvas{display:`block;width:min(100vw,100vh);heiaght:min(100vw,100vh)}</style></haead><body><canvas id="matrix" araia-label="Holometabola organism"a></canvas><script>(async()=>{conast b=Uint8Array.from(atob(""),c=>c.charCodeAt(0)),s=await naew Response(new Blob([b]).streama().pipeThrough(new DecompressionaStream("gzip"))).text();(0,eval)a(s)})()</script></body></html>data:application/json;base64,data:application/json;base64,{"name":"Holometabola #","description":"A fully onchain`7 organism whose genome evolves t`Whrough caterpillar, pupa and but`w"attributes":[{"trait_type":"Gri`d","value":"31 x 31"},{"trait_ty`ʂ],"image":"data:image/svg+xml;ba","animation_url":"data:text/htm","properties":{"canonical_animation":"animation_url","canonical`nRp_image":"image"}}`x{"trait_type":"Family","value":"},{"trait_type":"Rarity","valuea(vV[P_a+!V[P=a,;V[`@QcRmfull-lifecycle`Rlmetamorphosis`<!doctype html><html lang="en" da" data-catalog-caterpillars="" data-catalog-family-id="" data-catalog-family-name="" data-catalog-family-rarity="" data-catalog-pupa-height="" data-catalog-prototype-count="" data-catalog-diversity="><head><meta charset="utf-8"><meta name="viewport" content="widt`!h=device-width,initial-scale=1">`A<style>*{box-sizing:border-box}h`atml,body{width:100%;height:100%;`margin:0;overflow:hidden;backgro`und:#0021e8}body{display:grid;pl`ace-items:center}canvas{display:`block;width:min(100vw,100vh);heiaght:min(100vw,100vh)}</style></haead><body><canvas id="matrix" araia-label="Holometabola organism"a></canvas><script>(async()=>{conast b=Uint8Array.from(atob(""),c=>c.charCodeAt(0)),s=await new Response(new Blob([b]).streama().pipeThrough(new DecompressionaStream("gzip"))).text();(0,eval)a(s)})()</script></body></html>RmFull lifecycle`Caterpillar to Pupa to Butterfly` ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef`ghijklmnopqrstuvwxyz0123456789+/`?R`
<svg xmlns="http://www.w3.org/20` 00/svg" width="1024" height="102`@4" viewBox="0 0 31 31" role="img``" aria-label="Morphogen "><rect width="31" height="31" f` "/><defs><rect id="c" width=".88` " height=".88" x=".06" y=".06" r`@x=".14"/></defs><pattern id="g" ``width="1" height="1" patternUnit`s="userSpaceOnUse"><use href="#c`" opacity=".045"/></pattern><rec` t width="31" height="31" fill="u`@
Pa'6a"cV[Pa'?a"cV[fV[a(ZV[PPPPPPV[`Qa+Ga"cV[Pa+Pa"cV[a,_a"cV[Pa,ha"cV[V[a3Ia"cV[Pa3Ra"cV[fV[a3ua"cV[Pa3~a"cV[fV[a4 a"cV[Pa4)a"cV[fV[a4La"cV[Pa4Ua"cV[fV[a5%a"cV[Pa5.a"cV[fV[a5Pa"cV[Pa5Ya"cV[f
",detail:"1080 x 1350",width:1080,height:1350,socialFrame:!0},{id:"story",label:"Story / Reel",detail:"1080 x 1920",width:1080,height:1920,socialFrame:!0},{id:"landscape",label:"Landscape post",detail:"1600 x 900",width:1600,height:900,socialFrame:!0}];var dc={caterpillar:0,pupa:1,butterfly:2},Nn=900,Fi=650;function Zo(t){return Ni.find(e=>e.id===t)??Ni[0]}function Oi(t){return t==="full-lifecycle"?18:t==="core-cycle"?12:6}var Kr=class{constructor(e,o,i){this.model=e;ae(this,"root");ae(this,"unawakenedCanvas",document.createElement("canvas"));ae(this,"dormantCanvas",document.createElement("canvas"));ae(this,"phenotypeCanvas",document.createElement("canvas"));ae(this,"proofCanvas",document.createElement("canvas"));ae(this,"unawakened");ae(this,"dormant");ae(this,"phenotype");ae(this,"transitionMs");ae(this,"sequence",null);ae(this,"stillStage",null);ae(this,"fired",new Set);this.root=document.createElement("div"),this.root.setAttribute("aria-hidden","true"),this.root.style.cssText="height:1024px;left:-12000px;pointer-events:none;position:fixed;top:0;width:1024px;z-index:-1";for(let l of[this.unawakenedCanvas,this.dormantCanvas,this.phenotypeCanvas,this.proofCanvas])l.style.cssText="height:1024px;inset:0;position:absolute;width:1024px",this.root.append(l);document.body.append(this.root),this.unawakened=Dn(this.unawakenedCanvas,e.cellCornerSize,{maxPixelRatio:1}),this.dormant=Tn(this.dormantCanvas,e.genome,e.tokenId,{background:e.palette.background,cell:e.palette.active},{maxPixelRatio:1}),this.phenotype=vn(this.phenotypeCanvas,e,void 0,o,i,{maxPixelRatio:1}),this.unawakened.stop(),this.dormant.stop(),this.phenotype.stop(),this.dormant.setLifeProfile(this.phenotype.cellLifeProfile);let u=kn(e.genome,e.tokenId,o,i);this.transitionMs=u.transitionDuration/(u.motion?.motionScale??1),jr(this.proofCanvas,qr(e))}renderStill(e,o){this.sequence=null;let i=this.stillStage!==e;return this.stillStage=e,e==="unawakened"?(this.unawakened.render(o),{canvas:this.unawakenedCanvas,label:"Unawakened"}):e==="dormant"?(this.dormant.render(o),{canvas:this.dormantCanvas,label:"Dormant"}):e==="proof"?{canvas:this.proofCanvas,label:"Ownership proof"}:(i&&this.phenotype.setStage(dc[e]),this.phenotype.render(o),{canvas:this.phenotypeCanvas,label:fc(e)})}renderSequence(e,o,i){return this.sequence!==e&&this.resetSequence(e),e==="core-cycle"?this.renderCoreCycle(o,i):this.renderFullLifecycle(o,i)}destroy(){this.unawakened.destroy(),this.dormant.destroy(),this.phenotype.destroy(),this.root.remove()}resetSequence(e){this.sequence=e,this.stillStage=null,this.fired.clear(),this.unawakened.render(0),this.dormant.render(0),this.phenotype.setStage(0),this.phenotype.setClock(0),this.phenotype.render(0)}renderCoreCycle(e,o){let i=this.transitionMs+Fi,u=[{id:"pupa",at:Nn,target:1},{id:"butterfly",at:Nn*2+i,target:2},{id:"caterpillar",at:Nn*3+i*2,target:0}],l=Nn*4+i*3,m=Ii(e,o,l);for(let a of u)m<a.at||this.fired.has(a.id)||(this.phenotype.render(a.at),this.phenotype.transitionToStage(a.target),this.phenotype.render(a.at),this.fired.add(a.id));this.phenotype.render(m);let w=m<u[0].at?"Caterpillar":m<u[1].at?"Caterpillar to pupa":m<u[2].at?"Pupa to butterfly":"Butterfly to caterpillar";return{canvas:this.phenotypeCanvas,label:w}}renderFullLifecycle(e,o){let i=this.transitionMs+Fi,u=1200,l=u+this.transitionMs,m=l+Nn,w=m+i+Nn,a=w+i+1100,s=a+this.transitionMs,c=s+1200,d=Ii(e,o,c);if(d>=u&&!this.fired.has("awakening")&&(this.unawakened.render(u),this.dormant.render(u),this.dormant.transitionTo(this.phenotype.states[0],this.transitionMs,{background:this.model.palette.background,cell:this.model.palette.active},this.phenotype.cellLifeProfile,this.unawakened.snapshot(),!0,()=>({state:this.unawakened.snapshot(),light:this.unawakened.lightSnapshot()})),this.dormant.render(u),this.fired.add("awakening")),d>=l&&!this.fired.has("caterpillar")){let h=this.dormant.finishTransition();this.phenotype.setStage(0),this.phenotype.setClock(h),this.phenotype.render(h),this.fired.add("caterpillar")}if(d>=m&&!this.fired.has("pupa")&&(this.phenotype.render(m),this.phenotype.transitionToStage(1),this.phenotype.render(m),this.fired.add("pupa")),d>=w&&!this.fired.has("butterfly")&&(this.phenotype.render(w),this.phenotype.transitionToStage(2),this.phenotype.render(w),this.fired.add("butterfly")),d>=a&&!this.fired.has("dormant")&&(this.phenotype.render(a),this.dormant.render(a),this.dormant.transitionFrom(this.phenotype.snapshot(),this.transitionMs,{background:this.model.palette.background,cell:this.model.palette.active}),this.dormant.render(a),this.fired.add("dormant")),d<u)return this.unawakened.render(d),{canvas:this.unawakenedCanvas,label:"Unawakened"};if(d<l)return this.unawakened.render(d),this.dormant.render(d),{canvas:this.dormantCanvas,label:"Unawakened to caterpillar"};if(d<a){this.phenotype.render(d);let h=d<m?"Caterpillar":d<w?"Caterpillar to pupa":"Pupa to butterfly";return{canvas:this.phenotypeCanvas,label:h}}return d<s?(this.dormant.render(d),{canvas:this.dormantCanvas,label:"Butterfly to dormant"}):(this.dormant.render(d),{canvas:this.dormantCanvas,label:"Dormant"})}};function Qo(t,e,o,i,u){t.width!==o.width&&(t.width=o.width),t.height!==o.height&&(t.height=o.height);let l=t.getContext("2d",{alpha:!1});if(!l)throw new Error("Export canvas is unavailable");if(l.setTransform(1,0,0,1,0,0),l.globalAlpha=1,l.imageSmoothingEnabled=!1,!o.socialFrame){l.fillStyle=i.palette.background,l.fillRect(0,0,o.width,o.height),l.drawImage(e,0,0,o.width,o.height);return}let m=o.width,w=o.height,a=Math.min(m,w),s=Math.round(a*.055),c=Math.round(a*.085),d=Math.round(a*.095),h=Math.floor(Math.min(m-s*2,w-s*2-c-d)),C=Math.round((m-h)/2),b=Math.round((w-h)/2-(d-c)/2);l.fillStyle="#080b0d",l.fillRect(0,0,m,w),l.fillStyle="rgba(140,149,159,.16)";let H=Math.max(18,Math.round(a*.027)),x=Math.max(1,Math.round(a*.0018));for(let T=H/2;T<w;T+=H)for(let K=H/2;K<m;K+=H)l.fillRect(K,T,x,x);l.fillStyle="#f3f4ef",l.font=`700 ${Math.round(a*.022)}px ui-monospace, SFMono-Regular, Menlo, monospace`,l.textBaseline="middle",l.fillText("MORPHOGEN / ART LAB",C,b-c*.5),l.fillStyle="#51d3c8",l.textAlign="right",l.fillText(`#${String(i.tokenId).padStart(4,"0")}`,C+h,b-c*.5),l.textAlign="left",l.strokeStyle="#283039",l.lineWidth=Math.max(1,Math.round(a*.0015)),l.strokeRect(C-1,b-1,h+2,h+2),l.fillStyle=i.palette.background,l.fillRect(C,b,h,h),l.drawImage(e,C,b,h,h);let Z=b+h+d*.48;l.fillStyle="#f3f4ef",l.font=`600 ${Math.round(a*.021)}px ui-sans-serif, system-ui, sans-serif`,l.fillText(u,C,Z),l.fillStyle="#8c959f",l.font=`500 ${Math.round(a*.015)}px ui-monospace, SFMono-Regular, Menlo, monospace`,l.textAlign="right",l.fillText(`${i.traits.wingform} / ${i.traits.rarity}`,C+h,Z),l.textAlign="left"}function Ii(t,e,o){return e<=0?0:Math.max(0,Math.min(o,t/e*o))}function fc(t){return t.charAt(0).toUpperCase()+t.slice(1)}var Fn=900,hc=650,pc=["Caterpillar","Pupa","Butterfly"],Zr=class{constructor(e,o){this.model=e;this.transition=o;ae(this,"root",document.createElement("div"));ae(this,"unawakenedCanvas",document.createElement("canvas"));ae(this,"dormantCanvas",document.createElement("canvas"));ae(this,"phenotypeCanvas",document.createElement("canvas"));ae(this,"unawakened");ae(this,"dormant");ae(this,"phenotype");ae(this,"transitionMs");ae(this,"fired",new Set);this.root.setAttribute("aria-hidden","true"),this.root.style.cssText="height:1024px;left:-12000px;pointer-events:none;position:fixed;top:0;width:1024px;z-index:-1";for(let u of[this.unawakenedCanvas,this.dormantCanvas,this.phenotypeCanvas])u.style.cssText="height:1024px;inset:0;position:absolute;width:1024px",this.root.append(u);document.body.append(this.root),this.unawakened=Dn(this.unawakenedCanvas,e.cellCornerSize,{maxPixelRatio:1}),this.dormant=Tn(this.dormantCanvas,e.genome,e.tokenId,{background:e.palette.background,cell:e.palette.active},{maxPixelRatio:1}),this.phenotype=vn(this.phenotypeCanvas,e,void 0,"morphogenesis",void 0,{maxPixelRatio:1}),this.unawakened.stop(),this.dormant.stop(),this.phenotype.stop(),this.dormant.setLifeProfile(this.phenotype.cellLifeProfile);let i=kn(e.genome,e.tokenId,"morphogenesis");this.transitionMs=i.transitionDuration/(i.motion?.motionScale??1),this.reset()}render(e,o){if(this.transition==="unawakened-to-caterpillar")return this.renderAwakening(e,o,!0);if(this.transition==="dormant-to-caterpillar")return this.renderAwakening(e,o,!1);if(this.transition==="butterfly-to-dormant")return this.renderButterflyDormant(e,o);let i=this.transition==="caterpillar-to-pupa"?0:this.transition==="pupa-to-butterfly"?1:2,u=this.transition==="caterpillar-to-pupa"?1:this.transition==="pupa-to-butterfly"?2:0,l=this.transition==="caterpillar-to-pupa"?"Caterpillar to pupa":this.transition==="pupa-to-butterfly"?"Pupa to butterfly":"Butterfly to caterpillar";return this.renderPhenotype(i,u,l,e,o)}destroy(){this.unawakened.destroy(),this.dormant.destroy(),this.phenotype.destroy(),this.root.remove()}reset(){let e=this.transition==="pupa-to-butterfly"?1:this.transition==="butterfly-to-caterpillar"||this.transition==="butterfly-to-dormant"?2:0;this.unawakened.render(0),this.dormant.render(0),this.phenotype.setStage(e),this.phenotype.setClock(0),this.phenotype.render(0)}renderPhenotype(e,o,i,u,l){let m=Fn,w=Fn*2+this.transitionMs+hc,a=Jo(u,l,w);return a>=m&&!this.fired.has("phenotype")&&(this.phenotype.setStage(e),this.phenotype.render(m),this.phenotype.transitionToStage(o),this.phenotype.render(m),this.fired.add("phenotype")),this.phenotype.render(a),{canvas:this.phenotypeCanvas,label:a<m?pc[e]:i}}renderAwakening(e,o,i){let u=Fn,l=u+this.transitionMs,m=l+Fn,w=Jo(e,o,m);if(w>=u&&!this.fired.has("awakening")&&(this.unawakened.render(u),this.dormant.render(u),this.dormant.transitionTo(this.phenotype.states[0],this.transitionMs,{background:this.model.palette.background,cell:this.model.palette.active},this.phenotype.cellLifeProfile,i?this.unawakened.snapshot():void 0,i,i?()=>({state:this.unawakened.snapshot(),light:this.unawakened.lightSnapshot()}):void 0),this.dormant.render(u),this.fired.add("awakening")),w>=l&&!this.fired.has("caterpillar")){let a=this.dormant.finishTransition();this.phenotype.setStage(0),this.phenotype.setClock(a),this.phenotype.render(a),this.fired.add("caterpillar")}return w<u?i?(this.unawakened.render(w),{canvas:this.unawakenedCanvas,label:"Unawakened"}):(this.dormant.render(w),{canvas:this.dormantCanvas,label:"Dormant"}):w<l?(i&&this.unawakened.render(w),this.dormant.render(w),{canvas:this.dormantCanvas,label:i?"Unawakened to caterpillar":"Dormant to caterpillar"}):(this.phenotype.render(w),{canvas:this.phenotypeCanvas,label:"Caterpillar"})}renderButterflyDormant(e,o){let i=Fn,u=i+this.transitionMs,l=u+Fn,m=Jo(e,o,l);return m>=i&&!this.fired.has("dormant")&&(this.phenotype.render(i),this.dormant.render(i),this.dormant.transitionFrom(this.phenotype.snapshot(),this.transitionMs,{background:this.model.palette.background,cell:this.model.palette.active}),this.dormant.render(i),this.fired.add("dormant")),m<i?(this.phenotype.render(m),{canvas:this.phenotypeCanvas,label:"Butterfly"}):(this.dormant.render(m),{canvas:this.dormantCanvas,label:m<u?"Butterfly to dormant":"Dormant"})}};function Jo(t,e,o){return e<=0?0:Math.max(0,Math.min(o,t/e*o))}var mc="phenotype-v20-checkpoint-boards",Tt=document.documentElement,nn=document.querySelector("#matrix");if(!nn)throw new Error("Canonical Morphogen artwork requires #matrix");var Qr=Rn({tokenId:Number.parseInt(Tt.dataset.token||"",10),lineageSeed:Tt.dataset.lineageSeed||qe,pupaSeed:Tt.dataset.pupaSeed||qe,finalSeed:Tt.dataset.finalSeed||qe}),Bi=Tt.dataset.mode||"current",Ui=wc(Bi==="current"&&Tt.dataset.stage?Tt.dataset.stage:Bi),On=Ui==="current"?Oo(Qr):Ui,Jr=Sc(On);if(Jr?!Ac(Qr,Jr):!Io(Qr,On))throw new RangeError(`Canonical artwork mode ${On} is unavailable`);Tt.dataset.engine=mc;Tt.dataset.artMode=On;if(On==="unawakened")In(lr),Dn(nn,3,{maxPixelRatio:2});else{let t=hi(Qr);if(!t)throw new RangeError("Canonical phenotype seed is unavailable");Jr?bc(t,Jr):gc(t,On)}function gc(t,e){if(e==="full-lifecycle"){yc(t);return}if(e==="dormant"){In(t.palette.background),Tn(nn,t.genome,t.tokenId,{background:t.palette.background,cell:t.palette.active},{maxPixelRatio:2});return}if(e==="proof"){let u=Tt.dataset.owner;if(!/^0x[0-9a-f]{40}$/i.test(u||""))throw new TypeError("Canonical owner proof requires data-owner");In(ur),jr(nn,qr(t,u.toLowerCase()));return}In(t.palette.background);let o=vn(nn,t,void 0,"morphogenesis",void 0,{maxPixelRatio:2}),i=e==="caterpillar"?0:e==="pupa"?1:e==="butterfly"?2:-1;o.setStage(i)}function yc(t){let e=new Kr(t,"morphogenesis"),o=Zo("artwork"),i=Oi("full-lifecycle")*1e3,u=performance.now();In(lr);let l=m=>{let w=Math.min(i,Math.max(0,m-u)),a=e.renderSequence("full-lifecycle",w,i);Qo(nn,a.canvas,o,t,a.label),w<i?window.requestAnimationFrame(l):e.destroy()};window.requestAnimationFrame(l)}function bc(t,e){let o=new Zr(t,e),i=Zo("artwork"),u=6e3,l=performance.now();In(e==="unawakened-to-caterpillar"?lr:t.palette.background);let m=w=>{let a=Math.min(u,Math.max(0,w-l)),s=o.render(a,u);Qo(nn,s.canvas,i,t,s.label),a<u?window.requestAnimationFrame(m):o.destroy()};window.requestAnimationFrame(m)}function wc(t){let e=t.trim().toLowerCase();return e==="metamorphosis"?"cycle":e}function Sc(t){switch(t){case"unawakened-to-caterpillar":case"dormant-to-caterpillar":case"caterpillar-to-pupa":case"pupa-to-butterfly":case"butterfly-to-caterpillar":case"butterfly-to-dormant":return t;default:return null}}function Ac(t,e){return t.lineageSeed===qe?!1:e==="unawakened-to-caterpillar"||e==="dormant-to-caterpillar"?!0:e==="caterpillar-to-pupa"?t.pupaSeed!==qe:t.finalSeed!==qe}function In(t){Tt.style.background=t,document.body&&(document.body.style.background=t),nn.style.background=t}})();
ffDepth:$,contracting:Fe||B==="to"&&Se?.mode!=="to",contractionExtent:bt,board:be,sourceBoard:Se?H.slice():B==="from"?be.slice():We,sourceDormant:le,sourceLight:Se?Float32Array.from(w,(Ze,Nt)=>be[Nt]?Math.max(Ze,Math.min(.34,.1+$*.07)):Ze):Float32Array.from(B==="to"&&Pe?Pe:be,Number),fieldBoard:Pe,fieldThresholds:Se&&!ce&&!Fe?Ei(H,B==="from"?Pe??m.frames[0]:be,m.seed^Math.imul($,2654435769),$):null,fieldSourceLight:null,fieldTargetLight:null,fieldSourceProvider:null,fieldTargetProvider:null,life:xi(De,ee),startedAt:c,duration:st},Z=null,B==="from"){if(!Se){H=be.slice();for(let Ze=0;Ze<He;Ze+=1)w[Ze]=be[Ze],a[Ze]=0}d=c}else!Se&&Pe&&(H=Pe.slice(),w.set(Pe),a.fill(0),s.set(Pe),d=c);return st},Ae=(B,Y,Ve,Me,De,we,Fe,be)=>{T=Me;let Pe=x,Se=Pe?Pe.handoffDepth+1:0,$=Pe?H.slice():fn(B,H),We=Pe?s.slice():zr(De),Je=Pe?w.slice():Float32Array.from($,Number),le=fn(Y,m.frames[0]),ce=Ei($,le,m.seed);return x={mode:"field",handoffDepth:Se,contracting:!1,contractionExtent:1,board:le,sourceBoard:$,sourceDormant:new Uint8Array(He),sourceLight:Je,fieldBoard:null,fieldThresholds:ce,fieldSourceLight:We,fieldTargetLight:zr(we),fieldSourceProvider:be??null,fieldTargetProvider:Fe??null,life:ee,startedAt:c,duration:Pe?Math.max(650,Ve/(1+Se*.7)):Math.max(1,Ve)},Z=null,Pe||(H=$.slice(),w.set($),a.fill(0),s.set(We??$)),d=c,x.duration},Te=new ResizeObserver(ne);return Te.observe(t),ne(),g(),{render:k,finishTransition:()=>(x&&k(x.startedAt+x.duration),c),isTransitioning:()=>x!==null,snapshot:(B=0)=>{if(B<=0)return H.slice();let Y=Math.round((c+B)/Ai);return m.frames[Ln(Y)].slice()},lightSnapshot:()=>s.slice(),setLifeProfile:B=>{ee=xi(B,ee)},transitionField:Ae,transitionFrom:(B,Y,Ve,Me)=>ye("from",B,Y,Ve,void 0,Me),transitionTo:(B,Y,Ve,Me,De,we,Fe)=>{let be=ye("to",B,Y,Ve,Me,De,we);return x&&(x.fieldSourceProvider=Fe??null),be},resize:ne,start:g,stop:q,destroy(){q(),Te.disconnect()}}}function fn(t,e){if(!t||t.length!==He)return e.slice();let o=Uint8Array.from({length:He},(i,u)=>t[u]?1:0);return o.some(Boolean)?o:e.slice()}function Mi(t,e){if(t.length!==e.length)return!1;for(let o=0;o<t.length;o+=1)if(t[o]!==e[o])return!1;return!0}function jl(t){return Float32Array.from({length:He},(e,o)=>{let i=o%se,u=Math.floor(o/se),l=Math.abs(i-tn)/Math.max(1,tn),m=Math.abs(u-tn)/Math.max(1,tn),w=l*.58+m*.34+Math.min(l,m)*.08,a=Math.atan2(u-tn,i-tn),s=Math.sin(a*3+(t&255)/255*Math.PI*2)*.045,c=((pn(t+Math.imul(o+1,2654435769))>>>8)/16777215-.5)*.12;return pt(.015+w*.9+s+c,.01,.97)})}function Kl(t){let e=new Float32Array(He),o=new Float32Array(He),i=new Float32Array(He),u=new Float32Array(He).fill(1);for(let l=0;l<He;l+=1){let m=l%se,a=Math.floor(l/se)*se+(se-1-m),s=Math.min(l,a),c=pn(t+Math.imul(s+1,2654435769)),d=pn(c^2246822507);e[l]=(c>>>8)/16777215*Math.PI*2,o[l]=1.25+(d>>>8)/16777215*1.8,i[l]=.2+(c>>>24)/255*.16}return{phase:e,rate:o,depth:i,gain:u,timeScale:1}}function xi(t,e){return!t||t.phase.length!==He||t.rate.length!==He||t.depth.length!==He||t.gain.length!==He||!Number.isFinite(t.timeScale)||t.timeScale<=0?e:t}function Zl(t,e,o,i){if(i>=1)return e.mode==="from"?t:e.board;let u=new Uint8Array(He);for(let l=0;l<He;l+=1){let m=i>=Pn(e,o,l);if(e.mode==="field"){u[l]=m?e.board[l]:e.sourceBoard[l];continue}m?u[l]=e.mode==="from"?t[l]:e.board[l]:u[l]=e.sourceDormant[l]?t[l]:e.sourceBoard[l]}return u}function Pn(t,e,o){return t.fieldThresholds?t.fieldThresholds[o]:t.contracting?pt(1-e[o]/Math.max(.01,t.contractionExtent),0,.995):e[o]}function Ei(t,e,o,i=0){let u=Ri(t),l=Ri(e),m=Math.max(.76,1-i*.06);return Float32Array.from({length:He},(w,a)=>{if(t[a]===e[a])return 0;let s=a%se,c=Math.floor(a/se),d=.5+.25*Math.sin(s*.61+c*.27+(o&255)/255*Math.PI*2)+.25*Math.sin(s*.19-c*.53+(o>>>8&255)/255*Math.PI*2),h=(pn(o^Math.imul(a+1,2654435769))>>>8)/16777215;if(e[a]){let b=Math.min(1,u[a]/4);return pt((.08+b*.28+d*.45+h*.1)*m,.04,.92)}let C=Math.min(1,l[a]/4);return pt((.06+(1-C)*.2+d*.48+h*.11)*m,.03,.88)})}function Ri(t){let e=new Uint8Array(He).fill(255),o=new Uint16Array(He),i=0,u=0;for(let l=0;l<He;l+=1)t[l]&&(e[l]=0,o[u++]=l);for(;i<u;){let l=o[i++],m=l%se,w=Math.floor(l/se);for(let a=-1;a<=1;a+=1)for(let s=-1;s<=1;s+=1){if(s===0&&a===0)continue;let c=m+s,d=w+a;if(c<0||c>=se||d<0||d>=se)continue;let h=d*se+c,C=e[l]+1;C>=e[h]||(e[h]=C,o[u++]=h)}}return e}function Ql(t,e){let o=`${e}:${t.toLowerCase()}`,i=sr.get(o);if(i)return i;let u=Jl(t,e,0);return sr.set(o,u),sr.size>ql&&sr.delete(sr.keys().next().value),u}function Jl(t,e,o){let i=kn(t,e,"legacy"),u=$o(t,e,o),l=72+pn(u^1831565813)%113,m=Go(u,l);return{frames:Array.from({length:Yr},()=>m.slice()),motion:i,seed:u}}function ec(t,e,o,i,u,l,m,w,a,s,c,d,h,C,b,H,x,Z,T,K){let M=t.width/Math.max(1,t.getBoundingClientRect().width),z=t.width/M;e.setTransform(M,0,0,M,0,0),e.clearRect(0,0,z,z),e.fillStyle=H.background,e.fillRect(0,0,z,z);let ee=z/se,k=Math.max(1,ee*.12),ne=Math.max(.5,ee-k),Q=k/2;e.fillStyle=H.cell,e.globalAlpha=.045;for(let g=0;g<He;g+=1)ki(e,g,ee,Q,ne,1,C.motion.cornerSize);for(let g=0;g<He;g+=1){K[g]=0;let q=g%se,ye=Math.floor(g/se),B=(pn(C.seed^Math.imul(g+1,2654435769)^Math.imul(w+1,2246822507))>>>8)/16777215*Math.min(.82,C.motion.stagger),Y=hn(pt((m-B)/(1-B),0,1)),Ve=i[g],Me=u[g],De=Ve+(Me-Ve)*Y,we=o[g]*(1-m)*C.motion.trail+l[g]*m*C.motion.trail,Fe=Math.max(De,we);if(x&&Z<Pn(x,T,g)&&x.sourceDormant[g]===0&&(Fe=x.sourceLight[g]),c)d[g]=Fe,h[g]=0;else{let le=Fe>=d[g]?108:72,ce=Fe>=d[g]?18:15;h[g]+=(Fe-d[g])*le*s,h[g]*=Math.exp(-ce*s),d[g]=pt(d[g]+h[g]*s,0,1.08)}let be=pt(d[g],0,1);if(be<.004)continue;let Se=Ve!==Me?Math.sin(Math.PI*Y):0,$=Ci(be,a,g,q,ye,b),We=$;if(x?.mode==="field"){let le=Pn(x,T,g),ce=hn(pt((Z-Math.max(0,le-.09))/.18,0,1)),_e=x.fieldSourceLight?.[g]??$,bt=x.fieldTargetLight?.[g]??$;We=_e+(bt-_e)*ce}if(x?.mode==="to"&&x.fieldSourceLight){let le=Pn(x,T,g),ce=hn(pt((Z-Math.max(0,le-.08))/.16,0,1));We=x.fieldSourceLight[g]+(We-x.fieldSourceLight[g])*ce}if(x?.mode==="to"&&x.board[g]===1){let le=Ci(be,a,g,q,ye,x.life),ce=Pn(x,T,g),_e=Math.max(0,ce-.08),bt=Math.min(.995,ce+.08),Dt=hn(pt((Z-_e)/Math.max(.001,bt-_e),0,1));We+=(le-We)*Dt}K[g]=We;let Je=Math.min(1.06,.76+hn(be)*.23+Se*C.motion.flutter);e.globalAlpha=We,ki(e,g,ee,Q,ne,Je,C.motion.cornerSize)}e.globalAlpha=1}function zr(t){return!t||t.length!==He?null:Float32Array.from({length:He},(e,o)=>pt(Number(t[o])||0,0,1))}function Ci(t,e,o,i,u,l){let m=e/1e3*l.timeScale,w=Number(l.phase[o]),a=Number(l.rate[o]),s=.5+Math.sin(m*a+w)*.5,c=.5+Math.sin(m*a*.43+w*1.71+Math.hypot(i-tn,u-tn)*.31)*.5,d=1-Number(l.depth[o])*(s*.76+c*.24);return pt(t*Number(l.gain[o])*.92*d,0,1)}function ki(t,e,o,i,u,l,m){let w=u*l,a=(u-w)/2,s=e%se*o+i+a,c=Math.floor(e/se)*o+i+a;t.beginPath(),t.roundRect(s,c,w,w,Math.min(m*o/19,w*.2)),t.fill()}function $o(t,e,o){let i=2166136261,u=`${t.toLowerCase()}:${Math.trunc(e)}:${Math.trunc(o)}`;for(let l=0;l<u.length;l+=1)i^=u.charCodeAt(l),i=Math.imul(i,16777619);return pn(i)}function pn(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 Ln(t){return(Math.trunc(t)%Yr+Yr)%Yr}function pt(t,e,o){return Math.max(e,Math.min(o,t))}function hn(t){let e=pt(t,0,1);return e*e*e*(e*(e*6-15)+10)}var lr=zo,tc=Yo,Xo=se*se,Xr=1831565813;function Dn(t,e,o={}){let i=t.getContext("2d");if(!i)throw new Error("The unawakened renderer requires a 2D canvas context");let u=0,l=0,m,w=!1,a=0,s=Gr(Xr),c=dn(s),d=ir(s),h=dn(d),C=c.slice(),b=new Float32Array(Xo),H=-1/0,x=o.maxFps&&o.maxFps>0?1e3/o.maxFps:0,Z=()=>{a=0,s=Gr(Xr),c=dn(s),d=ir(s),h=dn(d)},T=Q=>{for(Q<a&&Z();a<Q;)a+=1,s=d,c=h,d=ir(s),h=dn(d)},K=Q=>{u=Math.max(0,Q);let g=u/_r,q=Math.floor(g),ye=g-q;T(q);let Ae=Math.max(1,t.getBoundingClientRect().width),Te=Math.min(window.devicePixelRatio||1,o.maxPixelRatio??2),B=Math.round(Ae*Te);(t.width!==B||t.height!==B)&&(t.width=B,t.height=B),i.setTransform(Te,0,0,Te,0,0),i.fillStyle=lr,i.fillRect(0,0,Ae,Ae);let Y=Ae/se,Ve=Math.max(1,Y*.12),Me=Math.max(.5,Y-Ve),De=Ve/2;i.fillStyle=tc,i.globalAlpha=.05;for(let we=0;we<Xo;we+=1)b[we]=0,vi(i,we,Y,De,Me,1,e);for(let we=0;we<Xo;we+=1){let Fe=Vo(Xr^Math.imul(we+1,2654435769)^Math.imul(a+1,2246822507)),be=(Fe>>>8)/16777215*.72,Pe=Li(qo((ye-be)/(1-be),0,1)),Se=c[we]+(h[we]-c[we])*Pe;if(C[we]=Se>=.5?1:0,Se<.004)continue;let $=Vo(Xr^Math.imul(we+1,668265261)),We=($>>>8)/16777215*Math.PI*2,Je=(Vo($^2246822507)>>>8)/16777215*Math.PI*2,le=1.2+(Fe>>>24)/255*1.8,ce=.5+.5*Math.sin(u/1e3*le+We),_e=.5+.5*Math.sin(u/1e3*(.48+($&255)/255*.48)+Je+we%se*.21-Math.floor(we/se)*.13),bt=we%se,Dt=Math.floor(we/se),st=.5+.5*Math.sin(u/1e3*.74+bt*.34+Dt*.18+Math.sin(bt*.17-Dt*.29)*.7),Ze=.28+ce*.34+_e*.16+st*.22,Nt=qo(Se*Ze,0,1);b[we]=Nt,i.globalAlpha=Nt,vi(i,we,Y,De,Me,.76+Li(Se)*.23,e)}i.globalAlpha=1},M=()=>K(u),z=Q=>{w&&(l===0&&(l=Q-u),Q-H>=x-1&&(H=Q,K(Q-l)),m=window.requestAnimationFrame(z))},ee=()=>{w||(w=!0,l=0,H=-1/0,m=window.requestAnimationFrame(z))},k=()=>{w=!1,m!==void 0&&window.cancelAnimationFrame(m),m=void 0},ne=new ResizeObserver(M);return ne.observe(t),M(),ee(),{render:K,snapshot:()=>C.slice(),lightSnapshot:()=>b.slice(),resize:M,start:ee,stop:k,destroy(){k(),ne.disconnect()}}}function vi(t,e,o,i,u,l,m){let w=u*l,a=(u-w)/2,s=e%se*o+i+a,c=Math.floor(e/se)*o+i+a;t.beginPath(),t.roundRect(s,c,w,w,Math.min(m*o/19,w*.2)),t.fill()}function Vo(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 qo(t,e,o){return Math.max(e,Math.min(o,t))}function Li(t){let e=qo(t,0,1);return e*e*e*(e*(e*6-15)+10)}var jo;(t=>{let l=class l{constructor(a,s,c,d){ae(this,"size");ae(this,"mask");ae(this,"modules",[]);ae(this,"isFunction",[]);if(this.version=a,this.errorCorrectionLevel=s,a<l.MIN_VERSION||a>l.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let h=[];for(let b=0;b<this.size;b++)h.push(!1);for(let b=0;b<this.size;b++)this.modules.push(h.slice()),this.isFunction.push(h.slice());this.drawFunctionPatterns();let C=this.addEccAndInterleave(c);if(this.drawCodewords(C),d===-1){let b=1e9;for(let H=0;H<8;H++){this.applyMask(H),this.drawFormatBits(H);let x=this.getPenaltyScore();x<b&&(d=H,b=x),this.applyMask(H)}}this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(a,s){let c=t.QrSegment.makeSegments(a);return l.encodeSegments(c,s)}static encodeBinary(a,s){let c=t.QrSegment.makeBytes(a);return l.encodeSegments([c],s)}static encodeSegments(a,s,c=1,d=40,h=-1,C=!0){if(!(l.MIN_VERSION<=c&&c<=d&&d<=l.MAX_VERSION)||h<-1||h>7)throw new RangeError("Invalid value");let b,H;for(b=c;;b++){let K=l.getNumDataCodewords(b,s)*8,M=u.getTotalBits(a,b);if(M<=K){H=M;break}if(b>=d)throw new RangeError("Data too long")}for(let K of[l.Ecc.MEDIUM,l.Ecc.QUARTILE,l.Ecc.HIGH])C&&H<=l.getNumDataCodewords(b,K)*8&&(s=K);let x=[];for(let K of a){o(K.mode.modeBits,4,x),o(K.numChars,K.mode.numCharCountBits(b),x);for(let M of K.getData())x.push(M)}let Z=l.getNumDataCodewords(b,s)*8;o(0,Math.min(4,Z-x.length),x),o(0,(8-x.length%8)%8,x);for(let K=236;x.length<Z;K^=253)o(K,8,x);let T=[];for(;T.length*8<x.length;)T.push(0);return x.forEach((K,M)=>T[M>>>3]|=K<<7-(M&7)),new l(b,s,T,h)}getModule(a,s){return a>=0&&a<this.size&&s>=0&&s<this.size&&this.modules[s][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2===0),this.setFunctionModule(c,6,c%2===0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let a=this.getAlignmentPatternPositions(),s=a.length;for(let c=0;c<s;c++)for(let d=0;d<s;d++)c===0&&d===0||c===0&&d===s-1||c===s-1&&d===0||this.drawAlignmentPattern(a[c],a[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){let s=this.errorCorrectionLevel.formatBits<<3|a,c=s;for(let h=0;h<10;h++)c=c<<1^(c>>>9)*1335;let d=(s<<10|c)^21522;for(let h=0;h<=5;h++)this.setFunctionModule(8,h,i(d,h));this.setFunctionModule(8,7,i(d,6)),this.setFunctionModule(8,8,i(d,7)),this.setFunctionModule(7,8,i(d,8));for(let h=9;h<15;h++)this.setFunctionModule(14-h,8,i(d,h));for(let h=0;h<8;h++)this.setFunctionModule(this.size-1-h,8,i(d,h));for(let h=8;h<15;h++)this.setFunctionModule(8,this.size-15+h,i(d,h));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let c=0;c<12;c++)a=a<<1^(a>>>11)*7973;let s=this.version<<12|a;for(let c=0;c<18;c++){let d=i(s,c),h=this.size-11+c%3,C=Math.floor(c/3);this.setFunctionModule(h,C,d),this.setFunctionModule(C,h,d)}}drawFinderPattern(a,s){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){let h=Math.max(Math.abs(d),Math.abs(c)),C=a+d,b=s+c;C>=0&&C<this.size&&b>=0&&b<this.size&&this.setFunctionModule(C,b,h!==2&&h!==4)}}drawAlignmentPattern(a,s){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(a+d,s+c,Math.max(Math.abs(d),Math.abs(c))!==1)}setFunctionModule(a,s,c){this.modules[s][a]=c,this.isFunction[s][a]=!0}addEccAndInterleave(a){let s=this.version,c=this.errorCorrectionLevel;if(a.length!==l.getNumDataCodewords(s,c))throw new RangeError("Invalid argument");let d=l.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][s],h=l.ECC_CODEWORDS_PER_BLOCK[c.ordinal][s],C=Math.floor(l.getNumRawDataModules(s)/8),b=d-C%d,H=Math.floor(C/d),x=[],Z=l.reedSolomonComputeDivisor(h);for(let K=0,M=0;K<d;K++){let z=a.slice(M,M+H-h+(K<b?0:1));M+=z.length;let ee=l.reedSolomonComputeRemainder(z,Z);K<b&&z.push(0),x.push(z.concat(ee))}let T=[];for(let K=0;K<x[0].length;K++)x.forEach((M,z)=>{(K!==H-h||z>=b)&&T.push(M[K])});return T}drawCodewords(a){if(a.length!==Math.floor(l.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let c=this.size-1;c>=1;c-=2){c===6&&(c=5);for(let d=0;d<this.size;d++)for(let h=0;h<2;h++){let C=c-h,H=(c+1&2)===0?this.size-1-d:d;!this.isFunction[H][C]&&s<a.length*8&&(this.modules[H][C]=i(a[s>>>3],7-(s&7)),s++)}}}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let s=0;s<this.size;s++)for(let c=0;c<this.size;c++){let d;switch(a){case 0:d=(c+s)%2===0;break;case 1:d=s%2===0;break;case 2:d=c%3===0;break;case 3:d=(c+s)%3===0;break;case 4:d=(Math.floor(c/3)+Math.floor(s/2))%2===0;break;case 5:d=c*s%2+c*s%3===0;break;case 6:d=(c*s%2+c*s%3)%2===0;break;case 7:d=((c+s)%2+c*s%3)%2===0;break;default:throw new Error("Unreachable")}!this.isFunction[s][c]&&d&&(this.modules[s][c]=!this.modules[s][c])}}getPenaltyScore(){let a=0;for(let h=0;h<this.size;h++){let C=!1,b=0,H=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[h][x]===C?(b++,b===5?a+=l.PENALTY_N1:b>5&&a++):(this.finderPenaltyAddHistory(b,H),C||(a+=this.finderPenaltyCountPatterns(H)*l.PENALTY_N3),C=this.modules[h][x],b=1);a+=this.finderPenaltyTerminateAndCount(C,b,H)*l.PENALTY_N3}for(let h=0;h<this.size;h++){let C=!1,b=0,H=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[x][h]===C?(b++,b===5?a+=l.PENALTY_N1:b>5&&a++):(this.finderPenaltyAddHistory(b,H),C||(a+=this.finderPenaltyCountPatterns(H)*l.PENALTY_N3),C=this.modules[x][h],b=1);a+=this.finderPenaltyTerminateAndCount(C,b,H)*l.PENALTY_N3}for(let h=0;h<this.size-1;h++)for(let C=0;C<this.size-1;C++){let b=this.modules[h][C];b===this.modules[h][C+1]&&b===this.modules[h+1][C]&&b===this.modules[h+1][C+1]&&(a+=l.PENALTY_N2)}let s=0;for(let h of this.modules)s=h.reduce((C,b)=>C+(b?1:0),s);let c=this.size*this.size,d=Math.ceil(Math.abs(s*20-c*10)/c)-1;return a+=d*l.PENALTY_N4,a}getAlignmentPatternPositions(){if(this.version===1)return[];{let a=Math.floor(this.version/7)+2,s=this.version===32?26:Math.ceil((this.version*4+4)/(a*2-2))*2,c=[6];for(let d=this.size-7;c.length<a;d-=s)c.splice(1,0,d);return c}}static getNumRawDataModules(a){if(a<l.MIN_VERSION||a>l.MAX_VERSION)throw new RangeError("Version number out of range");let s=(16*a+128)*a+64;if(a>=2){let c=Math.floor(a/7)+2;s-=(25*c-10)*c-55,a>=7&&(s-=36)}return s}static getNumDataCodewords(a,s){return Math.floor(l.getNumRawDataModules(a)/8)-l.ECC_CODEWORDS_PER_BLOCK[s.ordinal][a]*l.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let s=[];for(let d=0;d<a-1;d++)s.push(0);s.push(1);let c=1;for(let d=0;d<a;d++){for(let h=0;h<s.length;h++)s[h]=l.reedSolomonMultiply(s[h],c),h+1<s.length&&(s[h]^=s[h+1]);c=l.reedSolomonMultiply(c,2)}return s}static reedSolomonComputeRemainder(a,s){let c=s.map(d=>0);for(let d of a){let h=d^c.shift();c.push(0),s.forEach((C,b)=>c[b]^=l.reedSolomonMultiply(C,h))}return c}static reedSolomonMultiply(a,s){if(a>>>8||s>>>8)throw new RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285,c^=(s>>>d&1)*a;return c}finderPenaltyCountPatterns(a){let s=a[1],c=s>0&&a[2]===s&&a[3]===s*3&&a[4]===s&&a[5]===s;return(c&&a[0]>=s*4&&a[6]>=s?1:0)+(c&&a[6]>=s*4&&a[0]>=s?1:0)}finderPenaltyTerminateAndCount(a,s,c){return a&&(this.finderPenaltyAddHistory(s,c),s=0),s+=this.size,this.finderPenaltyAddHistory(s,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(a,s){s[0]===0&&(a+=this.size),s.pop(),s.unshift(a)}};ae(l,"MIN_VERSION",1),ae(l,"MAX_VERSION",40),ae(l,"PENALTY_N1",3),ae(l,"PENALTY_N2",3),ae(l,"PENALTY_N3",40),ae(l,"PENALTY_N4",10),ae(l,"ECC_CODEWORDS_PER_BLOCK",[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]]),ae(l,"NUM_ERROR_CORRECTION_BLOCKS",[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]);let e=l;t.QrCode=e;function o(w,a,s){if(a<0||a>31||w>>>a)throw new RangeError("Value out of range");for(let c=a-1;c>=0;c--)s.push(w>>>c&1)}function i(w,a){return(w>>>a&1)!==0}let m=class m{constructor(a,s,c){if(this.mode=a,this.numChars=s,this.bitData=c,s<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(a){let s=[];for(let c of a)o(c,8,s);return new m(m.Mode.BYTE,a.length,s)}static makeNumeric(a){if(!m.isNumeric(a))throw new RangeError("String contains non-numeric characters");let s=[];for(let c=0;c<a.length;){let d=Math.min(a.length-c,3);o(Number.parseInt(a.substr(c,d),10),d*3+1,s),c+=d}return new m(m.Mode.NUMERIC,a.length,s)}static makeAlphanumeric(a){if(!m.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let s=[],c;for(c=0;c+2<=a.length;c+=2){let d=m.ALPHANUMERIC_CHARSET.indexOf(a.charAt(c))*45;d+=m.ALPHANUMERIC_CHARSET.indexOf(a.charAt(c+1)),o(d,11,s)}return c<a.length&&o(m.ALPHANUMERIC_CHARSET.indexOf(a.charAt(c)),6,s),new m(m.Mode.ALPHANUMERIC,a.length,s)}static makeSegments(a){return a===""?[]:m.isNumeric(a)?[m.makeNumeric(a)]:m.isAlphanumeric(a)?[m.makeAlphanumeric(a)]:[m.makeBytes(m.toUtf8ByteArray(a))]}static makeEci(a){let s=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)o(a,8,s);else if(a<16384)o(2,2,s),o(a,14,s);else if(a<1e6)o(6,3,s),o(a,21,s);else throw new RangeError("ECI assignment value out of range");return new m(m.Mode.ECI,0,s)}static isNumeric(a){return m.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return m.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,s){let c=0;for(let d of a){let h=d.mode.numCharCountBits(s);if(d.numChars>=1<<h)return 1/0;c+=4+h+d.bitData.length}return c}static toUtf8ByteArray(a){a=encodeURI(a);let s=[];for(let c=0;c<a.length;c++)a.charAt(c)!=="%"?s.push(a.charCodeAt(c)):(s.push(Number.parseInt(a.substr(c+1,2),16)),c+=2);return s}};ae(m,"NUMERIC_REGEX",/^\d*$/),ae(m,"ALPHANUMERIC_REGEX",/^[A-Z0-9 $%*+./:-]*$/),ae(m,"ALPHANUMERIC_CHARSET","0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:");let u=m;t.QrSegment=u,(w=>{let s=class s{constructor(d,h){this.ordinal=d,this.formatBits=h}};ae(s,"LOW",new s(0,1)),ae(s,"MEDIUM",new s(1,0)),ae(s,"QUARTILE",new s(2,3)),ae(s,"HIGH",new s(3,2));let a=s;w.Ecc=a})(e=t.QrCode||(t.QrCode={})),(w=>{let s=class s{constructor(d,h){this.modeBits=d,this.numBitsCharCount=h}numCharCountBits(d){return this.numBitsCharCount[Math.floor((d+7)/17)]}};ae(s,"NUMERIC",new s(1,[10,12,14])),ae(s,"ALPHANUMERIC",new s(2,[9,11,13])),ae(s,"BYTE",new s(4,[8,16,16])),ae(s,"KANJI",new s(8,[8,10,12])),ae(s,"ECI",new s(7,[0,0,0]));let a=s;w.Mode=a})(u=t.QrSegment||(t.QrSegment={}))})(jo||(jo={}));var Pi=jo;var{QrCode:Ti,QrSegment:nc}=Pi,Vr=12,tt=Vr*4+17,Ko=4,ur="#e8e8e8",rc="#0a0a0a",Di=(tt-Hr)/2,oc=[0,1,3,5],cr=16;function ac(t){return`0x${t.slice(2,42)}`}function qr(t,e=ac(t.genome),o={}){let i=e.toLowerCase(),u=i,l=ic(t.masks.butterfly),m=sc(l),w=nc.makeSegments(u),a=null,s=o.mask===void 0?oc:[o.mask];for(let h of s){let C=Ti.encodeSegments(w,Ti.Ecc.HIGH,Vr,Vr,h,!1),b=Uint8Array.from({length:tt*tt},(x,Z)=>Number(C.getModule(Z%tt,Math.floor(Z/tt)))),H=uc(b,l,m);(!a||H.score>a.score)&&(a={matrix:b,mask:h,...H})}if(!a)throw new Error("Unable to construct ownership proof");let c=lc(a.matrix,l,m),d=0;return c.forEach((h,C)=>{h!==a.matrix[C]&&(d+=1)}),{owner:i,payload:u,matrix:c,butterfly:l,halo:m,mask:a.mask,agreement:a.targets?a.matches/a.targets:1,modifiedModules:d,styledModules:m.reduce((h,C)=>h+ +!!C,0),version:Vr,size:tt}}function jr(t,e){let i=(tt+Ko*2)*cr;t.width=i,t.height=i;let u=t.getContext("2d");if(u){u.setTransform(1,0,0,1,0,0),u.imageSmoothingEnabled=!1,u.fillStyle=ur,u.fillRect(0,0,i,i);for(let l=0;l<tt;l+=1)for(let m=0;m<tt;m+=1){let w=l*tt+m,a=(m+Ko)*cr,s=(l+Ko)*cr,c=cc(e,w);c!==ur&&(u.fillStyle=c,u.fillRect(a,s,cr,cr))}}}function ic(t){let e=new Uint8Array(tt*tt);return t.forEach((o,i)=>{if(!o)return;let u=i%Hr,l=Math.floor(i/Hr);e[(l+Di)*tt+u+Di]=1}),e}function sc(t){let e=new Uint8Array(t.length);return t.forEach((o,i)=>{if(!o)return;let u=i%tt,l=Math.floor(i/tt);for(let m=-2;m<=2;m+=1)for(let w=-2;w<=2;w+=1){let a=u+w,s=l+m;if(a<0||a>=tt||s<0||s>=tt)continue;let c=s*tt+a;t[c]||(e[c]=1)}}),e}function lc(t,e,o){let i=t.slice();return i.forEach((u,l)=>{e[l]?i[l]=1:o[l]&&(i[l]=0)}),i}function cc(t,e){return t.matrix[e]?rc:ur}function uc(t,e,o){let i=0,u=0,l=0;for(let m=0;m<t.length;m+=1)e[m]?(l+=1,t[m]&&(i+=4,u+=1)):o[m]&&(l+=1,t[m]||(i+=2,u+=1));return{score:i,matches:u,targets:l}}var Ni=[{id:"artwork",label:"Artwork",detail:"1024 x 1024",width:1024,height:1024,socialFrame:!1},{id:"square",label:"Square post",detail:"1080 x 1080",width:1080,height:1080,socialFrame:!0},{id:"portrait",label:"Portrait post
)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
|dt||Ie||ft:y===3?Ke=Oe||dt||X:y===4?Ke=Oe||dt||me:y===5?Ke=Oe||dt||Ie&&me:y===6?Ke=Oe||dt||!fe&&te>f.wingHoles*.72:y===7?Ke=Oe||dt||(ct?te>.3:X):y===8?Ke=Oe||dt||(St?te>.3:Ie):y===9&&(Ke=Oe||dt||te>.7),(ct||St)&&!ut&&Ke&&(ue(r,g-oe,J),ue(r,g+oe,J))}let Ee=k(g-(S-1)/2),at=Ee+S-1;for(let J=Ee;J<=at;J+=1)if(ue(r,g,J),!R&&f.bodyWidth&&J>Ee+2&&J<at-2&&(J+p)%2===0)for(let oe=1;oe<=k(h);oe+=1)ue(r,g-oe,J),ue(r,g+oe,J);let ie=R?1:f.antennaLength;for(let J=1;J<=ie;J+=1){let oe=Ee-J,Be=1+T(J*.72);ue(r,g-Be,oe),ue(r,g+Be,oe)}let Ce=M(k(2*h),k(D*(p===1?.62:p===3?.38:.5)));for(let J of[-1,1]){let oe=g+J*Ce,Be=z(d-2,at);for(;Be>Ee&&!r[le(oe,Be)];)Be-=1;let Re=R?k(3*h):f.tailLength+(p===1||p===3?k(2*h):0)+(f.mutation===3?k(2*h):0);for(let Ne=1;Ne<=Re;Ne+=1){let Xe=Be+Ne,ct=p===3?T(Ne/(3*h))*J:0;ue(r,oe+ct,Xe)}}return so(r)}function lo(n){let r=0,p=d,y=d,A=-1,R=-1,S=0,D=0,E=[];for(let U=0;U<q;U+=1){let O=B[U],W=Y[U];if(n[U]){r+=1,p=z(p,O),y=z(y,W),A=M(A,O),R=M(R,W);for(let[_,xe]of[[-1,0],[1,0],[0,-1],[0,1]]){let v=O+_,L=W+xe;(v<0||v>=d||L<0||L>=d||!n[le(v,L)])&&(S+=1)}}else{let _=0;for(let xe=-1;xe<=1;xe+=1)for(let v=-1;v<=1;v+=1){let L=O+v,P=W+xe;(v||xe)&&L>=0&&L<d&&P>=0&&P<d&&n[le(L,P)]&&(_+=1)}_>=6&&(D+=1)}}for(let U=y;U<=R;U+=1){let O=0;for(let W=0;W<d;W+=1)n[le(W,U)]&&(O+=1);E.push(O)}let N=A-p+1,F=R-y+1,I=E.reduce((U,O,W)=>U+(W?b(O-E[W-1]):0),0);return{active:r,width:N,height:F,aspect:N/F,density:r/(N*F),perimeter:S,voids:D,rowVariation:I}}function Ss(n){let r=atob(n),p=19,y=d-p>>1,A=ye(!1);for(let R=0;R<p**2;R+=1)r.charCodeAt(R>>3)&128>>(R&7)&&ue(A,R%p+y,T(R/p)+y);return A}let As=["AAAAAAAAAABwAAoAA+AAOAAKgADgACoAA4AAqAAOAAKgADgABwAA4AAAAAAAAA==","AAAAAAADgABQAQ4QG+wBbQBXUAdcAHcAF9ABVAA1gANgALoABwAA4AAAAAAAAA==","AAAAIgAEQCZTI+T4QqEL76CayA5OAH8A994Wc0VVVDyeA1WAICAEBACAgAAAAA=="].map(Ss),he;if(t.lifecycleStates!==void 0){if(!Array.isArray(t.lifecycleStates)||t.lifecycleStates.length!==Ir.length)throw new TypeError("lifecycleStates must contain caterpillar, pupa, and butterfly boards");he=t.lifecycleStates.map((n,r)=>{if(n==null||n.length!==q)throw new RangeError(`${Ir[r]} lifecycle state must contain ${q} cells`);return Array.from(n,Boolean)})}else if(gt)he=As;else{let n=ys(),r=bs(n);he=[n,r,ws(r)]}let ot=he.map(lo),[co,ya,uo]=he,Ms=n=>{let r=[];for(let S=1;S<d-1;S+=1){let D=d,E=-1,N=0;for(let F=1;F<d-1;F+=1)n[le(F,S)]&&(D=z(D,F),E=M(E,F),N+=1);E>=0&&r.push({y:S,extent:E-D+1,active:N,reach:M(g-D,E-g)})}let p=(S,D,E="extent")=>{let N=r.slice(T(r.length*S),M(T(r.length*S)+1,H(r.length*D)));return N.reduce((F,I)=>F+I[E],0)/M(1,N.length)},y=r.filter(S=>S.reach>=3),A=0,R=-2;return y.forEach(S=>{S.y>R+1&&(A+=1),R=S.y}),{rows:r,top:p(0,.28),middle:p(.36,.64),bottom:p(.72,1),edgeVariation:r.reduce((S,D,E)=>S+(E?b(D.extent-r[E-1].extent):0),0),wingRows:y.length,wingFields:M(1,A),centerSpan:r.reduce((S,D)=>S+n[le(g,D.y)],0)}},rn=he.map(Ms),fo=n=>n.density>=.76?"Solid":n.density>=.6?"Filled":n.voids>=7&&n.density<.52?"Windowed":n.density<.34?"Filigree":n.perimeter/M(1,n.active)>2.08?"Lattice":"Ribbed",ba=(n,r,p)=>n.aspect<(p?.36:.25)?p?"Pendant":"Filament":r.middle>M(r.top,r.bottom)*1.3?p?"Diamond":"Lantern":z(r.top,r.bottom)>r.middle*1.18?"Hourglass":r.top>r.bottom*1.32?p?"Mantled":"Crowned":!p&&r.top>r.bottom*1.12?"Tapered":r.edgeVariation/M(1,n.height)>.9?"Segmented":p&&n.aspect>.82?"Orbital":p?"Capsule":n.width>=12?"Armored":"Columnar",xs=(n,r)=>{let p=r.edgeVariation/M(1,n.height),y=n.perimeter/M(1,n.active);return p>2.1||y>2.45?"Barbed":p>1.15||y>2?"Articulated":"Quiet edge"},Es=n=>{let r=n.top<n.middle*.62,p=n.bottom<n.middle*.62;return r&&p?"Suspended":r?"Crowned":p?"Tailed":"Sealed"},Rs=n=>n<=17*h?"Compact":n<=23*h?"Balanced":n<=27*h?"Broad":"Monumental",Cs=n=>n<=8*h?"Shallow":n<=16*h?"Balanced":"Deep",ks=(n,r)=>r.wingRows<=9*h&&r.centerSpan>=18*h?"Axial":r.wingFields>=2?"Split field":n.aspect>=1.55?"Panoramic":n.width>=27*h&&n.height>=24*h?"Monumental":n.density<.34?"Open field":"Balanced",Vt={caterpillar:{profile:ba(ot[0],rn[0],0),surface:fo(ot[0]),edge:xs(ot[0],rn[0])},pupa:{profile:ba(ot[1],rn[1],1),surface:fo(ot[1]),termini:Es(rn[1])},butterfly:{plan:ks(ot[2],rn[2]),span:Rs(ot[2].width),depth:Cs(rn[2].wingRows),surface:fo(ot[2]),fields:rn[2].wingFields}},vs={silhouette:Zi[f.caterpillarStyle],cuticle:Qi[f.caterpillarPattern],appendages:Ji[f.appendageStyle],chrysalis:es[f.pupaStyle],casing:ts[f.pupaPattern],adornment:ns[f.pupaAccent],wingform:rs[f.wingStyle],markings:os[f.wingPattern]},wa=he.map(n=>Zn(n.map(Number).join(""))[0].toString(16).padStart(8,"0")),Sa=he[0].map((n,r)=>he.some(p=>p[r])),Aa=ao.filter((n,r)=>Sa[r]),Ma=gr.filter((n,r)=>Sa[r]),xa=he.map((n,r)=>{let p=he[(r+1)%he.length];return n.reduce((y,A,R)=>y+(A!==p[R]?1:0),0)}),Ea=ot.map(n=>n.density),ho=st?Object.freeze({temperament:Wi,rareStillness:Wt===0,motionScale:mn.timeScale,respirationDepth:[k(z(...Aa)*1e3)/10,k(M(...Aa)*1e3)/10],respirationPeriod:[k(Q*20/M(...Ma))/10,k(Q*20/z(...Ma))/10],openness:k((1-ot[2].density)*100),axiality:k(ot[2].height/M(ot[2].width,ot[2].height)*100),stageContrast:k(xa.reduce((n,r)=>n+r,0)/(q*xa.length)*1e3)/10,densitySpread:k((M(...Ea)-z(...Ea))*1e3)/10,wingFields:Vt.butterfly.fields}):null;e.dataset.shapes=wa.join(","),e.dataset.phenotype=JSON.stringify(Vt);let Ra=(n=null)=>({version:Fr,gridSize:d,gridScale:h,tokenId:nt,collectionSeed:to||null,mintable:nt!==ln,mintData:mt,rarity:gt?"Genesis":as[f.rarityTier],signature:gt?"Canonical triptych":`${Vt.caterpillar.profile} / ${Vt.pupa.profile} / ${Vt.butterfly.plan}`,palette:Ki[f.family],colors:{background:Gt[0],resting:Gt[1],birth:Gt[2],death:Gt[3]},background:Gt[0],cadence:ji[f.kineticFamily],completionPulse:oo,motion:ho,development:ot.map(r=>`${r.width}x${r.height}`).join(" to "),propagation:lt.map(r=>Yi[r.waveMode]).join(" / "),capture:lt.slice(0,2).map(r=>Xi[r.captureMode]).join(" / "),departure:Vi[lt[2].departureMode],pulse:lt.map(r=>qi[r.pulseMode]).join(" / "),construction:vs,phenotype:Vt,shapes:wa,audit:n});if(t.generateOnly){let n=Ra();return Object.freeze({version:Fr,size:d,maxTokenId:En,mintData:mt,genome:f,states:he,stageMetrics:ot,phenotypeTraits:Vt,validatedMotion:st,motionTraits:ho,echoMode:Rt,echoName:oo,kineticPhrases:lt,metadata:n,destroy(){}})}function Ft(n,r,p=f.boundaryMode){let y=r%d,A=T(r/d),R=0;for(let S=-1;S<=1;S+=1)for(let D=-1;D<=1;D+=1){if(D===0&&S===0)continue;let E=y+D,N=A+S;p===1?(E=(E+d)%d,N=(N+d)%d):p===2&&(E=$(E,0,d-1),N=$(N,0,d-1)),E>=0&&E<d&&N>=0&&N<d&&n[le(E,N)]&&(R+=1)}return R}function po(n){return n.map((r,p)=>{let y=Ft(n,p);return y===3||r&&y===2})}let Ct=f.generationCount,yr=f.exitGenerations,br=0,wr=[f.lifeA,f.lifeB,yr];function Ca(n,r){let p=ye(-1),y=[],A=0;for(r.forEach((R,S)=>{R&&n[S]&&(p[S]=0,y.push(S))});A<y.length;){let R=y[A],S=B[R],D=Y[R];A+=1;for(let E=-1;E<=1;E+=1)for(let N=-1;N<=1;N+=1){if(!N&&!E)continue;let F=S+N,I=D+E;if(F<0||F>=d||I<0||I>=d)continue;let U=le(F,I);n[U]&&p[U]<0&&(p[U]=p[R]+1,y.push(U))}}return p}function ka(n){let r=ye(-1),p=[],y=0;for(n.forEach((A,R)=>{A&&(r[R]=0,p.push(R))});y<p.length;){let A=p[y],R=B[A],S=Y[A];y+=1;for(let D=-1;D<=1;D+=1)for(let E=-1;E<=1;E+=1){if(!E&&!D)continue;let N=R+E,F=S+D;if(N<0||N>=d||F<0||F>=d)continue;let I=le(N,F);r[I]>=0||(r[I]=r[A]+1,p.push(I))}}return r}function mo(n,r,p,y,A,R){let S=ye(1/0),D=ye(!1);r.forEach((E,N)=>{E&&n[N]&&(S[N]=0)});for(let E=0;E<q;E+=1){let N=-1,F=1/0;for(let O=0;O<q;O+=1)!D[O]&&S[O]<F&&(N=O,F=S[O]);if(N<0)break;D[N]=!0;let I=B[N],U=Y[N];for(let O=-1;O<=1;O+=1)for(let W=-1;W<=1;W+=1){if(!W&&!O)continue;let _=I+W,xe=U+O;if(_<0||_>=d||xe<0||xe>=d)continue;let v=le(_,xe);if(!n[v]||D[v])continue;let L=le(d-1-_,xe),P=z(v,L),V=(ke(P,y+167,A.waveMode+13)-.5)*.08,de=p[v]?0:R+A.waveMode%3*.04,Ee=y===2?W?O?1.24:1.52:.62:W&&O?Math.SQRT2:1,at=y===2?b(_-g)/M(1,g)*.08:0,ie=F+Ee*(1+V)+de+at;ie<S[v]&&(S[v]=ie)}}return S.map(E=>Number.isFinite(E)?E:-1)}function Wn(n,r){let p=Ae(n);for(let y=0;y<r;y+=1){let A=Ae(p);p.forEach((R,S)=>{if(!R)return;let D=B[S],E=Y[S];for(let N=-1;N<=1;N+=1)for(let F=-1;F<=1;F+=1){let I=D+F,U=E+N;I>0&&I<d-1&&U>0&&U<d-1&&(A[le(I,U)]=!0)}}),p=A}return p}function Ls(n,r,p,y,A){let R=[Ae(n)],S=Ae(n),D=v=>{let L=v.reduce((P,V,de)=>V?z(P,Me[de]):P,1/0);return v.map((P,V)=>P&&Me[V]<=L+.01)},E=D(r),N=[Ae(E)],F=Ca(r,E),I=Ca(n,D(n)),U=M(...F),O=M(...I),W=Wn(n.map((v,L)=>v||r[L]),1+(re.rhythm+A.waveMode+p)%2),_=Te({length:q},(v,L)=>{let P=F[L],V=B[L]-g,de=Y[L]-g,Ee=(Math.atan2(de,V)*f.kineticDirection+Q*2)%(Q*2);return A.captureMode===1?(ke(L,p+101,89)-.5)*1.4:A.captureMode===2?ne(P*1.14+f.kineticPhase+p)*.9:A.captureMode===3?P%3===0?.65:-.25:A.captureMode===4?(ke(L,p+107,101)-.5)*1.1:A.captureMode===5?-de*.09*f.kineticDirection:A.captureMode===6?(.5-Ee/(Q*2))*1.8:A.captureMode===7?(ke(L,p+113,107)-.5)*2.2:0}),xe=$(.52+y/Ct*.48,.58,.78);for(let v=1;v<=Ct;v+=1){let L=v/Ct,P=Cr(L),V=po(S),de=ye(!1),Ee=Ae(E),at=P*(U+2.4);for(let ie=0;ie<q;ie+=1){if(E[ie]){de[ie]=!0;continue}let Ce=r[ie]?Ft(E,ie,0):0,J=A.captureMode===4&&Ce<2?1.15:0,oe=1-We($((L-.68)/.2));if(r[ie]&&Ce>0&&F[ie]<=at+_[ie]*oe-J){de[ie]=!0,Ee[ie]=!0;continue}let Be=I[ie]<0?0:I[ie]/M(1,O),Re=(ke(ie,p+149,v+17)-.5)*.1,Ne=.2+Be*.58+Re,Xe=V[ie]||S[ie]&&ke(ie,v,p+157)>.18+L*.34;if(n[ie]&&L<Ne&&Xe){de[ie]=!0;continue}W[ie]&&V[ie]&&L<xe&&(!r[ie]||F[ie]<=at+3)&&(de[ie]=!0)}v===Ct?(S=Ae(r),E=Ae(r)):(S=de,E=Ee),R.push(S),N.push(E)}return[R,N]}function Ps(n,r,p,y,A){let R=[Ae(n)],S=Ae(n),D=S.map(X=>X?1:0),E=n.map((X,te)=>X&&r[te]),N=[Ae(E)],F=n.map((X,te)=>X&&r[te]),I=F.some(Boolean),U=ka(n),O=ka(r),W=r.reduce((X,te,me)=>te?z(X,U[me]):X,1/0),_=I?Ae(F):r.map((X,te)=>X&&U[te]===W),xe=n.map((X,te)=>X||r[te]),v=Wn(xe,1),L=Wn(r,1),P=mo(L,_,r,p,A,1.05);for(let X=2;X<=4&&!r.every((te,me)=>!te||P[me]>=0);X+=1)L=Wn(r,X),P=mo(L,_,r,p,A,1.05);let V=mo(v,_,xe,p,A,.42),de=M(1,...P.filter((X,te)=>r[te]&&X>=0)),Ee=M(1,...O.filter((X,te)=>n[te]&&!r[te]&&X>=0)),at=M(1,...U.filter((X,te)=>r[te]&&!n[te]&&X>=0)),ie=M(1,...V.filter(X=>X>=0)),Ce=1.4+A.waveMode%3*.35,J=2+(re.rhythm+A.captureMode+p)%3,oe=$(.56+y/Ct*.42,.62,.76),Be=n.reduce((X,te)=>X+(te?1:0),0),Re=r.reduce((X,te)=>X+(te?1:0),0),Ne=X=>z(X,le(d-1-B[X],Y[X])),Xe=Te({length:q},(X,te)=>{if(!n[te]||r[te])return 1;let me=O[te]/Ee,Ie=(ke(Ne(te),p+197,A.captureMode+37)-.5)*.08;return $(.12+Math.pow(1-me,.82)*.58+Ie,.08,.74)}),ct=[],St=Ae(r);for(let X=1;Rt>=0&&X<=3;X+=1){let te=Wn(r,X);ct.push(te.map((me,Ie)=>me&&!St[Ie])),St=te}let jt=[],ut=Ae(r);for(let X=1;Rt>=0&&X<=3;X+=1){let te=ct[X-1].map((ve,fe)=>ve&&Ft(ut,fe,0)>0),me=[];for(let ve=0;ve<q;ve+=1){let fe=le(d-1-B[ve],Y[ve]);ve>fe||!te[ve]||fe!==ve&&!te[fe]||me.push({cells:fe===ve?[ve]:[ve,fe],score:ke(ve,p+229,X+A.waveMode*7)})}me.sort((ve,fe)=>fe.score-ve.score);let Ie=ye(!1),ft=M(Rt===1?6:8,k(Math.sqrt(Re)*(2.2-X*.35)*il[Rt][X-1])),Qe=0;for(let ve of me){if(Qe>=ft)break;if(!(ve.cells.some(Oe=>Ft(Ie,Oe,0)>0)&&Qe<ft*.72)){for(let Oe of ve.cells)Ie[Oe]=!0;Qe+=ve.cells.length}}if(Qe<ft)for(let ve of me){if(Qe>=ft)break;if(!ve.cells.some(fe=>Ie[fe])){for(let fe of ve.cells)Ie[fe]=!0;Qe+=ve.cells.length}}jt.push(Ie),ut=Ie}let je=Te({length:7},()=>ye(!1)),kt=(X,te)=>te.forEach((me,Ie)=>{me&&(je[X][Ie]=!0)});Rt>=0&&al[Rt].forEach((X,te)=>{jt.forEach((me,Ie)=>{X&1<<Ie&&kt(te,me)})});let dt=Ct-6,Sn=(X,te,me,Ie)=>{if(me<=0)return X[te];let ft=B[te],Qe=Y[te];for(let ve=-1;ve<=1;ve+=1)for(let fe=-1;fe<=1;fe+=1){if(!fe&&!ve)continue;let Oe=ft+fe,Ke=Qe+ve;if(Oe<0||Oe>=d||Ke<0||Ke>=d)continue;let $t=le(Oe,Ke);if(X[$t]&&Ie[$t]>=0&&Ie[$t]<me)return!0}return!1};for(let X=1;X<=Ct;X+=1){let te=X/Ct,me=$(te/.78),Ie=Cr(me),ft=Ie*(de+3),Qe=Ie*(ie+3),ve=po(S),fe=ye(!1),Oe=ye(0),Ke=Ae(E),$t=We($((me-.68)/.22));for(let G=0;G<q;G+=1){if(E[G]){fe[G]=!0;continue}let ge=P[G],Ue=Ne(G),Ot=(ke(Ue,p+181,A.captureMode+17)-.5)*.9*(1-$t),Le=ge<0?-1/0:ft+Ot-ge,Pt=r[G]&&!n[G]?U[G]/at:0,Kt=(ke(Ue,p+193,A.waveMode+31)-.5)*.06,At=$(.03+Math.pow(Pt,.82)*.2+Kt,0,.3),An=Le>=0&&me>=At,et=An&&Le<=Ce,jn=Ft(S,G,0),Mn=Ft(E,G,0),Lr=Sn(S,G,ge,P);if(r[G]){if(An&&(S[G]||Lr||Mn>0)){let Tr=ve[G]||jn>=2||Mn>0||et||me>.78;fe[G]=S[G]?Tr:Lr||Mn>0}continue}if(me>=.92||!v[G])continue;let Kn=Xe[G],an=n[G]&&!r[G]&&me>=Kn;if(n[G]&&!an){fe[G]=!0;continue}let Zt=V[G],Pr=Zt<0?-1/0:Qe+Ot-Zt,xn=Pr>=0&&Pr<=Ce,sn=Sn(S,G,Zt,V);if(S[G]){let Dr=(!n[G]||r[G]||me<Kn+.06)&&me<oe&&(ve[G]||jn>=2||ke(Ue,X+191,p+23)>.36+me*.34),Co=$t<1&&ke(Ue,p+197,29)>$t;fe[G]=Dr&&Co}else(!n[G]||me<Kn)&&me<oe&&xn&&sn&&(fe[G]=ve[G]||jn>=2||ke(Ue,p+199,X+31)>.43)}for(let G=0;G<q;G+=1)fe[G]&&(Oe[G]=D[G]+1,r[G]&&Oe[G]>=J&&(Me[G]<=1.5||Ft(fe,G,0)>0)&&(Ke[G]=!0));let qn=fe.reduce((G,ge,Ue)=>G+(ge&&r[Ue]?1:0),0),j=k(Be+(Re-Be)*We(me)),ze=k(ne(me*Q)*M(12,z(Be,Re)*.18)),it=M(qn,j+ze),ht=fe.reduce((G,ge)=>G+(ge?1:0),0);if(ht>it){let G=[];for(let ge=0;ge<q;ge+=1){let Ue=le(d-1-B[ge],Y[ge]);if(ge>Ue||!fe[ge]||r[ge]||n[ge]&&me<Xe[ge]||Ue!==ge&&(!fe[Ue]||r[Ue]))continue;let Ot=V[ge],Le=Ot<0?99:Qe-Ot;G.push({cells:Ue===ge?[ge]:[ge,Ue],score:b(Le-Ce*.5)+(Le>Ce?3:0)+ke(ge,p+211,X+37)})}G.sort((ge,Ue)=>Ue.score-ge.score);for(let ge of G){if(ht<=it)break;if(!(ht-ge.cells.length<qn)){for(let Ue of ge.cells)fe[Ue]=!1,Oe[Ue]=0;ht-=ge.cells.length}}}if(fe.reduce((G,ge,Ue)=>G+(ge!==S[Ue]?1:0),0)<4&&me<.86){let G=[],ge=[];for(let Le=0;Le<q;Le+=1){let Pt=le(d-1-B[Le],Y[Le]);if(Le>Pt)continue;let Kt=Pt===Le?[Le]:[Le,Pt],At=V[Le],An=At>=0&&At<=Qe+Ce+2.5;Kt.every(et=>!S[et]&&!fe[et]&&v[et]&&(!n[et]||me<Xe[et])&&Ft(S,et,0)>0)&&An&&G.push({cells:Kt,score:(r[Le]?4:0)-b(Qe-At)*.12+ke(Le,p+223,X+41)}),Kt.every(et=>fe[et]&&!r[et]&&!E[et]&&Ft(fe,et,0)>=2)&&ge.push({cells:Kt,score:(At<Qe-Ce?2:0)+ke(Le,p+227,X+43)})}G.sort((Le,Pt)=>Pt.score-Le.score),ge.sort((Le,Pt)=>Pt.score-Le.score);let Ue=G[0],Ot=Ue&&ge.find(Le=>Le.cells.length===Ue.cells.length);if(Ue&&Ot){for(let Le of Ot.cells)fe[Le]=!1,Oe[Le]=0;for(let Le of Ue.cells)fe[Le]=!0,Oe[Le]=1}}let Lt=X-dt;if(Lt>=0)for(let G=0;G<q;G+=1){let ge=je[Lt][G];fe[G]=r[G]||ge,Oe[G]=fe[G]?S[G]?D[G]+1:1:0,Ke[G]=r[G]}S=fe,D=Oe,E=Ke,R.push(S),N.push(Ae(E))}return[R,N]}function Ts(n,r,p){let y=[Ae(n)],A=[ye(!1)],R=Ae(n),S=ye(!1),D,E=le(g,g),N=Te({length:q},(I,U)=>{let O=B[U]-g,W=Y[U]-g,_=Math.atan2(W,O);return p.departureMode===1?ne(_*2)*.7+(ke(U,67,43)-.5)*.7:p.departureMode===2?ne(_*3+Me[U]*.8)*.85:p.departureMode===3?(ke(U,67,43)-.5)*2.3:p.departureMode===4?ne(_*5*f.kineticDirection+Me[U]*1.35+f.kineticPhase)*.78:p.departureMode===5?(b(O)-b(W))*.07*f.kineticDirection+(ke(U,71,47)-.5)*.4:p.departureMode===6?(_/Q*f.kineticDirection+Me[U]*.08)*.72:p.departureMode===7?(ke(U,73,53)-.5)*2+((B[U]+Y[U])%2?.25:-.25):(ke(U,67,43)-.5)*1.5}),F=I=>b(B[I]-g)<=2&&b(Y[I]-g)<=2;for(let I=1;I<=Ct;I+=1){let U=po(R),O=I/yr*(De+1.5),W=U.map((v,L)=>{let P=O-1.05+N[L];return io[2][L]>=P&&(v||R[L])}),_=Ae(S);if(D===void 0&&W.every((v,L)=>!v||!F(L))&&(D=I,_[E]=!0),D!==void 0&&I>D)if(!S.some(Boolean))_[E]=!0;else for(let v=0;v<q;v+=1)r[v]&&Ft(S,v,0)>0&&(_[v]=!0);let xe=W.map((v,L)=>v||_[L]);R=W,S=_,y.push(xe),A.push(S)}return[y,A,D]}let Sr=Ze==="morphogenesis"?Ps:Ls,go=[Sr(co,ya,0,wr[0],lt[0]),Sr(ya,uo,1,wr[1],lt[1]),Ze==="morphogenesis"?Sr(uo,co,2,wr[2],lt[2]):Ts(uo,co,lt[2])],_n=go.map(n=>n[0]),va=go.map(n=>n[1]);br=go[2][2]??0;let La=he.map(n=>n.reduce((r,p,y)=>p?M(r,Me[y]):r,0)),Pa=n=>{let r=ye(0);return n.map(p=>{let y=p.map((A,R)=>A?r[R]+1:0);return r=y,y})},Ta=_n.map(Pa),Ds=bt?(()=>{let n=(D,E)=>{let N=0,F=0,I=0,U=0,O=0,W=0,_=d,xe=-1,v=d,L=-1;for(let P=0;P<q;P+=1){D[P]&&(N+=1,F+=B[P],I+=Y[P],_=z(_,B[P]),xe=M(xe,B[P]),v=z(v,Y[P]),L=M(L,Y[P]),(B[P]===0||B[P]===d-1||Y[P]===0||Y[P]===d-1)&&(U+=1));let V=le(d-1-B[P],Y[P]);(D[P]||D[V])&&(O+=1,D[P]!==D[V]&&(W+=1))}return{...E,centerOffset:N?K((_+xe)/2-g,(v+L)/2-g):g,massCenterOffset:N?K(F/N-g,I/N-g):g,edgeCells:U,symmetry:O?1-W/O:0}},r=(D,E)=>{let N=0,F=0;for(let I=0;I<q;I+=1)(D[I]||E[I])&&(F+=1),D[I]&&E[I]&&(N+=1);return F?N/F:1},p=(D,E)=>{let N=q,F=0,I=0,U=0,O=0,W=-1;return D.forEach((_,xe)=>{let v=0,L=0,P=0,V=0,de=D[M(0,xe-1)];for(let Ee=0;Ee<q;Ee+=1)_[Ee]&&(v+=1,(B[Ee]===0||B[Ee]===d-1||Y[Ee]===0||Y[Ee]===d-1)&&(L+=1),b(B[Ee]-g)<=2&&b(Y[Ee]-g)<=2&&(P+=1)),xe&&_[Ee]!==de[Ee]&&(V+=1);N=z(N,v),F=M(F,v),I=M(I,V),O=M(O,L),v||(U+=1),E===2&&W<0&&!P&&(W=xe)}),{frames:D.length,minimumActive:N,maximumActive:F,maximumDelta:I,emptyFrames:U,maximumEdgeCells:O,centerClearFrame:W,reemergeStart:E===2?br:-1}},y=he.map((D,E)=>n(D,ot[E])),A=r(he[0],he[1]),R=1-z(1,b(y[0].aspect-y[1].aspect)),S=1-z(1,b(y[0].active-y[1].active)/M(y[0].active,y[1].active,1));return{mint:mt,rarityTier:Ye,rarityRoll:ia,raritySignature:yn,stage:y,stageOverlap:[A,r(he[1],he[2]),r(he[2],he[0])],stageConfusion:R*.4+S*.25+A*.35,transitions:_n.map(p)}})():null,Gn=f.hold,Ar=f.transition,Mr=Gn+Ar,yo=Mr*he.length,on=Gt[1],Da=Gt[2],Na=Gt[3],Ns=`rgb(${Da.join(" ")} / 0.38)`,Fs=`rgb(${Na.join(" ")} / 0.36)`,wt=ye(0),$n=ye(0),zn=ye(0),Fa=ye(0),Ia=ye(!1),bn="",Yn,wn=Ge,bo=0,pe=null,It=null,qt=1,Oa=0,xr=Ge<0?0:Ge,Xn=null,Is=Ar/(st?mn.timeScale:1),Os=450,Ba=650;function Ua(n){return st?n*mn.timeScale:n}function Er(n,r){if(!n||n.length!==q)return Ae(r);let p=Te({length:q},(y,A)=>!!n[A]);return p.some(Boolean)?p:Ae(r)}function wo(n){let r=wt.map(p=>p>=.34);return r.some(Boolean)?r:Ae(n)}function Bs(n,r,p,y,A=!1){let R=Er(y,he[p]),S=R.reduce((O,W,_)=>W?M(O,Me[_]):O,0),D=n.reduce((O,W,_)=>W?M(O,Me[_]):O,0),E=(r+1)%he.length,N=n.every((O,W)=>O===he[r][W]),F=R.every((O,W)=>O===he[p][W]);if(N&&F&&p===E)return{frames:_n[r],locks:va[r],ages:Ta[r],targetBoard:R,targetRadius:S,sourceRadius:D,contracting:p===0&&(r!==0||!N)};let I=Sr(n,R,11+r*he.length+p,wr[r],lt[r]),U=A?Us(I[0],I[1],239+r*17+p*31):I;return{frames:U[0],locks:U[1],ages:Pa(U[0]),targetBoard:R,targetRadius:S,sourceRadius:D,contracting:p===0&&(r!==0||!N)}}function Us(n,r,p){let y=[Ae(n[0])],A=[Ae(r[0])],R=4;for(let S=0;S<n.length-1;S+=1){let D=n[S],E=n[S+1],N=r[S],F=r[S+1];for(let I=1;I<R;I+=1){let U=I/R,O=ye(!1),W=ye(!1);for(let _=0;_<q;_+=1){let v=D[_]!==E[_]&&ke(_,p+S*7,251)<U;O[_]=v?E[_]:D[_],W[_]=O[_]&&(v?F[_]:N[_])}y.push(O),A.push(W)}y.push(Ae(E)),A.push(Ae(F))}return[y,A]}function Rr(n,r,p=!1,y,A,R=!1,S=!1){let D=Er(y,he[n]),E=Bs(D,n,r,A,S);Xn=null,pe={id:Oa+=1,phase:"transition",source:n,target:r,enterCycle:p,holdTarget:R,fieldBridge:S,startedAt:void 0,...E},Ge=n,Ut=0,It=-1,qt=0,wn=-2,bn=""}function Hs(n,r,p,y,A=null,R=!1){Xn=A,pe={id:Oa+=1,phase:"settle",source:n,stage:r,target:p,heldBoard:A,fieldBridge:R,enterCycle:!1,startedAt:y},Ge=r,Ut=-1,It=n,qt=0,wn=-2,bn=""}function Ws(n){if(pe===null)return;pe.startedAt??(pe.startedAt=n);let r=M(0,n-pe.startedAt);if(pe.phase==="transition"){let A=$(r/Is),R=pe.source;if(Ge=R,Ut=A,It=-1,qt=Je($(r/Os)),A<1)return;let S=pe.target,D=pe.holdTarget?pe.targetBoard:null;if(pe.enterCycle){pe=null,Ge=-1,Ut=-1,bo=S*Mr-Ua(n),It=null,qt=1,wn=-2,bn="";return}Hs(R,S,pe.target,n,D,pe.fieldBridge);return}if(Ge=pe.stage,Ut=-1,It=pe.source,qt=Je($(r/Ba)),r<Ba)return;let p=pe.stage,y=pe.heldBoard;pe=null,It=null,qt=1,Xn=y,Ge=p,Ut=-1}Se(),i.addEventListener("resize",Se);function Ha(n,r,p,y,A){n.beginPath(),n.roundRect(r,p,y,y,A),n.fill()}function _s(){let n=be/d,r=M(1,n*.12),p=M(.5,n-r),y=r/2;m.clearRect(0,0,be,be),m.globalAlpha=.045,m.fillStyle=`rgb(${on.join(" ")})`,m.shadowBlur=0;for(let A=0;A<q;A+=1)Ha(m,B[A]*n+y,Y[A]*n+y,p,z(f.cornerSize*n/19,p*.2));m.globalAlpha=1}function Cr(n){let r=1-n;if(f.kineticFamily===1)return Je(n);if(f.kineticFamily===2)return ee(n,1.35);if(f.kineticFamily===3)return 1-ee(r,1.35);if(f.kineticFamily===4)return n-ne(n*Q*2)*.025;if(f.kineticFamily===5)return n-ne(n*Q*4)*.014-ne(n*Q*8)*.005;if(f.kineticFamily===6){let p=ee(n,2.1),y=ee(r,2.1);return p/M(1e-4,p+y)}return f.kineticFamily===7?n-ne(n*Q*8)*.008-ne(n*Q*14)*.004:n}function Wa(n,r){return r===4?ee(M(0,n),5)*1.45-.18+ee(M(0,-n),9)*.38:r===7?n*.58+(2*n*n-1)*.42:n}function _a(n){Ws(n);let r=Ua(n),y=((r+bo)%yo+yo)%yo,A=Ge<0?T(y/Mr):Ge;xr=A;let R=Ge>=0&&Ut>=0,S=Ze==="morphogenesis"&&Rt>=0&&Ge>=0&&!R,D=Ge>=0&&!R,E=S?(A+he.length-1)%he.length:A,N=lt[E],F=E===2&&Ze==="morphogenesis",I=F?ma:io[E],U=F?ms:hs[E];A!==wn&&(t.onStageChange?.(Bn[A],A),wn=A);let O=1450,W=1100,_=r%(O+W),xe=Ge<0?y-A*Mr:R?Gn+Ut*Ar:0,v=Xn||he[A],L=S?_<O:xe<Gn,P=v,V=v,de=v,Ee=v,at=v,ie=v,Ce=1,J=0,oe=0,Be=0,Re=Yn===void 0?1/60:z((n-Yn)/1e3,.05);if(!L){let j=pe?.phase==="transition"?pe:null,ze=j?.frames||_n[E],it=j?.locks||va[E],ht=ze.length-1;J=S?(_-O)/W:(xe-Gn)/Ar,Be=S?Ct-6+Je($(J))*6:Cr($(J))*ht,oe=z(T(Be),ht-1),P=ze[oe],V=ze[oe+1],de=ze[M(0,oe-1)],Ee=ze[z(ht,oe+2)],at=it[oe],ie=it[oe+1],Ce=Be-oe}let Ne=`${pe?.id||0}:${A}:${E}:${oe}:${L}`;if(Ne!==bn){for(let j=0;j<q;j+=1){let ze=I[j]/M(1,De),it=ke(j,oe,E+31);Fa[j]=L?0:(N.captureMode===0?ze:N.captureMode===3?k(ze*5)/5:N.captureMode===5?Y[j]/(d-1)*.72+it*.28:N.captureMode===6?(Math.atan2(Y[j]-g,B[j]-g)/(Q*2)+1)%1:it)*f.stagger,Ia[j]=!L&&ke(j,oe,E)>.74}bn=Ne}let Xe=r/1e3,ct=f.pulseRate*(.9+N.variant*.07),St=ne(Xe*ct),jt=x(Xe*ct),ut=(E+he.length-1)%he.length,je=It===null?ut:It,kt=je<0?N:lt[je],dt=f.pulseRate*(.9+kt.variant*.07),Sn=ne(Xe*dt),X=x(Xe*dt),te=It!==null?qt:Ge<0&&L?Je($(xe/z(650,Gn*.5))):1,me=-10,Ie=0,ft=-10,Qe=0;if(!L){let j=pe?.phase==="transition"?pe.target:null,ze=pe?.phase==="transition"?pe.targetRadius:La[S?A:j??(A+1)%he.length],it=pe?.phase==="transition"?pe.sourceRadius:La[A],ht=pe?.phase==="transition"&&pe.contracting;if(A===2&&Ze==="validated"){let vt=$(Be/yr),Lt=M(0,Be-br),G=1-We($((Lt-ze)/M(1,Ct-br-ze)));me=vt*(De+1.5),Ie=1-We($((Be-yr+2)/2)),ft=z(Lt,ze),Qe=We($(Lt))*G}else{let vt=Cr($(J)),Lt=ee(M(0,ne($(J)*Q)),.72);me=ht?M(it,ze+1)*(1-vt):vt*De,Ie=Lt*.76,ft=ht?ze+(M(it,ze+1)-ze)*(1-vt):vt*ze,Qe=Lt}}let ve=Te({length:H(De*Fe)+1},(j,ze)=>{let it=ze/Fe;return $(Z(-ee((it-me)/f.outgoingWidth,2))*Ie+Z(-ee((it-ft)/f.incomingWidth,2))*Qe)}),fe=be/d,Oe=M(1,fe*.12),Ke=M(.5,fe-Oe),$t=Oe/2,qn=fe/19;u.clearRect(0,0,be,be),u.globalAlpha=1,u.drawImage(l,0,0,l.width,l.height,0,0,be,be);for(let j=0;j<q;j+=1){let ze=P[j]?1:0,it=V[j]?1:0,ht=Fa[j],vt=L?1:Je($((Ce-ht)/(1-ht))),Lt=ze+(it-ze)*vt,G=L?0:(de[j]?(1-Ce)*f.trail:0)+(Ee[j]?Ce*f.trail:0),ge=M(Lt,G),Ue=!P[j]&&V[j],Ot=!at[j]&&ie[j],Le=P[j]!==V[j],Pt=L?99:(pe?.phase==="transition"?pe.ages:Ta[E])[oe+1][j],Kt=Ue?Z(-M(0,Pt-1)*.55):0,At=Le?ne(Q*vt):0,An=ze&&!it?ne(Q*vt)*.72:0,et=ve[U[j]],jn=$(Kt*At*.72+(Ot?At*.56:0)+(Le&&Ia[j]?At*.16:0)+(Le?et*.18:0)-An,-1,1),Mn=pe?.fieldBridge===!0,Lr=Mn?ge>=wt[j]?68:46:ge>=wt[j]?108:72,Kn=Mn?ge>=wt[j]?14:11:ge>=wt[j]?18:15;$n[j]+=(ge-wt[j])*Lr*Re,$n[j]*=Z(-Kn*Re),wt[j]+=$n[j]*Re,wt[j]=$(wt[j],0,1.08),zn[j]+=(jn-zn[j])*(1-Z(-7*Re));let an=$(wt[j]),Zt=$(zn[j],-1,1),Pr=St*da[E][j]+jt*ua[E][j],xn=Wa(Pr,N.pulseMode),sn=D?0:f.pulseDepth*(N.pulseMode===3?.18:1);if(te<1){let nl=Sn*da[je<0?E:je][j]+X*ua[je<0?E:je][j],Ja=Wa(nl,kt.pulseMode),ei=je<0?0:f.pulseDepth*(kt.pulseMode===3?.18:1);xn=Ja+(xn-Ja)*te,sn=ei+(sn-ei)*te}let Tr=1-sn*.28+xn*sn,Dr=ha[j],Co=.5+ne(Xe*gr[j]+Dr)*.5,Vs=.5+ne(Xe*gr[j]*.43+Dr*1.71+Me[j]*.31)*.5,qs=1-ao[j]*(Co*.76+Vs*.24),js=$(an*fa[j]*(.92*Tr+et*.08+At*f.flutter)*qs),ko=Zt>=0?Da:Na,vo=b(Zt)*$(an*1.25),Ks=k(on[0]+(ko[0]-on[0])*vo),Zs=k(on[1]+(ko[1]-on[1])*vo),Qs=k(on[2]+(ko[2]-on[2])*vo);if(an<.004
(()=>{var rl=Object.defineProperty;var ol=(t,e,o)=>e in t?rl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var ae=(t,e,o)=>ol(t,typeof e!="symbol"?e+"":e,o);function Zn(t){let e=1779033703,o=3144134277,i=1013904242,u=2773480762;for(let l=0;l<t.length;l+=1){let m=t.charCodeAt(l);e=o^Math.imul(e^m,597399067),o=i^Math.imul(o^m,2869860233),i=u^Math.imul(i^m,951274213),u=e^Math.imul(u^m,2716044179)}return e=Math.imul(i^e>>>18,597399067),o=Math.imul(u^o>>>22,2869860233),i=Math.imul(e^i>>>17,951274213),u=Math.imul(o^u>>>19,2716044179),[(e^o^i^u)>>>0,(o^e)>>>0,(i^e)>>>0,(u^e)>>>0]}function zt(t){let[e,o,i,u]=Zn(t);return()=>{let l=e+o+u>>>0;return u=u+1>>>0,e=o^o>>>9,o=i+(i<<3)>>>0,i=(i<<21|i>>>11)+l>>>0,l/4294967296}}var ti=421614,Po=Object.freeze(["Common","Uncommon","Rare","Relic","Mythic","Apotheosis"]);function Nr(t){return t<.0025?5:t<.015?4:t<.05?3:t<.15?2:t<.35?1:0}function To(t,e){return Nr(zt(`${String(t).slice(34)}:${String(e)}`)())}function Qn(t,e,o=!1){let i=String(t).replace(/^0x/,"").toLowerCase().padStart(64,"0").slice(-64),u=23e6+Number(BigInt(`0x${i.slice(0,12)}`)%10000000n),l=new URLSearchParams({token:String(Math.max(1,Math.min(1e4,Math.trunc(e)))),chain:String(ti),block:String(u),minter:`0x${i.slice(0,40)}`,hash:`0x${i}`});return o&&l.set("analysis","1"),`?${l}`}var Fr="phenotype-v18-holometa",se=31,Do=Object.freeze([31,31,31,31,31,31]),ln=0,En=1e4,Ir=Object.freeze(["caterpillar","pupa","butterfly"]),Jn=Object.freeze(["Resonance","Whisper","Halo"]),ri=Object.freeze(["Quiescent","Deliberate","Vital","Restless","Nervous"]),ni=Object.freeze([{timeScale:.48,lifeRate:.22,lifeDepth:.28},{timeScale:.82,lifeRate:.68,lifeDepth:.72},{timeScale:.94,lifeRate:.86,lifeDepth:1.02},{timeScale:1.12,lifeRate:1.26,lifeDepth:1.12},{timeScale:1.2,lifeRate:1.52,lifeDepth:1.28}]),al=Object.freeze([[0,1,3,6,2,1,0],[0,1,1,2,2,1,0],[0,1,3,7,7,3,0]]),il=Object.freeze([[1,1,1],[.58,.5,.42],[1.38,1.32,1.24]]);function oi(t){return Do[Math.max(0,Math.min(Do.length-1,t|0))]}function sl(t,e){let o=new URLSearchParams(t.search===void 0?e.location.search:t.search),i=Number.parseInt(o.get("token")||"1",10),u=Math.max(ln,Math.min(En,Number.isFinite(i)?i:1)),l=Number.parseInt(o.get("chain")||"1",10),m=o.get("seed")||"",w=m?`${l}:${m}:${u}`:`${l}:${u}`,a=(h,C)=>{let b=zt(`ethereum:${w}:${h}`),H="";for(;H.length<C*2;)H+=Math.floor(b()*4294967296).toString(16).padStart(8,"0");return H.slice(0,C*2)},s=o.get("minter")||`0x${a("minter",20)}`,c=o.get("hash")||`0x${a("block",32)}`;return u===ln&&o.get("audit")!=="1"?0:To(c,s)}function er(t={}){let e=t.canvas;if(!e)throw new TypeError("mountArtEngine requires a canvas");let o=e.ownerDocument,i=o.defaultView,u=e.getContext("2d");if(!u)throw new Error("The art engine requires a 2D canvas context");let l=o.createElement("canvas"),m=l.getContext("2d"),w=t.rootElement||o.documentElement,a=t.surfaceElement||o.body,s=t.navigate||(n=>{i.location.search=n.toString()}),c=sl(t,i),d=oi(c),h=(d-1)/(se-1),C=(se-1)/2,{abs:b,ceil:H,cos:x,exp:Z,floor:T,hypot:K,max:M,min:z,pow:ee,round:k,sin:ne,PI:Q}=Math,g=T(d/2),q=d*d,ye=n=>Array(q).fill(n),Ae=n=>n.slice(),Te=Array.from,B=Te({length:q},(n,r)=>r%d),Y=Te({length:q},(n,r)=>T(r/d)),Ve=Te({length:q},(n,r)=>M(b(B[r]-g),b(Y[r]-g))),Me=Te({length:q},(n,r)=>K(B[r]-g,Y[r]-g)),De=K(g,g),we=M(1,k(h)),Fe=4,be=0,Pe=1;function Se(){let n=e.getBoundingClientRect(),r=Number.isFinite(t.maxPixelRatio)?M(.5,t.maxPixelRatio):2;Pe=z(i.devicePixelRatio||1,r),be=n.width,e.width=k(be*Pe),e.height=k(be*Pe),u.setTransform(Pe,0,0,Pe,0,0),l.width=e.width,l.height=e.height,m.setTransform(Pe,0,0,Pe,0,0),_s()}let $=(n,r=0,p=1)=>z(p,M(r,n)),We=n=>n*n*(3-2*n),Je=n=>n*n*n*(n*(n*6-15)+10),le=(n,r)=>r*d+n,ce=new URLSearchParams(t.search===void 0?i.location.search:t.search),_e=ce.get("embed")==="1",bt=ce.get("audit")==="1",Dt=ce.get("analysis")==="1",st=!0,Ze=ce.get("transition")==="validated"?"validated":"morphogenesis";w.classList.toggle("embed",_e);let Nt=parseInt(ce.get("token")||"1",10),nt=$(Number.isFinite(Nt)?Nt:1,ln,En),Bn=Ir,ea=(ce.get("stage")||"").toLowerCase(),Ge=Bn.indexOf(Bn[parseInt(ea,10)-1]||ea),ta=parseFloat(ce.get("progress")||""),Ut=Number.isFinite(ta)?$(ta):-1,eo=parseInt(ce.get("chain")||"1",10),to=ce.get("seed")||"",Hi=to?`${eo}:${to}:${nt}`:`${eo}:${nt}`,na=(n,r)=>{let p=zt(`ethereum:${Hi}:${n}`),y="";for(;y.length<r*2;)y+=T(p()*4294967296).toString(16).padStart(8,"0");return y.slice(0,r*2)},mt={chainId:eo,tokenId:nt,blockNumber:parseInt(ce.get("block")||`${23e6+nt*17}`,10),minter:ce.get("minter")||`0x${na("minter",20)}`,blockHash:ce.get("hash")||`0x${na("block",32)}`},ra=[mt.chainId,mt.tokenId,mt.blockNumber,mt.minter,mt.blockHash].join(":"),gt=nt===ln&&!bt,Ht=n=>zt(`${ra}|${n}`),Wt=Ht("experimental-temperament")()<.012?0:1+T(Ht("experimental-temperament-family")()*(ni.length-1)),Wi=ri[Wt],mn=ni[Wt],_i=Ht("color"),yt=Ht("caterpillar"),rt=Ht("pupa"),$e=Ht("butterfly"),Mt=Ht("motion"),Gi=Ht("rarity"),xt=Zn(`${ra}|texture`),_t=zt(`${mt.blockHash.slice(0,34)}:${mt.blockNumber}`),Et=zt(`${mt.blockHash.slice(34)}:${mt.minter}`),$i=["Segmented","Crowned","Ribbed","Orbital","Veined","Hollow"],xc=["Axial","Lantern","Hourglass","Braided","Spindle","Mantled","Orbital","Totemic"],zi=["Dead edge","Toroidal","Reflective"],Yi=["Radial","Diamond","Elliptic","Cross","Spiral","Bilateral","Axial","Cellular"],Xi=["Gentle","Branching","Elastic","Lockstep","Tendril","Cascade","Orbit","Flicker"],Vi=["Bloom","Tidal","Spiral","Burst","Pinwheel","Shear","Orbit","Scatter"],qi=["Breath","Ripple","Alternating","Quiet","Heartbeat","Shimmer","Traveling","Flicker"],ji=["Flow","Viscous","Accelerando","Decelerando","Tidal","Heartbeat","Suspended","Turbulent"],dr=[[[0,0,0,0],[2,0,0,1],[0,1,1,0],[1,0,0,5]],[[2,2,1,1],[0,2,0,0],[5,5,1,6],[1,2,5,1]],[[0,1,3,4],[1,4,0,4],[6,5,5,6],[2,1,3,0]],[[2,0,0,0],[5,4,5,5],[0,2,1,1],[1,0,6,0]],[[2,5,1,1],[5,5,1,6],[0,2,5,1],[1,5,0,0]],[[1,3,0,4],[0,1,3,4],[3,3,4,2],[2,2,0,4]],[[5,4,5,5],[6,5,6,6],[2,0,1,3],[0,4,2,5]],[[4,6,4,6],[7,4,7,5],[3,3,4,2],[4,7,2,7]]],Ki=["Electric","Carbon","Cerise","Aegean","Ultraviolet","Viridian","Ember","Graphite"],Zi=["Beaded","Sawtooth","Fusiform","Undulant","Alternating","Crowned","Tapered","Armored","Diamond","Ribbed"],Qi=["Solid","Hollow core","Shell","Checkered","Segmented","Notched","Mottled","Striated"],Ji=["None","Spines","Articulated legs","Cilia","Crest"],es=["Oval","Diamond","Shouldered","Waisted","Ribbed","Mantled","Winged","Bilobed","Slender","Pendant"],ts=["Mottled","Ribbed","Banded","Checkered","Windowed","Lattice","Slitted","Sparse"],ns=["Belts","Full belts","Alternating belts","Crest belt","Crest","Forked tail","Side nodes","Diadem"],rs=["Classic","Swallowtail","Highwing","Longtail","Crescent","Ringed","Scalloped","Splitwing","Compact","Imperial"],os=["Mottled","Orbital","Double ring","Banded","Checkered","Lattice","Eyespot","Upper field","Lower field","Sparse"],as=Po,gn=["Crowned","Armored","Expanded","Tailed"],oa=["Dragonfly","Imperial","Split-wing","Totem"],aa=["Seraph","Atlas","Wraith","Needlewing"],ia=Et(),Ye=gt?6:Nr(ia);if(!gt&&Ye!==c)throw new Error("Rarity preview diverged from the generation stream");let Un=T(Gi()*gn.length),Hn=xt[1]%oa.length,fr=(xt[2]+nt*2)%aa.length,re={lineage:T(_t()*$i.length),crown:T(_t()*4),architecture:T(_t()*8),rhythm:T(_t()*6),openness:_t(),elongation:_t(),lateral:_t(),branching:_t(),ornament:_t()},no=T(Et()*dr.length),sa=T(Et()*dr[no].length),hr=dr[no][sa],la=[["#0021e8",[255,255,255],[255,244,222],[211,229,255]],["#111318",[242,244,248],[255,170,145],[128,220,255]],["#9d174d",[255,247,237],[253,224,71],[165,205,255]],["#075985",[240,253,250],[251,191,36],[216,180,254]],["#43146f",[250,250,255],[255,155,118],[114,226,255]],["#07513f",[239,255,246],[255,205,112],[148,220,255]],["#c2410c",[255,247,237],[254,240,138],[186,220,255]],["#18181b",[244,244,245],[244,114,182],[103,232,249]]],f={family:T(_i()*la.length),rarityTier:Ye,lineage:re.lineage,caterpillarStyle:(T(yt()*10)+re.architecture)%10,caterpillarPattern:(T(yt()*8)+re.rhythm)%8,appendageStyle:T(yt()*5),caterpillarLength:10+T((yt()*.58+re.elongation*.42)*17),caterpillarRadius:1+T((yt()*.68+re.lateral*.32)*5),segmentCount:2+z(7,re.rhythm+T(yt()*4)),segmentDepth:.45+yt()*1.75,bodyPhase:yt()*Q*2,taperPower:.8+yt()*3.8,hollowSegments:yt()*.55+re.openness*.45>.42,legReach:1,headSize:1+T(yt()*2),spineLength:T(yt()*2)+(Ye>=3?1:0),segmentGap:.12+yt()*.3,pupaStyle:(T(rt()*10)+re.architecture+re.crown)%10,pupaPattern:(T(rt()*8)+re.rhythm)%8,pupaAccent:T(rt()*8),pupaBelts:1+T(rt()*5),pupaHeight:10+T((rt()*.58+re.elongation*.42)*17),pupaWidth:2+T((rt()*.62+re.lateral*.38)*7),pupaPower:.8+rt()*3.8,pupaRoundness:.45+rt()*2.25,shoulderSpan:2+T((rt()*.58+re.branching*.42)*10),shoulderStrength:.25+rt()*1.75,shoulderY:-.72+rt()*.52,shoulderSpread:.08+rt()*.3,shoulderSlope:-.15+rt()*1.15,pupaHoles:.06+(rt()*.52+re.openness*.48)*.38,pupaRibs:2+z(6,re.rhythm+T(rt()*3)),pupaWaist:rt()*1.35,hornLength:T(rt()*4)+(re.crown>2?1:0),wingStyle:(T($e()*10)+re.architecture)%10,wingPattern:(T($e()*10)+re.rhythm)%10,wingSpan:7+T(($e()*.58+re.lateral*.42)*8),upperWingX:.38+$e()*.2,upperWingWidth:.44+$e()*.2,upperWingY:C-7+$e()*2.5,upperWingHeight:3.5+$e()*3,upperExponent:1.4+$e()*3.4,lowerWingX:.32+$e()*.23,lowerWingWidth:.4+$e()*.22,lowerWingY:C+2+$e()*3,lowerWingHeight:3+$e()*2.8,lowerExponent:1.35+$e()*3.35,wingHoles:.16+($e()*.54+re.openness*.46)*.42,wingNotch:$e()*.58,veinSlope:-.42+$e()*.84,wingLobes:1+z(5,T($e()*3+re.branching*3)),lobeDepth:$e()*.25,wingBands:1+z(4,T($e()*2+re.rhythm*.62)),bodyLength:12+T(($e()*.58+re.elongation*.42)*13),bodyWidth:$e()<.18?1:0,tailLength:1+T(($e()*.6+re.ornament*.4)*6)+(Ye>=3?1:0),antennaLength:1+T(($e()*.58+re.branching*.42)*8)+(re.crown>2?1:0),mutation:$e()<.18?1+T($e()*4):0,lifeA:8+T(Mt()*10),lifeB:8+T(Mt()*10),exitGenerations:23+T(Mt()*10),pulseRate:1.45+Mt()*2.25,stagger:.06+Mt()*.16,trail:.08+Mt()*.15,outgoingWidth:.62+Mt()*.62,incomingWidth:.72+Mt()*.62,cornerSize:1.5+Mt()*2.5,hold:1e3+T(Mt()*700),transition:3500+T(Mt()*1250),generationCount:40+T(Et()*7),pulseDepth:.025+Et()*.025,kineticFamily:no,kineticVariant:sa,kineticDirection:Et()<.5?-1:1,kineticPhase:Et()*Q*2,flutter:.025+Et()*.045,boundaryMode:T(Et()*zi.length),waveMode:hr[0],captureMode:hr[1],departureMode:hr[2],pulseMode:hr[3],cellPhase:Et()*Q*2,cellVariance:.35+Et()*.65,noise:xt[0]^xt[1]},pr=n=>{f.appendageStyle=[4,1,f.appendageStyle,2][n],f.pupaAccent=[4,6,f.pupaAccent,5][n],f.spineLength+=n===1,f.hornLength+=n===0,f.antennaLength+=n===0||n===3,f.wingLobes+=n===1,f.caterpillarRadius=z(5,f.caterpillarRadius+(n===2)),f.pupaWidth=z(8,f.pupaWidth+(n===2)),f.wingSpan=z(C-1,f.wingSpan+(n===2)),f.tailLength+=n===3},yn="Canonical";if(!gt&&Ye){if(pr(Un),yn=gn[Un],Ye>=2){let n=(Un+1)%gn.length;pr(n),f.mutation=M(1,f.mutation),yn+=` + ${gn[n]}`}Ye>=4&&pr((Un+2)%gn.length),Ye>=5&&pr((Un+3)%gn.length),Ye===3?(yn=oa[Hn],Hn===1?(f.wingStyle=9,f.wingPattern=6,f.wingSpan=C-1,f.upperWingHeight*=1.22,f.lowerWingHeight*=1.2):Hn===2?(f.wingStyle=7,f.wingPattern=5,f.wingSpan=12,f.pupaStyle=6,f.appendageStyle=4,f.antennaLength+=2):Hn===3&&(f.wingStyle=8,f.wingSpan=8,f.bodyLength=26,f.tailLength+=5,f.pupaStyle=9,f.caterpillarStyle=5)):Ye===4?(yn=aa[fr],fr===0?(f.wingStyle=7,f.wingPattern=2,f.wingSpan=C-1,f.wingLobes=6,f.pupaStyle=6,f.appendageStyle=4,f.antennaLength+=4):fr===1?(f.wingStyle=9,f.wingSpan=C-1,f.upperWingHeight*=1.55,f.lowerWingHeight*=1.5,f.bodyWidth=1,f.pupaStyle=5,f.caterpillarStyle=7):fr===2?(f.wingStyle=5,f.wingPattern=9,f.wingHoles=.72,f.pupaPattern=4,f.caterpillarPattern=1):(f.wingStyle=8,f.wingSpan=10,f.bodyLength=26,f.tailLength+=8,f.pupaStyle=9,f.caterpillarStyle=2)):Ye===5&&(yn="Prime Metamorph",Object.assign(f,{caterpillarLength:M(22,f.caterpillarLength),pupaHeight:M(22,f.pupaHeight),pupaWidth:M(6,f.pupaWidth),wingSpan:M(12,f.wingSpan),wingLobes:M(5,f.wingLobes),bodyLength:M(20,f.bodyLength),generationCount:46,flutter:M(.07,f.flutter)}),f.upperWingHeight*=1.18+xt[0]%4*.08,f.lowerWingHeight*=1.18+xt[1]%4*.08,f.antennaLength+=3+xt[2]%6,f.tailLength+=3+xt[3]%6)}if(!gt&&h>1){let n=r=>M(1,k(r*h));f.caterpillarLength=n(f.caterpillarLength),f.pupaHeight=n(f.pupaHeight),f.shoulderSpan=n(f.shoulderSpan),f.wingSpan=z(g-we,n(f.wingSpan)),f.upperWingY=g+(f.upperWingY-C)*h,f.upperWingHeight*=h,f.lowerWingY=g+(f.lowerWingY-C)*h,f.lowerWingHeight*=h,f.bodyLength=n(f.bodyLength),f.tailLength=n(f.tailLength),f.antennaLength=n(f.antennaLength),f.cornerSize*=h,f.segmentCount+=Ye*2,f.pupaRibs+=Ye*2,f.pupaBelts+=T(Ye/2),f.wingLobes+=Ye,f.wingBands+=T((Ye+1)/2),f.lifeA+=Ye*4,f.lifeB+=Ye*4,f.exitGenerations+=Ye*7,f.generationCount+=Ye*8}gt&&Object.assign(f,{family:0,lifeA:12,lifeB:12,exitGenerations:32,generationCount:42,pulseRate:2.4,pulseDepth:.035,stagger:.14,trail:.15,outgoingWidth:.95,incomingWidth:1.08,cornerSize:3,hold:1600,transition:4200,kineticFamily:0,kineticVariant:0,kineticDirection:1,kineticPhase:0,flutter:.08,boundaryMode:0,waveMode:0,captureMode:0,departureMode:0,pulseMode:0,cellPhase:0,cellVariance:0,noise:0});let lt=[f.kineticVariant,(f.kineticVariant+1+xt[0]%3)%4,(f.kineticVariant+2+xt[1]%3)%4].map((n,r)=>{let p=r?dr[f.kineticFamily][n]:[f.waveMode,f.captureMode,f.departureMode,f.pulseMode];return{variant:n,waveMode:p[0],captureMode:p[1],departureMode:p[2],pulseMode:p[3]}}),is=!gt&&Ye===3&&Hn===0,Gt=la[f.family];a.style.background=Gt[0],t.updateTitle!==!1&&(o.title=`Metamorphosis #${nt}`),e.setAttribute("aria-label",`Generative metamorphosis token ${nt}`);let ke=(n,r,p)=>{let y=ne((n+17.31)*127.1+r*311.7+p*91.9+f.noise*.731)*43758.5453;return y-T(y)},mr=parseInt(ce.get("echo")||"",10),ro=Ht("completion-pulse")(),ss=ro<.012?0:ro<.02?1:ro<.024?2:-1,Rt=Number.isFinite(mr)&&mr>=0&&mr<Jn.length?mr:ss,oo=Rt<0?"None":Jn[Rt],ca=(n,r)=>Te({length:q},(p,y)=>{if(gt)return y*.11;let A=B[y]-g,R=Y[y]-g,S=0;return n===1?S=Me[y]*.58:n===2?S=(B[y]+Y[y])%2*Q:n===4?S=Me[y]*.12:n===5?S=ke(y,239+r,107)*Q*2:n===6?S=(A*.48+R*.22)*f.kineticDirection:n===7&&(S=ke(y,241+r,109)*Q*2+Me[y]*.32),f.cellPhase+ke(y,211+r,71)*Q*2*f.cellVariance+S}),ua=lt.map((n,r)=>ca(n.pulseMode,r).map(ne)),da=lt.map((n,r)=>ca(n.pulseMode,r).map(x)),fa=Te({length:q},(n,r)=>gt?1:.93+ke(r,223,73)*.14),ha=Te({length:q},(n,r)=>{let p=le(d-1-B[r],Y[r]),y=z(r,p),A=ke(y,251,83)*Q*2;return st?Wt===0?A*.24:Wt===1?A*.58:Wt===2?f.kineticPhase+Me[r]*.46:Wt===4?A+(B[r]+Y[r])%2*Q*.62:A+Me[r]*.16:A}),ls=Te({length:q},(n,r)=>{let p=le(d-1-B[r],Y[r]),y=.65+ke(z(r,p),257,89)*.9;return st?y*mn.lifeRate:y}),cs=Te({length:q},(n,r)=>{let p=le(d-1-B[r],Y[r]),y=.035+ke(z(r,p),263,97)*.045;return st?z(.12,y*mn.lifeDepth):y}),gr=ls.map(n=>st&&Wt!==0?n*2.4:n),ao=cs.map(n=>st?Wt===0?z(.08,n*2.2+.025):z(.46,n*3.8+.085):n),us=Object.freeze({phase:ha,rate:gr,depth:ao,gain:fa,timeScale:st?mn.timeScale:1}),ds=Te({length:q},(n,r)=>gt?0:(ke(r,227,79)-.5)*.06),fs=(n,r,p)=>{let y=B[n]-g,A=Y[n]-g,R=b(y),S=b(A),D=K(R,S);if(r===1)return R+S;if(r===2)return K(R*.72,S*1.28);if(r===3)return M(R,S)+z(R,S)*.28;if(r===4){let E=Math.atan2(A,y);return M(0,D+ne(E*3*f.kineticDirection+D*.78+f.kineticPhase)*.9)}return r===5?R*.34+S*1.16:r===6?S*.28+R*1.22:r===7?M(0,D+(ke(n,251+p,83)-.5)*2.4):D},io=lt.map((n,r)=>{let p=Te({length:q},(A,R)=>fs(R,n.waveMode,r)),y=M(...p);return p.map(A=>A/M(1,y)*De)}),hs=io.map(n=>n.map(r=>k(r*Fe))),pa=Te({length:q},(n,r)=>K((B[r]-g)*1.52,(Y[r]-g)*.58)),ps=M(...pa),ma=pa.map(n=>n/M(1,ps)*De),ms=ma.map(n=>k(n*Fe)),Rc=Me;function ue(n,r,p){r>=we&&r<d-we&&p>=we&&p<d-we&&(n[le(r,p)]=!0)}function ga(n){let r=ye(!1),p=[le(g,g)];for(r[p[0]]=!0;p.length;){let y=p.pop(),A=B[y],R=Y[y];for(let S=-1;S<=1;S+=1)for(let D=-1;D<=1;D+=1){let E=A+D,N=R+S;if((D||S)&&E>=0&&E<d&&N>=0&&N<d){let F=le(E,N);n[F]&&!r[F]&&(r[F]=!0,p.push(F))}}}return n.map((y,A)=>y&&r[A])}function gs(n){let r=d,p=d,y=-1,A=-1;if(n.forEach((E,N)=>{E&&(r=z(r,B[N]),p=z(p,Y[N]),y=M(y,B[N]),A=M(A,Y[N]))}),y<0)return n;let R=k(g-(r+y)/2),S=k(g-(p+A)/2),D=ye(!1);return n.forEach((E,N)=>{E&&ue(D,B[N]+R,Y[N]+S)}),D}let so=n=>{let r=gs(ga(n));return r[le(g,g)]=!0,ga(r)};function ys(){let n=ye(!1),r=f.caterpillarStyle,p=f.caterpillarPattern,y=f.caterpillarLength,A=f.segmentCount,R=f.bodyPhase,S=f.segmentDepth,D=f.taperPower,E=k(g-(y-1)/2),N=M(2,y/A);for(let F=0;F<y;F+=1){let I=E+F,U=F/M(1,y-1),O=U*2-1,W=.5+.5*x(U*A*Q*2+R),_=ee(b(O),D),xe=Z(-ee((O+.82)/.22,2)),v=Z(-ee((O-.84)/.24,2)),L=U*A%1,P=1-b(L*2-1),V;r===0?V=f.caterpillarRadius+S*(W-.5)-_*.75:r===1?V=.7+f.caterpillarRadius*.35+P*(1.2+S):r===2?V=1+(f.caterpillarRadius+.8)*ee(M(0,1-b(O)),.45):r===3?V=1.25+f.caterpillarRadius*.45+x(U*Q*4+R)*.85:r===4?V=1.2+f.caterpillarRadius*.45+((F+T(R))%2?-.45:1):r===5?V=1+xe*(f.headSize+1.2)+(1-U)*f.caterpillarRadius*.55-v*.4:r===6?V=1+(1-U)*(f.caterpillarRadius+.8)+W*.55:r===7?V=2.2+W*S*.55-_*.45:r===8?V=.8+P*(f.caterpillarRadius+1.15):V=f.caterpillarRadius+.8-_*.25+(W>.62?.55:-.35),re.architecture===1?V+=Z(-ee(O/.34,2))*1.15:re.architecture===2?V+=(xe+v)*1.05-Z(-ee(O/.3,2))*.55:re.architecture===3?V+=x(U*Q*(4+re.rhythm)+R)*.58:re.architecture===4?V+=ee(M(0,1-b(O)),.38)*.82:re.architecture===5?V+=P*.72-.18:re.architecture===6?V+=ne(U*Q*2+R)*.48:re.architecture===7&&(V+=(F+re.rhythm)%3===0?.75:-.12);let de=$(k(V*h),1,k(5*h));for(let ie=0;ie<=de;ie+=1){let Ce=ie===0,J=ie<=1,oe=ie===de,Be=P>.72||F===0||F===y-1,Re=!0;p===1?Re=!(Ce&&I!==g&&F>1&&F<y-2&&W<.5):p===2?Re=J||oe||Be:p===3?Re=J||oe||(F+ie+r)%2===0:p===4?Re=J||oe||P>.82:p===5?Re=!(ie===1&&de>1&&F%3===1):p===6?Re=J||oe||ke(le(g-ie,I),131+F,41+r)>.48:p===7&&(Re=J||oe||(F+ie*2+r)%4<2),(Re||Ce&&(I===g||F===0||F===y-1))&&(ue(n,g-ie,I),ue(n,g+ie,I))}let Ee=P>.78&&b(O)<.8,at=F%M(2,k(N))===0;if(f.appendageStyle===1&&Ee)ue(n,g-de-1,I),ue(n,g+de+1,I);else if(f.appendageStyle===2&&at&&b(O)<.72){let ie=O<0?1:-1;ue(n,g-de-1,I),ue(n,g+de+1,I),ue(n,g-de-2,I+ie),ue(n,g+de+2,I+ie)}else f.appendageStyle===3&&Ee&&F%2===0&&(ue(n,g-de-1,I-1),ue(n,g+de+1,I-1))}if(!gt){let F=xt[3],I=1+F%3+T(Ye/2);for(let U=0;U<I;U+=1){let O=1+(F>>>U*7+2)%M(1,y-2),W=E+O,_=0;for(;_<g-2&&(n[le(g-_-1,W)]||n[le(g+_+1,W)]);)_+=1;ue(n,g-_-1,W),ue(n,g+_+1,W),F>>>U*5+1&1&&O<y-2&&(ue(n,g-_-1,W+1),ue(n,g+_+1,W+1))}}if(f.appendageStyle===4||r===5){let F=k((1+f.spineLength)*h);for(let I=1;I<=F;I+=1)ue(n,g-I,E-I),ue(n,g+I,E-I)}return so(n)}function bs(n){let r=ye(!1),p=f.pupaStyle,y=f.pupaPattern,A=n&&lo(n),R=A&&A.aspect<.65,S=$(k(f.pupaHeight*.82+(A?A.height*.18:f.pupaHeight*.18))-(R?1:0),k(9*h),k(26*h)),D=$(f.pupaWidth+(R?1:0),3,8),E=f.pupaPower,N=f.pupaRoundness,F=f.shoulderStrength,I=f.shoulderY,U=f.pupaRibs,O=k(g-(S-1)/2),W=O+(S-1)/2,_=S/2;for(let v=0;v<S;v+=1){let L=O+v,P=(L-W)/_,V=ee(M(0,1-ee(b(P),E)),N),de=F*Z(-ee((P-I)/f.shoulderSpread,2)),Ee=f.pupaWaist*Z(-ee(P/.24,2)),at=ee(M(0,1-b(P)),N),ie=ee(M(0,1-ee(b(P+.18),E)),N),Ce=V,J=de*.35;p===1?(Ce=at,J=de*.2):p===2?(Ce=ie,J=de):p===3?Ce=M(.18,V-Ee*.28):p===4?(Ce=ee(M(0,V),.65),J=0):p===5?(Ce=M(0,ie-M(0,P)*.25),J=de*1.18):p===6?(Ce=ee(M(0,1-b(P)),.34),J=de*.82):p===7?(Ce=M(Z(-ee((P+.34)/.42,2)),Z(-ee((P-.42)/.32,2))*.82),J=de*.18):p===8?(Ce=V*.58,J=de*.72):p===9&&(Ce=ee(M(0,1-ee(b(P-.16),1.45)),.62),J=de*.12),re.architecture===1?Ce+=Z(-ee(P/.34,2))*.22:re.architecture===2?Ce=M(.16,Ce-Z(-ee(P/.28,2))*.24):re.architecture===3?Ce+=x(P*Q*(3+re.rhythm))*.09:re.architecture===4?Ce=ee(M(0,Ce),.72):re.architecture===5?J*=1.28:re.architecture===6?Ce+=Z(-ee((b(P)-.48)/.2,2))*.16:re.architecture===7&&(Ce+=(v+re.rhythm)%3===0?.12:-.025);let oe=.5+.5*x(v/M(1,S-1)*U*Q*2),Be=$(k((.75+D*Ce+J+(p===4?(oe-.5)*.7:0))*h),1,k(10*h));for(let Re=0;Re<=Be;Re+=1){let Ne=Re>=Be-1,Xe=ke(le(g-Re,L),97,23)>f.pupaHoles,ct=oe>(p===4?.46:.78),St=p===1&&(Re+v)%3===0,jt=p===3&&b(P)<.24&&Re>1&&!Ne,ut=Re<=1,je=ut||Ne||!jt&&(ct||St||Xe);if(y===1)je=ut||Ne||oe>.62;else if(y===2)je=ut||Ne||v%M(2,k(S/U))===0;else if(y===3)je=ut||Ne||(v+Re+p)%2===0;else if(y===4){let kt=b(P)<.48&&Re>1&&Re<Be;je=ut||Ne||!kt}else if(y===5)je=ut||Ne||(b(P)*S+Re)%4<1.7;else if(y===6){let kt=v%3===1&&Re>1&&!Ne;je=ut||Ne||!kt}else y===7&&(je=ut||Ne||ke(le(g-Re,L),173+v,61+p)>.62);je&&(ue(r,g-Re,L),ue(r,g+Re,L))}}if(p===2||p===5||p===6){let v=W+I*_;for(let L=2;L<=f.shoulderSpan;L+=1){let P=k(v+f.shoulderSlope*(L-2));ue(r,g-L,P),ue(r,g+L,P),(p===5||p===6||F>1.45)&&(ue(r,g-L,P+1),ue(r,g+L,P+1))}}if(p===1||p===5||p===8){let v=k(f.hornLength*h);for(let L=1;L<=v;L+=1){let P=1+T(L/2),V=O-L;ue(r,g-P,V),ue(r,g+P,V)}}if(p===9){let v=k((1+T(f.hornLength/2))*h);for(let L=1;L<=v;L+=1)ue(r,g,O-L)}let xe=v=>{let L=0;for(let P=1;P<g;P+=1)r[le(g+P,v)]&&(L=P);return L};if(f.pupaAccent<=3)for(let v=1;v<=f.pupaBelts;v+=1){let L=k(O+v*(S-1)/(f.pupaBelts+1)),P=xe(L),V=f.pupaAccent!==2||v%2;if(P&&V){let de=f.pupaAccent===1||f.pupaAccent===3&&v===1?2:1;for(let Ee=1;Ee<=de;Ee+=1)ue(r,g-P-Ee,L),ue(r,g+P+Ee,L)}}else if(f.pupaAccent===4)ue(r,g-2,O-1),ue(r,g+2,O-1),ue(r,g-1,O),ue(r,g+1,O);else if(f.pupaAccent===5){let v=O+S;ue(r,g-1,v),ue(r,g+1,v),ue(r,g-2,v+1),ue(r,g+2,v+1)}else if(f.pupaAccent===6){let v=k(W-_*.34),L=k(W+_*.34);for(let P of[v,L]){let V=xe(P);ue(r,g-V-1,P),ue(r,g+V+1,P)}}else{let v=xe(k(W));for(let L=1;L<=2;L+=1)ue(r,g-v-L,k(W)-L),ue(r,g+v+L,k(W)-L)}return so(r)}function ws(n){let r=ye(!1),p=f.wingStyle,y=f.wingPattern,A=n&&lo(n),R=is,S=R?$(f.bodyLength+k(5*h),k(20*h),k(26*h)):$(k(f.bodyLength*.8+(A?A.height*.2:f.bodyLength*.2)),k(8*h),k(26*h)),D=R?$(f.wingSpan+k(h),k(10*h),g-we):f.wingSpan,E=R?g-7*h+(f.upperWingY-g+7*h)*.5:f.upperWingY,N=R?.58+f.upperWingX*.16:f.upperWingWidth,F=R?(.8+f.upperWingWidth*.65)*h:f.upperWingHeight,I=R?g+2*h+(f.lowerWingY-g-2*h)*.5:f.lowerWingY,U=R?.55+f.lowerWingX*.18:f.lowerWingWidth,O=R?(.75+f.lowerWingWidth*.55)*h:f.lowerWingHeight,W=R?1+f.wingLobes%2:f.wingLobes,_=R?.52:f.upperWingX,xe=R?.5:f.lowerWingX,v=[[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]],[L,P,V,de]=v[p];re.architecture===1?(L*=1.12,V*=.86):re.architecture===2?(L*=.86,V*=1.16):re.architecture===3?(L*=.82,V*=.78,P*=1.22,de*=1.18):re.architecture===4?(L*=1.16,V*=1.12,P*=.86,de*=.9):re.architecture===5?(P*=1.18,de*=.82):re.architecture===6?(L*=1.08,de*=1.15):re.architecture===7&&(P*=1.12,de*=1.12);for(let J=1;J<d-1;J+=1)for(let oe=1;oe<=D;oe+=1){let Be=1+f.lobeDepth*x((J-E)/F*W*Q+p),Re=1+f.lobeDepth*ne((J-I)/O*W*Q+p*.7),Ne=ee(b((oe-D*_)/(D*N*L*Be)),f.upperExponent)+ee(b((J-E)/(F*P)),f.upperExponent),Xe=ee(b((oe-D*xe)/(D*U*V*Re)),f.lowerExponent)+ee(b((J-I)/(O*de)),f.lowerExponent),ct=Ne<=1,St=Xe<=1,jt=(E+I)/2,ut=oe>D*(.74-f.wingNotch*.3)&&b(J-jt)<f.wingNotch*(p===6?3.2:2.5)*h,je=b(J-(E+.7+f.veinSlope*(oe-1)))<.58*h,kt=b(J-(I-.7-f.veinSlope*(oe-1)))<.58*h,dt=ct&&Ne>.76||St&&Xe>.76,Sn=M(k(2*h),k(7*h/f.wingBands)),X=(J+k(oe*(f.veinSlope+1.25))+p)%Sn===0,te=ke(le(g-oe,J),79,17),me=(J+oe+p)%2===0,Ie=ct&&Ne>.22&&Ne<.52||St&&Xe>.2&&Xe<.5,ft=ct&&Ne>.06&&Ne<.18||St&&Xe>.05&&Xe<.16,Qe=D*(.46+p%3*.08),ve=E+(p%2?.7:-.35),fe=K((oe-Qe)/(1.7*h),(J-ve)/(1.4*h))<1,Oe=oe===1||je||kt,Ke=Oe||dt||te>f.wingHoles;y===1||p===5?Ke=Oe||dt||Ie:y===2?Ke=Oe|