{"version":3,"file":"ClientLogo.DPUQLSTB.mjs","names":["useRef","useState","useLayoutEffect","useEffect"],"sources":["https:/framerusercontent.com/modules/eq6OQcj650gO6VocYeZI/RhdaXgyQQGbNpMLYLNpm/ClientLogo.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useLayoutEffect,useRef,useState}from\"react\";const srcOf=p=>typeof p===\"string\"?p:p?.src||\"\";const altOf=p=>typeof p===\"string\"?\"\":p?.alt||\"\";const useIso=typeof window!==\"undefined\"?useLayoutEffect:useEffect;/**\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 60\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function ClientLogo(props){const{logo,size=56,align=\"left\"}=props;const root=useRef(null);const[ar,setAr]=useState(4);const[room,setRoom]=useState(0);const src=srcOf(logo);useEffect(()=>{if(!src)return;let dead=false;const im=new Image;im.onload=()=>{if(!dead&&im.naturalWidth&&im.naturalHeight)setAr(im.naturalWidth/im.naturalHeight);};im.src=src;return()=>{dead=true;};},[src]);useIso(()=>{const el=root.current;if(!el)return;const measure=()=>setRoom(el.clientWidth);measure();const ro=new ResizeObserver(measure);ro.observe(el);return()=>ro.disconnect();},[]);// the area of a 4:1 logo `size` tall, shared by every shape\nlet h=Math.sqrt(4*size*size/ar);let w=h*ar;if(room&&w>room){w=room;h=w/ar;}return /*#__PURE__*/_jsx(\"div\",{ref:root,style:{width:\"100%\",display:\"flex\",justifyContent:align===\"right\"?\"flex-end\":align===\"center\"?\"center\":\"flex-start\"},children:src?/*#__PURE__*/_jsx(\"img\",{src:src,alt:altOf(logo),draggable:false,style:{display:\"block\",width:Math.round(w),height:Math.round(h),objectFit:\"contain\",pointerEvents:\"none\"}}):/*#__PURE__*/_jsx(\"div\",{style:{height:size,width:size*4,border:\"1px dashed rgba(255,255,255,.3)\"}})});}addPropertyControls(ClientLogo,{logo:{type:ControlType.ResponsiveImage,title:\"Logo\",description:\"The client's logo (an SVG works best). Connected to the Logo field in the CMS.\"},size:{type:ControlType.Number,title:\"Size\",min:16,max:200,step:2,defaultValue:56,unit:\"px\",description:\"How big logos are. Sized by area so wide and tall logos look equally heavy: this is the height a typical wide (4:1) logo gets.\"},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Centre\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ClientLogo\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"60\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"300\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ClientLogo.map"],"mappings":"mMAKG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,GAAG,QAAM,QAAQ,EAAY,EAAKA,EAAO,IAAI,EAAO,CAAC,EAAG,GAAOC,EAAS,CAAC,EAAO,CAAC,EAAK,GAASA,EAAS,CAAC,EAAQ,EAAI,EAAM,CAAI,EAAE,MAAc,CAAC,GAAG,CAAC,EAAI,OAAO,IAAI,EAAK,GAAY,EAAG,IAAI,MAAsH,MAAhH,GAAG,WAAW,CAAI,CAAC,GAAM,EAAG,cAAc,EAAG,eAAc,EAAM,EAAG,aAAa,EAAG,aAAa,CAAE,EAAE,EAAG,IAAI,MAAc,CAAC,EAAK,EAAK,CAAE,EAAE,CAAC,CAAG,CAAC,EAAE,MAAW,CAAC,IAAM,EAAG,EAAK,QAAQ,GAAG,CAAC,EAAG,OAAO,IAAM,MAAY,EAAQ,EAAG,WAAW,EAAE,EAAQ,EAAE,IAAM,EAAG,IAAI,eAAe,CAAO,EAAiB,OAAf,EAAG,QAAQ,CAAE,MAAY,EAAG,WAAW,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