import{_ as E}from"./nselect-nvb1idpm.js";import{u as F,c as U,a as W,_ as q}from"#entry";import{_ as z}from"./nswitch-ls95gzk4.js";import{_ as J}from"./ndropdown-jcnxkt1n.js";import{_ as O}from"./ncode-block-pcw3yh3u.js";import{_ as X}from"./ndrawer-ele5003c.js";import{A as V,d as x}from"./vendor/quicktype-core-i0qughny.js";import{p as Y,k,q as D,x as N,X as c,a4 as m,Y as n,a1 as d,$ as r,a3 as p,J as _,F as C,ah as S,u as f,ab as b,af as G}from"./vendor/json-editor-vue-ikjc812x.js";import"./vendor/shiki-hpfujfi3.js";import"./vendor/unocss-hczpatch.js";import"./client-miiq4qin.js";const H={border:"b base",flex:"~ items-center gap-2",sticky:"","left-0":"","right-0":"","top-0":"","z-1":"","bg-base":"",p3:""},K={key:0,flex:"~ items-center justify-center",absolute:"","bottom--1":"","right--2":"","h-4":"","w-4":"","rounded-full":"","bg-lime:30":"","text-8px":""},M={flex:"~ col","w-100":"","of-auto":"",py2:""},P={"text-xs":"",capitalize:"",op75:""},Q=Y({__name:"DataSchemaDrawer",setup(R){const s=F(),w=k(0),l=k("TypeScript"),v=D(()=>V.all.find(e=>e.displayName===l.value)),a=k(v.value?.optionDefinitions.filter(e=>typeof e.defaultValue=="boolean")),y=U(async()=>{if(w.value,!s.value)return"";const e=x.jsonInputForTargetLanguage(l.value);await e.addSource({name:s.value.name??"Data",samples:[s.value.input]});const t=new x.InputData;return t.addInput(e),(await x.quicktype({inputData:t,lang:l.value,rendererOptions:a.value?.reduce((u,i)=>(u[i.name]=i.defaultValue,u),{})})).lines.join(`
`)}),j=D(()=>{const e=l.value.toLocaleLowerCase();return e.startsWith("javascript")?"javascript":e.startsWith("json")?"json":e.startsWith("typescript")?"typescript":e});N(a,()=>{w.value++},{deep:!0}),N(l,()=>{a.value=v.value?.optionDefinitions.filter(e=>typeof e.defaultValue=="boolean")});const B=W();function L(){B(y.value||"")}return(e,t)=>{const h=E,u=q,i=z,I=J,T=O,$=X;return v.value?(n(),c(G,{key:0,to:"body"},[d($,{"model-value":!!f(s)?.input,"auto-close":"","max-w-screen":"","w-2xl":"","n-code-block":"",onClose:t[2]||(t[2]=o=>s.value=null)},{default:r(()=>[p("div",H,[t[3]||(t[3]=p("p",{"mr-2":""}," Schema ",-1)),d(h,{modelValue:l.value,"onUpdate:modelValue":t[0]||(t[0]=o=>l.value=o),n:"xs primary"},{default:r(()=>[(n(!0),_(C,null,S(f(V.all),o=>(n(),_("option",{key:o.displayName},b(o.displayName),1))),128))]),_:1},8,["modelValue"]),a.value?.length?(n(),c(I,{key:0,n:"sm lime"},{trigger:r(({click:o})=>[d(u,{icon:"carbon-settings","h-full":"",onClick:g=>o()},null,8,["onClick"]),a.value?(n(),_("span",K,b(a.value.length),1)):m("",!0)]),default:r(()=>[p("div",M,[(n(!0),_(C,null,S(a.value,(o,g)=>(n(),c(i,{key:o.name,modelValue:a.value[g].defaultValue,"onUpdate:modelValue":A=>a.value[g].defaultValue=A,flex:"~ gap-2",rounded:"",px2:"",py2:""},{default:r(()=>[p("span",P,b(o.description),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]))),128))])]),_:1})):m("",!0),t[4]||(t[4]=p("div",{"flex-auto":""},null,-1)),d(u,{icon:"carbon-copy","mr-6":"","h-full":"",onClick:t[1]||(t[1]=o=>L())})]),f(y)?(n(),c(T,{key:0,lang:j.value,code:f(y)},null,8,["lang","code"])):m("",!0)]),_:1},8,["model-value"])])):m("",!0)}}}),ie=Object.assign(Q,{__name:"DataSchemaDrawer"});export{ie as default};
