"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Edit=void 0;const compose_1=require("@wordpress/compose"),core_data_1=require("@wordpress/core-data"),element_1=require("@wordpress/element"),i18n_1=require("@wordpress/i18n"),block_templates_1=require("@woocommerce/block-templates"),components_1=require("@wordpress/components");function Edit({attributes:e}){const o=(0,block_templates_1.useWooBlockProps)(e),{label:t}=e,[r,s]=(0,core_data_1.useEntityProp)("postType","product","post_password"),[n,c]=(0,element_1.useState)(Boolean(r)),l=(0,compose_1.useInstanceId)(components_1.BaseControl,"post_password");return(0,element_1.createElement)("div",{...o},(0,element_1.createElement)(components_1.CheckboxControl,{label:t,checked:n,className:"wp-block-woocommerce-product-password-fields__field",onChange:e=>{c(e),e||s("")}}),n&&(0,element_1.createElement)(components_1.BaseControl,{id:l,label:(0,i18n_1.__)("Password","woocommerce")},(0,element_1.createElement)(components_1.__experimentalInputControl,{id:l,value:r,onChange:s})))}exports.Edit=Edit;