ai-wrapped 1.19.0 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/bin/cli.ts +34 -5
- package/dist/assets/{Aurora-gPgXaQaG.js → Aurora-Crla_yBY.js} +1 -1
- package/dist/assets/{BotAvatar-Bur2fckZ.js → BotAvatar-qk28u-xO.js} +1 -1
- package/dist/assets/{CrystalizedBall-KWGPAJYI.js → CrystalizedBall-CmJJ8Krr.js} +1 -1
- package/dist/assets/{DarkVeil-BgGKjyIE.js → DarkVeil-DZcrp12B.js} +1 -1
- package/dist/assets/{EchoText-BrB32uyp.js → EchoText-aQjpJffM.js} +1 -1
- package/dist/assets/{FaultyTerminal-DDw4c9b4.js → FaultyTerminal-CS1bfd2v.js} +1 -1
- package/dist/assets/{Galaxy-Dgc9RDEH.js → Galaxy-CjdJNhsE.js} +1 -1
- package/dist/assets/{GlowCursor-BZCHElFf.js → GlowCursor-DULtwCNS.js} +1 -1
- package/dist/assets/{Heatwave-CJzverw9.js → Heatwave-DYV3pa27.js} +1 -1
- package/dist/assets/{Iridescence-BvMXvo4z.js → Iridescence-C6SshI6F.js} +1 -1
- package/dist/assets/{LetterGlitch-BfoWmQyO.js → LetterGlitch-Ce-Pz7K7.js} +1 -1
- package/dist/assets/{LightTunnel-Dig-ybUd.js → LightTunnel-BZtaSGGm.js} +1 -1
- package/dist/assets/{LineSpiral-BORPdW5M.js → LineSpiral-DnZQUwxi.js} +1 -1
- package/dist/assets/{Plasma-CHJExTBw.js → Plasma-C4NLxl4u.js} +1 -1
- package/dist/assets/{Prism-19JE2gzg.js → Prism-BX0sB44l.js} +1 -1
- package/dist/assets/{SideRays-DcOr-gOm.js → SideRays-B0NXHiz5.js} +1 -1
- package/dist/assets/{SlicedWaves-BUD_9aqV.js → SlicedWaves-BChKIgxt.js} +1 -1
- package/dist/assets/{SplitFlapText-D5KE4_3P.js → SplitFlapText-m9HqqaXr.js} +1 -1
- package/dist/assets/{Strands-CtNx3Esy.js → Strands-BSDJZmIz.js} +1 -1
- package/dist/assets/{TechText-BtSyI_Dm.js → TechText-BkqORxn3.js} +1 -1
- package/dist/assets/{Threads-H6WESD1W.js → Threads-wlUgTZgr.js} +1 -1
- package/dist/assets/index-BxNTb8op.js +161 -0
- package/dist/assets/index-C25M8eaq.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +9 -2
- package/skills/ai-wrapped/SKILL.md +38 -0
- package/src/bun/headless.ts +28 -8
- package/src/bun/notesFile.test.ts +27 -0
- package/src/bun/promptExport.test.ts +24 -0
- package/src/bun/promptExport.ts +72 -0
- package/src/bun/promptWords.ts +8 -0
- package/src/bun/share.ts +9 -4
- package/src/shared/cardStyle.ts +83 -0
- package/src/shared/portraitCard.test.ts +47 -0
- package/src/shared/schemaDocs.test.ts +51 -0
- package/src/shared/shareData.ts +209 -6
- package/src/shared/wrappedInput.test.ts +121 -0
- package/src/shared/wrappedInput.ts +456 -0
- package/dist/assets/index-BstFwFxc.js +0 -161
- package/dist/assets/index-yPH2MNv-.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as _e,m as Fi,j as Si}from"./index-
|
|
1
|
+
import{r as _e,m as Fi,j as Si}from"./index-BxNTb8op.js";function De(t){let e=t[0],i=t[1],s=t[2];return Math.sqrt(e*e+i*i+s*s)}function dt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Ci(t,e,i,s){return t[0]=e,t[1]=i,t[2]=s,t}function qt(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}function Ht(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function Di(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function zi(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t}function at(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function Pi(t,e){let i=e[0]-t[0],s=e[1]-t[1],r=e[2]-t[2];return Math.sqrt(i*i+s*s+r*r)}function Li(t,e){let i=e[0]-t[0],s=e[1]-t[1],r=e[2]-t[2];return i*i+s*s+r*r}function Xt(t){let e=t[0],i=t[1],s=t[2];return e*e+i*i+s*s}function ki(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function Bi(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function pt(t,e){let i=e[0],s=e[1],r=e[2],n=i*i+s*s+r*r;return n>0&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function ci(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Vt(t,e,i){let s=e[0],r=e[1],n=e[2],a=i[0],l=i[1],h=i[2];return t[0]=r*h-n*l,t[1]=n*a-s*h,t[2]=s*l-r*a,t}function Ii(t,e,i,s){let r=e[0],n=e[1],a=e[2];return t[0]=r+s*(i[0]-r),t[1]=n+s*(i[1]-n),t[2]=a+s*(i[2]-a),t}function Ni(t,e,i,s,r){const n=Math.exp(-s*r);let a=e[0],l=e[1],h=e[2];return t[0]=i[0]+(a-i[0])*n,t[1]=i[1]+(l-i[1])*n,t[2]=i[2]+(h-i[2])*n,t}function Oi(t,e,i){let s=e[0],r=e[1],n=e[2],a=i[3]*s+i[7]*r+i[11]*n+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*r+i[8]*n+i[12])/a,t[1]=(i[1]*s+i[5]*r+i[9]*n+i[13])/a,t[2]=(i[2]*s+i[6]*r+i[10]*n+i[14])/a,t}function Ui(t,e,i){let s=e[0],r=e[1],n=e[2],a=i[3]*s+i[7]*r+i[11]*n+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*r+i[8]*n)/a,t[1]=(i[1]*s+i[5]*r+i[9]*n)/a,t[2]=(i[2]*s+i[6]*r+i[10]*n)/a,t}function Gi(t,e,i){let s=e[0],r=e[1],n=e[2];return t[0]=s*i[0]+r*i[3]+n*i[6],t[1]=s*i[1]+r*i[4]+n*i[7],t[2]=s*i[2]+r*i[5]+n*i[8],t}function qi(t,e,i){let s=e[0],r=e[1],n=e[2],a=i[0],l=i[1],h=i[2],o=i[3],c=l*n-h*r,f=h*s-a*n,u=a*r-l*s,d=l*u-h*f,p=h*c-a*u,g=a*f-l*c,m=o*2;return c*=m,f*=m,u*=m,d*=2,p*=2,g*=2,t[0]=s+c+d,t[1]=r+f+p,t[2]=n+u+g,t}const Hi=(function(){const t=[0,0,0],e=[0,0,0];return function(i,s){dt(t,i),dt(e,s),pt(t,t),pt(e,e);let r=ci(t,e);return r>1?0:r<-1?Math.PI:Math.acos(r)}})();function Xi(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}class ee extends Array{constructor(e=0,i=e,s=e){return super(e,i,s),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this[0]=e}set y(e){this[1]=e}set z(e){this[2]=e}set(e,i=e,s=e){return e.length?this.copy(e):(Ci(this,e,i,s),this)}copy(e){return dt(this,e),this}add(e,i){return i?qt(this,e,i):qt(this,this,e),this}sub(e,i){return i?Ht(this,e,i):Ht(this,this,e),this}multiply(e){return e.length?Di(this,this,e):at(this,this,e),this}divide(e){return e.length?zi(this,this,e):at(this,this,1/e),this}inverse(e=this){return Bi(this,e),this}len(){return De(this)}distance(e){return e?Pi(this,e):De(this)}squaredLen(){return Xt(this)}squaredDistance(e){return e?Li(this,e):Xt(this)}negate(e=this){return ki(this,e),this}cross(e,i){return i?Vt(this,e,i):Vt(this,this,e),this}scale(e){return at(this,this,e),this}normalize(){return pt(this,this),this}dot(e){return ci(this,e)}equals(e){return Xi(this,e)}applyMatrix3(e){return Gi(this,this,e),this}applyMatrix4(e){return Oi(this,this,e),this}scaleRotateMatrix4(e){return Ui(this,this,e),this}applyQuaternion(e){return qi(this,this,e),this}angle(e){return Hi(this,e)}lerp(e,i){return Ii(this,this,e,i),this}smoothLerp(e,i,s){return Ni(this,this,e,i,s),this}clone(){return new ee(this[0],this[1],this[2])}fromArray(e,i=0){return this[0]=e[i],this[1]=e[i+1],this[2]=e[i+2],this}toArray(e=[],i=0){return e[i]=this[0],e[i+1]=this[1],e[i+2]=this[2],e}transformDirection(e){const i=this[0],s=this[1],r=this[2];return this[0]=e[0]*i+e[4]*s+e[8]*r,this[1]=e[1]*i+e[5]*s+e[9]*r,this[2]=e[2]*i+e[6]*s+e[10]*r,this.normalize()}}const Wt=new ee;let Vi=1,Wi=1,$t=!1;class fi{constructor(e,i={}){e.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=e,this.attributes=i,this.id=Vi++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let s in i)this.addAttribute(s,i[s])}addAttribute(e,i){if(this.attributes[e]=i,i.id=Wi++,i.size=i.size||1,i.type=i.type||(i.data.constructor===Float32Array?this.gl.FLOAT:i.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),i.target=e==="index"?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,i.normalized=i.normalized||!1,i.stride=i.stride||0,i.offset=i.offset||0,i.count=i.count||(i.stride?i.data.byteLength/i.stride:i.data.length/i.size),i.divisor=i.instanced||0,i.needsUpdate=!1,i.usage=i.usage||this.gl.STATIC_DRAW,i.buffer||this.updateAttribute(i),i.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==i.count*i.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,i.count*i.divisor);this.instancedCount=i.count*i.divisor}else e==="index"?this.drawRange.count=i.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,i.count))}updateAttribute(e){const i=!e.buffer;i&&(e.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==e.buffer&&(this.gl.bindBuffer(e.target,e.buffer),this.glState.boundBuffer=e.buffer),i?this.gl.bufferData(e.target,e.data,e.usage):this.gl.bufferSubData(e.target,0,e.data),e.needsUpdate=!1}setIndex(e){this.addAttribute("index",e)}setDrawRange(e,i){this.drawRange.start=e,this.drawRange.count=i}setInstancedCount(e){this.instancedCount=e}createVAO(e){this.VAOs[e.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.bindAttributes(e)}bindAttributes(e){e.attributeLocations.forEach((i,{name:s,type:r})=>{if(!this.attributes[s]){console.warn(`active attribute ${s} not being supplied`);return}const n=this.attributes[s];this.gl.bindBuffer(n.target,n.buffer),this.glState.boundBuffer=n.buffer;let a=1;r===35674&&(a=2),r===35675&&(a=3),r===35676&&(a=4);const l=n.size/a,h=a===1?0:a*a*4,o=a===1?0:a*4;for(let c=0;c<a;c++)this.gl.vertexAttribPointer(i+c,l,n.type,n.normalized,n.stride+h,n.offset+c*o),this.gl.enableVertexAttribArray(i+c),this.gl.renderer.vertexAttribDivisor(i+c,n.divisor)}),this.attributes.index&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:e,mode:i=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${e.attributeOrder}`&&(this.VAOs[e.attributeOrder]||this.createVAO(e),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${e.attributeOrder}`),e.attributeLocations.forEach((r,{name:n})=>{const a=this.attributes[n];a.needsUpdate&&this.updateAttribute(a)});let s=2;this.attributes.index?.type===this.gl.UNSIGNED_INT&&(s=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(i,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*s,this.instancedCount):this.gl.renderer.drawArraysInstanced(i,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(i,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*s):this.gl.drawArrays(i,this.drawRange.start,this.drawRange.count)}getPosition(){const e=this.attributes.position;if(e.data)return e;if(!$t)return console.warn("No position buffer data found to compute bounds"),$t=!0}computeBoundingBox(e){e||(e=this.getPosition());const i=e.data,s=e.size;this.bounds||(this.bounds={min:new ee,max:new ee,center:new ee,scale:new ee,radius:1/0});const r=this.bounds.min,n=this.bounds.max,a=this.bounds.center,l=this.bounds.scale;r.set(1/0),n.set(-1/0);for(let h=0,o=i.length;h<o;h+=s){const c=i[h],f=i[h+1],u=i[h+2];r.x=Math.min(c,r.x),r.y=Math.min(f,r.y),r.z=Math.min(u,r.z),n.x=Math.max(c,n.x),n.y=Math.max(f,n.y),n.z=Math.max(u,n.z)}l.sub(n,r),a.add(r,n).divide(2)}computeBoundingSphere(e){e||(e=this.getPosition());const i=e.data,s=e.size;this.bounds||this.computeBoundingBox(e);let r=0;for(let n=0,a=i.length;n<a;n+=s)Wt.fromArray(i,n),r=Math.max(r,this.bounds.center.squaredDistance(Wt));this.bounds.radius=Math.sqrt(r)}remove(){for(let e in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[e]),delete this.VAOs[e];for(let e in this.attributes)this.gl.deleteBuffer(this.attributes[e].buffer),delete this.attributes[e]}}let $i=1;const Yt={};class Oe{constructor(e,{vertex:i,fragment:s,uniforms:r={},transparent:n=!1,cullFace:a=e.BACK,frontFace:l=e.CCW,depthTest:h=!0,depthWrite:o=!0,depthFunc:c=e.LEQUAL}={}){e.canvas||console.error("gl not passed as first argument to Program"),this.gl=e,this.uniforms=r,this.id=$i++,i||console.warn("vertex shader not supplied"),s||console.warn("fragment shader not supplied"),this.transparent=n,this.cullFace=a,this.frontFace=l,this.depthTest=h,this.depthWrite=o,this.depthFunc=c,this.blendFunc={},this.blendEquation={},this.stencilFunc={},this.stencilOp={},this.transparent&&!this.blendFunc.src&&(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)),this.vertexShader=e.createShader(e.VERTEX_SHADER),this.fragmentShader=e.createShader(e.FRAGMENT_SHADER),this.program=e.createProgram(),e.attachShader(this.program,this.vertexShader),e.attachShader(this.program,this.fragmentShader),this.setShaders({vertex:i,fragment:s})}setShaders({vertex:e,fragment:i}){if(e&&(this.gl.shaderSource(this.vertexShader,e),this.gl.compileShader(this.vertexShader),this.gl.getShaderInfoLog(this.vertexShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.vertexShader)}
|
|
2
2
|
Vertex Shader
|
|
3
3
|
${jt(e)}`)),i&&(this.gl.shaderSource(this.fragmentShader,i),this.gl.compileShader(this.fragmentShader),this.gl.getShaderInfoLog(this.fragmentShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.fragmentShader)}
|
|
4
4
|
Fragment Shader
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as M,m as Yt,j as _}from"./index-
|
|
1
|
+
import{r as M,m as Yt,j as _}from"./index-BxNTb8op.js";const Wt=typeof window>"u"?M.useEffect:M.useLayoutEffect,a=(i,C,L)=>Math.min(Math.max(i,C),L),Tt={right:{x:1,y:0},left:{x:-1,y:0},up:{x:0,y:-1},down:{x:0,y:1},diagonal:{x:.72,y:.72}},Ft={linear:i=>i,"ease-out":i=>1-Math.pow(1-i,3),"ease-in-out":i=>i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2,snappy:i=>1-Math.pow(1-i,5)},Jt=7200,Kt=2600,Zt=1100,te=80,K=i=>i instanceof Element?[i.scrollLeft||0,i.scrollTop||0]:[window.scrollX,window.scrollY],ne=({text:i="Motion Echo",echoes:C=12,lag:L=.24,offset:Z=36,direction:tt="right",fade:et=.72,blur:nt=3,tint:ot="#7dd3fc",echoColors:P,echoStyle:Rt="solid",echoScale:rt=1,mode:Y="both",trail:S="pointer",clickBurst:j=!0,cursorRadius:st=320,duration:at=900,ease:it="ease-out",fontSize:Lt="clamp(3rem, 9vw, 7rem)",fontWeight:Nt=800,color:$t="currentColor",className:At="",style:kt})=>{const ct=M.useRef(null),lt=M.useRef(null),E=M.useRef([]),[B,It]=M.useState(!1),l=B?0:a(Math.round(C),0,24),_t=M.useMemo(()=>Array.from({length:l},(r,d)=>l-d),[l]),N=Array.isArray(P)&&P.length?P:null,Ct=j&&l>0,Pt=r=>{if(N){const d=l>1?(r-1)/(l-1):0;return`color-mix(in srgb, ${N[N.length-1]} ${Math.round(d*100)}%, ${N[0]})`}return ot?`color-mix(in srgb, ${ot} ${Math.min(72,18+r*5)}%, currentColor)`:void 0};M.useEffect(()=>{if(!window.matchMedia)return;const r=Yt(),d=()=>It(r.matches);return d(),()=>r.removeEventListener?.("change",d)},[]),Wt(()=>{const r=ct.current;if(!r||B||Yt().matches)return;const d=Tt[tt]||Tt.right,u=a(Number(Z)||0,0,120),dt=a(Number(st)||320,40,1200),D=a(Number(L)||.16,.02,.5),ht=a(Number(et)||.64,.1,.95),$=a(Number(nt)||0,0,16),Bt=a(Number(rt)||1,.25,2.5),ut=Math.max(0,Number(at)||0),Dt=Ft[it]||Ft["ease-out"],A=Y==="entrance"||Y==="both",O=Y==="pointer"||Y==="both",Ot=!!window.matchMedia?.("(hover: hover) and (pointer: fine)").matches,q=O&&S==="auto",G=O&&S==="scroll",ft=O&&Ot&&!G,qt=.12+D*1.1,Gt=a(u/36,.35,2.5),k=u*4,t={targetX:0,targetY:0,lastTargetX:0,lastTargetY:0,activity:A?1:0,positions:Array.from({length:l+1},(e,n)=>{const o=A?u*(n+.35):0;return{x:d.x*o,y:d.y*o}}),bends:Array.from({length:l+1},()=>({x:0,y:0})),startTime:performance.now(),lastTime:0,drift:0,phase:0,pointerNear:!1,pointerTime:-1/0,visible:!0,pushX:0,pushY:0,velocityX:0,velocityY:0,bursts:[]};let T=0;for(let e=1;e<=l;e+=1){const n=E.current[e];n&&(n.style.filter=$>0?`blur(${($*e/l).toFixed(2)}px)`:"none")}const Ut=e=>{t.bursts=t.bursts.filter(n=>{const o=e-n.start;let h=!1;return n.nodes.forEach((s,f)=>{const y=(o-f*te)/Zt;y<1&&(h=!0);const p=a(y,0,1),m=1-Math.pow(1-p,3),b=1+m*.34*Gt,g=.75*Math.pow(ht,f*.5),z=y<=0?0:Math.min(1,p*8)*Math.pow(1-p,1.5)*g;s.style.transform=`translate3d(${n.x.toFixed(2)}px, ${n.y.toFixed(2)}px, 0) scale(${b.toFixed(4)})`,s.style.opacity=z.toFixed(3),s.style.filter=$>0?`blur(${($*.3*m).toFixed(2)}px)`:"none"}),h||n.nodes.forEach(s=>s.remove()),h})},U=e=>{T=0;const n=t.lastTime?a(e-t.lastTime,0,64):16.67,o=n/16.67;t.lastTime=e;const h=e-t.startTime,s=A&&ut>0?a(h/ut,0,1):1,f=A?1-Dt(s):0,y=Math.hypot(t.targetX-t.lastTargetX,t.targetY-t.lastTargetY);if(t.lastTargetX=t.targetX,t.lastTargetY=t.targetY,q){const c=!ft||!t.pointerNear||e-t.pointerTime>Kt;t.drift+=((c?1:0)-t.drift)*(1-Math.pow(.965,o)),t.phase+=n/Jt*Math.PI*2}if(G){const c=1-Math.pow(.7,o);t.velocityX+=(t.pushX/Math.max(o,.25)-t.velocityX)*c,t.velocityY+=(t.pushY/Math.max(o,.25)-t.velocityY)*c,t.pushX=0,t.pushY=0}const p=Math.hypot(t.velocityX,t.velocityY),m=a(-t.velocityX*3.2,-k,k),b=a(-t.velocityY*3.2,-k,k),g=t.targetX*(1-t.drift),z=t.targetY*(1-t.drift);let H=0,Q=0;for(let c=0;c<=l;c+=1){const R=E.current[c],x=t.positions[c],v=t.bends[c];if(!R||!x||!v)continue;const w=l?c/l:0,vt=f*u*(c+.35);let W=g+d.x*vt,J=z+d.y*vt;if(t.drift>5e-4){const X=t.phase-c*qt,Xt=u*t.drift*(.25+.75*w);W+=Math.sin(X)*Xt,J+=Math.sin(X)*Math.cos(X)*Xt*1.3}const Mt=1-Math.pow(1-a(.34/(1+c*D*4.2),.018,.36),o),bt=1-Math.pow(1-.3/(1+w*(1+D*8)),o);x.x+=(W-x.x)*Mt,x.y+=(J-x.y)*Mt,v.x+=(m*w-v.x)*bt,v.y+=(b*w-v.y)*bt,Q=Math.max(Q,Math.abs(W-x.x),Math.abs(J-x.y),Math.abs(m*w-v.x),Math.abs(b*w-v.y));const wt=x.x+v.x,Et=x.y+v.y,Qt=1+(Bt-1)*w;if(R.style.transform=`translate3d(${wt.toFixed(3)}px, ${Et.toFixed(3)}px, 0) scale(${Qt.toFixed(4)})`,c>0){const X=t.positions[0];H=Math.max(H,Math.hypot(wt-X.x,Et-X.y))}}const Vt=u>0?a(H/(u*2.25),0,1):0,zt=u>0?a(y/(u*.35),0,1):0,Ht=Math.max(f,Vt,zt,t.drift*.9,a(p/5,0,1));t.activity+=(Ht-t.activity)*(1-Math.pow(.82,o)),Ut(e);const xt=s<1||t.activity>.002||Q>.05||p>.02||t.bursts.length>0||q&&t.visible;xt||(t.activity=0);for(let c=1;c<=l;c+=1){const R=E.current[c];R&&(R.style.opacity=String(Math.pow(ht,c)*t.activity))}xt&&(T=requestAnimationFrame(U))},F=()=>{T||(t.lastTime=0,T=requestAnimationFrame(U))},pt=e=>{const n=r.getBoundingClientRect();if(!n.width||!n.height)return;const o=e.clientX-(n.left+n.width/2),h=e.clientY-(n.top+n.height/2),s=Math.hypot(o,h),f=s>0?a(s/dt,0,1):0,y=s>0?o/s:0,p=s>0?h/s:0;t.targetX=y*f*u,t.targetY=p*f*u*.72,t.pointerNear=s<=dt,t.pointerTime=performance.now(),F()},mt=e=>{e.relatedTarget||(t.targetX=0,t.targetY=0,t.pointerNear=!1,F())},I=new WeakMap,yt=e=>{const n=e.target;if(!(n instanceof Document)&&!(n instanceof Element&&n.contains(r)))return;const[o,h]=K(n),s=I.get(n);I.set(n,[o,h]),s&&(t.pushX-=o-s[0],t.pushY-=h-s[1],F())},gt=e=>{const n=lt.current,o=r.getBoundingClientRect();if(!n||!l||!o.width||!o.height)return;const h=a((e.clientX-o.left)/o.width,0,1)*100,s=a((e.clientY-o.top)/o.height,0,1)*100,f=a(Math.round(l/3)+2,3,6),y=t.positions[0],p=[];for(let m=0;m<f;m+=1){const b=E.current[1+Math.round(m/Math.max(1,f-1)*(l-1))];if(!b)continue;const g=b.cloneNode(!0);g.removeAttribute("data-echo-index"),g.style.transformOrigin=`${h.toFixed(1)}% ${s.toFixed(1)}%`,g.style.opacity="0",n.appendChild(g),p.push(g)}for(t.bursts.push({start:performance.now(),x:y?.x||0,y:y?.y||0,nodes:p});t.bursts.length>4;)t.bursts.shift()?.nodes.forEach(m=>m.remove());F()};if(ft&&(window.addEventListener("pointermove",pt,{passive:!0}),document.addEventListener("pointerout",mt)),G){I.set(document,K(document));for(let e=r.parentElement;e;e=e.parentElement)I.set(e,K(e));document.addEventListener("scroll",yt,{capture:!0,passive:!0})}j&&r.addEventListener("click",gt);let V;return q&&typeof IntersectionObserver<"u"&&(V=new IntersectionObserver(e=>{t.visible=e[e.length-1].isIntersecting,t.visible&&F()}),V.observe(r)),U(t.startTime),()=>{cancelAnimationFrame(T),window.removeEventListener("pointermove",pt),document.removeEventListener("pointerout",mt),document.removeEventListener("scroll",yt,{capture:!0}),r.removeEventListener("click",gt),V?.disconnect(),t.bursts.forEach(e=>e.nodes.forEach(n=>n.remove()))}},[nt,j,st,tt,at,it,l,rt,et,L,Y,Z,B,S]);const St={fontSize:Lt,fontWeight:Nt,color:$t,cursor:Ct?"pointer":void 0,...kt},jt=["pointer-events-none absolute inset-0 block origin-center transform-gpu backface-hidden will-change-[transform,opacity] motion-reduce:hidden",Rt==="outline"?"[-webkit-text-fill-color:transparent] [-webkit-text-stroke:max(1px,0.014em)_currentColor]":""].join(" ").trim();return _.jsxs("span",{ref:ct,className:`relative inline-block whitespace-nowrap select-none leading-[0.9] tracking-[-0.04em] [contain:layout_style] [font-kerning:normal] [text-rendering:geometricPrecision] ${At}`.trim(),style:St,children:[_t.map(r=>_.jsx("span",{"aria-hidden":"true",className:jt,"data-echo-index":r,ref:d=>{E.current[r]=d},style:{color:Pt(r),opacity:0},children:i},`echo-${r}`)),_.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0",ref:lt}),_.jsx("span",{className:"pointer-events-none relative z-[2] block transform-gpu text-shadow-[0_0.035em_0_rgba(255,255,255,0.04)] will-change-transform motion-reduce:[transform:none]!","data-echo-index":"0",ref:r=>{E.current[0]=r},children:i})]})};export{ne as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as A,m as ze,j as ye}from"./index-
|
|
1
|
+
import{r as A,m as ze,j as ye}from"./index-BxNTb8op.js";const Ve=2,C=4,He={glitch:.7,degauss:1.6},qe={blocks:0,dots:1,characters:2},$e={none:0,glitch:1,degauss:2},je=[[".###.","#..##","#.#.#","##..#",".###."],["..#..",".##..","..#..","..#..",".###."],["####.","....#",".###.","#....","#####"],["####.","....#",".###.","....#","####."],["#..#.","#..#.","#####","...#.","...#."],["#####","#....","####.","....#","####."],[".###.","#....","####.","#...#",".###."],["#####","....#","...#.","..#..","..#.."],[".###.","#...#",".###.","#...#",".###."],[".###.","#...#",".####","....#",".###."],[".###.","#...#","#####","#...#","#...#"],["####.","#...#","####.","#...#","####."],[".####","#....","#....","#....",".####"],["####.","#...#","#...#","#...#","####."],["#####","#....","####.","#....","#####"],["#####","#....","####.","#....","#...."],[".....","..#..",".###.","..#..","....."],[".....",".....",".###.",".....","....."],[".#...","..#..","...#.","..#..",".#..."],["....#","...#.","..#..",".#...","#...."],[".....","#.#.#",".###.","#.#.#","....."],[".....","#####",".....","#####","....."],[".....",".....",".....",".....","#####"]],J=je.map(o=>o.reduce((c,u,a)=>{let s=c;for(let y=0;y<5;y++)u[y]==="#"&&(s+=2**(a*5+y));return s},0)),Ye=`#version 300 es
|
|
2
2
|
void main() {
|
|
3
3
|
vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
4
4
|
gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as T,m as De,j as ce}from"./index-
|
|
1
|
+
import{r as T,m as De,j as ce}from"./index-BxNTb8op.js";const fe=8,q=4,Ge=2.2,ze=`#version 300 es
|
|
2
2
|
in vec2 aPosition;
|
|
3
3
|
void main() {
|
|
4
4
|
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C,m as Ke,j as pe}from"./index-
|
|
1
|
+
import{r as C,m as Ke,j as pe}from"./index-BxNTb8op.js";const V=8,B=3,ge=2400,z=3.4,ve=2.8,xe=["#4a3a9c","#8eb2ea","#6e8c3c","#d6f2ef","#f2d48c"],Ue=`#version 300 es
|
|
2
2
|
void main() {
|
|
3
3
|
vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
4
4
|
gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as A,m as ke,j as de}from"./index-
|
|
1
|
+
import{r as A,m as ke,j as de}from"./index-BxNTb8op.js";const Oe="relative h-full w-full overflow-hidden",Ge="absolute inset-0 block h-full w-full",Be=`#version 300 es
|
|
2
2
|
in vec2 aPosition;
|
|
3
3
|
out vec2 vUv;
|
|
4
4
|
void main() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as j,m as Pt,j as Ze}from"./index-
|
|
1
|
+
import{r as j,m as Pt,j as Ze}from"./index-BxNTb8op.js";const et="ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$&*()-_+=/[]{};:<>.,0123456789",tt="ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, 'Liberation Mono', monospace",Lt=["#ffffff","#61dca3"],Dt=["#18181b","#0f9f6e"],Fe=8,kt=1.4,It=.2,Ut=.1,Xt=48,Bt=`#version 300 es
|
|
2
2
|
void main() {
|
|
3
3
|
vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
4
4
|
gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C,m as gt,j as Be}from"./index-
|
|
1
|
+
import{r as C,m as gt,j as Be}from"./index-BxNTb8op.js";const ge=8,ae=3,Ge=4,We=2400,xt=4,V=2.4,ze=2.2,Xe=["#f2f5ff","#7fb2ff","#2f6bff"],vt=`#version 300 es
|
|
2
2
|
void main() {
|
|
3
3
|
vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
4
4
|
gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as b,m as ye,j as ae}from"./index-
|
|
1
|
+
import{r as b,m as ye,j as ae}from"./index-BxNTb8op.js";const be=1.4,C=64,_e=[.299,.587,.114,.299,.587,.114,.299,.587,.114],Pe=[.701,-.587,-.114,-.299,.413,-.114,-.3,-.588,.886],Ae=[.168,-.331,.5,.328,.035,-.5,-.497,.296,.201],Ue=`#version 300 es
|
|
2
2
|
void main() {
|
|
3
3
|
vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
4
4
|
gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as S,m as Me,j as oe}from"./index-
|
|
1
|
+
import{r as S,m as Me,j as oe}from"./index-BxNTb8op.js";const Ee=24e5,O=Math.PI*2,ne={"top-right":{flipX:0,flipY:0,side:0},"top-left":{flipX:1,flipY:0,side:0},"bottom-right":{flipX:0,flipY:1,side:0},"bottom-left":{flipX:1,flipY:1,side:0},right:{flipX:0,flipY:0,side:1},left:{flipX:1,flipY:0,side:1}},Fe=`#version 300 es
|
|
2
2
|
const vec2 corners[3] = vec2[3](vec2(-1.0, -1.0), vec2(3.0, -1.0), vec2(-1.0, 3.0));
|
|
3
3
|
void main() {
|
|
4
4
|
gl_Position = vec4(corners[gl_VertexID], 0.0, 1.0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r,j as n,m as pt}from"./index-
|
|
1
|
+
import{r,j as n,m as pt}from"./index-BxNTb8op.js";const Ft=["LAUNCH READY","SYNC ONLINE","SIGNAL LIVE"],P={alpha:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",numeric:"0123456789"},Lt=`
|
|
2
2
|
.split-flap-text{gap:var(--split-flap-gap,6px);font-family:'SFMono-Regular','Roboto Mono','Cascadia Code','Liberation Mono',Menlo,monospace;font-size:var(--split-flap-font-size,52px);font-weight:760;line-height:1;letter-spacing:.035em;font-variant-numeric:tabular-nums}
|
|
3
3
|
.split-flap-text__tile{position:relative;flex:none;width:.78em;height:1.08em;overflow:hidden;border-radius:var(--split-flap-radius,8px);background:radial-gradient(circle at 50% 0%,rgba(255,255,255,.16),transparent 44%),linear-gradient(180deg,color-mix(in srgb,var(--split-flap-tile-color,#111827) 82%,white),var(--split-flap-tile-color,#111827));box-shadow:0 .035em .08em rgba(255,255,255,.08) inset,0 -.05em .1em rgba(0,0,0,.38) inset,0 calc(.16em * var(--split-flap-lift,1)) calc(.38em * var(--split-flap-lift,1)) rgba(0,0,0,var(--split-flap-drop,.28));perspective:10em;transform-style:preserve-3d;isolation:isolate}
|
|
4
4
|
.split-flap-text__tile::before{content:'';position:absolute;z-index:8;top:calc(50% - var(--split-flap-hinge,1px) / 2);left:0;width:100%;height:var(--split-flap-hinge,1px);background:linear-gradient(90deg,transparent,rgba(255,255,255,.18) 18%,rgba(0,0,0,var(--split-flap-hinge-shade,.64)) 50%,rgba(255,255,255,.14) 82%,transparent);box-shadow:0 -1px 0 rgba(255,255,255,.08),0 1px 0 rgba(0,0,0,.5);pointer-events:none}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as ot,m as $e,j as Zt}from"./index-BstFwFxc.js";const te="10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",ee=8,Ct=320,Pe=/^(currentcolor|inherit)$/i,Ie=.15,We=.62,D=(C,T,_,Q)=>C+(T-C)*(1-Math.exp(-_/Q)),ft=C=>Math.min(1,Math.max(0,Number(C)||0)),nt=(C,T,_)=>{const Q=ft((_-C)/(T-C));return Q*Q*(3-2*Q)},N=(...C)=>{let T=2166136261;for(const _ of C)T=Math.imul(T^(_|0),16777619),T^=T>>>13,T=Math.imul(T,1540483477),T^=T>>>15;return(T>>>0)/4294967296},oe=C=>C>0?`+${C}`:C<0?`−${-C}`:"0",He=({text:C="React Bits",fontFamily:T="",fontWeight:_=600,fontSize:Q=150,letterSpacing:ne=-.05,color:se="currentColor",accentColor:ae="currentColor",align:ie="center",reach:re=200,softness:ce=.7,dashLength:le=4,dashGap:fe=2,strokeWidth:de=1.5,lineStyle:ue="dashed",reveal:he="letter",specks:xe=15,selection:me=!0,labels:pe=!0,draggable:be=!0,bounce:ge=.4,sweep:ye=!0,speed:Me=1,clickKick:ve=!0,intro:Be="none",introDuration:we=2,guides:Ae=!1,className:ke="",style:Le})=>{const St=ot.useRef(null),Tt=ot.useRef(null),dt=ot.useRef(null),st=ot.useRef(()=>{});return ot.useEffect(()=>{dt.current={text:C,fontFamily:T,fontWeight:_,fontSize:Q,letterSpacing:ne,color:se,accentColor:ae,align:ie,reach:re,softness:ce,dashLength:le,dashGap:fe,strokeWidth:de,lineStyle:ue,reveal:he,specks:xe,selection:me,labels:pe,draggable:be,bounce:ge,sweep:ye,speed:Me,clickKick:ve,intro:Be,introDuration:we,guides:Ae},st.current()}),ot.useEffect(()=>{const y=St.current,O=Tt.current,n=O?.getContext("2d"),Y=document.createElement("canvas"),F=Y.getContext("2d");if(!y||!O||!n||!F)return;const gt=$e()?.matches;let K=1,at=1,b=1,it=0,yt=performance.now(),Mt=!1,vt=!0,Bt="",wt=!0,zt="",G=null,M=[],U=0,At=0,V=0,Ot=!1,L=-1,Dt="",kt=0,X="",z=!1,Ft=!document.fonts,Z=0;const q=[],P={x:0,y:0,time:0,index:-1},k={x:0,y:0,inside:!1},ut={x:0,y:0},I={x:0,y:0},f={x1:0,y1:0,x2:0,y2:0,alpha:0,index:-1},tt=()=>{Bt="",st.current()},$t=()=>{Ft=!0,tt()},Pt=t=>t.fontFamily||getComputedStyle(y).fontFamily||"sans-serif",It=(t,e)=>`${t.fontWeight} ${e}px ${Pt(t)}`,Ee=t=>{const e=getComputedStyle(y).color||"#000000",o=s=>!s||Pe.test(String(s).trim())?e:s;return{ink:o(t.color),accent:o(t.accentColor)}},Lt=(t,e,o)=>{t.font=It(e,o),"letterSpacing"in t&&(t.letterSpacing=`${e.letterSpacing*o}px`),t.textAlign="left",t.textBaseline="alphabetic"},Wt=(t,e,o,s,r)=>{const a=Math.ceil(t.strokeWidth*2+4),h=o.box.x1-a,l=o.box.y1-a,c=o.box.x2-o.box.x1+a*2,x=o.box.y2-o.box.y1+a*2,u=document.createElement("canvas");u.addEventListener("contextrestored",tt),u.width=Math.max(1,Math.ceil(c*b)),u.height=Math.max(1,Math.ceil(x*b));const d=u.getContext("2d");return d?(d.setTransform(b,0,0,b,-h*b,-l*b),Lt(d,t,e.size),s?(d.lineJoin="round",d.lineWidth=t.strokeWidth*2,d.lineCap="butt",d.strokeStyle=r,t.lineStyle!=="solid"&&d.setLineDash([Math.max(1,t.dashLength),Math.max(1,t.dashGap)]),d.strokeText(o.char,o.x,e.baseline),d.setLineDash([]),d.globalCompositeOperation="destination-out",d.fillStyle="#000000",d.fillText(o.char,o.x,e.baseline),d.globalCompositeOperation="source-over"):(d.fillStyle=r,d.fillText(o.char,o.x,e.baseline)),{image:u,left:h,top:l}):{image:u,left:h,top:l}},Re=(t,e)=>{const o=[t.text,Pt(t),t.fontWeight,t.fontSize,t.letterSpacing,t.align,e,t.dashLength,t.dashGap,t.strokeWidth,t.lineStyle,K,at,b].join("|");if(o===Bt&&G)return G;Bt=o;const s=It(t,64);document.fonts&&s!==zt&&(zt=s,document.fonts.load(s,t.text).then(tt,tt));const r=F;Lt(r,t,t.fontSize);let a=r.measureText(t.text);const h=Math.min(1,K*.9/Math.max(a.actualBoundingBoxLeft+a.actualBoundingBoxRight,1),at*.66/Math.max(a.actualBoundingBoxAscent+a.actualBoundingBoxDescent,1)),l=t.fontSize*h;Lt(r,t,l),a=r.measureText(t.text);const c=a.actualBoundingBoxLeft+a.actualBoundingBoxRight,x=a.actualBoundingBoxAscent+a.actualBoundingBoxDescent,u=K*.05,p=(t.align==="left"?u:t.align==="right"?K-u-c:(K-c)/2)+a.actualBoundingBoxLeft,m=(at-x)/2+a.actualBoundingBoxAscent,E=m-r.measureText("x").actualBoundingBoxAscent,A=m-r.measureText("H").actualBoundingBoxAscent,B=m-r.measureText("d").actualBoundingBoxAscent,R=m+r.measureText("p").actualBoundingBoxDescent,S=m-a.actualBoundingBoxAscent,i=m+a.actualBoundingBoxDescent,g=Math.min(S,A)-2,v=Math.max(i,m)+2,w={size:l,baseline:m,left:p-a.actualBoundingBoxLeft,right:p+a.actualBoundingBoxRight,top:S,bottom:i,lines:[{y:m,label:"baseline"},{y:E,label:"x-height"},{y:A,label:"cap height"},...A-B>Math.max(11,l*.06)?[{y:B,label:"ascender"}]:[],{y:R,label:"descender"}],bands:[{y0:E,y1:m,up:!0,order:0},{y0:A,y1:E,up:!0,order:1},{y0:g,y1:A,up:!0,order:2},{y0:m,y1:v,up:!1,order:1}].filter($=>$.y1-$.y0>.5)};G=w;const j=Array.from(t.text),H=M;M=[];let pt="";return j.forEach(($,ct)=>{pt+=$;const lt=r.measureText($),Et=p+r.measureText(pt).width-lt.width;if(!$.trim())return;const Rt={char:$,x:Et,box:{x1:Et-lt.actualBoundingBoxLeft,y1:m-lt.actualBoundingBoxAscent,x2:Et+lt.actualBoundingBoxRight,y2:m+lt.actualBoundingBoxDescent}},et=H[M.length],bt=et?.char===$&&et.index===ct;M.push({...Rt,offset:bt?et.offset:{x:0,y:0},velocity:bt?et.velocity:{x:0,y:0},outline:bt?et.outline:0,shown:bt?et.shown:1,cells:null,assembled:0,index:ct,fill:Wt(t,w,Rt,!1,e),dashes:Wt(t,w,Rt,!0,e)})}),L>=0&&M[L]?.index!==H[L]?.index&&(L=-1),f.index>=0&&M[f.index]?.char!==H[f.index]?.char&&(f.index=-1),w},jt=(t,e)=>{if(!G||e<G.top-24||e>G.bottom+24)return-1;let o=-1,s=1/0;return M.forEach((r,a)=>{const h=r.box.x1+r.offset.x,l=r.box.x2+r.offset.x,c=t<h?h-t:t>l?t-l:0;c<s&&(s=c,o=a)}),s<28?o:-1},Ht=(t,e,o,s,r,a)=>{const h=Math.min(1,Math.max(0,1-a)),l=t.createRadialGradient(e,o,0,e,o,s);if(l.addColorStop(0,`rgba(0, 0, 0, ${r})`),h>.995)return l.addColorStop(.995,`rgba(0, 0, 0, ${r})`),l.addColorStop(1,"rgba(0, 0, 0, 0)"),l;for(let c=0;c<=ee;c++){const x=c/ee,u=x*x*(3-2*x);l.addColorStop(h+(1-h)*x,`rgba(0, 0, 0, ${r*(1-u)})`)}return l},J=(t,e,o,s,r,a)=>{t.drawImage(e.image,Math.round((e.left+o)*b-r),Math.round((e.top+s)*b-a))},Ce=t=>{const e=t.reach*b,o=I.x*b,s=I.y*b;n.globalCompositeOperation="destination-out",n.fillStyle=Ht(n,o,s,e,U,t.softness),n.fillRect(o-e,s-e,e*2,e*2),n.globalCompositeOperation="source-over";const r=Math.max(0,Math.floor(o-e)),a=Math.max(0,Math.floor(s-e)),h=Math.min(O.width,Math.ceil(o+e)),l=Math.min(O.height,Math.ceil(s+e));if(h<=r||l<=a)return;const c=h-r,x=l-a;(Y.width<c||Y.height<x)&&(Y.width=Math.max(Y.width,c),Y.height=Math.max(Y.height,x)),F.setTransform(1,0,0,1,0,0),F.globalCompositeOperation="source-over",F.clearRect(0,0,c,x);for(const u of M)J(F,u.dashes,u.offset.x,u.offset.y,r,a);F.globalCompositeOperation="destination-in",F.fillStyle=Ht(F,o-r,s-a,e,1,t.softness),F.fillRect(0,0,c,x),F.globalCompositeOperation="source-over",n.globalAlpha=U,n.drawImage(Y,0,0,c,x,r,a,c,x),n.globalAlpha=1},rt=t=>(Math.round(t*b)+.5)/b,Nt=(t,e,o)=>{let s=(t%(2*(e+o))+2*(e+o))%(2*(e+o));return s<e?[f.x1+s,f.y1,0,-1]:(s-=e,s<o?[f.x2,f.y1+s,1,0]:(s-=o,s<e?[f.x2-s,f.y2,0,1]:(s-=e,[f.x1,f.y2-s,-1,0])))},Se=(t,e,o)=>{const s=f.x2-f.x1,r=f.y2-f.y1;if(s<2||r<2)return;const a=2*(s+r),h=f.index+1,l=3;n.fillStyle=o,n.strokeStyle=o;for(let c=0;c<t.specks;c++){const x=.5+N(h,c,11)*1.2,u=V/x+N(h,c,17),d=Math.floor(u),p=u-d;if(p>.7)continue;const[m,E,A,B]=Nt(N(h,c,d)*a,s,r),R=N(h,c,d,2),S=R<.46?2:R<.7?3:R<.84?5:R<.94?8:11,i=S>=8,g=(i?9:4)+Math.floor(N(h,c,d,1)*5)*l,v=f.x1+Math.round((m+A*g-f.x1)/l)*l,w=f.y1+Math.round((E+B*g-f.y1)/l)*l,j=N(h,c,d,3),H=p<.06||p>.32&&p<.36?.35:1,pt=e*(i?.3+.4*j:.3+.6*j)*H,$=Math.round(v-S/2),ct=Math.round(w-S/2);n.globalAlpha=pt,j<.26||i&&j<.78?(n.strokeRect($+.5,ct+.5,S,S),i&&j>.5&&n.fillRect(Math.round(v)-1,Math.round(w)-1,2,2)):n.fillRect($,ct,S,S)}for(let c=0;c<2;c++){const x=(V*.42*t.speed+c*.5)*a;for(let u=0;u<4;u++){const[d,p]=Nt(x-u*6,s,r),m=u===0?3:2;n.globalAlpha=e*[.95,.55,.32,.16][u],n.fillRect(Math.round(d-m/2),Math.round(p-m/2),m,m)}}n.globalAlpha=1},Te=(t,e)=>{const o=M[f.index];if(!o||f.alpha<.01)return;const s=f.alpha,r=rt(f.x1),a=rt(f.y1),h=rt(f.x2),l=rt(f.y2);n.setTransform(b,0,0,b,0,0),n.fillStyle=e,n.strokeStyle=e,n.lineWidth=1;const c=Math.hypot(o.offset.x,o.offset.y);if(c>1){const u=(o.box.x1+o.box.x2)/2,d=(o.box.y1+o.box.y2)/2;n.beginPath(),n.moveTo(u,d),n.lineTo(u+o.offset.x,d+o.offset.y),n.setLineDash([3,4]),n.globalAlpha=.45*s,n.stroke(),n.setLineDash([]),n.beginPath(),n.rect(Math.round(u)-2,Math.round(d)-2,4,4),n.globalAlpha=.7*s,n.fill()}n.beginPath(),n.rect(r,a,h-r,l-a),n.globalAlpha=.5*s,n.stroke(),n.beginPath();for(const[u,d]of[[r,a],[h,a],[h,l],[r,l]])n.rect(Math.round(u)-2,Math.round(d)-2,5,5);if(n.globalAlpha=.95*s,n.fill(),n.globalAlpha=1,t.specks>0&&Se(t,s,e),!t.labels)return;n.font=te,n.textAlign="left",n.textBaseline="bottom",n.fillStyle=e,n.globalAlpha=.62*s;const x=c>1?`${oe(Math.round(o.offset.x))}, ${oe(Math.round(-o.offset.y))}`:`${o.char} ${Math.round(o.box.x2-o.box.x1)} × ${Math.round(o.box.y2-o.box.y1)}`;n.fillText(x,Math.round(f.x1),Math.round(f.y1)-7),n.globalAlpha=1},Yt=(t,e,o,s,r)=>{const a=Math.max(12,e.size*.12),h=Math.round(e.left-a),l=Math.round(e.right+a),c=K-l>h;n.setTransform(b,0,0,b,0,0),n.strokeStyle=o,n.fillStyle=o,n.lineWidth=1,n.font=te,n.textBaseline="middle",n.textAlign=c?"left":"right",e.lines.forEach((x,u)=>{const d=r(u);if(d<=.001)return;const p=rt(x.y),m=h+(l-h)*d;n.globalAlpha=s*.4,n.beginPath(),n.moveTo(h,p),n.lineTo(m,p),n.stroke(),n.globalAlpha=s*.9,n.fillRect(h-1,Math.round(x.y)-1,3,3),n.fillRect(Math.round(m)-1,Math.round(x.y)-1,3,3),t.labels&&(n.globalAlpha=s*.62*nt(.7,1,d),n.fillText(x.label,c?l+8:h-8,Math.round(x.y)))}),n.textAlign="left",n.setTransform(1,0,0,1,0,0),n.globalAlpha=1},ze=(t,e)=>{if(t.cells)return t.cells;const o=t.fill,s=Math.max(3,Math.round(e.size/26)),r=o.image.width,a=o.image.height,h=o.image.getContext("2d"),l=[];if(t.cells=l,t.assembled=0,!h||r<2||a<2)return l;const c=h.getImageData(0,0,r,a).data,x=Math.floor(o.left/s)*s,u=Math.floor(o.top/s)*s,d=Math.ceil((o.left+r/b-x)/s)+1,p=Math.ceil((o.top+a/b-u)/s)+1,m=new Uint8Array(d*p);for(let B=0;B<a;B++)for(let R=0;R<r;R++){if(c[(B*r+R)*4+3]<24)continue;const S=Math.floor((o.left+R/b-x)/s),i=Math.floor((o.top+B/b-u)/s);m[i*d+S]=1}const E=(t.box.x1+t.box.x2)/2,A=ft((E-e.left)/Math.max(1,e.right-e.left));for(let B=0;B<m.length;B++){if(!m[B])continue;const R=N(t.index,B,1)*Math.PI*2,S=e.size*(.25+.6*N(t.index,B,2)),i=.03+.36*A+.12*N(t.index,B,3),g=i+.3+.14*N(t.index,B,4);l.push({x:x+B%d*s,y:u+Math.floor(B/d)*s,size:s,dx:Math.cos(R)*S,dy:Math.sin(R)*S*.7,start:i,land:g}),t.assembled=Math.max(t.assembled,g)}return l},Kt=(t,e,o)=>{const s=Math.round(t*b),r=Math.round(e*b);return[s,r,Math.round((t+o)*b)-s,Math.round((e+o)*b)-r]},Oe=(t,e,o)=>{const s=t.cells||[];n.save(),n.beginPath();let r=0;for(const a of s){if(e<a.land)continue;const[h,l,c,x]=Kt(a.x,a.y,a.size);n.rect(h,l,c,x),r++}r&&(n.clip(),J(n,t.fill,0,0,0,0)),n.restore(),n.fillStyle=o;for(const a of s){if(e<a.start||e>=a.land)continue;const h=(e-a.start)/(a.land-a.start),l=1-Math.pow(1-h,4),c=a.size*(.4+.6*l),x=a.x+(a.size-c)/2+a.dx*(1-l),u=a.y+(a.size-c)/2+a.dy*(1-l),[d,p,m,E]=Kt(x,u,c);n.globalAlpha=Math.min(1,h*4)*(.55+.45*l),n.fillRect(d,p,Math.max(1,m),Math.max(1,E))}n.globalAlpha=1},De=(t,e,o,s)=>{const r=t.fill,a=Math.floor(r.left*b),h=Math.floor(r.top*b),l=r.image.width+2,c=r.image.height+2,x=ft((o-.24-.28*e)/.48),u=[];for(const p of s.bands){const m=nt(.3*p.order,.3*p.order+.4,x);if(m<=0)continue;const E=(p.y1-p.y0)*m,A=Math.round((p.up?p.y1-E:p.y0)*b),B=Math.round((p.up?p.y1:p.y0+E)*b);B>A&&u.push([A,B-A])}const d=nt(.08+.2*e,.22+.2*e,o);if(d>.001){n.save(),n.beginPath(),n.rect(a-2,h-2,l+2,c+2);for(const[p,m]of u)n.rect(a-2,p,l+2,m);n.clip("evenodd"),n.globalAlpha=d,J(n,t.dashes,0,0,0,0),n.restore()}if(u.length){n.save(),n.beginPath();for(const[p,m]of u)n.rect(a-2,p,l+2,m);n.clip(),J(n,t.fill,0,0,0,0),n.restore()}n.globalAlpha=1},Fe=t=>{const e=(G?G.size:120)*11;q.push({index:t,at:V,velocity:e});for(let o=1;o<M.length;o++){const s=e*Math.pow(We,o);if(s<30)break;for(const r of[t-o,t+o])r>=0&&r<M.length&&q.push({index:r,at:V+o*.055,velocity:s})}st.current()},Gt=t=>{it=0;const e=dt.current;if(!e)return;if(wt){wt=!1,K=Math.max(1,y.clientWidth),at=Math.max(1,y.clientHeight),b=Math.min(window.devicePixelRatio||1,2);const i=Math.round(K*b),g=Math.round(at*b);O.width!==i&&(O.width=i),O.height!==g&&(O.height=g)}const o=Math.min(.05,Math.max(.001,(t-yt)/1e3));yt=t;const{ink:s,accent:r}=Ee(e),a=Re(e,s),h=2*Math.sqrt(Ct)*(1-ft(e.bounce)*.96);e.intro!==X&&(X=e.intro,kt=0);const l=X!=="none"&&!gt&&M.length>0;l&&Ft&&(kt+=o);const c=l?ft((kt-Ie)/Math.max(.3,e.introDuration)):1;z=l&&c<1;const x=!z&&e.sweep&&!gt&&!k.inside&&L<0;x&&(At+=o*e.speed),V+=o;let u=k.x,d=k.y;x&&(u=a.left+(a.right-a.left)*(.5-.5*Math.cos(At*.45)),d=a.top+(a.bottom-a.top)*(.45+.1*Math.sin(At*.8)));const p=!z&&(k.inside||x||L>=0);if(p&&!Ot&&(I.x=u,I.y=d),p){const i=k.inside?.05:.22;I.x=D(I.x,u,o,i),I.y=D(I.y,d,o,i)}Ot=p,U=D(U,e.reveal==="area"&&p&&L<0?1:0,o,.16);for(let i=q.length-1;i>=0;i--){if(q[i].at>V)continue;const g=M[q[i].index];g&&(g.velocity.y-=q[i].velocity),q.splice(i,1)}let m=!1;M.forEach((i,g)=>{if(g===L){i.offset.x=D(i.offset.x,k.x-ut.x,o,.03),i.offset.y=D(i.offset.y,k.y-ut.y,o,.03),i.velocity.x=0,i.velocity.y=0,m=!0;return}const{offset:v,velocity:w}=i;if(Math.abs(v.x)<.05&&Math.abs(v.y)<.05&&Math.hypot(w.x,w.y)<.5){v.x=0,v.y=0,w.x=0,w.y=0;return}w.x+=(-Ct*v.x-h*w.x)*o,w.y+=(-Ct*v.y-h*w.y)*o,v.x+=w.x*o,v.y+=w.y*o,m=!0});let E=-1;if(z&&X==="type"){const i=.86/M.length,g=Math.min(M.length-1,Math.floor(c/i));E=c<.93?g:-1,M.forEach((v,w)=>{v.shown=w<g?1:w===g?nt(0,i*.3,c-w*i):0})}else M.forEach(i=>{i.shown=1});const A=z?E:L>=0?L:p?jt(I.x,I.y):-1;if(A>=0&&e.selection){const i=M[A],g=i.box.x1+i.offset.x-6,v=i.box.y1+i.offset.y-6,w=i.box.x2+i.offset.x+6,j=i.box.y2+i.offset.y+6;(f.index<0||f.alpha<.02)&&(f.x1=g,f.y1=v,f.x2=w,f.y2=j);const H=A===L?.02:.08;f.x1=D(f.x1,g,o,H),f.y1=D(f.y1,v,o,H),f.x2=D(f.x2,w,o,H),f.y2=D(f.y2,j,o,H),f.index=A}f.alpha=D(f.alpha,A>=0&&e.selection?1:0,o,.1),M.forEach((i,g)=>{const v=z?X==="type"&&(g===E||E>=0&&g>E)?1:0:e.reveal==="letter"&&g===A&&g!==L?1:0;z&&i.shown===0&&(i.outline=v),i.outline=D(i.outline,v,o,.09),Math.abs(i.outline-v)>.002?m=!0:i.outline=v}),Z=D(Z,e.guides&&!z&&(A>=0||U>.4)?1:0,o,.14);const B=!z&&A>=0&&k.inside,R=L>=0?"grabbing":B&&e.draggable?"grab":B&&e.clickKick?"pointer":"";R!==Dt&&(Dt=R,y.style.cursor=R),n.setTransform(1,0,0,1,0,0),n.globalCompositeOperation="source-over",n.globalAlpha=1,n.clearRect(0,0,O.width,O.height);for(const i of M){const g=Math.hypot(i.offset.x,i.offset.y);g>1&&(n.globalAlpha=Math.min(1,g/24)*.55,J(n,i.dashes,0,0,0,0),n.globalAlpha=1)}z&&X==="metrics"?Yt(e,a,r,1-nt(.84,1,c),i=>nt(.02+.04*i,.2+.04*i,c)):Z>.005&&Yt(e,a,r,Z*.6,()=>1),M.forEach((i,g)=>{if(z&&X==="assemble"&&(ze(i,a),c<i.assembled)){Oe(i,c,r);return}if(z&&X==="metrics"){const v=M.length>1?g/(M.length-1):0;if(c<.72+.28*v){De(i,v,c,a);return}}i.shown<.001||(i.outline<.999&&(n.globalAlpha=(1-i.outline)*i.shown,J(n,i.fill,i.offset.x,i.offset.y,0,0)),i.outline>.001&&(n.globalAlpha=i.outline*i.shown,J(n,i.dashes,i.offset.x,i.offset.y,0,0)),n.globalAlpha=1)}),U>.001&&Ce(e),Te(e,r);const S=m||z||q.length>0||Z>.005&&Z<.995||Math.abs(U-(e.reveal==="area"&&p&&L<0?1:0))>.002||f.alpha>.01&&f.alpha<.99;(p||S)&&Mt&&vt&&(it=requestAnimationFrame(Gt))},W=()=>{it||!Mt||!vt||(yt=performance.now(),it=requestAnimationFrame(Gt))};st.current=W;const ht=()=>{wt=!0,W()},Xt=t=>{const e=y.getBoundingClientRect();k.x=t.clientX-e.left,k.y=t.clientY-e.top},xt=t=>{Xt(t),k.inside=!0,W()},qt=()=>{L>=0||(k.inside=!1,W())},_t=t=>{Xt(t),k.inside=!0;const e=dt.current,o=t.pointerType!=="mouse"||t.button===0,s=z||!o?-1:jt(k.x,k.y);P.x=k.x,P.y=k.y,P.time=performance.now(),P.index=s,e?.draggable&&s>=0&&(L=s,ut.x=k.x-M[s].offset.x,ut.y=k.y-M[s].offset.y,y.setPointerCapture?.(t.pointerId)),W()},mt=t=>{if(L>=0){L=-1,y.releasePointerCapture?.(t.pointerId);const e=y.getBoundingClientRect();k.inside=t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}if(t.type==="pointerup"&&P.index>=0&&dt.current?.clickKick&&!gt&&performance.now()-P.time<450){const e=y.getBoundingClientRect();Math.hypot(t.clientX-e.left-P.x,t.clientY-e.top-P.y)<6&&Fe(P.index)}P.index=-1,W()};y.addEventListener("pointermove",xt,{passive:!0}),y.addEventListener("pointerenter",xt,{passive:!0}),y.addEventListener("pointerdown",_t,{passive:!0}),y.addEventListener("pointerup",mt,{passive:!0}),y.addEventListener("pointercancel",mt,{passive:!0}),y.addEventListener("pointerleave",qt,{passive:!0}),O.addEventListener("contextrestored",tt);const Qt=new ResizeObserver(ht);Qt.observe(y),window.addEventListener("resize",ht,{passive:!0});const Ut=new IntersectionObserver(([t])=>{Mt=t.isIntersecting,W()});Ut.observe(y);const Jt=new MutationObserver(W);for(const t of[document.documentElement,document.body])t&&Jt.observe(t,{attributes:!0,attributeFilter:["class","style","data-theme"]});const Vt=window.matchMedia?.("(prefers-color-scheme: dark)");return Vt?.addEventListener?.("change",W),document.fonts&&document.fonts.ready.then($t,$t),ht(),()=>{vt=!1,cancelAnimationFrame(it),st.current=()=>{},Qt.disconnect(),window.removeEventListener("resize",ht),Ut.disconnect(),Jt.disconnect(),Vt?.removeEventListener?.("change",W),y.style.cursor="",y.removeEventListener("pointermove",xt),y.removeEventListener("pointerenter",xt),y.removeEventListener("pointerdown",_t),y.removeEventListener("pointerup",mt),y.removeEventListener("pointercancel",mt),y.removeEventListener("pointerleave",qt),O.removeEventListener("contextrestored",tt)}},[]),Zt.jsx("div",{ref:St,className:`relative w-full h-full touch-pan-y select-none ${ke}`.trim(),style:Le,role:"img","aria-label":C,children:Zt.jsx("canvas",{ref:Tt,className:"block w-full h-full"})})};export{He as default};
|
|
1
|
+
import{r as ot,m as $e,j as Zt}from"./index-BxNTb8op.js";const te="10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",ee=8,Ct=320,Pe=/^(currentcolor|inherit)$/i,Ie=.15,We=.62,D=(C,T,_,Q)=>C+(T-C)*(1-Math.exp(-_/Q)),ft=C=>Math.min(1,Math.max(0,Number(C)||0)),nt=(C,T,_)=>{const Q=ft((_-C)/(T-C));return Q*Q*(3-2*Q)},N=(...C)=>{let T=2166136261;for(const _ of C)T=Math.imul(T^(_|0),16777619),T^=T>>>13,T=Math.imul(T,1540483477),T^=T>>>15;return(T>>>0)/4294967296},oe=C=>C>0?`+${C}`:C<0?`−${-C}`:"0",He=({text:C="React Bits",fontFamily:T="",fontWeight:_=600,fontSize:Q=150,letterSpacing:ne=-.05,color:se="currentColor",accentColor:ae="currentColor",align:ie="center",reach:re=200,softness:ce=.7,dashLength:le=4,dashGap:fe=2,strokeWidth:de=1.5,lineStyle:ue="dashed",reveal:he="letter",specks:xe=15,selection:me=!0,labels:pe=!0,draggable:be=!0,bounce:ge=.4,sweep:ye=!0,speed:Me=1,clickKick:ve=!0,intro:Be="none",introDuration:we=2,guides:Ae=!1,className:ke="",style:Le})=>{const St=ot.useRef(null),Tt=ot.useRef(null),dt=ot.useRef(null),st=ot.useRef(()=>{});return ot.useEffect(()=>{dt.current={text:C,fontFamily:T,fontWeight:_,fontSize:Q,letterSpacing:ne,color:se,accentColor:ae,align:ie,reach:re,softness:ce,dashLength:le,dashGap:fe,strokeWidth:de,lineStyle:ue,reveal:he,specks:xe,selection:me,labels:pe,draggable:be,bounce:ge,sweep:ye,speed:Me,clickKick:ve,intro:Be,introDuration:we,guides:Ae},st.current()}),ot.useEffect(()=>{const y=St.current,O=Tt.current,n=O?.getContext("2d"),Y=document.createElement("canvas"),F=Y.getContext("2d");if(!y||!O||!n||!F)return;const gt=$e()?.matches;let K=1,at=1,b=1,it=0,yt=performance.now(),Mt=!1,vt=!0,Bt="",wt=!0,zt="",G=null,M=[],U=0,At=0,V=0,Ot=!1,L=-1,Dt="",kt=0,X="",z=!1,Ft=!document.fonts,Z=0;const q=[],P={x:0,y:0,time:0,index:-1},k={x:0,y:0,inside:!1},ut={x:0,y:0},I={x:0,y:0},f={x1:0,y1:0,x2:0,y2:0,alpha:0,index:-1},tt=()=>{Bt="",st.current()},$t=()=>{Ft=!0,tt()},Pt=t=>t.fontFamily||getComputedStyle(y).fontFamily||"sans-serif",It=(t,e)=>`${t.fontWeight} ${e}px ${Pt(t)}`,Ee=t=>{const e=getComputedStyle(y).color||"#000000",o=s=>!s||Pe.test(String(s).trim())?e:s;return{ink:o(t.color),accent:o(t.accentColor)}},Lt=(t,e,o)=>{t.font=It(e,o),"letterSpacing"in t&&(t.letterSpacing=`${e.letterSpacing*o}px`),t.textAlign="left",t.textBaseline="alphabetic"},Wt=(t,e,o,s,r)=>{const a=Math.ceil(t.strokeWidth*2+4),h=o.box.x1-a,l=o.box.y1-a,c=o.box.x2-o.box.x1+a*2,x=o.box.y2-o.box.y1+a*2,u=document.createElement("canvas");u.addEventListener("contextrestored",tt),u.width=Math.max(1,Math.ceil(c*b)),u.height=Math.max(1,Math.ceil(x*b));const d=u.getContext("2d");return d?(d.setTransform(b,0,0,b,-h*b,-l*b),Lt(d,t,e.size),s?(d.lineJoin="round",d.lineWidth=t.strokeWidth*2,d.lineCap="butt",d.strokeStyle=r,t.lineStyle!=="solid"&&d.setLineDash([Math.max(1,t.dashLength),Math.max(1,t.dashGap)]),d.strokeText(o.char,o.x,e.baseline),d.setLineDash([]),d.globalCompositeOperation="destination-out",d.fillStyle="#000000",d.fillText(o.char,o.x,e.baseline),d.globalCompositeOperation="source-over"):(d.fillStyle=r,d.fillText(o.char,o.x,e.baseline)),{image:u,left:h,top:l}):{image:u,left:h,top:l}},Re=(t,e)=>{const o=[t.text,Pt(t),t.fontWeight,t.fontSize,t.letterSpacing,t.align,e,t.dashLength,t.dashGap,t.strokeWidth,t.lineStyle,K,at,b].join("|");if(o===Bt&&G)return G;Bt=o;const s=It(t,64);document.fonts&&s!==zt&&(zt=s,document.fonts.load(s,t.text).then(tt,tt));const r=F;Lt(r,t,t.fontSize);let a=r.measureText(t.text);const h=Math.min(1,K*.9/Math.max(a.actualBoundingBoxLeft+a.actualBoundingBoxRight,1),at*.66/Math.max(a.actualBoundingBoxAscent+a.actualBoundingBoxDescent,1)),l=t.fontSize*h;Lt(r,t,l),a=r.measureText(t.text);const c=a.actualBoundingBoxLeft+a.actualBoundingBoxRight,x=a.actualBoundingBoxAscent+a.actualBoundingBoxDescent,u=K*.05,p=(t.align==="left"?u:t.align==="right"?K-u-c:(K-c)/2)+a.actualBoundingBoxLeft,m=(at-x)/2+a.actualBoundingBoxAscent,E=m-r.measureText("x").actualBoundingBoxAscent,A=m-r.measureText("H").actualBoundingBoxAscent,B=m-r.measureText("d").actualBoundingBoxAscent,R=m+r.measureText("p").actualBoundingBoxDescent,S=m-a.actualBoundingBoxAscent,i=m+a.actualBoundingBoxDescent,g=Math.min(S,A)-2,v=Math.max(i,m)+2,w={size:l,baseline:m,left:p-a.actualBoundingBoxLeft,right:p+a.actualBoundingBoxRight,top:S,bottom:i,lines:[{y:m,label:"baseline"},{y:E,label:"x-height"},{y:A,label:"cap height"},...A-B>Math.max(11,l*.06)?[{y:B,label:"ascender"}]:[],{y:R,label:"descender"}],bands:[{y0:E,y1:m,up:!0,order:0},{y0:A,y1:E,up:!0,order:1},{y0:g,y1:A,up:!0,order:2},{y0:m,y1:v,up:!1,order:1}].filter($=>$.y1-$.y0>.5)};G=w;const j=Array.from(t.text),H=M;M=[];let pt="";return j.forEach(($,ct)=>{pt+=$;const lt=r.measureText($),Et=p+r.measureText(pt).width-lt.width;if(!$.trim())return;const Rt={char:$,x:Et,box:{x1:Et-lt.actualBoundingBoxLeft,y1:m-lt.actualBoundingBoxAscent,x2:Et+lt.actualBoundingBoxRight,y2:m+lt.actualBoundingBoxDescent}},et=H[M.length],bt=et?.char===$&&et.index===ct;M.push({...Rt,offset:bt?et.offset:{x:0,y:0},velocity:bt?et.velocity:{x:0,y:0},outline:bt?et.outline:0,shown:bt?et.shown:1,cells:null,assembled:0,index:ct,fill:Wt(t,w,Rt,!1,e),dashes:Wt(t,w,Rt,!0,e)})}),L>=0&&M[L]?.index!==H[L]?.index&&(L=-1),f.index>=0&&M[f.index]?.char!==H[f.index]?.char&&(f.index=-1),w},jt=(t,e)=>{if(!G||e<G.top-24||e>G.bottom+24)return-1;let o=-1,s=1/0;return M.forEach((r,a)=>{const h=r.box.x1+r.offset.x,l=r.box.x2+r.offset.x,c=t<h?h-t:t>l?t-l:0;c<s&&(s=c,o=a)}),s<28?o:-1},Ht=(t,e,o,s,r,a)=>{const h=Math.min(1,Math.max(0,1-a)),l=t.createRadialGradient(e,o,0,e,o,s);if(l.addColorStop(0,`rgba(0, 0, 0, ${r})`),h>.995)return l.addColorStop(.995,`rgba(0, 0, 0, ${r})`),l.addColorStop(1,"rgba(0, 0, 0, 0)"),l;for(let c=0;c<=ee;c++){const x=c/ee,u=x*x*(3-2*x);l.addColorStop(h+(1-h)*x,`rgba(0, 0, 0, ${r*(1-u)})`)}return l},J=(t,e,o,s,r,a)=>{t.drawImage(e.image,Math.round((e.left+o)*b-r),Math.round((e.top+s)*b-a))},Ce=t=>{const e=t.reach*b,o=I.x*b,s=I.y*b;n.globalCompositeOperation="destination-out",n.fillStyle=Ht(n,o,s,e,U,t.softness),n.fillRect(o-e,s-e,e*2,e*2),n.globalCompositeOperation="source-over";const r=Math.max(0,Math.floor(o-e)),a=Math.max(0,Math.floor(s-e)),h=Math.min(O.width,Math.ceil(o+e)),l=Math.min(O.height,Math.ceil(s+e));if(h<=r||l<=a)return;const c=h-r,x=l-a;(Y.width<c||Y.height<x)&&(Y.width=Math.max(Y.width,c),Y.height=Math.max(Y.height,x)),F.setTransform(1,0,0,1,0,0),F.globalCompositeOperation="source-over",F.clearRect(0,0,c,x);for(const u of M)J(F,u.dashes,u.offset.x,u.offset.y,r,a);F.globalCompositeOperation="destination-in",F.fillStyle=Ht(F,o-r,s-a,e,1,t.softness),F.fillRect(0,0,c,x),F.globalCompositeOperation="source-over",n.globalAlpha=U,n.drawImage(Y,0,0,c,x,r,a,c,x),n.globalAlpha=1},rt=t=>(Math.round(t*b)+.5)/b,Nt=(t,e,o)=>{let s=(t%(2*(e+o))+2*(e+o))%(2*(e+o));return s<e?[f.x1+s,f.y1,0,-1]:(s-=e,s<o?[f.x2,f.y1+s,1,0]:(s-=o,s<e?[f.x2-s,f.y2,0,1]:(s-=e,[f.x1,f.y2-s,-1,0])))},Se=(t,e,o)=>{const s=f.x2-f.x1,r=f.y2-f.y1;if(s<2||r<2)return;const a=2*(s+r),h=f.index+1,l=3;n.fillStyle=o,n.strokeStyle=o;for(let c=0;c<t.specks;c++){const x=.5+N(h,c,11)*1.2,u=V/x+N(h,c,17),d=Math.floor(u),p=u-d;if(p>.7)continue;const[m,E,A,B]=Nt(N(h,c,d)*a,s,r),R=N(h,c,d,2),S=R<.46?2:R<.7?3:R<.84?5:R<.94?8:11,i=S>=8,g=(i?9:4)+Math.floor(N(h,c,d,1)*5)*l,v=f.x1+Math.round((m+A*g-f.x1)/l)*l,w=f.y1+Math.round((E+B*g-f.y1)/l)*l,j=N(h,c,d,3),H=p<.06||p>.32&&p<.36?.35:1,pt=e*(i?.3+.4*j:.3+.6*j)*H,$=Math.round(v-S/2),ct=Math.round(w-S/2);n.globalAlpha=pt,j<.26||i&&j<.78?(n.strokeRect($+.5,ct+.5,S,S),i&&j>.5&&n.fillRect(Math.round(v)-1,Math.round(w)-1,2,2)):n.fillRect($,ct,S,S)}for(let c=0;c<2;c++){const x=(V*.42*t.speed+c*.5)*a;for(let u=0;u<4;u++){const[d,p]=Nt(x-u*6,s,r),m=u===0?3:2;n.globalAlpha=e*[.95,.55,.32,.16][u],n.fillRect(Math.round(d-m/2),Math.round(p-m/2),m,m)}}n.globalAlpha=1},Te=(t,e)=>{const o=M[f.index];if(!o||f.alpha<.01)return;const s=f.alpha,r=rt(f.x1),a=rt(f.y1),h=rt(f.x2),l=rt(f.y2);n.setTransform(b,0,0,b,0,0),n.fillStyle=e,n.strokeStyle=e,n.lineWidth=1;const c=Math.hypot(o.offset.x,o.offset.y);if(c>1){const u=(o.box.x1+o.box.x2)/2,d=(o.box.y1+o.box.y2)/2;n.beginPath(),n.moveTo(u,d),n.lineTo(u+o.offset.x,d+o.offset.y),n.setLineDash([3,4]),n.globalAlpha=.45*s,n.stroke(),n.setLineDash([]),n.beginPath(),n.rect(Math.round(u)-2,Math.round(d)-2,4,4),n.globalAlpha=.7*s,n.fill()}n.beginPath(),n.rect(r,a,h-r,l-a),n.globalAlpha=.5*s,n.stroke(),n.beginPath();for(const[u,d]of[[r,a],[h,a],[h,l],[r,l]])n.rect(Math.round(u)-2,Math.round(d)-2,5,5);if(n.globalAlpha=.95*s,n.fill(),n.globalAlpha=1,t.specks>0&&Se(t,s,e),!t.labels)return;n.font=te,n.textAlign="left",n.textBaseline="bottom",n.fillStyle=e,n.globalAlpha=.62*s;const x=c>1?`${oe(Math.round(o.offset.x))}, ${oe(Math.round(-o.offset.y))}`:`${o.char} ${Math.round(o.box.x2-o.box.x1)} × ${Math.round(o.box.y2-o.box.y1)}`;n.fillText(x,Math.round(f.x1),Math.round(f.y1)-7),n.globalAlpha=1},Yt=(t,e,o,s,r)=>{const a=Math.max(12,e.size*.12),h=Math.round(e.left-a),l=Math.round(e.right+a),c=K-l>h;n.setTransform(b,0,0,b,0,0),n.strokeStyle=o,n.fillStyle=o,n.lineWidth=1,n.font=te,n.textBaseline="middle",n.textAlign=c?"left":"right",e.lines.forEach((x,u)=>{const d=r(u);if(d<=.001)return;const p=rt(x.y),m=h+(l-h)*d;n.globalAlpha=s*.4,n.beginPath(),n.moveTo(h,p),n.lineTo(m,p),n.stroke(),n.globalAlpha=s*.9,n.fillRect(h-1,Math.round(x.y)-1,3,3),n.fillRect(Math.round(m)-1,Math.round(x.y)-1,3,3),t.labels&&(n.globalAlpha=s*.62*nt(.7,1,d),n.fillText(x.label,c?l+8:h-8,Math.round(x.y)))}),n.textAlign="left",n.setTransform(1,0,0,1,0,0),n.globalAlpha=1},ze=(t,e)=>{if(t.cells)return t.cells;const o=t.fill,s=Math.max(3,Math.round(e.size/26)),r=o.image.width,a=o.image.height,h=o.image.getContext("2d"),l=[];if(t.cells=l,t.assembled=0,!h||r<2||a<2)return l;const c=h.getImageData(0,0,r,a).data,x=Math.floor(o.left/s)*s,u=Math.floor(o.top/s)*s,d=Math.ceil((o.left+r/b-x)/s)+1,p=Math.ceil((o.top+a/b-u)/s)+1,m=new Uint8Array(d*p);for(let B=0;B<a;B++)for(let R=0;R<r;R++){if(c[(B*r+R)*4+3]<24)continue;const S=Math.floor((o.left+R/b-x)/s),i=Math.floor((o.top+B/b-u)/s);m[i*d+S]=1}const E=(t.box.x1+t.box.x2)/2,A=ft((E-e.left)/Math.max(1,e.right-e.left));for(let B=0;B<m.length;B++){if(!m[B])continue;const R=N(t.index,B,1)*Math.PI*2,S=e.size*(.25+.6*N(t.index,B,2)),i=.03+.36*A+.12*N(t.index,B,3),g=i+.3+.14*N(t.index,B,4);l.push({x:x+B%d*s,y:u+Math.floor(B/d)*s,size:s,dx:Math.cos(R)*S,dy:Math.sin(R)*S*.7,start:i,land:g}),t.assembled=Math.max(t.assembled,g)}return l},Kt=(t,e,o)=>{const s=Math.round(t*b),r=Math.round(e*b);return[s,r,Math.round((t+o)*b)-s,Math.round((e+o)*b)-r]},Oe=(t,e,o)=>{const s=t.cells||[];n.save(),n.beginPath();let r=0;for(const a of s){if(e<a.land)continue;const[h,l,c,x]=Kt(a.x,a.y,a.size);n.rect(h,l,c,x),r++}r&&(n.clip(),J(n,t.fill,0,0,0,0)),n.restore(),n.fillStyle=o;for(const a of s){if(e<a.start||e>=a.land)continue;const h=(e-a.start)/(a.land-a.start),l=1-Math.pow(1-h,4),c=a.size*(.4+.6*l),x=a.x+(a.size-c)/2+a.dx*(1-l),u=a.y+(a.size-c)/2+a.dy*(1-l),[d,p,m,E]=Kt(x,u,c);n.globalAlpha=Math.min(1,h*4)*(.55+.45*l),n.fillRect(d,p,Math.max(1,m),Math.max(1,E))}n.globalAlpha=1},De=(t,e,o,s)=>{const r=t.fill,a=Math.floor(r.left*b),h=Math.floor(r.top*b),l=r.image.width+2,c=r.image.height+2,x=ft((o-.24-.28*e)/.48),u=[];for(const p of s.bands){const m=nt(.3*p.order,.3*p.order+.4,x);if(m<=0)continue;const E=(p.y1-p.y0)*m,A=Math.round((p.up?p.y1-E:p.y0)*b),B=Math.round((p.up?p.y1:p.y0+E)*b);B>A&&u.push([A,B-A])}const d=nt(.08+.2*e,.22+.2*e,o);if(d>.001){n.save(),n.beginPath(),n.rect(a-2,h-2,l+2,c+2);for(const[p,m]of u)n.rect(a-2,p,l+2,m);n.clip("evenodd"),n.globalAlpha=d,J(n,t.dashes,0,0,0,0),n.restore()}if(u.length){n.save(),n.beginPath();for(const[p,m]of u)n.rect(a-2,p,l+2,m);n.clip(),J(n,t.fill,0,0,0,0),n.restore()}n.globalAlpha=1},Fe=t=>{const e=(G?G.size:120)*11;q.push({index:t,at:V,velocity:e});for(let o=1;o<M.length;o++){const s=e*Math.pow(We,o);if(s<30)break;for(const r of[t-o,t+o])r>=0&&r<M.length&&q.push({index:r,at:V+o*.055,velocity:s})}st.current()},Gt=t=>{it=0;const e=dt.current;if(!e)return;if(wt){wt=!1,K=Math.max(1,y.clientWidth),at=Math.max(1,y.clientHeight),b=Math.min(window.devicePixelRatio||1,2);const i=Math.round(K*b),g=Math.round(at*b);O.width!==i&&(O.width=i),O.height!==g&&(O.height=g)}const o=Math.min(.05,Math.max(.001,(t-yt)/1e3));yt=t;const{ink:s,accent:r}=Ee(e),a=Re(e,s),h=2*Math.sqrt(Ct)*(1-ft(e.bounce)*.96);e.intro!==X&&(X=e.intro,kt=0);const l=X!=="none"&&!gt&&M.length>0;l&&Ft&&(kt+=o);const c=l?ft((kt-Ie)/Math.max(.3,e.introDuration)):1;z=l&&c<1;const x=!z&&e.sweep&&!gt&&!k.inside&&L<0;x&&(At+=o*e.speed),V+=o;let u=k.x,d=k.y;x&&(u=a.left+(a.right-a.left)*(.5-.5*Math.cos(At*.45)),d=a.top+(a.bottom-a.top)*(.45+.1*Math.sin(At*.8)));const p=!z&&(k.inside||x||L>=0);if(p&&!Ot&&(I.x=u,I.y=d),p){const i=k.inside?.05:.22;I.x=D(I.x,u,o,i),I.y=D(I.y,d,o,i)}Ot=p,U=D(U,e.reveal==="area"&&p&&L<0?1:0,o,.16);for(let i=q.length-1;i>=0;i--){if(q[i].at>V)continue;const g=M[q[i].index];g&&(g.velocity.y-=q[i].velocity),q.splice(i,1)}let m=!1;M.forEach((i,g)=>{if(g===L){i.offset.x=D(i.offset.x,k.x-ut.x,o,.03),i.offset.y=D(i.offset.y,k.y-ut.y,o,.03),i.velocity.x=0,i.velocity.y=0,m=!0;return}const{offset:v,velocity:w}=i;if(Math.abs(v.x)<.05&&Math.abs(v.y)<.05&&Math.hypot(w.x,w.y)<.5){v.x=0,v.y=0,w.x=0,w.y=0;return}w.x+=(-Ct*v.x-h*w.x)*o,w.y+=(-Ct*v.y-h*w.y)*o,v.x+=w.x*o,v.y+=w.y*o,m=!0});let E=-1;if(z&&X==="type"){const i=.86/M.length,g=Math.min(M.length-1,Math.floor(c/i));E=c<.93?g:-1,M.forEach((v,w)=>{v.shown=w<g?1:w===g?nt(0,i*.3,c-w*i):0})}else M.forEach(i=>{i.shown=1});const A=z?E:L>=0?L:p?jt(I.x,I.y):-1;if(A>=0&&e.selection){const i=M[A],g=i.box.x1+i.offset.x-6,v=i.box.y1+i.offset.y-6,w=i.box.x2+i.offset.x+6,j=i.box.y2+i.offset.y+6;(f.index<0||f.alpha<.02)&&(f.x1=g,f.y1=v,f.x2=w,f.y2=j);const H=A===L?.02:.08;f.x1=D(f.x1,g,o,H),f.y1=D(f.y1,v,o,H),f.x2=D(f.x2,w,o,H),f.y2=D(f.y2,j,o,H),f.index=A}f.alpha=D(f.alpha,A>=0&&e.selection?1:0,o,.1),M.forEach((i,g)=>{const v=z?X==="type"&&(g===E||E>=0&&g>E)?1:0:e.reveal==="letter"&&g===A&&g!==L?1:0;z&&i.shown===0&&(i.outline=v),i.outline=D(i.outline,v,o,.09),Math.abs(i.outline-v)>.002?m=!0:i.outline=v}),Z=D(Z,e.guides&&!z&&(A>=0||U>.4)?1:0,o,.14);const B=!z&&A>=0&&k.inside,R=L>=0?"grabbing":B&&e.draggable?"grab":B&&e.clickKick?"pointer":"";R!==Dt&&(Dt=R,y.style.cursor=R),n.setTransform(1,0,0,1,0,0),n.globalCompositeOperation="source-over",n.globalAlpha=1,n.clearRect(0,0,O.width,O.height);for(const i of M){const g=Math.hypot(i.offset.x,i.offset.y);g>1&&(n.globalAlpha=Math.min(1,g/24)*.55,J(n,i.dashes,0,0,0,0),n.globalAlpha=1)}z&&X==="metrics"?Yt(e,a,r,1-nt(.84,1,c),i=>nt(.02+.04*i,.2+.04*i,c)):Z>.005&&Yt(e,a,r,Z*.6,()=>1),M.forEach((i,g)=>{if(z&&X==="assemble"&&(ze(i,a),c<i.assembled)){Oe(i,c,r);return}if(z&&X==="metrics"){const v=M.length>1?g/(M.length-1):0;if(c<.72+.28*v){De(i,v,c,a);return}}i.shown<.001||(i.outline<.999&&(n.globalAlpha=(1-i.outline)*i.shown,J(n,i.fill,i.offset.x,i.offset.y,0,0)),i.outline>.001&&(n.globalAlpha=i.outline*i.shown,J(n,i.dashes,i.offset.x,i.offset.y,0,0)),n.globalAlpha=1)}),U>.001&&Ce(e),Te(e,r);const S=m||z||q.length>0||Z>.005&&Z<.995||Math.abs(U-(e.reveal==="area"&&p&&L<0?1:0))>.002||f.alpha>.01&&f.alpha<.99;(p||S)&&Mt&&vt&&(it=requestAnimationFrame(Gt))},W=()=>{it||!Mt||!vt||(yt=performance.now(),it=requestAnimationFrame(Gt))};st.current=W;const ht=()=>{wt=!0,W()},Xt=t=>{const e=y.getBoundingClientRect();k.x=t.clientX-e.left,k.y=t.clientY-e.top},xt=t=>{Xt(t),k.inside=!0,W()},qt=()=>{L>=0||(k.inside=!1,W())},_t=t=>{Xt(t),k.inside=!0;const e=dt.current,o=t.pointerType!=="mouse"||t.button===0,s=z||!o?-1:jt(k.x,k.y);P.x=k.x,P.y=k.y,P.time=performance.now(),P.index=s,e?.draggable&&s>=0&&(L=s,ut.x=k.x-M[s].offset.x,ut.y=k.y-M[s].offset.y,y.setPointerCapture?.(t.pointerId)),W()},mt=t=>{if(L>=0){L=-1,y.releasePointerCapture?.(t.pointerId);const e=y.getBoundingClientRect();k.inside=t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}if(t.type==="pointerup"&&P.index>=0&&dt.current?.clickKick&&!gt&&performance.now()-P.time<450){const e=y.getBoundingClientRect();Math.hypot(t.clientX-e.left-P.x,t.clientY-e.top-P.y)<6&&Fe(P.index)}P.index=-1,W()};y.addEventListener("pointermove",xt,{passive:!0}),y.addEventListener("pointerenter",xt,{passive:!0}),y.addEventListener("pointerdown",_t,{passive:!0}),y.addEventListener("pointerup",mt,{passive:!0}),y.addEventListener("pointercancel",mt,{passive:!0}),y.addEventListener("pointerleave",qt,{passive:!0}),O.addEventListener("contextrestored",tt);const Qt=new ResizeObserver(ht);Qt.observe(y),window.addEventListener("resize",ht,{passive:!0});const Ut=new IntersectionObserver(([t])=>{Mt=t.isIntersecting,W()});Ut.observe(y);const Jt=new MutationObserver(W);for(const t of[document.documentElement,document.body])t&&Jt.observe(t,{attributes:!0,attributeFilter:["class","style","data-theme"]});const Vt=window.matchMedia?.("(prefers-color-scheme: dark)");return Vt?.addEventListener?.("change",W),document.fonts&&document.fonts.ready.then($t,$t),ht(),()=>{vt=!1,cancelAnimationFrame(it),st.current=()=>{},Qt.disconnect(),window.removeEventListener("resize",ht),Ut.disconnect(),Jt.disconnect(),Vt?.removeEventListener?.("change",W),y.style.cursor="",y.removeEventListener("pointermove",xt),y.removeEventListener("pointerenter",xt),y.removeEventListener("pointerdown",_t),y.removeEventListener("pointerup",mt),y.removeEventListener("pointercancel",mt),y.removeEventListener("pointerleave",qt),O.removeEventListener("contextrestored",tt)}},[]),Zt.jsx("div",{ref:St,className:`relative w-full h-full touch-pan-y select-none ${ke}`.trim(),style:Le,role:"img","aria-label":C,children:Zt.jsx("canvas",{ref:Tt,className:"block w-full h-full"})})};export{He as default};
|