import{K as t,a7 as n}from"./index-a0da86f0.js";const p=async e=>{var o;try{return((o=(await t.get(`/jingrow/node/schema-fields/${encodeURIComponent(e)}`,{headers:n(),withCredentials:!0})).data)==null?void 0:o.fields)||[]}catch(r){return console.error("获取节点Schema字段失败:",r),[]}},c=async()=>{try{return(await t.post("/jingrow/node/import-local",{},{headers:n(),withCredentials:!0})).data}catch(e){throw console.error("导入本地节点失败:",e),e}},l=async e=>{try{const o=await t.post(`/jingrow/node/package/${encodeURIComponent(e)}`,{},{headers:n(),withCredentials:!0,responseType:"blob"});let r=`${e}.zip`;const i=o.headers["content-disposition"];if(i){const s=i.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);if(s&&s[1]){r=s[1].replace(/['"]/g,"");try{r=decodeURIComponent(r)}catch{}}}return{blob:o.data,filename:r}}catch(o){throw console.error("打包节点失败:",o),o}},d=async e=>{try{const o=new FormData;return o.append("node_type",e.node_type),o.append("title",e.title),e.subtitle&&o.append("subtitle",e.subtitle),e.description&&o.append("description",e.description),o.append("file_url",e.file_url),e.repository_url&&o.append("repository_url",e.repository_url),e.node_image&&o.append("node_image",e.node_image),(await t.post("/jingrow/node/publish",o,{headers:{...n(),"Content-Type":"multipart/form-data"},withCredentials:!0})).data}catch(o){throw console.error("发布节点失败:",o),o}};export{d as a,p as g,c as i,l as p};
