@marimo-team/frontend 0.25.2-dev52 → 0.25.2-dev56

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.
Files changed (100) hide show
  1. package/dist/assets/{CellStatus-Q5giBgg0.js → CellStatus-CRFBVGjI.js} +1 -1
  2. package/dist/assets/{ConnectedDataExplorerComponent-D5gfkAKK.js → ConnectedDataExplorerComponent-Jv_dljLQ.js} +1 -1
  3. package/dist/assets/{ErrorBoundary-CowFEmQK.js → ErrorBoundary-BKmN7zye.js} +2 -2
  4. package/dist/assets/JsonOutput-Dmq_45PS.js +11 -0
  5. package/dist/assets/{MarimoErrorOutput-p5jt_udI.js → MarimoErrorOutput-DCu6fm2y.js} +1 -1
  6. package/dist/assets/{RenderHTML-CqDY0F9e.js → RenderHTML-DRMkieKn.js} +1 -1
  7. package/dist/assets/RunButton-CPZWjCL9.js +1 -0
  8. package/dist/assets/{add-cell-with-ai-BKqOYjHI.js → add-cell-with-ai-sH3HbLJO.js} +1 -1
  9. package/dist/assets/{add-connection-dialog-CL3bFsGA.js → add-connection-dialog-pQcdKIlO.js} +2 -2
  10. package/dist/assets/{agent-panel-q9X3jIj0.js → agent-panel-9FeJ9hAg.js} +1 -1
  11. package/dist/assets/ai-model-dropdown-D-51nbXZ.js +5 -0
  12. package/dist/assets/{app-config-button-Bylx9JDv.js → app-config-button-Dr1EwwIk.js} +1 -1
  13. package/dist/assets/{blob-BTk5Q8u9.js → blob-BIYte8oT.js} +1 -1
  14. package/dist/assets/cache-panel-BNPF4X5e.js +1 -0
  15. package/dist/assets/{cell-editor-DfRhvA75.js → cell-editor-BNIogYsY.js} +3 -3
  16. package/dist/assets/{cell-link-DRuyhIKm.js → cell-link-BeZAiE1D.js} +1 -1
  17. package/dist/assets/{cells-CuKxjgjJ.js → cells-h5u00Nz8.js} +3 -3
  18. package/dist/assets/{chat-display-BT4wYvSi.js → chat-display-CuZ8niXg.js} +1 -1
  19. package/dist/assets/chat-panel-CHPPwqcP.js +4 -0
  20. package/dist/assets/{chat-ui-DsHB8FDP.js → chat-ui-BJAcq-Ln.js} +1 -1
  21. package/dist/assets/column-preview-D2Um0Qe3.js +1 -0
  22. package/dist/assets/{command-palette-DLjm6e2f.js → command-palette-ChCapZF9.js} +1 -1
  23. package/dist/assets/{common-BHV00wKC.js → common-BMeq0Bqi.js} +1 -1
  24. package/dist/assets/{components-DzAIJKU7.js → components-CWcf8098.js} +1 -1
  25. package/dist/assets/{config-BaEZVOk2.js → config-CR2d-XsP.js} +1 -1
  26. package/dist/assets/{datasource-D0736MyK.js → datasource-BLHGFSsT.js} +1 -1
  27. package/dist/assets/{dependency-graph-panel-B6fAc_9C.js → dependency-graph-panel-C8X3Nn8W.js} +1 -1
  28. package/dist/assets/{documentation-panel-DQAQba71.js → documentation-panel-C8wrSKlX.js} +1 -1
  29. package/dist/assets/{download-D-MTWucM.js → download-CUgiCx7s.js} +1 -1
  30. package/dist/assets/edit-page-DIBiWEli.js +9 -0
  31. package/dist/assets/{error-entries-CWxVwEPG.js → error-entries-DQD4A9cx.js} +1 -1
  32. package/dist/assets/{error-panel-DISYRsce.js → error-panel-BJYkwYEY.js} +1 -1
  33. package/dist/assets/{feedback-button-B1bYxCrZ.js → feedback-button-DbTjGwcX.js} +2 -2
  34. package/dist/assets/feedback-button-JqvnTSfN.js +1 -0
  35. package/dist/assets/file-explorer-panel-CxBxvZDk.js +1 -0
  36. package/dist/assets/{file-name-input-BVXW4Ihy.js → file-name-input-DPJSxW_X.js} +1 -1
  37. package/dist/assets/{floating-outline-BhY3Wt-J.js → floating-outline-3PlTr0K1.js} +1 -1
  38. package/dist/assets/{gallery-page-Be8AbY36.js → gallery-page-BqvVmwde.js} +1 -1
  39. package/dist/assets/{glide-data-editor-D1Fip07J.js → glide-data-editor-CAa14cIr.js} +1 -1
  40. package/dist/assets/home-page-B_NxFh87.js +4 -0
  41. package/dist/assets/{hooks-BgpsvfLA.js → hooks-5owWOOnf.js} +1 -1
  42. package/dist/assets/{index-BdrTweFz.js → index-D9fmFCuc.js} +4 -4
  43. package/dist/assets/input-DPd57MDP.js +7 -0
  44. package/dist/assets/{layout-BAJKEADQ.js → layout-giNu7tsO.js} +5 -5
  45. package/dist/assets/{logs-panel-CjHa5qIw.js → logs-panel-IKL6F2OX.js} +1 -1
  46. package/dist/assets/{markdown-renderer-quSCxU-_.js → markdown-renderer-DHvAXF8E.js} +1 -1
  47. package/dist/assets/{name-cell-input-Cba1m8_c.js → name-cell-input-j4eGLLyd.js} +1 -1
  48. package/dist/assets/{outline-panel-CWsF1QII.js → outline-panel-CprDWmxn.js} +1 -1
  49. package/dist/assets/{packages-panel-C-XEdHNc.js → packages-panel-BGqHk9nr.js} +1 -1
  50. package/dist/assets/{panel-accordion-state-u7avi-RV.js → panel-accordion-state-8xXVhawu.js} +1 -1
  51. package/dist/assets/{panels-B5iuV0lM.js → panels-DftjTXK1.js} +1 -1
  52. package/dist/assets/{process-output-DbjZ_y5T.js → process-output-DOmeJ1VR.js} +1 -1
  53. package/dist/assets/{readonly-code-display-Ctjk_xXb.js → readonly-code-display-xvH6MyT6.js} +1 -1
  54. package/dist/assets/{readonly-python-code-Ctej1jSH.js → readonly-python-code-D4YGmSvB.js} +1 -1
  55. package/dist/assets/{reveal-component-YHvm3T44.js → reveal-component-C72HbbmJ.js} +1 -1
  56. package/dist/assets/{run-page-BkMc69OJ.js → run-page-BOSkpSu_.js} +1 -1
  57. package/dist/assets/{sandbox-panel-fEQNl_1C.js → sandbox-panel-D5bRunTM.js} +1 -1
  58. package/dist/assets/{scratchpad-panel-CZ1PriSX.js → scratchpad-panel-C3gu3_1_.js} +1 -1
  59. package/dist/assets/{secrets-panel-Yc5ollBX.js → secrets-panel-DT1Nansx.js} +1 -1
  60. package/dist/assets/{select-Ww_82o86.js → select-BwRFbZty.js} +1 -1
  61. package/dist/assets/session-panel-CNK8FDu3.js +1 -0
  62. package/dist/assets/{snippets-panel-BFXHSCEq.js → snippets-panel-5_jR08Zd.js} +1 -1
  63. package/dist/assets/{state-Do1H9fl6.js → state-7os84dnI.js} +1 -1
  64. package/dist/assets/{state-CdP1z8ku.js → state-BxJ_FX3k.js} +1 -1
  65. package/dist/assets/switch-C-83e2fG.js +1 -0
  66. package/dist/assets/{toast-CL5SyrsO.js → toast-BRwEbWb6.js} +1 -1
  67. package/dist/assets/{tracing-DBfpxL3C.js → tracing-CRkNpBaH.js} +1 -1
  68. package/dist/assets/tracing-panel-DV2-2TUI.js +2 -0
  69. package/dist/assets/{tree-actions-DdvPjaze.js → tree-actions-CShqSonp.js} +1 -1
  70. package/dist/assets/{useAddCell-BbK54Wma.js → useAddCell-DesMfnE4.js} +1 -1
  71. package/dist/assets/{useCellActionButton-BEZZV5mI.js → useCellActionButton-BO5SFMxA.js} +1 -1
  72. package/dist/assets/useDateFormatter-CTYCgKB-.js +1 -0
  73. package/dist/assets/{useDeleteCell-BG8LgAEA.js → useDeleteCell-DSbUjpSC.js} +1 -1
  74. package/dist/assets/{useDependencyPanelTab-BEjMLLcY.js → useDependencyPanelTab-JIFiQrr2.js} +1 -1
  75. package/dist/assets/{useInstallPackage-DnijI-KS.js → useInstallPackage-CCQcFc6U.js} +1 -1
  76. package/dist/assets/{useNotebookActions-Cnznz5jV.js → useNotebookActions-ByyEgzc-.js} +1 -1
  77. package/dist/assets/useNumberFormatter-BP99Zbyy.js +1 -0
  78. package/dist/assets/{useRunCells-DTPuvtCQ.js → useRunCells-Bx3wXUWO.js} +1 -1
  79. package/dist/assets/{useSplitCell-BuTWivoM.js → useSplitCell-BRmQP02b.js} +1 -1
  80. package/dist/assets/{write-secret-modal-DknTu1O1.js → write-secret-modal-BcosCmZy.js} +2 -2
  81. package/dist/index.html +29 -29
  82. package/package.json +3 -3
  83. package/src/components/editor/navigation/__tests__/navigation.test.ts +8 -8
  84. package/dist/assets/JsonOutput-c1E0SCoN.js +0 -11
  85. package/dist/assets/RunButton-TcDo218m.js +0 -1
  86. package/dist/assets/ai-model-dropdown-CK8y46Fn.js +0 -5
  87. package/dist/assets/cache-panel-CKzoUIhe.js +0 -1
  88. package/dist/assets/chat-panel-C3Bu_7u5.js +0 -4
  89. package/dist/assets/column-preview-BltuXodG.js +0 -1
  90. package/dist/assets/edit-page-CMJrCnfU.js +0 -9
  91. package/dist/assets/feedback-button-BW1-NBBf.js +0 -1
  92. package/dist/assets/file-explorer-panel-VIG5c9ac.js +0 -1
  93. package/dist/assets/home-page-Dv2fEKyO.js +0 -4
  94. package/dist/assets/input-DnyzXg4C.js +0 -7
  95. package/dist/assets/session-panel-DD5LfQGb.js +0 -1
  96. package/dist/assets/switch-CPh_C6Mu.js +0 -1
  97. package/dist/assets/tracing-panel-CS9W1a0x.js +0 -2
  98. package/dist/assets/useDateFormatter-CjgScv5a.js +0 -1
  99. package/dist/assets/useNumberFormatter-C4-_TnkF.js +0 -1
  100. /package/dist/assets/{context-BFOBKCJB.js → I18nProvider-BFOBKCJB.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,t as n}from"./useEvent-Dc9HkKI2.js";import{t as r}from"./react-CUdNIagt.js";import{Bt as i,D as a,na as o,oa as s,rt as c,ta as l}from"./cells-CuKxjgjJ.js";import{t as u}from"./compiler-runtime-BQ9S8nyo.js";import{T as d,s as f}from"./config-Cyum2gRs.js";import{g as p,t as m}from"./useEventListener-IRzG-0mH.js";import{t as h}from"./utils-B4K466FK.js";import{m as g}from"./session-BykGt6S3.js";import{_}from"./config-BAnYSdpO.js";import{r as v}from"./state-ja7GWeCS.js";import{t as y}from"./cn-ldLVeaqm.js";import{t as b}from"./jsx-runtime-B74pBk57.js";import{n as x}from"./fullscreen-DEBblJKh.js";import{Ft as S}from"./JsonOutput-c1E0SCoN.js";import{t as C}from"./tooltip-B5pI8o2n.js";import{r as ee,t as w}from"./button-M49xxKoi.js";import{t as T}from"./createLucideIcon-rHn2EdoM.js";import{_ as E,d as D,f as O,g as k,s as A,u as j}from"./layout-BAJKEADQ.js";import{a as M}from"./useNumberFormatter-C4-_TnkF.js";import{t as te}from"./code-DW4kNwKG.js";import{t as ne}from"./eye-off-CfkK-QS3.js";import{n as N,t as re}from"./cell-editor-DfRhvA75.js";import{n as ie,t as P}from"./RunButton-TcDo218m.js";import{t as ae}from"./readonly-python-code-Ctej1jSH.js";import{r as oe}from"./useTheme-BkPLyRl9.js";import{r as se}from"./useDebounce-DMbg9X18.js";import{t as ce}from"./CellStatus-Q5giBgg0.js";import{i as le}from"./useRunCells-DTPuvtCQ.js";import{n as ue,r as de,t as fe}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{n as pe,t as me}from"./code-visibility-B5QjA0ie.js";import{t as he}from"./readonly-code-display-Ctjk_xXb.js";/* empty css */var ge=T(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),F=e(r(),1),I=u(),L=(e,t)=>{for(let n in t)e[n]=t[n];return e},R=(e,t)=>Array.from(e.querySelectorAll(t)),_e=(e,t,n)=>{n?e.classList.add(t):e.classList.remove(t)},ve=e=>{if(typeof e==`string`){if(e===`null`)return null;if(e===`true`)return!0;if(e===`false`)return!1;if(e.match(/^-?[\d\.]+$/))return parseFloat(e)}return e},ye=(e,t)=>{e.style.transform=t},z=(e,t)=>{let n=e.matches||e.matchesSelector||e.msMatchesSelector;return!!(n&&n.call(e,t))},B=(e,t)=>{if(e&&typeof e.closest==`function`)return e.closest(t);for(;e;){if(z(e,t))return e;e=e.parentElement}return null},be=e=>{e||=document.documentElement;let t=e.requestFullscreen||e.webkitRequestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen;t&&t.apply(e)},xe=(e,t,n,r=``)=>{let i=e.querySelectorAll(`.`+n);for(let t=0;t<i.length;t++){let n=i[t];if(n.parentNode===e)return n}let a=document.createElement(t);return a.className=n,a.innerHTML=r,e.appendChild(a),a},Se=e=>{let t=document.createElement(`style`);return e&&e.length>0&&t.appendChild(document.createTextNode(e)),document.head.appendChild(t),t},Ce=()=>{let e={};location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,t=>{let n=t.split(`=`).shift(),r=t.split(`=`).pop();return n&&r!==void 0&&(e[n]=r),t});for(let t in e){let n=e[t];e[t]=ve(unescape(n))}return e.dependencies!==void 0&&delete e.dependencies,e},we=(e,t=0)=>{if(e){let n,r=e.style.height;return e.style.height=`0px`,e.parentElement&&(e.parentElement.style.height=`auto`),n=t-(e.parentElement?.offsetHeight||0),e.style.height=r+`px`,e.parentElement&&e.parentElement.style.removeProperty(`height`),n}return t},V={mp4:`video/mp4`,m4a:`video/mp4`,ogv:`video/ogg`,mpeg:`video/mpeg`,webm:`video/webm`},H=(e=``)=>{let t=e.split(`.`).pop();return t?V[t]:void 0},Te=(e=``)=>encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),U=navigator.userAgent,Ee=/(iphone|ipod|ipad|android)/gi.test(U)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;/chrome/i.test(U)&&/edge/i.test(U);var De=/android/gi.test(U),Oe=function(e){if(e){var t=function(e){return[].slice.call(e)},n=0,r=1,i=2,a=3,o=[],s=null,c=`requestAnimationFrame`in e?function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};e.cancelAnimationFrame(s);var n=function(){return u(o.filter((function(e){return e.dirty&&e.active})))};if(t.sync)return n();s=e.requestAnimationFrame(n)}:function(){},l=function(e){return function(t){o.forEach((function(t){return t.dirty=e})),c(t)}},u=function(e){e.filter((function(e){return!e.styleComputed})).forEach((function(e){e.styleComputed=m(e)})),e.filter(h).forEach(g);var t=e.filter(p);t.forEach(f),t.forEach((function(e){g(e),d(e)})),t.forEach(_)},d=function(e){return e.dirty=n},f=function(e){e.availableWidth=e.element.parentNode.clientWidth,e.currentWidth=e.element.scrollWidth,e.previousFontSize=e.currentFontSize,e.currentFontSize=Math.min(Math.max(e.minSize,e.availableWidth/e.currentWidth*e.previousFontSize),e.maxSize),e.whiteSpace=e.multiLine&&e.currentFontSize===e.minSize?`normal`:`nowrap`},p=function(e){return e.dirty!==i||e.dirty===i&&e.element.parentNode.clientWidth!==e.availableWidth},m=function(t){var n=e.getComputedStyle(t.element,null);return t.currentFontSize=parseFloat(n.getPropertyValue(`font-size`)),t.display=n.getPropertyValue(`display`),t.whiteSpace=n.getPropertyValue(`white-space`),!0},h=function(e){var t=!1;return!e.preStyleTestCompleted&&(/inline-/.test(e.display)||(t=!0,e.display=`inline-block`),e.whiteSpace!==`nowrap`&&(t=!0,e.whiteSpace=`nowrap`),e.preStyleTestCompleted=!0,t)},g=function(e){e.element.style.whiteSpace=e.whiteSpace,e.element.style.display=e.display,e.element.style.fontSize=e.currentFontSize+`px`},_=function(e){e.element.dispatchEvent(new CustomEvent(`fit`,{detail:{oldValue:e.previousFontSize,newValue:e.currentFontSize,scaleFactor:e.currentFontSize/e.previousFontSize}}))},v=function(e,t){return function(n){e.dirty=t,e.active&&c(n)}},y=function(e){return function(){o=o.filter((function(t){return t.element!==e.element})),e.observeMutations&&e.observer.disconnect(),e.element.style.whiteSpace=e.originalStyle.whiteSpace,e.element.style.display=e.originalStyle.display,e.element.style.fontSize=e.originalStyle.fontSize}},b=function(e){return function(){e.active||(e.active=!0,c())}},x=function(e){return function(){return e.active=!1}},S=function(e){e.observeMutations&&(e.observer=new MutationObserver(v(e,r)),e.observer.observe(e.element,e.observeMutations))},C={minSize:16,maxSize:512,multiLine:!0,observeMutations:`MutationObserver`in e&&{subtree:!0,childList:!0,characterData:!0}},ee=null,w=function(){e.clearTimeout(ee),ee=e.setTimeout(l(i),D.observeWindowDelay)},T=[`resize`,`orientationchange`];return Object.defineProperty(D,"observeWindow",{set:function(t){var n=`${t?`add`:`remove`}EventListener`;T.forEach((function(t){e[n](t,w)}))}}),D.observeWindow=!0,D.observeWindowDelay=100,D.fitAll=l(a),D}function E(e,t){var n=Object.assign({},C,t),r=e.map((function(e){var t=Object.assign({},n,{element:e,active:!0});return function(e){e.originalStyle={whiteSpace:e.element.style.whiteSpace,display:e.element.style.display,fontSize:e.element.style.fontSize},S(e),e.newbie=!0,e.dirty=!0,o.push(e)}(t),{element:e,fit:v(t,a),unfreeze:b(t),freeze:x(t),unsubscribe:y(t)}}));return c(),r}function D(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof e==`string`?E(t(document.querySelectorAll(e)),n):E([e],n)[0]}}(typeof window>`u`?null:window);function W(e){"@babel/helpers - typeof";return W=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},W(e)}function ke(e,t){if(W(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(W(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ae(e){var t=ke(e,`string`);return W(t)==`symbol`?t:t+``}function je(e,t,n){return(t=Ae(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Me=class{constructor(e){je(this,`allowedToPlayAudio`,null),this.Reveal=e,this.startEmbeddedMedia=this.startEmbeddedMedia.bind(this),this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this),this.preventIframeAutoFocus=this.preventIframeAutoFocus.bind(this),this.ensureMobileMediaPlaying=this.ensureMobileMediaPlaying.bind(this),this.failedAudioPlaybackTargets=new Set,this.failedVideoPlaybackTargets=new Set,this.failedMutedVideoPlaybackTargets=new Set,this.renderMediaPlayButton()}renderMediaPlayButton(){this.mediaPlayButton=document.createElement(`button`),this.mediaPlayButton.className=`r-overlay-button r-media-play-button`,this.mediaPlayButton.addEventListener(`click`,()=>{this.resetTemporarilyMutedMedia(),new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{this.startEmbeddedMedia({target:e})}),this.clearMediaPlaybackErrors()})}shouldPreload(e){if(this.Reveal.isScrollView())return!0;let t=this.Reveal.getConfig().preloadIframes;return typeof t!=`boolean`&&(t=e.hasAttribute(`data-preload`)),t}load(e,t={}){let n=this.Reveal.getConfig().display;if(n.includes(`!important`)){let t=n.replace(/\s*!important\s*$/,``).trim();e.style.setProperty(`display`,t,`important`)}else e.style.display=n;R(e,`img[data-src], video[data-src], audio[data-src], iframe[data-src]`).forEach(e=>{let t=e.tagName===`IFRAME`;(!t||this.shouldPreload(e))&&(e.setAttribute(`src`,e.getAttribute(`data-src`)),e.setAttribute(`data-lazy-loaded`,``),e.removeAttribute(`data-src`),t&&e.addEventListener(`load`,this.preventIframeAutoFocus))}),R(e,`video, audio`).forEach(e=>{let t=0;R(e,`source[data-src]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`data-src`)),e.removeAttribute(`data-src`),e.setAttribute(`data-lazy-loaded`,``),t+=1}),Ee&&e.tagName===`VIDEO`&&e.setAttribute(`playsinline`,``),t>0&&e.load()});let r=e.slideBackgroundElement;if(r){r.style.display=`block`;let n=e.slideBackgroundContentElement,i=e.getAttribute(`data-background-iframe`);if(r.hasAttribute(`data-loaded`)===!1){r.setAttribute(`data-loaded`,`true`);let a=e.getAttribute(`data-background-image`),o=e.getAttribute(`data-background-video`),s=e.hasAttribute(`data-background-video-loop`),c=e.hasAttribute(`data-background-video-muted`);if(a)/^data:/.test(a.trim())?n.style.backgroundImage=`url(${a.trim()})`:n.style.backgroundImage=a.split(`,`).map(e=>`url(${Te(decodeURI(e.trim()))})`).join(`,`);else if(o){let e=document.createElement(`video`);s&&e.setAttribute(`loop`,``),(c||this.Reveal.isSpeakerNotes())&&(e.muted=!0),Ee&&e.setAttribute(`playsinline`,``),o.split(`,`).forEach(t=>{let n=document.createElement(`source`);n.setAttribute(`src`,t);let r=H(t);r&&n.setAttribute(`type`,r),e.appendChild(n)}),n.appendChild(e)}else if(i&&t.excludeIframes!==!0){let e=document.createElement(`iframe`);e.setAttribute(`allowfullscreen`,``),e.setAttribute(`mozallowfullscreen`,``),e.setAttribute(`webkitallowfullscreen`,``),e.setAttribute(`allow`,`autoplay`),e.setAttribute(`data-src`,i),e.style.width=`100%`,e.style.height=`100%`,e.style.maxHeight=`100%`,e.style.maxWidth=`100%`,n.appendChild(e)}}let a=n.querySelector(`iframe[data-src]`);a&&this.shouldPreload(r)&&!/autoplay=(1|true|yes)/gi.test(i)&&a.getAttribute(`src`)!==i&&a.setAttribute(`src`,i)}this.layout(e)}layout(e){Array.from(e.querySelectorAll(`.r-fit-text`)).forEach(e=>{Oe(e,{minSize:24,maxSize:this.Reveal.getConfig().height*.8,observeMutations:!1,observeWindow:!1})})}unload(e){e.style.display=`none`;let t=this.Reveal.getSlideBackground(e);t&&(t.style.display=`none`,R(t,`iframe[src]`).forEach(e=>{e.removeAttribute(`src`)})),R(e,`video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)}),R(e,`video[data-lazy-loaded] source[src], audio source[src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)})}formatEmbeddedContent(){let e=(e,t,n)=>{R(this.Reveal.getSlidesElement(),`iframe[`+e+`*="`+t+`"]`).forEach(t=>{let r=t.getAttribute(e);r&&r.indexOf(n)===-1&&t.setAttribute(e,r+(/\?/.test(r)?`&`:`?`)+n)})};e(`src`,`youtube.com/embed/`,`enablejsapi=1`),e(`data-src`,`youtube.com/embed/`,`enablejsapi=1`),e(`src`,`player.vimeo.com/`,`api=1`),e(`data-src`,`player.vimeo.com/`,`api=1`)}startEmbeddedContent(e){if(e){let t=this.Reveal.isSpeakerNotes();R(e,`img[src$=".gif"]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`src`))}),R(e,`video, audio`).forEach(e=>{if(B(e,`.fragment`)&&!B(e,`.fragment.visible`))return;let n=this.Reveal.getConfig().autoPlayMedia;if(typeof n!=`boolean`&&(n=e.hasAttribute(`data-autoplay`)||!!B(e,`.slide-background`)),n&&typeof e.play==`function`){if(t&&!e.muted)return;e.readyState>1?this.startEmbeddedMedia({target:e}):Ee?(e.addEventListener(`canplay`,this.ensureMobileMediaPlaying),this.playMediaElement(e)):(e.removeEventListener(`loadeddata`,this.startEmbeddedMedia),e.addEventListener(`loadeddata`,this.startEmbeddedMedia))}}),t||(R(e,`iframe[src]`).forEach(e=>{B(e,`.fragment`)&&!B(e,`.fragment.visible`)||this.startEmbeddedIframe({target:e})}),R(e,`iframe[data-src]`).forEach(e=>{B(e,`.fragment`)&&!B(e,`.fragment.visible`)||e.getAttribute(`src`)!==e.getAttribute(`data-src`)&&(e.removeEventListener(`load`,this.startEmbeddedIframe),e.addEventListener(`load`,this.startEmbeddedIframe),e.setAttribute(`src`,e.getAttribute(`data-src`)))}))}}ensureMobileMediaPlaying(e){let t=e.target;typeof t.getVideoPlaybackQuality==`function`&&setTimeout(()=>{let e=t.paused===!1,n=t.getVideoPlaybackQuality().totalVideoFrames;e&&n===0&&(t.load(),t.play())},1e3)}startEmbeddedMedia(e){let t=!!B(e.target,`html`),n=!!B(e.target,`.present`);t&&n&&(e.target.paused||e.target.ended)&&(e.target.currentTime=0,this.playMediaElement(e.target)),e.target.removeEventListener(`loadeddata`,this.startEmbeddedMedia)}playMediaElement(e){let t=e.play();t&&typeof t.catch==`function`&&t.then(()=>{e.muted||(this.allowedToPlayAudio=!0)}).catch(t=>{if(t.name===`NotAllowedError`){if(this.allowedToPlayAudio=!1,e.tagName===`VIDEO`){this.onVideoPlaybackNotAllowed(e);let t=!!B(e,`html`),n=!!B(e,`.present`),r=e.muted;t&&n&&!r&&(e.setAttribute(`data-muted-by-reveal`,`true`),e.muted=!0,e.play().catch(()=>{this.onMutedVideoPlaybackNotAllowed(e)}))}else e.tagName===`AUDIO`&&this.onAudioPlaybackNotAllowed(e)}})}startEmbeddedIframe(e){let t=e.target;if(this.preventIframeAutoFocus(e),t&&t.contentWindow){let n=!!B(e.target,`html`),r=!!B(e.target,`.present`);if(n&&r){let e=this.Reveal.getConfig().autoPlayMedia;typeof e!=`boolean`&&(e=t.hasAttribute(`data-autoplay`)||!!B(t,`.slide-background`)),/youtube\.com\/embed\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"event":"command","func":"playVideo","args":""}`,`*`):/player\.vimeo\.com\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"method":"play"}`,`*`):t.contentWindow.postMessage(`slide:start`,`*`)}}}stopEmbeddedContent(e,t={}){t=L({unloadIframes:!0},t),e&&e.parentNode&&(R(e,`video, audio`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&typeof e.pause==`function`&&(e.setAttribute(`data-paused-by-reveal`,``),e.pause(),Ee&&e.removeEventListener(`canplay`,this.ensureMobileMediaPlaying))}),R(e,`iframe`).forEach(e=>{e.contentWindow&&e.contentWindow.postMessage(`slide:stop`,`*`),e.removeEventListener(`load`,this.preventIframeAutoFocus),e.removeEventListener(`load`,this.startEmbeddedIframe)}),R(e,`iframe[src*="youtube.com/embed/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"event":"command","func":"pauseVideo","args":""}`,`*`)}),R(e,`iframe[src*="player.vimeo.com/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"method":"pause"}`,`*`)}),t.unloadIframes===!0&&R(e,`iframe[data-src]`).forEach(e=>{e.setAttribute(`src`,`about:blank`),e.removeAttribute(`src`)}))}isAllowedToPlayAudio(){return this.allowedToPlayAudio}showPlayOrUnmuteButton(){let e=this.failedAudioPlaybackTargets.size,t=this.failedVideoPlaybackTargets.size,n=this.failedMutedVideoPlaybackTargets.size,r=`Play media`;n>0?r=`Play video`:t>0?r=`Unmute video`:e>0&&(r=`Play audio`),this.mediaPlayButton.textContent=r,this.Reveal.getRevealElement().appendChild(this.mediaPlayButton)}onAudioPlaybackNotAllowed(e){this.failedAudioPlaybackTargets.add(e),this.showPlayOrUnmuteButton(e)}onVideoPlaybackNotAllowed(e){this.failedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}onMutedVideoPlaybackNotAllowed(e){this.failedMutedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}resetTemporarilyMutedMedia(){new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{e.hasAttribute(`data-muted-by-reveal`)&&(e.muted=!1,e.removeAttribute(`data-muted-by-reveal`))})}clearMediaPlaybackErrors(){this.resetTemporarilyMutedMedia(),this.failedAudioPlaybackTargets.clear(),this.failedVideoPlaybackTargets.clear(),this.failedMutedVideoPlaybackTargets.clear(),this.mediaPlayButton&&this.mediaPlayButton.parentNode&&this.mediaPlayButton.remove()}preventIframeAutoFocus(e){let t=e.target;if(t&&this.Reveal.getConfig().preventIframeAutoFocus){let e=0,n=()=>{document.activeElement===t?document.activeElement.blur():e<1e3&&(e+=100,setTimeout(n,100))};setTimeout(n,100)}}afterSlideChanged(){this.clearMediaPlaybackErrors()}},Ne=`.slides section`,Pe=`.slides>section`,Fe=`.slides>section.present>section`,Ie=`.backgrounds>.slide-background`,Le=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview|previewIframe/,Re=class{constructor(e){this.Reveal=e}render(){this.element=document.createElement(`div`),this.element.className=`slide-number`,this.Reveal.getRevealElement().appendChild(this.element)}configure(e,t){let n=`none`;e.slideNumber&&!this.Reveal.isPrintView()&&(e.showSlideNumber===`all`||e.showSlideNumber===`speaker`&&this.Reveal.isSpeakerNotes())&&(n=`block`),this.element.style.display=n}update(){this.Reveal.getConfig().slideNumber&&this.element&&(this.element.innerHTML=this.getSlideNumber())}getSlideNumber(e=this.Reveal.getCurrentSlide()){let t=this.Reveal.getConfig(),n,r=`h.v`;if(typeof t.slideNumber==`function`)n=t.slideNumber(e);else{typeof t.slideNumber==`string`&&(r=t.slideNumber),!/c/.test(r)&&this.Reveal.getHorizontalSlides().length===1&&(r=`c`);let i=e&&e.dataset.visibility===`uncounted`?0:1;switch(n=[],r){case`c`:n.push(this.Reveal.getSlidePastCount(e)+i);break;case`c/t`:n.push(this.Reveal.getSlidePastCount(e)+i,`/`,this.Reveal.getTotalSlides());break;default:let t=this.Reveal.getIndices(e);n.push(t.h+i);let a=r===`h/v`?`/`:`.`;this.Reveal.isVerticalSlide(e)&&n.push(a,t.v+1)}}let i=`#`+this.Reveal.location.getHash(e);return this.formatNumber(n[0],n[1],n[2],i)}formatNumber(e,t,n,r=`#`+this.Reveal.location.getHash()){return typeof n==`number`&&!isNaN(n)?`<a href="${r}">
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,t as n}from"./useEvent-Dc9HkKI2.js";import{t as r}from"./react-CUdNIagt.js";import{Bt as i,D as a,na as o,oa as s,rt as c,ta as l}from"./cells-h5u00Nz8.js";import{t as u}from"./compiler-runtime-BQ9S8nyo.js";import{T as d,s as f}from"./config-Cyum2gRs.js";import{g as p,t as m}from"./useEventListener-IRzG-0mH.js";import{t as h}from"./utils-B4K466FK.js";import{m as g}from"./session-BykGt6S3.js";import{_}from"./config-BAnYSdpO.js";import{r as v}from"./state-ja7GWeCS.js";import{t as y}from"./cn-ldLVeaqm.js";import{t as b}from"./jsx-runtime-B74pBk57.js";import{n as x}from"./fullscreen-DEBblJKh.js";import{Ft as S}from"./JsonOutput-Dmq_45PS.js";import{t as C}from"./tooltip-B5pI8o2n.js";import{r as ee,t as w}from"./button-M49xxKoi.js";import{t as T}from"./createLucideIcon-rHn2EdoM.js";import{_ as E,d as D,f as O,g as k,s as A,u as j}from"./layout-giNu7tsO.js";import{a as M}from"./useNumberFormatter-BP99Zbyy.js";import{t as te}from"./code-DW4kNwKG.js";import{t as ne}from"./eye-off-CfkK-QS3.js";import{n as N,t as re}from"./cell-editor-BNIogYsY.js";import{n as ie,t as P}from"./RunButton-CPZWjCL9.js";import{t as ae}from"./readonly-python-code-D4YGmSvB.js";import{r as oe}from"./useTheme-BkPLyRl9.js";import{r as se}from"./useDebounce-DMbg9X18.js";import{t as ce}from"./CellStatus-CRFBVGjI.js";import{i as le}from"./useRunCells-Bx3wXUWO.js";import{n as ue,r as de,t as fe}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{n as pe,t as me}from"./code-visibility-B5QjA0ie.js";import{t as he}from"./readonly-code-display-xvH6MyT6.js";/* empty css */var ge=T(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),F=e(r(),1),I=u(),L=(e,t)=>{for(let n in t)e[n]=t[n];return e},R=(e,t)=>Array.from(e.querySelectorAll(t)),_e=(e,t,n)=>{n?e.classList.add(t):e.classList.remove(t)},ve=e=>{if(typeof e==`string`){if(e===`null`)return null;if(e===`true`)return!0;if(e===`false`)return!1;if(e.match(/^-?[\d\.]+$/))return parseFloat(e)}return e},ye=(e,t)=>{e.style.transform=t},z=(e,t)=>{let n=e.matches||e.matchesSelector||e.msMatchesSelector;return!!(n&&n.call(e,t))},B=(e,t)=>{if(e&&typeof e.closest==`function`)return e.closest(t);for(;e;){if(z(e,t))return e;e=e.parentElement}return null},be=e=>{e||=document.documentElement;let t=e.requestFullscreen||e.webkitRequestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen;t&&t.apply(e)},xe=(e,t,n,r=``)=>{let i=e.querySelectorAll(`.`+n);for(let t=0;t<i.length;t++){let n=i[t];if(n.parentNode===e)return n}let a=document.createElement(t);return a.className=n,a.innerHTML=r,e.appendChild(a),a},Se=e=>{let t=document.createElement(`style`);return e&&e.length>0&&t.appendChild(document.createTextNode(e)),document.head.appendChild(t),t},Ce=()=>{let e={};location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,t=>{let n=t.split(`=`).shift(),r=t.split(`=`).pop();return n&&r!==void 0&&(e[n]=r),t});for(let t in e){let n=e[t];e[t]=ve(unescape(n))}return e.dependencies!==void 0&&delete e.dependencies,e},we=(e,t=0)=>{if(e){let n,r=e.style.height;return e.style.height=`0px`,e.parentElement&&(e.parentElement.style.height=`auto`),n=t-(e.parentElement?.offsetHeight||0),e.style.height=r+`px`,e.parentElement&&e.parentElement.style.removeProperty(`height`),n}return t},V={mp4:`video/mp4`,m4a:`video/mp4`,ogv:`video/ogg`,mpeg:`video/mpeg`,webm:`video/webm`},H=(e=``)=>{let t=e.split(`.`).pop();return t?V[t]:void 0},Te=(e=``)=>encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),U=navigator.userAgent,Ee=/(iphone|ipod|ipad|android)/gi.test(U)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;/chrome/i.test(U)&&/edge/i.test(U);var De=/android/gi.test(U),Oe=function(e){if(e){var t=function(e){return[].slice.call(e)},n=0,r=1,i=2,a=3,o=[],s=null,c=`requestAnimationFrame`in e?function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};e.cancelAnimationFrame(s);var n=function(){return u(o.filter((function(e){return e.dirty&&e.active})))};if(t.sync)return n();s=e.requestAnimationFrame(n)}:function(){},l=function(e){return function(t){o.forEach((function(t){return t.dirty=e})),c(t)}},u=function(e){e.filter((function(e){return!e.styleComputed})).forEach((function(e){e.styleComputed=m(e)})),e.filter(h).forEach(g);var t=e.filter(p);t.forEach(f),t.forEach((function(e){g(e),d(e)})),t.forEach(_)},d=function(e){return e.dirty=n},f=function(e){e.availableWidth=e.element.parentNode.clientWidth,e.currentWidth=e.element.scrollWidth,e.previousFontSize=e.currentFontSize,e.currentFontSize=Math.min(Math.max(e.minSize,e.availableWidth/e.currentWidth*e.previousFontSize),e.maxSize),e.whiteSpace=e.multiLine&&e.currentFontSize===e.minSize?`normal`:`nowrap`},p=function(e){return e.dirty!==i||e.dirty===i&&e.element.parentNode.clientWidth!==e.availableWidth},m=function(t){var n=e.getComputedStyle(t.element,null);return t.currentFontSize=parseFloat(n.getPropertyValue(`font-size`)),t.display=n.getPropertyValue(`display`),t.whiteSpace=n.getPropertyValue(`white-space`),!0},h=function(e){var t=!1;return!e.preStyleTestCompleted&&(/inline-/.test(e.display)||(t=!0,e.display=`inline-block`),e.whiteSpace!==`nowrap`&&(t=!0,e.whiteSpace=`nowrap`),e.preStyleTestCompleted=!0,t)},g=function(e){e.element.style.whiteSpace=e.whiteSpace,e.element.style.display=e.display,e.element.style.fontSize=e.currentFontSize+`px`},_=function(e){e.element.dispatchEvent(new CustomEvent(`fit`,{detail:{oldValue:e.previousFontSize,newValue:e.currentFontSize,scaleFactor:e.currentFontSize/e.previousFontSize}}))},v=function(e,t){return function(n){e.dirty=t,e.active&&c(n)}},y=function(e){return function(){o=o.filter((function(t){return t.element!==e.element})),e.observeMutations&&e.observer.disconnect(),e.element.style.whiteSpace=e.originalStyle.whiteSpace,e.element.style.display=e.originalStyle.display,e.element.style.fontSize=e.originalStyle.fontSize}},b=function(e){return function(){e.active||(e.active=!0,c())}},x=function(e){return function(){return e.active=!1}},S=function(e){e.observeMutations&&(e.observer=new MutationObserver(v(e,r)),e.observer.observe(e.element,e.observeMutations))},C={minSize:16,maxSize:512,multiLine:!0,observeMutations:`MutationObserver`in e&&{subtree:!0,childList:!0,characterData:!0}},ee=null,w=function(){e.clearTimeout(ee),ee=e.setTimeout(l(i),D.observeWindowDelay)},T=[`resize`,`orientationchange`];return Object.defineProperty(D,"observeWindow",{set:function(t){var n=`${t?`add`:`remove`}EventListener`;T.forEach((function(t){e[n](t,w)}))}}),D.observeWindow=!0,D.observeWindowDelay=100,D.fitAll=l(a),D}function E(e,t){var n=Object.assign({},C,t),r=e.map((function(e){var t=Object.assign({},n,{element:e,active:!0});return function(e){e.originalStyle={whiteSpace:e.element.style.whiteSpace,display:e.element.style.display,fontSize:e.element.style.fontSize},S(e),e.newbie=!0,e.dirty=!0,o.push(e)}(t),{element:e,fit:v(t,a),unfreeze:b(t),freeze:x(t),unsubscribe:y(t)}}));return c(),r}function D(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof e==`string`?E(t(document.querySelectorAll(e)),n):E([e],n)[0]}}(typeof window>`u`?null:window);function W(e){"@babel/helpers - typeof";return W=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},W(e)}function ke(e,t){if(W(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(W(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ae(e){var t=ke(e,`string`);return W(t)==`symbol`?t:t+``}function je(e,t,n){return(t=Ae(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Me=class{constructor(e){je(this,`allowedToPlayAudio`,null),this.Reveal=e,this.startEmbeddedMedia=this.startEmbeddedMedia.bind(this),this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this),this.preventIframeAutoFocus=this.preventIframeAutoFocus.bind(this),this.ensureMobileMediaPlaying=this.ensureMobileMediaPlaying.bind(this),this.failedAudioPlaybackTargets=new Set,this.failedVideoPlaybackTargets=new Set,this.failedMutedVideoPlaybackTargets=new Set,this.renderMediaPlayButton()}renderMediaPlayButton(){this.mediaPlayButton=document.createElement(`button`),this.mediaPlayButton.className=`r-overlay-button r-media-play-button`,this.mediaPlayButton.addEventListener(`click`,()=>{this.resetTemporarilyMutedMedia(),new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{this.startEmbeddedMedia({target:e})}),this.clearMediaPlaybackErrors()})}shouldPreload(e){if(this.Reveal.isScrollView())return!0;let t=this.Reveal.getConfig().preloadIframes;return typeof t!=`boolean`&&(t=e.hasAttribute(`data-preload`)),t}load(e,t={}){let n=this.Reveal.getConfig().display;if(n.includes(`!important`)){let t=n.replace(/\s*!important\s*$/,``).trim();e.style.setProperty(`display`,t,`important`)}else e.style.display=n;R(e,`img[data-src], video[data-src], audio[data-src], iframe[data-src]`).forEach(e=>{let t=e.tagName===`IFRAME`;(!t||this.shouldPreload(e))&&(e.setAttribute(`src`,e.getAttribute(`data-src`)),e.setAttribute(`data-lazy-loaded`,``),e.removeAttribute(`data-src`),t&&e.addEventListener(`load`,this.preventIframeAutoFocus))}),R(e,`video, audio`).forEach(e=>{let t=0;R(e,`source[data-src]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`data-src`)),e.removeAttribute(`data-src`),e.setAttribute(`data-lazy-loaded`,``),t+=1}),Ee&&e.tagName===`VIDEO`&&e.setAttribute(`playsinline`,``),t>0&&e.load()});let r=e.slideBackgroundElement;if(r){r.style.display=`block`;let n=e.slideBackgroundContentElement,i=e.getAttribute(`data-background-iframe`);if(r.hasAttribute(`data-loaded`)===!1){r.setAttribute(`data-loaded`,`true`);let a=e.getAttribute(`data-background-image`),o=e.getAttribute(`data-background-video`),s=e.hasAttribute(`data-background-video-loop`),c=e.hasAttribute(`data-background-video-muted`);if(a)/^data:/.test(a.trim())?n.style.backgroundImage=`url(${a.trim()})`:n.style.backgroundImage=a.split(`,`).map(e=>`url(${Te(decodeURI(e.trim()))})`).join(`,`);else if(o){let e=document.createElement(`video`);s&&e.setAttribute(`loop`,``),(c||this.Reveal.isSpeakerNotes())&&(e.muted=!0),Ee&&e.setAttribute(`playsinline`,``),o.split(`,`).forEach(t=>{let n=document.createElement(`source`);n.setAttribute(`src`,t);let r=H(t);r&&n.setAttribute(`type`,r),e.appendChild(n)}),n.appendChild(e)}else if(i&&t.excludeIframes!==!0){let e=document.createElement(`iframe`);e.setAttribute(`allowfullscreen`,``),e.setAttribute(`mozallowfullscreen`,``),e.setAttribute(`webkitallowfullscreen`,``),e.setAttribute(`allow`,`autoplay`),e.setAttribute(`data-src`,i),e.style.width=`100%`,e.style.height=`100%`,e.style.maxHeight=`100%`,e.style.maxWidth=`100%`,n.appendChild(e)}}let a=n.querySelector(`iframe[data-src]`);a&&this.shouldPreload(r)&&!/autoplay=(1|true|yes)/gi.test(i)&&a.getAttribute(`src`)!==i&&a.setAttribute(`src`,i)}this.layout(e)}layout(e){Array.from(e.querySelectorAll(`.r-fit-text`)).forEach(e=>{Oe(e,{minSize:24,maxSize:this.Reveal.getConfig().height*.8,observeMutations:!1,observeWindow:!1})})}unload(e){e.style.display=`none`;let t=this.Reveal.getSlideBackground(e);t&&(t.style.display=`none`,R(t,`iframe[src]`).forEach(e=>{e.removeAttribute(`src`)})),R(e,`video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)}),R(e,`video[data-lazy-loaded] source[src], audio source[src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)})}formatEmbeddedContent(){let e=(e,t,n)=>{R(this.Reveal.getSlidesElement(),`iframe[`+e+`*="`+t+`"]`).forEach(t=>{let r=t.getAttribute(e);r&&r.indexOf(n)===-1&&t.setAttribute(e,r+(/\?/.test(r)?`&`:`?`)+n)})};e(`src`,`youtube.com/embed/`,`enablejsapi=1`),e(`data-src`,`youtube.com/embed/`,`enablejsapi=1`),e(`src`,`player.vimeo.com/`,`api=1`),e(`data-src`,`player.vimeo.com/`,`api=1`)}startEmbeddedContent(e){if(e){let t=this.Reveal.isSpeakerNotes();R(e,`img[src$=".gif"]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`src`))}),R(e,`video, audio`).forEach(e=>{if(B(e,`.fragment`)&&!B(e,`.fragment.visible`))return;let n=this.Reveal.getConfig().autoPlayMedia;if(typeof n!=`boolean`&&(n=e.hasAttribute(`data-autoplay`)||!!B(e,`.slide-background`)),n&&typeof e.play==`function`){if(t&&!e.muted)return;e.readyState>1?this.startEmbeddedMedia({target:e}):Ee?(e.addEventListener(`canplay`,this.ensureMobileMediaPlaying),this.playMediaElement(e)):(e.removeEventListener(`loadeddata`,this.startEmbeddedMedia),e.addEventListener(`loadeddata`,this.startEmbeddedMedia))}}),t||(R(e,`iframe[src]`).forEach(e=>{B(e,`.fragment`)&&!B(e,`.fragment.visible`)||this.startEmbeddedIframe({target:e})}),R(e,`iframe[data-src]`).forEach(e=>{B(e,`.fragment`)&&!B(e,`.fragment.visible`)||e.getAttribute(`src`)!==e.getAttribute(`data-src`)&&(e.removeEventListener(`load`,this.startEmbeddedIframe),e.addEventListener(`load`,this.startEmbeddedIframe),e.setAttribute(`src`,e.getAttribute(`data-src`)))}))}}ensureMobileMediaPlaying(e){let t=e.target;typeof t.getVideoPlaybackQuality==`function`&&setTimeout(()=>{let e=t.paused===!1,n=t.getVideoPlaybackQuality().totalVideoFrames;e&&n===0&&(t.load(),t.play())},1e3)}startEmbeddedMedia(e){let t=!!B(e.target,`html`),n=!!B(e.target,`.present`);t&&n&&(e.target.paused||e.target.ended)&&(e.target.currentTime=0,this.playMediaElement(e.target)),e.target.removeEventListener(`loadeddata`,this.startEmbeddedMedia)}playMediaElement(e){let t=e.play();t&&typeof t.catch==`function`&&t.then(()=>{e.muted||(this.allowedToPlayAudio=!0)}).catch(t=>{if(t.name===`NotAllowedError`){if(this.allowedToPlayAudio=!1,e.tagName===`VIDEO`){this.onVideoPlaybackNotAllowed(e);let t=!!B(e,`html`),n=!!B(e,`.present`),r=e.muted;t&&n&&!r&&(e.setAttribute(`data-muted-by-reveal`,`true`),e.muted=!0,e.play().catch(()=>{this.onMutedVideoPlaybackNotAllowed(e)}))}else e.tagName===`AUDIO`&&this.onAudioPlaybackNotAllowed(e)}})}startEmbeddedIframe(e){let t=e.target;if(this.preventIframeAutoFocus(e),t&&t.contentWindow){let n=!!B(e.target,`html`),r=!!B(e.target,`.present`);if(n&&r){let e=this.Reveal.getConfig().autoPlayMedia;typeof e!=`boolean`&&(e=t.hasAttribute(`data-autoplay`)||!!B(t,`.slide-background`)),/youtube\.com\/embed\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"event":"command","func":"playVideo","args":""}`,`*`):/player\.vimeo\.com\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"method":"play"}`,`*`):t.contentWindow.postMessage(`slide:start`,`*`)}}}stopEmbeddedContent(e,t={}){t=L({unloadIframes:!0},t),e&&e.parentNode&&(R(e,`video, audio`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&typeof e.pause==`function`&&(e.setAttribute(`data-paused-by-reveal`,``),e.pause(),Ee&&e.removeEventListener(`canplay`,this.ensureMobileMediaPlaying))}),R(e,`iframe`).forEach(e=>{e.contentWindow&&e.contentWindow.postMessage(`slide:stop`,`*`),e.removeEventListener(`load`,this.preventIframeAutoFocus),e.removeEventListener(`load`,this.startEmbeddedIframe)}),R(e,`iframe[src*="youtube.com/embed/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"event":"command","func":"pauseVideo","args":""}`,`*`)}),R(e,`iframe[src*="player.vimeo.com/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"method":"pause"}`,`*`)}),t.unloadIframes===!0&&R(e,`iframe[data-src]`).forEach(e=>{e.setAttribute(`src`,`about:blank`),e.removeAttribute(`src`)}))}isAllowedToPlayAudio(){return this.allowedToPlayAudio}showPlayOrUnmuteButton(){let e=this.failedAudioPlaybackTargets.size,t=this.failedVideoPlaybackTargets.size,n=this.failedMutedVideoPlaybackTargets.size,r=`Play media`;n>0?r=`Play video`:t>0?r=`Unmute video`:e>0&&(r=`Play audio`),this.mediaPlayButton.textContent=r,this.Reveal.getRevealElement().appendChild(this.mediaPlayButton)}onAudioPlaybackNotAllowed(e){this.failedAudioPlaybackTargets.add(e),this.showPlayOrUnmuteButton(e)}onVideoPlaybackNotAllowed(e){this.failedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}onMutedVideoPlaybackNotAllowed(e){this.failedMutedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}resetTemporarilyMutedMedia(){new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{e.hasAttribute(`data-muted-by-reveal`)&&(e.muted=!1,e.removeAttribute(`data-muted-by-reveal`))})}clearMediaPlaybackErrors(){this.resetTemporarilyMutedMedia(),this.failedAudioPlaybackTargets.clear(),this.failedVideoPlaybackTargets.clear(),this.failedMutedVideoPlaybackTargets.clear(),this.mediaPlayButton&&this.mediaPlayButton.parentNode&&this.mediaPlayButton.remove()}preventIframeAutoFocus(e){let t=e.target;if(t&&this.Reveal.getConfig().preventIframeAutoFocus){let e=0,n=()=>{document.activeElement===t?document.activeElement.blur():e<1e3&&(e+=100,setTimeout(n,100))};setTimeout(n,100)}}afterSlideChanged(){this.clearMediaPlaybackErrors()}},Ne=`.slides section`,Pe=`.slides>section`,Fe=`.slides>section.present>section`,Ie=`.backgrounds>.slide-background`,Le=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview|previewIframe/,Re=class{constructor(e){this.Reveal=e}render(){this.element=document.createElement(`div`),this.element.className=`slide-number`,this.Reveal.getRevealElement().appendChild(this.element)}configure(e,t){let n=`none`;e.slideNumber&&!this.Reveal.isPrintView()&&(e.showSlideNumber===`all`||e.showSlideNumber===`speaker`&&this.Reveal.isSpeakerNotes())&&(n=`block`),this.element.style.display=n}update(){this.Reveal.getConfig().slideNumber&&this.element&&(this.element.innerHTML=this.getSlideNumber())}getSlideNumber(e=this.Reveal.getCurrentSlide()){let t=this.Reveal.getConfig(),n,r=`h.v`;if(typeof t.slideNumber==`function`)n=t.slideNumber(e);else{typeof t.slideNumber==`string`&&(r=t.slideNumber),!/c/.test(r)&&this.Reveal.getHorizontalSlides().length===1&&(r=`c`);let i=e&&e.dataset.visibility===`uncounted`?0:1;switch(n=[],r){case`c`:n.push(this.Reveal.getSlidePastCount(e)+i);break;case`c/t`:n.push(this.Reveal.getSlidePastCount(e)+i,`/`,this.Reveal.getTotalSlides());break;default:let t=this.Reveal.getIndices(e);n.push(t.h+i);let a=r===`h/v`?`/`:`.`;this.Reveal.isVerticalSlide(e)&&n.push(a,t.v+1)}}let i=`#`+this.Reveal.location.getHash(e);return this.formatNumber(n[0],n[1],n[2],i)}formatNumber(e,t,n,r=`#`+this.Reveal.location.getHash()){return typeof n==`number`&&!isNaN(n)?`<a href="${r}">
2
2
  <span class="slide-number-a">${e}</span>
3
3
  <span class="slide-number-delimiter">${t}</span>
4
4
  <span class="slide-number-b">${n}</span>
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{D as a,La as o,g as s,oo as c,x as l}from"./cells-CuKxjgjJ.js";import{t as u}from"./compiler-runtime-BQ9S8nyo.js";import{C as d}from"./config-Cyum2gRs.js";import{r as f}from"./utils-B4K466FK.js";import{t as p}from"./session-BykGt6S3.js";import{T as m,_ as h,l as g,p as _}from"./config-BAnYSdpO.js";import{t as v}from"./cn-ldLVeaqm.js";import{t as y}from"./jsx-runtime-B74pBk57.js";import{a as b,c as x,i as S,l as C,n as w,s as T,t as E}from"./alert-dialog-DlL1c-bx.js";import{I as D,It as ee}from"./JsonOutput-c1E0SCoN.js";import{n as te}from"./download-D-MTWucM.js";import{i as O,n as k,r as ne,t as re}from"./tabs-QRT1DYjj.js";import{n as A,t as j}from"./button-M49xxKoi.js";import{n as ie}from"./paths-CzfpItSz.js";import{t as M}from"./arrow-left-DzPJ79ZB.js";import{t as N}from"./copy-RyCOE8jo.js";import{a as P,i as F,n as I,o as L,r as R,t as ae}from"./panels-B5iuV0lM.js";import{t as oe}from"./house-CbkYoQ5W.js";import{t as z}from"./spinner-CGdRKCnw.js";import{l as B,s as V}from"./readonly-python-code-Ctej1jSH.js";import{Gt as H,Ut as U,Wt as W,Xt as G,Zt as K,qt as q}from"./input-DnyzXg4C.js";import{n as J}from"./copy-D03Y7IMR.js";import{t as Y}from"./use-toast-CC89xOwH.js";import{r as se}from"./requests-yTHMxhVa.js";import{t as ce}from"./shell-BSnvn9t7.js";import{t as le}from"./share-BZW3tzEX.js";import{a as ue}from"./cell-link-DRuyhIKm.js";import{n as de,t as fe}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{n as pe}from"./code-visibility-B5QjA0ie.js";import{n as me,t as he}from"./marimo-icons-B_1oPpIE.js";import{o as ge}from"./state-Bo8h64Rn.js";var _e=e(i(),1),X=u(),Z=y(),ve=()=>{let e=(0,X.c)(25),[n,r]=t(ge);if(n===null)return null;let i;e[0]===n?i=e[1]:(i=async()=>{try{await navigator.clipboard.writeText(n),Y({title:`Copied to clipboard`,description:`Error details have been copied to your clipboard.`})}catch{Y({title:`Failed to copy`,description:`Could not copy to clipboard.`,variant:`danger`})}},e[0]=n,e[1]=i);let a=i,o;e[2]===r?o=e[3]:(o=()=>{r(null)},e[2]=r,e[3]=o);let s=o,l=ye,u;e[4]===s?u=e[5]:(u=e=>!e&&s(),e[4]=s,e[5]=u);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{className:`flex items-center gap-2 text-destructive`,children:[(0,Z.jsx)(c,{className:`h-5 w-5`}),`Kernel Startup Failed`]}),(0,Z.jsx)(b,{children:`The kernel failed to start. This usually happens when the package manager can't install your notebook's dependencies.`})]}),e[6]=d):d=e[6];let f;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:`Error Details`}),e[7]=f):f=e[7];let p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(N,{className:`h-3 w-3`}),e[8]=p):p=e[8];let m;e[9]===a?m=e[10]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[f,(0,Z.jsxs)(j,{variant:`outline`,size:`xs`,onClick:a,className:`flex items-center gap-1`,children:[p,`Copy`]})]}),e[9]=a,e[10]=m);let h;e[11]===n?h=e[12]:(h=(0,Z.jsx)(`pre`,{className:`bg-muted p-4 rounded-md text-sm font-mono overflow-auto max-h-80`,children:n}),e[11]=n,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`my-4 overflow-hidden`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(j,{variant:`outline`,onClick:l,className:`flex items-center gap-2`,children:[(0,Z.jsx)(oe,{className:`h-4 w-4`}),`Return to Home`]}),e[16]=_):_=e[16];let v;e[17]===s?v=e[18]:(v=(0,Z.jsxs)(T,{children:[_,(0,Z.jsx)(w,{onClick:s,children:`Dismiss`})]}),e[17]=s,e[18]=v);let y;e[19]!==v||e[20]!==g?(y=(0,Z.jsxs)(S,{className:`max-w-2xl`,children:[d,g,v]}),e[19]=v,e[20]=g,e[21]=y):y=e[21];let D;return e[22]!==y||e[23]!==u?(D=(0,Z.jsx)(E,{open:!0,onOpenChange:u,children:y}),e[22]=y,e[23]=u,e[24]=D):D=e[24],D};function ye(){let e=document.baseURI.split(`?`)[0];window.open(e,`_self`)}var be=e=>{let t=(0,X.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`font-mono text-center text-base text-(--red-11)`,children:(0,Z.jsx)(`p`,{children:n})}),t[0]=n,t[1]=r),r},xe=e=>{let t=(0,X.c)(7),{connection:n,className:r,children:i}=e,a;t[0]!==n.reason||t[1]!==n.state?(a=n.state===m.CLOSED&&(0,Z.jsx)(be,{reason:n.reason}),t[0]=n.reason,t[1]=n.state,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==r||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:r,children:[i,a]}),t[3]=i,t[4]=r,t[5]=a,t[6]=o):o=t[6],o},Q=n(e=>e(s)||!_(e(h).state)),Se=e=>{let t=(0,X.c)(22),{appConfig:n,hideHeader:i}=e,{setCells:o}=a(),{sendComponentValues:s}=se(),c;t[0]===s?c=t[1]:(c=()=>(R.INSTANCE.start(s),Ce),t[0]=s,t[1]=c);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[2]=u):u=t[2],(0,_e.useEffect)(c,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=p(),t[3]=d):d=t[3];let f;t[4]===o?f=t[5]:(f={autoInstantiate:!0,setCells:o,sessionId:d},t[4]=o,t[5]=f);let{connection:m,reconnect:h}=I(f),g=r(l),_;if(t[6]===Symbol.for(`react.memo_cache_sentinel`)){bb0:{if(typeof window>`u`){_=null;break bb0}let e=new URL(window.location.href);if(!e.searchParams.has(`file`)){_=null;break bb0}e.searchParams.delete(`file`);let t=e.searchParams.toString();_=t?`${e.pathname}?${t}`:e.pathname}t[6]=_}else _=t[6];let y=_,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ve,{}),t[7]=b):b=t[7];let x=i?`hidden`:`sm:pt-8`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=y&&(0,Z.jsx)(`div`,{className:`flex items-center px-6 pt-4 sm:-mt-8`,children:(0,Z.jsxs)(`a`,{href:y,"aria-label":`Back to gallery`,className:v(A({variant:`text`,size:`sm`}),`gap-2 px-0 text-muted-foreground hover:text-foreground`),children:[(0,Z.jsx)(M,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:`Back`})]})}),t[8]=S):S=t[8];let C;t[9]!==m||t[10]!==x?(C=(0,Z.jsx)(xe,{connection:m,className:x,children:S}),t[9]=m,t[10]=x,t[11]=C):C=t[11];let w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{className:`mx-auto`}),(0,Z.jsx)(`p`,{className:`text-center text-sm text-muted-foreground mt-2`,children:`Connecting...`})]}),t[12]=w):w=t[12];let T;t[13]===n?T=t[14]:(T=(0,Z.jsx)(L,{requires:Q,delay:2e3,fallback:w,children:(0,Z.jsx)(F,{appConfig:n,mode:`read`})}),t[13]=n,t[14]=T);let E;return t[15]!==n.width||t[16]!==m||t[17]!==g||t[18]!==h||t[19]!==T||t[20]!==C?(E=(0,Z.jsxs)(P,{connection:m,isRunning:g,width:n.width,onReconnect:h,children:[b,C,T]}),t[15]=n.width,t[16]=m,t[17]=g,t[18]=h,t[19]=T,t[20]=C,t[21]=E):E=t[21],E};function Ce(){R.INSTANCE.stop()}var we=()=>{let e=(0,X.c)(3),t=r(o);if(!g()||!t)return null;let n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`span`,{children:[`Static`,` `,(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) font-medium underline`,children:`marimo`}),` `,`notebook - Run or edit for full interactivity`]}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,Z.jsxs)(`div`,{className:`px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm`,"data-testid":`static-notebook-banner`,children:[n,(0,Z.jsx)(`span`,{className:`shrink-0`,children:(0,Z.jsx)(Te,{code:t})})]}),e[1]=t,e[2]=i),i},Te=e=>{let t=(0,X.c)(44),{code:n}=e,r=ie.basename(ue()||`notebook.py`),[i]=d(),a=i.sharing?.molab??!0,o=Ee(window.location.href,r),s=o!==r,c=ce(o),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsx)(j,{"data-testid":`static-notebook-dialog-trigger`,variant:`outline`,size:`xs`,children:`Run or Edit`})}),t[0]=l):l=t[0];let u;t[1]===r?u=t[2]:(u=(0,Z.jsx)(G,{children:r}),t[1]=r,t[2]=u);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) hover:underline font-medium`,children:`marimo`}),t[3]=p):p=t[3];let m=s?`Run it`:`Download it, then run it`,h;t[4]===m?h=t[5]:(h=(0,Z.jsxs)(`p`,{children:[`This is a static`,` `,p,` `,`notebook. `,m,` `,`locally for full interactivity.`]}),t[4]=m,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(ne,{"aria-label":`Package manager`,children:[(0,Z.jsx)(O,{value:`uv`,children:`uv`}),(0,Z.jsx)(O,{value:`pip`,children:`pip`}),(0,Z.jsx)(O,{value:`conda`,children:`conda`})]}),t[6]=g):g=t[6];let _=`uvx marimo edit --sandbox ${c}`,v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(k,{value:`uv`,children:(0,Z.jsx)($,{command:_})}),t[7]=_,t[8]=v);let y=`pip install marimo\nmarimo edit ${c}`,b;t[9]===y?b=t[10]:(b=(0,Z.jsx)(k,{value:`pip`,children:(0,Z.jsx)($,{command:y})}),t[9]=y,t[10]=b);let x=`conda install -c conda-forge marimo\nmarimo edit ${c}`,S;t[11]===x?S=t[12]:(S=(0,Z.jsx)(k,{value:`conda`,children:(0,Z.jsx)($,{command:x})}),t[11]=x,t[12]=S);let C;t[13]!==b||t[14]!==S||t[15]!==v?(C=(0,Z.jsxs)(re,{defaultValue:`uv`,children:[g,v,b,S]}),t[13]=b,t[14]=S,t[15]=v,t[16]=C):C=t[16];let w;t[17]!==n||t[18]!==a?(w=a&&(0,Z.jsx)(De,{code:n}),t[17]=n,t[18]=a,t[19]=w):w=t[19];let T;t[20]!==C||t[21]!==w||t[22]!==h?(T=(0,Z.jsx)(H,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`pt-3 text-left space-y-3`,children:[h,C,w]})}),t[20]=C,t[21]=w,t[22]=h,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==u?(E=(0,Z.jsxs)(q,{children:[u,T]}),t[24]=T,t[25]=u,t[26]=E):E=t[26];let D;t[27]===n?D=t[28]:(D=async()=>{await J(n),Y({title:`Copied to clipboard`})},t[27]=n,t[28]=D);let A;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(N,{className:`w-3 h-3 mr-2`}),t[29]=A):A=t[29];let M;t[30]===D?M=t[31]:(M=(0,Z.jsxs)(j,{"data-testid":`copy-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:D,children:[A,`Copy code`]}),t[30]=D,t[31]=M);let P;t[32]!==n||t[33]!==r?(P=()=>{te(new Blob([n],{type:`text/plain`}),r)},t[32]=n,t[33]=r,t[34]=P):P=t[34];let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(ee,{className:`w-3 h-3 mr-2`}),t[35]=F):F=t[35];let I;t[36]===P?I=t[37]:(I=(0,Z.jsxs)(j,{"data-testid":`download-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:P,children:[F,`Download`]}),t[36]=P,t[37]=I);let L;t[38]!==M||t[39]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[M,I]}),t[38]=M,t[39]=I,t[40]=L):L=t[40];let R;return t[41]!==E||t[42]!==L?(R=(0,Z.jsxs)(U,{children:[l,(0,Z.jsxs)(W,{children:[E,L]})]}),t[41]=E,t[42]=L,t[43]=R):R=t[43],R};function Ee(e,t){let n=new URL(e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return t;let r=n.pathname.endsWith(`.html`)&&n.search===``,i=n.protocol===`https:`&&(n.hostname===`marimo.app`||n.hostname===`links.marimo.app`||n.hostname===`static.marimo.app`&&n.pathname.startsWith(`/static`)||n.pathname.includes(`/notebooks/nb`));return!r&&!i?t:(n.hash=``,n.href)}var $=e=>{let t=(0,X.c)(10),{command:n}=e,r;t[0]===n?r=t[1]:(r=(0,Z.jsx)(`pre`,{className:`p-3 pr-10 font-mono text-(--sky-11) leading-relaxed whitespace-pre-wrap break-all`,children:n}),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=async()=>{await J(n),Y({title:`Command copied to clipboard`})},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(N,{className:`w-3.5 h-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(j,{"aria-label":`Copy command`,className:`absolute right-2 top-2`,variant:`ghost`,size:`icon`,onClick:i,children:a}),t[5]=i,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative rounded-lg border bg-(--sky-2) border-(--sky-7)`,children:[r,o]}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s},De=e=>{let t=(0,X.c)(8),{code:n}=e,r;t[0]===n?r=t[1]:(r=le({code:n,baseUrl:`${f.molab}/new`}),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(me,{size:12,strokeWidth:1.5,className:`mr-1.5 mt-px text-(--grass-11)`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(j,{asChild:!0,variant:`outline`,size:`xs`,className:`shrink-0`,children:(0,Z.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,children:[a,`Open in molab`]})}),t[3]=i,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`p`,{className:`text-sm text-(--sky-12)`,children:[`Run this notebook in `,(0,Z.jsx)(`span`,{className:`font-semibold`,children:`molab`}),`, marimo's cloud-hosted notebook platform.`]}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,Z.jsxs)(`div`,{className:`pt-3 border-t flex gap-2 items-center`,children:[o,s]}),t[6]=o,t[7]=c),c},Oe=e=>{let t=(0,X.c)(17),n=r(pe).kind,i=n===`static`||n===`wasm`,{selectedLayout:a}=B(),o;t[0]===a?o=t[1]:(o=V({selectedLayout:a,isReading:!0,searchParams:new URLSearchParams(window.location.search)}),t[0]=a,t[1]=o);let s=i&&o===`slides`,c;t[2]===s?c=t[3]:(c=!s&&(0,Z.jsx)(we,{}),t[2]=s,t[3]=c);let l;t[4]!==s||t[5]!==e.appConfig?(l=(0,Z.jsx)(Se,{appConfig:e.appConfig,hideHeader:s}),t[4]=s,t[5]=e.appConfig,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==s?(u=i&&!s&&(0,Z.jsx)(ke,{}),t[7]=i,t[8]=s,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(fe,{children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(D,{}),t[14]=f):f=t[14];let p;return t[15]===d?p=t[16]:(p=(0,Z.jsx)(ae,{children:(0,Z.jsxs)(de,{direction:`horizontal`,autoSaveId:`marimo:chrome:v1:run1`,children:[d,f]})}),t[15]=d,t[16]=p),p},ke=()=>{let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`fixed bottom-0 right-0 z-50 print:hidden`,"data-testid":`watermark`,children:(0,Z.jsxs)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:`made with marimo`}),(0,Z.jsx)(he,{className:`h-4 w-auto`})]})}),e[0]=t):t=e[0],t};export{Oe as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{D as a,La as o,g as s,oo as c,x as l}from"./cells-h5u00Nz8.js";import{t as u}from"./compiler-runtime-BQ9S8nyo.js";import{C as d}from"./config-Cyum2gRs.js";import{r as f}from"./utils-B4K466FK.js";import{t as p}from"./session-BykGt6S3.js";import{T as m,_ as h,l as g,p as _}from"./config-BAnYSdpO.js";import{t as v}from"./cn-ldLVeaqm.js";import{t as y}from"./jsx-runtime-B74pBk57.js";import{a as b,c as x,i as S,l as C,n as w,s as T,t as E}from"./alert-dialog-DlL1c-bx.js";import{I as D,It as ee}from"./JsonOutput-Dmq_45PS.js";import{n as te}from"./download-CUgiCx7s.js";import{i as O,n as k,r as ne,t as re}from"./tabs-QRT1DYjj.js";import{n as A,t as j}from"./button-M49xxKoi.js";import{n as ie}from"./paths-CzfpItSz.js";import{t as M}from"./arrow-left-DzPJ79ZB.js";import{t as N}from"./copy-RyCOE8jo.js";import{a as P,i as F,n as I,o as L,r as R,t as ae}from"./panels-DftjTXK1.js";import{t as oe}from"./house-CbkYoQ5W.js";import{t as z}from"./spinner-CGdRKCnw.js";import{l as B,s as V}from"./readonly-python-code-D4YGmSvB.js";import{Jt as H,Qt as U,Xt as W,Yt as G,nn as K,tn as q}from"./input-DPd57MDP.js";import{n as J}from"./copy-D03Y7IMR.js";import{t as Y}from"./use-toast-CC89xOwH.js";import{r as se}from"./requests-yTHMxhVa.js";import{t as ce}from"./shell-BSnvn9t7.js";import{t as le}from"./share-BZW3tzEX.js";import{a as ue}from"./cell-link-BeZAiE1D.js";import{n as de,t as fe}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{n as pe}from"./code-visibility-B5QjA0ie.js";import{n as me,t as he}from"./marimo-icons-B_1oPpIE.js";import{o as ge}from"./state-Bo8h64Rn.js";var _e=e(i(),1),X=u(),Z=y(),ve=()=>{let e=(0,X.c)(25),[n,r]=t(ge);if(n===null)return null;let i;e[0]===n?i=e[1]:(i=async()=>{try{await navigator.clipboard.writeText(n),Y({title:`Copied to clipboard`,description:`Error details have been copied to your clipboard.`})}catch{Y({title:`Failed to copy`,description:`Could not copy to clipboard.`,variant:`danger`})}},e[0]=n,e[1]=i);let a=i,o;e[2]===r?o=e[3]:(o=()=>{r(null)},e[2]=r,e[3]=o);let s=o,l=ye,u;e[4]===s?u=e[5]:(u=e=>!e&&s(),e[4]=s,e[5]=u);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{className:`flex items-center gap-2 text-destructive`,children:[(0,Z.jsx)(c,{className:`h-5 w-5`}),`Kernel Startup Failed`]}),(0,Z.jsx)(b,{children:`The kernel failed to start. This usually happens when the package manager can't install your notebook's dependencies.`})]}),e[6]=d):d=e[6];let f;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:`Error Details`}),e[7]=f):f=e[7];let p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(N,{className:`h-3 w-3`}),e[8]=p):p=e[8];let m;e[9]===a?m=e[10]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[f,(0,Z.jsxs)(j,{variant:`outline`,size:`xs`,onClick:a,className:`flex items-center gap-1`,children:[p,`Copy`]})]}),e[9]=a,e[10]=m);let h;e[11]===n?h=e[12]:(h=(0,Z.jsx)(`pre`,{className:`bg-muted p-4 rounded-md text-sm font-mono overflow-auto max-h-80`,children:n}),e[11]=n,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`my-4 overflow-hidden`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(j,{variant:`outline`,onClick:l,className:`flex items-center gap-2`,children:[(0,Z.jsx)(oe,{className:`h-4 w-4`}),`Return to Home`]}),e[16]=_):_=e[16];let v;e[17]===s?v=e[18]:(v=(0,Z.jsxs)(T,{children:[_,(0,Z.jsx)(w,{onClick:s,children:`Dismiss`})]}),e[17]=s,e[18]=v);let y;e[19]!==v||e[20]!==g?(y=(0,Z.jsxs)(S,{className:`max-w-2xl`,children:[d,g,v]}),e[19]=v,e[20]=g,e[21]=y):y=e[21];let D;return e[22]!==y||e[23]!==u?(D=(0,Z.jsx)(E,{open:!0,onOpenChange:u,children:y}),e[22]=y,e[23]=u,e[24]=D):D=e[24],D};function ye(){let e=document.baseURI.split(`?`)[0];window.open(e,`_self`)}var be=e=>{let t=(0,X.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`font-mono text-center text-base text-(--red-11)`,children:(0,Z.jsx)(`p`,{children:n})}),t[0]=n,t[1]=r),r},xe=e=>{let t=(0,X.c)(7),{connection:n,className:r,children:i}=e,a;t[0]!==n.reason||t[1]!==n.state?(a=n.state===m.CLOSED&&(0,Z.jsx)(be,{reason:n.reason}),t[0]=n.reason,t[1]=n.state,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==r||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:r,children:[i,a]}),t[3]=i,t[4]=r,t[5]=a,t[6]=o):o=t[6],o},Q=n(e=>e(s)||!_(e(h).state)),Se=e=>{let t=(0,X.c)(22),{appConfig:n,hideHeader:i}=e,{setCells:o}=a(),{sendComponentValues:s}=se(),c;t[0]===s?c=t[1]:(c=()=>(R.INSTANCE.start(s),Ce),t[0]=s,t[1]=c);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[2]=u):u=t[2],(0,_e.useEffect)(c,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=p(),t[3]=d):d=t[3];let f;t[4]===o?f=t[5]:(f={autoInstantiate:!0,setCells:o,sessionId:d},t[4]=o,t[5]=f);let{connection:m,reconnect:h}=I(f),g=r(l),_;if(t[6]===Symbol.for(`react.memo_cache_sentinel`)){bb0:{if(typeof window>`u`){_=null;break bb0}let e=new URL(window.location.href);if(!e.searchParams.has(`file`)){_=null;break bb0}e.searchParams.delete(`file`);let t=e.searchParams.toString();_=t?`${e.pathname}?${t}`:e.pathname}t[6]=_}else _=t[6];let y=_,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ve,{}),t[7]=b):b=t[7];let x=i?`hidden`:`sm:pt-8`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=y&&(0,Z.jsx)(`div`,{className:`flex items-center px-6 pt-4 sm:-mt-8`,children:(0,Z.jsxs)(`a`,{href:y,"aria-label":`Back to gallery`,className:v(A({variant:`text`,size:`sm`}),`gap-2 px-0 text-muted-foreground hover:text-foreground`),children:[(0,Z.jsx)(M,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:`Back`})]})}),t[8]=S):S=t[8];let C;t[9]!==m||t[10]!==x?(C=(0,Z.jsx)(xe,{connection:m,className:x,children:S}),t[9]=m,t[10]=x,t[11]=C):C=t[11];let w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{className:`mx-auto`}),(0,Z.jsx)(`p`,{className:`text-center text-sm text-muted-foreground mt-2`,children:`Connecting...`})]}),t[12]=w):w=t[12];let T;t[13]===n?T=t[14]:(T=(0,Z.jsx)(L,{requires:Q,delay:2e3,fallback:w,children:(0,Z.jsx)(F,{appConfig:n,mode:`read`})}),t[13]=n,t[14]=T);let E;return t[15]!==n.width||t[16]!==m||t[17]!==g||t[18]!==h||t[19]!==T||t[20]!==C?(E=(0,Z.jsxs)(P,{connection:m,isRunning:g,width:n.width,onReconnect:h,children:[b,C,T]}),t[15]=n.width,t[16]=m,t[17]=g,t[18]=h,t[19]=T,t[20]=C,t[21]=E):E=t[21],E};function Ce(){R.INSTANCE.stop()}var we=()=>{let e=(0,X.c)(3),t=r(o);if(!g()||!t)return null;let n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`span`,{children:[`Static`,` `,(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) font-medium underline`,children:`marimo`}),` `,`notebook - Run or edit for full interactivity`]}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,Z.jsxs)(`div`,{className:`px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm`,"data-testid":`static-notebook-banner`,children:[n,(0,Z.jsx)(`span`,{className:`shrink-0`,children:(0,Z.jsx)(Te,{code:t})})]}),e[1]=t,e[2]=i),i},Te=e=>{let t=(0,X.c)(44),{code:n}=e,r=ie.basename(ue()||`notebook.py`),[i]=d(),a=i.sharing?.molab??!0,o=Ee(window.location.href,r),s=o!==r,c=ce(o),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsx)(j,{"data-testid":`static-notebook-dialog-trigger`,variant:`outline`,size:`xs`,children:`Run or Edit`})}),t[0]=l):l=t[0];let u;t[1]===r?u=t[2]:(u=(0,Z.jsx)(q,{children:r}),t[1]=r,t[2]=u);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) hover:underline font-medium`,children:`marimo`}),t[3]=p):p=t[3];let m=s?`Run it`:`Download it, then run it`,h;t[4]===m?h=t[5]:(h=(0,Z.jsxs)(`p`,{children:[`This is a static`,` `,p,` `,`notebook. `,m,` `,`locally for full interactivity.`]}),t[4]=m,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(ne,{"aria-label":`Package manager`,children:[(0,Z.jsx)(O,{value:`uv`,children:`uv`}),(0,Z.jsx)(O,{value:`pip`,children:`pip`}),(0,Z.jsx)(O,{value:`conda`,children:`conda`})]}),t[6]=g):g=t[6];let _=`uvx marimo edit --sandbox ${c}`,v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(k,{value:`uv`,children:(0,Z.jsx)($,{command:_})}),t[7]=_,t[8]=v);let y=`pip install marimo\nmarimo edit ${c}`,b;t[9]===y?b=t[10]:(b=(0,Z.jsx)(k,{value:`pip`,children:(0,Z.jsx)($,{command:y})}),t[9]=y,t[10]=b);let x=`conda install -c conda-forge marimo\nmarimo edit ${c}`,S;t[11]===x?S=t[12]:(S=(0,Z.jsx)(k,{value:`conda`,children:(0,Z.jsx)($,{command:x})}),t[11]=x,t[12]=S);let C;t[13]!==b||t[14]!==S||t[15]!==v?(C=(0,Z.jsxs)(re,{defaultValue:`uv`,children:[g,v,b,S]}),t[13]=b,t[14]=S,t[15]=v,t[16]=C):C=t[16];let w;t[17]!==n||t[18]!==a?(w=a&&(0,Z.jsx)(De,{code:n}),t[17]=n,t[18]=a,t[19]=w):w=t[19];let T;t[20]!==C||t[21]!==w||t[22]!==h?(T=(0,Z.jsx)(W,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`pt-3 text-left space-y-3`,children:[h,C,w]})}),t[20]=C,t[21]=w,t[22]=h,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==u?(E=(0,Z.jsxs)(U,{children:[u,T]}),t[24]=T,t[25]=u,t[26]=E):E=t[26];let D;t[27]===n?D=t[28]:(D=async()=>{await J(n),Y({title:`Copied to clipboard`})},t[27]=n,t[28]=D);let A;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(N,{className:`w-3 h-3 mr-2`}),t[29]=A):A=t[29];let M;t[30]===D?M=t[31]:(M=(0,Z.jsxs)(j,{"data-testid":`copy-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:D,children:[A,`Copy code`]}),t[30]=D,t[31]=M);let P;t[32]!==n||t[33]!==r?(P=()=>{te(new Blob([n],{type:`text/plain`}),r)},t[32]=n,t[33]=r,t[34]=P):P=t[34];let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(ee,{className:`w-3 h-3 mr-2`}),t[35]=F):F=t[35];let I;t[36]===P?I=t[37]:(I=(0,Z.jsxs)(j,{"data-testid":`download-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:P,children:[F,`Download`]}),t[36]=P,t[37]=I);let L;t[38]!==M||t[39]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[M,I]}),t[38]=M,t[39]=I,t[40]=L):L=t[40];let R;return t[41]!==E||t[42]!==L?(R=(0,Z.jsxs)(H,{children:[l,(0,Z.jsxs)(G,{children:[E,L]})]}),t[41]=E,t[42]=L,t[43]=R):R=t[43],R};function Ee(e,t){let n=new URL(e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return t;let r=n.pathname.endsWith(`.html`)&&n.search===``,i=n.protocol===`https:`&&(n.hostname===`marimo.app`||n.hostname===`links.marimo.app`||n.hostname===`static.marimo.app`&&n.pathname.startsWith(`/static`)||n.pathname.includes(`/notebooks/nb`));return!r&&!i?t:(n.hash=``,n.href)}var $=e=>{let t=(0,X.c)(10),{command:n}=e,r;t[0]===n?r=t[1]:(r=(0,Z.jsx)(`pre`,{className:`p-3 pr-10 font-mono text-(--sky-11) leading-relaxed whitespace-pre-wrap break-all`,children:n}),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=async()=>{await J(n),Y({title:`Command copied to clipboard`})},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(N,{className:`w-3.5 h-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(j,{"aria-label":`Copy command`,className:`absolute right-2 top-2`,variant:`ghost`,size:`icon`,onClick:i,children:a}),t[5]=i,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative rounded-lg border bg-(--sky-2) border-(--sky-7)`,children:[r,o]}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s},De=e=>{let t=(0,X.c)(8),{code:n}=e,r;t[0]===n?r=t[1]:(r=le({code:n,baseUrl:`${f.molab}/new`}),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(me,{size:12,strokeWidth:1.5,className:`mr-1.5 mt-px text-(--grass-11)`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(j,{asChild:!0,variant:`outline`,size:`xs`,className:`shrink-0`,children:(0,Z.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,children:[a,`Open in molab`]})}),t[3]=i,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`p`,{className:`text-sm text-(--sky-12)`,children:[`Run this notebook in `,(0,Z.jsx)(`span`,{className:`font-semibold`,children:`molab`}),`, marimo's cloud-hosted notebook platform.`]}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,Z.jsxs)(`div`,{className:`pt-3 border-t flex gap-2 items-center`,children:[o,s]}),t[6]=o,t[7]=c),c},Oe=e=>{let t=(0,X.c)(17),n=r(pe).kind,i=n===`static`||n===`wasm`,{selectedLayout:a}=B(),o;t[0]===a?o=t[1]:(o=V({selectedLayout:a,isReading:!0,searchParams:new URLSearchParams(window.location.search)}),t[0]=a,t[1]=o);let s=i&&o===`slides`,c;t[2]===s?c=t[3]:(c=!s&&(0,Z.jsx)(we,{}),t[2]=s,t[3]=c);let l;t[4]!==s||t[5]!==e.appConfig?(l=(0,Z.jsx)(Se,{appConfig:e.appConfig,hideHeader:s}),t[4]=s,t[5]=e.appConfig,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==s?(u=i&&!s&&(0,Z.jsx)(ke,{}),t[7]=i,t[8]=s,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(fe,{children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(D,{}),t[14]=f):f=t[14];let p;return t[15]===d?p=t[16]:(p=(0,Z.jsx)(ae,{children:(0,Z.jsxs)(de,{direction:`horizontal`,autoSaveId:`marimo:chrome:v1:run1`,children:[d,f]})}),t[15]=d,t[16]=p),p},ke=()=>{let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`fixed bottom-0 right-0 z-50 print:hidden`,"data-testid":`watermark`,children:(0,Z.jsxs)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:`made with marimo`}),(0,Z.jsx)(he,{className:`h-4 w-auto`})]})}),e[0]=t):t=e[0],t};export{Oe as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{co as a}from"./cells-CuKxjgjJ.js";import{t as o}from"./compiler-runtime-BQ9S8nyo.js";import{t as s}from"./useEventListener-IRzG-0mH.js";import{T as c,_ as l,v as u,w as d,x as f}from"./config-BAnYSdpO.js";import{t as p}from"./cn-ldLVeaqm.js";import{t as m}from"./jsx-runtime-B74pBk57.js";import{t as h}from"./circle-Bb1IbBVn.js";import{t as g}from"./button-M49xxKoi.js";import{t as _}from"./arrow-down-BFFrjzad.js";import{t as v}from"./check-Wea4hZ6R.js";import{i as y}from"./useNumberFormatter-C4-_TnkF.js";import{t as b}from"./spinner-CGdRKCnw.js";import{t as x}from"./refresh-cw-CEGpOrzd.js";import{t as S}from"./copy-icon-wfSGfX8v.js";import{s as C}from"./useInstallPackage-DnijI-KS.js";import{r as w}from"./panel-context-BPaQeOuV.js";import{l as T,o as E,t as D}from"./state-Bo8h64Rn.js";var O=e(i(),1),k=o(),A=n(null),j=n(e=>e(D).environments.kernel.operations.findLast(e=>e.action===`prepare`)),M=n(e=>{let t=e(D).environments.kernel.operations;return t.findLast(e=>e.action===`sync`&&e.status.kind===`running`)??t.findLast(e=>e.action===`sync`)}),N=n(null),P=n(e=>{let t=e(M),n=e(N),r=n&&n.operation===t&&t?.status.kind!==`running`?n.state:t?.status??{kind:`idle`};return e(D).environments.kernel.restart_required&&(r.kind===`idle`||r.kind===`succeeded`)?{kind:`restart-required`,reason:`Dependency changes are saved; restart the kernel to apply them.`}:r},(e,t,n)=>{t(N,{state:n,operation:e(M)})}),F=n(null),I=n(e=>{let t=e(l),n=!!e(A)?.backend,r=e(P),i=r.kind===`running`,a=r.kind===`restart-required`,o=r.kind===`failed`?r.error:r.kind===`cancelled`?`Sandbox sync was interrupted.`:a?r.reason:null;if(n&&(i||o!==null)&&t.state===c.OPEN)return{kind:`sync`,sandbox:n,title:i?`Syncing sandbox…`:a?`Sandbox restart required`:`Sandbox sync failed`,description:i?`Applying the saved manifest to this notebook’s environment.`:a?`Restart the kernel to use the updated environment.`:`Review the error details, then try again.`,pending:i,error:o};if(t.state===c.CONNECTING)return{kind:t.phase===`reconnecting`?`connection`:`startup`,phase:t.phase,sandbox:n,...t.phase?{"preparing-environment":{title:`Preparing environment…`,description:`Getting this notebook’s Python environment ready. The first start can take a few minutes.`},"starting-kernel":{title:`Starting kernel…`,description:`The environment is prepared. Waiting for the Python kernel to connect to this notebook.`},reconnecting:{title:`Reconnecting…`,description:`The connection was interrupted. Your notebook and existing outputs stay visible while the kernel reconnects.`}}[t.phase]:{title:`Connecting…`,description:`Waiting for the notebook’s kernel to connect.`},pending:!0,error:null};if(t.state===c.CLOSED){let r=t.code===d.KERNEL_STARTUP_ERROR,i=r&&t.phase===`preparing-environment`;return{kind:r?`startup`:`connection`,phase:t.phase,sandbox:n,title:i?`Sandbox setup failed`:r?`Kernel failed to start`:t.reason,description:i?`The notebook can’t run yet.`:r?`The Python kernel could not start. Check the error details, then try again.`:`The connection to the notebook’s kernel was lost.`,pending:!1,error:r?e(E)??t.reason:null}}return null});function L(e){let t=(0,k.c)(11),n=e===void 0?500:e,i=r(I),a=r(u),o=T(i?.pending?n:0),[s,c]=(0,O.useState)(null),l,d;if(t[0]!==a||t[1]!==o||t[2]!==i?(l=()=>{if(i||!a){c(o?i:null);return}let e=setTimeout(()=>c(null),1500);return()=>clearTimeout(e)},d=[i,a,o],t[0]=a,t[1]=o,t[2]=i,t[3]=l,t[4]=d):(l=t[3],d=t[4]),(0,O.useEffect)(l,d),i){let e;return t[5]!==o||t[6]!==i?(e=o?{...i,ready:!1}:null,t[5]=o,t[6]=i,t[7]=e):e=t[7],e}if(a&&s?.pending&&s.sandbox&&s.kind!==`connection`){let e=s.kind===`sync`?`Environment synced`:`Your notebook is ready`,n;return t[8]!==s||t[9]!==e?(n={...s,pending:!1,ready:!0,title:e,description:`The notebook is ready to run.`,error:null},t[8]=s,t[9]=e,t[10]=n):n=t[10],n}return null}var R=n(null),z=n(e=>{let t=e(I);return{preparationId:e(j)?.operation_id,error:t&&!t.pending?t.error??t.title:null}}),B=n(e=>{let t=e(z),n=e(R);return n&&n.preparationId===t.preparationId&&n.error===t.error?n.expanded:e(I)!==null},(e,t,n)=>{t(R,{...e(z),expanded:n})}),V=m();function H(e){let t=e.ownerDocument.getSelection();return t&&!t.isCollapsed&&t.containsNode(e,!0)}function U(e){let t=(0,k.c)(44),{logs:n,label:r,state:i}=e,a=i===void 0?`running`:i,[o,c]=(0,O.useState)(!1),[l,u]=(0,O.useState)(!0),d=(0,O.useRef)(null),f=(0,O.useRef)(null),m=(0,O.useId)(),h=n.trimEnd().split(/\r?\n/),g=a===`failed`?`text-foreground`:a===`running`?`last:text-foreground`:void 0,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e.key===`Escape`&&(e.preventDefault(),c(!1),f.current?.focus())},t[0]=v):v=t[0],s(d,`keydown`,v);let b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{d.current&&H(d.current)&&u(!1)},t[1]=b):b=t[1],s(document,`selectionchange`,b);let x,C;if(t[2]!==o||t[3]!==l||t[4]!==n?(x=()=>{let e=d.current;if(!e)return;let t=e.textContent??``;n.startsWith(t)?n.length>t.length&&e.append(document.createTextNode(n.slice(t.length))):e.textContent=n,o&&l&&!H(e)&&(e.scrollTop=e.scrollHeight)},C=[n,o,l],t[2]=o,t[3]=l,t[4]=n,t[5]=x,t[6]=C):(x=t[5],C=t[6]),(0,O.useLayoutEffect)(x,C),!n.trim())return null;let w=o?`bg-muted/40`:`hover:bg-muted/40`,T;t[7]===w?T=t[8]:(T=p(`relative mt-2.5 min-w-0 contain-inline-size rounded text-muted-foreground`,w),t[7]=w,t[8]=T);let E=o&&`flex items-center pr-1`,D;t[9]===E?D=t[10]:(D=p(E),t[9]=E,t[10]=D);let A=`${o?`Collapse`:`Expand`} ${r}`,j=o?`Collapse output`:`Expand output`,M=o&&`items-center justify-between gap-2 text-xs hover:text-foreground`,N;t[11]===M?N=t[12]:(N=p(`flex w-full min-w-0 rounded px-2.5 py-1 text-left focus-visible:outline-2 focus-visible:outline-ring`,M),t[11]=M,t[12]=N);let P;t[13]===o?P=t[14]:(P=()=>{c(!o),u(!0)},t[13]=o,t[14]=P);let F=o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`leading-5`,children:`Logs`}),(0,V.jsx)(y,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,V.jsx)(`span`,{className:p(`min-w-0 flex-1 font-mono text-[11px] leading-5`,h.length>1&&`[mask-image:linear-gradient(to_bottom,transparent,#000_70%)]`),"aria-hidden":!0,children:h.slice(-3).map((e,t)=>(0,V.jsx)(`span`,{className:p(`block truncate`,g),children:e||`\xA0`},t))}),I;t[15]!==o||t[16]!==m||t[17]!==A||t[18]!==j||t[19]!==N||t[20]!==P||t[21]!==F?(I=(0,V.jsx)(`button`,{ref:f,type:`button`,"aria-label":A,"aria-expanded":o,"aria-controls":m,title:j,className:N,onClick:P,children:F}),t[15]=o,t[16]=m,t[17]=A,t[18]=j,t[19]=N,t[20]=P,t[21]=F,t[22]=I):I=t[22];let L;t[23]!==o||t[24]!==r||t[25]!==n?(L=o&&(0,V.jsx)(S,{value:n,ariaLabel:`Copy ${r}`,tooltip:`Copy output`,className:`size-3.5`,buttonClassName:`size-6 shrink-0 flex items-center justify-center rounded hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring`}),t[23]=o,t[24]=r,t[25]=n,t[26]=L):L=t[26];let R;t[27]!==I||t[28]!==L||t[29]!==D?(R=(0,V.jsxs)(`div`,{className:D,children:[I,L]}),t[27]=I,t[28]=L,t[29]=D,t[30]=R):R=t[30];let z=!o,B;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{let t=e.currentTarget;u(!H(t)&&t.scrollHeight-t.scrollTop-t.clientHeight<12)},t[31]=B):B=t[31];let U;t[32]!==r||t[33]!==m||t[34]!==z?(U=(0,V.jsx)(`pre`,{id:m,ref:d,hidden:z,tabIndex:0,"aria-label":r,className:`max-h-48 overflow-auto overscroll-contain whitespace-pre px-2.5 pb-2.5 font-mono text-[11px] leading-5 scrollbar-thin focus-visible:outline-2 focus-visible:outline-ring`,onScroll:B}),t[32]=r,t[33]=m,t[34]=z,t[35]=U):U=t[35];let W;t[36]!==o||t[37]!==l?(W=o&&!l&&(0,V.jsxs)(`button`,{type:`button`,className:`absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center gap-1 whitespace-nowrap rounded-full border bg-background px-2 py-1 text-xs shadow-xs hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,onClick:()=>{let e=d.current;e&&(H(e)&&e.ownerDocument.getSelection()?.removeAllRanges(),e.focus({preventScroll:!0})),u(!0)},children:[(0,V.jsx)(_,{className:`size-3`,"aria-hidden":!0}),`Jump to latest`]}),t[36]=o,t[37]=l,t[38]=W):W=t[38];let G;return t[39]!==R||t[40]!==U||t[41]!==W||t[42]!==T?(G=(0,V.jsxs)(`div`,{className:T,children:[R,U,W]}),t[39]=R,t[40]=U,t[41]=W,t[42]=T,t[43]=G):G=t[43],G}var W=[{phase:`preparing-environment`,titles:{complete:`Environment prepared`,failed:`Environment setup failed`,pending:`Preparing environment`,waiting:`Prepare environment`},descriptions:{complete:`Python and dependencies are available.`,failed:`Setup could not finish.`,pending:`Set up Python and dependencies.`,waiting:`Set up Python and dependencies.`}},{phase:`starting-kernel`,titles:{complete:`Kernel started`,failed:`Kernel failed to start`,pending:`Starting kernel`,waiting:`Start kernel`},descriptions:{complete:`The notebook is ready to run.`,failed:`The kernel could not connect.`,pending:`Connecting to this notebook.`,waiting:`After the environment is ready.`}}];function G(e){let t=(0,k.c)(5),{phase:n,state:i}=e,a=r(j),o=r(f),s=n===`preparing-environment`,c=s?a?.logs.environment??``:o?.phase===n?o.logs:``,l=a?.operation_id,u=s?`environment preparation output`:`kernel startup output`,d;return t[0]!==c||t[1]!==i||t[2]!==l||t[3]!==u?(d=(0,V.jsx)(U,{logs:c,state:i,label:u},l),t[0]=c,t[1]=i,t[2]=l,t[3]=u,t[4]=d):d=t[4],d}function K(e){let t=(0,k.c)(10),{notice:n}=e,r;t[0]===n.title?r=t[1]:(r=(0,V.jsx)(`output`,{className:`sr-only`,children:n.title}),t[0]=n.title,t[1]=r);let i=n.ready?`Your notebook is ready`:`Getting your notebook ready`,a;t[2]===i?a=t[3]:(a=(0,V.jsx)(`h2`,{className:`text-foreground font-heading text-2xl leading-8 tracking-tight font-normal`,children:i}),t[2]=i,t[3]=a);let o=n.ready?`Your environment and kernel are ready.`:n.pending?`Preparing Python and dependencies for this notebook.`:`Review the setup details below to continue.`,s;t[4]===o?s=t[5]:(s=(0,V.jsx)(`p`,{className:`text-muted-foreground mt-3 text-sm leading-6`,children:o}),t[4]=o,t[5]=s);let c;return t[6]!==r||t[7]!==a||t[8]!==s?(c=(0,V.jsxs)(`header`,{children:[r,a,s]}),t[6]=r,t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function q(e){let t=(0,k.c)(3),{notice:n}=e;if(n.ready){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(v,{className:`size-4 shrink-0 text-(--grass-11)`,"aria-hidden":!0}),t[0]=e):e=t[0],e}if(n.pending){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(b,{className:`size-4 shrink-0 motion-reduce:animate-none`,"aria-hidden":!0}),t[1]=e):e=t[1],e}let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,V.jsx)(a,{className:`size-4 shrink-0 text-(--red-11)`,"aria-hidden":!0}),t[2]=r):r=t[2],r}function J(e){let t=(0,k.c)(14),{notice:n,surface:r}=e,i;t[0]!==n||t[1]!==r?(i=r===`notebook`&&(0,V.jsx)(K,{notice:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=r===`notebook`&&`mt-8`,o;t[3]===a?o=t[4]:(o=p(`space-y-6`,a),t[3]=a,t[4]=o);let s;t[5]!==n||t[6]!==r?(s=W.map((e,t)=>{let{phase:i,titles:a,descriptions:o}=e,s=n.ready||t===0&&n.phase===`starting-kernel`,c=!n.ready&&n.phase===i,l=c&&!n.pending,u=s?`complete`:l?`failed`:c?`pending`:`waiting`;return(0,V.jsxs)(`li`,{"aria-current":c?`step`:void 0,className:`relative flex items-start gap-3`,children:[t===0&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-2 top-6 -bottom-4 border-l border-border`}),(0,V.jsx)(`span`,{className:p(`mt-0.5`,s?`text-(--grass-11)`:`text-muted-foreground`),children:s?(0,V.jsx)(v,{className:`size-4`,"aria-hidden":!0}):c?(0,V.jsx)(q,{notice:n}):(0,V.jsx)(h,{className:`size-4 text-muted-foreground/50`,"aria-hidden":!0})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`div`,{className:p(`text-sm`,l?`text-(--red-11)`:s||c?`text-foreground`:`text-muted-foreground`),children:a[u]}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:o[u]}),r===`sidebar`&&(0,V.jsx)(G,{phase:i,state:l?`failed`:c?`running`:`succeeded`})]})]},i)}),t[5]=n,t[6]=r,t[7]=s):s=t[7];let c;t[8]!==o||t[9]!==s?(c=(0,V.jsx)(`ol`,{className:o,"aria-label":`Notebook startup stages`,children:s}),t[8]=o,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==i||t[12]!==c?(l=(0,V.jsxs)(V.Fragment,{children:[i,c]}),t[11]=i,t[12]=c,t[13]=l):l=t[13],l}function Y(e){let t=(0,k.c)(2),{error:n}=e,r;return t[0]===n?r=t[1]:(r=(0,V.jsx)(`pre`,{tabIndex:0,"aria-label":`Error details`,className:`mt-3 p-3 rounded border bg-muted/30 text-xs text-muted-foreground whitespace-pre min-w-0 max-w-full max-h-52 overflow-auto`,children:n}),t[0]=n,t[1]=r),r}function X(e){let t=(0,k.c)(23),{notice:n}=e,i=r(A),a=r(F),o=r(P);if(n.pending||n.ready)return null;let s;t[0]===n.description?s=t[1]:(s=(0,V.jsx)(`p`,{className:`mt-2 text-foreground`,children:n.description}),t[0]=n.description,t[1]=s);let c;t[2]===n.error?c=t[3]:(c=n.error&&(0,V.jsx)(Y,{error:n.error}),t[2]=n.error,t[3]=c);let l=!a||i?.manifest==null,u;t[4]===a?u=t[5]:(u=()=>a?.editManifest(),t[4]=a,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,V.jsx)(g,{variant:`outline`,size:`xs`,disabled:l,onClick:u,children:`Edit manifest…`}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==n.kind||t[11]!==o?(f=n.kind===`sync`&&o.kind===`restart-required`?(0,V.jsx)(Z,{}):(0,V.jsx)(g,{variant:`text`,size:`xs`,disabled:!a,onClick:()=>a?.sync(),children:`Retry sync`}),t[9]=a,t[10]=n.kind,t[11]=o,t[12]=f):f=t[12];let p;t[13]!==d||t[14]!==f?(p=(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15];let m;t[16]===i?.manifest?m=t[17]:(m=i?.manifest==null&&(0,V.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`A manifest will be available once this new notebook starts.`}),t[16]=i?.manifest,t[17]=m);let h;return t[18]!==s||t[19]!==c||t[20]!==p||t[21]!==m?(h=(0,V.jsxs)(V.Fragment,{children:[s,c,p,m]}),t[18]=s,t[19]=c,t[20]=p,t[21]=m,t[22]=h):h=t[22],h}function Z(){let e=(0,k.c)(2),t=C(),n;return e[0]===t?n=e[1]:(n=(0,V.jsx)(g,{variant:`text`,size:`xs`,onClick:t,children:`Restart Kernel`}),e[0]=t,e[1]=n),n}function Q(e){let t=(0,k.c)(8),{notice:n}=e,r=n.kind===`startup`&&(n.ready||n.phase===`preparing-environment`||n.phase===`starting-kernel`),i;t[0]!==n||t[1]!==r?(i=r?(0,V.jsx)(J,{notice:n,surface:`sidebar`}):(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,role:`status`,children:[(0,V.jsx)(q,{notice:n}),(0,V.jsx)(`h2`,{children:n.title})]}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=(0,V.jsx)(X,{notice:n}),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,V.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function $(e){let t=(0,k.c)(12),{notice:n}=e,r;t[0]===n?r=t[1]:(r=(0,V.jsx)(q,{notice:n}),t[0]=n,t[1]=r);let i;t[2]===n.title?i=t[3]:(i=(0,V.jsx)(`span`,{children:n.title}),t[2]=n.title,t[3]=i);let a;t[4]!==r||t[5]!==i?(a=(0,V.jsxs)(`output`,{className:`flex items-center gap-2 text-xs`,children:[r,i]}),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;t[7]===n?o=t[8]:(o=(0,V.jsx)(X,{notice:n}),t[7]=n,t[8]=o);let s;return t[9]!==a||t[10]!==o?(s=(0,V.jsxs)(`div`,{className:`mb-5 text-sm`,children:[a,o]}),t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function ee(e){let t=(0,k.c)(9),{notice:n}=e,i=r(M);if(!i&&!n)return null;let a;t[0]===n?a=t[1]:(a=n?(0,V.jsx)($,{notice:n}):(0,V.jsx)(`p`,{className:`text-sm`,children:`Environment synced`}),t[0]=n,t[1]=a);let o=i?.operation_id,s=i?.logs.environment??``,c=i?.status.kind===`running`?`running`:i?.status.kind===`succeeded`?`succeeded`:`failed`,l;t[2]!==o||t[3]!==s||t[4]!==c?(l=(0,V.jsx)(U,{logs:s,state:c,label:`sandbox sync output`},o),t[2]=o,t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==a||t[7]!==l?(u=(0,V.jsxs)(`div`,{className:`mt-5 min-w-0`,children:[a,l]}),t[6]=a,t[7]=l,t[8]=u):u=t[8],u}function te(){let e=(0,k.c)(29),n=w(),i=r(u),a=r(I),o=r(j),s=r(f),[c,l]=t(B),d;e[0]!==a||e[1]!==o||e[2]!==s?(d=a?.kind===`startup`?{...a,ready:!1}:o||s?{kind:`startup`,sandbox:!0,title:`Notebook started`,description:`The notebook is ready to run.`,pending:!1,ready:!0,error:null}:null,e[0]=a,e[1]=o,e[2]=s,e[3]=d):d=e[3];let m=d,h=`sandbox-details-${n}`,g=!c,_=i?`shrink-0 max-h-[65%] border-b`:`flex-1`,v;e[4]===_?v=e[5]:(v=p(`min-w-0 overflow-auto p-4`,_),e[4]=_,e[5]=v);let y,b;e[6]===l?(y=e[7],b=e[8]):(y=()=>l(!0),b=()=>l(!0),e[6]=l,e[7]=y,e[8]=b);let x;e[9]===a?x=e[10]:(x=a?.kind===`connection`&&(0,V.jsx)($,{notice:{...a,ready:!1}}),e[9]=a,e[10]=x);let S;e[11]===m?S=e[12]:(S=m&&(0,V.jsx)(Q,{notice:m}),e[11]=m,e[12]=S);let C;e[13]!==i||e[14]!==a?(C=i&&(0,V.jsx)(ee,{notice:a?.kind===`sync`?{...a,ready:!1}:null}),e[13]=i,e[14]=a,e[15]=C):C=e[15];let T;e[16]!==i||e[17]!==a?(T=i&&(!a||a.pending)&&(0,V.jsx)(ne,{}),e[16]=i,e[17]=a,e[18]=T):T=e[18];let E;return e[19]!==h||e[20]!==T||e[21]!==g||e[22]!==v||e[23]!==y||e[24]!==b||e[25]!==x||e[26]!==S||e[27]!==C?(E=(0,V.jsxs)(`section`,{id:h,"aria-label":`Sandbox details`,hidden:g,className:v,onPointerDownCapture:y,onFocusCapture:b,children:[x,S,C,T]}),e[19]=h,e[20]=T,e[21]=g,e[22]=v,e[23]=y,e[24]=b,e[25]=x,e[26]=S,e[27]=C,e[28]=E):E=e[28],E}function ne(){let e=(0,k.c)(14),t=r(A),n=r(F),i=r(P).kind===`running`||!n,a;e[0]===n?a=e[1]:(a=()=>n?.sync(),e[0]=n,e[1]=a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,V.jsx)(x,{className:`size-3`,"aria-hidden":!0}),e[2]=o):o=e[2];let s;e[3]!==i||e[4]!==a?(s=(0,V.jsxs)(g,{variant:`text`,size:`xs`,className:`text-muted-foreground gap-1.5 p-0`,disabled:i,onClick:a,children:[o,`Sync`]}),e[3]=i,e[4]=a,e[5]=s):s=e[5];let c=!n||t?.manifest==null,l;e[6]===n?l=e[7]:(l=()=>n?.editManifest(),e[6]=n,e[7]=l);let u;e[8]!==c||e[9]!==l?(u=(0,V.jsx)(g,{variant:`text`,size:`xs`,className:`text-muted-foreground p-0`,disabled:c,onClick:l,children:`Edit manifest…`}),e[8]=c,e[9]=l,e[10]=u):u=e[10];let d;return e[11]!==s||e[12]!==u?(d=(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mt-5 border-t pt-3`,children:[s,u]}),e[11]=s,e[12]=u,e[13]=d):d=e[13],d}export{B as a,F as c,J as i,A as l,Y as n,L as o,q as r,I as s,te as t,P as u};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{co as a}from"./cells-h5u00Nz8.js";import{t as o}from"./compiler-runtime-BQ9S8nyo.js";import{t as s}from"./useEventListener-IRzG-0mH.js";import{T as c,_ as l,v as u,w as d,x as f}from"./config-BAnYSdpO.js";import{t as p}from"./cn-ldLVeaqm.js";import{t as m}from"./jsx-runtime-B74pBk57.js";import{t as h}from"./circle-Bb1IbBVn.js";import{t as g}from"./button-M49xxKoi.js";import{t as _}from"./arrow-down-BFFrjzad.js";import{t as v}from"./check-Wea4hZ6R.js";import{i as y}from"./useNumberFormatter-BP99Zbyy.js";import{t as b}from"./spinner-CGdRKCnw.js";import{t as x}from"./refresh-cw-CEGpOrzd.js";import{t as S}from"./copy-icon-wfSGfX8v.js";import{s as C}from"./useInstallPackage-CCQcFc6U.js";import{r as w}from"./panel-context-BPaQeOuV.js";import{l as T,o as E,t as D}from"./state-Bo8h64Rn.js";var O=e(i(),1),k=o(),A=n(null),j=n(e=>e(D).environments.kernel.operations.findLast(e=>e.action===`prepare`)),M=n(e=>{let t=e(D).environments.kernel.operations;return t.findLast(e=>e.action===`sync`&&e.status.kind===`running`)??t.findLast(e=>e.action===`sync`)}),N=n(null),P=n(e=>{let t=e(M),n=e(N),r=n&&n.operation===t&&t?.status.kind!==`running`?n.state:t?.status??{kind:`idle`};return e(D).environments.kernel.restart_required&&(r.kind===`idle`||r.kind===`succeeded`)?{kind:`restart-required`,reason:`Dependency changes are saved; restart the kernel to apply them.`}:r},(e,t,n)=>{t(N,{state:n,operation:e(M)})}),F=n(null),I=n(e=>{let t=e(l),n=!!e(A)?.backend,r=e(P),i=r.kind===`running`,a=r.kind===`restart-required`,o=r.kind===`failed`?r.error:r.kind===`cancelled`?`Sandbox sync was interrupted.`:a?r.reason:null;if(n&&(i||o!==null)&&t.state===c.OPEN)return{kind:`sync`,sandbox:n,title:i?`Syncing sandbox…`:a?`Sandbox restart required`:`Sandbox sync failed`,description:i?`Applying the saved manifest to this notebook’s environment.`:a?`Restart the kernel to use the updated environment.`:`Review the error details, then try again.`,pending:i,error:o};if(t.state===c.CONNECTING)return{kind:t.phase===`reconnecting`?`connection`:`startup`,phase:t.phase,sandbox:n,...t.phase?{"preparing-environment":{title:`Preparing environment…`,description:`Getting this notebook’s Python environment ready. The first start can take a few minutes.`},"starting-kernel":{title:`Starting kernel…`,description:`The environment is prepared. Waiting for the Python kernel to connect to this notebook.`},reconnecting:{title:`Reconnecting…`,description:`The connection was interrupted. Your notebook and existing outputs stay visible while the kernel reconnects.`}}[t.phase]:{title:`Connecting…`,description:`Waiting for the notebook’s kernel to connect.`},pending:!0,error:null};if(t.state===c.CLOSED){let r=t.code===d.KERNEL_STARTUP_ERROR,i=r&&t.phase===`preparing-environment`;return{kind:r?`startup`:`connection`,phase:t.phase,sandbox:n,title:i?`Sandbox setup failed`:r?`Kernel failed to start`:t.reason,description:i?`The notebook can’t run yet.`:r?`The Python kernel could not start. Check the error details, then try again.`:`The connection to the notebook’s kernel was lost.`,pending:!1,error:r?e(E)??t.reason:null}}return null});function L(e){let t=(0,k.c)(11),n=e===void 0?500:e,i=r(I),a=r(u),o=T(i?.pending?n:0),[s,c]=(0,O.useState)(null),l,d;if(t[0]!==a||t[1]!==o||t[2]!==i?(l=()=>{if(i||!a){c(o?i:null);return}let e=setTimeout(()=>c(null),1500);return()=>clearTimeout(e)},d=[i,a,o],t[0]=a,t[1]=o,t[2]=i,t[3]=l,t[4]=d):(l=t[3],d=t[4]),(0,O.useEffect)(l,d),i){let e;return t[5]!==o||t[6]!==i?(e=o?{...i,ready:!1}:null,t[5]=o,t[6]=i,t[7]=e):e=t[7],e}if(a&&s?.pending&&s.sandbox&&s.kind!==`connection`){let e=s.kind===`sync`?`Environment synced`:`Your notebook is ready`,n;return t[8]!==s||t[9]!==e?(n={...s,pending:!1,ready:!0,title:e,description:`The notebook is ready to run.`,error:null},t[8]=s,t[9]=e,t[10]=n):n=t[10],n}return null}var R=n(null),z=n(e=>{let t=e(I);return{preparationId:e(j)?.operation_id,error:t&&!t.pending?t.error??t.title:null}}),B=n(e=>{let t=e(z),n=e(R);return n&&n.preparationId===t.preparationId&&n.error===t.error?n.expanded:e(I)!==null},(e,t,n)=>{t(R,{...e(z),expanded:n})}),V=m();function H(e){let t=e.ownerDocument.getSelection();return t&&!t.isCollapsed&&t.containsNode(e,!0)}function U(e){let t=(0,k.c)(44),{logs:n,label:r,state:i}=e,a=i===void 0?`running`:i,[o,c]=(0,O.useState)(!1),[l,u]=(0,O.useState)(!0),d=(0,O.useRef)(null),f=(0,O.useRef)(null),m=(0,O.useId)(),h=n.trimEnd().split(/\r?\n/),g=a===`failed`?`text-foreground`:a===`running`?`last:text-foreground`:void 0,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e.key===`Escape`&&(e.preventDefault(),c(!1),f.current?.focus())},t[0]=v):v=t[0],s(d,`keydown`,v);let b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{d.current&&H(d.current)&&u(!1)},t[1]=b):b=t[1],s(document,`selectionchange`,b);let x,C;if(t[2]!==o||t[3]!==l||t[4]!==n?(x=()=>{let e=d.current;if(!e)return;let t=e.textContent??``;n.startsWith(t)?n.length>t.length&&e.append(document.createTextNode(n.slice(t.length))):e.textContent=n,o&&l&&!H(e)&&(e.scrollTop=e.scrollHeight)},C=[n,o,l],t[2]=o,t[3]=l,t[4]=n,t[5]=x,t[6]=C):(x=t[5],C=t[6]),(0,O.useLayoutEffect)(x,C),!n.trim())return null;let w=o?`bg-muted/40`:`hover:bg-muted/40`,T;t[7]===w?T=t[8]:(T=p(`relative mt-2.5 min-w-0 contain-inline-size rounded text-muted-foreground`,w),t[7]=w,t[8]=T);let E=o&&`flex items-center pr-1`,D;t[9]===E?D=t[10]:(D=p(E),t[9]=E,t[10]=D);let A=`${o?`Collapse`:`Expand`} ${r}`,j=o?`Collapse output`:`Expand output`,M=o&&`items-center justify-between gap-2 text-xs hover:text-foreground`,N;t[11]===M?N=t[12]:(N=p(`flex w-full min-w-0 rounded px-2.5 py-1 text-left focus-visible:outline-2 focus-visible:outline-ring`,M),t[11]=M,t[12]=N);let P;t[13]===o?P=t[14]:(P=()=>{c(!o),u(!0)},t[13]=o,t[14]=P);let F=o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`leading-5`,children:`Logs`}),(0,V.jsx)(y,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,V.jsx)(`span`,{className:p(`min-w-0 flex-1 font-mono text-[11px] leading-5`,h.length>1&&`[mask-image:linear-gradient(to_bottom,transparent,#000_70%)]`),"aria-hidden":!0,children:h.slice(-3).map((e,t)=>(0,V.jsx)(`span`,{className:p(`block truncate`,g),children:e||`\xA0`},t))}),I;t[15]!==o||t[16]!==m||t[17]!==A||t[18]!==j||t[19]!==N||t[20]!==P||t[21]!==F?(I=(0,V.jsx)(`button`,{ref:f,type:`button`,"aria-label":A,"aria-expanded":o,"aria-controls":m,title:j,className:N,onClick:P,children:F}),t[15]=o,t[16]=m,t[17]=A,t[18]=j,t[19]=N,t[20]=P,t[21]=F,t[22]=I):I=t[22];let L;t[23]!==o||t[24]!==r||t[25]!==n?(L=o&&(0,V.jsx)(S,{value:n,ariaLabel:`Copy ${r}`,tooltip:`Copy output`,className:`size-3.5`,buttonClassName:`size-6 shrink-0 flex items-center justify-center rounded hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring`}),t[23]=o,t[24]=r,t[25]=n,t[26]=L):L=t[26];let R;t[27]!==I||t[28]!==L||t[29]!==D?(R=(0,V.jsxs)(`div`,{className:D,children:[I,L]}),t[27]=I,t[28]=L,t[29]=D,t[30]=R):R=t[30];let z=!o,B;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{let t=e.currentTarget;u(!H(t)&&t.scrollHeight-t.scrollTop-t.clientHeight<12)},t[31]=B):B=t[31];let U;t[32]!==r||t[33]!==m||t[34]!==z?(U=(0,V.jsx)(`pre`,{id:m,ref:d,hidden:z,tabIndex:0,"aria-label":r,className:`max-h-48 overflow-auto overscroll-contain whitespace-pre px-2.5 pb-2.5 font-mono text-[11px] leading-5 scrollbar-thin focus-visible:outline-2 focus-visible:outline-ring`,onScroll:B}),t[32]=r,t[33]=m,t[34]=z,t[35]=U):U=t[35];let W;t[36]!==o||t[37]!==l?(W=o&&!l&&(0,V.jsxs)(`button`,{type:`button`,className:`absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center gap-1 whitespace-nowrap rounded-full border bg-background px-2 py-1 text-xs shadow-xs hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,onClick:()=>{let e=d.current;e&&(H(e)&&e.ownerDocument.getSelection()?.removeAllRanges(),e.focus({preventScroll:!0})),u(!0)},children:[(0,V.jsx)(_,{className:`size-3`,"aria-hidden":!0}),`Jump to latest`]}),t[36]=o,t[37]=l,t[38]=W):W=t[38];let G;return t[39]!==R||t[40]!==U||t[41]!==W||t[42]!==T?(G=(0,V.jsxs)(`div`,{className:T,children:[R,U,W]}),t[39]=R,t[40]=U,t[41]=W,t[42]=T,t[43]=G):G=t[43],G}var W=[{phase:`preparing-environment`,titles:{complete:`Environment prepared`,failed:`Environment setup failed`,pending:`Preparing environment`,waiting:`Prepare environment`},descriptions:{complete:`Python and dependencies are available.`,failed:`Setup could not finish.`,pending:`Set up Python and dependencies.`,waiting:`Set up Python and dependencies.`}},{phase:`starting-kernel`,titles:{complete:`Kernel started`,failed:`Kernel failed to start`,pending:`Starting kernel`,waiting:`Start kernel`},descriptions:{complete:`The notebook is ready to run.`,failed:`The kernel could not connect.`,pending:`Connecting to this notebook.`,waiting:`After the environment is ready.`}}];function G(e){let t=(0,k.c)(5),{phase:n,state:i}=e,a=r(j),o=r(f),s=n===`preparing-environment`,c=s?a?.logs.environment??``:o?.phase===n?o.logs:``,l=a?.operation_id,u=s?`environment preparation output`:`kernel startup output`,d;return t[0]!==c||t[1]!==i||t[2]!==l||t[3]!==u?(d=(0,V.jsx)(U,{logs:c,state:i,label:u},l),t[0]=c,t[1]=i,t[2]=l,t[3]=u,t[4]=d):d=t[4],d}function K(e){let t=(0,k.c)(10),{notice:n}=e,r;t[0]===n.title?r=t[1]:(r=(0,V.jsx)(`output`,{className:`sr-only`,children:n.title}),t[0]=n.title,t[1]=r);let i=n.ready?`Your notebook is ready`:`Getting your notebook ready`,a;t[2]===i?a=t[3]:(a=(0,V.jsx)(`h2`,{className:`text-foreground font-heading text-2xl leading-8 tracking-tight font-normal`,children:i}),t[2]=i,t[3]=a);let o=n.ready?`Your environment and kernel are ready.`:n.pending?`Preparing Python and dependencies for this notebook.`:`Review the setup details below to continue.`,s;t[4]===o?s=t[5]:(s=(0,V.jsx)(`p`,{className:`text-muted-foreground mt-3 text-sm leading-6`,children:o}),t[4]=o,t[5]=s);let c;return t[6]!==r||t[7]!==a||t[8]!==s?(c=(0,V.jsxs)(`header`,{children:[r,a,s]}),t[6]=r,t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function q(e){let t=(0,k.c)(3),{notice:n}=e;if(n.ready){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(v,{className:`size-4 shrink-0 text-(--grass-11)`,"aria-hidden":!0}),t[0]=e):e=t[0],e}if(n.pending){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(b,{className:`size-4 shrink-0 motion-reduce:animate-none`,"aria-hidden":!0}),t[1]=e):e=t[1],e}let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,V.jsx)(a,{className:`size-4 shrink-0 text-(--red-11)`,"aria-hidden":!0}),t[2]=r):r=t[2],r}function J(e){let t=(0,k.c)(14),{notice:n,surface:r}=e,i;t[0]!==n||t[1]!==r?(i=r===`notebook`&&(0,V.jsx)(K,{notice:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=r===`notebook`&&`mt-8`,o;t[3]===a?o=t[4]:(o=p(`space-y-6`,a),t[3]=a,t[4]=o);let s;t[5]!==n||t[6]!==r?(s=W.map((e,t)=>{let{phase:i,titles:a,descriptions:o}=e,s=n.ready||t===0&&n.phase===`starting-kernel`,c=!n.ready&&n.phase===i,l=c&&!n.pending,u=s?`complete`:l?`failed`:c?`pending`:`waiting`;return(0,V.jsxs)(`li`,{"aria-current":c?`step`:void 0,className:`relative flex items-start gap-3`,children:[t===0&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-2 top-6 -bottom-4 border-l border-border`}),(0,V.jsx)(`span`,{className:p(`mt-0.5`,s?`text-(--grass-11)`:`text-muted-foreground`),children:s?(0,V.jsx)(v,{className:`size-4`,"aria-hidden":!0}):c?(0,V.jsx)(q,{notice:n}):(0,V.jsx)(h,{className:`size-4 text-muted-foreground/50`,"aria-hidden":!0})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`div`,{className:p(`text-sm`,l?`text-(--red-11)`:s||c?`text-foreground`:`text-muted-foreground`),children:a[u]}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:o[u]}),r===`sidebar`&&(0,V.jsx)(G,{phase:i,state:l?`failed`:c?`running`:`succeeded`})]})]},i)}),t[5]=n,t[6]=r,t[7]=s):s=t[7];let c;t[8]!==o||t[9]!==s?(c=(0,V.jsx)(`ol`,{className:o,"aria-label":`Notebook startup stages`,children:s}),t[8]=o,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==i||t[12]!==c?(l=(0,V.jsxs)(V.Fragment,{children:[i,c]}),t[11]=i,t[12]=c,t[13]=l):l=t[13],l}function Y(e){let t=(0,k.c)(2),{error:n}=e,r;return t[0]===n?r=t[1]:(r=(0,V.jsx)(`pre`,{tabIndex:0,"aria-label":`Error details`,className:`mt-3 p-3 rounded border bg-muted/30 text-xs text-muted-foreground whitespace-pre min-w-0 max-w-full max-h-52 overflow-auto`,children:n}),t[0]=n,t[1]=r),r}function X(e){let t=(0,k.c)(23),{notice:n}=e,i=r(A),a=r(F),o=r(P);if(n.pending||n.ready)return null;let s;t[0]===n.description?s=t[1]:(s=(0,V.jsx)(`p`,{className:`mt-2 text-foreground`,children:n.description}),t[0]=n.description,t[1]=s);let c;t[2]===n.error?c=t[3]:(c=n.error&&(0,V.jsx)(Y,{error:n.error}),t[2]=n.error,t[3]=c);let l=!a||i?.manifest==null,u;t[4]===a?u=t[5]:(u=()=>a?.editManifest(),t[4]=a,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,V.jsx)(g,{variant:`outline`,size:`xs`,disabled:l,onClick:u,children:`Edit manifest…`}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==n.kind||t[11]!==o?(f=n.kind===`sync`&&o.kind===`restart-required`?(0,V.jsx)(Z,{}):(0,V.jsx)(g,{variant:`text`,size:`xs`,disabled:!a,onClick:()=>a?.sync(),children:`Retry sync`}),t[9]=a,t[10]=n.kind,t[11]=o,t[12]=f):f=t[12];let p;t[13]!==d||t[14]!==f?(p=(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15];let m;t[16]===i?.manifest?m=t[17]:(m=i?.manifest==null&&(0,V.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`A manifest will be available once this new notebook starts.`}),t[16]=i?.manifest,t[17]=m);let h;return t[18]!==s||t[19]!==c||t[20]!==p||t[21]!==m?(h=(0,V.jsxs)(V.Fragment,{children:[s,c,p,m]}),t[18]=s,t[19]=c,t[20]=p,t[21]=m,t[22]=h):h=t[22],h}function Z(){let e=(0,k.c)(2),t=C(),n;return e[0]===t?n=e[1]:(n=(0,V.jsx)(g,{variant:`text`,size:`xs`,onClick:t,children:`Restart Kernel`}),e[0]=t,e[1]=n),n}function Q(e){let t=(0,k.c)(8),{notice:n}=e,r=n.kind===`startup`&&(n.ready||n.phase===`preparing-environment`||n.phase===`starting-kernel`),i;t[0]!==n||t[1]!==r?(i=r?(0,V.jsx)(J,{notice:n,surface:`sidebar`}):(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,role:`status`,children:[(0,V.jsx)(q,{notice:n}),(0,V.jsx)(`h2`,{children:n.title})]}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=(0,V.jsx)(X,{notice:n}),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,V.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function $(e){let t=(0,k.c)(12),{notice:n}=e,r;t[0]===n?r=t[1]:(r=(0,V.jsx)(q,{notice:n}),t[0]=n,t[1]=r);let i;t[2]===n.title?i=t[3]:(i=(0,V.jsx)(`span`,{children:n.title}),t[2]=n.title,t[3]=i);let a;t[4]!==r||t[5]!==i?(a=(0,V.jsxs)(`output`,{className:`flex items-center gap-2 text-xs`,children:[r,i]}),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;t[7]===n?o=t[8]:(o=(0,V.jsx)(X,{notice:n}),t[7]=n,t[8]=o);let s;return t[9]!==a||t[10]!==o?(s=(0,V.jsxs)(`div`,{className:`mb-5 text-sm`,children:[a,o]}),t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function ee(e){let t=(0,k.c)(9),{notice:n}=e,i=r(M);if(!i&&!n)return null;let a;t[0]===n?a=t[1]:(a=n?(0,V.jsx)($,{notice:n}):(0,V.jsx)(`p`,{className:`text-sm`,children:`Environment synced`}),t[0]=n,t[1]=a);let o=i?.operation_id,s=i?.logs.environment??``,c=i?.status.kind===`running`?`running`:i?.status.kind===`succeeded`?`succeeded`:`failed`,l;t[2]!==o||t[3]!==s||t[4]!==c?(l=(0,V.jsx)(U,{logs:s,state:c,label:`sandbox sync output`},o),t[2]=o,t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==a||t[7]!==l?(u=(0,V.jsxs)(`div`,{className:`mt-5 min-w-0`,children:[a,l]}),t[6]=a,t[7]=l,t[8]=u):u=t[8],u}function te(){let e=(0,k.c)(29),n=w(),i=r(u),a=r(I),o=r(j),s=r(f),[c,l]=t(B),d;e[0]!==a||e[1]!==o||e[2]!==s?(d=a?.kind===`startup`?{...a,ready:!1}:o||s?{kind:`startup`,sandbox:!0,title:`Notebook started`,description:`The notebook is ready to run.`,pending:!1,ready:!0,error:null}:null,e[0]=a,e[1]=o,e[2]=s,e[3]=d):d=e[3];let m=d,h=`sandbox-details-${n}`,g=!c,_=i?`shrink-0 max-h-[65%] border-b`:`flex-1`,v;e[4]===_?v=e[5]:(v=p(`min-w-0 overflow-auto p-4`,_),e[4]=_,e[5]=v);let y,b;e[6]===l?(y=e[7],b=e[8]):(y=()=>l(!0),b=()=>l(!0),e[6]=l,e[7]=y,e[8]=b);let x;e[9]===a?x=e[10]:(x=a?.kind===`connection`&&(0,V.jsx)($,{notice:{...a,ready:!1}}),e[9]=a,e[10]=x);let S;e[11]===m?S=e[12]:(S=m&&(0,V.jsx)(Q,{notice:m}),e[11]=m,e[12]=S);let C;e[13]!==i||e[14]!==a?(C=i&&(0,V.jsx)(ee,{notice:a?.kind===`sync`?{...a,ready:!1}:null}),e[13]=i,e[14]=a,e[15]=C):C=e[15];let T;e[16]!==i||e[17]!==a?(T=i&&(!a||a.pending)&&(0,V.jsx)(ne,{}),e[16]=i,e[17]=a,e[18]=T):T=e[18];let E;return e[19]!==h||e[20]!==T||e[21]!==g||e[22]!==v||e[23]!==y||e[24]!==b||e[25]!==x||e[26]!==S||e[27]!==C?(E=(0,V.jsxs)(`section`,{id:h,"aria-label":`Sandbox details`,hidden:g,className:v,onPointerDownCapture:y,onFocusCapture:b,children:[x,S,C,T]}),e[19]=h,e[20]=T,e[21]=g,e[22]=v,e[23]=y,e[24]=b,e[25]=x,e[26]=S,e[27]=C,e[28]=E):E=e[28],E}function ne(){let e=(0,k.c)(14),t=r(A),n=r(F),i=r(P).kind===`running`||!n,a;e[0]===n?a=e[1]:(a=()=>n?.sync(),e[0]=n,e[1]=a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,V.jsx)(x,{className:`size-3`,"aria-hidden":!0}),e[2]=o):o=e[2];let s;e[3]!==i||e[4]!==a?(s=(0,V.jsxs)(g,{variant:`text`,size:`xs`,className:`text-muted-foreground gap-1.5 p-0`,disabled:i,onClick:a,children:[o,`Sync`]}),e[3]=i,e[4]=a,e[5]=s):s=e[5];let c=!n||t?.manifest==null,l;e[6]===n?l=e[7]:(l=()=>n?.editManifest(),e[6]=n,e[7]=l);let u;e[8]!==c||e[9]!==l?(u=(0,V.jsx)(g,{variant:`text`,size:`xs`,className:`text-muted-foreground p-0`,disabled:c,onClick:l,children:`Edit manifest…`}),e[8]=c,e[9]=l,e[10]=u):u=e[10];let d;return e[11]!==s||e[12]!==u?(d=(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mt-5 border-t pt-3`,children:[s,u]}),e[11]=s,e[12]=u,e[13]=d):d=e[13],d}export{B as a,F as c,J as i,A as l,Y as n,L as o,q as r,I as s,te as t,P as u};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as ee,t as r,u as te}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{D as ne,I as re,Qr as a,Rt as ie,So as o,xo as ae}from"./cells-CuKxjgjJ.js";import{t as s}from"./compiler-runtime-BQ9S8nyo.js";import{C as oe}from"./config-Cyum2gRs.js";import{_ as se}from"./useEventListener-IRzG-0mH.js";import{n as ce}from"./utils-B4K466FK.js";import{O as c}from"./config-BAnYSdpO.js";import{t as le}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{n as ue}from"./JsonOutput-c1E0SCoN.js";import{t as u}from"./tooltip-B5pI8o2n.js";import{t as d}from"./button-M49xxKoi.js";import{t as f}from"./createLucideIcon-rHn2EdoM.js";import{l as de}from"./layout-BAJKEADQ.js";import{n as fe,t as pe}from"./LazyAnyLanguageCodeMirror-CeTd_wFt.js";import{u as me}from"./toDate-BbJ1_N2T.js";import{t as he}from"./cell-editor-DfRhvA75.js";import{t as ge}from"./spinner-CGdRKCnw.js";import{i as _e}from"./useDeleteCell-BG8LgAEA.js";import{r as ve}from"./requests-yTHMxhVa.js";import{r as ye}from"./useTheme-BkPLyRl9.js";import{n as be,r as xe,t as Se}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{a as Ce}from"./renderShortcut-BnRfkbwf.js";import{n as we,r as Te}from"./panel-context-BPaQeOuV.js";import{t as Ee}from"./kiosk-mode-DCHo0R3W.js";var De=f(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Oe=f(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),p=e(i(),1),ke=s(),m=15,h=c(`marimo:scratchpadHistory:v1`,[],a),Ae=n(!1),je=n(null,(e,t,n)=>{if(n=n.trim(),!n)return;let ee=e(h);t(h,[n,...ee.filter(e=>e!==n)].slice(0,m))}),g=l(),Me={hide_code:!1,disabled:!1},_=()=>{let e=(0,ke.c)(60),n=re(),[i]=oe(),{theme:a}=ye(),s=(0,p.useRef)(null),c=ie(),{createNewCell:l,updateCellCode:f}=ne(),{sendRunScratchpad:m}=ve(),_=we(),v=Te(),y=n.cellRuntime[o],b=y?.output,x=y?.status,S=y?.consoleOutputs,C=n.cellData.__scratch__?.code??``,w=te(je),[T,E]=t(Ae),D=ee(h),O;e[0]!==w||e[1]!==C||e[2]!==m?(O=()=>{m({code:C}),w(C)},e[0]=w,e[1]=C,e[2]=m,e[3]=O):O=e[3];let k=r(O),A;e[4]!==C||e[5]!==l||e[6]!==c?(A=()=>{C.trim()&&l({code:C,before:!1,cellId:c??`__end__`})},e[4]=C,e[5]=l,e[6]=c,e[7]=A):A=e[7];let j=r(A),M;e[8]!==m||e[9]!==f?(M=()=>{f({cellId:o,code:``,formattingChange:!1}),m({code:``});let e=s.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:``}})},e[8]=m,e[9]=f,e[10]=M):M=e[10];let N=r(M),P;e[11]!==E||e[12]!==f?(P=e=>{E(!1),f({cellId:o,code:e,formattingChange:!1});let t=s.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[11]=E,e[12]=f,e[13]=P):P=e[13];let F=r(P),[I,Ne]=(0,p.useState)(),L;e[14]!==F||e[15]!==D||e[16]!==T||e[17]!==a?(L=()=>T?(0,g.jsx)(`div`,{className:`absolute inset-0 z-100 bg-background p-3 border-none overflow-auto`,children:(0,g.jsx)(`div`,{className:`overflow-auto flex flex-col gap-3`,children:D.map((e,t)=>(0,g.jsx)(`div`,{className:`border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden`,onClick:()=>F(e),children:(0,g.jsx)(p.Suspense,{children:(0,g.jsx)(pe,{language:`python`,theme:a,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})})},t))})}):null,e[14]=F,e[15]=D,e[16]=T,e[17]=a,e[18]=L):L=e[18];let R=L,z;e[19]!==N||e[20]!==j||e[21]!==k||e[22]!==D.length||e[23]!==T||e[24]!==E||e[25]!==x?(z=()=>(0,g.jsxs)(`div`,{className:`flex items-center shrink-0 border-b`,children:[(0,g.jsx)(u,{content:Ce(`cell.run`),children:(0,g.jsx)(d,{"data-testid":`scratchpad-run-button`,onClick:k,disabled:T,variant:`text`,size:`xs`,children:(0,g.jsx)(_e,{color:`var(--grass-11)`,size:16})})}),(0,g.jsx)(u,{content:`Clear code and outputs`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:N,children:(0,g.jsx)(De,{size:16})})}),(0,g.jsx)(Ee,{children:(0,g.jsx)(u,{content:`Insert code`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:j,children:(0,g.jsx)(fe,{size:16})})})}),(x===`running`||x===`queued`)&&(0,g.jsx)(ge,{className:`inline`,size:`small`}),(0,g.jsx)(`div`,{className:`flex-1`}),(0,g.jsx)(u,{content:`Toggle history`,children:(0,g.jsx)(d,{size:`xs`,variant:`text`,className:le(T&&`bg-(--sky-3) rounded-none`),onClick:()=>E(!T),disabled:D.length===0,children:(0,g.jsx)(Oe,{size:16})})}),(0,g.jsx)(u,{content:(0,g.jsx)(`span`,{className:`block max-w-prose`,children:`Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file.`}),children:(0,g.jsx)(d,{size:`xs`,variant:`text`,children:(0,g.jsx)(me,{size:16})})})]}),e[19]=N,e[20]=j,e[21]=k,e[22]=D.length,e[23]=T,e[24]=E,e[25]=x,e[26]=z):z=e[26];let B=z,Pe=_===`vertical`,V;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(V=ae.create(o),e[27]=V):V=e[27];let H;e[28]===B?H=e[29]:(H=B(),e[28]=B,e[29]=H);let U;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{s.current=e},e[30]=U):U=e[30];let W;e[31]!==C||e[32]!==k||e[33]!==I||e[34]!==a||e[35]!==i?(W=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(he,{theme:a,showPlaceholder:!1,id:o,code:C,config:Me,status:`idle`,serializedEditorState:null,runCell:k,userConfig:i,editorViewRef:s,setEditorView:U,hidden:!1,showHiddenCode:se.NOOP,languageAdapter:I,setLanguageAdapter:Ne})}),e[31]=C,e[32]=k,e[33]=I,e[34]=a,e[35]=i,e[36]=W):W=e[36];let G;e[37]===R?G=e[38]:(G=R(),e[37]=R,e[38]=G);let K;e[39]!==G||e[40]!==H||e[41]!==W?(K=(0,g.jsx)(Se,{defaultSize:40,minSize:20,maxSize:70,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative`,children:[H,W,G]})}),e[39]=G,e[40]=H,e[41]=W,e[42]=K):K=e[42];let q=Pe?`h-1`:`w-1`,J;e[43]===q?J=e[44]:(J=le(`bg-border hover:bg-primary/50 transition-colors`,q),e[43]=q,e[44]=J);let Y;e[45]===J?Y=e[46]:(Y=(0,g.jsx)(xe,{className:J}),e[45]=J,e[46]=Y);let X;e[47]===b?X=e[48]:(X=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(ue,{allowExpand:!1,output:b,className:ce.outputArea,cellId:o,stale:!1,loading:!1})}),e[47]=b,e[48]=X);let Z;e[49]===S?Z=e[50]:(Z=(0,g.jsx)(`div`,{className:`overflow-auto shrink-0 max-h-[50%]`,children:(0,g.jsx)(de,{consoleOutputs:S,className:`overflow-auto`,stale:!1,interrupted:!1,cellName:`_`,onSubmitDebugger:se.NOOP,cellId:o,debuggerActive:!1})}),e[49]=S,e[50]=Z);let Q;e[51]!==X||e[52]!==Z?(Q=(0,g.jsx)(Se,{defaultSize:60,minSize:20,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col divide-y overflow-hidden`,children:[X,Z]})}),e[51]=X,e[52]=Z,e[53]=Q):Q=e[53];let $;return e[54]!==_||e[55]!==v||e[56]!==K||e[57]!==Y||e[58]!==Q?($=(0,g.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden`,id:V,children:(0,g.jsxs)(be,{direction:_,className:`h-full`,children:[K,Y,Q]},v)}),e[54]=_,e[55]=v,e[56]=K,e[57]=Y,e[58]=Q,e[59]=$):$=e[59],$},v=()=>{let e=(0,ke.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,g.jsx)(_,{}),e[0]=t):t=e[0],t};export{v as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as ee,t as r,u as te}from"./useEvent-Dc9HkKI2.js";import{t as i}from"./react-CUdNIagt.js";import{D as ne,I as re,Qr as a,Rt as ie,So as o,xo as ae}from"./cells-h5u00Nz8.js";import{t as s}from"./compiler-runtime-BQ9S8nyo.js";import{C as oe}from"./config-Cyum2gRs.js";import{_ as se}from"./useEventListener-IRzG-0mH.js";import{n as ce}from"./utils-B4K466FK.js";import{O as c}from"./config-BAnYSdpO.js";import{t as le}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{n as ue}from"./JsonOutput-Dmq_45PS.js";import{t as u}from"./tooltip-B5pI8o2n.js";import{t as d}from"./button-M49xxKoi.js";import{t as f}from"./createLucideIcon-rHn2EdoM.js";import{l as de}from"./layout-giNu7tsO.js";import{n as fe,t as pe}from"./LazyAnyLanguageCodeMirror-CeTd_wFt.js";import{u as me}from"./toDate-BbJ1_N2T.js";import{t as he}from"./cell-editor-BNIogYsY.js";import{t as ge}from"./spinner-CGdRKCnw.js";import{i as _e}from"./useDeleteCell-DSbUjpSC.js";import{r as ve}from"./requests-yTHMxhVa.js";import{r as ye}from"./useTheme-BkPLyRl9.js";import{n as be,r as xe,t as Se}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{a as Ce}from"./renderShortcut-BnRfkbwf.js";import{n as we,r as Te}from"./panel-context-BPaQeOuV.js";import{t as Ee}from"./kiosk-mode-DCHo0R3W.js";var De=f(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Oe=f(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),p=e(i(),1),ke=s(),m=15,h=c(`marimo:scratchpadHistory:v1`,[],a),Ae=n(!1),je=n(null,(e,t,n)=>{if(n=n.trim(),!n)return;let ee=e(h);t(h,[n,...ee.filter(e=>e!==n)].slice(0,m))}),g=l(),Me={hide_code:!1,disabled:!1},_=()=>{let e=(0,ke.c)(60),n=re(),[i]=oe(),{theme:a}=ye(),s=(0,p.useRef)(null),c=ie(),{createNewCell:l,updateCellCode:f}=ne(),{sendRunScratchpad:m}=ve(),_=we(),v=Te(),y=n.cellRuntime[o],b=y?.output,x=y?.status,S=y?.consoleOutputs,C=n.cellData.__scratch__?.code??``,w=te(je),[T,E]=t(Ae),D=ee(h),O;e[0]!==w||e[1]!==C||e[2]!==m?(O=()=>{m({code:C}),w(C)},e[0]=w,e[1]=C,e[2]=m,e[3]=O):O=e[3];let k=r(O),A;e[4]!==C||e[5]!==l||e[6]!==c?(A=()=>{C.trim()&&l({code:C,before:!1,cellId:c??`__end__`})},e[4]=C,e[5]=l,e[6]=c,e[7]=A):A=e[7];let j=r(A),M;e[8]!==m||e[9]!==f?(M=()=>{f({cellId:o,code:``,formattingChange:!1}),m({code:``});let e=s.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:``}})},e[8]=m,e[9]=f,e[10]=M):M=e[10];let N=r(M),P;e[11]!==E||e[12]!==f?(P=e=>{E(!1),f({cellId:o,code:e,formattingChange:!1});let t=s.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[11]=E,e[12]=f,e[13]=P):P=e[13];let F=r(P),[I,Ne]=(0,p.useState)(),L;e[14]!==F||e[15]!==D||e[16]!==T||e[17]!==a?(L=()=>T?(0,g.jsx)(`div`,{className:`absolute inset-0 z-100 bg-background p-3 border-none overflow-auto`,children:(0,g.jsx)(`div`,{className:`overflow-auto flex flex-col gap-3`,children:D.map((e,t)=>(0,g.jsx)(`div`,{className:`border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden`,onClick:()=>F(e),children:(0,g.jsx)(p.Suspense,{children:(0,g.jsx)(pe,{language:`python`,theme:a,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})})},t))})}):null,e[14]=F,e[15]=D,e[16]=T,e[17]=a,e[18]=L):L=e[18];let R=L,z;e[19]!==N||e[20]!==j||e[21]!==k||e[22]!==D.length||e[23]!==T||e[24]!==E||e[25]!==x?(z=()=>(0,g.jsxs)(`div`,{className:`flex items-center shrink-0 border-b`,children:[(0,g.jsx)(u,{content:Ce(`cell.run`),children:(0,g.jsx)(d,{"data-testid":`scratchpad-run-button`,onClick:k,disabled:T,variant:`text`,size:`xs`,children:(0,g.jsx)(_e,{color:`var(--grass-11)`,size:16})})}),(0,g.jsx)(u,{content:`Clear code and outputs`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:N,children:(0,g.jsx)(De,{size:16})})}),(0,g.jsx)(Ee,{children:(0,g.jsx)(u,{content:`Insert code`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:j,children:(0,g.jsx)(fe,{size:16})})})}),(x===`running`||x===`queued`)&&(0,g.jsx)(ge,{className:`inline`,size:`small`}),(0,g.jsx)(`div`,{className:`flex-1`}),(0,g.jsx)(u,{content:`Toggle history`,children:(0,g.jsx)(d,{size:`xs`,variant:`text`,className:le(T&&`bg-(--sky-3) rounded-none`),onClick:()=>E(!T),disabled:D.length===0,children:(0,g.jsx)(Oe,{size:16})})}),(0,g.jsx)(u,{content:(0,g.jsx)(`span`,{className:`block max-w-prose`,children:`Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file.`}),children:(0,g.jsx)(d,{size:`xs`,variant:`text`,children:(0,g.jsx)(me,{size:16})})})]}),e[19]=N,e[20]=j,e[21]=k,e[22]=D.length,e[23]=T,e[24]=E,e[25]=x,e[26]=z):z=e[26];let B=z,Pe=_===`vertical`,V;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(V=ae.create(o),e[27]=V):V=e[27];let H;e[28]===B?H=e[29]:(H=B(),e[28]=B,e[29]=H);let U;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{s.current=e},e[30]=U):U=e[30];let W;e[31]!==C||e[32]!==k||e[33]!==I||e[34]!==a||e[35]!==i?(W=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(he,{theme:a,showPlaceholder:!1,id:o,code:C,config:Me,status:`idle`,serializedEditorState:null,runCell:k,userConfig:i,editorViewRef:s,setEditorView:U,hidden:!1,showHiddenCode:se.NOOP,languageAdapter:I,setLanguageAdapter:Ne})}),e[31]=C,e[32]=k,e[33]=I,e[34]=a,e[35]=i,e[36]=W):W=e[36];let G;e[37]===R?G=e[38]:(G=R(),e[37]=R,e[38]=G);let K;e[39]!==G||e[40]!==H||e[41]!==W?(K=(0,g.jsx)(Se,{defaultSize:40,minSize:20,maxSize:70,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative`,children:[H,W,G]})}),e[39]=G,e[40]=H,e[41]=W,e[42]=K):K=e[42];let q=Pe?`h-1`:`w-1`,J;e[43]===q?J=e[44]:(J=le(`bg-border hover:bg-primary/50 transition-colors`,q),e[43]=q,e[44]=J);let Y;e[45]===J?Y=e[46]:(Y=(0,g.jsx)(xe,{className:J}),e[45]=J,e[46]=Y);let X;e[47]===b?X=e[48]:(X=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(ue,{allowExpand:!1,output:b,className:ce.outputArea,cellId:o,stale:!1,loading:!1})}),e[47]=b,e[48]=X);let Z;e[49]===S?Z=e[50]:(Z=(0,g.jsx)(`div`,{className:`overflow-auto shrink-0 max-h-[50%]`,children:(0,g.jsx)(de,{consoleOutputs:S,className:`overflow-auto`,stale:!1,interrupted:!1,cellName:`_`,onSubmitDebugger:se.NOOP,cellId:o,debuggerActive:!1})}),e[49]=S,e[50]=Z);let Q;e[51]!==X||e[52]!==Z?(Q=(0,g.jsx)(Se,{defaultSize:60,minSize:20,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col divide-y overflow-hidden`,children:[X,Z]})}),e[51]=X,e[52]=Z,e[53]=Q):Q=e[53];let $;return e[54]!==_||e[55]!==v||e[56]!==K||e[57]!==Y||e[58]!==Q?($=(0,g.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden`,id:V,children:(0,g.jsxs)(be,{direction:_,className:`h-full`,children:[K,Y,Q]},v)}),e[54]=_,e[55]=v,e[56]=K,e[57]=Y,e[58]=Q,e[59]=$):$=e[59],$},v=()=>{let e=(0,ke.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,g.jsx)(_,{}),e[0]=t):t=e[0],t};export{v as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CUdNIagt.js";import{t as n}from"./compiler-runtime-BQ9S8nyo.js";import{t as r}from"./cn-ldLVeaqm.js";import{t as i}from"./jsx-runtime-B74pBk57.js";import{t as a}from"./check-Wea4hZ6R.js";import{t as o}from"./copy-RyCOE8jo.js";import{T as s,b as c,n as l,t as u,v as d}from"./write-secret-modal-DknTu1O1.js";import{t as f}from"./spinner-CGdRKCnw.js";import{t as p}from"./plus-gbN72xHe.js";import{n as m}from"./copy-D03Y7IMR.js";import{t as h}from"./use-toast-CC89xOwH.js";import{t as g}from"./badge-DFf033uX.js";import{n as _}from"./useAsyncData-DucTwMkf.js";import{n as v}from"./error-banner-D1_bPN9u.js";import{a as y,i as b,n as x,o as S,r as C,t as w}from"./table-Dg1KxH-q.js";import{n as T,r as E,t as D}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{t as O}from"./empty-state-CzxjZqGW.js";var k=n(),A=e(t(),1),j=i(),M=()=>{let e=(0,k.c)(27),{openModal:t,closeModal:n}=c(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],e[0]=r):r=e[0];let{data:i,isPending:a,error:o,refetch:l}=_(P,r);if(a){let t;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,j.jsx)(f,{size:`medium`,centered:!0}),e[1]=t):t=e[1],t}if(o){let t;return e[2]===o?t=e[3]:(t=(0,j.jsx)(v,{error:o}),e[2]=o,e[3]=t),t}let d;e[4]===i?d=e[5]:(d=i.filter(F).map(I),e[4]=i,e[5]=d);let m=d;if(i.length===0){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,j.jsx)(O,{title:`No environment variables`,description:`No environment variables are available in this notebook.`,icon:(0,j.jsx)(s,{})}),e[6]=t):t=e[6],t}let h;e[7]!==n||e[8]!==t||e[9]!==m||e[10]!==l?(h=()=>t((0,j.jsx)(u,{providerNames:m,onSuccess:()=>{l(),n()},onClose:n})),e[7]=n,e[8]=t,e[9]=m,e[10]=l,e[11]=h):h=e[11];let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,j.jsx)(p,{className:`h-4 w-4`}),e[12]=g):g=e[12];let C;e[13]===h?C=e[14]:(C=(0,j.jsx)(`div`,{className:`flex justify-start h-8 border-b`,children:(0,j.jsx)(`button`,{type:`button`,className:`border-r px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,onClick:h,children:g})}),e[13]=h,e[14]=C);let A;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,j.jsx)(y,{children:(0,j.jsxs)(S,{children:[(0,j.jsx)(b,{children:`Environment Variable`}),(0,j.jsx)(b,{children:`Source`}),(0,j.jsx)(b,{})]})}),e[15]=A):A=e[15];let M;e[16]===i?M=e[17]:(M=i.map(L),e[16]=i,e[17]=M);let N;e[18]===M?N=e[19]:(N=(0,j.jsxs)(w,{className:`overflow-auto flex-1 mb-16`,children:[A,(0,j.jsx)(x,{children:M})]}),e[18]=M,e[19]=N);let R;e[20]!==C||e[21]!==N?(R=(0,j.jsx)(D,{defaultSize:50,minSize:30,maxSize:80,children:(0,j.jsxs)(`div`,{className:`flex flex-col h-full`,children:[C,N]})}),e[20]=C,e[21]=N,e[22]=R):R=e[22];let z;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,j.jsx)(E,{className:`w-1 bg-border hover:bg-primary/50 transition-colors`}),e[23]=z):z=e[23];let B;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,j.jsx)(D,{defaultSize:50,children:(0,j.jsx)(`div`,{})}),e[24]=B):B=e[24];let V;return e[25]===R?V=e[26]:(V=(0,j.jsxs)(T,{direction:`horizontal`,className:`h-full`,children:[R,z,B]}),e[25]=R,e[26]=V),V},N=e=>{let t=(0,k.c)(9),{className:n,ariaLabel:r,onCopy:i}=e,[s,c]=A.useState(!1),l;t[0]===i?l=t[1]:(l=()=>{i(),c(!0),setTimeout(()=>c(!1),1e3)},t[0]=i,t[1]=l);let u=l,d;t[2]===s?d=t[3]:(d=s?(0,j.jsx)(a,{className:`w-3 h-3 text-green-700 rounded`}):(0,j.jsx)(o,{className:`w-3 h-3 hover:bg-muted rounded`}),t[2]=s,t[3]=d);let f;return t[4]!==r||t[5]!==n||t[6]!==u||t[7]!==d?(f=(0,j.jsx)(`button`,{type:`button`,className:n,onClick:u,"aria-label":r,children:d}),t[4]=r,t[5]=n,t[6]=u,t[7]=d,t[8]=f):f=t[8],f};async function P(){let e=await d.request({});return l(e.secrets)}function F(e){return e.provider!==`env`}function I(e){return e.name}function L(e){return e.keys.map(t=>(0,j.jsxs)(S,{className:`group`,children:[(0,j.jsx)(C,{children:t}),(0,j.jsx)(C,{children:e.provider!==`env`&&(0,j.jsx)(g,{variant:`outline`,className:`select-none`,children:e.name})}),(0,j.jsx)(C,{children:(0,j.jsx)(N,{ariaLabel:`Copy ${t}`,onCopy:async()=>{await m(`os.environ["${t}"]`),h({title:`Copied to clipboard`,description:`os.environ["${t}"] has been copied to your clipboard.`})},className:r(`float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground`,`invisible group-hover:visible`)})})]},`${e.name}-${t}`))}export{M as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CUdNIagt.js";import{t as n}from"./compiler-runtime-BQ9S8nyo.js";import{t as r}from"./cn-ldLVeaqm.js";import{t as i}from"./jsx-runtime-B74pBk57.js";import{t as a}from"./check-Wea4hZ6R.js";import{t as o}from"./copy-RyCOE8jo.js";import{T as s,b as c,n as l,t as u,v as d}from"./write-secret-modal-BcosCmZy.js";import{t as f}from"./spinner-CGdRKCnw.js";import{t as p}from"./plus-gbN72xHe.js";import{n as m}from"./copy-D03Y7IMR.js";import{t as h}from"./use-toast-CC89xOwH.js";import{t as g}from"./badge-DFf033uX.js";import{n as _}from"./useAsyncData-DucTwMkf.js";import{n as v}from"./error-banner-D1_bPN9u.js";import{a as y,i as b,n as x,o as S,r as C,t as w}from"./table-Dg1KxH-q.js";import{n as T,r as E,t as D}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{t as O}from"./empty-state-CzxjZqGW.js";var k=n(),A=e(t(),1),j=i(),M=()=>{let e=(0,k.c)(27),{openModal:t,closeModal:n}=c(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],e[0]=r):r=e[0];let{data:i,isPending:a,error:o,refetch:l}=_(P,r);if(a){let t;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,j.jsx)(f,{size:`medium`,centered:!0}),e[1]=t):t=e[1],t}if(o){let t;return e[2]===o?t=e[3]:(t=(0,j.jsx)(v,{error:o}),e[2]=o,e[3]=t),t}let d;e[4]===i?d=e[5]:(d=i.filter(F).map(I),e[4]=i,e[5]=d);let m=d;if(i.length===0){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,j.jsx)(O,{title:`No environment variables`,description:`No environment variables are available in this notebook.`,icon:(0,j.jsx)(s,{})}),e[6]=t):t=e[6],t}let h;e[7]!==n||e[8]!==t||e[9]!==m||e[10]!==l?(h=()=>t((0,j.jsx)(u,{providerNames:m,onSuccess:()=>{l(),n()},onClose:n})),e[7]=n,e[8]=t,e[9]=m,e[10]=l,e[11]=h):h=e[11];let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,j.jsx)(p,{className:`h-4 w-4`}),e[12]=g):g=e[12];let C;e[13]===h?C=e[14]:(C=(0,j.jsx)(`div`,{className:`flex justify-start h-8 border-b`,children:(0,j.jsx)(`button`,{type:`button`,className:`border-r px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,onClick:h,children:g})}),e[13]=h,e[14]=C);let A;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,j.jsx)(y,{children:(0,j.jsxs)(S,{children:[(0,j.jsx)(b,{children:`Environment Variable`}),(0,j.jsx)(b,{children:`Source`}),(0,j.jsx)(b,{})]})}),e[15]=A):A=e[15];let M;e[16]===i?M=e[17]:(M=i.map(L),e[16]=i,e[17]=M);let N;e[18]===M?N=e[19]:(N=(0,j.jsxs)(w,{className:`overflow-auto flex-1 mb-16`,children:[A,(0,j.jsx)(x,{children:M})]}),e[18]=M,e[19]=N);let R;e[20]!==C||e[21]!==N?(R=(0,j.jsx)(D,{defaultSize:50,minSize:30,maxSize:80,children:(0,j.jsxs)(`div`,{className:`flex flex-col h-full`,children:[C,N]})}),e[20]=C,e[21]=N,e[22]=R):R=e[22];let z;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,j.jsx)(E,{className:`w-1 bg-border hover:bg-primary/50 transition-colors`}),e[23]=z):z=e[23];let B;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,j.jsx)(D,{defaultSize:50,children:(0,j.jsx)(`div`,{})}),e[24]=B):B=e[24];let V;return e[25]===R?V=e[26]:(V=(0,j.jsxs)(T,{direction:`horizontal`,className:`h-full`,children:[R,z,B]}),e[25]=R,e[26]=V),V},N=e=>{let t=(0,k.c)(9),{className:n,ariaLabel:r,onCopy:i}=e,[s,c]=A.useState(!1),l;t[0]===i?l=t[1]:(l=()=>{i(),c(!0),setTimeout(()=>c(!1),1e3)},t[0]=i,t[1]=l);let u=l,d;t[2]===s?d=t[3]:(d=s?(0,j.jsx)(a,{className:`w-3 h-3 text-green-700 rounded`}):(0,j.jsx)(o,{className:`w-3 h-3 hover:bg-muted rounded`}),t[2]=s,t[3]=d);let f;return t[4]!==r||t[5]!==n||t[6]!==u||t[7]!==d?(f=(0,j.jsx)(`button`,{type:`button`,className:n,onClick:u,"aria-label":r,children:d}),t[4]=r,t[5]=n,t[6]=u,t[7]=d,t[8]=f):f=t[8],f};async function P(){let e=await d.request({});return l(e.secrets)}function F(e){return e.provider!==`env`}function I(e){return e.name}function L(e){return e.keys.map(t=>(0,j.jsxs)(S,{className:`group`,children:[(0,j.jsx)(C,{children:t}),(0,j.jsx)(C,{children:e.provider!==`env`&&(0,j.jsx)(g,{variant:`outline`,className:`select-none`,children:e.name})}),(0,j.jsx)(C,{children:(0,j.jsx)(N,{ariaLabel:`Copy ${t}`,onCopy:async()=>{await m(`os.environ["${t}"]`),h({title:`Copied to clipboard`,description:`os.environ["${t}"] has been copied to your clipboard.`})},className:r(`float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground`,`invisible group-hover:visible`)})})]},`${e.name}-${t}`))}export{M as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CUdNIagt.js";import{t as n}from"./react-dom-CKsE8sC1.js";import{t as r}from"./compiler-runtime-BQ9S8nyo.js";import{o as i,r as a}from"./useEventListener-IRzG-0mH.js";import{n as o,t as s}from"./cn-ldLVeaqm.js";import{t as c}from"./jsx-runtime-B74pBk57.js";import{C as l,S as u,T as d,a as f,b as p,c as m,d as h,f as g,h as _,i as v,l as y,p as b,s as x,v as S,w as C,x as w,y as T}from"./fullscreen-DEBblJKh.js";import{i as E,n as D,r as O,s as k,t as A}from"./dist-Bqtq4wYM.js";import{d as j,t as ee,u as te}from"./menu-items-DAaNKHJF.js";import{r as ne}from"./button-M49xxKoi.js";import{t as M}from"./check-Wea4hZ6R.js";import{a as N,i as re,r as P}from"./useNumberFormatter-C4-_TnkF.js";var F=e(t(),1),I=c(),L=Object.defineProperty,R=F.forwardRef(((e,t)=>L(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,I.jsx)(d.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),z=e(n(),1),B=Object.defineProperty,ie=(e,t)=>B(e,`name`,{value:t,configurable:!0});function V(e){let t=F.useRef({value:e,previous:e});return F.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}ie(V,`usePrevious`);var ae=Object.defineProperty,oe=(e,t)=>ae(e,`name`,{value:t,configurable:!0});function H(e,[t,n]){return Math.min(n,Math.max(t,e))}oe(H,`clamp`);var se=Object.defineProperty,U=(e,t)=>se(e,`name`,{value:t,configurable:!0}),ce=[` `,`Enter`,`ArrowUp`,`ArrowDown`],le=[` `,`Enter`],W=`Select`,[G,K,ue]=j(W),[q,de]=C(W,[ue,E]),fe=E(),[pe,J]=q(W),[me,he]=q(W);function ge(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=fe(t),[_,v]=F.useState(null),[y,b]=F.useState(null),[x,S]=F.useState(!1),C=te(l),[E,D]=w({prop:r,defaultProp:i??!1,onChange:a,caller:W}),[k,A]=w({prop:o,defaultProp:s,onChange:c,caller:W}),j=F.useRef(null),ee=F.useRef(k);F.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=U(()=>A(ee.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,A]);let ne=!_||!!m||!!_.closest(`form`),[M,N]=F.useState(new Set),re=T(),P=Array.from(M).map(e=>e.props.value).join(`;`),L=F.useCallback(e=>{N(t=>new Set(t).add(e))},[]),R=F.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),z={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:re,value:k,onValueChange:A,open:E,onOpenChange:D,dir:C,triggerPointerDownPosRef:j,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:M,nativeSelectKey:P,isFormControl:ne};return(0,I.jsx)(O,{...g,children:(0,I.jsx)(pe,{scope:t,...z,children:(0,I.jsx)(G.Provider,{scope:t,children:(0,I.jsx)(me,{scope:t,onNativeOptionAdd:L,onNativeOptionRemove:R,children:it(h)?h(z):n})})})})}U(ge,`SelectProvider`);var _e=U(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,I.jsx)(ge,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,I.jsxs)(I.Fragment,{children:[n,e?(0,I.jsx)(rt,{__scopeSelect:t}):null]})})},`Select`),ve=`SelectTrigger`,ye=F.forwardRef(U(function(e,t){let{__scopeSelect:n,disabled:r=!1,...a}=e,o=fe(n),s=J(ve,n),c=s.disabled||r,u=i(t,s.onTriggerChange),f=K(n),p=F.useRef(`touch`),[m,h,g]=at(e=>{let t=f().filter(e=>!e.disabled),n=ot(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),_=U(e=>{c||(s.onOpenChange(!0),g()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,I.jsx)(A,{asChild:!0,...o,children:(0,I.jsx)(d.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":Q(s.value)?``:void 0,...a,ref:u,onClick:l(a.onClick,e=>{e.currentTarget.focus(),p.current!==`mouse`&&_(e)}),onPointerDown:l(a.onPointerDown,e=>{p.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:l(a.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&ce.includes(e.key)&&(_(),e.preventDefault())})})})},`SelectTrigger`)),be=`SelectValue`,xe=F.forwardRef(U(function(e,t){let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=J(be,n),{onValueNodeHasChildrenChange:f}=l,p=o!==void 0,m=i(t,l.onValueNodeChange);u(()=>{f(p)},[f,p]);let h=Q(l.value);return(0,I.jsx)(d.span,{...c,asChild:!h&&c.asChild,ref:m,style:{pointerEvents:`none`},children:(0,I.jsx)(F.Fragment,{children:h?s:o},h?`placeholder`:`value`)})},`SelectValue`)),Se=F.forwardRef(U(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,I.jsx)(d.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[Ce,we]=q(`SelectPortal`,{forceMount:void 0}),Te=U(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,I.jsx)(Ce,{scope:e.__scopeSelect,forceMount:n,children:(0,I.jsx)(g,{asChild:!0,...r})})},`SelectPortal`),Y=`SelectContent`,Ee=F.forwardRef(U(function(e,t){let n=we(Y,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=J(Y,e.__scopeSelect),[o,s]=F.useState();return u(()=>{s(new DocumentFragment)},[]),(0,I.jsx)(p,{present:r||a.open,children:({present:e})=>e?(0,I.jsx)(Ae,{...i,ref:t}):(0,I.jsx)(De,{...i,fragment:o})})},`SelectContent`)),De=F.forwardRef(U(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?z.createPortal((0,I.jsx)(Oe,{scope:n,children:(0,I.jsx)(G.Slot,{scope:n,children:(0,I.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),X=10,[Oe,Z]=q(Y),ke=a(`SelectContent.RemoveScroll`),Ae=F.forwardRef(U(function(e,t){let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:g,collisionPadding:v,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=J(Y,n),[E,D]=F.useState(null),[O,k]=F.useState(null),A=i(t,D),[j,ee]=F.useState(null),[te,ne]=F.useState(null),M=K(n),[N,re]=F.useState(!1),P=F.useRef(!1);F.useEffect(()=>{if(E)return m(E)},[E]),h();let L=F.useCallback(e=>{let[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[M,O]),R=F.useCallback(()=>L([j,E]),[L,j,E]);F.useEffect(()=>{N&&R()},[N,R]);let{onOpenChange:z,triggerPointerDownPosRef:B}=T;F.useEffect(()=>{if(E){let e={x:0,y:0},t=U(t=>{e={x:Math.abs(Math.round(t.pageX)-(B.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(B.current?.y??0))}},`handlePointerMove`),n=U(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||z(!1),document.removeEventListener(`pointermove`,t),B.current=null},`handlePointerUp`);return B.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,z,B]),F.useEffect(()=>{let e=U(()=>z(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[z]);let[ie,V]=at(e=>{let t=M().filter(e=>!e.disabled),n=ot(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ae=F.useCallback((e,t,n)=>{let r=!P.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(P.current=!0))},[T.value]),oe=F.useCallback(()=>E?.focus(),[E]),H=F.useCallback((e,t,n)=>{let r=!P.current&&!n;(T.value!==void 0&&T.value===t||r)&&ne(e)},[T.value]),se=r===`popper`?Me:je,ce=se===Me?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:g,collisionPadding:v,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,I.jsx)(Oe,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:ae,selectedItem:j,onItemLeave:oe,itemTextRefCallback:H,focusSelectedItem:R,selectedItemText:te,position:r,isPositioned:N,searchRef:ie,children:(0,I.jsx)(y,{as:ke,allowPinchZoom:!0,children:(0,I.jsx)(b,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,I.jsx)(se,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ce,onPlaced:()=>re(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:l(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&V(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=M().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>L(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),je=F.forwardRef(U(function(e,t){let{__scopeSelect:n,onPlaced:r,...a}=e,o=J(Y,n),s=Z(Y,n),[c,l]=F.useState(null),[f,p]=F.useState(null),m=i(t,p),h=K(n),g=F.useRef(!1),_=F.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=F.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&f&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=f.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=H(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=H(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=h(),s=window.innerHeight-X*2,l=v.scrollHeight,u=window.getComputedStyle(f),d=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=d+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=d+p+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=f.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,d+v.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}c.style.margin=`${X}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,c,f,v,y,b,o.dir,r]);u(()=>S(),[S]);let[C,w]=F.useState();u(()=>{f&&w(window.getComputedStyle(f).zIndex)},[f]);let T=F.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]);return(0,I.jsx)(Ne,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:(0,I.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,I.jsx)(d.div,{...a,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})},`SelectItemAlignedPosition`)),Me=F.forwardRef(U(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=fe(n);return(0,I.jsx)(D,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[Ne,Pe]=q(Y,{}),Fe=`SelectViewport`,Ie=F.forwardRef(U(function(e,t){let{__scopeSelect:n,nonce:r,...a}=e,o=Z(Fe,n),s=Pe(Fe,n),c=i(t,o.onViewportChange),u=F.useRef(0);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,I.jsx)(G.Slot,{scope:n,children:(0,I.jsx)(d.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:l(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})},`SelectViewport`)),[Le,Re]=q(`SelectGroup`),ze=F.forwardRef(U(function(e,t){let{__scopeSelect:n,...r}=e,i=T();return(0,I.jsx)(Le,{scope:n,id:i,children:(0,I.jsx)(d.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})},`SelectGroup`)),Be=`SelectLabel`,Ve=F.forwardRef(U(function(e,t){let{__scopeSelect:n,...r}=e,i=Re(Be,n);return(0,I.jsx)(d.div,{id:i.id,...r,ref:t})},`SelectLabel`)),He=`SelectItem`,[Ue,We]=q(He),Ge=F.forwardRef(U(function(e,t){let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...s}=e,c=J(He,n),u=Z(He,n),f=c.value===r,[p,m]=F.useState(o??``),[h,g]=F.useState(!1),_=S(e=>u.itemRefCallback?.(e,r,a)),v=i(t,_),y=T(),b=F.useRef(`touch`),x=U(()=>{a||(c.onValueChange(r),c.onOpenChange(!1))},`handleSelect`);return(0,I.jsx)(Ue,{scope:n,value:r,disabled:a,textId:y,isSelected:f,onItemTextChange:F.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(G.ItemSlot,{scope:n,value:r,disabled:a,textValue:p,children:(0,I.jsx)(d.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":f&&h,"data-state":f?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:l(s.onFocus,()=>g(!0)),onBlur:l(s.onBlur,()=>g(!1)),onClick:l(s.onClick,()=>{b.current!==`mouse`&&x()}),onPointerUp:l(s.onPointerUp,()=>{b.current===`mouse`&&x()}),onPointerDown:l(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:l(s.onPointerMove,e=>{b.current=e.pointerType,a?u.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:l(s.onKeyDown,e=>{a||e.target!==e.currentTarget||(u.searchRef?.current===``||e.key!==` `)&&(le.includes(e.key)&&x(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Ke=`SelectItemText`,qe=F.forwardRef(U(function(e,t){let{__scopeSelect:n,className:r,style:a,...o}=e,s=J(Ke,n),c=Z(Ke,n),l=We(Ke,n),f=he(Ke,n),[p,m]=F.useState(null),h=S(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),g=i(t,m,l.onItemTextChange,h),_=p?.textContent,v=F.useMemo(()=>(0,I.jsx)(`option`,{value:l.value,disabled:l.disabled,children:_},l.value),[l.disabled,l.value,_]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=f;return u(()=>(y(v),()=>b(v)),[y,b,v]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(d.span,{id:l.textId,...o,ref:g}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!Q(s.value)?z.createPortal(o.children,s.valueNode):null]})},`SelectItemText`)),Je=`SelectItemIndicator`,Ye=F.forwardRef(U(function(e,t){let{__scopeSelect:n,...r}=e;return We(Je,n).isSelected?(0,I.jsx)(d.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Xe=`SelectScrollUpButton`,Ze=F.forwardRef(U(function(e,t){let n=Z(Xe,e.__scopeSelect),r=Pe(Xe,e.__scopeSelect),[a,o]=F.useState(!1),s=i(t,r.onScrollButtonChange);return u(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)};U(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,I.jsx)(et,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Qe=`SelectScrollDownButton`,$e=F.forwardRef(U(function(e,t){let n=Z(Qe,e.__scopeSelect),r=Pe(Qe,e.__scopeSelect),[a,o]=F.useState(!1),s=i(t,r.onScrollButtonChange);return u(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)};U(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,I.jsx)(et,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),et=F.forwardRef(U(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),o=F.useRef(null),s=K(n),c=F.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return F.useEffect(()=>()=>c(),[c]),u(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,I.jsx)(d.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:l(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:l(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:l(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),tt=F.forwardRef(U(function(e,t){let{__scopeSelect:n,...r}=e;return(0,I.jsx)(d.div,{"aria-hidden":!0,...r,ref:t})},`SelectSeparator`)),nt=`SelectBubbleInput`,rt=F.forwardRef(U(function({__scopeSelect:e,...t},n){let r=J(nt,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=F.useRef(null),g=i(n,h),_=a??``,v=V(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return F.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,I.jsxs)(d.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:f,onChange:e=>o(e.target.value),...t,style:{...k,...t.style},ref:g,defaultValue:_,children:[Q(a)&&!y?(0,I.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`SelectBubbleInput`));function it(e){return typeof e==`function`}U(it,`isFunction`);function Q(e){return e===``||e===void 0}U(Q,`shouldShowPlaceholder`);function at(e){let t=S(e),n=F.useRef(``),r=F.useRef(0),i=F.useCallback(e=>{let i=n.current+e;t(i),U((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=F.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return F.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}U(at,`useTypeaheadSearch`);function ot(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=st(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}U(ot,`findNextItem`);function st(e,t){return e.map((n,r)=>e[(t+r)%e.length])}U(st,`wrapArray`);var $=r(),ct=o(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),lt=F.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(ct(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,I.jsx)(R,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});lt.displayName=R.displayName;var ut=o(`flex h-6 w-fit mb-1 items-center justify-between rounded-sm bg-background px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer forced-color-adjust-none forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText] forced-colors:disabled:text-[GrayText]`,{variants:{variant:{default:`shadow-xs-solid border border-input hover:shadow-sm-solid focus-visible:border-primary focus-visible:shadow-md-solid disabled:hover:shadow-xs-solid forced-colors:border-[ButtonText] forced-colors:disabled:border-[GrayText]`,ghost:`opacity-70 hover:opacity-100 focus:opacity-100`}},defaultVariants:{variant:`default`}}),dt=F.forwardRef((e,t)=>{let n=(0,$.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=ne.stopPropagation(),n[4]=o):o=n[4];let c;n[5]===i?c=n[6]:(c=s(ut({}),i),n[5]=i,n[6]=c);let l;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==c?(l=(0,I.jsx)(`select`,{ref:t,onClick:o,className:c,...a,children:r}),n[7]=r,n[8]=a,n[9]=t,n[10]=c,n[11]=l):l=n[11],l});dt.displayName=`NativeSelect`;var ft=_e,pt=ze,mt=v(Te),ht=xe,gt=F.forwardRef((e,t)=>{let n=(0,$.c)(21),r,i,a,o,c,l;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],c=n[5],l=n[6]):({className:i,children:r,onClear:a,variant:l,hideChevron:c,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=c,n[6]=l);let u=c!==void 0&&c,d;n[7]!==i||n[8]!==l?(d=s(ut({variant:l}),`mb-0`,i),n[7]=i,n[8]=l,n[9]=d):d=n[9];let f;n[10]!==u||n[11]!==a?(f=a?(0,I.jsx)(`span`,{onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),a()},children:(0,I.jsx)(P,{className:`h-4 w-4 opacity-50 hover:opacity-90`})}):!u&&(0,I.jsx)(N,{className:`h-4 w-4 opacity-50`}),n[10]=u,n[11]=a,n[12]=f):f=n[12];let p;n[13]===f?p=n[14]:(p=(0,I.jsx)(Se,{asChild:!0,children:f}),n[13]=f,n[14]=p);let m;return n[15]!==r||n[16]!==o||n[17]!==t||n[18]!==d||n[19]!==p?(m=(0,I.jsxs)(ye,{ref:t,className:d,...o,children:[r,p]}),n[15]=r,n[16]=o,n[17]=t,n[18]=d,n[19]=p,n[20]=m):m=n[20],m});gt.displayName=ye.displayName;var _t=f(Ee),vt=F.forwardRef((e,t)=>{let n=(0,$.c)(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,position:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let c=o===void 0?`popper`:o,l=c===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,u;n[5]!==i||n[6]!==l?(u=s(`max-h-[300px] relative z-50 min-w-32 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,l,i),n[5]=i,n[6]=l,n[7]=u):u=n[7];let d;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,I.jsx)(Ze,{className:`flex items-center justify-center h-[20px] bg-background text-muted-foreground cursor-default`,children:(0,I.jsx)(re,{className:`h-4 w-4`})}),n[8]=d):d=n[8];let f=c===`popper`&&`h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)`,p;n[9]===f?p=n[10]:(p=s(`p-1`,f),n[9]=f,n[10]=p);let m;n[11]!==r||n[12]!==p?(m=(0,I.jsx)(Ie,{className:p,children:r}),n[11]=r,n[12]=p,n[13]=m):m=n[13];let h;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,I.jsx)($e,{className:`flex items-center justify-center h-[20px] bg-background text-muted-foreground cursor-default`,children:(0,I.jsx)(N,{className:`h-4 w-4 opacity-50`})}),n[14]=h):h=n[14];let g;return n[15]!==c||n[16]!==a||n[17]!==t||n[18]!==u||n[19]!==m?(g=(0,I.jsx)(mt,{children:(0,I.jsx)(x,{children:(0,I.jsxs)(_t,{ref:t,className:u,position:c,...a,children:[d,m,h]})})}),n[15]=c,n[16]=a,n[17]=t,n[18]=u,n[19]=m,n[20]=g):g=n[20],g});vt.displayName=Ee.displayName;var yt=F.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`px-2 py-1.5 text-sm font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,I.jsx)(Ve,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});yt.displayName=Ve.displayName;var bt=F.forwardRef((e,t)=>{let n=(0,$.c)(17),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,subtitle:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let c;n[5]===i?c=n[6]:(c=s(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-hidden data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground forced-colors:data-[highlighted]:bg-[Highlight] forced-colors:data-[highlighted]:text-[HighlightText]`,ee,i),n[5]=i,n[6]=c);let l;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,I.jsx)(Ye,{children:(0,I.jsx)(M,{className:`h-3 w-3`})})}),n[7]=l):l=n[7];let u=typeof r!=`string`||void 0,d;n[8]!==r||n[9]!==u?(d=(0,I.jsx)(qe,{asChild:u,className:`flex w-full flex-1`,children:r}),n[8]=r,n[9]=u,n[10]=d):d=n[10];let f;return n[11]!==a||n[12]!==t||n[13]!==o||n[14]!==c||n[15]!==d?(f=(0,I.jsxs)(Ge,{ref:t,className:c,...a,children:[l,d,o]}),n[11]=a,n[12]=t,n[13]=o,n[14]=c,n[15]=d,n[16]=f):f=n[16],f});bt.displayName=Ge.displayName;var xt=F.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,I.jsx)(tt,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});xt.displayName=tt.displayName;export{yt as a,ht as c,lt as d,Se as f,V as h,bt as i,dt as l,H as m,vt as n,xt as o,ye as p,pt as r,gt as s,ft as t,ut as u};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CUdNIagt.js";import{t as n}from"./react-dom-CKsE8sC1.js";import{t as r}from"./compiler-runtime-BQ9S8nyo.js";import{o as i,r as a}from"./useEventListener-IRzG-0mH.js";import{n as o,t as s}from"./cn-ldLVeaqm.js";import{t as c}from"./jsx-runtime-B74pBk57.js";import{C as l,S as u,T as d,a as f,b as p,c as m,d as h,f as g,h as _,i as v,l as y,p as b,s as x,v as S,w as C,x as w,y as T}from"./fullscreen-DEBblJKh.js";import{i as E,n as D,r as O,s as k,t as A}from"./dist-Bqtq4wYM.js";import{d as j,t as ee,u as te}from"./menu-items-DAaNKHJF.js";import{r as ne}from"./button-M49xxKoi.js";import{t as M}from"./check-Wea4hZ6R.js";import{a as N,i as re,r as P}from"./useNumberFormatter-BP99Zbyy.js";var F=e(t(),1),I=c(),L=Object.defineProperty,R=F.forwardRef(((e,t)=>L(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,I.jsx)(d.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),z=e(n(),1),B=Object.defineProperty,ie=(e,t)=>B(e,`name`,{value:t,configurable:!0});function V(e){let t=F.useRef({value:e,previous:e});return F.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}ie(V,`usePrevious`);var ae=Object.defineProperty,oe=(e,t)=>ae(e,`name`,{value:t,configurable:!0});function H(e,[t,n]){return Math.min(n,Math.max(t,e))}oe(H,`clamp`);var se=Object.defineProperty,U=(e,t)=>se(e,`name`,{value:t,configurable:!0}),ce=[` `,`Enter`,`ArrowUp`,`ArrowDown`],le=[` `,`Enter`],W=`Select`,[G,K,ue]=j(W),[q,de]=C(W,[ue,E]),fe=E(),[pe,J]=q(W),[me,he]=q(W);function ge(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=fe(t),[_,v]=F.useState(null),[y,b]=F.useState(null),[x,S]=F.useState(!1),C=te(l),[E,D]=w({prop:r,defaultProp:i??!1,onChange:a,caller:W}),[k,A]=w({prop:o,defaultProp:s,onChange:c,caller:W}),j=F.useRef(null),ee=F.useRef(k);F.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=U(()=>A(ee.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,A]);let ne=!_||!!m||!!_.closest(`form`),[M,N]=F.useState(new Set),re=T(),P=Array.from(M).map(e=>e.props.value).join(`;`),L=F.useCallback(e=>{N(t=>new Set(t).add(e))},[]),R=F.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),z={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:re,value:k,onValueChange:A,open:E,onOpenChange:D,dir:C,triggerPointerDownPosRef:j,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:M,nativeSelectKey:P,isFormControl:ne};return(0,I.jsx)(O,{...g,children:(0,I.jsx)(pe,{scope:t,...z,children:(0,I.jsx)(G.Provider,{scope:t,children:(0,I.jsx)(me,{scope:t,onNativeOptionAdd:L,onNativeOptionRemove:R,children:it(h)?h(z):n})})})})}U(ge,`SelectProvider`);var _e=U(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,I.jsx)(ge,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,I.jsxs)(I.Fragment,{children:[n,e?(0,I.jsx)(rt,{__scopeSelect:t}):null]})})},`Select`),ve=`SelectTrigger`,ye=F.forwardRef(U(function(e,t){let{__scopeSelect:n,disabled:r=!1,...a}=e,o=fe(n),s=J(ve,n),c=s.disabled||r,u=i(t,s.onTriggerChange),f=K(n),p=F.useRef(`touch`),[m,h,g]=at(e=>{let t=f().filter(e=>!e.disabled),n=ot(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),_=U(e=>{c||(s.onOpenChange(!0),g()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,I.jsx)(A,{asChild:!0,...o,children:(0,I.jsx)(d.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":Q(s.value)?``:void 0,...a,ref:u,onClick:l(a.onClick,e=>{e.currentTarget.focus(),p.current!==`mouse`&&_(e)}),onPointerDown:l(a.onPointerDown,e=>{p.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:l(a.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&ce.includes(e.key)&&(_(),e.preventDefault())})})})},`SelectTrigger`)),be=`SelectValue`,xe=F.forwardRef(U(function(e,t){let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=J(be,n),{onValueNodeHasChildrenChange:f}=l,p=o!==void 0,m=i(t,l.onValueNodeChange);u(()=>{f(p)},[f,p]);let h=Q(l.value);return(0,I.jsx)(d.span,{...c,asChild:!h&&c.asChild,ref:m,style:{pointerEvents:`none`},children:(0,I.jsx)(F.Fragment,{children:h?s:o},h?`placeholder`:`value`)})},`SelectValue`)),Se=F.forwardRef(U(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,I.jsx)(d.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[Ce,we]=q(`SelectPortal`,{forceMount:void 0}),Te=U(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,I.jsx)(Ce,{scope:e.__scopeSelect,forceMount:n,children:(0,I.jsx)(g,{asChild:!0,...r})})},`SelectPortal`),Y=`SelectContent`,Ee=F.forwardRef(U(function(e,t){let n=we(Y,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=J(Y,e.__scopeSelect),[o,s]=F.useState();return u(()=>{s(new DocumentFragment)},[]),(0,I.jsx)(p,{present:r||a.open,children:({present:e})=>e?(0,I.jsx)(Ae,{...i,ref:t}):(0,I.jsx)(De,{...i,fragment:o})})},`SelectContent`)),De=F.forwardRef(U(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?z.createPortal((0,I.jsx)(Oe,{scope:n,children:(0,I.jsx)(G.Slot,{scope:n,children:(0,I.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),X=10,[Oe,Z]=q(Y),ke=a(`SelectContent.RemoveScroll`),Ae=F.forwardRef(U(function(e,t){let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:g,collisionPadding:v,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=J(Y,n),[E,D]=F.useState(null),[O,k]=F.useState(null),A=i(t,D),[j,ee]=F.useState(null),[te,ne]=F.useState(null),M=K(n),[N,re]=F.useState(!1),P=F.useRef(!1);F.useEffect(()=>{if(E)return m(E)},[E]),h();let L=F.useCallback(e=>{let[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[M,O]),R=F.useCallback(()=>L([j,E]),[L,j,E]);F.useEffect(()=>{N&&R()},[N,R]);let{onOpenChange:z,triggerPointerDownPosRef:B}=T;F.useEffect(()=>{if(E){let e={x:0,y:0},t=U(t=>{e={x:Math.abs(Math.round(t.pageX)-(B.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(B.current?.y??0))}},`handlePointerMove`),n=U(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||z(!1),document.removeEventListener(`pointermove`,t),B.current=null},`handlePointerUp`);return B.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,z,B]),F.useEffect(()=>{let e=U(()=>z(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[z]);let[ie,V]=at(e=>{let t=M().filter(e=>!e.disabled),n=ot(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ae=F.useCallback((e,t,n)=>{let r=!P.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(P.current=!0))},[T.value]),oe=F.useCallback(()=>E?.focus(),[E]),H=F.useCallback((e,t,n)=>{let r=!P.current&&!n;(T.value!==void 0&&T.value===t||r)&&ne(e)},[T.value]),se=r===`popper`?Me:je,ce=se===Me?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:g,collisionPadding:v,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,I.jsx)(Oe,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:ae,selectedItem:j,onItemLeave:oe,itemTextRefCallback:H,focusSelectedItem:R,selectedItemText:te,position:r,isPositioned:N,searchRef:ie,children:(0,I.jsx)(y,{as:ke,allowPinchZoom:!0,children:(0,I.jsx)(b,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,I.jsx)(se,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ce,onPlaced:()=>re(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:l(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&V(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=M().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>L(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),je=F.forwardRef(U(function(e,t){let{__scopeSelect:n,onPlaced:r,...a}=e,o=J(Y,n),s=Z(Y,n),[c,l]=F.useState(null),[f,p]=F.useState(null),m=i(t,p),h=K(n),g=F.useRef(!1),_=F.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=F.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&f&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=f.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=H(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=H(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=h(),s=window.innerHeight-X*2,l=v.scrollHeight,u=window.getComputedStyle(f),d=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=d+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=d+p+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=f.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,d+v.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}c.style.margin=`${X}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,c,f,v,y,b,o.dir,r]);u(()=>S(),[S]);let[C,w]=F.useState();u(()=>{f&&w(window.getComputedStyle(f).zIndex)},[f]);let T=F.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]);return(0,I.jsx)(Ne,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:(0,I.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,I.jsx)(d.div,{...a,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})},`SelectItemAlignedPosition`)),Me=F.forwardRef(U(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=fe(n);return(0,I.jsx)(D,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[Ne,Pe]=q(Y,{}),Fe=`SelectViewport`,Ie=F.forwardRef(U(function(e,t){let{__scopeSelect:n,nonce:r,...a}=e,o=Z(Fe,n),s=Pe(Fe,n),c=i(t,o.onViewportChange),u=F.useRef(0);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,I.jsx)(G.Slot,{scope:n,children:(0,I.jsx)(d.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:l(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})},`SelectViewport`)),[Le,Re]=q(`SelectGroup`),ze=F.forwardRef(U(function(e,t){let{__scopeSelect:n,...r}=e,i=T();return(0,I.jsx)(Le,{scope:n,id:i,children:(0,I.jsx)(d.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})},`SelectGroup`)),Be=`SelectLabel`,Ve=F.forwardRef(U(function(e,t){let{__scopeSelect:n,...r}=e,i=Re(Be,n);return(0,I.jsx)(d.div,{id:i.id,...r,ref:t})},`SelectLabel`)),He=`SelectItem`,[Ue,We]=q(He),Ge=F.forwardRef(U(function(e,t){let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...s}=e,c=J(He,n),u=Z(He,n),f=c.value===r,[p,m]=F.useState(o??``),[h,g]=F.useState(!1),_=S(e=>u.itemRefCallback?.(e,r,a)),v=i(t,_),y=T(),b=F.useRef(`touch`),x=U(()=>{a||(c.onValueChange(r),c.onOpenChange(!1))},`handleSelect`);return(0,I.jsx)(Ue,{scope:n,value:r,disabled:a,textId:y,isSelected:f,onItemTextChange:F.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(G.ItemSlot,{scope:n,value:r,disabled:a,textValue:p,children:(0,I.jsx)(d.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":f&&h,"data-state":f?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:l(s.onFocus,()=>g(!0)),onBlur:l(s.onBlur,()=>g(!1)),onClick:l(s.onClick,()=>{b.current!==`mouse`&&x()}),onPointerUp:l(s.onPointerUp,()=>{b.current===`mouse`&&x()}),onPointerDown:l(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:l(s.onPointerMove,e=>{b.current=e.pointerType,a?u.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:l(s.onKeyDown,e=>{a||e.target!==e.currentTarget||(u.searchRef?.current===``||e.key!==` `)&&(le.includes(e.key)&&x(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Ke=`SelectItemText`,qe=F.forwardRef(U(function(e,t){let{__scopeSelect:n,className:r,style:a,...o}=e,s=J(Ke,n),c=Z(Ke,n),l=We(Ke,n),f=he(Ke,n),[p,m]=F.useState(null),h=S(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),g=i(t,m,l.onItemTextChange,h),_=p?.textContent,v=F.useMemo(()=>(0,I.jsx)(`option`,{value:l.value,disabled:l.disabled,children:_},l.value),[l.disabled,l.value,_]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=f;return u(()=>(y(v),()=>b(v)),[y,b,v]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(d.span,{id:l.textId,...o,ref:g}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!Q(s.value)?z.createPortal(o.children,s.valueNode):null]})},`SelectItemText`)),Je=`SelectItemIndicator`,Ye=F.forwardRef(U(function(e,t){let{__scopeSelect:n,...r}=e;return We(Je,n).isSelected?(0,I.jsx)(d.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Xe=`SelectScrollUpButton`,Ze=F.forwardRef(U(function(e,t){let n=Z(Xe,e.__scopeSelect),r=Pe(Xe,e.__scopeSelect),[a,o]=F.useState(!1),s=i(t,r.onScrollButtonChange);return u(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)};U(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,I.jsx)(et,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Qe=`SelectScrollDownButton`,$e=F.forwardRef(U(function(e,t){let n=Z(Qe,e.__scopeSelect),r=Pe(Qe,e.__scopeSelect),[a,o]=F.useState(!1),s=i(t,r.onScrollButtonChange);return u(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)};U(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,I.jsx)(et,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),et=F.forwardRef(U(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),o=F.useRef(null),s=K(n),c=F.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return F.useEffect(()=>()=>c(),[c]),u(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,I.jsx)(d.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:l(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:l(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:l(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),tt=F.forwardRef(U(function(e,t){let{__scopeSelect:n,...r}=e;return(0,I.jsx)(d.div,{"aria-hidden":!0,...r,ref:t})},`SelectSeparator`)),nt=`SelectBubbleInput`,rt=F.forwardRef(U(function({__scopeSelect:e,...t},n){let r=J(nt,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=F.useRef(null),g=i(n,h),_=a??``,v=V(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return F.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,I.jsxs)(d.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:f,onChange:e=>o(e.target.value),...t,style:{...k,...t.style},ref:g,defaultValue:_,children:[Q(a)&&!y?(0,I.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`SelectBubbleInput`));function it(e){return typeof e==`function`}U(it,`isFunction`);function Q(e){return e===``||e===void 0}U(Q,`shouldShowPlaceholder`);function at(e){let t=S(e),n=F.useRef(``),r=F.useRef(0),i=F.useCallback(e=>{let i=n.current+e;t(i),U((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=F.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return F.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}U(at,`useTypeaheadSearch`);function ot(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=st(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}U(ot,`findNextItem`);function st(e,t){return e.map((n,r)=>e[(t+r)%e.length])}U(st,`wrapArray`);var $=r(),ct=o(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),lt=F.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(ct(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,I.jsx)(R,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});lt.displayName=R.displayName;var ut=o(`flex h-6 w-fit mb-1 items-center justify-between rounded-sm bg-background px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer forced-color-adjust-none forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText] forced-colors:disabled:text-[GrayText]`,{variants:{variant:{default:`shadow-xs-solid border border-input hover:shadow-sm-solid focus-visible:border-primary focus-visible:shadow-md-solid disabled:hover:shadow-xs-solid forced-colors:border-[ButtonText] forced-colors:disabled:border-[GrayText]`,ghost:`opacity-70 hover:opacity-100 focus:opacity-100`}},defaultVariants:{variant:`default`}}),dt=F.forwardRef((e,t)=>{let n=(0,$.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=ne.stopPropagation(),n[4]=o):o=n[4];let c;n[5]===i?c=n[6]:(c=s(ut({}),i),n[5]=i,n[6]=c);let l;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==c?(l=(0,I.jsx)(`select`,{ref:t,onClick:o,className:c,...a,children:r}),n[7]=r,n[8]=a,n[9]=t,n[10]=c,n[11]=l):l=n[11],l});dt.displayName=`NativeSelect`;var ft=_e,pt=ze,mt=v(Te),ht=xe,gt=F.forwardRef((e,t)=>{let n=(0,$.c)(21),r,i,a,o,c,l;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],c=n[5],l=n[6]):({className:i,children:r,onClear:a,variant:l,hideChevron:c,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=c,n[6]=l);let u=c!==void 0&&c,d;n[7]!==i||n[8]!==l?(d=s(ut({variant:l}),`mb-0`,i),n[7]=i,n[8]=l,n[9]=d):d=n[9];let f;n[10]!==u||n[11]!==a?(f=a?(0,I.jsx)(`span`,{onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),a()},children:(0,I.jsx)(P,{className:`h-4 w-4 opacity-50 hover:opacity-90`})}):!u&&(0,I.jsx)(N,{className:`h-4 w-4 opacity-50`}),n[10]=u,n[11]=a,n[12]=f):f=n[12];let p;n[13]===f?p=n[14]:(p=(0,I.jsx)(Se,{asChild:!0,children:f}),n[13]=f,n[14]=p);let m;return n[15]!==r||n[16]!==o||n[17]!==t||n[18]!==d||n[19]!==p?(m=(0,I.jsxs)(ye,{ref:t,className:d,...o,children:[r,p]}),n[15]=r,n[16]=o,n[17]=t,n[18]=d,n[19]=p,n[20]=m):m=n[20],m});gt.displayName=ye.displayName;var _t=f(Ee),vt=F.forwardRef((e,t)=>{let n=(0,$.c)(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,position:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let c=o===void 0?`popper`:o,l=c===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,u;n[5]!==i||n[6]!==l?(u=s(`max-h-[300px] relative z-50 min-w-32 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,l,i),n[5]=i,n[6]=l,n[7]=u):u=n[7];let d;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,I.jsx)(Ze,{className:`flex items-center justify-center h-[20px] bg-background text-muted-foreground cursor-default`,children:(0,I.jsx)(re,{className:`h-4 w-4`})}),n[8]=d):d=n[8];let f=c===`popper`&&`h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)`,p;n[9]===f?p=n[10]:(p=s(`p-1`,f),n[9]=f,n[10]=p);let m;n[11]!==r||n[12]!==p?(m=(0,I.jsx)(Ie,{className:p,children:r}),n[11]=r,n[12]=p,n[13]=m):m=n[13];let h;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,I.jsx)($e,{className:`flex items-center justify-center h-[20px] bg-background text-muted-foreground cursor-default`,children:(0,I.jsx)(N,{className:`h-4 w-4 opacity-50`})}),n[14]=h):h=n[14];let g;return n[15]!==c||n[16]!==a||n[17]!==t||n[18]!==u||n[19]!==m?(g=(0,I.jsx)(mt,{children:(0,I.jsx)(x,{children:(0,I.jsxs)(_t,{ref:t,className:u,position:c,...a,children:[d,m,h]})})}),n[15]=c,n[16]=a,n[17]=t,n[18]=u,n[19]=m,n[20]=g):g=n[20],g});vt.displayName=Ee.displayName;var yt=F.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`px-2 py-1.5 text-sm font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,I.jsx)(Ve,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});yt.displayName=Ve.displayName;var bt=F.forwardRef((e,t)=>{let n=(0,$.c)(17),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,subtitle:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let c;n[5]===i?c=n[6]:(c=s(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-hidden data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground forced-colors:data-[highlighted]:bg-[Highlight] forced-colors:data-[highlighted]:text-[HighlightText]`,ee,i),n[5]=i,n[6]=c);let l;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,I.jsx)(Ye,{children:(0,I.jsx)(M,{className:`h-3 w-3`})})}),n[7]=l):l=n[7];let u=typeof r!=`string`||void 0,d;n[8]!==r||n[9]!==u?(d=(0,I.jsx)(qe,{asChild:u,className:`flex w-full flex-1`,children:r}),n[8]=r,n[9]=u,n[10]=d):d=n[10];let f;return n[11]!==a||n[12]!==t||n[13]!==o||n[14]!==c||n[15]!==d?(f=(0,I.jsxs)(Ge,{ref:t,className:c,...a,children:[l,d,o]}),n[11]=a,n[12]=t,n[13]=o,n[14]=c,n[15]=d,n[16]=f):f=n[16],f});bt.displayName=Ge.displayName;var xt=F.forwardRef((e,t)=>{let n=(0,$.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,I.jsx)(tt,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});xt.displayName=tt.displayName;export{yt as a,ht as c,lt as d,Se as f,V as h,bt as i,dt as l,H as m,vt as n,xt as o,ye as p,pt as r,gt as s,ft as t,ut as u};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,u as i}from"./useEvent-Dc9HkKI2.js";import{t as a}from"./react-CUdNIagt.js";import{$r as o,Ai as s,Bi as c,Bt as l,Cn as u,D as d,Gn as f,Ha as p,Hi as m,Ii as h,Ji as g,Ki as _,Kn as v,Li as y,M as b,Mi as x,P as S,Qr as C,Ri as w,Rn as T,Rt as E,Ui as D,Wa as O,Wi as k,Xi as A,Yi as j,Zi as M,_n as ee,c as N,fn as P,gn as F,i as I,jn as L,qi as R,qn as z,ro as te,ti as ne,to as B,yr as V,yt as H,zi as U}from"./cells-h5u00Nz8.js";import{t as W}from"./compiler-runtime-BQ9S8nyo.js";import{s as re}from"./config-Cyum2gRs.js";import{O as G}from"./config-BAnYSdpO.js";import{t as K}from"./ErrorBoundary-BKmN7zye.js";import{t as ie}from"./cn-ldLVeaqm.js";import{t as q}from"./jsx-runtime-B74pBk57.js";import{r as ae}from"./config-CR2d-XsP.js";import{_ as oe,at as J,f as se,g as ce,h as le,it as ue,m as de,nt as fe,ot as pe,rt as me,tt as he,v as ge}from"./JsonOutput-Dmq_45PS.js";import{t as _e}from"./tooltip-B5pI8o2n.js";import{r as ve,t as ye}from"./button-M49xxKoi.js";import{t as be}from"./createLucideIcon-rHn2EdoM.js";import{i as xe}from"./paths-CzfpItSz.js";import{r as Se}from"./useNumberFormatter-BP99Zbyy.js";import{a as Ce,r as we}from"./tree-actions-CShqSonp.js";import{a as Te}from"./input-DPd57MDP.js";import{n as Ee,o as De}from"./column-preview-D2Um0Qe3.js";import{t as Oe}from"./workflow-nBi9HGeO.js";import{t as ke}from"./copy-icon-wfSGfX8v.js";import{l as Ae}from"./arrays-BqUx5USx.js";import{i as je}from"./strings-hlCLC-K1.js";import{r as Me}from"./requests-yTHMxhVa.js";import{t as Ne}from"./I18nProvider-BFOBKCJB.js";import{n as Pe}from"./useAsyncData-DucTwMkf.js";import{t as Fe}from"./cell-link-BeZAiE1D.js";import{a as Ie,i as Le,n as Re,o as ze,r as Be,t as Ve}from"./table-Dg1KxH-q.js";import{n as He}from"./icons-CVdkfEA3.js";import{t as Ue}from"./useDeepCompareMemoize-DSlTt6u_.js";import{t as We}from"./useAddCell-DesMfnE4.js";import{t as Ge}from"./empty-state-CzxjZqGW.js";import{n as Ke,t as qe}from"./common-BMeq0Bqi.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./components-CWcf8098.js";import{r as tt}from"./panel-accordion-state-8xXVhawu.js";var nt=be(`square-equal`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 10h10`,key:`1101jm`}],[`path`,{d:`M7 14h10`,key:`1mhdw3`}]]),Y=W(),X=e(a(),1),Z=q(),rt=1;function it(e){return 1.75+e*rt}function at(e){return 3+e*rt}function ot(e){return 3.25+e*rt}var Q={engineEmpty:.75,engine:.75,database:1,tableLoading:2.75,tableSchemaless:2,columnLocal:1.25,columnPreview:2.5};function $(e){return{paddingLeft:`${e}rem`}}var st=n(e=>{let t=e(w),n=e(ne),r=e(I);return Ae(t,e=>{if(!e.variable_name)return-1;let t=Object.values(n).find(t=>t.name===e.variable_name);if(!t)return 0;let i=r.inOrderIds.indexOf(t.declaredBy[0]);return i===-1?0:i})}),ct=G(`marimo:datasources:hideEmpty`,!1,C,{getOnInit:!0});function lt(e){let t=!1,n=[];for(let r of e){if(!k(r)||!m(r)){n.push(r);continue}let e=r.child_schemas??[],i=lt(e);if(r.tables.length===0&&i.length===0){t=!0;continue}if(i===e){n.push(r);continue}t=!0,n.push({...r,child_schemas:i})}return t?n:e}function ut(e){let t=!1,n=[];for(let r of e){if(D(r)&&r.schemas.length===0){t=!0;continue}if(r.schemas.length===0){n.push(r);continue}let e=lt(r.schemas);if(e.length===0){t=!0;continue}if(e===r.schemas){n.push(r);continue}t=!0,n.push({...r,schemas:e})}return t?n:e}var dt=()=>{let e=(0,Y.c)(42),[n,a]=X.useState(``),[o,s]=t(ct),c=i(y),l=r(st),d=r(x),f;bb0:{if(!o){f=d;break bb0}let t,n;e[0]===d?(t=e[1],n=e[2]):(t=!1,n=d.map(e=>{let n=ut(e.databases);return n===e.databases?e:(t=!0,{...e,databases:n})}),e[0]=d,e[1]=t,e[2]=n),f=t?n:d}let p=f;if(l.length===0&&p.length===0){let t;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ge,{title:`No tables found`,description:`Any datasets/dataframes in the global scope will be shown here.`,action:(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,variant:`outline`,size:`sm`}),icon:(0,Z.jsx)(xe,{})}),e[3]=t):t=e[3],t}let m;e[4]===n?m=e[5]:(m=n.trim(),e[4]=n,e[5]=m);let h=!!m,g;e[6]===c?g=e[7]:(g=e=>{c(e.length>0),a(e)},e[6]=c,e[7]=g);let _;e[8]!==n||e[9]!==g?(_=(0,Z.jsx)(F,{placeholder:`Search tables...`,className:`h-6 m-1`,value:n,onValueChange:g,rootClassName:`flex-1 border-r border-b-0`}),e[8]=n,e[9]=g,e[10]=_):_=e[10];let v;e[11]===h?v=e[12]:(v=h&&(0,Z.jsx)(`button`,{type:`button`,className:`float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,onClick:()=>a(``),children:(0,Z.jsx)(Se,{className:`h-4 w-4`})}),e[11]=h,e[12]=v);let b=!o,S;e[13]!==o||e[14]!==s?(S=()=>s(!o),e[13]=o,e[14]=s,e[15]=S):S=e[15];let C;e[16]!==b||e[17]!==S?(C=(0,Z.jsx)(Ce,{"data-testid":`datasources-hide-empty-button`,isVisible:b,onToggle:S,showTooltip:`Show empty schemas and databases`,hideTooltip:`Hide empty schemas and databases`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[16]=b,e[17]=S,e[18]=C):C=e[18];let w;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,compact:!0,variant:`ghost`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[19]=w):w=e[19];let T;e[20]!==_||e[21]!==v||e[22]!==C?(T=(0,Z.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[_,v,C,w]}),e[20]=_,e[21]=v,e[22]=C,e[23]=T):T=e[23];let E;if(e[24]!==p||e[25]!==n){let t;e[27]===n?t=e[28]:(t=e=>(0,Z.jsx)(ft,{connection:e,hasChildren:e.databases.length>0,children:e.databases.map(t=>(0,Z.jsx)(gt,{connection:e,database:t,searchValue:n},t.name))},e.name),e[27]=n,e[28]=t),E=p.map(t),e[24]=p,e[25]=n,e[26]=E}else E=e[26];let D;e[29]!==p.length||e[30]!==l.length?(D=p.length>0&&l.length>0&&(0,Z.jsxs)(de,{className:`pr-2`,style:$(Q.engine),children:[(0,Z.jsx)(He,{className:`h-4 w-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`text-xs`,children:`Python`})]}),e[29]=p.length,e[30]=l.length,e[31]=D):D=e[31];let O;e[32]!==n||e[33]!==l?(O=l.length>0&&(0,Z.jsx)(bt,{tables:l,searchValue:n}),e[32]=n,e[33]=l,e[34]=O):O=e[34];let k;e[35]!==E||e[36]!==D||e[37]!==O?(k=(0,Z.jsxs)(u,{className:`flex flex-col`,children:[E,D,O]}),e[35]=E,e[36]=D,e[37]=O,e[38]=k):k=e[38];let A;return e[39]!==k||e[40]!==T?(A=(0,Z.jsxs)(P,{className:`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden`,shouldFilter:!1,children:[T,k]}),e[39]=k,e[40]=T,e[41]=A):A=e[41],A},ft=e=>{let t=(0,Y.c)(26),{connection:n,children:r,hasChildren:i}=e,a=n.name===M,o=a?`In-Memory`:n.name,{previewDataSourceConnection:c}=Me(),l;t[0]!==n.name||t[1]!==c?(l=async()=>{await c({engine:n.name})},t[0]=n.name,t[1]=c,t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=$(Q.engine),t[3]=d):d=t[3];let f;t[4]===n.dialect?f=t[5]:(f=(0,Z.jsx)(L,{className:`h-4 w-4 text-muted-foreground`,name:n.dialect}),t[4]=n.dialect,t[5]=f);let p;t[6]===n.dialect?p=t[7]:(p=s(n.dialect),t[6]=n.dialect,t[7]=p);let m;t[8]===p?m=t[9]:(m=(0,Z.jsx)(`span`,{className:`text-xs`,children:p}),t[8]=p,t[9]=m);let h=o,g;t[10]===h?g=t[11]:(g=(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,(0,Z.jsx)($e,{variableName:h}),`)`]}),t[10]=h,t[11]=g);let _;t[12]!==u||t[13]!==a?(_=!a&&(0,Z.jsx)(we,{onClick:u,tooltip:`Refresh connection`,className:`ml-auto h-4 p-0`,iconClassName:`h-3.5 w-3.5`}),t[12]=u,t[13]=a,t[14]=_):_=t[14];let v;t[15]!==f||t[16]!==m||t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(de,{className:`pr-2`,style:d,children:[f,m,g,_]}),t[15]=f,t[16]=m,t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==r||t[21]!==i?(y=i?r:(0,Z.jsx)(le,{content:`No databases available`,style:$(Q.engineEmpty)}),t[20]=r,t[21]=i,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==v?(b=(0,Z.jsxs)(Z.Fragment,{children:[v,y]}),t[23]=y,t[24]=v,t[25]=b):b=t[25],b},pt=X.createContext(null);function mt(){let e=X.useContext(pt);if(e==null)throw Error(`useDataSourceTree must be used within a DataSourceTreeContext.Provider`);return e}function ht(e,{schema:t,schemaPath:n}){return{engine:e.engineName,database:e.databaseName,schema:t,schemaPath:n,defaultSchema:e.defaultSchema,defaultDatabase:e.defaultDatabase,dialect:e.dialect}}var gt=e=>{let t=(0,Y.c)(21),{connection:n,database:r,searchValue:i}=e,a;t[0]!==n.default_database||t[1]!==n.default_schema||t[2]!==n.dialect||t[3]!==n.name||t[4]!==r.name||t[5]!==i?(a={engineName:n.name,databaseName:r.name,dialect:n.dialect,defaultSchema:n.default_schema,defaultDatabase:n.default_database,searchValue:i},t[0]=n.default_database,t[1]=n.default_schema,t[2]=n.dialect,t[3]=n.name,t[4]=r.name,t[5]=i,t[6]=a):a=t[6];let o=a,s=n.name,c=r.schemas,l;t[7]===r?l=t[8]:(l=D(r),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[9]=u):u=t[9];let d;t[10]!==r.schemas||t[11]!==l?(d=(0,Z.jsx)(vt,{schemas:c,schemasResolved:l,schemaPath:u,depth:0}),t[10]=r.schemas,t[11]=l,t[12]=d):d=t[12];let f;t[13]!==d||t[14]!==o?(f=(0,Z.jsx)(pt.Provider,{value:o,children:d}),t[13]=d,t[14]=o,t[15]=f):f=t[15];let p;return t[16]!==n.name||t[17]!==r||t[18]!==i||t[19]!==f?(p=(0,Z.jsx)(_t,{engineName:s,database:r,searchValue:i,children:f}),t[16]=n.name,t[17]=r,t[18]=i,t[19]=f,t[20]=p):p=t[20],p},_t=e=>{let t=(0,Y.c)(29),{searchValue:n,engineName:r,database:i,children:a}=e,o;t[0]!==i||t[1]!==n?(o=g(i,n),t[0]=i,t[1]=n,t[2]=o):o=t[2];let s=o,[c,l]=X.useState(s),[u,d]=X.useState(!1),[f,p]=X.useState(n),[m,h]=X.useState(s);(f!==n||m!==s)&&(p(n),h(s),l(s));let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=$(Q.database),t[3]=_):_=t[3];let v;t[4]!==c||t[5]!==u?(v=()=>{l(!c),d(!u)},t[4]=c,t[5]=u,t[6]=v):v=t[6];let y=`${r}:${i.name}`,b;t[7]===c?b=t[8]:(b=(0,Z.jsx)(ge,{isExpanded:c}),t[7]=c,t[8]=b);let x=u&&c?`text-foreground`:`text-muted-foreground`,S;t[9]===x?S=t[10]:(S=ie(`h-4 w-4`,x),t[9]=x,t[10]=S);let C;t[11]===S?C=t[12]:(C=(0,Z.jsx)(xe,{className:S}),t[11]=S,t[12]=C);let w=u&&c&&`font-semibold`,T;t[13]===w?T=t[14]:(T=ie(w),t[13]=w,t[14]=T);let E;t[15]===i.name?E=t[16]:(E=i.name===``?(0,Z.jsx)(`i`,{children:`Not connected`}):i.name,t[15]=i.name,t[16]=E);let D;t[17]!==T||t[18]!==E?(D=(0,Z.jsx)(`span`,{className:T,children:E}),t[17]=T,t[18]=E,t[19]=D):D=t[19];let O;t[20]!==D||t[21]!==v||t[22]!==y||t[23]!==b||t[24]!==C?(O=(0,Z.jsxs)(ee,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:_,onSelect:v,value:y,children:[b,C,D]}),t[20]=D,t[21]=v,t[22]=y,t[23]=b,t[24]=C,t[25]=O):O=t[25];let k=c&&a,A;return t[26]!==O||t[27]!==k?(A=(0,Z.jsxs)(Z.Fragment,{children:[O,k]}),t[26]=O,t[27]=k,t[28]=A):A=t[28],A},vt=e=>{let{schemas:t,schemasResolved:n,depth:r}=e,i=mt(),{engineName:a,databaseName:o,searchValue:s}=i,{addSchemaList:c}=h(),l=Ue(e.schemaPath),[u,d]=X.useState(!1),{isPending:p,error:m}=Pe(async()=>{if(!n&&a){d(!0);try{let e=await f.request({engine:a,database:o,schemaPath:l});c({schemas:e.schemas??[],sqlSchemaContext:{engine:a,database:o,schemaPath:l}})}finally{d(!1)}}},[n,a,o,l]),g=$(it(r));return p||u?(0,Z.jsx)(oe,{message:`Loading schemas...`,style:g}):m?(0,Z.jsx)(ce,{error:m,style:g}):t.length===0?(0,Z.jsx)(le,{content:`No schemas available`,style:g}):(0,Z.jsx)(Z.Fragment,{children:t.map(e=>_(e.name)?(0,Z.jsx)(bt,{tables:e.tables,tablesResolved:k(e),searchValue:s,sqlTableContext:ht(i,{schema:e.name,schemaPath:l})},e.name):(0,Z.jsx)(yt,{schema:e,schemaPath:[...l,e.name],depth:r},e.name))})},yt=e=>{let t=(0,Y.c)(41),{schema:n,schemaPath:r,depth:i}=e,a=mt(),{databaseName:o,searchValue:s}=a,c;t[0]!==n||t[1]!==s?(c=R(n,s),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l=c,[u,d]=X.useState(l),[f,p]=X.useState(!1),[h,g]=X.useState(s),[_,v]=X.useState(l),y;t[3]===r?y=t[4]:(y=r.join(`.`),t[3]=r,t[4]=y);let b=`${o}:${y}`,x;t[5]===n.child_schemas?x=t[6]:(x=n.child_schemas??[],t[5]=n.child_schemas,t[6]=x);let S=x;(h!==s||_!==l)&&(g(s),v(l),d(l));let C;t[7]===i?C=t[8]:(C=$(it(i)),t[7]=i,t[8]=C);let w;t[9]!==u||t[10]!==f?(w=()=>{d(!u),p(!f)},t[9]=u,t[10]=f,t[11]=w):w=t[11];let T;t[12]===u?T=t[13]:(T=(0,Z.jsx)(ge,{isExpanded:u}),t[12]=u,t[13]=T);let E=f&&u&&`text-foreground`,D;t[14]===E?D=t[15]:(D=ie(`h-4 w-4 text-muted-foreground`,E),t[14]=E,t[15]=D);let O;t[16]===D?O=t[17]:(O=(0,Z.jsx)(B,{className:D}),t[16]=D,t[17]=O);let A=f&&u&&`font-semibold`,j;t[18]===A?j=t[19]:(j=ie(A),t[18]=A,t[19]=j);let M;t[20]!==n.name||t[21]!==j?(M=(0,Z.jsx)(`span`,{className:j,children:n.name}),t[20]=n.name,t[21]=j,t[22]=M):M=t[22];let N;t[23]!==M||t[24]!==C||t[25]!==w||t[26]!==T||t[27]!==O||t[28]!==b?(N=(0,Z.jsxs)(ee,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:C,onSelect:w,value:b,children:[T,O,M]}),t[23]=M,t[24]=C,t[25]=w,t[26]=T,t[27]=O,t[28]=b,t[29]=N):N=t[29];let P;t[30]!==S||t[31]!==i||t[32]!==u||t[33]!==n||t[34]!==r||t[35]!==s||t[36]!==a?(P=u&&(0,Z.jsxs)(Z.Fragment,{children:[(S.length>0||!m(n))&&(0,Z.jsx)(vt,{schemas:S,schemasResolved:m(n),schemaPath:r,depth:i+1}),(0,Z.jsx)(bt,{tables:n.tables,tablesResolved:k(n),searchValue:s,tableIndentRem:at(i),columnIndentRem:ot(i),sqlTableContext:ht(a,{schema:n.name,schemaPath:r})})]}),t[30]=S,t[31]=i,t[32]=u,t[33]=n,t[34]=r,t[35]=s,t[36]=a,t[37]=P):P=t[37];let F;return t[38]!==N||t[39]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[38]=N,t[39]=P,t[40]=F):F=t[40],F},bt=e=>{let t=(0,Y.c)(31),{tables:n,sqlTableContext:r,searchValue:i,tablesResolved:a,tableIndentRem:o,columnIndentRem:s}=e,c=a===void 0||a,{addTableList:l}=h(),[u,d]=X.useState(!1),f;t[0]!==l||t[1]!==r||t[2]!==c?(f=async()=>{if(!c&&r){d(!0);let{engine:e,database:t,schema:n,schemaPath:i}=r,a=await z.request({engine:e,database:t,schema:n,schemaPath:i??[]});if(!a?.tables)throw d(!1),Error(`No tables available`);l({tables:a.tables,sqlTableContext:r}),d(!1)}},t[0]=l,t[1]=r,t[2]=c,t[3]=f):f=t[3];let p;t[4]!==r||t[5]!==c?(p=[c,r],t[4]=r,t[5]=c,t[6]=p):p=t[6];let{isPending:m,error:g}=Pe(f,p),_=o??Q.tableLoading,v;t[7]===_?v=t[8]:(v=$(_),t[7]=_,t[8]=v);let y=v;if(m||u){let e;return t[9]===y?e=t[10]:(e=(0,Z.jsx)(oe,{message:`Loading tables...`,style:y}),t[9]=y,t[10]=e),e}if(g){let e;return t[11]!==g||t[12]!==y?(e=(0,Z.jsx)(ce,{error:g,style:y}),t[11]=g,t[12]=y,t[13]=e):e=t[13],e}if(n.length===0){let e;return t[14]===y?e=t[15]:(e=(0,Z.jsx)(le,{content:`No tables found`,style:y}),t[14]=y,t[15]=e),e}let b;if(t[16]!==s||t[17]!==i||t[18]!==r||t[19]!==o||t[20]!==n){let e;t[22]===i?e=t[23]:(e=e=>!i||e.name.toLowerCase().includes(i.toLowerCase()),t[22]=i,t[23]=e);let a=n.filter(e),c;t[24]!==s||t[25]!==i||t[26]!==r||t[27]!==o?(c=e=>(0,Z.jsx)(xt,{table:e,sqlTableContext:r,isSearching:!!i,tableIndentRem:o,columnIndentRem:s},e.name),t[24]=s,t[25]=i,t[26]=r,t[27]=o,t[28]=c):c=t[28],b=a.map(c),t[16]=s,t[17]=i,t[18]=r,t[19]=o,t[20]=n,t[21]=b}else b=t[21];let x;return t[29]===b?x=t[30]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[29]=b,t[30]=x),x},xt=e=>{let t=(0,Y.c)(69),{table:n,sqlTableContext:i,isSearching:a,tableIndentRem:o,columnIndentRem:s}=e,{addTable:c}=h(),[u,f]=X.useState(!1),p=n.columns.length>0,m;t[0]!==c||t[1]!==u||t[2]!==i||t[3]!==n.name||t[4]!==p?(m=async()=>{if(u&&!p&&i){let{engine:e,database:t,schema:r,schemaPath:a}=i,o=await v.request({engine:e,database:t,schema:r,tableName:n.name,schemaPath:a??[]});if(!o?.table)throw Error(`No table details available`);c({table:o.table,sqlTableContext:i})}},t[0]=c,t[1]=u,t[2]=i,t[3]=n.name,t[4]=p,t[5]=m):m=t[5];let g;t[6]!==u||t[7]!==p?(g=[u,p],t[6]=u,t[7]=p,t[8]=g):g=t[8];let{isFetching:_,isPending:y,error:b}=Pe(m,g),x=r(re),S=E(),{createNewCell:C}=d(),w=We(),T;t[9]!==w||t[10]!==x||t[11]!==C||t[12]!==S||t[13]!==i||t[14]!==n?(T=()=>{l({autoInstantiate:x,createNewCell:C,fromCellId:S}),w((()=>{if(n.source_type===`catalog`){let e=i?.database?[i.database,...i.schemaPath??[],n.name].join(`.`):n.name;return`${n.engine}.load_table("${e}")`}if(i)return j({table:n,columnName:`*`,sqlTableContext:i});switch(n.source_type){case`local`:return`mo.ui.table(${n.name})`;case`duckdb`:case`connection`:return j({table:n,columnName:`*`,sqlTableContext:i});default:return je(n.source_type),``}})())},t[9]=w,t[10]=x,t[11]=C,t[12]=S,t[13]=i,t[14]=n,t[15]=T):T=t[15];let D=T,k;t[16]!==n.num_columns||t[17]!==n.num_rows?(k=()=>{let e=[];return n.num_rows!=null&&e.push(`${n.num_rows} rows`),n.num_columns!=null&&e.push(`${n.num_columns} columns`),e.length===0?null:(0,Z.jsx)(`div`,{className:`flex flex-row gap-2 items-center pl-6 group-hover:hidden`,children:(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.join(`, `)})})},t[16]=n.num_columns,t[17]=n.num_rows,t[18]=k):k=t[18];let M=k,N;t[19]!==s||t[20]!==b||t[21]!==_||t[22]!==y||t[23]!==i||t[24]!==n?(N=()=>{let e=$(s??Q.tableLoading);if(y||_)return(0,Z.jsx)(oe,{message:`Loading columns...`,style:e});if(b)return(0,Z.jsx)(ce,{error:b,style:e});let t=n.columns;return t.length===0?(0,Z.jsx)(le,{content:`No columns found`,style:e}):t.map(e=>(0,Z.jsx)(St,{table:n,column:e,sqlTableContext:i,columnIndentRem:s},e.name))},t[19]=s,t[20]=b,t[21]=_,t[22]=y,t[23]=i,t[24]=n,t[25]=N):N=t[25];let P=N,F;t[26]!==u||t[27]!==a||t[28]!==n.source_type||t[29]!==n.type?(F=()=>{if(n.source_type===`local`)return;let e=n.type===`table`?O:te;return(0,Z.jsx)(e,{className:`h-3 w-3`,strokeWidth:u||a?2.5:void 0})},t[26]=u,t[27]=a,t[28]=n.source_type,t[29]=n.type,t[30]=F):F=t[30];let I=F,L;t[31]!==i||t[32]!==n.name?(L=A(i,n.name),t[31]=i,t[32]=n.name,t[33]=L):L=t[33];let R=L,z=o??(i?Q.tableSchemaless:0),ne=(u||a)&&`font-semibold`,B;t[34]===ne?B=t[35]:(B=ie(`rounded-none group h-8 cursor-pointer`,ne),t[34]=ne,t[35]=B);let V;t[36]===z?V=t[37]:(V=$(z),t[36]=z,t[37]=V);let H;t[38]===u?H=t[39]:(H=()=>f(!u),t[38]=u,t[39]=H);let U;t[40]===I?U=t[41]:(U=I(),t[40]=I,t[41]=U);let W;t[42]===n.name?W=t[43]:(W=(0,Z.jsx)(`span`,{className:`text-sm`,children:n.name}),t[42]=n.name,t[43]=W);let G;t[44]!==U||t[45]!==W?(G=(0,Z.jsxs)(`div`,{className:`flex gap-2 items-center flex-1 pl-1`,children:[U,W]}),t[44]=U,t[45]=W,t[46]=G):G=t[46];let K;t[47]===M?K=t[48]:(K=M(),t[47]=M,t[48]=K);let q;t[49]===D?q=t[50]:(q=ve.stopPropagation(()=>D()),t[49]=D,t[50]=q);let ae;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(De,{className:`h-3 w-3`}),t[51]=ae):ae=t[51];let J;t[52]===q?J=t[53]:(J=(0,Z.jsx)(_e,{content:`Add table to notebook`,delayDuration:400,children:(0,Z.jsx)(ye,{className:`group-hover:inline-flex hidden`,variant:`text`,size:`icon`,onClick:q,children:ae})}),t[52]=q,t[53]=J);let se;t[54]!==u||t[55]!==V||t[56]!==H||t[57]!==G||t[58]!==K||t[59]!==J||t[60]!==B||t[61]!==R?(se=(0,Z.jsxs)(ee,{className:B,style:V,value:R,"aria-selected":u,forceMount:!0,onSelect:H,children:[G,K,J]}),t[54]=u,t[55]=V,t[56]=H,t[57]=G,t[58]=K,t[59]=J,t[60]=B,t[61]=R,t[62]=se):se=t[62];let ue;t[63]!==u||t[64]!==P?(ue=u&&P(),t[63]=u,t[64]=P,t[65]=ue):ue=t[65];let de;return t[66]!==se||t[67]!==ue?(de=(0,Z.jsxs)(Z.Fragment,{children:[se,ue]}),t[66]=se,t[67]=ue,t[68]=de):de=t[68],de},St=e=>{let t=(0,Y.c)(51),{table:n,column:a,sqlTableContext:o,columnIndentRem:s}=e,[l,u]=X.useState(!1),d=r(y),f=i(U);d&&l&&u(!1),f(l?e=>new Set([...e,`${n.name}:${a.name}`]):e=>(e.delete(`${n.name}:${a.name}`),new Set(e)));let p=We(),{columnsPreviews:m}=c(),h;t[0]!==a.name||t[1]!==n.primary_keys?(h=n.primary_keys?.includes(a.name)||!1,t[0]=a.name,t[1]=n.primary_keys,t[2]=h):h=t[2];let g=h,_;t[3]!==a.name||t[4]!==n.indexes?(_=n.indexes?.includes(a.name)||!1,t[3]=a.name,t[4]=n.indexes,t[5]=_):_=t[5];let v=_,b;t[6]===p?b=t[7]:(b=e=>{p(e)},t[6]=p,t[7]=b);let x=b,S=Ct,C=l?`font-semibold`:``,w;t[8]!==a.name||t[9]!==C?(w=(0,Z.jsx)(`span`,{className:C,children:a.name}),t[8]=a.name,t[9]=C,t[10]=w):w=t[10];let T=w,E=`${n.name}.${a.name}`,D=`${n.name}.${a.name}`,O;t[11]===l?O=t[12]:(O=()=>u(!l),t[11]=l,t[12]=O);let k;t[13]!==s||t[14]!==o?(k=s??(o?ot(0):Q.columnLocal),t[13]=s,t[14]=o,t[15]=k):k=t[15];let A;t[16]===k?A=t[17]:(A=$(k),t[16]=k,t[17]=A);let j;t[18]!==a.type||t[19]!==T?(j=(0,Z.jsx)(se,{columnName:T,dataType:a.type}),t[18]=a.type,t[19]=T,t[20]=j):j=t[20];let M;t[21]===g?M=t[22]:(M=g&&S({tooltipContent:`Primary key`,content:`PK`}),t[21]=g,t[22]=M);let N;t[23]===v?N=t[24]:(N=v&&S({tooltipContent:`Indexed`,content:`IDX`}),t[23]=v,t[24]=N);let P;t[25]!==A||t[26]!==j||t[27]!==M||t[28]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex flex-row gap-2 items-center flex-1`,style:A,children:[j,M,N]}),t[25]=A,t[26]=j,t[27]=M,t[28]=N,t[29]=P):P=t[29];let F;t[30]===a.name?F=t[31]:(F=(0,Z.jsx)(_e,{content:`Copy column name`,delayDuration:400,children:(0,Z.jsx)(ye,{variant:`text`,size:`icon`,className:`group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(ke,{tooltip:!1,value:a.name,className:`h-3 w-3`})})}),t[30]=a.name,t[31]=F);let I;t[32]===a.external_type?I=t[33]:(I=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a.external_type}),t[32]=a.external_type,t[33]=I);let L;t[34]!==P||t[35]!==F||t[36]!==I||t[37]!==E||t[38]!==D||t[39]!==O?(L=(0,Z.jsxs)(ee,{className:`rounded-none py-1 group cursor-pointer`,value:D,onSelect:O,children:[P,F,I]},E),t[34]=P,t[35]=F,t[36]=I,t[37]=E,t[38]=D,t[39]=O,t[40]=L):L=t[40];let R;t[41]!==a||t[42]!==m||t[43]!==x||t[44]!==l||t[45]!==o||t[46]!==n?(R=l&&(0,Z.jsx)(`div`,{className:`pr-2 py-2 bg-(--slate-1) shadow-inner border-b`,style:$(Q.columnPreview),children:(0,Z.jsx)(K,{children:(0,Z.jsx)(Ee,{table:n,column:a,onAddColumnChart:x,preview:m.get(o?`${o.database}.${o.schema}.${n.name}:${a.name}`:`${n.name}:${a.name}`),sqlTableContext:o})})}),t[41]=a,t[42]=m,t[43]=x,t[44]=l,t[45]=o,t[46]=n,t[47]=R):R=t[47];let z;return t[48]!==L||t[49]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[L,R]}),t[48]=L,t[49]=R,t[50]=z):z=t[50],z};function Ct(e){let{tooltipContent:t,content:n}=e;return(0,Z.jsx)(_e,{content:t,delayDuration:100,children:(0,Z.jsx)(`span`,{className:`text-xs text-black bg-gray-100 dark:invert rounded px-1`,children:n})})}function wt(e){return e}var Tt={name:`name`,type:`type-value`,defs:`defs-refs`},Et=[wt({id:Tt.name,accessorFn:e=>[e.name,e.declaredBy],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(he,{header:`Name`,column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsx)(qe,{name:t,declaredBy:n})}}),wt({id:Tt.type,accessorFn:e=>[e.dataType,e.value],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(he,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Type`}),(0,Z.jsx)(`span`,{children:`Value`})]}),column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsxs)(`div`,{className:`max-w-[150px]`,children:[(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs`,children:t}),(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap`,title:n??``,children:n})]})}}),wt({id:Tt.defs,accessorFn:e=>[e.declaredBy,e.usedBy,e.name,e.declaredByNames,e.usedByNames],enableSorting:!0,sortingFn:`basic`,header:({column:e})=>(0,Z.jsx)(he,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Declared By`}),(0,Z.jsx)(`span`,{children:`Used By`})]}),column:e}),cell:({getValue:e})=>{let[t,n,r]=e(),i=e=>{let t=N(e);t&&V(t,r)};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 py-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-center`,children:[(0,Z.jsx)(`span`,{title:`Declared by`,children:(0,Z.jsx)(nt,{className:`w-3.5 h-3.5 text-muted-foreground`})}),t.length===1?(0,Z.jsx)(Fe,{variant:`focus`,cellId:t[0],skipScroll:!0,onClick:()=>i(t[0])}):(0,Z.jsx)(`div`,{className:`text-destructive flex flex-row gap-2`,children:t.slice(0,3).map((e,n)=>(0,Z.jsxs)(`span`,{className:`flex`,children:[(0,Z.jsx)(Fe,{variant:`focus`,cellId:e,skipScroll:!0,className:`whitespace-nowrap text-destructive`,onClick:()=>i(e)},e),n<t.length-1&&`, `]},e))})]}),(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-baseline`,children:[(0,Z.jsx)(`span`,{title:`Used by`,children:(0,Z.jsx)(Oe,{className:`w-3.5 h-3.5 text-muted-foreground`})}),(0,Z.jsx)(Ke,{maxCount:3,cellIds:n,skipScroll:!0,onClick:i})]})]})}})];function Dt({variables:e,sort:t,cellIdToIndex:n}){t||={id:Tt.defs,desc:!1};let r=[];switch(t.id){case Tt.name:r=Ae(e,e=>e.name);break;case Tt.type:r=Ae(e,e=>e.dataType);break;case Tt.defs:r=Ae(e,e=>n.get(e.declaredBy[0]))}return t.desc?r.toReversed():r}var Ot=(0,X.memo)(({className:e,cellIds:t,variables:n})=>{let[r,i]=X.useState([]),[a,o]=X.useState(``),s=S(),{locale:c}=Ne(),l=(0,X.useMemo)(()=>{let e=e=>{let n=s[e];return T(n)?`cell-${t.indexOf(e)}`:n??`cell-${t.indexOf(e)}`};return Object.values(n).map(t=>({...t,declaredByNames:t.declaredBy.map(e),usedByNames:t.usedBy.map(e)}))},[n,s,t]),u=(0,X.useMemo)(()=>{let e=new Map;return t.forEach((t,n)=>e.set(t,n)),Dt({variables:l,sort:r[0],cellIdToIndex:e})},[l,r,t]),d=me({data:u,columns:Et,getCoreRowModel:ue(),onGlobalFilterChange:o,getFilteredRowModel:J(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(e){return e.columnDef.enableGlobalFilter??!0},globalFilterFn:`auto`,manualSorting:!0,locale:c,onSortingChange:i,getSortedRowModel:pe(),state:{sorting:r,globalFilter:a}});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{className:`w-full`,placeholder:`Search`,value:a,onChange:e=>o(e.target.value)}),(0,Z.jsxs)(Ve,{className:ie(`w-full text-sm flex-1 border-separate border-spacing-0`,e),children:[(0,Z.jsx)(Ie,{children:(0,Z.jsx)(ze,{className:`whitespace-nowrap text-xs`,children:d.getFlatHeaders().map(e=>(0,Z.jsx)(Le,{className:`sticky top-0 bg-background border-b`,children:fe(e.column.columnDef.header,e.getContext())},e.id))})}),(0,Z.jsx)(Re,{children:d.getRowModel().rows.map(e=>(0,Z.jsx)(ze,{className:`hover:bg-accent`,children:e.getVisibleCells().map(e=>(0,Z.jsx)(Be,{className:`border-b`,children:fe(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})]})});Ot.displayName=`VariableTable`;var kt=()=>{let e=(0,Y.c)(30),n=o(),i=b(),a=r(w),s=r(x),c=H(`database`),[l,u]=t(tt),d=a.length+s.length,f;e[0]!==d||e[1]!==l.hasUserInteracted||e[2]!==l.openSections?(f=!l.hasUserInteracted&&d>0?[...new Set([...l.openSections,`datasources`])]:l.openSections,e[0]=d,e[1]=l.hasUserInteracted,e[2]=l.openSections,e[3]=f):f=e[3];let m=f,h;e[4]===u?h=e[5]:(h=e=>{u({openSections:e,hasUserInteracted:!0})},e[4]=u,e[5]=h);let g=h,_;e[6]===m?_=e[7]:(_=m.includes(`datasources`),e[6]=m,e[7]=_);let v=!_&&d>0,y=c.length>0,S;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(xe,{className:`w-4 h-4`}),e[8]=S):S=e[8];let C;e[9]!==d||e[10]!==v?(C=v&&(0,Z.jsx)(Je,{children:d}),e[9]=d,e[10]=v,e[11]=C):C=e[11];let T;e[12]!==c.length||e[13]!==y?(T=y&&(0,Z.jsx)(et,{count:c.length,type:`database`}),e[12]=c.length,e[13]=y,e[14]=T):T=e[14];let E;e[15]!==C||e[16]!==T?(E=(0,Z.jsxs)(Ye,{children:[S,`Data sources`,C,T]}),e[15]=C,e[16]=T,e[17]=E):E=e[17];let D;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Xe,{children:(0,Z.jsx)(dt,{})}),e[18]=D):D=e[18];let O;e[19]===E?O=e[20]:(O=(0,Z.jsxs)(Qe,{value:`datasources`,children:[E,D]}),e[19]=E,e[20]=O);let k;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsxs)(Ye,{children:[(0,Z.jsx)(p,{className:`w-4 h-4`}),`Variables`]}),e[21]=k):k=e[21];let A;e[22]!==i||e[23]!==n?(A=(0,Z.jsxs)(Qe,{value:`variables`,lastItem:!0,children:[k,(0,Z.jsx)(Xe,{children:Object.keys(n).length===0?(0,Z.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground`,children:`No variables defined`}):(0,Z.jsx)(Ot,{cellIds:i.inOrderIds,variables:n})})]}),e[22]=i,e[23]=n,e[24]=A):A=e[24];let j;return e[25]!==g||e[26]!==m||e[27]!==A||e[28]!==O?(j=(0,Z.jsxs)(ae,{type:`multiple`,value:m,onValueChange:g,className:`flex flex-col h-full overflow-auto`,children:[O,A]}),e[25]=g,e[26]=m,e[27]=A,e[28]=O,e[29]=j):j=e[29],j};export{kt as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CUdNIagt.js";import{Cn as n,D as r,Rt as i,_n as a,fn as o,gn as s,mn as c}from"./cells-CuKxjgjJ.js";import{t as l}from"./compiler-runtime-BQ9S8nyo.js";import{n as u}from"./useEventListener-IRzG-0mH.js";import{r as d}from"./utils-B4K466FK.js";import{t as f}from"./cn-ldLVeaqm.js";import{t as p}from"./jsx-runtime-B74pBk57.js";import{t as m}from"./tooltip-B5pI8o2n.js";import{t as h}from"./button-M49xxKoi.js";import{n as g,t as _}from"./LazyAnyLanguageCodeMirror-CeTd_wFt.js";import{r as v}from"./useNumberFormatter-C4-_TnkF.js";import{b as y}from"./write-secret-modal-DknTu1O1.js";import{t as b}from"./spinner-CGdRKCnw.js";import{t as x}from"./plus-gbN72xHe.js";import{Gt as S,Kt as C,Wt as w,Xt as T,qt as E}from"./input-DnyzXg4C.js";import{st as D}from"./dist-Cny7_yZb.js";import{r as O}from"./requests-yTHMxhVa.js";import{r as k}from"./useTheme-BkPLyRl9.js";import{n as A}from"./useAsyncData-DucTwMkf.js";import{t as j}from"./RenderHTML-CqDY0F9e.js";import{n as M}from"./error-banner-D1_bPN9u.js";import{n as N,r as P,t as F}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{t as I}from"./empty-state-CzxjZqGW.js";import{n as L,r as R}from"./panel-context-BPaQeOuV.js";import{t as z}from"./readonly-code-display-Ctjk_xXb.js";import{t as B}from"./kiosk-mode-DCHo0R3W.js";var V=e(t(),1),H=l(),U=p(),W=u,G=e=>{let t=(0,H.c)(6),{children:n}=e,{openModal:r,closeModal:i}=y(),a;t[0]!==i||t[1]!==r?(a=()=>r((0,U.jsx)(K,{onClose:i})),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==a?(o=(0,U.jsx)(W,{onClick:a,children:n}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o},K=e=>{let t=(0,H.c)(4),{onClose:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(T,{children:`Contribute a Snippet`}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,U.jsxs)(E,{children:[r,(0,U.jsxs)(S,{children:[`Have a useful snippet you want to share with the community? Make a pull request`,` `,(0,U.jsx)(`a`,{href:d.githubPage,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`on GitHub`}),`.`]})]}),t[1]=i):i=t[1];let a;return t[2]===n?a=t[3]:(a=(0,U.jsxs)(w,{className:`max-w-md`,children:[i,(0,U.jsx)(C,{children:(0,U.jsx)(h,{"data-testid":`snippet-close-button`,variant:`default`,onClick:n,children:`Close`})})]}),t[2]=n,t[3]=a),a},q=[D.lineWrapping],J=()=>{let e=(0,H.c)(24),{readSnippets:t}=O(),[n,r]=V.useState(),i=L(),a=R(),l;e[0]===t?l=e[1]:(l=()=>t(),e[0]=t,e[1]=l);let u;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],e[2]=u):u=e[2];let{data:d,error:p,isPending:m}=A(l,u);if(p){let t;return e[3]===p?t=e[4]:(t=(0,U.jsx)(M,{error:p}),e[3]=p,e[4]=t),t}if(m||!d){let t;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(b,{size:`medium`,centered:!0}),e[5]=t):t=e[5],t}let h=i===`vertical`,g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,U.jsx)(s,{placeholder:`Search snippets...`,className:`h-6 m-1`,rootClassName:`flex-1 border-r`}),e[6]=g):g=e[6];let _,v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,U.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[g,(0,U.jsx)(G,{children:(0,U.jsx)(`button`,{className:`float-right px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,children:(0,U.jsx)(x,{className:`h-4 w-4`})})})]}),v=(0,U.jsx)(c,{children:`No results`}),e[7]=_,e[8]=v):(_=e[7],v=e[8]);let y;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>r(e),e[9]=y):y=e[9];let S;e[10]===d.snippets?S=e[11]:(S=(0,U.jsx)(F,{defaultSize:40,minSize:20,maxSize:70,children:(0,U.jsxs)(o,{className:`h-full rounded-none`,children:[_,v,(0,U.jsx)(X,{onSelect:y,snippets:d.snippets})]})}),e[10]=d.snippets,e[11]=S);let C=h?`h-1`:`w-1`,w;e[12]===C?w=e[13]:(w=f(`bg-border hover:bg-primary/50 transition-colors`,C),e[12]=C,e[13]=w);let T;e[14]===w?T=e[15]:(T=(0,U.jsx)(P,{className:w}),e[14]=w,e[15]=T);let E;e[16]===n?E=e[17]:(E=(0,U.jsx)(F,{defaultSize:60,minSize:20,children:(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(`div`,{className:`h-full snippet-viewer flex flex-col overflow-hidden`,children:n?(0,U.jsx)(Y,{snippet:n,onClose:()=>r(void 0)},n.title):(0,U.jsx)(I,{title:``,description:`Click on a snippet to view its content.`})})})}),e[16]=n,e[17]=E);let D;return e[18]!==i||e[19]!==a||e[20]!==E||e[21]!==S||e[22]!==T?(D=(0,U.jsx)(`div`,{className:`flex-1 overflow-hidden h-full`,children:(0,U.jsxs)(N,{direction:i,className:`h-full`,children:[S,T,E]},a)}),e[18]=i,e[19]=a,e[20]=E,e[21]=S,e[22]=T,e[23]=D):D=e[23],D},Y=e=>{let t=(0,H.c)(33),{snippet:n,onClose:a}=e,{theme:o}=k(),{createNewCell:s}=r(),c=i(),l;t[0]!==s||t[1]!==c||t[2]!==n.sections?(l=()=>{for(let e of n.sections.toReversed())e.code&&s({code:e.code,before:!1,cellId:c??`__end__`,skipIfCodeExists:!0})},t[0]=s,t[1]=c,t[2]=n.sections,t[3]=l):l=t[3];let u=l,d;t[4]!==s||t[5]!==c?(d=e=>{s({code:e,before:!1,cellId:c??`__end__`})},t[4]=s,t[5]=c,t[6]=d):d=t[6];let f=d,p;t[7]===n.title?p=t[8]:(p=(0,U.jsx)(`span`,{children:n.title}),t[7]=n.title,t[8]=p);let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsx)(v,{className:`h-4 w-4`}),t[9]=y):y=t[9];let b;t[10]===a?b=t[11]:(b=(0,U.jsx)(h,{size:`sm`,variant:`ghost`,onClick:a,className:`h-6 w-6 p-0 hover:bg-muted-foreground/10`,children:y}),t[10]=a,t[11]=b);let x;t[12]!==p||t[13]!==b?(x=(0,U.jsxs)(`div`,{className:`text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center`,children:[p,b]}),t[12]=p,t[13]=b,t[14]=x):x=t[14];let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,U.jsx)(g,{className:`ml-2 h-4 w-4`}),t[15]=S):S=t[15];let C;t[16]===u?C=t[17]:(C=(0,U.jsx)(`div`,{className:`flex justify-end`,children:(0,U.jsx)(B,{children:(0,U.jsxs)(h,{className:`float-right`,size:`xs`,variant:`outline`,onClick:u,children:[`Insert snippet`,S]})})}),t[16]=u,t[17]=C);let w;if(t[18]!==f||t[19]!==n.sections||t[20]!==n.title||t[21]!==o){let e;t[23]!==f||t[24]!==n.title||t[25]!==o?(e=e=>{let{code:t,html:r,id:i}=e;if(r)return(0,U.jsx)(`div`,{children:j({html:r})},`${n.title}-${i}`);if(!t)return null;let{language:a,code:s}=z(t);return(0,U.jsxs)(`div`,{className:`relative hover-actions-parent pr-2`,children:[(0,U.jsx)(B,{children:(0,U.jsx)(m,{content:`Insert snippet`,children:(0,U.jsx)(h,{className:`absolute -top-2 -right-1 z-10 hover-action px-2 bg-background`,size:`sm`,variant:`outline`,onClick:()=>{f(t)},children:(0,U.jsx)(g,{className:`h-5 w-5`})})})}),(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(_,{theme:o===`dark`?`dark`:`light`,language:a,className:`cm border rounded overflow-hidden`,extensions:q,value:s,readOnly:!0},`${n.title}-${i}`)})]},`${n.title}-${i}`)},t[23]=f,t[24]=n.title,t[25]=o,t[26]=e):e=t[26],w=n.sections.map(e),t[18]=f,t[19]=n.sections,t[20]=n.title,t[21]=o,t[22]=w}else w=t[22];let T;t[27]!==C||t[28]!==w?(T=(0,U.jsxs)(`div`,{className:`px-2 py-2 space-y-4 overflow-auto flex-1`,children:[C,w]}),t[27]=C,t[28]=w,t[29]=T):T=t[29];let E;return t[30]!==T||t[31]!==x?(E=(0,U.jsxs)(U.Fragment,{children:[x,T]}),t[30]=T,t[31]=x,t[32]=E):E=t[32],E},X=e=>{let t=(0,H.c)(7),{snippets:r,onSelect:i}=e,o;if(t[0]!==i||t[1]!==r){let e;t[3]===i?e=t[4]:(e=e=>(0,U.jsx)(a,{className:`rounded-none`,onSelect:()=>i(e),children:(0,U.jsx)(`div`,{className:`flex flex-row gap-2 items-center`,children:(0,U.jsx)(`span`,{className:`mt-1 text-accent-foreground`,children:e.title})})},e.title),t[3]=i,t[4]=e),o=r.map(e),t[0]=i,t[1]=r,t[2]=o}else o=t[2];let s;return t[5]===o?s=t[6]:(s=(0,U.jsx)(n,{className:`flex flex-col overflow-auto`,children:o}),t[5]=o,t[6]=s),s};export{J as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CUdNIagt.js";import{Cn as n,D as r,Rt as i,_n as a,fn as o,gn as s,mn as c}from"./cells-h5u00Nz8.js";import{t as l}from"./compiler-runtime-BQ9S8nyo.js";import{n as u}from"./useEventListener-IRzG-0mH.js";import{r as d}from"./utils-B4K466FK.js";import{t as f}from"./cn-ldLVeaqm.js";import{t as p}from"./jsx-runtime-B74pBk57.js";import{t as m}from"./tooltip-B5pI8o2n.js";import{t as h}from"./button-M49xxKoi.js";import{n as g,t as _}from"./LazyAnyLanguageCodeMirror-CeTd_wFt.js";import{r as v}from"./useNumberFormatter-BP99Zbyy.js";import{b as y}from"./write-secret-modal-BcosCmZy.js";import{t as b}from"./spinner-CGdRKCnw.js";import{t as x}from"./plus-gbN72xHe.js";import{Qt as S,Xt as C,Yt as w,Zt as T,tn as E}from"./input-DPd57MDP.js";import{st as D}from"./dist-Cny7_yZb.js";import{r as O}from"./requests-yTHMxhVa.js";import{r as k}from"./useTheme-BkPLyRl9.js";import{n as A}from"./useAsyncData-DucTwMkf.js";import{t as j}from"./RenderHTML-DRMkieKn.js";import{n as M}from"./error-banner-D1_bPN9u.js";import{n as N,r as P,t as F}from"./react-resizable-panels.browser.esm-BL2E7f5c.js";import{t as I}from"./empty-state-CzxjZqGW.js";import{n as L,r as R}from"./panel-context-BPaQeOuV.js";import{t as z}from"./readonly-code-display-xvH6MyT6.js";import{t as B}from"./kiosk-mode-DCHo0R3W.js";var V=e(t(),1),H=l(),U=p(),W=u,G=e=>{let t=(0,H.c)(6),{children:n}=e,{openModal:r,closeModal:i}=y(),a;t[0]!==i||t[1]!==r?(a=()=>r((0,U.jsx)(K,{onClose:i})),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==a?(o=(0,U.jsx)(W,{onClick:a,children:n}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o},K=e=>{let t=(0,H.c)(4),{onClose:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(E,{children:`Contribute a Snippet`}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,U.jsxs)(S,{children:[r,(0,U.jsxs)(C,{children:[`Have a useful snippet you want to share with the community? Make a pull request`,` `,(0,U.jsx)(`a`,{href:d.githubPage,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`on GitHub`}),`.`]})]}),t[1]=i):i=t[1];let a;return t[2]===n?a=t[3]:(a=(0,U.jsxs)(w,{className:`max-w-md`,children:[i,(0,U.jsx)(T,{children:(0,U.jsx)(h,{"data-testid":`snippet-close-button`,variant:`default`,onClick:n,children:`Close`})})]}),t[2]=n,t[3]=a),a},q=[D.lineWrapping],J=()=>{let e=(0,H.c)(24),{readSnippets:t}=O(),[n,r]=V.useState(),i=L(),a=R(),l;e[0]===t?l=e[1]:(l=()=>t(),e[0]=t,e[1]=l);let u;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],e[2]=u):u=e[2];let{data:d,error:p,isPending:m}=A(l,u);if(p){let t;return e[3]===p?t=e[4]:(t=(0,U.jsx)(M,{error:p}),e[3]=p,e[4]=t),t}if(m||!d){let t;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(b,{size:`medium`,centered:!0}),e[5]=t):t=e[5],t}let h=i===`vertical`,g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,U.jsx)(s,{placeholder:`Search snippets...`,className:`h-6 m-1`,rootClassName:`flex-1 border-r`}),e[6]=g):g=e[6];let _,v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,U.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[g,(0,U.jsx)(G,{children:(0,U.jsx)(`button`,{className:`float-right px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,children:(0,U.jsx)(x,{className:`h-4 w-4`})})})]}),v=(0,U.jsx)(c,{children:`No results`}),e[7]=_,e[8]=v):(_=e[7],v=e[8]);let y;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>r(e),e[9]=y):y=e[9];let S;e[10]===d.snippets?S=e[11]:(S=(0,U.jsx)(F,{defaultSize:40,minSize:20,maxSize:70,children:(0,U.jsxs)(o,{className:`h-full rounded-none`,children:[_,v,(0,U.jsx)(X,{onSelect:y,snippets:d.snippets})]})}),e[10]=d.snippets,e[11]=S);let C=h?`h-1`:`w-1`,w;e[12]===C?w=e[13]:(w=f(`bg-border hover:bg-primary/50 transition-colors`,C),e[12]=C,e[13]=w);let T;e[14]===w?T=e[15]:(T=(0,U.jsx)(P,{className:w}),e[14]=w,e[15]=T);let E;e[16]===n?E=e[17]:(E=(0,U.jsx)(F,{defaultSize:60,minSize:20,children:(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(`div`,{className:`h-full snippet-viewer flex flex-col overflow-hidden`,children:n?(0,U.jsx)(Y,{snippet:n,onClose:()=>r(void 0)},n.title):(0,U.jsx)(I,{title:``,description:`Click on a snippet to view its content.`})})})}),e[16]=n,e[17]=E);let D;return e[18]!==i||e[19]!==a||e[20]!==E||e[21]!==S||e[22]!==T?(D=(0,U.jsx)(`div`,{className:`flex-1 overflow-hidden h-full`,children:(0,U.jsxs)(N,{direction:i,className:`h-full`,children:[S,T,E]},a)}),e[18]=i,e[19]=a,e[20]=E,e[21]=S,e[22]=T,e[23]=D):D=e[23],D},Y=e=>{let t=(0,H.c)(33),{snippet:n,onClose:a}=e,{theme:o}=k(),{createNewCell:s}=r(),c=i(),l;t[0]!==s||t[1]!==c||t[2]!==n.sections?(l=()=>{for(let e of n.sections.toReversed())e.code&&s({code:e.code,before:!1,cellId:c??`__end__`,skipIfCodeExists:!0})},t[0]=s,t[1]=c,t[2]=n.sections,t[3]=l):l=t[3];let u=l,d;t[4]!==s||t[5]!==c?(d=e=>{s({code:e,before:!1,cellId:c??`__end__`})},t[4]=s,t[5]=c,t[6]=d):d=t[6];let f=d,p;t[7]===n.title?p=t[8]:(p=(0,U.jsx)(`span`,{children:n.title}),t[7]=n.title,t[8]=p);let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsx)(v,{className:`h-4 w-4`}),t[9]=y):y=t[9];let b;t[10]===a?b=t[11]:(b=(0,U.jsx)(h,{size:`sm`,variant:`ghost`,onClick:a,className:`h-6 w-6 p-0 hover:bg-muted-foreground/10`,children:y}),t[10]=a,t[11]=b);let x;t[12]!==p||t[13]!==b?(x=(0,U.jsxs)(`div`,{className:`text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center`,children:[p,b]}),t[12]=p,t[13]=b,t[14]=x):x=t[14];let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,U.jsx)(g,{className:`ml-2 h-4 w-4`}),t[15]=S):S=t[15];let C;t[16]===u?C=t[17]:(C=(0,U.jsx)(`div`,{className:`flex justify-end`,children:(0,U.jsx)(B,{children:(0,U.jsxs)(h,{className:`float-right`,size:`xs`,variant:`outline`,onClick:u,children:[`Insert snippet`,S]})})}),t[16]=u,t[17]=C);let w;if(t[18]!==f||t[19]!==n.sections||t[20]!==n.title||t[21]!==o){let e;t[23]!==f||t[24]!==n.title||t[25]!==o?(e=e=>{let{code:t,html:r,id:i}=e;if(r)return(0,U.jsx)(`div`,{children:j({html:r})},`${n.title}-${i}`);if(!t)return null;let{language:a,code:s}=z(t);return(0,U.jsxs)(`div`,{className:`relative hover-actions-parent pr-2`,children:[(0,U.jsx)(B,{children:(0,U.jsx)(m,{content:`Insert snippet`,children:(0,U.jsx)(h,{className:`absolute -top-2 -right-1 z-10 hover-action px-2 bg-background`,size:`sm`,variant:`outline`,onClick:()=>{f(t)},children:(0,U.jsx)(g,{className:`h-5 w-5`})})})}),(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(_,{theme:o===`dark`?`dark`:`light`,language:a,className:`cm border rounded overflow-hidden`,extensions:q,value:s,readOnly:!0},`${n.title}-${i}`)})]},`${n.title}-${i}`)},t[23]=f,t[24]=n.title,t[25]=o,t[26]=e):e=t[26],w=n.sections.map(e),t[18]=f,t[19]=n.sections,t[20]=n.title,t[21]=o,t[22]=w}else w=t[22];let T;t[27]!==C||t[28]!==w?(T=(0,U.jsxs)(`div`,{className:`px-2 py-2 space-y-4 overflow-auto flex-1`,children:[C,w]}),t[27]=C,t[28]=w,t[29]=T):T=t[29];let E;return t[30]!==T||t[31]!==x?(E=(0,U.jsxs)(U.Fragment,{children:[x,T]}),t[30]=T,t[31]=x,t[32]=E):E=t[32],E},X=e=>{let t=(0,H.c)(7),{snippets:r,onSelect:i}=e,o;if(t[0]!==i||t[1]!==r){let e;t[3]===i?e=t[4]:(e=e=>(0,U.jsx)(a,{className:`rounded-none`,onSelect:()=>i(e),children:(0,U.jsx)(`div`,{className:`flex flex-row gap-2 items-center`,children:(0,U.jsx)(`span`,{className:`mt-1 text-accent-foreground`,children:e.title})})},e.title),t[3]=i,t[4]=e),o=r.map(e),t[0]=i,t[1]=r,t[2]=o}else o=t[2];let s;return t[5]===o?s=t[6]:(s=(0,U.jsx)(n,{className:`flex flex-col overflow-auto`,children:o}),t[5]=o,t[6]=s),s};export{J as default};