import{_ as e}from"./index105.js?v=1761009159";import{b as a,P as s,l,k as t,j as o}from"./utils-lib.js?v=1761009159";import{c as n,r,o as u,v as i,x as d,e as p,B as c,I as m,y as f,G as _,b3 as y,J as b,V as g,q as k,H as w,N as h,C as v,z as x,Q as j,ab as q,a9 as C}from"./base-lib.js?v=1761009159";import{bm as V,bn as z,bo as R,bp as U,bq as H}from"./firewall.js?v=1761009159";import{u as I}from"./column.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const S=n({__name:"upload-thesaurus",emits:["upload-success"],setup(e,{expose:s,emit:l}){const t=a(),o=r(),n=r(),g=l,k=window.location.protocol+"//"+window.location.host+"/project/content/in_thesaurus",w=u({f_size:0,f_path:"/tmp/",f_name:"inthesaurus.txt",f_start:0}),h=r([]),v=[".txt"].join(","),x=()=>{g("upload-success")},j=()=>{t.error("导入失败")},q={"x-http-token":window.vite_public_request_token},C=e=>{e.value=e,w.f_size=e.size,w.f_start=0},V=(e,a)=>{h.value=a},z=(e,a,s)=>{w.f_start=e.percent,h.value=s.map(s=>(s.uid===a.uid&&(s.percentage=e.percent),s))};return s({onConfirm:()=>{n.value.submit()},open:()=>{o.value.$el.click()},fileData:w}),(e,a)=>{const s=_,l=y;return i(),d("div",null,[p(l,{class:"upload-demo",ref_key:"uploadRef",ref:n,name:"blob",data:f(w),action:k,headers:q,accept:f(v),"on-error":j,multiple:!1,"show-file-list":!1,"auto-upload":!0,"on-success":x,"on-progress":z,"file-list":f(h),"on-change":V,"before-upload":C},{default:c(()=>[m(p(s,{ref_key:"openRef",ref:o,size:"small",type:"primary"},null,512),[[b,!1]])]),_:1},8,["data","accept","file-list"])])}}}),A=n({__name:"own-thesaurus",setup(a){const n=r(null),d=g([]),y=r(!1),b=r(null),A=r(!1),B=u({key:""}),D=u({key:[{trigger:["blur","change"],required:!0,message:"请输入关键词"}]}),F=async()=>{n.value.open()},G=async()=>{const e=await s({loading:"正在导出关键词文件，请稍后...",request:V(),data:{msg:String}});window.open("/download?filename="+e.msg,"_blank","noopener,noreferrer")},J=async e=>{Q()},N=[{label:"关键词\t",render:e=>p("span",null,[e])},I([{onClick:async e=>{await s({loading:"正在删除关键词，请稍后...",request:z({key:e}),message:!0}),Q()},title:"删除"}])],P=async()=>{await s({loading:"正在清空自定义词库，请稍后...",request:R(),message:!0}),Q()},Q=async()=>{await s({loading:"正在加载词库列表，请稍后...",request:U(),data:[Array,d]})},T=async e=>{await b.value.validate(),await s({loading:"正在添加关键词，请稍候...",request:H(B),message:!0}),B.key="",A.value=!1,Q()};return k(()=>Q()),(a,s)=>{const r=_,u=l,g=t,k=q,V=C,z=o,R=e,U=w("bt-loading");return i(),h(R,{class:"px-[1.6rem] py-[1.6rem]"},{"header-left":c(()=>[p(r,{onClick:s[0]||(s[0]=e=>A.value=!0),type:"primary"},{default:c(()=>s[3]||(s[3]=[v("添加",-1)])),_:1,__:[3]}),p(r,{onClick:F},{default:c(()=>s[4]||(s[4]=[v("导入",-1)])),_:1,__:[4]}),p(r,{onClick:G},{default:c(()=>s[5]||(s[5]=[v("导出",-1)])),_:1,__:[5]}),p(r,{onClick:P},{default:c(()=>s[6]||(s[6]=[v("清空",-1)])),_:1,__:[6]}),p(S,{ref_key:"fileIpRef",ref:n,onUploadSuccess:J},null,512)]),content:c(()=>[m(p(u,{"max-height":"260",column:N,data:f(d),description:"词库列表为空"},null,8,["data"]),[[U,f(y)],[U,"正在加载词库列表，请稍后...","title"]])]),popup:c(()=>[p(z,{title:"添加自定义词库",modelValue:f(A),"onUpdate:modelValue":s[2]||(s[2]=e=>j(A)?A.value=e:null),area:42,onConfirm:T,showFooter:""},{default:c(()=>[p(V,{ref_key:"addThesaurusRef",ref:b,rules:f(D),model:f(B),class:"p-[2rem]","label-width":"5rem"},{default:c(()=>[p(k,{label:"关键词",prop:"key"},{default:c(()=>[p(g,{modelValue:f(B).key,"onUpdate:modelValue":s[1]||(s[1]=e=>f(B).key=e),width:"20rem",placeholder:"请输入你需要扫描的关键词"},null,8,["modelValue"])]),_:1}),s[7]||(s[7]=x("ul",{class:"leading-8 text-small list-disc ml-20px"},[x("li",null,"关键字小于2时会引起大量误报，请设置大于等于2个关键字！")],-1))]),_:1,__:[7]},8,["rules","model"])]),_:1},8,["modelValue"])]),_:1})}}});export{A as default};
