@fabi-play/engine 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fabi-play-engine.js +13 -13
- package/dist/fabi-play-engine.lite.js +11 -11
- package/dist/fabi-play-engine.lite.umd.js +1 -1
- package/dist/fabi-play-engine.lite.umd.min.js +1 -1
- package/dist/fabi-play-engine.umd.js +1 -1
- package/dist/fabi-play-engine.umd.min.js +1 -1
- package/dist/index.js +11 -11
- package/dist/integrity.json +7 -7
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fabi-play/engine 0.1.0 (full) | Fabi Play Kit License | https://docs.fabiplay.app */(function(wi,te){var Qe=typeof document<"u"?document.currentScript:null;typeof define=="function"&&define.amd?define([],function(){return te(Qe)}):typeof module=="object"&&module&&module.exports?module.exports=te(Qe):wi.FabiEngine=te(Qe)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(wi){"use strict";var te={exports:{}},Qe=te.exports,je=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,or=Object.getOwnPropertyNames,lr=Object.prototype.hasOwnProperty,hr=(t,e,s)=>e in t?je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,cr=(t,e)=>{for(var s in e)je(t,s,{get:e[s],enumerable:!0})},fr=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of or(e))!lr.call(t,n)&&n!==s&&je(t,n,{get:()=>e[n],enumerable:!(i=ar(e,n))||i.enumerable});return t},ur=t=>fr(je({},"__esModule",{value:!0}),t),d=(t,e,s)=>hr(t,typeof e!="symbol"?e+"":e,s),ki={};cr(ki,{AnimatedSprite:()=>ne,Atlas:()=>Ws,AvatarPainter:()=>ai,AvatarsNode:()=>Hn,BitmapFont:()=>oi,DEFAULT_FONT:()=>An,EASE:()=>Pe,Group:()=>Xs,HALO:()=>Ue,MAX_LAYERS:()=>Gs,NameTags:()=>ni,Node:()=>se,NodePool:()=>Kn,Particles:()=>Ji,STAGE_HEIGHT:()=>lt,Shape:()=>Oe,ShelfPacker:()=>tn,Sound:()=>Nn,Sprite:()=>de,TIERS:()=>Gt,Text:()=>Be,Timeline:()=>Gn,Tweens:()=>$n,avatarPortrait:()=>eo,blur:()=>al,brightness:()=>Zo,colorMatrix:()=>rl,contrast:()=>Jo,createAvatarRenderer:()=>to,createEngine:()=>Mo,createRenderer:()=>si,dropShadow:()=>ol,grayscale:()=>el,handsOf:()=>Fn,hits:()=>hi,hueRotate:()=>il,invert:()=>nl,nodePool:()=>pl,packColor:()=>ue,parseBMFont:()=>ys,parseColor:()=>Lt,pickTier:()=>In,playerColor:()=>li,rendererOrder:()=>En,rng:()=>fa,saturate:()=>tl,sepia:()=>sl,shader:()=>ll,shapeBounds:()=>ri,tier:()=>re,tint:()=>Ko,touching:()=>Pn,wrists:()=>Rn}),te.exports=ur(ki);var vi=33,V={nose:0,leftShoulder:11,rightShoulder:12,leftElbow:13,rightElbow:14,leftWrist:15,rightWrist:16,leftHip:23,rightHip:24,leftKnee:25,rightKnee:26,leftAnkle:27,rightAnkle:28},dr=["3-5","6-8","9-12"],pr=t=>dr.includes(t),yr=4,Ve=["#EE6A43","#6FA0E0","#8CC9A0","#C49BE0"],Mi={"3-5":["bunny","bear","panda","penguin"],"6-8":["fox","lion","dragon","unicorn"],"9-12":["robot","astronaut","ninja","skater"]},mr=Mi["6-8"],Ei=(t,e)=>{const s=pr(e)?Mi[e]:mr;return s[Number.isInteger(t)&&t>=0?t%s.length:0]},xr=(t,e)=>t?{x:t.x+e.x*t.w,y:t.y+e.y*t.h}:{x:e.x,y:e.y},gr=12,br=vi*4,wr=t=>gr+t*br,vl=wr(yr),kr=t=>t.startsWith("fabi-play.")?`fablee-play.${t.slice(10)}`:null;function vr(t,e,s=kr(e)){if(!(!t||!s))try{const i=t.getItem(s);if(i===null)return;t.getItem(e)===null&&t.setItem(e,i),t.removeItem(s)}catch{}}var yt="#4a382c",ft="#2b2118",vt="#1c1f2b",Ai="#fbefe3",At="#f4897a",_e="#3a2a22",_i=[{id:"fox",name:{en:"Fox",it:"Volpe"},band:"6-8",palette:{body:"#ee6a43",limbs:"#ee6a43",belly:Ai,accent:"#ffd9c2",outline:ft,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"dot",mouth:"cat",nose:_e,muzzle:"cheeks"},tail:"fluffy",headExtras:[],bodyExtras:[]},{id:"mascot",name:{en:"Fabi",it:"Fabi"},band:"all",special:!0,palette:{body:"#ee6a43",limbs:"#ee6a43",belly:Ai,accent:"#5a3426",outline:ft,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"bead",mouth:"open",nose:_e,muzzle:"band",cheeks:At},tail:"brush",headExtras:[],bodyExtras:["star"],extraColors:["#ffd84a"]},{id:"bunny",name:{en:"Bunny",it:"Coniglietto"},band:"3-5",palette:{body:"#f9d0de",limbs:"#f9d0de",belly:"#fff6f8",accent:"#f4a0b9",outline:yt},head:"round",ears:"long",face:{eyes:"dot",mouth:"cat",nose:"#e0607e",muzzle:"none",cheeks:At},tail:"pom",headExtras:[],bodyExtras:[]},{id:"bear",name:{en:"Bear",it:"Orsetto"},band:"3-5",palette:{body:"#cf9f78",limbs:"#cf9f78",belly:"#f7e0bf",accent:"#f7e0bf",outline:yt},head:"round",ears:"round",face:{eyes:"dot",mouth:"smile",nose:_e,muzzle:"oval",cheeks:At},tail:"none",headExtras:[],bodyExtras:[]},{id:"cat",name:{en:"Cat",it:"Gattino"},band:"3-5",palette:{body:"#c8b6ee",limbs:"#c8b6ee",belly:"#f4eeff",accent:"#f7b3c8",outline:yt,hands:"#f4eeff",feet:"#f4eeff"},head:"wide",ears:"pointy",face:{eyes:"big",eyeColor:"#3f9a5a",mouth:"cat",nose:"#f07a9a",muzzle:"none",cheeks:At},tail:"long",headExtras:["whiskers"],bodyExtras:[]},{id:"panda",name:{en:"Panda",it:"Panda"},band:"3-5",palette:{body:"#ffffff",limbs:"#6e6674",belly:"#ffffff",accent:"#6e6674",outline:yt,ears:"#6e6674"},head:"wide",ears:"round",face:{eyes:"mask",mouth:"smile",nose:"#2f2a2c",muzzle:"none",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:[]},{id:"penguin",name:{en:"Penguin",it:"Pinguino"},band:"3-5",palette:{body:"#6c8fca",limbs:"#6c8fca",belly:"#ffffff",accent:"#f9b95c",outline:yt,feet:"#f9b95c"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"heart",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:["flippers","scarf"],extraColors:["#f6907a"]},{id:"frog",name:{en:"Frog",it:"Ranocchio"},band:"3-5",palette:{body:"#8fd487",limbs:"#8fd487",belly:"#e6f7cc",accent:"#62ad62",outline:yt},head:"wide",ears:"none",face:{eyes:"big",eyesOnTop:!0,mouth:"open",muzzle:"none",cheeks:"#f59b8f"},tail:"none",headExtras:[],bodyExtras:["flippers","spots"],extraColors:["#62ad62","#b0e6a4"]},{id:"lion",name:{en:"Lion",it:"Leoncino"},band:"6-8",palette:{body:"#f6c454",limbs:"#f6c454",belly:"#fde7b0",accent:"#fde7b0",outline:ft},head:"round",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#8a4b2a",muzzle:"oval",cheeks:At},tail:"tuft",headExtras:["mane"],bodyExtras:[],extraColors:["#c8692e"]},{id:"unicorn",name:{en:"Unicorn",it:"Unicorno"},band:"6-8",palette:{body:"#fbf5ff",limbs:"#fbf5ff",belly:"#efe0ff",accent:"#fbd46a",outline:ft,hands:"#c9a6f2",feet:"#c9a6f2"},head:"tall",ears:"unicorn",face:{eyes:"dot",mouth:"smile",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["rainbow-mane"],bodyExtras:[],extraColors:["#f58cc0","#8fd3f4","#a98ff2"]},{id:"dragon",name:{en:"Little Dragon",it:"Draghetto"},band:"6-8",palette:{body:"#8a63d2",limbs:"#8a63d2",belly:"#fbd46a",accent:"#5fd0b5",outline:ft},head:"wide",ears:"horns",face:{eyes:"big",eyeColor:"#3a2a6a",mouth:"teeth",muzzle:"none",cheeks:"#f59bc0"},tail:"arrow",headExtras:[],bodyExtras:["wings"]},{id:"robot",name:{en:"Robot",it:"Robot"},band:"9-12",palette:{body:"#b9c7d2",limbs:"#8b9aa6",belly:"#b9c7d2",accent:"#ee6a43",outline:vt,hands:"#ee6a43",feet:"#6b7a86"},head:"square",ears:"antenna",face:{eyes:"screen",eyeColor:"#7ff0ff",mouth:"grill",muzzle:"none"},tail:"none",headExtras:["bolts"],bodyExtras:["panel","joints","boots"],extraColors:["#ff7a6b","#fbd46a","#7ff0ff"]},{id:"astronaut",name:{en:"Astronaut",it:"Astronauta"},band:"9-12",palette:{body:"#f4f1ec",limbs:"#f4f1ec",belly:"#f4f1ec",accent:"#ee6a43",outline:vt,hands:"#9fb0bd",feet:"#9fb0bd"},head:"round",ears:"none",face:{eyes:"visor",mouth:"smile",muzzle:"none"},tail:"none",headExtras:["helmet"],bodyExtras:["backpack","badge","boots"],extraColors:["#c9d3db"]},{id:"dinosaur",name:{en:"Dinosaur",it:"Dinosauro"},band:"6-8",palette:{body:"#3fb3a6",limbs:"#3fb3a6",belly:"#c9f0d6",accent:"#f79a3e",outline:ft},head:"wide",ears:"none",face:{eyes:"dot",mouth:"teeth",muzzle:"none",cheeks:"#f59b8f"},tail:"spiky",headExtras:["spikes","spots"],bodyExtras:[],extraColors:["#2b8f84","#7fd3c6"]},{id:"monkey",name:{en:"Monkey",it:"Scimmietta"},band:"6-8",palette:{body:"#7b5234",limbs:"#7b5234",belly:"#f2c9a0",accent:"#f2c9a0",outline:ft,hands:"#f2c9a0",feet:"#f2c9a0"},head:"round",ears:"side",face:{eyes:"dot",mouth:"open",nose:"#5a3a26",muzzle:"monkey",cheeks:At},tail:"curl",headExtras:["tuft"],bodyExtras:[]},{id:"koala",name:{en:"Koala",it:"Koala"},band:"3-5",palette:{body:"#b7bcc6",limbs:"#b7bcc6",belly:"#eef0f3",accent:"#f4dbe2",outline:yt},head:"wide",ears:"big-round",face:{eyes:"dot",mouth:"smile",nose:"#3b3438",muzzle:"none",cheeks:"#f4a3b0"},tail:"none",headExtras:[],bodyExtras:[]},{id:"tiger",name:{en:"Tiger",it:"Tigrotto"},band:"6-8",palette:{body:"#f9a33a",limbs:"#f9a33a",belly:"#fff1dc",accent:"#fff1dc",outline:ft},head:"wide",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#e2607a",muzzle:"oval",cheeks:At},tail:"striped",headExtras:["stripes","whiskers"],bodyExtras:[],extraColors:["#3a2a22"]},{id:"owl",name:{en:"Owl",it:"Gufetto"},band:"3-5",palette:{body:"#8ec0e6",limbs:"#8ec0e6",belly:"#e3f2fc",accent:"#639cc9",outline:yt,feet:"#f9b95c",hands:"#639cc9"},head:"tall",ears:"tufts",face:{eyes:"big",eyeColor:yt,eyeRing:"#fde08a",mouth:"beak",muzzle:"none",cheeks:"#f6a8b4"},tail:"none",headExtras:[],bodyExtras:["feathers"]},{id:"alien",name:{en:"Alien",it:"Alieno"},band:"9-12",palette:{body:"#9ee05a",limbs:"#9ee05a",belly:"#d8f5a8",accent:"#b07cf2",outline:vt},head:"bulb",ears:"antennae",face:{eyes:"almond",eyeColor:"#1e1838",mouth:"smirk",muzzle:"none"},tail:"none",headExtras:[],bodyExtras:["spots"],extraColors:["#7cc23e","#7cc23e"]},{id:"ghost",name:{en:"Friendly Ghost",it:"Fantasmino"},band:"6-8",palette:{body:"#e6f4ff",limbs:"#e6f4ff",belly:"#e6f4ff",accent:"#bcd9f2",outline:ft},head:"round",ears:"none",face:{eyes:"dot",mouth:"open",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["curl"],bodyExtras:["sheet"]},{id:"octopus",name:{en:"Octopus",it:"Polpetto"},band:"6-8",palette:{body:"#e0578a",limbs:"#e0578a",belly:"#f7b3cc",accent:"#f7b3cc",outline:ft,hands:"#f7b3cc",feet:"#f7b3cc"},head:"tall",ears:"none",face:{eyes:"big",eyeColor:"#3a2140",mouth:"smile",muzzle:"none",cheeks:"#ffd0a0"},tail:"none",headExtras:["spots"],bodyExtras:["tentacles"],extraColors:["#f7b3cc","#f7b3cc"]},{id:"chick",name:{en:"Chick",it:"Pulcino"},band:"3-5",palette:{body:"#ffd45e",limbs:"#ffd45e",belly:"#fff2c2",accent:"#ffa04a",outline:yt,hands:"#ffc23d",feet:"#ffa04a"},head:"round",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"none",cheeks:At},tail:"none",headExtras:["eggshell"],bodyExtras:[],extraColors:["#fffaf0"]},{id:"puppy",name:{en:"Puppy",it:"Cucciolo"},band:"3-5",palette:{body:"#f4e4cf",limbs:"#f4e4cf",belly:"#fffaf2",accent:"#f29aa4",outline:yt,ears:"#b58262",hands:"#e6caa6",feet:"#e6caa6"},head:"wide",ears:"floppy",face:{eyes:"dot",mouth:"open",nose:_e,muzzle:"oval",cheeks:At},tail:"curl",headExtras:["eye-spot"],bodyExtras:[]},{id:"lamb",name:{en:"Lamb",it:"Agnellino"},band:"3-5",palette:{body:"#fdf8ee",limbs:"#e3d1c2",belly:"#fffdf8",accent:"#f6bcc2",outline:yt,skin:"#f7dccb",hands:"#a58c7e",feet:"#a58c7e"},head:"round",ears:"droopy",face:{eyes:"dot",mouth:"smile",nose:"#e591a0",muzzle:"none",cheeks:At},tail:"pom",headExtras:["wool"],bodyExtras:["wool"]},{id:"duckling",name:{en:"Duckling",it:"Anatroccolo"},band:"3-5",palette:{body:"#fff1a6",limbs:"#fff1a6",belly:"#fffbe0",accent:"#ff9f43",outline:yt,feet:"#ff9f43"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"bill",muzzle:"none",cheeks:At},tail:"none",headExtras:["curl"],bodyExtras:["flippers","scarf"],extraColors:["#86cfe0"]},{id:"shark",name:{en:"Shark",it:"Squalo"},band:"6-8",palette:{body:"#6c95c4",limbs:"#6c95c4",belly:"#eef5fb",accent:"#4c76a8",outline:ft,hands:"#eef5fb",feet:"#4c76a8"},head:"wide",ears:"fin",face:{eyes:"dot",mouth:"jaws",muzzle:"none",cheeks:"#f59bb0"},tail:"fish",headExtras:["gills"],bodyExtras:[]},{id:"wolf",name:{en:"Wolf",it:"Lupo"},band:"6-8",palette:{body:"#8f9bb3",limbs:"#8f9bb3",belly:"#eef1f6",accent:"#f3b8c4",outline:ft,hands:"#5a647a",feet:"#5a647a"},head:"round",ears:"pointy",face:{eyes:"dot",mouth:"open",nose:_e,muzzle:"oval",cheeks:"#f4a3b0"},tail:"fluffy",headExtras:["ruff","forehead"],bodyExtras:[],extraColors:["#636d84"]},{id:"parrot",name:{en:"Parrot",it:"Pappagallo"},band:"6-8",palette:{body:"#e8503f",limbs:"#e8503f",belly:"#ffd25a",accent:"#f6e6c4",outline:ft,hands:"#3a9bdc",feet:"#8a7a70"},head:"round",ears:"none",face:{eyes:"big",eyeColor:ft,eyeRing:"#ffffff",mouth:"hook",muzzle:"none",cheeks:"#ffb0a0"},tail:"plume",headExtras:["crest"],bodyExtras:["feathers"],extraColors:["#ffd25a","#3fae5a","#3a9bdc"]},{id:"ninja",name:{en:"Ninja",it:"Ninja"},band:"9-12",palette:{body:"#2f3a56",limbs:"#2f3a56",belly:"#2f3a56",accent:"#36c9bb",outline:vt,skin:"#b07a52",hands:"#222a40",feet:"#222a40"},head:"round",ears:"none",face:{eyes:"calm",mouth:"none",muzzle:"none",brows:"#2a1d16"},tail:"none",headExtras:["ninja-hood"],bodyExtras:["belt"],extraColors:["#36c9bb","#36c9bb","#36c9bb"]},{id:"skater",name:{en:"Skater",it:"Skater"},band:"9-12",palette:{body:"#3a8fc0",limbs:"#2c3e57",belly:"#2f7aa6",accent:"#ffcf3a",outline:vt,skin:"#f2c9a5",hair:"#7a4a2a",hands:"#f2c9a5",feet:"#eef1f5"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#5a3520"},tail:"none",headExtras:["hair","cap"],bodyExtras:["pocket","joints"],extraColors:["#ff5d73"]},{id:"explorer",name:{en:"Explorer",it:"Giramondo"},band:"9-12",palette:{body:"#5f8f5b",limbs:"#5f8f5b",belly:"#5f8f5b",accent:"#d9bb7e",outline:vt,skin:"#7a4a30",hair:"#1d1410",hands:"#7a4a30",feet:"#6b4a2a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#1d1410"},tail:"none",headExtras:["curls","safari-hat"],bodyExtras:["backpack","straps","boots"],extraColors:["#e07b39","#6b4a2a"]},{id:"wizard",name:{en:"Wizard",it:"Mago"},band:"9-12",palette:{body:"#5b3fa0",limbs:"#5b3fa0",belly:"#5b3fa0",accent:"#3d5fc8",outline:vt,skin:"#c98d62",hair:"#a8452a",hands:"#c98d62",feet:"#33255e"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#7a301c"},tail:"none",headExtras:["locks","wizard-hat"],bodyExtras:["robe","belt"],extraColors:["#ffd84a","#ffd84a","#ffd84a"]},{id:"knight",name:{en:"Knight",it:"Cavaliere"},band:"9-12",palette:{body:"#bcc7d3",limbs:"#8e9aa8",belly:"#dce3ea",accent:"#d8443a",outline:vt,hands:"#6c7786",feet:"#6c7786"},head:"bucket",ears:"none",face:{eyes:"slit",eyeColor:"#bfefff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["plume"],bodyExtras:["pauldrons","emblem","boots"],extraColors:["#d8443a"]},{id:"racer",name:{en:"Racer",it:"Pilota"},band:"9-12",palette:{body:"#ff6a2b",limbs:"#ff6a2b",belly:"#ffffff",accent:"#ffffff",outline:vt,hands:"#232838",feet:"#232838"},head:"round",ears:"none",face:{eyes:"goggle",eyeColor:"#7fd6ff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["stripe"],bodyExtras:["racing-stripe","boots"]},{id:"pirate",name:{en:"Pirate",it:"Pirata"},band:"9-12",palette:{body:"#f2efe6",limbs:"#2a3d6e",belly:"#f2efe6",accent:"#d94545",outline:vt,skin:"#d9a072",hair:"#2b1a12",hands:"#d9a072",feet:"#3a2a20"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#2b1a12"},tail:"none",headExtras:["locks","bandana","eye-patch"],bodyExtras:["stripes","belt","boots"],extraColors:["#d94545","#2a3d6e","#4a3426"]},{id:"diver",name:{en:"Diver",it:"Sub"},band:"9-12",palette:{body:"#1f6582",limbs:"#1f6582",belly:"#1f6582",accent:"#ffb020",outline:vt,skin:"#e8b48a",hair:"#c98f2e",hands:"#1b4f66",feet:"#ffb020"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#8a5a1a"},tail:"none",headExtras:["curls","dive-mask"],bodyExtras:["tank","fins"],extraColors:["#c9d3db"]},{id:"hero",name:{en:"Hero",it:"Supereroe"},band:"9-12",palette:{body:"#3557c8",limbs:"#3557c8",belly:"#3557c8",accent:"#e0403a",outline:vt,skin:"#5a3825",hair:"#141010",hands:"#e0403a",feet:"#e0403a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#141010"},tail:"none",headExtras:["hair","domino"],bodyExtras:["cape","emblem","boots"],extraColors:["#ffd84a"]}],st={M:0,L:1,Q:2,C:3,Z:4},Ti=[2,2,4,6,0];function Ss(t,e){for(const s of e)Mr(t,s)}function Mr(t,e){if(e.k==="group"){t.save(),t.translate(e.x,e.y),e.rot&&t.rotate(e.rot),e.s!==void 0&&e.s!==1&&t.scale(e.s,e.s),e.alpha!==void 0&&(t.globalAlpha*=e.alpha),Ss(t,e.items),t.restore();return}switch(t.save(),e.alpha!==void 0&&(t.globalAlpha*=e.alpha),t.beginPath(),e.k){case"circle":t.arc(e.x,e.y,Math.max(e.r,0),0,Math.PI*2);break;case"ellipse":t.ellipse(e.x,e.y,Math.max(e.rx,0),Math.max(e.ry,0),e.rot??0,0,Math.PI*2);break;case"rect":Er(t,e);break;case"path":typeof e.d=="string"?Tr(t,e.d):Ar(t,e.d);break;case"line":t.moveTo(e.pts[0]??0,e.pts[1]??0);for(let s=2;s+1<e.pts.length;s+=2)t.lineTo(e.pts[s],e.pts[s+1]);break}t.lineCap="round",t.lineJoin="round",e.fill&&e.k!=="line"&&(t.fillStyle=e.fill,t.fill()),e.stroke&&(e.lw??1)>0&&(t.strokeStyle=e.stroke,t.lineWidth=e.lw??1,t.stroke()),t.restore()}function Er(t,e){const s=Math.max(0,Math.min(e.r,e.w/2,e.h/2));t.translate(e.x,e.y),e.rot&&t.rotate(e.rot);const i=-e.w/2,n=-e.h/2;t.moveTo(i+s,n),t.lineTo(i+e.w-s,n),t.quadraticCurveTo(i+e.w,n,i+e.w,n+s),t.lineTo(i+e.w,n+e.h-s),t.quadraticCurveTo(i+e.w,n+e.h,i+e.w-s,n+e.h),t.lineTo(i+s,n+e.h),t.quadraticCurveTo(i,n+e.h,i,n+e.h-s),t.lineTo(i,n+s),t.quadraticCurveTo(i,n,i+s,n),t.closePath()}function Ar(t,e){for(let s=0;s<e.length;){const i=e[s++];if(i===st.M)t.moveTo(e[s],e[s+1]);else if(i===st.L)t.lineTo(e[s],e[s+1]);else if(i===st.Q)t.quadraticCurveTo(e[s],e[s+1],e[s+2],e[s+3]);else if(i===st.C)t.bezierCurveTo(e[s],e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]);else if(i===st.Z)t.closePath();else return;s+=Ti[i]}}function _r(t){if(typeof t=="string")return(t.match(/-?\d*\.?\d+(?:e-?\d+)?/gi)??[]).map(Number);const e=[];for(let s=0;s<t.length;){const i=Ti[t[s++]];if(i===void 0)break;for(let n=0;n<i;n++)e.push(t[s+n]);s+=i}return e}function Tr(t,e){const s=e.match(/[MLQCZ]|-?\d*\.?\d+(?:e-?\d+)?/gi)??[];let i="",n=0;const r=()=>Number(s[n++]);for(;n<s.length;){const a=s[n];if(/[MLQCZ]/i.test(a)&&(i=a.toUpperCase(),n++,i==="Z")){t.closePath();continue}i==="M"?(t.moveTo(r(),r()),i="L"):i==="L"?t.lineTo(r(),r()):i==="Q"?t.quadraticCurveTo(r(),r(),r(),r()):i==="C"?t.bezierCurveTo(r(),r(),r(),r(),r(),r()):n++}}var j=t=>{const e=Math.round(t*100)/100;return e===0?0:e};function tt(t,e=.5){const s=t.length;if(s<3)return[];const i=(l,h,o)=>({x:l.x+(h.x-l.x)*o,y:l.y+(h.y-l.y)*o}),n=Math.min(Math.max(e,0),.5),r=i(t[0],t[1],n),a=[st.M,j(r.x),j(r.y)];for(let l=1;l<=s;l++){const h=t[(l-1)%s],o=t[l%s],f=t[(l+1)%s],u=i(h,o,1-n),c=i(o,f,n);a.push(st.L,j(u.x),j(u.y),st.Q,j(o.x),j(o.y),j(c.x),j(c.y))}return a.push(st.Z),a}function Z(t,e=1){const s=t.length;if(s<3)return[];const i=[st.M,j(t[0].x),j(t[0].y)],n=e/6;for(let r=0;r<s;r++){const a=t[(r-1+s)%s],l=t[r],h=t[(r+1)%s],o=t[(r+2)%s];i.push(st.C,j(l.x+(h.x-a.x)*n),j(l.y+(h.y-a.y)*n),j(h.x-(o.x-l.x)*n),j(h.y-(o.y-l.y)*n),j(h.x),j(h.y))}return i.push(st.Z),i}function Te(t){const e=t.length;if(e<2)return[];const s=[st.M,j(t[0].x),j(t[0].y)];for(let i=0;i<e-1;i++){const n=t[Math.max(i-1,0)],r=t[i],a=t[i+1],l=t[Math.min(i+2,e-1)];s.push(st.C,j(r.x+(a.x-n.x)/6),j(r.y+(a.y-n.y)/6),j(a.x-(l.x-r.x)/6),j(a.y-(l.y-r.y)/6),j(a.x),j(a.y))}return s}var Ke="M0 -1 L0.29 -0.4 L0.95 -0.31 L0.47 0.15 L0.59 0.81 L0 0.5 L-0.59 0.81 L-0.47 0.15 L-0.95 -0.31 L-0.29 -0.4 Z",at="#ffffff",$=[-1,1],Si="#3a2420",Sr="#f2808f",Cs="#26324a",Cr="#ffd84a",ut=(...t)=>{const e=[];for(let s=0;s+1<t.length;s+=2)e.push({x:t[s],y:t[s+1]});return e};function Ci(t,e){const s=t.palette,i=[],n={stroke:s.outline,lw:e},r=f=>t.headExtras.includes(f),a=(f,u)=>t.extraColors?.[f]??u;if(r("mane")){for(let u=0;u<12;u++){const c=u/12*Math.PI*2;i.push({k:"circle",x:Math.cos(c)*1.02,y:Math.sin(c)*1+.04,r:.42,fill:a(0,s.accent),...n})}i.push({k:"circle",x:0,y:.04,r:1.08,fill:a(0,s.accent)})}if(r("rainbow-mane")){const f=t.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];[[.98,.05,.3,.5,-.25],[.92,.58,.26,.42,-.1],[.62,.92,.22,.32,.4]].forEach(([c,y,p,x,m],g)=>i.push({k:"ellipse",x:c,y,rx:p,ry:x,rot:m,fill:f[g%f.length],...n}))}if(r("spikes"))for(const f of[-.55,0,.55]){const u=Se(f,1.48),c=Se(f-.32,.86),y=Se(f+.32,.86);i.push({k:"path",d:tt([c,u,y],.22),fill:s.accent,...n})}if(r("curl")&&i.push({k:"path",d:Z([{x:-.2,y:-.9},{x:-.05,y:-1.3},{x:.32,y:-1.42},{x:.16,y:-1.18},{x:.2,y:-.9}]),fill:s.body,...n}),r("wool"))for(let f=0;f<=8;f++){const u=-1.75+f/8*3.5;i.push({k:"circle",x:Math.sin(u)*.98,y:-Math.cos(u)*.92-.04,r:.34,fill:s.body,...n})}if(r("crest")&&[-.38,0,.38].forEach((f,u)=>{const c=Se(f,1.12);i.push({k:"ellipse",x:c.x,y:c.y,rx:.15,ry:.42,rot:f,fill:a(u,s.accent),...n})}),r("plume")&&i.push({k:"path",d:Z(ut(-.12,-.92,-.2,-1.42,.1,-1.78,.62,-1.74,.36,-1.46,.16,-.98)),fill:s.accent,...n}),r("locks")&&i.push({k:"path",d:Z(ut(-1.14,.58,-1.24,-.2,-.86,-.98,0,-1.2,.86,-.98,1.24,-.2,1.14,.58,.8,.66,0,.2,-.8,.66)),fill:s.hair??s.outline,...n}),r("ninja-hood"))for(const[f,u]of[[.35,.5],[.85,.42]])i.push({k:"ellipse",x:1+Math.cos(f)*u*.8,y:-.5+Math.sin(f)*u*.8,rx:u,ry:.11,rot:f,fill:s.accent,...n});if(r("bandana"))for(const[f,u]of[[Math.PI-.5,.42],[Math.PI-1,.36]])i.push({k:"ellipse",x:-.98+Math.cos(f)*u*.8,y:-.36+Math.sin(f)*u*.8,rx:u,ry:.12,rot:f,fill:s.accent,...n});if(r("ruff"))for(const f of $)i.push({k:"path",d:tt(ut(f*.7,-.3,f*1.32,0,f*1.02,.18,f*1.26,.46,f*.86,.56,f*.98,.84,f*.4,.7),.25),fill:s.body,...n});if(t.face.eyesOnTop)for(const f of $)i.push({k:"circle",x:f*.46,y:-.72,r:.38,fill:s.body,...n});i.push(...Lr(t,e)),i.push(Rr(t,n));const l=t.face.muzzle,h=s.belly;if(l==="oval"&&i.push({k:"ellipse",x:0,y:.4,rx:.46,ry:.32,fill:h}),l==="monkey"){for(const f of $)i.push({k:"circle",x:f*.32,y:-.04,r:.38,fill:h});i.push({k:"ellipse",x:0,y:.4,rx:.56,ry:.4,fill:h})}if(l==="heart"){for(const f of $)i.push({k:"circle",x:f*.36,y:.02,r:.5,fill:h});i.push({k:"ellipse",x:0,y:.38,rx:.66,ry:.48,fill:h})}if(l==="disc")for(const f of $)i.push({k:"circle",x:f*.4,y:.02,r:.44,fill:h});if(l==="cheeks")for(const f of $)i.push({k:"ellipse",x:f*.4,y:.44,rx:.44,ry:.32,fill:h});if(l==="band"&&i.push({k:"path",d:Pr(t,e),fill:h}),r("stripes")){const f=a(0,s.outline);i.push({k:"line",pts:[0,-.97,0,-.66],stroke:f,lw:.13});for(const u of $)i.push({k:"line",pts:[u*.3,-.93,u*.24,-.7],stroke:f,lw:.1}),i.push({k:"line",pts:[u*.98,-.05,u*.74,0],stroke:f,lw:.1}),i.push({k:"line",pts:[u*.94,.22,u*.74,.22],stroke:f,lw:.09})}if(r("spots")){const f=a(1,s.belly);i.push({k:"circle",x:-.55,y:-.5,r:.15,fill:f}),i.push({k:"circle",x:.58,y:-.42,r:.11,fill:f}),i.push({k:"circle",x:.22,y:-.76,r:.09,fill:f})}if(r("forehead")&&i.push({k:"path",d:Z(ut(-.62,-.66,0,-.86,.62,-.66,.26,-.36,0,-.1,-.26,-.36),.9),fill:a(0,s.accent)}),r("eye-spot")&&i.push({k:"ellipse",x:.42,y:-.06,rx:.3,ry:.33,rot:.3,fill:s.ears??s.accent}),r("gills"))for(const f of $)for(const u of[0,.12,.24])i.push({k:"path",d:`M${f*(.66+u)} 0.06 Q${f*(.6+u)} 0.22 ${f*(.66+u)} 0.38`,stroke:s.accent,lw:e*.9});const o=s.hair??s.outline;if(r("hair")&&i.push({k:"path",d:Z(ut(-1.02,-.06,-1.02,-.58,-.62,-1.04,.08,-1.14,.76,-.92,1.05,-.42,1,-.06,.84,-.4,.42,-.5,.06,-.4,-.34,-.56,-.74,-.38)),fill:o,...n}),r("locks")&&i.push({k:"path",d:Z(ut(-1,-.08,-.98,-.62,-.56,-1.02,0,-1.1,.56,-1.02,.98,-.62,1,-.08,.8,-.38,.36,-.44,0,-.4,-.36,-.44,-.8,-.38)),fill:o,...n}),r("curls")){for(let f=0;f<7;f++){const u=Se(-1.3+f/6*2.6,.86);i.push({k:"circle",x:u.x,y:u.y,r:.3,fill:o,...n})}i.push({k:"ellipse",x:0,y:-.64,rx:.8,ry:.36,fill:o})}if(r("ninja-hood")&&(i.push({k:"rect",x:0,y:0,w:1.56,h:.6,r:.28,fill:s.skin??at,stroke:s.outline,lw:e*.8}),i.push({k:"path",d:"M-0.98 -0.42 Q0 -0.74 0.98 -0.42 L1.0 -0.62 Q0 -0.94 -1.0 -0.62 Z",fill:s.accent,...n})),r("domino")){i.push({k:"path",d:Z(ut(-.86,-.04,-.62,-.3,-.18,-.24,0,-.16,.18,-.24,.62,-.3,.86,-.04,.6,.22,.16,.16,0,.1,-.16,.16,-.6,.22),.9),fill:s.accent,...n});for(const f of $)i.push({k:"ellipse",x:f*.38,y:0,rx:.19,ry:.13,fill:at})}if(i.push(...Nr(t,e)),r("brows"))for(const f of $)i.push({k:"line",pts:[f*.72,-.5,f*.14,-.3],stroke:s.accent,lw:.16});if(t.face.brows)for(const f of $)i.push({k:"line",pts:[f*.2,-.2,f*.54,-.28],stroke:t.face.brows,lw:.09});if(i.push(...Ir(t,e)),t.face.cheeks)for(const f of $)i.push({k:"ellipse",x:f*.64,y:.3,rx:.15,ry:.1,fill:t.face.cheeks,alpha:.8});if(r("whiskers"))for(const f of $)for(const u of[-.1,.06])i.push({k:"line",pts:[f*.62,.38+u,f*1.06,.3+u*2.2],stroke:s.outline,lw:e*.7,alpha:.75});if(r("rainbow-mane")){const f=t.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];i.push({k:"ellipse",x:.42,y:-.82,rx:.34,ry:.22,rot:.5,fill:f[0],...n}),i.push({k:"ellipse",x:.1,y:-.92,rx:.3,ry:.2,rot:.25,fill:f[1%f.length],...n})}if(t.ears==="unicorn"){const f=[{x:-.18,y:-.84},{x:.02,y:-1.72},{x:.18,y:-.84}];i.push({k:"path",d:tt(f,.12),fill:s.accent,...n});for(const u of[-1,-1.2,-1.4]){const c=.16*((u+1.72)/.88);i.push({k:"line",pts:[-c,u+.04,c,u-.04],stroke:s.outline,lw:e*.7,alpha:.6})}}if(r("helmet")){for(const f of $)i.push({k:"rect",x:f*1,y:.05,w:.26,h:.56,r:.12,fill:s.accent,...n});i.push({k:"path",d:"M-0.62 -0.62 Q-0.3 -0.92 0.12 -0.9",stroke:at,lw:.1,alpha:.9})}if(r("bolts"))for(const f of $)i.push({k:"rect",x:f*1.08,y:.08,w:.2,h:.44,r:.08,fill:s.accent,...n});if(r("tuft")&&i.push({k:"path",d:Z([{x:-.26,y:-.95},{x:-.12,y:-1.22},{x:.02,y:-1.04},{x:.16,y:-1.28},{x:.28,y:-.95},{x:0,y:-.86}]),fill:s.body,...n}),r("eggshell")&&i.push({k:"path",d:"M-0.88 -0.5 C-0.88 -1.12 -0.46 -1.42 0 -1.42 C0.46 -1.42 0.88 -1.12 0.88 -0.5 L0.66 -0.66 L0.44 -0.48 L0.22 -0.66 L0 -0.48 L-0.22 -0.66 L-0.44 -0.48 L-0.66 -0.66 Z",fill:a(0,at),...n}),r("wool"))for(const[f,u]of[[-.36,-.84],[.02,-.94],[.4,-.82]])i.push({k:"circle",x:f,y:u,r:.27,fill:s.body,...n});if(r("stripe")&&i.push({k:"rect",x:0,y:-.64,w:.38,h:.62,r:.06,fill:s.accent}),r("eye-patch")&&(i.push({k:"line",pts:[-.97,-.5,.97,.13],stroke:s.outline,lw:.07}),i.push({k:"ellipse",x:.38,y:.02,rx:.21,ry:.19,fill:s.outline})),r("bandana")){i.push({k:"path",d:Z(ut(-1.05,-.22,-.96,-.72,-.5,-1.08,.1,-1.14,.72,-.96,1.04,-.56,1.05,-.22,.5,-.46,-.5,-.46)),fill:s.accent,...n});for(const[f,u]of[[-.5,-.8],[.08,-.92],[.6,-.74],[-.12,-.62],[.36,-.6]])i.push({k:"circle",x:f,y:u,r:.06,fill:at,alpha:.85});i.push({k:"circle",x:-.98,y:-.34,r:.15,fill:s.accent,...n})}if(r("cap")){for(const f of $)i.push({k:"line",pts:[f*.98,-.2,f*.5,.82,-f*.05,.98],stroke:s.outline,lw:.06});i.push({k:"path",d:Z(ut(-1.1,-.16,-1.04,-.66,-.6,-1.12,0,-1.24,.6,-1.12,1.04,-.66,1.1,-.16,.5,-.4,-.5,-.4)),fill:s.accent,...n}),i.push({k:"path",d:"M-0.74 -0.4 Q0 -0.6 0.74 -0.4 Q0.8 -0.24 0.6 -0.22 Q0 -0.36 -0.6 -0.22 Q-0.8 -0.24 -0.74 -0.4 Z",fill:s.accent,...n}),i.push({k:"circle",x:.5,y:-.82,r:.15,fill:a(0,at),...n});for(const f of[-.42,-.14])i.push({k:"line",pts:[f,-1.04,f+.02,-.78],stroke:s.outline,lw:.07,alpha:.7})}if(r("safari-hat")&&(i.push({k:"ellipse",x:0,y:-.56,rx:1.48,ry:.3,fill:s.accent,...n}),i.push({k:"path",d:Z(ut(-.78,-.58,-.7,-1.1,-.3,-1.38,.3,-1.38,.7,-1.1,.78,-.58,0,-.5),.8),fill:s.accent,...n}),i.push({k:"path",d:"M-0.77 -0.72 Q0 -0.62 0.77 -0.72 L0.74 -0.9 Q0 -0.8 -0.74 -0.9 Z",fill:a(1,s.outline),stroke:s.outline,lw:e*.8})),r("wizard-hat")){i.push({k:"ellipse",x:0,y:-.62,rx:1.32,ry:.26,fill:s.accent,...n}),i.push({k:"path",d:tt(ut(-.8,-.66,-.36,-1.5,.5,-2.2,.3,-1.46,.8,-.66),.3),fill:s.accent,...n});const f=a(0,Cr);for(const[u,c,y]of[[.02,-1.08,.18],[-.38,-.84,.1],[.36,-1.5,.11]])i.push({k:"group",x:u,y:c,s:y,items:[{k:"path",d:Ke,fill:f}]})}if(r("dive-mask")){for(const u of $)i.push({k:"line",pts:[u*.7,-.04,u*1,-.12],stroke:s.outline,lw:.2},{k:"line",pts:[u*.7,-.04,u*1,-.12],stroke:s.accent,lw:.11});i.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,fill:"#bfe9f5",alpha:.35}),i.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:s.outline,lw:.2}),i.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:s.accent,lw:.11}),i.push({k:"path",d:"M-0.5 -0.16 Q-0.4 -0.24 -0.22 -0.24",stroke:at,lw:.06,alpha:.9});const f="M0.5 0.52 Q0.98 0.56 1.04 0.1 L1.12 -0.92";i.push({k:"path",d:f,stroke:s.outline,lw:.24},{k:"path",d:f,stroke:s.accent,lw:.13})}return i}function Rr(t,e){const s=t.headExtras.includes("ninja-hood")?t.palette.body:t.palette.skin??t.palette.body;switch(t.head){case"round":return{k:"circle",x:0,y:0,r:1,fill:s,...e};case"wide":return{k:"ellipse",x:0,y:.03,rx:1.12,ry:.94,fill:s,...e};case"tall":return{k:"ellipse",x:0,y:-.02,rx:.94,ry:1.04,fill:s,...e};case"square":return{k:"rect",x:0,y:0,w:2,h:1.8,r:.46,fill:s,...e};case"bucket":return{k:"path",d:tt(ut(-.94,.96,-.98,-.36,-.62,-1.04,.62,-1.04,.98,-.36,.94,.96),.42),fill:s,...e};case"bulb":return{k:"path",d:Z([{x:0,y:-1.02},{x:.86,y:-.74},{x:1.08,y:-.12},{x:.72,y:.62},{x:0,y:.92},{x:-.72,y:.62},{x:-1.08,y:-.12},{x:-.86,y:-.74}]),fill:s,...e}}}function Fr(t){return t.head==="round"?{cy:0,rx:1,ry:1}:t.head==="tall"?{cy:-.02,rx:.94,ry:1.04}:{cy:.03,rx:1.12,ry:.94}}function Pr(t,e){const{cy:s,rx:i,ry:n}=Fr(t),r=i-e/2,a=n-e/2,l=.15,h=Math.asin(Math.min(1,(l-s)/a)),o=Math.cos(h)*r,f=p=>Math.round(p*100)/100||0,u=[st.M,f(-o),l],c=[[-.84*o,.02,-.53*o,.06,-.32*o,.24],[-.17*o,.11,.17*o,.11,.32*o,.24],[.53*o,.06,.84*o,.02,o,l]];for(const p of c)u.push(st.C,...p.map(f));const y=24;for(let p=1;p<=y;p++){const x=h+(Math.PI-2*h)*p/y;u.push(st.L,f(Math.cos(x)*r),f(s+Math.sin(x)*a))}return u.push(st.Z),u}function Lr(t,e){const s=t.palette,i={stroke:s.outline,lw:e},n=[];for(const r of $)switch(t.ears){case"pointy":case"unicorn":{const a=t.ears==="unicorn"?.8:1,l={x:r*.3,y:-.82},h={x:r*.86,y:-.82-.62*a},o={x:r*.94,y:-.36};n.push({k:"path",d:tt([l,h,o],.2),fill:s.body,...i});const f={x:(l.x+h.x+o.x)/3,y:(l.y+h.y+o.y)/3},u=[l,h,o].map(c=>({x:f.x+(c.x-f.x)*.55,y:f.y+(c.y-f.y)*.55+.04}));n.push({k:"path",d:tt(u,.25),fill:s.accent});break}case"round":n.push({k:"circle",x:r*.72,y:-.72,r:.36,fill:s.ears??s.body,...i}),s.ears||n.push({k:"circle",x:r*.74,y:-.74,r:.19,fill:s.accent});break;case"big-round":n.push({k:"circle",x:r*.96,y:-.46,r:.52,fill:s.body,...i}),n.push({k:"circle",x:r*1,y:-.44,r:.32,fill:s.accent});break;case"long":n.push({k:"ellipse",x:r*.38,y:-1.42,rx:.25,ry:.68,rot:r*.14,fill:s.body,...i}),n.push({k:"ellipse",x:r*.39,y:-1.36,rx:.12,ry:.48,rot:r*.14,fill:s.accent});break;case"side":n.push({k:"circle",x:r*1,y:.02,r:.34,fill:s.body,...i}),n.push({k:"circle",x:r*1.02,y:.02,r:.2,fill:s.belly});break;case"tufts":n.push({k:"path",d:tt([{x:r*.3,y:-.84},{x:r*1.22,y:-1.12},{x:r*.92,y:-.42}],.16),fill:s.body,...i}),n.push({k:"line",pts:[r*.62,-.78,r*1,-.98],stroke:s.accent,lw:.08});break;case"antennae":{const a={x:r*.62,y:-1.42};n.push({k:"path",d:`M${r*.3} -0.8 Q${r*.36} -1.2 ${a.x} ${a.y}`,stroke:s.outline,lw:e*2.6}),n.push({k:"path",d:`M${r*.3} -0.8 Q${r*.36} -1.2 ${a.x} ${a.y}`,stroke:s.body,lw:e*1.2}),n.push({k:"circle",x:a.x,y:a.y,r:.17,fill:s.accent,...i});break}case"floppy":n.push({k:"ellipse",x:r*.96,y:.02,rx:.3,ry:.62,rot:-r*.36,fill:s.ears??s.body,...i});break;case"droopy":n.push({k:"ellipse",x:r*1.04,y:-.22,rx:.4,ry:.18,rot:r*.32,fill:s.skin??s.body,...i}),n.push({k:"ellipse",x:r*1.08,y:-.2,rx:.24,ry:.08,rot:r*.32,fill:s.accent});break;case"human":n.push({k:"ellipse",x:r*.98,y:.06,rx:.17,ry:.23,fill:s.skin??s.body,...i});break;case"horns":{const a=[{x:r*.3,y:-.84},{x:r*.6,y:-1.5},{x:r*.66,y:-.68}];n.push({k:"path",d:tt(a,.18),fill:s.accent,...i});break}}return t.ears==="fin"&&n.push({k:"path",d:tt(ut(-.4,-.82,.2,-1.62,.46,-.78),.2),fill:s.body,...i}),t.ears==="antenna"&&(n.push({k:"line",pts:[0,-.85,0,-1.42],stroke:s.outline,lw:e*2.6}),n.push({k:"line",pts:[0,-.85,0,-1.42],stroke:s.limbs,lw:e*1.2}),n.push({k:"circle",x:0,y:-1.5,r:.18,fill:s.accent,...i})),n}function Nr(t,e){const s=t.palette,i=t.face,n=[],r=s.outline,a=i.eyesOnTop?.46:.4,l=i.eyesOnTop?-.72:-.04,h=(o,f,u)=>({k:"circle",x:o,y:f,r:u,fill:at});switch(i.eyes){case"dot":for(const o of $)n.push({k:"ellipse",x:o*a,y:l,rx:.12,ry:.155,fill:r}),n.push(h(o*a+.04,l-.06,.045));break;case"bead":for(const o of $)n.push({k:"ellipse",x:o*a,y:l,rx:.16,ry:.22,fill:r}),n.push(h(o*a+.05,l-.08,.065));break;case"big":for(const o of $)i.eyeRing&&n.push({k:"circle",x:o*a,y:l,r:.36,fill:i.eyeRing,stroke:r,lw:e*.8}),n.push({k:"circle",x:o*a,y:l,r:.25,fill:at,stroke:r,lw:e*.8}),n.push({k:"circle",x:o*a+o*-.03,y:l+.03,r:.14,fill:i.eyeColor??r}),n.push(h(o*a+o*-.03+.05,l-.03,.05));break;case"mask":for(const o of $)n.push({k:"ellipse",x:o*.4,y:0,rx:.24,ry:.32,rot:o*-.55,fill:s.limbs}),n.push({k:"circle",x:o*.4,y:-.02,r:.11,fill:at}),n.push({k:"circle",x:o*.39,y:-0,r:.065,fill:r});break;case"screen":n.push({k:"rect",x:0,y:0,w:1.5,h:.66,r:.26,fill:"#24323d",stroke:r,lw:e*.8});for(const o of $)n.push({k:"ellipse",x:o*.36,y:0,rx:.2,ry:.24,fill:i.eyeColor??"#7ff0ff",alpha:.3}),n.push({k:"ellipse",x:o*.36,y:0,rx:.12,ry:.16,fill:i.eyeColor??"#7ff0ff"});break;case"almond":for(const o of $)n.push({k:"ellipse",x:o*.42,y:-.02,rx:.3,ry:.2,rot:-o*.5,fill:i.eyeColor??r}),n.push(h(o*.42-o*.07,-.08,.07));break;case"calm":for(const o of $)n.push({k:"ellipse",x:o*.38,y:.02,rx:.085,ry:.12,fill:r}),n.push(h(o*.38+.03,-.02,.03));break;case"slit":n.push({k:"line",pts:[0,-.98,0,-.2],stroke:r,lw:e*.8,alpha:.5}),n.push({k:"rect",x:0,y:-.04,w:1.56,h:.26,r:.1,fill:Cs,stroke:r,lw:e*.8}),n.push({k:"rect",x:0,y:.3,w:.22,h:.46,r:.08,fill:Cs,stroke:r,lw:e*.8});for(const o of $){n.push({k:"ellipse",x:o*.4,y:-.04,rx:.12,ry:.07,fill:i.eyeColor??at});for(const f of[.36,.56])n.push({k:"circle",x:o*.42,y:f,r:.05,fill:r,alpha:.6})}break;case"goggle":for(const o of $)n.push({k:"circle",x:o*.9,y:0,r:.13,fill:s.accent,stroke:r,lw:e*.8});n.push({k:"rect",x:0,y:0,w:1.66,h:.62,r:.3,fill:Cs,stroke:r,lw:e*.8}),n.push({k:"path",d:"M-0.6 -0.16 Q-0.42 -0.24 -0.12 -0.24",stroke:at,lw:.07,alpha:.8});for(const o of $)n.push({k:"path",d:`M${o*.5} 0.04 Q${o*.34} -0.08 ${o*.16} 0.02`,stroke:i.eyeColor??"#7fd6ff",lw:.08});for(const o of[-.18,0,.18])n.push({k:"line",pts:[o,.56,o,.72],stroke:r,lw:e*.8,alpha:.6});break;case"visor":n.push({k:"ellipse",x:0,y:.08,rx:.8,ry:.64,fill:"#2a3f6b",stroke:r,lw:e*.8}),n.push({k:"path",d:"M-0.56 -0.14 Q-0.46 -0.4 -0.16 -0.46",stroke:at,lw:.08,alpha:.7});for(const o of $)n.push({k:"ellipse",x:o*.28,y:.04,rx:.1,ry:.14,fill:i.eyeColor??"#cfeeff"});break}return n}function Ir(t,e){const s=t.palette,i=t.face,n=[],r=i.eyes==="visor"?"#cfeeff":Si,a=e*1.05;switch(i.nose&&i.mouth!=="beak"&&(i.mouth==="cat"?n.push({k:"path",d:tt([{x:-.1,y:.22},{x:.1,y:.22},{x:0,y:.33}],.3),fill:i.nose,stroke:i.nose,lw:e*.6}):t.ears==="big-round"?n.push({k:"ellipse",x:0,y:.22,rx:.2,ry:.25,fill:i.nose}):n.push({k:"ellipse",x:0,y:.25,rx:.13,ry:.085,fill:i.nose})),i.mouth){case"smile":n.push({k:"path",d:i.eyes==="visor"?"M-0.16 0.32 Q0 0.46 0.16 0.32":"M-0.17 0.42 Q0 0.58 0.17 0.42",stroke:r,lw:a});break;case"open":n.push({k:"path",d:"M-0.21 0.4 Q0 0.46 0.21 0.4 Q0.19 0.68 0 0.68 Q-0.19 0.68 -0.21 0.4 Z",fill:r,stroke:r,lw:e*.5}),n.push({k:"ellipse",x:0,y:.6,rx:.1,ry:.06,fill:Sr});break;case"cat":n.push({k:"path",d:"M-0.19 0.4 Q-0.1 0.5 0 0.37 Q0.1 0.5 0.19 0.4",stroke:r,lw:a});break;case"beak":n.push({k:"path",d:tt([{x:-.17,y:.2},{x:.17,y:.2},{x:0,y:.48}],.25),fill:s.accent,stroke:s.outline,lw:e*.8});break;case"teeth":n.push({k:"path",d:"M-0.36 0.34 Q0 0.44 0.36 0.34 Q0.28 0.66 0 0.66 Q-0.28 0.66 -0.36 0.34 Z",fill:r,stroke:r,lw:e*.5});for(const l of $)n.push({k:"rect",x:l*.12,y:.43,w:.1,h:.1,r:.03,fill:at});break;case"grill":n.push({k:"rect",x:0,y:.56,w:.62,h:.2,r:.08,fill:"#24323d",stroke:s.outline,lw:e*.7});for(const l of[-.15,0,.15])n.push({k:"line",pts:[l,.51,l,.61],stroke:"#9fb0bd",lw:e*.6});break;case"tiny":n.push({k:"ellipse",x:0,y:.44,rx:.08,ry:.1,fill:r});break;case"smirk":n.push({k:"path",d:"M-0.16 0.46 Q0.06 0.54 0.22 0.38",stroke:r,lw:a});break;case"bill":n.push({k:"ellipse",x:0,y:.36,rx:.44,ry:.2,fill:s.accent,stroke:s.outline,lw:e*.8}),n.push({k:"path",d:"M-0.36 0.38 Q0 0.46 0.36 0.38",stroke:s.outline,lw:e*.7});for(const l of $)n.push({k:"circle",x:l*.1,y:.28,r:.03,fill:s.outline});break;case"hook":n.push({k:"ellipse",x:0,y:.48,rx:.16,ry:.11,fill:Si}),n.push({k:"path",d:"M-0.3 0.12 Q0 -0.02 0.3 0.12 Q0.36 0.52 0.04 0.76 Q0.08 0.52 -0.08 0.46 Q-0.28 0.38 -0.3 0.12 Z",fill:s.accent,stroke:s.outline,lw:e*.8});break;case"jaws":{n.push({k:"path",d:"M-0.5 0.3 Q0 0.5 0.5 0.3 Q0.38 0.72 0 0.72 Q-0.38 0.72 -0.5 0.3 Z",fill:r,stroke:r,lw:e*.5});for(const l of[-.34,-.17,0,.17,.34]){const h=.3+.4*(l+.5)*(.5-l)-.01;n.push({k:"path",d:tt(ut(l-.075,h,l+.075,h,l,h+.13),.15),fill:at})}break}}return n}var Se=(t,e)=>({x:Math.sin(t)*e,y:-Math.cos(t)*e}),Or=.5,qt={leftEye:2,rightEye:5,leftEar:7,rightEar:8},ce={"3-5":{head:.75,neck:.74,arm:.3,leg:.36,hand:.19,foot:1.2,shoulderMin:.4,shoulderPad:.07,hipMin:.5,hipPad:.22,bottom:.26,bulge:1.12,armsOverHead:!0},"6-8":{head:.6,neck:.78,arm:.22,leg:.28,hand:.15,foot:1,shoulderMin:.34,shoulderPad:.04,hipMin:.4,hipPad:.16,bottom:.14,bulge:1.04,armsOverHead:!1},"9-12":{head:.5,neck:.92,arm:.17,leg:.21,hand:.125,foot:.9,shoulderMin:.36,shoulderPad:.07,hipMin:.32,hipPad:.08,bottom:.1,bulge:1,armsOverHead:!1}},Ze="6-8",Ri=t=>t.band in ce?t.band:Ze,Ml=ce[Ze].head,zr=.3,Dr=.12,Ur=.9,Fi=.5,Pi=.65,Br=.35,Gr=.2,$r=.25,Dt=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),_t=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),ot=(t,e)=>({x:t.x*e,y:t.y*e}),ee=t=>Math.hypot(t.x,t.y),Li=(t,e)=>({x:(t.x+e.x)/2,y:(t.y+e.y)/2}),Rs=t=>{const e=ee(t);return e>1e-9?{x:t.x/e,y:t.y/e}:{x:0,y:1}},Hr=(...t)=>t.every(Number.isFinite),Xr=t=>Math.atan2(Math.sin(t),Math.cos(t)),qr=(t,e,s)=>Math.min(Math.max(t,e),s);function Ni(t,e,s=!1){return i=>{const n=t[i*3],r=t[i*3+1],a=t[i*3+2];return n===void 0||r===void 0||a===void 0||!Hr(n,r,a)?{x:0,y:0,ok:!1}:{x:e.x+(s?1-n:n)*e.w,y:e.y+r*e.h,ok:a>=Or}}}function Fs(t,e,s={}){const i=Ni(t,e,s.mirrored),n=i(V.leftShoulder),r=i(V.rightShoulder);if(!n.ok||!r.ok)return null;const a=i(V.leftHip),l=i(V.rightHip),h=Li(n,r),o=ee(Dt(r,n)),f=a.ok&&l.ok;let u=Rs(Dt(r,n));o<1e-6&&(u={x:1,y:0});let c,y,p;if(f){const C=Li(a,l);y=ee(Dt(C,h)),y>=o*$r?c=Rs(Dt(C,h)):(c={x:-u.y,y:u.x},c.y<0&&(c=ot(c,-1))),p=Math.max(y,o*1.15)}else c={x:-u.y,y:u.x},c.y<0&&(c=ot(c,-1)),p=o*1.15,y=p;p=Math.max(p,1e-6);const x={x:c.y,y:-c.x},m=Math.atan2(x.y,x.x),g=ot(c,-1),w=ce[s.band??Ze]??ce[Ze],E=w.head*p;let k=_t(h,ot(g,E*w.neck));const A=i(V.nose);if(A.ok){const C=_t(A,ot(g,E*.15)),R=ot(Dt(C,k),Br),O=Math.min(1,E*Gr/Math.max(ee(R),1e-6));k=_t(k,ot(R,O))}return{S:h,r:x,d:c,U:p,L:y,hipsOk:f,head:k,headR:E,headRot:m+Wr(t,i,m,p),angle:m}}function Wr(t,e,s,i){const n=[[qt.leftEar,qt.rightEar],[qt.leftEye,qt.rightEye]];for(const[r,a]of n){const l=e(r),h=e(a);if(!l.ok||!h.ok||!(t[r*3+2]>=Pi&&t[a*3+2]>=Pi)||ee(Dt(h,l))<i*.05)continue;const o=Xr(Math.atan2(h.y-l.y,h.x-l.x)-s),f=Math.max(Math.abs(o)-Dr,0),u=qr((Ur+Fi-Math.abs(o))/Fi,0,1);return Math.sign(o)*Math.min(f,zr)*u}return 0}function Ii(t,e,s,i={}){const n=Ri(e),r=ce[n],a=Fs(t,s,{...i,band:n});if(!a)return[];const l=Ni(t,s,i.mirrored),h=e.palette,{S:o,r:f,d:u,U:c,L:y}=a,p=v=>e.bodyExtras.includes(v),x=Math.max(1.2,c*.045),m={stroke:h.outline,lw:x},g=(v,L)=>({x:o.x+f.x*v+u.x*L,y:o.y+f.y*v+u.y*L}),w=v=>v.map(([L,D])=>g(L,D)),E=l(V.leftShoulder),k=l(V.rightShoulder),A=l(V.leftHip),C=l(V.rightHip),R=ee(Dt(k,E)),O=a.hipsOk?ee(Dt(C,A)):R*.7,P=Math.max(R/2+r.shoulderPad*c,r.shoulderMin*c),I=Math.max(O/2+r.hipPad*c,r.hipMin*c),X=-.1*c,Y=y+r.bottom*c,B=[],Ct=[],q=[],et=[],pt=[],Rt=(v,L,D,W)=>{const G=L.flatMap(nt=>[nt.x,nt.y]);v.push({k:"line",pts:G,stroke:h.outline,lw:D+x*2}),v.push({k:"line",pts:G,stroke:W,lw:D})},di=r.leg*c,bt=r.arm*c,Ft=Math.max(r.arm/.22,.9);if(a.hipsOk)for(const[v,L,D,W]of[[A,V.leftKnee,V.leftAnkle,-1],[C,V.rightKnee,V.rightAnkle,1]]){const G=l(L),nt=l(D);if(!G.ok)continue;const ke=_t(v,ot(u,-.12*c)),Ht=nt.ok?[ke,G,nt]:[ke,G];Rt(Ct,Ht,di,h.limbs),p("joints")&&Ct.push({k:"circle",x:G.x,y:G.y,r:.15*c*Ft,fill:h.accent,...m}),nt.ok&&Ct.push(jr(e,nt,a,W,x,r.foot))}for(const[v,L,D,W]of[[E,V.leftElbow,V.leftWrist,-1],[k,V.rightElbow,V.rightWrist,1]]){const G=l(L),nt=l(D);if(p("pauldrons")){const zt=_t(v,ot(u,.02*c));et.push({k:"ellipse",x:zt.x,y:zt.y,rx:.25*c,ry:.17*c,rot:a.angle+W*.25,fill:h.body,...m});const Xt=_t(zt,ot(u,.05*c));et.push({k:"ellipse",x:Xt.x,y:Xt.y,rx:.17*c,ry:.07*c,rot:a.angle+W*.25,fill:h.belly})}if(!G.ok)continue;const Ht=r.armsOverHead&&(G.x-o.x)*u.x+(G.y-o.y)*u.y<-.25*c?pt:et,$e=_t(v,ot(u,.04*c));if(Rt(Ht,nt.ok?[$e,G,nt]:[$e,G],bt,h.limbs),p("joints")&&Ht.push({k:"circle",x:G.x,y:G.y,r:.13*c*Ft,fill:h.accent,...m}),!nt.ok)continue;const Ot=Rs(Dt(nt,G)),ve=_t(nt,ot(Ot,.05*c));if(p("feathers"))for(const zt of[-.55,0,.55]){const Xt=Math.cos(zt),Me=Math.sin(zt)*W,He={x:Ot.x*Xt-Ot.y*Me,y:Ot.x*Me+Ot.y*Xt},ae=_t(ve,ot(He,.16*c));Ht.push({k:"ellipse",x:ae.x,y:ae.y,rx:.2*c,ry:.09*c,rot:Math.atan2(He.y,He.x),fill:h.hands??h.accent,...m})}Ht.push({k:"circle",x:ve.x,y:ve.y,r:r.hand*c,fill:h.hands??h.limbs,...m})}if(p("wings"))for(const v of[-1,1]){const L=w([[v*P*.5,.05*c],[v*(P+.85*c),-.6*c],[v*(P+.72*c),.05*c],[v*(P+.45*c),-.02*c],[v*(P+.3*c),.32*c],[v*P*.6,.55*c]]);B.push({k:"path",d:tt(L,.18),fill:h.accent,...m})}if(p("cape")){const v=y+.8*c,L=I+.36*c,D=w([[-P*.92,X+.04*c],[P*.92,X+.04*c],[P+.16*c,y*.5],[L,v],[L*.5,v-.1*c],[0,v],[-L*.5,v-.1*c],[-L,v],[-P-.16*c,y*.5]]);B.push({k:"path",d:Z(D,.6),fill:h.accent,...m})}if(p("backpack")){const v=g(0,.35*c);B.push({k:"rect",x:v.x,y:v.y,w:P*2+.34*c,h:.8*c,r:.16*c,rot:a.angle,fill:e.extraColors?.[0]??h.limbs,...m})}if(p("tank")){const v=g(P*.95,.24*c),L=e.extraColors?.[0]??h.accent,D=g(P*.95,-.3*c);B.push({k:"rect",x:D.x,y:D.y,w:.14*c,h:.16*c,r:.04*c,rot:a.angle,fill:h.outline}),B.push({k:"rect",x:v.x,y:v.y,w:.34*c,h:1*c,r:.17*c,rot:a.angle,fill:L,...m})}if(a.hipsOk&&!i.portrait&&B.push(...Vr(e,a,I,x)),p("tentacles")&&a.hipsOk)for(const v of[-1,1]){const L=w([[v*I*.7,y*.9],[v*(I+.22*c),y+.3*c],[v*(I+.48*c),y+.22*c],[v*(I+.5*c),y-.02*c],[v*(I+.34*c),y-.06*c]]);B.push({k:"path",d:Te(L),stroke:h.outline,lw:.2*c+x*2}),B.push({k:"path",d:Te(L),stroke:h.limbs,lw:.2*c})}const wt=Math.max(P,I)*r.bulge;if(p("wool")){for(const[L,D]of[[P*.7,X+.02*c],[wt,y*.3],[wt*1.02,y*.62],[(wt+I)/2,y*.92],[I*.55,Y]])for(const W of[-1,1]){const G=g(W*L,D);q.push({k:"circle",x:G.x,y:G.y,r:.2*c,fill:h.body,...m})}const v=g(0,Y+.02*c);q.push({k:"circle",x:v.x,y:v.y,r:.2*c,fill:h.body,...m})}if(p("robe")){const v=y+.58*c,L=I*1.4;q.push({k:"path",d:Z(w([[-P,X],[0,X-.04*c],[P,X],[wt,y*.55],[L,v],[0,v+.06*c],[-L,v],[-wt,y*.55]]),.7),fill:h.body,...m});const D=w([[-L*.94,v-.1*c],[0,v-.04*c],[L*.94,v-.1*c]]);q.push({k:"path",d:Te(D),stroke:e.extraColors?.[0]??h.accent,lw:.07*c})}else if(p("sheet")){const v=y+.78*c,L=I*1.3;q.push({k:"path",d:Z(w([[-P,X],[P,X],[wt,y*.55],[L,v],[L*.5,v-.2*c],[0,v],[-L*.5,v-.2*c],[-L,v],[-wt,y*.55]]),.9),fill:h.body,...m})}else q.push({k:"path",d:Z(w([[-P,X],[0,X-.04*c],[P,X],[wt,y*.55],[I,Y],[0,Y+.03*c],[-I,Y],[-wt,y*.55]]),.85),fill:h.body,...m});const ht=Math.min(P,I);if(p("pocket")){const v=g(0,y*.74);q.push({k:"rect",x:v.x,y:v.y,w:ht*1.3,h:.3*c,r:.1*c,rot:a.angle,fill:h.belly,stroke:h.outline,lw:x*.8})}else if(p("racing-stripe"))for(const v of[-.1,.1]){const L=g(v*c,X+.02*c),D=g(v*c,Y-.04*c);q.push({k:"line",pts:[L.x,L.y,D.x,D.y],stroke:h.belly,lw:.1*c})}else if(h.belly&&h.belly!==h.body&&!p("panel")&&!p("sheet")&&!p("stripes")){const v=g(0,y*.58);q.push({k:"ellipse",x:v.x,y:v.y,rx:ht*.64,ry:Math.max(y*.36,.2*c),rot:a.angle,fill:h.belly})}if(p("spots")){const v=e.extraColors?.[1]??h.belly;for(const[L,D,W]of[[-.55,.35,.09],[.5,.62,.11],[-.35,.86,.07]]){const G=g(L*ht,D*y);q.push({k:"circle",x:G.x,y:G.y,r:W*c,fill:v})}}if(p("stripes")){const v=e.extraColors?.[1]??h.accent;for(const L of[.22,.44,.66]){const D=g(-ht*.98,y*L),W=g(ht*.98,y*L);q.push({k:"line",pts:[D.x,D.y,W.x,W.y],stroke:v,lw:.1*c})}}if(p("straps")){const v=e.extraColors?.[1]??h.outline;for(const L of[-1,1]){const D=g(L*P*.62,X+.02*c),W=g(L*ht*.62,y*.72);q.push({k:"line",pts:[D.x,D.y,W.x,W.y],stroke:h.outline,lw:.13*c+x*2}),q.push({k:"line",pts:[D.x,D.y,W.x,W.y],stroke:v,lw:.13*c})}}if(p("belt")){const v=g(0,y*.9);q.push({k:"rect",x:v.x,y:v.y,w:I*1.92,h:.17*c,r:.06*c,rot:a.angle,fill:e.extraColors?.[2]??"#4a3426",...m}),q.push({k:"rect",x:v.x,y:v.y,w:.2*c,h:.19*c,r:.04*c,rot:a.angle,fill:"#ffd84a",...m})}if(p("emblem")){const v=g(0,y*.4),L=e.extraColors?.[0]??h.accent,D=tt([{x:-.22,y:-.2},{x:.22,y:-.2},{x:.22,y:.04},{x:0,y:.26},{x:-.22,y:.04}],.25);q.push({k:"group",x:v.x,y:v.y,rot:a.angle,s:c,items:[{k:"path",d:D,fill:L,stroke:h.outline,lw:x/c},{k:"group",x:0,y:.01,s:.12,items:[{k:"path",d:Ke,fill:L===h.accent?"#ffffff":h.accent}]}]})}if(p("panel")){const v=g(0,y*.5);q.push({k:"rect",x:v.x,y:v.y,w:ht*1.2,h:.38*c,r:.1*c,rot:a.angle,fill:"#24323d",...m}),(e.extraColors??["#ff7a6b","#fbd46a","#7ff0ff"]).slice(0,3).forEach((D,W)=>{const G=g((W-1)*ht*.34,y*.5);q.push({k:"circle",x:G.x,y:G.y,r:.075*c,fill:D})})}if(p("badge")){const v=g(-ht*.42,y*.36);q.push({k:"circle",x:v.x,y:v.y,r:.15*c,fill:h.accent,...m}),q.push({k:"group",x:v.x,y:v.y,rot:a.angle,s:.09*c,items:[{k:"path",d:Ke,fill:"#ffffff"}]})}if(p("star")){const v=g(-ht*.5,y*.3),L=.15*c;q.push({k:"group",x:v.x,y:v.y,rot:a.angle-.2,s:L,items:[{k:"path",d:Ke,fill:e.extraColors?.[0]??"#ffd84a",stroke:h.outline,lw:x*.8/L}]})}if(p("scarf")){const v=Math.max(.04,r.head*(1-r.neck)-.06)*c,L=g(0,v),D=e.extraColors?.[0]??h.accent,W=g(P*.45,v+.28*c);q.push({k:"rect",x:W.x,y:W.y,w:.16*c,h:.42*c,r:.06*c,rot:a.angle+.15,fill:D,...m}),q.push({k:"rect",x:L.x,y:L.y,w:P*2.05,h:.2*c,r:.1*c,rot:a.angle,fill:D,...m})}const Pt={k:"group",x:a.head.x,y:a.head.y,rot:a.headRot,s:a.headR,items:Qr(e,x/a.headR)};return[...B,...Ct,...q,...et,Pt,...pt]}var Oi=new WeakMap,Yr=64;function Qr(t,e){const s=Number(e.toPrecision(4));let i=Oi.get(t);i||Oi.set(t,i=new Map);let n=i.get(s);return n||(i.size>=Yr&&i.clear(),i.set(s,n=Ci(t,s))),n}function jr(t,e,s,i,n,r){const a=t.palette,{d:l,r:h}=s,o=s.U*r,f=_t(_t(e,ot(l,.07*o)),ot(h,i*.06*o)),u={stroke:a.outline,lw:n},c=a.feet??a.limbs;if(t.bodyExtras.includes("fins")){const y=tt([{x:-.13,y:-.06},{x:.13,y:-.06},{x:.24,y:.46},{x:-.24,y:.46}],.22);return{k:"group",x:f.x,y:f.y,rot:s.angle,s:o,items:[{k:"path",d:y,fill:c,stroke:a.outline,lw:n/o},{k:"line",pts:[0,.06,0,.38],stroke:a.outline,lw:n/o,alpha:.5}]}}return t.bodyExtras.includes("flippers")?{k:"ellipse",x:f.x,y:f.y,rx:.27*o,ry:.11*o,rot:s.angle,fill:c,...u}:t.bodyExtras.includes("boots")?{k:"rect",x:f.x,y:f.y,w:.4*o,h:.24*o,r:.09*o,rot:s.angle,fill:c,...u}:{k:"ellipse",x:f.x,y:f.y,rx:.2*o,ry:.13*o,rot:s.angle,fill:c,...u}}function Vr(t,e,s,i){const n=t.palette,{U:r,L:a,S:l,r:h,d:o}=e,f=(x,m)=>({x:l.x+h.x*x+o.x*m,y:l.y+h.y*x+o.y*m}),u=x=>x.map(([m,g])=>f(m,g)),c={stroke:n.outline,lw:i},y=(x,m,g)=>[{k:"path",d:Te(x),stroke:n.outline,lw:m+i*2},{k:"path",d:Te(x),stroke:g,lw:m}],p=[];switch(t.tail){case"none":break;case"fluffy":{const x=u([[s*.5,a*.95],[s+.28*r,a*1],[s+.72*r,a*.62],[s+.78*r,a*.12],[s+.52*r,a*.32],[s+.3*r,a*.6],[s*.6,a*.7]]);p.push({k:"path",d:Z(x),fill:n.body,...c});const m=f(s+.72*r,a*.2);p.push({k:"ellipse",x:m.x,y:m.y,rx:.13*r,ry:.2*r,rot:e.angle+.25,fill:n.belly,...c});break}case"brush":{const x=u([[s*.4,a*.98],[s+.42*r,a*1.06],[s+.98*r,a*.66],[s+1.06*r,a*.12],[s+.86*r,-.04*r],[s+.66*r,a*.36],[s+.3*r,a*.66],[s*.5,a*.68]]);p.push({k:"path",d:Z(x),fill:n.body,...c});const m=u([[s+1.03*r,a*.36],[s+1.06*r,a*.12],[s+.86*r,-.04*r],[s+.72*r,a*.24],[s+.86*r,a*.34]]);p.push({k:"path",d:Z(m),fill:n.belly,...c});break}case"pom":{const x=f(s+.06*r,a*.88);p.push({k:"circle",x:x.x,y:x.y,r:.2*r,fill:n.belly,...c});break}case"long":case"striped":case"tuft":{const x=u([[s*.6,a*.9],[s+.35*r,a*.85],[s+.58*r,a*.4],[s+.5*r,-.02*r]]);if(p.push(...y(x,.14*r,n.body)),t.tail==="tuft"){const m=x[x.length-1];p.push({k:"circle",x:m.x,y:m.y,r:.16*r,fill:t.extraColors?.[0]??n.accent,...c})}if(t.tail==="striped"){for(const g of[.35,.6,.85]){const w=f(s+.35*r+.22999999999999998*r*(g*1.4>1?1:g*1.4),a*(.85-.85*g));p.push({k:"line",pts:[w.x-h.x*.08*r,w.y-h.y*.08*r,w.x+h.x*.08*r,w.y+h.y*.08*r],stroke:t.extraColors?.[0]??n.outline,lw:.06*r})}const m=x[x.length-1];p.push({k:"circle",x:m.x,y:m.y,r:.07*r,fill:t.extraColors?.[0]??n.outline})}break}case"curl":{const x=u([[s*.6,a*.9],[s+.4*r,a*.88],[s+.62*r,a*.45],[s+.5*r,a*.12],[s+.3*r,a*.24],[s+.36*r,a*.42]]);p.push(...y(x,.12*r,n.limbs));break}case"fish":{const x=u([[s*.6,a*.9],[s+.36*r,a*.86],[s+.6*r,a*.5]]);p.push(...y(x,.17*r,n.body));const m=x[x.length-1],g=tt([{x:0,y:.06},{x:-.26,y:-.34},{x:.02,y:-.12},{x:.32,y:-.3}],.2);p.push({k:"group",x:m.x,y:m.y,rot:e.angle+.35,s:r,items:[{k:"path",d:g,fill:n.body,stroke:n.outline,lw:i/r}]});break}case"plume":{const x=t.extraColors??[n.accent];[0,1,2].forEach(m=>{const g=f(s+(.12+m*.13)*r,a+(.32-m*.06)*r);p.push({k:"ellipse",x:g.x,y:g.y,rx:.11*r,ry:.44*r,rot:e.angle-.55+m*.28,fill:x[(m+1)%x.length],...c})});break}case"spiky":case"arrow":{const x=u([[s*.3,a*.55],[s+.35*r,a*.68],[s+.95*r,a*.86],[s+.35*r,a*1.08],[s*.3,a*1.08]]);if(t.tail==="spiky"){for(const m of[.15,.45,.72]){const g=s+(.2+m*.7)*r,w=a*(.66+m*.19);p.push({k:"path",d:tt(u([[g-.12*r,w+.05*r],[g,w-.2*r],[g+.12*r,w+.07*r]]),.2),fill:n.accent,...c})}p.push({k:"path",d:Z(x,.7),fill:n.body,...c})}else{const m=u([[s*.6,a*.9],[s+.4*r,a*.92],[s+.62*r,a*.5],[s+.62*r,a*.18]]);p.push(...y(m,.13*r,n.body));const g=m[m.length-1];p.push({k:"group",x:g.x,y:g.y,rot:e.angle,s:r,items:[{k:"path",d:tt([{x:-.15,y:.04},{x:0,y:-.22},{x:.15,y:.04}],.2),fill:n.accent,stroke:n.outline,lw:i/r}]})}break}}return p}var Kr={nose:[0,-.62],leftShoulder:[-.42,0],rightShoulder:[.42,0],leftElbow:[-.58,.5],rightElbow:[.58,.5],leftWrist:[-.66,.98],rightWrist:[.66,.98],leftHip:[-.27,1],rightHip:[.27,1],leftKnee:[-.31,1.6],rightKnee:[.31,1.6],leftAnkle:[-.33,2.18],rightAnkle:[.33,2.18]};function Zr(t,{cx:e=.5,cy:s=.36,T:i=.18}={}){const n={...Kr,...t},r=new Array(vi*3).fill(0),a=(o,[f,u],c=.99)=>{r[o*3]=e+f*i,r[o*3+1]=s+u*i,r[o*3+2]=c};for(const o of Object.keys(V))a(V[o],n[o]);const l=n.tilt??0,h=(o,f)=>[n.nose[0]+o*Math.cos(l)-f*Math.sin(l),n.nose[1]+o*Math.sin(l)+f*Math.cos(l)];return a(qt.leftEye,h(-.1,-.08)),a(qt.rightEye,h(.1,-.08)),a(qt.leftEar,h(-.22,-.02)),a(qt.rightEar,h(.22,-.02)),r}var Jr=()=>Zr({}),zi=.5,ta=.15,ea=class{constructor(t={}){d(this,"tracks",new Map),d(this,"offset",NaN),d(this,"lastArrival",NaN),d(this,"interval",33),d(this,"lastT",NaN),d(this,"lostMs"),d(this,"maxExtrapolateMs"),this.lostMs=t.lostMs??250,this.maxExtrapolateMs=t.maxExtrapolateMs??25}get delayMs(){return this.interval}push(t,e,s,i=Di()){Number.isFinite(e)||(e=i),this.clock(e,i);const n=this.tracks.get(t);if(!n||e-n.tb>this.lostMs||e<n.tb-this.lostMs||s.length!==n.b.length){this.tracks.set(t,{a:null,ta:e,b:s,tb:e,out:null,outAt:NaN});return}if(s===n.b||e<=n.tb){e===n.tb&&s!==n.b&&(n.b=s,n.out=null);return}n.a=n.b,n.ta=n.tb,n.b=s,n.tb=e,n.out=null}at(t,e=Di()){const s=this.tracks.get(t);if(!s)return null;if(!s.a)return s.b;if(s.out&&s.outAt===e)return s.out;const i=e-this.offset-this.interval,n=s.tb-s.ta,r=Math.min(n*.5,this.maxExtrapolateMs),a=Math.min(Math.max((i-s.ta)/n,0),1+r/n);return s.out=sa(s.a,s.b,a),s.outAt=e,s.out}forget(t){this.tracks.delete(t)}clear(){this.tracks.clear()}clock(t,e){const s=e-t;if(!Number.isFinite(this.offset)||s<this.offset||s>this.offset+1e3?this.offset=s:Number.isFinite(this.lastArrival)&&(this.offset+=Math.min(s-this.offset,(e-this.lastArrival)/1e3)),this.lastArrival=e,Number.isFinite(this.lastT)&&t>this.lastT){const i=t-this.lastT;i<this.interval*3+20&&(this.interval+=(Math.min(Math.max(i,8),100)-this.interval)*.1)}t<=this.lastT||(this.lastT=t)}},Di=()=>globalThis.performance?.now()??Date.now();function sa(t,e,s){const i=e.slice(),n=s<.5?t:e;for(let r=0;r+2<e.length;r+=3){const a=t[r],l=t[r+1],h=e[r],o=e[r+1];t[r+2]>=zi&&e[r+2]>=zi&&Math.abs(h-a)+Math.abs(o-l)<ta?(i[r]=a+(h-a)*s,i[r+1]=l+(o-l)*s,i[r+2]=t[r+2]+(e[r+2]-t[r+2])*Math.min(s,1)):(i[r]=n[r],i[r+1]=n[r+1],i[r+2]=n[r+2])}return i}var El=_i.map(t=>t.id),Je=new Map(_i.map(t=>[t.id,t])),Ce=Je.get("fox"),ia=t=>typeof t=="string"&&Je.has(t),ts=t=>Je.get(t),na=t=>typeof t=="string"?Je.get(t)??Ce:t;function ra(t,e){const s=na(t),i=Jr(),n=Ri(s),r=Fs(i,{x:0,y:0,w:1,h:1},{band:n}),a=-Ui(Ci(s,.05)).minY,h=Math.min(.27,.43/Math.max(a,1))*e/ce[n].head/r.U,o=.5*e+Math.min(0,(a-1.6)*.06*e),f={x:e/2-r.head.x*h,y:o-r.head.y*h,w:h,h};return Ii(i,s,f,{portrait:!0})}function aa(t,e,s=.5){if(!t||t.length!==e.length)return e.slice();const i=e.slice();for(let n=0;n+2<e.length;n+=3){const r=t[n+2],a=e[n+2],l=r>=.5,h=a>=.5;l&&a>=.3&&(i[n+2]=Math.max(a,.5)),l&&h&&Math.hypot(e[n]-t[n],e[n+1]-t[n+1])<.15?(i[n]=t[n]+(e[n]-t[n])*s,i[n+1]=t[n+1]+(e[n+1]-t[n+1])*s):l&&!h&&i[n+2]>=.5&&(i[n]=t[n],i[n+1]=t[n+1])}return ha(t,e,i,s*oa),i}var oa=.35,la=11;function ha(t,e,s,i){const n=V.leftShoulder*3,r=V.rightShoulder*3,a=(u,c)=>u[c+2]>=.5;if(!a(t,n)||!a(t,r)||!a(e,n)||!a(e,r))return;const l=(u,c)=>(u[n+c]+u[r+c])/2,h=[l(t,0),l(t,1)],o=[l(e,0),l(e,1)],f=[l(s,0),l(s,1)];for(let u=0;u<la&&u*3+2<e.length;u++){const c=u*3;if(!a(t,c)||!a(e,c))continue;const y=[t[c]-h[0],t[c+1]-h[1]],p=[e[c]-o[0],e[c+1]-o[1]];Math.hypot(p[0]-y[0],p[1]-y[1])>=.15||(s[c]=f[0]+y[0]+(p[0]-y[0])*i,s[c+1]=f[1]+y[1]+(p[1]-y[1])*i)}}function Ui(t){const e={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},s=(i,n)=>{e.minX=Math.min(e.minX,i),e.minY=Math.min(e.minY,n),e.maxX=Math.max(e.maxX,i),e.maxY=Math.max(e.maxY,n)};for(const i of t){const n="lw"in i&&i.stroke?(i.lw??1)/2:0;switch(i.k){case"circle":s(i.x-i.r-n,i.y-i.r-n),s(i.x+i.r+n,i.y+i.r+n);break;case"ellipse":case"rect":{const r=i.k==="ellipse"?i.rx:i.w/2,a=i.k==="ellipse"?i.ry:i.h/2,l=Math.max(r,a)+n;s(i.x-l,i.y-l),s(i.x+l,i.y+l);break}case"path":{const r=_r(i.d);for(let a=0;a+1<r.length;a+=2)s(r[a]-n,r[a+1]-n),s(r[a]+n,r[a+1]+n);break}case"line":for(let r=0;r+1<i.pts.length;r+=2)s(i.pts[r]-n,i.pts[r+1]-n),s(i.pts[r]+n,i.pts[r+1]+n);break;case"group":{const r=Ui(i.items);if(!Number.isFinite(r.minX))break;const a=i.s??1,l=Math.cos(i.rot??0),h=Math.sin(i.rot??0);for(const[o,f]of[[r.minX,r.minY],[r.maxX,r.minY],[r.minX,r.maxY],[r.maxX,r.maxY]])s(i.x+(o*l-f*h)*a,i.y+(o*h+f*l)*a);break}}}return e}var fe=()=>Float64Array.of(1,0,0,1,0,0);function Ut(t,e,s,i,n,r,a){const l=n?Math.cos(n):1,h=n?Math.sin(n):0,o=l*r,f=h*r,u=-h*a,c=l*a;if(!e)return t[0]=o,t[1]=f,t[2]=u,t[3]=c,t[4]=s,t[5]=i,t;const y=e[0],p=e[1],x=e[2],m=e[3];return t[0]=y*o+x*f,t[1]=p*o+m*f,t[2]=y*u+x*c,t[3]=p*u+m*c,t[4]=y*s+x*i+e[4],t[5]=p*s+m*i+e[5],t}function ca(t,e,s){const i=t[0]*t[3]-t[1]*t[2];if(Math.abs(i)<1e-12)return null;const n=e-t[4],r=s-t[5];return[(t[3]*n-t[2]*r)/i,(-t[1]*n+t[0]*r)/i]}var Bi={white:16777215,black:0,red:16711680,transparent:0},Re=new Map;function Lt(t){if(typeof t=="number")return[t&16777215,1];const e=Re.get(t);if(e)return e;let s=[16777215,1];const i=t.trim().toLowerCase();if(i[0]==="#"){const n=i.slice(1),r=n.length<=4?[...n].map(l=>l+l).join(""):n,a=parseInt(r.slice(0,6),16);Number.isFinite(a)&&(s=[a,r.length===8?parseInt(r.slice(6,8),16)/255:1])}else if(i.startsWith("rgb")){const n=i.match(/-?\d*\.?\d+%?/g)?.map(o=>o.endsWith("%")?parseFloat(o)/100*255:parseFloat(o))??[],[r=255,a=255,l=255]=n,h=n[3]===void 0?1:i.match(/,\s*[\d.]+%\s*\)$/)?n[3]/255:n[3];s=[(Ps(r)<<16|Ps(a)<<8|Ps(l))>>>0,Math.min(Math.max(h,0),1)]}else if(i in Bi)s=[Bi[i],i==="transparent"?0:1];else if(typeof document<"u"){const n=document.createElement("canvas").getContext("2d");if(n){n.fillStyle="#ffffff",n.fillStyle=i;const r=n.fillStyle;if(r!==i)return Re.set(t,s=Lt(r)),s}}return Re.size>512&&Re.clear(),Re.set(t,s),s}var Ps=t=>Math.min(Math.max(Math.round(t),0),255);function ue(t,e,s=!1){const i=Math.min(Math.max(e,0),1),n=(t>>16&255)*i,r=(t>>8&255)*i,a=(t&255)*i,l=s?0:i*255;return(Math.round(l)<<24|Math.round(a)<<16|Math.round(r)<<8|Math.round(n))>>>0}var Fe=(t,e=1)=>`rgba(${t>>16&255},${t>>8&255},${t&255},${e})`;function Gi(t,e){if(t===16777215)return e;if(e===16777215)return t;const s=i=>Math.round((t>>i&255)*(e>>i&255)/255);return(s(16)<<16|s(8)<<8|s(0))>>>0}var Pe={linear:t=>t,quadIn:t=>t*t,quadOut:t=>t*(2-t),quadInOut:t=>t<.5?2*t*t:-1+(4-2*t)*t,cubicOut:t=>1-(1-t)**3,sineInOut:t=>-(Math.cos(Math.PI*t)-1)/2,backOut:t=>1+(1.70158+1)*(t-1)**3+1.70158*(t-1)**2,elasticOut:t=>t===0||t===1?t:2**(-10*t)*Math.sin((t*10-.75)*(2*Math.PI/3))+1,bounceOut:t=>t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375};function fa(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let s=e;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}var Le=1,$i=2,es=0,Tt=1,ua=4294967295,_={cap:0,epoch:0,x:new Float64Array(0),y:new Float64Array(0),rot:new Float64Array(0),sx:new Float64Array(0),sy:new Float64Array(0),alpha:new Float64Array(0),la:new Float64Array(0),lb:new Float64Array(0),lc:new Float64Array(0),ld:new Float64Array(0),world:new Float64Array(0),tint:new Uint32Array(0),flags:new Uint8Array(0),moved:new Uint8Array(0),dirty:new Uint8Array(0),gen:new Uint32Array(0),parent:new Int32Array(0),first:new Int32Array(0),next:new Int32Array(0),prev:new Int32Array(0),stamp:new Uint32Array(0),pass:0,free:new Int32Array(0),freeHead:0,freeCount:0,top:2},Wt=[],da="x y rot sx sy alpha la lb lc ld world tint flags moved dirty gen parent first next prev stamp".split(" ");function Hi(t){const e=_;for(const i of da){const n=e[i],r=new n.constructor(i==="world"?t*6:t);r.set(n),e[i]=r}const s=new Int32Array(t);for(let i=0;i<_.freeCount;i++)s[i]=_.free[(_.freeHead+i)%_.cap];for(_.free=s,_.freeHead=0,_.cap=t,_.epoch++;Wt.length<t;)Wt.push(null)}function Ls(t){_.x[t]=_.y[t]=_.rot[t]=0,_.sx[t]=_.sy[t]=_.alpha[t]=1,_.la[t]=_.ld[t]=1,_.lb[t]=_.lc[t]=0;const e=t*6,s=_.world;s[e]=s[e+3]=1,s[e+1]=s[e+2]=s[e+4]=s[e+5]=0,_.tint[t]=16777215,_.flags[t]=Le|$i,_.moved[t]=1,_.dirty[t]=0,_.parent[t]=_.first[t]=_.next[t]=_.prev[t]=-1}Hi(256),Ls(es),_.flags[es]=0,Ls(Tt),_.flags[Tt]=0;function pa(){let t;if(_.freeCount){t=_.free[_.freeHead],_.freeHead=(_.freeHead+1)%_.cap,_.freeCount--;const e=Wt[t];e&&(e._i=es,e._g=-1,Wt[t]=null)}else _.top===_.cap&&Hi(_.cap*2),t=_.top++;return Ls(t),t}function Xi(t,e){Ns(t);for(let i=_.first[t];i>=0;){const n=_.next[i];_.parent[i]=_.next[i]=_.prev[i]=-1,i=n}_.first[t]=-1,_.flags[t]=_.flags[t]&~$i,_.moved[t]=0;const s=_.gen[t]+1;_.gen[t]=s,s!==ua&&(e&&(Wt[t]=e),_.free[(_.freeHead+_.freeCount)%_.cap]=t,_.freeCount++)}function ya(t){for(let e=0;e<Wt.length;e++){const s=Wt[e];s&&t(s)&&(s._i=es,s._g=-1,Wt[e]=null)}}function ma(t,e){Ns(t);const s=_.first[e];_.parent[t]=e,_.next[t]=s,_.prev[t]=-1,s>=0&&(_.prev[s]=t),_.first[e]=t,_.moved[t]=1}function Ns(t){const e=_.parent[t];if(e<0)return;const s=_.next[t],i=_.prev[t];i>=0?_.next[i]=s:_.first[e]=s,s>=0&&(_.prev[s]=i),_.parent[t]=_.next[t]=_.prev[t]=-1}var Ne={root:-1,gen:-1,world:new Float64Array(6)};function xa(t){const e=++_.pass,s=_.world,i=t*6,n=Ne.world;let r=Ne.root!==t||Ne.gen!==_.gen[t];for(let a=0;a<6;a++)n[a]!==s[i+a]&&(r=!0),n[a]=s[i+a];Ne.root=t,Ne.gen=_.gen[t],_.stamp[t]=r?e:e-1}function ga(t){_.stamp[t]=_.pass}function qi(t){for(let e=_.first[t];e>=0;){const s=_.next[e];qi(e),e=s}Xi(t)}var Is=typeof FinalizationRegistry=="function"?new FinalizationRegistry(t=>_.gen[t.i]===t.g&&qi(t.i)):null;function Wi(t){t._reg||!Is||(t._reg=!0,Is.register(t,{i:t._i,g:t._g},t))}function ba(t){t._reg&&Is.unregister(t)}var Os=1,zs=2,Ds=3,Us=4;function Bs(t){if(t){for(let e=0;e<t.length;e++)if(t[e].enabled)return!0}return!1}function wa(t,e){let s=0;for(let i=0;i<t.length;i++){const n=t[i];n.enabled&&n.pad&&(s+=n.pad(e))}return s}var Nt={gl:null,c2d:null,live:null},Q=new Float64Array(3),Gs=4,ka=1,$s=()=>ka++,it=fe(),F=_,se=class{constructor(t){d(this,"kernel",t),d(this,"_i",pa()),d(this,"_g",F.gen[this._i]),d(this,"_wv",null),d(this,"_wi",-1),d(this,"_we",-1),d(this,"blend","normal"),d(this,"_data",null),d(this,"parent",null),d(this,"hitRadius",null),d(this,"clip",null),d(this,"mask",null),d(this,"filters",null),d(this,"_z",0),d(this,"anchorX",0),d(this,"anchorY",0),d(this,"_pool",null),d(this,"_free",!1),d(this,"_reg",!1)}get x(){return F.x[this._i]}set x(t){const e=this._i||Tt;F.x[e]=t,F.moved[e]=1}get y(){return F.y[this._i]}set y(t){const e=this._i||Tt;F.y[e]=t,F.moved[e]=1}get rotation(){return F.rot[this._i]}set rotation(t){const e=this._i||Tt;F.rot[e]=t,F.dirty[e]=F.moved[e]=1}get scaleX(){return F.sx[this._i]}set scaleX(t){const e=this._i||Tt;F.sx[e]=t,F.dirty[e]=F.moved[e]=1}get scaleY(){return F.sy[this._i]}set scaleY(t){const e=this._i||Tt;F.sy[e]=t,F.dirty[e]=F.moved[e]=1}get alpha(){return F.alpha[this._i]}set alpha(t){const e=this._i||Tt;F.alpha[e]=t,F.moved[e]=1}get visible(){return(F.flags[this._i]&Le)!==0}set visible(t){const e=this._i||Tt;t?F.flags[e]=F.flags[e]|Le:F.flags[e]=F.flags[e]&~Le,F.moved[e]=1}get destroyed(){return F.gen[this._i]!==this._g}get world(){const t=this._i||Tt;return(this._wi!==t||this._we!==F.epoch)&&(this._wv=F.world.subarray(t*6,t*6+6),this._wi=t,this._we=F.epoch),this._wv}get data(){return this._data??(this._data={})}set data(t){this._data=t}get scale(){return this.scaleX}set scale(t){this.scaleX=this.scaleY=t}get z(){return this._z}set z(t){t!==this._z&&(this._z=t,this.parent&&(this.parent.sortDirty=!0))}get tint(){return F.tint[this._i]}set tint(t){F.tint[this._i||Tt]=typeof t=="number"?t&16777215:Lt(t)[0]}set anchor(t){typeof t=="number"?this.anchorX=this.anchorY=t:(this.anchorX=t.x,this.anchorY=t.y)}get width(){return 0}set width(t){}get height(){return 0}set height(t){}set(t){for(const e in t){const s=t[e];s!==void 0&&(this[e]=s)}return this}destroy(){this.destroyed||(this.visible=!1,this.parent&&(this.parent.dead=!0,this.parent=null),Xi(this._i,this),ba(this),this.kernel.tweens.stopAll(this),this._pool?.forget(this))}updateWorld(){const t=this.parent?this.parent.updateWorld():null;return Ut(this.world,t,this.x,this.y,this.rotation,this.scaleX,this.scaleY)}draw(t,e,s){}};function va(t){ya(e=>e.kernel===t)}var Hs=!1,Yi=Object.freeze([]),Xs=class rr extends se{constructor(e){super(e),d(this,"children",Yi),d(this,"sortDirty",!1),d(this,"dead",!1),Wi(this)}add(e,...s){this.adopt(e);for(let i=0;i<s.length;i++)this.adopt(s[i]);return e}adopt(e){e.parent&&e.parent.detach(e),e.parent=this,!e.destroyed&&!this.destroyed&&ma(e._i,this._i),this.children===Yi&&(this.children=[]),this.children.push(e),(e.z!==0||this.sortDirty)&&(this.sortDirty=!0)}remove(e){this.detach(e),e._pool||Wi(e)}detach(e){const s=this.children,i=s.indexOf(e);if(i>=0){for(let n=i+1;n<s.length;n++)s[n-1]=s[n];s.pop()}e.parent===this&&(e.parent=null,e.destroyed||Ns(e._i))}clear(){for(const e of this.children)e.destroy()}destroy(){for(const e of this.children)e.destroy();super.destroy()}sweep(){if(this.dead){this.dead=!1;let e=0;for(const s of this.children)s.destroyed?s.parent===this&&(s.parent=null):this.children[e++]=s;this.children.length=e}for(const e of this.children)e instanceof rr&&e.sweep()}draw(e,s,i){if(Hs)return F.parent[this._i]<0&&!this.destroyed&&ga(this._i),this.drawChildren(e,s,i);Hs=!0;try{this.destroyed||xa(this._i),this.drawChildren(e,s,i)}finally{Hs=!1}}drawChildren(e,s,i){if(this.sortDirty){const l=new Map(this.children.map((h,o)=>[h,o]));this.children.sort((h,o)=>h.z-o.z||l.get(h)-l.get(o)),this.sortDirty=!1}const n=this.children,r=this._i,a=F.stamp[r]===F.pass;for(let l=0;l<n.length;l++){const h=n[l],o=h._i,f=F.alpha[o];if(F.gen[o]!==h._g||!(F.flags[o]&Le)||f<=0)continue;if(a||F.moved[o]){F.moved[o]=0,F.stamp[o]=F.pass;let y,p,x,m;if(F.dirty[o]){F.dirty[o]=0;const I=F.rot[o],X=I?Math.cos(I):1,Y=I?Math.sin(I):0,B=F.sx[o],Ct=F.sy[o];F.la[o]=y=X*B,F.lb[o]=p=Y*B,F.lc[o]=x=-Y*Ct,F.ld[o]=m=X*Ct}else y=F.la[o],p=F.lb[o],x=F.lc[o],m=F.ld[o];const g=F.world,w=F.x[o],E=F.y[o],k=o*6,A=r*6,C=g[A],R=g[A+1],O=g[A+2],P=g[A+3];g[k]=C*y+O*p,g[k+1]=R*y+P*p,g[k+2]=C*x+O*m,g[k+3]=R*x+P*m,g[k+4]=C*w+O*E+g[A+4],g[k+5]=R*w+P*E+g[A+5]}const u=s*f,c=Gi(i,F.tint[o]);h.clip||h.mask||h.filters?ji(e,h,u,c):h.draw(e,u,c)}}},dt=new Float64Array(128),ie=0,qs=new Float64Array(8);function Qi(t,e,s,i){e.clip||e.mask||e.filters?ji(t,e,s,i):e.draw(t,s,i)}function ji(t,e,s,i){const n=t.r,r=e.world,a=e.clip;let l=!1,h=!1;if(a)if(Math.abs(r[1])<1e-9&&Math.abs(r[2])<1e-9&&ie<32){const u=r[0]*a.x+r[4],c=r[0]*(a.x+a.width)+r[4],y=r[3]*a.y+r[5],p=r[3]*(a.y+a.height)+r[5];let x=Math.min(u,c),m=Math.max(u,c),g=Math.min(y,p),w=Math.max(y,p);if(ie){const k=(ie-1)*4;x=Math.max(x,dt[k]),g=Math.max(g,dt[k+1]),m=Math.min(m,dt[k+2]),w=Math.min(w,dt[k+3])}const E=ie++*4;dt[E]=x,dt[E+1]=g,dt[E+2]=m,dt[E+3]=w,n.clip(x,g,Math.max(m-x,0),Math.max(w-g,0)),h=!0}else l=!0;const o=e.mask&&e.mask.visible?e.mask:null,f=Bs(e.filters)?e.filters:null;try{if(l&&n.beginLayer(),o&&n.beginLayer(),f?(e.draw(t,n.beginLayer()?1:s,i),n.endLayer(s,f)):e.draw(t,s,i),o&&(n.beginMask(),Ut(o.world,r,o.x,o.y,o.rotation,o.scaleX,o.scaleY),Qi(t,o,o.alpha,16777215),n.endLayer(1)),l&&a){n.beginMask();for(let u=0;u<4;u++){const c=u===1||u===2?a.x+a.width:a.x,y=u>1?a.y+a.height:a.y;qs[u*2]=r[0]*c+r[2]*y+r[4],qs[u*2+1]=r[1]*c+r[3]*y+r[5]}n.polygon(qs,4,16777215,1),n.endLayer(1)}}finally{if(h)if(ie--,ie){const u=(ie-1)*4;n.clip(dt[u],dt[u+1],dt[u+2]-dt[u],dt[u+3]-dt[u+1])}else n.unclip()}}var de=class extends se{constructor(t,e,s){super(t),d(this,"_frame",null),d(this,"_w",null),d(this,"_h",null),d(this,"slice",0),d(this,"autoAnchor",!0),d(this,"frameName",null),e&&(this.frame=e),s?.anchor===void 0&&this.useFrameAnchor(),s&&this.set(s)}get frame(){return this._frame}set frame(t){this.frameName=typeof t=="string"?t:null,this._frame=typeof t=="string"?this.kernel.frame(t):t,this.autoAnchor&&this.useFrameAnchor()}set anchor(t){this.autoAnchor=!1,super.anchor=t}get naturalWidth(){const t=this.frameNow();return t?(t.sw??t.w)/t.scale-t.margin*2:0}get naturalHeight(){const t=this.frameNow();return t?(t.sh??t.h)/t.scale-t.margin*2:0}get width(){return this._w??this.naturalWidth}set width(t){this._w=t}get height(){return this._h??this.naturalHeight}set height(t){this._h=t}sizeQ(t){me[0]=this._w??(t.sw??t.w)/t.scale-t.margin*2,me[1]=this._h??(t.sh??t.h)/t.scale-t.margin*2}frameNow(){return this.frameName&&!this.kernel.atlas.valid(this._frame)&&(this._frame=this.kernel.frame(this.frameName)),this._frame}useFrameAnchor(){const t=this._frame;if(!t)return;const e=(t.sw??t.w)/t.scale-t.margin*2,s=(t.sh??t.h)/t.scale-t.margin*2;this.anchorX=e>0?(t.ox-t.margin)/e:0,this.anchorY=s>0?(t.oy-t.margin)/s:0}draw(t,e,s){const i=this.frameNow();if(!i)return;const n=me;this.sizeQ(i),n[2]=this.anchorX,n[3]=this.anchorY,n[4]=e,Ma(t,i,this.world,this.slice,s,this.blend)}},pe=new Float64Array(12),ye=new Float64Array(12),Ie={x:0,y:0,w:0,h:0};function Vi(t,e,s,i,n,r){e=Math.max(e,0),s=Math.max(s,0),i=Math.max(i,0);const a=s+i>n?s*n/(s+i):s,l=s+i>n?i*n/(s+i):i;let h=a/r,o=l/r;if(h+o>e){const f=e/(h+o);h*=f,o*=f}t[0]=0,t[1]=h,t[2]=0,t[3]=a,t[4]=h,t[5]=e-h-o,t[6]=a,t[7]=n-a-l,t[8]=e-o,t[9]=o,t[10]=n-l,t[11]=l}var me=new Float64Array(5);function Ma(t,e,s,i,n,r){const a=me,l=a[0],h=a[1],o=a[2],f=a[3],u=a[4],c=t.tex(e.surface),y=i===0?e.slice??0:i;if(y===0){const k=(e.sw??e.w)/e.scale-e.margin*2,A=(e.sh??e.h)/e.scale-e.margin*2,C=k>0?l/k:1,R=A>0?h/A:1,O=-o*l+((e.tx??0)/e.scale-e.margin)*C,P=-f*h+((e.ty??0)/e.scale-e.margin)*R;ss(s,O,P),Q[0]=e.w/e.scale*C,Q[1]=e.h/e.scale*R,Q[2]=u,t.r.quadQ(c,e,it,n,r);return}const p=e.tx??0,x=e.ty??0,m=(e.sw??e.w)-e.w-p,g=(e.sh??e.h)-e.h-x,w=-o*l-e.margin+p/e.scale,E=-f*h-e.margin+x/e.scale;if(Vi(pe,l+e.margin*2-(p+m)/e.scale,(typeof y=="number"?y:y[3])-p,(typeof y=="number"?y:y[1])-m,e.w,e.scale),Vi(ye,h+e.margin*2-(x+g)/e.scale,(typeof y=="number"?y:y[0])-x,(typeof y=="number"?y:y[2])-g,e.h,e.scale),ss(s,w,E),Q[2]=u,!t.r.nineQ?.(c,e,pe,ye,it,n,r))for(let k=0;k<12;k+=4){const A=ye[k+1],C=ye[k+3];if(!(A<=0||C<=0))for(let R=0;R<12;R+=4){const O=pe[R+1],P=pe[R+3];O<=0||P<=0||(Ie.x=e.x+pe[R+2],Ie.y=e.y+ye[k+2],Ie.w=P,Ie.h=C,ss(s,w+pe[R],E+ye[k]),Q[0]=O,Q[1]=A,Q[2]=u,t.r.quadQ(c,Ie,it,n,r))}}}function ss(t,e,s){it[0]=t[0],it[1]=t[1],it[2]=t[2],it[3]=t[3],it[4]=t[0]*e+t[2]*s+t[4],it[5]=t[1]*e+t[3]*s+t[5]}var Oe=class extends de{constructor(t,e,s={}){super(t,null),d(this,"_spec"),d(this,"baked",null),d(this,"bakedEffects",!0),this._spec=e,this.bake(),s.anchor===void 0&&this.useFrameAnchor(),this.set(s)}get spec(){return this._spec}set spec(t){this._spec=t,this.baked=null,this._w=this._h=null,this.bake()}bake(){const t=this.kernel;return this.baked&&t.atlas.valid(this.baked.frame)&&this.baked.frame.scale===t.pixelScale&&this.bakedEffects===t.effects?this.baked:(this.bakedEffects=t.effects,this.baked=t.shape(this._spec),this._frame=this.baked.frame,this.slice=this.baked.slice,this.baked)}frameNow(){return this.bake().frame}sizeQ(){const t=this.bake();me[0]=this._w??t.w,me[1]=this._h??t.h}get width(){return this._w??this.bake().w}set width(t){this._w=t}get height(){return this._h??this.bake().h}set height(t){this._h=t}},Ki=(t,e,s)=>t===void 0?e:typeof t=="number"?t:t[0]+(t[1]-t[0])*s(),Zi=class Ye extends se{constructor(e,s,i={}){super(e),d(this,"max"),d(this,"f"),d(this,"tints"),d(this,"count",0),d(this,"gravity"),d(this,"drag"),d(this,"frameRef"),d(this,"random",Math.random),this.frameRef=s,this.max=Math.max(1,Math.floor(i.max??200)),this.f=new Float32Array(this.max*Ye.W),this.tints=new Uint32Array(this.max),this.blend=i.blend??"normal",this.gravity=i.gravity??0,this.drag=i.drag??1}get alive(){return this.count}burst(e,s,i,n={}){const r=Ye.W,a=this.random,l=n.tint===void 0?16777215:Lt(n.tint)[0];for(let h=0;h<i;h++){let o=this.count;if(o>=this.max){let x=0,m=1/0;for(let g=0;g<this.max;g++){const w=this.f[g*r+5]-this.f[g*r+4];w<m&&(m=w,x=g)}o=x}else this.count++;const f=(n.angle??0)+(n.spread===void 0?a()*Math.PI*2:(a()-.5)*n.spread),u=Ki(n.speed,200,a),c=Array.isArray(n.scale)?n.scale[0]:n.scale??1,y=Array.isArray(n.scale)?n.scale[1]:n.scale??1,p=o*r;this.f[p]=e,this.f[p+1]=s,this.f[p+2]=Math.cos(f)*u,this.f[p+3]=Math.sin(f)*u,this.f[p+4]=0,this.f[p+5]=Math.max(Ki(n.life,.8,a),.01),this.f[p+6]=a()*Math.PI*2,this.f[p+7]=(a()-.5)*2*(n.spin??0),this.f[p+8]=c,this.f[p+9]=y,this.f[p+10]=n.alpha??1,this.tints[o]=l}}update(e){const s=Ye.W,i=this.f,n=this.drag>=1?1:Math.pow(Math.max(this.drag,0),e);for(let r=0;r<this.count;){const a=r*s;if(i[a+4]=i[a+4]+e,i[a+4]>=i[a+5]){const l=--this.count;r!==l&&(i.copyWithin(a,l*s,l*s+s),this.tints[r]=this.tints[l]);continue}i[a+3]=(i[a+3]+this.gravity*e)*n,i[a+2]=i[a+2]*n,i[a]=i[a]+i[a+2]*e,i[a+1]=i[a+1]+i[a+3]*e,i[a+6]=i[a+6]+i[a+7]*e,r++}}clear(){this.count=0}draw(e,s,i){if(!this.count)return;const n=typeof this.frameRef=="string"?this.frameRef=this.kernel.frame(this.frameRef):this.frameRef,r=Ye.W,a=this.f,l=this.world,h=n.w/n.scale,o=n.h/n.scale;for(let f=0;f<this.count;f++){const u=f*r,c=a[u+4]/a[u+5],y=a[u+8]+(a[u+9]-a[u+8])*c,p=s*a[u+10]*(1-c*c),x=a[u+6],m=Math.cos(x)*y,g=Math.sin(x)*y,w=a[u],E=a[u+1],k=l[0],A=l[1],C=l[2],R=l[3],O=k*m+C*g,P=A*m+R*g,I=C*m-k*g,X=R*m-A*g;it[0]=O,it[1]=P,it[2]=I,it[3]=X,it[4]=k*w+C*E+l[4]-(O*h+I*o)/2,it[5]=A*w+R*E+l[5]-(P*h+X*o)/2,Q[0]=h,Q[1]=o,Q[2]=p,e.r.quadQ(e.tex(n.surface),n,it,Gi(i,this.tints[f]),this.blend)}}};d(Zi,"W",11);var Ji=Zi,ne=class extends de{constructor(t,e,s={}){const{fps:i,loop:n,playing:r,speed:a,onComplete:l,...h}=s;if(!e.frames.length)throw new Error("[engine] an animation needs at least one frame");super(t,e.frames[0],h),d(this,"frames"),d(this,"durations"),d(this,"fps"),d(this,"loop"),d(this,"speed"),d(this,"onComplete"),d(this,"_playing"),d(this,"index",0),d(this,"t",0),this.frames=e.frames,this.durations=e.durations&&i===void 0?e.durations:null,this.fps=i??12,this.loop=n!==!1,this.speed=a??1,this.onComplete=l??null,this._playing=r!==!1,this.speed<0&&this.show(e.frames.length-1)}get frameIndex(){return this.index}get frameCount(){return this.frames.length}get playing(){return this._playing}play(){return!this.loop&&!this._playing&&this.index===(this.speed<0?0:this.frames.length-1)&&this.show(this.speed<0?this.frames.length-1:0),this._playing=!0,this}stop(){return this._playing=!1,this}gotoFrame(t){const e=this.frames.length;return this.show((Math.floor(t)%e+e)%e),this.t=0,this}gotoAndPlay(t){return this._playing=!0,this.gotoFrame(t)}gotoAndStop(t){return this._playing=!1,this.gotoFrame(t)}show(t){t===this.index&&this._frame||(this.index=t,this.frame=this.frames[t])}secondsOf(t){const e=this.durations?.[t];return e!==void 0&&e>0?e:1/Math.max(this.fps,.001)}update(t){if(!this._playing||this.destroyed||this.speed===0)return;const e=this.frames.length,s=this.speed<0;this.t+=t*Math.abs(this.speed);let i=this.index;for(let n=0;n<1e3;n++){const r=this.secondsOf(i);if(this.t<r)break;this.t-=r;const a=s?i-1:i+1;if(a<0||a>=e){if(!this.loop){this.t=0,this._playing=!1,this.show(i),this.onComplete?.();return}i=s?e-1:0}else i=a}this.show(i)}},Ea=(t,e)=>t.localeCompare(e,void 0,{numeric:!0}),tn=class{constructor(t,e,s=2){d(this,"width",t),d(this,"height",e),d(this,"padding",s),d(this,"shelves",[]),d(this,"free",[]),d(this,"bottom",0)}alloc(t,e){const s=Math.ceil(t)+this.padding*2,i=Math.ceil(e)+this.padding*2;if(s>this.width||i>this.height)return null;for(let a=0;a<this.free.length;a++){const l=this.free[a];if(l.w>=s&&l.h>=i&&l.w*l.h<=s*i*2)return this.free.splice(a,1),this.inner(l.x,l.y,t,e)}let n=null;for(const a of this.shelves)a.h>=i&&a.h<=i*1.5+8&&this.width-a.x>=s&&(!n||a.h<n.h)&&(n=a);if(!n)if(this.bottom+i>this.height){for(const a of this.shelves)a.h>=i&&this.width-a.x>=s&&(n=a);if(!n)return null}else n={y:this.bottom,h:i,x:0},this.shelves.push(n),this.bottom+=i;const r=n.x;return n.x+=s,this.inner(r,n.y,t,e)}release(t){this.free.push({x:t.x-this.padding,y:t.y-this.padding,w:Math.ceil(t.w)+this.padding*2,h:Math.ceil(t.h)+this.padding*2})}get fill(){return this.bottom/this.height}reset(){this.shelves=[],this.free=[],this.bottom=0}inner(t,e,s,i){return{x:t+this.padding,y:e+this.padding,w:s,h:i}}},is=t=>({source:t,texture:null,pending:[]}),Ws=class{constructor(t=2048,e=4){d(this,"pageSize",t),d(this,"maxPages",e),d(this,"pages",[]),d(this,"gen",1),d(this,"onPage",()=>{}),d(this,"onDrop",()=>{})}valid(t){return!!t&&(t.gen===this.gen||t.gen===0)}bake(t,e,s,i=1,n=0,r=0,a=0){const l=Math.max(1,Math.ceil(t)),h=Math.max(1,Math.ceil(e)),o=document.createElement("canvas");o.width=l,o.height=h;const f=o.getContext("2d");return s(f),this.put(o,l,h,i,n,r,a)}add(t,e=1,s=0,i=0){const n=document.createElement("canvas");return n.width=Math.max(1,t.width),n.height=Math.max(1,t.height),n.getContext("2d").drawImage(t,0,0),this.put(n,n.width,n.height,e,s,i,0)}release(t){if(t.gen!==this.gen)return;this.pages.find(s=>s.surface===t.surface)?.packer.release(t)}rebake(t,e,s,i,n=t.w,r=t.h){if(!this.valid(t)||e>n||s>r)return null;const a=Math.max(1,Math.ceil(e)),l=Math.max(1,Math.ceil(s)),h=this.pages.find(f=>f.surface===t.surface);if(!h)return null;const o=document.createElement("canvas");return o.width=Math.ceil(n),o.height=Math.ceil(r),i(o.getContext("2d")),h.ctx.clearRect(t.x,t.y,o.width,o.height),h.ctx.drawImage(o,t.x,t.y),t.surface.pending.push([o,t.x,t.y]),t.w=a,t.h=l,t}put(t,e,s,i,n,r,a){let l=null,h=this.pages.find(f=>(l=f.packer.alloc(e,s))!==null);if(h||(!(Math.max(e,s)+4>this.pageSize)&&this.pages.length>=this.maxPages&&(this.wipe(),h=this.pages[0],l=h?h.packer.alloc(e,s):null),(!h||!l)&&(h=this.newPage(Math.max(e,s)),l=h.packer.alloc(e,s))),!l)throw new Error(`[engine] ${e}\xD7${s} does not fit an atlas page`);const o=l;return h.ctx.drawImage(t,o.x,o.y),h.surface.pending.push([t,o.x,o.y]),{surface:h.surface,x:o.x,y:o.y,w:e,h:s,scale:i,gen:this.gen,ox:n,oy:r,margin:a}}newPage(t){let e=this.pageSize;for(;e<t+4;)e*=2;const s=document.createElement("canvas");s.width=s.height=e;const i=s.getContext("2d"),n=is(s),r={surface:n,packer:new tn(e,e),ctx:i};return this.pages.push(r),this.onPage(n),r}wipe(){this.gen++;let t=0;for(let e=0;e<this.pages.length;e++){const s=this.pages[e];if(t<this.maxPages&&s.surface.source.width===this.pageSize){this.pages[t++]=s;continue}s.surface.pending=[],this.onDrop(s.surface)}this.pages.length=t;for(const e of this.pages)e.packer.reset(),e.ctx.clearRect(0,0,e.surface.source.width,e.surface.source.height),e.surface.pending=[],e.surface.pending.push([e.surface.source,0,0])}},Aa=()=>{const t=typeof document<"u"?document.timeline?.currentTime:null;return typeof t=="number"&&Number.isFinite(t)?t:globalThis.performance?.now()??Date.now()},en=()=>globalThis.performance?.now()??Date.now(),sn=class{constructor(t=Aa){d(this,"now",t),d(this,"known",new Map),d(this,"smoothed",new Map),d(this,"times",new WeakMap),d(this,"lerp",new ea),d(this,"drawnAt",NaN),d(this,"drawn",0),d(this,"smoothedBody",(e,s={})=>{const i=s.interpolate!==!1;if(typeof e=="number"){const n=this.smoothed.get(e);return n?i?this.lerp.at(e,this.tick())??n.body:n.body:null}return typeof e!="object"||e===null||!Array.isArray(e.body)?null:this.posed(e.id,e.body,_a(s.smooth),i)})}note(t,e,s=en()){for(const i of t)this.known.set(i.id,this.resolve(i.id,i.avatar)),e!==void 0&&Number.isFinite(e)&&Array.isArray(i.body)&&this.times.set(i.body,{t:e,arrival:s})}of(t){return typeof t=="object"&&t!==null?t.avatar!==void 0?this.resolve(t.id,t.avatar):this.of(t.id):this.known.get(t)??Ei(t-1)}posed(t,e,s,i=!0){const n=this.smooth(t,e,s);return i?this.lerp.at(t,this.tick())??n:n}smooth(t,e,s){const i=this.smoothed.get(t);if(i&&i.raw===e&&i.amount===s)return i.body;i&&i.amount!==s&&this.lerp.forget(t);const n=s<1?aa(i?.body,e,s):e;this.smoothed.set(t,{raw:e,body:n,amount:s});const r=this.times.get(e),a=r?.arrival??en();return this.lerp.push(t,r?.t??a,n,a),n}takeDrawn(){const t=this.drawn;return this.drawn=0,t}tick(){const t=this.now();return t!==this.drawnAt&&(this.drawnAt=t,this.drawn++),t}resolve(t,e){return ia(e)?e:Ei(t-1)}},_a=t=>t===!1?1:typeof t=="number"?Math.min(Math.max(t,.05),1):.5,nn=new Float64Array(1),rn=new Int32Array(nn.buffer),xe=(t,e)=>(t=Math.imul(t^e,1540483477),t^t>>>15);function Yt(t,e=2538058380){return t!==t?xe(e,2146959360):(nn[0]=t===0?0:t,xe(xe(e,rn[0]),rn[1]))}function an(t,e=2166136261){for(let s=0;s<t.length;s++)e=Math.imul(e^t.charCodeAt(s),16777619);return e}function Qt(t){switch(typeof t){case"number":return Yt(t);case"string":return an(t);case"boolean":return t?1013904242:461845907;case"object":{if(t===null)return 625341585;if(Array.isArray(t)||t instanceof Float64Array){let i=1779033703^t.length;for(let n=0;n<t.length;n++){const r=t[n];i=xe(i,typeof r=="number"?Yt(r):Qt(r))}return i}let e=1359893119;const s=t;for(const i in s){const n=s[i];n!==void 0&&(e=e+xe(an(i),Qt(n))|0)}return xe(e,2600822924)}default:return 0}}function ze(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null)return typeof t=="number"&&typeof e=="number"&&t!==t&&e!==e;const s=Array.isArray(t)||t instanceof Float64Array;if(s!==(Array.isArray(e)||e instanceof Float64Array))return!1;if(s){const r=t,a=e;if(r.length!==a.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==a[l]&&!ze(r[l],a[l]))return!1;return!0}const i=t,n=e;for(const r in i)if(i[r]!==void 0&&!ze(i[r],n[r]))return!1;for(const r in n)if(n[r]!==void 0&&i[r]===void 0)return!1;return!0}function ns(t){if(typeof t!="object"||t===null)return t;if(Array.isArray(t))return t.map(ns);if(t instanceof Float64Array)return t.slice();const e={};for(const s in t)t[s]!==void 0&&(e[s]=ns(t[s]));return e}var on=class{constructor(t=1/0){d(this,"max",t),d(this,"buckets",new Map),d(this,"n",0)}get size(){return this.n}get(t,e=Qt(t)){const s=this.buckets.get(e);if(s){for(let i=0;i<s.length;i++)if(ze(s[i].key,t))return s[i].value}}set(t,e,s=Qt(t)){let i=this.buckets.get(s);if(i){for(const n of i)if(ze(n.key,t)){n.value=e;return}}this.n>=this.max&&this.clear(),(!i||!this.buckets.has(s))&&this.buckets.set(s,i=[]),i.push({key:ns(t),value:e}),this.n++}clear(){this.buckets.clear(),this.n=0}},Ys=0,ln=1,rs=2,Qs=3,hn=class{constructor(){d(this,"scale",1),d(this,"cOn",!1),d(this,"px0",0),d(this,"py0",0),d(this,"px1",0),d(this,"py1",0),d(this,"clipVer",0),d(this,"stack",[]),d(this,"sp",0),d(this,"real",0),d(this,"mute",0),d(this,"bnd",new Float64Array(4*(Gs+1))),d(this,"rx0",0),d(this,"ry0",0),d(this,"rx1",0),d(this,"ry1",0),d(this,"maxBlur",1/0),d(this,"time",0),d(this,"skipped",0),d(this,"gq",new Float64Array(4))}resetLayers(t){this.scale=t,this.sp=this.real=this.mute=0,this.skipped=0,this.cOn=!1,this.clipVer++}growQ(){const t=this.gq;this.grow(t[0],t[1],t[2],t[3])}grow(t,e,s,i){if(!this.real)return;const n=this.bnd,r=(this.real-1)*4;t<n[r]&&(n[r]=t),e<n[r+1]&&(n[r+1]=e),s>n[r+2]&&(n[r+2]=s),i>n[r+3]&&(n[r+3]=i)}area(t,e){const s=this.bnd,i=t*4,n=this.scale;return this.rx0=Math.max(Math.floor((s[i]-e)*n)-1,0),this.ry0=Math.max(Math.floor((s[i+1]-e)*n)-1,0),this.rx1=Math.min(Math.ceil((s[i+2]+e)*n)+1,this.canvas.width),this.ry1=Math.min(Math.ceil((s[i+3]+e)*n)+1,this.canvas.height),this.rx1>this.rx0&&this.ry1>this.ry0}clip(t,e,s,i){const n=this.scale,r=this.canvas.width,a=this.canvas.height,l=Math.min(Math.max(Math.round(t*n),0),r),h=Math.min(Math.max(Math.round(e*n),0),a),o=Math.min(Math.max(Math.round((t+s)*n),l),r),f=Math.min(Math.max(Math.round((e+i)*n),h),a);this.cOn&&l===this.px0&&h===this.py0&&o===this.px1&&f===this.py1||(this.cOn=!0,this.px0=l,this.py0=h,this.px1=o,this.py1=f,this.clipVer++)}unclip(){this.cOn&&(this.cOn=!1,this.clipVer++)}push(t){if(t<rs&&(this.mute||this.real>=Gs||!this.pushLayer())&&(t+=2),t===Qs)this.mute++;else if(t!==rs){const e=this.real*4;this.bnd[e]=this.bnd[e+1]=1/0,this.bnd[e+2]=this.bnd[e+3]=-1/0,this.real++}return this.stack[this.sp++]=t,t<rs}beginLayer(){return this.push(Ys)}beginMask(){this.push(this.sp&&this.stack[this.sp-1]===Ys?ln:Qs)}endLayer(t,e){if(!this.sp)return;let s=this.stack[--this.sp];if(s===Qs){if(this.mute--,!this.sp)return;s=this.stack[--this.sp]}if(s===ln){const i=--this.real,n=this.popLayer();this.area(i-1,0)&&this.composite(n,!0,1,null);const r=this.bnd,a=(i-1)*4,l=i*4;r[a]=Math.max(r[a],r[l]),r[a+1]=Math.max(r[a+1],r[l+1]),r[a+2]=Math.min(r[a+2],r[l+2]),r[a+3]=Math.min(r[a+3],r[l+3]),s=this.stack[--this.sp]}if(s===rs)Bs(e)&&(this.skipped+=e.length);else if(s===Ys){const i=--this.real,n=Bs(e)?e:null,r=this.popLayer();if(this.area(i,n?wa(n,this.maxBlur):0)){this.composite(r,!1,t,n);const a=this.scale;this.grow(this.rx0/a,this.ry0/a,this.rx1/a,this.ry1/a)}}}closeLayers(){for(;this.sp;)this.endLayer(1)}},Ta=256,cn=8<<20,mt=new Float64Array(32),xt={x:0,y:0,w:0,h:0};function Sa(t){if(typeof t.filter!="string")return!1;t.filter="blur(1px)";const e=t.filter==="blur(1px)";return t.filter="none",e}function js(t){const e=t.getContext("2d",{alpha:!0});return e?new Ca(t,e):null}var Ca=class extends hn{constructor(t,e){super(),d(this,"canvas",t),d(this,"ctx",e),d(this,"kind","canvas2d"),d(this,"maxTextureSize",4096),d(this,"features",{}),d(this,"info",{renderer:"canvas2d"}),d(this,"support"),d(this,"lost",!1),d(this,"fxr",null),d(this,"quads",0),d(this,"stats",{drawCalls:0,quads:0,filtersSkipped:0}),d(this,"tinted",new Map),d(this,"tintedN",0),d(this,"lostListeners",[]),d(this,"restoredListeners",[]),d(this,"base"),d(this,"top"),d(this,"layers",[]),d(this,"scratch",[]),d(this,"nines",new Map),d(this,"ninePx",0),d(this,"frame",0),d(this,"hit",!1),d(this,"missed",new Map),this.support={filters:Sa(e),shaders:!1},this.base=this.top={ctx:e,clipped:!1,ver:0},t.addEventListener("contextlost",()=>{this.lost=!0,this.lostListeners.forEach(s=>s())}),t.addEventListener("contextrestored",()=>{this.lost=!1,this.tinted.clear(),this.tintedN=0,this.dropNines(),this.restoredListeners.forEach(s=>s())})}resize(t,e){this.canvas.width!==t&&(this.canvas.width=t),this.canvas.height!==e&&(this.canvas.height=e)}createTexture(t){return{id:$s(),width:t.width,height:t.height,source:t}}updateTexture(t,e,s=0,i=0){const n=e?s+e.width:1/0,r=e?i+e.height:1/0;for(const a of this.nines.values()){const l=a.key;l[0]===t.id&&l[1]<n&&l[1]+l[3]>s&&l[2]<r&&l[2]+l[4]>i&&this.dropNine(a)}for(const[a,l]of this.tinted){const h=l.filter(o=>o.id!==t.id);this.tintedN-=l.length-h.length,h.length?this.tinted.set(a,h):this.tinted.delete(a)}}destroyTexture(t){this.updateTexture(t)}begin(t,e,s){this.resetLayers(s),this.fxr?.tick(),this.frame++,this.quads=0,this.top=this.base,this.ctx=this.base.ctx;const i=this.ctx;this.base.clipped&&i.restore(),this.base.clipped=!1,this.base.ver=this.clipVer,i.setTransform(1,0,0,1,0,0),i.globalAlpha=1,i.globalCompositeOperation="source-over",i.clearRect(0,0,this.canvas.width,this.canvas.height),e>0&&(i.fillStyle=Fe(t,e),i.fillRect(0,0,this.canvas.width,this.canvas.height))}quad(t,e,s,i,n,r,a,l){Q[0]=i,Q[1]=n,Q[2]=a,this.quadQ(t,e,s,r,l)}quadQ(t,e,s,i,n){e.w<=0||e.h<=0||(i===16777215?this.blit(t.source,e.x,e.y,e.w,e.h,s,n):this.blit(this.tint(t,e,i),0,0,e.w,e.h,s,n))}blit(t,e,s,i,n,r,a){const l=Q[0],h=Q[1],o=Q[2];if(o<=0||this.mute)return;this.sync();const f=this.ctx,u=this.scale;if(this.real){const c=r[0]*l,y=r[1]*l,p=r[2]*h,x=r[3]*h;this.grow(r[4]+Math.min(0,c,p,c+p),r[5]+Math.min(0,y,x,y+x),r[4]+Math.max(0,c,p,c+p),r[5]+Math.max(0,y,x,y+x))}f.setTransform(r[0]*u,r[1]*u,r[2]*u,r[3]*u,r[4]*u,r[5]*u),f.globalAlpha=Math.min(o,1),a==="add"&&(f.globalCompositeOperation="lighter"),f.drawImage(t,e,s,i,n,0,0,l,h),a==="add"&&(f.globalCompositeOperation="source-over"),this.quads++}nineQ(t,e,s,i,n,r,a){var l,h;const o=s[8]+s[9],f=i[8]+i[9],u=Math.ceil(o*Math.hypot(n[0],n[1])*this.scale-1e-6),c=Math.ceil(f*Math.hypot(n[2],n[3])*this.scale-1e-6);if(n[1]===0&&n[2]===0||u>4096||c>4096)return!1;if(!(u>0&&c>0&&Q[2]>0)||this.mute)return!0;let y=this.kept(t,e,s,i,u,c,r);const p=(y??(y=(l=this.scratch)[h=13*Math.ceil(Math.log2(u))+Math.ceil(Math.log2(c))]??(l[h]=document.createElement("canvas").getContext("2d")))).canvas;if(p.width<u&&(p.width=u),p.height<c&&(p.height=c),!this.hit){y.clearRect(0,0,u+2,c+2);for(let x=0;x<12;x+=4){const m=Math.round(i[x]*c/f),g=Math.round((i[x]+i[x+1])*c/f);for(let w=0;w<12;w+=4){const E=Math.round(s[w]*u/o),k=Math.round((s[w]+s[w+1])*u/o);xt.x=e.x+s[w+2],xt.y=e.y+i[x+2],xt.w=s[w+3],xt.h=i[x+3],!(k<=E||g<=m||xt.w<=0||xt.h<=0)&&(r===16777215?y.drawImage(t.source,xt.x,xt.y,xt.w,xt.h,E,m,k-E,g-m):y.drawImage(this.tint(t,xt,r),0,0,xt.w,xt.h,E,m,k-E,g-m))}}}return Q[0]=o,Q[1]=f,this.blit(p,0,0,u,c,n,a),!0}kept(t,e,s,i,n,r,a){mt[0]=t.id,mt[1]=e.x,mt[2]=e.y,mt[3]=e.w,mt[4]=e.h,mt[5]=n,mt[6]=r,mt[7]=a,mt.set(s,8),mt.set(i,20);const l=Qt(mt),h=this.nines.get(l);if(this.hit=!1,h)return ze(h.key,mt)?(h.used=this.frame,this.hit=!0,h.ctx):null;const o=this.missed,f=o.get(l);o.size>4096&&o.clear(),o.set(l,this.frame);const u=n*r;if(f!==this.frame-1||u>cn)return null;let c;for(;this.ninePx+u>cn;){let x;for(const w of this.nines.values())w.used<this.frame-1&&!(x&&x.used<=w.used)&&(x=w);if(!x)return null;const m=x.ctx.canvas,g=!c&&m.width>=n&&m.height>=r&&m.width*m.height<=2*u;this.dropNine(x,g),g&&(c=x.ctx)}const y=c??document.createElement("canvas").getContext("2d"),p=y.canvas;return c||(p.width=n,p.height=r),this.ninePx+=p.width*p.height,this.nines.set(l,{key:ns(mt),ctx:y,used:this.frame}),y}dropNine(t,e=!1){this.nines.delete(Qt(t.key));const s=t.ctx.canvas;this.ninePx-=s.width*s.height,e||(s.width=0)}dropNines(){for(const t of this.nines.values())this.dropNine(t)}tint(t,e,s){const i=Yt(s,Yt(e.h,Yt(e.w,Yt(e.y,Yt(e.x,Yt(t.id))))));let n=this.tinted.get(i);if(n)for(let l=0;l<n.length;l++){const h=n[l];if(h.id===t.id&&h.x===e.x&&h.y===e.y&&h.w===e.w&&h.h===e.h&&h.color===s)return h.canvas}this.tintedN>=Ta&&(this.tinted.clear(),this.tintedN=0,n=void 0);const r=document.createElement("canvas");r.width=Math.ceil(e.w),r.height=Math.ceil(e.h);const a=r.getContext("2d");return a.drawImage(t.source,e.x,e.y,e.w,e.h,0,0,e.w,e.h),a.globalCompositeOperation="multiply",a.fillStyle=Fe(s),a.fillRect(0,0,e.w,e.h),a.globalCompositeOperation="destination-in",a.drawImage(t.source,e.x,e.y,e.w,e.h,0,0,e.w,e.h),n||this.tinted.set(i,n=[]),n.push({id:t.id,x:e.x,y:e.y,w:e.w,h:e.h,color:s,canvas:r}),this.tintedN++,r}paint(t,e){this.sync();const s=this.ctx,i=this.scale;return s.setTransform(i,0,0,i,0,0),s.globalAlpha=Math.min(e,1),Fe(t)}ellipse(t,e,s,i,n,r,a){if(a<=0||s<=0||i<=0||this.mute)return;const l=Math.max(s,i);this.grow(t-l,e-l,t+l,e+l);const h=this.ctx;h.fillStyle=this.paint(r,a),h.beginPath(),h.ellipse(t,e,s,i,n,0,Math.PI*2),h.fill(),this.quads++}trace(t,e,s=0){if(this.real)for(let n=0;n<e;n++)this.grow(t[n*2]-s,t[n*2+1]-s,t[n*2]+s,t[n*2+1]+s);const i=this.ctx;i.beginPath(),i.moveTo(t[0],t[1]);for(let n=1;n<e;n++)i.lineTo(t[n*2],t[n*2+1])}polygon(t,e,s,i){if(i<=0||e<3||this.mute)return;const n=this.ctx;n.fillStyle=this.paint(s,i),this.trace(t,e),n.closePath(),n.fill(),this.quads++}stroke(t,e,s,i,n,r){if(n<=0||s<=0||e<1||this.mute)return;const a=this.ctx;a.strokeStyle=this.paint(i,n),a.lineWidth=s,a.lineCap="round",a.lineJoin="round",this.trace(t,e,s/2),e===1&&a.lineTo(t[0],t[1]),r&&a.closePath(),a.stroke(),this.quads++}sync(){const t=this.top;if(t.ver===this.clipVer)return;const e=t.ctx;t.clipped&&e.restore(),t.clipped=this.cOn,t.ver=this.clipVer,this.cOn&&(e.save(),e.setTransform(1,0,0,1,0,0),e.beginPath(),e.rect(this.px0,this.py0,this.px1-this.px0,this.py1-this.py0),e.clip())}pushLayer(){const t=this.canvas.width,e=this.canvas.height;let s=this.layers[this.real];if(!s||s.ctx.canvas.width!==t||s.ctx.canvas.height!==e){const n=document.createElement("canvas");n.width=t,n.height=e;const r=n.getContext("2d");if(!r)return!1;s=this.layers[this.real]={ctx:r,clipped:!1,ver:-1}}const i=s.ctx;return s.clipped&&i.restore(),s.clipped=!1,s.ver=-1,i.setTransform(1,0,0,1,0,0),i.globalAlpha=1,i.globalCompositeOperation="source-over",i.clearRect(0,0,t,e),this.top=s,this.ctx=i,!0}popLayer(){return this.top=this.real>0?this.layers[this.real-1]:this.base,this.ctx=this.top.ctx,this.layers[this.real].ctx.canvas}composite(t,e,s,i){let n=t,r="none";const a=i&&Nt.c2d?this.fxr??(this.fxr=Nt.c2d(this)):null;a&&(n=a.chain(t,i),r=a.css),this.sync();const l=this.ctx,h=this.rx0,o=this.ry0,f=this.rx1-h,u=this.ry1-o;l.setTransform(1,0,0,1,0,0),l.globalAlpha=Math.min(s,1),l.globalCompositeOperation=e?"destination-in":"source-over",r!=="none"&&(l.filter=r),l.drawImage(n,h,o,f,u,h,o,f,u),r!=="none"&&(l.filter="none"),l.globalCompositeOperation="source-over",this.quads++}end(){this.closeLayers();const t=this.stats;return t.drawCalls=t.quads=this.quads,t.filtersSkipped=this.skipped,t}onLost(t){this.lostListeners.push(t)}onRestored(t){this.restoredListeners.push(t)}destroy(){this.tinted.clear(),this.dropNines(),this.layers=[],this.scratch=[],this.fxr?.destroy(),this.fxr=null}},De=14,ge=6,fn=8192,Ra=class{constructor(t,e,s=fn){d(this,"instanced",t),d(this,"slots",e),d(this,"capacity",s),d(this,"f32"),d(this,"u32"),d(this,"quads",0),d(this,"textures"),d(this,"bound",0),this.textures=new Array(e).fill(null);const i=s*(t?De:ge*4),n=new ArrayBuffer(i*4);this.f32=new Float32Array(n),this.u32=new Uint32Array(n)}slot(t){const e=this.textures;for(let s=0;s<this.bound;s++)if(e[s]===t)return s;return this.bound>=this.slots?-1:(e[this.bound]=t,this.bound++)}has(t){for(let e=0;e<this.bound;e++)if(this.textures[e]===t)return!0;return!1}get full(){return this.quads>=this.capacity}get words(){return this.quads*(this.instanced?De:ge*4)}reset(){this.quads=0;for(let t=0;t<this.bound;t++)this.textures[t]=null;this.bound=0}push(t,e,s,i,n,r,a,l,h,o,f,u,c,y){const p=this.f32;if(this.instanced){let x=this.quads*De;p[x++]=t,p[x++]=e,p[x++]=s,p[x++]=i,p[x++]=n,p[x++]=r,p[x++]=a,p[x++]=l,p[x++]=h,p[x++]=o,p[x++]=f,p[x++]=u,this.u32[x++]=c,p[x]=y}else{const x=this.quads*ge*4;this.vertex(x,t,e,h,o,c,y),this.vertex(x+6,s,i,f,o,c,y),this.vertex(x+12,n,r,f,u,c,y),this.vertex(x+18,a,l,h,u,c,y)}this.quads++}pushQ(t,e){const s=this.f32;if(this.instanced){const i=this.quads*De;for(let n=0;n<12;n++)s[i+n]=t[n];this.u32[i+12]=t[12],s[i+13]=e}else{let i=this.quads*ge*4;const n=t[12];for(let r=0;r<4;r++,i+=ge)s[i]=t[r*2],s[i+1]=t[r*2+1],s[i+2]=r===1||r===2?t[10]:t[8],s[i+3]=r>=2?t[11]:t[9],this.u32[i+4]=n,s[i+5]=e}this.quads++}vertex(t,e,s,i,n,r,a){const l=this.f32;l[t]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,this.u32[t+4]=r,l[t+5]=a}};function Fa(t){const e=new Uint16Array(t*6);for(let s=0,i=0,n=0;s<t;s++,i+=6,n+=4)e[i]=n,e[i+1]=n+1,e[i+2]=n+2,e[i+3]=n,e[i+4]=n+2,e[i+5]=n+3;return e}var gt={M:0,L:1,Q:2,C:3,Z:4},un=[2,2,4,6,0],Pa={M:0,L:1,Q:2,C:3,Z:4};function Vs(t,e){if(t.length>=e)return t;const s=new Float64Array(Math.max(e,t.length*2,16));return s.set(t),s}var as=new Map;function La(t){if(typeof t!="string")return t;let e=as.get(t);if(e)return e;e=[];const s=t.match(/[MLQCZ]|-?\d*\.?\d+(?:e-?\d+)?/gi)??[];let i=-1;for(let n=0;n<s.length;){const r=s[n],a=Pa[r.toUpperCase()];if(a!==void 0){i=a,n++,a===gt.Z&&e.push(gt.Z);continue}if(i<0||i===gt.Z){n++;continue}const l=un[i];e.push(i);for(let h=0;h<l;h++)e.push(Number(s[n+h]??0));n+=l,i===gt.M&&(i=gt.L)}return as.size>256&&as.clear(),as.set(t,e),e}var jt={subs:[],count:0},Ks=null,Vt=null;function os(t,e){let s=Vt;s||(s=jt.subs[jt.count]??null,s||jt.subs.push(s={pts:new Float64Array(64),n:0,closed:!1}),s.n=0,s.closed=!1,jt.count++,Vt=s);const i=s.n*2;i+2>s.pts.length&&(s.pts=Vs(s.pts,i+2));const n=Ks;n?(s.pts[i]=n[0]*t+n[2]*e+n[4],s.pts[i+1]=n[1]*t+n[3]*e+n[5]):(s.pts[i]=t,s.pts[i+1]=e),s.n++}function Zs(t,e=null,s=1,i=6){const n=La(t);jt.count=0,Vt=null,Ks=e;let r=0,a=0,l=0,h=0;const o=s/i;for(let f=0;f<n.length;){const u=n[f++],c=n;if(u===gt.M)Vt=null,r=l=c[f],a=h=c[f+1],os(r,a);else if(u===gt.L)r=c[f],a=c[f+1],os(r,a);else if(u===gt.Q){const y=c[f],p=c[f+1],x=c[f+2],m=c[f+3],g=dn((Bt(y-r,p-a)+Bt(x-y,m-p))*o);for(let w=1;w<=g;w++){const E=w/g,k=1-E;os(k*k*r+2*k*E*y+E*E*x,k*k*a+2*k*E*p+E*E*m)}r=x,a=m}else if(u===gt.C){const y=c[f],p=c[f+1],x=c[f+2],m=c[f+3],g=c[f+4],w=c[f+5],E=dn((Bt(y-r,p-a)+Bt(x-y,m-p)+Bt(g-x,w-m))*o);for(let k=1;k<=E;k++){const A=k/E,C=1-A,R=C*C*C,O=3*C*C*A,P=3*C*A*A,I=A*A*A;os(R*r+O*y+P*x+I*g,R*a+O*p+P*m+I*w)}r=g,a=w}else if(u===gt.Z){Vt&&(Vt.closed=!0),Vt=null,r=l,a=h;continue}else break;f+=un[u]}Vt=null,Ks=null;for(let f=0;f<jt.count;f++){const u=jt.subs[f],c=u.n*2;u.closed&&u.n>=2&&Math.abs(u.pts[0]-u.pts[c-2])<1e-6&&Math.abs(u.pts[1]-u.pts[c-1])<1e-6&&u.n--}return jt}var Bt=(t,e)=>Math.sqrt(t*t+e*e),dn=t=>Math.min(Math.max(Math.ceil(t),2),24);function Na(t,e){let s=0;for(let i=0,n=e-1;i<e;n=i++)s+=(t[n*2]-t[i*2])*(t[n*2+1]+t[i*2+1]);return s}var ls=new Int32Array(64),hs=(t,e,s,i,n)=>((t[i*2]-t[s*2])*(t[n*2+1]-t[s*2+1])-(t[i*2+1]-t[s*2+1])*(t[n*2]-t[s*2]))*e;function Ia(t,e,s){if(e<3)return 0;ls.length<e&&(ls=new Int32Array(Math.max(e,ls.length*2)));const i=ls;let n=e,r=0;for(let o=0;o<e;o++)i[o]=o;const a=Na(t,e)>0?1:-1;let l=e*e+8,h=0;for(;n>3&&l-- >0;){const o=i[(h+n-1)%n],f=i[h%n],u=i[(h+1)%n];let c=hs(t,a,o,f,u)>0;if(c)for(let y=0;y<n;y++){const p=i[y];if(!(p===o||p===f||p===u)&&hs(t,a,o,f,p)>=0&&hs(t,a,f,u,p)>=0&&hs(t,a,u,o,p)>=0){c=!1;break}}c?(s[r++]=o,s[r++]=f,s[r++]=u,i.copyWithin(h%n,h%n+1,n),n--,h=Math.max(h-1,0)):h=(h+1)%n}if(n===3)s[r++]=i[0],s[r++]=i[1],s[r++]=i[2];else if(n>3)for(let o=1;o+1<n;o++)s[r++]=i[0],s[r++]=i[o],s[r++]=i[o+1];return r}var Oa=.85,cs=new Float64Array(64),pn=new Float64Array(64),yn=new Float64Array(64),mn=new Float64Array(64),xn=new Float64Array(64),gn=new Float64Array(64),bn=new Uint8Array(64),fs=new Float64Array(8);function za(t,e,s,i,n,r){const a=fs;if(cs.length<e){const m=Math.max(e,cs.length*2);cs=new Float64Array(m),pn=new Float64Array(m),yn=new Float64Array(m),mn=new Float64Array(m),xn=new Float64Array(m),gn=new Float64Array(m),bn=new Uint8Array(m)}const l=cs,h=pn;let o=0;for(let m=0;m<e;m++){const g=t[m*2],w=t[m*2+1];!Number.isFinite(g)||!Number.isFinite(w)||o&&Math.abs(l[o-1]-g)<.001&&Math.abs(h[o-1]-w)<.001||(l[o]=g,h[o]=w,o++)}if(i&&o>2&&Math.abs(l[0]-l[o-1])<.001&&Math.abs(h[0]-h[o-1])<.001&&o--,o===0)return;if(o===1)return a[0]=l[0],a[1]=h[0],r();const f=i?o:o-1,u=yn,c=mn;for(let m=0;m<f;m++){const g=(m+1)%o,w=l[g]-l[m],E=h[g]-h[m],k=Bt(w,E)||1;u[m]=-E/k,c[m]=w/k}const y=xn,p=gn,x=bn;for(let m=0;m<o;m++){const g=i?(m-1+f)%f:m-1,w=m<f?m:-1;if(x[m]=1,g<0||w<0||u[g]*u[w]+c[g]*c[w]<Oa)continue;let k=u[g]+u[w],A=c[g]+c[w];const C=Bt(k,A)||1;k/=C,A/=C;const R=s/Math.max(k*u[w]+A*c[w],.5);y[m]=k*R,p[m]=A*R,x[m]=0}for(let m=0;m<f;m++){const g=(m+1)%o,w=x[m]?u[m]*s:y[m],E=x[m]?c[m]*s:p[m],k=x[g]?u[m]*s:y[g],A=x[g]?c[m]*s:p[g];a[0]=l[m]+w,a[1]=h[m]+E,a[2]=l[g]+k,a[3]=h[g]+A,a[4]=l[g]-k,a[5]=h[g]-A,a[6]=l[m]-w,a[7]=h[m]-E,n()}for(let m=0;m<o;m++)x[m]&&(a[0]=l[m],a[1]=h[m],r())}function wn(t,e){let s=0,i=1/0;for(let n=0;n<e.length;n++){const r=Math.abs(Math.log(Math.max(t,.5)/e[n]));r<i&&(i=r,s=n)}return s}var Mt=256,Js=[{x:240,y:0,w:8,h:8,r:3},{x:224,y:0,w:16,h:16,r:7},{x:192,y:0,w:32,h:32,r:15},{x:128,y:0,w:64,h:64,r:31},{x:0,y:0,w:128,h:128,r:63}],ti=[4,8,16,32,64,128].map((t,e)=>({x:e*4,y:128,w:4,h:t,r:t/2-1})),Kt={x:248,y:248,w:8,h:8},Da=Js.map(t=>t.r*2),Ua=ti.map(t=>t.r*2),kn=(t,e)=>Math.min(Math.max(t+.5-e,0),1);function Ba(){const t=new Uint8ClampedArray(Mt*Mt*4),e=(s,i,n)=>{const r=(i*Mt+s)*4;t[r]=t[r+1]=t[r+2]=255,t[r+3]=Math.round(n*255)};for(const s of Js){const i=s.w/2;for(let n=0;n<s.h;n++)for(let r=0;r<s.w;r++)e(s.x+r,s.y+n,kn(s.r,Math.hypot(r+.5-i,n+.5-i)))}for(const s of ti){const i=s.h/2;for(let n=0;n<s.h;n++)for(let r=0;r<s.w;r++)e(s.x+r,s.y+n,kn(s.r,Math.abs(n+.5-i)))}for(let s=0;s<Kt.h;s++)for(let i=0;i<Kt.w;i++)e(Kt.x+i,Kt.y+s,1);return t}function Ga(){const t=document.createElement("canvas");return t.width=t.height=Mt,t.getContext("2d").putImageData(new ImageData(Ba(),Mt,Mt),0,0),t}var vn=8,ei=`
|
|
1
|
+
/*! @fabi-play/engine 0.2.0 (full) | Fabi Play Kit License | https://docs.fabiplay.app */(function(wi,te){var Qe=typeof document<"u"?document.currentScript:null;typeof define=="function"&&define.amd?define([],function(){return te(Qe)}):typeof module=="object"&&module&&module.exports?module.exports=te(Qe):wi.FabiEngine=te(Qe)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(wi){"use strict";var te={exports:{}},Qe=te.exports,je=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,or=Object.getOwnPropertyNames,lr=Object.prototype.hasOwnProperty,hr=(t,e,s)=>e in t?je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,cr=(t,e)=>{for(var s in e)je(t,s,{get:e[s],enumerable:!0})},fr=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of or(e))!lr.call(t,n)&&n!==s&&je(t,n,{get:()=>e[n],enumerable:!(i=ar(e,n))||i.enumerable});return t},ur=t=>fr(je({},"__esModule",{value:!0}),t),d=(t,e,s)=>hr(t,typeof e!="symbol"?e+"":e,s),ki={};cr(ki,{AnimatedSprite:()=>ne,Atlas:()=>Ws,AvatarPainter:()=>ai,AvatarsNode:()=>Hn,BitmapFont:()=>oi,DEFAULT_FONT:()=>An,EASE:()=>Pe,Group:()=>Xs,HALO:()=>Ue,MAX_LAYERS:()=>Gs,NameTags:()=>ni,Node:()=>se,NodePool:()=>Kn,Particles:()=>Ji,STAGE_HEIGHT:()=>lt,Shape:()=>Oe,ShelfPacker:()=>tn,Sound:()=>Nn,Sprite:()=>de,TIERS:()=>Gt,Text:()=>Be,Timeline:()=>Gn,Tweens:()=>$n,avatarPortrait:()=>eo,blur:()=>al,brightness:()=>Zo,colorMatrix:()=>rl,contrast:()=>Jo,createAvatarRenderer:()=>to,createEngine:()=>Mo,createRenderer:()=>si,dropShadow:()=>ol,grayscale:()=>el,handsOf:()=>Fn,hits:()=>hi,hueRotate:()=>il,invert:()=>nl,nodePool:()=>pl,packColor:()=>ue,parseBMFont:()=>ys,parseColor:()=>Lt,pickTier:()=>In,playerColor:()=>li,rendererOrder:()=>En,rng:()=>fa,saturate:()=>tl,sepia:()=>sl,shader:()=>ll,shapeBounds:()=>ri,tier:()=>re,tint:()=>Ko,touching:()=>Pn,wrists:()=>Rn}),te.exports=ur(ki);var vi=33,V={nose:0,leftShoulder:11,rightShoulder:12,leftElbow:13,rightElbow:14,leftWrist:15,rightWrist:16,leftHip:23,rightHip:24,leftKnee:25,rightKnee:26,leftAnkle:27,rightAnkle:28},dr=["3-5","6-8","9-12"],pr=t=>dr.includes(t),yr=4,Ve=["#EE6A43","#6FA0E0","#8CC9A0","#C49BE0"],Mi={"3-5":["bunny","bear","panda","penguin"],"6-8":["fox","lion","dragon","unicorn"],"9-12":["robot","astronaut","ninja","skater"]},mr=Mi["6-8"],Ei=(t,e)=>{const s=pr(e)?Mi[e]:mr;return s[Number.isInteger(t)&&t>=0?t%s.length:0]},xr=(t,e)=>t?{x:t.x+e.x*t.w,y:t.y+e.y*t.h}:{x:e.x,y:e.y},gr=12,br=vi*4,wr=t=>gr+t*br,vl=wr(yr),kr=t=>t.startsWith("fabi-play.")?`fablee-play.${t.slice(10)}`:null;function vr(t,e,s=kr(e)){if(!(!t||!s))try{const i=t.getItem(s);if(i===null)return;t.getItem(e)===null&&t.setItem(e,i),t.removeItem(s)}catch{}}var yt="#4a382c",ft="#2b2118",vt="#1c1f2b",Ai="#fbefe3",At="#f4897a",_e="#3a2a22",_i=[{id:"fox",name:{en:"Fox",it:"Volpe"},band:"6-8",palette:{body:"#ee6a43",limbs:"#ee6a43",belly:Ai,accent:"#ffd9c2",outline:ft,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"dot",mouth:"cat",nose:_e,muzzle:"cheeks"},tail:"fluffy",headExtras:[],bodyExtras:[]},{id:"mascot",name:{en:"Fabi",it:"Fabi"},band:"all",special:!0,palette:{body:"#ee6a43",limbs:"#ee6a43",belly:Ai,accent:"#5a3426",outline:ft,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"bead",mouth:"open",nose:_e,muzzle:"band",cheeks:At},tail:"brush",headExtras:[],bodyExtras:["star"],extraColors:["#ffd84a"]},{id:"bunny",name:{en:"Bunny",it:"Coniglietto"},band:"3-5",palette:{body:"#f9d0de",limbs:"#f9d0de",belly:"#fff6f8",accent:"#f4a0b9",outline:yt},head:"round",ears:"long",face:{eyes:"dot",mouth:"cat",nose:"#e0607e",muzzle:"none",cheeks:At},tail:"pom",headExtras:[],bodyExtras:[]},{id:"bear",name:{en:"Bear",it:"Orsetto"},band:"3-5",palette:{body:"#cf9f78",limbs:"#cf9f78",belly:"#f7e0bf",accent:"#f7e0bf",outline:yt},head:"round",ears:"round",face:{eyes:"dot",mouth:"smile",nose:_e,muzzle:"oval",cheeks:At},tail:"none",headExtras:[],bodyExtras:[]},{id:"cat",name:{en:"Cat",it:"Gattino"},band:"3-5",palette:{body:"#c8b6ee",limbs:"#c8b6ee",belly:"#f4eeff",accent:"#f7b3c8",outline:yt,hands:"#f4eeff",feet:"#f4eeff"},head:"wide",ears:"pointy",face:{eyes:"big",eyeColor:"#3f9a5a",mouth:"cat",nose:"#f07a9a",muzzle:"none",cheeks:At},tail:"long",headExtras:["whiskers"],bodyExtras:[]},{id:"panda",name:{en:"Panda",it:"Panda"},band:"3-5",palette:{body:"#ffffff",limbs:"#6e6674",belly:"#ffffff",accent:"#6e6674",outline:yt,ears:"#6e6674"},head:"wide",ears:"round",face:{eyes:"mask",mouth:"smile",nose:"#2f2a2c",muzzle:"none",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:[]},{id:"penguin",name:{en:"Penguin",it:"Pinguino"},band:"3-5",palette:{body:"#6c8fca",limbs:"#6c8fca",belly:"#ffffff",accent:"#f9b95c",outline:yt,feet:"#f9b95c"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"heart",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:["flippers","scarf"],extraColors:["#f6907a"]},{id:"frog",name:{en:"Frog",it:"Ranocchio"},band:"3-5",palette:{body:"#8fd487",limbs:"#8fd487",belly:"#e6f7cc",accent:"#62ad62",outline:yt},head:"wide",ears:"none",face:{eyes:"big",eyesOnTop:!0,mouth:"open",muzzle:"none",cheeks:"#f59b8f"},tail:"none",headExtras:[],bodyExtras:["flippers","spots"],extraColors:["#62ad62","#b0e6a4"]},{id:"lion",name:{en:"Lion",it:"Leoncino"},band:"6-8",palette:{body:"#f6c454",limbs:"#f6c454",belly:"#fde7b0",accent:"#fde7b0",outline:ft},head:"round",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#8a4b2a",muzzle:"oval",cheeks:At},tail:"tuft",headExtras:["mane"],bodyExtras:[],extraColors:["#c8692e"]},{id:"unicorn",name:{en:"Unicorn",it:"Unicorno"},band:"6-8",palette:{body:"#fbf5ff",limbs:"#fbf5ff",belly:"#efe0ff",accent:"#fbd46a",outline:ft,hands:"#c9a6f2",feet:"#c9a6f2"},head:"tall",ears:"unicorn",face:{eyes:"dot",mouth:"smile",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["rainbow-mane"],bodyExtras:[],extraColors:["#f58cc0","#8fd3f4","#a98ff2"]},{id:"dragon",name:{en:"Little Dragon",it:"Draghetto"},band:"6-8",palette:{body:"#8a63d2",limbs:"#8a63d2",belly:"#fbd46a",accent:"#5fd0b5",outline:ft},head:"wide",ears:"horns",face:{eyes:"big",eyeColor:"#3a2a6a",mouth:"teeth",muzzle:"none",cheeks:"#f59bc0"},tail:"arrow",headExtras:[],bodyExtras:["wings"]},{id:"robot",name:{en:"Robot",it:"Robot"},band:"9-12",palette:{body:"#b9c7d2",limbs:"#8b9aa6",belly:"#b9c7d2",accent:"#ee6a43",outline:vt,hands:"#ee6a43",feet:"#6b7a86"},head:"square",ears:"antenna",face:{eyes:"screen",eyeColor:"#7ff0ff",mouth:"grill",muzzle:"none"},tail:"none",headExtras:["bolts"],bodyExtras:["panel","joints","boots"],extraColors:["#ff7a6b","#fbd46a","#7ff0ff"]},{id:"astronaut",name:{en:"Astronaut",it:"Astronauta"},band:"9-12",palette:{body:"#f4f1ec",limbs:"#f4f1ec",belly:"#f4f1ec",accent:"#ee6a43",outline:vt,hands:"#9fb0bd",feet:"#9fb0bd"},head:"round",ears:"none",face:{eyes:"visor",mouth:"smile",muzzle:"none"},tail:"none",headExtras:["helmet"],bodyExtras:["backpack","badge","boots"],extraColors:["#c9d3db"]},{id:"dinosaur",name:{en:"Dinosaur",it:"Dinosauro"},band:"6-8",palette:{body:"#3fb3a6",limbs:"#3fb3a6",belly:"#c9f0d6",accent:"#f79a3e",outline:ft},head:"wide",ears:"none",face:{eyes:"dot",mouth:"teeth",muzzle:"none",cheeks:"#f59b8f"},tail:"spiky",headExtras:["spikes","spots"],bodyExtras:[],extraColors:["#2b8f84","#7fd3c6"]},{id:"monkey",name:{en:"Monkey",it:"Scimmietta"},band:"6-8",palette:{body:"#7b5234",limbs:"#7b5234",belly:"#f2c9a0",accent:"#f2c9a0",outline:ft,hands:"#f2c9a0",feet:"#f2c9a0"},head:"round",ears:"side",face:{eyes:"dot",mouth:"open",nose:"#5a3a26",muzzle:"monkey",cheeks:At},tail:"curl",headExtras:["tuft"],bodyExtras:[]},{id:"koala",name:{en:"Koala",it:"Koala"},band:"3-5",palette:{body:"#b7bcc6",limbs:"#b7bcc6",belly:"#eef0f3",accent:"#f4dbe2",outline:yt},head:"wide",ears:"big-round",face:{eyes:"dot",mouth:"smile",nose:"#3b3438",muzzle:"none",cheeks:"#f4a3b0"},tail:"none",headExtras:[],bodyExtras:[]},{id:"tiger",name:{en:"Tiger",it:"Tigrotto"},band:"6-8",palette:{body:"#f9a33a",limbs:"#f9a33a",belly:"#fff1dc",accent:"#fff1dc",outline:ft},head:"wide",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#e2607a",muzzle:"oval",cheeks:At},tail:"striped",headExtras:["stripes","whiskers"],bodyExtras:[],extraColors:["#3a2a22"]},{id:"owl",name:{en:"Owl",it:"Gufetto"},band:"3-5",palette:{body:"#8ec0e6",limbs:"#8ec0e6",belly:"#e3f2fc",accent:"#639cc9",outline:yt,feet:"#f9b95c",hands:"#639cc9"},head:"tall",ears:"tufts",face:{eyes:"big",eyeColor:yt,eyeRing:"#fde08a",mouth:"beak",muzzle:"none",cheeks:"#f6a8b4"},tail:"none",headExtras:[],bodyExtras:["feathers"]},{id:"alien",name:{en:"Alien",it:"Alieno"},band:"9-12",palette:{body:"#9ee05a",limbs:"#9ee05a",belly:"#d8f5a8",accent:"#b07cf2",outline:vt},head:"bulb",ears:"antennae",face:{eyes:"almond",eyeColor:"#1e1838",mouth:"smirk",muzzle:"none"},tail:"none",headExtras:[],bodyExtras:["spots"],extraColors:["#7cc23e","#7cc23e"]},{id:"ghost",name:{en:"Friendly Ghost",it:"Fantasmino"},band:"6-8",palette:{body:"#e6f4ff",limbs:"#e6f4ff",belly:"#e6f4ff",accent:"#bcd9f2",outline:ft},head:"round",ears:"none",face:{eyes:"dot",mouth:"open",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["curl"],bodyExtras:["sheet"]},{id:"octopus",name:{en:"Octopus",it:"Polpetto"},band:"6-8",palette:{body:"#e0578a",limbs:"#e0578a",belly:"#f7b3cc",accent:"#f7b3cc",outline:ft,hands:"#f7b3cc",feet:"#f7b3cc"},head:"tall",ears:"none",face:{eyes:"big",eyeColor:"#3a2140",mouth:"smile",muzzle:"none",cheeks:"#ffd0a0"},tail:"none",headExtras:["spots"],bodyExtras:["tentacles"],extraColors:["#f7b3cc","#f7b3cc"]},{id:"chick",name:{en:"Chick",it:"Pulcino"},band:"3-5",palette:{body:"#ffd45e",limbs:"#ffd45e",belly:"#fff2c2",accent:"#ffa04a",outline:yt,hands:"#ffc23d",feet:"#ffa04a"},head:"round",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"none",cheeks:At},tail:"none",headExtras:["eggshell"],bodyExtras:[],extraColors:["#fffaf0"]},{id:"puppy",name:{en:"Puppy",it:"Cucciolo"},band:"3-5",palette:{body:"#f4e4cf",limbs:"#f4e4cf",belly:"#fffaf2",accent:"#f29aa4",outline:yt,ears:"#b58262",hands:"#e6caa6",feet:"#e6caa6"},head:"wide",ears:"floppy",face:{eyes:"dot",mouth:"open",nose:_e,muzzle:"oval",cheeks:At},tail:"curl",headExtras:["eye-spot"],bodyExtras:[]},{id:"lamb",name:{en:"Lamb",it:"Agnellino"},band:"3-5",palette:{body:"#fdf8ee",limbs:"#e3d1c2",belly:"#fffdf8",accent:"#f6bcc2",outline:yt,skin:"#f7dccb",hands:"#a58c7e",feet:"#a58c7e"},head:"round",ears:"droopy",face:{eyes:"dot",mouth:"smile",nose:"#e591a0",muzzle:"none",cheeks:At},tail:"pom",headExtras:["wool"],bodyExtras:["wool"]},{id:"duckling",name:{en:"Duckling",it:"Anatroccolo"},band:"3-5",palette:{body:"#fff1a6",limbs:"#fff1a6",belly:"#fffbe0",accent:"#ff9f43",outline:yt,feet:"#ff9f43"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"bill",muzzle:"none",cheeks:At},tail:"none",headExtras:["curl"],bodyExtras:["flippers","scarf"],extraColors:["#86cfe0"]},{id:"shark",name:{en:"Shark",it:"Squalo"},band:"6-8",palette:{body:"#6c95c4",limbs:"#6c95c4",belly:"#eef5fb",accent:"#4c76a8",outline:ft,hands:"#eef5fb",feet:"#4c76a8"},head:"wide",ears:"fin",face:{eyes:"dot",mouth:"jaws",muzzle:"none",cheeks:"#f59bb0"},tail:"fish",headExtras:["gills"],bodyExtras:[]},{id:"wolf",name:{en:"Wolf",it:"Lupo"},band:"6-8",palette:{body:"#8f9bb3",limbs:"#8f9bb3",belly:"#eef1f6",accent:"#f3b8c4",outline:ft,hands:"#5a647a",feet:"#5a647a"},head:"round",ears:"pointy",face:{eyes:"dot",mouth:"open",nose:_e,muzzle:"oval",cheeks:"#f4a3b0"},tail:"fluffy",headExtras:["ruff","forehead"],bodyExtras:[],extraColors:["#636d84"]},{id:"parrot",name:{en:"Parrot",it:"Pappagallo"},band:"6-8",palette:{body:"#e8503f",limbs:"#e8503f",belly:"#ffd25a",accent:"#f6e6c4",outline:ft,hands:"#3a9bdc",feet:"#8a7a70"},head:"round",ears:"none",face:{eyes:"big",eyeColor:ft,eyeRing:"#ffffff",mouth:"hook",muzzle:"none",cheeks:"#ffb0a0"},tail:"plume",headExtras:["crest"],bodyExtras:["feathers"],extraColors:["#ffd25a","#3fae5a","#3a9bdc"]},{id:"ninja",name:{en:"Ninja",it:"Ninja"},band:"9-12",palette:{body:"#2f3a56",limbs:"#2f3a56",belly:"#2f3a56",accent:"#36c9bb",outline:vt,skin:"#b07a52",hands:"#222a40",feet:"#222a40"},head:"round",ears:"none",face:{eyes:"calm",mouth:"none",muzzle:"none",brows:"#2a1d16"},tail:"none",headExtras:["ninja-hood"],bodyExtras:["belt"],extraColors:["#36c9bb","#36c9bb","#36c9bb"]},{id:"skater",name:{en:"Skater",it:"Skater"},band:"9-12",palette:{body:"#3a8fc0",limbs:"#2c3e57",belly:"#2f7aa6",accent:"#ffcf3a",outline:vt,skin:"#f2c9a5",hair:"#7a4a2a",hands:"#f2c9a5",feet:"#eef1f5"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#5a3520"},tail:"none",headExtras:["hair","cap"],bodyExtras:["pocket","joints"],extraColors:["#ff5d73"]},{id:"explorer",name:{en:"Explorer",it:"Giramondo"},band:"9-12",palette:{body:"#5f8f5b",limbs:"#5f8f5b",belly:"#5f8f5b",accent:"#d9bb7e",outline:vt,skin:"#7a4a30",hair:"#1d1410",hands:"#7a4a30",feet:"#6b4a2a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#1d1410"},tail:"none",headExtras:["curls","safari-hat"],bodyExtras:["backpack","straps","boots"],extraColors:["#e07b39","#6b4a2a"]},{id:"wizard",name:{en:"Wizard",it:"Mago"},band:"9-12",palette:{body:"#5b3fa0",limbs:"#5b3fa0",belly:"#5b3fa0",accent:"#3d5fc8",outline:vt,skin:"#c98d62",hair:"#a8452a",hands:"#c98d62",feet:"#33255e"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#7a301c"},tail:"none",headExtras:["locks","wizard-hat"],bodyExtras:["robe","belt"],extraColors:["#ffd84a","#ffd84a","#ffd84a"]},{id:"knight",name:{en:"Knight",it:"Cavaliere"},band:"9-12",palette:{body:"#bcc7d3",limbs:"#8e9aa8",belly:"#dce3ea",accent:"#d8443a",outline:vt,hands:"#6c7786",feet:"#6c7786"},head:"bucket",ears:"none",face:{eyes:"slit",eyeColor:"#bfefff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["plume"],bodyExtras:["pauldrons","emblem","boots"],extraColors:["#d8443a"]},{id:"racer",name:{en:"Racer",it:"Pilota"},band:"9-12",palette:{body:"#ff6a2b",limbs:"#ff6a2b",belly:"#ffffff",accent:"#ffffff",outline:vt,hands:"#232838",feet:"#232838"},head:"round",ears:"none",face:{eyes:"goggle",eyeColor:"#7fd6ff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["stripe"],bodyExtras:["racing-stripe","boots"]},{id:"pirate",name:{en:"Pirate",it:"Pirata"},band:"9-12",palette:{body:"#f2efe6",limbs:"#2a3d6e",belly:"#f2efe6",accent:"#d94545",outline:vt,skin:"#d9a072",hair:"#2b1a12",hands:"#d9a072",feet:"#3a2a20"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#2b1a12"},tail:"none",headExtras:["locks","bandana","eye-patch"],bodyExtras:["stripes","belt","boots"],extraColors:["#d94545","#2a3d6e","#4a3426"]},{id:"diver",name:{en:"Diver",it:"Sub"},band:"9-12",palette:{body:"#1f6582",limbs:"#1f6582",belly:"#1f6582",accent:"#ffb020",outline:vt,skin:"#e8b48a",hair:"#c98f2e",hands:"#1b4f66",feet:"#ffb020"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#8a5a1a"},tail:"none",headExtras:["curls","dive-mask"],bodyExtras:["tank","fins"],extraColors:["#c9d3db"]},{id:"hero",name:{en:"Hero",it:"Supereroe"},band:"9-12",palette:{body:"#3557c8",limbs:"#3557c8",belly:"#3557c8",accent:"#e0403a",outline:vt,skin:"#5a3825",hair:"#141010",hands:"#e0403a",feet:"#e0403a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#141010"},tail:"none",headExtras:["hair","domino"],bodyExtras:["cape","emblem","boots"],extraColors:["#ffd84a"]}],st={M:0,L:1,Q:2,C:3,Z:4},Ti=[2,2,4,6,0];function Ss(t,e){for(const s of e)Mr(t,s)}function Mr(t,e){if(e.k==="group"){t.save(),t.translate(e.x,e.y),e.rot&&t.rotate(e.rot),e.s!==void 0&&e.s!==1&&t.scale(e.s,e.s),e.alpha!==void 0&&(t.globalAlpha*=e.alpha),Ss(t,e.items),t.restore();return}switch(t.save(),e.alpha!==void 0&&(t.globalAlpha*=e.alpha),t.beginPath(),e.k){case"circle":t.arc(e.x,e.y,Math.max(e.r,0),0,Math.PI*2);break;case"ellipse":t.ellipse(e.x,e.y,Math.max(e.rx,0),Math.max(e.ry,0),e.rot??0,0,Math.PI*2);break;case"rect":Er(t,e);break;case"path":typeof e.d=="string"?Tr(t,e.d):Ar(t,e.d);break;case"line":t.moveTo(e.pts[0]??0,e.pts[1]??0);for(let s=2;s+1<e.pts.length;s+=2)t.lineTo(e.pts[s],e.pts[s+1]);break}t.lineCap="round",t.lineJoin="round",e.fill&&e.k!=="line"&&(t.fillStyle=e.fill,t.fill()),e.stroke&&(e.lw??1)>0&&(t.strokeStyle=e.stroke,t.lineWidth=e.lw??1,t.stroke()),t.restore()}function Er(t,e){const s=Math.max(0,Math.min(e.r,e.w/2,e.h/2));t.translate(e.x,e.y),e.rot&&t.rotate(e.rot);const i=-e.w/2,n=-e.h/2;t.moveTo(i+s,n),t.lineTo(i+e.w-s,n),t.quadraticCurveTo(i+e.w,n,i+e.w,n+s),t.lineTo(i+e.w,n+e.h-s),t.quadraticCurveTo(i+e.w,n+e.h,i+e.w-s,n+e.h),t.lineTo(i+s,n+e.h),t.quadraticCurveTo(i,n+e.h,i,n+e.h-s),t.lineTo(i,n+s),t.quadraticCurveTo(i,n,i+s,n),t.closePath()}function Ar(t,e){for(let s=0;s<e.length;){const i=e[s++];if(i===st.M)t.moveTo(e[s],e[s+1]);else if(i===st.L)t.lineTo(e[s],e[s+1]);else if(i===st.Q)t.quadraticCurveTo(e[s],e[s+1],e[s+2],e[s+3]);else if(i===st.C)t.bezierCurveTo(e[s],e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]);else if(i===st.Z)t.closePath();else return;s+=Ti[i]}}function _r(t){if(typeof t=="string")return(t.match(/-?\d*\.?\d+(?:e-?\d+)?/gi)??[]).map(Number);const e=[];for(let s=0;s<t.length;){const i=Ti[t[s++]];if(i===void 0)break;for(let n=0;n<i;n++)e.push(t[s+n]);s+=i}return e}function Tr(t,e){const s=e.match(/[MLQCZ]|-?\d*\.?\d+(?:e-?\d+)?/gi)??[];let i="",n=0;const r=()=>Number(s[n++]);for(;n<s.length;){const a=s[n];if(/[MLQCZ]/i.test(a)&&(i=a.toUpperCase(),n++,i==="Z")){t.closePath();continue}i==="M"?(t.moveTo(r(),r()),i="L"):i==="L"?t.lineTo(r(),r()):i==="Q"?t.quadraticCurveTo(r(),r(),r(),r()):i==="C"?t.bezierCurveTo(r(),r(),r(),r(),r(),r()):n++}}var j=t=>{const e=Math.round(t*100)/100;return e===0?0:e};function tt(t,e=.5){const s=t.length;if(s<3)return[];const i=(l,h,o)=>({x:l.x+(h.x-l.x)*o,y:l.y+(h.y-l.y)*o}),n=Math.min(Math.max(e,0),.5),r=i(t[0],t[1],n),a=[st.M,j(r.x),j(r.y)];for(let l=1;l<=s;l++){const h=t[(l-1)%s],o=t[l%s],f=t[(l+1)%s],u=i(h,o,1-n),c=i(o,f,n);a.push(st.L,j(u.x),j(u.y),st.Q,j(o.x),j(o.y),j(c.x),j(c.y))}return a.push(st.Z),a}function Z(t,e=1){const s=t.length;if(s<3)return[];const i=[st.M,j(t[0].x),j(t[0].y)],n=e/6;for(let r=0;r<s;r++){const a=t[(r-1+s)%s],l=t[r],h=t[(r+1)%s],o=t[(r+2)%s];i.push(st.C,j(l.x+(h.x-a.x)*n),j(l.y+(h.y-a.y)*n),j(h.x-(o.x-l.x)*n),j(h.y-(o.y-l.y)*n),j(h.x),j(h.y))}return i.push(st.Z),i}function Te(t){const e=t.length;if(e<2)return[];const s=[st.M,j(t[0].x),j(t[0].y)];for(let i=0;i<e-1;i++){const n=t[Math.max(i-1,0)],r=t[i],a=t[i+1],l=t[Math.min(i+2,e-1)];s.push(st.C,j(r.x+(a.x-n.x)/6),j(r.y+(a.y-n.y)/6),j(a.x-(l.x-r.x)/6),j(a.y-(l.y-r.y)/6),j(a.x),j(a.y))}return s}var Ke="M0 -1 L0.29 -0.4 L0.95 -0.31 L0.47 0.15 L0.59 0.81 L0 0.5 L-0.59 0.81 L-0.47 0.15 L-0.95 -0.31 L-0.29 -0.4 Z",at="#ffffff",$=[-1,1],Si="#3a2420",Sr="#f2808f",Cs="#26324a",Cr="#ffd84a",ut=(...t)=>{const e=[];for(let s=0;s+1<t.length;s+=2)e.push({x:t[s],y:t[s+1]});return e};function Ci(t,e){const s=t.palette,i=[],n={stroke:s.outline,lw:e},r=f=>t.headExtras.includes(f),a=(f,u)=>t.extraColors?.[f]??u;if(r("mane")){for(let u=0;u<12;u++){const c=u/12*Math.PI*2;i.push({k:"circle",x:Math.cos(c)*1.02,y:Math.sin(c)*1+.04,r:.42,fill:a(0,s.accent),...n})}i.push({k:"circle",x:0,y:.04,r:1.08,fill:a(0,s.accent)})}if(r("rainbow-mane")){const f=t.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];[[.98,.05,.3,.5,-.25],[.92,.58,.26,.42,-.1],[.62,.92,.22,.32,.4]].forEach(([c,y,p,x,m],g)=>i.push({k:"ellipse",x:c,y,rx:p,ry:x,rot:m,fill:f[g%f.length],...n}))}if(r("spikes"))for(const f of[-.55,0,.55]){const u=Se(f,1.48),c=Se(f-.32,.86),y=Se(f+.32,.86);i.push({k:"path",d:tt([c,u,y],.22),fill:s.accent,...n})}if(r("curl")&&i.push({k:"path",d:Z([{x:-.2,y:-.9},{x:-.05,y:-1.3},{x:.32,y:-1.42},{x:.16,y:-1.18},{x:.2,y:-.9}]),fill:s.body,...n}),r("wool"))for(let f=0;f<=8;f++){const u=-1.75+f/8*3.5;i.push({k:"circle",x:Math.sin(u)*.98,y:-Math.cos(u)*.92-.04,r:.34,fill:s.body,...n})}if(r("crest")&&[-.38,0,.38].forEach((f,u)=>{const c=Se(f,1.12);i.push({k:"ellipse",x:c.x,y:c.y,rx:.15,ry:.42,rot:f,fill:a(u,s.accent),...n})}),r("plume")&&i.push({k:"path",d:Z(ut(-.12,-.92,-.2,-1.42,.1,-1.78,.62,-1.74,.36,-1.46,.16,-.98)),fill:s.accent,...n}),r("locks")&&i.push({k:"path",d:Z(ut(-1.14,.58,-1.24,-.2,-.86,-.98,0,-1.2,.86,-.98,1.24,-.2,1.14,.58,.8,.66,0,.2,-.8,.66)),fill:s.hair??s.outline,...n}),r("ninja-hood"))for(const[f,u]of[[.35,.5],[.85,.42]])i.push({k:"ellipse",x:1+Math.cos(f)*u*.8,y:-.5+Math.sin(f)*u*.8,rx:u,ry:.11,rot:f,fill:s.accent,...n});if(r("bandana"))for(const[f,u]of[[Math.PI-.5,.42],[Math.PI-1,.36]])i.push({k:"ellipse",x:-.98+Math.cos(f)*u*.8,y:-.36+Math.sin(f)*u*.8,rx:u,ry:.12,rot:f,fill:s.accent,...n});if(r("ruff"))for(const f of $)i.push({k:"path",d:tt(ut(f*.7,-.3,f*1.32,0,f*1.02,.18,f*1.26,.46,f*.86,.56,f*.98,.84,f*.4,.7),.25),fill:s.body,...n});if(t.face.eyesOnTop)for(const f of $)i.push({k:"circle",x:f*.46,y:-.72,r:.38,fill:s.body,...n});i.push(...Lr(t,e)),i.push(Rr(t,n));const l=t.face.muzzle,h=s.belly;if(l==="oval"&&i.push({k:"ellipse",x:0,y:.4,rx:.46,ry:.32,fill:h}),l==="monkey"){for(const f of $)i.push({k:"circle",x:f*.32,y:-.04,r:.38,fill:h});i.push({k:"ellipse",x:0,y:.4,rx:.56,ry:.4,fill:h})}if(l==="heart"){for(const f of $)i.push({k:"circle",x:f*.36,y:.02,r:.5,fill:h});i.push({k:"ellipse",x:0,y:.38,rx:.66,ry:.48,fill:h})}if(l==="disc")for(const f of $)i.push({k:"circle",x:f*.4,y:.02,r:.44,fill:h});if(l==="cheeks")for(const f of $)i.push({k:"ellipse",x:f*.4,y:.44,rx:.44,ry:.32,fill:h});if(l==="band"&&i.push({k:"path",d:Pr(t,e),fill:h}),r("stripes")){const f=a(0,s.outline);i.push({k:"line",pts:[0,-.97,0,-.66],stroke:f,lw:.13});for(const u of $)i.push({k:"line",pts:[u*.3,-.93,u*.24,-.7],stroke:f,lw:.1}),i.push({k:"line",pts:[u*.98,-.05,u*.74,0],stroke:f,lw:.1}),i.push({k:"line",pts:[u*.94,.22,u*.74,.22],stroke:f,lw:.09})}if(r("spots")){const f=a(1,s.belly);i.push({k:"circle",x:-.55,y:-.5,r:.15,fill:f}),i.push({k:"circle",x:.58,y:-.42,r:.11,fill:f}),i.push({k:"circle",x:.22,y:-.76,r:.09,fill:f})}if(r("forehead")&&i.push({k:"path",d:Z(ut(-.62,-.66,0,-.86,.62,-.66,.26,-.36,0,-.1,-.26,-.36),.9),fill:a(0,s.accent)}),r("eye-spot")&&i.push({k:"ellipse",x:.42,y:-.06,rx:.3,ry:.33,rot:.3,fill:s.ears??s.accent}),r("gills"))for(const f of $)for(const u of[0,.12,.24])i.push({k:"path",d:`M${f*(.66+u)} 0.06 Q${f*(.6+u)} 0.22 ${f*(.66+u)} 0.38`,stroke:s.accent,lw:e*.9});const o=s.hair??s.outline;if(r("hair")&&i.push({k:"path",d:Z(ut(-1.02,-.06,-1.02,-.58,-.62,-1.04,.08,-1.14,.76,-.92,1.05,-.42,1,-.06,.84,-.4,.42,-.5,.06,-.4,-.34,-.56,-.74,-.38)),fill:o,...n}),r("locks")&&i.push({k:"path",d:Z(ut(-1,-.08,-.98,-.62,-.56,-1.02,0,-1.1,.56,-1.02,.98,-.62,1,-.08,.8,-.38,.36,-.44,0,-.4,-.36,-.44,-.8,-.38)),fill:o,...n}),r("curls")){for(let f=0;f<7;f++){const u=Se(-1.3+f/6*2.6,.86);i.push({k:"circle",x:u.x,y:u.y,r:.3,fill:o,...n})}i.push({k:"ellipse",x:0,y:-.64,rx:.8,ry:.36,fill:o})}if(r("ninja-hood")&&(i.push({k:"rect",x:0,y:0,w:1.56,h:.6,r:.28,fill:s.skin??at,stroke:s.outline,lw:e*.8}),i.push({k:"path",d:"M-0.98 -0.42 Q0 -0.74 0.98 -0.42 L1.0 -0.62 Q0 -0.94 -1.0 -0.62 Z",fill:s.accent,...n})),r("domino")){i.push({k:"path",d:Z(ut(-.86,-.04,-.62,-.3,-.18,-.24,0,-.16,.18,-.24,.62,-.3,.86,-.04,.6,.22,.16,.16,0,.1,-.16,.16,-.6,.22),.9),fill:s.accent,...n});for(const f of $)i.push({k:"ellipse",x:f*.38,y:0,rx:.19,ry:.13,fill:at})}if(i.push(...Nr(t,e)),r("brows"))for(const f of $)i.push({k:"line",pts:[f*.72,-.5,f*.14,-.3],stroke:s.accent,lw:.16});if(t.face.brows)for(const f of $)i.push({k:"line",pts:[f*.2,-.2,f*.54,-.28],stroke:t.face.brows,lw:.09});if(i.push(...Ir(t,e)),t.face.cheeks)for(const f of $)i.push({k:"ellipse",x:f*.64,y:.3,rx:.15,ry:.1,fill:t.face.cheeks,alpha:.8});if(r("whiskers"))for(const f of $)for(const u of[-.1,.06])i.push({k:"line",pts:[f*.62,.38+u,f*1.06,.3+u*2.2],stroke:s.outline,lw:e*.7,alpha:.75});if(r("rainbow-mane")){const f=t.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];i.push({k:"ellipse",x:.42,y:-.82,rx:.34,ry:.22,rot:.5,fill:f[0],...n}),i.push({k:"ellipse",x:.1,y:-.92,rx:.3,ry:.2,rot:.25,fill:f[1%f.length],...n})}if(t.ears==="unicorn"){const f=[{x:-.18,y:-.84},{x:.02,y:-1.72},{x:.18,y:-.84}];i.push({k:"path",d:tt(f,.12),fill:s.accent,...n});for(const u of[-1,-1.2,-1.4]){const c=.16*((u+1.72)/.88);i.push({k:"line",pts:[-c,u+.04,c,u-.04],stroke:s.outline,lw:e*.7,alpha:.6})}}if(r("helmet")){for(const f of $)i.push({k:"rect",x:f*1,y:.05,w:.26,h:.56,r:.12,fill:s.accent,...n});i.push({k:"path",d:"M-0.62 -0.62 Q-0.3 -0.92 0.12 -0.9",stroke:at,lw:.1,alpha:.9})}if(r("bolts"))for(const f of $)i.push({k:"rect",x:f*1.08,y:.08,w:.2,h:.44,r:.08,fill:s.accent,...n});if(r("tuft")&&i.push({k:"path",d:Z([{x:-.26,y:-.95},{x:-.12,y:-1.22},{x:.02,y:-1.04},{x:.16,y:-1.28},{x:.28,y:-.95},{x:0,y:-.86}]),fill:s.body,...n}),r("eggshell")&&i.push({k:"path",d:"M-0.88 -0.5 C-0.88 -1.12 -0.46 -1.42 0 -1.42 C0.46 -1.42 0.88 -1.12 0.88 -0.5 L0.66 -0.66 L0.44 -0.48 L0.22 -0.66 L0 -0.48 L-0.22 -0.66 L-0.44 -0.48 L-0.66 -0.66 Z",fill:a(0,at),...n}),r("wool"))for(const[f,u]of[[-.36,-.84],[.02,-.94],[.4,-.82]])i.push({k:"circle",x:f,y:u,r:.27,fill:s.body,...n});if(r("stripe")&&i.push({k:"rect",x:0,y:-.64,w:.38,h:.62,r:.06,fill:s.accent}),r("eye-patch")&&(i.push({k:"line",pts:[-.97,-.5,.97,.13],stroke:s.outline,lw:.07}),i.push({k:"ellipse",x:.38,y:.02,rx:.21,ry:.19,fill:s.outline})),r("bandana")){i.push({k:"path",d:Z(ut(-1.05,-.22,-.96,-.72,-.5,-1.08,.1,-1.14,.72,-.96,1.04,-.56,1.05,-.22,.5,-.46,-.5,-.46)),fill:s.accent,...n});for(const[f,u]of[[-.5,-.8],[.08,-.92],[.6,-.74],[-.12,-.62],[.36,-.6]])i.push({k:"circle",x:f,y:u,r:.06,fill:at,alpha:.85});i.push({k:"circle",x:-.98,y:-.34,r:.15,fill:s.accent,...n})}if(r("cap")){for(const f of $)i.push({k:"line",pts:[f*.98,-.2,f*.5,.82,-f*.05,.98],stroke:s.outline,lw:.06});i.push({k:"path",d:Z(ut(-1.1,-.16,-1.04,-.66,-.6,-1.12,0,-1.24,.6,-1.12,1.04,-.66,1.1,-.16,.5,-.4,-.5,-.4)),fill:s.accent,...n}),i.push({k:"path",d:"M-0.74 -0.4 Q0 -0.6 0.74 -0.4 Q0.8 -0.24 0.6 -0.22 Q0 -0.36 -0.6 -0.22 Q-0.8 -0.24 -0.74 -0.4 Z",fill:s.accent,...n}),i.push({k:"circle",x:.5,y:-.82,r:.15,fill:a(0,at),...n});for(const f of[-.42,-.14])i.push({k:"line",pts:[f,-1.04,f+.02,-.78],stroke:s.outline,lw:.07,alpha:.7})}if(r("safari-hat")&&(i.push({k:"ellipse",x:0,y:-.56,rx:1.48,ry:.3,fill:s.accent,...n}),i.push({k:"path",d:Z(ut(-.78,-.58,-.7,-1.1,-.3,-1.38,.3,-1.38,.7,-1.1,.78,-.58,0,-.5),.8),fill:s.accent,...n}),i.push({k:"path",d:"M-0.77 -0.72 Q0 -0.62 0.77 -0.72 L0.74 -0.9 Q0 -0.8 -0.74 -0.9 Z",fill:a(1,s.outline),stroke:s.outline,lw:e*.8})),r("wizard-hat")){i.push({k:"ellipse",x:0,y:-.62,rx:1.32,ry:.26,fill:s.accent,...n}),i.push({k:"path",d:tt(ut(-.8,-.66,-.36,-1.5,.5,-2.2,.3,-1.46,.8,-.66),.3),fill:s.accent,...n});const f=a(0,Cr);for(const[u,c,y]of[[.02,-1.08,.18],[-.38,-.84,.1],[.36,-1.5,.11]])i.push({k:"group",x:u,y:c,s:y,items:[{k:"path",d:Ke,fill:f}]})}if(r("dive-mask")){for(const u of $)i.push({k:"line",pts:[u*.7,-.04,u*1,-.12],stroke:s.outline,lw:.2},{k:"line",pts:[u*.7,-.04,u*1,-.12],stroke:s.accent,lw:.11});i.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,fill:"#bfe9f5",alpha:.35}),i.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:s.outline,lw:.2}),i.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:s.accent,lw:.11}),i.push({k:"path",d:"M-0.5 -0.16 Q-0.4 -0.24 -0.22 -0.24",stroke:at,lw:.06,alpha:.9});const f="M0.5 0.52 Q0.98 0.56 1.04 0.1 L1.12 -0.92";i.push({k:"path",d:f,stroke:s.outline,lw:.24},{k:"path",d:f,stroke:s.accent,lw:.13})}return i}function Rr(t,e){const s=t.headExtras.includes("ninja-hood")?t.palette.body:t.palette.skin??t.palette.body;switch(t.head){case"round":return{k:"circle",x:0,y:0,r:1,fill:s,...e};case"wide":return{k:"ellipse",x:0,y:.03,rx:1.12,ry:.94,fill:s,...e};case"tall":return{k:"ellipse",x:0,y:-.02,rx:.94,ry:1.04,fill:s,...e};case"square":return{k:"rect",x:0,y:0,w:2,h:1.8,r:.46,fill:s,...e};case"bucket":return{k:"path",d:tt(ut(-.94,.96,-.98,-.36,-.62,-1.04,.62,-1.04,.98,-.36,.94,.96),.42),fill:s,...e};case"bulb":return{k:"path",d:Z([{x:0,y:-1.02},{x:.86,y:-.74},{x:1.08,y:-.12},{x:.72,y:.62},{x:0,y:.92},{x:-.72,y:.62},{x:-1.08,y:-.12},{x:-.86,y:-.74}]),fill:s,...e}}}function Fr(t){return t.head==="round"?{cy:0,rx:1,ry:1}:t.head==="tall"?{cy:-.02,rx:.94,ry:1.04}:{cy:.03,rx:1.12,ry:.94}}function Pr(t,e){const{cy:s,rx:i,ry:n}=Fr(t),r=i-e/2,a=n-e/2,l=.15,h=Math.asin(Math.min(1,(l-s)/a)),o=Math.cos(h)*r,f=p=>Math.round(p*100)/100||0,u=[st.M,f(-o),l],c=[[-.84*o,.02,-.53*o,.06,-.32*o,.24],[-.17*o,.11,.17*o,.11,.32*o,.24],[.53*o,.06,.84*o,.02,o,l]];for(const p of c)u.push(st.C,...p.map(f));const y=24;for(let p=1;p<=y;p++){const x=h+(Math.PI-2*h)*p/y;u.push(st.L,f(Math.cos(x)*r),f(s+Math.sin(x)*a))}return u.push(st.Z),u}function Lr(t,e){const s=t.palette,i={stroke:s.outline,lw:e},n=[];for(const r of $)switch(t.ears){case"pointy":case"unicorn":{const a=t.ears==="unicorn"?.8:1,l={x:r*.3,y:-.82},h={x:r*.86,y:-.82-.62*a},o={x:r*.94,y:-.36};n.push({k:"path",d:tt([l,h,o],.2),fill:s.body,...i});const f={x:(l.x+h.x+o.x)/3,y:(l.y+h.y+o.y)/3},u=[l,h,o].map(c=>({x:f.x+(c.x-f.x)*.55,y:f.y+(c.y-f.y)*.55+.04}));n.push({k:"path",d:tt(u,.25),fill:s.accent});break}case"round":n.push({k:"circle",x:r*.72,y:-.72,r:.36,fill:s.ears??s.body,...i}),s.ears||n.push({k:"circle",x:r*.74,y:-.74,r:.19,fill:s.accent});break;case"big-round":n.push({k:"circle",x:r*.96,y:-.46,r:.52,fill:s.body,...i}),n.push({k:"circle",x:r*1,y:-.44,r:.32,fill:s.accent});break;case"long":n.push({k:"ellipse",x:r*.38,y:-1.42,rx:.25,ry:.68,rot:r*.14,fill:s.body,...i}),n.push({k:"ellipse",x:r*.39,y:-1.36,rx:.12,ry:.48,rot:r*.14,fill:s.accent});break;case"side":n.push({k:"circle",x:r*1,y:.02,r:.34,fill:s.body,...i}),n.push({k:"circle",x:r*1.02,y:.02,r:.2,fill:s.belly});break;case"tufts":n.push({k:"path",d:tt([{x:r*.3,y:-.84},{x:r*1.22,y:-1.12},{x:r*.92,y:-.42}],.16),fill:s.body,...i}),n.push({k:"line",pts:[r*.62,-.78,r*1,-.98],stroke:s.accent,lw:.08});break;case"antennae":{const a={x:r*.62,y:-1.42};n.push({k:"path",d:`M${r*.3} -0.8 Q${r*.36} -1.2 ${a.x} ${a.y}`,stroke:s.outline,lw:e*2.6}),n.push({k:"path",d:`M${r*.3} -0.8 Q${r*.36} -1.2 ${a.x} ${a.y}`,stroke:s.body,lw:e*1.2}),n.push({k:"circle",x:a.x,y:a.y,r:.17,fill:s.accent,...i});break}case"floppy":n.push({k:"ellipse",x:r*.96,y:.02,rx:.3,ry:.62,rot:-r*.36,fill:s.ears??s.body,...i});break;case"droopy":n.push({k:"ellipse",x:r*1.04,y:-.22,rx:.4,ry:.18,rot:r*.32,fill:s.skin??s.body,...i}),n.push({k:"ellipse",x:r*1.08,y:-.2,rx:.24,ry:.08,rot:r*.32,fill:s.accent});break;case"human":n.push({k:"ellipse",x:r*.98,y:.06,rx:.17,ry:.23,fill:s.skin??s.body,...i});break;case"horns":{const a=[{x:r*.3,y:-.84},{x:r*.6,y:-1.5},{x:r*.66,y:-.68}];n.push({k:"path",d:tt(a,.18),fill:s.accent,...i});break}}return t.ears==="fin"&&n.push({k:"path",d:tt(ut(-.4,-.82,.2,-1.62,.46,-.78),.2),fill:s.body,...i}),t.ears==="antenna"&&(n.push({k:"line",pts:[0,-.85,0,-1.42],stroke:s.outline,lw:e*2.6}),n.push({k:"line",pts:[0,-.85,0,-1.42],stroke:s.limbs,lw:e*1.2}),n.push({k:"circle",x:0,y:-1.5,r:.18,fill:s.accent,...i})),n}function Nr(t,e){const s=t.palette,i=t.face,n=[],r=s.outline,a=i.eyesOnTop?.46:.4,l=i.eyesOnTop?-.72:-.04,h=(o,f,u)=>({k:"circle",x:o,y:f,r:u,fill:at});switch(i.eyes){case"dot":for(const o of $)n.push({k:"ellipse",x:o*a,y:l,rx:.12,ry:.155,fill:r}),n.push(h(o*a+.04,l-.06,.045));break;case"bead":for(const o of $)n.push({k:"ellipse",x:o*a,y:l,rx:.16,ry:.22,fill:r}),n.push(h(o*a+.05,l-.08,.065));break;case"big":for(const o of $)i.eyeRing&&n.push({k:"circle",x:o*a,y:l,r:.36,fill:i.eyeRing,stroke:r,lw:e*.8}),n.push({k:"circle",x:o*a,y:l,r:.25,fill:at,stroke:r,lw:e*.8}),n.push({k:"circle",x:o*a+o*-.03,y:l+.03,r:.14,fill:i.eyeColor??r}),n.push(h(o*a+o*-.03+.05,l-.03,.05));break;case"mask":for(const o of $)n.push({k:"ellipse",x:o*.4,y:0,rx:.24,ry:.32,rot:o*-.55,fill:s.limbs}),n.push({k:"circle",x:o*.4,y:-.02,r:.11,fill:at}),n.push({k:"circle",x:o*.39,y:-0,r:.065,fill:r});break;case"screen":n.push({k:"rect",x:0,y:0,w:1.5,h:.66,r:.26,fill:"#24323d",stroke:r,lw:e*.8});for(const o of $)n.push({k:"ellipse",x:o*.36,y:0,rx:.2,ry:.24,fill:i.eyeColor??"#7ff0ff",alpha:.3}),n.push({k:"ellipse",x:o*.36,y:0,rx:.12,ry:.16,fill:i.eyeColor??"#7ff0ff"});break;case"almond":for(const o of $)n.push({k:"ellipse",x:o*.42,y:-.02,rx:.3,ry:.2,rot:-o*.5,fill:i.eyeColor??r}),n.push(h(o*.42-o*.07,-.08,.07));break;case"calm":for(const o of $)n.push({k:"ellipse",x:o*.38,y:.02,rx:.085,ry:.12,fill:r}),n.push(h(o*.38+.03,-.02,.03));break;case"slit":n.push({k:"line",pts:[0,-.98,0,-.2],stroke:r,lw:e*.8,alpha:.5}),n.push({k:"rect",x:0,y:-.04,w:1.56,h:.26,r:.1,fill:Cs,stroke:r,lw:e*.8}),n.push({k:"rect",x:0,y:.3,w:.22,h:.46,r:.08,fill:Cs,stroke:r,lw:e*.8});for(const o of $){n.push({k:"ellipse",x:o*.4,y:-.04,rx:.12,ry:.07,fill:i.eyeColor??at});for(const f of[.36,.56])n.push({k:"circle",x:o*.42,y:f,r:.05,fill:r,alpha:.6})}break;case"goggle":for(const o of $)n.push({k:"circle",x:o*.9,y:0,r:.13,fill:s.accent,stroke:r,lw:e*.8});n.push({k:"rect",x:0,y:0,w:1.66,h:.62,r:.3,fill:Cs,stroke:r,lw:e*.8}),n.push({k:"path",d:"M-0.6 -0.16 Q-0.42 -0.24 -0.12 -0.24",stroke:at,lw:.07,alpha:.8});for(const o of $)n.push({k:"path",d:`M${o*.5} 0.04 Q${o*.34} -0.08 ${o*.16} 0.02`,stroke:i.eyeColor??"#7fd6ff",lw:.08});for(const o of[-.18,0,.18])n.push({k:"line",pts:[o,.56,o,.72],stroke:r,lw:e*.8,alpha:.6});break;case"visor":n.push({k:"ellipse",x:0,y:.08,rx:.8,ry:.64,fill:"#2a3f6b",stroke:r,lw:e*.8}),n.push({k:"path",d:"M-0.56 -0.14 Q-0.46 -0.4 -0.16 -0.46",stroke:at,lw:.08,alpha:.7});for(const o of $)n.push({k:"ellipse",x:o*.28,y:.04,rx:.1,ry:.14,fill:i.eyeColor??"#cfeeff"});break}return n}function Ir(t,e){const s=t.palette,i=t.face,n=[],r=i.eyes==="visor"?"#cfeeff":Si,a=e*1.05;switch(i.nose&&i.mouth!=="beak"&&(i.mouth==="cat"?n.push({k:"path",d:tt([{x:-.1,y:.22},{x:.1,y:.22},{x:0,y:.33}],.3),fill:i.nose,stroke:i.nose,lw:e*.6}):t.ears==="big-round"?n.push({k:"ellipse",x:0,y:.22,rx:.2,ry:.25,fill:i.nose}):n.push({k:"ellipse",x:0,y:.25,rx:.13,ry:.085,fill:i.nose})),i.mouth){case"smile":n.push({k:"path",d:i.eyes==="visor"?"M-0.16 0.32 Q0 0.46 0.16 0.32":"M-0.17 0.42 Q0 0.58 0.17 0.42",stroke:r,lw:a});break;case"open":n.push({k:"path",d:"M-0.21 0.4 Q0 0.46 0.21 0.4 Q0.19 0.68 0 0.68 Q-0.19 0.68 -0.21 0.4 Z",fill:r,stroke:r,lw:e*.5}),n.push({k:"ellipse",x:0,y:.6,rx:.1,ry:.06,fill:Sr});break;case"cat":n.push({k:"path",d:"M-0.19 0.4 Q-0.1 0.5 0 0.37 Q0.1 0.5 0.19 0.4",stroke:r,lw:a});break;case"beak":n.push({k:"path",d:tt([{x:-.17,y:.2},{x:.17,y:.2},{x:0,y:.48}],.25),fill:s.accent,stroke:s.outline,lw:e*.8});break;case"teeth":n.push({k:"path",d:"M-0.36 0.34 Q0 0.44 0.36 0.34 Q0.28 0.66 0 0.66 Q-0.28 0.66 -0.36 0.34 Z",fill:r,stroke:r,lw:e*.5});for(const l of $)n.push({k:"rect",x:l*.12,y:.43,w:.1,h:.1,r:.03,fill:at});break;case"grill":n.push({k:"rect",x:0,y:.56,w:.62,h:.2,r:.08,fill:"#24323d",stroke:s.outline,lw:e*.7});for(const l of[-.15,0,.15])n.push({k:"line",pts:[l,.51,l,.61],stroke:"#9fb0bd",lw:e*.6});break;case"tiny":n.push({k:"ellipse",x:0,y:.44,rx:.08,ry:.1,fill:r});break;case"smirk":n.push({k:"path",d:"M-0.16 0.46 Q0.06 0.54 0.22 0.38",stroke:r,lw:a});break;case"bill":n.push({k:"ellipse",x:0,y:.36,rx:.44,ry:.2,fill:s.accent,stroke:s.outline,lw:e*.8}),n.push({k:"path",d:"M-0.36 0.38 Q0 0.46 0.36 0.38",stroke:s.outline,lw:e*.7});for(const l of $)n.push({k:"circle",x:l*.1,y:.28,r:.03,fill:s.outline});break;case"hook":n.push({k:"ellipse",x:0,y:.48,rx:.16,ry:.11,fill:Si}),n.push({k:"path",d:"M-0.3 0.12 Q0 -0.02 0.3 0.12 Q0.36 0.52 0.04 0.76 Q0.08 0.52 -0.08 0.46 Q-0.28 0.38 -0.3 0.12 Z",fill:s.accent,stroke:s.outline,lw:e*.8});break;case"jaws":{n.push({k:"path",d:"M-0.5 0.3 Q0 0.5 0.5 0.3 Q0.38 0.72 0 0.72 Q-0.38 0.72 -0.5 0.3 Z",fill:r,stroke:r,lw:e*.5});for(const l of[-.34,-.17,0,.17,.34]){const h=.3+.4*(l+.5)*(.5-l)-.01;n.push({k:"path",d:tt(ut(l-.075,h,l+.075,h,l,h+.13),.15),fill:at})}break}}return n}var Se=(t,e)=>({x:Math.sin(t)*e,y:-Math.cos(t)*e}),Or=.5,qt={leftEye:2,rightEye:5,leftEar:7,rightEar:8},ce={"3-5":{head:.75,neck:.74,arm:.3,leg:.36,hand:.19,foot:1.2,shoulderMin:.4,shoulderPad:.07,hipMin:.5,hipPad:.22,bottom:.26,bulge:1.12,armsOverHead:!0},"6-8":{head:.6,neck:.78,arm:.22,leg:.28,hand:.15,foot:1,shoulderMin:.34,shoulderPad:.04,hipMin:.4,hipPad:.16,bottom:.14,bulge:1.04,armsOverHead:!1},"9-12":{head:.5,neck:.92,arm:.17,leg:.21,hand:.125,foot:.9,shoulderMin:.36,shoulderPad:.07,hipMin:.32,hipPad:.08,bottom:.1,bulge:1,armsOverHead:!1}},Ze="6-8",Ri=t=>t.band in ce?t.band:Ze,Ml=ce[Ze].head,zr=.3,Dr=.12,Ur=.9,Fi=.5,Pi=.65,Br=.35,Gr=.2,$r=.25,Dt=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),_t=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),ot=(t,e)=>({x:t.x*e,y:t.y*e}),ee=t=>Math.hypot(t.x,t.y),Li=(t,e)=>({x:(t.x+e.x)/2,y:(t.y+e.y)/2}),Rs=t=>{const e=ee(t);return e>1e-9?{x:t.x/e,y:t.y/e}:{x:0,y:1}},Hr=(...t)=>t.every(Number.isFinite),Xr=t=>Math.atan2(Math.sin(t),Math.cos(t)),qr=(t,e,s)=>Math.min(Math.max(t,e),s);function Ni(t,e,s=!1){return i=>{const n=t[i*3],r=t[i*3+1],a=t[i*3+2];return n===void 0||r===void 0||a===void 0||!Hr(n,r,a)?{x:0,y:0,ok:!1}:{x:e.x+(s?1-n:n)*e.w,y:e.y+r*e.h,ok:a>=Or}}}function Fs(t,e,s={}){const i=Ni(t,e,s.mirrored),n=i(V.leftShoulder),r=i(V.rightShoulder);if(!n.ok||!r.ok)return null;const a=i(V.leftHip),l=i(V.rightHip),h=Li(n,r),o=ee(Dt(r,n)),f=a.ok&&l.ok;let u=Rs(Dt(r,n));o<1e-6&&(u={x:1,y:0});let c,y,p;if(f){const C=Li(a,l);y=ee(Dt(C,h)),y>=o*$r?c=Rs(Dt(C,h)):(c={x:-u.y,y:u.x},c.y<0&&(c=ot(c,-1))),p=Math.max(y,o*1.15)}else c={x:-u.y,y:u.x},c.y<0&&(c=ot(c,-1)),p=o*1.15,y=p;p=Math.max(p,1e-6);const x={x:c.y,y:-c.x},m=Math.atan2(x.y,x.x),g=ot(c,-1),w=ce[s.band??Ze]??ce[Ze],E=w.head*p;let k=_t(h,ot(g,E*w.neck));const A=i(V.nose);if(A.ok){const C=_t(A,ot(g,E*.15)),R=ot(Dt(C,k),Br),O=Math.min(1,E*Gr/Math.max(ee(R),1e-6));k=_t(k,ot(R,O))}return{S:h,r:x,d:c,U:p,L:y,hipsOk:f,head:k,headR:E,headRot:m+Wr(t,i,m,p),angle:m}}function Wr(t,e,s,i){const n=[[qt.leftEar,qt.rightEar],[qt.leftEye,qt.rightEye]];for(const[r,a]of n){const l=e(r),h=e(a);if(!l.ok||!h.ok||!(t[r*3+2]>=Pi&&t[a*3+2]>=Pi)||ee(Dt(h,l))<i*.05)continue;const o=Xr(Math.atan2(h.y-l.y,h.x-l.x)-s),f=Math.max(Math.abs(o)-Dr,0),u=qr((Ur+Fi-Math.abs(o))/Fi,0,1);return Math.sign(o)*Math.min(f,zr)*u}return 0}function Ii(t,e,s,i={}){const n=Ri(e),r=ce[n],a=Fs(t,s,{...i,band:n});if(!a)return[];const l=Ni(t,s,i.mirrored),h=e.palette,{S:o,r:f,d:u,U:c,L:y}=a,p=v=>e.bodyExtras.includes(v),x=Math.max(1.2,c*.045),m={stroke:h.outline,lw:x},g=(v,L)=>({x:o.x+f.x*v+u.x*L,y:o.y+f.y*v+u.y*L}),w=v=>v.map(([L,D])=>g(L,D)),E=l(V.leftShoulder),k=l(V.rightShoulder),A=l(V.leftHip),C=l(V.rightHip),R=ee(Dt(k,E)),O=a.hipsOk?ee(Dt(C,A)):R*.7,P=Math.max(R/2+r.shoulderPad*c,r.shoulderMin*c),I=Math.max(O/2+r.hipPad*c,r.hipMin*c),X=-.1*c,Y=y+r.bottom*c,B=[],Ct=[],q=[],et=[],pt=[],Rt=(v,L,D,W)=>{const G=L.flatMap(nt=>[nt.x,nt.y]);v.push({k:"line",pts:G,stroke:h.outline,lw:D+x*2}),v.push({k:"line",pts:G,stroke:W,lw:D})},di=r.leg*c,bt=r.arm*c,Ft=Math.max(r.arm/.22,.9);if(a.hipsOk)for(const[v,L,D,W]of[[A,V.leftKnee,V.leftAnkle,-1],[C,V.rightKnee,V.rightAnkle,1]]){const G=l(L),nt=l(D);if(!G.ok)continue;const ke=_t(v,ot(u,-.12*c)),Ht=nt.ok?[ke,G,nt]:[ke,G];Rt(Ct,Ht,di,h.limbs),p("joints")&&Ct.push({k:"circle",x:G.x,y:G.y,r:.15*c*Ft,fill:h.accent,...m}),nt.ok&&Ct.push(jr(e,nt,a,W,x,r.foot))}for(const[v,L,D,W]of[[E,V.leftElbow,V.leftWrist,-1],[k,V.rightElbow,V.rightWrist,1]]){const G=l(L),nt=l(D);if(p("pauldrons")){const zt=_t(v,ot(u,.02*c));et.push({k:"ellipse",x:zt.x,y:zt.y,rx:.25*c,ry:.17*c,rot:a.angle+W*.25,fill:h.body,...m});const Xt=_t(zt,ot(u,.05*c));et.push({k:"ellipse",x:Xt.x,y:Xt.y,rx:.17*c,ry:.07*c,rot:a.angle+W*.25,fill:h.belly})}if(!G.ok)continue;const Ht=r.armsOverHead&&(G.x-o.x)*u.x+(G.y-o.y)*u.y<-.25*c?pt:et,$e=_t(v,ot(u,.04*c));if(Rt(Ht,nt.ok?[$e,G,nt]:[$e,G],bt,h.limbs),p("joints")&&Ht.push({k:"circle",x:G.x,y:G.y,r:.13*c*Ft,fill:h.accent,...m}),!nt.ok)continue;const Ot=Rs(Dt(nt,G)),ve=_t(nt,ot(Ot,.05*c));if(p("feathers"))for(const zt of[-.55,0,.55]){const Xt=Math.cos(zt),Me=Math.sin(zt)*W,He={x:Ot.x*Xt-Ot.y*Me,y:Ot.x*Me+Ot.y*Xt},ae=_t(ve,ot(He,.16*c));Ht.push({k:"ellipse",x:ae.x,y:ae.y,rx:.2*c,ry:.09*c,rot:Math.atan2(He.y,He.x),fill:h.hands??h.accent,...m})}Ht.push({k:"circle",x:ve.x,y:ve.y,r:r.hand*c,fill:h.hands??h.limbs,...m})}if(p("wings"))for(const v of[-1,1]){const L=w([[v*P*.5,.05*c],[v*(P+.85*c),-.6*c],[v*(P+.72*c),.05*c],[v*(P+.45*c),-.02*c],[v*(P+.3*c),.32*c],[v*P*.6,.55*c]]);B.push({k:"path",d:tt(L,.18),fill:h.accent,...m})}if(p("cape")){const v=y+.8*c,L=I+.36*c,D=w([[-P*.92,X+.04*c],[P*.92,X+.04*c],[P+.16*c,y*.5],[L,v],[L*.5,v-.1*c],[0,v],[-L*.5,v-.1*c],[-L,v],[-P-.16*c,y*.5]]);B.push({k:"path",d:Z(D,.6),fill:h.accent,...m})}if(p("backpack")){const v=g(0,.35*c);B.push({k:"rect",x:v.x,y:v.y,w:P*2+.34*c,h:.8*c,r:.16*c,rot:a.angle,fill:e.extraColors?.[0]??h.limbs,...m})}if(p("tank")){const v=g(P*.95,.24*c),L=e.extraColors?.[0]??h.accent,D=g(P*.95,-.3*c);B.push({k:"rect",x:D.x,y:D.y,w:.14*c,h:.16*c,r:.04*c,rot:a.angle,fill:h.outline}),B.push({k:"rect",x:v.x,y:v.y,w:.34*c,h:1*c,r:.17*c,rot:a.angle,fill:L,...m})}if(a.hipsOk&&!i.portrait&&B.push(...Vr(e,a,I,x)),p("tentacles")&&a.hipsOk)for(const v of[-1,1]){const L=w([[v*I*.7,y*.9],[v*(I+.22*c),y+.3*c],[v*(I+.48*c),y+.22*c],[v*(I+.5*c),y-.02*c],[v*(I+.34*c),y-.06*c]]);B.push({k:"path",d:Te(L),stroke:h.outline,lw:.2*c+x*2}),B.push({k:"path",d:Te(L),stroke:h.limbs,lw:.2*c})}const wt=Math.max(P,I)*r.bulge;if(p("wool")){for(const[L,D]of[[P*.7,X+.02*c],[wt,y*.3],[wt*1.02,y*.62],[(wt+I)/2,y*.92],[I*.55,Y]])for(const W of[-1,1]){const G=g(W*L,D);q.push({k:"circle",x:G.x,y:G.y,r:.2*c,fill:h.body,...m})}const v=g(0,Y+.02*c);q.push({k:"circle",x:v.x,y:v.y,r:.2*c,fill:h.body,...m})}if(p("robe")){const v=y+.58*c,L=I*1.4;q.push({k:"path",d:Z(w([[-P,X],[0,X-.04*c],[P,X],[wt,y*.55],[L,v],[0,v+.06*c],[-L,v],[-wt,y*.55]]),.7),fill:h.body,...m});const D=w([[-L*.94,v-.1*c],[0,v-.04*c],[L*.94,v-.1*c]]);q.push({k:"path",d:Te(D),stroke:e.extraColors?.[0]??h.accent,lw:.07*c})}else if(p("sheet")){const v=y+.78*c,L=I*1.3;q.push({k:"path",d:Z(w([[-P,X],[P,X],[wt,y*.55],[L,v],[L*.5,v-.2*c],[0,v],[-L*.5,v-.2*c],[-L,v],[-wt,y*.55]]),.9),fill:h.body,...m})}else q.push({k:"path",d:Z(w([[-P,X],[0,X-.04*c],[P,X],[wt,y*.55],[I,Y],[0,Y+.03*c],[-I,Y],[-wt,y*.55]]),.85),fill:h.body,...m});const ht=Math.min(P,I);if(p("pocket")){const v=g(0,y*.74);q.push({k:"rect",x:v.x,y:v.y,w:ht*1.3,h:.3*c,r:.1*c,rot:a.angle,fill:h.belly,stroke:h.outline,lw:x*.8})}else if(p("racing-stripe"))for(const v of[-.1,.1]){const L=g(v*c,X+.02*c),D=g(v*c,Y-.04*c);q.push({k:"line",pts:[L.x,L.y,D.x,D.y],stroke:h.belly,lw:.1*c})}else if(h.belly&&h.belly!==h.body&&!p("panel")&&!p("sheet")&&!p("stripes")){const v=g(0,y*.58);q.push({k:"ellipse",x:v.x,y:v.y,rx:ht*.64,ry:Math.max(y*.36,.2*c),rot:a.angle,fill:h.belly})}if(p("spots")){const v=e.extraColors?.[1]??h.belly;for(const[L,D,W]of[[-.55,.35,.09],[.5,.62,.11],[-.35,.86,.07]]){const G=g(L*ht,D*y);q.push({k:"circle",x:G.x,y:G.y,r:W*c,fill:v})}}if(p("stripes")){const v=e.extraColors?.[1]??h.accent;for(const L of[.22,.44,.66]){const D=g(-ht*.98,y*L),W=g(ht*.98,y*L);q.push({k:"line",pts:[D.x,D.y,W.x,W.y],stroke:v,lw:.1*c})}}if(p("straps")){const v=e.extraColors?.[1]??h.outline;for(const L of[-1,1]){const D=g(L*P*.62,X+.02*c),W=g(L*ht*.62,y*.72);q.push({k:"line",pts:[D.x,D.y,W.x,W.y],stroke:h.outline,lw:.13*c+x*2}),q.push({k:"line",pts:[D.x,D.y,W.x,W.y],stroke:v,lw:.13*c})}}if(p("belt")){const v=g(0,y*.9);q.push({k:"rect",x:v.x,y:v.y,w:I*1.92,h:.17*c,r:.06*c,rot:a.angle,fill:e.extraColors?.[2]??"#4a3426",...m}),q.push({k:"rect",x:v.x,y:v.y,w:.2*c,h:.19*c,r:.04*c,rot:a.angle,fill:"#ffd84a",...m})}if(p("emblem")){const v=g(0,y*.4),L=e.extraColors?.[0]??h.accent,D=tt([{x:-.22,y:-.2},{x:.22,y:-.2},{x:.22,y:.04},{x:0,y:.26},{x:-.22,y:.04}],.25);q.push({k:"group",x:v.x,y:v.y,rot:a.angle,s:c,items:[{k:"path",d:D,fill:L,stroke:h.outline,lw:x/c},{k:"group",x:0,y:.01,s:.12,items:[{k:"path",d:Ke,fill:L===h.accent?"#ffffff":h.accent}]}]})}if(p("panel")){const v=g(0,y*.5);q.push({k:"rect",x:v.x,y:v.y,w:ht*1.2,h:.38*c,r:.1*c,rot:a.angle,fill:"#24323d",...m}),(e.extraColors??["#ff7a6b","#fbd46a","#7ff0ff"]).slice(0,3).forEach((D,W)=>{const G=g((W-1)*ht*.34,y*.5);q.push({k:"circle",x:G.x,y:G.y,r:.075*c,fill:D})})}if(p("badge")){const v=g(-ht*.42,y*.36);q.push({k:"circle",x:v.x,y:v.y,r:.15*c,fill:h.accent,...m}),q.push({k:"group",x:v.x,y:v.y,rot:a.angle,s:.09*c,items:[{k:"path",d:Ke,fill:"#ffffff"}]})}if(p("star")){const v=g(-ht*.5,y*.3),L=.15*c;q.push({k:"group",x:v.x,y:v.y,rot:a.angle-.2,s:L,items:[{k:"path",d:Ke,fill:e.extraColors?.[0]??"#ffd84a",stroke:h.outline,lw:x*.8/L}]})}if(p("scarf")){const v=Math.max(.04,r.head*(1-r.neck)-.06)*c,L=g(0,v),D=e.extraColors?.[0]??h.accent,W=g(P*.45,v+.28*c);q.push({k:"rect",x:W.x,y:W.y,w:.16*c,h:.42*c,r:.06*c,rot:a.angle+.15,fill:D,...m}),q.push({k:"rect",x:L.x,y:L.y,w:P*2.05,h:.2*c,r:.1*c,rot:a.angle,fill:D,...m})}const Pt={k:"group",x:a.head.x,y:a.head.y,rot:a.headRot,s:a.headR,items:Qr(e,x/a.headR)};return[...B,...Ct,...q,...et,Pt,...pt]}var Oi=new WeakMap,Yr=64;function Qr(t,e){const s=Number(e.toPrecision(4));let i=Oi.get(t);i||Oi.set(t,i=new Map);let n=i.get(s);return n||(i.size>=Yr&&i.clear(),i.set(s,n=Ci(t,s))),n}function jr(t,e,s,i,n,r){const a=t.palette,{d:l,r:h}=s,o=s.U*r,f=_t(_t(e,ot(l,.07*o)),ot(h,i*.06*o)),u={stroke:a.outline,lw:n},c=a.feet??a.limbs;if(t.bodyExtras.includes("fins")){const y=tt([{x:-.13,y:-.06},{x:.13,y:-.06},{x:.24,y:.46},{x:-.24,y:.46}],.22);return{k:"group",x:f.x,y:f.y,rot:s.angle,s:o,items:[{k:"path",d:y,fill:c,stroke:a.outline,lw:n/o},{k:"line",pts:[0,.06,0,.38],stroke:a.outline,lw:n/o,alpha:.5}]}}return t.bodyExtras.includes("flippers")?{k:"ellipse",x:f.x,y:f.y,rx:.27*o,ry:.11*o,rot:s.angle,fill:c,...u}:t.bodyExtras.includes("boots")?{k:"rect",x:f.x,y:f.y,w:.4*o,h:.24*o,r:.09*o,rot:s.angle,fill:c,...u}:{k:"ellipse",x:f.x,y:f.y,rx:.2*o,ry:.13*o,rot:s.angle,fill:c,...u}}function Vr(t,e,s,i){const n=t.palette,{U:r,L:a,S:l,r:h,d:o}=e,f=(x,m)=>({x:l.x+h.x*x+o.x*m,y:l.y+h.y*x+o.y*m}),u=x=>x.map(([m,g])=>f(m,g)),c={stroke:n.outline,lw:i},y=(x,m,g)=>[{k:"path",d:Te(x),stroke:n.outline,lw:m+i*2},{k:"path",d:Te(x),stroke:g,lw:m}],p=[];switch(t.tail){case"none":break;case"fluffy":{const x=u([[s*.5,a*.95],[s+.28*r,a*1],[s+.72*r,a*.62],[s+.78*r,a*.12],[s+.52*r,a*.32],[s+.3*r,a*.6],[s*.6,a*.7]]);p.push({k:"path",d:Z(x),fill:n.body,...c});const m=f(s+.72*r,a*.2);p.push({k:"ellipse",x:m.x,y:m.y,rx:.13*r,ry:.2*r,rot:e.angle+.25,fill:n.belly,...c});break}case"brush":{const x=u([[s*.4,a*.98],[s+.42*r,a*1.06],[s+.98*r,a*.66],[s+1.06*r,a*.12],[s+.86*r,-.04*r],[s+.66*r,a*.36],[s+.3*r,a*.66],[s*.5,a*.68]]);p.push({k:"path",d:Z(x),fill:n.body,...c});const m=u([[s+1.03*r,a*.36],[s+1.06*r,a*.12],[s+.86*r,-.04*r],[s+.72*r,a*.24],[s+.86*r,a*.34]]);p.push({k:"path",d:Z(m),fill:n.belly,...c});break}case"pom":{const x=f(s+.06*r,a*.88);p.push({k:"circle",x:x.x,y:x.y,r:.2*r,fill:n.belly,...c});break}case"long":case"striped":case"tuft":{const x=u([[s*.6,a*.9],[s+.35*r,a*.85],[s+.58*r,a*.4],[s+.5*r,-.02*r]]);if(p.push(...y(x,.14*r,n.body)),t.tail==="tuft"){const m=x[x.length-1];p.push({k:"circle",x:m.x,y:m.y,r:.16*r,fill:t.extraColors?.[0]??n.accent,...c})}if(t.tail==="striped"){for(const g of[.35,.6,.85]){const w=f(s+.35*r+.22999999999999998*r*(g*1.4>1?1:g*1.4),a*(.85-.85*g));p.push({k:"line",pts:[w.x-h.x*.08*r,w.y-h.y*.08*r,w.x+h.x*.08*r,w.y+h.y*.08*r],stroke:t.extraColors?.[0]??n.outline,lw:.06*r})}const m=x[x.length-1];p.push({k:"circle",x:m.x,y:m.y,r:.07*r,fill:t.extraColors?.[0]??n.outline})}break}case"curl":{const x=u([[s*.6,a*.9],[s+.4*r,a*.88],[s+.62*r,a*.45],[s+.5*r,a*.12],[s+.3*r,a*.24],[s+.36*r,a*.42]]);p.push(...y(x,.12*r,n.limbs));break}case"fish":{const x=u([[s*.6,a*.9],[s+.36*r,a*.86],[s+.6*r,a*.5]]);p.push(...y(x,.17*r,n.body));const m=x[x.length-1],g=tt([{x:0,y:.06},{x:-.26,y:-.34},{x:.02,y:-.12},{x:.32,y:-.3}],.2);p.push({k:"group",x:m.x,y:m.y,rot:e.angle+.35,s:r,items:[{k:"path",d:g,fill:n.body,stroke:n.outline,lw:i/r}]});break}case"plume":{const x=t.extraColors??[n.accent];[0,1,2].forEach(m=>{const g=f(s+(.12+m*.13)*r,a+(.32-m*.06)*r);p.push({k:"ellipse",x:g.x,y:g.y,rx:.11*r,ry:.44*r,rot:e.angle-.55+m*.28,fill:x[(m+1)%x.length],...c})});break}case"spiky":case"arrow":{const x=u([[s*.3,a*.55],[s+.35*r,a*.68],[s+.95*r,a*.86],[s+.35*r,a*1.08],[s*.3,a*1.08]]);if(t.tail==="spiky"){for(const m of[.15,.45,.72]){const g=s+(.2+m*.7)*r,w=a*(.66+m*.19);p.push({k:"path",d:tt(u([[g-.12*r,w+.05*r],[g,w-.2*r],[g+.12*r,w+.07*r]]),.2),fill:n.accent,...c})}p.push({k:"path",d:Z(x,.7),fill:n.body,...c})}else{const m=u([[s*.6,a*.9],[s+.4*r,a*.92],[s+.62*r,a*.5],[s+.62*r,a*.18]]);p.push(...y(m,.13*r,n.body));const g=m[m.length-1];p.push({k:"group",x:g.x,y:g.y,rot:e.angle,s:r,items:[{k:"path",d:tt([{x:-.15,y:.04},{x:0,y:-.22},{x:.15,y:.04}],.2),fill:n.accent,stroke:n.outline,lw:i/r}]})}break}}return p}var Kr={nose:[0,-.62],leftShoulder:[-.42,0],rightShoulder:[.42,0],leftElbow:[-.58,.5],rightElbow:[.58,.5],leftWrist:[-.66,.98],rightWrist:[.66,.98],leftHip:[-.27,1],rightHip:[.27,1],leftKnee:[-.31,1.6],rightKnee:[.31,1.6],leftAnkle:[-.33,2.18],rightAnkle:[.33,2.18]};function Zr(t,{cx:e=.5,cy:s=.36,T:i=.18}={}){const n={...Kr,...t},r=new Array(vi*3).fill(0),a=(o,[f,u],c=.99)=>{r[o*3]=e+f*i,r[o*3+1]=s+u*i,r[o*3+2]=c};for(const o of Object.keys(V))a(V[o],n[o]);const l=n.tilt??0,h=(o,f)=>[n.nose[0]+o*Math.cos(l)-f*Math.sin(l),n.nose[1]+o*Math.sin(l)+f*Math.cos(l)];return a(qt.leftEye,h(-.1,-.08)),a(qt.rightEye,h(.1,-.08)),a(qt.leftEar,h(-.22,-.02)),a(qt.rightEar,h(.22,-.02)),r}var Jr=()=>Zr({}),zi=.5,ta=.15,ea=class{constructor(t={}){d(this,"tracks",new Map),d(this,"offset",NaN),d(this,"lastArrival",NaN),d(this,"interval",33),d(this,"lastT",NaN),d(this,"lostMs"),d(this,"maxExtrapolateMs"),this.lostMs=t.lostMs??250,this.maxExtrapolateMs=t.maxExtrapolateMs??25}get delayMs(){return this.interval}push(t,e,s,i=Di()){Number.isFinite(e)||(e=i),this.clock(e,i);const n=this.tracks.get(t);if(!n||e-n.tb>this.lostMs||e<n.tb-this.lostMs||s.length!==n.b.length){this.tracks.set(t,{a:null,ta:e,b:s,tb:e,out:null,outAt:NaN});return}if(s===n.b||e<=n.tb){e===n.tb&&s!==n.b&&(n.b=s,n.out=null);return}n.a=n.b,n.ta=n.tb,n.b=s,n.tb=e,n.out=null}at(t,e=Di()){const s=this.tracks.get(t);if(!s)return null;if(!s.a)return s.b;if(s.out&&s.outAt===e)return s.out;const i=e-this.offset-this.interval,n=s.tb-s.ta,r=Math.min(n*.5,this.maxExtrapolateMs),a=Math.min(Math.max((i-s.ta)/n,0),1+r/n);return s.out=sa(s.a,s.b,a),s.outAt=e,s.out}forget(t){this.tracks.delete(t)}clear(){this.tracks.clear()}clock(t,e){const s=e-t;if(!Number.isFinite(this.offset)||s<this.offset||s>this.offset+1e3?this.offset=s:Number.isFinite(this.lastArrival)&&(this.offset+=Math.min(s-this.offset,(e-this.lastArrival)/1e3)),this.lastArrival=e,Number.isFinite(this.lastT)&&t>this.lastT){const i=t-this.lastT;i<this.interval*3+20&&(this.interval+=(Math.min(Math.max(i,8),100)-this.interval)*.1)}t<=this.lastT||(this.lastT=t)}},Di=()=>globalThis.performance?.now()??Date.now();function sa(t,e,s){const i=e.slice(),n=s<.5?t:e;for(let r=0;r+2<e.length;r+=3){const a=t[r],l=t[r+1],h=e[r],o=e[r+1];t[r+2]>=zi&&e[r+2]>=zi&&Math.abs(h-a)+Math.abs(o-l)<ta?(i[r]=a+(h-a)*s,i[r+1]=l+(o-l)*s,i[r+2]=t[r+2]+(e[r+2]-t[r+2])*Math.min(s,1)):(i[r]=n[r],i[r+1]=n[r+1],i[r+2]=n[r+2])}return i}var El=_i.map(t=>t.id),Je=new Map(_i.map(t=>[t.id,t])),Ce=Je.get("fox"),ia=t=>typeof t=="string"&&Je.has(t),ts=t=>Je.get(t),na=t=>typeof t=="string"?Je.get(t)??Ce:t;function ra(t,e){const s=na(t),i=Jr(),n=Ri(s),r=Fs(i,{x:0,y:0,w:1,h:1},{band:n}),a=-Ui(Ci(s,.05)).minY,h=Math.min(.27,.43/Math.max(a,1))*e/ce[n].head/r.U,o=.5*e+Math.min(0,(a-1.6)*.06*e),f={x:e/2-r.head.x*h,y:o-r.head.y*h,w:h,h};return Ii(i,s,f,{portrait:!0})}function aa(t,e,s=.5){if(!t||t.length!==e.length)return e.slice();const i=e.slice();for(let n=0;n+2<e.length;n+=3){const r=t[n+2],a=e[n+2],l=r>=.5,h=a>=.5;l&&a>=.3&&(i[n+2]=Math.max(a,.5)),l&&h&&Math.hypot(e[n]-t[n],e[n+1]-t[n+1])<.15?(i[n]=t[n]+(e[n]-t[n])*s,i[n+1]=t[n+1]+(e[n+1]-t[n+1])*s):l&&!h&&i[n+2]>=.5&&(i[n]=t[n],i[n+1]=t[n+1])}return ha(t,e,i,s*oa),i}var oa=.35,la=11;function ha(t,e,s,i){const n=V.leftShoulder*3,r=V.rightShoulder*3,a=(u,c)=>u[c+2]>=.5;if(!a(t,n)||!a(t,r)||!a(e,n)||!a(e,r))return;const l=(u,c)=>(u[n+c]+u[r+c])/2,h=[l(t,0),l(t,1)],o=[l(e,0),l(e,1)],f=[l(s,0),l(s,1)];for(let u=0;u<la&&u*3+2<e.length;u++){const c=u*3;if(!a(t,c)||!a(e,c))continue;const y=[t[c]-h[0],t[c+1]-h[1]],p=[e[c]-o[0],e[c+1]-o[1]];Math.hypot(p[0]-y[0],p[1]-y[1])>=.15||(s[c]=f[0]+y[0]+(p[0]-y[0])*i,s[c+1]=f[1]+y[1]+(p[1]-y[1])*i)}}function Ui(t){const e={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},s=(i,n)=>{e.minX=Math.min(e.minX,i),e.minY=Math.min(e.minY,n),e.maxX=Math.max(e.maxX,i),e.maxY=Math.max(e.maxY,n)};for(const i of t){const n="lw"in i&&i.stroke?(i.lw??1)/2:0;switch(i.k){case"circle":s(i.x-i.r-n,i.y-i.r-n),s(i.x+i.r+n,i.y+i.r+n);break;case"ellipse":case"rect":{const r=i.k==="ellipse"?i.rx:i.w/2,a=i.k==="ellipse"?i.ry:i.h/2,l=Math.max(r,a)+n;s(i.x-l,i.y-l),s(i.x+l,i.y+l);break}case"path":{const r=_r(i.d);for(let a=0;a+1<r.length;a+=2)s(r[a]-n,r[a+1]-n),s(r[a]+n,r[a+1]+n);break}case"line":for(let r=0;r+1<i.pts.length;r+=2)s(i.pts[r]-n,i.pts[r+1]-n),s(i.pts[r]+n,i.pts[r+1]+n);break;case"group":{const r=Ui(i.items);if(!Number.isFinite(r.minX))break;const a=i.s??1,l=Math.cos(i.rot??0),h=Math.sin(i.rot??0);for(const[o,f]of[[r.minX,r.minY],[r.maxX,r.minY],[r.minX,r.maxY],[r.maxX,r.maxY]])s(i.x+(o*l-f*h)*a,i.y+(o*h+f*l)*a);break}}}return e}var fe=()=>Float64Array.of(1,0,0,1,0,0);function Ut(t,e,s,i,n,r,a){const l=n?Math.cos(n):1,h=n?Math.sin(n):0,o=l*r,f=h*r,u=-h*a,c=l*a;if(!e)return t[0]=o,t[1]=f,t[2]=u,t[3]=c,t[4]=s,t[5]=i,t;const y=e[0],p=e[1],x=e[2],m=e[3];return t[0]=y*o+x*f,t[1]=p*o+m*f,t[2]=y*u+x*c,t[3]=p*u+m*c,t[4]=y*s+x*i+e[4],t[5]=p*s+m*i+e[5],t}function ca(t,e,s){const i=t[0]*t[3]-t[1]*t[2];if(Math.abs(i)<1e-12)return null;const n=e-t[4],r=s-t[5];return[(t[3]*n-t[2]*r)/i,(-t[1]*n+t[0]*r)/i]}var Bi={white:16777215,black:0,red:16711680,transparent:0},Re=new Map;function Lt(t){if(typeof t=="number")return[t&16777215,1];const e=Re.get(t);if(e)return e;let s=[16777215,1];const i=t.trim().toLowerCase();if(i[0]==="#"){const n=i.slice(1),r=n.length<=4?[...n].map(l=>l+l).join(""):n,a=parseInt(r.slice(0,6),16);Number.isFinite(a)&&(s=[a,r.length===8?parseInt(r.slice(6,8),16)/255:1])}else if(i.startsWith("rgb")){const n=i.match(/-?\d*\.?\d+%?/g)?.map(o=>o.endsWith("%")?parseFloat(o)/100*255:parseFloat(o))??[],[r=255,a=255,l=255]=n,h=n[3]===void 0?1:i.match(/,\s*[\d.]+%\s*\)$/)?n[3]/255:n[3];s=[(Ps(r)<<16|Ps(a)<<8|Ps(l))>>>0,Math.min(Math.max(h,0),1)]}else if(i in Bi)s=[Bi[i],i==="transparent"?0:1];else if(typeof document<"u"){const n=document.createElement("canvas").getContext("2d");if(n){n.fillStyle="#ffffff",n.fillStyle=i;const r=n.fillStyle;if(r!==i)return Re.set(t,s=Lt(r)),s}}return Re.size>512&&Re.clear(),Re.set(t,s),s}var Ps=t=>Math.min(Math.max(Math.round(t),0),255);function ue(t,e,s=!1){const i=Math.min(Math.max(e,0),1),n=(t>>16&255)*i,r=(t>>8&255)*i,a=(t&255)*i,l=s?0:i*255;return(Math.round(l)<<24|Math.round(a)<<16|Math.round(r)<<8|Math.round(n))>>>0}var Fe=(t,e=1)=>`rgba(${t>>16&255},${t>>8&255},${t&255},${e})`;function Gi(t,e){if(t===16777215)return e;if(e===16777215)return t;const s=i=>Math.round((t>>i&255)*(e>>i&255)/255);return(s(16)<<16|s(8)<<8|s(0))>>>0}var Pe={linear:t=>t,quadIn:t=>t*t,quadOut:t=>t*(2-t),quadInOut:t=>t<.5?2*t*t:-1+(4-2*t)*t,cubicOut:t=>1-(1-t)**3,sineInOut:t=>-(Math.cos(Math.PI*t)-1)/2,backOut:t=>1+(1.70158+1)*(t-1)**3+1.70158*(t-1)**2,elasticOut:t=>t===0||t===1?t:2**(-10*t)*Math.sin((t*10-.75)*(2*Math.PI/3))+1,bounceOut:t=>t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375};function fa(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let s=e;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}var Le=1,$i=2,es=0,Tt=1,ua=4294967295,_={cap:0,epoch:0,x:new Float64Array(0),y:new Float64Array(0),rot:new Float64Array(0),sx:new Float64Array(0),sy:new Float64Array(0),alpha:new Float64Array(0),la:new Float64Array(0),lb:new Float64Array(0),lc:new Float64Array(0),ld:new Float64Array(0),world:new Float64Array(0),tint:new Uint32Array(0),flags:new Uint8Array(0),moved:new Uint8Array(0),dirty:new Uint8Array(0),gen:new Uint32Array(0),parent:new Int32Array(0),first:new Int32Array(0),next:new Int32Array(0),prev:new Int32Array(0),stamp:new Uint32Array(0),pass:0,free:new Int32Array(0),freeHead:0,freeCount:0,top:2},Wt=[],da="x y rot sx sy alpha la lb lc ld world tint flags moved dirty gen parent first next prev stamp".split(" ");function Hi(t){const e=_;for(const i of da){const n=e[i],r=new n.constructor(i==="world"?t*6:t);r.set(n),e[i]=r}const s=new Int32Array(t);for(let i=0;i<_.freeCount;i++)s[i]=_.free[(_.freeHead+i)%_.cap];for(_.free=s,_.freeHead=0,_.cap=t,_.epoch++;Wt.length<t;)Wt.push(null)}function Ls(t){_.x[t]=_.y[t]=_.rot[t]=0,_.sx[t]=_.sy[t]=_.alpha[t]=1,_.la[t]=_.ld[t]=1,_.lb[t]=_.lc[t]=0;const e=t*6,s=_.world;s[e]=s[e+3]=1,s[e+1]=s[e+2]=s[e+4]=s[e+5]=0,_.tint[t]=16777215,_.flags[t]=Le|$i,_.moved[t]=1,_.dirty[t]=0,_.parent[t]=_.first[t]=_.next[t]=_.prev[t]=-1}Hi(256),Ls(es),_.flags[es]=0,Ls(Tt),_.flags[Tt]=0;function pa(){let t;if(_.freeCount){t=_.free[_.freeHead],_.freeHead=(_.freeHead+1)%_.cap,_.freeCount--;const e=Wt[t];e&&(e._i=es,e._g=-1,Wt[t]=null)}else _.top===_.cap&&Hi(_.cap*2),t=_.top++;return Ls(t),t}function Xi(t,e){Ns(t);for(let i=_.first[t];i>=0;){const n=_.next[i];_.parent[i]=_.next[i]=_.prev[i]=-1,i=n}_.first[t]=-1,_.flags[t]=_.flags[t]&~$i,_.moved[t]=0;const s=_.gen[t]+1;_.gen[t]=s,s!==ua&&(e&&(Wt[t]=e),_.free[(_.freeHead+_.freeCount)%_.cap]=t,_.freeCount++)}function ya(t){for(let e=0;e<Wt.length;e++){const s=Wt[e];s&&t(s)&&(s._i=es,s._g=-1,Wt[e]=null)}}function ma(t,e){Ns(t);const s=_.first[e];_.parent[t]=e,_.next[t]=s,_.prev[t]=-1,s>=0&&(_.prev[s]=t),_.first[e]=t,_.moved[t]=1}function Ns(t){const e=_.parent[t];if(e<0)return;const s=_.next[t],i=_.prev[t];i>=0?_.next[i]=s:_.first[e]=s,s>=0&&(_.prev[s]=i),_.parent[t]=_.next[t]=_.prev[t]=-1}var Ne={root:-1,gen:-1,world:new Float64Array(6)};function xa(t){const e=++_.pass,s=_.world,i=t*6,n=Ne.world;let r=Ne.root!==t||Ne.gen!==_.gen[t];for(let a=0;a<6;a++)n[a]!==s[i+a]&&(r=!0),n[a]=s[i+a];Ne.root=t,Ne.gen=_.gen[t],_.stamp[t]=r?e:e-1}function ga(t){_.stamp[t]=_.pass}function qi(t){for(let e=_.first[t];e>=0;){const s=_.next[e];qi(e),e=s}Xi(t)}var Is=typeof FinalizationRegistry=="function"?new FinalizationRegistry(t=>_.gen[t.i]===t.g&&qi(t.i)):null;function Wi(t){t._reg||!Is||(t._reg=!0,Is.register(t,{i:t._i,g:t._g},t))}function ba(t){t._reg&&Is.unregister(t)}var Os=1,zs=2,Ds=3,Us=4;function Bs(t){if(t){for(let e=0;e<t.length;e++)if(t[e].enabled)return!0}return!1}function wa(t,e){let s=0;for(let i=0;i<t.length;i++){const n=t[i];n.enabled&&n.pad&&(s+=n.pad(e))}return s}var Nt={gl:null,c2d:null,live:null},Q=new Float64Array(3),Gs=4,ka=1,$s=()=>ka++,it=fe(),F=_,se=class{constructor(t){d(this,"kernel",t),d(this,"_i",pa()),d(this,"_g",F.gen[this._i]),d(this,"_wv",null),d(this,"_wi",-1),d(this,"_we",-1),d(this,"blend","normal"),d(this,"_data",null),d(this,"parent",null),d(this,"hitRadius",null),d(this,"clip",null),d(this,"mask",null),d(this,"filters",null),d(this,"_z",0),d(this,"anchorX",0),d(this,"anchorY",0),d(this,"_pool",null),d(this,"_free",!1),d(this,"_reg",!1)}get x(){return F.x[this._i]}set x(t){const e=this._i||Tt;F.x[e]=t,F.moved[e]=1}get y(){return F.y[this._i]}set y(t){const e=this._i||Tt;F.y[e]=t,F.moved[e]=1}get rotation(){return F.rot[this._i]}set rotation(t){const e=this._i||Tt;F.rot[e]=t,F.dirty[e]=F.moved[e]=1}get scaleX(){return F.sx[this._i]}set scaleX(t){const e=this._i||Tt;F.sx[e]=t,F.dirty[e]=F.moved[e]=1}get scaleY(){return F.sy[this._i]}set scaleY(t){const e=this._i||Tt;F.sy[e]=t,F.dirty[e]=F.moved[e]=1}get alpha(){return F.alpha[this._i]}set alpha(t){const e=this._i||Tt;F.alpha[e]=t,F.moved[e]=1}get visible(){return(F.flags[this._i]&Le)!==0}set visible(t){const e=this._i||Tt;t?F.flags[e]=F.flags[e]|Le:F.flags[e]=F.flags[e]&~Le,F.moved[e]=1}get destroyed(){return F.gen[this._i]!==this._g}get world(){const t=this._i||Tt;return(this._wi!==t||this._we!==F.epoch)&&(this._wv=F.world.subarray(t*6,t*6+6),this._wi=t,this._we=F.epoch),this._wv}get data(){return this._data??(this._data={})}set data(t){this._data=t}get scale(){return this.scaleX}set scale(t){this.scaleX=this.scaleY=t}get z(){return this._z}set z(t){t!==this._z&&(this._z=t,this.parent&&(this.parent.sortDirty=!0))}get tint(){return F.tint[this._i]}set tint(t){F.tint[this._i||Tt]=typeof t=="number"?t&16777215:Lt(t)[0]}set anchor(t){typeof t=="number"?this.anchorX=this.anchorY=t:(this.anchorX=t.x,this.anchorY=t.y)}get width(){return 0}set width(t){}get height(){return 0}set height(t){}set(t){for(const e in t){const s=t[e];s!==void 0&&(this[e]=s)}return this}destroy(){this.destroyed||(this.visible=!1,this.parent&&(this.parent.dead=!0,this.parent=null),Xi(this._i,this),ba(this),this.kernel.tweens.stopAll(this),this._pool?.forget(this))}updateWorld(){const t=this.parent?this.parent.updateWorld():null;return Ut(this.world,t,this.x,this.y,this.rotation,this.scaleX,this.scaleY)}draw(t,e,s){}};function va(t){ya(e=>e.kernel===t)}var Hs=!1,Yi=Object.freeze([]),Xs=class rr extends se{constructor(e){super(e),d(this,"children",Yi),d(this,"sortDirty",!1),d(this,"dead",!1),Wi(this)}add(e,...s){this.adopt(e);for(let i=0;i<s.length;i++)this.adopt(s[i]);return e}adopt(e){e.parent&&e.parent.detach(e),e.parent=this,!e.destroyed&&!this.destroyed&&ma(e._i,this._i),this.children===Yi&&(this.children=[]),this.children.push(e),(e.z!==0||this.sortDirty)&&(this.sortDirty=!0)}remove(e){this.detach(e),e._pool||Wi(e)}detach(e){const s=this.children,i=s.indexOf(e);if(i>=0){for(let n=i+1;n<s.length;n++)s[n-1]=s[n];s.pop()}e.parent===this&&(e.parent=null,e.destroyed||Ns(e._i))}clear(){for(const e of this.children)e.destroy()}destroy(){for(const e of this.children)e.destroy();super.destroy()}sweep(){if(this.dead){this.dead=!1;let e=0;for(const s of this.children)s.destroyed?s.parent===this&&(s.parent=null):this.children[e++]=s;this.children.length=e}for(const e of this.children)e instanceof rr&&e.sweep()}draw(e,s,i){if(Hs)return F.parent[this._i]<0&&!this.destroyed&&ga(this._i),this.drawChildren(e,s,i);Hs=!0;try{this.destroyed||xa(this._i),this.drawChildren(e,s,i)}finally{Hs=!1}}drawChildren(e,s,i){if(this.sortDirty){const l=new Map(this.children.map((h,o)=>[h,o]));this.children.sort((h,o)=>h.z-o.z||l.get(h)-l.get(o)),this.sortDirty=!1}const n=this.children,r=this._i,a=F.stamp[r]===F.pass;for(let l=0;l<n.length;l++){const h=n[l],o=h._i,f=F.alpha[o];if(F.gen[o]!==h._g||!(F.flags[o]&Le)||f<=0)continue;if(a||F.moved[o]){F.moved[o]=0,F.stamp[o]=F.pass;let y,p,x,m;if(F.dirty[o]){F.dirty[o]=0;const I=F.rot[o],X=I?Math.cos(I):1,Y=I?Math.sin(I):0,B=F.sx[o],Ct=F.sy[o];F.la[o]=y=X*B,F.lb[o]=p=Y*B,F.lc[o]=x=-Y*Ct,F.ld[o]=m=X*Ct}else y=F.la[o],p=F.lb[o],x=F.lc[o],m=F.ld[o];const g=F.world,w=F.x[o],E=F.y[o],k=o*6,A=r*6,C=g[A],R=g[A+1],O=g[A+2],P=g[A+3];g[k]=C*y+O*p,g[k+1]=R*y+P*p,g[k+2]=C*x+O*m,g[k+3]=R*x+P*m,g[k+4]=C*w+O*E+g[A+4],g[k+5]=R*w+P*E+g[A+5]}const u=s*f,c=Gi(i,F.tint[o]);h.clip||h.mask||h.filters?ji(e,h,u,c):h.draw(e,u,c)}}},dt=new Float64Array(128),ie=0,qs=new Float64Array(8);function Qi(t,e,s,i){e.clip||e.mask||e.filters?ji(t,e,s,i):e.draw(t,s,i)}function ji(t,e,s,i){const n=t.r,r=e.world,a=e.clip;let l=!1,h=!1;if(a)if(Math.abs(r[1])<1e-9&&Math.abs(r[2])<1e-9&&ie<32){const u=r[0]*a.x+r[4],c=r[0]*(a.x+a.width)+r[4],y=r[3]*a.y+r[5],p=r[3]*(a.y+a.height)+r[5];let x=Math.min(u,c),m=Math.max(u,c),g=Math.min(y,p),w=Math.max(y,p);if(ie){const k=(ie-1)*4;x=Math.max(x,dt[k]),g=Math.max(g,dt[k+1]),m=Math.min(m,dt[k+2]),w=Math.min(w,dt[k+3])}const E=ie++*4;dt[E]=x,dt[E+1]=g,dt[E+2]=m,dt[E+3]=w,n.clip(x,g,Math.max(m-x,0),Math.max(w-g,0)),h=!0}else l=!0;const o=e.mask&&e.mask.visible?e.mask:null,f=Bs(e.filters)?e.filters:null;try{if(l&&n.beginLayer(),o&&n.beginLayer(),f?(e.draw(t,n.beginLayer()?1:s,i),n.endLayer(s,f)):e.draw(t,s,i),o&&(n.beginMask(),Ut(o.world,r,o.x,o.y,o.rotation,o.scaleX,o.scaleY),Qi(t,o,o.alpha,16777215),n.endLayer(1)),l&&a){n.beginMask();for(let u=0;u<4;u++){const c=u===1||u===2?a.x+a.width:a.x,y=u>1?a.y+a.height:a.y;qs[u*2]=r[0]*c+r[2]*y+r[4],qs[u*2+1]=r[1]*c+r[3]*y+r[5]}n.polygon(qs,4,16777215,1),n.endLayer(1)}}finally{if(h)if(ie--,ie){const u=(ie-1)*4;n.clip(dt[u],dt[u+1],dt[u+2]-dt[u],dt[u+3]-dt[u+1])}else n.unclip()}}var de=class extends se{constructor(t,e,s){super(t),d(this,"_frame",null),d(this,"_w",null),d(this,"_h",null),d(this,"slice",0),d(this,"autoAnchor",!0),d(this,"frameName",null),e&&(this.frame=e),s?.anchor===void 0&&this.useFrameAnchor(),s&&this.set(s)}get frame(){return this._frame}set frame(t){this.frameName=typeof t=="string"?t:null,this._frame=typeof t=="string"?this.kernel.frame(t):t,this.autoAnchor&&this.useFrameAnchor()}set anchor(t){this.autoAnchor=!1,super.anchor=t}get naturalWidth(){const t=this.frameNow();return t?(t.sw??t.w)/t.scale-t.margin*2:0}get naturalHeight(){const t=this.frameNow();return t?(t.sh??t.h)/t.scale-t.margin*2:0}get width(){return this._w??this.naturalWidth}set width(t){this._w=t}get height(){return this._h??this.naturalHeight}set height(t){this._h=t}sizeQ(t){me[0]=this._w??(t.sw??t.w)/t.scale-t.margin*2,me[1]=this._h??(t.sh??t.h)/t.scale-t.margin*2}frameNow(){return this.frameName&&!this.kernel.atlas.valid(this._frame)&&(this._frame=this.kernel.frame(this.frameName)),this._frame}useFrameAnchor(){const t=this._frame;if(!t)return;const e=(t.sw??t.w)/t.scale-t.margin*2,s=(t.sh??t.h)/t.scale-t.margin*2;this.anchorX=e>0?(t.ox-t.margin)/e:0,this.anchorY=s>0?(t.oy-t.margin)/s:0}draw(t,e,s){const i=this.frameNow();if(!i)return;const n=me;this.sizeQ(i),n[2]=this.anchorX,n[3]=this.anchorY,n[4]=e,Ma(t,i,this.world,this.slice,s,this.blend)}},pe=new Float64Array(12),ye=new Float64Array(12),Ie={x:0,y:0,w:0,h:0};function Vi(t,e,s,i,n,r){e=Math.max(e,0),s=Math.max(s,0),i=Math.max(i,0);const a=s+i>n?s*n/(s+i):s,l=s+i>n?i*n/(s+i):i;let h=a/r,o=l/r;if(h+o>e){const f=e/(h+o);h*=f,o*=f}t[0]=0,t[1]=h,t[2]=0,t[3]=a,t[4]=h,t[5]=e-h-o,t[6]=a,t[7]=n-a-l,t[8]=e-o,t[9]=o,t[10]=n-l,t[11]=l}var me=new Float64Array(5);function Ma(t,e,s,i,n,r){const a=me,l=a[0],h=a[1],o=a[2],f=a[3],u=a[4],c=t.tex(e.surface),y=i===0?e.slice??0:i;if(y===0){const k=(e.sw??e.w)/e.scale-e.margin*2,A=(e.sh??e.h)/e.scale-e.margin*2,C=k>0?l/k:1,R=A>0?h/A:1,O=-o*l+((e.tx??0)/e.scale-e.margin)*C,P=-f*h+((e.ty??0)/e.scale-e.margin)*R;ss(s,O,P),Q[0]=e.w/e.scale*C,Q[1]=e.h/e.scale*R,Q[2]=u,t.r.quadQ(c,e,it,n,r);return}const p=e.tx??0,x=e.ty??0,m=(e.sw??e.w)-e.w-p,g=(e.sh??e.h)-e.h-x,w=-o*l-e.margin+p/e.scale,E=-f*h-e.margin+x/e.scale;if(Vi(pe,l+e.margin*2-(p+m)/e.scale,(typeof y=="number"?y:y[3])-p,(typeof y=="number"?y:y[1])-m,e.w,e.scale),Vi(ye,h+e.margin*2-(x+g)/e.scale,(typeof y=="number"?y:y[0])-x,(typeof y=="number"?y:y[2])-g,e.h,e.scale),ss(s,w,E),Q[2]=u,!t.r.nineQ?.(c,e,pe,ye,it,n,r))for(let k=0;k<12;k+=4){const A=ye[k+1],C=ye[k+3];if(!(A<=0||C<=0))for(let R=0;R<12;R+=4){const O=pe[R+1],P=pe[R+3];O<=0||P<=0||(Ie.x=e.x+pe[R+2],Ie.y=e.y+ye[k+2],Ie.w=P,Ie.h=C,ss(s,w+pe[R],E+ye[k]),Q[0]=O,Q[1]=A,Q[2]=u,t.r.quadQ(c,Ie,it,n,r))}}}function ss(t,e,s){it[0]=t[0],it[1]=t[1],it[2]=t[2],it[3]=t[3],it[4]=t[0]*e+t[2]*s+t[4],it[5]=t[1]*e+t[3]*s+t[5]}var Oe=class extends de{constructor(t,e,s={}){super(t,null),d(this,"_spec"),d(this,"baked",null),d(this,"bakedEffects",!0),this._spec=e,this.bake(),s.anchor===void 0&&this.useFrameAnchor(),this.set(s)}get spec(){return this._spec}set spec(t){this._spec=t,this.baked=null,this._w=this._h=null,this.bake()}bake(){const t=this.kernel;return this.baked&&t.atlas.valid(this.baked.frame)&&this.baked.frame.scale===t.pixelScale&&this.bakedEffects===t.effects?this.baked:(this.bakedEffects=t.effects,this.baked=t.shape(this._spec),this._frame=this.baked.frame,this.slice=this.baked.slice,this.baked)}frameNow(){return this.bake().frame}sizeQ(){const t=this.bake();me[0]=this._w??t.w,me[1]=this._h??t.h}get width(){return this._w??this.bake().w}set width(t){this._w=t}get height(){return this._h??this.bake().h}set height(t){this._h=t}},Ki=(t,e,s)=>t===void 0?e:typeof t=="number"?t:t[0]+(t[1]-t[0])*s(),Zi=class Ye extends se{constructor(e,s,i={}){super(e),d(this,"max"),d(this,"f"),d(this,"tints"),d(this,"count",0),d(this,"gravity"),d(this,"drag"),d(this,"frameRef"),d(this,"random",Math.random),this.frameRef=s,this.max=Math.max(1,Math.floor(i.max??200)),this.f=new Float32Array(this.max*Ye.W),this.tints=new Uint32Array(this.max),this.blend=i.blend??"normal",this.gravity=i.gravity??0,this.drag=i.drag??1}get alive(){return this.count}burst(e,s,i,n={}){const r=Ye.W,a=this.random,l=n.tint===void 0?16777215:Lt(n.tint)[0];for(let h=0;h<i;h++){let o=this.count;if(o>=this.max){let x=0,m=1/0;for(let g=0;g<this.max;g++){const w=this.f[g*r+5]-this.f[g*r+4];w<m&&(m=w,x=g)}o=x}else this.count++;const f=(n.angle??0)+(n.spread===void 0?a()*Math.PI*2:(a()-.5)*n.spread),u=Ki(n.speed,200,a),c=Array.isArray(n.scale)?n.scale[0]:n.scale??1,y=Array.isArray(n.scale)?n.scale[1]:n.scale??1,p=o*r;this.f[p]=e,this.f[p+1]=s,this.f[p+2]=Math.cos(f)*u,this.f[p+3]=Math.sin(f)*u,this.f[p+4]=0,this.f[p+5]=Math.max(Ki(n.life,.8,a),.01),this.f[p+6]=a()*Math.PI*2,this.f[p+7]=(a()-.5)*2*(n.spin??0),this.f[p+8]=c,this.f[p+9]=y,this.f[p+10]=n.alpha??1,this.tints[o]=l}}update(e){const s=Ye.W,i=this.f,n=this.drag>=1?1:Math.pow(Math.max(this.drag,0),e);for(let r=0;r<this.count;){const a=r*s;if(i[a+4]=i[a+4]+e,i[a+4]>=i[a+5]){const l=--this.count;r!==l&&(i.copyWithin(a,l*s,l*s+s),this.tints[r]=this.tints[l]);continue}i[a+3]=(i[a+3]+this.gravity*e)*n,i[a+2]=i[a+2]*n,i[a]=i[a]+i[a+2]*e,i[a+1]=i[a+1]+i[a+3]*e,i[a+6]=i[a+6]+i[a+7]*e,r++}}clear(){this.count=0}draw(e,s,i){if(!this.count)return;const n=typeof this.frameRef=="string"?this.frameRef=this.kernel.frame(this.frameRef):this.frameRef,r=Ye.W,a=this.f,l=this.world,h=n.w/n.scale,o=n.h/n.scale;for(let f=0;f<this.count;f++){const u=f*r,c=a[u+4]/a[u+5],y=a[u+8]+(a[u+9]-a[u+8])*c,p=s*a[u+10]*(1-c*c),x=a[u+6],m=Math.cos(x)*y,g=Math.sin(x)*y,w=a[u],E=a[u+1],k=l[0],A=l[1],C=l[2],R=l[3],O=k*m+C*g,P=A*m+R*g,I=C*m-k*g,X=R*m-A*g;it[0]=O,it[1]=P,it[2]=I,it[3]=X,it[4]=k*w+C*E+l[4]-(O*h+I*o)/2,it[5]=A*w+R*E+l[5]-(P*h+X*o)/2,Q[0]=h,Q[1]=o,Q[2]=p,e.r.quadQ(e.tex(n.surface),n,it,Gi(i,this.tints[f]),this.blend)}}};d(Zi,"W",11);var Ji=Zi,ne=class extends de{constructor(t,e,s={}){const{fps:i,loop:n,playing:r,speed:a,onComplete:l,...h}=s;if(!e.frames.length)throw new Error("[engine] an animation needs at least one frame");super(t,e.frames[0],h),d(this,"frames"),d(this,"durations"),d(this,"fps"),d(this,"loop"),d(this,"speed"),d(this,"onComplete"),d(this,"_playing"),d(this,"index",0),d(this,"t",0),this.frames=e.frames,this.durations=e.durations&&i===void 0?e.durations:null,this.fps=i??12,this.loop=n!==!1,this.speed=a??1,this.onComplete=l??null,this._playing=r!==!1,this.speed<0&&this.show(e.frames.length-1)}get frameIndex(){return this.index}get frameCount(){return this.frames.length}get playing(){return this._playing}play(){return!this.loop&&!this._playing&&this.index===(this.speed<0?0:this.frames.length-1)&&this.show(this.speed<0?this.frames.length-1:0),this._playing=!0,this}stop(){return this._playing=!1,this}gotoFrame(t){const e=this.frames.length;return this.show((Math.floor(t)%e+e)%e),this.t=0,this}gotoAndPlay(t){return this._playing=!0,this.gotoFrame(t)}gotoAndStop(t){return this._playing=!1,this.gotoFrame(t)}show(t){t===this.index&&this._frame||(this.index=t,this.frame=this.frames[t])}secondsOf(t){const e=this.durations?.[t];return e!==void 0&&e>0?e:1/Math.max(this.fps,.001)}update(t){if(!this._playing||this.destroyed||this.speed===0)return;const e=this.frames.length,s=this.speed<0;this.t+=t*Math.abs(this.speed);let i=this.index;for(let n=0;n<1e3;n++){const r=this.secondsOf(i);if(this.t<r)break;this.t-=r;const a=s?i-1:i+1;if(a<0||a>=e){if(!this.loop){this.t=0,this._playing=!1,this.show(i),this.onComplete?.();return}i=s?e-1:0}else i=a}this.show(i)}},Ea=(t,e)=>t.localeCompare(e,void 0,{numeric:!0}),tn=class{constructor(t,e,s=2){d(this,"width",t),d(this,"height",e),d(this,"padding",s),d(this,"shelves",[]),d(this,"free",[]),d(this,"bottom",0)}alloc(t,e){const s=Math.ceil(t)+this.padding*2,i=Math.ceil(e)+this.padding*2;if(s>this.width||i>this.height)return null;for(let a=0;a<this.free.length;a++){const l=this.free[a];if(l.w>=s&&l.h>=i&&l.w*l.h<=s*i*2)return this.free.splice(a,1),this.inner(l.x,l.y,t,e)}let n=null;for(const a of this.shelves)a.h>=i&&a.h<=i*1.5+8&&this.width-a.x>=s&&(!n||a.h<n.h)&&(n=a);if(!n)if(this.bottom+i>this.height){for(const a of this.shelves)a.h>=i&&this.width-a.x>=s&&(n=a);if(!n)return null}else n={y:this.bottom,h:i,x:0},this.shelves.push(n),this.bottom+=i;const r=n.x;return n.x+=s,this.inner(r,n.y,t,e)}release(t){this.free.push({x:t.x-this.padding,y:t.y-this.padding,w:Math.ceil(t.w)+this.padding*2,h:Math.ceil(t.h)+this.padding*2})}get fill(){return this.bottom/this.height}reset(){this.shelves=[],this.free=[],this.bottom=0}inner(t,e,s,i){return{x:t+this.padding,y:e+this.padding,w:s,h:i}}},is=t=>({source:t,texture:null,pending:[]}),Ws=class{constructor(t=2048,e=4){d(this,"pageSize",t),d(this,"maxPages",e),d(this,"pages",[]),d(this,"gen",1),d(this,"onPage",()=>{}),d(this,"onDrop",()=>{})}valid(t){return!!t&&(t.gen===this.gen||t.gen===0)}bake(t,e,s,i=1,n=0,r=0,a=0){const l=Math.max(1,Math.ceil(t)),h=Math.max(1,Math.ceil(e)),o=document.createElement("canvas");o.width=l,o.height=h;const f=o.getContext("2d");return s(f),this.put(o,l,h,i,n,r,a)}add(t,e=1,s=0,i=0){const n=document.createElement("canvas");return n.width=Math.max(1,t.width),n.height=Math.max(1,t.height),n.getContext("2d").drawImage(t,0,0),this.put(n,n.width,n.height,e,s,i,0)}release(t){if(t.gen!==this.gen)return;this.pages.find(s=>s.surface===t.surface)?.packer.release(t)}rebake(t,e,s,i,n=t.w,r=t.h){if(!this.valid(t)||e>n||s>r)return null;const a=Math.max(1,Math.ceil(e)),l=Math.max(1,Math.ceil(s)),h=this.pages.find(f=>f.surface===t.surface);if(!h)return null;const o=document.createElement("canvas");return o.width=Math.ceil(n),o.height=Math.ceil(r),i(o.getContext("2d")),h.ctx.clearRect(t.x,t.y,o.width,o.height),h.ctx.drawImage(o,t.x,t.y),t.surface.pending.push([o,t.x,t.y]),t.w=a,t.h=l,t}put(t,e,s,i,n,r,a){let l=null,h=this.pages.find(f=>(l=f.packer.alloc(e,s))!==null);if(h||(!(Math.max(e,s)+4>this.pageSize)&&this.pages.length>=this.maxPages&&(this.wipe(),h=this.pages[0],l=h?h.packer.alloc(e,s):null),(!h||!l)&&(h=this.newPage(Math.max(e,s)),l=h.packer.alloc(e,s))),!l)throw new Error(`[engine] ${e}\xD7${s} does not fit an atlas page`);const o=l;return h.ctx.drawImage(t,o.x,o.y),h.surface.pending.push([t,o.x,o.y]),{surface:h.surface,x:o.x,y:o.y,w:e,h:s,scale:i,gen:this.gen,ox:n,oy:r,margin:a}}newPage(t){let e=this.pageSize;for(;e<t+4;)e*=2;const s=document.createElement("canvas");s.width=s.height=e;const i=s.getContext("2d"),n=is(s),r={surface:n,packer:new tn(e,e),ctx:i};return this.pages.push(r),this.onPage(n),r}wipe(){this.gen++;let t=0;for(let e=0;e<this.pages.length;e++){const s=this.pages[e];if(t<this.maxPages&&s.surface.source.width===this.pageSize){this.pages[t++]=s;continue}s.surface.pending=[],this.onDrop(s.surface)}this.pages.length=t;for(const e of this.pages)e.packer.reset(),e.ctx.clearRect(0,0,e.surface.source.width,e.surface.source.height),e.surface.pending=[],e.surface.pending.push([e.surface.source,0,0])}},Aa=()=>{const t=typeof document<"u"?document.timeline?.currentTime:null;return typeof t=="number"&&Number.isFinite(t)?t:globalThis.performance?.now()??Date.now()},en=()=>globalThis.performance?.now()??Date.now(),sn=class{constructor(t=Aa){d(this,"now",t),d(this,"known",new Map),d(this,"smoothed",new Map),d(this,"times",new WeakMap),d(this,"lerp",new ea),d(this,"drawnAt",NaN),d(this,"drawn",0),d(this,"smoothedBody",(e,s={})=>{const i=s.interpolate!==!1;if(typeof e=="number"){const n=this.smoothed.get(e);return n?i?this.lerp.at(e,this.tick())??n.body:n.body:null}return typeof e!="object"||e===null||!Array.isArray(e.body)?null:this.posed(e.id,e.body,_a(s.smooth),i)})}note(t,e,s=en()){for(const i of t)this.known.set(i.id,this.resolve(i.id,i.avatar)),e!==void 0&&Number.isFinite(e)&&Array.isArray(i.body)&&this.times.set(i.body,{t:e,arrival:s})}of(t){return typeof t=="object"&&t!==null?t.avatar!==void 0?this.resolve(t.id,t.avatar):this.of(t.id):this.known.get(t)??Ei(t-1)}posed(t,e,s,i=!0){const n=this.smooth(t,e,s);return i?this.lerp.at(t,this.tick())??n:n}smooth(t,e,s){const i=this.smoothed.get(t);if(i&&i.raw===e&&i.amount===s)return i.body;i&&i.amount!==s&&this.lerp.forget(t);const n=s<1?aa(i?.body,e,s):e;this.smoothed.set(t,{raw:e,body:n,amount:s});const r=this.times.get(e),a=r?.arrival??en();return this.lerp.push(t,r?.t??a,n,a),n}takeDrawn(){const t=this.drawn;return this.drawn=0,t}tick(){const t=this.now();return t!==this.drawnAt&&(this.drawnAt=t,this.drawn++),t}resolve(t,e){return ia(e)?e:Ei(t-1)}},_a=t=>t===!1?1:typeof t=="number"?Math.min(Math.max(t,.05),1):.5,nn=new Float64Array(1),rn=new Int32Array(nn.buffer),xe=(t,e)=>(t=Math.imul(t^e,1540483477),t^t>>>15);function Yt(t,e=2538058380){return t!==t?xe(e,2146959360):(nn[0]=t===0?0:t,xe(xe(e,rn[0]),rn[1]))}function an(t,e=2166136261){for(let s=0;s<t.length;s++)e=Math.imul(e^t.charCodeAt(s),16777619);return e}function Qt(t){switch(typeof t){case"number":return Yt(t);case"string":return an(t);case"boolean":return t?1013904242:461845907;case"object":{if(t===null)return 625341585;if(Array.isArray(t)||t instanceof Float64Array){let i=1779033703^t.length;for(let n=0;n<t.length;n++){const r=t[n];i=xe(i,typeof r=="number"?Yt(r):Qt(r))}return i}let e=1359893119;const s=t;for(const i in s){const n=s[i];n!==void 0&&(e=e+xe(an(i),Qt(n))|0)}return xe(e,2600822924)}default:return 0}}function ze(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null)return typeof t=="number"&&typeof e=="number"&&t!==t&&e!==e;const s=Array.isArray(t)||t instanceof Float64Array;if(s!==(Array.isArray(e)||e instanceof Float64Array))return!1;if(s){const r=t,a=e;if(r.length!==a.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==a[l]&&!ze(r[l],a[l]))return!1;return!0}const i=t,n=e;for(const r in i)if(i[r]!==void 0&&!ze(i[r],n[r]))return!1;for(const r in n)if(n[r]!==void 0&&i[r]===void 0)return!1;return!0}function ns(t){if(typeof t!="object"||t===null)return t;if(Array.isArray(t))return t.map(ns);if(t instanceof Float64Array)return t.slice();const e={};for(const s in t)t[s]!==void 0&&(e[s]=ns(t[s]));return e}var on=class{constructor(t=1/0){d(this,"max",t),d(this,"buckets",new Map),d(this,"n",0)}get size(){return this.n}get(t,e=Qt(t)){const s=this.buckets.get(e);if(s){for(let i=0;i<s.length;i++)if(ze(s[i].key,t))return s[i].value}}set(t,e,s=Qt(t)){let i=this.buckets.get(s);if(i){for(const n of i)if(ze(n.key,t)){n.value=e;return}}this.n>=this.max&&this.clear(),(!i||!this.buckets.has(s))&&this.buckets.set(s,i=[]),i.push({key:ns(t),value:e}),this.n++}clear(){this.buckets.clear(),this.n=0}},Ys=0,ln=1,rs=2,Qs=3,hn=class{constructor(){d(this,"scale",1),d(this,"cOn",!1),d(this,"px0",0),d(this,"py0",0),d(this,"px1",0),d(this,"py1",0),d(this,"clipVer",0),d(this,"stack",[]),d(this,"sp",0),d(this,"real",0),d(this,"mute",0),d(this,"bnd",new Float64Array(4*(Gs+1))),d(this,"rx0",0),d(this,"ry0",0),d(this,"rx1",0),d(this,"ry1",0),d(this,"maxBlur",1/0),d(this,"time",0),d(this,"skipped",0),d(this,"gq",new Float64Array(4))}resetLayers(t){this.scale=t,this.sp=this.real=this.mute=0,this.skipped=0,this.cOn=!1,this.clipVer++}growQ(){const t=this.gq;this.grow(t[0],t[1],t[2],t[3])}grow(t,e,s,i){if(!this.real)return;const n=this.bnd,r=(this.real-1)*4;t<n[r]&&(n[r]=t),e<n[r+1]&&(n[r+1]=e),s>n[r+2]&&(n[r+2]=s),i>n[r+3]&&(n[r+3]=i)}area(t,e){const s=this.bnd,i=t*4,n=this.scale;return this.rx0=Math.max(Math.floor((s[i]-e)*n)-1,0),this.ry0=Math.max(Math.floor((s[i+1]-e)*n)-1,0),this.rx1=Math.min(Math.ceil((s[i+2]+e)*n)+1,this.canvas.width),this.ry1=Math.min(Math.ceil((s[i+3]+e)*n)+1,this.canvas.height),this.rx1>this.rx0&&this.ry1>this.ry0}clip(t,e,s,i){const n=this.scale,r=this.canvas.width,a=this.canvas.height,l=Math.min(Math.max(Math.round(t*n),0),r),h=Math.min(Math.max(Math.round(e*n),0),a),o=Math.min(Math.max(Math.round((t+s)*n),l),r),f=Math.min(Math.max(Math.round((e+i)*n),h),a);this.cOn&&l===this.px0&&h===this.py0&&o===this.px1&&f===this.py1||(this.cOn=!0,this.px0=l,this.py0=h,this.px1=o,this.py1=f,this.clipVer++)}unclip(){this.cOn&&(this.cOn=!1,this.clipVer++)}push(t){if(t<rs&&(this.mute||this.real>=Gs||!this.pushLayer())&&(t+=2),t===Qs)this.mute++;else if(t!==rs){const e=this.real*4;this.bnd[e]=this.bnd[e+1]=1/0,this.bnd[e+2]=this.bnd[e+3]=-1/0,this.real++}return this.stack[this.sp++]=t,t<rs}beginLayer(){return this.push(Ys)}beginMask(){this.push(this.sp&&this.stack[this.sp-1]===Ys?ln:Qs)}endLayer(t,e){if(!this.sp)return;let s=this.stack[--this.sp];if(s===Qs){if(this.mute--,!this.sp)return;s=this.stack[--this.sp]}if(s===ln){const i=--this.real,n=this.popLayer();this.area(i-1,0)&&this.composite(n,!0,1,null);const r=this.bnd,a=(i-1)*4,l=i*4;r[a]=Math.max(r[a],r[l]),r[a+1]=Math.max(r[a+1],r[l+1]),r[a+2]=Math.min(r[a+2],r[l+2]),r[a+3]=Math.min(r[a+3],r[l+3]),s=this.stack[--this.sp]}if(s===rs)Bs(e)&&(this.skipped+=e.length);else if(s===Ys){const i=--this.real,n=Bs(e)?e:null,r=this.popLayer();if(this.area(i,n?wa(n,this.maxBlur):0)){this.composite(r,!1,t,n);const a=this.scale;this.grow(this.rx0/a,this.ry0/a,this.rx1/a,this.ry1/a)}}}closeLayers(){for(;this.sp;)this.endLayer(1)}},Ta=256,cn=8<<20,mt=new Float64Array(32),xt={x:0,y:0,w:0,h:0};function Sa(t){if(typeof t.filter!="string")return!1;t.filter="blur(1px)";const e=t.filter==="blur(1px)";return t.filter="none",e}function js(t){const e=t.getContext("2d",{alpha:!0});return e?new Ca(t,e):null}var Ca=class extends hn{constructor(t,e){super(),d(this,"canvas",t),d(this,"ctx",e),d(this,"kind","canvas2d"),d(this,"maxTextureSize",4096),d(this,"features",{}),d(this,"info",{renderer:"canvas2d"}),d(this,"support"),d(this,"lost",!1),d(this,"fxr",null),d(this,"quads",0),d(this,"stats",{drawCalls:0,quads:0,filtersSkipped:0}),d(this,"tinted",new Map),d(this,"tintedN",0),d(this,"lostListeners",[]),d(this,"restoredListeners",[]),d(this,"base"),d(this,"top"),d(this,"layers",[]),d(this,"scratch",[]),d(this,"nines",new Map),d(this,"ninePx",0),d(this,"frame",0),d(this,"hit",!1),d(this,"missed",new Map),this.support={filters:Sa(e),shaders:!1},this.base=this.top={ctx:e,clipped:!1,ver:0},t.addEventListener("contextlost",()=>{this.lost=!0,this.lostListeners.forEach(s=>s())}),t.addEventListener("contextrestored",()=>{this.lost=!1,this.tinted.clear(),this.tintedN=0,this.dropNines(),this.restoredListeners.forEach(s=>s())})}resize(t,e){this.canvas.width!==t&&(this.canvas.width=t),this.canvas.height!==e&&(this.canvas.height=e)}createTexture(t){return{id:$s(),width:t.width,height:t.height,source:t}}updateTexture(t,e,s=0,i=0){const n=e?s+e.width:1/0,r=e?i+e.height:1/0;for(const a of this.nines.values()){const l=a.key;l[0]===t.id&&l[1]<n&&l[1]+l[3]>s&&l[2]<r&&l[2]+l[4]>i&&this.dropNine(a)}for(const[a,l]of this.tinted){const h=l.filter(o=>o.id!==t.id);this.tintedN-=l.length-h.length,h.length?this.tinted.set(a,h):this.tinted.delete(a)}}destroyTexture(t){this.updateTexture(t)}begin(t,e,s){this.resetLayers(s),this.fxr?.tick(),this.frame++,this.quads=0,this.top=this.base,this.ctx=this.base.ctx;const i=this.ctx;this.base.clipped&&i.restore(),this.base.clipped=!1,this.base.ver=this.clipVer,i.setTransform(1,0,0,1,0,0),i.globalAlpha=1,i.globalCompositeOperation="source-over",i.clearRect(0,0,this.canvas.width,this.canvas.height),e>0&&(i.fillStyle=Fe(t,e),i.fillRect(0,0,this.canvas.width,this.canvas.height))}quad(t,e,s,i,n,r,a,l){Q[0]=i,Q[1]=n,Q[2]=a,this.quadQ(t,e,s,r,l)}quadQ(t,e,s,i,n){e.w<=0||e.h<=0||(i===16777215?this.blit(t.source,e.x,e.y,e.w,e.h,s,n):this.blit(this.tint(t,e,i),0,0,e.w,e.h,s,n))}blit(t,e,s,i,n,r,a){const l=Q[0],h=Q[1],o=Q[2];if(o<=0||this.mute)return;this.sync();const f=this.ctx,u=this.scale;if(this.real){const c=r[0]*l,y=r[1]*l,p=r[2]*h,x=r[3]*h;this.grow(r[4]+Math.min(0,c,p,c+p),r[5]+Math.min(0,y,x,y+x),r[4]+Math.max(0,c,p,c+p),r[5]+Math.max(0,y,x,y+x))}f.setTransform(r[0]*u,r[1]*u,r[2]*u,r[3]*u,r[4]*u,r[5]*u),f.globalAlpha=Math.min(o,1),a==="add"&&(f.globalCompositeOperation="lighter"),f.drawImage(t,e,s,i,n,0,0,l,h),a==="add"&&(f.globalCompositeOperation="source-over"),this.quads++}nineQ(t,e,s,i,n,r,a){var l,h;const o=s[8]+s[9],f=i[8]+i[9],u=Math.ceil(o*Math.hypot(n[0],n[1])*this.scale-1e-6),c=Math.ceil(f*Math.hypot(n[2],n[3])*this.scale-1e-6);if(n[1]===0&&n[2]===0||u>4096||c>4096)return!1;if(!(u>0&&c>0&&Q[2]>0)||this.mute)return!0;let y=this.kept(t,e,s,i,u,c,r);const p=(y??(y=(l=this.scratch)[h=13*Math.ceil(Math.log2(u))+Math.ceil(Math.log2(c))]??(l[h]=document.createElement("canvas").getContext("2d")))).canvas;if(p.width<u&&(p.width=u),p.height<c&&(p.height=c),!this.hit){y.clearRect(0,0,u+2,c+2);for(let x=0;x<12;x+=4){const m=Math.round(i[x]*c/f),g=Math.round((i[x]+i[x+1])*c/f);for(let w=0;w<12;w+=4){const E=Math.round(s[w]*u/o),k=Math.round((s[w]+s[w+1])*u/o);xt.x=e.x+s[w+2],xt.y=e.y+i[x+2],xt.w=s[w+3],xt.h=i[x+3],!(k<=E||g<=m||xt.w<=0||xt.h<=0)&&(r===16777215?y.drawImage(t.source,xt.x,xt.y,xt.w,xt.h,E,m,k-E,g-m):y.drawImage(this.tint(t,xt,r),0,0,xt.w,xt.h,E,m,k-E,g-m))}}}return Q[0]=o,Q[1]=f,this.blit(p,0,0,u,c,n,a),!0}kept(t,e,s,i,n,r,a){mt[0]=t.id,mt[1]=e.x,mt[2]=e.y,mt[3]=e.w,mt[4]=e.h,mt[5]=n,mt[6]=r,mt[7]=a,mt.set(s,8),mt.set(i,20);const l=Qt(mt),h=this.nines.get(l);if(this.hit=!1,h)return ze(h.key,mt)?(h.used=this.frame,this.hit=!0,h.ctx):null;const o=this.missed,f=o.get(l);o.size>4096&&o.clear(),o.set(l,this.frame);const u=n*r;if(f!==this.frame-1||u>cn)return null;let c;for(;this.ninePx+u>cn;){let x;for(const w of this.nines.values())w.used<this.frame-1&&!(x&&x.used<=w.used)&&(x=w);if(!x)return null;const m=x.ctx.canvas,g=!c&&m.width>=n&&m.height>=r&&m.width*m.height<=2*u;this.dropNine(x,g),g&&(c=x.ctx)}const y=c??document.createElement("canvas").getContext("2d"),p=y.canvas;return c||(p.width=n,p.height=r),this.ninePx+=p.width*p.height,this.nines.set(l,{key:ns(mt),ctx:y,used:this.frame}),y}dropNine(t,e=!1){this.nines.delete(Qt(t.key));const s=t.ctx.canvas;this.ninePx-=s.width*s.height,e||(s.width=0)}dropNines(){for(const t of this.nines.values())this.dropNine(t)}tint(t,e,s){const i=Yt(s,Yt(e.h,Yt(e.w,Yt(e.y,Yt(e.x,Yt(t.id))))));let n=this.tinted.get(i);if(n)for(let l=0;l<n.length;l++){const h=n[l];if(h.id===t.id&&h.x===e.x&&h.y===e.y&&h.w===e.w&&h.h===e.h&&h.color===s)return h.canvas}this.tintedN>=Ta&&(this.tinted.clear(),this.tintedN=0,n=void 0);const r=document.createElement("canvas");r.width=Math.ceil(e.w),r.height=Math.ceil(e.h);const a=r.getContext("2d");return a.drawImage(t.source,e.x,e.y,e.w,e.h,0,0,e.w,e.h),a.globalCompositeOperation="multiply",a.fillStyle=Fe(s),a.fillRect(0,0,e.w,e.h),a.globalCompositeOperation="destination-in",a.drawImage(t.source,e.x,e.y,e.w,e.h,0,0,e.w,e.h),n||this.tinted.set(i,n=[]),n.push({id:t.id,x:e.x,y:e.y,w:e.w,h:e.h,color:s,canvas:r}),this.tintedN++,r}paint(t,e){this.sync();const s=this.ctx,i=this.scale;return s.setTransform(i,0,0,i,0,0),s.globalAlpha=Math.min(e,1),Fe(t)}ellipse(t,e,s,i,n,r,a){if(a<=0||s<=0||i<=0||this.mute)return;const l=Math.max(s,i);this.grow(t-l,e-l,t+l,e+l);const h=this.ctx;h.fillStyle=this.paint(r,a),h.beginPath(),h.ellipse(t,e,s,i,n,0,Math.PI*2),h.fill(),this.quads++}trace(t,e,s=0){if(this.real)for(let n=0;n<e;n++)this.grow(t[n*2]-s,t[n*2+1]-s,t[n*2]+s,t[n*2+1]+s);const i=this.ctx;i.beginPath(),i.moveTo(t[0],t[1]);for(let n=1;n<e;n++)i.lineTo(t[n*2],t[n*2+1])}polygon(t,e,s,i){if(i<=0||e<3||this.mute)return;const n=this.ctx;n.fillStyle=this.paint(s,i),this.trace(t,e),n.closePath(),n.fill(),this.quads++}stroke(t,e,s,i,n,r){if(n<=0||s<=0||e<1||this.mute)return;const a=this.ctx;a.strokeStyle=this.paint(i,n),a.lineWidth=s,a.lineCap="round",a.lineJoin="round",this.trace(t,e,s/2),e===1&&a.lineTo(t[0],t[1]),r&&a.closePath(),a.stroke(),this.quads++}sync(){const t=this.top;if(t.ver===this.clipVer)return;const e=t.ctx;t.clipped&&e.restore(),t.clipped=this.cOn,t.ver=this.clipVer,this.cOn&&(e.save(),e.setTransform(1,0,0,1,0,0),e.beginPath(),e.rect(this.px0,this.py0,this.px1-this.px0,this.py1-this.py0),e.clip())}pushLayer(){const t=this.canvas.width,e=this.canvas.height;let s=this.layers[this.real];if(!s||s.ctx.canvas.width!==t||s.ctx.canvas.height!==e){const n=document.createElement("canvas");n.width=t,n.height=e;const r=n.getContext("2d");if(!r)return!1;s=this.layers[this.real]={ctx:r,clipped:!1,ver:-1}}const i=s.ctx;return s.clipped&&i.restore(),s.clipped=!1,s.ver=-1,i.setTransform(1,0,0,1,0,0),i.globalAlpha=1,i.globalCompositeOperation="source-over",i.clearRect(0,0,t,e),this.top=s,this.ctx=i,!0}popLayer(){return this.top=this.real>0?this.layers[this.real-1]:this.base,this.ctx=this.top.ctx,this.layers[this.real].ctx.canvas}composite(t,e,s,i){let n=t,r="none";const a=i&&Nt.c2d?this.fxr??(this.fxr=Nt.c2d(this)):null;a&&(n=a.chain(t,i),r=a.css),this.sync();const l=this.ctx,h=this.rx0,o=this.ry0,f=this.rx1-h,u=this.ry1-o;l.setTransform(1,0,0,1,0,0),l.globalAlpha=Math.min(s,1),l.globalCompositeOperation=e?"destination-in":"source-over",r!=="none"&&(l.filter=r),l.drawImage(n,h,o,f,u,h,o,f,u),r!=="none"&&(l.filter="none"),l.globalCompositeOperation="source-over",this.quads++}end(){this.closeLayers();const t=this.stats;return t.drawCalls=t.quads=this.quads,t.filtersSkipped=this.skipped,t}onLost(t){this.lostListeners.push(t)}onRestored(t){this.restoredListeners.push(t)}destroy(){this.tinted.clear(),this.dropNines(),this.layers=[],this.scratch=[],this.fxr?.destroy(),this.fxr=null}},De=14,ge=6,fn=8192,Ra=class{constructor(t,e,s=fn){d(this,"instanced",t),d(this,"slots",e),d(this,"capacity",s),d(this,"f32"),d(this,"u32"),d(this,"quads",0),d(this,"textures"),d(this,"bound",0),this.textures=new Array(e).fill(null);const i=s*(t?De:ge*4),n=new ArrayBuffer(i*4);this.f32=new Float32Array(n),this.u32=new Uint32Array(n)}slot(t){const e=this.textures;for(let s=0;s<this.bound;s++)if(e[s]===t)return s;return this.bound>=this.slots?-1:(e[this.bound]=t,this.bound++)}has(t){for(let e=0;e<this.bound;e++)if(this.textures[e]===t)return!0;return!1}get full(){return this.quads>=this.capacity}get words(){return this.quads*(this.instanced?De:ge*4)}reset(){this.quads=0;for(let t=0;t<this.bound;t++)this.textures[t]=null;this.bound=0}push(t,e,s,i,n,r,a,l,h,o,f,u,c,y){const p=this.f32;if(this.instanced){let x=this.quads*De;p[x++]=t,p[x++]=e,p[x++]=s,p[x++]=i,p[x++]=n,p[x++]=r,p[x++]=a,p[x++]=l,p[x++]=h,p[x++]=o,p[x++]=f,p[x++]=u,this.u32[x++]=c,p[x]=y}else{const x=this.quads*ge*4;this.vertex(x,t,e,h,o,c,y),this.vertex(x+6,s,i,f,o,c,y),this.vertex(x+12,n,r,f,u,c,y),this.vertex(x+18,a,l,h,u,c,y)}this.quads++}pushQ(t,e){const s=this.f32;if(this.instanced){const i=this.quads*De;for(let n=0;n<12;n++)s[i+n]=t[n];this.u32[i+12]=t[12],s[i+13]=e}else{let i=this.quads*ge*4;const n=t[12];for(let r=0;r<4;r++,i+=ge)s[i]=t[r*2],s[i+1]=t[r*2+1],s[i+2]=r===1||r===2?t[10]:t[8],s[i+3]=r>=2?t[11]:t[9],this.u32[i+4]=n,s[i+5]=e}this.quads++}vertex(t,e,s,i,n,r,a){const l=this.f32;l[t]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,this.u32[t+4]=r,l[t+5]=a}};function Fa(t){const e=new Uint16Array(t*6);for(let s=0,i=0,n=0;s<t;s++,i+=6,n+=4)e[i]=n,e[i+1]=n+1,e[i+2]=n+2,e[i+3]=n,e[i+4]=n+2,e[i+5]=n+3;return e}var gt={M:0,L:1,Q:2,C:3,Z:4},un=[2,2,4,6,0],Pa={M:0,L:1,Q:2,C:3,Z:4};function Vs(t,e){if(t.length>=e)return t;const s=new Float64Array(Math.max(e,t.length*2,16));return s.set(t),s}var as=new Map;function La(t){if(typeof t!="string")return t;let e=as.get(t);if(e)return e;e=[];const s=t.match(/[MLQCZ]|-?\d*\.?\d+(?:e-?\d+)?/gi)??[];let i=-1;for(let n=0;n<s.length;){const r=s[n],a=Pa[r.toUpperCase()];if(a!==void 0){i=a,n++,a===gt.Z&&e.push(gt.Z);continue}if(i<0||i===gt.Z){n++;continue}const l=un[i];e.push(i);for(let h=0;h<l;h++)e.push(Number(s[n+h]??0));n+=l,i===gt.M&&(i=gt.L)}return as.size>256&&as.clear(),as.set(t,e),e}var jt={subs:[],count:0},Ks=null,Vt=null;function os(t,e){let s=Vt;s||(s=jt.subs[jt.count]??null,s||jt.subs.push(s={pts:new Float64Array(64),n:0,closed:!1}),s.n=0,s.closed=!1,jt.count++,Vt=s);const i=s.n*2;i+2>s.pts.length&&(s.pts=Vs(s.pts,i+2));const n=Ks;n?(s.pts[i]=n[0]*t+n[2]*e+n[4],s.pts[i+1]=n[1]*t+n[3]*e+n[5]):(s.pts[i]=t,s.pts[i+1]=e),s.n++}function Zs(t,e=null,s=1,i=6){const n=La(t);jt.count=0,Vt=null,Ks=e;let r=0,a=0,l=0,h=0;const o=s/i;for(let f=0;f<n.length;){const u=n[f++],c=n;if(u===gt.M)Vt=null,r=l=c[f],a=h=c[f+1],os(r,a);else if(u===gt.L)r=c[f],a=c[f+1],os(r,a);else if(u===gt.Q){const y=c[f],p=c[f+1],x=c[f+2],m=c[f+3],g=dn((Bt(y-r,p-a)+Bt(x-y,m-p))*o);for(let w=1;w<=g;w++){const E=w/g,k=1-E;os(k*k*r+2*k*E*y+E*E*x,k*k*a+2*k*E*p+E*E*m)}r=x,a=m}else if(u===gt.C){const y=c[f],p=c[f+1],x=c[f+2],m=c[f+3],g=c[f+4],w=c[f+5],E=dn((Bt(y-r,p-a)+Bt(x-y,m-p)+Bt(g-x,w-m))*o);for(let k=1;k<=E;k++){const A=k/E,C=1-A,R=C*C*C,O=3*C*C*A,P=3*C*A*A,I=A*A*A;os(R*r+O*y+P*x+I*g,R*a+O*p+P*m+I*w)}r=g,a=w}else if(u===gt.Z){Vt&&(Vt.closed=!0),Vt=null,r=l,a=h;continue}else break;f+=un[u]}Vt=null,Ks=null;for(let f=0;f<jt.count;f++){const u=jt.subs[f],c=u.n*2;u.closed&&u.n>=2&&Math.abs(u.pts[0]-u.pts[c-2])<1e-6&&Math.abs(u.pts[1]-u.pts[c-1])<1e-6&&u.n--}return jt}var Bt=(t,e)=>Math.sqrt(t*t+e*e),dn=t=>Math.min(Math.max(Math.ceil(t),2),24);function Na(t,e){let s=0;for(let i=0,n=e-1;i<e;n=i++)s+=(t[n*2]-t[i*2])*(t[n*2+1]+t[i*2+1]);return s}var ls=new Int32Array(64),hs=(t,e,s,i,n)=>((t[i*2]-t[s*2])*(t[n*2+1]-t[s*2+1])-(t[i*2+1]-t[s*2+1])*(t[n*2]-t[s*2]))*e;function Ia(t,e,s){if(e<3)return 0;ls.length<e&&(ls=new Int32Array(Math.max(e,ls.length*2)));const i=ls;let n=e,r=0;for(let o=0;o<e;o++)i[o]=o;const a=Na(t,e)>0?1:-1;let l=e*e+8,h=0;for(;n>3&&l-- >0;){const o=i[(h+n-1)%n],f=i[h%n],u=i[(h+1)%n];let c=hs(t,a,o,f,u)>0;if(c)for(let y=0;y<n;y++){const p=i[y];if(!(p===o||p===f||p===u)&&hs(t,a,o,f,p)>=0&&hs(t,a,f,u,p)>=0&&hs(t,a,u,o,p)>=0){c=!1;break}}c?(s[r++]=o,s[r++]=f,s[r++]=u,i.copyWithin(h%n,h%n+1,n),n--,h=Math.max(h-1,0)):h=(h+1)%n}if(n===3)s[r++]=i[0],s[r++]=i[1],s[r++]=i[2];else if(n>3)for(let o=1;o+1<n;o++)s[r++]=i[0],s[r++]=i[o],s[r++]=i[o+1];return r}var Oa=.85,cs=new Float64Array(64),pn=new Float64Array(64),yn=new Float64Array(64),mn=new Float64Array(64),xn=new Float64Array(64),gn=new Float64Array(64),bn=new Uint8Array(64),fs=new Float64Array(8);function za(t,e,s,i,n,r){const a=fs;if(cs.length<e){const m=Math.max(e,cs.length*2);cs=new Float64Array(m),pn=new Float64Array(m),yn=new Float64Array(m),mn=new Float64Array(m),xn=new Float64Array(m),gn=new Float64Array(m),bn=new Uint8Array(m)}const l=cs,h=pn;let o=0;for(let m=0;m<e;m++){const g=t[m*2],w=t[m*2+1];!Number.isFinite(g)||!Number.isFinite(w)||o&&Math.abs(l[o-1]-g)<.001&&Math.abs(h[o-1]-w)<.001||(l[o]=g,h[o]=w,o++)}if(i&&o>2&&Math.abs(l[0]-l[o-1])<.001&&Math.abs(h[0]-h[o-1])<.001&&o--,o===0)return;if(o===1)return a[0]=l[0],a[1]=h[0],r();const f=i?o:o-1,u=yn,c=mn;for(let m=0;m<f;m++){const g=(m+1)%o,w=l[g]-l[m],E=h[g]-h[m],k=Bt(w,E)||1;u[m]=-E/k,c[m]=w/k}const y=xn,p=gn,x=bn;for(let m=0;m<o;m++){const g=i?(m-1+f)%f:m-1,w=m<f?m:-1;if(x[m]=1,g<0||w<0||u[g]*u[w]+c[g]*c[w]<Oa)continue;let k=u[g]+u[w],A=c[g]+c[w];const C=Bt(k,A)||1;k/=C,A/=C;const R=s/Math.max(k*u[w]+A*c[w],.5);y[m]=k*R,p[m]=A*R,x[m]=0}for(let m=0;m<f;m++){const g=(m+1)%o,w=x[m]?u[m]*s:y[m],E=x[m]?c[m]*s:p[m],k=x[g]?u[m]*s:y[g],A=x[g]?c[m]*s:p[g];a[0]=l[m]+w,a[1]=h[m]+E,a[2]=l[g]+k,a[3]=h[g]+A,a[4]=l[g]-k,a[5]=h[g]-A,a[6]=l[m]-w,a[7]=h[m]-E,n()}for(let m=0;m<o;m++)x[m]&&(a[0]=l[m],a[1]=h[m],r())}function wn(t,e){let s=0,i=1/0;for(let n=0;n<e.length;n++){const r=Math.abs(Math.log(Math.max(t,.5)/e[n]));r<i&&(i=r,s=n)}return s}var Mt=256,Js=[{x:240,y:0,w:8,h:8,r:3},{x:224,y:0,w:16,h:16,r:7},{x:192,y:0,w:32,h:32,r:15},{x:128,y:0,w:64,h:64,r:31},{x:0,y:0,w:128,h:128,r:63}],ti=[4,8,16,32,64,128].map((t,e)=>({x:e*4,y:128,w:4,h:t,r:t/2-1})),Kt={x:248,y:248,w:8,h:8},Da=Js.map(t=>t.r*2),Ua=ti.map(t=>t.r*2),kn=(t,e)=>Math.min(Math.max(t+.5-e,0),1);function Ba(){const t=new Uint8ClampedArray(Mt*Mt*4),e=(s,i,n)=>{const r=(i*Mt+s)*4;t[r]=t[r+1]=t[r+2]=255,t[r+3]=Math.round(n*255)};for(const s of Js){const i=s.w/2;for(let n=0;n<s.h;n++)for(let r=0;r<s.w;r++)e(s.x+r,s.y+n,kn(s.r,Math.hypot(r+.5-i,n+.5-i)))}for(const s of ti){const i=s.h/2;for(let n=0;n<s.h;n++)for(let r=0;r<s.w;r++)e(s.x+r,s.y+n,kn(s.r,Math.abs(n+.5-i)))}for(let s=0;s<Kt.h;s++)for(let i=0;i<Kt.w;i++)e(Kt.x+i,Kt.y+s,1);return t}function Ga(){const t=document.createElement("canvas");return t.width=t.height=Mt,t.getContext("2d").putImageData(new ImageData(Ba(),Mt,Mt),0,0),t}var vn=8,ei=`
|
|
2
2
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
3
3
|
precision highp float;
|
|
4
4
|
#else
|