{"version":3,"file":"BookLink.CyXLFPCG.mjs","names":["useRef","__esmMin","init_ssg_sandbox_shims","de","c","init_jsx_runtime","init_npm_react_18_3_1","ce","window","withBookingQuery","ref","query","q","isBook","a","onClickCapture","Component","props","init_BookLink"],"sources":["https:/framerusercontent.com/modules/app4ZnTHm0fGfZSxVk9w/cuGK9IOinwqPqlpeIpwn/BookLink.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";/**\n * Booking links (override)\n *\n * Why code: Framer page links can't carry a ?query, but the booking page can open with a\n * treatment or clinician already chosen (/book?treatment=checkup, /book?clinician=varga).\n * - withBookingQuery: on a frame that holds a link to /book and a hidden text layer named\n *   \"Booking Query\" (for example \"treatment=checkup\", bound to the CMS). Links to /book inside\n *   the frame then open the booking page with that choice made.\n */const isBook=a=>{try{return new URL(a.getAttribute(\"href\")||\"\",window.location.href).pathname.replace(/\\/$/,\"\")===\"/book\";}catch(_){return false;}};export function withBookingQuery(Component){return props=>{const ref=useRef(null);const query=()=>ref.current?.querySelector('[data-framer-name=\"Booking Query\"]')?.textContent?.trim()||\"\";// show the full address on hover and for \"open in new tab\"\nuseEffect(()=>{const q=query();if(!q)return;ref.current?.querySelectorAll(\"a[href]\").forEach(a=>{if(isBook(a))a.setAttribute(\"href\",\"/book?\"+q);});},[]);const onClickCapture=e=>{const a=e.target?.closest?.(\"a[href]\");const q=query();if(!a||!q||!isBook(a)||e.metaKey||e.ctrlKey||e.shiftKey||e.button===1)return;e.preventDefault();e.stopPropagation();window.location.assign(\"/book?\"+q);};return /*#__PURE__*/_jsx(\"span\",{ref:ref,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props,onClickCapture:onClickCapture})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withBookingQuery\":{\"type\":\"reactHoc\",\"name\":\"withBookingQuery\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BookLink.map"],"mappings":"A,uIAQuJ,SAAgBS,EAAiB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAMC,EAAIV,EAAO,IAAI,EAAQW,MAAUD,EAAI,SAAS,cAAc,oCAAoC,CAAC,EAAE,aAAa,KAAK,GAAG,GAChVH,MAAc,CAAC,IAAMK,EAAED,EAAM,EAAMC,GAASF,EAAI,SAAS,iBAAiB,SAAS,CAAC,CAAC,QAAQ,GAAG,CAAIG,EAAOC,CAAC,GAAEA,EAAE,aAAa,OAAO,SAASF,CAAC,CAAE,CAAC,CAAE,EAAE,CAAC,CAAC,EAAE,IAAMG,EAAe,GAAG,CAAC,IAAMD,EAAE,EAAE,QAAQ,UAAU,SAAS,EAAQF,EAAED,EAAM,EAAMG,GAAIF,GAAIC,EAAOC,CAAC,GAAG,GAAE,SAAS,GAAE,SAAS,GAAE,UAAU,EAAE,SAAS,IAAS,EAAE,eAAe,EAAE,EAAE,gBAAgB,EAAEN,EAAO,SAAS,OAAO,SAASI,CAAC,EAAE,EAAE,MAAoB,gBAAK,OAAO,CAAK,MAAI,MAAM,CAAC,QAAQ,UAAU,EAAE,SAAsB,gBAAKI,EAAU,CAAC,GAAGC,EAAqB,gBAAc,CAAC,CAAC,CAAC,CAAE,CAAE,C,gDADhhB,EAAO,GAAG,CAAC,GAAG,CAAC,OAAO,IAAI,IAAIH,EAAE,aAAa,MAAM,GAAG,GAAGN,EAAO,SAAS,IAAI,CAAC,CAAC,SAAS,QAAQ,MAAM,EAAE,IAAI,OAAQ,MAAS,CAAC,MAAO,EAAM,CAAC,C"}