File: //proc/self/cwd/wp-content/plugins/wordpress-seo-premium/assets/js/dist/blocks-2760.min.js
(()=>{"use strict";var e={n:t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return e.d(s,{a:s}),s},d:(t,s)=>{for(var o in s)e.o(s,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:s[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.lodash,s=window.wp.blocks,o=window.wp.blockEditor,n=window.wp.components,r=window.wp.data,i=window.wp.domReady;var a=e.n(i);const l=window.wp.element,c=window.wp.i18n,u=window.wp.a11y,d=window.wp.url,p=window.yoast.helpers,g=window.yoast.propTypes;var h=e.n(g);const m=window.yoast.styledComponents;var b=e.n(m);const w=window.yoast.componentsNew,f=window.yoast.styleGuide,y=window.ReactJSXRuntime,x=b().div`
display: flex;
align-items: normal;
min-height: 40px;
margin: 10px 0 5px;
`,k=(0,p.createSvgIconComponent)({copy:{viewbox:"0 0 448 512",path:"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"},check:{viewbox:"0 0 512 512",path:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}}),v=b().div`
background-color: #e5e5e5;
width: 100%;
height: 1px;
`,_=b().button`
box-sizing: border-box;
flex: 0 0 30px;
height: 30px;
width: 30px;
background-color: ${e=>e.iconBackground};
border-radius: 5px;
cursor: pointer;
outline: none;
border: 1px solid ${e=>e.iconBorder};
margin-left: 3px;
&:focus {
box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8);
}
`;_.props={iconBackground:h().string,iconBorder:h().string},_.defaultProps={iconBackground:f.colors.$color_button,iconBorder:f.colors.$color_button_border};const j=b().div`
flex: auto;
`,R=(0,p.makeOutboundLink)(b().a`
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
/* -webkit-box-orient: vertical; */
/* -moz-box-orient: vertical; */
max-height: 40px;
margin-bottom: 4px;
-webkit-box-orient: vertical;
overflow: hidden;
padding: 0 0 4px;
`),B=b().div`
flex-wrap: wrap;
display: flex;
flex-direction: row;
justify-content: unset;
margin-top: 4px;
`,A=b().span`
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
padding: 3px 8px;
font-size: 0.85em;
background-color: #f3f4f5;
border-radius: 2px;
margin-bottom: 4px;
margin-right: 4px;
text-transform: lowercase;
`,L=({badges:e})=>(0,y.jsx)(B,{children:e.map(((e,t)=>(0,y.jsx)(A,{children:e},t)))});L.propTypes={badges:h().array.isRequired};const T=({value:e,url:t,isActive:s,labels:o})=>{const n=(0,c.__)("Copy link","wordpress-seo-premium"),r=(0,c.sprintf)(/* translators: Hidden accessibility text; %s expands to the link value */ /* translators: Hidden accessibility text; %s expands to the link value */
(0,c.__)("Copy link to suggested article: %s","wordpress-seo-premium"),e),i=(0,l.useCallback)((e=>{e.nativeEvent.target.setAttribute("aria-label",r),e.nativeEvent.target.setAttribute("data-label",n)}),[r,n]);let a="copy",u=f.colors.$color_black,d=f.colors.$color_button,p="#979797";return s&&(a="check",u=f.colors.$color_alert_success_text,d=f.colors.$color_alert_success_background,p=f.colors.$color_alert_success_background),(0,y.jsxs)("div",{children:[(0,y.jsx)(v,{}),(0,y.jsxs)(x,{className:"yoast-link-suggestion__wrapper",children:[(0,y.jsxs)(j,{className:"yoast-link-suggestion__container",children:[(0,y.jsx)(R,{href:t,children:e}),(0,y.jsx)(L,{badges:o})]}),(0,y.jsxs)(_,{type:"button",className:"yoast-link-suggestion__copy yoast-tooltip yoast-tooltip-alt yoast-tooltip-s",onBlur:i,"data-clipboard-text":t,"aria-label":r,"data-label":n,iconBackground:d,iconBorder:p,children:[(0,y.jsx)(k,{icon:a,color:u}),(0,y.jsx)(w.ScreenReaderText,{children:n})]})]})]})};T.propTypes={value:h().string.isRequired,url:h().string.isRequired,isActive:h().bool,labels:h().array.isRequired},T.defaultProps={isActive:!1};const q=T,S=window.React;S.forwardRef((function(e,t){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),S.createElement("path",{fillRule:"evenodd",d:"M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"}))}));const C=window.yoast.uiLibrary,M=(e,t)=>{try{return(0,l.createInterpolateElement)(e,t)}catch(t){return console.error("Error in translation for:",e,t),e}};h().string.isRequired,h().shape({src:h().string.isRequired,width:h().string,height:h().string}).isRequired,h().shape({value:h().bool.isRequired,status:h().string.isRequired,set:h().func.isRequired}).isRequired;const N=({href:e,children:t,...s})=>(0,y.jsxs)(C.Link,{target:"_blank",rel:"noopener noreferrer",...s,href:e,children:[t,(0,y.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
(0,c.__)("(Opens in a new browser tab)","wordpress-seo-premium")})]});N.propTypes={href:h().string.isRequired,children:h().node},N.defaultProps={children:null};window.yoast.reactHelmet;h().string.isRequired,h().shape({src:h().string.isRequired,width:h().string,height:h().string}).isRequired,h().shape({value:h().bool.isRequired,status:h().string.isRequired,set:h().func.isRequired}).isRequired,h().func.isRequired,h().string.isRequired,h().string.isRequired,h().string.isRequired,h().string.isRequired;const E=b().div`
display: table-cell;
`;let P;const H=e=>{const t=(0,c.__)("Copied!","wordpress-seo-premium");e.trigger.focus(),e.trigger.setAttribute("aria-label",t),e.trigger.setAttribute("data-label",t),(0,u.speak)(t,"assertive")},I=e=>{const t=(0,c.__)("Not supported!","wordpress-seo-premium");e.trigger.el.setAttribute("aria-label",t),e.trigger.setAttribute("data-label",t),(0,u.speak)(t,"assertive")},O=({suggestions:e,maxSuggestions:t,customMessages:s,location:o})=>{const n=function(e){const t=(0,p.makeOutboundLink)(),s=(0,d.addQueryArgs)(wpseoAdminL10n["shortlinks.site_structure_metabox"],{context:e});return M(
// Translators: Text between {{a}} and {{/a}} will be a link to an article about site structure.
// Translators: Text between {{a}} and {{/a}} will be a link to an article about site structure.
(0,c.__)("{{a}}Read our guide on internal linking for SEO{{/a}} to learn more.","wordpress-seo-premium").replace("{{a}}","<a>").replace("{{/a}}","</a>"),{a:(0,y.jsx)(t,{href:s})})}(o);return 0===e.length?(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{children:""===s.lengthMessage?(0,c.__)("We could not find any relevant articles on your website that you could link to from your post.","wordpress-seo-premium"):s.lengthMessage}),(0,y.jsx)("p",{children:s.metaMessage}),(0,y.jsx)("p",{children:n})]}):(e.length>t&&(e.length=t),(0,y.jsxs)(E,{children:[(0,y.jsxs)("p",{children:[(0,c.__)("To improve your site structure, consider linking to other relevant posts or pages on your website.","wordpress-seo-premium")," ",n]}),(0,y.jsx)("p",{children:s.metaMessage}),e.map(((e,t)=>(0,y.jsx)(q,{...e},t)))]}))};O.propTypes={suggestions:h().array.isRequired,maxSuggestions:h().number,customMessages:h().object,location:h().string},O.defaultProps={maxSuggestions:10,customMessages:{lengthMessage:"",metaMessage:""},location:""};const $=()=>{window.open("admin.php?page=wpseo_tools&start-indexation=true","yoastSeoAnalyzeProminentWords")},D=()=>{const e=(0,r.select)("yoast-seo/editor").getPreference("isRtl",!1);return(0,y.jsx)(C.Root,{context:{isRtl:e},children:(0,y.jsx)("div",{className:"yst-flex yst-justify-center",children:(0,y.jsxs)(C.Alert,{variant:"warning",className:"yst-mb-4 yst-mx-0 yst-max-w-2xl",children:[(0,y.jsx)(C.Title,{as:"span",size:"5",className:"yst-mb-2 yst-text-inherit",children:(0,c.__)("Unable to provide linking suggestions","wordpress-seo-premium")}),(0,y.jsx)("p",{className:"yst-mt-0 yst-mb-3",children:M((0,c.sprintf)(/* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */ /* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */
(0,c.__)("We need to optimize your site’s SEO data so we can offer you the best %1$slinking suggestions%2$s.","wordpress-seo-premium"),"<a>","</a>"),{a:(0,y.jsx)(N,{href:wpseoAdminL10n["shortlinks.notification_internal_link"]})})}),(0,y.jsx)(C.Button,{variant:"secondary",onClick:$,children:(0,c.__)("Start SEO data optimization","wordpress-seo-premium")})]})})})},z=e=>{if((0,l.useEffect)((()=>(e.suggester.subscribe(),()=>{e.suggester.unsubscribe()})),[]),e.isLoading)return(0,y.jsx)("div",{className:"yoast-link-suggestions",children:(0,y.jsx)("p",{children:(0,c.__)("It takes a few seconds to show you a list of related content to which you could link. The suggestions will be shown here as soon as we have them.","wordpress-seo-premium")})});P||(P=new ClipboardJS(".yoast-link-suggestion__copy"),P.on("success",H),P.on("error",I));let t=null;e.showUnindexedWarning&&(t=D());const s=(e=>{let t="";e.hasWordsForLinking||(t=(0,c.__)("Once you add a bit more copy, we'll give you a list of related content here to which you could link in your post.","wordpress-seo-premium"));const s=((e,t,s)=>{switch(!0){case s&&!t&&""===e:return(0,c.__)("Add a title to your post for the best internal linking suggestions.","wordpress-seo-premium");case!s&&t&&""===e:return(0,c.__)("Add a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium");case!s&&!t&&""===e:return(0,c.__)("Add a title and a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium");case s&&!t&&""!==e:return(0,c.__)("Also, add a title to your post for the best internal linking suggestions.","wordpress-seo-premium");case!s&&t&&""!==e:return(0,c.__)("Also, add a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium");case!s&&!t&&""!==e:return(0,c.__)("Also, add a title and a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium")}})(t,e.hasTitle,e.hasMetaDescription);return{lengthMessage:t,metaMessage:s}})({...e.messageData,hasWordsForLinking:Array.isArray(e.wordsForLinking)&&e.wordsForLinking.length>0});return(0,y.jsxs)("div",{className:"yoast-link-suggestions",children:[t,(0,y.jsx)(O,{suggestions:e.suggestions,customMessages:s,location:e.location})]})};function F(e,t){for(const s of e)t(s),s.innerBlocks&&F(s.innerBlocks,t)}z.propTypes={suggester:h().object,suggestions:h().array.isRequired,wordsForLinking:h().array,messageData:h().object,isLoading:h().bool.isRequired,showUnindexedWarning:h().bool,location:h().string},z.defaultProps={suggester:null,showUnindexedWarning:!1,messageData:{hasMetaDescription:!1,hasTitle:!1},wordsForLinking:[],location:""};const W=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"version":"23.0","name":"yoast-seo/related-links","title":"Yoast Related Links","description":"Adds a list of links related to this page.","category":"yoast-internal-linking-blocks","icon":"editor-ul","keywords":["SEO","internal linking","site structure","related posts","related pages"],"textdomain":"wordpress-seo-premium","attributes":{"status":{"type":"string","default":"loading"},"values":{"type":"string","source":"html","selector":"ul","multiline":"li","default":""}},"example":{"attributes":{"status":"loaded","values":"<li><a href=\'https://example.org\'>Related link 1</a></li> <li><a href=\'https://example.org\'>Related link 2</a></li> <li><a href=\'https://example.org\'>Related link 3</a></li>"}}}');function U(e,t,s,o){t!==s&&o(e,{status:t})}function V(e){if(!(0,r.select)("yoast-seo-premium/editor"))return void setTimeout(V.bind(null,e),500);(0,t.get)(YoastSEO,"analysis.linkSuggester")&&YoastSEO.analysis.linkSuggester.update();const{linkSuggestionsAreLoading:s}=(0,r.select)("yoast-seo-premium/editor"),{getBlockAttributes:o}=(0,r.select)("core/block-editor"),n=o(e);"loaded"!==n.status&&(s()?setTimeout(V.bind(null,e),500):function(e,t){const{linkSuggestionsAreUnindexed:s,getLinkSuggestions:o,getWordsForLinking:n}=(0,r.select)("yoast-seo-premium/editor"),{updateBlockAttributes:i}=(0,r.dispatch)("core/block-editor");if(s())return void U(e,"unindexed",t.status,i);const a=n();if(!Array.isArray(a)||0===a.length)return void U(e,"no-content",t.status,i);const l=o();0!==l.length?"loading"===t.status?i(e,{values:l.map((e=>`<li><a href="${e.url}">${e.value}</a></li>`)).join(""),status:"loaded"}):U(e,"has-suggestions",t.status,i):U(e,"no-suggestions",t.status,i)}(e,n))}function Y(e,t="warning",s){const o=`notice notice-${t} notice-alt wpseo-notice-breakout-inside yoast-links-suggestions-notice`,n=[s.className,o].filter(Boolean).join(" ");return(0,y.jsx)("div",{...s,className:n,children:(0,y.jsx)("p",{children:e})})}function J(){return(0,r.select)("yoast-seo-premium/editor")?(0,r.select)("yoast-seo-premium/editor").getLinkSuggestions():null}function G(){return(0,r.select)("yoast-seo-premium/editor")?(0,r.select)("yoast-seo-premium/editor").getWordsForLinking():null}const Q=window.wp.hooks,X=window.yoast.analysis,K=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"version":"23.1","name":"yoast-seo/table-of-contents","title":"Yoast Table of Contents","description":"Adds a table of contents to this page.","category":"yoast-internal-linking-blocks","icon":"editor-ul","keywords":["SEO","links","toc","site structure"],"textdomain":"wordpress-seo-premium","attributes":{"title":{"type":"string","source":"html","selector":"h1,h2,h3,h4,h5,h6","default":"Table of contents"},"level":{"type":"number","default":2},"maxHeadingLevel":{"type":"number","default":3},"headings":{"type":"array","source":"query","selector":"a","query":{"content":{"type":"string","source":"html"},"href":{"type":"string","source":"attribute","attribute":"href"},"level":{"type":"string","source":"attribute","attribute":"data-level"}}}},"example":{"attributes":{"headings":[{"content":"Heading 1","href":"#heading-1","level":"2"},{"content":"Subheading 1","href":"#subheading-1","level":"3"},{"content":"Subheading 2","href":"#subheading-2","level":"3"},{"content":"Heading 2","href":"#heading-2","level":"2"}]}}}'),{stripHTMLTags:Z}=X.languageProcessing,ee=(e,o)=>{const n=`h-${function(e){const s=new RegExp("[^\\p{L}\\p{N}]+","gu");return(0,t.trim)((0,t.deburr)(Z(e)).replace(s,"-").toLowerCase(),"-")}((0,s.getBlockContent)(e))}`;let r=n,i=0;for(;o.includes(r);)r=`${n}-${i}`,i++;return r};const te=()=>{const e=(0,r.select)("core/editor"),t=(0,r.select)("core/block-editor");return e?e.getEditorBlocks():t.getBlocks()},se=e=>{const t=[];return F(e,(e=>{"core/heading"===e.name&&t.push(e.attributes.anchor)})),t};function oe(e,t){let s=e;for(;s&&s.level>=t;)s=s.parent;return s}function ne(e){const t=e.map((e=>{let t=null;return e.children&&e.children.length>0&&(t=ne(e.children)),(0,y.jsxs)("li",{children:[(0,y.jsx)("a",{href:e.href,"data-level":e.level,children:e.content}),t]},e.href)}));return(0,y.jsx)("ul",{children:t})}function re(e,t=99){return e&&0!==e.length?ne(e=function(e){const t=[];let s;for(const o of e){const e=parseInt(o.level,10),n={children:[],parent:null,...o,level:e},r=oe(s,e);r?(n.parent=r,r.children.push(n)):t.push(n),s=n}return t}(e=e.filter((e=>e.level<=t)))):null}(0,Q.addFilter)("blocks.switchToBlockType.transformedBlock","yoast-seo-table-of-contents/transformed-block",(e=>{if((0,t.isNil)(e.attributes.anchor)&&"core/heading"===e.name){const t=te(),s=se(t);e.attributes.anchor=ee(e,s)}return e})),a()((()=>{window.wpseoPremiumMetaboxData?function(){let e=(0,r.select)("core/block-editor").getBlocks(),s=G(),o=J();(0,r.subscribe)((()=>{const n=(0,r.select)("core/block-editor").getBlocks(),i=G(),a=J(),l=!(0,t.isEqual)(e,n),c=!(0,t.isEqual)(s,i),u=!(0,t.isEqual)(o,a);(l||c||u)&&F(n,(e=>{"yoast-seo/related-links"===e.name&&(l&&"loading"===e.attributes.status?V(e.clientId):(c&&"no-content"===e.attributes.status&&V(e.clientId),u&&"loaded"!==e.attributes.status&&V(e.clientId)))})),e=n,s=i,o=a}))}():(0,s.unregisterBlockType)("yoast-seo/related-links")})),(0,s.registerBlockType)(W,{edit:function({clientId:e,attributes:t,setAttributes:i}){const{status:a}=t,u=()=>{i({status:"loading"}),V(e)};(0,l.useEffect)((()=>{"loaded"!==a&&u()}),[]),function(e,t){const o=(0,r.useRegistry)(),{updateBlockAttributes:n,replaceInnerBlocks:i}=(0,r.dispatch)("core/block-editor");(0,l.useEffect)((()=>{if(!e.values)return;const[r,a]=function(e){const{values:t,...o}=e,n=document.createElement("ul");n.innerHTML=t;const[r]=(0,s.rawHandler)({HTML:n.outerHTML});return[{...o,...r.attributes},r.innerBlocks]}(e);o.batch((()=>{n(t,r),i(t,a)}))}),[e.values])}(t,e);const d=(0,o.useBlockProps)(),p=(0,o.useInnerBlocksProps)(d,{allowedBlocks:["core/list-item"],templateLock:!1,templateInsertUpdatesSelection:!0});if(!(window.wpseoPremiumMetaboxData.data.restApi.available&&window.wpseoPremiumMetaboxData.data.restApi.contentEndpointsAvailable&&"enabled"===window.wpseoPremiumMetaboxData.data.linkSuggestionsEnabled&&window.wpseoPremiumMetaboxData.data.linkSuggestionsAvailable)&&"loaded"!==a)return Y(M((0,c.__)("You have disabled Link suggestions, which is needed for Related links to work. If you want to add Related links, please go to <a>Site features</a> and enable Link suggestions.","wordpress-seo-premium"),{a:(0,y.jsx)("a",{href:wpseoPremiumMetaboxData.data.settingsPageUrl,target:"_blank",children:"#21441-gutenberg"})}),"error",d);if("loaded"!==a)return function(e,t,s){if("unindexed"===e)return(0,y.jsx)("div",{...s,children:D()});let o=(0,c.__)("We could not find any relevant articles on your website that you could link to from your post.","wordpress-seo-premium");return"no-content"===e&&(o=(0,c.__)("Once you add a bit more copy, we'll give you a list of related content here to which you could link in your post.","wordpress-seo-premium")),"loading"===e&&(o=(0,c.__)("It takes a few seconds to show you a list of related content to which you could link. The suggestions will be shown here as soon as we have them.","wordpress-seo-premium")),"has-suggestions"===e&&(o=(0,y.jsxs)(l.Fragment,{children:[o,(0,y.jsx)("br",{}),(0,y.jsx)("br",{}),(0,y.jsx)("button",{type:"button",className:"button",onClick:t,children:(0,c.__)("Load suggestions","wordpress-seo-premium")})]})),Y(o,"warning",s)}(a,u,d);const g=(0,y.jsx)(o.BlockControls,{children:(0,y.jsx)(n.ToolbarGroup,{controls:[{icon:"image-rotate",title:(0,c.__)("Refresh suggestions","wordpress-seo-premium"),isActive:!1,onClick:u}]})});return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("ul",{...p}),g]})},save:function({attributes:e}){if("loaded"!==e.status)return null;const t=o.useBlockProps.save({className:"yoast-seo-related-links"}),s=o.useInnerBlocksProps.save(t);return(0,y.jsx)("ul",{...s})},deprecated:[{attributes:{status:{type:"string",default:"loading"},values:{type:"string",source:"html",selector:"ul",multiline:"li",default:""}},save:({attributes:e})=>"loaded"!==e.status?null:(0,y.jsx)(o.RichText.Content,{tagName:"ul",multiline:"li",value:e.values})}]}),(0,t.get)(window,"wpseoTOCData.data.disableTableOfContents",!1)||(a()((()=>{!function(){let e=null,o="",n=!1,i=[];const a={};(0,r.subscribe)((()=>{if(n)return;const l=te(),c=[];if(e!==l){const e=[],u=[];let d="";n=!0;const p=se(l).every((e=>(0,t.isUndefined)(e)));F(l,(o=>{if("core/heading"===o.name){const l=Z((0,s.getBlockContent)(o)),u=o.attributes.level,g=function(e,o,n,i,a){let l=e.attributes.anchor;const c=o[e.clientId],u=Z((0,s.getBlockContent)(e));return c&&c===u||l&&!l.startsWith("h-")||(l=function(e,o,n,r){return!(0,t.isNil)(e.attributes.anchor)||r||(0,t.isEmpty)((0,s.getBlockContent)(e))||n.includes(e.clientId)?ee(e,o):""}(e,n,i,a),l!==e.attributes.anchor&&(0,r.dispatch)("core/block-editor").updateBlockAttributes(e.clientId,{anchor:l})),l}(o,a,c,i,p);if(a[o.clientId]=l,""===g||(0,t.isEmpty)(l))return;c.push(g),e.push({content:(n=l,(new DOMParser).parseFromString(n,"text/html").documentElement.textContent),href:"#"+g,level:u}),d+="$"+u+":"+g+":"+l}else u.push(o.clientId);var n})),F(l,(t=>{if("yoast-seo/table-of-contents"===t.name){const s=t.attributes.headings&&t.attributes.headings.length>0;(o!==d||e.length>0&&!s)&&(0,r.dispatch)("core/block-editor").updateBlockAttributes(t.clientId,{headings:e})}})),n=!1,o=d,i=u}e=l}))}()})),K.attributes&&K.attributes.title&&K.attributes.title.default&&(K.attributes.title.default=(0,c.__)("Table of contents","wordpress-seo-premium")),(0,s.registerBlockType)(K,{edit:function({attributes:e,setAttributes:t}){const s=(0,l.useCallback)((e=>t({title:e})),[t]),r=(0,l.useCallback)((e=>t({level:e})),[t]),i=(0,l.useCallback)((e=>t({maxHeadingLevel:Number(e)})),[t]),a=(0,o.useBlockProps)({className:"yoast-table-of-contents"});return(0,y.jsxs)(l.Fragment,{children:[(0,y.jsx)(o.BlockControls,{children:(0,y.jsx)(n.ToolbarGroup,{children:(0,y.jsx)(o.HeadingLevelDropdown,{value:e.level,options:[1,2,3,4,5,6],onChange:r})})}),(0,y.jsx)(o.InspectorControls,{children:(0,y.jsx)(n.PanelBody,{title:(0,c.__)("Settings","wordpress-seo-premium"),className:"yoast-table-of-contents-controls",children:(0,y.jsx)(n.SelectControl,{label:(0,c.__)("Maximum heading level","wordpress-seo-premium"),value:e.maxHeadingLevel,options:[1,2,3,4,5,6].map((e=>({label:(0,c.sprintf)((0,c.__)("Heading %d"),e),value:e}))),onChange:i,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})})}),(0,y.jsxs)("div",{...a,children:[(0,y.jsx)(o.RichText,{tagName:"h"+e.level,value:e.title,onChange:s}),re(e.headings,e.maxHeadingLevel)]})]})},save:function({attributes:e}){let t=null;e.title&&(t=(0,y.jsx)(o.RichText.Content,{tagName:"h"+e.level,value:e.title}));const s=o.useBlockProps.save({className:"yoast-table-of-contents"});return(0,y.jsxs)("div",{...s,children:[t,re(e.headings,e.maxHeadingLevel)]})},deprecated:[{attributes:{title:{type:"string",source:"html",selector:"h2",default:(0,c.__)("Table of contents","wordpress-seo-premium")},level:{type:"number",default:2},headings:{type:"array",source:"query",selector:"a",query:{content:{type:"string",source:"html"},href:{type:"string",source:"attribute",attribute:"href"},level:{type:"string",source:"attribute",attribute:"data-level"}}}},migrate:e=>({maxHeadingLevel:6,...e}),save:({attributes:e})=>{let t=null;return e.title&&(t=(0,y.jsx)(o.RichText.Content,{tagName:"h"+e.level,value:e.title})),(0,y.jsxs)("div",{className:"yoast-table-of-contents",children:[t,re(e.headings)]})}}]}))})();