"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,o)=>{for(var t in o)__defProp(e,t,{get:o[t],enumerable:!0})},__copyProps=(e,o,t,r)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let _ of __getOwnPropNames(o))__hasOwnProp.call(e,_)||_===t||__defProp(e,_,{get:()=>o[_],enumerable:!(r=__getOwnPropDesc(o,_))||r.enumerable});return e},__toESM=(e,o,t)=>(t=null!=e?__create(__getProtoOf(e)):{},__copyProps(!o&&e&&e.__esModule?t:__defProp(t,"default",{value:e,enumerable:!0}),e)),__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),edit_exports={};__export(edit_exports,{SummaryBlockEdit:()=>SummaryBlockEdit}),module.exports=__toCommonJS(edit_exports);var import_i18n=require("@wordpress/i18n"),import_block_templates=require("@woocommerce/block-templates"),import_element=require("@wordpress/element"),import_components=require("@wordpress/components"),import_core_data=require("@wordpress/core-data"),import_compose=require("@wordpress/compose"),import_clsx=__toESM(require("clsx")),import_block_editor=require("@wordpress/block-editor"),import_paragraph_rtl_control=require("./paragraph-rtl-control"),import_constants=require("./constants"),import_use_clear_selected_block_on_blur=require("../../../hooks/use-clear-selected-block-on-blur");function SummaryBlockEdit({attributes:e,setAttributes:o,context:t}){const{align:r,allowedFormats:_,direction:l,label:n,helpText:p}=e,m=(0,import_block_templates.useWooBlockProps)(e,{style:{direction:l}}),c=(0,import_compose.useInstanceId)(SummaryBlockEdit,"wp-block-woocommerce-product-summary-field__content"),[i,a]=(0,import_core_data.useEntityProp)("postType",t.postType||"product",e.property),{handleBlur:s}=(0,import_use_clear_selected_block_on_blur.useClearSelectedBlockOnBlur)();return(0,import_element.createElement)("div",{className:"wp-block wp-block-woocommerce-product-summary-field-wrapper"},(0,import_element.createElement)(import_block_editor.BlockControls,{group:"block"},(0,import_element.createElement)(import_block_editor.AlignmentControl,{alignmentControls:import_constants.ALIGNMENT_CONTROLS,value:r,onChange:function(e){o({align:e})}}),(0,import_element.createElement)(import_paragraph_rtl_control.ParagraphRTLControl,{direction:l,onChange:function(e){o({direction:e})}})),(0,import_element.createElement)(import_components.BaseControl,{id:c.toString(),label:void 0===n?(0,import_element.createInterpolateElement)((0,import_i18n.__)("Summary","woocommerce"),{optional:(0,import_element.createElement)("span",{className:"woocommerce-product-form__optional-input"},(0,import_i18n.__)("(OPTIONAL)","woocommerce"))}):n,help:void 0===p?(0,import_i18n.__)("Summarize this product in 1-2 short sentences. We'll show it at the top of the page.","woocommerce"):p},(0,import_element.createElement)("div",{...m},(0,import_element.createElement)(import_block_editor.RichText,{id:c.toString(),identifier:"content",tagName:"p",value:i,onChange:a,"data-empty":Boolean(i),className:(0,import_clsx.default)("components-summary-control",{[`has-text-align-${r}`]:r}),dir:l,allowedFormats:_,onBlur:s}))))}