PageSourceSearch

https://leap-c-leap-c.hf.space/assets/useInstallPackage-DEHK-C20.js

js leap-c-leap-c.hf.space collected 2026-10-03 17:04:30 UTC 2,192 bytes, 1 lines download raw bytes

1import{s as l}from"./chunk-LvLJmgfZ.js";import{p as x}from"./useEvent-D91BmmQi.js";import{t as k}from"./react-Bj1aDYRI.js";import{_ as v}from"./useEventListener-BakX-tnw.js";import{t as f}from"./jsx-runtime-PbYoItBR.js";import{r as j}from"./requests-KshNNAOp.js";import{t as n}from"./use-toast-BH8bU9Xf.js";import{t as o}from"./kbd-BCXa3Ocm.js";const y=x(null),m="packages-install-input",p=()=>{requestAnimationFrame(()=>{let e=document.getElementById(m);e&&e.focus()})},P=e=>{e.openApplication("packages"),p()};var a=l(f(),1);const g=(e,t)=>{n(t?{title:"Failed to add package",description:t,variant:"danger"}:{title:"Package added",description:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{children:["The package ",(0,a.jsx)(o,{className:"inline",children:e})," and its dependencies has been added to your environment."]}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},N=(e,t)=>{n(t?{title:"Failed to upgrade package",description:t,variant:"danger"}:{title:"Package upgraded",description:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{children:["The package ",(0,a.jsx)(o,{className:"inline",children:e})," has been upgraded."]}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},q=(e,t)=>{n(t?{title:"Failed to remove package",description:t,variant:"danger"}:{title:"Package removed",description:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{children:["The package ",(0,a.jsx)(o,{className:"inline",children:e})," has been removed from your environment."]}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})};var F=l(k(),1);function S(){let[e,t]=(0,F.useState)(!1),{addPackage:h}=j();return{loading:e,handleInstallPackages:async(d,r)=>{t(!0);try{for(let[s,i]of d.entries()){let c=await h({package:i});c.success?g(i):g(i,c.error),s<d.length-1&&await new Promise(u=>setTimeout(u,1e3))}r==null||r()}catch(s){v.error(s)}finally{t(!1)}}}}export{p as a,m as i,q as n,P as o,N as r,y as s,S as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.