"use strict";const e=require("../../../../common/vendor.js");require("../../../adapter-vue.js");const a=require("../search-type-list.js"),r=require("../search-time-list.js"),n=require("../../../../common/assets.js"),t=require("../../../utils/env.js");Math||(s+o)();const s=()=>"../../common/Icon.js",o=()=>"../../common/DatePicker/index.js",u=e.defineComponent({__name:"index",props:{popupPosition:{type:String,default:"bottom"},searchType:{type:String,default:"global",validator:e=>["global","conversation"].includes(e)}},emits:["searchConfigChange","closeInConversationSearch"],setup(s,{emit:o}){const u=s,i=o,c=e.computed((()=>"conversation"===(null==u?void 0:u.searchType)?a.conversationSearchTypeList:a.globalSearchTypeList)),l=e.ref(a.searchMessageTypeDefault[null==u?void 0:u.searchType]),h=e.ref(r.searchMessageTimeDefault),p=e.computed((()=>"contact"!==l.value.key&&"group"!==l.value.key)),f=e.computed((()=>t.isPC&&"global"===u.searchType&&!t.isUniFrameWork?"two":"one")),v=e.ref(!1);function d(e){(null==e?void 0:e.searchType)===(null==u?void 0:u.searchType)&&(l.value=(null==e?void 0:e.value)||a.searchMessageTypeDefault[null==u?void 0:u.searchType])}function T(e){(null==e?void 0:e.searchType)===(null==u?void 0:u.searchType)&&(h.value=(null==e?void 0:e.value)||r.searchMessageTimeDefault)}e.onMounted((()=>{e.Jt.watch(e.o.SEARCH,{currentSearchMessageType:d,currentSearchMessageTime:T})})),e.onUnmounted((()=>{e.Jt.unwatch(e.o.SEARCH,{currentSearchMessageType:d,currentSearchMessageTime:T})}));const y=()=>{var a;"all"!==(null==(a=h.value)?void 0:a.key)?e.Jt.update(e.o.SEARCH,"currentSearchMessageTime",{value:r.searchMessageTimeDefault,searchType:u.searchType}):v.value=!0},m=a=>{var r,n,t;if("all"===(null==(r=h.value)?void 0:r.key)){const{startDate:r,endDate:s}=a,o=Number(((null==(n=null==s?void 0:s.toDate())?void 0:n.getTime())/1e3).toFixed(0)),i=o-Number(((null==(t=null==r?void 0:r.toDate())?void 0:t.getTime())/1e3).toFixed(0)),c={key:h.value.key,label:h.value.label,value:{timePosition:o,timePeriod:i}};e.Jt.update(e.o.SEARCH,"currentSearchMessageTime",{value:c,searchType:u.searchType})}},g=()=>{var a;v.value=!1,"all"===(null==(a=h.value)?void 0:a.key)&&e.Jt.update(e.o.SEARCH,"currentSearchMessageTime",{value:r.searchMessageTimeDefault,searchType:u.searchType})},S=()=>{i("closeInConversationSearch")};return(a,s)=>e.e({a:"conversation"===u.searchType&&!e.unref(t.isUniFrameWork)},"conversation"!==u.searchType||e.unref(t.isUniFrameWork)?{}:{b:e.t(e.unref(e.Wt).t("TUISearch.搜索会话内容")),c:e.p({file:e.unref(n.closeIcon$1),width:"14px",height:"14px"}),d:e.o$1(S)},{e:e.f(e.unref(c),((a,r,n)=>({a:e.t(e.unref(e.Wt).t(`TUISearch.${a.label}`)),b:r,c:e.n(e.unref(l).key===a.key&&"tui-search-tabs-item-selected"),d:e.o$1((r=>{return n=a,void e.Jt.update(e.o.SEARCH,"currentSearchMessageType",{value:n,searchType:u.searchType});var n}),r)}))),f:e.unref(p)},e.unref(p)?{g:e.f(e.unref(r.searchMessageTimeList),((a,r,t)=>e.e({a:"all"===a.key},"all"===a.key?e.e({b:!e.unref(v)},e.unref(v)?{}:{c:e.t(e.unref(e.Wt).t("TUISearch.选择时间")+":  "+e.unref(e.Wt).t("TUISearch.全部")),d:"440f7fd2-1-"+t,e:e.p({file:e.unref(n.downSVG),width:"14px",height:"14px"}),f:e.o$1(y,r)},{g:e.unref(v)},e.unref(v)?{h:e.o$1(m,r),i:"440f7fd2-2-"+t,j:e.p({type:"range",rangeTableType:e.unref(f)})}:{},{k:e.o$1((()=>{}),r),l:e.unref(v)},e.unref(v)?{m:"440f7fd2-3-"+t,n:e.p({file:e.unref(n.closeIcon),width:"14px",height:"14px"}),o:e.o$1(g,r)}:{}):{p:e.t(e.unref(e.Wt).t(`TUISearch.${a.label}`))},{q:r,r:e.n(e.unref(h).key===a.key&&"tui-search-time-item-selected"),s:e.o$1((r=>{return n=a,void(v.value&&"all"===n.key?v.value=!1:(v.value=!1,e.Jt.update(e.o.SEARCH,"currentSearchMessageTime",{value:n,searchType:u.searchType})));var n}),r)})))}:{},{h:e.n(e.unref(t.isPC)&&`tui-search-container-${u.popupPosition}`),i:e.n(!e.unref(t.isPC)&&"tui-search-container-h5-main"),j:e.n(!e.unref(t.isPC)&&"tui-search-container-h5"),k:e.n(e.unref(t.isPC)&&`container-${u.popupPosition}`),l:e.n(`container-${u.searchType}`)})}}),i=e._export_sfc(u,[["__scopeId","data-v-440f7fd2"]]);wx.createComponent(i);
