import{s as g}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as k}from"./react-Bj1aDYRI.js";import"./react-dom-CSu739Rf.js";import{t as $}from"./compiler-runtime-B3qBwwSJ.js";import{t as M}from"./cn-DYvqRARy.js";import{t as E}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-CTDqNQr6.js";import{t as L}from"./check-rzLRd0j9.js";import{t as A}from"./copy-3iHFdt22.js";import{n as D}from"./DeferredRequestRegistry-C8EV1PoE.js";import{t as P}from"./spinner-D-V4psAa.js";import{t as T}from"./plus-AgXtozBz.js";import{t as V}from"./badge-B92a4ePY.js";import{t as q}from"./use-toast-BwJoaaDM.js";import{n as B}from"./copy-Bxb1_Gtw.js";import{n as F}from"./ImperativeModal-fY-ZfT0b.js";import{n as I}from"./error-banner-BSxEOIn2.js";import{n as O}from"./useAsyncData-Bg5iAViP.js";import{a as R,i as S,n as G,o as w,r as _,t as H}from"./table-CH2plyy9.js";import{n as J,r as K,t as C}from"./react-resizable-panels.browser.esm-Z-MD3n3J.js";import{t as Q}from"./empty-state-JOk_hLQe.js";import{t as U}from"./request-registry-Dpk9hQrX.js";import{n as W,t as X}from"./write-secret-modal-Dtm66yVf.js";var z=$(),Y=g(k(),1),r=g(E(),1),Z=()=>{let e=(0,z.c)(27),{openModal:t,closeModal:n}=F(),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[0]=l):l=e[0];let{data:s,isPending:x,error:f,refetch:m}=O(re,l);if(x){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(P,{size:"medium",centered:!0}),e[1]=o):o=e[1],o}if(f){let o;return e[2]===f?o=e[3]:(o=(0,r.jsx)(I,{error:f}),e[2]=f,e[3]=o),o}let c;e[4]===s?c=e[5]:(c=s.filter(te).map(oe),e[4]=s,e[5]=c);let i=c;if(s.length===0){let o;return e[6]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(Q,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:(0,r.jsx)(D,{})}),e[6]=o):o=e[6],o}let a;e[7]!==n||e[8]!==t||e[9]!==i||e[10]!==m?(a=()=>t((0,r.jsx)(X,{providerNames:i,onSuccess:()=>{m(),n()},onClose:n})),e[7]=n,e[8]=t,e[9]=i,e[10]=m,e[11]=a):a=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=(0,r.jsx)(T,{className:"h-4 w-4"}),e[12]=b):b=e[12];let d;e[13]===a?d=e[14]:(d=(0,r.jsx)("div",{className:"flex justify-start h-8 border-b",children:(0,r.jsx)("button",{type:"button",className:"border-r px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:a,children:b})}),e[13]=a,e[14]=d);let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=(0,r.jsx)(R,{children:(0,r.jsxs)(w,{children:[(0,r.jsx)(S,{children:"Environment Variable"}),(0,r.jsx)(S,{children:"Source"}),(0,r.jsx)(S,{})]})}),e[15]=j):j=e[15];let p;e[16]===s?p=e[17]:(p=s.map(se),e[16]=s,e[17]=p);let h;e[18]===p?h=e[19]:(h=(0,r.jsxs)(H,{className:"overflow-auto flex-1 mb-16",children:[j,(0,r.jsx)(G,{children:p})]}),e[18]=p,e[19]=h);let u;e[20]!==d||e[21]!==h?(u=(0,r.jsx)(C,{defaultSize:50,minSize:30,maxSize:80,children:(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[d,h]})}),e[20]=d,e[21]=h,e[22]=u):u=e[22];let v;e[23]===Symbol.for("react.memo_cache_sentinel")?(v=(0,r.jsx)(K,{className:"w-1 bg-border hover:bg-primary/50 transition-colors"}),e[23]=v):v=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=(0,r.jsx)(C,{defaultSize:50,children:(0,r.jsx)("div",{})}),e[24]=y):y=e[24];let N;return e[25]===u?N=e[26]:(N=(0,r.jsxs)(J,{direction:"horizontal",className:"h-full",children:[u,v,y]}),e[25]=u,e[26]=N),N},ee=e=>{let t=(0,z.c)(9),{className:n,ariaLabel:l,onCopy:s}=e,[x,f]=Y.useState(!1),m;t[0]===s?m=t[1]:(m=()=>{s(),f(!0),setTimeout(()=>f(!1),1e3)},t[0]=s,t[1]=m);let c=m,i;t[2]===x?i=t[3]:(i=x?(0,r.jsx)(L,{className:"w-3 h-3 text-green-700 rounded"}):(0,r.jsx)(A,{className:"w-3 h-3 hover:bg-muted rounded"}),t[2]=x,t[3]=i);let a;return t[4]!==l||t[5]!==n||t[6]!==c||t[7]!==i?(a=(0,r.jsx)("button",{type:"button",className:n,onClick:c,"aria-label":l,children:i}),t[4]=l,t[5]=n,t[6]=c,t[7]=i,t[8]=a):a=t[8],a};async function re(){return W((await U.request({})).secrets)}function te(e){return e.provider!=="env"}function oe(e){return e.name}function se(e){return e.keys.map(t=>(0,r.jsxs)(w,{className:"group",children:[(0,r.jsx)(_,{children:t}),(0,r.jsx)(_,{children:e.provider!=="env"&&(0,r.jsx)(V,{variant:"outline",className:"select-none",children:e.name})}),(0,r.jsx)(_,{children:(0,r.jsx)(ee,{ariaLabel:`Copy ${t}`,onCopy:async()=>{await B(`os.environ["${t}"]`),q({title:"Copied to clipboard",description:`os.environ["${t}"] has been copied to your clipboard.`})},className:M("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${e.name}-${t}`))}export{Z as default};
