{"version":3,"file":"AppendQuery.C0To75Ja.mjs","names":[],"sources":["https:/framerusercontent.com/modules/lklsYstppbvh1eNVoPs9/71tpZ1J8eN63EpS54bYm/AppendQuery.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";// Whitelist which params you want to pass through\nconst ALLOW=[\"aff\",\"af\",\"ref\",\"utm_source\",\"utm_medium\",\"utm_campaign\",\"utm_content\",\"utm_term\",\"adset\",\"ad\",\"ad_id\"];function mergeQuery(base,currentQs){try{const baseUrl=new URL(base,typeof window!==\"undefined\"?window.location.origin:\"https://example.com\");const curr=new URLSearchParams(currentQs);for(const k of ALLOW){const v=curr.get(k);if(v&&!baseUrl.searchParams.has(k)){baseUrl.searchParams.set(k,v);}}return baseUrl.toString();}catch{const[pathAndQuery,hash=\"\"]=base.split(\"#\");const[path,q=\"\"]=pathAndQuery.split(\"?\");const dest=new URLSearchParams(q);const curr=new URLSearchParams(currentQs);for(const k of ALLOW){const v=curr.get(k);if(v&&!dest.has(k)){dest.set(k,v);}}const joined=dest.toString();return path+(joined?\"?\"+joined:\"\")+(hash?\"#\"+hash:\"\");}}// HOC override: sets the final href with merged params\n// and fires Meta Lead event on click\nexport function withAppendQuery(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const base=props.href??props.link??props.url??\"\";const qs=typeof window!==\"undefined\"?window.location.search:\"\";const href=base?mergeQuery(base,qs):base;const handleClick=e=>{// preserve any existing click behavior\nif(props.onClick){props.onClick(e);}// fire Meta lead event once\nif(typeof window!==\"undefined\"&&typeof window.fbq===\"function\"){window.fbq(\"track\",\"Lead\");}};return /*#__PURE__*/_jsx(Component,{...props,ref:ref,href:href,onClick:handleClick});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withAppendQuery\":{\"type\":\"reactHoc\",\"name\":\"withAppendQuery\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AppendQuery.map"],"mapp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