import{d as F,O as ie,k as h,v as re,w as le,p as ce,r as L,o as r,x as k,b as o,a as n,c as d,u as e,z as m,t as y,F as $,h as J,A as N,E as pe,B as C}from"./vue.1703796278973.js";import{cx as ue,cy as de,aP as me,av as _e,aw as fe,a as ge,E as ye,I as ve,r as he,aG as ke,F as we,K as be}from"./index.17037962789732.js";import"./index.170379627897315.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import{_ as Ce}from"./index.vue_vue_type_script_setup_true_name_ValueItem_lang.1703796278973.js";import"./index.170379627897314.js";import{_ as xe}from"./index.17037962789739.js";import{h as je}from"./system.1703796278973.js";import"./index.170379627897317.js";import"./index.170379627897327.js";import{_ as Se}from"./index.vue_vue_type_script_setup_true_name_PermissionButton_lang.1703796278973.js";import"./index.1703796278973316.js";import"./index.170379627897330.js";import{i as Pe,j as Ie,s as $e,u as Te}from"./accessConfig.1703796278973.js";import Ve from"./index.1703796278973191.js";import{o as D}from"./comm.1703796278973.js";import{C as Ae}from"./rules.1703796278973.js";import{_ as Be}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897337.js";import"./index.170379627897338.js";import"./index.170379627897329.js";import"./index.170379627897325.js";import"./index.170379627897322.js";import"./index.170379627897323.js";import"./index.170379627897324.js";import"./index.170379627897316.js";import"./style.1703796278973.js";import"./index.170379627897332.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./permission.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";import"./index.170379627897320.js";import"./index.170379627897321.js";import"./index.1703796278973308.js";const Ee={class:"steps-content"},Re={key:0,class:"steps-box"},qe={class:"search"},Le={class:"plugin-other"},Je={class:"plugin-id"},Ne={class:"other-content"},De={class:"plugin-version"},Fe={class:"other-content"},Me={key:1,class:"steps-box"},Oe={class:"steps-action"},Ue=F({name:"AccessConfigPlugin"}),ze=F({...Ue,props:{provider:{type:Object,default:()=>{}},data:{type:Object,default:()=>{}}},setup(M){const _=M,T=ie(),O=je(),u=h(0),w=h([]),f=h(_.data.channelId),x=T.params.id,U=T.query.view,V=document.body.clientHeight,S=h(!1),c=re({name:void 0,description:void 0,configuration:{}}),A=h(),P=h([]),B=(t={})=>{Pe({...t,sorts:[{name:"createTime",order:"desc"}],paging:!1}).then(s=>{w.value=[],s.success&&(w.value=s.result||[])})},z=t=>{var p,v;let s="输入",a=[];["select","date"].includes(((p=t.type)==null?void 0:p.type)||"string")&&(s="选择"),t.required&&a.push({required:!0,message:`请${s}${t.name}`});const l=Ae((v=t.type)==null?void 0:v.type);return a=[...a,...l],a},H=(t,s=!0)=>{Ie(t).then(a=>{var l,p,v;if(a.success){const j=((v=(p=(l=a.result)==null?void 0:l.others)==null?void 0:p.configMetadata)==null?void 0:v.properties)||[];P.value=j.map(g=>{var b;return s&&(c.configuration[g.property]=void 0),{label:g.name,name:g.property,type:((b=g.type)==null?void 0:b.type)||"string",rules:z(g)}})}})},G=t=>{B({terms:[{column:"name",termType:"like",value:`%${t}%`}]})},K=t=>{_.data.id||(f.value=t)},Q=()=>{var a;const t=(a=O.menus["link/plugin"])==null?void 0:a.path,s=window.open(`${window.location.origin+window.location.pathname}#${t}?save=true`);s.onTabSaveSuccess=l=>{var p;l.success&&(f.value=(p=l.result)==null?void 0:p.id,w.value.unshift(l.result))}},W=()=>{if(!f.value)return D("请选择插件!","error");u.value+=1},X=()=>{u.value-=1},Y=()=>{A.value.validate().then(async t=>{var s;if(t){const a={..._.data,...t,protocol:"plugin",channel:"plugin",channelId:f.value,provider:_.provider.id,transport:"plugin"};S.value=!0;const l=x===":id"?await $e(a).catch(()=>{}):await Te({...a,id:x}).catch(()=>{});S.value=!1,l.success&&(D("操作成功","success"),history.back(),window.onTabSaveSuccess&&(s=l.result)!=null&&s.id&&(window.onTabSaveSuccess(l),setTimeout(()=>window.close(),300)))}})};return le(()=>{u.value===1&&f.value&&H(f.value,f.value!==_.data.channelId)}),ce(()=>{x!==":id"&&(c.name=_.data.name,c.description=_.data.description,c.configuration=_.data.configuration)}),B(),(t,s)=>{const a=ue,l=de,p=me,v=L("AIcon"),j=Se,g=L("Ellipsis"),b=_e,E=fe,Z=ge,ee=ye,R=xe,te=ve,I=he,oe=ke,ne=Ce,se=we,q=be;return r(),k("div",null,[o(l,{current:e(u)},{default:n(()=>[(r(),d(a,{disabled:"",key:0,title:"选择插件"})),(r(),d(a,{disabled:"",key:1,title:"完成"}))]),_:1},8,["current"]),m("div",Ee,[e(u)===0?(r(),k("div",Re,[m("div",qe,[o(p,{allowClear:"",placeholder:"请输入",style:{width:"300px"},onSearch:G}),o(j,{type:"primary",onClick:Q,hasPermission:"link/plugin:add"},{icon:n(()=>[o(v,{type:"PlusOutlined"})]),default:n(()=>[y(" 新增 ")]),_:1})]),o(ee,{height:"480"},{default:n(()=>[e(w).length>0?(r(),d(E,{key:0,gutter:[24,24],style:{width:"100%"}},{default:n(()=>[(r(!0),k($,null,J(e(w),i=>(r(),d(b,{span:8,key:i.id},{default:n(()=>[o(Ve,{onCheckedChange:K,checked:e(f),disabled:e(x)!==":id",data:{...i,type:"plugin"}},{other:n(()=>[m("div",Le,[m("div",Je,[y(" 插件ID: "),m("div",Ne,[o(g,null,{default:n(()=>[y(N(i.id),1)]),_:2},1024)])]),m("div",De,[y(" 版本号: "),m("div",Fe,[o(g,null,{default:n(()=>[y(N(i.version),1)]),_:2},1024)])])])]),_:2},1032,["checked","disabled","data"])]),_:2},1024))),128))]),_:1})):(r(),d(Z,{key:1,style:{"margin-top":"10%"},description:"暂无数据"}))]),_:1})])):e(u)===1?(r(),k("div",Me,[m("div",{class:"card-last",style:pe(`max-height:${e(V)>900?750:e(V)*.7}px`)},[o(E,{gutter:[24,24]},{default:n(()=>[o(b,{span:16},{default:n(()=>[o(R,{data:"基本信息"}),o(se,{ref_key:"formRef",ref:A,model:e(c),layout:"vertical"},{default:n(()=>[o(I,{label:"名称",rules:[{required:!0,message:"请输入名称",trigger:"blur"},{max:64,message:"最多可输入64个字符"}],name:"name"},{default:n(()=>[o(te,{value:e(c).name,"onUpdate:value":s[0]||(s[0]=i=>e(c).name=i),allowClear:"",placeholder:"请输入名称"},null,8,["value"])]),_:1}),o(I,{label:"说明",rules:[{max:200,message:"最多可输入200个字符"}],name:"description"},{default:n(()=>[o(oe,{placeholder:"请输入说明",rows:4,value:e(c).description,"onUpdate:value":s[1]||(s[1]=i=>e(c).description=i),"show-count":"",maxlength:200},null,8,["value"])]),_:1}),e(P).length?(r(),k($,{key:0},[o(R,{data:"通用配置"}),(r(!0),k($,null,J(e(P),i=>(r(),d(I,{key:i.name,name:["configuration",i.name],label:i.label,rules:i.rules},{default:n(()=>[o(ne,{modelValue:e(c).configuration[i.name],"onUpdate:modelValue":ae=>e(c).configuration[i.name]=ae,itemType:i.type},null,8,["modelValue","onUpdate:modelValue","itemType"])]),_:2},1032,["name","label","rules"]))),128))],64)):C("",!0)]),_:1},8,["model"])]),_:1})]),_:1})],4)])):C("",!0)]),m("div",Oe,[e(u)>0?(r(),d(q,{key:0,onClick:X,style:{"margin-right":"8px"}},{default:n(()=>[y(" 上一步 ")]),_:1})):C("",!0),e(u)===1&&e(U)==="false"?(r(),d(j,{key:1,type:"primary",style:{"margin-right":"8px"},onClick:Y,hasPermission:`link/AccessConfig:${t.id===":id"?"add":"update"}`,loading:e(S)},{default:n(()=>[y(" 保存 ")]),_:1},8,["hasPermission","loading"])):C("",!0),e(u)===0?(r(),d(q,{key:2,type:"primary",onClick:W},{default:n(()=>[y(" 下一步 ")]),_:1})):C("",!0)])])}}});const qt=Be(ze,[["__scopeId","data-v-8c7857b4"]]);export{qt as default};