import{_ as B}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as j}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{et as H,dE as L,i as N}from"./index-BTglIPU2.js?v=1773287522785";import{a1 as P,b as V,al as z,B as D}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{k as I,R as O,t as T,r as Z,e as q,$ as A,Z as F,a0 as n,S as s,a9 as i,_ as o,j as d,aa as r}from"./vue-core-DJjvd5ZC.js?v=1773287522785";const G={class:"w-300px"},J={class:"w-300px"},K={class:"w-300px"},M={class:"flex flex-col"},et=I({__name:"form",props:{site:{}},emits:["changeHotlink"],setup(v,{expose:g,emit:h}){const{t:c}=O(),S=v,k=h,_=T(S,"site"),x=Z(null),t=q({fix:"",domains:"",return_rule:"",status:!1,http_status:!1}),w={fix:{trigger:["blur","change"],validator:()=>t.fix.trim()===""?new Error(c("Site.RulesError.index_330")):!0},return_rule:{trigger:["blur","change"],validator:()=>t.return_rule.trim()===""?new Error(c("Site.RulesError.index_330")):!0}},$=()=>{p()},C=()=>{p()},y=()=>({id:_.value.id,name:_.value.name,fix:t.fix,domains:t.domains.trim().split("\n").join(","),return_rule:t.return_rule,status:t.status,http_status:t.http_status}),p=async()=>{var e;await((e=x.value)==null?void 0:e.validate()),await H(y()),k("changeHotlink",t.status),m()},m=async()=>{const{message:e}=await L({id:_.value.id,name:_.value.name});N(e)&&(t.fix=e.fix,t.domains=e.domains.split(",").join("\n"),t.return_rule=e.return_rule,t.status=e.status,t.http_status=e.http_status==="true"||e.http_status===!0)};return m(),g({init:m}),(e,a)=>{const f=V,u=P,b=z,R=D,U=j,E=B;return A(),F("div",null,[n(U,{ref_key:"formRef",ref:x,class:"px-8px",model:s(t),rules:w},{default:i(()=>[n(u,{label:e.$t("Site.Lable.index_6"),path:"fix"},{default:i(()=>[o("div",G,[n(f,{value:s(t).fix,"onUpdate:value":a[0]||(a[0]=l=>s(t).fix=l),disabled:s(t).status,placeholder:""},null,8,["value","disabled"])])]),_:1},8,["label"]),n(u,{label:e.$t("Site.Lable.index_7")},{default:i(()=>[o("div",J,[n(f,{value:s(t).domains,"onUpdate:value":a[1]||(a[1]=l=>s(t).domains=l),type:"textarea",autosize:{minRows:6,maxRows:6},placeholder:""},null,8,["value"])])]),_:1},8,["label"]),n(u,{label:e.$t("Site.Lable.index_13"),path:"return_rule"},{default:i(()=>[o("div",K,[n(f,{value:s(t).return_rule,"onUpdate:value":a[2]||(a[2]=l=>s(t).return_rule=l),disabled:s(t).status,placeholder:""},null,8,["value","disabled"])])]),_:1},8,["label"]),n(u,{label:" "},{default:i(()=>[o("div",M,[n(b,{checked:s(t).status,"onUpdate:checked":[a[3]||(a[3]=l=>s(t).status=l),$]},{default:i(()=>[d(r(e.$t("Site.Config.index_94")),1)]),_:1},8,["checked"]),n(b,{checked:s(t).http_status,"onUpdate:checked":[a[4]||(a[4]=l=>s(t).http_status=l),C],class:"mt-16px"},{default:i(()=>[d(r(e.$t("Site.Config.index_95")),1)]),_:1},8,["checked"])])]),_:1}),n(u,{label:" ","show-feedback":!1},{default:i(()=>[n(R,{type:"primary",onClick:p},{default:i(()=>[d(r(e.$t("Site.Cert.index_60")),1)]),_:1})]),_:1})]),_:1},8,["model"]),n(E,{class:"mt-20px"},{default:i(()=>[o("li",null,[d(r(e.$t("Site.Config.index_96")),1),a[5]||(a[5]=o("br",null,null,-1)),d(" "+r(e.$t("Site.Config.index_97")),1)]),o("li",null,r(e.$t("Site.Config.index_98")),1),o("li",null,r(e.$t("Site.Config.index_99")),1)]),_:1})])}}});export{et as _};
