exodeui 6.4.0 → 6.4.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.
- package/dist/index.js +1 -1
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
`||p[ft]==="\r");if(vt&&At>0&&ft++,vt){if(((Xt=q.top)==null?void 0:Xt.width)>0){const Gt=j+At*k-q.top.offset;t.strokeStyle=q.top.color||"#000000",t.lineWidth=q.top.width,t.beginPath();const Yt=-i/2+k*.2;t.moveTo(Yt,Gt),t.lineTo(i/2-k*.2,Gt),t.stroke()}if(((zt=q.bottom)==null?void 0:zt.width)>0){const Gt=j+(At+1)*k-q.bottom.offset;t.strokeStyle=q.bottom.color||"#000000",t.lineWidth=q.bottom.width,t.beginPath();const Yt=-i/2+k*.2;t.moveTo(Yt,Gt),t.lineTo(i/2-k*.2,Gt),t.stroke()}}ft+=(xt.text||"").length})}if(e.stroke&&e.stroke.width>0){const ft=t.globalAlpha;e.fill&&e.fill.type!=="None"&&e.fill.isEnabled!==!1&&e.fill.opacity!==0&&e.fill.color!=="transparent"&&e.fill.color!=="rgba(0,0,0,0)"&&(t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=e.stroke.color;const At=t.getTransform(),Pt=Math.sqrt(At.a*At.a+At.b*At.b)||1,vt=window.devicePixelRatio||1;t.lineWidth=(e.stroke.width||1)*vt/Pt,t.globalAlpha=ft*this.normalizeOpacity(e.stroke.opacity??100);let Xt=0,zt=j;(O||[]).forEach(Gt=>{let Yt=-X/2;M==="center"?Yt=0:M==="right"&&(Yt=X/2),N(Gt.text,Yt,zt,!0,Xt),Xt+=(Gt.text||"").length,zt+=k,Xt<p.length&&(p[Xt]===`
|
|
17
17
|
`||p[Xt]==="\r")&&(P>0&&(zt+=P),Xt++,p[Xt-1]==="\r"&&p[Xt]===`
|
|
18
18
|
`&&Xt++)}),t.globalAlpha=ft}}}applyStrokeAlignment(t,s,o,e,n,i){if(!s.stroke||s.stroke.width<=0||s.stroke.isEnabled===!1)return;const a=s.stroke,r=t.getTransform(),c=Math.sqrt(r.a*r.a+r.b*r.b)||1,d=window.devicePixelRatio||1,p=(a.width||1)*d/c,u=(a.alignment||"center").toLowerCase();if(t.save(),s.fill&&s.fill.type!=="None"&&s.fill.isEnabled!==!1&&s.fill.opacity!==0&&s.fill.color!=="transparent"&&s.fill.color!=="rgba(0,0,0,0)"&&(t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),a.fill){const S=this.createCanvasFill(t,a.fill,e,n);S?t.strokeStyle=S:t.strokeStyle=a.color||"#000000"}else t.strokeStyle=a.color||"#000000";const h=t.globalAlpha;t.globalAlpha=h*this.normalizeOpacity(a.opacity??100),t.lineWidth=p,t.lineCap=a.lineCap||"round",t.lineJoin=a.lineJoin||"round",a.miterLimit!==void 0&&(t.miterLimit=a.miterLimit);const f=a.trimStart??0,v=a.trimEnd??1,m=a.trimOffset??0,l=a.dashOffset??0,b=a.dashArray||[];if(f!==0||v!==1||m!==0){const S=this.getPerimeter(o,e,n);if(S>0){const w=Math.max(0,Math.min(1,f)),C=Math.max(0,Math.min(1,v));if(w<C){const M=S*(C-w),I=S-M,_=-(S*(w+m%1));t.setLineDash([M,I]),t.lineDashOffset=_-l*S}else if(w===C)t.setLineDash([0,S]);else{const M=S*(1-w+C),I=S-M,_=-(S*w);t.setLineDash([M,I]),t.lineDashOffset=_-l*S}}}else if(b.length>0||l!==0){b.length>0&&t.setLineDash(b);const S=this.getPerimeter(o,e,n);t.lineDashOffset=-(l*S)}if((o==null?void 0:o.type)==="Line"||e===0||n===0)this.applyPath(t,o,e,n,i),t.stroke();else if(u==="inside")t.lineWidth=p*2,t.save(),this.applyPath(t,o,e,n,i),t.clip(),t.stroke(),t.restore();else if(u==="outside"){t.save(),t.beginPath();const S=Math.max(e,n,2e4);t.rect(-S,-S,S*2,S*2),this._tracePath(t,o,e,n,i),t.clip("evenodd"),t.lineWidth=p*2,t.beginPath(),this.applyPath(t,o,e,n,i),t.stroke(),t.restore()}else t.lineWidth=p,this.applyPath(t,o,e,n,i),t.stroke();t.restore()}getPerimeter(t,s,o){switch(this.ensurePathPoints(t),t==null?void 0:t.type){case"Rectangle":return(s+o)*2;case"Ellipse":{const e=Math.abs(s)/2,n=Math.abs(o)/2,i=Math.abs(t.sweepAngle??360),a=t.ratio||0,r=Math.PI*(3*(e+n)-Math.sqrt((3*e+n)*(e+3*n)));if(i>=360&&a<=0)return r;let c=i/360*r;if(a>0){const d=Math.PI*(3*(e*a+n*a)-Math.sqrt((3*e*a+n*a)*(e*a+3*n*a)));c+=i/360*d,i<360&&(c+=2*Math.sqrt((e-e*a)**2+(n-n*a)**2))}else i<360&&(c+=2*Math.max(e,n));return isNaN(c)?0:c}case"Line":return t.length||Math.sqrt(s*s+o*o);case"Triangle":return s+Math.sqrt((s/2)**2+o**2)*2;case"Polygon":{const e=t.sides||3,n=t.radius||Math.min(s,o)/2;return 2*e*n*Math.sin(Math.PI/e)}case"Star":{const e=t.points||5,n=t.outer_radius||Math.min(s,o)/2,i=t.inner_radius||n/2,a=Math.PI/e;return Math.sqrt(n*n+i*i-2*n*i*Math.cos(a))*e*2}case"Path":{const e=t.points||[];if(e.length<2)return t.length||0;let n=0,i=e[0].x,a=e[0].y;for(let r=1;r<e.length;r++){const c=e[r];if(c.moveTo){i=c.x,a=c.y;continue}const d=i,p=a,u=e[r-1].out_x,g=e[r-1].out_y;if(u!==void 0||c.in_x!==void 0?n+=this.getBezierLength(d,p,u??d,g??p,c.in_x??c.x,c.in_y??c.y,c.x,c.y):n+=Math.sqrt((c.x-d)**2+(c.y-p)**2),i=c.x,a=c.y,c.closePath||r===e.length-1&&(t.is_closed||t.isClosed)){const h=i,f=a,v=[...e.slice(0,r+1)].reverse().find(M=>M.moveTo)||e[0],m=v.x,l=v.y,b=e[r].out_x,S=e[r].out_y,w=v.in_x,C=v.in_y;b!==void 0||w!==void 0?n+=this.getBezierLength(h,f,b??h,S??f,w??m,C??l,m,l):n+=Math.sqrt((m-h)**2+(l-f)**2)}}return n}default:return(s+o)*2}}getBezierLength(t,s,o,e,n,i,a,r,c=10){let d=0,p=t,u=s;for(let g=1;g<=c;g++){const h=g/c,f=1-h,v=h*h,m=f*f,l=m*f,b=v*h,S=l*t+3*m*h*o+3*f*v*n+b*a,w=l*s+3*m*h*e+3*f*v*i+b*r,C=S-p,M=w-u;d+=Math.sqrt(C*C+M*M),p=S,u=w}return d}getBezierTAtLength(t,s,o,e,n,i,a,r,c,d=20){if(t<=0)return 0;let p=0,u=s,g=o;for(let h=1;h<=d;h++){const f=h/d,v=1-f,m=f*f,l=v*v,b=l*v,S=m*f,w=b*s+3*l*f*e+3*v*m*i+S*r,C=b*o+3*l*f*n+3*v*m*a+S*c,M=w-u,I=C-g,_=Math.sqrt(M*M+I*I);if(p+_>=t){const E=t-p,P=_===0?0:E/_;return(h-1+P)/d}p+=_,u=w,g=C}return 1}getPointOnPath(t,s,o,e){if(this.ensurePathPoints(t),(t==null?void 0:t.type)==="Path"){const n=t.points||[];if(n.length<2)return{x:0,y:0,angle:0};let i=1/0,a=-1/0,r=1/0,c=-1/0;n.forEach(l=>{typeof l.x=="number"&&typeof l.y=="number"&&(i=Math.min(i,l.x),a=Math.max(a,l.x),r=Math.min(r,l.y),c=Math.max(c,l.y),l.out_x!==void 0&&(i=Math.min(i,l.out_x),a=Math.max(a,l.out_x)),l.out_y!==void 0&&(r=Math.min(r,l.out_y),c=Math.max(c,l.out_y)),l.in_x!==void 0&&(i=Math.min(i,l.in_x),a=Math.max(a,l.in_x)),l.in_y!==void 0&&(r=Math.min(r,l.in_y),c=Math.max(c,l.in_y)))});const d=(i+a)/2,p=(r+c)/2,g=this.getPerimeter(t,s,o)*e;let h=0;const f=[];let v=n[0],m=n[0];for(let l=1;l<n.length;l++){const b=n[l];if(b.moveTo){v=b,m=b;continue}f.push({p0:v,p1:b}),(b.closePath||l===n.length-1&&(t.is_closed||t.isClosed))&&f.push({p0:b,p1:m}),v=b}for(const l of f){const b=l.p0,S=l.p1;let w=0;const C=b.out_x!==void 0||S.in_x!==void 0;if(C?w=this.getBezierLength(b.x,b.y,b.out_x??b.x,b.out_y??b.y,S.in_x??S.x,S.in_y??S.y,S.x,S.y):w=Math.sqrt((S.x-b.x)**2+(S.y-b.y)**2),h+w>=g||l===f[f.length-1]){let M=0;if(C)return M=this.getBezierTAtLength(g-h,b.x,b.y,b.out_x??b.x,b.out_y??b.y,S.in_x??S.x,S.in_y??S.y,S.x,S.y,20),this.getBezierPointAndAngle(M,b,S,d,p);{M=w===0?0:(g-h)/w;const I=b.x+(S.x-b.x)*M-d,_=b.y+(S.y-b.y)*M-p,E=Math.atan2(S.y-b.y,S.x-b.x);return{x:I,y:_,angle:E}}}h+=w}}else if(t.type==="Ellipse"){const n=Math.abs(s)/2,i=Math.abs(o)/2,a=t.sweepAngle??360,c=((t.startAngle??0)+a*e)*Math.PI/180,d=n*Math.cos(c),p=i*Math.sin(c),u=-n*Math.sin(c),g=i*Math.cos(c),h=Math.atan2(g,u);return{x:d,y:p,angle:h}}else if((t==null?void 0:t.type)==="Rectangle"){const n=Math.abs(s),i=Math.abs(o),r=(n+i)*2*e;let c=0,d=0,p=0;return r<n?(c=-n/2+r,d=-i/2,p=0):r<n+i?(c=n/2,d=-i/2+(r-n),p=Math.PI/2):r<2*n+i?(c=n/2-(r-(n+i)),d=i/2,p=Math.PI):(c=-n/2,d=i/2-(r-(2*n+i)),p=-Math.PI/2),{x:c,y:d,angle:p}}return{x:0,y:0,angle:0}}getBezierPointAndAngle(t,s,o,e,n){const i=s.x,a=s.y,r=s.out_x??s.x,c=s.out_y??s.y,d=o.in_x??o.x,p=o.in_y??o.y,u=o.x,g=o.y,h=1-t,f=t*t,v=h*h,m=v*h,l=f*t,b=m*i+3*v*t*r+3*h*f*d+l*u-e,S=m*a+3*v*t*c+3*h*f*p+l*g-n,w=3*v*(r-i)+6*h*t*(d-r)+3*f*(u-d),C=3*v*(c-a)+6*h*t*(p-c)+3*f*(g-p),M=Math.atan2(C,w);return{x:b,y:S,angle:M}}applyAbsoluteTransform(t,s,o){if(!o.get(s))return;const n=[];let i=s;for(;i;){n.unshift(i);const a=o.get(i);i=a==null?void 0:a.parentId}n.forEach(a=>{this.applyObjectTransform(t,a)})}applyObjectTransform(t,s){var h,f,v;const o=this.objectStates.get(s);if(!o)return;t.translate(o.x,o.y),t.rotate((o.rotation??0)*Math.PI/180);const e=o.skew_x||0,n=o.skew_y||0;if(e!==0||n!==0){const m=Math.tan(e*Math.PI/180),l=Math.tan(n*Math.PI/180);t.transform(1+m*l,l,m,1,0,0)}const i=o.rotate_x!==void 0?o.rotate_x:((h=o.transform)==null?void 0:h.rotate_x)??0,a=o.rotate_y!==void 0?o.rotate_y:((f=o.transform)==null?void 0:f.rotate_y)??0,c=1+(o.translate_z!==void 0?o.translate_z:((v=o.transform)==null?void 0:v.translate_z)??0)/1e3,d=(o.flip_x===!0?-1:1)*Math.cos(a*Math.PI/180)*c,p=(o.flip_y===!0?-1:1)*Math.cos(i*Math.PI/180)*c,u=(o.scale_x??1)*d,g=(o.scale_y??1)*p;t.scale(u,g)}applyInnerGlowOverlay(t,s,o,e,n,i,a){var m,l;const r=a||s.style||{},c=r==null?void 0:r.effect,p=((r==null?void 0:r.effects)||(c?[c]:[])).find(b=>b.isEnabled!==!1&&b.type==="Glow"&&(b.mode==="inner"||b.mode==="Inner Glow"));if(!p)return;t.save(),t.beginPath(),this.applyPath(t,o,e,n,i),t.clip();const u=p.blur||10,g=1e4,h=t.getTransform();let f=p.color||"white";(l=(m=this.artboard)==null?void 0:m.tokens)!=null&&l.colors&&this.artboard.tokens.colors[f]&&(f=this.artboard.tokens.colors[f]),t.shadowColor=f,t.shadowBlur=u,t.shadowOffsetX=g*h.a,t.shadowOffsetY=g*h.b,t.translate(-g,0),t.lineWidth=u+5,t.strokeStyle=f;const v=Math.min(p.intensity||1,5);for(let b=0;b<v;b++)t.beginPath(),this.applyPath(t,o,e,n,i),t.stroke();t.restore()}applyArtEffectOverlay(t,s,o,e,n,i){var g,h,f,v,m;const a=this.objectStates.get(s.id),r=((g=a==null?void 0:a.style)==null?void 0:g.artEffect)||s.artEffect||((h=s.style)==null?void 0:h.artEffect);if(!r||!r.enabled)return;const c=r.type,d=r.intensity??.5,p=r.speed??1,u=r.scale??10;if(c==="acid_gradient"||c==="acid_rave"||c==="shimmer"||c==="glint_overlay"||c==="halftone"||c==="noise"||c==="scanlines"||c==="chromatic_aberration"||c==="pixelate"||c==="glitch"||c==="fold_overlay"||c==="crumple_overlay"){if(t.save(),this.applyPath(t,o,e,n,i),t.clip(),c==="shimmer"){const b=this.currentTime*p%2/2,S=t.createLinearGradient(-e,-n,e,n);S.addColorStop(Math.max(0,b-.2),"rgba(255,255,255,0)"),S.addColorStop(b,`rgba(255,255,255,${d*.8})`),S.addColorStop(Math.min(1,b+.2),"rgba(255,255,255,0)"),t.fillStyle=S,t.globalCompositeOperation="screen",t.fillRect(-e/2,-n/2,e,n),t.globalCompositeOperation="source-over"}else if(c==="glint_overlay"){let S=((this._lastPointerPos||{x:0}).x-(((f=s.transform)==null?void 0:f.x)??0)+300)/600;S=Math.max(-.2,Math.min(1.2,S));const w=t.createLinearGradient(-e,-n,e,n);w.addColorStop(Math.max(0,S-.15),"rgba(255,255,255,0)"),w.addColorStop(Math.max(0,Math.min(1,S)),`rgba(255,255,255,${d})`),w.addColorStop(Math.min(1,S+.15),"rgba(255,255,255,0)"),t.fillStyle=w,t.globalCompositeOperation="screen",t.fillRect(-e/2,-n/2,e,n),t.globalCompositeOperation="source-over"}else if(c==="fold_overlay"){const l=this._lastPointerPos||{x:0,y:0},b=l.x-(((v=s.transform)==null?void 0:v.x)??0),S=l.y-(((m=s.transform)==null?void 0:m.y)??0),w=t.createLinearGradient(b>0?-e/2:e/2,S>0?-n/2:n/2,b>0?e/2:-e/2,S>0?n/2:-n/2);w.addColorStop(0,`rgba(0,0,0,${d*.6})`),w.addColorStop(.4,"rgba(0,0,0,0)"),w.addColorStop(.5,`rgba(255,255,255,${d*.4})`),w.addColorStop(1,`rgba(0,0,0,${d*.2})`),t.fillStyle=w,t.globalCompositeOperation="overlay",t.fillRect(-e/2,-n/2,e,n),t.globalCompositeOperation="source-over",t.beginPath(),b>0&&S>0?(t.moveTo(e/2-40,n/2),t.lineTo(e/2,n/2-40),t.lineTo(e/2-40,n/2-40)):b<0&&S>0?(t.moveTo(-e/2+40,n/2),t.lineTo(-e/2,n/2-40),t.lineTo(-e/2+40,n/2-40)):b>0&&S<0?(t.moveTo(e/2-40,-n/2),t.lineTo(e/2,-n/2+40),t.lineTo(e/2-40,-n/2+40)):(t.moveTo(-e/2+40,-n/2),t.lineTo(-e/2,-n/2+40),t.lineTo(-e/2+40,-n/2+40)),t.closePath(),t.fillStyle="#ffffff",t.shadowColor="rgba(0,0,0,0.5)",t.shadowBlur=10,t.shadowOffsetX=b>0?-2:2,t.shadowOffsetY=S>0?-2:2,t.fill()}else if(c==="crumple_overlay"){const l=Math.floor(e/u),b=document.createElement("canvas");b.width=l,b.height=Math.floor(n/u);const S=b.getContext("2d"),w=S.createImageData(b.width,b.height);for(let C=0;C<w.data.length;C+=4){const M=Math.random()>.95?150:255;w.data[C]=M,w.data[C+1]=M,w.data[C+2]=M,w.data[C+3]=255*d}S.putImageData(w,0,0),t.globalCompositeOperation="multiply",t.imageSmoothingEnabled=!1,t.drawImage(b,-e/2,-n/2,e,n)}else if(c==="acid_gradient"||c==="acid_rave"){const l=this.currentTime*p,b=r.color1,S=r.color2,w=t.createLinearGradient(-e/2,-n/2,e/2,n/2);if(b&&S){const C=l*60%360;w.addColorStop(0,this._shiftHue(b,C,d*.7)),w.addColorStop(1,this._shiftHue(S,(C+180)%360,d*.7))}else{const C=l*100%360,M=(C+180)%360;w.addColorStop(0,`hsla(${C}, 80%, 50%, ${d*.5})`),w.addColorStop(1,`hsla(${M}, 80%, 50%, ${d*.5})`)}t.fillStyle=w,t.globalCompositeOperation="screen",t.fillRect(-e/2,-n/2,e,n)}else if(c==="halftone"){const l=Math.max(2,u*(1-d*.8)),b=document.createElement("canvas");b.width=l,b.height=l;const S=b.getContext("2d");if(S){S.fillStyle="black",S.beginPath(),S.arc(l/2,l/2,l/2*d,0,Math.PI*2),S.fill();const w=t.createPattern(b,"repeat");w&&(t.globalAlpha=.3*d,t.fillStyle=w,t.fillRect(-e/2,-n/2,e,n))}}else if(c==="noise"){const l=Math.floor(e*n*d*.02);t.globalAlpha=.4*d;for(let b=0;b<l;b++){const S=Math.random()>.5?255:0;t.fillStyle=`rgba(${S}, ${S}, ${S}, ${.5+Math.random()*.5})`,t.fillRect(-e/2+Math.random()*e,-n/2+Math.random()*n,2,2)}}else if(c==="scanlines"){t.globalAlpha=.2*d,t.strokeStyle="rgba(0,0,0,0.5)",t.lineWidth=1;for(let l=-n/2;l<n/2;l+=4)t.beginPath(),t.moveTo(-e/2,l),t.lineTo(e/2,l),t.stroke()}else if(c==="chromatic_aberration"){const l=5*d;t.globalCompositeOperation="screen",t.globalAlpha=.5,t.fillStyle="cyan",t.fillRect(-e/2-l,-n/2,e,n),t.fillStyle="magenta",t.fillRect(-e/2+l,-n/2,e,n)}else if(c==="pixelate"){const l=Math.max(2,Math.round(u*(1-d*.5))),b=document.createElement("canvas"),S=Math.max(1,Math.ceil(e/l)),w=Math.max(1,Math.ceil(n/l));b.width=S,b.height=w;const C=b.getContext("2d");if(C){C.imageSmoothingEnabled=!1;const M=t.getTransform(),I=M.e-e/2,_=M.f-n/2;C.drawImage(t.canvas,I,_,e,n,0,0,S,w),t.imageSmoothingEnabled=!1,t.drawImage(b,0,0,S,w,-e/2,-n/2,e,n),t.imageSmoothingEnabled=!0}}else if(c==="glitch"){const l=this.currentTime*p,b=r.chaosAmount??.2,S=Math.max(3,Math.floor(8*d)),w=d*e*.15;t.globalCompositeOperation="screen",t.globalAlpha=d*.4;const C=w*.3;t.fillStyle="rgba(255, 0, 0, 0.4)",t.fillRect(-e/2+C,-n/2,e,n),t.fillStyle="rgba(0, 255, 255, 0.4)",t.fillRect(-e/2-C,-n/2,e,n),t.globalCompositeOperation="source-over",t.globalAlpha=1;const M=n/S;for(let I=0;I<S;I++){const _=Math.sin(I*127.1+l*311.7*p)*43758.5,E=_-Math.floor(_);if(E>1-b){const P=(E-(1-b))/b*w*(Math.random()>.5?1:-1),L=-n/2+I*M,k=t.getTransform(),A=k.e-e/2+P,T=k.f+L;t.save(),t.beginPath(),t.rect(-e/2,L,e,M),t.clip(),t.globalAlpha=.8,t.drawImage(t.canvas,A,T,e,M,-e/2+P,L,e,M),t.restore()}}}t.restore()}}_shiftHue(t,s,o){let e=0,n=0,i=0;if(t.startsWith("#")){const g=t.replace("#","");e=parseInt(g.substring(0,2),16)/255,n=parseInt(g.substring(2,4),16)/255,i=parseInt(g.substring(4,6),16)/255}const a=Math.max(e,n,i),r=Math.min(e,n,i);let c=0,d=0,p=(a+r)/2;if(a!==r){const g=a-r;switch(d=p>.5?g/(2-a-r):g/(a+r),a){case e:c=((n-i)/g+(n<i?6:0))/6;break;case n:c=((i-e)/g+2)/6;break;case i:c=((e-n)/g+4)/6;break}}return`hsla(${(((c*360+s)%360+360)%360).toFixed(0)}, ${(d*100).toFixed(0)}%, ${(p*100).toFixed(0)}%, ${o})`}applyBackgroundBlurGlass(t,s,o,e,n,i,a){const r=i.radius??10,c=i.opacity!==void 0?this.normalizeOpacity(i.opacity):.5,d=i.noise??0,p=i.color??"rgba(255,255,255,0.2)";t.save(),this.applyPath(t,s,o,e,n),t.clip();const u=t.getTransform(),g=t.canvas;try{const v=document.createElement("canvas");v.width=Math.max(1,Math.ceil(o)),v.height=Math.max(1,Math.ceil(e));const m=v.getContext("2d");if(m){m.save(),m.translate(o/2,e/2);const l=i.magnification||1;if(l!==1&&m.scale(l,l),typeof u.inverse=="function"){const w=u.inverse();m.transform(w.a,w.b,w.c,w.d,w.e,w.f)}else{const w=u.a*u.d-u.b*u.c;w!==0&&m.transform(u.d/w,-u.b/w,-u.c/w,u.a/w,(u.c*u.f-u.d*u.e)/w,(u.b*u.e-u.a*u.f)/w)}m.drawImage(g,0,0),m.restore();const b=document.createElement("canvas");b.width=v.width,b.height=v.height;const S=b.getContext("2d");S.filter=`blur(${r}px)`,S.drawImage(v,0,0),t.globalCompositeOperation="destination-out",t.fillRect(-o/2,-e/2,o,e),t.globalCompositeOperation="source-over",t.globalAlpha=1,t.drawImage(b,-o/2,-e/2,o,e)}}catch(v){console.error("Background blur failed:",v)}t.globalCompositeOperation="source-over",t.globalAlpha=c,t.fillStyle=p,t.fillRect(-o/2,-e/2,o,e),t.globalAlpha=1;const h=t.createLinearGradient(-o/2,-e/2,o/2,e/2);if(h.addColorStop(0,"rgba(255,255,255,0.12)"),h.addColorStop(.3,"rgba(255,255,255,0.04)"),h.addColorStop(.5,"rgba(255,255,255,0.0)"),h.addColorStop(1,"rgba(255,255,255,0.0)"),t.fillStyle=h,t.fillRect(-o/2,-e/2,o,e),d>0){if(t.globalAlpha=d/100,!this._noiseTileCanvas){const m=document.createElement("canvas");m.width=64,m.height=64;const l=m.getContext("2d"),b=l.createImageData(64,64),S=b.data;for(let w=0;w<S.length;w+=4){const C=Math.floor(Math.random()*255);S[w]=C,S[w+1]=C,S[w+2]=C,S[w+3]=18}l.putImageData(b,0,0),this._noiseTileCanvas=m}const v=t.createPattern(this._noiseTileCanvas,"repeat");v&&(t.fillStyle=v,t.fillRect(-o/2,-e/2,o,e))}t.restore(),t.save(),t.globalAlpha=1,(a==null?void 0:a.stroke)&&a.stroke.width>0&&a.stroke.isEnabled!==!1?(this.applyPath(t,s,o,e,n),this.applyStrokeAlignment(t,a,s,o,e,n)):(t.strokeStyle="rgba(255, 255, 255, 0.25)",t.lineWidth=1.5,this.applyPath(t,s,o,e,n),t.stroke()),t.restore()}applyPath(t,s,o,e,n){s!=null&&s.data&&(s.type==="Path"||s.type==="Subtract"||s.type==="Union"||s.type==="Intersect"||s.type==="Exclude"||s.type),t.beginPath(),this._tracePath(t,s,o,e,n)}_tracePath(t,s,o,e,n){if(s){if(this.ensurePathPoints(s),(s==null?void 0:s.type)==="Rectangle"||s.type==="Image"){const i=n!==void 0?n:s.corner_radius??0;this.drawRoundRect(t,-o/2,-e/2,o,e,i)}else if(s.type==="Line")t.moveTo(-o/2,0),t.lineTo(o/2,0);else if(s.type==="Ellipse"||s.type==="circle"){const{startAngle:i=0,sweepAngle:a=360,ratio:r=0}=s,c=o/2,d=e/2,p=i*Math.PI/180,u=a*Math.PI/180,g=p+u;a>=360&&r<=0?t.ellipse(0,0,c,d,0,0,Math.PI*2):(t.ellipse(0,0,c,d,0,p,g,!1),r>0?t.ellipse(0,0,c*r,d*r,0,g,p,!0):t.lineTo(0,0),t.closePath())}else if(s.type==="Triangle")t.moveTo(0,-e/2),t.lineTo(o/2,e/2),t.lineTo(-o/2,e/2),t.closePath();else if(s.type==="Polygon"){const i=s.sides||3,a=s.radius||Math.min(o,e)/2;for(let r=0;r<i;r++){const c=r*2*Math.PI/i-Math.PI/2,d=a*Math.cos(c),p=a*Math.sin(c);r===0?t.moveTo(d,p):t.lineTo(d,p)}t.closePath()}else if(s.type==="Star"){const i=s.points||5,a=s.outer_radius||Math.min(o,e)/2;let r=s.inner_radius;r==null?r=a*.382:r<=1&&(r=a*r);for(let c=0;c<i*2;c++){const d=c*Math.PI/i-Math.PI/2,p=c%2===0?a:r,u=p*Math.cos(d),g=p*Math.sin(d);c===0?t.moveTo(u,g):t.lineTo(u,g)}t.closePath()}else if(((s==null?void 0:s.type)==="Path"||s.type==="Subtract"||s.type==="Union"||s.type==="Intersect"||s.type==="Exclude"||s.type==="BooleanOperation")&&s.points){this.frameCount%300===0&&this.log("[Engine] Tracing Path:",s.points.length,"points");let i=1/0,a=-1/0,r=1/0,c=-1/0;if(s.points.forEach(u=>{typeof u.x=="number"&&typeof u.y=="number"&&(i=Math.min(i,u.x),a=Math.max(a,u.x),r=Math.min(r,u.y),c=Math.max(c,u.y),u.out_x!==void 0&&(i=Math.min(i,u.out_x),a=Math.max(a,u.out_x)),u.out_y!==void 0&&(r=Math.min(r,u.out_y),c=Math.max(c,u.out_y)),u.in_x!==void 0&&(i=Math.min(i,u.in_x),a=Math.max(a,u.in_x)),u.in_y!==void 0&&(r=Math.min(r,u.in_y),c=Math.max(c,u.in_y)))}),i===1/0)return;let d=(i+a)/2,p=(r+c)/2;if(isNaN(d)||isNaN(p)){this.warn("[Engine] Invalid path center:",d,p);return}s.points.forEach((u,g)=>{if(g===0||u.moveTo)t.moveTo(u.x-d,u.y-p);else{const h=s.points[g-1];if(!h)return;const f=(h.out_x??h.x)-d,v=(h.out_y??h.y)-p,m=(u.in_x??u.x)-d,l=(u.in_y??u.y)-p;isNaN(f)||isNaN(m)||isNaN(u.x)?t.lineTo(u.x-d,u.y-p):t.bezierCurveTo(f,v,m,l,u.x-d,u.y-p)}if(u.closePath||g===s.points.length-1&&(s.is_closed||s.isClosed)){const h=[...s.points.slice(0,g+1)].reverse().find(f=>f.moveTo)||s.points[0];h&&(u.out_x!==void 0||h.in_x!==void 0)&&t.bezierCurveTo((u.out_x??u.x)-d,(u.out_y??u.y)-p,(h.in_x??h.x)-d,(h.in_y??h.y)-p,h.x-d,h.y-p),t.closePath()}})}else if(s.points&&Array.isArray(s.points)){let i=1/0,a=-1/0,r=1/0,c=-1/0;s.points.forEach(u=>{i=Math.min(i,u.x),a=Math.max(a,u.x),r=Math.min(r,u.y),c=Math.max(c,u.y)});const d=(i+a)/2,p=(r+c)/2;s.points.forEach((u,g)=>{if(g===0)t.moveTo(u.x-d,u.y-p);else{const h=s.points[g-1];h.out_x!==void 0||u.in_x!==void 0?t.bezierCurveTo((h.out_x??h.x)-d,(h.out_y??h.y)-p,(u.in_x??u.x)-d,(u.in_y??u.y)-p,u.x-d,u.y-p):t.lineTo(u.x-d,u.y-p)}(u.closePath||g===s.points.length-1&&(s.is_closed||s.isClosed))&&t.closePath()})}}}renderInputBox(t,s){var zt,Gt,Yt,te,ie,ce,ve,_e,ge,Ee,Zt,Me,Re,Ie,de,me,Ae,he;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=s.geometry||{},i=s.style||{},a=n.width||250,r=n.height||45,c=this.focusedId===s.id,d=this.lastHoveredObjectId===s.id,p=e.previewState||"default",u=p!=="default"?p:c?"focused":d?"hovered":"default",g=e.label||{visible:!0,text:"Label"},h=e.helperText||{visible:!1,text:"Helper text"},f=e.leftIcon||{visible:!1},v=e.rightIcon||{visible:!1},m=e.inputType==="textarea"||e.multiline===!0,l=u==="disabled",b=u==="error",S=n.corner_radius??n.cornerRadius,w=Array.isArray(S)?{tl:S[0],tr:S[1],br:S[2],bl:S[3]}:S&&typeof S=="object"?S:void 0,C=Number(e.cornerRadius??e.corner_radius??S??e.radius??8),M=e.corners??w??{tl:C,tr:C,bl:C,br:C},I=[Number(M.tl??C),Number(M.tr??C),Number(M.br??C),Number(M.bl??C)],_=(mt,rt,z,K,G,B=0)=>{const Q=Math.max(0,z-B*2),H=Math.max(0,K-B*2);let[lt,kt,Et,Ht]=G.map(qt=>Math.max(0,(Number(qt)||0)-B));const Ut=Math.min(Q,H)/2;lt=Math.min(lt,Ut),kt=Math.min(kt,Ut),Et=Math.min(Et,Ut),Ht=Math.min(Ht,Ut),t.beginPath(),t.roundRect?t.roundRect(mt+B,rt+B,Q,H,[lt,kt,Et,Ht]):(t.moveTo(mt+B+lt,rt+B),t.lineTo(mt+B+Q-kt,rt+B),t.arcTo(mt+B+Q,rt+B,mt+B+Q,rt+B+kt,kt),t.lineTo(mt+B+Q,rt+B+H-Et),t.arcTo(mt+B+Q,rt+B+H,mt+B+Q-Et,rt+B+H,Et),t.lineTo(mt+B+Ht,rt+B+H),t.arcTo(mt+B,rt+B+H,mt+B,rt+B+H-Ht,Ht),t.lineTo(mt+B+lt,rt+B),t.arcTo(mt+B,rt+B,mt+B+lt,rt+B,lt),t.closePath())};let E=e.backgroundColor||((zt=i.fill)==null?void 0:zt.color)||"rgba(31, 41, 55, 1)",P=e.borderColor||((Yt=(Gt=i.stroke)==null?void 0:Gt.fill)==null?void 0:Yt.color)||((te=i.stroke)==null?void 0:te.color)||"rgba(55, 65, 81, 1)",L=Number(e.borderWidth??((ie=i.stroke)==null?void 0:ie.width)??1),k=e.color||((ce=i.fill)==null?void 0:ce.color)||"#ffffff",A=e.placeholderColor||"rgba(156, 163, 175, 1)",T=e.fontSize||14,R=e.caretColor||"#3b82f6";const F=`${u}Style`,O=e[F];O?(O.backgroundColor!==void 0&&(E=O.backgroundColor),O.borderColor!==void 0&&(P=O.borderColor),O.borderWidth!==void 0&&(L=O.borderWidth),O.color!==void 0&&(k=O.color),O.placeholderColor!==void 0&&(A=O.placeholderColor),O.fontSize!==void 0&&(T=O.fontSize),O.caretColor!==void 0&&(R=O.caretColor)):u==="focused"?(P=e.focusBorderColor||"rgba(59, 130, 246, 1)",L=Math.max(L,2)):u==="hovered"||u==="hover"?(P=e.hoverBorderColor||P,E=e.hoverBackgroundColor||E):l?(E=e.disabledBackgroundColor||"rgba(31, 41, 55, 0.6)",P=e.disabledBorderColor||"rgba(55, 65, 81, 0.4)"):b&&(P="rgba(239, 68, 68, 1)",L=Math.max(L,2));const W=L>0?L/2:0,V=this.createCanvasFill(t,E,a,r);if(V&&E!=="transparent"&&(_(-a/2,-r/2,a,r,I,W),t.fillStyle=V,t.fill()),L>0){const mt=this.createCanvasFill(t,P,a,r);mt&&P!=="transparent"&&(_(-a/2,-r/2,a,r,I,W),t.strokeStyle=mt,t.lineWidth=L,t.lineCap="round",t.lineJoin="round",t.stroke())}if((u==="focused"||u==="focus")&&!l){t.save();const mt=-3,rt=I.map(G=>Math.max(0,G+3));_(-a/2+mt,-r/2+mt,a-mt*2,r-mt*2,rt);const z=((ve=e.activeStyle)==null?void 0:ve.borderColor)||R||"rgba(59, 130, 246, 0.4)",K=this.createCanvasFill(t,z,a,r)||"rgba(59, 130, 246, 0.4)";t.strokeStyle=K,t.lineWidth=2,t.lineCap="round",t.lineJoin="round",t.stroke(),t.restore()}const U=e.fontFamily||"Inter",Y=e.fontWeight||400,X=T,ot=e.inputType==="number"&&((_e=e.number)==null?void 0:_e.showSteppers)!==!1,J=24,at=ot?J+4:0,j=String(e.text??e.value??"");let it="Enter text...";if(e.inputType==="tel")it=`${((ge=e.tel)==null?void 0:ge.dialCode)||"+1"} (555) 000-0000`;else if(e.inputType==="number"){const mt=(Ee=e.number)!=null&&Ee.prefix?`${e.number.prefix} `:"",rt=(Zt=e.number)!=null&&Zt.suffix?` ${e.number.suffix}`:"";it=`${mt}0.00${rt}`}else e.inputType==="email"?it="user@example.com":e.inputType==="search"?it="Search anything...":e.inputType==="url"?it="https://example.com":e.inputType==="password"?it="••••••••":e.inputType==="textarea"&&(it="Enter text...");const x=e.placeholder||it,D=!j,N=e.inputType==="password",ct=v.mode==="password-toggle"||N&&v.visible!==!1,Mt=v.mode==="clear"||e.inputType==="search"&&!!j,bt=(mt,rt)=>{var lt;let z=mt.svgPath||"";if(z||(rt?e.inputType==="search"&&(z="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"):ct?z=e.passwordVisible?"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24M1 1l22 22":"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z M12 9a3 3 0 100 6 3 3 0 000-6z":Mt&&(z="M18 6L6 18M6 6l12 12")),!(mt.visible||!!z&&(!rt&&(ct||Mt)||rt&&e.inputType==="search"))||!z)return;const G=mt.size||16,B=(mt.offset??16)+(rt?0:at),Q=typeof mt.color=="string"?mt.color:((lt=mt.color)==null?void 0:lt.color)||"#9ca3af",H=rt?-(a/2)+B:a/2-B;if(t.save(),t.translate(H,0),!z.startsWith("<svg")){const kt=new Path2D(z),Et=G/24;t.scale(Et,Et),t.translate(-12,-12),z.includes("M18 6L6 18")||z.includes("M1 1l22 22")||z.includes("M21 21")?(t.strokeStyle=Q,t.lineWidth=2,t.lineCap="round",t.stroke(kt)):(t.fillStyle=Q,t.fill(kt))}t.restore()};if(bt(f,!0),bt(v,!1),ot){const mt=a/2-J-4;t.save(),t.strokeStyle=P||"rgba(55, 65, 81, 0.5)",t.lineWidth=1,t.beginPath(),t.moveTo(mt,-r/2+6),t.lineTo(mt,r/2-6),t.stroke(),t.beginPath(),t.moveTo(mt,0),t.lineTo(a/2-4,0),t.stroke(),t.fillStyle=k||"rgba(156, 163, 175, 0.8)",t.font=`600 8px "${U}", sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillText("▲",mt+J/2,-r/4),t.fillText("▼",mt+J/2,r/4),t.restore()}const wt=((Me=e.padding)==null?void 0:Me.left)??e.inputPadding??12,gt=((Re=e.padding)==null?void 0:Re.right)??e.inputPadding??12,It=f.visible||e.inputType==="search",ut=v.visible||ct||Mt,Ot=It?(f.offset??16)+(f.size||16)/2+8:wt,Wt=ut?(v.offset??16)+(v.size||16)/2+8+at:gt+at,q=-(a/2)+Ot,ft=Math.max(0,a-Ot-Wt);let xt=j||x;if(e.inputType==="number"&&j){const mt=(Ie=e.number)!=null&&Ie.prefix?`${e.number.prefix} `:"",rt=(de=e.number)!=null&&de.suffix?` ${e.number.suffix}`:"";xt=`${mt}${j}${rt}`}const At=N&&j?e.passwordVisible?j:"•".repeat(j.length):xt,Pt=D?A:k;if(t.font=`${Y} ${X}px "${U}", sans-serif`,t.fillStyle=Pt,t.textAlign="left",t.save(),t.beginPath(),t.rect(q-2,-r/2+4,ft+4,r-8),t.clip(),m){t.textBaseline="top";const mt=At.split(`
|
|
19
|
-
`);let rt=-r/2+(((me=e.padding)==null?void 0:me.top)??8);const z=X*1.4,K=e.rows||3;let G=0,B=0;for(const Q of mt){if(G>=K)break;const H=Q.split(" ");let lt="";for(let kt=0;kt<H.length;kt++){const Et=lt+H[kt]+" ";if(t.measureText(Et).width>ft&&kt>0){if(G>=K)break;t.fillText(lt.trim(),q,rt),lt=H[kt]+" ",rt+=z,G++}else lt=Et}G<K&&(t.fillText(lt.trim(),q,rt),B=t.measureText(lt.trim()).width,rt+=z,G++)}if(c&&!D&&Math.floor(performance.now()/500)%2===0){const Q=rt-z;t.fillStyle=R,t.fillRect(q+Math.min(B,ft),Q,1.5,X)}}else{t.textBaseline="middle";const rt=t.measureText(At).width;let z=0;if(rt>ft&&(z=rt-ft),t.fillText(At,q-z,0),c&&Math.floor(performance.now()/500)%2===0){const K=D?q:q+rt-z;t.fillStyle=R,t.fillRect(K,-(X/2),1.5,X)}}if(t.restore(),e.showCharCounter){t.save();const mt=Number(e.maxLength||0),rt=mt>0?`${j.length}/${mt}`:`${j.length}`;t.font=`400 10px "${U}", sans-serif`,t.fillStyle=mt>0&&j.length>=mt?"#ef4444":"rgba(156, 163, 175, 0.6)",t.textAlign="right",t.textBaseline="top",t.fillText(rt,-(a/2)+a-8,-(r/2)+r+4),t.restore()}if(g.visible!==!1){const mt=!!(g.required||(Ae=e.validation)!=null&&Ae.required),rt=(g.text||"Label")+(mt?" *":""),z=g.fontSize||12,K=g.color||"rgba(156, 163, 175, 1)",G=g.position||"top",B=g.gap??g.offset??6;let Q=-(a/2),H=-(r/2)-B,lt="left",kt="bottom",Et=`600 ${z}px "${g.fontFamily||U}", sans-serif`;G==="left"?(Q=-(a/2)-B,H=0,lt="right",kt="middle"):G==="bottom"?(Q=-(a/2),H=r/2+B,lt="left",kt="top"):G==="floating"&&(!!j||c?(Q=-(a/2)+12,H=-(r/2)+4,lt="left",kt="top",Et=`600 ${Math.max(9,z-2)}px "${g.fontFamily||U}", sans-serif`):Et=null),Et&&(t.save(),t.font=Et,t.fillStyle=K,t.textAlign=lt,t.textBaseline=kt,t.fillText(rt,Q,H),t.restore())}const vt=(he=e.validation)==null?void 0:he.errorMessage;if(b&&vt||h.visible===!0&&h.text){t.save();const mt=h.fontSize||11,rt=b?"#ef4444":h.color||"rgba(156, 163, 175, 1)",z=h.offset??6,K=b&&vt?vt:h.text;t.font=`400 ${mt}px "${U}", sans-serif`,t.fillStyle=rt,t.textAlign="left",t.textBaseline="top",t.fillText(K,-(a/2),r/2+z),t.restore()}l&&(t.save(),_(-a/2,-r/2,a,r,I),t.fillStyle="rgba(0, 0, 0, 0.3)",t.fill(),t.restore())}renderSlider(t,s){const o=this.objectStates.get(s.id),e=(o==null?void 0:o.geometry)||s.geometry,n=(o==null?void 0:o.options)||s.options||{},i=e.width||200,a=n.value??50,r=n.min??0,d=(n.max??100)-r,p=d===0?0:(a-r)/d,u=n.trackHeight||4,g=n.trackRoundedness??2,h=n.trackShape??"Rectangle",f=n.trackPath||"",v=n.accentColor||"#3b82f6",m=n.inactiveColor||"#374151",l=n.thumbShape||"Ellipse",b=n.thumbWidth??16,S=n.thumbHeight??16,w=n.thumbRoundedness??0,C=n.thumbColor||"#ffffff",M=n.thumbPath||"",I=n.thumbIcon||"",_=n.showValueTooltip??!1,E=n.tooltipBgColor||"#333333",P=n.tooltipColor||"#ffffff",L=n.tooltipOffsetX??0,k=n.tooltipOffsetY??-25,A=(J,at,j,it,x,D,N)=>{if((J==="Custom"||J==="Icon")&&N)try{const ct=new Path2D(N);if(t.save(),t.translate(at,j),J==="Icon"){const Mt=Math.min(it,x)/24;t.scale(Mt,Mt),t.translate(-12,-12)}t.fill(ct),t.restore();return}catch(ct){console.error("Error drawing slider shape in engine:",ct)}if(t.beginPath(),J==="Ellipse")t.ellipse(at,j,it/2,x/2,0,0,Math.PI*2);else if(J==="Rectangle")this.drawRoundRect(t,at-it/2,j-x/2,it,x,D);else if(J==="Triangle")t.moveTo(at,j-x/2),t.lineTo(at+it/2,j+x/2),t.lineTo(at-it/2,j+x/2),t.closePath();else if(J==="Diamond")t.moveTo(at,j-x/2),t.lineTo(at+it/2,j),t.lineTo(at,j+x/2),t.lineTo(at-it/2,j),t.closePath();else if(J==="Polygon"){const ct=s.geometry.sides||3,Mt=s.geometry.radius||Math.min(it,x)/2;for(let bt=0;bt<ct;bt++){const wt=bt*2*Math.PI/ct-Math.PI/2,gt=at+Mt*Math.cos(wt),It=j+Mt*Math.sin(wt);bt===0?t.moveTo(gt,It):t.lineTo(gt,It)}t.closePath()}else if(J==="Star"){const Mt=Math.min(it,x)/2,bt=Mt/2;for(let wt=0;wt<10;wt++){const gt=wt%2===0?Mt:bt,It=wt*Math.PI/5-Math.PI/2;t.lineTo(at+gt*Math.cos(It),j+gt*Math.sin(It))}t.closePath()}else J==="Line"&&(t.moveTo(at-it/2,j),t.lineTo(at+it/2,j));t.fill()},T=this.createCanvasFill(t,m,i,u);T&&(t.fillStyle=T,t.strokeStyle=T),h==="Line"?(t.lineWidth=u,t.beginPath(),t.moveTo(-i/2,0),t.lineTo(i/2,0),t.stroke()):A(h,0,0,i,u,g,f);const R=i-b,F=-i/2+b/2+p*R,O=F- -i/2;if(O>0){const J=this.createCanvasFill(t,v,i,u);J&&(t.fillStyle=J,t.strokeStyle=J),h==="Line"?(t.lineWidth=u,t.beginPath(),t.moveTo(-i/2,0),t.lineTo(F,0),t.stroke()):h==="Rectangle"&&(t.beginPath(),this.drawRoundRect(t,-i/2,-u/2,O,u,g),t.fill())}t.save(),t.translate(F,0);const W=t.getTransform(),V=Math.sqrt(W.a*W.a+W.b*W.b)||1;t.shadowColor="rgba(0,0,0,0.2)",t.shadowBlur=4*V,t.shadowOffsetY=1*V;const U=this.createCanvasFill(t,C,b,S);if(U&&(t.fillStyle=U),A(l,0,0,b,S,w,l==="Icon"?I:M),t.restore(),_){t.save(),t.translate(F+L,k);const J=Math.round(a).toString();t.font="10px Inter, sans-serif";const at=t.measureText(J),j=6,it=4,x=at.width+j*2,D=14+it;t.beginPath(),this.drawRoundRect(t,-x/2,-D/2,x,D,4),t.fillStyle=E,t.fill(),t.fillStyle=P,t.textAlign="center",t.textBaseline="middle",t.fillText(J,0,0),t.restore()}const Y=n.label||{},X=n.helperText||{},ot=n.fontFamily||"Inter";if(Y.visible!==!1){const J=Y.text||"Label",at=Y.fontSize||12,j=Y.color||"rgba(156, 163, 175, 1)",it=Y.offset??8;t.font=`600 ${at}px "${ot}", sans-serif`,t.fillStyle=j,t.textAlign="left",t.textBaseline="bottom";const x=-(i/2),D=-(u/2)-it;t.fillText(J,x,D)}if(X.visible===!0){const J=X.text||"Helper text",at=X.fontSize||11,j=X.color||"rgba(156, 163, 175, 1)",it=X.offset??6;t.font=`400 ${at}px "${ot}", sans-serif`,t.fillStyle=j,t.textAlign="left",t.textBaseline="top";const x=-(i/2),D=u/2+it;t.fillText(J,x,D)}}renderDropdown(t,s){var k;const o=this.objectStates.get(s.id);if(!o)return;const e=o.options||s.options||{},n=s.geometry.width||160,i=s.geometry.height||40,a=-n/2,r=-i/2,c=e.corner_radius??6,d=e.disabled||e.previewState==="disabled",p=this.lastHoveredObjectId===s.id||e.previewState==="hover",u=(e.isOpen||e.previewState==="active")&&!d;let g=e.backgroundColor,h=e.borderColor,f=e.color||"#333333";d?(g=e.disabledBackgroundColor||"#f3f4f6",h=e.disabledBorderColor||"#e5e7eb",f=e.disabledColor||"#9ca3af"):u?(g=e.activeBackgroundColor||g,h=e.activeBorderColor||h,f=e.activeColor||f):p&&(g=e.hoverBackgroundColor||g,h=e.hoverBorderColor||h,f=e.hoverColor||f),g||(g="#ffffff"),h||(h="#e5e7eb");const v=t.globalAlpha;t.globalAlpha=v*(e.opacity??1),this.drawRoundRect(t,a,r,n,i,c),t.fillStyle=this.createCanvasFill(t,typeof g=="string"?{type:"Solid",color:g}:g,n,i)||"#ffffff",t.fill();const m=e.borderWidth??1;m>0&&(t.strokeStyle=this.createCanvasFill(t,typeof h=="string"?{type:"Solid",color:h}:h,n,i)||"#e5e7eb",t.lineWidth=m,t.stroke());const l=12,b=e.chevronType||"chevron",S=e.chevronSize||16,w=(u?e.openIconColor:e.closedIconColor)||e.chevronColor||"#6b7280";if(b!=="none"){const A=a+n-l-S/2;t.save(),t.translate(A,0);const T=u?e.openIconAngle??180:e.closedIconAngle??0;if(t.rotate(T*Math.PI/180),t.strokeStyle=w,t.fillStyle=w,t.lineWidth=1.5,t.lineCap="round",t.lineJoin="round",b==="chevron")t.beginPath(),t.moveTo(-S/2,-S*.2),t.lineTo(0,S*.2),t.lineTo(S/2,-S*.2),t.stroke();else if(b==="custom"||b==="path"){const R=u&&e.openIconPath||e.closedIconPath;if(R){const F=new Path2D(R);t.save();const O=S/24;t.scale(O,O),t.translate(-12,-12),t.fill(F),t.restore()}}t.restore()}const C=e.selectedOption||e.placeholder||"Select...",M=e.fontSize||14,I=e.fontWeight||400,_=e.fontFamily||"Inter, sans-serif";t.font=`${I} ${M}px ${_}`;const E=d?e.disabledColor||"#9ca3af":!e.selectedOption&&e.placeholder?"#9ca3af":f;t.fillStyle=this.createCanvasFill(t,typeof E=="string"?{type:"Solid",color:E}:E,n,i)||"#333333",t.textAlign="left",t.textBaseline="middle";const P=b==="none"?0:S+8,L=n-l*2-P;if(t.save(),t.beginPath(),t.rect(a+l,r,L,i),t.clip(),t.fillText(C,a+l,0),t.restore(),u&&!d){const A=r+i+4,T=e.optionsList||[],R=e.itemHeight||32,F=e.listPadding??4,O=T.length*R+F*2,W=e.listCornerRadius??c;t.save();const V=e.listShadow||{},U=t.getTransform(),Y=Math.sqrt(U.a*U.a+U.b*U.b)||1;t.shadowColor=typeof V.color=="string"?V.color:((k=V.color)==null?void 0:k.color)||"rgba(0,0,0,0.15)",t.shadowBlur=(V.blur??12)*Y,t.shadowOffsetY=(V.offsetY??6)*Y,t.shadowOffsetX=(V.offsetX??0)*Y,t.beginPath(),this.drawRoundRect(t,a,A,n,O,W),t.fillStyle=this.createCanvasFill(t,typeof e.listBackgroundColor=="string"?{type:"Solid",color:e.listBackgroundColor}:e.listBackgroundColor||{type:"Solid",color:"#ffffff"},n,O)||"#ffffff",t.fill();const X=e.listBorderWidth??1;X>0&&(t.shadowColor="transparent",t.strokeStyle=this.createCanvasFill(t,typeof e.listBorderColor=="string"?{type:"Solid",color:e.listBorderColor}:e.listBorderColor||{type:"Solid",color:h},n,O)||"#e5e7eb",t.lineWidth=X,t.stroke()),t.restore();const ot=e.itemFontSize||M,J=e.itemFontFamily||_;t.font=`${I} ${ot}px ${J}`,T.forEach((at,j)=>{const it=A+F+j*R;if(at===e.selectedOption)t.fillStyle=this.createCanvasFill(t,typeof e.itemSelectedBackgroundColor=="string"?{type:"Solid",color:e.itemSelectedBackgroundColor}:e.itemSelectedBackgroundColor||{type:"Solid",color:"#f3f4f6"},n,R)||"#f3f4f6",t.fillRect(a+X,it,n-X*2,R),t.fillStyle=e.itemSelectedColor||e.accentColor||f||"#374151";else if(t.fillStyle=e.listTextColor||f||"#333333",this.activeDropdownId===s.id&&this._lastPointerPos){const D=this._lastPointerPos.y-(A+F),N=Math.floor(D/R);j===N&&(t.fillStyle=this.createCanvasFill(t,typeof e.itemHoverBackgroundColor=="string"?{type:"Solid",color:e.itemHoverBackgroundColor}:e.itemHoverBackgroundColor||{type:"Solid",color:"#f9fafb"},n,R)||"#f9fafb",t.fillRect(a+X,it,n-X*2,R),t.fillStyle=e.itemHoverColor||f)}t.fillText(at,a+l,it+R/2)})}t.globalAlpha=v}renderButton(t,s){var L;if(s.children&&s.children.length>0)return;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=s.geometry||{},i=n.width||s.width||160,a=n.height||s.height||45,r=this.lastHoveredObjectId===s.id,c=this.activeObjectId===s.id,d=e.label||{},p=e.hoverStyle||{},u=e.activeStyle||{},g=e.icon||{enabled:!1};let h=e.backgroundColor||e.buttonBgColor||((L=s.style)==null?void 0:L.fill)||"#3b82f6",f=(typeof d=="object"?d.color:null)||"#ffffff",v=typeof d=="string"?d:d.text||s.text||(s.name&&!s.name.toLowerCase().includes("component")?s.name:"Button"),m=n.cornerRadius??n.corner_radius??8,l=e.borderColor||"transparent",b=e.borderWidth||0,S=1;c&&u?(h=u.backgroundColor||h,f=u.color||f,v=u.text||v,S=u.scale??.95,m=u.cornerRadius??m):r&&p&&(h=p.backgroundColor||h,f=p.color||f,v=p.text||v,S=p.scale??1,m=p.cornerRadius??m,l=p.borderColor||l);const w=-i/2,C=-a/2;t.save(),t.scale(S,S),t.beginPath(),this.drawRoundRect(t,w,C,i,a,m);const M=this.createCanvasFill(t,h,i,a);M&&(t.fillStyle=M,t.fill()),(b>0||r&&p.borderColor)&&(t.strokeStyle=l,t.lineWidth=b||(r?1:0),t.stroke());const I=d.fontSize||14,_=d.fontFamily||"Inter",E=d.fontWeight||600;t.font=`${E} ${I}px "${_}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`,t.fillStyle=f,t.textAlign="center",t.textBaseline="middle";let P=0;if(g.enabled&&g.svgPath){const k=I*1.1,A=g.gap||8,T=t.measureText(v),F=-(T.width+k+A)/2,O=g.position==="left"?F+k/2:F+T.width+A+k/2;P=g.position==="left"?F+k+A+T.width/2:F+T.width/2,t.save(),t.translate(O,0);const W=new Path2D(g.svgPath),V=k/24;t.scale(V,V),t.translate(-12,-12),t.fillStyle=f,t.fill(W),t.restore()}t.fillText(v,P,0),t.restore()}renderToggleButton(t,s){var v,m;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=e.checked??!1,i=((v=s.geometry)==null?void 0:v.width)||120,a=((m=s.geometry)==null?void 0:m.height)||40,r=-i/2,c=-a/2,d=e.corner_radius??8,p=e.label||{},u=n?e.accentColor||"#3b82f6":e.inactiveColor||"#374151",g=n?e.activeTextColor||"#ffffff":e.inactiveTextColor||"#9ca3af";t.save(),t.beginPath(),this.drawRoundRect(t,r,c,i,a,d),t.fillStyle=u,t.fill();const h=p.fontSize||14,f=p.fontFamily||"Inter";t.font=`${p.fontWeight||600} ${h}px "${f}", sans-serif`,t.fillStyle=g,t.textAlign="center",t.textBaseline="middle",t.fillText(p.text||"Toggle",0,0),t.restore()}renderToggle(t,s){var W,V,U,Y,X,ot,J,at,j,it,x,D;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=((W=s.geometry)==null?void 0:W.width)||52,i=((V=s.geometry)==null?void 0:V.height)||30,a=-n/2,r=-i/2,c=e.checked??!1,d=e.cornerRadius??e.corner_radius??i/2,p=e.toggleStyle||{},u=p.backgroundColor||e.activeColor||"#10b981",g=p.borderColor||e.borderColor||"transparent",h=p.borderWidth??e.borderWidth??0,f=p.knobColor||e.knobColor||"#ffffff",v=c?u:e.inactiveColor||"#374151",m=c?g:e.borderColor||"transparent",l=c?h:e.borderWidth??0,b=c?f:e.knobColor||"#ffffff";e.disabled&&(t.globalAlpha*=.5),t.beginPath(),this.drawRoundRect(t,a,r,n,i,d);const S=this.createCanvasFill(t,v,n,i);if(S&&(t.fillStyle=S,t.fill()),l>0){t.lineWidth=l;const N=this.createCanvasFill(t,m,n,i);N&&(t.strokeStyle=N,t.stroke())}const w=2,C=i-w*2,M=C/2,I=a+w,_=a+n-w-C,E=c?_:I,P=r+w;t.beginPath(),t.arc(E+M,P+M,M,0,Math.PI*2);const L=this.createCanvasFill(t,b,C,C);L&&(t.fillStyle=L,t.fill()),e.disabled&&(t.globalAlpha*=2);let k=!1,A=!1;const T=(c?(U=p.leftLabel)==null?void 0:U.text:null)||((Y=e.leftLabel)==null?void 0:Y.text)||"",R=(c?(X=p.leftLabel)==null?void 0:X.color:null)||((ot=e.leftLabel)==null?void 0:ot.color)||"#f3f4f6";if((J=e.leftLabel)!=null&&J.enabled&&T){const N=e.leftLabel;t.font=`${N.fontWeight||400} ${N.fontSize||12}px "${N.fontFamily||"Inter"}", sans-serif`,t.fillStyle=R,t.textBaseline="middle",t.textAlign="right",t.fillText(T,a-(N.gap||8),0),k=!0}const F=(c?(at=p.rightLabel)==null?void 0:at.text:null)||((j=e.rightLabel)==null?void 0:j.text)||"",O=(c?(it=p.rightLabel)==null?void 0:it.color:null)||((x=e.rightLabel)==null?void 0:x.color)||"#f3f4f6";if((D=e.rightLabel)!=null&&D.enabled&&F){const N=e.rightLabel;t.font=`${N.fontWeight||400} ${N.fontSize||12}px "${N.fontFamily||"Inter"}", sans-serif`,t.fillStyle=O,t.textBaseline="middle",t.textAlign="left",t.fillText(F,a+n+(N.gap||8),0),A=!0}if(!k&&!A&&e.label&&e.label.text){const N=e.label,ct=N.fontSize||14,Mt=N.fontWeight||400,bt=N.fontFamily||"Inter";t.font=`${Mt} ${ct}px "${bt}", sans-serif`,t.fillStyle=N.color||"#f3f4f6",t.textBaseline="middle";const wt=N.gap||10;let gt=0,It=0;N.position==="left"?(t.textAlign="right",gt=a-wt,It=0):N.position==="right"?(t.textAlign="left",gt=a+n+wt,It=0):N.position==="top"?(t.textAlign="center",gt=0,It=r-wt,t.textBaseline="bottom"):N.position==="bottom"?(t.textAlign="center",gt=0,It=r+i+wt,t.textBaseline="top"):(t.textAlign="left",gt=a+n+wt,It=0),t.fillText(N.text,gt,It)}}renderCheckbox(t,s){var S,w;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=((S=s.geometry)==null?void 0:S.width)||20,i=((w=s.geometry)==null?void 0:w.height)||20,a=-n/2,r=-i/2,c=e.cornerRadius??4,d=e.checked??!1,p=e.activeColor||"#3b82f6",u=e.inactiveColor||"transparent",g=e.checkColor||"#ffffff",h=e.borderColor||"#4b5563",f=e.borderWidth??2,v=d?p:u,m=d?"transparent":h,l=d?0:f;e.disabled&&(t.globalAlpha*=.5),t.beginPath(),this.drawRoundRect(t,a,r,n,i,c);const b=this.createCanvasFill(t,v,n,i);if(b&&(t.fillStyle=b,t.fill()),l>0){t.lineWidth=l;const C=this.createCanvasFill(t,m,n,i);C&&(t.strokeStyle=C,t.stroke())}else if(d){t.lineWidth=1;const C=this.createCanvasFill(t,p,n,i);C&&(t.strokeStyle=C,t.stroke())}if(d){t.save(),t.beginPath();const C=this.createCanvasFill(t,g,n,i);t.strokeStyle=C||g,t.lineWidth=Math.max(2,n*.12),t.lineCap="round",t.lineJoin="round";const M=a+n*.25,I=r+i*.5,_=a+n*.45,E=r+i*.7,P=a+n*.75,L=r+i*.25;t.moveTo(M,I),t.lineTo(_,E),t.lineTo(P,L),t.stroke(),t.restore()}if(e.disabled&&(t.globalAlpha*=2),e.label&&e.label.text){const C=e.label;t.save(),t.font=`${C.fontWeight||400} ${C.fontSize||14}px "${C.fontFamily||"Inter"}", sans-serif`,t.fillStyle=C.color||"#f3f4f6",t.textBaseline="middle";const M=C.gap||8;let I=0,_=0;C.position==="left"?(t.textAlign="right",I=a-M,_=0):C.position==="right"?(t.textAlign="left",I=a+n+M,_=0):C.position==="top"?(t.textAlign="center",I=0,_=r-M,t.textBaseline="bottom"):C.position==="bottom"&&(t.textAlign="center",I=0,_=r+i+M,t.textBaseline="top"),t.fillText(C.text,I,_),t.restore()}}renderRadioGroup(t,s){var _,E;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=((_=s.geometry)==null?void 0:_.width)||180,i=((E=s.geometry)==null?void 0:E.height)||100,a=-n/2,r=-i/2;let c=e.optionsList||["Option 1","Option 2","Option 3"];if(e.isDataVarEnabled&&e.dataInputId){let P=this.inputs.get(e.dataInputId);if(P===void 0){const L=this.inputNameMap.get(e.dataInputId);L&&L.length>0&&(P=this.inputs.get(L[0]))}P&&Array.isArray(P)&&(c=P.map(L=>typeof L=="string"?L:String(L)))}const d=e.selectedValue,p=e.orientation||"vertical",u=e.itemGap!==void 0?e.itemGap:16,g=e.activeColor||"#3b82f6",h=e.inactiveColor||"#4b5563",f=e.textColor||"#ffffff",v=e.fontSize||14,m=e.fontFamily||"Inter",l=e.fontWeight||400;t.save(),t.beginPath(),t.rect(a,r,n,i),t.clip(),e.disabled&&(t.globalAlpha*=.5);const b=8,S=b*2,w=e.radioShape||"circle",C=e.borderWidth!==void 0?e.borderWidth:2,M=e.fillEmpty||"transparent",I=(P,L,k,A)=>{if(t.beginPath(),A==="custom"&&e.customShapePath)try{const T=new Path2D(e.customShapePath);t.save(),t.translate(P-k,L-k),t.scale(k*2/24,k*2/24),t.fill(T),t.restore();return}catch{t.arc(P,L,k,0,Math.PI*2);return}if(A==="square"){const T=k*1.6;t.rect(P-T/2,L-T/2,T,T)}else if(A==="diamond"){const T=k*1.4;t.moveTo(P,L-T),t.lineTo(P+T,L),t.lineTo(P,L+T),t.lineTo(P-T,L),t.closePath()}else if(A==="heart"){const T=k*.9;t.moveTo(P,L+T*.7),t.bezierCurveTo(P-T*1.5,L-T*.3,P-T*.5,L-T*1.5,P,L-T*.5),t.bezierCurveTo(P+T*.5,L-T*1.5,P+T*1.5,L-T*.3,P,L+T*.7)}else if(A==="star"){const T=k*1.1,R=k*.5;for(let F=0;F<5;F++){const O=(F*72-90)*Math.PI/180,W=(F*72+36-90)*Math.PI/180;F===0?t.moveTo(P+T*Math.cos(O),L+T*Math.sin(O)):t.lineTo(P+T*Math.cos(O),L+T*Math.sin(O)),t.lineTo(P+R*Math.cos(W),L+R*Math.sin(W))}t.closePath()}else t.arc(P,L,k,0,Math.PI*2)};if(t.font=`${l} ${v}px "${m}", sans-serif`,t.textBaseline="middle",t.textAlign="left",p==="vertical"){const P=Math.max(S,v)+u,L=c.length*P-u,k=r+Math.max(0,(i-L)/2);c.forEach((A,T)=>{const R=k+b+T*P,F=d===A,O=this.createCanvasFill(t,g,S,S),W=this.createCanvasFill(t,h,S,S);F?(t.fillStyle=O||g,I(a+b,R,b,w),t.fill(),t.strokeStyle=O||g,t.lineWidth=C,I(a+b,R,b,w),t.stroke()):(M!=="transparent"&&(t.fillStyle=M,I(a+b,R,b,w),t.fill()),t.strokeStyle=W||h,t.lineWidth=C,I(a+b,R,b,w),t.stroke()),t.fillStyle=f,t.fillText(A,a+S+8,R)})}else{const P=r+i/2;let L=0;t.font=`${l} ${v}px "${m}", sans-serif`,c.forEach(T=>{L+=S+6+t.measureText(T).width+u}),L-=u;let A=a+Math.max(0,(n-L)/2);c.forEach(T=>{const R=d===T,F=t.measureText(T).width,O=this.createCanvasFill(t,g,S,S),W=this.createCanvasFill(t,h,S,S);R?(t.fillStyle=O||g,I(A+b,P,b,w),t.fill(),t.strokeStyle=O||g,t.lineWidth=C,I(A+b,P,b,w),t.stroke()):(M!=="transparent"&&(t.fillStyle=M,I(A+b,P,b,w),t.fill()),t.strokeStyle=W||h,t.lineWidth=C,I(A+b,P,b,w),t.stroke()),t.fillStyle=f,t.fillText(T,A+S+6,P),A+=S+6+F+u})}if(t.restore(),e.disabled&&(t.globalAlpha*=2),e.label&&e.label.text){const P=e.label;t.save(),t.font=`${P.fontWeight||400} ${P.fontSize||14}px "${P.fontFamily||"Inter"}", sans-serif`,t.fillStyle=P.color||"#9ca3af",t.textBaseline="middle";const L=P.gap||8;let k=0,A=0;P.position==="left"?(t.textAlign="right",k=a-L,A=0):P.position==="right"?(t.textAlign="left",k=a+n+L,A=0):P.position==="top"?(t.textAlign="center",k=0,A=r-L,t.textBaseline="bottom"):P.position==="bottom"&&(t.textAlign="center",k=0,A=r+i+L,t.textBaseline="top"),t.fillText(P.text,k,A),t.restore()}}renderBarChart(t,s){var E,P,L;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{};let n={...e};if(e.isDataVarEnabled&&e.dataInputId){let k=this.inputs.get(e.dataInputId);if(k===void 0){const A=this.inputNameMap.get(e.dataInputId);A&&A.length>0&&(k=this.inputs.get(A[0]))}k&&Array.isArray(k)&&(n.categories=k.map(A=>typeof A=="string"?A:String(A)))}if(e.isDatasetsVarEnabled&&((E=e.datasetInputIds)==null?void 0:E.length)>0){const k=e.datasetInputIds.map((A,T)=>{var O;let R=this.inputs.get(A);if(R===void 0){const W=this.inputNameMap.get(A);W&&W.length>0&&(R=this.inputs.get(W[0]))}const F=((O=e.datasets)==null?void 0:O[T])||{id:`ds-${T}`,label:`Series ${T+1}`,data:[],color:"#6366f1"};return R&&Array.isArray(R)?{...F,data:R.map(W=>typeof W=="number"?W:parseFloat(W)||0)}:F});n.datasets=k}const i={width:((P=s.geometry)==null?void 0:P.width)||300,height:((L=s.geometry)==null?void 0:L.height)||180,chartType:n.chartType||"grouped",datasets:n.datasets||[{id:"ds-1",label:"Revenue",data:[42,67,31,55,78,48],color:"#6366f1"}],categories:n.categories||["Jan","Feb","Mar","Apr","May","Jun"],orientation:n.orientation||"vertical",barWidth:n.barWidth!==void 0?n.barWidth:14,barGap:n.barGap!==void 0?n.barGap:4,barCornerRadius:n.barCornerRadius!==void 0?n.barCornerRadius:5,showXAxis:!!n.showXAxis,showYAxis:!!n.showYAxis,xAxisColor:n.xAxisColor||"rgba(255,255,255,0.15)",yAxisColor:n.yAxisColor||"rgba(255,255,255,0.15)",showXLabels:n.showXLabels!==void 0?!!n.showXLabels:!0,showYLabels:!!n.showYLabels,axisLabelColor:n.axisLabelColor||"rgba(255,255,255,0.55)",axisLabelFontSize:n.axisLabelFontSize||9,showLegend:n.showLegend!==void 0?!!n.showLegend:!0,legendColor:n.legendColor||"rgba(255,255,255,0.7)",legendFontSize:n.legendFontSize||9,showGridLines:n.showGridLines!==void 0?!!n.showGridLines:!0,gridColor:n.gridColor||"rgba(255,255,255,0.06)",cardBackground:n.cardBackground||"#ffffff",cardBackgroundOpacity:n.cardBackgroundOpacity!==void 0?n.cardBackgroundOpacity:.04,cardBorderColor:n.cardBorderColor||"rgba(255,255,255,0.08)",barGradient:n.barGradient!==void 0?!!n.barGradient:!0,gradientStartColor:n.gradientStartColor||"",gradientEndOpacity:n.gradientEndOpacity!==void 0?n.gradientEndOpacity:.27,showValueOnTop:!!n.showValueOnTop,valueFontSize:n.valueFontSize||10,valueColor:n.valueColor||"",valueFontWeight:n.valueFontWeight||"bold",barStyle:n.barStyle||"solid",barBorderWidth:n.barBorderWidth!==void 0?n.barBorderWidth:1,barBorderColor:n.barBorderColor||"auto",enableShadows:!!n.enableShadows,shadowColor:n.shadowColor||"rgba(0,0,0,0.5)",shadowBlur:n.shadowBlur!==void 0?n.shadowBlur:4,shadowOffsetY:n.shadowOffsetY!==void 0?n.shadowOffsetY:2,xAxisLineWidth:n.xAxisLineWidth!==void 0?n.xAxisLineWidth:1,yAxisLineWidth:n.yAxisLineWidth!==void 0?n.yAxisLineWidth:1,gridLineWidth:n.gridLineWidth!==void 0?n.gridLineWidth:1,gridLineDash:n.gridLineDash||[3,4],_hexToRgb:function(k,A){if(k.startsWith("rgba")||k.startsWith("rgb"))return k;k.startsWith("#")||(k="#"+k),k.length===4&&(k="#"+k[1]+k[1]+k[2]+k[2]+k[3]+k[3]);const T=parseInt(k.slice(1,3),16),R=parseInt(k.slice(3,5),16),F=parseInt(k.slice(5,7),16);return`rgba(${T},${R},${F},${A})`},_resolveColor:function(k,A){return typeof k=="string"?k:"#6366f1"},_makeGradient:function(k,A,T,R,F,O){if(!this.barGradient)return A;const W=this.gradientStartColor||A,V=k.createLinearGradient(T,R,F,O);return V.addColorStop(0,A),V.addColorStop(1,this._hexToRgb(W,this.gradientEndOpacity)),V},_drawRoundedBar:function(k,A,T,R,F,O,W){if(O=Math.min(O,Math.min(Math.abs(R),Math.abs(F))/2),O<=0||R===0||F===0){k.rect(A,T,R,F);return}k.beginPath(),W?(k.moveTo(A,T+F),k.lineTo(A,T+O),k.quadraticCurveTo(A,T,A+O,T),k.lineTo(A+R-O,T),k.quadraticCurveTo(A+R,T,A+R,T+O),k.lineTo(A+R,T+F),k.lineTo(A,T+F)):(k.moveTo(A,T),k.lineTo(A+R-O,T),k.quadraticCurveTo(A+R,T,A+R,T+O),k.lineTo(A+R,T+F-O),k.quadraticCurveTo(A+R,T+F,A+R-O,T+F),k.lineTo(A,T+F),k.lineTo(A,T)),k.closePath()}},a=i.width,r=i.height,c=-a/2,d=-r/2;if(!i.datasets||i.datasets.length===0||i.categories.length===0){t.save(),t.fillStyle="rgba(99,102,241,0.7)",t.font="bold 11px Inter, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("NO CHART DATA",0,0),t.restore();return}let p=-1/0,u=1/0;const g=i.categories.length,h=i.datasets.length;if(i.chartType==="stacked")for(let k=0;k<g;k++){let A=0,T=0;i.datasets.forEach(R=>{const F=R.data[k]??0;F>=0?A+=F:T+=F}),A>p&&(p=A),T<u&&(u=T)}else i.datasets.forEach(k=>{k.data&&k.data.forEach(A=>{A>p&&(p=A),A<u&&(u=A)})});isFinite(p)||(p=10),isFinite(u)||(u=0),p=Math.max(p,0),u=Math.min(u,0);const f=p-u||10;t.save(),i.enableShadows&&(t.shadowColor=i.shadowColor,t.shadowBlur=i.shadowBlur,t.shadowOffsetY=i.shadowOffsetY),t.font=i.axisLabelFontSize+"px Inter, sans-serif";const v=i.showYLabels?t.measureText(p.toFixed(0)).width+14:10,m=i.showXLabels?i.axisLabelFontSize+12:8,b=(i.showLegend&&h>0?i.legendFontSize+10:0)+8,S=10,w=c+v,C=d+b,M=a-v-S,I=r-b-m;if(i.enableShadows&&(t.shadowColor="transparent"),t.beginPath(),t.roundRect(c,d,a,r,10),t.fillStyle=i._hexToRgb(i.cardBackground,i.cardBackgroundOpacity),t.fill(),t.strokeStyle=i.cardBorderColor,t.lineWidth=1,t.stroke(),i.showLegend&&h>0){t.font=i.legendFontSize+"px Inter, sans-serif",t.textBaseline="middle";const k=d+12;let A=w;i.datasets.forEach((T,R)=>{const F=i._resolveColor(T.color,R),O=T.label||"Series "+(R+1),W=7;t.beginPath(),t.roundRect(A,k-W/2,W,W,2),t.fillStyle=F,t.fill(),t.fillStyle=i.legendColor,t.textAlign="left",t.fillText(O,A+W+4,k),A+=t.measureText(O).width+W+16})}const _=4;if(i.showGridLines){t.setLineDash(i.gridLineDash||[]),t.lineWidth=i.gridLineWidth||1,t.strokeStyle=i.gridColor;for(let k=0;k<=_;k++)if(i.orientation==="horizontal"){const A=w+k/_*M;t.beginPath(),t.moveTo(A,C),t.lineTo(A,C+I),t.stroke()}else{const A=C+k/_*I;t.beginPath(),t.moveTo(w,A),t.lineTo(w+M,A),t.stroke()}t.setLineDash([])}if(i.showYLabels){t.font=i.axisLabelFontSize+"px Inter, sans-serif",t.textAlign="right",t.textBaseline="middle",t.fillStyle=i.axisLabelColor;for(let k=0;k<=_;k++)if(i.orientation==="horizontal"){const A=u+k/_*f,T=w+k/_*M;t.textAlign="center",t.fillText(A.toFixed(0),T,C+I+i.axisLabelFontSize)}else{const A=p-k/_*f,T=C+k/_*I;t.textAlign="right",t.fillText(A.toFixed(0),w-6,T)}}if(t.setLineDash([]),i.showXAxis&&(t.lineWidth=i.xAxisLineWidth||1,t.strokeStyle=i.xAxisColor,t.beginPath(),t.moveTo(w,C+I),t.lineTo(w+M,C+I),t.stroke()),i.showYAxis&&(t.lineWidth=i.yAxisLineWidth||1,t.strokeStyle=i.yAxisColor,t.beginPath(),t.moveTo(w,C),t.lineTo(w,C+I),t.stroke()),i.enableShadows&&(t.shadowColor=i.shadowColor),i.chartType==="stacked")if(i.orientation==="horizontal"){const k=I/g;for(let A=0;A<g;A++){const T=C+A*k+k/2;i.showXLabels&&(t.font=i.axisLabelFontSize+"px Inter, sans-serif",t.textAlign="right",t.textBaseline="middle",t.fillStyle=i.axisLabelColor,t.shadowColor="transparent",t.fillText(i.categories[A]||"",w-5,T),i.enableShadows&&(t.shadowColor=i.shadowColor));let R=w;i.datasets.forEach((F,O)=>{const W=F.data[A]??0;if(W===0)return;const V=W/f*M,U=Math.min(i.barWidth*h+i.barGap,k-8),Y=T-U/2,X=R;R+=V;const ot=i._resolveColor(F.color,O);t.beginPath(),t.fillStyle=i._makeGradient(t,ot,X,Y,X+V,Y),i._drawRoundedBar(t,X,Y,V,U,O===h-1?i.barCornerRadius:0,!1),i.barStyle==="outline"||i.barStyle==="dashed"?(t.fillStyle="transparent",t.strokeStyle=i.barBorderColor==="auto"?ot:i.barBorderColor,t.lineWidth=i.barBorderWidth,i.barStyle==="dashed"&&t.setLineDash([4,4]),t.stroke(),t.setLineDash([])):t.fill()})}}else{const k=M/g;for(let A=0;A<g;A++){const T=w+A*k+k/2;i.showXLabels&&(t.font=i.axisLabelFontSize+"px Inter, sans-serif",t.textAlign="center",t.textBaseline="top",t.fillStyle=i.axisLabelColor,t.shadowColor="transparent",t.fillText(i.categories[A]||"",T,C+I+5),i.enableShadows&&(t.shadowColor=i.shadowColor));let R=C+I;i.datasets.forEach((F,O)=>{const W=F.data[A]??0;if(W===0)return;const V=W/f*I,U=Math.min(i.barWidth*h+i.barGap,k-8),Y=T-U/2,X=R-V;R-=V;const ot=i._resolveColor(F.color,O);t.beginPath(),t.fillStyle=i._makeGradient(t,ot,Y,X,Y,X+V),i._drawRoundedBar(t,Y,X,U,V,O===h-1?i.barCornerRadius:0,!0),i.barStyle==="outline"||i.barStyle==="dashed"?(t.fillStyle="transparent",t.strokeStyle=i.barBorderColor==="auto"?ot:i.barBorderColor,t.lineWidth=i.barBorderWidth,i.barStyle==="dashed"&&t.setLineDash([4,4]),t.stroke(),t.setLineDash([])):t.fill()})}}else if(i.orientation==="horizontal"){const k=I/g,A=h*i.barWidth+Math.max(0,(h-1)*i.barGap),T=w+(0-u)/f*M;for(let R=0;R<g;R++){const F=C+R*k+k/2;i.showXLabels&&(t.font=i.axisLabelFontSize+"px Inter, sans-serif",t.textAlign="right",t.textBaseline="middle",t.fillStyle=i.axisLabelColor,t.shadowColor="transparent",t.fillText(i.categories[R]||"",w-5,F),i.enableShadows&&(t.shadowColor=i.shadowColor));const O=F-A/2;i.datasets.forEach((W,V)=>{const U=W.data[R]??0,Y=Math.abs(U/f*M);if(Y<1)return;const X=O+V*(i.barWidth+i.barGap),ot=U>=0?T:T-Y,J=i._resolveColor(W.color,V);t.beginPath(),t.fillStyle=i._makeGradient(t,J,ot,X,ot+Y,X),i._drawRoundedBar(t,ot,X,Y,i.barWidth,i.barCornerRadius,!1),i.barStyle==="outline"||i.barStyle==="dashed"?(t.fillStyle="transparent",t.strokeStyle=i.barBorderColor==="auto"?J:i.barBorderColor,t.lineWidth=i.barBorderWidth,i.barStyle==="dashed"&&t.setLineDash([4,4]),t.stroke(),t.setLineDash([])):t.fill(),i.showValueOnTop&&U!==0&&(t.font=(i.valueFontWeight||"bold")+" "+(i.valueFontSize||10)+"px Inter, sans-serif",t.textAlign=U>=0?"left":"right",t.textBaseline="middle",t.fillStyle=i.valueColor==="auto"?J:i.valueColor||"#fff",t.shadowColor="transparent",t.fillText(U.toString(),U>=0?ot+Y+4:ot-4,X+i.barWidth/2),i.enableShadows&&(t.shadowColor=i.shadowColor))})}}else{const k=M/g,A=h*i.barWidth+Math.max(0,(h-1)*i.barGap),T=C+I-(0-u)/f*I;for(let R=0;R<g;R++){const F=w+R*k+k/2;i.showXLabels&&(t.font=i.axisLabelFontSize+"px Inter, sans-serif",t.textAlign="center",t.textBaseline="top",t.fillStyle=i.axisLabelColor,t.shadowColor="transparent",t.fillText(i.categories[R]||"",F,C+I+5),i.enableShadows&&(t.shadowColor=i.shadowColor));const O=F-A/2;i.datasets.forEach((W,V)=>{const U=W.data[R]??0,Y=Math.abs(U/f*I);if(Y<1)return;const X=O+V*(i.barWidth+i.barGap),ot=U>=0?T-Y:T,J=i._resolveColor(W.color,V);t.beginPath(),t.fillStyle=i._makeGradient(t,J,X,ot,X,ot+Y),i._drawRoundedBar(t,X,ot,i.barWidth,Y,i.barCornerRadius,!0),i.barStyle==="outline"||i.barStyle==="dashed"?(t.fillStyle="transparent",t.strokeStyle=i.barBorderColor==="auto"?J:i.barBorderColor,t.lineWidth=i.barBorderWidth,i.barStyle==="dashed"&&t.setLineDash([4,4]),t.stroke(),t.setLineDash([])):t.fill(),i.showValueOnTop&&U!==0&&(t.font=(i.valueFontWeight||"bold")+" "+(i.valueFontSize||10)+"px Inter, sans-serif",t.textAlign="center",t.textBaseline=U>=0?"bottom":"top",t.fillStyle=i.valueColor==="auto"?J:i.valueColor||"#fff",t.shadowColor="transparent",t.fillText(U.toString(),X+i.barWidth/2,U>=0?ot-4:ot+Y+4),i.enableShadows&&(t.shadowColor=i.shadowColor))})}}t.restore()}renderPieChart(t,s){var l,b;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=e.colorPalette==="custom"&&Array.isArray(e.customPalette)&&e.customPalette.length>0?e.customPalette:us[e.colorPalette||"vibrant"]||us.vibrant;let i=e.slices||[{id:"slice-1",label:"Item 1",value:45,color:""}];if(e.isDataVarEnabled&&e.dataInputId){let S=this.inputs.get(e.dataInputId);if(S===void 0){const w=this.inputNameMap.get(e.dataInputId);w&&w.length>0&&(S=this.inputs.get(w[0]))}S&&Array.isArray(S)&&(i=S.map((w,C)=>{var M,I;return{id:`slice-${C}`,label:((M=i[C])==null?void 0:M.label)||`Item ${C+1}`,value:typeof w=="number"?w:0,color:((I=i[C])==null?void 0:I.color)||""}}))}const a={width:((l=s.geometry)==null?void 0:l.width)||180,height:((b=s.geometry)==null?void 0:b.height)||180,chartType:e.chartType||"donut",slices:i,innerRadius:e.innerRadius!==void 0?e.innerRadius:.55,sliceGap:e.sliceGap!==void 0?e.sliceGap:3,showLabels:!!e.showLabels,labelColor:e.labelColor||"#000000",labelFontSize:e.labelFontSize||10,showLegend:e.showLegend!==void 0?!!e.showLegend:!0,legendColor:e.legendColor||"rgba(0,0,0,0.65)",legendFontSize:e.legendFontSize||9,showCenterText:e.showCenterText!==void 0?!!e.showCenterText:!0,centerLabel:e.centerLabel||"Total",centerTextColor:e.centerTextColor||"#000000",centerLabelColor:e.centerLabelColor||"rgba(0,0,0,0.4)",cardBackground:e.cardBackground||"#ffffff",cardBackgroundOpacity:e.cardBackgroundOpacity!==void 0?e.cardBackgroundOpacity:.04,cardBorderColor:e.cardBorderColor||"rgba(0,0,0,0.08)",_resolveSliceColor:function(S,w){return S.color?S.color:n[w%n.length]},_hexToRgb:function(S){if(S.startsWith("rgba")||S.startsWith("rgb"))return S;const w=S.replace("#",""),C=parseInt(w.substring(0,2),16),M=parseInt(w.substring(2,4),16),I=parseInt(w.substring(4,6),16);return`rgba(${C},${M},${I},${a.cardBackgroundOpacity})`}},r=a.width,c=a.height;if(!a.slices||a.slices.length===0){t.save(),t.fillStyle="rgba(99,102,241,0.8)",t.font="bold 11px Inter, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("NO PIE DATA",0,0),t.restore();return}const d=a.slices.reduce((S,w)=>S+(w.value||0),0);if(d<=0){t.save(),t.fillStyle="rgba(99,102,241,0.8)",t.font="bold 11px Inter, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("EMPTY DATA",0,0),t.restore();return}t.save();const p=a._hexToRgb(a.cardBackground);t.beginPath(),t.roundRect(-r/2,-c/2,r,c,10),t.fillStyle=p,t.fill(),t.strokeStyle=a.cardBorderColor,t.lineWidth=1,t.stroke();const u=a.showLegend?Math.ceil(a.slices.length/2):0,g=u>0?u*(a.legendFontSize+8)+10:0,h=c-g-16,f=Math.min(r-24,h)/2,v=0,m=-g/2;if(a.chartType==="rose"){const S=Math.max(...a.slices.map(M=>M.value||0)),w=Math.PI*2/a.slices.length,C=f>0?a.sliceGap/f:0;a.slices.forEach((M,I)=>{const _=M.value||0;if(_===0)return;const E=_/S*f,P=-Math.PI/2+I*w+C/2,L=P+w-C,k=a._resolveSliceColor(M,I);if(t.beginPath(),t.moveTo(v,m),t.arc(v,m,E,P,L),t.closePath(),t.fillStyle=k+"cc",t.fill(),t.strokeStyle=k,t.lineWidth=1.5,t.stroke(),a.showLabels){const A=P+(L-P)/2,T=v+E*.65*Math.cos(A),R=m+E*.65*Math.sin(A),F=Math.round(_/d*100);t.save(),t.font=`bold ${a.labelFontSize}px Inter, sans-serif`,t.fillStyle=a.labelColor,t.textAlign="center",t.textBaseline="middle",t.fillText(`${F}%`,T,R),t.restore()}})}else{const S=a.chartType==="pie"?0:a.innerRadius,w=f*Math.max(0,S),C=f>0?a.sliceGap/f:0;let M=-Math.PI/2;if(a.slices.forEach((I,_)=>{const E=I.value||0;if(E===0){M+=E/d*Math.PI*2;return}const P=E/d*Math.PI*2,L=M+C/2,k=M+P-C/2;if(k<=L){M+=P;return}const A=a._resolveSliceColor(I,_);if(t.beginPath(),t.fillStyle=A,w<=0?(t.moveTo(v,m),t.arc(v,m,f,L,k),t.lineTo(v,m)):(t.moveTo(v+f*Math.cos(L),m+f*Math.sin(L)),t.arc(v,m,f,L,k),t.arc(v,m,w,k,L,!0),t.closePath()),t.fill(),a.showLabels){const T=L+(k-L)/2,R=w+(f-w)/2,F=v+R*Math.cos(T),O=m+R*Math.sin(T),W=Math.round(E/d*100);t.save(),t.font=`bold ${a.labelFontSize}px Inter, sans-serif`,t.fillStyle=a.labelColor,t.textAlign="center",t.textBaseline="middle",t.fillText(`${W}%`,F,O),t.restore()}M+=P}),a.chartType==="donut"&&a.showCenterText&&w>14){const I=Math.round(d),_=Math.min(Math.floor(w*.52),20),E=Math.min(Math.floor(w*.26),10);t.textAlign="center",t.textBaseline="middle",t.font=`bold ${_}px Inter, sans-serif`,t.fillStyle=a.centerTextColor,t.fillText(I.toString(),v,m-E*.5),t.font=`${E}px Inter, sans-serif`,t.fillStyle=a.centerLabelColor,t.fillText(a.centerLabel,v,m+_*.6)}}if(a.showLegend&&a.slices.length>0){t.font=`${a.legendFontSize}px Inter, sans-serif`;const S=2,w=r/S,C=a.legendFontSize+8,M=c/2-g+10,I=-r/2+10;a.slices.forEach((_,E)=>{const P=E%S,L=Math.floor(E/S),k=I+P*w,A=M+L*C,T=a._resolveSliceColor(_,E),R=7;t.beginPath(),t.roundRect(k,A-R/2,R,R,2),t.fillStyle=T,t.fill(),t.textAlign="left",t.textBaseline="middle",t.fillStyle=a.legendColor;const F=Math.round((_.value||0)/d*100),O=`${_.label||"Item"} ${F}%`,W=w-R-20;let V=O;for(;t.measureText(V).width>W&&V.length>4;)V=V.slice(0,-4)+"…";t.fillText(V,k+R+4,A)})}t.restore()}renderJoystick(t,s){var v,m,l,b,S,w,C,M,I,_,E,P;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.width)!==void 0?o.width:((v=s.geometry)==null?void 0:v.width)??s.width??100,n=(o==null?void 0:o.height)!==void 0?o.height:((m=s.geometry)==null?void 0:m.height)??s.height??100,i=Math.min(e,n)*(((l=s.style)==null?void 0:l.baseSize)??.45),a=Math.min(e,n)*(((b=s.style)==null?void 0:b.handleSize)??.14);let r=s.handleX||0,c=s.handleY||0;o&&o.handleX!==void 0&&(r=o.handleX),o&&o.handleY!==void 0&&(c=o.handleY),t.save();let d=0,p=0;s.handleOrigin==="top-left"?(d=e/2,p=n/2):s.handleOrigin==="bottom-right"&&(d=-e/2,p=-n/2),t.translate(d,p);const u=t.globalAlpha;if(t.globalAlpha=u*(((S=s.style)==null?void 0:S.baseOpacity)??1),t.beginPath(),s.boundsShape==="square"){const L=s.joystickType==="2D"?12:18;t.roundRect(-i,-i,i*2,i*2,L)}else t.arc(0,0,i,0,Math.PI*2);t.fillStyle=((w=s.style)==null?void 0:w.baseColor)||"rgba(0,0,0,0.04)",t.fill(),(C=s.style)!=null&&C.baseBorderWidth?(t.lineWidth=s.style.baseBorderWidth,t.strokeStyle=s.style.baseBorderColor||"rgba(0,0,0,0.1)",t.stroke()):(t.lineWidth=1,t.strokeStyle=((M=s.style)==null?void 0:M.baseBorderColor)||"rgba(0,0,0,0.08)",t.stroke());const g=s.overflowHandle?i:Math.max(.1,i-a);let h=0,f=0;s.joystickType==="2D"?(h=r*g,f=c*g):s.joystickType==="1D_X"?(h=r*g,f=0):s.joystickType==="1D_Y"&&(h=0,f=c*g),t.globalAlpha=u*(((I=s.style)==null?void 0:I.handleOpacity)??1),t.beginPath(),t.arc(h,f,a,0,Math.PI*2),t.fillStyle=((_=s.style)==null?void 0:_.handleColor)||"#3b82f6",t.fill(),(E=s.style)!=null&&E.handleBorderWidth?(t.lineWidth=s.style.handleBorderWidth,t.strokeStyle=s.style.handleBorderColor||"rgba(255,255,255,0.5)",t.stroke()):(t.lineWidth=1,t.strokeStyle=((P=s.style)==null?void 0:P.handleBorderColor)||"rgba(255,255,255,0.5)",t.stroke()),t.globalAlpha=u,t.restore()}getRadioGroupItemIndexAtPointer(t,s,o){var I,_;const e=t.options||{},n=this.objectStates.get(t.id)||{},i=e.optionsList||[];if(i.length===0)return null;const a=n.width!==void 0?n.width:((I=t.geometry)==null?void 0:I.width)||180,r=n.height!==void 0?n.height:((_=t.geometry)==null?void 0:_.height)||100,c=e.orientation||"vertical",d=e.itemGap!==void 0?e.itemGap:16,p=e.fontSize||14,u=this.getWorldTransform(t.id),g=s-u.x,h=o-u.y,f=-u.rotation*(Math.PI/180),v=Math.cos(f),m=Math.sin(f),l=g*v-h*m,b=g*m+h*v,w=8*2,C=-a/2,M=-r/2;if(c==="vertical"){const E=Math.max(w,p)+d;for(let P=0;P<i.length;P++){const L=M+P*E;if(l>=C&&l<=C+a&&b>=L&&b<=L+E)return P}}else{let E=C;for(let P=0;P<i.length;P++){const k=i[P].length*8,A=w+6+k+d;if(l>=E&&l<=E+A&&b>=M&&b<=M+r)return P;E+=A}}return null}renderLineGraph(t,s,o,e){let n=s.datasets||[];if((!n||n.length===0)&&(s.data||s.graphData)&&(n=[{id:"line-1",label:"Series 1",data:s.data||s.graphData||[],lineColor:s.lineColor||"#3b82f6",lineWidth:s.lineWidth||2,showArea:s.showArea||!1,areaColor:s.areaColor||"rgba(139, 92, 246, 0.3)",smoothing:s.smoothing||!1,showPoints:s.showPoints!==void 0?s.showPoints:!0,pointSize:s.pointSize||6,pointFill:s.pointFill||"#ffffff",pointStrokeColor:s.pointStrokeColor||s.lineColor||"#3b82f6",pointStrokeWidth:s.pointStrokeWidth||2}]),!n||n.length===0||!n.some(f=>f.data&&f.data.length>=2)){t.save(),t.fillStyle="#6366f1",t.font="12px Inter, system-ui, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("NO DATA",0,0),t.restore();return}let i=1/0,a=-1/0,r=0;if(n.forEach(f=>{let v=f.data;if(f.isVarEnabled&&f.inputId){let m=this.inputs.get(f.inputId);if(m===void 0){const l=this.inputNameMap.get(f.inputId);l&&l.length>0&&(m=this.inputs.get(l[0]))}m&&Array.isArray(m)&&(v=m)}if(v&&v.length>0){const m=v.filter(l=>typeof l=="number"&&!isNaN(l));m.length>0&&(i=Math.min(i,...m),a=Math.max(a,...m),r=Math.max(r,v.length))}f._resolvedData=v}),r<2)return;const c=a-i,d=o/(r-1),p=f=>{const v=c===0?.5:(f-i)/c;return e/2-v*e},u=f=>f*d-o/2,g=s.axisColor||"#333333";if(s.showXAxis&&(t.beginPath(),t.strokeStyle=s.xAxisColor||g,t.lineWidth=1,t.moveTo(-o/2,e/2),t.lineTo(o/2,e/2),t.stroke()),s.showYAxis&&(t.beginPath(),t.strokeStyle=s.yAxisColor||g,t.lineWidth=1,t.moveTo(-o/2,-e/2),t.lineTo(-o/2,e/2),t.stroke()),t.fillStyle=s.axisLabelColor||"#333333",t.font=`${s.axisLabelFontSize||10}px Inter, sans-serif`,s.showXLabels){t.textAlign="center",t.textBaseline="top";for(let f=0;f<r;f++){const v=u(f);t.fillText(`${f+1}`,v,e/2+5)}}if(s.showYLabels){t.textAlign="right",t.textBaseline="middle";const f=-o/2-5,v=(a+i)/2;t.fillText(a.toFixed(1),f,p(a)),t.fillText(v.toFixed(1),f,p(v)),t.fillText(i.toFixed(1),f,p(i))}const h=10;if(n.forEach(f=>{const v=f._resolvedData;if(!(!v||v.length<2)){if(f.showArea){if(t.beginPath(),t.moveTo(u(0),e/2),t.lineTo(u(0),p(v[0])),f.smoothing&&v.length>2)for(let l=0;l<v.length-1;l++){const b=v[l===0?l:l-1],S=v[l],w=v[l+1],C=v[l+1===v.length-1?l+1:l+2];for(let M=1;M<=h;M++){const I=M/h,_=this._catmullRom(b,S,w,C,I);t.lineTo(u(l+I),p(_))}}else for(let l=1;l<v.length;l++)t.lineTo(u(l),p(v[l]));t.lineTo(u(v.length-1),e/2),t.closePath();const m=t.globalAlpha;t.globalAlpha=m*(s.areaOpacity??.3),t.fillStyle=f.areaColor||"rgba(139, 92, 246, 0.2)",t.fill(),t.globalAlpha=m}if(t.beginPath(),t.strokeStyle=f.lineColor||"#3b82f6",t.lineWidth=f.lineWidth||2,t.lineJoin="round",t.lineCap="round",t.moveTo(u(0),p(v[0])),f.smoothing&&v.length>2)for(let m=0;m<v.length-1;m++){const l=v[m===0?m:m-1],b=v[m],S=v[m+1],w=v[m+1===v.length-1?m+1:m+2];for(let C=1;C<=h;C++){const M=C/h,I=this._catmullRom(l,b,S,w,M);t.lineTo(u(m+M),p(I))}}else for(let m=1;m<v.length;m++)t.lineTo(u(m),p(v[m]));t.stroke(),f.showPoints&&v.forEach((m,l)=>{const b=u(l),S=p(m);t.beginPath(),t.arc(b,S,(f.pointSize||6)/2,0,Math.PI*2),t.fillStyle=f.pointFill||"#ffffff",t.fill(),t.strokeStyle=f.pointStrokeColor||f.lineColor||"#3b82f6",t.lineWidth=f.pointStrokeWidth||1,t.stroke()})}}),s.showLegend&&n.length>0){const f=o/2-10;let v=-e/2+15;const m=s.legendFontSize||10,l=m+5;t.font=`${m}px Inter, sans-serif`,t.textAlign="right",t.textBaseline="alphabetic",n.forEach(b=>{const w=b.label||"Series",C=t.measureText(w).width;t.beginPath(),t.rect(f-C-8-5,v-(8/2+2),8,8),t.fillStyle=b.lineColor||"#3b82f6",t.fill(),t.fillStyle=s.legendColor||"#333333",t.fillText(w,f,v),v+=l})}}_catmullRom(t,s,o,e,n){const i=(o-t)*.5,a=(e-s)*.5,r=n*n,c=n*r;return(2*s-2*o+i+a)*c+(-3*s+3*o-2*i-a)*r+i*n+s}normalizeOpacity(t){const s=typeof t=="number"?t:parseFloat(String(t));return isNaN(s)?1:s>1?Math.min(1,s/100):Math.max(0,Math.min(1,s))}createCanvasFill(t,s,o,e){var n,i,a;if(!s||s.type==="None")return null;if(typeof s=="string")return s;if(s.type==="Solid"&&s.color){const r=s.color,d=(((i=(n=this.artboard)==null?void 0:n.tokens)==null?void 0:i.colors)||{})[r]||r;return t.fillStyle=d,d}if((s.type==="LinearGradient"||s.type==="RadialGradient"||s.type==="AngularGradient"||s.type==="DiamondGradient")&&s.stops){const r=(c,d=100)=>{var S,w;const u=(((w=(S=this.artboard)==null?void 0:S.tokens)==null?void 0:w.colors)||{})[c]||c,g=this.normalizeOpacity(s.opacity??100),f=this.normalizeOpacity(d)*g;if(f>=1&&u.startsWith("#"))return u;const v=u.startsWith("#")?u.replace("#",""):"ffffff",m=parseInt(v.substring(0,2),16),l=parseInt(v.substring(2,4),16),b=parseInt(v.substring(4,6),16);return`rgba(${m}, ${l}, ${b}, ${f})`};if(s.type==="LinearGradient"){let c=0,d=-e/2,p=0,u=e/2;if(s.angle!==void 0&&(!s.start||!s.end)){const h=(s.angle-90)*Math.PI/180,f=Math.max(o,e)/2;c=Math.cos(h)*-f,d=Math.sin(h)*-f,p=Math.cos(h)*f,u=Math.sin(h)*f}else if(s.start||s.end){const h=(f,v,m)=>Array.isArray(f)?f[v]??.5:f&&typeof f=="object"?f[m]??.5:.5;c=h(s.start,0,"x")*o-o/2,d=h(s.start,1,"y")*e-e/2,p=h(s.end,0,"x")*o-o/2,u=h(s.end,1,"y")*e-e/2}Math.abs(c-p)<.001&&Math.abs(d-u)<.001&&(c=0,d=-e/2,p=0,u=e/2);const g=t.createLinearGradient(c,d,p,u);if(s.stops.forEach(h=>{const f=h.offset!==void 0?h.offset:h.pos!==void 0?h.pos:h.position!==void 0?h.position:0,v=r(h.color||"#000000",h.opacity??100);g.addColorStop(Math.max(0,Math.min(1,f)),v)}),s.gradientTransform&&g.setTransform){const[h,f,v,m,l,b]=s.gradientTransform;g.setTransform({a:h,b:f,c:v,d:m,e:l,f:b})}return g}else if(s.type==="RadialGradient"){const c=(h,f,v)=>Array.isArray(h)?h[f]??.5:h&&typeof h=="object"?h[v]??.5:.5,d=c(s.center,0,"x")*o-o/2,p=c(s.center,1,"y")*e-e/2,u=(s.radius??.5)*Math.max(o,e),g=t.createRadialGradient(d,p,0,d,p,u);if(s.stops.forEach(h=>{const f=h.offset!==void 0?h.offset:h.pos!==void 0?h.pos:h.position!==void 0?h.position:0,v=r(h.color||"#000000",h.opacity??100);g.addColorStop(Math.max(0,Math.min(1,f)),v)}),s.gradientTransform&&g.setTransform){const[h,f,v,m,l,b]=s.gradientTransform;g.setTransform({a:h,b:f,c:v,d:m,e:l,f:b})}return g}else if(s.type==="AngularGradient"){const c=(h,f,v)=>Array.isArray(h)?h[f]??.5:h&&typeof h=="object"?h[v]??.5:.5,d=c(s.center||[.5,.5],0,"x")*o-o/2,p=c(s.center||[.5,.5],1,"y")*e-e/2,u=(s.degree||s.angle||0)*(Math.PI/180),g=(a=t.createConicGradient)==null?void 0:a.call(t,u,d,p);if(g){if(s.stops.forEach(h=>{const f=h.offset!==void 0?h.offset:h.pos!==void 0?h.pos:h.position!==void 0?h.position:0,v=r(h.color||"#000000",h.opacity??100);g.addColorStop(Math.max(0,Math.min(1,f)),v)}),s.gradientTransform&&g.setTransform){const[h,f,v,m,l,b]=s.gradientTransform;g.setTransform({a:h,b:f,c:v,d:m,e:l,f:b})}return g}}else if(s.type==="DiamondGradient"){const c=(h,f,v)=>Array.isArray(h)?h[f]??.5:h&&typeof h=="object"?h[v]??.5:.5,d=c(s.center||[.5,.5],0,"x")*o-o/2,p=c(s.center||[.5,.5],1,"y")*e-e/2,u=(s.radius??.5)*Math.max(o,e);t.save(),t.translate(d,p),t.rotate(Math.PI/4);const g=t.createRadialGradient(0,0,0,0,0,u);if(s.stops.forEach(h=>{const f=h.offset!==void 0?h.offset:h.pos!==void 0?h.pos:h.position!==void 0?h.position:0,v=r(h.color||"#000000",h.opacity??100);g.addColorStop(Math.max(0,Math.min(1,f)),v)}),s.gradientTransform&&g.setTransform){const[h,f,v,m,l,b]=s.gradientTransform;g.setTransform({a:h,b:f,c:v,d:m,e:l,f:b})}return t.scale(1/Math.SQRT2,1/Math.SQRT2),t.fillStyle=g,t.restore(),g}}if(s.type==="Pattern"&&s.url){let r=this.imageCache.get(s.url);if(r||(r=new Image,r.src=s.url,this.imageCache.set(s.url,r)),r.complete&&r.naturalWidth>0){const c=t.createPattern(r,"repeat");if(c&&(s.scaleX!==void 0||s.offsetX!==void 0)){const d=new DOMMatrix,p=s.scaleX??1,u=s.scaleY??1,g=s.offsetX??0,h=s.offsetY??0,f=s.rotation??0;d.translateSelf(g,h),d.rotateSelf(f),d.scaleSelf(p,u),c.setTransform(d)}return c}}return s.color||null}drawRoundRect(t,s,o,e,n,i){if(i===0||i===void 0||i===null){t.rect(s,o,e,n);return}let a=i;if(typeof a=="string")try{a=JSON.parse(a)}catch{a=parseFloat(a)||0}let r=0,c=0,d=0,p=0;typeof a=="number"?r=c=d=p=a:Array.isArray(a)?a.length===1?r=c=d=p=a[0]:a.length===2?(r=d=a[0],c=p=a[1]):a.length===3?(r=a[0],c=p=a[1],d=a[2]):a.length>=4&&(r=a[0],c=a[1],d=a[2],p=a[3]):a&&typeof a=="object"&&(r=a[0]??a.tl??a.corner_radius??a.cornerRadius??0,c=a[1]??a.tr??a.corner_radius??a.cornerRadius??0,d=a[2]??a.br??a.corner_radius??a.cornerRadius??0,p=a[3]??a.bl??a.corner_radius??a.cornerRadius??0);const u=Math.min(Math.abs(e)/2,Math.abs(n)/2);if(r=Math.min(Math.max(0,r),u),c=Math.min(Math.max(0,c),u),d=Math.min(Math.max(0,d),u),p=Math.min(Math.max(0,p),u),t.roundRect){t.roundRect(s,o,e,n,[r,c,d,p]);return}t.moveTo(s+r,o),t.lineTo(s+e-c,o),t.arcTo(s+e,o,s+e,o+c,c),t.lineTo(s+e,o+n-d),t.arcTo(s+e,o+n,s+e-d,o+n,d),t.lineTo(s+p,o+n),t.arcTo(s,o+n,s,o+n-p,p),t.lineTo(s,o+r),t.arcTo(s,o,s+r,o,r),t.closePath()}renderListView(t,s){var T,R,F,O,W,V,U,Y,X,ot;const o=this.objectStates.get(s.id)||{},e=o.options||s.options||{},n=o.width!==void 0?o.width:((T=s.geometry)==null?void 0:T.width)||200,i=o.height!==void 0?o.height:((R=s.geometry)==null?void 0:R.height)||300,a=-n/2,r=-i/2,c=e.cornerRadius!==void 0?e.cornerRadius:o.cornerRadius!==void 0?o.cornerRadius:o.corner_radius??e.corner_radius??((F=s.geometry)==null?void 0:F.cornerRadius)??((O=s.geometry)==null?void 0:O.corner_radius)??0,d=e.orientation||"vertical",p=this.getResolvedListViewItems(s,e),u=e.itemGap??10,g=e.itemHeight??50,h=e.itemWidth??200,f=e.scrollOffset??0,v=e.padding??0,m=e.glassEffect!==!1,l=e.accentColor||"#3b82f6",b=e.itemTextColor||"#333333",S=e.itemBackgroundColor||"#ffffff",w=e.hoveredIndex??null,C=e.activeItemIndex??null,M=e.glowIntensity??0,I=e.glowColor||"#3b82f6",_=typeof I=="string"?I:I.color||((V=(W=I.stops)==null?void 0:W[0])==null?void 0:V.color)||"#3b82f6",E=e.opacity!==void 0?e.opacity:s.opacity!==void 0?s.opacity:1;if(t.save(),t.globalAlpha*=E,M>0){const J=t.getTransform(),at=Math.sqrt(J.a*J.a+J.b*J.b)||1;t.shadowColor=_,t.shadowBlur=M*2*at,t.shadowOffsetX=0,t.shadowOffsetY=0}if(m){const J=e.listBackgroundColor||"rgba(31, 41, 55, 0.4)",at=this.createCanvasFill(t,J,n,i);t.fillStyle=at||"rgba(31, 41, 55, 0.4)",t.beginPath(),this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c)||t.fill();const it=t.createLinearGradient(a,r,a+n,r+i);it.addColorStop(0,"rgba(255, 255, 255, 0.15)"),it.addColorStop(.5,"rgba(255, 255, 255, 0.08)"),it.addColorStop(1,"rgba(255, 255, 255, 0.03)"),t.fillStyle=it,t.beginPath(),this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c)||t.fill();const D=e.borderWidth??0;if(D>0&&e.borderColor&&e.borderColor!=="transparent"){const ct=this.createCanvasFill(t,e.borderColor,n,i);t.strokeStyle=ct||"rgba(255, 255, 255, 0.25)",t.lineWidth=D}else t.strokeStyle="rgba(255, 255, 255, 0.25)",t.lineWidth=1;t.beginPath(),this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c)||t.stroke()}else{const J=e.backgroundColor&&e.backgroundColor!=="transparent"?e.backgroundColor:e.listBackgroundColor||"transparent",at=this.createCanvasFill(t,J,n,i);if(at){t.fillStyle=at,t.beginPath();const it=this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c);t.fill()}const j=e.borderWidth??0;if(j>0){const it=this.createCanvasFill(t,e.borderColor||"#cccccc",n,i);t.strokeStyle=it||"#cccccc",t.lineWidth=j,t.beginPath();const x=this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c);t.stroke()}}t.shadowBlur=0;const P=e.clipContent!==!1&&e.listLayout!=="circular";if(P)if(t.save(),t.beginPath(),this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c)&&e.containerShape==="custom")try{const at=new Path2D(e.containerPath);t.translate(a,r),t.scale(n/100,i/100),t.clip(at),t.scale(100/n,100/i),t.translate(-a,-r)}catch{}else t.clip();const L=typeof v=="number"?v:d==="vertical"?v[0]:v[3];let k=(d==="vertical"?r:a)+f+L;if(t.textBaseline="middle",p.forEach((J,at)=>{var ft,xt,At,Pt;const j=e.listLayout||"linear",it=j==="circular"?h:d==="vertical"?n:h,x=j==="circular"||d==="vertical"?g:i;let D=0,N=0,ct=0;if(j==="circular"){const vt=p.length||1,Xt=Math.PI*2/vt,zt=e.circularStartAngle||0,Gt=e.circularRadius||100,Yt=f*.01+zt*Math.PI/180,te=at*Xt+Yt,ie=a+n/2,ce=r+i/2;D=ie+Math.cos(te)*Gt-it/2,N=ce+Math.sin(te)*Gt-x/2,ct=te+(e.itemRotation||0)*Math.PI/180}else D=d==="vertical"?a:k,N=d==="vertical"?k:r,ct=(e.itemRotation||0)*Math.PI/180;const Mt=w===at,bt=C===at,wt=e.itemBorderWidth??0;t.save(),ct!==0&&(t.translate(D+it/2,N+x/2),t.rotate(ct),t.translate(-(D+it/2),-(N+x/2)));const gt=Mt?((ft=e.hoverStyle)==null?void 0:ft.scale)??1:bt?((xt=e.activeStyle)==null?void 0:xt.scale)??1:1;if(gt!==1&&(t.translate(D+it/2,N+x/2),t.scale(gt,gt),t.translate(-(D+it/2),-(N+x/2))),bt){const vt=((At=e.activeStyle)==null?void 0:At.itemBackgroundColor)||e.activeBackgroundColor||(m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.1)"),Xt=this.createCanvasFill(t,vt,it,x);t.fillStyle=Xt||(typeof vt=="string"?vt:"transparent"),t.beginPath(),this.drawCustomShape(t,e.activeItemShape||e.itemShape||"rectangle",e.activeItemShape==="custom"?e.activeItemPath||"":e.itemPath||"",D,N,it,x,e.itemCornerRadius??0)||t.fill()}else if(Mt){const vt=((Pt=e.hoverStyle)==null?void 0:Pt.itemBackgroundColor)||e.hoverBackgroundColor||(m?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)"),Xt=this.createCanvasFill(t,vt,it,x);t.fillStyle=Xt||(typeof vt=="string"?vt:"transparent"),t.beginPath(),this.drawCustomShape(t,e.itemShape||"rectangle",e.itemPath||"",D,N,it,x,e.itemCornerRadius??0)||t.fill()}else if(S!=="transparent"){const vt=this.createCanvasFill(t,S,it,x);t.fillStyle=vt||(typeof S=="string"?S:"transparent"),t.beginPath(),this.drawCustomShape(t,e.itemShape||"rectangle",e.itemPath||"",D,N,it,x,e.itemCornerRadius??0)||t.fill()}if(wt>0&&e.itemBorderColor&&e.itemBorderColor!=="transparent"){const vt=this.createCanvasFill(t,e.itemBorderColor,it,x);t.strokeStyle=vt||(typeof e.itemBorderColor=="string"?e.itemBorderColor:"#cccccc"),t.lineWidth=wt,t.beginPath(),this.drawCustomShape(t,e.itemShape||"rectangle",e.itemPath||"",D,N,it,x,e.itemCornerRadius??0)||t.stroke()}if(bt){const vt=this.createCanvasFill(t,l,d==="vertical"?3:it,d==="vertical"?x:3);t.fillStyle=vt||l,d==="vertical"?t.fillRect(D,N,3,x):t.fillRect(D,N+x-3,it,3)}const It=bt?"#ffffff":m?"rgba(255, 255, 255, 0.9)":b;t.fillStyle=It,t.font=bt||Mt?"600 14px Inter, sans-serif":"400 14px Inter, sans-serif";const ut=typeof J=="string"?J:(J==null?void 0:J.label)||`Item ${at+1}`,Ot=D+(d==="vertical"?16:it/2),Wt=N+x/2;d==="horizontal"||j==="circular"?t.textAlign="center":t.textAlign="left";const q=j==="circular"?D+it/2:Ot;t.fillText(ut,q,Wt),t.restore(),t.beginPath(),k+=(d==="vertical"?g:h)+u}),P&&t.restore(),e.showScrollbar!==!1){const J=typeof v=="number"?v:d==="vertical"?v[0]:v[3],j=(p.length||0)*(d==="vertical"?g:h)+Math.max(0,(p.length||0)-1)*u+J*2,it=d==="vertical"?i:n,x=e.listLayout||"linear",D=e.containerShape==="circle"||x==="circular",N=e.scrollbarColor||"rgba(255,255,255,0.3)";let ct=typeof N=="object"?N.color||((Y=(U=N.stops)==null?void 0:U[0])==null?void 0:Y.color)||"rgba(255,255,255,0.3)":N;const Mt=((ot=(X=this.artboard)==null?void 0:X.tokens)==null?void 0:ot.colors)||{};Mt[ct]&&(ct=Mt[ct]);const bt=e.scrollbarWidth||2;if(t.save(),D){const wt=Math.min(n,i)/2-bt/2-2,gt=a+n/2,It=r+i/2;if(t.strokeStyle=ct,t.lineWidth=bt,t.lineCap="round",t.beginPath(),x==="circular"){const ut=Math.PI/4,Ot=-(f*.01)-Math.PI/2;t.arc(gt,It,wt,Ot,Ot+ut)}else{const ut=Math.PI/2,Ot=j>0?Math.min(1,it/j):1,Wt=ut*Ot,q=j>0?-f/j*ut:0,xt=-Math.PI/4+q;t.arc(gt,It,wt,xt,xt+Wt)}t.stroke()}else{let wt=it,gt=0;if(j>it){const It=it/j;wt=Math.max(16,it*It);const ut=it-wt,Ot=j-it;gt=Ot>0?Math.max(0,Math.min(ut,-f/Ot*ut)):0}if(t.fillStyle=ct,d==="vertical"){const It=a+n-bt-2,ut=r+gt,Ot=bt,Wt=wt;if(bt>2){t.beginPath();const q=Math.min(bt/2,wt/2);if(t.roundRect)try{t.roundRect(It,ut,Ot,Wt,q),t.fill()}catch{t.fillRect(It,ut,Ot,Wt)}else t.fillRect(It,ut,Ot,Wt)}else t.fillRect(It,ut,Ot,Wt)}else{const It=a+gt,ut=r+i-bt-2,Ot=wt,Wt=bt;if(bt>2){t.beginPath();const q=Math.min(bt/2,wt/2);if(t.roundRect)try{t.roundRect(It,ut,Ot,Wt,q),t.fill()}catch{t.fillRect(It,ut,Ot,Wt)}else t.fillRect(It,ut,Ot,Wt)}else t.fillRect(It,ut,Ot,Wt)}}t.restore()}t.beginPath(),t.restore()}drawCustomShape(t,s,o,e,n,i,a,r){if(s==="circle"){const c=Math.min(i,a)/2;return t.arc(e+i/2,n+a/2,c,0,Math.PI*2),!1}else if(s==="pill"){const c=Math.min(i,a)/2;return this.drawListViewRect(t,e,n,i,a,c),!1}else if(s==="custom"&&o)try{const c=new Path2D(o);return t.save(),t.translate(e,n),t.scale(i/100,a/100),t.fill(c),t.restore(),!0}catch{return this.drawListViewRect(t,e,n,i,a,r),!1}return this.drawListViewRect(t,e,n,i,a,r),!1}updateListViewScrollFromPointer(t){var S,w,C,M;if(!this._lastPointerPos||!this._prevPointerPos)return;const s=this.objectStates.get(t.id);s&&!s.options&&(s.options=JSON.parse(JSON.stringify(t.options||{})));const o=(s==null?void 0:s.options)||t.options||{},e=o.orientation||"vertical",n=this._lastPointerPos.x-this._prevPointerPos.x,i=this._lastPointerPos.y-this._prevPointerPos.y;let a=o.scrollOffset||0;const r=this.getResolvedListViewItems(t,o),c=o.itemGap??10,d=o.itemHeight??50,p=o.itemWidth??200,u=(s==null?void 0:s.width)!==void 0?s.width:((S=t.geometry)==null?void 0:S.width)||200,g=(s==null?void 0:s.height)!==void 0?s.height:((w=t.geometry)==null?void 0:w.height)||300,h=typeof o.padding=="number"?o.padding:e==="vertical"?((C=o.padding)==null?void 0:C[0])||0:((M=o.padding)==null?void 0:M[3])||0,v=(r.length||0)*(e==="vertical"?d:p)+Math.max(0,(r.length||0)-1)*c+h*2,m=e==="vertical"?g:u,l=Math.max(0,v-m);if(this.draggingListViewIsScrollbar&&o.listLayout!=="circular"){const I=v>0?m/v:1,_=Math.max(16,m*I),E=Math.max(1,m-_),P=l>0?l/E:1;e==="vertical"?a-=i*P:a-=n*P}else e==="vertical"?a+=i:a+=n;if((o.listLayout||"linear")==="circular"){o.scrollOffset=a,s&&s.options&&(s.options.scrollOffset=a),t.options&&(t.options.scrollOffset=a);return}a>0&&(a=0),a<-l&&(a=-l),o.scrollOffset=a,s&&s.options&&(s.options.scrollOffset=a),t.options&&(t.options.scrollOffset=a)}updateListViewHoverFromPointer(t,s,o){const e=this.getListViewItemIndexAtPointer(t,s,o),n=this.objectStates.get(t.id);if(n&&n.options)n.options.hoveredIndex!==e&&(n.options.hoveredIndex=e);else{const i=t.options||{};i.hoveredIndex!==e&&(i.hoveredIndex=e)}}getListViewItemIndexAtPointer(t,s,o){var F,O;const e=this.objectStates.get(t.id),n=(e==null?void 0:e.options)||t.options||{},i=this.getResolvedListViewItems(t,n);if(i.length===0)return null;const a=(e==null?void 0:e.width)!==void 0?e.width:((F=t.geometry)==null?void 0:F.width)||200,r=(e==null?void 0:e.height)!==void 0?e.height:((O=t.geometry)==null?void 0:O.height)||300,c=n.orientation||"vertical",d=n.itemGap??10,p=n.itemHeight??50,u=n.itemWidth??200,g=n.scrollOffset??0,h=n.padding??0,f=this.getWorldTransform(t.id),v=s-f.x,m=o-f.y,l=-f.rotation*(Math.PI/180),b=Math.cos(l),S=Math.sin(l),w=v*b-m*S,C=v*S+m*b,M=-a/2,I=-r/2,_=typeof h=="number"?h:c==="vertical"?h[0]:h[3];let E=(c==="vertical"?I:M)+g+_;const P=n.listLayout||"linear",L=i.length||1,k=Math.PI*2/L,A=n.circularStartAngle||0,T=n.circularRadius||100,R=g*.01+A*Math.PI/180;for(let W=0;W<i.length;W++){const V=P==="circular"?u:c==="vertical"?a:u,U=P==="circular"||c==="vertical"?p:r;let Y=0,X=0,ot=0;if(P==="circular"){const J=W*k+R,at=M+a/2,j=I+r/2;Y=at+Math.cos(J)*T-V/2,X=j+Math.sin(J)*T-U/2,ot=J+(n.itemRotation||0)*Math.PI/180}else Y=c==="vertical"?M:E,X=c==="vertical"?E:I,ot=(n.itemRotation||0)*Math.PI/180;if(ot!==0){const J=Y+V/2,at=X+U/2,j=w-J,it=C-at,x=-ot,D=j*Math.cos(x)-it*Math.sin(x)+J,N=j*Math.sin(x)+it*Math.cos(x)+at;if(D>=Y&&D<=Y+V&&N>=X&&N<=X+U)return W}else if(w>=Y&&w<=Y+V&&C>=X&&C<=X+U)return W;E+=(c==="vertical"?p:u)+d}return null}drawListViewRect(t,s,o,e,n,i){this.drawRoundRect(t,s,o,e,n,i)}solveBehaviors(t){if(!this.artboard)return;if(!this._lastPointerPos){this.frameCount%60;return}const{x:s,y:o}=this._lastPointerPos;this.artboard.objects.forEach(e=>{if(!e.behaviors||e.behaviors.length===0)return;const n=this.objectStates.get(e.id);n&&e.behaviors.forEach(i=>{var u,g,h,f,v,m,l,b,S,w,C,M,I,_,E,P,L,k,A,T,R,F,O,W,V,U,Y,X,ot,J,at,j,it,x,D,N,ct,Mt,bt,wt,gt,It,ut,Ot,Wt,q,ft,xt,At,Pt,vt,Xt,zt,Gt,Yt,te,ie,ce,ve,_e,ge,Ee,Zt,Me,Re,Ie,de,me,Ae,he,mt,rt,z,K,G,B,Q,H,lt,kt,Et,Ht,Ut,qt,$,dt,Lt,Nt,st,yt,St,ee,Ct,Vt,Tt,Dt,Rt,le,fe,Oe,jt,oe,ne,Fe,xe,Be,We,Ye,Xe,Ge,se,ue,Se,De,Ne,ke,Ce,we;if(!i.enabled)return;const a=i.startTime||0,r=i.endTime||1/0;if(this.currentTime<a||this.currentTime>r)return;const c=n.x-s,d=n.y-o,p=Math.sqrt(c*c+d*d);if(this.frameCount%240===0&&Math.random()<.1&&this.log(`[ExodeUI] Executing ${i.type} on ${e.name}`),i.type===tt.Proximity){const Z=((u=i.settings)==null?void 0:u.radius)||300,nt=((g=i.settings)==null?void 0:g.falloff)||"smooth";let et=0;p<Z&&(nt==="linear"?et=1-p/Z:et=Math.pow(1-p/Z,2)),i.sensors.forEach(pt=>{this.applyBehaviorSensor(n,pt,et,t,i.settings,e,c,d,p)})}else if(i.type===tt.Magnetic){const Z=((h=i.settings)==null?void 0:h.radius)||400,nt=((f=i.settings)==null?void 0:f.strength)||.5;if(p<Z&&p>5){const et=1-p/Z,pt=c*et*nt,Ft=d*et*nt;n.x-=pt*t*10,n.y-=Ft*t*10}}else if(i.type===tt.Repel){const Z=((v=i.settings)==null?void 0:v.radius)||300,nt=((m=i.settings)==null?void 0:m.strength)||1;if(p<Z){const et=Math.pow(1-p/Z,2);n.x+=c/(p||1)*et*60*nt*t*5,n.y+=d/(p||1)*et*60*nt*t*5}}else if(i.type===tt.Orbit){const Z=((l=i.settings)==null?void 0:l.speed)||1,nt=((b=i.settings)==null?void 0:b.radius)||30,et=this.currentTime*Z*Math.PI*2;n.x+=Math.cos(et)*nt*t*5,n.y+=Math.sin(et)*nt*t*5,n.rotation+=2*t*5}else if(i.type===tt.Vortex){const Z=((S=i.settings)==null?void 0:S.radius)||400,nt=((w=i.settings)==null?void 0:w.speed)||2,et=((C=i.settings)==null?void 0:C.strength)||1;if(p<Z){const pt=Math.pow(1-p/Z,1.5),Ft=this.currentTime*nt*Math.PI*2,Bt=Math.cos(Ft)*30-c*.4,Jt=Math.sin(Ft)*30-d*.4;n.x+=Bt*pt*et*t*5,n.y+=Jt*pt*et*t*5,n.rotation+=5*pt*et*t*5,n.scale_x*=1-pt*.1*et*t,n.scale_y*=1-pt*.1*et*t}}else if(i.type===tt.Fluid){const Z=((M=i.settings)==null?void 0:M.radius)||300,nt=((I=i.settings)==null?void 0:I.strength)||1;if(p<Z){const et=Math.pow(1-p/Z,1.2),pt=c/(p||1)*et*1.2*nt,Ft=d/(p||1)*et*1.2*nt;n.x+=pt*10*t*5,n.y+=Ft*10*t*5,n.scale_x*=1+et*.3*nt*t,n.scale_y*=1+et*.3*nt*t}}else if(i.type===tt.Elastic){const Z=((_=i.settings)==null?void 0:_.radius)||300,nt=((E=i.settings)==null?void 0:E.strength)||1;if(p<Z){const et=1-p/Z;n.scale_x*=1+et*.4*nt*t,n.scale_y*=1+et*.4*nt*t}}else if(i.type===tt.Holographic){const Z=n.x-this.canvasWidth/2,nt=n.y-this.canvasHeight/2,et=((P=i.settings)==null?void 0:P.factor)||25;if(n.x-=Z/1e3*et*t*5,n.y-=nt/1e3*et*t*5,n.style){const pt=1-Math.min(1,p/400);n.style.exposure=(n.style.exposure||1)+pt*.5*t}}else if(i.type===tt.Sticky){const Z=((L=i.settings)==null?void 0:L.radius)||80,nt=((k=i.settings)==null?void 0:k.strength)||1;if(p<Z){const et=Math.pow(1-p/Z,2);n.x-=c*et*nt*t*10,n.y-=d*et*nt*t*10,n.scale_x*=1-et*.1*nt*t,n.scale_y*=1-et*.1*nt*t}}else if(i.type===tt.Dilation){const Z=((A=i.settings)==null?void 0:A.size)||120,nt=((T=i.settings)==null?void 0:T.strength)||1;if(p<Z){const et=1-p/Z;n.scale_x*=1+et*.5*nt*t,n.scale_y*=1+et*.5*nt*t}}else if(i.type===tt.Parallax){const Z=((R=i.settings)==null?void 0:R.factor)||15,nt=((F=i.settings)==null?void 0:F.strength)||1,et=this.canvasWidth/2,pt=this.canvasHeight/2,Ft=this._lastPointerPos||{x:et,y:pt},Bt=(Ft.x-et)/et,Jt=(Ft.y-pt)/pt,pe=(((O=e.transform)==null?void 0:O.x)??0)+Bt*Z*nt,Te=(((W=e.transform)==null?void 0:W.y)??0)+Jt*Z*nt,$e=(((V=e.transform)==null?void 0:V.rotate_x)??0)-Jt*Z*1.5*nt,ye=(((U=e.transform)==null?void 0:U.rotate_y)??0)+Bt*Z*1.5*nt,Le=Math.min(1,10*t);n.x=this.lerp(n.x??((Y=e.transform)==null?void 0:Y.x)??0,pe,Le),n.y=this.lerp(n.y??((X=e.transform)==null?void 0:X.y)??0,Te,Le),n.rotate_x=this.lerp(n.rotate_x??((ot=e.transform)==null?void 0:ot.rotate_x)??0,$e,Le),n.rotate_y=this.lerp(n.rotate_y??((J=e.transform)==null?void 0:J.rotate_y)??0,ye,Le)}else if(i.type===tt.Fold){if(p<300){const Z=1-p/300,nt=(c>0?-1:1)*Z*10,et=1-Z*.1,pt=d/300*Z*20,Ft=-(c/300)*Z*20,Bt=Math.min(1,10*t);n.skew_x=this.lerp(n.skew_x??((at=e.transform)==null?void 0:at.skew_x)??0,nt,Bt),n.scale_y=this.lerp(n.scale_y??((j=e.transform)==null?void 0:j.scale_y)??1,(((it=e.transform)==null?void 0:it.scale_y)??1)*et,Bt),n.rotate_x=this.lerp(n.rotate_x??((x=e.transform)==null?void 0:x.rotate_x)??0,pt,Bt),n.rotate_y=this.lerp(n.rotate_y??((D=e.transform)==null?void 0:D.rotate_y)??0,Ft,Bt),n.style=n.style||{...e.style},n.style.artEffect={enabled:!0,type:"fold_overlay",intensity:((N=i.settings)==null?void 0:N.opacity)??.5}}}else if(i.type===tt.Crumple){if(p<300){const Z=1-p/300,nt=Z*(Math.random()-.5)*5,et=Z*(Math.random()-.5)*.05,pt=Math.min(1,15*t);n.skew_x=this.lerp(n.skew_x??((ct=e.transform)==null?void 0:ct.skew_x)??0,nt,pt),n.scale_x=this.lerp(n.scale_x??((Mt=e.transform)==null?void 0:Mt.scale_x)??1,(((bt=e.transform)==null?void 0:bt.scale_x)??1)*(1+et),pt),n.scale_y=this.lerp(n.scale_y??((wt=e.transform)==null?void 0:wt.scale_y)??1,(((gt=e.transform)==null?void 0:gt.scale_y)??1)*(1+et),pt),n.style=n.style||{...e.style},n.style.artEffect={enabled:!0,type:"crumple_overlay",intensity:((It=i.settings)==null?void 0:It.intensity)??1,scale:((ut=i.settings)==null?void 0:ut.scale)??2}}}else if(i.type===tt.Squash){const Z=((Ot=i.settings)==null?void 0:Ot.strength)||.8;p<(e.width||100)&&this.isMouseDown?(n.scale_y=this.lerp(n.scale_y??1,(((Wt=e.transform)==null?void 0:Wt.scale_y)??1)*Z,.3),n.scale_x=this.lerp(n.scale_x??1,(((q=e.transform)==null?void 0:q.scale_x)??1)*(1+(1-Z)*.4),.3)):(n.scale_y=this.lerp(n.scale_y??1,((ft=e.transform)==null?void 0:ft.scale_y)??1,.2),n.scale_x=this.lerp(n.scale_x??1,((xt=e.transform)==null?void 0:xt.scale_x)??1,.2))}else if(i.type===tt.TextCounter){const Z=((At=i.settings)==null?void 0:At.duration)||2,nt=((Pt=i.settings)==null?void 0:Pt.from)||0,et=((vt=i.settings)==null?void 0:vt.to)||100;i._runtimeStart===void 0&&(i._runtimeStart=this.currentTime);const pt=this.currentTime-i._runtimeStart,Ft=Math.min(1,pt/Z),Bt=Math.floor(nt+(et-nt)*Ft);if(((Xt=e.geometry)==null?void 0:Xt.type)==="Text"){const Jt=((zt=i.settings)==null?void 0:zt.prefix)||"",pe=((Gt=i.settings)==null?void 0:Gt.suffix)||"";n.geometry||(n.geometry={...e.geometry}),n.geometry.text=`${Jt}${Bt}${pe}`}}else if(i.type===tt.Spotlight){const Z=((Yt=i.settings)==null?void 0:Yt.radius)||250,nt=((te=i.settings)==null?void 0:te.strength)||1.5;if(p<Z){const et=Math.pow(1-p/Z,2);n.style||(n.style={...e.style}),n.style.adjustments||(n.style.adjustments={...(ie=e.style)==null?void 0:ie.adjustments}),n.style.adjustments.exposure=(((ve=(ce=e.style)==null?void 0:ce.adjustments)==null?void 0:ve.exposure)||0)+et*nt*50}else(_e=n.style)!=null&&_e.adjustments&&(n.style.adjustments.exposure=this.lerp(n.style.adjustments.exposure||0,((Ee=(ge=e.style)==null?void 0:ge.adjustments)==null?void 0:Ee.exposure)||0,.1))}else if(i.type===tt.Noise||i.type===tt.Float){const Z=(((Zt=i.settings)==null?void 0:Zt.frequency)||((Me=i.settings)==null?void 0:Me.speed)||1)*.002,nt=(((Re=i.settings)==null?void 0:Re.amplitude)||((Ie=i.settings)==null?void 0:Ie.range)||50)*(((de=i.settings)==null?void 0:de.strength)||1),et=Date.now();n.x+=Math.sin(et*Z)*nt*t,n.y+=Math.cos(et*Z*.8)*nt*t,n.rotation+=Math.sin(et*Z*.5)*5*t}else if(i.type===tt.Pulse){const Z=(((me=i.settings)==null?void 0:me.speed)||1)*.005,nt=(((Ae=i.settings)==null?void 0:Ae.scale)||1.2)-1,et=Math.sin(Date.now()*Z),pt=((he=i.settings)==null?void 0:he.strength)||1;n.scale_x*=1+et*nt*pt*t,n.scale_y*=1+et*nt*pt*t,n.style&&(n.style.exposure=(n.style.exposure||1)+Math.max(0,et)*.1*pt*t)}else if(i.type===tt.Draggable){if(!this.draggingBehaviors.has(e.id)){const nt=((mt=i.settings)==null?void 0:mt.radius)||150;if(p<nt){const et=((rt=i.settings)==null?void 0:rt.strength)||1,pt=Math.max(0,1-p/nt);this.applyBehaviorSensor(n,re.PositionX,pt*et,t,i.settings,e,c,d,p),this.applyBehaviorSensor(n,re.PositionY,pt*et,t,i.settings,e,c,d,p)}}}else if(i.type===tt.Scroll){const Z=((z=i.settings)==null?void 0:z.axis)||"vertical",nt=((K=i.settings)==null?void 0:K.factor)||.5,et=((G=i.settings)==null?void 0:G.strength)||1,pt=((B=i.settings)==null?void 0:B.scaleFactor)||0;(Z==="vertical"||Z==="both")&&(n.y+=this.scrollOffset.y*nt*et*t),(Z==="horizontal"||Z==="both")&&(n.x+=this.scrollOffset.x*nt*et*t),pt!==0&&(n.scale_x*=1+this.scrollOffset.y*pt*t,n.scale_y*=1+this.scrollOffset.y*pt*t)}else if(i.type===tt.LookAt){const Z=((Q=i.settings)==null?void 0:Q.factor)||1,nt=((H=i.settings)==null?void 0:H.strength)||1,et=Math.atan2(-d,-c)*(180/Math.PI),pt=n.rotation,Ft=(et-pt+180)%360-180;n.rotation+=Ft*Z*nt*t*10}else if(i.type===tt.Scan){const Z=(((lt=i.settings)==null?void 0:lt.speed)||1)*.004,nt=((kt=i.settings)==null?void 0:kt.strength)||1,et=(Math.sin(Date.now()*Z)+1)/2;n.style&&(n.style.exposure=(n.style.exposure||1)+et*nt*t*5),n.x+=(et-.5)*20*nt*t}else if(i.type===tt.Glint)n.style=n.style||{...e.style},n.style.artEffect={enabled:!0,type:"glint_overlay",intensity:((Et=i.settings)==null?void 0:Et.strength)??.8};else if(i.type===tt.Ratchet){const Z=((Ht=i.settings)==null?void 0:Ht.steps)||12,nt=(((Ut=i.settings)==null?void 0:Ut.speed)||1)*30,et=Math.floor(n.rotation/(360/Z))*(360/Z);n.rotation=this.lerp(n.rotation,et+nt*t,.1)}else if(i.type===tt.Jitter&&p<300){const Z=((qt=i.settings)==null?void 0:qt.strength)||1,nt=((($=i.settings)==null?void 0:$.intensity)||5)*Z;n.x+=(Math.random()-.5)*nt*t*60,n.y+=(Math.random()-.5)*nt*t*60,n.rotation+=(Math.random()-.5)*nt*t*120}else if(i.type===tt.Follower){const Z=(dt=i.settings)==null?void 0:dt.targetId;if(Z){const nt=this.objectStates.get(Z);if(nt){const et=((Lt=i.settings)==null?void 0:Lt.stiffness)||.1,pt=nt.x-n.x,Ft=nt.y-n.y;n.x+=pt*et*t*60,n.y+=Ft*et*t*60}}}else if(i.type===tt.Wrap)n.x<0?n.x=this.canvasWidth:n.x>this.canvasWidth&&(n.x=0),n.y<0?n.y=this.canvasHeight:n.y>this.canvasHeight&&(n.y=0);else if(i.type===tt.Gravity){const Z=((Nt=i.settings)==null?void 0:Nt.strength)||9.8;n.y+=Z*t*10}else if(i.type===tt.Velocity){const Z=((st=i.settings)==null?void 0:st.vx)||0,nt=((yt=i.settings)==null?void 0:yt.vy)||0;n.x+=Z*t*10,n.y+=nt*t*10}else if(i.type===tt.Shear){const Z=((St=i.settings)==null?void 0:St.strength)||1,nt=((ee=i.settings)==null?void 0:ee.radius)||300;if(p<nt){const et=1-p/nt;n.skew_x=this.lerp(n.skew_x||0,(((Ct=e.transform)==null?void 0:Ct.skew_x)||0)+et*Z*30,.1)}else n.skew_x=this.lerp(n.skew_x||0,((Vt=e.transform)==null?void 0:Vt.skew_x)||0,.05)}else if(i.type===tt.Lens){const Z=((Tt=i.settings)==null?void 0:Tt.radius)||200,nt=((Dt=i.settings)==null?void 0:Dt.strength)||.5;if(p<Z){const et=Math.pow(1-p/Z,2);n.scale_x=this.lerp(n.scale_x??1,(((Rt=e.transform)==null?void 0:Rt.scale_x)??1)*(1+et*nt),.2),n.scale_y=this.lerp(n.scale_y??1,(((le=e.transform)==null?void 0:le.scale_y)??1)*(1+et*nt),.2)}else n.scale_x=this.lerp(n.scale_x??1,((fe=e.transform)==null?void 0:fe.scale_x)??1,.1),n.scale_y=this.lerp(n.scale_y??1,((Oe=e.transform)==null?void 0:Oe.scale_y)??1,.1)}else if(i.type===tt.LayoutAnimation){const Z=((jt=i.settings)==null?void 0:jt.watchProperties)||["x","y","scale_x","scale_y","opacity","rotation"],nt=((oe=i.settings)==null?void 0:oe.duration)||.3;this._layoutAnimCache.has(e.id)||this._layoutAnimCache.set(e.id,new Map);const et=this._layoutAnimCache.get(e.id);for(const pt of Z){const Ft=this.getObjectProperty(n,e,pt);if(Ft===void 0)continue;const Bt=et.get(pt);if(!Bt)et.set(pt,{from:Ft,to:Ft,startTime:this.currentTime,duration:0});else if(Bt.to!==Ft){const pe=this.getObjectProperty(n,e,pt);et.set(pt,{from:pe??Bt.from,to:Ft,startTime:this.currentTime,duration:((ne=i.settings)==null?void 0:ne.duration)??nt})}const Jt=et.get(pt);if(Jt.duration>0&&Jt.from!==Jt.to){const pe=this.currentTime-Jt.startTime,Te=Math.min(1,pe/Jt.duration),$e=this.applyEasing(Te,((Fe=i.settings)==null?void 0:Fe.easing)||"easeOutCubic"),ye=Jt.from+(Jt.to-Jt.from)*$e;this.setObjectProperty(n,e,pt,ye)}}}else if(i.type===tt.StateReactive){this._layoutAnimCache.has(e.id)||this._layoutAnimCache.set(e.id,new Map);const Z=this._layoutAnimCache.get(e.id),nt=((xe=i.settings)==null?void 0:xe.defaultDuration)||.3,et=["x","y","scale_x","scale_y","opacity","rotation","style.fill.color","style.stroke.width","geometry.cornerRadius","style.blur.value","style.shadow.blur","style.shadow.offsetX","style.shadow.offsetY"];for(const pt of et){const Ft=this.getObjectProperty(n,e,pt);if(Ft===void 0||typeof Ft!="number")continue;const Bt=Z.get(pt);if(!Bt)Z.set(pt,{from:Ft,to:Ft,startTime:this.currentTime,duration:0});else if(Bt.to!==Ft){const pe=this.getObjectProperty(n,e,pt);Z.set(pt,{from:pe??Bt.from,to:Ft,startTime:this.currentTime,duration:nt})}const Jt=Z.get(pt);if(Jt.duration>0&&Jt.from!==Jt.to){const pe=this.currentTime-Jt.startTime,Te=Math.min(1,pe/Jt.duration),$e=this.applyEasing(Te,((Be=i.settings)==null?void 0:Be.defaultEasing)||"easeOutCubic"),ye=Jt.from+(Jt.to-Jt.from)*$e;this.setObjectProperty(n,e,pt,ye)}}}else if(i.type===tt.SpringChain){const Z=((We=i.settings)==null?void 0:We.connections)||[],nt=((Ye=i.settings)==null?void 0:Ye.globalDamping)||.3;this._springChainState.has(e.id)||this._springChainState.set(e.id,new Map);const et=this._springChainState.get(e.id);for(const Ft of Z){if(!et.has(Ft.targetId)){const Bt=this.objectStates.get(Ft.targetId);et.set(Ft.targetId,{x:(Bt==null?void 0:Bt.x)??0,y:(Bt==null?void 0:Bt.y)??0,vx:0,vy:0})}et.has(e.id)||et.set(e.id,{x:n.x,y:n.y,vx:0,vy:0})}const pt=et.get(e.id);if(pt){pt.x=n.x,pt.y=n.y;for(const Ft of Z){const Bt=et.get(Ft.targetId);if(!Bt)continue;const Jt=Bt.x-pt.x,pe=Bt.y-pt.y,Te=Math.sqrt(Jt*Jt+pe*pe)||.001,ye=(Te-(Ft.restLength||50))*(Ft.stiffness||.8),Le=Jt/Te*ye,Qe=pe/Te*ye;pt.vx+=Le*t*10,pt.vy+=Qe*t*10,Bt.vx-=Le*t*10,Bt.vy-=Qe*t*10,pt.vx*=1-nt*t*10,pt.vy*=1-nt*t*10,Bt.vx*=1-nt*t*10,Bt.vy*=1-nt*t*10;const Pe=this.objectStates.get(Ft.targetId);Pe&&(Pe.x+=Bt.vx*t,Pe.y+=Bt.vy*t)}n.x+=pt.vx*t,n.y+=pt.vy*t}}else if(i.type===tt.ParticleEmitter){const Z=((Xe=i.settings)==null?void 0:Xe.rate)||10,nt=((Ge=i.settings)==null?void 0:Ge.speed)||100,et=((se=i.settings)==null?void 0:se.size)||5,pt=((ue=i.settings)==null?void 0:ue.lifetime)||2,Ft=((Se=i.settings)==null?void 0:Se.gravity)||0,Bt=((De=i.settings)==null?void 0:De.color)||"#ffffff",Jt=((Ne=i.settings)==null?void 0:Ne.maxParticles)||200,pe=(ke=i.settings)!=null&&ke.rateInputId?this.inputs.get(i.settings.rateInputId)??Z:Z,Te=(Ce=i.settings)!=null&&Ce.gravityInputId?this.inputs.get(i.settings.gravityInputId)??Ft:Ft,$e=(we=i.settings)!=null&&we.speedInputId?this.inputs.get(i.settings.speedInputId)??nt:nt;this._emitterPools.has(e.id)||this._emitterPools.set(e.id,[]);const ye=this._emitterPools.get(e.id);let Le=0;i._pendingBurst&&i._pendingBurst>0&&(Le=i._pendingBurst,i._pendingBurst=0);const Qe=Math.floor(pe*t)+(Le||0);for(let Pe=0;Pe<Math.min(Qe,Jt-ye.length);Pe++){const be=Math.random()*Math.PI*2,ms=$e*(.5+Math.random()*.5);ye.push({x:n.x,y:n.y,vx:Math.cos(be)*ms,vy:Math.sin(be)*ms,life:0,maxLife:pt*(.5+Math.random()*.5),size:et*(.5+Math.random()),color:Bt,opacity:1})}for(let Pe=ye.length-1;Pe>=0;Pe--){const be=ye[Pe];be.vy+=Te*t*10,be.x+=be.vx*t,be.y+=be.vy*t,be.life+=t,be.opacity=Math.max(0,1-be.life/be.maxLife),be.life>=be.maxLife&&ye.splice(Pe,1)}}})})}applyBehaviorSensor(t,s,o,e,n,i,a=0,r=0,c=1){var h,f,v,m,l,b,S,w,C,M,I,_,E,P,L,k,A,T,R,F,O,W,V,U;const d=(n==null?void 0:n.intensity)||(n==null?void 0:n.strength)||1,p=Math.min(1,15*e),u=c>0?a/c:0,g=c>0?r/c:0;switch(s){case re.Scale:{const Y=((h=i==null?void 0:i.transform)==null?void 0:h.scale_x)??1,X=((f=i==null?void 0:i.transform)==null?void 0:f.scale_y)??1,ot=Y*(1+o*d*.4),J=X*(1+o*d*.4);t.scale_x=(t.scale_x??Y)*(1-p)+ot*p,t.scale_y=(t.scale_y??X)*(1-p)+J*p;break}case re.Opacity:{const Y=((v=i==null?void 0:i.transform)==null?void 0:v.opacity)??100,X=Math.max(0,Math.min(100,Y-o*d*100));t.opacity=(t.opacity??Y)*(1-p)+X*p;break}case re.RotateZ:{const Y=((m=i==null?void 0:i.transform)==null?void 0:m.rotation)??0,X=Y+o*d*45;t.rotation=(t.rotation??Y)*(1-p)+X*p;break}case re.RotateX:{const Y=((l=i==null?void 0:i.transform)==null?void 0:l.rotate_x)??0,X=Y-g*o*d*60;t.rotate_x=(t.rotate_x??Y)*(1-p)+X*p;break}case re.RotateY:{const Y=((b=i==null?void 0:i.transform)==null?void 0:b.rotate_y)??0,X=Y+u*o*d*60;t.rotate_y=(t.rotate_y??Y)*(1-p)+X*p;break}case re.PositionX:{const Y=((S=i==null?void 0:i.transform)==null?void 0:S.x)??0,X=Y-u*o*d*40;t.x=(t.x??Y)*(1-p)+X*p;break}case re.PositionY:{const Y=((w=i==null?void 0:i.transform)==null?void 0:w.y)??0,X=Y-g*o*d*40;t.y=(t.y??Y)*(1-p)+X*p;break}case re.SkewX:{const Y=((C=i==null?void 0:i.transform)==null?void 0:C.skew_x)??0,X=Y+u*o*d*45;t.skew_x=(t.skew_x??Y)*(1-p)+X*p,t.skew_x>85&&(t.skew_x=85),t.skew_x<-85&&(t.skew_x=-85);break}case re.Blur:{t.style||(t.style={...i==null?void 0:i.style}),t.style.blur||(t.style.blur={...(M=i==null?void 0:i.style)==null?void 0:M.blur});const Y=((_=(I=i==null?void 0:i.style)==null?void 0:I.blur)==null?void 0:_.amount)||0,X=Y+o*((n==null?void 0:n.blur)||20)*d;t.style.blur.amount=(t.style.blur.amount??Y)*(1-p)+X*p;break}case re.Exposure:{t.style||(t.style={...i==null?void 0:i.style}),t.style.adjustments||(t.style.adjustments={...(E=i==null?void 0:i.style)==null?void 0:E.adjustments});const Y=((L=(P=i==null?void 0:i.style)==null?void 0:P.adjustments)==null?void 0:L.exposure)||0,X=Y+o*((n==null?void 0:n.exposure)||50)*d;t.style.adjustments.exposure=(t.style.adjustments.exposure??Y)*(1-p)+X*p;break}case re.HueShift:{t.style||(t.style={...i==null?void 0:i.style}),t.style.adjustments||(t.style.adjustments={...(k=i==null?void 0:i.style)==null?void 0:k.adjustments});const Y=((T=(A=i==null?void 0:i.style)==null?void 0:A.adjustments)==null?void 0:T.hue)||0,X=Y+o*((n==null?void 0:n.hue)||180)*d;t.style.adjustments.hue=(t.style.adjustments.hue??Y)*(1-p)+X*p;break}case re.Negative:{t.style||(t.style={...i==null?void 0:i.style}),t.style.adjustments||(t.style.adjustments={...(R=i==null?void 0:i.style)==null?void 0:R.adjustments});const Y=((O=(F=i==null?void 0:i.style)==null?void 0:F.adjustments)==null?void 0:O.negative)||0,X=Y+o*((n==null?void 0:n.negative)||100)*d;t.style.adjustments.negative=(t.style.adjustments.negative??Y)*(1-p)+X*p;break}case re.CornerRadius:{const Y=((W=i==null?void 0:i.transform)==null?void 0:W.corner_radius)||0,X=Y+o*d*50;t.corner_radius=(t.corner_radius??Y)*(1-p)+X*p;break}case re.StrokeWidth:{t.style||(t.style={...i==null?void 0:i.style});const Y=((V=i==null?void 0:i.style)==null?void 0:V.borderWidth)||0,X=Y+o*d*10;t.style.borderWidth=(t.style.borderWidth??Y)*(1-p)+X*p;break}case re.LetterSpacing:{t.geometry||(t.geometry={});const Y=((U=i==null?void 0:i.geometry)==null?void 0:U.letterSpacing)||0,X=Y+o*d*10;t.geometry.letterSpacing=(t.geometry.letterSpacing??Y)*(1-p)+X*p;break}}}getObjectProperty(t,s,o){const e=o.replace(/\[(\d+)\]/g,".$1").split(".");let n=t;for(const i of e){if(n==null||typeof n!="object")return;if(i==="style"&&t.style===void 0){n=s.style;continue}n=n[i]}return typeof n=="number"?n:void 0}setObjectProperty(t,s,o,e){const n=o.replace(/\[(\d+)\]/g,".$1").split(".");let i=t;for(let r=0;r<n.length-1;r++){const c=n[r];if(i[c]===void 0||i[c]===null){const d=s,p=n.slice(0,r+1).reduce((h,f)=>h==null?void 0:h[f],d),u=n[r+1],g=!isNaN(Number(u));i[c]=p!==void 0?Array.isArray(p)?[...p]:{...p}:g?[]:{}}i=i[c]}const a=n[n.length-1];i!=null&&(i[a]=e)}applyEasing(t,s){switch(s){case"easeOutCubic":return 1-Math.pow(1-t,3);case"easeInCubic":return t*t*t;case"easeInOutCubic":return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;case"easeOutQuad":return t*(2-t);case"easeInQuad":return t*t;case"easeInOutQuad":return t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2;case"easeOutExpo":return t===1?1:1-Math.pow(2,-10*t);case"easeOutBack":return 1+2.70158*Math.pow(t-1,3)+1.70158*Math.pow(t-1,2);case"easeOutElastic":{const o=2*Math.PI/3;return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t*10-.75)*o)+1}case"easeOutBounce":return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375;case"linear":return t;default:return 1-Math.pow(1-t,3)}}lerp(t,s,o){return t*(1-o)+s*o}deepMerge(t,s){if(!t)return s;if(!s)return t;if(typeof t!="object"||typeof s!="object"||t===null||s===null)return s;if(Array.isArray(s)){if(!Array.isArray(t))return s;const e=[...t];for(let n=0;n<s.length;n++)s[n]&&typeof s[n]=="object"&&!Array.isArray(s[n])&&t[n]&&typeof t[n]=="object"?e[n]=this.deepMerge(t[n],s[n]):e[n]=s[n];return e}const o={...t};for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&(s[e]&&typeof s[e]=="object"&&!Array.isArray(s[e])?o[e]=this.deepMerge(t[e],s[e]):Array.isArray(s[e])?o[e]=this.deepMerge(t[e],s[e]):o[e]=s[e]);return o}processFabricAdjustmentsCanvas(t,s,o,e){if(!e)return t;const n=(e.exposure||0)/100,i=(e.contrast||0)/100,a=(e.saturation||0)/100,r=(e.temperature||0)/200,c=(e.tint||0)/200,d=(e.highlights||0)/500,p=(e.shadows||0)/500,u=e.hue||0,g=(e.negative||0)/100,h=e.blur||0;if(!(n!==0||i!==0||a!==0||r!==0||c!==0||d!==0||p!==0||u!==0||g!==0||h>0))return t;const v=t.naturalWidth||Math.max(1,Math.round(s)),m=t.naturalHeight||Math.max(1,Math.round(o)),l=document.createElement("canvas");l.width=v,l.height=m;const b=l.getContext("2d");if(!b)return t;const S=[];h>0&&S.push(`blur(${h}px)`),u!==0&&S.push(`hue-rotate(${Math.round(u)}deg)`),S.length>0&&(b.filter=S.join(" ")),b.drawImage(t,0,0,v,m);try{const w=b.getImageData(0,0,v,m),C=w.data,M=C.length,I=n*255,_=i>=0?(1+i)/Math.max(.01,1-i):1+i,E=1+a,P=1+r-c/2,L=1+c,k=1-r-c/2,A=1+d+p,T=p*25.5,R=1-g/50,F=(1-R)*255;for(let O=0;O<M;O+=4){let W=C[O],V=C[O+1],U=C[O+2];if(n!==0&&(W+=I,V+=I,U+=I),i!==0&&(W=(W-127.5)*_+127.5,V=(V-127.5)*_+127.5,U=(U-127.5)*_+127.5),a!==0){const Y=.2989*W+.587*V+.114*U;W=Y+(W-Y)*E,V=Y+(V-Y)*E,U=Y+(U-Y)*E}(r!==0||c!==0)&&(W=W*P,V=V*L,U=U*k),(d!==0||p!==0)&&(W=W*A+T,V=V*A+T,U=U*A+T),g!==0&&(W=W*R+F,V=V*R+F,U=U*R+F),C[O]=Math.min(255,Math.max(0,W)),C[O+1]=Math.min(255,Math.max(0,V)),C[O+2]=Math.min(255,Math.max(0,U))}return b.putImageData(w,0,0),l}catch{return l}}renderFittedImage(t,s,o,e,n,i,a="cover"){const r=s.naturalWidth||s.width||n,c=s.naturalHeight||s.height||i,d=r/c,p=n/i;let u=n,g=i,h=o,f=e;a==="cover"?d>p?(u=i*d,h=o-(u-n)/2):(g=n/d,f=e-(g-i)/2):a==="contain"&&(d>p?(g=n/d,f=e+(i-g)/2):(u=i*d,h=o+(n-u)/2)),t.drawImage(s,h,f,u,g)}}const ai=$t.forwardRef(({artboard:y,src:t,style:s,autoPlay:o=!0,fit:e="Contain",alignment:n="Center",onReady:i,onTrigger:a,onInputUpdate:r,onComponentChange:c,onToggle:d,onInputChange:p,onInputFocus:u,onInputBlur:g,onLog:h,onLogicUpdate:f,onButtonClick:v,onGraphPointClick:m,currentTime:l,revision:b=0,scrollY:S,scrollX:w,mouseX:C,mouseY:M,isMouseDown:I,inputs:_,interactive:E=!0,onNavigation:P},L)=>{const k=$t.useRef(null),A=$t.useRef(null);A.current||(A.current=new gs);const T=$t.useRef(void 0),R=$t.useRef(0),F=$t.useRef(null),O=$t.useRef(b),W=$t.useRef(null),[,V]=$t.useState(y||null),U=$t.useRef(!0),Y=$t.useRef(o),X=$t.useRef(l);$t.useEffect(()=>{Y.current=o},[o]),$t.useEffect(()=>{X.current=l},[l]),$t.useImperativeHandle(L,()=>k.current),$t.useEffect(()=>(U.current=!0,()=>{U.current=!1,T.current&&cancelAnimationFrame(T.current)}),[]),$t.useEffect(()=>{A.current.setLayout(e,n)},[e,n]),$t.useEffect(()=>{const x=A.current;a&&x.setTriggerCallback(a),r&&x.setInputUpdateCallback((D,N)=>r({[D]:N})),c&&x.setComponentChangeCallback(D=>c(D)),d&&x.setToggleCallback(d),p&&x.setInputChangeCallback(p),u&&x.setInputFocusCallback(u),g&&x.setInputBlurCallback(g),h&&x.setOnLogCallback(D=>h(D,"info")),f&&x.setLogicUpdateCallback(f),v&&x.setButtonClickCallback(v),m&&x.setGraphPointClickCallback(D=>m(D.objectId,D)),P&&x.setNavigationCallback(P)},[a,r,c,d,p,u,g,h,f,v,m,P]),$t.useEffect(()=>{(async()=>{let D=y;if(t&&!y)try{t.startsWith("{")?D=JSON.parse(t):D=await(await fetch(t)).json()}catch(N){console.error("[ExodeUI] Failed to load src:",N)}if(D){const N=A.current,ct=D.id||D.name||"default";(F.current!==ct||O.current!==b||W.current!==D)&&(N.load(D),F.current=ct,O.current=b,W.current=D,V(D),R.current=-1,N.advance(0)),i&&i(N)}})()},[y,t,b]),$t.useEffect(()=>{const x=D=>{if(!A.current||!U.current)return;const N=A.current,ct=k.current;if(!ct)return;const Mt=ct.getContext("2d");if(!Mt)return;const bt=D/1e3;R.current<0&&(R.current=bt),R.current===0&&(R.current=bt);let wt=bt-R.current;wt>.1&&(wt=.1),R.current=bt;const gt=ct.getBoundingClientRect(),It=window.devicePixelRatio||1,ut=Math.round(gt.width*It),Ot=Math.round(gt.height*It);(ct.width!==ut||ct.height!==Ot)&&(ct.width=ut,ct.height=Ot);try{Y.current?N.advance(wt):X.current!==void 0&&N.seek(X.current),N.render(Mt,ct.width,ct.height)}catch(Wt){console.error("[ExodeUICanvas] Error in animation loop:",Wt),h&&h(`[Error] Animation loop crashed: ${Wt}`,"error")}T.current=requestAnimationFrame(x)};return T.current=requestAnimationFrame(x),()=>{T.current&&cancelAnimationFrame(T.current)}},[]),$t.useEffect(()=>{const x=A.current;S!==void 0&&x.updateInput("scrollY",S),w!==void 0&&x.updateInput("scrollX",w),C!==void 0&&x.updateInput("mouseX",C),M!==void 0&&x.updateInput("mouseY",M),I!==void 0&&x.updateInput("isMouseDown",I),_&&Object.entries(_).forEach(([D,N])=>x.updateInput(D,N))},[S,w,C,M,I,_]);const ot=(x,D)=>{if(!E||!k.current)return;x.stopPropagation(),"nativeEvent"in x&&x.nativeEvent&&typeof x.nativeEvent.stopImmediatePropagation=="function"?x.nativeEvent.stopImmediatePropagation():typeof x.stopImmediatePropagation=="function"&&x.stopImmediatePropagation();const N=k.current,ct=N.getBoundingClientRect(),Mt=x.clientX-ct.left,bt=x.clientY-ct.top,wt=window.devicePixelRatio||1;(D==="click"||D==="down"||D==="up")&&h&&h(`[Canvas] Pointer ${D} at rect(${Math.round(Mt)},${Math.round(bt)}) mapped to buffer(${Math.round(Mt*wt)},${Math.round(bt*wt)})`,"info"),A.current.handlePointerInput(D,Mt*wt,bt*wt,N.width,N.height)};$t.useEffect(()=>{if(!E)return;const x=N=>{var ct,Mt,bt;((ct=document.activeElement)==null?void 0:ct.tagName)==="INPUT"||((Mt=document.activeElement)==null?void 0:Mt.tagName)==="TEXTAREA"||(bt=A.current)==null||bt.handleKeyDown(N)},D=N=>{var ct,Mt,bt;((ct=document.activeElement)==null?void 0:ct.tagName)==="INPUT"||((Mt=document.activeElement)==null?void 0:Mt.tagName)==="TEXTAREA"||(bt=A.current)==null||bt.handleKeyUp(N)};return window.addEventListener("keydown",x),window.addEventListener("keyup",D),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",D)}},[E]),$t.useEffect(()=>{const x=k.current;if(!x||!E)return;const D=N=>{if(N.preventDefault(),N.stopPropagation(),A.current){const ct=x.getBoundingClientRect(),Mt=window.devicePixelRatio||1,bt=(N.clientX-ct.left)*Mt,wt=(N.clientY-ct.top)*Mt;let gt=N.deltaX,It=N.deltaY;N.deltaMode===1?(gt*=25,It*=25):N.deltaMode===2&&(gt*=100,It*=100),A.current.handlePointerInput("move",bt,wt,x.width,x.height),A.current.handleWheel(gt,It,bt,wt,x.width,x.height)}};return x.addEventListener("wheel",D,{passive:!1}),()=>{x.removeEventListener("wheel",D)}},[E]);const[J,at]=$t.useState([]);$t.useEffect(()=>{if(y&&y.objects){const x=y.objects.filter(D=>{var N,ct;return D.type==="Joystick"&&((N=D.inputBinding)==null?void 0:N.type)==="keyboard"&&((ct=D.inputBinding.keyboardConfig)==null?void 0:ct.showVirtualKeyboard)});at(x)}},[y]);const[,j]=$t.useState(0);$t.useEffect(()=>{if(J.length===0)return;let x;const D=()=>{j(N=>N+1),x=requestAnimationFrame(D)};return x=requestAnimationFrame(D),()=>cancelAnimationFrame(x)},[J.length]);const it=()=>J.map(x=>{const D=x.inputBinding.keyboardConfig,N=gt=>{var ut;const It={key:gt,code:gt,preventDefault:()=>{}};(ut=A.current)==null||ut.handleKeyDown(It)},ct=gt=>{var ut;const It={key:gt,code:gt,preventDefault:()=>{}};(ut=A.current)==null||ut.handleKeyUp(It)},Mt=A.current,bt=gt=>Mt&&Mt.activeKeys?Mt.activeKeys.has(gt.toLowerCase()):!1,wt=gt=>({width:"50px",height:"50px",background:gt?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.4)",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontWeight:"bold",fontSize:"18px",userSelect:"none",cursor:"pointer",backdropFilter:"blur(8px)",transition:"background 0.1s",boxShadow:gt?"none":"0 4px 6px rgba(0,0,0,0.1)"});return Qt.jsxs("div",{style:{position:"absolute",bottom:"40px",right:"40px",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",pointerEvents:"auto",zIndex:100},children:[Qt.jsx("div",{style:wt(bt(D.upKey)),onMouseDown:()=>N(D.upKey),onMouseUp:()=>ct(D.upKey),onMouseLeave:()=>ct(D.upKey),onTouchStart:gt=>{gt.preventDefault(),N(D.upKey)},onTouchEnd:gt=>{gt.preventDefault(),ct(D.upKey)},children:D.upKey.toUpperCase()}),Qt.jsxs("div",{style:{display:"flex",gap:"8px"},children:[Qt.jsx("div",{style:wt(bt(D.leftKey)),onMouseDown:()=>N(D.leftKey),onMouseUp:()=>ct(D.leftKey),onMouseLeave:()=>ct(D.leftKey),onTouchStart:gt=>{gt.preventDefault(),N(D.leftKey)},onTouchEnd:gt=>{gt.preventDefault(),ct(D.leftKey)},children:D.leftKey.toUpperCase()}),Qt.jsx("div",{style:wt(bt(D.downKey)),onMouseDown:()=>N(D.downKey),onMouseUp:()=>ct(D.downKey),onMouseLeave:()=>ct(D.downKey),onTouchStart:gt=>{gt.preventDefault(),N(D.downKey)},onTouchEnd:gt=>{gt.preventDefault(),ct(D.downKey)},children:D.downKey.toUpperCase()}),Qt.jsx("div",{style:wt(bt(D.rightKey)),onMouseDown:()=>N(D.rightKey),onMouseUp:()=>ct(D.rightKey),onMouseLeave:()=>ct(D.rightKey),onTouchStart:gt=>{gt.preventDefault(),N(D.rightKey)},onTouchEnd:gt=>{gt.preventDefault(),ct(D.rightKey)},children:D.rightKey.toUpperCase()})]})]},x.id)});return Qt.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[Qt.jsx("canvas",{ref:k,onPointerDown:x=>{var D;ot(x,"down"),x.currentTarget.setPointerCapture(x.pointerId),(D=k.current)==null||D.focus()},onPointerMove:x=>ot(x,"move"),onPointerUp:x=>{ot(x,"up"),x.currentTarget.releasePointerCapture(x.pointerId)},onPointerCancel:x=>{ot(x,"up"),x.currentTarget.releasePointerCapture(x.pointerId)},onClick:x=>ot(x,"click"),onKeyDown:x=>A.current.handleKeyDown(x.nativeEvent),onKeyUp:x=>A.current.handleKeyUp(x.nativeEvent),onContextMenu:x=>x.preventDefault(),tabIndex:0,style:{...s,width:"100%",height:"100%",outline:"none",display:"block",touchAction:"none",pointerEvents:E?"auto":"none"}}),it()]})});function ri(){const[y,t]=$t.useState(null),s=$t.useCallback((u,g)=>{y==null||y.setInputBool(u,g)},[y]),o=$t.useCallback((u,g)=>{y==null||y.setInputNumber(u,g)},[y]),e=$t.useCallback(u=>{y==null||y.fireTrigger(u)},[y]),n=$t.useCallback((u,g)=>{y==null||y.setInputText(u,g)},[y]),i=$t.useCallback((u,g)=>{y==null||y.setInputNumberArray(u,g)},[y]),a=$t.useCallback((u,g)=>{y==null||y.setInputStringArray(u,g)},[y]),r=$t.useCallback((u,g)=>{y==null||y.updateObjectOptions(u,g)},[y]),c=$t.useCallback((u,g,h)=>{y==null||y.updateConstraint(u,g,h)},[y]),d=$t.useCallback((u,g)=>{y==null||y.updateGraphData(u,g)},[y]),p=$t.useCallback(u=>y==null?void 0:y.getInputValue(u),[y]);return{setEngine:t,engine:y,setInputBool:s,setInputNumber:o,fireTrigger:e,setInputText:n,setInputNumberArray:i,setInputStringArray:a,updateConstraint:c,updateGraphData:d,updateObjectOptions:r,getInputValue:p}}const li=({artboard:y,config:t})=>{const s={...y.seo,...t},o=s.enableSmartExtraction!==!1;$t.useEffect(()=>{const a=s.title||y.name;a&&(document.title=a);let r=s.description;if(!r&&o){const p=y.objects.filter(u=>{var g;return((g=u.geometry)==null?void 0:g.type)==="Text"}).sort((u,g)=>{var h,f;return(((h=g.geometry.text)==null?void 0:h.length)||0)-(((f=u.geometry.text)==null?void 0:f.length)||0)});p.length>0&&(r=p[0].geometry.text)}r&&(e("name","description",r),e("property","og:description",r)),s.keywords&&s.keywords.length>0&&e("name","keywords",s.keywords.join(", "));const c=s.ogImage||y.backgroundImage;c&&e("property","og:image",c),a&&e("property","og:title",a),e("property","og:type","website")},[s,y,o]);const e=(a,r,c)=>{let d=document.querySelector(`meta[${a}="${r}"]`);d||(d=document.createElement("meta"),d.setAttribute(a,r),document.head.appendChild(d)),d.setAttribute("content",c)},n=()=>{const a=[];return a.push(Qt.jsx("h1",{children:s.title||y.name},"artboard-title")),y.objects.forEach((c,d)=>{var p,u;if(!(c.visible===!1||c.isVisible===!1))if(((p=c.geometry)==null?void 0:p.type)==="Text"){const g=c.geometry.text;g&&(c.geometry.fontSize>24?a.push(Qt.jsx("h2",{children:g},c.id||d)):a.push(Qt.jsx("p",{children:g},c.id||d)))}else if(((u=c.geometry)==null?void 0:u.type)==="Image"){const g=c.geometry.src,h=c.altText||c.name||"Illustration";a.push(Qt.jsx("img",{src:g,alt:h},c.id||d))}else c.type==="Button"&&a.push(Qt.jsx("button",{children:c.name||"Button"},c.id||d))}),a},i=s.jsonLd||{"@context":"https://schema.org","@type":"VisualArtwork",name:s.title||y.name,description:s.description,image:s.ogImage||y.backgroundImage,abstract:"Animated interface created with ExodeUI"};return Qt.jsxs("div",{id:`exode-seo-${y.id||"default"}`,"aria-hidden":"false",style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0",zIndex:-1},children:[n(),Qt.jsx("script",{type:"application/ld+json",children:JSON.stringify(i)})]})},ci={version:"6.4.0"}.version;Kt.BAR_STYLE_PRESETS=oi,Kt.BehaviorSensor=re,Kt.BehaviorType=tt,Kt.ConditionOp=je,Kt.ExodeSEO=li,Kt.ExodeUICanvas=ai,Kt.ExodeUIEngine=gs,Kt.LogicOp=_t,Kt.RapierPhysics=is,Kt.VERSION=ci,Kt.useExodeUI=ri,Object.defineProperty(Kt,Symbol.toStringTag,{value:"Module"})}));
|
|
19
|
+
`);let rt=-r/2+(((me=e.padding)==null?void 0:me.top)??8);const z=X*1.4,K=e.rows||3;let G=0,B=0;for(const Q of mt){if(G>=K)break;const H=Q.split(" ");let lt="";for(let kt=0;kt<H.length;kt++){const Et=lt+H[kt]+" ";if(t.measureText(Et).width>ft&&kt>0){if(G>=K)break;t.fillText(lt.trim(),q,rt),lt=H[kt]+" ",rt+=z,G++}else lt=Et}G<K&&(t.fillText(lt.trim(),q,rt),B=t.measureText(lt.trim()).width,rt+=z,G++)}if(c&&!D&&Math.floor(performance.now()/500)%2===0){const Q=rt-z;t.fillStyle=R,t.fillRect(q+Math.min(B,ft),Q,1.5,X)}}else{t.textBaseline="middle";const rt=t.measureText(At).width;let z=0;if(rt>ft&&(z=rt-ft),t.fillText(At,q-z,0),c&&Math.floor(performance.now()/500)%2===0){const K=D?q:q+rt-z;t.fillStyle=R,t.fillRect(K,-(X/2),1.5,X)}}if(t.restore(),e.showCharCounter){t.save();const mt=Number(e.maxLength||0),rt=mt>0?`${j.length}/${mt}`:`${j.length}`;t.font=`400 10px "${U}", sans-serif`,t.fillStyle=mt>0&&j.length>=mt?"#ef4444":"rgba(156, 163, 175, 0.6)",t.textAlign="right",t.textBaseline="top",t.fillText(rt,-(a/2)+a-8,-(r/2)+r+4),t.restore()}if(g.visible!==!1){const mt=!!(g.required||(Ae=e.validation)!=null&&Ae.required),rt=(g.text||"Label")+(mt?" *":""),z=g.fontSize||12,K=g.color||"rgba(156, 163, 175, 1)",G=g.position||"top",B=g.gap??g.offset??6;let Q=-(a/2),H=-(r/2)-B,lt="left",kt="bottom",Et=`600 ${z}px "${g.fontFamily||U}", sans-serif`;G==="left"?(Q=-(a/2)-B,H=0,lt="right",kt="middle"):G==="bottom"?(Q=-(a/2),H=r/2+B,lt="left",kt="top"):G==="floating"&&(!!j||c?(Q=-(a/2)+12,H=-(r/2)+4,lt="left",kt="top",Et=`600 ${Math.max(9,z-2)}px "${g.fontFamily||U}", sans-serif`):Et=null),Et&&(t.save(),t.font=Et,t.fillStyle=K,t.textAlign=lt,t.textBaseline=kt,t.fillText(rt,Q,H),t.restore())}const vt=(he=e.validation)==null?void 0:he.errorMessage;if(b&&vt||h.visible===!0&&h.text){t.save();const mt=h.fontSize||11,rt=b?"#ef4444":h.color||"rgba(156, 163, 175, 1)",z=h.offset??6,K=b&&vt?vt:h.text;t.font=`400 ${mt}px "${U}", sans-serif`,t.fillStyle=rt,t.textAlign="left",t.textBaseline="top",t.fillText(K,-(a/2),r/2+z),t.restore()}l&&(t.save(),_(-a/2,-r/2,a,r,I),t.fillStyle="rgba(0, 0, 0, 0.3)",t.fill(),t.restore())}renderSlider(t,s){const o=this.objectStates.get(s.id),e=(o==null?void 0:o.geometry)||s.geometry,n=(o==null?void 0:o.options)||s.options||{},i=e.width||200,a=n.value??50,r=n.min??0,d=(n.max??100)-r,p=d===0?0:(a-r)/d,u=n.trackHeight||4,g=n.trackRoundedness??2,h=n.trackShape??"Rectangle",f=n.trackPath||"",v=n.accentColor||"#3b82f6",m=n.inactiveColor||"#374151",l=n.thumbShape||"Ellipse",b=n.thumbWidth??16,S=n.thumbHeight??16,w=n.thumbRoundedness??0,C=n.thumbColor||"#ffffff",M=n.thumbPath||"",I=n.thumbIcon||"",_=n.showValueTooltip??!1,E=n.tooltipBgColor||"#333333",P=n.tooltipColor||"#ffffff",L=n.tooltipOffsetX??0,k=n.tooltipOffsetY??-25,A=(J,at,j,it,x,D,N)=>{if((J==="Custom"||J==="Icon")&&N)try{const ct=new Path2D(N);if(t.save(),t.translate(at,j),J==="Icon"){const Mt=Math.min(it,x)/24;t.scale(Mt,Mt),t.translate(-12,-12)}t.fill(ct),t.restore();return}catch(ct){console.error("Error drawing slider shape in engine:",ct)}if(t.beginPath(),J==="Ellipse")t.ellipse(at,j,it/2,x/2,0,0,Math.PI*2);else if(J==="Rectangle")this.drawRoundRect(t,at-it/2,j-x/2,it,x,D);else if(J==="Triangle")t.moveTo(at,j-x/2),t.lineTo(at+it/2,j+x/2),t.lineTo(at-it/2,j+x/2),t.closePath();else if(J==="Diamond")t.moveTo(at,j-x/2),t.lineTo(at+it/2,j),t.lineTo(at,j+x/2),t.lineTo(at-it/2,j),t.closePath();else if(J==="Polygon"){const ct=s.geometry.sides||3,Mt=s.geometry.radius||Math.min(it,x)/2;for(let bt=0;bt<ct;bt++){const wt=bt*2*Math.PI/ct-Math.PI/2,gt=at+Mt*Math.cos(wt),It=j+Mt*Math.sin(wt);bt===0?t.moveTo(gt,It):t.lineTo(gt,It)}t.closePath()}else if(J==="Star"){const Mt=Math.min(it,x)/2,bt=Mt/2;for(let wt=0;wt<10;wt++){const gt=wt%2===0?Mt:bt,It=wt*Math.PI/5-Math.PI/2;t.lineTo(at+gt*Math.cos(It),j+gt*Math.sin(It))}t.closePath()}else J==="Line"&&(t.moveTo(at-it/2,j),t.lineTo(at+it/2,j));t.fill()},T=this.createCanvasFill(t,m,i,u);T&&(t.fillStyle=T,t.strokeStyle=T),h==="Line"?(t.lineWidth=u,t.beginPath(),t.moveTo(-i/2,0),t.lineTo(i/2,0),t.stroke()):A(h,0,0,i,u,g,f);const R=i-b,F=-i/2+b/2+p*R,O=F- -i/2;if(O>0){const J=this.createCanvasFill(t,v,i,u);J&&(t.fillStyle=J,t.strokeStyle=J),h==="Line"?(t.lineWidth=u,t.beginPath(),t.moveTo(-i/2,0),t.lineTo(F,0),t.stroke()):h==="Rectangle"&&(t.beginPath(),this.drawRoundRect(t,-i/2,-u/2,O,u,g),t.fill())}t.save(),t.translate(F,0);const W=t.getTransform(),V=Math.sqrt(W.a*W.a+W.b*W.b)||1;t.shadowColor="rgba(0,0,0,0.2)",t.shadowBlur=4*V,t.shadowOffsetY=1*V;const U=this.createCanvasFill(t,C,b,S);if(U&&(t.fillStyle=U),A(l,0,0,b,S,w,l==="Icon"?I:M),t.restore(),_){t.save(),t.translate(F+L,k);const J=Math.round(a).toString();t.font="10px Inter, sans-serif";const at=t.measureText(J),j=6,it=4,x=at.width+j*2,D=14+it;t.beginPath(),this.drawRoundRect(t,-x/2,-D/2,x,D,4),t.fillStyle=E,t.fill(),t.fillStyle=P,t.textAlign="center",t.textBaseline="middle",t.fillText(J,0,0),t.restore()}const Y=n.label||{},X=n.helperText||{},ot=n.fontFamily||"Inter";if(Y.visible!==!1){const J=Y.text||"Label",at=Y.fontSize||12,j=Y.color||"rgba(156, 163, 175, 1)",it=Y.offset??8;t.font=`600 ${at}px "${ot}", sans-serif`,t.fillStyle=j,t.textAlign="left",t.textBaseline="bottom";const x=-(i/2),D=-(u/2)-it;t.fillText(J,x,D)}if(X.visible===!0){const J=X.text||"Helper text",at=X.fontSize||11,j=X.color||"rgba(156, 163, 175, 1)",it=X.offset??6;t.font=`400 ${at}px "${ot}", sans-serif`,t.fillStyle=j,t.textAlign="left",t.textBaseline="top";const x=-(i/2),D=u/2+it;t.fillText(J,x,D)}}renderDropdown(t,s){var k;const o=this.objectStates.get(s.id);if(!o)return;const e=o.options||s.options||{},n=s.geometry.width||180,i=s.geometry.height||40,a=-n/2,r=-i/2,c=e.cornerRadius??e.corner_radius??6,d=e.disabled||e.previewState==="disabled",p=this.lastHoveredObjectId===s.id||e.previewState==="hover",u=(e.isOpen||e.previewState==="active")&&!d;let g=e.backgroundColor,h=e.borderColor,f=e.color||"#333333";d?(g=e.disabledBackgroundColor||"#f3f4f6",h=e.disabledBorderColor||"#e5e7eb",f=e.disabledColor||"#9ca3af"):u?(g=e.activeBackgroundColor||g,h=e.activeBorderColor||h,f=e.activeColor||f):p&&(g=e.hoverBackgroundColor||g,h=e.hoverBorderColor||h,f=e.hoverColor||f),g||(g="#ffffff"),h||(h="#e5e7eb"),t.save();const v=t.globalAlpha;t.globalAlpha=v*(e.opacity??1),t.beginPath(),this.drawRoundRect(t,a,r,n,i,c),t.fillStyle=this.createCanvasFill(t,typeof g=="string"?{type:"Solid",color:g}:g,n,i)||"#ffffff",t.fill();const m=e.borderWidth??1;m>0&&(t.beginPath(),this.drawRoundRect(t,a,r,n,i,c),t.strokeStyle=this.createCanvasFill(t,typeof h=="string"?{type:"Solid",color:h}:h,n,i)||"#e5e7eb",t.lineWidth=m,t.stroke());const l=12,b=e.chevronType||"chevron",S=e.chevronSize||16,w=(u?e.openIconColor:e.closedIconColor)||e.chevronColor||"#6b7280";if(b!=="none"){const A=a+n-l-S/2;t.save(),t.translate(A,0);const T=u?e.openIconAngle??180:e.closedIconAngle??0;if(t.rotate(T*Math.PI/180),t.strokeStyle=w,t.fillStyle=w,t.lineWidth=1.5,t.lineCap="round",t.lineJoin="round",b==="chevron")t.beginPath(),t.moveTo(-S/2,-S*.2),t.lineTo(0,S*.2),t.lineTo(S/2,-S*.2),t.stroke();else if(b==="custom"||b==="path"){const R=u&&e.openIconPath||e.closedIconPath;if(R){const F=new Path2D(R);t.save();const O=S/24;t.scale(O,O),t.translate(-12,-12),t.fill(F),t.restore()}}t.restore()}const C=e.selectedOption||e.placeholder||"Select...",M=e.fontSize||14,I=e.fontWeight||400,_=e.fontFamily||"Inter, sans-serif";t.font=`${I} ${M}px ${_}`;const E=d?e.disabledColor||"#9ca3af":!e.selectedOption&&e.placeholder?"#9ca3af":f;t.fillStyle=this.createCanvasFill(t,typeof E=="string"?{type:"Solid",color:E}:E,n,i)||"#333333",t.textAlign="left",t.textBaseline="middle";const P=b==="none"?0:S+8,L=n-l*2-P;if(t.save(),t.beginPath(),t.rect(a+l,r,L,i),t.clip(),t.fillText(C,a+l,0),t.restore(),u&&!d){const A=r+i+4,T=e.optionsList||[],R=e.itemHeight||32,F=e.listPadding??4,O=T.length*R+F*2,W=e.listCornerRadius??c;t.save();const V=e.listShadow||{},U=t.getTransform(),Y=Math.sqrt(U.a*U.a+U.b*U.b)||1;t.shadowColor=typeof V.color=="string"?V.color:((k=V.color)==null?void 0:k.color)||"rgba(0,0,0,0.15)",t.shadowBlur=(V.blur??12)*Y,t.shadowOffsetY=(V.offsetY??6)*Y,t.shadowOffsetX=(V.offsetX??0)*Y,t.beginPath(),this.drawRoundRect(t,a,A,n,O,W),t.fillStyle=this.createCanvasFill(t,typeof e.listBackgroundColor=="string"?{type:"Solid",color:e.listBackgroundColor}:e.listBackgroundColor||{type:"Solid",color:"#ffffff"},n,O)||"#ffffff",t.fill();const X=e.listBorderWidth??1;X>0&&(t.shadowColor="transparent",t.beginPath(),this.drawRoundRect(t,a,A,n,O,W),t.strokeStyle=this.createCanvasFill(t,typeof e.listBorderColor=="string"?{type:"Solid",color:e.listBorderColor}:e.listBorderColor||{type:"Solid",color:h},n,O)||"#e5e7eb",t.lineWidth=X,t.stroke()),t.restore();const ot=e.itemFontSize||M,J=e.itemFontFamily||_;t.font=`${I} ${ot}px ${J}`,T.forEach((at,j)=>{const it=A+F+j*R;if(at===e.selectedOption)t.fillStyle=this.createCanvasFill(t,typeof e.itemSelectedBackgroundColor=="string"?{type:"Solid",color:e.itemSelectedBackgroundColor}:e.itemSelectedBackgroundColor||{type:"Solid",color:"#f3f4f6"},n,R)||"#f3f4f6",t.fillRect(a+X,it,n-X*2,R),t.fillStyle=e.itemSelectedColor||e.accentColor||f||"#374151";else if(t.fillStyle=e.listTextColor||f||"#333333",this.activeDropdownId===s.id&&this._lastPointerPos){const D=this._lastPointerPos.y-(A+F),N=Math.floor(D/R);j===N&&(t.fillStyle=this.createCanvasFill(t,typeof e.itemHoverBackgroundColor=="string"?{type:"Solid",color:e.itemHoverBackgroundColor}:e.itemHoverBackgroundColor||{type:"Solid",color:"#f9fafb"},n,R)||"#f9fafb",t.fillRect(a+X,it,n-X*2,R),t.fillStyle=e.itemHoverColor||f)}t.fillText(at,a+l,it+R/2)})}t.restore()}renderButton(t,s){var L;if(s.children&&s.children.length>0)return;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=s.geometry||{},i=n.width||s.width||160,a=n.height||s.height||45,r=this.lastHoveredObjectId===s.id,c=this.activeObjectId===s.id,d=e.label||{},p=e.hoverStyle||{},u=e.activeStyle||{},g=e.icon||{enabled:!1};let h=e.backgroundColor||e.buttonBgColor||((L=s.style)==null?void 0:L.fill)||"#3b82f6",f=(typeof d=="object"?d.color:null)||"#ffffff",v=typeof d=="string"?d:d.text||s.text||(s.name&&!s.name.toLowerCase().includes("component")?s.name:"Button"),m=n.cornerRadius??n.corner_radius??8,l=e.borderColor||"transparent",b=e.borderWidth||0,S=1;c&&u?(h=u.backgroundColor||h,f=u.color||f,v=u.text||v,S=u.scale??.95,m=u.cornerRadius??m):r&&p&&(h=p.backgroundColor||h,f=p.color||f,v=p.text||v,S=p.scale??1,m=p.cornerRadius??m,l=p.borderColor||l);const w=-i/2,C=-a/2;t.save(),t.scale(S,S),t.beginPath(),this.drawRoundRect(t,w,C,i,a,m);const M=this.createCanvasFill(t,h,i,a);M&&(t.fillStyle=M,t.fill()),(b>0||r&&p.borderColor)&&(t.strokeStyle=l,t.lineWidth=b||(r?1:0),t.stroke());const I=d.fontSize||14,_=d.fontFamily||"Inter",E=d.fontWeight||600;t.font=`${E} ${I}px "${_}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`,t.fillStyle=f,t.textAlign="center",t.textBaseline="middle";let P=0;if(g.enabled&&g.svgPath){const k=I*1.1,A=g.gap||8,T=t.measureText(v),F=-(T.width+k+A)/2,O=g.position==="left"?F+k/2:F+T.width+A+k/2;P=g.position==="left"?F+k+A+T.width/2:F+T.width/2,t.save(),t.translate(O,0);const W=new Path2D(g.svgPath),V=k/24;t.scale(V,V),t.translate(-12,-12),t.fillStyle=f,t.fill(W),t.restore()}t.fillText(v,P,0),t.restore()}renderToggleButton(t,s){var v,m;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=e.checked??!1,i=((v=s.geometry)==null?void 0:v.width)||120,a=((m=s.geometry)==null?void 0:m.height)||40,r=-i/2,c=-a/2,d=e.corner_radius??8,p=e.label||{},u=n?e.accentColor||"#3b82f6":e.inactiveColor||"#374151",g=n?e.activeTextColor||"#ffffff":e.inactiveTextColor||"#9ca3af";t.save(),t.beginPath(),this.drawRoundRect(t,r,c,i,a,d),t.fillStyle=u,t.fill();const h=p.fontSize||14,f=p.fontFamily||"Inter";t.font=`${p.fontWeight||600} ${h}px "${f}", sans-serif`,t.fillStyle=g,t.textAlign="center",t.textBaseline="middle",t.fillText(p.text||"Toggle",0,0),t.restore()}renderToggle(t,s){var W,V,U,Y,X,ot,J,at,j,it,x,D;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=((W=s.geometry)==null?void 0:W.width)||52,i=((V=s.geometry)==null?void 0:V.height)||30,a=-n/2,r=-i/2,c=e.checked??!1,d=e.cornerRadius??e.corner_radius??i/2,p=e.toggleStyle||{},u=p.backgroundColor||e.activeColor||"#10b981",g=p.borderColor||e.borderColor||"transparent",h=p.borderWidth??e.borderWidth??0,f=p.knobColor||e.knobColor||"#ffffff",v=c?u:e.inactiveColor||"#374151",m=c?g:e.borderColor||"transparent",l=c?h:e.borderWidth??0,b=c?f:e.knobColor||"#ffffff";e.disabled&&(t.globalAlpha*=.5),t.beginPath(),this.drawRoundRect(t,a,r,n,i,d);const S=this.createCanvasFill(t,v,n,i);if(S&&(t.fillStyle=S,t.fill()),l>0){t.lineWidth=l;const N=this.createCanvasFill(t,m,n,i);N&&(t.strokeStyle=N,t.stroke())}const w=2,C=i-w*2,M=C/2,I=a+w,_=a+n-w-C,E=c?_:I,P=r+w;t.beginPath(),t.arc(E+M,P+M,M,0,Math.PI*2);const L=this.createCanvasFill(t,b,C,C);L&&(t.fillStyle=L,t.fill()),e.disabled&&(t.globalAlpha*=2);let k=!1,A=!1;const T=(c?(U=p.leftLabel)==null?void 0:U.text:null)||((Y=e.leftLabel)==null?void 0:Y.text)||"",R=(c?(X=p.leftLabel)==null?void 0:X.color:null)||((ot=e.leftLabel)==null?void 0:ot.color)||"#f3f4f6";if((J=e.leftLabel)!=null&&J.enabled&&T){const N=e.leftLabel;t.font=`${N.fontWeight||400} ${N.fontSize||12}px "${N.fontFamily||"Inter"}", sans-serif`,t.fillStyle=R,t.textBaseline="middle",t.textAlign="right",t.fillText(T,a-(N.gap||8),0),k=!0}const F=(c?(at=p.rightLabel)==null?void 0:at.text:null)||((j=e.rightLabel)==null?void 0:j.text)||"",O=(c?(it=p.rightLabel)==null?void 0:it.color:null)||((x=e.rightLabel)==null?void 0:x.color)||"#f3f4f6";if((D=e.rightLabel)!=null&&D.enabled&&F){const N=e.rightLabel;t.font=`${N.fontWeight||400} ${N.fontSize||12}px "${N.fontFamily||"Inter"}", sans-serif`,t.fillStyle=O,t.textBaseline="middle",t.textAlign="left",t.fillText(F,a+n+(N.gap||8),0),A=!0}if(!k&&!A&&e.label&&e.label.text){const N=e.label,ct=N.fontSize||14,Mt=N.fontWeight||400,bt=N.fontFamily||"Inter";t.font=`${Mt} ${ct}px "${bt}", sans-serif`,t.fillStyle=N.color||"#f3f4f6",t.textBaseline="middle";const wt=N.gap||10;let gt=0,It=0;N.position==="left"?(t.textAlign="right",gt=a-wt,It=0):N.position==="right"?(t.textAlign="left",gt=a+n+wt,It=0):N.position==="top"?(t.textAlign="center",gt=0,It=r-wt,t.textBaseline="bottom"):N.position==="bottom"?(t.textAlign="center",gt=0,It=r+i+wt,t.textBaseline="top"):(t.textAlign="left",gt=a+n+wt,It=0),t.fillText(N.text,gt,It)}}renderCheckbox(t,s){var S,w;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=((S=s.geometry)==null?void 0:S.width)||20,i=((w=s.geometry)==null?void 0:w.height)||20,a=-n/2,r=-i/2,c=e.cornerRadius??4,d=e.checked??!1,p=e.activeColor||"#3b82f6",u=e.inactiveColor||"transparent",g=e.checkColor||"#ffffff",h=e.borderColor||"#4b5563",f=e.borderWidth??2,v=d?p:u,m=d?"transparent":h,l=d?0:f;e.disabled&&(t.globalAlpha*=.5),t.beginPath(),this.drawRoundRect(t,a,r,n,i,c);const b=this.createCanvasFill(t,v,n,i);if(b&&(t.fillStyle=b,t.fill()),l>0){t.lineWidth=l;const C=this.createCanvasFill(t,m,n,i);C&&(t.strokeStyle=C,t.stroke())}else if(d){t.lineWidth=1;const C=this.createCanvasFill(t,p,n,i);C&&(t.strokeStyle=C,t.stroke())}if(d){t.save(),t.beginPath();const C=this.createCanvasFill(t,g,n,i);t.strokeStyle=C||g,t.lineWidth=Math.max(2,n*.12),t.lineCap="round",t.lineJoin="round";const M=a+n*.25,I=r+i*.5,_=a+n*.45,E=r+i*.7,P=a+n*.75,L=r+i*.25;t.moveTo(M,I),t.lineTo(_,E),t.lineTo(P,L),t.stroke(),t.restore()}if(e.disabled&&(t.globalAlpha*=2),e.label&&e.label.text){const C=e.label;t.save(),t.font=`${C.fontWeight||400} ${C.fontSize||14}px "${C.fontFamily||"Inter"}", sans-serif`,t.fillStyle=C.color||"#f3f4f6",t.textBaseline="middle";const M=C.gap||8;let I=0,_=0;C.position==="left"?(t.textAlign="right",I=a-M,_=0):C.position==="right"?(t.textAlign="left",I=a+n+M,_=0):C.position==="top"?(t.textAlign="center",I=0,_=r-M,t.textBaseline="bottom"):C.position==="bottom"&&(t.textAlign="center",I=0,_=r+i+M,t.textBaseline="top"),t.fillText(C.text,I,_),t.restore()}}renderRadioGroup(t,s){var _,E;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=((_=s.geometry)==null?void 0:_.width)||180,i=((E=s.geometry)==null?void 0:E.height)||100,a=-n/2,r=-i/2;let c=e.optionsList||["Option 1","Option 2","Option 3"];if(e.isDataVarEnabled&&e.dataInputId){let P=this.inputs.get(e.dataInputId);if(P===void 0){const L=this.inputNameMap.get(e.dataInputId);L&&L.length>0&&(P=this.inputs.get(L[0]))}P&&Array.isArray(P)&&(c=P.map(L=>typeof L=="string"?L:String(L)))}const d=e.selectedValue,p=e.orientation||"vertical",u=e.itemGap!==void 0?e.itemGap:16,g=e.activeColor||"#3b82f6",h=e.inactiveColor||"#4b5563",f=e.textColor||"#ffffff",v=e.fontSize||14,m=e.fontFamily||"Inter",l=e.fontWeight||400;t.save(),t.beginPath(),t.rect(a,r,n,i),t.clip(),e.disabled&&(t.globalAlpha*=.5);const b=8,S=b*2,w=e.radioShape||"circle",C=e.borderWidth!==void 0?e.borderWidth:2,M=e.fillEmpty||"transparent",I=(P,L,k,A)=>{if(t.beginPath(),A==="custom"&&e.customShapePath)try{const T=new Path2D(e.customShapePath);t.save(),t.translate(P-k,L-k),t.scale(k*2/24,k*2/24),t.fill(T),t.restore();return}catch{t.arc(P,L,k,0,Math.PI*2);return}if(A==="square"){const T=k*1.6;t.rect(P-T/2,L-T/2,T,T)}else if(A==="diamond"){const T=k*1.4;t.moveTo(P,L-T),t.lineTo(P+T,L),t.lineTo(P,L+T),t.lineTo(P-T,L),t.closePath()}else if(A==="heart"){const T=k*.9;t.moveTo(P,L+T*.7),t.bezierCurveTo(P-T*1.5,L-T*.3,P-T*.5,L-T*1.5,P,L-T*.5),t.bezierCurveTo(P+T*.5,L-T*1.5,P+T*1.5,L-T*.3,P,L+T*.7)}else if(A==="star"){const T=k*1.1,R=k*.5;for(let F=0;F<5;F++){const O=(F*72-90)*Math.PI/180,W=(F*72+36-90)*Math.PI/180;F===0?t.moveTo(P+T*Math.cos(O),L+T*Math.sin(O)):t.lineTo(P+T*Math.cos(O),L+T*Math.sin(O)),t.lineTo(P+R*Math.cos(W),L+R*Math.sin(W))}t.closePath()}else t.arc(P,L,k,0,Math.PI*2)};if(t.font=`${l} ${v}px "${m}", sans-serif`,t.textBaseline="middle",t.textAlign="left",p==="vertical"){const P=Math.max(S,v)+u,L=c.length*P-u,k=r+Math.max(0,(i-L)/2);c.forEach((A,T)=>{const R=k+b+T*P,F=d===A,O=this.createCanvasFill(t,g,S,S),W=this.createCanvasFill(t,h,S,S);F?(t.fillStyle=O||g,I(a+b,R,b,w),t.fill(),t.strokeStyle=O||g,t.lineWidth=C,I(a+b,R,b,w),t.stroke()):(M!=="transparent"&&(t.fillStyle=M,I(a+b,R,b,w),t.fill()),t.strokeStyle=W||h,t.lineWidth=C,I(a+b,R,b,w),t.stroke()),t.fillStyle=f,t.fillText(A,a+S+8,R)})}else{const P=r+i/2;let L=0;t.font=`${l} ${v}px "${m}", sans-serif`,c.forEach(T=>{L+=S+6+t.measureText(T).width+u}),L-=u;let A=a+Math.max(0,(n-L)/2);c.forEach(T=>{const R=d===T,F=t.measureText(T).width,O=this.createCanvasFill(t,g,S,S),W=this.createCanvasFill(t,h,S,S);R?(t.fillStyle=O||g,I(A+b,P,b,w),t.fill(),t.strokeStyle=O||g,t.lineWidth=C,I(A+b,P,b,w),t.stroke()):(M!=="transparent"&&(t.fillStyle=M,I(A+b,P,b,w),t.fill()),t.strokeStyle=W||h,t.lineWidth=C,I(A+b,P,b,w),t.stroke()),t.fillStyle=f,t.fillText(T,A+S+6,P),A+=S+6+F+u})}if(t.restore(),e.disabled&&(t.globalAlpha*=2),e.label&&e.label.text){const P=e.label;t.save(),t.font=`${P.fontWeight||400} ${P.fontSize||14}px "${P.fontFamily||"Inter"}", sans-serif`,t.fillStyle=P.color||"#9ca3af",t.textBaseline="middle";const L=P.gap||8;let k=0,A=0;P.position==="left"?(t.textAlign="right",k=a-L,A=0):P.position==="right"?(t.textAlign="left",k=a+n+L,A=0):P.position==="top"?(t.textAlign="center",k=0,A=r-L,t.textBaseline="bottom"):P.position==="bottom"&&(t.textAlign="center",k=0,A=r+i+L,t.textBaseline="top"),t.fillText(P.text,k,A),t.restore()}}renderBarChart(t,s){var E,P,L;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{};let n={...e};if(e.isDataVarEnabled&&e.dataInputId){let k=this.inputs.get(e.dataInputId);if(k===void 0){const A=this.inputNameMap.get(e.dataInputId);A&&A.length>0&&(k=this.inputs.get(A[0]))}k&&Array.isArray(k)&&(n.categories=k.map(A=>typeof A=="string"?A:String(A)))}if(e.isDatasetsVarEnabled&&((E=e.datasetInputIds)==null?void 0:E.length)>0){const k=e.datasetInputIds.map((A,T)=>{var O;let R=this.inputs.get(A);if(R===void 0){const W=this.inputNameMap.get(A);W&&W.length>0&&(R=this.inputs.get(W[0]))}const F=((O=e.datasets)==null?void 0:O[T])||{id:`ds-${T}`,label:`Series ${T+1}`,data:[],color:"#6366f1"};return R&&Array.isArray(R)?{...F,data:R.map(W=>typeof W=="number"?W:parseFloat(W)||0)}:F});n.datasets=k}const i={width:((P=s.geometry)==null?void 0:P.width)||300,height:((L=s.geometry)==null?void 0:L.height)||180,chartType:n.chartType||"grouped",datasets:n.datasets||[{id:"ds-1",label:"Revenue",data:[42,67,31,55,78,48],color:"#6366f1"}],categories:n.categories||["Jan","Feb","Mar","Apr","May","Jun"],orientation:n.orientation||"vertical",barWidth:n.barWidth!==void 0?n.barWidth:14,barGap:n.barGap!==void 0?n.barGap:4,barCornerRadius:n.barCornerRadius!==void 0?n.barCornerRadius:5,showXAxis:!!n.showXAxis,showYAxis:!!n.showYAxis,xAxisColor:n.xAxisColor||"rgba(255,255,255,0.15)",yAxisColor:n.yAxisColor||"rgba(255,255,255,0.15)",showXLabels:n.showXLabels!==void 0?!!n.showXLabels:!0,showYLabels:!!n.showYLabels,axisLabelColor:n.axisLabelColor||"rgba(255,255,255,0.55)",axisLabelFontSize:n.axisLabelFontSize||9,showLegend:n.showLegend!==void 0?!!n.showLegend:!0,legendColor:n.legendColor||"rgba(255,255,255,0.7)",legendFontSize:n.legendFontSize||9,showGridLines:n.showGridLines!==void 0?!!n.showGridLines:!0,gridColor:n.gridColor||"rgba(255,255,255,0.06)",cardBackground:n.cardBackground||"#ffffff",cardBackgroundOpacity:n.cardBackgroundOpacity!==void 0?n.cardBackgroundOpacity:.04,cardBorderColor:n.cardBorderColor||"rgba(255,255,255,0.08)",barGradient:n.barGradient!==void 0?!!n.barGradient:!0,gradientStartColor:n.gradientStartColor||"",gradientEndOpacity:n.gradientEndOpacity!==void 0?n.gradientEndOpacity:.27,showValueOnTop:!!n.showValueOnTop,valueFontSize:n.valueFontSize||10,valueColor:n.valueColor||"",valueFontWeight:n.valueFontWeight||"bold",barStyle:n.barStyle||"solid",barBorderWidth:n.barBorderWidth!==void 0?n.barBorderWidth:1,barBorderColor:n.barBorderColor||"auto",enableShadows:!!n.enableShadows,shadowColor:n.shadowColor||"rgba(0,0,0,0.5)",shadowBlur:n.shadowBlur!==void 0?n.shadowBlur:4,shadowOffsetY:n.shadowOffsetY!==void 0?n.shadowOffsetY:2,xAxisLineWidth:n.xAxisLineWidth!==void 0?n.xAxisLineWidth:1,yAxisLineWidth:n.yAxisLineWidth!==void 0?n.yAxisLineWidth:1,gridLineWidth:n.gridLineWidth!==void 0?n.gridLineWidth:1,gridLineDash:n.gridLineDash||[3,4],_hexToRgb:function(k,A){if(k.startsWith("rgba")||k.startsWith("rgb"))return k;k.startsWith("#")||(k="#"+k),k.length===4&&(k="#"+k[1]+k[1]+k[2]+k[2]+k[3]+k[3]);const T=parseInt(k.slice(1,3),16),R=parseInt(k.slice(3,5),16),F=parseInt(k.slice(5,7),16);return`rgba(${T},${R},${F},${A})`},_resolveColor:function(k,A){return typeof k=="string"?k:"#6366f1"},_makeGradient:function(k,A,T,R,F,O){if(!this.barGradient)return A;const W=this.gradientStartColor||A,V=k.createLinearGradient(T,R,F,O);return V.addColorStop(0,A),V.addColorStop(1,this._hexToRgb(W,this.gradientEndOpacity)),V},_drawRoundedBar:function(k,A,T,R,F,O,W){if(O=Math.min(O,Math.min(Math.abs(R),Math.abs(F))/2),O<=0||R===0||F===0){k.rect(A,T,R,F);return}k.beginPath(),W?(k.moveTo(A,T+F),k.lineTo(A,T+O),k.quadraticCurveTo(A,T,A+O,T),k.lineTo(A+R-O,T),k.quadraticCurveTo(A+R,T,A+R,T+O),k.lineTo(A+R,T+F),k.lineTo(A,T+F)):(k.moveTo(A,T),k.lineTo(A+R-O,T),k.quadraticCurveTo(A+R,T,A+R,T+O),k.lineTo(A+R,T+F-O),k.quadraticCurveTo(A+R,T+F,A+R-O,T+F),k.lineTo(A,T+F),k.lineTo(A,T)),k.closePath()}},a=i.width,r=i.height,c=-a/2,d=-r/2;if(!i.datasets||i.datasets.length===0||i.categories.length===0){t.save(),t.fillStyle="rgba(99,102,241,0.7)",t.font="bold 11px Inter, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("NO CHART DATA",0,0),t.restore();return}let p=-1/0,u=1/0;const g=i.categories.length,h=i.datasets.length;if(i.chartType==="stacked")for(let k=0;k<g;k++){let A=0,T=0;i.datasets.forEach(R=>{const F=R.data[k]??0;F>=0?A+=F:T+=F}),A>p&&(p=A),T<u&&(u=T)}else i.datasets.forEach(k=>{k.data&&k.data.forEach(A=>{A>p&&(p=A),A<u&&(u=A)})});isFinite(p)||(p=10),isFinite(u)||(u=0),p=Math.max(p,0),u=Math.min(u,0);const f=p-u||10;t.save(),i.enableShadows&&(t.shadowColor=i.shadowColor,t.shadowBlur=i.shadowBlur,t.shadowOffsetY=i.shadowOffsetY),t.font=i.axisLabelFontSize+"px Inter, sans-serif";const v=i.showYLabels?t.measureText(p.toFixed(0)).width+14:10,m=i.showXLabels?i.axisLabelFontSize+12:8,b=(i.showLegend&&h>0?i.legendFontSize+10:0)+8,S=10,w=c+v,C=d+b,M=a-v-S,I=r-b-m;if(i.enableShadows&&(t.shadowColor="transparent"),t.beginPath(),t.roundRect(c,d,a,r,10),t.fillStyle=i._hexToRgb(i.cardBackground,i.cardBackgroundOpacity),t.fill(),t.strokeStyle=i.cardBorderColor,t.lineWidth=1,t.stroke(),i.showLegend&&h>0){t.font=i.legendFontSize+"px Inter, sans-serif",t.textBaseline="middle";const k=d+12;let A=w;i.datasets.forEach((T,R)=>{const F=i._resolveColor(T.color,R),O=T.label||"Series "+(R+1),W=7;t.beginPath(),t.roundRect(A,k-W/2,W,W,2),t.fillStyle=F,t.fill(),t.fillStyle=i.legendColor,t.textAlign="left",t.fillText(O,A+W+4,k),A+=t.measureText(O).width+W+16})}const _=4;if(i.showGridLines){t.setLineDash(i.gridLineDash||[]),t.lineWidth=i.gridLineWidth||1,t.strokeStyle=i.gridColor;for(let k=0;k<=_;k++)if(i.orientation==="horizontal"){const A=w+k/_*M;t.beginPath(),t.moveTo(A,C),t.lineTo(A,C+I),t.stroke()}else{const A=C+k/_*I;t.beginPath(),t.moveTo(w,A),t.lineTo(w+M,A),t.stroke()}t.setLineDash([])}if(i.showYLabels){t.font=i.axisLabelFontSize+"px Inter, sans-serif",t.textAlign="right",t.textBaseline="middle",t.fillStyle=i.axisLabelColor;for(let k=0;k<=_;k++)if(i.orientation==="horizontal"){const A=u+k/_*f,T=w+k/_*M;t.textAlign="center",t.fillText(A.toFixed(0),T,C+I+i.axisLabelFontSize)}else{const A=p-k/_*f,T=C+k/_*I;t.textAlign="right",t.fillText(A.toFixed(0),w-6,T)}}if(t.setLineDash([]),i.showXAxis&&(t.lineWidth=i.xAxisLineWidth||1,t.strokeStyle=i.xAxisColor,t.beginPath(),t.moveTo(w,C+I),t.lineTo(w+M,C+I),t.stroke()),i.showYAxis&&(t.lineWidth=i.yAxisLineWidth||1,t.strokeStyle=i.yAxisColor,t.beginPath(),t.moveTo(w,C),t.lineTo(w,C+I),t.stroke()),i.enableShadows&&(t.shadowColor=i.shadowColor),i.chartType==="stacked")if(i.orientation==="horizontal"){const k=I/g;for(let A=0;A<g;A++){const T=C+A*k+k/2;i.showXLabels&&(t.font=i.axisLabelFontSize+"px Inter, sans-serif",t.textAlign="right",t.textBaseline="middle",t.fillStyle=i.axisLabelColor,t.shadowColor="transparent",t.fillText(i.categories[A]||"",w-5,T),i.enableShadows&&(t.shadowColor=i.shadowColor));let R=w;i.datasets.forEach((F,O)=>{const W=F.data[A]??0;if(W===0)return;const V=W/f*M,U=Math.min(i.barWidth*h+i.barGap,k-8),Y=T-U/2,X=R;R+=V;const ot=i._resolveColor(F.color,O);t.beginPath(),t.fillStyle=i._makeGradient(t,ot,X,Y,X+V,Y),i._drawRoundedBar(t,X,Y,V,U,O===h-1?i.barCornerRadius:0,!1),i.barStyle==="outline"||i.barStyle==="dashed"?(t.fillStyle="transparent",t.strokeStyle=i.barBorderColor==="auto"?ot:i.barBorderColor,t.lineWidth=i.barBorderWidth,i.barStyle==="dashed"&&t.setLineDash([4,4]),t.stroke(),t.setLineDash([])):t.fill()})}}else{const k=M/g;for(let A=0;A<g;A++){const T=w+A*k+k/2;i.showXLabels&&(t.font=i.axisLabelFontSize+"px Inter, sans-serif",t.textAlign="center",t.textBaseline="top",t.fillStyle=i.axisLabelColor,t.shadowColor="transparent",t.fillText(i.categories[A]||"",T,C+I+5),i.enableShadows&&(t.shadowColor=i.shadowColor));let R=C+I;i.datasets.forEach((F,O)=>{const W=F.data[A]??0;if(W===0)return;const V=W/f*I,U=Math.min(i.barWidth*h+i.barGap,k-8),Y=T-U/2,X=R-V;R-=V;const ot=i._resolveColor(F.color,O);t.beginPath(),t.fillStyle=i._makeGradient(t,ot,Y,X,Y,X+V),i._drawRoundedBar(t,Y,X,U,V,O===h-1?i.barCornerRadius:0,!0),i.barStyle==="outline"||i.barStyle==="dashed"?(t.fillStyle="transparent",t.strokeStyle=i.barBorderColor==="auto"?ot:i.barBorderColor,t.lineWidth=i.barBorderWidth,i.barStyle==="dashed"&&t.setLineDash([4,4]),t.stroke(),t.setLineDash([])):t.fill()})}}else if(i.orientation==="horizontal"){const k=I/g,A=h*i.barWidth+Math.max(0,(h-1)*i.barGap),T=w+(0-u)/f*M;for(let R=0;R<g;R++){const F=C+R*k+k/2;i.showXLabels&&(t.font=i.axisLabelFontSize+"px Inter, sans-serif",t.textAlign="right",t.textBaseline="middle",t.fillStyle=i.axisLabelColor,t.shadowColor="transparent",t.fillText(i.categories[R]||"",w-5,F),i.enableShadows&&(t.shadowColor=i.shadowColor));const O=F-A/2;i.datasets.forEach((W,V)=>{const U=W.data[R]??0,Y=Math.abs(U/f*M);if(Y<1)return;const X=O+V*(i.barWidth+i.barGap),ot=U>=0?T:T-Y,J=i._resolveColor(W.color,V);t.beginPath(),t.fillStyle=i._makeGradient(t,J,ot,X,ot+Y,X),i._drawRoundedBar(t,ot,X,Y,i.barWidth,i.barCornerRadius,!1),i.barStyle==="outline"||i.barStyle==="dashed"?(t.fillStyle="transparent",t.strokeStyle=i.barBorderColor==="auto"?J:i.barBorderColor,t.lineWidth=i.barBorderWidth,i.barStyle==="dashed"&&t.setLineDash([4,4]),t.stroke(),t.setLineDash([])):t.fill(),i.showValueOnTop&&U!==0&&(t.font=(i.valueFontWeight||"bold")+" "+(i.valueFontSize||10)+"px Inter, sans-serif",t.textAlign=U>=0?"left":"right",t.textBaseline="middle",t.fillStyle=i.valueColor==="auto"?J:i.valueColor||"#fff",t.shadowColor="transparent",t.fillText(U.toString(),U>=0?ot+Y+4:ot-4,X+i.barWidth/2),i.enableShadows&&(t.shadowColor=i.shadowColor))})}}else{const k=M/g,A=h*i.barWidth+Math.max(0,(h-1)*i.barGap),T=C+I-(0-u)/f*I;for(let R=0;R<g;R++){const F=w+R*k+k/2;i.showXLabels&&(t.font=i.axisLabelFontSize+"px Inter, sans-serif",t.textAlign="center",t.textBaseline="top",t.fillStyle=i.axisLabelColor,t.shadowColor="transparent",t.fillText(i.categories[R]||"",F,C+I+5),i.enableShadows&&(t.shadowColor=i.shadowColor));const O=F-A/2;i.datasets.forEach((W,V)=>{const U=W.data[R]??0,Y=Math.abs(U/f*I);if(Y<1)return;const X=O+V*(i.barWidth+i.barGap),ot=U>=0?T-Y:T,J=i._resolveColor(W.color,V);t.beginPath(),t.fillStyle=i._makeGradient(t,J,X,ot,X,ot+Y),i._drawRoundedBar(t,X,ot,i.barWidth,Y,i.barCornerRadius,!0),i.barStyle==="outline"||i.barStyle==="dashed"?(t.fillStyle="transparent",t.strokeStyle=i.barBorderColor==="auto"?J:i.barBorderColor,t.lineWidth=i.barBorderWidth,i.barStyle==="dashed"&&t.setLineDash([4,4]),t.stroke(),t.setLineDash([])):t.fill(),i.showValueOnTop&&U!==0&&(t.font=(i.valueFontWeight||"bold")+" "+(i.valueFontSize||10)+"px Inter, sans-serif",t.textAlign="center",t.textBaseline=U>=0?"bottom":"top",t.fillStyle=i.valueColor==="auto"?J:i.valueColor||"#fff",t.shadowColor="transparent",t.fillText(U.toString(),X+i.barWidth/2,U>=0?ot-4:ot+Y+4),i.enableShadows&&(t.shadowColor=i.shadowColor))})}}t.restore()}renderPieChart(t,s){var l,b;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.options)||s.options||{},n=e.colorPalette==="custom"&&Array.isArray(e.customPalette)&&e.customPalette.length>0?e.customPalette:us[e.colorPalette||"vibrant"]||us.vibrant;let i=e.slices||[{id:"slice-1",label:"Item 1",value:45,color:""}];if(e.isDataVarEnabled&&e.dataInputId){let S=this.inputs.get(e.dataInputId);if(S===void 0){const w=this.inputNameMap.get(e.dataInputId);w&&w.length>0&&(S=this.inputs.get(w[0]))}S&&Array.isArray(S)&&(i=S.map((w,C)=>{var M,I;return{id:`slice-${C}`,label:((M=i[C])==null?void 0:M.label)||`Item ${C+1}`,value:typeof w=="number"?w:0,color:((I=i[C])==null?void 0:I.color)||""}}))}const a={width:((l=s.geometry)==null?void 0:l.width)||180,height:((b=s.geometry)==null?void 0:b.height)||180,chartType:e.chartType||"donut",slices:i,innerRadius:e.innerRadius!==void 0?e.innerRadius:.55,sliceGap:e.sliceGap!==void 0?e.sliceGap:3,showLabels:!!e.showLabels,labelColor:e.labelColor||"#000000",labelFontSize:e.labelFontSize||10,showLegend:e.showLegend!==void 0?!!e.showLegend:!0,legendColor:e.legendColor||"rgba(0,0,0,0.65)",legendFontSize:e.legendFontSize||9,showCenterText:e.showCenterText!==void 0?!!e.showCenterText:!0,centerLabel:e.centerLabel||"Total",centerTextColor:e.centerTextColor||"#000000",centerLabelColor:e.centerLabelColor||"rgba(0,0,0,0.4)",cardBackground:e.cardBackground||"#ffffff",cardBackgroundOpacity:e.cardBackgroundOpacity!==void 0?e.cardBackgroundOpacity:.04,cardBorderColor:e.cardBorderColor||"rgba(0,0,0,0.08)",_resolveSliceColor:function(S,w){return S.color?S.color:n[w%n.length]},_hexToRgb:function(S){if(S.startsWith("rgba")||S.startsWith("rgb"))return S;const w=S.replace("#",""),C=parseInt(w.substring(0,2),16),M=parseInt(w.substring(2,4),16),I=parseInt(w.substring(4,6),16);return`rgba(${C},${M},${I},${a.cardBackgroundOpacity})`}},r=a.width,c=a.height;if(!a.slices||a.slices.length===0){t.save(),t.fillStyle="rgba(99,102,241,0.8)",t.font="bold 11px Inter, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("NO PIE DATA",0,0),t.restore();return}const d=a.slices.reduce((S,w)=>S+(w.value||0),0);if(d<=0){t.save(),t.fillStyle="rgba(99,102,241,0.8)",t.font="bold 11px Inter, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("EMPTY DATA",0,0),t.restore();return}t.save();const p=a._hexToRgb(a.cardBackground);t.beginPath(),t.roundRect(-r/2,-c/2,r,c,10),t.fillStyle=p,t.fill(),t.strokeStyle=a.cardBorderColor,t.lineWidth=1,t.stroke();const u=a.showLegend?Math.ceil(a.slices.length/2):0,g=u>0?u*(a.legendFontSize+8)+10:0,h=c-g-16,f=Math.min(r-24,h)/2,v=0,m=-g/2;if(a.chartType==="rose"){const S=Math.max(...a.slices.map(M=>M.value||0)),w=Math.PI*2/a.slices.length,C=f>0?a.sliceGap/f:0;a.slices.forEach((M,I)=>{const _=M.value||0;if(_===0)return;const E=_/S*f,P=-Math.PI/2+I*w+C/2,L=P+w-C,k=a._resolveSliceColor(M,I);if(t.beginPath(),t.moveTo(v,m),t.arc(v,m,E,P,L),t.closePath(),t.fillStyle=k+"cc",t.fill(),t.strokeStyle=k,t.lineWidth=1.5,t.stroke(),a.showLabels){const A=P+(L-P)/2,T=v+E*.65*Math.cos(A),R=m+E*.65*Math.sin(A),F=Math.round(_/d*100);t.save(),t.font=`bold ${a.labelFontSize}px Inter, sans-serif`,t.fillStyle=a.labelColor,t.textAlign="center",t.textBaseline="middle",t.fillText(`${F}%`,T,R),t.restore()}})}else{const S=a.chartType==="pie"?0:a.innerRadius,w=f*Math.max(0,S),C=f>0?a.sliceGap/f:0;let M=-Math.PI/2;if(a.slices.forEach((I,_)=>{const E=I.value||0;if(E===0){M+=E/d*Math.PI*2;return}const P=E/d*Math.PI*2,L=M+C/2,k=M+P-C/2;if(k<=L){M+=P;return}const A=a._resolveSliceColor(I,_);if(t.beginPath(),t.fillStyle=A,w<=0?(t.moveTo(v,m),t.arc(v,m,f,L,k),t.lineTo(v,m)):(t.moveTo(v+f*Math.cos(L),m+f*Math.sin(L)),t.arc(v,m,f,L,k),t.arc(v,m,w,k,L,!0),t.closePath()),t.fill(),a.showLabels){const T=L+(k-L)/2,R=w+(f-w)/2,F=v+R*Math.cos(T),O=m+R*Math.sin(T),W=Math.round(E/d*100);t.save(),t.font=`bold ${a.labelFontSize}px Inter, sans-serif`,t.fillStyle=a.labelColor,t.textAlign="center",t.textBaseline="middle",t.fillText(`${W}%`,F,O),t.restore()}M+=P}),a.chartType==="donut"&&a.showCenterText&&w>14){const I=Math.round(d),_=Math.min(Math.floor(w*.52),20),E=Math.min(Math.floor(w*.26),10);t.textAlign="center",t.textBaseline="middle",t.font=`bold ${_}px Inter, sans-serif`,t.fillStyle=a.centerTextColor,t.fillText(I.toString(),v,m-E*.5),t.font=`${E}px Inter, sans-serif`,t.fillStyle=a.centerLabelColor,t.fillText(a.centerLabel,v,m+_*.6)}}if(a.showLegend&&a.slices.length>0){t.font=`${a.legendFontSize}px Inter, sans-serif`;const S=2,w=r/S,C=a.legendFontSize+8,M=c/2-g+10,I=-r/2+10;a.slices.forEach((_,E)=>{const P=E%S,L=Math.floor(E/S),k=I+P*w,A=M+L*C,T=a._resolveSliceColor(_,E),R=7;t.beginPath(),t.roundRect(k,A-R/2,R,R,2),t.fillStyle=T,t.fill(),t.textAlign="left",t.textBaseline="middle",t.fillStyle=a.legendColor;const F=Math.round((_.value||0)/d*100),O=`${_.label||"Item"} ${F}%`,W=w-R-20;let V=O;for(;t.measureText(V).width>W&&V.length>4;)V=V.slice(0,-4)+"…";t.fillText(V,k+R+4,A)})}t.restore()}renderJoystick(t,s){var v,m,l,b,S,w,C,M,I,_,E,P;const o=this.objectStates.get(s.id),e=(o==null?void 0:o.width)!==void 0?o.width:((v=s.geometry)==null?void 0:v.width)??s.width??100,n=(o==null?void 0:o.height)!==void 0?o.height:((m=s.geometry)==null?void 0:m.height)??s.height??100,i=Math.min(e,n)*(((l=s.style)==null?void 0:l.baseSize)??.45),a=Math.min(e,n)*(((b=s.style)==null?void 0:b.handleSize)??.14);let r=s.handleX||0,c=s.handleY||0;o&&o.handleX!==void 0&&(r=o.handleX),o&&o.handleY!==void 0&&(c=o.handleY),t.save();let d=0,p=0;s.handleOrigin==="top-left"?(d=e/2,p=n/2):s.handleOrigin==="bottom-right"&&(d=-e/2,p=-n/2),t.translate(d,p);const u=t.globalAlpha;if(t.globalAlpha=u*(((S=s.style)==null?void 0:S.baseOpacity)??1),t.beginPath(),s.boundsShape==="square"){const L=s.joystickType==="2D"?12:18;t.roundRect(-i,-i,i*2,i*2,L)}else t.arc(0,0,i,0,Math.PI*2);t.fillStyle=((w=s.style)==null?void 0:w.baseColor)||"rgba(0,0,0,0.04)",t.fill(),(C=s.style)!=null&&C.baseBorderWidth?(t.lineWidth=s.style.baseBorderWidth,t.strokeStyle=s.style.baseBorderColor||"rgba(0,0,0,0.1)",t.stroke()):(t.lineWidth=1,t.strokeStyle=((M=s.style)==null?void 0:M.baseBorderColor)||"rgba(0,0,0,0.08)",t.stroke());const g=s.overflowHandle?i:Math.max(.1,i-a);let h=0,f=0;s.joystickType==="2D"?(h=r*g,f=c*g):s.joystickType==="1D_X"?(h=r*g,f=0):s.joystickType==="1D_Y"&&(h=0,f=c*g),t.globalAlpha=u*(((I=s.style)==null?void 0:I.handleOpacity)??1),t.beginPath(),t.arc(h,f,a,0,Math.PI*2),t.fillStyle=((_=s.style)==null?void 0:_.handleColor)||"#3b82f6",t.fill(),(E=s.style)!=null&&E.handleBorderWidth?(t.lineWidth=s.style.handleBorderWidth,t.strokeStyle=s.style.handleBorderColor||"rgba(255,255,255,0.5)",t.stroke()):(t.lineWidth=1,t.strokeStyle=((P=s.style)==null?void 0:P.handleBorderColor)||"rgba(255,255,255,0.5)",t.stroke()),t.globalAlpha=u,t.restore()}getRadioGroupItemIndexAtPointer(t,s,o){var I,_;const e=t.options||{},n=this.objectStates.get(t.id)||{},i=e.optionsList||[];if(i.length===0)return null;const a=n.width!==void 0?n.width:((I=t.geometry)==null?void 0:I.width)||180,r=n.height!==void 0?n.height:((_=t.geometry)==null?void 0:_.height)||100,c=e.orientation||"vertical",d=e.itemGap!==void 0?e.itemGap:16,p=e.fontSize||14,u=this.getWorldTransform(t.id),g=s-u.x,h=o-u.y,f=-u.rotation*(Math.PI/180),v=Math.cos(f),m=Math.sin(f),l=g*v-h*m,b=g*m+h*v,w=8*2,C=-a/2,M=-r/2;if(c==="vertical"){const E=Math.max(w,p)+d;for(let P=0;P<i.length;P++){const L=M+P*E;if(l>=C&&l<=C+a&&b>=L&&b<=L+E)return P}}else{let E=C;for(let P=0;P<i.length;P++){const k=i[P].length*8,A=w+6+k+d;if(l>=E&&l<=E+A&&b>=M&&b<=M+r)return P;E+=A}}return null}renderLineGraph(t,s,o,e){let n=s.datasets||[];if((!n||n.length===0)&&(s.data||s.graphData)&&(n=[{id:"line-1",label:"Series 1",data:s.data||s.graphData||[],lineColor:s.lineColor||"#3b82f6",lineWidth:s.lineWidth||2,showArea:s.showArea||!1,areaColor:s.areaColor||"rgba(139, 92, 246, 0.3)",smoothing:s.smoothing||!1,showPoints:s.showPoints!==void 0?s.showPoints:!0,pointSize:s.pointSize||6,pointFill:s.pointFill||"#ffffff",pointStrokeColor:s.pointStrokeColor||s.lineColor||"#3b82f6",pointStrokeWidth:s.pointStrokeWidth||2}]),!n||n.length===0||!n.some(f=>f.data&&f.data.length>=2)){t.save(),t.fillStyle="#6366f1",t.font="12px Inter, system-ui, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("NO DATA",0,0),t.restore();return}let i=1/0,a=-1/0,r=0;if(n.forEach(f=>{let v=f.data;if(f.isVarEnabled&&f.inputId){let m=this.inputs.get(f.inputId);if(m===void 0){const l=this.inputNameMap.get(f.inputId);l&&l.length>0&&(m=this.inputs.get(l[0]))}m&&Array.isArray(m)&&(v=m)}if(v&&v.length>0){const m=v.filter(l=>typeof l=="number"&&!isNaN(l));m.length>0&&(i=Math.min(i,...m),a=Math.max(a,...m),r=Math.max(r,v.length))}f._resolvedData=v}),r<2)return;const c=a-i,d=o/(r-1),p=f=>{const v=c===0?.5:(f-i)/c;return e/2-v*e},u=f=>f*d-o/2,g=s.axisColor||"#333333";if(s.showXAxis&&(t.beginPath(),t.strokeStyle=s.xAxisColor||g,t.lineWidth=1,t.moveTo(-o/2,e/2),t.lineTo(o/2,e/2),t.stroke()),s.showYAxis&&(t.beginPath(),t.strokeStyle=s.yAxisColor||g,t.lineWidth=1,t.moveTo(-o/2,-e/2),t.lineTo(-o/2,e/2),t.stroke()),t.fillStyle=s.axisLabelColor||"#333333",t.font=`${s.axisLabelFontSize||10}px Inter, sans-serif`,s.showXLabels){t.textAlign="center",t.textBaseline="top";for(let f=0;f<r;f++){const v=u(f);t.fillText(`${f+1}`,v,e/2+5)}}if(s.showYLabels){t.textAlign="right",t.textBaseline="middle";const f=-o/2-5,v=(a+i)/2;t.fillText(a.toFixed(1),f,p(a)),t.fillText(v.toFixed(1),f,p(v)),t.fillText(i.toFixed(1),f,p(i))}const h=10;if(n.forEach(f=>{const v=f._resolvedData;if(!(!v||v.length<2)){if(f.showArea){if(t.beginPath(),t.moveTo(u(0),e/2),t.lineTo(u(0),p(v[0])),f.smoothing&&v.length>2)for(let l=0;l<v.length-1;l++){const b=v[l===0?l:l-1],S=v[l],w=v[l+1],C=v[l+1===v.length-1?l+1:l+2];for(let M=1;M<=h;M++){const I=M/h,_=this._catmullRom(b,S,w,C,I);t.lineTo(u(l+I),p(_))}}else for(let l=1;l<v.length;l++)t.lineTo(u(l),p(v[l]));t.lineTo(u(v.length-1),e/2),t.closePath();const m=t.globalAlpha;t.globalAlpha=m*(s.areaOpacity??.3),t.fillStyle=f.areaColor||"rgba(139, 92, 246, 0.2)",t.fill(),t.globalAlpha=m}if(t.beginPath(),t.strokeStyle=f.lineColor||"#3b82f6",t.lineWidth=f.lineWidth||2,t.lineJoin="round",t.lineCap="round",t.moveTo(u(0),p(v[0])),f.smoothing&&v.length>2)for(let m=0;m<v.length-1;m++){const l=v[m===0?m:m-1],b=v[m],S=v[m+1],w=v[m+1===v.length-1?m+1:m+2];for(let C=1;C<=h;C++){const M=C/h,I=this._catmullRom(l,b,S,w,M);t.lineTo(u(m+M),p(I))}}else for(let m=1;m<v.length;m++)t.lineTo(u(m),p(v[m]));t.stroke(),f.showPoints&&v.forEach((m,l)=>{const b=u(l),S=p(m);t.beginPath(),t.arc(b,S,(f.pointSize||6)/2,0,Math.PI*2),t.fillStyle=f.pointFill||"#ffffff",t.fill(),t.strokeStyle=f.pointStrokeColor||f.lineColor||"#3b82f6",t.lineWidth=f.pointStrokeWidth||1,t.stroke()})}}),s.showLegend&&n.length>0){const f=o/2-10;let v=-e/2+15;const m=s.legendFontSize||10,l=m+5;t.font=`${m}px Inter, sans-serif`,t.textAlign="right",t.textBaseline="alphabetic",n.forEach(b=>{const w=b.label||"Series",C=t.measureText(w).width;t.beginPath(),t.rect(f-C-8-5,v-(8/2+2),8,8),t.fillStyle=b.lineColor||"#3b82f6",t.fill(),t.fillStyle=s.legendColor||"#333333",t.fillText(w,f,v),v+=l})}}_catmullRom(t,s,o,e,n){const i=(o-t)*.5,a=(e-s)*.5,r=n*n,c=n*r;return(2*s-2*o+i+a)*c+(-3*s+3*o-2*i-a)*r+i*n+s}normalizeOpacity(t){const s=typeof t=="number"?t:parseFloat(String(t));return isNaN(s)?1:s>1?Math.min(1,s/100):Math.max(0,Math.min(1,s))}createCanvasFill(t,s,o,e){var n,i,a;if(!s||s.type==="None")return null;if(typeof s=="string")return s;if(s.type==="Solid"&&s.color){const r=s.color,d=(((i=(n=this.artboard)==null?void 0:n.tokens)==null?void 0:i.colors)||{})[r]||r;return t.fillStyle=d,d}if((s.type==="LinearGradient"||s.type==="RadialGradient"||s.type==="AngularGradient"||s.type==="DiamondGradient")&&s.stops){const r=(c,d=100)=>{var S,w;const u=(((w=(S=this.artboard)==null?void 0:S.tokens)==null?void 0:w.colors)||{})[c]||c,g=this.normalizeOpacity(s.opacity??100),f=this.normalizeOpacity(d)*g;if(f>=1&&u.startsWith("#"))return u;const v=u.startsWith("#")?u.replace("#",""):"ffffff",m=parseInt(v.substring(0,2),16),l=parseInt(v.substring(2,4),16),b=parseInt(v.substring(4,6),16);return`rgba(${m}, ${l}, ${b}, ${f})`};if(s.type==="LinearGradient"){let c=0,d=-e/2,p=0,u=e/2;if(s.angle!==void 0&&(!s.start||!s.end)){const h=(s.angle-90)*Math.PI/180,f=Math.max(o,e)/2;c=Math.cos(h)*-f,d=Math.sin(h)*-f,p=Math.cos(h)*f,u=Math.sin(h)*f}else if(s.start||s.end){const h=(f,v,m)=>Array.isArray(f)?f[v]??.5:f&&typeof f=="object"?f[m]??.5:.5;c=h(s.start,0,"x")*o-o/2,d=h(s.start,1,"y")*e-e/2,p=h(s.end,0,"x")*o-o/2,u=h(s.end,1,"y")*e-e/2}Math.abs(c-p)<.001&&Math.abs(d-u)<.001&&(c=0,d=-e/2,p=0,u=e/2);const g=t.createLinearGradient(c,d,p,u);if(s.stops.forEach(h=>{const f=h.offset!==void 0?h.offset:h.pos!==void 0?h.pos:h.position!==void 0?h.position:0,v=r(h.color||"#000000",h.opacity??100);g.addColorStop(Math.max(0,Math.min(1,f)),v)}),s.gradientTransform&&g.setTransform){const[h,f,v,m,l,b]=s.gradientTransform;g.setTransform({a:h,b:f,c:v,d:m,e:l,f:b})}return g}else if(s.type==="RadialGradient"){const c=(h,f,v)=>Array.isArray(h)?h[f]??.5:h&&typeof h=="object"?h[v]??.5:.5,d=c(s.center,0,"x")*o-o/2,p=c(s.center,1,"y")*e-e/2,u=(s.radius??.5)*Math.max(o,e),g=t.createRadialGradient(d,p,0,d,p,u);if(s.stops.forEach(h=>{const f=h.offset!==void 0?h.offset:h.pos!==void 0?h.pos:h.position!==void 0?h.position:0,v=r(h.color||"#000000",h.opacity??100);g.addColorStop(Math.max(0,Math.min(1,f)),v)}),s.gradientTransform&&g.setTransform){const[h,f,v,m,l,b]=s.gradientTransform;g.setTransform({a:h,b:f,c:v,d:m,e:l,f:b})}return g}else if(s.type==="AngularGradient"){const c=(h,f,v)=>Array.isArray(h)?h[f]??.5:h&&typeof h=="object"?h[v]??.5:.5,d=c(s.center||[.5,.5],0,"x")*o-o/2,p=c(s.center||[.5,.5],1,"y")*e-e/2,u=(s.degree||s.angle||0)*(Math.PI/180),g=(a=t.createConicGradient)==null?void 0:a.call(t,u,d,p);if(g){if(s.stops.forEach(h=>{const f=h.offset!==void 0?h.offset:h.pos!==void 0?h.pos:h.position!==void 0?h.position:0,v=r(h.color||"#000000",h.opacity??100);g.addColorStop(Math.max(0,Math.min(1,f)),v)}),s.gradientTransform&&g.setTransform){const[h,f,v,m,l,b]=s.gradientTransform;g.setTransform({a:h,b:f,c:v,d:m,e:l,f:b})}return g}}else if(s.type==="DiamondGradient"){const c=(h,f,v)=>Array.isArray(h)?h[f]??.5:h&&typeof h=="object"?h[v]??.5:.5,d=c(s.center||[.5,.5],0,"x")*o-o/2,p=c(s.center||[.5,.5],1,"y")*e-e/2,u=(s.radius??.5)*Math.max(o,e);t.save(),t.translate(d,p),t.rotate(Math.PI/4);const g=t.createRadialGradient(0,0,0,0,0,u);if(s.stops.forEach(h=>{const f=h.offset!==void 0?h.offset:h.pos!==void 0?h.pos:h.position!==void 0?h.position:0,v=r(h.color||"#000000",h.opacity??100);g.addColorStop(Math.max(0,Math.min(1,f)),v)}),s.gradientTransform&&g.setTransform){const[h,f,v,m,l,b]=s.gradientTransform;g.setTransform({a:h,b:f,c:v,d:m,e:l,f:b})}return t.scale(1/Math.SQRT2,1/Math.SQRT2),t.fillStyle=g,t.restore(),g}}if(s.type==="Pattern"&&s.url){let r=this.imageCache.get(s.url);if(r||(r=new Image,r.src=s.url,this.imageCache.set(s.url,r)),r.complete&&r.naturalWidth>0){const c=t.createPattern(r,"repeat");if(c&&(s.scaleX!==void 0||s.offsetX!==void 0)){const d=new DOMMatrix,p=s.scaleX??1,u=s.scaleY??1,g=s.offsetX??0,h=s.offsetY??0,f=s.rotation??0;d.translateSelf(g,h),d.rotateSelf(f),d.scaleSelf(p,u),c.setTransform(d)}return c}}return s.color||null}drawRoundRect(t,s,o,e,n,i){if(i===0||i===void 0||i===null){t.rect(s,o,e,n);return}let a=i;if(typeof a=="string")try{a=JSON.parse(a)}catch{a=parseFloat(a)||0}let r=0,c=0,d=0,p=0;typeof a=="number"?r=c=d=p=a:Array.isArray(a)?a.length===1?r=c=d=p=a[0]:a.length===2?(r=d=a[0],c=p=a[1]):a.length===3?(r=a[0],c=p=a[1],d=a[2]):a.length>=4&&(r=a[0],c=a[1],d=a[2],p=a[3]):a&&typeof a=="object"&&(r=a[0]??a.tl??a.corner_radius??a.cornerRadius??0,c=a[1]??a.tr??a.corner_radius??a.cornerRadius??0,d=a[2]??a.br??a.corner_radius??a.cornerRadius??0,p=a[3]??a.bl??a.corner_radius??a.cornerRadius??0);const u=Math.min(Math.abs(e)/2,Math.abs(n)/2);if(r=Math.min(Math.max(0,r),u),c=Math.min(Math.max(0,c),u),d=Math.min(Math.max(0,d),u),p=Math.min(Math.max(0,p),u),t.roundRect){t.roundRect(s,o,e,n,[r,c,d,p]);return}t.moveTo(s+r,o),t.lineTo(s+e-c,o),t.arcTo(s+e,o,s+e,o+c,c),t.lineTo(s+e,o+n-d),t.arcTo(s+e,o+n,s+e-d,o+n,d),t.lineTo(s+p,o+n),t.arcTo(s,o+n,s,o+n-p,p),t.lineTo(s,o+r),t.arcTo(s,o,s+r,o,r),t.closePath()}renderListView(t,s){var T,R,F,O,W,V,U,Y,X,ot;const o=this.objectStates.get(s.id)||{},e=o.options||s.options||{},n=o.width!==void 0?o.width:((T=s.geometry)==null?void 0:T.width)||200,i=o.height!==void 0?o.height:((R=s.geometry)==null?void 0:R.height)||300,a=-n/2,r=-i/2,c=e.cornerRadius!==void 0?e.cornerRadius:o.cornerRadius!==void 0?o.cornerRadius:o.corner_radius??e.corner_radius??((F=s.geometry)==null?void 0:F.cornerRadius)??((O=s.geometry)==null?void 0:O.corner_radius)??0,d=e.orientation||"vertical",p=this.getResolvedListViewItems(s,e),u=e.itemGap??10,g=e.itemHeight??50,h=e.itemWidth??200,f=e.scrollOffset??0,v=e.padding??0,m=e.glassEffect!==!1,l=e.accentColor||"#3b82f6",b=e.itemTextColor||"#333333",S=e.itemBackgroundColor||"#ffffff",w=e.hoveredIndex??null,C=e.activeItemIndex??null,M=e.glowIntensity??0,I=e.glowColor||"#3b82f6",_=typeof I=="string"?I:I.color||((V=(W=I.stops)==null?void 0:W[0])==null?void 0:V.color)||"#3b82f6",E=e.opacity!==void 0?e.opacity:s.opacity!==void 0?s.opacity:1;if(t.save(),t.globalAlpha*=E,M>0){const J=t.getTransform(),at=Math.sqrt(J.a*J.a+J.b*J.b)||1;t.shadowColor=_,t.shadowBlur=M*2*at,t.shadowOffsetX=0,t.shadowOffsetY=0}if(m){const J=e.listBackgroundColor||"rgba(31, 41, 55, 0.4)",at=this.createCanvasFill(t,J,n,i);t.fillStyle=at||"rgba(31, 41, 55, 0.4)",t.beginPath(),this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c)||t.fill();const it=t.createLinearGradient(a,r,a+n,r+i);it.addColorStop(0,"rgba(255, 255, 255, 0.15)"),it.addColorStop(.5,"rgba(255, 255, 255, 0.08)"),it.addColorStop(1,"rgba(255, 255, 255, 0.03)"),t.fillStyle=it,t.beginPath(),this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c)||t.fill();const D=e.borderWidth??0;if(D>0&&e.borderColor&&e.borderColor!=="transparent"){const ct=this.createCanvasFill(t,e.borderColor,n,i);t.strokeStyle=ct||"rgba(255, 255, 255, 0.25)",t.lineWidth=D}else t.strokeStyle="rgba(255, 255, 255, 0.25)",t.lineWidth=1;t.beginPath(),this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c)||t.stroke()}else{const J=e.backgroundColor&&e.backgroundColor!=="transparent"?e.backgroundColor:e.listBackgroundColor||"transparent",at=this.createCanvasFill(t,J,n,i);if(at){t.fillStyle=at,t.beginPath();const it=this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c);t.fill()}const j=e.borderWidth??0;if(j>0){const it=this.createCanvasFill(t,e.borderColor||"#cccccc",n,i);t.strokeStyle=it||"#cccccc",t.lineWidth=j,t.beginPath();const x=this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c);t.stroke()}}t.shadowBlur=0;const P=e.clipContent!==!1&&e.listLayout!=="circular";if(P)if(t.save(),t.beginPath(),this.drawCustomShape(t,e.containerShape||"rectangle",e.containerPath||"",a,r,n,i,c)&&e.containerShape==="custom")try{const at=new Path2D(e.containerPath);t.translate(a,r),t.scale(n/100,i/100),t.clip(at),t.scale(100/n,100/i),t.translate(-a,-r)}catch{}else t.clip();const L=typeof v=="number"?v:d==="vertical"?v[0]:v[3];let k=(d==="vertical"?r:a)+f+L;if(t.textBaseline="middle",p.forEach((J,at)=>{var ft,xt,At,Pt;const j=e.listLayout||"linear",it=j==="circular"?h:d==="vertical"?n:h,x=j==="circular"||d==="vertical"?g:i;let D=0,N=0,ct=0;if(j==="circular"){const vt=p.length||1,Xt=Math.PI*2/vt,zt=e.circularStartAngle||0,Gt=e.circularRadius||100,Yt=f*.01+zt*Math.PI/180,te=at*Xt+Yt,ie=a+n/2,ce=r+i/2;D=ie+Math.cos(te)*Gt-it/2,N=ce+Math.sin(te)*Gt-x/2,ct=te+(e.itemRotation||0)*Math.PI/180}else D=d==="vertical"?a:k,N=d==="vertical"?k:r,ct=(e.itemRotation||0)*Math.PI/180;const Mt=w===at,bt=C===at,wt=e.itemBorderWidth??0;t.save(),ct!==0&&(t.translate(D+it/2,N+x/2),t.rotate(ct),t.translate(-(D+it/2),-(N+x/2)));const gt=Mt?((ft=e.hoverStyle)==null?void 0:ft.scale)??1:bt?((xt=e.activeStyle)==null?void 0:xt.scale)??1:1;if(gt!==1&&(t.translate(D+it/2,N+x/2),t.scale(gt,gt),t.translate(-(D+it/2),-(N+x/2))),bt){const vt=((At=e.activeStyle)==null?void 0:At.itemBackgroundColor)||e.activeBackgroundColor||(m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.1)"),Xt=this.createCanvasFill(t,vt,it,x);t.fillStyle=Xt||(typeof vt=="string"?vt:"transparent"),t.beginPath(),this.drawCustomShape(t,e.activeItemShape||e.itemShape||"rectangle",e.activeItemShape==="custom"?e.activeItemPath||"":e.itemPath||"",D,N,it,x,e.itemCornerRadius??0)||t.fill()}else if(Mt){const vt=((Pt=e.hoverStyle)==null?void 0:Pt.itemBackgroundColor)||e.hoverBackgroundColor||(m?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)"),Xt=this.createCanvasFill(t,vt,it,x);t.fillStyle=Xt||(typeof vt=="string"?vt:"transparent"),t.beginPath(),this.drawCustomShape(t,e.itemShape||"rectangle",e.itemPath||"",D,N,it,x,e.itemCornerRadius??0)||t.fill()}else if(S!=="transparent"){const vt=this.createCanvasFill(t,S,it,x);t.fillStyle=vt||(typeof S=="string"?S:"transparent"),t.beginPath(),this.drawCustomShape(t,e.itemShape||"rectangle",e.itemPath||"",D,N,it,x,e.itemCornerRadius??0)||t.fill()}if(wt>0&&e.itemBorderColor&&e.itemBorderColor!=="transparent"){const vt=this.createCanvasFill(t,e.itemBorderColor,it,x);t.strokeStyle=vt||(typeof e.itemBorderColor=="string"?e.itemBorderColor:"#cccccc"),t.lineWidth=wt,t.beginPath(),this.drawCustomShape(t,e.itemShape||"rectangle",e.itemPath||"",D,N,it,x,e.itemCornerRadius??0)||t.stroke()}if(bt){const vt=this.createCanvasFill(t,l,d==="vertical"?3:it,d==="vertical"?x:3);t.fillStyle=vt||l,d==="vertical"?t.fillRect(D,N,3,x):t.fillRect(D,N+x-3,it,3)}const It=bt?"#ffffff":m?"rgba(255, 255, 255, 0.9)":b;t.fillStyle=It,t.font=bt||Mt?"600 14px Inter, sans-serif":"400 14px Inter, sans-serif";const ut=typeof J=="string"?J:(J==null?void 0:J.label)||`Item ${at+1}`,Ot=D+(d==="vertical"?16:it/2),Wt=N+x/2;d==="horizontal"||j==="circular"?t.textAlign="center":t.textAlign="left";const q=j==="circular"?D+it/2:Ot;t.fillText(ut,q,Wt),t.restore(),t.beginPath(),k+=(d==="vertical"?g:h)+u}),P&&t.restore(),e.showScrollbar!==!1){const J=typeof v=="number"?v:d==="vertical"?v[0]:v[3],j=(p.length||0)*(d==="vertical"?g:h)+Math.max(0,(p.length||0)-1)*u+J*2,it=d==="vertical"?i:n,x=e.listLayout||"linear",D=e.containerShape==="circle"||x==="circular",N=e.scrollbarColor||"rgba(255,255,255,0.3)";let ct=typeof N=="object"?N.color||((Y=(U=N.stops)==null?void 0:U[0])==null?void 0:Y.color)||"rgba(255,255,255,0.3)":N;const Mt=((ot=(X=this.artboard)==null?void 0:X.tokens)==null?void 0:ot.colors)||{};Mt[ct]&&(ct=Mt[ct]);const bt=e.scrollbarWidth||2;if(t.save(),D){const wt=Math.min(n,i)/2-bt/2-2,gt=a+n/2,It=r+i/2;if(t.strokeStyle=ct,t.lineWidth=bt,t.lineCap="round",t.beginPath(),x==="circular"){const ut=Math.PI/4,Ot=-(f*.01)-Math.PI/2;t.arc(gt,It,wt,Ot,Ot+ut)}else{const ut=Math.PI/2,Ot=j>0?Math.min(1,it/j):1,Wt=ut*Ot,q=j>0?-f/j*ut:0,xt=-Math.PI/4+q;t.arc(gt,It,wt,xt,xt+Wt)}t.stroke()}else{let wt=it,gt=0;if(j>it){const It=it/j;wt=Math.max(16,it*It);const ut=it-wt,Ot=j-it;gt=Ot>0?Math.max(0,Math.min(ut,-f/Ot*ut)):0}if(t.fillStyle=ct,d==="vertical"){const It=a+n-bt-2,ut=r+gt,Ot=bt,Wt=wt;if(bt>2){t.beginPath();const q=Math.min(bt/2,wt/2);if(t.roundRect)try{t.roundRect(It,ut,Ot,Wt,q),t.fill()}catch{t.fillRect(It,ut,Ot,Wt)}else t.fillRect(It,ut,Ot,Wt)}else t.fillRect(It,ut,Ot,Wt)}else{const It=a+gt,ut=r+i-bt-2,Ot=wt,Wt=bt;if(bt>2){t.beginPath();const q=Math.min(bt/2,wt/2);if(t.roundRect)try{t.roundRect(It,ut,Ot,Wt,q),t.fill()}catch{t.fillRect(It,ut,Ot,Wt)}else t.fillRect(It,ut,Ot,Wt)}else t.fillRect(It,ut,Ot,Wt)}}t.restore()}t.beginPath(),t.restore()}drawCustomShape(t,s,o,e,n,i,a,r){if(s==="circle"){const c=Math.min(i,a)/2;return t.arc(e+i/2,n+a/2,c,0,Math.PI*2),!1}else if(s==="pill"){const c=Math.min(i,a)/2;return this.drawListViewRect(t,e,n,i,a,c),!1}else if(s==="custom"&&o)try{const c=new Path2D(o);return t.save(),t.translate(e,n),t.scale(i/100,a/100),t.fill(c),t.restore(),!0}catch{return this.drawListViewRect(t,e,n,i,a,r),!1}return this.drawListViewRect(t,e,n,i,a,r),!1}updateListViewScrollFromPointer(t){var S,w,C,M;if(!this._lastPointerPos||!this._prevPointerPos)return;const s=this.objectStates.get(t.id);s&&!s.options&&(s.options=JSON.parse(JSON.stringify(t.options||{})));const o=(s==null?void 0:s.options)||t.options||{},e=o.orientation||"vertical",n=this._lastPointerPos.x-this._prevPointerPos.x,i=this._lastPointerPos.y-this._prevPointerPos.y;let a=o.scrollOffset||0;const r=this.getResolvedListViewItems(t,o),c=o.itemGap??10,d=o.itemHeight??50,p=o.itemWidth??200,u=(s==null?void 0:s.width)!==void 0?s.width:((S=t.geometry)==null?void 0:S.width)||200,g=(s==null?void 0:s.height)!==void 0?s.height:((w=t.geometry)==null?void 0:w.height)||300,h=typeof o.padding=="number"?o.padding:e==="vertical"?((C=o.padding)==null?void 0:C[0])||0:((M=o.padding)==null?void 0:M[3])||0,v=(r.length||0)*(e==="vertical"?d:p)+Math.max(0,(r.length||0)-1)*c+h*2,m=e==="vertical"?g:u,l=Math.max(0,v-m);if(this.draggingListViewIsScrollbar&&o.listLayout!=="circular"){const I=v>0?m/v:1,_=Math.max(16,m*I),E=Math.max(1,m-_),P=l>0?l/E:1;e==="vertical"?a-=i*P:a-=n*P}else e==="vertical"?a+=i:a+=n;if((o.listLayout||"linear")==="circular"){o.scrollOffset=a,s&&s.options&&(s.options.scrollOffset=a),t.options&&(t.options.scrollOffset=a);return}a>0&&(a=0),a<-l&&(a=-l),o.scrollOffset=a,s&&s.options&&(s.options.scrollOffset=a),t.options&&(t.options.scrollOffset=a)}updateListViewHoverFromPointer(t,s,o){const e=this.getListViewItemIndexAtPointer(t,s,o),n=this.objectStates.get(t.id);if(n&&n.options)n.options.hoveredIndex!==e&&(n.options.hoveredIndex=e);else{const i=t.options||{};i.hoveredIndex!==e&&(i.hoveredIndex=e)}}getListViewItemIndexAtPointer(t,s,o){var F,O;const e=this.objectStates.get(t.id),n=(e==null?void 0:e.options)||t.options||{},i=this.getResolvedListViewItems(t,n);if(i.length===0)return null;const a=(e==null?void 0:e.width)!==void 0?e.width:((F=t.geometry)==null?void 0:F.width)||200,r=(e==null?void 0:e.height)!==void 0?e.height:((O=t.geometry)==null?void 0:O.height)||300,c=n.orientation||"vertical",d=n.itemGap??10,p=n.itemHeight??50,u=n.itemWidth??200,g=n.scrollOffset??0,h=n.padding??0,f=this.getWorldTransform(t.id),v=s-f.x,m=o-f.y,l=-f.rotation*(Math.PI/180),b=Math.cos(l),S=Math.sin(l),w=v*b-m*S,C=v*S+m*b,M=-a/2,I=-r/2,_=typeof h=="number"?h:c==="vertical"?h[0]:h[3];let E=(c==="vertical"?I:M)+g+_;const P=n.listLayout||"linear",L=i.length||1,k=Math.PI*2/L,A=n.circularStartAngle||0,T=n.circularRadius||100,R=g*.01+A*Math.PI/180;for(let W=0;W<i.length;W++){const V=P==="circular"?u:c==="vertical"?a:u,U=P==="circular"||c==="vertical"?p:r;let Y=0,X=0,ot=0;if(P==="circular"){const J=W*k+R,at=M+a/2,j=I+r/2;Y=at+Math.cos(J)*T-V/2,X=j+Math.sin(J)*T-U/2,ot=J+(n.itemRotation||0)*Math.PI/180}else Y=c==="vertical"?M:E,X=c==="vertical"?E:I,ot=(n.itemRotation||0)*Math.PI/180;if(ot!==0){const J=Y+V/2,at=X+U/2,j=w-J,it=C-at,x=-ot,D=j*Math.cos(x)-it*Math.sin(x)+J,N=j*Math.sin(x)+it*Math.cos(x)+at;if(D>=Y&&D<=Y+V&&N>=X&&N<=X+U)return W}else if(w>=Y&&w<=Y+V&&C>=X&&C<=X+U)return W;E+=(c==="vertical"?p:u)+d}return null}drawListViewRect(t,s,o,e,n,i){this.drawRoundRect(t,s,o,e,n,i)}solveBehaviors(t){if(!this.artboard)return;if(!this._lastPointerPos){this.frameCount%60;return}const{x:s,y:o}=this._lastPointerPos;this.artboard.objects.forEach(e=>{if(!e.behaviors||e.behaviors.length===0)return;const n=this.objectStates.get(e.id);n&&e.behaviors.forEach(i=>{var u,g,h,f,v,m,l,b,S,w,C,M,I,_,E,P,L,k,A,T,R,F,O,W,V,U,Y,X,ot,J,at,j,it,x,D,N,ct,Mt,bt,wt,gt,It,ut,Ot,Wt,q,ft,xt,At,Pt,vt,Xt,zt,Gt,Yt,te,ie,ce,ve,_e,ge,Ee,Zt,Me,Re,Ie,de,me,Ae,he,mt,rt,z,K,G,B,Q,H,lt,kt,Et,Ht,Ut,qt,$,dt,Lt,Nt,st,yt,St,ee,Ct,Vt,Tt,Dt,Rt,le,fe,Oe,jt,oe,ne,Fe,xe,Be,We,Ye,Xe,Ge,se,ue,Se,De,Ne,ke,Ce,we;if(!i.enabled)return;const a=i.startTime||0,r=i.endTime||1/0;if(this.currentTime<a||this.currentTime>r)return;const c=n.x-s,d=n.y-o,p=Math.sqrt(c*c+d*d);if(this.frameCount%240===0&&Math.random()<.1&&this.log(`[ExodeUI] Executing ${i.type} on ${e.name}`),i.type===tt.Proximity){const Z=((u=i.settings)==null?void 0:u.radius)||300,nt=((g=i.settings)==null?void 0:g.falloff)||"smooth";let et=0;p<Z&&(nt==="linear"?et=1-p/Z:et=Math.pow(1-p/Z,2)),i.sensors.forEach(pt=>{this.applyBehaviorSensor(n,pt,et,t,i.settings,e,c,d,p)})}else if(i.type===tt.Magnetic){const Z=((h=i.settings)==null?void 0:h.radius)||400,nt=((f=i.settings)==null?void 0:f.strength)||.5;if(p<Z&&p>5){const et=1-p/Z,pt=c*et*nt,Ft=d*et*nt;n.x-=pt*t*10,n.y-=Ft*t*10}}else if(i.type===tt.Repel){const Z=((v=i.settings)==null?void 0:v.radius)||300,nt=((m=i.settings)==null?void 0:m.strength)||1;if(p<Z){const et=Math.pow(1-p/Z,2);n.x+=c/(p||1)*et*60*nt*t*5,n.y+=d/(p||1)*et*60*nt*t*5}}else if(i.type===tt.Orbit){const Z=((l=i.settings)==null?void 0:l.speed)||1,nt=((b=i.settings)==null?void 0:b.radius)||30,et=this.currentTime*Z*Math.PI*2;n.x+=Math.cos(et)*nt*t*5,n.y+=Math.sin(et)*nt*t*5,n.rotation+=2*t*5}else if(i.type===tt.Vortex){const Z=((S=i.settings)==null?void 0:S.radius)||400,nt=((w=i.settings)==null?void 0:w.speed)||2,et=((C=i.settings)==null?void 0:C.strength)||1;if(p<Z){const pt=Math.pow(1-p/Z,1.5),Ft=this.currentTime*nt*Math.PI*2,Bt=Math.cos(Ft)*30-c*.4,Jt=Math.sin(Ft)*30-d*.4;n.x+=Bt*pt*et*t*5,n.y+=Jt*pt*et*t*5,n.rotation+=5*pt*et*t*5,n.scale_x*=1-pt*.1*et*t,n.scale_y*=1-pt*.1*et*t}}else if(i.type===tt.Fluid){const Z=((M=i.settings)==null?void 0:M.radius)||300,nt=((I=i.settings)==null?void 0:I.strength)||1;if(p<Z){const et=Math.pow(1-p/Z,1.2),pt=c/(p||1)*et*1.2*nt,Ft=d/(p||1)*et*1.2*nt;n.x+=pt*10*t*5,n.y+=Ft*10*t*5,n.scale_x*=1+et*.3*nt*t,n.scale_y*=1+et*.3*nt*t}}else if(i.type===tt.Elastic){const Z=((_=i.settings)==null?void 0:_.radius)||300,nt=((E=i.settings)==null?void 0:E.strength)||1;if(p<Z){const et=1-p/Z;n.scale_x*=1+et*.4*nt*t,n.scale_y*=1+et*.4*nt*t}}else if(i.type===tt.Holographic){const Z=n.x-this.canvasWidth/2,nt=n.y-this.canvasHeight/2,et=((P=i.settings)==null?void 0:P.factor)||25;if(n.x-=Z/1e3*et*t*5,n.y-=nt/1e3*et*t*5,n.style){const pt=1-Math.min(1,p/400);n.style.exposure=(n.style.exposure||1)+pt*.5*t}}else if(i.type===tt.Sticky){const Z=((L=i.settings)==null?void 0:L.radius)||80,nt=((k=i.settings)==null?void 0:k.strength)||1;if(p<Z){const et=Math.pow(1-p/Z,2);n.x-=c*et*nt*t*10,n.y-=d*et*nt*t*10,n.scale_x*=1-et*.1*nt*t,n.scale_y*=1-et*.1*nt*t}}else if(i.type===tt.Dilation){const Z=((A=i.settings)==null?void 0:A.size)||120,nt=((T=i.settings)==null?void 0:T.strength)||1;if(p<Z){const et=1-p/Z;n.scale_x*=1+et*.5*nt*t,n.scale_y*=1+et*.5*nt*t}}else if(i.type===tt.Parallax){const Z=((R=i.settings)==null?void 0:R.factor)||15,nt=((F=i.settings)==null?void 0:F.strength)||1,et=this.canvasWidth/2,pt=this.canvasHeight/2,Ft=this._lastPointerPos||{x:et,y:pt},Bt=(Ft.x-et)/et,Jt=(Ft.y-pt)/pt,pe=(((O=e.transform)==null?void 0:O.x)??0)+Bt*Z*nt,Te=(((W=e.transform)==null?void 0:W.y)??0)+Jt*Z*nt,$e=(((V=e.transform)==null?void 0:V.rotate_x)??0)-Jt*Z*1.5*nt,ye=(((U=e.transform)==null?void 0:U.rotate_y)??0)+Bt*Z*1.5*nt,Le=Math.min(1,10*t);n.x=this.lerp(n.x??((Y=e.transform)==null?void 0:Y.x)??0,pe,Le),n.y=this.lerp(n.y??((X=e.transform)==null?void 0:X.y)??0,Te,Le),n.rotate_x=this.lerp(n.rotate_x??((ot=e.transform)==null?void 0:ot.rotate_x)??0,$e,Le),n.rotate_y=this.lerp(n.rotate_y??((J=e.transform)==null?void 0:J.rotate_y)??0,ye,Le)}else if(i.type===tt.Fold){if(p<300){const Z=1-p/300,nt=(c>0?-1:1)*Z*10,et=1-Z*.1,pt=d/300*Z*20,Ft=-(c/300)*Z*20,Bt=Math.min(1,10*t);n.skew_x=this.lerp(n.skew_x??((at=e.transform)==null?void 0:at.skew_x)??0,nt,Bt),n.scale_y=this.lerp(n.scale_y??((j=e.transform)==null?void 0:j.scale_y)??1,(((it=e.transform)==null?void 0:it.scale_y)??1)*et,Bt),n.rotate_x=this.lerp(n.rotate_x??((x=e.transform)==null?void 0:x.rotate_x)??0,pt,Bt),n.rotate_y=this.lerp(n.rotate_y??((D=e.transform)==null?void 0:D.rotate_y)??0,Ft,Bt),n.style=n.style||{...e.style},n.style.artEffect={enabled:!0,type:"fold_overlay",intensity:((N=i.settings)==null?void 0:N.opacity)??.5}}}else if(i.type===tt.Crumple){if(p<300){const Z=1-p/300,nt=Z*(Math.random()-.5)*5,et=Z*(Math.random()-.5)*.05,pt=Math.min(1,15*t);n.skew_x=this.lerp(n.skew_x??((ct=e.transform)==null?void 0:ct.skew_x)??0,nt,pt),n.scale_x=this.lerp(n.scale_x??((Mt=e.transform)==null?void 0:Mt.scale_x)??1,(((bt=e.transform)==null?void 0:bt.scale_x)??1)*(1+et),pt),n.scale_y=this.lerp(n.scale_y??((wt=e.transform)==null?void 0:wt.scale_y)??1,(((gt=e.transform)==null?void 0:gt.scale_y)??1)*(1+et),pt),n.style=n.style||{...e.style},n.style.artEffect={enabled:!0,type:"crumple_overlay",intensity:((It=i.settings)==null?void 0:It.intensity)??1,scale:((ut=i.settings)==null?void 0:ut.scale)??2}}}else if(i.type===tt.Squash){const Z=((Ot=i.settings)==null?void 0:Ot.strength)||.8;p<(e.width||100)&&this.isMouseDown?(n.scale_y=this.lerp(n.scale_y??1,(((Wt=e.transform)==null?void 0:Wt.scale_y)??1)*Z,.3),n.scale_x=this.lerp(n.scale_x??1,(((q=e.transform)==null?void 0:q.scale_x)??1)*(1+(1-Z)*.4),.3)):(n.scale_y=this.lerp(n.scale_y??1,((ft=e.transform)==null?void 0:ft.scale_y)??1,.2),n.scale_x=this.lerp(n.scale_x??1,((xt=e.transform)==null?void 0:xt.scale_x)??1,.2))}else if(i.type===tt.TextCounter){const Z=((At=i.settings)==null?void 0:At.duration)||2,nt=((Pt=i.settings)==null?void 0:Pt.from)||0,et=((vt=i.settings)==null?void 0:vt.to)||100;i._runtimeStart===void 0&&(i._runtimeStart=this.currentTime);const pt=this.currentTime-i._runtimeStart,Ft=Math.min(1,pt/Z),Bt=Math.floor(nt+(et-nt)*Ft);if(((Xt=e.geometry)==null?void 0:Xt.type)==="Text"){const Jt=((zt=i.settings)==null?void 0:zt.prefix)||"",pe=((Gt=i.settings)==null?void 0:Gt.suffix)||"";n.geometry||(n.geometry={...e.geometry}),n.geometry.text=`${Jt}${Bt}${pe}`}}else if(i.type===tt.Spotlight){const Z=((Yt=i.settings)==null?void 0:Yt.radius)||250,nt=((te=i.settings)==null?void 0:te.strength)||1.5;if(p<Z){const et=Math.pow(1-p/Z,2);n.style||(n.style={...e.style}),n.style.adjustments||(n.style.adjustments={...(ie=e.style)==null?void 0:ie.adjustments}),n.style.adjustments.exposure=(((ve=(ce=e.style)==null?void 0:ce.adjustments)==null?void 0:ve.exposure)||0)+et*nt*50}else(_e=n.style)!=null&&_e.adjustments&&(n.style.adjustments.exposure=this.lerp(n.style.adjustments.exposure||0,((Ee=(ge=e.style)==null?void 0:ge.adjustments)==null?void 0:Ee.exposure)||0,.1))}else if(i.type===tt.Noise||i.type===tt.Float){const Z=(((Zt=i.settings)==null?void 0:Zt.frequency)||((Me=i.settings)==null?void 0:Me.speed)||1)*.002,nt=(((Re=i.settings)==null?void 0:Re.amplitude)||((Ie=i.settings)==null?void 0:Ie.range)||50)*(((de=i.settings)==null?void 0:de.strength)||1),et=Date.now();n.x+=Math.sin(et*Z)*nt*t,n.y+=Math.cos(et*Z*.8)*nt*t,n.rotation+=Math.sin(et*Z*.5)*5*t}else if(i.type===tt.Pulse){const Z=(((me=i.settings)==null?void 0:me.speed)||1)*.005,nt=(((Ae=i.settings)==null?void 0:Ae.scale)||1.2)-1,et=Math.sin(Date.now()*Z),pt=((he=i.settings)==null?void 0:he.strength)||1;n.scale_x*=1+et*nt*pt*t,n.scale_y*=1+et*nt*pt*t,n.style&&(n.style.exposure=(n.style.exposure||1)+Math.max(0,et)*.1*pt*t)}else if(i.type===tt.Draggable){if(!this.draggingBehaviors.has(e.id)){const nt=((mt=i.settings)==null?void 0:mt.radius)||150;if(p<nt){const et=((rt=i.settings)==null?void 0:rt.strength)||1,pt=Math.max(0,1-p/nt);this.applyBehaviorSensor(n,re.PositionX,pt*et,t,i.settings,e,c,d,p),this.applyBehaviorSensor(n,re.PositionY,pt*et,t,i.settings,e,c,d,p)}}}else if(i.type===tt.Scroll){const Z=((z=i.settings)==null?void 0:z.axis)||"vertical",nt=((K=i.settings)==null?void 0:K.factor)||.5,et=((G=i.settings)==null?void 0:G.strength)||1,pt=((B=i.settings)==null?void 0:B.scaleFactor)||0;(Z==="vertical"||Z==="both")&&(n.y+=this.scrollOffset.y*nt*et*t),(Z==="horizontal"||Z==="both")&&(n.x+=this.scrollOffset.x*nt*et*t),pt!==0&&(n.scale_x*=1+this.scrollOffset.y*pt*t,n.scale_y*=1+this.scrollOffset.y*pt*t)}else if(i.type===tt.LookAt){const Z=((Q=i.settings)==null?void 0:Q.factor)||1,nt=((H=i.settings)==null?void 0:H.strength)||1,et=Math.atan2(-d,-c)*(180/Math.PI),pt=n.rotation,Ft=(et-pt+180)%360-180;n.rotation+=Ft*Z*nt*t*10}else if(i.type===tt.Scan){const Z=(((lt=i.settings)==null?void 0:lt.speed)||1)*.004,nt=((kt=i.settings)==null?void 0:kt.strength)||1,et=(Math.sin(Date.now()*Z)+1)/2;n.style&&(n.style.exposure=(n.style.exposure||1)+et*nt*t*5),n.x+=(et-.5)*20*nt*t}else if(i.type===tt.Glint)n.style=n.style||{...e.style},n.style.artEffect={enabled:!0,type:"glint_overlay",intensity:((Et=i.settings)==null?void 0:Et.strength)??.8};else if(i.type===tt.Ratchet){const Z=((Ht=i.settings)==null?void 0:Ht.steps)||12,nt=(((Ut=i.settings)==null?void 0:Ut.speed)||1)*30,et=Math.floor(n.rotation/(360/Z))*(360/Z);n.rotation=this.lerp(n.rotation,et+nt*t,.1)}else if(i.type===tt.Jitter&&p<300){const Z=((qt=i.settings)==null?void 0:qt.strength)||1,nt=((($=i.settings)==null?void 0:$.intensity)||5)*Z;n.x+=(Math.random()-.5)*nt*t*60,n.y+=(Math.random()-.5)*nt*t*60,n.rotation+=(Math.random()-.5)*nt*t*120}else if(i.type===tt.Follower){const Z=(dt=i.settings)==null?void 0:dt.targetId;if(Z){const nt=this.objectStates.get(Z);if(nt){const et=((Lt=i.settings)==null?void 0:Lt.stiffness)||.1,pt=nt.x-n.x,Ft=nt.y-n.y;n.x+=pt*et*t*60,n.y+=Ft*et*t*60}}}else if(i.type===tt.Wrap)n.x<0?n.x=this.canvasWidth:n.x>this.canvasWidth&&(n.x=0),n.y<0?n.y=this.canvasHeight:n.y>this.canvasHeight&&(n.y=0);else if(i.type===tt.Gravity){const Z=((Nt=i.settings)==null?void 0:Nt.strength)||9.8;n.y+=Z*t*10}else if(i.type===tt.Velocity){const Z=((st=i.settings)==null?void 0:st.vx)||0,nt=((yt=i.settings)==null?void 0:yt.vy)||0;n.x+=Z*t*10,n.y+=nt*t*10}else if(i.type===tt.Shear){const Z=((St=i.settings)==null?void 0:St.strength)||1,nt=((ee=i.settings)==null?void 0:ee.radius)||300;if(p<nt){const et=1-p/nt;n.skew_x=this.lerp(n.skew_x||0,(((Ct=e.transform)==null?void 0:Ct.skew_x)||0)+et*Z*30,.1)}else n.skew_x=this.lerp(n.skew_x||0,((Vt=e.transform)==null?void 0:Vt.skew_x)||0,.05)}else if(i.type===tt.Lens){const Z=((Tt=i.settings)==null?void 0:Tt.radius)||200,nt=((Dt=i.settings)==null?void 0:Dt.strength)||.5;if(p<Z){const et=Math.pow(1-p/Z,2);n.scale_x=this.lerp(n.scale_x??1,(((Rt=e.transform)==null?void 0:Rt.scale_x)??1)*(1+et*nt),.2),n.scale_y=this.lerp(n.scale_y??1,(((le=e.transform)==null?void 0:le.scale_y)??1)*(1+et*nt),.2)}else n.scale_x=this.lerp(n.scale_x??1,((fe=e.transform)==null?void 0:fe.scale_x)??1,.1),n.scale_y=this.lerp(n.scale_y??1,((Oe=e.transform)==null?void 0:Oe.scale_y)??1,.1)}else if(i.type===tt.LayoutAnimation){const Z=((jt=i.settings)==null?void 0:jt.watchProperties)||["x","y","scale_x","scale_y","opacity","rotation"],nt=((oe=i.settings)==null?void 0:oe.duration)||.3;this._layoutAnimCache.has(e.id)||this._layoutAnimCache.set(e.id,new Map);const et=this._layoutAnimCache.get(e.id);for(const pt of Z){const Ft=this.getObjectProperty(n,e,pt);if(Ft===void 0)continue;const Bt=et.get(pt);if(!Bt)et.set(pt,{from:Ft,to:Ft,startTime:this.currentTime,duration:0});else if(Bt.to!==Ft){const pe=this.getObjectProperty(n,e,pt);et.set(pt,{from:pe??Bt.from,to:Ft,startTime:this.currentTime,duration:((ne=i.settings)==null?void 0:ne.duration)??nt})}const Jt=et.get(pt);if(Jt.duration>0&&Jt.from!==Jt.to){const pe=this.currentTime-Jt.startTime,Te=Math.min(1,pe/Jt.duration),$e=this.applyEasing(Te,((Fe=i.settings)==null?void 0:Fe.easing)||"easeOutCubic"),ye=Jt.from+(Jt.to-Jt.from)*$e;this.setObjectProperty(n,e,pt,ye)}}}else if(i.type===tt.StateReactive){this._layoutAnimCache.has(e.id)||this._layoutAnimCache.set(e.id,new Map);const Z=this._layoutAnimCache.get(e.id),nt=((xe=i.settings)==null?void 0:xe.defaultDuration)||.3,et=["x","y","scale_x","scale_y","opacity","rotation","style.fill.color","style.stroke.width","geometry.cornerRadius","style.blur.value","style.shadow.blur","style.shadow.offsetX","style.shadow.offsetY"];for(const pt of et){const Ft=this.getObjectProperty(n,e,pt);if(Ft===void 0||typeof Ft!="number")continue;const Bt=Z.get(pt);if(!Bt)Z.set(pt,{from:Ft,to:Ft,startTime:this.currentTime,duration:0});else if(Bt.to!==Ft){const pe=this.getObjectProperty(n,e,pt);Z.set(pt,{from:pe??Bt.from,to:Ft,startTime:this.currentTime,duration:nt})}const Jt=Z.get(pt);if(Jt.duration>0&&Jt.from!==Jt.to){const pe=this.currentTime-Jt.startTime,Te=Math.min(1,pe/Jt.duration),$e=this.applyEasing(Te,((Be=i.settings)==null?void 0:Be.defaultEasing)||"easeOutCubic"),ye=Jt.from+(Jt.to-Jt.from)*$e;this.setObjectProperty(n,e,pt,ye)}}}else if(i.type===tt.SpringChain){const Z=((We=i.settings)==null?void 0:We.connections)||[],nt=((Ye=i.settings)==null?void 0:Ye.globalDamping)||.3;this._springChainState.has(e.id)||this._springChainState.set(e.id,new Map);const et=this._springChainState.get(e.id);for(const Ft of Z){if(!et.has(Ft.targetId)){const Bt=this.objectStates.get(Ft.targetId);et.set(Ft.targetId,{x:(Bt==null?void 0:Bt.x)??0,y:(Bt==null?void 0:Bt.y)??0,vx:0,vy:0})}et.has(e.id)||et.set(e.id,{x:n.x,y:n.y,vx:0,vy:0})}const pt=et.get(e.id);if(pt){pt.x=n.x,pt.y=n.y;for(const Ft of Z){const Bt=et.get(Ft.targetId);if(!Bt)continue;const Jt=Bt.x-pt.x,pe=Bt.y-pt.y,Te=Math.sqrt(Jt*Jt+pe*pe)||.001,ye=(Te-(Ft.restLength||50))*(Ft.stiffness||.8),Le=Jt/Te*ye,Qe=pe/Te*ye;pt.vx+=Le*t*10,pt.vy+=Qe*t*10,Bt.vx-=Le*t*10,Bt.vy-=Qe*t*10,pt.vx*=1-nt*t*10,pt.vy*=1-nt*t*10,Bt.vx*=1-nt*t*10,Bt.vy*=1-nt*t*10;const Pe=this.objectStates.get(Ft.targetId);Pe&&(Pe.x+=Bt.vx*t,Pe.y+=Bt.vy*t)}n.x+=pt.vx*t,n.y+=pt.vy*t}}else if(i.type===tt.ParticleEmitter){const Z=((Xe=i.settings)==null?void 0:Xe.rate)||10,nt=((Ge=i.settings)==null?void 0:Ge.speed)||100,et=((se=i.settings)==null?void 0:se.size)||5,pt=((ue=i.settings)==null?void 0:ue.lifetime)||2,Ft=((Se=i.settings)==null?void 0:Se.gravity)||0,Bt=((De=i.settings)==null?void 0:De.color)||"#ffffff",Jt=((Ne=i.settings)==null?void 0:Ne.maxParticles)||200,pe=(ke=i.settings)!=null&&ke.rateInputId?this.inputs.get(i.settings.rateInputId)??Z:Z,Te=(Ce=i.settings)!=null&&Ce.gravityInputId?this.inputs.get(i.settings.gravityInputId)??Ft:Ft,$e=(we=i.settings)!=null&&we.speedInputId?this.inputs.get(i.settings.speedInputId)??nt:nt;this._emitterPools.has(e.id)||this._emitterPools.set(e.id,[]);const ye=this._emitterPools.get(e.id);let Le=0;i._pendingBurst&&i._pendingBurst>0&&(Le=i._pendingBurst,i._pendingBurst=0);const Qe=Math.floor(pe*t)+(Le||0);for(let Pe=0;Pe<Math.min(Qe,Jt-ye.length);Pe++){const be=Math.random()*Math.PI*2,ms=$e*(.5+Math.random()*.5);ye.push({x:n.x,y:n.y,vx:Math.cos(be)*ms,vy:Math.sin(be)*ms,life:0,maxLife:pt*(.5+Math.random()*.5),size:et*(.5+Math.random()),color:Bt,opacity:1})}for(let Pe=ye.length-1;Pe>=0;Pe--){const be=ye[Pe];be.vy+=Te*t*10,be.x+=be.vx*t,be.y+=be.vy*t,be.life+=t,be.opacity=Math.max(0,1-be.life/be.maxLife),be.life>=be.maxLife&&ye.splice(Pe,1)}}})})}applyBehaviorSensor(t,s,o,e,n,i,a=0,r=0,c=1){var h,f,v,m,l,b,S,w,C,M,I,_,E,P,L,k,A,T,R,F,O,W,V,U;const d=(n==null?void 0:n.intensity)||(n==null?void 0:n.strength)||1,p=Math.min(1,15*e),u=c>0?a/c:0,g=c>0?r/c:0;switch(s){case re.Scale:{const Y=((h=i==null?void 0:i.transform)==null?void 0:h.scale_x)??1,X=((f=i==null?void 0:i.transform)==null?void 0:f.scale_y)??1,ot=Y*(1+o*d*.4),J=X*(1+o*d*.4);t.scale_x=(t.scale_x??Y)*(1-p)+ot*p,t.scale_y=(t.scale_y??X)*(1-p)+J*p;break}case re.Opacity:{const Y=((v=i==null?void 0:i.transform)==null?void 0:v.opacity)??100,X=Math.max(0,Math.min(100,Y-o*d*100));t.opacity=(t.opacity??Y)*(1-p)+X*p;break}case re.RotateZ:{const Y=((m=i==null?void 0:i.transform)==null?void 0:m.rotation)??0,X=Y+o*d*45;t.rotation=(t.rotation??Y)*(1-p)+X*p;break}case re.RotateX:{const Y=((l=i==null?void 0:i.transform)==null?void 0:l.rotate_x)??0,X=Y-g*o*d*60;t.rotate_x=(t.rotate_x??Y)*(1-p)+X*p;break}case re.RotateY:{const Y=((b=i==null?void 0:i.transform)==null?void 0:b.rotate_y)??0,X=Y+u*o*d*60;t.rotate_y=(t.rotate_y??Y)*(1-p)+X*p;break}case re.PositionX:{const Y=((S=i==null?void 0:i.transform)==null?void 0:S.x)??0,X=Y-u*o*d*40;t.x=(t.x??Y)*(1-p)+X*p;break}case re.PositionY:{const Y=((w=i==null?void 0:i.transform)==null?void 0:w.y)??0,X=Y-g*o*d*40;t.y=(t.y??Y)*(1-p)+X*p;break}case re.SkewX:{const Y=((C=i==null?void 0:i.transform)==null?void 0:C.skew_x)??0,X=Y+u*o*d*45;t.skew_x=(t.skew_x??Y)*(1-p)+X*p,t.skew_x>85&&(t.skew_x=85),t.skew_x<-85&&(t.skew_x=-85);break}case re.Blur:{t.style||(t.style={...i==null?void 0:i.style}),t.style.blur||(t.style.blur={...(M=i==null?void 0:i.style)==null?void 0:M.blur});const Y=((_=(I=i==null?void 0:i.style)==null?void 0:I.blur)==null?void 0:_.amount)||0,X=Y+o*((n==null?void 0:n.blur)||20)*d;t.style.blur.amount=(t.style.blur.amount??Y)*(1-p)+X*p;break}case re.Exposure:{t.style||(t.style={...i==null?void 0:i.style}),t.style.adjustments||(t.style.adjustments={...(E=i==null?void 0:i.style)==null?void 0:E.adjustments});const Y=((L=(P=i==null?void 0:i.style)==null?void 0:P.adjustments)==null?void 0:L.exposure)||0,X=Y+o*((n==null?void 0:n.exposure)||50)*d;t.style.adjustments.exposure=(t.style.adjustments.exposure??Y)*(1-p)+X*p;break}case re.HueShift:{t.style||(t.style={...i==null?void 0:i.style}),t.style.adjustments||(t.style.adjustments={...(k=i==null?void 0:i.style)==null?void 0:k.adjustments});const Y=((T=(A=i==null?void 0:i.style)==null?void 0:A.adjustments)==null?void 0:T.hue)||0,X=Y+o*((n==null?void 0:n.hue)||180)*d;t.style.adjustments.hue=(t.style.adjustments.hue??Y)*(1-p)+X*p;break}case re.Negative:{t.style||(t.style={...i==null?void 0:i.style}),t.style.adjustments||(t.style.adjustments={...(R=i==null?void 0:i.style)==null?void 0:R.adjustments});const Y=((O=(F=i==null?void 0:i.style)==null?void 0:F.adjustments)==null?void 0:O.negative)||0,X=Y+o*((n==null?void 0:n.negative)||100)*d;t.style.adjustments.negative=(t.style.adjustments.negative??Y)*(1-p)+X*p;break}case re.CornerRadius:{const Y=((W=i==null?void 0:i.transform)==null?void 0:W.corner_radius)||0,X=Y+o*d*50;t.corner_radius=(t.corner_radius??Y)*(1-p)+X*p;break}case re.StrokeWidth:{t.style||(t.style={...i==null?void 0:i.style});const Y=((V=i==null?void 0:i.style)==null?void 0:V.borderWidth)||0,X=Y+o*d*10;t.style.borderWidth=(t.style.borderWidth??Y)*(1-p)+X*p;break}case re.LetterSpacing:{t.geometry||(t.geometry={});const Y=((U=i==null?void 0:i.geometry)==null?void 0:U.letterSpacing)||0,X=Y+o*d*10;t.geometry.letterSpacing=(t.geometry.letterSpacing??Y)*(1-p)+X*p;break}}}getObjectProperty(t,s,o){const e=o.replace(/\[(\d+)\]/g,".$1").split(".");let n=t;for(const i of e){if(n==null||typeof n!="object")return;if(i==="style"&&t.style===void 0){n=s.style;continue}n=n[i]}return typeof n=="number"?n:void 0}setObjectProperty(t,s,o,e){const n=o.replace(/\[(\d+)\]/g,".$1").split(".");let i=t;for(let r=0;r<n.length-1;r++){const c=n[r];if(i[c]===void 0||i[c]===null){const d=s,p=n.slice(0,r+1).reduce((h,f)=>h==null?void 0:h[f],d),u=n[r+1],g=!isNaN(Number(u));i[c]=p!==void 0?Array.isArray(p)?[...p]:{...p}:g?[]:{}}i=i[c]}const a=n[n.length-1];i!=null&&(i[a]=e)}applyEasing(t,s){switch(s){case"easeOutCubic":return 1-Math.pow(1-t,3);case"easeInCubic":return t*t*t;case"easeInOutCubic":return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;case"easeOutQuad":return t*(2-t);case"easeInQuad":return t*t;case"easeInOutQuad":return t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2;case"easeOutExpo":return t===1?1:1-Math.pow(2,-10*t);case"easeOutBack":return 1+2.70158*Math.pow(t-1,3)+1.70158*Math.pow(t-1,2);case"easeOutElastic":{const o=2*Math.PI/3;return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t*10-.75)*o)+1}case"easeOutBounce":return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375;case"linear":return t;default:return 1-Math.pow(1-t,3)}}lerp(t,s,o){return t*(1-o)+s*o}deepMerge(t,s){if(!t)return s;if(!s)return t;if(typeof t!="object"||typeof s!="object"||t===null||s===null)return s;if(Array.isArray(s)){if(!Array.isArray(t))return s;const e=[...t];for(let n=0;n<s.length;n++)s[n]&&typeof s[n]=="object"&&!Array.isArray(s[n])&&t[n]&&typeof t[n]=="object"?e[n]=this.deepMerge(t[n],s[n]):e[n]=s[n];return e}const o={...t};for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&(s[e]&&typeof s[e]=="object"&&!Array.isArray(s[e])?o[e]=this.deepMerge(t[e],s[e]):Array.isArray(s[e])?o[e]=this.deepMerge(t[e],s[e]):o[e]=s[e]);return o}processFabricAdjustmentsCanvas(t,s,o,e){if(!e)return t;const n=(e.exposure||0)/100,i=(e.contrast||0)/100,a=(e.saturation||0)/100,r=(e.temperature||0)/200,c=(e.tint||0)/200,d=(e.highlights||0)/500,p=(e.shadows||0)/500,u=e.hue||0,g=(e.negative||0)/100,h=e.blur||0;if(!(n!==0||i!==0||a!==0||r!==0||c!==0||d!==0||p!==0||u!==0||g!==0||h>0))return t;const v=t.naturalWidth||Math.max(1,Math.round(s)),m=t.naturalHeight||Math.max(1,Math.round(o)),l=document.createElement("canvas");l.width=v,l.height=m;const b=l.getContext("2d");if(!b)return t;const S=[];h>0&&S.push(`blur(${h}px)`),u!==0&&S.push(`hue-rotate(${Math.round(u)}deg)`),S.length>0&&(b.filter=S.join(" ")),b.drawImage(t,0,0,v,m);try{const w=b.getImageData(0,0,v,m),C=w.data,M=C.length,I=n*255,_=i>=0?(1+i)/Math.max(.01,1-i):1+i,E=1+a,P=1+r-c/2,L=1+c,k=1-r-c/2,A=1+d+p,T=p*25.5,R=1-g/50,F=(1-R)*255;for(let O=0;O<M;O+=4){let W=C[O],V=C[O+1],U=C[O+2];if(n!==0&&(W+=I,V+=I,U+=I),i!==0&&(W=(W-127.5)*_+127.5,V=(V-127.5)*_+127.5,U=(U-127.5)*_+127.5),a!==0){const Y=.2989*W+.587*V+.114*U;W=Y+(W-Y)*E,V=Y+(V-Y)*E,U=Y+(U-Y)*E}(r!==0||c!==0)&&(W=W*P,V=V*L,U=U*k),(d!==0||p!==0)&&(W=W*A+T,V=V*A+T,U=U*A+T),g!==0&&(W=W*R+F,V=V*R+F,U=U*R+F),C[O]=Math.min(255,Math.max(0,W)),C[O+1]=Math.min(255,Math.max(0,V)),C[O+2]=Math.min(255,Math.max(0,U))}return b.putImageData(w,0,0),l}catch{return l}}renderFittedImage(t,s,o,e,n,i,a="cover"){const r=s.naturalWidth||s.width||n,c=s.naturalHeight||s.height||i,d=r/c,p=n/i;let u=n,g=i,h=o,f=e;a==="cover"?d>p?(u=i*d,h=o-(u-n)/2):(g=n/d,f=e-(g-i)/2):a==="contain"&&(d>p?(g=n/d,f=e+(i-g)/2):(u=i*d,h=o+(n-u)/2)),t.drawImage(s,h,f,u,g)}}const ai=$t.forwardRef(({artboard:y,src:t,style:s,autoPlay:o=!0,fit:e="Contain",alignment:n="Center",onReady:i,onTrigger:a,onInputUpdate:r,onComponentChange:c,onToggle:d,onInputChange:p,onInputFocus:u,onInputBlur:g,onLog:h,onLogicUpdate:f,onButtonClick:v,onGraphPointClick:m,currentTime:l,revision:b=0,scrollY:S,scrollX:w,mouseX:C,mouseY:M,isMouseDown:I,inputs:_,interactive:E=!0,onNavigation:P},L)=>{const k=$t.useRef(null),A=$t.useRef(null);A.current||(A.current=new gs);const T=$t.useRef(void 0),R=$t.useRef(0),F=$t.useRef(null),O=$t.useRef(b),W=$t.useRef(null),[,V]=$t.useState(y||null),U=$t.useRef(!0),Y=$t.useRef(o),X=$t.useRef(l);$t.useEffect(()=>{Y.current=o},[o]),$t.useEffect(()=>{X.current=l},[l]),$t.useImperativeHandle(L,()=>k.current),$t.useEffect(()=>(U.current=!0,()=>{U.current=!1,T.current&&cancelAnimationFrame(T.current)}),[]),$t.useEffect(()=>{A.current.setLayout(e,n)},[e,n]),$t.useEffect(()=>{const x=A.current;a&&x.setTriggerCallback(a),r&&x.setInputUpdateCallback((D,N)=>r({[D]:N})),c&&x.setComponentChangeCallback(D=>c(D)),d&&x.setToggleCallback(d),p&&x.setInputChangeCallback(p),u&&x.setInputFocusCallback(u),g&&x.setInputBlurCallback(g),h&&x.setOnLogCallback(D=>h(D,"info")),f&&x.setLogicUpdateCallback(f),v&&x.setButtonClickCallback(v),m&&x.setGraphPointClickCallback(D=>m(D.objectId,D)),P&&x.setNavigationCallback(P)},[a,r,c,d,p,u,g,h,f,v,m,P]),$t.useEffect(()=>{(async()=>{let D=y;if(t&&!y)try{t.startsWith("{")?D=JSON.parse(t):D=await(await fetch(t)).json()}catch(N){console.error("[ExodeUI] Failed to load src:",N)}if(D){const N=A.current,ct=D.id||D.name||"default";(F.current!==ct||O.current!==b||W.current!==D)&&(N.load(D),F.current=ct,O.current=b,W.current=D,V(D),R.current=-1,N.advance(0)),i&&i(N)}})()},[y,t,b]),$t.useEffect(()=>{const x=D=>{if(!A.current||!U.current)return;const N=A.current,ct=k.current;if(!ct)return;const Mt=ct.getContext("2d");if(!Mt)return;const bt=D/1e3;R.current<0&&(R.current=bt),R.current===0&&(R.current=bt);let wt=bt-R.current;wt>.1&&(wt=.1),R.current=bt;const gt=ct.getBoundingClientRect(),It=window.devicePixelRatio||1,ut=Math.round(gt.width*It),Ot=Math.round(gt.height*It);(ct.width!==ut||ct.height!==Ot)&&(ct.width=ut,ct.height=Ot);try{Y.current?N.advance(wt):X.current!==void 0&&N.seek(X.current),N.render(Mt,ct.width,ct.height)}catch(Wt){console.error("[ExodeUICanvas] Error in animation loop:",Wt),h&&h(`[Error] Animation loop crashed: ${Wt}`,"error")}T.current=requestAnimationFrame(x)};return T.current=requestAnimationFrame(x),()=>{T.current&&cancelAnimationFrame(T.current)}},[]),$t.useEffect(()=>{const x=A.current;S!==void 0&&x.updateInput("scrollY",S),w!==void 0&&x.updateInput("scrollX",w),C!==void 0&&x.updateInput("mouseX",C),M!==void 0&&x.updateInput("mouseY",M),I!==void 0&&x.updateInput("isMouseDown",I),_&&Object.entries(_).forEach(([D,N])=>x.updateInput(D,N))},[S,w,C,M,I,_]);const ot=(x,D)=>{if(!E||!k.current)return;x.stopPropagation(),"nativeEvent"in x&&x.nativeEvent&&typeof x.nativeEvent.stopImmediatePropagation=="function"?x.nativeEvent.stopImmediatePropagation():typeof x.stopImmediatePropagation=="function"&&x.stopImmediatePropagation();const N=k.current,ct=N.getBoundingClientRect(),Mt=x.clientX-ct.left,bt=x.clientY-ct.top,wt=window.devicePixelRatio||1;(D==="click"||D==="down"||D==="up")&&h&&h(`[Canvas] Pointer ${D} at rect(${Math.round(Mt)},${Math.round(bt)}) mapped to buffer(${Math.round(Mt*wt)},${Math.round(bt*wt)})`,"info"),A.current.handlePointerInput(D,Mt*wt,bt*wt,N.width,N.height)};$t.useEffect(()=>{if(!E)return;const x=N=>{var ct,Mt,bt;((ct=document.activeElement)==null?void 0:ct.tagName)==="INPUT"||((Mt=document.activeElement)==null?void 0:Mt.tagName)==="TEXTAREA"||(bt=A.current)==null||bt.handleKeyDown(N)},D=N=>{var ct,Mt,bt;((ct=document.activeElement)==null?void 0:ct.tagName)==="INPUT"||((Mt=document.activeElement)==null?void 0:Mt.tagName)==="TEXTAREA"||(bt=A.current)==null||bt.handleKeyUp(N)};return window.addEventListener("keydown",x),window.addEventListener("keyup",D),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",D)}},[E]),$t.useEffect(()=>{const x=k.current;if(!x||!E)return;const D=N=>{if(N.preventDefault(),N.stopPropagation(),A.current){const ct=x.getBoundingClientRect(),Mt=window.devicePixelRatio||1,bt=(N.clientX-ct.left)*Mt,wt=(N.clientY-ct.top)*Mt;let gt=N.deltaX,It=N.deltaY;N.deltaMode===1?(gt*=25,It*=25):N.deltaMode===2&&(gt*=100,It*=100),A.current.handlePointerInput("move",bt,wt,x.width,x.height),A.current.handleWheel(gt,It,bt,wt,x.width,x.height)}};return x.addEventListener("wheel",D,{passive:!1}),()=>{x.removeEventListener("wheel",D)}},[E]);const[J,at]=$t.useState([]);$t.useEffect(()=>{if(y&&y.objects){const x=y.objects.filter(D=>{var N,ct;return D.type==="Joystick"&&((N=D.inputBinding)==null?void 0:N.type)==="keyboard"&&((ct=D.inputBinding.keyboardConfig)==null?void 0:ct.showVirtualKeyboard)});at(x)}},[y]);const[,j]=$t.useState(0);$t.useEffect(()=>{if(J.length===0)return;let x;const D=()=>{j(N=>N+1),x=requestAnimationFrame(D)};return x=requestAnimationFrame(D),()=>cancelAnimationFrame(x)},[J.length]);const it=()=>J.map(x=>{const D=x.inputBinding.keyboardConfig,N=gt=>{var ut;const It={key:gt,code:gt,preventDefault:()=>{}};(ut=A.current)==null||ut.handleKeyDown(It)},ct=gt=>{var ut;const It={key:gt,code:gt,preventDefault:()=>{}};(ut=A.current)==null||ut.handleKeyUp(It)},Mt=A.current,bt=gt=>Mt&&Mt.activeKeys?Mt.activeKeys.has(gt.toLowerCase()):!1,wt=gt=>({width:"50px",height:"50px",background:gt?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.4)",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontWeight:"bold",fontSize:"18px",userSelect:"none",cursor:"pointer",backdropFilter:"blur(8px)",transition:"background 0.1s",boxShadow:gt?"none":"0 4px 6px rgba(0,0,0,0.1)"});return Qt.jsxs("div",{style:{position:"absolute",bottom:"40px",right:"40px",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",pointerEvents:"auto",zIndex:100},children:[Qt.jsx("div",{style:wt(bt(D.upKey)),onMouseDown:()=>N(D.upKey),onMouseUp:()=>ct(D.upKey),onMouseLeave:()=>ct(D.upKey),onTouchStart:gt=>{gt.preventDefault(),N(D.upKey)},onTouchEnd:gt=>{gt.preventDefault(),ct(D.upKey)},children:D.upKey.toUpperCase()}),Qt.jsxs("div",{style:{display:"flex",gap:"8px"},children:[Qt.jsx("div",{style:wt(bt(D.leftKey)),onMouseDown:()=>N(D.leftKey),onMouseUp:()=>ct(D.leftKey),onMouseLeave:()=>ct(D.leftKey),onTouchStart:gt=>{gt.preventDefault(),N(D.leftKey)},onTouchEnd:gt=>{gt.preventDefault(),ct(D.leftKey)},children:D.leftKey.toUpperCase()}),Qt.jsx("div",{style:wt(bt(D.downKey)),onMouseDown:()=>N(D.downKey),onMouseUp:()=>ct(D.downKey),onMouseLeave:()=>ct(D.downKey),onTouchStart:gt=>{gt.preventDefault(),N(D.downKey)},onTouchEnd:gt=>{gt.preventDefault(),ct(D.downKey)},children:D.downKey.toUpperCase()}),Qt.jsx("div",{style:wt(bt(D.rightKey)),onMouseDown:()=>N(D.rightKey),onMouseUp:()=>ct(D.rightKey),onMouseLeave:()=>ct(D.rightKey),onTouchStart:gt=>{gt.preventDefault(),N(D.rightKey)},onTouchEnd:gt=>{gt.preventDefault(),ct(D.rightKey)},children:D.rightKey.toUpperCase()})]})]},x.id)});return Qt.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[Qt.jsx("canvas",{ref:k,onPointerDown:x=>{var D;ot(x,"down"),x.currentTarget.setPointerCapture(x.pointerId),(D=k.current)==null||D.focus()},onPointerMove:x=>ot(x,"move"),onPointerUp:x=>{ot(x,"up"),x.currentTarget.releasePointerCapture(x.pointerId)},onPointerCancel:x=>{ot(x,"up"),x.currentTarget.releasePointerCapture(x.pointerId)},onClick:x=>ot(x,"click"),onKeyDown:x=>A.current.handleKeyDown(x.nativeEvent),onKeyUp:x=>A.current.handleKeyUp(x.nativeEvent),onContextMenu:x=>x.preventDefault(),tabIndex:0,style:{...s,width:"100%",height:"100%",outline:"none",display:"block",touchAction:"none",pointerEvents:E?"auto":"none"}}),it()]})});function ri(){const[y,t]=$t.useState(null),s=$t.useCallback((u,g)=>{y==null||y.setInputBool(u,g)},[y]),o=$t.useCallback((u,g)=>{y==null||y.setInputNumber(u,g)},[y]),e=$t.useCallback(u=>{y==null||y.fireTrigger(u)},[y]),n=$t.useCallback((u,g)=>{y==null||y.setInputText(u,g)},[y]),i=$t.useCallback((u,g)=>{y==null||y.setInputNumberArray(u,g)},[y]),a=$t.useCallback((u,g)=>{y==null||y.setInputStringArray(u,g)},[y]),r=$t.useCallback((u,g)=>{y==null||y.updateObjectOptions(u,g)},[y]),c=$t.useCallback((u,g,h)=>{y==null||y.updateConstraint(u,g,h)},[y]),d=$t.useCallback((u,g)=>{y==null||y.updateGraphData(u,g)},[y]),p=$t.useCallback(u=>y==null?void 0:y.getInputValue(u),[y]);return{setEngine:t,engine:y,setInputBool:s,setInputNumber:o,fireTrigger:e,setInputText:n,setInputNumberArray:i,setInputStringArray:a,updateConstraint:c,updateGraphData:d,updateObjectOptions:r,getInputValue:p}}const li=({artboard:y,config:t})=>{const s={...y.seo,...t},o=s.enableSmartExtraction!==!1;$t.useEffect(()=>{const a=s.title||y.name;a&&(document.title=a);let r=s.description;if(!r&&o){const p=y.objects.filter(u=>{var g;return((g=u.geometry)==null?void 0:g.type)==="Text"}).sort((u,g)=>{var h,f;return(((h=g.geometry.text)==null?void 0:h.length)||0)-(((f=u.geometry.text)==null?void 0:f.length)||0)});p.length>0&&(r=p[0].geometry.text)}r&&(e("name","description",r),e("property","og:description",r)),s.keywords&&s.keywords.length>0&&e("name","keywords",s.keywords.join(", "));const c=s.ogImage||y.backgroundImage;c&&e("property","og:image",c),a&&e("property","og:title",a),e("property","og:type","website")},[s,y,o]);const e=(a,r,c)=>{let d=document.querySelector(`meta[${a}="${r}"]`);d||(d=document.createElement("meta"),d.setAttribute(a,r),document.head.appendChild(d)),d.setAttribute("content",c)},n=()=>{const a=[];return a.push(Qt.jsx("h1",{children:s.title||y.name},"artboard-title")),y.objects.forEach((c,d)=>{var p,u;if(!(c.visible===!1||c.isVisible===!1))if(((p=c.geometry)==null?void 0:p.type)==="Text"){const g=c.geometry.text;g&&(c.geometry.fontSize>24?a.push(Qt.jsx("h2",{children:g},c.id||d)):a.push(Qt.jsx("p",{children:g},c.id||d)))}else if(((u=c.geometry)==null?void 0:u.type)==="Image"){const g=c.geometry.src,h=c.altText||c.name||"Illustration";a.push(Qt.jsx("img",{src:g,alt:h},c.id||d))}else c.type==="Button"&&a.push(Qt.jsx("button",{children:c.name||"Button"},c.id||d))}),a},i=s.jsonLd||{"@context":"https://schema.org","@type":"VisualArtwork",name:s.title||y.name,description:s.description,image:s.ogImage||y.backgroundImage,abstract:"Animated interface created with ExodeUI"};return Qt.jsxs("div",{id:`exode-seo-${y.id||"default"}`,"aria-hidden":"false",style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0",zIndex:-1},children:[n(),Qt.jsx("script",{type:"application/ld+json",children:JSON.stringify(i)})]})},ci={version:"6.4.1"}.version;Kt.BAR_STYLE_PRESETS=oi,Kt.BehaviorSensor=re,Kt.BehaviorType=tt,Kt.ConditionOp=je,Kt.ExodeSEO=li,Kt.ExodeUICanvas=ai,Kt.ExodeUIEngine=gs,Kt.LogicOp=_t,Kt.RapierPhysics=is,Kt.VERSION=ci,Kt.useExodeUI=ri,Object.defineProperty(Kt,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.mjs
CHANGED
|
@@ -4840,13 +4840,13 @@ class hi {
|
|
|
4840
4840
|
var k;
|
|
4841
4841
|
const o = this.objectStates.get(s.id);
|
|
4842
4842
|
if (!o) return;
|
|
4843
|
-
const e = o.options || s.options || {}, n = s.geometry.width ||
|
|
4843
|
+
const e = o.options || s.options || {}, n = s.geometry.width || 180, i = s.geometry.height || 40, a = -n / 2, r = -i / 2, c = e.cornerRadius ?? e.corner_radius ?? 6, d = e.disabled || e.previewState === "disabled", p = this.lastHoveredObjectId === s.id || e.previewState === "hover", u = (e.isOpen || e.previewState === "active") && !d;
|
|
4844
4844
|
let g = e.backgroundColor, h = e.borderColor, f = e.color || "#333333";
|
|
4845
|
-
d ? (g = e.disabledBackgroundColor || "#f3f4f6", h = e.disabledBorderColor || "#e5e7eb", f = e.disabledColor || "#9ca3af") : u ? (g = e.activeBackgroundColor || g, h = e.activeBorderColor || h, f = e.activeColor || f) : p && (g = e.hoverBackgroundColor || g, h = e.hoverBorderColor || h, f = e.hoverColor || f), g || (g = "#ffffff"), h || (h = "#e5e7eb");
|
|
4845
|
+
d ? (g = e.disabledBackgroundColor || "#f3f4f6", h = e.disabledBorderColor || "#e5e7eb", f = e.disabledColor || "#9ca3af") : u ? (g = e.activeBackgroundColor || g, h = e.activeBorderColor || h, f = e.activeColor || f) : p && (g = e.hoverBackgroundColor || g, h = e.hoverBorderColor || h, f = e.hoverColor || f), g || (g = "#ffffff"), h || (h = "#e5e7eb"), t.save();
|
|
4846
4846
|
const v = t.globalAlpha;
|
|
4847
|
-
t.globalAlpha = v * (e.opacity ?? 1), this.drawRoundRect(t, a, r, n, i, c), t.fillStyle = this.createCanvasFill(t, typeof g == "string" ? { type: "Solid", color: g } : g, n, i) || "#ffffff", t.fill();
|
|
4847
|
+
t.globalAlpha = v * (e.opacity ?? 1), t.beginPath(), this.drawRoundRect(t, a, r, n, i, c), t.fillStyle = this.createCanvasFill(t, typeof g == "string" ? { type: "Solid", color: g } : g, n, i) || "#ffffff", t.fill();
|
|
4848
4848
|
const m = e.borderWidth ?? 1;
|
|
4849
|
-
m > 0 && (t.strokeStyle = this.createCanvasFill(t, typeof h == "string" ? { type: "Solid", color: h } : h, n, i) || "#e5e7eb", t.lineWidth = m, t.stroke());
|
|
4849
|
+
m > 0 && (t.beginPath(), this.drawRoundRect(t, a, r, n, i, c), t.strokeStyle = this.createCanvasFill(t, typeof h == "string" ? { type: "Solid", color: h } : h, n, i) || "#e5e7eb", t.lineWidth = m, t.stroke());
|
|
4850
4850
|
const l = 12, b = e.chevronType || "chevron", S = e.chevronSize || 16, w = (u ? e.openIconColor : e.closedIconColor) || e.chevronColor || "#6b7280";
|
|
4851
4851
|
if (b !== "none") {
|
|
4852
4852
|
const A = a + n - l - S / 2;
|
|
@@ -4876,7 +4876,7 @@ class hi {
|
|
|
4876
4876
|
const V = e.listShadow || {}, U = t.getTransform(), X = Math.sqrt(U.a * U.a + U.b * U.b) || 1;
|
|
4877
4877
|
t.shadowColor = typeof V.color == "string" ? V.color : ((k = V.color) == null ? void 0 : k.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (V.blur ?? 12) * X, t.shadowOffsetY = (V.offsetY ?? 6) * X, t.shadowOffsetX = (V.offsetX ?? 0) * X, t.beginPath(), this.drawRoundRect(t, a, A, n, R, W), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, n, R) || "#ffffff", t.fill();
|
|
4878
4878
|
const Y = e.listBorderWidth ?? 1;
|
|
4879
|
-
Y > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: h }, n, R) || "#e5e7eb", t.lineWidth = Y, t.stroke()), t.restore();
|
|
4879
|
+
Y > 0 && (t.shadowColor = "transparent", t.beginPath(), this.drawRoundRect(t, a, A, n, R, W), t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: h }, n, R) || "#e5e7eb", t.lineWidth = Y, t.stroke()), t.restore();
|
|
4880
4880
|
const ot = e.itemFontSize || M, J = e.itemFontFamily || _;
|
|
4881
4881
|
t.font = `${I} ${ot}px ${J}`, T.forEach((at, j) => {
|
|
4882
4882
|
const it = A + F + j * L;
|
|
@@ -4889,7 +4889,7 @@ class hi {
|
|
|
4889
4889
|
t.fillText(at, a + l, it + L / 2);
|
|
4890
4890
|
});
|
|
4891
4891
|
}
|
|
4892
|
-
t.
|
|
4892
|
+
t.restore();
|
|
4893
4893
|
}
|
|
4894
4894
|
renderButton(t, s) {
|
|
4895
4895
|
var O;
|
|
@@ -6719,7 +6719,7 @@ const Ci = ({ artboard: y, config: t }) => {
|
|
|
6719
6719
|
]
|
|
6720
6720
|
}
|
|
6721
6721
|
);
|
|
6722
|
-
}, fi = "6.4.
|
|
6722
|
+
}, fi = "6.4.1", di = {
|
|
6723
6723
|
version: fi
|
|
6724
6724
|
}, wi = di.version;
|
|
6725
6725
|
export {
|