@marimo-team/frontend 0.20.5-dev64 → 0.20.5-dev65
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.
- package/dist/assets/{add-connection-dialog-DS033hDE.js → add-connection-dialog-DVxfAULb.js} +41 -41
- package/dist/assets/{command-palette-BqxnATcC.js → command-palette-CnmuHC-K.js} +1 -1
- package/dist/assets/{edit-page-DhaaVp0t.js → edit-page-dgMbnPkJ.js} +3 -3
- package/dist/assets/{file-explorer-panel-oUugl36h.js → file-explorer-panel-CRxTuNmM.js} +1 -1
- package/dist/assets/{index-Dm1Npvfm.js → index-B6j3GjGF.js} +2 -2
- package/dist/assets/{session-panel-CXK0e5N_.js → session-panel-KnTyM1M-.js} +1 -1
- package/dist/assets/{useNotebookActions-Cab6kvWf.js → useNotebookActions-DvWNs3kA.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/editor/connections/add-connection-dialog.tsx +27 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Dt=Object.defineProperty;var zt=(t,e,n)=>e in t?Dt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var B=(t,e,n)=>zt(t,typeof e!="symbol"?e+"":e,n);import{s as Re}from"./chunk-LvLJmgfZ.js";import{i as Ot,l as me,n as L,p as Te,u as se}from"./useEvent-O0nX5vok.js";import{t as Mt}from"./react-Bj1aDYRI.js";import{En as $t,T as Rt,kn as Ae,si as Tt,ui as Ee,ur as At}from"./cells-5wegzPD4.js";import"./react-dom-CSu739Rf.js";import{t as te}from"./compiler-runtime-B3qBwwSJ.js";import"./tooltip-WkrsrB6k.js";import{i as Ie,r as Et,t as Le}from"./add-connection-dialog-DS033hDE.js";import{h as It,m as ge}from"./useEventListener-BGihH8bs.js";import{t as Lt}from"./invariant-CQUIhlu2.js";import{p as Bt,u as Be}from"./utils-HIU-NsEv.js";import{S as he}from"./config-RexwtI0U.js";import{t as Vt}from"./jsx-runtime-icT_Ltz2.js";import{n as Ht,t as R}from"./button-BZAv3veu.js";import{t as q}from"./cn-BoaCR37F.js";import{St as Ut}from"./dist-B_cxg-E4.js";import{a as qt,i as Ve,o as pe}from"./JsonOutput-BzXkaUJB.js";import"./cjs-BU2qXMKx.js";import"./main-DrBRErTM.js";import"./useNonce-BtW-rR_1.js";import{n as Wt,r as je}from"./requests-Bgjtqo_1.js";import{t as ae}from"./createLucideIcon-Cm-Z7dYr.js";import{a as He,c as Ue,i as qe,n as fe,o as ye,r as Kt,t as Gt}from"./state-CQzPalvd.js";import{n as Jt}from"./LazyAnyLanguageCodeMirror-CwbmGJrl.js";import{a as Yt,i as Zt,n as be,o as Qt,r as Xt,t as ea}from"./tree-IqZcruNX.js";import{t as ta}from"./x-BI1M8X_v.js";import{c as aa,i as ve,r as We}from"./download-B8XlLSji.js";import{f as we}from"./maps-CqKCrVZ8.js";import{n as na}from"./markdown-renderer-D0ROu8n3.js";import{u as sa}from"./toDate-BqKH-Jd9.js";import{a as M,c as ne,p as Ke,r as Ge,t as Je}from"./dropdown-menu-CJ-Wwa2I.js";import{t as Ne}from"./copy-CkudG0Ej.js";import{t as ke}from"./download-DBW9RXtT.js";import{t as ra}from"./eye-off-vwi9L975.js";import{a as ia,i as Ye,n as Ze,r as la,t as oa}from"./file-icons-BdaBiPvr.js";import{t as Qe}from"./file-plus-corner-lLQw9OnR.js";import{t as Xe}from"./file-DzHkbIdO.js";import{t as ca}from"./link-Cf10mh3t.js";import{n as Ce,t as da}from"./spinner-C5JoisA7.js";import{t as et}from"./plus-dVmh0yTy.js";import{t as tt}from"./refresh-cw-CHAHPgkx.js";import{t as ma}from"./save-8fSvKYJT.js";import{t as ha}from"./trash-2-CAoNMkjq.js";import{t as pa}from"./triangle-alert-qZo1ox6x.js";import{i as fa,n as xa,t as ua}from"./es-2S6JXj4o.js";import"./dist-BNC_tnlW.js";import"./dist-CXLJUPFl.js";import"./dist-CQqv2gQL.js";import"./dist-8UD0A5sU.js";import"./dist-apDpadc4.js";import{t as A}from"./use-toast-Hc8CXlvz.js";import{t as Fe}from"./paths-D2lG83Oh.js";import"./session-CXChHxAw.js";import"./Combination-CBJmtdux.js";import{t as T}from"./tooltip-CNmaER6z.js";import"./purify.es-BBn8CPhf.js";import"./dates-BcvJrESI.js";import{o as ga}from"./alert-dialog-DbQ_TZC7.js";import{t as at}from"./context-CRmPPhx9.js";import"./popover-JNsSzROl.js";import{n as nt}from"./ImperativeModal-b5nJtLod.js";import{r as ja}from"./errors-0IrrdfSG.js";import{n as ya}from"./blob-DgooIGjS.js";import"./vega-loader.browser-BJ9oKrvH.js";import"./defaultLocale-CuYNS33t.js";import"./defaultLocale-CGfP-Ye3.js";import{t as re}from"./copy-f2iEg0yL.js";import{t as ba}from"./copy-icon-Cu7az85f.js";import{n as va}from"./multi-map-x_GQgXMS.js";import{n as wa,t as Na}from"./alert-DkRmN0_B.js";import{n as st}from"./error-banner-CAuK5DPN.js";import{n as _e}from"./useAsyncData-a8f2Q_nk.js";import{a as ka,o as rt,t as Ca,u as Fa}from"./command-B7XhH0hz.js";import"./chunk-5FQGJX7Z-DEi7JZeU.js";import"./katex-0Z75JF53.js";import"./html-to-image-BYwkVvZl.js";import{o as _a}from"./focus-BjrLbkmu.js";import{a as Sa}from"./renderShortcut-BSq2vc9J.js";import{t as Pa}from"./bundle.esm-cfPbrCwe.js";import{t as Da}from"./useAddCell-CKoCjXpL.js";import{a as za,c as Se,d as Pe,l as it,u as lt}from"./components-CMr3IGTz.js";import{t as Oa}from"./empty-state-qEnkddw9.js";import{t as De}from"./formatting-CgyD0Rtn.js";import{a as Ma,i as $a,n as ot,r as ct,t as dt}from"./components-BtpAwxaG.js";import{n as mt,t as Ra}from"./marimo-icons-D5FuIsqO.js";import{t as Ta}from"./links-XdsYEk97.js";var Aa=ae("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),ht=ae("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),pt=ae("list-tree",[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]]),Ea=ae("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),Ia=ae("square-play",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}]]),ft=ae("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),z=Re(Mt(),1),La=te(),a=Re(Vt(),1);const xt=t=>{let e=(0,La.c)(17),{filename:n,filenameIcon:i,onBack:r,onRefresh:s,onDownload:c,actions:o}=t,h;e[0]===r?h=e[1]:(h=r&&(0,a.jsx)(T,{content:"Back to file list",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:r,children:(0,a.jsx)(Ue,{className:"h-4 w-4"})})}),e[0]=r,e[1]=h);let l;e[2]!==n||e[3]!==i?(l=n?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate",children:[i,n]}):(0,a.jsx)("span",{className:"flex-1"}),e[2]=n,e[3]=i,e[4]=l):l=e[4];let f;e[5]===s?f=e[6]:(f=s&&(0,a.jsx)(T,{content:"Refresh",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:s,children:(0,a.jsx)(tt,{className:"h-3.5 w-3.5"})})}),e[5]=s,e[6]=f);let j;e[7]===c?j=e[8]:(j=c&&(0,a.jsx)(T,{content:"Download",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:c,children:(0,a.jsx)(ke,{className:"h-3.5 w-3.5"})})}),e[7]=c,e[8]=j);let y;e[9]!==o||e[10]!==f||e[11]!==j?(y=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[f,o,j]}),e[9]=o,e[10]=f,e[11]=j,e[12]=y):y=e[12];let p;return e[13]!==h||e[14]!==l||e[15]!==y?(p=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[h,l,y]}),e[13]=h,e[14]=l,e[15]=y,e[16]=p):p=e[16],p};var Ba=100*1024*1024;function Va(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}const Ha=({entry:t,namespace:e,onBack:n})=>{let{locale:i}=at(),r=Va(t.path),s=t.mimeType||"text/plain",c=pe(s),o=c&&t.size>Ba&&t.size>0,{data:h,isPending:l,error:f,refetch:j}=_e(async()=>{if(o)return null;let x=await ye.request({namespace:e,path:t.path,preview:!c});if(x.error)throw Error(x.error);if(!x.url)throw Error("No URL returned");if(c)return{type:"media",url:x.url};let b=await fetch(x.url);if(!b.ok)throw Error(`Failed to fetch preview: ${b.statusText}`);return{type:"text",content:await b.text()}},[e,t.path,c,o]),y=(0,z.useCallback)(async()=>{try{let x=await ye.request({namespace:e,path:t.path});if(x.error){A({title:"Download failed",description:x.error,variant:"danger"});return}x.url&&ve(x.url,x.filename??r)}catch(x){ge.error("Failed to download storage entry",x),A({title:"Download failed",description:String(x),variant:"danger"})}},[e,t.path,r]),p=(0,a.jsx)(xt,{filename:r,filenameIcon:Ye(r),onBack:n,onDownload:y}),m=({includeMime:x=!1})=>(0,a.jsxs)("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs",children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Path"}),(0,a.jsxs)("div",{className:"truncate flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-mono text-[11px]",children:t.path}),(0,a.jsx)(ba,{value:t.path,className:"h-3 w-3"})]}),x&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),x&&(0,a.jsx)("span",{children:s}),t.size>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Size"}),(0,a.jsx)("span",{children:De(t.size,i)})]}),t.lastModified!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Modified"}),(0,a.jsx)("span",{children:new Date(t.lastModified*1e3).toLocaleString()})]})]});return o?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,m({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",De(t.size,i),")."]})]}):l?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,m({}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24",children:[(0,a.jsx)(Ce,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):f?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,m({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",f.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)(R,{variant:"secondary",size:"xs",onClick:j,children:[(0,a.jsx)(tt,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):h?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,m({}),(0,a.jsx)(Ve,{mimeType:s,contents:h.type==="text"?h.content:void 0,mediaSource:h.type==="media"?{url:h.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,m({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(Xe,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var Ua=new Set(["http","file","in-memory"]);function ze(t){return JSON.stringify(t).slice(1,-1)}const qa=[{id:"read-file",label:"Insert read snippet",icon:Qt,getCode:t=>{if(t.entry.kind==="directory")return null;let e=ze(t.entry.path);return t.backendType==="obstore"?`_data = ${t.variableName}.get("${e}").bytes()
|
|
1
|
+
var Dt=Object.defineProperty;var zt=(t,e,n)=>e in t?Dt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var B=(t,e,n)=>zt(t,typeof e!="symbol"?e+"":e,n);import{s as Re}from"./chunk-LvLJmgfZ.js";import{i as Ot,l as me,n as L,p as Te,u as se}from"./useEvent-O0nX5vok.js";import{t as Mt}from"./react-Bj1aDYRI.js";import{En as $t,T as Rt,kn as Ae,si as Tt,ui as Ee,ur as At}from"./cells-5wegzPD4.js";import"./react-dom-CSu739Rf.js";import{t as te}from"./compiler-runtime-B3qBwwSJ.js";import"./tooltip-WkrsrB6k.js";import{i as Ie,r as Et,t as Le}from"./add-connection-dialog-DVxfAULb.js";import{h as It,m as ge}from"./useEventListener-BGihH8bs.js";import{t as Lt}from"./invariant-CQUIhlu2.js";import{p as Bt,u as Be}from"./utils-HIU-NsEv.js";import{S as he}from"./config-RexwtI0U.js";import{t as Vt}from"./jsx-runtime-icT_Ltz2.js";import{n as Ht,t as R}from"./button-BZAv3veu.js";import{t as q}from"./cn-BoaCR37F.js";import{St as Ut}from"./dist-B_cxg-E4.js";import{a as qt,i as Ve,o as pe}from"./JsonOutput-BzXkaUJB.js";import"./cjs-BU2qXMKx.js";import"./main-DrBRErTM.js";import"./useNonce-BtW-rR_1.js";import{n as Wt,r as je}from"./requests-Bgjtqo_1.js";import{t as ae}from"./createLucideIcon-Cm-Z7dYr.js";import{a as He,c as Ue,i as qe,n as fe,o as ye,r as Kt,t as Gt}from"./state-CQzPalvd.js";import{n as Jt}from"./LazyAnyLanguageCodeMirror-CwbmGJrl.js";import{a as Yt,i as Zt,n as be,o as Qt,r as Xt,t as ea}from"./tree-IqZcruNX.js";import{t as ta}from"./x-BI1M8X_v.js";import{c as aa,i as ve,r as We}from"./download-B8XlLSji.js";import{f as we}from"./maps-CqKCrVZ8.js";import{n as na}from"./markdown-renderer-D0ROu8n3.js";import{u as sa}from"./toDate-BqKH-Jd9.js";import{a as M,c as ne,p as Ke,r as Ge,t as Je}from"./dropdown-menu-CJ-Wwa2I.js";import{t as Ne}from"./copy-CkudG0Ej.js";import{t as ke}from"./download-DBW9RXtT.js";import{t as ra}from"./eye-off-vwi9L975.js";import{a as ia,i as Ye,n as Ze,r as la,t as oa}from"./file-icons-BdaBiPvr.js";import{t as Qe}from"./file-plus-corner-lLQw9OnR.js";import{t as Xe}from"./file-DzHkbIdO.js";import{t as ca}from"./link-Cf10mh3t.js";import{n as Ce,t as da}from"./spinner-C5JoisA7.js";import{t as et}from"./plus-dVmh0yTy.js";import{t as tt}from"./refresh-cw-CHAHPgkx.js";import{t as ma}from"./save-8fSvKYJT.js";import{t as ha}from"./trash-2-CAoNMkjq.js";import{t as pa}from"./triangle-alert-qZo1ox6x.js";import{i as fa,n as xa,t as ua}from"./es-2S6JXj4o.js";import"./dist-BNC_tnlW.js";import"./dist-CXLJUPFl.js";import"./dist-CQqv2gQL.js";import"./dist-8UD0A5sU.js";import"./dist-apDpadc4.js";import{t as A}from"./use-toast-Hc8CXlvz.js";import{t as Fe}from"./paths-D2lG83Oh.js";import"./session-CXChHxAw.js";import"./Combination-CBJmtdux.js";import{t as T}from"./tooltip-CNmaER6z.js";import"./purify.es-BBn8CPhf.js";import"./dates-BcvJrESI.js";import{o as ga}from"./alert-dialog-DbQ_TZC7.js";import{t as at}from"./context-CRmPPhx9.js";import"./popover-JNsSzROl.js";import{n as nt}from"./ImperativeModal-b5nJtLod.js";import{r as ja}from"./errors-0IrrdfSG.js";import{n as ya}from"./blob-DgooIGjS.js";import"./vega-loader.browser-BJ9oKrvH.js";import"./defaultLocale-CuYNS33t.js";import"./defaultLocale-CGfP-Ye3.js";import{t as re}from"./copy-f2iEg0yL.js";import{t as ba}from"./copy-icon-Cu7az85f.js";import{n as va}from"./multi-map-x_GQgXMS.js";import{n as wa,t as Na}from"./alert-DkRmN0_B.js";import{n as st}from"./error-banner-CAuK5DPN.js";import{n as _e}from"./useAsyncData-a8f2Q_nk.js";import{a as ka,o as rt,t as Ca,u as Fa}from"./command-B7XhH0hz.js";import"./chunk-5FQGJX7Z-DEi7JZeU.js";import"./katex-0Z75JF53.js";import"./html-to-image-BYwkVvZl.js";import{o as _a}from"./focus-BjrLbkmu.js";import{a as Sa}from"./renderShortcut-BSq2vc9J.js";import{t as Pa}from"./bundle.esm-cfPbrCwe.js";import{t as Da}from"./useAddCell-CKoCjXpL.js";import{a as za,c as Se,d as Pe,l as it,u as lt}from"./components-CMr3IGTz.js";import{t as Oa}from"./empty-state-qEnkddw9.js";import{t as De}from"./formatting-CgyD0Rtn.js";import{a as Ma,i as $a,n as ot,r as ct,t as dt}from"./components-BtpAwxaG.js";import{n as mt,t as Ra}from"./marimo-icons-D5FuIsqO.js";import{t as Ta}from"./links-XdsYEk97.js";var Aa=ae("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),ht=ae("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),pt=ae("list-tree",[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]]),Ea=ae("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),Ia=ae("square-play",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}]]),ft=ae("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),z=Re(Mt(),1),La=te(),a=Re(Vt(),1);const xt=t=>{let e=(0,La.c)(17),{filename:n,filenameIcon:i,onBack:r,onRefresh:s,onDownload:c,actions:o}=t,h;e[0]===r?h=e[1]:(h=r&&(0,a.jsx)(T,{content:"Back to file list",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:r,children:(0,a.jsx)(Ue,{className:"h-4 w-4"})})}),e[0]=r,e[1]=h);let l;e[2]!==n||e[3]!==i?(l=n?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate",children:[i,n]}):(0,a.jsx)("span",{className:"flex-1"}),e[2]=n,e[3]=i,e[4]=l):l=e[4];let f;e[5]===s?f=e[6]:(f=s&&(0,a.jsx)(T,{content:"Refresh",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:s,children:(0,a.jsx)(tt,{className:"h-3.5 w-3.5"})})}),e[5]=s,e[6]=f);let j;e[7]===c?j=e[8]:(j=c&&(0,a.jsx)(T,{content:"Download",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:c,children:(0,a.jsx)(ke,{className:"h-3.5 w-3.5"})})}),e[7]=c,e[8]=j);let y;e[9]!==o||e[10]!==f||e[11]!==j?(y=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[f,o,j]}),e[9]=o,e[10]=f,e[11]=j,e[12]=y):y=e[12];let p;return e[13]!==h||e[14]!==l||e[15]!==y?(p=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[h,l,y]}),e[13]=h,e[14]=l,e[15]=y,e[16]=p):p=e[16],p};var Ba=100*1024*1024;function Va(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}const Ha=({entry:t,namespace:e,onBack:n})=>{let{locale:i}=at(),r=Va(t.path),s=t.mimeType||"text/plain",c=pe(s),o=c&&t.size>Ba&&t.size>0,{data:h,isPending:l,error:f,refetch:j}=_e(async()=>{if(o)return null;let x=await ye.request({namespace:e,path:t.path,preview:!c});if(x.error)throw Error(x.error);if(!x.url)throw Error("No URL returned");if(c)return{type:"media",url:x.url};let b=await fetch(x.url);if(!b.ok)throw Error(`Failed to fetch preview: ${b.statusText}`);return{type:"text",content:await b.text()}},[e,t.path,c,o]),y=(0,z.useCallback)(async()=>{try{let x=await ye.request({namespace:e,path:t.path});if(x.error){A({title:"Download failed",description:x.error,variant:"danger"});return}x.url&&ve(x.url,x.filename??r)}catch(x){ge.error("Failed to download storage entry",x),A({title:"Download failed",description:String(x),variant:"danger"})}},[e,t.path,r]),p=(0,a.jsx)(xt,{filename:r,filenameIcon:Ye(r),onBack:n,onDownload:y}),m=({includeMime:x=!1})=>(0,a.jsxs)("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs",children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Path"}),(0,a.jsxs)("div",{className:"truncate flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-mono text-[11px]",children:t.path}),(0,a.jsx)(ba,{value:t.path,className:"h-3 w-3"})]}),x&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),x&&(0,a.jsx)("span",{children:s}),t.size>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Size"}),(0,a.jsx)("span",{children:De(t.size,i)})]}),t.lastModified!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Modified"}),(0,a.jsx)("span",{children:new Date(t.lastModified*1e3).toLocaleString()})]})]});return o?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,m({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",De(t.size,i),")."]})]}):l?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,m({}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24",children:[(0,a.jsx)(Ce,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):f?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,m({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",f.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)(R,{variant:"secondary",size:"xs",onClick:j,children:[(0,a.jsx)(tt,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):h?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,m({}),(0,a.jsx)(Ve,{mimeType:s,contents:h.type==="text"?h.content:void 0,mediaSource:h.type==="media"?{url:h.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,m({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(Xe,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var Ua=new Set(["http","file","in-memory"]);function ze(t){return JSON.stringify(t).slice(1,-1)}const qa=[{id:"read-file",label:"Insert read snippet",icon:Qt,getCode:t=>{if(t.entry.kind==="directory")return null;let e=ze(t.entry.path);return t.backendType==="obstore"?`_data = ${t.variableName}.get("${e}").bytes()
|
|
2
2
|
_data`:`_data = ${t.variableName}.cat_file("${e}")
|
|
3
3
|
_data`}},{id:"download-file",label:"Insert download snippet",icon:ca,getCode:t=>{if(t.entry.kind==="directory")return null;let e=ze(t.entry.path);if(t.backendType==="obstore")return Ua.has(t.protocol)?null:`from datetime import timedelta
|
|
4
4
|
from obstore import sign
|