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