PageSourceSearch

https://molab.marimo.io/_next/static/immutable/chunks/2lnb_ey1x20p0.js

js marimo.io collected 2026-10-02 02:19:48 UTC 34,023 bytes, 4 lines download raw bytes

1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="4f0eb114-dcdc-604d-2d32-5b11602d654f")}catch(e){}}();
2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,758602,756372,e=>{"use strict";var t=e.i(390833),n=e.i(645570),s=e.i(129381);e.i(116233);var o=e.i(714359),r=e.i(111541),i=e.i(340904),a=e.i(181241),l=e.i(471009),d=e.i(270205),c=e.i(552310),u=e.i(998869),h=e.i(642597),p=e.i(239118),m=e.i(801685);let x=(0,m.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);var g=e.i(448549),b=e.i(358204);let v=(0,m.default)("save-off",[["path",{d:"M13 13H8a1 1 0 0 0-1 1v7",key:"h8g396"}],["path",{d:"M14 8h1",key:"1lfen6"}],["path",{d:"M17 21v-4",key:"1yknxs"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.41 20.41A2 2 0 0 1 19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 .59-1.41",key:"1t4vdl"}],["path",{d:"M29.5 11.5s5 5 4 5",key:"zzn4i6"}],["path",{d:"M9 3h6.2a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V15",key:"24cby9"}]]);var f=e.i(292920),j=e.i(432668),k=e.i(570644),y=e.i(757086),w=e.i(474054),N=e.i(62554),C=e.i(352788),S=e.i(932980),T=e.i(318234),I=e.i(535822),A=e.i(632137),P=e.i(102097);let E={sky:{track:"bg-[var(--sky-3)]",trackActive:"bg-[var(--sky-9)]",handle:"bg-[var(--sky-9)] border-[var(--sky-8)]",handleActive:"bg-[var(--sky-10)] scale-110",text:"text-[var(--sky-11)]",badge:"bg-[var(--sky-2)] text-[var(--sky-11)] border-[var(--sky-6)]"},jade:{track:"bg-[var(--jade-3)]",trackActive:"bg-[var(--jade-9)]",handle:"bg-[var(--jade-9)] border-[var(--jade-8)]",handleActive:"bg-[var(--jade-10)] scale-110",text:"text-[var(--jade-11)]",badge:"bg-[var(--jade-3)] text-[var(--jade-11)] border-[var(--jade-6)]"}};function D(e){return e.values.length<=1?(0,t.jsx)(R,{...e}):(0,t.jsx)(F,{...e})}function R({values:e,value:n,label:s,unit:o="",color:r,disabled:i=!1}){let a=E[r],l=e[0]??n;return(0,t.jsx)("div",{className:(0,A.cn)("space-y-3",i&&"cursor-not-allowed opacity-50"),"data-disabled":i,children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("label",{className:`text-sm font-semibold ${a.text}`,children:s}),(0,t.jsxs)("span",{className:`rounded-full border px-3 py-1 text-xs font-medium ${a.badge}`,children:[l,o]})]})})}function F({values:e,value:n,onChange:s,label:o,unit:r="",color:i,disabled:a=!1}){let l=(0,w.useRef)(null),d=e.indexOf(n),c=d>=0?d:function(e,t){let n=0,s=Math.abs(t-e[0]);for(let o=1;o<e.length;o++){let r=Math.abs(t-e[o]);r<s&&(n=o,s=r)}return n}(e,n),u=e.length-1,h=(0,P.useRanger)({getRangerElement:()=>l.current,values:[c],min:0,max:u,stepSize:1,onChange:t=>{let n=t.sortedValues[0];void 0!==n&&s(e[n])}}),p=E[i];return(0,t.jsxs)("div",{className:(0,A.cn)("space-y-3",a&&"cursor-not-allowed opacity-50"),"data-disabled":a,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("label",{className:`text-sm font-semibold ${p.text}`,children:o}),(0,t.jsxs)("span",{className:`rounded-full border px-3 py-1 text-xs font-medium ${p.badge}`,children:[n,r]})]}),(0,t.jsxs)("div",{ref:l,className:"relative h-3 w-full cursor-pointer",children:[(0,t.jsx)("div",{className:`absolute inset-0 -mx-2 rounded-full ${p.track}`}),(0,t.jsx)("div",{className:`absolute -mx-2 h-full rounded-full ${p.trackActive} shadow-sm`,style:{width:`${c/u*100}%`}}),e.map((e,n)=>(0,t.jsx)("div",{className:`absolute top-1/2 h-2 w-2 -translate-y-1/2 rounded-full transition-all duration-200 ${n<=c?"bg-white shadow-md":"bg-gray-300"}`,style:{left:`${n/u*100}%`,transform:"translate(-50%, -50%)"}},e)),h.handles().map((e,n)=>(0,t.jsx)("button",{onKeyDown:e.onKeyDownHandler,onMouseDown:e.onMouseDownHandler,onTouchStart:e.onTouchStart,role:"slider","aria-valuemin":h.options.min,"aria-valuemax":h.options.max,"aria-valuenow":e.value,className:`absolute top-1/2 z-10 h-6 w-6 -translate-y-1/2 cursor-pointer rounded-full border-2 outline-none transition-all duration-200 ease-out ${p.handle}hover:${p.handleActive}active:${p.handleActive}focus:ring-4 focus:ring-opacity-30 ${"sky"===i?"focus:ring-[var(--sky-7)]":"focus:ring-[var(--jade-7)]"}`,style:{left:`${h.getPercentageForValue(e.value)}%`,transform:"translate(-50%, -50%)",zIndex:e.isActive?"1":"0"},children:(0,t.jsx)("div",{className:"absolute inset-0.5 rounded-full bg-white opacity-20"})},n))]}),(0,t.jsxs)("div",{className:"flex justify-between text-xs font-medium text-gray-500",children:[(0,t.jsxs)("span",{children:[e[0],r]}),(0,t.jsxs)("span",{children:[e[e.length-1],r]})]})]})}var O=e.i(283261),L=e.i(519162),M=e.i(324547),U=e.i(152236);function B({size:e=56,className:n}){return(0,t.jsx)("div",{role:"status","aria-label":"Loading",children:(0,t.jsx)("span",{className:(0,U.cn)("block","leaf-spinner",n),style:{fontSize:e},"aria-hidden":"true",children:"🍃"})})}
2var V=e.i(624688),G=e.i(672908),$=e.i(437472),_=e.i(113968),H=e.i(826234),z=e.i(981831),K=e.i(525009),X=e.i(847741),W=e.i(45790),Y=e.i(403601),q=e.i(34897),Q=e.i(69989),J=e.i(432245),Z=e.i(962942),ee=e.i(409259);let et={github:"View on GitHub",gist:"View Gist on GitHub",colab:"View on Colab",drive:"View on Google Drive"};function en({type:e,url:n}){let s=et[e],o="github"===e||"gist"===e?ee.GitHubIcon:Z.ExternalLinkIcon;return(0,t.jsx)(a.Tooltip,{content:s,asChild:!0,children:(0,t.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer","aria-label":s,className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:(0,t.jsx)(o,{className:"h-4 w-4"})})})}e.s(["ExternalSourceLink",0,en,"Filename",0,function({filename:e}){return(0,t.jsx)("h1",{className:"text-md line-clamp-3 break-words font-semibold",title:e,children:e})},"GitHubOrgAvatar",0,function({org:e}){return(0,t.jsx)(a.Tooltip,{content:e,children:(0,t.jsxs)(J.Avatar,{className:"hidden h-6 w-6 flex-shrink-0 sm:block md:h-8 md:w-8",children:[(0,t.jsx)(J.AvatarImage,{src:`https://github.com/${e}.png?size=60`,alt:e}),(0,t.jsx)(J.AvatarFallback,{className:"text-2xs",children:e.slice(0,2).toUpperCase()})]})})}],756372);var es=e.i(543598),eo=e.i(721841),er=e.i(651702);let ei=(0,er.createServerReference)("7f428422ef9391e05c795ab53a219e743982e22489",er.callServer,void 0,er.findSourceMapURL,"duplicateNotebook");var ea=e.i(777573),el=e.i(278130),ed=e.i(707165),ec=e.i(215571),eu=e.i(183144),eh=e.i(170270),ep=e.i(16988),em=e.i(840301);function ex({open:e,onOpenChange:n,url:s,notebookId:o}){let[r,i]=(0,w.useState)(!1),a=(0,N.useTrackEvent)(),d=async()=>{a("share.click",{item:"copy-follow-link",location:"notebook_header",notebook_path:`/notebooks/${o}`}),await (0,em.copyToClipboard)(s),i(!0),(0,l.toast)({title:"Link copied",description:"Follow-along link copied to clipboard"}),setTimeout(()=>i(!1),2e3)};return(0,t.jsx)(ec.Dialog,{open:e,onOpenChange:n,children:(0,t.jsxs)(ec.DialogContent,{className:"sm:max-w-[560px]",children:[(0,t.jsx)(ec.DialogTitle,{children:"Let someone follow along"}),(0,t.jsx)(ec.DialogDescription,{children:"Anyone with this link can watch your notebook live while it's running — treat it like a secret. It stops working once the session ends."}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eu.Input,{readOnly:!0,value:s,onFocus:e=>e.currentTarget.select(),className:"flex-1"}),(0,t.jsxs)(z.Button,{type:"button",onClick:d,className:"shrink-0 gap-1.5",children:[r?(0,t.jsx)(eh.CheckIcon,{className:"h-4 w-4"}):(0,t.jsx)(ep.CopyIcon,{className:"h-4 w-4"}),r?"Copied":"Copy"]})]})]})})}var eg=e.i(465440),eb=e.i(817353);function ev({open:e,onOpenChange:n}){return(0,t.jsx)(eb.AlertDialog,{open:e,onOpenChange:n,children:(0,t.jsxs)(eb.AlertDialogContent,{children:[(0,t.jsxs)(eb.AlertDialogHeader,{children:[(0,t.jsx)(eb.AlertDialogTitle,{children:"Notebook stopped"}),(0,t.jsx)(eb.AlertDialogDescription,{children:"Your sandbox stopped responding and was reclaimed. Would you like to relaunch it?"})]}),(0,t.jsxs)(eb.AlertDialogFooter,{children:[(0,t.jsx)(eb.AlertDialogCancel,{onClick:()=>n(!1),children:"Not now"}),(0,t.jsx)(eb.AlertDialogAction,{onClick:()=>{n(!1),window.location.reload()},children:"Relaunch"})]})]})})}var ef=e.i(308005),ej=e.i(297314);let ek=["Scheduling sandbox ...","Installing dependencies ...","Unfurling cells ...","Wiring up your graph ...","Booting up compute ...","Letting data flow ..."];function ey({error:e}){return(0,t.jsx)(I.ErrorCard,{title:"Failed to load notebook",message:e})}function ew({error:e,blocked:n}){return n?(0,t.jsx)(C.AccountRestrictedCard,{}):(0,t.jsx)(ey,{error:e})}function eN(){return(0,t.jsx)(I.ErrorCard,{title:"Notebook stopped",message:"Your sandbox stopped responding and was reclaimed. Relaunch it to keep working.",actions:(0,t.jsx)(z.Button,{onClick:()=>window.location.reload(),children:"Relaunch"})})}function eC({error:e,blocked:n,notebookNonce:s,launchPromise:o,title:r,sandboxIdRef:i,onSandboxReady:a}){return e?(0,t.jsx)(ew,{error:e,blocked:n}):(0,t.jsx)(I.ClientErrorBoundary,{fallback:e=>(0,t.jsx)(ey,{error:e.message}),children:(0,t.jsx)(w.Suspense,{fallback:(0,t.jsx)(eS,{messages:ek}),children:(0,t.jsx)(e_,{launchPromise:o,title:r,sandboxIdRef:i,onSandboxReady:a})})},s)}function eS({messages:e}){return(0,t.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,t.jsx)(B,{}),(0,t.jsx)("p",{className:"text-muted-foreground",children:(0,t.jsx)(M.CyclingText,{texts:e,delay:3e3})})]})})}function eT(){return(0,t.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,t.jsxs)("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-6 text-center",children:[(0,t.jsx)("h2",{className:"mb-2 font-semibold text-gray-800",children:"Preview Not Available"}),(0,t.jsx)("p",{className:"text-gray-600",children:"This notebook cannot be previewed at the moment."})]})})}function eI({gpuCount:e,maxGpuCount:n,onDecrease:s,onIncrease:o,disabled:r}){return(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)(a.Tooltip,{content:"Decrease GPU count",children:(0,t.jsx)(z.Button,{variant:"outline",size:"icon",onClick:s,disabled:r,children:(0,t.jsx)(x,{className:"h-4 w-4"})})}),(0,t.jsx)("div",{className:"flex items-center gap-1 rounded-md bg-[var(--orange-3)] px-3 py-1 text-sm font-medium text-[var(--orange-11)]",children:(0,t.jsxs)("span",{children:[e," ",1===e?"GPU":"GPUs"]})}),(0,t.jsx)(a.Tooltip,{content:"Increase GPU count",children:(0,t.jsx)(z.Button,{variant:"outline",size:"icon",onClick:o,disabled:r||e>=n,children:(0,t.jsx)(b.Plus,{className:"h-4 w-4"})})})]})}function eA(){return(0,t.jsx)("h3",{className:"mb-6 bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-lg font-bold text-transparent",children:"Configure Resources"})}function eP({plan:e,gpu:n,gpuCount:s,onGpuChange:r,onGpuCountDecrease:a,onGpuCountIncrease:l,disabled:d}){return e.gpu&&0!==e.gpu.length?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(o.Label,{children:"GPUs"}),(0,t.jsxs)(i.Select,{value:n||"_none_",onValueChange:e=>{r("_none_"===e?null:e)},children:[(0,t.jsx)(i.SelectTrigger,{disabled:d,children:(0,t.jsx)(i.SelectValue,{placeholder:"Select GPU"})}),(0,t.jsxs)(i.SelectContent,{children:[(0,t.jsx)(i.SelectItem,{value:"_none_",children:"None"}),(0,t.jsx)(i.SelectSeparator,{}),e.gpu.map(e=>(0,t.jsx)(i.SelectItem,{value:e,children:(0,Y.formatGpuLabel)(e)},e))]})]}),n&&e.maxGpuCount>1&&(0,t.jsx)(eI,{gpuCount:s,maxGpuCount:e.maxGpuCount,onDecrease:a,onIncrease:l,disabled:d})]}):null}function eE({kind:e}){if(!e)return null;let n="workspace"===e?(0,t.jsx)(j.default,{href:"/notebooks",className:"hidden shrink-0 lg:inline",children:(0,t.jsx)("span",{className:"text-muted-foreground transition-colors hover:text-foreground",children:"Your notebooks"})}):(0,t.jsx)(j.default,{href:`/notebooks?tab=${ed.NOTEBOOKS_TAB.PUBLIC}`,className:"hidden shrink-0 lg:inline",children:(0,t.jsx)("span",{className:"text-muted-foreground transition-colors hover:text-foreground",children:"Examples"})});return(0,t.jsxs)(t.Fragment,{children:[n,(0,t.jsx)("span",{className:"hidden lg:inline",children:"/"})]})}function eD({title:e,breadcrumb:n,onTitleChange:s,sourceLink:o,isTrusted:r,showTrustBadge:i,className:a}){return(0,t.jsxs)(_.HeaderTitleContainer,{className:a,children:[(0,t.jsx)(eE,{kind:n}),s?(0,t.jsx)(O.EditableHeader,{initialText:e,onSave:s,updateTitle:!0,className:"min-w-0 break-all text-xs font-semibold leading-tight sm:text-sm md:text-base"}):(0,t.jsx)("h1",{className:"line-clamp-2 min-w-0 break-all font-semibold leading-tight",children:e}),o&&(0,t.jsx)(en,{type:o.type,url:o.url}),i&&!r&&(0,t.jsx)(G.UntrustedNotebookBadge,{})]})}function eR(e,t,o){let r=(0,N.useTrackEvent)(),i=(0,k.useSearchParams)(),{isLoaded:a,isSignedIn:l}=(0,n.useAuth)(),d=(0,S.useSignInModal)();return(0,s.useEvent)(async n=>{if(r("fork.click",{location:o,notebook_path:t?`/notebooks/${t}`:void 0,ref:i.get("ref")??void 0}),!e)return;if(a&&!l)return void d();let s=await e(n);s.success||W.Logger.error("Failed to fork notebook",{notebookId:t,error:s.error}),(0,L.toastServerActionFailure)(s)})}function eF(e,t){let n=(0,s.useEvent)(async()=>{let t=await e();t.success?(0,l.toast)({title:"Synced to your workspace"}):(0,L.toastServerActionFailure)(t)});if(e)return[{key:"sync",label:"Sync to workspace",description:"Add this notebook to your workspace, linked to the upstream source",icon:d.BookmarkIcon,onSelect:n,untrustedConfirm:(0,G.untrustedConfirmConfig)(G.SYNC_CONFIRM,t)}]}function eO({notebookId:e,hasOrgAccess:n,isEphemeral:s,sourceTitle:o,onForkNotebook:r,specsProps:i,viewModeDropdownProps:a,secondaryActions:l,extraShareItems:d,isTrusted:c,scriptMetadata:u}){let h=(0,k.useRouter)(),[p,m]=(0,w.useTransition)(),x=async()=>{e&&m(async()=>{let t=await ei({sourceNotebookId:e});t.success?h.push(`/notebooks/${t.data.targetNotebookId}`):(0,L.toastServerActionFailure)(t)})},g=eR(r,e,"notebook_header"),b=function(e){let{isEphemeral:t,hasOrgAccess:n,onForkNotebook:s,sourceTitle:o,onForkClick:r,secondaryActions:i,isTrusted:a}=e;if(t){let e;if(!s)return;return{kind:"save-copy",defaultTitle:(e=(o??"").trim())?e.endsWith("(Fork)")?e:`${e} (Fork)`:"Untitled (Fork)",onAction:e=>
2r(e),secondaryActions:i?.length?i:void 0,showUntrustedNotice:!a}}return n?{kind:"duplicate",onAction:e.onDuplicate,disabled:e.duplicateDisabled}:s?{kind:"fork",onAction:()=>r(),untrustedConfirm:(0,G.untrustedConfirmConfig)(G.FORK_CONFIRM,a)}:void 0}({isEphemeral:s,hasOrgAccess:n,onForkNotebook:r,onDuplicate:x,duplicateDisabled:p||!e,sourceTitle:o,onForkClick:g,secondaryActions:l,isTrusted:c}),v=a&&n?i:void 0;return(0,t.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-2",children:[a&&v?(0,t.jsxs)("div",{className:"inline-flex items-center gap-0 sm:rounded-md sm:border sm:bg-background",children:[(0,t.jsx)(eo.ViewModeDropdown,{...a,triggerClassName:"sm:rounded-r-none"}),(0,t.jsx)("div",{className:"hidden sm:block",children:(0,t.jsx)(w.Suspense,{children:(0,t.jsx)(eM,{...v,variant:"attached"})})})]}):(0,t.jsxs)(t.Fragment,{children:[a&&(0,t.jsx)(eo.ViewModeDropdown,{...a}),(0,t.jsx)("div",{className:"hidden sm:block",children:(0,t.jsx)(w.Suspense,{children:n&&i&&(0,t.jsx)(eM,{...i})})})]}),(0,t.jsx)(H.ShareForkButtons,{shareItems:[...eL({notebookId:e,includeAppUrl:!0}),...d??[]],primaryAction:b,scriptMetadata:u,analytics:{location:s?"server_page":n?"notebook_header":"preview_header",notebookPath:e?`/notebooks/${e}`:void 0}}),(0,t.jsx)(_.ToolbarDivider,{className:"hidden sm:block"}),(0,t.jsx)(el.NotebooksHeaderActions,{})]})}function eL({notebookId:e,includeAppUrl:n=!1}){let s=async()=>{await (0,ea.copyNotebookUrl)(e?{kind:"notebook",notebookId:e}:{kind:"page"})},o=async()=>{await (0,ea.copyBadgeUrlAsMarkdown)(e?{kind:"notebook",notebookId:e}:{kind:"page"})},r=[{key:"copy-notebook-url",label:"Copy Notebook URL",icon:h.LinkIcon,onSelect:s},{key:"copy-badge",label:"Copy Badge",icon:f.ShieldIcon,onSelect:o,rightContent:(0,t.jsx)(V.MolabShield,{className:"ml-3 w-24"})}];return n&&e&&r.push({key:"copy-app-url",label:"Copy App URL",icon:g.PlaySquareIcon,onSelect:async()=>{await (0,ea.copyAppUrl)(e)}}),r}function eM({plan:e,onSaveAndRestart:n,specs:s,onSpecsChange:o,variant:i="default"}){let l=(0,w.use)(s),[d,h]=(0,w.useState)(l.cpu),[m,x]=(0,w.useState)(l.memory),[g,b]=(0,w.useState)(l.gpu),[v,f]=(0,w.useState)(l.gpuCount),[j,k]=(0,w.useTransition)();(0,w.useEffect)(()=>{h(l.cpu),x(l.memory),b(l.gpu),f(l.gpuCount)},[l.cpu,l.memory,l.gpu,l.gpuCount]);let y=async()=>{k(async()=>{let e=await n({cpu:d,memory:m,gpu:g,gpuCount:v});e.success&&o?.(e),(0,L.toastServerActionFailure)(e)})},N=g?(0,Y.formatGpuLabel)(g).replace(/\s*\([^)]*\)/g,""):null,C="attached"===i,S=(0,t.jsxs)(z.Button,{variant:C?"ghost":"outline",size:"sm",className:C?"h-8 w-8 shrink-0 rounded-l-none border-l p-0":"h-8 shrink-0 gap-1.5 px-2.5 text-muted-foreground",title:"Configure compute","aria-label":`Configure compute: ${d} CPU, ${m} GiB${N?`, ${N}`:""}`,type:"button",children:[(0,t.jsx)(u.CpuIcon,{className:"h-4 w-4 shrink-0"}),!C&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"hidden text-xs font-medium lg:inline",children:[d," CPU · ",m," GiB",N?` \xb7 ${N}`:""]}),(0,t.jsx)("span",{className:"text-xs font-medium lg:hidden",children:"Compute"}),(0,t.jsx)(c.ChevronDownIcon,{className:"h-3 w-3 shrink-0 opacity-60"})]})]});return(0,t.jsxs)(r.Popover,{children:[(0,t.jsx)(r.PopoverTrigger,{asChild:!0,children:S}),(0,t.jsx)(r.PopoverContent,{align:"end",children:(0,t.jsx)("div",{className:"space-y-6 px-2",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(eA,{}),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(D,{values:e.cpu,value:d,onChange:h,label:"CPU Cores",unit:" cores",color:"sky",disabled:j}),(0,t.jsx)(D,{values:e.memory,value:m,onChange:x,label:"Memory",unit:" GiB",color:"jade",disabled:j}),(0,t.jsx)(eP,{plan:e,gpu:g,gpuCount:v,onGpuChange:e=>{b(e),e&&0===v?f(1):e||f(0)},disabled:j,onGpuCountDecrease:()=>{v<=1?(b(null),f(0)):f(v-1)},onGpuCountIncrease:()=>f(Math.min(e.maxGpuCount,v+1))})]}),(0,t.jsx)(a.Tooltip,{content:"Apply configuration changes and restart notebook",children:(0,t.jsx)(z.Button,{onClick:y,disabled:j,className:"mt-6 w-full rounded-md bg-primary py-2 font-medium text-primary-foreground shadow-sm hover:bg-primary/90",size:"sm",children:j?(0,t.jsx)(p.Loader2Icon,{className:"h-4 w-4 animate-spin"}):"Save and restart"})})]})})})]})}function eU({notebookId:e,title:n,hasOrgAccess:s,breadcrumb:o,isEphemeral:r,onTitleChange:i,onForkNotebook:l,specsProps:d,sourceLink:c,viewModeDropdownProps:u,secondaryActions:h,extraShareItems:p,isTrusted:m,scriptMetadata:x,showTrustBadge:g}){let b=s&&!r?i:void 0,v=o??(s?"workspace":"examples");return(0,t.jsxs)(_.ProductHeaderShell,{neverShadow:!0,children:[(0,t.jsx)(_.ProductHeaderLogo,{href:"/notebooks"}),(0,t.jsx)(eD,{title:n,breadcrumb:"none"===v?void 0:v,onTitleChange:b,sourceLink:c,isTrusted:m,showTrustBadge:g}),(0,t.jsx)(a.TooltipProvider,{delayDuration:300,children:(0,t.jsx)(eO,{notebookId:e,hasOrgAccess:s,isEphemeral:r,sourceTitle:n,onForkNotebook:l,specsProps:d,viewModeDropdownProps:u,secondaryActions:h,extraShareItems:p,isTrusted:m,scriptMetadata:x})})]})}function eB({notebookUrl:e,title:n,loadingComponent:s}){let o=(0,k.useSearchParams)();return(0,t.jsx)("div",{className:"flex-1",children:e?(0,t.jsx)(T.BetterIframe,{src:(0,U.addQueryParams)(e,o),title:n,sandbox:$.SandboxPermissions.INTERACTIVE_APP,timeout:6e4,containerClassName:"h-full w-full",loadingComponent:s,enableRetry:!0,allowFullScreen:!0}):(0,t.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,t.jsx)("p",{className:"text-muted-foreground",children:"Unable to load notebook"})})})}function eV({isLoading:e,error:n,notebookUrl:s,title:o,loadingMessages:r,isReadonly:i=!1}){return e?(0,t.jsx)(eS,{messages:r}):n?i&&n.includes("404")?(0,t.jsx)(eT,{}):(0,t.jsx)(ey,{error:n}):(0,t.jsx)(eB,{notebookUrl:s,title:o,loadingComponent:(0,t.jsx)(eS,{messages:r})})}async function eG(e){return(0,y.ofetch)("/api/notebook/launch",{method:"POST",body:{notebookId:e}})}
2function e$({initialLaunchPromise:e,keepAliveNotebookId:t}){let[o,r]=(0,w.useState)(0),[i,a]=(0,w.useState)(e),l=(0,w.useRef)(void 0),{id:d,error:c,blocked:u}=function(e){let[t,n]=(0,w.useState)(null),[s,o]=(0,w.useState)(null),[r,i]=(0,w.useState)(!1);return(0,w.useEffect)(()=>{let t=!1;return n(null),o(null),i(!1),(async()=>{try{let s=await e;if(t)return;if("error"===s.kind){o(s.message),i(s.code===K.ACCOUNT_BLOCKED_CODE);return}n(s.notebookId)}catch(e){if(t)return;W.Logger.error("Failed to launch notebook",{error:e}),o(e instanceof Error?e.message:"Failed to launch notebook")}})(),()=>{t=!0}},[e]),{id:t,error:s,blocked:r}}(i),{stopped:h,resetStopped:p,showShutdownModal:m,setShowShutdownModal:x}=function({notebookId:e,sandboxIdRef:t,hasError:s}){let{isSignedIn:o,getToken:r}=(0,n.useAuth)(),[i,a]=(0,w.useState)(!1),[l,d]=(0,w.useState)(!1),c=(0,w.useCallback)(()=>{a(!1),d(!1)},[]),u=(0,w.useCallback)(async()=>{if(!e)return;let n=null;try{n=await r({skipCache:!0})}catch(t){W.Logger.error("Failed to refresh session token",{notebookId:e,error:t});return}if(!n)return void W.Logger.warn("Failed to refresh session token. Session has expired",{notebookId:e});try{let s=await (0,y.ofetch)("/api/notebook/keep-alive",{method:"POST",body:{notebookId:e,sandboxId:t.current},headers:{Authorization:`Bearer ${n}`}});"gone"!==s.status||i||(W.Logger.warn("Notebook sandbox is gone. Stopping keep-alive.",{notebookId:e}),a(!0),d(!0))}catch(t){W.Logger.warn("Failed to keep notebook alive. Failed response.",{notebookId:e,error:t})}},[e,r,t,i]);return!function(e,t){var n,s;let o,{delayMs:r,whenVisible:i,disabled:a=!1}=t,l=(0,w.useRef)(()=>{});(0,w.useEffect)(()=>{l.current=e},[e]),(0,w.useEffect)(()=>{if(null===r||a)return;let e=setInterval(()=>{i&&"visible"!==document.visibilityState||l.current?.()},r);return()=>clearInterval(e)},[r,i,a]);let d="u">typeof document?document:{};n="visibilitychange",s=()=>{d?.visibilityState==="visible"&&i&&!a&&l.current?.()},o=(0,w.useRef)(s),(0,w.useEffect)(()=>{o.current=s},[s]),(0,w.useEffect)(()=>{let e=null!==d&&"object"==typeof d&&"current"in d?d.current:d;if(!e)return;let t=e=>o.current(e);return e.addEventListener(n,t,void 0),()=>{e.removeEventListener(n,t,void 0)}},[n,d,void 0])}(()=>void u(),{delayMs:3e4,disabled:!o||!e||!!s||i,whenVisible:!0}),{stopped:i,resetStopped:c,showShutdownModal:l,setShowShutdownModal:d}}({notebookId:t??d,sandboxIdRef:l,hasError:!!c});return{currentLaunchPromise:i,restart:(0,s.useEvent)(e=>{p(),r(e=>e+1),l.current=void 0,a(e)}),notebookNonce:o,sandboxIdRef:l,resolvedNotebookId:d,error:c,blocked:u,stopped:h,showShutdownModal:m,setShowShutdownModal:x}}function e_({launchPromise:e,title:n,sandboxIdRef:s,onSandboxReady:o}){let r=(0,w.use)(e);return"error"===r.kind?(0,t.jsx)(ew,{error:r.message,blocked:r.code===K.ACCOUNT_BLOCKED_CODE}):(0,t.jsx)(eH,{descriptor:r,title:n,sandboxIdRef:s,onSandboxReady:o})}function eH({descriptor:e,title:n,sandboxIdRef:s,onSandboxReady:o}){let{notebookUrl:r,error:i}=(0,q.useNotebookUrl)(e,s),{sandboxId:a,authToken:l}=e;if((0,w.useEffect)(()=>{a&&l&&o?.({sandboxId:a,authToken:l})},[a,l,o]),i)throw Error(i);return r?(0,t.jsx)(eB,{notebookUrl:r,title:n,loadingComponent:(0,t.jsx)(eS,{messages:ek})}):(0,t.jsx)(eS,{messages:ek})}let ez={github:"GitHub",gist:"GitHub",colab:"Google Colab",drive:"Google Drive"},eK={mirror:{shortText:"GitHub mirror — changes won't be saved.",longText:e=>`This notebook is mirrored from ${e}; changes won't be saved.`},notebook:{shortText:"Temporary session — changes won't be saved.",longText:()=>"This is a temporary server session; changes won't be saved."},wasm:{shortText:"Browser preview — changes won't be saved.",longText:()=>"This is a browser-only preview; changes won't be saved."}};function eX({source:e,variant:n="mirror"}){let s=e?ez[e]:"its source",{shortText:o,longText:r}=eK[n];return(0,t.jsxs)("div",{className:"flex items-center justify-center gap-x-2.5 border-b border-amber-200 bg-amber-50 px-4 py-2 text-sm sm:py-2.5",children:[(0,t.jsx)(v,{className:"h-4 w-4 flex-shrink-0 text-amber-700"}),(0,t.jsxs)("p",{className:"text-xs text-amber-800 sm:text-sm",children:[(0,t.jsx)("span",{className:"font-medium sm:hidden",children:o}),(0,t.jsx)("span",{className:"hidden font-medium sm:inline",children:r(s)}),(0,t.jsx)("span",{className:"hidden sm:inline",children:" Save a copy to your workspace to keep your edits."})]})]})}e.s(["EphemeralBanner",0,eX,"EphemeralNotebook",0,function({sourceNotebookId:e,title:n,inWorkspace:o,launchPromise:r,specsProps:i,onForkEphemeralNotebook:a,sourceLink:l,navHrefs:d,onSyncToWorkspace:c,bannerVariant:u,embedWasmUrl:h,isTrusted:p,scriptMetadata:m}){let x=(0,k.useRouter)(),{currentLaunchPromise:g,restart:b,notebookNonce:v,sandboxIdRef:f,resolvedNotebookId:j,error:y,blocked:N,stopped:C,showShutdownModal:S,setShowShutdownModal:T}
2=e$({initialLaunchPromise:r}),[I,A]=(0,w.useState)(Promise.resolve(i.specs)),P=(0,s.useEvent)(e=>{e.success&&(A(Promise.resolve(e.data.specs)),b(Promise.resolve(e.data.launch)))}),E={specs:I,plan:i.plan,onSaveAndRestart:async e=>j?i.onSaveAndRestart(j,e):Q.ServerActionResult.error("Notebook is still starting. Try again in a moment."),onSpecsChange:e=>P(e)},D=j?e=>a(j,e??""):void 0,R=d?.code,F=d?.wasm,O=d?{mode:"server",onPreview:()=>x.push((0,X.asRoute)(d.preview)),onCode:R?()=>x.push((0,X.asRoute)(R)):void 0,onRun:F?()=>x.push((0,X.asRoute)(F)):void 0,server:{signedIn:!0,onSelect:()=>{}}}:void 0,L=eF(o?void 0:c,p);return(0,t.jsxs)("div",{className:"flex h-screen flex-col",children:[(0,t.jsx)(eU,{notebookId:e,title:n,hasOrgAccess:!0,breadcrumb:o?"workspace":"none",isEphemeral:!0,onForkNotebook:D,specsProps:E,sourceLink:l,viewModeDropdownProps:O,secondaryActions:L,extraShareItems:h?[(0,es.embedShareItem)(h)]:void 0,isTrusted:p,scriptMetadata:m,showTrustBadge:!0}),(0,t.jsx)(eX,{source:l?.type,variant:u}),C?(0,t.jsx)(eN,{}):(0,t.jsx)(eC,{error:y,blocked:N,notebookNonce:v,launchPromise:g,title:n,sandboxIdRef:f}),(0,t.jsx)(ev,{open:S,onOpenChange:T})]})},"ErrorState",0,function({error:e}){return(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsxs)("div",{className:"max-w-md rounded-md border border-red-200 bg-red-50 p-6 text-center dark:border-red-900 dark:bg-red-950",children:[(0,t.jsx)("h2",{className:"mb-2 font-semibold text-red-800",children:"Error"}),(0,t.jsx)("p",{className:"text-red-600",children:e})]})})},"LoadingState",0,function(e){return(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,t.jsx)(B,{}),(0,t.jsx)("p",{className:"text-muted-foreground",children:(0,t.jsx)(M.CyclingText,{texts:e.messages,delay:3e3})})]})})},"NotebookHeader",0,eU,"NotebookViewer",0,eB,"PreviewUnavailableState",0,function(){return(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsxs)("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-6 text-center",children:[(0,t.jsx)("h2",{className:"mb-2 font-semibold text-gray-800",children:"Preview Not Available"}),(0,t.jsx)("p",{className:"text-gray-600",children:"This notebook cannot be previewed at the moment."})]})})},"ReadonlyNotebook",0,function({notebookId:e,title:n,notebookUrl:s,onForkNotebook:o,server:r,notebook:i,isTrusted:a,scriptMetadata:l}){let d=(0,k.useRouter)(),c=(0,S.useSignInModal)(),u=`/notebooks/${e}/server`,h=r?r.signedIn?{signedIn:!0,onSelect:()=>d.push((0,X.asRoute)(u))}:{signedIn:!1,onSelect:()=>c(u)}:void 0,{serverOption:p,onRunOnServer:m,confirmDialog:x}=(0,eo.useGuardedServerModeOption)(h,a,l),g=eR(o,e,"preview_banner");return(0,t.jsxs)("div",{className:"flex h-screen flex-col",children:[x,(0,t.jsx)(eU,{notebookId:e,title:n,hasOrgAccess:!1,onForkNotebook:o,notebook:i,viewModeDropdownProps:{mode:"preview",onPreview:()=>{},server:p},isTrusted:a,scriptMetadata:l,showTrustBadge:!1}),(0,t.jsx)(eg.PreviewBanner,{onFork:o?g:void 0,onRunOnServer:m,isTrusted:a,scriptMetadata:l}),(0,t.jsx)(eV,{isLoading:!1,error:null,notebookUrl:s,title:n,loadingMessages:["Loading..."],isReadonly:!0})]})},"SANDBOX_LOADING_MESSAGES",0,ek,"SandboxNotebook",0,function({notebookId:e,title:n,onTitleChange:o,specsProps:r,launchSandboxPromise:i,notebook:a}){let{currentLaunchPromise:l,restart:d,notebookNonce:c,sandboxIdRef:u,error:h,blocked:p,stopped:m,showShutdownModal:x,setShowShutdownModal:g}=e$({initialLaunchPromise:i,keepAliveNotebookId:e}),b=(0,s.useEvent)(()=>{d(eG(e))}),v=function(e){let t=(0,ej.useFlag)("followAlong"),[n,s]=(0,w.useState)(null),[o,r]=(0,w.useState)(!1),i=n?`${(0,X.molabURL)({notebookId:e})}/follow#sb=${n.sandboxId}&token=${encodeURIComponent(n.authToken)}`:"";return{onSandboxReady:s,shareItems:t&&n?[{key:"follow-along",label:"Let someone follow along",icon:ef.UsersIcon,description:"Share a live, read-only view while your notebook runs",onSelect:()=>r(!0)}]:void 0,dialogProps:{open:o,onOpenChange:r,url:i,notebookId:e}}}(e);return(0,t.jsxs)("div",{className:"flex h-screen flex-col",children:[(0,t.jsx)(eU,{notebookId:e,title:n,hasOrgAccess:!0,onTitleChange:o,notebook:a,specsProps:{...r,onSpecsChange:b},extraShareItems:v.shareItems,isTrusted:!0,showTrustBadge:!0}),m?(0,t.jsx)(eN,{}):(0,t.jsx)(eC,{error:h,blocked:p,notebookNonce:c,launchPromise:l,title:n,sandboxIdRef:u,onSandboxReady:v.onSandboxReady}
2),(0,t.jsx)(ev,{open:x,onOpenChange:g}),(0,t.jsx)(ex,{...v.dialogProps})]})},"TitleBreadcrumb",0,eE,"defaultShareItems",0,eL,"useSyncToWorkspaceSecondaryAction",0,eF],758602)},102097,(e,t,n)=>{e.e,function(e,t){"use strict";var n=function(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}(t);let s=e=>[...e].map(Number).sort((e,t)=>e-t),o={getPercentageForValue:(e,t,n)=>Math.max(0,Math.min(100,(e-t)/(n-t)*100)),getValueForClientX:(e,t,n,s)=>{let{left:o,width:r}=t;return(e-o)/r*(s-n)+n}};class r{sortedValues=[];rangerElement=null;constructor(e){this.setOptions(e)}setOptions(e){Object.entries(e).forEach(([t,n])=>{void 0===n&&delete e[t]}),this.options={debug:!1,tickSize:10,interpolator:o,onChange:()=>{},...e}}_willUpdate=()=>{let e=this.options.getRangerElement();this.rangerElement!==e&&(this.rangerElement=e)};getValueForClientX=e=>{let t,n={left:Math.ceil((t=this.rangerElement.getBoundingClientRect()).left),width:Math.ceil(t.width)};return this.options.interpolator.getValueForClientX(e,n,this.options.min,this.options.max)};getNextStep=(e,t)=>{let{min:n,max:s}=this.options;if("steps"in this.options){let{steps:n}=this.options,s=n.indexOf(e)+t;return s>=0&&s<n.length?n[s]:e}{let o=e+this.options.stepSize*t;return o>=n&&o<=s?o:e}};roundToStep=e=>{let{min:t,max:n}=this.options,s=t,o=n;if("steps"in this.options)this.options.steps.forEach(t=>{t<=e&&t>s&&(s=t),t>=e&&t<o&&(o=t)});else{let{stepSize:t}=this.options;for(;s<e&&s+t<e;)s+=t;o=Math.min(s+t,n)}return e-s<o-e?s:o};handleDrag=e=>{if(void 0===this.activeHandleIndex)return;let t="touchmove"===e.type?e.changedTouches[0].clientX:e.clientX,n=this.getValueForClientX(t),s=this.roundToStep(n);this.sortedValues=[...this.options.values.slice(0,this.activeHandleIndex),s,...this.options.values.slice(this.activeHandleIndex+1)],this.options.onDrag?this.options.onDrag(this):(this.tempValues=this.sortedValues,this.options.rerender())};handleKeyDown=(e,t)=>{let{values:n}=this.options;if(37===e.keyCode||39===e.keyCode){this.activeHandleIndex=t;let o=37===e.keyCode?-1:1,r=this.getNextStep(n[t],o),i=[...n.slice(0,t),r,...n.slice(t+1)];this.sortedValues=s(i),this.options.onChange&&this.options.onChange(this)}};handlePress=(e,t)=>{this.activeHandleIndex=t,this.options.rerender();let n=()=>{let{tempValues:e,handleDrag:t}=this;document.removeEventListener("mousemove",t),document.removeEventListener("touchmove",t),document.removeEventListener("mouseup",n),document.removeEventListener("touchend",n),this.sortedValues=s(e||this.options.values),this.options.onChange&&this.options.onChange(this),this.options.onDrag&&this.options.onDrag(this),this.activeHandleIndex=void 0,this.tempValues=void 0,this.options.rerender()},{handleDrag:o}=this;document.addEventListener("mousemove",o),document.addEventListener("touchmove",o),document.addEventListener("mouseup",n),document.addEventListener("touchend",n)};getPercentageForValue=e=>this.options.interpolator.getPercentageForValue(e,this.options.min,this.options.max);getTicks=()=>{let e=[];
2if(this.options.ticks)e=[...this.options.ticks];else if("steps"in this.options)e=[...this.options.steps];else{for(e=[this.options.min];e[e.length-1]<this.options.max-this.options.tickSize;)e.push(e[e.length-1]+this.options.tickSize);e.push(this.options.max)}return e.map((e,t)=>({value:e,key:t,percentage:this.getPercentageForValue(e)}))};getSteps=()=>{let e=s(this.tempValues||this.options.values);return[...e,this.options.max].map((t,n)=>{let s=e[n-1],o=void 0!==s?s:this.options.min,r=this.getPercentageForValue(o);return{left:r,width:this.getPercentageForValue(t)-r}})};handles=()=>(this.tempValues||this.options.values).map((e,t)=>({value:e,isActive:t===this.activeHandleIndex,onKeyDownHandler:e=>{this.handleKeyDown(e,t)},onMouseDownHandler:e=>{this.handlePress(e,t)},onTouchStart:e=>{this.handlePress(e,t)}}))}let i="u">typeof window?n.useLayoutEffect:n.useEffect;e.Ranger=r,e.useRanger=function(e){let t=n.useReducer(()=>({}),{})[1],s={...e,rerender:t,onChange:n=>{t(),e.onChange?.(n)}},[o]=n.useState(()=>new r(s));return o.setOptions(s),i(()=>o._willUpdate()),o},Object.defineProperty(e,"__esModule",{value:!0})}(n,e.r(474054))}]);
3
4//# debugId=4f0eb114-dcdc-604d-2d32-5b11602d654f

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.