(()=>{"use strict";var e={n:o=>{var r=o&&o.__esModule?()=>o.default:()=>o;return e.d(r,{a:r}),r},d:(o,r)=>{for(var t in r)e.o(r,t)&&!e.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:r[t]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)};const o=window.wp.element,r=window.wp.i18n,t=window.wp.blocks,a=JSON.parse('{"name":"cusrev/trust-badge","description":"Display a Trust Badge with a summary of product and store reviews."}'),c=window.wp.components,l=window.wp.serverSideRender;var s=e.n(l);const n=e=>(0,o.createElement)(c.BaseControl,{id:e.instanceId||Math.random(),label:e.label||""},(0,o.createElement)(c.ColorPicker,{color:e.color,label:e.label,disableAlpha:e.disableAlpha,onChangeComplete:e.onChange})),m=()=>(0,o.createElement)("div",{class:"cr-placeholder-tb"},(0,o.createElement)("div",{class:"cr-placeholder-tb-fr"}),(0,o.createElement)("div",{class:"cr-placeholder-tb-sr"})),i=window.wp.blockEditor,{name:d}=a;function w({attributes:e,setAttributes:t}){return(0,o.createElement)("div",(0,i.useBlockProps)(),(0,o.createElement)(i.InspectorControls,{key:"setting"},(0,o.createElement)(c.PanelBody,{title:(0,r.__)("Trust Badge Settings","customer-reviews-woocommerce"),initialOpen:!0},(0,o.createElement)(c.SelectControl,{label:(0,r.__)("Badge Size","customer-reviews-woocommerce"),value:e.badge_size,options:[{label:(0,r.__)("Small","customer-reviews-woocommerce"),value:"small"},{label:(0,r.__)("Wide","customer-reviews-woocommerce"),value:"wide"},{label:(0,r.__)("Compact","customer-reviews-woocommerce"),value:"compact"}],onChange:e=>t({badge_size:e})}),(0,o.createElement)(c.SelectControl,{label:(0,r.__)("Badge Style","customer-reviews-woocommerce"),value:e.badge_style,options:[{label:(0,r.__)("Light","customer-reviews-woocommerce"),value:"light"},{label:(0,r.__)("Dark","customer-reviews-woocommerce"),value:"dark"}],onChange:e=>t({badge_style:e})}),(0,o.createElement)(c.ToggleControl,{label:(0,r.__)("Show Store Rating","customer-reviews-woocommerce"),help:e.store_rating?(0,r.__)("Include store rating","customer-reviews-woocommerce"):(0,r.__)("Exclude store rating","customer-reviews-woocommerce"),checked:e.store_rating,onChange:()=>t({store_rating:!e.store_rating})}),(0,o.createElement)(c.ToggleControl,{label:(0,r.__)("Show Border","customer-reviews-woocommerce"),help:e.badge_border?(0,r.__)("Display badge border","customer-reviews-woocommerce"):(0,r.__)("No badge border","customer-reviews-woocommerce"),checked:e.badge_border,onChange:()=>t({badge_border:!e.badge_border})}),(0,o.createElement)(n,{color:e.badge_color,label:(0,r.__)("Background Color","customer-reviews-woocommerce"),help:(0,r.__)("Set a custom background color for the badge","customer-reviews-woocommerce"),disableAlpha:!0,onChange:e=>{t({badge_color:e.hex})}}))),(0,o.createElement)(c.Disabled,null,(0,o.createElement)(s(),{LoadingResponsePlaceholder:()=>((0,o.useEffect)((()=>()=>{"function"==typeof crResizeTrustBadges&&crResizeTrustBadges()})),(0,o.createElement)(m,null)),block:d,attributes:e})))}const{name:u,description:b}=a;(0,t.registerBlockType)(u,{description:(0,r.__)(b,"customer-reviews-woocommerce"),edit:e=>(0,o.createElement)(w,e),save:()=>null})})();