!function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,n=window.wp.element,o=window.wp.serverSideRender,a=e.n(o),r=window.wp.i18n,s=window.wp.blockEditor,l=window.wp.data,i=window.wp.components,c=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","name":"terms-block/assigned-terms","title":"Assigned Terms","apiVersion":3,"icon":"tag","description":"Displays a list of assigned terms in the selected taxonomy.","textdomain":"terms-block","attributes":{"className":{"type":"string","default":""},"taxonomy":{"type":"string","default":"category"}},"category":"widgets","editorScript":"file:./index.js"}');const{name:m}=c;(0,t.registerBlockType)(m,{...c,edit:function({className:e,attributes:o,setAttributes:m}){const{taxonomy:u}=o,d=(0,l.useSelect)((e=>e("core").getTaxonomies({per_page:-1})||[]),[]),p=(0,l.useSelect)((e=>e("core").getEntityRecords("taxonomy",u,{})||[]),[u]),w=(0,n.createElement)(s.InspectorControls,null,(0,n.createElement)(i.PanelBody,{title:"Settings"},(0,n.createElement)(i.SelectControl,{label:"Taxonomy",onChange:e=>{m({taxonomy:e})},value:u,options:[...d.map((({name:e,slug:t})=>({value:t,label:e})))]}))),g=(0,t.getBlockDefaultClassName)(c.name),y=((e,t=[])=>{const n=(e=>e.flatMap((e=>e?e.split(" "):[])))(t),{className:o}=e,a=o?o.split(" "):[];return{...e,className:a.filter((e=>!n.includes(e))).join(" ")}})((0,s.useBlockProps)(),[g,e]);return Array.isArray(p)&&p.length?(0,n.createElement)(n.Fragment,null,w,(0,n.createElement)("div",{...y},(0,n.createElement)(i.Disabled,null,(0,n.createElement)(a(),{className:e,block:c.name,attributes:o,emptyResponseLabel:(0,r.__)("Term Not Found.","terms-block")})))):(0,n.createElement)(n.Fragment,null,w,(0,n.createElement)(i.Placeholder,{icon:c.icon,label:(0,r.__)("Terms")},(0,r.__)("No terms found.")))},save:()=>null})}();