{"version":3,"file":"ServiceQueryPrefill.BvfM9Jv5.mjs","names":[],"sources":["https:/framerusercontent.com/modules/1wUV05OotN2Jyo3w19dz/zWIU0ZX18nsdITRszKiT/ServiceQueryPrefill.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";const services={website:{value:\"website-landing-page\",label:\"Website / Landing Page\"},\"google-ads\":{value:\"google-ads\",label:\"Google Ads\"},tracking:{value:\"tracking-measurement\",label:\"Tracking & Measurement\"},strategy:{value:\"growth-strategy\",label:\"Growth Strategy\"}};const storageKey=\"local-outcome-service-prefill\";function requestedService(){if(typeof window===\"undefined\")return false;const fromQuery=new URLSearchParams(window.location.search).get(\"service\");if(fromQuery&&services[fromQuery])return fromQuery;try{const fromNavigation=window.sessionStorage.getItem(storageKey);return fromNavigation&&services[fromNavigation]?fromNavigation:undefined;}catch{return undefined;}}function applyService(key){if(typeof window===\"undefined\")return false;const requested=key?services[key]:undefined;if(!requested)return false;const select=document.querySelector('select[name=\"help_with\"]');if(!select)return false;const option=Array.from(select.options).find(candidate=>candidate.value===requested.value||candidate.text.trim()===requested.label);if(!option)return false;if(select.value===option.value)return true;const valueSetter=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,\"value\")?.set;if(valueSetter)valueSetter.call(select,option.value);else select.value=option.value;select.dispatchEvent(new Event(\"input\",{bubbles:true}));select.dispatchEvent(new Event(\"change\",{bubbles:true}));return select.value===option.value;}export function withServiceQueryPrefill(Component){return function ServiceQueryPrefill(props){React.useEffect(()=>{if(typeof window===\"undefined\")return;const key=requestedService();if(!key)return;let attempts=0;let stablePasses=0;let retry=0;const apply=()=>{attempts+=1;stablePasses=applyService(key)?stablePasses+1:0;if(stablePasses>=3||attempts>=30){window.clearInterval(retry);try{window.sessionStorage.removeItem(storageKey);}catch{}}};const firstFrame=window.requestAnimationFrame(apply);retry=window.setInterval(apply,100);return()=>{window.cancelAnimationFrame(firstFrame);window.clearInterval(retry);};},[]);return /*#__PURE__*/_jsx(Component,{...props});};}function withService(service){return function(Component){return function ServiceLink(props){const href=`/contact?service=${service}`;const onClick=event=>{try{window.sessionStorage.setItem(storageKey,service);}catch{}props.onClick?.(event);};return /*#__PURE__*/_jsx(Component,{...props,href:href,target:\"_self\",onClick:onClick});};};}export function withWebsiteService(Component){return withService(\"website\")(Component);}export function withGoogleAdsService(Component){return withService(\"google-ads\")(Component);}export function withTrackingService(Component){return withService(\"tracking\")(Component);}export function withStrategyService(Component){return withService(\"strategy\")(Component);}\nexport const __FramerMetadata__ = {\"exports\":{\"withTrackingService\":{\"type\":\"reactHoc\",\"name\":\"withTrackingService\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withServiceQueryPrefill\":{\"type\":\"reactHoc\",\"name\":\"withServiceQueryPrefill\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGoogleAdsService\":{\"type\":\"reactHoc\",\"name\":\"withGoogleAdsService\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withStrategyService\":{\"type\":\"reactHoc\",\"name\":\"withStrategyService\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withWebsiteService\":{\"type\":\"reactHoc\",\"name\":\"withWebsiteService\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ServiceQueryPrefill.map"],"mappings":"gIAAsY,SAAS,GAAkB,CAAC,GAAU,IAAS,OAAY,MAAO,GAAM,IAAM,EAAU,IAAI,gBAAgB,EAAO,SAAS,MAAM,CAAC,CAAC,IAAI,SAAS,EAAE,GAAG,GAAW,EAAS,GAAW,OAAO,EAAU,GAAG,CAAC,IAAM,EAAe,EAAO,eAAe,QAAQ,CAAU,EAAE,OAAO,GAAgB,EAAS,GAAgB,EAAe,IAAA,EAAU,MAAM,CAAC,MAAiB,CAAC,CAAC,SAAS,EAAa,EAAI,CAAC,GAAU,IAAS,OAAY,MAAO,GAAM,IAAM,EAAU,EAAI,EAAS,GAAK,IAAA,GAAU,G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