notebook 7.2.0rc0__py3-none-any.whl → 7.2.1__py3-none-any.whl

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.

Potentially problematic release.


This version of notebook might be problematic. Click here for more details.

Files changed (175) hide show
  1. notebook/_version.py +1 -1
  2. notebook/static/113.bundle.js +1 -1
  3. notebook/static/1198.bundle.js +1 -1
  4. notebook/static/134.bundle.js +1 -1
  5. notebook/static/1388.bundle.js +1 -1
  6. notebook/static/1408.bundle.js +1 -1
  7. notebook/static/1496.bundle.js +1 -1
  8. notebook/static/1647.bundle.js +1 -1
  9. notebook/static/1650.bundle.js +1 -1
  10. notebook/static/1684.bundle.js +1 -1
  11. notebook/static/1809.bundle.js +1 -1
  12. notebook/static/1827.bundle.js +1 -1
  13. notebook/static/1833.bundle.js +1 -1
  14. notebook/static/1846.bundle.js +1 -1
  15. notebook/static/1958.bundle.js +1 -1
  16. notebook/static/1962.bundle.js +1 -1
  17. notebook/static/2007.bundle.js +1 -1
  18. notebook/static/2088.bundle.js +1 -1
  19. notebook/static/2089.bundle.js +1 -1
  20. notebook/static/2122.bundle.js +1 -1
  21. notebook/static/2167.bundle.js +1 -1
  22. notebook/static/2184.bundle.js +1 -1
  23. notebook/static/2311.bundle.js +1 -1
  24. notebook/static/2401.bundle.js +1 -1
  25. notebook/static/2479.bundle.js +1 -1
  26. notebook/static/2489.bundle.js +1 -1
  27. notebook/static/2607.bundle.js +1 -1
  28. notebook/static/2615.bundle.js +1 -1
  29. notebook/static/2636.bundle.js +1 -1
  30. notebook/static/2692.bundle.js +1 -1
  31. notebook/static/2924.bundle.js +1 -1
  32. notebook/static/2944.bundle.js +1 -1
  33. notebook/static/3129.bundle.js +1 -1
  34. notebook/static/3146.bundle.js +1 -1
  35. notebook/static/3154.bundle.js +1 -1
  36. notebook/static/3187.bundle.js +1 -1
  37. notebook/static/3213.bundle.js +1 -1
  38. notebook/static/3340.bundle.js +1 -1
  39. notebook/static/3360.bundle.js +1 -1
  40. notebook/static/3466.bundle.js +1 -1
  41. notebook/static/3512.bundle.js +1 -1
  42. notebook/static/3676.bundle.js +1 -1
  43. notebook/static/3680.bundle.js +1 -1
  44. notebook/static/374.bundle.js +1 -1
  45. notebook/static/3768.bundle.js +1 -1
  46. notebook/static/377.bundle.js +1 -1
  47. notebook/static/3863.bundle.js +1 -1
  48. notebook/static/3881.bundle.js +1 -1
  49. notebook/static/4042.bundle.js +1 -1
  50. notebook/static/4212.bundle.js +1 -1
  51. notebook/static/4382.bundle.js +1 -1
  52. notebook/static/4630.bundle.js +1 -1
  53. notebook/static/4645.bundle.js +1 -1
  54. notebook/static/4811.bundle.js +1 -1
  55. notebook/static/4837.bundle.js +1 -1
  56. notebook/static/5099.bundle.js +1 -1
  57. notebook/static/5135.bundle.js +1 -1
  58. notebook/static/5254.bundle.js +1 -1
  59. notebook/static/5263.bundle.js +1 -1
  60. notebook/static/5313.bundle.js +1 -1
  61. notebook/static/5325.bundle.js +1 -1
  62. notebook/static/5346.bundle.js +1 -1
  63. notebook/static/5425.bundle.js +1 -1
  64. notebook/static/5426.bundle.js +1 -1
  65. notebook/static/545.bundle.js +1 -1
  66. notebook/static/5573.bundle.js +1 -1
  67. notebook/static/5601.bundle.js +1 -1
  68. notebook/static/5733.bundle.js +1 -1
  69. notebook/static/5912.bundle.js +1 -1
  70. notebook/static/5921.bundle.js +1 -1
  71. notebook/static/6017.bundle.js +1 -1
  72. notebook/static/{1053.bundle.js → 6078.bundle.js} +1 -1
  73. notebook/static/6139.bundle.js +1 -1
  74. notebook/static/62.bundle.js +1 -1
  75. notebook/static/6281.bundle.js +1 -1
  76. notebook/static/6345.bundle.js +1 -1
  77. notebook/static/6417.bundle.js +1 -1
  78. notebook/static/6604.bundle.js +1 -1
  79. notebook/static/6621.bundle.js +1 -1
  80. notebook/static/6627.bundle.js +1 -1
  81. notebook/static/6640.bundle.js +1 -1
  82. notebook/static/6748.bundle.js +1 -1
  83. notebook/static/6815.bundle.js +1 -1
  84. notebook/static/6853.bundle.js +1 -1
  85. notebook/static/6893.bundle.js +1 -1
  86. notebook/static/690.bundle.js +1 -1
  87. notebook/static/6962.bundle.js +1 -1
  88. notebook/static/6999.bundle.js +1 -1
  89. notebook/static/7097.bundle.js +1 -1
  90. notebook/static/7153.bundle.js +1 -1
  91. notebook/static/7226.bundle.js +1 -1
  92. notebook/static/7252.bundle.js +1 -1
  93. notebook/static/7259.bundle.js +1 -1
  94. notebook/static/7302.bundle.js +1 -1
  95. notebook/static/7386.bundle.js +1 -1
  96. notebook/static/7391.bundle.js +1 -1
  97. notebook/static/7471.bundle.js +1 -1
  98. notebook/static/7506.bundle.js +2 -2
  99. notebook/static/7543.bundle.js +1 -1
  100. notebook/static/7603.bundle.js +1 -1
  101. notebook/static/7639.bundle.js +1 -1
  102. notebook/static/7655.bundle.js +1 -1
  103. notebook/static/7684.bundle.js +1 -1
  104. notebook/static/7812.bundle.js +1 -1
  105. notebook/static/7819.bundle.js +1 -1
  106. notebook/static/7854.bundle.js +1 -1
  107. notebook/static/7900.bundle.js +1 -1
  108. notebook/static/7906.bundle.js +1 -1
  109. notebook/static/8471.bundle.js +1 -1
  110. notebook/static/8579.bundle.js +1 -1
  111. notebook/static/8633.bundle.js +1 -1
  112. notebook/static/8771.bundle.js +1 -1
  113. notebook/static/8781.bundle.js +1 -1
  114. notebook/static/8845.bundle.js +1 -1
  115. notebook/static/8875.bundle.js +1 -1
  116. notebook/static/8907.bundle.js +1 -1
  117. notebook/static/8928.bundle.js +1 -1
  118. notebook/static/893.bundle.js +1 -1
  119. notebook/static/901.bundle.js +1 -1
  120. notebook/static/9068.bundle.js +1 -1
  121. notebook/static/9136.bundle.js +1 -1
  122. notebook/static/9151.bundle.js +1 -1
  123. notebook/static/9161.bundle.js +1 -1
  124. notebook/static/9268.bundle.js +1 -1
  125. notebook/static/9335.bundle.js +1 -1
  126. notebook/static/9341.bundle.js +1 -1
  127. notebook/static/9380.bundle.js +1 -1
  128. notebook/static/9605.bundle.js +1 -1
  129. notebook/static/9638.bundle.js +1 -1
  130. notebook/static/9680.bundle.js +1 -1
  131. notebook/static/9685.bundle.js +1 -1
  132. notebook/static/9752.bundle.js +1 -1
  133. notebook/static/9821.bundle.js +1 -1
  134. notebook/static/9852.bundle.js +1 -1
  135. notebook/static/bundle.js +1 -1
  136. notebook/static/third-party-licenses.json +101 -101
  137. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +14 -14
  138. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +4 -4
  139. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
  140. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +9 -9
  141. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +15 -15
  142. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +11 -11
  143. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +10 -10
  144. notebook-7.2.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.c842f59b09a70d32fbf5.js → notebook-7.2.1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.9cd06af416befd593828.js +1 -1
  145. notebook-7.2.1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/678.af323c3ff765541c6aa4.js +1 -0
  146. notebook-7.2.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.0be57dd4ecbedec78b46.js → notebook-7.2.1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.6d26fccf0ddab13bf5bb.js +1 -1
  147. notebook-7.2.1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.d04be841d48ffe2a9bdd.js +1 -0
  148. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
  149. {notebook-7.2.0rc0.dist-info → notebook-7.2.1.dist-info}/METADATA +2 -2
  150. {notebook-7.2.0rc0.dist-info → notebook-7.2.1.dist-info}/RECORD +173 -173
  151. notebook-7.2.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/546.f643d3e7381a2d9b834f.js +0 -1
  152. notebook-7.2.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.dbe55a308c2bef40bd5e.js +0 -1
  153. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
  154. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/applications/jupyter-notebook.desktop +0 -0
  155. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
  156. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
  157. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
  158. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +0 -0
  159. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
  160. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
  161. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
  162. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
  163. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
  164. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/edit-notebook-metadata.json +0 -0
  165. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
  166. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
  167. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
  168. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -0
  169. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
  170. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
  171. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/93.eae3497dd223d842d198.js +0 -0
  172. {notebook-7.2.0rc0.data → notebook-7.2.1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
  173. {notebook-7.2.0rc0.dist-info → notebook-7.2.1.dist-info}/WHEEL +0 -0
  174. {notebook-7.2.0rc0.dist-info → notebook-7.2.1.dist-info}/entry_points.txt +0 -0
  175. {notebook-7.2.0rc0.dist-info → notebook-7.2.1.dist-info}/licenses/LICENSE +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6621],{78947:(e,t,s)=>{s.d(t,{q:()=>He});var i=s(22620);const r=1540483477,n=new TextEncoder;function o(e,t){const s=n.encode(e);let i=s.length,o=t^i,a=0;for(;i>=4;){let e=255&s[a]|(255&s[++a])<<8|(255&s[++a])<<16|(255&s[++a])<<24;e=(65535&e)*r+(((e>>>16)*r&65535)<<16),e^=e>>>24,e=(65535&e)*r+(((e>>>16)*r&65535)<<16),o=(65535&o)*r+(((o>>>16)*r&65535)<<16)^e,i-=4,++a}switch(i){case 3:o^=(255&s[a+2])<<16;case 2:o^=(255&s[a+1])<<8;case 1:o^=255&s[a],o=(65535&o)*r+(((o>>>16)*r&65535)<<16)}return o^=o>>>13,o=(65535&o)*r+(((o>>>16)*r&65535)<<16),o^=o>>>15,o>>>0}class a{constructor(){this._fileParams=new Map,this._hashMethods=new Map}getCodeId(e,t){const s=this._fileParams.get(t);if(!s)throw new Error(`Kernel (${t}) has no tmp file params.`);const i=this._hashMethods.get(t);if(!i)throw new Error(`Kernel (${t}) has no hashing params.`);const{prefix:r,suffix:n}=s;return`${r}${i(e)}${n}`}setHashParams(e){const{kernel:t,method:s,seed:i}=e;if(!t)throw new TypeError("Kernel name is not defined.");if("Murmur2"!==s)throw new Error(`Hash method (${s}) is not supported.`);this._hashMethods.set(t,(e=>o(e,i).toString()))}setTmpFileParams(e){const{kernel:t,prefix:s,suffix:i}=e;if(!t)throw new TypeError("Kernel name is not defined.");this._fileParams.set(t,{kernel:t,prefix:s,suffix:i})}getTmpFileParams(e){return this._fileParams.get(e)}}var l,d=s(96049),c=s(67406),h=s(63485);!function(e){e.getCode=function(e){return new u({...e,body:new p(e),buttons:[d.Dialog.cancelButton({label:e.cancelLabel}),d.Dialog.okButton({label:e.okLabel})]}).launch()}}(l||(l={}));class u extends d.Dialog{handleEvent(e){if("keydown"===e.type){const t=e,{code:s,shiftKey:i}=t;if(i&&"Enter"===s)return this.resolve();if("Enter"===s)return}super.handleEvent(e)}}class p extends h.Widget{constructor(e){super();const{contentFactory:t,rendermime:s,mimeType:i}=e,r=new c.CodeCellModel;r.mimeType=null!=i?i:"",this._prompt=new c.CodeCell({contentFactory:t,rendermime:s,model:r,placeholder:!1}).initializeState(),this._prompt.inputArea.promptNode.remove(),this.node.appendChild(this._prompt.node)}getValue(){return this._prompt.model.sharedModel.getSource()}onAfterAttach(e){super.onAfterAttach(e),this._prompt.activate()}}var g=s(52839);class _{constructor(e){this._services=e.editorServices}createNewEditor(e){const{content:t,mimeType:s,path:i}=e,r=this._services.factoryService.newInlineEditor,n=this._services.mimeTypeService,o=new g.CodeEditor.Model({mimeType:s||n.getMimeTypeByFilePath(i)});o.sharedModel.source=t;const a=new g.CodeEditorWrapper({editorOptions:{config:{readOnly:!0,lineNumbers:!0}},model:o,factory:r});return a.node.setAttribute("data-jp-debugger","true"),a.disposed.connect((()=>{o.dispose()})),a}}var m,v=s(37267),b=s(58959),f=s(81997),w=s(1167),k=s(89843),S=s(3546);class C{constructor(e){var t,s,i,r;this._src=e.src,this._id=null!==(i=null===(s=null===(t=e.debuggerService.session)||void 0===t?void 0:t.connection)||void 0===s?void 0:s.id)&&void 0!==i?i:"",this._path=null!==(r=e.path)&&void 0!==r?r:"",this._debuggerService=e.debuggerService,this._editor=e.getEditor,this._editorMonitor=new w.ActivityMonitor({signal:this._src.changed,timeout:1e3}),this._editorMonitor.activityStopped.connect((()=>{this._sendEditorBreakpoints()}),this),this._debuggerService.model.breakpoints.changed.connect((async()=>{const e=this.editor;e&&!e.isDisposed&&this._addBreakpointsToEditor()})),this._debuggerService.model.breakpoints.restored.connect((async()=>{const e=this.editor;e&&!e.isDisposed&&this._addBreakpointsToEditor()})),this._debuggerService.model.callstack.currentFrameChanged.connect((()=>{const e=this.editor;e&&C.clearHighlight(e)})),this._breakpointEffect=k.StateEffect.define({map:(e,t)=>({pos:e.pos.map((e=>t.mapPos(e)))})}),this._breakpointState=k.StateField.define({create:()=>k.RangeSet.empty,update:(e,t)=>{e=e.map(t.changes);for(let s of t.effects)if(s.is(this._breakpointEffect)){let t=s;e=t.value.pos.length?e.update({add:t.value.pos.map((e=>m.breakpointMarker.range(e))),sort:!0}):k.RangeSet.empty}return e}}),this._gutter=new k.Compartment,this._highlightDeco=S.Decoration.line({class:"jp-DebuggerEditor-highlight"}),this._highlightState=k.StateField.define({create:()=>S.Decoration.none,update:(e,t)=>{e=e.map(t.changes);for(let s of t.effects)if(s.is(C._highlightEffect)){let t=s;e=t.value.pos.length?e.update({add:t.value.pos.map((e=>this._highlightDeco.range(e)))}):S.Decoration.none}return e},provide:e=>S.EditorView.decorations.from(e)}),e.editorReady().then((()=>{this._setupEditor()}))}get editor(){return this._editor()}dispose(){this.isDisposed||(this._editorMonitor.dispose(),this._clearEditor(),this.isDisposed=!0,f.Signal.clearData(this))}refreshBreakpoints(){this._addBreakpointsToEditor()}_setupEditor(){const e=this.editor;if(!e||e.isDisposed)return;e.setOption("lineNumbers",!0);const t=[this._breakpointState,this._highlightState,k.Prec.highest((0,S.gutter)({class:"cm-breakpoint-gutter",renderEmptyElements:!0,markers:e=>e.state.field(this._breakpointState),initialSpacer:()=>m.breakpointMarker,domEventHandlers:{mousedown:(e,t)=>(this._onGutterClick(e,t.from),!0)}}))];e.injectExtension(this._gutter.of(t)),this._addBreakpointsToEditor()}_clearEditor(){const e=this.editor;e&&!e.isDisposed&&(C.clearHighlight(e),this._clearGutter(e),e.setOption("lineNumbers",!1),e.editor.dispatch({effects:this._gutter.reconfigure([])}))}_sendEditorBreakpoints(){var e;if(null===(e=this.editor)||void 0===e?void 0:e.isDisposed)return;const t=this._getBreakpointsFromEditor().map((e=>{var t,s;return m.createBreakpoint((null===(s=null===(t=this._debuggerService.session)||void 0===t?void 0:t.connection)||void 0===s?void 0:s.name)||"",e)}));this._debuggerService.updateBreakpoints(this._src.getSource(),t,this._path)}_onGutterClick(e,t){var s,i,r;if(this._id!==(null===(i=null===(s=this._debuggerService.session)||void 0===s?void 0:s.connection)||void 0===i?void 0:i.id))return;const n=e.state.doc.lineAt(t).number;let o=e.state.field(this._breakpointState),a=!1;o.between(t,t,(()=>{a=!0}));let l=this._getBreakpoints();a?l=l.filter((e=>e.line!==n)):l.push(m.createBreakpoint(null!==(r=this._path)&&void 0!==r?r:this._debuggerService.session.connection.name,n)),l.sort(((e,t)=>e.line-t.line)),this._debuggerService.updateBreakpoints(this._src.getSource(),l,this._path)}_addBreakpointsToEditor(){var e,t;if(this._id!==(null===(t=null===(e=this._debuggerService.session)||void 0===e?void 0:e.connection)||void 0===t?void 0:t.id))return;const s=this.editor,i=this._getBreakpoints();this._clearGutter(s);const r=i.map((e=>s.state.doc.line(e.line).from));s.editor.dispatch({effects:this._breakpointEffect.of({pos:r})})}_getBreakpointsFromEditor(){const e=this.editor,t=e.editor.state.field(this._breakpointState);let s=[];return t.between(0,e.doc.length,(t=>{s.push(e.doc.lineAt(t).number)})),s}_clearGutter(e){e&&e.editor.dispatch({effects:this._breakpointEffect.of({pos:[]})})}_getBreakpoints(){const e=this._src.getSource();return this._debuggerService.model.breakpoints.getBreakpoints(this._path||this._debuggerService.getCodeId(e))}}!function(e){function t(t){t&&!t.isDisposed&&t.editor.dispatch({effects:e._highlightEffect.of({pos:[]})})}e._highlightEffect=k.StateEffect.define({map:(e,t)=>({pos:e.pos.map((e=>t.mapPos(e)))})}),e.showCurrentLine=function(s,i){t(s);const r=s,n=r.doc.line(i).from;r.editor.dispatch({effects:e._highlightEffect.of({pos:[n]})})},e.clearHighlight=t}(C||(C={})),function(e){e.breakpointMarker=new class extends S.GutterMarker{toDOM(){return document.createTextNode("●")}},e.createBreakpoint=function(e,t){return{line:t,verified:!0,source:{name:e}}}}(m||(m={}));class y{constructor(e){this._debuggerService=e.debuggerService,this._consolePanel=e.widget,this._cellMap=new b.ObservableMap;const t=this._consolePanel.console;t.promptCell&&this._addEditorHandler(t.promptCell),t.promptCellCreated.connect(((e,t)=>{this._addEditorHandler(t)}));const s=()=>{for(const e of t.cells)this._addEditorHandler(e)};s(),this._consolePanel.console.cells.changed.connect(s)}dispose(){this.isDisposed||(this.isDisposed=!0,this._cellMap.values().forEach((e=>e.dispose())),this._cellMap.dispose(),f.Signal.clearData(this))}_addEditorHandler(e){const t=e.model.id;if("code"!==e.model.type||this._cellMap.has(t))return;const s=e,i=new C({debuggerService:this._debuggerService,editorReady:async()=>(await s.ready,s.editor),getEditor:()=>s.editor,src:e.model.sharedModel});s.disposed.connect((()=>{this._cellMap.delete(t),i.dispose()})),this._cellMap.set(t,i)}}class E{constructor(e){var t;this._debuggerService=e.debuggerService,this._fileEditor=e.widget.content,this._hasLineNumber=null!==(t=this._fileEditor.editor.getOption("lineNumbers"))&&void 0!==t&&t,this._editorHandler=new C({debuggerService:this._debuggerService,editorReady:()=>Promise.resolve(this._fileEditor.editor),getEditor:()=>this._fileEditor.editor,src:this._fileEditor.model.sharedModel})}dispose(){var e,t;this.isDisposed||(this.isDisposed=!0,null===(e=this._editorHandler)||void 0===e||e.dispose(),null===(t=this._editorHandler)||void 0===t||t.editor.setOptions({lineNumbers:this._hasLineNumber}),f.Signal.clearData(this))}}class x{constructor(e){this._debuggerService=e.debuggerService,this._notebookPanel=e.widget,this._cellMap=new b.ObservableMap,this._notebookPanel.content.model.cells.changed.connect(this._onCellsChanged,this),this._onCellsChanged()}dispose(){this.isDisposed||(this.isDisposed=!0,this._cellMap.values().forEach((e=>{var t;e.dispose(),null===(t=e.editor)||void 0===t||t.setOptions({...this._notebookPanel.content.editorConfig.code})})),this._cellMap.dispose(),f.Signal.clearData(this))}_onCellsChanged(e,t){var s;if(this._notebookPanel.content.widgets.forEach((e=>this._addEditorHandler(e))),"move"===(null==t?void 0:t.type))for(const e of t.newValues)null===(s=this._cellMap.get(e.id))||void 0===s||s.refreshBreakpoints()}_addEditorHandler(e){const t=e.model.id;if("code"!==e.model.type||this._cellMap.has(t))return;const s=e,i=new C({debuggerService:this._debuggerService,editorReady:async()=>(await s.ready,s.editor),getEditor:()=>s.editor,src:e.model.sharedModel});s.disposed.connect((()=>{this._cellMap.delete(t),i.dispose()})),this._cellMap.set(e.model.id,i)}}const M="debugger-icon";function D(e,t,s=!0,i){e&&(e.enabled=s,e.pressed=t,i&&(e.onClick=i))}class T{constructor(e){this._handlers={},this._contextKernelChangedHandlers={},this._kernelChangedHandlers={},this._statusChangedHandlers={},this._iopubMessageHandlers={},this._iconButtons={},this._type=e.type,this._shell=e.shell,this._service=e.service}get activeWidget(){return this._activeWidget}async update(e,t){if(!t)return delete this._kernelChangedHandlers[e.id],delete this._statusChangedHandlers[e.id],delete this._iopubMessageHandlers[e.id],this.updateWidget(e,t);const s=()=>{this.updateWidget(e,t)},i=this._kernelChangedHandlers[e.id];i&&t.kernelChanged.disconnect(i),this._kernelChangedHandlers[e.id]=s,t.kernelChanged.connect(s);const r=(s,i)=>{i.endsWith("restarting")&&this.updateWidget(e,t)},n=this._statusChangedHandlers[e.id];n&&t.statusChanged.disconnect(n),t.statusChanged.connect(r),this._statusChangedHandlers[e.id]=r;const o=(e,t)=>{"execute_request"==t.parent_header.msg_type&&this._service.isStarted&&!this._service.hasStoppedThreads()&&this._service.displayDefinedVariables()},a=this._iopubMessageHandlers[e.id];return a&&t.iopubMessage.disconnect(a),t.iopubMessage.connect(o),this._iopubMessageHandlers[e.id]=o,this._activeWidget=e,this.updateWidget(e,t)}async updateContext(e,t){const s=()=>{const{session:s}=t;this.update(e,s)},i=this._contextKernelChangedHandlers[e.id];return i&&t.kernelChanged.disconnect(i),this._contextKernelChangedHandlers[e.id]=s,t.kernelChanged.connect(s),this.update(e,t.session)}async updateWidget(e,t){var s,r,n,o;if(!this._service.model||!t)return;const a=()=>this._shell.currentWidget===e,l=()=>{this._handlers[e.id]?e.node.setAttribute("data-jp-debugger","true"):e.node.removeAttribute("data-jp-debugger")},d=()=>{if(!this._handlers[e.id]){switch(this._type){case"notebook":this._handlers[e.id]=new x({debuggerService:this._service,widget:e});break;case"console":this._handlers[e.id]=new y({debuggerService:this._service,widget:e});break;case"file":this._handlers[e.id]=new E({debuggerService:this._service,widget:e});break;default:throw Error(`No handler for the type ${this._type}`)}l()}},c=()=>{var s,i,r,n;const o=this._handlers[e.id];o&&(o.dispose(),delete this._handlers[e.id],delete this._kernelChangedHandlers[e.id],delete this._statusChangedHandlers[e.id],delete this._iopubMessageHandlers[e.id],delete this._contextKernelChangedHandlers[e.id],(null===(i=null===(s=this._service.session)||void 0===s?void 0:s.connection)||void 0===i?void 0:i.path)!==(null==t?void 0:t.path)&&(null===(n=null===(r=this._service.session)||void 0===r?void 0:r.connection)||void 0===n?void 0:n.kernel)||this._service.model.clear(),l())},h=()=>{var e;return this._service.isStarted&&(null===(e=this._previousConnection)||void 0===e?void 0:e.id)===(null==t?void 0:t.id)},u=async()=>{this._service.session.connection=t,await this._service.stop()},p=async()=>{var e,s;this._service.session.connection=t,this._previousConnection=t,await this._service.restoreState(!0),await this._service.displayDefinedVariables(),(null===(s=null===(e=this._service.session)||void 0===e?void 0:e.capabilities)||void 0===s?void 0:s.supportsModulesRequest)&&await this._service.displayModules()},g=async()=>{if(!a())return;const t=this._iconButtons[e.id];h()?(await u(),c(),D(t,!1)):(await p(),d(),D(t,!0))};return((t=!0)=>{const s=this._iconButtons[e.id];s?D(s,this._service.isStarted,t,g):this._iconButtons[e.id]=function(e,t,s,r,n=v.nullTranslator){const o=n.load("jupyterlab"),a=new i.ToolbarButton({className:"jp-DebuggerBugButton",icon:i.bugIcon,tooltip:o.__("Enable Debugger"),pressedIcon:i.bugDotIcon,pressedTooltip:o.__("Disable Debugger"),disabledTooltip:o.__("Select a kernel that supports debugging to enable debugger"),enabled:s,pressed:r,onClick:t});return e.toolbar.insertBefore("kernelName",M,a)||e.toolbar.addItem(M,a),a}(e,g,this._service.isStarted,t)})(!1),e.disposed.connect((async()=>{h()&&await u(),c(),delete this._iconButtons[e.id],delete this._contextKernelChangedHandlers[e.id]})),await this._service.isAvailable(t)?(this._service.session?(this._previousConnection=(null===(s=this._service.session.connection)||void 0===s?void 0:s.kernel)?this._service.session.connection:null,this._service.session.connection=t):this._service.session=new He.Session({connection:t,config:this._service.config}),await this._service.restoreState(!1),this._service.isStarted&&!this._service.hasStoppedThreads()&&(await this._service.displayDefinedVariables(),(null===(n=null===(r=this._service.session)||void 0===r?void 0:r.capabilities)||void 0===n?void 0:n.supportsModulesRequest)&&await this._service.displayModules()),D(this._iconButtons[e.id],this._service.isStarted,!0),this._service.isStarted?(d(),void(this._previousConnection=t)):(c(),this._service.session.connection=null!==(o=this._previousConnection)&&void 0!==o?o:t,void await this._service.restoreState(!1))):(c(),void D(this._iconButtons[e.id],!1,!1))}}const I=new i.LabIcon({name:"debugger:close-all",svgstr:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <g class="jp-icon3" fill="#616161">\n <path d="M16.4805 17.2481C16.8158 16.3972 17 15.4701 17 14.5C17 10.3579 13.6421 7.00001 9.5 7.00001C8.36314 7.00001 7.28536 7.25295 6.31986 7.70564C7.60064 6.0592 9.60074 5 11.8482 5C15.7142 5 18.8482 8.13401 18.8482 12C18.8482 14.0897 17.9325 15.9655 16.4805 17.2481Z" />\n <path d="M19.1607 14.2481C19.496 13.3971 19.6801 12.4701 19.6801 11.5C19.6801 7.35786 16.3223 4 12.1801 4C11.0433 4 9.9655 4.25295 9.00001 4.70563C10.2808 3.05919 12.2809 2 14.5284 2C18.3944 2 21.5284 5.134 21.5284 9C21.5284 11.0897 20.6127 12.9655 19.1607 14.2481Z" />\n <path d="M16 15C16 18.866 12.866 22 9 22C5.13401 22 2 18.866 2 15C2 11.134 5.13401 8 9 8C12.866 8 16 11.134 16 15ZM11.7914 11L13 12.2086L10.2086 15L13 17.7914L11.7914 19L9 16.2086L6.20857 19L5 17.7914L7.79143 15L5 12.2086L6.20857 11L9 13.7914L11.7914 11Z" />\n </g>\n</svg>\n'}),V=new i.LabIcon({name:"debugger:pause-on-exception",svgstr:'<svg height="24" width="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <g class="jp-icon3" fill="#616161" transform="matrix(1.1999396,0,0,1.3858273,-2.3726971,-4.6347192)">\n <path\n d="M 12.023438,0.30859375 11.158203,1.8085937 -1.2382812,23.285156 l 26.5292972,-0.002 z m 0.002,3.99999995 9.800781,16.9746093 -19.6015626,0.002 z"\n transform="matrix(0.72509832,0,0,0.7247701,3.2918397,3.480876)"\n />\n <path d="m 11.144475,9.117095 h 1.666751 v 7.215906 h -1.666751 z" />\n <path d="m 11.144475,17.054592 h 1.666751 v 1.443181 h -1.666751 z" />\n </g>\n</svg>\n'}),B=new i.LabIcon({name:"debugger:pause",svgstr:'<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">\n <g class="jp-icon3" fill="#616161">\n <path d="m 7,6 h 4 V 18 H 7 Z" />\n <path d="m 13,6 h 4 v 12 h -4 z" />\n </g>\n</svg>\n'}),H=new i.LabIcon({name:"debugger:step-into",svgstr:'<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">\n\t<g class="jp-icon3" fill="#616161">\n\t\t<path d="M7.99998 9.53198H8.54198L12.447 5.62698L11.386 4.56698L8.74898 7.17698L8.74898 0.999985H7.99998H7.25098L7.25098 7.17698L4.61398 4.56698L3.55298 5.62698L7.45798 9.53198H7.99998ZM9.95598 13.013C9.95598 14.1175 9.06055 15.013 7.95598 15.013C6.85141 15.013 5.95598 14.1175 5.95598 13.013C5.95598 11.9084 6.85141 11.013 7.95598 11.013C9.06055 11.013 9.95598 11.9084 9.95598 13.013Z"/>\n\t</g>\n</svg>\n'}),R=new i.LabIcon({name:"debugger:step-over",svgstr:'<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">\n\t<g class="jp-icon3" fill="#616161">\n\t\t<path d="M14.25 5.75V1.75H12.75V4.2916C11.605 2.93303 9.83899 2.08334 7.90914 2.08334C4.73316 2.08334 1.98941 4.39036 1.75072 7.48075L1.72992 7.75H3.231L3.25287 7.5241C3.46541 5.32932 5.45509 3.58334 7.90914 3.58334C9.6452 3.58334 11.1528 4.45925 11.9587 5.75H9.12986V7.25H13.292L14.2535 6.27493V5.75H14.25ZM7.99997 14C9.10454 14 9.99997 13.1046 9.99997 12C9.99997 10.8954 9.10454 10 7.99997 10C6.8954 10 5.99997 10.8954 5.99997 12C5.99997 13.1046 6.8954 14 7.99997 14Z"/>\n\t</g>\n</svg>\n'}),j=new i.LabIcon({name:"debugger:step-out",svgstr:'<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">\n\t<g class="jp-icon3" fill="#616161">\n\t\t<path d="M7.99998 1H7.45798L3.55298 4.905L4.61398 5.965L7.25098 3.355V9.532H7.99998H8.74898V3.355L11.386 5.965L12.447 4.905L8.54198 1H7.99998ZM9.95598 13.013C9.95598 14.1176 9.06055 15.013 7.95598 15.013C6.85141 15.013 5.95598 14.1176 5.95598 13.013C5.95598 11.9084 6.85141 11.013 7.95598 11.013C9.06055 11.013 9.95598 11.9084 9.95598 13.013Z"/>\n\t</g>\n</svg>\n'}),F=new i.LabIcon({name:"debugger:variable",svgstr:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 4L1 4.5V12.5L1.5 13H4V12H2V5H4V4H1.5ZM14.5 13L15 12.5L15 4.5L14.5 4H12V5L14 5L14 12H12V13H14.5ZM8.79693 5L4.29693 7L4 7.45691V9.95691L4.24275 10.3857L6.74275 11.8857L7.20307 11.9138L11.7031 9.91381L12 9.45691V6.95691L11.7572 6.52816L9.25725 5.02816L8.79693 5ZM5 8.34V9.67381L6.5 10.5738V9.24L5 8.34ZM7.5 9.28184V10.6875L11 9.13197V7.72629L7.5 9.28184ZM10.4178 6.89071L8.96559 6.01936L5.58216 7.52311L7.03441 8.39445L10.4178 6.89071Z" fill="#007ACC"/>\n</svg>\n'}),L=new i.LabIcon({name:"debugger:view-breakpoint",svgstr:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <g class="jp-icon3" fill="#616161">\n <path d="M5 2H15L20 7V20C20 20.5304 19.7893 21.0391 19.4142 21.4142C19.0391 21.7893 18.5304 22 18 22H5C4.46957 22 3.96086 21.7893 3.58579 21.4142C3.21071 21.0391 3 20.5304 3 20V14H4V16L8 13L4 10V12H3V4C3 3.46957 3.21071 2.96086 3.58579 2.58579C3.96086 2.21071 4.46957 2 5 2ZM12 18H16V16H12V18ZM12 14H18V12H12V14ZM12 10H18V8H12V10ZM10 14C10.5523 14 11 13.5523 11 13C11 12.4477 10.5523 12 10 12C9.44771 12 9 12.4477 9 13C9 13.5523 9.44771 14 10 14Z"/>\n <path d="M3 12V14H1V13V12H3Z"/>\n </g>\n</svg>\n'}),P=new i.LabIcon({name:"debugger:open-kernel-source",svgstr:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <g class="jp-icon3" fill="#616161">\n <path d="M5 2H15L20 7V20C20 20.5304 19.7893 21.0391 19.4142 21.4142C19.0391 21.7893 18.5304 22 18 22H5C4.46957 22 3.96086 21.7893 3.58579 21.4142C3.21071 21.0391 3 20.5304 3 20V14H4V16L8 13L4 10V12H3V4C3 3.46957 3.21071 2.96086 3.58579 2.58579C3.96086 2.21071 4.46957 2 5 2ZM12 18H16V16H12V18ZM12 14H18V12H12V14ZM12 10H18V8H12V10ZM10 14C10.5523 14 11 13.5523 11 13C11 12.4477 10.5523 12 10 12C9.44771 12 9 12.4477 9 13C9 13.5523 9.44771 14 10 14Z"/>\n <path d="M3 12V14H1V13V12H3Z"/>\n </g>\n</svg>\n'});class O{constructor(){this._breakpoints=new Map,this._changed=new f.Signal(this),this._restored=new f.Signal(this),this._clicked=new f.Signal(this)}get changed(){return this._changed}get restored(){return this._restored}get clicked(){return this._clicked}get breakpoints(){return this._breakpoints}setBreakpoints(e,t){this._breakpoints.set(e,t),this._changed.emit(t)}getBreakpoints(e){var t;return null!==(t=this._breakpoints.get(e))&&void 0!==t?t:[]}restoreBreakpoints(e){this._breakpoints=e,this._restored.emit()}}class N{constructor(){this._state=[],this._currentFrame=null,this._framesChanged=new f.Signal(this),this._currentFrameChanged=new f.Signal(this)}get frames(){return this._state}set frames(e){this._state=e;const t=null!==this.frame?A.getFrameId(this.frame):"";e.find((e=>A.getFrameId(e)===t))||(this.frame=e[0]),this._framesChanged.emit(e)}get frame(){return this._currentFrame}set frame(e){this._currentFrame=e,this._currentFrameChanged.emit(e)}get framesChanged(){return this._framesChanged}get currentFrameChanged(){return this._currentFrameChanged}}var A;!function(e){e.getFrameId=function(e){var t;return`${null===(t=null==e?void 0:e.source)||void 0===t?void 0:t.path}-${null==e?void 0:e.id}`}}(A||(A={}));class q{constructor(e){this._currentSourceOpened=new f.Signal(this),this._currentSourceChanged=new f.Signal(this),this.currentFrameChanged=e.currentFrameChanged}get currentSourceOpened(){return this._currentSourceOpened}get currentSourceChanged(){return this._currentSourceChanged}get currentSource(){return this._currentSource}set currentSource(e){this._currentSource=e,this._currentSourceChanged.emit(e)}open(){this._currentSourceOpened.emit(this._currentSource)}}var W=s(97934);const Z=(e,t)=>e.name<t.name?-1:e.name>t.name?1:0;class K{constructor(){this._filteredKernelSources=null,this._filter="",this._isDisposed=!1,this._kernelSources=null,this._changed=new f.Signal(this),this._filterChanged=new f.Signal(this),this._kernelSourceOpened=new f.Signal(this),this.refresh=this.refresh.bind(this),this._refreshDebouncer=new W.Debouncer(this.refresh,500)}get filter(){return this._filter}set filter(e){this._filter=e,this._filterChanged.emit(e),this._refreshDebouncer.invoke()}get isDisposed(){return this._isDisposed}get kernelSources(){return this._kernelSources}set kernelSources(e){this._kernelSources=e,this.refresh()}get changed(){return this._changed}get filterChanged(){return this._filterChanged}get kernelSourceOpened(){return this._kernelSourceOpened}dispose(){this._isDisposed||(this._isDisposed=!0,this._refreshDebouncer.dispose(),f.Signal.clearData(this))}open(e){this._kernelSourceOpened.emit(e)}getFilteredKernelSources(){const e=new RegExp(this._filter);return this._kernelSources.filter((t=>e.test(t.name)))}refresh(){this._kernelSources?(this._filteredKernelSources=this._filter?this.getFilteredKernelSources():this._kernelSources,this._filteredKernelSources.sort(Z)):(this._kernelSources=new Array,this._filteredKernelSources=new Array),this._changed.emit(this._filteredKernelSources)}}class z{constructor(){this._selectedVariable=null,this._state=[],this._variableExpanded=new f.Signal(this),this._changed=new f.Signal(this)}get scopes(){return this._state}set scopes(e){this._state=e,this._changed.emit()}get changed(){return this._changed}get variableExpanded(){return this._variableExpanded}get selectedVariable(){return this._selectedVariable}set selectedVariable(e){this._selectedVariable=e}expandVariable(e){this._variableExpanded.emit(e)}}class G{constructor(){this._disposed=new f.Signal(this),this._isDisposed=!1,this._hasRichVariableRendering=!1,this._supportCopyToGlobals=!1,this._stoppedThreads=new Set,this._title="-",this._titleChanged=new f.Signal(this),this.breakpoints=new O,this.callstack=new N,this.variables=new z,this.sources=new q({currentFrameChanged:this.callstack.currentFrameChanged}),this.kernelSources=new K}get disposed(){return this._disposed}get hasRichVariableRendering(){return this._hasRichVariableRendering}set hasRichVariableRendering(e){this._hasRichVariableRendering=e}get supportCopyToGlobals(){return this._supportCopyToGlobals}set supportCopyToGlobals(e){this._supportCopyToGlobals=e}get isDisposed(){return this._isDisposed}get stoppedThreads(){return this._stoppedThreads}set stoppedThreads(e){this._stoppedThreads=e}get title(){return this._title}set title(e){e!==this._title&&(this._title=null!=e?e:"-",this._titleChanged.emit(e))}get titleChanged(){return this._titleChanged}dispose(){this._isDisposed||(this._isDisposed=!0,this.kernelSources.dispose(),this._disposed.emit())}clear(){this._stoppedThreads.clear();const e=new Map;this.breakpoints.restoreBreakpoints(e),this.callstack.frames=[],this.variables.scopes=[],this.sources.currentSource=null,this.kernelSources.kernelSources=null,this.title="-"}}class $ extends h.Panel{constructor(e){super(),this._filter=new Set,this._grid=null,this._pending=null,this.commands=e.commands,this.model=e.model,this.themeManager=e.themeManager,this.translator=e.translator,this.model.changed.connect((()=>this.update()),this),this.addClass("jp-DebuggerVariables-body")}get filter(){return this._filter}set filter(e){this._filter=e,this.update()}get scope(){return this._scope}set scope(e){this._scope=e,"Globals"!==e?this.addClass("jp-debuggerVariables-local"):this.removeClass("jp-debuggerVariables-local"),this.update()}async initialize(){if(this._grid||this._pending)return;const{Grid:e}=await(this._pending=Promise.all([s.e(9072),s.e(1958)]).then(s.bind(s,31958))),{commands:t,model:i,themeManager:r,translator:n}=this;this._grid=new e({commands:t,model:i,themeManager:r,translator:n}),this._grid.addClass("jp-DebuggerVariables-grid"),this._pending=null,this.addWidget(this._grid),this.update()}onBeforeShow(e){this._grid||this._pending||this.initialize(),super.onBeforeShow(e)}onUpdateRequest(e){var t;if(this._grid){const{dataModel:e}=this._grid;e.filter=this._filter,e.scope=this._scope,e.setData(null!==(t=this.model.scopes)&&void 0!==t?t:[])}super.onUpdateRequest(e)}}var U=s(13408),J=s(20998);class Y extends d.MainAreaWidget{constructor(e){const{dataLoader:t,rendermime:s,translator:i}=e,r=new h.Panel,n=new J.PromiseDelegate;super({content:r,reveal:Promise.all([t,n.promise])}),this.content.addClass("jp-VariableRendererPanel"),this.trans=(null!=i?i:v.nullTranslator).load("jupyterlab"),this.dataLoader=t,this.renderMime=s,this._dataHash=null,this.refresh().then((()=>{n.resolve()})).catch((e=>n.reject(e)))}async refresh(e=!1){let t=await this.dataLoader();if(0===Object.keys(t.data).length&&(t={data:{"text/plain":this.trans.__("The variable is undefined in the active context.")},metadata:{}}),!t.data)return this._dataHash=null,Promise.reject("Unable to get a view on the variable.");{const s=o(JSON.stringify(t),17);if(e||this._dataHash!==s){this.content.layout&&this.content.widgets.forEach((e=>{this.content.layout.removeWidget(e)}));const e=this.renderMime.preferredMimeType(t.data,"any");if(!e)return this._dataHash=null,Promise.reject("Unable to determine the preferred mime type.");{const i=this.renderMime.createRenderer(e);i.addClass("jp-VariableRendererPanel-renderer");const r=new U.MimeModel({...t,trusted:!0});this._dataHash=s,await i.renderModel(r),this.content.addWidget(i)}}}}}class Q{constructor(e){var t,s;this._eventMessage=new f.Signal(this),this._isDisposed=!1,this._sessionChanged=new f.Signal(this),this._pauseOnExceptionChanged=new f.Signal(this),this._config=e.config,this._session=null,this._specsManager=null!==(t=e.specsManager)&&void 0!==t?t:null,this._model=new He.Model,this._debuggerSources=null!==(s=e.debuggerSources)&&void 0!==s?s:null,this._trans=(e.translator||v.nullTranslator).load("jupyterlab")}get eventMessage(){return this._eventMessage}get config(){return this._config}get isDisposed(){return this._isDisposed}get isStarted(){var e,t;return null!==(t=null===(e=this._session)||void 0===e?void 0:e.isStarted)&&void 0!==t&&t}get pauseOnExceptionChanged(){return this._pauseOnExceptionChanged}get model(){return this._model}get session(){return this._session}set session(e){var t;this._session!==e&&(this._session&&this._session.dispose(),this._session=e,null===(t=this._session)||void 0===t||t.eventMessage.connect(((e,t)=>{"stopped"===t.event?(this._model.stoppedThreads.add(t.body.threadId),this._getAllFrames()):"continued"===t.event&&(this._model.stoppedThreads.delete(t.body.threadId),this._clearModel(),this._clearSignals()),this._eventMessage.emit(t)})),this._sessionChanged.emit(e))}get sessionChanged(){return this._sessionChanged}dispose(){this.isDisposed||(this._isDisposed=!0,f.Signal.clearData(this))}getCodeId(e){var t,s,i,r;try{return this._config.getCodeId(e,null!==(r=null===(i=null===(s=null===(t=this.session)||void 0===t?void 0:t.connection)||void 0===s?void 0:s.kernel)||void 0===i?void 0:i.name)&&void 0!==r?r:"")}catch(e){return""}}hasStoppedThreads(){var e,t;return null!==(t=(null===(e=this._model)||void 0===e?void 0:e.stoppedThreads.size)>0)&&void 0!==t&&t}async isAvailable(e){var t,s,i,r;if(!this._specsManager)return!0;await this._specsManager.ready;const n=null==e?void 0:e.kernel;if(!n)return!1;const o=n.name;return!(null===(t=this._specsManager.specs)||void 0===t?void 0:t.kernelspecs[o])||!(null===(r=null===(i=null===(s=this._specsManager.specs.kernelspecs[o])||void 0===s?void 0:s.metadata)||void 0===i?void 0:i.debugger)||void 0===r||!r)}async clearBreakpoints(){var e;if(!0!==(null===(e=this.session)||void 0===e?void 0:e.isStarted))return;this._model.breakpoints.breakpoints.forEach(((e,t,s)=>{this._setBreakpoints([],t)}));let t=new Map;this._model.breakpoints.restoreBreakpoints(t)}async continue(){try{if(!this.session)throw new Error("No active debugger session");await this.session.sendRequest("continue",{threadId:this._currentThread()}),this._model.stoppedThreads.delete(this._currentThread()),this._clearModel(),this._clearSignals()}catch(e){console.error("Error:",e.message)}}async getSource(e){var t,s;if(!this.session)throw new Error("No active debugger session");return{...(await this.session.sendRequest("source",{source:e,sourceReference:null!==(t=e.sourceReference)&&void 0!==t?t:0})).body,path:null!==(s=e.path)&&void 0!==s?s:""}}async evaluate(e){var t;if(!this.session)throw new Error("No active debugger session");const s=null===(t=this.model.callstack.frame)||void 0===t?void 0:t.id,i=await this.session.sendRequest("evaluate",{context:"repl",expression:e,frameId:s});return i.success?(this._clearModel(),await this._getAllFrames(),i.body):null}async next(){try{if(!this.session)throw new Error("No active debugger session");await this.session.sendRequest("next",{threadId:this._currentThread()})}catch(e){console.error("Error:",e.message)}}async inspectRichVariable(e,t){if(!this.session)throw new Error("No active debugger session");const s=await this.session.sendRequest("richInspectVariables",{variableName:e,frameId:t});if(s.success)return s.body;throw new Error(s.message)}async inspectVariable(e){if(!this.session)throw new Error("No active debugger session");const t=await this.session.sendRequest("variables",{variablesReference:e});if(t.success)return t.body.variables;throw new Error(t.message)}async copyToGlobals(e){if(!this.session)throw new Error("No active debugger session");if(!this.model.supportCopyToGlobals)throw new Error('The "copyToGlobals" request is not supported by the kernel');const t=this.model.callstack.frames;this.session.sendRequest("copyToGlobals",{srcVariableName:e,dstVariableName:e,srcFrameId:t[0].id}).then((async()=>{const e=await this._getScopes(t[0]),s=await Promise.all(e.map((e=>this._getVariables(e)))),i=this._convertScopes(e,s);this._model.variables.scopes=i})).catch((e=>{console.error(e)}))}async displayDefinedVariables(){if(!this.session)throw new Error("No active debugger session");const e=(await this.session.sendRequest("inspectVariables",{})).body.variables,t=[{name:this._trans.__("Globals"),variables:e}];this._model.variables.scopes=t}async displayModules(){if(!this.session)throw new Error("No active debugger session");const e=await this.session.sendRequest("modules",{});this._model.kernelSources.kernelSources=e.body.modules.map((e=>({name:e.name,path:e.path})))}async restart(){const{breakpoints:e}=this._model.breakpoints;await this.stop(),await this.start(),await this._restoreBreakpoints(e)}async restoreState(e){var t,s,i,r,n,o,a,l,d,c;if(!this.model||!this.session)return;const h=await this.session.restoreState(),{body:u}=h,p=this._mapBreakpoints(u.breakpoints),g=new Set(u.stoppedThreads);if(this._model.hasRichVariableRendering=!0===u.richRendering,this._model.supportCopyToGlobals=!0===u.copyToGlobals,this._config.setHashParams({kernel:null!==(r=null===(i=null===(s=null===(t=this.session)||void 0===t?void 0:t.connection)||void 0===s?void 0:s.kernel)||void 0===i?void 0:i.name)&&void 0!==r?r:"",method:u.hashMethod,seed:u.hashSeed}),this._config.setTmpFileParams({kernel:null!==(l=null===(a=null===(o=null===(n=this.session)||void 0===n?void 0:n.connection)||void 0===o?void 0:o.kernel)||void 0===a?void 0:a.name)&&void 0!==l?l:"",prefix:u.tmpFilePrefix,suffix:u.tmpFileSuffix}),this._model.stoppedThreads=g,this.isStarted||!e&&0===g.size||await this.start(),(this.isStarted||e)&&(this._model.title=this.isStarted&&(null===(c=null===(d=this.session)||void 0===d?void 0:d.connection)||void 0===c?void 0:c.name)||"-"),this._debuggerSources){const e=this._filterBreakpoints(p);this._model.breakpoints.restoreBreakpoints(e)}else this._model.breakpoints.restoreBreakpoints(p);0!==g.size?await this._getAllFrames():this.isStarted&&(this._clearModel(),this._clearSignals()),this.session.currentExceptionFilters&&await this.pauseOnExceptions(this.session.currentExceptionFilters)}start(){if(!this.session)throw new Error("No active debugger session");return this.session.start()}async pause(){try{if(!this.session)throw new Error("No active debugger session");await this.session.sendRequest("pause",{threadId:this._currentThread()})}catch(e){console.error("Error:",e.message)}}async stepIn(){try{if(!this.session)throw new Error("No active debugger session");await this.session.sendRequest("stepIn",{threadId:this._currentThread()})}catch(e){console.error("Error:",e.message)}}async stepOut(){try{if(!this.session)throw new Error("No active debugger session");await this.session.sendRequest("stepOut",{threadId:this._currentThread()})}catch(e){console.error("Error:",e.message)}}async stop(){if(!this.session)throw new Error("No active debugger session");await this.session.stop(),this._model&&this._model.clear()}async updateBreakpoints(e,t,s){var i;if(!(null===(i=this.session)||void 0===i?void 0:i.isStarted))return;s||(s=(await this._dumpCell(e)).body.sourcePath);const r=await this.session.restoreState(),n=t.filter((({line:e})=>"number"==typeof e)).map((({line:e})=>({line:e}))),o=this._mapBreakpoints(r.body.breakpoints);if(this._debuggerSources){const e=this._filterBreakpoints(o);this._model.breakpoints.restoreBreakpoints(e)}else this._model.breakpoints.restoreBreakpoints(o);let a=new Set;const l=(await this._setBreakpoints(n,s)).body.breakpoints.filter(((e,t,s)=>{const i=s.findIndex((t=>t.line===e.line))>-1,r=!a.has(e.line);return a.add(e.line),i&&r}));this._model.breakpoints.setBreakpoints(s,l),await this.session.sendRequest("configurationDone",{})}pauseOnExceptionsIsValid(){var e,t;return!(!this.isStarted||0===(null===(t=null===(e=this.session)||void 0===e?void 0:e.exceptionBreakpointFilters)||void 0===t?void 0:t.length))}async pauseOnExceptionsFilter(e){var t;if(!(null===(t=this.session)||void 0===t?void 0:t.isStarted))return;let s=this.session.currentExceptionFilters;if(this.session.isPausingOnException(e)){const t=s.indexOf(e);s.splice(t,1)}else null==s||s.push(e);await this.pauseOnExceptions(s)}async pauseOnExceptions(e){var t,s;if(!(null===(t=this.session)||void 0===t?void 0:t.isStarted))return;const i=(null===(s=this.session.exceptionBreakpointFilters)||void 0===s?void 0:s.map((e=>e.filter)))||[];let r={filters:[]};e.forEach((e=>{i.includes(e)&&r.filters.push(e)})),this.session.currentExceptionFilters=r.filters,await this.session.sendRequest("setExceptionBreakpoints",r),this._pauseOnExceptionChanged.emit()}getDebuggerState(){var e,t,s,i,r,n,o;const a=this._model.breakpoints.breakpoints;let l=[];if(this._debuggerSources)for(const d of a.keys()){const a=this._debuggerSources.find({focus:!1,kernel:null!==(i=null===(s=null===(t=null===(e=this.session)||void 0===e?void 0:e.connection)||void 0===t?void 0:t.kernel)||void 0===s?void 0:s.name)&&void 0!==i?i:"",path:null!==(o=null===(n=null===(r=this._session)||void 0===r?void 0:r.connection)||void 0===n?void 0:n.path)&&void 0!==o?o:"",source:d}).map((e=>e.src.getSource()));l=l.concat(a)}return{cells:l,breakpoints:a}}async restoreDebuggerState(e){var t,s,i,r;await this.start();for(const t of e.cells)await this._dumpCell(t);const n=new Map,o=null!==(r=null===(i=null===(s=null===(t=this.session)||void 0===t?void 0:t.connection)||void 0===s?void 0:s.kernel)||void 0===i?void 0:i.name)&&void 0!==r?r:"",{prefix:a,suffix:l}=this._config.getTmpFileParams(o);for(const t of e.breakpoints){const[e,s]=t,i=e.substr(0,e.length-l.length),r=i.substr(i.lastIndexOf("/")+1),o=a.concat(r).concat(l);n.set(o,s)}await this._restoreBreakpoints(n);const d=await this.session.sendRequest("configurationDone",{});return await this.restoreState(!1),d.success}_clearModel(){this._model.callstack.frames=[],this._model.variables.scopes=[]}_clearSignals(){this._model.callstack.currentFrameChanged.disconnect(this._onCurrentFrameChanged,this),this._model.variables.variableExpanded.disconnect(this._onVariableExpanded,this)}_convertScopes(e,t){return t&&e?e.map(((e,s)=>({name:e.name,variables:t[s].map((e=>({...e})))}))):[]}_currentThread(){return 1}async _dumpCell(e){if(!this.session)throw new Error("No active debugger session");return this.session.sendRequest("dumpCell",{code:e})}_filterBreakpoints(e){if(!this._debuggerSources)return e;let t=new Map;for(const s of e){const[e,i]=s;i.forEach((()=>{var s,r,n,o,a,l,d;this._debuggerSources.find({focus:!1,kernel:null!==(o=null===(n=null===(r=null===(s=this.session)||void 0===s?void 0:s.connection)||void 0===r?void 0:r.kernel)||void 0===n?void 0:n.name)&&void 0!==o?o:"",path:null!==(d=null===(l=null===(a=this._session)||void 0===a?void 0:a.connection)||void 0===l?void 0:l.path)&&void 0!==d?d:"",source:e}).forEach((()=>{i.length>0&&t.set(e,i)}))}))}return t}async _getAllFrames(){this._model.callstack.currentFrameChanged.connect(this._onCurrentFrameChanged,this),this._model.variables.variableExpanded.connect(this._onVariableExpanded,this);const e=await this._getFrames(this._currentThread());this._model.callstack.frames=e}async _getFrames(e){if(!this.session)throw new Error("No active debugger session");return(await this.session.sendRequest("stackTrace",{threadId:e})).body.stackFrames}async _getScopes(e){if(!this.session)throw new Error("No active debugger session");return e?(await this.session.sendRequest("scopes",{frameId:e.id})).body.scopes:[]}async _getVariables(e){if(!this.session)throw new Error("No active debugger session");return e?(await this.session.sendRequest("variables",{variablesReference:e.variablesReference})).body.variables:[]}_mapBreakpoints(e){return e.length?e.reduce(((e,t)=>{const{breakpoints:s,source:i}=t;return e.set(i,s.map((e=>({...e,source:{path:i},verified:!0})))),e}),new Map):new Map}async _onCurrentFrameChanged(e,t){if(!t)return;const s=await this._getScopes(t),i=await Promise.all(s.map((e=>this._getVariables(e)))),r=this._convertScopes(s,i);this._model.variables.scopes=r}async _onVariableExpanded(e,t){if(!this.session)throw new Error("No active debugger session");const s=await this.session.sendRequest("variables",{variablesReference:t.variablesReference});let i={...t,expanded:!0};s.body.variables.forEach((e=>{i={[e.name]:e,...i}}));const r=this._model.variables.scopes.map((e=>{const s=e.variables.findIndex((e=>e.variablesReference===t.variablesReference));return e.variables[s]=i,{...e}}));return this._model.variables.scopes=[...r],s.body.variables}async _setBreakpoints(e,t){if(!this.session)throw new Error("No active debugger session");return await this.session.sendRequest("setBreakpoints",{breakpoints:e,source:{path:t},sourceModified:!1})}async _restoreBreakpoints(e){for(const[t,s]of e)await this._setBreakpoints(s.filter((({line:e})=>"number"==typeof e)).map((({line:e})=>({line:e}))),t);this._model.breakpoints.restoreBreakpoints(e)}}class X{constructor(e){this._seq=0,this._ready=new J.PromiseDelegate,this._isDisposed=!1,this._isStarted=!1,this._exceptionPaths=[],this._exceptionBreakpointFilters=[],this._currentExceptionFilters={},this._disposed=new f.Signal(this),this._eventMessage=new f.Signal(this),this.connection=e.connection,this._config=e.config,this.translator=e.translator||v.nullTranslator}get isDisposed(){return this._isDisposed}get capabilities(){return this._capabilities}get disposed(){return this._disposed}get connection(){return this._connection}set connection(e){var t,s;if(this._connection&&this._connection.iopubMessage.disconnect(this._handleEvent,this),this._connection=e,!this._connection)return void(this._isStarted=!1);this._connection.iopubMessage.connect(this._handleEvent,this),this._ready=new J.PromiseDelegate;const i=null===(s=null===(t=this.connection)||void 0===t?void 0:t.kernel)||void 0===s?void 0:s.requestDebug({type:"request",seq:0,command:"debugInfo"});i&&(i.onReply=e=>{this._ready.resolve(),i.dispose()})}get isStarted(){return this._isStarted}get exceptionPaths(){return this._exceptionPaths}get exceptionBreakpointFilters(){return this._exceptionBreakpointFilters}get currentExceptionFilters(){var e,t,s;const i=null!==(s=null===(t=null===(e=this.connection)||void 0===e?void 0:e.kernel)||void 0===t?void 0:t.name)&&void 0!==s?s:"";if(!i)return[];const r=this._config.getTmpFileParams(i);if(!r)return[];let n=r.prefix;return Object.keys(this._currentExceptionFilters).includes(n)?this._currentExceptionFilters[n]:[]}set currentExceptionFilters(e){var t,s,i;const r=null!==(i=null===(s=null===(t=this.connection)||void 0===t?void 0:t.kernel)||void 0===s?void 0:s.name)&&void 0!==i?i:"";if(!r)return;const n=this._config.getTmpFileParams(r);if(!n)return;let o=n.prefix;null===e?Object.keys(this._currentExceptionFilters).includes(o)&&delete this._currentExceptionFilters[o]:this._currentExceptionFilters[o]=e}get eventMessage(){return this._eventMessage}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposed.emit(),f.Signal.clearData(this))}async start(){var e,t,s,i;const r=await this.sendRequest("initialize",{clientID:"jupyterlab",clientName:"JupyterLab",adapterID:null!==(s=null===(t=null===(e=this.connection)||void 0===e?void 0:e.kernel)||void 0===t?void 0:t.name)&&void 0!==s?s:"",pathFormat:"path",linesStartAt1:!0,columnsStartAt1:!0,supportsVariableType:!0,supportsVariablePaging:!0,supportsRunInTerminalRequest:!0,locale:document.documentElement.lang});if(!r.success)throw new Error(`Could not start the debugger: ${r.message}`);this._capabilities=r.body,this._isStarted=!0,this._exceptionBreakpointFilters=null===(i=r.body)||void 0===i?void 0:i.exceptionBreakpointFilters,await this.sendRequest("attach",{})}async stop(){this._isStarted=!1,await this.sendRequest("disconnect",{restart:!1,terminateDebuggee:!1})}async restoreState(){var e;const t=await this.sendRequest("debugInfo",{});return this._isStarted=t.body.isStarted,this._exceptionPaths=null===(e=t.body)||void 0===e?void 0:e.exceptionPaths,t}isPausingOnException(e){var t,s;return e?null!==(s=null===(t=this.currentExceptionFilters)||void 0===t?void 0:t.includes(e))&&void 0!==s&&s:this.currentExceptionFilters.length>0}async sendRequest(e,t){return await this._ready.promise,(await this._sendDebugMessage({type:"request",seq:this._seq++,command:e,arguments:t})).content}_handleEvent(e,t){if("debug_event"!==t.header.msg_type)return;const s=t.content;this._eventMessage.emit(s)}async _sendDebugMessage(e){var t;const s=null===(t=this.connection)||void 0===t?void 0:t.kernel;if(!s)return Promise.reject(new Error("A kernel is required to send debug messages."));const i=new J.PromiseDelegate,r=s.requestDebug(e);return r.onReply=e=>{i.resolve(e)},await r.done,i.promise}}var ee=s(78156),te=s.n(ee);class se extends i.ReactWidget{constructor(e){super(),this._model=e,this.addClass("jp-DebuggerBreakpoints-body")}render(){return te().createElement(ie,{model:this._model})}}const ie=({model:e})=>{const[t,s]=(0,ee.useState)(Array.from(e.breakpoints.entries()));return(0,ee.useEffect)((()=>{const t=(t,i)=>{s(Array.from(e.breakpoints.entries()))},i=t=>{s(Array.from(e.breakpoints.entries()))};return e.changed.connect(t),e.restored.connect(i),()=>{e.changed.disconnect(t),e.restored.disconnect(i)}})),te().createElement(te().Fragment,null,t.map((t=>te().createElement(re,{key:t[0],breakpoints:t[1],model:e}))))},re=({breakpoints:e,model:t})=>te().createElement(te().Fragment,null,e.sort(((e,t)=>{var s,i;return(null!==(s=e.line)&&void 0!==s?s:0)-(null!==(i=t.line)&&void 0!==i?i:0)})).map(((e,s)=>{var i,r;return te().createElement(ne,{key:(null!==(r=null===(i=e.source)||void 0===i?void 0:i.path)&&void 0!==r?r:"")+s,breakpoint:e,model:t})}))),ne=({breakpoint:e,model:t})=>{var s,i,r,n;return te().createElement("div",{className:"jp-DebuggerBreakpoint",onClick:()=>t.clicked.emit(e),title:null===(s=e.source)||void 0===s?void 0:s.path},te().createElement("span",{className:"jp-DebuggerBreakpoint-marker"},"●"),te().createElement("span",{className:"jp-DebuggerBreakpoint-source jp-left-truncated"},"/"===(n=null!==(r=null===(i=e.source)||void 0===i?void 0:i.path)&&void 0!==r?r:"")[0]?n.slice(1)+"/":n),te().createElement("span",{className:"jp-DebuggerBreakpoint-line"},e.line))},oe="jp-PauseOnExceptions";class ae extends i.ToolbarButton{constructor(e){super(),this.onclick=()=>{this._menu.open(this.node.getBoundingClientRect().left,this.node.getBoundingClientRect().bottom)},this._menu=new le({service:e.service,commands:{registry:e.commands.registry,pauseOnExceptions:e.commands.pauseOnExceptions}}),this.node.className="jp-debugger-pauseOnExceptions",this._props=e,this._props.className=oe,this._props.service.eventMessage.connect(((e,t)=>{"initialized"!==t.event&&"terminated"!==t.event||this.onChange()}),this),this._props.enabled=this._props.service.pauseOnExceptionsIsValid(),this._props.service.pauseOnExceptionChanged.connect(this.onChange,this)}onChange(){var e;const t=this._props.service.session,s=null==t?void 0:t.exceptionBreakpointFilters;this._props.className=oe,(null===(e=this._props.service.session)||void 0===e?void 0:e.isStarted)&&s?(this._props.pressed=t.isPausingOnException(),this._props.enabled=!0):this._props.enabled=!1,this.update()}render(){return ee.createElement(i.ToolbarButtonComponent,{...this._props,onClick:this.onclick})}}class le extends i.MenuSvg{constructor(e){super({commands:e.commands.registry}),this._service=e.service,this._command=e.commands.pauseOnExceptions,e.service.eventMessage.connect(((e,t)=>{"initialized"===t.event&&this._build()}),this),this._build(),this.addClass("jp-PauseOnExceptions-menu")}_build(){var e,t;this.clearItems(),(null!==(t=null===(e=this._service.session)||void 0===e?void 0:e.exceptionBreakpointFilters)&&void 0!==t?t:[]).map(((e,t)=>{this.addItem({command:this._command,args:{filter:e.filter,description:e.description}})}))}}class de extends i.PanelWithToolbar{constructor(e){var t;super(e),this.clicked=new f.Signal(this);const{model:s,service:r,commands:n}=e,o=(null!==(t=e.translator)&&void 0!==t?t:v.nullTranslator).load("jupyterlab");this.title.label=o.__("Breakpoints");const a=new se(s);this.toolbar.addItem("pauseOnException",new ae({service:r,commands:n,icon:V,tooltip:o.__("Pause on exception filter")})),this.toolbar.addItem("closeAll",new i.ToolbarButton({icon:I,onClick:async()=>{if(0!==s.breakpoints.size)return(await(0,d.showDialog)({title:o.__("Remove All Breakpoints"),body:o.__("Are you sure you want to remove all breakpoints?"),buttons:[d.Dialog.okButton({label:o.__("Remove breakpoints")}),d.Dialog.cancelButton()],hasClose:!0})).button.accept?r.clearBreakpoints():void 0},tooltip:o.__("Remove All Breakpoints")})),this.addWidget(a),this.addClass("jp-DebuggerBreakpoints")}}class ce extends i.ReactWidget{constructor(e){super(),this._model=e,this.addClass("jp-DebuggerCallstack-body")}render(){return te().createElement(he,{model:this._model})}}const he=({model:e})=>{const[t,s]=(0,ee.useState)(e.frames),[i,r]=(0,ee.useState)(e.frame);return(0,ee.useEffect)((()=>{const t=()=>{r(e.frame),s(e.frames)};return e.framesChanged.connect(t),()=>{e.framesChanged.disconnect(t)}}),[e]),te().createElement("ul",null,t.map((t=>{var s;return te().createElement("li",{key:t.id,onClick:()=>{return r(s=t),void(e.frame=s);var s},className:(null==i?void 0:i.id)===t.id?"selected jp-DebuggerCallstackFrame":"jp-DebuggerCallstackFrame"},te().createElement("span",{className:"jp-DebuggerCallstackFrame-name"},t.name),te().createElement("span",{className:"jp-DebuggerCallstackFrame-location",title:null===(s=t.source)||void 0===s?void 0:s.path},(e=>{var t;const s=(null===(t=e.source)||void 0===t?void 0:t.path)||"",i=w.PathExt.basename(w.PathExt.dirname(s)),r=w.PathExt.basename(s);return`${w.PathExt.join(i,r)}:${e.line}`})(t)))})))};class ue extends i.PanelWithToolbar{constructor(e){var t;super(e);const{commands:s,model:r}=e,n=(null!==(t=e.translator)&&void 0!==t?t:v.nullTranslator).load("jupyterlab");this.title.label=n.__("Callstack");const o=new ce(r);this.toolbar.addItem("continue",new i.CommandToolbarButton({commands:s.registry,id:s.continue,label:""})),this.toolbar.addItem("terminate",new i.CommandToolbarButton({commands:s.registry,id:s.terminate,label:""})),this.toolbar.addItem("step-over",new i.CommandToolbarButton({commands:s.registry,id:s.next,label:""})),this.toolbar.addItem("step-in",new i.CommandToolbarButton({commands:s.registry,id:s.stepIn,label:""})),this.toolbar.addItem("step-out",new i.CommandToolbarButton({commands:s.registry,id:s.stepOut,label:""})),this.toolbar.addItem("evaluate",new i.CommandToolbarButton({commands:s.registry,id:s.evaluate,label:""})),this.addWidget(o),this.addClass("jp-DebuggerCallstack")}}const pe=({model:e})=>te().createElement(i.UseSignal,{signal:e.currentSourceChanged,initialSender:e},(e=>{var t,s;return te().createElement("span",{onClick:()=>null==e?void 0:e.open(),className:"jp-DebuggerSources-header-path"},null!==(s=null===(t=null==e?void 0:e.currentSource)||void 0===t?void 0:t.path)&&void 0!==s?s:"")}));class ge extends h.Widget{constructor(e){super(),this._model=e.model,this._debuggerService=e.service,this._mimeTypeService=e.editorServices.mimeTypeService;const t=new He.ReadOnlyEditorFactory({editorServices:e.editorServices});this._editor=t.createNewEditor({content:"",mimeType:"",path:""}),this._editor.hide(),this._model.currentFrameChanged.connect((async(e,t)=>{t?this._showSource(t):this._clearEditor()}));const s=new h.PanelLayout;s.addWidget(this._editor),this.layout=s,this.addClass("jp-DebuggerSources-body")}dispose(){var e;this.isDisposed||(null===(e=this._editorHandler)||void 0===e||e.dispose(),f.Signal.clearData(this),super.dispose())}_clearEditor(){this._model.currentSource=null,this._editor.hide()}async _showSource(e){var t;const s=null===(t=e.source)||void 0===t?void 0:t.path,i=await this._debuggerService.getSource({sourceReference:0,path:s});if(!(null==i?void 0:i.content))return void this._clearEditor();this._editorHandler&&this._editorHandler.dispose();const{content:r,mimeType:n}=i,o=n||this._mimeTypeService.getMimeTypeByFilePath(null!=s?s:"");this._editor.model.sharedModel.setSource(r),this._editor.model.mimeType=o,this._editorHandler=new C({debuggerService:this._debuggerService,editorReady:()=>Promise.resolve(this._editor.editor),getEditor:()=>this._editor.editor,path:s,src:this._editor.model.sharedModel}),this._model.currentSource={content:r,mimeType:o,path:null!=s?s:""},requestAnimationFrame((()=>{C.showCurrentLine(this._editor.editor,e.line)})),this._editor.show()}}class _e extends i.PanelWithToolbar{constructor(e){var t;super();const{model:s,service:r,editorServices:n}=e,o=(null!==(t=e.translator)&&void 0!==t?t:v.nullTranslator).load("jupyterlab");this.title.label=o.__("Source"),this.toolbar.addClass("jp-DebuggerSources-header");const a=new ge({service:r,model:s,editorServices:n});this.toolbar.addItem("open",new i.ToolbarButton({icon:L,onClick:()=>s.open(),tooltip:o.__("Open in the Main Area")}));const l=i.ReactWidget.create(te().createElement(pe,{model:s}));this.toolbar.addItem("sourcePath",l),this.addClass("jp-DebuggerSources-header"),this.addWidget(a),this.addClass("jp-DebuggerSources")}}var me=s(31884);const ve=e=>te().createElement(me.o,{onChange:t=>{const s=t.target.value;e.model.filter=s},placeholder:e.trans.__("Filter the kernel sources"),value:e.model.filter}),be=e=>te().createElement(i.UseSignal,{signal:e.model.filterChanged,initialArgs:e.model.filter},(t=>te().createElement(ve,{model:e.model,trans:e.trans})));class fe extends i.ReactWidget{constructor(e){var t;super(),this._showFilter=!1,this._model=e.model,this._debuggerService=e.service,this._trans=(null!==(t=e.translator)&&void 0!==t?t:v.nullTranslator).load("jupyterlab"),this.addClass("jp-DebuggerKernelSources-body")}render(){let e="jp-DebuggerKernelSource-filterBox";return this._showFilter||(e+=" jp-DebuggerKernelSource-filterBox-hidden"),te().createElement(te().Fragment,null,te().createElement("div",{className:e,key:"filter"},te().createElement(be,{model:this._model,trans:this._trans})),te().createElement(i.UseSignal,{signal:this._model.changed},((e,t)=>{const s={};return(null!=t?t:[]).map((e=>{var t;const r=e.name,n=e.path,o=r+(s[r]=(null!==(t=s[r])&&void 0!==t?t:0)+1).toString();return te().createElement("div",{key:o,title:n,className:"jp-DebuggerKernelSource-source",onClick:()=>{this._debuggerService.getSource({sourceReference:0,path:n}).then((e=>{this._model.open(e)})).catch((e=>{(0,d.showErrorMessage)(this._trans.__("Fail to get source"),this._trans.__("Fail to get '%1' source:\n%2",n,e))}))}},te().createElement(i.LabIcon.resolveReact,{icon:P,iconClass:(0,i.classes)("jp-Icon"),tag:null}),r)}))})))}toggleFilterbox(){this._showFilter=!this._showFilter,this.update()}}class we extends i.PanelWithToolbar{constructor(e){var t;super();const{model:s,service:r}=e;this._model=s;const n=(null!==(t=e.translator)&&void 0!==t?t:v.nullTranslator).load("jupyterlab");this.title.label=n.__("Kernel Sources"),this.toolbar.addClass("jp-DebuggerKernelSources-header"),this._body=new fe({service:r,model:s,translator:e.translator}),this.toolbar.addItem("open-filter",new i.ToolbarButton({icon:i.searchIcon,onClick:async()=>{this._body.toggleFilterbox()},tooltip:n.__("Toggle search filter")})),this.toolbar.addItem("refresh",new i.ToolbarButton({icon:i.refreshIcon,onClick:()=>{this._model.kernelSources=[],r.displayModules().catch((e=>{(0,d.showErrorMessage)(n.__("Fail to get kernel sources"),n.__("Fail to get kernel sources:\n%2",e))}))},tooltip:n.__("Refresh kernel sources")})),this.addClass("jp-DebuggerKernelSources-header"),this.addWidget(this._body),this.addClass("jp-DebuggerKenelSources")}set filter(e){this._model.filter=e}}const ke=({model:e,tree:t,grid:s,trans:r})=>{const[n,o]=(0,ee.useState)("-"),a=e.scopes;return te().createElement(i.HTMLSelect,{onChange:e=>{const i=e.target.value;o(i),t.scope=i,s.scope=i},value:n,"aria-label":r.__("Scope")},a.map((e=>te().createElement("option",{key:e.name,value:e.name},r.__(e.name)))))};class Se extends i.ReactWidget{constructor(e){super();const{translator:t,model:s,tree:i,grid:r}=e;this._model=s,this._tree=i,this._grid=r,this._trans=(t||v.nullTranslator).load("jupyterlab")}render(){return te().createElement(i.UseSignal,{signal:this._model.changed,initialSender:this._model},(()=>te().createElement(ke,{model:this._model,trans:this._trans,tree:this._tree,grid:this._grid})))}}var Ce=s(33625);const ye="jp-DebuggerVariables-buttons";class Ee extends i.ReactWidget{constructor(e){super(),this._scope="",this._scopes=[],this._filter=new Set,this._commands=e.commands,this._service=e.service,this._translator=e.translator,this._hoverChanged=new f.Signal(this),(this.model=e.model).changed.connect(this._updateScopes,this),this.addClass("jp-DebuggerVariables-body")}render(){var e;const t=null!==(e=this._scopes.find((e=>e.name===this._scope)))&&void 0!==e?e:this._scopes[0],s=e=>{this.model.selectedVariable=e},r=te().createElement(i.caretDownEmptyIcon.react,{stylesheet:"menuItem",tag:"span"});return"Globals"!==(null==t?void 0:t.name)?this.addClass("jp-debuggerVariables-local"):this.removeClass("jp-debuggerVariables-local"),t?te().createElement(te().Fragment,null,te().createElement(Me,{key:t.name,commands:this._commands,service:this._service,data:t.variables,filter:this._filter,translator:this._translator,handleSelectVariable:s,onHoverChanged:e=>{this._hoverChanged.emit(e)},collapserIcon:r}),te().createElement(xe,{commands:this._commands,service:this._service,hoverChanged:this._hoverChanged,handleSelectVariable:s})):te().createElement("div",null)}set filter(e){this._filter=e,this.update()}set scope(e){this._scope=e,this.update()}_updateScopes(e){Ce.ArrayExt.shallowEqual(this._scopes,e.scopes)||(this._scopes=e.scopes,this.update())}}const xe=e=>{var t;const{commands:s,service:r,translator:n,handleSelectVariable:o}=e,a=(null!=n?n:v.nullTranslator).load("jupyterlab"),[l,d]=(0,ee.useState)(0),[c,h]=(0,ee.useState)(null);let u=0;const p=(0,ee.useCallback)(((e,t)=>{const s=++u;if(t.variable)h(t.variable),requestAnimationFrame((()=>{s===u&&t.target&&d(t.target.offsetTop)}));else{if(s!==u)return;const e=t.target;if(e&&e instanceof Element&&e.closest(`.${ye}`))return;h(null)}}),[]);return(0,ee.useEffect)((()=>(e.hoverChanged.connect(p),()=>{e.hoverChanged.disconnect(p)})),[p]),te().createElement("div",{className:ye,style:{transform:`translateY(${l}px)`,opacity:!c||["special variables","protected variables","function variables","class variables"].includes(c.name)?0:1}},te().createElement("button",{className:"jp-DebuggerVariables-renderVariable",disabled:!c||!r.model.hasRichVariableRendering||!s.isEnabled(He.CommandIDs.renderMimeVariable,{name:c.name,frameID:null===(t=r.model.callstack.frame)||void 0===t?void 0:t.id}),onClick:e=>{var t;c&&o&&(e.stopPropagation(),o(c),s.execute(He.CommandIDs.renderMimeVariable,{name:c.name,frameID:null===(t=r.model.callstack.frame)||void 0===t?void 0:t.id}).catch((e=>{console.error(`Failed to render variable ${null==c?void 0:c.name}`,e)})))},title:a.__("Render variable: %1",null==c?void 0:c.name)},te().createElement(i.searchIcon.react,{stylesheet:"menuItem",tag:"span"})))},Me=e=>{const{commands:t,data:s,service:i,filter:r,translator:n,handleSelectVariable:o,onHoverChanged:a,collapserIcon:l}=e,[d,c]=(0,ee.useState)(s);return(0,ee.useEffect)((()=>{c(s)}),[s]),te().createElement("ul",{className:"jp-DebuggerVariables-branch"},d.filter((e=>!(r||new Set).has(e.evaluateName||""))).map((e=>{const s=`${e.name}-${e.evaluateName}-${e.type}-${e.value}-${e.variablesReference}`;return te().createElement(De,{key:s,commands:t,data:e,service:i,filter:r,translator:n,onSelect:o,onHoverChanged:a,collapserIcon:l})})))},De=e=>{const{commands:t,data:s,service:i,filter:r,translator:n,onSelect:o,onHoverChanged:a,collapserIcon:l}=e,[d]=(0,ee.useState)(s),[c,h]=(0,ee.useState)(),[u,p]=(0,ee.useState)(),g=null!=o?o:()=>{},_=0!==d.variablesReference||"function"===d.type;return te().createElement("li",{onClick:e=>(async e=>{if(!_)return;e.stopPropagation();const t=await i.inspectVariable(d.variablesReference);h(!c),p(t)})(e),onMouseDown:e=>{e.stopPropagation(),g(d)},onMouseOver:e=>{a&&(a({target:e.currentTarget,variable:d}),e.stopPropagation())},onMouseLeave:e=>{a&&(a({target:e.relatedTarget,variable:null}),e.stopPropagation())}},te().createElement("span",{className:"jp-DebuggerVariables-collapser"+(c?" jp-mod-expanded":"")},_?te().cloneElement(l):null),te().createElement("span",{className:"jp-DebuggerVariables-name"},d.name),te().createElement("span",{className:"jp-DebuggerVariables-detail"},function(e){if("float"===e.type&&("inf"==e.value||"-inf"==e.value))return e.value;const t=Ie(e);return"float"===e.type&&isNaN(t)?"NaN":t}(d)),c&&u&&te().createElement(Me,{key:d.name,commands:t,data:u,service:i,filter:r,translator:n,handleSelectVariable:o,onHoverChanged:a,collapserIcon:l}))};class Te extends i.PanelWithToolbar{constructor(e){super(e);const{model:t,service:s,commands:r,themeManager:n}=e,o=e.translator||v.nullTranslator,a=o.load("jupyterlab");this.title.label=a.__("Variables"),this.toolbar.addClass("jp-DebuggerVariables-toolbar"),this._tree=new Ee({model:t,service:s,commands:r,translator:o}),this._table=new $({model:t,commands:r,themeManager:n,translator:o}),this._table.hide(),this.toolbar.addItem("scope-switcher",new Se({translator:o,model:t,tree:this._tree,grid:this._table}));const l=()=>{this._table.isHidden?(this._tree.hide(),this._table.show(),this.node.setAttribute("data-jp-table","true"),h("table")):(this._tree.show(),this._table.hide(),this.node.removeAttribute("data-jp-table"),h("tree")),this.update()},d=new i.ToolbarButton({icon:i.treeViewIcon,className:"jp-TreeView",onClick:l,tooltip:a.__("Tree View")}),c=new i.ToolbarButton({icon:i.tableRowsIcon,className:"jp-TableView",onClick:l,tooltip:a.__("Table View")}),h=e=>{c.pressed="tree"!==e,d.pressed=!c.pressed};h(this._table.isHidden?"tree":"table"),this.toolbar.addItem("view-VariableTreeView",d),this.toolbar.addItem("view-VariableTableView",c),this.addWidget(this._tree),this.addWidget(this._table),this.addClass("jp-DebuggerVariables")}set filter(e){this._tree.filter=e,this._table.filter=e}onResize(e){super.onResize(e),this._resizeBody(e)}_resizeBody(e){const t=e.height-this.toolbar.node.offsetHeight;this._tree.node.style.height=`${t}px`}}const Ie=e=>{var t,s;const{type:i,value:r}=e;switch(i){case"int":return parseInt(r,10);case"float":return parseFloat(r);case"bool":return r;case"str":return(null===(s=null===(t=e.presentationHint)||void 0===t?void 0:t.attributes)||void 0===s?void 0:s.includes("rawString"))?r.slice(1,r.length-1):r;default:return null!=i?i:r}};class Ve extends i.SidePanel{constructor(e){const t=e.translator||v.nullTranslator;super({translator:t}),this.id="jp-debugger-sidebar",this.title.icon=i.bugIcon,this.addClass("jp-DebuggerSidebar");const{callstackCommands:s,breakpointsCommands:r,editorServices:n,service:o,themeManager:a}=e,l=o.model;this.variables=new Te({model:l.variables,commands:s.registry,service:o,themeManager:a,translator:t}),this.callstack=new ue({commands:s,model:l.callstack,translator:t}),this.breakpoints=new de({service:o,commands:r,model:l.breakpoints,translator:t}),this.sources=new _e({model:l.sources,service:o,editorServices:n,translator:t}),this.kernelSources=new we({model:l.kernelSources,service:o,translator:t});const d=new Ve.Header;this.header.addWidget(d),l.titleChanged.connect(((e,t)=>{d.title.label=t})),this.content.addClass("jp-DebuggerSidebar-body"),this.addWidget(this.variables),this.addWidget(this.callstack),this.addWidget(this.breakpoints),this.addWidget(this.sources),this.addWidget(this.kernelSources)}}var Be,He;!function(e){class t extends h.Widget{constructor(){super({node:Be.createHeader()}),this.title.changed.connect((e=>{this.node.textContent=this.title.label}))}}e.Header=t}(Ve||(Ve={})),function(e){e.createHeader=function(){const e=document.createElement("h2");return e.textContent="-",e.classList.add("jp-text-truncated"),e}}(Be||(Be={}));class Re{constructor(e){var t,s,i;this._config=e.config,this._shell=e.shell,this._notebookTracker=null!==(t=e.notebookTracker)&&void 0!==t?t:null,this._consoleTracker=null!==(s=e.consoleTracker)&&void 0!==s?s:null,this._editorTracker=null!==(i=e.editorTracker)&&void 0!==i?i:null,this._readOnlyEditorTracker=new d.WidgetTracker({namespace:"@jupyterlab/debugger"})}find(e){return[...this._findInConsoles(e),...this._findInEditors(e),...this._findInNotebooks(e),...this._findInReadOnlyEditors(e)]}open(e){const{editorWrapper:t,label:s,caption:r}=e,n=new d.MainAreaWidget({content:t});n.id=d.DOMUtils.createDomID(),n.title.label=s,n.title.closable=!0,n.title.caption=r,n.title.icon=i.textEditorIcon,this._shell.add(n,"main",{type:"Debugger Sources"}),this._readOnlyEditorTracker.add(n)}_findInNotebooks(e){if(!this._notebookTracker)return[];const{focus:t,kernel:s,path:i,source:r}=e,n=[];return this._notebookTracker.forEach((e=>{const o=e.sessionContext;if(i!==o.path)return;const a=e.content;t&&(a.mode="command"),e.content.widgets.forEach(((i,o)=>{const l=i.model.sharedModel.getSource(),d=this._getCodeId(l,s);d&&r===d&&(t&&(a.activeCellIndex=o,a.activeCell&&a.scrollToItem(a.activeCellIndex,"smart").catch((e=>{})),this._shell.activateById(e.id)),n.push(Object.freeze({get:()=>i.editor,reveal:()=>a.scrollToItem(o,"smart"),src:i.model.sharedModel})))}))})),n}_findInConsoles(e){if(!this._consoleTracker)return[];const{focus:t,kernel:s,path:i,source:r}=e,n=[];return this._consoleTracker.forEach((e=>{const o=e.sessionContext;if(i!==o.path)return;const a=e.console.cells;for(const i of a){const o=i.model.sharedModel.getSource(),a=this._getCodeId(o,s);if(!a)break;if(r!==a)break;n.push(Object.freeze({get:()=>i.editor,reveal:()=>Promise.resolve(this._shell.activateById(e.id)),src:i.model.sharedModel})),t&&this._shell.activateById(e.id)}})),n}_findInEditors(e){if(!this._editorTracker)return[];const{focus:t,kernel:s,path:i,source:r}=e,n=[];return this._editorTracker.forEach((e=>{const o=e.content;if(i!==o.context.path)return;const a=o.editor;if(!a)return;const l=a.model.sharedModel.getSource(),d=this._getCodeId(l,s);d&&r===d&&(n.push(Object.freeze({get:()=>a,reveal:()=>Promise.resolve(this._shell.activateById(e.id)),src:o.model.sharedModel})),t&&this._shell.activateById(e.id))})),n}_findInReadOnlyEditors(e){const{focus:t,kernel:s,source:i}=e,r=[];return this._readOnlyEditorTracker.forEach((e=>{var n;const o=null===(n=e.content)||void 0===n?void 0:n.editor;if(!o)return;const a=o.model.sharedModel.getSource(),l=this._getCodeId(a,s);l&&(e.title.caption!==i&&i!==l||(r.push(Object.freeze({get:()=>o,reveal:()=>Promise.resolve(this._shell.activateById(e.id)),src:o.model.sharedModel})),t&&this._shell.activateById(e.id)))})),r}_getCodeId(e,t){try{return this._config.getCodeId(e,t)}catch(e){return""}}}!function(e){let t,s,r;e.Config=class extends a{},e.EditorHandler=class extends C{},e.Handler=class extends T{},e.Model=class extends G{},e.ReadOnlyEditorFactory=class extends _{},e.Service=class extends Q{},e.Session=class extends X{},e.Sidebar=class extends Ve{},e.Sources=class extends Re{},e.VariablesGrid=class extends ${},e.VariableRenderer=class extends Y{},function(e){e.debugContinue="debugger:continue",e.terminate="debugger:terminate",e.next="debugger:next",e.showPanel="debugger:show-panel",e.stepIn="debugger:stepIn",e.stepOut="debugger:stepOut",e.inspectVariable="debugger:inspect-variable",e.renderMimeVariable="debugger:render-mime-variable",e.evaluate="debugger:evaluate",e.restartDebug="debugger:restart-debug",e.pauseOnExceptions="debugger:pause-on-exceptions",e.copyToClipboard="debugger:copy-to-clipboard",e.copyToGlobals="debugger:copy-to-globals",e.openSource="debugger:open-source"}(t=e.CommandIDs||(e.CommandIDs={})),function(e){e.closeAllIcon=I,e.evaluateIcon=i.codeIcon,e.continueIcon=i.runIcon,e.pauseIcon=B,e.stepIntoIcon=H,e.stepOutIcon=j,e.stepOverIcon=R,e.terminateIcon=i.stopIcon,e.variableIcon=F,e.viewBreakpointIcon=L,e.pauseOnExceptionsIcon=B}(s=e.Icons||(e.Icons={})),function(e){e.getCode=l.getCode}(r=e.Dialogs||(e.Dialogs={}))}(He||(He={}))},36621:(e,t,s)=>{s.r(t),s.d(t,{Debugger:()=>i.q,IDebugger:()=>n,IDebuggerConfig:()=>o,IDebuggerHandler:()=>d,IDebuggerSidebar:()=>l,IDebuggerSourceViewer:()=>c,IDebuggerSources:()=>a});var i=s(78947),r=s(20998);const n=new r.Token("@jupyterlab/debugger:IDebugger","A debugger user interface."),o=new r.Token("@jupyterlab/debugger:IDebuggerConfig","A service to handle the debugger configuration."),a=new r.Token("@jupyterlab/debugger:IDebuggerSources","A service to display sources in debug mode."),l=new r.Token("@jupyterlab/debugger:IDebuggerSidebar","A service for the debugger sidebar."),d=new r.Token("@jupyterlab/debugger:IDebuggerHandler","A service for handling notebook debugger."),c=new r.Token("@jupyterlab/debugger:IDebuggerSourceViewer","A debugger source viewer.")}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6621],{78947:(e,t,s)=>{s.d(t,{q:()=>He});var i=s(35613);const r=1540483477,n=new TextEncoder;function o(e,t){const s=n.encode(e);let i=s.length,o=t^i,a=0;for(;i>=4;){let e=255&s[a]|(255&s[++a])<<8|(255&s[++a])<<16|(255&s[++a])<<24;e=(65535&e)*r+(((e>>>16)*r&65535)<<16),e^=e>>>24,e=(65535&e)*r+(((e>>>16)*r&65535)<<16),o=(65535&o)*r+(((o>>>16)*r&65535)<<16)^e,i-=4,++a}switch(i){case 3:o^=(255&s[a+2])<<16;case 2:o^=(255&s[a+1])<<8;case 1:o^=255&s[a],o=(65535&o)*r+(((o>>>16)*r&65535)<<16)}return o^=o>>>13,o=(65535&o)*r+(((o>>>16)*r&65535)<<16),o^=o>>>15,o>>>0}class a{constructor(){this._fileParams=new Map,this._hashMethods=new Map}getCodeId(e,t){const s=this._fileParams.get(t);if(!s)throw new Error(`Kernel (${t}) has no tmp file params.`);const i=this._hashMethods.get(t);if(!i)throw new Error(`Kernel (${t}) has no hashing params.`);const{prefix:r,suffix:n}=s;return`${r}${i(e)}${n}`}setHashParams(e){const{kernel:t,method:s,seed:i}=e;if(!t)throw new TypeError("Kernel name is not defined.");if("Murmur2"!==s)throw new Error(`Hash method (${s}) is not supported.`);this._hashMethods.set(t,(e=>o(e,i).toString()))}setTmpFileParams(e){const{kernel:t,prefix:s,suffix:i}=e;if(!t)throw new TypeError("Kernel name is not defined.");this._fileParams.set(t,{kernel:t,prefix:s,suffix:i})}getTmpFileParams(e){return this._fileParams.get(e)}}var l,d=s(53312),c=s(73166),h=s(63485);!function(e){e.getCode=function(e){return new u({...e,body:new p(e),buttons:[d.Dialog.cancelButton({label:e.cancelLabel}),d.Dialog.okButton({label:e.okLabel})]}).launch()}}(l||(l={}));class u extends d.Dialog{handleEvent(e){if("keydown"===e.type){const t=e,{code:s,shiftKey:i}=t;if(i&&"Enter"===s)return this.resolve();if("Enter"===s)return}super.handleEvent(e)}}class p extends h.Widget{constructor(e){super();const{contentFactory:t,rendermime:s,mimeType:i}=e,r=new c.CodeCellModel;r.mimeType=null!=i?i:"",this._prompt=new c.CodeCell({contentFactory:t,rendermime:s,model:r,placeholder:!1}).initializeState(),this._prompt.inputArea.promptNode.remove(),this.node.appendChild(this._prompt.node)}getValue(){return this._prompt.model.sharedModel.getSource()}onAfterAttach(e){super.onAfterAttach(e),this._prompt.activate()}}var g=s(51429);class _{constructor(e){this._services=e.editorServices}createNewEditor(e){const{content:t,mimeType:s,path:i}=e,r=this._services.factoryService.newInlineEditor,n=this._services.mimeTypeService,o=new g.CodeEditor.Model({mimeType:s||n.getMimeTypeByFilePath(i)});o.sharedModel.source=t;const a=new g.CodeEditorWrapper({editorOptions:{config:{readOnly:!0,lineNumbers:!0}},model:o,factory:r});return a.node.setAttribute("data-jp-debugger","true"),a.disposed.connect((()=>{o.dispose()})),a}}var m,v=s(12030),b=s(31231),f=s(81997),w=s(68722),k=s(89843),S=s(3546);class C{constructor(e){var t,s,i,r;this._src=e.src,this._id=null!==(i=null===(s=null===(t=e.debuggerService.session)||void 0===t?void 0:t.connection)||void 0===s?void 0:s.id)&&void 0!==i?i:"",this._path=null!==(r=e.path)&&void 0!==r?r:"",this._debuggerService=e.debuggerService,this._editor=e.getEditor,this._editorMonitor=new w.ActivityMonitor({signal:this._src.changed,timeout:1e3}),this._editorMonitor.activityStopped.connect((()=>{this._sendEditorBreakpoints()}),this),this._debuggerService.model.breakpoints.changed.connect((async()=>{const e=this.editor;e&&!e.isDisposed&&this._addBreakpointsToEditor()})),this._debuggerService.model.breakpoints.restored.connect((async()=>{const e=this.editor;e&&!e.isDisposed&&this._addBreakpointsToEditor()})),this._debuggerService.model.callstack.currentFrameChanged.connect((()=>{const e=this.editor;e&&C.clearHighlight(e)})),this._breakpointEffect=k.StateEffect.define({map:(e,t)=>({pos:e.pos.map((e=>t.mapPos(e)))})}),this._breakpointState=k.StateField.define({create:()=>k.RangeSet.empty,update:(e,t)=>{e=e.map(t.changes);for(let s of t.effects)if(s.is(this._breakpointEffect)){let t=s;e=t.value.pos.length?e.update({add:t.value.pos.map((e=>m.breakpointMarker.range(e))),sort:!0}):k.RangeSet.empty}return e}}),this._gutter=new k.Compartment,this._highlightDeco=S.Decoration.line({class:"jp-DebuggerEditor-highlight"}),this._highlightState=k.StateField.define({create:()=>S.Decoration.none,update:(e,t)=>{e=e.map(t.changes);for(let s of t.effects)if(s.is(C._highlightEffect)){let t=s;e=t.value.pos.length?e.update({add:t.value.pos.map((e=>this._highlightDeco.range(e)))}):S.Decoration.none}return e},provide:e=>S.EditorView.decorations.from(e)}),e.editorReady().then((()=>{this._setupEditor()}))}get editor(){return this._editor()}dispose(){this.isDisposed||(this._editorMonitor.dispose(),this._clearEditor(),this.isDisposed=!0,f.Signal.clearData(this))}refreshBreakpoints(){this._addBreakpointsToEditor()}_setupEditor(){const e=this.editor;if(!e||e.isDisposed)return;e.setOption("lineNumbers",!0);const t=[this._breakpointState,this._highlightState,k.Prec.highest((0,S.gutter)({class:"cm-breakpoint-gutter",renderEmptyElements:!0,markers:e=>e.state.field(this._breakpointState),initialSpacer:()=>m.breakpointMarker,domEventHandlers:{mousedown:(e,t)=>(this._onGutterClick(e,t.from),!0)}}))];e.injectExtension(this._gutter.of(t)),this._addBreakpointsToEditor()}_clearEditor(){const e=this.editor;e&&!e.isDisposed&&(C.clearHighlight(e),this._clearGutter(e),e.setOption("lineNumbers",!1),e.editor.dispatch({effects:this._gutter.reconfigure([])}))}_sendEditorBreakpoints(){var e;if(null===(e=this.editor)||void 0===e?void 0:e.isDisposed)return;const t=this._getBreakpointsFromEditor().map((e=>{var t,s;return m.createBreakpoint((null===(s=null===(t=this._debuggerService.session)||void 0===t?void 0:t.connection)||void 0===s?void 0:s.name)||"",e)}));this._debuggerService.updateBreakpoints(this._src.getSource(),t,this._path)}_onGutterClick(e,t){var s,i,r;if(this._id!==(null===(i=null===(s=this._debuggerService.session)||void 0===s?void 0:s.connection)||void 0===i?void 0:i.id))return;const n=e.state.doc.lineAt(t).number;let o=e.state.field(this._breakpointState),a=!1;o.between(t,t,(()=>{a=!0}));let l=this._getBreakpoints();a?l=l.filter((e=>e.line!==n)):l.push(m.createBreakpoint(null!==(r=this._path)&&void 0!==r?r:this._debuggerService.session.connection.name,n)),l.sort(((e,t)=>e.line-t.line)),this._debuggerService.updateBreakpoints(this._src.getSource(),l,this._path)}_addBreakpointsToEditor(){var e,t;if(this._id!==(null===(t=null===(e=this._debuggerService.session)||void 0===e?void 0:e.connection)||void 0===t?void 0:t.id))return;const s=this.editor,i=this._getBreakpoints();this._clearGutter(s);const r=i.map((e=>s.state.doc.line(e.line).from));s.editor.dispatch({effects:this._breakpointEffect.of({pos:r})})}_getBreakpointsFromEditor(){const e=this.editor,t=e.editor.state.field(this._breakpointState);let s=[];return t.between(0,e.doc.length,(t=>{s.push(e.doc.lineAt(t).number)})),s}_clearGutter(e){e&&e.editor.dispatch({effects:this._breakpointEffect.of({pos:[]})})}_getBreakpoints(){const e=this._src.getSource();return this._debuggerService.model.breakpoints.getBreakpoints(this._path||this._debuggerService.getCodeId(e))}}!function(e){function t(t){t&&!t.isDisposed&&t.editor.dispatch({effects:e._highlightEffect.of({pos:[]})})}e._highlightEffect=k.StateEffect.define({map:(e,t)=>({pos:e.pos.map((e=>t.mapPos(e)))})}),e.showCurrentLine=function(s,i){t(s);const r=s,n=r.doc.line(i).from;r.editor.dispatch({effects:e._highlightEffect.of({pos:[n]})})},e.clearHighlight=t}(C||(C={})),function(e){e.breakpointMarker=new class extends S.GutterMarker{toDOM(){return document.createTextNode("●")}},e.createBreakpoint=function(e,t){return{line:t,verified:!0,source:{name:e}}}}(m||(m={}));class y{constructor(e){this._debuggerService=e.debuggerService,this._consolePanel=e.widget,this._cellMap=new b.ObservableMap;const t=this._consolePanel.console;t.promptCell&&this._addEditorHandler(t.promptCell),t.promptCellCreated.connect(((e,t)=>{this._addEditorHandler(t)}));const s=()=>{for(const e of t.cells)this._addEditorHandler(e)};s(),this._consolePanel.console.cells.changed.connect(s)}dispose(){this.isDisposed||(this.isDisposed=!0,this._cellMap.values().forEach((e=>e.dispose())),this._cellMap.dispose(),f.Signal.clearData(this))}_addEditorHandler(e){const t=e.model.id;if("code"!==e.model.type||this._cellMap.has(t))return;const s=e,i=new C({debuggerService:this._debuggerService,editorReady:async()=>(await s.ready,s.editor),getEditor:()=>s.editor,src:e.model.sharedModel});s.disposed.connect((()=>{this._cellMap.delete(t),i.dispose()})),this._cellMap.set(t,i)}}class E{constructor(e){var t;this._debuggerService=e.debuggerService,this._fileEditor=e.widget.content,this._hasLineNumber=null!==(t=this._fileEditor.editor.getOption("lineNumbers"))&&void 0!==t&&t,this._editorHandler=new C({debuggerService:this._debuggerService,editorReady:()=>Promise.resolve(this._fileEditor.editor),getEditor:()=>this._fileEditor.editor,src:this._fileEditor.model.sharedModel})}dispose(){var e,t;this.isDisposed||(this.isDisposed=!0,null===(e=this._editorHandler)||void 0===e||e.dispose(),null===(t=this._editorHandler)||void 0===t||t.editor.setOptions({lineNumbers:this._hasLineNumber}),f.Signal.clearData(this))}}class x{constructor(e){this._debuggerService=e.debuggerService,this._notebookPanel=e.widget,this._cellMap=new b.ObservableMap,this._notebookPanel.content.model.cells.changed.connect(this._onCellsChanged,this),this._onCellsChanged()}dispose(){this.isDisposed||(this.isDisposed=!0,this._cellMap.values().forEach((e=>{var t;e.dispose(),null===(t=e.editor)||void 0===t||t.setOptions({...this._notebookPanel.content.editorConfig.code})})),this._cellMap.dispose(),f.Signal.clearData(this))}_onCellsChanged(e,t){var s;if(this._notebookPanel.content.widgets.forEach((e=>this._addEditorHandler(e))),"move"===(null==t?void 0:t.type))for(const e of t.newValues)null===(s=this._cellMap.get(e.id))||void 0===s||s.refreshBreakpoints()}_addEditorHandler(e){const t=e.model.id;if("code"!==e.model.type||this._cellMap.has(t))return;const s=e,i=new C({debuggerService:this._debuggerService,editorReady:async()=>(await s.ready,s.editor),getEditor:()=>s.editor,src:e.model.sharedModel});s.disposed.connect((()=>{this._cellMap.delete(t),i.dispose()})),this._cellMap.set(e.model.id,i)}}const M="debugger-icon";function D(e,t,s=!0,i){e&&(e.enabled=s,e.pressed=t,i&&(e.onClick=i))}class T{constructor(e){this._handlers={},this._contextKernelChangedHandlers={},this._kernelChangedHandlers={},this._statusChangedHandlers={},this._iopubMessageHandlers={},this._iconButtons={},this._type=e.type,this._shell=e.shell,this._service=e.service}get activeWidget(){return this._activeWidget}async update(e,t){if(!t)return delete this._kernelChangedHandlers[e.id],delete this._statusChangedHandlers[e.id],delete this._iopubMessageHandlers[e.id],this.updateWidget(e,t);const s=()=>{this.updateWidget(e,t)},i=this._kernelChangedHandlers[e.id];i&&t.kernelChanged.disconnect(i),this._kernelChangedHandlers[e.id]=s,t.kernelChanged.connect(s);const r=(s,i)=>{i.endsWith("restarting")&&this.updateWidget(e,t)},n=this._statusChangedHandlers[e.id];n&&t.statusChanged.disconnect(n),t.statusChanged.connect(r),this._statusChangedHandlers[e.id]=r;const o=(e,t)=>{"execute_request"==t.parent_header.msg_type&&this._service.isStarted&&!this._service.hasStoppedThreads()&&this._service.displayDefinedVariables()},a=this._iopubMessageHandlers[e.id];return a&&t.iopubMessage.disconnect(a),t.iopubMessage.connect(o),this._iopubMessageHandlers[e.id]=o,this._activeWidget=e,this.updateWidget(e,t)}async updateContext(e,t){const s=()=>{const{session:s}=t;this.update(e,s)},i=this._contextKernelChangedHandlers[e.id];return i&&t.kernelChanged.disconnect(i),this._contextKernelChangedHandlers[e.id]=s,t.kernelChanged.connect(s),this.update(e,t.session)}async updateWidget(e,t){var s,r,n,o;if(!this._service.model||!t)return;const a=()=>this._shell.currentWidget===e,l=()=>{this._handlers[e.id]?e.node.setAttribute("data-jp-debugger","true"):e.node.removeAttribute("data-jp-debugger")},d=()=>{if(!this._handlers[e.id]){switch(this._type){case"notebook":this._handlers[e.id]=new x({debuggerService:this._service,widget:e});break;case"console":this._handlers[e.id]=new y({debuggerService:this._service,widget:e});break;case"file":this._handlers[e.id]=new E({debuggerService:this._service,widget:e});break;default:throw Error(`No handler for the type ${this._type}`)}l()}},c=()=>{var s,i,r,n;const o=this._handlers[e.id];o&&(o.dispose(),delete this._handlers[e.id],delete this._kernelChangedHandlers[e.id],delete this._statusChangedHandlers[e.id],delete this._iopubMessageHandlers[e.id],delete this._contextKernelChangedHandlers[e.id],(null===(i=null===(s=this._service.session)||void 0===s?void 0:s.connection)||void 0===i?void 0:i.path)!==(null==t?void 0:t.path)&&(null===(n=null===(r=this._service.session)||void 0===r?void 0:r.connection)||void 0===n?void 0:n.kernel)||this._service.model.clear(),l())},h=()=>{var e;return this._service.isStarted&&(null===(e=this._previousConnection)||void 0===e?void 0:e.id)===(null==t?void 0:t.id)},u=async()=>{this._service.session.connection=t,await this._service.stop()},p=async()=>{var e,s;this._service.session.connection=t,this._previousConnection=t,await this._service.restoreState(!0),await this._service.displayDefinedVariables(),(null===(s=null===(e=this._service.session)||void 0===e?void 0:e.capabilities)||void 0===s?void 0:s.supportsModulesRequest)&&await this._service.displayModules()},g=async()=>{if(!a())return;const t=this._iconButtons[e.id];h()?(await u(),c(),D(t,!1)):(await p(),d(),D(t,!0))};return((t=!0)=>{const s=this._iconButtons[e.id];s?D(s,this._service.isStarted,t,g):this._iconButtons[e.id]=function(e,t,s,r,n=v.nullTranslator){const o=n.load("jupyterlab"),a=new i.ToolbarButton({className:"jp-DebuggerBugButton",icon:i.bugIcon,tooltip:o.__("Enable Debugger"),pressedIcon:i.bugDotIcon,pressedTooltip:o.__("Disable Debugger"),disabledTooltip:o.__("Select a kernel that supports debugging to enable debugger"),enabled:s,pressed:r,onClick:t});return e.toolbar.insertBefore("kernelName",M,a)||e.toolbar.addItem(M,a),a}(e,g,this._service.isStarted,t)})(!1),e.disposed.connect((async()=>{h()&&await u(),c(),delete this._iconButtons[e.id],delete this._contextKernelChangedHandlers[e.id]})),await this._service.isAvailable(t)?(this._service.session?(this._previousConnection=(null===(s=this._service.session.connection)||void 0===s?void 0:s.kernel)?this._service.session.connection:null,this._service.session.connection=t):this._service.session=new He.Session({connection:t,config:this._service.config}),await this._service.restoreState(!1),this._service.isStarted&&!this._service.hasStoppedThreads()&&(await this._service.displayDefinedVariables(),(null===(n=null===(r=this._service.session)||void 0===r?void 0:r.capabilities)||void 0===n?void 0:n.supportsModulesRequest)&&await this._service.displayModules()),D(this._iconButtons[e.id],this._service.isStarted,!0),this._service.isStarted?(d(),void(this._previousConnection=t)):(c(),this._service.session.connection=null!==(o=this._previousConnection)&&void 0!==o?o:t,void await this._service.restoreState(!1))):(c(),void D(this._iconButtons[e.id],!1,!1))}}const I=new i.LabIcon({name:"debugger:close-all",svgstr:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <g class="jp-icon3" fill="#616161">\n <path d="M16.4805 17.2481C16.8158 16.3972 17 15.4701 17 14.5C17 10.3579 13.6421 7.00001 9.5 7.00001C8.36314 7.00001 7.28536 7.25295 6.31986 7.70564C7.60064 6.0592 9.60074 5 11.8482 5C15.7142 5 18.8482 8.13401 18.8482 12C18.8482 14.0897 17.9325 15.9655 16.4805 17.2481Z" />\n <path d="M19.1607 14.2481C19.496 13.3971 19.6801 12.4701 19.6801 11.5C19.6801 7.35786 16.3223 4 12.1801 4C11.0433 4 9.9655 4.25295 9.00001 4.70563C10.2808 3.05919 12.2809 2 14.5284 2C18.3944 2 21.5284 5.134 21.5284 9C21.5284 11.0897 20.6127 12.9655 19.1607 14.2481Z" />\n <path d="M16 15C16 18.866 12.866 22 9 22C5.13401 22 2 18.866 2 15C2 11.134 5.13401 8 9 8C12.866 8 16 11.134 16 15ZM11.7914 11L13 12.2086L10.2086 15L13 17.7914L11.7914 19L9 16.2086L6.20857 19L5 17.7914L7.79143 15L5 12.2086L6.20857 11L9 13.7914L11.7914 11Z" />\n </g>\n</svg>\n'}),V=new i.LabIcon({name:"debugger:pause-on-exception",svgstr:'<svg height="24" width="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <g class="jp-icon3" fill="#616161" transform="matrix(1.1999396,0,0,1.3858273,-2.3726971,-4.6347192)">\n <path\n d="M 12.023438,0.30859375 11.158203,1.8085937 -1.2382812,23.285156 l 26.5292972,-0.002 z m 0.002,3.99999995 9.800781,16.9746093 -19.6015626,0.002 z"\n transform="matrix(0.72509832,0,0,0.7247701,3.2918397,3.480876)"\n />\n <path d="m 11.144475,9.117095 h 1.666751 v 7.215906 h -1.666751 z" />\n <path d="m 11.144475,17.054592 h 1.666751 v 1.443181 h -1.666751 z" />\n </g>\n</svg>\n'}),B=new i.LabIcon({name:"debugger:pause",svgstr:'<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">\n <g class="jp-icon3" fill="#616161">\n <path d="m 7,6 h 4 V 18 H 7 Z" />\n <path d="m 13,6 h 4 v 12 h -4 z" />\n </g>\n</svg>\n'}),H=new i.LabIcon({name:"debugger:step-into",svgstr:'<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">\n\t<g class="jp-icon3" fill="#616161">\n\t\t<path d="M7.99998 9.53198H8.54198L12.447 5.62698L11.386 4.56698L8.74898 7.17698L8.74898 0.999985H7.99998H7.25098L7.25098 7.17698L4.61398 4.56698L3.55298 5.62698L7.45798 9.53198H7.99998ZM9.95598 13.013C9.95598 14.1175 9.06055 15.013 7.95598 15.013C6.85141 15.013 5.95598 14.1175 5.95598 13.013C5.95598 11.9084 6.85141 11.013 7.95598 11.013C9.06055 11.013 9.95598 11.9084 9.95598 13.013Z"/>\n\t</g>\n</svg>\n'}),R=new i.LabIcon({name:"debugger:step-over",svgstr:'<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">\n\t<g class="jp-icon3" fill="#616161">\n\t\t<path d="M14.25 5.75V1.75H12.75V4.2916C11.605 2.93303 9.83899 2.08334 7.90914 2.08334C4.73316 2.08334 1.98941 4.39036 1.75072 7.48075L1.72992 7.75H3.231L3.25287 7.5241C3.46541 5.32932 5.45509 3.58334 7.90914 3.58334C9.6452 3.58334 11.1528 4.45925 11.9587 5.75H9.12986V7.25H13.292L14.2535 6.27493V5.75H14.25ZM7.99997 14C9.10454 14 9.99997 13.1046 9.99997 12C9.99997 10.8954 9.10454 10 7.99997 10C6.8954 10 5.99997 10.8954 5.99997 12C5.99997 13.1046 6.8954 14 7.99997 14Z"/>\n\t</g>\n</svg>\n'}),j=new i.LabIcon({name:"debugger:step-out",svgstr:'<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">\n\t<g class="jp-icon3" fill="#616161">\n\t\t<path d="M7.99998 1H7.45798L3.55298 4.905L4.61398 5.965L7.25098 3.355V9.532H7.99998H8.74898V3.355L11.386 5.965L12.447 4.905L8.54198 1H7.99998ZM9.95598 13.013C9.95598 14.1176 9.06055 15.013 7.95598 15.013C6.85141 15.013 5.95598 14.1176 5.95598 13.013C5.95598 11.9084 6.85141 11.013 7.95598 11.013C9.06055 11.013 9.95598 11.9084 9.95598 13.013Z"/>\n\t</g>\n</svg>\n'}),F=new i.LabIcon({name:"debugger:variable",svgstr:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 4L1 4.5V12.5L1.5 13H4V12H2V5H4V4H1.5ZM14.5 13L15 12.5L15 4.5L14.5 4H12V5L14 5L14 12H12V13H14.5ZM8.79693 5L4.29693 7L4 7.45691V9.95691L4.24275 10.3857L6.74275 11.8857L7.20307 11.9138L11.7031 9.91381L12 9.45691V6.95691L11.7572 6.52816L9.25725 5.02816L8.79693 5ZM5 8.34V9.67381L6.5 10.5738V9.24L5 8.34ZM7.5 9.28184V10.6875L11 9.13197V7.72629L7.5 9.28184ZM10.4178 6.89071L8.96559 6.01936L5.58216 7.52311L7.03441 8.39445L10.4178 6.89071Z" fill="#007ACC"/>\n</svg>\n'}),L=new i.LabIcon({name:"debugger:view-breakpoint",svgstr:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <g class="jp-icon3" fill="#616161">\n <path d="M5 2H15L20 7V20C20 20.5304 19.7893 21.0391 19.4142 21.4142C19.0391 21.7893 18.5304 22 18 22H5C4.46957 22 3.96086 21.7893 3.58579 21.4142C3.21071 21.0391 3 20.5304 3 20V14H4V16L8 13L4 10V12H3V4C3 3.46957 3.21071 2.96086 3.58579 2.58579C3.96086 2.21071 4.46957 2 5 2ZM12 18H16V16H12V18ZM12 14H18V12H12V14ZM12 10H18V8H12V10ZM10 14C10.5523 14 11 13.5523 11 13C11 12.4477 10.5523 12 10 12C9.44771 12 9 12.4477 9 13C9 13.5523 9.44771 14 10 14Z"/>\n <path d="M3 12V14H1V13V12H3Z"/>\n </g>\n</svg>\n'}),P=new i.LabIcon({name:"debugger:open-kernel-source",svgstr:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <g class="jp-icon3" fill="#616161">\n <path d="M5 2H15L20 7V20C20 20.5304 19.7893 21.0391 19.4142 21.4142C19.0391 21.7893 18.5304 22 18 22H5C4.46957 22 3.96086 21.7893 3.58579 21.4142C3.21071 21.0391 3 20.5304 3 20V14H4V16L8 13L4 10V12H3V4C3 3.46957 3.21071 2.96086 3.58579 2.58579C3.96086 2.21071 4.46957 2 5 2ZM12 18H16V16H12V18ZM12 14H18V12H12V14ZM12 10H18V8H12V10ZM10 14C10.5523 14 11 13.5523 11 13C11 12.4477 10.5523 12 10 12C9.44771 12 9 12.4477 9 13C9 13.5523 9.44771 14 10 14Z"/>\n <path d="M3 12V14H1V13V12H3Z"/>\n </g>\n</svg>\n'});class O{constructor(){this._breakpoints=new Map,this._changed=new f.Signal(this),this._restored=new f.Signal(this),this._clicked=new f.Signal(this)}get changed(){return this._changed}get restored(){return this._restored}get clicked(){return this._clicked}get breakpoints(){return this._breakpoints}setBreakpoints(e,t){this._breakpoints.set(e,t),this._changed.emit(t)}getBreakpoints(e){var t;return null!==(t=this._breakpoints.get(e))&&void 0!==t?t:[]}restoreBreakpoints(e){this._breakpoints=e,this._restored.emit()}}class N{constructor(){this._state=[],this._currentFrame=null,this._framesChanged=new f.Signal(this),this._currentFrameChanged=new f.Signal(this)}get frames(){return this._state}set frames(e){this._state=e;const t=null!==this.frame?A.getFrameId(this.frame):"";e.find((e=>A.getFrameId(e)===t))||(this.frame=e[0]),this._framesChanged.emit(e)}get frame(){return this._currentFrame}set frame(e){this._currentFrame=e,this._currentFrameChanged.emit(e)}get framesChanged(){return this._framesChanged}get currentFrameChanged(){return this._currentFrameChanged}}var A;!function(e){e.getFrameId=function(e){var t;return`${null===(t=null==e?void 0:e.source)||void 0===t?void 0:t.path}-${null==e?void 0:e.id}`}}(A||(A={}));class q{constructor(e){this._currentSourceOpened=new f.Signal(this),this._currentSourceChanged=new f.Signal(this),this.currentFrameChanged=e.currentFrameChanged}get currentSourceOpened(){return this._currentSourceOpened}get currentSourceChanged(){return this._currentSourceChanged}get currentSource(){return this._currentSource}set currentSource(e){this._currentSource=e,this._currentSourceChanged.emit(e)}open(){this._currentSourceOpened.emit(this._currentSource)}}var W=s(97934);const Z=(e,t)=>e.name<t.name?-1:e.name>t.name?1:0;class K{constructor(){this._filteredKernelSources=null,this._filter="",this._isDisposed=!1,this._kernelSources=null,this._changed=new f.Signal(this),this._filterChanged=new f.Signal(this),this._kernelSourceOpened=new f.Signal(this),this.refresh=this.refresh.bind(this),this._refreshDebouncer=new W.Debouncer(this.refresh,500)}get filter(){return this._filter}set filter(e){this._filter=e,this._filterChanged.emit(e),this._refreshDebouncer.invoke()}get isDisposed(){return this._isDisposed}get kernelSources(){return this._kernelSources}set kernelSources(e){this._kernelSources=e,this.refresh()}get changed(){return this._changed}get filterChanged(){return this._filterChanged}get kernelSourceOpened(){return this._kernelSourceOpened}dispose(){this._isDisposed||(this._isDisposed=!0,this._refreshDebouncer.dispose(),f.Signal.clearData(this))}open(e){this._kernelSourceOpened.emit(e)}getFilteredKernelSources(){const e=new RegExp(this._filter);return this._kernelSources.filter((t=>e.test(t.name)))}refresh(){this._kernelSources?(this._filteredKernelSources=this._filter?this.getFilteredKernelSources():this._kernelSources,this._filteredKernelSources.sort(Z)):(this._kernelSources=new Array,this._filteredKernelSources=new Array),this._changed.emit(this._filteredKernelSources)}}class z{constructor(){this._selectedVariable=null,this._state=[],this._variableExpanded=new f.Signal(this),this._changed=new f.Signal(this)}get scopes(){return this._state}set scopes(e){this._state=e,this._changed.emit()}get changed(){return this._changed}get variableExpanded(){return this._variableExpanded}get selectedVariable(){return this._selectedVariable}set selectedVariable(e){this._selectedVariable=e}expandVariable(e){this._variableExpanded.emit(e)}}class G{constructor(){this._disposed=new f.Signal(this),this._isDisposed=!1,this._hasRichVariableRendering=!1,this._supportCopyToGlobals=!1,this._stoppedThreads=new Set,this._title="-",this._titleChanged=new f.Signal(this),this.breakpoints=new O,this.callstack=new N,this.variables=new z,this.sources=new q({currentFrameChanged:this.callstack.currentFrameChanged}),this.kernelSources=new K}get disposed(){return this._disposed}get hasRichVariableRendering(){return this._hasRichVariableRendering}set hasRichVariableRendering(e){this._hasRichVariableRendering=e}get supportCopyToGlobals(){return this._supportCopyToGlobals}set supportCopyToGlobals(e){this._supportCopyToGlobals=e}get isDisposed(){return this._isDisposed}get stoppedThreads(){return this._stoppedThreads}set stoppedThreads(e){this._stoppedThreads=e}get title(){return this._title}set title(e){e!==this._title&&(this._title=null!=e?e:"-",this._titleChanged.emit(e))}get titleChanged(){return this._titleChanged}dispose(){this._isDisposed||(this._isDisposed=!0,this.kernelSources.dispose(),this._disposed.emit())}clear(){this._stoppedThreads.clear();const e=new Map;this.breakpoints.restoreBreakpoints(e),this.callstack.frames=[],this.variables.scopes=[],this.sources.currentSource=null,this.kernelSources.kernelSources=null,this.title="-"}}class $ extends h.Panel{constructor(e){super(),this._filter=new Set,this._grid=null,this._pending=null,this.commands=e.commands,this.model=e.model,this.themeManager=e.themeManager,this.translator=e.translator,this.model.changed.connect((()=>this.update()),this),this.addClass("jp-DebuggerVariables-body")}get filter(){return this._filter}set filter(e){this._filter=e,this.update()}get scope(){return this._scope}set scope(e){this._scope=e,"Globals"!==e?this.addClass("jp-debuggerVariables-local"):this.removeClass("jp-debuggerVariables-local"),this.update()}async initialize(){if(this._grid||this._pending)return;const{Grid:e}=await(this._pending=Promise.all([s.e(9072),s.e(1958)]).then(s.bind(s,31958))),{commands:t,model:i,themeManager:r,translator:n}=this;this._grid=new e({commands:t,model:i,themeManager:r,translator:n}),this._grid.addClass("jp-DebuggerVariables-grid"),this._pending=null,this.addWidget(this._grid),this.update()}onBeforeShow(e){this._grid||this._pending||this.initialize(),super.onBeforeShow(e)}onUpdateRequest(e){var t;if(this._grid){const{dataModel:e}=this._grid;e.filter=this._filter,e.scope=this._scope,e.setData(null!==(t=this.model.scopes)&&void 0!==t?t:[])}super.onUpdateRequest(e)}}var U=s(81221),J=s(20998);class Y extends d.MainAreaWidget{constructor(e){const{dataLoader:t,rendermime:s,translator:i}=e,r=new h.Panel,n=new J.PromiseDelegate;super({content:r,reveal:Promise.all([t,n.promise])}),this.content.addClass("jp-VariableRendererPanel"),this.trans=(null!=i?i:v.nullTranslator).load("jupyterlab"),this.dataLoader=t,this.renderMime=s,this._dataHash=null,this.refresh().then((()=>{n.resolve()})).catch((e=>n.reject(e)))}async refresh(e=!1){let t=await this.dataLoader();if(0===Object.keys(t.data).length&&(t={data:{"text/plain":this.trans.__("The variable is undefined in the active context.")},metadata:{}}),!t.data)return this._dataHash=null,Promise.reject("Unable to get a view on the variable.");{const s=o(JSON.stringify(t),17);if(e||this._dataHash!==s){this.content.layout&&this.content.widgets.forEach((e=>{this.content.layout.removeWidget(e)}));const e=this.renderMime.preferredMimeType(t.data,"any");if(!e)return this._dataHash=null,Promise.reject("Unable to determine the preferred mime type.");{const i=this.renderMime.createRenderer(e);i.addClass("jp-VariableRendererPanel-renderer");const r=new U.MimeModel({...t,trusted:!0});this._dataHash=s,await i.renderModel(r),this.content.addWidget(i)}}}}}class Q{constructor(e){var t,s;this._eventMessage=new f.Signal(this),this._isDisposed=!1,this._sessionChanged=new f.Signal(this),this._pauseOnExceptionChanged=new f.Signal(this),this._config=e.config,this._session=null,this._specsManager=null!==(t=e.specsManager)&&void 0!==t?t:null,this._model=new He.Model,this._debuggerSources=null!==(s=e.debuggerSources)&&void 0!==s?s:null,this._trans=(e.translator||v.nullTranslator).load("jupyterlab")}get eventMessage(){return this._eventMessage}get config(){return this._config}get isDisposed(){return this._isDisposed}get isStarted(){var e,t;return null!==(t=null===(e=this._session)||void 0===e?void 0:e.isStarted)&&void 0!==t&&t}get pauseOnExceptionChanged(){return this._pauseOnExceptionChanged}get model(){return this._model}get session(){return this._session}set session(e){var t;this._session!==e&&(this._session&&this._session.dispose(),this._session=e,null===(t=this._session)||void 0===t||t.eventMessage.connect(((e,t)=>{"stopped"===t.event?(this._model.stoppedThreads.add(t.body.threadId),this._getAllFrames()):"continued"===t.event&&(this._model.stoppedThreads.delete(t.body.threadId),this._clearModel(),this._clearSignals()),this._eventMessage.emit(t)})),this._sessionChanged.emit(e))}get sessionChanged(){return this._sessionChanged}dispose(){this.isDisposed||(this._isDisposed=!0,f.Signal.clearData(this))}getCodeId(e){var t,s,i,r;try{return this._config.getCodeId(e,null!==(r=null===(i=null===(s=null===(t=this.session)||void 0===t?void 0:t.connection)||void 0===s?void 0:s.kernel)||void 0===i?void 0:i.name)&&void 0!==r?r:"")}catch(e){return""}}hasStoppedThreads(){var e,t;return null!==(t=(null===(e=this._model)||void 0===e?void 0:e.stoppedThreads.size)>0)&&void 0!==t&&t}async isAvailable(e){var t,s,i,r;if(!this._specsManager)return!0;await this._specsManager.ready;const n=null==e?void 0:e.kernel;if(!n)return!1;const o=n.name;return!(null===(t=this._specsManager.specs)||void 0===t?void 0:t.kernelspecs[o])||!(null===(r=null===(i=null===(s=this._specsManager.specs.kernelspecs[o])||void 0===s?void 0:s.metadata)||void 0===i?void 0:i.debugger)||void 0===r||!r)}async clearBreakpoints(){var e;if(!0!==(null===(e=this.session)||void 0===e?void 0:e.isStarted))return;this._model.breakpoints.breakpoints.forEach(((e,t,s)=>{this._setBreakpoints([],t)}));let t=new Map;this._model.breakpoints.restoreBreakpoints(t)}async continue(){try{if(!this.session)throw new Error("No active debugger session");await this.session.sendRequest("continue",{threadId:this._currentThread()}),this._model.stoppedThreads.delete(this._currentThread()),this._clearModel(),this._clearSignals()}catch(e){console.error("Error:",e.message)}}async getSource(e){var t,s;if(!this.session)throw new Error("No active debugger session");return{...(await this.session.sendRequest("source",{source:e,sourceReference:null!==(t=e.sourceReference)&&void 0!==t?t:0})).body,path:null!==(s=e.path)&&void 0!==s?s:""}}async evaluate(e){var t;if(!this.session)throw new Error("No active debugger session");const s=null===(t=this.model.callstack.frame)||void 0===t?void 0:t.id,i=await this.session.sendRequest("evaluate",{context:"repl",expression:e,frameId:s});return i.success?(this._clearModel(),await this._getAllFrames(),i.body):null}async next(){try{if(!this.session)throw new Error("No active debugger session");await this.session.sendRequest("next",{threadId:this._currentThread()})}catch(e){console.error("Error:",e.message)}}async inspectRichVariable(e,t){if(!this.session)throw new Error("No active debugger session");const s=await this.session.sendRequest("richInspectVariables",{variableName:e,frameId:t});if(s.success)return s.body;throw new Error(s.message)}async inspectVariable(e){if(!this.session)throw new Error("No active debugger session");const t=await this.session.sendRequest("variables",{variablesReference:e});if(t.success)return t.body.variables;throw new Error(t.message)}async copyToGlobals(e){if(!this.session)throw new Error("No active debugger session");if(!this.model.supportCopyToGlobals)throw new Error('The "copyToGlobals" request is not supported by the kernel');const t=this.model.callstack.frames;this.session.sendRequest("copyToGlobals",{srcVariableName:e,dstVariableName:e,srcFrameId:t[0].id}).then((async()=>{const e=await this._getScopes(t[0]),s=await Promise.all(e.map((e=>this._getVariables(e)))),i=this._convertScopes(e,s);this._model.variables.scopes=i})).catch((e=>{console.error(e)}))}async displayDefinedVariables(){if(!this.session)throw new Error("No active debugger session");const e=(await this.session.sendRequest("inspectVariables",{})).body.variables,t=[{name:this._trans.__("Globals"),variables:e}];this._model.variables.scopes=t}async displayModules(){if(!this.session)throw new Error("No active debugger session");const e=await this.session.sendRequest("modules",{});this._model.kernelSources.kernelSources=e.body.modules.map((e=>({name:e.name,path:e.path})))}async restart(){const{breakpoints:e}=this._model.breakpoints;await this.stop(),await this.start(),await this._restoreBreakpoints(e)}async restoreState(e){var t,s,i,r,n,o,a,l,d,c;if(!this.model||!this.session)return;const h=await this.session.restoreState(),{body:u}=h,p=this._mapBreakpoints(u.breakpoints),g=new Set(u.stoppedThreads);if(this._model.hasRichVariableRendering=!0===u.richRendering,this._model.supportCopyToGlobals=!0===u.copyToGlobals,this._config.setHashParams({kernel:null!==(r=null===(i=null===(s=null===(t=this.session)||void 0===t?void 0:t.connection)||void 0===s?void 0:s.kernel)||void 0===i?void 0:i.name)&&void 0!==r?r:"",method:u.hashMethod,seed:u.hashSeed}),this._config.setTmpFileParams({kernel:null!==(l=null===(a=null===(o=null===(n=this.session)||void 0===n?void 0:n.connection)||void 0===o?void 0:o.kernel)||void 0===a?void 0:a.name)&&void 0!==l?l:"",prefix:u.tmpFilePrefix,suffix:u.tmpFileSuffix}),this._model.stoppedThreads=g,this.isStarted||!e&&0===g.size||await this.start(),(this.isStarted||e)&&(this._model.title=this.isStarted&&(null===(c=null===(d=this.session)||void 0===d?void 0:d.connection)||void 0===c?void 0:c.name)||"-"),this._debuggerSources){const e=this._filterBreakpoints(p);this._model.breakpoints.restoreBreakpoints(e)}else this._model.breakpoints.restoreBreakpoints(p);0!==g.size?await this._getAllFrames():this.isStarted&&(this._clearModel(),this._clearSignals()),this.session.currentExceptionFilters&&await this.pauseOnExceptions(this.session.currentExceptionFilters)}start(){if(!this.session)throw new Error("No active debugger session");return this.session.start()}async pause(){try{if(!this.session)throw new Error("No active debugger session");await this.session.sendRequest("pause",{threadId:this._currentThread()})}catch(e){console.error("Error:",e.message)}}async stepIn(){try{if(!this.session)throw new Error("No active debugger session");await this.session.sendRequest("stepIn",{threadId:this._currentThread()})}catch(e){console.error("Error:",e.message)}}async stepOut(){try{if(!this.session)throw new Error("No active debugger session");await this.session.sendRequest("stepOut",{threadId:this._currentThread()})}catch(e){console.error("Error:",e.message)}}async stop(){if(!this.session)throw new Error("No active debugger session");await this.session.stop(),this._model&&this._model.clear()}async updateBreakpoints(e,t,s){var i;if(!(null===(i=this.session)||void 0===i?void 0:i.isStarted))return;s||(s=(await this._dumpCell(e)).body.sourcePath);const r=await this.session.restoreState(),n=t.filter((({line:e})=>"number"==typeof e)).map((({line:e})=>({line:e}))),o=this._mapBreakpoints(r.body.breakpoints);if(this._debuggerSources){const e=this._filterBreakpoints(o);this._model.breakpoints.restoreBreakpoints(e)}else this._model.breakpoints.restoreBreakpoints(o);let a=new Set;const l=(await this._setBreakpoints(n,s)).body.breakpoints.filter(((e,t,s)=>{const i=s.findIndex((t=>t.line===e.line))>-1,r=!a.has(e.line);return a.add(e.line),i&&r}));this._model.breakpoints.setBreakpoints(s,l),await this.session.sendRequest("configurationDone",{})}pauseOnExceptionsIsValid(){var e,t;return!(!this.isStarted||0===(null===(t=null===(e=this.session)||void 0===e?void 0:e.exceptionBreakpointFilters)||void 0===t?void 0:t.length))}async pauseOnExceptionsFilter(e){var t;if(!(null===(t=this.session)||void 0===t?void 0:t.isStarted))return;let s=this.session.currentExceptionFilters;if(this.session.isPausingOnException(e)){const t=s.indexOf(e);s.splice(t,1)}else null==s||s.push(e);await this.pauseOnExceptions(s)}async pauseOnExceptions(e){var t,s;if(!(null===(t=this.session)||void 0===t?void 0:t.isStarted))return;const i=(null===(s=this.session.exceptionBreakpointFilters)||void 0===s?void 0:s.map((e=>e.filter)))||[];let r={filters:[]};e.forEach((e=>{i.includes(e)&&r.filters.push(e)})),this.session.currentExceptionFilters=r.filters,await this.session.sendRequest("setExceptionBreakpoints",r),this._pauseOnExceptionChanged.emit()}getDebuggerState(){var e,t,s,i,r,n,o;const a=this._model.breakpoints.breakpoints;let l=[];if(this._debuggerSources)for(const d of a.keys()){const a=this._debuggerSources.find({focus:!1,kernel:null!==(i=null===(s=null===(t=null===(e=this.session)||void 0===e?void 0:e.connection)||void 0===t?void 0:t.kernel)||void 0===s?void 0:s.name)&&void 0!==i?i:"",path:null!==(o=null===(n=null===(r=this._session)||void 0===r?void 0:r.connection)||void 0===n?void 0:n.path)&&void 0!==o?o:"",source:d}).map((e=>e.src.getSource()));l=l.concat(a)}return{cells:l,breakpoints:a}}async restoreDebuggerState(e){var t,s,i,r;await this.start();for(const t of e.cells)await this._dumpCell(t);const n=new Map,o=null!==(r=null===(i=null===(s=null===(t=this.session)||void 0===t?void 0:t.connection)||void 0===s?void 0:s.kernel)||void 0===i?void 0:i.name)&&void 0!==r?r:"",{prefix:a,suffix:l}=this._config.getTmpFileParams(o);for(const t of e.breakpoints){const[e,s]=t,i=e.substr(0,e.length-l.length),r=i.substr(i.lastIndexOf("/")+1),o=a.concat(r).concat(l);n.set(o,s)}await this._restoreBreakpoints(n);const d=await this.session.sendRequest("configurationDone",{});return await this.restoreState(!1),d.success}_clearModel(){this._model.callstack.frames=[],this._model.variables.scopes=[]}_clearSignals(){this._model.callstack.currentFrameChanged.disconnect(this._onCurrentFrameChanged,this),this._model.variables.variableExpanded.disconnect(this._onVariableExpanded,this)}_convertScopes(e,t){return t&&e?e.map(((e,s)=>({name:e.name,variables:t[s].map((e=>({...e})))}))):[]}_currentThread(){return 1}async _dumpCell(e){if(!this.session)throw new Error("No active debugger session");return this.session.sendRequest("dumpCell",{code:e})}_filterBreakpoints(e){if(!this._debuggerSources)return e;let t=new Map;for(const s of e){const[e,i]=s;i.forEach((()=>{var s,r,n,o,a,l,d;this._debuggerSources.find({focus:!1,kernel:null!==(o=null===(n=null===(r=null===(s=this.session)||void 0===s?void 0:s.connection)||void 0===r?void 0:r.kernel)||void 0===n?void 0:n.name)&&void 0!==o?o:"",path:null!==(d=null===(l=null===(a=this._session)||void 0===a?void 0:a.connection)||void 0===l?void 0:l.path)&&void 0!==d?d:"",source:e}).forEach((()=>{i.length>0&&t.set(e,i)}))}))}return t}async _getAllFrames(){this._model.callstack.currentFrameChanged.connect(this._onCurrentFrameChanged,this),this._model.variables.variableExpanded.connect(this._onVariableExpanded,this);const e=await this._getFrames(this._currentThread());this._model.callstack.frames=e}async _getFrames(e){if(!this.session)throw new Error("No active debugger session");return(await this.session.sendRequest("stackTrace",{threadId:e})).body.stackFrames}async _getScopes(e){if(!this.session)throw new Error("No active debugger session");return e?(await this.session.sendRequest("scopes",{frameId:e.id})).body.scopes:[]}async _getVariables(e){if(!this.session)throw new Error("No active debugger session");return e?(await this.session.sendRequest("variables",{variablesReference:e.variablesReference})).body.variables:[]}_mapBreakpoints(e){return e.length?e.reduce(((e,t)=>{const{breakpoints:s,source:i}=t;return e.set(i,s.map((e=>({...e,source:{path:i},verified:!0})))),e}),new Map):new Map}async _onCurrentFrameChanged(e,t){if(!t)return;const s=await this._getScopes(t),i=await Promise.all(s.map((e=>this._getVariables(e)))),r=this._convertScopes(s,i);this._model.variables.scopes=r}async _onVariableExpanded(e,t){if(!this.session)throw new Error("No active debugger session");const s=await this.session.sendRequest("variables",{variablesReference:t.variablesReference});let i={...t,expanded:!0};s.body.variables.forEach((e=>{i={[e.name]:e,...i}}));const r=this._model.variables.scopes.map((e=>{const s=e.variables.findIndex((e=>e.variablesReference===t.variablesReference));return e.variables[s]=i,{...e}}));return this._model.variables.scopes=[...r],s.body.variables}async _setBreakpoints(e,t){if(!this.session)throw new Error("No active debugger session");return await this.session.sendRequest("setBreakpoints",{breakpoints:e,source:{path:t},sourceModified:!1})}async _restoreBreakpoints(e){for(const[t,s]of e)await this._setBreakpoints(s.filter((({line:e})=>"number"==typeof e)).map((({line:e})=>({line:e}))),t);this._model.breakpoints.restoreBreakpoints(e)}}class X{constructor(e){this._seq=0,this._ready=new J.PromiseDelegate,this._isDisposed=!1,this._isStarted=!1,this._exceptionPaths=[],this._exceptionBreakpointFilters=[],this._currentExceptionFilters={},this._disposed=new f.Signal(this),this._eventMessage=new f.Signal(this),this.connection=e.connection,this._config=e.config,this.translator=e.translator||v.nullTranslator}get isDisposed(){return this._isDisposed}get capabilities(){return this._capabilities}get disposed(){return this._disposed}get connection(){return this._connection}set connection(e){var t,s;if(this._connection&&this._connection.iopubMessage.disconnect(this._handleEvent,this),this._connection=e,!this._connection)return void(this._isStarted=!1);this._connection.iopubMessage.connect(this._handleEvent,this),this._ready=new J.PromiseDelegate;const i=null===(s=null===(t=this.connection)||void 0===t?void 0:t.kernel)||void 0===s?void 0:s.requestDebug({type:"request",seq:0,command:"debugInfo"});i&&(i.onReply=e=>{this._ready.resolve(),i.dispose()})}get isStarted(){return this._isStarted}get exceptionPaths(){return this._exceptionPaths}get exceptionBreakpointFilters(){return this._exceptionBreakpointFilters}get currentExceptionFilters(){var e,t,s;const i=null!==(s=null===(t=null===(e=this.connection)||void 0===e?void 0:e.kernel)||void 0===t?void 0:t.name)&&void 0!==s?s:"";if(!i)return[];const r=this._config.getTmpFileParams(i);if(!r)return[];let n=r.prefix;return Object.keys(this._currentExceptionFilters).includes(n)?this._currentExceptionFilters[n]:[]}set currentExceptionFilters(e){var t,s,i;const r=null!==(i=null===(s=null===(t=this.connection)||void 0===t?void 0:t.kernel)||void 0===s?void 0:s.name)&&void 0!==i?i:"";if(!r)return;const n=this._config.getTmpFileParams(r);if(!n)return;let o=n.prefix;null===e?Object.keys(this._currentExceptionFilters).includes(o)&&delete this._currentExceptionFilters[o]:this._currentExceptionFilters[o]=e}get eventMessage(){return this._eventMessage}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposed.emit(),f.Signal.clearData(this))}async start(){var e,t,s,i;const r=await this.sendRequest("initialize",{clientID:"jupyterlab",clientName:"JupyterLab",adapterID:null!==(s=null===(t=null===(e=this.connection)||void 0===e?void 0:e.kernel)||void 0===t?void 0:t.name)&&void 0!==s?s:"",pathFormat:"path",linesStartAt1:!0,columnsStartAt1:!0,supportsVariableType:!0,supportsVariablePaging:!0,supportsRunInTerminalRequest:!0,locale:document.documentElement.lang});if(!r.success)throw new Error(`Could not start the debugger: ${r.message}`);this._capabilities=r.body,this._isStarted=!0,this._exceptionBreakpointFilters=null===(i=r.body)||void 0===i?void 0:i.exceptionBreakpointFilters,await this.sendRequest("attach",{})}async stop(){this._isStarted=!1,await this.sendRequest("disconnect",{restart:!1,terminateDebuggee:!1})}async restoreState(){var e;const t=await this.sendRequest("debugInfo",{});return this._isStarted=t.body.isStarted,this._exceptionPaths=null===(e=t.body)||void 0===e?void 0:e.exceptionPaths,t}isPausingOnException(e){var t,s;return e?null!==(s=null===(t=this.currentExceptionFilters)||void 0===t?void 0:t.includes(e))&&void 0!==s&&s:this.currentExceptionFilters.length>0}async sendRequest(e,t){return await this._ready.promise,(await this._sendDebugMessage({type:"request",seq:this._seq++,command:e,arguments:t})).content}_handleEvent(e,t){if("debug_event"!==t.header.msg_type)return;const s=t.content;this._eventMessage.emit(s)}async _sendDebugMessage(e){var t;const s=null===(t=this.connection)||void 0===t?void 0:t.kernel;if(!s)return Promise.reject(new Error("A kernel is required to send debug messages."));const i=new J.PromiseDelegate,r=s.requestDebug(e);return r.onReply=e=>{i.resolve(e)},await r.done,i.promise}}var ee=s(78156),te=s.n(ee);class se extends i.ReactWidget{constructor(e){super(),this._model=e,this.addClass("jp-DebuggerBreakpoints-body")}render(){return te().createElement(ie,{model:this._model})}}const ie=({model:e})=>{const[t,s]=(0,ee.useState)(Array.from(e.breakpoints.entries()));return(0,ee.useEffect)((()=>{const t=(t,i)=>{s(Array.from(e.breakpoints.entries()))},i=t=>{s(Array.from(e.breakpoints.entries()))};return e.changed.connect(t),e.restored.connect(i),()=>{e.changed.disconnect(t),e.restored.disconnect(i)}})),te().createElement(te().Fragment,null,t.map((t=>te().createElement(re,{key:t[0],breakpoints:t[1],model:e}))))},re=({breakpoints:e,model:t})=>te().createElement(te().Fragment,null,e.sort(((e,t)=>{var s,i;return(null!==(s=e.line)&&void 0!==s?s:0)-(null!==(i=t.line)&&void 0!==i?i:0)})).map(((e,s)=>{var i,r;return te().createElement(ne,{key:(null!==(r=null===(i=e.source)||void 0===i?void 0:i.path)&&void 0!==r?r:"")+s,breakpoint:e,model:t})}))),ne=({breakpoint:e,model:t})=>{var s,i,r,n;return te().createElement("div",{className:"jp-DebuggerBreakpoint",onClick:()=>t.clicked.emit(e),title:null===(s=e.source)||void 0===s?void 0:s.path},te().createElement("span",{className:"jp-DebuggerBreakpoint-marker"},"●"),te().createElement("span",{className:"jp-DebuggerBreakpoint-source jp-left-truncated"},"/"===(n=null!==(r=null===(i=e.source)||void 0===i?void 0:i.path)&&void 0!==r?r:"")[0]?n.slice(1)+"/":n),te().createElement("span",{className:"jp-DebuggerBreakpoint-line"},e.line))},oe="jp-PauseOnExceptions";class ae extends i.ToolbarButton{constructor(e){super(),this.onclick=()=>{this._menu.open(this.node.getBoundingClientRect().left,this.node.getBoundingClientRect().bottom)},this._menu=new le({service:e.service,commands:{registry:e.commands.registry,pauseOnExceptions:e.commands.pauseOnExceptions}}),this.node.className="jp-debugger-pauseOnExceptions",this._props=e,this._props.className=oe,this._props.service.eventMessage.connect(((e,t)=>{"initialized"!==t.event&&"terminated"!==t.event||this.onChange()}),this),this._props.enabled=this._props.service.pauseOnExceptionsIsValid(),this._props.service.pauseOnExceptionChanged.connect(this.onChange,this)}onChange(){var e;const t=this._props.service.session,s=null==t?void 0:t.exceptionBreakpointFilters;this._props.className=oe,(null===(e=this._props.service.session)||void 0===e?void 0:e.isStarted)&&s?(this._props.pressed=t.isPausingOnException(),this._props.enabled=!0):this._props.enabled=!1,this.update()}render(){return ee.createElement(i.ToolbarButtonComponent,{...this._props,onClick:this.onclick})}}class le extends i.MenuSvg{constructor(e){super({commands:e.commands.registry}),this._service=e.service,this._command=e.commands.pauseOnExceptions,e.service.eventMessage.connect(((e,t)=>{"initialized"===t.event&&this._build()}),this),this._build(),this.addClass("jp-PauseOnExceptions-menu")}_build(){var e,t;this.clearItems(),(null!==(t=null===(e=this._service.session)||void 0===e?void 0:e.exceptionBreakpointFilters)&&void 0!==t?t:[]).map(((e,t)=>{this.addItem({command:this._command,args:{filter:e.filter,description:e.description}})}))}}class de extends i.PanelWithToolbar{constructor(e){var t;super(e),this.clicked=new f.Signal(this);const{model:s,service:r,commands:n}=e,o=(null!==(t=e.translator)&&void 0!==t?t:v.nullTranslator).load("jupyterlab");this.title.label=o.__("Breakpoints");const a=new se(s);this.toolbar.addItem("pauseOnException",new ae({service:r,commands:n,icon:V,tooltip:o.__("Pause on exception filter")})),this.toolbar.addItem("closeAll",new i.ToolbarButton({icon:I,onClick:async()=>{if(0!==s.breakpoints.size)return(await(0,d.showDialog)({title:o.__("Remove All Breakpoints"),body:o.__("Are you sure you want to remove all breakpoints?"),buttons:[d.Dialog.okButton({label:o.__("Remove breakpoints")}),d.Dialog.cancelButton()],hasClose:!0})).button.accept?r.clearBreakpoints():void 0},tooltip:o.__("Remove All Breakpoints")})),this.addWidget(a),this.addClass("jp-DebuggerBreakpoints")}}class ce extends i.ReactWidget{constructor(e){super(),this._model=e,this.addClass("jp-DebuggerCallstack-body")}render(){return te().createElement(he,{model:this._model})}}const he=({model:e})=>{const[t,s]=(0,ee.useState)(e.frames),[i,r]=(0,ee.useState)(e.frame);return(0,ee.useEffect)((()=>{const t=()=>{r(e.frame),s(e.frames)};return e.framesChanged.connect(t),()=>{e.framesChanged.disconnect(t)}}),[e]),te().createElement("ul",null,t.map((t=>{var s;return te().createElement("li",{key:t.id,onClick:()=>{return r(s=t),void(e.frame=s);var s},className:(null==i?void 0:i.id)===t.id?"selected jp-DebuggerCallstackFrame":"jp-DebuggerCallstackFrame"},te().createElement("span",{className:"jp-DebuggerCallstackFrame-name"},t.name),te().createElement("span",{className:"jp-DebuggerCallstackFrame-location",title:null===(s=t.source)||void 0===s?void 0:s.path},(e=>{var t;const s=(null===(t=e.source)||void 0===t?void 0:t.path)||"",i=w.PathExt.basename(w.PathExt.dirname(s)),r=w.PathExt.basename(s);return`${w.PathExt.join(i,r)}:${e.line}`})(t)))})))};class ue extends i.PanelWithToolbar{constructor(e){var t;super(e);const{commands:s,model:r}=e,n=(null!==(t=e.translator)&&void 0!==t?t:v.nullTranslator).load("jupyterlab");this.title.label=n.__("Callstack");const o=new ce(r);this.toolbar.addItem("continue",new i.CommandToolbarButton({commands:s.registry,id:s.continue,label:""})),this.toolbar.addItem("terminate",new i.CommandToolbarButton({commands:s.registry,id:s.terminate,label:""})),this.toolbar.addItem("step-over",new i.CommandToolbarButton({commands:s.registry,id:s.next,label:""})),this.toolbar.addItem("step-in",new i.CommandToolbarButton({commands:s.registry,id:s.stepIn,label:""})),this.toolbar.addItem("step-out",new i.CommandToolbarButton({commands:s.registry,id:s.stepOut,label:""})),this.toolbar.addItem("evaluate",new i.CommandToolbarButton({commands:s.registry,id:s.evaluate,label:""})),this.addWidget(o),this.addClass("jp-DebuggerCallstack")}}const pe=({model:e})=>te().createElement(i.UseSignal,{signal:e.currentSourceChanged,initialSender:e},(e=>{var t,s;return te().createElement("span",{onClick:()=>null==e?void 0:e.open(),className:"jp-DebuggerSources-header-path"},null!==(s=null===(t=null==e?void 0:e.currentSource)||void 0===t?void 0:t.path)&&void 0!==s?s:"")}));class ge extends h.Widget{constructor(e){super(),this._model=e.model,this._debuggerService=e.service,this._mimeTypeService=e.editorServices.mimeTypeService;const t=new He.ReadOnlyEditorFactory({editorServices:e.editorServices});this._editor=t.createNewEditor({content:"",mimeType:"",path:""}),this._editor.hide(),this._model.currentFrameChanged.connect((async(e,t)=>{t?this._showSource(t):this._clearEditor()}));const s=new h.PanelLayout;s.addWidget(this._editor),this.layout=s,this.addClass("jp-DebuggerSources-body")}dispose(){var e;this.isDisposed||(null===(e=this._editorHandler)||void 0===e||e.dispose(),f.Signal.clearData(this),super.dispose())}_clearEditor(){this._model.currentSource=null,this._editor.hide()}async _showSource(e){var t;const s=null===(t=e.source)||void 0===t?void 0:t.path,i=await this._debuggerService.getSource({sourceReference:0,path:s});if(!(null==i?void 0:i.content))return void this._clearEditor();this._editorHandler&&this._editorHandler.dispose();const{content:r,mimeType:n}=i,o=n||this._mimeTypeService.getMimeTypeByFilePath(null!=s?s:"");this._editor.model.sharedModel.setSource(r),this._editor.model.mimeType=o,this._editorHandler=new C({debuggerService:this._debuggerService,editorReady:()=>Promise.resolve(this._editor.editor),getEditor:()=>this._editor.editor,path:s,src:this._editor.model.sharedModel}),this._model.currentSource={content:r,mimeType:o,path:null!=s?s:""},requestAnimationFrame((()=>{C.showCurrentLine(this._editor.editor,e.line)})),this._editor.show()}}class _e extends i.PanelWithToolbar{constructor(e){var t;super();const{model:s,service:r,editorServices:n}=e,o=(null!==(t=e.translator)&&void 0!==t?t:v.nullTranslator).load("jupyterlab");this.title.label=o.__("Source"),this.toolbar.addClass("jp-DebuggerSources-header");const a=new ge({service:r,model:s,editorServices:n});this.toolbar.addItem("open",new i.ToolbarButton({icon:L,onClick:()=>s.open(),tooltip:o.__("Open in the Main Area")}));const l=i.ReactWidget.create(te().createElement(pe,{model:s}));this.toolbar.addItem("sourcePath",l),this.addClass("jp-DebuggerSources-header"),this.addWidget(a),this.addClass("jp-DebuggerSources")}}var me=s(31884);const ve=e=>te().createElement(me.o,{onChange:t=>{const s=t.target.value;e.model.filter=s},placeholder:e.trans.__("Filter the kernel sources"),value:e.model.filter}),be=e=>te().createElement(i.UseSignal,{signal:e.model.filterChanged,initialArgs:e.model.filter},(t=>te().createElement(ve,{model:e.model,trans:e.trans})));class fe extends i.ReactWidget{constructor(e){var t;super(),this._showFilter=!1,this._model=e.model,this._debuggerService=e.service,this._trans=(null!==(t=e.translator)&&void 0!==t?t:v.nullTranslator).load("jupyterlab"),this.addClass("jp-DebuggerKernelSources-body")}render(){let e="jp-DebuggerKernelSource-filterBox";return this._showFilter||(e+=" jp-DebuggerKernelSource-filterBox-hidden"),te().createElement(te().Fragment,null,te().createElement("div",{className:e,key:"filter"},te().createElement(be,{model:this._model,trans:this._trans})),te().createElement(i.UseSignal,{signal:this._model.changed},((e,t)=>{const s={};return(null!=t?t:[]).map((e=>{var t;const r=e.name,n=e.path,o=r+(s[r]=(null!==(t=s[r])&&void 0!==t?t:0)+1).toString();return te().createElement("div",{key:o,title:n,className:"jp-DebuggerKernelSource-source",onClick:()=>{this._debuggerService.getSource({sourceReference:0,path:n}).then((e=>{this._model.open(e)})).catch((e=>{(0,d.showErrorMessage)(this._trans.__("Fail to get source"),this._trans.__("Fail to get '%1' source:\n%2",n,e))}))}},te().createElement(i.LabIcon.resolveReact,{icon:P,iconClass:(0,i.classes)("jp-Icon"),tag:null}),r)}))})))}toggleFilterbox(){this._showFilter=!this._showFilter,this.update()}}class we extends i.PanelWithToolbar{constructor(e){var t;super();const{model:s,service:r}=e;this._model=s;const n=(null!==(t=e.translator)&&void 0!==t?t:v.nullTranslator).load("jupyterlab");this.title.label=n.__("Kernel Sources"),this.toolbar.addClass("jp-DebuggerKernelSources-header"),this._body=new fe({service:r,model:s,translator:e.translator}),this.toolbar.addItem("open-filter",new i.ToolbarButton({icon:i.searchIcon,onClick:async()=>{this._body.toggleFilterbox()},tooltip:n.__("Toggle search filter")})),this.toolbar.addItem("refresh",new i.ToolbarButton({icon:i.refreshIcon,onClick:()=>{this._model.kernelSources=[],r.displayModules().catch((e=>{(0,d.showErrorMessage)(n.__("Fail to get kernel sources"),n.__("Fail to get kernel sources:\n%2",e))}))},tooltip:n.__("Refresh kernel sources")})),this.addClass("jp-DebuggerKernelSources-header"),this.addWidget(this._body),this.addClass("jp-DebuggerKenelSources")}set filter(e){this._model.filter=e}}const ke=({model:e,tree:t,grid:s,trans:r})=>{const[n,o]=(0,ee.useState)("-"),a=e.scopes;return te().createElement(i.HTMLSelect,{onChange:e=>{const i=e.target.value;o(i),t.scope=i,s.scope=i},value:n,"aria-label":r.__("Scope")},a.map((e=>te().createElement("option",{key:e.name,value:e.name},r.__(e.name)))))};class Se extends i.ReactWidget{constructor(e){super();const{translator:t,model:s,tree:i,grid:r}=e;this._model=s,this._tree=i,this._grid=r,this._trans=(t||v.nullTranslator).load("jupyterlab")}render(){return te().createElement(i.UseSignal,{signal:this._model.changed,initialSender:this._model},(()=>te().createElement(ke,{model:this._model,trans:this._trans,tree:this._tree,grid:this._grid})))}}var Ce=s(33625);const ye="jp-DebuggerVariables-buttons";class Ee extends i.ReactWidget{constructor(e){super(),this._scope="",this._scopes=[],this._filter=new Set,this._commands=e.commands,this._service=e.service,this._translator=e.translator,this._hoverChanged=new f.Signal(this),(this.model=e.model).changed.connect(this._updateScopes,this),this.addClass("jp-DebuggerVariables-body")}render(){var e;const t=null!==(e=this._scopes.find((e=>e.name===this._scope)))&&void 0!==e?e:this._scopes[0],s=e=>{this.model.selectedVariable=e},r=te().createElement(i.caretDownEmptyIcon.react,{stylesheet:"menuItem",tag:"span"});return"Globals"!==(null==t?void 0:t.name)?this.addClass("jp-debuggerVariables-local"):this.removeClass("jp-debuggerVariables-local"),t?te().createElement(te().Fragment,null,te().createElement(Me,{key:t.name,commands:this._commands,service:this._service,data:t.variables,filter:this._filter,translator:this._translator,handleSelectVariable:s,onHoverChanged:e=>{this._hoverChanged.emit(e)},collapserIcon:r}),te().createElement(xe,{commands:this._commands,service:this._service,hoverChanged:this._hoverChanged,handleSelectVariable:s})):te().createElement("div",null)}set filter(e){this._filter=e,this.update()}set scope(e){this._scope=e,this.update()}_updateScopes(e){Ce.ArrayExt.shallowEqual(this._scopes,e.scopes)||(this._scopes=e.scopes,this.update())}}const xe=e=>{var t;const{commands:s,service:r,translator:n,handleSelectVariable:o}=e,a=(null!=n?n:v.nullTranslator).load("jupyterlab"),[l,d]=(0,ee.useState)(0),[c,h]=(0,ee.useState)(null);let u=0;const p=(0,ee.useCallback)(((e,t)=>{const s=++u;if(t.variable)h(t.variable),requestAnimationFrame((()=>{s===u&&t.target&&d(t.target.offsetTop)}));else{if(s!==u)return;const e=t.target;if(e&&e instanceof Element&&e.closest(`.${ye}`))return;h(null)}}),[]);return(0,ee.useEffect)((()=>(e.hoverChanged.connect(p),()=>{e.hoverChanged.disconnect(p)})),[p]),te().createElement("div",{className:ye,style:{transform:`translateY(${l}px)`,opacity:!c||["special variables","protected variables","function variables","class variables"].includes(c.name)?0:1}},te().createElement("button",{className:"jp-DebuggerVariables-renderVariable",disabled:!c||!r.model.hasRichVariableRendering||!s.isEnabled(He.CommandIDs.renderMimeVariable,{name:c.name,frameID:null===(t=r.model.callstack.frame)||void 0===t?void 0:t.id}),onClick:e=>{var t;c&&o&&(e.stopPropagation(),o(c),s.execute(He.CommandIDs.renderMimeVariable,{name:c.name,frameID:null===(t=r.model.callstack.frame)||void 0===t?void 0:t.id}).catch((e=>{console.error(`Failed to render variable ${null==c?void 0:c.name}`,e)})))},title:a.__("Render variable: %1",null==c?void 0:c.name)},te().createElement(i.searchIcon.react,{stylesheet:"menuItem",tag:"span"})))},Me=e=>{const{commands:t,data:s,service:i,filter:r,translator:n,handleSelectVariable:o,onHoverChanged:a,collapserIcon:l}=e,[d,c]=(0,ee.useState)(s);return(0,ee.useEffect)((()=>{c(s)}),[s]),te().createElement("ul",{className:"jp-DebuggerVariables-branch"},d.filter((e=>!(r||new Set).has(e.evaluateName||""))).map((e=>{const s=`${e.name}-${e.evaluateName}-${e.type}-${e.value}-${e.variablesReference}`;return te().createElement(De,{key:s,commands:t,data:e,service:i,filter:r,translator:n,onSelect:o,onHoverChanged:a,collapserIcon:l})})))},De=e=>{const{commands:t,data:s,service:i,filter:r,translator:n,onSelect:o,onHoverChanged:a,collapserIcon:l}=e,[d]=(0,ee.useState)(s),[c,h]=(0,ee.useState)(),[u,p]=(0,ee.useState)(),g=null!=o?o:()=>{},_=0!==d.variablesReference||"function"===d.type;return te().createElement("li",{onClick:e=>(async e=>{if(!_)return;e.stopPropagation();const t=await i.inspectVariable(d.variablesReference);h(!c),p(t)})(e),onMouseDown:e=>{e.stopPropagation(),g(d)},onMouseOver:e=>{a&&(a({target:e.currentTarget,variable:d}),e.stopPropagation())},onMouseLeave:e=>{a&&(a({target:e.relatedTarget,variable:null}),e.stopPropagation())}},te().createElement("span",{className:"jp-DebuggerVariables-collapser"+(c?" jp-mod-expanded":"")},_?te().cloneElement(l):null),te().createElement("span",{className:"jp-DebuggerVariables-name"},d.name),te().createElement("span",{className:"jp-DebuggerVariables-detail"},function(e){if("float"===e.type&&("inf"==e.value||"-inf"==e.value))return e.value;const t=Ie(e);return"float"===e.type&&isNaN(t)?"NaN":t}(d)),c&&u&&te().createElement(Me,{key:d.name,commands:t,data:u,service:i,filter:r,translator:n,handleSelectVariable:o,onHoverChanged:a,collapserIcon:l}))};class Te extends i.PanelWithToolbar{constructor(e){super(e);const{model:t,service:s,commands:r,themeManager:n}=e,o=e.translator||v.nullTranslator,a=o.load("jupyterlab");this.title.label=a.__("Variables"),this.toolbar.addClass("jp-DebuggerVariables-toolbar"),this._tree=new Ee({model:t,service:s,commands:r,translator:o}),this._table=new $({model:t,commands:r,themeManager:n,translator:o}),this._table.hide(),this.toolbar.addItem("scope-switcher",new Se({translator:o,model:t,tree:this._tree,grid:this._table}));const l=()=>{this._table.isHidden?(this._tree.hide(),this._table.show(),this.node.setAttribute("data-jp-table","true"),h("table")):(this._tree.show(),this._table.hide(),this.node.removeAttribute("data-jp-table"),h("tree")),this.update()},d=new i.ToolbarButton({icon:i.treeViewIcon,className:"jp-TreeView",onClick:l,tooltip:a.__("Tree View")}),c=new i.ToolbarButton({icon:i.tableRowsIcon,className:"jp-TableView",onClick:l,tooltip:a.__("Table View")}),h=e=>{c.pressed="tree"!==e,d.pressed=!c.pressed};h(this._table.isHidden?"tree":"table"),this.toolbar.addItem("view-VariableTreeView",d),this.toolbar.addItem("view-VariableTableView",c),this.addWidget(this._tree),this.addWidget(this._table),this.addClass("jp-DebuggerVariables")}set filter(e){this._tree.filter=e,this._table.filter=e}onResize(e){super.onResize(e),this._resizeBody(e)}_resizeBody(e){const t=e.height-this.toolbar.node.offsetHeight;this._tree.node.style.height=`${t}px`}}const Ie=e=>{var t,s;const{type:i,value:r}=e;switch(i){case"int":return parseInt(r,10);case"float":return parseFloat(r);case"bool":return r;case"str":return(null===(s=null===(t=e.presentationHint)||void 0===t?void 0:t.attributes)||void 0===s?void 0:s.includes("rawString"))?r.slice(1,r.length-1):r;default:return null!=i?i:r}};class Ve extends i.SidePanel{constructor(e){const t=e.translator||v.nullTranslator;super({translator:t}),this.id="jp-debugger-sidebar",this.title.icon=i.bugIcon,this.addClass("jp-DebuggerSidebar");const{callstackCommands:s,breakpointsCommands:r,editorServices:n,service:o,themeManager:a}=e,l=o.model;this.variables=new Te({model:l.variables,commands:s.registry,service:o,themeManager:a,translator:t}),this.callstack=new ue({commands:s,model:l.callstack,translator:t}),this.breakpoints=new de({service:o,commands:r,model:l.breakpoints,translator:t}),this.sources=new _e({model:l.sources,service:o,editorServices:n,translator:t}),this.kernelSources=new we({model:l.kernelSources,service:o,translator:t});const d=new Ve.Header;this.header.addWidget(d),l.titleChanged.connect(((e,t)=>{d.title.label=t})),this.content.addClass("jp-DebuggerSidebar-body"),this.addWidget(this.variables),this.addWidget(this.callstack),this.addWidget(this.breakpoints),this.addWidget(this.sources),this.addWidget(this.kernelSources)}}var Be,He;!function(e){class t extends h.Widget{constructor(){super({node:Be.createHeader()}),this.title.changed.connect((e=>{this.node.textContent=this.title.label}))}}e.Header=t}(Ve||(Ve={})),function(e){e.createHeader=function(){const e=document.createElement("h2");return e.textContent="-",e.classList.add("jp-text-truncated"),e}}(Be||(Be={}));class Re{constructor(e){var t,s,i;this._config=e.config,this._shell=e.shell,this._notebookTracker=null!==(t=e.notebookTracker)&&void 0!==t?t:null,this._consoleTracker=null!==(s=e.consoleTracker)&&void 0!==s?s:null,this._editorTracker=null!==(i=e.editorTracker)&&void 0!==i?i:null,this._readOnlyEditorTracker=new d.WidgetTracker({namespace:"@jupyterlab/debugger"})}find(e){return[...this._findInConsoles(e),...this._findInEditors(e),...this._findInNotebooks(e),...this._findInReadOnlyEditors(e)]}open(e){const{editorWrapper:t,label:s,caption:r}=e,n=new d.MainAreaWidget({content:t});n.id=d.DOMUtils.createDomID(),n.title.label=s,n.title.closable=!0,n.title.caption=r,n.title.icon=i.textEditorIcon,this._shell.add(n,"main",{type:"Debugger Sources"}),this._readOnlyEditorTracker.add(n)}_findInNotebooks(e){if(!this._notebookTracker)return[];const{focus:t,kernel:s,path:i,source:r}=e,n=[];return this._notebookTracker.forEach((e=>{const o=e.sessionContext;if(i!==o.path)return;const a=e.content;t&&(a.mode="command"),e.content.widgets.forEach(((i,o)=>{const l=i.model.sharedModel.getSource(),d=this._getCodeId(l,s);d&&r===d&&(t&&(a.activeCellIndex=o,a.activeCell&&a.scrollToItem(a.activeCellIndex,"smart").catch((e=>{})),this._shell.activateById(e.id)),n.push(Object.freeze({get:()=>i.editor,reveal:()=>a.scrollToItem(o,"smart"),src:i.model.sharedModel})))}))})),n}_findInConsoles(e){if(!this._consoleTracker)return[];const{focus:t,kernel:s,path:i,source:r}=e,n=[];return this._consoleTracker.forEach((e=>{const o=e.sessionContext;if(i!==o.path)return;const a=e.console.cells;for(const i of a){const o=i.model.sharedModel.getSource(),a=this._getCodeId(o,s);if(!a)break;if(r!==a)break;n.push(Object.freeze({get:()=>i.editor,reveal:()=>Promise.resolve(this._shell.activateById(e.id)),src:i.model.sharedModel})),t&&this._shell.activateById(e.id)}})),n}_findInEditors(e){if(!this._editorTracker)return[];const{focus:t,kernel:s,path:i,source:r}=e,n=[];return this._editorTracker.forEach((e=>{const o=e.content;if(i!==o.context.path)return;const a=o.editor;if(!a)return;const l=a.model.sharedModel.getSource(),d=this._getCodeId(l,s);d&&r===d&&(n.push(Object.freeze({get:()=>a,reveal:()=>Promise.resolve(this._shell.activateById(e.id)),src:o.model.sharedModel})),t&&this._shell.activateById(e.id))})),n}_findInReadOnlyEditors(e){const{focus:t,kernel:s,source:i}=e,r=[];return this._readOnlyEditorTracker.forEach((e=>{var n;const o=null===(n=e.content)||void 0===n?void 0:n.editor;if(!o)return;const a=o.model.sharedModel.getSource(),l=this._getCodeId(a,s);l&&(e.title.caption!==i&&i!==l||(r.push(Object.freeze({get:()=>o,reveal:()=>Promise.resolve(this._shell.activateById(e.id)),src:o.model.sharedModel})),t&&this._shell.activateById(e.id)))})),r}_getCodeId(e,t){try{return this._config.getCodeId(e,t)}catch(e){return""}}}!function(e){let t,s,r;e.Config=class extends a{},e.EditorHandler=class extends C{},e.Handler=class extends T{},e.Model=class extends G{},e.ReadOnlyEditorFactory=class extends _{},e.Service=class extends Q{},e.Session=class extends X{},e.Sidebar=class extends Ve{},e.Sources=class extends Re{},e.VariablesGrid=class extends ${},e.VariableRenderer=class extends Y{},function(e){e.debugContinue="debugger:continue",e.terminate="debugger:terminate",e.next="debugger:next",e.showPanel="debugger:show-panel",e.stepIn="debugger:stepIn",e.stepOut="debugger:stepOut",e.inspectVariable="debugger:inspect-variable",e.renderMimeVariable="debugger:render-mime-variable",e.evaluate="debugger:evaluate",e.restartDebug="debugger:restart-debug",e.pauseOnExceptions="debugger:pause-on-exceptions",e.copyToClipboard="debugger:copy-to-clipboard",e.copyToGlobals="debugger:copy-to-globals",e.openSource="debugger:open-source"}(t=e.CommandIDs||(e.CommandIDs={})),function(e){e.closeAllIcon=I,e.evaluateIcon=i.codeIcon,e.continueIcon=i.runIcon,e.pauseIcon=B,e.stepIntoIcon=H,e.stepOutIcon=j,e.stepOverIcon=R,e.terminateIcon=i.stopIcon,e.variableIcon=F,e.viewBreakpointIcon=L,e.pauseOnExceptionsIcon=B}(s=e.Icons||(e.Icons={})),function(e){e.getCode=l.getCode}(r=e.Dialogs||(e.Dialogs={}))}(He||(He={}))},36621:(e,t,s)=>{s.r(t),s.d(t,{Debugger:()=>i.q,IDebugger:()=>n,IDebuggerConfig:()=>o,IDebuggerHandler:()=>d,IDebuggerSidebar:()=>l,IDebuggerSourceViewer:()=>c,IDebuggerSources:()=>a});var i=s(78947),r=s(20998);const n=new r.Token("@jupyterlab/debugger:IDebugger","A debugger user interface."),o=new r.Token("@jupyterlab/debugger:IDebuggerConfig","A service to handle the debugger configuration."),a=new r.Token("@jupyterlab/debugger:IDebuggerSources","A service to display sources in debug mode."),l=new r.Token("@jupyterlab/debugger:IDebuggerSidebar","A service for the debugger sidebar."),d=new r.Token("@jupyterlab/debugger:IDebuggerHandler","A service for handling notebook debugger."),c=new r.Token("@jupyterlab/debugger:IDebuggerSourceViewer","A debugger source viewer.")}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6627],{6627:(e,a,r)=>{r.r(a),r.d(a,{default:()=>d});var t=r(96049),s=r(37267);const d={id:"@jupyterlab/theme-dark-extension:plugin",description:"Adds a dark theme.",requires:[t.IThemeManager,s.ITranslator],activate:(e,a,r)=>{const t=r.load("jupyterlab");a.register({name:"JupyterLab Dark",displayName:t.__("JupyterLab Dark"),isLight:!1,themeScrollbars:!0,load:()=>a.loadCSS("@jupyterlab/theme-dark-extension/index.css"),unload:()=>Promise.resolve(void 0)})},autoStart:!0}}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6627],{6627:(e,a,r)=>{r.r(a),r.d(a,{default:()=>d});var t=r(53312),s=r(12030);const d={id:"@jupyterlab/theme-dark-extension:plugin",description:"Adds a dark theme.",requires:[t.IThemeManager,s.ITranslator],activate:(e,a,r)=>{const t=r.load("jupyterlab");a.register({name:"JupyterLab Dark",displayName:t.__("JupyterLab Dark"),isLight:!1,themeScrollbars:!0,load:()=>a.loadCSS("@jupyterlab/theme-dark-extension/index.css"),unload:()=>Promise.resolve(void 0)})},autoStart:!0}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6640],{6640:(t,e,a)=>{a.d(e,{diagram:()=>f});var i=a(75343),n=a(23617),d=a(7259),r=a(29197),s=a(24028);a(27693),a(7608),a(31699);const o={},c=(t,e,a)=>{const i=(0,s.c)().state.padding,n=2*(0,s.c)().state.padding,d=t.node().getBBox(),r=d.width,o=d.x,c=t.append("text").attr("x",0).attr("y",(0,s.c)().state.titleShift).attr("font-size",(0,s.c)().state.fontSize).attr("class","state-title").text(e.id),g=c.node().getBBox().width+n;let p,h=Math.max(g,r);h===r&&(h+=n);const l=t.node().getBBox();e.doc,p=o-i,g>r&&(p=(r-h)/2+i),Math.abs(o-l.x)<i&&g>r&&(p=o-(g-r)/2);const x=1-(0,s.c)().state.textHeight;return t.insert("rect",":first-child").attr("x",p).attr("y",x).attr("class",a?"alt-composit":"composit").attr("width",h).attr("height",l.height+(0,s.c)().state.textHeight+(0,s.c)().state.titleShift+1).attr("rx","0"),c.attr("x",p+i),g<=r&&c.attr("x",o+(h-n)/2-g/2+i),t.insert("rect",":first-child").attr("x",p).attr("y",(0,s.c)().state.titleShift-(0,s.c)().state.textHeight-(0,s.c)().state.padding).attr("width",h).attr("height",3*(0,s.c)().state.textHeight).attr("rx",(0,s.c)().state.radius),t.insert("rect",":first-child").attr("x",p).attr("y",(0,s.c)().state.titleShift-(0,s.c)().state.textHeight-(0,s.c)().state.padding).attr("width",h).attr("height",l.height+3+2*(0,s.c)().state.textHeight).attr("rx",(0,s.c)().state.radius),t},g=function(t,e){const a=e.id,i={id:a,label:e.id,width:0,height:0},n=t.append("g").attr("id",a).attr("class","stateGroup");"start"===e.type&&(t=>{t.append("circle").attr("class","start-state").attr("r",(0,s.c)().state.sizeUnit).attr("cx",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit).attr("cy",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit)})(n),"end"===e.type&&(t=>{t.append("circle").attr("class","end-state-outer").attr("r",(0,s.c)().state.sizeUnit+(0,s.c)().state.miniPadding).attr("cx",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit+(0,s.c)().state.miniPadding).attr("cy",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit+(0,s.c)().state.miniPadding),t.append("circle").attr("class","end-state-inner").attr("r",(0,s.c)().state.sizeUnit).attr("cx",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit+2).attr("cy",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit+2)})(n),"fork"!==e.type&&"join"!==e.type||((t,e)=>{let a=(0,s.c)().state.forkWidth,i=(0,s.c)().state.forkHeight;if(e.parentId){let t=a;a=i,i=t}t.append("rect").style("stroke","black").style("fill","black").attr("width",a).attr("height",i).attr("x",(0,s.c)().state.padding).attr("y",(0,s.c)().state.padding)})(n,e),"note"===e.type&&((t,e)=>{e.attr("class","state-note");const a=e.append("rect").attr("x",0).attr("y",(0,s.c)().state.padding),i=e.append("g"),{textWidth:n,textHeight:d}=((t,e,a,i)=>{let n=0;const d=i.append("text");d.style("text-anchor","start"),d.attr("class","noteText");let r=t.replace(/\r\n/g,"<br/>");r=r.replace(/\n/g,"<br/>");const o=r.split(s.e.lineBreakRegex);let c=1.25*(0,s.c)().state.noteMargin;for(const t of o){const e=t.trim();if(e.length>0){const t=d.append("tspan");t.text(e),0===c&&(c+=t.node().getBBox().height),n+=c,t.attr("x",0+(0,s.c)().state.noteMargin),t.attr("y",0+n+1.25*(0,s.c)().state.noteMargin)}}return{textWidth:d.node().getBBox().width,textHeight:n}})(t,0,0,i);a.attr("height",d+2*(0,s.c)().state.noteMargin),a.attr("width",n+2*(0,s.c)().state.noteMargin)})(e.note.text,n),"divider"===e.type&&(t=>{t.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",(0,s.c)().state.textHeight).attr("class","divider").attr("x2",2*(0,s.c)().state.textHeight).attr("y1",0).attr("y2",0)})(n),"default"===e.type&&0===e.descriptions.length&&((t,e)=>{const a=t.append("text").attr("x",2*(0,s.c)().state.padding).attr("y",(0,s.c)().state.textHeight+2*(0,s.c)().state.padding).attr("font-size",(0,s.c)().state.fontSize).attr("class","state-title").text(e.id).node().getBBox();t.insert("rect",":first-child").attr("x",(0,s.c)().state.padding).attr("y",(0,s.c)().state.padding).attr("width",a.width+2*(0,s.c)().state.padding).attr("height",a.height+2*(0,s.c)().state.padding).attr("rx",(0,s.c)().state.radius)})(n,e),"default"===e.type&&e.descriptions.length>0&&((t,e)=>{const a=t.append("text").attr("x",2*(0,s.c)().state.padding).attr("y",(0,s.c)().state.textHeight+1.3*(0,s.c)().state.padding).attr("font-size",(0,s.c)().state.fontSize).attr("class","state-title").text(e.descriptions[0]).node().getBBox(),i=a.height,n=t.append("text").attr("x",(0,s.c)().state.padding).attr("y",i+.4*(0,s.c)().state.padding+(0,s.c)().state.dividerMargin+(0,s.c)().state.textHeight).attr("class","state-description");let d=!0,r=!0;e.descriptions.forEach((function(t){d||(function(t,e,a){const i=t.append("tspan").attr("x",2*(0,s.c)().state.padding).text(e);a||i.attr("dy",(0,s.c)().state.textHeight)}(n,t,r),r=!1),d=!1}));const o=t.append("line").attr("x1",(0,s.c)().state.padding).attr("y1",(0,s.c)().state.padding+i+(0,s.c)().state.dividerMargin/2).attr("y2",(0,s.c)().state.padding+i+(0,s.c)().state.dividerMargin/2).attr("class","descr-divider"),c=n.node().getBBox(),g=Math.max(c.width,a.width);o.attr("x2",g+3*(0,s.c)().state.padding),t.insert("rect",":first-child").attr("x",(0,s.c)().state.padding).attr("y",(0,s.c)().state.padding).attr("width",g+2*(0,s.c)().state.padding).attr("height",c.height+i+2*(0,s.c)().state.padding).attr("rx",(0,s.c)().state.radius)})(n,e);const d=n.node().getBBox();return i.width=d.width+2*(0,s.c)().state.padding,i.height=d.height+2*(0,s.c)().state.padding,r=i,o[a]=r,i;var r};let p,h=0;const l={},x=(t,e,a,o,u,f,y)=>{const w=new r.k({compound:!0,multigraph:!0});let b,B=!0;for(b=0;b<t.length;b++)if("relation"===t[b].stmt){B=!1;break}a?w.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:B?1:p.edgeLengthFactor,nodeSep:B?1:50,isMultiGraph:!0}):w.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:B?1:p.edgeLengthFactor,nodeSep:B?1:50,ranker:"tight-tree",isMultiGraph:!0}),w.setDefaultEdgeLabel((function(){return{}})),y.db.extract(t);const m=y.db.getStates(),k=y.db.getRelations(),E=Object.keys(m);for(const t of E){const i=m[t];let n;if(a&&(i.parentId=a),i.doc){let t=e.append("g").attr("id",i.id).attr("class","stateGroup");n=x(i.doc,t,i.id,!o,u,f,y);{t=c(t,i,o);let e=t.node().getBBox();n.width=e.width,n.height=e.height+p.padding/2,l[i.id]={y:p.compositTitleSize}}}else n=g(e,i);if(i.note){const t={descriptions:[],id:i.id+"-note",note:i.note,type:"note"},a=g(e,t);"left of"===i.note.position?(w.setNode(n.id+"-note",a),w.setNode(n.id,n)):(w.setNode(n.id,n),w.setNode(n.id+"-note",a)),w.setParent(n.id,n.id+"-group"),w.setParent(n.id+"-note",n.id+"-group")}else w.setNode(n.id,n)}s.l.debug("Count=",w.nodeCount(),w);let N=0;k.forEach((function(t){var e;N++,s.l.debug("Setting edge",t),w.setEdge(t.id1,t.id2,{relation:t,width:(e=t.title,e?e.length*p.fontSizeFactor:1),height:p.labelHeight*s.e.getRows(t.title).length,labelpos:"c"},"id"+N)})),(0,d.bK)(w),s.l.debug("Graph after layout",w.nodes());const v=e.node();w.nodes().forEach((function(t){void 0!==t&&void 0!==w.node(t)?(s.l.warn("Node "+t+": "+JSON.stringify(w.node(t))),u.select("#"+v.id+" #"+t).attr("transform","translate("+(w.node(t).x-w.node(t).width/2)+","+(w.node(t).y+(l[t]?l[t].y:0)-w.node(t).height/2)+" )"),u.select("#"+v.id+" #"+t).attr("data-x-shift",w.node(t).x-w.node(t).width/2),f.querySelectorAll("#"+v.id+" #"+t+" .divider").forEach((t=>{const e=t.parentElement;let a=0,i=0;e&&(e.parentElement&&(a=e.parentElement.getBBox().width),i=parseInt(e.getAttribute("data-x-shift"),10),Number.isNaN(i)&&(i=0)),t.setAttribute("x1",0-i+8),t.setAttribute("x2",a-i-8)}))):s.l.debug("No Node "+t+": "+JSON.stringify(w.node(t)))}));let M=v.getBBox();w.edges().forEach((function(t){void 0!==t&&void 0!==w.edge(t)&&(s.l.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(w.edge(t))),function(t,e,a){e.points=e.points.filter((t=>!Number.isNaN(t.y)));const d=e.points,r=(0,n.jvg)().x((function(t){return t.x})).y((function(t){return t.y})).curve(n.$0Z),o=t.append("path").attr("d",r(d)).attr("id","edge"+h).attr("class","transition");let c="";if((0,s.c)().state.arrowMarkerAbsolute&&(c=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,c=c.replace(/\(/g,"\\("),c=c.replace(/\)/g,"\\)")),o.attr("marker-end","url("+c+"#"+function(t){switch(t){case i.d.relationType.AGGREGATION:return"aggregation";case i.d.relationType.EXTENSION:return"extension";case i.d.relationType.COMPOSITION:return"composition";case i.d.relationType.DEPENDENCY:return"dependency"}}(i.d.relationType.DEPENDENCY)+"End)"),void 0!==a.title){const i=t.append("g").attr("class","stateLabel"),{x:n,y:d}=s.u.calcLabelPosition(e.points),r=s.e.getRows(a.title);let o=0;const c=[];let g=0,p=0;for(let t=0;t<=r.length;t++){const e=i.append("text").attr("text-anchor","middle").text(r[t]).attr("x",n).attr("y",d+o),a=e.node().getBBox();if(g=Math.max(g,a.width),p=Math.min(p,a.x),s.l.info(a.x,n,d+o),0===o){const t=e.node().getBBox();o=t.height,s.l.info("Title height",o,d)}c.push(e)}let h=o*r.length;if(r.length>1){const t=(r.length-1)*o*.5;c.forEach(((e,a)=>e.attr("y",d+a*o-t))),h=o*r.length}const l=i.node().getBBox();i.insert("rect",":first-child").attr("class","box").attr("x",n-g/2-(0,s.c)().state.padding/2).attr("y",d-h/2-(0,s.c)().state.padding/2-3.5).attr("width",g+(0,s.c)().state.padding).attr("height",h+(0,s.c)().state.padding),s.l.info(l)}h++}(e,w.edge(t),w.edge(t).relation))})),M=v.getBBox();const S={id:a||"root",label:a||"root",width:0,height:0};return S.width=M.width+2*p.padding,S.height=M.height+2*p.padding,s.l.debug("Doc rendered",S,w),S},u={setConf:function(){},draw:function(t,e,a,i){p=(0,s.c)().state;const d=(0,s.c)().securityLevel;let r;"sandbox"===d&&(r=(0,n.Ys)("#i"+e));const o="sandbox"===d?(0,n.Ys)(r.nodes()[0].contentDocument.body):(0,n.Ys)("body"),c="sandbox"===d?r.nodes()[0].contentDocument:document;s.l.debug("Rendering diagram "+t);const g=o.select(`[id='${e}']`);g.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z");const h=i.db.getRootDoc();x(h,g,void 0,!1,o,c,i);const l=p.padding,u=g.node().getBBox(),f=u.width+2*l,y=u.height+2*l,w=1.75*f;(0,s.i)(g,y,w,p.useMaxWidth),g.attr("viewBox",`${u.x-p.padding} ${u.y-p.padding} `+f+" "+y)}},f={parser:i.p,db:i.d,renderer:u,styles:i.s,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,i.d.clear()}}}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6640],{6640:(t,e,a)=>{a.d(e,{diagram:()=>f});var i=a(75343),n=a(23617),d=a(7259),r=a(67406),s=a(24028);a(27693),a(7608),a(31699);const o={},c=(t,e,a)=>{const i=(0,s.c)().state.padding,n=2*(0,s.c)().state.padding,d=t.node().getBBox(),r=d.width,o=d.x,c=t.append("text").attr("x",0).attr("y",(0,s.c)().state.titleShift).attr("font-size",(0,s.c)().state.fontSize).attr("class","state-title").text(e.id),g=c.node().getBBox().width+n;let p,h=Math.max(g,r);h===r&&(h+=n);const l=t.node().getBBox();e.doc,p=o-i,g>r&&(p=(r-h)/2+i),Math.abs(o-l.x)<i&&g>r&&(p=o-(g-r)/2);const x=1-(0,s.c)().state.textHeight;return t.insert("rect",":first-child").attr("x",p).attr("y",x).attr("class",a?"alt-composit":"composit").attr("width",h).attr("height",l.height+(0,s.c)().state.textHeight+(0,s.c)().state.titleShift+1).attr("rx","0"),c.attr("x",p+i),g<=r&&c.attr("x",o+(h-n)/2-g/2+i),t.insert("rect",":first-child").attr("x",p).attr("y",(0,s.c)().state.titleShift-(0,s.c)().state.textHeight-(0,s.c)().state.padding).attr("width",h).attr("height",3*(0,s.c)().state.textHeight).attr("rx",(0,s.c)().state.radius),t.insert("rect",":first-child").attr("x",p).attr("y",(0,s.c)().state.titleShift-(0,s.c)().state.textHeight-(0,s.c)().state.padding).attr("width",h).attr("height",l.height+3+2*(0,s.c)().state.textHeight).attr("rx",(0,s.c)().state.radius),t},g=function(t,e){const a=e.id,i={id:a,label:e.id,width:0,height:0},n=t.append("g").attr("id",a).attr("class","stateGroup");"start"===e.type&&(t=>{t.append("circle").attr("class","start-state").attr("r",(0,s.c)().state.sizeUnit).attr("cx",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit).attr("cy",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit)})(n),"end"===e.type&&(t=>{t.append("circle").attr("class","end-state-outer").attr("r",(0,s.c)().state.sizeUnit+(0,s.c)().state.miniPadding).attr("cx",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit+(0,s.c)().state.miniPadding).attr("cy",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit+(0,s.c)().state.miniPadding),t.append("circle").attr("class","end-state-inner").attr("r",(0,s.c)().state.sizeUnit).attr("cx",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit+2).attr("cy",(0,s.c)().state.padding+(0,s.c)().state.sizeUnit+2)})(n),"fork"!==e.type&&"join"!==e.type||((t,e)=>{let a=(0,s.c)().state.forkWidth,i=(0,s.c)().state.forkHeight;if(e.parentId){let t=a;a=i,i=t}t.append("rect").style("stroke","black").style("fill","black").attr("width",a).attr("height",i).attr("x",(0,s.c)().state.padding).attr("y",(0,s.c)().state.padding)})(n,e),"note"===e.type&&((t,e)=>{e.attr("class","state-note");const a=e.append("rect").attr("x",0).attr("y",(0,s.c)().state.padding),i=e.append("g"),{textWidth:n,textHeight:d}=((t,e,a,i)=>{let n=0;const d=i.append("text");d.style("text-anchor","start"),d.attr("class","noteText");let r=t.replace(/\r\n/g,"<br/>");r=r.replace(/\n/g,"<br/>");const o=r.split(s.e.lineBreakRegex);let c=1.25*(0,s.c)().state.noteMargin;for(const t of o){const e=t.trim();if(e.length>0){const t=d.append("tspan");t.text(e),0===c&&(c+=t.node().getBBox().height),n+=c,t.attr("x",0+(0,s.c)().state.noteMargin),t.attr("y",0+n+1.25*(0,s.c)().state.noteMargin)}}return{textWidth:d.node().getBBox().width,textHeight:n}})(t,0,0,i);a.attr("height",d+2*(0,s.c)().state.noteMargin),a.attr("width",n+2*(0,s.c)().state.noteMargin)})(e.note.text,n),"divider"===e.type&&(t=>{t.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",(0,s.c)().state.textHeight).attr("class","divider").attr("x2",2*(0,s.c)().state.textHeight).attr("y1",0).attr("y2",0)})(n),"default"===e.type&&0===e.descriptions.length&&((t,e)=>{const a=t.append("text").attr("x",2*(0,s.c)().state.padding).attr("y",(0,s.c)().state.textHeight+2*(0,s.c)().state.padding).attr("font-size",(0,s.c)().state.fontSize).attr("class","state-title").text(e.id).node().getBBox();t.insert("rect",":first-child").attr("x",(0,s.c)().state.padding).attr("y",(0,s.c)().state.padding).attr("width",a.width+2*(0,s.c)().state.padding).attr("height",a.height+2*(0,s.c)().state.padding).attr("rx",(0,s.c)().state.radius)})(n,e),"default"===e.type&&e.descriptions.length>0&&((t,e)=>{const a=t.append("text").attr("x",2*(0,s.c)().state.padding).attr("y",(0,s.c)().state.textHeight+1.3*(0,s.c)().state.padding).attr("font-size",(0,s.c)().state.fontSize).attr("class","state-title").text(e.descriptions[0]).node().getBBox(),i=a.height,n=t.append("text").attr("x",(0,s.c)().state.padding).attr("y",i+.4*(0,s.c)().state.padding+(0,s.c)().state.dividerMargin+(0,s.c)().state.textHeight).attr("class","state-description");let d=!0,r=!0;e.descriptions.forEach((function(t){d||(function(t,e,a){const i=t.append("tspan").attr("x",2*(0,s.c)().state.padding).text(e);a||i.attr("dy",(0,s.c)().state.textHeight)}(n,t,r),r=!1),d=!1}));const o=t.append("line").attr("x1",(0,s.c)().state.padding).attr("y1",(0,s.c)().state.padding+i+(0,s.c)().state.dividerMargin/2).attr("y2",(0,s.c)().state.padding+i+(0,s.c)().state.dividerMargin/2).attr("class","descr-divider"),c=n.node().getBBox(),g=Math.max(c.width,a.width);o.attr("x2",g+3*(0,s.c)().state.padding),t.insert("rect",":first-child").attr("x",(0,s.c)().state.padding).attr("y",(0,s.c)().state.padding).attr("width",g+2*(0,s.c)().state.padding).attr("height",c.height+i+2*(0,s.c)().state.padding).attr("rx",(0,s.c)().state.radius)})(n,e);const d=n.node().getBBox();return i.width=d.width+2*(0,s.c)().state.padding,i.height=d.height+2*(0,s.c)().state.padding,r=i,o[a]=r,i;var r};let p,h=0;const l={},x=(t,e,a,o,u,f,y)=>{const w=new r.k({compound:!0,multigraph:!0});let b,B=!0;for(b=0;b<t.length;b++)if("relation"===t[b].stmt){B=!1;break}a?w.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:B?1:p.edgeLengthFactor,nodeSep:B?1:50,isMultiGraph:!0}):w.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:B?1:p.edgeLengthFactor,nodeSep:B?1:50,ranker:"tight-tree",isMultiGraph:!0}),w.setDefaultEdgeLabel((function(){return{}})),y.db.extract(t);const m=y.db.getStates(),k=y.db.getRelations(),E=Object.keys(m);for(const t of E){const i=m[t];let n;if(a&&(i.parentId=a),i.doc){let t=e.append("g").attr("id",i.id).attr("class","stateGroup");n=x(i.doc,t,i.id,!o,u,f,y);{t=c(t,i,o);let e=t.node().getBBox();n.width=e.width,n.height=e.height+p.padding/2,l[i.id]={y:p.compositTitleSize}}}else n=g(e,i);if(i.note){const t={descriptions:[],id:i.id+"-note",note:i.note,type:"note"},a=g(e,t);"left of"===i.note.position?(w.setNode(n.id+"-note",a),w.setNode(n.id,n)):(w.setNode(n.id,n),w.setNode(n.id+"-note",a)),w.setParent(n.id,n.id+"-group"),w.setParent(n.id+"-note",n.id+"-group")}else w.setNode(n.id,n)}s.l.debug("Count=",w.nodeCount(),w);let N=0;k.forEach((function(t){var e;N++,s.l.debug("Setting edge",t),w.setEdge(t.id1,t.id2,{relation:t,width:(e=t.title,e?e.length*p.fontSizeFactor:1),height:p.labelHeight*s.e.getRows(t.title).length,labelpos:"c"},"id"+N)})),(0,d.bK)(w),s.l.debug("Graph after layout",w.nodes());const v=e.node();w.nodes().forEach((function(t){void 0!==t&&void 0!==w.node(t)?(s.l.warn("Node "+t+": "+JSON.stringify(w.node(t))),u.select("#"+v.id+" #"+t).attr("transform","translate("+(w.node(t).x-w.node(t).width/2)+","+(w.node(t).y+(l[t]?l[t].y:0)-w.node(t).height/2)+" )"),u.select("#"+v.id+" #"+t).attr("data-x-shift",w.node(t).x-w.node(t).width/2),f.querySelectorAll("#"+v.id+" #"+t+" .divider").forEach((t=>{const e=t.parentElement;let a=0,i=0;e&&(e.parentElement&&(a=e.parentElement.getBBox().width),i=parseInt(e.getAttribute("data-x-shift"),10),Number.isNaN(i)&&(i=0)),t.setAttribute("x1",0-i+8),t.setAttribute("x2",a-i-8)}))):s.l.debug("No Node "+t+": "+JSON.stringify(w.node(t)))}));let M=v.getBBox();w.edges().forEach((function(t){void 0!==t&&void 0!==w.edge(t)&&(s.l.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(w.edge(t))),function(t,e,a){e.points=e.points.filter((t=>!Number.isNaN(t.y)));const d=e.points,r=(0,n.jvg)().x((function(t){return t.x})).y((function(t){return t.y})).curve(n.$0Z),o=t.append("path").attr("d",r(d)).attr("id","edge"+h).attr("class","transition");let c="";if((0,s.c)().state.arrowMarkerAbsolute&&(c=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,c=c.replace(/\(/g,"\\("),c=c.replace(/\)/g,"\\)")),o.attr("marker-end","url("+c+"#"+function(t){switch(t){case i.d.relationType.AGGREGATION:return"aggregation";case i.d.relationType.EXTENSION:return"extension";case i.d.relationType.COMPOSITION:return"composition";case i.d.relationType.DEPENDENCY:return"dependency"}}(i.d.relationType.DEPENDENCY)+"End)"),void 0!==a.title){const i=t.append("g").attr("class","stateLabel"),{x:n,y:d}=s.u.calcLabelPosition(e.points),r=s.e.getRows(a.title);let o=0;const c=[];let g=0,p=0;for(let t=0;t<=r.length;t++){const e=i.append("text").attr("text-anchor","middle").text(r[t]).attr("x",n).attr("y",d+o),a=e.node().getBBox();if(g=Math.max(g,a.width),p=Math.min(p,a.x),s.l.info(a.x,n,d+o),0===o){const t=e.node().getBBox();o=t.height,s.l.info("Title height",o,d)}c.push(e)}let h=o*r.length;if(r.length>1){const t=(r.length-1)*o*.5;c.forEach(((e,a)=>e.attr("y",d+a*o-t))),h=o*r.length}const l=i.node().getBBox();i.insert("rect",":first-child").attr("class","box").attr("x",n-g/2-(0,s.c)().state.padding/2).attr("y",d-h/2-(0,s.c)().state.padding/2-3.5).attr("width",g+(0,s.c)().state.padding).attr("height",h+(0,s.c)().state.padding),s.l.info(l)}h++}(e,w.edge(t),w.edge(t).relation))})),M=v.getBBox();const S={id:a||"root",label:a||"root",width:0,height:0};return S.width=M.width+2*p.padding,S.height=M.height+2*p.padding,s.l.debug("Doc rendered",S,w),S},u={setConf:function(){},draw:function(t,e,a,i){p=(0,s.c)().state;const d=(0,s.c)().securityLevel;let r;"sandbox"===d&&(r=(0,n.Ys)("#i"+e));const o="sandbox"===d?(0,n.Ys)(r.nodes()[0].contentDocument.body):(0,n.Ys)("body"),c="sandbox"===d?r.nodes()[0].contentDocument:document;s.l.debug("Rendering diagram "+t);const g=o.select(`[id='${e}']`);g.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z");const h=i.db.getRootDoc();x(h,g,void 0,!1,o,c,i);const l=p.padding,u=g.node().getBBox(),f=u.width+2*l,y=u.height+2*l,w=1.75*f;(0,s.i)(g,y,w,p.useMaxWidth),g.attr("viewBox",`${u.x-p.padding} ${u.y-p.padding} `+f+" "+y)}},f={parser:i.p,db:i.d,renderer:u,styles:i.s,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,i.d.clear()}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6748],{86748:(e,n,o)=>{o.r(n),o.d(n,{default:()=>P});var t=o(2922),r=o(96049),l=o(52839),s=o(89144),a=o(80106),c=o(42751),i=o(65651),d=o(50845),u=o(13408),p=o(24554),m=o(37267),C=o(22620),v=o(33625),g=o(20998),h=o(2549),b=o(14421);const f={id:"@jupyterlab/console-extension:foreign",description:"Add foreign handler of IOPub messages to the console.",requires:[a.IConsoleTracker,p.ISettingRegistry,m.ITranslator],optional:[r.ICommandPalette],activate:function(e,n,o,t,r){var l;const s=t.load("jupyterlab"),{shell:c}=e;n.widgetAdded.connect(((e,n)=>{const t=n.console,r=new a.ForeignHandler({sessionContext:t.sessionContext,parent:t});k.foreignHandlerProperty.set(t,r),o.get("@jupyterlab/console-extension:tracker","showAllKernelActivity").then((({composite:e})=>{const n=e;r.enabled=n})),t.disposed.connect((()=>{r.dispose()}))}));const{commands:i}=e,d=s.__("Console"),u="console:toggle-show-all-kernel-activity";i.addCommand(u,{label:e=>s.__("Show All Kernel Activity"),execute:e=>{const o=function(e){const o=n.currentWidget;return!1!==e.activate&&o&&c.activateById(o.id),o}(e);if(!o)return;const t=k.foreignHandlerProperty.get(o.console);t&&(t.enabled=!t.enabled)},isToggled:()=>{var e;return null!==n.currentWidget&&!!(null===(e=k.foreignHandlerProperty.get(n.currentWidget.console))||void 0===e?void 0:e.enabled)},isEnabled:()=>null!==n.currentWidget&&n.currentWidget===c.currentWidget});const p=()=>{i.notifyCommandChanged(u)};n.currentChanged.connect(p),null===(l=c.currentChanged)||void 0===l||l.connect(p),r&&r.addItem({command:u,category:d,args:{isPalette:!0}})},autoStart:!0},y=f;var k;!function(e){e.foreignHandlerProperty=new b.AttachedProperty({name:"foreignHandler",create:()=>{}})}(k||(k={}));const _={id:"@jupyterlab/console-extension:cell-executor",description:"Provides the console cell executor.",autoStart:!0,provides:a.IConsoleCellExecutor,activate:()=>Object.freeze({runCell:a.runCell})};var x;!function(e){e.autoClosingBrackets="console:toggle-autoclosing-brackets",e.create="console:create",e.clear="console:clear",e.runUnforced="console:run-unforced",e.runForced="console:run-forced",e.linebreak="console:linebreak",e.interrupt="console:interrupt-kernel",e.restart="console:restart-kernel",e.closeAndShutdown="console:close-and-shutdown",e.open="console:open",e.inject="console:inject",e.changeKernel="console:change-kernel",e.getKernel="console:get-kernel",e.interactionMode="console:interaction-mode",e.redo="console:redo",e.replaceSelection="console:replace-selection",e.shutdown="console:shutdown",e.undo="console:undo",e.invokeCompleter="completer:invoke-console",e.selectCompleter="completer:select-console"}(x||(x={}));const w={id:"@jupyterlab/console-extension:tracker",description:"Provides the console widget tracker.",provides:a.IConsoleTracker,requires:[a.ConsolePanel.IContentFactory,l.IEditorServices,a.IConsoleCellExecutor,u.IRenderMimeRegistry,p.ISettingRegistry],optional:[t.ILayoutRestorer,c.IDefaultFileBrowser,d.IMainMenu,r.ICommandPalette,i.ILauncher,t.ILabStatus,r.ISessionContextDialogs,C.IFormRendererRegistry,m.ITranslator],activate:async function(e,n,o,t,l,s,c,i,d,u,p,b,f,y,k){var _;const w=null!=k?k:m.nullTranslator,I=w.load("jupyterlab"),E=e.serviceManager,{commands:S,shell:P}=e,M=I.__("Console"),j=null!=f?f:new r.SessionContextDialogs({translator:w}),T=new r.WidgetTracker({namespace:"console"});async function A(e){var r,c;await E.ready;const i=new a.ConsolePanel({manager:E,contentFactory:n,mimeTypeService:o.mimeTypeService,rendermime:l,sessionDialogs:j,executor:t,translator:w,setBusy:null!==(r=b&&(()=>b.setBusy()))&&void 0!==r?r:void 0,...e}),d=(await s.get("@jupyterlab/console-extension:tracker","interactionMode")).composite;return i.console.node.dataset.jpInteractionMode=d,await T.add(i),i.sessionContext.propertyChanged.connect((()=>{T.save(i)})),P.add(i,"main",{ref:e.ref,mode:e.insertMode,activate:!1!==e.activate,type:null!==(c=e.type)&&void 0!==c?c:"Console"}),i}c&&c.restore(T,{command:x.create,args:e=>{const{path:n,name:o,kernelPreference:t}=e.console.sessionContext;return{path:n,name:o,kernelPreference:{...t}}},name:e=>{var n;return null!==(n=e.console.sessionContext.path)&&void 0!==n?n:g.UUID.uuid4()},when:E.ready}),p&&E.ready.then((()=>{let e=null;const n=()=>{e&&(e.dispose(),e=null);const n=E.kernelspecs.specs;if(n){e=new h.DisposableSet;for(const o in n.kernelspecs){const t=o===n.default?0:1/0,r=n.kernelspecs[o],l=r.resources["logo-svg"]||r.resources["logo-64x64"];e.add(p.add({command:x.create,args:{isLauncher:!0,kernelPreference:{name:o}},category:I.__("Console"),rank:t,kernelIconUrl:l,metadata:{kernel:g.JSONExt.deepCopy(r.metadata||{})}}))}}};n(),E.kernelspecs.specsChanged.connect(n)}));const K="@jupyterlab/console-extension:tracker";let R,B={};async function U(e){R=(await s.get(K,"interactionMode")).composite,B=(await s.get(K,"promptCellConfig")).composite;const n=e=>{var n,o;e.console.node.dataset.jpInteractionMode=R,e.console.editorConfig=B,null===(o=null===(n=e.console.promptCell)||void 0===n?void 0:n.editor)||void 0===o||o.setOptions(B)};e?n(e):T.forEach(n)}if(s.pluginChanged.connect(((e,n)=>{n===K&&U()})),await U(),y){const e=y.getRenderer("@jupyterlab/codemirror-extension:plugin.defaultConfig");e&&y.addRenderer("@jupyterlab/console-extension:tracker.promptCellConfig",e)}function W(){return null!==T.currentWidget&&T.currentWidget===P.currentWidget}function D(e){const n=T.currentWidget;return!1!==e.activate&&n&&P.activateById(n.id),null!=n?n:null}T.widgetAdded.connect(((e,n)=>{U(n)})),S.addCommand(x.autoClosingBrackets,{execute:async e=>{var n;B.autoClosingBrackets=!!(null!==(n=e.force)&&void 0!==n?n:!B.autoClosingBrackets),await s.set(K,"promptCellConfig",B)},label:I.__("Auto Close Brackets for Code Console Prompt"),isToggled:()=>B.autoClosingBrackets}),S.addCommand(x.open,{label:I.__("Open a console for the provided `path`."),execute:e=>{const n=e.path,o=T.find((e=>{var o;return(null===(o=e.console.sessionContext.session)||void 0===o?void 0:o.path)===n}));return o?(!1!==e.activate&&P.activateById(o.id),o):E.ready.then((()=>(0,v.find)(E.sessions.running(),(e=>e.path===n))?A(e):Promise.reject(`No running kernel session for path: ${n}`)))}}),S.addCommand(x.create,{label:e=>{var n,o,t,r;if(e.isPalette)return I.__("New Console");if(e.isLauncher&&e.kernelPreference){const l=e.kernelPreference;return null!==(r=null===(t=null===(o=null===(n=E.kernelspecs)||void 0===n?void 0:n.specs)||void 0===o?void 0:o.kernelspecs[l.name||""])||void 0===t?void 0:t.display_name)&&void 0!==r?r:""}return I.__("Console")},icon:e=>e.isPalette?void 0:C.consoleIcon,execute:e=>{var n;return A({basePath:null!==(n=e.basePath||e.cwd||(null==i?void 0:i.model.path))&&void 0!==n?n:"",...e})}}),S.addCommand(x.undo,{execute:e=>{var n;const o=D(e);if(!o)return;const t=null===(n=o.console.promptCell)||void 0===n?void 0:n.editor;t&&t.undo()},isEnabled:e=>{var n,o,t;if(!W())return!1;const r=null===(t=null===(o=null===(n=D(e))||void 0===n?void 0:n.console)||void 0===o?void 0:o.promptCell)||void 0===t?void 0:t.editor;return!!r&&r.model.sharedModel.canUndo()},icon:C.undoIcon.bindprops({stylesheet:"menuItem"}),label:I.__("Undo")}),S.addCommand(x.redo,{execute:e=>{var n;const o=D(e);if(!o)return;const t=null===(n=o.console.promptCell)||void 0===n?void 0:n.editor;t&&t.redo()},isEnabled:e=>{var n,o,t;if(!W())return!1;const r=null===(t=null===(o=null===(n=D(e))||void 0===n?void 0:n.console)||void 0===o?void 0:o.promptCell)||void 0===t?void 0:t.editor;return!!r&&r.model.sharedModel.canRedo()},icon:C.redoIcon.bindprops({stylesheet:"menuItem"}),label:I.__("Redo")}),S.addCommand(x.clear,{label:I.__("Clear Console Cells"),execute:e=>{const n=D(e);n&&n.console.clear()},isEnabled:W}),S.addCommand(x.runUnforced,{label:I.__("Run Cell (unforced)"),execute:e=>{const n=D(e);if(n)return n.console.execute()},isEnabled:W}),S.addCommand(x.runForced,{label:I.__("Run Cell (forced)"),execute:e=>{const n=D(e);if(n)return n.console.execute(!0)},isEnabled:W}),S.addCommand(x.linebreak,{label:I.__("Insert Line Break"),execute:e=>{const n=D(e);n&&n.console.insertLinebreak()},isEnabled:W}),S.addCommand(x.replaceSelection,{label:I.__("Replace Selection in Console"),execute:e=>{const n=D(e);if(!n)return;const o=e.text||"";n.console.replaceSelection(o)},isEnabled:W}),S.addCommand(x.interrupt,{label:I.__("Interrupt Kernel"),execute:e=>{var n;const o=D(e);if(!o)return;const t=null===(n=o.console.sessionContext.session)||void 0===n?void 0:n.kernel;return t?t.interrupt():void 0},isEnabled:W}),S.addCommand(x.restart,{label:I.__("Restart Kernel…"),execute:e=>{const n=D(e);if(n)return j.restart(n.console.sessionContext)},isEnabled:W}),S.addCommand(x.shutdown,{label:I.__("Shut Down"),execute:e=>{const n=D(e);if(n)return n.console.sessionContext.shutdown()}}),S.addCommand(x.closeAndShutdown,{label:I.__("Close and Shut Down…"),execute:e=>{const n=D(e);if(n)return(0,r.showDialog)({title:I.__("Shut down the console?"),body:I.__('Are you sure you want to close "%1"?',n.title.label),buttons:[r.Dialog.cancelButton({ariaLabel:I.__("Cancel console Shut Down")}),r.Dialog.warnButton({ariaLabel:I.__("Confirm console Shut Down")})]}).then((e=>!!e.button.accept&&S.execute(x.shutdown,{activate:!1}).then((()=>(n.dispose(),!0)))))},isEnabled:W}),S.addCommand(x.inject,{label:I.__("Inject some code in a console."),execute:e=>{const n=e.path;T.find((o=>{var t;return(null===(t=o.console.sessionContext.session)||void 0===t?void 0:t.path)===n&&(!1!==e.activate&&P.activateById(o.id),o.console.inject(e.code,e.metadata),!0)}))},isEnabled:W}),S.addCommand(x.changeKernel,{label:I.__("Change Kernel…"),execute:e=>{const n=D(e);if(n)return j.selectKernel(n.console.sessionContext)},isEnabled:W}),S.addCommand(x.getKernel,{label:I.__("Get Kernel"),execute:e=>{var n;const o=D({activate:!1,...e});if(o)return null===(n=o.sessionContext.session)||void 0===n?void 0:n.kernel},isEnabled:W});const F=[x.create],L=()=>{Object.values(x).filter((e=>!F.includes(e))).forEach((n=>e.commands.notifyCommandChanged(n)))};T.currentChanged.connect(L),null===(_=P.currentChanged)||void 0===_||_.connect(L),u&&[x.create,x.linebreak,x.clear,x.runUnforced,x.runForced,x.restart,x.interrupt,x.changeKernel,x.closeAndShutdown].forEach((e=>{u.addItem({command:e,category:M,args:{isPalette:!0}})})),d&&(d.fileMenu.closeAndCleaners.add({id:x.closeAndShutdown,isEnabled:W}),d.kernelMenu.kernelUsers.changeKernel.add({id:x.changeKernel,isEnabled:W}),d.kernelMenu.kernelUsers.clearWidget.add({id:x.clear,isEnabled:W}),d.kernelMenu.kernelUsers.interruptKernel.add({id:x.interrupt,isEnabled:W}),d.kernelMenu.kernelUsers.restartKernel.add({id:x.restart,isEnabled:W}),d.kernelMenu.kernelUsers.shutdownKernel.add({id:x.shutdown,isEnabled:W}),d.runMenu.codeRunners.run.add({id:x.runForced,isEnabled:W}),d.editMenu.clearers.clearCurrent.add({id:x.clear,isEnabled:W}),d.editMenu.undoers.redo.add({id:x.redo,isEnabled:W}),d.editMenu.undoers.undo.add({id:x.undo,isEnabled:W}),d.helpMenu.getKernel.add({id:x.getKernel,isEnabled:W}));const O={notebook:I.__("Execute with Shift+Enter"),terminal:I.__("Execute with Enter")};return S.addCommand(x.interactionMode,{label:e=>{var n;return null!==(n=O[e.interactionMode])&&void 0!==n?n:"Set the console interaction mode."},execute:async e=>{try{await s.set(K,"interactionMode",e.interactionMode)}catch(e){console.error(`Failed to set ${K}:keyMap - ${e.message}`)}},isToggled:e=>e.interactionMode===R}),T},autoStart:!0},I={id:"@jupyterlab/console-extension:factory",description:"Provides the console widget content factory.",provides:a.ConsolePanel.IContentFactory,requires:[l.IEditorServices],autoStart:!0,activate:(e,n)=>{const o=n.factoryService.newInlineEditor;return new a.ConsolePanel.ContentFactory({editorFactory:o})}},E={id:"@jupyterlab/console-extension:kernel-status",description:"Adds the console to the kernel status indicator model.",autoStart:!0,requires:[a.IConsoleTracker,r.IKernelStatusModel],activate:(e,n,o)=>{o.addSessionProvider((e=>e&&n.has(e)?e.sessionContext:null))}},S={id:"@jupyterlab/console-extension:cursor-position",description:"Adds the console to the code editor cursor position model.",autoStart:!0,requires:[a.IConsoleTracker,l.IPositionModel],activate:(e,n,o)=>{let t=null;o.addEditorProvider((async e=>{let r=null;if(e!==t){if(null==t||t.console.promptCellCreated.disconnect(o.update),t=null,e&&n.has(e)){e.console.promptCellCreated.connect(o.update);const n=e.console.promptCell;r=null,n&&(await n.ready,r=n.editor),t=e}}else if(e){const n=e.console.promptCell;r=null,n&&(await n.ready,r=n.editor)}return r}))}},P=[I,w,y,E,S,{id:"@jupyterlab/console-extension:completer",description:"Adds completion to the console.",autoStart:!0,requires:[a.IConsoleTracker],optional:[s.ICompletionProviderManager,m.ITranslator,r.ISanitizer],activate:function(e,n,o,t,l){if(!o)return;const s=(null!=t?t:m.nullTranslator).load("jupyterlab"),a=null!=l?l:new r.Sanitizer;e.commands.addCommand(x.invokeCompleter,{label:s.__("Display the completion helper."),execute:()=>{const e=n.currentWidget&&n.currentWidget.id;if(e)return o.invoke(e)}}),e.commands.addCommand(x.selectCompleter,{label:s.__("Select the completion suggestion."),execute:()=>{const e=n.currentWidget&&n.currentWidget.id;if(e)return o.select(e)}}),e.commands.addKeyBinding({command:x.selectCompleter,keys:["Enter"],selector:".jp-ConsolePanel .jp-mod-completer-active"});const c=async(e,n)=>{var t,r;const l={editor:null!==(r=null===(t=n.console.promptCell)||void 0===t?void 0:t.editor)&&void 0!==r?r:null,session:n.console.sessionContext.session,widget:n};await o.updateCompleter(l),n.console.promptCellCreated.connect(((e,t)=>{const r={editor:t.editor,session:e.sessionContext.session,widget:n,sanitzer:a};o.updateCompleter(r).catch(console.error)})),n.console.sessionContext.sessionChanged.connect((()=>{var e,t;const r={editor:null!==(t=null===(e=n.console.promptCell)||void 0===e?void 0:e.editor)&&void 0!==t?t:null,session:n.console.sessionContext.session,widget:n,sanitizer:a};o.updateCompleter(r).catch(console.error)}))};n.widgetAdded.connect(c),o.activeProvidersChanged.connect((()=>{n.forEach((e=>{c(0,e).catch((e=>console.error(e)))}))}))}},_]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6748],{86748:(e,n,o)=>{o.r(n),o.d(n,{default:()=>P});var t=o(44604),r=o(53312),l=o(51429),s=o(81002),a=o(67260),c=o(71427),i=o(86810),d=o(29879),u=o(81221),p=o(23295),m=o(12030),C=o(35613),v=o(33625),g=o(20998),h=o(2549),b=o(14421);const f={id:"@jupyterlab/console-extension:foreign",description:"Add foreign handler of IOPub messages to the console.",requires:[a.IConsoleTracker,p.ISettingRegistry,m.ITranslator],optional:[r.ICommandPalette],activate:function(e,n,o,t,r){var l;const s=t.load("jupyterlab"),{shell:c}=e;n.widgetAdded.connect(((e,n)=>{const t=n.console,r=new a.ForeignHandler({sessionContext:t.sessionContext,parent:t});k.foreignHandlerProperty.set(t,r),o.get("@jupyterlab/console-extension:tracker","showAllKernelActivity").then((({composite:e})=>{const n=e;r.enabled=n})),t.disposed.connect((()=>{r.dispose()}))}));const{commands:i}=e,d=s.__("Console"),u="console:toggle-show-all-kernel-activity";i.addCommand(u,{label:e=>s.__("Show All Kernel Activity"),execute:e=>{const o=function(e){const o=n.currentWidget;return!1!==e.activate&&o&&c.activateById(o.id),o}(e);if(!o)return;const t=k.foreignHandlerProperty.get(o.console);t&&(t.enabled=!t.enabled)},isToggled:()=>{var e;return null!==n.currentWidget&&!!(null===(e=k.foreignHandlerProperty.get(n.currentWidget.console))||void 0===e?void 0:e.enabled)},isEnabled:()=>null!==n.currentWidget&&n.currentWidget===c.currentWidget});const p=()=>{i.notifyCommandChanged(u)};n.currentChanged.connect(p),null===(l=c.currentChanged)||void 0===l||l.connect(p),r&&r.addItem({command:u,category:d,args:{isPalette:!0}})},autoStart:!0},y=f;var k;!function(e){e.foreignHandlerProperty=new b.AttachedProperty({name:"foreignHandler",create:()=>{}})}(k||(k={}));const _={id:"@jupyterlab/console-extension:cell-executor",description:"Provides the console cell executor.",autoStart:!0,provides:a.IConsoleCellExecutor,activate:()=>Object.freeze({runCell:a.runCell})};var x;!function(e){e.autoClosingBrackets="console:toggle-autoclosing-brackets",e.create="console:create",e.clear="console:clear",e.runUnforced="console:run-unforced",e.runForced="console:run-forced",e.linebreak="console:linebreak",e.interrupt="console:interrupt-kernel",e.restart="console:restart-kernel",e.closeAndShutdown="console:close-and-shutdown",e.open="console:open",e.inject="console:inject",e.changeKernel="console:change-kernel",e.getKernel="console:get-kernel",e.interactionMode="console:interaction-mode",e.redo="console:redo",e.replaceSelection="console:replace-selection",e.shutdown="console:shutdown",e.undo="console:undo",e.invokeCompleter="completer:invoke-console",e.selectCompleter="completer:select-console"}(x||(x={}));const w={id:"@jupyterlab/console-extension:tracker",description:"Provides the console widget tracker.",provides:a.IConsoleTracker,requires:[a.ConsolePanel.IContentFactory,l.IEditorServices,a.IConsoleCellExecutor,u.IRenderMimeRegistry,p.ISettingRegistry],optional:[t.ILayoutRestorer,c.IDefaultFileBrowser,d.IMainMenu,r.ICommandPalette,i.ILauncher,t.ILabStatus,r.ISessionContextDialogs,C.IFormRendererRegistry,m.ITranslator],activate:async function(e,n,o,t,l,s,c,i,d,u,p,b,f,y,k){var _;const w=null!=k?k:m.nullTranslator,I=w.load("jupyterlab"),E=e.serviceManager,{commands:S,shell:P}=e,M=I.__("Console"),j=null!=f?f:new r.SessionContextDialogs({translator:w}),T=new r.WidgetTracker({namespace:"console"});async function A(e){var r,c;await E.ready;const i=new a.ConsolePanel({manager:E,contentFactory:n,mimeTypeService:o.mimeTypeService,rendermime:l,sessionDialogs:j,executor:t,translator:w,setBusy:null!==(r=b&&(()=>b.setBusy()))&&void 0!==r?r:void 0,...e}),d=(await s.get("@jupyterlab/console-extension:tracker","interactionMode")).composite;return i.console.node.dataset.jpInteractionMode=d,await T.add(i),i.sessionContext.propertyChanged.connect((()=>{T.save(i)})),P.add(i,"main",{ref:e.ref,mode:e.insertMode,activate:!1!==e.activate,type:null!==(c=e.type)&&void 0!==c?c:"Console"}),i}c&&c.restore(T,{command:x.create,args:e=>{const{path:n,name:o,kernelPreference:t}=e.console.sessionContext;return{path:n,name:o,kernelPreference:{...t}}},name:e=>{var n;return null!==(n=e.console.sessionContext.path)&&void 0!==n?n:g.UUID.uuid4()},when:E.ready}),p&&E.ready.then((()=>{let e=null;const n=()=>{e&&(e.dispose(),e=null);const n=E.kernelspecs.specs;if(n){e=new h.DisposableSet;for(const o in n.kernelspecs){const t=o===n.default?0:1/0,r=n.kernelspecs[o],l=r.resources["logo-svg"]||r.resources["logo-64x64"];e.add(p.add({command:x.create,args:{isLauncher:!0,kernelPreference:{name:o}},category:I.__("Console"),rank:t,kernelIconUrl:l,metadata:{kernel:g.JSONExt.deepCopy(r.metadata||{})}}))}}};n(),E.kernelspecs.specsChanged.connect(n)}));const K="@jupyterlab/console-extension:tracker";let R,B={};async function U(e){R=(await s.get(K,"interactionMode")).composite,B=(await s.get(K,"promptCellConfig")).composite;const n=e=>{var n,o;e.console.node.dataset.jpInteractionMode=R,e.console.editorConfig=B,null===(o=null===(n=e.console.promptCell)||void 0===n?void 0:n.editor)||void 0===o||o.setOptions(B)};e?n(e):T.forEach(n)}if(s.pluginChanged.connect(((e,n)=>{n===K&&U()})),await U(),y){const e=y.getRenderer("@jupyterlab/codemirror-extension:plugin.defaultConfig");e&&y.addRenderer("@jupyterlab/console-extension:tracker.promptCellConfig",e)}function W(){return null!==T.currentWidget&&T.currentWidget===P.currentWidget}function D(e){const n=T.currentWidget;return!1!==e.activate&&n&&P.activateById(n.id),null!=n?n:null}T.widgetAdded.connect(((e,n)=>{U(n)})),S.addCommand(x.autoClosingBrackets,{execute:async e=>{var n;B.autoClosingBrackets=!!(null!==(n=e.force)&&void 0!==n?n:!B.autoClosingBrackets),await s.set(K,"promptCellConfig",B)},label:I.__("Auto Close Brackets for Code Console Prompt"),isToggled:()=>B.autoClosingBrackets}),S.addCommand(x.open,{label:I.__("Open a console for the provided `path`."),execute:e=>{const n=e.path,o=T.find((e=>{var o;return(null===(o=e.console.sessionContext.session)||void 0===o?void 0:o.path)===n}));return o?(!1!==e.activate&&P.activateById(o.id),o):E.ready.then((()=>(0,v.find)(E.sessions.running(),(e=>e.path===n))?A(e):Promise.reject(`No running kernel session for path: ${n}`)))}}),S.addCommand(x.create,{label:e=>{var n,o,t,r;if(e.isPalette)return I.__("New Console");if(e.isLauncher&&e.kernelPreference){const l=e.kernelPreference;return null!==(r=null===(t=null===(o=null===(n=E.kernelspecs)||void 0===n?void 0:n.specs)||void 0===o?void 0:o.kernelspecs[l.name||""])||void 0===t?void 0:t.display_name)&&void 0!==r?r:""}return I.__("Console")},icon:e=>e.isPalette?void 0:C.consoleIcon,execute:e=>{var n;return A({basePath:null!==(n=e.basePath||e.cwd||(null==i?void 0:i.model.path))&&void 0!==n?n:"",...e})}}),S.addCommand(x.undo,{execute:e=>{var n;const o=D(e);if(!o)return;const t=null===(n=o.console.promptCell)||void 0===n?void 0:n.editor;t&&t.undo()},isEnabled:e=>{var n,o,t;if(!W())return!1;const r=null===(t=null===(o=null===(n=D(e))||void 0===n?void 0:n.console)||void 0===o?void 0:o.promptCell)||void 0===t?void 0:t.editor;return!!r&&r.model.sharedModel.canUndo()},icon:C.undoIcon.bindprops({stylesheet:"menuItem"}),label:I.__("Undo")}),S.addCommand(x.redo,{execute:e=>{var n;const o=D(e);if(!o)return;const t=null===(n=o.console.promptCell)||void 0===n?void 0:n.editor;t&&t.redo()},isEnabled:e=>{var n,o,t;if(!W())return!1;const r=null===(t=null===(o=null===(n=D(e))||void 0===n?void 0:n.console)||void 0===o?void 0:o.promptCell)||void 0===t?void 0:t.editor;return!!r&&r.model.sharedModel.canRedo()},icon:C.redoIcon.bindprops({stylesheet:"menuItem"}),label:I.__("Redo")}),S.addCommand(x.clear,{label:I.__("Clear Console Cells"),execute:e=>{const n=D(e);n&&n.console.clear()},isEnabled:W}),S.addCommand(x.runUnforced,{label:I.__("Run Cell (unforced)"),execute:e=>{const n=D(e);if(n)return n.console.execute()},isEnabled:W}),S.addCommand(x.runForced,{label:I.__("Run Cell (forced)"),execute:e=>{const n=D(e);if(n)return n.console.execute(!0)},isEnabled:W}),S.addCommand(x.linebreak,{label:I.__("Insert Line Break"),execute:e=>{const n=D(e);n&&n.console.insertLinebreak()},isEnabled:W}),S.addCommand(x.replaceSelection,{label:I.__("Replace Selection in Console"),execute:e=>{const n=D(e);if(!n)return;const o=e.text||"";n.console.replaceSelection(o)},isEnabled:W}),S.addCommand(x.interrupt,{label:I.__("Interrupt Kernel"),execute:e=>{var n;const o=D(e);if(!o)return;const t=null===(n=o.console.sessionContext.session)||void 0===n?void 0:n.kernel;return t?t.interrupt():void 0},isEnabled:W}),S.addCommand(x.restart,{label:I.__("Restart Kernel…"),execute:e=>{const n=D(e);if(n)return j.restart(n.console.sessionContext)},isEnabled:W}),S.addCommand(x.shutdown,{label:I.__("Shut Down"),execute:e=>{const n=D(e);if(n)return n.console.sessionContext.shutdown()}}),S.addCommand(x.closeAndShutdown,{label:I.__("Close and Shut Down…"),execute:e=>{const n=D(e);if(n)return(0,r.showDialog)({title:I.__("Shut down the console?"),body:I.__('Are you sure you want to close "%1"?',n.title.label),buttons:[r.Dialog.cancelButton({ariaLabel:I.__("Cancel console Shut Down")}),r.Dialog.warnButton({ariaLabel:I.__("Confirm console Shut Down")})]}).then((e=>!!e.button.accept&&S.execute(x.shutdown,{activate:!1}).then((()=>(n.dispose(),!0)))))},isEnabled:W}),S.addCommand(x.inject,{label:I.__("Inject some code in a console."),execute:e=>{const n=e.path;T.find((o=>{var t;return(null===(t=o.console.sessionContext.session)||void 0===t?void 0:t.path)===n&&(!1!==e.activate&&P.activateById(o.id),o.console.inject(e.code,e.metadata),!0)}))},isEnabled:W}),S.addCommand(x.changeKernel,{label:I.__("Change Kernel…"),execute:e=>{const n=D(e);if(n)return j.selectKernel(n.console.sessionContext)},isEnabled:W}),S.addCommand(x.getKernel,{label:I.__("Get Kernel"),execute:e=>{var n;const o=D({activate:!1,...e});if(o)return null===(n=o.sessionContext.session)||void 0===n?void 0:n.kernel},isEnabled:W});const F=[x.create],L=()=>{Object.values(x).filter((e=>!F.includes(e))).forEach((n=>e.commands.notifyCommandChanged(n)))};T.currentChanged.connect(L),null===(_=P.currentChanged)||void 0===_||_.connect(L),u&&[x.create,x.linebreak,x.clear,x.runUnforced,x.runForced,x.restart,x.interrupt,x.changeKernel,x.closeAndShutdown].forEach((e=>{u.addItem({command:e,category:M,args:{isPalette:!0}})})),d&&(d.fileMenu.closeAndCleaners.add({id:x.closeAndShutdown,isEnabled:W}),d.kernelMenu.kernelUsers.changeKernel.add({id:x.changeKernel,isEnabled:W}),d.kernelMenu.kernelUsers.clearWidget.add({id:x.clear,isEnabled:W}),d.kernelMenu.kernelUsers.interruptKernel.add({id:x.interrupt,isEnabled:W}),d.kernelMenu.kernelUsers.restartKernel.add({id:x.restart,isEnabled:W}),d.kernelMenu.kernelUsers.shutdownKernel.add({id:x.shutdown,isEnabled:W}),d.runMenu.codeRunners.run.add({id:x.runForced,isEnabled:W}),d.editMenu.clearers.clearCurrent.add({id:x.clear,isEnabled:W}),d.editMenu.undoers.redo.add({id:x.redo,isEnabled:W}),d.editMenu.undoers.undo.add({id:x.undo,isEnabled:W}),d.helpMenu.getKernel.add({id:x.getKernel,isEnabled:W}));const O={notebook:I.__("Execute with Shift+Enter"),terminal:I.__("Execute with Enter")};return S.addCommand(x.interactionMode,{label:e=>{var n;return null!==(n=O[e.interactionMode])&&void 0!==n?n:"Set the console interaction mode."},execute:async e=>{try{await s.set(K,"interactionMode",e.interactionMode)}catch(e){console.error(`Failed to set ${K}:keyMap - ${e.message}`)}},isToggled:e=>e.interactionMode===R}),T},autoStart:!0},I={id:"@jupyterlab/console-extension:factory",description:"Provides the console widget content factory.",provides:a.ConsolePanel.IContentFactory,requires:[l.IEditorServices],autoStart:!0,activate:(e,n)=>{const o=n.factoryService.newInlineEditor;return new a.ConsolePanel.ContentFactory({editorFactory:o})}},E={id:"@jupyterlab/console-extension:kernel-status",description:"Adds the console to the kernel status indicator model.",autoStart:!0,requires:[a.IConsoleTracker,r.IKernelStatusModel],activate:(e,n,o)=>{o.addSessionProvider((e=>e&&n.has(e)?e.sessionContext:null))}},S={id:"@jupyterlab/console-extension:cursor-position",description:"Adds the console to the code editor cursor position model.",autoStart:!0,requires:[a.IConsoleTracker,l.IPositionModel],activate:(e,n,o)=>{let t=null;o.addEditorProvider((async e=>{let r=null;if(e!==t){if(null==t||t.console.promptCellCreated.disconnect(o.update),t=null,e&&n.has(e)){e.console.promptCellCreated.connect(o.update);const n=e.console.promptCell;r=null,n&&(await n.ready,r=n.editor),t=e}}else if(e){const n=e.console.promptCell;r=null,n&&(await n.ready,r=n.editor)}return r}))}},P=[I,w,y,E,S,{id:"@jupyterlab/console-extension:completer",description:"Adds completion to the console.",autoStart:!0,requires:[a.IConsoleTracker],optional:[s.ICompletionProviderManager,m.ITranslator,r.ISanitizer],activate:function(e,n,o,t,l){if(!o)return;const s=(null!=t?t:m.nullTranslator).load("jupyterlab"),a=null!=l?l:new r.Sanitizer;e.commands.addCommand(x.invokeCompleter,{label:s.__("Display the completion helper."),execute:()=>{const e=n.currentWidget&&n.currentWidget.id;if(e)return o.invoke(e)}}),e.commands.addCommand(x.selectCompleter,{label:s.__("Select the completion suggestion."),execute:()=>{const e=n.currentWidget&&n.currentWidget.id;if(e)return o.select(e)}}),e.commands.addKeyBinding({command:x.selectCompleter,keys:["Enter"],selector:".jp-ConsolePanel .jp-mod-completer-active"});const c=async(e,n)=>{var t,r;const l={editor:null!==(r=null===(t=n.console.promptCell)||void 0===t?void 0:t.editor)&&void 0!==r?r:null,session:n.console.sessionContext.session,widget:n};await o.updateCompleter(l),n.console.promptCellCreated.connect(((e,t)=>{const r={editor:t.editor,session:e.sessionContext.session,widget:n,sanitzer:a};o.updateCompleter(r).catch(console.error)})),n.console.sessionContext.sessionChanged.connect((()=>{var e,t;const r={editor:null!==(t=null===(e=n.console.promptCell)||void 0===e?void 0:e.editor)&&void 0!==t?t:null,session:n.console.sessionContext.session,widget:n,sanitizer:a};o.updateCompleter(r).catch(console.error)}))};n.widgetAdded.connect(c),o.activeProvidersChanged.connect((()=>{n.forEach((e=>{c(0,e).catch((e=>console.error(e)))}))}))}},_]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6815],{56815:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var n=a(2922),o=a(96049),s=a(50845),l=a(24554),r=a(37267);const i="@jupyterlab/translation-extension:plugin",c={id:"@jupyterlab/translation:translator",description:"Provides the application translation object.",autoStart:!0,requires:[n.JupyterFrontEnd.IPaths,l.ISettingRegistry],optional:[n.ILabShell],provides:r.ITranslator,activate:async(e,t,a,n)=>{const s=await a.load(i),l=s.get("locale").composite;let c=s.get("stringsPrefix").composite;c=s.get("displayStringsPrefix").composite?c:"";const d=e.serviceManager.serverSettings,u=new r.TranslationManager(t.urls.translations,c,d);return await u.fetch(l),n&&(n.translator=u),o.Dialog.translator=u,u}},d={id:i,description:"Adds translation commands and settings.",requires:[l.ISettingRegistry,r.ITranslator],optional:[s.IMainMenu,o.ICommandPalette],autoStart:!0,activate:(e,t,a,n,s)=>{const l=a.load("jupyterlab"),{commands:c}=e;let d;function u(e){d=e.get("locale").composite}t.load(i).then((t=>{var a;u(t),document.documentElement.lang="default"!==d?(null!=d?d:"").replace("_","-"):"en-US",t.changed.connect(u);const i=n?null===(a=n.settingsMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-settings-language"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===a?void 0:a.submenu:null;let g;const p=e.serviceManager.serverSettings;(0,r.requestTranslationsAPI)("","",{},p).then((e=>{for(const a in e.data){const n=e.data[a],r=n.displayName,d=n.nativeName,u=r===d,p=u?`${r}`:`${r} - ${d}`;g=`jupyterlab-translation:${a}`,c.addCommand(g,{label:p,caption:p,isEnabled:()=>!u,isVisible:()=>!0,isToggled:()=>u,execute:()=>(0,o.showDialog)({title:l.__("Change interface language?"),body:l.__("After changing the interface language to %1, you will need to reload JupyterLab to see the changes.",p),buttons:[o.Dialog.cancelButton({label:l.__("Cancel")}),o.Dialog.okButton({label:l.__("Change and reload")})]}).then((e=>{e.button.accept&&t.set("locale",a).then((()=>{window.location.reload()})).catch((e=>{console.error(e)}))}))}),i&&i.addItem({command:g,args:{}}),s&&s.addItem({category:l.__("Display Languages"),command:g})}})).catch((e=>{console.error(`Available locales errored!\n${e}`)}))})).catch((e=>{console.error(`The jupyterlab translation extension appears to be missing.\n${e}`)}))}},u=[c,d]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6815],{56815:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var n=a(44604),o=a(53312),s=a(29879),l=a(23295),r=a(12030);const i="@jupyterlab/translation-extension:plugin",c={id:"@jupyterlab/translation:translator",description:"Provides the application translation object.",autoStart:!0,requires:[n.JupyterFrontEnd.IPaths,l.ISettingRegistry],optional:[n.ILabShell],provides:r.ITranslator,activate:async(e,t,a,n)=>{const s=await a.load(i),l=s.get("locale").composite;let c=s.get("stringsPrefix").composite;c=s.get("displayStringsPrefix").composite?c:"";const d=e.serviceManager.serverSettings,u=new r.TranslationManager(t.urls.translations,c,d);return await u.fetch(l),n&&(n.translator=u),o.Dialog.translator=u,u}},d={id:i,description:"Adds translation commands and settings.",requires:[l.ISettingRegistry,r.ITranslator],optional:[s.IMainMenu,o.ICommandPalette],autoStart:!0,activate:(e,t,a,n,s)=>{const l=a.load("jupyterlab"),{commands:c}=e;let d;function u(e){d=e.get("locale").composite}t.load(i).then((t=>{var a;u(t),document.documentElement.lang="default"!==d?(null!=d?d:"").replace("_","-"):"en-US",t.changed.connect(u);const i=n?null===(a=n.settingsMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-settings-language"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===a?void 0:a.submenu:null;let g;const p=e.serviceManager.serverSettings;(0,r.requestTranslationsAPI)("","",{},p).then((e=>{for(const a in e.data){const n=e.data[a],r=n.displayName,d=n.nativeName,u=r===d,p=u?`${r}`:`${r} - ${d}`;g=`jupyterlab-translation:${a}`,c.addCommand(g,{label:p,caption:p,isEnabled:()=>!u,isVisible:()=>!0,isToggled:()=>u,execute:()=>(0,o.showDialog)({title:l.__("Change interface language?"),body:l.__("After changing the interface language to %1, you will need to reload JupyterLab to see the changes.",p),buttons:[o.Dialog.cancelButton({label:l.__("Cancel")}),o.Dialog.okButton({label:l.__("Change and reload")})]}).then((e=>{e.button.accept&&t.set("locale",a).then((()=>{window.location.reload()})).catch((e=>{console.error(e)}))}))}),i&&i.addItem({command:g,args:{}}),s&&s.addItem({category:l.__("Display Languages"),command:g})}})).catch((e=>{console.error(`Available locales errored!\n${e}`)}))})).catch((e=>{console.error(`The jupyterlab translation extension appears to be missing.\n${e}`)}))}},u=[c,d]}}]);