{"version":3,"file":"FAQSchema.B6VGtV2F.mjs","names":["useMemo","useState"],"sources":["https:/framerusercontent.com/modules/8e5cqOAIvCmtPgKDBFJ1/oD1P4J1YDz9h7U4HQuqC/FAQSchema.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useMemo}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";function parseFAQs(input){if(!input||typeof input!==\"string\")return[];const items=[];const normalised=input.replace(/\\r\\n/g,\"\\n\").replace(/[\\u2018\\u2019]/g,\"'\").replace(/[\\u201C\\u201D]/g,'\"');const lines=normalised.split(\"\\n\");let currentQ=null;let currentA=[];let mode=null;const flush=()=>{if(currentQ!==null){const answer=currentA.join(\"\\n\").trim();if(currentQ.trim()&&answer){items.push({question:currentQ.trim(),answer});}}currentQ=null;currentA=[];mode=null;};for(const rawLine of lines){const line=rawLine.trimEnd();const qMatch=line.match(/^\\s*Q\\s*[:.\\-]\\s*(.*)$/i);const aMatch=line.match(/^\\s*A\\s*[:.\\-]\\s*(.*)$/i);if(qMatch){flush();currentQ=qMatch[1];mode=\"q\";}else if(aMatch){currentA=[aMatch[1]];mode=\"a\";}else if(mode===\"q\"&&currentQ!==null){currentQ+=\" \"+line.trim();}else if(mode===\"a\"){currentA.push(line);}}flush();return items;}function escapeForJSON(str){return str.replace(/<[^>]*>/g,\"\").trim();}function buildSchema(items){const schema={\"@context\":\"https://schema.org\",\"@type\":\"FAQPage\",mainEntity:items.map(item=>({\"@type\":\"Question\",name:escapeForJSON(item.question),acceptedAnswer:{\"@type\":\"Answer\",text:escapeForJSON(item.answer)}}))};return JSON.stringify(schema);}export default function FAQSchema(props){const{faqs,showAccordion,heading,showHeading,headingSize,questionSize,answerSize,accentColor,backgroundColor,questionColor,answerColor,borderColor,style}=props;const items=useMemo(()=>parseFAQs(faqs||\"\"),[faqs]);const[openIndex,setOpenIndex]=useState(null);useEffect(()=>{if(typeof document===\"undefined\")return;if(items.length===0)return;const target=RenderTarget.current();const shouldInject=target===RenderTarget.preview||target===RenderTarget.export;if(!shouldInject)return;const scriptId=\"vekta-faq-schema-jsonld\";const existing=document.getElementById(scriptId);if(existing)existing.remove();const script=document.createElement(\"script\");script.type=\"application/ld+json\";script.id=scriptId;script.textContent=buildSchema(items);document.head.appendChild(script);return()=>{const node=document.getElementById(scriptId);if(node)node.remove();};},[items]);if(items.length===0){if(RenderTarget.current()===RenderTarget.canvas){return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",padding:24,border:`1px dashed ${borderColor}`,borderRadius:8,fontFamily:\"Plus Jakarta Sans, system-ui, sans-serif\",fontSize:14,color:\"#666\",lineHeight:1.5,background:\"#fafafa\",boxSizing:\"border-box\",...style},children:[/*#__PURE__*/_jsx(\"strong\",{style:{color:\"#222\"},children:\"FAQ Schema\"}),/*#__PURE__*/_jsx(\"div\",{style:{marginTop:8},children:\"No FAQs detected. Add to the article's faqs CMS field (Long Text).\"})]});}return null;}if(!showAccordion)return null;return /*#__PURE__*/_jsxs(\"section\",{\"aria-label\":\"Frequently asked questions\",style:{width:\"100%\",background:backgroundColor,fontFamily:\"Plus Jakarta Sans, system-ui, sans-serif\",boxSizing:\"border-box\",...style},children:[showHeading&&heading&&/*#__PURE__*/_jsx(\"h2\",{style:{fontFamily:\"Kurdis Wide Bold, Plus Jakarta Sans, system-ui, sans-serif\",fontSize:headingSize,lineHeight:1.4,letterSpacing:\"-0.04em\",color:questionColor,margin:\"0 0 16px 0\",fontWeight:700},children:heading}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexDirection:\"column\",width:\"100%\"},children:items.map((item,i)=>{const isOpen=openIndex===i;return /*#__PURE__*/_jsxs(\"div\",{style:{borderTop:`1px solid ${borderColor}`,borderBottom:i===items.length-1?`1px solid ${borderColor}`:\"none\"},children:[/*#__PURE__*/_jsxs(\"button\",{onClick:()=>setOpenIndex(isOpen?null:i),\"aria-expanded\":isOpen,style:{width:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",gap:16,padding:\"16px 0\",background:\"transparent\",border:\"none\",cursor:\"pointer\",textAlign:\"left\",fontFamily:\"Kurdis Wide Bold, Plus Jakarta Sans, system-ui, sans-serif\",fontSize:questionSize,lineHeight:1.4,letterSpacing:\"-0.02em\",color:questionColor,fontWeight:700,transition:\"color 200ms ease\"},onMouseEnter:e=>{e.currentTarget.style.color=accentColor;},onMouseLeave:e=>{e.currentTarget.style.color=questionColor;},children:[/*#__PURE__*/_jsx(\"span\",{children:item.question}),/*#__PURE__*/_jsxs(\"span\",{\"aria-hidden\":\"true\",style:{flexShrink:0,width:14,height:14,position:\"relative\",transition:\"transform 200ms ease\",transform:isOpen?\"rotate(45deg)\":\"rotate(0deg)\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",top:\"50%\",left:0,width:\"100%\",height:2,background:accentColor,transform:\"translateY(-50%)\"}}),/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",top:0,left:\"50%\",width:2,height:\"100%\",background:accentColor,transform:\"translateX(-50%)\"}})]})]}),/*#__PURE__*/_jsx(\"div\",{style:{maxHeight:isOpen?2e3:0,overflow:\"hidden\",transition:\"max-height 300ms ease, opacity 200ms ease\",opacity:isOpen?1:0},children:/*#__PURE__*/_jsx(\"div\",{style:{padding:\"0 0 20px 0\",fontFamily:\"Plus Jakarta Sans, system-ui, sans-serif\",fontSize:answerSize,lineHeight:1.6,color:answerColor,whiteSpace:\"pre-wrap\",fontWeight:400},children:item.answer})})]},i);})})]});}FAQSchema.defaultProps={faqs:\"\",showAccordion:true,heading:\"Frequently asked questions\",showHeading:true,headingSize:18,questionSize:14,answerSize:14,accentColor:\"rgb(251, 206, 1)\",backgroundColor:\"transparent\",questionColor:\"rgb(0, 0, 0)\",answerColor:\"rgb(33, 35, 39)\",borderColor:\"rgb(225, 227, 229)\"};addPropertyControls(FAQSchema,{faqs:{type:ControlType.String,title:\"FAQs\",displayTextArea:true,description:\"Format: Q: question then A: answer on the next line. Bind to a Long Text CMS field.\",defaultValue:\"\"},showAccordion:{type:ControlType.Boolean,title:\"Visible FAQ\",enabledTitle:\"Show\",disabledTitle:\"Schema only\",defaultValue:true},showHeading:{type:ControlType.Boolean,title:\"Heading\",enabledTitle:\"Show\",disabledTitle:\"Hide\",defaultValue:true,hidden:props=>props.showAccordion===false},heading:{type:ControlType.String,title:\"Heading text\",defaultValue:\"Frequently asked questions\",hidden:props=>props.showAccordion===false||props.showHeading===false},headingSize:{type:ControlType.Number,title:\"Heading size\",defaultValue:18,min:12,max:48,step:1,unit:\"px\",hidden:props=>props.showAccordion===false||props.showHeading===false},questionSize:{type:ControlType.Number,title:\"Question size\",defaultValue:14,min:12,max:32,step:1,unit:\"px\",hidden:props=>props.showAccordion===false},answerSize:{type:ControlType.Number,title:\"Answer size\",defaultValue:14,min:12,max:24,step:1,unit:\"px\",hidden:props=>props.showAccordion===false},accentColor:{type:ControlType.Color,title:\"Accent\",defaultValue:\"rgb(251, 206, 1)\",hidden:props=>props.showAccordion===false},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"transparent\",hidden:props=>props.showAccordion===false},questionColor:{type:ControlType.Color,title:\"Question\",defaultValue:\"rgb(0, 0, 0)\",hidden:props=>props.showAccordion===false},answerColor:{type:ControlType.Color,title:\"Answer\",defaultValue:\"rgb(33, 35, 39)\",hidden:props=>props.showAccordion===false},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"rgb(225, 227, 229)\",hidden:props=>props.showAccordion===false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FAQSchema\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FAQSchema.map"],"mappings":"uMAAwK,SAAS,EAAU,EAAM,CAAC,GAAG,CAAC,GAAO,OAAO,GAAQ,SAAS,MAAM,CAAC,EAAE,IAAM,EAAM,CAAC,EAAm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