"use strict";(self.webpackChunkscreenity=self.webpackChunkscreenity||[]).push([[507],{507(t,e,r){r.r(e),r.d(e,{default:()=>s});var o=r(6540),i=r(2316),n=(r(7296),r(543)),h=r(4848);const s=()=>{const[t,e]=(0,o.useContext)(n.U),[r,s]=(0,o.useState)(null),d=(0,o.useRef)(null),a=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{d.current&&d.current.getCoordinates()&&(t.fromCropper||(a.current=!0,d.current.setCoordinates({top:t.top,left:t.left,width:t.width,height:t.height}),a.current=!1,t.top!=d.current.getCoordinates().top&&e(t=>({...t,top:d.current.getCoordinates().top})),t.left!=d.current.getCoordinates().left&&e(t=>({...t,left:d.current.getCoordinates().left})),t.width!=d.current.getCoordinates().width&&e(t=>({...t,width:d.current.getCoordinates().width})),t.height!=d.current.getCoordinates().height&&e(t=>({...t,height:d.current.getCoordinates().height}))))},[t.width,t.height,t.top,t.left]),(0,o.useEffect)(()=>{t.blob&&s(t.frame)},[t.frame]),(0,h.jsx)("div",{children:(0,h.jsx)(i.IOb,{src:r,ref:d,onChange:t=>{t&&(a.current||e(e=>({...e,top:t.getCoordinates().top,left:t.getCoordinates().left,width:t.getCoordinates().width,height:t.getCoordinates().height,fromCropper:!0})))},className:"cropper",stencilProps:{grid:!0},defaultSize:{width:t.width||void 0,height:t.height||void 0},backgroundWrapperClassName:"CropperBackgroundWrapper",width:t.width,height:t.height,transitions:!1,style:{transition:"none"}})})}}}]);