{"version":3,"file":"TEDFAQStructuredData.5HZb3bbI.mjs","names":["React.useState","__esmMin","te","init_npm_react_18_3_1","_e","init_jsx_runtime","c","ce","addPropertyControls","RenderTarget","init_framer_BWFVvmND","ControlType","plainText","value","scriptJSON","CMSFAQSource","record","itemKey","question","answer","style","hiddenStyle","FAQPageSchema","schema","setSchema","active","frame","sync","records","sourceSelector","node","key","next","previous","schedule","containsSource","observer","mutations","mutation","DirectoryCMSItem","entrySlug","entryName","collectionPath","DirectoryPageSchema","selector","base","items","slug","name","index","item","m","TEDFAQStructuredData","props","init_TEDFAQStructuredData"],"sources":["https:/framerusercontent.com/modules/b7zSRghyjtxDtgpTc4hP/0dwCZfofv6Y1gLTikPlW/TEDFAQStructuredData.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const sourceSelector='script[data-ted-faq-cms-source=\"1\"]';function plainText(value){return typeof value===\"string\"?value.replace(/\\s+/g,\" \").trim():\"\";}// A CMS value cannot terminate its containing script element. JSON.parse restores\n// the original characters; this does not change the published question or answer.\nfunction scriptJSON(value){return JSON.stringify(value).replace(/</g,\"\\\\u003c\").replace(/\\u2028/g,\"\\\\u2028\").replace(/\\u2029/g,\"\\\\u2029\");}const hiddenStyle={position:\"absolute\",width:1,height:1,overflow:\"hidden\",pointerEvents:\"none\"};function CMSFAQSource({style,itemKey,question,answer}){const record={key:plainText(itemKey)||plainText(question),question:plainText(question),answer:plainText(answer)};return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{...style,...hiddenStyle},children:record.question&&record.answer?/*#__PURE__*/_jsx(\"script\",{type:\"application/json\",\"data-ted-faq-cms-source\":\"1\",dangerouslySetInnerHTML:{__html:scriptJSON(record)}}):null});}function FAQPageSchema({style}){const[schema,setSchema]=React.useState(null);React.useEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas)return;let active=true;let frame=0;function sync(){if(!active)return;const records=new Map;document.querySelectorAll(sourceSelector).forEach(node=>{try{const value=JSON.parse(node.textContent||\"null\");if(!value||typeof value!==\"object\")return;const question=plainText(value.question);const answer=plainText(value.answer);const key=plainText(value.key)||question;if(key&&question&&answer&&!records.has(key)){records.set(key,{key,question,answer});}}catch{// Incomplete CMS fragments are retried by the observer.\n}});const next=records.size?scriptJSON({\"@context\":\"https://schema.org\",\"@type\":\"FAQPage\",\"@id\":\"https://tokyoexpatdental.com/faq#faq\",mainEntity:Array.from(records.values(),({question,answer})=>({\"@type\":\"Question\",name:question,acceptedAnswer:{\"@type\":\"Answer\",text:answer}}))}):null;// Let Framer finish hydrating its CMS/Suspense boundaries first.\nReact.startTransition(()=>{if(active)setSchema(previous=>previous===next?previous:next);});}function schedule(){if(frame)cancelAnimationFrame(frame);frame=requestAnimationFrame(()=>{frame=0;sync();});}function containsSource(node){return node instanceof Element&&(node.matches(sourceSelector)||!!node.querySelector(sourceSelector));}const observer=new MutationObserver(mutations=>{const sourceChanged=mutations.some(mutation=>{const target=mutation.target instanceof Element?mutation.target:mutation.target.parentElement;return!!target?.matches(sourceSelector)||Array.from(mutation.addedNodes).some(containsSource)||Array.from(mutation.removedNodes).some(containsSource);});if(sourceChanged)schedule();});observer.observe(document.body,{childList:true,subtree:true,characterData:true});sync();return()=>{active=false;observer.disconnect();if(frame)cancelAnimationFrame(frame);};},[]);return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{...style,...hiddenStyle},children:schema?/*#__PURE__*/_jsx(\"script\",{id:\"ted-schema-faq\",type:\"application/ld+json\",dangerouslySetInnerHTML:{__html:schema}}):null});}// Directory records use a separate native CMS source list with the same\n// editorial visibility filter and order as the unsearched directory.\nfunction DirectoryCMSItem({style,collectionPath,entrySlug,entryName}){const record={slug:plainText(entrySlug),name:plainText(entryName)};return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{...style,...hiddenStyle},children:record.slug&&record.name?/*#__PURE__*/_jsx(\"script\",{type:\"application/json\",\"data-ted-directory-source\":collectionPath,dangerouslySetInnerHTML:{__html:scriptJSON(record)}}):null});}function DirectoryPageSchema({style,collectionPath=\"/treatments\"}){const[schema,setSchema]=React.useState(null);React.useEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas)return;if(![\"/treatments\",\"/blog\",\"/staff\"].includes(collectionPath))return;const selector=`script[data-ted-directory-source=\"${collectionPath}\"]`;const base=\"https://tokyoexpatdental.com\"+collectionPath;let active=true;let frame=0;const containsSource=node=>node instanceof Element&&(node.matches(selector)||!!node.querySelector(selector));function sync(){if(!active)return;const items=new Map;document.querySelectorAll(selector).forEach(node=>{try{const record=JSON.parse(node.textContent||\"null\");const slug=plainText(record?.slug);const name=plainText(record?.name);if(slug&&name&&!items.has(slug))items.set(slug,{slug,name});}catch{/* Retry incomplete CMS fragments on their next mutation. */}});const next=items.size?scriptJSON({\"@context\":\"https://schema.org\",\"@type\":\"ItemList\",\"@id\":base+\"#list\",numberOfItems:items.size,itemListElement:Array.from(items.values(),(item,index)=>({\"@type\":\"ListItem\",position:index+1,name:item.name,url:base+\"/\"+encodeURIComponent(item.slug)}))}):null;React.startTransition(()=>{if(active)setSchema(previous=>previous===next?previous:next);});}function schedule(){if(frame)cancelAnimationFrame(frame);frame=requestAnimationFrame(()=>{frame=0;sync();});}const observer=new MutationObserver(mutations=>{if(mutations.some(m=>{const target=m.target instanceof Element?m.target:m.target.parentElement;return!!target?.matches(selector)||Array.from(m.addedNodes).some(containsSource)||Array.from(m.removedNodes).some(containsSource);}))schedule();});observer.observe(document.body,{childList:true,subtree:true,characterData:true});sync();return()=>{active=false;observer.disconnect();if(frame)cancelAnimationFrame(frame);};},[collectionPath]);return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{...style,...hiddenStyle},children:schema?/*#__PURE__*/_jsx(\"script\",{id:\"ted-schema-collection\",type:\"application/ld+json\",dangerouslySetInnerHTML:{__html:schema}}):null});}/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 1\n * @framerIntrinsicHeight 1\n */export default function TEDFAQStructuredData(props){if(props.mode===\"directory-item\")return /*#__PURE__*/_jsx(DirectoryCMSItem,{...props});if(props.mode===\"directory-page\")return /*#__PURE__*/_jsx(DirectoryPageSchema,{...props});return props.mode===\"cms-item\"?/*#__PURE__*/_jsx(CMSFAQSource,{...props}):/*#__PURE__*/_jsx(FAQPageSchema,{...props});}addPropertyControls(TEDFAQStructuredData,{mode:{type:ControlType.Enum,title:\"Mode\",options:[\"page\",\"cms-item\",\"directory-page\",\"directory-item\"],optionTitles:[\"FAQ page schema\",\"FAQ CMS item\",\"Directory schema\",\"Directory CMS item\"],defaultValue:\"page\"},collectionPath:{type:ControlType.Enum,title:\"Directory\",options:[\"/treatments\",\"/blog\",\"/staff\"],optionTitles:[\"Treatments\",\"Patient guides\",\"Our team\"],defaultValue:\"/treatments\",hidden:props=>!props.mode?.startsWith(\"directory-\")},entrySlug:{type:ControlType.String,title:\"CMS slug\",defaultValue:\"\",hidden:props=>props.mode!==\"directory-item\"},entryName:{type:ControlType.String,title:\"Entry name\",defaultValue:\"\",hidden:props=>props.mode!==\"directory-item\"},itemKey:{type:ControlType.String,title:\"CMS key\",defaultValue:\"\",hidden:props=>props.mode!==\"cms-item\"},question:{type:ControlType.String,title:\"Question\",defaultValue:\"\",hidden:props=>props.mode!==\"cms-item\"},answer:{type:ControlType.String,title:\"Answer\",displayTextArea:true,defaultValue:\"\",hidden:props=>props.mode!==\"cms-item\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TEDFAQStructuredData\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TEDFAQStructuredData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