{"version":3,"file":"Gradient.CjMMe_hT.mjs","names":["useState","useRef","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","te","window","_e","de","init_jsx_runtime","p","ce","motion","useMotionValue","useSpring","init_framer_motion_DhsWWWsN","addPropertyControls","ControlType","init_framer_CaDWdxiz","getPastelPair","PASTEL_PALETTE","i","recalcMetrics","shortSide","w","h","pad","parallaxStrength","blurStrength","FramerGradient","propWidth","propHeight","props","width","style","height","currentGradientIndex","setCurrentGradientIndex","startIndex","colors","setColors","metrics","setMetrics","isAtEdgeRef","rafRef","containerRef","innerOffsetX","innerOffsetY","innerOffsetXSpring","springStiffness","springDamping","innerOffsetYSpring","handlePointerMove","rect","relativeX","relativeY","cx","cy","dx","dy","isAtLeftEdge","edgeThreshold","isAtRightEdge","isAtTopEdge","isAtBottomEdge","isAtAnyEdge","nextIndex","normalizedDx","normalizedDy","colorDuration","WHITE","init_Gradient"],"sources":["https:/framerusercontent.com/modules/cwZsi7XBAcXbQamrwj9J/klW5ltHxzYSN9C3xoOIw/Gradient.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{motion,useMotionValue,useSpring}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";// Пастельная палитра Toloka\nconst PASTEL_PALETTE=[\"#FFF7CC\",\"#E0FFCC\",\"#CEF0FD\",\"#E0D7F4\",\"#FBD0EB\",\"#FFCDCC\",\"#FFE9CC\"];const WHITE=\"#FFFFFF\";function getPastelPair(i){const outer=PASTEL_PALETTE[i%7];const inner=PASTEL_PALETTE[(i+2)%7];return{outer,inner};}function recalcMetrics(w,h,parallaxStrength,blurStrength){const shortSide=Math.min(w,h);const pad=shortSide/8;const innerPad=pad;const maxShift=shortSide*parallaxStrength;const blurPx=shortSide/blurStrength;return{shortSide,pad,innerPad,maxShift,blurPx};}/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function FramerGradient(props){const{width:propWidth,height:propHeight,startIndex=1,parallaxStrength=.35,colorDuration=1.5,edgeThreshold=100,blurStrength=3,springStiffness=150,springDamping=25,style}=props;// Get dimensions from style prop if available (for responsive sizing)\nconst width=style?.width===\"100%\"?800:propWidth??800;const height=style?.height===\"100%\"?600:propHeight??600;// Состояния\nconst[currentGradientIndex,setCurrentGradientIndex]=useState(startIndex);const[colors,setColors]=useState(()=>getPastelPair(startIndex));const[metrics,setMetrics]=useState(()=>recalcMetrics(width,height,parallaxStrength,blurStrength));// Refs\nconst isAtEdgeRef=useRef(false);const rafRef=useRef(null);const containerRef=useRef(null);// Параллакс\nconst innerOffsetX=useMotionValue(0);const innerOffsetY=useMotionValue(0);const innerOffsetXSpring=useSpring(innerOffsetX,{stiffness:springStiffness,damping:springDamping});const innerOffsetYSpring=useSpring(innerOffsetY,{stiffness:springStiffness,damping:springDamping});// Пересчёт метрик при изменении размеров\nuseEffect(()=>{setMetrics(recalcMetrics(width,height,parallaxStrength,blurStrength));},[width,height,parallaxStrength,blurStrength]);// Обработчик движения курсора\nuseEffect(()=>{const handlePointerMove=e=>{if(rafRef.current!==null)return;rafRef.current=requestAnimationFrame(()=>{const rect=containerRef.current?.getBoundingClientRect();if(!rect){rafRef.current=null;return;}// Координаты относительно контейнера\nconst relativeX=e.clientX-rect.left;const relativeY=e.clientY-rect.top;// Центр контейнера\nconst cx=width/2;const cy=height/2;const dx=relativeX-cx;const dy=relativeY-cy;// Проверка края\nconst isAtLeftEdge=relativeX<edgeThreshold;const isAtRightEdge=relativeX>width-edgeThreshold;const isAtTopEdge=relativeY<edgeThreshold;const isAtBottomEdge=relativeY>height-edgeThreshold;const isAtAnyEdge=isAtLeftEdge||isAtRightEdge||isAtTopEdge||isAtBottomEdge;// Смена градиента при касании края\nif(isAtAnyEdge&&!isAtEdgeRef.current){isAtEdgeRef.current=true;const nextIndex=(currentGradientIndex+1)%7;startTransition(()=>{setCurrentGradientIndex(nextIndex);setColors(getPastelPair(nextIndex));});}else if(!isAtAnyEdge&&isAtEdgeRef.current){isAtEdgeRef.current=false;}// Параллакс\nconst normalizedDx=dx/metrics.shortSide*metrics.maxShift;const normalizedDy=dy/metrics.shortSide*metrics.maxShift;innerOffsetX.set(normalizedDx);innerOffsetY.set(normalizedDy);rafRef.current=null;});};if(typeof window!==\"undefined\"){window.addEventListener(\"pointermove\",handlePointerMove);}return()=>{if(typeof window!==\"undefined\"){window.removeEventListener(\"pointermove\",handlePointerMove);}if(rafRef.current!==null){cancelAnimationFrame(rafRef.current);}};},[currentGradientIndex,metrics,width,height,edgeThreshold,innerOffsetX,innerOffsetY]);return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(motion.div,{style:{position:\"absolute\",inset:0},initial:{backgroundColor:colors.outer},animate:{backgroundColor:colors.outer},transition:{duration:colorDuration,ease:\"easeInOut\"}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",backgroundColor:WHITE,top:metrics.pad,left:metrics.pad,right:metrics.pad,bottom:metrics.pad}}),/*#__PURE__*/_jsx(motion.div,{style:{position:\"absolute\",top:metrics.pad+metrics.innerPad,left:metrics.pad+metrics.innerPad,right:metrics.pad+metrics.innerPad,bottom:metrics.pad+metrics.innerPad,x:innerOffsetXSpring,y:innerOffsetYSpring},initial:{backgroundColor:colors.inner},animate:{backgroundColor:colors.inner},transition:{duration:colorDuration,ease:\"easeInOut\"}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,backgroundColor:\"rgba(255, 255, 255, 0.01)\",backdropFilter:`blur(${metrics.blurPx}px)`,WebkitBackdropFilter:`blur(${metrics.blurPx}px)`,pointerEvents:\"none\"}})]});}// Property Controls для Framer\naddPropertyControls(FramerGradient,{startIndex:{type:ControlType.Enum,title:\"Начальный градиент\",options:[0,1,2,3,4,5,6],optionTitles:[\"Yellow + Blue\",\"Green + Violet\",\"Blue + Magenta\",\"Violet + Red\",\"Magenta + Orange\",\"Red + Yellow\",\"Orange + Green\"],defaultValue:1},parallaxStrength:{type:ControlType.Number,title:\"Сила параллакса\",min:0,max:.5,step:.05,defaultValue:.35,displayStepper:true},colorDuration:{type:ControlType.Number,title:\"Скорость смены цветов\",min:.3,max:5,step:.1,defaultValue:1.5,unit:\"s\",displayStepper:true},edgeThreshold:{type:ControlType.Number,title:\"Чувствительность края\",min:10,max:300,step:10,defaultValue:100,unit:\"px\",displayStepper:true},blurStrength:{type:ControlType.Number,title:\"Сила blur (делитель)\",min:1,max:10,step:.5,defaultValue:3,displayStepper:true},springStiffness:{type:ControlType.Number,title:\"Скорость spring\",min:20,max:300,step:10,defaultValue:150,displayStepper:true},springDamping:{type:ControlType.Number,title:\"Затухание spring\",min:10,max:50,step:5,defaultValue:25,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FramerGradient\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Gradient.map"],"mappings":"A,qRACmH,SAASmB,EAAc,EAAE,CAAqE,MAAM,CAAC,MAA/DC,EAAeC,EAAE,GAAoD,MAArCD,GAAgBC,EAAE,GAAG,EAAqB,CAAE,CAAC,SAASC,EAAc,EAAE,EAAE,EAAiB,EAAa,CAAC,IAAMC,EAAU,KAAK,IAAIC,EAAEC,CAAC,EAAQC,EAAIH,EAAU,EAAmG,MAAM,CAAC,YAAU,MAAI,SAAAG,EAAS,SAA7FH,EAAUI,EAA4F,OAA9DJ,EAAUK,CAA0D,CAAE,CAGje,SAAwBC,EAAe,EAAM,CAAC,GAAK,CAAC,MAAMC,EAAU,OAAOC,EAAW,aAAW,EAAE,mBAAiB,IAAI,gBAAc,IAAI,gBAAc,IAAI,eAAa,EAAE,kBAAgB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