import{J as m}from"./index-UcVXCjOs.js";import{f as _,a4 as E,a5 as P,a6 as V,a2 as J,M as O}from"./app-JmgyQoR0.js";import{b as U,a as s,c as b,D as v,h as f,i as B,j as o,l as n,u as k,K as u,t as M,F as A,H}from"./vue-y3KLWBaS.js";const T={class:"_formRoot"},j={class:"_formBlock"},F=k("i",{class:"ph-paper-plane-tilt ph-bold ph-lg"},null,-1),I={key:0,class:"_formBlock"},W=U({__name:"api-console",setup(R){const r=s("{}"),p=s(""),y=s([]),d=s(!1),i=s(""),c=s(!0);_("endpoints").then(t=>{y.value=t});function h(){d.value=!0;const t=m.parse(r.value);_(p.value,t,t.i||(c.value?void 0:null)).then(e=>{d.value=!1,i.value=m.stringify(e,null,2)},e=>{d.value=!1,i.value=m.stringify(e,null,2)})}function g(){_("endpoint",{endpoint:p.value},c.value?void 0:null).then(t=>{const e={};for(const a of t.params)e[a.name]=a.type==="String"?"":a.type==="Number"?0:a.type==="Boolean"?!1:a.type==="Array"?[]:a.type==="Object"?{}:null;r.value=m.stringify(e,null,2)})}const S=b(()=>[]),C=b(()=>[]);return E({title:"API console",icon:"ph-terminal-window ph-bold ph-lg"}),(t,e)=>{const a=v("MkPageHeader"),N=v("MkEllipsis"),x=v("MkSpacer"),w=v("MkStickyContainer");return f(),B(w,null,{header:o(()=>[n(a,{actions:S.value,tabs:C.value},null,8,["actions","tabs"])]),default:o(()=>[n(x,{"content-max":700},{default:o(()=>[k("div",T,[k("div",j,[n(P,{modelValue:p.value,"onUpdate:modelValue":[e[0]||(e[0]=l=>p.value=l),e[1]||(e[1]=l=>g())],datalist:y.value,class:"_formBlock"},{label:o(()=>[u("Endpoint")]),_:1},8,["modelValue","datalist"]),n(V,{modelValue:r.value,"onUpdate:modelValue":e[2]||(e[2]=l=>r.value=l),class:"_formBlock",code:""},{label:o(()=>[u("Params (JSON or JSON5)")]),_:1},8,["modelValue"]),n(J,{modelValue:c.value,"onUpdate:modelValue":e[3]||(e[3]=l=>c.value=l),class:"_formBlock"},{default:o(()=>[u(" With credential ")]),_:1},8,["modelValue"]),n(O,{class:"_formBlock",primary:"",disabled:d.value,onClick:h},{default:o(()=>[d.value?(f(),B(N,{key:0})):(f(),M(A,{key:1},[F,u(" Send")],64))]),_:1},8,["disabled"])]),i.value?(f(),M("div",I,[n(V,{modelValue:i.value,"onUpdate:modelValue":e[4]||(e[4]=l=>i.value=l),code:"",readonly:"",tall:""},{label:o(()=>[u("Response")]),_:1},8,["modelValue"])])):H("",!0)])]),_:1})]),_:1})}}});export{W as default};
