{"version":3,"file":"ContactFormSelect.DaKXOpC6.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/bpqPKTLP51Z0qMf7nmC6/IC9OCHGqmTAVd7B5wKKf/ContactFormSelect.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";export function SelectServiceFromURL(){useEffect(()=>{const normalize=val=>val.trim().toLowerCase().replace(/\\s+/g,\" \");/* ---------------- URL PARAM ---------------- */const params=new URLSearchParams(window.location.search);const rawParam=params.get(\"services\")||params.get(\"service\");// const serviceParam =\n//     rawParam && rawParam.trim() ? rawParam.trim().toLowerCase() : null\nconst serviceParam=rawParam&&rawParam.trim()?rawParam.trim().toLowerCase():null;/* ---------------- Slug → English label ---------------- */const serviceMapEN={\"private-office\":\"Private Offices\",\"private-offices\":\"Private Offices\",\"virtual-office\":\"Virtual Offices\",\"virtual-offices\":\"Virtual Offices\",\"enterprise-solution\":\"Managed Office\",\"enterprise-solutions\":\"Managed Office\",\"managed-office\":\"Managed Office\",\"managed-offices\":\"Managed Office\",\"meeting-rooms\":\"Meeting/Conference Rooms\",\"meeting-room\":\"Meeting/Conference Rooms\",\"event-spaces\":\"Event Spaces\",\"event-space\":\"Event Spaces\",\"business-setup\":\"Business Setup\",\"business-setup-visa\":\"Business Setup & Visa Application Service\",coworking:\"Coworking Spaces\",\"coworking-spaces\":\"Coworking Spaces\"};/* ---------------- English → Arabic ---------------- */const serviceMapAR={\"Private Offices\":\"المكاتب الخاصة\",\"Virtual Offices\":\"المكاتب الافتراضية\",\"Enterprise Solution\":\"المكتب المُدار\",\"Enterprise Solutions\":\"المكتب المُدار\",\"Managed Office\":\"المكتب المُدار\",\"Managed Offices\":\"المكتب المُدار\",\"Meeting/Conference Rooms\":\"غرف الاجتماعات/المؤتمرات\",\"Event Spaces\":\"قاعات الفعاليات\",\"Business Setup\":\"تأسيس شركة\",\"Business Setup & Visa Application Service\":\"خدمة تأسيس الشركات وتقديم طلبات التأشيرة\",\"Coworking Spaces\":\"مساحات العمل المشتركة\"};const isArabicPage=document.documentElement.lang===\"ar\"||window.location.pathname.startsWith(\"/ar\");/* ---------------- Location → Service filter ---------------- */const LOCATION_SERVICE_MAP={\"one central\":[\"private offices\",\"coworking spaces\",\"virtual offices\",\"meeting/conference rooms\",\"event spaces\",\"business setup\",\"business setup & visa application service\",\"managed office\"],\"al maryah tower\":[\"private offices\",\"coworking spaces\",\"virtual offices\",\"meeting/conference rooms\",\"event spaces\",\"managed office\"],\"al sila tower\":[\"private offices\",\"coworking spaces\",\"virtual offices\",\"meeting/conference rooms\",\"event spaces\",\"managed office\"],\"one zaabeel\":[\"private offices\",\"meeting/conference rooms\",\"event spaces\"]};/* ---------------- Core logic ---------------- */const applyLogic=(serviceSelect,locationSelect)=>{const locationText=normalize(locationSelect.options[locationSelect.selectedIndex]?.text||\"\");const allowedServices=LOCATION_SERVICE_MAP[locationText]||[];let firstVisibleIndex=null;Array.from(serviceSelect.options).forEach((opt,index)=>{const label=normalize(opt.text);const isAllowed=!allowedServices.length||allowedServices.includes(label);opt.hidden=!isAllowed;opt.disabled=!isAllowed;if(isAllowed&&firstVisibleIndex===null){firstVisibleIndex=index;}});const current=serviceSelect.options[serviceSelect.selectedIndex];if(!current||current.hidden||current.disabled){serviceSelect.selectedIndex=firstVisibleIndex??0;}serviceSelect.dispatchEvent(new Event(\"change\",{bubbles:true}));};const preselectService=serviceSelect=>{console.log(preselectService);if(!serviceParam)return;const enLabel=serviceMapEN[serviceParam];const arLabel=enLabel?serviceMapAR[enLabel]:null;const options=Array.from(serviceSelect.options);const match=options.find(opt=>normalize(opt.text)===normalize(enLabel||\"\")||isArabicPage&&arLabel&&normalize(opt.text)===normalize(arLabel));if(match){serviceSelect.selectedIndex=options.indexOf(match);serviceSelect.dispatchEvent(new Event(\"change\",{bubbles:true}));}};/* ---------------- Wait for Framer ---------------- */const observer=new MutationObserver(()=>{console.log(\"sssss\");const serviceSelect=document.querySelector('select[name=\"Service\"]');const locationSelect=document.querySelector('select[name=\"Location\"]');console.log(serviceSelect);console.log(locationSelect);if(serviceSelect||locationSelect||serviceSelect.options.length){preselectService(serviceSelect);applyLogic(serviceSelect,locationSelect);locationSelect.addEventListener(\"change\",()=>applyLogic(serviceSelect,locationSelect));observer.disconnect();}});observer.observe(document.body,{childList:true,subtree:true});return()=>observer.disconnect();},[]);return{};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withSelectServiceFromURL(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...SelectServiceFromURL(props)});};}withSelectServiceFromURL.displayName=\"SelectServiceFromURL\";\nexport const __FramerMetadata__ = {\"exports\":{\"withSelectServiceFromURL\":{\"type\":\"reactHoc\",\"name\":\"withSelectServiceFromURL\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"SelectServiceFromURL\":{\"type\":\"override\",\"name\":\"SelectServiceFromURL\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ContactFormSelect.map"],"mappings":"yLAAwE,SAAgB,GAAsB,CAE+xH,OAF9xH,MAAc,CAAC,IAAM,EAAU,GAAK,EAAI,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,OAAO,GAAG,EAAyD,EAAO,IAAI,gBAAgB,EAAO,SAAS,MAAM,EAAQ,EAAS,EAAO,IAAI,UAAU,GAAG,EAAO,IAAI,SAAS,EAE/V,EAAa,GAAU,EAAS,KAAK,EAAE,EAAS,KAAK,CAAC,CAAC,YAAY,EAAE,KAAuE,EAAa,CAAC,iBAAiB,kBAAkB,kBAAkB,kBAAkB,iBAAiB,kBAAkB,kBAAkB,kBAAkB,sBAAsB,iBAAiB,uBAAuB,iBAAiB,iBAAiB,iBAAiB,kBAAkB,iBAAiB,gBAAgB,2BAA2B,eAAe,2BAA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