import{s as I}from"./chunk-LvLJmgfZ.js";import{o as D,p as E}from"./useEvent-D91BmmQi.js";import{t as F}from"./react-Bj1aDYRI.js";import{Jt as J,vr as L}from"./cells-BsaJrRWi.js";import{t as V}from"./compiler-runtime-B3qBwwSJ.js";import{t as A}from"./cn-DCUzRj2J.js";import{t as q}from"./jsx-runtime-BqBOg78p.js";import{h as G}from"./download-DT8gf0PL.js";import{r as K}from"./radio-group-DlVSuZ_1.js";import{t as g}from"./tooltip-DTV9tlSr.js";import{r as Q,t as W}from"./button-BbCh-29a.js";import{at as M}from"./dist-BrR4M-k3.js";import{f as U}from"./dist-C9ZB41s2.js";import{t as X}from"./createLucideIcon-D5guW7EU.js";import{t as Y}from"./copy-BwrPA9zQ.js";import{t as Z}from"./plus-BgB18UzY.js";import{t as $}from"./use-toast-IPAtJGea.js";import{r as tt}from"./useTheme-CI2eq4XN.js";import{n as ot}from"./copy-LK56fFow.js";import{t as et}from"./esm-CqWdmSnV.js";var rt=X("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const O=E({isInstantiated:!1,error:null});function at(){return D(O,o=>o.isInstantiated)}var w=V(),R=I(F(),1),s=I(q(),1),st=[J(),M.lineWrapping],it=[U(),M.lineWrapping];const T=(0,R.memo)(o=>{let t=(0,w.c)(41),{theme:a}=tt(),e,r,i,l,c,k,C,j;t[0]===o?(e=t[1],r=t[2],i=t[3],l=t[4],c=t[5],k=t[6],C=t[7],j=t[8]):({code:r,className:e,initiallyHideCode:i,showHideCode:k,showCopyCode:C,insertNewCell:l,language:j,...c}=o,t[0]=o,t[1]=e,t[2]=r,t[3]=i,t[4]=l,t[5]=c,t[6]=k,t[7]=C,t[8]=j);let m=k===void 0?!0:k,b=C===void 0?!0:C,B=j===void 0?"python":j,[n,H]=(0,R.useState)(i),d;t[9]===e?d=t[10]:(d=A("relative hover-actions-parent w-full overflow-hidden",e),t[9]=e,t[10]=d);let p;t[11]!==n||t[12]!==m?(p=m&&n&&(0,s.jsx)(ct,{tooltip:"Show code",onClick:()=>H(!1)}),t[11]=n,t[12]=m,t[13]=p):p=t[13];let h;t[14]!==r||t[15]!==b?(h=b&&(0,s.jsx)(lt,{text:r}),t[14]=r,t[15]=b,t[16]=h):h=t[16];let f;t[17]!==r||t[18]!==l?(f=l&&(0,s.jsx)(mt,{code:r}),t[17]=r,t[18]=l,t[19]=f):f=t[19];let x;t[20]!==n||t[21]!==m?(x=m&&!n&&(0,s.jsx)(nt,{onClick:()=>H(!0)}),t[20]=n,t[21]=m,t[22]=x):x=t[22];let y;t[23]!==h||t[24]!==f||t[25]!==x?(y=(0,s.jsxs)("div",{className:"absolute top-0 right-0 my-1 mx-2 z-10 hover-action flex gap-2",children:[h,f,x]}),t[23]=h,t[24]=f,t[25]=x,t[26]=y):y=t[26];let z=n&&"opacity-20 h-8 overflow-hidden",v;t[27]===z?v=t[28]:(v=A("cm",z),t[27]=z,t[28]=v);let _=a==="dark"?"dark":"light",S=!n,P=B==="python"?st:it,u;t[29]!==r||t[30]!==c||t[31]!==v||t[32]!==_||t[33]!==S||t[34]!==P?(u=(0,s.jsx)(et,{...c,className:v,theme:_,height:"100%",editable:S,extensions:P,value:r,readOnly:!0}),t[29]=r,t[30]=c,t[31]=v,t[32]=_,t[33]=S,t[34]=P,t[35]=u):u=t[35];let N;return t[36]!==u||t[37]!==d||t[38]!==p||t[39]!==y?(N=(0,s.jsxs)("div",{className:d,children:[p,y,u]}),t[36]=u,t[37]=d,t[38]=p,t[39]=y,t[40]=N):N=t[40],N});T.displayName="ReadonlyCode";var lt=o=>{let t=(0,w.c)(5),a;t[0]===o.text?a=t[1]:(a=Q.stopPropagation(async()=>{await ot(o.text),$({title:"Copied to clipboard"})}),t[0]=o.text,t[1]=a);let e=a,r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,s.jsx)(Y,{size:14,strokeWidth:1.5}),t[2]=r):r=t[2];let i;return t[3]===e?i=t[4]:(i=(0,s.jsx)(g,{content:"Copy code",usePortal:!1,children:(0,s.jsx)(W,{onClick:e,size:"xs",className:"py-0",variant:"secondary",children:r})}),t[3]=e,t[4]=i),i},nt=o=>{let t=(0,w.c)(3),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(G,{size:14,strokeWidth:1.5}),t[0]=a):a=t[0];let e;return t[1]===o.onClick?e=t[2]:(e=(0,s.jsx)(g,{content:"Hide code",usePortal:!1,children:(0,s.jsx)(W,{onClick:o.onClick,size:"xs",className:"py-0",variant:"secondary",children:a})}),t[1]=o.onClick,t[2]=e),e};const ct=o=>{let t=(0,w.c)(7),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(L,{className:"hover-action w-5 h-5 text-muted-foreground cursor-pointer absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 opacity-80 hover:opacity-100 z-20"}),t[0]=a):a=t[0];let e;t[1]===o.tooltip?e=t[2]:(e=(0,s.jsx)(g,{usePortal:!1,content:o.tooltip,children:a}),t[1]=o.tooltip,t[2]=e);let r;return t[3]!==o.className||t[4]!==o.onClick||t[5]!==e?(r=(0,s.jsx)("div",{className:o.className,onClick:o.onClick,children:e}),t[3]=o.className,t[4]=o.onClick,t[5]=e,t[6]=r):r=t[6],r};var mt=o=>{let t=(0,w.c)(6),a=K(),e;t[0]!==a||t[1]!==o.code?(e=()=>{a(o.code)},t[0]=a,t[1]=o.code,t[2]=e):e=t[2];let r=e,i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(Z,{size:14,strokeWidth:1.5}),t[3]=i):i=t[3];let l;return t[4]===r?l=t[5]:(l=(0,s.jsx)(g,{content:"Add code to notebook",usePortal:!1,children:(0,s.jsx)(W,{onClick:r,size:"xs",className:"py-0",variant:"secondary",children:i})}),t[4]=r,t[5]=l),l};export{rt as i,O as n,at as r,T as t};
