notebook 7.1.2__py3-none-any.whl → 7.2.0__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 (229) hide show
  1. notebook/_version.py +1 -1
  2. notebook/static/113.bundle.js +1 -0
  3. notebook/static/1198.bundle.js +1 -1
  4. notebook/static/131.bundle.js +1 -1
  5. notebook/static/134.bundle.js +1 -1
  6. notebook/static/1408.bundle.js +1 -1
  7. notebook/static/1496.bundle.js +1 -1
  8. notebook/static/1584.bundle.js +1 -1
  9. notebook/static/1647.bundle.js +1 -1
  10. notebook/static/1650.bundle.js +1 -1
  11. notebook/static/1684.bundle.js +1 -1
  12. notebook/static/1809.bundle.js +1 -1
  13. notebook/static/1827.bundle.js +1 -1
  14. notebook/static/1828.bundle.js +1 -0
  15. notebook/static/1833.bundle.js +1 -1
  16. notebook/static/1846.bundle.js +1 -1
  17. notebook/static/1884.bundle.js +386 -0
  18. notebook/static/1958.bundle.js +1 -1
  19. notebook/static/1962.bundle.js +1 -0
  20. notebook/static/2007.bundle.js +1 -1
  21. notebook/static/2088.bundle.js +1 -1
  22. notebook/static/2089.bundle.js +1 -1
  23. notebook/static/2122.bundle.js +1 -1
  24. notebook/static/2167.bundle.js +1 -1
  25. notebook/static/2184.bundle.js +1 -1
  26. notebook/static/2311.bundle.js +1 -1
  27. notebook/static/2323.bundle.js +1 -1
  28. notebook/static/2401.bundle.js +1 -1
  29. notebook/static/2479.bundle.js +1 -1
  30. notebook/static/2489.bundle.js +1 -1
  31. notebook/static/2552.bundle.js +1 -1
  32. notebook/static/2607.bundle.js +1 -1
  33. notebook/static/2615.bundle.js +1 -1
  34. notebook/static/2636.bundle.js +1 -0
  35. notebook/static/2866.bundle.js +1 -1
  36. notebook/static/2924.bundle.js +1 -1
  37. notebook/static/2944.bundle.js +1 -1
  38. notebook/static/2955.bundle.js +1 -1
  39. notebook/static/3129.bundle.js +1 -1
  40. notebook/static/3146.bundle.js +1 -1
  41. notebook/static/3154.bundle.js +1 -1
  42. notebook/static/3187.bundle.js +1 -1
  43. notebook/static/3213.bundle.js +1 -1
  44. notebook/static/3301.bundle.js +1 -1
  45. notebook/static/3340.bundle.js +1 -1
  46. notebook/static/3360.bundle.js +1 -1
  47. notebook/static/3462.bundle.js +1 -0
  48. notebook/static/3466.bundle.js +1 -1
  49. notebook/static/3512.bundle.js +1 -1
  50. notebook/static/3676.bundle.js +1 -1
  51. notebook/static/3680.bundle.js +1 -1
  52. notebook/static/374.bundle.js +1 -0
  53. notebook/static/3768.bundle.js +1 -1
  54. notebook/static/377.bundle.js +1 -1
  55. notebook/static/3797.bundle.js +1 -1
  56. notebook/static/3863.bundle.js +1 -1
  57. notebook/static/3881.bundle.js +1 -1
  58. notebook/static/4042.bundle.js +1 -1
  59. notebook/static/4058.bundle.js +1 -1
  60. notebook/static/4212.bundle.js +1 -1
  61. notebook/static/4382.bundle.js +1 -1
  62. notebook/static/4430.bundle.js +1 -0
  63. notebook/static/4588.bundle.js +1 -1
  64. notebook/static/4630.bundle.js +1 -1
  65. notebook/static/4645.bundle.js +1 -1
  66. notebook/static/4670.bundle.js +1 -1
  67. notebook/static/4708.bundle.js +1 -0
  68. notebook/static/4810.bundle.js +1 -1
  69. notebook/static/4811.bundle.js +1 -1
  70. notebook/static/4837.bundle.js +1 -1
  71. notebook/static/5099.bundle.js +1 -1
  72. notebook/static/5135.bundle.js +1 -1
  73. notebook/static/5166.bundle.js +1 -0
  74. notebook/static/5254.bundle.js +1 -0
  75. notebook/static/5261.bundle.js +1 -1
  76. notebook/static/5263.bundle.js +1 -1
  77. notebook/static/5313.bundle.js +1 -1
  78. notebook/static/5325.bundle.js +1 -1
  79. notebook/static/5346.bundle.js +1 -1
  80. notebook/static/5425.bundle.js +1 -1
  81. notebook/static/5426.bundle.js +1 -1
  82. notebook/static/545.bundle.js +1 -0
  83. notebook/static/5573.bundle.js +1 -1
  84. notebook/static/5601.bundle.js +1 -1
  85. notebook/static/5649.bundle.js +3 -3
  86. notebook/static/5733.bundle.js +1 -1
  87. notebook/static/5828.bundle.js +1 -1
  88. notebook/static/5850.bundle.js +1 -1
  89. notebook/static/5912.bundle.js +1 -1
  90. notebook/static/5921.bundle.js +1 -1
  91. notebook/static/6017.bundle.js +1 -1
  92. notebook/static/6061.bundle.js +1 -1
  93. notebook/static/{1053.bundle.js → 6078.bundle.js} +1 -1
  94. notebook/static/6139.bundle.js +1 -1
  95. notebook/static/62.bundle.js +1 -1
  96. notebook/static/6271.bundle.js +1 -1
  97. notebook/static/6281.bundle.js +1 -1
  98. notebook/static/6345.bundle.js +1 -1
  99. notebook/static/6417.bundle.js +1 -1
  100. notebook/static/6521.bundle.js +1 -0
  101. notebook/static/6604.bundle.js +1 -1
  102. notebook/static/6621.bundle.js +1 -1
  103. notebook/static/6627.bundle.js +1 -1
  104. notebook/static/6731.bundle.js +1 -1
  105. notebook/static/6748.bundle.js +1 -0
  106. notebook/static/6815.bundle.js +1 -1
  107. notebook/static/6853.bundle.js +1 -0
  108. notebook/static/6893.bundle.js +1 -1
  109. notebook/static/690.bundle.js +1 -1
  110. notebook/static/6962.bundle.js +1 -1
  111. notebook/static/6972.bundle.js +1 -1
  112. notebook/static/6999.bundle.js +1 -1
  113. notebook/static/7153.bundle.js +1 -1
  114. notebook/static/7226.bundle.js +1 -1
  115. notebook/static/7252.bundle.js +1 -1
  116. notebook/static/7302.bundle.js +1 -1
  117. notebook/static/7386.bundle.js +1 -1
  118. notebook/static/7391.bundle.js +1 -1
  119. notebook/static/7450.bundle.js +1 -1
  120. notebook/static/7506.bundle.js +703 -0
  121. notebook/static/7543.bundle.js +1 -0
  122. notebook/static/755.bundle.js +1 -1
  123. notebook/static/7603.bundle.js +1 -1
  124. notebook/static/7639.bundle.js +1 -1
  125. notebook/static/7655.bundle.js +1 -0
  126. notebook/static/7674.bundle.js +1 -1
  127. notebook/static/7684.bundle.js +1 -1
  128. notebook/static/7812.bundle.js +1 -1
  129. notebook/static/7819.bundle.js +1 -1
  130. notebook/static/7854.bundle.js +1 -0
  131. notebook/static/7866.bundle.js +1 -1
  132. notebook/static/7884.bundle.js +1 -0
  133. notebook/static/7900.bundle.js +1 -1
  134. notebook/static/7906.bundle.js +1 -1
  135. notebook/static/7995.bundle.js +1 -1
  136. notebook/static/7997.bundle.js +1 -1
  137. notebook/static/8010.bundle.js +1 -1
  138. notebook/static/8032.bundle.js +1 -1
  139. notebook/static/8471.bundle.js +1 -0
  140. notebook/static/8579.bundle.js +1 -1
  141. notebook/static/8633.bundle.js +1 -1
  142. notebook/static/8771.bundle.js +1 -1
  143. notebook/static/8781.bundle.js +1 -1
  144. notebook/static/8845.bundle.js +1 -1
  145. notebook/static/8875.bundle.js +1 -1
  146. notebook/static/8907.bundle.js +1 -1
  147. notebook/static/8928.bundle.js +1 -1
  148. notebook/static/8929.bundle.js +1 -1
  149. notebook/static/893.bundle.js +1 -1
  150. notebook/static/901.bundle.js +1 -1
  151. notebook/static/9068.bundle.js +1 -1
  152. notebook/static/911.bundle.js +1 -1
  153. notebook/static/9136.bundle.js +1 -0
  154. notebook/static/9151.bundle.js +1 -1
  155. notebook/static/9161.bundle.js +1 -1
  156. notebook/static/9239.bundle.js +1 -1
  157. notebook/static/9268.bundle.js +1 -1
  158. notebook/static/9335.bundle.js +1 -1
  159. notebook/static/9341.bundle.js +1 -1
  160. notebook/static/9380.bundle.js +1 -1
  161. notebook/static/9605.bundle.js +1 -1
  162. notebook/static/9638.bundle.js +1 -1
  163. notebook/static/9680.bundle.js +1 -1
  164. notebook/static/9685.bundle.js +1 -1
  165. notebook/static/9752.bundle.js +1 -1
  166. notebook/static/9799.bundle.js +1 -1
  167. notebook/static/9821.bundle.js +1 -1
  168. notebook/static/9852.bundle.js +1 -1
  169. notebook/static/bundle.js +1 -1
  170. notebook/static/third-party-licenses.json +173 -161
  171. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +15 -15
  172. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +5 -5
  173. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
  174. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +10 -10
  175. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +17 -17
  176. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +12 -12
  177. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +11 -11
  178. notebook-7.1.2.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/246.7bfc2ac5bb3d27d6e0b9.js → notebook-7.2.0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/302.8a8d0af0376cb309e580.js +1 -1
  179. notebook-7.1.2.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.6e8d43b976f4be45b3d2.js → notebook-7.2.0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.aff74c88f76bc9000e65.js +1 -1
  180. notebook-7.2.0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.76f40c4b4ee1c8583ca3.js +1 -0
  181. notebook-7.1.2.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.832d780237fca436ff92.js → notebook-7.2.0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.eced2d228ddfce366f36.js +1 -1
  182. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
  183. {notebook-7.1.2.dist-info → notebook-7.2.0.dist-info}/METADATA +5 -5
  184. {notebook-7.1.2.dist-info → notebook-7.2.0.dist-info}/RECORD +208 -206
  185. {notebook-7.1.2.dist-info → notebook-7.2.0.dist-info}/WHEEL +1 -1
  186. notebook/static/1337.bundle.js +0 -1
  187. notebook/static/1664.bundle.js +0 -743
  188. notebook/static/1682.bundle.js +0 -1
  189. notebook/static/1835.bundle.js +0 -1
  190. notebook/static/1950.bundle.js +0 -1
  191. notebook/static/2067.bundle.js +0 -1
  192. notebook/static/2094.bundle.js +0 -1
  193. notebook/static/2512.bundle.js +0 -1
  194. notebook/static/2577.bundle.js +0 -1
  195. notebook/static/2758.bundle.js +0 -1
  196. notebook/static/3654.bundle.js +0 -1
  197. notebook/static/4558.bundle.js +0 -1
  198. notebook/static/4928.bundle.js +0 -1
  199. notebook/static/4997.bundle.js +0 -1
  200. notebook/static/5088.bundle.js +0 -1
  201. notebook/static/514.bundle.js +0 -1
  202. notebook/static/6256.bundle.js +0 -1
  203. notebook/static/6467.bundle.js +0 -1
  204. notebook/static/7394.bundle.js +0 -1
  205. notebook/static/853.bundle.js +0 -1
  206. notebook-7.1.2.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.65b9457e7bb7d428c0a7.js +0 -1
  207. /notebook/static/{1664.bundle.js.LICENSE.txt → 7506.bundle.js.LICENSE.txt} +0 -0
  208. {notebook-7.1.2.data → notebook-7.2.0.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
  209. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/applications/jupyter-notebook.desktop +0 -0
  210. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
  211. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
  212. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
  213. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +0 -0
  214. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
  215. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
  216. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
  217. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
  218. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
  219. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/edit-notebook-metadata.json +0 -0
  220. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
  221. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
  222. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
  223. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -0
  224. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
  225. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
  226. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/93.eae3497dd223d842d198.js +0 -0
  227. {notebook-7.1.2.data → notebook-7.2.0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
  228. {notebook-7.1.2.dist-info → notebook-7.2.0.dist-info}/entry_points.txt +0 -0
  229. {notebook-7.1.2.dist-info → notebook-7.2.0.dist-info}/licenses/LICENSE +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6999],{36999:(e,t,s)=>{s.r(t),s.d(t,{FOUND_CLASSES:()=>o,GenericSearchProvider:()=>c,HTMLSearchEngine:()=>h,ISearchProviderRegistry:()=>$,SearchDocumentModel:()=>m,SearchDocumentView:()=>L,SearchProvider:()=>n,SearchProviderRegistry:()=>Q,TextSearchEngine:()=>d});var r=s(31516),i=s(81997);class n{constructor(e){this.widget=e,this._stateChanged=new i.Signal(this),this._filtersChanged=new i.Signal(this),this._disposed=!1}get stateChanged(){return this._stateChanged}get filtersChanged(){return this._filtersChanged}get currentMatchIndex(){return null}get isDisposed(){return this._disposed}get matchesCount(){return null}dispose(){this._disposed||(this._disposed=!0,i.Signal.clearData(this))}getInitialQuery(){return""}getFilters(){return{}}static preserveCase(e,t){return e.toUpperCase()===e?t.toUpperCase():e.toLowerCase()===e?t.toLowerCase():a(e)===e?a(t):t}}function a([e="",...t]){return e.toUpperCase()+""+t.join("").toLowerCase()}const o=["cm-string","cm-overlay","cm-searching"],l=["CodeMirror-selectedtext"];class h{static search(e,t){if(!(t instanceof Node))return console.warn("Unable to search with HTMLSearchEngine the provided object.",t),Promise.resolve([]);e.global||(e=new RegExp(e.source,e.flags+"g"));const s=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:s=>{let r=s.parentElement;for(;r!==t;){if(r.nodeName in h.UNSUPPORTED_ELEMENTS)return NodeFilter.FILTER_REJECT;r=r.parentElement}return e.test(s.textContent)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let i=null;for(;null!==(i=r.nextNode());){e.lastIndex=0;let t=null;for(;null!==(t=e.exec(i.textContent));)s.push({text:t[0],position:t.index,node:i})}return Promise.resolve(s)}}h.UNSUPPORTED_ELEMENTS={BASE:!0,HEAD:!0,LINK:!0,META:!0,STYLE:!0,TITLE:!0,BODY:!0,AREA:!0,AUDIO:!0,IMG:!0,MAP:!0,TRACK:!0,VIDEO:!0,APPLET:!0,EMBED:!0,IFRAME:!0,NOEMBED:!0,OBJECT:!0,PARAM:!0,PICTURE:!0,SOURCE:!0,CANVAS:!0,NOSCRIPT:!0,SCRIPT:!0,SVG:!0};class c extends n{constructor(){super(...arguments),this.isReadOnly=!0,this._matches=[],this._mutationObserver=new MutationObserver(this._onWidgetChanged.bind(this)),this._markNodes=new Array}static isApplicable(e){return e instanceof r.Widget}static createNew(e,t,s){return new c(e)}get currentMatchIndex(){return this._currentMatchIndex>=0?this._currentMatchIndex:null}get currentMatch(){var e;return null!==(e=this._matches[this._currentMatchIndex])&&void 0!==e?e:null}get matches(){return this._matches?this._matches.map((e=>Object.assign({},e))):this._matches}get matchesCount(){return this._matches.length}clearHighlight(){return this._currentMatchIndex>=0&&this._markNodes[this._currentMatchIndex].classList.remove(...l),this._currentMatchIndex=-1,Promise.resolve()}dispose(){this.isDisposed||(this.endQuery().catch((e=>{console.error("Failed to end search query.",e)})),super.dispose())}async highlightNext(e){var t;return null!==(t=this._highlightNext(!1,null==e||e))&&void 0!==t?t:void 0}async highlightPrevious(e){var t;return null!==(t=this._highlightNext(!0,null==e||e))&&void 0!==t?t:void 0}async replaceCurrentMatch(e,t){return Promise.resolve(!1)}async replaceAllMatches(e){return Promise.resolve(!1)}async startQuery(e,t={}){if(await this.endQuery(),this._query=e,null===e)return Promise.resolve();const s=await h.search(e,this.widget.node);let r=0;for(;r<s.length;){let e=s[r].node,t=e.parentNode,i=[s[r]];for(;++r<s.length&&s[r].node===e;)i.unshift(s[r]);const n=i.map((s=>{const r=document.createElement("mark");r.classList.add(...o),r.textContent=s.text;const i=e.splitText(s.position);return i.textContent=i.textContent.slice(s.text.length),t.insertBefore(r,i),r}));for(let e=n.length-1;e>=0;e--)this._markNodes.push(n[e])}this._mutationObserver.observe(this.widget.node,{attributes:!1,characterData:!0,childList:!0,subtree:!0}),this._matches=s}async endQuery(){this._mutationObserver.disconnect(),this._markNodes.forEach((e=>{const t=e.parentNode;t.replaceChild(document.createTextNode(e.textContent),e),t.normalize()})),this._markNodes=[],this._matches=[],this._currentMatchIndex=-1}_highlightNext(e,t){if(0===this._matches.length)return null;if(-1===this._currentMatchIndex?this._currentMatchIndex=e?this.matches.length-1:0:(this._markNodes[this._currentMatchIndex].classList.remove(...l),this._currentMatchIndex=e?this._currentMatchIndex-1:this._currentMatchIndex+1,t&&(this._currentMatchIndex<0||this._currentMatchIndex>=this._matches.length)&&(this._currentMatchIndex=(this._currentMatchIndex+this._matches.length)%this._matches.length)),this._currentMatchIndex>=0&&this._currentMatchIndex<this._matches.length){const t=this._markNodes[this._currentMatchIndex];return t.classList.add(...l),function(e){const t=e.getBoundingClientRect();return t.top>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.left>=0&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}(t)||t.scrollIntoView(e),t.focus(),this._matches[this._currentMatchIndex]}return this._currentMatchIndex=-1,null}async _onWidgetChanged(e,t){this._currentMatchIndex=-1,await this.startQuery(this._query),this._stateChanged.emit()}}const d={search(e,t){if("string"!=typeof t)try{t=JSON.stringify(t)}catch(e){return console.warn("Unable to search with TextSearchEngine non-JSON serializable object.",e,t),Promise.resolve([])}e.global||(e=new RegExp(e.source,e.flags+"g"));const s=new Array;let r=null;for(;null!==(r=e.exec(t));)s.push({text:r[0],position:r.index});return Promise.resolve(s)}};var p,u=s(68239),g=s(97934);class m extends u.VDomModel{constructor(e,t){if(super(),this.searchProvider=e,this._caseSensitive=!1,this._disposed=new i.Signal(this),this._parsingError="",this._preserveCase=!1,this._initialQuery="",this._filters={},this._replaceText="",this._searchActive=!1,this._searchExpression="",this._useRegex=!1,this._wholeWords=!1,this._filters={},this.searchProvider.getFilters){const e=this.searchProvider.getFilters();for(const t in e)this._filters[t]=e[t].default}e.stateChanged.connect(this._onProviderStateChanged,this),this._searchDebouncer=new g.Debouncer((()=>{this._updateSearch().catch((e=>{console.error("Failed to update search on document.",e)}))}),t)}get caseSensitive(){return this._caseSensitive}set caseSensitive(e){this._caseSensitive!==e&&(this._caseSensitive=e,this.stateChanged.emit(),this.refresh())}get currentIndex(){return this.searchProvider.currentMatchIndex}get disposed(){return this._disposed}get filters(){return this._filters}get filtersDefinition(){var e,t,s;return null!==(s=null===(t=(e=this.searchProvider).getFilters)||void 0===t?void 0:t.call(e))&&void 0!==s?s:{}}get filtersDefinitionChanged(){return this.searchProvider.filtersChanged||null}get initialQuery(){return this._initialQuery}set initialQuery(e){this._initialQuery=e||this._searchExpression}get suggestedInitialQuery(){return this.searchProvider.getInitialQuery()}get selectionState(){return this.searchProvider.getSelectionState?this.searchProvider.getSelectionState():void 0}get isReadOnly(){return this.searchProvider.isReadOnly}get replaceOptionsSupport(){return this.searchProvider.replaceOptionsSupport}get parsingError(){return this._parsingError}get preserveCase(){return this._preserveCase}set preserveCase(e){this._preserveCase!==e&&(this._preserveCase=e,this.stateChanged.emit(),this.refresh())}get replaceText(){return this._replaceText}set replaceText(e){this._replaceText!==e&&(this._replaceText=e,this.stateChanged.emit())}get searchExpression(){return this._searchExpression}set searchExpression(e){this._searchExpression!==e&&(this._searchExpression=e,this.stateChanged.emit(),this.refresh())}get totalMatches(){return this.searchProvider.matchesCount}get useRegex(){return this._useRegex}set useRegex(e){this._useRegex!==e&&(this._useRegex=e,this.stateChanged.emit(),this.refresh())}get wholeWords(){return this._wholeWords}set wholeWords(e){this._wholeWords!==e&&(this._wholeWords=e,this.stateChanged.emit(),this.refresh())}dispose(){this.isDisposed||(this._searchExpression&&this.endQuery().catch((e=>{console.error(`Failed to end query '${this._searchExpression}.`,e)})),this.searchProvider.stateChanged.disconnect(this._onProviderStateChanged,this),this._searchDebouncer.dispose(),super.dispose())}async endQuery(){this._searchActive=!1,await this.searchProvider.endQuery(),this.stateChanged.emit()}async highlightNext(){await this.searchProvider.highlightNext(),this.stateChanged.emit()}async highlightPrevious(){await this.searchProvider.highlightPrevious(),this.stateChanged.emit()}refresh(){this._searchDebouncer.invoke().catch((e=>{console.error("Failed to invoke search document debouncer.",e)}))}async replaceAllMatches(){await this.searchProvider.replaceAllMatches(this._replaceText,{preserveCase:this.preserveCase,regularExpression:this.useRegex}),this.stateChanged.emit()}async replaceCurrentMatch(){await this.searchProvider.replaceCurrentMatch(this._replaceText,!0,{preserveCase:this.preserveCase,regularExpression:this.useRegex}),this.stateChanged.emit()}async setFilter(e,t){this._filters[e]!==t&&(this.searchProvider.validateFilter?(this._filters[e]=await this.searchProvider.validateFilter(e,t),this._filters[e]===t&&(this.stateChanged.emit(),this.refresh())):(this._filters[e]=t,this.stateChanged.emit(),this.refresh()))}async _updateSearch(){this._parsingError&&(this._parsingError="",this.stateChanged.emit());try{const e=this.searchExpression?p.parseQuery(this.searchExpression,this.caseSensitive,this.useRegex,this.wholeWords):null;e?(this._searchActive=!0,await this.searchProvider.startQuery(e,this._filters)):(this._searchActive=!1,await this.searchProvider.endQuery()),this.stateChanged.emit()}catch(e){this._parsingError=e.toString(),this.stateChanged.emit(),console.error(`Failed to parse expression ${this.searchExpression}`,e)}}_onProviderStateChanged(){this._searchActive&&this.refresh()}}!function(e){e.parseQuery=function(e,t,s,r){const i=t?"gm":"gim";let n=s?e:e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&");r&&(n="\\b"+n+"\\b");const a=new RegExp(n,i);return a.test("")?null:a}}(p||(p={}));var _=s(71677),v=s(32895),x=s(12982),C=s(78156);const E="jp-DocumentSearch-overlay-row",f="jp-DocumentSearch-input",y="jp-DocumentSearch-input-label",S="jp-DocumentSearch-input-wrapper",b="jp-DocumentSearch-input-button-off",w="jp-DocumentSearch-input-button-on",R="jp-DocumentSearch-up-down-button",I="jp-DocumentSearch-search-filter",N="jp-DocumentSearch-replace-button",T="jp-DocumentSearch-replace-button-wrapper",P="jp-DocumentSearch-button-content",M="jp-DocumentSearch-button-wrapper";function D(e){const[t,s]=(0,C.useState)(1),r=(0,C.useCallback)((t=>{var r;const i=t?t.target:null===(r=e.inputRef)||void 0===r?void 0:r.current;if(i){const e=i.value.split(/\n/);let t=e.reduce(((e,t)=>e.length>t.length?e:t),"");i.parentNode&&i.parentNode instanceof HTMLElement&&(i.parentNode.dataset.value=t),s(e.length)}}),[]);return(0,C.useEffect)((()=>{var t,s;null===(s=null===(t=e.inputRef)||void 0===t?void 0:t.current)||void 0===s||s.select(),r()}),[e.initialValue]),C.createElement("label",{className:y},C.createElement("textarea",{onChange:t=>{e.onChange(t),r(t)},onKeyDown:t=>{e.onKeyDown(t),r(t)},rows:t,placeholder:e.placeholder,className:f,key:e.autoUpdate?e.initialValue:null,tabIndex:0,ref:e.inputRef,title:e.title,defaultValue:e.initialValue,autoFocus:e.autoFocus}))}function k(e){var t;const s=(null!==(t=e.translator)&&void 0!==t?t:_.nullTranslator).load("jupyterlab"),r=(0,u.classes)(e.caseSensitive?w:b,P),i=(0,u.classes)(e.useRegex?w:b,P),n=(0,u.classes)(e.wholeWords?w:b,P),a=S;return C.createElement("div",{className:a},C.createElement(D,{placeholder:s.__("Find"),onChange:t=>e.onChange(t),onKeyDown:t=>e.onKeydown(t),inputRef:e.inputRef,initialValue:e.initialSearchText,title:s.__("Find"),autoFocus:!0,autoUpdate:!0}),C.createElement("button",{className:M,onClick:()=>{e.onCaseSensitiveToggled()},tabIndex:0,title:s.__("Match Case")},C.createElement(u.caseSensitiveIcon.react,{className:r,tag:"span"})),C.createElement("button",{className:M,onClick:()=>e.onWordToggled(),tabIndex:0,title:s.__("Match Whole Word")},C.createElement(u.wordIcon.react,{className:n,tag:"span"})),C.createElement("button",{className:M,onClick:()=>e.onRegexToggled(),tabIndex:0,title:s.__("Use Regular Expression")},C.createElement(u.regexIcon.react,{className:i,tag:"span"})))}function F(e){var t,s,r;const i=(null!==(t=e.translator)&&void 0!==t?t:_.nullTranslator).load("jupyterlab"),n=(0,u.classes)(e.preserveCase?w:b,P);return C.createElement("div",{className:"jp-DocumentSearch-replace-wrapper-class"},C.createElement("div",{className:S},C.createElement(D,{placeholder:i.__("Replace"),initialValue:null!==(s=e.replaceText)&&void 0!==s?s:"",onKeyDown:t=>e.onReplaceKeydown(t),onChange:t=>e.onChange(t),title:i.__("Replace"),autoFocus:!1,autoUpdate:!1}),(null===(r=e.replaceOptionsSupport)||void 0===r?void 0:r.preserveCase)?C.createElement("button",{className:M,onClick:()=>e.onPreserveCaseToggled(),tabIndex:0,title:i.__("Preserve Case")},C.createElement(u.caseSensitiveIcon.react,{className:n,tag:"span"})):null),C.createElement("button",{className:T,onClick:()=>e.onReplaceCurrent(),tabIndex:0},C.createElement("span",{className:`${N} ${P}`,tabIndex:0},i.__("Replace"))),C.createElement("button",{className:T,tabIndex:0,onClick:()=>e.onReplaceAll()},C.createElement("span",{className:`${N} ${P}`,tabIndex:-1},i.__("Replace All"))))}function O(e){var t,s;const r=null===(t=e.keyBindings)||void 0===t?void 0:t.next,i=null===(s=e.keyBindings)||void 0===s?void 0:s.previous,n=r?v.CommandRegistry.formatKeystroke(r.keys):"",a=i?v.CommandRegistry.formatKeystroke(i.keys):"",o=a?` (${a})`:"",l=n?` (${n})`:"";return C.createElement("div",{className:"jp-DocumentSearch-up-down-wrapper"},C.createElement("button",{className:M,onClick:()=>e.onHighlightPrevious(),tabIndex:0,title:`${e.trans.__("Previous Match")}${o}`},C.createElement(u.caretUpEmptyThinIcon.react,{className:(0,u.classes)(R,P),tag:"span"})),C.createElement("button",{className:M,onClick:()=>e.onHighlightNext(),tabIndex:0,title:`${e.trans.__("Next Match")}${l}`},C.createElement(u.caretDownEmptyThinIcon.react,{className:(0,u.classes)(R,P),tag:"span"})))}function j(e){return C.createElement("div",{className:"jp-DocumentSearch-index-counter"},0===e.totalMatches?"-/-":`${null===e.currentIndex?"-":e.currentIndex+1}/${e.totalMatches}`)}function A(e){let t=`jp-DocumentSearch-filter-button ${P}`;e.visible&&(t=`${t} jp-DocumentSearch-filter-button-enabled`);const s=e.anyEnabled?u.filterDotIcon:u.filterIcon;return C.createElement("button",{className:M,onClick:()=>e.toggleVisible(),tabIndex:0,title:e.visible?e.trans.__("Hide Search Filters"):e.trans.__("Show Search Filters")},C.createElement(s.react,{className:t,tag:"span",height:"20px",width:"20px"}))}function V(e){return C.createElement("label",{className:e.isEnabled?I:`${I} jp-DocumentSearch-search-filter-disabled`,title:e.description},C.createElement("input",{type:"checkbox",className:"jp-mod-styled",disabled:!e.isEnabled,checked:e.value,onChange:e.onToggle}),e.title)}class W extends C.Component{constructor(e){super(e),this.translator=e.translator||_.nullTranslator}_onSearchChange(e){const t=e.target.value;this.props.onSearchChanged(t)}_onSearchKeydown(e){if(13===e.keyCode)if(e.stopPropagation(),e.preventDefault(),e.ctrlKey){const t=e.target;this._insertNewLine(t),this.props.onSearchChanged(t.value)}else e.shiftKey?this.props.onHighlightPrevious():this.props.onHighlightNext()}_onReplaceKeydown(e){13===e.keyCode&&(e.stopPropagation(),e.preventDefault(),e.ctrlKey?this._insertNewLine(e.target):this.props.onReplaceCurrent())}_insertNewLine(e){const[t,s]=[e.selectionStart,e.selectionEnd];e.setRangeText("\n",t,s,"end")}_onClose(){this.props.onClose()}_onReplaceToggled(){if(!this.props.replaceEntryVisible)for(const e in this.props.filtersDefinition){const t=this.props.filtersDefinition[e];t.supportReplace||this.props.onFilterChanged(e,!1).catch((e=>{console.error(`Fail to update filter value for ${t.title}:\n${e}`)}))}this.props.onReplaceEntryShown(!this.props.replaceEntryVisible)}_toggleFiltersVisibility(){this.props.onFiltersVisibilityChanged(!this.props.filtersVisible)}render(){var e,t;const s=this.translator.load("jupyterlab"),r=!this.props.isReadOnly&&this.props.replaceEntryVisible,i=this.props.filtersDefinition,n=Object.keys(i).length>0,a=n?C.createElement(A,{visible:this.props.filtersVisible,anyEnabled:Object.keys(i).some((e=>{var t;const s=i[e];return null!==(t=this.props.filters[e])&&void 0!==t?t:s.default})),toggleVisible:()=>this._toggleFiltersVisibility(),trans:s}):null,o=null===(e=this.props.keyBindings)||void 0===e?void 0:e.toggleSearchInSelection,l=o?v.CommandRegistry.formatKeystroke(o.keys):"",h=l?` (${l})`:"",c=n?C.createElement("div",{className:"jp-DocumentSearch-search-options"},Object.keys(i).map((e=>{var t;const s=i[e];return C.createElement(V,{key:e,title:s.title,description:s.description+("selection"==e?h:""),isEnabled:!r||s.supportReplace,onToggle:async()=>{await this.props.onFilterChanged(e,!this.props.filters[e])},value:null!==(t=this.props.filters[e])&&void 0!==t?t:s.default})}))):null,d=this.props.replaceEntryVisible?u.caretDownIcon:u.caretRightIcon;return C.createElement(C.Fragment,null,C.createElement("div",{className:E},this.props.isReadOnly?C.createElement("div",{className:"jp-DocumentSearch-toggle-placeholder"}):C.createElement("button",{className:"jp-DocumentSearch-toggle-wrapper",onClick:()=>this._onReplaceToggled(),tabIndex:0,title:s.__("Toggle Replace")},C.createElement(d.react,{className:`jp-DocumentSearch-replace-toggle ${P}`,tag:"span",elementPosition:"center",height:"20px",width:"20px"})),C.createElement(k,{inputRef:this.props.searchInputRef,useRegex:this.props.useRegex,caseSensitive:this.props.caseSensitive,wholeWords:this.props.wholeWords,onCaseSensitiveToggled:this.props.onCaseSensitiveToggled,onRegexToggled:this.props.onRegexToggled,onWordToggled:this.props.onWordToggled,onKeydown:e=>this._onSearchKeydown(e),onChange:e=>this._onSearchChange(e),initialSearchText:this.props.initialSearchText,translator:this.translator}),a,C.createElement(j,{currentIndex:this.props.currentIndex,totalMatches:null!==(t=this.props.totalMatches)&&void 0!==t?t:0}),C.createElement(O,{onHighlightPrevious:()=>{this.props.onHighlightPrevious()},onHighlightNext:()=>{this.props.onHighlightNext()},trans:s,keyBindings:this.props.keyBindings}),C.createElement("button",{className:M,onClick:()=>this._onClose(),tabIndex:0},C.createElement(u.closeIcon.react,{className:"jp-icon-hover",elementPosition:"center",height:"16px",width:"16px"}))),C.createElement("div",{className:E},r?C.createElement(C.Fragment,null,C.createElement(F,{onPreserveCaseToggled:this.props.onPreserveCaseToggled,onReplaceKeydown:e=>this._onReplaceKeydown(e),onChange:e=>this.props.onReplaceChanged(e.target.value),onReplaceCurrent:()=>this.props.onReplaceCurrent(),onReplaceAll:()=>this.props.onReplaceAll(),replaceOptionsSupport:this.props.replaceOptionsSupport,replaceText:this.props.replaceText,preserveCase:this.props.preserveCase,translator:this.translator}),C.createElement("div",{className:"jp-DocumentSearch-spacer"})):null),this.props.filtersVisible?c:null,!!this.props.errorMessage&&C.createElement("div",{className:"jp-DocumentSearch-regex-error"},this.props.errorMessage))}}class L extends u.VDomRenderer{constructor(e,t,s){super(e),this.translator=t,this._showReplace=!1,this._showFilters=!1,this._closed=new i.Signal(this),this.addClass("jp-DocumentSearch-overlay"),this._searchInput=C.createRef(),this._keyBindings=s}get closed(){return this._closed}focusSearchInput(){var e;null===(e=this._searchInput.current)||void 0===e||e.select()}setSearchText(e){this.model.initialQuery=e,e&&(this.model.searchExpression=e)}setReplaceText(e){this.model.replaceText=e}showReplace(){this.setReplaceInputVisibility(!0)}onCloseRequest(e){super.onCloseRequest(e),this._closed.emit(),this.model.endQuery()}setReplaceInputVisibility(e){this._showReplace!==e&&(this._showReplace=e,this.update())}setFiltersVisibility(e){this._showFilters!==e&&(this._showFilters=e,this.update())}render(){return this.model.filtersDefinitionChanged?C.createElement(x.UseSignal,{signal:this.model.filtersDefinitionChanged},(()=>this._renderOverlay())):this._renderOverlay()}_renderOverlay(){return C.createElement(W,{caseSensitive:this.model.caseSensitive,currentIndex:this.model.currentIndex,isReadOnly:this.model.isReadOnly,errorMessage:this.model.parsingError,filters:this.model.filters,filtersDefinition:this.model.filtersDefinition,preserveCase:this.model.preserveCase,replaceEntryVisible:this._showReplace,filtersVisible:this._showFilters,replaceOptionsSupport:this.model.replaceOptionsSupport,replaceText:this.model.replaceText,initialSearchText:this.model.initialQuery,searchInputRef:this._searchInput,totalMatches:this.model.totalMatches,translator:this.translator,useRegex:this.model.useRegex,wholeWords:this.model.wholeWords,onCaseSensitiveToggled:()=>{this.model.caseSensitive=!this.model.caseSensitive},onRegexToggled:()=>{this.model.useRegex=!this.model.useRegex},onWordToggled:()=>{this.model.wholeWords=!this.model.wholeWords},onFilterChanged:async(e,t)=>{await this.model.setFilter(e,t)},onFiltersVisibilityChanged:e=>{this.setFiltersVisibility(e)},onHighlightNext:()=>{this.model.highlightNext()},onHighlightPrevious:()=>{this.model.highlightPrevious()},onPreserveCaseToggled:()=>{this.model.preserveCase=!this.model.preserveCase},onSearchChanged:e=>{this.model.searchExpression=e},onClose:()=>{this.close()},onReplaceEntryShown:e=>{this.setReplaceInputVisibility(e)},onReplaceChanged:e=>{this.model.replaceText=e},onReplaceCurrent:()=>{this.model.replaceCurrentMatch()},onReplaceAll:()=>{this.model.replaceAllMatches()},keyBindings:this._keyBindings})}}var U=s(2549);class Q{constructor(e=_.nullTranslator){this.translator=e,this._changed=new i.Signal(this),this._providerMap=new Map}add(e,t){return this._providerMap.set(e,t),this._changed.emit(),new U.DisposableDelegate((()=>{this._providerMap.delete(e),this._changed.emit()}))}getProvider(e){for(const t of this._providerMap.values())if(t.isApplicable(e))return t.createNew(e,this.translator)}hasProvider(e){for(const t of this._providerMap.values())if(t.isApplicable(e))return!0;return!1}get changed(){return this._changed}}const $=new(s(20998).Token)("@jupyterlab/documentsearch:ISearchProviderRegistry","A service for a registry of search\n providers for the application. Plugins can register their UI elements with this registry\n to provide find/replace support.")}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6999],{36999:(e,t,s)=>{s.r(t),s.d(t,{FOUND_CLASSES:()=>o,GenericSearchProvider:()=>c,HTMLSearchEngine:()=>h,ISearchProviderRegistry:()=>$,SearchDocumentModel:()=>m,SearchDocumentView:()=>L,SearchProvider:()=>n,SearchProviderRegistry:()=>Q,TextSearchEngine:()=>d});var r=s(63485),i=s(81997);class n{constructor(e){this.widget=e,this._stateChanged=new i.Signal(this),this._filtersChanged=new i.Signal(this),this._disposed=!1}get stateChanged(){return this._stateChanged}get filtersChanged(){return this._filtersChanged}get currentMatchIndex(){return null}get isDisposed(){return this._disposed}get matchesCount(){return null}dispose(){this._disposed||(this._disposed=!0,i.Signal.clearData(this))}getInitialQuery(){return""}getFilters(){return{}}static preserveCase(e,t){return e.toUpperCase()===e?t.toUpperCase():e.toLowerCase()===e?t.toLowerCase():a(e)===e?a(t):t}}function a([e="",...t]){return e.toUpperCase()+""+t.join("").toLowerCase()}const o=["cm-string","cm-overlay","cm-searching"],l=["CodeMirror-selectedtext"];class h{static search(e,t){if(!(t instanceof Node))return console.warn("Unable to search with HTMLSearchEngine the provided object.",t),Promise.resolve([]);e.global||(e=new RegExp(e.source,e.flags+"g"));const s=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:s=>{let r=s.parentElement;for(;r!==t;){if(r.nodeName in h.UNSUPPORTED_ELEMENTS)return NodeFilter.FILTER_REJECT;r=r.parentElement}return e.test(s.textContent)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let i=null;for(;null!==(i=r.nextNode());){e.lastIndex=0;let t=null;for(;null!==(t=e.exec(i.textContent));)s.push({text:t[0],position:t.index,node:i})}return Promise.resolve(s)}}h.UNSUPPORTED_ELEMENTS={BASE:!0,HEAD:!0,LINK:!0,META:!0,STYLE:!0,TITLE:!0,BODY:!0,AREA:!0,AUDIO:!0,IMG:!0,MAP:!0,TRACK:!0,VIDEO:!0,APPLET:!0,EMBED:!0,IFRAME:!0,NOEMBED:!0,OBJECT:!0,PARAM:!0,PICTURE:!0,SOURCE:!0,CANVAS:!0,NOSCRIPT:!0,SCRIPT:!0,SVG:!0};class c extends n{constructor(){super(...arguments),this.isReadOnly=!0,this._matches=[],this._mutationObserver=new MutationObserver(this._onWidgetChanged.bind(this)),this._markNodes=new Array}static isApplicable(e){return e instanceof r.Widget}static createNew(e,t,s){return new c(e)}get currentMatchIndex(){return this._currentMatchIndex>=0?this._currentMatchIndex:null}get currentMatch(){var e;return null!==(e=this._matches[this._currentMatchIndex])&&void 0!==e?e:null}get matches(){return this._matches?this._matches.map((e=>Object.assign({},e))):this._matches}get matchesCount(){return this._matches.length}clearHighlight(){return this._currentMatchIndex>=0&&this._markNodes[this._currentMatchIndex].classList.remove(...l),this._currentMatchIndex=-1,Promise.resolve()}dispose(){this.isDisposed||(this.endQuery().catch((e=>{console.error("Failed to end search query.",e)})),super.dispose())}async highlightNext(e){var t;return null!==(t=this._highlightNext(!1,null==e||e))&&void 0!==t?t:void 0}async highlightPrevious(e){var t;return null!==(t=this._highlightNext(!0,null==e||e))&&void 0!==t?t:void 0}async replaceCurrentMatch(e,t){return Promise.resolve(!1)}async replaceAllMatches(e){return Promise.resolve(!1)}async startQuery(e,t={}){if(await this.endQuery(),this._query=e,null===e)return Promise.resolve();const s=await h.search(e,this.widget.node);let r=0;for(;r<s.length;){let e=s[r].node,t=e.parentNode,i=[s[r]];for(;++r<s.length&&s[r].node===e;)i.unshift(s[r]);const n=i.map((s=>{const r=document.createElement("mark");r.classList.add(...o),r.textContent=s.text;const i=e.splitText(s.position);return i.textContent=i.textContent.slice(s.text.length),t.insertBefore(r,i),r}));for(let e=n.length-1;e>=0;e--)this._markNodes.push(n[e])}this._mutationObserver.observe(this.widget.node,{attributes:!1,characterData:!0,childList:!0,subtree:!0}),this._matches=s}async endQuery(){this._mutationObserver.disconnect(),this._markNodes.forEach((e=>{const t=e.parentNode;t.replaceChild(document.createTextNode(e.textContent),e),t.normalize()})),this._markNodes=[],this._matches=[],this._currentMatchIndex=-1}_highlightNext(e,t){if(0===this._matches.length)return null;if(-1===this._currentMatchIndex?this._currentMatchIndex=e?this.matches.length-1:0:(this._markNodes[this._currentMatchIndex].classList.remove(...l),this._currentMatchIndex=e?this._currentMatchIndex-1:this._currentMatchIndex+1,t&&(this._currentMatchIndex<0||this._currentMatchIndex>=this._matches.length)&&(this._currentMatchIndex=(this._currentMatchIndex+this._matches.length)%this._matches.length)),this._currentMatchIndex>=0&&this._currentMatchIndex<this._matches.length){const t=this._markNodes[this._currentMatchIndex];return t.classList.add(...l),function(e){const t=e.getBoundingClientRect();return t.top>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.left>=0&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}(t)||t.scrollIntoView(e),t.focus(),this._matches[this._currentMatchIndex]}return this._currentMatchIndex=-1,null}async _onWidgetChanged(e,t){this._currentMatchIndex=-1,await this.startQuery(this._query),this._stateChanged.emit()}}const d={search(e,t){if("string"!=typeof t)try{t=JSON.stringify(t)}catch(e){return console.warn("Unable to search with TextSearchEngine non-JSON serializable object.",e,t),Promise.resolve([])}e.global||(e=new RegExp(e.source,e.flags+"g"));const s=new Array;let r=null;for(;null!==(r=e.exec(t));)s.push({text:r[0],position:r.index});return Promise.resolve(s)}};var p,u=s(35613),g=s(97934);class m extends u.VDomModel{constructor(e,t){if(super(),this.searchProvider=e,this._caseSensitive=!1,this._disposed=new i.Signal(this),this._parsingError="",this._preserveCase=!1,this._initialQuery="",this._filters={},this._replaceText="",this._searchActive=!1,this._searchExpression="",this._useRegex=!1,this._wholeWords=!1,this._filters={},this.searchProvider.getFilters){const e=this.searchProvider.getFilters();for(const t in e)this._filters[t]=e[t].default}e.stateChanged.connect(this._onProviderStateChanged,this),this._searchDebouncer=new g.Debouncer((()=>{this._updateSearch().catch((e=>{console.error("Failed to update search on document.",e)}))}),t)}get caseSensitive(){return this._caseSensitive}set caseSensitive(e){this._caseSensitive!==e&&(this._caseSensitive=e,this.stateChanged.emit(),this.refresh())}get currentIndex(){return this.searchProvider.currentMatchIndex}get disposed(){return this._disposed}get filters(){return this._filters}get filtersDefinition(){var e,t,s;return null!==(s=null===(t=(e=this.searchProvider).getFilters)||void 0===t?void 0:t.call(e))&&void 0!==s?s:{}}get filtersDefinitionChanged(){return this.searchProvider.filtersChanged||null}get initialQuery(){return this._initialQuery}set initialQuery(e){this._initialQuery=e||this._searchExpression}get suggestedInitialQuery(){return this.searchProvider.getInitialQuery()}get selectionState(){return this.searchProvider.getSelectionState?this.searchProvider.getSelectionState():void 0}get isReadOnly(){return this.searchProvider.isReadOnly}get replaceOptionsSupport(){return this.searchProvider.replaceOptionsSupport}get parsingError(){return this._parsingError}get preserveCase(){return this._preserveCase}set preserveCase(e){this._preserveCase!==e&&(this._preserveCase=e,this.stateChanged.emit(),this.refresh())}get replaceText(){return this._replaceText}set replaceText(e){this._replaceText!==e&&(this._replaceText=e,this.stateChanged.emit())}get searchExpression(){return this._searchExpression}set searchExpression(e){this._searchExpression!==e&&(this._searchExpression=e,this.stateChanged.emit(),this.refresh())}get totalMatches(){return this.searchProvider.matchesCount}get useRegex(){return this._useRegex}set useRegex(e){this._useRegex!==e&&(this._useRegex=e,this.stateChanged.emit(),this.refresh())}get wholeWords(){return this._wholeWords}set wholeWords(e){this._wholeWords!==e&&(this._wholeWords=e,this.stateChanged.emit(),this.refresh())}dispose(){this.isDisposed||(this._searchExpression&&this.endQuery().catch((e=>{console.error(`Failed to end query '${this._searchExpression}.`,e)})),this.searchProvider.stateChanged.disconnect(this._onProviderStateChanged,this),this._searchDebouncer.dispose(),super.dispose())}async endQuery(){this._searchActive=!1,await this.searchProvider.endQuery(),this.stateChanged.emit()}async highlightNext(){await this.searchProvider.highlightNext(),this.stateChanged.emit()}async highlightPrevious(){await this.searchProvider.highlightPrevious(),this.stateChanged.emit()}refresh(){this._searchDebouncer.invoke().catch((e=>{console.error("Failed to invoke search document debouncer.",e)}))}async replaceAllMatches(){await this.searchProvider.replaceAllMatches(this._replaceText,{preserveCase:this.preserveCase,regularExpression:this.useRegex}),this.stateChanged.emit()}async replaceCurrentMatch(){await this.searchProvider.replaceCurrentMatch(this._replaceText,!0,{preserveCase:this.preserveCase,regularExpression:this.useRegex}),this.stateChanged.emit()}async setFilter(e,t){this._filters[e]!==t&&(this.searchProvider.validateFilter?(this._filters[e]=await this.searchProvider.validateFilter(e,t),this._filters[e]===t&&(this.stateChanged.emit(),this.refresh())):(this._filters[e]=t,this.stateChanged.emit(),this.refresh()))}async _updateSearch(){this._parsingError&&(this._parsingError="",this.stateChanged.emit());try{const e=this.searchExpression?p.parseQuery(this.searchExpression,this.caseSensitive,this.useRegex,this.wholeWords):null;e?(this._searchActive=!0,await this.searchProvider.startQuery(e,this._filters)):(this._searchActive=!1,await this.searchProvider.endQuery()),this.stateChanged.emit()}catch(e){this._parsingError=e.toString(),this.stateChanged.emit(),console.error(`Failed to parse expression ${this.searchExpression}`,e)}}_onProviderStateChanged(){this._searchActive&&this.refresh()}}!function(e){e.parseQuery=function(e,t,s,r){const i=t?"gm":"gim";let n=s?e:e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&");r&&(n="\\b"+n+"\\b");const a=new RegExp(n,i);return a.test("")?null:a}}(p||(p={}));var _=s(12030),v=s(16934),x=s(53312),C=s(78156);const E="jp-DocumentSearch-overlay-row",f="jp-DocumentSearch-input",y="jp-DocumentSearch-input-label",S="jp-DocumentSearch-input-wrapper",b="jp-DocumentSearch-input-button-off",w="jp-DocumentSearch-input-button-on",R="jp-DocumentSearch-up-down-button",I="jp-DocumentSearch-search-filter",N="jp-DocumentSearch-replace-button",T="jp-DocumentSearch-replace-button-wrapper",P="jp-DocumentSearch-button-content",M="jp-DocumentSearch-button-wrapper";function D(e){const[t,s]=(0,C.useState)(1),r=(0,C.useCallback)((t=>{var r;const i=t?t.target:null===(r=e.inputRef)||void 0===r?void 0:r.current;if(i){const e=i.value.split(/\n/);let t=e.reduce(((e,t)=>e.length>t.length?e:t),"");i.parentNode&&i.parentNode instanceof HTMLElement&&(i.parentNode.dataset.value=t),s(e.length)}}),[]);return(0,C.useEffect)((()=>{var t,s;null===(s=null===(t=e.inputRef)||void 0===t?void 0:t.current)||void 0===s||s.select(),r()}),[e.initialValue]),C.createElement("label",{className:y},C.createElement("textarea",{onChange:t=>{e.onChange(t),r(t)},onKeyDown:t=>{e.onKeyDown(t),r(t)},rows:t,placeholder:e.placeholder,className:f,key:e.autoUpdate?e.initialValue:null,tabIndex:0,ref:e.inputRef,title:e.title,defaultValue:e.initialValue,autoFocus:e.autoFocus}))}function k(e){var t;const s=(null!==(t=e.translator)&&void 0!==t?t:_.nullTranslator).load("jupyterlab"),r=(0,u.classes)(e.caseSensitive?w:b,P),i=(0,u.classes)(e.useRegex?w:b,P),n=(0,u.classes)(e.wholeWords?w:b,P),a=S;return C.createElement("div",{className:a},C.createElement(D,{placeholder:s.__("Find"),onChange:t=>e.onChange(t),onKeyDown:t=>e.onKeydown(t),inputRef:e.inputRef,initialValue:e.initialSearchText,title:s.__("Find"),autoFocus:!0,autoUpdate:!0}),C.createElement("button",{className:M,onClick:()=>{e.onCaseSensitiveToggled()},tabIndex:0,title:s.__("Match Case")},C.createElement(u.caseSensitiveIcon.react,{className:r,tag:"span"})),C.createElement("button",{className:M,onClick:()=>e.onWordToggled(),tabIndex:0,title:s.__("Match Whole Word")},C.createElement(u.wordIcon.react,{className:n,tag:"span"})),C.createElement("button",{className:M,onClick:()=>e.onRegexToggled(),tabIndex:0,title:s.__("Use Regular Expression")},C.createElement(u.regexIcon.react,{className:i,tag:"span"})))}function F(e){var t,s,r;const i=(null!==(t=e.translator)&&void 0!==t?t:_.nullTranslator).load("jupyterlab"),n=(0,u.classes)(e.preserveCase?w:b,P);return C.createElement("div",{className:"jp-DocumentSearch-replace-wrapper-class"},C.createElement("div",{className:S},C.createElement(D,{placeholder:i.__("Replace"),initialValue:null!==(s=e.replaceText)&&void 0!==s?s:"",onKeyDown:t=>e.onReplaceKeydown(t),onChange:t=>e.onChange(t),title:i.__("Replace"),autoFocus:!1,autoUpdate:!1}),(null===(r=e.replaceOptionsSupport)||void 0===r?void 0:r.preserveCase)?C.createElement("button",{className:M,onClick:()=>e.onPreserveCaseToggled(),tabIndex:0,title:i.__("Preserve Case")},C.createElement(u.caseSensitiveIcon.react,{className:n,tag:"span"})):null),C.createElement("button",{className:T,onClick:()=>e.onReplaceCurrent(),tabIndex:0},C.createElement("span",{className:`${N} ${P}`,tabIndex:0},i.__("Replace"))),C.createElement("button",{className:T,tabIndex:0,onClick:()=>e.onReplaceAll()},C.createElement("span",{className:`${N} ${P}`,tabIndex:-1},i.__("Replace All"))))}function O(e){var t,s;const r=null===(t=e.keyBindings)||void 0===t?void 0:t.next,i=null===(s=e.keyBindings)||void 0===s?void 0:s.previous,n=r?v.CommandRegistry.formatKeystroke(r.keys):"",a=i?v.CommandRegistry.formatKeystroke(i.keys):"",o=a?` (${a})`:"",l=n?` (${n})`:"",h=C.createElement("button",{className:M,onClick:()=>!!e.isEnabled&&e.onHighlightPrevious(),tabIndex:0,title:`${e.trans.__("Previous Match")}${o}`,disabled:!e.isEnabled},C.createElement(u.caretUpEmptyThinIcon.react,{className:(0,u.classes)(R,P),tag:"span"})),c=C.createElement("button",{className:M,onClick:()=>!!e.isEnabled&&e.onHighlightNext(),tabIndex:0,title:`${e.trans.__("Next Match")}${l}`,disabled:!e.isEnabled},C.createElement(u.caretDownEmptyThinIcon.react,{className:(0,u.classes)(R,P),tag:"span"}));return C.createElement("div",{className:"jp-DocumentSearch-up-down-wrapper"},h,c)}function j(e){return C.createElement("div",{className:"jp-DocumentSearch-index-counter"},0===e.totalMatches?"-/-":`${null===e.currentIndex?"-":e.currentIndex+1}/${e.totalMatches}`)}function A(e){let t=`jp-DocumentSearch-filter-button ${P}`;e.visible&&(t=`${t} jp-DocumentSearch-filter-button-enabled`);const s=e.anyEnabled?u.filterDotIcon:u.filterIcon;return C.createElement("button",{className:M,onClick:()=>e.toggleVisible(),tabIndex:0,title:e.visible?e.trans.__("Hide Search Filters"):e.trans.__("Show Search Filters")},C.createElement(s.react,{className:t,tag:"span",height:"20px",width:"20px"}))}function V(e){return C.createElement("label",{className:e.isEnabled?I:`${I} jp-DocumentSearch-search-filter-disabled`,title:e.description},C.createElement("input",{type:"checkbox",className:"jp-mod-styled",disabled:!e.isEnabled,checked:e.value,onChange:e.onToggle}),e.title)}class W extends C.Component{constructor(e){super(e),this.translator=e.translator||_.nullTranslator}_onSearchChange(e){const t=e.target.value;this.props.onSearchChanged(t)}_onSearchKeydown(e){if(13===e.keyCode)if(e.stopPropagation(),e.preventDefault(),e.ctrlKey){const t=e.target;this._insertNewLine(t),this.props.onSearchChanged(t.value)}else e.shiftKey?this.props.onHighlightPrevious():this.props.onHighlightNext()}_onReplaceKeydown(e){13===e.keyCode&&(e.stopPropagation(),e.preventDefault(),e.ctrlKey?this._insertNewLine(e.target):this.props.onReplaceCurrent())}_insertNewLine(e){const[t,s]=[e.selectionStart,e.selectionEnd];e.setRangeText("\n",t,s,"end")}_onClose(){this.props.onClose()}_onReplaceToggled(){if(!this.props.replaceEntryVisible)for(const e in this.props.filtersDefinition){const t=this.props.filtersDefinition[e];t.supportReplace||this.props.onFilterChanged(e,!1).catch((e=>{console.error(`Fail to update filter value for ${t.title}:\n${e}`)}))}this.props.onReplaceEntryShown(!this.props.replaceEntryVisible)}_toggleFiltersVisibility(){this.props.onFiltersVisibilityChanged(!this.props.filtersVisible)}render(){var e,t,s;const r=this.translator.load("jupyterlab"),i=!this.props.isReadOnly&&this.props.replaceEntryVisible,n=this.props.filtersDefinition,a=Object.keys(n).length>0,o=a?C.createElement(A,{visible:this.props.filtersVisible,anyEnabled:Object.keys(n).some((e=>{var t;const s=n[e];return null!==(t=this.props.filters[e])&&void 0!==t?t:s.default})),toggleVisible:()=>this._toggleFiltersVisibility(),trans:r}):null,l=null===(e=this.props.keyBindings)||void 0===e?void 0:e.toggleSearchInSelection,h=l?v.CommandRegistry.formatKeystroke(l.keys):"",c=h?` (${h})`:"",d=a?C.createElement("div",{className:"jp-DocumentSearch-search-options"},Object.keys(n).map((e=>{var t,s;const r=n[e],a=!i||r.supportReplace,o=a?r.description:null!==(t=r.disabledDescription)&&void 0!==t?t:r.description;return C.createElement(V,{key:e,title:r.title,description:o+("selection"==e?c:""),isEnabled:a,onToggle:async()=>{await this.props.onFilterChanged(e,!this.props.filters[e])},value:null!==(s=this.props.filters[e])&&void 0!==s?s:r.default})}))):null,p=this.props.replaceEntryVisible?u.caretDownIcon:u.caretRightIcon;return C.createElement(C.Fragment,null,C.createElement("div",{className:E},this.props.isReadOnly?C.createElement("div",{className:"jp-DocumentSearch-toggle-placeholder"}):C.createElement("button",{className:"jp-DocumentSearch-toggle-wrapper",onClick:()=>this._onReplaceToggled(),tabIndex:0,title:i?r.__("Hide Replace"):r.__("Show Replace")},C.createElement(p.react,{className:`jp-DocumentSearch-replace-toggle ${P}`,tag:"span",elementPosition:"center",height:"20px",width:"20px"})),C.createElement(k,{inputRef:this.props.searchInputRef,useRegex:this.props.useRegex,caseSensitive:this.props.caseSensitive,wholeWords:this.props.wholeWords,onCaseSensitiveToggled:this.props.onCaseSensitiveToggled,onRegexToggled:this.props.onRegexToggled,onWordToggled:this.props.onWordToggled,onKeydown:e=>this._onSearchKeydown(e),onChange:e=>this._onSearchChange(e),initialSearchText:this.props.initialSearchText,translator:this.translator}),o,C.createElement(j,{currentIndex:this.props.currentIndex,totalMatches:null!==(t=this.props.totalMatches)&&void 0!==t?t:0}),C.createElement(O,{onHighlightPrevious:()=>{this.props.onHighlightPrevious()},onHighlightNext:()=>{this.props.onHighlightNext()},trans:r,keyBindings:this.props.keyBindings,isEnabled:!!(null===(s=this.props.searchInputRef.current)||void 0===s?void 0:s.value)}),C.createElement("button",{className:M,onClick:()=>this._onClose(),tabIndex:0,title:r.__("Close Search Box")},C.createElement(u.closeIcon.react,{className:"jp-icon-hover",elementPosition:"center",height:"16px",width:"16px"}))),C.createElement("div",{className:E},i?C.createElement(C.Fragment,null,C.createElement(F,{onPreserveCaseToggled:this.props.onPreserveCaseToggled,onReplaceKeydown:e=>this._onReplaceKeydown(e),onChange:e=>this.props.onReplaceChanged(e.target.value),onReplaceCurrent:()=>this.props.onReplaceCurrent(),onReplaceAll:()=>this.props.onReplaceAll(),replaceOptionsSupport:this.props.replaceOptionsSupport,replaceText:this.props.replaceText,preserveCase:this.props.preserveCase,translator:this.translator}),C.createElement("div",{className:"jp-DocumentSearch-spacer"})):null),this.props.filtersVisible?d:null,!!this.props.errorMessage&&C.createElement("div",{className:"jp-DocumentSearch-regex-error"},this.props.errorMessage))}}class L extends u.VDomRenderer{constructor(e,t,s){super(e),this.translator=t,this._showReplace=!1,this._showFilters=!1,this._closed=new i.Signal(this),this.addClass("jp-DocumentSearch-overlay"),this._searchInput=C.createRef(),this._keyBindings=s}get closed(){return this._closed}focusSearchInput(){var e;null===(e=this._searchInput.current)||void 0===e||e.select()}setSearchText(e){this.model.initialQuery=e,e&&(this.model.searchExpression=e)}setReplaceText(e){this.model.replaceText=e}showReplace(){this.setReplaceInputVisibility(!0)}onCloseRequest(e){super.onCloseRequest(e),this._closed.emit(),this.model.endQuery()}setReplaceInputVisibility(e){this._showReplace!==e&&(this._showReplace=e,this.update())}setFiltersVisibility(e){this._showFilters!==e&&(this._showFilters=e,this.update())}render(){return this.model.filtersDefinitionChanged?C.createElement(x.UseSignal,{signal:this.model.filtersDefinitionChanged},(()=>this._renderOverlay())):this._renderOverlay()}_renderOverlay(){return C.createElement(W,{caseSensitive:this.model.caseSensitive,currentIndex:this.model.currentIndex,isReadOnly:this.model.isReadOnly,errorMessage:this.model.parsingError,filters:this.model.filters,filtersDefinition:this.model.filtersDefinition,preserveCase:this.model.preserveCase,replaceEntryVisible:this._showReplace,filtersVisible:this._showFilters,replaceOptionsSupport:this.model.replaceOptionsSupport,replaceText:this.model.replaceText,initialSearchText:this.model.initialQuery,searchInputRef:this._searchInput,totalMatches:this.model.totalMatches,translator:this.translator,useRegex:this.model.useRegex,wholeWords:this.model.wholeWords,onCaseSensitiveToggled:()=>{this.model.caseSensitive=!this.model.caseSensitive},onRegexToggled:()=>{this.model.useRegex=!this.model.useRegex},onWordToggled:()=>{this.model.wholeWords=!this.model.wholeWords},onFilterChanged:async(e,t)=>{await this.model.setFilter(e,t)},onFiltersVisibilityChanged:e=>{this.setFiltersVisibility(e)},onHighlightNext:()=>{this.model.highlightNext()},onHighlightPrevious:()=>{this.model.highlightPrevious()},onPreserveCaseToggled:()=>{this.model.preserveCase=!this.model.preserveCase},onSearchChanged:e=>{this.model.searchExpression=e},onClose:()=>{this.close()},onReplaceEntryShown:e=>{this.setReplaceInputVisibility(e)},onReplaceChanged:e=>{this.model.replaceText=e},onReplaceCurrent:()=>{this.model.replaceCurrentMatch()},onReplaceAll:()=>{this.model.replaceAllMatches()},keyBindings:this._keyBindings})}}var U=s(2549);class Q{constructor(e=_.nullTranslator){this.translator=e,this._changed=new i.Signal(this),this._providerMap=new Map}add(e,t){return this._providerMap.set(e,t),this._changed.emit(),new U.DisposableDelegate((()=>{this._providerMap.delete(e),this._changed.emit()}))}getProvider(e){for(const t of this._providerMap.values())if(t.isApplicable(e))return t.createNew(e,this.translator)}hasProvider(e){for(const t of this._providerMap.values())if(t.isApplicable(e))return!0;return!1}get changed(){return this._changed}}const $=new(s(20998).Token)("@jupyterlab/documentsearch:ISearchProviderRegistry","A service for a registry of search\n providers for the application. Plugins can register their UI elements with this registry\n to provide find/replace support.")}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7153],{74193:(e,t,n)=>{n.d(t,{a:()=>l});var r=n(51723);function l(e,t){var n=e.append("foreignObject").attr("width","100000"),l=n.append("xhtml:div");l.attr("xmlns","http://www.w3.org/1999/xhtml");var o=t.label;switch(typeof o){case"function":l.insert(o);break;case"object":l.insert((function(){return o}));break;default:l.html(o)}r.bg(l,t.labelStyle),l.style("display","inline-block"),l.style("white-space","nowrap");var a=l.node().getBoundingClientRect();return n.attr("width",a.width).attr("height",a.height),n}},51723:(e,t,n)=>{n.d(t,{$p:()=>d,O1:()=>a,WR:()=>p,bF:()=>o,bg:()=>c});var r=n(53541),l=n(48489);function o(e,t){return!!e.children(t).length}function a(e){return i(e.v)+":"+i(e.w)+":"+i(e.name)}var s=/:/g;function i(e){return e?String(e).replace(s,"\\:"):""}function c(e,t){t&&e.attr("style",t)}function d(e,t,n){t&&e.attr("class",t).attr("class",n+" "+e.attr("class"))}function p(e,t){var n=t.graph();if(r.Z(n)){var o=n.transition;if(l.Z(o))return o(e)}return e}},57153:(e,t,n)=>{n.d(t,{diagram:()=>a});var r=n(31261),l=n(3675),o=n(24028);n(23617),n(67406),n(7259),n(58038),n(27693),n(7608),n(31699);const a={parser:r.p,db:r.f,renderer:l.f,styles:l.a,init:e=>{e.flowchart||(e.flowchart={}),e.flowchart.arrowMarkerAbsolute=e.arrowMarkerAbsolute,(0,o.p)({flowchart:{arrowMarkerAbsolute:e.arrowMarkerAbsolute}}),l.f.setConf(e.flowchart),r.f.clear(),r.f.setGen("gen-2")}}},3675:(e,t,n)=>{n.d(t,{a:()=>h,f:()=>u});var r=n(67406),l=n(23617),o=n(24028),a=n(86281),s=n(74193),i=n(90267),c=n(42528);const d=(e,t)=>i.Z.lang.round(c.Z.parse(e)[t]);var p=n(14728);const b={},w=function(e,t,n,r,l,a){const i=r.select(`[id="${n}"]`);Object.keys(e).forEach((function(n){const r=e[n];let c="default";r.classes.length>0&&(c=r.classes.join(" ")),c+=" flowchart-label";const d=(0,o.k)(r.styles);let p,b=void 0!==r.text?r.text:r.id;if(o.l.info("vertex",r,r.labelType),"markdown"===r.labelType)o.l.info("vertex",r,r.labelType);else if((0,o.m)((0,o.c)().flowchart.htmlLabels)){const e={label:b.replace(/fa[blrs]?:fa-[\w-]+/g,(e=>`<i class='${e.replace(":"," ")}'></i>`))};p=(0,s.a)(i,e).node(),p.parentNode.removeChild(p)}else{const e=l.createElementNS("http://www.w3.org/2000/svg","text");e.setAttribute("style",d.labelStyle.replace("color:","fill:"));const t=b.split(o.e.lineBreakRegex);for(const n of t){const t=l.createElementNS("http://www.w3.org/2000/svg","tspan");t.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),t.setAttribute("dy","1em"),t.setAttribute("x","1"),t.textContent=n,e.appendChild(t)}p=e}let w=0,f="";switch(r.type){case"round":w=5,f="rect";break;case"square":case"group":default:f="rect";break;case"diamond":f="question";break;case"hexagon":f="hexagon";break;case"odd":case"odd_right":f="rect_left_inv_arrow";break;case"lean_right":f="lean_right";break;case"lean_left":f="lean_left";break;case"trapezoid":f="trapezoid";break;case"inv_trapezoid":f="inv_trapezoid";break;case"circle":f="circle";break;case"ellipse":f="ellipse";break;case"stadium":f="stadium";break;case"subroutine":f="subroutine";break;case"cylinder":f="cylinder";break;case"doublecircle":f="doublecircle"}t.setNode(r.id,{labelStyle:d.labelStyle,shape:f,labelText:b,labelType:r.labelType,rx:w,ry:w,class:c,style:d.style,id:r.id,link:r.link,linkTarget:r.linkTarget,tooltip:a.db.getTooltip(r.id)||"",domId:a.db.lookUpDomId(r.id),haveCallback:r.haveCallback,width:"group"===r.type?500:void 0,dir:r.dir,type:r.type,props:r.props,padding:(0,o.c)().flowchart.padding}),o.l.info("setNode",{labelStyle:d.labelStyle,labelType:r.labelType,shape:f,labelText:b,rx:w,ry:w,class:c,style:d.style,id:r.id,domId:a.db.lookUpDomId(r.id),width:"group"===r.type?500:void 0,type:r.type,dir:r.dir,props:r.props,padding:(0,o.c)().flowchart.padding})}))},f=function(e,t,n){o.l.info("abc78 edges = ",e);let r,a,s=0,i={};if(void 0!==e.defaultStyle){const t=(0,o.k)(e.defaultStyle);r=t.style,a=t.labelStyle}e.forEach((function(n){s++;const c="L-"+n.start+"-"+n.end;void 0===i[c]?(i[c]=0,o.l.info("abc78 new entry",c,i[c])):(i[c]++,o.l.info("abc78 new entry",c,i[c]));let d=c+"-"+i[c];o.l.info("abc78 new link id to be used is",c,d,i[c]);const p="LS-"+n.start,w="LE-"+n.end,f={style:"",labelStyle:""};switch(f.minlen=n.length||1,"arrow_open"===n.type?f.arrowhead="none":f.arrowhead="normal",f.arrowTypeStart="arrow_open",f.arrowTypeEnd="arrow_open",n.type){case"double_arrow_cross":f.arrowTypeStart="arrow_cross";case"arrow_cross":f.arrowTypeEnd="arrow_cross";break;case"double_arrow_point":f.arrowTypeStart="arrow_point";case"arrow_point":f.arrowTypeEnd="arrow_point";break;case"double_arrow_circle":f.arrowTypeStart="arrow_circle";case"arrow_circle":f.arrowTypeEnd="arrow_circle"}let u="",h="";switch(n.stroke){case"normal":u="fill:none;",void 0!==r&&(u=r),void 0!==a&&(h=a),f.thickness="normal",f.pattern="solid";break;case"dotted":f.thickness="normal",f.pattern="dotted",f.style="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":f.thickness="thick",f.pattern="solid",f.style="stroke-width: 3.5px;fill:none;";break;case"invisible":f.thickness="invisible",f.pattern="solid",f.style="stroke-width: 0;fill:none;"}if(void 0!==n.style){const e=(0,o.k)(n.style);u=e.style,h=e.labelStyle}f.style=f.style+=u,f.labelStyle=f.labelStyle+=h,void 0!==n.interpolate?f.curve=(0,o.n)(n.interpolate,l.c_6):void 0!==e.defaultInterpolate?f.curve=(0,o.n)(e.defaultInterpolate,l.c_6):f.curve=(0,o.n)(b.curve,l.c_6),void 0===n.text?void 0!==n.style&&(f.arrowheadStyle="fill: #333"):(f.arrowheadStyle="fill: #333",f.labelpos="c"),f.labelType=n.labelType,f.label=n.text.replace(o.e.lineBreakRegex,"\n"),void 0===n.style&&(f.style=f.style||"stroke: #333; stroke-width: 1.5px;fill:none;"),f.labelStyle=f.labelStyle.replace("color:","fill:"),f.id=d,f.classes="flowchart-link "+p+" "+w,t.setEdge(n.start,n.end,f,s)}))},u={setConf:function(e){const t=Object.keys(e);for(const n of t)b[n]=e[n]},addVertices:w,addEdges:f,getClasses:function(e,t){return t.db.getClasses()},draw:async function(e,t,n,s){o.l.info("Drawing flowchart");let i=s.db.getDirection();void 0===i&&(i="TD");const{securityLevel:c,flowchart:d}=(0,o.c)(),p=d.nodeSpacing||50,b=d.rankSpacing||50;let u;"sandbox"===c&&(u=(0,l.Ys)("#i"+t));const h="sandbox"===c?(0,l.Ys)(u.nodes()[0].contentDocument.body):(0,l.Ys)("body"),g="sandbox"===c?u.nodes()[0].contentDocument:document,y=new r.k({multigraph:!0,compound:!0}).setGraph({rankdir:i,nodesep:p,ranksep:b,marginx:0,marginy:0}).setDefaultEdgeLabel((function(){return{}}));let k;const x=s.db.getSubGraphs();o.l.info("Subgraphs - ",x);for(let e=x.length-1;e>=0;e--)k=x[e],o.l.info("Subgraph - ",k),s.db.addVertex(k.id,{text:k.title,type:k.labelType},"group",void 0,k.classes,k.dir);const v=s.db.getVertices(),m=s.db.getEdges();o.l.info("Edges",m);let T=0;for(T=x.length-1;T>=0;T--){k=x[T],(0,l.td_)("cluster").append("text");for(let e=0;e<k.nodes.length;e++)o.l.info("Setting up subgraphs",k.nodes[e],k.id),y.setParent(k.nodes[e],k.id)}w(v,y,t,h,g,s),f(m,y);const S=h.select(`[id="${t}"]`),_=h.select("#"+t+" g");if(await(0,a.r)(_,y,["point","circle","cross"],"flowchart",t),o.u.insertTitle(S,"flowchartTitleText",d.titleTopMargin,s.db.getDiagramTitle()),(0,o.o)(y,S,d.diagramPadding,d.useMaxWidth),s.db.indexNodes("subGraph"+T),!d.htmlLabels){const e=g.querySelectorAll('[id="'+t+'"] .edgeLabel .label');for(const t of e){const e=t.getBBox(),n=g.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("rx",0),n.setAttribute("ry",0),n.setAttribute("width",e.width),n.setAttribute("height",e.height),t.insertBefore(n,t.firstChild)}}Object.keys(v).forEach((function(e){const n=v[e];if(n.link){const r=(0,l.Ys)("#"+t+' [id="'+e+'"]');if(r){const e=g.createElementNS("http://www.w3.org/2000/svg","a");e.setAttributeNS("http://www.w3.org/2000/svg","class",n.classes.join(" ")),e.setAttributeNS("http://www.w3.org/2000/svg","href",n.link),e.setAttributeNS("http://www.w3.org/2000/svg","rel","noopener"),"sandbox"===c?e.setAttributeNS("http://www.w3.org/2000/svg","target","_top"):n.linkTarget&&e.setAttributeNS("http://www.w3.org/2000/svg","target",n.linkTarget);const t=r.insert((function(){return e}),":first-child"),l=r.select(".label-container");l&&t.append((function(){return l.node()}));const o=r.select(".label");o&&t.append((function(){return o.node()}))}}}))}},h=e=>`.label {\n font-family: ${e.fontFamily};\n color: ${e.nodeTextColor||e.textColor};\n }\n .cluster-label text {\n fill: ${e.titleColor};\n }\n .cluster-label span,p {\n color: ${e.titleColor};\n }\n\n .label text,span,p {\n fill: ${e.nodeTextColor||e.textColor};\n color: ${e.nodeTextColor||e.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${e.mainBkg};\n stroke: ${e.nodeBorder};\n stroke-width: 1px;\n }\n .flowchart-label text {\n text-anchor: middle;\n }\n // .flowchart-label .text-outer-tspan {\n // text-anchor: middle;\n // }\n // .flowchart-label .text-inner-tspan {\n // text-anchor: start;\n // }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${e.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${e.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${e.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${e.edgeLabelBackground};\n rect {\n opacity: 0.5;\n background-color: ${e.edgeLabelBackground};\n fill: ${e.edgeLabelBackground};\n }\n text-align: center;\n }\n\n /* For html labels only */\n .labelBkg {\n background-color: ${((e,t)=>{const n=d,r=n(e,"r"),l=n(e,"g"),o=n(e,"b");return p.Z(r,l,o,.5)})(e.edgeLabelBackground)};\n // background-color: \n }\n\n .cluster rect {\n fill: ${e.clusterBkg};\n stroke: ${e.clusterBorder};\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${e.titleColor};\n }\n\n .cluster span,p {\n color: ${e.titleColor};\n }\n /* .cluster div {\n color: ${e.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${e.fontFamily};\n font-size: 12px;\n background: ${e.tertiaryColor};\n border: 1px solid ${e.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${e.textColor};\n }\n`}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7153],{74193:(e,t,n)=>{n.d(t,{a:()=>l});var r=n(51723);function l(e,t){var n=e.append("foreignObject").attr("width","100000"),l=n.append("xhtml:div");l.attr("xmlns","http://www.w3.org/1999/xhtml");var o=t.label;switch(typeof o){case"function":l.insert(o);break;case"object":l.insert((function(){return o}));break;default:l.html(o)}r.bg(l,t.labelStyle),l.style("display","inline-block"),l.style("white-space","nowrap");var a=l.node().getBoundingClientRect();return n.attr("width",a.width).attr("height",a.height),n}},51723:(e,t,n)=>{n.d(t,{$p:()=>d,O1:()=>a,WR:()=>p,bF:()=>o,bg:()=>c});var r=n(53541),l=n(48489);function o(e,t){return!!e.children(t).length}function a(e){return i(e.v)+":"+i(e.w)+":"+i(e.name)}var s=/:/g;function i(e){return e?String(e).replace(s,"\\:"):""}function c(e,t){t&&e.attr("style",t)}function d(e,t,n){t&&e.attr("class",t).attr("class",n+" "+e.attr("class"))}function p(e,t){var n=t.graph();if(r.Z(n)){var o=n.transition;if(l.Z(o))return o(e)}return e}},57153:(e,t,n)=>{n.d(t,{diagram:()=>a});var r=n(31261),l=n(3675),o=n(24028);n(23617),n(67406),n(7259),n(81779),n(27693),n(7608),n(31699);const a={parser:r.p,db:r.f,renderer:l.f,styles:l.a,init:e=>{e.flowchart||(e.flowchart={}),e.flowchart.arrowMarkerAbsolute=e.arrowMarkerAbsolute,(0,o.p)({flowchart:{arrowMarkerAbsolute:e.arrowMarkerAbsolute}}),l.f.setConf(e.flowchart),r.f.clear(),r.f.setGen("gen-2")}}},3675:(e,t,n)=>{n.d(t,{a:()=>h,f:()=>u});var r=n(67406),l=n(23617),o=n(24028),a=n(86281),s=n(74193),i=n(90267),c=n(42528);const d=(e,t)=>i.Z.lang.round(c.Z.parse(e)[t]);var p=n(14728);const b={},w=function(e,t,n,r,l,a){const i=r.select(`[id="${n}"]`);Object.keys(e).forEach((function(n){const r=e[n];let c="default";r.classes.length>0&&(c=r.classes.join(" ")),c+=" flowchart-label";const d=(0,o.k)(r.styles);let p,b=void 0!==r.text?r.text:r.id;if(o.l.info("vertex",r,r.labelType),"markdown"===r.labelType)o.l.info("vertex",r,r.labelType);else if((0,o.m)((0,o.c)().flowchart.htmlLabels)){const e={label:b.replace(/fa[blrs]?:fa-[\w-]+/g,(e=>`<i class='${e.replace(":"," ")}'></i>`))};p=(0,s.a)(i,e).node(),p.parentNode.removeChild(p)}else{const e=l.createElementNS("http://www.w3.org/2000/svg","text");e.setAttribute("style",d.labelStyle.replace("color:","fill:"));const t=b.split(o.e.lineBreakRegex);for(const n of t){const t=l.createElementNS("http://www.w3.org/2000/svg","tspan");t.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),t.setAttribute("dy","1em"),t.setAttribute("x","1"),t.textContent=n,e.appendChild(t)}p=e}let w=0,f="";switch(r.type){case"round":w=5,f="rect";break;case"square":case"group":default:f="rect";break;case"diamond":f="question";break;case"hexagon":f="hexagon";break;case"odd":case"odd_right":f="rect_left_inv_arrow";break;case"lean_right":f="lean_right";break;case"lean_left":f="lean_left";break;case"trapezoid":f="trapezoid";break;case"inv_trapezoid":f="inv_trapezoid";break;case"circle":f="circle";break;case"ellipse":f="ellipse";break;case"stadium":f="stadium";break;case"subroutine":f="subroutine";break;case"cylinder":f="cylinder";break;case"doublecircle":f="doublecircle"}t.setNode(r.id,{labelStyle:d.labelStyle,shape:f,labelText:b,labelType:r.labelType,rx:w,ry:w,class:c,style:d.style,id:r.id,link:r.link,linkTarget:r.linkTarget,tooltip:a.db.getTooltip(r.id)||"",domId:a.db.lookUpDomId(r.id),haveCallback:r.haveCallback,width:"group"===r.type?500:void 0,dir:r.dir,type:r.type,props:r.props,padding:(0,o.c)().flowchart.padding}),o.l.info("setNode",{labelStyle:d.labelStyle,labelType:r.labelType,shape:f,labelText:b,rx:w,ry:w,class:c,style:d.style,id:r.id,domId:a.db.lookUpDomId(r.id),width:"group"===r.type?500:void 0,type:r.type,dir:r.dir,props:r.props,padding:(0,o.c)().flowchart.padding})}))},f=function(e,t,n){o.l.info("abc78 edges = ",e);let r,a,s=0,i={};if(void 0!==e.defaultStyle){const t=(0,o.k)(e.defaultStyle);r=t.style,a=t.labelStyle}e.forEach((function(n){s++;const c="L-"+n.start+"-"+n.end;void 0===i[c]?(i[c]=0,o.l.info("abc78 new entry",c,i[c])):(i[c]++,o.l.info("abc78 new entry",c,i[c]));let d=c+"-"+i[c];o.l.info("abc78 new link id to be used is",c,d,i[c]);const p="LS-"+n.start,w="LE-"+n.end,f={style:"",labelStyle:""};switch(f.minlen=n.length||1,"arrow_open"===n.type?f.arrowhead="none":f.arrowhead="normal",f.arrowTypeStart="arrow_open",f.arrowTypeEnd="arrow_open",n.type){case"double_arrow_cross":f.arrowTypeStart="arrow_cross";case"arrow_cross":f.arrowTypeEnd="arrow_cross";break;case"double_arrow_point":f.arrowTypeStart="arrow_point";case"arrow_point":f.arrowTypeEnd="arrow_point";break;case"double_arrow_circle":f.arrowTypeStart="arrow_circle";case"arrow_circle":f.arrowTypeEnd="arrow_circle"}let u="",h="";switch(n.stroke){case"normal":u="fill:none;",void 0!==r&&(u=r),void 0!==a&&(h=a),f.thickness="normal",f.pattern="solid";break;case"dotted":f.thickness="normal",f.pattern="dotted",f.style="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":f.thickness="thick",f.pattern="solid",f.style="stroke-width: 3.5px;fill:none;";break;case"invisible":f.thickness="invisible",f.pattern="solid",f.style="stroke-width: 0;fill:none;"}if(void 0!==n.style){const e=(0,o.k)(n.style);u=e.style,h=e.labelStyle}f.style=f.style+=u,f.labelStyle=f.labelStyle+=h,void 0!==n.interpolate?f.curve=(0,o.n)(n.interpolate,l.c_6):void 0!==e.defaultInterpolate?f.curve=(0,o.n)(e.defaultInterpolate,l.c_6):f.curve=(0,o.n)(b.curve,l.c_6),void 0===n.text?void 0!==n.style&&(f.arrowheadStyle="fill: #333"):(f.arrowheadStyle="fill: #333",f.labelpos="c"),f.labelType=n.labelType,f.label=n.text.replace(o.e.lineBreakRegex,"\n"),void 0===n.style&&(f.style=f.style||"stroke: #333; stroke-width: 1.5px;fill:none;"),f.labelStyle=f.labelStyle.replace("color:","fill:"),f.id=d,f.classes="flowchart-link "+p+" "+w,t.setEdge(n.start,n.end,f,s)}))},u={setConf:function(e){const t=Object.keys(e);for(const n of t)b[n]=e[n]},addVertices:w,addEdges:f,getClasses:function(e,t){return t.db.getClasses()},draw:async function(e,t,n,s){o.l.info("Drawing flowchart");let i=s.db.getDirection();void 0===i&&(i="TD");const{securityLevel:c,flowchart:d}=(0,o.c)(),p=d.nodeSpacing||50,b=d.rankSpacing||50;let u;"sandbox"===c&&(u=(0,l.Ys)("#i"+t));const h="sandbox"===c?(0,l.Ys)(u.nodes()[0].contentDocument.body):(0,l.Ys)("body"),g="sandbox"===c?u.nodes()[0].contentDocument:document,y=new r.k({multigraph:!0,compound:!0}).setGraph({rankdir:i,nodesep:p,ranksep:b,marginx:0,marginy:0}).setDefaultEdgeLabel((function(){return{}}));let k;const x=s.db.getSubGraphs();o.l.info("Subgraphs - ",x);for(let e=x.length-1;e>=0;e--)k=x[e],o.l.info("Subgraph - ",k),s.db.addVertex(k.id,{text:k.title,type:k.labelType},"group",void 0,k.classes,k.dir);const v=s.db.getVertices(),m=s.db.getEdges();o.l.info("Edges",m);let T=0;for(T=x.length-1;T>=0;T--){k=x[T],(0,l.td_)("cluster").append("text");for(let e=0;e<k.nodes.length;e++)o.l.info("Setting up subgraphs",k.nodes[e],k.id),y.setParent(k.nodes[e],k.id)}w(v,y,t,h,g,s),f(m,y);const S=h.select(`[id="${t}"]`),_=h.select("#"+t+" g");if(await(0,a.r)(_,y,["point","circle","cross"],"flowchart",t),o.u.insertTitle(S,"flowchartTitleText",d.titleTopMargin,s.db.getDiagramTitle()),(0,o.o)(y,S,d.diagramPadding,d.useMaxWidth),s.db.indexNodes("subGraph"+T),!d.htmlLabels){const e=g.querySelectorAll('[id="'+t+'"] .edgeLabel .label');for(const t of e){const e=t.getBBox(),n=g.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("rx",0),n.setAttribute("ry",0),n.setAttribute("width",e.width),n.setAttribute("height",e.height),t.insertBefore(n,t.firstChild)}}Object.keys(v).forEach((function(e){const n=v[e];if(n.link){const r=(0,l.Ys)("#"+t+' [id="'+e+'"]');if(r){const e=g.createElementNS("http://www.w3.org/2000/svg","a");e.setAttributeNS("http://www.w3.org/2000/svg","class",n.classes.join(" ")),e.setAttributeNS("http://www.w3.org/2000/svg","href",n.link),e.setAttributeNS("http://www.w3.org/2000/svg","rel","noopener"),"sandbox"===c?e.setAttributeNS("http://www.w3.org/2000/svg","target","_top"):n.linkTarget&&e.setAttributeNS("http://www.w3.org/2000/svg","target",n.linkTarget);const t=r.insert((function(){return e}),":first-child"),l=r.select(".label-container");l&&t.append((function(){return l.node()}));const o=r.select(".label");o&&t.append((function(){return o.node()}))}}}))}},h=e=>`.label {\n font-family: ${e.fontFamily};\n color: ${e.nodeTextColor||e.textColor};\n }\n .cluster-label text {\n fill: ${e.titleColor};\n }\n .cluster-label span,p {\n color: ${e.titleColor};\n }\n\n .label text,span,p {\n fill: ${e.nodeTextColor||e.textColor};\n color: ${e.nodeTextColor||e.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${e.mainBkg};\n stroke: ${e.nodeBorder};\n stroke-width: 1px;\n }\n .flowchart-label text {\n text-anchor: middle;\n }\n // .flowchart-label .text-outer-tspan {\n // text-anchor: middle;\n // }\n // .flowchart-label .text-inner-tspan {\n // text-anchor: start;\n // }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${e.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${e.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${e.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${e.edgeLabelBackground};\n rect {\n opacity: 0.5;\n background-color: ${e.edgeLabelBackground};\n fill: ${e.edgeLabelBackground};\n }\n text-align: center;\n }\n\n /* For html labels only */\n .labelBkg {\n background-color: ${((e,t)=>{const n=d,r=n(e,"r"),l=n(e,"g"),o=n(e,"b");return p.Z(r,l,o,.5)})(e.edgeLabelBackground)};\n // background-color: \n }\n\n .cluster rect {\n fill: ${e.clusterBkg};\n stroke: ${e.clusterBorder};\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${e.titleColor};\n }\n\n .cluster span,p {\n color: ${e.titleColor};\n }\n /* .cluster div {\n color: ${e.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${e.fontFamily};\n font-size: 12px;\n background: ${e.tertiaryColor};\n border: 1px solid ${e.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${e.textColor};\n }\n`}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7226],{47226:(t,e,s)=>{s.r(e),s.d(e,{OutputArea:()=>x,OutputAreaModel:()=>d,OutputPrompt:()=>w,SimplifiedOutputArea:()=>v,Stdin:()=>O});var i,n=s(85923),r=s(11351),a=s(70856),o=s(33625),h=s(20998),u=s(81997);class d{constructor(t={}){if(this.clearNext=!1,this._lastStream="",this._trusted=!1,this._isDisposed=!1,this._stateChanged=new u.Signal(this),this._changed=new u.Signal(this),this._trusted=!!t.trusted,this.contentFactory=t.contentFactory||d.defaultContentFactory,this.list=new r.ObservableList,t.values)for(const e of t.values){const t=this._add(e)-1;this.list.get(t).changed.connect(this._onGenericChange,this)}this.list.changed.connect(this._onListChanged,this)}get stateChanged(){return this._stateChanged}get changed(){return this._changed}get length(){return this.list?this.list.length:0}get trusted(){return this._trusted}set trusted(t){if(t===this._trusted)return;const e=this._trusted=t;for(let t=0;t<this.list.length;t++){const s=this.list.get(t),i=s.toJSON(),n=this._createItem({value:i,trusted:e});this.list.set(t,n),s.dispose()}}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this.list.dispose(),u.Signal.clearData(this))}get(t){return this.list.get(t)}set(t,e){e=h.JSONExt.deepCopy(e),i.normalize(e);const s=this._createItem({value:e,trusted:this._trusted});this.list.set(t,s)}add(t){return this.clearNext&&(this.clear(),this.clearNext=!1),this._add(t)}clear(t=!1){if(this._lastStream="",t)this.clearNext=!0;else{for(const t of this.list)t.dispose();this.list.clear()}}fromJSON(t){this.clear();for(const e of t)this._add(e)}toJSON(){return Array.from((0,o.map)(this.list,(t=>t.toJSON())))}_add(t){const e=this._trusted;if(t=h.JSONExt.deepCopy(t),i.normalize(t),n.isStream(t)&&this._lastStream&&t.name===this._lastName&&this.shouldCombine({value:t,lastModel:this.list.get(this.length-1)})){this._lastStream+=t.text,this._lastStream=i.removeOverwrittenChars(this._lastStream),t.text=this._lastStream;const s=this._createItem({value:t,trusted:e}),n=this.length-1,r=this.list.get(n);return this.list.set(n,s),r.dispose(),this.length}n.isStream(t)&&(t.text=i.removeOverwrittenChars(t.text));const s=this._createItem({value:t,trusted:e});return n.isStream(t)?(this._lastStream=t.text,this._lastName=t.name):this._lastStream="",this.list.push(s)}shouldCombine(t){return!0}_createItem(t){return this.contentFactory.createOutputModel(t)}_onListChanged(t,e){switch(e.type){case"add":e.newValues.forEach((t=>{t.changed.connect(this._onGenericChange,this)}));break;case"remove":e.oldValues.forEach((t=>{t.changed.disconnect(this._onGenericChange,this)}));break;case"set":e.newValues.forEach((t=>{t.changed.connect(this._onGenericChange,this)})),e.oldValues.forEach((t=>{t.changed.disconnect(this._onGenericChange,this)}))}this._changed.emit(e)}_onGenericChange(t){let e,s=null;for(e=0;e<this.list.length&&(s=this.list.get(e),s!==t);e++);null!=s&&(this._stateChanged.emit(e),this._changed.emit({type:"set",newIndex:e,oldIndex:e,oldValues:[s],newValues:[s]}))}}!function(t){class e{createOutputModel(t){return new a.OutputModel(t)}}t.ContentFactory=e,t.defaultContentFactory=new e}(d||(d={})),function(t){t.normalize=function(t){n.isStream(t)&&Array.isArray(t.text)&&(t.text=t.text.join("\n"))},t.removeOverwrittenChars=function(t){return function(t){for(t=t.replace(/\r+\n/gm,"\n");t.search(/\r[^$]/g)>-1;){const e=t.match(/^(.*)\r+/m)[1];let s=t.match(/\r+(.*)$/m)[1];s+=e.slice(s.length,e.length),t=t.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,s)}return t}(function(t){let e=t;do{e=(t=e).replace(/[^\n]\x08/gm,"")}while(e.length<t.length);return t}(t))}}(i||(i={}));var l=s(12982),c=s(16954),p=s(71677),m=s(14421),_=s(31516);const g="jp-OutputArea-child",y="jp-OutputArea-output",f="jp-OutputArea-prompt";class x extends _.Widget{constructor(t){var e,s,i,n;super(),this.outputLengthChanged=new u.Signal(this),this._onIOPub=t=>{const e=this.model,s=t.header.msg_type;let i;const n=(t.content.transient||{}).display_id;let r;switch(s){case"execute_result":case"display_data":case"stream":case"error":i={...t.content,output_type:s},e.add(i);break;case"clear_output":{const s=t.content.wait;e.clear(s);break}case"update_display_data":if(i={...t.content,output_type:"display_data"},r=this._displayIdMap.get(n),r)for(const t of r)e.set(t,i)}n&&"display_data"===s&&(r=this._displayIdMap.get(n)||[],r.push(e.length-1),this._displayIdMap.set(n,r))},this._onExecuteReply=t=>{const e=this.model,s=t.content;if("ok"!==s.status)return;const i=s&&s.payload;if(!i||!i.length)return;const n=i.filter((t=>"page"===t.source));if(!n.length)return;const r={output_type:"display_data",data:JSON.parse(JSON.stringify(n[0])).data,metadata:{}};e.add(r)},this._displayIdMap=new Map,this._minHeightTimeout=null,this._inputRequested=new u.Signal(this),this._toggleScrolling=new u.Signal(this),this._initialize=new u.Signal(this),this._outputTracker=new l.WidgetTracker({namespace:h.UUID.uuid4()}),this._inputHistoryScope="global",super.layout=new _.PanelLayout,this.addClass("jp-OutputArea"),this.contentFactory=null!==(e=t.contentFactory)&&void 0!==e?e:x.defaultContentFactory,this.rendermime=t.rendermime,this._maxNumberOutputs=null!==(s=t.maxNumberOutputs)&&void 0!==s?s:1/0,this._translator=null!==(i=t.translator)&&void 0!==i?i:p.nullTranslator,this._inputHistoryScope=null!==(n=t.inputHistoryScope)&&void 0!==n?n:"global";const r=this.model=t.model;for(let t=0;t<Math.min(r.length,this._maxNumberOutputs+1);t++){const e=r.get(t);this._insertOutput(t,e)}r.changed.connect(this.onModelChanged,this),r.stateChanged.connect(this.onStateChanged,this),t.promptOverlay&&this._addPromptOverlay()}get layout(){return super.layout}get widgets(){return this.layout.widgets}get future(){return this._future}set future(t){if(this.model.isDisposed)throw Error("Model is disposed");this._future!==t&&(this._future&&this._future.dispose(),this._future=t,this.model.clear(),this.widgets.length&&(this._clear(),this.outputLengthChanged.emit(Math.min(this.model.length,this._maxNumberOutputs))),t.onIOPub=this._onIOPub,t.onReply=this._onExecuteReply,t.onStdin=e=>{c.KernelMessage.isInputRequestMsg(e)&&this.onInputRequest(e,t)})}get inputRequested(){return this._inputRequested}get maxNumberOutputs(){return this._maxNumberOutputs}set maxNumberOutputs(t){if(t<=0)return void console.warn("OutputArea.maxNumberOutputs must be strictly positive.");const e=this._maxNumberOutputs;this._maxNumberOutputs=t,e<t&&this._showTrimmedOutputs(e)}dispose(){this._future&&(this._future.dispose(),this._future=null),this._displayIdMap.clear(),this._outputTracker.dispose(),super.dispose()}onModelChanged(t,e){switch(e.type){case"add":this._insertOutput(e.newIndex,e.newValues[0]);break;case"remove":if(this.widgets.length)if(0===this.model.length)this._clear();else{const t=e.oldIndex;for(let s=0;s<e.oldValues.length&&t<this.widgets.length;++s){const e=this.widgets[t];e.parent=null,e.dispose()}this._moveDisplayIdIndices(t,e.oldValues.length),this._preventHeightChangeJitter()}break;case"set":this._setOutput(e.newIndex,e.newValues[0])}this.outputLengthChanged.emit(Math.min(this.model.length,this._maxNumberOutputs))}get toggleScrolling(){return this._toggleScrolling}get initialize(){return this._initialize}_addPromptOverlay(){const t=document.createElement("div");t.className="jp-OutputArea-promptOverlay",t.addEventListener("click",(()=>{this._toggleScrolling.emit()})),this.node.appendChild(t),requestAnimationFrame((()=>{this._initialize.emit()}))}_moveDisplayIdIndices(t,e){this._displayIdMap.forEach((s=>{const i=t+e;for(let n=s.length-1;n>=0;--n){const r=s[n];r>=t&&r<i?s.splice(n,1):r>=i&&(s[n]-=e)}}))}onStateChanged(t,e){const s=Math.min(this.model.length,this._maxNumberOutputs);if(e){if(e>=this._maxNumberOutputs)return;this._setOutput(e,this.model.get(e))}else for(let t=0;t<s;t++)this._setOutput(t,this.model.get(t));this.outputLengthChanged.emit(s)}_clear(){if(!this.widgets.length)return;const t=this.widgets.length;for(let e=0;e<t;e++){const t=this.widgets[0];t.parent=null,t.dispose()}this._displayIdMap.clear(),this._preventHeightChangeJitter()}_preventHeightChangeJitter(){const t=this.node.getBoundingClientRect();this.node.style.minHeight=`${t.height}px`,this._minHeightTimeout&&window.clearTimeout(this._minHeightTimeout),this._minHeightTimeout=window.setTimeout((()=>{this.isDisposed||(this.node.style.minHeight="")}),50)}onInputRequest(t,e){const s=this.contentFactory,i=t.content.prompt,n=t.content.password,r=new _.Panel;r.addClass(g),r.addClass("jp-OutputArea-stdin-item");const a=s.createOutputPrompt();a.addClass(f),r.addWidget(a);const o=s.createStdin({parent_header:t.header,prompt:i,password:n,future:e,translator:this._translator,inputHistoryScope:this._inputHistoryScope});o.addClass(y),r.addWidget(o),this.model.length>=this.maxNumberOutputs&&(this.maxNumberOutputs=this.model.length),this._inputRequested.emit(o);const h=o.node.getElementsByTagName("input")[0];o.value.then((t=>{this.model.length>=this.maxNumberOutputs&&(this.maxNumberOutputs=this.model.length+1),r.addClass("jp-OutputArea-stdin-hiding"),this.model.add({output_type:"stream",name:"stdin",text:t+"\n"}),h.focus(),window.setTimeout((()=>{const t=document.activeElement;r.dispose(),t&&t instanceof HTMLElement&&t.focus()}),500)})),this.layout.addWidget(r)}_setOutput(t,e){if(t>=this._maxNumberOutputs)return;const s=this.layout.widgets[t],i=s.widgets?s.widgets.filter((t=>"renderModel"in t)).pop():s,n=this.rendermime.preferredMimeType(e.data,e.trusted?"any":"ensure");C.currentPreferredMimetype.get(i)===n&&x.isIsolated(n,e.metadata)===i instanceof C.IsolatedRenderer?i.renderModel(e):(this.layout.widgets[t].dispose(),this._insertOutput(t,e))}_insertOutput(t,e){if(t>this._maxNumberOutputs)return;const s=this.layout;if(t===this._maxNumberOutputs){const e=new C.TrimmedOutputs(this._maxNumberOutputs,(()=>{const t=this._maxNumberOutputs;this._maxNumberOutputs=1/0,this._showTrimmedOutputs(t)}));s.insertWidget(t,this._wrappedOutput(e))}else{let i=this.createOutputItem(e);i?i.toggleClass("jp-OutputArea-executeResult",null!==e.executionCount):i=new _.Widget,this._outputTracker.has(i)||this._outputTracker.add(i),s.insertWidget(t,i)}}get outputTracker(){return this._outputTracker}_showTrimmedOutputs(t){this.widgets[t].dispose();for(let e=t;e<this.model.length;e++)this._insertOutput(e,this.model.get(e));this.outputLengthChanged.emit(Math.min(this.model.length,this._maxNumberOutputs))}createOutputItem(t){const e=this.createRenderedMimetype(t);return e?this._wrappedOutput(e,t.executionCount):null}createRenderedMimetype(t){const e=this.rendermime.preferredMimeType(t.data,t.trusted?"any":"ensure");if(!e)return null;let s=this.rendermime.createRenderer(e);return!0===x.isIsolated(e,t.metadata)&&(s=new C.IsolatedRenderer(s)),C.currentPreferredMimetype.set(s,e),s.renderModel(t).catch((t=>{const e=document.createElement("pre"),i=this._translator.load("jupyterlab");e.textContent=i.__("Javascript Error: %1",t.message),s.node.appendChild(e),s.node.className="lm-Widget jp-RenderedText",s.node.setAttribute("data-mime-type","application/vnd.jupyter.stderr")})),s}_wrappedOutput(t,e=null){const s=new C.OutputPanel;s.addClass(g);const i=this.contentFactory.createOutputPrompt();return i.executionCount=e,i.addClass(f),s.addWidget(i),t.addClass(y),s.addWidget(t),s}}class v extends x{onInputRequest(t,e){}createOutputItem(t){const e=this.createRenderedMimetype(t);if(!e)return null;const s=new C.OutputPanel;return s.addClass(g),e.addClass(y),s.addWidget(e),s}}!function(t){t.execute=async function(t,e,s,i){var n;let r=!0;i&&Array.isArray(i.tags)&&-1!==i.tags.indexOf("raises-exception")&&(r=!1);const a={code:t,stop_on_error:r},o=null===(n=s.session)||void 0===n?void 0:n.kernel;if(!o)throw new Error("Session has no kernel.");const h=o.requestExecute(a,!1,i);return e.future=h,h.done},t.isIsolated=function(t,e){const s=e[t];return s&&void 0!==s.isolated?!!s.isolated:!!e.isolated};class e{createOutputPrompt(){return new w}createStdin(t){return new O(t)}}t.ContentFactory=e,t.defaultContentFactory=new e}(x||(x={}));class w extends _.Widget{constructor(){super(),this._executionCount=null,this.addClass("jp-OutputPrompt")}get executionCount(){return this._executionCount}set executionCount(t){this._executionCount=t,this.node.textContent=null===t?"":`[${t}]:`}}class O extends _.Widget{static _historyIx(t,e){const s=O._history.get(t);if(!s)return;const i=s.length;return e<=0?i+e:void 0}static _historyAt(t,e){const s=O._history.get(t);if(!s)return;const i=s.length,n=O._historyIx(t,e);return void 0!==n&&n<i?s[n]:void 0}static _historyPush(t,e){const s=O._history.get(t);s.push(e),s.length>1e3&&s.shift()}static _historySearch(t,e,s,i=!0){const n=O._history.get(t),r=n.length,a=O._historyIx(t,s),o=t=>-1!==t.search(e);if(void 0!==a)if(i){if(0===a)return;const t=n.slice(0,a).findLastIndex(o);if(-1!==t)return t-r}else{if(a>=r-1)return;const t=n.slice(a+1).findIndex(o);if(-1!==t)return t-r+a+1}}constructor(t){var e;super({node:C.createInputWidgetNode(t.prompt,t.password)}),this._promise=new h.PromiseDelegate,this._resolved=!1,this.addClass("jp-Stdin"),this._future=t.future,this._historyIndex=0,this._historyKey="session"===t.inputHistoryScope?t.parent_header.session:"",this._historyPat="",this._parentHeader=t.parent_header,this._password=t.password,this._trans=(null!==(e=t.translator)&&void 0!==e?e:p.nullTranslator).load("jupyterlab"),this._value=t.prompt+" ",this._input=this.node.getElementsByTagName("input")[0],this._input.placeholder=this._trans.__("↑↓ for history. Search history with c-↑/c-↓"),O._history.has(this._historyKey)||O._history.set(this._historyKey,[])}get value(){return this._promise.promise.then((()=>this._value))}handleEvent(t){if(this._resolved)return void t.preventDefault();const e=this._input;if("keydown"===t.type)if("Enter"===t.key)this.resetSearch(),this._future.sendInputReply({status:"ok",value:e.value},this._parentHeader),this._password?this._value+="········":(this._value+=e.value,O._historyPush(this._historyKey,e.value)),this._resolved=!0,this._promise.resolve(void 0);else if("Escape"===t.key)this.resetSearch(),e.blur();else if(!t.ctrlKey||"ArrowUp"!==t.key&&"ArrowDown"!==t.key){if("ArrowUp"===t.key){this.resetSearch();const s=O._historyAt(this._historyKey,this._historyIndex-1);s&&(0===this._historyIndex&&(this._valueCache=e.value),this._setInputValue(s),--this._historyIndex,t.preventDefault())}else if("ArrowDown"===t.key)if(this.resetSearch(),0===this._historyIndex);else if(-1===this._historyIndex)this._setInputValue(this._valueCache),++this._historyIndex;else{const t=O._historyAt(this._historyKey,this._historyIndex+1);t&&(this._setInputValue(t),++this._historyIndex)}}else{""===this._historyPat&&(this._historyPat=e.value);const s="ArrowUp"===t.key,i=O._historySearch(this._historyKey,this._historyPat,this._historyIndex,s);if(void 0!==i){const s=O._historyAt(this._historyKey,i);void 0!==s&&(0===this._historyIndex&&(this._valueCache=e.value),this._setInputValue(s),this._historyIndex=i,t.preventDefault())}}}resetSearch(){this._historyPat=""}onAfterAttach(t){this._input.addEventListener("keydown",this),this._input.focus()}onBeforeDetach(t){this._input.removeEventListener("keydown",this)}_setInputValue(t){this._input.value=t,this._input.setSelectionRange(t.length,t.length)}}var C;O._history=new Map,function(t){t.createInputWidgetNode=function(t,e){const s=document.createElement("div"),i=document.createElement("pre");i.className="jp-Stdin-prompt",i.textContent=t;const n=document.createElement("input");return n.className="jp-Stdin-input",e&&(n.type="password"),s.appendChild(i),i.appendChild(n),s};class e extends _.Widget{constructor(t){super({node:document.createElement("iframe")}),this.addClass("jp-mod-isolated"),this._wrapped=t;const e=this.node;e.frameBorder="0",e.scrolling="auto",e.addEventListener("load",(()=>{e.contentDocument.open(),e.contentDocument.write(this._wrapped.node.innerHTML),e.contentDocument.close();const t=e.contentDocument.body;e.style.height=`${t.scrollHeight}px`,e.heightChangeObserver=new ResizeObserver((()=>{e.style.height=`${t.scrollHeight}px`})),e.heightChangeObserver.observe(t)}))}renderModel(t){return this._wrapped.renderModel(t)}}t.IsolatedRenderer=e,t.currentPreferredMimetype=new m.AttachedProperty({name:"preferredMimetype",create:t=>""});class s extends _.Panel{constructor(t){super(t)}_onContext(t){this.node.focus()}onAfterAttach(t){super.onAfterAttach(t),this.node.addEventListener("contextmenu",this._onContext.bind(this))}onBeforeDetach(t){super.onAfterDetach(t),this.node.removeEventListener("contextmenu",this._onContext.bind(this))}}t.OutputPanel=s;class i extends _.Widget{constructor(t,e){const s=document.createElement("div"),i=`The first ${t} are displayed`;s.insertAdjacentHTML("afterbegin",`<a title=${i}>\n <pre>Show more outputs</pre>\n </a>`),super({node:s}),this._onClick=e,this.addClass("jp-TrimmedOutputs"),this.addClass("jp-RenderedHTMLCommon")}handleEvent(t){"click"===t.type&&this._onClick(t)}onAfterAttach(t){super.onAfterAttach(t),this.node.addEventListener("click",this)}onBeforeDetach(t){super.onBeforeDetach(t),this.node.removeEventListener("click",this)}}t.TrimmedOutputs=i}(C||(C={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7226],{47226:(t,e,s)=>{s.r(e),s.d(e,{OutputArea:()=>x,OutputAreaModel:()=>d,OutputPrompt:()=>v,SimplifiedOutputArea:()=>w,Stdin:()=>O});var i,n=s(81139),r=s(31231),a=s(81221),o=s(33625),h=s(20998),u=s(81997);class d{constructor(t={}){if(this.clearNext=!1,this._lastStream="",this._trusted=!1,this._isDisposed=!1,this._stateChanged=new u.Signal(this),this._changed=new u.Signal(this),this._trusted=!!t.trusted,this.contentFactory=t.contentFactory||d.defaultContentFactory,this.list=new r.ObservableList,t.values)for(const e of t.values){const t=this._add(e)-1;this.list.get(t).changed.connect(this._onGenericChange,this)}this.list.changed.connect(this._onListChanged,this)}get stateChanged(){return this._stateChanged}get changed(){return this._changed}get length(){return this.list?this.list.length:0}get trusted(){return this._trusted}set trusted(t){if(t===this._trusted)return;const e=this._trusted=t;for(let t=0;t<this.list.length;t++){const s=this.list.get(t),i=s.toJSON(),n=this._createItem({value:i,trusted:e});this.list.set(t,n),s.dispose()}}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this.list.dispose(),u.Signal.clearData(this))}get(t){return this.list.get(t)}set(t,e){e=h.JSONExt.deepCopy(e),i.normalize(e);const s=this._createItem({value:e,trusted:this._trusted});this.list.set(t,s)}add(t){return this.clearNext&&(this.clear(),this.clearNext=!1),this._add(t)}clear(t=!1){if(this._lastStream="",t)this.clearNext=!0;else{for(const t of this.list)t.dispose();this.list.clear()}}fromJSON(t){this.clear();for(const e of t)this._add(e)}toJSON(){return Array.from((0,o.map)(this.list,(t=>t.toJSON())))}_add(t){const e=this._trusted;if(t=h.JSONExt.deepCopy(t),i.normalize(t),n.isStream(t)&&this._lastStream&&t.name===this._lastName&&this.shouldCombine({value:t,lastModel:this.list.get(this.length-1)})){this._lastStream+=t.text,this._lastStream=i.removeOverwrittenChars(this._lastStream),t.text=this._lastStream;const s=this._createItem({value:t,trusted:e}),n=this.length-1,r=this.list.get(n);return this.list.set(n,s),r.dispose(),this.length}n.isStream(t)&&(t.text=i.removeOverwrittenChars(t.text));const s=this._createItem({value:t,trusted:e});return n.isStream(t)?(this._lastStream=t.text,this._lastName=t.name):this._lastStream="",this.list.push(s)}shouldCombine(t){return!0}_createItem(t){return this.contentFactory.createOutputModel(t)}_onListChanged(t,e){switch(e.type){case"add":e.newValues.forEach((t=>{t.changed.connect(this._onGenericChange,this)}));break;case"remove":e.oldValues.forEach((t=>{t.changed.disconnect(this._onGenericChange,this)}));break;case"set":e.newValues.forEach((t=>{t.changed.connect(this._onGenericChange,this)})),e.oldValues.forEach((t=>{t.changed.disconnect(this._onGenericChange,this)}))}this._changed.emit(e)}_onGenericChange(t){let e,s=null;for(e=0;e<this.list.length&&(s=this.list.get(e),s!==t);e++);null!=s&&(this._stateChanged.emit(e),this._changed.emit({type:"set",newIndex:e,oldIndex:e,oldValues:[s],newValues:[s]}))}}!function(t){class e{createOutputModel(t){return new a.OutputModel(t)}}t.ContentFactory=e,t.defaultContentFactory=new e}(d||(d={})),function(t){t.normalize=function(t){n.isStream(t)&&Array.isArray(t.text)&&(t.text=t.text.join("\n"))},t.removeOverwrittenChars=function(t){return function(t){for(t=t.replace(/\r+\n/gm,"\n");t.search(/\r[^$]/g)>-1;){const e=t.match(/^(.*)\r+/m)[1];let s=t.match(/\r+(.*)$/m)[1];s+=e.slice(s.length,e.length),t=t.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,s)}return t}(function(t){let e=t;do{e=(t=e).replace(/[^\n]\x08/gm,"")}while(e.length<t.length);return t}(t))}}(i||(i={}));var l=s(53312),c=s(87408),p=s(12030),_=s(14421),m=s(63485);const g="jp-OutputArea-child",y="jp-OutputArea-output",f="jp-OutputArea-prompt";class x extends m.Widget{constructor(t){var e,s,i,n;super(),this.outputLengthChanged=new u.Signal(this),this._onIOPub=t=>{const e=this.model,s=t.header.msg_type;let i;const n=(t.content.transient||{}).display_id;let r;switch(s){case"execute_result":case"display_data":case"stream":case"error":i={...t.content,output_type:s},e.add(i);break;case"clear_output":{const s=t.content.wait;e.clear(s);break}case"update_display_data":if(i={...t.content,output_type:"display_data"},r=this._displayIdMap.get(n),r)for(const t of r)e.set(t,i);break;case"status":"idle"===t.content.execution_state&&(this._pendingInput=!1)}n&&"display_data"===s&&(r=this._displayIdMap.get(n)||[],r.push(e.length-1),this._displayIdMap.set(n,r))},this._onExecuteReply=t=>{const e=this.model,s=t.content;if("ok"!==s.status)return;const i=s&&s.payload;if(!i||!i.length)return;const n=i.filter((t=>"page"===t.source));if(!n.length)return;const r={output_type:"display_data",data:JSON.parse(JSON.stringify(n[0])).data,metadata:{}};e.add(r)},this._displayIdMap=new Map,this._minHeightTimeout=null,this._inputRequested=new u.Signal(this),this._toggleScrolling=new u.Signal(this),this._initialize=new u.Signal(this),this._outputTracker=new l.WidgetTracker({namespace:h.UUID.uuid4()}),this._inputHistoryScope="global",this._pendingInput=!1,super.layout=new m.PanelLayout,this.addClass("jp-OutputArea"),this.contentFactory=null!==(e=t.contentFactory)&&void 0!==e?e:x.defaultContentFactory,this.rendermime=t.rendermime,this._maxNumberOutputs=null!==(s=t.maxNumberOutputs)&&void 0!==s?s:1/0,this._translator=null!==(i=t.translator)&&void 0!==i?i:p.nullTranslator,this._inputHistoryScope=null!==(n=t.inputHistoryScope)&&void 0!==n?n:"global";const r=this.model=t.model;for(let t=0;t<Math.min(r.length,this._maxNumberOutputs+1);t++){const e=r.get(t);this._insertOutput(t,e)}r.changed.connect(this.onModelChanged,this),r.stateChanged.connect(this.onStateChanged,this),t.promptOverlay&&this._addPromptOverlay()}get layout(){return super.layout}get widgets(){return this.layout.widgets}get future(){return this._future}set future(t){if(this.model.isDisposed)throw Error("Model is disposed");this._future!==t&&(this._future&&this._future.dispose(),this._future=t,t.done.finally((()=>{this._pendingInput=!1})).catch((()=>{})),this.model.clear(),this.widgets.length&&(this._clear(),this.outputLengthChanged.emit(Math.min(this.model.length,this._maxNumberOutputs))),t.onIOPub=this._onIOPub,t.onReply=this._onExecuteReply,t.onStdin=e=>{c.KernelMessage.isInputRequestMsg(e)&&this.onInputRequest(e,t)})}get inputRequested(){return this._inputRequested}get pendingInput(){return this._pendingInput}get maxNumberOutputs(){return this._maxNumberOutputs}set maxNumberOutputs(t){if(t<=0)return void console.warn("OutputArea.maxNumberOutputs must be strictly positive.");const e=this._maxNumberOutputs;this._maxNumberOutputs=t,e<t&&this._showTrimmedOutputs(e)}dispose(){this._future&&(this._future.dispose(),this._future=null),this._displayIdMap.clear(),this._outputTracker.dispose(),super.dispose()}onModelChanged(t,e){switch(e.type){case"add":this._insertOutput(e.newIndex,e.newValues[0]);break;case"remove":if(this.widgets.length)if(0===this.model.length)this._clear();else{const t=e.oldIndex;for(let s=0;s<e.oldValues.length&&t<this.widgets.length;++s){const e=this.widgets[t];e.parent=null,e.dispose()}this._moveDisplayIdIndices(t,e.oldValues.length),this._preventHeightChangeJitter()}break;case"set":this._setOutput(e.newIndex,e.newValues[0])}this.outputLengthChanged.emit(Math.min(this.model.length,this._maxNumberOutputs))}get toggleScrolling(){return this._toggleScrolling}get initialize(){return this._initialize}_addPromptOverlay(){const t=document.createElement("div");t.className="jp-OutputArea-promptOverlay",t.addEventListener("click",(()=>{this._toggleScrolling.emit()})),this.node.appendChild(t),requestAnimationFrame((()=>{this._initialize.emit()}))}_moveDisplayIdIndices(t,e){this._displayIdMap.forEach((s=>{const i=t+e;for(let n=s.length-1;n>=0;--n){const r=s[n];r>=t&&r<i?s.splice(n,1):r>=i&&(s[n]-=e)}}))}onStateChanged(t,e){const s=Math.min(this.model.length,this._maxNumberOutputs);if(e){if(e>=this._maxNumberOutputs)return;this._setOutput(e,this.model.get(e))}else for(let t=0;t<s;t++)this._setOutput(t,this.model.get(t));this.outputLengthChanged.emit(s)}_clear(){if(!this.widgets.length)return;const t=this.widgets.length;for(let e=0;e<t;e++){const t=this.widgets[0];t.parent=null,t.dispose()}this._displayIdMap.clear(),this._preventHeightChangeJitter()}_preventHeightChangeJitter(){const t=this.node.getBoundingClientRect();this.node.style.minHeight=`${t.height}px`,this._minHeightTimeout&&window.clearTimeout(this._minHeightTimeout),this._minHeightTimeout=window.setTimeout((()=>{this.isDisposed||(this.node.style.minHeight="")}),50)}onInputRequest(t,e){const s=this.contentFactory,i=t.content.prompt,n=t.content.password,r=new m.Panel;r.addClass(g),r.addClass("jp-OutputArea-stdin-item");const a=s.createOutputPrompt();a.addClass(f),r.addWidget(a),this._pendingInput=!0;const o=s.createStdin({parent_header:t.header,prompt:i,password:n,future:e,translator:this._translator,inputHistoryScope:this._inputHistoryScope});o.addClass(y),r.addWidget(o),this.model.length>=this.maxNumberOutputs&&(this.maxNumberOutputs=this.model.length),this._inputRequested.emit(o);const h=o.node.getElementsByTagName("input")[0];o.value.then((t=>{this.model.length>=this.maxNumberOutputs&&(this.maxNumberOutputs=this.model.length+1),r.addClass("jp-OutputArea-stdin-hiding"),this.model.add({output_type:"stream",name:"stdin",text:t+"\n"}),h.focus(),this._pendingInput=!1,window.setTimeout((()=>{const t=document.activeElement;r.dispose(),t&&t instanceof HTMLElement&&t.focus()}),500)})),this.layout.addWidget(r)}_setOutput(t,e){if(t>=this._maxNumberOutputs)return;const s=this.layout.widgets[t],i=s.widgets?s.widgets.filter((t=>"renderModel"in t)).pop():s,n=this.rendermime.preferredMimeType(e.data,e.trusted?"any":"ensure");C.currentPreferredMimetype.get(i)===n&&x.isIsolated(n,e.metadata)===i instanceof C.IsolatedRenderer?i.renderModel(e):(this.layout.widgets[t].dispose(),this._insertOutput(t,e))}_insertOutput(t,e){if(t>this._maxNumberOutputs)return;const s=this.layout;if(t===this._maxNumberOutputs){const e=new C.TrimmedOutputs(this._maxNumberOutputs,(()=>{const t=this._maxNumberOutputs;this._maxNumberOutputs=1/0,this._showTrimmedOutputs(t)}));s.insertWidget(t,this._wrappedOutput(e))}else{let i=this.createOutputItem(e);i?i.toggleClass("jp-OutputArea-executeResult",null!==e.executionCount):i=new m.Widget,this._outputTracker.has(i)||this._outputTracker.add(i),s.insertWidget(t,i)}}get outputTracker(){return this._outputTracker}_showTrimmedOutputs(t){this.widgets[t].dispose();for(let e=t;e<this.model.length;e++)this._insertOutput(e,this.model.get(e));this.outputLengthChanged.emit(Math.min(this.model.length,this._maxNumberOutputs))}createOutputItem(t){const e=this.createRenderedMimetype(t);return e?this._wrappedOutput(e,t.executionCount):null}createRenderedMimetype(t){const e=this.rendermime.preferredMimeType(t.data,t.trusted?"any":"ensure");if(!e)return null;let s=this.rendermime.createRenderer(e);return!0===x.isIsolated(e,t.metadata)&&(s=new C.IsolatedRenderer(s)),C.currentPreferredMimetype.set(s,e),s.renderModel(t).catch((t=>{const e=document.createElement("pre"),i=this._translator.load("jupyterlab");e.textContent=i.__("Javascript Error: %1",t.message),s.node.appendChild(e),s.node.className="lm-Widget jp-RenderedText",s.node.setAttribute("data-mime-type","application/vnd.jupyter.stderr")})),s}_wrappedOutput(t,e=null){const s=new C.OutputPanel;s.addClass(g);const i=this.contentFactory.createOutputPrompt();return i.executionCount=e,i.addClass(f),s.addWidget(i),t.addClass(y),s.addWidget(t),s}}class w extends x{onInputRequest(t,e){}createOutputItem(t){const e=this.createRenderedMimetype(t);if(!e)return null;const s=new C.OutputPanel;return s.addClass(g),e.addClass(y),s.addWidget(e),s}}!function(t){t.execute=async function(t,e,s,i){var n;let r=!0;i&&Array.isArray(i.tags)&&-1!==i.tags.indexOf("raises-exception")&&(r=!1);const a={code:t,stop_on_error:r},o=null===(n=s.session)||void 0===n?void 0:n.kernel;if(!o)throw new Error("Session has no kernel.");const h=o.requestExecute(a,!1,i);return e.future=h,h.done},t.isIsolated=function(t,e){const s=e[t];return s&&void 0!==s.isolated?!!s.isolated:!!e.isolated};class e{createOutputPrompt(){return new v}createStdin(t){return new O(t)}}t.ContentFactory=e,t.defaultContentFactory=new e}(x||(x={}));class v extends m.Widget{constructor(){super(),this._executionCount=null,this.addClass("jp-OutputPrompt")}get executionCount(){return this._executionCount}set executionCount(t){this._executionCount=t,this.node.textContent=null===t?"":`[${t}]:`}}class O extends m.Widget{static _historyIx(t,e){const s=O._history.get(t);if(!s)return;const i=s.length;return e<=0?i+e:void 0}static _historyAt(t,e){const s=O._history.get(t);if(!s)return;const i=s.length,n=O._historyIx(t,e);return void 0!==n&&n<i?s[n]:void 0}static _historyPush(t,e){const s=O._history.get(t);s.push(e),s.length>1e3&&s.shift()}static _historySearch(t,e,s,i=!0){const n=O._history.get(t),r=n.length,a=O._historyIx(t,s),o=t=>-1!==t.search(e);if(void 0!==a)if(i){if(0===a)return;const t=n.slice(0,a).findLastIndex(o);if(-1!==t)return t-r}else{if(a>=r-1)return;const t=n.slice(a+1).findIndex(o);if(-1!==t)return t-r+a+1}}constructor(t){var e;super({node:C.createInputWidgetNode(t.prompt,t.password)}),this._promise=new h.PromiseDelegate,this._resolved=!1,this.addClass("jp-Stdin"),this._future=t.future,this._historyIndex=0,this._historyKey="session"===t.inputHistoryScope?t.parent_header.session:"",this._historyPat="",this._parentHeader=t.parent_header,this._password=t.password,this._trans=(null!==(e=t.translator)&&void 0!==e?e:p.nullTranslator).load("jupyterlab"),this._value=t.prompt+" ",this._input=this.node.getElementsByTagName("input")[0],this._password?this._input.placeholder="":this._input.placeholder=this._trans.__("↑↓ for history. Search history with c-↑/c-↓"),O._history.has(this._historyKey)||O._history.set(this._historyKey,[])}get value(){return this._promise.promise.then((()=>this._value))}handleEvent(t){if(this._resolved)return void t.preventDefault();const e=this._input;if("keydown"===t.type)if("Enter"===t.key)this.resetSearch(),this._future.sendInputReply({status:"ok",value:e.value},this._parentHeader),this._password?this._value+="········":(this._value+=e.value,O._historyPush(this._historyKey,e.value)),this._resolved=!0,this._promise.resolve(void 0);else if("Escape"===t.key)this.resetSearch(),e.blur();else if(!t.ctrlKey||"ArrowUp"!==t.key&&"ArrowDown"!==t.key){if("ArrowUp"===t.key){this.resetSearch();const s=O._historyAt(this._historyKey,this._historyIndex-1);s&&(0===this._historyIndex&&(this._valueCache=e.value),this._setInputValue(s),--this._historyIndex,t.preventDefault())}else if("ArrowDown"===t.key)if(this.resetSearch(),0===this._historyIndex);else if(-1===this._historyIndex)this._setInputValue(this._valueCache),++this._historyIndex;else{const t=O._historyAt(this._historyKey,this._historyIndex+1);t&&(this._setInputValue(t),++this._historyIndex)}}else{""===this._historyPat&&(this._historyPat=e.value);const s="ArrowUp"===t.key,i=O._historySearch(this._historyKey,this._historyPat,this._historyIndex,s);if(void 0!==i){const s=O._historyAt(this._historyKey,i);void 0!==s&&(0===this._historyIndex&&(this._valueCache=e.value),this._setInputValue(s),this._historyIndex=i,t.preventDefault())}}}resetSearch(){this._historyPat=""}onAfterAttach(t){this._input.addEventListener("keydown",this),this._input.focus()}onBeforeDetach(t){this._input.removeEventListener("keydown",this)}_setInputValue(t){this._input.value=t,this._input.setSelectionRange(t.length,t.length)}}var C;O._history=new Map,function(t){t.createInputWidgetNode=function(t,e){const s=document.createElement("div"),i=document.createElement("pre");i.className="jp-Stdin-prompt",i.textContent=t;const n=document.createElement("input");return n.className="jp-Stdin-input",e&&(n.type="password"),s.appendChild(i),i.appendChild(n),s};class e extends m.Widget{constructor(t){super({node:document.createElement("iframe")}),this.addClass("jp-mod-isolated"),this._wrapped=t;const e=this.node;e.frameBorder="0",e.scrolling="auto",e.addEventListener("load",(()=>{e.contentDocument.open(),e.contentDocument.write(this._wrapped.node.innerHTML),e.contentDocument.close();const t=e.contentDocument.body;e.style.height=`${t.scrollHeight}px`,e.heightChangeObserver=new ResizeObserver((()=>{e.style.height=`${t.scrollHeight}px`})),e.heightChangeObserver.observe(t)}))}renderModel(t){return this._wrapped.renderModel(t)}}t.IsolatedRenderer=e,t.currentPreferredMimetype=new _.AttachedProperty({name:"preferredMimetype",create:t=>""});class s extends m.Panel{constructor(t){super(t)}_onContext(t){this.node.focus()}onAfterAttach(t){super.onAfterAttach(t),this.node.addEventListener("contextmenu",this._onContext.bind(this))}onBeforeDetach(t){super.onAfterDetach(t),this.node.removeEventListener("contextmenu",this._onContext.bind(this))}}t.OutputPanel=s;class i extends m.Widget{constructor(t,e){const s=document.createElement("div"),i=`The first ${t} are displayed`;s.insertAdjacentHTML("afterbegin",`<a title=${i}>\n <pre>Show more outputs</pre>\n </a>`),super({node:s}),this._onClick=e,this.addClass("jp-TrimmedOutputs"),this.addClass("jp-RenderedHTMLCommon")}handleEvent(t){"click"===t.type&&this._onClick(t)}onAfterAttach(t){super.onAfterAttach(t),this.node.addEventListener("click",this)}onBeforeDetach(t){super.onBeforeDetach(t),this.node.removeEventListener("click",this)}}t.TrimmedOutputs=i}(C||(C={}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7252,9685],{79685:(e,t,r)=>{r.r(t),r.d(t,{default:()=>k});var n,a=r(3053),o=r(12982),d=r(38639),i=r(73847),c=r(70856),s=r(36768),w=r(87749),m=r(71677);!function(e){e.markdownPreview="markdownviewer:open",e.markdownEditor="markdownviewer:edit"}(n||(n={}));const p="Markdown Preview",l={activate:function(e,t,r,a,s,w,m){const k=r.load("jupyterlab"),{commands:u,docRegistry:g}=e;t.addFactory(c.markdownRendererFactory);const f=new o.WidgetTracker({namespace:"markdownviewer-widget"});let h={...i.MarkdownViewer.defaultConfig};function y(e){Object.keys(h).forEach((t=>{var r;e.setOption(t,null!==(r=h[t])&&void 0!==r?r:null)}))}if(s){const e=e=>{h=e.composite,f.forEach((e=>{y(e.content)}))};s.load(l.id).then((t=>{t.changed.connect((()=>{e(t)})),e(t)})).catch((e=>{console.error(e.message)}))}const v=new i.MarkdownViewerFactory({rendermime:t,name:p,label:k.__("Markdown Preview"),primaryFileType:g.getFileType("markdown"),fileTypes:["markdown"],defaultRendered:["markdown"]});return v.widgetCreated.connect(((e,t)=>{t.context.pathChanged.connect((()=>{f.save(t)})),y(t.content),f.add(t)})),g.addWidgetFactory(v),a&&a.restore(f,{command:"docmanager:open",args:e=>({path:e.context.path,factory:p}),name:e=>e.context.path}),u.addCommand(n.markdownPreview,{label:k.__("Markdown Preview"),execute:e=>{const t=e.path;if("string"==typeof t)return u.execute("docmanager:open",{path:t,factory:p,options:e.options})}}),u.addCommand(n.markdownEditor,{execute:()=>{const e=f.currentWidget;if(!e)return;const t=e.context.path;return u.execute("docmanager:open",{path:t,factory:"Editor",options:{mode:"split-right"}})},isVisible:()=>{const e=f.currentWidget;return e&&".md"===d.PathExt.extname(e.context.path)||!1},label:k.__("Show Markdown Editor")}),w&&w.add(new i.MarkdownViewerTableOfContentsFactory(f,t.markdownParser,null!=m?m:t.sanitizer)),f},id:"@jupyterlab/markdownviewer-extension:plugin",description:"Adds markdown file viewer and provides its tracker.",provides:i.IMarkdownViewerTracker,requires:[c.IRenderMimeRegistry,m.ITranslator],optional:[a.ILayoutRestorer,s.ISettingRegistry,w.ITableOfContentsRegistry,o.ISanitizer],autoStart:!0},k=l}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7252,9685],{79685:(e,t,r)=>{r.r(t),r.d(t,{default:()=>k});var n,a=r(44604),o=r(53312),d=r(68722),i=r(3991),c=r(81221),s=r(23295),w=r(79426),m=r(12030);!function(e){e.markdownPreview="markdownviewer:open",e.markdownEditor="markdownviewer:edit"}(n||(n={}));const p="Markdown Preview",l={activate:function(e,t,r,a,s,w,m){const k=r.load("jupyterlab"),{commands:u,docRegistry:g}=e;t.addFactory(c.markdownRendererFactory);const f=new o.WidgetTracker({namespace:"markdownviewer-widget"});let h={...i.MarkdownViewer.defaultConfig};function y(e){Object.keys(h).forEach((t=>{var r;e.setOption(t,null!==(r=h[t])&&void 0!==r?r:null)}))}if(s){const e=e=>{h=e.composite,f.forEach((e=>{y(e.content)}))};s.load(l.id).then((t=>{t.changed.connect((()=>{e(t)})),e(t)})).catch((e=>{console.error(e.message)}))}const v=new i.MarkdownViewerFactory({rendermime:t,name:p,label:k.__("Markdown Preview"),primaryFileType:g.getFileType("markdown"),fileTypes:["markdown"],defaultRendered:["markdown"]});return v.widgetCreated.connect(((e,t)=>{t.context.pathChanged.connect((()=>{f.save(t)})),y(t.content),f.add(t)})),g.addWidgetFactory(v),a&&a.restore(f,{command:"docmanager:open",args:e=>({path:e.context.path,factory:p}),name:e=>e.context.path}),u.addCommand(n.markdownPreview,{label:k.__("Markdown Preview"),execute:e=>{const t=e.path;if("string"==typeof t)return u.execute("docmanager:open",{path:t,factory:p,options:e.options})}}),u.addCommand(n.markdownEditor,{execute:()=>{const e=f.currentWidget;if(!e)return;const t=e.context.path;return u.execute("docmanager:open",{path:t,factory:"Editor",options:{mode:"split-right"}})},isVisible:()=>{const e=f.currentWidget;return e&&".md"===d.PathExt.extname(e.context.path)||!1},label:k.__("Show Markdown Editor")}),w&&w.add(new i.MarkdownViewerTableOfContentsFactory(f,t.markdownParser,null!=m?m:t.sanitizer)),f},id:"@jupyterlab/markdownviewer-extension:plugin",description:"Adds markdown file viewer and provides its tracker.",provides:i.IMarkdownViewerTracker,requires:[c.IRenderMimeRegistry,m.ITranslator],optional:[a.ILayoutRestorer,s.ISettingRegistry,w.ITableOfContentsRegistry,o.ISanitizer],autoStart:!0},k=l}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7302,3768],{83768:(e,t,o)=>{o.r(t),o.d(t,{default:()=>F});var n=o(12982),r=o(38639),i=o(97713),a=o(36768),s=o(13589),l=o(68671),d=o(71677),c=o(68239),g=o(81997),u=o(31516),w=o(82282),h=o(78156),b=o.n(h);class p{constructor(e){this._onSelectionChanged=()=>{var e,t,o,n,r,i;const a=Array.from(this._browser.selectedItems()),s=a.length>0,l=a.some((e=>"directory"===e.type));null===(e=this._widgets.get("placeholder"))||void 0===e||e.setHidden(s),null===(t=this._widgets.get("delete"))||void 0===t||t.setHidden(!s),null===(o=this._widgets.get("duplicate"))||void 0===o||o.setHidden(!s||l),null===(n=this._widgets.get("download"))||void 0===n||n.setHidden(!s||l),null===(r=this._widgets.get("open"))||void 0===r||r.setHidden(!s||l),null===(i=this._widgets.get("rename"))||void 0===i||i.setHidden(1!==a.length)},this._widgets=new Map,this._browser=e.browser;const{commands:t,selectionChanged:o,translator:r}=e,i=r.load("notebook"),a=n.ReactWidget.create(b().createElement("div",{key:"placeholder"},i.__("Select items to perform actions on them.")));a.id="fileAction-placeholder",this._widgets.set("placeholder",a),["open","download","rename","duplicate","delete"].forEach((e=>{const o=n.ReactWidget.create(b().createElement(n.CommandToolbarButtonComponent,{key:e,commands:t,id:`filebrowser:${e}`,args:{toolbar:!0},icon:void 0}));o.id=`fileAction-${e}`,o.addClass("jp-ToolbarButton"),o.addClass("jp-FileAction"),this._widgets.set(e,o)})),o.connect(this._onSelectionChanged,this),this._onSelectionChanged()}get widgets(){return this._widgets.values()}}const m="FileBrowser";var f;!function(e){e.activate="filebrowser:activate"}(f||(f={}));const _={id:"@jupyter-notebook/tree-extension:new",description:"Plugin to add extra commands to the file browser to create new notebooks, files, consoles and terminals.",requires:[d.ITranslator],optional:[n.IToolbarWidgetRegistry],autoStart:!0,activate:(e,t,o)=>{var n;const{commands:r,serviceManager:i}=e,a=t.load("notebook"),s={overflowMenuOptions:{isVisible:!1}},l=new u.MenuBar(s),d=new u.Menu({commands:r});d.title.label=a.__("New"),d.title.icon=c.caretDownIcon,l.addMenu(d);const g=()=>{var e,t;const o=null===(t=null===(e=i.kernelspecs)||void 0===e?void 0:e.specs)||void 0===t?void 0:t.kernelspecs;for(const e in o)d.addItem({args:{kernelName:e,isLauncher:!0},command:"notebook:create-new"});["terminal:create-new","console:create","filebrowser:create-new-file","filebrowser:create-new-directory"].forEach((e=>{d.addItem({command:e})}))};null===(n=i.kernelspecs)||void 0===n||n.specsChanged.connect((()=>{d.clearItems(),g()})),g(),o&&o.addFactory(m,"new-dropdown",(e=>{const t=new u.MenuBar(s);return t.addMenu(d),t.addClass("jp-DropdownMenu"),t}))}},v={id:"@jupyter-notebook/tree-extension:file-actions",description:"A plugin to add file browser actions to the file browser toolbar.",autoStart:!0,requires:[i.IDefaultFileBrowser,n.IToolbarWidgetRegistry,d.ITranslator],activate:(e,t,o,n)=>{const r=new g.Signal(t);["_selectItem","_handleMultiSelect","handleFileSelect"].forEach((e=>{const o=t.listing[e];t.listing[e]=(...e)=>{o.call(t.listing,...e),r.emit(void 0)}}));const{commands:i}=e,a=new p({commands:i,browser:t,selectionChanged:r,translator:n});for(const e of a.widgets)o.addFactory(m,e.id,(()=>e))}},y={id:"@jupyter-notebook/tree-extension:load-plugins",description:"Plugin to load the default plugins that are loaded on all the Notebook pages (tree, edit, view, etc.) so they are visible in the settings editor.",autoStart:!0,requires:[a.ISettingRegistry],activate(e,t){const{isDisabled:o}=r.PageConfig.Extension,n=t.connector,i=r.PageConfig.getOption("allPlugins");if(!i)return;const a=JSON.parse(i),s=new Set;Object.keys(a).forEach((e=>{const t=a[e];Object.keys(t).forEach((e=>{const o=t[e];"boolean"==typeof o&&o?s.add(e):Array.isArray(o)&&o.forEach((e=>{s.add(e)}))}))})),e.restored.then((async()=>{(await n.list("all")).ids.forEach((async e=>{const[n]=e.split(":");if((s.has(n)||s.has(e))&&!o(e)&&!(e in t.plugins))try{await t.load(e)}catch(t){console.warn(`Settings failed to load for (${e})`,t)}}))}))}},k={id:"@jupyter-notebook/tree-extension:open-file-browser",description:"A plugin to add file browser commands for the tree view.",requires:[w.INotebookTree,i.IDefaultFileBrowser],autoStart:!0,activate:(e,t,o)=>{const{commands:n}=e;n.addCommand(f.activate,{execute:()=>{t.currentWidget=o}})}},S={id:"@jupyter-notebook/tree-extension:widget",description:"A plugin to add the file browser widget to an INotebookShell.",requires:[i.IDefaultFileBrowser,d.ITranslator,a.ISettingRegistry,n.IToolbarWidgetRegistry,i.IFileBrowserFactory],optional:[s.IRunningSessionManagers,l.ISettingEditorTracker,l.IJSONSettingEditorTracker],autoStart:!0,provides:w.INotebookTree,activate:(e,t,o,r,a,l,d,g,u)=>{const h=new w.NotebookTreeWidget,b=o.load("notebook");if(t.title.label=b.__("Files"),t.node.setAttribute("role","region"),t.node.setAttribute("aria-label",b.__("File Browser Section")),t.title.icon=c.folderIcon,h.addWidget(t),h.tabBar.addTab(t.title),h.tabsMovable=!1,a.addFactory(m,"uploader",(e=>new i.Uploader({model:e.model,translator:o,label:b.__("Upload")}))),a.addFactory(m,"fileNameSearcher",(e=>{const t=(0,c.FilenameSearcher)({updateFilter:(t,o)=>{e.model.setFilter((e=>t(e.name.toLowerCase())))},useFuzzyFilter:!0,placeholder:b.__("Filter files by name"),forceRefresh:!0});return t.addClass("jp-FileBrowser-filterBox"),t})),(0,n.setToolbar)(t,(0,n.createToolbarFactory)(a,r,m,S.id,o)),d){const e=new s.RunningSessions(d,o);e.id="jp-running-sessions-tree",e.title.label=b.__("Running"),e.title.icon=c.runningIcon,h.addWidget(e),h.tabBar.addTab(e.title)}const p=r.load("@jupyterlab/filebrowser-extension:browser");Promise.all([p,e.restored]).then((([e])=>{["showFileCheckboxes","showFileSizeColumn","sortNotebooksFirst","showFullPath"].forEach((t=>{void 0===e.user[t]&&e.set(t,!0)}))})).catch((e=>{console.error(e.message)})),e.shell.add(h,"main",{rank:100}),[g,u].forEach((e=>{e&&e.widgetAdded.connect(((e,t)=>{h.addWidget(t),h.tabBar.addTab(t.title),h.currentWidget=t}))}));const{tracker:f}=l,_=()=>{f._pool.current=t};return f.widgetAdded.connect(((e,t)=>_())),_(),h}},F=[_,v,y,k,S]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7302,3768],{83768:(e,t,o)=>{o.r(t),o.d(t,{default:()=>F});var n=o(53312),r=o(68722),i=o(71427),a=o(23295),s=o(9235),l=o(74258),d=o(12030),c=o(35613),g=o(81997),u=o(63485),w=o(88660),h=o(78156),b=o.n(h);class p{constructor(e){this._onSelectionChanged=()=>{var e,t,o,n,r,i;const a=Array.from(this._browser.selectedItems()),s=a.length>0,l=a.some((e=>"directory"===e.type));null===(e=this._widgets.get("placeholder"))||void 0===e||e.setHidden(s),null===(t=this._widgets.get("delete"))||void 0===t||t.setHidden(!s),null===(o=this._widgets.get("duplicate"))||void 0===o||o.setHidden(!s||l),null===(n=this._widgets.get("download"))||void 0===n||n.setHidden(!s||l),null===(r=this._widgets.get("open"))||void 0===r||r.setHidden(!s||l),null===(i=this._widgets.get("rename"))||void 0===i||i.setHidden(1!==a.length)},this._widgets=new Map,this._browser=e.browser;const{commands:t,selectionChanged:o,translator:r}=e,i=r.load("notebook"),a=n.ReactWidget.create(b().createElement("div",{key:"placeholder"},i.__("Select items to perform actions on them.")));a.id="fileAction-placeholder",this._widgets.set("placeholder",a),["open","download","rename","duplicate","delete"].forEach((e=>{const o=n.ReactWidget.create(b().createElement(n.CommandToolbarButtonComponent,{key:e,commands:t,id:`filebrowser:${e}`,args:{toolbar:!0},icon:void 0}));o.id=`fileAction-${e}`,o.addClass("jp-ToolbarButton"),o.addClass("jp-FileAction"),this._widgets.set(e,o)})),o.connect(this._onSelectionChanged,this),this._onSelectionChanged()}get widgets(){return this._widgets.values()}}const m="FileBrowser";var f;!function(e){e.activate="filebrowser:activate"}(f||(f={}));const _={id:"@jupyter-notebook/tree-extension:new",description:"Plugin to add extra commands to the file browser to create new notebooks, files, consoles and terminals.",requires:[d.ITranslator],optional:[n.IToolbarWidgetRegistry],autoStart:!0,activate:(e,t,o)=>{var n;const{commands:r,serviceManager:i}=e,a=t.load("notebook"),s={overflowMenuOptions:{isVisible:!1}},l=new u.MenuBar(s),d=new u.Menu({commands:r});d.title.label=a.__("New"),d.title.icon=c.caretDownIcon,l.addMenu(d);const g=()=>{var e,t;const o=null===(t=null===(e=i.kernelspecs)||void 0===e?void 0:e.specs)||void 0===t?void 0:t.kernelspecs;for(const e in o)d.addItem({args:{kernelName:e,isLauncher:!0},command:"notebook:create-new"});["terminal:create-new","console:create","filebrowser:create-new-file","filebrowser:create-new-directory"].forEach((e=>{d.addItem({command:e})}))};null===(n=i.kernelspecs)||void 0===n||n.specsChanged.connect((()=>{d.clearItems(),g()})),g(),o&&o.addFactory(m,"new-dropdown",(e=>{const t=new u.MenuBar(s);return t.addMenu(d),t.addClass("jp-DropdownMenu"),t}))}},v={id:"@jupyter-notebook/tree-extension:file-actions",description:"A plugin to add file browser actions to the file browser toolbar.",autoStart:!0,requires:[i.IDefaultFileBrowser,n.IToolbarWidgetRegistry,d.ITranslator],activate:(e,t,o,n)=>{const r=new g.Signal(t);["_selectItem","_handleMultiSelect","handleFileSelect"].forEach((e=>{const o=t.listing[e];t.listing[e]=(...e)=>{o.call(t.listing,...e),r.emit(void 0)}}));const{commands:i}=e,a=new p({commands:i,browser:t,selectionChanged:r,translator:n});for(const e of a.widgets)o.addFactory(m,e.id,(()=>e))}},y={id:"@jupyter-notebook/tree-extension:load-plugins",description:"Plugin to load the default plugins that are loaded on all the Notebook pages (tree, edit, view, etc.) so they are visible in the settings editor.",autoStart:!0,requires:[a.ISettingRegistry],activate(e,t){const{isDisabled:o}=r.PageConfig.Extension,n=t.connector,i=r.PageConfig.getOption("allPlugins");if(!i)return;const a=JSON.parse(i),s=new Set;Object.keys(a).forEach((e=>{const t=a[e];Object.keys(t).forEach((e=>{const o=t[e];"boolean"==typeof o&&o?s.add(e):Array.isArray(o)&&o.forEach((e=>{s.add(e)}))}))})),e.restored.then((async()=>{(await n.list("all")).ids.forEach((async e=>{const[n]=e.split(":");if((s.has(n)||s.has(e))&&!o(e)&&!(e in t.plugins))try{await t.load(e)}catch(t){console.warn(`Settings failed to load for (${e})`,t)}}))}))}},k={id:"@jupyter-notebook/tree-extension:open-file-browser",description:"A plugin to add file browser commands for the tree view.",requires:[w.INotebookTree,i.IDefaultFileBrowser],autoStart:!0,activate:(e,t,o)=>{const{commands:n}=e;n.addCommand(f.activate,{execute:()=>{t.currentWidget=o}})}},S={id:"@jupyter-notebook/tree-extension:widget",description:"A plugin to add the file browser widget to an INotebookShell.",requires:[i.IDefaultFileBrowser,d.ITranslator,a.ISettingRegistry,n.IToolbarWidgetRegistry,i.IFileBrowserFactory],optional:[s.IRunningSessionManagers,l.ISettingEditorTracker,l.IJSONSettingEditorTracker],autoStart:!0,provides:w.INotebookTree,activate:(e,t,o,r,a,l,d,g,u)=>{const h=new w.NotebookTreeWidget,b=o.load("notebook");if(t.title.label=b.__("Files"),t.node.setAttribute("role","region"),t.node.setAttribute("aria-label",b.__("File Browser Section")),t.title.icon=c.folderIcon,h.addWidget(t),h.tabBar.addTab(t.title),h.tabsMovable=!1,a.addFactory(m,"uploader",(e=>new i.Uploader({model:e.model,translator:o,label:b.__("Upload")}))),a.addFactory(m,"fileNameSearcher",(e=>{const t=(0,c.FilenameSearcher)({updateFilter:(t,o)=>{e.model.setFilter((e=>t(e.name.toLowerCase())))},useFuzzyFilter:!0,placeholder:b.__("Filter files by name"),forceRefresh:!0});return t.addClass("jp-FileBrowser-filterBox"),t})),(0,n.setToolbar)(t,(0,n.createToolbarFactory)(a,r,m,S.id,o)),d){const e=new s.RunningSessions(d,o);e.id="jp-running-sessions-tree",e.title.label=b.__("Running"),e.title.icon=c.runningIcon,h.addWidget(e),h.tabBar.addTab(e.title)}const p=r.load("@jupyterlab/filebrowser-extension:browser");Promise.all([p,e.restored]).then((([e])=>{["showFileCheckboxes","showFileSizeColumn","sortNotebooksFirst","showFullPath"].forEach((t=>{void 0===e.user[t]&&e.set(t,!0)}))})).catch((e=>{console.error(e.message)})),e.shell.add(h,"main",{rank:100}),[g,u].forEach((e=>{e&&e.widgetAdded.connect(((e,t)=>{h.addWidget(t),h.tabBar.addTab(t.title),h.currentWidget=t}))}));const{tracker:f}=l,_=()=>{f._pool.current=t};return f.widgetAdded.connect(((e,t)=>_())),_(),h}},F=[_,v,y,k,S]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7386,4811],{37386:(e,t,o)=>{o.r(t),o.d(t,{CellBarExtension:()=>u,CellToolbarTracker:()=>c});var l=o(12982),n=o(11351),a=o(68239),i=o(33625),s=o(81997);const r=["text/plain","application/vnd.jupyter.stdout","application/vnd.jupyter.stderr"],d="jp-toolbar-overlap";class c{constructor(e,t,o){if(this._isDisposed=!1,this._toolbar=null,this._toolbarItems=null,this._toolbarFactory=null,this._panel=e,this._previousActiveCell=this._panel.content.activeCell,this._toolbarItems=null!=t?t:null,this._toolbarFactory=null!=o?o:null,null===this._toolbarItems&&null===this._toolbarFactory)throw Error("You must provide the toolbarFactory or the toolbar items.");!this._toolbarFactory&&this._toolbarItems&&(this._onToolbarChanged(),this._toolbarItems.changed.connect(this._onToolbarChanged,this)),e.revealed.then((()=>{requestAnimationFrame((()=>{const t=e.content;this._onActiveCellChanged(t),t.activeCellChanged.connect(this._onActiveCellChanged,this),t.renderingLayoutChanged.connect(this._onActiveCellChanged,this),t.disposed.connect((()=>{t.activeCellChanged.disconnect(this._onActiveCellChanged)}))}))}))}_onMetadataChanged(e,t){"jupyter"===t.key&&("object"!=typeof t.newValue||!0!==t.newValue.source_hidden||"add"!==t.type&&"change"!==t.type?"object"==typeof t.oldValue&&!0===t.oldValue.source_hidden&&this._addToolbar(e):this._removeToolbar(e))}_onActiveCellChanged(e){this._previousActiveCell&&!this._previousActiveCell.isDisposed&&(this._removeToolbar(this._previousActiveCell.model),this._previousActiveCell.model.metadataChanged.disconnect(this._onMetadataChanged));const t=e.activeCell;this._previousActiveCell=t,null===t||t.inputHidden||(t.model.metadataChanged.connect(this._onMetadataChanged,this),this._addToolbar(t.model))}get isDisposed(){return this._isDisposed}dispose(){var e,t;this.isDisposed||(this._isDisposed=!0,null===(e=this._toolbarItems)||void 0===e||e.changed.disconnect(this._onToolbarChanged,this),null===(t=this._toolbar)||void 0===t||t.dispose(),this._panel=null,s.Signal.clearData(this))}_addToolbar(e){const t=this._getCell(e);if(t&&!t.isDisposed){const e=this._toolbar=new a.Toolbar;e.addClass("jp-cell-menu"),e.addClass("jp-cell-toolbar");const o=[t.ready];if(this._toolbarFactory)(0,l.setToolbar)(t,this._toolbarFactory,e),e.layout.widgets.forEach((e=>{e.update()}));else for(const{name:t,widget:l}of this._toolbarItems)e.addItem(t,l),l instanceof a.ReactWidget&&void 0!==l.renderPromise&&(l.update(),o.push(l.renderPromise));Promise.all(o).then((()=>{var o;t.isDisposed||(null===(o=this._panel)||void 0===o?void 0:o.content.activeCell)!==t?e.dispose():(t.layout.insertWidget(0,e),t.displayChanged.connect(this._resizeEventCallback,this),t.model.contentChanged.connect(this._changedEventCallback,this),this._updateCellForToolbarOverlap(t))})).catch((e=>{console.error("Error rendering buttons of the cell toolbar: ",e)}))}}_getCell(e){var t;return null===(t=this._panel)||void 0===t?void 0:t.content.widgets.find((t=>t.model===e))}_removeToolbar(e){var t,o;const l=this._getCell(e);l&&!l.isDisposed&&l.displayChanged.disconnect(this._resizeEventCallback,this),e.contentChanged.disconnect(this._changedEventCallback,this),(null===(t=this._toolbar)||void 0===t?void 0:t.parent)===l&&!1===(null===(o=this._toolbar)||void 0===o?void 0:o.isDisposed)&&this._toolbar.dispose()}_onToolbarChanged(){var e;const t=null===(e=this._panel)||void 0===e?void 0:e.content.activeCell;t&&(this._removeToolbar(t.model),this._addToolbar(t.model))}_changedEventCallback(){var e;const t=null===(e=this._panel)||void 0===e?void 0:e.content.activeCell;null!=t&&this._updateCellForToolbarOverlap(t)}_resizeEventCallback(){var e;const t=null===(e=this._panel)||void 0===e?void 0:e.content.activeCell;null!=t&&this._updateCellForToolbarOverlap(t)}_updateCellForToolbarOverlap(e){requestAnimationFrame((()=>{const t=e.node;t.classList.remove(d),this._cellToolbarOverlapsContents(e)&&t.classList.add(d)}))}_cellToolbarOverlapsContents(e){var t,o,l,n;const a=e.model.type,i=null===(t=e.editorWidget)||void 0===t?void 0:t.node.getBoundingClientRect(),s=null!==(o=null==i?void 0:i.left)&&void 0!==o?o:0,r=null!==(l=null==i?void 0:i.right)&&void 0!==l?l:0,d=this._cellToolbarLeft(e);return null!==d&&((s+r)/2>d||("markdown"===a&&e.rendered?this._markdownOverlapsToolbar(e):"default"===(null===(n=this._panel)||void 0===n?void 0:n.content.renderingLayout)?this._codeOverlapsToolbar(e):this._outputOverlapsToolbar(e)))}_markdownOverlapsToolbar(e){const t=e.inputArea;if(!t)return!1;const o=t.renderedInput.node.firstElementChild;if(null===o)return!1;const l=o.style.maxWidth;o.style.maxWidth="max-content";const n=o.getBoundingClientRect().right;o.style.maxWidth=l;const a=this._cellToolbarLeft(e);return null!==a&&n>a}_outputOverlapsToolbar(e){const t=e.outputArea.node;if(t){const o=t.querySelectorAll("[data-mime-type]"),l=this._cellToolbarRect(e);if(l){const{left:e,bottom:t}=l;return(0,i.some)(o,(o=>{const l=o.firstElementChild;if(l){const n=new Range;r.includes(o.getAttribute("data-mime-type")||"")?n.selectNodeContents(l):n.selectNode(l);const{right:a,top:i}=n.getBoundingClientRect();return a>e&&i<t}return!1}))}}return!1}_codeOverlapsToolbar(e){const t=e.editorWidget,o=e.editor;if(!t||!o)return!1;if(o.lineCount<1)return!1;const l=t.node.getElementsByClassName("cm-line");if(l.length<1)return!1;let n=l[0].getBoundingClientRect().left;const a=document.createRange();a.selectNodeContents(l[0]),n+=a.getBoundingClientRect().width;const i=this._cellToolbarLeft(e);return null!==i&&n>i}_cellToolbarRect(e){var t;return(null===(t=this._toolbar)||void 0===t?void 0:t.parent)!==e?null:this._toolbar.node.getBoundingClientRect()}_cellToolbarLeft(e){var t;return(null===(t=this._cellToolbarRect(e))||void 0===t?void 0:t.left)||null}}const h=[{command:"notebook:duplicate-below",name:"duplicate-cell"},{command:"notebook:move-cell-up",name:"move-cell-up"},{command:"notebook:move-cell-down",name:"move-cell-down"},{command:"notebook:insert-cell-above",name:"insert-cell-above"},{command:"notebook:insert-cell-below",name:"insert-cell-below"},{command:"notebook:delete-cell",name:"delete-cell"}];class u{constructor(e,t){this._commands=e,this._toolbarFactory=null!=t?t:this.defaultToolbarFactory}get defaultToolbarFactory(){const e=(0,l.createDefaultFactory)(this._commands);return t=>new n.ObservableList({values:h.map((o=>({name:o.name,widget:e(u.FACTORY_NAME,t,o)})))})}createNew(e){return new c(e,void 0,this._toolbarFactory)}}u.FACTORY_NAME="Cell"}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7386,4811],{37386:(e,t,o)=>{o.r(t),o.d(t,{CellBarExtension:()=>u,CellToolbarTracker:()=>c});var l=o(53312),n=o(31231),a=o(35613),i=o(33625),s=o(81997);const r=["text/plain","application/vnd.jupyter.stdout","application/vnd.jupyter.stderr"],d="jp-toolbar-overlap";class c{constructor(e,t,o){if(this._isDisposed=!1,this._toolbar=null,this._toolbarItems=null,this._toolbarFactory=null,this._panel=e,this._previousActiveCell=this._panel.content.activeCell,this._toolbarItems=null!=t?t:null,this._toolbarFactory=null!=o?o:null,null===this._toolbarItems&&null===this._toolbarFactory)throw Error("You must provide the toolbarFactory or the toolbar items.");!this._toolbarFactory&&this._toolbarItems&&(this._onToolbarChanged(),this._toolbarItems.changed.connect(this._onToolbarChanged,this)),e.revealed.then((()=>{requestAnimationFrame((()=>{const t=e.content;this._onActiveCellChanged(t),t.activeCellChanged.connect(this._onActiveCellChanged,this),t.renderingLayoutChanged.connect(this._onActiveCellChanged,this),t.disposed.connect((()=>{t.activeCellChanged.disconnect(this._onActiveCellChanged)}))}))}))}_onMetadataChanged(e,t){"jupyter"===t.key&&("object"!=typeof t.newValue||!0!==t.newValue.source_hidden||"add"!==t.type&&"change"!==t.type?"object"==typeof t.oldValue&&!0===t.oldValue.source_hidden&&this._addToolbar(e):this._removeToolbar(e))}_onActiveCellChanged(e){this._previousActiveCell&&!this._previousActiveCell.isDisposed&&(this._removeToolbar(this._previousActiveCell.model),this._previousActiveCell.model.metadataChanged.disconnect(this._onMetadataChanged));const t=e.activeCell;this._previousActiveCell=t,null===t||t.inputHidden||(t.model.metadataChanged.connect(this._onMetadataChanged,this),this._addToolbar(t.model))}get isDisposed(){return this._isDisposed}dispose(){var e,t;this.isDisposed||(this._isDisposed=!0,null===(e=this._toolbarItems)||void 0===e||e.changed.disconnect(this._onToolbarChanged,this),null===(t=this._toolbar)||void 0===t||t.dispose(),this._panel=null,s.Signal.clearData(this))}_addToolbar(e){const t=this._getCell(e);if(t&&!t.isDisposed){const e=this._toolbar=new a.Toolbar;e.addClass("jp-cell-menu"),e.addClass("jp-cell-toolbar");const o=[t.ready];if(this._toolbarFactory)(0,l.setToolbar)(t,this._toolbarFactory,e),e.layout.widgets.forEach((e=>{e.update()}));else for(const{name:t,widget:l}of this._toolbarItems)e.addItem(t,l),l instanceof a.ReactWidget&&void 0!==l.renderPromise&&(l.update(),o.push(l.renderPromise));o.push(t.ready),Promise.all(o).then((()=>{var o;t.isDisposed||(null===(o=this._panel)||void 0===o?void 0:o.content.activeCell)!==t?e.dispose():(t.inputArea.layout.insertWidget(0,e),t.displayChanged.connect(this._resizeEventCallback,this),t.model.contentChanged.connect(this._changedEventCallback,this),this._updateCellForToolbarOverlap(t))})).catch((e=>{console.error("Error rendering buttons of the cell toolbar: ",e)}))}}_getCell(e){var t;return null===(t=this._panel)||void 0===t?void 0:t.content.widgets.find((t=>t.model===e))}_removeToolbar(e){var t,o;const l=this._getCell(e);l&&!l.isDisposed&&l.displayChanged.disconnect(this._resizeEventCallback,this),e.contentChanged.disconnect(this._changedEventCallback,this),(null===(t=this._toolbar)||void 0===t?void 0:t.parent)===(null==l?void 0:l.inputArea)&&!1===(null===(o=this._toolbar)||void 0===o?void 0:o.isDisposed)&&this._toolbar.dispose()}_onToolbarChanged(){var e;const t=null===(e=this._panel)||void 0===e?void 0:e.content.activeCell;t&&(this._removeToolbar(t.model),this._addToolbar(t.model))}_changedEventCallback(){var e;const t=null===(e=this._panel)||void 0===e?void 0:e.content.activeCell;null!=t&&this._updateCellForToolbarOverlap(t)}_resizeEventCallback(){var e;const t=null===(e=this._panel)||void 0===e?void 0:e.content.activeCell;null!=t&&this._updateCellForToolbarOverlap(t)}_updateCellForToolbarOverlap(e){requestAnimationFrame((()=>{const t=e.node;t.classList.remove(d),this._cellToolbarOverlapsContents(e)&&t.classList.add(d)}))}_cellToolbarOverlapsContents(e){var t,o,l,n;const a=e.model.type,i=null===(t=e.editorWidget)||void 0===t?void 0:t.node.getBoundingClientRect(),s=null!==(o=null==i?void 0:i.left)&&void 0!==o?o:0,r=null!==(l=null==i?void 0:i.right)&&void 0!==l?l:0,d=this._cellToolbarLeft(e);return null!==d&&((s+r)/2>d||("markdown"===a&&e.rendered?this._markdownOverlapsToolbar(e):"default"===(null===(n=this._panel)||void 0===n?void 0:n.content.renderingLayout)?this._codeOverlapsToolbar(e):this._outputOverlapsToolbar(e)))}_markdownOverlapsToolbar(e){const t=e.inputArea;if(!t)return!1;const o=t.renderedInput.node.firstElementChild;if(null===o)return!1;const l=o.style.maxWidth;o.style.maxWidth="max-content";const n=o.getBoundingClientRect().right;o.style.maxWidth=l;const a=this._cellToolbarLeft(e);return null!==a&&n>a}_outputOverlapsToolbar(e){const t=e.outputArea.node;if(t){const o=t.querySelectorAll("[data-mime-type]"),l=this._cellToolbarRect(e);if(l){const{left:e,bottom:t}=l;return(0,i.some)(o,(o=>{const l=o.firstElementChild;if(l){const n=new Range;r.includes(o.getAttribute("data-mime-type")||"")?n.selectNodeContents(l):n.selectNode(l);const{right:a,top:i}=n.getBoundingClientRect();return a>e&&i<t}return!1}))}}return!1}_codeOverlapsToolbar(e){const t=e.editorWidget,o=e.editor;if(!t||!o)return!1;if(o.lineCount<1)return!1;const l=t.node.getElementsByClassName("cm-line");if(l.length<1)return!1;let n=l[0].getBoundingClientRect().left;const a=document.createRange();a.selectNodeContents(l[0]),n+=a.getBoundingClientRect().width;const i=this._cellToolbarLeft(e);return null!==i&&n>i}_cellToolbarRect(e){var t;return(null===(t=this._toolbar)||void 0===t?void 0:t.parent)!==e.inputArea?null:this._toolbar.node.getBoundingClientRect()}_cellToolbarLeft(e){var t;return(null===(t=this._cellToolbarRect(e))||void 0===t?void 0:t.left)||null}}const h=[{command:"notebook:duplicate-below",name:"duplicate-cell"},{command:"notebook:move-cell-up",name:"move-cell-up"},{command:"notebook:move-cell-down",name:"move-cell-down"},{command:"notebook:insert-cell-above",name:"insert-cell-above"},{command:"notebook:insert-cell-below",name:"insert-cell-below"},{command:"notebook:delete-cell",name:"delete-cell"}];class u{constructor(e,t){this._commands=e,this._toolbarFactory=null!=t?t:this.defaultToolbarFactory}get defaultToolbarFactory(){const e=(0,l.createDefaultFactory)(this._commands);return t=>new n.ObservableList({values:h.map((o=>({name:o.name,widget:e(u.FACTORY_NAME,t,o)})))})}createNew(e){return new c(e,void 0,this._toolbarFactory)}}u.FACTORY_NAME="Cell"}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7391],{77391:(e,t,i)=>{i.r(t),i.d(t,{COMPLETER_ACTIVE_CLASS:()=>D,COMPLETER_ENABLED_CLASS:()=>E,CodeEditor:()=>o,CodeEditorWrapper:()=>L,CodeViewerWidget:()=>j,IEditorMimeTypeService:()=>s,IEditorServices:()=>S,IPositionModel:()=>N,JSONEditor:()=>m,LineCol:()=>f});var s,o,n=i(23781),r=i(11351),a=i(81997);!function(e){e.defaultMimeType="text/plain"}(s||(s={})),function(e){e.Model=class{constructor(e={}){var t,i;this.standaloneModel=!1,this._isDisposed=!1,this._selections=new r.ObservableMap,this._mimeType=s.defaultMimeType,this._mimeTypeChanged=new a.Signal(this),this.standaloneModel=void 0===e.sharedModel,this.sharedModel=null!==(t=e.sharedModel)&&void 0!==t?t:new n.YFile,this._mimeType=null!==(i=e.mimeType)&&void 0!==i?i:s.defaultMimeType}get mimeTypeChanged(){return this._mimeTypeChanged}get selections(){return this._selections}get mimeType(){return this._mimeType}set mimeType(e){const t=this.mimeType;t!==e&&(this._mimeType=e,this._mimeTypeChanged.emit({name:"mimeType",oldValue:t,newValue:e}))}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._selections.dispose(),this.standaloneModel&&this.sharedModel.dispose(),a.Signal.clearData(this))}}}(o||(o={}));var d=i(71677),h=i(68239),l=i(20998),c=i(31516);const u="jp-mod-error";class m extends c.Widget{constructor(e){super(),this._dataDirty=!1,this._inputDirty=!1,this._source=null,this._originalValue=l.JSONExt.emptyObject,this._changeGuard=!1,this.translator=e.translator||d.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.addClass("jp-JSONEditor"),this.headerNode=document.createElement("div"),this.headerNode.className="jp-JSONEditor-header",this.revertButtonNode=h.undoIcon.element({tag:"span",title:this._trans.__("Revert changes to data")}),this.commitButtonNode=h.checkIcon.element({tag:"span",title:this._trans.__("Commit changes to data"),marginLeft:"8px"}),this.editorHostNode=document.createElement("div"),this.editorHostNode.className="jp-JSONEditor-host",this.headerNode.appendChild(this.revertButtonNode),this.headerNode.appendChild(this.commitButtonNode),this.node.appendChild(this.headerNode),this.node.appendChild(this.editorHostNode);const t=new o.Model({mimeType:"application/json"});t.sharedModel.changed.connect(this._onModelChanged,this),this.model=t,this.editor=e.editorFactory({host:this.editorHostNode,model:t,config:{readOnly:!0}})}get source(){return this._source}set source(e){this._source!==e&&(this._source&&this._source.changed.disconnect(this._onSourceChanged,this),this._source=e,this.editor.setOption("readOnly",null===e),e&&e.changed.connect(this._onSourceChanged,this),this._setValue())}get isDirty(){return this._dataDirty||this._inputDirty}dispose(){var e;this.isDisposed||(null===(e=this.source)||void 0===e||e.dispose(),this.model.dispose(),this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"blur":this._evtBlur(e);break;case"click":this._evtClick(e)}}onAfterAttach(e){const t=this.editorHostNode;t.addEventListener("blur",this,!0),t.addEventListener("click",this,!0),this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.headerNode.addEventListener("click",this)}onBeforeDetach(e){const t=this.editorHostNode;t.removeEventListener("blur",this,!0),t.removeEventListener("click",this,!0),this.headerNode.removeEventListener("click",this)}_onSourceChanged(e,t){this._changeGuard||(this._inputDirty||this.editor.hasFocus()?this._dataDirty=!0:this._setValue())}_onModelChanged(e,t){if(t.sourceChange){let e=!0;try{const e=JSON.parse(this.editor.model.sharedModel.getSource());this.removeClass(u),this._inputDirty=!this._changeGuard&&!l.JSONExt.deepEqual(e,this._originalValue)}catch(t){this.addClass(u),this._inputDirty=!0,e=!1}this.revertButtonNode.hidden=!this._inputDirty,this.commitButtonNode.hidden=!e||!this._inputDirty}}_evtBlur(e){!this._inputDirty&&this._dataDirty&&this._setValue()}_evtClick(e){const t=e.target;this.revertButtonNode.contains(t)?this._setValue():this.commitButtonNode.contains(t)?this.commitButtonNode.hidden||this.hasClass(u)||(this._changeGuard=!0,this._mergeContent(),this._changeGuard=!1,this._setValue()):this.editorHostNode.contains(t)&&this.editor.focus()}_mergeContent(){const e=this.editor.model,t=this._originalValue,i=JSON.parse(e.sharedModel.getSource()),s=this.source;if(s){for(const e in i)l.JSONExt.deepEqual(i[e],t[e]||null)||s.set(e,i[e]);for(const e in t)e in i||s.delete(e)}}_setValue(){this._dataDirty=!1,this._inputDirty=!1,this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.removeClass(u);const e=this.editor.model,t=this._source?this._source.toJSON():{};if(this._changeGuard=!0,void 0===t)e.sharedModel.setSource(this._trans.__("No data!")),this._originalValue=l.JSONExt.emptyObject;else{const i=JSON.stringify(t,null,4);e.sharedModel.setSource(i),this._originalValue=t,i.length>1&&"{"===i[0]&&this.editor.setCursorPosition({line:0,column:1})}this._changeGuard=!1,this.commitButtonNode.hidden=!0,this.revertButtonNode.hidden=!0}}var p=i(34276),_=i(78156),g=i.n(_),v=i(12982);class C extends g().Component{constructor(e){super(e),this._handleChange=e=>{this.setState({value:e.currentTarget.value})},this._handleSubmit=e=>{e.preventDefault();const t=parseInt(this._textInput.value,10);return!isNaN(t)&&isFinite(t)&&1<=t&&t<=this.props.maxLine&&this.props.handleSubmit(t),!1},this._handleFocus=()=>{this.setState({hasFocus:!0})},this._handleBlur=()=>{this.setState({hasFocus:!1})},this._textInput=null,this.translator=e.translator||d.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.state={value:"",hasFocus:!1,textInputId:v.DOMUtils.createDomID()+"-line-number-input"}}componentDidMount(){this._textInput.focus()}render(){return g().createElement("div",{className:"jp-lineFormSearch"},g().createElement("form",{name:"lineColumnForm",onSubmit:this._handleSubmit,noValidate:!0},g().createElement("div",{className:(0,h.classes)("jp-lineFormWrapper","lm-lineForm-wrapper",this.state.hasFocus?"jp-lineFormWrapperFocusWithin":void 0)},g().createElement("input",{type:"text",id:this.state.textInputId,className:"jp-lineFormInput",onChange:this._handleChange,onFocus:this._handleFocus,onBlur:this._handleBlur,value:this.state.value,ref:e=>{this._textInput=e}}),g().createElement("div",{className:"jp-baseLineForm jp-lineFormButtonContainer"},g().createElement(h.lineFormIcon.react,{className:"jp-baseLineForm jp-lineFormButtonIcon",elementPosition:"center"}),g().createElement("input",{type:"submit",className:"jp-baseLineForm jp-lineFormButton",value:""}))),g().createElement("label",{className:"jp-lineFormCaption",htmlFor:this.state.textInputId},this._trans.__("Go to line number between 1 and %1",this.props.maxLine))))}}function y(e){const t=(e.translator||d.nullTranslator).load("jupyterlab");return g().createElement(p.TextItem,{onClick:e.handleClick,source:t.__("Ln %1, Col %2",e.line,e.column),title:t.__("Go to line number…"),tabIndex:0,onKeyDown:t=>{"Enter"!==t.key&&"Spacebar"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),e.handleClick())}})}class f extends h.VDomRenderer{constructor(e){super(new f.Model),this._popup=null,this.addClass("jp-mod-highlighted"),this.translator=e||d.nullTranslator}render(){return null===this.model?null:g().createElement(y,{line:this.model.line,column:this.model.column,translator:this.translator,handleClick:()=>this._handleClick()})}_handleClick(){this._popup&&this._popup.dispose();const e=h.ReactWidget.create(g().createElement(C,{handleSubmit:e=>this._handleSubmit(e),currentLine:this.model.line,maxLine:this.model.editor.lineCount,translator:this.translator}));this._popup=(0,p.showPopup)({body:e,anchor:this,align:"right"})}_handleSubmit(e){this.model.editor.setCursorPosition({line:e-1,column:0}),this._popup.dispose(),this.model.editor.focus()}}!function(e){class t extends h.VDomModel{constructor(){super(...arguments),this._onSelectionChanged=()=>{const e=this._getAllState(),t=this.editor.getCursorPosition();this._line=t.line+1,this._column=t.column+1,this._triggerChange(e,this._getAllState())},this._line=1,this._column=1,this._editor=null}get editor(){return this._editor}set editor(e){var t;const i=this._editor;(null===(t=null==i?void 0:i.model)||void 0===t?void 0:t.selections)&&i.model.selections.changed.disconnect(this._onSelectionChanged);const s=this._getAllState();if(this._editor=e,this._editor){this._editor.model.selections.changed.connect(this._onSelectionChanged);const e=this._editor.getCursorPosition();this._column=e.column+1,this._line=e.line+1}else this._column=1,this._line=1;this._triggerChange(s,this._getAllState())}get line(){return this._line}get column(){return this._column}_getAllState(){return[this._line,this._column]}_triggerChange(e,t){e[0]===t[0]&&e[1]===t[1]||this.stateChanged.emit(void 0)}}e.Model=t}(f||(f={}));const E="jp-mod-completer-enabled",D="jp-mod-completer-active",S=new l.Token("@jupyterlab/codeeditor:IEditorServices","A service for the text editor provider\n for the application. Use this to create new text editors and host them in your\n UI elements."),N=new l.Token("@jupyterlab/codeeditor:IPositionModel","A service to handle an code editor cursor position."),T="jp-mod-has-primary-selection",O="jp-mod-in-leading-whitespace",b="jp-mod-dropTarget",x=/^\s+$/;class L extends c.Widget{constructor(e){super();const{factory:t,model:i,editorOptions:s}=e;(this.editor=t({host:this.node,model:i,...s})).model.selections.changed.connect(this._onSelectionsChanged,this)}get model(){return this.editor.model}dispose(){this.isDisposed||(this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e)}}onActivateRequest(e){this.editor.focus()}onAfterAttach(e){super.onAfterAttach(e);const t=this.node;t.addEventListener("lm-dragenter",this),t.addEventListener("lm-dragleave",this),t.addEventListener("lm-dragover",this),t.addEventListener("lm-drop",this)}onBeforeDetach(e){const t=this.node;t.removeEventListener("lm-dragenter",this),t.removeEventListener("lm-dragleave",this),t.removeEventListener("lm-dragover",this),t.removeEventListener("lm-drop",this)}_onSelectionsChanged(){const{start:e,end:t}=this.editor.getSelection();e.column!==t.column||e.line!==t.line?(this.addClass(T),this.removeClass(O)):(this.removeClass(T),this.editor.getLine(t.line).slice(0,t.column).match(x)?this.addClass(O):this.removeClass(O))}_evtDragEnter(e){!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation(),this.addClass("jp-mod-dropTarget"))}_evtDragLeave(e){this.removeClass(b),!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation())}_evtDragOver(e){this.removeClass(b),!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation(),e.dropAction="copy",this.addClass(b))}_evtDrop(e){if(!0===this.editor.getOption("readOnly"))return;const t=M.findTextData(e.mimeData);if(void 0===t)return;const i={top:e.y,bottom:e.y,left:e.x,right:e.x,x:e.x,y:e.y,width:0,height:0},s=this.editor.getPositionForCoordinate(i);if(null===s)return;if(this.removeClass(b),e.preventDefault(),e.stopPropagation(),"none"===e.proposedAction)return void(e.dropAction="none");const o=this.editor.getOffsetAt(s);this.model.sharedModel.updateSource(o,o,t)}}var M;!function(e){e.findTextData=function(e){const t=e.types().find((e=>0===e.indexOf("text")));if(void 0!==t)return e.getData(t)}}(M||(M={}));class j extends c.Widget{constructor(e){var t;super(),this.model=e.model;const i=new L({factory:e.factory,model:this.model,editorOptions:{...e.editorOptions,config:{...null===(t=e.editorOptions)||void 0===t?void 0:t.config,readOnly:!0}}});this.editor=i.editor,(this.layout=new c.StackedLayout).addWidget(i)}static createCodeViewer(e){const{content:t,mimeType:i,...s}=e,n=new o.Model({mimeType:i});n.sharedModel.setSource(t);const r=new j({...s,model:n});return r.disposed.connect((()=>{n.dispose()})),r}get content(){return this.model.sharedModel.getSource()}get mimeType(){return this.model.mimeType}}}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7391],{77391:(e,t,i)=>{i.r(t),i.d(t,{COMPLETER_ACTIVE_CLASS:()=>D,COMPLETER_ENABLED_CLASS:()=>E,CodeEditor:()=>o,CodeEditorWrapper:()=>L,CodeViewerWidget:()=>j,IEditorMimeTypeService:()=>s,IEditorServices:()=>S,IPositionModel:()=>N,JSONEditor:()=>m,LineCol:()=>f});var s,o,n=i(57508),r=i(31231),a=i(81997);!function(e){e.defaultMimeType="text/plain"}(s||(s={})),function(e){e.Model=class{constructor(e={}){var t,i;this.standaloneModel=!1,this._isDisposed=!1,this._selections=new r.ObservableMap,this._mimeType=s.defaultMimeType,this._mimeTypeChanged=new a.Signal(this),this.standaloneModel=void 0===e.sharedModel,this.sharedModel=null!==(t=e.sharedModel)&&void 0!==t?t:new n.YFile,this._mimeType=null!==(i=e.mimeType)&&void 0!==i?i:s.defaultMimeType}get mimeTypeChanged(){return this._mimeTypeChanged}get selections(){return this._selections}get mimeType(){return this._mimeType}set mimeType(e){const t=this.mimeType;t!==e&&(this._mimeType=e,this._mimeTypeChanged.emit({name:"mimeType",oldValue:t,newValue:e}))}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._selections.dispose(),this.standaloneModel&&this.sharedModel.dispose(),a.Signal.clearData(this))}}}(o||(o={}));var d=i(12030),l=i(35613),h=i(20998),c=i(63485);const u="jp-mod-error";class m extends c.Widget{constructor(e){super(),this._dataDirty=!1,this._inputDirty=!1,this._source=null,this._originalValue=h.JSONExt.emptyObject,this._changeGuard=!1,this.translator=e.translator||d.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.addClass("jp-JSONEditor"),this.headerNode=document.createElement("div"),this.headerNode.className="jp-JSONEditor-header",this.revertButtonNode=l.undoIcon.element({tag:"span",title:this._trans.__("Revert changes to data")}),this.commitButtonNode=l.checkIcon.element({tag:"span",title:this._trans.__("Commit changes to data"),marginLeft:"8px"}),this.editorHostNode=document.createElement("div"),this.editorHostNode.className="jp-JSONEditor-host",this.headerNode.appendChild(this.revertButtonNode),this.headerNode.appendChild(this.commitButtonNode),this.node.appendChild(this.headerNode),this.node.appendChild(this.editorHostNode);const t=new o.Model({mimeType:"application/json"});t.sharedModel.changed.connect(this._onModelChanged,this),this.model=t,this.editor=e.editorFactory({host:this.editorHostNode,model:t,config:{readOnly:!0}})}get source(){return this._source}set source(e){this._source!==e&&(this._source&&this._source.changed.disconnect(this._onSourceChanged,this),this._source=e,this.editor.setOption("readOnly",null===e),e&&e.changed.connect(this._onSourceChanged,this),this._setValue())}get isDirty(){return this._dataDirty||this._inputDirty}dispose(){var e;this.isDisposed||(null===(e=this.source)||void 0===e||e.dispose(),this.model.dispose(),this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"blur":this._evtBlur(e);break;case"click":this._evtClick(e)}}onAfterAttach(e){const t=this.editorHostNode;t.addEventListener("blur",this,!0),t.addEventListener("click",this,!0),this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.headerNode.addEventListener("click",this)}onBeforeDetach(e){const t=this.editorHostNode;t.removeEventListener("blur",this,!0),t.removeEventListener("click",this,!0),this.headerNode.removeEventListener("click",this)}_onSourceChanged(e,t){this._changeGuard||(this._inputDirty||this.editor.hasFocus()?this._dataDirty=!0:this._setValue())}_onModelChanged(e,t){if(t.sourceChange){let e=!0;try{const e=JSON.parse(this.editor.model.sharedModel.getSource());this.removeClass(u),this._inputDirty=!this._changeGuard&&!h.JSONExt.deepEqual(e,this._originalValue)}catch(t){this.addClass(u),this._inputDirty=!0,e=!1}this.revertButtonNode.hidden=!this._inputDirty,this.commitButtonNode.hidden=!e||!this._inputDirty}}_evtBlur(e){!this._inputDirty&&this._dataDirty&&this._setValue()}_evtClick(e){const t=e.target;this.revertButtonNode.contains(t)?this._setValue():this.commitButtonNode.contains(t)?this.commitButtonNode.hidden||this.hasClass(u)||(this._changeGuard=!0,this._mergeContent(),this._changeGuard=!1,this._setValue()):this.editorHostNode.contains(t)&&this.editor.focus()}_mergeContent(){const e=this.editor.model,t=this._originalValue,i=JSON.parse(e.sharedModel.getSource()),s=this.source;if(s){for(const e in i)h.JSONExt.deepEqual(i[e],t[e]||null)||s.set(e,i[e]);for(const e in t)e in i||s.delete(e)}}_setValue(){this._dataDirty=!1,this._inputDirty=!1,this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.removeClass(u);const e=this.editor.model,t=this._source?this._source.toJSON():{};if(this._changeGuard=!0,void 0===t)e.sharedModel.setSource(this._trans.__("No data!")),this._originalValue=h.JSONExt.emptyObject;else{const i=JSON.stringify(t,null,4);e.sharedModel.setSource(i),this._originalValue=t,i.length>1&&"{"===i[0]&&this.editor.setCursorPosition({line:0,column:1})}this._changeGuard=!1,this.commitButtonNode.hidden=!0,this.revertButtonNode.hidden=!0}}var p=i(71098),_=i(78156),g=i.n(_),v=i(53312);class C extends g().Component{constructor(e){super(e),this._handleChange=e=>{this.setState({value:e.currentTarget.value})},this._handleSubmit=e=>{e.preventDefault();const t=parseInt(this._textInput.value,10);return!isNaN(t)&&isFinite(t)&&1<=t&&t<=this.props.maxLine&&this.props.handleSubmit(t),!1},this._handleFocus=()=>{this.setState({hasFocus:!0})},this._handleBlur=()=>{this.setState({hasFocus:!1})},this._textInput=null,this.translator=e.translator||d.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.state={value:"",hasFocus:!1,textInputId:v.DOMUtils.createDomID()+"-line-number-input"}}componentDidMount(){this._textInput.focus()}render(){return g().createElement("div",{className:"jp-lineFormSearch"},g().createElement("form",{name:"lineColumnForm",onSubmit:this._handleSubmit,noValidate:!0},g().createElement("div",{className:(0,l.classes)("jp-lineFormWrapper","lm-lineForm-wrapper",this.state.hasFocus?"jp-lineFormWrapperFocusWithin":void 0)},g().createElement("input",{type:"text",id:this.state.textInputId,className:"jp-lineFormInput",onChange:this._handleChange,onFocus:this._handleFocus,onBlur:this._handleBlur,value:this.state.value,ref:e=>{this._textInput=e}}),g().createElement("div",{className:"jp-baseLineForm jp-lineFormButtonContainer"},g().createElement(l.lineFormIcon.react,{className:"jp-baseLineForm jp-lineFormButtonIcon",elementPosition:"center"}),g().createElement("input",{type:"submit",className:"jp-baseLineForm jp-lineFormButton",value:""}))),g().createElement("label",{className:"jp-lineFormCaption",htmlFor:this.state.textInputId},this._trans.__("Go to line number between 1 and %1",this.props.maxLine))))}}function y(e){const t=(e.translator||d.nullTranslator).load("jupyterlab");return g().createElement(p.TextItem,{onClick:e.handleClick,source:t.__("Ln %1, Col %2",e.line,e.column),title:t.__("Go to line number…"),tabIndex:0,onKeyDown:t=>{"Enter"!==t.key&&"Spacebar"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),e.handleClick())}})}class f extends l.VDomRenderer{constructor(e){super(new f.Model),this._popup=null,this.addClass("jp-mod-highlighted"),this.translator=e||d.nullTranslator}render(){return null===this.model?null:g().createElement(y,{line:this.model.line,column:this.model.column,translator:this.translator,handleClick:()=>this._handleClick()})}_handleClick(){this._popup&&this._popup.dispose();const e=l.ReactWidget.create(g().createElement(C,{handleSubmit:e=>this._handleSubmit(e),currentLine:this.model.line,maxLine:this.model.editor.lineCount,translator:this.translator}));this._popup=(0,p.showPopup)({body:e,anchor:this,align:"right"})}_handleSubmit(e){this.model.editor.setCursorPosition({line:e-1,column:0}),this._popup.dispose(),this.model.editor.focus()}}!function(e){class t extends l.VDomModel{constructor(){super(...arguments),this._onSelectionChanged=()=>{const e=this._getAllState(),t=this.editor.getCursorPosition();this._line=t.line+1,this._column=t.column+1,this._triggerChange(e,this._getAllState())},this._line=1,this._column=1,this._editor=null}get editor(){return this._editor}set editor(e){var t;const i=this._editor;(null===(t=null==i?void 0:i.model)||void 0===t?void 0:t.selections)&&i.model.selections.changed.disconnect(this._onSelectionChanged);const s=this._getAllState();if(this._editor=e,this._editor){this._editor.model.selections.changed.connect(this._onSelectionChanged);const e=this._editor.getCursorPosition();this._column=e.column+1,this._line=e.line+1}else this._column=1,this._line=1;this._triggerChange(s,this._getAllState())}get line(){return this._line}get column(){return this._column}_getAllState(){return[this._line,this._column]}_triggerChange(e,t){e[0]===t[0]&&e[1]===t[1]||this.stateChanged.emit(void 0)}}e.Model=t}(f||(f={}));const E="jp-mod-completer-enabled",D="jp-mod-completer-active",S=new h.Token("@jupyterlab/codeeditor:IEditorServices","A service for the text editor provider\n for the application. Use this to create new text editors and host them in your\n UI elements."),N=new h.Token("@jupyterlab/codeeditor:IPositionModel","A service to handle an code editor cursor position."),T="jp-mod-has-primary-selection",O="jp-mod-in-leading-whitespace",b="jp-mod-dropTarget",x=/^\s+$/;class L extends c.Widget{constructor(e){super();const{factory:t,model:i,editorOptions:s}=e;(this.editor=t({host:this.node,model:i,...s})).model.selections.changed.connect(this._onSelectionsChanged,this)}get model(){return this.editor.model}dispose(){this.isDisposed||(this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e)}}onActivateRequest(e){this.editor.focus()}onAfterAttach(e){super.onAfterAttach(e);const t=this.node;t.addEventListener("lm-dragenter",this),t.addEventListener("lm-dragleave",this),t.addEventListener("lm-dragover",this),t.addEventListener("lm-drop",this)}onBeforeDetach(e){const t=this.node;t.removeEventListener("lm-dragenter",this),t.removeEventListener("lm-dragleave",this),t.removeEventListener("lm-dragover",this),t.removeEventListener("lm-drop",this)}_onSelectionsChanged(){const{start:e,end:t}=this.editor.getSelection();e.column!==t.column||e.line!==t.line?(this.addClass(T),this.removeClass(O)):(this.removeClass(T),this.editor.getLine(t.line).slice(0,t.column).match(x)?this.addClass(O):this.removeClass(O))}_evtDragEnter(e){!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation(),this.addClass("jp-mod-dropTarget"))}_evtDragLeave(e){this.removeClass(b),!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation())}_evtDragOver(e){this.removeClass(b),!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation(),e.dropAction="copy",this.addClass(b))}_evtDrop(e){if(!0===this.editor.getOption("readOnly"))return;const t=M.findTextData(e.mimeData);if(void 0===t)return;const i={top:e.y,bottom:e.y,left:e.x,right:e.x},s=this.editor.getPositionForCoordinate(i);if(null===s)return;if(this.removeClass(b),e.preventDefault(),e.stopPropagation(),"none"===e.proposedAction)return void(e.dropAction="none");const o=this.editor.getOffsetAt(s);this.model.sharedModel.updateSource(o,o,t)}}var M;!function(e){e.findTextData=function(e){const t=e.types().find((e=>0===e.indexOf("text")));if(void 0!==t)return e.getData(t)}}(M||(M={}));class j extends c.Widget{constructor(e){var t;super(),this.model=e.model;const i=new L({factory:e.factory,model:this.model,editorOptions:{...e.editorOptions,config:{...null===(t=e.editorOptions)||void 0===t?void 0:t.config,readOnly:!0}}});this.editor=i.editor,(this.layout=new c.StackedLayout).addWidget(i)}static createCodeViewer(e){const{content:t,mimeType:i,...s}=e,n=new o.Model({mimeType:i});n.sharedModel.setSource(t);const r=new j({...s,model:n});return r.disposed.connect((()=>{n.dispose()})),r}get content(){return this.model.sharedModel.getSource()}get mimeType(){return this.model.mimeType}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7450],{67450:(e,t,n)=>{n.r(t),n.d(t,{blockComment:()=>f,blockUncomment:()=>m,copyLineDown:()=>Nt,copyLineUp:()=>Vt,cursorCharBackward:()=>ne,cursorCharForward:()=>te,cursorCharLeft:()=>Z,cursorCharRight:()=>ee,cursorDocEnd:()=>ct,cursorDocStart:()=>st,cursorGroupBackward:()=>ae,cursorGroupForward:()=>le,cursorGroupLeft:()=>oe,cursorGroupRight:()=>ie,cursorLineBoundaryBackward:()=>De,cursorLineBoundaryForward:()=>Ee,cursorLineBoundaryLeft:()=>xe,cursorLineBoundaryRight:()=>Le,cursorLineDown:()=>Se,cursorLineEnd:()=>Te,cursorLineStart:()=>Me,cursorLineUp:()=>ke,cursorMatchingBracket:()=>Oe,cursorPageDown:()=>Ce,cursorPageUp:()=>Ae,cursorSubwordBackward:()=>he,cursorSubwordForward:()=>de,cursorSyntaxLeft:()=>pe,cursorSyntaxRight:()=>ge,defaultKeymap:()=>Yt,deleteCharBackward:()=>St,deleteCharForward:()=>wt,deleteGroupBackward:()=>At,deleteGroupForward:()=>Ct,deleteLine:()=>Jt,deleteLineBoundaryBackward:()=>Dt,deleteLineBoundaryForward:()=>xt,deleteToLineEnd:()=>Bt,deleteToLineStart:()=>Et,deleteTrailingWhitespace:()=>Lt,emacsStyleKeymap:()=>qt,history:()=>E,historyField:()=>D,historyKeymap:()=>$,indentLess:()=>$t,indentMore:()=>_t,indentSelection:()=>Wt,indentWithTab:()=>Qt,insertBlankLine:()=>Ft,insertNewline:()=>Pt,insertNewlineAndIndent:()=>Gt,insertTab:()=>jt,invertedEffects:()=>A,isolateHistory:()=>v,lineComment:()=>u,lineUncomment:()=>d,moveLineDown:()=>Rt,moveLineUp:()=>It,redo:()=>M,redoDepth:()=>R,redoSelection:()=>b,selectAll:()=>ht,selectCharBackward:()=>Pe,selectCharForward:()=>Je,selectCharLeft:()=>Ve,selectCharRight:()=>Ne,selectDocEnd:()=>dt,selectDocStart:()=>ut,selectGroupBackward:()=>We,selectGroupForward:()=>ze,selectGroupLeft:()=>Fe,selectGroupRight:()=>He,selectLine:()=>ft,selectLineBoundaryBackward:()=>rt,selectLineBoundaryForward:()=>nt,selectLineBoundaryLeft:()=>ot,selectLineBoundaryRight:()=>it,selectLineDown:()=>Xe,selectLineEnd:()=>at,selectLineStart:()=>lt,selectLineUp:()=>Qe,selectMatchingBracket:()=>Ie,selectPageDown:()=>tt,selectPageUp:()=>et,selectParentSyntax:()=>mt,selectSubwordBackward:()=>je,selectSubwordForward:()=>$e,selectSyntaxLeft:()=>qe,selectSyntaxRight:()=>Ke,simplifySelection:()=>pt,splitLine:()=>Mt,standardKeymap:()=>Kt,toggleBlockComment:()=>h,toggleBlockCommentByLine:()=>p,toggleComment:()=>a,toggleLineComment:()=>c,transposeChars:()=>Tt,undo:()=>L,undoDepth:()=>I,undoSelection:()=>T});var r=n(17811),o=n(30890),i=n(7201),l=n(73887);const a=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=g(e.state,n.from);return r.line?c(e):!!r.block&&p(e)};function s(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);return!!o&&(r(n.update(o)),!0)}}const c=s(S,0),u=s(S,1),d=s(S,2),h=s(k,0),f=s(k,1),m=s(k,2),p=s(((e,t)=>k(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to),i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=o.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}(t))),0);function g(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const y=50;function k(e,t,n=t.selection.ranges){let r=n.map((e=>g(t,e.from).block));if(!r.every((e=>e)))return null;let o=n.map(((e,n)=>function(e,{open:t,close:n},r,o){let i,l,a=e.sliceDoc(r-y,r),s=e.sliceDoc(o,o+y),c=/\s*$/.exec(a)[0].length,u=/^\s*/.exec(s)[0].length,d=a.length-c;if(a.slice(d-t.length,d)==t&&s.slice(u,u+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:o+u,margin:u&&1}};o-r<=2*y?i=l=e.sliceDoc(r,o):(i=e.sliceDoc(r,r+y),l=e.sliceDoc(o-y,o));let h=/^\s*/.exec(i)[0].length,f=/\s*$/.exec(l)[0].length,m=l.length-f-n.length;return i.slice(h,h+t.length)==t&&l.slice(m,m+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(i.charAt(h+t.length))?1:0},close:{pos:o-f-n.length,margin:/\s/.test(l.charAt(m-1))?1:0}}:null}(t,r[n],e.from,e.to)));if(2!=e&&!o.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>o[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}])))};if(1!=e&&o.some((e=>e))){let e=[];for(let t,n=0;n<o.length;n++)if(t=o[n]){let o=r[n],{open:i,close:l}=t;e.push({from:i.pos-o.open.length,to:i.pos+i.margin},{from:l.pos-l.margin,to:l.pos+o.close.length})}return{changes:e}}return null}function S(e,t,n=t.selection.ranges){let r=[],o=-1;for(let{from:e,to:i}of n){let n=r.length,l=1e9,a=g(t,e).line;if(a){for(let n=e;n<=i;){let s=t.doc.lineAt(n);if(s.from>o&&(e==i||i>s.from)){o=s.from;let e=/^\s*/.exec(s.text)[0].length,t=e==s.length,n=s.text.slice(e,e+a.length)==a?e:-1;e<s.text.length&&e<l&&(l=e),r.push({line:s,comment:n,token:a,indent:e,empty:t,single:!1})}n=s.to+1}if(l<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=l);r.length==n+1&&(r[n].single=!0)}}if(2!=e&&r.some((e=>e.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:o,empty:i,single:l}of r)!l&&i||e.push({from:t.from+o,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:o}of r)if(n>=0){let r=t.from+n,i=r+o.length;" "==t.text[i-t.from]&&i++,e.push({from:r,to:i})}return{changes:e}}return null}const w=r.Annotation.define(),v=r.Annotation.define(),A=r.Facet.define(),C=r.Facet.define({combine:e=>(0,r.combineConfig)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),B=r.StateField.define({create:()=>_.empty,update(e,t){let n=t.state.facet(C),o=t.annotation(w);if(o){let i=t.docChanged?r.EditorSelection.single(function(e){let t=0;return e.iterChangedRanges(((e,n)=>t=n)),t}(t.changes)):void 0,l=U.fromTransaction(t,i),a=o.side,s=0==a?e.undone:e.done;return s=l?V(s,s.length,n.minDepth,l):G(s,t.startState.selection),new _(0==a?o.rest:s,0==a?s:o.rest)}let i=t.annotation(v);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(r.Transaction.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let l=U.fromTransaction(t),a=t.annotation(r.Transaction.time),s=t.annotation(r.Transaction.userEvent);return l?e=e.addChanges(l,a,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,a,s,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON:e=>({done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}),fromJSON:e=>new _(e.done.map(U.fromJSON),e.undone.map(U.fromJSON))});function E(e={}){return[B,C.of(e),o.EditorView.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?L:"historyRedo"==e.inputType?M:null;return!!n&&(e.preventDefault(),n(t))}})]}const D=B;function x(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(B,!1);if(!o)return!1;let i=o.pop(e,n,t);return!!i&&(r(i),!0)}}const L=x(0,!1),M=x(1,!1),T=x(0,!0),b=x(1,!0);function O(e){return function(t){let n=t.field(B,!1);if(!n)return 0;let r=0==e?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const I=O(0),R=O(1);class U{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new U(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new U(e.changes&&r.ChangeSet.fromJSON(e.changes),[],e.mapped&&r.ChangeDesc.fromJSON(e.mapped),e.startSelection&&r.EditorSelection.fromJSON(e.startSelection),e.selectionsAfter.map(r.EditorSelection.fromJSON))}static fromTransaction(e,t){let n=J;for(let t of e.startState.facet(A)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new U(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,J)}static selection(e){return new U(void 0,J,void 0,void 0,e)}}function V(e,t,n,r){let o=t+1>n+20?t-n-1:0,i=e.slice(o,t);return i.push(r),i}function N(e,t){return e.length?t.length?e.concat(t):e:t}const J=[],P=200;function G(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-P));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),V(e,e.length-1,1e9,n.setSelAfter(r)))}return[U.selection([t])]}function F(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function H(e,t){if(!e.length)return e;let n=e.length,r=J;for(;n;){let o=z(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let t=e.slice(0,n);return t[n-1]=o,t}t=o.mapped,n--,r=o.selectionsAfter}return r.length?[U.selection(r)]:J}function z(e,t,n){let o=N(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):J,n);if(!e.changes)return U.selection(o);let i=e.changes.map(t),l=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(l):l;return new U(i,r.StateEffect.mapEffects(e.effects,t),a,e.startSelection.map(l),o)}const W=/^(input\.type|delete)($|\.)/;class _{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new _(this.done,this.undone):this}addChanges(e,t,n,r,o){let i=this.done,l=i[i.length-1];return i=l&&l.changes&&!l.changes.empty&&e.changes&&(!n||W.test(n))&&(!l.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,function(e,t){let n=[],r=!1;return e.iterChangedRanges(((e,t)=>n.push(e,t))),t.iterChangedRanges(((e,t,o,i)=>{for(let e=0;e<n.length;){let t=n[e++],l=n[e++];i>=t&&o<=l&&(r=!0)}})),r}(l.changes,e.changes))||"input.type.compose"==n)?V(i,i.length-1,r.minDepth,new U(e.changes.compose(l.changes),N(e.effects,l.effects),l.mapped,l.startSelection,J)):V(i,i.length,r.minDepth,e),new _(i,J,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:J;return o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=o[o.length-1],l=e,i.ranges.length==l.ranges.length&&0===i.ranges.filter(((e,t)=>e.empty!=l.ranges[t].empty)).length)?this:new _(G(this.done,e),this.undone,t,n);var i,l}addMapping(e){return new _(H(this.done,e),H(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let o=r[r.length-1];if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:w.of({side:e,rest:F(r)}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let n=1==r.length?J:r.slice(0,r.length-1);return o.mapped&&(n=H(n,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:w.of({side:e,rest:n}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}_.empty=new _(J,J);const $=[{key:"Mod-z",run:L,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:M,preventDefault:!0},{linux:"Ctrl-Shift-z",run:M,preventDefault:!0},{key:"Mod-u",run:T,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:b,preventDefault:!0}];function j(e,t){return r.EditorSelection.create(e.ranges.map(t),e.mainIndex)}function q(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function K({state:e,dispatch:t},n){let r=j(e.selection,n);return!r.eq(e.selection)&&(t(q(e,r)),!0)}function Y(e,t){return r.EditorSelection.cursor(t?e.to:e.from)}function Q(e,t){return K(e,(n=>n.empty?e.moveByChar(n,t):Y(n,t)))}function X(e){return e.textDirectionAt(e.state.selection.main.head)==o.Direction.LTR}const Z=e=>Q(e,!X(e)),ee=e=>Q(e,X(e)),te=e=>Q(e,!0),ne=e=>Q(e,!1);function re(e,t){return K(e,(n=>n.empty?e.moveByGroup(n,t):Y(n,t)))}const oe=e=>re(e,!X(e)),ie=e=>re(e,X(e)),le=e=>re(e,!0),ae=e=>re(e,!1),se="undefined"!=typeof Intl&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ce(e,t,n){let o=e.state.charCategorizer(t.from),i=r.CharCategory.Space,l=t.from,a=0,s=!1,c=!1,u=!1,d=t=>{if(s)return!1;l+=n?t.length:-t.length;let d,h=o(t);if(h==r.CharCategory.Word&&t.charCodeAt(0)<128&&/[\W_]/.test(t)&&(h=-1),i==r.CharCategory.Space&&(i=h),i!=h)return!1;if(i==r.CharCategory.Word)if(t.toLowerCase()==t){if(!n&&c)return!1;u=!0}else if(u){if(n)return!1;s=!0}else{if(c&&n&&o(d=e.state.sliceDoc(l,l+1))==r.CharCategory.Word&&d.toLowerCase()==d)return!1;c=!0}return a++,!0},h=e.moveByChar(t,n,(e=>(d(e),d)));if(se&&i==r.CharCategory.Word&&h.from==t.from+a*(n?1:-1)){let o=Math.min(t.head,h.head),i=Math.max(t.head,h.head),l=e.state.sliceDoc(o,i);if(l.length>1&&/[\u4E00-\uffff]/.test(l)){let e=Array.from(se.segment(l));if(e.length>1)return n?r.EditorSelection.cursor(t.head+e[1].index,-1):r.EditorSelection.cursor(h.head+e[e.length-1].index,1)}}return h}function ue(e,t){return K(e,(n=>n.empty?ce(e,n,t):Y(n,t)))}const de=e=>ue(e,!0),he=e=>ue(e,!1);function fe(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function me(e,t,n){let o,a,s=(0,i.syntaxTree)(e).resolveInner(t.head),c=n?l.NodeProp.closedBy:l.NodeProp.openedBy;for(let r=t.head;;){let t=n?s.childAfter(r):s.childBefore(r);if(!t)break;fe(e,t,c)?s=t:r=n?t.to:t.from}return a=s.type.prop(c)&&(o=n?(0,i.matchBrackets)(e,s.from,1):(0,i.matchBrackets)(e,s.to,-1))&&o.matched?n?o.end.to:o.end.from:n?s.to:s.from,r.EditorSelection.cursor(a,n?-1:1)}const pe=e=>K(e,(t=>me(e.state,t,!X(e)))),ge=e=>K(e,(t=>me(e.state,t,X(e))));function ye(e,t){return K(e,(n=>{if(!n.empty)return Y(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)}))}const ke=e=>ye(e,!1),Se=e=>ye(e,!0);function we(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0;if(n){for(let t of e.state.facet(o.EditorView.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(r=Math.max(null==n?void 0:n.top,r)),(null==n?void 0:n.bottom)&&(i=Math.max(null==n?void 0:n.bottom,i))}t=e.scrollDOM.clientHeight-r-i}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function ve(e,t){let n,r=we(e),{state:i}=e,l=j(i.selection,(n=>n.empty?e.moveVertically(n,t,r.height):Y(n,t)));if(l.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),s=a.top+r.marginTop,c=a.bottom-r.marginBottom;t&&t.top>s&&t.bottom<c&&(n=o.EditorView.scrollIntoView(l.main.head,{y:"start",yMargin:t.top-s}))}return e.dispatch(q(i,l),{effects:n}),!0}const Ae=e=>ve(e,!1),Ce=e=>ve(e,!0);function Be(e,t,n){let o=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?o.to:o.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==o.from&&o.length){let n=/^\s*/.exec(e.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;n&&t.head!=o.from+n&&(i=r.EditorSelection.cursor(o.from+n))}return i}const Ee=e=>K(e,(t=>Be(e,t,!0))),De=e=>K(e,(t=>Be(e,t,!1))),xe=e=>K(e,(t=>Be(e,t,!X(e)))),Le=e=>K(e,(t=>Be(e,t,X(e)))),Me=e=>K(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).from,1))),Te=e=>K(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).to,-1)));function be(e,t,n){let o=!1,l=j(e.selection,(t=>{let l=(0,i.matchBrackets)(e,t.head,-1)||(0,i.matchBrackets)(e,t.head,1)||t.head>0&&(0,i.matchBrackets)(e,t.head-1,1)||t.head<e.doc.length&&(0,i.matchBrackets)(e,t.head+1,-1);if(!l||!l.end)return t;o=!0;let a=l.start.from==t.head?l.end.to:l.end.from;return n?r.EditorSelection.range(t.anchor,a):r.EditorSelection.cursor(a)}));return!!o&&(t(q(e,l)),!0)}const Oe=({state:e,dispatch:t})=>be(e,t,!1),Ie=({state:e,dispatch:t})=>be(e,t,!0);function Re(e,t){let n=j(e.state.selection,(e=>{let n=t(e);return r.EditorSelection.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(q(e.state,n)),!0)}function Ue(e,t){return Re(e,(n=>e.moveByChar(n,t)))}const Ve=e=>Ue(e,!X(e)),Ne=e=>Ue(e,X(e)),Je=e=>Ue(e,!0),Pe=e=>Ue(e,!1);function Ge(e,t){return Re(e,(n=>e.moveByGroup(n,t)))}const Fe=e=>Ge(e,!X(e)),He=e=>Ge(e,X(e)),ze=e=>Ge(e,!0),We=e=>Ge(e,!1);function _e(e,t){return Re(e,(n=>ce(e,n,t)))}const $e=e=>_e(e,!0),je=e=>_e(e,!1),qe=e=>Re(e,(t=>me(e.state,t,!X(e)))),Ke=e=>Re(e,(t=>me(e.state,t,X(e))));function Ye(e,t){return Re(e,(n=>e.moveVertically(n,t)))}const Qe=e=>Ye(e,!1),Xe=e=>Ye(e,!0);function Ze(e,t){return Re(e,(n=>e.moveVertically(n,t,we(e).height)))}const et=e=>Ze(e,!1),tt=e=>Ze(e,!0),nt=e=>Re(e,(t=>Be(e,t,!0))),rt=e=>Re(e,(t=>Be(e,t,!1))),ot=e=>Re(e,(t=>Be(e,t,!X(e)))),it=e=>Re(e,(t=>Be(e,t,X(e)))),lt=e=>Re(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).from))),at=e=>Re(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).to))),st=({state:e,dispatch:t})=>(t(q(e,{anchor:0})),!0),ct=({state:e,dispatch:t})=>(t(q(e,{anchor:e.doc.length})),!0),ut=({state:e,dispatch:t})=>(t(q(e,{anchor:e.selection.main.anchor,head:0})),!0),dt=({state:e,dispatch:t})=>(t(q(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ht=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),ft=({state:e,dispatch:t})=>{let n=bt(e).map((({from:t,to:n})=>r.EditorSelection.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:r.EditorSelection.create(n),userEvent:"select"})),!0},mt=({state:e,dispatch:t})=>{let n=j(e.selection,(t=>{var n;for(let o=(0,i.syntaxTree)(e).resolveStack(t.from,1);o;o=o.next){let{node:e}=o;if((e.from<t.from&&e.to>=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent))return r.EditorSelection.range(e.to,e.from)}return t}));return t(q(e,n)),!0},pt=({state:e,dispatch:t})=>{let n=e.selection,o=null;return n.ranges.length>1?o=r.EditorSelection.create([n.main]):n.main.empty||(o=r.EditorSelection.create([r.EditorSelection.cursor(n.main.head)])),!!o&&(t(q(e,o)),!0)};function gt(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,l=i.changeByRange((o=>{let{from:i,to:l}=o;if(i==l){let r=t(o);r<i?(n="delete.backward",r=yt(e,r,!1)):r>i&&(n="delete.forward",r=yt(e,r,!0)),i=Math.min(i,r),l=Math.max(l,r)}else i=yt(e,i,!1),l=yt(e,l,!0);return i==l?{range:o}:{changes:{from:i,to:l},range:r.EditorSelection.cursor(i,i<o.head?-1:1)}}));return!l.changes.empty&&(e.dispatch(i.update(l,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?o.EditorView.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function yt(e,t,n){if(e instanceof o.EditorView)for(let r of e.state.facet(o.EditorView.atomicRanges).map((t=>t(e))))r.between(t,t,((e,r)=>{e<t&&r>t&&(t=n?r:e)}));return t}const kt=(e,t)=>gt(e,(n=>{let o,l,a=n.from,{state:s}=e,c=s.doc.lineAt(a);if(!t&&a>c.from&&a<c.from+200&&!/[^ \t]/.test(o=c.text.slice(0,a-c.from))){if("\t"==o[o.length-1])return a-1;let e=(0,r.countColumn)(o,s.tabSize)%(0,i.getIndentUnit)(s)||(0,i.getIndentUnit)(s);for(let t=0;t<e&&" "==o[o.length-1-t];t++)a--;l=a}else l=(0,r.findClusterBreak)(c.text,a-c.from,t,t)+c.from,l==a&&c.number!=(t?s.doc.lines:1)&&(l+=t?1:-1);return l})),St=e=>kt(e,!1),wt=e=>kt(e,!0),vt=(e,t)=>gt(e,(n=>{let o=n.head,{state:i}=e,l=i.doc.lineAt(o),a=i.charCategorizer(o);for(let e=null;;){if(o==(t?l.to:l.from)){o==n.head&&l.number!=(t?i.doc.lines:1)&&(o+=t?1:-1);break}let s=(0,r.findClusterBreak)(l.text,o-l.from,t)+l.from,c=l.text.slice(Math.min(o,s)-l.from,Math.max(o,s)-l.from),u=a(c);if(null!=e&&u!=e)break;" "==c&&o==n.head||(e=u),o=s}return o})),At=e=>vt(e,!1),Ct=e=>vt(e,!0),Bt=e=>gt(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})),Et=e=>gt(e,(t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)})),Dt=e=>gt(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)})),xt=e=>gt(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})),Lt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let t=0,r="",o=e.doc.iter();;){if(o.next(),o.lineBreak||o.done){let e=r.search(/\s+$/);if(e>-1&&n.push({from:t-(r.length-e),to:t}),o.done)break;r=""}else r=o.value;t+=o.value.length}return!!n.length&&(t(e.update({changes:n,userEvent:"delete"})),!0)},Mt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:r.Text.of(["",""])},range:r.EditorSelection.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Tt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,o=e.doc.lineAt(n),i=n==o.from?n-1:(0,r.findClusterBreak)(o.text,n-o.from,!1)+o.from,l=n==o.to?n+1:(0,r.findClusterBreak)(o.text,n-o.from,!0)+o.from;return{changes:{from:i,to:l,insert:e.doc.slice(n,l).append(e.doc.slice(i,n))},range:r.EditorSelection.cursor(l)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function bt(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(r.empty||r.to!=i.from||(i=e.doc.lineAt(r.to-1)),n>=o.number){let e=t[t.length-1];e.to=i.to,e.ranges.push(r)}else t.push({from:o.from,to:i.to,ranges:[r]});n=i.number+1}return t}function Ot(e,t,n){if(e.readOnly)return!1;let o=[],i=[];for(let t of bt(e)){if(n?t.to==e.doc.length:0==t.from)continue;let l=e.doc.lineAt(n?t.to+1:t.from-1),a=l.length+1;if(n){o.push({from:t.to,to:l.to},{from:t.from,insert:l.text+e.lineBreak});for(let n of t.ranges)i.push(r.EditorSelection.range(Math.min(e.doc.length,n.anchor+a),Math.min(e.doc.length,n.head+a)))}else{o.push({from:l.from,to:t.from},{from:t.to,insert:e.lineBreak+l.text});for(let e of t.ranges)i.push(r.EditorSelection.range(e.anchor-a,e.head-a))}}return!!o.length&&(t(e.update({changes:o,scrollIntoView:!0,selection:r.EditorSelection.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}const It=({state:e,dispatch:t})=>Ot(e,t,!1),Rt=({state:e,dispatch:t})=>Ot(e,t,!0);function Ut(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of bt(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Vt=({state:e,dispatch:t})=>Ut(e,t,!1),Nt=({state:e,dispatch:t})=>Ut(e,t,!0),Jt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(bt(t).map((({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n})))),r=j(t.selection,(t=>e.moveVertically(t,!0))).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0},Pt=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),Gt=Ht(!1),Ft=Ht(!0);function Ht(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let o=t.changeByRange((n=>{let{from:o,to:a}=n,s=t.doc.lineAt(o),c=!e&&o==a&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,r=(0,i.syntaxTree)(e).resolveInner(t),o=r.childBefore(t),a=r.childAfter(t);return o&&a&&o.to<=t&&a.from>=t&&(n=o.type.prop(l.NodeProp.closedBy))&&n.indexOf(a.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(o.to,a.from))?{from:o.to,to:a.from}:null}(t,o);e&&(o=a=(a<=s.to?s:t.doc.lineAt(a)).to);let u=new i.IndentContext(t,{simulateBreak:o,simulateDoubleBreak:!!c}),d=(0,i.getIndentation)(u,o);for(null==d&&(d=(0,r.countColumn)(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));a<s.to&&/\s/.test(s.text[a-s.from]);)a++;c?({from:o,to:a}=c):o>s.from&&o<s.from+100&&!/\S/.test(s.text.slice(0,o))&&(o=s.from);let h=["",(0,i.indentString)(t,d)];return c&&h.push((0,i.indentString)(t,u.lineIndent(s.from,-1))),{changes:{from:o,to:a,insert:r.Text.of(h)},range:r.EditorSelection.cursor(o+1+h[1].length)}}));return n(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0}}function zt(e,t){let n=-1;return e.changeByRange((o=>{let i=[];for(let r=o.from;r<=o.to;){let l=e.doc.lineAt(r);l.number>n&&(o.empty||o.to>l.from)&&(t(l,i,o),n=l.number),r=l.to+1}let l=e.changes(i);return{changes:i,range:r.EditorSelection.range(l.mapPos(o.anchor,1),l.mapPos(o.head,1))}}))}const Wt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new i.IndentContext(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),o=zt(e,((t,o,l)=>{let a=(0,i.getIndentation)(r,t.from);if(null==a)return;/\S/.test(t.text)||(a=0);let s=/^\s*/.exec(t.text)[0],c=(0,i.indentString)(e,a);(s!=c||l.from<t.from+s.length)&&(n[t.from]=a,o.push({from:t.from,to:t.from+s.length,insert:c}))}));return o.changes.empty||t(e.update(o,{userEvent:"indent"})),!0},_t=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(zt(e,((t,n)=>{n.push({from:t.from,insert:e.facet(i.indentUnit)})})),{userEvent:"input.indent"})),!0),$t=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(zt(e,((t,n)=>{let o=/^\s*/.exec(t.text)[0];if(!o)return;let l=(0,r.countColumn)(o,e.tabSize),a=0,s=(0,i.indentString)(e,Math.max(0,l-(0,i.getIndentUnit)(e)));for(;a<o.length&&a<s.length&&o.charCodeAt(a)==s.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+o.length,insert:s.slice(a)})})),{userEvent:"delete.dedent"})),!0),jt=({state:e,dispatch:t})=>e.selection.ranges.some((e=>!e.empty))?_t({state:e,dispatch:t}):(t(e.update(e.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0),qt=[{key:"Ctrl-b",run:Z,shift:Ve,preventDefault:!0},{key:"Ctrl-f",run:ee,shift:Ne},{key:"Ctrl-p",run:ke,shift:Qe},{key:"Ctrl-n",run:Se,shift:Xe},{key:"Ctrl-a",run:Me,shift:lt},{key:"Ctrl-e",run:Te,shift:at},{key:"Ctrl-d",run:wt},{key:"Ctrl-h",run:St},{key:"Ctrl-k",run:Bt},{key:"Ctrl-Alt-h",run:At},{key:"Ctrl-o",run:Mt},{key:"Ctrl-t",run:Tt},{key:"Ctrl-v",run:Ce}],Kt=[{key:"ArrowLeft",run:Z,shift:Ve,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:oe,shift:Fe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:xe,shift:ot,preventDefault:!0},{key:"ArrowRight",run:ee,shift:Ne,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ie,shift:He,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Le,shift:it,preventDefault:!0},{key:"ArrowUp",run:ke,shift:Qe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:st,shift:ut},{mac:"Ctrl-ArrowUp",run:Ae,shift:et},{key:"ArrowDown",run:Se,shift:Xe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ct,shift:dt},{mac:"Ctrl-ArrowDown",run:Ce,shift:tt},{key:"PageUp",run:Ae,shift:et},{key:"PageDown",run:Ce,shift:tt},{key:"Home",run:De,shift:rt,preventDefault:!0},{key:"Mod-Home",run:st,shift:ut},{key:"End",run:Ee,shift:nt,preventDefault:!0},{key:"Mod-End",run:ct,shift:dt},{key:"Enter",run:Gt},{key:"Mod-a",run:ht},{key:"Backspace",run:St,shift:St},{key:"Delete",run:wt},{key:"Mod-Backspace",mac:"Alt-Backspace",run:At},{key:"Mod-Delete",mac:"Alt-Delete",run:Ct},{mac:"Mod-Backspace",run:Dt},{mac:"Mod-Delete",run:xt}].concat(qt.map((e=>({mac:e.key,run:e.run,shift:e.shift})))),Yt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:pe,shift:qe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:ge,shift:Ke},{key:"Alt-ArrowUp",run:It},{key:"Shift-Alt-ArrowUp",run:Vt},{key:"Alt-ArrowDown",run:Rt},{key:"Shift-Alt-ArrowDown",run:Nt},{key:"Escape",run:pt},{key:"Mod-Enter",run:Ft},{key:"Alt-l",mac:"Ctrl-l",run:ft},{key:"Mod-i",run:mt,preventDefault:!0},{key:"Mod-[",run:$t},{key:"Mod-]",run:_t},{key:"Mod-Alt-\\",run:Wt},{key:"Shift-Mod-k",run:Jt},{key:"Shift-Mod-\\",run:Oe},{key:"Mod-/",run:a},{key:"Alt-A",run:h}].concat(Kt),Qt={key:"Tab",run:_t,shift:$t}}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7450],{67450:(e,t,n)=>{n.r(t),n.d(t,{blockComment:()=>h,blockUncomment:()=>m,copyLineDown:()=>Nt,copyLineUp:()=>Vt,cursorCharBackward:()=>ne,cursorCharForward:()=>te,cursorCharLeft:()=>Z,cursorCharRight:()=>ee,cursorDocEnd:()=>ct,cursorDocStart:()=>st,cursorGroupBackward:()=>ae,cursorGroupForward:()=>le,cursorGroupLeft:()=>oe,cursorGroupRight:()=>ie,cursorLineBoundaryBackward:()=>De,cursorLineBoundaryForward:()=>Ee,cursorLineBoundaryLeft:()=>xe,cursorLineBoundaryRight:()=>Le,cursorLineDown:()=>we,cursorLineEnd:()=>Te,cursorLineStart:()=>Me,cursorLineUp:()=>ke,cursorMatchingBracket:()=>Oe,cursorPageDown:()=>Ce,cursorPageUp:()=>Ae,cursorSubwordBackward:()=>de,cursorSubwordForward:()=>fe,cursorSyntaxLeft:()=>pe,cursorSyntaxRight:()=>ge,defaultKeymap:()=>Yt,deleteCharBackward:()=>wt,deleteCharForward:()=>St,deleteGroupBackward:()=>At,deleteGroupForward:()=>Ct,deleteLine:()=>Jt,deleteLineBoundaryBackward:()=>Dt,deleteLineBoundaryForward:()=>xt,deleteToLineEnd:()=>Bt,deleteToLineStart:()=>Et,deleteTrailingWhitespace:()=>Lt,emacsStyleKeymap:()=>qt,history:()=>E,historyField:()=>D,historyKeymap:()=>$,indentLess:()=>$t,indentMore:()=>_t,indentSelection:()=>Wt,indentWithTab:()=>Qt,insertBlankLine:()=>Ft,insertNewline:()=>Pt,insertNewlineAndIndent:()=>Gt,insertTab:()=>jt,invertedEffects:()=>A,isolateHistory:()=>v,lineComment:()=>u,lineUncomment:()=>f,moveLineDown:()=>Rt,moveLineUp:()=>It,redo:()=>M,redoDepth:()=>R,redoSelection:()=>b,selectAll:()=>dt,selectCharBackward:()=>Pe,selectCharForward:()=>Je,selectCharLeft:()=>Ve,selectCharRight:()=>Ne,selectDocEnd:()=>ft,selectDocStart:()=>ut,selectGroupBackward:()=>We,selectGroupForward:()=>ze,selectGroupLeft:()=>Fe,selectGroupRight:()=>He,selectLine:()=>ht,selectLineBoundaryBackward:()=>rt,selectLineBoundaryForward:()=>nt,selectLineBoundaryLeft:()=>ot,selectLineBoundaryRight:()=>it,selectLineDown:()=>Xe,selectLineEnd:()=>at,selectLineStart:()=>lt,selectLineUp:()=>Qe,selectMatchingBracket:()=>Ie,selectPageDown:()=>tt,selectPageUp:()=>et,selectParentSyntax:()=>mt,selectSubwordBackward:()=>je,selectSubwordForward:()=>$e,selectSyntaxLeft:()=>qe,selectSyntaxRight:()=>Ke,simplifySelection:()=>pt,splitLine:()=>Mt,standardKeymap:()=>Kt,toggleBlockComment:()=>d,toggleBlockCommentByLine:()=>p,toggleComment:()=>a,toggleLineComment:()=>c,transposeChars:()=>Tt,undo:()=>L,undoDepth:()=>I,undoSelection:()=>T});var r=n(89843),o=n(3546),i=n(17592),l=n(79352);const a=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=g(e.state,n.from);return r.line?c(e):!!r.block&&p(e)};function s(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);return!!o&&(r(n.update(o)),!0)}}const c=s(w,0),u=s(w,1),f=s(w,2),d=s(k,0),h=s(k,1),m=s(k,2),p=s(((e,t)=>k(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to),i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=o.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}(t))),0);function g(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const y=50;function k(e,t,n=t.selection.ranges){let r=n.map((e=>g(t,e.from).block));if(!r.every((e=>e)))return null;let o=n.map(((e,n)=>function(e,{open:t,close:n},r,o){let i,l,a=e.sliceDoc(r-y,r),s=e.sliceDoc(o,o+y),c=/\s*$/.exec(a)[0].length,u=/^\s*/.exec(s)[0].length,f=a.length-c;if(a.slice(f-t.length,f)==t&&s.slice(u,u+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:o+u,margin:u&&1}};o-r<=2*y?i=l=e.sliceDoc(r,o):(i=e.sliceDoc(r,r+y),l=e.sliceDoc(o-y,o));let d=/^\s*/.exec(i)[0].length,h=/\s*$/.exec(l)[0].length,m=l.length-h-n.length;return i.slice(d,d+t.length)==t&&l.slice(m,m+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(i.charAt(d+t.length))?1:0},close:{pos:o-h-n.length,margin:/\s/.test(l.charAt(m-1))?1:0}}:null}(t,r[n],e.from,e.to)));if(2!=e&&!o.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>o[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}])))};if(1!=e&&o.some((e=>e))){let e=[];for(let t,n=0;n<o.length;n++)if(t=o[n]){let o=r[n],{open:i,close:l}=t;e.push({from:i.pos-o.open.length,to:i.pos+i.margin},{from:l.pos-l.margin,to:l.pos+o.close.length})}return{changes:e}}return null}function w(e,t,n=t.selection.ranges){let r=[],o=-1;for(let{from:e,to:i}of n){let n=r.length,l=1e9,a=g(t,e).line;if(a){for(let n=e;n<=i;){let s=t.doc.lineAt(n);if(s.from>o&&(e==i||i>s.from)){o=s.from;let e=/^\s*/.exec(s.text)[0].length,t=e==s.length,n=s.text.slice(e,e+a.length)==a?e:-1;e<s.text.length&&e<l&&(l=e),r.push({line:s,comment:n,token:a,indent:e,empty:t,single:!1})}n=s.to+1}if(l<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=l);r.length==n+1&&(r[n].single=!0)}}if(2!=e&&r.some((e=>e.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:o,empty:i,single:l}of r)!l&&i||e.push({from:t.from+o,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:o}of r)if(n>=0){let r=t.from+n,i=r+o.length;" "==t.text[i-t.from]&&i++,e.push({from:r,to:i})}return{changes:e}}return null}const S=r.Annotation.define(),v=r.Annotation.define(),A=r.Facet.define(),C=r.Facet.define({combine:e=>(0,r.combineConfig)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),B=r.StateField.define({create:()=>_.empty,update(e,t){let n=t.state.facet(C),o=t.annotation(S);if(o){let r=U.fromTransaction(t,o.selection),i=o.side,l=0==i?e.undone:e.done;return l=r?V(l,l.length,n.minDepth,r):G(l,t.startState.selection),new _(0==i?o.rest:l,0==i?l:o.rest)}let i=t.annotation(v);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(r.Transaction.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let l=U.fromTransaction(t),a=t.annotation(r.Transaction.time),s=t.annotation(r.Transaction.userEvent);return l?e=e.addChanges(l,a,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,a,s,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON:e=>({done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}),fromJSON:e=>new _(e.done.map(U.fromJSON),e.undone.map(U.fromJSON))});function E(e={}){return[B,C.of(e),o.EditorView.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?L:"historyRedo"==e.inputType?M:null;return!!n&&(e.preventDefault(),n(t))}})]}const D=B;function x(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(B,!1);if(!o)return!1;let i=o.pop(e,n,t);return!!i&&(r(i),!0)}}const L=x(0,!1),M=x(1,!1),T=x(0,!0),b=x(1,!0);function O(e){return function(t){let n=t.field(B,!1);if(!n)return 0;let r=0==e?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const I=O(0),R=O(1);class U{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new U(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new U(e.changes&&r.ChangeSet.fromJSON(e.changes),[],e.mapped&&r.ChangeDesc.fromJSON(e.mapped),e.startSelection&&r.EditorSelection.fromJSON(e.startSelection),e.selectionsAfter.map(r.EditorSelection.fromJSON))}static fromTransaction(e,t){let n=J;for(let t of e.startState.facet(A)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new U(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,J)}static selection(e){return new U(void 0,J,void 0,void 0,e)}}function V(e,t,n,r){let o=t+1>n+20?t-n-1:0,i=e.slice(o,t);return i.push(r),i}function N(e,t){return e.length?t.length?e.concat(t):e:t}const J=[],P=200;function G(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-P));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),V(e,e.length-1,1e9,n.setSelAfter(r)))}return[U.selection([t])]}function F(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function H(e,t){if(!e.length)return e;let n=e.length,r=J;for(;n;){let o=z(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let t=e.slice(0,n);return t[n-1]=o,t}t=o.mapped,n--,r=o.selectionsAfter}return r.length?[U.selection(r)]:J}function z(e,t,n){let o=N(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):J,n);if(!e.changes)return U.selection(o);let i=e.changes.map(t),l=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(l):l;return new U(i,r.StateEffect.mapEffects(e.effects,t),a,e.startSelection.map(l),o)}const W=/^(input\.type|delete)($|\.)/;class _{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new _(this.done,this.undone):this}addChanges(e,t,n,r,o){let i=this.done,l=i[i.length-1];return i=l&&l.changes&&!l.changes.empty&&e.changes&&(!n||W.test(n))&&(!l.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,function(e,t){let n=[],r=!1;return e.iterChangedRanges(((e,t)=>n.push(e,t))),t.iterChangedRanges(((e,t,o,i)=>{for(let e=0;e<n.length;){let t=n[e++],l=n[e++];i>=t&&o<=l&&(r=!0)}})),r}(l.changes,e.changes))||"input.type.compose"==n)?V(i,i.length-1,r.minDepth,new U(e.changes.compose(l.changes),N(e.effects,l.effects),l.mapped,l.startSelection,J)):V(i,i.length,r.minDepth,e),new _(i,J,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:J;return o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=o[o.length-1],l=e,i.ranges.length==l.ranges.length&&0===i.ranges.filter(((e,t)=>e.empty!=l.ranges[t].empty)).length)?this:new _(G(this.done,e),this.undone,t,n);var i,l}addMapping(e){return new _(H(this.done,e),H(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let o=r[r.length-1],i=o.selectionsAfter[0]||t.selection;if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:S.of({side:e,rest:F(r),selection:i}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let n=1==r.length?J:r.slice(0,r.length-1);return o.mapped&&(n=H(n,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:S.of({side:e,rest:n,selection:i}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}_.empty=new _(J,J);const $=[{key:"Mod-z",run:L,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:M,preventDefault:!0},{linux:"Ctrl-Shift-z",run:M,preventDefault:!0},{key:"Mod-u",run:T,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:b,preventDefault:!0}];function j(e,t){return r.EditorSelection.create(e.ranges.map(t),e.mainIndex)}function q(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function K({state:e,dispatch:t},n){let r=j(e.selection,n);return!r.eq(e.selection,!0)&&(t(q(e,r)),!0)}function Y(e,t){return r.EditorSelection.cursor(t?e.to:e.from)}function Q(e,t){return K(e,(n=>n.empty?e.moveByChar(n,t):Y(n,t)))}function X(e){return e.textDirectionAt(e.state.selection.main.head)==o.Direction.LTR}const Z=e=>Q(e,!X(e)),ee=e=>Q(e,X(e)),te=e=>Q(e,!0),ne=e=>Q(e,!1);function re(e,t){return K(e,(n=>n.empty?e.moveByGroup(n,t):Y(n,t)))}const oe=e=>re(e,!X(e)),ie=e=>re(e,X(e)),le=e=>re(e,!0),ae=e=>re(e,!1),se="undefined"!=typeof Intl&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ce(e,t,n){let o=e.state.charCategorizer(t.from),i=r.CharCategory.Space,l=t.from,a=0,s=!1,c=!1,u=!1,f=t=>{if(s)return!1;l+=n?t.length:-t.length;let f,d=o(t);if(d==r.CharCategory.Word&&t.charCodeAt(0)<128&&/[\W_]/.test(t)&&(d=-1),i==r.CharCategory.Space&&(i=d),i!=d)return!1;if(i==r.CharCategory.Word)if(t.toLowerCase()==t){if(!n&&c)return!1;u=!0}else if(u){if(n)return!1;s=!0}else{if(c&&n&&o(f=e.state.sliceDoc(l,l+1))==r.CharCategory.Word&&f.toLowerCase()==f)return!1;c=!0}return a++,!0},d=e.moveByChar(t,n,(e=>(f(e),f)));if(se&&i==r.CharCategory.Word&&d.from==t.from+a*(n?1:-1)){let o=Math.min(t.head,d.head),i=Math.max(t.head,d.head),l=e.state.sliceDoc(o,i);if(l.length>1&&/[\u4E00-\uffff]/.test(l)){let e=Array.from(se.segment(l));if(e.length>1)return n?r.EditorSelection.cursor(t.head+e[1].index,-1):r.EditorSelection.cursor(d.head+e[e.length-1].index,1)}}return d}function ue(e,t){return K(e,(n=>n.empty?ce(e,n,t):Y(n,t)))}const fe=e=>ue(e,!0),de=e=>ue(e,!1);function he(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function me(e,t,n){let o,a,s=(0,i.syntaxTree)(e).resolveInner(t.head),c=n?l.NodeProp.closedBy:l.NodeProp.openedBy;for(let r=t.head;;){let t=n?s.childAfter(r):s.childBefore(r);if(!t)break;he(e,t,c)?s=t:r=n?t.to:t.from}return a=s.type.prop(c)&&(o=n?(0,i.matchBrackets)(e,s.from,1):(0,i.matchBrackets)(e,s.to,-1))&&o.matched?n?o.end.to:o.end.from:n?s.to:s.from,r.EditorSelection.cursor(a,n?-1:1)}const pe=e=>K(e,(t=>me(e.state,t,!X(e)))),ge=e=>K(e,(t=>me(e.state,t,X(e))));function ye(e,t){return K(e,(n=>{if(!n.empty)return Y(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)}))}const ke=e=>ye(e,!1),we=e=>ye(e,!0);function Se(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0;if(n){for(let t of e.state.facet(o.EditorView.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(r=Math.max(null==n?void 0:n.top,r)),(null==n?void 0:n.bottom)&&(i=Math.max(null==n?void 0:n.bottom,i))}t=e.scrollDOM.clientHeight-r-i}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function ve(e,t){let n,r=Se(e),{state:i}=e,l=j(i.selection,(n=>n.empty?e.moveVertically(n,t,r.height):Y(n,t)));if(l.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),s=a.top+r.marginTop,c=a.bottom-r.marginBottom;t&&t.top>s&&t.bottom<c&&(n=o.EditorView.scrollIntoView(l.main.head,{y:"start",yMargin:t.top-s}))}return e.dispatch(q(i,l),{effects:n}),!0}const Ae=e=>ve(e,!1),Ce=e=>ve(e,!0);function Be(e,t,n){let o=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?o.to:o.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==o.from&&o.length){let n=/^\s*/.exec(e.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;n&&t.head!=o.from+n&&(i=r.EditorSelection.cursor(o.from+n))}return i}const Ee=e=>K(e,(t=>Be(e,t,!0))),De=e=>K(e,(t=>Be(e,t,!1))),xe=e=>K(e,(t=>Be(e,t,!X(e)))),Le=e=>K(e,(t=>Be(e,t,X(e)))),Me=e=>K(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).from,1))),Te=e=>K(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).to,-1)));function be(e,t,n){let o=!1,l=j(e.selection,(t=>{let l=(0,i.matchBrackets)(e,t.head,-1)||(0,i.matchBrackets)(e,t.head,1)||t.head>0&&(0,i.matchBrackets)(e,t.head-1,1)||t.head<e.doc.length&&(0,i.matchBrackets)(e,t.head+1,-1);if(!l||!l.end)return t;o=!0;let a=l.start.from==t.head?l.end.to:l.end.from;return n?r.EditorSelection.range(t.anchor,a):r.EditorSelection.cursor(a)}));return!!o&&(t(q(e,l)),!0)}const Oe=({state:e,dispatch:t})=>be(e,t,!1),Ie=({state:e,dispatch:t})=>be(e,t,!0);function Re(e,t){let n=j(e.state.selection,(e=>{let n=t(e);return r.EditorSelection.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(q(e.state,n)),!0)}function Ue(e,t){return Re(e,(n=>e.moveByChar(n,t)))}const Ve=e=>Ue(e,!X(e)),Ne=e=>Ue(e,X(e)),Je=e=>Ue(e,!0),Pe=e=>Ue(e,!1);function Ge(e,t){return Re(e,(n=>e.moveByGroup(n,t)))}const Fe=e=>Ge(e,!X(e)),He=e=>Ge(e,X(e)),ze=e=>Ge(e,!0),We=e=>Ge(e,!1);function _e(e,t){return Re(e,(n=>ce(e,n,t)))}const $e=e=>_e(e,!0),je=e=>_e(e,!1),qe=e=>Re(e,(t=>me(e.state,t,!X(e)))),Ke=e=>Re(e,(t=>me(e.state,t,X(e))));function Ye(e,t){return Re(e,(n=>e.moveVertically(n,t)))}const Qe=e=>Ye(e,!1),Xe=e=>Ye(e,!0);function Ze(e,t){return Re(e,(n=>e.moveVertically(n,t,Se(e).height)))}const et=e=>Ze(e,!1),tt=e=>Ze(e,!0),nt=e=>Re(e,(t=>Be(e,t,!0))),rt=e=>Re(e,(t=>Be(e,t,!1))),ot=e=>Re(e,(t=>Be(e,t,!X(e)))),it=e=>Re(e,(t=>Be(e,t,X(e)))),lt=e=>Re(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).from))),at=e=>Re(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).to))),st=({state:e,dispatch:t})=>(t(q(e,{anchor:0})),!0),ct=({state:e,dispatch:t})=>(t(q(e,{anchor:e.doc.length})),!0),ut=({state:e,dispatch:t})=>(t(q(e,{anchor:e.selection.main.anchor,head:0})),!0),ft=({state:e,dispatch:t})=>(t(q(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),dt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),ht=({state:e,dispatch:t})=>{let n=bt(e).map((({from:t,to:n})=>r.EditorSelection.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:r.EditorSelection.create(n),userEvent:"select"})),!0},mt=({state:e,dispatch:t})=>{let n=j(e.selection,(t=>{var n;for(let o=(0,i.syntaxTree)(e).resolveStack(t.from,1);o;o=o.next){let{node:e}=o;if((e.from<t.from&&e.to>=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent))return r.EditorSelection.range(e.to,e.from)}return t}));return t(q(e,n)),!0},pt=({state:e,dispatch:t})=>{let n=e.selection,o=null;return n.ranges.length>1?o=r.EditorSelection.create([n.main]):n.main.empty||(o=r.EditorSelection.create([r.EditorSelection.cursor(n.main.head)])),!!o&&(t(q(e,o)),!0)};function gt(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,l=i.changeByRange((o=>{let{from:i,to:l}=o;if(i==l){let r=t(o);r<i?(n="delete.backward",r=yt(e,r,!1)):r>i&&(n="delete.forward",r=yt(e,r,!0)),i=Math.min(i,r),l=Math.max(l,r)}else i=yt(e,i,!1),l=yt(e,l,!0);return i==l?{range:o}:{changes:{from:i,to:l},range:r.EditorSelection.cursor(i,i<o.head?-1:1)}}));return!l.changes.empty&&(e.dispatch(i.update(l,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?o.EditorView.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function yt(e,t,n){if(e instanceof o.EditorView)for(let r of e.state.facet(o.EditorView.atomicRanges).map((t=>t(e))))r.between(t,t,((e,r)=>{e<t&&r>t&&(t=n?r:e)}));return t}const kt=(e,t)=>gt(e,(n=>{let o,l,a=n.from,{state:s}=e,c=s.doc.lineAt(a);if(!t&&a>c.from&&a<c.from+200&&!/[^ \t]/.test(o=c.text.slice(0,a-c.from))){if("\t"==o[o.length-1])return a-1;let e=(0,r.countColumn)(o,s.tabSize)%(0,i.getIndentUnit)(s)||(0,i.getIndentUnit)(s);for(let t=0;t<e&&" "==o[o.length-1-t];t++)a--;l=a}else l=(0,r.findClusterBreak)(c.text,a-c.from,t,t)+c.from,l==a&&c.number!=(t?s.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(l-c.from,a-c.from))&&(l=(0,r.findClusterBreak)(c.text,l-c.from,!1,!1)+c.from);return l})),wt=e=>kt(e,!1),St=e=>kt(e,!0),vt=(e,t)=>gt(e,(n=>{let o=n.head,{state:i}=e,l=i.doc.lineAt(o),a=i.charCategorizer(o);for(let e=null;;){if(o==(t?l.to:l.from)){o==n.head&&l.number!=(t?i.doc.lines:1)&&(o+=t?1:-1);break}let s=(0,r.findClusterBreak)(l.text,o-l.from,t)+l.from,c=l.text.slice(Math.min(o,s)-l.from,Math.max(o,s)-l.from),u=a(c);if(null!=e&&u!=e)break;" "==c&&o==n.head||(e=u),o=s}return o})),At=e=>vt(e,!1),Ct=e=>vt(e,!0),Bt=e=>gt(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})),Et=e=>gt(e,(t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)})),Dt=e=>gt(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)})),xt=e=>gt(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})),Lt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let t=0,r="",o=e.doc.iter();;){if(o.next(),o.lineBreak||o.done){let e=r.search(/\s+$/);if(e>-1&&n.push({from:t-(r.length-e),to:t}),o.done)break;r=""}else r=o.value;t+=o.value.length}return!!n.length&&(t(e.update({changes:n,userEvent:"delete"})),!0)},Mt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:r.Text.of(["",""])},range:r.EditorSelection.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Tt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,o=e.doc.lineAt(n),i=n==o.from?n-1:(0,r.findClusterBreak)(o.text,n-o.from,!1)+o.from,l=n==o.to?n+1:(0,r.findClusterBreak)(o.text,n-o.from,!0)+o.from;return{changes:{from:i,to:l,insert:e.doc.slice(n,l).append(e.doc.slice(i,n))},range:r.EditorSelection.cursor(l)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function bt(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(r.empty||r.to!=i.from||(i=e.doc.lineAt(r.to-1)),n>=o.number){let e=t[t.length-1];e.to=i.to,e.ranges.push(r)}else t.push({from:o.from,to:i.to,ranges:[r]});n=i.number+1}return t}function Ot(e,t,n){if(e.readOnly)return!1;let o=[],i=[];for(let t of bt(e)){if(n?t.to==e.doc.length:0==t.from)continue;let l=e.doc.lineAt(n?t.to+1:t.from-1),a=l.length+1;if(n){o.push({from:t.to,to:l.to},{from:t.from,insert:l.text+e.lineBreak});for(let n of t.ranges)i.push(r.EditorSelection.range(Math.min(e.doc.length,n.anchor+a),Math.min(e.doc.length,n.head+a)))}else{o.push({from:l.from,to:t.from},{from:t.to,insert:e.lineBreak+l.text});for(let e of t.ranges)i.push(r.EditorSelection.range(e.anchor-a,e.head-a))}}return!!o.length&&(t(e.update({changes:o,scrollIntoView:!0,selection:r.EditorSelection.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}const It=({state:e,dispatch:t})=>Ot(e,t,!1),Rt=({state:e,dispatch:t})=>Ot(e,t,!0);function Ut(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of bt(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Vt=({state:e,dispatch:t})=>Ut(e,t,!1),Nt=({state:e,dispatch:t})=>Ut(e,t,!0),Jt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(bt(t).map((({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n})))),r=j(t.selection,(t=>e.moveVertically(t,!0))).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0},Pt=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),Gt=Ht(!1),Ft=Ht(!0);function Ht(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let o=t.changeByRange((n=>{let{from:o,to:a}=n,s=t.doc.lineAt(o),c=!e&&o==a&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,r=(0,i.syntaxTree)(e).resolveInner(t),o=r.childBefore(t),a=r.childAfter(t);return o&&a&&o.to<=t&&a.from>=t&&(n=o.type.prop(l.NodeProp.closedBy))&&n.indexOf(a.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(o.to,a.from))?{from:o.to,to:a.from}:null}(t,o);e&&(o=a=(a<=s.to?s:t.doc.lineAt(a)).to);let u=new i.IndentContext(t,{simulateBreak:o,simulateDoubleBreak:!!c}),f=(0,i.getIndentation)(u,o);for(null==f&&(f=(0,r.countColumn)(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));a<s.to&&/\s/.test(s.text[a-s.from]);)a++;c?({from:o,to:a}=c):o>s.from&&o<s.from+100&&!/\S/.test(s.text.slice(0,o))&&(o=s.from);let d=["",(0,i.indentString)(t,f)];return c&&d.push((0,i.indentString)(t,u.lineIndent(s.from,-1))),{changes:{from:o,to:a,insert:r.Text.of(d)},range:r.EditorSelection.cursor(o+1+d[1].length)}}));return n(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0}}function zt(e,t){let n=-1;return e.changeByRange((o=>{let i=[];for(let r=o.from;r<=o.to;){let l=e.doc.lineAt(r);l.number>n&&(o.empty||o.to>l.from)&&(t(l,i,o),n=l.number),r=l.to+1}let l=e.changes(i);return{changes:i,range:r.EditorSelection.range(l.mapPos(o.anchor,1),l.mapPos(o.head,1))}}))}const Wt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new i.IndentContext(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),o=zt(e,((t,o,l)=>{let a=(0,i.getIndentation)(r,t.from);if(null==a)return;/\S/.test(t.text)||(a=0);let s=/^\s*/.exec(t.text)[0],c=(0,i.indentString)(e,a);(s!=c||l.from<t.from+s.length)&&(n[t.from]=a,o.push({from:t.from,to:t.from+s.length,insert:c}))}));return o.changes.empty||t(e.update(o,{userEvent:"indent"})),!0},_t=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(zt(e,((t,n)=>{n.push({from:t.from,insert:e.facet(i.indentUnit)})})),{userEvent:"input.indent"})),!0),$t=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(zt(e,((t,n)=>{let o=/^\s*/.exec(t.text)[0];if(!o)return;let l=(0,r.countColumn)(o,e.tabSize),a=0,s=(0,i.indentString)(e,Math.max(0,l-(0,i.getIndentUnit)(e)));for(;a<o.length&&a<s.length&&o.charCodeAt(a)==s.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+o.length,insert:s.slice(a)})})),{userEvent:"delete.dedent"})),!0),jt=({state:e,dispatch:t})=>e.selection.ranges.some((e=>!e.empty))?_t({state:e,dispatch:t}):(t(e.update(e.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0),qt=[{key:"Ctrl-b",run:Z,shift:Ve,preventDefault:!0},{key:"Ctrl-f",run:ee,shift:Ne},{key:"Ctrl-p",run:ke,shift:Qe},{key:"Ctrl-n",run:we,shift:Xe},{key:"Ctrl-a",run:Me,shift:lt},{key:"Ctrl-e",run:Te,shift:at},{key:"Ctrl-d",run:St},{key:"Ctrl-h",run:wt},{key:"Ctrl-k",run:Bt},{key:"Ctrl-Alt-h",run:At},{key:"Ctrl-o",run:Mt},{key:"Ctrl-t",run:Tt},{key:"Ctrl-v",run:Ce}],Kt=[{key:"ArrowLeft",run:Z,shift:Ve,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:oe,shift:Fe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:xe,shift:ot,preventDefault:!0},{key:"ArrowRight",run:ee,shift:Ne,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ie,shift:He,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Le,shift:it,preventDefault:!0},{key:"ArrowUp",run:ke,shift:Qe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:st,shift:ut},{mac:"Ctrl-ArrowUp",run:Ae,shift:et},{key:"ArrowDown",run:we,shift:Xe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ct,shift:ft},{mac:"Ctrl-ArrowDown",run:Ce,shift:tt},{key:"PageUp",run:Ae,shift:et},{key:"PageDown",run:Ce,shift:tt},{key:"Home",run:De,shift:rt,preventDefault:!0},{key:"Mod-Home",run:st,shift:ut},{key:"End",run:Ee,shift:nt,preventDefault:!0},{key:"Mod-End",run:ct,shift:ft},{key:"Enter",run:Gt},{key:"Mod-a",run:dt},{key:"Backspace",run:wt,shift:wt},{key:"Delete",run:St},{key:"Mod-Backspace",mac:"Alt-Backspace",run:At},{key:"Mod-Delete",mac:"Alt-Delete",run:Ct},{mac:"Mod-Backspace",run:Dt},{mac:"Mod-Delete",run:xt}].concat(qt.map((e=>({mac:e.key,run:e.run,shift:e.shift})))),Yt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:pe,shift:qe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:ge,shift:Ke},{key:"Alt-ArrowUp",run:It},{key:"Shift-Alt-ArrowUp",run:Vt},{key:"Alt-ArrowDown",run:Rt},{key:"Shift-Alt-ArrowDown",run:Nt},{key:"Escape",run:pt},{key:"Mod-Enter",run:Ft},{key:"Alt-l",mac:"Ctrl-l",run:ht},{key:"Mod-i",run:mt,preventDefault:!0},{key:"Mod-[",run:$t},{key:"Mod-]",run:_t},{key:"Mod-Alt-\\",run:Wt},{key:"Shift-Mod-k",run:Jt},{key:"Shift-Mod-\\",run:Oe},{key:"Mod-/",run:a},{key:"Alt-A",run:d}].concat(Kt),Qt={key:"Tab",run:_t,shift:$t}}}]);