import{g as X}from"../js/helpers.2cc9d8ec.js";import{u as ee,a as te}from"../js/index.317ad629.js";import{h as re,r as ne}from"../js/utils.6d965f64.js";import"../js/translations.e71e2202.js";import{_ as d}from"../js/default-i18n.65d58dd6.js";import"../js/runtime-core.esm-bundler.ce5add0b.js";import"../js/helpers.633a054c.js";const g="all-in-one-seo-pack",G=window.wp,{PanelBody:se}=G.components,oe=({clientId:a})=>{const o=`aioseo-${a}-settings`,r=()=>{window.aioseoBus.$emit("do-post-settings-main-tab-change",{name:"advanced",context:"metabox"}),G.data.dispatch("core/edit-post").openGeneralSidebar("aioseo-post-settings-sidebar/aioseo-post-settings-sidebar"),setTimeout(()=>{window.aioseoBus.$emit("do-post-settings-main-tab-change",{name:"advanced",context:"sidebar"})},100)};return React.createElement(se,{title:d("Breadcrumb Settings",g),initialOpen:!0},React.createElement("div",null,React.createElement("div",{id:o},React.createElement("p",{className:"aioseo-breadcrumbs-sidebar-text"},d("You can customize your breadcrumb trail under ",g),React.createElement("a",{href:"#",onClick:()=>r()},d("Advanced > Breadcrumbs.",g))))))},ae=re`
<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
	<path d="M1.7002 5.31067H10.8705L17.8705 12.5L10.8705 19.6893H1.7002V5.31067ZM10.2856 12.4999C10.2856 13.3284 9.61396 14.0001 8.7854 14.0001C7.95684 14.0001 7.28516 13.3284 7.28516 12.4999C7.28516 11.6713 7.95684 10.9996 8.7854 10.9996C9.61396 10.9996 10.2856 11.6713 10.2856 12.4999ZM6.1933 12.5001C6.1933 13.195 5.62995 13.7584 4.93503 13.7584C4.2401 13.7584 3.67676 13.195 3.67676 12.5001C3.67676 11.8052 4.2401 11.2418 4.93503 11.2418C5.62995 11.2418 6.1933 11.8052 6.1933 12.5001ZM12.6342 13.7584C13.3292 13.7584 13.8925 13.195 13.8925 12.5001C13.8925 11.8052 13.3292 11.2418 12.6342 11.2418C11.9393 11.2418 11.376 11.8052 11.376 12.5001C11.376 13.195 11.9393 13.7584 12.6342 13.7584ZM15.3002 5.31067H12.5771L19.5771 12.5L12.5771 19.6893H15.3002L22.3002 12.5L15.3002 5.31067Z" fill="black"/>
</svg>
`,ce="https://schemas.wp.org/wp/5.8/block.json",ie="aioseo/breadcrumbs",ue="AIOSEO - Breadcrumbs",me="Displays the breadcrumb trail for the current page.",le="widgets",be=["breadcrumb","breadcrumbs","breadcrumb trail","crumb","crumbs","crumb trail","hierarchy","links","menu","navigation","schema","seo","trail"],de={primaryTerm:{type:"string",default:null},postTitle:{type:"string",default:null},breadcrumbSettings:{type:"object",default:{default:!0,separator:"›",showHomeCrumb:!0,showParentCrumbs:!0,showTaxonomyCrumbs:!0,template:"default",parentTemplate:"default",taxonomy:"",primaryTerm:null}}},ge="all-in-one-seo-pack",pe={html:!1},fe={$schema:ce,name:ie,title:ue,description:me,category:le,keywords:be,attributes:de,textdomain:ge,supports:pe},s=window.wp,{useEffect:_,useRef:C}=s.element,{useSelect:ye}=s.data,{InspectorControls:we}=s.blockEditor||s.editor,{Disabled:Te}=s.components,R=s.serverSideRender||s.components.ServerSideRender;var x,v;const he=((v=(x=window==null?void 0:window.aioseo)==null?void 0:x.currentPost)==null?void 0:v.postType)??"";let U="";var P,S;const p=(S=(P=window==null?void 0:window.aioseo)==null?void 0:P.postData)==null?void 0:S.postTypes.find(a=>a.name===he),e=ee();p&&0<p.taxonomies.length&&(U=p.taxonomies[0]);const{name:f,title:_e,description:Ce,category:Re}=fe;var k,L,B,$,A,H,M,O,N,Z,D,I,j,q,J,F,z,E;const xe={title:_e,description:Ce,category:Re,icon:ae,attributes:{primaryTerm:{type:"string",default:null},postTitle:{type:"string",default:null},breadcrumbSettings:{type:"object",default:{default:((L=(k=e==null?void 0:e.currentPost)==null?void 0:k.breadcrumb_settings)==null?void 0:L.default)??!0,separator:(($=(B=e==null?void 0:e.currentPost)==null?void 0:B.breadcrumb_settings)==null?void 0:$.separator)??"›",showHomeCrumb:((H=(A=e==null?void 0:e.currentPost)==null?void 0:A.breadcrumb_settings)==null?void 0:H.showHomeCrumb)??!0,showTaxonomyCrumbs:((O=(M=e==null?void 0:e.currentPost)==null?void 0:M.breadcrumb_settings)==null?void 0:O.showTaxonomyCrumbs)??!0,showParentCrumbs:((Z=(N=e==null?void 0:e.currentPost)==null?void 0:N.breadcrumb_settings)==null?void 0:Z.showParentCrumbs)??!0,template:((I=(D=e==null?void 0:e.currentPost)==null?void 0:D.breadcrumb_settings)==null?void 0:I.template)??"default",parentTemplate:((q=(j=e==null?void 0:e.currentPost)==null?void 0:j.breadcrumb_settings)==null?void 0:q.parentTemplate)??"default",taxonomy:((F=(J=e==null?void 0:e.currentPost)==null?void 0:J.breadcrumb_settings)==null?void 0:F.taxonomy)||U,primaryTerm:((E=(z=e==null?void 0:e.currentPost)==null?void 0:z.breadcrumb_settings)==null?void 0:E.primaryTerm)??null}}},edit:function(a){var w,T,h;const{setAttributes:o,attributes:r,clientId:V}=a,W=te(),c=C(null),y=C(!1),b=ye(t=>t("core/editor").getEditedPostAttribute("title"));window.aioseoBus.$on("standalone-update-post",t=>{!(t!=null&&t.primary_term)&&!(t!=null&&t.breadcrumb_settings)||(t!=null&&t.primary_term&&o({primaryTerm:JSON.stringify(t.primary_term)}),t!=null&&t.breadcrumb_settings&&o({breadcrumbSettings:t.breadcrumb_settings}))});let i=(w=r.breadcrumbSettings)==null?void 0:w.primaryTerm;if((T=r.breadcrumbSettings)!=null&&T.taxonomy){const t=X((h=r.breadcrumbSettings)==null?void 0:h.taxonomy,!0);t[0]&&t[0]!==i&&(i=t[0])}const Y=W.aioseo.user,K=()=>{var n;const t=(n=e==null?void 0:e.currentPost)==null?void 0:n.breadcrumb_settings;if(t){const u=JSON.stringify(r.breadcrumbSettings),m=JSON.stringify(t);u!==m&&o({breadcrumbSettings:t})}},Q=()=>{var n;if(y.current)return;y.current=!0,((n=c.current)==null?void 0:n.querySelector(".aioseo-breadcrumbs"))&&K()};return _(()=>{setTimeout(()=>{b!==r.postTitle&&o({postTitle:b})},1e3)},[b]),_(()=>{if(!c.current)return;const t=new MutationObserver(n=>{var u;for(const m of n)if(m.type==="childList"&&0<m.addedNodes.length){const l=(u=c.current)==null?void 0:u.querySelector(".aioseo-breadcrumbs");if(l&&l.innerHTML.trim()&&!l.innerHTML.includes("Loading...")&&!l.querySelector(".components-spinner")){Q(),t.disconnect();break}}});return t.observe(c.current,{childList:!0,subtree:!0}),()=>t.disconnect()},[]),React.createElement(React.Fragment,null,Y.capabilities.aioseo_page_advanced_settings&&React.createElement(we,null,React.createElement(oe,{clientId:V})),React.createElement("div",{ref:c},window.aioseo.options.breadcrumbs.enable?React.createElement(Te,null,React.createElement(R,{block:f,attributes:{primaryTerm:r.primaryTerm,postTitle:r.postTitle,breadcrumbSettings:{...r.breadcrumbSettings,primaryTerm:i}}})):React.createElement(R,{block:f,attributes:{primaryTerm:r.primaryTerm,postTitle:r.postTitle,breadcrumbSettings:{...r.breadcrumbSettings,primaryTerm:i}}})))},save:function(){return null}};ne({name:f,settings:xe});
