exodeui 6.1.13 → 6.2.3
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 +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26,4 +26,4 @@
|
|
|
26
26
|
`&&U++),p+=v})}else{if(g.fill){const U=A.globalAlpha,p=this.createCanvasFill(A,g.fill,E,i);A.fillStyle=p||g.fill.color||"#000000",A.globalAlpha=U*this.normalizeOpacity(g.fill.opacity??100);const L=q.fullText||(C.enableSegments?(C.segments||[]).map(j=>{let KA=j.text||"";const wA=j.textCase||C.textCase||"none";return wA==="uppercase"?KA.toUpperCase():wA==="lowercase"?KA.toLowerCase():wA==="capitalize"?KA.replace(/\b\w/g,T=>T.toUpperCase()):KA}).join(""):a);let r=0,H=CA;(Z||[]).forEach(j=>{const KA=j.text||"";let wA=Math.round(-E/2);S==="center"?wA=0:S==="right"&&(wA=Math.round(E/2)),sA(KA,wA,H,!1,r),r+=KA.length,H+=v,r<L.length&&(L[r]===`
|
|
27
27
|
`||L[r]==="\r")&&(c>0&&(H+=c),r++,L[r-1]==="\r"&&L[r]===`
|
|
28
28
|
`&&r++)}),A.globalAlpha=U}if(g.stroke&&g.stroke.width>0){const U=A.globalAlpha;g.fill&&g.fill.type!=="None"&&g.fill.isEnabled!==!1&&g.fill.opacity!==0&&g.fill.color!=="transparent"&&g.fill.color!=="rgba(0,0,0,0)"&&(A.shadowColor="transparent",A.shadowBlur=0,A.shadowOffsetX=0,A.shadowOffsetY=0),A.strokeStyle=g.stroke.color,A.lineWidth=g.stroke.width,A.globalAlpha=U*this.normalizeOpacity(g.stroke.opacity??100);let L=0,r=CA;(Z||[]).forEach(H=>{let j=Math.round(-E/2);S==="center"?j=0:S==="right"&&(j=Math.round(E/2)),sA(H.text,j,r,!0,L),L+=(H.text||"").length+1,r+=Y}),A.globalAlpha=U}}}applyStrokeAlignment(A,I,C,g,Q,E){if(!I.stroke||I.stroke.width<=0||I.stroke.isEnabled===!1)return;const i=I.stroke,D=i.width,o=(i.alignment||"center").toLowerCase();if(A.save(),I.fill&&I.fill.type!=="None"&&I.fill.isEnabled!==!1&&I.fill.opacity!==0&&I.fill.color!=="transparent"&&I.fill.color!=="rgba(0,0,0,0)"&&(A.shadowColor="transparent",A.shadowBlur=0,A.shadowOffsetX=0,A.shadowOffsetY=0),i.fill){const k=this.createCanvasFill(A,i.fill,g,Q);k?A.strokeStyle=k:A.strokeStyle=i.color||"#000000"}else A.strokeStyle=i.color||"#000000";const a=A.globalAlpha;A.globalAlpha=a*this.normalizeOpacity(i.opacity??100),A.lineWidth=D,A.lineCap=i.lineCap||"round",A.lineJoin=i.lineJoin||"round",i.miterLimit!==void 0&&(A.miterLimit=i.miterLimit);const h=i.trimStart??0,t=i.trimEnd??1,G=i.trimOffset??0,K=i.dashOffset??0,y=i.dashArray||[];if(h!==0||t!==1||G!==0){const k=this.getPerimeter(C,g,Q);if(k>0){const e=Math.max(0,Math.min(1,h)),N=Math.max(0,Math.min(1,t));if(e<N){const S=k*(N-e),c=k-S,M=-(k*(e+G%1+K%1));A.setLineDash([S,c]),A.lineDashOffset=M}else A.setLineDash([0,k])}}else y.length>0&&(A.setLineDash(y),A.lineDashOffset=K);C.type==="Line"||g===0||Q===0?(this.applyPath(A,C,g,Q,E),A.stroke()):o==="inside"?(A.lineWidth=D*2,A.save(),this.applyPath(A,C,g,Q,E),A.clip(),A.stroke(),A.restore()):o==="outside"?(A.lineWidth=D*2,this.applyPath(A,C,g,Q,E),A.stroke(),A.save(),A.globalCompositeOperation="destination-out",this.applyPath(A,C,g,Q,E),A.fill(),A.restore()):(A.lineWidth=D,this.applyPath(A,C,g,Q,E),A.stroke()),A.restore()}getPerimeter(A,I,C){switch(this.ensurePathPoints(A),A.type){case"Rectangle":return(I+C)*2;case"Ellipse":{const g=Math.abs(I)/2,Q=Math.abs(C)/2,E=Math.abs(A.sweepAngle??360),i=A.ratio||0,D=Math.PI*(3*(g+Q)-Math.sqrt((3*g+Q)*(g+3*Q)));if(E>=360&&i<=0)return D;let o=E/360*D;if(i>0){const w=Math.PI*(3*(g*i+Q*i)-Math.sqrt((3*g*i+Q*i)*(g*i+3*Q*i)));o+=E/360*w,E<360&&(o+=2*Math.sqrt((g-g*i)**2+(Q-Q*i)**2))}else E<360&&(o+=2*Math.max(g,Q));return isNaN(o)?0:o}case"Line":return A.length||Math.sqrt(I*I+C*C);case"Triangle":return I+Math.sqrt((I/2)**2+C**2)*2;case"Polygon":{const g=A.sides||3,Q=A.radius||Math.min(I,C)/2;return 2*g*Q*Math.sin(Math.PI/g)}case"Star":{const g=A.points||5,Q=A.outer_radius||Math.min(I,C)/2,E=A.inner_radius||Q/2,i=Math.PI/g;return Math.sqrt(Q*Q+E*E-2*Q*E*Math.cos(i))*g*2}case"Path":{const g=A.points||[];if(g.length<2)return A.length||0;let Q=0,E=g[0].x,i=g[0].y;for(let D=1;D<g.length;D++){const o=g[D];if(o.moveTo){E=o.x,i=o.y;continue}const w=E,a=i,h=g[D-1].out_x,t=g[D-1].out_y;if(h!==void 0||o.in_x!==void 0?Q+=this.getBezierLength(w,a,h??w,t??a,o.in_x??o.x,o.in_y??o.y,o.x,o.y):Q+=Math.sqrt((o.x-w)**2+(o.y-a)**2),E=o.x,i=o.y,o.closePath||D===g.length-1&&(A.is_closed||A.isClosed)){const G=E,K=i,y=[...g.slice(0,D+1)].reverse().find(J=>J.moveTo)||g[0],k=y.x,e=y.y,N=g[D].out_x,S=g[D].out_y,c=y.in_x,M=y.in_y;N!==void 0||c!==void 0?Q+=this.getBezierLength(G,K,N??G,S??K,c??k,M??e,k,e):Q+=Math.sqrt((k-G)**2+(e-K)**2)}}return Q}default:return(I+C)*2}}getBezierLength(A,I,C,g,Q,E,i,D,o=10){let w=0,a=A,h=I;for(let t=1;t<=o;t++){const G=t/o,K=1-G,y=G*G,k=K*K,e=k*K,N=y*G,S=e*A+3*k*G*C+3*K*y*Q+N*i,c=e*I+3*k*G*g+3*K*y*E+N*D,M=S-a,J=c-h;w+=Math.sqrt(M*M+J*J),a=S,h=c}return w}getBezierTAtLength(A,I,C,g,Q,E,i,D,o,w=20){if(A<=0)return 0;let a=0,h=I,t=C;for(let G=1;G<=w;G++){const K=G/w,y=1-K,k=K*K,e=y*y,N=e*y,S=k*K,c=N*I+3*e*K*g+3*y*k*E+S*D,M=N*C+3*e*K*Q+3*y*k*i+S*o,J=c-h,Y=M-t,V=Math.sqrt(J*J+Y*Y);if(a+V>=A){const f=A-a,b=V===0?0:f/V;return(G-1+b)/w}a+=V,h=c,t=M}return 1}getPointOnPath(A,I,C,g){if(this.ensurePathPoints(A),A.type==="Path"){const Q=A.points||[];if(Q.length<2)return{x:0,y:0,angle:0};let E=1/0,i=-1/0,D=1/0,o=-1/0;Q.forEach(e=>{typeof e.x=="number"&&typeof e.y=="number"&&(E=Math.min(E,e.x),i=Math.max(i,e.x),D=Math.min(D,e.y),o=Math.max(o,e.y),e.out_x!==void 0&&(E=Math.min(E,e.out_x),i=Math.max(i,e.out_x)),e.out_y!==void 0&&(D=Math.min(D,e.out_y),o=Math.max(o,e.out_y)),e.in_x!==void 0&&(E=Math.min(E,e.in_x),i=Math.max(i,e.in_x)),e.in_y!==void 0&&(D=Math.min(D,e.in_y),o=Math.max(o,e.in_y)))});const w=(E+i)/2,a=(D+o)/2,t=this.getPerimeter(A,I,C)*g;let G=0;const K=[];let y=Q[0],k=Q[0];for(let e=1;e<Q.length;e++){const N=Q[e];if(N.moveTo){y=N,k=N;continue}K.push({p0:y,p1:N}),(N.closePath||e===Q.length-1&&(A.is_closed||A.isClosed))&&K.push({p0:N,p1:k}),y=N}for(const e of K){const N=e.p0,S=e.p1;let c=0;const M=N.out_x!==void 0||S.in_x!==void 0;if(M?c=this.getBezierLength(N.x,N.y,N.out_x??N.x,N.out_y??N.y,S.in_x??S.x,S.in_y??S.y,S.x,S.y):c=Math.sqrt((S.x-N.x)**2+(S.y-N.y)**2),G+c>=t||e===K[K.length-1]){let J=0;if(M)return J=this.getBezierTAtLength(t-G,N.x,N.y,N.out_x??N.x,N.out_y??N.y,S.in_x??S.x,S.in_y??S.y,S.x,S.y,20),this.getBezierPointAndAngle(J,N,S,w,a);{J=c===0?0:(t-G)/c;const Y=N.x+(S.x-N.x)*J-w,V=N.y+(S.y-N.y)*J-a,f=Math.atan2(S.y-N.y,S.x-N.x);return{x:Y,y:V,angle:f}}}G+=c}}else if(A.type==="Ellipse"){const Q=Math.abs(I)/2,E=Math.abs(C)/2,i=A.sweepAngle??360,o=((A.startAngle??0)+i*g)*Math.PI/180,w=Q*Math.cos(o),a=E*Math.sin(o),h=-Q*Math.sin(o),t=E*Math.cos(o),G=Math.atan2(t,h);return{x:w,y:a,angle:G}}else if(A.type==="Rectangle"){const Q=Math.abs(I),E=Math.abs(C),D=(Q+E)*2*g;let o=0,w=0,a=0;return D<Q?(o=-Q/2+D,w=-E/2,a=0):D<Q+E?(o=Q/2,w=-E/2+(D-Q),a=Math.PI/2):D<2*Q+E?(o=Q/2-(D-(Q+E)),w=E/2,a=Math.PI):(o=-Q/2,w=E/2-(D-(2*Q+E)),a=-Math.PI/2),{x:o,y:w,angle:a}}return{x:0,y:0,angle:0}}getBezierPointAndAngle(A,I,C,g,Q){const E=I.x,i=I.y,D=I.out_x??I.x,o=I.out_y??I.y,w=C.in_x??C.x,a=C.in_y??C.y,h=C.x,t=C.y,G=1-A,K=A*A,y=G*G,k=y*G,e=K*A,N=k*E+3*y*A*D+3*G*K*w+e*h-g,S=k*i+3*y*A*o+3*G*K*a+e*t-Q,c=3*y*(D-E)+6*G*A*(w-D)+3*K*(h-w),M=3*y*(o-i)+6*G*A*(a-o)+3*K*(t-a),J=Math.atan2(M,c);return{x:N,y:S,angle:J}}applyAbsoluteTransform(A,I,C){if(!C.get(I))return;const Q=[];let E=I;for(;E;){Q.unshift(E);const i=C.get(E);E=i==null?void 0:i.parentId}Q.forEach(i=>{this.applyObjectTransform(A,i)})}applyObjectTransform(A,I){const C=this.objectStates.get(I);if(!C)return;A.translate(C.x,C.y),A.rotate(C.rotation*Math.PI/180);const g=(C.scale_x??1)*(C.flip_x===!0?-1:1),Q=(C.scale_y??1)*(C.flip_y===!0?-1:1);A.scale(g,Q)}applyPath(A,I,C,g,Q){I.data&&(I.type==="Path"||I.type==="Subtract"||I.type==="Union"||I.type==="Intersect"||I.type==="Exclude"||I.type),A.beginPath(),this._tracePath(A,I,C,g,Q)}_tracePath(A,I,C,g,Q){if(I){if(this.ensurePathPoints(I),I.type==="Rectangle"||I.type==="Image"){const E=Q!==void 0?Q:I.corner_radius??0;this.drawRoundRect(A,-C/2,-g/2,C,g,E)}else if(I.type==="Line")A.moveTo(-C/2,0),A.lineTo(C/2,0);else if(I.type==="Ellipse"){const{startAngle:E=0,sweepAngle:i=360,ratio:D=0}=I,o=C/2,w=g/2,a=E*Math.PI/180,h=i*Math.PI/180,t=a+h;i>=360&&D<=0?A.ellipse(0,0,o,w,0,0,Math.PI*2):(A.ellipse(0,0,o,w,0,a,t,!1),D>0?A.ellipse(0,0,o*D,w*D,0,t,a,!0):A.lineTo(0,0),A.closePath())}else if(I.type==="Triangle")A.moveTo(0,-g/2),A.lineTo(C/2,g/2),A.lineTo(-C/2,g/2),A.closePath();else if(I.type==="Polygon"){const E=I.sides||3,i=I.radius||Math.min(C,g)/2;for(let D=0;D<E;D++){const o=D*2*Math.PI/E-Math.PI/2,w=i*Math.cos(o),a=i*Math.sin(o);D===0?A.moveTo(w,a):A.lineTo(w,a)}A.closePath()}else if(I.type==="Star"){const E=I.inner_radius||20,i=I.outer_radius||50,D=I.points||5;for(let o=0;o<D*2;o++){const w=o*Math.PI/D-Math.PI/2,a=o%2===0?i:E,h=a*Math.cos(w),t=a*Math.sin(w);o===0?A.moveTo(h,t):A.lineTo(h,t)}A.closePath()}else if((I.type==="Path"||I.type==="Subtract"||I.type==="Union"||I.type==="Intersect"||I.type==="Exclude"||I.type==="BooleanOperation")&&I.points){this.frameCount%10===0&&console.log("[Engine] Tracing Path:",I.points.length,"points");let E=1/0,i=-1/0,D=1/0,o=-1/0;if(I.points.forEach(h=>{typeof h.x=="number"&&typeof h.y=="number"&&(E=Math.min(E,h.x),i=Math.max(i,h.x),D=Math.min(D,h.y),o=Math.max(o,h.y),h.out_x!==void 0&&(E=Math.min(E,h.out_x),i=Math.max(i,h.out_x)),h.out_y!==void 0&&(D=Math.min(D,h.out_y),o=Math.max(o,h.out_y)),h.in_x!==void 0&&(E=Math.min(E,h.in_x),i=Math.max(i,h.in_x)),h.in_y!==void 0&&(D=Math.min(D,h.in_y),o=Math.max(o,h.in_y)))}),E===1/0)return;const w=(E+i)/2,a=(D+o)/2;if(isNaN(w)||isNaN(a)){console.warn("[Engine] Invalid path center:",w,a);return}I.points.forEach((h,t)=>{if(t===0||h.moveTo)A.moveTo(h.x-w,h.y-a);else{const G=I.points[t-1];if(!G)return;const K=(G.out_x??G.x)-w,y=(G.out_y??G.y)-a,k=(h.in_x??h.x)-w,e=(h.in_y??h.y)-a;isNaN(K)||isNaN(k)||isNaN(h.x)?A.lineTo(h.x-w,h.y-a):A.bezierCurveTo(K,y,k,e,h.x-w,h.y-a)}if(h.closePath||t===I.points.length-1&&(I.is_closed||I.isClosed)){const G=[...I.points.slice(0,t+1)].reverse().find(K=>K.moveTo)||I.points[0];G&&(h.out_x!==void 0||G.in_x!==void 0)&&A.bezierCurveTo((h.out_x??h.x)-w,(h.out_y??h.y)-a,(G.in_x??G.x)-w,(G.in_y??G.y)-a,G.x-w,G.y-a),A.closePath()}})}else if(I.points&&Array.isArray(I.points)){let E=1/0,i=-1/0,D=1/0,o=-1/0;I.points.forEach(h=>{E=Math.min(E,h.x),i=Math.max(i,h.x),D=Math.min(D,h.y),o=Math.max(o,h.y)});const w=(E+i)/2,a=(D+o)/2;I.points.forEach((h,t)=>{if(t===0)A.moveTo(h.x-w,h.y-a);else{const G=I.points[t-1];G.out_x!==void 0||h.in_x!==void 0?A.bezierCurveTo((G.out_x??G.x)-w,(G.out_y??G.y)-a,(h.in_x??h.x)-w,(h.in_y??h.y)-a,h.x-w,h.y-a):A.lineTo(h.x-w,h.y-a)}(h.closePath||t===I.points.length-1&&(I.is_closed||I.isClosed))&&A.closePath()})}}}renderInputBox(A,I){var sA,FA;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=((sA=I.geometry)==null?void 0:sA.width)||250,E=((FA=I.geometry)==null?void 0:FA.height)||45,i=this.focusedId===I.id,D=this.lastHoveredObjectId===I.id,o=g.previewState||"default",w=o!=="default"?o:i?"focused":D?"hovered":"default",a=g.label||{visible:!0,text:"Label"},h=g.helperText||{visible:!1,text:"Helper text"},t=g.leftIcon||{visible:!1},G=g.rightIcon||{visible:!1},K=g.multiline===!0,y=g.corner_radius??8,k=g.corners||{tl:y,tr:y,bl:y,br:y},e=[k.tl,k.tr,k.br,k.bl];let N=g.backgroundColor||"rgba(31, 41, 55, 1)",S=g.borderColor||"rgba(55, 65, 81, 1)",c=g.borderWidth??1.5,M=g.color||"#ffffff",J=g.placeholderColor||"rgba(156, 163, 175, 1)",Y=g.fontSize||14;const V=`${w}Style`,f=g[V];if(f?(f.backgroundColor!==void 0&&(N=f.backgroundColor),f.borderColor!==void 0&&(S=f.borderColor),f.borderWidth!==void 0&&(c=f.borderWidth),f.color!==void 0&&(M=f.color),f.placeholderColor!==void 0&&(J=f.placeholderColor),f.fontSize!==void 0&&(Y=f.fontSize)):w==="focused"?(S=g.focusBorderColor||"rgba(59, 130, 246, 1)",c=Math.max(c,2)):w==="hovered"||w==="hover"?(S=g.hoverBorderColor||S,N=g.hoverBackgroundColor||N):w==="disabled"?(N=g.disabledBackgroundColor||"rgba(31, 41, 55, 0.6)",S=g.disabledBorderColor||"rgba(55, 65, 81, 0.4)"):w==="error"&&(S="rgba(239, 68, 68, 1)",c=Math.max(c,2)),A.beginPath(),this.drawRoundRect(A,-Q/2,-E/2,Q,E,e),A.fillStyle=N,A.fill(),c>0&&(A.strokeStyle=S,A.lineWidth=c,A.stroke(),w==="focused"||w==="focus")){A.save(),A.beginPath();const yA=e.map(qA=>qA+2);this.drawRoundRect(A,-Q/2-2,-E/2-2,Q+4,E+4,yA),A.strokeStyle="rgba(59, 130, 246, 0.3)",A.lineWidth=2,A.stroke(),A.restore()}const b=(yA,qA)=>{if(!yA.visible||!yA.svgPath)return;const JA=yA.size||14,LA=yA.offset??16,U=yA.color||"#ffffff",p=qA?-(Q/2)+LA:Q/2-LA,L=yA.svgPath;if(A.save(),A.translate(p,0),!L.startsWith("<svg")){const r=new Path2D(L),H=JA/24;A.scale(H,H),A.translate(-12,-12),A.fillStyle=U,A.fill(r)}A.restore()};b(t,!0),b(G,!1);const x=g.text||"",IA=g.placeholder||"Enter text...",$=!x,q=x||IA,v=$?J:M,z=Y,Z=g.fontFamily||"Inter",m=g.fontWeight||400;A.font=`${m} ${z}px "${Z}", sans-serif`,A.fillStyle=v,A.textAlign="left",A.textBaseline=K?"top":"middle";const u=g.inputPadding??16,X=t.visible?(t.offset??16)+(t.size||14)/2+8:u,CA=G.visible?(G.offset??16)+(G.size||14)/2+8:u,O=-(Q/2)+X,AA=Q-X-CA,tA=g.inputType==="password"?"•".repeat(q.length):q;if(A.save(),A.beginPath(),A.rect(O-2,-E/2+4,AA+4,E-8),A.clip(),K){const yA=tA.split(`
|
|
29
|
-
`);let qA=-E/2+u;const JA=z*1.2;let LA=0;yA.forEach((U,p)=>{const L=U.split(" ");let r="";for(let H=0;H<L.length;H++){const j=r+L[H]+" ";A.measureText(j).width>AA&&H>0?(A.fillText(r,O,qA),r=L[H]+" ",qA+=JA):r=j}A.fillText(r,O,qA),LA=A.measureText(r).width,p<yA.length-1&&(qA+=JA,LA=0)}),i&&!$&&Math.floor(performance.now()/500)%2===0&&A.fillRect(O+LA,qA,1.5,z)}else{const qA=A.measureText(tA).width;let JA=0;if(qA>AA&&(JA=qA-AA),A.fillText(tA,O-JA,0),i&&!$&&Math.floor(performance.now()/500)%2===0){const U=O+qA-JA;A.fillRect(U,-(z/2),1.5,z)}}if(A.restore(),a.visible!==!1){const yA=a.text||"Label",qA=a.fontSize||12,JA=a.color||"rgba(156, 163, 175, 1)",LA=a.offset??8;A.font=`600 ${qA}px "${Z}", sans-serif`,A.fillStyle=JA,A.textAlign="left",A.textBaseline="bottom";const U=-(Q/2),p=-(E/2)-LA;A.fillText(yA,U,p)}if(h.visible===!0){const yA=h.text||"Helper text",qA=h.fontSize||11,JA=w==="error"?"rgba(239, 68, 68, 1)":h.color||"rgba(156, 163, 175, 1)",LA=h.offset??6;A.font=`400 ${qA}px "${Z}", sans-serif`,A.fillStyle=JA,A.textAlign="left",A.textBaseline="top";const U=-(Q/2),p=E/2+LA;A.fillText(yA,U,p)}}renderSlider(A,I){const C=this.objectStates.get(I.id),g=(C==null?void 0:C.geometry)||I.geometry,Q=(C==null?void 0:C.options)||I.options||{},E=g.width||200,i=Q.value??50,D=Q.min??0,w=(Q.max??100)-D,a=w===0?0:(i-D)/w,h=Q.trackHeight||4,t=Q.trackRoundedness??2,G=Q.trackShape??"Rectangle",K=Q.trackPath||"",y=Q.activeColor||"#3b82f6",k=Q.inactiveColor||"#374151",e=Q.thumbShape||"Ellipse",N=Q.thumbWidth??16,S=Q.thumbHeight??16,c=Q.thumbRoundedness??0,M=Q.thumbColor||"#ffffff",J=Q.thumbPath||"",Y=Q.thumbIcon||"",V=Q.showValueTooltip??!1,f=Q.tooltipBgColor||"#333333",b=Q.tooltipColor||"#ffffff",x=Q.tooltipOffsetX??0,IA=Q.tooltipOffsetY??-25,$=(O,AA,tA,sA,FA,yA,qA)=>{if((O==="Custom"||O==="Icon")&&qA)try{const JA=new Path2D(qA);if(A.save(),A.translate(AA,tA),O==="Icon"){const LA=Math.min(sA,FA)/24;A.scale(LA,LA),A.translate(-12,-12)}A.fill(JA),A.restore();return}catch(JA){console.error("Error drawing slider shape in engine:",JA)}if(A.beginPath(),O==="Ellipse")A.ellipse(AA,tA,sA/2,FA/2,0,0,Math.PI*2);else if(O==="Rectangle")this.drawRoundRect(A,AA-sA/2,tA-FA/2,sA,FA,yA);else if(O==="Triangle")A.moveTo(AA,tA-FA/2),A.lineTo(AA+sA/2,tA+FA/2),A.lineTo(AA-sA/2,tA+FA/2),A.closePath();else if(O==="Diamond")A.moveTo(AA,tA-FA/2),A.lineTo(AA+sA/2,tA),A.lineTo(AA,tA+FA/2),A.lineTo(AA-sA/2,tA),A.closePath();else if(O==="Polygon"){const JA=I.geometry.sides||3,LA=I.geometry.radius||Math.min(sA,FA)/2;for(let U=0;U<JA;U++){const p=U*2*Math.PI/JA-Math.PI/2,L=AA+LA*Math.cos(p),r=tA+LA*Math.sin(p);U===0?A.moveTo(L,r):A.lineTo(L,r)}A.closePath()}else if(O==="Star"){const LA=Math.min(sA,FA)/2,U=LA/2;for(let p=0;p<5*2;p++){const L=p%2===0?LA:U,r=p*Math.PI/5-Math.PI/2;A.lineTo(AA+L*Math.cos(r),tA+L*Math.sin(r))}A.closePath()}else O==="Line"&&(A.moveTo(AA-sA/2,tA),A.lineTo(AA+sA/2,tA));A.fill()};A.fillStyle=k,G==="Line"?(A.strokeStyle=k,A.lineWidth=h,A.beginPath(),A.moveTo(-E/2,0),A.lineTo(E/2,0),A.stroke()):$(G,0,0,E,h,t,K);const q=E-N,v=-E/2+N/2+a*q,z=v- -E/2;z>0&&(A.fillStyle=y,G==="Line"?(A.strokeStyle=y,A.lineWidth=h,A.beginPath(),A.moveTo(-E/2,0),A.lineTo(v,0),A.stroke()):G==="Rectangle"&&(A.beginPath(),this.drawRoundRect(A,-E/2,-h/2,z,h,t),A.fill())),A.save(),A.translate(v,0);const Z=A.getTransform(),m=Math.sqrt(Z.a*Z.a+Z.b*Z.b)||1;if(A.shadowColor="rgba(0,0,0,0.2)",A.shadowBlur=4*m,A.shadowOffsetY=1*m,A.fillStyle=M,$(e,0,0,N,S,c,e==="Icon"?Y:J),A.restore(),V){A.save(),A.translate(v+x,IA);const O=Math.round(i).toString();A.font="10px Inter, sans-serif";const AA=A.measureText(O),tA=6,sA=4,FA=AA.width+tA*2,yA=14+sA;A.beginPath(),this.drawRoundRect(A,-FA/2,-yA/2,FA,yA,4),A.fillStyle=f,A.fill(),A.fillStyle=b,A.textAlign="center",A.textBaseline="middle",A.fillText(O,0,0),A.restore()}const u=Q.label||{},X=Q.helperText||{},CA=Q.fontFamily||"Inter";if(u.visible!==!1){const O=u.text||"Label",AA=u.fontSize||12,tA=u.color||"rgba(156, 163, 175, 1)",sA=u.offset??8;A.font=`600 ${AA}px "${CA}", sans-serif`,A.fillStyle=tA,A.textAlign="left",A.textBaseline="bottom";const FA=-(E/2),yA=-(h/2)-sA;A.fillText(O,FA,yA)}if(X.visible===!0){const O=X.text||"Helper text",AA=X.fontSize||11,tA=X.color||"rgba(156, 163, 175, 1)",sA=X.offset??6;A.font=`400 ${AA}px "${CA}", sans-serif`,A.fillStyle=tA,A.textAlign="left",A.textBaseline="top";const FA=-(E/2),yA=h/2+sA;A.fillText(O,FA,yA)}}renderDropdown(A,I){var IA;const C=this.objectStates.get(I.id);if(!C)return;const g=C.options||I.options||{},Q=I.geometry.width||160,E=I.geometry.height||40,i=-Q/2,D=-E/2,o=g.corner_radius??6,w=g.disabled||g.previewState==="disabled",a=this.lastHoveredObjectId===I.id||g.previewState==="hover",h=(g.isOpen||g.previewState==="active")&&!w;let t=g.backgroundColor,G=g.borderColor,K=g.color||"#333333";w?(t=g.disabledBackgroundColor||"#f3f4f6",G=g.disabledBorderColor||"#e5e7eb",K=g.disabledColor||"#9ca3af"):h?(t=g.activeBackgroundColor||t,G=g.activeBorderColor||G,K=g.activeColor||K):a&&(t=g.hoverBackgroundColor||t,G=g.hoverBorderColor||G,K=g.hoverColor||K),t||(t="#ffffff"),G||(G="#e5e7eb");const y=A.globalAlpha;A.globalAlpha=y*(g.opacity??1),this.drawRoundRect(A,i,D,Q,E,o),A.fillStyle=this.createCanvasFill(A,typeof t=="string"?{type:"Solid",color:t}:t,Q,E)||"#ffffff",A.fill();const k=g.borderWidth??1;k>0&&(A.strokeStyle=this.createCanvasFill(A,typeof G=="string"?{type:"Solid",color:G}:G,Q,E)||"#e5e7eb",A.lineWidth=k,A.stroke());const e=12,N=g.chevronType||"chevron",S=g.chevronSize||16,c=(h?g.openIconColor:g.closedIconColor)||g.chevronColor||"#6b7280";if(N!=="none"){const $=i+Q-e-S/2;A.save(),A.translate($,0);const q=h?g.openIconAngle??180:g.closedIconAngle??0;if(A.rotate(q*Math.PI/180),A.strokeStyle=c,A.fillStyle=c,A.lineWidth=1.5,A.lineCap="round",A.lineJoin="round",N==="chevron")A.beginPath(),A.moveTo(-S/2,-S*.2),A.lineTo(0,S*.2),A.lineTo(S/2,-S*.2),A.stroke();else if(N==="custom"||N==="path"){const v=h&&g.openIconPath||g.closedIconPath;if(v){const z=new Path2D(v);A.save();const Z=S/24;A.scale(Z,Z),A.translate(-12,-12),A.fill(z),A.restore()}}A.restore()}const M=g.selectedOption||g.placeholder||"Select...",J=g.fontSize||14,Y=g.fontWeight||400,V=g.fontFamily||"Inter, sans-serif";A.font=`${Y} ${J}px ${V}`;const f=w?g.disabledColor||"#9ca3af":!g.selectedOption&&g.placeholder?"#9ca3af":K;A.fillStyle=this.createCanvasFill(A,typeof f=="string"?{type:"Solid",color:f}:f,Q,E)||"#333333",A.textAlign="left",A.textBaseline="middle";const b=N==="none"?0:S+8,x=Q-e*2-b;if(A.save(),A.beginPath(),A.rect(i+e,D,x,E),A.clip(),A.fillText(M,i+e,0),A.restore(),h&&!w){const $=D+E+4,q=g.optionsList||[],v=g.itemHeight||32,z=g.listPadding??4,Z=q.length*v+z*2,m=g.listCornerRadius??o;A.save();const u=g.listShadow||{},X=A.getTransform(),CA=Math.sqrt(X.a*X.a+X.b*X.b)||1;A.shadowColor=typeof u.color=="string"?u.color:((IA=u.color)==null?void 0:IA.color)||"rgba(0,0,0,0.15)",A.shadowBlur=(u.blur??12)*CA,A.shadowOffsetY=(u.offsetY??6)*CA,A.shadowOffsetX=(u.offsetX??0)*CA,A.beginPath(),this.drawRoundRect(A,i,$,Q,Z,m),A.fillStyle=this.createCanvasFill(A,typeof g.listBackgroundColor=="string"?{type:"Solid",color:g.listBackgroundColor}:g.listBackgroundColor||{type:"Solid",color:"#ffffff"},Q,Z)||"#ffffff",A.fill();const O=g.listBorderWidth??1;O>0&&(A.shadowColor="transparent",A.strokeStyle=this.createCanvasFill(A,typeof g.listBorderColor=="string"?{type:"Solid",color:g.listBorderColor}:g.listBorderColor||{type:"Solid",color:G},Q,Z)||"#e5e7eb",A.lineWidth=O,A.stroke()),A.restore();const AA=g.itemFontSize||J,tA=g.itemFontFamily||V;A.font=`${Y} ${AA}px ${tA}`,q.forEach((sA,FA)=>{const yA=$+z+FA*v;if(sA===g.selectedOption)A.fillStyle=this.createCanvasFill(A,typeof g.itemSelectedBackgroundColor=="string"?{type:"Solid",color:g.itemSelectedBackgroundColor}:g.itemSelectedBackgroundColor||{type:"Solid",color:"#f3f4f6"},Q,v)||"#f3f4f6",A.fillRect(i+O,yA,Q-O*2,v),A.fillStyle=g.itemSelectedColor||g.activeColor||K||"#374151";else if(A.fillStyle=g.listTextColor||K||"#333333",this.activeDropdownId===I.id&&this._lastPointerPos){const JA=this._lastPointerPos.y-($+z),LA=Math.floor(JA/v);FA===LA&&(A.fillStyle=this.createCanvasFill(A,typeof g.itemHoverBackgroundColor=="string"?{type:"Solid",color:g.itemHoverBackgroundColor}:g.itemHoverBackgroundColor||{type:"Solid",color:"#f9fafb"},Q,v)||"#f9fafb",A.fillRect(i+O,yA,Q-O*2,v),A.fillStyle=g.itemHoverColor||K)}A.fillText(sA,i+e,yA+v/2)})}A.globalAlpha=y}renderButton(A,I){var N,S,c,M;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=((N=I.geometry)==null?void 0:N.width)||120,E=((S=I.geometry)==null?void 0:S.height)||40,i=-Q/2,D=-E/2,o=this.lastHoveredObjectId===I.id,w=g.corner_radius??8,a=g.bgShape||"Rectangle",h=o?((c=g.hoverStyle)==null?void 0:c.backgroundColor)||g.buttonBgColor||"#3b82f6":g.buttonBgColor||"#3b82f6",t=g.label||{},G=o?((M=g.hoverStyle)==null?void 0:M.textColor)||t.color||"#ffffff":t.color||"#ffffff",K=g.icon||{enabled:!1};A.save(),A.beginPath(),a==="Rectangle"?this.drawRoundRect(A,i,D,Q,E,w):a==="Ellipse"||a==="Circle"?A.ellipse(0,0,Q/2,E/2,0,0,Math.PI*2):a==="Pill"&&this.drawRoundRect(A,i,D,Q,E,E/2),A.fillStyle=h,A.fill();const y=t.fontSize||14,k=t.fontFamily||"Inter";A.font=`${t.fontWeight||400} ${y}px "${k}", sans-serif`,A.fillStyle=G,A.textAlign="center",A.textBaseline="middle";let e=0;if(K.enabled&&K.svgPath){const J=K.size||16,Y=K.gap||8,V=K.position==="left"?-(A.measureText(t.text||"").width/2+J/2+Y/2):A.measureText(t.text||"").width/2+J/2+Y/2;A.save(),A.translate(V,0);const f=new Path2D(K.svgPath),b=J/24;A.scale(b,b),A.translate(-12,-12),A.fillStyle=K.color||G,A.fill(f),A.restore(),e=K.position==="left"?J/2+Y/2:-(J/2+Y/2)}A.fillText(t.text||"Button",e,0),A.restore()}renderToggleButton(A,I){var y,k;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=g.checked??!1,E=((y=I.geometry)==null?void 0:y.width)||120,i=((k=I.geometry)==null?void 0:k.height)||40,D=-E/2,o=-i/2,w=g.corner_radius??8,a=g.label||{},h=Q?g.activeColor||"#3b82f6":g.inactiveColor||"#374151",t=Q?g.activeTextColor||"#ffffff":g.inactiveTextColor||"#9ca3af";A.save(),A.beginPath(),this.drawRoundRect(A,D,o,E,i,w),A.fillStyle=h,A.fill();const G=a.fontSize||14,K=a.fontFamily||"Inter";A.font=`${a.fontWeight||600} ${G}px "${K}", sans-serif`,A.fillStyle=t,A.textAlign="center",A.textBaseline="middle",A.fillText(a.text||"Toggle",0,0),A.restore()}renderToggle(A,I){var e,N;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=((e=I.geometry)==null?void 0:e.width)||52,E=((N=I.geometry)==null?void 0:N.height)||30,i=-Q/2,D=-E/2,o=g.checked??!1,w=g.corner_radius??E/2;A.beginPath(),this.drawRoundRect(A,i,D,Q,E,w),A.fillStyle=o?g.activeColor||"#10b981":g.inactiveColor||"#374151",g.disabled&&(A.globalAlpha*=.5),A.fill();const a=3,h=E-a*2,t=h/2,G=i+a,K=i+Q-a-h,y=o?K:G,k=D+a;if(A.beginPath(),A.arc(y+t,k+t,t,0,Math.PI*2),A.fillStyle=g.knobColor||"#ffffff",A.fill(),g.disabled&&(A.globalAlpha*=2),g.label&&g.label.text){const S=g.label,c=S.fontSize||14,M=S.fontWeight||400,J=S.fontFamily||"Inter";A.font=`${M} ${c}px "${J}", sans-serif`,A.fillStyle=S.color||"#f3f4f6",A.textBaseline="middle";const Y=S.gap||10;let V=0,f=0;S.position==="left"?(A.textAlign="right",V=i-Y,f=0):S.position==="right"?(A.textAlign="left",V=i+Q+Y,f=0):S.position==="top"?(A.textAlign="center",V=0,f=D-Y,A.textBaseline="bottom"):S.position==="bottom"?(A.textAlign="center",V=0,f=D+E+Y,A.textBaseline="top"):(A.textAlign="left",V=i+Q+Y,f=0),A.fillText(S.text,V,f)}}renderLineGraph(A,I,C,g){let Q=I.datasets||[];if((!Q||Q.length===0)&&(I.data||I.graphData)&&(Q=[{id:"line-1",label:"Series 1",data:I.data||I.graphData||[],lineColor:I.lineColor||"#3b82f6",lineWidth:I.lineWidth||2,showArea:I.showArea||!1,areaColor:I.areaColor||"rgba(139, 92, 246, 0.3)",smoothing:I.smoothing||!1,showPoints:I.showPoints!==void 0?I.showPoints:!0,pointSize:I.pointSize||6,pointFill:I.pointFill||"#ffffff",pointStrokeColor:I.pointStrokeColor||I.lineColor||"#3b82f6",pointStrokeWidth:I.pointStrokeWidth||2}]),!Q||Q.length===0||!Q.some(K=>K.data&&K.data.length>=2)){A.save(),A.fillStyle="#6366f1",A.font="12px Inter, system-ui, sans-serif",A.textAlign="center",A.textBaseline="middle",A.fillText("NO DATA",0,0),A.restore();return}let E=1/0,i=-1/0,D=0;if(Q.forEach(K=>{let y=K.data;if(K.isVarEnabled&&K.inputId){let k=this.inputs.get(K.inputId);if(k===void 0){const e=this.inputNameMap.get(K.inputId);e&&e.length>0&&(k=this.inputs.get(e[0]))}k&&Array.isArray(k)&&(y=k)}if(y&&y.length>0){const k=y.filter(e=>typeof e=="number"&&!isNaN(e));k.length>0&&(E=Math.min(E,...k),i=Math.max(i,...k),D=Math.max(D,y.length))}K._resolvedData=y}),D<2)return;const o=i-E,w=C/(D-1),a=K=>{const y=o===0?.5:(K-E)/o;return g/2-y*g},h=K=>K*w-C/2,t=I.axisColor||"#333333";if(I.showXAxis&&(A.beginPath(),A.strokeStyle=I.xAxisColor||t,A.lineWidth=1,A.moveTo(-C/2,g/2),A.lineTo(C/2,g/2),A.stroke()),I.showYAxis&&(A.beginPath(),A.strokeStyle=I.yAxisColor||t,A.lineWidth=1,A.moveTo(-C/2,-g/2),A.lineTo(-C/2,g/2),A.stroke()),A.fillStyle=I.axisLabelColor||"#333333",A.font=`${I.axisLabelFontSize||10}px Inter, sans-serif`,I.showXLabels){A.textAlign="center",A.textBaseline="top";for(let K=0;K<D;K++){const y=h(K);A.fillText(`${K+1}`,y,g/2+5)}}if(I.showYLabels){A.textAlign="right",A.textBaseline="middle";const K=-C/2-5,y=(i+E)/2;A.fillText(i.toFixed(1),K,a(i)),A.fillText(y.toFixed(1),K,a(y)),A.fillText(E.toFixed(1),K,a(E))}const G=10;if(Q.forEach(K=>{const y=K._resolvedData;if(!(!y||y.length<2)){if(K.showArea){if(A.beginPath(),A.moveTo(h(0),g/2),A.lineTo(h(0),a(y[0])),K.smoothing&&y.length>2)for(let e=0;e<y.length-1;e++){const N=y[e===0?e:e-1],S=y[e],c=y[e+1],M=y[e+1===y.length-1?e+1:e+2];for(let J=1;J<=G;J++){const Y=J/G,V=this._catmullRom(N,S,c,M,Y);A.lineTo(h(e+Y),a(V))}}else for(let e=1;e<y.length;e++)A.lineTo(h(e),a(y[e]));A.lineTo(h(y.length-1),g/2),A.closePath();const k=A.globalAlpha;A.globalAlpha=k*(I.areaOpacity??.3),A.fillStyle=K.areaColor||"rgba(139, 92, 246, 0.2)",A.fill(),A.globalAlpha=k}if(A.beginPath(),A.strokeStyle=K.lineColor||"#3b82f6",A.lineWidth=K.lineWidth||2,A.lineJoin="round",A.lineCap="round",A.moveTo(h(0),a(y[0])),K.smoothing&&y.length>2)for(let k=0;k<y.length-1;k++){const e=y[k===0?k:k-1],N=y[k],S=y[k+1],c=y[k+1===y.length-1?k+1:k+2];for(let M=1;M<=G;M++){const J=M/G,Y=this._catmullRom(e,N,S,c,J);A.lineTo(h(k+J),a(Y))}}else for(let k=1;k<y.length;k++)A.lineTo(h(k),a(y[k]));A.stroke(),K.showPoints&&y.forEach((k,e)=>{const N=h(e),S=a(k);A.beginPath(),A.arc(N,S,(K.pointSize||6)/2,0,Math.PI*2),A.fillStyle=K.pointFill||"#ffffff",A.fill(),A.strokeStyle=K.pointStrokeColor||K.lineColor||"#3b82f6",A.lineWidth=K.pointStrokeWidth||1,A.stroke()})}}),I.showLegend&&Q.length>0){const K=C/2-10;let y=-g/2+15;const k=I.legendFontSize||10,e=k+5;A.font=`${k}px Inter, sans-serif`,A.textAlign="right",A.textBaseline="alphabetic",Q.forEach(N=>{const c=N.label||"Series",M=A.measureText(c).width;A.beginPath(),A.rect(K-M-8-5,y-(8/2+2),8,8),A.fillStyle=N.lineColor||"#3b82f6",A.fill(),A.fillStyle=I.legendColor||"#333333",A.fillText(c,K,y),y+=e})}}_catmullRom(A,I,C,g,Q){const E=(C-A)*.5,i=(g-I)*.5,D=Q*Q,o=Q*D;return(2*I-2*C+E+i)*o+(-3*I+3*C-2*E-i)*D+E*Q+I}normalizeOpacity(A){const I=typeof A=="number"?A:parseFloat(String(A));return isNaN(I)?1:I>1?Math.min(1,I/100):Math.max(0,Math.min(1,I))}createCanvasFill(A,I,C,g){var Q,E,i;if(!I||I.type==="None")return null;if(typeof I=="string")return I;if(I.type==="Solid"&&I.color){const D=I.color,w=(((E=(Q=this.artboard)==null?void 0:Q.tokens)==null?void 0:E.colors)||{})[D]||D;return A.fillStyle=w,w}if((I.type==="LinearGradient"||I.type==="RadialGradient"||I.type==="AngularGradient"||I.type==="DiamondGradient")&&I.stops){const D=(o,w=100)=>{var S,c;const h=(((c=(S=this.artboard)==null?void 0:S.tokens)==null?void 0:c.colors)||{})[o]||o,t=this.normalizeOpacity(I.opacity??100),K=this.normalizeOpacity(w)*t;if(K>=1&&h.startsWith("#"))return h;const y=h.startsWith("#")?h.replace("#",""):"ffffff",k=parseInt(y.substring(0,2),16),e=parseInt(y.substring(2,4),16),N=parseInt(y.substring(4,6),16);return`rgba(${k}, ${e}, ${N}, ${K})`};if(I.type==="LinearGradient"){const o=(K,y,k)=>Array.isArray(K)?K[y]??(y===0?0:1):K&&typeof K=="object"?K[k]??(y===0?0:1):y===0?0:1,w=o(I.start,0,"x")*C-C/2,a=o(I.start,1,"y")*g-g/2,h=o(I.end,0,"x")*C-C/2,t=o(I.end,1,"y")*g-g/2,G=A.createLinearGradient(w,a,h,t);if(I.stops.forEach(K=>{const y=K.offset!==void 0?K.offset:K.pos!==void 0?K.pos:K.position!==void 0?K.position:0,k=D(K.color||"#000000",K.opacity??100);G.addColorStop(Math.max(0,Math.min(1,y)),k)}),I.gradientTransform&&G.setTransform){const[K,y,k,e,N,S]=I.gradientTransform;G.setTransform({a:K,b:y,c:k,d:e,e:N,f:S})}return G}else if(I.type==="RadialGradient"){const o=(G,K,y)=>Array.isArray(G)?G[K]??.5:G&&typeof G=="object"?G[y]??.5:.5,w=o(I.center,0,"x")*C-C/2,a=o(I.center,1,"y")*g-g/2,h=(I.radius??.5)*Math.max(C,g),t=A.createRadialGradient(w,a,0,w,a,h);if(I.stops.forEach(G=>{const K=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,y=D(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,K)),y)}),I.gradientTransform&&t.setTransform){const[G,K,y,k,e,N]=I.gradientTransform;t.setTransform({a:G,b:K,c:y,d:k,e,f:N})}return t}else if(I.type==="AngularGradient"){const o=(G,K,y)=>Array.isArray(G)?G[K]??.5:G&&typeof G=="object"?G[y]??.5:.5,w=o(I.center||[.5,.5],0,"x")*C-C/2,a=o(I.center||[.5,.5],1,"y")*g-g/2,h=(I.degree||I.angle||0)*(Math.PI/180),t=(i=A.createConicGradient)==null?void 0:i.call(A,h,w,a);if(t){if(I.stops.forEach(G=>{const K=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,y=D(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,K)),y)}),I.gradientTransform&&t.setTransform){const[G,K,y,k,e,N]=I.gradientTransform;t.setTransform({a:G,b:K,c:y,d:k,e,f:N})}return t}}else if(I.type==="DiamondGradient"){const o=(G,K,y)=>Array.isArray(G)?G[K]??.5:G&&typeof G=="object"?G[y]??.5:.5,w=o(I.center||[.5,.5],0,"x")*C-C/2,a=o(I.center||[.5,.5],1,"y")*g-g/2,h=(I.radius??.5)*Math.max(C,g);A.save(),A.translate(w,a),A.rotate(Math.PI/4);const t=A.createRadialGradient(0,0,0,0,0,h);if(I.stops.forEach(G=>{const K=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,y=D(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,K)),y)}),I.gradientTransform&&t.setTransform){const[G,K,y,k,e,N]=I.gradientTransform;t.setTransform({a:G,b:K,c:y,d:k,e,f:N})}return A.scale(1/Math.SQRT2,1/Math.SQRT2),A.fillStyle=t,A.restore(),t}}if(I.type==="Pattern"&&I.url){let D=this.imageCache.get(I.url);if(D||(D=new Image,D.src=I.url,this.imageCache.set(I.url,D)),D.complete&&D.naturalWidth>0){const o=A.createPattern(D,"repeat");if(o&&(I.scaleX!==void 0||I.offsetX!==void 0)){const w=new DOMMatrix,a=I.scaleX??1,h=I.scaleY??1,t=I.offsetX??0,G=I.offsetY??0,K=I.rotation??0;w.translateSelf(t,G),w.rotateSelf(K),w.scaleSelf(a,h),o.setTransform(w)}return o}}return I.color||null}drawRoundRect(A,I,C,g,Q,E){if(E===0||E===void 0||E===null){A.rect(I,C,g,Q);return}let i=E;if(typeof i=="string")try{i=JSON.parse(i)}catch{i=parseFloat(i)||0}let D=0,o=0,w=0,a=0;typeof i=="number"?D=o=w=a=i:Array.isArray(i)?i.length===1?D=o=w=a=i[0]:i.length===2?(D=w=i[0],o=a=i[1]):i.length===3?(D=i[0],o=a=i[1],w=i[2]):i.length>=4&&(D=i[0],o=i[1],w=i[2],a=i[3]):i&&typeof i=="object"&&(D=i.tl??i.corner_radius??i.cornerRadius??0,o=i.tr??i.corner_radius??i.cornerRadius??0,w=i.br??i.corner_radius??i.cornerRadius??0,a=i.bl??i.corner_radius??i.cornerRadius??0);const h=Math.min(Math.abs(g)/2,Math.abs(Q)/2);if(D=Math.min(Math.max(0,D),h),o=Math.min(Math.max(0,o),h),w=Math.min(Math.max(0,w),h),a=Math.min(Math.max(0,a),h),A.roundRect){A.roundRect(I,C,g,Q,[D,o,w,a]);return}A.moveTo(I+D,C),A.lineTo(I+g-o,C),A.arcTo(I+g,C,I+g,C+o,o),A.lineTo(I+g,C+Q-w),A.arcTo(I+g,C+Q,I+g-w,C+Q,w),A.lineTo(I+a,C+Q),A.arcTo(I,C+Q,I,C+Q-a,a),A.lineTo(I,C+D),A.arcTo(I,C,I+D,C,D),A.closePath()}renderListView(A,I){var $,q,v,z;const C=this.objectStates.get(I.id)||{},g=C.options||I.options||{},Q=C.width!==void 0?C.width:(($=I.geometry)==null?void 0:$.width)||200,E=C.height!==void 0?C.height:((q=I.geometry)==null?void 0:q.height)||300,i=-Q/2,D=-E/2,o=C.corner_radius!==void 0?C.corner_radius:g.corner_radius??0,w=g.orientation||"vertical",a=g.items||[],h=g.itemGap??10,t=g.itemHeight??50,G=g.itemWidth??200,K=g.scrollOffset??0,y=g.padding??0,k=g.glassEffect!==!1,e=g.accentColor||"#3b82f6",N=g.itemTextColor||"#333333",S=g.itemBackgroundColor||"#ffffff",c=g.hoveredIndex??null,M=g.activeItemIndex??null,J=g.glowIntensity??0,Y=g.glowColor||"#3b82f6",V=typeof Y=="string"?Y:Y.color||((z=(v=Y.stops)==null?void 0:v[0])==null?void 0:z.color)||"#3b82f6",f=g.opacity!==void 0?g.opacity:I.opacity!==void 0?I.opacity:1;if(A.save(),A.globalAlpha*=f,J>0){const Z=A.getTransform(),m=Math.sqrt(Z.a*Z.a+Z.b*Z.b)||1;A.shadowColor=V,A.shadowBlur=J*2*m,A.shadowOffsetX=0,A.shadowOffsetY=0}if(k){const Z=g.listBackgroundColor||"rgba(31, 41, 55, 0.4)",m=this.createCanvasFill(A,Z,Q,E);A.fillStyle=m||"rgba(31, 41, 55, 0.4)",this.drawListViewRect(A,i,D,Q,E,o),A.fill();const u=A.createLinearGradient(i,D,i+Q,D+E);u.addColorStop(0,"rgba(255, 255, 255, 0.15)"),u.addColorStop(.5,"rgba(255, 255, 255, 0.08)"),u.addColorStop(1,"rgba(255, 255, 255, 0.03)"),A.fillStyle=u,this.drawListViewRect(A,i,D,Q,E,o),A.fill(),A.strokeStyle="rgba(255, 255, 255, 0.25)",A.lineWidth=1,this.drawListViewRect(A,i,D,Q,E,o),A.stroke()}else{const Z=g.listBackgroundColor||"transparent",m=this.createCanvasFill(A,Z,Q,E);m&&(A.fillStyle=m,this.drawListViewRect(A,i,D,Q,E,o),A.fill());const u=g.borderWidth??0;u>0&&(A.strokeStyle=g.borderColor||"#cccccc",A.lineWidth=u,this.drawListViewRect(A,i,D,Q,E,o),A.stroke())}A.shadowBlur=0,A.save(),this.drawListViewRect(A,i,D,Q,E,o),A.clip();const b=typeof y=="number"?y:w==="vertical"?y[0]:y[3];let x=(w==="vertical"?D:i)+K+b;if(A.textBaseline="middle",a.forEach((Z,m)=>{const u=w==="vertical"?Q:G,X=w==="vertical"?t:E,CA=w==="vertical"?i:x,O=w==="vertical"?x:D,AA=c===m,tA=M===m;if(tA){const JA=this.createCanvasFill(A,e,u,X);A.fillStyle=JA||e;const LA=A.globalAlpha;A.globalAlpha=LA*.8,A.fillRect(CA,O,u,X),A.globalAlpha=LA}else if(AA)A.fillStyle=k?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)",A.fillRect(CA,O,u,X);else if(S!=="transparent"){const JA=this.createCanvasFill(A,S,u,X);A.fillStyle=JA||S,A.fillRect(CA,O,u,X)}if(tA||AA){const JA=this.createCanvasFill(A,e,w==="vertical"?3:u,w==="vertical"?X:3);A.fillStyle=JA||e,w==="vertical"?A.fillRect(CA,O,3,X):A.fillRect(CA,O+X-3,u,3)}const sA=tA?"#ffffff":k?"rgba(255, 255, 255, 0.9)":N;A.fillStyle=sA,A.font=tA||AA?"600 14px Inter, sans-serif":"400 14px Inter, sans-serif";const FA=typeof Z=="string"?Z:(Z==null?void 0:Z.label)||`Item ${m+1}`,yA=CA+(w==="vertical"?16:u/2),qA=O+X/2;w==="horizontal"?A.textAlign="center":A.textAlign="left",A.fillText(FA,yA,qA),x+=(w==="vertical"?t:G)+h}),A.restore(),g.showScrollbar!==!1){const Z=(a.length||0)*(w==="vertical"?t:G)+((a.length||0)-1)*h,m=w==="vertical"?E:Q;if(Z>m){const u=m/Z,X=m*u,CA=-K/Z*m,O=g.scrollbarColor||"rgba(255,255,255,0.3)",AA=g.scrollbarWidth||4;A.fillStyle=O,w==="vertical"?A.fillRect(i+Q-AA-2,D+CA,AA,X):A.fillRect(i+CA,D+E-AA-2,X,AA)}}A.restore()}updateListViewScrollFromPointer(A){var y,k;if(!this._lastPointerPos||!this._prevPointerPos)return;const I=A.options||{},C=I.orientation||"vertical",g=this._lastPointerPos.x-this._prevPointerPos.x,Q=this._lastPointerPos.y-this._prevPointerPos.y;C==="vertical"?I.scrollOffset=(I.scrollOffset||0)+Q:I.scrollOffset=(I.scrollOffset||0)+g;const E=this.objectStates.get(A.id)||{},i=I.items||[],D=I.itemGap??10,o=I.itemHeight??50,w=I.itemWidth??200,a=E.width!==void 0?E.width:((y=A.geometry)==null?void 0:y.width)||200,h=E.height!==void 0?E.height:((k=A.geometry)==null?void 0:k.height)||300,t=(i.length||0)*(C==="vertical"?o:w)+((i.length||0)-1)*D,K=Math.max(0,t-(C==="vertical"?h:a)+(I.padding*2||0));I.scrollOffset>0&&(I.scrollOffset=0),I.scrollOffset<-K&&(I.scrollOffset=-K)}updateListViewHoverFromPointer(A,I,C){const g=this.getListViewItemIndexAtPointer(A,I,C),Q=A.options||{};Q.hoveredIndex!==g&&(Q.hoveredIndex=g)}getListViewItemIndexAtPointer(A,I,C){var b,x;const g=A.options||{},Q=this.objectStates.get(A.id)||{},E=g.items||[];if(E.length===0)return null;const i=Q.width!==void 0?Q.width:((b=A.geometry)==null?void 0:b.width)||200,D=Q.height!==void 0?Q.height:((x=A.geometry)==null?void 0:x.height)||300,o=g.orientation||"vertical",w=g.itemGap??10,a=g.itemHeight??50,h=g.itemWidth??200,t=g.scrollOffset??0,G=g.padding??0,K=this.getWorldTransform(A.id),y=I-K.x,k=C-K.y,e=-K.rotation*(Math.PI/180),N=Math.cos(e),S=Math.sin(e),c=y*N-k*S,M=y*S+k*N,J=-i/2,Y=-D/2,V=typeof G=="number"?G:o==="vertical"?G[0]:G[3];let f=(o==="vertical"?Y:J)+t+V;for(let IA=0;IA<E.length;IA++){const $=o==="vertical"?i:h,q=o==="vertical"?a:D,v=o==="vertical"?J:f,z=o==="vertical"?f:Y;if(c>=v&&c<=v+$&&M>=z&&M<=z+q)return IA;f+=(o==="vertical"?a:h)+w}return null}drawListViewRect(A,I,C,g,Q,E){A.beginPath(),this.drawRoundRect(A,I,C,g,Q,E),A.fill()}solveBehaviors(A){if(!this.artboard)return;if(!this._lastPointerPos){this.frameCount%60;return}const{x:I,y:C}=this._lastPointerPos;this.artboard.objects.forEach(g=>{if(!g.behaviors||g.behaviors.length===0)return;const Q=this.objectStates.get(g.id);Q&&g.behaviors.forEach(E=>{var h,t,G,K,y,k,e,N,S,c,M,J,Y,V,f,b,x,IA,$,q,v,z,Z,m,u,X,CA,O,AA,tA,sA,FA,yA,qA,JA,LA,U,p,L,r,H,j,KA,wA;if(!E.enabled)return;const i=E.startTime||0,D=E.endTime||1/0;if(this.currentTime<i||this.currentTime>D)return;const o=Q.x-I,w=Q.y-C,a=Math.sqrt(o*o+w*w);if(this.frameCount%240===0&&Math.random()<.1&&console.log(`[ExodeUI] Executing ${E.type} on ${g.name}`),E.type===P.Proximity){const T=((h=E.settings)==null?void 0:h.radius)||300,W=((t=E.settings)==null?void 0:t.falloff)||"smooth";let d=0;a<T&&(W==="linear"?d=1-a/T:d=Math.pow(1-a/T,2)),d>0&&E.sensors.forEach(l=>{this.applyBehaviorSensor(Q,l,d,A,E.settings)})}else if(E.type===P.Magnetic){const T=((G=E.settings)==null?void 0:G.radius)||400,W=((K=E.settings)==null?void 0:K.strength)||.5;if(a<T&&a>5){const d=1-a/T,l=o*d*W,SA=w*d*W;Q.x-=l*A*10,Q.y-=SA*A*10}}else if(E.type===P.Repel){const T=((y=E.settings)==null?void 0:y.radius)||300,W=((k=E.settings)==null?void 0:k.strength)||1;if(a<T){const d=Math.pow(1-a/T,2);Q.x+=o/(a||1)*d*60*W*A*5,Q.y+=w/(a||1)*d*60*W*A*5}}else if(E.type===P.Orbit){const T=((e=E.settings)==null?void 0:e.speed)||1,W=((N=E.settings)==null?void 0:N.radius)||30,d=this.currentTime*T*Math.PI*2;Q.x+=Math.cos(d)*W*A*5,Q.y+=Math.sin(d)*W*A*5,Q.rotation+=2*A*5}else if(E.type===P.Vortex){const T=((S=E.settings)==null?void 0:S.radius)||400,W=((c=E.settings)==null?void 0:c.speed)||2,d=((M=E.settings)==null?void 0:M.strength)||1;if(a<T){const l=Math.pow(1-a/T,1.5),SA=this.currentTime*W*Math.PI*2,mA=Math.cos(SA)*30-o*.4,$A=Math.sin(SA)*30-w*.4;Q.x+=mA*l*d*A*5,Q.y+=$A*l*d*A*5,Q.rotation+=5*l*d*A*5,Q.scale_x*=1-l*.1*d*A,Q.scale_y*=1-l*.1*d*A}}else if(E.type===P.Fluid){const T=((J=E.settings)==null?void 0:J.radius)||300,W=((Y=E.settings)==null?void 0:Y.strength)||1;if(a<T){const d=Math.pow(1-a/T,1.2),l=o/(a||1)*d*1.2*W,SA=w/(a||1)*d*1.2*W;Q.x+=l*10*A*5,Q.y+=SA*10*A*5,Q.scale_x*=1+d*.3*W*A,Q.scale_y*=1+d*.3*W*A}}else if(E.type===P.Elastic){const T=((V=E.settings)==null?void 0:V.radius)||300,W=((f=E.settings)==null?void 0:f.strength)||1;if(a<T){const d=1-a/T;Q.scale_x*=1+d*.4*W*A,Q.scale_y*=1+d*.4*W*A}}else if(E.type===P.Holographic){const T=Q.x-this.canvasWidth/2,W=Q.y-this.canvasHeight/2,d=((b=E.settings)==null?void 0:b.factor)||25;if(Q.x-=T/1e3*d*A*5,Q.y-=W/1e3*d*A*5,Q.style){const l=1-Math.min(1,a/400);Q.style.exposure=(Q.style.exposure||1)+l*.5*A}}else if(E.type===P.Sticky){const T=((x=E.settings)==null?void 0:x.radius)||80,W=((IA=E.settings)==null?void 0:IA.strength)||1;if(a<T){const d=Math.pow(1-a/T,2);Q.x-=o*d*W*A*10,Q.y-=w*d*W*A*10,Q.scale_x*=1-d*.1*W*A,Q.scale_y*=1-d*.1*W*A}}else if(E.type===P.Dilation){const T=(($=E.settings)==null?void 0:$.size)||120,W=((q=E.settings)==null?void 0:q.strength)||1;if(a<T){const d=1-a/T;Q.scale_x*=1+d*.5*W*A,Q.scale_y*=1+d*.5*W*A}}else if(E.type===P.Parallax){const T=((v=E.settings)==null?void 0:v.factor)||.05,W=this.canvasHeight/2,d=(this._lastPointerPos.y-W)*T;Q.y+=d*A*10}else if(E.type===P.Noise||E.type===P.Float){const T=(((z=E.settings)==null?void 0:z.frequency)||((Z=E.settings)==null?void 0:Z.speed)||1)*.002,W=(((m=E.settings)==null?void 0:m.amplitude)||((u=E.settings)==null?void 0:u.range)||50)*(((X=E.settings)==null?void 0:X.strength)||1),d=Date.now();Q.x+=Math.sin(d*T)*W*A,Q.y+=Math.cos(d*T*.8)*W*A,Q.rotation+=Math.sin(d*T*.5)*5*A}else if(E.type===P.Pulse){const T=(((CA=E.settings)==null?void 0:CA.speed)||1)*.005,W=(((O=E.settings)==null?void 0:O.scale)||1.2)-1,d=Math.sin(Date.now()*T),l=((AA=E.settings)==null?void 0:AA.strength)||1;Q.scale_x*=1+d*W*l*A,Q.scale_y*=1+d*W*l*A,Q.style&&(Q.style.exposure=(Q.style.exposure||1)+Math.max(0,d)*.1*l*A)}else if(E.type===P.Draggable){const T=((tA=E.settings)==null?void 0:tA.radius)||150,W=this.draggingBehaviors.has(g.id);if(a<T||W){const d=((sA=E.settings)==null?void 0:sA.strength)||1,l=W?1:Math.max(0,1-a/T);this.applyBehaviorSensor(Q,zA.PositionX,l*d,A,E.settings),this.applyBehaviorSensor(Q,zA.PositionY,l*d,A,E.settings)}}else if(E.type===P.Scroll){const T=((FA=E.settings)==null?void 0:FA.axis)||"vertical",W=((yA=E.settings)==null?void 0:yA.factor)||.5,d=((qA=E.settings)==null?void 0:qA.strength)||1;(T==="vertical"||T==="both")&&(Q.y+=this.scrollOffset.y*W*d*A),(T==="horizontal"||T==="both")&&(Q.x+=this.scrollOffset.x*W*d*A)}else if(E.type===P.LookAt){const T=((JA=E.settings)==null?void 0:JA.factor)||1,W=((LA=E.settings)==null?void 0:LA.strength)||1,d=Math.atan2(-w,-o)*(180/Math.PI),l=Q.rotation,SA=(d-l+180)%360-180;Q.rotation+=SA*T*W*A*10}else if(E.type===P.Glint||E.type===P.Scan){const T=(((U=E.settings)==null?void 0:U.speed)||1)*.004,W=((p=E.settings)==null?void 0:p.strength)||1,d=(Math.sin(Date.now()*T)+1)/2;Q.style&&(Q.style.exposure=(Q.style.exposure||1)+d*W*A*5),Q.x+=(d-.5)*20*W*A}else if(E.type===P.Ratchet){const T=((L=E.settings)==null?void 0:L.steps)||12,W=(((r=E.settings)==null?void 0:r.speed)||1)*30,d=Math.floor(Q.rotation/(360/T))*(360/T);Q.rotation=this.lerp(Q.rotation,d+W*A,.1)}else if(E.type===P.Jitter&&a<300){const T=((H=E.settings)==null?void 0:H.strength)||1,W=(((j=E.settings)==null?void 0:j.intensity)||5)*T;Q.x+=(Math.random()-.5)*W*A*60,Q.y+=(Math.random()-.5)*W*A*60,Q.rotation+=(Math.random()-.5)*W*A*120}else if(E.type===P.Follower){const T=(KA=E.settings)==null?void 0:KA.targetId;if(T){const W=this.objectStates.get(T);if(W){const d=((wA=E.settings)==null?void 0:wA.stiffness)||.1,l=W.x-Q.x,SA=W.y-Q.y;Q.x+=l*d*A*60,Q.y+=SA*d*A*60}}}else E.type===P.Wrap&&(Q.x<0?Q.x=this.canvasWidth:Q.x>this.canvasWidth&&(Q.x=0),Q.y<0?Q.y=this.canvasHeight:Q.y>this.canvasHeight&&(Q.y=0))})})}applyBehaviorSensor(A,I,C,g,Q){const E=(Q==null?void 0:Q.intensity)||(Q==null?void 0:Q.strength)||1,i=C*E*g;switch(I){case zA.Scale:A.scale_x*=1+i*.5,A.scale_y*=1+i*.5;break;case zA.Opacity:A.opacity=Math.max(0,Math.min(100,A.opacity-i*100));break;case zA.RotateZ:A.rotation+=i*180;break;case zA.RotateX:A.rotate_x=(A.rotate_x||0)+i*180;break;case zA.RotateY:A.rotate_y=(A.rotate_y||0)+i*180;break;case zA.PositionX:A.x+=i*300;break;case zA.PositionY:A.y+=i*300;break;case zA.SkewX:A.skew_x=(A.skew_x||0)+i*45;break;case zA.Blur:A.style||(A.style={}),A.style.blur=Math.min(100,(A.style.blur||0)+i*50);break;case zA.Exposure:A.style||(A.style={}),A.style.exposure=(A.style.exposure||1)+i*2;break;case zA.HueShift:A.style||(A.style={}),A.style.hue=(A.style.hue||0)+i*360;break;case zA.CornerRadius:A.corner_radius=Math.min(200,(A.corner_radius||0)+i*100);break;case zA.LetterSpacing:A.geometry||(A.geometry={}),A.geometry.letterSpacing=(A.geometry.letterSpacing||0)+i*10;break}}lerp(A,I,C){return A*(1-C)+I*C}deepMerge(A,I){if(!A)return I;if(!I)return A;if(typeof A!="object"||typeof I!="object"||A===null||I===null)return I;const C={...A};for(const g in I)Object.prototype.hasOwnProperty.call(I,g)&&(I[g]&&typeof I[g]=="object"&&!Array.isArray(I[g])?C[g]=this.deepMerge(A[g],I[g]):C[g]=I[g]);return C}renderFittedImage(A,I,C,g,Q,E,i="cover"){const D=I.naturalWidth,o=I.naturalHeight,w=D/o,a=Q/E;let h=Q,t=E,G=C,K=g;i==="cover"?w>a?(h=E*w,G=C-(h-Q)/2):(t=Q/w,K=g-(t-E)/2):i==="contain"&&(w>a?(t=Q/w,K=g+(E-t)/2):(h=E*w,G=C+(Q-h)/2)),A.drawImage(I,G,K,h,t)}}const PQ=({artboard:B,config:A})=>{const I={...B.seo,...A},C=I.enableSmartExtraction!==!1;nA.useEffect(()=>{const i=I.title||B.name;i&&(document.title=i);let D=I.description;if(!D&&C){const a=B.objects.filter(h=>h.geometry.type==="Text").sort((h,t)=>{var G,K;return(((G=t.geometry.text)==null?void 0:G.length)||0)-(((K=h.geometry.text)==null?void 0:K.length)||0)});a.length>0&&(D=a[0].geometry.text)}D&&(g("name","description",D),g("property","og:description",D)),I.keywords&&I.keywords.length>0&&g("name","keywords",I.keywords.join(", "));const o=I.ogImage||B.backgroundImage;o&&g("property","og:image",o),i&&g("property","og:title",i),g("property","og:type","website")},[I,B,C]);const g=(i,D,o)=>{let w=document.querySelector(`meta[${i}="${D}"]`);w||(w=document.createElement("meta"),w.setAttribute(i,D),document.head.appendChild(w)),w.setAttribute("content",o)},Q=()=>{const i=[];return i.push(ZA.jsx("h1",{children:I.title||B.name},"artboard-title")),B.objects.forEach((o,w)=>{if(!(!o.visible&&o.isVisible!==!0))if(o.geometry.type==="Text"){const a=o.geometry.text;a&&(o.geometry.fontSize>24?i.push(ZA.jsx("h2",{children:a},o.id||w)):i.push(ZA.jsx("p",{children:a},o.id||w)))}else if(o.geometry.type==="Image"){const a=o.geometry.src,h=o.altText||o.name||"Illustration";i.push(ZA.jsx("img",{src:a,alt:h},o.id||w))}else o.type==="Button"&&i.push(ZA.jsx("button",{children:o.name||"Button"},o.id||w))}),i},E=I.jsonLd||{"@context":"https://schema.org","@type":"VisualArtwork",name:I.title||B.name,description:I.description,image:I.ogImage||B.backgroundImage,abstract:"Animated interface created with ExodeUI"};return ZA.jsxs("div",{id:`exode-seo-${B.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:[Q(),ZA.jsx("script",{type:"application/ld+json",children:JSON.stringify(E)})]})},Bi=nA.forwardRef(({artboard:B,src:A,className:I,style:C,autoPlay:g=!0,fit:Q="Contain",alignment:E="Center",enableSEO:i=!0,seo:D,onReady:o,onTrigger:w,onInputUpdate:a,onComponentChange:h,onToggle:t,onInputChange:G,onInputFocus:K,onInputBlur:y,onLog:k,currentTime:e},N)=>{const S=nA.useRef(null),c=nA.useRef(new vQ),M=nA.useRef(),J=nA.useRef(0),Y=nA.useRef(null),[V,f]=nA.useState(B||null);nA.useImperativeHandle(N,()=>S.current),nA.useEffect(()=>{console.log("[ExodeUI] Layout Effect - Component Updated/Mounted"),c.current.setLayout(Q,E)},[Q,E]),nA.useEffect(()=>{w&&c.current.setTriggerCallback(w)},[w]),nA.useEffect(()=>{a&&c.current.setInputUpdateCallback(a)},[a]),nA.useEffect(()=>{h&&c.current.setComponentChangeCallback(h)},[h]),nA.useEffect(()=>{t&&c.current.setToggleCallback(t)},[t]),nA.useEffect(()=>{G&&c.current.setInputChangeCallback(G)},[G]),nA.useEffect(()=>{K&&c.current.setInputFocusCallback(K)},[K]),nA.useEffect(()=>{y&&c.current.setInputBlurCallback(y)},[y]),nA.useEffect(()=>{(async()=>{const IA=c.current;let $=B;if(!$&&A)try{const v=await(await fetch(A)).text();if(!v.trim().startsWith("{")&&!v.trim().startsWith("["))try{const z=XQ.decompressFromBase64(v.trim());z&&($=JSON.parse(z))}catch{console.warn("[ExodeUI] File is not standard JSON, and decompression failed.")}if(!$&&v)try{$=JSON.parse(v)}catch(z){console.error("[ExodeUI] Failed to parse JSON content:",z)}}catch(q){console.error("Failed to load ExodeUI animation:",q);return}if($){const q=$.id||$.name||"default";Y.current!==q&&(IA.load($),Y.current=q,f($),J.current=0),o&&o(IA)}})()},[B,A]),nA.useEffect(()=>{e!==void 0&&c.current.seek(e)},[e]),nA.useEffect(()=>{const x=c.current,IA=S.current;if(!IA)return;const $=IA.getContext("2d");if(!$)return;$.imageSmoothingEnabled=!0,$.imageSmoothingQuality="high",k&&x.setOnLogCallback(k);const q=z=>{J.current||(J.current=z);const Z=(z-J.current)/1e3;J.current=z,g&&x.advance(Z);const m=window.devicePixelRatio||1,u=IA.getBoundingClientRect(),X=Math.floor(u.width*m),CA=Math.floor(u.height*m);(IA.width!==X||IA.height!==CA)&&(IA.width=X,IA.height=CA),x.render($,X,CA),M.current=requestAnimationFrame(q)};M.current=requestAnimationFrame(q);const v=()=>{x.handleScroll(window.scrollX,window.scrollY)};return window.addEventListener("scroll",v,{passive:!0}),()=>{M.current&&cancelAnimationFrame(M.current),window.removeEventListener("scroll",v)}},[g]);const b=(x,IA)=>{const $=x.currentTarget.getBoundingClientRect(),q=x.clientX-$.left,v=x.clientY-$.top,z=$.width,Z=$.height;c.current.handlePointerInput(IA,q,v,z,Z)};return ZA.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",...C},className:I,children:[ZA.jsx("canvas",{ref:S,style:{width:"100%",height:"100%",outline:"none"},tabIndex:0,onPointerDown:x=>{var IA;b(x,"down"),(IA=S.current)==null||IA.focus()},onPointerUp:x=>b(x,"up"),onPointerMove:x=>b(x,"move"),onPointerLeave:x=>b(x,"blur"),onClick:x=>b(x,"click"),onKeyDown:x=>{x.key==="Backspace"||x.key==="Enter"||x.key,c.current.handleKeyDown(x.nativeEvent)}}),i&&V&&ZA.jsx(PQ,{artboard:V,config:D})]})});function Ei(){const[B,A]=nA.useState(null),I=nA.useCallback((a,h)=>{B==null||B.setInputBool(a,h)},[B]),C=nA.useCallback((a,h)=>{B==null||B.setInputNumber(a,h)},[B]),g=nA.useCallback(a=>{B==null||B.fireTrigger(a)},[B]),Q=nA.useCallback((a,h)=>{B==null||B.setInputText(a,h)},[B]),E=nA.useCallback((a,h)=>{B==null||B.setInputNumberArray(a,h)},[B]),i=nA.useCallback((a,h)=>{B==null||B.setInputStringArray(a,h)},[B]),D=nA.useCallback((a,h)=>{B==null||B.updateObjectOptions(a,h)},[B]),o=nA.useCallback((a,h,t)=>{B==null||B.updateConstraint(a,h,t)},[B]),w=nA.useCallback((a,h)=>{B==null||B.updateGraphData(a,h)},[B]);return{setEngine:A,engine:B,setInputBool:I,setInputNumber:C,fireTrigger:g,setInputText:Q,setInputNumberArray:E,setInputStringArray:i,updateConstraint:o,updateGraphData:w,updateObjectOptions:D}}const ii={version:"6.1.13"}.version;WA.BehaviorSensor=zA,WA.BehaviorType=P,WA.ConditionOp=kC,WA.ExodeSEO=PQ,WA.ExodeUICanvas=Bi,WA.ExodeUIEngine=vQ,WA.LogicOp=UI,WA.VERSION=ii,WA.useExodeUI=Ei,Object.defineProperty(WA,Symbol.toStringTag,{value:"Module"})});
|
|
29
|
+
`);let qA=-E/2+u;const JA=z*1.2;let LA=0;yA.forEach((U,p)=>{const L=U.split(" ");let r="";for(let H=0;H<L.length;H++){const j=r+L[H]+" ";A.measureText(j).width>AA&&H>0?(A.fillText(r,O,qA),r=L[H]+" ",qA+=JA):r=j}A.fillText(r,O,qA),LA=A.measureText(r).width,p<yA.length-1&&(qA+=JA,LA=0)}),i&&!$&&Math.floor(performance.now()/500)%2===0&&A.fillRect(O+LA,qA,1.5,z)}else{const qA=A.measureText(tA).width;let JA=0;if(qA>AA&&(JA=qA-AA),A.fillText(tA,O-JA,0),i&&!$&&Math.floor(performance.now()/500)%2===0){const U=O+qA-JA;A.fillRect(U,-(z/2),1.5,z)}}if(A.restore(),a.visible!==!1){const yA=a.text||"Label",qA=a.fontSize||12,JA=a.color||"rgba(156, 163, 175, 1)",LA=a.offset??8;A.font=`600 ${qA}px "${Z}", sans-serif`,A.fillStyle=JA,A.textAlign="left",A.textBaseline="bottom";const U=-(Q/2),p=-(E/2)-LA;A.fillText(yA,U,p)}if(h.visible===!0){const yA=h.text||"Helper text",qA=h.fontSize||11,JA=w==="error"?"rgba(239, 68, 68, 1)":h.color||"rgba(156, 163, 175, 1)",LA=h.offset??6;A.font=`400 ${qA}px "${Z}", sans-serif`,A.fillStyle=JA,A.textAlign="left",A.textBaseline="top";const U=-(Q/2),p=E/2+LA;A.fillText(yA,U,p)}}renderSlider(A,I){const C=this.objectStates.get(I.id),g=(C==null?void 0:C.geometry)||I.geometry,Q=(C==null?void 0:C.options)||I.options||{},E=g.width||200,i=Q.value??50,D=Q.min??0,w=(Q.max??100)-D,a=w===0?0:(i-D)/w,h=Q.trackHeight||4,t=Q.trackRoundedness??2,G=Q.trackShape??"Rectangle",K=Q.trackPath||"",y=Q.activeColor||"#3b82f6",k=Q.inactiveColor||"#374151",e=Q.thumbShape||"Ellipse",N=Q.thumbWidth??16,S=Q.thumbHeight??16,c=Q.thumbRoundedness??0,M=Q.thumbColor||"#ffffff",J=Q.thumbPath||"",Y=Q.thumbIcon||"",V=Q.showValueTooltip??!1,f=Q.tooltipBgColor||"#333333",b=Q.tooltipColor||"#ffffff",x=Q.tooltipOffsetX??0,IA=Q.tooltipOffsetY??-25,$=(O,AA,tA,sA,FA,yA,qA)=>{if((O==="Custom"||O==="Icon")&&qA)try{const JA=new Path2D(qA);if(A.save(),A.translate(AA,tA),O==="Icon"){const LA=Math.min(sA,FA)/24;A.scale(LA,LA),A.translate(-12,-12)}A.fill(JA),A.restore();return}catch(JA){console.error("Error drawing slider shape in engine:",JA)}if(A.beginPath(),O==="Ellipse")A.ellipse(AA,tA,sA/2,FA/2,0,0,Math.PI*2);else if(O==="Rectangle")this.drawRoundRect(A,AA-sA/2,tA-FA/2,sA,FA,yA);else if(O==="Triangle")A.moveTo(AA,tA-FA/2),A.lineTo(AA+sA/2,tA+FA/2),A.lineTo(AA-sA/2,tA+FA/2),A.closePath();else if(O==="Diamond")A.moveTo(AA,tA-FA/2),A.lineTo(AA+sA/2,tA),A.lineTo(AA,tA+FA/2),A.lineTo(AA-sA/2,tA),A.closePath();else if(O==="Polygon"){const JA=I.geometry.sides||3,LA=I.geometry.radius||Math.min(sA,FA)/2;for(let U=0;U<JA;U++){const p=U*2*Math.PI/JA-Math.PI/2,L=AA+LA*Math.cos(p),r=tA+LA*Math.sin(p);U===0?A.moveTo(L,r):A.lineTo(L,r)}A.closePath()}else if(O==="Star"){const LA=Math.min(sA,FA)/2,U=LA/2;for(let p=0;p<5*2;p++){const L=p%2===0?LA:U,r=p*Math.PI/5-Math.PI/2;A.lineTo(AA+L*Math.cos(r),tA+L*Math.sin(r))}A.closePath()}else O==="Line"&&(A.moveTo(AA-sA/2,tA),A.lineTo(AA+sA/2,tA));A.fill()};A.fillStyle=k,G==="Line"?(A.strokeStyle=k,A.lineWidth=h,A.beginPath(),A.moveTo(-E/2,0),A.lineTo(E/2,0),A.stroke()):$(G,0,0,E,h,t,K);const q=E-N,v=-E/2+N/2+a*q,z=v- -E/2;z>0&&(A.fillStyle=y,G==="Line"?(A.strokeStyle=y,A.lineWidth=h,A.beginPath(),A.moveTo(-E/2,0),A.lineTo(v,0),A.stroke()):G==="Rectangle"&&(A.beginPath(),this.drawRoundRect(A,-E/2,-h/2,z,h,t),A.fill())),A.save(),A.translate(v,0);const Z=A.getTransform(),m=Math.sqrt(Z.a*Z.a+Z.b*Z.b)||1;if(A.shadowColor="rgba(0,0,0,0.2)",A.shadowBlur=4*m,A.shadowOffsetY=1*m,A.fillStyle=M,$(e,0,0,N,S,c,e==="Icon"?Y:J),A.restore(),V){A.save(),A.translate(v+x,IA);const O=Math.round(i).toString();A.font="10px Inter, sans-serif";const AA=A.measureText(O),tA=6,sA=4,FA=AA.width+tA*2,yA=14+sA;A.beginPath(),this.drawRoundRect(A,-FA/2,-yA/2,FA,yA,4),A.fillStyle=f,A.fill(),A.fillStyle=b,A.textAlign="center",A.textBaseline="middle",A.fillText(O,0,0),A.restore()}const u=Q.label||{},X=Q.helperText||{},CA=Q.fontFamily||"Inter";if(u.visible!==!1){const O=u.text||"Label",AA=u.fontSize||12,tA=u.color||"rgba(156, 163, 175, 1)",sA=u.offset??8;A.font=`600 ${AA}px "${CA}", sans-serif`,A.fillStyle=tA,A.textAlign="left",A.textBaseline="bottom";const FA=-(E/2),yA=-(h/2)-sA;A.fillText(O,FA,yA)}if(X.visible===!0){const O=X.text||"Helper text",AA=X.fontSize||11,tA=X.color||"rgba(156, 163, 175, 1)",sA=X.offset??6;A.font=`400 ${AA}px "${CA}", sans-serif`,A.fillStyle=tA,A.textAlign="left",A.textBaseline="top";const FA=-(E/2),yA=h/2+sA;A.fillText(O,FA,yA)}}renderDropdown(A,I){var IA;const C=this.objectStates.get(I.id);if(!C)return;const g=C.options||I.options||{},Q=I.geometry.width||160,E=I.geometry.height||40,i=-Q/2,D=-E/2,o=g.corner_radius??6,w=g.disabled||g.previewState==="disabled",a=this.lastHoveredObjectId===I.id||g.previewState==="hover",h=(g.isOpen||g.previewState==="active")&&!w;let t=g.backgroundColor,G=g.borderColor,K=g.color||"#333333";w?(t=g.disabledBackgroundColor||"#f3f4f6",G=g.disabledBorderColor||"#e5e7eb",K=g.disabledColor||"#9ca3af"):h?(t=g.activeBackgroundColor||t,G=g.activeBorderColor||G,K=g.activeColor||K):a&&(t=g.hoverBackgroundColor||t,G=g.hoverBorderColor||G,K=g.hoverColor||K),t||(t="#ffffff"),G||(G="#e5e7eb");const y=A.globalAlpha;A.globalAlpha=y*(g.opacity??1),this.drawRoundRect(A,i,D,Q,E,o),A.fillStyle=this.createCanvasFill(A,typeof t=="string"?{type:"Solid",color:t}:t,Q,E)||"#ffffff",A.fill();const k=g.borderWidth??1;k>0&&(A.strokeStyle=this.createCanvasFill(A,typeof G=="string"?{type:"Solid",color:G}:G,Q,E)||"#e5e7eb",A.lineWidth=k,A.stroke());const e=12,N=g.chevronType||"chevron",S=g.chevronSize||16,c=(h?g.openIconColor:g.closedIconColor)||g.chevronColor||"#6b7280";if(N!=="none"){const $=i+Q-e-S/2;A.save(),A.translate($,0);const q=h?g.openIconAngle??180:g.closedIconAngle??0;if(A.rotate(q*Math.PI/180),A.strokeStyle=c,A.fillStyle=c,A.lineWidth=1.5,A.lineCap="round",A.lineJoin="round",N==="chevron")A.beginPath(),A.moveTo(-S/2,-S*.2),A.lineTo(0,S*.2),A.lineTo(S/2,-S*.2),A.stroke();else if(N==="custom"||N==="path"){const v=h&&g.openIconPath||g.closedIconPath;if(v){const z=new Path2D(v);A.save();const Z=S/24;A.scale(Z,Z),A.translate(-12,-12),A.fill(z),A.restore()}}A.restore()}const M=g.selectedOption||g.placeholder||"Select...",J=g.fontSize||14,Y=g.fontWeight||400,V=g.fontFamily||"Inter, sans-serif";A.font=`${Y} ${J}px ${V}`;const f=w?g.disabledColor||"#9ca3af":!g.selectedOption&&g.placeholder?"#9ca3af":K;A.fillStyle=this.createCanvasFill(A,typeof f=="string"?{type:"Solid",color:f}:f,Q,E)||"#333333",A.textAlign="left",A.textBaseline="middle";const b=N==="none"?0:S+8,x=Q-e*2-b;if(A.save(),A.beginPath(),A.rect(i+e,D,x,E),A.clip(),A.fillText(M,i+e,0),A.restore(),h&&!w){const $=D+E+4,q=g.optionsList||[],v=g.itemHeight||32,z=g.listPadding??4,Z=q.length*v+z*2,m=g.listCornerRadius??o;A.save();const u=g.listShadow||{},X=A.getTransform(),CA=Math.sqrt(X.a*X.a+X.b*X.b)||1;A.shadowColor=typeof u.color=="string"?u.color:((IA=u.color)==null?void 0:IA.color)||"rgba(0,0,0,0.15)",A.shadowBlur=(u.blur??12)*CA,A.shadowOffsetY=(u.offsetY??6)*CA,A.shadowOffsetX=(u.offsetX??0)*CA,A.beginPath(),this.drawRoundRect(A,i,$,Q,Z,m),A.fillStyle=this.createCanvasFill(A,typeof g.listBackgroundColor=="string"?{type:"Solid",color:g.listBackgroundColor}:g.listBackgroundColor||{type:"Solid",color:"#ffffff"},Q,Z)||"#ffffff",A.fill();const O=g.listBorderWidth??1;O>0&&(A.shadowColor="transparent",A.strokeStyle=this.createCanvasFill(A,typeof g.listBorderColor=="string"?{type:"Solid",color:g.listBorderColor}:g.listBorderColor||{type:"Solid",color:G},Q,Z)||"#e5e7eb",A.lineWidth=O,A.stroke()),A.restore();const AA=g.itemFontSize||J,tA=g.itemFontFamily||V;A.font=`${Y} ${AA}px ${tA}`,q.forEach((sA,FA)=>{const yA=$+z+FA*v;if(sA===g.selectedOption)A.fillStyle=this.createCanvasFill(A,typeof g.itemSelectedBackgroundColor=="string"?{type:"Solid",color:g.itemSelectedBackgroundColor}:g.itemSelectedBackgroundColor||{type:"Solid",color:"#f3f4f6"},Q,v)||"#f3f4f6",A.fillRect(i+O,yA,Q-O*2,v),A.fillStyle=g.itemSelectedColor||g.activeColor||K||"#374151";else if(A.fillStyle=g.listTextColor||K||"#333333",this.activeDropdownId===I.id&&this._lastPointerPos){const JA=this._lastPointerPos.y-($+z),LA=Math.floor(JA/v);FA===LA&&(A.fillStyle=this.createCanvasFill(A,typeof g.itemHoverBackgroundColor=="string"?{type:"Solid",color:g.itemHoverBackgroundColor}:g.itemHoverBackgroundColor||{type:"Solid",color:"#f9fafb"},Q,v)||"#f9fafb",A.fillRect(i+O,yA,Q-O*2,v),A.fillStyle=g.itemHoverColor||K)}A.fillText(sA,i+e,yA+v/2)})}A.globalAlpha=y}renderButton(A,I){var N,S,c,M;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=((N=I.geometry)==null?void 0:N.width)||120,E=((S=I.geometry)==null?void 0:S.height)||40,i=-Q/2,D=-E/2,o=this.lastHoveredObjectId===I.id,w=g.corner_radius??8,a=g.bgShape||"Rectangle",h=o?((c=g.hoverStyle)==null?void 0:c.backgroundColor)||g.buttonBgColor||"#3b82f6":g.buttonBgColor||"#3b82f6",t=g.label||{},G=o?((M=g.hoverStyle)==null?void 0:M.textColor)||t.color||"#ffffff":t.color||"#ffffff",K=g.icon||{enabled:!1};A.save(),A.beginPath(),a==="Rectangle"?this.drawRoundRect(A,i,D,Q,E,w):a==="Ellipse"||a==="Circle"?A.ellipse(0,0,Q/2,E/2,0,0,Math.PI*2):a==="Pill"&&this.drawRoundRect(A,i,D,Q,E,E/2),A.fillStyle=h,A.fill();const y=t.fontSize||14,k=t.fontFamily||"Inter";A.font=`${t.fontWeight||400} ${y}px "${k}", sans-serif`,A.fillStyle=G,A.textAlign="center",A.textBaseline="middle";let e=0;if(K.enabled&&K.svgPath){const J=K.size||16,Y=K.gap||8,V=K.position==="left"?-(A.measureText(t.text||"").width/2+J/2+Y/2):A.measureText(t.text||"").width/2+J/2+Y/2;A.save(),A.translate(V,0);const f=new Path2D(K.svgPath),b=J/24;A.scale(b,b),A.translate(-12,-12),A.fillStyle=K.color||G,A.fill(f),A.restore(),e=K.position==="left"?J/2+Y/2:-(J/2+Y/2)}A.fillText(t.text||"Button",e,0),A.restore()}renderToggleButton(A,I){var y,k;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=g.checked??!1,E=((y=I.geometry)==null?void 0:y.width)||120,i=((k=I.geometry)==null?void 0:k.height)||40,D=-E/2,o=-i/2,w=g.corner_radius??8,a=g.label||{},h=Q?g.activeColor||"#3b82f6":g.inactiveColor||"#374151",t=Q?g.activeTextColor||"#ffffff":g.inactiveTextColor||"#9ca3af";A.save(),A.beginPath(),this.drawRoundRect(A,D,o,E,i,w),A.fillStyle=h,A.fill();const G=a.fontSize||14,K=a.fontFamily||"Inter";A.font=`${a.fontWeight||600} ${G}px "${K}", sans-serif`,A.fillStyle=t,A.textAlign="center",A.textBaseline="middle",A.fillText(a.text||"Toggle",0,0),A.restore()}renderToggle(A,I){var e,N;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=((e=I.geometry)==null?void 0:e.width)||52,E=((N=I.geometry)==null?void 0:N.height)||30,i=-Q/2,D=-E/2,o=g.checked??!1,w=g.corner_radius??E/2;A.beginPath(),this.drawRoundRect(A,i,D,Q,E,w),A.fillStyle=o?g.activeColor||"#10b981":g.inactiveColor||"#374151",g.disabled&&(A.globalAlpha*=.5),A.fill();const a=3,h=E-a*2,t=h/2,G=i+a,K=i+Q-a-h,y=o?K:G,k=D+a;if(A.beginPath(),A.arc(y+t,k+t,t,0,Math.PI*2),A.fillStyle=g.knobColor||"#ffffff",A.fill(),g.disabled&&(A.globalAlpha*=2),g.label&&g.label.text){const S=g.label,c=S.fontSize||14,M=S.fontWeight||400,J=S.fontFamily||"Inter";A.font=`${M} ${c}px "${J}", sans-serif`,A.fillStyle=S.color||"#f3f4f6",A.textBaseline="middle";const Y=S.gap||10;let V=0,f=0;S.position==="left"?(A.textAlign="right",V=i-Y,f=0):S.position==="right"?(A.textAlign="left",V=i+Q+Y,f=0):S.position==="top"?(A.textAlign="center",V=0,f=D-Y,A.textBaseline="bottom"):S.position==="bottom"?(A.textAlign="center",V=0,f=D+E+Y,A.textBaseline="top"):(A.textAlign="left",V=i+Q+Y,f=0),A.fillText(S.text,V,f)}}renderLineGraph(A,I,C,g){let Q=I.datasets||[];if((!Q||Q.length===0)&&(I.data||I.graphData)&&(Q=[{id:"line-1",label:"Series 1",data:I.data||I.graphData||[],lineColor:I.lineColor||"#3b82f6",lineWidth:I.lineWidth||2,showArea:I.showArea||!1,areaColor:I.areaColor||"rgba(139, 92, 246, 0.3)",smoothing:I.smoothing||!1,showPoints:I.showPoints!==void 0?I.showPoints:!0,pointSize:I.pointSize||6,pointFill:I.pointFill||"#ffffff",pointStrokeColor:I.pointStrokeColor||I.lineColor||"#3b82f6",pointStrokeWidth:I.pointStrokeWidth||2}]),!Q||Q.length===0||!Q.some(K=>K.data&&K.data.length>=2)){A.save(),A.fillStyle="#6366f1",A.font="12px Inter, system-ui, sans-serif",A.textAlign="center",A.textBaseline="middle",A.fillText("NO DATA",0,0),A.restore();return}let E=1/0,i=-1/0,D=0;if(Q.forEach(K=>{let y=K.data;if(K.isVarEnabled&&K.inputId){let k=this.inputs.get(K.inputId);if(k===void 0){const e=this.inputNameMap.get(K.inputId);e&&e.length>0&&(k=this.inputs.get(e[0]))}k&&Array.isArray(k)&&(y=k)}if(y&&y.length>0){const k=y.filter(e=>typeof e=="number"&&!isNaN(e));k.length>0&&(E=Math.min(E,...k),i=Math.max(i,...k),D=Math.max(D,y.length))}K._resolvedData=y}),D<2)return;const o=i-E,w=C/(D-1),a=K=>{const y=o===0?.5:(K-E)/o;return g/2-y*g},h=K=>K*w-C/2,t=I.axisColor||"#333333";if(I.showXAxis&&(A.beginPath(),A.strokeStyle=I.xAxisColor||t,A.lineWidth=1,A.moveTo(-C/2,g/2),A.lineTo(C/2,g/2),A.stroke()),I.showYAxis&&(A.beginPath(),A.strokeStyle=I.yAxisColor||t,A.lineWidth=1,A.moveTo(-C/2,-g/2),A.lineTo(-C/2,g/2),A.stroke()),A.fillStyle=I.axisLabelColor||"#333333",A.font=`${I.axisLabelFontSize||10}px Inter, sans-serif`,I.showXLabels){A.textAlign="center",A.textBaseline="top";for(let K=0;K<D;K++){const y=h(K);A.fillText(`${K+1}`,y,g/2+5)}}if(I.showYLabels){A.textAlign="right",A.textBaseline="middle";const K=-C/2-5,y=(i+E)/2;A.fillText(i.toFixed(1),K,a(i)),A.fillText(y.toFixed(1),K,a(y)),A.fillText(E.toFixed(1),K,a(E))}const G=10;if(Q.forEach(K=>{const y=K._resolvedData;if(!(!y||y.length<2)){if(K.showArea){if(A.beginPath(),A.moveTo(h(0),g/2),A.lineTo(h(0),a(y[0])),K.smoothing&&y.length>2)for(let e=0;e<y.length-1;e++){const N=y[e===0?e:e-1],S=y[e],c=y[e+1],M=y[e+1===y.length-1?e+1:e+2];for(let J=1;J<=G;J++){const Y=J/G,V=this._catmullRom(N,S,c,M,Y);A.lineTo(h(e+Y),a(V))}}else for(let e=1;e<y.length;e++)A.lineTo(h(e),a(y[e]));A.lineTo(h(y.length-1),g/2),A.closePath();const k=A.globalAlpha;A.globalAlpha=k*(I.areaOpacity??.3),A.fillStyle=K.areaColor||"rgba(139, 92, 246, 0.2)",A.fill(),A.globalAlpha=k}if(A.beginPath(),A.strokeStyle=K.lineColor||"#3b82f6",A.lineWidth=K.lineWidth||2,A.lineJoin="round",A.lineCap="round",A.moveTo(h(0),a(y[0])),K.smoothing&&y.length>2)for(let k=0;k<y.length-1;k++){const e=y[k===0?k:k-1],N=y[k],S=y[k+1],c=y[k+1===y.length-1?k+1:k+2];for(let M=1;M<=G;M++){const J=M/G,Y=this._catmullRom(e,N,S,c,J);A.lineTo(h(k+J),a(Y))}}else for(let k=1;k<y.length;k++)A.lineTo(h(k),a(y[k]));A.stroke(),K.showPoints&&y.forEach((k,e)=>{const N=h(e),S=a(k);A.beginPath(),A.arc(N,S,(K.pointSize||6)/2,0,Math.PI*2),A.fillStyle=K.pointFill||"#ffffff",A.fill(),A.strokeStyle=K.pointStrokeColor||K.lineColor||"#3b82f6",A.lineWidth=K.pointStrokeWidth||1,A.stroke()})}}),I.showLegend&&Q.length>0){const K=C/2-10;let y=-g/2+15;const k=I.legendFontSize||10,e=k+5;A.font=`${k}px Inter, sans-serif`,A.textAlign="right",A.textBaseline="alphabetic",Q.forEach(N=>{const c=N.label||"Series",M=A.measureText(c).width;A.beginPath(),A.rect(K-M-8-5,y-(8/2+2),8,8),A.fillStyle=N.lineColor||"#3b82f6",A.fill(),A.fillStyle=I.legendColor||"#333333",A.fillText(c,K,y),y+=e})}}_catmullRom(A,I,C,g,Q){const E=(C-A)*.5,i=(g-I)*.5,D=Q*Q,o=Q*D;return(2*I-2*C+E+i)*o+(-3*I+3*C-2*E-i)*D+E*Q+I}normalizeOpacity(A){const I=typeof A=="number"?A:parseFloat(String(A));return isNaN(I)?1:I>1?Math.min(1,I/100):Math.max(0,Math.min(1,I))}createCanvasFill(A,I,C,g){var Q,E,i;if(!I||I.type==="None")return null;if(typeof I=="string")return I;if(I.type==="Solid"&&I.color){const D=I.color,w=(((E=(Q=this.artboard)==null?void 0:Q.tokens)==null?void 0:E.colors)||{})[D]||D;return A.fillStyle=w,w}if((I.type==="LinearGradient"||I.type==="RadialGradient"||I.type==="AngularGradient"||I.type==="DiamondGradient")&&I.stops){const D=(o,w=100)=>{var S,c;const h=(((c=(S=this.artboard)==null?void 0:S.tokens)==null?void 0:c.colors)||{})[o]||o,t=this.normalizeOpacity(I.opacity??100),K=this.normalizeOpacity(w)*t;if(K>=1&&h.startsWith("#"))return h;const y=h.startsWith("#")?h.replace("#",""):"ffffff",k=parseInt(y.substring(0,2),16),e=parseInt(y.substring(2,4),16),N=parseInt(y.substring(4,6),16);return`rgba(${k}, ${e}, ${N}, ${K})`};if(I.type==="LinearGradient"){const o=(K,y,k)=>Array.isArray(K)?K[y]??(y===0?0:1):K&&typeof K=="object"?K[k]??(y===0?0:1):y===0?0:1,w=o(I.start,0,"x")*C-C/2,a=o(I.start,1,"y")*g-g/2,h=o(I.end,0,"x")*C-C/2,t=o(I.end,1,"y")*g-g/2,G=A.createLinearGradient(w,a,h,t);if(I.stops.forEach(K=>{const y=K.offset!==void 0?K.offset:K.pos!==void 0?K.pos:K.position!==void 0?K.position:0,k=D(K.color||"#000000",K.opacity??100);G.addColorStop(Math.max(0,Math.min(1,y)),k)}),I.gradientTransform&&G.setTransform){const[K,y,k,e,N,S]=I.gradientTransform;G.setTransform({a:K,b:y,c:k,d:e,e:N,f:S})}return G}else if(I.type==="RadialGradient"){const o=(G,K,y)=>Array.isArray(G)?G[K]??.5:G&&typeof G=="object"?G[y]??.5:.5,w=o(I.center,0,"x")*C-C/2,a=o(I.center,1,"y")*g-g/2,h=(I.radius??.5)*Math.max(C,g),t=A.createRadialGradient(w,a,0,w,a,h);if(I.stops.forEach(G=>{const K=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,y=D(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,K)),y)}),I.gradientTransform&&t.setTransform){const[G,K,y,k,e,N]=I.gradientTransform;t.setTransform({a:G,b:K,c:y,d:k,e,f:N})}return t}else if(I.type==="AngularGradient"){const o=(G,K,y)=>Array.isArray(G)?G[K]??.5:G&&typeof G=="object"?G[y]??.5:.5,w=o(I.center||[.5,.5],0,"x")*C-C/2,a=o(I.center||[.5,.5],1,"y")*g-g/2,h=(I.degree||I.angle||0)*(Math.PI/180),t=(i=A.createConicGradient)==null?void 0:i.call(A,h,w,a);if(t){if(I.stops.forEach(G=>{const K=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,y=D(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,K)),y)}),I.gradientTransform&&t.setTransform){const[G,K,y,k,e,N]=I.gradientTransform;t.setTransform({a:G,b:K,c:y,d:k,e,f:N})}return t}}else if(I.type==="DiamondGradient"){const o=(G,K,y)=>Array.isArray(G)?G[K]??.5:G&&typeof G=="object"?G[y]??.5:.5,w=o(I.center||[.5,.5],0,"x")*C-C/2,a=o(I.center||[.5,.5],1,"y")*g-g/2,h=(I.radius??.5)*Math.max(C,g);A.save(),A.translate(w,a),A.rotate(Math.PI/4);const t=A.createRadialGradient(0,0,0,0,0,h);if(I.stops.forEach(G=>{const K=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,y=D(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,K)),y)}),I.gradientTransform&&t.setTransform){const[G,K,y,k,e,N]=I.gradientTransform;t.setTransform({a:G,b:K,c:y,d:k,e,f:N})}return A.scale(1/Math.SQRT2,1/Math.SQRT2),A.fillStyle=t,A.restore(),t}}if(I.type==="Pattern"&&I.url){let D=this.imageCache.get(I.url);if(D||(D=new Image,D.src=I.url,this.imageCache.set(I.url,D)),D.complete&&D.naturalWidth>0){const o=A.createPattern(D,"repeat");if(o&&(I.scaleX!==void 0||I.offsetX!==void 0)){const w=new DOMMatrix,a=I.scaleX??1,h=I.scaleY??1,t=I.offsetX??0,G=I.offsetY??0,K=I.rotation??0;w.translateSelf(t,G),w.rotateSelf(K),w.scaleSelf(a,h),o.setTransform(w)}return o}}return I.color||null}drawRoundRect(A,I,C,g,Q,E){if(E===0||E===void 0||E===null){A.rect(I,C,g,Q);return}let i=E;if(typeof i=="string")try{i=JSON.parse(i)}catch{i=parseFloat(i)||0}let D=0,o=0,w=0,a=0;typeof i=="number"?D=o=w=a=i:Array.isArray(i)?i.length===1?D=o=w=a=i[0]:i.length===2?(D=w=i[0],o=a=i[1]):i.length===3?(D=i[0],o=a=i[1],w=i[2]):i.length>=4&&(D=i[0],o=i[1],w=i[2],a=i[3]):i&&typeof i=="object"&&(D=i.tl??i.corner_radius??i.cornerRadius??0,o=i.tr??i.corner_radius??i.cornerRadius??0,w=i.br??i.corner_radius??i.cornerRadius??0,a=i.bl??i.corner_radius??i.cornerRadius??0);const h=Math.min(Math.abs(g)/2,Math.abs(Q)/2);if(D=Math.min(Math.max(0,D),h),o=Math.min(Math.max(0,o),h),w=Math.min(Math.max(0,w),h),a=Math.min(Math.max(0,a),h),A.roundRect){A.roundRect(I,C,g,Q,[D,o,w,a]);return}A.moveTo(I+D,C),A.lineTo(I+g-o,C),A.arcTo(I+g,C,I+g,C+o,o),A.lineTo(I+g,C+Q-w),A.arcTo(I+g,C+Q,I+g-w,C+Q,w),A.lineTo(I+a,C+Q),A.arcTo(I,C+Q,I,C+Q-a,a),A.lineTo(I,C+D),A.arcTo(I,C,I+D,C,D),A.closePath()}renderListView(A,I){var $,q,v,z;const C=this.objectStates.get(I.id)||{},g=C.options||I.options||{},Q=C.width!==void 0?C.width:(($=I.geometry)==null?void 0:$.width)||200,E=C.height!==void 0?C.height:((q=I.geometry)==null?void 0:q.height)||300,i=-Q/2,D=-E/2,o=C.corner_radius!==void 0?C.corner_radius:g.corner_radius??0,w=g.orientation||"vertical",a=g.items||[],h=g.itemGap??10,t=g.itemHeight??50,G=g.itemWidth??200,K=g.scrollOffset??0,y=g.padding??0,k=g.glassEffect!==!1,e=g.accentColor||"#3b82f6",N=g.itemTextColor||"#333333",S=g.itemBackgroundColor||"#ffffff",c=g.hoveredIndex??null,M=g.activeItemIndex??null,J=g.glowIntensity??0,Y=g.glowColor||"#3b82f6",V=typeof Y=="string"?Y:Y.color||((z=(v=Y.stops)==null?void 0:v[0])==null?void 0:z.color)||"#3b82f6",f=g.opacity!==void 0?g.opacity:I.opacity!==void 0?I.opacity:1;if(A.save(),A.globalAlpha*=f,J>0){const Z=A.getTransform(),m=Math.sqrt(Z.a*Z.a+Z.b*Z.b)||1;A.shadowColor=V,A.shadowBlur=J*2*m,A.shadowOffsetX=0,A.shadowOffsetY=0}if(k){const Z=g.listBackgroundColor||"rgba(31, 41, 55, 0.4)",m=this.createCanvasFill(A,Z,Q,E);A.fillStyle=m||"rgba(31, 41, 55, 0.4)",this.drawListViewRect(A,i,D,Q,E,o),A.fill();const u=A.createLinearGradient(i,D,i+Q,D+E);u.addColorStop(0,"rgba(255, 255, 255, 0.15)"),u.addColorStop(.5,"rgba(255, 255, 255, 0.08)"),u.addColorStop(1,"rgba(255, 255, 255, 0.03)"),A.fillStyle=u,this.drawListViewRect(A,i,D,Q,E,o),A.fill(),A.strokeStyle="rgba(255, 255, 255, 0.25)",A.lineWidth=1,this.drawListViewRect(A,i,D,Q,E,o),A.stroke()}else{const Z=g.listBackgroundColor||"transparent",m=this.createCanvasFill(A,Z,Q,E);m&&(A.fillStyle=m,this.drawListViewRect(A,i,D,Q,E,o),A.fill());const u=g.borderWidth??0;u>0&&(A.strokeStyle=g.borderColor||"#cccccc",A.lineWidth=u,this.drawListViewRect(A,i,D,Q,E,o),A.stroke())}A.shadowBlur=0,A.save(),this.drawListViewRect(A,i,D,Q,E,o),A.clip();const b=typeof y=="number"?y:w==="vertical"?y[0]:y[3];let x=(w==="vertical"?D:i)+K+b;if(A.textBaseline="middle",a.forEach((Z,m)=>{const u=w==="vertical"?Q:G,X=w==="vertical"?t:E,CA=w==="vertical"?i:x,O=w==="vertical"?x:D,AA=c===m,tA=M===m;if(tA){const JA=this.createCanvasFill(A,e,u,X);A.fillStyle=JA||e;const LA=A.globalAlpha;A.globalAlpha=LA*.8,A.fillRect(CA,O,u,X),A.globalAlpha=LA}else if(AA)A.fillStyle=k?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)",A.fillRect(CA,O,u,X);else if(S!=="transparent"){const JA=this.createCanvasFill(A,S,u,X);A.fillStyle=JA||S,A.fillRect(CA,O,u,X)}if(tA||AA){const JA=this.createCanvasFill(A,e,w==="vertical"?3:u,w==="vertical"?X:3);A.fillStyle=JA||e,w==="vertical"?A.fillRect(CA,O,3,X):A.fillRect(CA,O+X-3,u,3)}const sA=tA?"#ffffff":k?"rgba(255, 255, 255, 0.9)":N;A.fillStyle=sA,A.font=tA||AA?"600 14px Inter, sans-serif":"400 14px Inter, sans-serif";const FA=typeof Z=="string"?Z:(Z==null?void 0:Z.label)||`Item ${m+1}`,yA=CA+(w==="vertical"?16:u/2),qA=O+X/2;w==="horizontal"?A.textAlign="center":A.textAlign="left",A.fillText(FA,yA,qA),x+=(w==="vertical"?t:G)+h}),A.restore(),g.showScrollbar!==!1){const Z=(a.length||0)*(w==="vertical"?t:G)+((a.length||0)-1)*h,m=w==="vertical"?E:Q;if(Z>m){const u=m/Z,X=m*u,CA=-K/Z*m,O=g.scrollbarColor||"rgba(255,255,255,0.3)",AA=g.scrollbarWidth||4;A.fillStyle=O,w==="vertical"?A.fillRect(i+Q-AA-2,D+CA,AA,X):A.fillRect(i+CA,D+E-AA-2,X,AA)}}A.restore()}updateListViewScrollFromPointer(A){var y,k;if(!this._lastPointerPos||!this._prevPointerPos)return;const I=A.options||{},C=I.orientation||"vertical",g=this._lastPointerPos.x-this._prevPointerPos.x,Q=this._lastPointerPos.y-this._prevPointerPos.y;C==="vertical"?I.scrollOffset=(I.scrollOffset||0)+Q:I.scrollOffset=(I.scrollOffset||0)+g;const E=this.objectStates.get(A.id)||{},i=I.items||[],D=I.itemGap??10,o=I.itemHeight??50,w=I.itemWidth??200,a=E.width!==void 0?E.width:((y=A.geometry)==null?void 0:y.width)||200,h=E.height!==void 0?E.height:((k=A.geometry)==null?void 0:k.height)||300,t=(i.length||0)*(C==="vertical"?o:w)+((i.length||0)-1)*D,K=Math.max(0,t-(C==="vertical"?h:a)+(I.padding*2||0));I.scrollOffset>0&&(I.scrollOffset=0),I.scrollOffset<-K&&(I.scrollOffset=-K)}updateListViewHoverFromPointer(A,I,C){const g=this.getListViewItemIndexAtPointer(A,I,C),Q=A.options||{};Q.hoveredIndex!==g&&(Q.hoveredIndex=g)}getListViewItemIndexAtPointer(A,I,C){var b,x;const g=A.options||{},Q=this.objectStates.get(A.id)||{},E=g.items||[];if(E.length===0)return null;const i=Q.width!==void 0?Q.width:((b=A.geometry)==null?void 0:b.width)||200,D=Q.height!==void 0?Q.height:((x=A.geometry)==null?void 0:x.height)||300,o=g.orientation||"vertical",w=g.itemGap??10,a=g.itemHeight??50,h=g.itemWidth??200,t=g.scrollOffset??0,G=g.padding??0,K=this.getWorldTransform(A.id),y=I-K.x,k=C-K.y,e=-K.rotation*(Math.PI/180),N=Math.cos(e),S=Math.sin(e),c=y*N-k*S,M=y*S+k*N,J=-i/2,Y=-D/2,V=typeof G=="number"?G:o==="vertical"?G[0]:G[3];let f=(o==="vertical"?Y:J)+t+V;for(let IA=0;IA<E.length;IA++){const $=o==="vertical"?i:h,q=o==="vertical"?a:D,v=o==="vertical"?J:f,z=o==="vertical"?f:Y;if(c>=v&&c<=v+$&&M>=z&&M<=z+q)return IA;f+=(o==="vertical"?a:h)+w}return null}drawListViewRect(A,I,C,g,Q,E){A.beginPath(),this.drawRoundRect(A,I,C,g,Q,E),A.fill()}solveBehaviors(A){if(!this.artboard)return;if(!this._lastPointerPos){this.frameCount%60;return}const{x:I,y:C}=this._lastPointerPos;this.artboard.objects.forEach(g=>{if(!g.behaviors||g.behaviors.length===0)return;const Q=this.objectStates.get(g.id);Q&&g.behaviors.forEach(E=>{var h,t,G,K,y,k,e,N,S,c,M,J,Y,V,f,b,x,IA,$,q,v,z,Z,m,u,X,CA,O,AA,tA,sA,FA,yA,qA,JA,LA,U,p,L,r,H,j,KA,wA;if(!E.enabled)return;const i=E.startTime||0,D=E.endTime||1/0;if(this.currentTime<i||this.currentTime>D)return;const o=Q.x-I,w=Q.y-C,a=Math.sqrt(o*o+w*w);if(this.frameCount%240===0&&Math.random()<.1&&console.log(`[ExodeUI] Executing ${E.type} on ${g.name}`),E.type===P.Proximity){const T=((h=E.settings)==null?void 0:h.radius)||300,W=((t=E.settings)==null?void 0:t.falloff)||"smooth";let d=0;a<T&&(W==="linear"?d=1-a/T:d=Math.pow(1-a/T,2)),d>0&&E.sensors.forEach(l=>{this.applyBehaviorSensor(Q,l,d,A,E.settings)})}else if(E.type===P.Magnetic){const T=((G=E.settings)==null?void 0:G.radius)||400,W=((K=E.settings)==null?void 0:K.strength)||.5;if(a<T&&a>5){const d=1-a/T,l=o*d*W,SA=w*d*W;Q.x-=l*A*10,Q.y-=SA*A*10}}else if(E.type===P.Repel){const T=((y=E.settings)==null?void 0:y.radius)||300,W=((k=E.settings)==null?void 0:k.strength)||1;if(a<T){const d=Math.pow(1-a/T,2);Q.x+=o/(a||1)*d*60*W*A*5,Q.y+=w/(a||1)*d*60*W*A*5}}else if(E.type===P.Orbit){const T=((e=E.settings)==null?void 0:e.speed)||1,W=((N=E.settings)==null?void 0:N.radius)||30,d=this.currentTime*T*Math.PI*2;Q.x+=Math.cos(d)*W*A*5,Q.y+=Math.sin(d)*W*A*5,Q.rotation+=2*A*5}else if(E.type===P.Vortex){const T=((S=E.settings)==null?void 0:S.radius)||400,W=((c=E.settings)==null?void 0:c.speed)||2,d=((M=E.settings)==null?void 0:M.strength)||1;if(a<T){const l=Math.pow(1-a/T,1.5),SA=this.currentTime*W*Math.PI*2,mA=Math.cos(SA)*30-o*.4,$A=Math.sin(SA)*30-w*.4;Q.x+=mA*l*d*A*5,Q.y+=$A*l*d*A*5,Q.rotation+=5*l*d*A*5,Q.scale_x*=1-l*.1*d*A,Q.scale_y*=1-l*.1*d*A}}else if(E.type===P.Fluid){const T=((J=E.settings)==null?void 0:J.radius)||300,W=((Y=E.settings)==null?void 0:Y.strength)||1;if(a<T){const d=Math.pow(1-a/T,1.2),l=o/(a||1)*d*1.2*W,SA=w/(a||1)*d*1.2*W;Q.x+=l*10*A*5,Q.y+=SA*10*A*5,Q.scale_x*=1+d*.3*W*A,Q.scale_y*=1+d*.3*W*A}}else if(E.type===P.Elastic){const T=((V=E.settings)==null?void 0:V.radius)||300,W=((f=E.settings)==null?void 0:f.strength)||1;if(a<T){const d=1-a/T;Q.scale_x*=1+d*.4*W*A,Q.scale_y*=1+d*.4*W*A}}else if(E.type===P.Holographic){const T=Q.x-this.canvasWidth/2,W=Q.y-this.canvasHeight/2,d=((b=E.settings)==null?void 0:b.factor)||25;if(Q.x-=T/1e3*d*A*5,Q.y-=W/1e3*d*A*5,Q.style){const l=1-Math.min(1,a/400);Q.style.exposure=(Q.style.exposure||1)+l*.5*A}}else if(E.type===P.Sticky){const T=((x=E.settings)==null?void 0:x.radius)||80,W=((IA=E.settings)==null?void 0:IA.strength)||1;if(a<T){const d=Math.pow(1-a/T,2);Q.x-=o*d*W*A*10,Q.y-=w*d*W*A*10,Q.scale_x*=1-d*.1*W*A,Q.scale_y*=1-d*.1*W*A}}else if(E.type===P.Dilation){const T=(($=E.settings)==null?void 0:$.size)||120,W=((q=E.settings)==null?void 0:q.strength)||1;if(a<T){const d=1-a/T;Q.scale_x*=1+d*.5*W*A,Q.scale_y*=1+d*.5*W*A}}else if(E.type===P.Parallax){const T=((v=E.settings)==null?void 0:v.factor)||.05,W=this.canvasHeight/2,d=(this._lastPointerPos.y-W)*T;Q.y+=d*A*10}else if(E.type===P.Noise||E.type===P.Float){const T=(((z=E.settings)==null?void 0:z.frequency)||((Z=E.settings)==null?void 0:Z.speed)||1)*.002,W=(((m=E.settings)==null?void 0:m.amplitude)||((u=E.settings)==null?void 0:u.range)||50)*(((X=E.settings)==null?void 0:X.strength)||1),d=Date.now();Q.x+=Math.sin(d*T)*W*A,Q.y+=Math.cos(d*T*.8)*W*A,Q.rotation+=Math.sin(d*T*.5)*5*A}else if(E.type===P.Pulse){const T=(((CA=E.settings)==null?void 0:CA.speed)||1)*.005,W=(((O=E.settings)==null?void 0:O.scale)||1.2)-1,d=Math.sin(Date.now()*T),l=((AA=E.settings)==null?void 0:AA.strength)||1;Q.scale_x*=1+d*W*l*A,Q.scale_y*=1+d*W*l*A,Q.style&&(Q.style.exposure=(Q.style.exposure||1)+Math.max(0,d)*.1*l*A)}else if(E.type===P.Draggable){const T=((tA=E.settings)==null?void 0:tA.radius)||150,W=this.draggingBehaviors.has(g.id);if(a<T||W){const d=((sA=E.settings)==null?void 0:sA.strength)||1,l=W?1:Math.max(0,1-a/T);this.applyBehaviorSensor(Q,zA.PositionX,l*d,A,E.settings),this.applyBehaviorSensor(Q,zA.PositionY,l*d,A,E.settings)}}else if(E.type===P.Scroll){const T=((FA=E.settings)==null?void 0:FA.axis)||"vertical",W=((yA=E.settings)==null?void 0:yA.factor)||.5,d=((qA=E.settings)==null?void 0:qA.strength)||1;(T==="vertical"||T==="both")&&(Q.y+=this.scrollOffset.y*W*d*A),(T==="horizontal"||T==="both")&&(Q.x+=this.scrollOffset.x*W*d*A)}else if(E.type===P.LookAt){const T=((JA=E.settings)==null?void 0:JA.factor)||1,W=((LA=E.settings)==null?void 0:LA.strength)||1,d=Math.atan2(-w,-o)*(180/Math.PI),l=Q.rotation,SA=(d-l+180)%360-180;Q.rotation+=SA*T*W*A*10}else if(E.type===P.Glint||E.type===P.Scan){const T=(((U=E.settings)==null?void 0:U.speed)||1)*.004,W=((p=E.settings)==null?void 0:p.strength)||1,d=(Math.sin(Date.now()*T)+1)/2;Q.style&&(Q.style.exposure=(Q.style.exposure||1)+d*W*A*5),Q.x+=(d-.5)*20*W*A}else if(E.type===P.Ratchet){const T=((L=E.settings)==null?void 0:L.steps)||12,W=(((r=E.settings)==null?void 0:r.speed)||1)*30,d=Math.floor(Q.rotation/(360/T))*(360/T);Q.rotation=this.lerp(Q.rotation,d+W*A,.1)}else if(E.type===P.Jitter&&a<300){const T=((H=E.settings)==null?void 0:H.strength)||1,W=(((j=E.settings)==null?void 0:j.intensity)||5)*T;Q.x+=(Math.random()-.5)*W*A*60,Q.y+=(Math.random()-.5)*W*A*60,Q.rotation+=(Math.random()-.5)*W*A*120}else if(E.type===P.Follower){const T=(KA=E.settings)==null?void 0:KA.targetId;if(T){const W=this.objectStates.get(T);if(W){const d=((wA=E.settings)==null?void 0:wA.stiffness)||.1,l=W.x-Q.x,SA=W.y-Q.y;Q.x+=l*d*A*60,Q.y+=SA*d*A*60}}}else E.type===P.Wrap&&(Q.x<0?Q.x=this.canvasWidth:Q.x>this.canvasWidth&&(Q.x=0),Q.y<0?Q.y=this.canvasHeight:Q.y>this.canvasHeight&&(Q.y=0))})})}applyBehaviorSensor(A,I,C,g,Q){const E=(Q==null?void 0:Q.intensity)||(Q==null?void 0:Q.strength)||1,i=C*E*g;switch(I){case zA.Scale:A.scale_x*=1+i*.5,A.scale_y*=1+i*.5;break;case zA.Opacity:A.opacity=Math.max(0,Math.min(100,A.opacity-i*100));break;case zA.RotateZ:A.rotation+=i*180;break;case zA.RotateX:A.rotate_x=(A.rotate_x||0)+i*180;break;case zA.RotateY:A.rotate_y=(A.rotate_y||0)+i*180;break;case zA.PositionX:A.x+=i*300;break;case zA.PositionY:A.y+=i*300;break;case zA.SkewX:A.skew_x=(A.skew_x||0)+i*45;break;case zA.Blur:A.style||(A.style={}),A.style.blur=Math.min(100,(A.style.blur||0)+i*50);break;case zA.Exposure:A.style||(A.style={}),A.style.exposure=(A.style.exposure||1)+i*2;break;case zA.HueShift:A.style||(A.style={}),A.style.hue=(A.style.hue||0)+i*360;break;case zA.CornerRadius:A.corner_radius=Math.min(200,(A.corner_radius||0)+i*100);break;case zA.LetterSpacing:A.geometry||(A.geometry={}),A.geometry.letterSpacing=(A.geometry.letterSpacing||0)+i*10;break}}lerp(A,I,C){return A*(1-C)+I*C}deepMerge(A,I){if(!A)return I;if(!I)return A;if(typeof A!="object"||typeof I!="object"||A===null||I===null)return I;const C={...A};for(const g in I)Object.prototype.hasOwnProperty.call(I,g)&&(I[g]&&typeof I[g]=="object"&&!Array.isArray(I[g])?C[g]=this.deepMerge(A[g],I[g]):C[g]=I[g]);return C}renderFittedImage(A,I,C,g,Q,E,i="cover"){const D=I.naturalWidth,o=I.naturalHeight,w=D/o,a=Q/E;let h=Q,t=E,G=C,K=g;i==="cover"?w>a?(h=E*w,G=C-(h-Q)/2):(t=Q/w,K=g-(t-E)/2):i==="contain"&&(w>a?(t=Q/w,K=g+(E-t)/2):(h=E*w,G=C+(Q-h)/2)),A.drawImage(I,G,K,h,t)}}const PQ=({artboard:B,config:A})=>{const I={...B.seo,...A},C=I.enableSmartExtraction!==!1;nA.useEffect(()=>{const i=I.title||B.name;i&&(document.title=i);let D=I.description;if(!D&&C){const a=B.objects.filter(h=>h.geometry.type==="Text").sort((h,t)=>{var G,K;return(((G=t.geometry.text)==null?void 0:G.length)||0)-(((K=h.geometry.text)==null?void 0:K.length)||0)});a.length>0&&(D=a[0].geometry.text)}D&&(g("name","description",D),g("property","og:description",D)),I.keywords&&I.keywords.length>0&&g("name","keywords",I.keywords.join(", "));const o=I.ogImage||B.backgroundImage;o&&g("property","og:image",o),i&&g("property","og:title",i),g("property","og:type","website")},[I,B,C]);const g=(i,D,o)=>{let w=document.querySelector(`meta[${i}="${D}"]`);w||(w=document.createElement("meta"),w.setAttribute(i,D),document.head.appendChild(w)),w.setAttribute("content",o)},Q=()=>{const i=[];return i.push(ZA.jsx("h1",{children:I.title||B.name},"artboard-title")),B.objects.forEach((o,w)=>{if(!(!o.visible&&o.isVisible!==!0))if(o.geometry.type==="Text"){const a=o.geometry.text;a&&(o.geometry.fontSize>24?i.push(ZA.jsx("h2",{children:a},o.id||w)):i.push(ZA.jsx("p",{children:a},o.id||w)))}else if(o.geometry.type==="Image"){const a=o.geometry.src,h=o.altText||o.name||"Illustration";i.push(ZA.jsx("img",{src:a,alt:h},o.id||w))}else o.type==="Button"&&i.push(ZA.jsx("button",{children:o.name||"Button"},o.id||w))}),i},E=I.jsonLd||{"@context":"https://schema.org","@type":"VisualArtwork",name:I.title||B.name,description:I.description,image:I.ogImage||B.backgroundImage,abstract:"Animated interface created with ExodeUI"};return ZA.jsxs("div",{id:`exode-seo-${B.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:[Q(),ZA.jsx("script",{type:"application/ld+json",children:JSON.stringify(E)})]})},Bi=nA.forwardRef(({artboard:B,src:A,className:I,style:C,autoPlay:g=!0,fit:Q="Contain",alignment:E="Center",enableSEO:i=!0,seo:D,onReady:o,onTrigger:w,onInputUpdate:a,onComponentChange:h,onToggle:t,onInputChange:G,onInputFocus:K,onInputBlur:y,onLog:k,currentTime:e},N)=>{const S=nA.useRef(null),c=nA.useRef(new vQ),M=nA.useRef(),J=nA.useRef(0),Y=nA.useRef(null),[V,f]=nA.useState(B||null);nA.useImperativeHandle(N,()=>S.current),nA.useEffect(()=>{console.log("[ExodeUI] Layout Effect - Component Updated/Mounted"),c.current.setLayout(Q,E)},[Q,E]),nA.useEffect(()=>{w&&c.current.setTriggerCallback(w)},[w]),nA.useEffect(()=>{a&&c.current.setInputUpdateCallback(a)},[a]),nA.useEffect(()=>{h&&c.current.setComponentChangeCallback(h)},[h]),nA.useEffect(()=>{t&&c.current.setToggleCallback(t)},[t]),nA.useEffect(()=>{G&&c.current.setInputChangeCallback(G)},[G]),nA.useEffect(()=>{K&&c.current.setInputFocusCallback(K)},[K]),nA.useEffect(()=>{y&&c.current.setInputBlurCallback(y)},[y]),nA.useEffect(()=>{(async()=>{const IA=c.current;let $=B;if(!$&&A)try{const v=await(await fetch(A)).text();if(!v.trim().startsWith("{")&&!v.trim().startsWith("["))try{const z=XQ.decompressFromBase64(v.trim());z&&($=JSON.parse(z))}catch{console.warn("[ExodeUI] File is not standard JSON, and decompression failed.")}if(!$&&v)try{$=JSON.parse(v)}catch(z){console.error("[ExodeUI] Failed to parse JSON content:",z)}}catch(q){console.error("Failed to load ExodeUI animation:",q);return}if($){const q=$.id||$.name||"default";Y.current!==q&&(IA.load($),Y.current=q,f($),J.current=0),o&&o(IA)}})()},[B,A]),nA.useEffect(()=>{e!==void 0&&c.current.seek(e)},[e]),nA.useEffect(()=>{const x=c.current,IA=S.current;if(!IA)return;const $=IA.getContext("2d");if(!$)return;$.imageSmoothingEnabled=!0,$.imageSmoothingQuality="high",k&&x.setOnLogCallback(k);const q=z=>{J.current||(J.current=z);const Z=(z-J.current)/1e3;J.current=z,g&&x.advance(Z);const m=window.devicePixelRatio||1,u=IA.getBoundingClientRect(),X=Math.floor(u.width*m),CA=Math.floor(u.height*m);(IA.width!==X||IA.height!==CA)&&(IA.width=X,IA.height=CA),x.render($,X,CA),M.current=requestAnimationFrame(q)};M.current=requestAnimationFrame(q);const v=()=>{x.handleScroll(window.scrollX,window.scrollY)};return window.addEventListener("scroll",v,{passive:!0}),()=>{M.current&&cancelAnimationFrame(M.current),window.removeEventListener("scroll",v)}},[g]);const b=(x,IA)=>{const $=x.currentTarget.getBoundingClientRect(),q=x.clientX-$.left,v=x.clientY-$.top,z=$.width,Z=$.height;c.current.handlePointerInput(IA,q,v,z,Z)};return ZA.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",...C},className:I,children:[ZA.jsx("canvas",{ref:S,style:{width:"100%",height:"100%",outline:"none"},tabIndex:0,onPointerDown:x=>{var IA;b(x,"down"),(IA=S.current)==null||IA.focus()},onPointerUp:x=>b(x,"up"),onPointerMove:x=>b(x,"move"),onPointerLeave:x=>b(x,"blur"),onClick:x=>b(x,"click"),onKeyDown:x=>{x.key==="Backspace"||x.key==="Enter"||x.key,c.current.handleKeyDown(x.nativeEvent)}}),i&&V&&ZA.jsx(PQ,{artboard:V,config:D})]})});function Ei(){const[B,A]=nA.useState(null),I=nA.useCallback((a,h)=>{B==null||B.setInputBool(a,h)},[B]),C=nA.useCallback((a,h)=>{B==null||B.setInputNumber(a,h)},[B]),g=nA.useCallback(a=>{B==null||B.fireTrigger(a)},[B]),Q=nA.useCallback((a,h)=>{B==null||B.setInputText(a,h)},[B]),E=nA.useCallback((a,h)=>{B==null||B.setInputNumberArray(a,h)},[B]),i=nA.useCallback((a,h)=>{B==null||B.setInputStringArray(a,h)},[B]),D=nA.useCallback((a,h)=>{B==null||B.updateObjectOptions(a,h)},[B]),o=nA.useCallback((a,h,t)=>{B==null||B.updateConstraint(a,h,t)},[B]),w=nA.useCallback((a,h)=>{B==null||B.updateGraphData(a,h)},[B]);return{setEngine:A,engine:B,setInputBool:I,setInputNumber:C,fireTrigger:g,setInputText:Q,setInputNumberArray:E,setInputStringArray:i,updateConstraint:o,updateGraphData:w,updateObjectOptions:D}}const ii={version:"6.2.3"}.version;WA.BehaviorSensor=zA,WA.BehaviorType=P,WA.ConditionOp=kC,WA.ExodeSEO=PQ,WA.ExodeUICanvas=Bi,WA.ExodeUIEngine=vQ,WA.LogicOp=UI,WA.VERSION=ii,WA.useExodeUI=Ei,Object.defineProperty(WA,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -10056,7 +10056,7 @@ function Ni() {
|
|
|
10056
10056
|
updateObjectOptions: D
|
|
10057
10057
|
};
|
|
10058
10058
|
}
|
|
10059
|
-
const ti = "6.
|
|
10059
|
+
const ti = "6.2.3", Gi = {
|
|
10060
10060
|
version: ti
|
|
10061
10061
|
}, ei = Gi.version;
|
|
10062
10062
|
export {
|