@fabi-play/sdk 0.0.0-stage → 0.1.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/LICENSE +76 -0
- package/README.md +51 -2
- package/dist/avatars.d.ts +256 -0
- package/dist/avatars.js +18 -0
- package/dist/chunks/chunk-QJPCNRFI.js +2112 -0
- package/dist/fabi-play.d.ts +680 -0
- package/dist/fabi-play.js +1 -0
- package/dist/fabi-play.schema.json +102 -0
- package/dist/fabi-play.umd.js +2612 -0
- package/dist/fabi-play.umd.min.js +1 -0
- package/dist/index.d.ts +767 -0
- package/dist/index.js +490 -0
- package/dist/integrity.json +12 -0
- package/package.json +68 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(()=>{var Ye=Object.defineProperty;var It=(n,e,t)=>e in n?Ye(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Lt=(n,e)=>{for(var t in e)Ye(n,t,{get:e[t],enumerable:!0})};var z=(n,e,t)=>It(n,typeof e!="symbol"?e+"":e,t);function We(n,e=window){let t=new Set,r=e.AudioContext;r&&(e.AudioContext=class extends r{constructor(...s){super(...s),t.add(this)}});let a=[],o=[];Promise.resolve(n).then(s=>{s.on("break-start",()=>{a=[...e.document.querySelectorAll("audio, video")].filter(u=>!u.paused),a.forEach(u=>u.pause()),o=[...t].filter(u=>u.state==="running"),o.forEach(u=>{u.suspend()})}),s.on("break-done",()=>{a.forEach(u=>{u.play().catch(()=>{})}),o.forEach(u=>{u.resume()}),a=[],o=[]})})}var $t={jump:"Space",squat:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",clap:"Enter"};function Xe(n){if(n.trim()==="default")return;let e={};for(let t of n.split(",")){let[r,a]=t.split(":").map(o=>o.trim());r&&a&&(e[r]=a)}return e}var Nt={Space:[" ",32],Enter:["Enter",13],Escape:["Escape",27],ShiftLeft:["Shift",16],ArrowLeft:["ArrowLeft",37],ArrowUp:["ArrowUp",38],ArrowRight:["ArrowRight",39],ArrowDown:["ArrowDown",40]};function Qe(n){let e=Nt[n];if(e)return{key:e[0],code:n,keyCode:e[1]};let t=/^Key([A-Z])$/.exec(n);if(t)return{key:t[1].toLowerCase(),code:n,keyCode:t[1].charCodeAt(0)};let r=/^Digit([0-9])$/.exec(n);if(r)return{key:r[1],code:n,keyCode:48+Number(r[1])};throw new Error(`Fabi Play: unknown key "${n}" (use Space, Enter, Arrow\u2026, KeyA\u2026, Digit0\u2026)`)}var Ft=(n=document)=>({dispatch(e,t){let r=new KeyboardEvent(e,{key:t.key,code:t.code,bubbles:!0,cancelable:!0});for(let a of["keyCode","which"])Object.defineProperty(r,a,{get:()=>t.keyCode});(n.activeElement??n.body??n).dispatchEvent(r)}}),je=80,Ht=800;function qe(n,e=$t,t={}){let r=t.player??1,a=t.target??Ft(),o=t.setTimeout??((d,m)=>setTimeout(d,m)),s=new Set,u=0,l=d=>{let m=e[d];!m||s.has(d)||(s.add(d),a.dispatch("keydown",Qe(m)))},p=d=>{let m=e[d];!m||!s.has(d)||(s.delete(d),a.dispatch("keyup",Qe(m)))},i=d=>{l(d),o(()=>p(d),je)},f=d=>{if(d.player!==r)return;let m={"lane-left":-1,"lane-center":0,"lane-right":1};switch(d.gesture){case"jump":l("jump"),o(()=>p("jump"),Ht);break;case"land":p("jump");break;case"squat":l("squat");break;case"stand":p("squat");break;case"clap":i("clap");break;default:{let h=m[d.gesture];if(h===void 0)break;let b=h>u?"right":"left";for(let w=0;w<Math.abs(h-u);w++)o(()=>i(b),w*(je*2));u=h}}},c=d=>{let m=d.players.find(h=>h.id===r);m&&(m.shape==="arms-up"?l("arms-up"):p("arms-up"))},x=[n.on("gesture",f),n.on("frame",c),n.on("break-start",()=>[...s].forEach(p))];return()=>{x.forEach(d=>d()),[...s].forEach(p)}}function _t(n=document){let e=n.createElement("div");e.setAttribute("aria-hidden","true"),e.style.cssText="position:fixed;left:0;top:0;width:56px;height:56px;margin:-28px 0 0 -28px;border-radius:50%;border:6px solid #FBE7B8;background:rgba(251,231,184,.25);pointer-events:none;z-index:2147483647;box-sizing:border-box;transition:transform 60ms linear",n.body.appendChild(e);let t=(r,a,...o)=>{let s=n.elementFromPoint(r,a)??n.body;for(let u of o){let l={bubbles:!0,cancelable:!0,clientX:r,clientY:a,pointerId:1,pointerType:"touch",isPrimary:!0};s.dispatchEvent(u.startsWith("pointer")?new PointerEvent(u,l):new MouseEvent(u,l))}};return{size:()=>({width:n.documentElement.clientWidth,height:n.documentElement.clientHeight}),move:(r,a)=>t(r,a,"pointermove","mousemove"),click:(r,a)=>t(r,a,"pointerdown","mousedown","pointerup","mouseup","click"),cursor:(r,a,o)=>{e.style.transform=`translate(${r}px, ${a}px) scale(${1-o*.35})`,e.style.borderColor=o>0?"#EE6A43":"#FBE7B8"}}}function Ze(n,e={}){let t=e.player??1,r=e.hand??"any",a=e.dwellMs??800,o=e.radius??.04,s=e.target??_t(),u=null,l=!1;return n.on("frame",p=>{let i=p.players.find(D=>D.id===t);if(!i)return;let c=r==="left"?i.leftHand:r==="right"?i.rightHand:((D,V)=>D&&V?D.y<V.y?D:V:D??V)(i.leftHand,i.rightHand);if(!c)return;let{width:x,height:d}=s.size(),m=c.x*x,h=c.y*d;s.move(m,h),(!u||Math.hypot(m-u.x,h-u.y)>o*Math.hypot(x,d))&&(u={x:m,y:h,t:p.t},l=!1);let w=l?0:Math.min((p.t-u.t)/a,1);w>=1&&(l=!0,s.click(u.x,u.y)),s.cursor(m,h,l?0:w)})}var P={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},Je=["3-5","6-8","9-12"],Vt=n=>Je.includes(n);var Gt=4;var et={"3-5":["bunny","bear","panda","penguin"],"6-8":["fox","lion","dragon","unicorn"],"9-12":["robot","astronaut","ninja","skater"]},Kt=et["6-8"],De=(n,e)=>{let t=Vt(e)?et[e]:Kt;return t[Number.isInteger(n)&&n>=0?n%t.length:0]};var Te="fabi-play",ae=n=>({ns:Te,...n});function Re(n){if(!ze(n))return;let{x:e,y:t,w:r,h:a}=n;return oe(e)&&oe(t)&&oe(r)&&oe(a)&&r>0&&a>0?{x:e,y:t,w:r,h:a}:void 0}var ge=(n,e)=>n?{x:n.x+e.x*n.w,y:n.y+e.y*n.h}:{x:e.x,y:e.y},tt=["high","medium","low"];function nt(n){if(!ze(n))return;let e={};return tt.includes(n.tier)&&(e.tier=n.tier),oe(n.hz)&&n.hz>=20&&n.hz<=240&&(e.hz=Math.round(n.hz)),e.tier||e.hz?e:void 0}function rt(n){let e={};return ze(n)&&(oe(n.fps)&&n.fps>=0&&n.fps<1e3&&(e.fps=n.fps),typeof n.renderer=="string"&&/^[a-z0-9-]{1,16}$/.test(n.renderer)&&(e.renderer=n.renderer),tt.includes(n.tier)&&(e.tier=n.tier)),e}var ze=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),oe=n=>typeof n=="number"&&Number.isFinite(n);var Ut=12,Yt=132,Qt=n=>Ut+n*Yt,Ln=Qt(Gt);var _="#4a382c",$="#2b2118",G="#1c1f2b",ot="#fbefe3",K="#f4897a",he="#3a2a22",Oe=[{id:"fox",name:{en:"Fox",it:"Volpe"},band:"6-8",palette:{body:"#ee6a43",limbs:"#ee6a43",belly:ot,accent:"#ffd9c2",outline:$,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"dot",mouth:"cat",nose:he,muzzle:"cheeks"},tail:"fluffy",headExtras:[],bodyExtras:[]},{id:"mascot",name:{en:"Fabi",it:"Fabi"},band:"all",special:!0,palette:{body:"#ee6a43",limbs:"#ee6a43",belly:ot,accent:"#5a3426",outline:$,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"bead",mouth:"open",nose:he,muzzle:"band",cheeks:K},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:_},head:"round",ears:"long",face:{eyes:"dot",mouth:"cat",nose:"#e0607e",muzzle:"none",cheeks:K},tail:"pom",headExtras:[],bodyExtras:[]},{id:"bear",name:{en:"Bear",it:"Orsetto"},band:"3-5",palette:{body:"#cf9f78",limbs:"#cf9f78",belly:"#f7e0bf",accent:"#f7e0bf",outline:_},head:"round",ears:"round",face:{eyes:"dot",mouth:"smile",nose:he,muzzle:"oval",cheeks:K},tail:"none",headExtras:[],bodyExtras:[]},{id:"cat",name:{en:"Cat",it:"Gattino"},band:"3-5",palette:{body:"#c8b6ee",limbs:"#c8b6ee",belly:"#f4eeff",accent:"#f7b3c8",outline:_,hands:"#f4eeff",feet:"#f4eeff"},head:"wide",ears:"pointy",face:{eyes:"big",eyeColor:"#3f9a5a",mouth:"cat",nose:"#f07a9a",muzzle:"none",cheeks:K},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:_,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:_,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:_},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:$},head:"round",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#8a4b2a",muzzle:"oval",cheeks:K},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:$,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:$},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:G,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:G,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:$},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:$,hands:"#f2c9a0",feet:"#f2c9a0"},head:"round",ears:"side",face:{eyes:"dot",mouth:"open",nose:"#5a3a26",muzzle:"monkey",cheeks:K},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:_},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:$},head:"wide",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#e2607a",muzzle:"oval",cheeks:K},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:_,feet:"#f9b95c",hands:"#639cc9"},head:"tall",ears:"tufts",face:{eyes:"big",eyeColor:_,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:G},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:$},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:$,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:_,hands:"#ffc23d",feet:"#ffa04a"},head:"round",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"none",cheeks:K},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:_,ears:"#b58262",hands:"#e6caa6",feet:"#e6caa6"},head:"wide",ears:"floppy",face:{eyes:"dot",mouth:"open",nose:he,muzzle:"oval",cheeks:K},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:_,skin:"#f7dccb",hands:"#a58c7e",feet:"#a58c7e"},head:"round",ears:"droopy",face:{eyes:"dot",mouth:"smile",nose:"#e591a0",muzzle:"none",cheeks:K},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:_,feet:"#ff9f43"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"bill",muzzle:"none",cheeks:K},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:$,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:$,hands:"#5a647a",feet:"#5a647a"},head:"round",ears:"pointy",face:{eyes:"dot",mouth:"open",nose:he,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:$,hands:"#3a9bdc",feet:"#8a7a70"},head:"round",ears:"none",face:{eyes:"big",eyeColor:$,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:G,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:G,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:G,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:G,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:G,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:G,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:G,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:G,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:G,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"]}];var R={M:0,L:1,Q:2,C:3,Z:4},at=[2,2,4,6,0];function se(n,e){for(let t of e)jt(n,t)}function jt(n,e){if(e.k==="group"){n.save(),n.translate(e.x,e.y),e.rot&&n.rotate(e.rot),e.s!==void 0&&e.s!==1&&n.scale(e.s,e.s),e.alpha!==void 0&&(n.globalAlpha*=e.alpha),se(n,e.items),n.restore();return}switch(n.save(),e.alpha!==void 0&&(n.globalAlpha*=e.alpha),n.beginPath(),e.k){case"circle":n.arc(e.x,e.y,Math.max(e.r,0),0,Math.PI*2);break;case"ellipse":n.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":Wt(n,e);break;case"path":typeof e.d=="string"?qt(n,e.d):Xt(n,e.d);break;case"line":n.moveTo(e.pts[0]??0,e.pts[1]??0);for(let t=2;t+1<e.pts.length;t+=2)n.lineTo(e.pts[t],e.pts[t+1]);break}n.lineCap="round",n.lineJoin="round",e.fill&&e.k!=="line"&&(n.fillStyle=e.fill,n.fill()),e.stroke&&(e.lw??1)>0&&(n.strokeStyle=e.stroke,n.lineWidth=e.lw??1,n.stroke()),n.restore()}function Wt(n,e){let t=Math.max(0,Math.min(e.r,e.w/2,e.h/2));n.translate(e.x,e.y),e.rot&&n.rotate(e.rot);let r=-e.w/2,a=-e.h/2;n.moveTo(r+t,a),n.lineTo(r+e.w-t,a),n.quadraticCurveTo(r+e.w,a,r+e.w,a+t),n.lineTo(r+e.w,a+e.h-t),n.quadraticCurveTo(r+e.w,a+e.h,r+e.w-t,a+e.h),n.lineTo(r+t,a+e.h),n.quadraticCurveTo(r,a+e.h,r,a+e.h-t),n.lineTo(r,a+t),n.quadraticCurveTo(r,a,r+t,a),n.closePath()}function Xt(n,e){for(let t=0;t<e.length;){let r=e[t++];if(r===R.M)n.moveTo(e[t],e[t+1]);else if(r===R.L)n.lineTo(e[t],e[t+1]);else if(r===R.Q)n.quadraticCurveTo(e[t],e[t+1],e[t+2],e[t+3]);else if(r===R.C)n.bezierCurveTo(e[t],e[t+1],e[t+2],e[t+3],e[t+4],e[t+5]);else if(r===R.Z)n.closePath();else return;t+=at[r]}}function Ie(n){if(typeof n=="string")return(n.match(/-?\d*\.?\d+(?:e-?\d+)?/gi)??[]).map(Number);let e=[];for(let t=0;t<n.length;){let r=at[n[t++]];if(r===void 0)break;for(let a=0;a<r;a++)e.push(n[t+a]);t+=r}return e}function qt(n,e){let t=e.match(/[MLQCZ]|-?\d*\.?\d+(?:e-?\d+)?/gi)??[],r="",a=0,o=()=>Number(t[a++]);for(;a<t.length;){let s=t[a];if(/[MLQCZ]/i.test(s)&&(r=s.toUpperCase(),a++,r==="Z")){n.closePath();continue}r==="M"?(n.moveTo(o(),o()),r="L"):r==="L"?n.lineTo(o(),o()):r==="Q"?n.quadraticCurveTo(o(),o(),o(),o()):r==="C"?n.bezierCurveTo(o(),o(),o(),o(),o(),o()):a++}}var B=n=>{let e=Math.round(n*100)/100;return e===0?0:e};function T(n,e=.5){let t=n.length;if(t<3)return[];let r=(u,l,p)=>({x:u.x+(l.x-u.x)*p,y:u.y+(l.y-u.y)*p}),a=Math.min(Math.max(e,0),.5),o=r(n[0],n[1],a),s=[R.M,B(o.x),B(o.y)];for(let u=1;u<=t;u++){let l=n[(u-1)%t],p=n[u%t],i=n[(u+1)%t],f=r(l,p,1-a),c=r(p,i,a);s.push(R.L,B(f.x),B(f.y),R.Q,B(p.x),B(p.y),B(c.x),B(c.y))}return s.push(R.Z),s}function C(n,e=1){let t=n.length;if(t<3)return[];let r=[R.M,B(n[0].x),B(n[0].y)],a=e/6;for(let o=0;o<t;o++){let s=n[(o-1+t)%t],u=n[o],l=n[(o+1)%t],p=n[(o+2)%t];r.push(R.C,B(u.x+(l.x-s.x)*a),B(u.y+(l.y-s.y)*a),B(l.x-(p.x-u.x)*a),B(l.y-(p.y-u.y)*a),B(l.x),B(l.y))}return r.push(R.Z),r}function ie(n){let e=n.length;if(e<2)return[];let t=[R.M,B(n[0].x),B(n[0].y)];for(let r=0;r<e-1;r++){let a=n[Math.max(r-1,0)],o=n[r],s=n[r+1],u=n[Math.min(r+2,e-1)];t.push(R.C,B(o.x+(s.x-a.x)/6),B(o.y+(s.y-a.y)/6),B(s.x-(u.x-o.x)/6),B(s.y-(u.y-o.y)/6),B(s.x),B(s.y))}return t}var J="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";var I="#ffffff",v=[-1,1],st="#3a2420",Zt="#f2808f",Le="#26324a",Jt="#ffd84a",N=(...n)=>{let e=[];for(let t=0;t+1<n.length;t+=2)e.push({x:n[t],y:n[t+1]});return e};function we(n,e){let t=n.palette,r=[],a={stroke:t.outline,lw:e},o=i=>n.headExtras.includes(i),s=(i,f)=>n.extraColors?.[i]??f;if(o("mane")){for(let f=0;f<12;f++){let c=f/12*Math.PI*2;r.push({k:"circle",x:Math.cos(c)*1.02,y:Math.sin(c)*1+.04,r:.42,fill:s(0,t.accent),...a})}r.push({k:"circle",x:0,y:.04,r:1.08,fill:s(0,t.accent)})}if(o("rainbow-mane")){let i=n.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];[[.98,.05,.3,.5,-.25],[.92,.58,.26,.42,-.1],[.62,.92,.22,.32,.4]].forEach(([c,x,d,m,h],b)=>r.push({k:"ellipse",x:c,y:x,rx:d,ry:m,rot:h,fill:i[b%i.length],...a}))}if(o("spikes"))for(let i of[-.55,0,.55]){let f=me(i,1.48),c=me(i-.32,.86),x=me(i+.32,.86);r.push({k:"path",d:T([c,f,x],.22),fill:t.accent,...a})}if(o("curl")&&r.push({k:"path",d:C([{x:-.2,y:-.9},{x:-.05,y:-1.3},{x:.32,y:-1.42},{x:.16,y:-1.18},{x:.2,y:-.9}]),fill:t.body,...a}),o("wool"))for(let i=0;i<=8;i++){let f=-1.75+i/8*3.5;r.push({k:"circle",x:Math.sin(f)*.98,y:-Math.cos(f)*.92-.04,r:.34,fill:t.body,...a})}if(o("crest")&&[-.38,0,.38].forEach((i,f)=>{let c=me(i,1.12);r.push({k:"ellipse",x:c.x,y:c.y,rx:.15,ry:.42,rot:i,fill:s(f,t.accent),...a})}),o("plume")&&r.push({k:"path",d:C(N(-.12,-.92,-.2,-1.42,.1,-1.78,.62,-1.74,.36,-1.46,.16,-.98)),fill:t.accent,...a}),o("locks")&&r.push({k:"path",d:C(N(-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:t.hair??t.outline,...a}),o("ninja-hood"))for(let[i,f]of[[.35,.5],[.85,.42]])r.push({k:"ellipse",x:1+Math.cos(i)*f*.8,y:-.5+Math.sin(i)*f*.8,rx:f,ry:.11,rot:i,fill:t.accent,...a});if(o("bandana"))for(let[i,f]of[[Math.PI-.5,.42],[Math.PI-1,.36]])r.push({k:"ellipse",x:-.98+Math.cos(i)*f*.8,y:-.36+Math.sin(i)*f*.8,rx:f,ry:.12,rot:i,fill:t.accent,...a});if(o("ruff"))for(let i of v)r.push({k:"path",d:T(N(i*.7,-.3,i*1.32,0,i*1.02,.18,i*1.26,.46,i*.86,.56,i*.98,.84,i*.4,.7),.25),fill:t.body,...a});if(n.face.eyesOnTop)for(let i of v)r.push({k:"circle",x:i*.46,y:-.72,r:.38,fill:t.body,...a});r.push(...rn(n,e)),r.push(en(n,a));let u=n.face.muzzle,l=t.belly;if(u==="oval"&&r.push({k:"ellipse",x:0,y:.4,rx:.46,ry:.32,fill:l}),u==="monkey"){for(let i of v)r.push({k:"circle",x:i*.32,y:-.04,r:.38,fill:l});r.push({k:"ellipse",x:0,y:.4,rx:.56,ry:.4,fill:l})}if(u==="heart"){for(let i of v)r.push({k:"circle",x:i*.36,y:.02,r:.5,fill:l});r.push({k:"ellipse",x:0,y:.38,rx:.66,ry:.48,fill:l})}if(u==="disc")for(let i of v)r.push({k:"circle",x:i*.4,y:.02,r:.44,fill:l});if(u==="cheeks")for(let i of v)r.push({k:"ellipse",x:i*.4,y:.44,rx:.44,ry:.32,fill:l});if(u==="band"&&r.push({k:"path",d:nn(n,e),fill:l}),o("stripes")){let i=s(0,t.outline);r.push({k:"line",pts:[0,-.97,0,-.66],stroke:i,lw:.13});for(let f of v)r.push({k:"line",pts:[f*.3,-.93,f*.24,-.7],stroke:i,lw:.1}),r.push({k:"line",pts:[f*.98,-.05,f*.74,0],stroke:i,lw:.1}),r.push({k:"line",pts:[f*.94,.22,f*.74,.22],stroke:i,lw:.09})}if(o("spots")){let i=s(1,t.belly);r.push({k:"circle",x:-.55,y:-.5,r:.15,fill:i}),r.push({k:"circle",x:.58,y:-.42,r:.11,fill:i}),r.push({k:"circle",x:.22,y:-.76,r:.09,fill:i})}if(o("forehead")&&r.push({k:"path",d:C(N(-.62,-.66,0,-.86,.62,-.66,.26,-.36,0,-.1,-.26,-.36),.9),fill:s(0,t.accent)}),o("eye-spot")&&r.push({k:"ellipse",x:.42,y:-.06,rx:.3,ry:.33,rot:.3,fill:t.ears??t.accent}),o("gills"))for(let i of v)for(let f of[0,.12,.24])r.push({k:"path",d:`M${i*(.66+f)} 0.06 Q${i*(.6+f)} 0.22 ${i*(.66+f)} 0.38`,stroke:t.accent,lw:e*.9});let p=t.hair??t.outline;if(o("hair")&&r.push({k:"path",d:C(N(-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:p,...a}),o("locks")&&r.push({k:"path",d:C(N(-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:p,...a}),o("curls")){for(let i=0;i<7;i++){let f=me(-1.3+i/6*2.6,.86);r.push({k:"circle",x:f.x,y:f.y,r:.3,fill:p,...a})}r.push({k:"ellipse",x:0,y:-.64,rx:.8,ry:.36,fill:p})}if(o("ninja-hood")&&(r.push({k:"rect",x:0,y:0,w:1.56,h:.6,r:.28,fill:t.skin??I,stroke:t.outline,lw:e*.8}),r.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:t.accent,...a})),o("domino")){r.push({k:"path",d:C(N(-.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:t.accent,...a});for(let i of v)r.push({k:"ellipse",x:i*.38,y:0,rx:.19,ry:.13,fill:I})}if(r.push(...on(n,e)),o("brows"))for(let i of v)r.push({k:"line",pts:[i*.72,-.5,i*.14,-.3],stroke:t.accent,lw:.16});if(n.face.brows)for(let i of v)r.push({k:"line",pts:[i*.2,-.2,i*.54,-.28],stroke:n.face.brows,lw:.09});if(r.push(...an(n,e)),n.face.cheeks)for(let i of v)r.push({k:"ellipse",x:i*.64,y:.3,rx:.15,ry:.1,fill:n.face.cheeks,alpha:.8});if(o("whiskers"))for(let i of v)for(let f of[-.1,.06])r.push({k:"line",pts:[i*.62,.38+f,i*1.06,.3+f*2.2],stroke:t.outline,lw:e*.7,alpha:.75});if(o("rainbow-mane")){let i=n.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];r.push({k:"ellipse",x:.42,y:-.82,rx:.34,ry:.22,rot:.5,fill:i[0],...a}),r.push({k:"ellipse",x:.1,y:-.92,rx:.3,ry:.2,rot:.25,fill:i[1%i.length],...a})}if(n.ears==="unicorn"){let i=[{x:-.18,y:-.84},{x:.02,y:-1.72},{x:.18,y:-.84}];r.push({k:"path",d:T(i,.12),fill:t.accent,...a});for(let f of[-1,-1.2,-1.4]){let c=.16*((f+1.72)/.88);r.push({k:"line",pts:[-c,f+.04,c,f-.04],stroke:t.outline,lw:e*.7,alpha:.6})}}if(o("helmet")){for(let i of v)r.push({k:"rect",x:i*1,y:.05,w:.26,h:.56,r:.12,fill:t.accent,...a});r.push({k:"path",d:"M-0.62 -0.62 Q-0.3 -0.92 0.12 -0.9",stroke:I,lw:.1,alpha:.9})}if(o("bolts"))for(let i of v)r.push({k:"rect",x:i*1.08,y:.08,w:.2,h:.44,r:.08,fill:t.accent,...a});if(o("tuft")&&r.push({k:"path",d:C([{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:t.body,...a}),o("eggshell")&&r.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:s(0,I),...a}),o("wool"))for(let[i,f]of[[-.36,-.84],[.02,-.94],[.4,-.82]])r.push({k:"circle",x:i,y:f,r:.27,fill:t.body,...a});if(o("stripe")&&r.push({k:"rect",x:0,y:-.64,w:.38,h:.62,r:.06,fill:t.accent}),o("eye-patch")&&(r.push({k:"line",pts:[-.97,-.5,.97,.13],stroke:t.outline,lw:.07}),r.push({k:"ellipse",x:.38,y:.02,rx:.21,ry:.19,fill:t.outline})),o("bandana")){r.push({k:"path",d:C(N(-1.05,-.22,-.96,-.72,-.5,-1.08,.1,-1.14,.72,-.96,1.04,-.56,1.05,-.22,.5,-.46,-.5,-.46)),fill:t.accent,...a});for(let[i,f]of[[-.5,-.8],[.08,-.92],[.6,-.74],[-.12,-.62],[.36,-.6]])r.push({k:"circle",x:i,y:f,r:.06,fill:I,alpha:.85});r.push({k:"circle",x:-.98,y:-.34,r:.15,fill:t.accent,...a})}if(o("cap")){for(let i of v)r.push({k:"line",pts:[i*.98,-.2,i*.5,.82,-i*.05,.98],stroke:t.outline,lw:.06});r.push({k:"path",d:C(N(-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:t.accent,...a}),r.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:t.accent,...a}),r.push({k:"circle",x:.5,y:-.82,r:.15,fill:s(0,I),...a});for(let i of[-.42,-.14])r.push({k:"line",pts:[i,-1.04,i+.02,-.78],stroke:t.outline,lw:.07,alpha:.7})}if(o("safari-hat")&&(r.push({k:"ellipse",x:0,y:-.56,rx:1.48,ry:.3,fill:t.accent,...a}),r.push({k:"path",d:C(N(-.78,-.58,-.7,-1.1,-.3,-1.38,.3,-1.38,.7,-1.1,.78,-.58,0,-.5),.8),fill:t.accent,...a}),r.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:s(1,t.outline),stroke:t.outline,lw:e*.8})),o("wizard-hat")){r.push({k:"ellipse",x:0,y:-.62,rx:1.32,ry:.26,fill:t.accent,...a}),r.push({k:"path",d:T(N(-.8,-.66,-.36,-1.5,.5,-2.2,.3,-1.46,.8,-.66),.3),fill:t.accent,...a});let i=s(0,Jt);for(let[f,c,x]of[[.02,-1.08,.18],[-.38,-.84,.1],[.36,-1.5,.11]])r.push({k:"group",x:f,y:c,s:x,items:[{k:"path",d:J,fill:i}]})}if(o("dive-mask")){for(let f of v)r.push({k:"line",pts:[f*.7,-.04,f*1,-.12],stroke:t.outline,lw:.2},{k:"line",pts:[f*.7,-.04,f*1,-.12],stroke:t.accent,lw:.11});r.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,fill:"#bfe9f5",alpha:.35}),r.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:t.outline,lw:.2}),r.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:t.accent,lw:.11}),r.push({k:"path",d:"M-0.5 -0.16 Q-0.4 -0.24 -0.22 -0.24",stroke:I,lw:.06,alpha:.9});let i="M0.5 0.52 Q0.98 0.56 1.04 0.1 L1.12 -0.92";r.push({k:"path",d:i,stroke:t.outline,lw:.24},{k:"path",d:i,stroke:t.accent,lw:.13})}return r}function en(n,e){let t=n.headExtras.includes("ninja-hood")?n.palette.body:n.palette.skin??n.palette.body;switch(n.head){case"round":return{k:"circle",x:0,y:0,r:1,fill:t,...e};case"wide":return{k:"ellipse",x:0,y:.03,rx:1.12,ry:.94,fill:t,...e};case"tall":return{k:"ellipse",x:0,y:-.02,rx:.94,ry:1.04,fill:t,...e};case"square":return{k:"rect",x:0,y:0,w:2,h:1.8,r:.46,fill:t,...e};case"bucket":return{k:"path",d:T(N(-.94,.96,-.98,-.36,-.62,-1.04,.62,-1.04,.98,-.36,.94,.96),.42),fill:t,...e};case"bulb":return{k:"path",d:C([{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:t,...e}}}function tn(n){return n.head==="round"?{cy:0,rx:1,ry:1}:n.head==="tall"?{cy:-.02,rx:.94,ry:1.04}:{cy:.03,rx:1.12,ry:.94}}function nn(n,e){let{cy:t,rx:r,ry:a}=tn(n),o=r-e/2,s=a-e/2,u=.15,l=Math.asin(Math.min(1,(u-t)/s)),p=Math.cos(l)*o,i=d=>Math.round(d*100)/100||0,f=[R.M,i(-p),u],c=[[-.84*p,.02,-.53*p,.06,-.32*p,.24],[-.17*p,.11,.17*p,.11,.32*p,.24],[.53*p,.06,.84*p,.02,p,u]];for(let d of c)f.push(R.C,...d.map(i));let x=24;for(let d=1;d<=x;d++){let m=l+(Math.PI-2*l)*d/x;f.push(R.L,i(Math.cos(m)*o),i(t+Math.sin(m)*s))}return f.push(R.Z),f}function rn(n,e){let t=n.palette,r={stroke:t.outline,lw:e},a=[];for(let o of v)switch(n.ears){case"pointy":case"unicorn":{let s=n.ears==="unicorn"?.8:1,u={x:o*.3,y:-.82},l={x:o*.86,y:-.82-.62*s},p={x:o*.94,y:-.36};a.push({k:"path",d:T([u,l,p],.2),fill:t.body,...r});let i={x:(u.x+l.x+p.x)/3,y:(u.y+l.y+p.y)/3},f=[u,l,p].map(c=>({x:i.x+(c.x-i.x)*.55,y:i.y+(c.y-i.y)*.55+.04}));a.push({k:"path",d:T(f,.25),fill:t.accent});break}case"round":a.push({k:"circle",x:o*.72,y:-.72,r:.36,fill:t.ears??t.body,...r}),t.ears||a.push({k:"circle",x:o*.74,y:-.74,r:.19,fill:t.accent});break;case"big-round":a.push({k:"circle",x:o*.96,y:-.46,r:.52,fill:t.body,...r}),a.push({k:"circle",x:o*1,y:-.44,r:.32,fill:t.accent});break;case"long":a.push({k:"ellipse",x:o*.38,y:-1.42,rx:.25,ry:.68,rot:o*.14,fill:t.body,...r}),a.push({k:"ellipse",x:o*.39,y:-1.36,rx:.12,ry:.48,rot:o*.14,fill:t.accent});break;case"side":a.push({k:"circle",x:o*1,y:.02,r:.34,fill:t.body,...r}),a.push({k:"circle",x:o*1.02,y:.02,r:.2,fill:t.belly});break;case"tufts":a.push({k:"path",d:T([{x:o*.3,y:-.84},{x:o*1.22,y:-1.12},{x:o*.92,y:-.42}],.16),fill:t.body,...r}),a.push({k:"line",pts:[o*.62,-.78,o*1,-.98],stroke:t.accent,lw:.08});break;case"antennae":{let s={x:o*.62,y:-1.42};a.push({k:"path",d:`M${o*.3} -0.8 Q${o*.36} -1.2 ${s.x} ${s.y}`,stroke:t.outline,lw:e*2.6}),a.push({k:"path",d:`M${o*.3} -0.8 Q${o*.36} -1.2 ${s.x} ${s.y}`,stroke:t.body,lw:e*1.2}),a.push({k:"circle",x:s.x,y:s.y,r:.17,fill:t.accent,...r});break}case"floppy":a.push({k:"ellipse",x:o*.96,y:.02,rx:.3,ry:.62,rot:-o*.36,fill:t.ears??t.body,...r});break;case"droopy":a.push({k:"ellipse",x:o*1.04,y:-.22,rx:.4,ry:.18,rot:o*.32,fill:t.skin??t.body,...r}),a.push({k:"ellipse",x:o*1.08,y:-.2,rx:.24,ry:.08,rot:o*.32,fill:t.accent});break;case"human":a.push({k:"ellipse",x:o*.98,y:.06,rx:.17,ry:.23,fill:t.skin??t.body,...r});break;case"horns":{let s=[{x:o*.3,y:-.84},{x:o*.6,y:-1.5},{x:o*.66,y:-.68}];a.push({k:"path",d:T(s,.18),fill:t.accent,...r});break}}return n.ears==="fin"&&a.push({k:"path",d:T(N(-.4,-.82,.2,-1.62,.46,-.78),.2),fill:t.body,...r}),n.ears==="antenna"&&(a.push({k:"line",pts:[0,-.85,0,-1.42],stroke:t.outline,lw:e*2.6}),a.push({k:"line",pts:[0,-.85,0,-1.42],stroke:t.limbs,lw:e*1.2}),a.push({k:"circle",x:0,y:-1.5,r:.18,fill:t.accent,...r})),a}function on(n,e){let t=n.palette,r=n.face,a=[],o=t.outline,s=r.eyesOnTop?.46:.4,u=r.eyesOnTop?-.72:-.04,l=(p,i,f)=>({k:"circle",x:p,y:i,r:f,fill:I});switch(r.eyes){case"dot":for(let p of v)a.push({k:"ellipse",x:p*s,y:u,rx:.12,ry:.155,fill:o}),a.push(l(p*s+.04,u-.06,.045));break;case"bead":for(let p of v)a.push({k:"ellipse",x:p*s,y:u,rx:.16,ry:.22,fill:o}),a.push(l(p*s+.05,u-.08,.065));break;case"big":for(let p of v)r.eyeRing&&a.push({k:"circle",x:p*s,y:u,r:.36,fill:r.eyeRing,stroke:o,lw:e*.8}),a.push({k:"circle",x:p*s,y:u,r:.25,fill:I,stroke:o,lw:e*.8}),a.push({k:"circle",x:p*s+p*-.03,y:u+.03,r:.14,fill:r.eyeColor??o}),a.push(l(p*s+p*-.03+.05,u-.03,.05));break;case"mask":for(let p of v)a.push({k:"ellipse",x:p*.4,y:0,rx:.24,ry:.32,rot:p*-.55,fill:t.limbs}),a.push({k:"circle",x:p*.4,y:-.02,r:.11,fill:I}),a.push({k:"circle",x:p*.39,y:-0,r:.065,fill:o});break;case"screen":a.push({k:"rect",x:0,y:0,w:1.5,h:.66,r:.26,fill:"#24323d",stroke:o,lw:e*.8});for(let p of v)a.push({k:"ellipse",x:p*.36,y:0,rx:.2,ry:.24,fill:r.eyeColor??"#7ff0ff",alpha:.3}),a.push({k:"ellipse",x:p*.36,y:0,rx:.12,ry:.16,fill:r.eyeColor??"#7ff0ff"});break;case"almond":for(let p of v)a.push({k:"ellipse",x:p*.42,y:-.02,rx:.3,ry:.2,rot:-p*.5,fill:r.eyeColor??o}),a.push(l(p*.42-p*.07,-.08,.07));break;case"calm":for(let p of v)a.push({k:"ellipse",x:p*.38,y:.02,rx:.085,ry:.12,fill:o}),a.push(l(p*.38+.03,-.02,.03));break;case"slit":a.push({k:"line",pts:[0,-.98,0,-.2],stroke:o,lw:e*.8,alpha:.5}),a.push({k:"rect",x:0,y:-.04,w:1.56,h:.26,r:.1,fill:Le,stroke:o,lw:e*.8}),a.push({k:"rect",x:0,y:.3,w:.22,h:.46,r:.08,fill:Le,stroke:o,lw:e*.8});for(let p of v){a.push({k:"ellipse",x:p*.4,y:-.04,rx:.12,ry:.07,fill:r.eyeColor??I});for(let i of[.36,.56])a.push({k:"circle",x:p*.42,y:i,r:.05,fill:o,alpha:.6})}break;case"goggle":for(let p of v)a.push({k:"circle",x:p*.9,y:0,r:.13,fill:t.accent,stroke:o,lw:e*.8});a.push({k:"rect",x:0,y:0,w:1.66,h:.62,r:.3,fill:Le,stroke:o,lw:e*.8}),a.push({k:"path",d:"M-0.6 -0.16 Q-0.42 -0.24 -0.12 -0.24",stroke:I,lw:.07,alpha:.8});for(let p of v)a.push({k:"path",d:`M${p*.5} 0.04 Q${p*.34} -0.08 ${p*.16} 0.02`,stroke:r.eyeColor??"#7fd6ff",lw:.08});for(let p of[-.18,0,.18])a.push({k:"line",pts:[p,.56,p,.72],stroke:o,lw:e*.8,alpha:.6});break;case"visor":a.push({k:"ellipse",x:0,y:.08,rx:.8,ry:.64,fill:"#2a3f6b",stroke:o,lw:e*.8}),a.push({k:"path",d:"M-0.56 -0.14 Q-0.46 -0.4 -0.16 -0.46",stroke:I,lw:.08,alpha:.7});for(let p of v)a.push({k:"ellipse",x:p*.28,y:.04,rx:.1,ry:.14,fill:r.eyeColor??"#cfeeff"});break}return a}function an(n,e){let t=n.palette,r=n.face,a=[],o=r.eyes==="visor"?"#cfeeff":st,s=e*1.05;switch(r.nose&&r.mouth!=="beak"&&(r.mouth==="cat"?a.push({k:"path",d:T([{x:-.1,y:.22},{x:.1,y:.22},{x:0,y:.33}],.3),fill:r.nose,stroke:r.nose,lw:e*.6}):n.ears==="big-round"?a.push({k:"ellipse",x:0,y:.22,rx:.2,ry:.25,fill:r.nose}):a.push({k:"ellipse",x:0,y:.25,rx:.13,ry:.085,fill:r.nose})),r.mouth){case"smile":a.push({k:"path",d:r.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:o,lw:s});break;case"open":a.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:o,stroke:o,lw:e*.5}),a.push({k:"ellipse",x:0,y:.6,rx:.1,ry:.06,fill:Zt});break;case"cat":a.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:o,lw:s});break;case"beak":a.push({k:"path",d:T([{x:-.17,y:.2},{x:.17,y:.2},{x:0,y:.48}],.25),fill:t.accent,stroke:t.outline,lw:e*.8});break;case"teeth":a.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:o,stroke:o,lw:e*.5});for(let u of v)a.push({k:"rect",x:u*.12,y:.43,w:.1,h:.1,r:.03,fill:I});break;case"grill":a.push({k:"rect",x:0,y:.56,w:.62,h:.2,r:.08,fill:"#24323d",stroke:t.outline,lw:e*.7});for(let u of[-.15,0,.15])a.push({k:"line",pts:[u,.51,u,.61],stroke:"#9fb0bd",lw:e*.6});break;case"tiny":a.push({k:"ellipse",x:0,y:.44,rx:.08,ry:.1,fill:o});break;case"smirk":a.push({k:"path",d:"M-0.16 0.46 Q0.06 0.54 0.22 0.38",stroke:o,lw:s});break;case"bill":a.push({k:"ellipse",x:0,y:.36,rx:.44,ry:.2,fill:t.accent,stroke:t.outline,lw:e*.8}),a.push({k:"path",d:"M-0.36 0.38 Q0 0.46 0.36 0.38",stroke:t.outline,lw:e*.7});for(let u of v)a.push({k:"circle",x:u*.1,y:.28,r:.03,fill:t.outline});break;case"hook":a.push({k:"ellipse",x:0,y:.48,rx:.16,ry:.11,fill:st}),a.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:t.accent,stroke:t.outline,lw:e*.8});break;case"jaws":{a.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:o,stroke:o,lw:e*.5});for(let u of[-.34,-.17,0,.17,.34]){let l=.3+.4*(u+.5)*(.5-u)-.01;a.push({k:"path",d:T(N(u-.075,l,u+.075,l,u,l+.13),.15),fill:I})}break}}return a}var me=(n,e)=>({x:Math.sin(n)*e,y:-Math.cos(n)*e});var ut=.5,Q={leftEye:2,rightEye:5,leftEar:7,rightEar:8},j={"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}},ve="6-8",Ae=n=>n.band in j?n.band:ve,sn=j[ve].head,ft=.3,dt=.12,ln=.9,it=.5,lt=.65,cn=.35,pn=.2,un=.25,q=(n,e)=>({x:n.x-e.x,y:n.y-e.y}),U=(n,e)=>({x:n.x+e.x,y:n.y+e.y}),L=(n,e)=>({x:n.x*e,y:n.y*e}),ee=n=>Math.hypot(n.x,n.y),ct=(n,e)=>({x:(n.x+e.x)/2,y:(n.y+e.y)/2}),$e=n=>{let e=ee(n);return e>1e-9?{x:n.x/e,y:n.y/e}:{x:0,y:1}},fn=(...n)=>n.every(Number.isFinite),dn=n=>Math.atan2(Math.sin(n),Math.cos(n)),yn=(n,e,t)=>Math.min(Math.max(n,e),t);function yt(n,e,t=!1){return r=>{let a=n[r*3],o=n[r*3+1],s=n[r*3+2];return a===void 0||o===void 0||s===void 0||!fn(a,o,s)?{x:0,y:0,ok:!1}:{x:e.x+(t?1-a:a)*e.w,y:e.y+o*e.h,ok:s>=ut}}}function le(n,e,t={}){let r=yt(n,e,t.mirrored),a=r(P.leftShoulder),o=r(P.rightShoulder);if(!a.ok||!o.ok)return null;let s=r(P.leftHip),u=r(P.rightHip),l=ct(a,o),p=ee(q(o,a)),i=s.ok&&u.ok,f=$e(q(o,a));p<1e-6&&(f={x:1,y:0});let c,x,d;if(i){let Z=ct(s,u);x=ee(q(Z,l)),x>=p*un?c=$e(q(Z,l)):(c={x:-f.y,y:f.x},c.y<0&&(c=L(c,-1))),d=Math.max(x,p*1.15)}else c={x:-f.y,y:f.x},c.y<0&&(c=L(c,-1)),d=p*1.15,x=d;d=Math.max(d,1e-6);let m={x:c.y,y:-c.x},h=Math.atan2(m.y,m.x),b=L(c,-1),w=j[t.band??ve]??j[ve],D=w.head*d,V=U(l,L(b,D*w.neck)),ue=r(P.nose);if(ue.ok){let Z=U(ue,L(b,D*.15)),fe=L(q(Z,V),cn),Me=Math.min(1,D*pn/Math.max(ee(fe),1e-6));V=U(V,L(fe,Me))}return{S:l,r:m,d:c,U:d,L:x,hipsOk:i,head:V,headR:D,headRot:h+hn(n,r,h,d),angle:h}}function hn(n,e,t,r){let a=[[Q.leftEar,Q.rightEar],[Q.leftEye,Q.rightEye]];for(let[o,s]of a){let u=e(o),l=e(s);if(!u.ok||!l.ok||!(n[o*3+2]>=lt&&n[s*3+2]>=lt)||ee(q(l,u))<r*.05)continue;let p=dn(Math.atan2(l.y-u.y,l.x-u.x)-t),i=Math.max(Math.abs(p)-dt,0),f=yn((ln+it-Math.abs(p))/it,0,1);return Math.sign(p)*Math.min(i,ft)*f}return 0}function ce(n,e,t,r={}){let a=Ae(e),o=j[a],s=le(n,t,{...r,band:a});if(!s)return[];let u=yt(n,t,r.mirrored),l=e.palette,{S:p,r:i,d:f,U:c,L:x}=s,d=y=>e.bodyExtras.includes(y),m=Math.max(1.2,c*.045),h={stroke:l.outline,lw:m},b=(y,k)=>({x:p.x+i.x*y+f.x*k,y:p.y+i.y*y+f.y*k}),w=y=>y.map(([k,g])=>b(k,g)),D=u(P.leftShoulder),V=u(P.rightShoulder),ue=u(P.leftHip),Z=u(P.rightHip),fe=ee(q(V,D)),Me=s.hipsOk?ee(q(Z,ue)):fe*.7,S=Math.max(fe/2+o.shoulderPad*c,o.shoulderMin*c),O=Math.max(Me/2+o.hipPad*c,o.hipMin*c),F=-.1*c,te=x+o.bottom*c,W=[],xe=[],E=[],ke=[],He=[],_e=(y,k,g,M)=>{let A=k.flatMap(H=>[H.x,H.y]);y.push({k:"line",pts:A,stroke:l.outline,lw:g+m*2}),y.push({k:"line",pts:A,stroke:M,lw:g})},Rt=o.leg*c,zt=o.arm*c,Ve=Math.max(o.arm/.22,.9);if(s.hipsOk)for(let[y,k,g,M]of[[ue,P.leftKnee,P.leftAnkle,-1],[Z,P.rightKnee,P.rightAnkle,1]]){let A=u(k),H=u(g);if(!A.ok)continue;let Pe=U(y,L(f,-.12*c)),ne=H.ok?[Pe,A,H]:[Pe,A];_e(xe,ne,Rt,l.limbs),d("joints")&&xe.push({k:"circle",x:A.x,y:A.y,r:.15*c*Ve,fill:l.accent,...h}),H.ok&&xe.push(xn(e,H,s,M,m,o.foot))}for(let[y,k,g,M]of[[D,P.leftElbow,P.leftWrist,-1],[V,P.rightElbow,P.rightWrist,1]]){let A=u(k),H=u(g);if(d("pauldrons")){let re=U(y,L(f,.02*c));ke.push({k:"ellipse",x:re.x,y:re.y,rx:.25*c,ry:.17*c,rot:s.angle+M*.25,fill:l.body,...h});let ye=U(re,L(f,.05*c));ke.push({k:"ellipse",x:ye.x,y:ye.y,rx:.17*c,ry:.07*c,rot:s.angle+M*.25,fill:l.belly})}if(!A.ok)continue;let ne=o.armsOverHead&&(A.x-p.x)*f.x+(A.y-p.y)*f.y<-.25*c?He:ke,Ge=U(y,L(f,.04*c));if(_e(ne,H.ok?[Ge,A,H]:[Ge,A],zt,l.limbs),d("joints")&&ne.push({k:"circle",x:A.x,y:A.y,r:.13*c*Ve,fill:l.accent,...h}),!H.ok)continue;let de=$e(q(H,A)),Be=U(H,L(de,.05*c));if(d("feathers"))for(let re of[-.55,0,.55]){let ye=Math.cos(re),Ke=Math.sin(re)*M,Ce={x:de.x*ye-de.y*Ke,y:de.x*Ke+de.y*ye},Ue=U(Be,L(Ce,.16*c));ne.push({k:"ellipse",x:Ue.x,y:Ue.y,rx:.2*c,ry:.09*c,rot:Math.atan2(Ce.y,Ce.x),fill:l.hands??l.accent,...h})}ne.push({k:"circle",x:Be.x,y:Be.y,r:o.hand*c,fill:l.hands??l.limbs,...h})}if(d("wings"))for(let y of[-1,1]){let k=w([[y*S*.5,.05*c],[y*(S+.85*c),-.6*c],[y*(S+.72*c),.05*c],[y*(S+.45*c),-.02*c],[y*(S+.3*c),.32*c],[y*S*.6,.55*c]]);W.push({k:"path",d:T(k,.18),fill:l.accent,...h})}if(d("cape")){let y=x+.8*c,k=O+.36*c,g=w([[-S*.92,F+.04*c],[S*.92,F+.04*c],[S+.16*c,x*.5],[k,y],[k*.5,y-.1*c],[0,y],[-k*.5,y-.1*c],[-k,y],[-S-.16*c,x*.5]]);W.push({k:"path",d:C(g,.6),fill:l.accent,...h})}if(d("backpack")){let y=b(0,.35*c);W.push({k:"rect",x:y.x,y:y.y,w:S*2+.34*c,h:.8*c,r:.16*c,rot:s.angle,fill:e.extraColors?.[0]??l.limbs,...h})}if(d("tank")){let y=b(S*.95,.24*c),k=e.extraColors?.[0]??l.accent,g=b(S*.95,-.3*c);W.push({k:"rect",x:g.x,y:g.y,w:.14*c,h:.16*c,r:.04*c,rot:s.angle,fill:l.outline}),W.push({k:"rect",x:y.x,y:y.y,w:.34*c,h:1*c,r:.17*c,rot:s.angle,fill:k,...h})}if(s.hipsOk&&!r.portrait&&W.push(...kn(e,s,O,m)),d("tentacles")&&s.hipsOk)for(let y of[-1,1]){let k=w([[y*O*.7,x*.9],[y*(O+.22*c),x+.3*c],[y*(O+.48*c),x+.22*c],[y*(O+.5*c),x-.02*c],[y*(O+.34*c),x-.06*c]]);W.push({k:"path",d:ie(k),stroke:l.outline,lw:.2*c+m*2}),W.push({k:"path",d:ie(k),stroke:l.limbs,lw:.2*c})}let X=Math.max(S,O)*o.bulge;if(d("wool")){for(let[k,g]of[[S*.7,F+.02*c],[X,x*.3],[X*1.02,x*.62],[(X+O)/2,x*.92],[O*.55,te]])for(let M of[-1,1]){let A=b(M*k,g);E.push({k:"circle",x:A.x,y:A.y,r:.2*c,fill:l.body,...h})}let y=b(0,te+.02*c);E.push({k:"circle",x:y.x,y:y.y,r:.2*c,fill:l.body,...h})}if(d("robe")){let y=x+.58*c,k=O*1.4;E.push({k:"path",d:C(w([[-S,F],[0,F-.04*c],[S,F],[X,x*.55],[k,y],[0,y+.06*c],[-k,y],[-X,x*.55]]),.7),fill:l.body,...h});let g=w([[-k*.94,y-.1*c],[0,y-.04*c],[k*.94,y-.1*c]]);E.push({k:"path",d:ie(g),stroke:e.extraColors?.[0]??l.accent,lw:.07*c})}else if(d("sheet")){let y=x+.78*c,k=O*1.3;E.push({k:"path",d:C(w([[-S,F],[S,F],[X,x*.55],[k,y],[k*.5,y-.2*c],[0,y],[-k*.5,y-.2*c],[-k,y],[-X,x*.55]]),.9),fill:l.body,...h})}else E.push({k:"path",d:C(w([[-S,F],[0,F-.04*c],[S,F],[X,x*.55],[O,te],[0,te+.03*c],[-O,te],[-X,x*.55]]),.85),fill:l.body,...h});let Y=Math.min(S,O);if(d("pocket")){let y=b(0,x*.74);E.push({k:"rect",x:y.x,y:y.y,w:Y*1.3,h:.3*c,r:.1*c,rot:s.angle,fill:l.belly,stroke:l.outline,lw:m*.8})}else if(d("racing-stripe"))for(let y of[-.1,.1]){let k=b(y*c,F+.02*c),g=b(y*c,te-.04*c);E.push({k:"line",pts:[k.x,k.y,g.x,g.y],stroke:l.belly,lw:.1*c})}else if(l.belly&&l.belly!==l.body&&!d("panel")&&!d("sheet")&&!d("stripes")){let y=b(0,x*.58);E.push({k:"ellipse",x:y.x,y:y.y,rx:Y*.64,ry:Math.max(x*.36,.2*c),rot:s.angle,fill:l.belly})}if(d("spots")){let y=e.extraColors?.[1]??l.belly;for(let[k,g,M]of[[-.55,.35,.09],[.5,.62,.11],[-.35,.86,.07]]){let A=b(k*Y,g*x);E.push({k:"circle",x:A.x,y:A.y,r:M*c,fill:y})}}if(d("stripes")){let y=e.extraColors?.[1]??l.accent;for(let k of[.22,.44,.66]){let g=b(-Y*.98,x*k),M=b(Y*.98,x*k);E.push({k:"line",pts:[g.x,g.y,M.x,M.y],stroke:y,lw:.1*c})}}if(d("straps")){let y=e.extraColors?.[1]??l.outline;for(let k of[-1,1]){let g=b(k*S*.62,F+.02*c),M=b(k*Y*.62,x*.72);E.push({k:"line",pts:[g.x,g.y,M.x,M.y],stroke:l.outline,lw:.13*c+m*2}),E.push({k:"line",pts:[g.x,g.y,M.x,M.y],stroke:y,lw:.13*c})}}if(d("belt")){let y=b(0,x*.9);E.push({k:"rect",x:y.x,y:y.y,w:O*1.92,h:.17*c,r:.06*c,rot:s.angle,fill:e.extraColors?.[2]??"#4a3426",...h}),E.push({k:"rect",x:y.x,y:y.y,w:.2*c,h:.19*c,r:.04*c,rot:s.angle,fill:"#ffd84a",...h})}if(d("emblem")){let y=b(0,x*.4),k=e.extraColors?.[0]??l.accent,g=T([{x:-.22,y:-.2},{x:.22,y:-.2},{x:.22,y:.04},{x:0,y:.26},{x:-.22,y:.04}],.25);E.push({k:"group",x:y.x,y:y.y,rot:s.angle,s:c,items:[{k:"path",d:g,fill:k,stroke:l.outline,lw:m/c},{k:"group",x:0,y:.01,s:.12,items:[{k:"path",d:J,fill:k===l.accent?"#ffffff":l.accent}]}]})}if(d("panel")){let y=b(0,x*.5);E.push({k:"rect",x:y.x,y:y.y,w:Y*1.2,h:.38*c,r:.1*c,rot:s.angle,fill:"#24323d",...h}),(e.extraColors??["#ff7a6b","#fbd46a","#7ff0ff"]).slice(0,3).forEach((g,M)=>{let A=b((M-1)*Y*.34,x*.5);E.push({k:"circle",x:A.x,y:A.y,r:.075*c,fill:g})})}if(d("badge")){let y=b(-Y*.42,x*.36);E.push({k:"circle",x:y.x,y:y.y,r:.15*c,fill:l.accent,...h}),E.push({k:"group",x:y.x,y:y.y,rot:s.angle,s:.09*c,items:[{k:"path",d:J,fill:"#ffffff"}]})}if(d("star")){let y=b(-Y*.5,x*.3),k=.15*c;E.push({k:"group",x:y.x,y:y.y,rot:s.angle-.2,s:k,items:[{k:"path",d:J,fill:e.extraColors?.[0]??"#ffd84a",stroke:l.outline,lw:m*.8/k}]})}if(d("scarf")){let y=Math.max(.04,o.head*(1-o.neck)-.06)*c,k=b(0,y),g=e.extraColors?.[0]??l.accent,M=b(S*.45,y+.28*c);E.push({k:"rect",x:M.x,y:M.y,w:.16*c,h:.42*c,r:.06*c,rot:s.angle+.15,fill:g,...h}),E.push({k:"rect",x:k.x,y:k.y,w:S*2.05,h:.2*c,r:.1*c,rot:s.angle,fill:g,...h})}let Ot={k:"group",x:s.head.x,y:s.head.y,rot:s.headRot,s:s.headR,items:bn(e,m/s.headR)};return[...W,...xe,...E,...ke,Ot,...He]}var pt=new WeakMap,mn=64;function bn(n,e){let t=Number(e.toPrecision(4)),r=pt.get(n);r||pt.set(n,r=new Map);let a=r.get(t);return a||(r.size>=mn&&r.clear(),r.set(t,a=we(n,t))),a}function xn(n,e,t,r,a,o){let s=n.palette,{d:u,r:l}=t,p=t.U*o,i=U(U(e,L(u,.07*p)),L(l,r*.06*p)),f={stroke:s.outline,lw:a},c=s.feet??s.limbs;if(n.bodyExtras.includes("fins")){let x=T([{x:-.13,y:-.06},{x:.13,y:-.06},{x:.24,y:.46},{x:-.24,y:.46}],.22);return{k:"group",x:i.x,y:i.y,rot:t.angle,s:p,items:[{k:"path",d:x,fill:c,stroke:s.outline,lw:a/p},{k:"line",pts:[0,.06,0,.38],stroke:s.outline,lw:a/p,alpha:.5}]}}return n.bodyExtras.includes("flippers")?{k:"ellipse",x:i.x,y:i.y,rx:.27*p,ry:.11*p,rot:t.angle,fill:c,...f}:n.bodyExtras.includes("boots")?{k:"rect",x:i.x,y:i.y,w:.4*p,h:.24*p,r:.09*p,rot:t.angle,fill:c,...f}:{k:"ellipse",x:i.x,y:i.y,rx:.2*p,ry:.13*p,rot:t.angle,fill:c,...f}}function kn(n,e,t,r){let a=n.palette,{U:o,L:s,S:u,r:l,d:p}=e,i=(m,h)=>({x:u.x+l.x*m+p.x*h,y:u.y+l.y*m+p.y*h}),f=m=>m.map(([h,b])=>i(h,b)),c={stroke:a.outline,lw:r},x=(m,h,b)=>[{k:"path",d:ie(m),stroke:a.outline,lw:h+r*2},{k:"path",d:ie(m),stroke:b,lw:h}],d=[];switch(n.tail){case"none":break;case"fluffy":{let m=f([[t*.5,s*.95],[t+.28*o,s*1],[t+.72*o,s*.62],[t+.78*o,s*.12],[t+.52*o,s*.32],[t+.3*o,s*.6],[t*.6,s*.7]]);d.push({k:"path",d:C(m),fill:a.body,...c});let h=i(t+.72*o,s*.2);d.push({k:"ellipse",x:h.x,y:h.y,rx:.13*o,ry:.2*o,rot:e.angle+.25,fill:a.belly,...c});break}case"brush":{let m=f([[t*.4,s*.98],[t+.42*o,s*1.06],[t+.98*o,s*.66],[t+1.06*o,s*.12],[t+.86*o,-.04*o],[t+.66*o,s*.36],[t+.3*o,s*.66],[t*.5,s*.68]]);d.push({k:"path",d:C(m),fill:a.body,...c});let h=f([[t+1.03*o,s*.36],[t+1.06*o,s*.12],[t+.86*o,-.04*o],[t+.72*o,s*.24],[t+.86*o,s*.34]]);d.push({k:"path",d:C(h),fill:a.belly,...c});break}case"pom":{let m=i(t+.06*o,s*.88);d.push({k:"circle",x:m.x,y:m.y,r:.2*o,fill:a.belly,...c});break}case"long":case"striped":case"tuft":{let m=f([[t*.6,s*.9],[t+.35*o,s*.85],[t+.58*o,s*.4],[t+.5*o,-.02*o]]);if(d.push(...x(m,.14*o,a.body)),n.tail==="tuft"){let h=m[m.length-1];d.push({k:"circle",x:h.x,y:h.y,r:.16*o,fill:n.extraColors?.[0]??a.accent,...c})}if(n.tail==="striped"){for(let b of[.35,.6,.85]){let w=i(t+.35*o+.22999999999999998*o*(b*1.4>1?1:b*1.4),s*(.85-.85*b));d.push({k:"line",pts:[w.x-l.x*.08*o,w.y-l.y*.08*o,w.x+l.x*.08*o,w.y+l.y*.08*o],stroke:n.extraColors?.[0]??a.outline,lw:.06*o})}let h=m[m.length-1];d.push({k:"circle",x:h.x,y:h.y,r:.07*o,fill:n.extraColors?.[0]??a.outline})}break}case"curl":{let m=f([[t*.6,s*.9],[t+.4*o,s*.88],[t+.62*o,s*.45],[t+.5*o,s*.12],[t+.3*o,s*.24],[t+.36*o,s*.42]]);d.push(...x(m,.12*o,a.limbs));break}case"fish":{let m=f([[t*.6,s*.9],[t+.36*o,s*.86],[t+.6*o,s*.5]]);d.push(...x(m,.17*o,a.body));let h=m[m.length-1],b=T([{x:0,y:.06},{x:-.26,y:-.34},{x:.02,y:-.12},{x:.32,y:-.3}],.2);d.push({k:"group",x:h.x,y:h.y,rot:e.angle+.35,s:o,items:[{k:"path",d:b,fill:a.body,stroke:a.outline,lw:r/o}]});break}case"plume":{let m=n.extraColors??[a.accent];[0,1,2].forEach(h=>{let b=i(t+(.12+h*.13)*o,s+(.32-h*.06)*o);d.push({k:"ellipse",x:b.x,y:b.y,rx:.11*o,ry:.44*o,rot:e.angle-.55+h*.28,fill:m[(h+1)%m.length],...c})});break}case"spiky":case"arrow":{let m=f([[t*.3,s*.55],[t+.35*o,s*.68],[t+.95*o,s*.86],[t+.35*o,s*1.08],[t*.3,s*1.08]]);if(n.tail==="spiky"){for(let h of[.15,.45,.72]){let b=t+(.2+h*.7)*o,w=s*(.66+h*.19);d.push({k:"path",d:T(f([[b-.12*o,w+.05*o],[b,w-.2*o],[b+.12*o,w+.07*o]]),.2),fill:a.accent,...c})}d.push({k:"path",d:C(m,.7),fill:a.body,...c})}else{let h=f([[t*.6,s*.9],[t+.4*o,s*.92],[t+.62*o,s*.5],[t+.62*o,s*.18]]);d.push(...x(h,.13*o,a.body));let b=h[h.length-1];d.push({k:"group",x:b.x,y:b.y,rot:e.angle,s:o,items:[{k:"path",d:T([{x:-.15,y:.04},{x:0,y:-.22},{x:.15,y:.04}],.2),fill:a.accent,stroke:a.outline,lw:r/o}]})}break}}return d}var wn={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 vn(n,{cx:e=.5,cy:t=.36,T:r=.18}={}){let a={...wn,...n},o=new Array(99).fill(0),s=(p,[i,f],c=.99)=>{o[p*3]=e+i*r,o[p*3+1]=t+f*r,o[p*3+2]=c};for(let p of Object.keys(P))s(P[p],a[p]);let u=a.tilt??0,l=(p,i)=>[a.nose[0]+p*Math.cos(u)-i*Math.sin(u),a.nose[1]+p*Math.sin(u)+i*Math.cos(u)];return s(Q.leftEye,l(-.1,-.08)),s(Q.rightEye,l(.1,-.08)),s(Q.leftEar,l(-.22,-.02)),s(Q.rightEar,l(.22,-.02)),o}var ht=()=>vn({});var be=class{constructor(e={}){z(this,"tracks",new Map);z(this,"offset",NaN);z(this,"lastArrival",NaN);z(this,"interval",33);z(this,"lastT",NaN);z(this,"lostMs");z(this,"maxExtrapolateMs");this.lostMs=e.lostMs??250,this.maxExtrapolateMs=e.maxExtrapolateMs??25}get delayMs(){return this.interval}push(e,t,r,a=mt()){Number.isFinite(t)||(t=a),this.clock(t,a);let o=this.tracks.get(e);if(!o||t-o.tb>this.lostMs||t<o.tb-this.lostMs||r.length!==o.b.length){this.tracks.set(e,{a:null,ta:t,b:r,tb:t,out:null,outAt:NaN});return}if(r===o.b||t<=o.tb){t===o.tb&&r!==o.b&&(o.b=r,o.out=null);return}o.a=o.b,o.ta=o.tb,o.b=r,o.tb=t,o.out=null}at(e,t=mt()){let r=this.tracks.get(e);if(!r)return null;if(!r.a)return r.b;if(r.out&&r.outAt===t)return r.out;let a=t-this.offset-this.interval,o=r.tb-r.ta,s=Math.min(o*.5,this.maxExtrapolateMs),u=Math.min(Math.max((a-r.ta)/o,0),1+s/o);return r.out=bt(r.a,r.b,u),r.outAt=t,r.out}forget(e){this.tracks.delete(e)}clear(){this.tracks.clear()}clock(e,t){let r=t-e;if(!Number.isFinite(this.offset)||r<this.offset||r>this.offset+1e3?this.offset=r:Number.isFinite(this.lastArrival)&&(this.offset+=Math.min(r-this.offset,(t-this.lastArrival)/1e3)),this.lastArrival=t,Number.isFinite(this.lastT)&&e>this.lastT){let a=e-this.lastT;a<this.interval*3+20&&(this.interval+=(Math.min(Math.max(a,8),100)-this.interval)*.1)}e<=this.lastT||(this.lastT=e)}},mt=()=>globalThis.performance?.now()??Date.now();function bt(n,e,t){let r=e.slice(),a=t<.5?n:e;for(let o=0;o+2<e.length;o+=3){let s=n[o],u=n[o+1],l=e[o],p=e[o+1];n[o+2]>=.5&&e[o+2]>=.5&&Math.abs(l-s)+Math.abs(p-u)<.15?(r[o]=s+(l-s)*t,r[o+1]=u+(p-u)*t,r[o+2]=n[o+2]+(e[o+2]-n[o+2])*Math.min(t,1)):(r[o]=a[o],r[o+1]=a[o+1],r[o+2]=a[o+2])}return r}var or=Oe.map(n=>n.id);var Se=new Map(Oe.map(n=>[n.id,n])),Ne=Se.get("fox"),xt=n=>typeof n=="string"&&Se.has(n),kt=n=>Se.get(n);var gt=n=>typeof n=="string"?Se.get(n)??Ne:n;function wt(n,e,t,r,a={}){let o=ce(e,gt(t),r,{mirrored:a.mirrored});return o.length?(n.save(),a.alpha!==void 0&&(n.globalAlpha*=Math.min(Math.max(a.alpha,0),1)),se(n,o),n.restore(),!0):!1}function vt(n,e){let t=gt(n),r=ht(),a=Ae(t),o=le(r,{x:0,y:0,w:1,h:1},{band:a}),s=-St(we(t,.05)).minY,l=Math.min(.27,.43/Math.max(s,1))*e/j[a].head/o.U,p=.5*e+Math.min(0,(s-1.6)*.06*e),i={x:e/2-o.head.x*l,y:p-o.head.y*l,w:l,h:l};return ce(r,t,i,{portrait:!0})}function At(n,e,t=.5){if(!n||n.length!==e.length)return e.slice();let r=e.slice();for(let a=0;a+2<e.length;a+=3){let o=n[a+2],s=e[a+2],u=o>=.5,l=s>=.5;u&&s>=.3&&(r[a+2]=Math.max(s,.5)),u&&l&&Math.hypot(e[a]-n[a],e[a+1]-n[a+1])<.15?(r[a]=n[a]+(e[a]-n[a])*t,r[a+1]=n[a+1]+(e[a+1]-n[a+1])*t):u&&!l&&r[a+2]>=.5&&(r[a]=n[a],r[a+1]=n[a+1])}return Mn(n,e,r,t*Sn),r}var Sn=.35,En=11;function Mn(n,e,t,r){let a=P.leftShoulder*3,o=P.rightShoulder*3,s=(f,c)=>f[c+2]>=.5;if(!s(n,a)||!s(n,o)||!s(e,a)||!s(e,o))return;let u=(f,c)=>(f[a+c]+f[o+c])/2,l=[u(n,0),u(n,1)],p=[u(e,0),u(e,1)],i=[u(t,0),u(t,1)];for(let f=0;f<En&&f*3+2<e.length;f++){let c=f*3;if(!s(n,c)||!s(e,c))continue;let x=[n[c]-l[0],n[c+1]-l[1]],d=[e[c]-p[0],e[c+1]-p[1]];Math.hypot(d[0]-x[0],d[1]-x[1])>=.15||(t[c]=i[0]+x[0]+(d[0]-x[0])*r,t[c+1]=i[1]+x[1]+(d[1]-x[1])*r)}}function St(n){let e={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},t=(r,a)=>{e.minX=Math.min(e.minX,r),e.minY=Math.min(e.minY,a),e.maxX=Math.max(e.maxX,r),e.maxY=Math.max(e.maxY,a)};for(let r of n){let a="lw"in r&&r.stroke?(r.lw??1)/2:0;switch(r.k){case"circle":t(r.x-r.r-a,r.y-r.r-a),t(r.x+r.r+a,r.y+r.r+a);break;case"ellipse":case"rect":{let o=r.k==="ellipse"?r.rx:r.w/2,s=r.k==="ellipse"?r.ry:r.h/2,u=Math.max(o,s)+a;t(r.x-u,r.y-u),t(r.x+u,r.y+u);break}case"path":{let o=Ie(r.d);for(let s=0;s+1<o.length;s+=2)t(o[s]-a,o[s+1]-a),t(o[s]+a,o[s+1]+a);break}case"line":for(let o=0;o+1<r.pts.length;o+=2)t(r.pts[o]-a,r.pts[o+1]-a),t(r.pts[o]+a,r.pts[o+1]+a);break;case"group":{let o=St(r.items);if(!Number.isFinite(o.minX))break;let s=r.s??1,u=Math.cos(r.rot??0),l=Math.sin(r.rot??0);for(let[p,i]of[[o.minX,o.minY],[o.maxX,o.minY],[o.minX,o.maxY],[o.maxX,o.maxY]])t(r.x+(p*u-i*l)*s,r.y+(p*l+i*u)*s);break}}}return e}var Pn=()=>{let n=typeof document<"u"?document.timeline?.currentTime:null;return typeof n=="number"&&Number.isFinite(n)?n:globalThis.performance?.now()??Date.now()},Et=()=>globalThis.performance?.now()??Date.now(),pe=class{constructor(e=Pn){z(this,"now",e);z(this,"known",new Map);z(this,"smoothed",new Map);z(this,"times",new WeakMap);z(this,"lerp",new be);z(this,"drawnAt",NaN);z(this,"drawn",0);z(this,"smoothedBody",(e,t={})=>{let r=t.interpolate!==!1;if(typeof e=="number"){let a=this.smoothed.get(e);return a?r?this.lerp.at(e,this.tick())??a.body:a.body:null}return typeof e!="object"||e===null||!Array.isArray(e.body)?null:this.posed(e.id,e.body,Mt(t.smooth),r)})}note(e,t,r=Et()){for(let a of e)this.known.set(a.id,this.resolve(a.id,a.avatar)),t!==void 0&&Number.isFinite(t)&&Array.isArray(a.body)&&this.times.set(a.body,{t,arrival:r})}of(e){return typeof e=="object"&&e!==null?e.avatar!==void 0?this.resolve(e.id,e.avatar):this.of(e.id):this.known.get(e)??De(e-1)}posed(e,t,r,a=!0){let o=this.smooth(e,t,r);return a?this.lerp.at(e,this.tick())??o:o}smooth(e,t,r){let a=this.smoothed.get(e);if(a&&a.raw===t&&a.amount===r)return a.body;a&&a.amount!==r&&this.lerp.forget(e);let o=r<1?At(a?.body,t,r):t;this.smoothed.set(e,{raw:t,body:o,amount:r});let s=this.times.get(t),u=s?.arrival??Et();return this.lerp.push(e,s?.t??u,o,u),o}takeDrawn(){let e=this.drawn;return this.drawn=0,e}tick(){let e=this.now();return e!==this.drawnAt&&(this.drawnAt=e,this.drawn++),e}resolve(e,t){return xt(t)?t:De(e-1)}};function Bn(n,e){let t=typeof n.getTransform=="function"?n.getTransform():null,r=t&&Math.hypot(t.a,t.b)||1,a=t&&Math.hypot(t.c,t.d)||1,o=(n.canvas?.width??0)/r,s=(n.canvas?.height??0)/a;return e?{x:e.x*o,y:e.y*s,w:e.w*o,h:e.h*s}:{x:0,y:0,w:o,h:s}}var Mt=n=>n===!1?1:typeof n=="number"?Math.min(Math.max(n,.05),1):.5;function Ee(n,e){return(t,r,a,o,s={})=>{let u=Array.isArray(r)?null:r,l=u?u.body:r;if(!Array.isArray(l))return null;let p=typeof a=="string"?a:n.of(typeof a=="number"?a:u??1),i=typeof a=="number"?a:u?.id,f=i!==void 0?n.posed(i,l,Mt(s.smooth),s.interpolate!==!1):l;return wt(t,f,p,o??Bn(t,e().view),s.alpha!==void 0?{alpha:s.alpha}:{})?f:null}}function Bt(n){let e=new Map,t=(l,p)=>e.get(l)?.forEach(i=>i(p)),r=null,a=[],o=l=>r?l(r):a.push(l),s=new pe,u=Ee(s,()=>({view:null}));return n.then(l=>{r=l;let p=new Map;l.on("gesture",i=>t(i.gesture,{player:i.player})),l.on("pause",i=>t("pause",{reason:i.reason==="distance"?"distance":"user"})),l.on("resume",()=>t("resume",{})),l.on("break-start",()=>t("break-start",{})),l.on("break-done",i=>t("break-end",{shown:i.shown})),l.onBackdrop((i,f)=>t("backdrop",{backdrop:i,view:f})),l.on("frame",i=>{t("players",{players:i.players});for(let f of i.players)t("hands",{player:f.id,left:f.leftHand,right:f.rightHand}),p.get(f.id)!==f.shape&&(p.set(f.id,f.shape),t("shape",{player:f.id,shape:f.shape}))}),t("start",Pt(l)),a.splice(0).forEach(i=>i(l))}),{on(l,p){let i=e.get(l)??new Set;return e.set(l,i),i.add(p),l==="start"&&r&&p(Pt(r)),()=>{i.delete(p)}},ready:()=>o(l=>l.ready()),score:(l,p=1)=>o(i=>i.score(p,l)),break:l=>new Promise(p=>o(i=>{i.break(l).then(p)})),end:l=>o(p=>p.end(typeof l=="number"?[{player:1,score:l,stars:2}]:l.map(i=>({player:i.player,score:i.score,stars:i.stars??2})))),keys:(l,p)=>o(i=>{qe(i,l,p)}),pointer:l=>o(p=>{Ze(p,l)}),get view(){return r?.view??null},get device(){return r?.device??null},reportStats:l=>r?.reportStats(l),toScreen:l=>r?r.toScreen(l):ge(null,l),avatarOf:l=>r?r.avatarOf(l):s.of(l),drawAvatar:(...l)=>r?r.drawAvatar(...l):u(...l),smoothedBody:(...l)=>r?r.smoothedBody(...l):s.smoothedBody(...l)}}var Pt=n=>({ageRange:n.ageRange,players:n.players,locale:n.locale,mode:n.mode,backdrop:n.backdrop,view:n.view,device:n.device});var Cn=(n=window)=>({post:e=>n.parent.postMessage(e,"*"),listen:e=>n.addEventListener("message",t=>t.source===n.parent&&e(t.data))}),Dn=1e4,Tn=1e3;function Dt(n=Cn()){return new Promise((e,t)=>{let r=new Map,a=[],o=!1,s="none",u=null,l=new Set,p=new pe,i=Ee(p,()=>({view:u})),f=p.smoothedBody,c=setTimeout(()=>t(new Error("Fabi Play: no host, is the game opened from Fabi Play?")),Dn);n.listen(x=>{if(typeof x!="object"||x===null||x.ns!==Te)return;let d=x;if(d.type==="init"&&!o){if(d.v!==1)return clearTimeout(c),t(new Error(`Fabi Play: protocol ${d.v}, this SDK speaks ${1}`));o=!0,clearTimeout(c),s=d.backdrop==="video"?"video":"none",u=Re(d.view)??null;let m=nt(d.device)??null,h={};if(d.stats===!0){let b=performance.now();setInterval(()=>{let D=performance.now();n.post(ae({type:"stats",renderFps:Math.round(p.takeDrawn()*1e3/Math.max(D-b,1)),...h})),b=D},Tn).unref?.()}e({locale:d.locale,mode:d.mode,players:d.players,muted:d.muted,ageRange:d.ageRange??"6-8",get backdrop(){return s},get view(){return u},device:m,reportStats:b=>{h=rt(b)},toScreen:b=>ge(u,b),avatarOf:b=>p.of(b),drawAvatar:i,smoothedBody:f,onBackdrop(b){return l.add(b),()=>{l.delete(b)}},on(b,w){let D=r.get(b)??new Set;return r.set(b,D),D.add(w),()=>{D.delete(w)}},ready:()=>n.post(ae({type:"ready"})),score:(b,w)=>n.post(ae({type:"score",player:b,score:w})),break:(b="level")=>new Promise(w=>{a.push(w),n.post(ae({type:"break",reason:b}))}),end:b=>n.post(ae({type:"end",scores:b}))})}else if(o){let m=d;if(d.type==="frame"&&Array.isArray(d.players)&&p.note(d.players,d.t),d.type==="backdrop"){if(d.backdrop!=="video"&&d.backdrop!=="none")return;let h=Re(d.view)??null;if(d.backdrop===s&&Rn(h,u))return;s=d.backdrop,u=h,m={type:"backdrop",backdrop:s,...u?{view:u}:{}};for(let b of[...l])b(s,u)}for(let h of r.get(d.type)??[])h(m);d.type==="break-done"&&a.shift()?.(d.shown)}else return})})}var Rn=(n,e)=>n===e||n!==null&&e!==null&&n.x===e.x&&n.y===e.y&&n.w===e.w&&n.h===e.h;var Fe={};Lt(Fe,{BAND_BODY:()=>j,DEFAULT_AVATAR:()=>Ne,avatarById:()=>kt,avatarShapes:()=>ce,drawShapes:()=>se,frameOf:()=>le,iconShapes:()=>vt});function Tt(n){let e=Dt(),t=Bt(e);n?.dataset.mute!=="manual"&&We(e);let r=Object.assign(t,{avatars:{...Fe}});window.FabiPlay=r;let a=n?.dataset.keys;a&&t.keys(Xe(a));let o=n?.dataset.pointer;return o&&t.pointer({hand:o==="left"||o==="right"?o:"any"}),n?.dataset.ready!=="manual"&&(document.readyState==="complete"?t.ready():window.addEventListener("load",()=>t.ready(),{once:!0})),r}Tt(document.currentScript);})();
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Fabi Play game manifest (fabi-play.json)",
|
|
4
|
+
"description": "What a game declares about itself, served as fabi-play.json at the game's address. Fabi Play checks it with parseManifest (@fabi-play/protocol); this schema describes the same rules for editors. See https://docs.fabiplay.app/sdk/manifest/.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["id", "version", "title", "description", "ageRanges", "movements", "players", "minutes", "entry", "sdk"],
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "For editors only: the JSON Schema this file follows. Ignored by Fabi Play."
|
|
12
|
+
},
|
|
13
|
+
"id": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The game's id in the catalogue: lowercase letters, digits and single hyphens, up to 60 characters.",
|
|
16
|
+
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
|
|
17
|
+
"maxLength": 60,
|
|
18
|
+
"examples": ["star-catcher"]
|
|
19
|
+
},
|
|
20
|
+
"version": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "The game's version, e.g. 1.0 or 1.0.2.",
|
|
23
|
+
"pattern": "^\\d+\\.\\d+(\\.\\d+)?$",
|
|
24
|
+
"examples": ["1.0"]
|
|
25
|
+
},
|
|
26
|
+
"title": {
|
|
27
|
+
"description": "The game's name in Italian and English, up to 60 characters each.",
|
|
28
|
+
"$ref": "#/definitions/texts60"
|
|
29
|
+
},
|
|
30
|
+
"description": {
|
|
31
|
+
"description": "One or two sentences in Italian and English, up to 300 characters each.",
|
|
32
|
+
"$ref": "#/definitions/texts300"
|
|
33
|
+
},
|
|
34
|
+
"ageRanges": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"description": "The age ranges the game is made for: the catalogue shows it only to players in one of them.",
|
|
37
|
+
"minItems": 1,
|
|
38
|
+
"items": { "enum": ["3-5", "6-8", "9-12"] }
|
|
39
|
+
},
|
|
40
|
+
"movements": {
|
|
41
|
+
"type": "array",
|
|
42
|
+
"description": "The movements the game is played with.",
|
|
43
|
+
"minItems": 1,
|
|
44
|
+
"items": {
|
|
45
|
+
"enum": ["hands", "jump", "squat", "clap", "freeze", "lanes", "shapes"]
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"players": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"description": "How many children can play together: from 1 to 4, min not above max.",
|
|
51
|
+
"required": ["min", "max"],
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"properties": {
|
|
54
|
+
"min": { "type": "integer", "minimum": 1, "maximum": 4 },
|
|
55
|
+
"max": { "type": "integer", "minimum": 1, "maximum": 4 }
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"minutes": {
|
|
59
|
+
"type": "number",
|
|
60
|
+
"description": "Minutes of a typical game, from 1 to 20.",
|
|
61
|
+
"minimum": 1,
|
|
62
|
+
"maximum": 20
|
|
63
|
+
},
|
|
64
|
+
"entry": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "The page that starts the game: an .html file relative to the game's address (same site, no \"..\").",
|
|
67
|
+
"pattern": "^[\\w./-]+\\.html$",
|
|
68
|
+
"not": { "pattern": "\\.\\." },
|
|
69
|
+
"examples": ["index.html"]
|
|
70
|
+
},
|
|
71
|
+
"sdk": {
|
|
72
|
+
"const": 1,
|
|
73
|
+
"description": "The protocol version of the SDK the game was built with: 1."
|
|
74
|
+
},
|
|
75
|
+
"backdrop": {
|
|
76
|
+
"type": "array",
|
|
77
|
+
"description": "Optional: the backdrops the game can draw over besides its own background. [\"video\"] opts in to mirror mode (paint no opaque background while backdrop is 'video').",
|
|
78
|
+
"uniqueItems": true,
|
|
79
|
+
"items": { "enum": ["video"] }
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"definitions": {
|
|
83
|
+
"texts60": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"required": ["it", "en"],
|
|
86
|
+
"additionalProperties": false,
|
|
87
|
+
"properties": {
|
|
88
|
+
"it": { "type": "string", "minLength": 1, "maxLength": 60, "pattern": "\\S" },
|
|
89
|
+
"en": { "type": "string", "minLength": 1, "maxLength": 60, "pattern": "\\S" }
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"texts300": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"required": ["it", "en"],
|
|
95
|
+
"additionalProperties": false,
|
|
96
|
+
"properties": {
|
|
97
|
+
"it": { "type": "string", "minLength": 1, "maxLength": 300, "pattern": "\\S" },
|
|
98
|
+
"en": { "type": "string", "minLength": 1, "maxLength": 300, "pattern": "\\S" }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|