芝麻web文件管理V1.00
编辑当前文件:/home/ezdajrnh/www/wp-content/plugins/wordpress-seo-premium/assets/js/dist/blocks-2300.min.js
(()=>{"use strict";var e={865:(e,t,n)=>{var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=i(n(609)),s=i(n(848)),a=i(n(812));function i(e){return e&&e.__esModule?e:{default:e}}var l=void 0;function c(e,t){var n,a,i,u,d,p,m,g,f=[],h={};for(p=0;p
"+l);if("componentClose"===d.type)throw new Error("Missing opening component token: `"+d.value+"`");if("componentOpen"===d.type){n=t[d.value],i=p;break}f.push(t[d.value])}else f.push(d.value);return n&&(u=function(e,t){var n,o,r=t[e],s=0;for(o=e+1;o
{function t(e){return e.match(/^\{\{\//)?{type:"componentClose",value:e.replace(/\W/g,"")}:e.match(/\/\}\}$/)?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.match(/^\{\{/)?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}e.exports=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(t)}},848:(e,t,n)=>{var o=n(609),r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,s=n(650),a=n(163),i=n(759),l=".",c=":",u="function"==typeof Symbol&&Symbol.iterator,d="@@iterator";function p(e,t){return e&&"object"==typeof e&&null!=e.key?(n=e.key,o={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,(function(e){return o[e]}))):t.toString(36);var n,o}function m(e,t,n,o){var s,i=typeof e;if("undefined"!==i&&"boolean"!==i||(e=null),null===e||"string"===i||"number"===i||"object"===i&&e.$$typeof===r)return n(o,e,""===t?l+p(e,0):t),1;var g=0,f=""===t?l:t+c;if(Array.isArray(e))for(var h=0;h
{function t(e){return function(){return e}}var n=function(){};n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},163:e=>{e.exports=function(e,t,n,o,r,s,a,i){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,r,s,a,i],u=0;(l=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw l.framesToPop=1,l}}},759:(e,t,n)=>{var o=n(650);e.exports=o},609:e=>{e.exports=window.React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{const e=window.lodash;var t=n(609);const o=window.wp.blocks,r=window.wp.blockEditor,s=window.wp.components,a=window.wp.data,i=window.wp.domReady;var l=n.n(i);const c=window.wp.element,u=window.wp.i18n,d=window.wp.a11y,p=window.wp.url,m=window.yoast.helpers;var g=n(865);const f=window.yoast.propTypes;var h=n.n(f);const b=window.yoast.styledComponents;var y=n.n(b);const w=window.yoast.componentsNew,v=window.yoast.styleGuide,k=y().div` display: flex; align-items: normal; min-height: 40px; margin: 10px 0 5px; `,x=(0,m.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"}}),E=y().div` background-color: #e5e5e5; width: 100%; height: 1px; `,_=y().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:v.colors.$color_button,iconBorder:v.colors.$color_button_border};const A=y().div` flex: auto; `,S=(0,m.makeOutboundLink)(y().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; `),T=y().div` flex-wrap: wrap; display: flex; flex-direction: row; justify-content: unset; margin-top: 4px; `,B=y().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; `,R=({badges:e})=>(0,t.createElement)(T,null,e.map(((e,n)=>(0,t.createElement)(B,{key:n},e))));R.propTypes={badges:h().array.isRequired};const C=({value:e,url:n,isActive:o,labels:r})=>{const s=(0,u.__)("Copy link","wordpress-seo-premium"),a=(0,u.sprintf)(/* translators: Hidden accessibility text; %s expands to the link value */ /* translators: Hidden accessibility text; %s expands to the link value */ (0,u.__)("Copy link to suggested article: %s","wordpress-seo-premium"),e),i=(0,c.useCallback)((e=>{e.nativeEvent.target.setAttribute("aria-label",a),e.nativeEvent.target.setAttribute("data-label",s)}),[a,s]);let l="copy",d=v.colors.$color_black,p=v.colors.$color_button,m="#979797";return o&&(l="check",d=v.colors.$color_alert_success_text,p=v.colors.$color_alert_success_background,m=v.colors.$color_alert_success_background),(0,t.createElement)("div",null,(0,t.createElement)(E,null),(0,t.createElement)(k,{className:"yoast-link-suggestion__wrapper"},(0,t.createElement)(A,{className:"yoast-link-suggestion__container"},(0,t.createElement)(S,{href:n},e),(0,t.createElement)(R,{badges:r})),(0,t.createElement)(_,{type:"button",className:"yoast-link-suggestion__copy yoast-tooltip yoast-tooltip-alt yoast-tooltip-s",onBlur:i,"data-clipboard-text":n,"aria-label":a,"data-label":s,iconBackground:p,iconBorder:m},(0,t.createElement)(x,{icon:l,color:d}),(0,t.createElement)(w.ScreenReaderText,null,s))))};C.propTypes={value:h().string.isRequired,url:h().string.isRequired,isActive:h().bool,labels:h().array.isRequired},C.defaultProps={isActive:!1};const L=C,M=y().div` display: table-cell; `,P=(0,u.__)("We could not find any relevant articles on your website that you could link to from your post.","wordpress-seo-premium"),$=(0,u.__)("To improve your site structure, consider linking to other relevant posts or pages on your website.","wordpress-seo-premium");let O;const I=e=>{const t=(0,u.__)("Copied!","wordpress-seo-premium");e.trigger.focus(),e.trigger.setAttribute("aria-label",t),e.trigger.setAttribute("data-label",t),(0,d.speak)(t,"assertive")},N=e=>{const t=(0,u.__)("Not supported!","wordpress-seo-premium");e.trigger.el.setAttribute("aria-label",t),e.trigger.setAttribute("data-label",t),(0,d.speak)(t,"assertive")},j=({suggestions:e,maxSuggestions:n,customMessages:o,location:r})=>{const s=function(e){const n=(0,m.makeOutboundLink)(),o=(0,p.addQueryArgs)(wpseoAdminL10n["shortlinks.site_structure_metabox"],{context:e});return(0,g.A)({ // Translators: Text between {{a}} and {{/a}} will be a link to an article about site structure. mixedString:(0,u.__)("{{a}}Read our guide on internal linking for SEO{{/a}} to learn more.","wordpress-seo-premium"),components:{a:(0,t.createElement)(n,{href:o})}})}(r);if(0===e.length){let e=o.lengthMessage;return e=""===e?P:e,(0,t.createElement)("div",null,(0,t.createElement)("p",null,e),(0,t.createElement)("p",null,o.metaMessage),(0,t.createElement)("p",null,s))}return e.length>n&&(e.length=n),(0,t.createElement)(M,null,(0,t.createElement)("p",null,$," ",s),(0,t.createElement)("p",null,o.metaMessage),e.map(((e,n)=>(0,t.createElement)(L,{key:n,...e}))))};j.propTypes={suggestions:h().array.isRequired,maxSuggestions:h().number,customMessages:h().object,location:h().string},j.defaultProps={maxSuggestions:10,customMessages:{lengthMessage:"",metaMessage:""},location:""};const H=()=>{window.open("admin.php?page=wpseo_tools&start-indexation=true","yoastSeoAnalyzeProminentWords")},D=()=>{ /* translators: 1: link to yoast.com post about internal linking suggestion. 2: is anchor closing. 3: button to the recalculation option. 4: closing button */ let e=(0,u.__)("We need to optimize your site’s SEO data so we can offer you the best %1$slinking suggestions%2$s.\n\n%3$sStart SEO Data optimization%4$s","wordpress-seo-premium");return e=e.replace("%1$s","{{a}}"),e=e.replace("%2$s","{{/a}}"),e=e.replace("%3$s","{{startAnalysis}}"),e=e.replace("%4$s","{{/startAnalysis}}"),e=e.replace("\n\n","{{br /}}{{br /}}"),e=(0,g.A)({mixedString:e,components:{a:(0,t.createElement)("a",{href:wpseoAdminL10n["shortlinks.notification_internal_link"],target:"_blank"}),startAnalysis:(0,t.createElement)("button",{type:"button",className:"button",onClick:H}),br:(0,t.createElement)("br",null)}}),(0,t.createElement)("div",{className:"notice notice-warning notice-alt wpseo-notice-breakout-inside yoast-links-suggestions-notice"},(0,t.createElement)("p",null,e))},F=e=>{if((0,c.useEffect)((()=>(e.suggester.subscribe(),()=>{e.suggester.unsubscribe()})),[]),e.isLoading)return(0,t.createElement)("div",{className:"yoast-link-suggestions"},(0,t.createElement)("p",null,(0,u.__)("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")));O||(O=new ClipboardJS(".yoast-link-suggestion__copy"),O.on("success",I),O.on("error",N));let n=null;e.showUnindexedWarning&&(n=D());const o=(e=>{let t="";e.hasWordsForLinking||(t=(0,u.__)("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 n=((e,t,n)=>{switch(!0){case n&&!t&&""===e:return(0,u.__)("Add a title to your post for the best internal linking suggestions.","wordpress-seo-premium");case!n&&t&&""===e:return(0,u.__)("Add a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium");case!n&&!t&&""===e:return(0,u.__)("Add a title and a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium");case n&&!t&&""!==e:return(0,u.__)("Also, add a title to your post for the best internal linking suggestions.","wordpress-seo-premium");case!n&&t&&""!==e:return(0,u.__)("Also, add a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium");case!n&&!t&&""!==e:return(0,u.__)("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:n}})({...e.messageData,hasWordsForLinking:Array.isArray(e.wordsForLinking)&&e.wordsForLinking.length>0});return(0,t.createElement)("div",{className:"yoast-link-suggestions"},n,(0,t.createElement)(j,{suggestions:e.suggestions,customMessages:o,location:e.location}))};function W(e,t){for(const n of e)t(n),n.innerBlocks&&W(n.innerBlocks,t)}F.propTypes={suggester:h().object,suggestions:h().array.isRequired,wordsForLinking:h().array,messageData:h().object,isLoading:h().bool.isRequired,showUnindexedWarning:h().bool,location:h().string},F.defaultProps={suggester:null,showUnindexedWarning:!1,messageData:{hasMetaDescription:!1,hasTitle:!1},wordsForLinking:[],location:""};const q=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":"
Related link 1
Related link 2
Related link 3
"}}}');const z=window.yoast.editorModules.helpers.createInterpolateElement;function V(e,t,n,o){t!==n&&o(e,{status:t})}function U(t){if(!(0,a.select)("yoast-seo-premium/editor"))return void setTimeout(U.bind(null,t),500);(0,e.get)(YoastSEO,"analysis.linkSuggester")&&YoastSEO.analysis.linkSuggester.update();const{linkSuggestionsAreLoading:n}=(0,a.select)("yoast-seo-premium/editor"),{getBlockAttributes:o}=(0,a.select)("core/block-editor"),r=o(t);"loaded"!==r.status&&(n()?setTimeout(U.bind(null,t),500):function(e,t){const{linkSuggestionsAreUnindexed:n,getLinkSuggestions:o,getWordsForLinking:r}=(0,a.select)("yoast-seo-premium/editor"),{updateBlockAttributes:s}=(0,a.dispatch)("core/block-editor");if(n())return void V(e,"unindexed",t.status,s);const i=r();if(!Array.isArray(i)||0===i.length)return void V(e,"no-content",t.status,s);const l=o();0!==l.length?"loading"===t.status?s(e,{values:l.map((e=>`
${e.value}
`)).join(""),status:"loaded"}):V(e,"has-suggestions",t.status,s):V(e,"no-suggestions",t.status,s)}(t,r))}function Y(e,n="warning",o){const r=`notice notice-${n} notice-alt wpseo-notice-breakout-inside yoast-links-suggestions-notice`;return(0,t.createElement)("div",{...o,className:r},(0,t.createElement)("p",null,e))}function G(){return(0,a.select)("yoast-seo-premium/editor")?(0,a.select)("yoast-seo-premium/editor").getLinkSuggestions():null}function J(){return(0,a.select)("yoast-seo-premium/editor")?(0,a.select)("yoast-seo-premium/editor").getWordsForLinking():null}const Q=window.wp.hooks,K=window.yoast.analysis,{stripHTMLTags:X}=K.languageProcessing,Z=(t,n)=>{const r=`h-${function(t){const n=new RegExp("[^\\p{L}\\p{N}]+","gu");return(0,e.trim)((0,e.deburr)(X(t)).replace(n,"-").toLowerCase(),"-")}((0,o.getBlockContent)(t))}`;let s=r,a=0;for(;n.includes(s);)s=`${r}-${a}`,a++;return s};const ee=e=>{const t=[];return W(e,(e=>{"core/heading"===e.name&&t.push(e.attributes.anchor)})),t};function te(e,t){let n=e;for(;n&&n.level>=t;)n=n.parent;return n}function ne(e){const n=e.map((e=>{let n=null;return e.children&&e.children.length>0&&(n=ne(e.children)),(0,t.createElement)("li",{key:e.href},(0,t.createElement)("a",{href:e.href,"data-level":e.level},e.content),n)}));return(0,t.createElement)("ul",null,n)}function oe(e,t=99){return e&&0!==e.length?ne(e=function(e){const t=[];let n;for(const o of e){const e=parseInt(o.level,10),r={children:[],parent:null,...o,level:e},s=te(n,e);s?(r.parent=s,s.children.push(r)):t.push(r),n=r}return t}(e=e.filter((e=>e.level<=t)))):null}(0,Q.addFilter)("blocks.switchToBlockType.transformedBlock","yoast-seo-table-of-contents/transformed-block",(t=>{if((0,e.isNil)(t.attributes.anchor)&&"core/heading"===t.name){const e=(0,a.select)("core/block-editor").getBlocks(),n=ee(e);t.attributes.anchor=Z(t,n)}return t})),l()((()=>{window.wpseoPremiumMetaboxData?function(){let t=(0,a.select)("core/block-editor").getBlocks(),n=J(),o=G();(0,a.subscribe)((()=>{const r=(0,a.select)("core/block-editor").getBlocks(),s=J(),i=G(),l=!(0,e.isEqual)(t,r),c=!(0,e.isEqual)(n,s),u=!(0,e.isEqual)(o,i);(l||c||u)&&W(r,(e=>{"yoast-seo/related-links"===e.name&&(l&&"loading"===e.attributes.status?U(e.clientId):(c&&"no-content"===e.attributes.status&&U(e.clientId),u&&"loaded"!==e.attributes.status&&U(e.clientId)))})),t=r,n=s,o=i}))}():(0,o.unregisterBlockType)("yoast-seo/related-links")})),(0,o.registerBlockType)(q,{edit:function({clientId:e,attributes:n,setAttributes:i}){const{status:l}=n,d=()=>{i({status:"loading"}),U(e)};(0,c.useEffect)((()=>{"loaded"!==l&&d()}),[]),function(e,t){const n=(0,a.useRegistry)(),{updateBlockAttributes:r,replaceInnerBlocks:s}=(0,a.dispatch)("core/block-editor");(0,c.useEffect)((()=>{if(!e.values)return;const[a,i]=function(e){const{values:t,...n}=e,r=document.createElement("ul");r.innerHTML=t;const[s]=(0,o.rawHandler)({HTML:r.outerHTML});return[{...n,...s.attributes},s.innerBlocks]}(e);n.batch((()=>{r(t,a),s(t,i)}))}),[e.values])}(n,e);const p=(0,r.useBlockProps)(),m=(0,r.useInnerBlocksProps)(p,{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"!==l)return Y(z((0,u.__)("You have disabled Link suggestions, which is needed for Related links to work. If you want to add Related links, please go to
Site features
and enable Link suggestions.","wordpress-seo-premium"),{a:(0,t.createElement)("a",{href:wpseoPremiumMetaboxData.data.settingsPageUrl,target:"_blank"},"#21441-gutenberg")}),"error",p);if("loaded"!==l)return function(e,n,o){if("unindexed"===e)return D();let r=(0,u.__)("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&&(r=(0,u.__)("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&&(r=(0,u.__)("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&&(r=(0,t.createElement)(c.Fragment,null,r,(0,t.createElement)("br",null),(0,t.createElement)("br",null),(0,t.createElement)("button",{type:"button",className:"button",onClick:n},(0,u.__)("Load suggestions","wordpress-seo-premium")))),Y(r,"warning",o)}(l,d,p);const g=(0,t.createElement)(r.BlockControls,null,(0,t.createElement)(s.ToolbarGroup,{controls:[{icon:"image-rotate",title:(0,u.__)("Refresh suggestions","wordpress-seo-premium"),isActive:!1,onClick:d}]}));return(0,t.createElement)(c.Fragment,null,(0,t.createElement)("ul",{...m}),g)},save:function({attributes:e}){if("loaded"!==e.status)return null;const n=r.useBlockProps.save({className:"yoast-seo-related-links"}),o=r.useInnerBlocksProps.save(n);return(0,t.createElement)("ul",{...o})},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,t.createElement)(r.RichText.Content,{tagName:"ul",multiline:"li",value:e.values})}]}),(0,e.get)(window,"wpseoTOCData.data.disableTableOfContents",!1)||function(){const n=(0,e.get)(window,"wpseoTOCData.data",{}).TOCTitle;var i;l()((()=>{!function(){let t=null,n="",r=!1,s=[];const i={};(0,a.subscribe)((()=>{if(r)return;const l=(0,a.select)("core/block-editor").getBlocks(),c=[];if(t!==l){const t=[],u=[];let d="";r=!0;const p=ee(l).every((t=>(0,e.isUndefined)(t)));W(l,(n=>{if("core/heading"===n.name){const l=X((0,o.getBlockContent)(n)),u=n.attributes.level,m=function(t,n,r,s,i){let l=t.attributes.anchor;const c=n[t.clientId],u=X((0,o.getBlockContent)(t));return c&&c===u||l&&!l.startsWith("h-")||(l=function(t,n,r,s){return!(0,e.isNil)(t.attributes.anchor)||s||(0,e.isEmpty)((0,o.getBlockContent)(t))||r.includes(t.clientId)?Z(t,n):""}(t,r,s,i),l!==t.attributes.anchor&&(0,a.dispatch)("core/block-editor").updateBlockAttributes(t.clientId,{anchor:l})),l}(n,i,c,s,p);if(i[n.clientId]=l,""===m||(0,e.isEmpty)(l))return;c.push(m),t.push({content:(r=l,(new DOMParser).parseFromString(r,"text/html").documentElement.textContent),href:"#"+m,level:u}),d+="$"+u+":"+m+":"+l}else u.push(n.clientId);var r})),W(l,(e=>{if("yoast-seo/table-of-contents"===e.name){const o=e.attributes.headings&&e.attributes.headings.length>0;(n!==d||t.length>0&&!o)&&(0,a.dispatch)("core/block-editor").updateBlockAttributes(e.clientId,{headings:t})}})),r=!1,n=d,s=u}t=l}))}()})),i=n,(0,o.registerBlockType)("yoast-seo/table-of-contents",{title:(0,u.__)("Yoast Table of Contents","wordpress-seo-premium"),icon:"editor-ul",category:"yoast-internal-linking-blocks",description:(0,u.__)("Adds a table of contents to this page.","wordpress-seo-premium"),keywords:[(0,u.__)("seo","wordpress-seo-premium"),(0,u.__)("links","wordpress-seo-premium"),(0,u.__)("site structure","wordpress-seo-premium"),(0,u.__)("toc","wordpress-seo-premium")],attributes:{title:{type:"string",source:"html",selector:"h1,h2,h3,h4,h5,h6",default:i},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"}]}},edit:function({attributes:e,setAttributes:n}){const o=(0,c.useCallback)((e=>n({title:e})),[n]),a=(0,c.useCallback)((e=>n({level:e})),[n]),i=(0,c.useCallback)((e=>n({maxHeadingLevel:Number(e)})),[n]);return(0,t.createElement)(c.Fragment,null,(0,t.createElement)(r.BlockControls,null,(0,t.createElement)(s.ToolbarGroup,null,(0,t.createElement)(r.HeadingLevelDropdown,{value:e.level,options:[1,2,3,4,5,6],onChange:a}))),(0,t.createElement)(r.InspectorControls,null,(0,t.createElement)(s.PanelBody,{title:(0,u.__)("Settings","wordpress-seo-premium"),className:"yoast-table-of-contents-controls"},(0,t.createElement)(s.SelectControl,{label:(0,u.__)("Maximum heading level","wordpress-seo-premium"),value:e.maxHeadingLevel,options:[1,2,3,4,5,6].map((e=>({label:(0,u.sprintf)((0,u.__)("Heading %d"),e),value:e}))),onChange:i}))),(0,t.createElement)("div",{className:"yoast-table-of-contents"},(0,t.createElement)(r.RichText,{tagName:"h"+e.level,value:e.title,onChange:o}),oe(e.headings,e.maxHeadingLevel)))},save:function({attributes:e}){let n=null;return e.title&&(n=(0,t.createElement)(r.RichText.Content,{tagName:"h"+e.level,value:e.title})),(0,t.createElement)("div",{className:"yoast-table-of-contents"},n,oe(e.headings,e.maxHeadingLevel))},deprecated:[{attributes:{title:{type:"string",source:"html",selector:"h2",default:(0,u.__)("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 n=null;return e.title&&(n=(0,t.createElement)(r.RichText.Content,{tagName:"h"+e.level,value:e.title})),(0,t.createElement)("div",{className:"yoast-table-of-contents"},n,oe(e.headings))}}]})}()})()})();