import{d as e,r as l,E as a,I as t,e as u,D as s,A as n,$ as i,y as o,B as p,F as r,k as v}from"./main-D8Z-8iPZ.js";import{u as d}from"./useStore-CEiyUWBM.js";import{S as f}from"./index-4SW2EnHr.js";import{N as m}from"./text-BWsiCV4g.js";function y(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!v(e)}const c=e({name:"NotifyProviderSelect",props:{path:{type:String,default:""},value:{type:String,default:""},valueType:{type:String,default:"value"},isAddMode:{type:Boolean,default:!1}},emits:["update:value"],setup(e,{emit:v}){const{fetchNotifyProvider:c,notifyProvider:b}=d(),_=l({label:"",value:"",type:""}),x=l([]),g=()=>{window.open("/settings?tab=notification","_blank")},j=({option:l})=>u("div",{class:"flex items-center"},[l.label?u(r,null,[u(f,{iconName:`notify-${"value"===e.valueType?l.type:l.value}`,size:"2rem"},null),u("div",{class:"ml-[.8rem] p-[4px_0]"},[u(m,null,{default:()=>[l.label]})])]):u("span",{class:"text-[1.4rem] text-gray-400"},[i("t_0_1745887835267")])]),S=l=>u("div",{style:{display:"flex",alignItems:"center"}},[u(f,{iconName:`notify-${"value"===e.valueType?l.type:l.value}`,size:"2rem"},null),u("div",{class:"ml-[.8rem] p-[4px_0]"},[u(m,null,{default:()=>[l.label]})])]),N=e=>{if(!e)return;const l=x.value.find((l=>l.value===e));_.value={label:(null==l?void 0:l.label)||"",value:(null==l?void 0:l.value)||"",type:(null==l?void 0:l.type)||""}},T=e=>{N(e),v("update:value",_.value)};return a((()=>e.value),(e=>N(e)),{immediate:!0}),a((()=>b.value),(l=>{x.value=l.map((l=>({label:l.label,value:"value"===e.valueType?l.value:l.type,type:"value"===e.valueType?l.type:l.value})))||[],N(e.value)})),t((()=>{c()})),()=>{let l,a;return u(s,{cols:24},{default:()=>[u(n,{span:e.isAddMode?13:24,label:i("t_1_1745887832941"),path:e.path},{default:()=>[u(o,{class:"flex-1 w-full ",options:x.value,renderLabel:S,renderTag:j,filterable:!0,placeholder:i("t_0_1745887835267"),value:_.value.value,"onUpdate:value":e=>_.value.value=e,onUpdateValue:T},{empty:()=>u("span",{class:"text-[1.4rem]"},[i("t_0_1745887835267")])})]}),e.isAddMode&&u(n,{span:11},{default:()=>[u(p,{class:"mx-[8px]",onClick:g},y(l=i("t_2_1745887834248"))?l:{default:()=>[l]}),u(p,{onClick:c},y(a=i("t_0_1746497662220"))?a:{default:()=>[a]})]})]})}}});export{c as N};
