import{h as F,r as T,g as M}from"../js/utils.825d3528.js";import{d as $,G as O}from"../js/app-core.82d0a9b8.js";import{_ as s}from"../js/vendor-other.2cdd5822.js";import"../js/vendor-vue-ui.02763c14.js";import"../js/vendor-datetime.430013a3.js";import"../js/vendor-lodash.f9514987.js";const D=F`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 15q.425 0 .738-.312.312-.313.312-.738t-.312-.738Q14.425 12.9 14 12.9t-.737.312q-.313.313-.313.738t.313.738Q13.575 15 14 15Zm-.75-3.2h1.5q0-.725.15-1.063.15-.337.7-.887.75-.75 1-1.213.25-.462.25-1.087 0-1.125-.788-1.837Q15.275 5 14 5q-1.025 0-1.787.575-.763.575-1.063 1.525l1.35.55q.225-.625.613-.938Q13.5 6.4 14 6.4q.6 0 .975.337.375.338.375.913 0 .35-.2.662-.2.313-.7.788-.825.725-1.012 1.137-.188.413-.188 1.563ZM8 18q-.825 0-1.412-.587Q6 16.825 6 16V4q0-.825.588-1.413Q7.175 2 8 2h12q.825 0 1.413.587Q22 3.175 22 4v12q0 .825-.587 1.413Q20.825 18 20 18Zm-4 4q-.825 0-1.412-.587Q2 20.825 2 20V6h2v14h14v2Z"/></svg>
`,z="aioseo/faq",W="AIOSEO - FAQ",G="Easily add an SEO-friendly Frequently Asked Question (FAQ) to your content.",P="aioseo",U={hidden:{type:"boolean",default:!1},question:{type:"string",selector:".aioseo-faq-block-question"},schemaBlockId:{type:"string",default:""},tagName:{type:"string",default:"h3"}},V={html:!1,anchor:!0,align:["wide","full"],color:{link:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,lineHeight:!0},spacing:{margin:!0,padding:!0,blockGap:!0}},Z={name:z,title:W,description:G,category:P,attributes:U,supports:V},u="all-in-one-seo-pack",j=window.wp,{PanelBody:K,SelectControl:Y,ToggleControl:J}=j.components,X=({attributes:l,setSchemaBlockAttributes:t})=>{const{hidden:n,tagName:e}=l,a=$.getUpsellLink("faq-block",null,O.learnMore,"sidebar",!0);return React.createElement(K,{title:s("FAQ Options",u)},React.createElement(Y,{label:s("Title Wrapper",u),options:[{label:"DIV",value:"div"},{label:"H1",value:"h1"},{label:"H2",value:"h2"},{label:"H3",value:"h3"},{label:"H4",value:"h4"}],value:e,onChange:o=>t({tagName:o}),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),React.createElement("p",{className:"aioseo-visibility-label"},s("Visibility",u)),React.createElement(J,{className:"aioseo-faq-visibility",label:s("Display Block",u),help:s("You can choose to hide this block on the front-end of your site so that visitors won't see it but search engines will still see it.",u),checked:!n,onChange:()=>t({hidden:!n}),__nextHasNoMarginBottom:!0}),React.createElement("div",{className:"aioseo-alert aioseo-alert inline-upsell blue medium"},React.createElement("div",{dangerouslySetInnerHTML:{__html:s("FAQ schema is a Pro feature.",u)+" "+a}})))},N="all-in-one-seo-pack",{name:ee,title:te,description:oe,category:ne,supports:ae,attributes:se}=Z,{useSelect:R}=window.wp.data,{useEffect:le}=window.wp.element,{serialize:ce}=window.wp.blocks,E=window.wp,re=E.blockEditor?.InspectorControls||E.editor.InspectorControls,{RichText:A,InnerBlocks:x}=E.blockEditor,d=[],ie=l=>{const{body:t}=document.implementation.createHTMLDocument("");t.innerHTML=l;function n(e){const a=e.childNodes;for(const o of a){if(o.nodeName?.toLowerCase().includes("comment")&&o.parentNode.removeChild(o),o.attributes)for(const{name:m,value:k}of o.attributes){const f=k.replace(/\s+/g,"").toLowerCase();(!["src","href"].includes(m)||m.startsWith("on")||f.includes("javascript:")||f.includes("data:"))&&o.removeAttribute(m)}n(o)}}return n(t),t.innerHTML.trim().replace(/\s+/g," ")},ue={title:te,description:oe,category:ne,supports:ae,attributes:se,icon:D,edit:function(l){const{attributes:t,className:n,clientId:e,setAttributes:a,isSelected:o}=l,{hidden:m,question:k,tagName:f,schemaBlockId:q}=t;!d.includes(e)&&!o&&d.push(e);const h=r=>{window.requestAnimationFrame(()=>{a(r)}),window.aioseoBus.$emit("schemaBlockUpdated")};le(()=>{(!q||1<(document.querySelectorAll(`[data-schema-block-id='${q}']`)||[]).length)&&h({schemaBlockId:M()})},[]);const c=R(r=>{const p=r("core/block-editor");if(!p)return;const{getAdjacentBlockClientId:g,getBlockAttributes:b,getBlockName:i,getClientIdsWithDescendants:w,getGlobalBlockCount:y}=p;if(d.includes(e)||2>y("aioseo/faq"))return null;const B=g(e,-1);if(i(B)==="aioseo/faq")return b(B);const _=g(e,1);if(i(_)==="aioseo/faq")return b(_);const v=w().filter(H=>i(H)==="aioseo/faq"),C=v.indexOf(e),I=v[C-1]||v[C+1];return i(I)==="aioseo/faq"?b(I):null},[e,d]);o&&!d.includes(e)&&!t.question&&c&&(d.push(e),window.requestAnimationFrame(()=>{a({backgroundColor:c.backgroundColor,textColor:c.textColor,tagName:c.tagName,hidden:c.hidden,fontSize:c.fontSize,style:c.style})}));const S=R(r=>{const p=r("core/block-editor");if(!p)return;const{getBlocks:g}=p;return(i=>{const w=g(i),y=ce(w);return ie(y)})(e)},[e]);h({answer:S});const L=[["core/paragraph",{placeholder:s("Write an answer...",N)}]],Q=["core/paragraph","core/heading","core/list","core/image","core/media-text"];return React.createElement(React.Fragment,null,React.createElement("div",{"data-schema-only":m,className:n,"data-schema-block-id":q},React.createElement(re,null,React.createElement(X,{setSchemaBlockAttributes:h,attributes:t})),React.createElement(A,{tagName:f,placeholder:s("Write a question...",N),className:"aioseo-faq-block-question",value:k,onChange:r=>h({question:r})}),React.createElement("div",{className:"aioseo-faq-block-answer"},React.createElement(x,{template:L,allowedBlocks:Q}))))},save:function({attributes:l,className:t}){const{hidden:n,question:e,tagName:a}=l;return React.createElement("div",{"data-schema-only":n,className:t},React.createElement(A.Content,{tagName:a,className:"aioseo-faq-block-question",value:e}),React.createElement("div",{className:"aioseo-faq-block-answer"},React.createElement(x.Content,null)))}};T({name:ee,settings:ue});
