@sumi-forge/react 0.0.0-stage → 1.0.1

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.
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime"),u=require("react-dom");function d(e){let t=(e|0)+1831565813;return function(){return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function f(e,t,n){let r=Math.floor(e),i=Math.floor(t),a=e-r,o=t-i,s=(e,t)=>{let r=Math.imul(e,374761393)+Math.imul(t,668265263)+Math.imul(n,1442695041);return r=Math.imul(r^r>>>13,1274126177),((r^r>>>16)>>>0)/4294967296},c=a*a*(3-2*a),l=o*o*(3-2*o),u=s(r,i),d=s(r+1,i),f=s(r,i+1),p=s(r+1,i+1);return(u*(1-c)+d*c)*(1-l)+(f*(1-c)+p*c)*l}function p(e,t,n){let r=f(e,t,n),i=f(e*2.15+13.7,t*2.15+7.3,n+101),a=f(e*4.4-5.2,t*4.4+19.1,n+307);return r*.55+i*.3+a*.15}function m(e,t,n,r,i=96,a=0,o=1){let s=[];for(let c=0;c<=i;c++){let l=c/i,u=1-l,d=u*u*u,p=3*u*u*l,m=3*u*l*l,h=l*l*l,g=d*e.x+p*t.x+m*n.x+h*r.x,_=d*e.y+p*t.y+m*n.y+h*r.y,v=3*u*u*(t.x-e.x)+6*u*l*(n.x-t.x)+3*l*l*(r.x-n.x),y=3*u*u*(t.y-e.y)+6*u*l*(n.y-t.y)+3*l*l*(r.y-n.y),b=Math.hypot(v,y)||1,x=-y/b,S=v/b;if(a>0){let e=(f(l*12,o*.29,o)-.5)*a*7.5;g+=x*e,_+=S*e}s.push({x:g,y:_,nx:x,ny:S,t:l})}return s}function h(e,t,n,r=72,i=0,a=1){let o=[];for(let s=0;s<=r;s++){let c=s/r,l=1-c,u=l*l*e.x+2*l*c*t.x+c*c*n.x,d=l*l*e.y+2*l*c*t.y+c*c*n.y,p=2*l*(t.x-e.x)+2*c*(n.x-t.x),m=2*l*(t.y-e.y)+2*c*(n.y-t.y),h=Math.hypot(p,m)||1,g=-m/h,_=p/h;if(i>0){let e=(f(c*10,a*.37,a)-.5)*i*6;u+=g*e,d+=_*e}o.push({x:u,y:d,nx:g,ny:_,t:c})}return o}function g(e,t,n,r,i,a,o=0,s=0,c=88,l=0,u=1){let d=[],p=Math.cos(o),m=Math.sin(o);for(let o=0;o<=c;o++){let h=o/c,g=i+(a-i)*h,_=1+s*(h-.5),v=Math.cos(g)*n*_,y=Math.sin(g)*r*_,b=e+v*p-y*m,x=t+v*m+y*p,S=a-i,C=-Math.sin(g)*n*_*S+Math.cos(g)*n*s,w=Math.cos(g)*r*_*S+Math.sin(g)*r*s,T=C*p-w*m,E=C*m+w*p,D=Math.hypot(T,E)||1,O=-E/D,k=T/D;if(l>0){let e=(f(h*11,u*.19,u)-.5)*l*6.5;b+=O*e,x+=k*e}d.push({x:b,y:x,nx:O,ny:k,t:h})}return d}function _(e,t=0,n=1){if(e.length<2)return[];let r=[e[0]];for(let t=1;t<e.length-1;t++){let n=e[t-1],i=e[t],a=e[t+1];r.push({x:n.x*.2+i.x*.6+a.x*.2,y:n.y*.2+i.y*.6+a.y*.2})}r.push(e[e.length-1]);let i=[0],a=0;for(let e=1;e<r.length;e++)a+=Math.hypot(r[e].x-r[e-1].x,r[e].y-r[e-1].y),i.push(a);let o=Math.max(1,a);return r.map((e,a)=>{let s=r[Math.max(0,a-1)],c=r[Math.min(r.length-1,a+1)],l=c.x-s.x,u=c.y-s.y,d=Math.hypot(l,u)||1,p=-u/d,m=l/d,h=i[a]/o,g=e.x,_=e.y;if(t>0){let e=(f(h*12,n*.31,n)-.5)*t*5;g+=p*e,_+=m*e}return{x:g,y:_,nx:p,ny:m,t:h}})}function v(e){let t=e.replace(`#`,``).trim();return t.length===3?[parseInt(t[0]+t[0],16)||0,parseInt(t[1]+t[1],16)||0,parseInt(t[2]+t[2],16)||0]:[parseInt(t.substring(0,2),16)||0,parseInt(t.substring(2,4),16)||0,parseInt(t.substring(4,6),16)||0]}function y(e,t){let[n,r,i]=v(e);return`rgba(${n}, ${r}, ${i}, ${Math.max(0,Math.min(1,t)).toFixed(3)})`}function b(e,t,n){let[r,i,a]=v(e),[o,s,c]=v(t),l=Math.max(0,Math.min(1,n)),u=Math.round(r+(o-r)*l),d=Math.round(i+(s-i)*l),f=Math.round(a+(c-a)*l);return`#${u.toString(16).padStart(2,`0`)}${d.toString(16).padStart(2,`0`)}${f.toString(16).padStart(2,`0`)}`}function x(e,t){let n=new ImageData(new Uint8ClampedArray(e.data),e.width,e.height),r=n.data,i=v(t.colors.inkPrimary),a=v(t.colors.energySecondary),o=v(t.colors.coreGlow),s=t.dynamics.glowIntensity,c=t.channelMode;for(let e=0;e<r.length;e+=4){let t=r[e+3];if(t<4)continue;let n=r[e]/255,l=r[e+1]/255,u=r[e+2]/255,d=.299*n+.587*l+.114*u,f=Math.max(n,l,u),p=Math.min(n,l,u),m=f-p,h=p**2.2,g=Math.min(1,Math.max(0,(m*2.1+Math.max(0,d-.18)*.9)*(1-h))),_=Math.max(0,1-g-h);c===`shader_rgb_mask`?(r[e]=Math.min(255,Math.round(_*255)),r[e+1]=Math.min(255,Math.round(g*255)),r[e+2]=Math.min(255,Math.round(h*255))):c===`ink_only`?(r[e]=i[0],r[e+1]=i[1],r[e+2]=i[2],r[e+3]=Math.round(t*Math.min(1,_*1.4))):c===`energy_only`?(r[e]=a[0],r[e+1]=a[1],r[e+2]=a[2],r[e+3]=Math.round(t*Math.min(1,(g+h)*1.35))):(r[e]=Math.min(255,Math.round(i[0]*_+a[0]*s*g+o[0]*h)),r[e+1]=Math.min(255,Math.round(i[1]*_+a[1]*s*g+o[1]*h)),r[e+2]=Math.min(255,Math.round(i[2]*_+a[2]*s*g+o[2]*h)))}return n}var S={classic_washi:{id:`classic_washi`,name:`Washi Clássico & Nanquim`,jp:`水墨山水`,romaji:`Suiboku Sansui`,subtitle:`Papel Washi envelhecido, nanquim tradicional e aguadas de carvão`,isDark:!1,colors:{background:`#EFECE4`,ink:`#181715`,wash:`#524E46`,mist:`#EFECE4`,accent:`#C8232C`}},jade_mineral:{id:`jade_mineral`,name:`Verde Mineral & Jade`,jp:`青緑山水`,romaji:`Seiryoku Sansui`,subtitle:`Estilo imperial com pigmento mineral verde-celadon nas encostas`,isDark:!1,colors:{background:`#EDE8DC`,ink:`#1A211E`,wash:`#527361`,mist:`#EDE8DC`,accent:`#3B6E52`}},night_obsidian:{id:`night_obsidian`,name:`Noite Obsidiana (Dark Mode)`,jp:`夜行山水`,romaji:`Yakō Sansui`,subtitle:`Céu noturno em carvão profundo com cristas iluminadas em marfim`,isDark:!0,colors:{background:`#141518`,ink:`#E8E2D5`,wash:`#2A2D34`,mist:`#141518`,accent:`#C8232C`}},crimson_dawn:{id:`crimson_dawn`,name:`Alvorada Carmesim`,jp:`暁山水`,romaji:`Akatsuki Sansui`,subtitle:`Bruma matinal aquecida por aguadas de vermelhão e cinza-pedra`,isDark:!1,colors:{background:`#F2ECE4`,ink:`#1D1817`,wash:`#944347`,mist:`#F2ECE4`,accent:`#C8232C`}},cobalt_porcelain:{id:`cobalt_porcelain`,name:`Azul Índigo & Porcelana`,jp:`藍染山水`,romaji:`Aizome Sansui`,subtitle:`Tons serenos de índigo oriental sobre papel de arroz claro`,isDark:!1,colors:{background:`#EDF0F2`,ink:`#101C29`,wash:`#3B5C7A`,mist:`#EDF0F2`,accent:`#1E4E79`}}},C=[{id:`panoramic_river`,name:`Horizonte Fluvial & Barco Solitário`,jp:`江湖遠景`,romaji:`Kōko Enkei`,ptMeaning:`Águas tranquilas que se estendem até o horizonte infinito`,description:`Grande espelho d’água com ondulações calmas, ilhas distantes na neblina, promontório rochoso em primeiro plano e pescador solitário.`},{id:`karst_peaks`,name:`Picos Escarpados & Abismo`,jp:`奇峰聳立`,romaji:`Kihō Shōritsu`,ptMeaning:`Picos extraordinários que se erguem com majestade acima das nuvens`,description:`Torres verticais dramáticas com fissuras de rocha Cunfa, pinheiros agarrados às escarpas e silhuetas fantasmas ao fundo.`},{id:`layered_valley`,name:`Vale das Cinco Neblinas`,jp:`重巒畳嶂`,romaji:`Jūran Jōshō`,ptMeaning:`Cordilheiras sobrepostas em harmonia profunda entre o céu e a terra`,description:`Cinco a sete camadas de colinas e montanhas entrelaçadas com aguada mineral, matas de pinheiros nas cristas e neblina nos vales.`},{id:`twin_gorges`,name:`Desfiladeiro Noturno & Travessia`,jp:`峡谷孤舟`,romaji:`Kyōkoku Koshū`,ptMeaning:`A travessia serena entre grandes paredes de rocha milenar`,description:`Picos imponentes flanqueando um canal profundo com ilha de pinheiros em primeiro plano, perfeito tanto em papel claro quanto no Modo Noturno.`}],w={fuji_sakura:{id:`fuji_sakura`,name:`Monte Fuji & Sakura Carmesim`,elementStyle:`Sumi-e Clássico · Sol & Cerejeira`,colors:{inkPrimary:`#141413`,energySecondary:`#C8232C`,coreGlow:`#FFF5F5`,sporeAccent:`#E11D48`}},calligraphy_tide:{id:`calligraphy_tide`,name:`Maré Caligráfica`,elementStyle:`Hidromancia · Tinta & Espuma`,colors:{inkPrimary:`#061320`,energySecondary:`#38BDF8`,coreGlow:`#F0F9FF`,sporeAccent:`#7DD3FC`}},fungal_emerald:{id:`fungal_emerald`,name:`Éter Fúngico & Esmeralda`,elementStyle:`Bio-Arcano · Referência`,colors:{inkPrimary:`#080D0A`,energySecondary:`#8BE36A`,coreGlow:`#F6FFF0`,sporeAccent:`#4ADE80`}},toxic_venom:{id:`toxic_venom`,name:`Veneno & Peçonha Ácida`,elementStyle:`Alquimia · Miasma Corrosivo`,colors:{inkPrimary:`#0E1708`,energySecondary:`#A3E635`,coreGlow:`#ECFCCB`,sporeAccent:`#84CC16`}},abyssal_curse:{id:`abyssal_curse`,name:`Maldição & Grilhão Abissal`,elementStyle:`Bruxaria · Sombra & Agonia`,colors:{inkPrimary:`#0F051D`,energySecondary:`#C026D3`,coreGlow:`#FAE8FF`,sporeAccent:`#9333EA`}},blood_shadow:{id:`blood_shadow`,name:`Sangue & Hemomancia`,elementStyle:`Vampírico · Corte Arterial`,colors:{inkPrimary:`#190408`,energySecondary:`#E11D48`,coreGlow:`#FFE4E6`,sporeAccent:`#9F1239`}},necro_phantom:{id:`necro_phantom`,name:`Necromancia & Fogo-Fátuo`,elementStyle:`Post-Mortem · Alma & Osso`,colors:{inkPrimary:`#091114`,energySecondary:`#2DD4BF`,coreGlow:`#F0FDFA`,sporeAccent:`#E2E8F0`}},capoeira_dende:{id:`capoeira_dende`,name:`Axé Solar & Dendê`,elementStyle:`Capoeira · Cinética & Fogo`,colors:{inkPrimary:`#1A0E07`,energySecondary:`#F59E0B`,coreGlow:`#FEF9C3`,sporeAccent:`#EA580C`}},abyssal_flame:{id:`abyssal_flame`,name:`Chama Abissal & Cinza`,elementStyle:`Pirocinese · Brasa & Fuligem`,colors:{inkPrimary:`#160706`,energySecondary:`#FF5331`,coreGlow:`#FFF6CC`,sporeAccent:`#F59E0B`}},celestial_thunder:{id:`celestial_thunder`,name:`Trovão Celestial`,elementStyle:`Eletromancia · Alta Voltagem`,colors:{inkPrimary:`#0B071E`,energySecondary:`#A855F7`,coreGlow:`#ECFEFF`,sporeAccent:`#22D3EE`}},astral_gold:{id:`astral_gold`,name:`Luz Astral & Ouro`,elementStyle:`Geomancia · Ordem Divina`,colors:{inkPrimary:`#171206`,energySecondary:`#FACC15`,coreGlow:`#FEFCE8`,sporeAccent:`#F59E0B`}}},T=[{id:`hyb_slash_great_wave_katana`,name:`Corte da Grande Onda (Katana Hokusai)`,category:`Ukiyo-e · Hokusai`,defaultSchool:`calligraphy_tide`,description:`Golpe em arco com 5 correntes listradas internas e clusters de garras de espuma na crista.`},{id:`sakura_tempest_slash`,name:`Tempestade de Sakura & Galho Sumi-e`,category:`Sumi-e · Cerejeira`,defaultSchool:`fuji_sakura`,description:`Fita de nanquim Kasure acompanhada por redemoinho de flores de cerejeira e pétalas S-Curve.`},{id:`hyb_slash_crimson_phoenix_arc`,name:`Talho da Fênix Carmesim (Odachi S-Curve)`,category:`Suibokuga · Fogo`,defaultSchool:`abyssal_flame`,description:`Coroa de pétalas de chama aquareladas em curva S com 5 paradas e fitas desprendidas.`},{id:`hyb_slash_blood_moon_scythe`,name:`Ceifa da Lua de Sangue (Foice 270°)`,category:`Sumi-e · Kasure`,defaultSchool:`blood_shadow`,description:`Varredura ampla de 270° com 28 filamentos individuais e ranhuras de pincel seco Flying-White.`},{id:`crescent`,name:`Meia-Lua Caligráfica Mestre`,category:`Sakuga · Slash`,defaultSchool:`fungal_emerald`,description:`Arquétipo mestre: aceleração explosiva nos 3 primeiros quadros e erosão celular FBM 2D.`},{id:`water_slash`,name:`Corte d’Água & Éter Fluido`,category:`Sakuga · Erosão`,defaultSchool:`calligraphy_tide`,description:`Serpenteio fluido com ondas de gancho externas e gotas centrífugas alongadas pela tangente.`},{id:`enso_sigil`,name:`Círculo Zen Ensō & Selo Solar`,category:`Sumi-e · Caligrafia`,defaultSchool:`fuji_sakura`,description:`Anel caligráfico traçado em gesto único de 325° com fenda orgânica onde as cerdas secam.`},{id:`elem_fire_meteor_bolide`,name:`Cometa Carmesim & Brasa Viva`,category:`Suibokuga · Fogo`,defaultSchool:`abyssal_flame`,description:`Esfera incandescente envolvida por línguas de chama e nuvens orientais.`},{id:`solid_ref_fumaca`,name:`Brisa de Nuvens & Neblina Oriental`,category:`Ukiyo-e · Kumo`,defaultSchool:`necro_phantom`,description:`Volutas ornamentais de neblina que serpenteiam pelo papel como vento.`},{id:`elem_water_healing_fountain`,name:`Fonte Cristalina Tarashikomi`,category:`Suibokuga · Aguada`,defaultSchool:`fungal_emerald`,description:`Manchas orgânicas de aquarela japonesa com borda de sangria de pigmento e correntes ascendentes.`},{id:`portal_abyssal_vortex`,name:`Portal & Vórtice Espiral Abissal`,category:`Arco Polar · Vórtice`,defaultSchool:`abyssal_curse`,description:`Braços espirais logarítmicos convergindo sobre núcleo abissal oclusivo e aguada Tarashikomi.`}],E={archetype:`hyb_slash_great_wave_katana`,school:`calligraphy_tide`,colors:{inkPrimary:`#081C2E`,energySecondary:`#38BDF8`,coreGlow:`#F0F9FF`,sporeAccent:`#0284C7`},bgMode:`washi`,channelMode:`composite`,brush:{bristleCount:24,strokeThickness:1.2,taperStart:.9,taperEnd:.95,dryBrushGap:.34,curvature:1,angle:0,arcSweep:1},dynamics:{splatterCount:28,splatterSpread:1.4,hookWaves:4,erosionStrength:.9,erosionScale:1.1,glowIntensity:1.35,colorOffset:1.15,jitterAmount:.3},rough:{roughness:1,bowing:.85,outlineWidth:1.5,fillStyle:`solid`,celSteps:3},totalFrames:16,fps:16,seed:8472,frameSize:128},D={sunIntensity:1,mountainIntensity:1,sakuraBranchIntensity:1,sakuraPetalsIntensity:1,waterReflectionIntensity:1,mistKumoIntensity:1},O=[{id:1,code:`TEC-01`,title:`PRNG Determinístico (Mulberry32) & Ruído Fractal FBM 2D`,subtitle:`Coerência temporal entre os 16 quadros sem cintilação (flicker) aleatória`,origin:`Fundação Matemática Procedural`,archetype:`crescent`,school:`fungal_emerald`,equations:[`Mulberry32: a = (seed | 0) + 0x6D2B79F5; distribuição uniforme em [0, 1)`,`Smoothstep Hermite: u = xf² · (3 - 2·xf), v = yf² · (3 - 2·yf)`,`FBM 3 Oitavas: 0.55·N(x,y,s) + 0.30·N(2.15x+13.7, 2.15y+7.3, s+101) + 0.15·N(4.4x-5.2, 4.4y+19.1, s+307)`],invariantsDo:[`Derivar semente deterministicamente por cerda: bristleSeed = config.seed + b * 73`,`Usar o mesmo seed nos 16 quadros para corroer exatamente as mesmas ilhas de tinta`],invariantsDont:[`JAMAIS chamar Math.random() dentro do loop de renderização de quadros`,`Proibido usar ruído de 1 única oitava para erosão de nanquim`],description:`Garante que cada cerda, gota e ilha de nanquim mantenha sua identidade física do quadro 1 ao 16 sem cintilação.`},{id:2,code:`TEC-02`,title:`Amostradores de Curvas Paramétricas (Arco Polar 3D Tilt & Bézier S-Curve)`,subtitle:`Geração de espinhas dorsais Point2D com vetores normais analíticos para espessura e camadas`,origin:`Cinemática Caligráfica & Espadas 2D`,archetype:`sakura_tempest_slash`,school:`capoeira_dende`,equations:[`Arco Polar 3D Tilt: r(t) = r0 · (1 + spiralFactor · (t - 0.5))`,`Bézier Cúbica: B(t) = (1-t)³P0 + 3(1-t)²tP1 + 3(1-t)t²P2 + t³P3`,`Vetor Normal Unitário: (nx, ny) = (-dy / ||B'(t)||, dx / ||B'(t)||)`],invariantsDo:[`Calcular derivada analítica (dx, dy) para normais contínuas sem degraus`,`Aplicar jitter orgânico multiplicando sampleNoise2D pelo vetor normal (nx, ny)`],invariantsDont:[`Proibido usar ctx.arc() nativo de largura constante para golpes caligráficos`],description:`Amostra espinhas dorsais de 60 a 110 pontos com normais analíticas que permitem separar o canal de Tinta do canal de Energia.`},{id:3,code:`TEC-03`,title:`Fita Caligráfica Multi-Cerdas Sumi-e com Efeito Kasure (Flying-White)`,subtitle:`Simulação de 10 a 38 filamentos individuais de pincel com pressão variável e ranhuras secas`,origin:`Pintura Caligráfica Japonesa Sumi-e`,archetype:`hyb_slash_blood_moon_scythe`,school:`blood_shadow`,equations:[`Posição da Cerda: u = (b / (bristleCount - 1)) * 2 - 1 ∈ [-1, 1]`,`Envelope de Pressão: E(t) = sin(min(1, 1.35·t) · π/2) · (1-t)^(0.35 + 1.15·taperEnd) · 1.65`,`Convergência na Lâmina: spread(t) = (1 - 0.72·t)^0.75`],invariantsDo:[`Construir cada segmento de cerda como polígono fechado preenchido com ctx.fill()`,`Incluir a gota arredondada de apoio inicial do pincel (roundHeadCap)`],invariantsDont:[`Proibido desenhar linha grossa única com ctx.lineWidth sem subdivisão em cerdas`],description:`Reproduz a abertura real das cerdas de bambu no golpe rápido, deixando trilhas brancas onde o papel Washi aparece.`},{id:4,code:`TEC-04`,title:`Erosão Celular Progressiva por Limiar de Ruído & Gotas Centrífugas`,subtitle:`Dissolução orgânica da tinta em ilhas isoladas de nanquim em vez de fade-out fantasma`,origin:`Animação 2D Tradicional de Efeitos (Sakuga VFX)`,archetype:`water_slash`,school:`calligraphy_tide`,equations:[`Attack Snap: headReach = min(1, 1 - (1 - frameNorm)^3.4)`,`Retração da Cauda: tailRetract = max(0, (frameNorm - 0.18) / 0.82)^1.55 * 0.78`,`Corte Celular: fbmNoise2D(...) < erosionProgress * 0.92 + tailBias - 0.18`],invariantsDo:[`Manter opacidade alta (0.85 a 1.0) enquanto corrói o polígono em ilhas orgânicas`,`Alongar gotas centrífugas na direção tangente + normal da velocidade`],invariantsDont:[`NUNCA desaparecer um golpe apenas reduzindo ctx.globalAlpha de 1 para 0`],description:`Preserva 100% de presença gráfica nos fragmentos restantes enquanto quebra a pincelada da cauda para a ponta.`},{id:5,code:`TEC-05`,title:`Pétalas de Chama Aquareladas em S-Curve com Estrias Fibrosas`,subtitle:`Síntese de fogo e pétalas orientais combinando línguas curvas sobrepostas e pontas saturadas`,origin:`Aquarela Oriental Suibokuga & Caligrafia de Fogo`,archetype:`hyb_slash_crimson_phoenix_arc`,school:`abyssal_flame`,equations:[`Envelope de Barriga: bellyEnv(t) = sin(t^0.58 · π) · (1 - t)^0.7 · 1.48`,`Assimetria Lateral: esquerda 1.0 · halfW, direita 0.88 · halfW`,`Gradiente Aquarelado de 5 Paradas: base clara (t=0) → meio energético → ponta escura nanquim (t=1)`],invariantsDo:[`Sobrepor pétalas em 2 a 3 camadas com estrias fibrosas internas`,`Adicionar fitas caligráficas desprendidas (wisps) subindo acima das pontas`],invariantsDont:[`Proibido desenhar fogo usando triângulos retos ou círculos borrados com shadowBlur`],description:`Na aquarela oriental Suibokuga, o pigmento escuro se acumula nas pontas e bordas superiores das pétalas em curva S.`},{id:6,code:`TEC-06`,title:`Cristas de Onda Ukiyo-e (Hokusai), Correntes Listradas & Garras de Espuma`,subtitle:`Síntese da Grande Onda de Kanagawa com faixas longitudinais e garras articuladas na crista`,origin:`Xilogravura Japonesa Ukiyo-e (Katsushika Hokusai)`,archetype:`hyb_slash_great_wave_katana`,school:`calligraphy_tide`,equations:[`Envelope Muscular da Vaga: waveEnv(t) = sin(t^0.55 · π · 0.92) · (1 - 0.35·t) + 0.35·(1 - t)`,`Correntes Longitudinais: 5 faixas paralelas em u ∈ [-0.72, +0.72] alternando coreGlow e inkPrimary`,`Garras de Espuma: clusters fractais na ponta (t=1.0) e no dorso (t=0.62)`],invariantsDo:[`Plantar 5 a 7 garras de espuma na crista e 3 no dorso contornadas a nanquim`,`Traçar as 5 faixas longitudinais internas acompanhando a barriga côncava da vaga`],invariantsDont:[`Proibido representar água apenas como círculos azuis translúcidos sem garras e listras`],description:`Divide qualquer efeito aquático nos 4 componentes anatômicos clássicos das xilogravuras de Hokusai.`},{id:7,code:`TEC-07`,title:`Bancos de Nuvens & Fumaça Ukiyo-e (Kumo) com Volutas em C-Hook`,subtitle:`Substituição total de esferas empilhadas por volutas ornamentais com cauda afilada e caracol interno`,origin:`Gravuras Tradicionais de Nuvens Ukiyo-e (Kumo)`,archetype:`solid_ref_fumaca`,school:`necro_phantom`,equations:[`Crista Superior Lobulada: lóbulo(t) = 0.58 + 0.42 · |sin(t · π · lobeCount)|`,`Envelope da Cauda Afilada: tailTaper(t) = sin(t^0.62 · π) · 1.28`,`Caracol Espiral C-Hook: ang = headAng + flip * (0.4 + u * π * 2.25), r = curlR * (0.92 - u * 0.76)`],invariantsDo:[`Desenhar sempre o caracol interno em C-Hook com traço mais espesso na cabeça e fino no centro`,`Agrupar de 3 a 6 volutas para formar bancos de neblina oriental ou fumaça vulcânica`],invariantsDont:[`PROIBIDO usar loops de ctx.arc() ou círculos empilhados ("cotton-ball smoke")`],description:`Constrói neblina do Monte Fuji e fumaça com cristas lobuladas superiores, caudas longas e caracóis internos duplos.`},{id:8,code:`TEC-08`,title:`Núcleo Sólido 100% Opaco com Oclusão Real & Línguas Envolventes`,subtitle:`Eliminação do aspecto de adesivo translúcido através de oclusão em 3 camadas (Cauda → Esfera → Abraço)`,origin:`Pintura de Projéteis & Meteoros Action RPG`,archetype:`elem_fire_meteor_bolide`,school:`abyssal_flame`,equations:[`Deformação do Núcleo: R(θ) = R0 · (1 + (fbmNoise2D(cos θ · 1.6, sin θ · 1.6, seed) - 0.5) · wobble)`,`Z-Order Estrito: Passo 1 (Cauda Traseira) → Passo 2 (Esfera Hex Alpha 1.0) → Passo 3 (Wrapping Tongues)`],invariantsDo:[`Garantir que todas as paradas do gradiente radial do núcleo tenham opacidade 1.0 (cores Hex puras)`,`Desenhar línguas frontais/laterais após a esfera opaca para abraçar o projétil`],invariantsDont:[`Nunca deixar linhas de cauda visíveis atravessando o interior da cabeça do cometa/meteoro`],description:`Opera em 3 passos estritos de Z-ordering para que o núcleo tenha massa sólida real integrada ao fluxo da cauda.`},{id:9,code:`TEC-09`,title:`Aguada Suibokuga (Tarashikomi) com Borda de Sangria de Pigmento`,subtitle:`Manchas orgânicas de aquarela japonesa onde o pigmento se concentra no anel externo úmido`,origin:`Pintura Rinpa & Suibokuga Japonesa (Tarashikomi)`,archetype:`elem_water_healing_fountain`,school:`fuji_sakura`,equations:[`Polígono Amebóide (32 vértices): r(θ) = rBase · (1 + (fbmNoise2D(...) - 0.5) · 0.34)`,`Gradiente Tarashikomi: stop 0.0 (alpha 0.42) → stop 0.68 (0.58) → stop 0.90 (0.74 pico úmido!) → stop 1.0 (0.0)`],invariantsDo:[`Aplicar a aguada Tarashikomi como camada atmosférica de base ou no disco solar carmesim`],invariantsDont:[`Proibido usar ctx.filter = "blur(12px)" que degrada a performance em tempo real`],description:`Simula o gotejamento de tinta sobre papel Washi úmido, empurrando o pigmento para a auréola externa ("water-bloom rim").`},{id:10,code:`TEC-10`,title:`Geometria Poligonal Sólida Hand-Made com Rough.js (Cristais & Facetas)`,subtitle:`Integração vetorial Rough.js para silhuetas desenhadas à mão, cristais chanfrados e hachuras`,origin:`Ilustração Hand-Crafted 2D & Cel-Shading Analógico`,archetype:`elem_water_glacial_spikes`,school:`calligraphy_tide`,equations:[`Bipartição Cel-Shaded: Polígono Esquerdo (coreGlow luz alta) + Polígono Direito (energySecondary sombra)`,`Rough.js Determinístico: seed = Math.max(1, Math.floor(config.seed + seedOffset))`],invariantsDo:[`Passar sempre seed inteiro determinístico no objeto Options do Rough.js`,`Permitir alternar fillStyle entre solid, hachure, cross-hatch e zigzag`],invariantsDont:[`Jamais chamar rc.polygon() ou rc.curve() sem definir explicitamente a propriedade seed`],description:`Cria cristais glaciais, rochas tectônicas e as facetas nevadas do Monte Fuji com traço duplo caligráfico.`},{id:11,code:`TEC-11`,title:`Shader de Recolorização por Separação de 3 Canais (Web, Godot 4 & Unity)`,subtitle:`Decomposição matemática em pesos de Tinta Abissal, Energia Elemental e Núcleo Branco`,origin:`Pipeline de Shaders para Engines de Jogos 2D`,archetype:`enso_sigil`,school:`astral_gold`,equations:[`Luminância Perceptual: L = 0.299·R + 0.587·G + 0.114·B`,`Pesos: W_core = (min(R,G,B))^2.2; W_energy = clamp(chroma*2.1 + max(0,L-0.18)*(1-W_core), 0, 1); W_ink = 1 - W_energy - W_core`,`Reconstrução: RGB_out = InkColor·W_ink + (EnergyColor·GlowBoost)·W_energy + CoreColor·W_core`],invariantsDo:[`Preservar o canal Alpha original e suportar exportação de máscara pura RGB (#FF0000, #00FF00, #0000FF)`],invariantsDont:[`Proibido usar multiplicação simples de cor (tint multiply) que apaga o brilho sobre o nanquim`],description:`Permite recolorir qualquer efeito ou textura instantaneamente para qualquer uma das Escolas de Magia.`},{id:12,code:`TEC-12`,title:`Pipeline de Composição Sprite Sheet 4×4 & Codificador Binário GIF89a LZW`,subtitle:`Renderização de grade 16 quadros com isolamento ctx.clip() e exportação GIF transparente nativa`,origin:`Engenharia de Exportação de Assets 2D`,archetype:`hyb_slash_great_wave_katana`,school:`calligraphy_tide`,equations:[`Mapeamento 4×4: col = frameIndex % 4, row = floor(frameIndex / 4)`,`Isolamento: ctx.rect(col*S, row*S, S, S) -> ctx.clip() -> ctx.translate(col*S, row*S)`,`GIF89a LZW: Graphics Control Extension (0x21 0xF9) com Disposal Method = 2 e índice transparente 255`],invariantsDo:[`Aplicar ctx.clip() estrito em cada célula antes de renderizar o quadro`,`Usar Disposal Method = 2 no GIF89a para não acumular rastro entre frames transparentes`],invariantsDont:[`Jamais deixar respingos centrífugos invadirem a célula vizinha da Sprite Sheet`],description:`Exporta grades 4×4 prontas para engines e GIFs animados transparentes sem dependências externas.`}];function k(e,t,n,r={}){let i=e.rough,a=e.colors;return{roughness:i.roughness*.65,bowing:i.bowing*.8,stroke:y(a.inkPrimary,.85),strokeWidth:Math.max(.45,i.outlineWidth*.6*t),fillStyle:i.fillStyle===`solid`?`solid`:i.fillStyle,fillWeight:Math.max(.4,i.outlineWidth*.38*t),hachureGap:Math.max(2.2,3.5*t),seed:Math.max(1,Math.floor(e.seed+n)),...r}}function A(e,t){let{spine:n,maxWidth:r,bristleCount:i,dryBrushGap:a,taperStart:o,taperEnd:s,color:c,alpha:l=1,offsetNormal:u=0,headReach:m=1,tailRetract:h=0,erosionProgress:g=0,erosionScale:_=1,hookWaves:v=0,roundHeadCap:b=!0,seed:x}=t;if(n.length<2||m<=h+.01)return;let S=Math.max(1,Math.min(44,Math.round(i)));if(e.save(),e.fillStyle=y(c,l),b&&h<.12&&g<.35){let t=n[Math.min(n.length-1,Math.floor(h*n.length))];if(t){let n=r*.28*(1-g*.6);e.beginPath(),e.arc(t.x+t.nx*u,t.y+t.ny*u,Math.max(1,n),0,Math.PI*2),e.fill()}}for(let t=0;t<S;t++){let i=x+t*73,c=d(i),l=S===1?0:t/(S-1)*2-1;if(Math.abs(l)>.18&&Math.abs(l)<.84&&c()<a*.55)continue;let y=(c()-.5)*.06,b=(c()-.5)*.08,C=Math.max(0,h+y),w=Math.min(1,m+b);if(w<=C+.02)continue;let T=r/S*(1.18+(c()-.5)*.45)*(1-Math.abs(l)*.22),E=[],D=[],O=!1,k=()=>{if(E.length>=2){e.beginPath(),e.moveTo(E[0].x,E[0].y);for(let t=1;t<E.length;t++)e.lineTo(E[t].x,E[t].y);for(let t=D.length-1;t>=0;t--)e.lineTo(D[t].x,D[t].y);e.closePath(),e.fill()}E=[],D=[],O=!1};for(let e=0;e<n.length;e++){let c=n[e];if(c.t<C||c.t>w){O&&k();continue}let d=Math.max(0,Math.min(1,(c.t-C)/Math.max(.001,w-C)));if(g>.02){let e=p(c.t*8.5*_+l*2.2,t*.35+x*.05,i),n=(1-d)*.35+Math.abs(l)*.18;if(e<g*.92+n-.18){O&&k();continue}}if(a>.05&&d>.35&&f(d*14,t*1.7,i+19)<a*(d-.25)*.85){O&&k();continue}let m=Math.min(1,d*4.5)**+Math.max(.15,1-o*.7),h=Math.max(0,1-d)**(.35+s*1.35),y=Math.sin(Math.min(1,d*1.35)*Math.PI*.5)*h*1.65+m*(1-d)*.85,b=.72+s*.27,S=Math.max(.005,1-d*b)**(.75+s*.65),A=v>0&&l>.25?Math.sin(d*Math.PI*v*2+t*.4)*r*.16*l*d:0,j=u+l*r*.52*S+Math.sin(d*Math.PI*3+t)*(a*2.2*S)+A,M=s>.8?.12*(1-d*.85):.4,N=Math.max(M,T*y*.55);E.push({x:c.x+c.nx*(j-N),y:c.y+c.ny*(j-N)}),D.push({x:c.x+c.nx*(j+N),y:c.y+c.ny*(j+N)}),O=!0}O&&k()}e.restore()}function j(e,t,n,r,i,a,o,s){if(t.length<4||r<=0)return;let c=d(s+991);e.save();for(let l=0;l<r;l++){let r=c()*.55;if(n<r)continue;let u=(n-r)/Math.max(.1,1-r);if(u>1)continue;let d=Math.min(t.length-2,Math.max(1,Math.floor(c()*(t.length-2)))),f=t[d],m=t[d+1],h=m.x-f.x,g=m.y-f.y,_=Math.hypot(h,g)||1,v=h/_,y=g/_,b=c()>.25?1:-1,x=(12+c()*28)*i*a,S=u**.72*x,C=v*.65+f.nx*b*(.45+c()*.5),w=y*.65+f.ny*b*(.45+c()*.5),T=Math.atan2(w,C),E=f.x+Math.cos(T)*S,D=f.y+Math.sin(T)*S,O=p(l*1.3,u*3.5,s+l*17);if(u>.65&&O<(u-.55)*1.8)continue;let k=(1.1+c()*2.4)*a*(1-u*.45),A=1.4+u*2.2*i,j=c();e.fillStyle=j<.52?o.inkPrimary:j<.85?o.energySecondary:o.coreGlow,e.save(),e.translate(E,D),e.rotate(T),e.beginPath(),e.ellipse(0,0,Math.max(.6,k*A),Math.max(.5,k*.65),0,0,Math.PI*2),e.fill(),e.restore()}e.restore()}function M(e,t,n,r,i){let{rootX:a,rootY:o,ctrl1X:s,ctrl1Y:c,ctrl2X:l,ctrl2Y:u,tipX:d,tipY:f,maxBellyWidth:p,striationCount:h=5,alpha:g=1,seed:_}=i,v=m({x:a,y:o},{x:s,y:c},{x:l,y:u},{x:d,y:f},48,n.dynamics.jitterAmount*.18,_),x=[],S=[];for(let e of v){let t=Math.sin(e.t**.58*Math.PI)*Math.max(0,1-e.t)**.7*1.48,n=p*.5*t;x.push([e.x-e.nx*n,e.y-e.ny*n*.92]),S.push([e.x+e.nx*n*.88,e.y+e.ny*n])}let C=[...x,...S.reverse()];e.save(),e.beginPath(),C.forEach(([t,n],r)=>{r===0?e.moveTo(t,n):e.lineTo(t,n)}),e.closePath();let w=e.createLinearGradient(a,o,d,f),T=n.colors;w.addColorStop(0,y(T.coreGlow,g)),w.addColorStop(.28,y(b(T.coreGlow,T.energySecondary,.35),g)),w.addColorStop(.68,y(T.energySecondary,g*.96)),w.addColorStop(.92,y(b(T.energySecondary,T.inkPrimary,.45),g*.95)),w.addColorStop(1,y(T.inkPrimary,g)),e.fillStyle=w,e.fill();for(let t=0;t<h;t++){let n=h===1?0:t/(h-1)*2-1;e.beginPath();for(let t=2;t<v.length-2;t+=2){let r=v[t],i=Math.sin(r.t**.58*Math.PI)*Math.max(0,1-r.t)**.7*1.48,a=n*.36*p*i,o=r.x+r.nx*a,s=r.y+r.ny*a;t===2?e.moveTo(o,s):e.lineTo(o,s)}e.strokeStyle=y(t%2==0?T.coreGlow:T.inkPrimary,g*(t%2==0?.5:.42)),e.lineWidth=Math.max(.5,.75*r),e.stroke()}if(t&&n.rough.outlineWidth>.1){let e=C.filter((e,t)=>t%3==0);t.polygon(e,k(n,r,_,{fill:void 0,stroke:y(T.inkPrimary,g*.85)}))}e.restore()}function N(e,t,n,r,i,a,o,s){let c=(t+r)*.5+(i-n)*.25,l=(n+i)*.5-(r-t)*.25;A(e,{spine:h({x:t,y:n},{x:c,y:l},{x:r,y:i},28,.2,s),maxWidth:a,bristleCount:6,dryBrushGap:.25,taperStart:.7,taperEnd:.95,color:o,roundHeadCap:!1,seed:s})}function P(e,t,n,r,i,a,o,s,c,l,u){let f=d(u),p=c.colors;e.save();for(let d=0;d<o;d++){let m=o===1?0:d/(o-1)*2-1,h=i+m*.65+(f()-.5)*.18,g=s*(.72+(1-Math.abs(m)*.35)*.52),_=n+Math.cos(h+a*.55)*g,v=r+Math.sin(h+a*.55)*g,b=Math.max(1.2,s*.22),x=-Math.sin(h)*b,S=Math.cos(h)*b,C=n+Math.cos(h)*g*.65,w=r+Math.sin(h)*g*.65;if(e.beginPath(),e.moveTo(n-x,r-S),e.quadraticCurveTo(C-x*.4,w-S*.4,_,v),e.quadraticCurveTo(C+x*.3,w+S*.3,n+x,r+S),e.closePath(),e.fillStyle=p.coreGlow,e.fill(),e.strokeStyle=y(p.inkPrimary,.88),e.lineWidth=Math.max(.65,.9*l*c.rough.outlineWidth*.65),e.stroke(),t&&c.rough.roughness>.2&&t.curve([[n-x,r-S],[C,w],[_,v]],k(c,l,u+d*31,{strokeWidth:Math.max(.5,.7*l)})),f()>.25){let t=g*(1.12+f()*.38),i=h+a*(.5+f()*.35),o=n+Math.cos(i)*t,s=r+Math.sin(i)*t,c=Math.max(.8,(1.1+f()*1.4)*l);e.beginPath(),e.arc(o,s,c,0,Math.PI*2),e.fillStyle=p.coreGlow,e.fill(),e.strokeStyle=p.inkPrimary,e.lineWidth=Math.max(.45,.6*l),e.stroke()}}e.restore()}function F(e,t,n,r,i,a,o,s,c,l){if(n.length<6)return;let u=o.colors,d=[],f=[];for(let e of n){let t=Math.sin(e.t**.55*Math.PI*.92)*(1-.35*e.t)+.35*(1-e.t),n=r*.48*t;d.push([e.x-e.nx*n,e.y-e.ny*n]),f.push([e.x+e.nx*n,e.y+e.ny*n])}e.save(),e.beginPath(),d.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n));for(let t=f.length-1;t>=0;t--)e.lineTo(f[t][0],f[t][1]);e.closePath();let p=n[0],m=n[n.length-1],h=e.createLinearGradient(p.x,p.y,m.x,m.y);h.addColorStop(0,y(u.inkPrimary,c*.95)),h.addColorStop(.55,y(u.energySecondary,c*.92)),h.addColorStop(1,y(u.coreGlow,c*.98)),e.fillStyle=h,e.fill();for(let t=0;t<5;t++){let i=t/4*1.44-.72,a=t%2==0;e.strokeStyle=y(a?u.coreGlow:u.inkPrimary,c*.84),e.lineWidth=Math.max(.7,(a?1.3:1)*s),e.beginPath();for(let t=1;t<n.length-2;t+=2){let a=n[t],o=Math.sin(a.t**.55*Math.PI*.92)*(1-a.t*.35)+(1-a.t)*.35,s=i*r*.38*o,c=a.x+a.nx*s,l=a.y+a.ny*s;t===1?e.moveTo(c,l):e.lineTo(c,l)}e.stroke()}let g=n[n.length-1],_=n[Math.max(0,n.length-3)],v=Math.atan2(g.y-_.y,g.x-_.x);P(e,t,g.x,g.y,v,i,a,r*.58,o,s,l+101);let b=n[Math.floor(n.length*.62)];if(b){let n=Math.atan2(b.ny*i,b.nx*i);P(e,t,b.x+b.nx*i*r*.32,b.y+b.ny*i*r*.32,n,i,Math.max(3,Math.floor(a*.65)),r*.42,o,s,l+203)}e.restore()}function I(e,t,n,r,i){let{startX:a,startY:o,endX:s,endY:c,maxThickness:l,lobeCount:u=3,curlRadius:d=l*.48,flip:f=1,alpha:p=.92,seed:h}=i,g=s-a,_=c-o,v=a+g*.32-_*.18*f,x=o+_*.32+g*.18*f,S=a+g*.72+_*.12*f,C=o+_*.72-g*.12*f,w=m({x:a,y:o},{x:v,y:x},{x:S,y:C},{x:s,y:c},44,n.dynamics.jitterAmount*.12,h),T=[],E=[];for(let e=0;e<w.length;e++){let t=w[e],n=t.t,r=.58+.42*Math.abs(Math.sin(n*Math.PI*u)),i=Math.sin(n**.62*Math.PI)*1.28,a=l*.62*r*i,o=l*.28*Math.sin(n*Math.PI);T.push([t.x+t.nx*f*a,t.y+t.ny*f*a]),E.push([t.x-t.nx*f*o,t.y-t.ny*f*o])}let D=n.colors;e.save(),e.beginPath(),T.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n));for(let t=E.length-1;t>=0;t--)e.lineTo(E[t][0],E[t][1]);e.closePath();let O=e.createLinearGradient(a,o,s,c);O.addColorStop(0,y(D.inkPrimary,p*.75)),O.addColorStop(.55,y(b(D.energySecondary,D.coreGlow,.45),p*.88)),O.addColorStop(1,y(D.coreGlow,p*.95)),e.fillStyle=O,e.fill(),e.strokeStyle=y(D.inkPrimary,p*.85),e.lineWidth=Math.max(.75,1.15*r*(n.rough.outlineWidth*.7)),e.stroke();let A=w[w.length-1],j=w[w.length-3],M=Math.atan2(A.y-j.y,A.x-j.x),N=A.x+A.nx*f*d*.35,P=A.y+A.ny*f*d*.35,F=[];for(let e=0;e<=22;e++){let t=e/22,n=M+f*(.4+t*Math.PI*2.25),r=d*(.92-t*.76);F.push([N+Math.cos(n)*r,P+Math.sin(n)*r])}e.beginPath(),F.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),e.strokeStyle=y(D.inkPrimary,p*.92),e.lineWidth=Math.max(.8,1.35*r),e.stroke(),t&&n.rough.outlineWidth>.2&&t.curve(F.filter((e,t)=>t%2==0),k(n,r,h+59,{stroke:y(D.inkPrimary,p*.82)})),e.restore()}function L(e,t,n,r,i,a,o,s,c,l){let u=d(l);for(let d=0;d<a;d++){let f=a===1?0:d/(a-1)*2-1,p=d%2==0?1:-1,m=n+f*i*.38-p*i*.22,h=r+(u()-.5)*i*.16;I(e,t,o,s,{startX:m,startY:h,endX:n+f*i*.38+p*i*.26,endY:h-i*.06*(1-Math.abs(f)*.5),maxThickness:i*(.22+(1-Math.abs(f)*.3)*.1),lobeCount:3,flip:p,alpha:c,seed:l+d*83})}}function R(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=Math.cos(o),m=Math.sin(o);for(let e=0;e<36;e++){let t=e/36*Math.PI*2,o=1+(p(Math.cos(t)*1.6,Math.sin(t)*1.6,u)-.5)*s,c=Math.cos(t)*i*o,l=Math.sin(t)*a*o;d.push([n+c*f-l*m,r+c*m+l*f])}let h=c.colors;e.save(),e.beginPath(),d.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),e.closePath(),e.globalAlpha=1,e.fillStyle=h.energySecondary,e.fill();let g=n+f*i*.32,_=r+m*i*.32,v=e.createRadialGradient(g,_,i*.08,n,r,Math.max(i,a)*1.05);v.addColorStop(0,`#FFFFFF`),v.addColorStop(.38,h.coreGlow),v.addColorStop(.75,h.energySecondary),v.addColorStop(1,b(h.inkPrimary,h.energySecondary,.35)),e.fillStyle=v,e.fill(),e.strokeStyle=h.inkPrimary,e.lineWidth=Math.max(1,1.5*l),e.stroke(),t&&c.rough.outlineWidth>.2&&t.polygon(d.filter((e,t)=>t%2==0),k(c,l,u+41,{fill:void 0,stroke:h.inkPrimary})),e.restore()}function z(e,t,n,r,i,a,o,s,c,l){let u=Math.cos(a),d=Math.sin(a);e.save(),e.beginPath();for(let a=0;a<=36;a++){let o=a/36*Math.PI*2,s=1+(p(Math.cos(o)*1.8+l*.1,Math.sin(o)*1.8,l)-.5)*.34,c=Math.cos(o)*r*s,f=Math.sin(o)*i*s,m=t+c*u-f*d,h=n+c*d+f*u;a===0?e.moveTo(m,h):e.lineTo(m,h)}e.closePath();let f=Math.max(1,Math.max(r,i)),m=e.createRadialGradient(t,n,Math.min(r,i)*.1,t,n,f);m.addColorStop(0,y(o,c*.42)),m.addColorStop(.68,y(s,c*.58)),m.addColorStop(.9,y(s,c*.78)),m.addColorStop(1,y(s,0)),e.fillStyle=m,e.fill(),e.restore()}function B(e,t,n,r,i,a,o,s,c,l){if(a<=1||o<=1)return;let u=Math.cos(i),d=Math.sin(i),f=-d,p=u,m=o*.5,h=a*.72,g=[n,r],_=[n+f*m,r+p*m],v=[n-f*m,r-p*m],x=[n+u*h+f*m*.82,r+d*h+p*m*.82],S=[n+u*h-f*m*.82,r+d*h-p*m*.82],C=[n+u*a,r+d*a],w=s.colors;e.save(),e.beginPath(),[g,_,x,C].forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),e.closePath(),e.fillStyle=w.coreGlow,e.fill(),e.beginPath(),[g,C,S,v].forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),e.closePath(),e.fillStyle=b(w.energySecondary,w.inkPrimary,.28),e.fill(),e.beginPath(),e.moveTo(g[0],g[1]),e.lineTo(C[0],C[1]),e.strokeStyle=`#FFFFFF`,e.lineWidth=Math.max(.8,1.2*c),e.stroke();let T=[_,x,C,S,v];t?t.polygon(T,k(s,c,l,{fill:s.rough.fillStyle===`solid`?void 0:y(w.inkPrimary,.25),stroke:w.inkPrimary,strokeWidth:Math.max(.9,s.rough.outlineWidth*.85*c)})):(e.beginPath(),T.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),e.closePath(),e.strokeStyle=w.inkPrimary,e.lineWidth=Math.max(.9,1.3*c),e.stroke()),e.restore()}function V(e,t,n,r,i,a,o,s,c=1,l=1){if(r<1||c<=.01)return;let u=d(l);e.save(),e.translate(t,n),e.rotate(i);for(let t=0;t<5;t++){let n=t/5*Math.PI*2+(u()-.5)*.08;e.save(),e.rotate(n);let i=r*(.88+u()*.22),l=i*.56;e.beginPath(),e.moveTo(0,0),e.bezierCurveTo(-l*.95,-i*.38,-l*.85,-i*.92,-l*.18,-i),e.lineTo(0,-i*.86),e.lineTo(l*.18,-i),e.bezierCurveTo(l*.85,-i*.92,l*.95,-i*.38,0,0),e.closePath();let d=e.createRadialGradient(0,-i*.25,i*.05,0,-i*.55,i*.95);d.addColorStop(0,y(o,c*.95)),d.addColorStop(.45,y(a,c*.94)),d.addColorStop(.88,y(b(a,s,.22),c*.98)),d.addColorStop(1,y(a,c*.9)),e.fillStyle=d,e.fill(),e.strokeStyle=y(b(a,s,.45),c*.55),e.lineWidth=Math.max(.4,r*.04),e.stroke(),e.restore()}for(let t=0;t<7;t++){let n=t/7*Math.PI*2+.2,i=r*(.26+t%2*.08),a=Math.cos(n)*i,s=Math.sin(n)*i;e.beginPath(),e.moveTo(0,0),e.lineTo(a,s),e.strokeStyle=y(o,c*.85),e.lineWidth=Math.max(.45,r*.045),e.stroke(),e.beginPath(),e.arc(a,s,Math.max(.6,r*.055),0,Math.PI*2),e.fillStyle=y(o,c*.95),e.fill()}e.restore()}function H(e,t,n,r,i,a,o,s=.92){e.save(),e.translate(t,n),e.rotate(i),e.scale(1,Math.max(.28,Math.min(1,a))),e.beginPath(),e.moveTo(-r*.5,0),e.bezierCurveTo(-r*.2,-r*.55,r*.45,-r*.48,r*.6,-r*.12),e.lineTo(r*.42,0),e.lineTo(r*.6,r*.12),e.bezierCurveTo(r*.45,r*.48,-r*.2,r*.55,-r*.5,0),e.closePath(),e.fillStyle=y(o,s),e.fill(),e.restore()}function U(e,t,n,r,i,a,o,s,c,l=.9,u=1){if(r<8||l<=.01)return;let f=d(u);e.save(),e.translate(t,n),e.rotate(i);let p=r*.5,h=Math.sin(a)*r*.11,g=-Math.cos(a)*r*.16,_=m({x:p,y:0},{x:p*.3,y:h},{x:-p*.35,y:g},{x:-p,y:h*.8},44,.05,u);e.save(),e.strokeStyle=y(o,l*.16),e.lineWidth=Math.max(.8,r*.012),e.beginPath(),e.ellipse(p*.15,0,r*.62,r*.24,0,0,Math.PI*2),e.stroke(),e.restore();let v=_[Math.floor(_.length*.24)];if(v)for(let t of[-1,1]){let n=Math.sin(a+t*.6)*.22,i=r*.28,s=Math.atan2(v.ny*t,v.nx*t)-.55+n;e.save(),e.translate(v.x,v.y),e.rotate(s),e.beginPath(),e.moveTo(0,0),e.quadraticCurveTo(i*.55,-i*.38*t,i,-i*.1*t),e.quadraticCurveTo(i*.45,i*.25*t,0,0),e.closePath(),e.fillStyle=y(c,l*.78),e.fill(),e.strokeStyle=y(o,l*.65),e.lineWidth=Math.max(.8,r*.012),e.stroke(),e.restore()}let b=_[_.length-1],x=_[_.length-4];if(b&&x){let t=Math.atan2(b.y-x.y,b.x-x.x),n=r*.34;for(let r of[-1,1]){let i=t+r*(.38+Math.sin(a*1.2)*.12);e.beginPath(),e.moveTo(b.x,b.y),e.quadraticCurveTo(b.x+Math.cos(i)*n*.65,b.y+Math.sin(i)*n*.65,b.x+Math.cos(i-r*.25)*n,b.y+Math.sin(i-r*.25)*n),e.quadraticCurveTo(b.x+Math.cos(t)*n*.4,b.y+Math.sin(t)*n*.4,b.x,b.y),e.fillStyle=y(r===1?s:o,l*.72),e.fill()}}let S=[],C=[],w=r*.23;for(let e of _){let t=e.t,n=t<.22?(t/.22)**.52:Math.max(.06,1-(t-.22)/.78)**.82,r=w*.5*n;S.push([e.x-e.nx*r,e.y-e.ny*r]),C.push([e.x+e.nx*r,e.y+e.ny*r])}e.beginPath(),S.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n));for(let t=C.length-1;t>=0;t--)e.lineTo(C[t][0],C[t][1]);e.closePath(),e.fillStyle=y(c,l*.95),e.fill(),e.save(),e.clip();let T=_[Math.floor(_.length*.16)],E=_[Math.floor(_.length*.48)],D=_[Math.floor(_.length*.72)];T&&z(e,T.x,T.y+(f()-.5)*w*.25,w*.55,w*.42,.3,s,s,l*.95,u+11),E&&z(e,E.x,E.y-w*.12,w*.62,w*.45,-.2,s,s,l*.9,u+23),D&&z(e,D.x,D.y,w*.42,w*.35,.1,o,o,l*.85,u+37),e.restore(),e.beginPath(),S.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n));for(let t=C.length-1;t>=0;t--)e.lineTo(C[t][0],C[t][1]);e.closePath(),e.strokeStyle=y(o,l*.88),e.lineWidth=Math.max(1.1,r*.018),e.stroke();let O=_.slice(Math.floor(_.length*.26),Math.floor(_.length*.76));O.length>=4&&A(e,{spine:O.map((e,t,n)=>({...e,t:t/Math.max(1,n.length-1)})),maxWidth:r*.065,bristleCount:6,dryBrushGap:.25,taperStart:.4,taperEnd:.9,color:o,alpha:l*.85,roundHeadCap:!1,seed:u+71});let k=_[1];if(k)for(let t of[-1,1])e.beginPath(),e.arc(k.x-r*.03,k.y+t*w*.22,Math.max(1.1,r*.016),0,Math.PI*2),e.fillStyle=y(o,l),e.fill(),e.beginPath(),e.moveTo(p*.96,t*w*.1),e.quadraticCurveTo(p*1.08,t*w*.28,p*1.02,t*w*.42),e.strokeStyle=y(o,l*.78),e.lineWidth=Math.max(.8,r*.011),e.stroke();e.restore()}function W(e,t,n,r,i,a,o,s,c,l,u,f,p){if(s<=.02)return;let g=d(p),_=r-t,v=i-n,y=Math.sin(c*.9+p)*5,b=Math.cos(c*.75+p)*4,x=m({x:t,y:n},{x:t+_*.35-v*.18*a,y:n+v*.35+_*.12*a},{x:t+_*.7+v*.12*a+y*.5,y:n+v*.7-_*.1*a+b*.5},{x:r+y,y:i+b},68,.26,p);A(e,{spine:x,maxWidth:o,bristleCount:22,dryBrushGap:.28,taperStart:.1,taperEnd:.99,color:l,alpha:.94,headReach:s,roundHeadCap:!0,seed:p+13});let S=[.32,.62],C=[x];S.forEach((t,n)=>{if(s<=t+.08)return;let r=Math.min(1,(s-t)/(1-t)),i=x[Math.floor(t*(x.length-1))];if(!i)return;let c=n%2==0?a:-a,u=Math.hypot(_,v)*(.42-n*.08),d=Math.atan2(v,_)+c*.58,f=i.x+Math.cos(d)*u+y*.8,m=i.y+Math.sin(d)*u+b*.8,g=h({x:i.x,y:i.y},{x:(i.x+f)*.5+c*14,y:(i.y+m)*.5-12},{x:f,y:m},40,.22,p+50+n*19);C.push(g),A(e,{spine:g,maxWidth:o*.52,bristleCount:12,dryBrushGap:.26,taperStart:.12,taperEnd:.99,color:l,alpha:.92,headReach:r,roundHeadCap:!1,seed:p+70+n*19})}),C.forEach((t,n)=>{let r=n===0?14:8;for(let i=0;i<r;i++){let a=.14+i/Math.max(1,r-1)*.84;if(a>s)continue;let d=Math.min(1,(s-a*.72)*2.8);if(d<=.05)continue;let m=t[Math.min(t.length-1,Math.floor(a*(t.length-1)))],h=1-a*.55,_=(g()-.45)*o*1.1*h,v=m.x+m.nx*_+Math.sin(c*1.3+i)*1.5,y=m.y+m.ny*_+Math.cos(c*1.1+i)*1.5,b=(o*.42+g()*o*.34)*d;V(e,v,y,Math.max(4,b),i*.8+n+Math.sin(c+i)*.08,u,f,l,.95,p+200+n*50+i)}})}function G(e,t,n){if(e&&e.length){let[r,i]=t,a=Math.PI/180*n,o=Math.cos(a),s=Math.sin(a);for(let t of e){let[e,n]=t;t[0]=(e-r)*o-(n-i)*s+r,t[1]=(e-r)*s+(n-i)*o+i}}}function K(e,t){return e[0]===t[0]&&e[1]===t[1]}function q(e,t,n,r=1){let i=n,a=Math.max(t,.1),o=e[0]&&e[0][0]&&typeof e[0][0]==`number`?[e]:e,s=[0,0];if(i)for(let e of o)G(e,s,i);let c=function(e,t,n){let r=[];for(let t of e){let e=[...t];K(e[0],e[e.length-1])||e.push([e[0][0],e[0][1]]),e.length>2&&r.push(e)}let i=[];t=Math.max(t,.1);let a=[];for(let e of r)for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n[1]!==r[1]){let e=Math.min(n[1],r[1]);a.push({ymin:e,ymax:Math.max(n[1],r[1]),x:e===n[1]?n[0]:r[0],islope:(r[0]-n[0])/(r[1]-n[1])})}}if(a.sort(((e,t)=>e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax))),!a.length)return i;let o=[],s=a[0].ymin,c=0;for(;o.length||a.length;){if(a.length){let e=-1;for(let t=0;t<a.length&&!(a[t].ymin>s);t++)e=t;a.splice(0,e+1).forEach((e=>{o.push({s,edge:e})}))}if(o=o.filter((e=>!(e.edge.ymax<=s))),o.sort(((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x))),(n!==1||c%t==0)&&o.length>1)for(let e=0;e<o.length;e+=2){let t=e+1;if(t>=o.length)break;let n=o[e].edge,r=o[t].edge;i.push([[Math.round(n.x),s],[Math.round(r.x),s]])}s+=n,o.forEach((e=>{e.edge.x=e.edge.x+n*e.edge.islope})),c++}return i}(o,a,r);if(i){for(let e of o)G(e,s,-i);(function(e,t,n){let r=[];e.forEach((e=>r.push(...e))),G(r,t,n)})(c,s,-i)}return c}function J(e,t){let n=t.hachureAngle+90,r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.round(Math.max(r,.1));let i=1;return t.roughness>=1&&(t.randomizer?.next()||Math.random())>.7&&(i=r),q(e,r,n,i||1)}var Y=class{constructor(e){this.helper=e}fillPolygons(e,t){return this._fillPolygons(e,t)}_fillPolygons(e,t){let n=J(e,t);return{type:`fillSketch`,ops:this.renderLines(n,t)}}renderLines(e,t){let n=[];for(let r of e)n.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],t));return n}};function ee(e){let t=e[0],n=e[1];return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}var te=class extends Y{fillPolygons(e,t){let n=t.hachureGap;n<0&&(n=4*t.strokeWidth),n=Math.max(n,.1);let r=J(e,Object.assign({},t,{hachureGap:n})),i=Math.PI/180*t.hachureAngle,a=[],o=.5*n*Math.cos(i),s=.5*n*Math.sin(i);for(let[e,t]of r)ee([e,t])&&a.push([[e[0]-o,e[1]+s],[...t]],[[e[0]+o,e[1]-s],[...t]]);return{type:`fillSketch`,ops:this.renderLines(a,t)}}},ne=class extends Y{fillPolygons(e,t){let n=this._fillPolygons(e,t),r=Object.assign({},t,{hachureAngle:t.hachureAngle+90}),i=this._fillPolygons(e,r);return n.ops=n.ops.concat(i.ops),n}},re=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=J(e,t=Object.assign({},t,{hachureAngle:0}));return this.dotsOnLines(n,t)}dotsOnLines(e,t){let n=[],r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.max(r,.1);let i=t.fillWeight;i<0&&(i=t.strokeWidth/2);let a=r/4;for(let o of e){let e=ee(o),s=e/r,c=Math.ceil(s)-1,l=e-c*r,u=(o[0][0]+o[1][0])/2-r/4,d=Math.min(o[0][1],o[1][1]);for(let e=0;e<c;e++){let o=d+l+e*r,s=u-a+2*Math.random()*a,c=o-a+2*Math.random()*a,f=this.helper.ellipse(s,c,i,i,t);n.push(...f.ops)}}return{type:`fillSketch`,ops:n}}},ie=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=J(e,t);return{type:`fillSketch`,ops:this.dashedLine(n,t)}}dashedLine(e,t){let n=t.dashOffset<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashOffset,r=t.dashGap<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashGap,i=[];return e.forEach((e=>{let a=ee(e),o=Math.floor(a/(n+r)),s=(a+r-o*(n+r))/2,c=e[0],l=e[1];c[0]>l[0]&&(c=e[1],l=e[0]);let u=Math.atan((l[1]-c[1])/(l[0]-c[0]));for(let e=0;e<o;e++){let a=e*(n+r),o=a+n,l=[c[0]+a*Math.cos(u)+s*Math.cos(u),c[1]+a*Math.sin(u)+s*Math.sin(u)],d=[c[0]+o*Math.cos(u)+s*Math.cos(u),c[1]+o*Math.sin(u)+s*Math.sin(u)];i.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],t))}})),i}},ae=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=t.hachureGap<0?4*t.strokeWidth:t.hachureGap,r=t.zigzagOffset<0?n:t.zigzagOffset,i=J(e,t=Object.assign({},t,{hachureGap:n+r}));return{type:`fillSketch`,ops:this.zigzagLines(i,r,t)}}zigzagLines(e,t,n){let r=[];return e.forEach((e=>{let i=ee(e),a=Math.round(i/(2*t)),o=e[0],s=e[1];o[0]>s[0]&&(o=e[1],s=e[0]);let c=Math.atan((s[1]-o[1])/(s[0]-o[0]));for(let e=0;e<a;e++){let i=2*e*t,a=2*(e+1)*t,s=Math.sqrt(2*t**2),l=[o[0]+i*Math.cos(c),o[1]+i*Math.sin(c)],u=[o[0]+a*Math.cos(c),o[1]+a*Math.sin(c)],d=[l[0]+s*Math.cos(c+Math.PI/4),l[1]+s*Math.sin(c+Math.PI/4)];r.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],n),...this.helper.doubleLineOps(d[0],d[1],u[0],u[1],n))}})),r}},X={},oe=class{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},se=0,ce=1,le=2,ue={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function de(e,t){return e.type===t}function fe(e){let t=[],n=function(e){let t=[];for(;e!==``;)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:se,text:RegExp.$1},e=e.substr(RegExp.$1.length);else{if(!e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];t[t.length]={type:ce,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length)}return t[t.length]={type:le,text:``},t}(e),r=`BOD`,i=0,a=n[i];for(;!de(a,le);){let o=0,s=[];if(r===`BOD`){if(a.text!==`M`&&a.text!==`m`)return fe(`M0,0`+e);i++,o=ue[a.text],r=a.text}else de(a,ce)?o=ue[r]:(i++,o=ue[a.text],r=a.text);if(!(i+o<n.length))throw Error(`Path data ended short`);for(let e=i;e<i+o;e++){let t=n[e];if(!de(t,ce))throw Error(`Param not a number: `+r+`,`+t.text);s[s.length]=+t.text}if(typeof ue[r]!=`number`)throw Error(`Bad segment: `+r);{let e={key:r,data:s};t.push(e),i+=o,a=n[i],r===`M`&&(r=`L`),r===`m`&&(r=`l`)}}return t}function pe(e){let t=0,n=0,r=0,i=0,a=[];for(let{key:o,data:s}of e)switch(o){case`M`:a.push({key:`M`,data:[...s]}),[t,n]=s,[r,i]=s;break;case`m`:t+=s[0],n+=s[1],a.push({key:`M`,data:[t,n]}),r=t,i=n;break;case`L`:a.push({key:`L`,data:[...s]}),[t,n]=s;break;case`l`:t+=s[0],n+=s[1],a.push({key:`L`,data:[t,n]});break;case`C`:a.push({key:`C`,data:[...s]}),t=s[4],n=s[5];break;case`c`:{let e=s.map(((e,r)=>r%2?e+n:e+t));a.push({key:`C`,data:e}),t=e[4],n=e[5];break}case`Q`:a.push({key:`Q`,data:[...s]}),t=s[2],n=s[3];break;case`q`:{let e=s.map(((e,r)=>r%2?e+n:e+t));a.push({key:`Q`,data:e}),t=e[2],n=e[3];break}case`A`:a.push({key:`A`,data:[...s]}),t=s[5],n=s[6];break;case`a`:t+=s[5],n+=s[6],a.push({key:`A`,data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case`H`:a.push({key:`H`,data:[...s]}),t=s[0];break;case`h`:t+=s[0],a.push({key:`H`,data:[t]});break;case`V`:a.push({key:`V`,data:[...s]}),n=s[0];break;case`v`:n+=s[0],a.push({key:`V`,data:[n]});break;case`S`:a.push({key:`S`,data:[...s]}),t=s[2],n=s[3];break;case`s`:{let e=s.map(((e,r)=>r%2?e+n:e+t));a.push({key:`S`,data:e}),t=e[2],n=e[3];break}case`T`:a.push({key:`T`,data:[...s]}),t=s[0],n=s[1];break;case`t`:t+=s[0],n+=s[1],a.push({key:`T`,data:[t,n]});break;case`Z`:case`z`:a.push({key:`Z`,data:[]}),t=r,n=i}return a}function me(e){let t=[],n=``,r=0,i=0,a=0,o=0,s=0,c=0;for(let{key:l,data:u}of e){switch(l){case`M`:t.push({key:`M`,data:[...u]}),[r,i]=u,[a,o]=u;break;case`C`:t.push({key:`C`,data:[...u]}),r=u[4],i=u[5],s=u[2],c=u[3];break;case`L`:t.push({key:`L`,data:[...u]}),[r,i]=u;break;case`H`:r=u[0],t.push({key:`L`,data:[r,i]});break;case`V`:i=u[0],t.push({key:`L`,data:[r,i]});break;case`S`:{let e=0,a=0;n===`C`||n===`S`?(e=r+(r-s),a=i+(i-c)):(e=r,a=i),t.push({key:`C`,data:[e,a,...u]}),s=u[0],c=u[1],r=u[2],i=u[3];break}case`T`:{let[e,a]=u,o=0,l=0;n===`Q`||n===`T`?(o=r+(r-s),l=i+(i-c)):(o=r,l=i);let d=r+2*(o-r)/3,f=i+2*(l-i)/3,p=e+2*(o-e)/3,m=a+2*(l-a)/3;t.push({key:`C`,data:[d,f,p,m,e,a]}),s=o,c=l,r=e,i=a;break}case`Q`:{let[e,n,a,o]=u,l=r+2*(e-r)/3,d=i+2*(n-i)/3,f=a+2*(e-a)/3,p=o+2*(n-o)/3;t.push({key:`C`,data:[l,d,f,p,a,o]}),s=e,c=n,r=a,i=o;break}case`A`:{let e=Math.abs(u[0]),n=Math.abs(u[1]),a=u[2],o=u[3],s=u[4],c=u[5],l=u[6];e===0||n===0?(t.push({key:`C`,data:[r,i,c,l,c,l]}),r=c,i=l):(r!==c||i!==l)&&(ge(r,i,c,l,e,n,a,o,s).forEach((function(e){t.push({key:`C`,data:e})})),r=c,i=l);break}case`Z`:t.push({key:`Z`,data:[]}),r=a,i=o}n=l}return t}function he(e,t,n){return[e*Math.cos(n)-t*Math.sin(n),e*Math.sin(n)+t*Math.cos(n)]}function ge(e,t,n,r,i,a,o,s,c,l){let u=(d=o,Math.PI*d/180);var d;let f=[],p=0,m=0,h=0,g=0;if(l)[p,m,h,g]=l;else{[e,t]=he(e,t,-u),[n,r]=he(n,r,-u);let o=(e-n)/2,l=(t-r)/2,d=o*o/(i*i)+l*l/(a*a);d>1&&(d=Math.sqrt(d),i*=d,a*=d);let f=i*i,_=a*a,v=f*_-f*l*l-_*o*o,y=f*l*l+_*o*o,b=(s===c?-1:1)*Math.sqrt(Math.abs(v/y));h=b*i*l/a+(e+n)/2,g=b*-a*o/i+(t+r)/2,p=Math.asin(parseFloat(((t-g)/a).toFixed(9))),m=Math.asin(parseFloat(((r-g)/a).toFixed(9))),e<h&&(p=Math.PI-p),n<h&&(m=Math.PI-m),p<0&&(p=2*Math.PI+p),m<0&&(m=2*Math.PI+m),c&&p>m&&(p-=2*Math.PI),!c&&m>p&&(m-=2*Math.PI)}let _=m-p;if(Math.abs(_)>120*Math.PI/180){let e=m,t=n,s=r;m=c&&m>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=ge(n=h+i*Math.cos(m),r=g+a*Math.sin(m),t,s,i,a,o,0,c,[m,e,h,g])}_=m-p;let v=Math.cos(p),y=Math.sin(p),b=Math.cos(m),x=Math.sin(m),S=Math.tan(_/4),C=4/3*i*S,w=4/3*a*S,T=[e,t],E=[e+C*y,t-w*v],D=[n+C*x,r-w*b],O=[n,r];if(E[0]=2*T[0]-E[0],E[1]=2*T[1]-E[1],l)return[E,D,O].concat(f);{f=[E,D,O].concat(f);let e=[];for(let t=0;t<f.length;t+=3){let n=he(f[t][0],f[t][1],u),r=he(f[t+1][0],f[t+1][1],u),i=he(f[t+2][0],f[t+2][1],u);e.push([n[0],n[1],r[0],r[1],i[0],i[1]])}return e}}var _e={randOffset:function(e,t){return Z(e,t)},randOffsetWithRange:function(e,t,n){return Ae(e,t,n)},ellipse:function(e,t,n,r,i){return Ce(e,t,i,Se(n,r,i)).opset},doubleLineOps:function(e,t,n,r,i){return Q(e,t,n,r,i,!0)}};function ve(e,t,n,r,i){return{type:`path`,ops:Q(e,t,n,r,i)}}function ye(e,t,n){let r=(e||[]).length;if(r>2){let i=[];for(let t=0;t<r-1;t++)i.push(...Q(e[t][0],e[t][1],e[t+1][0],e[t+1][1],n));return t&&i.push(...Q(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:`path`,ops:i}}return r===2?ve(e[0][0],e[0][1],e[1][0],e[1][1],n):{type:`path`,ops:[]}}function be(e,t,n,r,i){return function(e,t){return ye(e,!0,t)}([[e,t],[e+n,t],[e+n,t+r],[e,t+r]],i)}function xe(e,t){if(e.length){let n=typeof e[0][0]==`number`?[e]:e,r=Me(n[0],1*(1+.2*t.roughness),t),i=t.disableMultiStroke?[]:Me(n[0],1.5*(1+.22*t.roughness),Oe(t));for(let e=1;e<n.length;e++){let a=n[e];if(a.length){let e=Me(a,1*(1+.2*t.roughness),t),n=t.disableMultiStroke?[]:Me(a,1.5*(1+.22*t.roughness),Oe(t));for(let t of e)t.op!==`move`&&r.push(t);for(let e of n)e.op!==`move`&&i.push(e)}}return{type:`path`,ops:r.concat(i)}}return{type:`path`,ops:[]}}function Se(e,t,n){let r=Math.sqrt(2*Math.PI*Math.sqrt(((e/2)**2+(t/2)**2)/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),a=2*Math.PI/i,o=Math.abs(e/2),s=Math.abs(t/2),c=1-n.curveFitting;return o+=Z(o*c,n),s+=Z(s*c,n),{increment:a,rx:o,ry:s}}function Ce(e,t,n,r){let[i,a]=Pe(r.increment,e,t,r.rx,r.ry,1,r.increment*Ae(.1,Ae(.4,1,n),n),n),o=Ne(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[i]=Pe(r.increment,e,t,r.rx,r.ry,1.5,0,n),a=Ne(i,null,n);o=o.concat(a)}return{estimatedPoints:a,opset:{type:`path`,ops:o}}}function we(e,t,n,r,i,a,o,s,c){let l=e,u=t,d=Math.abs(n/2),f=Math.abs(r/2);d+=Z(.01*d,c),f+=Z(.01*f,c);let p=i,m=a;for(;p<0;)p+=2*Math.PI,m+=2*Math.PI;m-p>2*Math.PI&&(p=0,m=2*Math.PI);let h=2*Math.PI/c.curveStepCount,g=Math.min(h/2,(m-p)/2),_=Fe(g,l,u,d,f,p,m,1,c);if(!c.disableMultiStroke){let e=Fe(g,l,u,d,f,p,m,1.5,c);_.push(...e)}return o&&(s?_.push(...Q(l,u,l+d*Math.cos(p),u+f*Math.sin(p),c),...Q(l,u,l+d*Math.cos(m),u+f*Math.sin(m),c)):_.push({op:`lineTo`,data:[l,u]},{op:`lineTo`,data:[l+d*Math.cos(p),u+f*Math.sin(p)]})),{type:`path`,ops:_}}function Te(e,t){let n=me(pe(fe(e))),r=[],i=[0,0],a=[0,0];for(let{key:e,data:o}of n)switch(e){case`M`:a=[o[0],o[1]],i=[o[0],o[1]];break;case`L`:r.push(...Q(a[0],a[1],o[0],o[1],t)),a=[o[0],o[1]];break;case`C`:{let[e,n,i,s,c,l]=o;r.push(...Ie(e,n,i,s,c,l,a,t)),a=[c,l];break}case`Z`:r.push(...Q(a[0],a[1],i[0],i[1],t)),a=[i[0],i[1]]}return{type:`path`,ops:r}}function Ee(e,t){let n=[];for(let r of e)if(r.length){let e=t.maxRandomnessOffset||0,i=r.length;if(i>2){n.push({op:`move`,data:[r[0][0]+Z(e,t),r[0][1]+Z(e,t)]});for(let a=1;a<i;a++)n.push({op:`lineTo`,data:[r[a][0]+Z(e,t),r[a][1]+Z(e,t)]})}}return{type:`fillPath`,ops:n}}function De(e,t){return function(e,t){let n=e.fillStyle||`hachure`;if(!X[n])switch(n){case`zigzag`:X[n]||(X[n]=new te(t));break;case`cross-hatch`:X[n]||(X[n]=new ne(t));break;case`dots`:X[n]||(X[n]=new re(t));break;case`dashed`:X[n]||(X[n]=new ie(t));break;case`zigzag-line`:X[n]||(X[n]=new ae(t));break;default:n=`hachure`,X[n]||(X[n]=new Y(t))}return X[n]}(t,_e).fillPolygons(e,t)}function Oe(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function ke(e){return e.randomizer||=new oe(e.seed||0),e.randomizer.next()}function Ae(e,t,n,r=1){return n.roughness*r*(ke(n)*(t-e)+e)}function Z(e,t,n=1){return Ae(-e,e,t,n)}function Q(e,t,n,r,i,a=!1){let o=a?i.disableMultiStrokeFill:i.disableMultiStroke,s=je(e,t,n,r,i,!0,!1);if(o)return s;let c=je(e,t,n,r,i,!0,!0);return s.concat(c)}function je(e,t,n,r,i,a,o){let s=(e-n)**2+(t-r)**2,c=Math.sqrt(s),l=1;l=c<200?1:c>500?.4:-.0016668*c+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>s&&(u=c/10);let d=u/2,f=.2+.2*ke(i),p=i.bowing*i.maxRandomnessOffset*(r-t)/200,m=i.bowing*i.maxRandomnessOffset*(e-n)/200;p=Z(p,i,l),m=Z(m,i,l);let h=[],g=()=>Z(d,i,l),_=()=>Z(u,i,l),v=i.preserveVertices;return a&&(o?h.push({op:`move`,data:[e+(v?0:g()),t+(v?0:g())]}):h.push({op:`move`,data:[e+(v?0:Z(u,i,l)),t+(v?0:Z(u,i,l))]})),o?h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+g(),m+t+(r-t)*f+g(),p+e+2*(n-e)*f+g(),m+t+2*(r-t)*f+g(),n+(v?0:g()),r+(v?0:g())]}):h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+_(),m+t+(r-t)*f+_(),p+e+2*(n-e)*f+_(),m+t+2*(r-t)*f+_(),n+(v?0:_()),r+(v?0:_())]}),h}function Me(e,t,n){if(!e.length)return[];let r=[];r.push([e[0][0]+Z(t,n),e[0][1]+Z(t,n)]),r.push([e[0][0]+Z(t,n),e[0][1]+Z(t,n)]);for(let i=1;i<e.length;i++)r.push([e[i][0]+Z(t,n),e[i][1]+Z(t,n)]),i===e.length-1&&r.push([e[i][0]+Z(t,n),e[i][1]+Z(t,n)]);return Ne(r,null,n)}function Ne(e,t,n){let r=e.length,i=[];if(r>3){let a=[],o=1-n.curveTightness;i.push({op:`move`,data:[e[1][0],e[1][1]]});for(let t=1;t+2<r;t++){let n=e[t];a[0]=[n[0],n[1]],a[1]=[n[0]+(o*e[t+1][0]-o*e[t-1][0])/6,n[1]+(o*e[t+1][1]-o*e[t-1][1])/6],a[2]=[e[t+1][0]+(o*e[t][0]-o*e[t+2][0])/6,e[t+1][1]+(o*e[t][1]-o*e[t+2][1])/6],a[3]=[e[t+1][0],e[t+1][1]],i.push({op:`bcurveTo`,data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(t&&t.length===2){let e=n.maxRandomnessOffset;i.push({op:`lineTo`,data:[t[0]+Z(e,n),t[1]+Z(e,n)]})}}else r===3?(i.push({op:`move`,data:[e[1][0],e[1][1]]}),i.push({op:`bcurveTo`,data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&i.push(...je(e[0][0],e[0][1],e[1][0],e[1][1],n,!0,!0));return i}function Pe(e,t,n,r,i,a,o,s){let c=[],l=[];if(s.roughness===0){e/=4,l.push([t+r*Math.cos(-e),n+i*Math.sin(-e)]);for(let a=0;a<=2*Math.PI;a+=e){let e=[t+r*Math.cos(a),n+i*Math.sin(a)];c.push(e),l.push(e)}l.push([t+r*Math.cos(0),n+i*Math.sin(0)]),l.push([t+r*Math.cos(e),n+i*Math.sin(e)])}else{let u=Z(.5,s)-Math.PI/2;l.push([Z(a,s)+t+.9*r*Math.cos(u-e),Z(a,s)+n+.9*i*Math.sin(u-e)]);let d=2*Math.PI+u-.01;for(let o=u;o<d;o+=e){let e=[Z(a,s)+t+r*Math.cos(o),Z(a,s)+n+i*Math.sin(o)];c.push(e),l.push(e)}l.push([Z(a,s)+t+r*Math.cos(u+2*Math.PI+.5*o),Z(a,s)+n+i*Math.sin(u+2*Math.PI+.5*o)]),l.push([Z(a,s)+t+.98*r*Math.cos(u+o),Z(a,s)+n+.98*i*Math.sin(u+o)]),l.push([Z(a,s)+t+.9*r*Math.cos(u+.5*o),Z(a,s)+n+.9*i*Math.sin(u+.5*o)])}return[l,c]}function Fe(e,t,n,r,i,a,o,s,c){let l=a+Z(.1,c),u=[];u.push([Z(s,c)+t+.9*r*Math.cos(l-e),Z(s,c)+n+.9*i*Math.sin(l-e)]);for(let a=l;a<=o;a+=e)u.push([Z(s,c)+t+r*Math.cos(a),Z(s,c)+n+i*Math.sin(a)]);return u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),Ne(u,null,c)}function Ie(e,t,n,r,i,a,o,s){let c=[],l=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],u=[0,0],d=s.disableMultiStroke?1:2,f=s.preserveVertices;for(let p=0;p<d;p++)p===0?c.push({op:`move`,data:[o[0],o[1]]}):c.push({op:`move`,data:[o[0]+(f?0:Z(l[0],s)),o[1]+(f?0:Z(l[0],s))]}),u=f?[i,a]:[i+Z(l[p],s),a+Z(l[p],s)],c.push({op:`bcurveTo`,data:[e+Z(l[p],s),t+Z(l[p],s),n+Z(l[p],s),r+Z(l[p],s),u[0],u[1]]});return c}function Le(e){return[...e]}function Re(e,t=0){let n=e.length;if(n<3)throw Error(`A curve must have at least three points.`);let r=[];if(n===3)r.push(Le(e[0]),Le(e[1]),Le(e[2]),Le(e[2]));else{let n=[];n.push(e[0],e[0]);for(let t=1;t<e.length;t++)n.push(e[t]),t===e.length-1&&n.push(e[t]);let i=[],a=1-t;r.push(Le(n[0]));for(let e=1;e+2<n.length;e++){let t=n[e];i[0]=[t[0],t[1]],i[1]=[t[0]+(a*n[e+1][0]-a*n[e-1][0])/6,t[1]+(a*n[e+1][1]-a*n[e-1][1])/6],i[2]=[n[e+1][0]+(a*n[e][0]-a*n[e+2][0])/6,n[e+1][1]+(a*n[e][1]-a*n[e+2][1])/6],i[3]=[n[e+1][0],n[e+1][1]],r.push(i[1],i[2],i[3])}}return r}function ze(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function Be(e,t,n){let r=ze(t,n);if(r===0)return ze(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),ze(e,Ve(t,n,i))}function Ve(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function He(e,t,n,r){let i=r||[];if(function(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],a=e[t+3],o=3*r[0]-2*n[0]-a[0];o*=o;let s=3*r[1]-2*n[1]-a[1];s*=s;let c=3*i[0]-2*a[0]-n[0];c*=c;let l=3*i[1]-2*a[1]-n[1];return l*=l,o<c&&(o=c),s<l&&(s=l),o+s}(e,t)<n){let n=e[t+0];i.length?(a=i[i.length-1],o=n,Math.sqrt(ze(a,o))>1&&i.push(n)):i.push(n),i.push(e[t+3])}else{let r=.5,a=e[t+0],o=e[t+1],s=e[t+2],c=e[t+3],l=Ve(a,o,r),u=Ve(o,s,r),d=Ve(s,c,r),f=Ve(l,u,r),p=Ve(u,d,r),m=Ve(f,p,r);He([a,l,f,m],0,n,i),He([m,p,d,c],0,n,i)}var a,o;return i}function Ue(e,t){return We(e,0,e.length,t)}function We(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],c=0,l=1;for(let r=t+1;r<n-1;++r){let t=Be(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(We(e,t,l+1,r,a),We(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function Ge(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let n=0;n<i;n++)He(e,3*n,t,r);return n&&n>0?We(r,0,r.length,n):r}var $=`none`,Ke=class{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:`#000`,strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:`hachure`,fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,t,n){return{shape:e,sets:t||[],options:n||this.defaultOptions}}line(e,t,n,r,i){let a=this._o(i);return this._d(`line`,[ve(e,t,n,r,a)],a)}rectangle(e,t,n,r,i){let a=this._o(i),o=[],s=be(e,t,n,r,a);if(a.fill){let i=[[e,t],[e+n,t],[e+n,t+r],[e,t+r]];a.fillStyle===`solid`?o.push(Ee([i],a)):o.push(De([i],a))}return a.stroke!==$&&o.push(s),this._d(`rectangle`,o,a)}ellipse(e,t,n,r,i){let a=this._o(i),o=[],s=Se(n,r,a),c=Ce(e,t,a,s);if(a.fill){if(a.fillStyle===`solid`){let n=Ce(e,t,a,s).opset;n.type=`fillPath`,o.push(n)}else o.push(De([c.estimatedPoints],a))}return a.stroke!==$&&o.push(c.opset),this._d(`ellipse`,o,a)}circle(e,t,n,r){let i=this.ellipse(e,t,n,n,r);return i.shape=`circle`,i}linearPath(e,t){let n=this._o(t);return this._d(`linearPath`,[ye(e,!1,n)],n)}arc(e,t,n,r,i,a,o=!1,s){let c=this._o(s),l=[],u=we(e,t,n,r,i,a,o,!0,c);if(o&&c.fill){if(c.fillStyle===`solid`){let o=Object.assign({},c);o.disableMultiStroke=!0;let s=we(e,t,n,r,i,a,!0,!1,o);s.type=`fillPath`,l.push(s)}else l.push(function(e,t,n,r,i,a,o){let s=e,c=t,l=Math.abs(n/2),u=Math.abs(r/2);l+=Z(.01*l,o),u+=Z(.01*u,o);let d=i,f=a;for(;d<0;)d+=2*Math.PI,f+=2*Math.PI;f-d>2*Math.PI&&(d=0,f=2*Math.PI);let p=(f-d)/o.curveStepCount,m=[];for(let e=d;e<=f;e+=p)m.push([s+l*Math.cos(e),c+u*Math.sin(e)]);return m.push([s+l*Math.cos(f),c+u*Math.sin(f)]),m.push([s,c]),De([m],o)}(e,t,n,r,i,a,c))}return c.stroke!==$&&l.push(u),this._d(`arc`,l,c)}curve(e,t){let n=this._o(t),r=[],i=xe(e,n);if(n.fill&&n.fill!==$){if(n.fillStyle===`solid`){let t=xe(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else{let t=[],i=e;if(i.length){let e=typeof i[0][0]==`number`?[i]:i;for(let r of e)r.length<3?t.push(...r):r.length===3?t.push(...Ge(Re([r[0],r[0],r[1],r[2]]),10,(1+n.roughness)/2)):t.push(...Ge(Re(r),10,(1+n.roughness)/2))}t.length&&r.push(De([t],n))}}return n.stroke!==$&&r.push(i),this._d(`curve`,r,n)}polygon(e,t){let n=this._o(t),r=[],i=ye(e,!0,n);return n.fill&&(n.fillStyle===`solid`?r.push(Ee([e],n)):r.push(De([e],n))),n.stroke!==$&&r.push(i),this._d(`polygon`,r,n)}path(e,t){let n=this._o(t),r=[];if(!e)return this._d(`path`,r,n);e=(e||``).replace(/\n/g,` `).replace(/(-\s)/g,`-`).replace(`/(ss)/g`,` `);let i=n.fill&&n.fill!==`transparent`&&n.fill!==$,a=n.stroke!==$,o=!!(n.simplification&&n.simplification<1),s=function(e,t,n){let r=me(pe(fe(e))),i=[],a=[],o=[0,0],s=[],c=()=>{s.length>=4&&a.push(...Ge(s,t)),s=[]},l=()=>{c(),a.length&&(i.push(a),a=[])};for(let{key:e,data:t}of r)switch(e){case`M`:l(),o=[t[0],t[1]],a.push(o);break;case`L`:c(),a.push([t[0],t[1]]);break;case`C`:if(!s.length){let e=a.length?a[a.length-1]:o;s.push([e[0],e[1]])}s.push([t[0],t[1]]),s.push([t[2],t[3]]),s.push([t[4],t[5]]);break;case`Z`:c(),a.push([o[0],o[1]])}if(l(),!n)return i;let u=[];for(let e of i){let t=Ue(e,n);t.length&&u.push(t)}return u}(e,1,o?4-4*(n.simplification||1):(1+n.roughness)/2),c=Te(e,n);if(i){if(n.fillStyle===`solid`){if(s.length===1){let t=Te(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else r.push(Ee(s,n))}else r.push(De(s,n))}return a&&(o?s.forEach((e=>{r.push(ye(e,!1,n))})):r.push(c)),this._d(`path`,r,n)}opsToPath(e,t){let n=``;for(let r of e.ops){let e=typeof t==`number`&&t>=0?r.data.map((e=>+e.toFixed(t))):r.data;switch(r.op){case`move`:n+=`M${e[0]} ${e[1]} `;break;case`bcurveTo`:n+=`C${e[0]} ${e[1]}, ${e[2]} ${e[3]}, ${e[4]} ${e[5]} `;break;case`lineTo`:n+=`L${e[0]} ${e[1]} `}}return n.trim()}toPaths(e){let t=e.sets||[],n=e.options||this.defaultOptions,r=[];for(let e of t){let t=null;switch(e.type){case`path`:t={d:this.opsToPath(e),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:$};break;case`fillPath`:t={d:this.opsToPath(e),stroke:$,strokeWidth:0,fill:n.fill||$};break;case`fillSketch`:t=this.fillSketch(e,n)}t&&r.push(t)}return r}fillSketch(e,t){let n=t.fillWeight;return n<0&&(n=t.strokeWidth/2),{d:this.opsToPath(e),stroke:t.fill||$,strokeWidth:n,fill:$}}_mergedShape(e){return e.filter(((e,t)=>t===0||e.op!==`move`))}},qe=class{constructor(e,t){this.canvas=e,this.ctx=this.canvas.getContext(`2d`),this.gen=new Ke(t)}draw(e){let t=e.sets||[],n=e.options||this.getDefaultOptions(),r=this.ctx,i=e.options.fixedDecimalPlaceDigits;for(let a of t)switch(a.type){case`path`:r.save(),r.strokeStyle=n.stroke===`none`?`transparent`:n.stroke,r.lineWidth=n.strokeWidth,n.strokeLineDash&&r.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(r.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(r,a,i),r.restore();break;case`fillPath`:{r.save(),r.fillStyle=n.fill||``;let t=e.shape===`curve`||e.shape===`polygon`||e.shape===`path`?`evenodd`:`nonzero`;this._drawToContext(r,a,i,t),r.restore();break}case`fillSketch`:this.fillSketch(r,a,n)}}fillSketch(e,t,n){let r=n.fillWeight;r<0&&(r=n.strokeWidth/2),e.save(),n.fillLineDash&&e.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(e.lineDashOffset=n.fillLineDashOffset),e.strokeStyle=n.fill||``,e.lineWidth=r,this._drawToContext(e,t,n.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,t,n,r=`nonzero`){e.beginPath();for(let r of t.ops){let t=typeof n==`number`&&n>=0?r.data.map((e=>+e.toFixed(n))):r.data;switch(r.op){case`move`:e.moveTo(t[0],t[1]);break;case`bcurveTo`:e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]);break;case`lineTo`:e.lineTo(t[0],t[1])}}t.type===`fillPath`?e.fill(r):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,t,n,r,i){let a=this.gen.line(e,t,n,r,i);return this.draw(a),a}rectangle(e,t,n,r,i){let a=this.gen.rectangle(e,t,n,r,i);return this.draw(a),a}ellipse(e,t,n,r,i){let a=this.gen.ellipse(e,t,n,r,i);return this.draw(a),a}circle(e,t,n,r){let i=this.gen.circle(e,t,n,r);return this.draw(i),i}linearPath(e,t){let n=this.gen.linearPath(e,t);return this.draw(n),n}polygon(e,t){let n=this.gen.polygon(e,t);return this.draw(n),n}arc(e,t,n,r,i,a,o=!1,s){let c=this.gen.arc(e,t,n,r,i,a,o,s);return this.draw(c),c}curve(e,t){let n=this.gen.curve(e,t);return this.draw(n),n}path(e,t){let n=this.gen.path(e,t);return this.draw(n),n}},Je=`http://www.w3.org/2000/svg`,Ye=class{constructor(e,t){this.svg=e,this.gen=new Ke(t)}draw(e){let t=e.sets||[],n=e.options||this.getDefaultOptions(),r=this.svg.ownerDocument||window.document,i=r.createElementNS(Je,`g`),a=e.options.fixedDecimalPlaceDigits;for(let o of t){let t=null;switch(o.type){case`path`:t=r.createElementNS(Je,`path`),t.setAttribute(`d`,this.opsToPath(o,a)),t.setAttribute(`stroke`,n.stroke),t.setAttribute(`stroke-width`,n.strokeWidth+``),t.setAttribute(`fill`,`none`),n.strokeLineDash&&t.setAttribute(`stroke-dasharray`,n.strokeLineDash.join(` `).trim()),n.strokeLineDashOffset&&t.setAttribute(`stroke-dashoffset`,`${n.strokeLineDashOffset}`);break;case`fillPath`:t=r.createElementNS(Je,`path`),t.setAttribute(`d`,this.opsToPath(o,a)),t.setAttribute(`stroke`,`none`),t.setAttribute(`stroke-width`,`0`),t.setAttribute(`fill`,n.fill||``),e.shape!==`curve`&&e.shape!==`polygon`||t.setAttribute(`fill-rule`,`evenodd`);break;case`fillSketch`:t=this.fillSketch(r,o,n)}t&&i.appendChild(t)}return i}fillSketch(e,t,n){let r=n.fillWeight;r<0&&(r=n.strokeWidth/2);let i=e.createElementNS(Je,`path`);return i.setAttribute(`d`,this.opsToPath(t,n.fixedDecimalPlaceDigits)),i.setAttribute(`stroke`,n.fill||``),i.setAttribute(`stroke-width`,r+``),i.setAttribute(`fill`,`none`),n.fillLineDash&&i.setAttribute(`stroke-dasharray`,n.fillLineDash.join(` `).trim()),n.fillLineDashOffset&&i.setAttribute(`stroke-dashoffset`,`${n.fillLineDashOffset}`),i}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,t){return this.gen.opsToPath(e,t)}line(e,t,n,r,i){let a=this.gen.line(e,t,n,r,i);return this.draw(a)}rectangle(e,t,n,r,i){let a=this.gen.rectangle(e,t,n,r,i);return this.draw(a)}ellipse(e,t,n,r,i){let a=this.gen.ellipse(e,t,n,r,i);return this.draw(a)}circle(e,t,n,r){let i=this.gen.circle(e,t,n,r);return this.draw(i)}linearPath(e,t){let n=this.gen.linearPath(e,t);return this.draw(n)}polygon(e,t){let n=this.gen.polygon(e,t);return this.draw(n)}arc(e,t,n,r,i,a,o=!1,s){let c=this.gen.arc(e,t,n,r,i,a,o,s);return this.draw(c)}curve(e,t){let n=this.gen.curve(e,t);return this.draw(n)}path(e,t){let n=this.gen.path(e,t);return this.draw(n)}},Xe={canvas:(e,t)=>new qe(e,t),svg:(e,t)=>new Ye(e,t),generator:e=>new Ke(e),newSeed:()=>Ke.newSeed()};function Ze(e,t,n,r,i,a,o=!1){let s=r/128,c=n<=1?.32:t/(n-1),l=a.seed,u=a.colors;e.save(),o||(a.bgMode===`washi`?(e.fillStyle=`#F4F1EA`,e.fillRect(0,0,r,i)):a.bgMode===`dark`&&(e.fillStyle=`#111113`,e.fillRect(0,0,r,i)));let f=null;try{f=Xe.canvas(e.canvas)}catch{f=null}let p=Math.min(1,1-(1-c)**3.4),h=c<.18?0:((c-.18)/.82)**1.55*.78,_=c<.25?0:((c-.25)/.75)**1.25*a.dynamics.erosionStrength,v=c>=.18&&c<=.46?Math.sin((c-.18)/.28*Math.PI):0,y=a.brush.angle*Math.PI/180,b=64*s,S=64*s;a.dynamics.glowIntensity>.2&&_<.88&&z(e,b,S,46*s*(.7+p*.35),38*s*(.7+p*.35),y,u.coreGlow,u.energySecondary,Math.max(.08,(1-_*.85)*.32*a.dynamics.glowIntensity),l+11);let C=a.archetype;if(C===`hyb_slash_great_wave_katana`||C===`water_slash`){let n=-Math.PI*.78*a.brush.arcSweep+y,r=Math.PI*.68*a.brush.arcSweep+y,i=g(b,S,43*s,36*s*a.brush.curvature,n,r,y*.35,.12,88,a.dynamics.jitterAmount,l);A(e,{spine:i,maxWidth:24*s*a.brush.strokeThickness,bristleCount:a.brush.bristleCount,dryBrushGap:a.brush.dryBrushGap,taperStart:a.brush.taperStart,taperEnd:a.brush.taperEnd,color:u.inkPrimary,headReach:p,tailRetract:h,erosionProgress:_,erosionScale:a.dynamics.erosionScale,hookWaves:a.dynamics.hookWaves,seed:l});let o=i.filter(e=>e.t>=h*.85&&e.t<=p);o.length>=6&&_<.82&&F(e,f,o.map((e,t,n)=>({...e,t:t/Math.max(1,n.length-1)})),19*s*a.brush.strokeThickness*(1-_*.45),1,C===`hyb_slash_great_wave_katana`?6:4,a,s,Math.max(.2,1-_*.65),l+t*7),A(e,{spine:i,maxWidth:(8+v*5)*s*a.brush.strokeThickness,bristleCount:Math.max(6,Math.floor(a.brush.bristleCount*.45)),dryBrushGap:a.brush.dryBrushGap*.5,taperStart:.9,taperEnd:.95,color:u.coreGlow,offsetNormal:2.2*s*a.dynamics.colorOffset,headReach:p,tailRetract:Math.min(p,h+.08),erosionProgress:_*1.1,erosionScale:a.dynamics.erosionScale,seed:l+303}),j(e,i,c,a.dynamics.splatterCount,a.dynamics.splatterSpread,s,u,l)}else if(C===`hyb_slash_crimson_phoenix_arc`){let t=m({x:18*s,y:104*s},{x:24*s,y:22*s*a.brush.curvature},{x:104*s,y:106*s*a.brush.curvature},{x:110*s,y:20*s},92,a.dynamics.jitterAmount,l);A(e,{spine:t,maxWidth:22*s*a.brush.strokeThickness,bristleCount:a.brush.bristleCount,dryBrushGap:a.brush.dryBrushGap,taperStart:a.brush.taperStart,taperEnd:a.brush.taperEnd,color:u.inkPrimary,headReach:p,tailRetract:h,erosionProgress:_,erosionScale:a.dynamics.erosionScale,seed:l});for(let n=0;n<7;n++){let r=(n+.5)/7;if(r<h||r>p)continue;let i=t[Math.min(t.length-1,Math.floor(r*(t.length-1)))],o=(22+Math.sin(r*Math.PI)*18)*s*(1-_*.55),c=Math.atan2(i.ny,i.nx)-.45,d=i.x+Math.cos(c)*o,m=i.y+Math.sin(c)*o;M(e,f,a,s,{rootX:i.x,rootY:i.y,ctrl1X:i.x+Math.cos(c-.5)*o*.42,ctrl1Y:i.y+Math.sin(c-.5)*o*.42,ctrl2X:i.x+Math.cos(c+.48)*o*.76,ctrl2Y:i.y+Math.sin(c+.48)*o*.76,tipX:d,tipY:m,maxBellyWidth:14*s*a.brush.strokeThickness,striationCount:5,alpha:Math.max(.2,1-_*.65),seed:l+n*67}),n%2==0&&_<.7&&N(e,d,m,d+Math.cos(c-.2)*14*s,m+Math.sin(c-.2)*14*s,3.2*s,u.energySecondary,l+n*131)}j(e,t,c,a.dynamics.splatterCount,a.dynamics.splatterSpread,s,u,l)}else if(C===`sakura_tempest_slash`){let t=g(b,S,44*s,34*s*a.brush.curvature,-Math.PI*.85+y,Math.PI*.75+y,-.25,-.15,92,a.dynamics.jitterAmount,l);A(e,{spine:t,maxWidth:21*s*a.brush.strokeThickness,bristleCount:a.brush.bristleCount,dryBrushGap:a.brush.dryBrushGap,taperStart:a.brush.taperStart,taperEnd:a.brush.taperEnd,color:u.inkPrimary,headReach:p,tailRetract:h,erosionProgress:_,erosionScale:a.dynamics.erosionScale,seed:l}),A(e,{spine:t,maxWidth:9*s*a.brush.strokeThickness,bristleCount:Math.max(8,Math.floor(a.brush.bristleCount*.5)),dryBrushGap:a.brush.dryBrushGap*.7,taperStart:.8,taperEnd:.9,color:u.energySecondary,offsetNormal:3.5*s,headReach:p,tailRetract:h,erosionProgress:_,erosionScale:a.dynamics.erosionScale,seed:l+77});let n=d(l+409);for(let r=0;r<9;r++){let i=(r+.4)/9;if(i>p)continue;let a=t[Math.min(t.length-1,Math.floor(i*(t.length-1)))],o=Math.max(0,c-i*.35)*18*s,d=a.x+a.nx*((n()-.35)*18*s+o),f=a.y+a.ny*((n()-.35)*18*s-o*.4),m=(5.5+r%3*2.5)*s*(1-_*.35);r%2==0?V(e,d,f,m,c*1.8+r,u.energySecondary,u.coreGlow,u.inkPrimary,Math.max(.2,1-_*.5),l+r*43):H(e,d,f,m*1.1,c*3.2+r,.45+.5*Math.abs(Math.cos(c*4+r)),u.energySecondary,Math.max(.25,1-_*.4))}}else if(C===`enso_sigil`){let t=Math.PI*1.82*a.brush.arcSweep,n=g(b,S,41*s,40*s*a.brush.curvature,-Math.PI*.85+y+c*.25,-Math.PI*.85+t+y+c*.25,0,-.06,96,a.dynamics.jitterAmount*.7,l);A(e,{spine:n,maxWidth:22*s*a.brush.strokeThickness,bristleCount:a.brush.bristleCount,dryBrushGap:Math.max(.25,a.brush.dryBrushGap),taperStart:.85,taperEnd:.98,color:u.inkPrimary,headReach:p,tailRetract:h*.45,erosionProgress:_*.85,erosionScale:a.dynamics.erosionScale,roundHeadCap:!0,seed:l}),A(e,{spine:n,maxWidth:10*s*a.brush.strokeThickness,bristleCount:Math.max(8,Math.floor(a.brush.bristleCount*.55)),dryBrushGap:a.brush.dryBrushGap,taperStart:.85,taperEnd:.98,color:u.energySecondary,offsetNormal:2.8*s*a.dynamics.colorOffset,headReach:p,tailRetract:h*.55,erosionProgress:_,erosionScale:a.dynamics.erosionScale,seed:l+149}),j(e,n,c,a.dynamics.splatterCount,a.dynamics.splatterSpread,s,u,l)}else if(C===`elem_fire_meteor_bolide`){let n=Math.min(1,c*1.25),r=(24+n*68)*s,i=(24+n*68)*s,o=(10+n*18)*s,u=(10+n*18)*s,d=Math.atan2(i-u,r-o),p=(16-_*4)*s*a.brush.strokeThickness;for(let t=0;t<4;t++){let n=(t-1.5)*14*s;M(e,f,a,s,{rootX:r,rootY:i,ctrl1X:(r+o)*.55+n,ctrl1Y:(i+u)*.55-n,ctrl2X:(r+o)*.3-n*.8,ctrl2Y:(i+u)*.3+n*.8,tipX:o+(t-1.5)*8*s,tipY:u-(t-1.5)*8*s,maxBellyWidth:18*s*a.brush.strokeThickness,striationCount:5,alpha:Math.max(.25,1-_*.6),seed:l+t*53})}if(c<.85){R(e,f,r,i,p*1.12,p*.94,d,.24,a,s,l+t*13);for(let t of[-1,1]){let n=d+t*Math.PI*.42,o=r+Math.cos(n)*p*.72,c=i+Math.sin(n)*p*.72,u=d+Math.PI+t*.28;M(e,f,a,s,{rootX:o,rootY:c,ctrl1X:o+Math.cos(n)*10*s,ctrl1Y:c+Math.sin(n)*10*s,ctrl2X:o+Math.cos(u)*22*s,ctrl2Y:c+Math.sin(u)*22*s,tipX:o+Math.cos(u)*34*s,tipY:c+Math.sin(u)*34*s,maxBellyWidth:9.5*s,striationCount:3,alpha:.96,seed:l+(t>0?311:419)})}}c>.55&&L(e,f,r,i,46*s*((c-.5)*1.8),4,a,s,Math.min(.95,(c-.5)*1.9),l+701)}else if(C===`elem_water_glacial_spikes`){let t=c<.28?Math.min(1.12,(c/.28)**.65*1.12):Math.max(.15,1-Math.max(0,c-.65)*2.1);for(let n=0;n<6;n++){let r=n/5*2-1,i=-Math.PI*.5+r*.68+y*.3,o=(56-Math.abs(r)*22)*s*t*a.brush.strokeThickness,c=(16-Math.abs(r)*4)*s*a.brush.strokeThickness;B(e,f,b+r*16*s,104*s,i,o,c,a,s,l+n*97)}L(e,f,b,104*s,68*s,4,a,s,Math.max(.25,1-_*.7),l+503)}else if(C===`solid_ref_fumaca`){let t=.65+p*.55;for(let n=0;n<5;n++){let r=n/5*Math.PI*2+c*.55+y,i=(14+c*24)*s,o=b+Math.cos(r)*i*.35,u=S+Math.sin(r)*i*.35,d=b+Math.cos(r+.55)*(36*s*t),p=S+Math.sin(r+.55)*(36*s*t);I(e,f,a,s,{startX:o,startY:u,endX:d,endY:p,maxThickness:20*s*a.brush.strokeThickness*(1-_*.45),lobeCount:3,flip:n%2==0?1:-1,alpha:Math.max(.2,1-_*.65),seed:l+n*113})}}else if(C===`elem_water_healing_fountain`){z(e,b,82*s,44*s,26*s,0,u.coreGlow,u.energySecondary,.75*(1-_*.5),l+31);for(let t=0;t<3;t++){let n=t*Math.PI*2/3+c*Math.PI*1.4;A(e,{spine:m({x:b+Math.sin(n)*20*s,y:106*s},{x:b-Math.sin(n)*32*s,y:74*s},{x:b+Math.sin(n)*28*s,y:42*s},{x:b-Math.sin(n)*14*s,y:16*s},64,a.dynamics.jitterAmount*.4,l+t*71),maxWidth:13*s*a.brush.strokeThickness,bristleCount:14,dryBrushGap:a.brush.dryBrushGap,taperStart:.7,taperEnd:.95,color:t===0?u.inkPrimary:t===1?u.energySecondary:u.coreGlow,headReach:p,tailRetract:h*.7,erosionProgress:_,erosionScale:a.dynamics.erosionScale,seed:l+t*89})}}else if(C===`portal_abyssal_vortex`){for(let t=0;t<3;t++){let n=t/3*Math.PI*2+c*Math.PI*1.5+y;A(e,{spine:g(b,S,45*s,42*s*a.brush.curvature,n,n+Math.PI*1.45,0,-.52,76,a.dynamics.jitterAmount*.5,l+t*61),maxWidth:16*s*a.brush.strokeThickness,bristleCount:Math.max(10,Math.floor(a.brush.bristleCount*.7)),dryBrushGap:a.brush.dryBrushGap,taperStart:.6,taperEnd:.95,color:t%2==0?u.energySecondary:u.inkPrimary,headReach:p,tailRetract:h*.4,erosionProgress:_*.75,erosionScale:a.dynamics.erosionScale,seed:l+t*107})}e.beginPath(),e.arc(b,S,13*s*(1-_*.35),0,Math.PI*2),e.fillStyle=u.inkPrimary,e.fill(),e.strokeStyle=u.coreGlow,e.lineWidth=1.5*s,e.stroke()}else{let t=C===`hyb_slash_blood_moon_scythe`,n=(t?Math.PI*1.52:Math.PI*1.18)*a.brush.arcSweep,r=g(b,S,44*s,(t?42:34)*s*a.brush.curvature,-n*.55+y,n*.55+y,.22,t?-.18:.08,96,a.dynamics.jitterAmount,l);A(e,{spine:r,maxWidth:(t?28:23)*s*a.brush.strokeThickness,bristleCount:a.brush.bristleCount,dryBrushGap:a.brush.dryBrushGap,taperStart:a.brush.taperStart,taperEnd:a.brush.taperEnd,color:u.inkPrimary,headReach:p,tailRetract:h,erosionProgress:_,erosionScale:a.dynamics.erosionScale,hookWaves:a.dynamics.hookWaves,roundHeadCap:!0,seed:l}),A(e,{spine:r,maxWidth:14*s*a.brush.strokeThickness,bristleCount:Math.max(8,Math.floor(a.brush.bristleCount*.68)),dryBrushGap:a.brush.dryBrushGap*.85,taperStart:a.brush.taperStart,taperEnd:a.brush.taperEnd,color:u.energySecondary,offsetNormal:3.2*s*a.dynamics.colorOffset,headReach:p,tailRetract:Math.min(p,h+.04),erosionProgress:_,erosionScale:a.dynamics.erosionScale,hookWaves:a.dynamics.hookWaves,roundHeadCap:!1,seed:l+199}),A(e,{spine:r,maxWidth:(6.5+v*4.5)*s*a.brush.strokeThickness,bristleCount:Math.max(5,Math.floor(a.brush.bristleCount*.38)),dryBrushGap:a.brush.dryBrushGap*.5,taperStart:.9,taperEnd:.95,color:u.coreGlow,offsetNormal:1.8*s*a.dynamics.colorOffset,headReach:p,tailRetract:Math.min(p,h+.09),erosionProgress:_*1.15,erosionScale:a.dynamics.erosionScale,roundHeadCap:!1,seed:l+397}),j(e,r,c,a.dynamics.splatterCount,a.dynamics.splatterSpread,s,u,l)}if(a.channelMode!==`composite`){let t=x(e.getImageData(0,0,r,i),a);e.putImageData(t,0,0)}e.restore()}function Qe(e,t,n=4){let r=Math.ceil(t.totalFrames/n),i=t.frameSize;e.width=i*n,e.height=i*r;let a=e.getContext(`2d`);if(a){a.clearRect(0,0,e.width,e.height);for(let e=0;e<t.totalFrames;e++){let r=e%n,o=Math.floor(e/n);a.save(),a.beginPath(),a.rect(r*i,o*i,i,i),a.clip(),a.translate(r*i,o*i),Ze(a,e,t.totalFrames,i,i,t,!0),a.restore()}}}function $e(e,t,n,r){let i=[],a=e=>i.push(e&255),o=e=>{i.push(e&255),i.push(e>>8&255)},s=e=>{for(let t=0;t<e.length;t++)i.push(e.charCodeAt(t)&255)};s(`GIF89a`),o(t),o(n),a(247),a(255),a(0);for(let e=0;e<256;e++)if(e<216){let t=Math.floor(e/36),n=Math.floor(e%36/6),r=e%6;a(Math.round(t*255/5)),a(Math.round(n*255/5)),a(Math.round(r*255/5))}else a(0),a(0),a(0);a(33),a(255),a(11),s(`NETSCAPE2.0`),a(3),a(1),o(0),a(0);let c=Math.max(2,Math.round(100/Math.max(1,r)));for(let r of e){a(33),a(249),a(4),a(9),o(c),a(255),a(0),a(44),o(0),o(0),o(t),o(n),a(0);let e=new Uint8Array(t*n),i=r.data;for(let r=0;r<t*n;r++){let t=r*4;if(i[t+3]<48)e[r]=255;else{let n=Math.min(5,Math.round(i[t]*5/255)),a=Math.min(5,Math.round(i[t+1]*5/255)),o=Math.min(5,Math.round(i[t+2]*5/255));e[r]=n*36+a*6+o}}a(8);let s=et(e,8);for(let e=0;e<s.length;e++)a(s[e]);a(0)}return a(59),new Uint8Array(i)}function et(e,t){let n=1<<t,r=n+1,i=t+1,a=r+1,o=new Map,s=[],c=0,l=0,u=[],d=()=>{if(u.length>0){s.push(u.length);for(let e=0;e<u.length;e++)s.push(u[e]);u.length=0}},f=e=>{for(c|=e<<l,l+=i;l>=8;)u.push(c&255),u.length===255&&d(),c>>>=8,l-=8};f(n);let p=e[0];for(let s=1;s<e.length;s++){let c=e[s],l=p<<8|c,u=o.get(l);u===void 0?(f(p),a<4096?(o.set(l,a++),a>1<<i&&i<12&&i++):(f(n),o.clear(),i=t+1,a=r+1),p=c):p=u}return f(p),f(r),l>0&&u.push(c&255),d(),s}var tt=({src:e=`/assets/aistudio/image_8f7809d3.png`,alt:t=`Pintura Sumi-e revelada por máscara caligráfica`,choreography:n=`fuji_masterpiece`,duration:r=3.4,bristleCount:i=26,dryBrushGap:a=.28,seed:o=8472,showLiveInkAccents:s=!0,maskOnlyPreview:u=!1,progress:f,replayTrigger:p=0,interactiveBrush:v=!0,showTouchControls:y=!0,className:b=``})=>{let x=(0,c.useRef)(null),S=(0,c.useRef)(null),C=(0,c.useRef)(null),w=(0,c.useRef)(``),T=(0,c.useRef)(!0),E=(0,c.useRef)(null),[D,O]=(0,c.useState)(!1),[k,j]=(0,c.useState)(!1),[M,N]=(0,c.useState)(n===`interactive_brush`),[P,F]=(0,c.useState)(0),I=(0,c.useRef)([]),L=(0,c.useRef)(null),R=(0,c.useRef)({x:0,y:0,active:!1}),B=(0,c.useRef)(0),U=(0,c.useRef)(performance.now());(0,c.useEffect)(()=>{N(n===`interactive_brush`)},[n]),(0,c.useEffect)(()=>{O(!1),j(!1),w.current=``;let t=new Image;t.crossOrigin=`anonymous`,t.onload=()=>{E.current=t,w.current=``,O(!0)},t.onerror=()=>{j(!0)},t.src=e},[e]),(0,c.useEffect)(()=>{U.current=performance.now(),I.current=[],F(0),B.current++,w.current=``},[p,n,o,e]),(0,c.useEffect)(()=>{let e=x.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.forEach(e=>{T.current=e.isIntersecting})},{rootMargin:`80px 0px`,threshold:.01});return t.observe(e),()=>t.disconnect()},[]),(0,c.useEffect)(()=>{let e=x.current;if(!e)return;S.current||=document.createElement(`canvas`),C.current||=document.createElement(`canvas`);let t=S.current,c=C.current,l=0,p=e.getBoundingClientRect(),v=new ResizeObserver(e=>{e[0]&&(p=e[0].contentRect,w.current=``)});v.observe(e);let y=v=>{if(!T.current){l=requestAnimationFrame(y);return}let b=Math.min(1.75,window.devicePixelRatio||1),x=Math.max(220,Math.floor(p.width||e.clientWidth||500)),S=Math.max(160,Math.floor(p.height||e.clientHeight||320)),C=Math.floor(x*b),O=Math.floor(S*b);(e.width!==C||e.height!==O)&&(e.width=C,e.height=O,t.width=C,t.height=O,c.width=C,c.height=O,w.current=``);let j=e.getContext(`2d`),N=t.getContext(`2d`),P=c.getContext(`2d`);if(!j||!N||!P)return;let F=(v-U.current)/1e3,W=M||n===`interactive_brush`,G=W?.16:Math.min(1,F/Math.max(.4,r)),K=f===void 0?G:f,q=K>=.998?1:Math.round(K*90)/90,J=Math.max(.52,Math.min(x/920,S/560)),Y=`${C}x${O}:${n}:${W}:${q}:${i}:${a}:${o}:${u}:${D}:${B.current}`;if(w.current!==Y){if(N.save(),N.setTransform(b,0,0,b,0,0),N.clearRect(0,0,x,S),W)I.current.length===0&&!L.current&&z(N,x*.5,S*.48,x*.14,S*.14,0,`#000000`,`#000000`,.85,o+19);else if(n===`fuji_masterpiece`){let e=Math.min(1,q*2.2);if(e>.01&&z(N,x*.79,S*.28,x*.22*e,x*.22*e,0,`#000000`,`#000000`,1,o+11),[{x0:x*.74,y0:S*.45,x1:x*.34,y1:S*.85,w:145*J,start:.08,end:.55},{x0:x*.73,y0:S*.46,x1:x*.98,y1:S*.82,w:140*J,start:.14,end:.62},{x0:x*.42,y0:S*.84,x1:x*.96,y1:S*.88,w:165*J,start:.22,end:.72}].forEach((e,t)=>{let n=Math.max(0,Math.min(1,(q-e.start)/(e.end-e.start)));if(n<=.01)return;let r=h({x:e.x0,y:e.y0},{x:(e.x0+e.x1)*.5,y:(e.y0+e.y1)*.5-24*J},{x:e.x1,y:e.y1},48,.15,o+100+t*19);A(N,{spine:r,maxWidth:e.w,bristleCount:i,dryBrushGap:a*.75,taperStart:.25,taperEnd:.45,color:`#000000`,alpha:1,headReach:n,seed:o+120+t*19})}),[{p0:{x:0,y:S*.72},p1:{x:x*.16,y:S*.42},p2:{x:x*.32,y:S*.2},p3:{x:x*.56,y:S*.04},w:195*J,start:.18,end:.76},{p0:{x:x*.08,y:S*.48},p1:{x:x*.28,y:S*.46},p2:{x:x*.46,y:S*.62},p3:{x:x*.66,y:S*.75},w:175*J,start:.28,end:.85},{p0:{x:x*.04,y:S*.45},p1:{x:x*.12,y:S*.24},p2:{x:x*.28,y:S*.12},p3:{x:x*.64,y:S*.22},w:180*J,start:.34,end:.9}].forEach((e,t)=>{let n=Math.max(0,Math.min(1,(q-e.start)/(e.end-e.start)));if(n<=.01)return;let r=m(e.p0,e.p1,e.p2,e.p3,52,.2,o+200+t*29);A(N,{spine:r,maxWidth:e.w,bristleCount:i,dryBrushGap:a*.65,taperStart:.15,taperEnd:.35,color:`#000000`,alpha:1,headReach:n,seed:o+220+t*29})}),q>.55){let e=(q-.55)/.45;z(N,x*.5,S*.5,x*.72*e,S*.72*e,0,`#000000`,`#000000`,Math.min(1,e*1.35),o+555)}}else if(n===`katana_slashes`)for(let e=0;e<6;e++){let t=e*.11,n=Math.max(0,Math.min(1,(q-t)/.45));if(n<=.01)continue;let r=S*(.12+e/5*.78),s=S*(.08+(5-e)/5*.84),c=e%2==0;A(N,{spine:h({x:c?-x*.05:x*1.05,y:r},{x:x*.5,y:(r+s)*.5+(c?-45:45)*J},{x:c?x*1.05:-x*.05,y:s},52,.18,o+e*37),maxWidth:165*J,bristleCount:i,dryBrushGap:a,taperStart:.2,taperEnd:.35,color:`#000000`,alpha:1,headReach:n,seed:o+e*73})}else if(n===`enso_spiral`){let e=Math.hypot(x,S)*.56;for(let t=0;t<3;t++){let n=Math.max(0,Math.min(1,(q-t*.15)/.65));if(n<=.01)continue;let r=e*((t+.6)/3);A(N,{spine:g(x*.5,S*.5,r,r*.82,-Math.PI*.85+t*1.2,Math.PI*1.35+t*1.2,0,.15,68,.15,o+t*59),maxWidth:190*J,bristleCount:i,dryBrushGap:a,taperStart:.25,taperEnd:.4,color:`#000000`,alpha:1,headReach:n,seed:o+t*97})}}else if(n===`hokusai_tide`)for(let e=0;e<5;e++){let t=Math.max(0,Math.min(1,(q-e*.1)/.55));if(t<=.01)continue;let n=S*(.15+e/4*.72);A(N,{spine:m({x:-x*.05,y:n+30*J},{x:x*.32,y:n-75*J},{x:x*.68,y:n+75*J},{x:x*1.05,y:n-25*J},56,.2,o+e*43),maxWidth:175*J,bristleCount:i,dryBrushGap:a,taperStart:.15,taperEnd:.25,color:`#000000`,alpha:1,headReach:t,hookWaves:4,seed:o+e*83})}if((L.current?[...I.current,L.current]:I.current).forEach((e,t)=>{if(e.length===0)return;let n=e.length===1?[{x:e[0].x-28*J,y:e[0].y+10*J,pressure:.85},{x:e[0].x,y:e[0].y,pressure:.95},{x:e[0].x+32*J,y:e[0].y-12*J,pressure:.75}]:e,r=_(n,.1,o+t*17),s=n.reduce((e,t)=>e+t.pressure,0)/n.length;z(N,n[0].x,n[0].y,46*J,38*J,t*.7,`#000000`,`#000000`,.95,o+800+t*19),A(N,{spine:r,maxWidth:122*J*(.75+s*.85),bristleCount:Math.max(14,Math.floor(i*.85)),dryBrushGap:a*.65,taperStart:.18,taperEnd:.38,color:`#000000`,alpha:1,seed:o+900+t*23})}),N.restore(),P.save(),P.setTransform(b,0,0,b,0,0),P.clearRect(0,0,x,S),u)P.drawImage(t,0,0,x,S);else if(D&&E.current&&!k){let e=E.current,n=e.width/Math.max(1,e.height),r=x/S,i=x,a=S,o=0,s=0;r>n?(i=x,a=x/n,s=(S-a)*.5):(a=S,i=S*n,o=(x-i)*.5),P.drawImage(e,o,s,i,a),P.globalCompositeOperation=`destination-in`,P.drawImage(t,0,0,x,S),P.globalCompositeOperation=`source-over`,W&&(P.globalCompositeOperation=`destination-over`,P.globalAlpha=.12,P.drawImage(e,o,s,i,a),P.globalAlpha=1,P.globalCompositeOperation=`source-over`)}else P.drawImage(t,0,0,x,S);P.restore(),w.current=Y}if(j.save(),j.setTransform(b,0,0,b,0,0),j.clearRect(0,0,x,S),j.drawImage(c,0,0,x,S),u||((L.current?[...I.current,L.current]:I.current).forEach((e,t)=>{if(e.length!==0)for(let n=0;n<e.length;n+=4){let r=e[n];V(j,r.x+Math.sin(t+n)*8*J,r.y+Math.cos(t+n)*8*J,(6.5+n%3*2)*J,(t+n)*.7,`#C8232C`,`#FFF5F5`,`#141413`,.78,o+1400+t*31+n)}}),R.current.active&&L.current&&(j.beginPath(),j.arc(R.current.x,R.current.y,24*J,0,Math.PI*2),j.strokeStyle=`rgba(200, 35, 44, 0.55)`,j.lineWidth=1.75,j.stroke())),s&&!u&&K>.15){let e=d(o+777);for(let t=0;t<14;t++){let n=e()*x*.72,r=e()*S*.78,i=16+e()*22,a=(n+F*i*1.2+Math.sin(F*1.5+t)*16*J)%(x*.96),s=(r+F*i*.55+Math.cos(F*1.2+t)*12*J)%(S*.9);t%5==0?V(j,a,s,(6.5+t%3*2)*J,F*.9+t,`#C8232C`,`#FFF5F5`,`#141413`,.85*Math.min(1,(K-.15)*2),o+t*31):H(j,a,s,(5+t%4*2)*J,F*1.8+t,.4+.55*Math.abs(Math.sin(F*2.2+t)),`#C8232C`,.88*Math.min(1,(K-.15)*2))}}j.restore(),(K<1||s&&!u||L.current!==null)&&(l=requestAnimationFrame(y))};return l=requestAnimationFrame(y),()=>{cancelAnimationFrame(l),v.disconnect()}},[D,k,n,M,r,i,a,o,s,u,f,p]);let W=()=>{B.current++},G=e=>{if(!v)return;try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=e.pressure>0&&e.pressure!==.5?e.pressure:.82;R.current={x:n,y:r,active:!0},L.current=[{x:n,y:r,pressure:i}],W()},K=e=>{if(!v||!L.current)return;let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;R.current={x:n,y:r,active:!0};let i=L.current[L.current.length-1],a=i?Math.hypot(n-i.x,r-i.y):0;if(a<3)return;let o=Math.max(.35,Math.min(1,1-a/68)),s=e.pressure>0&&e.pressure!==.5?e.pressure:o;L.current.push({x:n,y:r,pressure:s}),W()},q=()=>{if(R.current.active=!1,L.current&&L.current.length>=1){let e=L.current;if(e.length===1){let t=e[0];I.current.push([{x:t.x-26,y:t.y+10,pressure:.85},{x:t.x,y:t.y,pressure:.95},{x:t.x+28,y:t.y-10,pressure:.78}])}else I.current.push(e);F(I.current.length)}L.current=null,W()};return(0,l.jsxs)(`div`,{className:`relative w-full h-full overflow-hidden select-none ${b}`,"aria-label":t,children:[(0,l.jsx)(`canvas`,{ref:x,onPointerDown:G,onPointerMove:K,onPointerUp:q,onPointerCancel:q,style:{touchAction:v?`none`:`auto`},className:`block w-full h-full ${v?`cursor-crosshair touch-none`:``}`}),v&&y&&(0,l.jsxs)(`div`,{className:`absolute bottom-2.5 left-2.5 right-2.5 flex flex-wrap items-center justify-between gap-1.5 pointer-events-none z-10`,children:[(0,l.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-[#F8F4EC]/90 backdrop-blur-md border border-[#11100E]/20 text-[11px] font-medium text-[#11100E] shadow-xs`,children:[(0,l.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-[#C8232C] shrink-0`}),(0,l.jsx)(`span`,{children:M?P===0?`Arraste o dedo ou toque na tela para revelar a pintura`:`${P} ${P===1?`pincelada aplicada`:`pinceladas aplicadas`}`:`Toque ou arraste na tela para pintar`})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-1.5 pointer-events-auto`,children:[(0,l.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),I.current=[],F(0),N(!0),W()},className:`px-2.5 py-1 rounded-[3px] text-[11px] font-medium border transition-colors cursor-pointer ${M?`bg-[#C8232C] text-[#FAF7F0] border-[#11100E]`:`bg-[#F8F4EC]/92 text-[#11100E] border-[#11100E]/60 hover:bg-[#11100E] hover:text-[#FAF7F0]`}`,children:M?`Limpar & Pintar do Zero`:`Pintar do Zero (Toque)`}),M&&(0,l.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),I.current=[],F(0),N(!1),U.current=performance.now(),W()},className:`px-2.5 py-1 rounded-[3px] text-[11px] font-medium bg-[#11100E] text-[#FAF7F0] border border-[#11100E] hover:bg-[#272420] transition-colors cursor-pointer`,children:`Auto-Revelar`})]})]})]})},nt=({revealProgress:e,revealProgressRef:t,layers:n,colors:r,seed:i=8472,animated:a=!0,windSpeed:o=1,className:s=``,interactive:u=!0})=>{let f=(0,c.useRef)(null),_=(0,c.useRef)(!0),v=(0,c.useRef)({x:.5,y:.5,smoothX:.5,smoothY:.5,active:!1}),x=(0,c.useRef)(performance.now()),S={...D,...n},C={inkPrimary:r?.inkPrimary??`#141413`,energySecondary:r?.energySecondary??`#C8232C`,coreGlow:r?.coreGlow??`#FFF7F5`,sporeAccent:r?.sporeAccent??`#4A5559`};return(0,c.useEffect)(()=>{x.current=performance.now()},[i]),(0,c.useEffect)(()=>{let e=f.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.forEach(e=>{_.current=e.isIntersecting})},{threshold:.01});return t.observe(e),()=>t.disconnect()},[]),(0,c.useEffect)(()=>{let n=f.current;if(!n)return;let r=document.createElement(`canvas`),s=document.createElement(`canvas`),c=document.createElement(`canvas`),l=document.createElement(`canvas`),u=document.createElement(`canvas`),w=[],T=``,D=0,O=n.getBoundingClientRect(),k=new ResizeObserver(e=>{e[0]&&(O=e[0].contentRect,T=``)});k.observe(n);let j=(e,t,n)=>{let a=Math.floor(e*n),o=Math.floor(t*n);[r,s,c,l,u].forEach(e=>{e.width=a,e.height=o});let f=e<640,p=Math.min(e/(f?720:1200),t/700),_=r.getContext(`2d`);if(_&&S.sunIntensity>.02){_.save(),_.setTransform(n,0,0,n,0,0),_.clearRect(0,0,e,t);let r=e*(f?.75:.795),a=t*(f?.23:.275),o=Math.min(e,t)*(f?.185:.165)*Math.min(1.3,S.sunIntensity);z(_,r,a,o*1.08,o*1.05,.15,C.energySecondary,C.energySecondary,.88*Math.min(1,S.sunIntensity),i+11),_.save(),_.beginPath(),_.arc(r,a,o*.94,0,Math.PI*2),_.fillStyle=y(C.energySecondary,.94*Math.min(1,S.sunIntensity)),_.fill(),_.restore(),A(_,{spine:g(r,a,o*.92,o*.92,-Math.PI*.85,Math.PI*.95,0,0,64,.12,i+23),maxWidth:o*.24,bristleCount:16,dryBrushGap:.46,taperStart:.5,taperEnd:.92,color:C.energySecondary,alpha:.95*Math.min(1,S.sunIntensity),headReach:1,seed:i+29}),_.restore()}let v=s.getContext(`2d`);if(v){if(v.save(),v.setTransform(n,0,0,n,0,0),v.clearRect(0,0,e,t),S.mountainIntensity>.02){let n=e*(f?.68:.735),r=t*(f?.52:.485),a=e*(f?.065:.046),o=e*(f?.16:.33),s=e*.99,c=t*.79,l=Math.min(1,S.mountainIntensity);v.save(),v.beginPath(),v.moveTo(o,c),v.quadraticCurveTo(e*(f?.48:.58),t*.68,n-a,r+4*p),v.lineTo(n-a*.3,r),v.lineTo(n+a*.45,r+2*p),v.lineTo(n+a,r+6*p),v.quadraticCurveTo(e*.84,t*.65,s,c-12*p),v.closePath();let u=v.createLinearGradient(n,r,n,c);u.addColorStop(0,y(C.inkPrimary,.92*l)),u.addColorStop(.45,y(b(C.inkPrimary,C.sporeAccent,.45),.78*l)),u.addColorStop(.85,y(C.sporeAccent,.32*l)),u.addColorStop(1,y(C.sporeAccent,0)),v.fillStyle=u,v.fill(),v.restore(),A(v,{spine:h({x:n-a,y:r+4*p},{x:e*(f?.48:.58),y:t*.675},{x:o,y:c},56,.18,i+103),maxWidth:16*p,bristleCount:16,dryBrushGap:.38,taperStart:.4,taperEnd:.95,color:C.inkPrimary,alpha:.88*l,headReach:1,seed:i+107}),A(v,{spine:h({x:n+a,y:r+5*p},{x:e*.84,y:t*.64},{x:s,y:c-15*p},48,.18,i+109),maxWidth:14*p,bristleCount:14,dryBrushGap:.42,taperStart:.4,taperEnd:.95,color:C.inkPrimary,alpha:.85*l,headReach:1,seed:i+113});let m=d(i+151);for(let o=0;o<12;o++){let s=o/11*2-1,c=n+s*a*.92,u=r+Math.abs(s)*6*p,d=n+s*e*(.14+m()*.08),f=r+t*(.11+m()*.09);A(v,{spine:h({x:c,y:u},{x:(c+d)*.5,y:(u+f)*.5+6*p},{x:d,y:f},32,.22,i+o*29),maxWidth:(o%2==0?15:9)*p,bristleCount:9,dryBrushGap:.32,taperStart:.25,taperEnd:.92,color:o%2==0?`#FAF8F5`:C.inkPrimary,alpha:(o%2==0?.95:.78)*l,headReach:1,roundHeadCap:!1,seed:i+o*53})}}let r=Math.min(1,S.waterReflectionIntensity),a=Math.min(1,S.mistKumoIntensity);if(a>.02){let n=null;try{n=Xe.canvas(s)}catch{n=null}let r={...E,colors:{inkPrimary:b(C.sporeAccent,`#D6D1C7`,.6),energySecondary:`#EFECE4`,coreGlow:`#FAF8F4`,sporeAccent:C.sporeAccent}};for(let o=0;o<4;o++){let s=e*(.45+o*.14),c=t*(.75+o%2*.03);I(v,n,r,p,{startX:s-75*p,startY:c,endX:s+75*p,endY:c-8*p,maxThickness:28*p*a,lobeCount:3,flip:o%2==0?1:-1,alpha:.42*a,seed:i+300+o*37})}}if(r>.02){let n=t*.845;A(v,{spine:m({x:e*(f?.46:.56),y:n+6*p},{x:e*.68,y:n-12*p},{x:e*.82,y:n-22*p},{x:e*.95,y:n+4*p},44,.25,i+509),maxWidth:32*p,bristleCount:20,dryBrushGap:.22,taperStart:.75,taperEnd:.65,color:C.inkPrimary,alpha:.94*r,headReach:1,seed:i+521}),[{x:e*.61,y:n-2*p,h:24*p},{x:e*.65,y:n-4*p,h:30*p},{x:e*.71,y:n-8*p,h:46*p},{x:e*.755,y:n-12*p,h:64*p},{x:e*.805,y:n-10*p,h:52*p}].forEach((e,t)=>{let n=h({x:e.x,y:e.y},{x:e.x+(t%2==0?-3:3)*p,y:e.y-e.h*.5},{x:e.x,y:e.y-e.h},16,.15,i+600+t);A(v,{spine:n,maxWidth:4.2*p,bristleCount:5,dryBrushGap:.15,taperStart:.2,taperEnd:.7,color:C.inkPrimary,alpha:.95*r,seed:i+610+t});for(let n=0;n<3;n++){let a=e.y-e.h*(.45+n*.26),o=e.h*(.48-n*.08),s=h({x:e.x-o,y:a+2*p},{x:e.x,y:a-4*p},{x:e.x+o,y:a+2*p},18,.2,i+630+t*10+n);A(v,{spine:s,maxWidth:9*p,bristleCount:7,dryBrushGap:.3,taperStart:.7,taperEnd:.7,color:C.inkPrimary,alpha:.92*r,seed:i+650+t*10+n})}})}v.restore()}w=[];let x=c.getContext(`2d`);if(x&&S.sakuraBranchIntensity>.02){x.save(),x.setTransform(n,0,0,n,0,0),x.clearRect(0,0,e,t);let r=Math.min(1,S.sakuraBranchIntensity),a=m({x:-24*p,y:t*.68},{x:e*.11,y:t*.44},{x:e*.25,y:t*.18},{x:e*.46,y:-t*.08},80,.28,i+701);A(x,{spine:a,maxWidth:44*p*Math.min(1.25,S.sakuraBranchIntensity),bristleCount:24,dryBrushGap:.28,taperStart:.1,taperEnd:.99,color:C.inkPrimary,alpha:.96*r,headReach:1,roundHeadCap:!0,seed:i+709});let o=[{p0:{x:e*.12,y:t*.45},p1:{x:e*.28,y:t*.44},p2:{x:e*.44,y:t*.61},p3:{x:e*.58,y:t*.72},width:22*p},{p0:{x:e*.34,y:t*.52},p1:{x:e*.44,y:t*.55},p2:{x:e*.52,y:t*.49},p3:{x:e*.6,y:t*.43},width:10*p},{p0:{x:e*.1,y:t*.44},p1:{x:e*.13,y:t*.26},p2:{x:e*.1,y:t*.1},p3:{x:e*.05,y:-t*.07},width:15*p},{p0:{x:e*.21,y:t*.31},p1:{x:e*.33,y:t*.3},p2:{x:e*.46,y:t*.22},p3:{x:e*.58,y:t*.15},width:12*p},{p0:{x:e*.09,y:t*.53},p1:{x:e*.16,y:t*.62},p2:{x:e*.22,y:t*.69},p3:{x:e*.28,y:t*.75},width:9*p}],s=[a];if(o.forEach((e,t)=>{let n=m(e.p0,e.p1,e.p2,e.p3,48,.24,i+750+t*31);s.push(n),A(x,{spine:n,maxWidth:e.width*Math.min(1.25,S.sakuraBranchIntensity),bristleCount:14,dryBrushGap:.26,taperStart:.12,taperEnd:.99,color:C.inkPrimary,alpha:.95*r,headReach:1,roundHeadCap:!1,seed:i+760+t*31})}),S.sakuraPetalsIntensity>.02){let e=d(i+881);s.forEach((t,n)=>{let r=n===0?18:11;for(let a=0;a<r;a++){let o=.12+a/Math.max(1,r-1)*.87,s=t[Math.min(t.length-1,Math.floor(o*(t.length-1)))],c=1-o*.55,l=(e()-.45)*26*p*c,u=s.x+s.nx*l,d=s.y+s.ny*l,f=(8.5+e()*10.5)*p*Math.min(1.25,S.sakuraPetalsIntensity),m=.48+o*.26+n*.025+e()*.05;w.push({bx:u,by:d,radius:f,angle:a*.7+n*1.3,stainStart:Math.min(.84,m),seed:i+900+n*100+a})}})}x.restore()}let T=l.getContext(`2d`);if(T){T.save(),T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,a,o),T.drawImage(r,0,0),T.drawImage(s,0,0),T.drawImage(c,0,0),T.setTransform(n,0,0,n,0,0);let e=Math.min(1,S.sakuraPetalsIntensity);w.forEach(t=>{let n=T.createRadialGradient(t.bx,t.by,0,t.bx,t.by,t.radius*1.45);n.addColorStop(0,y(C.energySecondary,.22*e)),n.addColorStop(.65,y(C.energySecondary,.08*e)),n.addColorStop(1,y(C.energySecondary,0)),T.fillStyle=n,T.beginPath(),T.arc(t.bx,t.by,t.radius*1.45,0,Math.PI*2),T.fill(),V(T,t.bx,t.by,t.radius,t.angle,C.energySecondary,C.coreGlow,C.inkPrimary,.95*e,t.seed)}),T.restore()}},M=f=>{if(!_.current&&e===1){a&&(D=requestAnimationFrame(M));return}let m=Math.min(1.75,window.devicePixelRatio||1),g=Math.max(300,Math.floor(O.width||n.clientWidth||800)),b=Math.max(220,Math.floor(O.height||n.clientHeight||500)),E=Math.floor(g*m),k=Math.floor(b*m);(n.width!==E||n.height!==k)&&(n.width=E,n.height=k,T=``);let N=`${E}x${k}:${i}:${S.sunIntensity}:${S.mountainIntensity}:${S.sakuraBranchIntensity}:${S.sakuraPetalsIntensity}:${S.waterReflectionIntensity}:${S.mistKumoIntensity}:${C.inkPrimary}:${C.energySecondary}`;T!==N&&(j(g,b,m),T=N);let P=n.getContext(`2d`);if(!P)return;let F=(f-x.current)/1e3,I=Math.min(1,F/2.4),L=t?.current===void 0?e===void 0?I:e:t.current,R=Math.max(0,Math.min(1,L)),z=a?F*o:1.5,B=v.current,U=B.active?B.x:.5,W=B.active?B.y:.5;B.smoothX+=(U-B.smoothX)*.08,B.smoothY+=(W-B.smoothY)*.08;let G=g<640,K=Math.min(g/(G?720:1200),b/700),q=(B.smoothX-.5)*14*K,J=(B.smoothY-.5)*8*K;if(P.save(),P.setTransform(m,0,0,m,0,0),P.clearRect(0,0,g,b),R>=.998)P.drawImage(l,q*.35,J*.3,g,b);else{let e=g*(G?.75:.795)+q*.35,t=b*(G?.23:.275)+J*.25,n=Math.min(g,b)*(G?.185:.165)*Math.min(1.3,S.sunIntensity),i=Math.max(0,Math.min(1,R/.44));if(S.sunIntensity>.02&&i>.005){let a=1-(1-i)**3,o=n*(.35+a*.95),s=P.createRadialGradient(e,t,o*.08,e,t,o);s.addColorStop(0,y(C.energySecondary,.85*a)),s.addColorStop(.65,y(C.energySecondary,.55*a)),s.addColorStop(.88,y(C.energySecondary,.24*a)),s.addColorStop(1,y(C.energySecondary,0)),P.save(),P.fillStyle=s,P.beginPath(),P.arc(e,t,o,0,Math.PI*2),P.fill(),P.globalAlpha=i**1.4,P.drawImage(r,q*.35,J*.3,g,b),P.restore()}let a=Math.max(0,Math.min(1,(R-.1)/.52));if(a>.005){let e=u.getContext(`2d`);if(e){e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,E,k),e.drawImage(s,0,0),e.setTransform(m,0,0,m,0,0),e.globalCompositeOperation=`destination-in`;let t=1-(1-a)**2.5,n=g*.72,r=b*.65,i=Math.hypot(g*.75,b*.6)*t,o=e.createRadialGradient(n,r,i*.2,n,r,Math.max(10,i));o.addColorStop(0,`rgba(0,0,0,1)`),o.addColorStop(.82,`rgba(0,0,0,0.92)`),o.addColorStop(1,`rgba(0,0,0,0)`),e.fillStyle=o,e.fillRect(0,0,g,b),e.restore(),P.drawImage(u,q*.35,J*.3,g,b)}}let o=Math.max(0,Math.min(1,(R-.08)/.46));if(S.sakuraBranchIntensity>.02&&o>.005){let e=u.getContext(`2d`);if(e){e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,E,k),e.drawImage(c,0,0),e.setTransform(m,0,0,m,0,0),e.globalCompositeOperation=`destination-in`;let t=1-(1-o)**2.2,n=Math.hypot(g*.68,b*.85)*1.12,r=Math.max(12,n*t),i=b*.64,a=e.createRadialGradient(0,i,r*.55,0,i,r);a.addColorStop(0,`rgba(0,0,0,1)`),a.addColorStop(.85,`rgba(0,0,0,1)`),a.addColorStop(1,`rgba(0,0,0,0)`),e.fillStyle=a,e.fillRect(0,0,g,b),e.restore(),P.drawImage(u,q*.35,J*.3,g,b)}}if(S.sakuraPetalsIntensity>.02&&R>.48){let e=Math.min(1,S.sakuraPetalsIntensity);P.save(),P.translate(q*.35,J*.3);for(let t=0;t<w.length;t++){let n=w[t],r=(R-n.stainStart)/.16;if(r<=.01)continue;let i=Math.min(1,r),a=1-(1-i)**3,o=n.radius*(.4+a*1.25),s=i<.5?i/.5*.42*e:(.42-(i-.5)/.5*.2)*e,c=P.createRadialGradient(n.bx,n.by,0,n.bx,n.by,o);if(c.addColorStop(0,y(C.energySecondary,s*1.3)),c.addColorStop(.6,y(C.energySecondary,s*.7)),c.addColorStop(1,y(C.energySecondary,0)),P.fillStyle=c,P.beginPath(),P.arc(n.bx,n.by,o,0,Math.PI*2),P.fill(),i>.18){let t=1-(1-Math.min(1,(i-.18)/.82))**2.5;V(P,n.bx,n.by,n.radius*(.45+t*.55),n.angle,C.energySecondary,C.coreGlow,C.inkPrimary,.95*e*t,n.seed)}}P.restore()}}let Y=Math.max(0,Math.min(1,R*1.6));if(S.sunIntensity>.02&&Y>.2){let e=g*(G?.75:.795)+q*.35,t=b*(G?.23:.275)+J*.25,n=Math.min(g,b)*(G?.185:.165)*Y**.45*Math.min(1.3,S.sunIntensity),r=d(i+47);for(let a=0;a<7;a++){let o=t+n*(.58+a/7*.72),s=n*(1.12-Math.abs(a-2.5)*.12+Math.sin(z*1.5+a)*.04),c=(r()-.35)*n*.45;A(P,{spine:h({x:e-s+c,y:o},{x:e+c,y:o+(r()-.5)*2},{x:e+s+c,y:o},18,.05,i+a*19),maxWidth:Math.max(2.2,(5.8-a*.4)*K),bristleCount:5,dryBrushGap:.48,taperStart:.85,taperEnd:.85,color:C.energySecondary,alpha:(.8-a*.06)*Math.min(1,S.sunIntensity)*Y,headReach:Y,roundHeadCap:!1,seed:i+a*41})}}let ee=Math.max(0,Math.min(1,(R-.2)*1.4));if(S.waterReflectionIntensity>.02&&ee>.15){let e=Math.min(1,S.waterReflectionIntensity),t=d(i+401);for(let n=0;n<9;n++){let r=b*(.81+n/9*.16),a=g*(.28+t()*.62)+Math.sin(z*.9+n)*8*K,o=g*(.08+t()*.16);A(P,{spine:h({x:a-o,y:r},{x:a,y:r+Math.sin(z+n)*1.5},{x:a+o,y:r},18,.06,i+n*23),maxWidth:(4+n%3*2)*K,bristleCount:5,dryBrushGap:.52,taperStart:.85,taperEnd:.85,color:n%3==0?C.inkPrimary:C.sporeAccent,alpha:(.22+n%3*.11)*e*ee,headReach:ee,roundHeadCap:!1,seed:i+n*61})}}if(S.sakuraPetalsIntensity>.05&&R>.62){let e=Math.min(1,(R-.62)/.3),t=d(i+1201),n=Math.round((G?14:22)*Math.min(1.4,S.sakuraPetalsIntensity));for(let r=0;r<n;r++){let n=t()*g*.75,a=t()*b*.82,o=18+t()*24,s=(n+z*o*1.35+Math.sin(z*1.5+r)*20*K)%(g*.95),c=(a+z*o*.65+Math.cos(z*1.1+r)*12*K)%(b*.88),l=p(s*.005,c*.005,i+r);H(P,s,c,(5.5+r%4*2)*K,z*(1.2+r%3*.4)+l*Math.PI,.35+.6*Math.abs(Math.sin(z*2.1+r)),C.energySecondary,.88*e)}}P.restore(),(a||e===void 0&&!t)&&(D=requestAnimationFrame(M))};return D=requestAnimationFrame(M),()=>{cancelAnimationFrame(D),k.disconnect()}},[e,t,S.sunIntensity,S.mountainIntensity,S.sakuraBranchIntensity,S.sakuraPetalsIntensity,S.waterReflectionIntensity,S.mistKumoIntensity,C.inkPrimary,C.energySecondary,C.coreGlow,C.sporeAccent,i,a,o]),(0,l.jsx)(`canvas`,{ref:f,onPointerMove:e=>{if(!u)return;let t=e.currentTarget.getBoundingClientRect();v.current.x=(e.clientX-t.left)/Math.max(1,t.width),v.current.y=(e.clientY-t.top)/Math.max(1,t.height),v.current.active=!0},onPointerLeave:()=>{v.current.active=!1},className:`block w-full h-full select-none ${s}`})},rt={inkPrimary:`#141413`,energySecondary:`#C8232C`,coreGlow:`#FFF5F5`,sporeAccent:`#4A4742`};function it(e,t=880,n=460){let r=e=>e/880*t,i=e=>e/460*n,a=Math.max(.55,Math.min(t/820,n/440));return[{id:`preset-sun-wash`,brushType:`tarashikomi_wash`,layerId:`background`,colors:{...e},thickness:3.4*a,bristleCount:22,dryBrushGap:.2,seed:1011,points:[{x:r(640),y:i(130),pressure:.9,velocity:.12,timestamp:0},{x:r(690),y:i(125),pressure:.95,velocity:.1,timestamp:40},{x:r(740),y:i(140),pressure:.9,velocity:.12,timestamp:80}]},{id:`preset-fuji-left`,brushType:`sumi_kasure`,layerId:`midground`,colors:{...e},thickness:1.15*a,bristleCount:28,dryBrushGap:.35,seed:2022,points:[{x:r(625),y:i(185),pressure:.85,velocity:.2,timestamp:100},{x:r(540),y:i(245),pressure:.72,velocity:.35,timestamp:160},{x:r(440),y:i(305),pressure:.55,velocity:.5,timestamp:220},{x:r(330),y:i(345),pressure:.3,velocity:.75,timestamp:280}]},{id:`preset-fuji-right`,brushType:`sumi_kasure`,layerId:`midground`,colors:{...e},thickness:1.1*a,bristleCount:26,dryBrushGap:.38,seed:3033,points:[{x:r(648),y:i(185),pressure:.85,velocity:.2,timestamp:300},{x:r(720),y:i(250),pressure:.68,velocity:.42,timestamp:360},{x:r(815),y:i(325),pressure:.4,velocity:.68,timestamp:420}]},{id:`preset-sakura-branch-main`,brushType:`sakura_branch`,layerId:`foreground`,colors:{...e},thickness:1.2*a,bristleCount:24,dryBrushGap:.28,seed:4044,points:[{x:r(35),y:i(330),pressure:.95,velocity:.15,timestamp:450},{x:r(135),y:i(240),pressure:.82,velocity:.28,timestamp:520},{x:r(235),y:i(165),pressure:.68,velocity:.38,timestamp:590},{x:r(345),y:i(115),pressure:.52,velocity:.52,timestamp:660},{x:r(460),y:i(78),pressure:.35,velocity:.7,timestamp:730}]},{id:`preset-sakura-branch-lower`,brushType:`sakura_branch`,layerId:`foreground`,colors:{...e},thickness:.95*a,bristleCount:20,dryBrushGap:.32,seed:5055,points:[{x:r(125),y:i(245),pressure:.78,velocity:.24,timestamp:760},{x:r(235),y:i(255),pressure:.65,velocity:.36,timestamp:820},{x:r(345),y:i(285),pressure:.5,velocity:.48,timestamp:880},{x:r(455),y:i(315),pressure:.32,velocity:.65,timestamp:940}]}]}function at(e,t,n=1){if(t.points.length<2||n<=.01)return;let r=_(t.points,.14,t.seed),i=t.points.reduce((e,t)=>e+t.pressure,0)/t.points.length,a=32*t.thickness*(.45+i*.85),{inkPrimary:o,energySecondary:s,coreGlow:c,sporeAccent:l}=t.colors,u={...E,colors:t.colors,seed:t.seed};if(t.brushType===`tarashikomi_wash`){let c=Math.max(1,Math.floor(r.length/7)),l=Math.max(1,Math.floor(r.length*n));for(let n=0;n<l;n+=c){let c=r[n],l=Math.atan2(-c.nx,c.ny);z(e,c.x,c.y,a*.95*(.6+i*.6),a*.82*(.6+i*.6),l,s,o,.52,t.seed+n*19)}}else if(t.brushType===`sumi_kasure`){let i=r[Math.floor(r.length*.45)],s=Math.atan2(-r[0].nx,r[0].ny);z(e,i.x,i.y,a*1.3,a*.7,s,l,o,.16*n,t.seed+7),A(e,{spine:r,maxWidth:a,bristleCount:t.bristleCount,dryBrushGap:t.dryBrushGap,taperStart:.22,taperEnd:.58,color:o,alpha:.95,headReach:n,seed:t.seed})}else if(t.brushType===`sakura_branch`){A(e,{spine:r,maxWidth:a*.82,bristleCount:t.bristleCount,dryBrushGap:t.dryBrushGap*.9,taperStart:.15,taperEnd:.65,color:o,alpha:.96,headReach:n,seed:t.seed});let l=d(t.seed+333),u=Math.floor(r.length*n);for(let n=2;n<u;n+=3){if(l()<.22)continue;let u=r[n],d=(l()-.48)*a*1.15,f=u.x+u.nx*d,p=u.y+u.ny*d,m=(6.5+l()*8.5)*(.7+i*.5);l()>.55&&z(e,f,p,m*1.45,m*1.35,l()*Math.PI,s,o,.24,t.seed+n*41),V(e,f,p,m,l()*Math.PI*2,s,c,o,.94,t.seed+n*29)}}else if(t.brushType===`hokusai_wave`)F(e,null,r.slice(0,Math.max(6,Math.floor(r.length*n))),a*1.35,1,6,u,1,.95,t.seed);else if(t.brushType===`suibokuga_flame`){let i=r[0],o=r[Math.floor(r.length*.33*n)]||i,s=r[Math.floor(r.length*.66*n)]||o,c=r[Math.max(1,Math.floor((r.length-1)*n))]||s;M(e,null,u,1,{rootX:i.x,rootY:i.y,ctrl1X:o.x,ctrl1Y:o.y,ctrl2X:s.x,ctrl2Y:s.y,tipX:c.x,tipY:c.y,maxBellyWidth:a*1.4,striationCount:5,alpha:.94,seed:t.seed})}else if(t.brushType===`kumo_cloud`){let i=r[0],o=r[Math.max(1,Math.floor((r.length-1)*n))]||i;I(e,null,u,1,{startX:i.x,startY:i.y,endX:o.x,endY:o.y,maxThickness:a*1.25,lobeCount:3,alpha:.92,seed:t.seed})}}var ot=({activeBrush:e=`sakura_branch`,colors:t=rt,strokeThickness:n=1.25,bristleCount:r=26,dryBrushGap:i=.32,activeLayer:a=`foreground`,layerOpacities:o={background:1,midground:1,foreground:1},showReferenceGuide:s=!0,onTelemetryChange:u,actionsRef:d,className:f=``})=>{let p=(0,c.useRef)(null),m=(0,c.useRef)(null),h=(0,c.useRef)(!1),g=(0,c.useRef)(null),[_,v]=(0,c.useState)(!1),y=(0,c.useRef)([]),b=(0,c.useRef)(!1),x=(0,c.useRef)(null),S=(0,c.useRef)([]),C=(0,c.useRef)({active:!1,startTime:0,duration:2600});(0,c.useEffect)(()=>{let e=new Image;e.crossOrigin=`anonymous`,e.onload=()=>{g.current=e,h.current=!1,v(!0)},e.src=`/assets/aistudio/image_8f7809d3.png`},[]);let w=(0,c.useCallback)(()=>{h.current=!1},[]),T=(0,c.useCallback)((e,t,n,r)=>{if(e.save(),e.setTransform(r,0,0,r,0,0),e.clearRect(0,0,t,n),e.fillStyle=`#F4F1EA`,e.fillRect(0,0,t,n),s&&_&&g.current){e.save(),e.globalAlpha=.14;let r=g.current,i=r.width/Math.max(1,r.height),a=t/n,o=t,s=n,c=0,l=0;a>i?(o=t,s=t/i,l=(n-s)*.5):(s=n,o=n*i,c=(t-o)*.5),e.drawImage(r,c,l,o,s),e.restore()}[`background`,`midground`,`foreground`].forEach(t=>{let n=o[t]??1;n<=.01||(e.save(),e.globalAlpha=n,y.current.forEach(n=>{n.layerId===t&&at(e,n,1)}),e.restore())}),e.restore()},[o,_,s]),E=(0,c.useCallback)(()=>{let e=p.current;if(!e)return;let n=Math.min(1.75,window.devicePixelRatio||1),r=Math.max(240,e.clientWidth||640),i=Math.max(180,e.clientHeight||420);!b.current&&r>0&&i>0&&(y.current=it(t,r,i),b.current=!0,h.current=!1),(e.width!==Math.floor(r*n)||e.height!==Math.floor(i*n))&&(e.width=Math.floor(r*n),e.height=Math.floor(i*n),h.current=!1),m.current||=document.createElement(`canvas`);let a=m.current;(a.width!==e.width||a.height!==e.height)&&(a.width=e.width,a.height=e.height,h.current=!1);let s=e.getContext(`2d`),c=a.getContext(`2d`);if(!s||!c)return;let l=performance.now(),u=C.current.active,d=u?Math.min(1,(l-C.current.startTime)/C.current.duration):1;if(u){s.save(),s.setTransform(n,0,0,n,0,0),s.clearRect(0,0,r,i),s.fillStyle=`#F4F1EA`,s.fillRect(0,0,r,i);let e=[`background`,`midground`,`foreground`],t=Math.max(1,y.current.length);e.forEach(e=>{let n=o[e]??1;n<=.01||(s.save(),s.globalAlpha=n,y.current.forEach((n,r)=>{if(n.layerId!==e)return;let i=r/t,a=(r+1)/t,o=Math.max(0,Math.min(1,(d-i)/(a-i)));at(s,n,o)}),s.restore())}),s.restore()}else h.current||=(T(c,r,i,n),!0),s.save(),s.setTransform(n,0,0,n,0,0),s.clearRect(0,0,r,i),s.drawImage(a,0,0,r,i),x.current&&(s.globalAlpha=o[x.current.layerId]??1,at(s,x.current,1)),s.restore()},[t,o,T]);(0,c.useEffect)(()=>{w(),E()},[w,E,o,s,_]),(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=new ResizeObserver(()=>{w(),E()});return t.observe(e),()=>t.disconnect()},[w,E]);let D=(0,c.useCallback)(()=>{C.current={active:!0,startTime:performance.now(),duration:Math.max(1400,y.current.length*420)};let e=()=>{if(!C.current.active)return;let t=performance.now()-C.current.startTime;E(),t<C.current.duration?requestAnimationFrame(e):(C.current.active=!1,w(),E(),u?.({pressure:0,velocity:0,strokeCount:y.current.length,isReplaying:!1}))};u?.({pressure:.75,velocity:.5,strokeCount:y.current.length,isReplaying:!0}),requestAnimationFrame(e)},[w,u,E]);(0,c.useEffect)(()=>{d&&(d.current={replayStrokes:D,undoStroke:()=>{y.current=y.current.slice(0,-1),w(),E(),u?.({pressure:0,velocity:0,strokeCount:y.current.length,isReplaying:!1})},clearCanvas:()=>{y.current=[],w(),E(),u?.({pressure:0,velocity:0,strokeCount:0,isReplaying:!1})},loadFujiPresetStrokes:()=>{let e=p.current,n=Math.max(260,e?.clientWidth||880),r=Math.max(200,e?.clientHeight||460);y.current=it(t,n,r),w(),D()},exportPng:()=>{let e=p.current;if(!e)return;let t=document.createElement(`a`);t.download=`sumi-forge-painting-${Date.now()}.png`,t.href=e.toDataURL(`image/png`),t.click()}})},[d,t,w,u,E,D]);let O=o=>{let s=p.current;if(!s)return;try{s.setPointerCapture(o.pointerId)}catch{}let c=s.getBoundingClientRect(),l=o.clientX-c.left,d=o.clientY-c.top,f=o.pressure>0&&o.pressure!==.5?o.pressure:.72,m=performance.now();S.current=[{x:l,y:d,pressure:f,velocity:.15,timestamp:m}],x.current={id:`stroke-${Date.now()}`,brushType:e,layerId:a,colors:{...t},thickness:n,bristleCount:r,dryBrushGap:i,seed:Math.floor(Math.random()*9e4)+1e3,points:S.current},u?.({pressure:f,velocity:.15,strokeCount:y.current.length+1,isReplaying:!1})},k=e=>{if(!x.current||!p.current)return;let t=p.current.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=performance.now(),a=S.current[S.current.length-1],o=a?Math.hypot(n-a.x,r-a.y):0;if(o<3)return;let s=Math.max(1,i-(a?.timestamp||i-16)),c=Math.min(1,o/s/2.2),l=Math.max(.22,Math.min(1,.94-c*.62)),d=e.pressure>0&&e.pressure!==.5?e.pressure:l;S.current.push({x:n,y:r,pressure:d,velocity:c,timestamp:i}),x.current.points=S.current,E(),u?.({pressure:d,velocity:c,strokeCount:y.current.length+1,isReplaying:!1})},A=()=>{if(x.current){if(S.current.length===1){let e=S.current[0];S.current.push({x:e.x+18,y:e.y-8,pressure:e.pressure*.95,velocity:.18,timestamp:e.timestamp+16},{x:e.x+36,y:e.y-14,pressure:e.pressure*.75,velocity:.25,timestamp:e.timestamp+32}),x.current.points=S.current}S.current.length>=2&&(y.current.push(x.current),w()),x.current=null,S.current=[],E(),u?.({pressure:0,velocity:0,strokeCount:y.current.length,isReplaying:!1})}};return(0,l.jsx)(`canvas`,{ref:p,onPointerDown:O,onPointerMove:k,onPointerUp:A,onPointerCancel:A,style:{touchAction:`none`},className:`block w-full h-full cursor-crosshair touch-none select-none ${f}`})},st=({variant:e=`horizontal_kasure`,inkColor:t=`#141413`,accentColor:n=`#C8232C`,bristleCount:r=18,dryBrushGap:i=.36,thickness:a=14,seed:o=4096,animateOnMount:s=!0,className:u=``})=>{let d=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let c=d.current;if(!c)return;let l=0,u=performance.now(),f=d=>{let p=c.getBoundingClientRect(),_=Math.min(2,window.devicePixelRatio||1),v=Math.max(120,Math.floor(p.width)),y=Math.max(28,Math.floor(p.height));(c.width!==v*_||c.height!==y*_)&&(c.width=v*_,c.height=y*_);let b=c.getContext(`2d`);if(!b)return;b.save(),b.setTransform(_,0,0,_,0,0),b.clearRect(0,0,v,y);let x=s?Math.min(1,(d-u)/950):1,S=1-(1-x)**3.2;if(e===`enso_seal`){let e=Math.min(v,y)*.38;A(b,{spine:g(v*.5,y*.5,e,e*.96,-Math.PI*.8,Math.PI*.95,0,-.05,72,.12,o),maxWidth:a,bristleCount:r,dryBrushGap:i,taperStart:.85,taperEnd:.98,color:t,headReach:S,seed:o})}else if(e===`s_curve_flourish`)A(b,{spine:m({x:12,y:y*.65},{x:v*.32,y:y*.15},{x:v*.68,y:y*.85},{x:v-12,y:y*.35},72,.12,o),maxWidth:a,bristleCount:r,dryBrushGap:i,taperStart:.75,taperEnd:.95,color:t,headReach:S,seed:o});else if(e===`sakura_branch_divider`){let e=m({x:8,y:y*.58},{x:v*.35,y:y*.32},{x:v*.65,y:y*.68},{x:v-12,y:y*.42},72,.18,o);A(b,{spine:e,maxWidth:a,bristleCount:r,dryBrushGap:i,taperStart:.2,taperEnd:.95,color:t,headReach:S,seed:o}),[.22,.46,.72,.88].forEach((r,i)=>{if(r>S)return;let s=e[Math.floor(r*(e.length-1))];s&&V(b,s.x,s.y+(i%2==0?-4:4),Math.min(y*.32,a*.75),i*.9,n,`#FFF5F5`,t,.95,o+i*31)})}else A(b,{spine:h({x:8,y:y*.55},{x:v*.48,y:y*.42},{x:v-8,y:y*.52},64,.1,o),maxWidth:a,bristleCount:r,dryBrushGap:i,taperStart:.8,taperEnd:.95,color:t,headReach:S,seed:o});b.restore(),x<1&&(l=requestAnimationFrame(f))};return l=requestAnimationFrame(f),()=>cancelAnimationFrame(l)},[e,t,n,r,i,a,o,s]),(0,l.jsx)(`canvas`,{ref:d,className:`block w-full select-none ${u}`})},ct=({config:e,mode:t=`player`,fixedFrame:n=null,size:r=256,paused:i=!1,onFrameTick:a,className:o=``})=>{let s=(0,c.useRef)(null),u=(0,c.useRef)(0),d=(0,c.useRef)(!0),f={...E,...e,colors:{...E.colors,...e?.colors},brush:{...E.brush,...e?.brush},dynamics:{...E.dynamics,...e?.dynamics},rough:{...E.rough,...e?.rough}};return(0,c.useEffect)(()=>{let e=s.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.forEach(e=>{d.current=e.isIntersecting})},{rootMargin:`80px 0px`,threshold:.01});return t.observe(e),()=>t.disconnect()},[]),(0,c.useEffect)(()=>{let e=s.current;if(!e)return;if(t===`spritesheet`){Qe(e,f,4);return}e.width=r,e.height=r;let o=e.getContext(`2d`);if(!o)return;let c=e=>{o.clearRect(0,0,r,r),Ze(o,e,f.totalFrames,r,r,f,f.bgMode===`checker`||f.bgMode===`transparent`)};if(n!==null||i){c(n===null?u.current:n);return}c(u.current);let l=0,p=performance.now(),m=1e3/Math.max(1,f.fps),h=e=>{d.current&&e-p>=m&&(p=e,u.current=(u.current+1)%f.totalFrames,c(u.current),a?.(u.current)),l=requestAnimationFrame(h)};return l=requestAnimationFrame(h),()=>cancelAnimationFrame(l)},[f,t,n,r,i,a]),(0,l.jsx)(`canvas`,{ref:s,className:`block max-w-full h-auto select-none ${f.bgMode===`checker`?`checker-bg`:``} ${o}`})},lt=({theme:e,scrollProgress:t=1,scrollProgressRef:n,school:r=`fuji_sakura`,seed:i=8472,ambientMotion:a=!0,className:o=``})=>{let s=(0,c.useRef)(null),u=(0,c.useRef)(null),f=(0,c.useRef)(``),p=(0,c.useRef)(!0),_=(0,c.useRef)(performance.now());return(0,c.useEffect)(()=>{let t=s.current;if(!t||typeof IntersectionObserver>`u`)return;if(e===`header_single_stroke`){p.current=!0;return}let n=new IntersectionObserver(e=>{e.forEach(e=>{p.current=e.isIntersecting})},{rootMargin:`120px 0px`,threshold:.01});return n.observe(t),()=>n.disconnect()},[e]),(0,c.useEffect)(()=>{let o=s.current;if(!o)return;u.current||=document.createElement(`canvas`);let c=u.current,l=0,v=o.getBoundingClientRect(),x=new ResizeObserver(e=>{e[0]&&(v=e[0].contentRect,f.current=``)});x.observe(o);let S=(t,n,a,o,s,c)=>{if(t.save(),t.setTransform(s,0,0,s,0,0),t.clearRect(0,0,a,o),c<=.005){t.restore();return}let l=a<640,u=Math.min(a/(l?760:1280),Math.max(.62,o/520)),d=w[r]?.colors??w.fuji_sakura.colors,f={...E,school:r,colors:d,seed:i},p=null;try{p=Xe.canvas(n)}catch{p=null}if(e===`header_single_stroke`){let e=(a+48)*c;t.save(),t.beginPath(),t.moveTo(-24,0),t.lineTo(e,0),t.quadraticCurveTo(e-12,o*.62,Math.max(-24,e-36),o-4),t.bezierCurveTo(e*.68,o-1,e*.32,o-6,-24,o-3),t.closePath();let n=t.createLinearGradient(0,0,0,o);n.addColorStop(0,`rgba(245, 240, 230, 0.97)`),n.addColorStop(.78,`rgba(239, 232, 219, 0.95)`),n.addColorStop(1,`rgba(230, 221, 206, 0.88)`),t.fillStyle=n,t.fill(),t.restore(),A(t,{spine:m({x:-20,y:o*.5},{x:a*.34,y:o*.46},{x:a*.68,y:o*.54},{x:a+28,y:o*.49},60,.03,i+7),maxWidth:o*1.15,bristleCount:18,dryBrushGap:.25,taperStart:.04,taperEnd:.14,color:`#E5DCCB`,alpha:.45,headReach:c,roundHeadCap:!0,seed:i+13});let r=m({x:-16,y:o-4.5},{x:a*.35,y:o-6.5},{x:a*.7,y:o-3},{x:a+20,y:o-5},64,.04,i+19);if(A(t,{spine:r,maxWidth:5.5,bristleCount:10,dryBrushGap:.28,taperStart:.08,taperEnd:.65,color:`#4A453E`,alpha:.34,headReach:c,roundHeadCap:!0,seed:i+23}),A(t,{spine:r,maxWidth:3.2,bristleCount:7,dryBrushGap:.22,taperStart:.12,taperEnd:.78,color:`#C8232C`,offsetNormal:1.5,alpha:.72,headReach:Math.max(0,c-.04),roundHeadCap:!0,seed:i+29}),c>.65){let e=Math.min(.85,(c-.65)*2.5);H(t,a*.88,o-7,5.5,.4,.7,`#C8232C`,e),H(t,a*.91,o-4,4.2,1.2,.55,`#E11D48`,e)}}else if(e===`sakura_katana_canopy`)z(t,a*.84,o*.18,a*.15*c,a*.15*c,0,`#FFF5F5`,`#C8232C`,.2,i+19),W(t,a+18,o*.14,a*(l?.56:.65),o*.04,-1,Math.max(16,26*u),c,0,d.inkPrimary,d.energySecondary,d.coreGlow,i+101),W(t,-18,o*.94,a*(l?.36:.28),o*.81,1,Math.max(15,24*u),c,1.5,d.inkPrimary,d.energySecondary,d.coreGlow,i+149);else if(e===`koi_river_rapids`){let e=w.calligraphy_tide.colors,n={...f,colors:e},r=m({x:-a*.05,y:o*.82},{x:a*.34,y:o*.14},{x:a*.66,y:o*.88},{x:a*1.05,y:o*.22},72,.1,i+211);A(t,{spine:r,maxWidth:Math.max(95,185*u),bristleCount:22,dryBrushGap:.38,taperStart:.15,taperEnd:.15,color:`#38BDF8`,alpha:.22*c,headReach:c,hookWaves:3,roundHeadCap:!1,seed:i+223}),A(t,{spine:r,maxWidth:Math.max(42,82*u),bristleCount:14,dryBrushGap:.44,taperStart:.15,taperEnd:.25,color:`#081C2E`,offsetNormal:18*u,alpha:.24*c,headReach:c,roundHeadCap:!1,seed:i+229});let s=m({x:-a*.03,y:o*.92},{x:a*.11,y:o*.78},{x:a*.16,y:o*.38},{x:a*.27,y:o*.2},52,.14,i+241).filter(e=>e.t<=c);s.length>=8&&F(t,p,s.map((e,t,n)=>({...e,t:t/Math.max(1,n.length-1)})),Math.max(34,66*u),1,6,n,Math.max(.85,u*1.1),.68,i+251);let d=m({x:a*1.03,y:o*.88},{x:a*.89,y:o*.76},{x:a*.84,y:o*.44},{x:a*.74,y:o*.28},52,.14,i+263).filter(e=>e.t<=c);d.length>=8&&F(t,p,d.map((e,t,n)=>({...e,t:t/Math.max(1,n.length-1)})),Math.max(32,58*u),-1,5,n,Math.max(.82,u*1.05),.64,i+271),W(t,a+14,o*.07,a*(l?.68:.76),o*.16,1,Math.max(14,22*u),c,0,`#11100E`,`#C8232C`,`#FFF5F5`,i+299)}else if(e===`misty_mountains_sakura`)[{x0:-a*.02,xPeak:a*.16,x1:a*.42,yPeak:o*.56,yBase:o*.98,alpha:.2},{x0:a*.58,xPeak:a*.84,x1:a*1.03,yPeak:o*.52,yBase:o*.98,alpha:.22}].forEach((e,n)=>{t.save(),t.beginPath(),t.moveTo(e.x0,e.yBase),t.quadraticCurveTo((e.x0+e.xPeak)*.5,(e.yBase+e.yPeak)*.52,e.xPeak,e.yPeak),t.quadraticCurveTo((e.xPeak+e.x1)*.5,(e.yBase+e.yPeak)*.52,e.x1,e.yBase),t.closePath();let r=t.createLinearGradient(e.xPeak,e.yPeak,e.xPeak,e.yBase);r.addColorStop(0,y(d.inkPrimary,e.alpha*c)),r.addColorStop(.7,y(b(d.inkPrimary,`#4A5559`,.5),e.alpha*.5*c)),r.addColorStop(1,y(d.inkPrimary,0)),t.fillStyle=r,t.fill(),t.restore(),A(t,{spine:h({x:e.xPeak,y:e.yPeak},{x:(e.x0+e.xPeak)*.5,y:(e.yBase+e.yPeak)*.52},{x:e.x0,y:e.yBase},36,.16,i+310+n*17),maxWidth:15*u,bristleCount:12,dryBrushGap:.38,taperStart:.25,taperEnd:.95,color:d.inkPrimary,alpha:.42*c,headReach:c,seed:i+320+n*17})}),L(t,p,a*.15,o*.18,Math.max(140,235*u*c),4,f,Math.max(.8,u),.26*c,i+331),L(t,p,a*.85,o*.78,Math.max(150,250*u*c),4,f,Math.max(.8,u),.26*c,i+347),W(t,-14,o*.96,a*(l?.28:.2),o*.76,1,Math.max(16,24*u),c,0,d.inkPrimary,`#C8232C`,`#FFF5F5`,i+373),W(t,a+14,o*.96,a*(l?.72:.8),o*.76,-1,Math.max(16,24*u),c,1.2,d.inkPrimary,`#C8232C`,`#FFF5F5`,i+389);else if(e===`enso_imperial_seal`){let e=a*.5,n=o*.52,r=Math.min(a,o)*.44;z(t,e,n,r*1.04*c,r*1.02*c,.1,d.coreGlow,d.energySecondary,.18*c,i+401);let s=g(e,n,r,r*.96,-Math.PI*.82,Math.PI*.96,0,-.06,84,.16,i+419);A(t,{spine:s,maxWidth:Math.max(20,38*u),bristleCount:24,dryBrushGap:.36,taperStart:.85,taperEnd:.99,color:d.inkPrimary,alpha:.28,headReach:c,roundHeadCap:!0,seed:i+431}),A(t,{spine:s,maxWidth:Math.max(7,13*u),bristleCount:12,dryBrushGap:.42,taperStart:.85,taperEnd:.99,color:d.energySecondary,offsetNormal:6*u,alpha:.34,headReach:Math.max(0,c-.08),seed:i+449}),W(t,-12,o*.84,a*(l?.28:.22),o*.52,1,Math.max(15,23*u),c,0,d.inkPrimary,d.energySecondary,d.coreGlow,i+463),W(t,a+12,o*.22,a*(l?.72:.78),o*.5,-1,Math.max(15,23*u),c,1.1,d.inkPrimary,d.energySecondary,d.coreGlow,i+479)}t.restore()},C=s=>{if(!p.current&&e!==`header_single_stroke`){a&&(l=requestAnimationFrame(C));return}let u=Math.min(1.75,window.devicePixelRatio||1),m=Math.max(240,Math.floor(v.width||o.clientWidth||600)),h=Math.max(52,Math.floor(v.height||o.clientHeight||120)),g=Math.floor(m*u),y=Math.floor(h*u);(o.width!==g||o.height!==y)&&(o.width=g,o.height=y,c.width=g,c.height=y,f.current=``);let b=o.getContext(`2d`),x=c.getContext(`2d`);if(!b||!x)return;let T=n?n.current:t,E=Math.max(0,Math.min(1,T));if(e===`header_single_stroke`&&E<=.005){b.clearRect(0,0,g,y);return}let D=e===`header_single_stroke`?Math.min(1,E**.6):Math.min(1,E**.65*1.15),O=D>=.995?1:Math.round(D*60)/60,k=`${e}:${g}x${y}:${O}:${r}:${i}`;if(f.current!==k&&(S(x,c,m,h,u,O),f.current=k),b.save(),b.setTransform(u,0,0,u,0,0),b.clearRect(0,0,m,h),b.drawImage(c,0,0,m,h),a&&D>.1){let t=(s-_.current)/1e3,n=m<640,a=Math.min(m/(n?760:1280),Math.max(.62,h/520)),o=w[r]?.colors??w.fuji_sakura.colors;if(e===`sakura_katana_canopy`){let e=d(i+199),r=n?10:15;for(let n=0;n<r;n++){let r=e()*m,i=e()*h;H(b,(r+t*(16+n%5*5)+Math.sin(t+n)*16)%m,(i+t*(7+n%3*4)+Math.cos(t+n)*10)%h,(5+n%4*1.8)*a,t*1.4+n,.35+.55*Math.abs(Math.sin(t*2+n)),o.energySecondary,.72*D)}}else if(e===`koi_river_rapids`&&D>.15){let e=Math.min(.95,(D-.12)*1.35);U(b,m*.56+Math.cos(t*.6)*22*a,h*.18+Math.sin(t*.75)*12*a,Math.max(95,160*a),-.24+Math.sin(t*.7)*.08,t*3.2,`#11100E`,`#C8232C`,`#FAF8F5`,e,i+281),U(b,m*.08+Math.sin(t*.55)*16*a,h*.43+Math.cos(t*.7)*18*a,Math.max(88,145*a),-.95+Math.cos(t*.65)*.08,t*3+1.4,`#11100E`,`#E11D48`,`#FFF7ED`,e,i+293),U(b,m*.63+Math.sin(t*.5)*24*a,h*.91+Math.cos(t*.6)*10*a,Math.max(90,148*a),-Math.PI+.28+Math.sin(t*.6)*.07,t*3.1+2.7,`#11100E`,`#C8232C`,`#FAF8F5`,e,i+307)}else if(e===`misty_mountains_sakura`){let e=d(i+395);for(let n=0;n<10;n++){let r=e()*m,i=e()*h;H(b,(r+t*(14+n%4*4)+Math.sin(t+n)*14)%m,(i+t*(6+n%3*3)+Math.cos(t+n)*8)%h,(4.8+n%3*1.6)*a,t*1.2+n,.4+.5*Math.abs(Math.sin(t*1.8+n)),`#C8232C`,.65*D)}}else if(e===`enso_imperial_seal`){let e=m*.5,n=h*.52,r=Math.min(m,h)*.44,s=d(i+499);for(let i=0;i<12;i++){let c=i/12*Math.PI*2+t*.22,l=r*(.85+(s()-.3)*.35);H(b,e+Math.cos(c)*l,n+Math.sin(c)*l,Math.max(5,8*a*D),t*1.3+i,.4+.5*Math.abs(Math.sin(t+i)),o.energySecondary,.5*D)}}}b.restore(),(a||n)&&(l=requestAnimationFrame(C))};return l=requestAnimationFrame(C),()=>{cancelAnimationFrame(l),x.disconnect()}},[e,t,n,r,i,a]),(0,l.jsx)(`canvas`,{ref:s,className:`block w-full h-full pointer-events-none select-none ${o}`})},ut=({name:e,size:t=22,color:n=`#11100E`,seed:r=101,className:i=``})=>{let a=(0,c.useRef)(null),o=Math.max(20,t);return(0,c.useEffect)(()=>{let t=a.current;if(!t)return;let i=Math.max(2,Math.min(3,window.devicePixelRatio||2));t.width=o*i,t.height=o*i;let s=t.getContext(`2d`);if(!s)return;let c=n;n===`currentColor`&&t.parentElement&&(c=window.getComputedStyle(t.parentElement).color||`#11100E`),s.save(),s.scale(i,i),s.clearRect(0,0,o,o),s.lineCap=`round`,s.lineJoin=`round`;let l=Xe.canvas(t),u=o/24,d={stroke:c,strokeWidth:Math.max(1.85,2*u),roughness:.22,bowing:.25,preserveVertices:!0,disableMultiStroke:!1,seed:r},f={...d,fill:c,fillStyle:`solid`};if(e===`logo`)A(s,{spine:g(12*u,12*u,9.2*u,9*u,-Math.PI*.78,Math.PI*1.05,0,0,36,.08,r),maxWidth:3.4*u,bristleCount:10,dryBrushGap:.22,taperStart:.7,taperEnd:.98,color:c,alpha:.95,roundHeadCap:!0,seed:r});else if(e===`brush`)l.polygon([[20.2*u,2.5*u],[21.5*u,3.8*u],[13.4*u,12.6*u],[11.4*u,10.6*u]],f),l.line(9.8*u,11.2*u,12.8*u,14.2*u,{...d,strokeWidth:Math.max(2.1,2.3*u)}),l.curve([[9.6*u,11.8*u],[6*u,14.2*u],[4.2*u,18.2*u],[2.5*u,21.2*u]],d),l.curve([[12.2*u,14.4*u],[10.2*u,18.2*u],[6.8*u,20.4*u],[2.5*u,21.2*u]],d),l.curve([[10.9*u,13.1*u],[8*u,16.5*u],[5.2*u,19.2*u],[2.5*u,21.2*u]],{...d,strokeWidth:Math.max(1.3,1.45*u)});else if(e===`katana`)l.curve([[7.5*u,16.5*u],[14*u,9.5*u],[21*u,3*u]],{...d,strokeWidth:Math.max(2.2,2.4*u)}),l.line(6*u,13.5*u,10.5*u,18*u,{...d,strokeWidth:Math.max(2.3,2.5*u)}),l.line(3*u,21*u,7.5*u,16.5*u,{...d,strokeWidth:Math.max(2.4,2.6*u)});else if(e===`sakura`){for(let e=0;e<5;e++){let t=e/5*Math.PI*2-Math.PI/2,n=12*u+Math.cos(t)*6.2*u,r=12*u+Math.sin(t)*6.2*u;l.circle(n,r,6.2*u,d)}l.circle(12*u,12*u,3.2*u,f)}else e===`koi`?(l.curve([[3.5*u,14.5*u],[8*u,6.5*u],[15.5*u,7.5*u],[19*u,12*u]],d),l.curve([[3.5*u,14.5*u],[9.5*u,16*u],[15*u,14.2*u],[19*u,12*u]],d),l.circle(8.2*u,11.2*u,3.2*u,f),l.polygon([[18.5*u,12*u],[22*u,8*u],[20.6*u,12*u],[22*u,16*u]],f)):e===`mountain`?(l.circle(17.5*u,6.5*u,5.2*u,d),l.polygon([[2*u,19.5*u],[8.8*u,7.5*u],[13.2*u,7.5*u],[20.5*u,19.5*u]],d),l.linearPath([[6.8*u,11.5*u],[9.5*u,10.5*u],[11*u,12*u],[12.5*u,10.5*u],[15.2*u,11.5*u]],d)):e===`scroll`?(l.rectangle(5.5*u,4*u,13*u,16*u,d),l.line(4*u,4*u,20*u,4*u,{...d,strokeWidth:Math.max(2.2,2.4*u)}),l.line(4*u,20*u,20*u,20*u,{...d,strokeWidth:Math.max(2.2,2.4*u)}),l.line(8.5*u,9*u,15.5*u,9*u,d),l.line(8.5*u,13*u,15.5*u,13*u,d)):e===`play`?l.polygon([[6.5*u,4.5*u],[19.5*u,12*u],[6.5*u,19.5*u]],f):e===`pause`?(l.rectangle(6*u,4.5*u,4.2*u,15*u,f),l.rectangle(13.8*u,4.5*u,4.2*u,15*u,f)):e===`replay`?(l.arc(12*u,12.5*u,14.5*u,14.5*u,.25,Math.PI*1.65,!1,d),l.polygon([[15.5*u,3*u],[21*u,6.2*u],[15.2*u,9.5*u]],f)):e===`copy`?(l.rectangle(8.5*u,8.5*u,11.5*u,11.5*u,d),l.linearPath([[15.5*u,8.5*u],[15.5*u,4.5*u],[4.5*u,4.5*u],[4.5*u,15.5*u],[8.5*u,15.5*u]],d)):e===`check`?l.linearPath([[4*u,12.5*u],[9.5*u,18*u],[20*u,6*u]],{...d,strokeWidth:Math.max(2.4,2.7*u)}):e===`download`?(l.line(12*u,3.5*u,12*u,15*u,d),l.linearPath([[7*u,10.5*u],[12*u,15.8*u],[17*u,10.5*u]],d),l.line(4.5*u,20*u,19.5*u,20*u,{...d,strokeWidth:Math.max(2.2,2.4*u)})):e===`upload`?(l.line(12*u,16*u,12*u,4.5*u,d),l.linearPath([[7*u,9.5*u],[12*u,4.2*u],[17*u,9.5*u]],d),l.line(4.5*u,20*u,19.5*u,20*u,{...d,strokeWidth:Math.max(2.2,2.4*u)})):e===`undo`?(l.linearPath([[9.5*u,5*u],[4.5*u,9.5*u],[9.5*u,14*u]],d),l.curve([[5*u,9.5*u],[15*u,9*u],[19.5*u,13.5*u],[16*u,19.5*u]],d)):e===`trash`?(l.line(4*u,6.5*u,20*u,6.5*u,d),l.line(9.5*u,3.8*u,14.5*u,3.8*u,d),l.rectangle(6.5*u,6.8*u,11*u,13.2*u,d),l.line(10.2*u,10.5*u,10.2*u,16.5*u,d),l.line(13.8*u,10.5*u,13.8*u,16.5*u,d)):e===`eye`?(l.curve([[2*u,12*u],[12*u,4.8*u],[22*u,12*u]],d),l.curve([[2*u,12*u],[12*u,19.2*u],[22*u,12*u]],d),l.circle(12*u,12*u,5.4*u,f)):e===`layers`?(l.polygon([[12*u,3.2*u],[21*u,8*u],[12*u,12.8*u],[3*u,8*u]],d),l.linearPath([[3*u,12.8*u],[12*u,17.2*u],[21*u,12.8*u]],d),l.linearPath([[3*u,16.8*u],[12*u,21.2*u],[21*u,16.8*u]],d)):e===`sliders`?(l.line(3.5*u,7*u,20.5*u,7*u,d),l.circle(9*u,7*u,5.2*u,f),l.line(3.5*u,16.5*u,20.5*u,16.5*u,d),l.circle(15.5*u,16.5*u,5.2*u,f)):e===`chevron-down`?l.linearPath([[5*u,8.5*u],[12*u,15.8*u],[19*u,8.5*u]],{...d,strokeWidth:Math.max(2.1,2.3*u)}):e===`close`?(l.line(5.5*u,5.5*u,18.5*u,18.5*u,d),l.line(18.5*u,5.5*u,5.5*u,18.5*u,d)):e===`terminal`&&(l.linearPath([[4*u,6.5*u],[10.5*u,12*u],[4*u,17.5*u]],{...d,strokeWidth:Math.max(2.2,2.4*u)}),l.line(12*u,17.5*u,20*u,17.5*u,{...d,strokeWidth:Math.max(2.2,2.4*u)}));s.restore()},[e,o,n,r]),(0,l.jsx)(`canvas`,{ref:a,style:{width:o,height:o},className:`inline-block shrink-0 pointer-events-none select-none ${i}`,"aria-hidden":`true`})},dt=({size:e=36,className:t=``})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let t=n.current;if(!t)return;let r=Math.max(2,Math.min(3,window.devicePixelRatio||2));t.width=e*r,t.height=e*r;let i=t.getContext(`2d`);if(!i)return;i.save(),i.scale(r,r),i.clearRect(0,0,e,e);let a=e/40;Xe.canvas(t).circle(25.5*a,14.5*a,14.5*a,{stroke:`#C8232C`,fill:`#C8232C`,fillStyle:`solid`,roughness:.25,preserveVertices:!0,seed:77}),A(i,{spine:g(20*a,20*a,15.5*a,15.2*a,-Math.PI*.82,Math.PI*.98,0,-.05,54,.08,8472),maxWidth:4.8*a,bristleCount:14,dryBrushGap:.22,taperStart:.65,taperEnd:.98,color:`#11100E`,alpha:.96,roundHeadCap:!0,seed:8472}),A(i,{spine:h({x:10*a,y:29*a},{x:20*a,y:27*a},{x:31*a,y:28.5*a},24,.04,99),maxWidth:2.6*a,bristleCount:8,dryBrushGap:.18,taperStart:.3,taperEnd:.9,color:`#C8232C`,alpha:.9,roundHeadCap:!0,seed:99}),i.font=`700 ${Math.round(17.5*a)}px "Cormorant Garamond", Georgia, serif`,i.textAlign=`center`,i.textBaseline=`middle`,i.fillStyle=`#11100E`,i.fillText(`墨`,19.5*a,19.5*a),i.restore()},[e]),(0,l.jsx)(`canvas`,{ref:n,style:{width:e,height:e},className:`inline-block shrink-0 pointer-events-none select-none ${t}`,"aria-hidden":`true`})},ft=new Map;function pt(e,t,n,r,i){let a=`${e}x${t}:${n}:${r??`none`}:${i}`,o=ft.get(a);if(o)return{mainPaths:[o[0]??``],accentPaths:o[1]?[o[1]]:[]};if(typeof document>`u`||e<8||t<8)return{mainPaths:[],accentPaths:[]};let s=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),c=Xe.svg(s),l=c.rectangle(1.5,1.5,Math.max(4,e-3),Math.max(4,t-3),{stroke:n,strokeWidth:1.45,roughness:.36,bowing:.28,preserveVertices:!0,seed:i}),u=[];l.querySelectorAll(`path`).forEach(e=>{let t=e.getAttribute(`d`);t&&u.push(t)});let d=[];return r&&e>24&&t>20&&c.rectangle(3.5,3.5,Math.max(4,e-7),Math.max(4,t-7),{stroke:r,strokeWidth:.75,roughness:.25,bowing:.2,preserveVertices:!0,seed:i+17}).querySelectorAll(`path`).forEach(e=>{let t=e.getAttribute(`d`);t&&d.push(t)}),ft.set(a,[u.join(` `),d.join(` `)]),{mainPaths:u,accentPaths:d}}var mt=({variant:e=`washi`,size:t=`md`,active:n=!1,seed:r=108,fullWidth:i=!1,className:a=``,children:o,disabled:s,...u})=>{let d=(0,c.useRef)(null),[f,p]=(0,c.useState)({w:0,h:0}),[m,h]=(0,c.useState)(!1);(0,c.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=Math.round(t.width),r=Math.round(t.height);p(e=>e.w===n&&e.h===r?e:{w:n,h:r})};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[o,t,i]);let g=n?e===`crimson`?`crimson`:`ink`:e,_=``,v=``,y=`#11100E`,b=null;g===`crimson`?(_=m&&!s?`bg-[#A81B23]`:`bg-[#C8232C]`,v=`text-[#FAF7F0]`,y=`#11100E`,b=`rgba(250, 247, 240, 0.35)`):g===`ink`?(_=m&&!s?`bg-[#25221F]`:`bg-[#11100E]`,v=`text-[#F5F0E6]`,y=m||n?`#C8232C`:`#11100E`,b=`rgba(245, 240, 230, 0.24)`):g===`washi`?(_=m&&!s?`bg-[#F3EDE0]`:`bg-[#FAF7F0]/92`,v=`text-[#11100E]`,y=m?`#C8232C`:`#11100E`,b=m?`rgba(200, 35, 44, 0.22)`:`rgba(17, 16, 14, 0.14)`):g===`outline`?(_=m&&!s?`bg-[#11100E]/6`:`bg-[#F8F4EC]/70`,v=`text-[#11100E]`,y=m?`#C8232C`:`#2C2A27`,b=null):(_=m&&!s?`bg-[#11100E]/8`:`bg-transparent`,v=`text-[#11100E]`,y=m?`#11100E`:`rgba(17, 16, 14, 0.38)`,b=null);let x={xs:`px-2.5 py-1 text-[11px] gap-1.5 min-h-[28px]`,sm:`px-3.5 py-1.5 text-xs gap-2 min-h-[34px]`,md:`px-4 py-2.5 text-xs sm:text-sm gap-2.5 min-h-[40px]`,lg:`px-5 py-3 text-sm gap-2.5 min-h-[44px]`},{mainPaths:S,accentPaths:C}=f.w>0&&f.h>0?pt(f.w,f.h,y,b,r):{mainPaths:[],accentPaths:[]};return(0,l.jsxs)(`button`,{ref:d,disabled:s,onMouseEnter:e=>{h(!0),u.onMouseEnter?.(e)},onMouseLeave:e=>{h(!1),u.onMouseLeave?.(e)},className:`relative inline-flex items-center justify-center font-medium rounded-[2px] transition-colors duration-150 select-none cursor-pointer disabled:opacity-50 disabled:pointer-events-none ${i?`w-full`:` shrink-0`} ${_} ${v} ${x[t]} ${a}`,...u,children:[f.w>0&&f.h>0&&(0,l.jsxs)(`svg`,{width:f.w,height:f.h,viewBox:`0 0 ${f.w} ${f.h}`,className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,"aria-hidden":`true`,children:[C.map((e,t)=>(0,l.jsx)(`path`,{d:e,fill:`none`,stroke:b??y,strokeWidth:.8,strokeLinecap:`square`},`acc-${t}`)),S.map((e,t)=>(0,l.jsx)(`path`,{d:e,fill:`none`,stroke:y,strokeWidth:1.45,strokeLinecap:`square`},`main-${t}`))]}),(0,l.jsx)(`span`,{className:`relative z-10 inline-flex items-center justify-center gap-2 whitespace-nowrap`,children:o})]})},ht=({strokeColor:e=`#11100E`,innerAccentColor:t=`rgba(17, 16, 14, 0.14)`,seed:n=303,className:r=``,children:i,...a})=>{let o=(0,c.useRef)(null),[s,u]=(0,c.useState)({w:0,h:0});(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=Math.round(t.width),r=Math.round(t.height);u(e=>e.w===n&&e.h===r?e:{w:n,h:r})};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let{mainPaths:d,accentPaths:f}=s.w>0&&s.h>0?pt(s.w,s.h,e,t,n):{mainPaths:[],accentPaths:[]};return(0,l.jsxs)(`div`,{ref:o,className:`relative rounded-[2px] ${r}`,...a,children:[s.w>0&&s.h>0&&(0,l.jsxs)(`svg`,{width:s.w,height:s.h,viewBox:`0 0 ${s.w} ${s.h}`,className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible z-20`,"aria-hidden":`true`,children:[f.map((n,r)=>(0,l.jsx)(`path`,{d:n,fill:`none`,stroke:t??e,strokeWidth:.75,strokeLinecap:`square`},`acc-${r}`)),d.map((t,n)=>(0,l.jsx)(`path`,{d:t,fill:`none`,stroke:e,strokeWidth:1.35,strokeLinecap:`square`},`main-${n}`))]}),i]})},gt=({jp:e,romaji:t,pt:n,variant:r=`inline`,tooltipPlacement:i=`top`,className:a=``})=>{let[o,s]=(0,c.useState)(!1),d=(0,c.useRef)(null),[f,p]=(0,c.useState)({top:0,left:0,effectivePlacement:i}),m=()=>{let e=d.current;if(!e)return;let t=e.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight,a=i;a===`top`&&t.top-86-10<12?a=`bottom`:a===`bottom`&&t.bottom+86+10>r-12?a=`top`:a===`left`&&t.left-248-10<12?a=`right`:a===`right`&&t.right+248+10>n-12&&(a=`left`);let o=0,s=0;a===`top`?(o=t.top-86-10,s=t.left+t.width/2-124):a===`bottom`?(o=t.bottom+10,s=t.left+t.width/2-124):a===`left`?(o=t.top+t.height/2-43,s=t.left-248-10):(o=t.top+t.height/2-43,s=t.right+10),s=Math.max(12,Math.min(n-248-12,s)),o=Math.max(12,Math.min(r-86-12,o)),p({top:o,left:s,effectivePlacement:a})};(0,c.useEffect)(()=>{if(!o)return;m();let e=()=>m();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[o,i]);let h=()=>{m(),s(!0)},g=()=>{s(!1)},_=o&&typeof document<`u`?(0,u.createPortal)((0,l.jsxs)(`div`,{role:`tooltip`,style:{position:`fixed`,top:f.top,left:f.left,width:248,zIndex:9999},className:`pointer-events-none rounded-xl border border-[#C8232C]/45 bg-[#161412]/96 backdrop-blur-md text-[#F4EFE6] p-3 shadow-xl transition-opacity duration-150`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pb-1.5 mb-1.5 border-b border-[#F4EFE6]/12`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`inline-flex items-center justify-center px-1.5 py-0.5 rounded bg-[#C8232C] text-white text-xs font-editorial font-bold leading-none`,children:e}),t&&(0,l.jsx)(`span`,{className:`text-[11px] font-medium text-[#E5B8B8] italic`,children:t})]}),(0,l.jsx)(`span`,{className:`text-[10px] text-[#A69F93] font-tabular`,children:`PT-BR`})]}),(0,l.jsx)(`p`,{className:`text-xs leading-snug font-sans text-[#F4EFE6]`,children:n})]}),document.body):null,v=()=>{m(),s(e=>!e)};return r===`hanko`?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{ref:d,onMouseEnter:h,onMouseLeave:g,onClick:v,className:`relative inline-flex items-center justify-center whitespace-nowrap shrink-0 cursor-help select-none transition-transform duration-200 ${o?`scale-105`:``} ${a}`,children:(0,l.jsx)(`span`,{style:{border:`2px solid #C8232C`,boxShadow:`inset 0 0 0 1px rgba(200, 35, 44, 0.25)`,letterSpacing:`0.08em`},className:`hanko-seal px-2 py-0.5 text-xs font-bold font-editorial whitespace-nowrap transition-colors duration-200 ${o?`bg-[#C8232C] text-[#FAF8F5]`:`bg-[#F2EDE2]/90 text-[#C8232C]`}`,children:e})}),_]}):r===`tategaki`?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{ref:d,onMouseEnter:h,onMouseLeave:g,onClick:v,className:`relative inline-flex flex-col items-center shrink-0 cursor-help select-none ${a}`,children:(0,l.jsx)(`span`,{style:{writingMode:`vertical-rl`,textOrientation:`upright`},className:`tategaki font-editorial tracking-widest transition-colors duration-200 px-1.5 py-2 rounded-lg border ${o?`text-[#C8232C] border-[#C8232C]/50 bg-[#C8232C]/8`:`text-[#3F3D39] border-transparent`}`,children:e})}),_]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{ref:d,onMouseEnter:h,onMouseLeave:g,onClick:v,className:`relative inline-flex items-center gap-1 whitespace-nowrap shrink-0 border-b border-dotted border-[#C8232C]/70 cursor-help select-none transition-colors duration-200 ${o?`text-[#C8232C]`:``} ${a}`,children:(0,l.jsx)(`span`,{className:`font-editorial font-semibold text-sm whitespace-nowrap`,children:e})}),_]})};function _t(e){let t=e.replace(`#`,``).trim();if(t.length<6)return!1;let n=parseInt(t.slice(0,2),16)||0,r=parseInt(t.slice(2,4),16)||0,i=parseInt(t.slice(4,6),16)||0;return(.299*n+.587*r+.114*i)/255<.32}function vt(e,t,n,r,i){let a=S.classic_washi;if(e===`auto`&&typeof window<`u`){a=document.documentElement.classList.contains(`dark`)?S.night_obsidian:S.classic_washi;let e=getComputedStyle(document.documentElement),o=e.getPropertyValue(`--sumi-bg`).trim(),s=e.getPropertyValue(`--sumi-ink`).trim(),c=e.getPropertyValue(`--sumi-wash`).trim(),l=e.getPropertyValue(`--sumi-mist`).trim(),u=e.getPropertyValue(`--sumi-accent`).trim(),d={background:n||t?.background||o||a.colors.background,ink:r||t?.ink||s||a.colors.ink,wash:i||t?.wash||c||a.colors.wash,mist:t?.mist||l||n||t?.background||a.colors.mist,accent:t?.accent||u||a.colors.accent};return{resolved:d,isDark:_t(d.background)}}e!==`auto`&&S[e]&&(a=S[e]);let o=n||t?.background||a.colors.background;return{resolved:{background:o,ink:r||t?.ink||a.colors.ink,wash:i||t?.wash||a.colors.wash,mist:t?.mist||n||t?.background||a.colors.mist,accent:t?.accent||a.colors.accent},isDark:_t(o)}}function yt(e,t,n,r,i,a,o,s,c){let l=d(c),u=(l()-.5)*r*.24,f=t+u,p=n-r;e.save(),e.beginPath(),e.moveTo(t,n+2*i),e.quadraticCurveTo(t+u*.35,n-r*.52,f,p),e.strokeStyle=y(a,s*.92),e.lineWidth=Math.max(.8,r*.068),e.lineCap=`round`,e.stroke();let m=Math.max(3,Math.min(7,Math.floor(r/(5.5*i))+2));for(let t=0;t<m;t++){let n=t/Math.max(1,m-1),c=p+n*r*.68,d=f-u*n*.55+(l()-.5)*2.5*i,h=r*(.24+Math.sin(n*Math.PI*.85)*.28)*(.8+l()*.35);e.beginPath(),e.ellipse(d,c,h*.58,Math.max(1.2,r*.065),0,0,Math.PI*2),e.fillStyle=y(o,s*.34),e.fill(),e.beginPath(),e.moveTo(d-h*.55,c+(l()-.5)*1.5*i),e.quadraticCurveTo(d,c-1.6*i,d+h*.55,c+(l()-.5)*1.5*i),e.strokeStyle=y(a,s*.94),e.lineWidth=Math.max(.9,r*.062),e.stroke()}e.restore()}function bt(e,t,n,r,i,a,o,s,c){let l=d(c);e.save(),e.lineCap=`round`,e.lineJoin=`round`;let u=t-r*.32,f=n+r*.06,p=r*.78;e.beginPath(),e.moveTo(u,f+4*i),e.quadraticCurveTo(u-p*.12,f-p*.48,u-p*.24,f-p),e.moveTo(u-p*.1,f-p*.55),e.lineTo(u-p*.38,f-p*.78),e.moveTo(u-p*.14,f-p*.68),e.lineTo(u+p*.08,f-p*.88),e.strokeStyle=y(a,s*.92),e.lineWidth=Math.max(1.2,r*.048),e.stroke();for(let c=0;c<2;c++){let u=t+c*r*.28,d=n+c*r*.05,f=r*(c===0?1.02:.88),p=u+(c===0?.08:.15)*f,m=d-f;e.beginPath(),e.moveTo(u,d+5*i),e.quadraticCurveTo(u-f*.06,d-f*.5,p,m),e.strokeStyle=y(a,s*.95),e.lineWidth=Math.max(1.3,f*.052),e.stroke(),e.beginPath(),e.moveTo(u-f*.02,d-f*.58),e.lineTo(p+f*.18,m+f*.16),e.lineWidth=Math.max(.9,f*.035),e.stroke();for(let t=0;t<7;t++){let n=t/7*Math.PI*2+l()*.5,r=f*(.06+l()*.22),i=p+Math.cos(n)*r,c=m+Math.sin(n)*r*.68,u=Math.max(1.8,f*(.055+l()*.045)),d=t%2==0;e.beginPath(),e.arc(i,c,u,0,Math.PI*2),e.fillStyle=y(d?a:o,s*(d?.86:.52)),e.fill()}}e.restore()}function xt(e,t,n,r,i,a,o,s,c){let l=d(i.seed),u=(i.centerX-i.spanW*.5)*t,f=(i.centerX+i.spanW*.5)*t,m=i.peakY*n,h=i.baseY*n,g=Math.max(12,h-m),_=Math.max(48,Math.min(130,Math.floor((f-u)/(4*r)))),v=[];for(let e=0;e<=_;e++){let t=e/_,n=u+t*(f-u),r=Math.max(0,Math.min(1,t+(i.skew||0)*Math.sin(t*Math.PI))),a=Math.sin(r*Math.PI),o=Math.max(0,a)**+i.sharpness;if(i.plateau&&i.plateau>0){let e=1-i.plateau*.42;o=Math.min(e,o)/e}let s=p(t*3.6,i.seed*.013,i.seed),c=p(t*9.5,i.seed*.029,i.seed+71),l=.72+(s-.35)*.52+(c-.5)*.16,d=h-g*o*Math.max(.12,l);v.push({x:n,y:d,u:t,env:o})}let x=v[0];for(let e of v)e.y<x.y&&(x=e);e.save(),e.beginPath(),e.moveTo(u,h+6*r);for(let t of v)e.lineTo(t.x,t.y);e.lineTo(f,h+6*r),e.closePath();let S=e.createLinearGradient(0,x.y,0,h+4*r),C=(.14+i.depth*.42)*(o?1.35:1),w=Math.max(.52,Math.min(.95,.92-c*.18));if(o){let e=b(a.wash,a.ink,.16*i.depth);S.addColorStop(0,y(e,Math.min(.95,C+.25))),S.addColorStop(w*.65,y(a.wash,Math.min(.9,C*.85))),S.addColorStop(1,y(a.mist,.96))}else{let e=b(a.wash,a.ink,.18*i.depth);S.addColorStop(0,y(e,C)),S.addColorStop(w*.6,y(a.wash,C*.58)),S.addColorStop(w,y(a.mist,.85)),S.addColorStop(1,y(a.mist,.98))}if(e.fillStyle=S,e.fill(),i.cunfaDensity>.05&&i.depth>.22){e.save(),e.clip();let t=Math.floor((14+i.spanW*28)*i.cunfaDensity*(.55+i.depth*.65));for(let n=0;n<t;n++){let t=v[Math.floor((.08+l()*.84)*(v.length-1))];if(!t||t.env<.14)continue;let o=h-t.y;if(o<10*r)continue;let s=o*(.03+l()*.38),c=t.x+(l()-.5)*14*r,u=t.y+s,d=o*(.22+l()*.48),f=t.u<.5?-1:1,p=i.sharpness>1.35?f*(4+l()*14)*r:f*(12+l()*28)*r;e.beginPath(),e.moveTo(c,u),e.bezierCurveTo(c+p*.35+(l()-.5)*6*r,u+d*.35,c+p*.7-(l()-.5)*6*r,u+d*.72,c+p,u+d);let m=(.14+i.depth*.32)*(.5+l()*.6);e.strokeStyle=y(a.ink,m),e.lineWidth=(.55+l()*.95)*r,e.lineCap=`round`,e.stroke(),n%5==0&&i.depth>.55&&(e.beginPath(),e.moveTo(t.x,t.y+1.5*r),e.quadraticCurveTo(t.x+p*.45,t.y+d*.42,t.x+p*.85,t.y+d*.82),e.strokeStyle=y(a.ink,m*1.25),e.lineWidth=(.9+l()*.9)*r,e.stroke())}e.restore()}if(i.depth>.18){let t=Math.min(.98,.22+i.depth*.76),n=(1.1+i.depth*2.4)*r;for(let o=0;o<v.length-1;o++){let s=v[o],c=v[o+1],l=Math.sin(s.u*Math.PI);if(l<.04)continue;let u=.75+.5*p(s.u*12,i.seed*.07,i.seed+303),d=Math.max(.45*r,n*l**.65*u);e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(c.x,c.y),e.strokeStyle=y(a.ink,t*Math.min(1,l*1.6)),e.lineWidth=d,e.lineCap=`round`,e.stroke()}}if(i.treeStyle!==`none`&&s>.05){if(i.treeStyle===`foliage`){let t=v[Math.floor(v.length*.46)];t&&bt(e,t.x,t.y+8*r,Math.min(72*r,g*1.15),r,a.ink,a.wash,.95,i.seed+501)}else if(i.treeStyle===`pines`){let t=Math.max(1,Math.floor((3+i.spanW*8)*s*(.5+i.depth*.7)));for(let n=0;n<t;n++){let t=v[Math.floor((.15+l()*.7)*(v.length-1))];if(!t||t.env<.22)continue;let o=(9+l()*16*i.depth)*r;yt(e,t.x,t.y+(l()*5+1)*r,o,r,a.ink,a.wash,Math.min(.96,.45+i.depth*.55),i.seed+700+n*29)}}else if(i.treeStyle===`distant_dots`){let t=Math.floor(12*s);for(let n=0;n<t;n++){let t=v[Math.floor((.18+l()*.64)*(v.length-1))];if(!t||t.env<.25)continue;let n=(2.5+l()*3.8)*r;e.beginPath(),e.moveTo(t.x,t.y+.5*r),e.lineTo(t.x+(l()-.5)*1.5*r,t.y-n),e.strokeStyle=y(a.ink,.55*i.depth),e.lineWidth=.85*r,e.stroke(),e.beginPath(),e.arc(t.x,t.y-n,(1.1+l()*1.2)*r,0,Math.PI*2),e.fillStyle=y(a.ink,.5*i.depth),e.fill()}}}e.restore()}function St(e,t,n,r,i,a){e.save(),e.translate(t,n),e.beginPath(),e.moveTo(-r*.95,-r*.12),e.quadraticCurveTo(0,r*.24,r*.98,-r*.16),e.quadraticCurveTo(0,r*.08,-r*.95,-r*.12),e.fillStyle=y(i,a*.94),e.fill();let o=-r*.12;e.beginPath(),e.moveTo(o,r*.02),e.lineTo(o+r*.04,-r*.52),e.strokeStyle=y(i,a*.92),e.lineWidth=Math.max(1.1,r*.11),e.lineCap=`round`,e.stroke(),e.beginPath(),e.moveTo(o-r*.2,-r*.48),e.lineTo(o+r*.05,-r*.66),e.lineTo(o+r*.26,-r*.48),e.closePath(),e.fillStyle=y(i,a*.94),e.fill(),e.beginPath(),e.moveTo(o+r*.22,-r*.42),e.lineTo(-r*.48,r*.22),e.strokeStyle=y(i,a*.72),e.lineWidth=Math.max(.65,r*.055),e.stroke();for(let t=0;t<2;t++){let n=r*(.22+t*.14),o=r*(.65-t*.2);e.beginPath(),e.moveTo(-o,n),e.lineTo(o,n),e.strokeStyle=y(i,a*(.28-t*.1)),e.lineWidth=Math.max(.5,r*.045),e.stroke()}e.restore()}function Ct(e,t,n){let r=d(t),i=[];if(e===`panoramic_river`)return i.push({centerX:.71+(r()-.5)*.06,spanW:.42,peakY:.22+r()*.05,baseY:.37,sharpness:.95,skew:.15,depth:.16,cunfaDensity:.1,treeStyle:`none`,seed:t+11}),i.push({centerX:.94,spanW:.28,peakY:.27,baseY:.38,sharpness:.85,depth:.2,cunfaDensity:.1,treeStyle:`none`,seed:t+23}),i.push({centerX:.58+(r()-.5)*.05,spanW:.34,peakY:.3+r()*.03,baseY:.38,sharpness:.75,plateau:.65,skew:-.2,depth:.58,cunfaDensity:.75,treeStyle:`distant_dots`,seed:t+37}),i.push({centerX:.83+(r()-.5)*.04,spanW:.26,peakY:.28+r()*.03,baseY:.39,sharpness:1.05,skew:-.1,depth:.66,cunfaDensity:.85,treeStyle:`distant_dots`,seed:t+53}),i.push({centerX:.93,spanW:.29,peakY:.81,baseY:1.02,sharpness:.82,skew:-.15,depth:.98,cunfaDensity:1.25,treeStyle:`foliage`,seed:t+89}),i;if(e===`karst_peaks`)return i.push({centerX:.57+(r()-.5)*.06,spanW:.36,peakY:.34,baseY:.86,sharpness:1.55,depth:.18,cunfaDensity:.15,treeStyle:`none`,seed:t+101}),i.push({centerX:.9+(r()-.5)*.04,spanW:.32,peakY:.36+r()*.06,baseY:.93,sharpness:1.85,skew:-.12,depth:.68,cunfaDensity:1.15,treeStyle:`pines`,seed:t+131}),i.push({centerX:.68+(r()-.5)*.05,spanW:.31,peakY:.16+r()*.05,baseY:.94,sharpness:2.15,skew:.08,depth:.92,cunfaDensity:1.35,treeStyle:`pines`,seed:t+167}),i.push({centerX:.92,spanW:.32,peakY:.86,baseY:1.03,sharpness:.88,depth:1,cunfaDensity:1.2,treeStyle:`pines`,seed:t+199}),i;if(e===`twin_gorges`)return i.push({centerX:.18,spanW:.45,peakY:.22,baseY:.78,sharpness:1.35,depth:.18,cunfaDensity:.15,treeStyle:`none`,seed:t+211}),i.push({centerX:.82,spanW:.45,peakY:.2,baseY:.78,sharpness:1.4,depth:.2,cunfaDensity:.15,treeStyle:`none`,seed:t+223}),i.push({centerX:.28+(r()-.5)*.04,spanW:.28,peakY:.42,baseY:.9,sharpness:1.9,depth:.65,cunfaDensity:1,treeStyle:`pines`,seed:t+241}),i.push({centerX:.76+(r()-.5)*.04,spanW:.3,peakY:.35,baseY:.91,sharpness:1.95,depth:.76,cunfaDensity:1.15,treeStyle:`pines`,seed:t+263}),i.push({centerX:.55+(r()-.5)*.04,spanW:.34,peakY:.18+r()*.04,baseY:.93,sharpness:2.1,skew:.06,depth:.94,cunfaDensity:1.3,treeStyle:`pines`,seed:t+281}),i.push({centerX:.12,spanW:.34,peakY:.85,baseY:1.03,sharpness:.9,depth:1,cunfaDensity:1.2,treeStyle:`pines`,seed:t+307}),i;let a=Math.max(4,Math.min(8,n));for(let e=0;e<a;e++){let n=e/Math.max(1,a-1),o=e%2==0,s=o?.22+(r()-.4)*.18:.78+(r()-.6)*.18,c=.54+r()*.22,l=.16+n*.48+(r()-.5)*.05,u=Math.min(1.04,l+.34+n*.12);i.push({centerX:s,spanW:c,peakY:l,baseY:u,sharpness:1.05+(r()-.5)*.35,skew:o?-.14:.14,depth:.16+n**.85*.84,cunfaDensity:.35+n*.95,treeStyle:n<.25?`none`:`pines`,seed:t+400+e*43})}return i}var wt=({seed:e=8472,composition:t=`panoramic_river`,theme:n=`classic_washi`,colors:r,backgroundColor:i,inkColor:a,washColor:o,ridgeLayers:s=6,treeDensity:u=1,mistDensity:f=1,showBoat:p=!0,animated:m=!1,actionsRef:h,className:g=``})=>{let _=(0,c.useRef)(null),v=(0,c.useRef)(null),b=(0,c.useRef)(``),x=(0,c.useRef)(!0),S=(0,c.useCallback)(n=>{let r=_.current;if(!r)return;let i=document.createElement(`a`);i.download=n||`sumi-sansui-${t}-${e}.png`,i.href=r.toDataURL(`image/png`),i.click()},[t,e]);return(0,c.useEffect)(()=>{h&&(h.current={exportPng:S})},[h,S]),(0,c.useEffect)(()=>{let e=_.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.forEach(e=>{x.current=e.isIntersecting})},{rootMargin:`100px 0px`,threshold:.01});return t.observe(e),()=>t.disconnect()},[]),(0,c.useEffect)(()=>{let c=_.current;if(!c)return;v.current||=document.createElement(`canvas`);let l=v.current,h=0,g=c.getBoundingClientRect(),S=new ResizeObserver(e=>{e[0]&&(g=e[0].contentRect,b.current=``)});S.observe(c);let C=performance.now(),w=_=>{if(!x.current&&m){h=requestAnimationFrame(w);return}let v=Math.min(2,window.devicePixelRatio||1),S=Math.max(220,Math.floor(g.width||c.clientWidth||640)),T=Math.max(150,Math.floor(g.height||c.clientHeight||360)),E=Math.floor(S*v),D=Math.floor(T*v);(c.width!==E||c.height!==D)&&(c.width=E,c.height=D,l.width=E,l.height=D,b.current=``);let{resolved:O,isDark:k}=vt(n,r,i,a,o),A=Math.max(.55,Math.min(S/900,T/460)),j=`${E}x${D}:${e}:${t}:${s}:${u}:${f}:${O.background}:${O.ink}:${O.wash}:${O.mist}:${O.accent}`,M=c.getContext(`2d`),N=l.getContext(`2d`);if(!M||!N)return;if(b.current!==j){N.save(),N.setTransform(v,0,0,v,0,0),N.clearRect(0,0,S,T),N.fillStyle=O.background,N.fillRect(0,0,S,T);let n=d(e+999);N.strokeStyle=y(O.ink,k?.03:.022),N.lineWidth=.6;for(let e=0;e<42;e++){let e=n()*T;N.beginPath(),N.moveTo(0,e),N.lineTo(S,e+(n()-.5)*4),N.stroke()}let r=Ct(t,e,s),i=r.filter(e=>e.depth<.9),a=r.filter(e=>e.depth>=.9);for(let e of i)xt(N,S,T,A,e,O,k,u,f);let o=d(e+777),c=t===`panoramic_river`?T*.37:t===`layered_valley`?T*.72:T*.88,l=t===`panoramic_river`?58:t===`layered_valley`?18:16;for(let e=0;e<l;e++){let e=o()**.85,t=c+e*(T*.96-c),n=o()*S*.92,r=(28+o()*135)*A*(.65+(1-e)*.5);N.beginPath(),N.moveTo(n-r*.5,t),N.lineTo(n+r*.5,t),N.strokeStyle=y(O.ink,(k?.14:.18)*(.45+o()*.55)),N.lineWidth=Math.max(.5,.75*A),N.stroke()}for(let e of a)xt(N,S,T,A,e,O,k,u,f);N.restore(),b.current=j}M.save(),M.setTransform(v,0,0,v,0,0),M.clearRect(0,0,S,T),M.drawImage(l,0,0,S,T);let P=m?(_-C)/1e3:0;if(p){let n=d(e+555),r=S*.61,i=T*.81,a=15*A;t===`panoramic_river`?(r=S*(.58+(n()-.5)*.08),i=T*(.76+(n()-.5)*.05),a=15.5*A):t===`karst_peaks`?(r=S*(.43+(n()-.5)*.06),i=T*.94,a=12*A):t===`layered_valley`?(r=S*.51,i=T*.9,a=10.5*A):t===`twin_gorges`&&(r=S*.37,i=T*.94,a=11.5*A);let o=m?Math.sin(P*.55)*8*A:0,s=m?Math.cos(P*1.1)*1.2*A:0;St(M,r+o,i+s,Math.max(8,a),O.ink,.92)}M.restore(),m&&(h=requestAnimationFrame(w))};return h=requestAnimationFrame(w),()=>{cancelAnimationFrame(h),S.disconnect()}},[e,t,n,r,i,a,o,s,u,f,p,m]),(0,l.jsx)(`div`,{className:`relative w-full h-full overflow-hidden select-none ${g}`,children:(0,l.jsx)(`canvas`,{ref:_,className:`block w-full h-full`})})};exports.ARCHETYPE_CATALOG=T,exports.DEFAULT_FUJI_LAYERS=D,exports.DEFAULT_VFX_CONFIG=E,exports.JapaneseCalligraphy=gt,exports.MAGIC_SCHOOLS=w,exports.SANSUI_COMPOSITIONS=C,exports.SANSUI_THEMES=S,exports.SumiBrandEmblem=dt,exports.SumiBrushCanvas=ot,exports.SumiButton=mt,exports.SumiIcon=ut,exports.SumiLandscape=nt,exports.SumiMaskReveal=tt,exports.SumiRoughBox=ht,exports.SumiSansui=wt,exports.SumiSectionPainter=lt,exports.SumiStroke=st,exports.SumiVFX=ct,exports.TECHNIQUES_CATALOG=O,exports.createSeededRandom=d,exports.drawCalligraphicKoiCarp=U,exports.drawCentrifugalSplatters=j,exports.drawCornerSakuraBranch=W,exports.drawDetachedSumiFlameWisp=N,exports.drawFacetedRoughCrystal=B,exports.drawFlamePetalTongue=M,exports.drawFloatingSakuraPetal=H,exports.drawHokusaiFoamClawCluster=P,exports.drawHokusaiWaveCrest=F,exports.drawSakuraBlossom=V,exports.drawSolidOpaqueCoreSphere=R,exports.drawSumiKasureRibbon=A,exports.drawTarashikomiWashBlob=z,exports.drawUkiyoeCloudBank=L,exports.drawUkiyoeCloudScrollVolute=I,exports.encodeAnimatedGIF89a=$e,exports.fbmNoise2D=p,exports.hexToRgb=v,exports.makeFineRoughOptions=k,exports.mixHex=b,exports.recolorReferenceSheetData=x,exports.renderCompleteSpriteSheet=Qe,exports.renderVFXFrame=Ze,exports.rgbaStr=y,exports.sampleCubicCurve=m,exports.sampleNoise2D=f,exports.samplePolarArc=g,exports.sampleQuadraticCurve=h,exports.samplesToSpine=_;
2
+ //# sourceMappingURL=index.cjs.map