{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/GVm59KJbvir8hRTzQiTf/HABFVyI3VQdXWkOluNw6/Autocomplete.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Helper function to dynamically load scripts\nconst loadScript=(src,callback)=>{if(typeof window===\"undefined\")return;// Ensure it's running in the browser\n// Check if script is already loaded\nif(document.querySelector(`script[src=\"${src}\"]`)){callback===null||callback===void 0?void 0:callback()// Call the callback if the script is already loaded\n;return;}const script=document.createElement(\"script\");script.src=src;script.onload=callback;script.async=true// Ensure scripts load asynchronously\n;document.head.appendChild(script);};// Helper function to dynamically inject styles\nconst injectStyles=()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\")return;// Ensure it's running in the browser\nif(!document.querySelector(\"#autocomplete-styles\")){const style=document.createElement(\"style\");style.id=\"autocomplete-styles\";style.innerHTML=`\n            .field_autocomplete {\n                --framer-input-background: none !important;\n                --framer-input-border: none !important;\n                --framer-input-padding: 0 !important;\n                flex: 0 0 auto !important;\n                height: auto !important;\n                position: relative !important;\n                width: 100% !important;\n            }\n            .field_autocomplete select {\n                width: 100% !important;\n                height: auto !important;\n                padding: 10px !important;\n                box-sizing: border-box !important;\n                border: none !important;\n                border-radius: 10px !important;\n            }\n            .select2-container .select2-search--inline {\n                float: none;\n            }\n        `;document.head.appendChild(style);}};// Autocomplete Component\nexport function Autocomplete(props){const{googleMapsAPI,googleMapsAPIKey,targetFieldName}=props;const googleMapsScriptLoadedRef=useRef(false);useEffect(()=>{// Inject styles only in the browser environment\nif(typeof window!==\"undefined\"&&typeof document!==\"undefined\"){injectStyles();}// Ensure the script only loads in the browser environment\nif(typeof window!==\"undefined\"&&typeof document!==\"undefined\"&&googleMapsAPI&&googleMapsAPIKey&&!googleMapsScriptLoadedRef.current){const scriptSrc=`https://maps.googleapis.com/maps/api/js?key=${googleMapsAPIKey}&libraries=places`;loadScript(scriptSrc,()=>{googleMapsScriptLoadedRef.current=true;initializeGoogleMapsAutocomplete();});}},[googleMapsAPI,googleMapsAPIKey,targetFieldName]);// Initialize Google Maps Autocomplete\nconst initializeGoogleMapsAutocomplete=()=>{if(typeof window!==\"undefined\"&&typeof document!==\"undefined\"&&window.google&&googleMapsAPIKey&&targetFieldName){console.log(\"Initializing Google Maps autocomplete for\",targetFieldName);const inputFields=document.querySelectorAll(`input[name=\"${targetFieldName}\"]`);inputFields.forEach(inputField=>{const autocomplete=new google.maps.places.Autocomplete(inputField);autocomplete.addListener(\"place_changed\",()=>{const place=autocomplete.getPlace();console.log(\"Selected place:\",place);});});}else{console.error(\"Google Maps is not loaded, target field name is missing, or the code is not running in the browser.\");}};// Placeholder for rendering or debugging\nconst isEditor=typeof window!==\"undefined\"&&window.location.href.includes(\"framer.com\");const hiddenStyle=isEditor?{}:{display:\"none\",padding:20};return /*#__PURE__*/_jsx(\"div\",{style:hiddenStyle,children:/*#__PURE__*/_jsx(\"h1\",{children:\"Autocomplete Configuration\"})});}// Define property controls for the component\naddPropertyControls(Autocomplete,{googleMapsAPI:{type:ControlType.Boolean,title:\"Source: GoogleMaps API\",defaultValue:false},googleMapsAPIKey:{type:ControlType.String,title:\"GoogleMaps API Key\",hidden:props=>!props.googleMapsAPI},targetFieldName:{type:ControlType.String,title:\"Target Field Name\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"Autocomplete\":{\"type\":\"reactComponent\",\"name\":\"Autocomplete\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Autocomplete.map"],
  "mappings": "gJACA,IAAMA,EAAW,CAACC,EAAIC,IAAW,CAAC,GAAG,OAAOC,EAAS,IAAY,OAEjE,GAAG,SAAS,cAAc,eAAeF,CAAG,IAAI,EAAE,CAA2CC,IAAS,EACrG,MAAO,CAAC,IAAME,EAAO,SAAS,cAAc,QAAQ,EAAEA,EAAO,IAAIH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E,CAAC,GAAQ,QAAQ,MAAM,qGAAqG,CAAG,EACrjBC,EAA/E,OAAOjB,EAAS,KAAaA,EAAO,SAAS,KAAK,SAAS,YAAY,EAA6B,CAAC,EAAE,CAAC,QAAQ,OAAO,QAAQ,EAAE,EAAE,OAAoBkB,EAAK,MAAM,CAAC,MAAMD,EAAY,SAAsBC,EAAK,KAAK,CAAC,SAAS,4BAA4B,CAAC,CAAC,CAAC,CAAE,CAC/QC,EAAoBf,EAAa,CAAC,cAAc,CAAC,KAAKgB,EAAY,QAAQ,MAAM,yBAAyB,aAAa,EAAK,EAAE,iBAAiB,CAAC,KAAKA,EAAY,OAAO,MAAM,qBAAqB,OAAOf,GAAO,CAACA,EAAM,aAAa,EAAE,gBAAgB,CAAC,KAAKe,EAAY,OAAO,MAAM,mBAAmB,CAAC,CAAC",
  "names": ["loadScript", "src", "callback", "window", "script", "injectStyles", "style", "Autocomplete", "props", "googleMapsAPI", "googleMapsAPIKey", "targetFieldName", "googleMapsScriptLoadedRef", "pe", "ue", "scriptSrc", "initializeGoogleMapsAutocomplete", "inputField", "autocomplete", "place", "hiddenStyle", "p", "addPropertyControls", "ControlType"]
}
