view.js
1 lines
| 1 | import*as t from"@wordpress/interactivity";var e={2833(e,r,a){e.exports=(t=>{var e={};return a.d(e,t),e})({getContext:()=>t.getContext,getElement:()=>t.getElement,store:()=>t.store})},402(t,e,r){r.d(e,{Vp:()=>n});const a={stars:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.62L12 2 9.19 8.62 2 9.24l5.46 4.73L5.82 21z",hearts:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"};function n(t,e,r,n=""){const s=a[r]||a.stars;let i=n?`<span class="screen-reader-text">${n}</span>`:"";for(let r=1;r<=e;r++){i+=`<svg class="field-rating__icon ${r<=t?"is-filled":""}" viewBox="0 0 24 24" aria-hidden="true"><path d="${s}"></path></svg>`}return i}},3020(t,e,r){function a(t){return"rating"===t?.type?{rating:t.rating??0,maxRating:t.maxRating??5,iconStyle:t.iconStyle??"stars"}:null}function n(t){return"rating"===t?.type}function s(t){return n(t)&&t?.displayValue?t.displayValue:null}r.d(e,{$9:()=>n,$t:()=>s,eL:()=>a})}},r={};function a(t){var n=r[t];if(void 0!==n)return n.exports;var s=r[t]={exports:{}};return e[t](s,s.exports,a),s.exports}a.d=(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};a.d(n,{$9:()=>o.$9,$t:()=>o.$t,eL:()=>o.eL});var s=a(2833),i=a(402),o=a(3020);(0,s.store)("jetpack/form",{callbacks:{watchRatingIcons(){const{ref:t}=(0,s.getElement)(),e=(0,s.getContext)();let r=e.submission?.rating;if(!r&&t?.dataset?.rating)try{r=JSON.parse(t.dataset.rating)}catch{}if(!r)return;const{rating:a,maxRating:n,iconStyle:o,screenReaderText:l}=r;t.innerHTML=(0,i.Vp)(a,n,o,l)}}});const l=n.eL,c=n.$t,g=n.$9;export{l as getRating,c as getRatingDisplayValue,g as isRatingValue}; |