{"version":3,"file":"FAQ_Accessibility.DrO-Dfij.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/OarVRSg5j0nx4Kuqbaix/sMkhsTwmJwuB7LDSnvYS/FAQ_Accessibility.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";export function FAQTrigger(Component){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const hostRef=useRef(null);useEffect(()=>{const host=hostRef.current;if(!host)return;const control=host.matches(\"button, [role='button']\")?host:host.querySelector(\"button, [role='button']\");if(!control)return;const container=control.parentElement;if(!container)return;if(control.tagName!==\"BUTTON\"){control.setAttribute(\"role\",\"button\");control.setAttribute(\"tabindex\",\"0\");}const isVisible=element=>{const box=element.getBoundingClientRect();const style=getComputedStyle(element);return style.display!==\"none\"&&style.visibility!==\"hidden\"&&box.height>0;};const updateExpandedState=()=>{const controlBox=control.getBoundingClientRect();const containerBox=container.getBoundingClientRect();const visibleAnswerInsideControl=Array.from(control.querySelectorAll(\"p\")).some(element=>{const paragraph=element;return paragraph.textContent?.trim()&&isVisible(paragraph);});const visibleAnswerBesideControl=Array.from(container.children).some(child=>{if(child===control)return false;const element=child;const box=element.getBoundingClientRect();return isVisible(element)&&box.top>=controlBox.bottom-1&&box.bottom<=containerBox.bottom+1;});const nextValue=String(Boolean(visibleAnswerInsideControl||visibleAnswerBesideControl));if(control.getAttribute(\"aria-expanded\")!==nextValue){control.setAttribute(\"aria-expanded\",nextValue);}};const scheduleUpdate=()=>{requestAnimationFrame(updateExpandedState);window.setTimeout(updateExpandedState,80);window.setTimeout(updateExpandedState,300);};const handleKeyDown=event=>{if(control.tagName===\"BUTTON\")return;if(event.key===\"Enter\"||event.key===\" \"){event.preventDefault();control.click();}};updateExpandedState();control.addEventListener(\"click\",scheduleUpdate);control.addEventListener(\"keydown\",handleKeyDown);const resizeObserver=new ResizeObserver(updateExpandedState);resizeObserver.observe(control);resizeObserver.observe(container);const mutationObserver=new MutationObserver(updateExpandedState);mutationObserver.observe(control,{attributes:true,childList:true,subtree:true});return()=>{control.removeEventListener(\"click\",scheduleUpdate);control.removeEventListener(\"keydown\",handleKeyDown);resizeObserver.disconnect();mutationObserver.disconnect();};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:element=>{hostRef.current=element;if(typeof forwardedRef===\"function\"){forwardedRef(element);}else if(forwardedRef){forwardedRef.current=element;}}});});}export function FitCheckAccessibility(Component){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const hostRef=useRef(null);useEffect(()=>{const host=hostRef.current;if(!host)return;let userInteracted=false;const markInteraction=event=>{if(event.target?.matches?.('input[type=\"radio\"]')){userInteracted=true;}};const smallestTextLabel=input=>{let node=input.parentElement;while(node&&node!==host){const value=(node.innerText||\"\").trim();if(value&&value.length<=100)return value;node=node.parentElement;}return\"\";};const commonAncestor=elements=>{if(!elements.length)return null;let node=elements[0].parentElement;while(node&&node!==host){if(elements.every(element=>node?.contains(element)))return node;node=node.parentElement;}return host;};const enhance=()=>{const radios=Array.from(host.querySelectorAll('input[type=\"radio\"]'));if(!userInteracted){radios.forEach(radio=>{radio.checked=false;radio.removeAttribute(\"checked\");});}const radioLabels=[\"Contractor bids\",\"Supplier bids\",\"Consultant proposals\",\"Other\",\"1 to 3\",\"4 to 5\",\"6 to 8\",\"9 or more\",\"Under 120 pages\",\"120 to 300 pages\",\"300 to 600 pages\",\"More than 600 pages\",\"I’m not sure\",\"Private-sector procurement\",\"Public-sector or regulated procurement\",\"I’m not sure\"];radios.forEach((radio,index)=>{radio.required=true;radio.setAttribute(\"aria-required\",\"true\");const label=radioLabels[index]||smallestTextLabel(radio);if(label)radio.setAttribute(\"aria-label\",label);});const groups=new Map;radios.forEach((radio,index)=>{const fallbackGroup=index<4?0:index<8?1:index<13?2:3;const key=radio.name||\"akte-radio-group-\"+fallbackGroup;const group=groups.get(key)||[];group.push(radio);groups.set(key,group);});const groupLabels=[\"What are you evaluating?\",\"How many bids or proposals are you comparing?\",\"Approximately how large is the tender and bid document set combined?\",\"Which best describes the procurement?\"];Array.from(groups.values()).forEach((inputs,index)=>{const container=commonAncestor(inputs);if(!container)return;container.setAttribute(\"role\",\"radiogroup\");container.setAttribute(\"aria-required\",\"true\");if(!container.getAttribute(\"aria-label\")){container.setAttribute(\"aria-label\",groupLabels[index]||\"Required choice\");}});const date=host.querySelector('input[type=\"date\"]');if(date){const today=new Date;today.setMinutes(today.getMinutes()-today.getTimezoneOffset());date.min=today.toISOString().slice(0,10);date.required=true;date.setAttribute(\"aria-label\",\"When do you need the evaluation?\");date.setAttribute(\"autocomplete\",\"off\");}const inputs=Array.from(host.querySelectorAll(\"input, textarea\"));inputs.forEach(input=>{const placeholder=(input.getAttribute(\"placeholder\")||\"\").toLowerCase();if(placeholder===\"country\"){input.setAttribute(\"autocomplete\",\"country-name\");input.setAttribute(\"aria-label\",\"Project country\");}else if(placeholder===\"optional\"){input.setAttribute(\"autocomplete\",\"address-level1\");input.setAttribute(\"aria-label\",\"State, region or province (optional)\");}else if(placeholder===\"your name\"){input.setAttribute(\"autocomplete\",\"name\");input.setAttribute(\"aria-label\",\"Name\");}else if(placeholder===\"company or organisation\"){input.setAttribute(\"autocomplete\",\"organization\");input.setAttribute(\"aria-label\",\"Company or organisation\");}else if(placeholder===\"name@company.com\"){input.setAttribute(\"autocomplete\",\"email\");input.setAttribute(\"aria-label\",\"Work email\");}else if(placeholder.startsWith(\"optional. please keep this brief\")){input.setAttribute(\"aria-label\",\"Anything else we should know? Optional.\");}});};host.addEventListener(\"pointerdown\",markInteraction,true);host.addEventListener(\"keydown\",markInteraction,true);host.addEventListener(\"change\",markInteraction,true);const observer=new MutationObserver(enhance);observer.observe(host,{childList:true,subtree:true});const timers=[0,80,250,750].map(delay=>window.setTimeout(enhance,delay));return()=>{timers.forEach(window.clearTimeout);observer.disconnect();host.removeEventListener(\"pointerdown\",markInteraction,true);host.removeEventListener(\"keydown\",markInteraction,true);host.removeEventListener(\"change\",markInteraction,true);};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:element=>{hostRef.current=element;if(typeof forwardedRef===\"function\")forwardedRef(element);else if(forwardedRef)forwardedRef.current=element;}});});}export function MobileNavigationAccessibility(Component){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const hostRef=useRef(null);useEffect(()=>{const host=hostRef.current;if(!host)return;const update=()=>{const button=host.matches(\"button\")?host:host.querySelector(\"button\");if(!button)return;const nav=button.closest(\"nav\")||host;const expanded=nav.querySelectorAll(\"a\").length>1;button.setAttribute(\"aria-expanded\",expanded?\"true\":\"false\");button.setAttribute(\"aria-label\",expanded?\"Close navigation menu\":\"Open navigation menu\");button.setAttribute(\"aria-haspopup\",\"true\");};const observer=new MutationObserver(update);observer.observe(host,{childList:true,subtree:true});const onClick=()=>{requestAnimationFrame(update);window.setTimeout(update,120);};host.addEventListener(\"click\",onClick);update();return()=>{observer.disconnect();host.removeEventListener(\"click\",onClick);};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:element=>{hostRef.current=element;if(typeof forwardedRef===\"function\")forwardedRef(element);else if(forwardedRef)forwardedRef.current=element;}});});}export function BilingualLegalLanguage(Component){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const hostRef=useRef(null);useEffect(()=>{const host=hostRef.current;if(!host)return;const applyLanguage=()=>{host.setAttribute(\"lang\",\"de\");let english=false;const elements=[host,...Array.from(host.querySelectorAll(\"*\"))];elements.forEach(element=>{const ownText=Array.from(element.childNodes).filter(node=>node.nodeType===Node.TEXT_NODE).map(node=>node.textContent||\"\").join(\" \").trim();if(/ENGLISH/i.test(ownText)||/^ENGLISH$/i.test(element.innerText.trim())){english=true;}element.setAttribute(\"lang\",english?\"en\":\"de\");});};const observer=new MutationObserver(applyLanguage);observer.observe(host,{childList:true,subtree:true});applyLanguage();return()=>observer.disconnect();},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:element=>{hostRef.current=element;if(typeof forwardedRef===\"function\")forwardedRef(element);else if(forwardedRef)forwardedRef.current=element;}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"FitCheckAccessibility\":{\"type\":\"reactHoc\",\"name\":\"FitCheckAccessibility\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"FAQTrigger\":{\"type\":\"reactHoc\",\"name\":\"FAQTrigger\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"BilingualLegalLanguage\":{\"type\":\"reactHoc\",\"name\":\"BilingualLegalLanguage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"MobileNavigationAccessibility\":{\"type\":\"reactHoc\",\"name\":\"MobileNavigationAccessibility\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FAQ_Accessibility.map"],"mappings":"8IAA0F,SAAgB,EAAW,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAe,CAAC,IAAM,EAAQA,EAAO,IAAI,EAAioE,OAA/nE,MAAc,CAAC,IAAM,EAAK,EAAQ,QAAQ,GAAG,CAAC,EAAK,OAAO,IAAM,EAAQ,EAAK,QAAQ,yBAAyB,EAAE,EAAK,EAAK,cAAc,yBAAyB,EAAE,GAAG,CAAC,EAAQ,OAAO,IAAM,EAAU,EAAQ,cAAc,GAAG,CAAC,EAAU,OAAU,EAAQ,UAAU,WAAU,EAAQ,aAAa,OAAO,QAAQ,EAAE,EAAQ,aAAa,WAAW,GAAG,GAAG,IAAM,EAAU,GAAS,CAAC,IAAM,EAAI,EAAQ,sBAAsB,EAAQ,EAAM,iBAAiB,CAAO,EAAE,OAAO,EAAM,UAAU,QAAQ,EAAM,aAAa,UAAU,EAAI,OAAO,CAAE,EAAQ,MAAwB,CAAC,IAAM,EAAW,EAAQ,sBAAsB,EAAQ,EAAa,EAAU,sBAAsB,EAAQ,EAA2B,MAAM,KAAK,EAAQ,iBAAiB,GAAG,CAAC,CAAC,CAAC,KAAK,GAAS,CAAC,IAAM,EAAU,EAAQ,OAAO,EAAU,aAAa,KAAK,GAAG,EAAU,CAAS,CA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