(()=>{"use strict";const e=window.wp.blocks,t=window.wp.element,l=window.wp.primitives,r=(0,t.createElement)(l.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(l.Path,{d:"M12.5 14.5h-1V16h1c2.2 0 4-1.8 4-4s-1.8-4-4-4h-1v1.5h1c1.4 0 2.5 1.1 2.5 2.5s-1.1 2.5-2.5 2.5zm-4 1.5v-1.5h-1C6.1 14.5 5 13.4 5 12s1.1-2.5 2.5-2.5h1V8h-1c-2.2 0-4 1.8-4 4s1.8 4 4 4h1zm-1-3.2h5v-1.5h-5v1.5zM18 4H9c-1.1 0-2 .9-2 2v.5h1.5V6c0-.3.2-.5.5-.5h9c.3 0 .5.2.5.5v12c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5v-.5H7v.5c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2z"})),a=JSON.parse('{"$schema":"https://json.schemastore.org/block.json","apiVersion":2,"name":"small-plugins/primary-term","title":"Primary Term","category":"text","description":"Display a primary taxonomy term link.","keywords":["category","labels"],"attributes":{"fallback":{"type":"boolean","default":false}},"usesContext":["category-labels-block/scope-to-current-post","category-labels-block/display-primary","category-labels-block/fallback-primary","category-labels-block/limit"],"providesContext":{"term":"term"},"version":"1.0.0","textdomain":"category-labels-block","editorScript":"category-link-primary-block-script","parent":["small-plugins/category-labels"],"supports":{"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontStyle":true,"__experimentalFontWeight":true,"__experimentalTextTransform":true,"__experimentalFontFamily":true,"__experimentalLetterSpacing":true,"__experimentalTextDecoration":true,"__experimentalSkipSerialization":["textDecoration"],"__experimentalDefaultControls":{"fontSize":true}},"__experimentalBorder":true,"spacing":{"padding":true,"blockGap":true},"color":{"background":true,"link":false,"text":true},"layout":{"allowSwitching":false,"allowInheriting":false,"allowVerticalAlignment":false,"allowSizingOnChildren":true,"default":{"type":"flex"}}}}'),n=window.wp.blockEditor,o=window.wp.i18n,i=window.wp.components,s=window.lodash,c=function(e){return(0,t.createElement)(n.InspectorControls,null,(0,t.createElement)(i.PanelBody,{initialOpen:!0,title:(0,o.__)("General","category-labels-block")},(0,t.createElement)(i.ToggleControl,{label:(0,o.__)("Fallback","category-labels-block"),checked:e.attributes.fallback,onChange:t=>e.setAttributes({fallback:t}),help:(0,o.__)("Displays the top-most parent category of the post's primary category (if exists).","category-labels-block")})))};function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e},p.apply(this,arguments)}(0,e.registerBlockType)(a,{icon:r,edit:function(e){var l;const r=(0,s.get)(e,"__unstableLayoutClassNames",""),a=(0,n.useBlockProps)({className:["category-label-link_root",r].join(" ")}),o="true"===(0,s.get)(smallPluginsCategoryLabelsBlockData,"isPremium");return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("a",a,(0,t.createElement)(n.InnerBlocks,{template:[["small-plugins/term-name",{},[]]],renderAppender:!1,allowedBlocks:["small-plugins/term-name","small-plugins/term-abbreviation"],orientation:null!==(l=e?.attributes?.layout?.orientation)&&void 0!==l?l:"horizontal"})),(0,t.createElement)(n.BlockControls,null,o&&(0,t.createElement)(i.ToolbarGroup,null,(0,t.createElement)(n.Inserter,{clientId:e.clientId,rootClientId:e.clientId}))),(0,t.createElement)(c,e))},save:function(e){const{opensInNewTab:l}=e.attributes,r=n.useBlockProps.save({className:"category-label-link_root"});return(0,t.createElement)("a",p({},r,{href:"{{link}}",rel:"noopener",target:l?"_blank":"_self"}),(0,t.createElement)(n.InnerBlocks.Content,null))}})})();