geno/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/product-rating-counter-frontend.js
2024-02-01 11:54:18 +00:00

2 lines
No EOL
5.1 KiB
JavaScript

"use strict";(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[2918],{5042:(e,t,o)=>{o.r(t),o.d(t,{Block:()=>p,default:()=>f});var n=o(9196),r=o(5736),l=o(4184),c=o.n(l),s=o(2864),a=o(3611),i=o(721),u=o(1478),d=o(5609);const v=e=>{const{reviews:t}=e,o=t?(0,r.sprintf)(/* translators: %s is referring to the total of reviews for a product */
(0,r._n)("(%s customer review)","(%s customer reviews)",t,"woocommerce"),t):(0,r.__)("(X customer reviews)","woocommerce");return(0,n.createElement)("span",{className:"wc-block-components-product-rating-counter__reviews_count"},(0,n.createElement)(d.Disabled,null,(0,n.createElement)("a",{href:"/"},o)))},p=e=>{const{textAlign:t,shouldDisplayMockedReviewsWhenProductHasNoReviews:o}=e,r=(0,a.F)(e),{parentClassName:l}=(0,s.useInnerBlockLayoutContext)(),{product:i}=(0,s.useProductDataContext)(),d=(e=>{const t=(0,u.h)(e.review_count)?e.review_count:parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(i),p=c()(r.className,"wc-block-components-product-rating-counter",{[`${l}__product-rating`]:l,[`has-text-align-${t}`]:t});if(d||o)return(0,n.createElement)("div",{className:p,style:r.style},(0,n.createElement)("div",{className:"wc-block-components-product-rating-counter__container"},(0,n.createElement)(v,{reviews:d})))},f=(0,i.withProductDataContext)(p)},3611:(e,t,o)=>{o.d(t,{F:()=>i});var n=o(4184),r=o.n(n),l=o(7884),c=o(2646),s=o(1473),a=o(2661);const i=e=>{const t=(e=>{const t=(0,l.Kn)(e)?e:{style:{}};let o=t.style;return(0,c.H)(o)&&(o=JSON.parse(o)||{}),(0,l.Kn)(o)||(o={}),{...t,style:o}})(e),o=(0,a.vc)(t),n=(0,a.l8)(t),i=(0,a.su)(t),u=(0,s.f)(t);return{className:r()(u.className,o.className,n.className,i.className),style:{...u.style,...o.style,...n.style,...i.style}}}},1473:(e,t,o)=>{o.d(t,{f:()=>l});var n=o(7884),r=o(2646);const l=e=>{const t=(0,n.Kn)(e.style.typography)?e.style.typography:{},o=(0,r.H)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:o,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}}},2661:(e,t,o)=>{o.d(t,{l8:()=>d,su:()=>v,vc:()=>u});var n=o(4184),r=o.n(n),l=o(9784),c=o(2289),s=o(7884);function a(e={}){const t={};return(0,c.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function i(e,t){return e&&t?`has-${(0,l.o)(t)}-${e}`:""}function u(e){var t,o,n,l,c,u,d;const{backgroundColor:v,textColor:p,gradient:f,style:m}=e,g=i("background-color",v),y=i("color",p),b=function(e){if(e)return`has-${e}-gradient-background`}(f),h=b||(null==m||null===(t=m.color)||void 0===t?void 0:t.gradient);return{className:r()(y,b,{[g]:!h&&!!g,"has-text-color":p||(null==m||null===(o=m.color)||void 0===o?void 0:o.text),"has-background":v||(null==m||null===(n=m.color)||void 0===n?void 0:n.background)||f||(null==m||null===(l=m.color)||void 0===l?void 0:l.gradient),"has-link-color":(0,s.Kn)(null==m||null===(c=m.elements)||void 0===c?void 0:c.link)?null==m||null===(u=m.elements)||void 0===u||null===(d=u.link)||void 0===d?void 0:d.color:void 0}),style:a({color:(null==m?void 0:m.color)||{}})}}function d(e){var t;const o=(null===(t=e.style)||void 0===t?void 0:t.border)||{};return{className:function(e){var t;const{borderColor:o,style:n}=e,l=o?i("border-color",o):"";return r()({"has-border-color":!!o||!(null==n||null===(t=n.border)||void 0===t||!t.color),[l]:!!l})}(e),style:a({border:o})}}function v(e){var t;return{className:void 0,style:a({spacing:(null===(t=e.style)||void 0===t?void 0:t.spacing)||{}})}}},8519:(e,t,o)=>{o.d(t,{F:()=>n});const n=e=>null===e},1478:(e,t,o)=>{o.d(t,{h:()=>n});const n=e=>"number"==typeof e},7884:(e,t,o)=>{o.d(t,{$n:()=>l,Kn:()=>r});var n=o(8519);const r=e=>!(0,n.F)(e)&&e instanceof Object&&e.constructor===Object;function l(e,t){return r(e)&&t in e}},2646:(e,t,o)=>{o.d(t,{H:()=>n});const n=e=>"string"==typeof e},1290:(e,t,o)=>{o.d(t,{$:()=>l});var n=o(7582),r=o(307);function l(e,t){return void 0===t&&(t={}),(0,r.B)(e,(0,n.pi)({delimiter:"."},t))}},9562:(e,t,o)=>{function n(e){return e.toLowerCase()}o.d(t,{U:()=>n})},307:(e,t,o)=>{o.d(t,{B:()=>c});var n=o(9562),r=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],l=/[^A-Z0-9]+/gi;function c(e,t){void 0===t&&(t={});for(var o=t.splitRegexp,c=void 0===o?r:o,a=t.stripRegexp,i=void 0===a?l:a,u=t.transform,d=void 0===u?n.U:u,v=t.delimiter,p=void 0===v?" ":v,f=s(s(e,c,"$1\0$2"),i,"\0"),m=0,g=f.length;"\0"===f.charAt(m);)m++;for(;"\0"===f.charAt(g-1);)g--;return f.slice(m,g).split("\0").map(d).join(p)}function s(e,t,o){return t instanceof RegExp?e.replace(t,o):t.reduce((function(e,t){return e.replace(t,o)}),e)}},9784:(e,t,o)=>{o.d(t,{o:()=>l});var n=o(7582),r=o(1290);function l(e,t){return void 0===t&&(t={}),(0,r.$)(e,(0,n.pi)({delimiter:"-"},t))}},7582:(e,t,o)=>{o.d(t,{pi:()=>n});var n=function(){return n=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError}}]);