"use strict";const e=require("../../adapter-vue.js"),t=require("../../constant.js"),a=require("../../../../common/vendor.js"),{computed:l,ref:r,watchEffect:s}=e.vue,n={props:{ratingTemplate:{type:Object,default:()=>({})}},emits:["sendMessage"],setup(e,{emit:a}){const n=r(!1),u=r(""),i=r(-1),p=r(-1),o=r(!1),m=l((()=>{var t;return null==(t=e.ratingTemplate)?void 0:t.menu.map((e=>e.content))})),c=l((()=>{var t;return null==(t=e.ratingTemplate)?void 0:t.menu.map(((e,t)=>t))}));s((()=>{if(u.value=e.ratingTemplate.sessionId||"",null!=e.ratingTemplate.selected)for(let t=0;t<e.ratingTemplate.menu.length;t++)if(e.ratingTemplate.menu[t].id==e.ratingTemplate.selected.id){n.value=!0,i.value=t;break}Math.floor((new Date).getTime()/1e3)>e.ratingTemplate.expireTime&&(o.value=!0)}));return{props:e,hasReply:n,sessionId:u,selectValue:i,hoverValue:p,hasExpire:o,desc:m,numberList:c,setValue:e=>{n.value||(i.value=e)},setHoverValue:e=>{n.value||(p.value=e)},submitRatingStar:()=>{if(i.value>=0){const l={data:JSON.stringify({src:t.CUSTOM_MESSAGE_SRC.MENU_SELECTED,menuSelected:{id:e.ratingTemplate.menu[i.value].id,content:e.ratingTemplate.menu[i.value].content,sessionId:u.value},customerServicePlugin:0})};n.value=!0,a("sendMessage",l)}}}}};const u=a._export_sfc(n,[["render",function(e,t,l,r,s,n){return a.e({a:a.t(r.props.ratingTemplate.head),b:a.f(r.numberList,((e,t,l)=>({a:a.t(e+1),b:t,c:t===r.selectValue||t===r.hoverValue?1:"",d:t!==r.selectValue&&t!==r.hoverValue?1:"",e:0===t?"0px":"20px",f:a.o$1((e=>r.setValue(t)),t),g:a.o$1((e=>r.setHoverValue(t)),t),h:a.o$1((e=>r.setHoverValue(-1)),t)}))),c:"5px",d:a.t(-1===r.hoverValue?-1===r.selectValue?"如果满意请给好评哦～":r.desc[r.selectValue]:r.desc[r.hoverValue]),e:"10px",f:"10px",g:r.hasReply||r.hasExpire,h:a.o$1(((...e)=>r.submitRatingStar&&r.submitRatingStar(...e))),i:r.hasReply},r.hasReply?{j:a.t(r.props.ratingTemplate.tail),k:"20px"}:{})}],["__scopeId","data-v-587b09df"]]);wx.createComponent(u);
