@marimo-team/frontend 0.24.1-dev29 → 0.24.1-dev30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,181 @@
1
+ var yt=Object.defineProperty;var _t=(t,e,s)=>e in t?yt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var G=(t,e,s)=>_t(t,typeof e!="symbol"?e+"":e,s);import{o as ce}from"./chunk-C4rtOYze.js";import{u as V}from"./useEvent-GCVIknuR.js";import{t as xt}from"./react-C60yClUi.js";import{Ct as le,E as St,Ir as kt,Zr as wt,ur as y}from"./cells-Biwqg0z6.js";import{D as K,L as u,P as _,T as L,_ as de,i as vt,k as x}from"./zod-BIDX-mZr.js";import{t as U}from"./compiler-runtime-DnimoHo0.js";import{_ as $t}from"./useEventListener-DpNnLPuE.js";import{c as jt}from"./utils-C8Yt16Y7.js";import{t as z}from"./cn-DCUzRj2J.js";import{t as Ct}from"./jsx-runtime-3wZU7vFS.js";import{a as At,c as pe,i as Nt,o as he,r as Rt,s as Tt,t as Lt}from"./popover-B96fOqfH.js";import{c as Dt,i as It,n as Pt,r as qt,s as Ft,t as Et}from"./select-CPo-KTTe.js";import{i as Ot,t as ue}from"./tooltip-C9LWGQ7Y.js";import{t as me}from"./button-W__YVea9.js";import{r as W}from"./strings-DmKKoXrM.js";import{r as Bt,t as Ut}from"./x-4y-nyVDU.js";import{t as Kt}from"./circle-plus-C5gP9LrU.js";import{t as Ht}from"./components-CGGSwziZ.js";import{n as te}from"./DeferredRequestRegistry-6TRSC3VZ.js";import{t as Wt}from"./plus-r1QITpsJ.js";import{t as Mt}from"./sparkles-DwqcWrJl.js";import{a as be,c as ge,i as Gt,n as fe,o as ye,p as Vt,r as _e,s as xe,u as zt}from"./form-B10bgcbQ.js";import{a as Qt,c as Jt,l as Yt,n as Zt,r as Xt,t as es}from"./dialog-WU4x2UpK.js";import{n as Se}from"./ImperativeModal-Dxj31V4A.js";import{t as Q}from"./links-BeU4kHTI.js";import{t as ts}from"./useIframeCapabilities-DBacdN1t.js";import{r as ss}from"./html-to-image-ChfBVn8-.js";import{o as rs}from"./focus-CeTtpVjV.js";import{n as ke}from"./useAsyncData-BcvSvTUt.js";import{a as ns,c as we,i as J,o as Y,s as os,t as as}from"./command-D5LtSvbN.js";import{c as l,o as is,t as cs}from"./form-Cj9BLARR.js";import{t as ls}from"./request-registry-bUowmAtG.js";import{a as se,c as re,d as ds,f as ps,i as ve,l as $e,n as hs,o as us,r as Z,s as F,t as je,u as Ce}from"./write-secret-modal-DBPF-L6f.js";import{a as ms,i as bs,n as gs,t as fs}from"./data-source-discovery-DCNYJylO.js";import{t as ys}from"./state-BFx9-sFK.js";var D=ce(xt(),1),o=ce(Ct(),1);function _s(t,e){if(!e)return{recommended:[],other:[...t]};let s;try{s=new RegExp(e,"i")}catch{return{recommended:[],other:[...t]}}let n=[],r=[];for(let i of t)s.test(i)?n.push(i):r.push(i);return{recommended:n,other:r}}const Ae=({value:t,onChange:e,placeholder:s,secretsOnly:n=!1,recommendedKeys:r,otherKeys:i,onCreateSecret:c,className:a,searchPlaceholder:d,formatCustomValueLabel:p=f=>`Use "${f}"`,createSecretLabel:h="Create a new secret",allowCustomValue:m,allowCreateSecret:g})=>{let[f,b]=(0,D.useState)(!1),[S,w]=(0,D.useState)(""),k=S.trim(),$=!n&&k.length>0&&k!==t&&((m==null?void 0:m(k))??!0),C=(g==null?void 0:g(k))??!0,j=t?F(t)?us(t):t:null,N=v=>{e(re(v)),b(!1),w("")},P=v=>{e(v),b(!1),w("")},q=()=>{e(""),w(""),b(!1)};return(0,o.jsxs)("div",{className:z("flex w-full min-w-48 mb-1 items-center gap-1",a),children:[(0,o.jsxs)(Lt,{modal:!0,open:f,onOpenChange:v=>{b(v),v||w("")},children:[(0,o.jsx)(Nt,{asChild:!0,children:(0,o.jsxs)("button",{type:"button",className:z("flex h-6 min-w-0 flex-1 shadow-xs-solid items-center justify-between","rounded-sm border border-input bg-background px-1.5 text-sm font-code ring-offset-background placeholder:text-muted-foreground","hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid",F(t)&&"bg-accent"),"aria-expanded":f,children:[(0,o.jsx)("span",{className:"truncate flex-1 min-w-0 text-left flex items-center gap-1.5",children:j?(0,o.jsxs)(o.Fragment,{children:[F(t)&&(0,o.jsx)(te,{className:"h-3 w-3 shrink-0 opacity-70"}),(0,o.jsx)("span",{className:"truncate",children:j})]}):(0,o.jsx)("span",{className:"text-muted-foreground",children:s})}),(0,o.jsx)(Bt,{className:"ml-1 h-4 w-4 opacity-50 shrink-0"})]})}),(0,o.jsx)(Rt,{className:"w-(--radix-popover-trigger-width) p-0",align:"start",children:(0,o.jsxs)(as,{children:[(0,o.jsx)(ns,{placeholder:d??(n?"Search secrets...":"Type a value or search secrets..."),rootClassName:"px-1 h-8",autoFocus:!0,value:S,onValueChange:w}),(0,o.jsxs)(os,{className:"max-h-60 overscroll-contain",children:[$&&(0,o.jsx)(J,{children:(0,o.jsx)(Y,{value:`use custom value ${k}`,onSelect:()=>P(k),children:p(k)})}),C&&(0,o.jsx)(J,{className:"mt-0",children:(0,o.jsxs)(Y,{value:`create new secret ${k}`,onSelect:()=>{let v=k||void 0;b(!1),w(""),c(v)},children:[(0,o.jsx)(Kt,{className:"mr-2 h-3.5 w-3.5"}),h]})}),r.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(we,{className:"mt-0"}),(0,o.jsx)(J,{heading:"Recommended",children:r.map(v=>(0,o.jsxs)(Y,{value:v,onSelect:()=>N(v),children:[(0,o.jsx)(te,{className:"mr-2 h-3 w-3 opacity-70"}),v]},v))})]}),i.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(we,{className:"mt-0"}),(0,o.jsx)(J,{heading:r.length>0?"Other":void 0,children:i.map(v=>(0,o.jsxs)(Y,{value:v,onSelect:()=>N(v),children:[(0,o.jsx)(te,{className:"mr-2 h-3 w-3 opacity-70"}),v]},v))})]})]})]})})]}),t&&(0,o.jsx)("button",{type:"button","aria-label":"Clear",className:z("flex h-6 w-6 shrink-0 items-center justify-center rounded-sm","text-muted-foreground hover:bg-muted hover:text-foreground","focus:outline-hidden focus:ring-1 focus:ring-ring"),onClick:q,children:(0,o.jsx)(Ut,{className:"h-3.5 w-3.5"})})]})};var xs=U(),Ne=(0,D.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:$t.NOOP});const Re=()=>(0,D.use)(Ne),Ss=t=>{let e=(0,xs.c)(14),{children:s}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[0]=n):n=e[0];let{data:r,isPending:i,error:c,refetch:a}=ke(Cs,n);r==null||r.secretKeys,r==null||r.providerNames;let d;e[1]===(r==null?void 0:r.secretKeys)?d=e[2]:(d=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=d);let p;e[3]===(r==null?void 0:r.providerNames)?p=e[4]:(p=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=p);let h;e[5]!==c||e[6]!==i||e[7]!==a||e[8]!==d||e[9]!==p?(h={secretKeys:d,providerNames:p,loading:i,error:c,refreshSecrets:a},e[5]=c,e[6]=i,e[7]=a,e[8]=d,e[9]=p,e[10]=h):h=e[10];let m=h,g;return e[11]!==s||e[12]!==m?(g=(0,o.jsx)(Ne,{value:m,children:s}),e[11]=s,e[12]=m,e[13]=g):g=e[13],g},ks={isMatch:t=>{if(t instanceof de){let{optionRegex:e}=l.parse(t.description||"");return!!e}return!1},Component:({schema:t,form:e,path:s})=>{let{secretKeys:n,providerNames:r,refreshSecrets:i}=Re(),{openModal:c,closeModal:a}=Se(),{label:d,description:p,placeholder:h,optionRegex:m="",inputType:g}=l.parse(t.description||""),f=g==="password",{recommended:b,other:S}=_s(n,m);return(0,o.jsx)(be,{control:e.control,name:s,render:({field:w})=>(0,o.jsxs)(ye,{children:[(0,o.jsx)(xe,{children:d}),(0,o.jsx)(_e,{children:p}),(0,o.jsx)(fe,{children:(0,o.jsx)(Ae,{value:w.value?String(w.value):"",onChange:w.onChange,placeholder:h,secretsOnly:f,recommendedKeys:b,otherKeys:S,onCreateSecret:k=>{c((0,o.jsx)(je,{providerNames:r,initialValue:k,onSuccess:$=>{i(),w.onChange(re($)),a()},onClose:a}))}})}),(0,o.jsx)(ge,{})]})})}},ws={isMatch:t=>{if(t instanceof de){let{special:e}=l.parse(t.description||"");return e==="secret_textarea"}return!1},Component:({schema:t,form:e,path:s})=>{let{secretKeys:n,providerNames:r,refreshSecrets:i}=Re(),{openModal:c,closeModal:a}=Se(),{label:d,description:p,placeholder:h}=l.parse(t.description||"");return(0,o.jsx)(be,{control:e.control,name:s,render:({field:m})=>{let g=m.value?String(m.value):"",f=Ce(g)?ps(g):g;return(0,o.jsxs)(ye,{children:[(0,o.jsxs)(xe,{className:"flex items-center gap-1",children:[d,(0,o.jsx)(ue,{content:"Enter a path to a file on disk, or create a secret to paste JSON directly.",delayDuration:300,children:(0,o.jsx)("button",{type:"button",className:"inline-flex","aria-label":"Credential input help",children:(0,o.jsx)(kt,{className:"h-3.5 w-3.5"})})})]}),(0,o.jsx)(_e,{children:p}),(0,o.jsx)(fe,{children:(0,o.jsx)(Ae,{value:f,onChange:b=>{m.onChange(!b||F(b)||Ce(b)?b:ds(b))},placeholder:h,searchPlaceholder:"Type a file path or paste JSON",formatCustomValueLabel:b=>`Use "${b}" as a file path`,createSecretLabel:"Paste JSON credentials",allowCustomValue:b=>!ve(b),allowCreateSecret:b=>!b||ve(b),recommendedKeys:[],otherKeys:n,onCreateSecret:b=>{c((0,o.jsx)(je,{providerNames:r,initialValue:b,multiline:!0,onSuccess:S=>{i(),m.onChange(re(S)),a()},onClose:a}))}})}),(0,o.jsx)(ge,{})]})}})}};function vs(t){return t.provider!=="env"}function $s(t){return t.name}function js(t){return t.keys}async function Cs(){let t=await ls.request({}),e=hs(t.secrets).filter(vs).map($s);return{secretKeys:t.secrets.flatMap(js).toSorted(),providerNames:e}}var M=U(),As=[ks,ws];const ne=t=>{let e=(0,M.c)(2),{children:s}=t,n;return e[0]===s?n=e[1]:(n=(0,o.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[0]=s,e[1]=n),n},oe=t=>{let e=(0,M.c)(9),{name:s,color:n,icon:r,onSelect:i}=t,c;e[0]===n?c=e[1]:(c={backgroundColor:n},e[0]=n,e[1]=c);let a;e[2]===s?a=e[3]:(a=(0,o.jsx)("span",{className:"text-white font-medium text-lg",children:s}),e[2]=s,e[3]=a);let d;return e[4]!==r||e[5]!==i||e[6]!==c||e[7]!==a?(d=(0,o.jsxs)("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid",style:c,onClick:i,children:[r,a]}),e[4]=r,e[5]=i,e[6]=c,e[7]=a,e[8]=d):d=e[8],d},Ns=t=>{let e=(0,M.c)(25),{onBack:s,isValid:n,libraries:r,preferredLibrary:i,onLibraryChange:c,displayNames:a,libraryLabel:d}=t,p=d===void 0?"Preferred library":d,h;e[0]===s?h=e[1]:(h=(0,o.jsx)(me,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=h);let m=!n,g;e[2]===m?g=e[3]:(g=(0,o.jsx)(me,{type:"submit",disabled:m,children:"Add"}),e[2]=m,e[3]=g);let f;e[4]!==h||e[5]!==g?(f=(0,o.jsxs)("div",{className:"flex gap-2",children:[h,g]}),e[4]=h,e[5]=g,e[6]=f):f=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=(0,o.jsx)(Ft,{children:(0,o.jsx)(Dt,{placeholder:"Select a library"})}),e[7]=b):b=e[7];let S;e[8]===p?S=e[9]:(S=(0,o.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[b,(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:p})]}),e[8]=p,e[9]=S);let w;if(e[10]!==a||e[11]!==r){let j;e[13]===a?j=e[14]:(j=N=>(0,o.jsx)(It,{value:N,children:a[N]??N},N),e[13]=a,e[14]=j),w=r.map(j),e[10]=a,e[11]=r,e[12]=w}else w=e[12];let k;e[15]===w?k=e[16]:(k=(0,o.jsx)(Pt,{children:(0,o.jsx)(qt,{children:w})}),e[15]=w,e[16]=k);let $;e[17]!==c||e[18]!==i||e[19]!==S||e[20]!==k?($=(0,o.jsx)("div",{children:(0,o.jsxs)(Et,{value:i,onValueChange:c,children:[S,k]})}),e[17]=c,e[18]=i,e[19]=S,e[20]=k,e[21]=$):$=e[21];let C;return e[22]!==$||e[23]!==f?(C=(0,o.jsxs)("div",{className:"flex gap-2 justify-between",children:[f,$]}),e[22]=$,e[23]=f,e[24]=C):C=e[24],C};function Te(){let t=(0,M.c)(4),{createNewCell:e}=St(),s=rs(),n=V(jt),r;return t[0]!==n||t[1]!==e||t[2]!==s?(r=i=>{/\bmo\./.test(i)&&ss({autoInstantiate:n,createNewCell:e,fromCellId:s}),e({code:i,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=n,t[1]=e,t[2]=s,t[3]=r):r=t[3],r}const Le=t=>{let e=(0,M.c)(30),{schema:s,libraries:n,preferredLibrary:r,displayNames:i,libraryLabel:c,generateCode:a,onSubmit:d,onBack:p}=t,h;e[0]===s?h=e[1]:(h=is(s),e[0]=s,e[1]=h);let m=h,g;e[2]===s?g=e[3]:(g=zt(s),e[2]=s,e[3]=g);let f;e[4]!==m||e[5]!==g?(f={defaultValues:m,resolver:g,reValidateMode:"onChange"},e[4]=m,e[5]=g,e[6]=f):f=e[6];let b=Vt(f),[S,w]=D.useState(r),k=Te(),$;e[7]!==a||e[8]!==k||e[9]!==d||e[10]!==S?($=ft=>{k(a(ft,S)),d()},e[7]=a,e[8]=k,e[9]=d,e[10]=S,e[11]=$):$=e[11];let C=$,j;e[12]!==b||e[13]!==C?(j=b.handleSubmit(C),e[12]=b,e[13]=C,e[14]=j):j=e[14];let N;e[15]===Symbol.for("react.memo_cache_sentinel")?(N=(0,o.jsx)(Gt,{}),e[15]=N):N=e[15];let P;e[16]!==b||e[17]!==s?(P=(0,o.jsx)(Ss,{children:(0,o.jsx)(cs,{schema:s,form:b,renderers:As,children:N})}),e[16]=b,e[17]=s,e[18]=P):P=e[18];let q;e[19]!==i||e[20]!==b.formState.isValid||e[21]!==n||e[22]!==c||e[23]!==p||e[24]!==S?(q=(0,o.jsx)(Ns,{onBack:p,isValid:b.formState.isValid,libraries:n,preferredLibrary:S,onLibraryChange:w,displayNames:i,libraryLabel:c}),e[19]=i,e[20]=b.formState.isValid,e[21]=n,e[22]=c,e[23]=p,e[24]=S,e[25]=q):q=e[25];let v;return e[26]!==j||e[27]!==P||e[28]!==q?(v=(0,o.jsxs)("form",{onSubmit:j,className:"space-y-4",children:[P,q]}),e[26]=j,e[27]=P,e[28]=q,e[29]=v):v=e[29],v};function E(){return u().optional().describe(l.of({label:"Password",inputType:"password",optionRegex:"(password|passwd|pgpassword|db.?pass(word)?)"}))}function X(t,e){let s=u();return s=e?s.nonempty():s.optional(),s=s.describe(l.of({label:t||"Token",inputType:"password",optionRegex:"(token|api.?key|access.?token|auth.?token|(^|_)pat(_|$))"})),s}function ee(){return u().optional().describe(l.of({label:"Warehouse Name",optionRegex:"(warehouse|snowflake.?warehouse)"}))}function ae(t,e){let s=u();return s=e?s.nonempty():s.optional(),s.describe(l.of({label:t||"URI",optionRegex:"(uri|url|connection.?string|database.?url|jdbc)"}))}function I(t){return u().nonempty().describe(l.of({label:t||"Host",optionRegex:"^(?!.*(kubernetes|gpg)).*(host(name)?|pghost|db.?host|database.?host|mysql.?host|postgres.?host|server.?host)"}))}function R(){return u().describe(l.of({label:"Database",optionRegex:"(database|db.?name|pgdatabase|^DB$|^DATABASE$)"}))}function Rs(){return u().describe(l.of({label:"Schema",optionRegex:"(^SCHEMA$|db.?schema|postgres.?schema|pg.?schema|_SCHEMA$)"}))}function T(){return u().nonempty().describe(l.of({label:"Username",optionRegex:"(username|pguser|db.?user|^USER$|_USER$)"}))}function O(t){let e=vt().describe(l.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(s=>s>=0&&s<=65535,{message:"Port must be between 0 and 65535"});return t===void 0?e:e.default(t)}function De(){return L().default(!1).describe(l.of({label:"Read Only"}))}const Ie=_({type:x("postgres"),host:I(),port:O(5432).optional(),database:R(),username:T(),password:E(),ssl:L().default(!1).describe(l.of({label:"Use SSL"}))}).describe(l.of({direction:"two-columns"})),Pe=_({type:x("mysql"),host:I(),port:O(3306),database:R(),username:T(),password:E(),ssl:L().default(!1).describe(l.of({label:"Use SSL"}))}).describe(l.of({direction:"two-columns"})),qe=_({type:x("sqlite"),database:R().describe(l.of({label:"Database Path"}))}).describe(l.of({direction:"two-columns"})),Fe=_({type:x("duckdb"),database:R().describe(l.of({label:"Database Path"})),read_only:De()}).describe(l.of({direction:"two-columns"})),Ee=_({type:x("motherduck"),database:R().default("my_db").describe(l.of({label:"Database Name"})),token:X()}).describe(l.of({direction:"two-columns"})),Oe=_({type:x("snowflake"),account:u().nonempty().describe(l.of({label:"Account",optionRegex:"(snowflake.?account|^SNOWFLAKE_ACCOUNT$|account.?id)"})),warehouse:u().optional().describe(l.of({label:"Warehouse",optionRegex:"(snowflake.?warehouse|warehouse)"})),database:R(),schema:u().optional().describe(l.of({label:"Schema",optionRegex:"(snowflake.?schema|^SCHEMA$|_SCHEMA$)"})),role:u().optional().describe(l.of({label:"Role"})),authType:K("type",[_({type:x("Password"),username:T(),password:E(),enable_mfa:L().default(!1).describe(l.of({label:"Enable MFA (Duo Push)"}))}),_({type:x("SSO (Browser)"),username:T()}),_({type:x("Key Pair"),username:T(),private_key_path:u().nonempty().describe(l.of({label:"Private Key Path",placeholder:"/path/to/rsa_key.p8"})),private_key_passphrase:u().optional().describe(l.of({label:"Private Key Passphrase",inputType:"password",optionRegex:"(passphrase|private.?key.?passphrase|key.?passphrase)"}))}),_({type:x("OAuth / PAT"),token:X("Token",!0)})]).default({type:"Password",username:"username",enable_mfa:!1}).describe(l.of({special:"tabs"}))}).describe(l.of({direction:"two-columns"})),Be=_({type:x("bigquery"),project:u().nonempty().describe(l.of({label:"Project ID",optionRegex:"(bigquery.?project|gcp.?project|google.?cloud.?project|project.?id)"})),dataset:u().nonempty().describe(l.of({label:"Dataset",optionRegex:"(bigquery.?dataset|dataset)"})),credentials_json:u().describe(l.of({label:"Credentials JSON",special:"secret_textarea"}))}).describe(l.of({direction:"two-columns"})),Ue=_({type:x("clickhouse_connect"),host:I(),port:O(8123).optional(),username:T(),password:E(),secure:L().default(!1).describe(l.of({label:"Use HTTPs"})),proxy_path:u().optional().describe(l.of({label:"Proxy Path",placeholder:"/clickhouse"}))}).describe(l.of({direction:"two-columns"})),Ke=_({type:x("timeplus"),host:I().default("localhost"),port:O(8123).optional(),username:T().default("default"),password:E().default("")}).describe(l.of({direction:"two-columns"})),He=_({type:x("chdb"),database:R().describe(l.of({label:"Database Path"})),read_only:De()}).describe(l.of({direction:"two-columns"})),We=_({type:x("trino"),host:I(),port:O(8080),database:R(),schema:Rs().optional(),username:T(),password:E(),async_support:L().default(!1).describe(l.of({label:"Async Support"}))}).describe(l.of({direction:"two-columns"})),Me=_({type:x("iceberg"),name:u().describe(l.of({label:"Catalog Name"})),catalog:K("type",[_({type:x("REST"),warehouse:ee(),uri:u().optional().describe(l.of({label:"URI",placeholder:"https://",optionRegex:"(uri|url|connection.?string|database.?url|jdbc)"})),token:X()}),_({type:x("SQL"),warehouse:ee(),uri:u().optional().describe(l.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:"(uri|url|connection.?string|database.?url|jdbc)"}))}),_({type:x("Hive"),warehouse:ee(),uri:ae()}),_({type:x("Glue"),warehouse:ee(),uri:ae()}),_({type:x("DynamoDB"),"dynamodb.profile-name":u().optional().describe(l.of({label:"Profile Name"})),"dynamodb.region":u().optional().describe(l.of({label:"Region"})),"dynamodb.access-key-id":u().optional().describe(l.of({label:"Access Key ID",inputType:"password",optionRegex:"(access.?key.?id|aws.?access.?key)"})),"dynamodb.secret-access-key":u().optional().describe(l.of({label:"Secret Access Key",inputType:"password",optionRegex:"(secret.?access.?key|aws.?secret)"})),"dynamodb.session-token":u().optional().describe(l.of({label:"Session Token",inputType:"password",optionRegex:"(session.?token|aws.?session)"}))})]).default({type:"REST",token:void 0}).describe(l.of({special:"tabs"}))}),Ge=_({type:x("datafusion"),sessionContext:L().optional().describe(l.of({label:"Use Session Context"}))}),Ve=_({type:x("pyspark"),host:I().optional(),port:O().optional()}),ze=_({type:x("redshift"),host:I(),port:O(5439),connectionType:K("type",[_({type:x("IAM credentials"),region:u().describe(l.of({label:"Region"})),aws_access_key_id:u().nonempty().describe(l.of({label:"AWS Access Key ID",inputType:"password",optionRegex:"(access.?key.?id|aws.?access.?key)"})),aws_secret_access_key:u().nonempty().describe(l.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:"(secret.?access.?key|aws.?secret)"})),aws_session_token:u().optional().describe(l.of({label:"AWS Session Token",inputType:"password",optionRegex:"(session.?token|aws.?session)"}))}),_({type:x("DB credentials"),user:T(),password:E()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:R()}).describe(l.of({direction:"two-columns"})),Qe=_({type:x("databricks"),access_token:X("Access Token",!0),server_hostname:I("Server Hostname"),http_path:ae("HTTP Path",!0),catalog:u().optional().describe(l.of({label:"Catalog"})),schema:u().optional().describe(l.of({label:"Schema"}))}).describe(l.of({direction:"two-columns"})),Je=_({type:x("supabase"),host:I(),port:O(5432).optional(),database:R(),username:T(),password:E(),disable_client_pooling:L().default(!1).describe(l.of({label:"Disable Client-Side Pooling"}))}).describe(l.of({direction:"two-columns"})),Ts=K("type",[Ie,Pe,qe,Fe,Ee,Oe,Be,Ue,Ke,He,We,Me,Ge,Ve,ze,Qe,Je]),Ye={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift",databricks:"Databricks"};var A=class{constructor(t,e,s){this.connection=t,this.orm=e,this.secrets=s}get imports(){let t=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":t.add("import sqlalchemy");break;case"sqlmodel":t.add("import sqlmodel");break;case"duckdb":t.add("import duckdb");break;case"ibis":t.add("import ibis");break}return t}},Ls=t=>`_${t}`,Ds=class{constructor(){G(this,"secrets",{})}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(t,e,s){if(t=Ls(t),F(e)){let n=$e(e),r=s?`os.environ.get("${n}", "${s}")`:`os.environ.get("${n}")`;return this.secrets[t]=r,t}if(s!=null){let n=`os.environ.get("${e}", "${s}")`;return this.secrets[t]=n,t}return typeof e=="number"||typeof e=="number"?`${e}`:typeof e=="boolean"?H(e):e?`"${e}"`:""}printInFString(t,e,s){if(e===void 0)return"";if(typeof e=="number")return`${e}`;if(typeof e=="boolean")return H(e);let n=this.print(t,e,s);return n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):`{${n}}`}printPassword(t,e,s,n){let r=s?this.printInFString.bind(this):this.print.bind(this);return F(t)?r(n||"password",t):r(n||"password",e,t)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([t,e])=>`${t} = ${e}`).join(`
2
+ `)}},Is=class extends A{generateImports(){return[]}generateConnectionCode(){let t=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",e=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0);return y(`
3
+ DATABASE_URL = f"postgresql://${this.secrets.printInFString("username",this.connection.username)}:${e}@${this.secrets.printInFString("host",this.connection.host)}:${this.secrets.printInFString("port",this.connection.port)}/${this.secrets.printInFString("database",this.connection.database)}"
4
+ engine = ${this.orm}.create_engine(DATABASE_URL${t})
5
+ `)}},Ps=class extends A{generateImports(){return[]}generateConnectionCode(){let t=this.connection.ssl?", connect_args={'ssl': {'ssl-mode': 'preferred'}}":"",e=this.secrets.printPassword(this.connection.password,"MYSQL_PASSWORD",!0),s=this.secrets.printInFString("database",this.connection.database);return y(`
6
+ DATABASE_URL = f"mysql+pymysql://${this.secrets.printInFString("username",this.connection.username)}:${e}@${this.secrets.printInFString("host",this.connection.host)}:${this.secrets.printInFString("port",this.connection.port)}/${s}"
7
+ engine = ${this.orm}.create_engine(DATABASE_URL${t})
8
+ `)}},qs=class extends A{generateImports(){return[]}generateConnectionCode(){let t=this.connection.database?this.secrets.printInFString("database",this.connection.database):"";return y(`
9
+ ${t.startsWith("{")&&t.endsWith("}")?`DATABASE_URL = f"sqlite:///${t}"`:`DATABASE_URL = "sqlite:///${t}"`}
10
+ engine = ${this.orm}.create_engine(DATABASE_URL)
11
+ `)}},Fs=class extends A{generateImports(){return["from snowflake.sqlalchemy import URL"]}generateConnectionCode(){let{authType:t,account:e,database:s,warehouse:n,schema:r,role:i}=this.connection,c={account:this.secrets.print("account",e),database:this.secrets.print("database",s),warehouse:n?this.secrets.print("warehouse",n):void 0,schema:r?this.secrets.print("schema",r):void 0,role:i?this.secrets.print("role",i):void 0};switch(t.type){case"Password":{let a=this.secrets.printPassword(t.password,"SNOWFLAKE_PASSWORD",!1),d={...c,user:this.secrets.print("user",t.username),password:a};return t.enable_mfa?y(`
12
+ engine = ${this.orm}.create_engine(
13
+ URL(
14
+ ${B(d,p=>` ${p}`)},
15
+ ),
16
+ connect_args={"authenticator": "username_password_mfa"},
17
+ )
18
+ `):y(`
19
+ engine = ${this.orm}.create_engine(
20
+ URL(
21
+ ${B(d,p=>` ${p}`)},
22
+ )
23
+ )
24
+ `)}case"SSO (Browser)":{let a={...c,user:this.secrets.print("user",t.username),authenticator:'"externalbrowser"'};return y(`
25
+ engine = ${this.orm}.create_engine(
26
+ URL(
27
+ ${B(a,d=>` ${d}`)},
28
+ )
29
+ )
30
+ `)}case"Key Pair":{let a={...c,user:this.secrets.print("user",t.username)},d=this.secrets.print("private_key_path",t.private_key_path),p=t.private_key_passphrase?this.secrets.printPassword(t.private_key_passphrase,"SNOWFLAKE_PRIVATE_KEY_PASSPHRASE",!1):void 0,h=[' "authenticator": "SNOWFLAKE_JWT"',` "private_key_file": ${d}`];return p&&h.push(` "private_key_file_pwd": ${p}`),y(`
31
+ engine = ${this.orm}.create_engine(
32
+ URL(
33
+ ${B(a,m=>` ${m}`)},
34
+ ),
35
+ connect_args={
36
+ ${h.join(`,
37
+ `)},
38
+ },
39
+ )
40
+ `)}case"OAuth / PAT":{let a=this.secrets.printPassword(t.token,"SNOWFLAKE_TOKEN",!1),d={...c,authenticator:'"oauth"',token:a};return y(`
41
+ engine = ${this.orm}.create_engine(
42
+ URL(
43
+ ${B(d,p=>` ${p}`)},
44
+ )
45
+ )
46
+ `)}default:W(t)}}},Es=class extends A{get credential(){return se(this.connection.credentials_json,t=>this.secrets.print("credentials_json",t))}generateImports(){return this.credential.kind==="path"?[]:["import json"]}generateConnectionCode(){let t=this.secrets.printInFString("project",this.connection.project),e=this.secrets.printInFString("dataset",this.connection.dataset),s=this.credential;return s.kind==="path"?y(`
47
+ engine = ${this.orm}.create_engine(f"bigquery://${t}/${e}", credentials_path="${Z(s.path)}")
48
+ `):y(`
49
+ credentials = ${s.expr}
50
+ engine = ${this.orm}.create_engine(f"bigquery://${t}/${e}", credentials_info=credentials)
51
+ `)}},Os=class extends A{generateImports(){return[]}generateConnectionCode(){return y(`
52
+ DATABASE_URL = "${this.secrets.printInFString("database",this.connection.database||":memory:")}"
53
+ engine = ${this.orm}.connect(DATABASE_URL, read_only=${H(this.connection.read_only)})
54
+ `)}},Bs=class extends A{generateImports(){return[]}generateConnectionCode(){let t=this.secrets.printInFString("database",this.connection.database);return this.connection.token?y(`
55
+ conn = duckdb.connect("md:${t}", config={"motherduck_token": ${this.secrets.printPassword(this.connection.token,"MOTHERDUCK_TOKEN",!1)}})
56
+ `):y(`
57
+ conn = duckdb.connect("md:${t}")
58
+ `)}},Us=class extends A{generateImports(){return["import clickhouse_connect"]}generateConnectionCode(){let t=this.secrets.printPassword(this.connection.password,"CLICKHOUSE_PASSWORD",!1),e={host:this.secrets.print("host",this.connection.host),user:this.secrets.print("user",this.connection.username),secure:this.secrets.print("secure",this.connection.secure),port:this.connection.port?this.secrets.print("port",this.connection.port):void 0,password:this.connection.password?t:void 0,proxy_path:this.connection.proxy_path?this.secrets.print("proxy_path",this.connection.proxy_path):void 0};return y(`
59
+ engine = ${this.orm}.get_client(
60
+ ${B(e,s=>` ${s}`)},
61
+ )
62
+ `)}},Ks=class extends A{generateImports(){return[]}generateConnectionCode(){let t=this.secrets.printPassword(this.connection.password,"TIMEPLUS_PASSWORD",!0);return y(`
63
+ DATABASE_URL = f"timeplus://${this.secrets.printInFString("username",this.connection.username)}:${t}@${this.secrets.printInFString("host",this.connection.host)}:${this.secrets.printInFString("port",this.connection.port)}"
64
+ engine = ${this.orm}.create_engine(DATABASE_URL)
65
+ `)}},Hs=class extends A{generateImports(){return["import chdb"]}generateConnectionCode(){let t=this.secrets.print("database",this.connection.database)||'""';return y(`
66
+ engine = ${this.orm}.connect(${t}, read_only=${H(this.connection.read_only)})
67
+ `)}},Ws=class extends A{generateImports(){return this.connection.async_support?["import aiotrino"]:["import trino.sqlalchemy"]}generateConnectionCode(){let t=this.connection.async_support?"aiotrino":"trino",e=this.connection.schema?`/${this.connection.schema}`:"",s=this.secrets.printInFString("username",this.connection.username),n=this.secrets.printInFString("host",this.connection.host),r=this.secrets.printInFString("port",this.connection.port),i=this.secrets.printInFString("database",this.connection.database),c=this.secrets.printPassword(this.connection.password,"TRINO_PASSWORD",!0);return y(`
68
+ engine = ${this.orm}.create_engine(f"${t}://${s}:${c}@${n}:${r}/${i}${e}")
69
+ `)}},Ms=class extends A{getCatalogOptions(){return Object.fromEntries(Object.entries(this.connection.catalog).filter(([t,e])=>e!=null&&e!==""&&t!=="type"))}generateImports(){if(Object.keys(this.getCatalogOptions()).length===0)return["from pyiceberg.catalog import load_catalog"];switch(this.connection.catalog.type){case"REST":return["from pyiceberg.catalog.rest import RestCatalog"];case"SQL":return["from pyiceberg.catalog.sql import SqlCatalog"];case"Hive":return["from pyiceberg.catalog.hive import HiveCatalog"];case"Glue":return["from pyiceberg.catalog.glue import GlueCatalog"];case"DynamoDB":return["from pyiceberg.catalog.dynamodb import DynamoDBCatalog"];default:W(this.connection.catalog)}}generateConnectionCode(){let t=`"${this.connection.name}"`,e=this.getCatalogOptions();if(Object.keys(e).length===0)return`catalog = load_catalog(${t})`;for(let[n,r]of Object.entries(e))F(r)?e[n]=this.secrets.print(n,r):typeof r=="string"&&(e[n]=`"${r}"`);let s=Xs(e,n=>` ${n}`);switch(this.connection.catalog.type){case"REST":return y(`
70
+ catalog = RestCatalog(
71
+ ${t},
72
+ **{
73
+ ${s}
74
+ },
75
+ )
76
+ `);case"SQL":return y(`
77
+ catalog = SqlCatalog(
78
+ ${t},
79
+ **{
80
+ ${s}
81
+ },
82
+ )
83
+ `);case"Hive":return y(`
84
+ catalog = HiveCatalog(
85
+ ${t},
86
+ **{
87
+ ${s}
88
+ },
89
+ )
90
+ `);case"Glue":return y(`
91
+ catalog = GlueCatalog(
92
+ ${t},
93
+ **{
94
+ ${s}
95
+ },
96
+ )
97
+ `);case"DynamoDB":return y(`
98
+ catalog = DynamoDBCatalog(
99
+ ${t},
100
+ **{
101
+ ${s}
102
+ },
103
+ )
104
+ `);default:W(this.connection.catalog)}}},Gs=class extends A{generateImports(){return["from datafusion import SessionContext"]}generateConnectionCode(){return this.connection.sessionContext?y(`
105
+ ctx = SessionContext()
106
+ # Sample table
107
+ _ = ctx.from_pydict({"a": [1, 2, 3]}, "my_table")
108
+
109
+ con = ibis.datafusion.connect(ctx)
110
+ `):y(`
111
+ con = ibis.datafusion.connect()
112
+ `)}},Vs=class extends A{generateImports(){return["from pyspark.sql import SparkSession"]}generateConnectionCode(){return this.connection.host||this.connection.port?y(`
113
+ session = SparkSession.builder.remote(f"sc://${this.secrets.printInFString("host",this.connection.host)}:${this.secrets.printInFString("port",this.connection.port)}").getOrCreate()
114
+ con = ibis.pyspark.connect(session)
115
+ `):y(`
116
+ con = ibis.pyspark.connect()
117
+ `)}},zs=class extends A{generateImports(){return["import redshift_connector"]}generateConnectionCode(){let t=this.secrets.print("host",this.connection.host),e=this.secrets.print("port",this.connection.port),s=this.secrets.print("database",this.connection.database);if(this.connection.connectionType.type==="IAM credentials"){let i=this.secrets.print("aws_access_key_id",this.connection.connectionType.aws_access_key_id),c=this.secrets.print("aws_secret_access_key",this.connection.connectionType.aws_secret_access_key),a=this.connection.connectionType.aws_session_token?this.secrets.print("aws_session_token",this.connection.connectionType.aws_session_token):void 0;return y(`
118
+ con = redshift_connector.connect(
119
+ ${B({iam:!0,host:t,port:e,region:`"${this.connection.connectionType.region}"`,database:s,access_key_id:i,secret_access_key:c,...a&&{session_token:a}},d=>` ${d}`)},
120
+ )
121
+ `)}let n=this.connection.connectionType.user?this.secrets.print("user",this.connection.connectionType.user):void 0,r=this.connection.connectionType.password?this.secrets.printPassword(this.connection.connectionType.password,"REDSHIFT_PASSWORD",!1):void 0;return y(`
122
+ con = redshift_connector.connect(
123
+ ${B({host:t,port:e,database:s,...n&&{user:n},...r&&{password:r}},i=>` ${i}`)},
124
+ )
125
+ `)}},Qs=class extends A{generateImports(){return[]}generateConnectionCode(){let t=this.orm!=="ibis",e=this.secrets.printPassword(this.connection.access_token,"DATABRICKS_ACCESS_TOKEN",t,"access_token"),s=this.secrets.printPassword(this.connection.server_hostname,"DATABRICKS_SERVER_HOSTNAME",t,"server_hostname"),n=this.secrets.printPassword(this.connection.http_path,"DATABRICKS_HTTP_PATH",t,"http_path"),r=this.connection.catalog?this.secrets.printInFString("catalog",this.connection.catalog):void 0,i=this.connection.schema?this.secrets.printInFString("schema",this.connection.schema):void 0,c=`databricks://token:${e}@${s}?http_path=${n}`;return r&&(c+=`&catalog=${r}`),i&&(c+=`&schema=${i}`),this.orm==="ibis"?y(`
126
+ engine = ibis.databricks.connect(
127
+ server_hostname=${s},
128
+ http_path=${n},${r?`
129
+ catalog=${r},`:""}${i?`
130
+ schema=${i},`:""}
131
+ access_token=${e}
132
+ )
133
+ `):y(`
134
+ DATABASE_URL = f"${c}"
135
+ engine = ${this.orm}.create_engine(DATABASE_URL)
136
+ `)}},Js=class extends A{generateImports(){return this.connection.disable_client_pooling?["from sqlalchemy.pool import NullPool"]:[]}generateConnectionCode(){let t=this.secrets.printPassword(this.connection.password,"SUPABASE_PASSWORD",!0),e=this.secrets.printInFString("username",this.connection.username),s=this.secrets.printInFString("host",this.connection.host),n=this.secrets.printInFString("port",this.connection.port),r=this.secrets.printInFString("database",this.connection.database),i=this.connection.disable_client_pooling?", poolclass=NullPool":"";return y(`
137
+ DATABASE_URL = f"postgresql+psycopg2://${e}:${t}@${s}:${n}/${r}?sslmode=require"
138
+ engine = ${this.orm}.create_engine(DATABASE_URL${i})
139
+ `)}},Ys=class{constructor(){G(this,"secrets",new Ds)}createGenerator(t,e){switch(t.type){case"postgres":return new Is(t,e,this.secrets);case"mysql":return new Ps(t,e,this.secrets);case"sqlite":return new qs(t,e,this.secrets);case"snowflake":return new Fs(t,e,this.secrets);case"bigquery":return new Es(t,e,this.secrets);case"duckdb":return new Os(t,e,this.secrets);case"motherduck":return new Bs(t,e,this.secrets);case"clickhouse_connect":return new Us(t,e,this.secrets);case"timeplus":return new Ks(t,e,this.secrets);case"chdb":return new Hs(t,e,this.secrets);case"trino":return new Ws(t,e,this.secrets);case"iceberg":return new Ms(t,e,this.secrets);case"datafusion":return new Gs(t,e,this.secrets);case"pyspark":return new Vs(t,e,this.secrets);case"redshift":return new zs(t,e,this.secrets);case"databricks":return new Qs(t,e,this.secrets);case"supabase":return new Js(t,e,this.secrets);default:W(t)}}};function Zs(t,e){if(!(e in Ye))throw Error(`Unsupported library: ${e}`);Ts.parse(t);let s=new Ys,n=s.createGenerator(t,e),r=n.generateConnectionCode(),i=s.secrets,c=[...new Set([...i.imports,...n.imports])].toSorted();c.push("");let a=i.formatSecrets();return a&&c.push(a),c.push(r.trim()),c.join(`
140
+ `)}function H(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function B(t,e){return Object.entries(t).filter(([,s])=>s!=null&&s!=="").map(([s,n])=>e(typeof n=="boolean"?`${s}=${H(n)}`:`${s}=${n}`)).join(`,
141
+ `)}function Xs(t,e){return Object.entries(t).filter(([,s])=>s!=null&&s!=="").map(([s,n])=>{let r=`"${s}"`;return e(typeof n=="boolean"?`${r}: ${H(n)}`:`${r}: ${n}`)}).join(`,
142
+ `)}var Ze=U(),Xe=[{name:"PostgreSQL",schema:Ie,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:Pe,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:qe,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:Fe,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:Ee,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:Oe,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:Ue,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:Ke,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:Be,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:He,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:We,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:Ge,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:Ve,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:ze,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}},{name:"Databricks",schema:Qe,color:"#c41e0c",logo:"databricks",connectionLibraries:{libraries:["sqlalchemy","sqlmodel","ibis"],preferred:"sqlalchemy"}},{name:"Supabase",schema:Je,color:"#238F5F",logo:"supabase",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}}],et=[{name:"Iceberg",schema:Me,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],er=[...Xe,...et],tr=t=>{let e=(0,Ze.c)(12),{onSelect:s}=t,n;e[0]===s?n=e[1]:(n=Xe.map(p=>{let{name:h,schema:m,color:g,logo:f}=p;return(0,o.jsx)(oe,{name:h,color:g,icon:(0,o.jsx)(le,{name:f,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),onSelect:()=>s(m)},h)}),e[0]=s,e[1]=n);let r;e[2]===n?r=e[3]:(r=(0,o.jsx)(ne,{children:n}),e[2]=n,e[3]=r);let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsxs)("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4 my-2",children:["Data Catalogs",(0,o.jsx)("hr",{className:"flex-1"})]}),e[4]=i):i=e[4];let c;e[5]===s?c=e[6]:(c=et.map(p=>{let{name:h,schema:m,color:g,logo:f}=p;return(0,o.jsx)(oe,{name:h,color:g,icon:(0,o.jsx)(le,{name:f,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),onSelect:()=>s(m)},h)}),e[5]=s,e[6]=c);let a;e[7]===c?a=e[8]:(a=(0,o.jsx)(ne,{children:c}),e[7]=c,e[8]=a);let d;return e[9]!==r||e[10]!==a?(d=(0,o.jsxs)(o.Fragment,{children:[r,i,a]}),e[9]=r,e[10]=a,e[11]=d):d=e[11],d};const sr=t=>{let e=(0,Ze.c)(13),{onSubmit:s,header:n}=t,[r,i]=(0,D.useState)(null);if(!r){let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=(0,o.jsx)("div",{children:(0,o.jsx)(tr,{onSelect:i})}),e[0]=g):g=e[0];let f;return e[1]===n?f=e[2]:(f=(0,o.jsxs)(o.Fragment,{children:[n,g]}),e[1]=n,e[2]=f),f}let c;e[3]===r?c=e[4]:(c=er.find(g=>g.schema===r),e[3]=r,e[4]=c);let a=c==null?void 0:c.connectionLibraries,d;e[5]===(a==null?void 0:a.libraries)?d=e[6]:(d=(a==null?void 0:a.libraries)??[],e[5]=a==null?void 0:a.libraries,e[6]=d);let p=(a==null?void 0:a.preferred)??"sqlalchemy",h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=()=>i(null),e[7]=h):h=e[7];let m;return e[8]!==s||e[9]!==r||e[10]!==d||e[11]!==p?(m=(0,o.jsx)(Le,{schema:r,libraries:d,preferredLibrary:p,displayNames:Ye,libraryLabel:"Preferred connection library",generateCode:rr,onSubmit:s,onBack:h}),e[8]=s,e[9]=r,e[10]=d,e[11]=p,e[12]=m):m=e[12],m};function rr(t,e){return Zs(t,e)}var tt=U();function nr(){let t=(0,tt.c)(2),e=V(fs),s;return t[0]===e?s=t[1]:(s=[e],t[0]=e,t[1]=s),ke(gs,s)}function st(t){let e=(0,tt.c)(6),{data:s}=nr(),n=V(wt),r=V(ys),i;e:{if(!s){let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[0]=a):a=e[0],i=a;break e}let c;if(e[1]!==n||e[2]!==s||e[3]!==t||e[4]!==r){let a={dialects:[...n.values()].map(ir),storageProtocols:r.map(ar),storageBackendTypes:r.map(or)};c=s.filter(d=>ms(d,t)&&!bs(d,a)),e[1]=n,e[2]=s,e[3]=t,e[4]=r,e[5]=c}else c=e[5];i=c}return i}function or(t){return t.backendType.toLowerCase()}function ar(t){return t.protocol.toLowerCase()}function ir(t){return t.dialect.toLowerCase()}var ie=U();const cr=t=>{let e=(0,ie.c)(13),{className:s,sources:n,onAdd:r}=t;if(n.length===0)return null;let i;e[0]===s?i=e[1]:(i=z("rounded-full bg-[linear-gradient(135deg,var(--blue-2),var(--purple-3))] px-3 py-2",s),e[0]=s,e[1]=i);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=(0,o.jsxs)("div",{className:"mr-1 flex items-center gap-1.5",children:[(0,o.jsx)(Mt,{className:"h-3.5 w-3.5 text-(--blue-9)"}),(0,o.jsx)("h3",{id:"quick-add-data-sources-title",className:"text-sm",children:"Quick add"})]}),e[2]=c):c=e[2];let a;if(e[3]!==r||e[4]!==n){let h;e[6]===r?h=e[7]:(h=m=>(0,o.jsx)(ue,{side:"bottom",content:(0,o.jsx)(lr,{source:m}),children:(0,o.jsxs)("button",{type:"button","aria-label":`Add ${m.displayName} connection`,className:"inline-flex items-center gap-1 rounded-full border border-border/60 bg-background px-2.5 py-1 text-xs font-medium text-foreground/90 transition-colors hover:border-(--blue-7) focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",onClick:()=>r(m),children:[(0,o.jsx)(Wt,{className:"h-3 w-3 text-muted-foreground"}),m.displayName]})},m.id),e[6]=r,e[7]=h),a=n.map(h),e[3]=r,e[4]=n,e[5]=a}else a=e[5];let d;e[8]===a?d=e[9]:(d=(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,(0,o.jsx)(Ot,{delayDuration:200,children:a})]}),e[8]=a,e[9]=d);let p;return e[10]!==i||e[11]!==d?(p=(0,o.jsx)("section",{"aria-labelledby":"quick-add-data-sources-title",className:i,children:d}),e[10]=i,e[11]=d,e[12]=p):p=e[12],p};var lr=t=>{let e=(0,ie.c)(17),{source:s}=t,n;e[0]===s.displayName?n=e[1]:(n=(0,o.jsx)("div",{className:"font-medium",children:s.displayName}),e[0]=s.displayName,e[1]=n);let r;e[2]===s.origins?r=e[3]:(r=s.origins.map(pr).join(" and "),e[2]=s.origins,e[3]=r);let i;e[4]===r?i=e[5]:(i=(0,o.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Detected from"," ",r]}),e[4]=r,e[5]=i);let c;e[6]!==n||e[7]!==i?(c=(0,o.jsxs)("div",{children:[n,i]}),e[6]=n,e[7]=i,e[8]=c):c=e[8];let a;e[9]===s.configuration?a=e[10]:(a=s.configuration.map(hr),e[9]=s.configuration,e[10]=a);let d;e[11]===a?d=e[12]:(d=(0,o.jsx)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs",children:a}),e[11]=a,e[12]=d);let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=(0,o.jsx)("div",{className:"text-xs text-muted-foreground",children:"Click to add a configured cell."}),e[13]=p):p=e[13];let h;return e[14]!==c||e[15]!==d?(h=(0,o.jsxs)("div",{className:"min-w-64 space-y-2 py-1",children:[c,d,p]}),e[14]=c,e[15]=d,e[16]=h):h=e[16],h};const dr=t=>{let e=(0,ie.c)(7),{onSubmit:s,className:n,group:r}=t,i=Te(),c=st(r),a;e[0]!==i||e[1]!==s?(a=p=>{i(p.code),s==null||s()},e[0]=i,e[1]=s,e[2]=a):a=e[2];let d;return e[3]!==n||e[4]!==c||e[5]!==a?(d=(0,o.jsx)(cr,{className:n,sources:c,onAdd:a}),e[3]=n,e[4]=c,e[5]=a,e[6]=d):d=e[6],d};function pr(t){return t.label}function hr(t){return(0,o.jsxs)("div",{className:"contents",children:[(0,o.jsx)("dt",{className:"text-muted-foreground",children:t.field}),(0,o.jsx)("dd",{children:(0,o.jsx)("code",{children:t.value.kind==="environment-variable"?`os.environ["${t.value.name}"]`:t.value.value})})]},t.value.kind==="environment-variable"?t.value.name:`${t.field}:${t.value.value}`)}var rt=()=>K("type",[_({type:x("Access keys"),access_key_id:u().optional().describe(l.of({label:"Access Key ID",description:"Leave empty to use the default credential chain",inputType:"password",optionRegex:"(access.?key.?id|object.?storage.?key|aws.?access.?key)"})),secret_access_key:u().optional().describe(l.of({label:"Secret Access Key",inputType:"password",optionRegex:"(secret.?access.?key|object.?storage.?secret|aws.?secret)"}))}),_({type:x("Container credentials"),container_credentials_full_uri:u().nonempty().describe(l.of({label:"Credentials URI",description:"Endpoint that vends credentials to the container",placeholder:"http://169.254.170.23/v1/credentials",optionRegex:"container.?credentials"})),container_authorization_token_file:u().nonempty().describe(l.of({label:"Authorization Token File",description:"File holding the token sent to the credentials URI",placeholder:"/var/run/secrets/token",optionRegex:"(container.?authorization.?token.?file|container.?auth.?token)"}))})]).default({type:"Access keys"}).describe(l.of({label:"Credentials",special:"tabs"}));const nt=_({type:x("s3"),bucket:u().nonempty().describe(l.of({label:"Bucket",placeholder:"my-bucket",optionRegex:"(bucket|s3.?bucket)"})),region:u().optional().describe(l.of({label:"Region",placeholder:"us-east-1",optionRegex:"(region|aws.?region)"})),endpoint_url:u().optional().describe(l.of({label:"Endpoint URL",description:"Ignored if the AWS_ENDPOINT_URL_S3 environment variable is set",placeholder:"https://s3.amazonaws.com",optionRegex:"(endpoint|s3.?url|s3.?endpoint)"})),allow_http:L().default(!1).describe(l.of({label:"Allow HTTP",description:"Required for plain-http (non-TLS) endpoints"})),auth:rt()}).describe(l.of({direction:"two-columns"})),ot=_({type:x("gcs"),bucket:u().nonempty().describe(l.of({label:"Bucket",placeholder:"my-bucket",optionRegex:"(bucket|gcs.?bucket|google.?bucket)"})),service_account_key:u().optional().describe(l.of({label:"Service Account Key (JSON)",special:"secret_textarea"}))}).describe(l.of({direction:"two-columns"})),at=_({type:x("azure"),container:u().nonempty().describe(l.of({label:"Container",placeholder:"my-container"})),account_name:u().nonempty().describe(l.of({label:"Account Name",placeholder:"storageaccount",optionRegex:"(azure.?account|account.?name|storage.?account)"})),account_key:u().optional().describe(l.of({label:"Account Key",inputType:"password",optionRegex:"(azure.?key|account.?key|storage.?key)"}))}).describe(l.of({direction:"two-columns"})),it=_({type:x("coreweave"),bucket:u().nonempty().describe(l.of({label:"Bucket",placeholder:"bucket-name"})),region:u().nonempty().describe(l.of({label:"Region",placeholder:"US-EAST-04A"})),auth:rt()}).describe(l.of({direction:"two-columns"})),ct=_({type:x("gdrive"),credentials_json:u().optional().describe(l.of({label:"Service Account JSON",description:"Leave empty to use browser-based authentication",special:"secret_textarea"}))}).describe(l.of({direction:"two-columns"})),lt=_({type:x("huggingface"),token:u().optional().describe(l.of({label:"Access Token",description:"Leave empty to use the HF_TOKEN environment variable or cached login",inputType:"password",optionRegex:"(hf.?token|hugging.?face.?token|hub.?token)"}))}).describe(l.of({direction:"two-columns"}));function dt(t){return t!=null&&t!==""}const pt=_({type:x("github"),org:u().nonempty().describe(l.of({label:"Organization or user"})),repo:u().nonempty().describe(l.of({label:"Repository"})),sha:u().optional().describe(l.of({label:"Branch, tag, or commit",placeholder:"main",description:"Leave empty to use the default branch"})),username:u().optional().describe(l.of({label:"Username",description:"Set this together with access token",optionRegex:"(github.?username|github.?user)"})),token:u().optional().describe(l.of({label:"Access Token",description:"Set this together with username. Required for private repos and to avoid GitHub's rate limits.",inputType:"password",optionRegex:"(github.?token|gh.?token|github.?pat)"}))}).refine(t=>dt(t.username)===dt(t.token),{message:"Username and access token are required together",path:["token"]}).describe(l.of({direction:"two-columns"})),ur=K("type",[nt,ot,at,it,ct,lt,pt]),mr={obstore:"obstore",fsspec:"fsspec",huggingface_hub:"huggingface_hub"};var br=class{constructor(){G(this,"secrets",{})}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(t,e){if(e===void 0||e==="")return"";let s=`_${t}`;if(F(e)){let n=$e(e);return this.secrets[s]=`os.environ.get("${n}")`,s}return`"${Z(e)}"`}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([t,e])=>`${t} = ${e}`).join(`
143
+ `)}};function ht(t,e){if((t==null?void 0:t.type)==="Container credentials")return[` container_credentials_full_uri=${e.print("container_credentials_full_uri",t.container_credentials_full_uri)},`,` container_authorization_token_file=${e.print("container_authorization_token_file",t.container_authorization_token_file)},`];let s=[];return t!=null&&t.access_key_id&&s.push(` access_key_id=${e.print("access_key_id",t.access_key_id)},`),t!=null&&t.secret_access_key&&s.push(` secret_access_key=${e.print("secret_access_key",t.secret_access_key)},`),s}function gr(t,e){let s=e.print("bucket",t.bucket),n=new Set(["from obstore.store import S3Store"]),r=[];return t.region&&r.push(` region=${e.print("region",t.region)},`),r.push(...ht(t.auth,e)),t.endpoint_url&&r.push(` endpoint_url=${e.print("endpoint_url",t.endpoint_url)},`),t.allow_http&&r.push(" allow_http=True,"),{imports:n,code:y(`
144
+ store = S3Store(${s},${r.length>0?`
145
+ ${r.join(`
146
+ `)}
147
+ `:""})
148
+ `)}}function fr(t,e){let s=e.print("bucket",t.bucket),n=new Set(["from obstore.store import GCSStore"]);if(!t.service_account_key)return{imports:n,code:y(`
149
+ store = GCSStore(${s})
150
+ `)};let r=se(t.service_account_key,i=>e.print("service_account_key",i));return r.kind==="path"?{imports:n,code:y(`
151
+ store = GCSStore(${s},
152
+ service_account_path="${Z(r.path)}",
153
+ )
154
+ `)}:(n.add("import json"),{imports:n,code:y(`
155
+ _credentials = ${r.expr}
156
+ store = GCSStore(${s},
157
+ service_account_key=_credentials,
158
+ )
159
+ `)})}function yr(t,e){let s=e.print("container",t.container),n=e.print("account_name",t.account_name),r=new Set(["from obstore.store import AzureStore"]),i=[`account_name=${n},`];return t.account_key&&i.push(`account_key=${e.print("account_key",t.account_key)},`),{imports:r,code:`store = AzureStore(${s},
160
+ ${i.map(c=>` ${c}`).join(`
161
+ `)}
162
+ )`}}function _r(t,e){let s=e.print("bucket",t.bucket),n=new Set(["from obstore.store import S3Store"]),r=[` region=${e.print("region",t.region)},`];return r.push(...ht(t.auth,e)),r.push(` endpoint="https://${t.bucket}.cwobject.com",`," virtual_hosted_style_request=True,"),{imports:n,code:y(`
163
+ store = S3Store(${s},${`
164
+ ${r.join(`
165
+ `)}
166
+ `})
167
+ `)}}function xr(t,e){let{secrets:s,isEmbedded:n=!1}=e,r=new Set(["from gdrive_fsspec import GoogleDriveFileSystem"]);if(t.credentials_json){let i=se(t.credentials_json,c=>s.print("credentials_json",c));return i.kind==="path"?{imports:r,code:y(`
168
+ fs = GoogleDriveFileSystem(creds="${Z(i.path)}", token="service_account", use_listings_cache=False, skip_instance_cache=True)
169
+ `)}:(r.add("import json"),{imports:r,code:y(`
170
+ _creds = ${i.expr}
171
+ fs = GoogleDriveFileSystem(creds=_creds, token="service_account", use_listings_cache=False, skip_instance_cache=True)
172
+ `)})}return{imports:r,code:y(n?`
173
+ fs = GoogleDriveFileSystem(use_listings_cache=False, skip_instance_cache=True, auth_kwargs={"use_local_webserver": False})
174
+ mo.output.clear_console()
175
+ `:`
176
+ fs = GoogleDriveFileSystem(use_listings_cache=False, skip_instance_cache=True)
177
+ `)}}function Sr(t,e){let s=new Set(["from huggingface_hub import HfApi"]);return t.token?{imports:s,code:`hf = HfApi(token=${e.print("token",t.token)})`}:{imports:s,code:"hf = HfApi()"}}function kr(t,e){let s=new Set(["from fsspec.implementations.github import GithubFileSystem"]),n=[`org=${e.print("org",t.org)},`,`repo=${e.print("repo",t.repo)},`];return t.sha&&n.push(`sha=${e.print("sha",t.sha)},`),t.username&&t.token&&n.push(`username=${e.print("username",t.username)},`,`token=${e.print("token",t.token)},`),{imports:s,code:`fs = GithubFileSystem(
178
+ ${n.map(r=>` ${r}`).join(`
179
+ `)}
180
+ )`}}function wr(t,e){ur.parse(t);let s=new br,n;switch(t.type){case"s3":n=gr(t,s);break;case"gcs":n=fr(t,s);break;case"azure":n=yr(t,s);break;case"coreweave":n=_r(t,s);break;case"gdrive":n=xr(t,{secrets:s,isEmbedded:e.isEmbedded});break;case"huggingface":n=Sr(t,s);break;case"github":n=kr(t,s);break;default:W(t)}let r=[...new Set([...s.imports,...n.imports])].toSorted();r.push("");let i=s.formatSecrets();return i&&r.push(i),r.push(n.code.trim()),r.join(`
181
+ `)}var ut=U(),vr="#232F3E",mt=[{name:"Amazon S3",schema:nt,protocol:"s3",storageLibraries:{libraries:["obstore"],preferred:"obstore"}},{name:"Google Cloud Storage",schema:ot,protocol:"gcs",storageLibraries:{libraries:["obstore"],preferred:"obstore"}},{name:"Azure Blob Storage",schema:at,protocol:"azure",storageLibraries:{libraries:["obstore"],preferred:"obstore"}},{name:"CoreWeave",schema:it,protocol:"coreweave",storageLibraries:{libraries:["obstore"],preferred:"obstore"}},{name:"Google Drive",schema:ct,protocol:"gdrive",storageLibraries:{libraries:["fsspec"],preferred:"fsspec"}},{name:"Hugging Face Hub",schema:lt,protocol:"hf",storageLibraries:{libraries:["huggingface_hub"],preferred:"huggingface_hub"}},{name:"GitHub",schema:pt,protocol:"github",storageLibraries:{libraries:["fsspec"],preferred:"fsspec"}}],$r=t=>{let e=(0,ut.c)(4),{onSelect:s}=t,n;e[0]===s?n=e[1]:(n=mt.map(i=>{let{name:c,schema:a,protocol:d}=i;return(0,o.jsx)(oe,{name:c,color:vr,icon:(0,o.jsx)(Ht,{protocol:d,forceDark:!0,className:"w-7.5 h-7.5 text-white"}),onSelect:()=>s(a)},c)}),e[0]=s,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,o.jsx)(ne,{children:n}),e[2]=n,e[3]=r),r};const jr=t=>{let e=(0,ut.c)(16),{onSubmit:s,header:n}=t,{isEmbedded:r}=ts(),[i,c]=(0,D.useState)(null);if(!i){let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=(0,o.jsx)("div",{children:(0,o.jsx)($r,{onSelect:c})}),e[0]=b):b=e[0];let S;return e[1]===n?S=e[2]:(S=(0,o.jsxs)(o.Fragment,{children:[n,b]}),e[1]=n,e[2]=S),S}let a;e[3]===i?a=e[4]:(a=mt.find(b=>b.schema===i),e[3]=i,e[4]=a);let d=a==null?void 0:a.storageLibraries,p;e[5]===(d==null?void 0:d.libraries)?p=e[6]:(p=(d==null?void 0:d.libraries)??[],e[5]=d==null?void 0:d.libraries,e[6]=p);let h=(d==null?void 0:d.preferred)??"obstore",m;e[7]===r?m=e[8]:(m=(b,S)=>wr(b,{library:S,isEmbedded:r}),e[7]=r,e[8]=m);let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=()=>c(null),e[9]=g):g=e[9];let f;return e[10]!==s||e[11]!==i||e[12]!==p||e[13]!==h||e[14]!==m?(f=(0,o.jsx)(Le,{schema:i,libraries:p,preferredLibrary:h,displayNames:mr,libraryLabel:"Preferred storage library",generateCode:m,onSubmit:s,onBack:g}),e[10]=s,e[11]=i,e[12]=p,e[13]=h,e[14]=m,e[15]=f):f=e[15],f};var bt=U();const Cr=t=>{let e=(0,bt.c)(9),{children:s,defaultTab:n}=t,r=n===void 0?"databases":n,[i,c]=(0,D.useState)(!1),a;e[0]===s?a=e[1]:(a=(0,o.jsx)(Yt,{asChild:!0,children:s}),e[0]=s,e[1]=a);let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>c(!1),e[2]=d):d=e[2];let p;e[3]===r?p=e[4]:(p=(0,o.jsx)(gt,{defaultTab:r,onClose:d}),e[3]=r,e[4]=p);let h;return e[5]!==i||e[6]!==a||e[7]!==p?(h=(0,o.jsxs)(es,{open:i,onOpenChange:c,children:[a,p]}),e[5]=i,e[6]=a,e[7]=p,e[8]=h):h=e[8],h},gt=t=>{let e=(0,bt.c)(24),{defaultTab:s,onClose:n}=t,[r,i]=(0,D.useState)(s===void 0?"databases":s),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,o.jsxs)(Tt,{className:"w-full mb-4",children:[(0,o.jsx)(pe,{value:"databases",className:"flex-1",children:"Databases & Catalogs"}),(0,o.jsx)(pe,{value:"storage",className:"flex-1",children:"Remote Storages"})]}),e[0]=c):c=e[0];let a=c,d;e[1]===r?d=e[2]:(d=r==="databases"?(0,o.jsxs)(o.Fragment,{children:["Don't see your database or connection method? A"," ",(0,o.jsx)(Q,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"code snippet"})," ","is all you need."]}):(0,o.jsxs)(o.Fragment,{children:["Don't see your storage or connection method? A"," ",(0,o.jsx)(Q,{href:"https://docs.marimo.io/guides/working_with_data/remote_storage/#creating-a-storage-connection",children:"code snippet"})," ","is all you need."]}),e[1]=r,e[2]=d);let p=d,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=(0,o.jsx)(Jt,{children:"Add Connection"}),e[3]=h):h=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,o.jsx)(Q,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"database, data catalog"}),e[4]=m):m=e[4];let g;e[5]===Symbol.for("react.memo_cache_sentinel")?(g=(0,o.jsx)(Q,{href:"https://docs.marimo.io/guides/working_with_data/remote_storage/",children:"remote storage"}),e[5]=g):g=e[5];let f;e[6]===p?f=e[7]:(f=(0,o.jsxs)(Qt,{children:[h,(0,o.jsxs)(Xt,{children:["Connect to a"," ",m," ","or"," ",g," ","directly from your notebook.",(0,o.jsx)("span",{className:"block",children:p})]})]}),e[6]=p,e[7]=f);let b=r==="storage"?"storage":"database",S;e[8]!==n||e[9]!==b?(S=(0,o.jsx)(dr,{onSubmit:n,className:"-mt-2",group:b}),e[8]=n,e[9]=b,e[10]=S):S=e[10];let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=N=>i(N),e[11]=w):w=e[11];let k;e[12]===n?k=e[13]:(k=(0,o.jsx)(he,{value:"databases",className:"mt-0 focus-visible:ring-0 focus-visible:ring-offset-0",children:(0,o.jsx)(sr,{onSubmit:n,header:a})}),e[12]=n,e[13]=k);let $;e[14]===n?$=e[15]:($=(0,o.jsx)(he,{value:"storage",className:"mt-0 focus-visible:ring-0 focus-visible:ring-offset-0",children:(0,o.jsx)(jr,{onSubmit:n,header:a})}),e[14]=n,e[15]=$);let C;e[16]!==r||e[17]!==k||e[18]!==$?(C=(0,o.jsxs)(At,{value:r,onValueChange:w,children:[k,$]}),e[16]=r,e[17]=k,e[18]=$,e[19]=C):C=e[19];let j;return e[20]!==C||e[21]!==f||e[22]!==S?(j=(0,o.jsxs)(Zt,{className:"max-h-[75vh] overflow-y-auto",children:[f,S,C]}),e[20]=C,e[21]=f,e[22]=S,e[23]=j):j=e[23],j};export{gt as n,st as r,Cr as t};
@@ -1 +1 @@
1
- import{o as te}from"./chunk-C4rtOYze.js";import{l as ie,u as W}from"./useEvent-GCVIknuR.js";import"./react-C60yClUi.js";import"./cells-Biwqg0z6.js";import"./react-dom-Ba2zmJWD.js";import{t as Q}from"./compiler-runtime-DnimoHo0.js";import{w as ae}from"./ai-model-dropdown-BUCPZ0ND.js";import{m as oe,t as ne,u as de}from"./useEventListener-DpNnLPuE.js";import{t as re}from"./objects-CrbstYTV.js";import{C as se,S as pe,g as me}from"./utils-C8Yt16Y7.js";import"./readonly-python-code-BHrAhtGV.js";import{t as he}from"./jsx-runtime-3wZU7vFS.js";import"./fullscreen-CrevbcR_.js";import"./popover-B96fOqfH.js";import"./JsonOutput-htT793Wj.js";import"./download-CfUkZlw7.js";import"./dist-CeF1Em5L.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{r as ce}from"./requests-B9zEd_sW.js";import"./layout-YPBtS2D6.js";import{t as ye}from"./useCellActionButton-De17Z9R3.js";import"./markdown-renderer-BOS4jZLt.js";import{a as fe,c as ue,t as be}from"./useNotebookActions-CFJducB0.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import"./session-D-SddyN0.js";import"./purify.es-Bwm8T4QC.js";import"./dates-CZTDC2tF.js";import{n as ge}from"./useHotkey-cR1R36p-.js";import"./share-c5Zh8BM8.js";import"./tooltip-BUmTS76K.js";import"./vega-loader.browser-DLY285WP.js";import"./defaultLocale-CGJY8D9C.js";import"./defaultLocale-DzliDDTm.js";import"./chunk-5FQGJX7Z-BIDn9QG0.js";import"./html-to-image-ChfBVn8-.js";import{r as ke}from"./focus-CeTtpVjV.js";import"./react-resizable-panels.browser.esm-CLaR27oP.js";import{a as we,c as Ce,i as X,l as Y,n as _e,o as Z,r as xe,s as je}from"./command-D5LtSvbN.js";import{t as ee}from"./renderShortcut-C6HKXhBl.js";import"./esm-RBKN8Dn2.js";import"./name-cell-input-UMsLssMV.js";import"./multi-icon-C-boGjpw.js";import"./dist-CiELQ2ik.js";import"./dist-CtsSPT78.js";import"./dist-BpyRMlx3.js";import"./dist-Cnb7x5X_.js";import"./dist-B_Q1ayL4.js";import"./dist-CnESRnx2.js";import"./dist-M9OI1ywz.js";import"./dist-DcwGajoh.js";import"./dist-DXl-iyI_.js";import"./esm-B7G79VOo.js";var Se=Q(),ve=3;function Ke(){let e=(0,Se.c)(7),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[0]=l):l=e[0];let[o,r]=ue("marimo:commands",l),p;e[1]!==o||e[2]!==r?(p=u=>{r(He([u,...o]).slice(0,ve))},e[1]=o,e[2]=r,e[3]=p):p=e[3];let n;return e[4]!==o||e[5]!==p?(n={recentCommands:o,addRecentCommand:p},e[4]=o,e[5]=p,e[6]=n):n=e[6],n}function He(e){return[...new Set(e)]}function le(e){return e.dropdown!==void 0}function L(e,l=""){return e.flatMap(o=>o.label?le(o)?L(o.dropdown,`${l+o.label} > `):{...o,label:l+o.label,additionalKeywords:o.additionalKeywords}:[])}var Ae=Q();function De(){let e=(0,Ae.c)(87),[l,o]=se(),[r,p]=pe(),{saveAppConfig:n,saveUserConfig:u}=ce(),F;e[0]!==u||e[1]!==o?(F=async s=>{await u({config:s}).then(()=>{o(m=>({...m,...s}))})},e[0]=u,e[1]=o,e[2]=F):F=e[2];let t=F,M;e[3]!==n||e[4]!==p?(M=async s=>{await n({config:s}).then(()=>{p(s)})},e[3]=n,e[4]=p,e[5]=M):M=e[5];let E=M,V;if(e[6]!==r||e[7]!==l.completion||e[8]!==l.display||e[9]!==l.keymap||e[10]!==E||e[11]!==t){let s;e[13]===r?s=e[14]:(s=z=>z!==r.width,e[13]=r,e[14]=s);let m;e[15]!==r||e[16]!==E?(m=z=>({label:`App config > Set width=${z}`,handle:()=>{E({...r,width:z})}}),e[15]=r,e[16]=E,e[17]=m):m=e[17];let x;e[18]!==l.display||e[19]!==t?(x={label:"Config > Set theme: dark",handle:()=>{t({display:{...l.display,theme:"dark"}})}},e[18]=l.display,e[19]=t,e[20]=x):x=e[20];let b;e[21]!==l.display||e[22]!==t?(b={label:"Config > Set theme: light",handle:()=>{t({display:{...l.display,theme:"light"}})}},e[21]=l.display,e[22]=t,e[23]=b):b=e[23];let j;e[24]!==l.display||e[25]!==t?(j={label:"Config > Set theme: system",handle:()=>{t({display:{...l.display,theme:"system"}})}},e[24]=l.display,e[25]=t,e[26]=j):j=e[26];let N=l.keymap.preset==="vim",S;e[27]!==l.keymap||e[28]!==t?(S=()=>{t({keymap:{...l.keymap,preset:"vim"}})},e[27]=l.keymap,e[28]=t,e[29]=S):S=e[29];let v;e[30]!==N||e[31]!==S?(v={label:"Config > Switch keymap to VIM",hidden:N,handle:S},e[30]=N,e[31]=S,e[32]=v):v=e[32];let K=l.keymap.preset==="default",g;e[33]!==l.keymap||e[34]!==t?(g=()=>{t({keymap:{...l.keymap,preset:"default"}})},e[33]=l.keymap,e[34]=t,e[35]=g):g=e[35];let c;e[36]!==K||e[37]!==g?(c={label:"Config > Switch keymap to default (current: VIM)",hidden:K,handle:g},e[36]=K,e[37]=g,e[38]=c):c=e[38];let k;e[39]!==l.completion||e[40]!==t?(k=()=>{t({completion:{...l.completion,copilot:!1}})},e[39]=l.completion,e[40]=t,e[41]=k):k=e[41];let w=l.completion.copilot!=="github",R;e[42]!==k||e[43]!==w?(R={label:"Config > Disable GitHub Copilot",handle:k,hidden:w},e[42]=k,e[43]=w,e[44]=R):R=e[44];let C;e[45]!==l.completion||e[46]!==t?(C=()=>{t({completion:{...l.completion,copilot:"github"}})},e[45]=l.completion,e[46]=t,e[47]=C):C=e[47];let $=l.completion.copilot==="github",B;e[48]!==C||e[49]!==$?(B={label:"Config > Enable GitHub Copilot",handle:C,hidden:$},e[48]=C,e[49]=$,e[50]=B):B=e[50];let I=!l.display.reference_highlighting,_;e[51]!==l.display||e[52]!==t?(_=()=>{t({display:{...l.display,reference_highlighting:!1}})},e[51]=l.display,e[52]=t,e[53]=_):_=e[53];let y;e[54]!==I||e[55]!==_?(y={label:"Config > Disable reference highlighting",hidden:I,handle:_},e[54]=I,e[55]=_,e[56]=y):y=e[56];let h;e[57]!==l.display||e[58]!==t?(h=()=>{t({display:{...l.display,reference_highlighting:!0}})},e[57]=l.display,e[58]=t,e[59]=h):h=e[59];let H;e[60]!==l.display.reference_highlighting||e[61]!==h?(H={label:"Config > Enable reference highlighting",hidden:l.display.reference_highlighting,handle:h},e[60]=l.display.reference_highlighting,e[61]=h,e[62]=H):H=e[62];let i=!(l.display.code_lens??!0),a;e[63]!==l.display||e[64]!==t?(a=()=>{t({display:{...l.display,code_lens:!1}})},e[63]=l.display,e[64]=t,e[65]=a):a=e[65];let A;e[66]!==i||e[67]!==a?(A={label:"Config > Disable code lens",hidden:i,handle:a},e[66]=i,e[67]=a,e[68]=A):A=e[68];let f=l.display.code_lens??!0,D;e[69]!==l.display||e[70]!==t?(D=()=>{t({display:{...l.display,code_lens:!0}})},e[69]=l.display,e[70]=t,e[71]=D):D=e[71];let G;e[72]!==f||e[73]!==D?(G={label:"Config > Enable code lens",hidden:f,handle:D},e[72]=f,e[73]=D,e[74]=G):G=e[74];let q=l.display.cell_output==="above",O;e[75]!==l.display||e[76]!==t?(O=()=>{t({display:{...l.display,cell_output:"above"}})},e[75]=l.display,e[76]=t,e[77]=O):O=e[77];let T;e[78]!==q||e[79]!==O?(T={label:"Config > Set cell output area: above",hidden:q,handle:O},e[78]=q,e[79]=O,e[80]=T):T=e[80];let J=l.display.cell_output==="below",P;e[81]!==l.display||e[82]!==t?(P=()=>{t({display:{...l.display,cell_output:"below"}})},e[81]=l.display,e[82]=t,e[83]=P):P=e[83];let U;e[84]!==J||e[85]!==P?(U={label:"Config > Set cell output area: below",hidden:J,handle:P},e[84]=J,e[85]=P,e[86]=U):U=e[86],V=[...ae().filter(s).map(m),x,b,j,v,c,R,B,y,H,A,G,T,U].filter(Fe),e[6]=r,e[7]=l.completion,e[8]=l.display,e[9]=l.keymap,e[10]=E,e[11]=t,e[12]=V}else V=e[12];return V}function Fe(e){return!e.hidden}var Me=Q(),d=te(he(),1),Ee=()=>{let e=(0,Me.c)(37),[l,o]=ie(fe),r=ge(),p=W(ke),n=W(me),u;e[0]===p?u=e[1]:(u={cell:p},e[0]=p,e[1]=u);let F=ye(u).flat();F=L(F);let t=De(),M=be();M=[...L(M),...L(t)];let E=M.filter(Ne),V=re.keyBy(E,Re),{recentCommands:s,addRecentCommand:m}=Ke(),x;e[2]===s?x=e[3]:(x=new Set(s),e[2]=s,e[3]=x);let b=x,j;e[4]!==n||e[5]!==o?(j=i=>{oe(n.getHotkey("global.commandPalette").key)(i)&&(i.preventDefault(),o(Be))},e[4]=n,e[5]=o,e[6]=j):j=e[6],ne(document,"keydown",j);let N;e[7]!==m||e[8]!==n||e[9]!==r||e[10]!==o?(N=(i,a)=>{let A=r[i];if(!A)return null;let f=n.getHotkey(i);return(0,d.jsxs)(Z,{disabled:a.disabled,keywords:f.additionalKeywords,onSelect:()=>{m(i),o(!1),requestAnimationFrame(()=>{A()})},value:f.name,children:[(0,d.jsxs)("span",{children:[f.name,a.tooltip&&(0,d.jsx)("span",{className:"ml-2",children:a.tooltip})]}),(0,d.jsx)(Y,{children:(0,d.jsx)(ee,{shortcut:f.key})})]},i)},e[7]=m,e[8]=n,e[9]=r,e[10]=o,e[11]=N):N=e[11];let S=N,v;e[12]!==m||e[13]!==n||e[14]!==o?(v=i=>{let{label:a,handle:A,props:f,hotkey:D,additionalKeywords:G}=i,q=f===void 0?{}:f;return(0,d.jsxs)(Z,{disabled:q.disabled,keywords:G,onSelect:()=>{m(a),o(!1),requestAnimationFrame(()=>{A()})},value:a,children:[(0,d.jsxs)("span",{children:[a,q.tooltip&&(0,d.jsxs)("span",{className:"ml-2",children:["(",q.tooltip,")"]})]}),D&&(0,d.jsx)(Y,{children:(0,d.jsx)(ee,{shortcut:n.getHotkey(D).key})})]},a)},e[12]=m,e[13]=n,e[14]=o,e[15]=v):v=e[15];let K=v,g=_e,c;e[16]===Symbol.for("react.memo_cache_sentinel")?(c=(0,d.jsx)(we,{placeholder:"Type to search..."}),e[16]=c):c=e[16];let k=je,w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=(0,d.jsx)(xe,{children:"No results found."}),e[17]=w):w=e[17];let R=s.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(X,{heading:"Recently Used",children:s.map(i=>{let a=V[i];return de(i)?S(i,{disabled:a==null?void 0:a.disabled,tooltip:a==null?void 0:a.tooltip}):a&&!le(a)?K({label:a.label,handle:a.handleHeadless||a.handle,props:{disabled:a.disabled,tooltip:a.tooltip},additionalKeywords:a.additionalKeywords}):null})}),(0,d.jsx)(Ce,{})]}),C=X,$=n.iterate().map(i=>{if(b.has(i))return null;let a=V[i];return S(i,{disabled:a==null?void 0:a.disabled,tooltip:a==null?void 0:a.tooltip})}),B=E.map(i=>b.has(i.label)?null:K({label:i.label,handle:i.handleHeadless||i.handle,props:{disabled:i.disabled,tooltip:i.tooltip},additionalKeywords:i.additionalKeywords})),I;e[18]!==b||e[19]!==K?(I=i=>b.has(i.label)?null:K({label:`Cell > ${i.label}`,handle:i.handleHeadless||i.handle,props:{disabled:i.disabled,tooltip:i.tooltip},additionalKeywords:i.additionalKeywords}),e[18]=b,e[19]=K,e[20]=I):I=e[20];let _=F.map(I),y;e[21]!==C||e[22]!==B||e[23]!==_||e[24]!==$?(y=(0,d.jsxs)(C,{heading:"Commands",children:[$,B,_]}),e[21]=C,e[22]=B,e[23]=_,e[24]=$,e[25]=y):y=e[25];let h;e[26]!==k||e[27]!==y||e[28]!==w||e[29]!==R?(h=(0,d.jsxs)(k,{children:[w,R,y]}),e[26]=k,e[27]=y,e[28]=w,e[29]=R,e[30]=h):h=e[30];let H;return e[31]!==g||e[32]!==l||e[33]!==o||e[34]!==h||e[35]!==c?(H=(0,d.jsxs)(g,{open:l,onOpenChange:o,children:[c,h]}),e[31]=g,e[32]=l,e[33]=o,e[34]=h,e[35]=c,e[36]=H):H=e[36],H};function Ne(e){return!e.hotkey}function Re(e){return e.label}function Be(e){return!e}export{Ee as default};
1
+ import{o as te}from"./chunk-C4rtOYze.js";import{l as ie,u as W}from"./useEvent-GCVIknuR.js";import"./react-C60yClUi.js";import"./cells-Biwqg0z6.js";import"./react-dom-Ba2zmJWD.js";import{t as Q}from"./compiler-runtime-DnimoHo0.js";import{w as ae}from"./ai-model-dropdown-BUCPZ0ND.js";import{m as oe,t as ne,u as de}from"./useEventListener-DpNnLPuE.js";import{t as re}from"./objects-CrbstYTV.js";import{C as se,S as pe,g as me}from"./utils-C8Yt16Y7.js";import"./readonly-python-code-BHrAhtGV.js";import{t as he}from"./jsx-runtime-3wZU7vFS.js";import"./fullscreen-CrevbcR_.js";import"./popover-B96fOqfH.js";import"./JsonOutput-htT793Wj.js";import"./download-CfUkZlw7.js";import"./dist-CeF1Em5L.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{r as ce}from"./requests-B9zEd_sW.js";import"./layout-YPBtS2D6.js";import{t as ye}from"./useCellActionButton-De17Z9R3.js";import"./markdown-renderer-BOS4jZLt.js";import{a as fe,c as ue,t as be}from"./useNotebookActions-BI53NQV3.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import"./session-D-SddyN0.js";import"./purify.es-Bwm8T4QC.js";import"./dates-CZTDC2tF.js";import{n as ge}from"./useHotkey-cR1R36p-.js";import"./share-c5Zh8BM8.js";import"./tooltip-BUmTS76K.js";import"./vega-loader.browser-DLY285WP.js";import"./defaultLocale-CGJY8D9C.js";import"./defaultLocale-DzliDDTm.js";import"./chunk-5FQGJX7Z-BIDn9QG0.js";import"./html-to-image-ChfBVn8-.js";import{r as ke}from"./focus-CeTtpVjV.js";import"./react-resizable-panels.browser.esm-CLaR27oP.js";import{a as we,c as Ce,i as X,l as Y,n as _e,o as Z,r as xe,s as je}from"./command-D5LtSvbN.js";import{t as ee}from"./renderShortcut-C6HKXhBl.js";import"./esm-RBKN8Dn2.js";import"./name-cell-input-UMsLssMV.js";import"./multi-icon-C-boGjpw.js";import"./dist-CiELQ2ik.js";import"./dist-CtsSPT78.js";import"./dist-BpyRMlx3.js";import"./dist-Cnb7x5X_.js";import"./dist-B_Q1ayL4.js";import"./dist-CnESRnx2.js";import"./dist-M9OI1ywz.js";import"./dist-DcwGajoh.js";import"./dist-DXl-iyI_.js";import"./esm-B7G79VOo.js";var Se=Q(),ve=3;function Ke(){let e=(0,Se.c)(7),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[0]=l):l=e[0];let[o,r]=ue("marimo:commands",l),p;e[1]!==o||e[2]!==r?(p=u=>{r(He([u,...o]).slice(0,ve))},e[1]=o,e[2]=r,e[3]=p):p=e[3];let n;return e[4]!==o||e[5]!==p?(n={recentCommands:o,addRecentCommand:p},e[4]=o,e[5]=p,e[6]=n):n=e[6],n}function He(e){return[...new Set(e)]}function le(e){return e.dropdown!==void 0}function L(e,l=""){return e.flatMap(o=>o.label?le(o)?L(o.dropdown,`${l+o.label} > `):{...o,label:l+o.label,additionalKeywords:o.additionalKeywords}:[])}var Ae=Q();function De(){let e=(0,Ae.c)(87),[l,o]=se(),[r,p]=pe(),{saveAppConfig:n,saveUserConfig:u}=ce(),F;e[0]!==u||e[1]!==o?(F=async s=>{await u({config:s}).then(()=>{o(m=>({...m,...s}))})},e[0]=u,e[1]=o,e[2]=F):F=e[2];let t=F,M;e[3]!==n||e[4]!==p?(M=async s=>{await n({config:s}).then(()=>{p(s)})},e[3]=n,e[4]=p,e[5]=M):M=e[5];let E=M,V;if(e[6]!==r||e[7]!==l.completion||e[8]!==l.display||e[9]!==l.keymap||e[10]!==E||e[11]!==t){let s;e[13]===r?s=e[14]:(s=z=>z!==r.width,e[13]=r,e[14]=s);let m;e[15]!==r||e[16]!==E?(m=z=>({label:`App config > Set width=${z}`,handle:()=>{E({...r,width:z})}}),e[15]=r,e[16]=E,e[17]=m):m=e[17];let x;e[18]!==l.display||e[19]!==t?(x={label:"Config > Set theme: dark",handle:()=>{t({display:{...l.display,theme:"dark"}})}},e[18]=l.display,e[19]=t,e[20]=x):x=e[20];let b;e[21]!==l.display||e[22]!==t?(b={label:"Config > Set theme: light",handle:()=>{t({display:{...l.display,theme:"light"}})}},e[21]=l.display,e[22]=t,e[23]=b):b=e[23];let j;e[24]!==l.display||e[25]!==t?(j={label:"Config > Set theme: system",handle:()=>{t({display:{...l.display,theme:"system"}})}},e[24]=l.display,e[25]=t,e[26]=j):j=e[26];let N=l.keymap.preset==="vim",S;e[27]!==l.keymap||e[28]!==t?(S=()=>{t({keymap:{...l.keymap,preset:"vim"}})},e[27]=l.keymap,e[28]=t,e[29]=S):S=e[29];let v;e[30]!==N||e[31]!==S?(v={label:"Config > Switch keymap to VIM",hidden:N,handle:S},e[30]=N,e[31]=S,e[32]=v):v=e[32];let K=l.keymap.preset==="default",g;e[33]!==l.keymap||e[34]!==t?(g=()=>{t({keymap:{...l.keymap,preset:"default"}})},e[33]=l.keymap,e[34]=t,e[35]=g):g=e[35];let c;e[36]!==K||e[37]!==g?(c={label:"Config > Switch keymap to default (current: VIM)",hidden:K,handle:g},e[36]=K,e[37]=g,e[38]=c):c=e[38];let k;e[39]!==l.completion||e[40]!==t?(k=()=>{t({completion:{...l.completion,copilot:!1}})},e[39]=l.completion,e[40]=t,e[41]=k):k=e[41];let w=l.completion.copilot!=="github",R;e[42]!==k||e[43]!==w?(R={label:"Config > Disable GitHub Copilot",handle:k,hidden:w},e[42]=k,e[43]=w,e[44]=R):R=e[44];let C;e[45]!==l.completion||e[46]!==t?(C=()=>{t({completion:{...l.completion,copilot:"github"}})},e[45]=l.completion,e[46]=t,e[47]=C):C=e[47];let $=l.completion.copilot==="github",B;e[48]!==C||e[49]!==$?(B={label:"Config > Enable GitHub Copilot",handle:C,hidden:$},e[48]=C,e[49]=$,e[50]=B):B=e[50];let I=!l.display.reference_highlighting,_;e[51]!==l.display||e[52]!==t?(_=()=>{t({display:{...l.display,reference_highlighting:!1}})},e[51]=l.display,e[52]=t,e[53]=_):_=e[53];let y;e[54]!==I||e[55]!==_?(y={label:"Config > Disable reference highlighting",hidden:I,handle:_},e[54]=I,e[55]=_,e[56]=y):y=e[56];let h;e[57]!==l.display||e[58]!==t?(h=()=>{t({display:{...l.display,reference_highlighting:!0}})},e[57]=l.display,e[58]=t,e[59]=h):h=e[59];let H;e[60]!==l.display.reference_highlighting||e[61]!==h?(H={label:"Config > Enable reference highlighting",hidden:l.display.reference_highlighting,handle:h},e[60]=l.display.reference_highlighting,e[61]=h,e[62]=H):H=e[62];let i=!(l.display.code_lens??!0),a;e[63]!==l.display||e[64]!==t?(a=()=>{t({display:{...l.display,code_lens:!1}})},e[63]=l.display,e[64]=t,e[65]=a):a=e[65];let A;e[66]!==i||e[67]!==a?(A={label:"Config > Disable code lens",hidden:i,handle:a},e[66]=i,e[67]=a,e[68]=A):A=e[68];let f=l.display.code_lens??!0,D;e[69]!==l.display||e[70]!==t?(D=()=>{t({display:{...l.display,code_lens:!0}})},e[69]=l.display,e[70]=t,e[71]=D):D=e[71];let G;e[72]!==f||e[73]!==D?(G={label:"Config > Enable code lens",hidden:f,handle:D},e[72]=f,e[73]=D,e[74]=G):G=e[74];let q=l.display.cell_output==="above",O;e[75]!==l.display||e[76]!==t?(O=()=>{t({display:{...l.display,cell_output:"above"}})},e[75]=l.display,e[76]=t,e[77]=O):O=e[77];let T;e[78]!==q||e[79]!==O?(T={label:"Config > Set cell output area: above",hidden:q,handle:O},e[78]=q,e[79]=O,e[80]=T):T=e[80];let J=l.display.cell_output==="below",P;e[81]!==l.display||e[82]!==t?(P=()=>{t({display:{...l.display,cell_output:"below"}})},e[81]=l.display,e[82]=t,e[83]=P):P=e[83];let U;e[84]!==J||e[85]!==P?(U={label:"Config > Set cell output area: below",hidden:J,handle:P},e[84]=J,e[85]=P,e[86]=U):U=e[86],V=[...ae().filter(s).map(m),x,b,j,v,c,R,B,y,H,A,G,T,U].filter(Fe),e[6]=r,e[7]=l.completion,e[8]=l.display,e[9]=l.keymap,e[10]=E,e[11]=t,e[12]=V}else V=e[12];return V}function Fe(e){return!e.hidden}var Me=Q(),d=te(he(),1),Ee=()=>{let e=(0,Me.c)(37),[l,o]=ie(fe),r=ge(),p=W(ke),n=W(me),u;e[0]===p?u=e[1]:(u={cell:p},e[0]=p,e[1]=u);let F=ye(u).flat();F=L(F);let t=De(),M=be();M=[...L(M),...L(t)];let E=M.filter(Ne),V=re.keyBy(E,Re),{recentCommands:s,addRecentCommand:m}=Ke(),x;e[2]===s?x=e[3]:(x=new Set(s),e[2]=s,e[3]=x);let b=x,j;e[4]!==n||e[5]!==o?(j=i=>{oe(n.getHotkey("global.commandPalette").key)(i)&&(i.preventDefault(),o(Be))},e[4]=n,e[5]=o,e[6]=j):j=e[6],ne(document,"keydown",j);let N;e[7]!==m||e[8]!==n||e[9]!==r||e[10]!==o?(N=(i,a)=>{let A=r[i];if(!A)return null;let f=n.getHotkey(i);return(0,d.jsxs)(Z,{disabled:a.disabled,keywords:f.additionalKeywords,onSelect:()=>{m(i),o(!1),requestAnimationFrame(()=>{A()})},value:f.name,children:[(0,d.jsxs)("span",{children:[f.name,a.tooltip&&(0,d.jsx)("span",{className:"ml-2",children:a.tooltip})]}),(0,d.jsx)(Y,{children:(0,d.jsx)(ee,{shortcut:f.key})})]},i)},e[7]=m,e[8]=n,e[9]=r,e[10]=o,e[11]=N):N=e[11];let S=N,v;e[12]!==m||e[13]!==n||e[14]!==o?(v=i=>{let{label:a,handle:A,props:f,hotkey:D,additionalKeywords:G}=i,q=f===void 0?{}:f;return(0,d.jsxs)(Z,{disabled:q.disabled,keywords:G,onSelect:()=>{m(a),o(!1),requestAnimationFrame(()=>{A()})},value:a,children:[(0,d.jsxs)("span",{children:[a,q.tooltip&&(0,d.jsxs)("span",{className:"ml-2",children:["(",q.tooltip,")"]})]}),D&&(0,d.jsx)(Y,{children:(0,d.jsx)(ee,{shortcut:n.getHotkey(D).key})})]},a)},e[12]=m,e[13]=n,e[14]=o,e[15]=v):v=e[15];let K=v,g=_e,c;e[16]===Symbol.for("react.memo_cache_sentinel")?(c=(0,d.jsx)(we,{placeholder:"Type to search..."}),e[16]=c):c=e[16];let k=je,w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=(0,d.jsx)(xe,{children:"No results found."}),e[17]=w):w=e[17];let R=s.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(X,{heading:"Recently Used",children:s.map(i=>{let a=V[i];return de(i)?S(i,{disabled:a==null?void 0:a.disabled,tooltip:a==null?void 0:a.tooltip}):a&&!le(a)?K({label:a.label,handle:a.handleHeadless||a.handle,props:{disabled:a.disabled,tooltip:a.tooltip},additionalKeywords:a.additionalKeywords}):null})}),(0,d.jsx)(Ce,{})]}),C=X,$=n.iterate().map(i=>{if(b.has(i))return null;let a=V[i];return S(i,{disabled:a==null?void 0:a.disabled,tooltip:a==null?void 0:a.tooltip})}),B=E.map(i=>b.has(i.label)?null:K({label:i.label,handle:i.handleHeadless||i.handle,props:{disabled:i.disabled,tooltip:i.tooltip},additionalKeywords:i.additionalKeywords})),I;e[18]!==b||e[19]!==K?(I=i=>b.has(i.label)?null:K({label:`Cell > ${i.label}`,handle:i.handleHeadless||i.handle,props:{disabled:i.disabled,tooltip:i.tooltip},additionalKeywords:i.additionalKeywords}),e[18]=b,e[19]=K,e[20]=I):I=e[20];let _=F.map(I),y;e[21]!==C||e[22]!==B||e[23]!==_||e[24]!==$?(y=(0,d.jsxs)(C,{heading:"Commands",children:[$,B,_]}),e[21]=C,e[22]=B,e[23]=_,e[24]=$,e[25]=y):y=e[25];let h;e[26]!==k||e[27]!==y||e[28]!==w||e[29]!==R?(h=(0,d.jsxs)(k,{children:[w,R,y]}),e[26]=k,e[27]=y,e[28]=w,e[29]=R,e[30]=h):h=e[30];let H;return e[31]!==g||e[32]!==l||e[33]!==o||e[34]!==h||e[35]!==c?(H=(0,d.jsxs)(g,{open:l,onOpenChange:o,children:[c,h]}),e[31]=g,e[32]=l,e[33]=o,e[34]=h,e[35]=c,e[36]=H):H=e[36],H};function Ne(e){return!e.hotkey}function Re(e){return e.label}function Be(e){return!e}export{Ee as default};