const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__aioseoDynamicImportPreload__("js/vendor-draggable.f9bdaf1b.js"),window.__aioseoDynamicImportPreload__("js/vendor-other.7b559694.js"),window.__aioseoDynamicImportPreload__("js/vendor-vue-ui.de3ab35f.js"),window.__aioseoDynamicImportPreload__("css/vendor-vue-ui.dbee72c8.css")])))=>i.map(i=>d[i]); import{h as ue,c as pe,d as we,r as He}from"../js/utils.4c41c8aa.js";import{f as c,i as y,j as s,M as A,U as k,ae as j,Q as E,R as B,a0 as $,v,B as Ae,T as W,u as ge,r as q,b as Y,n as K,aq as fe,P as Q,C as Se,as as $e,O as Be,ad as Te,S as Ee,ar as te,an as oe}from"../js/vendor-vue-ui.de3ab35f.js";import{b as me,bk as X,bl as ie,bm as Ve,bn as Ie,ap as ne,y as Oe,l as Me,bo as Le}from"../js/app-core.ae890a3f.js";import{C as xe}from"../js/Tooltip.ae7a1028.js";import{S as ye}from"../js/Info.b2b2b6e1.js";import{_ as x,a as G}from"../js/vendor-other.7b559694.js";import{_ as Re}from"../js/vendor-phone.8b9bc15d.js";import{B as le}from"../js/Input.8918dec2.js";import{S as ze}from"../js/Close.098d4b76.js";import{S as Ne}from"../js/Drag.85d6c286.js";import{S as De}from"../js/Eye.050aa9d8.js";import{_ as qe}from"../js/_plugin-vue_export-helper.eefbdd86.js";import{S as Fe}from"../js/Link.53728cdc.js";import{C as Pe}from"../js/Index.ab3bcf62.js";import{_ as se}from"../js/Button.a549093d.js";import"../js/vendor-lodash.8e35bd59.js";import"../js/Index.52399193.js";import"../js/Pencil.405b16d2.js";import"../js/Trash.d35f8063.js";const Ze=ue` `,Ue="aioseo/table-of-contents",je="AIOSEO - Table of Contents",Qe="Automatically output a table of contents (TOC) for long posts or pages (and custom post types).",Ge="layout",Je={listStyle:{type:"string",default:"ul"},collapsibleType:{type:"string",default:"off"},collapsed:{type:"boolean",default:!1},collapsedTitle:{type:"string",default:"Show Table of Contents"},expandedTitle:{type:"string",default:"Hide Table of Contents"},mode:{type:"string",default:null},headings:{type:"array",items:{type:"object"},default:[]},reOrdered:{type:"boolean",default:!1}},Ye={multiple:!0,html:!1,reusable:!1,align:["wide","full"]},Ke={name:Ue,title:je,description:Qe,category:Ge,attributes:Je,supports:Ye},We={class:"aioseo-toc-header"},Xe={class:"aioseo-toc-header-title"},et={key:0,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},tt={key:1,width:"14",height:"2",viewBox:"0 0 14 2",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ot={key:1},it={class:"aioseo-toc-header-info"},nt={key:0,class:"aioseo-toc-header-instructions"},lt={key:1,class:"aioseo-toc-header-buttons"},re={__name:"Header",props:{blockAttributes:{type:Object,required:!0},loadActions:{type:Boolean,default:!1}},emits:["showModal"],setup(t,{emit:o}){const e="all-in-one-seo-pack",i=o,n=t,l={header:G(x("%1$s Table of Contents",e),"AIOSEO"),instructions:x("Add a heading block below to begin generating the Table of Contents.",e),tooltipMainDescription:G(x("%1$s can automatically output a table of contents based on your heading tags below. Search engines sometimes use table of contents in search results or rich snippets which can help you increase your rankings.",e),"AIOSEO"),reorder:x("Reorder",e),save:x("Save",e)},m=ge(()=>n.blockAttributes.collapsibleType==="off"?"":n.blockAttributes.collapsed?n.blockAttributes.collapsedTitle:n.blockAttributes.expandedTitle),a=()=>{window.wp.data.dispatch("core/block-editor").selectBlock(null),document?.activeElement?.blur()},d=()=>{const _=!n.blockAttributes.collapsed;n.blockAttributes.collapsed=_,window.wp.data.dispatch("core/block-editor").updateBlockAttributes(n.clientId,{...n.blockAttributes,collapsed:_})};return(_,T)=>(c(),y("header",We,[s("div",Xe,[t.blockAttributes.collapsibleType==="open"||t.blockAttributes.collapsibleType==="closed"?(c(),y("div",{key:0,class:"aioseo-toc-header-collapsible",onClick:d},[t.blockAttributes.collapsed?(c(),y("svg",et,[...T[1]||(T[1]=[s("path",{d:"M6 8H0V6H6V0H8V6H14V8H8V14H6V8Z",fill:"#005AE0"},null,-1)])])):(c(),y("svg",tt,[...T[2]||(T[2]=[s("path",{d:"M0 2V0H14V2H0Z",fill:"#005AE0"},null,-1)])]))])):A("",!0),t.blockAttributes.collapsibleType==="off"?(c(),y("span",ot,k(l.header),1)):A("",!0),j(" "+k(m.value)+" ",1),t.loadActions?(c(),E(v(xe),{key:2},{tooltip:B(()=>[Ae(_.$slots,"tooltip",{},()=>[j(k(l.tooltipMainDescription),1)])]),default:B(()=>[s("div",it,[$(v(ye))])]),_:3})):A("",!0)]),t.blockAttributes?.headings?.length===0&&t.loadActions?(c(),y("div",nt,k(l.instructions),1)):A("",!0),t.blockAttributes?.headings?.length!==0&&t.loadActions?(c(),y("div",lt,[s("a",{class:"aioseo-button-link",href:"#",onClick:T[0]||(T[0]=W(F=>i("showModal"),["prevent"]))},k(l.reorder),1),s("a",{class:"aioseo-button-link aioseo-button-link--primary",href:"#",onClick:W(a,["prevent"])},k(l.save),1)])):A("",!0)]))}},st={},rt={viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",class:"aioseo-eye-off"};function ct(t,o){return c(),y("svg",rt,[...o[0]||(o[0]=[s("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"},null,-1),s("path",{d:"M12 6a9.77 9.77 0 0 1 8.82 5.5 9.647 9.647 0 0 1-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6zm-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14zM2.01 3.87l2.68 2.68A11.738 11.738 0 0 0 1 11.5C2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45 2.01 3.87zm7.5 7.5 2.61 2.61c-.04.01-.08.02-.12.02a2.5 2.5 0 0 1-2.5-2.5c0-.05.01-.08.01-.13zm-3.4-3.4 1.75 1.75a4.6 4.6 0 0 0-.36 1.78 4.507 4.507 0 0 0 6.27 4.14l.98.98c-.88.24-1.8.38-2.75.38a9.77 9.77 0 0 1-8.82-5.5c.7-1.43 1.72-2.61 2.93-3.53z",fill:"currentColor"},null,-1)])])}const at=qe(st,[["render",ct]]),dt={class:"aioseo-toc-list-item__inner"},ht={key:0,class:"aioseo-drag-handle has-icon"},ut={class:"append-icon"},pt={class:"aioseo-tooltip__header"},wt=["onClick"],be={__name:"List",props:{headings:{required:!0,type:Array},clientId:{required:!0,type:String},allowReorder:{required:!1,type:Boolean,default:!1},group:{required:!1,type:String,default:"description"},parentBlockId:{required:!1,type:String,default:""}},setup(t){const o=$e(()=>Re(()=>import("../js/vendor-draggable.f9bdaf1b.js").then(w=>w.v),__vite__mapDeps([0,1,2,3]),import.meta.url)),e="all-in-one-seo-pack",i=t,n=me(),l=q(window.wp.data.select("core/block-editor").getBlockAttributes(i.clientId)||{}),m={tooltipHeader:x("Edit HTML Anchor:",e),tooltipDescription:G(x("The HTML anchor allows %1$s to link directly to your header from this table of contents block. Feel free to edit if you want, but an anchor is required. For headings without an anchor, %1$s will automatically generate them.",e),"AIOSEO")},a=ge(()=>({tag:l.value.listStyle,animation:300,group:i.group,disabled:!i.allowReorder,ghostClass:"aioseo-drag-ghost",dragClass:"aioseo-dragging"})),d=(w,h)=>{h.editedContent=w===h.content?"":pe(w,!0,!1),window.wp.data.dispatch("core/block-editor").updateBlockAttributes(i.clientId,{...l.value,headings:i.headings})},_=w=>(w.blockClientId===i.parentBlockId?w.headings=ie(w.headings,w.editedOrder):w.headings.map(_),w),T=w=>{if(l.value.reOrdered=!0,!w?.moved?.element)return;const b=we(l.value.headings),u=ie(b.map(_));window.wp.data.dispatch("core/block-editor").updateBlockAttributes(i.clientId,{...l.value,headings:u})},F=(w,h)=>{const b=h.blockClientId;if(window.wp.data.select("core/block-editor").getBlock(b)){if(h.anchor=X(w),!w){const r=window.wp.data.select("core/block-editor").getBlockIndex(b);h.anchor=n.aioseo.data.blocks.toc.hashPrefix+X(`${h.content}-${r}`)}window.wp.data.dispatch("core/block-editor").updateBlockAttributes(b,{anchor:h.anchor})}},P=(w,h)=>w?.map(b=>b.content===h.content&&b.level===Number(h.level)&&b.anchor===h.anchor?h:b.headings?P(b.headings,h):b),Z=w=>{if(w.hidden=!w.hidden,i.group==="nested"){window.wp.data.dispatch("core/block-editor").updateBlockAttributes(i.clientId,l.value);return}window.wp.data.dispatch("core/block-editor").updateBlockAttributes(i.clientId,P(l.value.headings,w))},N=w=>{const h=w.target.closest(".aioseo-toc-list-item"),b=h?.querySelector(".row-input--anchor input");b&&(h.classList.contains("anchor-edit")?(h.classList.add("anchor-is-animating"),h.classList.remove("anchor-edit"),h.classList.remove("done"),b.addEventListener("animationend",function u(){h.classList.remove("anchor-is-animating"),h.removeEventListener("animationend",u,!1)})):(b.focus({preventScroll:!0}),h.classList.add("anchor-edit","anchor-is-animating"),b.addEventListener("animationend",function u(){h.classList.remove("anchor-is-animating"),h.classList.add("done"),b.removeEventListener("animationend",u,!1)})))};return Y(()=>{K(()=>{window.aioseoBus.$on("updateToc"+i.clientId,()=>{l.value=window.wp.data.select("core/block-editor").getBlockAttributes(i.clientId)||{}})})}),(w,h)=>{const b=fe("List",!0);return c(),E(v(o),Se({class:["aioseo-toc-list",[{orderable:t.allowReorder}]]},a.value,{handle:".aioseo-drag-handle",list:i.headings,onChange:h[0]||(h[0]=u=>T(u)),"item-key":u=>u?.id||u.blockClientId}),{item:B(({element:u})=>[s("li",{class:Q(["aioseo-toc-list-item",{"heading-hidden":u.hidden}])},[s("div",dt,[t.allowReorder?(c(),y("button",ht,[$(v(Ne))])):A("",!0),$(v(le),{class:"row-input row-input--content",modelValue:u.editedContent||u.content,"onUpdate:modelValue":r=>d(r,u),placeholder:u.content},{"append-icon":B(()=>[t.allowReorder?A("",!0):(c(),y("div",{key:0,class:"append-icon",onClick:N},[$(v(Fe))]))]),_:1},8,["modelValue","onUpdate:modelValue","placeholder"]),t.allowReorder?A("",!0):(c(),E(v(le),{key:1,class:"row-input row-input--anchor",spellcheck:!1,modelValue:u.anchor,"onUpdate:modelValue":r=>F(r,u)},{"append-icon":B(()=>[s("div",ut,[$(v(xe),null,{tooltip:B(()=>[s("p",pt,k(m.tooltipHeader),1),s("p",null,k(m.tooltipDescription),1)]),default:B(()=>[s("div",null,[$(v(ye))])]),_:1}),s("div",{onClick:N},[$(v(ze))])])]),_:1},8,["modelValue","onUpdate:modelValue"])),t.allowReorder?A("",!0):(c(),y("button",{key:2,class:Q([{active:u.hidden},"aioseo-hide-heading-toggle","has-icon"]),onClick:r=>Z(u)},[u.hidden?(c(),E(v(at),{key:0})):(c(),E(v(De),{key:1}))],10,wt)),u.headings?(c(),E(b,{key:3,class:"aioseo-toc-list-nested",headings:u.headings,"parent-block-id":u.blockClientId,allowReorder:t.allowReorder,"client-id":t.clientId,group:u.anchor},null,8,["headings","parent-block-id","allowReorder","client-id","group"])):A("",!0)])],2)]),_:1},16,["class","list","item-key"])}}},gt=["href"],ft={__name:"ListRendered",props:{headings:{required:!0,type:Array},clientId:{required:!0,type:String}},setup(t){const o=t,e=q(window.wp.data.select("core/block-editor").getBlockAttributes(o.clientId)||{});return Y(()=>{K(()=>{window.aioseoBus.$on("updateToc"+o.clientId,()=>{e.value=window.wp.data.select("core/block-editor").getBlockAttributes(o.clientId)||{}})})}),(i,n)=>{const l=fe("ListRendered",!0);return c(),y("div",null,[(c(),E(Ee(e.value.listStyle),{class:"aioseo-toc-list--rendered"},{default:B(()=>[(c(!0),y(Be,null,Te(t.headings,(m,a)=>(c(),y("li",{class:Q(["aioseo-toc-list-item--rendered",[{hidden:m.hidden}]]),key:a},[s("a",{href:`#${m.anchor}`},k(m.editedContent||m.content),9,gt),m.headings?(c(),E(l,{key:0,class:"aioseo-toc-list-nested--rendered",headings:m.headings,"client-id":t.clientId},null,8,["headings","client-id"])):A("",!0)],2))),128))]),_:1}))])}}},mt={class:"aioseo-toc-header"},xt={class:"aioseo-toc-header-title"},yt={class:"aioseo-toc-header-buttons"},bt={__name:"Reorder",props:{headings:Array,show:Boolean,clientId:String},emits:["closeModal"],setup(t){const o="all-in-one-seo-pack",e={header:G(x("%1$s Table of Contents",o),"AIOSEO"),done:x("Done",o)};return(i,n)=>(c(),E(v(Pe),{show:t.show,noHeader:"",classes:["aioseo-toc-modal"],onClose:n[1]||(n[1]=l=>i.$emit("closeModal"))},{body:B(()=>[s("header",mt,[s("div",xt,k(e.header),1),s("div",yt,[s("a",{class:"aioseo-button-link aioseo-button-link--primary",href:"#",onClick:n[0]||(n[0]=W(l=>i.$emit("closeModal"),["prevent"]))},k(e.done),1)])]),$(v(be),{headings:t.headings,"client-id":t.clientId,allowReorder:""},null,8,["headings","client-id"])]),_:1},8,["show"]))}},vt={class:"aioseo-toc-container"},kt={key:0},Ct={key:0,class:"aioseo-toc-content"},_t={key:0,class:"aioseo-toc-rendered"},Ht={key:0},At={__name:"App",props:{clientId:{type:String,required:!0}},setup(t){const o=t,e=q(window.wp.data.select("core/block-editor").getBlockAttributes(o.clientId)),i=q(!1);return Y(()=>{K(()=>{window.aioseoBus.$on("updateToc"+o.clientId,()=>{e.value=window.wp.data.select("core/block-editor").getBlockAttributes(o.clientId)})})}),(n,l)=>(c(),y("div",vt,[s("div",{class:Q(["aioseo-toc-menu",{"aioseo-toc-placeholder":e.value?.headings?.length===0}])},[$(v(re),{"block-attributes":e.value,"load-actions":!0,onShowModal:l[0]||(l[0]=m=>i.value=!0)},null,8,["block-attributes"]),e.value.collapsed?A("",!0):(c(),y("div",kt,[e.value?.headings?.length!==0?(c(),y("div",Ct,[$(v(be),{headings:e.value?.headings,"client-id":t.clientId},null,8,["headings","client-id"])])):A("",!0)])),$(v(bt),{show:i.value,headings:e.value?.headings,"client-id":t.clientId,onCloseModal:l[1]||(l[1]=m=>i.value=!1)},null,8,["show","headings","client-id"])],2),e.value?.headings?.length!==0?(c(),y("div",_t,[$(v(re),{"block-attributes":e.value},null,8,["block-attributes"]),e.value.collapsed?A("",!0):(c(),y("div",Ht,[$(v(ft),{headings:e.value?.headings,"client-id":t.clientId},null,8,["headings","client-id"])]))])):A("",!0)]))}},St={class:"aioseo-toc-select-mode"},$t={class:"aioseo-toc-header-title"},Bt={class:"aioseo-toc-select-mode__collapsible"},Tt={key:0,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Et={key:1,width:"14",height:"2",viewBox:"0 0 14 2",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Vt={key:0},It={key:1},Ot={key:0},Mt={class:"aioseo-toc-select-mode__description"},Lt={class:"aioseo-toc-select-mode__selectors"},Rt={class:"aioseo-toc-select-mode__selector"},zt={class:"aioseo-toc-select-mode__selector-title"},Nt={class:"aioseo-toc-select-mode__selector-description"},Dt={class:"aioseo-toc-select-mode__selector"},qt={class:"aioseo-toc-select-mode__selector-title"},Ft={class:"aioseo-toc-select-mode__selector-description"},Pt={__name:"SelectMode",props:{clientId:{type:String,required:!0}},setup(t){const o="all-in-one-seo-pack",e=t,i=q(window.wp.data.select("core/block-editor").getBlockAttributes(e.clientId)),n={showTableOfContents:x("Show Table of Contents",o),hideTableOfContents:x("Hide Table of Contents",o),description:x("Choose whether you want this table of contents to be standalone or synced. You can change these block settings later from the block panel.",o),standaloneTitle:x("Standalone",o),standaloneDescription:x("Each ToC block acts independently, showing the same headings across all blocks for a unified navigation.",o),syncedTitle:x("Synced",o),syncedDescription:x("Multiple ToC blocks working together, pointing to different sections of your content with their own headings.",o),enableStandalone:x("Enable Standalone",o),enableSynced:x("Enable Synced",o)},l=a=>{window.wp.data.dispatch("core/block-editor").updateBlockAttributes(e.clientId,{mode:a})},m=()=>{const a=!i.value.collapsed;i.value.collapsed=a,window.wp.data.dispatch("core/block-editor").updateBlockAttributes(e.clientId,{collapsed:a})};return Y(()=>{K(()=>{window.aioseoBus.$on("updateToc"+e.clientId,()=>{i.value=window.wp.data.select("core/block-editor").getBlockAttributes(e.clientId)})})}),(a,d)=>(c(),y("div",St,[s("div",$t,[s("div",Bt,[s("div",{class:"aioseo-toc-header-collapsible",onClick:m},[i.value.collapsed?(c(),y("svg",Tt,[...d[2]||(d[2]=[s("path",{d:"M6 8H0V6H6V0H8V6H14V8H8V14H6V8Z",fill:"#005AE0"},null,-1)])])):(c(),y("svg",Et,[...d[3]||(d[3]=[s("path",{d:"M0 2V0H14V2H0Z",fill:"#005AE0"},null,-1)])]))]),s("p",null,[i.value.collapsed?(c(),y("span",Vt,k(n.showTableOfContents),1)):(c(),y("span",It,k(n.hideTableOfContents),1))])])]),i.value.collapsed?A("",!0):(c(),y("div",Ot,[s("p",Mt,k(n.description),1),s("div",Lt,[s("div",Rt,[d[4]||(d[4]=te('
',1)),s("h3",zt,k(n.standaloneTitle),1),s("p",Nt,k(n.standaloneDescription),1),$(v(se),{type:"blue",onClick:d[0]||(d[0]=_=>l("standalone")),size:"base"},{default:B(()=>[j(k(n.enableStandalone),1)]),_:1})]),s("div",Dt,[d[5]||(d[5]=te('',1)),s("h3",qt,k(n.syncedTitle),1),s("p",Ft,k(n.syncedDescription),1),$(v(se),{type:"blue",onClick:d[1]||(d[1]=_=>l("synced")),size:"base"},{default:B(()=>[j(k(n.enableSynced),1)]),_:1})])])]))]))}},Zt=window.wp,{CheckboxControl:Ut,SelectControl:ce,TextControl:ae}=Zt.components,R="all-in-one-seo-pack",jt=t=>{const{setAttributes:o,attributes:{listStyle:e,collapsibleType:i,collapsedTitle:n,mode:l,expandedTitle:m},clientId:a}=t;return React.createElement(React.Fragment,null,React.createElement(ce,{label:x("List Style",R),options:[{label:"Bullets",value:"ul"},{label:"Numbers",value:"ol"}],value:e,onChange:d=>{o({listStyle:d}),window.aioseoBus.$emit("updateToc"+a)},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),React.createElement(ce,{label:x("Collapsible",R),options:[{label:"Off",value:"off"},{label:"On - Open by default",value:"open"},{label:"On - Closed by default",value:"closed"}],value:i,onChange:d=>{o({collapsibleType:d}),window.aioseoBus.$emit("updateToc"+a)},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),i!=="off"&&React.createElement(ae,{label:x("Collapsed Title",R),value:n,onChange:d=>{o({collapsedTitle:d}),window.aioseoBus.$emit("updateToc"+a)},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),i!=="off"&&React.createElement(ae,{label:x("Expanded Title",R),value:m,onChange:d=>{o({expandedTitle:d}),window.aioseoBus.$emit("updateToc"+a)},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),React.createElement(Ut,{label:x("Synced Table of Contents",R),help:x("Syncing table of contents enables you to build one unified table of contents for documents with multiple sections, even using separate ToC blocks.",R),checked:l==="synced",onChange:()=>{o({mode:l==="synced"?"standalone":"synced"}),window.aioseoBus.$emit("updateToc"+a)},__nextHasNoMarginBottom:!0}))},Qt="all-in-one-seo-pack",I=window.wp,{useState:Gt,useEffect:de}=I.element,{InspectorControls:Jt}=I.blockEditor,{PanelBody:Yt}=I.components,{useSelect:Kt}=I.data,ve=I.blockEditor.store,{isTyping:Wt}=I.data.select(ve)||{isTyping:()=>null},J={HEADING:"core/heading",FAQ:"aioseo/faq",TOC:"aioseo/table-of-contents"},z=new Map;let D=[],U=null;const Xt=t=>t.question||t.content?.text||t.content||"",eo=(t,o,e)=>typeof t=="string"&&t!==""&&o<=e,to=(t,o,e,i=[],n)=>{const l=typeof t?.anchor=="string"&&t.anchor!=="",m=t.level||t.tagName.replace("h","");if(m==="div")return null;let a=Xt(t);if(!eo(a,e,o))return null;if(a=pe(a.replace(/(