const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["MkTokenGenerateWindow-Pr3eS6cf.js","app-QjDgb7aF.js","vue-Cm77DuTi.js","charts-3gEHPHRq.js","media-DuCIZ-3n.js","app-CV_aoXZ3.css"])))=>i.map(i=>d[i]);
import{aA as M,b as o,a9 as R,aB as q,M as T,q as s,a as I,d as S,l as A,at as E,u as j,be as L,C as v}from"./app-QjDgb7aF.js";import{g as $,I as J}from"./parser-DaoUb5SB.js";import{P as O}from"./index-BT0jOPXg.js";import{v as U}from"./v4-Dnyct6Ft.js";import{b as W,j as z,p as F,k as p,i as c,J as d,D as m,u as f,q as k,a as G,d as H,n as K}from"./vue-Cm77DuTi.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const Q={class:"_formRoot"},X={class:"_formBlock"},ie=W({__name:"plugin.install",setup(Y){const n=G();function y(t){try{return L(t,"0.12.0")>=0}catch{return!1}}function h({id:t,meta:e,src:a,token:r}){v.set("plugins",v.get("plugins").concat({...e,id:t,active:!0,configData:{},src:a,token:r}))}const x=new O;async function V(){if(n.value==null)return;const t=$(n.value);if(t==null){s({type:"error",text:"No language version annotation found :("});return}if(!y(t)){s({type:"error",text:`aiscript version '${t}' is not supported :(`});return}let e;try{e=x.parse(n.value)}catch(u){s({type:"error",text:`Syntax error : ${u}`});return}const a=J.collectMetadata(e);if(a==null){s({type:"error",text:"No metadata found :("});return}const r=a.get(null);if(r==null){s({type:"error",text:"No metadata found :("});return}const{name:l,version:_,author:g,description:b,permissions:i,config:B}=r;if(l==null||_==null||g==null){s({type:"error",text:"Required property (name, version, author) not found :("});return}const P=i==null||i.length===0?null:await new Promise((u,Z)=>{I(H(()=>A(()=>import("./MkTokenGenerateWindow-Pr3eS6cf.js"),__vite__mapDeps([0,1,2,3,4,5]))),{title:o.ts.tokenRequested,information:o.ts.pluginTokenRequestedDescription,initialName:l,initialPermissions:i},{done:async w=>{const{name:N,permissions:C}=w,{token:D}=await S("miauth/gen-token",{session:null,name:N,permission:C});u(D)}},"closed")});h({id:U(),meta:{name:l,version:_,author:g,description:b,permissions:i,config:B},src:n.value,token:P}),E(),K(()=>{j()})}return M({title:o.ts._plugin.install,icon:"ph-download-simple ph-bold ph-lg"}),(t,e)=>(z(),F("div",Q,[p(R,{warn:"",class:"_formBlock"},{default:c(()=>[d(m(f(o).ts._plugin.installWarn),1)]),_:1}),p(q,{modelValue:n.value,"onUpdate:modelValue":e[0]||(e[0]=a=>n.value=a),tall:"",class:"_formBlock"},{label:c(()=>[d(m(f(o).ts.code),1)]),_:1},8,["modelValue"]),k("div",X,[p(T,{disabled:n.value==null,primary:"",inline:"",onClick:V},{default:c(()=>[e[1]||(e[1]=k("i",{class:"ph-check ph-bold ph-lg"},null,-1)),d(" "+m(f(o).ts.install),1)]),_:1},8,["disabled"])])]))}});export{ie as default};
//# sourceMappingURL=plugin.install-DC2vtahi.js.map
