familiar-vue 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/README.md +8 -3
- package/dist/blocks/bots/engine/plastic.d.ts +5 -0
- package/dist/blocks/bots/engine/types.d.ts +5 -3
- package/dist/blocks/bots/types-1.d.ts +2 -2
- package/dist/blocks/bots/types.d.ts +2 -2
- package/dist/blocks/gallery/GalleryGrid.vue.d.ts +46 -0
- package/dist/blocks/gallery/MusicPlayer.vue.d.ts +34 -0
- package/dist/blocks/gallery/VideoPlayer.vue.d.ts +34 -0
- package/dist/blocks/gallery/icons.d.ts +49 -0
- package/dist/blocks/gallery/index.d.ts +141 -0
- package/dist/blocks/gallery/styles.d.ts +1 -0
- package/dist/blocks/gallery/support.d.ts +38 -0
- package/dist/blocks/gallery/types.d.ts +132 -0
- package/dist/blocks/image/studio/ImageStudio.vue.d.ts +1 -1
- package/dist/blocks/jelly/JellySurface.vue.d.ts +43 -0
- package/dist/blocks/jelly/engine/color.d.ts +12 -0
- package/dist/blocks/jelly/engine/environment.d.ts +2 -0
- package/dist/blocks/jelly/engine/frosted.d.ts +25 -0
- package/dist/blocks/jelly/engine/geometry.d.ts +13 -0
- package/dist/blocks/jelly/engine/icons.d.ts +16 -0
- package/dist/blocks/jelly/engine/renderer.d.ts +39 -0
- package/dist/blocks/jelly/engine/sound.d.ts +9 -0
- package/dist/blocks/jelly/engine/textures.d.ts +5 -0
- package/dist/blocks/jelly/index.d.ts +23 -0
- package/dist/blocks/jelly/types.d.ts +68 -0
- package/dist/blocks/loading/BreathingRing.vue.d.ts +25 -0
- package/dist/blocks/loading/index.d.ts +54 -1
- package/dist/blocks/loading/types.d.ts +22 -0
- package/dist/blocks/metal/MetalBadge.vue.d.ts +2 -2
- package/dist/bots.cjs +1 -1
- package/dist/bots.js +1 -1
- package/dist/familiar-vue.css +1 -1
- package/dist/gallery.cjs +2 -0
- package/dist/gallery.cjs.map +1 -0
- package/dist/gallery.d.ts +1 -0
- package/dist/gallery.js +8 -0
- package/dist/gallery.js.map +1 -0
- package/dist/index-Bb3rhhZY.cjs +221 -0
- package/dist/index-Bb3rhhZY.cjs.map +1 -0
- package/dist/index-C96O9k0x.cjs +289 -0
- package/dist/index-C96O9k0x.cjs.map +1 -0
- package/dist/index-CgkG0Pah.js +2580 -0
- package/dist/index-CgkG0Pah.js.map +1 -0
- package/dist/index-CjA5aaxl.js +934 -0
- package/dist/index-CjA5aaxl.js.map +1 -0
- package/dist/index-CpPZg7s9.js +476 -0
- package/dist/index-CpPZg7s9.js.map +1 -0
- package/dist/{index-CQIOTNIw.js → index-Da5OgBHn.js} +1269 -1239
- package/dist/index-Da5OgBHn.js.map +1 -0
- package/dist/index-Dc4JnH_g.cjs +80 -0
- package/dist/index-Dc4JnH_g.cjs.map +1 -0
- package/dist/index-U59nAOr-.cjs +1096 -0
- package/dist/index-U59nAOr-.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +58 -49
- package/dist/index.js.map +1 -1
- package/dist/jelly.cjs +2 -0
- package/dist/jelly.cjs.map +1 -0
- package/dist/jelly.d.ts +2 -0
- package/dist/jelly.js +9 -0
- package/dist/jelly.js.map +1 -0
- package/dist/loading.cjs +1 -1
- package/dist/loading.js +4 -3
- package/package.json +11 -1
- package/dist/index-BAZi5af3.cjs +0 -221
- package/dist/index-BAZi5af3.cjs.map +0 -1
- package/dist/index-BmMsid7x.js +0 -422
- package/dist/index-BmMsid7x.js.map +0 -1
- package/dist/index-CQIOTNIw.js.map +0 -1
- package/dist/index-DZJ-MNwi.cjs +0 -80
- package/dist/index-DZJ-MNwi.cjs.map +0 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";const N=require("vue"),De={clover:{label:"Clover",color:"#41C4FF",face:"eyes",faceX:50,faceY:50,faceScale:1,brightness:1.2,saturation:1.59},flower:{label:"Flower",color:"#2FCB7A",face:"eyes",faceX:50,faceY:51,faceScale:.95},triangle:{label:"Triangle",color:"#DC48FF",face:"eyes",faceX:50,faceY:61,faceScale:.9},square:{label:"Square",color:"#35B8FF",face:"eyes",faceX:50,faceY:50,faceScale:1},blob:{label:"Blob",color:"#2FCB7A",face:"eyes",faceX:49.5,faceY:50,faceScale:1},ghost:{label:"Ghost",color:"#F4F2FA",face:"eyes",faceX:50,faceY:48,faceScale:.95},circle:{label:"Circle",color:"#9A62FF",face:"eyes",faceX:50,faceY:50,faceScale:1},drop:{label:"Drop",color:"#1ED3C6",face:"eyes",faceX:50,faceY:62,faceScale:.9},star:{label:"Star",color:"#EFDB8E",face:"eyes",faceX:50,faceY:52,faceScale:.82,brightness:1.1,saturation:1.84},droid:{label:"Droid",color:"#D5DBEA",face:"eyes",faceX:50,faceY:60,faceScale:.95},mech:{label:"Mech",color:"#95A6C4",face:"eyes",faceX:50,faceY:59,faceScale:1},alien:{label:"Alien",color:"#9CD66A",face:"eyes",faceX:50,faceY:45,faceScale:1.05},hexagon:{label:"Hexagon",color:"#EB7575",face:"eyes",faceX:50,faceY:50,faceScale:.95},cat:{label:"Cat",color:"#EAA06F",face:"eyes",faceX:50,faceY:58,faceScale:1,brightness:1.22,saturation:1.88},cloud:{label:"Cloud",color:"#CFD5E4",face:"eyes",faceX:50,faceY:58,faceScale:.95},pill:{label:"Pill",color:"#ACAAF3",face:"eyes",faceX:50,faceY:50,faceScale:.9},pebble:{label:"Pebble",color:"#ABC793",face:"eyes",faceX:50,faceY:50,faceScale:.95},puddle:{label:"Puddle",color:"#EE8BDB",face:"eyes",faceX:50,faceY:50,faceScale:.95}},Ba=Object.keys(De),Ti=["eyes","mouth"],Ii=["default","working","sleeping","happy","sleepy","questioning","loving","surprised","playful"],Li=Object.fromEntries(Ba.map(t=>[t,De[t].color])),qs={default:"idle",working:"working",sleeping:"sleeping",happy:"happy",sleepy:"sleepy",questioning:"questioning",loving:"loving",surprised:"surprised",playful:"playful"},_s={clover:"M26.53 22.38A25 25 0 0 1 73.47 22.38A7 7 0 0 0 77.62 26.53A25 25 0 0 1 77.62 73.47A7 7 0 0 0 73.47 77.62A25 25 0 0 1 26.53 77.62A7 7 0 0 0 22.38 73.47A25 25 0 0 1 22.38 26.53A7 7 0 0 0 26.53 22.38Z",flower:"M31.2 19.82A20.5 20.5 0 0 1 68.8 19.82A5 5 0 0 0 72.9 22.8A20.5 20.5 0 0 1 84.51 58.55A5 5 0 0 0 82.95 63.37A20.5 20.5 0 0 1 52.54 85.47A5 5 0 0 0 47.46 85.47A20.5 20.5 0 0 1 17.05 63.37A5 5 0 0 0 15.49 58.55A20.5 20.5 0 0 1 27.1 22.8A5 5 0 0 0 31.2 19.82Z",triangle:"M38.75 27.43A13 13 0 0 1 61.25 27.43L82.7 64.49A13 13 0 0 1 71.45 84L28.55 84A13 13 0 0 1 17.3 64.49L38.75 27.43Z",square:"M93 50C93 53.66 92.96 58.23 92.88 60.97C92.8 63.71 92.67 64.81 92.51 66.44C92.35 68.08 92.15 69.44 91.9 70.77C91.66 72.1 91.37 73.3 91.04 74.44C90.72 75.58 90.35 76.63 89.94 77.63C89.53 78.63 89.07 79.55 88.58 80.43C88.08 81.31 87.54 82.13 86.96 82.9C86.37 83.67 85.75 84.39 85.07 85.07C84.39 85.75 83.67 86.37 82.9 86.96C82.13 87.54 81.31 88.08 80.43 88.58C79.55 89.07 78.63 89.53 77.63 89.94C76.63 90.35 75.58 90.72 74.44 91.04C73.3 91.37 72.1 91.66 70.77 91.9C69.44 92.15 68.08 92.35 66.44 92.51C64.81 92.67 63.71 92.8 60.97 92.88C58.23 92.96 53.66 93 50 93C46.34 93 41.77 92.96 39.03 92.88C36.29 92.8 35.19 92.67 33.56 92.51C31.92 92.35 30.56 92.15 29.23 91.9C27.9 91.66 26.7 91.37 25.56 91.04C24.42 90.72 23.37 90.35 22.37 89.94C21.37 89.53 20.45 89.07 19.57 88.58C18.69 88.08 17.87 87.54 17.1 86.96C16.33 86.37 15.61 85.75 14.93 85.07C14.25 84.39 13.63 83.67 13.04 82.9C12.46 82.13 11.92 81.31 11.42 80.43C10.93 79.55 10.47 78.63 10.06 77.63C9.65 76.63 9.28 75.58 8.96 74.44C8.63 73.3 8.34 72.1 8.1 70.77C7.85 69.44 7.65 68.08 7.49 66.44C7.33 64.81 7.2 63.71 7.12 60.97C7.04 58.23 7 53.66 7 50C7 46.34 7.04 41.77 7.12 39.03C7.2 36.29 7.33 35.19 7.49 33.56C7.65 31.92 7.85 30.56 8.1 29.23C8.34 27.9 8.63 26.7 8.96 25.56C9.28 24.42 9.65 23.37 10.06 22.37C10.47 21.37 10.93 20.45 11.42 19.57C11.92 18.69 12.46 17.87 13.04 17.1C13.63 16.33 14.25 15.61 14.93 14.93C15.61 14.25 16.33 13.63 17.1 13.04C17.87 12.46 18.69 11.92 19.57 11.42C20.45 10.93 21.37 10.47 22.37 10.06C23.37 9.65 24.42 9.28 25.56 8.96C26.7 8.63 27.9 8.34 29.23 8.1C30.56 7.85 31.92 7.65 33.56 7.49C35.19 7.33 36.29 7.2 39.03 7.12C41.77 7.04 46.34 7 50 7C53.66 7 58.23 7.04 60.97 7.12C63.71 7.2 64.81 7.33 66.44 7.49C68.08 7.65 69.44 7.85 70.77 8.1C72.1 8.34 73.3 8.63 74.44 8.96C75.58 9.28 76.63 9.65 77.63 10.06C78.63 10.47 79.55 10.93 80.43 11.42C81.31 11.92 82.13 12.46 82.9 13.04C83.67 13.63 84.39 14.25 85.07 14.93C85.75 15.61 86.37 16.33 86.96 17.1C87.54 17.87 88.08 18.69 88.58 19.57C89.07 20.45 89.53 21.37 89.94 22.37C90.35 23.37 90.72 24.42 91.04 25.56C91.37 26.7 91.66 27.9 91.9 29.23C92.15 30.56 92.35 31.92 92.51 33.56C92.67 35.19 92.8 36.29 92.88 39.03C92.96 41.77 93 46.34 93 50Z",blob:"M93.92 50C94.18 51.9 94.24 53.9 93.99 55.79C93.73 57.68 93.18 59.61 92.39 61.36C91.6 63.1 90.48 64.78 89.27 66.27C88.07 67.76 86.58 69.08 85.14 70.29C83.7 71.49 82.1 72.5 80.62 73.5C79.14 74.49 77.64 75.34 76.24 76.24C74.84 77.15 73.51 78 72.2 78.93C70.88 79.86 69.66 80.83 68.36 81.8C67.06 82.76 65.78 83.82 64.39 84.74C63 85.67 61.55 86.63 60.01 87.35C58.47 88.08 56.82 88.73 55.15 89.1C53.48 89.47 51.71 89.64 50 89.57C48.29 89.5 46.55 89.16 44.91 88.68C43.27 88.21 41.67 87.47 40.16 86.72C38.65 85.96 37.24 85.02 35.86 84.13C34.48 83.24 33.19 82.29 31.89 81.37C30.58 80.46 29.32 79.56 28.03 78.63C26.74 77.71 25.44 76.82 24.16 75.84C22.88 74.86 21.57 73.87 20.36 72.74C19.15 71.62 17.95 70.42 16.91 69.1C15.88 67.79 14.92 66.35 14.15 64.85C13.38 63.35 12.76 61.73 12.29 60.1C11.81 58.48 11.52 56.78 11.29 55.1C11.06 53.41 10.98 51.71 10.91 50C10.83 48.29 10.83 46.59 10.83 44.84C10.84 43.1 10.85 41.34 10.93 39.53C11.02 37.72 11.09 35.86 11.34 33.99C11.59 32.12 11.88 30.16 12.43 28.31C12.99 26.46 13.69 24.56 14.66 22.88C15.64 21.21 16.86 19.58 18.27 18.27C19.69 16.96 21.4 15.84 23.17 15.03C24.93 14.22 26.95 13.71 28.89 13.43C30.83 13.15 32.9 13.21 34.82 13.36C36.74 13.5 38.66 13.92 40.43 14.28C42.2 14.65 43.87 15.16 45.46 15.54C47.06 15.93 48.52 16.31 50 16.58C51.48 16.85 52.87 17.02 54.32 17.17C55.77 17.32 57.22 17.36 58.71 17.49C60.2 17.62 61.74 17.7 63.28 17.95C64.81 18.19 66.39 18.5 67.91 18.98C69.43 19.46 70.95 20.08 72.38 20.83C73.81 21.58 75.19 22.5 76.5 23.5C77.81 24.5 79.03 25.63 80.22 26.81C81.41 27.99 82.54 29.25 83.65 30.57C84.76 31.89 85.85 33.26 86.89 34.72C87.93 36.18 88.98 37.69 89.9 39.31C90.82 40.92 91.73 42.64 92.4 44.42C93.07 46.2 93.66 48.1 93.92 50Z",ghost:"M17 50C17 31.78 31.78 17 50 17C68.22 17 83 31.78 83 50V81.5Q72 93.5 61 81.5Q50 93.5 39 81.5Q28 93.5 17 81.5Z",circle:"M50 8A42 42 0 1 1 50 92A42 42 0 1 1 50 8Z",drop:"M50 8.5C52.2 8.5 53.4 10.3 56.4 15.2C62.9 25.5 84 44.6 84 61.5C84 80.3 68.8 92 50 92C31.2 92 16 80.3 16 61.5C16 44.6 37.1 25.5 43.6 15.2C46.6 10.3 47.8 8.5 50 8.5Z",star:"M45.77 9.7A5 5 0 0 1 54.23 9.7L65.02 26.81A4 4 0 0 0 67.42 28.55L87.02 33.53A5 5 0 0 1 89.63 41.57L76.7 57.12A4 4 0 0 0 75.78 59.94L77.11 80.12A5 5 0 0 1 70.26 85.09L51.48 77.59A4 4 0 0 0 48.52 77.59L29.74 85.09A5 5 0 0 1 22.89 80.12L24.22 59.94A4 4 0 0 0 23.3 57.12L10.37 41.57A5 5 0 0 1 12.98 33.53L32.58 28.55A4 4 0 0 0 34.98 26.81L45.77 9.7Z",droid:"M16 50C16 38.95 24.95 30 36 30H64C75.05 30 84 38.95 84 50V70C84 81.05 75.05 90 64 90H36C24.95 90 16 81.05 16 70ZM4 62A7 7 0 1 1 18 62A7 7 0 1 1 4 62ZM82 62A7 7 0 1 1 96 62A7 7 0 1 1 82 62Z",mech:"M10 48C10 38.06 18.06 30 28 30H72C81.94 30 90 38.06 90 48V70C90 79.94 81.94 88 72 88H28C18.06 88 10 79.94 10 70ZM3 54C3 51.79 4.79 50 7 50H11V72H7C4.79 72 3 70.21 3 68ZM89 50H93C95.21 50 97 51.79 97 54V68C97 70.21 95.21 72 93 72H89Z",alien:"M50 10C70 10 83 27 83 46C83 65 64 92 50 92C36 92 17 65 17 46C17 27 30 10 50 10Z",hexagon:"M91.4 45.5A9 9 0 0 1 91.4 54.5L74.6 83.61A9 9 0 0 1 66.8 88.11L33.2 88.11A9 9 0 0 1 25.4 83.61L8.6 54.5A9 9 0 0 1 8.6 45.5L25.4 16.39A9 9 0 0 1 33.2 11.89L66.8 11.89A9 9 0 0 1 74.6 16.39L91.4 45.5Z",cat:"M50 20A36 36 0 1 1 50 92A36 36 0 1 1 50 20ZM24.72 44.64A4.5 4.5 0 0 1 17.35 40.67L20.21 16.66A4.5 4.5 0 0 1 26.86 13.26L42.3 21.83A4.5 4.5 0 0 1 43.02 29.21L24.72 44.64ZM82.65 40.67A4.5 4.5 0 0 1 75.28 44.64L56.98 29.21A4.5 4.5 0 0 1 57.7 21.83L73.14 13.26A4.5 4.5 0 0 1 79.79 16.66L82.65 40.67Z",cloud:"M19 44A25 25 0 1 1 69 44A25 25 0 1 1 19 44ZM47 50A21 21 0 1 1 89 50A21 21 0 1 1 47 50ZM7 68A17 17 0 1 1 41 68A17 17 0 1 1 7 68ZM32 73A18 18 0 1 1 68 73A18 18 0 1 1 32 73ZM60 70A16 16 0 1 1 92 70A16 16 0 1 1 60 70Z",pill:"M28 28H72C84.15 28 94 37.85 94 50C94 62.15 84.15 72 72 72H28C15.85 72 6 62.15 6 50C6 37.85 15.85 28 28 28Z",pebble:"M94.6 50C94.71 51.92 94.56 53.93 94.17 55.82C93.79 57.7 93.13 59.6 92.28 61.33C91.44 63.06 90.32 64.72 89.1 66.19C87.87 67.67 86.41 69.01 84.92 70.16C83.42 71.31 81.75 72.29 80.11 73.1C78.47 73.92 76.73 74.55 75.06 75.06C73.39 75.58 71.7 75.91 70.1 76.2C68.5 76.48 66.93 76.62 65.45 76.76C63.96 76.9 62.55 76.94 61.2 77.03C59.84 77.11 58.57 77.16 57.31 77.26C56.05 77.36 54.86 77.48 53.64 77.63C52.42 77.79 51.24 77.98 50 78.18C48.76 78.39 47.52 78.64 46.2 78.85C44.89 79.06 43.53 79.3 42.11 79.46C40.69 79.61 39.2 79.75 37.67 79.77C36.14 79.78 34.54 79.74 32.95 79.54C31.35 79.33 29.7 79.03 28.1 78.55C26.49 78.07 24.86 77.45 23.33 76.67C21.8 75.88 20.29 74.94 18.92 73.85C17.54 72.77 16.23 71.51 15.08 70.16C13.94 68.8 12.9 67.29 12.04 65.72C11.17 64.16 10.45 62.46 9.91 60.74C9.36 59.03 8.98 57.22 8.76 55.43C8.55 53.64 8.5 51.8 8.6 50C8.71 48.2 8.98 46.39 9.38 44.65C9.79 42.91 10.35 41.19 11.02 39.56C11.7 37.92 12.52 36.34 13.43 34.85C14.34 33.37 15.39 31.96 16.5 30.66C17.61 29.36 18.84 28.15 20.11 27.07C21.39 25.98 22.76 25 24.15 24.15C25.54 23.3 27.01 22.56 28.48 21.95C29.94 21.33 31.46 20.85 32.95 20.46C34.44 20.08 35.95 19.83 37.43 19.66C38.91 19.48 40.38 19.43 41.81 19.43C43.24 19.43 44.64 19.53 46.01 19.66C47.37 19.78 48.7 19.98 50 20.18C51.3 20.39 52.57 20.63 53.83 20.87C55.1 21.11 56.34 21.37 57.6 21.62C58.87 21.87 60.13 22.12 61.43 22.39C62.74 22.66 64.07 22.93 65.45 23.24C66.83 23.56 68.25 23.88 69.72 24.3C71.19 24.72 72.71 25.17 74.25 25.75C75.78 26.34 77.37 27 78.91 27.81C80.46 28.63 82.04 29.56 83.5 30.66C84.97 31.75 86.43 33 87.7 34.38C88.98 35.77 90.19 37.32 91.17 38.97C92.14 40.62 92.98 42.43 93.56 44.27C94.13 46.1 94.5 48.08 94.6 50Z",puddle:"M85.34 50C85.65 51.54 85.9 53.13 86.01 54.74C86.11 56.35 86.11 58 85.95 59.63C85.8 61.26 85.51 62.93 85.07 64.52C84.62 66.12 84.03 67.72 83.3 69.23C82.58 70.74 81.7 72.21 80.72 73.57C79.74 74.94 78.62 76.23 77.43 77.43C76.24 78.62 74.93 79.72 73.58 80.73C72.23 81.74 70.79 82.65 69.33 83.48C67.86 84.31 66.34 85.04 64.79 85.71C63.24 86.37 61.65 86.95 60.04 87.46C58.42 87.96 56.77 88.4 55.1 88.75C53.43 89.09 51.72 89.37 50 89.54C48.28 89.71 46.52 89.81 44.76 89.76C43.01 89.72 41.22 89.58 39.47 89.29C37.72 89 35.95 88.58 34.26 88C32.57 87.42 30.89 86.69 29.33 85.8C27.77 84.92 26.26 83.87 24.91 82.7C23.56 81.53 22.3 80.19 21.23 78.77C20.16 77.35 19.22 75.79 18.47 74.2C17.71 72.61 17.13 70.91 16.7 69.23C16.26 67.55 16.02 65.81 15.88 64.13C15.75 62.45 15.78 60.76 15.88 59.14C15.97 57.52 16.21 55.94 16.45 54.42C16.7 52.89 17.03 51.43 17.34 50C17.65 48.57 18 47.2 18.32 45.83C18.63 44.46 18.94 43.13 19.24 41.76C19.53 40.39 19.79 39.03 20.08 37.61C20.36 36.18 20.62 34.74 20.95 33.23C21.28 31.72 21.61 30.16 22.07 28.57C22.52 26.98 23.02 25.32 23.69 23.69C24.35 22.06 25.11 20.38 26.05 18.79C26.99 17.21 28.08 15.62 29.33 14.2C30.58 12.78 32 11.41 33.54 10.26C35.08 9.12 36.8 8.11 38.57 7.35C40.34 6.6 42.27 6.04 44.17 5.73C46.08 5.43 48.08 5.37 50 5.54C51.92 5.71 53.87 6.15 55.69 6.75C57.52 7.36 59.3 8.22 60.94 9.19C62.57 10.15 64.11 11.33 65.51 12.56C66.91 13.78 68.17 15.15 69.33 16.52C70.48 17.89 71.5 19.34 72.44 20.76C73.38 22.18 74.19 23.62 74.97 25.03C75.75 26.43 76.44 27.83 77.12 29.19C77.8 30.56 78.42 31.89 79.05 33.23C79.67 34.57 80.28 35.87 80.87 37.21C81.46 38.55 82.05 39.88 82.6 41.27C83.14 42.65 83.68 44.05 84.14 45.51C84.6 46.96 85.03 48.46 85.34 50Z"},Ds={droid:"M47.5 14H52.5V32H47.5ZM43 11A7 7 0 1 1 57 11A7 7 0 1 1 43 11Z",mech:"M19.5 32L24.5 32L17 13L12 13ZM75.5 32L80.5 32L88 13L83 13ZM10 11.5A4.5 4.5 0 1 1 19 11.5A4.5 4.5 0 1 1 10 11.5ZM81 11.5A4.5 4.5 0 1 1 90 11.5A4.5 4.5 0 1 1 81 11.5Z"};function ge(t){const n=t.trim(),o=n.match(/^hsla?\(\s*([\d.]+)(?:deg)?[,\s]+([\d.]+)%[,\s]+([\d.]+)%/i);if(o)return Er([Number(o[1])/360,Number(o[2])/100,Number(o[3])/100]);const e=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(e){let s=e[1];s.length===3&&(s=s.split("").map(l=>l+l).join(""));const r=parseInt(s,16);return[r>>16&255,r>>8&255,r&255]}const a=n.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);return a?[Number(a[1]),Number(a[2]),Number(a[3])]:null}function ja(t){const n=ge(t);if(!n)return .5;const o=e=>{const a=e/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4};return .2126*o(n[0])+.7152*o(n[1])+.0722*o(n[2])}const Ir="#1E1A33",Lr="#F7F5F2";function Ya(t){return ja(t)<.13?Lr:Ir}function Fr([t,n,o]){t/=255,n/=255,o/=255;const e=Math.max(t,n,o),a=Math.min(t,n,o),s=(e+a)/2;if(e===a)return[0,0,s];const r=e-a,l=s>.5?r/(2-e-a):r/(e+a);let c=0;return e===t?c=(n-o)/r+(n<o?6:0):e===n?c=(o-t)/r+2:c=(t-n)/r+4,[c/6,l,s]}function Er([t,n,o]){if(n===0)return[o*255,o*255,o*255];const e=o<.5?o*(1+n):o+n-o*n,a=2*o-e,s=r=>(r=(r%1+1)%1,r<1/6?a+(e-a)*6*r:r<1/2?e:r<2/3?a+(e-a)*(2/3-r)*6:a);return[s(t+1/3)*255,s(t)*255,s(t-1/3)*255]}function $r([t,n,o]){return`hsl(${(t*360).toFixed(1)} ${(n*100).toFixed(1)}% ${(o*100).toFixed(1)}%)`}const C0=t=>Math.min(1,Math.max(0,t));function fn(t,n,o=0){const e=ge(t);if(!e)return t;const[a,s,r]=Fr(e);return $r([a,C0(s+o+(n<0?-n*.25:0)),C0(r+n)])}const ua=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4),Or=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055;function Wr(t,n,o){const e=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*o),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*o),s=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*o);return[.2104542553*e+.793617785*a-.0040720468*s,1.9779984951*e-2.428592205*a+.4505937099*s,.0259040371*e+.7827717662*a-.808675766*s]}function A0(t,n,o){const e=Math.pow(t+.3963377774*n+.2158037573*o,3),a=Math.pow(t-.1055613458*n-.0638541728*o,3),s=Math.pow(t-.0894841775*n-1.291485548*o,3);return[4.0767416621*e-3.3077115913*a+.2309699292*s,-1.2684380046*e+2.6097574011*a-.3413193965*s,-.0041960863*e-.7034186147*a+1.707614701*s]}const zr=t=>t.every(n=>n>=-1e-4&&n<=1+1e-4);function qr(t,n){const o=ge(t);if(!o||!(n>0))return t;const[e,a,s]=Wr(ua(o[0]/255),ua(o[1]/255),ua(o[2]/255)),r=Math.hypot(a,s);if(r<1e-4)return t;const l=a/r,c=s/r,h=r*(1+.5*n);let d=null,f=r;for(let i=0;i<=6;i++){const m=e*(1-.15*n*i/6);let g=0,M=h;for(let b=0;b<18;b++){const w=(g+M)/2;zr(A0(m,l*w,c*w))?g=w:M=w}if(g>f+.004*i&&(f=g,d=A0(m,l*g,c*g)),g>=h-1e-4)break}if(!d)return t;const u=d.map(i=>Math.round(255*Or(Math.min(1,Math.max(0,i)))));return`rgb(${u[0]} ${u[1]} ${u[2]})`}const Is=["default","working","sleeping"],Ls=["happy","sleepy","questioning","loving","surprised","playful"],Fi=t=>t==="working"||t==="sleeping"?t:"default",Ei=t=>Ls.includes(t)?t:null,_r={happy:.15,sleepy:.55,questioning:.6,loving:.45,surprised:.95,playful:0},$a=()=>({happy:0,sleepy:0,questioning:0,loving:0,surprised:0,playful:0}),Fs=.68,$i=26,Dr=.2,Rs={height:$i,time:Fs,stretch:1,squash:1.15,squashTime:.37,squashEase:"pulse",groundTime:.11,groundEase:"pulse",riseTime:.33,riseEase:"pulse",clickSquashTime:.24,spin:1,lean:6,every:8,land:0},Oi=(t,n)=>n?t.clickSquashTime:Dr*t.time,da=(t,n)=>Oi(t,n)+t.time+Wi[t.squashEase]*(n?t.clickSquashTime:t.squashTime)+Math.max(0,t.groundTime)+t.riseTime+Math.max(0,t.land)+.05,Wi={sharp:0,pulse:2/7,soft:.5,bouncy:.144},v0=(t,n)=>{if(t<=0)return 1;if(t>=1)return 0;switch(n){case"sharp":return(1-t)*(1-t);case"soft":return .5+.5*Math.cos(Math.PI*t);case"bouncy":return Math.exp(-3.2*t)*Math.cos(5.4*t)-t*t*t*.026;default:{const o=4.2*t;return(1+o)*Math.exp(-o)-t*t*t*.078}}},S0=(t,n)=>1+.25*zi(t,n),zi=(t,n)=>{if(t<=0||t>=1)return 0;let o;switch(n){case"sharp":o=(1-t)*(1-t);break;case"soft":o=Math.sin(Math.PI*t)**2;break;case"bouncy":o=Math.exp(-3.15*t)*Math.sin(8.43*t)/.596;break;default:{const a=7*t;o=a*a*Math.exp(2-a)/4}}const e=t>.85?1-(t-.85)/.15:1;return o*e*e*(3-2*e)},Ms=t=>Math.exp(-Math.pow(Math.min(Math.abs(t),Math.abs(t-1))/.11,2)),nn=Math.PI/180,ie=Math.PI*2,Rr={default:1.2,working:.7,sleeping:1.4},Hr=1;function Br(t){let n=t*2654435761>>>0||1;return()=>{n=n+1831565813>>>0;let o=n;return o=Math.imul(o^o>>>15,o|1),o^=o+Math.imul(o^o>>>7,o|61),((o^o>>>14)>>>0)/4294967296}}function le(t,n,o,e){return t+(n-t)*(1-Math.exp(-o*e))}const Ve=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,x0=t=>.5-.5*Math.cos(Math.PI*t);class Ne{constructor(n,o,e,a,s,r=!1){this.rand=n,this.amp=o,this.holdMin=e,this.holdMax=a,this.rate=s,this.spring=r}rand;amp;holdMin;holdMax;rate;spring;value=0;vel=0;target=0;next=0;update(n,o){if(n>=this.next&&(this.target=(this.rand()*2-1)*this.amp,this.next=n+this.holdMin+this.rand()*(this.holdMax-this.holdMin)),this.spring){const e=this.rate*1.6,a=.9;this.vel+=(e*e*(this.target-this.value)-2*a*e*this.vel)*o,this.value+=this.vel*o}else this.value=le(this.value,this.target,this.rate,o)}aim(n){this.target=n,this.next=1/0}set(n,o,e,a){this.amp=n,this.holdMin=o,this.holdMax=e,this.rate=a,this.next=0}}class re{constructor(n){this.duration=n}duration;p=-1;fire(){this.p=0}get active(){return this.p>=0}update(n){this.p<0||(this.p+=n/this.duration,this.p>=1&&(this.p=-1))}}const P0=35*nn,T0=14*nn,I0=3.2*nn,L0=2.6,jr=4.4,qi={default:{pitch:0,roll:0,y:0,lookX:0,lookY:0},working:{pitch:5*nn,roll:0,y:0,lookX:0,lookY:0},sleeping:{pitch:-16*nn,roll:6*nn,y:3,lookX:0,lookY:1}};class Xa{pose={yaw:0,pitch:0,roll:0,x:0,y:0,sx:1,sy:1,eyeOpen:1,blinkL:0,blinkR:0,lookX:0,lookY:0,breath:0,laugh:0,whirl:0,whirlAngle:0,w:[1,0,0],mood:$a(),winkL:0,winkR:0,drowse:0,beat:0,startle:0,t:0};state="default";motion="default";mood=null;moodW=$a();winkEv=new re(.6);winkAt=0;winkSide=1;startleEv=new re(.8);startleAt=0;jerkEv=new re(.5);drowsePhase=0;beatPhase=0;playPhase=0;rand;t=0;wFrom=[1,0,0];tr=1;trDuration=1.2;yawW;pitchW;rollW;lookXW;lookYW;blink=new re(.17);blinkAt;blinkAgain=!1;dart=new re(.12);dartAt;dartX=0;dartY=0;flip=new re(da(Rs,!1));flipPoked=!1;jump={...Rs};flipAt;flipSide=1;nod=new re(1.7);nodAt;hopPhase=0;hopCount=0;hopGain=0;laughEv=new re(.8);laughAt;prevYaw=0;jelly=0;jellyV=0;gazeLead=0;gazeDir=[0,0];gazeAt=0;turnK=1;breathPhase=0;ptrX=0;ptrY=0;ptrS=0;ptrTargetX=0;ptrTargetY=0;ptrTargetS=0;baseYaw=0;constructor(n,o="default"){this.rand=Br(Math.floor(n*1e6)+1);const e=this.rand;this.yawW=new Ne(e,36*nn,1.1,2.6,3,!0),this.pitchW=new Ne(e,10*nn,1.1,2.6,2.6,!0),this.rollW=new Ne(e,5*nn,1.6,3.2,2,!0),this.lookXW=new Ne(e,3.6,.5,2,14),this.lookYW=new Ne(e,2.4,.5,2,14),this.t=e()*10,this.hopPhase=e(),this.breathPhase=e(),this.blinkAt=this.t+1+e()*3,this.flipAt=this.nextFlip(this.t,1),this.nodAt=this.t+3+e()*4,this.dartAt=this.t+1+e()*2,this.laughAt=this.t+.6+e()*1.5,this.setState(o,!0)}setState(n,o=!1){if(n===this.state&&!o)return;const e=this.motion;this.state=n,this.motion=Fi(n),this.mood=Ei(n);const a=this.pose.w;if(o)for(const r of Ls)this.moodW[r]=this.mood===r?1:0;if(this.mood&&this.enterMood(this.mood,o),!o&&this.motion===e)return;const s=this.motion;if(o){for(let r=0;r<3;r++)a[r]=Is[r]===s?1:0;this.tr=1}else this.wFrom=[a[0],a[1],a[2]],this.tr=0,this.trDuration=e==="sleeping"?Hr:Rr[s];switch(s){case"default":this.yawW.set(P0,2.6,5.4,2),this.pitchW.set(T0,2.8,5.8,1.8),this.rollW.set(I0,3.4,6.6,1.5),this.gazeAt=0,this.gazeDir=[0,0],this.lookXW.set(3.6,.6,2.2,13),this.lookYW.set(2.4,.6,2.2,13),this.flipAt=this.nextFlip(this.t,.6);break;case"working":this.yawW.set(16*nn,.9,1.8,4),this.pitchW.set(3*nn,1.2,2.4,3),this.rollW.set(0,1,2,3),this.lookXW.set(2,.5,1.2,12),this.lookYW.set(1,.5,1.2,12),this.hopPhase=0,this.hopCount=0,this.laughAt=this.t+.5+this.rand()*1.2;break;case"sleeping":this.yawW.set(7*nn,3,6,.7),this.pitchW.set(3*nn,3,6,.7),this.rollW.set(2*nn,3,6,.6),this.lookXW.set(0,2,4,2),this.lookYW.set(0,2,4,2),this.nodAt=this.t+2.5+this.rand()*4;break}}enterMood(n,o){const e=this.t,a=this.rand;switch(n){case"happy":this.winkAt=e+(o?.4:.5)+a()*.8;break;case"playful":this.winkAt=e+.3+a()*.5,this.playPhase=0;break;case"sleepy":this.drowsePhase=o?.5:0;break;case"surprised":o||this.startleEv.fire(),this.startleAt=e+5+a()*3;break}}setPointer(n,o,e){this.ptrTargetX=Math.max(-1.2,Math.min(1.2,n)),this.ptrTargetY=Math.max(-1.2,Math.min(1.2,o)),this.ptrTargetS=Math.max(0,Math.min(1,e))}poke(){this.flip.active&&this.flip.p<.6||(this.flipPoked=!0,this.flip.duration=da(this.jump,!0),this.flipSide=this.rand()<.5?-1:1,this.flip.fire(),this.flipAt=this.nextFlip(this.t,1.1))}setTurn(n){const o=Math.max(0,n);o!==this.turnK&&(this.turnK=o,this.motion==="default"&&(this.gazeAt=0))}setJump(n){const o=this.jump.every;Object.assign(this.jump,n),n.every!==void 0&&n.every!==o&&(this.flipAt=this.nextFlip(this.t,1))}nextGaze(){const n=this.rand,[o,e]=this.gazeDir;if(o!==0||e!==0){const s=n();return s<.66?[-o,-e]:s<.85?[-o,e]:[0,0]}const a=[[1,-1],[-1,1],[-1,-1],[1,1]];return a[Math.floor(n()*a.length)]}nextFlip(n,o){const e=this.jump.every;return e>0?n+e*o*(.625+this.rand()*.75):1/0}update(n){n=Math.min(n,.05),this.t+=n;const o=this.t,e=this.pose,a=e.w;if(this.tr<1){this.tr=Math.min(1,this.tr+n/this.trDuration);const q=x0(this.tr);for(let F=0;F<3;F++){const bt=Is[F]===this.motion?1:0;a[F]=this.wFrom[F]+(bt-this.wFrom[F])*q}}const[s,r,l]=a,c=this.moodW;let h=0;for(const q of Ls)c[q]=le(c[q],this.mood===q?1:0,6,n),c[q]<.002&&(c[q]=0),h=Math.max(h,c[q]*_r[q]);const d={pitch:0,roll:0,y:0,lookX:0,lookY:0};for(let q=0;q<3;q++){const F=qi[Is[q]];d.pitch+=F.pitch*a[q],d.roll+=F.roll*a[q],d.y+=F.y*a[q],d.lookX+=F.lookX*a[q],d.lookY+=F.lookY*a[q]}if(this.motion==="default"&&o>=this.gazeAt){const[q,F]=this.nextGaze();this.gazeDir=[q,F];const bt=.84+this.rand()*.16;this.yawW.aim(q*P0*bt*this.turnK),this.pitchW.aim(F*T0*bt),this.rollW.aim(q*I0*bt*this.turnK),this.gazeAt=o+L0+this.rand()*(jr-L0)}this.yawW.update(o,n),this.pitchW.update(o,n),this.rollW.update(o,n),this.lookXW.update(o,n),this.lookYW.update(o,n),this.ptrS=le(this.ptrS,this.ptrTargetS,8,n),this.ptrX=le(this.ptrX,this.ptrTargetX,14,n),this.ptrY=le(this.ptrY,this.ptrTargetY,14,n);const f=this.ptrS,u=(1-.75*f)*(1-h);this.baseYaw=le(this.baseYaw,this.yawW.value*u+22*nn*this.ptrX*f,5,n);const i=d.pitch+this.pitchW.value*u-12*nn*this.ptrY*f,m=d.roll+this.rollW.value*u,g=d.y,M=d.lookX+this.lookXW.value*u+4.5*this.ptrX*f,b=d.lookY+this.lookYW.value*u+3*this.ptrY*f;let w=0,v=0,y=1,C=1,p=0,k=0,A=0,S=0,E=0,I=0,z=0,x=0;const $=(q,F,bt)=>{const H=Math.min(1,Math.max(0,(bt-q)/(F-q)));return H*H*(3-2*H)},T=q=>$(.1,.26,q)*(1-$(.66,.9,q)),L=q=>ie*(1.5*q+.9*Ve(q));if(o>=this.blinkAt&&!this.blink.active&&s+r>.5&&c.surprised<.3&&(this.blink.fire(),this.blinkAgain=!this.blinkAgain&&this.rand()<.22,this.blinkAt=o+(this.blinkAgain?.28:2.2+this.rand()*2.6)),this.blink.update(n),this.blink.active&&(A=Math.sin(Math.PI*this.blink.p)),o>=this.dartAt&&!this.dart.active&&s+r>.5&&(this.dart.fire(),this.dartX=(this.rand()*2-1)*4,this.dartY=(this.rand()*2-1)*2,this.dart.duration=.25+this.rand()*.45,this.dartAt=o+1.2+this.rand()*2.6),this.dart.update(n),this.dart.active){const q=this.dart.p,F=q<.15?q/.15:q>.8?(1-q)/.2:1;S+=this.dartX*F*(s+r)*(1-h),E+=this.dartY*F*(s+r)*(1-h)}const O=!this.mood||this.mood==="happy"||this.mood==="playful";if(this.motion==="default"&&O&&o>=this.flipAt&&!this.flip.active&&(this.flipPoked=!1,this.flip.duration=da(this.jump,!1),this.flipSide=this.rand()<.5?-1:1,this.flip.fire(),this.flipAt=this.nextFlip(o,1)),this.flip.update(n),this.flip.active){const q=this.jump,F=Oi(q,this.flipPoked),bt=(this.flip.p*this.flip.duration-F)/q.time,H=Math.min(1,Math.max(0,bt)),Et=Math.sin(Math.PI*H);w+=ie*q.spin*Ve(H),v-=q.height*Et;const Lt=(bt-1)*q.time-q.land,Cn=this.flipPoked?q.clickSquashTime:q.squashTime,_t=St=>this.flipPoked?St*St*(3-2*St):Ms(St-1),Mn=Math.max(0,q.groundTime),an=Wi[q.squashEase]*Cn,gn=Lt-an-Mn,Ot=Lt<=an?zi(Lt/Cn,q.squashEase):gn<=0?S0((Lt-an)/Mn,q.groundEase):v0(gn/q.riseTime,q.riseEase),Rt=(bt<0?_t(Math.max(0,1+bt*q.time/F)):Lt>0?Ot:bt<.2?Ms(bt):0)*q.squash;y+=.16*Rt-.06*Et*q.stretch,C+=-.18*Rt+.09*Et*q.stretch,k+=this.flipSide*q.lean*nn*Et,q.spin>0&&(I=Math.max(I,Et),z=Math.max(z,T(H)),x=L(H))}const _=this.jump,D=Math.max(0,_.groundTime),W=D+_.riseTime;if(this.motion==="working"&&(this.hopGain=r),this.hopGain>.02&&(this.motion==="working"||this.hopPhase>0)){this.hopPhase+=n/Fs,this.hopPhase>=1&&(this.motion==="working"?(this.hopPhase-=1,this.hopCount+=1):(this.hopPhase-1)*Fs>=W&&(this.hopPhase=0,this.hopGain=0));const q=this.hopGain,F=Math.min(1,this.hopPhase),bt=Math.sin(Math.PI*F),H=this.hopCount%3===2;v-=(H?$i:18)*bt*q;const Lt=this.motion!=="working"&&this.hopPhase>1?(this.hopPhase-1)*Fs:-1,Cn=Lt<0?Ms(this.hopPhase):Lt<D?S0(Lt/D,_.groundEase):v0((Lt-D)/_.riseTime,_.riseEase);y+=(.16*Cn-.06*bt)*q,C+=(-.18*Cn+.09*bt)*q,H&&(w+=ie*Ve(F)*q,I=Math.max(I,bt*q),T(F)*q>z&&(z=T(F)*q,x=L(F))),k+=(this.hopCount%2===0?1:-1)*6*nn*bt*q}if(this.motion==="working"&&o>=this.laughAt&&!this.laughEv.active&&(this.laughEv.fire(),this.laughEv.duration=.6+this.rand()*.5,this.laughAt=o+1.6+this.rand()*2.2),this.laughEv.update(n),this.laughEv.active){const q=this.laughEv.p;I=Math.max(I,q<.18?q/.18:q>.78?(1-q)/.22:1)}if(this.motion==="sleeping"&&o>=this.nodAt&&!this.nod.active&&(this.nod.fire(),this.nodAt=o+4+this.rand()*4),this.nod.update(n),this.nod.active){const q=this.nod.p,F=q<.72?Ve(q/.72):1-Ve((q-.72)/.28);p-=13*nn*F*l}let K=0,Z=0,nt=0,dt=0,pt=0;if((this.mood==="happy"||this.mood==="playful")&&o>=this.winkAt&&!this.winkEv.active){const q=this.mood==="playful";this.winkEv.duration=q?.7:.62,this.winkEv.fire(),this.winkSide=q?-this.winkSide:this.rand()<.8?1:-1,this.winkAt=o+(q?1.1+this.rand()*.7:2.4+this.rand()*2.4)}if(this.winkEv.update(n),this.winkEv.active){const q=this.winkEv.p,F=(q<.2?q/.2:q>.72?(1-q)/.28:1)*Math.min(1,c.happy+c.playful);this.winkSide>0?Z=F:K=F,k+=this.winkSide*5*nn*F}if(c.happy>0&&(k+=2.4*nn*Math.sin(o*1.6)*c.happy,v-=1.3*Math.abs(Math.sin(o*3.1))*c.happy,C+=.012*Math.sin(o*6.2)*c.happy),c.playful>0){this.playPhase+=n/.8;const q=this.playPhase%1,F=Math.sin(Math.PI*q),bt=Ms(q);v-=9*F*c.playful,y+=(.12*bt-.04*F)*c.playful,C+=(-.14*bt+.06*F)*c.playful,k+=(Math.floor(this.playPhase)%2?1:-1)*6*nn*F*c.playful}if(c.sleepy>0||this.mood==="sleepy"){this.drowsePhase+=n/3.4,this.drowsePhase>=1&&(this.drowsePhase=0,this.jerkEv.fire()),this.jerkEv.update(n),nt=.3+.62*x0(Math.min(1,this.drowsePhase));let q=0;if(this.jerkEv.active){const F=this.jerkEv.p;nt=F<.25?.92-.77*(F/.25):.15+.15*((F-.25)/.75),q=F<.25?F/.25:1-(F-.25)/.75}p+=(-11*nn*(nt-.3)+5*nn*q)*c.sleepy,k+=3*nn*Math.sin(o*.7)*c.sleepy}if(c.questioning>0&&(k+=(9*nn+2.5*nn*Math.sin(o*.9))*c.questioning,p+=3*nn*c.questioning,S+=2.4*c.questioning,E-=1.8*c.questioning),c.loving>0){this.beatPhase+=n/.85;const q=this.beatPhase%1;dt=Math.exp(-(((q-.12)/.07)**2))+.55*Math.exp(-(((q-.32)/.08)**2)),dt=Math.min(1,dt),y+=.03*dt*c.loving,C+=.04*dt*c.loving,v-=1.5*dt*c.loving,k+=3.5*nn*Math.sin(o*1.25)*c.loving}if(this.mood==="surprised"&&o>=this.startleAt&&!this.startleEv.active&&(this.startleEv.fire(),this.startleAt=o+5.5+this.rand()*3),this.startleEv.update(n),c.surprised>0){let q=.25;if(this.startleEv.active){const F=this.startleEv.p,bt=Math.sin(Math.PI*Math.min(1,F/.46)),H=Math.exp(-(((F-.48)/.1)**2));v-=12*bt*c.surprised,y+=(-.06*bt+.14*H)*c.surprised,C+=(.12*bt-.16*H)*c.surprised,q=1-.6*F}p+=5*nn*c.surprised,pt=q}this.breathPhase+=n/(3.6+1.2*l);const j=Math.sin(this.breathPhase*ie);e.breath=j,y+=j*(.008+.014*l),C+=j*(.012+.02*l);const V=Math.sin(o*ie/3.4)*2*(1-l);e.yaw=this.baseYaw+w;let U=this.baseYaw-this.prevYaw;U=((U+Math.PI)%ie+ie)%ie-Math.PI,this.prevYaw=this.baseYaw;const It=n>0?Math.abs(U)/n:0,Y=n>0?Math.max(-2.2,Math.min(2.2,U/n*2.4)):0;this.gazeLead=le(this.gazeLead,Y,9,n);const lt=Math.min(.22,.055*It),ft=16,Pt=.45;this.jellyV+=(ft*ft*(lt-this.jelly)-2*Pt*ft*this.jellyV)*n,this.jelly+=this.jellyV*n;const it=Math.max(-.08,Math.min(.28,this.jelly))*.6;y*=1+it,C*=1-.55*it,e.pitch=i+p,e.roll=m+k,e.x=0,e.y=g+v+V,e.sx=y,e.sy=C,e.eyeOpen=1,e.laugh=le(e.laugh,I,30,n),e.blinkL=A,e.blinkR=A,e.lookX=M+S+this.gazeLead,e.lookY=b+E,e.whirl=z,e.whirlAngle=x;for(const q of Ls)e.mood[q]=c[q];e.winkL=K,e.winkR=Z,e.drowse=nt,e.beat=dt,e.startle=pt,e.t=o}}const Yr={happy:{roll:-3*nn,winkR:1},sleepy:{pitch:-9*nn,roll:4*nn,drowse:.7},questioning:{pitch:3*nn,roll:9*nn,lookX:2.4,lookY:-1.8},loving:{roll:4*nn},surprised:{pitch:5*nn,startle:.5},playful:{roll:-5*nn,winkR:1}};function Hs(t){const n=Fi(t),o=Ei(t),e=qi[n],a=o?Yr[o]:{},s=$a();return o&&(s[o]=1),{yaw:0,pitch:e.pitch+(a.pitch??0),roll:e.roll+(a.roll??0),x:0,y:e.y,sx:1,sy:1,eyeOpen:1,blinkL:0,blinkR:0,lookX:e.lookX+(a.lookX??0),lookY:e.lookY+(a.lookY??0),breath:0,laugh:0,whirl:0,whirlAngle:0,w:Is.map(r=>r===n?1:0),mood:s,winkL:a.winkL??0,winkR:a.winkR??0,drowse:a.drowse??0,beat:0,startle:a.startle??0,t:.5}}const st=3,zt=100+2*st,Qt=64,_i=Qt,Es=Qt*Qt,Oo=24,Di=1e12,Ri=48*Math.PI/180,F0=Math.cos(Ri),Xr=Math.sin(Ri);function E0(t,n,o,e,a,s){let r=0;a[0]=0,s[0]=-1e30,s[1]=1e30;for(let l=1;l<n;l++){let c=0;for(;;){const h=a[r];if(c=(t[l]+l*l-t[h]-h*h)/(2*(l-h)),c>s[r])break;r--}r++,a[r]=l,s[r]=c,s[r+1]=1e30}r=0;for(let l=0;l<n;l++){for(;s[r+1]<l;)r++;const c=a[r];o[l]=(l-c)*(l-c)+t[c],e[l]=c}}function Oa(t,n,o,e,a){const s=new Float32Array(o),r=new Float32Array(o),l=new Int32Array(o),c=new Int32Array(o),h=new Float32Array(o+1),d=new Float32Array(o*o),f=new Int32Array(o*o);for(let u=0;u<o;u++){for(let i=0;i<o;i++)s[i]=t[i*o+u]===n?0:Di;E0(s,o,r,l,c,h);for(let i=0;i<o;i++)d[i*o+u]=r[i],f[i*o+u]=l[i]}for(let u=0;u<o;u++){const i=u*o;for(let m=0;m<o;m++)s[m]=d[i+m];E0(s,o,r,l,c,h);for(let m=0;m<o;m++)e[i+m]=r[m],a&&(a[i+m]=f[i+l[m]]*o+l[m])}}function pa(t,n,o){for(let e=0;e<n;e++){const a=e*n;for(let s=0;s<n;s++){const r=s<2?0:s-2,l=s<1?0:s-1,c=s>n-2?n-1:s+1,h=s>n-3?n-1:s+2;o[a+s]=(t[a+r]+4*t[a+l]+6*t[a+s]+4*t[a+c]+t[a+h])*.0625}}for(let e=0;e<n;e++)for(let a=0;a<n;a++){const s=a<2?0:a-2,r=a<1?0:a-1,l=a>n-2?n-1:a+1,c=a>n-3?n-1:a+2;t[a*n+e]=(o[s*n+e]+4*o[r*n+e]+6*o[a*n+e]+4*o[l*n+e]+o[c*n+e])*.0625}}function Gr(t,n,o){const e=[];for(let s=n,r=1;r<=4&&s%2===0||r===1;s>>=1,r<<=1){const l=new Uint8Array(s*s);for(let c=0;c<s;c++)for(let h=0;h<s;h++){let d=0;for(let f=0;f<r;f++)for(let u=0;u<r;u++)d+=t[(c*r+f)*n+h*r+u];l[c*s+h]=d>=128*r*r?1:0}if(e.push({n:s,mask:l,phi:new Float32Array(s*s)}),r===4)break}const a=(s,r,l,c)=>{const{n:h,mask:d,phi:f}=s,u=r*r;for(let i=0;i<l;i++)for(let m=1;m<h-1;m++){const g=m*h;for(let M=1;M<h-1;M++){const b=g+M;if(!d[b])continue;const w=(f[b-1]+f[b+1]+f[b-h]+f[b+h]+u)*.25;f[b]+=c*(w-f[b])}}};for(let s=e.length-1;s>=0;s--){const r=e[s],l=1<<s;if(s<e.length-1){const h=e[s+1],d=r.n,f=h.n;for(let u=0;u<d;u++){const i=Math.min(f-1,Math.max(0,(u+.5)/2-.5)),m=i|0,g=Math.min(f-1,m+1),M=i-m;for(let b=0;b<d;b++){const w=u*d+b;if(!r.mask[w])continue;const v=Math.min(f-1,Math.max(0,(b+.5)/2-.5)),y=v|0,C=Math.min(f-1,y+1),p=v-y;r.phi[w]=(h.phi[m*f+y]*(1-p)+h.phi[m*f+C]*p)*(1-M)+(h.phi[g*f+y]*(1-p)+h.phi[g*f+C]*p)*M}}}const c=Math.min(1.9,2/(1+Math.sin(Math.PI/r.n))-.05);a(r,o*l,4,1),a(r,o*l,s===2?100:s===1?30:16,c),a(r,o*l,8,1)}return e[0].phi}const Kr=[1,1,0,-1,-1,-1,0,1],Vr=[0,1,1,1,0,-1,-1,-1],Nr=[1,Math.SQRT2,1,Math.SQRT2,1,Math.SQRT2,1,Math.SQRT2];function Ga(t,n,o){const e=zt/n,a=n*n,s=new Uint8Array(a);for(let S=0;S<a;S++)s[S]=t[S]>=128?1:0;const r=new Float32Array(a),l=new Float32Array(a),c=new Int32Array(a);Oa(s,0,n,r,null),Oa(s,1,n,l,c);const h=new Float32Array(a),d=new Float32Array(a);for(let S=0;S<a;S++){const E=t[S]/255;h[S]=e*(E>0&&E<1?E-.5:s[S]?Math.sqrt(r[S])-.5:.5-Math.sqrt(l[S]))}pa(h,n,d),pa(h,n,d);const f=Gr(t,n,e);let u=0;for(let S=0;S<a;S++)f[S]>u&&(u=f[S]);const i=2*Math.sqrt(u),m=Math.min(1.5*o+.32*i,1.4*i),g=u>0?m/Math.sqrt(u):0,M=new Float32Array(a);for(let S=0;S<a;S++)M[S]=f[S]>0?g*Math.sqrt(f[S]):0;pa(M,n,d);const b={N:n,i00:new Uint16Array(a),wx:new Uint8Array(a),wy:new Uint8Array(a),ao:new Uint8Array(a),sd:h,h:M},{i00:w,wx:v,wy:y,ao:C}=b,p=n<=64?[1,2,3,5,8]:n<=96?[1,2,4,7,11]:[1,2,4,7,11,15],k=64,A=n-1;for(let S=0;S<n;S++)for(let E=0;E<n;E++){const I=S*n+E,z=s[I]?I:l[I]<=k?c[I]:-1;if(z<0)continue;const x=z%n,$=(z-x)/n,T=x>0?x-1:0,L=x<A?x+1:A,O=$>0?$-1:0,_=$<A?$+1:A;let D=-(M[$*n+L]-M[$*n+T])/(2*e),W=-(M[_*n+x]-M[O*n+x])/(2*e),K=1,Z=Math.sqrt(D*D+W*W+1);D/=Z,W/=Z,K/=Z;const nt=Math.max(0,h[z]);if(nt<2){let ft=h[$*n+L]-h[$*n+T],Pt=h[_*n+x]-h[O*n+x];const it=Math.hypot(ft,Pt)||1;ft/=it,Pt/=it;const q=.7*(1-nt/2);D+=q*(-ft-D),W+=q*(-Pt-W),K+=q*(0-K),Z=Math.sqrt(D*D+W*W+K*K)||1,D/=Z,W/=Z,K/=Z}const dt=M[z];let pt=0;for(let ft=0;ft<8;ft++){let Pt=0;for(let it=0;it<p.length;it++){const q=p[it];let F=x+Kr[ft]*q,bt=$+Vr[ft]*q;F<0?F=0:F>A&&(F=A),bt<0?bt=0:bt>A&&(bt=A);const H=(M[bt*n+F]-dt)/(q*e*Nr[ft]);H>Pt&&(Pt=H)}pt+=Pt/Math.sqrt(1+Pt*Pt)}const At=1-Math.min(1,nt/3),j=1-.2*At*At,V=Math.pow(1-.9*pt/8,1.5)*j;C[I]=Math.max(1,Math.round(255*Math.pow(V,1/2.2)));const U=(D*.5+.5)*(Qt-1),It=(W*.5+.5)*(Qt-1),Y=Math.min(Qt-2,Math.max(0,U|0)),lt=Math.min(Qt-2,Math.max(0,It|0));w[I]=lt*Qt+Y,v[I]=Math.round(255*Math.min(1,Math.max(0,U-Y))),y[I]=Math.round(255*Math.min(1,Math.max(0,It-lt)))}return b}function Wn(t){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(t,t);if(typeof document<"u"){const n=document.createElement("canvas");return n.width=n.height=t,n}return null}function Ln(t,n){return t.getContext("2d",n?{willReadFrequently:!0}:void 0)}function Hi(t,n){const o=Wn(n),e=o&&Ln(o,!0);if(!e)return null;const a=zt/n;e.setTransform(1/a,0,0,1/a,st/a,st/a),e.fillStyle="#fff",e.fill(t);const s=e.getImageData(0,0,n,n).data,r=new Uint8ClampedArray(n*n);for(let l=0;l<n*n;l++)r[l]=s[l*4+3];return r}const Ce=new Map,$s=new Set,$0=new WeakMap;let Zr=0;function ma(t){let n=$0.get(t);return n||$0.set(t,n=`p${Zr++}`),n}const Qe=[];let Wa=!1;const Ur=6,Ma=()=>typeof performance<"u"?performance.now():Date.now(),Qr=20;let ts=0;function Os(t){Wa=!1;const n=Ma();let o=Qe.shift();for(;o&&(o(),!((ts>0?Qr-(Ma()-n):t&&!t.didTimeout?t.timeRemaining()-6:Ur-(Ma()-n))<=0));)o=Qe.shift();Qe.length&&Bi()}function Bi(){if(Wa)return;if(Wa=!0,ts>0){setTimeout(()=>Os(),0);return}const t=globalThis.requestIdleCallback;t?t(Os,{timeout:60}):setTimeout(()=>Os(),24)}function gs(t){ts=Math.max(0,ts+(t?1:-1)),t&&Qe.length&&setTimeout(()=>Os(),0)}function bs(){return $s.size>0||Ae.size>0}function Ka(t){Qe.push(t),Bi()}const Bs=new Set;let js=!1,ga=!1;function ji(){ga||!Bs.size||(ga=!0,setTimeout(()=>{ga=!1;for(const t of[...Bs])t()},0))}function ba(t){return Bs.add(t),()=>{Bs.delete(t)}}function ys(){const t=js;return js=!1,t}function Yi(t,n,o,e,a){const s=`${t}|${o}|${Math.round(e)}`,r=Ce.get(s);if(r)return r;const l=()=>{if($s.delete(s),Ce.has(s))return;const c=Hi(n,o);c&&(Ce.size>=48&&Ce.clear(),Ce.set(s,Ga(c,o,e)),ji())};return a?(l(),Ce.get(s)??null):($s.has(s)||($s.add(s),Ka(l)),js=!0,null)}function Va(t,n,o=192,e=.65,a=!1,s=pe,r=295,l){const c=Yi(t,n,Ns(o),15*e,!0);if(a&&c){const h=r*Math.PI/180;Qa(c,t,15*e,Math.ceil(zt*o/100),!1,Math.sin(h),-Math.cos(h),s,l??ss(Math.sin(h),-Math.cos(h)))}}function Ns(t){return t<=100?64:t<=224?96:128}const O0=new WeakMap;function Jr(t,n,o){const e=Math.max(.05,Math.min(1,o)),a=`${n}|${e.toFixed(2)}`;let s=O0.get(t);s||O0.set(t,s=new Map);const r=s.get(a);if(r)return r;const{N:l,h:c,sd:h}=t;let d=0;for(let p=0;p<l*l;p++)c[p]>d&&(d=c[p]);const f=zt/l,u=new Float32Array(n),i=new Float32Array(n),m=new Float32Array(n),g=new Float32Array(n),M=new Float32Array(n);M[0]=1.2;const b=p=>{let k=0,A=0,S=0;for(let E=0,I=0;E<l;E++)for(let z=0;z<l;z++,I++)p(I)&&(k+=1,A+=z,S+=E);return k?[k,(A/k+.5)*f-st,(S/k+.5)*f-st]:[0,50,50]},[w,v,y]=b(p=>h[p]>=0);i[0]=1,m[0]=v,g[0]=y;for(let p=1;p<n;p++){const k=p/n;u[p]=d*k;const A=d*Math.pow(k,1/e),[S,E,I]=b(T=>h[T]>=0&&c[T]>=A);i[p]=Math.min(i[p-1],w?Math.sqrt(S/w):1),m[p]=E,g[p]=I;const z=d/(2*n);let x=0,$=0;for(let T=0;T<l*l;T++)h[T]>0&&Math.abs(c[T]-A)<z&&($+=h[T],x++);M[p]=Math.max(M[p-1],x?$/x:M[p-1])}const C={top:d,z:u,q:e,scale:i,cx:m,cy:g,inset:M};return s.size>6&&s.clear(),s.set(a,C),C}function tl(t,n,o,e,a=1){const s=`${t}|`,r=`|${Math.round(n)}`;let l=null;for(const[C,p]of Ce)C.startsWith(s)&&C.endsWith(r)&&(l=p);if(!l)return null;const{N:c,h}=l,d=zt/c,f=Math.min(c-1,Math.max(0,(o+st)/d-.5)),u=Math.min(c-1,Math.max(0,(e+st)/d-.5)),i=Math.min(c-2,f|0),m=Math.min(c-2,u|0),g=f-i,M=u-m,b=m*c+i,w=(h[b]*(1-g)+h[b+1]*g)*(1-M)+(h[b+c]*(1-g)+h[b+c+1]*g)*M;let v=0;for(let C=0;C<c*c;C++)h[C]>v&&(v=h[C]);if(v<=0)return 0;const y=Math.max(.05,Math.min(1,a));return v*Math.pow(Math.max(0,w)/v,y)}const ya=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4),ks=new Map;function Eo(t){let n=ks.get(t);if(!n){let o=ge(t);if(!o){const e=Wn(1),a=e&&Ln(e,!0);if(a){a.fillStyle=t,a.fillRect(0,0,1,1);const s=a.getImageData(0,0,1,1).data;o=[s[0],s[1],s[2]]}else o=[128,128,128]}n=[ya(o[0]/255),ya(o[1]/255),ya(o[2]/255)],ks.size>200&&ks.clear(),ks.set(t,n)}return n}const Zs=2048,Xi=2.5,Gi=Zs/Xi,Ki=new Float32Array(Zs);for(let t=0;t<Zs;t++){const n=(t+.5)/Gi,o=n<=.75?n:.75+.25*(1-Math.exp(-(n-.75)/.25));Ki[t]=255*(o<=.0031308?12.92*o:1.055*Math.pow(o,1/2.4)-.055)}const so=t=>Ki[t<=0?0:t>=Xi?Zs-1:t*Gi|0],ao=t=>t<=0?0:t>=1?255:255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055),fe=1024,ws=new Map;function Te(t){let n=ws.get(t);if(!n){n=new Float32Array(fe+1);for(let o=0;o<=fe;o++)n[o]=Math.pow(o/fe,t);ws.size>16&&ws.clear(),ws.set(t,n)}return n}function Re(t,n,o=1/0){if(!(n>0))return;const e=.2126*t[0]+.7152*t[1]+.0722*t[2],a=Math.min(t[0],t[1],t[2]),s=Math.max(t[0],t[1],t[2]);let r=1+3*n;a<e&&(r=Math.min(r,e/(e-a))),s>e&&(r=Math.min(r,Math.max(1,(o-e)/(s-e)))),t[0]=e+(t[0]-e)*r,t[1]=e+(t[1]-e)*r,t[2]=e+(t[2]-e)*r}const ka=[.92,.96,1],wa=[1,.98,.95],en=(t,n,o)=>{const e=o<=t?0:o>=n?1:(o-t)/(n-t);return e*e*(3-2*e)},de=(t,n,o)=>1-en(t-n,t+n,o);function Na(t,n,o,e){const{L:a,V:s,H:r,U:l,W:c,A:h,B:d}=o,f=e.vivid??0,u=[0,0,0],i=Math.max(n[0],n[1],n[2],.05),m=[n[0]/i,n[1]/i,n[2]/i],g=Math.max(.03,.3-.15*e.shadow),M=.15+.14*e.spread,b=.85,w=Math.min(90,Math.round(110/Math.pow(e.spread,1.3))),v=Math.max(2,Math.round(8/e.spread)),y=Te(w),C=Te(v),p=.45*e.highlight,k=.1*e.highlight,A=.11*e.highlight,S=.3*e.rim,E=[g*m[0],g*m[1],g*m[2]];for(let I=0;I<Qt;I++)for(let z=0;z<Qt;z++){let x=z/(Qt-1)*2-1,$=I/(Qt-1)*2-1,T=x*x+$*$;if(T>1.14)continue;if(T>1){const it=1/Math.sqrt(T);x*=it,$*=it,T=1}const L=Math.sqrt(1-T),O=x*a[0]+$*a[1]+L*a[2],_=Math.max(0,x*s[0]+$*s[1]+L*s[2]),D=Math.max(0,x*r[0]+$*r[1]+L*r[2]),W=Math.min(1,Math.max(0,(O+M)/(1+M))),K=1-_,Z=K*K,nt=Z*K,dt=nt*Z,pt=D*fe|0,At=(p*y[pt]+k*C[pt])*(1+3*dt),j=2*_*x-s[0],V=2*_*$-s[1],U=2*_*L-s[2],It=.45+.55*en(-.4,.6,j*l[0]+V*l[1]+U*l[2]),Y=j*c[0]+V*c[1]+U*c[2];let lt=0;if(Y>.5){const it=(j*h[0]+V*h[1]+U*h[2])/Y,q=(j*d[0]+V*d[1]+U*d[2])/Y;lt=de(.34,.12,Math.abs(it))*de(.12,.06,Math.abs(q))}const ft=S*nt*It+A*lt,Pt=(I*Qt+z)*3;u[0]=n[0]*(E[0]+b*W),u[1]=n[1]*(E[1]+b*W),u[2]=n[2]*(E[2]+b*W),Re(u,f),t[Pt]=so(u[0]+At*wa[0]+ft*ka[0]),t[Pt+1]=so(u[1]+At*wa[1]+ft*ka[1]),t[Pt+2]=so(u[2]+At*wa[2]+ft*ka[2])}}const W0=new WeakMap;function nl(t){let n=W0.get(t);if(n)return n;const{N:o,sd:e,ao:a}=t;n={ao:new Uint8Array(o*o),k:new Float32Array(o*o)};for(let s=0;s<o*o;s++){if(a[s]===0)continue;const r=Math.max(0,e[s]),l=1-Math.min(1,r/3),c=1-.2*l*l,h=Math.min(1,Math.pow(a[s]/255,2.2)/c);n.ao[s]=Math.max(1,Math.round(255*Math.pow(h,1/2.2))),n.k[s]=1}return W0.set(t,n),n}const Vi=5;function Za(t,n,o,e,a){const{N:s,i00:r,wx:l,wy:c,ao:h,sd:d}=t,f=Qt*3;for(let u=0,i=0;u<s*s;u++,i+=4){const m=h[u];if(m===0){o[i+3]=0;continue}let g=a?e[a.ao[u]]*a.k[u]:e[m];const M=r[u]*3,b=l[u]*(1/255),w=c[u]*(1/255);if(a){const A=(n[M+1]*(1-b)+n[M+4]*b)*(1-w)+(n[M+f+1]*(1-b)+n[M+f+4]*b)*w;g=1-(1-g)*(1.1-.75*Math.min(1,A/235))}const v=(1-b)*(1-w)*g,y=b*(1-w)*g,C=(1-b)*w*g,p=b*w*g;o[i]=n[M]*v+n[M+3]*y+n[M+f]*C+n[M+f+3]*p,o[i+1]=n[M+1]*v+n[M+4]*y+n[M+f+1]*C+n[M+f+4]*p,o[i+2]=n[M+2]*v+n[M+5]*y+n[M+f+2]*C+n[M+f+5]*p;const k=d[u]/Vi;o[i+3]=k>=1?255:k<=0?0:Math.round(255*k*k*(3-2*k))}}const z0=new WeakMap;function ol(t,n){let o=z0.get(t);if(o||z0.set(t,o=new Map),o.has(n))return o.get(n);const e=Wn(n),a=e&&Ln(e,!1);if(!e||!a)return o.set(n,null),null;const{N:s,sd:r}=t,l=new ImageData(n,n),c=n/zt;for(let h=0;h<n;h++)for(let d=0;d<n;d++){const u=(ue(r,s,(d+.5)/c/zt*s-.5,(h+.5)/c/zt*s-.5)+.2)/.6,i=(h*n+d)*4;l.data[i]=l.data[i+1]=l.data[i+2]=255,l.data[i+3]=u>=1?255:u<=0?0:Math.round(255*u*u*(3-2*u))}return a.putImageData(l,0,0),o.set(n,e),e}const q0=new WeakMap;function Us(t){let n=q0.get(t);if(n)return n;const{N:o,sd:e}=t,a=zt/o,s=[];for(let r=0,l=0;r<o;r++)for(let c=0;c<o;c++,l++)e[l]>=0&&e[l]<2*a&&s.push((c+.5)*a-st,(r+.5)*a-st,e[l]);return n=Float32Array.from(s),q0.set(t,n),n}const _0=new WeakMap;function el(t){let n=_0.get(t);if(n)return n;const o=Us(t),e=[];let a=0,s=0;for(let c=0;c<o.length;c+=3)a+=o[c],s+=o[c+1];a/=o.length/3||1,s/=o.length/3||1;for(let c=0;c<o.length;c+=3)e.push([o[c],o[c+1],Math.atan2(o[c+1]-s,o[c]-a),o[c+2]]);e.sort((c,h)=>c[2]-h[2]);const r=Math.max(1,Math.floor(e.length/96)),l=e.filter((c,h)=>h%r===0);return n={x:Float32Array.from(l,c=>c[0]),y:Float32Array.from(l,c=>c[1]),d:Float32Array.from(l,c=>c[3])},_0.set(t,n),n}function D0(t,n,o){const e=Math.round((n+Math.PI)/(2*Math.PI)*t),a=o&1?o+1>>1:-(o>>1);return((e+a)%t+t)%t}function Ys(t,n,o){let e=-Di;for(let a=0;a<t.length;a+=3){const s=t[a]*n+t[a+1]*o+t[a+2];s>e&&(e=s)}return e}const Bo=new Map,Ae=new Set,Ni=(t,n)=>Math.round(Math.atan2(n,t)/(Math.PI/12)),Zi=t=>t<=200?192:t<=360?320:512,pe={length:1,density:1.6,fuzz:.9,clumps:.4,curl:.7,gravity:.9},sl=t=>`${t.length.toFixed(2)},${t.density.toFixed(2)},${t.fuzz.toFixed(2)},${t.clumps.toFixed(2)},${t.curl.toFixed(2)},${(t.gravity??pe.gravity).toFixed(2)}`,Ui=(t,n,o,e,a,s)=>`${t}|${Math.round(n)}|${o}|${e}|${sl(a)}|${Pl(s)}`,R0=new Map,Ca=new Set,Vo=128,al=3.2,Aa=1/2.56,va=1/(2/3*Math.sqrt(1/3)),il=.6,H0=.07,B0=.14,j0=.3,rl=.6,ll=.35,cl=.3,Y0=.3,hl=1.26,fl=1.6,ul=.045,Qi=.5,Cs=Math.cos(Qi),X0=Math.sin(Qi),dl=.22,pl=.5,Ji=.36,ml=1.1,G0=1.625,Ml=.5,gl=.9,As=.7,bl=.15,yl=1.3,$o=20,Gn=zt+2*$o,kl=.8,wl=.3,Cl=.8,Al=.7,vl=.5,Ze=2.5,Sa=1.2,za=3,Sl=.8,xl=.3,K0=.1,Je=32*Math.PI/180,Xs=1;function tr(t,n,o=Je){const e=Math.cos(o),a=Math.sin(o);return Qo([t[0]*e+n[0]*a,t[1]*e+n[1]*a,t[2]*e+n[2]*a])}function nr(t,n){return Qo([.94*t[0]-.34*n[0],.94*t[1]-.34*n[1],.94*t[2]-.34*n[2]])}function Ua(t,n){const o=-.5*t,e=-.5*n-.87,a=Math.hypot(o,e)||1;return[o/a,e/a]}const ss=(t,n)=>{const[o,e]=Ua(t,n);return{bx:o,by:e,front:Je}},Pl=t=>`${Math.round(Math.atan2(t.by,t.bx)/(Math.PI/36))}|${Math.round(t.front/(Math.PI/90))}`;function Ws(t,n){let o=t*374761393+n*668265263|0;return o=Math.imul(o^o>>>13,1274126177),((o^o>>>16)>>>0)/4294967296}function ue(t,n,o,e){const a=n-1,s=Math.min(a,Math.max(0,o)),r=Math.min(a,Math.max(0,e)),l=Math.min(a-1,s|0),c=Math.min(a-1,r|0),h=s-l,d=r-c,f=c*n+l;return(t[f]*(1-h)+t[f+1]*h)*(1-d)+(t[f+n]*(1-h)+t[f+n+1]*h)*d}function Qa(t,n,o,e,a,s,r,l=pe,c=ss(s,r)){const h=Zi(e),d=Ni(s,r),f=Ui(n,o,h,d,l,c),u=Bo.get(f);if(u)return u;if(a)return Fl(t,n,o,e,s,r,l,c);const i=`${n}|${Math.round(o)}|`;if(h>192&&!ts&&!Ae.has(f)){let m=!1;for(const g of Bo.keys())g.startsWith(i)&&(m=!0);for(const g of Ae)g.startsWith(i)&&(m=!0);m||Qa(t,n,o,1,!1,s,r,l,c)}if(!Ae.has(f)){Ae.add(f),Ca.delete(f);const m=`${n}|${Math.round(o)}|${h}|${d}`,g=R0.get(m)??[];for(g.push(f);g.length>2;){const b=g.shift();Ca.add(b),Ae.delete(b)}R0.set(m,g);const M=or(t,f,h,s,r,l,c);if(M)for(const b of M.steps)Ka(()=>Ca.has(f)?void 0:b())}js=!0;for(const[m,g]of Bo)if(m.startsWith(i))return g;return null}function Tl(t){let n=t>>>0;return()=>{n=n+1831565813|0;let o=Math.imul(n^n>>>15,1|n);return o=o+Math.imul(o^o>>>7,61|o)^o,((o^o>>>14)>>>0)/4294967296}}function Oe(t,n){return(o,e)=>{const a=o/t,s=e/t,r=Math.floor(a),l=Math.floor(s),c=a-r,h=s-l,d=c*c*(3-2*c),f=h*h*(3-2*h),u=(b,w)=>Ws(b+n*131,w-n*71),i=u(r,l),m=u(r+1,l),g=u(r,l+1),M=u(r+1,l+1);return(i+(m-i)*d)*(1-f)+(g+(M-g)*d)*f}}function Il(t,n,o){let e=t*374761393+n*668265263+o*1274126177|0;return e=Math.imul(e^e>>>13,1274126177),((e^e>>>16)>>>0)/4294967296}function Ll(t,n){return(o,e,a)=>{const s=o/t,r=e/t,l=a/t,c=Math.floor(s),h=Math.floor(r),d=Math.floor(l),f=s-c,u=r-h,i=l-d,m=f*f*(3-2*f),g=u*u*(3-2*u),M=i*i*(3-2*i),b=(k,A,S)=>Il(k+n*131,A-n*71,S+n*17),w=(k,A,S)=>k+(A-k)*S,v=w(b(c,h,d),b(c+1,h,d),m),y=w(b(c,h+1,d),b(c+1,h+1,d),m),C=w(b(c,h,d+1),b(c+1,h,d+1),m),p=w(b(c,h+1,d+1),b(c+1,h+1,d+1),m);return w(w(v,y,g),w(C,p,g),M)}}function Fl(t,n="custom",o=9.75,e=320,a=-1,s=0,r=pe,l=ss(a,s)){const c=Zi(e),h=Ui(n,o,c,Ni(a,s),r,l),d=Bo.get(h);if(d)return d;const f=or(t,h,c,a,s,r,l);if(f)for(const u of f.steps)u();return Bo.get(h)??{R:0,mask:null,haze:null,cut:null,core:null,dark:null,light:null,glint:null,back:null,backSoft:null}}function or(t,n,o,e,a,s=pe,r=ss(e,a)){if(Bo.has(n))return null;const l=P=>{Bo.size>=24&&Bo.delete(Bo.keys().next().value),Bo.set(n,P),Ae.delete(n),ji()},{N:c}=t,h=o/zt,d=(P,B,G)=>ue(P,c,(B+st)/zt*c-.5,(G+st)/zt*c-.5),f=(P,B)=>d(t.sd,P,B),u=st+$o,i=Math.round(o*Gn/zt),m={R:o,mask:null,haze:null,cut:null,core:null,dark:null,light:null,glint:null,back:null,backSoft:null},g=Wn(i),M=Wn(i),b=Wn(o),w=Wn(i),v=Wn(i),y=Wn(i),C=g&&Ln(g,!1),p=M&&Ln(M,!1),k=b&&Ln(b,!1),A=w&&Ln(w,!1),S=v&&Ln(v,!1),E=y&&Ln(y,!1);if(!g||!M||!b||!w||!v||!y||!C||!p||!k||!A||!S||!E)return l(m),null;const I=Tl(c*7919+17),z=Oe(3.4,21),x=Oe(22,9),$=Oe(13,57),{length:T,density:L,fuzz:O,clumps:_,curl:D}=s,W=s.gravity??pe.gravity,K=Math.hypot(e,a)||1,Z=e/K,nt=a/K,dt=[Z,nt,0],pt=[0,0,1],At=[0,1,0],j=tr(dt,pt,r.front),V=nr([r.bx,r.by,0],pt),U=Qo([j[0],j[1],j[2]+1]),It=Qo([-.55*dt[0]+.85*pt[0]+.15*At[0],-.55*dt[1]+.85*pt[1]+.15*At[1],-.55*dt[2]+.85*pt[2]+.15*At[2]]);let Y=12;for(let P=-st;P<60;P+=.5)if(f(50,P)>.5){Y=P+1;break}Y-=18;const lt=50,ft=(P,B)=>{const R=f(P-.8,B)-f(P+.8,B),Q=f(P,B-.8)-f(P,B+.8),tt=Math.hypot(R,Q)||1;return[R/tt,Q/tt]},Pt=(P,B)=>{let G=P-lt,R=B-Y;const Q=Math.hypot(G,R)||1;G/=Q,R/=Q;const tt=W*(1-.6*Math.exp(-Q/8));let ht=G*(1-.8*tt),et=R*(1-.8*tt)+tt;const Wt=f(P,B);if(Wt<5){const[Yt,Gt]=ft(P,B),Dt=Math.max(0,-Gt),wt=Yt*(1-W*Dt),Ct=Gt*(1-W*Dt)+1.2*W,Ft=Math.max(0,Math.min(1,1-Wt/5))*.75;ht=ht*(1-Ft)+wt*Ft*1.6,et=et*(1-Ft)+Ct*Ft*1.6}const kt=(z(P,B)-.5)*(.5+1.6*D)+($(P,B)-.5)*(.6+D),yt=Math.cos(kt),mt=Math.sin(kt),ot=ht*yt-et*mt,ut=ht*mt+et*yt,vt=Math.hypot(ot,ut)||1;return[ot/vt,ut/vt]},it=[],q=(P,B,G)=>{for(let R=0;R<P;R+=B)it.push(()=>G(R,Math.min(P,R+B)))},F=(P,B)=>d(t.h,P,B),bt=(P,B)=>{const R=(F(P+.6,B)-F(P-.6,B))/1.2,Q=(F(P,B+.6)-F(P,B-.6))/(2*.6),tt=Math.hypot(R,Q);return[tt>1e-6?-R/tt:0,tt>1e-6?-Q/tt:0,tt/Math.sqrt(1+tt*tt)]},H=112,Et=Gn/H,Lt=new Float32Array(H*H),Cn=new Float32Array(H*H),_t=new Float32Array(H*H),Mn=new Float32Array(H*H),an=new Float32Array(H*H),gn=new Float32Array(H*H),Ot=new Float32Array(H*H),Rt=new Float32Array(H*H),St=new Float32Array(H*H),sn=new Float32Array(H*H),yn=new Float32Array(H*H),ro=new Float32Array(H*H),go=new Float32Array(H*H);q(H,28,(P,B)=>{for(let G=P,R=P*H;G<B;G++)for(let Q=0;Q<H;Q++,R++){const tt=(Q+.5)*Et-u,ht=(G+.5)*Et-u;let[et,Wt]=Pt(tt,ht);const[kt,yt,mt]=bt(tt,ht),ot=mt*(.25+.5*(1-W))*(1-W*Math.max(0,-yt));et=et*(1-ot)+kt*ot,Wt=Wt*(1-ot)+(yt+.35*W)*ot;const ut=Math.hypot(et,Wt)||1;et/=ut,Wt/=ut,Lt[R]=et,Cn[R]=Wt,_t[R]=mt;let vt=kt*mt,Yt=yt*mt,Gt=Math.sqrt(Math.max(0,1-mt*mt));const Dt=f(tt,ht);if(Dt<2){const[Zt,Ut]=ft(tt,ht),tn=Dt>=0?.7*(1-Dt/2):Math.min(1,.7-.2*Dt);vt+=tn*(Zt-vt),Yt+=tn*(Ut-Yt),Gt-=tn*Gt;const Pn=Math.hypot(vt,Yt,Gt)||1;vt/=Pn,Yt/=Pn,Gt/=Pn}Mn[R]=vt,an[R]=Yt,gn[R]=Gt,Ot[R]=en(-3.5,-1.5,Dt),go[R]=x(tt,ht),yn[R]=Dt>0?F(tt,ht):0;const wt=Math.sqrt(vt*vt+Yt*Yt),Ct=wt>1e-4?vt/wt:0,Ft=wt>1e-4?Yt/wt:0,qt=et*Ct+Wt*Ft,Bt=(1-Math.max(0,Gt))*qt;let Vt=Cs*(et-Bt*Ct)+X0*wt*Ct,jt=Cs*(Wt-Bt*Ft)+X0*wt*Ft;const Nt=en(-.5,1.5,Dt);Vt=et+(Vt-et)*Nt,jt=Wt+(jt-Wt)*Nt;const on=Math.sqrt(Vt*Vt+jt*jt)||1;Rt[R]=Vt/on,St[R]=jt/on,sn[R]=1+(Math.min(1,on)-1)*Nt}}),it.push(()=>{const P=new Float32Array(H*H),B=Float32Array.from(yn);for(let G=0;G<3;G++){for(let R=0,Q=0;R<H;R++)for(let tt=0;tt<H;tt++,Q++){let ht=0;for(let et=-2;et<=2;et++)ht+=B[R*H+Math.min(H-1,Math.max(0,tt+et))];P[Q]=ht/5}for(let R=0,Q=0;R<H;R++)for(let tt=0;tt<H;tt++,Q++){let ht=0;for(let et=-2;et<=2;et++)ht+=P[Math.min(H-1,Math.max(0,R+et))*H+tt];B[Q]=ht/5}}for(let G=0,R=0;G<H;G++)for(let Q=0;Q<H;Q++,R++){const tt=en(.2,2,f((Q+.5)*Et-u,(G+.5)*Et-u)),ht=en(.3,3.5,B[R]-yn[R])*tt,et=en(.15,.85,an[R])*(1-gn[R]);ro[R]=Math.min(1,ht+.45*et)*Ot[R]}});const J=(P,B,G)=>ue(P,H,(B+u)/Et-.5,(G+u)/Et-.5),Mt=(P,B)=>{const G=J(Rt,P,B),R=J(St,P,B),Q=Math.sqrt(G*G+R*R);return Q>1e-4?[G/Q,R/Q]:[0,1]},Ht=(P,B)=>{const G=J(Lt,P,B),R=J(Cn,P,B),Q=Math.sqrt(G*G+R*R);return Q>1e-4?[G/Q,R/Q]:[0,1]},Kt=i>>1,vn=Kt/Gn,ln=new Float32Array(Kt*Kt),Sn=new Float32Array(Kt*Kt),qn=(P,B,G)=>ue(P,Kt,(B+u)*vn-.5,(G+u)*vn-.5),lo=Oe(.7+.35*T,61),Fn=Oe(2.2+.6*T,67),Jn=(.2+.5*O)*Math.min(1.8,T),Bn=(P,B)=>{const G=.3*Math.max(-1.6,Math.min(1.6,qn(ln,P,B)))/1.6+.25*(lo(P,B)-.5)*2.4+.45*(Fn(P,B)-.5)*2.4;return Jn*Math.max(-1,Math.min(1,G))},bo=(.8+.45*T)*(.65+.4*_),X=1.5+1.6*T,ct=.32*bo*(.15+.85*_),at=new Float32Array(i*i).fill(-.25*ct),gt=new Int32Array(i*i).fill(-1),xt=16,Tt=Math.sqrt(.6*bo*X/al/Aa),rn=Math.ceil(Gn/Tt),rt=new Float32Array(rn*rn*xt);let un=0;const En=.45-.2*W,cn=Ll(1.6*X,79),_n=Oe(9,73),jn=1.5*ct*(.25+_);it.push(()=>{for(let P=0;P<rn;P++)for(let B=0;B<rn;B++){const G=(B+I())*Tt-u,R=(P+I())*Tt-u,Q=I(),tt=I(),ht=I(),et=I(),Wt=I(),kt=I(),yt=I();let mt=J(Mn,G,R),ot=J(an,G,R),ut=J(gn,G,R);const vt=Math.hypot(mt,ot,ut)||1;mt/=vt,ot/=vt,ut/=vt;const[Yt,Gt]=Ht(G,R),Dt=(Q-.5)*(.2+.45*D),wt=Math.cos(Dt),Ct=Math.sin(Dt),Ft=Yt*wt-Gt*Ct,qt=Yt*Ct+Gt*wt,Bt=Ft*mt+qt*ot;let Vt=Ft-Bt*mt,jt=qt-Bt*ot,Nt=-Bt*ut,on=Math.hypot(Vt,jt,Nt);on<.05&&(Vt=ut*mt,jt=ut*ot,Nt=ut*ut-1,on=Math.hypot(Vt,jt,Nt)||1),Vt/=on,jt/=on,Nt/=on;let Zt=ot*Nt-ut*jt,Ut=ut*Vt-mt*Nt,tn=mt*jt-ot*Vt;const Pn=En+.2*tt,Yn=Math.cos(Pn),Dn=Math.sin(Pn),fo=.8+.45*_n(G,R),uo=bo*fo*(.8+.4*ht),to=X*fo*(.75+.5*et);let Rn=(Vt*Yn+mt*Dn)*to*h,Tn=(jt*Yn+ot*Dn)*to*h,In=Math.hypot(Rn,Tn);In<1.5?(Rn=Ft,Tn=qt,In=1.5):(Rn/=In,Tn/=In);let Hn=-Zt*Tn+Ut*Rn;Hn<0&&(Zt=-Zt,Ut=-Ut,tn=-tn,Hn=-Hn);const Un=Math.max(.6,.5*uo*h*Math.max(.15,Hn)),po=In/(to*h)*(Un/(.5*uo*h)),$n=cn(G,R,F(G,R));if(Wt>Aa/Math.max(Aa,po)*(1-il*_*(1-en(.25,.65,$n))))continue;const mn=un++*xt;rt[mn]=(G+u)*h,rt[mn+1]=(R+u)*h,rt[mn+2]=Rn,rt[mn+3]=Tn,rt[mn+4]=In,rt[mn+5]=Un,rt[mn+6]=.1*ct*kt+jn*$n,rt[mn+7]=(yt-.5)*1.2*D,rt[mn+8]=Vt,rt[mn+9]=jt,rt[mn+10]=Nt,rt[mn+11]=Zt,rt[mn+12]=Ut,rt[mn+13]=tn,rt[mn+14]=to,rt[mn+15]=uo}});const dn=P=>(P<.25?4*P:1)*(1-.5*P),xn=6;for(let P=0;P<xn;P++)it.push(()=>{const B=Math.floor(un*P/xn),G=Math.floor(un*(P+1)/xn);for(let R=B;R<G;R++){const Q=R*xt,tt=rt[Q],ht=rt[Q+1],et=rt[Q+2],Wt=rt[Q+3],kt=rt[Q+4],yt=rt[Q+5],mt=rt[Q+6],ot=rt[Q+7],ut=yt*(1+Math.abs(ot))+1,vt=tt+et*kt,Yt=ht+Wt*kt,Gt=Math.max(0,Math.floor(Math.min(tt,vt)-ut)),Dt=Math.min(i-1,Math.ceil(Math.max(tt,vt)+ut)),wt=Math.max(0,Math.floor(Math.min(ht,Yt)-ut)),Ct=Math.min(i-1,Math.ceil(Math.max(ht,Yt)+ut)),Ft=1/kt,qt=1/yt;for(let Bt=wt;Bt<=Ct;Bt++){const Vt=Bt+.5-ht;for(let jt=Gt,Nt=Bt*i+Gt;jt<=Dt;jt++,Nt++){const on=jt+.5-tt,Zt=(on*et+Vt*Wt)*Ft;if(Zt<=0||Zt>=1)continue;const Ut=va*Math.sqrt(Zt)*(1-Zt),tn=(Vt*et-on*Wt)*qt-ot*Zt*Zt;if(tn>=Ut||tn<=-Ut)continue;const Pn=tn/Ut,Yn=mt+ct*dn(Zt)*(1-Pn*Pn);Yn>at[Nt]&&(at[Nt]=Yn,gt[Nt]=R)}}}});const Vn=new Float32Array(i*i),So=Math.max(1,Math.round(.3*bo*h)),Jt=new Float32Array(i),kn=(P,B,G,R,Q)=>{const tt=Q===1?i:1,ht=1/(2*G+1),et=yt=>Jt[yt<0?0:yt>=i?i-1:yt],Wt=R*tt;for(let yt=0;yt<i;yt++)Jt[yt]=P[Wt+yt*Q];let kt=0;for(let yt=-G;yt<=G;yt++)kt+=et(yt);for(let yt=0;yt<i;yt++)B[Wt+yt*Q]=kt*ht,kt+=et(yt+G+1)-et(yt-G)};it.push(()=>{for(let P=0;P<i;P++)kn(at,Vn,So,P,1);for(let P=0;P<i;P++)kn(Vn,Vn,So,P,1)}),it.push(()=>{for(let P=0;P<i;P++)kn(Vn,Vn,So,P,i);for(let P=0;P<i;P++)kn(Vn,Vn,So,P,i)}),it.push(()=>{for(let P=0;P<i;P++)kn(at,at,1,P,1);for(let P=0;P<i;P++)kn(at,at,1,P,i)});const pn=new ImageData(i,i),Zn=new ImageData(i,i),He=new ImageData(i,i),a0=new ImageData(i,i),i0=new ImageData(i,i),Js=new Float32Array(i*i),Xt=new Float32Array(11),cs=(P,B,G,R,Q)=>{const tt=Math.min(H-1,Math.max(0,(P+u)/Et-.5)),ht=Math.min(H-1,Math.max(0,(B+u)/Et-.5)),et=Math.min(H-2,tt|0),Wt=Math.min(H-2,ht|0),kt=tt-et,yt=ht-Wt,mt=Wt*H+et,ot=(1-kt)*(1-yt),ut=kt*(1-yt),vt=(1-kt)*yt,Yt=kt*yt,Gt=mn=>mn[mt]*ot+mn[mt+1]*ut+mn[mt+H]*vt+mn[mt+H+1]*Yt;let Dt=Gt(Mn),wt=Gt(an),Ct=Gt(gn);const Ft=Math.sqrt(Dt*Dt+wt*wt+Ct*Ct)||1;Dt/=Ft,wt/=Ft,Ct/=Ft;const qt=Dt*j[0]+wt*j[1]+Ct*j[2];Xt[4]=Dt,Xt[5]=wt,Xt[6]=Ct,Xt[7]=qt,Xt[8]=Gt(ro);const Bt=Gt(Ot);if(Xt[9]=Bt,Xt[10]=Gt(go),Bt<=0){Xt[0]=Xt[1]=Xt[3]=0,Xt[2]=.7;return}const Vt=en(-.2,.5,qt),jt=G*Dt+R*wt;let Nt=G-jt*Dt,on=R-jt*wt,Zt=-jt*Ct;const Ut=Math.sqrt(Nt*Nt+on*on+Zt*Zt);Ut>.001?(Nt/=Ut,on/=Ut,Zt/=Ut):(Nt=0,on=0,Zt=1);const tn=Math.cos(Q),Pn=Math.sin(Q);Nt=Nt*tn+Dt*Pn,on=on*tn+wt*Pn,Zt=Zt*tn+Ct*Pn;const Yn=Nt*U[0]+on*U[1]+Zt*U[2],Dn=Dt*U[0]+wt*U[1]+Ct*U[2],fo=Yn-.12*Dn,uo=Yn+.2*Dn,to=Math.max(0,1-fo*fo),Rn=to*to,Tn=Rn*Rn,In=Tn*Tn,Hn=In*In,Un=Math.max(0,1-uo*uo),po=Un*Un;Xt[0]=Vt*(.85*Hn*Hn*Tn+.15*po*po),Xt[0]*=(.4+.6*(1-en(.35,.85,qt)))*Bt;const $n=Math.sqrt(Math.max(0,1-Zt*Zt));Xt[1]=en(-.3,.6,Dt*V[0]+wt*V[1]+Ct*V[2])*Math.pow(1-Ct,1.6)*(.4+.6*$n)*(1-.6*Math.max(0,wt))*Bt,Xt[3]=en(-.5,.75,Dt*V[0]+wt*V[1]+Ct*V[2])*Math.pow(1-Ct,.85)*(1-.6*Math.max(0,wt))*Bt,Xt[2]=Vt*Bt+.7*(1-Bt)};it.push(()=>{for(let P=0,B=0;P<i;P++)for(let G=0;G<i;G++,B++){const R=Ws(G+911,P+37);Js[B]=R*R*R}});const Be=.25,br=Math.sqrt(1/7-1/16),je=Math.max(1,Math.round((.35+.4*T)*h)),r0=[],ta=new Float32Array(2*je+1),l0=new Float32Array(2*je+1);for(let P=0;P<=2*je;P++){const B=new Float32Array(P+1);let G=0,R=0;for(let Q=0;Q<=P;Q++){const tt=P?Q/P:0,ht=tt<=As?1:(1-tt)/(1-As);B[Q]=1-Ml*tt,G+=B[Q]*ht*Be,R+=B[Q]*B[Q]*(ht/7-Be*Be*ht*ht)}r0.push(B),ta[P]=G,l0[P]=Math.sqrt(Math.max(1e-6,R))}const yr=.12*(o>=512?1:o>=320?.75:.4)*Math.min(1.4,.55+.35*L),c0=Math.max(1,1.5*bo*h),Ee=Math.max(1,Math.min(5,Math.round(c0))),na=new Int32Array(Ee),oa=new Int32Array(Ee),h0=new Float32Array(Ee);for(let P=0;P<Ee;P++){const B=(P+1)/Ee*c0;na[P]=Math.round(Z*B),oa[P]=Math.round(nt*B),h0[P]=Math.hypot(na[P],oa[P])/h}const kr=Te(1.35),wr=Te(1/2.2),ea=P=>{const B=(P+j0)/(1+j0);return B<=0?0:B>=1?1:kr[B*fe|0]},f0=o>=512?1:o>=320?.8:.55,co=new Float32Array(4),u0=(P,B,G,R,Q)=>{if(Q<0){const[Bt,Vt]=Mt(G,R);co[0]=Bt,co[1]=Vt,co[2]=.5,co[3]=0;return}const tt=Q*xt,ht=rt[tt+2],et=rt[tt+3],Wt=rt[tt+4],kt=rt[tt+5],yt=rt[tt+7],mt=P+.5-rt[tt],ot=B+.5-rt[tt+1],ut=Math.min(.995,Math.max(.005,(mt*ht+ot*et)/Wt)),vt=Math.sqrt(ut),Yt=va*vt*(1-ut),Gt=va*(.5*(1-ut)/vt-vt),Dt=Math.max(-1,Math.min(1,((ot*ht-mt*et)/kt-yt*ut*ut)/Yt)),wt=Math.max(-1.2,Math.min(1.2,Dt*Gt+2*yt*ut)),Ct=Wt*ht-wt*kt*et,Ft=Wt*et+wt*kt*ht,qt=Math.sqrt(Ct*Ct+Ft*Ft)||1;co[0]=Ct/qt,co[1]=Ft/qt,co[2]=ut,co[3]=dn(ut)*(1-Dt*Dt)},$e=new Float32Array(i*i);q(i,32,(P,B)=>{for(let G=P;G<B;G++){const R=(G+.5)/h-u;for(let Q=0,tt=G*i;Q<i;Q++,tt++){const ht=(Q+.5)/h-u;u0(Q,G,ht,R,gt[tt]);const et=co[0],Wt=co[1],kt=Math.min(H-1,Math.max(0,(ht+u)/Et-.5)),yt=Math.min(H-1,Math.max(0,(R+u)/Et-.5)),mt=Math.min(H-2,kt|0),ot=Math.min(H-2,yt|0),ut=kt-mt,vt=yt-ot,Yt=ot*H+mt,Gt=(_t[Yt]*(1-ut)+_t[Yt+1]*ut)*(1-vt)+(_t[Yt+H]*(1-ut)+_t[Yt+H+1]*ut)*vt,Dt=(sn[Yt]*(1-ut)+sn[Yt+1]*ut)*(1-vt)+(sn[Yt+H]*(1-ut)+sn[Yt+H+1]*ut)*vt,wt=2*Math.max(1,Math.min(je,Math.round(je*(.5+.5*Gt)*Dt/Cs))),Ct=r0[wt];let Ft=0,qt=0;for(let jt=0;jt<=wt;jt++){const Nt=Math.round(Q-et*jt),on=Math.round(G-Wt*jt);if(Nt<0||on<0||Nt>=i||on>=i){Ft+=ta[wt]/(wt+1);continue}const Zt=Js[on*i+Nt],Ut=Zt*53.7,tn=wt*(As+(1-As)*(Ut-Math.floor(Ut)));jt<=tn&&(Ft+=Zt*Ct[jt],qt+=Zt*Ct[jt]*jt/(tn||1))}const Bt=(Ft-ta[wt])/l0[wt],Vt=Ft>1e-4?qt/Ft:.5;$e[tt]=Bt+gl*Math.min(2.5,Math.max(0,Bt))*(Vt-.45)}}});let d0=0,p0=0;q(i,16,(P,B)=>{const G=pn.data,R=Zn.data,Q=He.data,tt=a0.data,ht=i0.data;for(let et=P;et<B;et++){const Wt=(et+.5)/h-u;for(let kt=0;kt<i;kt++){const yt=(kt+.5)/h-u,mt=et*i+kt,ot=gt[mt],ut=ot*xt;u0(kt,et,yt,Wt,ot);const vt=co[0],Yt=co[1],Gt=co[2],Dt=co[3];cs(yt,Wt,vt,Yt,.25+.2*Dt);const wt=Xt[4],Ct=Xt[5],Ft=Xt[6],qt=Xt[7],Bt=kt>0?mt-1:mt,Vt=kt<i-1?mt+1:mt,jt=et>0?mt-i:mt,Nt=et<i-1?mt+i:mt,on=(at[Vt]-at[Bt])*h/(Vt-Bt||1),Zt=(at[Nt]-at[jt])*h*i/(Nt-jt||1),Ut=Math.sqrt(wt*wt+Ct*Ct);let tn=1,Pn=0,Yn=0,Dn=1,fo=0;Ut>.001&&(tn=-Ct/Ut,Pn=wt/Ut,Yn=-Ft*wt/Ut,Dn=-Ft*Ct/Ut,fo=Ut);const uo=Math.max(-1.5,Math.min(1.5,on*tn+Zt*Pn)),to=Math.max(-1.5,Math.min(1.5,on*Yn+Zt*Dn));let Rn=wt-uo*tn-to*Yn,Tn=Ct-uo*Pn-to*Dn,In=Ft-to*fo;const Hn=Math.sqrt(Rn*Rn+Tn*Tn+In*In)||1;Rn/=Hn,Tn/=Hn,In/=Hn;let Un=1;if(ot>=0){const oo=rt[ut+8],Do=rt[ut+9],wo=rt[ut+10],Co=.9*oo+.44*wt,Ro=.9*Do+.44*Ct,Ho=.9*wo+.44*Ft,ae=(Co*j[0]+Ro*j[1]+Ho*j[2])/(Math.sqrt(Co*Co+Ro*Ro+Ho*Ho)||1);Un=1-Y0+Y0*Math.min(1.2,Math.sqrt(Math.max(0,1-ae*ae))/.85)}const po=Rn*j[0]+Tn*j[1]+In*j[2],$n=at[mt];let mn=1;if(qt>-.25){const oo=Math.min(.97,Math.max(.05,qt)),Do=oo/Math.sqrt(1-oo*oo);let wo=0;for(let Co=0;Co<Ee;Co++){const Ro=kt+na[Co],Ho=et+oa[Co];if(Ro<0||Ho<0||Ro>=i||Ho>=i)break;const ae=at[Ho*i+Ro]-$n-h0[Co]*Do;ae>wo&&(wo=ae)}mn=1-rl*en(0,.35*ct,wo)}let ee=1-ll*en(0,.6*ct,Vn[mt]-$n);ot>=0&&(ee*=1-cl*(1-en(0,.35,Gt)));const To=H0+B0*Math.max(0,Rn*It[0]+Tn*It[1]+In*It[2]),ko=H0+B0*Math.max(0,wt*It[0]+Ct*It[1]+Ft*It[2]);let On=ee*(To+ea(po)*mn*Un)*hl/(ko+ea(qt));ot>=0&&(On*=(1+.15*Gt*Gt)*(1+.08*(Ws(ot,5)-.5)));const zo=Xt[8];On*=1-dl*zo*(.6+.4*en(0,.6*ct,Vn[mt]-$n)),On=1+(On-1)*f0;const mo=Xt[9],Io=(ko+ea(qt))/ml,qo=(Io>=1?1:wr[Io*fe|0])*mo+.75*(1-mo);let Lo=Math.sqrt(On>2.4?2.4:On);Lo>1&&(Lo=1+(Lo-1)/(1+2.5*qo*(Lo-1)));const ke=$e[mt];let ds=0;if(qt>0){const oo=j[0]-qt*wt,Do=j[1]-qt*Ct,wo=Math.sqrt(1-qt*qt),Co=wo>.001?bl*h*Math.min(3,wo/Math.max(.2,qt))/wo:0,Ro=Math.min(i-1.001,Math.max(0,kt+oo*Co)),Ho=Math.min(i-1.001,Math.max(0,et+Do*Co)),ae=Ro|0,k0=Ho|0,ps=Ro-ae,w0=Ho-k0,ms=k0*i+ae,Tr=($e[ms]*(1-ps)+$e[ms+1]*ps)*(1-w0)+($e[ms+i]*(1-ps)+$e[ms+i+1]*ps)*w0;ds=Math.max(0,Tr-Math.max(0,ke))*en(0,.3,qt)}let we=Lo*(1+yr*(ke*(.45+.55*Xt[2])*(.75+.5*Gt)-yl*ds))+.04*(Xt[10]-.5)+ul*f0*mo;const Nn=Math.min(yt+u,Gn-u-yt,Wt+u,Gn-u-Wt),fa=Nn>=8?1:Nn<=0?0:Nn/8*(Nn/8)*(3-2*Nn/8);we=1+(we-1)*fa;const Xn=mt*4;we<1?G[Xn+3]=Math.round(255*Math.min(1,(1-we)*qo/Math.max(.4,qo-Ji))):(R[Xn]=R[Xn+1]=R[Xn+2]=255,R[Xn+3]=Math.round(255*Math.min(1,fl*(G0-1)*qo/(G0-qo)*(we-1)*(1-.7*zo))));const _o=Math.max(-2,Math.min(2,4*(Lo-1))),hn=kt>>1,wn=et>>1;if(hn<Kt&&wn<Kt){const oo=wn*Kt+hn;ln[oo]+=.25*$n,Sn[oo]+=.25*_o}const no=en(-.4,1,_o)*Math.max(0,Math.min(1.4,.65+.25*ke));Q[Xn]=Q[Xn+1]=Q[Xn+2]=tt[Xn]=tt[Xn+1]=tt[Xn+2]=255,Q[Xn+3]=Math.round(255*Math.min(1,Xt[0]*no)),tt[Xn+3]=Math.round(255*Math.min(1,Xt[1]*Math.max(0,Math.min(1.6,.5+.4*ke))));const se=Math.max(.55,Math.min(1.3,.85+.15*ke+.12*_o));ht[Xn]=ht[Xn+1]=ht[Xn+2]=255,ht[Xn+3]=Math.round(255*Math.min(1,.85*Xt[3]*se))}}}),it.push(()=>{const P=Kt*Kt;for(let R=0;R<P;R++)d0+=ln[R],p0+=ln[R]*ln[R];const B=d0/P,G=Math.sqrt(Math.max(1e-9,p0/P-B*B));for(let R=0;R<P;R++)ln[R]=Math.max(-2.5,Math.min(2.5,(ln[R]-B)/G))}),it.push(()=>{C.putImageData(pn,0,0),p.putImageData(Zn,0,0),A.putImageData(He,0,0),E.putImageData(i0,0,0),S.putImageData(a0,0,0);for(const P of[C,p,A,S])P.setTransform(1,0,0,1,$o*h,$o*h),P.lineCap="round",P.lineJoin="round"});const Ye=16,m0=Gn*Gn,Xe=o>=512?1:o>=320?.45:0,Cr=[{count:.12,len:1.2,vary:1,endOn:.6,width:.09,spread:30,alpha:.4,deep:1,lift:.25,light:.46,dark:.34,bend:.93,clump:[1,0],clumpW:0,shadow:0,shadowW:1,over:0,crowd:!1,short:0},{count:.4*Xe,len:.9,vary:1.2,endOn:.35,width:.13,spread:100,alpha:.26,deep:.2,lift:.18,light:.55,dark:.06,bend:1.2,clump:[1,Math.round(1+2*_)],clumpW:.08+.07*_,shadow:.25,shadowW:2,over:.25,crowd:!0,short:1}],Ar=P=>Math.min(Ye-1,Math.max(0,Math.round((Math.max(-1,Math.min(1,P))+1)/2*(Ye-1)))),yo=6,hs=P=>Math.min(yo-1,P*yo|0),sa=4,xo=new Float32Array(sa+1),Po=new Float32Array(sa+1);for(const P of Cr){if(P.count<=0)continue;const B=P.clump[0]+.5*P.clump[1],G=Math.max(1,Math.ceil(m0*P.count*L*(P.crowd?2:1)*(.5+.5*B)/9e3));for(let R=0;R<G;R++)it.push(()=>{const Q=[],tt=[],ht=[],et=[];for(let ot=0;ot<Ye;ot++)Q.push(new Path2D);for(let ot=0;ot<yo;ot++)tt.push(new Path2D),ht.push(new Path2D);for(let ot=0;ot<3;ot++)et.push(new Path2D);const Wt=new Path2D,kt=Math.round(m0*P.count*L*(P.crowd?2:1)/G);for(let ot=0;ot<kt;ot++){const ut=I()*Gn-u,vt=I()*Gn-u,Yt=I(),Gt=I(),Dt=I(),wt=I(),Ct=I(),Ft=I();if(Ft*8>Math.min(ut+u,Gn-u-ut,vt+u,Gn-u-vt)||P.crowd&&Ft>(f(ut,vt)>0?.5/Math.max(.25,J(gn,ut,vt)):.5))continue;const[qt,Bt]=Mt(ut,vt),Vt=J(_t,ut,vt),jt=J(sn,ut,vt)/Cs,Nt=(Gt-.5)*(.6+.8*D)*(1-.5*Vt),on=Math.cos(Nt),Zt=Math.sin(Nt),Ut=qt*on-Bt*Zt,tn=qt*Zt+Bt*on,Pn=Dt<.1?1.35+.6*wt:1,Yn=(P.len+P.vary*wt*wt)*h*T*Pn*jt*(1-P.endOn+1.25*P.endOn*Vt);cs(ut,vt,Ut,tn,.1+.5*Ws(ot,7+R));let Dn=.22*qn(ln,ut,vt)+.3*qn(Sn,ut,vt);const fo=Yt<P.light*(.4+.6*Xt[2]);fo?Dn+=.2+.28*Ct:Yt<P.light+P.dark&&(Dn-=.2+.28*Ct),Dn+=P.lift,Dn+=.45*(Xt[2]-.5)-.35*Xt[8],Dn>0&&(Dn*=.3+.7*Xt[2]);const uo=.15*(1-Xt[2]),to=(ut+st)*h,Rn=(vt+st)*h,Tn=(I()-.5)*P.bend*D*Yn,In=Ct<.3?-.6*Tn:Tn*(.6+.8*I()),Hn=P.clump[0]+(I()*(P.clump[1]+1)|0),Un=P.clumpW*h*Math.min(1.5,T);for(let po=0;po<Hn;po++){const $n=Hn>1?I()-.5:0,mn=Hn>1?.7+.3*I():1,ee=Hn>1?(I()-.5)*.3:0,To=to-tn*$n*Un,ko=Rn+Ut*$n*Un,On=Yn*mn,zo=Tn+ee*On,mo=In+ee*On-$n*Un*.7,Io=To+Ut*On*.33-tn*zo,qo=ko+tn*On*.33+Ut*zo,Lo=To+Ut*On*.67-tn*mo,ke=ko+tn*On*.67+Ut*mo,ds=To+Ut*On-tn*(In-$n*Un*.75),we=ko+tn*On+Ut*(In-$n*Un*.75),Nn=On<4?2:On<10?3:sa;for(let hn=0;hn<=Nn;hn++){const wn=hn/Nn,no=1-wn,se=no*no*no,oo=3*no*no*wn,Do=3*no*wn*wn,wo=wn*wn*wn;xo[hn]=se*To+oo*Io+Do*Lo+wo*ds,Po[hn]=se*ko+oo*qo+Do*ke+wo*we}const fa=Dn+(Hn>1?(I()-.5)*.25:0),Xn=.3+.15*Xt[2];for(let hn=0;hn<Nn;hn++){const wn=Q[Ar(fa-.3-uo*(1-hn/Nn)+Xn*(hn+.5)/Nn)];wn.moveTo(xo[hn],Po[hn]),wn.lineTo(xo[hn+1],Po[hn+1])}if(fo&&P.over>0){Wt.moveTo(xo[1],Po[1]);for(let hn=2;hn<=Nn;hn++)Wt.lineTo(xo[hn],Po[hn])}if(po===0&&P.shadow>0&&Xt[2]>.25&&Dn>-.2){const hn=P.shadow*h*Math.min(1,T),wn=et[Math.min(2,(Xt[2]-.25)*4|0)];for(let no=1;no<=Nn;no++){const se=no/Nn,oo=-Z*hn*se,Do=-nt*hn*se+.3*hn*se;no===1&&wn.moveTo(xo[0],Po[0]),wn.lineTo(xo[no]+oo,Po[no]+Do)}}const _o=Nn>>1;if(Xt[0]>.3){const hn=tt[hs(Xt[0])];hn.moveTo(xo[_o],Po[_o]);for(let wn=_o+1;wn<=Nn;wn++)hn.lineTo(xo[wn],Po[wn])}if(Xt[1]>.1){const hn=ht[hs(Xt[1])];hn.moveTo(xo[_o],Po[_o]);for(let wn=_o+1;wn<=Nn;wn++)hn.lineTo(xo[wn],Po[wn])}}}const yt=Math.min(1,T)**P.short,mt=Math.max(.45,P.width*h*(.5+.5*yt));if(P.over>0&&(C.globalCompositeOperation="destination-out",C.lineWidth=mt,C.globalAlpha=P.over*yt,C.strokeStyle="#000",C.stroke(Wt),C.globalCompositeOperation="source-over"),P.shadow>0){C.lineWidth=mt*P.shadowW,C.strokeStyle="#000";for(let ot=0;ot<3;ot++)C.globalAlpha=.03*(ot+1)*yt,C.stroke(et[ot])}for(let ot=0;ot<Ye;ot++){const ut=Vo+(ot/(Ye-1)*2-1)*P.spread,vt=ut<Vo?C:p;vt.lineWidth=mt,vt.globalAlpha=P.alpha*yt*(ut<Vo?P.deep*(1-ut/Vo):(ut-Vo)/(255-Vo)),vt.strokeStyle=ut<Vo?"#000":"#fff",vt.stroke(Q[ot])}for(const ot of[A,S])ot.lineWidth=mt,ot.strokeStyle="#fff";for(let ot=0;ot<yo;ot++)A.globalAlpha=.4*(ot+.5)/yo,S.globalAlpha=.8*(ot+.5)/yo,A.stroke(tt[ot]),S.stroke(ht[ot]);C.globalAlpha=p.globalAlpha=A.globalAlpha=S.globalAlpha=1})}const Ge=new Path2D,aa=[];for(let P=0;P<yo;P++)aa.push(new Path2D);const ye=[],oe=zt/c;let ia=0;const ra=2;for(let P=0;P<ra;P++)it.push(()=>{if(P===0){for(let G=0;G<c*c;G++)t.sd[G]>-1.6&&t.sd[G]<2.2&&ye.push(G);ia=Math.round(ye.length*oe*oe*24*(.3+1.4*O)*Math.sqrt(L)*(.5+.5*Math.min(1,o/512))*(1-.55*Xe))}const B=Math.floor(ia*(P+1)/ra);for(let G=Math.floor(ia*P/ra);G<B;G++){const R=ye[I()*ye.length|0],Q=(R%c+I())*oe-st,tt=((R/c|0)+I())*oe-st,ht=f(Q,tt);if(ht<-1.2||ht>1.8)continue;const et=ht+Bn(Q,tt);if(et<-.2||et>1.2)continue;const[Wt,kt]=Pt(Q,tt),[yt,mt]=ft(Q,tt),ot=(I()-.5)*1.1,ut=Math.cos(ot),vt=Math.sin(ot);let Yt=Wt*ut-kt*vt,Gt=Wt*vt+kt*ut;const Dt=I(),wt=1+.5*W*Math.max(0,mt)-.35*W*Math.max(0,-mt);let Ct=(.3+1.5*Dt*Dt*Dt)*h*T*(.5+O)*wt;const Ft=(Q+st)*h,qt=(tt+st)*h;let Bt=(I()-.5)*1.17*D*Ct;mt<-.3&&I()<.06*(.3+O)&&(Yt=yt*.8+(I()-.5)*.6,Gt=mt*.8,Ct*=1.2,Bt=(I()<.5?-1:1)*(.25+.3*W)*Ct),Ge.moveTo(Ft,qt);const Vt=Ft+Yt*Ct*.5-Gt*Bt,jt=qt+Gt*Ct*.5+Yt*Bt,Nt=Ft+Yt*Ct,on=qt+Gt*Ct+W*Ct*.25;if(Ge.quadraticCurveTo(Vt,jt,Nt,on),cs(Q,tt,Yt,Gt,.3),Xt[1]>.08){const Zt=aa[hs(Xt[1])];Zt.moveTo(Ft,qt),Zt.quadraticCurveTo(Vt,jt,Nt,on)}}});const la=new Path2D,ca=[new Path2D,new Path2D,new Path2D],ha=[];for(let P=0;P<yo;P++)ha.push(new Path2D);it.push(()=>{const P=ye.length*oe*oe,B=P/3.8,G=Math.round(B/(.45+.3*T)*(.3+.8*O)*Math.sqrt(L)*(1+.6*Xe));for(let R=0,Q=0;R<G&&Q<6*G;Q++){const tt=ye[I()*ye.length|0],ht=(tt%c+I())*oe-st,et=((tt/c|0)+I())*oe-st,Wt=I(),kt=I(),yt=I(),mt=I(),ot=f(ht,et);if(ot<-.5||ot>1.6)continue;const ut=ot+Bn(ht,et);if(ut<0||ut>.9||qn(ln,ht,et)<-.4+.8*mt)continue;R++;const[vt,Yt]=Pt(ht,et),[Gt,Dt]=ft(ht,et),wt=(Wt-.5)*.8*(.5+D),Ct=Math.cos(wt),Ft=Math.sin(wt);let qt=.75*Gt+.25*vt,Bt=.75*Dt+.25*Yt,Vt=.55*vt+.45*Gt,jt=.55*Yt+.45*Dt+.35*W;const Nt=Math.hypot(qt,Bt)||1,on=Math.hypot(Vt,jt)||1;[qt,Bt]=[(qt*Ct-Bt*Ft)/Nt,(qt*Ft+Bt*Ct)/Nt],[Vt,jt]=[(Vt*Ct-jt*Ft)/on,(Vt*Ft+jt*Ct)/on];const Zt=1+.5*W*Math.max(0,Dt)-.35*W*Math.max(0,-Dt),Ut=(.5+1.1*kt*kt)*h*T*(.5+O)*Zt,tn=(.3+.35*yt)*h*Math.min(1.5,T),Pn=(ht+st)*h,Yn=(et+st)*h,Dn=Pn+qt*Ut*.5,fo=Yn+Bt*Ut*.5,uo=Pn+(qt*.4+Vt*.6)*Ut,to=Yn+(Bt*.4+jt*.6)*Ut,Rn=-Bt,Tn=qt;cs(ht,et,Vt,jt,.4);const In=Xt[1]>.08?ha[hs(Xt[1])]:null,Hn=ca[Math.min(2,Xt[2]*3|0)],Un=4+(I()*5|0);for(let po=0;po<Un;po++){const $n=I()-.5,mn=.7+.3*I(),ee=(I()-.5)*.35,To=Pn+Rn*$n*tn,ko=Yn+Tn*$n*tn,On=Dn+Rn*$n*tn*.6,zo=fo+Tn*$n*tn*.6,mo=To+(uo+Rn*($n*.25+ee)*tn-To)*mn,Io=ko+(to+Tn*($n*.25+ee)*tn-ko)*mn;la.moveTo(To,ko),la.quadraticCurveTo(On,zo,mo,Io);const qo=.25*To+.5*On+.25*mo,Lo=.25*ko+.5*zo+.25*Io;Hn.moveTo(qo,Lo),Hn.quadraticCurveTo(.5*(On+mo),.5*(zo+Io),mo,Io),In&&(In.moveTo(qo,Lo),In.quadraticCurveTo(.5*(On+mo),.5*(zo+Io),mo,Io))}}}),it.push(()=>{const P=Math.max(.4,.11*h);C.lineWidth=p.lineWidth=S.lineWidth=P,C.globalCompositeOperation="destination-out",C.globalAlpha=.6,C.strokeStyle="#000",p.strokeStyle="#fff";for(let B=0;B<3;B++)C.stroke(ca[B]),p.globalAlpha=.08+.11*B,p.stroke(ca[B]);C.globalCompositeOperation="source-over",S.strokeStyle="#fff";for(let B=0;B<yo;B++)S.globalAlpha=(B+.5)/yo,S.stroke(ha[B]);C.globalAlpha=p.globalAlpha=S.globalAlpha=1,p.lineWidth=C.lineWidth=Math.max(.35,.08*h),p.globalAlpha=.5*((140-Vo)/(255-Vo)),p.strokeStyle="#fff",p.stroke(Ge),p.globalAlpha=1,S.lineWidth=p.lineWidth,S.strokeStyle="#fff";for(let B=0;B<yo;B++)S.globalAlpha=(B+.5)/yo,S.stroke(aa[B]);S.globalAlpha=1,C.globalCompositeOperation="destination-out",C.globalAlpha=.7,C.strokeStyle="#000",C.stroke(Ge),C.globalAlpha=1,C.globalCompositeOperation="source-over"});const M0=new ImageData(o,o),g0=new ImageData(o,o),b0=new ImageData(o,o),fs=.5+1.2*O,vr=fs+Jn,Sr=kl*(1-.6*Xe),xr=wl*(1+1.2*Xe),Ke=Math.max(1,Math.round(Cl*T*h)),us=Ke+1,Pr=br*Math.sqrt(1+Ke*(2*Ke+1)/(3*us))/us,y0=Math.round($o*h);return q(o,64,(P,B)=>{const G=M0.data,R=g0.data,Q=b0.data;for(let tt=P;tt<B;tt++){const ht=(tt+.5)/h-st;for(let et=0;et<o;et++){const Wt=(et+.5)/h-st,kt=(tt*o+et)*4;G[kt]=G[kt+1]=G[kt+2]=R[kt]=R[kt+1]=R[kt+2]=255;const yt=f(Wt,ht);if(yt>=Jn+Sa){G[kt+3]=Q[kt+3]=255;continue}const mt=yt<=-vr?yt:yt+Bn(Wt,ht);if(mt>=0){G[kt+3]=255,Q[kt+3]=Math.round(255*en(.25*Sa,Sa,mt));continue}const ot=Math.min(1,-mt/(2*fs)),ut=J(Mn,Wt,ht)*V[0]+J(an,Wt,ht)*V[1];if(R[kt+3]=Math.round(255*Al*ot*ot*(3-2*ot)*(.45+.55*en(-.3,.6,ut))),mt<=-fs)continue;const vt=1+mt/fs,Yt=vt*vt*(3-2*vt),[Gt,Dt]=Ht(Wt,ht);let wt=0;for(let Ft=-Ke;Ft<=Ke;Ft++){const qt=Math.round(et+y0+Gt*Ft),Bt=Math.round(tt+y0+Dt*Ft);wt+=(qt<0||Bt<0||qt>=i||Bt>=i?Be:Js[Bt*i+qt])*(1-Math.abs(Ft)/us)}const Ct=(wt/us-Be)/Pr;G[kt+3]=Math.round(255*Math.max(0,Math.min(1,Yt*(Sr+xr*Ct))))}}}),it.push(()=>{const P=Wn(o),B=P&&Ln(P,!1);P&&B&&(B.putImageData(g0,0,0),m.haze=P),k.putImageData(M0,0,0),k.lineCap="round",k.lineWidth=Math.max(.35,.08*h),k.strokeStyle="rgba(255,255,255,0.45)",k.stroke(Ge),k.lineWidth=Math.max(.4,.11*h),k.strokeStyle="rgba(255,255,255,0.8)",k.stroke(la);const G=Wn(o),R=G&&Ln(G,!1);G&&R&&(R.putImageData(b0,0,0),m.core=G),m.dark=g,m.light=M,m.glint=w,m.back=v,m.backSoft=y,m.mask=b,l(m)}),{steps:it}}function El(t){if(t.cut||!t.mask)return t.cut;const n=t.mask.width,o=Wn(n),e=o&&Ln(o,!1);return o&&e&&(e.fillRect(0,0,n,n),e.globalCompositeOperation="destination-out",e.drawImage(t.mask,0,0),t.cut=o),t.cut}function $l(t,n,o,e){const{V:a,U:s,D:r}=o,l=e.vivid??0,c=[0,0,0],h=tr(s,a,e.front),d=nr(o.K,a),f=Math.max(.03,.2-.15*e.shadow),u=Math.max(.04,.24-.13*e.shadow),i=Math.min(.7,.05+.12*e.spread),m=1.3,g=.34*Math.min(1.6,e.shadow/.35),M=Qo([-.55*s[0]+.85*a[0]+.15*r[0],-.55*s[1]+.85*a[1]+.15*r[1],-.55*s[2]+.85*a[2]+.15*r[2]]),b=e.sheen??0,w=Math.min(1,Math.max(0,e.backSoft??Xs)),v=.16*e.highlight*b,y=1.15*e.rim*b,C=.2+.25*l,p=Math.max(n[0],n[1],n[2],.02),k=[n[0]/p,n[1]/p,n[2]/p],A=[k[0],k[1],k[2]],S=.45*(1-l),E=.25*(1-l),I=[S+(1-S)*k[0],S+(1-S)*k[1],S+(1-S)*k[2]],z=[E+(1-E)*k[0],E+(1-E)*k[1],E+(1-E)*k[2]],x=D=>.2126*D[0]+.7152*D[1]+.0722*D[2],$=1.8+2.2*l,T=[Math.pow(n[0],$),Math.pow(n[1],$),Math.pow(n[2],$)],L=x(n)/Math.max(1e-4,x(T)),O=[T[0]*L,T[1]*L,T[2]*L],_=[k[0]*k[0]*n[0],k[1]*k[1]*n[1],k[2]*k[2]*n[2]];for(let D=0;D<Qt;D++)for(let W=0;W<Qt;W++){let K=W/(Qt-1)*2-1,Z=D/(Qt-1)*2-1,nt=K*K+Z*Z;if(nt>1.14)continue;if(nt>1){const St=1/Math.sqrt(nt);K*=St,Z*=St,nt=1}const dt=Math.sqrt(1-nt),pt=K*h[0]+Z*h[1]+dt*h[2],At=Math.max(0,K*a[0]+Z*a[1]+dt*a[2]),j=K*r[0]+Z*r[1]+dt*r[2],V=K*d[0]+Z*d[1]+dt*d[2],U=1-At,It=i+(.45-i)*U*U;let Y=Math.min(1,Math.max(0,(pt+It)/(1+It)));Y=Math.pow(Y,1.35);const lt=u*Math.max(0,K*M[0]+Z*M[1]+dt*M[2]),ft=1-g*Math.max(0,j)*(.6+.4*U),Pt=(f+m*Y+lt)*ft,it=Math.min(1,Math.max(0,1-Pt)),q=Math.max(0,1-(pt+.08)*(pt+.08)/.18),F=C*q*q*ft,bt=Math.min(1,Math.max(0,(pt+.2)/.8)),H=v*U*U*bt,Et=en(-.3,.6,V),Lt=en(.18-.12*w,.62+.18*w,U),Cn=y*Lt*Math.sqrt(Lt)*(.3+.7*Et)*(1-.7*Math.max(0,j)),_t=Lt*Lt*Math.sqrt(Lt)*(1-.5*w),Mn=(D*Qt+W)*3;let an=0,gn=0,Ot=0;for(let St=0;St<3;St++){const yn=(n[St]+(O[St]-n[St])*it*.9)*Pt+F*_[St]+H*z[St]+Cn*(A[St]+(I[St]-A[St])*_t);St===0?an=yn:St===1?gn=yn:Ot=yn}const Rt=Math.max(an,gn,Ot);if(Rt>.8){const St=(.8+.2*(1-Math.exp(-(Rt-.8)/.2)))/Rt;an*=St,gn*=St,Ot*=St}l>0&&(c[0]=an,c[1]=gn,c[2]=Ot,Re(c,l,1),[an,gn,Ot]=c),t[Mn]=ao(an),t[Mn+1]=ao(gn),t[Mn+2]=ao(Ot)}}const Ol=.28,Wl=.42,V0=new WeakMap;function zl(t,n,o=0){const e=t.dark;if(!e)return null;let a=V0.get(t);a||V0.set(t,a=new Map);const s=Math.round(Math.min(1,o)*10)/10,r=`${n}|${s}`,l=a.get(r);if(l!==void 0)return l;const c=Wn(e.width),h=c&&Ln(c,!1);if(c&&h){const d=Eo(n),f=[ao(d[0])/255,ao(d[1])/255,ao(d[2])/255],u=Math.max(f[0],f[1],f[2],.001),i=.2126*f[0]+.7152*f[1]+.0722*f[2],m=Math.min(f[0],f[1],f[2])/u,g=Ol+Wl*i*i*m,M=C=>Math.round(255*g*C*Math.pow(C/u,3.2+3*s)),b=M(f[0]),w=M(f[1]),v=M(f[2]),y=(.2126*b+.7152*w+.0722*v)/255/Math.max(.001,i);h.globalAlpha=Math.min(1,Math.sqrt((1-Ji)/Math.max(.05,1-y))),h.drawImage(e,0,0),h.globalAlpha=1,h.globalCompositeOperation="source-in",h.fillStyle=`rgb(${b} ${w} ${v})`,h.fillRect(0,0,e.width,e.height)}return a.size>=4&&a.clear(),a.set(r,c&&h?c:null),c&&h?c:null}const N0=.6,Z0=new WeakMap;function ql(t,n,o){const e=t.light;if(!e)return null;const a=Math.round((N0+(1-N0)*Math.min(1,Math.max(0,o)))*10)/10,s=`${n}|${a}`;let r=Z0.get(t);r||Z0.set(t,r=new Map);const l=r.get(s);if(l!==void 0)return l;const c=Wn(e.width),h=c&&Ln(c,!1);if(c&&h){h.drawImage(e,0,0),h.globalCompositeOperation="source-in";const d=Eo(n),f=[ao(d[0]),ao(d[1]),ao(d[2])],u=Math.max(f[0],f[1],f[2],1),i=m=>Math.round(255+(255*m/u-255)*Math.min(1,a));h.fillStyle=`rgb(${i(f[0])} ${i(f[1])} ${i(f[2])})`,h.fillRect(0,0,e.width,e.height)}return r.size>=6&&r.clear(),r.set(s,c&&h?c:null),c&&h?c:null}const U0=new WeakMap;function _l(t,n,o){const e=t.glint,a=t.back;if(!e||!a)return null;const s=Math.min(1,.45*o.highlight*(o.shine??0)),r=Math.min(1,1.1*o.rim);if(s<=.01&&r<=.01)return null;const l=Math.min(1,o.vivid??0),c=Math.min(1,Math.max(0,Math.round((o.backSoft??Xs)*20)/20)),h=`${n}|${s.toFixed(2)}|${r.toFixed(2)}|${l.toFixed(1)}|${c}`;let d=U0.get(t);d||U0.set(t,d=new Map);const f=d.get(h);if(f!==void 0)return f;const u=e.width,i=Wn(u),m=i&&Ln(i,!1),g=Wn(u),M=g&&Ln(g,!1);if(i&&m&&g&&M){const b=Eo(n),w=[ao(b[0]),ao(b[1]),ao(b[2])],v=Math.max(w[0],w[1],w[2],1),y=p=>`rgb(${[0,1,2].map(k=>Math.round(255+(255*w[k]/v-255)*p)).join(" ")})`,C=[[a,y(.65+.35*l),r*(1-.85*c)],[t.backSoft,y(.7+.3*l),r*c],[e,y(.45+.55*l),s]];for(const[p,k,A]of C)p&&(A<=.01||(M.globalCompositeOperation="copy",M.drawImage(p,0,0),M.globalCompositeOperation="source-in",M.fillStyle=k,M.fillRect(0,0,u,u),m.globalAlpha=A,m.drawImage(g,0,0)));m.globalAlpha=1}return d.size>=6&&d.clear(),d.set(h,i&&m?i:null),i&&m?i:null}const Qo=t=>{const n=Math.hypot(t[0],t[1],t[2])||1;return[t[0]/n,t[1]/n,t[2]/n]};function Ja(t){const n=Math.cos(t.roll),o=Math.sin(t.roll),e=n*t.lx+o*t.ly,a=-o*t.lx+n*t.ly,s=t.facing<0?-1:1,r=s*Math.min(1,Math.abs(t.facing)/.16),{cy:l,sy:c,cp:h,sp:d}=t,f=($,T,L,O=r)=>Qo([l*$+c*d*T-c*h*L,h*T+d*L,O*(c*$-l*d*T+l*h*L)]),u=f(F0*e,F0*a,Xr),i=f(0,0,1,s),m=Qo([u[0]+i[0],u[1]+i[1],u[2]+i[2]]),g=f(e,a,0,s),M=Math.cos(80*Math.PI/180),b=Math.sin(80*Math.PI/180),w=M*e-b*a,v=b*e+M*a,y=Qo([.55*w,.55*v,.83]),C=Qo([y[1],-y[0],0]),p=[y[1]*C[2]-y[2]*C[1],y[2]*C[0]-y[0]*C[2],y[0]*C[1]-y[1]*C[0]],k=f(y[0],y[1],y[2],s),A=f(C[0],C[1],C[2],s),S=f(p[0],p[1],p[2],s),E=f(o,n,0,s),[I,z]=t.bx!==void 0&&t.by!==void 0?[t.bx,t.by]:Ua(t.lx,t.ly),x=f(n*I+o*z,-o*I+n*z,0,s);return{L:u,V:i,H:m,U:g,W:k,A,B:S,D:E,K:x}}const Q0=new WeakMap;function Dl(t,n){const o=t.canvas??t;let e=Q0.get(o);e||(e=new Map,Q0.set(o,e));let a=e.get(n);return a||(a={N:0,img:null,mc:new Float32Array(Es*3),mcPrev:new Float32Array(Es*3),mcMix:new Float32Array(Es*3),mixVersion:0,blendT:1,blendFrames:1,sinceBuild:0,L:null,V:null,lx:NaN,ly:NaN,base:"",shadow:NaN,highlight:NaN,spread:NaN,rim:NaN,vivid:NaN,front:NaN,sheen:NaN,backSoft:NaN,K:null,version:0,imgVersion:-1,imgAoK:NaN,imgForm:null,aoK:-1,aoMul:new Float32Array(256),scratch:[null,null],scratchIdx:0,scratchN:0,scratchStale:!0,sprites:[null,null,null,null,null],sliceG:[],sliceIns:[],sliceSpr:new Map,sliceSprKey:"",sliceSprMade:new Set,sliceKey:"",body:[null,null],bodyIdx:0,spriteVersion:-1,spritePx:0,spriteFur:null,miss:[0,0],missAt:[0,0],turnAt:[0,0],fade:null,lay:1,layTmp:null,haloTmp:null},e.size>4&&e.clear(),e.set(n,a)),a}const xa=1/48,Pa=(t,n)=>!n||Math.abs(t[0]-n[0])>=xa||Math.abs(t[1]-n[1])>=xa||Math.abs(t[2]-n[2])>=xa;function ve(t,n){return[t[0]*n[0]+t[2]*n[1],t[1]*n[0]+t[3]*n[1],t[0]*n[2]+t[2]*n[3],t[1]*n[2]+t[3]*n[3],t[0]*n[4]+t[2]*n[5]+t[4],t[1]*n[4]+t[3]*n[5]+t[5]]}function J0(t,n,o){const{N:e,sd:a}=n,s=t.data,r=h=>(h+st)/zt*e-.5,l=[],c=[];for(let h=0;h<Oo;h++){const d=h/Oo*Math.PI*2,f=Math.cos(d),u=Math.sin(d),i=[],m=[];for(let g=0;g<80;g+=.5){const M=o[0]+f*g,b=o[1]+u*g,w=ue(a,e,r(M),r(b));if(w<0)break;const v=Math.round(r(M)),y=Math.round(r(b));if(v<0||y<0||v>=e||y>=e)break;const C=(y*e+v)*4;i.push(w),m.push(s[C],s[C+1],s[C+2])}l.push(Float32Array.from(i)),c.push(Float32Array.from(m))}return{d:l,c}}function ti(t,n,o,e,a,s,r){const l=d=>{const f=n.d[d],u=n.c[d],i=typeof o=="number"?o:o[d],m=1-(typeof e=="number"?e:e[d]);let g=0;for(let M=0;M<f.length;M++)f[M]>=i&&(g=M);return u.length?`rgb(${u[g*3]*m|0} ${u[g*3+1]*m|0} ${u[g*3+2]*m|0})`:"rgb(0 0 0)"};if(!r&&typeof t.createConicGradient=="function"){const d=t.createConicGradient(0,a[0],a[1]);for(let f=0;f<=Oo;f++)d.addColorStop(f/Oo,l(f%Oo));return d}const c=t.createLinearGradient(a[0]+s[0]*50,a[1]+s[1]*50,a[0]-s[0]*50,a[1]-s[1]*50),h=d=>Math.round((d%(Math.PI*2)+Math.PI*2)%(Math.PI*2)/(Math.PI*2/Oo))%Oo;return c.addColorStop(0,l(h(Math.atan2(s[1],s[0])))),c.addColorStop(.5,l(h(Math.atan2(s[0],-s[1])))),c.addColorStop(1,l(h(Math.atan2(-s[1],-s[0])))),c}function Rl(t,n,o,e=0){const a=/rgb\((\d+) (\d+) (\d+)\)/.exec(Hl(t)),s=a?[+a[1],+a[2],+a[3]]:[255,255,255],r=Eo(n),l=[ao(r[0]),ao(r[1]),ao(r[2])],c=Math.max(l[0],l[1],l[2],1),h=Math.min(.85,.75*o),d=.45+.55*Math.min(1,e),f=u=>Math.round(s[u]+(255+(255*l[u]/c-255)*d-s[u])*h);return`rgb(${f(0)} ${f(1)} ${f(2)})`}function Hl(t){let n=-1,o=0,e=0,a=0;for(const r of t.c)for(let l=0;l<r.length;l+=3){const c=.2126*r[l]+.7152*r[l+1]+.0722*r[l+2];c>n&&(n=c,o=r[l],e=r[l+1],a=r[l+2])}const s=r=>Math.min(255,Math.round(r/4)*4);return`rgb(${s(o)} ${s(e)} ${s(a)})`}function qa(t,n,o,e,a,s,r,l,c){const h=s*t.cx[0]+r*t.cy[0],d=(s*o+r*e)*a;let f=l,u=0,i=!1;for(let m=1;m<n;m++){const g=s*t.cx[m]+r*t.cy[m]+t.scale[m]*(l-h);g+t.z[m]*d>f&&(f=g+t.z[m]*d,u=m,i=!1),g-t.z[m]*d>f&&(f=g-t.z[m]*d,u=m,i=!0)}return c&&(c.k=u,c.far=i),f}function Bl(t,n,o,e,a,s){if(s<=1e-4)return[1,0,0,1,0,0];const r=Us(t),l=Ys(r,e,a),c=Ys(r,-e,-a),h=qa(n,o,e,a,s,e,a,l),d=qa(n,o,e,a,s,-e,-a,c),f=(h+d)/Math.max(1,l+c)-1,u=h-(f+1)*l;return[1+f*e*e,f*e*a,f*e*a,1+f*a*a,e*u,a*u]}function jl(t,n,o,e,a,s,r,l){const c=Us(t),h=new Float32Array(Oo),d=new Float32Array(Oo),f=r[0]+r[3]-2,u={k:0,far:!1};for(let i=0;i<Oo;i++){const m=i/Oo*Math.PI*2,g=Math.cos(m),M=Math.sin(m),b=g*e+M*a,w=f/(1+f);let v=g-w*b*e,y=M-w*b*a;const C=Math.hypot(v,y);v/=C,y/=C,qa(n,o,e,a,s,v,y,Ys(c,v,y),u),h[i]=Math.max(za,n.inset[u.k]),d[i]=u.far?vl*l*(1-Math.exp(-2.4*(u.k/o))):0}return{inset:h,dark:d}}const ni=new WeakMap,eo=96,ze=.1;function Yl(t,n,o,e,a,s,r,l){const c=`${e}|${o.q}|${Math.round(s/ze)}|${Math.round(r/ze)}`;let h=ni.get(t);h||ni.set(t,h=new Map);const d=h.get(c);if(d||d===null&&!l)return d??null;if(h.size>256&&h.clear(),!l)return h.set(c,null),Ka(()=>{h.set(c,oi(t,n,o,e,a,s,r))}),null;const f=oi(t,n,o,e,a,s,r);return h.set(c,f),f}function oi(t,n,o,e,a,s,r){const l=Wn(eo),c=l&&Ln(l,!0);if(!c)return[0,0];const h=zt/eo,d=a[0]*a[3]-a[1]*a[2],f=a[3]/d,u=-a[1]/d,i=-a[2]/d,m=a[0]/d,g=-(f*a[4]+i*a[5]),M=-(u*a[4]+m*a[5]);c.fillStyle="#fff";for(let p=0;p<e;p++)for(const k of p?[o.z[p],-o.z[p]]:[0]){c.setTransform(1/h,0,0,1/h,st/h,st/h),c.transform(f,u,i,m,g,M),c.translate(k*s,k*r);const A=o.scale[p];p&&c.transform(A,0,0,A,o.cx[p]-A*o.cx[0],o.cy[p]-A*o.cy[0]),c.fill(n)}const b=c.getImageData(0,0,eo,eo).data,w=new Uint8Array(eo*eo),v=new Float32Array(eo*eo);for(let p=0;p<eo*eo;p++)w[p]=b[p*4+3]>127?1:0;Oa(w,1,eo,v,null);let y=0,C=0;for(let p=0,k=0;p<eo;p++)for(let A=0;A<eo;A++,k++){const S=ue(t.sd,t.N,(A+.5)/eo*t.N-.5,(p+.5)/eo*t.N-.5);w[k]&&S<0&&(y=Math.max(y,-S)),!w[k]&&S>0&&(C=Math.max(C,Math.sqrt(v[k])*h))}return[y,C]}const Ta=typeof navigator<"u"&&/AppleWebKit\//.test(navigator.userAgent)&&!/Chrome\/|Chromium\/|Edg\//.test(navigator.userAgent),Xl=typeof navigator<"u"&&/Firefox\//.test(navigator.userAgent);function Gl(t,n,o,e,a,s){const r=Ns(o.dev),l=Yi(n.typeKey??ma(n.path),n.path,r,o.halfDepth,!!o.still);if(!l)return!1;const c=n.shading==="fabric",h=n.shading==="metal"||n.shading==="glass"||n.shading==="jelly"||n.shading==="neon",d=Math.ceil(zt*o.dev/100),f=(()=>{const[X,ct]=o.bx!==void 0&&o.by!==void 0?[o.bx,o.by]:Ua(o.lx,o.ly);return{bx:X,by:ct,front:s.front??Je}})(),u=c?Qa(l,n.typeKey??ma(n.path),o.halfDepth,d,!!o.still&&!n.furOnIdle,o.lx,o.ly,n.fur??pe,f):null;if(c&&!u)return!1;const i=Dl(t,(n.typeKey??ma(n.path))+(c?"|fabric":h?`|${n.shading}`:"")),m=Ja(o),g=(()=>{const X=Math.hypot(m.L[0],m.L[1]);return X<.05?[0,-1]:[m.L[0]/X,m.L[1]/X]})();if((Pa(m.L,i.L)||Pa(m.V,i.V)||o.lx!==i.lx||o.ly!==i.ly||e.base!==i.base||s.shadow!==i.shadow||s.highlight!==i.highlight||s.spread!==i.spread||s.rim!==i.rim||(s.vivid??0)!==i.vivid||(s.front??Je)!==i.front||(s.sheen??0)!==i.sheen||(s.backSoft??Xs)!==i.backSoft||c&&Pa(m.K,i.K))&&(i.version>0&&i.mcPrev.set(i.mcMix),c?$l(i.mc,Eo(e.base),m,s):n.shading==="metal"?Vl(i.mc,Eo(e.base),m,s):n.shading==="glass"?Nl(i.mc,Eo(e.base),m,s):n.shading==="jelly"?Zl(i.mc,Eo(e.base),m,s):n.shading==="neon"?Ul(i.mc,Eo(e.base),m,s):Na(i.mc,Eo(e.base),m,s),i.version===0||o.still?(i.mcMix.set(i.mc),i.blendT=1):(i.blendFrames=Math.min(10,Math.max(1,i.sinceBuild)),i.blendT=0),i.sinceBuild=0,i.mixVersion++,i.L=m.L,i.V=m.V,i.lx=o.lx,i.ly=o.ly,i.base=e.base,i.shadow=s.shadow,i.highlight=s.highlight,i.spread=s.spread,i.rim=s.rim,i.vivid=s.vivid??0,i.front=s.front??Je,i.sheen=s.sheen??0,i.backSoft=s.backSoft??Xs,i.K=m.K,i.version++),i.sinceBuild++,i.blendT<1){i.blendT=Math.min(1,i.blendT+1/i.blendFrames);const X=i.blendT>=1?1:i.blendT*i.blendT*(3-2*i.blendT),ct=i.mcPrev,at=i.mc,gt=i.mcMix;for(let xt=0;xt<Es*3;xt++)gt[xt]=ct[xt]+(at[xt]-ct[xt])*X;i.mixVersion++}const M=u?Math.min(1.2,.3+.8*s.shadow):h?Math.min(.8,.9*s.shadow):Math.min(1.3,1.2*s.shadow);if(M!==i.aoK){for(let X=0;X<256;X++)i.aoMul[X]=Math.max(0,1-M*(1-X/255));i.aoK=M}if((!i.img||i.N!==r)&&(i.img=new ImageData(r,r),i.N=r,i.imgVersion=-1),(i.imgVersion!==i.mixVersion||i.imgAoK!==M||i.imgForm!==l)&&(Za(l,i.mcMix,i.img.data,i.aoMul,u||h?nl(l):void 0),i.imgVersion=i.mixVersion,i.imgAoK=M,i.imgForm=l,i.scratchStale=!0),i.scratchN!==r&&(i.scratch=[null,null],i.scratchN=r,i.scratchStale=!0),i.scratchStale){i.scratchIdx^=1;let X=i.scratch[i.scratchIdx];if(!X){const ct=Wn(r),at=ct&&Ln(ct,!1);if(!ct||!at)return!1;X=i.scratch[i.scratchIdx]={c:ct,g:at}}X.g.putImageData(i.img,0,0),i.scratchStale=!1}const w=i.scratch[i.scratchIdx].c,v=o.dev<=100?14:o.dev<=224?20:26,y=Jr(l,v,o.round??1),{cy:C,sy:p,cp:k,sp:A}=o,[S,E,I,z,x,$]=o.ctm,T=p*A,L=S*C+I*T,O=E*C+z*T,_=I*k,D=z*k;t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high";const W=o.facing>=0?1:-1,K=p/C,Z=-A/(C*k),nt=Math.hypot(K,Z);let dt=50;for(let X=1;X<v;X++)dt=Math.max(dt,50*y.scale[X]+y.z[X]*nt);const pt=nt>1e-6?W*K/nt:1,At=nt>1e-6?W*Z/nt:0,j=Math.min(.7,.55*Math.min(1.6,s.shadow/.35)),V=u?Bl(l,y,v,pt,At,nt):null,U=Math.ceil(zt*o.dev/100);if(i.spritePx!==U&&(i.sprites=[null,null,null,null,null],i.spritePx=U,i.spriteVersion=-1),i.spriteVersion!==i.version||i.spriteFur!==u){const X=U/zt,ct=u?ol(l,u.R):null,at=J0(i.img,l,[y.cx[0],y.cy[0]]);for(let gt=0;gt<4;gt++){if(gt===2)continue;let xt=i.sprites[gt];if(!xt){const un=Wn(U),En=un&&Ln(un,!1);if(!un||!En)return!1;xt=i.sprites[gt]={c:un,g:En}}const Tt=xt.g;Tt.setTransform(1,0,0,1,0,0),Tt.globalCompositeOperation="source-over",Tt.clearRect(0,0,U,U),Tt.imageSmoothingEnabled=!0,Tt.imageSmoothingQuality="high";const rn=gt===0&&u&&u.mask?u:null;rn&&rn.haze&&(Tt.imageSmoothingQuality="low",Tt.drawImage(rn.haze,0,0,U,U),Tt.imageSmoothingQuality="high",Tt.globalCompositeOperation="source-in",Tt.fillStyle=Rl(at,e.base,s.rim,s.vivid??0),Tt.fillRect(0,0,U,U),Tt.globalCompositeOperation="destination-over"),Tt.setTransform(X,0,0,X,st*X,st*X);const rt=rn&&V?jl(l,y,v,pt,At,nt,V,j):null;Tt.fillStyle=gt===1?"#000":ti(Tt,at,rt?rt.inset:u?Math.max(za,y.inset[0]):y.inset[0],rt?rt.dark:0,[y.cx[0],y.cy[0]],g,Ta),u&&u.mask?(Tt.fillRect(-st,-st,zt,zt),Tt.setTransform(1,0,0,1,0,0),Tt.globalCompositeOperation="destination-in",Tt.drawImage((gt===0?u.mask:ct)??u.mask,0,0,U,U),Tt.globalCompositeOperation="source-over"):Tt.fill(n.path)}if(u&&u.core){let gt=i.sprites[4];if(!gt){const xt=Wn(U),Tt=xt&&Ln(xt,!1);xt&&Tt&&(gt=i.sprites[4]={c:xt,g:Tt})}gt&&(gt.g.setTransform(1,0,0,1,0,0),gt.g.globalCompositeOperation="copy",gt.g.drawImage(i.sprites[0].c,0,0),gt.g.globalCompositeOperation="destination-out",gt.g.drawImage(u.core,0,0,U,U),gt.g.globalCompositeOperation="source-over")}i.spriteVersion=i.version,i.spriteFur=u}const It=(dt+50)/100,Y=(dt-50)/2,lt=1+(It-1)*pt*pt,ft=(It-1)*pt*At,Pt=1+(It-1)*At*At,it=ve(ve(o.ctm,[C,T,0,k,0,0]),[lt,ft,ft,Pt,Y*pt-50*lt-50*ft,Y*At-50*ft-50*Pt]),q=u?.dark&&u.light?u:null;let F=t,bt=0,H=0,Et=0,Lt=0;if(q){let X=1/0,ct=1/0,at=-1/0,gt=-1/0;for(const Tt of[-y.top,y.top]){const rn=Tt*p-50*C,rt=-Tt*C*A-50*T-50*k,un=S*rn+I*rt+x,En=E*rn+z*rt+$;for(const cn of[-st,100+st])for(const _n of[-st,100+st]){const jn=L*cn+_*_n+un,dn=O*cn+D*_n+En;jn<X&&(X=jn),jn>at&&(at=jn),dn<ct&&(ct=dn),dn>gt&&(gt=dn)}}bt=Math.floor(X)-1,H=Math.floor(ct)-1,Et=Math.ceil(at)+1-bt,Lt=Math.ceil(gt)+1-H,i.bodyIdx^=1;let xt=i.body[i.bodyIdx];if(!xt||xt.w<Et||xt.h<Lt||xt.w>2*Et+64||xt.h>2*Lt+64){const Tt=Math.ceil(Et/64)*64,rn=Math.ceil(Lt/64)*64;let rt=null;typeof document<"u"?(rt=document.createElement("canvas"),rt.width=Tt,rt.height=rn):typeof OffscreenCanvas<"u"&&(rt=new OffscreenCanvas(Tt,rn));const un=rt&&Ln(rt,!1);xt=rt&&un?i.body[i.bodyIdx]={c:rt,g:un,w:rt.width,h:rt.height}:null}xt?(F=xt.g,F.setTransform(1,0,0,1,0,0),F.globalCompositeOperation="source-over",F.globalAlpha=1,F.clearRect(0,0,Et,Lt),F.imageSmoothingEnabled=!0,F.imageSmoothingQuality="high"):bt=H=0}const Cn=X=>{const ct=X*p-50*C,at=-X*C*A-50*T-50*k;F.setTransform(L,O,_,D,S*ct+I*at+x-bt,E*ct+z*at+$-H)},[_t,Mn,,an]=i.sprites,gn=[y.cx[0],y.cy[0]],Ot=`${i.version}|${v}|${y.q}`;if(i.sliceKey!==Ot){const X=J0(i.img,l,gn);i.sliceG=[],i.sliceIns=[];for(let ct=0;ct<v;ct++){const at=u?Math.max(za,y.inset[ct]):y.inset[ct];i.sliceIns.push(at),i.sliceG.push(ti(t,X,at,0,gn,g,Ta))}i.sliceKey=Ot}const Rt=Xl&&typeof document<"u",St=`${Ot}|${U}`;Rt&&i.sliceSprKey!==St&&(i.sliceSprKey=St,i.sliceSprMade=new Set,i.sliceSpr.size>32&&i.sliceSpr.clear());const sn=X=>{const ct=i.sliceIns[X];let at=i.sliceSpr.get(ct);if(at&&i.sliceSprMade.has(ct))return at;if(!at||at.c.width!==U){const xt=document.createElement("canvas");xt.width=xt.height=U;const Tt=xt.getContext("2d");if(!Tt)return;at={c:xt,g:Tt},i.sliceSpr.set(ct,at)}const gt=U/zt;return at.g.setTransform(1,0,0,1,0,0),at.g.clearRect(0,0,U,U),at.g.setTransform(gt,0,0,gt,st*gt,st*gt),at.g.fillStyle=i.sliceG[X],at.g.fill(n.path),i.sliceSprMade.add(ct),at},yn=(X,ct,at)=>{Cn(ct);const gt=y.scale[X];if(X>0){F.transform(gt,0,0,gt,y.cx[X]-gt*y.cx[0],y.cy[X]-gt*y.cy[0]);const xt=Rt?sn(X):void 0;xt?F.drawImage(xt.c,-st,-st,zt,zt):(F.fillStyle=i.sliceG[X],F.fill(n.path)),at>.01&&(F.globalAlpha=at,F.fillStyle="#000",F.fill(n.path),F.globalAlpha=1);return}u?F.drawImage(an.c,-st,-st,zt,zt):(F.fillStyle=i.sliceG[0],F.fill(n.path)),u&&F===t&&go>.01&&(F.globalAlpha=go,F.drawImage(_t.c,-st,-st,zt,zt),F.globalAlpha=1),at>.01&&(F.globalAlpha=at,F.drawImage(Mn.c,-st,-st,zt,zt),F.globalAlpha=1)},ro=Math.abs(o.facing),go=ro>=.8?1:ro<=.45?0:(ro-.45)/.35,J=el(l),Mt=J.x.length,Ht=l.sd,Kt=l.N,vn=1.5/(Math.sqrt(Math.abs(L*D-O*_))||1)+.4,ln=zt/Kt,Sn=X=>(X+st)/zt*Kt-.5,qn=Math.atan2(-W*Z,-W*K),lo=Math.atan2(W*Z,W*K);for(let X=v-1;X>=1;X--){const ct=-W*y.z[X],at=y.scale[X];if(u){const gt=y.cx[X]-at*y.cx[0]+ct*K,xt=y.cy[X]-at*y.cy[0]+ct*Z;let Tt=Number.isFinite(gt)&&Number.isFinite(xt);for(let rn=0;Tt&&rn<Mt;rn++){const rt=D0(Mt,qn,rn);ue(Ht,Kt,Sn(at*J.x[rt]+gt),Sn(at*J.y[rt]+xt))<vn+at*(J.d[rt]+ln)&&(Tt=!1)}if(Tt)continue}yn(X,ct,u?0:j*(1-Math.exp(-2.4*(X/v))))}if(u&&nt>.001){const X=Ys(Us(l),-pt,-At),ct=1.3*y.top*nt;Cn(0);const at=F.createLinearGradient(-pt*X,-At*X,-pt*(X+ct),-At*(X+ct));for(let gt=0;gt<=8;gt++){const xt=gt/8;at.addColorStop(xt,`rgba(0,0,0,${(j*(1-Math.exp(-2.4*xt))*xt*xt*(3-2*xt)).toFixed(3)})`)}F.globalCompositeOperation="source-atop",F.fillStyle=at,F.fillRect(-st-60,-st-60,zt+120,zt+120),F.globalCompositeOperation="source-over"}yn(0,0,0);const Fn=Math.abs(o.facing),Jn=Fn>=.72?1:Fn<=.34?0:((Fn-.34)/.38)**1.5,Bn=it[0]*it[3]-it[1]*it[2],ne=Vi+1.5/(Math.sqrt(Math.abs(Bn))||1);for(let X=1;X<v;X++){const ct=W*y.z[X],at=y.scale[X];if(Jn>=1&&Math.abs(Bn)>1e-9){const gt=ct*p-50*C,xt=-ct*C*A-50*T-50*k,Tt=S*gt+I*xt+x-it[4],rn=E*gt+z*xt+$-it[5],rt=y.cx[X]-at*y.cx[0],un=y.cy[X]-at*y.cy[0];let En=!0;for(let cn=0;En&&cn<Mt;cn++){const _n=D0(Mt,lo,cn),jn=at*J.x[_n]+rt,dn=at*J.y[_n]+un,xn=L*jn+_*dn+Tt,Vn=O*jn+D*dn+rn,So=(it[3]*xn-it[2]*Vn)/Bn,Jt=(it[0]*Vn-it[1]*xn)/Bn;ue(Ht,Kt,Sn(So),Sn(Jt))<ne+at*(J.d[_n]+ln)&&(En=!1)}if(En)continue}yn(X,ct,0)}if(Jn>.01&&(F.save(),F.setTransform(it[0],it[1],it[2],it[3],it[4]-bt,it[5]-H),F.globalAlpha=Jn,F.drawImage(w,-st,-st,zt,zt),F.restore()),u&&u.mask&&V&&F!==t){const X=W*K,ct=W*Z,at=Math.abs(X-i.missAt[0])>1.5*ze||Math.abs(ct-i.missAt[1])>1.5*ze,gt=nt>1e-4?Yl(l,n.path,y,v,V,X,ct,!!o.still||at):[0,0];gt&&(i.miss=gt,i.missAt=[X,ct]);const[xt,Tt]=i.miss,rn=Math.max(xt,Tt);let rt=en(Ze/2,2*Ze,rn),un=en(Ze/2,Ze,Tt);const En=Math.abs(X-i.turnAt[0])>ze||Math.abs(ct-i.turnAt[1])>ze;i.turnAt=[X,ct];const cn=!o.still&&!En;if(cn&&i.fade){const Jt=(kn,pn)=>Math.abs(pn-kn)<.02?pn:kn+(pn-kn)*.2;rt=Jt(i.fade[0],rt),un=Jt(i.fade[1],un)}i.fade=[rt,un];const _n=i.sprites[4];F.imageSmoothingQuality="low",Cn(0),F.transform(V[0],V[1],V[2],V[3],V[4],V[5]);const jn=(1-en(0,xl,rt))*(1-un),dn=i.lay=cn?i.lay+Math.max(-K0,Math.min(K0,jn-i.lay)):jn;let xn=null;if(dn>0&&dn<1){let Jt=i.layTmp;if(!Jt||Jt.c.width<Et||Jt.c.height<Lt){const kn=Math.ceil(Math.max(Et,Lt)/64)*64;let pn=null;typeof document<"u"?(pn=document.createElement("canvas"),pn.width=pn.height=kn):pn=Wn(kn);const Zn=pn&&Ln(pn,!1);Jt=i.layTmp=pn&&Zn?{c:pn,g:Zn}:null}Jt&&(xn=Jt.g,xn.setTransform(1,0,0,1,0,0),xn.globalAlpha=1,xn.globalCompositeOperation="copy",xn.drawImage(F.canvas,0,0,Et,Lt,0,0,Et,Lt),xn.imageSmoothingQuality="low",xn.setTransform(F.getTransform()))}const Vn=Sl*Math.min(1,nt/.2),So=Jt=>{if(Ta){let kn=i.haloTmp;if(!kn||kn.c.width<Et||kn.c.height<Lt){const pn=Math.ceil(Math.max(Et,Lt)/64)*64;let Zn=null;typeof document<"u"?(Zn=document.createElement("canvas"),Zn.width=Zn.height=pn):Zn=Wn(pn);const He=Zn&&Ln(Zn,!1);kn=i.haloTmp=Zn&&He?{c:Zn,g:He}:null}if(kn){const pn=kn.g;pn.setTransform(1,0,0,1,0,0),pn.globalCompositeOperation="source-over",pn.globalAlpha=1,pn.clearRect(0,0,Et,Lt),pn.imageSmoothingEnabled=!0,pn.imageSmoothingQuality="low",pn.setTransform(Jt.getTransform()),pn.drawImage(_t.c,-st,-st,zt,zt),Jt.save(),Jt.setTransform(1,0,0,1,0,0),Jt.globalCompositeOperation="destination-atop",Jt.drawImage(kn.c,0,0,Et,Lt,0,0,Et,Lt),Jt.restore()}}else Jt.globalCompositeOperation="destination-atop",Jt.drawImage(_t.c,-st,-st,zt,zt);_n&&Vn>.01&&(Jt.globalCompositeOperation="source-atop",Jt.globalAlpha=Vn,Jt.drawImage(_n.c,-st,-st,zt,zt),Jt.globalAlpha=1),Jt.globalCompositeOperation="source-over"};if(xn&&So(xn),dn>=1||!xn&&dn>=.5)So(F);else{const Jt=rt<1?El(u):null;if(Jt){const kn=1+rt*(rn+Ze)/25,pn=y.cx[0],Zn=y.cy[0];F.save(),F.transform(kn,0,0,kn,pn*(1-kn),Zn*(1-kn)),F.globalCompositeOperation="destination-out",F.drawImage(Jt,-st,-st,zt,zt),F.restore()}un<1&&(F.globalAlpha=1-un,F.globalCompositeOperation="destination-over",F.drawImage(_t.c,-st,-st,zt,zt),F.globalAlpha=1),xn&&(F.setTransform(1,0,0,1,0,0),F.globalCompositeOperation="destination-in",F.globalAlpha=1-dn,F.fillStyle="#000",F.fillRect(0,0,Et,Lt),F.globalCompositeOperation="lighter",F.globalAlpha=dn,F.drawImage(xn.canvas,0,0,Et,Lt,0,0,Et,Lt),F.globalAlpha=1)}F.globalCompositeOperation="source-over"}if(F!==t&&q){F.globalCompositeOperation="source-atop",F.imageSmoothingQuality="low";const X=Eo(e.base),ct=Math.pow(.2126*X[0]+.7152*X[1]+.0722*X[2],1/2.2),at=zl(q,e.base,s.vivid??0)??q.dark,gt=ql(q,e.base,s.vivid??0)??q.light,xt=o.dev<160?0:Fn>=.88?1:Fn<=.55?0:(Fn-.55)/.33,Tt=xt>.01?_l(q,e.base,s):null,rn=W*pl*(n.fur??pe).length,rt=ve(ve(ve(o.ctm,[1,0,0,1,rn*p,-rn*C*A]),[C,T,0,k,0,0]),[lt,ft,ft,Pt,Y*pt-50*lt-50*ft,Y*At-50*ft-50*Pt]),un=(cn,_n,jn,dn=cn)=>{F.setTransform(cn[0],cn[1],cn[2],cn[3],cn[4]-bt,cn[5]-H),F.globalAlpha=_n,F.drawImage(at,-st-$o,-st-$o,Gn,Gn),dn!==cn&&F.setTransform(dn[0],dn[1],dn[2],dn[3],dn[4]-bt,dn[5]-H),F.globalAlpha=_n*(.25+.75*ct),F.drawImage(gt,-st-$o,-st-$o,Gn,Gn),jn&&Tt&&(F.globalAlpha=_n*xt,F.drawImage(Tt,-st-$o,-st-$o,Gn,Gn)),F.globalAlpha=1},En=Fn>=.62?0:Fn<=.36?1:(.62-Fn)/.26;if(En<1&&un(it,1-En,!0,rt),En>0){const cn=o.dev/100,_n=bt+Et/2,jn=H+Lt/2;un([cn,0,0,cn,_n-50*cn,jn-50*cn],En,!1)}F.globalCompositeOperation="source-over",t.save(),t.setTransform(1,0,0,1,0,0),t.imageSmoothingEnabled=!1,t.drawImage(F.canvas,0,0,Et,Lt,bt,H,Et,Lt),t.restore()}t.setTransform(S,E,I,z,x,$);const bo=Fn>=.95?1:Fn<=.8?0:(Fn-.8)/.15;if(!u&&o.dev>=256&&s.rim>0&&s.highlight>0&&bo>.01){t.save(),t.globalCompositeOperation="source-atop",t.setTransform(it[0],it[1],it[2],it[3],it[4],it[5]);const X=bo*Math.min(.5,.3*s.rim*Math.min(1.4,s.highlight)),ct=t.createLinearGradient(50+g[0]*50,50+g[1]*50,50-g[0]*50,50-g[1]*50);ct.addColorStop(0,`rgba(235,244,255,${X.toFixed(3)})`),ct.addColorStop(.45,`rgba(235,244,255,${(.35*X).toFixed(3)})`),ct.addColorStop(.75,"rgba(235,244,255,0)"),t.strokeStyle=ct,t.lineJoin="round",t.lineWidth=1.3,t.stroke(n.path),t.restore()}return!0}const Kl=(t,n,o)=>{const e=Math.hypot(t,n,o)||1;return[t/e,n/e,o/e]};function Vl(t,n,o,e){const{V:a,W:s,A:r,B:l,D:c,K:h}=o,d=Math.max(n[0],n[1],n[2],.05),f=[.3+.7*(n[0]/d),.3+.7*(n[1]/d),.3+.7*(n[2]/d)],u=.62+.3*e.highlight,i=.1+.07*Math.min(2,e.spread),m=e.vivid??0,g=[0,0,0];for(let M=0;M<Qt;M++)for(let b=0;b<Qt;b++){let w=b/(Qt-1)*2-1,v=M/(Qt-1)*2-1,y=w*w+v*v;if(y>1.14)continue;if(y>1){const K=1/Math.sqrt(y);w*=K,v*=K,y=1}const C=Math.sqrt(1-y),p=Math.max(.02,w*a[0]+v*a[1]+C*a[2]);let k=2*p*w-a[0],A=2*p*v-a[1],S=2*p*C-a[2];const E=Math.sin(k*3.1+S*2.3+.7)*i,I=Math.sin(A*2.7-S*1.9+2.1)*i,z=Math.sin(k*2.2+A*2.9)*i*.5;[k,A,S]=Kl(k+E,A+I,S+z);const x=-(k*c[0]+A*c[1]+S*c[2]);let $=x>=0?.52+.62*Math.pow(x,.85):.07+.22*Math.min(1,-x*1.15);const T=(x-.02)/.1;$*=1-.82*Math.exp(-T*T);const L=k*s[0]+A*s[1]+S*s[2];if(L>.4){const K=(k*r[0]+A*r[1]+S*r[2])/L,Z=(k*l[0]+A*l[1]+S*l[2])/L;$+=2.6*de(.4,.1,Math.abs(K))*de(.2,.08,Math.abs(Z))}const O=k*h[0]+A*h[1]+S*h[2];$+=1.5*en(.84,.93,O)*(1-en(.97,1,O)),$*=u;const _=1-p,D=_*_*_*_*_;g[0]=(f[0]+(1-f[0])*D)*$+.015*n[0],g[1]=(f[1]+(1-f[1])*D)*$+.015*n[1],g[2]=(f[2]+(1-f[2])*D)*$+.015*n[2],Re(g,m*.5);const W=(M*Qt+b)*3;t[W]=so(g[0]),t[W+1]=so(g[1]),t[W+2]=so(g[2])}}function Nl(t,n,o,e){const{L:a,V:s,H:r,U:l,W:c,A:h,B:d}=o,f=Math.max(n[0],n[1],n[2],.05),u=[n[0]/f,n[1]/f,n[2]/f],i=e.vivid??0,m=[0,0,0],g=Math.min(90,Math.round(140/Math.pow(e.spread,1.2))),M=Te(g);for(let b=0;b<Qt;b++)for(let w=0;w<Qt;w++){let v=w/(Qt-1)*2-1,y=b/(Qt-1)*2-1,C=v*v+y*y;if(C>1.14)continue;if(C>1){const j=1/Math.sqrt(C);v*=j,y*=j,C=1}const p=Math.sqrt(1-C),k=v*a[0]+y*a[1]+p*a[2],A=Math.max(0,v*s[0]+y*s[1]+p*s[2]),S=Math.max(0,v*r[0]+y*r[1]+p*r[2]),E=1-A,I=E*E*E,z=I*E*E,x=en(-.6,.9,k);let $=(.13+.26*x)*(.55+.9*E);const T=Math.exp(-Math.pow((E-.62)/.16,2));$*=1-.42*T;const L=-(v*l[0]+y*l[1]+p*l[2]),O=en(.15,.85,L)*(1-en(.55,.98,E))*(.45+.55*A),_=.1+1.15*I,D=1.1*M[S*fe|0],W=2*A*v-s[0],K=2*A*y-s[1],Z=2*A*p-s[2],nt=W*c[0]+K*c[1]+Z*c[2];let dt=0;if(nt>.5){const j=(W*h[0]+K*h[1]+Z*h[2])/nt,V=(W*d[0]+K*d[1]+Z*d[2])/nt;dt=de(.3,.08,Math.abs(j))*de(.11,.05,Math.abs(V))}m[0]=n[0]*$+u[0]*(.95*O+.4*_*(.4+.6*x)),m[1]=n[1]*$+u[1]*(.95*O+.4*_*(.4+.6*x)),m[2]=n[2]*$+u[2]*(.95*O+.4*_*(.4+.6*x)),Re(m,i);const pt=D+.55*dt*e.highlight+.55*z,At=(b*Qt+w)*3;t[At]=so(m[0]+pt*.96),t[At+1]=so(m[1]+pt),t[At+2]=so(m[2]+pt*1.02)}}function Zl(t,n,o,e){const{L:a,V:s,H:r,W:l,A:c,B:h,D:d}=o,f=Math.max(n[0],n[1],n[2],.05),u=[n[0]/f,n[1]/f,n[2]/f],i=e.vivid??0,m=[0,0,0],g=Math.min(90,Math.round(150/Math.pow(e.spread,1.1))),M=Te(g),b=Te(Math.max(2,Math.round(10/e.spread))),w=.9+.22*e.highlight,v=.8+.6*e.rim;for(let y=0;y<Qt;y++)for(let C=0;C<Qt;C++){let p=C/(Qt-1)*2-1,k=y/(Qt-1)*2-1,A=p*p+k*k;if(A>1.14)continue;if(A>1){const lt=1/Math.sqrt(A);p*=lt,k*=lt,A=1}const S=Math.sqrt(1-A),E=p*a[0]+k*a[1]+S*a[2],I=Math.max(0,p*s[0]+k*s[1]+S*s[2]),z=Math.max(0,p*r[0]+k*r[1]+S*r[2]),x=1-I,$=x*x*x,T=$*x*x,L=en(-.7,.95,E),O=p*d[0]+k*d[1]+S*d[2],_=en(-.2,.9,O),D=Math.exp(-Math.pow((x-.44)/.21,2)),W=en(.28,.96,O)*(.35+.65*$),K=(.58+.34*L)*(1-.16*_),Z=(.3*D+.24*W+.2*$)*v;m[0]=n[0]*K+u[0]*Z,m[1]=n[1]*K+u[1]*Z,m[2]=n[2]*K+u[2]*Z,Re(m,i);const nt=2*I*p-s[0],dt=2*I*k-s[1],pt=2*I*S-s[2],At=nt*l[0]+dt*l[1]+pt*l[2];let j=0;if(At>.5){const lt=(nt*c[0]+dt*c[1]+pt*c[2])/At,ft=(nt*h[0]+dt*h[1]+pt*h[2])/At;j=de(.28,.09,Math.abs(lt))*de(.1,.05,Math.abs(ft))}const V=z*fe|0,It=(.9*M[V]+.22*b[V])*e.highlight*(1+2.2*T)+.55*j*e.highlight+.42*T*w,Y=(y*Qt+C)*3;t[Y]=so(m[0]+It*.96),t[Y+1]=so(m[1]+It),t[Y+2]=so(m[2]+It*1.02)}}function Ul(t,n,o,e){const{L:a,V:s,K:r}=o,l=Math.max(n[0],n[1],n[2],.05),c=Math.min(n[0],n[1],n[2]),h=1-en(.08,.3,(l-c)/l),d=[n[0]/l*(1-h)+.12*h,n[1]/l*(1-h)+.88*h,n[2]/l*(1-h)+h],f=[d[2],d[0],d[1]],u=Math.max(.3,e.vivid??0),i=[0,0,0],m=[0,0,0],g=.8+.5*e.rim;for(let M=0;M<Qt;M++)for(let b=0;b<Qt;b++){let w=b/(Qt-1)*2-1,v=M/(Qt-1)*2-1,y=w*w+v*v;if(y>1.14)continue;if(y>1){const T=1/Math.sqrt(y);w*=T,v*=T,y=1}const C=Math.sqrt(1-y),p=w*a[0]+v*a[1]+C*a[2],A=1-Math.max(0,w*s[0]+v*s[1]+C*s[2]),S=en(-.5,1,p),E=en(-.1,.75,w*r[0]+v*r[1]+C*r[2]);for(let T=0;T<3;T++)m[T]=d[T]+(f[T]-d[T])*.75*E;const I=Math.pow(A,2.2)*2.1*g+.22*Math.pow(A,1.1),z=Math.pow(A,7)*1.6,x=.05+.2*S;i[0]=n[0]*x+m[0]*I,i[1]=n[1]*x+m[1]*I,i[2]=n[2]*x+m[2]*I,Re(i,u,2.2);const $=(M*Qt+b)*3;t[$]=so(i[0]+z*(.55+.45*m[0])),t[$+1]=so(i[1]+z*(.55+.45*m[1])),t[$+2]=so(i[2]+z*(.55+.45*m[2]))}}function er(t,n,o,e,a){return{m:t,o:n,L:o,H:e,px:a,toScreen:s=>{const r=s[0]-n[0],l=s[1]-n[1],c=s[2]-n[2];return[t[0]*r+t[1]*l+t[2]*c,t[3]*r+t[4]*l+t[5]*c]},depth:s=>t[6]*(s[0]-n[0])+t[7]*(s[1]-n[1])+t[8]*(s[2]-n[2]),dir:s=>Wo([t[0]*s[0]+t[1]*s[1]+t[2]*s[2],t[3]*s[0]+t[4]*s[1]+t[5]*s[2],t[6]*s[0]+t[7]*s[1]+t[8]*s[2]])}}const xe=(t,n)=>[t[0]-n[0],t[1]-n[1],t[2]-n[2]],ns=(t,n)=>[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]],io=(t,n)=>t[0]*n[0]+t[1]*n[1]+t[2]*n[2],Wo=t=>{const n=Math.hypot(t[0],t[1],t[2])||1;return[t[0]/n,t[1]/n,t[2]/n]},t0=Math.PI*2;function bn(t,n,o,e,a=11){return Math.max(o,Math.min(e,Math.round(n*t.px/a)))}function sr(t,n,o,e,a=!0){const s=n+1,r=s*(o+1),l=new Float64Array(r*3);let c=0;for(let g=0,M=0;g<=o;g++)for(let b=0;b<=n;b++,M++){const w=t(b/n,g/o);l[M*3]=w[0],l[M*3+1]=w[1],l[M*3+2]=w[2],c=Math.max(c,Math.abs(w[0]-l[0])+Math.abs(w[1]-l[1])+Math.abs(w[2]-l[2]))}const h=g=>[l[g*3],l[g*3+1],l[g*3+2]],d=new Float64Array(n*o*3);for(let g=0;g<o;g++)for(let M=0;M<n;M++){const b=g*s+M,w=h(b),v=h(b+1),y=h(b+s+1),C=h(b+s);let p=ns(xe(y,w),xe(C,v));const k=[(w[0]+v[0]+y[0]+C[0])/4,(w[1]+v[1]+y[1]+C[1])/4,(w[2]+v[2]+y[2]+C[2])/4],A=typeof e=="function"?e((M+.5)/n,(g+.5)/o):e;io(p,xe(k,A))<0&&(p=[-p[0],-p[1],-p[2]]),p=Wo(p);const S=(g*n+M)*3;d[S]=p[0],d[S+1]=p[1],d[S+2]=p[2]}const f=1e-6+c*1e-5,u=(g,M)=>Math.abs(l[g*3]-l[M*3])+Math.abs(l[g*3+1]-l[M*3+1])+Math.abs(l[g*3+2]-l[M*3+2])<f;let i=!0;for(let g=0;g<=o&&i;g++)i=u(g*s,g*s+n);let m=null;if(a){const g=new Float64Array(r*3);for(let b=0;b<o;b++)for(let w=0;w<n;w++){const v=(b*n+w)*3,y=b*s+w;for(const C of[y,y+1,y+s+1,y+s])g[C*3]+=d[v],g[C*3+1]+=d[v+1],g[C*3+2]+=d[v+2]}const M=b=>{let w=0,v=0,y=0;for(const C of b)w+=g[C*3],v+=g[C*3+1],y+=g[C*3+2];for(const C of b)g[C*3]=w,g[C*3+1]=v,g[C*3+2]=y};if(i)for(let b=0;b<=o;b++)M([b*s,b*s+n]);for(const b of[0,o]){let w=!0;for(let v=1;v<=n&&w;v++)w=u(b*s,b*s+v);w&&M(Array.from({length:s},(v,y)=>b*s+y))}for(let b=0;b<r;b++){const w=g[b*3],v=g[b*3+1],y=g[b*3+2],C=Math.hypot(w,v,y)||1;g[b*3]=w/C,g[b*3+1]=v/C,g[b*3+2]=y/C}m=g}return{nu:n,nv:o,closed:i,pos:l,fn:d,vn:m}}function Ql(t,n,o,e,a,s=!1){const l=c=>t(s?(c%1+1)%1:Math.max(0,Math.min(1,c)));return sr((c,h)=>{const d=t(c),f=Wo(xe(l(c+.001),l(c-.001))),u=io(n,f),i=Wo([n[0]-f[0]*u,n[1]-f[1]*u,n[2]-f[2]*u]),m=ns(f,i),[g,M]=o(c,h*t0);return[d[0]+i[0]*g+m[0]*M,d[1]+i[1]*g+m[1]*M,d[2]+i[2]*g+m[2]*M]},e,a,c=>t(c))}const Ie=(t,n,o=1)=>(e,a)=>{const s=Math.cos(a),r=Math.sin(a);return[t*Math.sign(s)*Math.pow(Math.abs(s),o),n*Math.sign(r)*Math.pow(Math.abs(r),o)]};function ar(t,n){const{nu:o,nv:e,pos:a,fn:s,vn:r}=n,l=o+1,c=l*(e+1),h=o*e,[d,f,u,i,m,g,M,b,w]=t.m,[v,y,C]=t.o,p=new Float64Array(c),k=new Float64Array(c),A=new Float64Array(c);for(let x=0;x<c;x++){const $=a[x*3]-v,T=a[x*3+1]-y,L=a[x*3+2]-C;p[x]=d*$+f*T+u*L,k[x]=i*$+m*T+g*L,A[x]=M*$+b*T+w*L}const S=(x,$,T)=>{for(let L=0;L<T;L++){const O=x[L*3],_=x[L*3+1],D=x[L*3+2],W=d*O+f*_+u*D,K=i*O+m*_+g*D,Z=M*O+b*_+w*D,nt=Math.hypot(W,K,Z)||1;$[L*3]=W/nt,$[L*3+1]=K/nt,$[L*3+2]=Z/nt}};let E=null;r&&S(r,E=new Float64Array(c*3),c);const I=new Float64Array(h*3),z=new Float64Array(h);S(s,I,h);for(let x=0,$=0;x<e;x++)for(let T=0;T<o;T++,$++){const L=x*l+T;z[$]=(A[L]+A[L+1]+A[L+l]+A[L+l+1])/4}return{nu:o,nv:e,closed:n.closed,x:p,y:k,d:A,n:E,f:I,cd:z}}function as(t){let n=1/0,o=1/0,e=-1/0,a=-1/0;for(const s of t)for(let r=0;r<s.x.length;r++)s.x[r]<n&&(n=s.x[r]),s.x[r]>e&&(e=s.x[r]),s.y[r]<o&&(o=s.y[r]),s.y[r]>a&&(a=s.y[r]);return{x0:n,y0:o,x1:e,y1:a,cx:(n+e)/2,cy:(o+a)/2,w:e-n,h:a-o}}function Jl(t,n,o,e){const a=t[e]-t[o],s=n[e]-n[o];let r=-1/0;for(let l=o;l<=e;l++){const c=(t[l]-t[o])*a+(n[l]-n[o])*s;if(c<r-1e-9)return!1;r=c}return!0}const Ia=t=>t<0?0:t>255?255:Math.round(t),he=t=>`rgb(${Ia(t[0])},${Ia(t[1])},${Ia(t[2])})`;function Kn(t,n,o){const e=[],a=[];for(const r of n){const l=r.bias??0,c=r.keep,h=r.cull!==!1;for(const d of r.parts){const{nu:f,nv:u,f:i,cd:m,x:g,y:M}=d,b=f+1,w=v=>(!h||i[v*3+2]>-.04)&&(!c||c(m[v]));for(let v=0;v<u;v++){if(r.flat){for(let p=0;p<f;p++){const k=v*f+p;w(k)&&(e.push({d:m[k]+l,l:r,p:d,j:v,cols:[p,p+1],cells:[k]}),a.push([g[v*b+p],M[v*b+p]],[g[(v+1)*b+p+1],M[(v+1)*b+p+1]]))}continue}const y=[];let C=null;for(let p=0;p<f;p++)w(v*f+p)?(C||y.push(C=[]),C.push(p)):C=null;d.closed&&y.length>1&&y[0][0]===0&&y[y.length-1][y[y.length-1].length-1]===f-1&&(y[0]=y.pop().concat(y[0]));for(const p of y){const k=p.concat(p[p.length-1]+1),A=[],S=[];for(let I=0;I<k.length;I++){const z=v*b+k[I],x=z+b;A.push((g[z]+g[x])/2),S.push((M[z]+M[x])/2),I===0||I===k.length-1?a.push([g[z],M[z]],[g[x],M[x]]):v===0?a.push([g[z],M[z]]):v===u-1&&a.push([g[x],M[x]])}let E=0;for(;E<k.length-1;){let I=E+1;for(;I+1<k.length&&Jl(A,S,E,I+1);)I++;let z=0;for(let x=E;x<I;x++)z+=m[v*f+p[x]];e.push({d:z/(I-E)+l,l:r,p:d,j:v,cols:k.slice(E,I+1),cells:p.slice(E,I)}),E=I}}}}}e.sort((r,l)=>r.d-l.d);const s=.5/o;for(const r of e){const{p:l,l:c,j:h,cols:d,cells:f}=r,{x:u,y:i,n:m,f:g}=l,M=l.nu+1,b=d.length,w=[],v=[],y=[],C=[],p=h*M+d[0],k=h*M+d[b-1];let A=(u[k]+u[k+M])/2-(u[p]+u[p+M])/2,S=(i[k]+i[k+M])/2-(i[p]+i[p+M])/2;const E=Math.hypot(A,S),I=E>1e-9?A/E:0,z=E>1e-9?S/E:0;for(let T=0;T<b;T++){const L=h*M+d[T],O=L+M;let _=u[L]-u[O],D=i[L]-i[O];const W=Math.hypot(_,D);W>1e-9?(_/=W,D/=W):_=D=0;const K=T===0?-s:T===b-1?s:0;w.push(u[L]+_*s+I*K),v.push(i[L]+D*s+z*K),y.push(u[O]-_*s+I*K),C.push(i[O]-D*s+z*K)}const x=T=>{if(m&&!c.flat){const _=(h*M+d[T])*3,D=_+M*3;return c.shade(Wo([m[_]+m[D],m[_+1]+m[D+1],m[_+2]+m[D+2]]))}const L=f[Math.max(0,Math.min(f.length-1,T-1))]*3,O=f[Math.min(f.length-1,T)]*3;return c.shade(c.flat?[g[O],g[O+1],g[O+2]]:Wo([g[L]+g[O],g[L+1]+g[O+1],g[L+2]+g[O+2]]))};let $;if(c.flat||E<1e-6)$=he(x(0));else{const T=t.createLinearGradient((u[p]+u[p+M])/2,(i[p]+i[p+M])/2,(u[k]+u[k+M])/2,(i[k]+i[k+M])/2);let L=null;const O=(u[p]+u[p+M])/2,_=(i[p]+i[p+M])/2;for(let D=0;D<b;D++){const W=x(D);if(L&&D<b-1&&Math.abs(W[0]-L[0])+Math.abs(W[1]-L[1])+Math.abs(W[2]-L[2])<5)continue;const K=h*M+d[D],Z=(((u[K]+u[K+M])/2-O)*A+((i[K]+i[K+M])/2-_)*S)/(E*E);T.addColorStop(Z<0?0:Z>1?1:Z,he(W)),L=W}$=T}t.fillStyle=$,t.beginPath(),t.moveTo(w[0],v[0]);for(let T=1;T<b;T++)t.lineTo(w[T],v[T]);for(let T=b-1;T>=0;T--)t.lineTo(y[T],C[T]);t.closePath(),t.fill()}return a}function me(t){const n=t.slice().sort((s,r)=>s[0]-r[0]||s[1]-r[1]);if(n.length<3)return n;const o=(s,r,l)=>(r[0]-s[0])*(l[1]-s[1])-(r[1]-s[1])*(l[0]-s[0]),e=[],a=[];for(const s of n){for(;e.length>=2&&o(e[e.length-2],e[e.length-1],s)<=0;)e.pop();e.push(s)}for(let s=n.length-1;s>=0;s--){const r=n[s];for(;a.length>=2&&o(a[a.length-2],a[a.length-1],r)<=0;)a.pop();a.push(r)}return e.pop(),a.pop(),e.concat(a)}const zn=t=>t<0?0:t>1?1:t,ho=(t,n,o)=>[t[0]+(n[0]-t[0])*o,t[1]+(n[1]-t[1])*o,t[2]+(n[2]-t[2])*o],Go=(t,n)=>[t[0]*n,t[1]*n,t[2]*n],Me=[255,255,255];function vo(t,n,o=1){const e=t.L;return a=>{const s=io(a,e),r=Math.pow(zn((s+.4)/1.4),1.35),l=Math.pow(1-zn(a[2]),2),c=(.22+.95*r+.22*l*zn(s+.6))*o,h=26*r*o;return[n[0]*c+h,n[1]*c+h,n[2]*c+h*1.05]}}function t1(t,n){const o=t.L,e=ho(n,Me,.3);return a=>{const s=io(a,o),r=zn((s+.3)/1.3),l=Math.pow(1-zn(a[2]),1.6);return ho(Go(n,.2+.7*r),e,.6*l*(.4+.6*r))}}function ei(t,n){const o=t.L,e=t.H;return a=>{const s=zn((io(a,o)+.2)/1.2),r=Math.pow(zn(io(a,e)),22)*.3;return ho(Go(n,.36+.7*s),Me,r)}}function Uo(t,n,o=1){const e=t.L,a=t.H;return s=>{const r=zn((io(s,e)+.25)/1.25),l=zn(io(s,a)),c=(Math.pow(l,16)*.2+Math.pow(l,80)*.6)*o,h=Math.pow(1-zn(s[2]),3)*.14*o;return ho(Go(n,.28+.78*r),Me,zn(c+h))}}function Gs(t,n){const o=t.L,e=t.H,a=Go(n,.42),s=ho(n,Me,.55);return r=>{const l=zn((io(r,o)+.35)/1.35),c=zn(io(r,e)),h=Math.pow(c,6)*.5+Math.pow(c,40)*.35;return ho(ho(a,n,l),s,zn(h))}}function n0(t,n,o,e){const a=t.H,s=t.L;return r=>{const l=2*r[2]*r[2]-1,h=-(2*r[2]*r[1]),d=zn(.45+h*.85+l*.1),f=Math.exp(-Math.pow((h+.12)/.16,2))*.55,u=zn(io(r,s)),i=ho(o,n,zn(.1+d*.72+u*.3)),m=Math.pow(zn(io(r,a)),70)+f*.4;return ho(i,e,zn(m))}}const o0=t=>n0(t,[255,200,88],[86,50,8],[255,247,220]),n1=t=>n0(t,[232,236,242],[58,62,72],[255,255,255]);function o1(t,n){const o=t.L,e=t.H,a=Go(n,.22),s=ho(n,Me,.3);return r=>{const l=ho(a,s,zn(zn(r[2])*.75+io(r,o)*.4));return ho(l,Me,Math.pow(zn(io(r,e)),24)*.95)}}const e1={gold:[[0,"#fffbe8"],[.08,"#ffe7a0"],[.3,"#eeb546"],[.62,"#ad7214"],[.87,"#5a3806"],[1,"#8c5c18"]],silver:[[0,"#ffffff"],[.08,"#f3f5f9"],[.32,"#c6ccd6"],[.64,"#7a808c"],[.88,"#3d4149"],[1,"#6b717c"]],pearl:[[0,"#ffffff"],[.1,"#fdf9f7"],[.45,"#ebe4e6"],[.8,"#c6bccb"],[1,"#a89db5"]]};function Ao(t,n,o,e,a){const s=n.toScreen(o),r=n.H,l=t.createRadialGradient(s[0]+r[0]*e*.85,s[1]+r[1]*e*.85,0,s[0],s[1],e);if(typeof a=="string")for(const[c,h]of e1[a])l.addColorStop(c,h);else l.addColorStop(0,he(ho(a,Me,.8))),l.addColorStop(.1,he(ho(a,Me,.3))),l.addColorStop(.35,he(a)),l.addColorStop(.85,he(Go(a,.5))),l.addColorStop(1,he(Go(a,.62)));t.fillStyle=l,t.beginPath(),t.arc(s[0],s[1],e,0,t0),t.fill()}function s1(t,n,o,e,a,s,r){const l=ns(e,a),c=(b,w,v)=>{const y=b*Math.cos(w),C=b*Math.sin(w);return[o[0]+y*a[0]+C*l[0]+v*e[0],o[1]+y*a[1]+C*l[1]+v*e[1],o[2]+y*a[2]+C*l[2]+v*e[2]]},h=8,d=.55,f=.36*s,u=[],i=[];for(let b=0;b<h;b++){const w=(b+.5)/h*t0;u.push(c(s,w,0)),i.push(c(s*d,w,f))}const m=o1(n,r),g=(b,w)=>{const v=n.dir(w);v[2]<=.02||(t.fillStyle=he(m(v)),t.beginPath(),b.forEach((y,C)=>{const p=n.toScreen(y);C?t.lineTo(p[0],p[1]):t.moveTo(p[0],p[1])}),t.closePath(),t.fill(),t.strokeStyle=t.fillStyle,t.stroke())};t.lineWidth=Math.min(.3,1/n.px),t.lineJoin="round";for(let b=0;b<h;b++){const w=u[b],v=u[(b+1)%h],y=i[(b+1)%h],C=i[b];let p=ns(xe(y,w),xe(C,v));io(p,e)<0&&(p=[-p[0],-p[1],-p[2]]),g([w,v,y,C],Wo(p))}if(g(i,e),n.dir(e)[2]>.1){const b=n.toScreen(c(0,0,f)),w=n.L;t.fillStyle="rgba(255,255,255,0.3)",t.beginPath();const v=n.toScreen(c(s*d*.8,Math.atan2(-w[1],-w[0])+2.2,f)),y=n.toScreen(c(s*d*.9,Math.atan2(-w[1],-w[0])+Math.PI,f)),C=n.toScreen(c(s*d*.8,Math.atan2(-w[1],-w[0])+Math.PI+.94,f));t.moveTo(b[0],b[1]),t.lineTo(v[0],v[1]),t.lineTo(y[0],y[1]),t.lineTo(C[0],C[1]),t.closePath(),t.fill()}}function Fe(t,n){const o=t.right-t.left;for(let e=0;e<t.widths.length;e++)if(t.widths[e]>=n*o)return e*t.step-st;return t.top}const si=new WeakMap;function ir(t){const n=si.get(t);if(n)return n;const o=128,e=Hi(t,o);if(!e)return null;const a=zt/o,s=p=>(p+.5)*a-st,r=(p,k)=>e[k*o+p]>=128,l=Math.floor((42+st)/a),c=Math.ceil((58+st)/a);let h=o,d=-1;for(let p=l;p<=c;p++){for(let k=0;k<o;k++)if(r(p,k)){k<h&&(h=k);break}for(let k=o-1;k>=0;k--)if(r(p,k)){k>d&&(d=k);break}}const f=p=>{let k=-1,A=-1;for(let S=0;S<o;S++)r(S,p)&&(k<0&&(k=S),A=S);return[k,A]},u=Math.min(o-1,h+Math.round(8/a)),[i,m]=f(u);let g=-1,M=0,b=0,w=0;for(let p=Math.round((33+st)/a);p<=Math.round((67+st)/a);p++){const[k,A]=f(p);k>=0&&A-k>g&&(g=A-k,M=k,b=A,w=p)}const v=new Float32Array(o),y=[];for(let p=0;p<o;p++){const[k,A]=f(p);v[p]=k<0?0:(A-k+1)*a,k>=0&&y.push([s(k)-.5*a,s(p)],[s(A)+.5*a,s(p)])}const C={top:s(h)-.5*a,topL:s(i),topR:s(m),mid:s(w),left:s(M)-.5*a,right:s(b)+.5*a,bottom:s(d)+.5*a,widths:v,step:a,hull:me(y)};return si.set(t,C),C}function Ko(t,n,o){const e=Math.cos(n),a=Math.sin(n),s=t[0]*e-t[1]*a,r=t[0]*a+t[1]*e,l=Math.cos(o),c=Math.sin(o);return[s,r*l-t[2]*c,r*c+t[2]*l]}const be=(t,n)=>[t[0]+n[0],t[1]+n[1],t[2]+n[2]],No=(t,n,o)=>[t[0]+n[0]*o,t[1]+n[1]*o,t[2]+n[2]*o];function os(t,n=!0){const o=new Path2D;return t.forEach((e,a)=>a?o.lineTo(e[0],e[1]):o.moveTo(e[0],e[1])),n&&o.closePath(),o}function is(t){let n=1/0,o=1/0,e=-1/0,a=-1/0;for(const[s,r]of t)s<n&&(n=s),r<o&&(o=r),s>e&&(e=s),r>a&&(a=r);return{x0:n,y0:o,x1:e,y1:a,cx:(n+e)/2,cy:(o+a)/2,w:e-n,h:a-o}}const jo=(t,n=0)=>{let o=t*2654435761+n*40503|0;return o=Math.imul(o^o>>>15,2246822507),o=Math.imul(o^o>>>13,3266489909),((o^o>>>16)>>>0)/4294967296};let La=null;function a1(){if(La)return La;const t=48,n=typeof OffscreenCanvas=="function"?new OffscreenCanvas(t,t):typeof document<"u"?Object.assign(document.createElement("canvas"),{width:t,height:t}):null,o=n&&n.getContext("2d");if(!n||!o)return null;const e=o.createImageData(t,t);for(let a=0;a<t*t;a++){const s=a%t,r=a/t|0;let l=0;for(let h=-2;h<=2;h++)l+=jo((s+h+t)%t+(r+h+t)%t*t,5);l/=5;const c=Math.round(255*(.82+.36*l));e.data[a*4]=e.data[a*4+1]=e.data[a*4+2]=Math.min(255,c),e.data[a*4+3]=255}return o.putImageData(e,0,0),La=n,n}const ai=new WeakMap;function rs(t,n,o,e=.18){const a=a1();if(!a||n.length<3)return;let s=ai.get(t);s||ai.set(t,s=new Map);let r=s.get(e);if(r===void 0&&(r=t.createPattern(a,"repeat"),r?.setTransform?.(new DOMMatrix().scale(e)),s.set(e,r)),!r)return;const l=is(n);t.save(),t.clip(os(n)),t.globalCompositeOperation="multiply",t.globalAlpha=o,t.fillStyle=r,t.fillRect(l.x0-1,l.y0-1,l.w+2,l.h+2),t.restore()}function ls(t,n,o,e,a,s=2.4){const r=n.length;if(r<3)return;let l=0;const c=[];for(let g=0;g<r;g++){const M=n[g],b=n[(g+1)%r],w=Math.hypot(b[0]-M[0],b[1]-M[1]);c.push(w),l+=w}const h=Math.min(360,Math.max(24,Math.round(l*Math.min(2.4,s*.5)))),d=is(n),f=new Path2D,u=new Path2D;let i=0,m=0;for(let g=0;g<h;g++){const M=(g+jo(g,e)*.8)*(l/h);for(;i<r-1&&m+c[i]<M;)m+=c[i++];const b=n[i],w=n[(i+1)%r],v=c[i]?(M-m)/c[i]:0,y=b[0]+(w[0]-b[0])*v,C=b[1]+(w[1]-b[1])*v;let p=y-d.cx,k=C-d.cy;const A=Math.hypot(p,k)||1;p/=A,k/=A;const S=(jo(g,e+1)-.5)*.9,E=Math.cos(S),I=Math.sin(S),z=p*E-k*I,x=p*I+k*E,$=a*(.35+jo(g,e+2)),T=jo(g,e+3)>.5?f:u;T.moveTo(y-z*.4,C-x*.4),T.lineTo(y+z*$,C+x*$)}t.save(),t.lineCap="round",t.lineWidth=.4,t.globalAlpha=.55,t.strokeStyle=fn(o,.14),t.stroke(f),t.strokeStyle=fn(o,-.06),t.stroke(u),t.restore()}function te(t,n,o,e,a,s,r){if(!(a>0)||!(s>0))return;t.save(),n&&t.clip(n),t.translate(o,e),t.scale(1,s/a);const l=t.createRadialGradient(0,0,0,0,0,a);l.addColorStop(0,`rgba(0,0,0,${r})`),l.addColorStop(.55,`rgba(0,0,0,${r*.45})`),l.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=l,t.beginPath(),t.arc(0,0,a,0,Math.PI*2),t.fill(),t.restore()}const ii=48*Math.PI/180;function rr(t,n){const o=Math.cos(ii),e=Math.sin(ii),a=Wo([t*o,n*o,e]);return{L:a,H:Wo([a[0],a[1],a[2]+1])}}function e0(t){const n=t.getTransform?.();return n?Math.sqrt(Math.abs(n.a*n.d-n.b*n.c))||1:2}function lr(t,n){const{L:o,H:e}=rr(t.lx,t.ly);return er([t.cy,0,t.sy,t.sy*t.sp,t.cp,-t.cy*t.sp,-t.sy*t.cp,t.sp,t.cy*t.cp],[50,50,0],o,e,n)}const _a=new WeakMap;let es=_a;function cr(t,n){let o=_a.get(es);o||_a.set(es,o=new Map);let e=o.get(t);return e||(o.size>240&&o.clear(),e=n(),o.set(t,e)),e}function An(t,n,o,e,a,s,r=!0){return ar(t,cr(`${n}|${e}x${a}`,()=>sr(o,e,a,s,r)))}function Yo(t,n,o,e,a,s,r,l=!1){return ar(t,cr(`${n}|${s}x${r}`,()=>Ql(o,e,a,s,r,l)))}const Qn=(t,n=[40,40,44])=>ge(t)??n,$t=Math.PI*2,hr=t=>t<=0?0:t>=1?1:t*t*(3-2*t),ce=(t,n)=>Math.sign(t)*Math.pow(Math.abs(t),n);function i1(t,n,o,e,a,s){return An(t,n,(r,l)=>{const c=r*$t,h=l*Math.PI;return[o[0]+e*Math.sin(h)*Math.cos(c),o[1]-e*Math.cos(h),o[2]+e*Math.sin(h)*Math.sin(c)]},a,s,o)}function Le(t,n,o,e,a,s,r,l,c){return An(t,n,(h,d)=>{const f=h*$t,u=d*$t,i=e+s*Math.cos(u);return o([i*Math.cos(f),a-s*Math.sin(u),i*r*Math.sin(f)])},l,c,h=>o([e*Math.cos(h*$t),a,e*r*Math.sin(h*$t)]))}function ri(t,n,o){return e=>{const s=Wo(xe(t(Math.min(1,e+.001)),t(Math.max(0,e-.001)))),r=ns(s,n);return No(t(e),r,o(e))}}function fr(t,n,o,e,a,s){const r=Qn(a),l=bn(n,$t*e,12,20),c=Kn(t,[{parts:[i1(n,`ball${s}`,o,e*.86,l,Math.max(6,l>>1))],shade:vo(n,r,.92)}],n.px),h=n.toScreen(o),d=is(c),f=Math.max(d.w,d.h)/2,u=Math.round(Math.min(340,50+f*n.px*5)),i=new Path2D,m=new Path2D;for(let b=0;b<u;b++){const w=jo(b,s)*$t,v=f*(.25+.7*Math.sqrt(jo(b,s+1))),y=f*(.25+.35*jo(b,s+2)),C=h[0]+Math.cos(w)*v,p=h[1]+Math.sin(w)*v,k=(jo(b,s+3)-.5)*.6,A=Math.cos(w+k),S=Math.sin(w+k),E=jo(b,s+4)>.45?i:m;E.moveTo(C,p),E.quadraticCurveTo(C+Math.cos(w)*y*.5,p+Math.sin(w)*y*.5,C+A*y,p+S*y)}t.save(),t.lineCap="round",t.lineWidth=Math.max(.3,f*.06);const g=n.L,M=t.createLinearGradient(h[0]+g[0]*f,h[1]+g[1]*f,h[0]-g[0]*f,h[1]-g[1]*f);M.addColorStop(0,fn(a,.2,-.03)),M.addColorStop(1,fn(a,-.12,.02)),t.strokeStyle=M,t.globalAlpha=.85,t.stroke(i),t.strokeStyle=fn(a,-.18,.03),t.globalAlpha=.6,t.stroke(m),t.restore()}function r1(t,n,o,e,a){const s=o.right-o.left,r=.46*s,l=.21*s,c=.33*s,h=.05*s,d=[50-.07*s,Math.max(o.top+.22*s,Fe(o,.5)+.1*s),0],f=-.24,u=-.2,i=z=>be(d,Ko(z,f,u)),m=bn(n,$t*r,32,56),g=bn(n,1.2*r,10,32,6),b=An(n,"beret:dome",(z,x)=>{const $=z*$t;let T,L;const O=.74;if(x<=O){const D=x/O*(Math.PI/2);T=r*Math.sin(D),L=-(h+l*Math.pow(Math.cos(D),.8))}else{const D=hr((x-O)/(1-O));T=r+(c-r)*D,L=-h*(1-D)}const _=Math.sin(Math.min(1,x/O)*Math.PI*.9);return T*=1+.035*Math.sin($*7+.4)*_,i([T*Math.cos($),L,T*.93*Math.sin($)])},m,g,i([0,-h-l*.4,0])),w=An(n,"beret:under",(z,x)=>{const $=z*$t,T=c*(1-x);return i([T*Math.cos($),-.004*s*x,T*.93*Math.sin($)])},24,2,i([0,-h-l*.4,0])),v=Qn(e),y=n.toScreen(i([0,.02*s,0]));te(t,a,y[0]+.02*s,y[1]+.045*s,c*1.25,.08*s,.4);const C=Le(n,"beret:binding",i,c,-.005*s,.022*s,.93,bn(n,$t*c,24,48),5),p=Qn(fn(e,-.06)),k=Kn(t,[{parts:[w],shade:vo(n,v,.7)},{parts:[C],shade:Uo(n,p,.45)},{parts:[b],shade:vo(n,v)}],n.px),A=me(k);rs(t,A,.5,.14),ls(t,A,e,11,.4,n.px);const S=.02*s,E=-h-l+.006*s,I=Yo(n,"beret:stalk",z=>i([S+.014*s*z*z,E-.045*s*z,0]),[0,0,1],(z,x)=>[.016*s*(1-.25*z)*Math.cos(x),.016*s*(1-.25*z)*Math.sin(x)],8,3);Kn(t,[{parts:[I],shade:vo(n,v,.95)}],n.px),Ao(t,n,i([S+.014*s,E-.047*s,0]),.019*s,Go(v,1.15))}function l1(t,n,o,e,a){const s=o.right-o.left,l=.53*Math.max(.5*s,o.topR-o.topL)+.08*s,c=.32*s,h=.1*s,d=l*1.05,f=[50,Fe(o,.72)+.06*s,0],u=0,i=-.14,m=$=>be(f,Ko($,u,i)),g=($,T)=>{const L=$*$t,O=T*(Math.PI/2),_=l*Math.sin(O)*(1-.03*(1-T)),D=-(h+c*Math.cos(O));return m([_*Math.cos(L),D,_*.92*Math.sin(L)])},M=m([0,-h-c*.4,0]),b=An(n,"beanie:dome",g,bn(n,$t*l,28,48),bn(n,1.3*c,9,24,6),M),w=($,T)=>{const L=$*$t,O=2*T-1,_=d*(1-.07*O*O*O*O)*1.01;return m([_*Math.cos(L),-h*(1-T),_*.92*Math.sin(L)])},v=An(n,"beanie:cuff",w,bn(n,$t*d,28,56),4,m([0,-h/2,0])),y=Qn(e),C=Qn(fn(e,.03)),p=as([v]);te(t,a,p.cx,p.y1-.01*s,p.w*.5,.06*s,.34);const k=Kn(t,[{parts:[b],shade:vo(n,y,.96)}],n.px),A=40,S=11;if(l*$t/A*n.px>=2.2){const $=An(n,"beanie:stitch",g,A,S,M,!1),T=new Path2D,L=new Path2D,O=A+1;for(let D=0;D<A*S;D++){if($.f[D*3+2]<.12)continue;const W=Math.floor(D/A)*O+D%A,K=[$.x[W],$.y[W]],Z=[$.x[W+1],$.y[W+1]],nt=[$.x[W+O+1],$.y[W+O+1]],dt=[$.x[W+O],$.y[W+O]],pt=(At,j)=>{const V=[K[0]+(Z[0]-K[0])*At,K[1]+(Z[1]-K[1])*At],U=[dt[0]+(nt[0]-dt[0])*At,dt[1]+(nt[1]-dt[1])*At];return[V[0]+(U[0]-V[0])*j,V[1]+(U[1]-V[1])*j]};for(const[At,j]of[[T,0],[L,-.06]]){const V=pt(.14+j,.12),U=pt(.5+j,.88),It=pt(.86+j,.12);At.moveTo(V[0],V[1]),At.lineTo(U[0],U[1]),At.lineTo(It[0],It[1])}}const _=l*$t/A;t.save(),t.clip(os(me(k))),t.lineCap="round",t.lineJoin="round",t.lineWidth=Math.max(.35,_*.2),t.strokeStyle=fn(e,-.22,.03),t.globalAlpha=.5,t.stroke(T),t.lineWidth=Math.max(.3,_*.12),t.strokeStyle=fn(e,.2,-.03),t.globalAlpha=.35,t.stroke(L),t.restore()}const I=Kn(t,[{parts:[v],shade:vo(n,C,.98)}],n.px),z=$t*d/30;if(z*n.px>=3){const $=new Path2D,T=new Path2D;for(let L=0;L<60;L++){const O=L/60,_=O*$t;if(n.dir(Ko([Math.cos(_),0,.92*Math.sin(_)],u,i))[2]<.08)continue;const D=n.toScreen(w(O,.1)),W=n.toScreen(w(O,.9)),K=L%2?$:T;K.moveTo(D[0],D[1]),K.lineTo(W[0],W[1])}t.save(),t.lineCap="round",t.lineWidth=z*.34,t.strokeStyle=fn(e,-.2,.03),t.globalAlpha=.45,t.stroke($),t.lineWidth=z*.22,t.strokeStyle=fn(e,.16,-.02),t.globalAlpha=.4,t.stroke(T),t.restore()}const x=me(k.concat(I));ls(t,x,e,23,.35,n.px),fr(t,n,m([0,-h-c-.055*s,0]),.085*s,fn(e,.06),31)}function c1(t,n,o,e,a){const s=o.right-o.left,r=[50+.06*s,Fe(o,.3)+.04*s,0],l=.18*s,c=Math.max(.3*s,Math.min(.46*s,r[1]+31-.1*s)),h=.18,d=-.12,f=S=>be(r,Ko(S,h,d)),u=(S,E,I=1)=>{const z=S*$t,x=l*(1-E)*(1+.04*Math.sin(E*Math.PI))*I;return f([x*Math.cos(z),-c*E,x*Math.sin(z)])},i=(S,E)=>f([0,-c*Math.min(.97,E),0]),m=bn(n,$t*l,20,40),g=bn(n,c,10,24,6),M=An(n,"party:cone",(S,E)=>u(S,E),m,g,i),b=Qn(e),w=[252,246,234],v=as([M]);te(t,a,v.cx,v.y1,l*1.15,.04*s,.3);const y=Le(n,"party:trim",f,l*1.02,.004*s,.016*s,1,bn(n,$t*l,20,40),5),C=[],p=6,k=3.2;for(let S=0;S<p;S+=1)C.push(An(n,`party:stripe${S}`,(E,I)=>u((S+.5*I-k*E*.97)/p,E*.97,1.004),g+3,1,i));const A=Kn(t,[{parts:[M],shade:ei(n,w)},{parts:[y],shade:o0(n)}],n.px);Kn(t,[{parts:C,shade:ei(n,b)}],n.px),rs(t,me(A),.18,.1),fr(t,n,f([0,-c-.035*s,0]),.06*s,"#f4efe6",37)}function h1(t,n,o,e){const a=o.right-o.left,r=.44*Math.max(.45*a,o.topR-o.topL)+.07*a,l=.11*a,c=.15*a,h=.9,d=[50,Fe(o,.42)+.05*a,0],f=.05,u=-.22,i=Y=>be(d,Ko(Y,f,u)),m=Y=>Wo(Ko(Y,f,u)),g=(Y,lt,ft)=>i([lt*Math.cos(Y),ft,lt*h*Math.sin(Y)]),M=Y=>i([0,Y,0]),b=bn(n,$t*r,32,64),w=An(n,"crown:band",(Y,lt)=>g(Y*$t,r*(1-.018*Math.sin(lt*Math.PI)),-l*(1-lt)),b,2,(Y,lt)=>M(-l*(1-lt))),v=.017*a,y=Le(n,"crown:rimTop",i,r+.004*a,-l,v,h,b,5),C=Le(n,"crown:rimBot",i,r+.004*a,0,v*1.15,h,b,5),p=-l*.55,k=Math.max(.12*a,d[1]-o.top+.04*a+p),A=Math.PI/2,S=An(n,"crown:cap",(Y,lt)=>{const ft=Y*$t,Pt=lt*(Math.PI/2),it=.08*Math.sin(2*Pt)*(.55+.45*Math.cos(5*(ft-A-Math.PI/5)));return g(ft,r*(.9*Math.sin(Pt)+it),p-k*Math.cos(Pt))},bn(n,$t*r,24,48),bn(n,1.4*k,8,20,6),M(p-k*.4)),E=[],I=[],z=[],x=[],$=(Y,lt,ft,Pt,it,q,F)=>{F.push(An(n,Y,(bt,H)=>{const Et=bt*2-1,Lt=lt+Et*ft*Math.pow(1-H,1.3),Cn=r+.004*a+it*(1-Math.abs(Et))*(1-.5*H)+q*H*H;return g(Lt,Cn,-l-Pt*H)},2,bn(n,Pt,3,5),(bt,H)=>g(lt,r*.5,-l-Pt*H),!1))};for(let Y=0;Y<5;Y++){const lt=A+Y/5*$t;$(`crown:point${Y}`,lt,$t/5*.34,c,.05*a,.03*a,E),z.push(g(lt,r+.004*a+.03*a+.02*a,-l-c-.018*a));const ft=lt+Math.PI/5;$(`crown:bud${Y}`,ft,$t/5*.12,c*.36,.02*a,.01*a,I),x.push(g(ft,r+.004*a+.012*a,-l-c*.36-.012*a))}const T=as([w]);te(t,e,T.cx,T.y1,T.w*.5,.045*a,.34);const L=n.depth(M(p)),O=o0(n),_=n0(n,[255,196,80],[92,54,10],[255,222,150]),D=Y=>_(Y[2]<0?[-Y[0],-Y[1],-Y[2]]:Y),W=.024*a,K=.019*a;for(const Y of z)n.depth(Y)<L&&Ao(t,n,Y,W,"pearl");for(const Y of x)n.depth(Y)<L&&Ao(t,n,Y,K,"gold");Kn(t,[{parts:[S],shade:t1(n,[150,22,44])},{parts:[w],shade:O,bias:.01*a},{parts:[y],shade:O,bias:.012*a},{parts:[C],shade:O,bias:.012*a},{parts:E,shade:D,cull:!1,flat:!0},{parts:I,shade:D,cull:!1,flat:!0}],n.px);const Z=[[208,20,60],[30,150,92],[36,90,220],[36,90,220],[30,150,92]];for(let Y=0;Y<5;Y++)for(const[lt,ft]of[[A+Y/5*$t,"stone"],[A+Y/5*$t+Math.PI/5,"stud"]]){const Pt=m([Math.cos(lt),0,h*Math.sin(lt)]);if(n.dir(Pt)[2]<.12)continue;const it=g(lt,r+.01*a,-l*.5);if(ft==="stud"){Ao(t,n,it,.013*a,"gold");continue}const q=(Y===0?.034:.027)*a;Ao(t,n,it,q*1.3,"gold");const F=m([-Math.sin(lt),0,h*Math.cos(lt)]);s1(t,n,No(it,Pt,.006*a),Pt,F,q,Z[Y])}for(const Y of z)n.depth(Y)>=L&&Ao(t,n,Y,W,"pearl");for(const Y of x)n.depth(Y)>=L&&Ao(t,n,Y,K,"gold");const nt=.034*a,dt=M(p-k-nt*.75),pt=m([0,-1,0]),At=(Y,lt,ft)=>Yo(n,Y,Pt=>[lt[0]+(ft[0]-lt[0])*Pt,lt[1]+(ft[1]-lt[1])*Pt,lt[2]+(ft[2]-lt[2])*Pt],m([0,0,1]),Ie(.009*a,.009*a,.5),2,6),j=No(dt,pt,nt*.8),V=No(dt,pt,nt*.8+.075*a),U=No(dt,pt,nt*.8+.05*a),It=m([1,0,0]);Ao(t,n,dt,nt,"gold"),Kn(t,[{parts:[At("crown:barV",j,V)],shade:O},{parts:[At("crown:barH",No(U,It,-.026*a),No(U,It,.026*a))],shade:O}],n.px)}function f1(t,n,o,e,a){const s=o.right-o.left,l=.34*Math.max(.5*s,o.topR-o.topL)+.06*s,c=.32*s,h=l*1.55,d=[50,Fe(o,.5)+.05*s,0],f=0,u=-.1,i=k=>be(d,Ko(k,f,u)),m=bn(n,$t*l,24,48),g=bn(n,c,8,20,6),M=An(n,"tophat:crown",(k,A)=>{const S=k*$t,E=l*(1-.02*A);return i([E*Math.cos(S),-c*A,E*Math.sin(S)])},m,g,i([0,-c*.5,0])),b=An(n,"tophat:top",(k,A)=>{const S=k*$t,E=l*A;return i([E*Math.cos(S),-c,E*Math.sin(S)])},m,2,i([0,-c-.1,0])),w=An(n,"tophat:brim",(k,A)=>{const S=k*$t,E=l+(h-l)*A;return i([E*Math.cos(S),-.012*s*Math.sin(A*Math.PI),E*Math.sin(S)])},bn(n,$t*h,32,64),2,i([0,.02,0])),v=Le(n,"tophat:band",i,l*1.005,-c*.72,.028*s,1,m,4),y=Qn(e),C=Qn(fn(e,.2)),p=as([w]);te(t,a,p.cx,p.y1-.02*s,l*1.05,.05*s,.34),Kn(t,[{parts:[b,M],shade:Uo(n,y,1.45)},{parts:[w],shade:Uo(n,y,1.15)},{parts:[v],shade:Gs(n,C)}],n.px)}function u1(t,n,o,e,a){const s=o.right-o.left,l=.34*Math.max(.5*s,o.topR-o.topL)+.06*s,c=[50,Fe(o,.5)+.05*s,0],h=Math.max(.42*s,Math.min(.6*s,c[1]+32-.08*s)),d=-.12,f=-.12,u=S=>be(c,Ko(S,d,f)),i=.14*s,m=bn(n,$t*l,20,40),g=bn(n,h,10,24,6),M=An(n,"wizard:cone",(S,E)=>{const I=S*$t,z=l*(1-E),x=i*E*E,$=.02*s*E*E;return u([z*Math.cos(I)+x,-h*E,z*Math.sin(I)+$])},m,g,(S,E)=>u([i*E*E,-h*E,.02*s*E*E])),b=l+.18*s,w=An(n,"wizard:brim",(S,E)=>{const I=S*$t,z=l+(b-l)*E;return u([z*Math.cos(I),.03*s*Math.sin(E*Math.PI),z*Math.sin(I)])},bn(n,$t*b,32,64),2,u([0,.02,0])),v=Le(n,"wizard:band",u,l*1.01,-.02*s,.028*s,1,m,4),y=Qn(e),C=Qn(fn(e,.14)),p=as([w]);te(t,a,p.cx,p.y1-.03*s,l*1.05,.05*s,.32);const k=Kn(t,[{parts:[M],shade:vo(n,y,.96)},{parts:[w],shade:vo(n,y,.9)},{parts:[v],shade:Gs(n,C)}],n.px),A=me(k);rs(t,A,.4,.12),ls(t,A,e,29,.35,n.px)}function d1(t,n,o,e,a){const s=o.right-o.left,l=.36*Math.max(.5*s,o.topR-o.topL)+.08*s,c=[50,Math.max(o.top-.05*s,14),0],h=g=>be(c,Ko(g,0,-.5)),d=bn(n,$t*l,40,72),f=n.toScreen(c),u=l*1.3;t.save();const i=t.createRadialGradient(f[0],f[1],0,f[0],f[1],u);i.addColorStop(0,"rgba(255,224,130,0.28)"),i.addColorStop(1,"rgba(255,224,130,0)"),t.fillStyle=i,t.beginPath(),t.arc(f[0],f[1],u,0,Math.PI*2),t.fill(),t.restore();const m=Le(n,"halo:torus",h,l,0,.02*s,1,d,6);Kn(t,[{parts:[m],shade:o0(n)}],n.px)}function p1(t,n,o,e,a){const s=o.right-o.left,r=[50-.2*s,Fe(o,.42)+.02*s,0],l=.11*s,c=u=>be(r,Ko(u,-.2,-.18)),h=Qn(e),d=5;for(let u=0;u<d;u++){const i=u/d*$t+.2,m=Math.cos(i)*l*.8,g=-Math.sin(i)*l*.4;Ao(t,n,c([m,g,.14*l]),l*.62,Go(h,1.06))}Ao(t,n,c([0,0,.22*l]),l*.34,"gold");const f=An(n,"flower:leaf",(u,i)=>{const m=-.5-i*.4,g=l*(.4+1.1*u);return c([g*Math.cos(m)-.02*s,-g*Math.sin(m)*.5+.06*s,.02*l])},1,2,c([0,0,-.1]));Kn(t,[{parts:[f],shade:vo(n,[72,120,66],.9)}],n.px)}function m1(t,n,o,e,a,s,r){if(o.facing<.05)return;const l=e.right-e.left,c=e.bottom-.2*l,h=Math.max(0,Math.min(e.widths.length-1,Math.round((c+st)/e.step))),d=Math.max(.26*l,Math.min(.42*l,e.widths[h]*.46)),f=Qn(a),u=Yo(n,"scarf:band",y=>{const C=50+(2*y-1)*d;return[C,c,s(C,c)*.9]},[0,1,0],Ie(.052*l,.05*l,.5),24,6),i=50-.2*l,m=Math.min(.26*l,e.bottom-.06*l-c),g=m>.04*l?Yo(n,"scarf:tail",y=>[i,c+m*y*y,s(i,c+m*y)*.9],[0,0,1],Ie(.046*l,.03*l,.6),10,6):null,M=n.toScreen([50,c+.02*l,s(50,c)*.9]);te(t,r,M[0],M[1],d*1.1,.05*l,.28);const b=[u];g&&b.push(g);const w=Kn(t,[{parts:b,shade:vo(n,f,.95)}],n.px),v=me(w);rs(t,v,.5,.12),ls(t,v,a,47,.3,n.px)}function M1(t,n,o){const e=n.right-n.left,a=.15*e,s=1.1,r=.05*e,l=.068*e,c=n.mid-.07*e,h=.5,d=Qn(o),f=Qn(fn(o,-.12)),u=Qn(fn(o,.08)),i=bn(t,$t*a,20,40),m=[],g=[],M=[],b=[],w=n1(t);for(const j of[-1,1]){const V=[j*Math.cos(h),0,Math.sin(h)],U=[0,1,0],It=[-Math.sin(h),0,j*Math.cos(h)],Y=[(j<0?n.left:n.right)-j*.02*e,c,.01*e],lt=(Ot,Rt,St)=>{const sn=Math.cos(St)*s*Rt,yn=Math.sin(St)*Rt;return[Y[0]+V[0]*Ot+U[0]*sn+It[0]*yn,Y[1]+V[1]*Ot+U[1]*sn+It[1]*yn,Y[2]+V[2]*Ot+U[2]*sn+It[2]*yn]},ft=Ot=>No(Y,V,Ot);b.push({c:Y,ry:a*s});const Pt=a*.9-r*.5,it=i>=48?1:0,q=An(t,`phones:cushion${j}`,(Ot,Rt)=>{const St=Ot*$t,sn=Rt*Math.PI,yn=1+.006*it*Math.sin(St*24)*Math.sin(sn);return lt(r*.5*(1-Math.cos(sn)),(Pt+r*.62*Math.sin(sn))*yn,St)},i,5,(Ot,Rt)=>ft(r*.5*(1-Math.cos(Rt*Math.PI)))),F=An(t,`phones:shell${j}`,(Ot,Rt)=>{const St=Rt*(Math.PI/2);return lt(r+l*Math.pow(Math.sin(St),.55),a*(.7+.3*Math.pow(Math.cos(St),.55)),Ot*$t)},i,5,ft(r+l*.5)),bt=.66*a,H=.017*e,Et=An(t,`phones:ring${j}`,(Ot,Rt)=>lt(r+l+H*.45*Math.sin(Rt*$t),bt+H*Math.cos(Rt*$t),Ot*$t),i,5,Ot=>lt(r+l,bt,Ot*$t)),Lt=bt-H*.5,Cn=An(t,`phones:plate${j}`,(Ot,Rt)=>lt(r+l+.013*e*(1-Rt*Rt),Lt*Rt,Ot*$t),i,3,ft(r+l-.02*e)),_t=r+l*.45,Mn=a*1.04+.022*e,an=Ot=>{const Rt=Ot*Math.PI,St=-Math.sin(Rt)*s*Mn,sn=Math.cos(Rt)*Mn;return[Y[0]+V[0]*_t+U[0]*St+It[0]*sn,Y[1]+V[1]*_t+U[1]*St+It[1]*sn,Y[2]+V[2]*_t+U[2]*St+It[2]*sn]},gn=Yo(t,`phones:yoke${j}`,an,V,Ie(.013*e,.008*e,.6),bn(t,Math.PI*Mn,12,24),6);g.push(an(0),an(1)),M.push(an(.5)),m.push({parts:[q],shade:Uo(t,f,.35)},{parts:[F],shade:Uo(t,d,.8)},{parts:[Et],shade:w,bias:.02*e},{parts:[Cn],shade:Uo(t,u,1.3),bias:.01*e},{parts:[gn],shade:w})}const[v,y]=M,C=(v[2]+y[2])/2,p=(v[0]+y[0])/2,k=(y[0]-v[0])/2,A=(v[1]+y[1])/2,S=j=>.005*e+.022*e*Math.pow(Math.sin(Math.PI*j),.35),E=2/2.2,I=j=>{let V=1/0;const U=n.hull;for(let It=0;It<U.length;It++){const Y=U[It],lt=U[(It+1)%U.length];Y[0]===lt[0]||j<Math.min(Y[0],lt[0])||j>Math.max(Y[0],lt[0])||(V=Math.min(V,Y[1]+(lt[1]-Y[1])*(j-Y[0])/(lt[0]-Y[0])))}return V};let z=A-n.top;for(let j=1;j<64;j++){const V=Math.PI*(1-j/64),U=Math.pow(Math.abs(Math.sin(V)),E),It=I(p+k*ce(Math.cos(V),E));U>.05&&Number.isFinite(It)&&(z=Math.max(z,(A-It+2*S(j/64)+.006*e)/U))}const x=j=>{const V=Math.PI*(1-j);return[p+k*ce(Math.cos(V),E),A-z*Math.pow(Math.abs(Math.sin(V)),E),C]},$=(j,V)=>U=>x(j+(V-j)*U),T=[0,0,1],L=k*2+z*2,O=bn(t,L,24,48),_=.09,D=.016*e,W=ri($(_,1-_),T,()=>D),K=j=>hr(Math.min(j,1-j)/.07),Z=Yo(t,"phones:bandShell",W,T,(j,V)=>{const U=K(j);return[(.024+.016*U)*e*ce(Math.cos(V),.4),(.008+.008*U)*e*ce(Math.sin(V),.4)]},O,6),nt=ri($(_+.02,1-_-.02),T,j=>-S(_+.02+(1-2*_-.04)*j)),dt=Yo(t,"phones:bandPad",nt,T,(j,V)=>[.034*e*ce(Math.cos(V),.5),S(_+.02+(1-2*_-.04)*j)*ce(Math.sin(V),.7)],O,6),pt=[$(0,_+.03),$(1-_-.03,1)].map((j,V)=>Yo(t,`phones:slider${V}`,j,T,Ie(.022*e,.006*e,.4),4,6));m.push({parts:[Z],shade:Uo(t,d,.9)},{parts:[dt],shade:Uo(t,f,.3)},{parts:pt,shade:w});const At=[];for(let j=0;j<=48;j++)At.push(No(nt(.04+.92*j/48),T,.034*e+.001*e));return{layers:m,pivots:g,pivotR:.017*e,stitch:At,seats:b}}let Ue=null;function ur(t,n,o,e,a,s){const r=`${n.m.join()}|${n.px}|${n.L.join()}|${e}`;(!Ue||Ue.m!==o||Ue.key!==r)&&(Ue={m:o,key:r,ph:M1(n,o,e)});const l=Ue.ph,c=o.right-o.left,h=d=>a==="front"?d>=0:d<0;if(a==="front")for(const d of l.seats){if(n.depth(d.c)<0)continue;const f=n.toScreen(d.c);te(t,s,f[0],f[1]+.01*c,.06*c,d.ry*1.05,.26)}Kn(t,l.layers.map(d=>({...d,keep:h})),n.px);for(const d of l.pivots)h(n.depth(d))&&Ao(t,n,d,l.pivotR,"silver");if(a==="front"&&c*n.px>120&&n.dir([0,0,1])[2]>.3){const d=l.stitch.map(f=>n.toScreen(f));t.save(),t.setLineDash([.022*c,.014*c]),t.lineCap="round",t.lineWidth=.0045*c,t.strokeStyle=fn(e,.12),t.globalAlpha=.55,t.stroke(os(d,!1)),t.restore()}}function g1(t,n,o,e,a,s,r,l,c=!1){if(o.facing<.05)return;const h=e.right-e.left,d=l.y+22*l.scale,f=Math.max(d,e.bottom-.15*h),u=Math.max(0,e.bottom-3-f),i=Math.min(h,100)*Math.max(.5,Math.min(1,u/15)),m=s(50,f),g=(I,z,x)=>[50+I*i,f+z*i,m+x*i],M=Qn(a),b=[g(-.36,-.18,0),g(.36,.18,0),g(-.36,.18,0),g(.36,-.18,0)].map(I=>n.toScreen(I)),w=is(b),v=n.toScreen(g(.01,.08,0));te(t,r,v[0],v[1],w.w*.52,w.h*.5,.3);const y=bn(n,.32*i,8,16),C=bn(n,.3*i,8,16,6),p=`${m.toFixed(2)},${f.toFixed(2)},${i.toFixed(2)}`,k=!!c,A=k?vo(n,M):Gs(n,M),S=[];for(const I of[-1,1]){const z=(x,$)=>{const T=.058+.3*x-.035*Math.pow(x,4)*Math.sin(Math.PI*$),O=-(.05+.12*Math.pow(x,.8))*Math.cos(Math.PI*$)+.012*x*x,_=.018+.058*Math.sin(Math.PI*(.12+.88*x)),D=.016*Math.sin(3*Math.PI*$)*Math.pow(1-x,1.3);return g(I*T,O,(_+D)*Math.sin(Math.PI*$)+.004)};S.push({parts:[An(n,`bow:wing${I}@${p}`,z,y,C,x=>g(I*(.058+.3*x),0,-.03))],shade:A}),S.push({parts:[An(n,`bow:end${I}@${p}`,(x,$)=>{const T=z(1,$);return[T[0],T[1],T[2]-(T[2]-m)*x]},1,C,g(I*.2,0,-.03))],shade:A})}const E=An(n,`bow:knot@${p}`,(I,z)=>{const x=.068*(2*I-1)*(1-.12*Math.sin(Math.PI*z)),$=.075*(2*z-1),T=Math.pow(Math.max(0,1-Math.pow(Math.abs(2*I-1),3)),.5),L=Math.pow(Math.max(0,1-Math.pow(Math.abs(2*z-1),5)),.4);return g(x,$,.012+.075*T*L)},6,6,g(0,0,-.02));if(S.push({parts:[E],shade:k?vo(n,M,.9):Gs(n,Go(M,.9))}),!k){Kn(t,S,n.px);return}for(let I=0;I<S.length;I+=2){const z=S.slice(I,I+2),x=me(Kn(t,z,n.px));rs(t,x,.5,.1),ls(t,x,a,41+I,.3,n.px)}}const li={round:{rx:10.8,ry:10.8,n:2,tr:1.15,td:1.2},square:{rx:12,ry:9.6,n:4.2,tr:1.45,td:1.4},shades:{rx:12.6,ry:10,n:3.4,tr:1.6,td:1.5}};function ci(t,n,o,e,a,s={yaw:0,pitch:0}){if(n==="none")return;es=li;const r=li[n],l=Math.cos(s.yaw),c=Math.sin(s.yaw),h=Math.cos(s.pitch),d=Math.sin(s.pitch),{L:f,H:u}=rr(e.lx,e.ly),i=er([l,0,c,d*c,h,-d*l,-h*c,d,h*l],[0,0,0],f,u,e0(t)),m=Math.max(o[0].fz,o[1].fz)+3.2,g=x=>m-.0045*x*x,M=2/r.n,b=(x,$)=>T=>{const L=T*$t,O=x.ox+(r.rx+$)*ce(Math.cos(L),M),_=x.oy+(r.ry+$)*ce(Math.sin(L),M);return[O,_,g(O)]},w=(x,$,T=48)=>{const L=b(x,$),O=[];for(let _=0;_<T;_++)O.push(i.toScreen(L(_/T)));return O},v=o.map(x=>Math.max(0,Math.min(1,(x.z-.18)*3.2)));if(a==="shadow"){for(let x=0;x<2;x++)v[x]<=0||(t.save(),t.globalAlpha=.22*v[x],t.translate(-e.lx*1.6,-e.ly*1.6+.8),t.lineWidth=r.tr*2+.6,t.lineJoin="round",t.strokeStyle="#000",t.stroke(os(w(o[x],0))),t.restore());return}const C=Uo(i,[22,22,26],1.1);for(let x=0;x<2;x++){if(v[x]<=0)continue;const $=os(w(o[x],-r.tr*.5)),T=is(w(o[x],0,16));if(t.save(),t.globalAlpha=v[x],n==="shades"){const W=t.createLinearGradient(T.cx,T.y0,T.cx,T.y1);W.addColorStop(0,"rgba(58,60,78,0.97)"),W.addColorStop(.55,"rgba(18,18,26,0.98)"),W.addColorStop(1,"rgba(30,26,44,0.98)"),t.fillStyle=W}else{const W=t.createLinearGradient(T.cx,T.y0,T.cx,T.y1);W.addColorStop(0,"rgba(236,244,255,0.26)"),W.addColorStop(.45,"rgba(214,230,255,0.08)"),W.addColorStop(1,"rgba(214,230,255,0.14)"),t.fillStyle=W}t.fill($),t.clip($);const L=T.w,O=T.h,_=(W,K,Z)=>{t.globalAlpha=v[x]*Z,t.fillStyle="#fff",t.beginPath(),t.moveTo(T.x0+L*W,T.y1+O*.1),t.lineTo(T.x0+L*(W+.55),T.y0-O*.1),t.lineTo(T.x0+L*(W+.55+K),T.y0-O*.1),t.lineTo(T.x0+L*(W+K),T.y1+O*.1),t.closePath(),t.fill()},D=n==="shades"?1.4:1;_(-.28,.26,.16*D),_(.06,.07,.3*D),t.restore()}const p=bn(i,$t*r.rx*1.1,28,56,8),k=x=>Yo(i,`rim:${n}:${x.ox},${x.oy},${x.fz.toFixed(2)}`,b(x,0),[0,0,1],Ie(r.td,r.tr,.55),p,6,!0),[A,S]=o,E=x=>{const $=n==="round",T=[A.ox+r.rx*($?.9:.98),A.oy-r.ry*($?.32:.42),0],L=[S.ox-r.rx*($?.9:.98),S.oy-r.ry*($?.32:.42),0],O=[0,(A.oy+S.oy)/2-r.ry*($?.8:.6),0],_=1-x,D=_*_*T[0]+2*_*x*O[0]+x*x*L[0],W=_*_*T[1]+2*_*x*O[1]+x*x*L[1];return[D,W,g(D)+.3]},I=Yo(i,`bridge:${n}:${A.ox},${A.oy},${S.ox},${m.toFixed(2)}`,E,[0,0,1],Ie(r.td*.8,r.tr*.75,.7),8,6),z=[{part:k(A),a:v[0],d:i.depth([A.ox,A.oy,m])},{part:k(S),a:v[1],d:i.depth([S.ox,S.oy,m])},{part:I,a:Math.min(v[0],v[1]),d:i.depth([0,A.oy,m])}].sort((x,$)=>x.d-$.d);for(const x of z)x.a<=0||(t.save(),t.globalAlpha=x.a,Kn(t,[{parts:[x.part],shade:C}],i.px),t.restore());for(const[x,$,T]of[[A,-1,v[0]],[S,1,v[1]]]){if(T<=0)continue;t.save(),t.globalAlpha=T;const L=x.ox+$*r.rx*.93;Ao(t,i,[L,x.oy-r.ry*.5,g(L)+r.td],.75,"silver"),t.restore()}}function b1(t,n,o,e){if(!e.headphones)return;const a=ir(n);a&&(es=a,ur(t,lr(o,e0(t)),a,e.color,"behind",null))}function y1(t,n,o,e,a,s,r){const l=ir(n);if(!l)return;es=l;const c=lr(o,e0(t));switch(e.bowTie&&g1(t,c,o,l,e.color,s,a,r,e.fabric),e.scarf&&m1(t,c,o,l,e.color,s,a),e.headphones&&ur(t,c,l,e.color,"front",a),e.hat){case"beret":r1(t,c,l,e.color,a);break;case"beanie":l1(t,c,l,e.color,a);break;case"party":c1(t,c,l,e.color,a);break;case"crown":h1(t,c,l,a);break;case"tophat":f1(t,c,l,e.color,a);break;case"wizard":u1(t,c,l,e.color,a);break;case"halo":d1(t,c,l,e.color);break;case"flower":p1(t,c,l,e.color);break}}const Fo=1.5,Pe=.1,Se=17,k1=15,w1=.9,hi=(t,n)=>n+(1-n)*Math.sqrt(Math.max(0,1-t*t)),C1=25,A1=6.3,v1={eyes:1,mouth:-3.5},vs=new Map;function S1(t,n,o){const e=`${t}|${n}|${o}`;let a=vs.get(e);if(!a){const s=fn(t,-.3*n,.05*n),r=fn(t,-.12*n,.03*n),l=[],c=[];for(let h=0;h<Se;h++){const d=h/(Se-1);l.push(d>.6?"":ui(s,r,d/.6)),c.push(d>=.5?t:ui(s,t,d/.5))}a={base:t,far:s,near:r,light:fn(t,.04*o),dark:fn(t,-.3*n,.05*n),capTop:fn(t,.035*o),capBottom:fn(t,-.035*n),crispMix:l,smoothMix:c,grad:null},vs.size>200&&vs.clear(),vs.set(e,a)}return a}const fi=t=>(t.startsWith("hsl(")?t:fn(t,0)).match(/[\d.]+/g).map(Number);function ui(t,n,o){const e=fi(t),a=fi(n),s=e.map((r,l)=>r+(a[l]-r)*o);return`hsl(${s[0].toFixed(1)} ${s[1].toFixed(1)}% ${s[2].toFixed(1)}%)`}const We=34,x1=Math.PI*1.55,P1=57,T1=.4,di=-.28,Ss=new Map;function I1(t){let n=Ss.get(t);return n||(n={base:fn(t,.1,.02),light:fn(t,.3,.04),dark:fn(t,-.22,.08),halo:fn(t,.2)},Ss.size>200&&Ss.clear(),Ss.set(t,n)),n}const xs=(t,n)=>t.replace(")",` / ${Math.max(0,Math.min(1,n)).toFixed(3)})`);function pi(t,n,o,e,a,s,r){const l=r?.strength??0,c=Math.min(1,n.whirl*l);if(c<=.01)return;const h=r?.size??1,d=r?.width??1,f=r?.length??1,u=r?.tilt??1,i=x1*f,m=I1(o),g=-n.whirlAngle,M=P1*h,b=M*T1*u*(s?1.14:.86),w=Math.atan2(a,e)-di;t.save(),t.rotate(di),t.translate(0,5),t.lineCap="butt";const v=(y,C,p,k,A)=>{t.strokeStyle=k,t.lineWidth=p,t.beginPath(),t.ellipse(0,A,M,b,0,y,C,!1),t.stroke()};if(s)for(let y=0;y<We;y++){const C=y/We,p=g+C*i,k=p+i/We+.012;if(Math.sin((k+p)/2)<=0)continue;const A=Math.pow(1-C,1.3);v(p,k,(2+8*A)*1.5*d,`rgba(0,0,0,${(.2*c*A).toFixed(3)})`,3.5)}for(let y=0;y<We;y++){const C=y/We,p=g+C*i,k=p+i/We+.012,A=(k+p)/2;if(Math.sin(A)>0!==s)continue;const S=.6+.4*Math.sin(A),E=Math.pow(1-C,1.3),I=1+.18*Math.sin(C*9+1.2),z=(2+8*E)*S*d*I,x=c*(.3+.7*E)*S,$=.5+.5*Math.cos(A-w);v(p,k,z*2.6,xs(m.halo,x*.2),0),v(p,k,z*.8,xs(m.dark,x*.45),z*.32),v(p,k,z,xs(m.base,x*.72),0),v(p,k,z*.62,xs(m.light,x*.78*(.4+.6*$)),-z*.16),v(p,k,z*.24,`rgba(255,255,255,${(x*.9*(.15+.85*$*$)).toFixed(3)})`,-z*.3)}t.restore()}const L1=(t,n)=>{if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(t,n);if(typeof document<"u"){const o=document.createElement("canvas");return o.width=t,o.height=n,o}return null},mi=new WeakMap;function Da(t,n){let o=mi.get(t);o||mi.set(t,o=[]);let e=o[n];if(!e||e.canvas.width!==t.width||e.canvas.height!==t.height){const a=L1(t.width,t.height),s=a&&a.getContext("2d");if(!s)return null;e=o[n]=s}return e.setTransform(1,0,0,1,0,0),e.globalCompositeOperation="source-over",e.globalAlpha=1,e.clearRect(0,0,t.width,t.height),e}const F1=.56,Mo=t=>{const n=Math.sin(t*127.1+311.7)*43758.5453;return n-Math.floor(n)},dr=t=>{let n=0;for(let o=0;o<t.length;o++)n=n*31+t.charCodeAt(o)|0;return Math.abs(n%997)/997};function s0(t){let n=ge(t)??[255,255,255];const o=Math.max(n[0],n[1],n[2],1),e=Math.min(n[0],n[1],n[2]),a=1-Math.min(1,Math.max(0,((o-e)/o-.08)/.22));a>0&&(n=[n[0]+(30-n[0])*a,n[1]+(225-n[1])*a,n[2]+(255-n[2])*a]);const s=Math.max(n[0],n[1],n[2],1),r=[n[0]/s*255,n[1]/s*255,n[2]/s*255];return{base:r,alt:[r[2],r[0],r[1]]}}const Jo=(t,n)=>`rgba(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${Math.max(0,Math.min(1,n)).toFixed(3)})`;function E1(t,n,o,e,a,s){const{base:r,alt:l}=s0(s),c=.86+.14*Math.sin(a*2.2);t.save(),t.transform(o[0],o[1],o[2],o[3],o[4],o[5]),t.globalCompositeOperation="lighter",t.lineWidth=3.4,t.shadowColor=Jo(r,.95*c),t.shadowBlur=15*e,t.strokeStyle=Jo(r,.5*c),t.stroke(n),t.shadowColor=Jo(l,.8*c),t.shadowBlur=26*e,t.lineWidth=1.6,t.strokeStyle=Jo(l,.28*c),t.stroke(n),t.restore()}const Fa=3.4,Mi=.4;function $1(t,n,o,e){const a=o+e*Fa,s=Math.floor(a/Fa),r=a-s*Fa;if(r>Mi)return;const l=Math.floor(a*24),c=(1-(r/Mi)**2)*(.7+.3*Mo(l+s)),h=t.canvas,d=h.width,f=h.height,u=Da(h,0),i=Da(h,1);if(!u||!i)return;u.drawImage(h,0,0),t.save(),t.setTransform(1,0,0,1,0,0);const m=l*7+s*131;for(let M=0;M<7;M++){if(Mo(m+M*1.7)>.62)continue;const b=Mo(m+M*3.1)*f*.88+f*.06,w=(.02+.07*Mo(m+M*4.3))*f,v=(Mo(m+M*5.9)-.5)*2*13*n*c;t.clearRect(0,b,d,w),t.drawImage(u.canvas,0,b,d,w,v,b,d,w)}const g=2.6*n*c;t.globalCompositeOperation="lighter";for(const[M,b]of[["#ff2a3d",1],["#1ee6ff",-1]])i.globalCompositeOperation="source-over",i.clearRect(0,0,d,f),i.drawImage(h,0,0),i.globalCompositeOperation="multiply",i.fillStyle=M,i.fillRect(0,0,d,f),i.globalCompositeOperation="destination-in",i.drawImage(h,0,0),t.globalAlpha=.42*Math.min(1,c*1.3),t.drawImage(i.canvas,b*g,0);t.globalAlpha=1,t.globalCompositeOperation="source-over";for(let M=0;M<3;M++){if(Mo(m+M*9.1)>.55)continue;const b=(.08+.12*Mo(m+M*2.2))*d,w=(.025+.04*Mo(m+M*6.6))*f,v=Mo(m+M*1.3)*(d-b),y=Mo(m+M*8.8)*(f-w);t.drawImage(u.canvas,v,y,b,w,v+(Mo(m+M*3.7)-.5)*.2*d*c,y+(Mo(m+M*5.3)-.5)*.05*f,b,w)}t.globalCompositeOperation="source-atop",t.fillStyle=`rgba(210,250,255,${(.28*c).toFixed(3)})`;for(let M=0;M<4;M++)t.fillRect(0,Mo(m+M*11.3)*f,d,Math.max(1,n*.5));t.restore()}const O1=t=>{if(t===void 0||!Number.isFinite(t))return{};const n=t*Math.PI/180;return{bx:Math.sin(n),by:-Math.cos(n)}},Qs={fabric:{shadow:1.15,highlight:1.45,light:295,rim:.6,spread:1.6},other:{shadow:.35,highlight:1.3,light:300,rim:.5,spread:1.55}};function Ks(t,n,o,e){const a=n*Fo;t.clearRect(0,0,a,a);const s=n/100;let r,l;if(e.dpr!==void 0)r=e.dpr,l=[r,0,0,r,0,0];else if(t.getTransform){const _t=t.getTransform();l=[_t.a,_t.b,_t.c,_t.d,_t.e,_t.f],r=_t.a||1}else r=1,l=[1,0,0,1,0,0];const c=Qs[e.shading==="fabric"?"fabric":"other"],h=e.shadow??c.shadow,d=e.highlight??c.highlight,f=k1*(e.depth??.65),u=e.rim??c.rim,i=1-(1-w1)*u,m=e.spread??c.spread,g=(e.light??c.light)*Math.PI/180,M=Math.sin(g),b=-Math.cos(g),w=S1(e.color,h,d),v=Math.cos(o.yaw),y=Math.sin(o.yaw),C=Math.cos(o.pitch),p=Math.sin(o.pitch),k=v*C,A=_t=>Math.abs(_t)<.22?_t<0?-.22:.22:_t,S=A(v),E=A(C),I=Math.cos(o.roll),z=Math.sin(o.roll),x=o.sx*s,$=o.sy*s,T=50*(1-o.sy)*s,L=ve(l,[I*x,z*x,-z*$,I*$,a/2+o.x*s-z*T,a/2+Pe*n+o.y*s+I*T]);t.save(),t.setTransform(L[0],L[1],L[2],L[3],L[4],L[5]),t.lineCap="round",t.lineJoin="round";const O=e.shading,_=(e.time??0)*.001,D=(_t,Mn,an,gn=!0)=>{let Ot=w.near,Rt=w.base;if(O==="crisp"){if(!w.grad||w.grad.lx!==M||w.grad.ly!==b||w.grad.mode!==O){const X=t.createLinearGradient(M*56,b*56,-M*56,-b*56);X.addColorStop(0,w.light),X.addColorStop(.45,w.near),X.addColorStop(1,w.dark);const ct=t.createLinearGradient(M*46,b*46,-M*46,-b*46);ct.addColorStop(0,w.capTop),ct.addColorStop(1,w.capBottom),w.grad={lx:M,ly:b,mode:O,lit:X,cap:ct}}Ot=w.grad.lit,Rt=w.grad.cap}const St=O==="plastic"||O==="fabric"||O==="metal"||O==="glass"||O==="jelly"||O==="neon";let sn=!1;St&&(sn=Gl(t,{...e,path:_t,typeKey:Mn,shading:gn||O!=="fabric"?O:"plastic"},{cy:S,sy:y,cp:E,sp:p,facing:k,roll:o.roll,halfDepth:an,lx:M,ly:b,...O1(e.backLight),dev:n*r,ctm:L,still:e.still,round:e.roundness??1},w,null,{shadow:h,highlight:d,spread:m,rim:u,vivid:e.vivid??0,front:Math.min(85,Math.max(0,e.lightFront??32))*Math.PI/180,shine:e.shine??0,sheen:e.sheen??0,backSoft:e.backSoftness??1}));const yn=St&&!sn?"smooth":O,ro=yn==="smooth",go=ro&&typeof Path2D=="function"?new Path2D:null,J=k>=0?1:-1,[Mt,Ht,Kt,vn,ln,Sn]=L;let qn=null,lo=1,Fn=0,Jn=0,Bn=1,ne=0,bo=0;for(let X=0;X<Se&&!sn;X++){const at=-1+2*(J>0?X:Se-1-X)/(Se-1),gt=hi(at,i),xt=X/(Se-1),Tt=S*gt,rn=y*p*gt,rt=E*gt,un=at*y*an-50*Tt,En=-at*S*p*an-50*rn-50*rt,cn=lo*Bn-Fn*Jn,_n=Bn/cn,jn=-Fn/cn,dn=-Jn/cn,xn=lo/cn,Vn=(Jn*bo-Bn*ne)/cn,So=(Fn*ne-lo*bo)/cn;t.transform(_n*Tt+dn*rn,jn*Tt+xn*rn,dn*rt,xn*rt,_n*un+dn*En+Vn,jn*un+xn*En+So),lo=Tt,Fn=rn,Jn=0,Bn=rt,ne=un,bo=En;let Jt;ro?Jt=w.smoothMix[X]:X===Se-1?Jt=Rt:xt>.6?Jt=Ot:Jt=w.crispMix[X],Jt!==qn&&(t.fillStyle=qn=Jt),t.fill(_t),go&&go.addPath(_t,{a:Tt,b:rn,c:0,d:rt,e:un,f:En})}if(sn||t.setTransform(Mt,Ht,Kt,vn,ln,Sn),go&&yn==="smooth"){t.save(),t.clip(go);const X=Math.min(1,.34*h),ct=t.createRadialGradient(-M*45,-b*45,4*m,-M*45,-b*45,84*m);ct.addColorStop(0,`rgba(0,0,0,${X})`),ct.addColorStop(.5,`rgba(0,0,0,${X*.35})`),ct.addColorStop(1,"rgba(0,0,0,0)"),t.globalCompositeOperation="multiply",t.fillStyle=ct,t.fillRect(-120,-120,240,240),t.globalCompositeOperation="source-over";const at=Math.min(1,.22*d),gt=t.createRadialGradient(M*37,b*37,0,M*37,b*37,62*m);gt.addColorStop(0,`rgba(255,255,255,${at})`),gt.addColorStop(.6,`rgba(255,255,255,${at*.23})`),gt.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=gt,t.fillRect(-120,-120,240,240),t.restore()}return sn};pi(t,o,e.color,M,b,!1,e.whirl);const W=e.wear,K=!!W&&(W.hat!=="none"||W.glasses!=="none"||W.headphones||W.bowTie||W.scarf),Z={cy:S,sy:y,cp:E,sp:p,facing:k,lx:M,ly:b};K&&b1(t,e.path,Z,W);const nt=e.typeKey??"custom",dt=[S,y*p,0,E,-50*S,-50*(y*p+E)],pt=n*r/100,At=O==="metal"||O==="glass"||O==="jelly"||O==="neon";O==="neon"&&E1(t,e.path,dt,pt,_,e.color);const j=t;let V=null;O==="glass"&&(V=Da(t.canvas,2),V&&(V.setTransform(L[0],L[1],L[2],L[3],L[4],L[5]),V.lineCap="round",V.lineJoin="round",t=V));const U=e.parts?Array.isArray(e.parts)?e.parts:[e.parts]:[];for(let _t=0;_t<U.length;_t++)D(U[_t],Array.isArray(e.parts)?`${nt}:parts${_t}/${U.length}`:`${nt}:parts`,f*(e.partsDepth??.4),!1);const It=D(e.path,nt,f);V&&(t=j,j.save(),j.setTransform(1,0,0,1,0,0),j.globalAlpha=F1,j.drawImage(V.canvas,0,0),j.restore()),At&&It&&W1(t,O,e,dt,{lx:M,ly:b,unit:pt,t:_,box:n});const Y=k>=0?1:-1,lt=e.roundness??1,ft=It,Pt=ft?1:hi(Y,i),it=(_t,Mn)=>ft?tl(nt,f,_t,Mn,lt)??.8*f:f*Pt,q=ft?.55*it(e.faceX,e.faceY):f,F=S*Pt,bt=y*p*Pt,H=E*Pt,Et=Y*y*q-50*F,Lt=-Y*S*p*q-50*bt-50*H;let Cn=null;if(K&&typeof Path2D=="function"&&(Cn=new Path2D,Cn.addPath(e.path,{a:F,b:bt,c:0,d:H,e:Et,f:Lt})),k>-.2){t.save();{const[Ot,Rt,St,sn,yn,ro]=L;t.setTransform(Ot*F+St*bt,Rt*F+sn*bt,St*H,sn*H,Ot*Et+St*Lt+yn,Rt*Et+sn*Lt+ro),t.clip(e.path),t.setTransform(Ot,Rt,St,sn,yn,ro)}t.translate(e.faceX-50,e.faceY-50),t.scale(e.faceScale,e.faceScale),O==="plastic"&&It&&(t.globalAlpha=.93);let _t=e;if(O==="neon"){const Ot=s0(e.color);_t={...e,ink:Jo([255-(255-Ot.base[0])*.35,255-(255-Ot.base[1])*.35,255-(255-Ot.base[2])*.35],1)},t.shadowColor=Jo(Ot.base,.95),t.shadowBlur=5*pt}const Mn=H1(t,o,_t);t.shadowBlur=0,t.shadowColor="rgba(0,0,0,0)",t.globalAlpha=1;const an=W&&W.glasses!=="none"?W.glasses:null,gn={yaw:o.yaw,pitch:o.pitch};an&&ci(t,an,Mn,{lx:M,ly:b},"shadow",gn),t.restore(),an&&(t.save(),t.translate(e.faceX-50,e.faceY-50),t.scale(e.faceScale,e.faceScale),ci(t,an,Mn,{lx:M,ly:b},"frame",gn),t.restore())}K&&y1(t,e.path,Z,W,Cn,it,{y:e.faceY,scale:e.faceScale}),pi(t,o,e.color,M,b,!0,e.whirl),t.restore(),D1(t,o,ve(l,[s,0,0,s,a/2+o.x*s,a/2+Pe*n+o.y*s*.25]),e.theme),O==="neon"&&e.time!==void 0&&$1(t,pt,_,dr(nt))}function W1(t,n,o,e,a){const s=o.path;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5]);const r=a.box>=40;if(n==="metal"){t.globalCompositeOperation="screen",t.strokeStyle="rgba(255,255,255,0.34)",t.lineWidth=1.3,t.stroke(s);const l=4.6,c=1,h=(a.t+dr(o.typeKey??"x")*l)%l;if(h<c){const d=h/c,f=Math.sin(Math.PI*d);t.clip(s),t.translate(50,50),t.rotate(.55);const u=-85+d*170,i=t.createLinearGradient(u-15,0,u+15,0);i.addColorStop(0,"rgba(255,255,255,0)"),i.addColorStop(.5,`rgba(255,255,255,${(.62*f).toFixed(3)})`),i.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=i,t.fillRect(-200,-200,400,400)}}else if(n==="glass"){t.globalCompositeOperation="screen";const l=a.lx*1.15,c=a.ly*1.15;t.save(),t.translate(l,c),t.strokeStyle="rgba(110,228,255,0.50)",t.lineWidth=1.9,t.stroke(s),t.restore(),t.save(),t.translate(-l,-c),t.strokeStyle="rgba(255,120,212,0.42)",t.lineWidth=1.7,t.stroke(s),t.restore(),t.strokeStyle="rgba(240,252,255,0.80)",t.lineWidth=.95,t.stroke(s),t.save(),t.clip(s),t.translate(50-a.lx*3.2,50-a.ly*3.2),t.scale(.87,.87),t.translate(-50,-50),t.strokeStyle="rgba(190,236,255,0.22)",t.lineWidth=1.4,t.stroke(s),t.restore(),t.save(),t.clip(s),t.translate(50,50),t.rotate(-.62);const h=t.createLinearGradient(-58,0,58,0);h.addColorStop(0,"rgba(255,255,255,0)"),h.addColorStop(.4,"rgba(255,255,255,0.02)"),h.addColorStop(.5,"rgba(255,255,255,0.20)"),h.addColorStop(.58,"rgba(255,255,255,0.03)"),h.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=h,t.fillRect(-160,-160,320,320),t.restore()}else if(n==="jelly"){t.globalCompositeOperation="screen",t.save(),t.clip(s),t.translate(50-a.lx*1.4,50-a.ly*1.4),t.scale(.915,.915),t.translate(-50,-50),t.lineJoin="round",t.strokeStyle="rgba(255,255,255,0.5)",t.lineWidth=2.4,t.stroke(s),t.restore(),t.lineJoin="round",t.strokeStyle="rgba(255,255,255,0.38)",t.lineWidth=1.1,t.stroke(s),t.save(),t.clip(s),t.translate(50,50),t.rotate(-.6);const l=t.createLinearGradient(-64,0,64,0);l.addColorStop(0,"rgba(255,255,255,0)"),l.addColorStop(.4,"rgba(255,255,255,0.04)"),l.addColorStop(.5,"rgba(255,255,255,0.30)"),l.addColorStop(.58,"rgba(255,255,255,0.05)"),l.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=l,t.fillRect(-160,-160,320,320);const c=t.createLinearGradient(0,54,0,102);c.addColorStop(0,"rgba(255,255,255,0)"),c.addColorStop(1,"rgba(255,255,255,0.18)"),t.fillStyle=c,t.fillRect(-10,54,120,52),t.restore()}else{const{base:l,alt:c}=s0(o.color),h=.9+.1*Math.sin(a.t*13)*Math.sin(a.t*3.1);if(t.globalCompositeOperation="lighter",t.lineJoin="round",t.strokeStyle=Jo(c,.42*h),t.lineWidth=2.6,t.shadowColor=Jo(c,.8),t.shadowBlur=5*a.unit,t.stroke(s),t.strokeStyle=`rgba(255,255,255,${(.55*h).toFixed(3)})`,t.lineWidth=.9,t.shadowColor=Jo(l,.9),t.shadowBlur=3*a.unit,t.stroke(s),t.shadowBlur=0,r){t.save(),t.clip(s),t.fillStyle="rgba(255,255,255,0.045)";const d=a.t*9%4;for(let f=-4+d;f<104;f+=4)t.fillRect(-10,f,120,1.2);t.restore()}}t.restore()}const z1="M0 0.92C-1.35 -0.05 -1 -1 -0.42 -1C-0.16 -1 0 -0.84 0 -0.62C0 -0.84 0.16 -1 0.42 -1C1 -1 1.35 -0.05 0 0.92Z",q1="M0 -1Q0.14 -0.14 1 0Q0.14 0.14 0 1Q-0.14 0.14 -1 0Q-0.14 -0.14 0 -1Z";let gi=null,bi=null;const pr=()=>gi??(gi=new Path2D(z1)),yi=()=>bi??(bi=new Path2D(q1)),_1={happy:0,sleepy:0,questioning:0,loving:0,surprised:0,playful:0},Ra=t=>Math.max(0,Math.min(1,t)),Ha=t=>{const n=Ra(t)-1;return 1+2.70158*n*n*n+1.70158*n*n};function D1(t,n,o,e){const a=n.mood;if(!a||a.sleepy<.01&&a.questioning<.01&&a.surprised<.01&&a.loving<.01&&a.playful<.01)return;const s=e!=="light",r=n.t??0;t.save(),t.setTransform(o[0],o[1],o[2],o[3],o[4],o[5]),t.lineCap="round",t.lineJoin="round";const l=s?"rgba(10,10,30,0.38)":"rgba(255,255,255,0.7)",c=(h,d,f)=>{t.beginPath(),h(),t.strokeStyle=l,t.lineWidth=f+1.8,t.stroke(),t.strokeStyle=d,t.lineWidth=f,t.stroke()};if(a.sleepy>=.01){const h=s?"#BCC8FF":"#5A68D8",d=.4+.6*(n.drowse??.5);for(let f=0;f<3;f++){const u=(r/3.6+f/3)%1,i=Math.min(1,u/.14)*(u>.72?(1-u)/.28:1)*a.sleepy*d;if(i<=.01)continue;const m=3.6+4.4*u;t.save(),t.globalAlpha=i,t.translate(20+22*u+3*Math.sin(u*7+f*2),-38-28*u),t.rotate(-.18+.1*Math.sin(r*1.3+f)),c(()=>{t.moveTo(-m,-m),t.lineTo(m,-m),t.lineTo(-m,m),t.lineTo(m,m)},h,m*.5),t.restore()}}if(a.questioning>=.01){const h=12*Ha(a.questioning);t.save(),t.globalAlpha=Ra(a.questioning*1.6),t.translate(34,-56+2*Math.sin(r*2.6)),t.rotate(.2+.12*Math.sin(r*1.7));const d=s?"#FFD166":"#E39A00";c(()=>{t.arc(0,-.35*h,.65*h,Math.PI*1.05,Math.PI*2.45),t.lineTo(0,.5*h)},d,h*.38),t.beginPath(),t.arc(0,1.05*h,.2*h,0,Math.PI*2),t.fillStyle=l,t.lineWidth=0,t.fill(),t.beginPath(),t.arc(0,1.05*h,.17*h,0,Math.PI*2),t.fillStyle=d,t.fill(),t.restore()}if(a.surprised>=.01){const h=9*Ha(a.surprised),d=1.5*(n.startle??.3),f=s?"#FF7A7A":"#E5322D";for(const u of[-1,1])t.save(),t.globalAlpha=Ra(a.surprised*1.6),t.translate(u*10+Math.sin(r*46+u)*d,-63+Math.cos(r*41+u)*d*.5),t.rotate(u*.16),c(()=>{t.moveTo(0,-h),t.lineTo(0,.2*h)},f,h*.62),t.beginPath(),t.arc(0,.95*h,.31*h,0,Math.PI*2),t.fillStyle=l,t.fill(),t.beginPath(),t.arc(0,.95*h,.27*h,0,Math.PI*2),t.fillStyle=f,t.fill(),t.restore()}if(a.loving>=.01){const h=[-24,10,-6,26,-34];for(let d=0;d<5;d++){const f=(r/3+d/5)%1,u=Math.min(1,f/.15)*(f>.7?(1-f)/.3:1)*a.loving;if(u<=.01)continue;const i=4+4*f;t.save(),t.globalAlpha=u,t.translate(h[d]+4*Math.sin(f*6+d),-46-30*f),t.rotate(.25*Math.sin(f*5+d)),t.scale(i,i),t.fillStyle=s?"#FF6B98":"#F0306A",t.fill(pr()),t.fillStyle="rgba(255,255,255,0.55)",t.beginPath(),t.ellipse(-.42,-.5,.2,.13,-.6,0,Math.PI*2),t.fill(),t.restore()}}if(a.playful>=.01){const h=[[-52,-36,10,0],[46,-46,12,1.7],[60,4,9,3.1],[-58,14,8,4.6],[8,-66,9,5.9]];for(const[d,f,u,i]of h){const m=Math.pow(Math.max(0,Math.sin(r*3.4+i)),1.5)*a.playful;m<=.02||(t.save(),t.translate(d,f),t.rotate(.4*Math.sin(r+i)),t.scale(u*m,u*m),t.fillStyle=s?"#FFD84D":"#F2A900",t.fill(yi()),t.scale(.45,.45),t.fillStyle="#FFFFFF",t.fill(yi()),t.restore())}}t.restore()}const qe=30;function ki(t,n,o,e){const a=Math.asin(Math.max(-1,Math.min(1,t/qe)))+o,s=Math.asin(Math.max(-1,Math.min(1,-n/qe)))+e,r=Math.cos(s);return{x:qe*Math.sin(a)*r,y:-qe*Math.sin(s),sx:Math.cos(a),sy:r,z:Math.cos(a)*r}}const wi=8,Ps=new Map;function Ci(t,n,o){const e=Math.round(t*50),a=Math.round(n*50),s=Math.round(o*50),r=e+2e3*a+4e6*s;let l=Ps.get(r);if(!l){const c=e/50,h=a/50,d=s/50;let f=`M${-c} ${h}`;for(let u=1;u<=wi;u++){const i=u/wi,m=1-i;f+=` L${(m*m*-c+i*i*c).toFixed(3)} ${((m*m+i*i)*h+2*m*i*d).toFixed(3)}`}l=new Path2D(f),Ps.size>256&&Ps.clear(),Ps.set(r,l)}return l}const Ai=Math.sin(.684),vi=Math.cos(.684),Ts=new Map;function R1(t){const n=A=>Math.round(A*50)/50,o=n(t.hw),e=n(t.t0),a=n(t.a),s=n(t.yt),r=n(t.ab),l=n(t.yb),c=`${o},${e},${a},${s},${r},${l}`;let h=Ts.get(c);if(h)return h;const d=A=>A.toFixed(3),f=e*Ai,u=e*vi,i=-o+f,m=-u,g=o-f,M=-u,b=-o-f,w=u,v=o+f,y=u,C=4/3*e*vi,p=4/3*e*Ai,k=`M${d(i)} ${d(m)}C${d(-o+a*o)} ${d(s-e)} ${d(o-a*o)} ${d(s-e)} ${d(g)} ${d(M)}C${d(g+C)} ${d(M-p)} ${d(v+C)} ${d(y-p)} ${d(v)} ${d(y)}C${d(o-r*o)} ${d(l+e)} ${d(-o+r*o)} ${d(l+e)} ${d(b)} ${d(w)}C${d(b-C)} ${d(w-p)} ${d(i-C)} ${d(m-p)} ${d(i)} ${d(m)}Z`;return h=new Path2D(k),Ts.size>256&&Ts.clear(),Ts.set(c,h),h}function H1(t,n,o){const[e,a,s]=n.w,r=o.ink,l=v1[o.face],c=C1/2,h=n.lookX,d=n.lookY,{yaw:f,pitch:u}=n,i=(L,O,_,D=1)=>{const W=ki(L,O,f,u);W.z<=.02||D<=.01||(t.save(),t.globalAlpha=D*Math.min(1,W.z*5),t.translate(W.x,W.y),t.scale(Math.max(.02,W.sx),Math.max(.02,W.sy)),_(),t.restore())},m=(L,O)=>Math.abs(L)<=O?0:Math.sign(L)*(Math.abs(L)-O)/(1-O),g=L=>Math.max(-1,Math.min(1,L)),M=m(g(-n.pitch/.26-n.lookY/7),.34),b=Math.abs(m(g(n.lookX/4.5),.4)),w=Math.max(.3,1+.55*M-.1*b),v=1-.05*M+.12*b,y=o.eyes??"default",C=n.mood??_1,p=C.loving,k=C.surprised,A=C.questioning,S=C.sleepy*(n.drowse??0),E=e+a*(1-n.laugh),I=a*n.laugh,z=Math.max(0,-n.y)/26,x=.5+.5*n.breath;for(const L of[-1,1]){const O=L<0?n.blinkL:n.blinkR;let _=Math.max(0,Math.min(1,n.eyeOpen*(1-O)));y==="sleepy"&&(_=Math.min(_,.42));const D=L<0?1:-1,W=w*(1+.3*A*D+.5*k),K=v*(1+.1*A*D+.28*k);let Z=E*_,nt=E*(1-_),dt=I,pt=s;const At=L<0?n.winkL??0:n.winkR??0;At>0&&(dt+=At*(Z+nt),Z*=1-At,nt*=1-At),S>0&&(Z*=1-S,nt*=1-S,dt*=1-S,pt=pt*(1-S)+S);const j=Z*.01+nt*5.4+dt*6.2+pt*6,V=Z*1.1*W+nt*.6+dt*(2.2-z*1.5)+pt*(-1.4+x),U=Z*-3.3*W+nt*.6+dt*(-11.4-4*z)+pt*(5.4+2*x),It=Z*A1*2*K+nt*2.8+dt*4.4+pt*4,Y=h*(Z+.5*(nt+dt)),lt=d*(Z+.5*nt);i(L*c+Y,l+lt,()=>{if(y==="round"||y==="dot"){const ft=y==="round"?7.4:3.6,Pt=Math.max(.5,ft*(.3+.7*_)*(1-.85*At)*(1-.7*S));t.fillStyle=r,t.beginPath(),t.ellipse(0,0,ft,Pt,0,0,Math.PI*2),t.fill();return}if(t.strokeStyle=r,y==="happy"){t.lineWidth=4.4,t.stroke(Ci(6.2,2.2-z*1.5,-11.4-4*z));return}t.lineWidth=It,t.stroke(Ci(j,V,U))},1-p),p>.01&&i(L*c+h*.5,l+d*.5+.6,()=>{const ft=8.4*(1+.16*(n.beat??0))*Ha(p);t.scale(ft,ft),t.fillStyle="#FF4F86",t.fill(pr()),t.fillStyle="rgba(255,255,255,0.7)",t.beginPath(),t.ellipse(-.42,-.5,.2,.13,-.6,0,Math.PI*2),t.fill()},p)}const $=Math.max(.55*C.happy,.7*p,.5*C.playful);if($>.02)for(const L of[-1,1])i(L*(c+5.5)+h*.4,l+9.5,()=>{t.fillStyle="rgba(255,105,140,0.55)",t.beginPath(),t.ellipse(0,0,4.2,2.4,0,0,Math.PI*2),t.fill()},$);if(A>.01||k>.01)for(const L of[-1,1])i(L*c+h,l+d,()=>{t.strokeStyle=r,t.lineWidth=2.3,t.lineCap="round",t.beginPath(),k>A?(t.moveTo(-6,-11),t.quadraticCurveTo(0,-15.5,6,-11)):L<0?(t.moveTo(-6,-9.5),t.quadraticCurveTo(0,-14.5,6,-10)):(t.moveTo(-6,-6.2),t.lineTo(6,-7.4)),t.stroke()},Math.max(k,A));if(y==="angry"||y==="worried"){const L=y==="angry"?2.4:-2.4,O=-7;for(const _ of[-1,1]){const D=-_*6,W=_*6;i(_*c+h,l+d,()=>{t.strokeStyle=r,t.lineWidth=2.5,t.lineCap="round",t.beginPath(),t.moveTo(D,O+L),t.lineTo(W,O-L),t.stroke()})}}if(o.face==="mouth"){const L=h*.35,O=Math.max(C.happy,p,C.playful),_=(.6+.4*e)*(1+.06*n.breath)*(1+.28*O)*(1-.3*A),D=(.6+.4*a)*(1+.25*Math.max(0,-n.y)/26),W=2.7*s*(1+.25*n.breath),K=(nt,dt,pt)=>e*nt+a*dt+s*pt,Z={hw:K(6.5*_,9.5*D,W),t0:K(1.9,0,0),a:K(2/3,2/3,0),yt:K(3.53*_,1.6*D,-4*W/3),ab:K(2/3,0,0),yb:K(3.53*_,17.3*D,4*W/3)};if(k>.001){const nt={hw:3.6,t0:0,a:0,yt:-4.8,ab:0,yb:4.8};for(const dt of Object.keys(nt))Z[dt]+=(nt[dt]-Z[dt])*k}i(L,K(12.5,11.6,15.5)+(14-K(12.5,11.6,15.5))*k,()=>{t.fillStyle=r,t.fill(R1(Z))})}const T=L=>{const O=ki(L,l,f,u);return{x:O.x,y:O.y,sx:O.sx,sy:O.sy,z:O.z,ox:L,oy:l,fz:Math.sqrt(Math.max(0,qe*qe-L*L-l*l))}};return[T(-c),T(c)]}const Zo={x:NaN,y:NaN},_e=new Set;let Xo=0,zs=0;function mr(t){Xo=0;const n=zs?Math.min(.1,(t-zs)/1e3):0;zs=t,_e.forEach(o=>o(n)),_e.size&&(Xo=requestAnimationFrame(mr))}function Mr(){Xo||typeof document>"u"||document.hidden||(zs=0,Xo=requestAnimationFrame(mr))}let Si=!1;function B1(){Si||typeof document>"u"||(Si=!0,document.addEventListener("pointermove",t=>{Zo.x=t.clientX,Zo.y=t.clientY},{passive:!0}),document.addEventListener("pointerleave",()=>{Zo.x=NaN,Zo.y=NaN}),window.addEventListener("blur",()=>{Zo.x=NaN,Zo.y=NaN}),document.addEventListener("visibilitychange",()=>{document.hidden?(Xo&&cancelAnimationFrame(Xo),Xo=0):_e.size&&Mr()}))}function j1(t){return B1(),_e.add(t),Mr(),()=>{_e.delete(t),!_e.size&&Xo&&(cancelAnimationFrame(Xo),Xo=0)}}const Y1=["data-bot-avatar","data-face","data-state","aria-label"],xi=4e3,Vs=N.defineComponent({name:"BotAvatar",__name:"BotAvatar",props:{type:{default:"clover"},path:{},face:{},eyes:{default:"default"},state:{default:"default"},size:{default:64},color:{},ink:{},brightness:{},saturation:{},speed:{default:1},paused:{type:Boolean,default:!1},seed:{},shading:{type:[String,Boolean],default:"fabric"},hat:{default:"none"},glasses:{default:"none"},headphones:{type:Boolean,default:!1},bowTie:{type:Boolean,default:!1},scarf:{type:Boolean,default:!1},accessoryColor:{default:"#27272b"},shadow:{},highlight:{},depth:{default:.65},roundness:{default:1},furLength:{default:1},furDensity:{default:1.6},furFuzz:{default:.9},furClumps:{default:.4},furCurl:{default:.7},furGravity:{default:.9},light:{},rim:{},backLight:{},lightFront:{},shine:{},sheen:{},backSoftness:{},spread:{},pose:{},interactive:{type:Boolean,default:!0},theme:{default:"auto"},turn:{default:1},whirl:{default:0},whirlSize:{default:1},whirlWidth:{default:1},whirlLength:{default:1},whirlTilt:{default:1},jumpHeight:{default:26},jumpTime:{default:.68},jumpStretch:{default:1},jumpSquash:{default:1.15},jumpSquashTime:{default:.37},jumpSquashEase:{default:"pulse"},jumpGroundTime:{default:.11},jumpGroundEase:{default:"pulse"},jumpRiseTime:{default:.33},jumpRiseEase:{default:"pulse"},jumpClickSquashTime:{default:.24},jumpSpin:{default:1},jumpLean:{default:6},jumpEvery:{default:8},jumpLand:{default:0},ariaLabel:{}},setup(t,{expose:n}){function o(J){let Mt=2166136261;for(let Ht=0;Ht<J.length;Ht++)Mt=Math.imul(Mt^J.charCodeAt(Ht),16777619);return(Mt>>>0)%1e3/1e3}const e=(J,Mt,Ht)=>Math.min(Ht,Math.max(Mt,Number.isFinite(J)?J:1)),a=new Map;function s(J){let Mt=a.get(J);return Mt||(Mt=new Path2D(J),a.set(J,Mt)),Mt}const r=new Map;function l(J){let Mt=r.get(J);return Mt||(Mt=J.split(/(?=M)/).filter(Ht=>Ht.trim()).map(Ht=>new Path2D(Ht)),r.set(J,Mt)),Mt}const c=new Map;function h(){if(bs())return;for(const Mt of c.values())if(!Mt.ready())return;const J=[...c.values()];c.clear();for(const Mt of J)Mt.show()}const d=()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,f=t,u=N.computed(()=>De[f.type]??De.clover),i=N.computed(()=>f.face??u.value.face),m=N.computed(()=>f.color??u.value.color),g=N.computed(()=>f.brightness??u.value.brightness??1),M=N.computed(()=>f.saturation??u.value.saturation??1.5),b=N.computed(()=>e(M.value,1.5,2.5)-1.5),w=N.computed(()=>qr(g.value===1&&M.value===1?m.value:fn(m.value,(Math.min(2,Math.max(0,g.value))-1)*.35,(Math.min(1.5,Math.max(0,M.value))-1)*.5),b.value)),v=N.computed(()=>f.ink??Ya(w.value)),y=N.useId(),C=N.computed(()=>Math.min(1,Math.max(0,f.seed??o(y)))),p=N.computed(()=>f.state in qs?f.state:"default"),k=N.computed(()=>f.paused||!(f.speed>0)),A=N.computed(()=>{const J=f.shading;return J===!0||J===""?"crisp":J===!1?"flat":J}),S=N.computed(()=>typeof f.path=="string"&&f.path.trim()?f.path.trim():null),E=N.computed(()=>S.value?`path:${o(S.value)}:${S.value.length}`:f.type),I=N.computed(()=>Qs[A.value==="fabric"?"fabric":"other"]),z=(J,Mt,Ht)=>Math.round(e(J,Mt,Ht)*20)/20,x=N.computed(()=>({length:z(f.furLength,.3,2.5),density:z(f.furDensity,.3,2),fuzz:z(f.furFuzz,0,1),clumps:z(f.furClumps,0,1),curl:z(f.furCurl,0,1),gravity:z(f.furGravity,0,1)})),$=N.computed(()=>`${x.value.length},${x.value.density},${x.value.fuzz},${x.value.clumps},${x.value.curl},${x.value.gravity}`),T=N.computed(()=>["plastic","fabric","metal","glass","jelly","neon"].includes(A.value)),L=N.computed(()=>`${A.value}|${E.value}|${f.size}`),O=N.computed(()=>f.interactive&&!f.pose),_=N.computed(()=>f.ariaLabel??`${u.value.label} bot, ${qs[p.value]}`),D=N.ref(null),W=N.ref(!T.value);let K=null,Z=null,nt=0,dt=null,pt=null,At=null,j=null,V=null,U=!1;const It={};function Y(){const J=D.value,Mt=Z;if(!J||!Mt||!Mt.path)return;const Ht=J.clientWidth/Fo||nt||(typeof f.size=="number"?f.size:64);if(!Ht)return;const Kt=Math.min(2,typeof devicePixelRatio=="number"&&devicePixelRatio||1),vn=Math.round(Ht*Fo*Kt);(J.width!==vn||J.height!==vn)&&(J.width=vn,J.height=vn),nt=Ht;const ln=J.getContext("2d");if(!ln)return;ln.setTransform(Kt,0,0,Kt,0,0),Mt.dpr=Kt,Mt.time=typeof performance=="object"&&performance.now?performance.now():Date.now();const Sn=f.pose,qn=Hs(p.value),lo=Sn?{...qn,yaw:Sn.yaw??0,pitch:Sn.pitch??qn.pitch,roll:Sn.roll??qn.roll}:K?K.pose:qn;Ks(ln,Ht,lo,Mt)}function lt(){pt&&pt(),pt=null}function ft(J){ys(),J(),ys()?pt||(pt=ba(()=>{const Mt=dt;D.value&&Mt?ft(Mt):lt()})):lt()}function Pt(){j&&j(),j=null}function it(J){if(At=J,ys(),J(),U=!ys(),U&&!bs()){h();return}j||(j=ba(()=>{const Mt=At;D.value&&Mt&&!W.value?it(Mt):Pt(),h()}))}let q=!1,F=null;function bt(){q||(q=!0,c.set(It,{ready:()=>U,show:()=>{W.value=!0}}),h(),gs(!0),F=setTimeout(()=>{W.value=!0},xi))}function H(){q&&(q=!1,gs(!1),F!==null&&(clearTimeout(F),F=null),Pt(),c.delete(It),h())}N.watch(W,J=>{J&&H()});function Et(){if(!T.value||!Z?.path)return;const J=Z.path,Mt=(typeof f.size=="number"?f.size:64)*Math.min(2,typeof devicePixelRatio=="number"&&devicePixelRatio||1),Ht=Z.light??295,Kt=Ht*Math.PI/180,vn=(f.backLight??0)*Math.PI/180,ln=ss(Math.sin(Kt),-Math.cos(Kt));f.backLight!==void 0&&([ln.bx,ln.by]=[Math.sin(vn),-Math.cos(vn)]),f.lightFront!==void 0&&(ln.front=Math.min(85,Math.max(0,f.lightFront))*Math.PI/180),Va(E.value,J,Mt,f.depth,A.value==="fabric",x.value,Ht,ln)}let Lt=null;function Cn(){Lt&&(Lt(),Lt=null)}function _t(){if(!T.value||!Z?.path)return;Cn();const J=typeof requestIdleCallback=="function",Ht=(J?requestIdleCallback:Kt=>setTimeout(Kt,1))(Et);Lt=J&&typeof cancelIdleCallback=="function"?()=>cancelIdleCallback(Ht):()=>clearTimeout(Ht)}let Mn=null;function an(){if(Et(),!bs())return;gs(!0);const J=()=>{V&&(V(),Ot())},Mt=ba(()=>{bs()||J()}),Ht=setTimeout(J,xi);V=()=>{Mt(),clearTimeout(Ht),gs(!1),V=null}}function gn(J){if(f.theme!=="auto")return f.theme;const Mt=J?.closest("[data-theme], .dark, .light");if(Mt){const Ht=Mt.getAttribute("data-theme");if(Ht==="dark"||Ht==="light")return Ht;if(Mt.classList.contains("dark"))return"dark";if(Mt.classList.contains("light"))return"light"}return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function Ot(){const J=S.value,Mt=A.value;if(Z={path:typeof Path2D>"u"?null:s(J??_s[f.type]??_s.clover),face:i.value,faceX:u.value.faceX,faceY:u.value.faceY,faceScale:u.value.faceScale,eyes:f.eyes,color:w.value,ink:v.value,shading:Mt,shadow:e(f.shadow??I.value.shadow,0,2),highlight:e(f.highlight??I.value.highlight,0,2),depth:e(f.depth,.2,2),roundness:e(f.roundness,0,1),fur:x.value,vivid:b.value,backLight:f.backLight,lightFront:f.lightFront,shine:f.shine,sheen:f.sheen,backSoftness:f.backSoftness,light:f.light??I.value.light,rim:e(f.rim??I.value.rim,0,2),spread:e(f.spread??I.value.spread,.4,2.5),typeKey:E.value,still:k.value||d(),furOnIdle:!0,whirl:{strength:e(f.whirl,0,2),size:e(f.whirlSize,.6,1.6),width:e(f.whirlWidth,.4,2),length:e(f.whirlLength,.4,1.6),tilt:e(f.whirlTilt,.5,1.8)},parts:typeof Path2D<"u"&&!J&&Ds[f.type]?l(Ds[f.type]):void 0,wear:{hat:f.hat,glasses:f.glasses,headphones:f.headphones,bowTie:f.bowTie,scarf:f.scarf,color:f.accessoryColor,fabric:Mt==="fabric"}},K?K.setState(p.value):K=new Xa(C.value,p.value),K.setTurn(e(f.turn,0,2)),W.value&&T.value&&Mn!==null&&Mn!==L.value&&!V&&an(),Mn=L.value,K.setJump({height:f.jumpHeight,time:Math.max(.2,f.jumpTime),stretch:f.jumpStretch,spin:Math.max(0,Math.round(f.jumpSpin)),lean:f.jumpLean,every:f.jumpEvery,land:f.jumpLand,squash:f.jumpSquash,squashTime:Math.max(.05,f.jumpSquashTime),squashEase:f.jumpSquashEase,groundTime:Math.max(0,f.jumpGroundTime),groundEase:f.jumpGroundEase,riseTime:Math.max(.05,f.jumpRiseTime),riseEase:f.jumpRiseEase,clickSquashTime:Math.max(.05,f.jumpClickSquashTime)}),!V){if(d()){const Ht=()=>{const Kt=D.value;if(!Kt||!Z||!Z.path)return;const vn=Kt.clientWidth/Fo||nt||(typeof f.size=="number"?f.size:64);if(!vn)return;nt=vn;const ln=Math.min(2,typeof devicePixelRatio=="number"&&devicePixelRatio||1);Kt.width=Kt.height=Math.round(vn*Fo*ln);const Sn=Kt.getContext("2d");Sn&&Z&&(Z.theme=gn(Kt),Z.dpr=ln,Sn.setTransform(ln,0,0,ln,0,0),Ks(Sn,vn,Hs(p.value),Z))};dt=Ht,W.value?ft(Ht):it(Ht);return}Z&&(Z.theme=gn(D.value)),W.value?k.value?(dt=Y,ft(Y)):(dt=null,lt(),Y()):(dt=k.value?Y:null,it(Y))}}let Rt=null,St=null;function sn(){Rt&&Rt(),Rt=null,St&&St.disconnect(),St=null}function yn(){if(sn(),k.value||d())return;const J=D.value;if(!J)return;const Mt=3,Ht=ln=>{const Sn=K;if(Sn){if(O.value&&!Number.isNaN(Zo.x)){const qn=J.getBoundingClientRect(),lo=qn.width/Fo||1,Fn=(Zo.x-(qn.left+qn.width/2))/lo,Jn=(Zo.y-(qn.top+qn.height/2+Pe*lo))/lo,Bn=Math.hypot(Fn,Jn),ne=Bn<1?1:Bn>Mt?0:1-(Bn-1)/(Mt-1);Sn.setPointer(Fn/Math.max(1,Bn),Jn/Math.max(1,Bn),ne)}else Sn.setPointer(0,0,0);Sn.update(ln*f.speed),W.value&&!V&&Y()}},Kt=()=>{Rt||(Rt=j1(Ht))},vn=()=>{Rt&&(Rt(),Rt=null)};typeof IntersectionObserver=="function"?(St=new IntersectionObserver(ln=>{ln[0]?.isIntersecting??!0?Kt():vn()}),St.observe(J)):Kt()}N.watch(k,()=>yn()),N.onMounted(()=>{Ot(),W.value||bt(),_t(),yn()}),N.onUpdated(Ot),N.onUnmounted(()=>{H(),lt(),Pt(),V&&V(),sn(),Cn()}),N.watch([A,E,()=>f.size,()=>f.depth,$,()=>f.light,()=>f.backLight,()=>f.lightFront],()=>_t());function ro(){f.interactive&&!k.value&&!f.pose&&K?.poke()}const go=N.computed(()=>{const J=f.size,Mt=typeof J=="number"?`${J*Fo}px`:`calc(${J} * ${Fo})`,Ht=vn=>typeof J=="number"?`${-J*vn}px`:`calc(${J} * ${-vn})`,Kt=(Fo-1)/2;return{display:"inline-block",verticalAlign:"middle",width:Mt,height:Mt,marginLeft:Ht(Kt),marginRight:Ht(Kt),marginTop:Ht(Kt+Pe),marginBottom:Ht(Kt-Pe),flex:"none",maxWidth:"none",opacity:W.value?1:0,transition:"opacity 0.3s ease-out"}});return n({canvas:D}),(J,Mt)=>(N.openBlock(),N.createElementBlock("canvas",{ref_key:"canvasEl",ref:D,class:"ba","data-bot-avatar":f.type,"data-face":i.value,"data-state":p.value,role:"img","aria-label":_.value,style:N.normalizeStyle(go.value),onClick:ro},null,12,Y1))}}),Pi="familiar-vue-bot-list-styles",X1=`
|
|
2
|
+
/* ══ root ═══════════════════════════════════════════════════════════════ */
|
|
3
|
+
.fv-botlist {
|
|
4
|
+
--bl-ink: #1c1c1c;
|
|
5
|
+
--bl-muted: #606060;
|
|
6
|
+
--bl-panel: #f5f5f5;
|
|
7
|
+
--bl-hover: rgba(28, 28, 28, 0.055);
|
|
8
|
+
--bl-active: rgba(28, 28, 28, 0.09);
|
|
9
|
+
--bl-line: rgba(28, 28, 28, 0.07);
|
|
10
|
+
--bl-accent: var(--fv-botlist-accent, #e8b86d);
|
|
11
|
+
--bl-accent-ink: var(--fv-botlist-accent-ink, #241a08);
|
|
12
|
+
--bl-font: var(--font-sans, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif);
|
|
13
|
+
--bl-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
width: 100%;
|
|
16
|
+
min-width: 0;
|
|
17
|
+
color: var(--bl-ink);
|
|
18
|
+
font-family: var(--bl-font);
|
|
19
|
+
font-size: 15px;
|
|
20
|
+
line-height: 1.35;
|
|
21
|
+
-webkit-tap-highlight-color: transparent;
|
|
22
|
+
}
|
|
23
|
+
.fv-botlist[data-theme="dark"] {
|
|
24
|
+
--bl-ink: #f4f3f1;
|
|
25
|
+
--bl-muted: #9b9b9f;
|
|
26
|
+
--bl-panel: #1f1f21;
|
|
27
|
+
--bl-hover: rgba(255, 255, 255, 0.055);
|
|
28
|
+
--bl-active: rgba(255, 255, 255, 0.095);
|
|
29
|
+
--bl-line: rgba(255, 255, 255, 0.08);
|
|
30
|
+
}
|
|
31
|
+
.fv-botlist *, .fv-botlist *::before, .fv-botlist *::after { box-sizing: border-box; }
|
|
32
|
+
|
|
33
|
+
.fv-botlist[data-surface="card"] {
|
|
34
|
+
padding: 10px;
|
|
35
|
+
border-radius: 18px;
|
|
36
|
+
background: var(--bl-panel);
|
|
37
|
+
box-shadow: inset 0 0 0 1px var(--bl-line);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ══ rows ═══════════════════════════════════════════════════════════════ */
|
|
41
|
+
.fv-botlist-items {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: var(--fv-botlist-gap, 6px);
|
|
45
|
+
margin: 0;
|
|
46
|
+
padding: 0;
|
|
47
|
+
list-style: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.fv-botlist-row {
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 14px;
|
|
54
|
+
width: 100%;
|
|
55
|
+
min-width: 0;
|
|
56
|
+
margin: 0;
|
|
57
|
+
padding: 8px 10px;
|
|
58
|
+
border: 0;
|
|
59
|
+
border-radius: 13px;
|
|
60
|
+
background: transparent;
|
|
61
|
+
color: inherit;
|
|
62
|
+
font: inherit;
|
|
63
|
+
text-align: left;
|
|
64
|
+
text-decoration: none;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
transition: background-color 150ms var(--bl-ease), box-shadow 150ms var(--bl-ease);
|
|
67
|
+
}
|
|
68
|
+
.fv-botlist-row:hover { background: var(--bl-hover); text-decoration: none; }
|
|
69
|
+
.fv-botlist-row:active { background: var(--bl-active); }
|
|
70
|
+
.fv-botlist-row:focus-visible {
|
|
71
|
+
outline: 2px solid var(--bl-accent);
|
|
72
|
+
outline-offset: 1px;
|
|
73
|
+
}
|
|
74
|
+
.fv-botlist-row[disabled],
|
|
75
|
+
.fv-botlist-row[aria-disabled="true"] {
|
|
76
|
+
opacity: 0.45;
|
|
77
|
+
cursor: default;
|
|
78
|
+
pointer-events: none;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.fv-botlist-item.is-selected .fv-botlist-row {
|
|
82
|
+
background: color-mix(in srgb, var(--bl-accent) 15%, transparent);
|
|
83
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bl-accent) 45%, transparent);
|
|
84
|
+
}
|
|
85
|
+
.fv-botlist-item.is-selected .fv-botlist-row:hover {
|
|
86
|
+
background: color-mix(in srgb, var(--bl-accent) 22%, transparent);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.fv-botlist[data-divided="true"] .fv-botlist-items { gap: 0; }
|
|
90
|
+
.fv-botlist[data-divided="true"] .fv-botlist-item + .fv-botlist-item {
|
|
91
|
+
border-top: 1px solid var(--bl-line);
|
|
92
|
+
}
|
|
93
|
+
.fv-botlist[data-divided="true"] .fv-botlist-row { border-radius: 10px; }
|
|
94
|
+
|
|
95
|
+
/* ── narrow rail: avatars only ───────────────────────────────────────── */
|
|
96
|
+
.fv-botlist[data-compact="true"][data-surface="card"] {
|
|
97
|
+
padding: 6px;
|
|
98
|
+
border-radius: 16px;
|
|
99
|
+
}
|
|
100
|
+
.fv-botlist[data-compact="true"] .fv-botlist-copy,
|
|
101
|
+
.fv-botlist[data-compact="true"] .fv-botlist-side { display: none; }
|
|
102
|
+
.fv-botlist[data-compact="true"] .fv-botlist-row {
|
|
103
|
+
width: fit-content;
|
|
104
|
+
margin-inline: auto;
|
|
105
|
+
gap: 0;
|
|
106
|
+
padding: 6px;
|
|
107
|
+
}
|
|
108
|
+
.fv-botlist[data-compact="true"] .fv-botlist-item { display: flex; justify-content: center; }
|
|
109
|
+
|
|
110
|
+
/* ══ contents ═══════════════════════════════════════════════════════════ */
|
|
111
|
+
.fv-botlist-avatar {
|
|
112
|
+
position: relative;
|
|
113
|
+
display: grid;
|
|
114
|
+
place-items: center;
|
|
115
|
+
flex: none;
|
|
116
|
+
width: var(--fv-botlist-avatar, 48px);
|
|
117
|
+
height: var(--fv-botlist-avatar, 48px);
|
|
118
|
+
}
|
|
119
|
+
.fv-botlist-avatar > * { flex: none; }
|
|
120
|
+
|
|
121
|
+
.fv-botlist-dot {
|
|
122
|
+
position: absolute;
|
|
123
|
+
top: 1px;
|
|
124
|
+
right: 1px;
|
|
125
|
+
width: 8px;
|
|
126
|
+
height: 8px;
|
|
127
|
+
border-radius: 50%;
|
|
128
|
+
background: var(--bl-accent);
|
|
129
|
+
box-shadow: 0 0 0 2px var(--fv-botlist-dot-ring, var(--bl-panel));
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.fv-botlist-copy {
|
|
134
|
+
display: flex;
|
|
135
|
+
min-width: 0;
|
|
136
|
+
flex: 1 1 auto;
|
|
137
|
+
flex-direction: column;
|
|
138
|
+
gap: 2px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.fv-botlist-title {
|
|
142
|
+
display: flex;
|
|
143
|
+
min-width: 0;
|
|
144
|
+
align-items: center;
|
|
145
|
+
gap: 8px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.fv-botlist-name {
|
|
149
|
+
overflow: hidden;
|
|
150
|
+
color: var(--bl-ink);
|
|
151
|
+
font-size: 18px;
|
|
152
|
+
font-weight: 600;
|
|
153
|
+
line-height: 1.25;
|
|
154
|
+
letter-spacing: -0.01em;
|
|
155
|
+
white-space: nowrap;
|
|
156
|
+
text-overflow: ellipsis;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.fv-botlist-preview {
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
color: var(--bl-muted);
|
|
162
|
+
font-size: 15px;
|
|
163
|
+
font-weight: 400;
|
|
164
|
+
line-height: 1.35;
|
|
165
|
+
white-space: nowrap;
|
|
166
|
+
text-overflow: ellipsis;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.fv-botlist-badge {
|
|
170
|
+
display: inline-grid;
|
|
171
|
+
min-width: 18px;
|
|
172
|
+
height: 18px;
|
|
173
|
+
flex: none;
|
|
174
|
+
place-items: center;
|
|
175
|
+
padding: 0 5px;
|
|
176
|
+
border-radius: 999px;
|
|
177
|
+
background: var(--bl-accent);
|
|
178
|
+
color: var(--bl-accent-ink);
|
|
179
|
+
font: 600 11px/1 var(--bl-font);
|
|
180
|
+
font-variant-numeric: tabular-nums;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.fv-botlist-side {
|
|
184
|
+
display: flex;
|
|
185
|
+
flex: none;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
align-items: flex-end;
|
|
188
|
+
gap: 4px;
|
|
189
|
+
align-self: flex-start;
|
|
190
|
+
padding-top: 3px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.fv-botlist-meta {
|
|
194
|
+
color: var(--bl-muted);
|
|
195
|
+
font-size: 12px;
|
|
196
|
+
line-height: 1.3;
|
|
197
|
+
font-variant-numeric: tabular-nums;
|
|
198
|
+
white-space: nowrap;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.fv-botlist-empty {
|
|
202
|
+
padding: 18px 12px;
|
|
203
|
+
color: var(--bl-muted);
|
|
204
|
+
font-size: 14px;
|
|
205
|
+
text-align: center;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@media (max-width: 480px) {
|
|
209
|
+
.fv-botlist-name { font-size: 16px; }
|
|
210
|
+
.fv-botlist-preview { font-size: 14px; }
|
|
211
|
+
.fv-botlist-row { gap: 12px; }
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@media (prefers-reduced-motion: reduce) {
|
|
215
|
+
.fv-botlist *, .fv-botlist *::before, .fv-botlist *::after {
|
|
216
|
+
transition-duration: 1ms !important;
|
|
217
|
+
animation-duration: 1ms !important;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
`;let Ea=!1;function G1(){if(typeof document>"u"||Ea)return;if(document.getElementById(Pi)){Ea=!0;return}const t=document.createElement("style");t.id=Pi,t.textContent=X1,document.head.appendChild(t),Ea=!0}const K1=["data-theme","data-surface","data-divided","data-compact"],V1=["aria-label"],N1={class:"fv-botlist-avatar"},Z1={key:0,class:"fv-botlist-dot","aria-hidden":"true"},U1={class:"fv-botlist-copy"},Q1={class:"fv-botlist-title"},J1={class:"fv-botlist-name"},tc={key:0,class:"fv-botlist-badge"},nc={key:0,class:"fv-botlist-preview"},oc={key:0,class:"fv-botlist-side"},ec={key:0,class:"fv-botlist-meta"},sc={key:1,class:"fv-botlist-empty"},gr=N.defineComponent({name:"BotList",__name:"BotList",props:{items:{},modelValue:{},initial:{},ariaLabel:{default:"Bots"},avatarSize:{default:48},theme:{default:"auto"},surface:{default:"card"},gap:{default:6},divided:{type:Boolean,default:!1},compactAt:{default:190}},emits:["select","update:modelValue"],setup(t,{emit:n}){G1();const o=t,e=n,a=N.computed(()=>(o.items??[]).map((p,k)=>({item:p,index:k,id:p.id??String(k)}))),s=N.computed(()=>a.value.map(p=>p.id)),r=(()=>{const p=o.initial;return p===void 0?-1:typeof p=="number"?Number.isFinite(p)?Math.max(0,Math.trunc(p)):-1:(o.items??[]).findIndex((A,S)=>(A.id??String(S))===p)})(),l=N.ref(r),c=N.computed(()=>{const p=a.value.length-1;if(o.modelValue!==void 0){const k=s.value.indexOf(o.modelValue);return k>=0?k:-1}return l.value>=0&&l.value<=p?l.value:-1});function h(p,k){if(p.item.disabled){k.preventDefault();return}o.modelValue===void 0&&(l.value=p.index),e("update:modelValue",p.id),e("select",{id:p.id,index:p.index,item:p.item})}function d(p){const k=p.target;if(!k||!k.classList.contains("fv-botlist-row")||!["ArrowDown","ArrowUp","Home","End"].includes(p.key))return;const A=p.currentTarget;if(!A)return;const S=[...A.querySelectorAll(".fv-botlist-row")].filter(z=>z.getAttribute("aria-disabled")!=="true"&&!z.hasAttribute("disabled"));if(!S.length)return;const E=S.indexOf(k);let I=-1;p.key==="ArrowDown"?I=Math.min(S.length-1,Math.max(0,E+1)):p.key==="ArrowUp"?I=Math.max(0,E-1):p.key==="Home"?I=0:p.key==="End"&&(I=S.length-1),!(I<0)&&(p.preventDefault(),S[I]?.focus())}const f=N.ref(o.theme==="auto"?"light":o.theme);let u=null;const i=N.ref(null),m=N.ref(!1);let g=null;function M(){const p=i.value;p&&(m.value=o.compactAt>0&&p.getBoundingClientRect().width<=o.compactAt)}function b(){if(o.theme!=="auto"){f.value=o.theme;return}if(typeof document>"u")return;const p=document.documentElement,k=p.dataset.theme??(p.classList.contains("dark")?"dark":p.classList.contains("light")?"light":"");k==="dark"||k==="light"?f.value=k:f.value=u?.matches?"dark":"light"}function w(){b()}let v=null;N.onMounted(()=>{if(u=window.matchMedia?.("(prefers-color-scheme: dark)")??null,u?.addEventListener?.("change",w),b(),typeof MutationObserver<"u"&&(v=new MutationObserver(b),v.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]})),M(),typeof ResizeObserver>"u"){window.addEventListener("resize",M);return}g=new ResizeObserver(M),i.value&&g.observe(i.value)}),N.onBeforeUnmount(()=>{u?.removeEventListener?.("change",w),v?.disconnect(),g?.disconnect(),g=null,window.removeEventListener("resize",M)}),N.watch(()=>o.theme,b),N.watch(()=>o.compactAt,M);const y=N.computed(()=>({"--fv-botlist-gap":`${Number.isFinite(o.gap)?Math.max(0,o.gap):6}px`,"--fv-botlist-avatar":typeof o.avatarSize=="number"?`${Math.max(1,o.avatarSize)}px`:o.avatarSize}));function C(p){return p>99?"99+":String(p)}return(p,k)=>(N.openBlock(),N.createElementBlock("div",{ref_key:"rootEl",ref:i,class:"fv-botlist","data-theme":f.value,"data-surface":t.surface,"data-divided":t.divided?"true":void 0,"data-compact":m.value?"true":void 0,style:N.normalizeStyle(y.value)},[a.value.length?(N.openBlock(),N.createElementBlock("ul",{key:0,class:"fv-botlist-items","aria-label":t.ariaLabel,onKeydown:d},[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(a.value,A=>(N.openBlock(),N.createElementBlock("li",{key:A.id,class:N.normalizeClass(["fv-botlist-item",{"is-selected":A.index===c.value}])},[(N.openBlock(),N.createBlock(N.resolveDynamicComponent(A.item.href?"a":"button"),{class:"fv-botlist-row",href:A.item.href,type:A.item.href?void 0:"button",tabindex:A.item.href&&A.item.disabled?-1:void 0,disabled:A.item.href?void 0:A.item.disabled,"aria-disabled":A.item.disabled?"true":void 0,"aria-current":A.index===c.value?"true":void 0,"aria-label":A.item.name,title:m.value?A.item.name:void 0,onClick:S=>h(A,S)},{default:N.withCtx(()=>[N.createElementVNode("span",N1,[N.renderSlot(p.$slots,"avatar",{item:A.item,index:A.index},()=>[N.createVNode(Vs,N.mergeProps({"aria-hidden":"true"},{ref_for:!0},A.item.avatar,{size:t.avatarSize,theme:f.value,interactive:A.item.avatar?.interactive??!1}),null,16,["size","theme","interactive"])]),m.value&&A.item.unread&&A.item.unread>0?(N.openBlock(),N.createElementBlock("span",Z1)):N.createCommentVNode("",!0)]),N.createElementVNode("span",U1,[N.createElementVNode("span",Q1,[N.createElementVNode("span",J1,N.toDisplayString(A.item.name),1),A.item.unread&&A.item.unread>0?(N.openBlock(),N.createElementBlock("span",tc,N.toDisplayString(C(A.item.unread)),1)):N.createCommentVNode("",!0)]),A.item.preview?(N.openBlock(),N.createElementBlock("span",nc,N.toDisplayString(A.item.preview),1)):N.createCommentVNode("",!0)]),A.item.meta||p.$slots.trailing?(N.openBlock(),N.createElementBlock("span",oc,[A.item.meta?(N.openBlock(),N.createElementBlock("span",ec,N.toDisplayString(A.item.meta),1)):N.createCommentVNode("",!0),N.renderSlot(p.$slots,"trailing",{item:A.item,index:A.index,selected:A.index===c.value})])):N.createCommentVNode("",!0)]),_:2},1032,["href","type","tabindex","disabled","aria-disabled","aria-current","aria-label","title","onClick"]))],2))),128))],40,V1)):(N.openBlock(),N.createElementBlock("div",sc,[N.renderSlot(p.$slots,"empty",{},()=>[k[0]||(k[0]=N.createTextVNode("No bots yet.",-1))])]))],12,K1))}}),ac=Object.freeze(Object.defineProperty({__proto__:null,BOT_AVATAR_LIGHTS:Qs,BOT_AVATAR_MATCAP_SIZE:_i,BOT_AVATAR_OVERSCAN:Fo,BOT_AVATAR_PAD:st,BOT_AVATAR_RISE:Pe,BOT_AVATAR_SPAN:zt,BotAvatar:Vs,BotAvatarSim:Xa,BotList:gr,autoInk:Ya,bakeBotAvatarForm:Ga,botAvatarCapFrame:Ja,botAvatarFaces:Ti,botAvatarJumpDefaults:Rs,botAvatarPalette:Li,botAvatarParts:Ds,botAvatarPresets:De,botAvatarShapes:_s,botAvatarStates:Ii,botAvatarTier:Ns,botAvatarTypes:Ba,buildBotAvatarMatcap:Na,default:Vs,drawBotAvatarFrame:Ks,luminance:ja,parseColor:ge,restPose:Hs,shade:fn,shadeBotAvatarTexels:Za,stateLabels:qs,warmBotAvatarPlastic:Va},Symbol.toStringTag,{value:"Module"}));exports.JUMP_DEFAULTS=Rs;exports.LIGHT_DEFAULTS=Qs;exports.MATCAP_SIZE=_i;exports.OVERSCAN=Fo;exports.PAD=st;exports.RISE=Pe;exports.SHAPE_PARTS=Ds;exports.SHAPE_PATHS=_s;exports.SPAN=zt;exports.Sim=Xa;exports._sfc_main=Vs;exports._sfc_main$1=gr;exports.autoInk=Ya;exports.botAvatarFaces=Ti;exports.botAvatarPalette=Li;exports.botAvatarPresets=De;exports.botAvatarStates=Ii;exports.botAvatarTypes=Ba;exports.buildForm=Ga;exports.buildMatcap=Na;exports.capFrame=Ja;exports.draw=Ks;exports.index=ac;exports.luminance=ja;exports.parseColor=ge;exports.restPose=Hs;exports.shade=fn;exports.shadeTexels=Za;exports.stateLabels=qs;exports.tierFor=Ns;exports.warmPlastic=Va;
|
|
221
|
+
//# sourceMappingURL=index-Bb3rhhZY.cjs.map
|