{"version":3,"file":"PWBFaqAccessibility.CXigGcDO.mjs","names":["useState","useCallback","useId"],"sources":["https:/framerusercontent.com/modules/WSxEkPq0z9zF9SFNGMU5/9LYEkTQHIlVIPBqGNdHd/PWBFaqAccessibility.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useId,useState}from\"react\";import{useIsStaticRenderer}from\"framer\";const categoryFocusStyles=new WeakMap;// Keep Framer's native category filter and visual variants. The actual Active\n// variant is the source of truth; do not invent a parallel selected category.\nexport function PWBFaqCategoryAccessibility(Component){const KeyboardComponent=PWBFaqQuestionKeyboard(Component);return /*#__PURE__*/forwardRef(function PWBFaqCategoryAccessibility(props,forwardedRef){const isStatic=useIsStaticRenderer();const[node,setNode]=useState(null);const ref=useCallback(element=>{setNode(element);if(typeof forwardedRef===\"function\")forwardedRef(element);else if(forwardedRef)forwardedRef.current=element;},[forwardedRef]);useEffect(()=>{if(isStatic||!node)return;const previous=node.getAttribute(\"aria-pressed\");const previousMarker=node.getAttribute(\"data-pwb-faq-category\");node.setAttribute(\"data-pwb-faq-category\",\"\");const doc=node.ownerDocument;let focusStyles=categoryFocusStyles.get(doc);if(!focusStyles){const element=doc.createElement(\"style\");element.textContent=`[data-pwb-faq-category]:focus-visible {\n                    outline: 0.125rem solid var(--token-a7974b4e-cab8-412b-9d55-7c4093a6b929, #1a2328) !important;\n                    outline-offset: 0.1875rem !important;\n                }`;doc.head.appendChild(element);focusStyles={element,users:0};categoryFocusStyles.set(doc,focusStyles);}const sharedStyles=focusStyles;sharedStyles.users+=1;const sync=()=>{// Default and its hover variant are both unselected. Active\n// has no separate hover variant in PWB Category Chip.\nconst selected=node.getAttribute(\"data-framer-name\")===\"Active\";node.setAttribute(\"aria-pressed\",String(selected));};const observer=new MutationObserver(sync);observer.observe(node,{attributes:true,attributeFilter:[\"data-framer-name\"]});sync();return()=>{observer.disconnect();if(previous===null)node.removeAttribute(\"aria-pressed\");else node.setAttribute(\"aria-pressed\",previous);if(previousMarker===null)node.removeAttribute(\"data-pwb-faq-category\");else node.setAttribute(\"data-pwb-faq-category\",previousMarker);sharedStyles.users-=1;if(sharedStyles.users===0){sharedStyles.element.remove();categoryFocusStyles.delete(doc);}};},[node,isStatic]);return /*#__PURE__*/_jsx(KeyboardComponent,{...props,ref:ref,type:\"button\"});});}// Framer's tap interaction responds to Enter, but its native button did not\n// activate with Space in preview. Invoke the same variant action for Space.\nexport function PWBFaqQuestionKeyboard(Component){return /*#__PURE__*/forwardRef(function PWBFaqQuestionKeyboard(props,ref){const isSpace=event=>event.key===\" \"||event.key===\"Spacebar\"||event.code===\"Space\";return /*#__PURE__*/_jsx(Component,{...props,ref:ref,onKeyDown:event=>{if(!isSpace(event))return props.onKeyDown?.(event);event.preventDefault();event.stopPropagation();if(event.repeat)return;const handler=props.onTap??props.onClick;if(typeof handler!==\"function\")return;const rect=event.currentTarget.getBoundingClientRect();handler(event,{point:{x:rect.x+rect.width/2,y:rect.y+rect.height/2}});},onKeyUp:event=>{if(!isSpace(event))return props.onKeyUp?.(event);event.preventDefault();event.stopPropagation();}});});}export function PWBFaqSearchLabel(Component){return /*#__PURE__*/forwardRef(function PWBFaqSearchLabel(props,forwardedRef){const isStatic=useIsStaticRenderer();const[node,setNode]=useState(null);const ref=useCallback(element=>{setNode(element);if(typeof forwardedRef===\"function\")forwardedRef(element);else if(forwardedRef)forwardedRef.current=element;},[forwardedRef]);useEffect(()=>{if(isStatic||!node)return;const field=node.matches(\"input\")?node:node.querySelector(\"input\");if(!field||field.hasAttribute(\"aria-label\")||field.hasAttribute(\"aria-labelledby\"))return;field.setAttribute(\"aria-label\",\"Search common questions\");return()=>{if(field.getAttribute(\"aria-label\")===\"Search common questions\")field.removeAttribute(\"aria-label\");};},[node,isStatic]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}// Enhance the native FAQ variants; do not replace their CMS text, layout,\n// animations or routing. Answers stay in SSR HTML even when collapsed.\nexport function PWBFaqAccessibility(Component){return /*#__PURE__*/forwardRef(function PWBFaqAccessibility(props,forwardedRef){const isStatic=useIsStaticRenderer();const uid=useId().replace(/[^a-zA-Z0-9_-]/g,\"\");const[node,setNode]=useState(null);const ref=useCallback(element=>{setNode(element);if(typeof forwardedRef===\"function\")forwardedRef(element);else if(forwardedRef)forwardedRef.current=element;},[forwardedRef]);useEffect(()=>{if(isStatic||!node)return;const attributes=new Map;const inert=new Map;const setAttribute=(element,name,value)=>{if(!attributes.has(element))attributes.set(element,new Map);const saved=attributes.get(element);if(!saved.has(name))saved.set(name,element.getAttribute(name));if(element.getAttribute(name)!==value)element.setAttribute(name,value);};const sync=()=>{const button=node.querySelector('button[data-framer-name=\"Question row\"]');const answer=node.querySelector('[data-framer-name=\"Answer\"]');if(!button||!answer)return;// Framer omits data-framer-name in the Closed hover variant.\n// Open is the only expanded variant in this native component.\nconst open=node.getAttribute(\"data-framer-name\")===\"Open\";if(!answer.id)setAttribute(answer,\"id\",`pwb-faq-answer-${uid}`);setAttribute(button,\"aria-controls\",answer.id);setAttribute(button,\"aria-expanded\",String(open));// Move focus out before making a closing answer unavailable.\nif(!open&&answer.contains(node.ownerDocument.activeElement)){button.focus({preventScroll:true});}if(!inert.has(answer))inert.set(answer,answer.inert);answer.inert=!open;setAttribute(answer,\"aria-hidden\",String(!open));};const observer=new MutationObserver(sync);observer.observe(node,{subtree:true,childList:true,attributes:true,attributeFilter:[\"data-framer-name\"]});sync();return()=>{observer.disconnect();inert.forEach((value,element)=>{element.inert=value;});attributes.forEach((saved,element)=>saved.forEach((value,name)=>{if(value===null)element.removeAttribute(name);else element.setAttribute(name,value);}));};},[node,isStatic,uid]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}export function PWBNewsSearchLabel(Component){return /*#__PURE__*/forwardRef(function PWBNewsSearchLabel(props,forwardedRef){const isStatic=useIsStaticRenderer();const[node,setNode]=useState(null);const ref=useCallback(element=>{setNode(element);if(typeof forwardedRef===\"function\")forwardedRef(element);else if(forwardedRef)forwardedRef.current=element;},[forwardedRef]);useEffect(()=>{if(isStatic||!node)return;const field=node.matches(\"input\")?node:node.querySelector(\"input\");if(!field||field.hasAttribute(\"aria-label\")||field.hasAttribute(\"aria-labelledby\"))return;field.setAttribute(\"aria-label\",\"Search news and insights\");return()=>{if(field.getAttribute(\"aria-label\")===\"Search news and insights\")field.removeAttribute(\"aria-label\");};},[node,isStatic]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}\nexport const __FramerMetadata__ = {\"exports\":{\"PWBFaqAccessibility\":{\"type\":\"reactHoc\",\"name\":\"PWBFaqAccessibility\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"PWBFaqSearchLabel\":{\"type\":\"reactHoc\",\"name\":\"PWBFaqSearchLabel\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"PWBFaqCategoryAccessibility\":{\"type\":\"reactHoc\",\"name\":\"PWBFaqCategoryAccessibility\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"PWBNewsSearchLabel\":{\"type\":\"reactHoc\",\"name\":\"PWBNewsSearchLabel\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"PWBFaqQuestionKeyboard\":{\"type\":\"reactHoc\",\"name\":\"PWBFaqQuestionKeyboard\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PWBFaqAccessibility.map"],"mappings":"2LAEA,SAAgB,EAA4B,EAAU,CAAC,IAAM,EAAkB,EAAuB,CAAS,EAAE,OAAoB,EAAW,SAAqC,EAAM,EAAa,CAAC,IAAM,EAAS,EAAoB,EAAO,CAAC,EAAK,GAASA,EAAS,IAAI,EAAQ,EAAIC,EAAY,GAAS,CAAC,EAAQ,CAAO,EAAK,OAAO,GAAe,WAAW,EAAa,CAAO,EAAU,IAAa,EAAa,QAAQ,EAAQ,EAAE,CAAC,CAAY,CAAC,EAK0M,OALxM,MAAc,CAAC,GAAG,GAAU,CAAC,EAAK,OAAO,IAAM,EAAS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