notebook 7.1.0a0__py3-none-any.whl → 7.1.0a1__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 (271) hide show
  1. notebook/_version.py +1 -1
  2. notebook/app.py +5 -2
  3. notebook/static/1053.bundle.js +1 -1
  4. notebook/static/1157.bundle.js +1 -0
  5. notebook/static/1169.bundle.js +1 -1
  6. notebook/static/1198.bundle.js +1 -1
  7. notebook/static/131.bundle.js +2 -2
  8. notebook/static/1326.bundle.js +2 -0
  9. notebook/static/1337.bundle.js +1 -1
  10. notebook/static/134.bundle.js +1 -1
  11. notebook/static/1408.bundle.js +1 -1
  12. notebook/static/1496.bundle.js +1 -0
  13. notebook/static/1584.bundle.js +1 -1
  14. notebook/static/1604.bundle.js +1 -0
  15. notebook/static/1647.bundle.js +1 -1
  16. notebook/static/1650.bundle.js +1 -1
  17. notebook/static/1682.bundle.js +1 -1
  18. notebook/static/1684.bundle.js +1 -1
  19. notebook/static/1809.bundle.js +1 -1
  20. notebook/static/1827.bundle.js +1 -1
  21. notebook/static/1833.bundle.js +1 -1
  22. notebook/static/1835.bundle.js +1 -1
  23. notebook/static/1895.bundle.js +1 -0
  24. notebook/static/1950.bundle.js +1 -1
  25. notebook/static/1958.bundle.js +1 -1
  26. notebook/static/2007.bundle.js +1 -1
  27. notebook/static/2067.bundle.js +1 -1
  28. notebook/static/2088.bundle.js +1 -1
  29. notebook/static/2089.bundle.js +1 -1
  30. notebook/static/2122.bundle.js +1 -1
  31. notebook/static/2167.bundle.js +1 -1
  32. notebook/static/2184.bundle.js +1 -1
  33. notebook/static/2311.bundle.js +1 -1
  34. notebook/static/2401.bundle.js +1 -1
  35. notebook/static/2479.bundle.js +1 -1
  36. notebook/static/2489.bundle.js +1 -1
  37. notebook/static/2502.bundle.js +1 -0
  38. notebook/static/2512.bundle.js +1 -1
  39. notebook/static/2515.bundle.js +1 -0
  40. notebook/static/2552.bundle.js +1 -1
  41. notebook/static/2577.bundle.js +1 -0
  42. notebook/static/2607.bundle.js +1 -1
  43. notebook/static/2615.bundle.js +1 -1
  44. notebook/static/270.bundle.js +1 -1
  45. notebook/static/2866.bundle.js +1 -1
  46. notebook/static/2883.bundle.js +1 -1
  47. notebook/static/2913.bundle.js +1 -1
  48. notebook/static/2924.bundle.js +1 -1
  49. notebook/static/2944.bundle.js +1 -0
  50. notebook/static/3079.bundle.js +1 -1
  51. notebook/static/3129.bundle.js +1 -1
  52. notebook/static/3146.bundle.js +1 -1
  53. notebook/static/3190.bundle.js +2 -0
  54. notebook/static/3213.bundle.js +1 -1
  55. notebook/static/3301.bundle.js +1 -1
  56. notebook/static/3340.bundle.js +1 -1
  57. notebook/static/3360.bundle.js +1 -1
  58. notebook/static/3466.bundle.js +1 -1
  59. notebook/static/3512.bundle.js +1 -1
  60. notebook/static/3642.bundle.js +1 -0
  61. notebook/static/3676.bundle.js +1 -1
  62. notebook/static/3680.bundle.js +1 -1
  63. notebook/static/3768.bundle.js +1 -1
  64. notebook/static/377.bundle.js +1 -1
  65. notebook/static/3863.bundle.js +1 -1
  66. notebook/static/3881.bundle.js +1 -1
  67. notebook/static/4042.bundle.js +1 -1
  68. notebook/static/4058.bundle.js +1 -1
  69. notebook/static/4131.bundle.js +1 -1
  70. notebook/static/4166.bundle.js +1 -0
  71. notebook/static/4212.bundle.js +1 -1
  72. notebook/static/4271.bundle.js +1 -1
  73. notebook/static/4291.bundle.js +1 -1
  74. notebook/static/433.bundle.js +1 -0
  75. notebook/static/4382.bundle.js +1 -1
  76. notebook/static/4461.bundle.js +1 -0
  77. notebook/static/4499.bundle.js +1 -0
  78. notebook/static/4501.bundle.js +1 -0
  79. notebook/static/4526.bundle.js +1 -1
  80. notebook/static/4558.bundle.js +1 -1
  81. notebook/static/4588.bundle.js +1 -1
  82. notebook/static/4630.bundle.js +1 -1
  83. notebook/static/4645.bundle.js +1 -1
  84. notebook/static/4670.bundle.js +1 -1
  85. notebook/static/4810.bundle.js +1 -1
  86. notebook/static/4811.bundle.js +1 -1
  87. notebook/static/4837.bundle.js +1 -1
  88. notebook/static/4892.bundle.js +1 -0
  89. notebook/static/5088.bundle.js +1 -1
  90. notebook/static/5099.bundle.js +1 -1
  91. notebook/static/5115.bundle.js +1 -1
  92. notebook/static/5135.bundle.js +1 -1
  93. notebook/static/514.bundle.js +1 -1
  94. notebook/static/5313.bundle.js +1 -1
  95. notebook/static/5325.bundle.js +1 -1
  96. notebook/static/5346.bundle.js +1 -1
  97. notebook/static/5376.bundle.js +1 -0
  98. notebook/static/5426.bundle.js +1 -1
  99. notebook/static/5573.bundle.js +1 -1
  100. notebook/static/5601.bundle.js +1 -1
  101. notebook/static/5649.bundle.js +1 -1
  102. notebook/static/5733.bundle.js +1 -1
  103. notebook/static/5828.bundle.js +1 -1
  104. notebook/static/5850.bundle.js +1 -1
  105. notebook/static/5874.bundle.js +744 -0
  106. notebook/static/5874.bundle.js.LICENSE.txt +4 -0
  107. notebook/static/5912.bundle.js +1 -1
  108. notebook/static/5921.bundle.js +1 -1
  109. notebook/static/5982.bundle.js +1 -0
  110. notebook/static/6017.bundle.js +1 -1
  111. notebook/static/6027.bundle.js +1 -1
  112. notebook/static/6061.bundle.js +1 -1
  113. notebook/static/6139.bundle.js +1 -1
  114. notebook/static/62.bundle.js +1 -1
  115. notebook/static/6249.bundle.js +1 -0
  116. notebook/static/6256.bundle.js +1 -1
  117. notebook/static/6262.bundle.js +1 -0
  118. notebook/static/6271.bundle.js +1 -1
  119. notebook/static/6345.bundle.js +1 -1
  120. notebook/static/6405.bundle.js +1 -0
  121. notebook/static/6604.bundle.js +1 -1
  122. notebook/static/6621.bundle.js +1 -1
  123. notebook/static/6627.bundle.js +1 -1
  124. notebook/static/6731.bundle.js +1 -1
  125. notebook/static/6815.bundle.js +1 -1
  126. notebook/static/6853.bundle.js +1 -1
  127. notebook/static/{4842.bundle.js → 6869.bundle.js} +1 -1
  128. notebook/static/6893.bundle.js +1 -1
  129. notebook/static/690.bundle.js +1 -1
  130. notebook/static/6962.bundle.js +1 -1
  131. notebook/static/6972.bundle.js +1 -1
  132. notebook/static/6999.bundle.js +1 -1
  133. notebook/static/7154.bundle.js +1 -1
  134. notebook/static/7226.bundle.js +1 -1
  135. notebook/static/7252.bundle.js +1 -1
  136. notebook/static/7302.bundle.js +1 -1
  137. notebook/static/7333.bundle.js +2 -0
  138. notebook/static/7339.bundle.js +1 -0
  139. notebook/static/7369.bundle.js +1 -1
  140. notebook/static/7386.bundle.js +1 -1
  141. notebook/static/7391.bundle.js +1 -1
  142. notebook/static/7394.bundle.js +1 -1
  143. notebook/static/7427.bundle.js +1 -1
  144. notebook/static/7582.bundle.js +1 -1
  145. notebook/static/{7407.bundle.js → 7590.bundle.js} +1 -1
  146. notebook/static/7603.bundle.js +1 -1
  147. notebook/static/7639.bundle.js +1 -1
  148. notebook/static/7674.bundle.js +1 -1
  149. notebook/static/7684.bundle.js +1 -1
  150. notebook/static/7811.bundle.js +1 -1
  151. notebook/static/7819.bundle.js +1 -1
  152. notebook/static/7866.bundle.js +1 -1
  153. notebook/static/7900.bundle.js +1 -1
  154. notebook/static/7906.bundle.js +1 -1
  155. notebook/static/7943.bundle.js +1 -0
  156. notebook/static/8010.bundle.js +1 -1
  157. notebook/static/8032.bundle.js +1 -1
  158. notebook/static/8055.bundle.js +1 -0
  159. notebook/static/8579.bundle.js +1 -1
  160. notebook/static/8633.bundle.js +1 -1
  161. notebook/static/8771.bundle.js +1 -1
  162. notebook/static/8781.bundle.js +1 -0
  163. notebook/static/882.bundle.js +1 -0
  164. notebook/static/8845.bundle.js +1 -1
  165. notebook/static/8875.bundle.js +1 -1
  166. notebook/static/8907.bundle.js +1 -1
  167. notebook/static/8928.bundle.js +1 -1
  168. notebook/static/8929.bundle.js +1 -1
  169. notebook/static/893.bundle.js +1 -1
  170. notebook/static/901.bundle.js +1 -1
  171. notebook/static/9068.bundle.js +1 -1
  172. notebook/static/911.bundle.js +1 -1
  173. notebook/static/9151.bundle.js +1 -1
  174. notebook/static/9161.bundle.js +1 -1
  175. notebook/static/9239.bundle.js +1 -1
  176. notebook/static/9250.bundle.js +1 -1
  177. notebook/static/9268.bundle.js +1 -1
  178. notebook/static/9284.bundle.js +1 -0
  179. notebook/static/9308.bundle.js +1 -1
  180. notebook/static/9335.bundle.js +1 -1
  181. notebook/static/9341.bundle.js +1 -1
  182. notebook/static/9380.bundle.js +1 -1
  183. notebook/static/9466.bundle.js +1 -0
  184. notebook/static/9554.bundle.js +1 -0
  185. notebook/static/9605.bundle.js +1 -1
  186. notebook/static/9638.bundle.js +1 -1
  187. notebook/static/9680.bundle.js +1 -1
  188. notebook/static/9685.bundle.js +1 -1
  189. notebook/static/9752.bundle.js +1 -1
  190. notebook/static/9799.bundle.js +1 -1
  191. notebook/static/9821.bundle.js +1 -1
  192. notebook/static/9852.bundle.js +1 -1
  193. notebook/static/9987.bundle.js +1 -0
  194. notebook/static/bundle.js +1 -1
  195. notebook/static/third-party-licenses.json +177 -111
  196. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +15 -15
  197. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +5 -5
  198. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
  199. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +10 -10
  200. notebook-7.1.0a1.data/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +17 -0
  201. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +17 -17
  202. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +12 -12
  203. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +11 -11
  204. notebook-7.1.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/50.e41798f78fa32030e149.js +1 -0
  205. notebook-7.1.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.9fa8bfe8da6242a4fc6b.js +1 -0
  206. notebook-7.1.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.79046a2eb17bde1af38c.js → notebook-7.1.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.faa0d74ec3a151a81a90.js +1 -1
  207. notebook-7.1.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/93.eae3497dd223d842d198.js +1 -0
  208. notebook-7.1.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.02d92bfa6cab99929020.js +1 -0
  209. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +4 -4
  210. {notebook-7.1.0a0.dist-info → notebook-7.1.0a1.dist-info}/METADATA +2 -2
  211. notebook-7.1.0a1.dist-info/RECORD +430 -0
  212. notebook/static/1306.bundle.js +0 -1
  213. notebook/static/1945.bundle.js +0 -1
  214. notebook/static/1964.bundle.js +0 -1
  215. notebook/static/3412.bundle.js +0 -1
  216. notebook/static/3434.bundle.js +0 -1
  217. notebook/static/3618.bundle.js +0 -1
  218. notebook/static/3672.bundle.js +0 -1
  219. notebook/static/3791.bundle.js +0 -1
  220. notebook/static/3993.bundle.js +0 -1
  221. notebook/static/4234.bundle.js +0 -1
  222. notebook/static/4793.bundle.js +0 -1
  223. notebook/static/4826.bundle.js +0 -1
  224. notebook/static/4867.bundle.js +0 -1
  225. notebook/static/5058.bundle.js +0 -1
  226. notebook/static/5329.bundle.js +0 -1
  227. notebook/static/5591.bundle.js +0 -1
  228. notebook/static/5642.bundle.js +0 -1
  229. notebook/static/6359.bundle.js +0 -1
  230. notebook/static/6667.bundle.js +0 -1
  231. notebook/static/6843.bundle.js +0 -1
  232. notebook/static/7763.bundle.js +0 -1
  233. notebook/static/7764.bundle.js +0 -1
  234. notebook/static/8723.bundle.js +0 -2
  235. notebook/static/880.bundle.js +0 -1
  236. notebook/static/8968.bundle.js +0 -1
  237. notebook/static/9086.bundle.js +0 -1
  238. notebook/static/9213.bundle.js +0 -2
  239. notebook/static/9381.bundle.js +0 -1
  240. notebook/static/9514.bundle.js +0 -1
  241. notebook/static/9545.bundle.js +0 -1
  242. notebook/static/973.bundle.js +0 -2
  243. notebook-7.1.0a0.data/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -10
  244. notebook-7.1.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.ffc2f99974c3b184be5a.js +0 -1
  245. notebook-7.1.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/776.c7baadfaddfd4518c935.js +0 -1
  246. notebook-7.1.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/922.0beff4620746e288bd5e.js +0 -1
  247. notebook-7.1.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.e73b0142911cf6300a74.js +0 -1
  248. notebook-7.1.0a0.dist-info/RECORD +0 -427
  249. /notebook/static/{9213.bundle.js.LICENSE.txt → 1326.bundle.js.LICENSE.txt} +0 -0
  250. /notebook/static/{8723.bundle.js.LICENSE.txt → 3190.bundle.js.LICENSE.txt} +0 -0
  251. /notebook/static/{973.bundle.js.LICENSE.txt → 7333.bundle.js.LICENSE.txt} +0 -0
  252. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
  253. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/applications/jupyter-notebook.desktop +0 -0
  254. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
  255. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
  256. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
  257. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +0 -0
  258. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
  259. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
  260. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
  261. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
  262. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
  263. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
  264. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
  265. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -0
  266. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
  267. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
  268. {notebook-7.1.0a0.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
  269. {notebook-7.1.0a0.dist-info → notebook-7.1.0a1.dist-info}/WHEEL +0 -0
  270. {notebook-7.1.0a0.dist-info → notebook-7.1.0a1.dist-info}/entry_points.txt +0 -0
  271. {notebook-7.1.0a0.dist-info → notebook-7.1.0a1.dist-info}/licenses/LICENSE +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[9086],{89086:(e,t,i)=>{i.r(t),i.d(t,{CONTEXT_PROVIDER_ID:()=>T,Completer:()=>P,CompleterModel:()=>_,CompletionHandler:()=>c,CompletionProviderManager:()=>q,CompletionTriggerKind:()=>s,ContextCompleterProvider:()=>k,ICompletionProviderManager:()=>l,KERNEL_PROVIDER_ID:()=>D,KernelCompleterProvider:()=>H,ProviderReconciliator:()=>M});var s,n=i(82743),o=i(49503),r=i(81997),a=i(20998);!function(e){e[e.Invoked=1]="Invoked",e[e.TriggerCharacter=2]="TriggerCharacter",e[e.TriggerForIncompleteCompletions=3]="TriggerForIncompleteCompletions"}(s||(s={}));const l=new a.Token("@jupyterlab/completer:ICompletionProviderManager","A service for the completion providers management."),d="jp-mod-completer-enabled",h="jp-mod-completer-active";class c{constructor(e){this._editor=null,this._enabled=!1,this._isDisposed=!1,this._autoCompletion=!1,this.completer=e.completer,this.completer.selected.connect(this.onCompletionSelected,this),this.completer.visibilityChanged.connect(this.onVisibilityChanged,this),this._reconciliator=e.reconciliator}set reconciliator(e){this._reconciliator=e}get editor(){return this._editor}set editor(e){if(e===this._editor)return;let t=this._editor;if(t&&!t.isDisposed){const e=t.model;t.host.classList.remove(d),t.host.classList.remove(h),e.selections.changed.disconnect(this.onSelectionsChanged,this),e.sharedModel.changed.disconnect(this.onTextChanged,this)}if(this.completer.reset(),this.completer.editor=e,t=this._editor=e,t){const e=t.model;this._enabled=!1,e.selections.changed.connect(this.onSelectionsChanged,this),e.sharedModel.changed.connect(this.onTextChanged,this),this.onSelectionsChanged()}}get isDisposed(){return this._isDisposed}set autoCompletion(e){this._autoCompletion=e}get autoCompletion(){return this._autoCompletion}dispose(){this.isDisposed||(this._isDisposed=!0,r.Signal.clearData(this))}invoke(){o.MessageLoop.sendMessage(this,c.Msg.InvokeRequest)}processMessage(e){e.type===c.Msg.InvokeRequest.type&&this.onInvokeRequest(e)}getState(e,t){return{text:e.model.sharedModel.getSource(),line:t.line,column:t.column}}onCompletionSelected(e,t){const i=e.model,s=this._editor;if(!s||!i)return;const n=i.createPatch(t);if(!n)return;const{start:o,end:r,value:a}=n,l=s.getOffsetAt(s.getCursorPosition());s.model.sharedModel.updateSource(o,r,a),l<=r&&l>=o&&s.setCursorPosition(s.getPositionAt(o+a.length))}onInvokeRequest(e){if(!this.completer.model)return;if(this.completer.model.original)return;const t=this._editor;t&&this._makeRequest(t.getCursorPosition(),s.Invoked).catch((e=>{console.warn("Invoke request bailed",e)}))}onSelectionsChanged(){const e=this.completer.model,t=this._editor;if(!t)return;const i=t.host;if(!e)return this._enabled=!1,void i.classList.remove(d);if(e.subsetMatch)return;const s=t.getCursorPosition(),n=t.getLine(s.line);if(!n)return this._enabled=!1,e.reset(!0),void i.classList.remove(d);const{start:o,end:r}=t.getSelection();return o.column!==r.column||o.line!==r.line||n.slice(0,s.column).match(/^\s*$/)?(this._enabled=!1,e.reset(!0),void i.classList.remove(d)):(this._enabled||(this._enabled=!0,i.classList.add(d)),void e.handleCursorChange(this.getState(t,t.getCursorPosition())))}async onTextChanged(e,t){const i=this.completer.model;if(!i||!this._enabled)return;const n=this.editor;if(!n)return;this._autoCompletion&&this._reconciliator.shouldShowContinuousHint&&await this._reconciliator.shouldShowContinuousHint(this.completer.isVisible,t)&&this._makeRequest(n.getCursorPosition(),s.TriggerCharacter);const{start:o,end:r}=n.getSelection();o.column===r.column&&o.line===r.line&&i.handleTextChange(this.getState(n,n.getCursorPosition()))}onVisibilityChanged(e){e.isDisposed||e.isHidden?this._editor&&(this._editor.host.classList.remove(h),this._editor.focus()):this._editor&&this._editor.host.classList.add(h)}_makeRequest(e,t){const i=this.editor;if(!i)return Promise.reject(new Error("No active editor"));const s=i.model.sharedModel.getSource(),o=n.Text.jsIndexToCharIndex(i.getOffsetAt(e),s),r=this.getState(i,e),a={text:s,offset:o};return this._reconciliator.fetch(a,t).then((e=>{if(!e)return;const t=this._updateModel(r,e.start,e.end);t&&t.setCompletionItems&&t.setCompletionItems(e.items)})).catch((e=>{}))}_updateModel(e,t,i){const s=this.completer.model,o=e.text;return s?(s.original=e,s.cursor={start:n.Text.charIndexToJsIndex(t,o),end:n.Text.charIndexToJsIndex(i,o)},s):null}}!function(e){let t;!function(e){e.InvokeRequest=new o.Message("invoke-request")}(t=e.Msg||(e.Msg={}))}(c||(c={}));var u,m=i(33625);function p(e){const t=document.createElement("span");return t.textContent=e,t.innerHTML}class _{constructor(){this.processedItemsCache=null,this._current=null,this._cursor=null,this._isDisposed=!1,this._completionItems=[],this._original=null,this._query="",this._subsetMatch=!1,this._typeMap={},this._orderedTypes=[],this._stateChanged=new r.Signal(this),this._queryChanged=new r.Signal(this),this._processedToOriginalItem=null,this._resolvingItem=0}get stateChanged(){return this._stateChanged}get queryChanged(){return this._queryChanged}get original(){return this._original}set original(e){this._original===e||this._original&&e&&a.JSONExt.deepEqual(e,this._original)||(this._reset(),this._current=this._original=e,this._stateChanged.emit(void 0))}get current(){return this._current}set current(e){if(this._current===e||this._current&&e&&a.JSONExt.deepEqual(e,this._current))return;const t=this._original;if(!t)return;const i=this._cursor;if(!i)return;const s=this._current=e;if(!s)return void this._stateChanged.emit(void 0);const n=t.text.split("\n")[t.line],o=s.text.split("\n")[s.line];if(!this._subsetMatch&&o.length<n.length)return void this.reset(!0);const{start:r,end:l}=i;let d=s.text.substring(r);const h=t.text.substring(l);d=d.substring(0,d.lastIndexOf(h)),this._query=d,this.processedItemsCache=null,this._processedToOriginalItem=null,this._queryChanged.emit({newValue:this._query,origin:"editorUpdate"}),this._stateChanged.emit(void 0)}get cursor(){return this._cursor}set cursor(e){this.original&&(this._cursor=e)}get query(){return this._query}set query(e){this._query=e,this.processedItemsCache=null,this._processedToOriginalItem=null,this._queryChanged.emit({newValue:this._query,origin:"setter"})}get subsetMatch(){return this._subsetMatch}set subsetMatch(e){this._subsetMatch=e}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,r.Signal.clearData(this))}completionItems(){if(!this.processedItemsCache){let e=this._query;if(e){const t=this._markup(e);this.processedItemsCache=t.map((e=>e.processedItem)),this._processedToOriginalItem=new WeakMap(t.map((e=>[e.processedItem,e.originalItem])))}else this.processedItemsCache=this._completionItems.map((e=>this._escapeItemLabel(e))),this._processedToOriginalItem=null}return this.processedItemsCache}setCompletionItems(e){a.JSONExt.deepEqual(e,this._completionItems)||(this._completionItems=e,this._orderedTypes=u.findOrderedCompletionItemTypes(this._completionItems),this.processedItemsCache=null,this._processedToOriginalItem=null,this._stateChanged.emit(void 0))}typeMap(){return this._typeMap}orderedTypes(){return this._orderedTypes}handleCursorChange(e){if(!this._original)return;const{column:t,line:i}=e,{current:s,original:n}=this;if(!n)return;if(i!==n.line)return void this.reset(!0);if(t<n.column)return void this.reset(!0);const{cursor:o}=this;if(!o||!s)return;const r=o.end-o.start,a=n.text.split("\n")[n.line],l=s.text.split("\n")[s.line].length-a.length;t>n.column+r+l&&this.reset(!0)}handleTextChange(e){const t=this._original;if(!t)return;const{text:i,column:s,line:n}=e,o=i.split("\n")[n][s-1];o&&o.match(/\S/)||e.column>=t.column?this.current=e:this.reset(!1)}createPatch(e){const t=this._original,i=this._cursor,s=this._current;if(!t||!i||!s)return;let{start:n,end:o}=i;return o+=s.text.length-t.text.length,{start:n,end:o,value:e}}reset(e=!1){!e&&this._subsetMatch||(this._reset(),this._stateChanged.emit(void 0))}_markup(e){var t;const i=this._completionItems;let s=[];for(const n of i){const i=n.label.indexOf("("),o=i>-1?n.label.substring(0,i):n.label,r=m.StringExt.matchSumOfSquares(p(o),e);if(r){let e=m.StringExt.highlight(p(n.label),r.indices,u.mark);const i=Object.assign({},n);i.label=e.join(""),i.insertText=null!==(t=n.insertText)&&void 0!==t?t:n.label,s.push({item:i,score:r.score,originalItem:n})}}return s.sort(u.scoreCmp),s.map((e=>({processedItem:e.item,originalItem:e.originalItem})))}resolveItem(e){let t,i;if("number"==typeof e){const i=this.completionItems();if(!i||!i[e])return;t=i[e]}else t=e;if(t)return i=this._processedToOriginalItem?this._processedToOriginalItem.get(t):t,i?this._resolveItemByValue(i):void 0}_resolveItemByValue(e){const t=++this._resolvingItem;let i;if(e.resolve){let t;e.insertText&&(t=this.createPatch(e.insertText)),i=e.resolve(t)}else i=Promise.resolve(e);return i.then((i=>(this._escapeItemLabel(i,!0),Object.keys(i).forEach((t=>{e[t]=i[t]})),e.resolve=void 0,t!==this._resolvingItem?Promise.resolve(null):i))).catch((t=>(console.error(t),Promise.resolve(e))))}_escapeItemLabel(e,t=!1){var i;const s=p(e.label);if(s!==e.label){const n=t?e:Object.assign({},e);return n.insertText=null!==(i=e.insertText)&&void 0!==i?i:e.label,n.label=s,n}return e}_reset(){const e=this._query;this._current=null,this._cursor=null,this._completionItems=[],this._original=null,this._query="",this.processedItemsCache=null,this._processedToOriginalItem=null,this._subsetMatch=!1,this._typeMap={},this._orderedTypes=[],e&&this._queryChanged.emit({newValue:this._query,origin:"reset"})}}!function(e){const t=["function","instance","class","module","keyword"],i=t.reduce(((e,t)=>(e[t]=null,e)),{});e.mark=function(e){return`<mark>${e}</mark>`},e.scoreCmp=function(e,t){var i,s,n;const o=e.score-t.score;return 0!==o?o:null!==(n=null===(i=e.item.insertText)||void 0===i?void 0:i.localeCompare(null!==(s=t.item.insertText)&&void 0!==s?s:""))&&void 0!==n?n:0},e.findOrderedCompletionItemTypes=function(e){const i=new Set;e.forEach((e=>{!e.type||t.includes(e.type)||i.has(e.type)||i.add(e.type)}));const s=Array.from(i);return s.sort(((e,t)=>e.localeCompare(t))),t.concat(s)},e.findOrderedTypes=function(e){const s=Object.keys(e).map((t=>e[t])).filter((e=>!!e&&!(e in i))).sort(((e,t)=>e.localeCompare(t)));return t.concat(s)}}(u||(u={}));var g=i(67569),v=i(29672),C=i(22205),f=i(18395),y=i(35111);const x="jp-Completer-item",I="jp-mod-active",w="jp-Completer-list",b=!0;class P extends y.Widget{constructor(e){var t,i,s,n;super({node:document.createElement("div")}),this._activeIndex=0,this._editor=null,this._model=null,this._selected=new r.Signal(this),this._visibilityChanged=new r.Signal(this),this._indexChanged=new r.Signal(this),this._lastSubsetMatch="",this._geometryLock=!1,this._geometryCounter=0,this._docPanelExpanded=!1,this._renderCounter=0,this.sanitizer=null!==(t=e.sanitizer)&&void 0!==t?t:new g.Sanitizer,this._defaultRenderer=P.getDefaultRenderer(this.sanitizer),this._renderer=null!==(i=e.renderer)&&void 0!==i?i:this._defaultRenderer,this._docPanel=this._createDocPanelNode(),this.model=null!==(s=e.model)&&void 0!==s?s:null,this.editor=null!==(n=e.editor)&&void 0!==n?n:null,this.addClass("jp-Completer"),this._updateConstraints()}_updateConstraints(){const e=document.createElement("div");e.classList.add(w),e.style.visibility="hidden",e.style.overflowY="scroll",document.body.appendChild(e);const t=window.getComputedStyle(e);this._maxHeight=parseInt(t.maxHeight,10),this._minHeight=parseInt(t.minHeight,10),this._scrollbarWidth=e.offsetWidth-e.clientWidth,document.body.removeChild(e);const i=this._createDocPanelNode();this._docPanelWidth=S.measureSize(i,"inline-block").width}get activeIndex(){return this._activeIndex}get editor(){return this._editor}set editor(e){this._editor=e}get selected(){return this._selected}get visibilityChanged(){return this._visibilityChanged}get indexChanged(){return this._indexChanged}get model(){return this._model}set model(e){(e||this._model)&&e!==this._model&&(this._model&&(this._model.stateChanged.disconnect(this.onModelStateChanged,this),this._model.queryChanged.disconnect(this.onModelQueryChanged,this)),this._model=e,this._model&&(this._model.stateChanged.connect(this.onModelStateChanged,this),this._model.queryChanged.connect(this.onModelQueryChanged,this)))}get renderer(){return this._renderer}set renderer(e){this._renderer=e}set showDocsPanel(e){this._showDoc=e}get showDocsPanel(){return this._showDoc}dispose(){this._sizeCache=void 0,this._model=null,super.dispose()}handleEvent(e){if(!this.isHidden&&this._editor)switch(e.type){case"keydown":this._evtKeydown(e);break;case"mousedown":this._evtMousedown(e);break;case"scroll":this._evtScroll(e)}}reset(){this._activeIndex=0,this._lastSubsetMatch="",this._model&&this._model.reset(!0),this._docPanel.style.display="none",this._sizeCache=void 0,this.node.scrollTop=0}selectActive(){const e=this.node.querySelector(`.${I}`);e?(this._selected.emit(e.getAttribute("data-value")),this.reset()):this.reset()}onAfterAttach(e){document.addEventListener("keydown",this,b),document.addEventListener("mousedown",this,b),document.addEventListener("scroll",this,b)}onBeforeDetach(e){document.removeEventListener("keydown",this,b),document.removeEventListener("mousedown",this,b),document.removeEventListener("scroll",this,b)}onModelStateChanged(){this.isAttached&&(this._activeIndex=0,this._indexChanged.emit(this._activeIndex),this.update())}onModelQueryChanged(e,t){if(this._sizeCache&&"editorUpdate"===t.origin){const t=e.completionItems(),i=this._sizeCache.items,s=i[this._findWidestItemIndex(i)],n=t[this._findWidestItemIndex(t)],o=this._getPreferredItemWidthHeuristic();t.length===this._sizeCache.items.length&&o(s)===o(n)||(this._sizeCache=void 0)}}onUpdateRequest(e){var t;const i=this._model;if(!i)return;i.query||this._populateSubset();let s=i.completionItems();if(!s.length)return void(this.isHidden||(this.reset(),this.hide(),this._visibilityChanged.emit(void 0)));this._updateConstraints(),this._geometryLock=!0;const n=this._createCompleterNode(i,s);let o=n.querySelectorAll(`.${x}`)[this._activeIndex];o.classList.add(I);const r=null===(t=this.model)||void 0===t?void 0:t.resolveItem(s[this._activeIndex]);this._showDoc&&(this._docPanel.innerText="",n.appendChild(this._docPanel),this._docPanelExpanded=!1,this._updateDocPanel(r,o)),this.isHidden?(this.show(),this._setGeometry(),this._visibilityChanged.emit(void 0)):this._setGeometry(),this._geometryLock=!1}get sizeCache(){if(this._sizeCache)return{width:this._sizeCache.width+this._sizeCache.docPanelWidth,height:Math.max(this._sizeCache.height,this._sizeCache.docPanelHeight)}}_createDocPanelNode(){const e=document.createElement("div");return e.className="jp-Completer-docpanel",e}_createCompleterNode(e,t){const i=++this._renderCounter;let s=this.node;s.textContent="";let n=e.orderedTypes(),o=document.createElement("ul");o.className=w;const r=this._renderer.createCompletionItemNode(t[0],n),a=[r],l=S.measureSize(r,"inline-grid"),d=Math.max(Math.ceil(this._maxHeight/l.height),5),h=Math.min(d+1,t.length),c=performance.now();for(let e=1;e<h;e++){const i=this._renderer.createCompletionItemNode(t[e],n);a.push(i)}for(const e of a)o.appendChild(e);const u=this._findWidestItemIndex(t),m=u<a.length?a[u]:this._renderer.createCompletionItemNode(t[u],n),p=S.measureSize(m.cloneNode(!0),"inline-grid");if(this._sizeCache={height:Math.min(this._maxHeight,l.height*t.length),width:p.width+this._scrollbarWidth,items:t,docPanelWidth:0,docPanelHeight:0},h<t.length){const e=(performance.now()-c)/h,s=Math.max(5,Math.floor(12/e));let r=h,d=a[a.length-1];const u=()=>{if(r>=t.length)return;const e=l.height*(t.length-r);d.style.marginBottom=`${e}px`,requestAnimationFrame((()=>{if(i!=this._renderCounter)return;d.style.marginBottom="";const e=Math.min(t.length,r+s);for(let i=r;i<e;i++){const e=this._renderer.createCompletionItemNode(t[i],n);o.appendChild(e),d=e}r=e,u()}))};u()}return s.appendChild(o),s}_findWidestItemIndex(e){const t=this._getPreferredItemWidthHeuristic(),i=e.map(t);return i.indexOf(Math.max(...i))}_getPreferredItemWidthHeuristic(){return this._renderer.itemWidthHeuristic?this._renderer.itemWidthHeuristic.bind(this._renderer):this._defaultRenderer.itemWidthHeuristic.bind(this._defaultRenderer)}_cycle(e){var t,i;const s=this.node.querySelectorAll(`.${x}`),n=this._activeIndex,o=s.length-1;let r=this.node.querySelector(`.${I}`);switch(r.classList.remove(I),e){case"up":this._activeIndex=0===n?o:n-1;break;case"down":this._activeIndex=n<o?n+1:0;break;case"pageUp":case"pageDown":{const t=this.node.getBoundingClientRect(),i=r.getBoundingClientRect(),s=Math.floor(t.height/i.height),a="pageUp"===e?-1:1;this._activeIndex=Math.min(Math.max(0,n+a*s),o);break}}r=s[this._activeIndex],r.classList.add(I);let a=this.node.querySelector(`.${w}`);f.ElementExt.scrollIntoViewIfNeeded(a,r),this._indexChanged.emit(this._activeIndex);const l=null===(t=this.model)||void 0===t?void 0:t.completionItems(),d=null==l?void 0:l[this._activeIndex];if(d){const e=null===(i=this.model)||void 0===i?void 0:i.resolveItem(d);this._showDoc&&this._updateDocPanel(e,r)}}_evtKeydown(e){if(!this.isHidden&&this._editor)if(this._editor.host.contains(e.target))switch(e.keyCode){case 9:{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();const t=this._model;if(!t)return;const i=t.completionItems();if(i&&1===i.length)return this._selected.emit(i[0].insertText||i[0].label),void this.reset();const s=this._populateSubset();return t.query&&t.query!==this._lastSubsetMatch&&(t.subsetMatch=!0,this._selected.emit(t.query),t.subsetMatch=!1,this._lastSubsetMatch=t.query),s&&this.update(),void this._cycle(e.shiftKey?"up":"down")}case 27:return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),void this.reset();case 33:case 34:case 38:case 40:{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();const t=S.keyCodeMap[e.keyCode];return void this._cycle(t)}default:return}else this.reset()}_evtMousedown(e){if(this.isHidden||!this._editor)return;if(S.nonstandardClick(e))return void this.reset();let t=e.target;for(;t!==document.documentElement;){if(t.classList.contains(x))return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this._selected.emit(t.getAttribute("data-value")),void this.reset();if(t===this.node)return e.preventDefault(),e.stopPropagation(),void e.stopImmediatePropagation();t=t.parentElement}this.reset()}_evtScroll(e){if(this.isHidden||!this._editor)return;const{node:t}=this;t.contains(e.target)||requestAnimationFrame((()=>{this._setGeometry()}))}_populateSubset(){const{model:e}=this;if(!e)return!1;const t=e.completionItems(),i=S.commonSubset(t.map((e=>e.insertText||e.label))),{query:s}=e;return!(!i||i===s||0!==i.indexOf(s)||(e.query=i,0))}_setGeometry(){const{node:e}=this,t=this._model,i=this._editor;if(!(i&&t&&t.original&&t.cursor))return;const s=t.cursor.start,n=i.getPositionAt(s),o=i.getCoordinateForPosition(n),r=window.getComputedStyle(e),a=parseInt(r.borderLeftWidth,10)||0,l=parseInt(r.paddingLeft,10)||0,d=i.host.closest(".jp-MainAreaWidget > .lm-Widget")||i.host,h=t.completionItems();this._sizeCache&&this._sizeCache.items.length!==h.length&&(this._sizeCache=void 0),C.HoverBox.setGeometry({anchor:o,host:d,maxHeight:this._maxHeight,minHeight:this._minHeight,node:e,size:this.sizeCache,offset:{horizontal:a+l},privilege:"below",style:r,outOfViewDisplay:{top:"stick-inside",bottom:"stick-inside",left:"stick-inside",right:"stick-outside"}});const c=++this._geometryCounter;this._sizeCache||requestAnimationFrame((()=>{if(c!=this._geometryCounter)return;let t=e.getBoundingClientRect(),i=this._docPanel.getBoundingClientRect();this._sizeCache={width:t.width-i.width,height:t.height,items:h,docPanelWidth:i.width,docPanelHeight:i.height}}))}_updateDocPanel(e,t){var i,s,n;let o=this._docPanel;if(!e)return void this._toggleDocPanel(!1);const r=null!==(n=null===(s=(i=this._renderer).createLoadingDocsIndicator)||void 0===s?void 0:s.call(i))&&void 0!==n?n:this._defaultRenderer.createLoadingDocsIndicator();t.appendChild(r),e.then((e=>{var t,i,s;if(e&&o)if(e.documentation){const n=null!==(s=null===(i=(t=this._renderer).createDocumentationNode)||void 0===i?void 0:i.call(t,e))&&void 0!==s?s:this._defaultRenderer.createDocumentationNode(e);o.textContent="",o.appendChild(n),this._toggleDocPanel(!0)}else this._toggleDocPanel(!1)})).catch((e=>console.error(e))).finally((()=>{t.removeChild(r)}))}_toggleDocPanel(e){let t=this._docPanel;if(e){if(this._docPanelExpanded)return;t.style.display="",this._docPanelExpanded=!0}else{if(!this._docPanelExpanded)return;t.style.display="none",this._docPanelExpanded=!1}const i=this._sizeCache;i&&(i.docPanelHeight=e?this._maxHeight:0,i.docPanelWidth=e?this._docPanelWidth:0,this._geometryLock||this._setGeometry())}}var S;!function(e){class t{constructor(e){this.sanitizer=(null==e?void 0:e.sanitizer)||new g.Sanitizer}createCompletionItemNode(e,t){let i=this._createWrapperNode(e.insertText||e.label);return e.deprecated&&i.classList.add("jp-Completer-deprecated"),this._constructNode(i,this._createLabelNode(e.label),!!e.type,e.type,t,e.icon)}createDocumentationNode(e){const t=document.createElement("div");t.classList.add("jp-RenderedText");const i=this.sanitizer,s=e.documentation||"";return(0,v.renderText)({host:t,sanitizer:i,source:s}).catch(console.error),t}itemWidthHeuristic(e){var t;return e.label.replace(/<(\/)?mark>/g,"").length+((null===(t=e.type)||void 0===t?void 0:t.length)||0)}createLoadingDocsIndicator(){const e=document.createElement("div");e.classList.add("jp-Completer-loading-bar-container");const t=document.createElement("div");return t.classList.add("jp-Completer-loading-bar"),e.append(t),e}_createWrapperNode(e){const t=document.createElement("li");return t.className=x,t.setAttribute("data-value",e),t}_createLabelNode(e){const t=document.createElement("code");return t.className="jp-Completer-match",t.innerHTML=e,t}_constructNode(e,t,i,s,n,o){if(o){const t=o.element({className:"jp-Completer-type jp-Completer-icon"});e.appendChild(t)}else if(i){const t=document.createElement("span");t.textContent=(s[0]||"").toLowerCase();const i=n.indexOf(s)%10+1;t.className="jp-Completer-type jp-Completer-monogram",t.setAttribute("data-color-index",i.toString()),e.appendChild(t)}else{const t=document.createElement("span");t.className="jp-Completer-monogram",e.appendChild(t)}if(e.appendChild(t),i){e.title=s;const t=document.createElement("code");t.className="jp-Completer-typeExtended",t.textContent=s.toLocaleLowerCase(),e.appendChild(t)}else{const t=document.createElement("span");t.className="jp-Completer-typeExtended",e.appendChild(t)}return e}}let i;e.Renderer=t,e.getDefaultRenderer=function(e){return(!i||e&&i.sanitizer!==e)&&(i=new t({sanitizer:e})),i}}(P||(P={})),function(e){e.keyCodeMap={38:"up",40:"down",33:"pageUp",34:"pageDown"},e.commonSubset=function(e){const t=e.length;let i="";if(t<2)return i;const s=e[0].length;for(let n=0;n<s;n++){const s=e[0][n];for(let o=1;o<t;o++)if(e[o][n]!==s)return i;i+=s}return i},e.nonstandardClick=function(e){return 0!==e.button||e.altKey||e.ctrlKey||e.shiftKey||e.metaKey},e.measureSize=function(e,t){e.isConnected&&console.warn("Measuring connected elements with `measureSize` has side-effects"),e.style.visibility="hidden",e.style.display=t,document.body.appendChild(e);const i=e.getBoundingClientRect();return document.body.removeChild(e),e.removeAttribute("style"),i}}(S||(S={}));class M{constructor(e){this._resolveFactory=(e,t)=>e.resolve?i=>e.resolve(t,this._context,i):void 0,this._fetching=0,this._providers=e.providers,this._context=e.context,this._timeout=e.timeout}async applicableProviders(){const e=this._providers.map((e=>e.isApplicable(this._context))),t=await Promise.all(e);return this._providers.filter(((e,i)=>t[i]))}async fetch(e,t){const i=++this._fetching;let s=[];const n=await this.applicableProviders();for(const o of n){let n;n=o.fetch(e,this._context,t).then((e=>{if(i!==this._fetching)return Promise.reject(void 0);const t=e.items.map((e=>({...e,resolve:this._resolveFactory(o,e)})));return{...e,items:t}}));const r=new Promise((e=>setTimeout((()=>e(null)),this._timeout)));n=Promise.race([n,r]),s.push(n.catch((e=>e)))}const o=Promise.all(s);return this._mergeCompletions(o)}async shouldShowContinuousHint(e,t){const i=await this.applicableProviders();return 0!==i.length&&(i[0].shouldShowContinuousHint?i[0].shouldShowContinuousHint(e,t,this._context):this._defaultShouldShowContinuousHint(e,t))}_alignPrefixes(e,t,i){if(t!=i){const t=this._context.editor;if(!t)return e;const s=t.getCursorPosition(),n=t.getLine(s.line);return n?e.map((e=>{if(e.start==i)return e;let t=n.substring(e.start,i);return{...e,items:e.items.map((e=>{let i=e.insertText||e.label;return e.insertText=i.startsWith(t)?i.slice(t.length):i,e}))}})):e}return e}async _mergeCompletions(e){let t=(await e).filter((e=>!(!e||e instanceof Error||!e.items.length)));if(0==t.length)return null;if(1==t.length)return t[0];const i=Math.min(...t.map((e=>e.end))),s=t.map((e=>e.start)),n=Math.min(...s),o=Math.max(...s);t=this._alignPrefixes(t,n,o);const r=new Set,a=new Array;for(const e of t)e.items.forEach((e=>{let t=(e.insertText||e.label).trim();r.has(t)||(r.add(t),a.push(e))}));return{start:o,end:i,items:a}}_defaultShouldShowContinuousHint(e,t){return!e&&(null==t.sourceChange||t.sourceChange.some((e=>null!=e.insert&&e.insert.length>0)))}}const T="CompletionProvider:context";class k{constructor(){this.identifier=T,this.rank=500,this.renderer=null}async isApplicable(e){return!0}fetch(e,t){const i=t.editor;return i?new Promise((e=>{e(E.contextHint(i))})):Promise.reject("No editor")}}var E;!function(e){e.contextHint=function(e){const t=e.getTokenAtCursor(),i=function(e,t){return t.getTokens().filter((t=>0===t.value.indexOf(e.value)&&t.value!==e.value))}(t,e).filter((e=>e.type)).map((e=>e.value)),s=new Set(i),n=new Array;return s.forEach((e=>n.push({label:e}))),{start:t.offset,end:t.offset+t.value.length,items:n}}}(E||(E={}));const D="CompletionProvider:kernel";class H{constructor(){this.identifier=D,this.rank=550,this.renderer=null}async isApplicable(e){var t;return!!(null===(t=e.session)||void 0===t?void 0:t.kernel)}async fetch(e,t){var i;const s=null===(i=t.session)||void 0===i?void 0:i.kernel;if(!s)throw new Error("No kernel for completion request.");const n={code:e.text,cursor_pos:e.offset},o=(await s.requestComplete(n)).content;if("ok"!==o.status)throw new Error("Completion fetch failed to return successfully.");const r=new Array,a=o.metadata._jupyter_types_experimental;return o.matches.forEach(((e,t)=>{a&&a[t]?r.push({label:e,type:a[t].type,insertText:a[t].text}):r.push({label:e})})),{start:o.cursor_start,end:o.cursor_end,items:r}}async resolve(e,t,i){const{editor:s,session:o}=t;if(o&&s){let t=s.model.sharedModel.getSource();const r=s.getCursorPosition();let a=n.Text.jsIndexToCharIndex(s.getOffsetAt(r),t);const l=o.kernel;if(!t||!l)return Promise.resolve(e);if(i){const{start:e,value:s}=i;t=t.substring(0,e)+s,a+=s.length}const d={code:t,cursor_pos:a,detail_level:0},h=(await l.requestInspect(d)).content;return"ok"===h.status&&h.found?(e.documentation=h.data["text/plain"],e):e}return e}shouldShowContinuousHint(e,t){const i=t.sourceChange;return null==i||!i.some((e=>null!=e.delete))&&i.some((t=>null!=t.insert&&("."===t.insert||!e&&t.insert.trim().length>0)))}}class q{constructor(){this._activeProviders=new Set([D,T]),this._providers=new Map,this._panelHandlers=new Map,this._mostRecentContext=new Map,this._activeProvidersChanged=new r.Signal(this)}get activeProvidersChanged(){return this._activeProvidersChanged}setTimeout(e){this._timeout=e}setShowDocumentationPanel(e){this._panelHandlers.forEach((t=>t.completer.showDocsPanel=e)),this._showDoc=e}setContinuousHinting(e){this._panelHandlers.forEach((t=>t.autoCompletion=e)),this._autoCompletion=e}registerProvider(e){const t=e.identifier;this._providers.has(t)?console.warn(`Completion service with identifier ${t} is already registered`):(this._providers.set(t,e),this._panelHandlers.forEach(((e,t)=>{this.updateCompleter(this._mostRecentContext.get(t))})))}getProviders(){return this._providers}activateProvider(e){this._activeProviders=new Set([]),e.forEach((e=>{this._providers.has(e)&&this._activeProviders.add(e)})),0===this._activeProviders.size&&(this._activeProviders.add(D),this._activeProviders.add(T)),this._activeProvidersChanged.emit()}async updateCompleter(e){var t,i;const{widget:s,editor:n,sanitizer:o}=e,r=s.id,a=this._panelHandlers.get(r),l=[...this._activeProviders][0],d=this._providers.get(l);let h=null!==(t=null==d?void 0:d.renderer)&&void 0!==t?t:P.getDefaultRenderer(o);const c=null==d?void 0:d.modelFactory;let u;u=c?await c.call(d,e):new _,this._mostRecentContext.set(s.id,e);const m={model:u,renderer:h,sanitizer:o,showDoc:this._showDoc};if(a){const t=a.completer;null===(i=t.model)||void 0===i||i.dispose(),t.model=m.model,t.renderer=m.renderer,t.showDocsPanel=m.showDoc,a.autoCompletion=this._autoCompletion,n&&(a.editor=n,a.reconciliator=await this.generateReconciliator(e))}else{const t=await this._generateHandler(e,m);this._panelHandlers.set(s.id,t),s.disposed.connect((e=>{this.disposeHandler(e.id,t),this._mostRecentContext.delete(r)}))}}invoke(e){const t=this._panelHandlers.get(e);t&&t.invoke()}select(e){const t=this._panelHandlers.get(e);t&&t.completer.selectActive()}async generateReconciliator(e){const t=[];for(const e of this._activeProviders){const i=this._providers.get(e);i&&t.push(i)}return new M({context:e,providers:t,timeout:this._timeout})}disposeHandler(e,t){var i;null===(i=t.completer.model)||void 0===i||i.dispose(),t.completer.dispose(),t.dispose(),this._panelHandlers.delete(e)}async _generateHandler(e,t){const i=new P(t);i.hide(),y.Widget.attach(i,document.body);const s=await this.generateReconciliator(e),n=new c({completer:i,reconciliator:s});return n.editor=e.editor,n}}}}]);