(()=>{"use strict";const e=window.wp.blocks,t=window.wp.blockEditor,a=window.wp.components,l=window.wp.i18n,n=JSON.parse('{"UU":"gateway/field-link"}'),i=window.ReactJSXRuntime;(0,e.registerBlockType)(n.UU,{edit:({attributes:e,setAttributes:n})=>{const{fieldKey:o,labelKey:s}=e,r=(0,t.useBlockProps)({className:"gateway-field-link"});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.InspectorControls,{children:(0,i.jsxs)(a.PanelBody,{title:(0,l.__)("Field Link Settings","gateway"),children:[(0,i.jsx)(a.TextControl,{label:(0,l.__)("URL Field Key","gateway"),value:o,onChange:e=>n({fieldKey:e}),help:(0,l.__)("The record property containing the URL.","gateway")}),(0,i.jsx)(a.TextControl,{label:(0,l.__)("Label Field Key","gateway"),value:s,onChange:e=>n({labelKey:e}),help:(0,l.__)("The record property to use as the link text (optional).","gateway")})]})}),(0,i.jsx)("span",{...r,children:o?(0,i.jsx)("em",{children:`[link: ${o}${s?` → ${s}`:""}]`}):(0,i.jsx)("em",{children:(0,l.__)("(no field key set)","gateway")})})]})},save:({attributes:e})=>{const{fieldKey:a,labelKey:l}=e;return(0,i.jsx)("a",{...t.useBlockProps.save({className:"gateway-field-link"}),href:"#","data-wp-bind--href":a?`context.record.${a}`:void 0,"data-wp-text":l?`context.record.${l}`:void 0})}})})();