notebook 7.0.0b4__py3-none-any.whl → 7.0.0rc0__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 (205) hide show
  1. notebook/_version.py +1 -1
  2. notebook/app.py +17 -13
  3. notebook/static/1018.bundle.js +1 -1
  4. notebook/static/1198.bundle.js +1 -1
  5. notebook/static/1337.bundle.js +1 -1
  6. notebook/static/134.bundle.js +1 -0
  7. notebook/static/1408.bundle.js +1 -1
  8. notebook/static/1584.bundle.js +1 -1
  9. notebook/static/162.bundle.js +1 -1
  10. notebook/static/1647.bundle.js +1 -1
  11. notebook/static/1650.bundle.js +1 -1
  12. notebook/static/1682.bundle.js +1 -1
  13. notebook/static/1684.bundle.js +1 -1
  14. notebook/static/1809.bundle.js +1 -1
  15. notebook/static/1827.bundle.js +1 -1
  16. notebook/static/1833.bundle.js +1 -1
  17. notebook/static/1835.bundle.js +1 -1
  18. notebook/static/1950.bundle.js +1 -1
  19. notebook/static/1958.bundle.js +1 -1
  20. notebook/static/2007.bundle.js +1 -1
  21. notebook/static/2067.bundle.js +1 -1
  22. notebook/static/2088.bundle.js +1 -1
  23. notebook/static/2089.bundle.js +1 -1
  24. notebook/static/2122.bundle.js +1 -1
  25. notebook/static/2167.bundle.js +1 -1
  26. notebook/static/2184.bundle.js +1 -1
  27. notebook/static/2251.bundle.js +1 -1
  28. notebook/static/2311.bundle.js +1 -1
  29. notebook/static/2323.bundle.js +1 -1
  30. notebook/static/2330.bundle.js +1 -1
  31. notebook/static/2401.bundle.js +1 -1
  32. notebook/static/2479.bundle.js +1 -0
  33. notebook/static/2512.bundle.js +1 -1
  34. notebook/static/2607.bundle.js +1 -1
  35. notebook/static/2913.bundle.js +1 -1
  36. notebook/static/2924.bundle.js +1 -1
  37. notebook/static/2955.bundle.js +1 -0
  38. notebook/static/2979.bundle.js +1 -1
  39. notebook/static/3146.bundle.js +1 -1
  40. notebook/static/3213.bundle.js +1 -1
  41. notebook/static/3340.bundle.js +1 -1
  42. notebook/static/3360.bundle.js +1 -1
  43. notebook/static/3466.bundle.js +1 -1
  44. notebook/static/35.bundle.js +1 -1
  45. notebook/static/3676.bundle.js +1 -1
  46. notebook/static/3680.bundle.js +1 -1
  47. notebook/static/3768.bundle.js +1 -1
  48. notebook/static/377.bundle.js +1 -1
  49. notebook/static/3797.bundle.js +1 -1
  50. notebook/static/3863.bundle.js +1 -1
  51. notebook/static/3881.bundle.js +1 -1
  52. notebook/static/4042.bundle.js +1 -0
  53. notebook/static/4131.bundle.js +1 -1
  54. notebook/static/4205.bundle.js +1 -1
  55. notebook/static/4212.bundle.js +1 -1
  56. notebook/static/4234.bundle.js +1 -1
  57. notebook/static/4382.bundle.js +1 -1
  58. notebook/static/4558.bundle.js +1 -1
  59. notebook/static/4645.bundle.js +1 -1
  60. notebook/static/4746.bundle.js +1 -0
  61. notebook/static/4785.bundle.js +1 -1
  62. notebook/static/4810.bundle.js +1 -1
  63. notebook/static/4811.bundle.js +1 -1
  64. notebook/static/4837.bundle.js +1 -0
  65. notebook/static/5016.bundle.js +1 -1
  66. notebook/static/5088.bundle.js +1 -1
  67. notebook/static/5099.bundle.js +1 -1
  68. notebook/static/5125.bundle.js +2 -0
  69. notebook/static/5135.bundle.js +1 -1
  70. notebook/static/5261.bundle.js +1 -0
  71. notebook/static/5313.bundle.js +1 -1
  72. notebook/static/5325.bundle.js +1 -1
  73. notebook/static/5346.bundle.js +1 -1
  74. notebook/static/5426.bundle.js +1 -1
  75. notebook/static/5573.bundle.js +1 -1
  76. notebook/static/5601.bundle.js +1 -1
  77. notebook/static/5678.bundle.js +1 -1
  78. notebook/static/5733.bundle.js +1 -1
  79. notebook/static/5765.bundle.js +1 -1
  80. notebook/static/5777.bundle.js +1 -1
  81. notebook/static/5828.bundle.js +1 -1
  82. notebook/static/5912.bundle.js +1 -1
  83. notebook/static/5921.bundle.js +1 -1
  84. notebook/static/6017.bundle.js +1 -1
  85. notebook/static/6027.bundle.js +1 -1
  86. notebook/static/6139.bundle.js +1 -1
  87. notebook/static/62.bundle.js +1 -1
  88. notebook/static/6256.bundle.js +1 -1
  89. notebook/static/6271.bundle.js +1 -1
  90. notebook/static/6345.bundle.js +1 -1
  91. notebook/static/6604.bundle.js +1 -1
  92. notebook/static/6621.bundle.js +1 -1
  93. notebook/static/6627.bundle.js +1 -1
  94. notebook/static/6774.bundle.js +1 -0
  95. notebook/static/6815.bundle.js +1 -1
  96. notebook/static/6853.bundle.js +1 -1
  97. notebook/static/6893.bundle.js +1 -1
  98. notebook/static/690.bundle.js +1 -0
  99. notebook/static/6919.bundle.js +3 -3
  100. notebook/static/6962.bundle.js +1 -1
  101. notebook/static/6999.bundle.js +1 -1
  102. notebook/static/7226.bundle.js +1 -1
  103. notebook/static/7252.bundle.js +1 -0
  104. notebook/static/7302.bundle.js +1 -1
  105. notebook/static/7369.bundle.js +1 -1
  106. notebook/static/7386.bundle.js +1 -1
  107. notebook/static/7391.bundle.js +1 -1
  108. notebook/static/7394.bundle.js +1 -1
  109. notebook/static/7427.bundle.js +1 -0
  110. notebook/static/7439.bundle.js +1 -1
  111. notebook/static/7450.bundle.js +1 -1
  112. notebook/static/7603.bundle.js +1 -1
  113. notebook/static/7639.bundle.js +1 -1
  114. notebook/static/7679.bundle.js +1 -0
  115. notebook/static/7684.bundle.js +1 -1
  116. notebook/static/7819.bundle.js +1 -1
  117. notebook/static/7900.bundle.js +1 -0
  118. notebook/static/7906.bundle.js +1 -1
  119. notebook/static/7957.bundle.js +1 -1
  120. notebook/static/7997.bundle.js +1 -1
  121. notebook/static/8010.bundle.js +1 -1
  122. notebook/static/8136.bundle.js +1 -1
  123. notebook/static/8578.bundle.js +1 -1
  124. notebook/static/8579.bundle.js +1 -1
  125. notebook/static/8633.bundle.js +1 -1
  126. notebook/static/8771.bundle.js +1 -1
  127. notebook/static/880.bundle.js +1 -1
  128. notebook/static/8845.bundle.js +1 -1
  129. notebook/static/8845.bundle.js.LICENSE.txt +2 -2
  130. notebook/static/8875.bundle.js +1 -1
  131. notebook/static/8907.bundle.js +1 -1
  132. notebook/static/8914.bundle.js +1 -1
  133. notebook/static/8928.bundle.js +1 -0
  134. notebook/static/893.bundle.js +1 -1
  135. notebook/static/901.bundle.js +1 -1
  136. notebook/static/9068.bundle.js +1 -1
  137. notebook/static/9086.bundle.js +1 -1
  138. notebook/static/9151.bundle.js +1 -1
  139. notebook/static/9268.bundle.js +1 -1
  140. notebook/static/9335.bundle.js +1 -1
  141. notebook/static/9341.bundle.js +1 -1
  142. notebook/static/9380.bundle.js +1 -1
  143. notebook/static/9605.bundle.js +1 -1
  144. notebook/static/9609.bundle.js +1 -1
  145. notebook/static/9638.bundle.js +1 -1
  146. notebook/static/9680.bundle.js +1 -0
  147. notebook/static/9685.bundle.js +1 -0
  148. notebook/static/9752.bundle.js +1 -1
  149. notebook/static/9799.bundle.js +1 -1
  150. notebook/static/9852.bundle.js +1 -1
  151. notebook/static/9854.bundle.js +2 -0
  152. notebook/static/bundle.js +1 -1
  153. notebook/static/third-party-licenses.json +151 -127
  154. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +14 -14
  155. notebook-7.0.0rc0.data/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +34 -0
  156. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +4 -4
  157. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
  158. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +9 -9
  159. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +15 -15
  160. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +11 -11
  161. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +10 -10
  162. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.a7e9e50b675118021681.js → notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.1b31bd587bea2c1816b1.js +1 -1
  163. notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/7.d4d2f899a93808dccf3d.js +1 -0
  164. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.2aa8888b3e6b5670842f.js → notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.a832439d17633285a072.js +1 -1
  165. notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.b00379f3c5b2b5eb657f.js +1 -0
  166. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
  167. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/METADATA +2 -2
  168. notebook-7.0.0rc0.dist-info/RECORD +389 -0
  169. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/WHEEL +1 -1
  170. notebook/static/2274.bundle.js +0 -1
  171. notebook/static/3063.bundle.js +0 -2
  172. notebook/static/3344.bundle.js +0 -1
  173. notebook/static/4190.bundle.js +0 -1
  174. notebook/static/435.bundle.js +0 -1
  175. notebook/static/4964.bundle.js +0 -1
  176. notebook/static/5282.bundle.js +0 -1
  177. notebook/static/5975.bundle.js +0 -1
  178. notebook/static/6695.bundle.js +0 -1
  179. notebook/static/771.bundle.js +0 -1
  180. notebook/static/7827.bundle.js +0 -2
  181. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/7.9bd87123f72aaa959984.js +0 -1
  182. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.ed19884b54327368a389.js +0 -1
  183. notebook-7.0.0b4.dist-info/RECORD +0 -381
  184. /notebook/static/{3063.bundle.js.LICENSE.txt → 5125.bundle.js.LICENSE.txt} +0 -0
  185. /notebook/static/{7827.bundle.js.LICENSE.txt → 9854.bundle.js.LICENSE.txt} +0 -0
  186. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
  187. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/applications/jupyter-notebook.desktop +0 -0
  188. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
  189. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
  190. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
  191. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
  192. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
  193. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
  194. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
  195. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
  196. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
  197. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
  198. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
  199. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -0
  200. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
  201. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
  202. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/776.c7baadfaddfd4518c935.js +0 -0
  203. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
  204. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/entry_points.txt +0 -0
  205. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/licenses/LICENSE +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[9609],{49609:(e,t,i)=>{i.r(t),i.d(t,{ABCWidgetFactory:()=>f,Base64ModelFactory:()=>u,Context:()=>_,DocumentModel:()=>g,DocumentRegistry:()=>M,DocumentWidget:()=>F,MimeContent:()=>x,MimeDocument:()=>C,MimeDocumentFactory:()=>T,TextModelFactory:()=>p});var s,a=i(61153),n=i(79452),o=i(18223),r=i(80259),l=i(49501),h=i(73701),d=i(47479),c=i(46947);class _{constructor(e){var t,i;this._isReady=!1,this._isDisposed=!1,this._isPopulated=!1,this._path="",this._lineEnding=null,this._contentsModel=null,this._populatedPromise=new l.PromiseDelegate,this._pathChanged=new d.Signal(this),this._fileChanged=new d.Signal(this),this._saveState=new d.Signal(this),this._disposed=new d.Signal(this),this._lastModifiedCheckMargin=500,this._timeConflictModalIsOpen=!1;const h=this._manager=e.manager;this.translator=e.translator||r.nullTranslator,this._trans=this.translator.load("jupyterlab"),this._factory=e.factory,this._dialogs=null!==(t=e.sessionDialogs)&&void 0!==t?t:new a.SessionContextDialogs({translator:e.translator}),this._opener=e.opener||s.noOp,this._path=this._manager.contents.normalize(e.path),this._lastModifiedCheckMargin=e.lastModifiedCheckMargin||500;const c=this._manager.contents.localPath(this._path),_=this._factory.preferredLanguage(n.PathExt.basename(c)),m=this._manager.contents.getSharedModelFactory(this._path),g=null==m?void 0:m.createNew({path:c,format:this._factory.fileFormat,contentType:this._factory.contentType,collaborative:this._factory.collaborative});this._model=this._factory.createNew({languagePreference:_,sharedModel:g,collaborationEnabled:null!==(i=null==m?void 0:m.collaborative)&&void 0!==i&&i}),this._readyPromise=h.ready.then((()=>this._populatedPromise.promise));const p=n.PathExt.extname(this._path);this.sessionContext=new a.SessionContext({sessionManager:h.sessions,specsManager:h.kernelspecs,path:c,type:".ipynb"===p?"notebook":"file",name:n.PathExt.basename(c),kernelPreference:e.kernelPreference||{shouldStart:!1},setBusy:e.setBusy}),this.sessionContext.propertyChanged.connect(this._onSessionChanged,this),h.contents.fileChanged.connect(this._onFileChanged,this),this.urlResolver=new o.RenderMimeRegistry.UrlResolver({path:this._path,contents:h.contents}),this.model.sharedModel.changed.connect(this.onStateChanged,this)}get pathChanged(){return this._pathChanged}get fileChanged(){return this._fileChanged}get saveState(){return this._saveState}get disposed(){return this._disposed}get lastModifiedCheckMargin(){return this._lastModifiedCheckMargin}set lastModifiedCheckMargin(e){this._lastModifiedCheckMargin=e}get model(){return this._model}get path(){return this._path}get localPath(){return this._manager.contents.localPath(this._path)}get contentsModel(){return this._contentsModel}get factoryName(){return this.isDisposed?"":this._factory.name}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this.sessionContext.dispose(),this._model.dispose(),this._model.sharedModel.dispose(),this._disposed.emit(void 0),d.Signal.clearData(this))}get isReady(){return this._isReady}get ready(){return this._readyPromise}get canSave(){var e;return!(!(null===(e=this._contentsModel)||void 0===e?void 0:e.writable)||this._model.collaborative)}async initialize(e){e?await this._save():await this._revert(),this.model.sharedModel.clearUndoHistory()}rename(e){return this.ready.then((()=>this._manager.ready.then((()=>this._rename(e)))))}async save(){await this.ready,await this._save()}async saveAs(){await this.ready;const e=this._manager.contents.localPath(this.path),t=await s.getSavePath(e);if(this.isDisposed||!t)return;const i=this._manager.contents.driveName(this.path),a=""==i?t:`${i}:${t}`;if(a===this._path)return this.save();try{await this._manager.ready,await this._manager.contents.get(a),await this._maybeOverWrite(a)}catch(e){if(!e.response||404!==e.response.status)throw e;await this._finishSaveAs(a)}}async download(){const e=await this._manager.contents.getDownloadUrl(this._path),t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t)}async revert(){await this.ready,await this._revert()}createCheckpoint(){const e=this._manager.contents;return this._manager.ready.then((()=>e.createCheckpoint(this._path)))}deleteCheckpoint(e){const t=this._manager.contents;return this._manager.ready.then((()=>t.deleteCheckpoint(this._path,e)))}restoreCheckpoint(e){const t=this._manager.contents,i=this._path;return this._manager.ready.then((()=>e?t.restoreCheckpoint(i,e):this.listCheckpoints().then((s=>{if(!this.isDisposed&&s.length)return e=s[s.length-1].id,t.restoreCheckpoint(i,e)}))))}listCheckpoints(){const e=this._manager.contents;return this._manager.ready.then((()=>e.listCheckpoints(this._path)))}addSibling(e,t={}){const i=this._opener;return i&&i(e,t),new h.DisposableDelegate((()=>{e.close()}))}onStateChanged(e,t){t.stateChange&&t.stateChange.forEach((e=>{if("path"===e.name){const t=this._manager.contents.driveName(this._path);let i=e.newValue;t&&(i=`${t}:${e.newValue}`),this._updatePath(i)}}))}_onFileChanged(e,t){var i;if("rename"!==t.type)return;let s=t.oldValue&&t.oldValue.path,a=t.newValue&&t.newValue.path;if(a&&0===this._path.indexOf(s||"")){let e=t.newValue;s!==this._path&&(a=this._path.replace(new RegExp(`^${s}/`),`${a}/`),s=this._path,e={last_modified:null===(i=t.newValue)||void 0===i?void 0:i.created,path:a}),this._updateContentsModel({...this._contentsModel,...e}),this._updatePath(a)}}_onSessionChanged(e,t){"path"===t&&this._updatePath(this.sessionContext.session.path)}_updateContentsModel(e){const t=e.writable&&!this._model.collaborative,i={path:e.path,name:e.name,type:e.type,content:void 0,writable:t,created:e.created,last_modified:e.last_modified,mimetype:e.mimetype,format:e.format},s=this._contentsModel?this._contentsModel.last_modified:null;this._contentsModel=i,this._model.sharedModel.setState("last_modified",i.last_modified),s&&i.last_modified===s||this._fileChanged.emit(i)}_updatePath(e){var t,i,s,a;if(this._path===e)return;this._path=e;const o=this._manager.contents.localPath(e),r=n.PathExt.basename(o);if((null===(t=this.sessionContext.session)||void 0===t?void 0:t.path)!==o&&(null===(i=this.sessionContext.session)||void 0===i||i.setPath(o)),(null===(s=this.sessionContext.session)||void 0===s?void 0:s.name)!==r&&(null===(a=this.sessionContext.session)||void 0===a||a.setName(r)),this.urlResolver.path!==e&&(this.urlResolver.path=e),this._contentsModel&&(this._contentsModel.path!==e||this._contentsModel.name!==r)){const t={...this._contentsModel,name:r,path:e};this._updateContentsModel(t)}this._model.sharedModel.getState("path")!==o&&this._model.sharedModel.setState("path",o),this._pathChanged.emit(e)}async _populate(){if(this._isPopulated=!0,this._isReady=!0,this._populatedPromise.resolve(void 0),await this._maybeCheckpoint(!1),this.isDisposed)return;const e=this._model.defaultKernelName||this.sessionContext.kernelPreference.name;this.sessionContext.kernelPreference={...this.sessionContext.kernelPreference,name:e,language:this._model.defaultKernelLanguage},this.sessionContext.initialize().then((e=>{e&&this._dialogs.selectKernel(this.sessionContext)}))}async _rename(e){var t,i;const s=this.localPath.split("/");s[s.length-1]=e;let a=n.PathExt.join(...s);const o=this._manager.contents.driveName(this.path);o&&(a=`${o}:${a}`),await this._manager.contents.rename(this.path,a),await(null===(t=this.sessionContext.session)||void 0===t?void 0:t.setPath(a)),await(null===(i=this.sessionContext.session)||void 0===i?void 0:i.setName(e)),this._path=a;const r=this._manager.contents.localPath(this._path);this.urlResolver.path=a,this._model.sharedModel.setState("path",r),this._pathChanged.emit(a)}async _save(){this._saveState.emit("started");const e=this._createSaveOptions();try{let t;if(await this._manager.ready,t=await this._maybeSave(e),this.isDisposed)return;this._model.dirty=!1,this._updateContentsModel(t),this._isPopulated||await this._populate(),this._saveState.emit("completed")}catch(e){const{name:t}=e;if("ModalCancelError"===t||"ModalDuplicateError"===t)throw e;const i=this._manager.contents.localPath(this._path),s=n.PathExt.basename(i);throw this._handleError(e,this._trans.__("File Save Error for %1",s)),this._saveState.emit("failed"),e}}_revert(e=!1){const t={type:this._factory.contentType,content:null!==this._factory.fileFormat,...null!==this._factory.fileFormat?{format:this._factory.fileFormat}:{}},i=this._path,s=this._model;return this._manager.ready.then((()=>this._manager.contents.get(i,t))).then((e=>{if(!this.isDisposed){if(e.content)if("json"===e.format)s.fromJSON(e.content);else{let t=e.content;-1!==t.indexOf("\r\n")?(this._lineEnding="\r\n",t=t.replace(/\r\n/g,"\n")):-1!==t.indexOf("\r")?(this._lineEnding="\r",t=t.replace(/\r/g,"\n")):this._lineEnding=null,s.fromString(t)}return this._updateContentsModel(e),s.dirty=!1,this._isPopulated?void 0:this._populate()}})).catch((async e=>{const t=this._manager.contents.localPath(this._path),i=n.PathExt.basename(t);throw this._handleError(e,this._trans.__("File Load Error for %1",i)),e}))}_maybeSave(e){const t=this._path;return this._manager.contents.get(t,{content:!1}).then((i=>{var s;if(this.isDisposed)return Promise.reject(new Error("Disposed"));const a=this._lastModifiedCheckMargin,n=this._model.sharedModel.getState("last_modified")||(null===(s=this.contentsModel)||void 0===s?void 0:s.last_modified),o=n?new Date(n):new Date,r=new Date(i.last_modified);return n&&r.getTime()-o.getTime()>a?this._timeConflict(o,i,e):this._manager.contents.save(t,e)}),(i=>{if(i.response&&404===i.response.status)return this._manager.contents.save(t,e);throw i}))}async _handleError(e,t){await(0,a.showErrorMessage)(t,e)}_maybeCheckpoint(e){let t=Promise.resolve(void 0);return this.canSave?(t=e?this.createCheckpoint().then():this.listCheckpoints().then((e=>{if(!this.isDisposed&&!e.length&&this.canSave)return this.createCheckpoint().then()})),t.catch((e=>{if(!e.response||403!==e.response.status)throw e}))):t}_timeConflict(e,t,i){const s=new Date(t.last_modified);if(console.warn(`Last saving performed ${e} while the current file seems to have been saved ${s}`),this._timeConflictModalIsOpen){const e=new Error("Modal is already displayed");return e.name="ModalDuplicateError",Promise.reject(e)}const n=this._trans.__('"%1" has changed on disk since the last time it was opened or saved.\nDo you want to overwrite the file on disk with the version open here,\nor load the version on disk (revert)?',this.path),o=a.Dialog.okButton({label:this._trans.__("Revert"),actions:["revert"]}),r=a.Dialog.warnButton({label:this._trans.__("Overwrite"),actions:["overwrite"]});return this._timeConflictModalIsOpen=!0,(0,a.showDialog)({title:this._trans.__("File Changed"),body:n,buttons:[a.Dialog.cancelButton(),o,r]}).then((e=>{if(this._timeConflictModalIsOpen=!1,this.isDisposed)return Promise.reject(new Error("Disposed"));if(e.button.actions.includes("overwrite"))return this._manager.contents.save(this._path,i);if(e.button.actions.includes("revert"))return this.revert().then((()=>t));const s=new Error("Cancel");return s.name="ModalCancelError",Promise.reject(s)}))}_maybeOverWrite(e){const t=this._trans.__('"%1" already exists. Do you want to replace it?',e),i=a.Dialog.warnButton({label:this._trans.__("Overwrite"),accept:!0});return(0,a.showDialog)({title:this._trans.__("File Overwrite?"),body:t,buttons:[a.Dialog.cancelButton(),i]}).then((t=>this.isDisposed?Promise.reject(new Error("Disposed")):t.button.accept?this._manager.contents.delete(e).then((()=>this._finishSaveAs(e))):void 0))}async _finishSaveAs(e){this._saveState.emit("started");try{await this._manager.ready;const t=this._createSaveOptions();await this._manager.contents.save(e,t),await this._maybeCheckpoint(!0),this._saveState.emit("completed")}catch(e){if("Cancel"===e.message||"Modal is already displayed"===e.message)throw e;const t=this._manager.contents.localPath(this._path),i=n.PathExt.basename(t);return this._handleError(e,this._trans.__("File Save Error for %1",i)),void this._saveState.emit("failed")}}_createSaveOptions(){let e=null;return"json"===this._factory.fileFormat?e=this._model.toJSON():(e=this._model.toString(),this._lineEnding&&(e=e.replace(/\n/g,this._lineEnding))),{type:this._factory.contentType,format:this._factory.fileFormat,content:e}}}!function(e){e.getSavePath=function(e,i){const s=(i=i||r.nullTranslator).load("jupyterlab"),n=a.Dialog.okButton({label:s.__("Save"),accept:!0});return(0,a.showDialog)({title:s.__("Save File As…"),body:new t(e),buttons:[a.Dialog.cancelButton(),n]}).then((e=>{var t;if(e.button.accept)return null!==(t=e.value)&&void 0!==t?t:void 0}))},e.noOp=function(){};class t extends c.Widget{constructor(e){super({node:i(e)})}getValue(){return this.node.value}}function i(e){const t=document.createElement("input");return t.value=e,t}}(s||(s={}));var m=i(47500);class g extends m.CodeEditor.Model{constructor(e={}){var t;super({sharedModel:e.sharedModel}),this._defaultLang="",this._dirty=!1,this._readOnly=!1,this._contentChanged=new d.Signal(this),this._stateChanged=new d.Signal(this),this._defaultLang=null!==(t=e.languagePreference)&&void 0!==t?t:"",this._collaborationEnabled=!!e.collaborationEnabled,this.sharedModel.changed.connect(this._onStateChanged,this)}get contentChanged(){return this._contentChanged}get stateChanged(){return this._stateChanged}get dirty(){return this._dirty}set dirty(e){const t=this._dirty;e!==t&&(this._dirty=e,this.triggerStateChange({name:"dirty",oldValue:t,newValue:e}))}get readOnly(){return this._readOnly}set readOnly(e){if(e===this._readOnly)return;const t=this._readOnly;this._readOnly=e,this.triggerStateChange({name:"readOnly",oldValue:t,newValue:e})}get defaultKernelName(){return""}get defaultKernelLanguage(){return this._defaultLang}get collaborative(){return this._collaborationEnabled}toString(){return this.sharedModel.getSource()}fromString(e){this.sharedModel.setSource(e)}toJSON(){return JSON.parse(this.sharedModel.getSource()||"null")}fromJSON(e){this.fromString(JSON.stringify(e))}initialize(){}triggerStateChange(e){this._stateChanged.emit(e)}triggerContentChange(){this._contentChanged.emit(void 0),this.dirty=!0}_onStateChanged(e,t){t.sourceChange&&this.triggerContentChange(),t.stateChange&&t.stateChange.forEach((e=>{"dirty"===e.name?this.dirty=e.newValue:e.oldValue!==e.newValue&&this.triggerStateChange({newValue:void 0,oldValue:void 0,...e})}))}}class p{constructor(e){this._isDisposed=!1,this._collaborative=null==e||e}get name(){return"text"}get contentType(){return"file"}get fileFormat(){return"text"}get collaborative(){return this._collaborative}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed=!0}createNew(e={}){const t=e.collaborationEnabled&&this.collaborative;return new g({...e,collaborationEnabled:t})}preferredLanguage(e){return""}}class u extends p{get name(){return"base64"}get contentType(){return"file"}get fileFormat(){return"base64"}}class f{constructor(e){this._isDisposed=!1,this._widgetCreated=new d.Signal(this),this._translator=e.translator||r.nullTranslator,this._name=e.name,this._label=e.label||e.name,this._readOnly=void 0!==e.readOnly&&e.readOnly,this._defaultFor=e.defaultFor?e.defaultFor.slice():[],this._defaultRendered=(e.defaultRendered||[]).slice(),this._fileTypes=e.fileTypes.slice(),this._modelName=e.modelName||"text",this._preferKernel=!!e.preferKernel,this._canStartKernel=!!e.canStartKernel,this._shutdownOnClose=!!e.shutdownOnClose,this._autoStartDefault=!!e.autoStartDefault,this._toolbarFactory=e.toolbarFactory}get widgetCreated(){return this._widgetCreated}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,d.Signal.clearData(this))}get readOnly(){return this._readOnly}get name(){return this._name}get label(){return this._label}get fileTypes(){return this._fileTypes.slice()}get modelName(){return this._modelName}get defaultFor(){return this._defaultFor.slice()}get defaultRendered(){return this._defaultRendered.slice()}get preferKernel(){return this._preferKernel}get canStartKernel(){return this._canStartKernel}get translator(){return this._translator}get shutdownOnClose(){return this._shutdownOnClose}set shutdownOnClose(e){this._shutdownOnClose=e}get autoStartDefault(){return this._autoStartDefault}set autoStartDefault(e){this._autoStartDefault=e}createNew(e,t){var i;const s=this.createNewWidget(e,t);return(0,a.setToolbar)(s,null!==(i=this._toolbarFactory)&&void 0!==i?i:this.defaultToolbarFactory.bind(this)),this._widgetCreated.emit(s),s}defaultToolbarFactory(e){return[]}}const y="jp-mod-dirty";class F extends a.MainAreaWidget{constructor(e){e.reveal=Promise.all([e.reveal,e.context.ready]),super(e),this.context=e.context,this.context.pathChanged.connect(this._onPathChanged,this),this._onPathChanged(this.context,this.context.path),this.context.model.stateChanged.connect(this._onModelStateChanged,this),this.context.ready.then((()=>{this._handleDirtyState()})),this.title.changed.connect(this._onTitleChanged,this)}setFragment(e){}async _onTitleChanged(e){const t=this.title.label,i=this.context.localPath.split("/").pop()||this.context.localPath;if(t!==i){if(t.length>0&&!/[\/\\:]/.test(t)){const e=this.context.path;if(await this.context.rename(t),this.context.path!==e)return}this.title.label=i}}_onPathChanged(e,t){this.title.label=n.PathExt.basename(e.localPath),this.isUntitled=!1}_onModelStateChanged(e,t){"dirty"===t.name&&this._handleDirtyState()}_handleDirtyState(){this.context.model.dirty&&!this.title.className.includes(y)?this.title.className+=` ${y}`:this.title.className=this.title.className.replace(y,"")}}var w,v=i(30807);class x extends c.Widget{constructor(e){super(),this._changeCallback=e=>{if(!e.data||!e.data[this.mimeType])return;const t=e.data[this.mimeType];"string"==typeof t?t!==this._context.model.toString()&&this._context.model.fromString(t):null==t||l.JSONExt.deepEqual(t,this._context.model.toJSON())||this._context.model.fromJSON(t)},this._fragment="",this._ready=new l.PromiseDelegate,this._isRendering=!1,this._renderRequested=!1,this.addClass("jp-MimeDocument"),this.translator=e.translator||r.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.mimeType=e.mimeType,this._dataType=e.dataType||"string",this._context=e.context,this.renderer=e.renderer,(this.layout=new c.StackedLayout).addWidget(this.renderer),this._context.ready.then((()=>this._render())).then((()=>{this.node===document.activeElement&&v.MessageLoop.sendMessage(this.renderer,c.Widget.Msg.ActivateRequest),this._monitor=new n.ActivityMonitor({signal:this._context.model.contentChanged,timeout:e.renderTimeout}),this._monitor.activityStopped.connect(this.update,this),this._ready.resolve(void 0)})).catch((e=>{requestAnimationFrame((()=>{this.dispose()})),(0,a.showErrorMessage)(this._trans.__("Renderer Failure: %1",this._context.path),e)}))}[a.Printing.symbol](){return a.Printing.getPrintFunction(this.renderer)}get ready(){return this._ready.promise}setFragment(e){this._fragment=e,this.update()}dispose(){this.isDisposed||(this._monitor&&this._monitor.dispose(),this._monitor=null,super.dispose())}onUpdateRequest(e){this._context.isReady&&(this._render(),this._fragment="")}async _render(){if(this.isDisposed)return;if(this._isRendering)return void(this._renderRequested=!0);this._renderRequested=!1;const e=this._context,t=e.model,i={};"string"===this._dataType?i[this.mimeType]=t.toString():i[this.mimeType]=t.toJSON();const s=new o.MimeModel({data:i,callback:this._changeCallback,metadata:{fragment:this._fragment}});try{if(this._isRendering=!0,await this.renderer.renderModel(s),this._isRendering=!1,this._renderRequested)return this._render()}catch(t){requestAnimationFrame((()=>{this.dispose()})),(0,a.showErrorMessage)(this._trans.__("Renderer Failure: %1",e.path),t)}}}class C extends F{setFragment(e){this.content.setFragment(e)}}class T extends f{constructor(e){super(w.createRegistryOptions(e)),this._rendermime=e.rendermime,this._renderTimeout=e.renderTimeout||1e3,this._dataType=e.dataType||"string",this._fileType=e.primaryFileType,this._factory=e.factory}createNewWidget(e){var t,i;const s=this._fileType,a=(null==s?void 0:s.mimeTypes.length)?s.mimeTypes[0]:"text/plain",n=this._rendermime.clone({resolver:e.urlResolver});let o;o=this._factory&&this._factory.mimeTypes.includes(a)?this._factory.createRenderer({mimeType:a,resolver:n.resolver,sanitizer:n.sanitizer,linkHandler:n.linkHandler,latexTypesetter:n.latexTypesetter,markdownParser:n.markdownParser}):n.createRenderer(a);const r=new x({context:e,renderer:o,mimeType:a,renderTimeout:this._renderTimeout,dataType:this._dataType});return r.title.icon=null==s?void 0:s.icon,r.title.iconClass=null!==(t=null==s?void 0:s.iconClass)&&void 0!==t?t:"",r.title.iconLabel=null!==(i=null==s?void 0:s.iconLabel)&&void 0!==i?i:"",new C({content:r,context:e})}}!function(e){e.createRegistryOptions=function(e){return{...e,readOnly:!0}}}(w||(w={}));var b,D=i(9768),S=i(20882);class M{constructor(e={}){this._modelFactories=Object.create(null),this._widgetFactories=Object.create(null),this._defaultWidgetFactory="",this._defaultWidgetFactoryOverrides=Object.create(null),this._defaultWidgetFactories=Object.create(null),this._defaultRenderedWidgetFactories=Object.create(null),this._widgetFactoriesForFileType=Object.create(null),this._fileTypes=[],this._extenders=Object.create(null),this._changed=new d.Signal(this),this._isDisposed=!1;const t=e.textModelFactory;if(this.translator=e.translator||r.nullTranslator,t&&"text"!==t.name)throw new Error("Text model factory must have the name `text`");this._modelFactories.text=t||new p(!0),(e.initialFileTypes||M.getDefaultFileTypes(this.translator)).forEach((e=>{const t={...M.getFileTypeDefaults(this.translator),...e};this._fileTypes.push(t)}))}get changed(){return this._changed}get isDisposed(){return this._isDisposed}dispose(){if(!this.isDisposed){this._isDisposed=!0;for(const e in this._modelFactories)this._modelFactories[e].dispose();for(const e in this._widgetFactories)this._widgetFactories[e].dispose();for(const e in this._extenders)this._extenders[e].length=0;this._fileTypes.length=0,d.Signal.clearData(this)}}addWidgetFactory(e){const t=e.name.toLowerCase();if(!t||"default"===t)throw Error("Invalid factory name");if(this._widgetFactories[t])return console.warn(`Duplicate registered factory ${t}`),new h.DisposableDelegate(b.noOp);this._widgetFactories[t]=e;for(const i of e.defaultFor||[])-1!==e.fileTypes.indexOf(i)&&("*"===i?this._defaultWidgetFactory=t:this._defaultWidgetFactories[i]=t);for(const i of e.defaultRendered||[])-1!==e.fileTypes.indexOf(i)&&(this._defaultRenderedWidgetFactories[i]=t);for(const i of e.fileTypes)this._widgetFactoriesForFileType[i]||(this._widgetFactoriesForFileType[i]=[]),this._widgetFactoriesForFileType[i].push(t);return this._changed.emit({type:"widgetFactory",name:t,change:"added"}),new h.DisposableDelegate((()=>{delete this._widgetFactories[t],this._defaultWidgetFactory===t&&(this._defaultWidgetFactory="");for(const e of Object.keys(this._defaultWidgetFactories))this._defaultWidgetFactories[e]===t&&delete this._defaultWidgetFactories[e];for(const e of Object.keys(this._defaultRenderedWidgetFactories))this._defaultRenderedWidgetFactories[e]===t&&delete this._defaultRenderedWidgetFactories[e];for(const e of Object.keys(this._widgetFactoriesForFileType))S.ArrayExt.removeFirstOf(this._widgetFactoriesForFileType[e],t),0===this._widgetFactoriesForFileType[e].length&&delete this._widgetFactoriesForFileType[e];for(const e of Object.keys(this._defaultWidgetFactoryOverrides))this._defaultWidgetFactoryOverrides[e]===t&&delete this._defaultWidgetFactoryOverrides[e];this._changed.emit({type:"widgetFactory",name:t,change:"removed"})}))}addModelFactory(e){const t=e.name.toLowerCase();return this._modelFactories[t]?(console.warn(`Duplicate registered factory ${t}`),new h.DisposableDelegate(b.noOp)):(this._modelFactories[t]=e,this._changed.emit({type:"modelFactory",name:t,change:"added"}),new h.DisposableDelegate((()=>{delete this._modelFactories[t],this._changed.emit({type:"modelFactory",name:t,change:"removed"})})))}addWidgetExtension(e,t){(e=e.toLowerCase())in this._extenders||(this._extenders[e]=[]);const i=this._extenders[e];return-1!==S.ArrayExt.firstIndexOf(i,t)?(console.warn(`Duplicate registered extension for ${e}`),new h.DisposableDelegate(b.noOp)):(this._extenders[e].push(t),this._changed.emit({type:"widgetExtension",name:e,change:"added"}),new h.DisposableDelegate((()=>{S.ArrayExt.removeFirstOf(this._extenders[e],t),this._changed.emit({type:"widgetExtension",name:e,change:"removed"})})))}addFileType(e,t){const i={...M.getFileTypeDefaults(this.translator),...e,...!(e.icon||e.iconClass)&&{icon:D.fileIcon}};if(this._fileTypes.push(i),t){const e=i.name.toLowerCase();t.map((e=>e.toLowerCase())).forEach((t=>{this._widgetFactoriesForFileType[e]||(this._widgetFactoriesForFileType[e]=[]),this._widgetFactoriesForFileType[e].includes(t)||this._widgetFactoriesForFileType[e].push(t)})),this._defaultWidgetFactories[e]||(this._defaultWidgetFactories[e]=this._widgetFactoriesForFileType[e][0])}return this._changed.emit({type:"fileType",name:i.name,change:"added"}),new h.DisposableDelegate((()=>{if(S.ArrayExt.removeFirstOf(this._fileTypes,i),t){const e=i.name.toLowerCase();for(const i of t.map((e=>e.toLowerCase())))S.ArrayExt.removeFirstOf(this._widgetFactoriesForFileType[e],i);this._defaultWidgetFactories[e]===t[0].toLowerCase()&&delete this._defaultWidgetFactories[e]}this._changed.emit({type:"fileType",name:e.name,change:"removed"})}))}preferredWidgetFactories(e){const t=new Set,i=this.getFileTypesForPath(n.PathExt.basename(e));i.forEach((e=>{e.name in this._defaultWidgetFactoryOverrides&&t.add(this._defaultWidgetFactoryOverrides[e.name])})),i.forEach((e=>{e.name in this._defaultWidgetFactories&&t.add(this._defaultWidgetFactories[e.name])})),i.forEach((e=>{e.name in this._defaultRenderedWidgetFactories&&t.add(this._defaultRenderedWidgetFactories[e.name])})),this._defaultWidgetFactory&&t.add(this._defaultWidgetFactory);for(const e of i)if(e.name in this._widgetFactoriesForFileType)for(const i of this._widgetFactoriesForFileType[e.name])t.add(i);if("*"in this._widgetFactoriesForFileType)for(const e of this._widgetFactoriesForFileType["*"])t.add(e);const s=[];for(const e of t){const t=this._widgetFactories[e];t&&((t.modelName||"text")in this._modelFactories&&s.push(t))}return s}defaultRenderedWidgetFactory(e){const t=this.getFileTypesForPath(n.PathExt.basename(e)).map((e=>e.name));for(const e in t)if(e in this._defaultWidgetFactoryOverrides)return this._widgetFactories[this._defaultWidgetFactoryOverrides[e]];for(const e in t)if(e in this._defaultRenderedWidgetFactories)return this._widgetFactories[this._defaultRenderedWidgetFactories[e]];return this.defaultWidgetFactory(e)}defaultWidgetFactory(e){return e?this.preferredWidgetFactories(e)[0]:this._widgetFactories[this._defaultWidgetFactory]}setDefaultWidgetFactory(e,t){if(e=e.toLowerCase(),!this.getFileType(e))throw Error(`Cannot find file type ${e}`);if(!t)return void(this._defaultWidgetFactoryOverrides[e]&&delete this._defaultWidgetFactoryOverrides[e]);if(!this.getWidgetFactory(t))throw Error(`Cannot find widget factory ${t}`);t=t.toLowerCase();const i=this._widgetFactoriesForFileType[e];if(!(t===this._defaultWidgetFactory||i&&i.includes(t)))throw Error(`Factory ${t} cannot view file type ${e}`);this._defaultWidgetFactoryOverrides[e]=t}*widgetFactories(){for(const e in this._widgetFactories)yield this._widgetFactories[e]}*modelFactories(){for(const e in this._modelFactories)yield this._modelFactories[e]}*widgetExtensions(e){if((e=e.toLowerCase())in this._extenders)for(const t of this._extenders[e])yield t}*fileTypes(){for(const e of this._fileTypes)yield e}getWidgetFactory(e){return this._widgetFactories[e.toLowerCase()]}getModelFactory(e){return this._modelFactories[e.toLowerCase()]}getFileType(e){return e=e.toLowerCase(),(0,S.find)(this._fileTypes,(t=>t.name.toLowerCase()===e))}getKernelPreference(e,t,i){t=t.toLowerCase();const s=this._widgetFactories[t];if(!s)return;const a=this.getModelFactory(s.modelName||"text");if(!a)return;const o=a.preferredLanguage(n.PathExt.basename(e)),r=i&&i.name;return{id:i&&i.id,name:r,language:o,shouldStart:s.preferKernel,canStart:s.canStartKernel,shutdownOnDispose:s.shutdownOnClose,autoStartDefault:s.autoStartDefault}}getFileTypeForModel(e){switch(e.type){case"directory":return(0,S.find)(this._fileTypes,(e=>"directory"===e.contentType))||M.getDefaultDirectoryFileType(this.translator);case"notebook":return(0,S.find)(this._fileTypes,(e=>"notebook"===e.contentType))||M.getDefaultNotebookFileType(this.translator);default:if(e.name||e.path){const t=e.name||n.PathExt.basename(e.path),i=this.getFileTypesForPath(t);if(i.length>0)return i[0]}return this.getFileType("text")||M.getDefaultTextFileType(this.translator)}}getFileTypesForPath(e){const t=[],i=n.PathExt.basename(e);let s=(0,S.find)(this._fileTypes,(e=>!(!e.pattern||null===i.match(e.pattern))));s&&t.push(s);let a=b.extname(i);for(;a.length>1;){const e=this._fileTypes.filter((e=>e.extensions.map((e=>e.toLowerCase())).includes(a)));t.push(...e),a="."+a.split(".").slice(2).join(".")}return t}}!function(e){function t(e){return{name:"default",displayName:(null==(e=e||r.nullTranslator)?void 0:e.load("jupyterlab")).__("default"),extensions:[],mimeTypes:[],contentType:"file",fileFormat:"text"}}function i(e){const i=null==(e=e||r.nullTranslator)?void 0:e.load("jupyterlab");return{...t(e),name:"text",displayName:i.__("Text"),mimeTypes:["text/plain"],extensions:[".txt"],icon:D.fileIcon}}function s(e){const i=null==(e=e||r.nullTranslator)?void 0:e.load("jupyterlab");return{...t(e),name:"notebook",displayName:i.__("Notebook"),mimeTypes:["application/x-ipynb+json"],extensions:[".ipynb"],contentType:"notebook",fileFormat:"json",icon:D.notebookIcon}}function a(e){const i=null==(e=e||r.nullTranslator)?void 0:e.load("jupyterlab");return{...t(e),name:"directory",displayName:i.__("Directory"),extensions:[],mimeTypes:["text/directory"],contentType:"directory",icon:D.folderIcon}}e.getFileTypeDefaults=t,e.getDefaultTextFileType=i,e.getDefaultNotebookFileType=s,e.getDefaultDirectoryFileType=a,e.getDefaultFileTypes=function(e){const t=null==(e=e||r.nullTranslator)?void 0:e.load("jupyterlab");return[i(e),s(e),a(e),{name:"markdown",displayName:t.__("Markdown File"),extensions:[".md"],mimeTypes:["text/markdown"],icon:D.markdownIcon},{name:"PDF",displayName:t.__("PDF File"),extensions:[".pdf"],mimeTypes:["application/pdf"],icon:D.pdfIcon},{name:"python",displayName:t.__("Python File"),extensions:[".py"],mimeTypes:["text/x-python"],icon:D.pythonIcon},{name:"json",displayName:t.__("JSON File"),extensions:[".json"],mimeTypes:["application/json"],icon:D.jsonIcon},{name:"julia",displayName:t.__("Julia File"),extensions:[".jl"],mimeTypes:["text/x-julia"],icon:D.juliaIcon},{name:"csv",displayName:t.__("CSV File"),extensions:[".csv"],mimeTypes:["text/csv"],icon:D.spreadsheetIcon},{name:"tsv",displayName:t.__("TSV File"),extensions:[".tsv"],mimeTypes:["text/csv"],icon:D.spreadsheetIcon},{name:"r",displayName:t.__("R File"),mimeTypes:["text/x-rsrc"],extensions:[".R"],icon:D.rKernelIcon},{name:"yaml",displayName:t.__("YAML File"),mimeTypes:["text/x-yaml","text/yaml"],extensions:[".yaml",".yml"],icon:D.yamlIcon},{name:"svg",displayName:t.__("Image"),mimeTypes:["image/svg+xml"],extensions:[".svg"],icon:D.imageIcon,fileFormat:"base64"},{name:"tiff",displayName:t.__("Image"),mimeTypes:["image/tiff"],extensions:[".tif",".tiff"],icon:D.imageIcon,fileFormat:"base64"},{name:"jpeg",displayName:t.__("Image"),mimeTypes:["image/jpeg"],extensions:[".jpg",".jpeg"],icon:D.imageIcon,fileFormat:"base64"},{name:"gif",displayName:t.__("Image"),mimeTypes:["image/gif"],extensions:[".gif"],icon:D.imageIcon,fileFormat:"base64"},{name:"png",displayName:t.__("Image"),mimeTypes:["image/png"],extensions:[".png"],icon:D.imageIcon,fileFormat:"base64"},{name:"bmp",displayName:t.__("Image"),mimeTypes:["image/bmp"],extensions:[".bmp"],icon:D.imageIcon,fileFormat:"base64"},{name:"webp",displayName:t.__("Image"),mimeTypes:["image/webp"],extensions:[".webp"],icon:D.imageIcon,fileFormat:"base64"}]}}(M||(M={})),function(e){e.extname=function(e){const t=n.PathExt.basename(e).split(".");return t.shift(),("."+t.join(".")).toLowerCase()},e.noOp=function(){}}(b||(b={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[9609],{49609:(e,t,i)=>{i.r(t),i.d(t,{ABCWidgetFactory:()=>f,Base64ModelFactory:()=>u,Context:()=>_,DocumentModel:()=>g,DocumentRegistry:()=>M,DocumentWidget:()=>F,MimeContent:()=>x,MimeDocument:()=>C,MimeDocumentFactory:()=>T,TextModelFactory:()=>p});var s,a=i(25314),n=i(8630),o=i(18932),r=i(6614),l=i(49501),h=i(73701),d=i(47479),c=i(46947);class _{constructor(e){var t,i;this._isReady=!1,this._isDisposed=!1,this._isPopulated=!1,this._path="",this._lineEnding=null,this._contentsModel=null,this._populatedPromise=new l.PromiseDelegate,this._pathChanged=new d.Signal(this),this._fileChanged=new d.Signal(this),this._saveState=new d.Signal(this),this._disposed=new d.Signal(this),this._lastModifiedCheckMargin=500,this._timeConflictModalIsOpen=!1;const h=this._manager=e.manager;this.translator=e.translator||r.nullTranslator,this._trans=this.translator.load("jupyterlab"),this._factory=e.factory,this._dialogs=null!==(t=e.sessionDialogs)&&void 0!==t?t:new a.SessionContextDialogs({translator:e.translator}),this._opener=e.opener||s.noOp,this._path=this._manager.contents.normalize(e.path),this._lastModifiedCheckMargin=e.lastModifiedCheckMargin||500;const c=this._manager.contents.localPath(this._path),_=this._factory.preferredLanguage(n.PathExt.basename(c)),m=this._manager.contents.getSharedModelFactory(this._path),g=null==m?void 0:m.createNew({path:c,format:this._factory.fileFormat,contentType:this._factory.contentType,collaborative:this._factory.collaborative});this._model=this._factory.createNew({languagePreference:_,sharedModel:g,collaborationEnabled:null!==(i=null==m?void 0:m.collaborative)&&void 0!==i&&i}),this._readyPromise=h.ready.then((()=>this._populatedPromise.promise));const p=n.PathExt.extname(this._path);this.sessionContext=new a.SessionContext({sessionManager:h.sessions,specsManager:h.kernelspecs,path:c,type:".ipynb"===p?"notebook":"file",name:n.PathExt.basename(c),kernelPreference:e.kernelPreference||{shouldStart:!1},setBusy:e.setBusy}),this.sessionContext.propertyChanged.connect(this._onSessionChanged,this),h.contents.fileChanged.connect(this._onFileChanged,this),this.urlResolver=new o.RenderMimeRegistry.UrlResolver({path:this._path,contents:h.contents}),this.model.sharedModel.changed.connect(this.onStateChanged,this)}get pathChanged(){return this._pathChanged}get fileChanged(){return this._fileChanged}get saveState(){return this._saveState}get disposed(){return this._disposed}get lastModifiedCheckMargin(){return this._lastModifiedCheckMargin}set lastModifiedCheckMargin(e){this._lastModifiedCheckMargin=e}get model(){return this._model}get path(){return this._path}get localPath(){return this._manager.contents.localPath(this._path)}get contentsModel(){return this._contentsModel}get factoryName(){return this.isDisposed?"":this._factory.name}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this.sessionContext.dispose(),this._model.dispose(),this._model.sharedModel.dispose(),this._disposed.emit(void 0),d.Signal.clearData(this))}get isReady(){return this._isReady}get ready(){return this._readyPromise}get canSave(){var e;return!(!(null===(e=this._contentsModel)||void 0===e?void 0:e.writable)||this._model.collaborative)}async initialize(e){e?await this._save():await this._revert(),this.model.sharedModel.clearUndoHistory()}rename(e){return this.ready.then((()=>this._manager.ready.then((()=>this._rename(e)))))}async save(){await this.ready,await this._save()}async saveAs(){await this.ready;const e=this._manager.contents.localPath(this.path),t=await s.getSavePath(e);if(this.isDisposed||!t)return;const i=this._manager.contents.driveName(this.path),a=""==i?t:`${i}:${t}`;if(a===this._path)return this.save();try{await this._manager.ready,await this._manager.contents.get(a),await this._maybeOverWrite(a)}catch(e){if(!e.response||404!==e.response.status)throw e;await this._finishSaveAs(a)}}async download(){const e=await this._manager.contents.getDownloadUrl(this._path),t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t)}async revert(){await this.ready,await this._revert()}createCheckpoint(){const e=this._manager.contents;return this._manager.ready.then((()=>e.createCheckpoint(this._path)))}deleteCheckpoint(e){const t=this._manager.contents;return this._manager.ready.then((()=>t.deleteCheckpoint(this._path,e)))}restoreCheckpoint(e){const t=this._manager.contents,i=this._path;return this._manager.ready.then((()=>e?t.restoreCheckpoint(i,e):this.listCheckpoints().then((s=>{if(!this.isDisposed&&s.length)return e=s[s.length-1].id,t.restoreCheckpoint(i,e)}))))}listCheckpoints(){const e=this._manager.contents;return this._manager.ready.then((()=>e.listCheckpoints(this._path)))}addSibling(e,t={}){const i=this._opener;return i&&i(e,t),new h.DisposableDelegate((()=>{e.close()}))}onStateChanged(e,t){t.stateChange&&t.stateChange.forEach((e=>{if("path"===e.name){const t=this._manager.contents.driveName(this._path);let i=e.newValue;t&&(i=`${t}:${e.newValue}`),this._updatePath(i)}}))}_onFileChanged(e,t){var i;if("rename"!==t.type)return;let s=t.oldValue&&t.oldValue.path,a=t.newValue&&t.newValue.path;if(a&&0===this._path.indexOf(s||"")){let e=t.newValue;s!==this._path&&(a=this._path.replace(new RegExp(`^${s}/`),`${a}/`),s=this._path,e={last_modified:null===(i=t.newValue)||void 0===i?void 0:i.created,path:a}),this._updateContentsModel({...this._contentsModel,...e}),this._updatePath(a)}}_onSessionChanged(e,t){"path"===t&&this._updatePath(this.sessionContext.session.path)}_updateContentsModel(e){const t=e.writable&&!this._model.collaborative,i={path:e.path,name:e.name,type:e.type,content:void 0,writable:t,created:e.created,last_modified:e.last_modified,mimetype:e.mimetype,format:e.format},s=this._contentsModel?this._contentsModel.last_modified:null;this._contentsModel=i,this._model.sharedModel.setState("last_modified",i.last_modified),s&&i.last_modified===s||this._fileChanged.emit(i)}_updatePath(e){var t,i,s,a;if(this._path===e)return;this._path=e;const o=this._manager.contents.localPath(e),r=n.PathExt.basename(o);if((null===(t=this.sessionContext.session)||void 0===t?void 0:t.path)!==o&&(null===(i=this.sessionContext.session)||void 0===i||i.setPath(o)),(null===(s=this.sessionContext.session)||void 0===s?void 0:s.name)!==r&&(null===(a=this.sessionContext.session)||void 0===a||a.setName(r)),this.urlResolver.path!==e&&(this.urlResolver.path=e),this._contentsModel&&(this._contentsModel.path!==e||this._contentsModel.name!==r)){const t={...this._contentsModel,name:r,path:e};this._updateContentsModel(t)}this._model.sharedModel.getState("path")!==o&&this._model.sharedModel.setState("path",o),this._pathChanged.emit(e)}async _populate(){if(this._isPopulated=!0,this._isReady=!0,this._populatedPromise.resolve(void 0),await this._maybeCheckpoint(!1),this.isDisposed)return;const e=this._model.defaultKernelName||this.sessionContext.kernelPreference.name;this.sessionContext.kernelPreference={...this.sessionContext.kernelPreference,name:e,language:this._model.defaultKernelLanguage},this.sessionContext.initialize().then((e=>{e&&this._dialogs.selectKernel(this.sessionContext)}))}async _rename(e){var t,i;const s=this.localPath.split("/");s[s.length-1]=e;let a=n.PathExt.join(...s);const o=this._manager.contents.driveName(this.path);o&&(a=`${o}:${a}`),await this._manager.contents.rename(this.path,a),await(null===(t=this.sessionContext.session)||void 0===t?void 0:t.setPath(a)),await(null===(i=this.sessionContext.session)||void 0===i?void 0:i.setName(e)),this._path=a;const r=this._manager.contents.localPath(this._path);this.urlResolver.path=a,this._model.sharedModel.setState("path",r),this._pathChanged.emit(a)}async _save(){this._saveState.emit("started");const e=this._createSaveOptions();try{let t;if(await this._manager.ready,t=await this._maybeSave(e),this.isDisposed)return;this._model.dirty=!1,this._updateContentsModel(t),this._isPopulated||await this._populate(),this._saveState.emit("completed")}catch(e){const{name:t}=e;if("ModalCancelError"===t||"ModalDuplicateError"===t)throw e;const i=this._manager.contents.localPath(this._path),s=n.PathExt.basename(i);throw this._handleError(e,this._trans.__("File Save Error for %1",s)),this._saveState.emit("failed"),e}}_revert(e=!1){const t={type:this._factory.contentType,content:null!==this._factory.fileFormat,...null!==this._factory.fileFormat?{format:this._factory.fileFormat}:{}},i=this._path,s=this._model;return this._manager.ready.then((()=>this._manager.contents.get(i,t))).then((e=>{if(!this.isDisposed){if(e.content)if("json"===e.format)s.fromJSON(e.content);else{let t=e.content;-1!==t.indexOf("\r\n")?(this._lineEnding="\r\n",t=t.replace(/\r\n/g,"\n")):-1!==t.indexOf("\r")?(this._lineEnding="\r",t=t.replace(/\r/g,"\n")):this._lineEnding=null,s.fromString(t)}return this._updateContentsModel(e),s.dirty=!1,this._isPopulated?void 0:this._populate()}})).catch((async e=>{const t=this._manager.contents.localPath(this._path),i=n.PathExt.basename(t);throw this._handleError(e,this._trans.__("File Load Error for %1",i)),e}))}_maybeSave(e){const t=this._path;return this._manager.contents.get(t,{content:!1}).then((i=>{var s;if(this.isDisposed)return Promise.reject(new Error("Disposed"));const a=this._lastModifiedCheckMargin,n=this._model.sharedModel.getState("last_modified")||(null===(s=this.contentsModel)||void 0===s?void 0:s.last_modified),o=n?new Date(n):new Date,r=new Date(i.last_modified);return n&&r.getTime()-o.getTime()>a?this._timeConflict(o,i,e):this._manager.contents.save(t,e)}),(i=>{if(i.response&&404===i.response.status)return this._manager.contents.save(t,e);throw i}))}async _handleError(e,t){await(0,a.showErrorMessage)(t,e)}_maybeCheckpoint(e){let t=Promise.resolve(void 0);return this.canSave?(t=e?this.createCheckpoint().then():this.listCheckpoints().then((e=>{if(!this.isDisposed&&!e.length&&this.canSave)return this.createCheckpoint().then()})),t.catch((e=>{if(!e.response||403!==e.response.status)throw e}))):t}_timeConflict(e,t,i){const s=new Date(t.last_modified);if(console.warn(`Last saving performed ${e} while the current file seems to have been saved ${s}`),this._timeConflictModalIsOpen){const e=new Error("Modal is already displayed");return e.name="ModalDuplicateError",Promise.reject(e)}const n=this._trans.__('"%1" has changed on disk since the last time it was opened or saved.\nDo you want to overwrite the file on disk with the version open here,\nor load the version on disk (revert)?',this.path),o=a.Dialog.okButton({label:this._trans.__("Revert"),actions:["revert"]}),r=a.Dialog.warnButton({label:this._trans.__("Overwrite"),actions:["overwrite"]});return this._timeConflictModalIsOpen=!0,(0,a.showDialog)({title:this._trans.__("File Changed"),body:n,buttons:[a.Dialog.cancelButton(),o,r]}).then((e=>{if(this._timeConflictModalIsOpen=!1,this.isDisposed)return Promise.reject(new Error("Disposed"));if(e.button.actions.includes("overwrite"))return this._manager.contents.save(this._path,i);if(e.button.actions.includes("revert"))return this.revert().then((()=>t));const s=new Error("Cancel");return s.name="ModalCancelError",Promise.reject(s)}))}_maybeOverWrite(e){const t=this._trans.__('"%1" already exists. Do you want to replace it?',e),i=a.Dialog.warnButton({label:this._trans.__("Overwrite"),accept:!0});return(0,a.showDialog)({title:this._trans.__("File Overwrite?"),body:t,buttons:[a.Dialog.cancelButton(),i]}).then((t=>this.isDisposed?Promise.reject(new Error("Disposed")):t.button.accept?this._manager.contents.delete(e).then((()=>this._finishSaveAs(e))):void 0))}async _finishSaveAs(e){this._saveState.emit("started");try{await this._manager.ready;const t=this._createSaveOptions();await this._manager.contents.save(e,t),await this._maybeCheckpoint(!0),this._saveState.emit("completed")}catch(e){if("Cancel"===e.message||"Modal is already displayed"===e.message)throw e;const t=this._manager.contents.localPath(this._path),i=n.PathExt.basename(t);return this._handleError(e,this._trans.__("File Save Error for %1",i)),void this._saveState.emit("failed")}}_createSaveOptions(){let e=null;return"json"===this._factory.fileFormat?e=this._model.toJSON():(e=this._model.toString(),this._lineEnding&&(e=e.replace(/\n/g,this._lineEnding))),{type:this._factory.contentType,format:this._factory.fileFormat,content:e}}}!function(e){e.getSavePath=function(e,i){const s=(i=i||r.nullTranslator).load("jupyterlab"),n=a.Dialog.okButton({label:s.__("Save"),accept:!0});return(0,a.showDialog)({title:s.__("Save File As…"),body:new t(e),buttons:[a.Dialog.cancelButton(),n]}).then((e=>{var t;if(e.button.accept)return null!==(t=e.value)&&void 0!==t?t:void 0}))},e.noOp=function(){};class t extends c.Widget{constructor(e){super({node:i(e)})}getValue(){return this.node.value}}function i(e){const t=document.createElement("input");return t.value=e,t}}(s||(s={}));var m=i(77842);class g extends m.CodeEditor.Model{constructor(e={}){var t;super({sharedModel:e.sharedModel}),this._defaultLang="",this._dirty=!1,this._readOnly=!1,this._contentChanged=new d.Signal(this),this._stateChanged=new d.Signal(this),this._defaultLang=null!==(t=e.languagePreference)&&void 0!==t?t:"",this._collaborationEnabled=!!e.collaborationEnabled,this.sharedModel.changed.connect(this._onStateChanged,this)}get contentChanged(){return this._contentChanged}get stateChanged(){return this._stateChanged}get dirty(){return this._dirty}set dirty(e){const t=this._dirty;e!==t&&(this._dirty=e,this.triggerStateChange({name:"dirty",oldValue:t,newValue:e}))}get readOnly(){return this._readOnly}set readOnly(e){if(e===this._readOnly)return;const t=this._readOnly;this._readOnly=e,this.triggerStateChange({name:"readOnly",oldValue:t,newValue:e})}get defaultKernelName(){return""}get defaultKernelLanguage(){return this._defaultLang}get collaborative(){return this._collaborationEnabled}toString(){return this.sharedModel.getSource()}fromString(e){this.sharedModel.setSource(e)}toJSON(){return JSON.parse(this.sharedModel.getSource()||"null")}fromJSON(e){this.fromString(JSON.stringify(e))}initialize(){}triggerStateChange(e){this._stateChanged.emit(e)}triggerContentChange(){this._contentChanged.emit(void 0),this.dirty=!0}_onStateChanged(e,t){t.sourceChange&&this.triggerContentChange(),t.stateChange&&t.stateChange.forEach((e=>{"dirty"===e.name?this.dirty=e.newValue:e.oldValue!==e.newValue&&this.triggerStateChange({newValue:void 0,oldValue:void 0,...e})}))}}class p{constructor(e){this._isDisposed=!1,this._collaborative=null==e||e}get name(){return"text"}get contentType(){return"file"}get fileFormat(){return"text"}get collaborative(){return this._collaborative}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed=!0}createNew(e={}){const t=e.collaborationEnabled&&this.collaborative;return new g({...e,collaborationEnabled:t})}preferredLanguage(e){return""}}class u extends p{get name(){return"base64"}get contentType(){return"file"}get fileFormat(){return"base64"}}class f{constructor(e){this._isDisposed=!1,this._widgetCreated=new d.Signal(this),this._translator=e.translator||r.nullTranslator,this._name=e.name,this._label=e.label||e.name,this._readOnly=void 0!==e.readOnly&&e.readOnly,this._defaultFor=e.defaultFor?e.defaultFor.slice():[],this._defaultRendered=(e.defaultRendered||[]).slice(),this._fileTypes=e.fileTypes.slice(),this._modelName=e.modelName||"text",this._preferKernel=!!e.preferKernel,this._canStartKernel=!!e.canStartKernel,this._shutdownOnClose=!!e.shutdownOnClose,this._autoStartDefault=!!e.autoStartDefault,this._toolbarFactory=e.toolbarFactory}get widgetCreated(){return this._widgetCreated}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,d.Signal.clearData(this))}get readOnly(){return this._readOnly}get name(){return this._name}get label(){return this._label}get fileTypes(){return this._fileTypes.slice()}get modelName(){return this._modelName}get defaultFor(){return this._defaultFor.slice()}get defaultRendered(){return this._defaultRendered.slice()}get preferKernel(){return this._preferKernel}get canStartKernel(){return this._canStartKernel}get translator(){return this._translator}get shutdownOnClose(){return this._shutdownOnClose}set shutdownOnClose(e){this._shutdownOnClose=e}get autoStartDefault(){return this._autoStartDefault}set autoStartDefault(e){this._autoStartDefault=e}createNew(e,t){var i;const s=this.createNewWidget(e,t);return(0,a.setToolbar)(s,null!==(i=this._toolbarFactory)&&void 0!==i?i:this.defaultToolbarFactory.bind(this)),this._widgetCreated.emit(s),s}defaultToolbarFactory(e){return[]}}const y="jp-mod-dirty";class F extends a.MainAreaWidget{constructor(e){e.reveal=Promise.all([e.reveal,e.context.ready]),super(e),this.context=e.context,this.context.pathChanged.connect(this._onPathChanged,this),this._onPathChanged(this.context,this.context.path),this.context.model.stateChanged.connect(this._onModelStateChanged,this),this.context.ready.then((()=>{this._handleDirtyState()})),this.title.changed.connect(this._onTitleChanged,this)}setFragment(e){}async _onTitleChanged(e){const t=this.title.label,i=this.context.localPath.split("/").pop()||this.context.localPath;if(t!==i){if(t.length>0&&!/[\/\\:]/.test(t)){const e=this.context.path;if(await this.context.rename(t),this.context.path!==e)return}this.title.label=i}}_onPathChanged(e,t){this.title.label=n.PathExt.basename(e.localPath),this.isUntitled=!1}_onModelStateChanged(e,t){"dirty"===t.name&&this._handleDirtyState()}_handleDirtyState(){this.context.model.dirty&&!this.title.className.includes(y)?this.title.className+=` ${y}`:this.title.className=this.title.className.replace(y,"")}}var w,v=i(30807);class x extends c.Widget{constructor(e){super(),this._changeCallback=e=>{if(!e.data||!e.data[this.mimeType])return;const t=e.data[this.mimeType];"string"==typeof t?t!==this._context.model.toString()&&this._context.model.fromString(t):null==t||l.JSONExt.deepEqual(t,this._context.model.toJSON())||this._context.model.fromJSON(t)},this._fragment="",this._ready=new l.PromiseDelegate,this._isRendering=!1,this._renderRequested=!1,this.addClass("jp-MimeDocument"),this.translator=e.translator||r.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.mimeType=e.mimeType,this._dataType=e.dataType||"string",this._context=e.context,this.renderer=e.renderer,(this.layout=new c.StackedLayout).addWidget(this.renderer),this._context.ready.then((()=>this._render())).then((()=>{this.node===document.activeElement&&v.MessageLoop.sendMessage(this.renderer,c.Widget.Msg.ActivateRequest),this._monitor=new n.ActivityMonitor({signal:this._context.model.contentChanged,timeout:e.renderTimeout}),this._monitor.activityStopped.connect(this.update,this),this._ready.resolve(void 0)})).catch((e=>{requestAnimationFrame((()=>{this.dispose()})),(0,a.showErrorMessage)(this._trans.__("Renderer Failure: %1",this._context.path),e)}))}[a.Printing.symbol](){return a.Printing.getPrintFunction(this.renderer)}get ready(){return this._ready.promise}setFragment(e){this._fragment=e,this.update()}dispose(){this.isDisposed||(this._monitor&&this._monitor.dispose(),this._monitor=null,super.dispose())}onUpdateRequest(e){this._context.isReady&&(this._render(),this._fragment="")}async _render(){if(this.isDisposed)return;if(this._isRendering)return void(this._renderRequested=!0);this._renderRequested=!1;const e=this._context,t=e.model,i={};"string"===this._dataType?i[this.mimeType]=t.toString():i[this.mimeType]=t.toJSON();const s=new o.MimeModel({data:i,callback:this._changeCallback,metadata:{fragment:this._fragment}});try{if(this._isRendering=!0,await this.renderer.renderModel(s),this._isRendering=!1,this._renderRequested)return this._render()}catch(t){requestAnimationFrame((()=>{this.dispose()})),(0,a.showErrorMessage)(this._trans.__("Renderer Failure: %1",e.path),t)}}}class C extends F{setFragment(e){this.content.setFragment(e)}}class T extends f{constructor(e){super(w.createRegistryOptions(e)),this._rendermime=e.rendermime,this._renderTimeout=e.renderTimeout||1e3,this._dataType=e.dataType||"string",this._fileType=e.primaryFileType,this._factory=e.factory}createNewWidget(e){var t,i;const s=this._fileType,a=(null==s?void 0:s.mimeTypes.length)?s.mimeTypes[0]:"text/plain",n=this._rendermime.clone({resolver:e.urlResolver});let o;o=this._factory&&this._factory.mimeTypes.includes(a)?this._factory.createRenderer({mimeType:a,resolver:n.resolver,sanitizer:n.sanitizer,linkHandler:n.linkHandler,latexTypesetter:n.latexTypesetter,markdownParser:n.markdownParser}):n.createRenderer(a);const r=new x({context:e,renderer:o,mimeType:a,renderTimeout:this._renderTimeout,dataType:this._dataType});return r.title.icon=null==s?void 0:s.icon,r.title.iconClass=null!==(t=null==s?void 0:s.iconClass)&&void 0!==t?t:"",r.title.iconLabel=null!==(i=null==s?void 0:s.iconLabel)&&void 0!==i?i:"",new C({content:r,context:e})}}!function(e){e.createRegistryOptions=function(e){return{...e,readOnly:!0}}}(w||(w={}));var b,D=i(5020),S=i(20882);class M{constructor(e={}){this._modelFactories=Object.create(null),this._widgetFactories=Object.create(null),this._defaultWidgetFactory="",this._defaultWidgetFactoryOverrides=Object.create(null),this._defaultWidgetFactories=Object.create(null),this._defaultRenderedWidgetFactories=Object.create(null),this._widgetFactoriesForFileType=Object.create(null),this._fileTypes=[],this._extenders=Object.create(null),this._changed=new d.Signal(this),this._isDisposed=!1;const t=e.textModelFactory;if(this.translator=e.translator||r.nullTranslator,t&&"text"!==t.name)throw new Error("Text model factory must have the name `text`");this._modelFactories.text=t||new p(!0),(e.initialFileTypes||M.getDefaultFileTypes(this.translator)).forEach((e=>{const t={...M.getFileTypeDefaults(this.translator),...e};this._fileTypes.push(t)}))}get changed(){return this._changed}get isDisposed(){return this._isDisposed}dispose(){if(!this.isDisposed){this._isDisposed=!0;for(const e in this._modelFactories)this._modelFactories[e].dispose();for(const e in this._widgetFactories)this._widgetFactories[e].dispose();for(const e in this._extenders)this._extenders[e].length=0;this._fileTypes.length=0,d.Signal.clearData(this)}}addWidgetFactory(e){const t=e.name.toLowerCase();if(!t||"default"===t)throw Error("Invalid factory name");if(this._widgetFactories[t])return console.warn(`Duplicate registered factory ${t}`),new h.DisposableDelegate(b.noOp);this._widgetFactories[t]=e;for(const i of e.defaultFor||[])-1!==e.fileTypes.indexOf(i)&&("*"===i?this._defaultWidgetFactory=t:this._defaultWidgetFactories[i]=t);for(const i of e.defaultRendered||[])-1!==e.fileTypes.indexOf(i)&&(this._defaultRenderedWidgetFactories[i]=t);for(const i of e.fileTypes)this._widgetFactoriesForFileType[i]||(this._widgetFactoriesForFileType[i]=[]),this._widgetFactoriesForFileType[i].push(t);return this._changed.emit({type:"widgetFactory",name:t,change:"added"}),new h.DisposableDelegate((()=>{delete this._widgetFactories[t],this._defaultWidgetFactory===t&&(this._defaultWidgetFactory="");for(const e of Object.keys(this._defaultWidgetFactories))this._defaultWidgetFactories[e]===t&&delete this._defaultWidgetFactories[e];for(const e of Object.keys(this._defaultRenderedWidgetFactories))this._defaultRenderedWidgetFactories[e]===t&&delete this._defaultRenderedWidgetFactories[e];for(const e of Object.keys(this._widgetFactoriesForFileType))S.ArrayExt.removeFirstOf(this._widgetFactoriesForFileType[e],t),0===this._widgetFactoriesForFileType[e].length&&delete this._widgetFactoriesForFileType[e];for(const e of Object.keys(this._defaultWidgetFactoryOverrides))this._defaultWidgetFactoryOverrides[e]===t&&delete this._defaultWidgetFactoryOverrides[e];this._changed.emit({type:"widgetFactory",name:t,change:"removed"})}))}addModelFactory(e){const t=e.name.toLowerCase();return this._modelFactories[t]?(console.warn(`Duplicate registered factory ${t}`),new h.DisposableDelegate(b.noOp)):(this._modelFactories[t]=e,this._changed.emit({type:"modelFactory",name:t,change:"added"}),new h.DisposableDelegate((()=>{delete this._modelFactories[t],this._changed.emit({type:"modelFactory",name:t,change:"removed"})})))}addWidgetExtension(e,t){(e=e.toLowerCase())in this._extenders||(this._extenders[e]=[]);const i=this._extenders[e];return-1!==S.ArrayExt.firstIndexOf(i,t)?(console.warn(`Duplicate registered extension for ${e}`),new h.DisposableDelegate(b.noOp)):(this._extenders[e].push(t),this._changed.emit({type:"widgetExtension",name:e,change:"added"}),new h.DisposableDelegate((()=>{S.ArrayExt.removeFirstOf(this._extenders[e],t),this._changed.emit({type:"widgetExtension",name:e,change:"removed"})})))}addFileType(e,t){const i={...M.getFileTypeDefaults(this.translator),...e,...!(e.icon||e.iconClass)&&{icon:D.fileIcon}};if(this._fileTypes.push(i),t){const e=i.name.toLowerCase();t.map((e=>e.toLowerCase())).forEach((t=>{this._widgetFactoriesForFileType[e]||(this._widgetFactoriesForFileType[e]=[]),this._widgetFactoriesForFileType[e].includes(t)||this._widgetFactoriesForFileType[e].push(t)})),this._defaultWidgetFactories[e]||(this._defaultWidgetFactories[e]=this._widgetFactoriesForFileType[e][0])}return this._changed.emit({type:"fileType",name:i.name,change:"added"}),new h.DisposableDelegate((()=>{if(S.ArrayExt.removeFirstOf(this._fileTypes,i),t){const e=i.name.toLowerCase();for(const i of t.map((e=>e.toLowerCase())))S.ArrayExt.removeFirstOf(this._widgetFactoriesForFileType[e],i);this._defaultWidgetFactories[e]===t[0].toLowerCase()&&delete this._defaultWidgetFactories[e]}this._changed.emit({type:"fileType",name:e.name,change:"removed"})}))}preferredWidgetFactories(e){const t=new Set,i=this.getFileTypesForPath(n.PathExt.basename(e));i.forEach((e=>{e.name in this._defaultWidgetFactoryOverrides&&t.add(this._defaultWidgetFactoryOverrides[e.name])})),i.forEach((e=>{e.name in this._defaultWidgetFactories&&t.add(this._defaultWidgetFactories[e.name])})),i.forEach((e=>{e.name in this._defaultRenderedWidgetFactories&&t.add(this._defaultRenderedWidgetFactories[e.name])})),this._defaultWidgetFactory&&t.add(this._defaultWidgetFactory);for(const e of i)if(e.name in this._widgetFactoriesForFileType)for(const i of this._widgetFactoriesForFileType[e.name])t.add(i);if("*"in this._widgetFactoriesForFileType)for(const e of this._widgetFactoriesForFileType["*"])t.add(e);const s=[];for(const e of t){const t=this._widgetFactories[e];t&&((t.modelName||"text")in this._modelFactories&&s.push(t))}return s}defaultRenderedWidgetFactory(e){const t=this.getFileTypesForPath(n.PathExt.basename(e)).map((e=>e.name));for(const e in t)if(e in this._defaultWidgetFactoryOverrides)return this._widgetFactories[this._defaultWidgetFactoryOverrides[e]];for(const e in t)if(e in this._defaultRenderedWidgetFactories)return this._widgetFactories[this._defaultRenderedWidgetFactories[e]];return this.defaultWidgetFactory(e)}defaultWidgetFactory(e){return e?this.preferredWidgetFactories(e)[0]:this._widgetFactories[this._defaultWidgetFactory]}setDefaultWidgetFactory(e,t){if(e=e.toLowerCase(),!this.getFileType(e))throw Error(`Cannot find file type ${e}`);if(!t)return void(this._defaultWidgetFactoryOverrides[e]&&delete this._defaultWidgetFactoryOverrides[e]);if(!this.getWidgetFactory(t))throw Error(`Cannot find widget factory ${t}`);t=t.toLowerCase();const i=this._widgetFactoriesForFileType[e];if(!(t===this._defaultWidgetFactory||i&&i.includes(t)))throw Error(`Factory ${t} cannot view file type ${e}`);this._defaultWidgetFactoryOverrides[e]=t}*widgetFactories(){for(const e in this._widgetFactories)yield this._widgetFactories[e]}*modelFactories(){for(const e in this._modelFactories)yield this._modelFactories[e]}*widgetExtensions(e){if((e=e.toLowerCase())in this._extenders)for(const t of this._extenders[e])yield t}*fileTypes(){for(const e of this._fileTypes)yield e}getWidgetFactory(e){return this._widgetFactories[e.toLowerCase()]}getModelFactory(e){return this._modelFactories[e.toLowerCase()]}getFileType(e){return e=e.toLowerCase(),(0,S.find)(this._fileTypes,(t=>t.name.toLowerCase()===e))}getKernelPreference(e,t,i){t=t.toLowerCase();const s=this._widgetFactories[t];if(!s)return;const a=this.getModelFactory(s.modelName||"text");if(!a)return;const o=a.preferredLanguage(n.PathExt.basename(e)),r=i&&i.name;return{id:i&&i.id,name:r,language:o,shouldStart:s.preferKernel,canStart:s.canStartKernel,shutdownOnDispose:s.shutdownOnClose,autoStartDefault:s.autoStartDefault}}getFileTypeForModel(e){switch(e.type){case"directory":return(0,S.find)(this._fileTypes,(e=>"directory"===e.contentType))||M.getDefaultDirectoryFileType(this.translator);case"notebook":return(0,S.find)(this._fileTypes,(e=>"notebook"===e.contentType))||M.getDefaultNotebookFileType(this.translator);default:if(e.name||e.path){const t=e.name||n.PathExt.basename(e.path),i=this.getFileTypesForPath(t);if(i.length>0)return i[0]}return this.getFileType("text")||M.getDefaultTextFileType(this.translator)}}getFileTypesForPath(e){const t=[],i=n.PathExt.basename(e);let s=(0,S.find)(this._fileTypes,(e=>!(!e.pattern||null===i.match(e.pattern))));s&&t.push(s);let a=b.extname(i);for(;a.length>1;){const e=this._fileTypes.filter((e=>e.extensions.map((e=>e.toLowerCase())).includes(a)));t.push(...e),a="."+a.split(".").slice(2).join(".")}return t}}!function(e){function t(e){return{name:"default",displayName:(null==(e=e||r.nullTranslator)?void 0:e.load("jupyterlab")).__("default"),extensions:[],mimeTypes:[],contentType:"file",fileFormat:"text"}}function i(e){const i=null==(e=e||r.nullTranslator)?void 0:e.load("jupyterlab");return{...t(e),name:"text",displayName:i.__("Text"),mimeTypes:["text/plain"],extensions:[".txt"],icon:D.fileIcon}}function s(e){const i=null==(e=e||r.nullTranslator)?void 0:e.load("jupyterlab");return{...t(e),name:"notebook",displayName:i.__("Notebook"),mimeTypes:["application/x-ipynb+json"],extensions:[".ipynb"],contentType:"notebook",fileFormat:"json",icon:D.notebookIcon}}function a(e){const i=null==(e=e||r.nullTranslator)?void 0:e.load("jupyterlab");return{...t(e),name:"directory",displayName:i.__("Directory"),extensions:[],mimeTypes:["text/directory"],contentType:"directory",icon:D.folderIcon}}e.getFileTypeDefaults=t,e.getDefaultTextFileType=i,e.getDefaultNotebookFileType=s,e.getDefaultDirectoryFileType=a,e.getDefaultFileTypes=function(e){const t=null==(e=e||r.nullTranslator)?void 0:e.load("jupyterlab");return[i(e),s(e),a(e),{name:"markdown",displayName:t.__("Markdown File"),extensions:[".md"],mimeTypes:["text/markdown"],icon:D.markdownIcon},{name:"PDF",displayName:t.__("PDF File"),extensions:[".pdf"],mimeTypes:["application/pdf"],icon:D.pdfIcon},{name:"python",displayName:t.__("Python File"),extensions:[".py"],mimeTypes:["text/x-python"],icon:D.pythonIcon},{name:"json",displayName:t.__("JSON File"),extensions:[".json"],mimeTypes:["application/json"],icon:D.jsonIcon},{name:"julia",displayName:t.__("Julia File"),extensions:[".jl"],mimeTypes:["text/x-julia"],icon:D.juliaIcon},{name:"csv",displayName:t.__("CSV File"),extensions:[".csv"],mimeTypes:["text/csv"],icon:D.spreadsheetIcon},{name:"tsv",displayName:t.__("TSV File"),extensions:[".tsv"],mimeTypes:["text/csv"],icon:D.spreadsheetIcon},{name:"r",displayName:t.__("R File"),mimeTypes:["text/x-rsrc"],extensions:[".R"],icon:D.rKernelIcon},{name:"yaml",displayName:t.__("YAML File"),mimeTypes:["text/x-yaml","text/yaml"],extensions:[".yaml",".yml"],icon:D.yamlIcon},{name:"svg",displayName:t.__("Image"),mimeTypes:["image/svg+xml"],extensions:[".svg"],icon:D.imageIcon,fileFormat:"base64"},{name:"tiff",displayName:t.__("Image"),mimeTypes:["image/tiff"],extensions:[".tif",".tiff"],icon:D.imageIcon,fileFormat:"base64"},{name:"jpeg",displayName:t.__("Image"),mimeTypes:["image/jpeg"],extensions:[".jpg",".jpeg"],icon:D.imageIcon,fileFormat:"base64"},{name:"gif",displayName:t.__("Image"),mimeTypes:["image/gif"],extensions:[".gif"],icon:D.imageIcon,fileFormat:"base64"},{name:"png",displayName:t.__("Image"),mimeTypes:["image/png"],extensions:[".png"],icon:D.imageIcon,fileFormat:"base64"},{name:"bmp",displayName:t.__("Image"),mimeTypes:["image/bmp"],extensions:[".bmp"],icon:D.imageIcon,fileFormat:"base64"},{name:"webp",displayName:t.__("Image"),mimeTypes:["image/webp"],extensions:[".webp"],icon:D.imageIcon,fileFormat:"base64"}]}}(M||(M={})),function(e){e.extname=function(e){const t=n.PathExt.basename(e).split(".");return t.shift(),("."+t.join(".")).toLowerCase()},e.noOp=function(){}}(b||(b={}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[9638,8771],{68771:(e,t,n)=>{n.r(t),n.d(t,{ILauncher:()=>s,Launcher:()=>p,LauncherModel:()=>u});const s=new(n(49501).Token)("@jupyterlab/launcher:ILauncher","A service for the application activity launcher.\n Use this to add your extension activities to the launcher panel.");var a,r=n(61153),c=n(80259),o=n(9768),i=n(20882),l=n(73701),d=n(12004),h=n(46947),m=n(78156);class u extends o.VDomModel{constructor(){super(...arguments),this.itemsList=[]}add(e){const t=a.createItem(e);return this.itemsList.push(t),this.stateChanged.emit(void 0),new l.DisposableDelegate((()=>{i.ArrayExt.removeFirstOf(this.itemsList,t),this.stateChanged.emit(void 0)}))}items(){return this.itemsList[Symbol.iterator]()}}class p extends o.VDomRenderer{constructor(e){super(e.model),this._pending=!1,this._cwd="",this._cwd=e.cwd,this.translator=e.translator||c.nullTranslator,this._trans=this.translator.load("jupyterlab"),this._callback=e.callback,this._commands=e.commands,this.addClass("jp-Launcher")}get cwd(){return this._cwd}set cwd(e){this._cwd=e,this.update()}get pending(){return this._pending}set pending(e){this._pending=e}render(){if(!this.model)return null;const e=[this._trans.__("Notebook"),this._trans.__("Console"),this._trans.__("Other")],t=[this._trans.__("Notebook"),this._trans.__("Console")],n=Object.create(null);for(const e of this.model.items()){const t=e.category||this._trans.__("Other");t in n||(n[t]=[]),n[t].push(e)}for(const e in n)n[e]=n[e].sort(((e,t)=>a.sortCmp(e,t,this._cwd,this._commands)));const s=[];let c;const l=[];for(const t of e)l.push(t);for(const t in n)-1===e.indexOf(t)&&l.push(t);return l.forEach((e=>{if(!n[e])return;const l=n[e][0],d={...l.args,cwd:this.cwd},u=t.indexOf(e)>-1,p=this._commands.iconClass(l.command,d),_=this._commands.icon(l.command,d);e in n&&(c=m.createElement("div",{className:"jp-Launcher-section",key:e},m.createElement("div",{className:"jp-Launcher-sectionHeader"},m.createElement(o.LabIcon.resolveReact,{icon:_,iconClass:(0,o.classes)(p,"jp-Icon-cover"),stylesheet:"launcherSection"}),m.createElement("h2",{className:"jp-Launcher-sectionTitle"},e)),m.createElement("div",{className:"jp-Launcher-cardContainer"},Array.from((0,i.map)(n[e],(e=>function(e,t,n,s,c,i){const l=t.command,d={...t.args,cwd:n.cwd},u=s.caption(l,d),p=s.label(l,d),_=e?p:u||p,g=()=>{!0!==n.pending&&(n.pending=!0,s.execute(l,{...t.args,cwd:n.cwd}).then((e=>{n.pending=!1,e instanceof h.Widget&&i(e)})).catch((e=>{console.error(e),n.pending=!1,(0,r.showErrorMessage)(c._p("Error","Launcher Error"),e)})))},E=s.iconClass(l,d),L=s.icon(l,d);return m.createElement("div",{className:"jp-LauncherCard",title:_,onClick:g,onKeyPress:e=>{"Enter"===e.key&&g()},tabIndex:0,"data-category":t.category||c.__("Other"),key:a.keyProperty.get(t)},m.createElement("div",{className:"jp-LauncherCard-icon"},e?t.kernelIconUrl?m.createElement("img",{src:t.kernelIconUrl,className:"jp-Launcher-kernelIcon"}):m.createElement("div",{className:"jp-LauncherCard-noKernelIcon"},p[0].toUpperCase()):m.createElement(o.LabIcon.resolveReact,{icon:L,iconClass:(0,o.classes)(E,"jp-Icon-cover"),stylesheet:"launcherCard"})),m.createElement("div",{className:"jp-LauncherCard-label",title:_},m.createElement("p",null,p)))}(u,e,this,this._commands,this._trans,this._callback)))))),s.push(c))})),m.createElement("div",{className:"jp-Launcher-body"},m.createElement("div",{className:"jp-Launcher-content"},m.createElement("div",{className:"jp-Launcher-cwd"},m.createElement("h3",null,this.cwd)),s))}}!function(e){let t=0;e.keyProperty=new d.AttachedProperty({name:"key",create:()=>t++}),e.createItem=function(e){return{...e,category:e.category||"",rank:void 0!==e.rank?e.rank:1/0}},e.sortCmp=function(e,t,n,s){const a=e.rank,r=t.rank;if(a!==r&&void 0!==a&&void 0!==r)return a<r?-1:1;const c=s.label(e.command,{...e.args,cwd:n}),o=s.label(t.command,{...t.args,cwd:n});return c.localeCompare(o)}}(a||(a={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[9638,8771],{68771:(e,t,n)=>{n.r(t),n.d(t,{ILauncher:()=>s,Launcher:()=>p,LauncherModel:()=>u});const s=new(n(49501).Token)("@jupyterlab/launcher:ILauncher","A service for the application activity launcher.\n Use this to add your extension activities to the launcher panel.");var a,r=n(25314),c=n(6614),o=n(5020),i=n(20882),l=n(73701),d=n(12004),h=n(46947),m=n(78156);class u extends o.VDomModel{constructor(){super(...arguments),this.itemsList=[]}add(e){const t=a.createItem(e);return this.itemsList.push(t),this.stateChanged.emit(void 0),new l.DisposableDelegate((()=>{i.ArrayExt.removeFirstOf(this.itemsList,t),this.stateChanged.emit(void 0)}))}items(){return this.itemsList[Symbol.iterator]()}}class p extends o.VDomRenderer{constructor(e){super(e.model),this._pending=!1,this._cwd="",this._cwd=e.cwd,this.translator=e.translator||c.nullTranslator,this._trans=this.translator.load("jupyterlab"),this._callback=e.callback,this._commands=e.commands,this.addClass("jp-Launcher")}get cwd(){return this._cwd}set cwd(e){this._cwd=e,this.update()}get pending(){return this._pending}set pending(e){this._pending=e}render(){if(!this.model)return null;const e=[this._trans.__("Notebook"),this._trans.__("Console"),this._trans.__("Other")],t=[this._trans.__("Notebook"),this._trans.__("Console")],n=Object.create(null);for(const e of this.model.items()){const t=e.category||this._trans.__("Other");t in n||(n[t]=[]),n[t].push(e)}for(const e in n)n[e]=n[e].sort(((e,t)=>a.sortCmp(e,t,this._cwd,this._commands)));const s=[];let c;const l=[];for(const t of e)l.push(t);for(const t in n)-1===e.indexOf(t)&&l.push(t);return l.forEach((e=>{if(!n[e])return;const l=n[e][0],d={...l.args,cwd:this.cwd},u=t.indexOf(e)>-1,p=this._commands.iconClass(l.command,d),_=this._commands.icon(l.command,d);e in n&&(c=m.createElement("div",{className:"jp-Launcher-section",key:e},m.createElement("div",{className:"jp-Launcher-sectionHeader"},m.createElement(o.LabIcon.resolveReact,{icon:_,iconClass:(0,o.classes)(p,"jp-Icon-cover"),stylesheet:"launcherSection"}),m.createElement("h2",{className:"jp-Launcher-sectionTitle"},e)),m.createElement("div",{className:"jp-Launcher-cardContainer"},Array.from((0,i.map)(n[e],(e=>function(e,t,n,s,c,i){const l=t.command,d={...t.args,cwd:n.cwd},u=s.caption(l,d),p=s.label(l,d),_=e?p:u||p,g=()=>{!0!==n.pending&&(n.pending=!0,s.execute(l,{...t.args,cwd:n.cwd}).then((e=>{n.pending=!1,e instanceof h.Widget&&i(e)})).catch((e=>{console.error(e),n.pending=!1,(0,r.showErrorMessage)(c._p("Error","Launcher Error"),e)})))},E=s.iconClass(l,d),L=s.icon(l,d);return m.createElement("div",{className:"jp-LauncherCard",title:_,onClick:g,onKeyPress:e=>{"Enter"===e.key&&g()},tabIndex:0,"data-category":t.category||c.__("Other"),key:a.keyProperty.get(t)},m.createElement("div",{className:"jp-LauncherCard-icon"},e?t.kernelIconUrl?m.createElement("img",{src:t.kernelIconUrl,className:"jp-Launcher-kernelIcon"}):m.createElement("div",{className:"jp-LauncherCard-noKernelIcon"},p[0].toUpperCase()):m.createElement(o.LabIcon.resolveReact,{icon:L,iconClass:(0,o.classes)(E,"jp-Icon-cover"),stylesheet:"launcherCard"})),m.createElement("div",{className:"jp-LauncherCard-label",title:_},m.createElement("p",null,p)))}(u,e,this,this._commands,this._trans,this._callback)))))),s.push(c))})),m.createElement("div",{className:"jp-Launcher-body"},m.createElement("div",{className:"jp-Launcher-content"},m.createElement("div",{className:"jp-Launcher-cwd"},m.createElement("h3",null,this.cwd)),s))}}!function(e){let t=0;e.keyProperty=new d.AttachedProperty({name:"key",create:()=>t++}),e.createItem=function(e){return{...e,category:e.category||"",rank:void 0!==e.rank?e.rank:1/0}},e.sortCmp=function(e,t,n,s){const a=e.rank,r=t.rank;if(a!==r&&void 0!==a&&void 0!==r)return a<r?-1:1;const c=s.label(e.command,{...e.args,cwd:n}),o=s.label(t.command,{...t.args,cwd:n});return c.localeCompare(o)}}(a||(a={}))}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[9680,7427],{99680:(e,t,n)=>{n.r(t),n.d(t,{IMarkdownViewerTracker:()=>a,MarkdownDocument:()=>w,MarkdownViewer:()=>f,MarkdownViewerFactory:()=>_,MarkdownViewerTableOfContentsFactory:()=>s,MarkdownViewerTableOfContentsModel:()=>i});var r=n(65684);class i extends r.TableOfContentsModel{constructor(e,t,n){super(e,n),this.parser=t}get documentType(){return"markdown-viewer"}get isAlwaysActive(){return!0}get supportedOptions(){return["maximalDepth","numberingH1","numberHeaders"]}getHeadings(){const e=this.widget.context.model.toString(),t=r.TableOfContentsUtils.filterHeadings(r.TableOfContentsUtils.Markdown.getHeadings(e),{...this.configuration,baseNumbering:1});return Promise.resolve(t)}}class s extends r.TableOfContentsFactory{constructor(e,t){super(e),this.parser=t}_createNew(e,t){const n=new i(e,this.parser,t);let s=new WeakMap;const o=(t,n)=>{if(n){const t=s.get(n);if(t){const n=e.content.node.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top>n.bottom||r.bottom<n.top)&&t.scrollIntoView({block:"center"})}}},a=()=>{this.parser&&(r.TableOfContentsUtils.clearNumbering(e.content.node),s=new WeakMap,n.headings.forEach((async t=>{var n;const i=await r.TableOfContentsUtils.Markdown.getHeadingId(this.parser,t.raw,t.level);if(!i)return;const o=`h${t.level}[id="${i}"]`;s.set(t,r.TableOfContentsUtils.addPrefix(e.content.node,o,null!==(n=t.prefix)&&void 0!==n?n:""))})))};return e.content.ready.then((()=>{a(),e.content.rendered.connect(a),n.activeHeadingChanged.connect(o),n.headingsChanged.connect(a),e.disposed.connect((()=>{e.content.rendered.disconnect(a),n.activeHeadingChanged.disconnect(o),n.headingsChanged.disconnect(a)}))})),n}}var o=n(49501);const a=new o.Token("@jupyterlab/markdownviewer:IMarkdownViewerTracker","A widget tracker for markdown\n document viewers. Use this if you want to iterate over and interact with rendered markdown documents.");var d=n(25314),c=n(8630),l=n(64846),h=n(18932),u=n(6614),g=n(47479),m=n(46947);const p="text/markdown";class f extends m.Widget{constructor(e){super(),this._config={...f.defaultConfig},this._fragment="",this._ready=new o.PromiseDelegate,this._isRendering=!1,this._renderRequested=!1,this._rendered=new g.Signal(this),this.context=e.context,this.translator=e.translator||u.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.renderer=e.renderer,this.node.tabIndex=0,this.addClass("jp-MarkdownViewer"),(this.layout=new m.StackedLayout).addWidget(this.renderer),this.context.ready.then((async()=>{await this._render(),this._monitor=new c.ActivityMonitor({signal:this.context.model.contentChanged,timeout:this._config.renderTimeout}),this._monitor.activityStopped.connect(this.update,this),this._ready.resolve(void 0)}))}get ready(){return this._ready.promise}get rendered(){return this._rendered}setFragment(e){this._fragment=e,this.update()}setOption(e,t){if(this._config[e]===t)return;this._config[e]=t;const{style:n}=this.renderer.node;switch(e){case"fontFamily":n.setProperty("font-family",t);break;case"fontSize":n.setProperty("font-size",t?t+"px":null);break;case"hideFrontMatter":this.update();break;case"lineHeight":n.setProperty("line-height",t?t.toString():null);break;case"lineWidth":{const e=t?`calc(50% - ${t/2}ch)`:null;n.setProperty("padding-left",e),n.setProperty("padding-right",e);break}case"renderTimeout":this._monitor&&(this._monitor.timeout=t)}}dispose(){this.isDisposed||(this._monitor&&this._monitor.dispose(),this._monitor=null,super.dispose())}onUpdateRequest(e){this.context.isReady&&!this.isDisposed&&(this._render(),this._fragment="")}onActivateRequest(e){this.node.focus()}async _render(){if(this.isDisposed)return;if(this._isRendering)return void(this._renderRequested=!0);this._renderRequested=!1;const{context:e}=this,{model:t}=e,n=t.toString(),r={};r[p]=this._config.hideFrontMatter?y.removeFrontMatter(n):n;const i=new h.MimeModel({data:r,metadata:{fragment:this._fragment}});try{if(this._isRendering=!0,await this.renderer.renderModel(i),this._isRendering=!1,this._renderRequested)return this._render();this._rendered.emit()}catch(t){requestAnimationFrame((()=>{this.dispose()})),(0,d.showErrorMessage)(this._trans.__("Renderer Failure: %1",e.path),t)}}}!function(e){e.defaultConfig={fontFamily:null,fontSize:null,lineHeight:null,lineWidth:null,hideFrontMatter:!0,renderTimeout:1e3}}(f||(f={}));class w extends l.DocumentWidget{setFragment(e){this.content.setFragment(e)}}class _ extends l.ABCWidgetFactory{constructor(e){super(y.createRegistryOptions(e)),this._fileType=e.primaryFileType,this._rendermime=e.rendermime}createNewWidget(e){var t,n,r,i,s;const o=this._rendermime.clone({resolver:e.urlResolver}).createRenderer(p),a=new f({context:e,renderer:o});return a.title.icon=null===(t=this._fileType)||void 0===t?void 0:t.icon,a.title.iconClass=null!==(r=null===(n=this._fileType)||void 0===n?void 0:n.iconClass)&&void 0!==r?r:"",a.title.iconLabel=null!==(s=null===(i=this._fileType)||void 0===i?void 0:i.iconLabel)&&void 0!==s?s:"",new w({content:a,context:e})}}var y;!function(e){e.createRegistryOptions=function(e){return{...e,readOnly:!0}},e.removeFrontMatter=function(e){const t=e.match(/^---\n[^]*?\n(---|...)\n/);if(!t)return e;const{length:n}=t[0];return e.slice(n)}}(y||(y={}))}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[9685,7252],{79685:(e,t,r)=>{r.r(t),r.d(t,{default:()=>k});var n,o=r(5452),a=r(25314),d=r(8630),i=r(63942),c=r(18932),s=r(72171),w=r(65684),m=r(6614);!function(e){e.markdownPreview="markdownviewer:open",e.markdownEditor="markdownviewer:edit"}(n||(n={}));const p="Markdown Preview",l={activate:function(e,t,r,o,s,w){const m=r.load("jupyterlab"),{commands:k,docRegistry:u}=e;t.addFactory(c.markdownRendererFactory);const g=new a.WidgetTracker({namespace:"markdownviewer-widget"});let f={...i.MarkdownViewer.defaultConfig};function h(e){Object.keys(f).forEach((t=>{var r;e.setOption(t,null!==(r=f[t])&&void 0!==r?r:null)}))}if(s){const e=e=>{f=e.composite,g.forEach((e=>{h(e.content)}))};s.load(l.id).then((t=>{t.changed.connect((()=>{e(t)})),e(t)})).catch((e=>{console.error(e.message)}))}const y=new i.MarkdownViewerFactory({rendermime:t,name:p,label:m.__("Markdown Preview"),primaryFileType:u.getFileType("markdown"),fileTypes:["markdown"],defaultRendered:["markdown"]});return y.widgetCreated.connect(((e,t)=>{t.context.pathChanged.connect((()=>{g.save(t)})),h(t.content),g.add(t)})),u.addWidgetFactory(y),o&&o.restore(g,{command:"docmanager:open",args:e=>({path:e.context.path,factory:p}),name:e=>e.context.path}),k.addCommand(n.markdownPreview,{label:m.__("Markdown Preview"),execute:e=>{const t=e.path;if("string"==typeof t)return k.execute("docmanager:open",{path:t,factory:p,options:e.options})}}),k.addCommand(n.markdownEditor,{execute:()=>{const e=g.currentWidget;if(!e)return;const t=e.context.path;return k.execute("docmanager:open",{path:t,factory:"Editor",options:{mode:"split-right"}})},isVisible:()=>{const e=g.currentWidget;return e&&".md"===d.PathExt.extname(e.context.path)||!1},label:m.__("Show Markdown Editor")}),w&&w.add(new i.MarkdownViewerTableOfContentsFactory(g,t.markdownParser)),g},id:"@jupyterlab/markdownviewer-extension:plugin",description:"Adds markdown file viewer and provides its tracker.",provides:i.IMarkdownViewerTracker,requires:[c.IRenderMimeRegistry,m.ITranslator],optional:[o.ILayoutRestorer,s.ISettingRegistry,w.ITableOfContentsRegistry],autoStart:!0},k=l}}]);