import{C as e,E as t,Et as n,Mt as r,Qt as i,W as a,Y as o,_ as s,c,dt as l,g as u,h as d,lt as f,m as p,tn as m,v as h,w as g}from"./vendor/json-editor-vue-eojr4v24.js";import{t as _}from"./nbutton-gygn07c2.js";import{u as v}from"#entry";import{t as y}from"./ncode-block-figzf35k.js";var b={key:0,relative:``,"n-code-block":``},x={flex:`~ wrap`,"w-full":``},S=[`onClick`],C={flex:`~ gap-2`,px3:``,pb3:``,n:`sm primary`},w=t({__name:`CodeSnippets`,props:{codeSnippets:{},eventType:{}},setup(t){let w=t,T=n(w.codeSnippets[0]),E=v(),D=p(()=>T.value?.lang||`text`);return f(()=>{w.codeSnippets.includes(T.value)||(T.value=w.codeSnippets[0])}),(n,f)=>{let p=y,v=_;return t.codeSnippets.length?(a(),h(`div`,b,[d(`div`,x,[(a(!0),h(c,null,o(t.codeSnippets,(e,t)=>(a(),h(`button`,{key:t,px4:``,py2:``,border:`r base`,hover:`bg-active`,class:i(e===T.value?``:`border-b`),onClick:t=>T.value=e},[d(`div`,{class:i(e===T.value?``:`op30`),"font-mono":``},m(e.name),3)],10,S))),128)),f[1]||=d(`div`,{border:`b base`,"flex-auto":``},null,-1)]),T.value?(a(),h(c,{key:0},[g(p,{code:T.value.code,lang:D.value,lines:!1,"w-full":``,"of-auto":``,p3:``},null,8,[`code`,`lang`]),d(`div`,C,[g(v,{icon:`carbon-copy`,onClick:f[0]||=e=>r(E)(T.value.code,t.eventType||`code-snippet-${T.value.name}`)},{default:l(()=>[...f[2]||=[e(` Copy `,-1)]]),_:1}),T.value?.docs?(a(),u(v,{key:0,to:T.value.docs,target:`_blank`,icon:`carbon-catalog`},{default:l(()=>[...f[3]||=[e(` Docs `,-1)]]),_:1},8,[`to`])):s(``,!0)])],64)):s(``,!0)])):s(``,!0)}}}),T=Object.assign(w,{__name:`CodeSnippets`});export{T as t};