import{_ as g}from"./ncode-block.vue-dt6krs6h.js";import{a as C,_ as S}from"./ebt3cj6n.js";import{p as w,m as x,q as B,w as N,U as a,W as n,X as s,F as d,ae as $,a0 as i,a8 as V,a3 as u,a2 as m,a9 as v,u as T,P as h,Z as r}from"./vendor/json-editor-vue-kcahofzr.js";const D={key:0,relative:"","n-code-block":""},E={flex:"~ wrap","w-full":""},F=["onClick"],L={flex:"~ gap-2",px3:"",pb3:"",n:"sm primary"},U=w({__name:"CodeSnippets",props:{codeSnippets:{},eventType:{}},setup(f){const l=f,e=x(l.codeSnippets[0]),_=C(),b=B(()=>e.value?.lang||"text");return N(()=>{l.codeSnippets.includes(e.value)||(e.value=l.codeSnippets[0])}),(p,o)=>{const k=g,c=S;return p.codeSnippets.length?(a(),n("div",D,[s("div",E,[(a(!0),n(d,null,$(p.codeSnippets,(t,y)=>(a(),n("button",{key:y,px4:"",py2:"",border:"r base",hover:"bg-active",class:i(t===e.value?"":"border-b"),onClick:q=>e.value=t},[s("div",{class:i(t===e.value?"":"op30"),"font-mono":""},V(t.name),3)],10,F))),128)),o[1]||(o[1]=s("div",{border:"b base","flex-auto":""},null,-1))]),e.value?(a(),n(d,{key:0},[u(k,{code:e.value.code,lang:b.value,lines:!1,"w-full":"","of-auto":"",p3:""},null,8,["code","lang"]),s("div",L,[u(c,{icon:"carbon-copy",onClick:o[0]||(o[0]=t=>T(_)(e.value.code,p.eventType||`code-snippet-${e.value.name}`))},{default:m(()=>o[2]||(o[2]=[v(" Copy ")])),_:1}),e.value?.docs?(a(),h(c,{key:0,to:e.value.docs,target:"_blank",icon:"carbon-catalog"},{default:m(()=>o[3]||(o[3]=[v(" Docs ")])),_:1},8,["to"])):r("",!0)])],64)):r("",!0)])):r("",!0)}}});export{U as _};
