import{g as x}from"../js/helpers.e70f7eb8.js";import{ap as P}from"../js/vendor-vue-ui.02763c14.js";import{l as L,b as B,u as k}from"../js/app-core.82d0a9b8.js";import{h as A,r as $}from"../js/utils.825d3528.js";import{_ as d}from"../js/vendor-other.2cdd5822.js";import"../js/vendor-datetime.430013a3.js";import"../js/vendor-lodash.f9514987.js";const l="all-in-one-seo-pack",S=window.wp,{PanelBody:H}=S.components,M=({clientId:n})=>{const o=`aioseo-${n}-settings`,t=()=>{window.aioseoBus.$emit("do-post-settings-main-tab-change",{name:"advanced",context:"metabox"}),S.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(H,{title:d("Breadcrumb Settings",l),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 ",l),React.createElement("a",{href:"#",onClick:()=>t()},d("Advanced > Breadcrumbs.",l))))))},O=A`
<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>
`,N="aioseo/breadcrumbs",Z="AIOSEO - Breadcrumbs",D="Displays the breadcrumb trail for the current page.",I="widgets",q={name:N,title:Z,description:D,category:I},r=window.wp,{useEffect:f,useRef:w}=r.element,{useSelect:J}=r.data,{InspectorControls:F}=r.blockEditor||r.editor,{Disabled:j}=r.components,y=r.serverSideRender||r.components.ServerSideRender,z=window?.aioseo?.currentPost?.postType??"";let _="";const b=window?.aioseo?.postData?.postTypes.find(n=>n.name===z);b&&0<b.taxonomies.length&&(_=b.taxonomies[0]);const{name:p,title:G,description:U,category:V}=q,W={title:G,description:U,category:V,icon:O,attributes:{primaryTerm:{type:"string",default:null},postTitle:{type:"string",default:null},breadcrumbSettings:{type:"object",default:{default:window?.aioseo?.currentPost?.breadcrumb_settings?.default??!0,separator:window?.aioseo?.currentPost?.breadcrumb_settings?.separator??"›",showHomeCrumb:window?.aioseo?.currentPost?.breadcrumb_settings?.showHomeCrumb??!0,showTaxonomyCrumbs:window?.aioseo?.currentPost?.breadcrumb_settings?.showTaxonomyCrumbs??!0,showParentCrumbs:window?.aioseo?.currentPost?.breadcrumb_settings?.showParentCrumbs??!0,template:window?.aioseo?.currentPost?.breadcrumb_settings?.template??"default",parentTemplate:window?.aioseo?.currentPost?.breadcrumb_settings?.parentTemplate??"default",taxonomy:window?.aioseo?.currentPost?.breadcrumb_settings?.taxonomy||_,primaryTerm:window?.aioseo?.currentPost?.breadcrumb_settings?.primaryTerm??null}}},edit:function(n){const{setAttributes:o,attributes:t,clientId:T}=n,h=B(),R=k(),s=w(null),g=w(!1),u=J(e=>e("core/editor").getEditedPostAttribute("title"));window.aioseoBus.$on("standalone-update-post",e=>{!e?.primary_term&&!e?.breadcrumb_settings||(e?.primary_term&&o({primaryTerm:JSON.stringify(e.primary_term)}),e?.breadcrumb_settings&&o({breadcrumbSettings:e.breadcrumb_settings}))});let i=t.breadcrumbSettings?.primaryTerm;if(t.breadcrumbSettings?.taxonomy){const e=x(t.breadcrumbSettings?.taxonomy,!0);e[0]&&e[0]!==i&&(i=e[0])}const C=h.aioseo.user,E=()=>{const e=R?.currentPost?.breadcrumb_settings;if(e){const m=JSON.stringify(t.breadcrumbSettings),a=JSON.stringify(e);m!==a&&o({breadcrumbSettings:e})}},v=()=>{if(g.current)return;g.current=!0,s.current?.querySelector(".aioseo-breadcrumbs")&&E()};return f(()=>{setTimeout(()=>{u!==t.postTitle&&o({postTitle:u})},1e3)},[u]),f(()=>{if(!s.current)return;const e=new MutationObserver(m=>{for(const a of m)if(a.type==="childList"&&0<a.addedNodes.length){const c=s.current?.querySelector(".aioseo-breadcrumbs");if(c&&c.innerHTML.trim()&&!c.innerHTML.includes("Loading...")&&!c.querySelector(".components-spinner")){v(),e.disconnect();break}}});return e.observe(s.current,{childList:!0,subtree:!0}),()=>e.disconnect()},[]),React.createElement(React.Fragment,null,C.capabilities.aioseo_page_advanced_settings&&React.createElement(F,null,React.createElement(M,{clientId:T})),React.createElement("div",{ref:s},window.aioseo.options.breadcrumbs.enable?React.createElement(j,null,React.createElement(y,{block:p,attributes:{primaryTerm:t.primaryTerm,postTitle:t.postTitle,breadcrumbSettings:{...t.breadcrumbSettings,primaryTerm:i}}})):React.createElement(y,{block:p,attributes:{primaryTerm:t.primaryTerm,postTitle:t.postTitle,breadcrumbSettings:{...t.breadcrumbSettings,primaryTerm:i}}})))},save:function(){return null}},Y=P({});L(Y);$({name:p,settings:W});
