{"version":3,"file":"Sticker_prod.DpYSAlIM.mjs","names":["useRef","useState","useCallback","axisY"],"sources":["https:/framerusercontent.com/modules/vrPzkqvimRd4wsTD6LxB/ATOQMEYyoBdJLNx7e6fj/Sticker_prod.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,useCallback}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{ComponentMessage}from\"https://framer.com/m/Utils-FINc.js\";import{useMotionValue,animate,useMotionValueEvent}from\"framer-motion\";// Three.js imports from CDN\nimport{Scene,PerspectiveCamera,WebGLRenderer,BoxGeometry,SkinnedMesh,MeshStandardMaterial,Texture,Vector3,Quaternion,Bone,Skeleton,Float32BufferAttribute,Uint16BufferAttribute,FrontSide,RepeatWrapping,LinearFilter,SRGBColorSpace,RGBAFormat,Color,DirectionalLight,AmbientLight,PlaneGeometry,Mesh,Group,ShadowMaterial,PCFSoftShadowMap}from\"https://cdn.jsdelivr.net/npm/three@0.174.0/build/three.module.js\";// Simple image source resolution\nconst resolveImageSource=input=>{if(!input)return undefined;if(typeof input===\"string\")return input.trim()||undefined;return input.src||undefined;};// ============================================================================\n// CONSTANTS\n// ============================================================================\n// Camera settings\nconst CAMERA_DISTANCE=1200;const CAMERA_NEAR=100;const CAMERA_FAR=2e3;// Sticker geometry - same as Reference for smoothness\nconst STICKER_DEPTH=.003;// Canvas scale - small padding for shadows while staying responsive\nconst CANVAS_SCALE=4// 400% extra space for shadows\n;// 2D Bone Grid settings\nconst BONE_GRID_X=60// Performance-safe bone count for hardware skinning\n;const BONE_GRID_Y=60;// ============================================================================\n// UTILITY FUNCTIONS\n// ============================================================================\nfunction calculateCameraFov(width,height,distance){const aspect=width/height;return 2*Math.atan(width/aspect/(2*distance))*(180/Math.PI);}function mapLinear(value,inMin,inMax,outMin,outMax){if(inMax===inMin)return outMin;const t=(value-inMin)/(inMax-inMin);return outMin+t*(outMax-outMin);}function mapInteralRadiusToUIValue(ui){const clamped=Math.max(.1,Math.min(1,ui));return mapLinear(clamped,.1,1,.05,1/Math.PI);}/**\n * Calculates contained dimensions (like CSS object-fit: contain)\n * Maintains image aspect ratio while fitting within container bounds\n */function calculateContainedDimensions(containerWidth,containerHeight,imageAspectRatio){// If no image aspect ratio yet, use container dimensions (will be updated when image loads)\nif(!imageAspectRatio){return{width:containerWidth,height:containerHeight};}const containerAspect=containerWidth/containerHeight;if(containerAspect>imageAspectRatio){// Container is wider than image: fit to height\nreturn{width:containerHeight*imageAspectRatio,height:containerHeight};}else{// Container is taller than image: fit to width\nreturn{width:containerWidth,height:containerWidth/imageAspectRatio};}}// CSS variable token and color parsing (hex/rgba/var())\nconst cssVariableRegex=/var\\s*\\(\\s*(--[\\w-]+)(?:\\s*,\\s*((?:[^)(]+|\\((?:[^)(]+|\\([^)(]*\\))*\\))*))?\\s*\\)/;function extractDefaultValue(cssVar){if(!cssVar||!cssVar.startsWith(\"var(\"))return cssVar;const match=cssVariableRegex.exec(cssVar);if(!match)return cssVar;const fallback=(match[2]||\"\").trim();if(fallback.startsWith(\"var(\"))return extractDefaultValue(fallback);return fallback||cssVar;}function resolveTokenColor(input){if(typeof input!==\"string\")return input;if(!input.startsWith(\"var(\"))return input;return extractDefaultValue(input);}function parseColorToRgba(input){if(!input)return{r:0,g:0,b:0,a:1};const str=input.trim();// Handle rgba() format\nconst rgbaMatch=str.match(/rgba?\\(\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*(?:,\\s*([\\d.]+)\\s*)?\\)/i);if(rgbaMatch){const r=Math.max(0,Math.min(255,parseFloat(rgbaMatch[1])))/255;const g=Math.max(0,Math.min(255,parseFloat(rgbaMatch[2])))/255;const b=Math.max(0,Math.min(255,parseFloat(rgbaMatch[3])))/255;const a=rgbaMatch[4]!==undefined?Math.max(0,Math.min(1,parseFloat(rgbaMatch[4]))):1;return{r,g,b,a};}// Handle hex formats\nconst hex=str.replace(/^#/,\"\");if(hex.length===8){return{r:parseInt(hex.slice(0,2),16)/255,g:parseInt(hex.slice(2,4),16)/255,b:parseInt(hex.slice(4,6),16)/255,a:parseInt(hex.slice(6,8),16)/255};}if(hex.length===6){return{r:parseInt(hex.slice(0,2),16)/255,g:parseInt(hex.slice(2,4),16)/255,b:parseInt(hex.slice(4,6),16)/255,a:1};}if(hex.length===4){return{r:parseInt(hex[0]+hex[0],16)/255,g:parseInt(hex[1]+hex[1],16)/255,b:parseInt(hex[2]+hex[2],16)/255,a:parseInt(hex[3]+hex[3],16)/255};}if(hex.length===3){return{r:parseInt(hex[0]+hex[0],16)/255,g:parseInt(hex[1]+hex[1],16)/255,b:parseInt(hex[2]+hex[2],16)/255,a:1};}return{r:0,g:0,b:0,a:1};}/**\n * When you show the same image on the back of a thin surface, it must be mirrored\n * to look consistent to the viewer when the sticker flips/curls.\n *\n * Important: never mutate the front texture. If `tex` is the same as `frontTex`,\n * we clone before mirroring.\n */function makeBackTextureViewConsistent(tex,frontTex){if(!tex)return null;const out=tex===frontTex&&typeof tex.clone===\"function\"?tex.clone():tex;out.wrapS=RepeatWrapping;out.repeat.x=-1;out.offset.x=1;out.needsUpdate=true;return out;}// ============================================================================\n// FRAMER ANNOTATIONS\n// ============================================================================\n/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 400\n * @framerDisableUnlink\n */export default function Sticker({image,curlRotation=0,curlMode=\"spiral\",animation={show:\"initial\",curlAmountStart:.6,curlAmountEnd:.6,curlRadiusStart:.15,curlRadiusEnd:1,curlStartStart:.5,curlStartEnd:1},transition={type:\"tween\",duration:.6,ease:\"easeInOut\"},backColor=\"rgba(255, 255, 255, 1)\",animationDuration=.6,shadowPositionX=-400,shadowPositionY=0,shadowBgColor=\"rgba(0, 0, 0, 0)\",castShadowOpacity=.3,refresh=false,style,borderRadius,backgroundColor=\"transparent\"}){// Refs\nconst containerRef=useRef(null);const canvasRef=useRef(null);const sceneRef=useRef(null);const rendererRef=useRef(null);const cameraRef=useRef(null);const meshRef=useRef(null);const groupRef=useRef(null)// Group for rotation around center\n;const bonesRef=useRef([]);const bonesInitialPositionsRef=useRef([]);const zoomProbeRef=useRef(null);const lastSizeRef=useRef({width:0,height:0,zoom:0,aspect:0,ts:0});const animationFrameRef=useRef(null);const loadedImageRef=useRef(null);const imageLoadAbortRef=useRef(false)// Track if component is unmounting\n;// Detect environment\nconst resolvedImageUrl=resolveImageSource(image);const isCanvas=RenderTarget.current()===RenderTarget.canvas;// In Canvas mode, use the show prop to determine initial state\n// In preview/live mode, always start with initial values\nconst shouldShowFinal=isCanvas&&animation.show===\"final\";// Use Framer Motion values for animated properties\nconst initialCurlAmount=shouldShowFinal?animation.curlAmountEnd:animation.curlAmountStart;const initialCurlStart=shouldShowFinal?animation.curlStartEnd:animation.curlStartStart;const initialCurlRadius=shouldShowFinal?animation.curlRadiusEnd:animation.curlRadiusStart;const curlAmountMotion=useMotionValue(initialCurlAmount);const curlStartMotion=useMotionValue(initialCurlStart);const curlRadiusMotion=useMotionValue(initialCurlRadius);// Keep refs for quick access in updateBones (motion values are read synchronously)\nconst animatedCurlRef=useRef({amount:initialCurlAmount});const animatedCurlStartRef=useRef({start:initialCurlStart});const animatedCurlRadiusRef=useRef({radius:initialCurlRadius});const isHoveringRef=useRef(false)// Track if currently hovering over sticker\n;const lightRef=useRef(null);const ambientLightRef=useRef(null);const backgroundPlaneRef=useRef(null);const curlRotationRef=useRef(curlRotation)// Store curlRotation in ref so updateBones always reads current value\n;const imageAspectRatioRef=useRef(null)// Store image aspect ratio for contain behavior\n;const lastMeshDimensionsRef=useRef(null)// Track mesh dimensions to avoid unnecessary recreation\n;const pendingUpdateRef=useRef(false)// Flag to batch bone updates into single RAF\n;const lastRetryAttemptRef=useRef(0)// Track last retry attempt to prevent rapid retries\n;const previousRefreshRef=useRef(undefined)// Track previous refresh value to detect changes\n;// State\nconst[textureLoaded,setTextureLoaded]=useState(false);// Track WebGL context loss (happens when too many WebGL contexts are active)\n// Browser limit is typically 8-16 contexts depending on the browser and hardware\nconst[contextLost,setContextLost]=useState(false);// Track when scene is ready to trigger re-renders (refs don't trigger re-renders)\nconst[sceneReady,setSceneReady]=useState(false);const hasContent=!!resolvedImageUrl;// ========================================================================\n// CREATE STICKER GEOMETRY WITH 2D BILINEAR SKINNING\n// ========================================================================\nconst createStickerGeometry=useCallback((width,height,gridX,gridY)=>{// High resolution geometry for smooth curves, independent of bone count\nconst xSegments=150;const ySegments=100;const geometry=new BoxGeometry(width,height,STICKER_DEPTH,xSegments,ySegments,1);// Geometry is centered at origin (no translation needed for 2D grid approach)\n// This keeps the sticker centered and simplifies fold line calculations\n// Add 2D bilinear skinning attributes\nconst position=geometry.attributes.position;const vertex=new Vector3;const skinIndexes=[];const skinWeights=[];// Bone grid spacing\nconst boneSpacingX=width/(gridX-1);const boneSpacingY=height/(gridY-1);for(let i=0;i<position.count;i++){vertex.fromBufferAttribute(position,i);// Convert vertex position to grid coordinates (0 to gridX-1, 0 to gridY-1)\n// Geometry is centered, so vertex.x ranges from -width/2 to width/2\nconst normalizedX=(vertex.x+width/2)/width// 0 to 1\n;const normalizedY=(vertex.y+height/2)/height// 0 to 1\n;// Find the 4 nearest bones (bilinear interpolation)\nconst gridXPos=normalizedX*(gridX-1);const gridYPos=normalizedY*(gridY-1);const x0=Math.floor(gridXPos);const y0=Math.floor(gridYPos);const x1=Math.min(x0+1,gridX-1);const y1=Math.min(y0+1,gridY-1);// Bilinear interpolation weights\nconst tx=gridXPos-x0;const ty=gridYPos-y0;// Four bone indices in the grid (row-major order)\nconst idx00=y0*gridX+x0// bottom-left\n;const idx10=y0*gridX+x1// bottom-right\n;const idx01=y1*gridX+x0// top-left\n;const idx11=y1*gridX+x1// top-right\n;// Bilinear weights\nconst w00=(1-tx)*(1-ty);const w10=tx*(1-ty);const w01=(1-tx)*ty;const w11=tx*ty;skinIndexes.push(idx00,idx10,idx01,idx11);skinWeights.push(w00,w10,w01,w11);}geometry.setAttribute(\"skinIndex\",new Uint16BufferAttribute(skinIndexes,4));geometry.setAttribute(\"skinWeight\",new Float32BufferAttribute(skinWeights,4));// Compute smooth normals AFTER skinning attributes to eliminate striations\ngeometry.computeVertexNormals();return geometry;},[]);// ========================================================================\n// SCENE SETUP\n// ========================================================================\nconst setupScene=useCallback(()=>{if(!canvasRef.current||!containerRef.current){return null;}const container=containerRef.current;const containerWidth=container.clientWidth||container.offsetWidth||1;const containerHeight=container.clientHeight||container.offsetHeight||1;// Ensure we have valid dimensions (at least 1px)\nif(containerWidth<=0||containerHeight<=0){return null;}const dpr=Math.min(window.devicePixelRatio||1,2);// Calculate contained dimensions (maintains image aspect ratio)\nconst contained=calculateContainedDimensions(containerWidth,containerHeight,imageAspectRatioRef.current);const width=contained.width;const height=contained.height;// Canvas with small padding for shadows\nconst canvasWidth=containerWidth*CANVAS_SCALE;const canvasHeight=containerHeight*CANVAS_SCALE;// Create scene\nconst scene=new Scene;sceneRef.current=scene;// Create camera\nconst camera=new PerspectiveCamera(calculateCameraFov(canvasWidth,canvasHeight,CAMERA_DISTANCE),canvasWidth/canvasHeight,CAMERA_NEAR,CAMERA_FAR);camera.position.set(0,0,CAMERA_DISTANCE);camera.lookAt(0,0,0);cameraRef.current=camera;// Dispose old renderer if it exists (prevent WebGL context accumulation)\nif(rendererRef.current){try{rendererRef.current.dispose();}catch(error){// Silently handle disposal errors\n}rendererRef.current=null;}// Create renderer\nlet renderer;try{renderer=new WebGLRenderer({canvas:canvasRef.current,alpha:true,antialias:true});// Check if context was actually created\nconst gl=renderer.getContext();if(!gl||gl.isContextLost()){console.error(\"WebGL context is lost or unavailable\");setContextLost(true);renderer.dispose();return null;}renderer.setSize(Math.round(canvasWidth*dpr),Math.round(canvasHeight*dpr),false);renderer.setPixelRatio(1);// Enable high-quality shadow maps (shadows always enabled)\nrenderer.shadowMap.enabled=true;renderer.shadowMap.type=PCFSoftShadowMap// High quality soft shadows\n;rendererRef.current=renderer;}catch(error){// WebGL context creation failed (too many contexts)\nconsole.error(\"Failed to create WebGL context:\",error);setContextLost(true);return null;}canvasRef.current.style.width=`${canvasWidth}px`;canvasRef.current.style.height=`${canvasHeight}px`;// Create geometry with base dimensions (1:1 or image aspect ratio if known)\n// We'll scale the mesh uniformly to fit the container while maintaining aspect ratio\nconst baseSize=Math.min(containerWidth,containerHeight);const geometry=createStickerGeometry(baseSize,baseSize,BONE_GRID_X,BONE_GRID_Y);// Create 2D bone grid\n// Bones are independent (not parented) - each bone controls a region of the sticker\n// Position bones relative to geometry size (baseSize), not contained dimensions\n// When mesh is scaled, bones will scale with it through the skeleton system\nconst bones=[];const boneSpacingX=baseSize/(BONE_GRID_X-1);const boneSpacingY=baseSize/(BONE_GRID_Y-1);for(let y=0;y<BONE_GRID_Y;y++){for(let x=0;x<BONE_GRID_X;x++){const bone=new Bone;// Position bones in a grid, centered at origin (relative to geometry size)\nbone.position.x=-baseSize/2+x*boneSpacingX;bone.position.y=-baseSize/2+y*boneSpacingY;bone.position.z=0;bones.push(bone);}}bonesRef.current=bones;bonesInitialPositionsRef.current=bones.map(b=>b.position.clone());const skeleton=new Skeleton(bones);// Create materials for front and back\n// Use MeshStandardMaterial with low roughness (0.1) like Reference.tsx for smoothness\n// This prevents striations while still casting shadows\n// Parse back color for side material (border) - use color but always 100% opaque\nconst resolvedBackColor=resolveTokenColor(backColor);const backColorRgba=parseColorToRgba(resolvedBackColor);// All faces use MeshStandardMaterial with smooth roughness (shadows always enabled)\nconst frontMaterial=new MeshStandardMaterial({color:16777215,side:FrontSide,transparent:true,roughness:.2,metalness:.4,// Add emissive to reduce lighting dependency and striations\nemissive:16777215,emissiveIntensity:.8});// Back face: transparent with image texture, but darker with shadow overlay\nconst backMaterial=new MeshStandardMaterial({color:16777215,side:FrontSide,transparent:true,roughness:.3,metalness:0,// Lower emissive than front to allow shadow/lighting overlay\nemissive:16777215,emissiveIntensity:.3});// Side material: will use front texture when loaded (blends with front image), back color as fallback\nconst sideMaterial=new MeshStandardMaterial({color:new Color(backColorRgba.r,backColorRgba.g,backColorRgba.b),transparent:true,opacity:1,roughness:.1,metalness:0});// Materials array for BoxGeometry faces\n// Order: +X, -X, +Y, -Y, +Z (front), -Z (back)\nconst materials=[sideMaterial,sideMaterial,sideMaterial,sideMaterial,frontMaterial,backMaterial];// Create skinned mesh\nconst mesh=new SkinnedMesh(geometry,materials);mesh.frustumCulled=false;// Add all bones to the mesh and initialize their matrices\nbones.forEach(bone=>{mesh.add(bone);// Initialize bone matrix to ensure it's ready for skeleton\nbone.updateMatrixWorld(true);});// Bind skeleton AFTER bones are added and initialized\nmesh.bind(skeleton);// Update mesh and skeleton matrices\nmesh.updateMatrixWorld(true);// Update skeleton AFTER mesh matrix world is computed\n// This ensures all bone matrices are ready\nskeleton.update();// Enable shadows (always enabled)\n// According to Three.js forum: setting both castShadow and receiveShadow can cause acne\n// The sticker casts shadows onto the background plane, but doesn't need to receive them\nmesh.castShadow=true;mesh.receiveShadow=false// Don't receive shadows to avoid acne\n;// Calculate initial scale to fit container with aspect ratio (if image aspect ratio is known)\n// Otherwise, use container dimensions\nlet initialScaleX=1;let initialScaleY=1;if(imageAspectRatioRef.current){const contained=calculateContainedDimensions(containerWidth,containerHeight,imageAspectRatioRef.current);initialScaleX=contained.width/baseSize;initialScaleY=contained.height/baseSize;}else{// No image yet - use container dimensions\ninitialScaleX=containerWidth/baseSize;initialScaleY=containerHeight/baseSize;}mesh.scale.set(initialScaleX,initialScaleY,1);// Create a group (no rotation - image stays upright, curl direction is handled by bone rotation axis)\nconst group=new Group;groupRef.current=group;// Mesh is centered at origin (no position offset needed with 2D grid approach)\nmesh.position.set(0,0,0);group.add(mesh);meshRef.current=mesh;// Initialize last mesh dimensions\nlastMeshDimensionsRef.current={width:baseSize,height:baseSize};scene.add(group);// Ensure mesh is immediately visible (will show back color until texture loads)\n// This prevents the \"white plane only\" issue\n// No group rotation - curlRotation is handled by rotating the fold line axis in updateBones()\n// Add lighting (shadows always enabled with intensity = 1)\n// Calculate initial light intensities for shadowIntensity = 1\n// High shadowIntensity = strong directional, low ambient = dark shadows\n// At shadowIntensity = 1, make shadows very dramatic (strong directional, low ambient)\nconst shadowIntensity=1// Hardcoded\n;const initialLightIntensity=.3+shadowIntensity*1.7// 0.3 to 2.0 (more dramatic at max)\n;const initialAmbientIntensity=Math.max(1-shadowIntensity*.6,.4)// 1.0 to 0.4 (lower at max for drama)\n;// Ambient light for overall scene illumination\n// Lower ambient allows shadows to be more visible\nconst ambientLight=new AmbientLight(16777215,initialAmbientIntensity);ambientLightRef.current=ambientLight;scene.add(ambientLight);// Directional light for shadows (reduced intensity to minimize band contrast)\nconst directionalLight=new DirectionalLight(16777215,initialLightIntensity);directionalLight.position.set(shadowPositionX,shadowPositionY,400);directionalLight.castShadow=true;// Configure shadow map for high-quality, soft shadows\ndirectionalLight.shadow.mapSize.width=4096;directionalLight.shadow.mapSize.height=4096;directionalLight.shadow.camera.near=1;directionalLight.shadow.camera.far=2e3;// Shadow camera bounds need to account for:\n// 1. Canvas size (which includes CANVAS_SCALE padding for shadows)\n// 2. Light position offset (shadowPositionX/Y can be -500 to 500)\n// 3. Shadow projection area (shadows extend in the direction opposite to light)\n// Use canvas dimensions to ensure shadows don't clip\n// Shadow camera should be at least as large as the canvas to prevent clipping\n// The 3.5 multiplier provides padding for light offsets, but it was relative to container\n// Now we scale it relative to canvas: use canvas size * (3.5 / CANVAS_SCALE) to maintain same padding ratio\n// But to prevent clipping, ensure it's at least canvas size\nconst baseShadowSize=Math.max(canvasWidth,canvasHeight);const shadowCameraSize=Math.max(baseShadowSize,baseShadowSize*(3.5/CANVAS_SCALE)// Or use scaled padding (maintains same absolute padding)\n);const shadowOffsetX=shadowPositionX*.3// Account for light position\n;const shadowOffsetY=shadowPositionY*.3;directionalLight.shadow.camera.left=-shadowCameraSize/2+shadowOffsetX;directionalLight.shadow.camera.right=shadowCameraSize/2+shadowOffsetX;directionalLight.shadow.camera.top=shadowCameraSize/2+shadowOffsetY;directionalLight.shadow.camera.bottom=-shadowCameraSize/2+shadowOffsetY;// Very small bias to prevent acne while keeping shadow visible\ndirectionalLight.shadow.bias=-1e-5;directionalLight.shadow.radius=8// Softer shadow edges\n;lightRef.current=directionalLight;scene.add(directionalLight);// Add background plane to receive shadows\n// Add shadow-only plane (transparent background with visible shadow)\n// ShadowMaterial shows ONLY shadows on transparent background\nconst shadowMat=new ShadowMaterial({opacity:castShadowOpacity,color:0});// Create plane sized to cover shadow camera area (larger to prevent clipping)\n// Match shadow camera bounds to ensure all shadows are captured\n// Use same calculation as shadow camera to ensure plane covers all shadows\nconst planeSize=shadowCameraSize;const planeGeometry=new PlaneGeometry(planeSize,planeSize);const backgroundPlane=new Mesh(planeGeometry,shadowMat);backgroundPlane.receiveShadow=true;// Position very slightly behind sticker\nbackgroundPlane.position.set(0,0,-1);backgroundPlaneRef.current=backgroundPlane;scene.add(backgroundPlane);// Initial render to show mesh immediately (even without texture)\nif(renderer&&scene&&camera){renderer.render(scene,camera);}// Mark scene as ready to trigger re-render and show canvas\nsetSceneReady(true);return{scene,camera,renderer,mesh,bones};},[createStickerGeometry,shadowPositionX,shadowPositionY,castShadowOpacity,backColor]);// ========================================================================\n// RENDERING\n// ========================================================================\nconst renderFrame=useCallback(()=>{if(!rendererRef.current||!sceneRef.current||!cameraRef.current)return;// Check if WebGL context is lost - but don't update state here to avoid infinite loops\nconst gl=rendererRef.current.getContext();if(!gl||gl.isContextLost()){return;}// Ensure world matrices and skeleton are updated before rendering\n// This prevents \"Cannot read properties of undefined (reading 'matrixWorld')\" errors\nif(meshRef.current&&meshRef.current.skeleton){meshRef.current.updateMatrixWorld(true);// Ensure all bones have valid matrices before skeleton update\nconst bones=meshRef.current.skeleton.bones;if(bones&&bones.length>0){// Update bone matrices individually to ensure they're ready\nbones.forEach(bone=>{if(bone&&typeof bone.updateMatrixWorld===\"function\"){bone.updateMatrixWorld(true);}});}meshRef.current.skeleton.update();}rendererRef.current.render(sceneRef.current,cameraRef.current);},[]);// ========================================================================\n// BACK TEXTURE CREATION\n// ========================================================================\n/**\n     * Creates a back texture that blends backColor with the front image\n     * If backColor is 100% opaque, shows just the color\n     * If backColor has transparency, blends it with the front image\n     */const createBackTexture=useCallback((img,backColorValue)=>{const backCanvas=document.createElement(\"canvas\");backCanvas.width=img.width;backCanvas.height=img.height;const backCtx=backCanvas.getContext(\"2d\");if(!backCtx)return null;// Parse back color\nconst resolvedBackColor=resolveTokenColor(backColorValue);const backColorRgba=parseColorToRgba(resolvedBackColor);// Draw the front image first (as base)\nbackCtx.drawImage(img,0,0);const imageData=backCtx.getImageData(0,0,img.width,img.height);// Blend backColor with the image based on opacity\n// If opacity is 1.0, replace image with color\n// If opacity < 1.0, blend color over image\nconst backR=Math.round(backColorRgba.r*255);const backG=Math.round(backColorRgba.g*255);const backB=Math.round(backColorRgba.b*255);const backA=backColorRgba.a;for(let i=0;i<imageData.data.length;i+=4){const imgR=imageData.data[i];const imgG=imageData.data[i+1];const imgB=imageData.data[i+2];const imgA=imageData.data[i+3]/255// Normalize alpha\n;if(backA>=1){// Fully opaque: replace with back color (but preserve image alpha shape)\nimageData.data[i]=backR;imageData.data[i+1]=backG;imageData.data[i+2]=backB;// Keep original alpha to maintain image shape\n}else if(backA>0){// Semi-transparent: blend back color over image\n// Alpha blending: result = backColor * backA + image * (1 - backA)\nimageData.data[i]=Math.round(backR*backA+imgR*(1-backA));imageData.data[i+1]=Math.round(backG*backA+imgG*(1-backA));imageData.data[i+2]=Math.round(backB*backA+imgB*(1-backA));// Keep original alpha to maintain image shape\n}// If backA is 0, keep original image (fully transparent back color)\n}backCtx.putImageData(imageData,0,0);const backTexture=new Texture(backCanvas);backTexture.needsUpdate=true;backTexture.minFilter=LinearFilter;backTexture.colorSpace=SRGBColorSpace;backTexture.format=RGBAFormat;return backTexture;},[]);// ========================================================================\n// MESH RECREATION WITH ASPECT RATIO\n// ========================================================================\n// Function to recreate geometry and mesh with correct aspect ratio\nconst recreateMeshWithAspectRatio=useCallback(aspectRatio=>{if(!sceneRef.current||!containerRef.current||!rendererRef.current||!cameraRef.current)return;const container=containerRef.current;const containerWidth=container.clientWidth||container.offsetWidth||1;const containerHeight=container.clientHeight||container.offsetHeight||1;// Calculate contained dimensions\nconst contained=calculateContainedDimensions(containerWidth,containerHeight,aspectRatio);// Preserve textures before disposing materials\nlet preservedTextures={};if(meshRef.current){const oldMesh=meshRef.current;const oldMaterials=oldMesh.material;if(Array.isArray(oldMaterials)){// Preserve textures before disposal\nif(oldMaterials[4]?.map)preservedTextures.front=oldMaterials[4].map;if(oldMaterials[5]?.map)preservedTextures.back=oldMaterials[5].map;if(oldMaterials[0]?.map)preservedTextures.side=oldMaterials[0].map;}// Remove from scene and group first\nif(groupRef.current){groupRef.current.remove(oldMesh);}sceneRef.current.remove(oldMesh);// Dispose geometry\nif(oldMesh.geometry){oldMesh.geometry.dispose();}// Dispose materials and textures\nif(Array.isArray(oldMesh.material)){oldMesh.material.forEach(mat=>{// Don't dispose textures - they're preserved\nif(mat.map&&mat.map!==preservedTextures.front&&mat.map!==preservedTextures.back&&mat.map!==preservedTextures.side){mat.map.dispose();}mat.dispose();});}else if(oldMesh.material){oldMesh.material.dispose();}// Clear old skeleton bones (they're children of the mesh)\nif(oldMesh.skeleton){oldMesh.skeleton.bones.forEach(bone=>{if(bone.parent){bone.parent.remove(bone);}});}}// Create new geometry with correct aspect ratio using 2D bone grid\nconst geometry=createStickerGeometry(contained.width,contained.height,BONE_GRID_X,BONE_GRID_Y);// Recreate 2D bone grid\nconst bones=[];const boneSpacingX=contained.width/(BONE_GRID_X-1);const boneSpacingY=contained.height/(BONE_GRID_Y-1);for(let y=0;y<BONE_GRID_Y;y++){for(let x=0;x<BONE_GRID_X;x++){const bone=new Bone;// Position bones in a grid, centered at origin\nbone.position.x=-contained.width/2+x*boneSpacingX;bone.position.y=-contained.height/2+y*boneSpacingY;bone.position.z=0;bones.push(bone);}}bonesRef.current=bones;bonesInitialPositionsRef.current=bones.map(b=>b.position.clone());const skeleton=new Skeleton(bones);// Recreate materials (reuse existing material setup logic from setupScene)\n// Parse back color for side material (border) - use color but always 100% opaque\nconst resolvedBackColor=resolveTokenColor(backColor);const backColorRgba=parseColorToRgba(resolvedBackColor);// All materials use MeshStandardMaterial (shadows always enabled)\nconst frontMaterial=new MeshStandardMaterial({color:16777215,side:FrontSide,transparent:true,roughness:.2,metalness:.4,emissive:16777215,emissiveIntensity:.8});const backMaterial=new MeshStandardMaterial({color:16777215,side:FrontSide,transparent:true,roughness:.3,metalness:0,emissive:16777215,emissiveIntensity:.3});// Side material: will use front texture when loaded (blends with front image), back color as fallback\nconst sideMaterial=new MeshStandardMaterial({color:new Color(backColorRgba.r,backColorRgba.g,backColorRgba.b),transparent:true,opacity:1,roughness:.1,metalness:0});const materials=[sideMaterial,sideMaterial,sideMaterial,sideMaterial,frontMaterial,backMaterial];// Create new mesh\nconst mesh=new SkinnedMesh(geometry,materials);mesh.frustumCulled=false;// Add all bones to the mesh and initialize their matrices\nbones.forEach(bone=>{mesh.add(bone);// Initialize bone matrix to ensure it's ready for skeleton\nbone.updateMatrixWorld(true);});// Bind skeleton AFTER bones are added and initialized\nmesh.bind(skeleton);// Update mesh and skeleton matrices\nmesh.updateMatrixWorld(true);// Update skeleton AFTER mesh matrix world is computed\n// This ensures all bone matrices are ready\nskeleton.update();// Shadows always enabled\nmesh.castShadow=true;mesh.receiveShadow=false;// Mesh is centered at origin (no position offset needed with 2D grid approach)\nmesh.position.set(0,0,0);// Create or get group (no rotation - image stays upright)\nlet group=groupRef.current;if(!group){group=new Group;groupRef.current=group;sceneRef.current.add(group);}else{// Remove old mesh from group if it exists\nconst oldMesh=group.children.find(child=>child===meshRef.current);if(oldMesh){group.remove(oldMesh);}}group.add(mesh);// No group rotation - curlRotation is handled by bone rotation axis in updateBones()\nmeshRef.current=mesh;// Update last mesh dimensions\nlastMeshDimensionsRef.current={width:contained.width,height:contained.height};// Apply textures if they're already loaded\n// Reuse preserved textures if available, otherwise create new ones\nif(loadedImageRef.current){const img=loadedImageRef.current;// Reuse preserved texture if available, otherwise create new one\nconst texture=preservedTextures.front||new Texture(img);if(!preservedTextures.front){texture.needsUpdate=true;texture.minFilter=LinearFilter;texture.colorSpace=SRGBColorSpace;texture.format=RGBAFormat;}// Create back texture: blend backColor with front image\n// If backColor is fully transparent (0% opacity), use front texture directly\nconst resolvedBackColor=resolveTokenColor(backColor);const backColorRgba=parseColorToRgba(resolvedBackColor);// Reuse preserved back texture if available and backColor hasn't changed\nlet rawBackTexture=preservedTextures.back;if(!rawBackTexture){rawBackTexture=backColorRgba.a<=0?texture:createBackTexture(img,backColor);}const backTexture=makeBackTextureViewConsistent(rawBackTexture,texture);const meshMaterials=mesh.material;if(Array.isArray(meshMaterials)){if(meshMaterials[4]){meshMaterials[4].map=texture;meshMaterials[4].transparent=true;meshMaterials[4].alphaTest=.01;if(meshMaterials[4].emissiveIntensity!==undefined){meshMaterials[4].emissiveMap=texture;meshMaterials[4].emissive=new Color(16777215);meshMaterials[4].emissiveIntensity=.8;}meshMaterials[4].needsUpdate=true;}if(meshMaterials[5]){const resolvedBackColor=resolveTokenColor(backColor);const backColorRgba=parseColorToRgba(resolvedBackColor);// With shadows: use texture (MeshStandardMaterial)\nif(backTexture){meshMaterials[5].map=backTexture;meshMaterials[5].transparent=true;meshMaterials[5].alphaTest=.01;// When using front texture (0% opacity), match front material properties for identical appearance\nif(backColorRgba.a<=0&&meshMaterials[5].emissiveIntensity!==undefined){meshMaterials[5].emissiveMap=texture;meshMaterials[5].emissive=new Color(16777215);meshMaterials[5].emissiveIntensity=.8// Match front material\n;}}meshMaterials[5].needsUpdate=true;}// Side faces (border): use front face texture - blends with front image, not background\n// Reuse preserved side texture if available\nconst sideTexture=preservedTextures.side||texture;for(let i=0;i<4;i++){if(meshMaterials[i]&&sideTexture){// Use front face texture so border blends with front image\nmeshMaterials[i].map=sideTexture;meshMaterials[i].transparent=true;meshMaterials[i].alphaTest=.01;// Match front material properties if using MeshStandardMaterial\nif(meshMaterials[i].emissiveIntensity!==undefined&&meshMaterials[4]?.emissiveIntensity!==undefined){meshMaterials[i].emissiveMap=sideTexture;meshMaterials[i].emissive=meshMaterials[4].emissive||new Color(16777215);meshMaterials[i].emissiveIntensity=meshMaterials[4].emissiveIntensity||.8;}meshMaterials[i].needsUpdate=true;}}}}// Mark scene as ready and render after mesh recreation to ensure it's visible\nsetSceneReady(true);// Use requestAnimationFrame to ensure textures are uploaded to GPU before rendering\nrequestAnimationFrame(()=>{if(!meshRef.current)return;// Force material updates to ensure textures are ready\nconst meshMaterials=mesh.material;if(Array.isArray(meshMaterials)){meshMaterials.forEach(mat=>{if(mat&&mat.needsUpdate!==undefined){mat.needsUpdate=true;}});}// Update skeleton and bones to ensure everything is in sync\nif(mesh.skeleton){mesh.updateMatrixWorld(true);mesh.skeleton.update();}// Render after texture is ready\nrenderFrame();// Second frame: final render to ensure everything is displayed\nrequestAnimationFrame(()=>{if(meshRef.current){renderFrame();}});});},[createStickerGeometry,backColor,createBackTexture,renderFrame]);// Expose a function to trigger resize after mesh recreation\n// This is needed to ensure responsiveness when image loads/changes\nconst triggerResizeRef=useRef(null);// ========================================================================\n// TEXTURE LOADING\n// ========================================================================\nconst loadTexture=useCallback(()=>{if(!resolvedImageUrl||!meshRef.current){setTextureLoaded(false);return;}setTextureLoaded(false);imageLoadAbortRef.current=false// Reset abort flag\n;const img=new Image;img.crossOrigin=\"anonymous\";img.onload=()=>{// Check if component was unmounted during load\nif(imageLoadAbortRef.current||!meshRef.current)return;// Store reference for border color updates\nloadedImageRef.current=img;// Detect and store image aspect ratio for contain behavior\nif(img.width&&img.height){const aspectRatio=img.width/img.height;imageAspectRatioRef.current=aspectRatio;// Recreate mesh with correct aspect ratio geometry\nrecreateMeshWithAspectRatio(aspectRatio);// Wait for next frame to ensure mesh is fully initialized before updating bones and triggering resize\n// This prevents race conditions where skeleton isn't ready yet\nrequestAnimationFrame(()=>{// Check if component unmounted during the frame delay\nif(imageLoadAbortRef.current)return;if(meshRef.current&&groupRef.current&&meshRef.current.skeleton){try{// Ensure skeleton is fully initialized before updating bones\nconst bones=meshRef.current.skeleton.bones;if(bones&&bones.length>0&&bonesRef.current.length>0){// Double-check bones are ready\nmeshRef.current.updateMatrixWorld(true);meshRef.current.skeleton.update();updateBones();}}catch(error){// Silently handle initialization errors\n}}// Trigger resize to ensure mesh is properly sized for current container\n// This is critical for responsiveness when image first loads or changes\nif(triggerResizeRef.current&&containerRef.current){triggerResizeRef.current();}});}// Check mesh is still valid after potential recreation\nif(!meshRef.current?.material)return;// Check if textures are already applied (from recreateMeshWithAspectRatio)\n// If so, we just need to ensure a render happens\nconst materials=meshRef.current.material;const hasTexture=Array.isArray(materials)&&materials[4]?.map;// Only create new textures if they don't exist yet\nlet texture;if(hasTexture&&Array.isArray(materials)){// Reuse existing texture, but ensure it's marked for update\ntexture=materials[4].map;if(texture&&texture.needsUpdate!==undefined){texture.needsUpdate=true;}}else{// Create main texture for front face\ntexture=new Texture(img);texture.needsUpdate=true;texture.minFilter=LinearFilter;texture.colorSpace=SRGBColorSpace;texture.format=RGBAFormat;}// Create back face texture: blend backColor with front image\n// If backColor is fully transparent (0% opacity), use front texture directly\nconst resolvedBackColor=resolveTokenColor(backColor);const backColorRgba=parseColorToRgba(resolvedBackColor);const rawBackTexture=backColorRgba.a<=0?texture:createBackTexture(img,backColor);const backTexture=makeBackTextureViewConsistent(rawBackTexture,texture);// Apply textures to materials (only if not already applied)\nif(Array.isArray(materials)){// Front face: image texture, use alphaTest for clean cutout\n// When using MeshStandardMaterial, also set emissiveMap so colors stay bright\nif(materials[4]){// Only apply if texture is different or not set\nif(materials[4].map!==texture){materials[4].map=texture;// Ensure texture is marked for update\nif(texture.needsUpdate!==undefined){texture.needsUpdate=true;}}materials[4].transparent=true;materials[4].alphaTest=.01// Discard nearly-transparent pixels\n;// If MeshStandardMaterial, use emissiveMap to keep image bright and reduce striations\nif(materials[4].emissiveIntensity!==undefined){materials[4].emissiveMap=texture// Emit the image colors\n;materials[4].emissive=new Color(16777215)// Allow full emissive color\n;// Increase emissive intensity to reduce lighting dependency and striations\nmaterials[4].emissiveIntensity=.8;}materials[4].needsUpdate=true;}// Back face: apply texture or color based on backColor\nif(materials[5]){const resolvedBackColor=resolveTokenColor(backColor);const backColorRgba=parseColorToRgba(resolvedBackColor);// With shadows: use texture (MeshStandardMaterial)\nif(backTexture){materials[5].map=backTexture;materials[5].transparent=true;materials[5].alphaTest=.01;// When using front texture (0% opacity), match front material properties for identical appearance\nif(backColorRgba.a<=0&&materials[5].emissiveIntensity!==undefined){materials[5].emissiveMap=texture;materials[5].emissive=new Color(16777215);materials[5].emissiveIntensity=.8// Match front material\n;}}materials[5].needsUpdate=true;}// Side faces (border): use front face texture - blends with front image, not background\nfor(let i=0;i<4;i++){if(materials[i]&&texture){// Use front face texture so border blends with front image\nmaterials[i].map=texture;materials[i].transparent=true;materials[i].alphaTest=.01;// Match front material properties if using MeshStandardMaterial\nif(materials[i].emissiveIntensity!==undefined&&materials[4]?.emissiveIntensity!==undefined){materials[i].emissiveMap=texture;materials[i].emissive=materials[4].emissive||new Color(16777215);materials[i].emissiveIntensity=materials[4].emissiveIntensity||.8;}materials[i].needsUpdate=true;}}}setTextureLoaded(true);// Ensure scene is marked as ready (triggers re-render to show canvas)\nsetSceneReady(true);// Always render after textures are applied (only if still mounted)\n// Use multiple requestAnimationFrame calls to ensure texture has uploaded to GPU\nif(!imageLoadAbortRef.current&&meshRef.current){// First frame: ensure materials and textures are marked for update\nrequestAnimationFrame(()=>{if(imageLoadAbortRef.current||!meshRef.current)return;// Force material and texture updates to ensure they're ready\nconst materials=meshRef.current.material;if(Array.isArray(materials)){materials.forEach(mat=>{if(mat){if(mat.needsUpdate!==undefined){mat.needsUpdate=true;}// Ensure texture is marked for update\nif(mat.map&&mat.map.needsUpdate!==undefined){mat.map.needsUpdate=true;}}});}// Update skeleton and bones to ensure everything is in sync\nif(meshRef.current.skeleton){meshRef.current.updateMatrixWorld(true);meshRef.current.skeleton.update();}// Second frame: render after texture upload has been triggered\nrequestAnimationFrame(()=>{if(imageLoadAbortRef.current||!meshRef.current)return;// Render to trigger texture upload\nrenderFrame();// Third frame: final render to ensure texture is displayed\nrequestAnimationFrame(()=>{if(!imageLoadAbortRef.current&&meshRef.current){renderFrame();// Trigger resize after textures are applied to ensure proper sizing\nif(triggerResizeRef.current&&containerRef.current){triggerResizeRef.current();}}});});});}};img.onerror=()=>{if(!imageLoadAbortRef.current){console.error(\"Texture loading error\");}setTextureLoaded(false);// Still render even if texture fails (will show back color) - only if still mounted\nif(!imageLoadAbortRef.current&&meshRef.current){renderFrame();}};img.src=resolvedImageUrl;},[resolvedImageUrl,backColor,createBackTexture,renderFrame,recreateMeshWithAspectRatio]);// Note: updateBones is called in setTimeout inside loadTexture, so it doesn't need to be a dependency\n// It will be available at runtime when the setTimeout executes\n// ========================================================================\n// BONE ANIMATION (2D Bone Grid with Fold Line)\n// ========================================================================\nconst updateBones=useCallback(()=>{if(!bonesRef.current.length||!meshRef.current||!bonesInitialPositionsRef.current.length)return;// Check if skeleton exists and has valid bones\nif(!meshRef.current.skeleton)return;const skeletonBones=meshRef.current.skeleton.bones;if(!skeletonBones||skeletonBones.length===0)return;// Force computation of world matrices BEFORE modifying bones\n// This prevents \"Cannot read properties of undefined (reading 'matrixWorld')\" errors\n// especially when curlRotation != 0 and bones have quaternion rotations\nmeshRef.current.updateMatrixWorld(true);// Ensure all bones have valid matrices before skeleton update\nskeletonBones.forEach(bone=>{if(bone&&typeof bone.updateMatrixWorld===\"function\"){bone.updateMatrixWorld(true);}});meshRef.current.skeleton.update();const bones=bonesRef.current;const initialPositions=bonesInitialPositionsRef.current;const curlFactor=Math.max(1e-4,animatedCurlRef.current.amount);// Use animated radius value instead of internalRadiusRef\nconst r=mapInteralRadiusToUIValue(animatedCurlRadiusRef.current.radius);const mesh=meshRef.current;// Use BASE geometry dimensions (without scale) for curl calculations\n// This ensures curl appearance stays visually consistent when component is resized\n// The scale is automatically applied through bone positions being children of the scaled mesh\nconst width=mesh.geometry.parameters.width;const height=mesh.geometry.parameters.height;// Use ref to always get current curlRotation value (avoids stale closure issues in Canvas mode)\nconst curlRotationRad=curlRotationRef.current*Math.PI/180;const dirX=Math.cos(curlRotationRad);const dirY=Math.sin(curlRotationRad);const axisX=-dirY;const axisY=dirX;const rotationAxis=new Vector3(axisX,axisY,0).normalize();// Calculate the actual maximum distance along the curl direction\n// For a rectangle, we need to find which corner is furthest along the direction vector\n// The rectangle extends from -halfWidth to +halfWidth in X and -halfHeight to +halfHeight in Y\nconst halfWidth=width/2;const halfHeight=height/2;// Check all 4 corners to find the maximum distance along the curl direction\n// Corner coordinates: (w, h), (w, -h), (-w, h), (-w, -h)\n// Distance along direction (dirX, dirY) = x * dirX + y * dirY\nconst corner1=halfWidth*dirX+halfHeight*dirY// (w, h)\n;const corner2=halfWidth*dirX-halfHeight*dirY// (w, -h)\n;const corner3=-halfWidth*dirX+halfHeight*dirY// (-w, h)\n;const corner4=-halfWidth*dirX-halfHeight*dirY// (-w, -h)\n;// Maximum distance along curl direction (furthest corner in that direction)\nconst maxDistAlongDir=Math.max(corner1,corner2,corner3,corner4);// Keep maxDistFromCenter for radius calculations (uses diagonal for smooth curves)\nconst diagonalLength=Math.sqrt(width*width+height*height);const maxDistFromCenter=diagonalLength/2;// foldOffset: position of the fold line along the 'dir' axis\n// Use animated curlStart value for smooth animations\n// Use maxDistAlongDir to keep fold line within sticker bounds (0 = left/top edge, 1 = right/bottom edge)\nconst animatedStart=animatedCurlStartRef.current.start;const foldOffset=-maxDistAlongDir+animatedStart*2*maxDistAlongDir;const radiusWorld=r*maxDistFromCenter;// RPrime is the current bending radius. As f -> 0, RPrime -> infinity (flat)\nconst RPrime=radiusWorld/curlFactor;const arcLimit=Math.PI*radiusWorld;for(let i=0;i<bones.length;i++){const bone=bones[i];const initialPos=initialPositions[i];const distOnDir=initialPos.x*dirX+initialPos.y*dirY;const signedDist=distOnDir-foldOffset;if(signedDist>0){let xRel,zRel,finalAngle;if(curlMode===\"semicircle\"){// Semicircle: follow arc of radius RPrime for arcLimit distance, then go straight\nconst angle_s=signedDist*curlFactor/radiusWorld;if(signedDist<=arcLimit){xRel=RPrime*Math.sin(angle_s);zRel=RPrime*(1-Math.cos(angle_s));finalAngle=angle_s;}else{const Phi=Math.PI*curlFactor;const xArcEnd=RPrime*Math.sin(Phi);const zArcEnd=RPrime*(1-Math.cos(Phi));const extra=signedDist-arcLimit;// Part past the arc is straight along the tangent at Phi\nxRel=xArcEnd+extra*Math.cos(Phi);zRel=zArcEnd+extra*Math.sin(Phi);finalAngle=Phi;}}else{// Spiral mode: tighten the radius as we wrap\nconst angle_sp=signedDist*curlFactor/radiusWorld;const spiralDecay=.85;const effectiveR=radiusWorld*Math.pow(spiralDecay,angle_sp/Math.PI);const effectiveRPrime=effectiveR/curlFactor;xRel=effectiveRPrime*Math.sin(angle_sp);zRel=effectiveRPrime*(1-Math.cos(angle_sp));finalAngle=angle_sp;}const dx=xRel-signedDist;bone.position.x=initialPos.x+dx*dirX;bone.position.y=initialPos.y+dx*dirY;bone.position.z=initialPos.z+zRel;const quat=new Quaternion;quat.setFromAxisAngle(rotationAxis,-finalAngle);bone.quaternion.copy(quat);}else{bone.position.copy(initialPos);bone.quaternion.identity();}}if(meshRef.current.skeleton){meshRef.current.skeleton.update();}renderFrame();},[curlMode,renderFrame])// curlRotation removed from deps - we use ref instead\n;// Batched bone update - only runs once per frame even if multiple values change\n// This prevents 3x redundant updateBones() calls when all 3 motion values animate together\nconst scheduleBoneUpdate=useCallback(()=>{if(pendingUpdateRef.current)return;// Already scheduled\npendingUpdateRef.current=true;requestAnimationFrame(()=>{pendingUpdateRef.current=false;updateBones();});},[updateBones]);// Set up motion value event listeners to sync with refs and schedule batched update\n// These must be after updateBones is defined\nuseMotionValueEvent(curlAmountMotion,\"change\",latest=>{animatedCurlRef.current.amount=latest;scheduleBoneUpdate();});useMotionValueEvent(curlStartMotion,\"change\",latest=>{animatedCurlStartRef.current.start=latest;scheduleBoneUpdate();});useMotionValueEvent(curlRadiusMotion,\"change\",latest=>{animatedCurlRadiusRef.current.radius=latest;scheduleBoneUpdate();});// ========================================================================\n// HOVER ANIMATION WITH FRAMER MOTION\n// ========================================================================\n// Store animation controls refs to allow cancellation\nconst animationControlsRef=useRef({});// Helper function to build transition config from ControlType.Transition\n// Handles both tween and spring animation types with all their properties\nconst buildTransitionConfig=useCallback((transitionValue,fallbackDuration=animationDuration,defaultEase)=>{const config={...transitionValue?.type&&{type:transitionValue.type}};// For tween animations\nif(!transitionValue?.type||transitionValue.type===\"tween\"){// ControlType.Transition already provides duration in seconds\n// fallbackDuration (animationDuration) is also in seconds\nconst duration=transitionValue?.duration??fallbackDuration;config.duration=duration;if(transitionValue?.ease){config.ease=transitionValue.ease;}else if(defaultEase){config.ease=defaultEase;}if(transitionValue?.delay!==undefined)config.delay=transitionValue.delay;}// For spring animations\nif(transitionValue?.type===\"spring\"){if(transitionValue.stiffness!==undefined)config.stiffness=transitionValue.stiffness;if(transitionValue.damping!==undefined)config.damping=transitionValue.damping;if(transitionValue.mass!==undefined)config.mass=transitionValue.mass;if(transitionValue.bounce!==undefined)config.bounce=transitionValue.bounce;if(transitionValue.restDelta!==undefined)config.restDelta=transitionValue.restDelta;if(transitionValue.restSpeed!==undefined)config.restSpeed=transitionValue.restSpeed;// Spring can also have duration if provided (already in seconds from ControlType.Transition)\nif(transitionValue.duration!==undefined){config.duration=transitionValue.duration;}}return config;},[animationDuration]);// Pointer enter handler: trigger animation forward when mouse enters container\nconst handleMouseEnter=useCallback(()=>{if(!isHoveringRef.current){isHoveringRef.current=true;// Update cursor\nif(containerRef.current){containerRef.current.style.cursor=\"pointer\";}// Stop any existing animations\nif(animationControlsRef.current.curlAmount)animationControlsRef.current.curlAmount.stop();if(animationControlsRef.current.curlStart)animationControlsRef.current.curlStart.stop();if(animationControlsRef.current.curlRadius)animationControlsRef.current.curlRadius.stop();// Build transition config\nconst transitionConfig=buildTransitionConfig(transition);// Animate to end states\nanimationControlsRef.current.curlAmount=animate(curlAmountMotion,animation.curlAmountEnd,transitionConfig);animationControlsRef.current.curlStart=animate(curlStartMotion,animation.curlStartEnd,transitionConfig);animationControlsRef.current.curlRadius=animate(curlRadiusMotion,animation.curlRadiusEnd,transitionConfig);}},[animation,transition,curlAmountMotion,curlStartMotion,curlRadiusMotion,buildTransitionConfig]);// Pointer leave handler: reverse animation when leaving container\nconst handleMouseLeave=useCallback(()=>{if(isHoveringRef.current){isHoveringRef.current=false;// Update cursor\nif(containerRef.current){containerRef.current.style.cursor=\"auto\";}// Stop any existing animations\nif(animationControlsRef.current.curlAmount)animationControlsRef.current.curlAmount.stop();if(animationControlsRef.current.curlStart)animationControlsRef.current.curlStart.stop();if(animationControlsRef.current.curlRadius)animationControlsRef.current.curlRadius.stop();// Build transition config (use easeOut for mouse leave)\nconst transitionConfig=buildTransitionConfig(transition,animationDuration,\"easeOut\");// Animate back to start states\nanimationControlsRef.current.curlAmount=animate(curlAmountMotion,animation.curlAmountStart,transitionConfig);animationControlsRef.current.curlStart=animate(curlStartMotion,animation.curlStartStart,transitionConfig);animationControlsRef.current.curlRadius=animate(curlRadiusMotion,animation.curlRadiusStart,transitionConfig);}},[animation,transition,animationDuration,curlAmountMotion,curlStartMotion,curlRadiusMotion,buildTransitionConfig]);// ========================================================================\n// RESIZE HANDLING\n// ========================================================================\nconst updateSize=useCallback((containerWidth,containerHeight)=>{if(!cameraRef.current||!rendererRef.current||!meshRef.current||!canvasRef.current)return;const dpr=Math.min(window.devicePixelRatio||1,2);// Canvas with small padding for shadows\nconst canvasWidth=containerWidth*CANVAS_SCALE;const canvasHeight=containerHeight*CANVAS_SCALE;// Calculate contained dimensions (maintains image aspect ratio)\nconst contained=calculateContainedDimensions(containerWidth,containerHeight,imageAspectRatioRef.current);const width=contained.width;const height=contained.height;// Update camera\ncameraRef.current.aspect=canvasWidth/canvasHeight;cameraRef.current.fov=calculateCameraFov(canvasWidth,canvasHeight,CAMERA_DISTANCE);cameraRef.current.updateProjectionMatrix();// Update renderer\nrendererRef.current.setSize(Math.round(canvasWidth*dpr),Math.round(canvasHeight*dpr),false);canvasRef.current.style.width=`${canvasWidth}px`;canvasRef.current.style.height=`${canvasHeight}px`;// Always scale the mesh to fit contained dimensions\n// Only recreate if aspect ratio changed significantly (to avoid unnecessary recreation)\nif(meshRef.current){const geometry=meshRef.current.geometry;const baseWidth=geometry.parameters.width;const baseHeight=geometry.parameters.height;// Check if aspect ratio changed significantly (needs recreation)\nconst aspectRatioChanged=imageAspectRatioRef.current&&lastMeshDimensionsRef.current&&Math.abs(lastMeshDimensionsRef.current.width/lastMeshDimensionsRef.current.height-width/height)>.01;if(aspectRatioChanged&&imageAspectRatioRef.current){// Recreate mesh with new aspect ratio\nrecreateMeshWithAspectRatio(imageAspectRatioRef.current);lastMeshDimensionsRef.current={width,height};// Restore curl after mesh recreation\nsetTimeout(()=>{if(meshRef.current&&bonesRef.current.length>0){// Ensure skeleton is initialized before updating bones\nif(meshRef.current.skeleton){meshRef.current.skeleton.update();}updateBones();renderFrame();}},10);}else{// Scale existing mesh to fit contained dimensions\n// This preserves textures and is much faster\nconst scaleX=width/baseWidth;const scaleY=height/baseHeight;meshRef.current.scale.set(scaleX,scaleY,1);// Mesh stays centered at origin (no position offset with 2D grid)\nmeshRef.current.position.set(0,0,0);// Update last dimensions\nlastMeshDimensionsRef.current={width,height};// Update bones to reflect new scale\nupdateBones();renderFrame();}}// Update shadow camera (shadows always enabled)\nif(lightRef.current){// Match shadow camera bounds from setupScene - use canvas dimensions\nconst baseShadowSize=Math.max(canvasWidth,canvasHeight);const shadowCameraSize=Math.max(baseShadowSize,baseShadowSize*(3.5/CANVAS_SCALE)// Or use scaled padding\n);const shadowOffsetX=shadowPositionX*.3;const shadowOffsetY=shadowPositionY*.3;lightRef.current.shadow.camera.left=-shadowCameraSize/2+shadowOffsetX;lightRef.current.shadow.camera.right=shadowCameraSize/2+shadowOffsetX;lightRef.current.shadow.camera.top=shadowCameraSize/2+shadowOffsetY;lightRef.current.shadow.camera.bottom=-shadowCameraSize/2+shadowOffsetY;lightRef.current.shadow.camera.updateProjectionMatrix();}},[recreateMeshWithAspectRatio,updateBones,renderFrame]);// ========================================================================\n// EFFECTS\n// ========================================================================\n// WebGL context loss detection - set up early\nuseEffect(()=>{const canvas=canvasRef.current;if(!canvas)return;const handleContextLost=event=>{event.preventDefault()// Prevent default behavior\n;console.warn(\"WebGL context lost event fired. Too many WebGL contexts active. Try reducing the number of 3D components on the page.\");setContextLost(true);};const handleContextRestored=()=>{console.log(\"WebGL context restored event fired\");setContextLost(false);setSceneReady(false)// Reset before re-initialization\n;// Re-initialize the scene when context is restored\nif(hasContent){const sceneSetup=setupScene();if(sceneSetup&&meshRef.current){if(meshRef.current.skeleton){meshRef.current.skeleton.update();}updateBones();renderFrame();loadTexture();}}};canvas.addEventListener(\"webglcontextlost\",handleContextLost,false);canvas.addEventListener(\"webglcontextrestored\",handleContextRestored,false);return()=>{canvas.removeEventListener(\"webglcontextlost\",handleContextLost);canvas.removeEventListener(\"webglcontextrestored\",handleContextRestored);};},[hasContent,setupScene,updateBones,renderFrame,loadTexture]);// Retry initialization when props change and context was lost\n// This allows the component to recover when user tweaks props\nuseEffect(()=>{if(contextLost&&hasContent){// Prevent rapid retry attempts - only allow once per 2 seconds\nconst now=Date.now();if(now-lastRetryAttemptRef.current<2e3){return;}lastRetryAttemptRef.current=now;console.log(\"Props changed while context lost - attempting to reinitialize...\");// Reset context lost state and scene ready state, then attempt to reinitialize\nsetContextLost(false);setSceneReady(false);imageLoadAbortRef.current=false;// Attempt to recreate the scene with a slight delay to ensure cleanup\nconst retryTimeout=setTimeout(()=>{console.log(\"Retrying scene setup after context loss...\");const sceneSetup=setupScene();if(sceneSetup&&meshRef.current){// Successfully created new context\nconsole.log(\"Successfully recreated WebGL context!\");if(meshRef.current.skeleton){meshRef.current.skeleton.update();}updateBones();renderFrame();loadTexture();}else{console.warn(\"Failed to recreate WebGL context - still unavailable\");}},100);return()=>clearTimeout(retryTimeout);}},[resolvedImageUrl,curlRotation,curlMode,backColor,shadowPositionX,shadowPositionY,castShadowOpacity,animation.curlAmountStart,animation.curlAmountEnd,animation.curlRadiusStart,animation.curlRadiusEnd,animation.curlStartStart,animation.curlStartEnd,animation.show,contextLost,hasContent,setupScene,updateBones,renderFrame,loadTexture]);// Reset aspect ratio when image changes\nuseEffect(()=>{imageAspectRatioRef.current=null;},[resolvedImageUrl]);// Refresh toggle - force complete re-initialization when toggled\nuseEffect(()=>{// Only run when refresh value actually changes (not on initial mount)\nif(previousRefreshRef.current===undefined){previousRefreshRef.current=refresh;return;}// If refresh value hasn't changed, do nothing\nif(previousRefreshRef.current===refresh){return;}// Update the previous value\npreviousRefreshRef.current=refresh;if(!hasContent)return;// Clean up existing scene completely\nif(rendererRef.current){try{rendererRef.current.dispose();}catch(error){// Silently handle disposal errors\n}rendererRef.current=null;}if(sceneRef.current){try{// Remove all children before clearing\nwhile(sceneRef.current.children.length>0){const child=sceneRef.current.children[0];sceneRef.current.remove(child);}sceneRef.current.clear();}catch(error){// Silently handle cleanup errors\n}sceneRef.current=null;}if(meshRef.current){const oldMesh=meshRef.current;if(groupRef.current){groupRef.current.remove(oldMesh);}// Dispose skeleton bones\nif(oldMesh.skeleton){oldMesh.skeleton.bones.forEach(bone=>{if(bone&&bone.parent){bone.parent.remove(bone);}});}if(oldMesh.geometry){oldMesh.geometry.dispose();}if(Array.isArray(oldMesh.material)){oldMesh.material.forEach(mat=>{if(mat.map)mat.map.dispose();mat.dispose();});}meshRef.current=null;}groupRef.current=null;bonesRef.current=[];bonesInitialPositionsRef.current=[];lightRef.current=null;ambientLightRef.current=null;backgroundPlaneRef.current=null;loadedImageRef.current=null;// Reset context lost state and scene ready state\nsetContextLost(false);setSceneReady(false);imageLoadAbortRef.current=false;// Reinitialize scene after a brief delay to ensure cleanup is complete\nsetTimeout(()=>{const sceneSetup=setupScene();if(sceneSetup&&meshRef.current){if(meshRef.current.skeleton){meshRef.current.skeleton.update();}updateBones();renderFrame();loadTexture();}},50);},[refresh,hasContent,setupScene,updateBones,renderFrame,loadTexture]);// Initialize scene\nuseEffect(()=>{if(!hasContent){imageLoadAbortRef.current=true// Mark as aborting\n;setSceneReady(false)// Reset scene ready state\n;if(rendererRef.current){try{rendererRef.current.dispose();}catch(error){// Silently handle disposal errors\n}rendererRef.current=null;}if(sceneRef.current){try{sceneRef.current.clear();}catch(error){// Silently handle cleanup errors\n}sceneRef.current=null;}meshRef.current=null;bonesRef.current=[];bonesInitialPositionsRef.current=[];lightRef.current=null;ambientLightRef.current=null;backgroundPlaneRef.current=null;imageAspectRatioRef.current=null;loadedImageRef.current=null;return;}imageLoadAbortRef.current=false// Reset abort flag when content is available\n;const sceneSetup=setupScene();if(!sceneSetup){// If setupScene returns null, it might be:\n// 1. Container not ready (retry)\n// 2. WebGL context failed (contextLost already set in setupScene)\n// Try again after a short delay\nconst retryTimeout=setTimeout(()=>{const retrySetup=setupScene();if(retrySetup&&meshRef.current){// Initialize skeleton and bones immediately\nif(meshRef.current.skeleton){meshRef.current.skeleton.update();}updateBones();// Render immediately to show mesh (even without texture)\nrenderFrame();// Load texture asynchronously\nloadTexture();}else if(!retrySetup){// Retry failed - if contextLost isn't already set, this might be a context issue\nconsole.warn(\"Scene setup failed on retry - context may be unavailable\");}},100);return()=>clearTimeout(retryTimeout);}// Initialize immediately - no setTimeout delays\nif(meshRef.current){// Initialize skeleton and bones\nif(meshRef.current.skeleton){meshRef.current.skeleton.update();}updateBones();// Render immediately to show mesh (even without texture - will show back color)\nrenderFrame();// Load texture asynchronously - it will trigger another render when done\nloadTexture();// Trigger initial resize to ensure proper sizing\n// This ensures component is responsive from the start\nrequestAnimationFrame(()=>{if(!imageLoadAbortRef.current&&triggerResizeRef.current&&containerRef.current){triggerResizeRef.current();}});}return()=>{if(animationFrameRef.current){cancelAnimationFrame(animationFrameRef.current);animationFrameRef.current=null;}// Reset scene ready state\nsetSceneReady(false);// Dispose mesh and all its resources\nif(meshRef.current){const oldMesh=meshRef.current;// Remove from scene and group\nif(groupRef.current){groupRef.current.remove(oldMesh);}if(sceneRef.current){sceneRef.current.remove(oldMesh);}// Dispose geometry\nif(oldMesh.geometry){oldMesh.geometry.dispose();}// Dispose materials and textures\nif(Array.isArray(oldMesh.material)){oldMesh.material.forEach(mat=>{if(mat.map)mat.map.dispose();mat.dispose();});}else if(oldMesh.material){if(oldMesh.material.map){oldMesh.material.map.dispose();}oldMesh.material.dispose();}// Clear skeleton bones\nif(oldMesh.skeleton){oldMesh.skeleton.bones.forEach(bone=>{if(bone&&bone.parent){bone.parent.remove(bone);}});}meshRef.current=null;}// Clear bones refs\nbonesRef.current=[];bonesInitialPositionsRef.current=[];groupRef.current=null;// Dispose renderer (this also disposes of its WebGL context)\nif(rendererRef.current){try{rendererRef.current.dispose();}catch(error){// Silently handle disposal errors\n}rendererRef.current=null;}// Clear scene\nif(sceneRef.current){try{// Remove all remaining objects\nwhile(sceneRef.current.children.length>0){const child=sceneRef.current.children[0];sceneRef.current.remove(child);// Dispose if it has dispose method\nif(child.dispose&&typeof child.dispose===\"function\"){child.dispose();}}sceneRef.current.clear();}catch(error){// Silently handle cleanup errors\n}sceneRef.current=null;}// Clear refs\ncameraRef.current=null;lightRef.current=null;ambientLightRef.current=null;backgroundPlaneRef.current=null;loadedImageRef.current=null;imageAspectRatioRef.current=null;// Stop any running animations\nif(animationControlsRef.current.curlAmount)animationControlsRef.current.curlAmount.stop();if(animationControlsRef.current.curlStart)animationControlsRef.current.curlStart.stop();if(animationControlsRef.current.curlRadius)animationControlsRef.current.curlRadius.stop();animationControlsRef.current={};// Mark image loading as aborted to prevent callbacks from running after unmount\nimageLoadAbortRef.current=true;};},[hasContent,setupScene,loadTexture,updateBones,renderFrame]);// Sync animated refs with animation prop changes (only when not hovering)\nuseEffect(()=>{// Only update if not currently animating (not hovering)\nif(!isHoveringRef.current){// In Canvas mode, respect the show prop to determine which state to display\n// In preview/live mode, always use start values\nconst shouldShowFinal=isCanvas&&animation.show===\"final\";const targetCurlAmount=shouldShowFinal?animation.curlAmountEnd:animation.curlAmountStart;const targetCurlStart=shouldShowFinal?animation.curlStartEnd:animation.curlStartStart;const targetCurlRadius=shouldShowFinal?animation.curlRadiusEnd:animation.curlRadiusStart;// Set motion values directly (no animation when props change)\n// Note: .set() doesn't trigger useMotionValueEvent, so we update refs manually\ncurlAmountMotion.set(targetCurlAmount);curlStartMotion.set(targetCurlStart);curlRadiusMotion.set(targetCurlRadius);// Update refs directly and call updateBones\nanimatedCurlRef.current.amount=targetCurlAmount;animatedCurlStartRef.current.start=targetCurlStart;animatedCurlRadiusRef.current.radius=targetCurlRadius;updateBones();}},[animation,isCanvas,curlAmountMotion,curlStartMotion,curlRadiusMotion,updateBones]);// Update bones when curlMode changes\n// Note: curlAmount and curlStart are handled by GSAP animations via animated refs\nuseEffect(()=>{updateBones();},[curlMode,updateBones]);// Update bones when curlRotation changes (fold line direction)\nuseEffect(()=>{// Update ref immediately so updateBones always uses current value\ncurlRotationRef.current=curlRotation;if(!meshRef.current||!bonesRef.current.length)return;updateBones();// In Canvas mode, explicitly render to ensure the change is visible\nif(isCanvas&&rendererRef.current&&sceneRef.current&&cameraRef.current){renderFrame();}},[curlRotation,updateBones,isCanvas,renderFrame]);// Update back color - recreate back texture when backColor changes\nuseEffect(()=>{if(!meshRef.current?.material||!loadedImageRef.current)return;const img=loadedImageRef.current;const materials=meshRef.current.material;if(!Array.isArray(materials))return;// Check if backColor is fully transparent (0% opacity)\nconst resolvedBackColor=resolveTokenColor(backColor);const backColorRgba=parseColorToRgba(resolvedBackColor);// Get front texture to reuse if backColor is fully transparent\nconst frontTexture=materials[4]?.map;// If backColor is fully transparent, use front texture directly\n// Otherwise, create blended back texture\nconst rawBackTexture=backColorRgba.a<=0&&frontTexture?frontTexture:createBackTexture(img,backColor);const backTexture=makeBackTextureViewConsistent(rawBackTexture,frontTexture);if(materials[5]){// Only dispose if it's a different texture (not the front texture)\nif(materials[5].map&&materials[5].map!==frontTexture&&materials[5].map!==backTexture){materials[5].map.dispose();}// With shadows: use texture (MeshStandardMaterial)\nif(backTexture){materials[5].map=backTexture;materials[5].transparent=true;materials[5].alphaTest=.01;// When using front texture (0% opacity), match front material properties more closely\nif(backColorRgba.a<=0&&materials[5].emissiveIntensity!==undefined){// Match front material emissive for identical appearance\nmaterials[5].emissiveIntensity=materials[4]?.emissiveIntensity??.8;materials[5].emissive=materials[4]?.emissive??new Color(16777215);}}materials[5].needsUpdate=true;}// Update side faces (border) to use front face texture - blends with front image, not background\nfor(let i=0;i<4;i++){if(materials[i]){// Use front face texture so border blends with front image\nif(frontTexture){materials[i].map=frontTexture;materials[i].transparent=true;materials[i].alphaTest=.01;// Match front material properties if using MeshStandardMaterial\nif(materials[i].emissiveIntensity!==undefined&&materials[4]?.emissiveIntensity!==undefined){materials[i].emissiveMap=frontTexture;materials[i].emissive=materials[4].emissive||new Color(16777215);materials[i].emissiveIntensity=materials[4].emissiveIntensity||.8;}}else{// No texture yet - use back color as fallback\nmaterials[i].map=null;materials[i].color.setRGB(backColorRgba.r,backColorRgba.g,backColorRgba.b);materials[i].transparent=true;materials[i].opacity=1;}materials[i].needsUpdate=true;}}renderFrame();},[backColor,createBackTexture,renderFrame]);// Update shadow position when settings change (debounced to prevent lag)\nuseEffect(()=>{// Debounce shadow position updates to improve performance when dragging sliders\nconst timeoutId=setTimeout(()=>{if(!lightRef.current||!containerRef.current)return;lightRef.current.position.set(shadowPositionX,shadowPositionY,400);lightRef.current.shadow.mapSize.width=4096;lightRef.current.shadow.mapSize.height=4096;lightRef.current.shadow.bias=-1e-5;lightRef.current.shadow.radius=8;// Update shadow camera bounds to account for new light position (use canvas dimensions)\nconst container=containerRef.current;const containerWidth=container.clientWidth||container.offsetWidth||1;const containerHeight=container.clientHeight||container.offsetHeight||1;const canvasWidth=containerWidth*CANVAS_SCALE;const canvasHeight=containerHeight*CANVAS_SCALE;const baseShadowSize=Math.max(canvasWidth,canvasHeight);const shadowCameraSize=Math.max(baseShadowSize,baseShadowSize*(3.5/CANVAS_SCALE)// Or use scaled padding\n);const shadowOffsetX=shadowPositionX*.3;const shadowOffsetY=shadowPositionY*.3;lightRef.current.shadow.camera.left=-shadowCameraSize/2+shadowOffsetX;lightRef.current.shadow.camera.right=shadowCameraSize/2+shadowOffsetX;lightRef.current.shadow.camera.top=shadowCameraSize/2+shadowOffsetY;lightRef.current.shadow.camera.bottom=-shadowCameraSize/2+shadowOffsetY;lightRef.current.shadow.camera.updateProjectionMatrix();lightRef.current.shadow.needsUpdate=true;renderFrame();},50)// 50ms debounce to prevent lag when dragging sliders\n;return()=>clearTimeout(timeoutId);},[shadowPositionX,shadowPositionY,renderFrame]);// Update shadow intensity (darkness) - hardcoded to 1\nuseEffect(()=>{if(!lightRef.current||!ambientLightRef.current)return;// Shadow darkness is controlled by the ratio of directional to ambient light\n// shadowIntensity = 1 (hardcoded), make shadows very dramatic\nconst shadowIntensity=1// Hardcoded\n;// Directional light: 0.3 to 2.0 (more dramatic at max)\nconst adjustedLightIntensity=.3+shadowIntensity*1.7;lightRef.current.intensity=adjustedLightIntensity;// Ambient light: 1.0 to 0.4 (lower at max for dramatic shadows)\nconst adjustedAmbientIntensity=1-shadowIntensity*.6;ambientLightRef.current.intensity=Math.max(adjustedAmbientIntensity,.4);renderFrame();},[renderFrame]);// Update cast shadow opacity when it changes (debounced to prevent lag)\nuseEffect(()=>{// Debounce shadow opacity updates to improve performance when dragging sliders\nconst timeoutId=setTimeout(()=>{if(!backgroundPlaneRef.current||!containerRef.current)return;const material=backgroundPlaneRef.current.material;// ShadowMaterial: adjust opacity based on castShadowOpacity\nmaterial.opacity=castShadowOpacity;material.needsUpdate=true;// Update plane size to match shadow camera bounds (use canvas dimensions)\nconst container=containerRef.current;const containerWidth=container.clientWidth||container.offsetWidth||1;const containerHeight=container.clientHeight||container.offsetHeight||1;const canvasWidth=containerWidth*CANVAS_SCALE;const canvasHeight=containerHeight*CANVAS_SCALE;const baseShadowSize=Math.max(canvasWidth,canvasHeight);const planeSize=Math.max(baseShadowSize,baseShadowSize*(3.5/CANVAS_SCALE)// Or use scaled padding to match shadow camera\n);// Dispose old geometry and create new one with updated size\nconst oldGeometry=backgroundPlaneRef.current.geometry;const newGeometry=new PlaneGeometry(planeSize,planeSize);backgroundPlaneRef.current.geometry=newGeometry;oldGeometry.dispose();renderFrame();},50)// 50ms debounce to prevent lag when dragging sliders\n;return()=>clearTimeout(timeoutId);},[castShadowOpacity,renderFrame]);// Size monitoring - optimized for Framer canvas\n// Re-run when image changes to ensure responsiveness\nuseEffect(()=>{const container=containerRef.current;if(!container)return;const handleResize=()=>{const width=container.clientWidth||container.offsetWidth||1;const height=container.clientHeight||container.offsetHeight||1;// For preview/live mode, always update if dimensions are valid\n// For canvas mode, only update if scene is initialized\nif(width>0&&height>0){const last=lastSizeRef.current;const sizeChanged=Math.abs(width-last.width)>.5||Math.abs(height-last.height)>.5;if(sizeChanged||!last.width||!last.height){// In preview/live mode, update immediately\n// In canvas mode, only update if scene is ready\nif(!isCanvas||rendererRef.current&&cameraRef.current&&meshRef.current){last.width=width;last.height=height;updateSize(width,height);renderFrame();}}}};// Store handleResize in ref so it can be called from image load callback\ntriggerResizeRef.current=handleResize;// Initial resize - delay to ensure scene is set up\n// In preview mode, the scene might not be ready immediately\n// Use multiple attempts to catch when container gets dimensions\nlet attemptCount=0;const maxAttempts=10;const attemptResize=()=>{if(attemptCount<maxAttempts){attemptCount++;handleResize();// If scene isn't ready yet, try again\nif(!rendererRef.current||!sceneRef.current){setTimeout(attemptResize,isCanvas?50:100);}}};// Trigger immediately, then also schedule delayed attempts\nhandleResize();const initialResizeTimeout=setTimeout(attemptResize,isCanvas?0:50);// Use requestAnimationFrame-based monitoring for canvas mode (like interactive-thermal3.tsx)\nconst resizeCleanup=isCanvas?(()=>{let rafId=0;const TICK_MS=250;const EPS_ASPECT=.001;const tick=now=>{if(!container)return;const probe=zoomProbeRef.current;if(!probe){rafId=requestAnimationFrame(tick);return;}const cw=container.clientWidth||container.offsetWidth||1;const ch=container.clientHeight||container.offsetHeight||1;const aspect=cw/ch;const zoom=probe.getBoundingClientRect().width/20;const timeOk=!lastSizeRef.current.ts||(now||performance.now())-lastSizeRef.current.ts>=TICK_MS;const aspectChanged=Math.abs(aspect-lastSizeRef.current.aspect)>EPS_ASPECT;const sizeChanged=Math.abs(cw-lastSizeRef.current.width)>1||Math.abs(ch-lastSizeRef.current.height)>1;if(timeOk&&(aspectChanged||sizeChanged)){// Only update lastSizeRef if scene is ready (canvas mode requirement)\nif(rendererRef.current&&cameraRef.current&&meshRef.current){lastSizeRef.current={width:cw,height:ch,aspect,zoom,ts:now||performance.now()};updateSize(cw,ch);renderFrame();}}rafId=requestAnimationFrame(tick);};rafId=requestAnimationFrame(tick);return()=>cancelAnimationFrame(rafId);})():(()=>{// For preview/published mode, use ResizeObserver + window resize\nconst resizeObserver=new ResizeObserver(handleResize);resizeObserver.observe(container);window.addEventListener(\"resize\",handleResize);return()=>{resizeObserver.disconnect();window.removeEventListener(\"resize\",handleResize);};})();return()=>{clearTimeout(initialResizeTimeout);resizeCleanup();triggerResizeRef.current=null;};},[updateSize,renderFrame,isCanvas,hasContent,resolvedImageUrl]);// Periodic check for context loss (in case event doesn't fire)\n// IMPORTANT: Must be before any conditional returns to follow React's rules of hooks\nuseEffect(()=>{if(!hasContent||contextLost)return;let checkCount=0;const maxFastChecks=5// First 5 checks are faster\n;const checkContext=()=>{if(rendererRef.current){const gl=rendererRef.current.getContext();if(!gl||gl.isContextLost()){console.warn(\"Detected context loss via periodic check\");setContextLost(true);}}checkCount++;};// Start with faster checks (every 500ms for first 2.5 seconds)\n// Then slow down to every 3 seconds\nconst fastInterval=setInterval(()=>{if(checkCount>=maxFastChecks){clearInterval(fastInterval);}else{checkContext();}},500);const slowInterval=setInterval(()=>{if(checkCount>=maxFastChecks){checkContext();}},3e3);return()=>{clearInterval(fastInterval);clearInterval(slowInterval);};},[hasContent,contextLost]);// If we have content but no scene after a delay, assume context loss\n// IMPORTANT: Must be before any conditional returns to follow React's rules of hooks\nuseEffect(()=>{if(!hasContent||contextLost||sceneReady)return;// After 2 seconds, if still no scene, assume WebGL context issue\nconst checkTimeout=setTimeout(()=>{if(!sceneRef.current&&!contextLost){console.warn(\"Scene failed to initialize after 2 seconds - assuming WebGL context unavailable\");setContextLost(true);}},2e3);return()=>clearTimeout(checkTimeout);},[hasContent,contextLost,sceneReady]);// ========================================================================\n// RENDER\n// ========================================================================\nif(!hasContent){return /*#__PURE__*/_jsx(ComponentMessage,{style:{position:\"relative\",width:\"100%\",height:\"100%\",minWidth:0,minHeight:0},title:\"3D Sticker\",subtitle:\"Add an image to see the sticker effect\"});}// Show error message when WebGL context is lost\nif(contextLost){return /*#__PURE__*/_jsx(ComponentMessage,{title:\"⚠️ Don't worry, this is normal.\",subtitle:\"There are currently more stickers in Canvas than Browsers can handle. Tweak Refresh to see the sticker re-appear. If you don't add too many stickers, you won't have issues in preview or deployed website.\"});}// Calculate offset to center the larger canvas within the container\n// This gives extra space for shadows while keeping the sticker centered\nconst offsetPercent=(CANVAS_SCALE-1)/2*100;return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,onPointerEnter:handleMouseEnter,onPointerLeave:handleMouseLeave,style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"visible\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",margin:0,padding:0,borderRadius:borderRadius,backgroundColor:backgroundColor?backgroundColor:\"transparent\"},children:[/*#__PURE__*/_jsx(\"div\",{ref:zoomProbeRef,style:{position:\"absolute\",width:20,height:20,opacity:0,pointerEvents:\"none\"}}),/*#__PURE__*/_jsx(\"canvas\",{ref:canvasRef,style:{position:\"absolute\",top:`-${offsetPercent}%`,left:`-${offsetPercent}%`,// In canvas mode, use explicit dimensions for better responsiveness\n// In preview/live mode, let JavaScript set dimensions\n...isCanvas?{width:`${CANVAS_SCALE*100}%`,height:`${CANVAS_SCALE*100}%`}:{},display:\"block\",pointerEvents:\"none\",cursor:\"auto\",opacity:sceneReady?1:0}})]});}// ============================================================================\n// PROPERTY CONTROLS\n// ============================================================================\naddPropertyControls(Sticker,{refresh:{type:ControlType.Boolean,title:\"Refresh\",defaultValue:false,enabledTitle:\"•\",disabledTitle:\"•\",description:\"Toggle if the sticker is showing an error to see it again\"},image:{type:ControlType.ResponsiveImage,title:\"Image\"},curlMode:{type:ControlType.Enum,title:\"Mode\",options:[\"semicircle\",\"spiral\"],optionTitles:[\"Semicircle\",\"Spiral\"],defaultValue:\"spiral\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},animation:{type:ControlType.Object,title:\"Animation\",controls:{show:{type:ControlType.Enum,title:\"Show\",options:[\"initial\",\"final\"],optionTitles:[\"Initial\",\"Final\"],defaultValue:\"final\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\",description:\"The state to show in the canvas\"},curlAmountStart:{type:ControlType.Number,title:\"Curl Start\",min:0,max:1,step:.05,defaultValue:.45},curlRadiusStart:{type:ControlType.Number,title:\"Radius Start\",min:0,max:1,step:.05,defaultValue:.15},curlStartStart:{type:ControlType.Number,title:\"Start Start\",min:0,max:1,step:.05,defaultValue:.8},curlAmountEnd:{type:ControlType.Number,title:\"Curl Final\",min:0,max:1,step:.05,defaultValue:.45},curlRadiusEnd:{type:ControlType.Number,title:\"Radius Final\",min:0,max:1,step:.05,defaultValue:.15},curlStartEnd:{type:ControlType.Number,title:\"Start Final\",min:0,max:1,step:.05,defaultValue:.55}}},curlRotation:{type:ControlType.Number,title:\"Direction\",min:0,max:360,step:15,defaultValue:315,unit:\"\\xb0\"},shadowPositionX:{type:ControlType.Number,title:\"Light X\",min:-500,max:500,step:10,defaultValue:-400},shadowPositionY:{type:ControlType.Number,title:\"Light Y\",min:-500,max:500,step:10,defaultValue:0},castShadowOpacity:{type:ControlType.Number,title:\"Shadow\",min:0,max:1,step:.05,defaultValue:.3},shadowBgColor:{type:ControlType.Color,title:\"Shadow Bg\",defaultValue:\"rgba(0, 0, 0, 0)\",hidden:()=>true},backColor:{type:ControlType.Color,title:\"Back Color\",defaultValue:\"rgba(255, 255, 255, 1)\"},borderRadius:{//@ts-ignore - BorderRadius exists in the latest versions of Framer\ntype:ControlType.BorderRadius,defaultValue:\"0px\",title:\"Radius\"},backgroundColor:{type:ControlType.Color,title:\"Background\",optional:true},transition:{type:ControlType.Transition,title:\"Transition\",defaultValue:{type:\"tween\",duration:.6,ease:\"easeInOut\"},description:\"More components at [Framer University](https://frameruni.link/cc).\"}});// ============================================================================\n// DISPLAY NAME\n// ============================================================================\nSticker.displayName=\"Sticker Peeling\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Sticker\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"400\",\"framerDisableUnlink\":\"\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Sticker_prod.map"],"mappings":"ihBAcA,SAAS,GAAmB,EAAM,EAAO,EAAS,CAAC,IAAM,EAAO,EAAM,EAAO,MAAO,GAAE,KAAK,KAAK,EAAM,GAAQ,EAAE,EAAS,GAAG,IAAI,KAAK,GAAI,CAAC,SAAS,EAAU,EAAM,EAAM,EAAM,EAAO,EAAO,CAAoE,OAAhE,IAAQ,EAAa,EAAkD,GAAlC,EAAM,IAAQ,EAAM,IAAwB,EAAO,EAAQ,CAAC,SAAS,GAA0B,EAAG,CAA2C,OAAO,EAAnC,KAAK,IAAI,GAAG,KAAK,IAAI,EAAE,CAAE,CAA0B,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAE,CAG7Z,SAAS,GAA6B,EAAe,EAAgB,EAAiB,CAGzF,OAFI,EAA6F,EAAe,EAAmC,EAC7I,CAAC,MAAM,EAAgB,EA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