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