notebook 7.3.0a0__py3-none-any.whl → 7.3.0b0__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.
- notebook/_version.py +1 -1
- notebook/app.py +10 -2
- notebook/static/113.bundle.js +1 -1
- notebook/static/1198.bundle.js +1 -1
- notebook/static/131.bundle.js +1 -1
- notebook/static/134.bundle.js +1 -1
- notebook/static/1408.bundle.js +1 -1
- notebook/static/1496.bundle.js +1 -1
- notebook/static/1584.bundle.js +1 -1
- notebook/static/1647.bundle.js +1 -1
- notebook/static/1650.bundle.js +1 -1
- notebook/static/1684.bundle.js +1 -1
- notebook/static/170.bundle.js +1 -1
- notebook/static/1809.bundle.js +1 -1
- notebook/static/1827.bundle.js +1 -1
- notebook/static/1828.bundle.js +1 -1
- notebook/static/1833.bundle.js +1 -1
- notebook/static/1958.bundle.js +1 -1
- notebook/static/1962.bundle.js +1 -1
- notebook/static/2007.bundle.js +1 -1
- notebook/static/2065.bundle.js +1 -1
- notebook/static/2088.bundle.js +1 -1
- notebook/static/2089.bundle.js +1 -1
- notebook/static/2122.bundle.js +1 -1
- notebook/static/2167.bundle.js +1 -1
- notebook/static/2184.bundle.js +1 -1
- notebook/static/2311.bundle.js +1 -1
- notebook/static/2401.bundle.js +1 -1
- notebook/static/2424.bundle.js +377 -0
- notebook/static/2479.bundle.js +1 -1
- notebook/static/2489.bundle.js +1 -1
- notebook/static/2607.bundle.js +1 -1
- notebook/static/2615.bundle.js +1 -1
- notebook/static/2636.bundle.js +1 -1
- notebook/static/2756.bundle.js +1 -1
- notebook/static/2813.bundle.js +1 -1
- notebook/static/2866.bundle.js +1 -1
- notebook/static/2924.bundle.js +1 -1
- notebook/static/2944.bundle.js +1 -1
- notebook/static/2955.bundle.js +1 -0
- notebook/static/3129.bundle.js +1 -1
- notebook/static/3146.bundle.js +1 -1
- notebook/static/3187.bundle.js +1 -1
- notebook/static/3213.bundle.js +1 -1
- notebook/static/3301.bundle.js +1 -1
- notebook/static/3325.bundle.js +1 -1
- notebook/static/3340.bundle.js +1 -1
- notebook/static/3360.bundle.js +1 -1
- notebook/static/{1261.bundle.js → 3463.bundle.js} +1 -1
- notebook/static/3466.bundle.js +1 -1
- notebook/static/35.bundle.js +1 -1
- notebook/static/3512.bundle.js +1 -1
- notebook/static/3676.bundle.js +1 -1
- notebook/static/3680.bundle.js +1 -1
- notebook/static/374.bundle.js +1 -1
- notebook/static/3768.bundle.js +1 -1
- notebook/static/377.bundle.js +1 -1
- notebook/static/3863.bundle.js +1 -1
- notebook/static/3881.bundle.js +1 -1
- notebook/static/4042.bundle.js +1 -1
- notebook/static/4058.bundle.js +1 -1
- notebook/static/409.bundle.js +1 -1
- notebook/static/4212.bundle.js +1 -1
- notebook/static/4242.bundle.js +79 -0
- notebook/static/4271.bundle.js +1 -1
- notebook/static/4291.bundle.js +1 -1
- notebook/static/4382.bundle.js +1 -1
- notebook/static/4526.bundle.js +1 -1
- notebook/static/4588.bundle.js +1 -1
- notebook/static/4630.bundle.js +1 -1
- notebook/static/4645.bundle.js +1 -1
- notebook/static/4811.bundle.js +1 -1
- notebook/static/4837.bundle.js +1 -1
- notebook/static/5099.bundle.js +1 -1
- notebook/static/5135.bundle.js +1 -1
- notebook/static/5166.bundle.js +1 -1
- notebook/static/5234.bundle.js +1 -1
- notebook/static/5254.bundle.js +1 -1
- notebook/static/5261.bundle.js +1 -1
- notebook/static/5263.bundle.js +1 -0
- notebook/static/5313.bundle.js +1 -1
- notebook/static/5325.bundle.js +1 -1
- notebook/static/5346.bundle.js +1 -1
- notebook/static/5426.bundle.js +1 -1
- notebook/static/5430.bundle.js +653 -0
- notebook/static/545.bundle.js +1 -1
- notebook/static/5451.bundle.js +1 -1
- notebook/static/5573.bundle.js +1 -1
- notebook/static/5601.bundle.js +1 -1
- notebook/static/5649.bundle.js +3 -3
- notebook/static/5733.bundle.js +1 -1
- notebook/static/5828.bundle.js +1 -1
- notebook/static/5850.bundle.js +1 -1
- notebook/static/5912.bundle.js +1 -1
- notebook/static/5921.bundle.js +1 -1
- notebook/static/6017.bundle.js +1 -1
- notebook/static/6061.bundle.js +1 -1
- notebook/static/6139.bundle.js +1 -1
- notebook/static/62.bundle.js +1 -1
- notebook/static/6271.bundle.js +1 -1
- notebook/static/6345.bundle.js +1 -1
- notebook/static/6604.bundle.js +1 -1
- notebook/static/6621.bundle.js +1 -1
- notebook/static/6627.bundle.js +1 -1
- notebook/static/6648.bundle.js +1 -0
- notebook/static/6731.bundle.js +1 -1
- notebook/static/6748.bundle.js +1 -1
- notebook/static/677.bundle.js +1 -1
- notebook/static/6815.bundle.js +1 -1
- notebook/static/6853.bundle.js +1 -1
- notebook/static/6893.bundle.js +1 -1
- notebook/static/690.bundle.js +1 -1
- notebook/static/6962.bundle.js +1 -1
- notebook/static/6999.bundle.js +1 -1
- notebook/static/7226.bundle.js +1 -1
- notebook/static/7252.bundle.js +1 -1
- notebook/static/7302.bundle.js +1 -1
- notebook/static/7386.bundle.js +1 -1
- notebook/static/7391.bundle.js +1 -1
- notebook/static/7450.bundle.js +1 -1
- notebook/static/7543.bundle.js +1 -1
- notebook/static/755.bundle.js +1 -1
- notebook/static/7603.bundle.js +1 -1
- notebook/static/7639.bundle.js +1 -1
- notebook/static/7655.bundle.js +1 -1
- notebook/static/{4427.bundle.js → 7674.bundle.js} +1 -1
- notebook/static/7684.bundle.js +1 -1
- notebook/static/7812.bundle.js +1 -1
- notebook/static/7819.bundle.js +1 -1
- notebook/static/7821.bundle.js +1 -1
- notebook/static/7854.bundle.js +1 -1
- notebook/static/7866.bundle.js +1 -0
- notebook/static/7900.bundle.js +1 -1
- notebook/static/7906.bundle.js +1 -1
- notebook/static/7995.bundle.js +1 -1
- notebook/static/8010.bundle.js +1 -1
- notebook/static/8032.bundle.js +1 -1
- notebook/static/8471.bundle.js +1 -1
- notebook/static/8579.bundle.js +1 -1
- notebook/static/8633.bundle.js +1 -1
- notebook/static/8635.bundle.js +41 -0
- notebook/static/8771.bundle.js +1 -1
- notebook/static/8781.bundle.js +1 -1
- notebook/static/8875.bundle.js +1 -1
- notebook/static/8907.bundle.js +1 -1
- notebook/static/8928.bundle.js +1 -1
- notebook/static/8929.bundle.js +1 -1
- notebook/static/893.bundle.js +1 -1
- notebook/static/901.bundle.js +1 -1
- notebook/static/9068.bundle.js +1 -1
- notebook/static/911.bundle.js +1 -1
- notebook/static/9136.bundle.js +1 -1
- notebook/static/9151.bundle.js +1 -1
- notebook/static/9161.bundle.js +1 -1
- notebook/static/9268.bundle.js +1 -1
- notebook/static/9335.bundle.js +1 -1
- notebook/static/9341.bundle.js +1 -1
- notebook/static/9380.bundle.js +1 -1
- notebook/static/9605.bundle.js +1 -1
- notebook/static/9638.bundle.js +1 -1
- notebook/static/9672.bundle.js +352 -0
- notebook/static/9680.bundle.js +1 -1
- notebook/static/9685.bundle.js +1 -1
- notebook/static/9752.bundle.js +1 -1
- notebook/static/9799.bundle.js +1 -0
- notebook/static/9821.bundle.js +1 -1
- notebook/static/9852.bundle.js +1 -1
- notebook/static/bundle.js +1 -1
- notebook/static/third-party-licenses.json +127 -133
- notebook/templates/consoles.html +1 -1
- notebook/templates/edit.html +1 -1
- notebook/templates/error.html +1 -1
- notebook/templates/notebooks.html +1 -1
- notebook/templates/terminals.html +1 -1
- notebook/templates/tree.html +1 -1
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +17 -17
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +5 -5
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +11 -11
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +18 -18
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -1
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +13 -13
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +12 -12
- notebook-7.3.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.6d49b092e49dc147dc54.js → notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.67f8b11d2af855286118.js +1 -1
- notebook-7.3.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/646.57a345a80ce9f0e64830.js → notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/907.767373e59d0c0e33ef12.js +1 -1
- notebook-7.3.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.7bcc163b9139ecb2b25b.js → notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.50419fa0a72e54064396.js +1 -1
- notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.fd0956ebf15f666a19f8.js +1 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
- {notebook-7.3.0a0.dist-info → notebook-7.3.0b0.dist-info}/METADATA +2 -2
- {notebook-7.3.0a0.dist-info → notebook-7.3.0b0.dist-info}/RECORD +213 -222
- {notebook-7.3.0a0.dist-info → notebook-7.3.0b0.dist-info}/WHEEL +1 -1
- notebook/static/1226.bundle.js +0 -1
- notebook/static/1750.bundle.js +0 -1
- notebook/static/1884.bundle.js +0 -386
- notebook/static/4045.bundle.js +0 -1
- notebook/static/4434.bundle.js +0 -1
- notebook/static/5018.bundle.js +0 -1
- notebook/static/5712.bundle.js +0 -1
- notebook/static/6164.bundle.js +0 -1
- notebook/static/6318.bundle.js +0 -1
- notebook/static/6619.bundle.js +0 -1
- notebook/static/6898.bundle.js +0 -1
- notebook/static/7506.bundle.js +0 -703
- notebook/static/7579.bundle.js +0 -1
- notebook/static/8054.bundle.js +0 -1
- notebook/static/8647.bundle.js +0 -1
- notebook/static/8723.bundle.js +0 -1
- notebook/static/9092.bundle.js +0 -1
- notebook/static/9734.bundle.js +0 -1
- notebook/static/9906.bundle.js +0 -1
- notebook-7.3.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.9381fdb35e72f41d8af1.js +0 -1
- /notebook/static/{7506.bundle.js.LICENSE.txt → 4242.bundle.js.LICENSE.txt} +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/applications/jupyter-notebook.desktop +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/edit-notebook-metadata.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/93.eae3497dd223d842d198.js +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
- {notebook-7.3.0a0.dist-info → notebook-7.3.0b0.dist-info}/entry_points.txt +0 -0
- {notebook-7.3.0a0.dist-info → notebook-7.3.0b0.dist-info}/licenses/LICENSE +0 -0
notebook/static/7391.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7391],{77391:(e,t,i)=>{i.r(t),i.d(t,{COMPLETER_ACTIVE_CLASS:()=>D,COMPLETER_ENABLED_CLASS:()=>E,CodeEditor:()=>o,CodeEditorWrapper:()=>L,CodeViewerWidget:()=>j,IEditorMimeTypeService:()=>s,IEditorServices:()=>S,IPositionModel:()=>N,JSONEditor:()=>m,LineCol:()=>f});var s,o,n=i(57508),r=i(83978),a=i(81997);!function(e){e.defaultMimeType="text/plain"}(s||(s={})),function(e){e.Model=class{constructor(e={}){var t,i;this.standaloneModel=!1,this._isDisposed=!1,this._selections=new r.ObservableMap,this._mimeType=s.defaultMimeType,this._mimeTypeChanged=new a.Signal(this),this.standaloneModel=void 0===e.sharedModel,this.sharedModel=null!==(t=e.sharedModel)&&void 0!==t?t:new n.YFile,this._mimeType=null!==(i=e.mimeType)&&void 0!==i?i:s.defaultMimeType}get mimeTypeChanged(){return this._mimeTypeChanged}get selections(){return this._selections}get mimeType(){return this._mimeType}set mimeType(e){const t=this.mimeType;t!==e&&(this._mimeType=e,this._mimeTypeChanged.emit({name:"mimeType",oldValue:t,newValue:e}))}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._selections.dispose(),this.standaloneModel&&this.sharedModel.dispose(),a.Signal.clearData(this))}}}(o||(o={}));var d=i(70858),l=i(95291),h=i(20998),c=i(63485);const u="jp-mod-error";class m extends c.Widget{constructor(e){super(),this._dataDirty=!1,this._inputDirty=!1,this._source=null,this._originalValue=h.JSONExt.emptyObject,this._changeGuard=!1,this.translator=e.translator||d.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.addClass("jp-JSONEditor"),this.headerNode=document.createElement("div"),this.headerNode.className="jp-JSONEditor-header",this.revertButtonNode=l.undoIcon.element({tag:"span",title:this._trans.__("Revert changes to data")}),this.commitButtonNode=l.checkIcon.element({tag:"span",title:this._trans.__("Commit changes to data"),marginLeft:"8px"}),this.editorHostNode=document.createElement("div"),this.editorHostNode.className="jp-JSONEditor-host",this.headerNode.appendChild(this.revertButtonNode),this.headerNode.appendChild(this.commitButtonNode),this.node.appendChild(this.headerNode),this.node.appendChild(this.editorHostNode);const t=new o.Model({mimeType:"application/json"});t.sharedModel.changed.connect(this._onModelChanged,this),this.model=t,this.editor=e.editorFactory({host:this.editorHostNode,model:t,config:{readOnly:!0}})}get source(){return this._source}set source(e){this._source!==e&&(this._source&&this._source.changed.disconnect(this._onSourceChanged,this),this._source=e,this.editor.setOption("readOnly",null===e),e&&e.changed.connect(this._onSourceChanged,this),this._setValue())}get isDirty(){return this._dataDirty||this._inputDirty}dispose(){var e;this.isDisposed||(null===(e=this.source)||void 0===e||e.dispose(),this.model.dispose(),this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"blur":this._evtBlur(e);break;case"click":this._evtClick(e)}}onAfterAttach(e){const t=this.editorHostNode;t.addEventListener("blur",this,!0),t.addEventListener("click",this,!0),this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.headerNode.addEventListener("click",this)}onBeforeDetach(e){const t=this.editorHostNode;t.removeEventListener("blur",this,!0),t.removeEventListener("click",this,!0),this.headerNode.removeEventListener("click",this)}_onSourceChanged(e,t){this._changeGuard||(this._inputDirty||this.editor.hasFocus()?this._dataDirty=!0:this._setValue())}_onModelChanged(e,t){if(t.sourceChange){let e=!0;try{const e=JSON.parse(this.editor.model.sharedModel.getSource());this.removeClass(u),this._inputDirty=!this._changeGuard&&!h.JSONExt.deepEqual(e,this._originalValue)}catch(t){this.addClass(u),this._inputDirty=!0,e=!1}this.revertButtonNode.hidden=!this._inputDirty,this.commitButtonNode.hidden=!e||!this._inputDirty}}_evtBlur(e){!this._inputDirty&&this._dataDirty&&this._setValue()}_evtClick(e){const t=e.target;this.revertButtonNode.contains(t)?this._setValue():this.commitButtonNode.contains(t)?this.commitButtonNode.hidden||this.hasClass(u)||(this._changeGuard=!0,this._mergeContent(),this._changeGuard=!1,this._setValue()):this.editorHostNode.contains(t)&&this.editor.focus()}_mergeContent(){const e=this.editor.model,t=this._originalValue,i=JSON.parse(e.sharedModel.getSource()),s=this.source;if(s){for(const e in i)h.JSONExt.deepEqual(i[e],t[e]||null)||s.set(e,i[e]);for(const e in t)e in i||s.delete(e)}}_setValue(){this._dataDirty=!1,this._inputDirty=!1,this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.removeClass(u);const e=this.editor.model,t=this._source?this._source.toJSON():{};if(this._changeGuard=!0,void 0===t)e.sharedModel.setSource(this._trans.__("No data!")),this._originalValue=h.JSONExt.emptyObject;else{const i=JSON.stringify(t,null,4);e.sharedModel.setSource(i),this._originalValue=t,i.length>1&&"{"===i[0]&&this.editor.setCursorPosition({line:0,column:1})}this._changeGuard=!1,this.commitButtonNode.hidden=!0,this.revertButtonNode.hidden=!0}}var p=i(58515),_=i(78156),g=i.n(_),v=i(72703);class C extends g().Component{constructor(e){super(e),this._handleChange=e=>{this.setState({value:e.currentTarget.value})},this._handleSubmit=e=>{e.preventDefault();const t=parseInt(this._textInput.value,10);return!isNaN(t)&&isFinite(t)&&1<=t&&t<=this.props.maxLine&&this.props.handleSubmit(t),!1},this._handleFocus=()=>{this.setState({hasFocus:!0})},this._handleBlur=()=>{this.setState({hasFocus:!1})},this._textInput=null,this.translator=e.translator||d.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.state={value:"",hasFocus:!1,textInputId:v.DOMUtils.createDomID()+"-line-number-input"}}componentDidMount(){this._textInput.focus()}render(){return g().createElement("div",{className:"jp-lineFormSearch"},g().createElement("form",{name:"lineColumnForm",onSubmit:this._handleSubmit,noValidate:!0},g().createElement("div",{className:(0,l.classes)("jp-lineFormWrapper","lm-lineForm-wrapper",this.state.hasFocus?"jp-lineFormWrapperFocusWithin":void 0)},g().createElement("input",{type:"text",id:this.state.textInputId,className:"jp-lineFormInput",onChange:this._handleChange,onFocus:this._handleFocus,onBlur:this._handleBlur,value:this.state.value,ref:e=>{this._textInput=e}}),g().createElement("div",{className:"jp-baseLineForm jp-lineFormButtonContainer"},g().createElement(l.lineFormIcon.react,{className:"jp-baseLineForm jp-lineFormButtonIcon",elementPosition:"center"}),g().createElement("input",{type:"submit",className:"jp-baseLineForm jp-lineFormButton",value:""}))),g().createElement("label",{className:"jp-lineFormCaption",htmlFor:this.state.textInputId},this._trans.__("Go to line number between 1 and %1",this.props.maxLine))))}}function y(e){const t=(e.translator||d.nullTranslator).load("jupyterlab");return g().createElement(p.TextItem,{onClick:e.handleClick,source:t.__("Ln %1, Col %2",e.line,e.column),title:t.__("Go to line number…"),tabIndex:0,onKeyDown:t=>{"Enter"!==t.key&&"Spacebar"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),e.handleClick())}})}class f extends l.VDomRenderer{constructor(e){super(new f.Model),this._popup=null,this.addClass("jp-mod-highlighted"),this.translator=e||d.nullTranslator}render(){return null===this.model?null:g().createElement(y,{line:this.model.line,column:this.model.column,translator:this.translator,handleClick:()=>this._handleClick()})}_handleClick(){this._popup&&this._popup.dispose();const e=l.ReactWidget.create(g().createElement(C,{handleSubmit:e=>this._handleSubmit(e),currentLine:this.model.line,maxLine:this.model.editor.lineCount,translator:this.translator}));this._popup=(0,p.showPopup)({body:e,anchor:this,align:"right"})}_handleSubmit(e){this.model.editor.setCursorPosition({line:e-1,column:0}),this._popup.dispose(),this.model.editor.focus()}}!function(e){class t extends l.VDomModel{constructor(){super(...arguments),this._onSelectionChanged=()=>{const e=this._getAllState(),t=this.editor.getCursorPosition();this._line=t.line+1,this._column=t.column+1,this._triggerChange(e,this._getAllState())},this._line=1,this._column=1,this._editor=null}get editor(){return this._editor}set editor(e){var t;const i=this._editor;(null===(t=null==i?void 0:i.model)||void 0===t?void 0:t.selections)&&i.model.selections.changed.disconnect(this._onSelectionChanged);const s=this._getAllState();if(this._editor=e,this._editor){this._editor.model.selections.changed.connect(this._onSelectionChanged);const e=this._editor.getCursorPosition();this._column=e.column+1,this._line=e.line+1}else this._column=1,this._line=1;this._triggerChange(s,this._getAllState())}get line(){return this._line}get column(){return this._column}_getAllState(){return[this._line,this._column]}_triggerChange(e,t){e[0]===t[0]&&e[1]===t[1]||this.stateChanged.emit(void 0)}}e.Model=t}(f||(f={}));const E="jp-mod-completer-enabled",D="jp-mod-completer-active",S=new h.Token("@jupyterlab/codeeditor:IEditorServices","A service for the text editor provider\n for the application. Use this to create new text editors and host them in your\n UI elements."),N=new h.Token("@jupyterlab/codeeditor:IPositionModel","A service to handle an code editor cursor position."),T="jp-mod-has-primary-selection",O="jp-mod-in-leading-whitespace",b="jp-mod-dropTarget",x=/^\s+$/;class L extends c.Widget{constructor(e){super();const{factory:t,model:i,editorOptions:s}=e;(this.editor=t({host:this.node,model:i,...s})).model.selections.changed.connect(this._onSelectionsChanged,this)}get model(){return this.editor.model}dispose(){this.isDisposed||(this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e)}}onActivateRequest(e){this.editor.focus()}onAfterAttach(e){super.onAfterAttach(e);const t=this.node;t.addEventListener("lm-dragenter",this),t.addEventListener("lm-dragleave",this),t.addEventListener("lm-dragover",this),t.addEventListener("lm-drop",this)}onBeforeDetach(e){const t=this.node;t.removeEventListener("lm-dragenter",this),t.removeEventListener("lm-dragleave",this),t.removeEventListener("lm-dragover",this),t.removeEventListener("lm-drop",this)}_onSelectionsChanged(){const{start:e,end:t}=this.editor.getSelection();e.column!==t.column||e.line!==t.line?(this.addClass(T),this.removeClass(O)):(this.removeClass(T),this.editor.getLine(t.line).slice(0,t.column).match(x)?this.addClass(O):this.removeClass(O))}_evtDragEnter(e){!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation(),this.addClass("jp-mod-dropTarget"))}_evtDragLeave(e){this.removeClass(b),!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation())}_evtDragOver(e){this.removeClass(b),!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation(),e.dropAction="copy",this.addClass(b))}_evtDrop(e){if(!0===this.editor.getOption("readOnly"))return;const t=M.findTextData(e.mimeData);if(void 0===t)return;const i={top:e.y,bottom:e.y,left:e.x,right:e.x},s=this.editor.getPositionForCoordinate(i);if(null===s)return;if(this.removeClass(b),e.preventDefault(),e.stopPropagation(),"none"===e.proposedAction)return void(e.dropAction="none");const o=this.editor.getOffsetAt(s);this.model.sharedModel.updateSource(o,o,t)}}var M;!function(e){e.findTextData=function(e){const t=e.types().find((e=>0===e.indexOf("text")));if(void 0!==t)return e.getData(t)}}(M||(M={}));class j extends c.Widget{constructor(e){var t;super(),this.model=e.model;const i=new L({factory:e.factory,model:this.model,editorOptions:{...e.editorOptions,config:{...null===(t=e.editorOptions)||void 0===t?void 0:t.config,readOnly:!0}}});this.editor=i.editor,(this.layout=new c.StackedLayout).addWidget(i)}static createCodeViewer(e){const{content:t,mimeType:i,...s}=e,n=new o.Model({mimeType:i});n.sharedModel.setSource(t);const r=new j({...s,model:n});return r.disposed.connect((()=>{n.dispose()})),r}get content(){return this.model.sharedModel.getSource()}get mimeType(){return this.model.mimeType}}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7391],{77391:(e,t,i)=>{i.r(t),i.d(t,{COMPLETER_ACTIVE_CLASS:()=>D,COMPLETER_ENABLED_CLASS:()=>E,CodeEditor:()=>o,CodeEditorWrapper:()=>L,CodeViewerWidget:()=>j,IEditorMimeTypeService:()=>s,IEditorServices:()=>S,IPositionModel:()=>N,JSONEditor:()=>m,LineCol:()=>f});var s,o,n=i(42763),r=i(71370),a=i(2159);!function(e){e.defaultMimeType="text/plain"}(s||(s={})),function(e){e.Model=class{constructor(e={}){var t,i;this.standaloneModel=!1,this._isDisposed=!1,this._selections=new r.ObservableMap,this._mimeType=s.defaultMimeType,this._mimeTypeChanged=new a.Signal(this),this.standaloneModel=void 0===e.sharedModel,this.sharedModel=null!==(t=e.sharedModel)&&void 0!==t?t:new n.YFile,this._mimeType=null!==(i=e.mimeType)&&void 0!==i?i:s.defaultMimeType}get mimeTypeChanged(){return this._mimeTypeChanged}get selections(){return this._selections}get mimeType(){return this._mimeType}set mimeType(e){const t=this.mimeType;t!==e&&(this._mimeType=e,this._mimeTypeChanged.emit({name:"mimeType",oldValue:t,newValue:e}))}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._selections.dispose(),this.standaloneModel&&this.sharedModel.dispose(),a.Signal.clearData(this))}}}(o||(o={}));var d=i(93050),l=i(76878),h=i(21961),c=i(2260);const u="jp-mod-error";class m extends c.Widget{constructor(e){super(),this._dataDirty=!1,this._inputDirty=!1,this._source=null,this._originalValue=h.JSONExt.emptyObject,this._changeGuard=!1,this.translator=e.translator||d.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.addClass("jp-JSONEditor"),this.headerNode=document.createElement("div"),this.headerNode.className="jp-JSONEditor-header",this.revertButtonNode=l.undoIcon.element({tag:"span",title:this._trans.__("Revert changes to data")}),this.commitButtonNode=l.checkIcon.element({tag:"span",title:this._trans.__("Commit changes to data"),marginLeft:"8px"}),this.editorHostNode=document.createElement("div"),this.editorHostNode.className="jp-JSONEditor-host",this.headerNode.appendChild(this.revertButtonNode),this.headerNode.appendChild(this.commitButtonNode),this.node.appendChild(this.headerNode),this.node.appendChild(this.editorHostNode);const t=new o.Model({mimeType:"application/json"});t.sharedModel.changed.connect(this._onModelChanged,this),this.model=t,this.editor=e.editorFactory({host:this.editorHostNode,model:t,config:{readOnly:!0}})}get source(){return this._source}set source(e){this._source!==e&&(this._source&&this._source.changed.disconnect(this._onSourceChanged,this),this._source=e,this.editor.setOption("readOnly",null===e),e&&e.changed.connect(this._onSourceChanged,this),this._setValue())}get isDirty(){return this._dataDirty||this._inputDirty}dispose(){var e;this.isDisposed||(null===(e=this.source)||void 0===e||e.dispose(),this.model.dispose(),this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"blur":this._evtBlur(e);break;case"click":this._evtClick(e)}}onAfterAttach(e){const t=this.editorHostNode;t.addEventListener("blur",this,!0),t.addEventListener("click",this,!0),this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.headerNode.addEventListener("click",this)}onBeforeDetach(e){const t=this.editorHostNode;t.removeEventListener("blur",this,!0),t.removeEventListener("click",this,!0),this.headerNode.removeEventListener("click",this)}_onSourceChanged(e,t){this._changeGuard||(this._inputDirty||this.editor.hasFocus()?this._dataDirty=!0:this._setValue())}_onModelChanged(e,t){if(t.sourceChange){let e=!0;try{const e=JSON.parse(this.editor.model.sharedModel.getSource());this.removeClass(u),this._inputDirty=!this._changeGuard&&!h.JSONExt.deepEqual(e,this._originalValue)}catch(t){this.addClass(u),this._inputDirty=!0,e=!1}this.revertButtonNode.hidden=!this._inputDirty,this.commitButtonNode.hidden=!e||!this._inputDirty}}_evtBlur(e){!this._inputDirty&&this._dataDirty&&this._setValue()}_evtClick(e){const t=e.target;this.revertButtonNode.contains(t)?this._setValue():this.commitButtonNode.contains(t)?this.commitButtonNode.hidden||this.hasClass(u)||(this._changeGuard=!0,this._mergeContent(),this._changeGuard=!1,this._setValue()):this.editorHostNode.contains(t)&&this.editor.focus()}_mergeContent(){const e=this.editor.model,t=this._originalValue,i=JSON.parse(e.sharedModel.getSource()),s=this.source;if(s){for(const e in i)h.JSONExt.deepEqual(i[e],t[e]||null)||s.set(e,i[e]);for(const e in t)e in i||s.delete(e)}}_setValue(){this._dataDirty=!1,this._inputDirty=!1,this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.removeClass(u);const e=this.editor.model,t=this._source?this._source.toJSON():{};if(this._changeGuard=!0,void 0===t)e.sharedModel.setSource(this._trans.__("No data!")),this._originalValue=h.JSONExt.emptyObject;else{const i=JSON.stringify(t,null,4);e.sharedModel.setSource(i),this._originalValue=t,i.length>1&&"{"===i[0]&&this.editor.setCursorPosition({line:0,column:1})}this._changeGuard=!1,this.commitButtonNode.hidden=!0,this.revertButtonNode.hidden=!0}}var p=i(33441),_=i(78156),g=i.n(_),v=i(53876);class C extends g().Component{constructor(e){super(e),this._handleChange=e=>{this.setState({value:e.currentTarget.value})},this._handleSubmit=e=>{e.preventDefault();const t=parseInt(this._textInput.value,10);return!isNaN(t)&&isFinite(t)&&1<=t&&t<=this.props.maxLine&&this.props.handleSubmit(t),!1},this._handleFocus=()=>{this.setState({hasFocus:!0})},this._handleBlur=()=>{this.setState({hasFocus:!1})},this._textInput=null,this.translator=e.translator||d.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.state={value:"",hasFocus:!1,textInputId:v.DOMUtils.createDomID()+"-line-number-input"}}componentDidMount(){this._textInput.focus()}render(){return g().createElement("div",{className:"jp-lineFormSearch"},g().createElement("form",{name:"lineColumnForm",onSubmit:this._handleSubmit,noValidate:!0},g().createElement("div",{className:(0,l.classes)("jp-lineFormWrapper","lm-lineForm-wrapper",this.state.hasFocus?"jp-lineFormWrapperFocusWithin":void 0)},g().createElement("input",{type:"text",id:this.state.textInputId,className:"jp-lineFormInput",onChange:this._handleChange,onFocus:this._handleFocus,onBlur:this._handleBlur,value:this.state.value,ref:e=>{this._textInput=e}}),g().createElement("div",{className:"jp-baseLineForm jp-lineFormButtonContainer"},g().createElement(l.lineFormIcon.react,{className:"jp-baseLineForm jp-lineFormButtonIcon",elementPosition:"center"}),g().createElement("input",{type:"submit",className:"jp-baseLineForm jp-lineFormButton",value:""}))),g().createElement("label",{className:"jp-lineFormCaption",htmlFor:this.state.textInputId},this._trans.__("Go to line number between 1 and %1",this.props.maxLine))))}}function y(e){const t=(e.translator||d.nullTranslator).load("jupyterlab");return g().createElement(p.TextItem,{onClick:e.handleClick,source:t.__("Ln %1, Col %2",e.line,e.column),title:t.__("Go to line number…"),tabIndex:0,onKeyDown:t=>{"Enter"!==t.key&&"Spacebar"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),e.handleClick())}})}class f extends l.VDomRenderer{constructor(e){super(new f.Model),this._popup=null,this.addClass("jp-mod-highlighted"),this.translator=e||d.nullTranslator}render(){return null===this.model?null:g().createElement(y,{line:this.model.line,column:this.model.column,translator:this.translator,handleClick:()=>this._handleClick()})}_handleClick(){this._popup&&this._popup.dispose();const e=l.ReactWidget.create(g().createElement(C,{handleSubmit:e=>this._handleSubmit(e),currentLine:this.model.line,maxLine:this.model.editor.lineCount,translator:this.translator}));this._popup=(0,p.showPopup)({body:e,anchor:this,align:"right"})}_handleSubmit(e){this.model.editor.setCursorPosition({line:e-1,column:0}),this._popup.dispose(),this.model.editor.focus()}}!function(e){class t extends l.VDomModel{constructor(){super(...arguments),this._onSelectionChanged=()=>{const e=this._getAllState(),t=this.editor.getCursorPosition();this._line=t.line+1,this._column=t.column+1,this._triggerChange(e,this._getAllState())},this._line=1,this._column=1,this._editor=null}get editor(){return this._editor}set editor(e){var t;const i=this._editor;(null===(t=null==i?void 0:i.model)||void 0===t?void 0:t.selections)&&i.model.selections.changed.disconnect(this._onSelectionChanged);const s=this._getAllState();if(this._editor=e,this._editor){this._editor.model.selections.changed.connect(this._onSelectionChanged);const e=this._editor.getCursorPosition();this._column=e.column+1,this._line=e.line+1}else this._column=1,this._line=1;this._triggerChange(s,this._getAllState())}get line(){return this._line}get column(){return this._column}_getAllState(){return[this._line,this._column]}_triggerChange(e,t){e[0]===t[0]&&e[1]===t[1]||this.stateChanged.emit(void 0)}}e.Model=t}(f||(f={}));const E="jp-mod-completer-enabled",D="jp-mod-completer-active",S=new h.Token("@jupyterlab/codeeditor:IEditorServices","A service for the text editor provider\n for the application. Use this to create new text editors and host them in your\n UI elements."),N=new h.Token("@jupyterlab/codeeditor:IPositionModel","A service to handle an code editor cursor position."),T="jp-mod-has-primary-selection",O="jp-mod-in-leading-whitespace",b="jp-mod-dropTarget",x=/^\s+$/;class L extends c.Widget{constructor(e){super();const{factory:t,model:i,editorOptions:s}=e;(this.editor=t({host:this.node,model:i,...s})).model.selections.changed.connect(this._onSelectionsChanged,this)}get model(){return this.editor.model}dispose(){this.isDisposed||(this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e)}}onActivateRequest(e){this.editor.focus()}onAfterAttach(e){super.onAfterAttach(e);const t=this.node;t.addEventListener("lm-dragenter",this),t.addEventListener("lm-dragleave",this),t.addEventListener("lm-dragover",this),t.addEventListener("lm-drop",this)}onBeforeDetach(e){const t=this.node;t.removeEventListener("lm-dragenter",this),t.removeEventListener("lm-dragleave",this),t.removeEventListener("lm-dragover",this),t.removeEventListener("lm-drop",this)}_onSelectionsChanged(){const{start:e,end:t}=this.editor.getSelection();e.column!==t.column||e.line!==t.line?(this.addClass(T),this.removeClass(O)):(this.removeClass(T),this.editor.getLine(t.line).slice(0,t.column).match(x)?this.addClass(O):this.removeClass(O))}_evtDragEnter(e){!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation(),this.addClass("jp-mod-dropTarget"))}_evtDragLeave(e){this.removeClass(b),!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation())}_evtDragOver(e){this.removeClass(b),!0!==this.editor.getOption("readOnly")&&void 0!==M.findTextData(e.mimeData)&&(e.preventDefault(),e.stopPropagation(),e.dropAction="copy",this.addClass(b))}_evtDrop(e){if(!0===this.editor.getOption("readOnly"))return;const t=M.findTextData(e.mimeData);if(void 0===t)return;const i={top:e.y,bottom:e.y,left:e.x,right:e.x},s=this.editor.getPositionForCoordinate(i);if(null===s)return;if(this.removeClass(b),e.preventDefault(),e.stopPropagation(),"none"===e.proposedAction)return void(e.dropAction="none");const o=this.editor.getOffsetAt(s);this.model.sharedModel.updateSource(o,o,t)}}var M;!function(e){e.findTextData=function(e){const t=e.types().find((e=>0===e.indexOf("text")));if(void 0!==t)return e.getData(t)}}(M||(M={}));class j extends c.Widget{constructor(e){var t;super(),this.model=e.model;const i=new L({factory:e.factory,model:this.model,editorOptions:{...e.editorOptions,config:{...null===(t=e.editorOptions)||void 0===t?void 0:t.config,readOnly:!0}}});this.editor=i.editor,(this.layout=new c.StackedLayout).addWidget(i)}static createCodeViewer(e){const{content:t,mimeType:i,...s}=e,n=new o.Model({mimeType:i});n.sharedModel.setSource(t);const r=new j({...s,model:n});return r.disposed.connect((()=>{n.dispose()})),r}get content(){return this.model.sharedModel.getSource()}get mimeType(){return this.model.mimeType}}}}]);
|
notebook/static/7450.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7450],{67450:(e,t,n)=>{n.r(t),n.d(t,{blockComment:()=>h,blockUncomment:()=>m,copyLineDown:()=>Jt,copyLineUp:()=>Nt,cursorCharBackward:()=>ne,cursorCharForward:()=>te,cursorCharLeft:()=>Z,cursorCharRight:()=>ee,cursorDocEnd:()=>ct,cursorDocStart:()=>st,cursorGroupBackward:()=>ae,cursorGroupForward:()=>le,cursorGroupLeft:()=>oe,cursorGroupRight:()=>ie,cursorLineBoundaryBackward:()=>De,cursorLineBoundaryForward:()=>Ee,cursorLineBoundaryLeft:()=>xe,cursorLineBoundaryRight:()=>Le,cursorLineDown:()=>we,cursorLineEnd:()=>Te,cursorLineStart:()=>Me,cursorLineUp:()=>ke,cursorMatchingBracket:()=>Oe,cursorPageDown:()=>Ce,cursorPageUp:()=>Ae,cursorSubwordBackward:()=>fe,cursorSubwordForward:()=>de,cursorSyntaxLeft:()=>pe,cursorSyntaxRight:()=>ge,defaultKeymap:()=>Xt,deleteCharBackward:()=>wt,deleteCharBackwardStrict:()=>St,deleteCharForward:()=>vt,deleteGroupBackward:()=>Ct,deleteGroupForward:()=>Bt,deleteLine:()=>Pt,deleteLineBoundaryBackward:()=>xt,deleteLineBoundaryForward:()=>Lt,deleteToLineEnd:()=>Et,deleteToLineStart:()=>Dt,deleteTrailingWhitespace:()=>Mt,emacsStyleKeymap:()=>Yt,history:()=>E,historyField:()=>D,historyKeymap:()=>K,indentLess:()=>jt,indentMore:()=>$t,indentSelection:()=>Kt,indentWithTab:()=>Zt,insertBlankLine:()=>zt,insertNewline:()=>Gt,insertNewlineAndIndent:()=>Ht,insertNewlineKeepIndent:()=>Ft,insertTab:()=>qt,invertedEffects:()=>A,isolateHistory:()=>v,lineComment:()=>u,lineUncomment:()=>d,moveLineDown:()=>Ut,moveLineUp:()=>Rt,redo:()=>M,redoDepth:()=>R,redoSelection:()=>b,selectAll:()=>ft,selectCharBackward:()=>Pe,selectCharForward:()=>Je,selectCharLeft:()=>Ve,selectCharRight:()=>Ne,selectDocEnd:()=>dt,selectDocStart:()=>ut,selectGroupBackward:()=>We,selectGroupForward:()=>ze,selectGroupLeft:()=>Fe,selectGroupRight:()=>He,selectLine:()=>ht,selectLineBoundaryBackward:()=>rt,selectLineBoundaryForward:()=>nt,selectLineBoundaryLeft:()=>ot,selectLineBoundaryRight:()=>it,selectLineDown:()=>Xe,selectLineEnd:()=>at,selectLineStart:()=>lt,selectLineUp:()=>Qe,selectMatchingBracket:()=>Ie,selectPageDown:()=>tt,selectPageUp:()=>et,selectParentSyntax:()=>mt,selectSubwordBackward:()=>$e,selectSubwordForward:()=>Ke,selectSyntaxLeft:()=>je,selectSyntaxRight:()=>qe,simplifySelection:()=>pt,splitLine:()=>Tt,standardKeymap:()=>Qt,toggleBlockComment:()=>f,toggleBlockCommentByLine:()=>p,toggleComment:()=>a,toggleLineComment:()=>c,transposeChars:()=>bt,undo:()=>L,undoDepth:()=>I,undoSelection:()=>T});var r=n(89843),o=n(45195),i=n(17592),l=n(79352);const a=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=g(e.state,n.from);return r.line?c(e):!!r.block&&p(e)};function s(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);return!!o&&(r(n.update(o)),!0)}}const c=s(w,0),u=s(w,1),d=s(w,2),f=s(k,0),h=s(k,1),m=s(k,2),p=s(((e,t)=>k(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to),i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=o.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}(t))),0);function g(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const y=50;function k(e,t,n=t.selection.ranges){let r=n.map((e=>g(t,e.from).block));if(!r.every((e=>e)))return null;let o=n.map(((e,n)=>function(e,{open:t,close:n},r,o){let i,l,a=e.sliceDoc(r-y,r),s=e.sliceDoc(o,o+y),c=/\s*$/.exec(a)[0].length,u=/^\s*/.exec(s)[0].length,d=a.length-c;if(a.slice(d-t.length,d)==t&&s.slice(u,u+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:o+u,margin:u&&1}};o-r<=2*y?i=l=e.sliceDoc(r,o):(i=e.sliceDoc(r,r+y),l=e.sliceDoc(o-y,o));let f=/^\s*/.exec(i)[0].length,h=/\s*$/.exec(l)[0].length,m=l.length-h-n.length;return i.slice(f,f+t.length)==t&&l.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:/\s/.test(i.charAt(f+t.length))?1:0},close:{pos:o-h-n.length,margin:/\s/.test(l.charAt(m-1))?1:0}}:null}(t,r[n],e.from,e.to)));if(2!=e&&!o.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>o[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}])))};if(1!=e&&o.some((e=>e))){let e=[];for(let t,n=0;n<o.length;n++)if(t=o[n]){let o=r[n],{open:i,close:l}=t;e.push({from:i.pos-o.open.length,to:i.pos+i.margin},{from:l.pos-l.margin,to:l.pos+o.close.length})}return{changes:e}}return null}function w(e,t,n=t.selection.ranges){let r=[],o=-1;for(let{from:e,to:i}of n){let n=r.length,l=1e9,a=g(t,e).line;if(a){for(let n=e;n<=i;){let s=t.doc.lineAt(n);if(s.from>o&&(e==i||i>s.from)){o=s.from;let e=/^\s*/.exec(s.text)[0].length,t=e==s.length,n=s.text.slice(e,e+a.length)==a?e:-1;e<s.text.length&&e<l&&(l=e),r.push({line:s,comment:n,token:a,indent:e,empty:t,single:!1})}n=s.to+1}if(l<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=l);r.length==n+1&&(r[n].single=!0)}}if(2!=e&&r.some((e=>e.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:o,empty:i,single:l}of r)!l&&i||e.push({from:t.from+o,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:o}of r)if(n>=0){let r=t.from+n,i=r+o.length;" "==t.text[i-t.from]&&i++,e.push({from:r,to:i})}return{changes:e}}return null}const S=r.Annotation.define(),v=r.Annotation.define(),A=r.Facet.define(),C=r.Facet.define({combine:e=>(0,r.combineConfig)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),B=r.StateField.define({create:()=>_.empty,update(e,t){let n=t.state.facet(C),o=t.annotation(S);if(o){let r=U.fromTransaction(t,o.selection),i=o.side,l=0==i?e.undone:e.done;return l=r?V(l,l.length,n.minDepth,r):G(l,t.startState.selection),new _(0==i?o.rest:l,0==i?l:o.rest)}let i=t.annotation(v);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(r.Transaction.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let l=U.fromTransaction(t),a=t.annotation(r.Transaction.time),s=t.annotation(r.Transaction.userEvent);return l?e=e.addChanges(l,a,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,a,s,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON:e=>({done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}),fromJSON:e=>new _(e.done.map(U.fromJSON),e.undone.map(U.fromJSON))});function E(e={}){return[B,C.of(e),o.EditorView.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?L:"historyRedo"==e.inputType?M:null;return!!n&&(e.preventDefault(),n(t))}})]}const D=B;function x(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(B,!1);if(!o)return!1;let i=o.pop(e,n,t);return!!i&&(r(i),!0)}}const L=x(0,!1),M=x(1,!1),T=x(0,!0),b=x(1,!0);function O(e){return function(t){let n=t.field(B,!1);if(!n)return 0;let r=0==e?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const I=O(0),R=O(1);class U{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new U(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new U(e.changes&&r.ChangeSet.fromJSON(e.changes),[],e.mapped&&r.ChangeDesc.fromJSON(e.mapped),e.startSelection&&r.EditorSelection.fromJSON(e.startSelection),e.selectionsAfter.map(r.EditorSelection.fromJSON))}static fromTransaction(e,t){let n=J;for(let t of e.startState.facet(A)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new U(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,J)}static selection(e){return new U(void 0,J,void 0,void 0,e)}}function V(e,t,n,r){let o=t+1>n+20?t-n-1:0,i=e.slice(o,t);return i.push(r),i}function N(e,t){return e.length?t.length?e.concat(t):e:t}const J=[],P=200;function G(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-P));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),V(e,e.length-1,1e9,n.setSelAfter(r)))}return[U.selection([t])]}function F(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function H(e,t){if(!e.length)return e;let n=e.length,r=J;for(;n;){let o=z(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let t=e.slice(0,n);return t[n-1]=o,t}t=o.mapped,n--,r=o.selectionsAfter}return r.length?[U.selection(r)]:J}function z(e,t,n){let o=N(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):J,n);if(!e.changes)return U.selection(o);let i=e.changes.map(t),l=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(l):l;return new U(i,r.StateEffect.mapEffects(e.effects,t),a,e.startSelection.map(l),o)}const W=/^(input\.type|delete)($|\.)/;class _{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new _(this.done,this.undone):this}addChanges(e,t,n,r,o){let i=this.done,l=i[i.length-1];return i=l&&l.changes&&!l.changes.empty&&e.changes&&(!n||W.test(n))&&(!l.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,function(e,t){let n=[],r=!1;return e.iterChangedRanges(((e,t)=>n.push(e,t))),t.iterChangedRanges(((e,t,o,i)=>{for(let e=0;e<n.length;){let t=n[e++],l=n[e++];i>=t&&o<=l&&(r=!0)}})),r}(l.changes,e.changes))||"input.type.compose"==n)?V(i,i.length-1,r.minDepth,new U(e.changes.compose(l.changes),N(e.effects,l.effects),l.mapped,l.startSelection,J)):V(i,i.length,r.minDepth,e),new _(i,J,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:J;return o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=o[o.length-1],l=e,i.ranges.length==l.ranges.length&&0===i.ranges.filter(((e,t)=>e.empty!=l.ranges[t].empty)).length)?this:new _(G(this.done,e),this.undone,t,n);var i,l}addMapping(e){return new _(H(this.done,e),H(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let o=r[r.length-1],i=o.selectionsAfter[0]||t.selection;if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:S.of({side:e,rest:F(r),selection:i}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let n=1==r.length?J:r.slice(0,r.length-1);return o.mapped&&(n=H(n,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:S.of({side:e,rest:n,selection:i}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}_.empty=new _(J,J);const K=[{key:"Mod-z",run:L,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:M,preventDefault:!0},{linux:"Ctrl-Shift-z",run:M,preventDefault:!0},{key:"Mod-u",run:T,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:b,preventDefault:!0}];function $(e,t){return r.EditorSelection.create(e.ranges.map(t),e.mainIndex)}function j(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function q({state:e,dispatch:t},n){let r=$(e.selection,n);return!r.eq(e.selection,!0)&&(t(j(e,r)),!0)}function Y(e,t){return r.EditorSelection.cursor(t?e.to:e.from)}function Q(e,t){return q(e,(n=>n.empty?e.moveByChar(n,t):Y(n,t)))}function X(e){return e.textDirectionAt(e.state.selection.main.head)==o.Direction.LTR}const Z=e=>Q(e,!X(e)),ee=e=>Q(e,X(e)),te=e=>Q(e,!0),ne=e=>Q(e,!1);function re(e,t){return q(e,(n=>n.empty?e.moveByGroup(n,t):Y(n,t)))}const oe=e=>re(e,!X(e)),ie=e=>re(e,X(e)),le=e=>re(e,!0),ae=e=>re(e,!1),se="undefined"!=typeof Intl&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ce(e,t,n){let o=e.state.charCategorizer(t.from),i=r.CharCategory.Space,l=t.from,a=0,s=!1,c=!1,u=!1,d=t=>{if(s)return!1;l+=n?t.length:-t.length;let d,f=o(t);if(f==r.CharCategory.Word&&t.charCodeAt(0)<128&&/[\W_]/.test(t)&&(f=-1),i==r.CharCategory.Space&&(i=f),i!=f)return!1;if(i==r.CharCategory.Word)if(t.toLowerCase()==t){if(!n&&c)return!1;u=!0}else if(u){if(n)return!1;s=!0}else{if(c&&n&&o(d=e.state.sliceDoc(l,l+1))==r.CharCategory.Word&&d.toLowerCase()==d)return!1;c=!0}return a++,!0},f=e.moveByChar(t,n,(e=>(d(e),d)));if(se&&i==r.CharCategory.Word&&f.from==t.from+a*(n?1:-1)){let o=Math.min(t.head,f.head),i=Math.max(t.head,f.head),l=e.state.sliceDoc(o,i);if(l.length>1&&/[\u4E00-\uffff]/.test(l)){let e=Array.from(se.segment(l));if(e.length>1)return n?r.EditorSelection.cursor(t.head+e[1].index,-1):r.EditorSelection.cursor(f.head+e[e.length-1].index,1)}}return f}function ue(e,t){return q(e,(n=>n.empty?ce(e,n,t):Y(n,t)))}const de=e=>ue(e,!0),fe=e=>ue(e,!1);function he(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function me(e,t,n){let o,a,s=(0,i.syntaxTree)(e).resolveInner(t.head),c=n?l.NodeProp.closedBy:l.NodeProp.openedBy;for(let r=t.head;;){let t=n?s.childAfter(r):s.childBefore(r);if(!t)break;he(e,t,c)?s=t:r=n?t.to:t.from}return a=s.type.prop(c)&&(o=n?(0,i.matchBrackets)(e,s.from,1):(0,i.matchBrackets)(e,s.to,-1))&&o.matched?n?o.end.to:o.end.from:n?s.to:s.from,r.EditorSelection.cursor(a,n?-1:1)}const pe=e=>q(e,(t=>me(e.state,t,!X(e)))),ge=e=>q(e,(t=>me(e.state,t,X(e))));function ye(e,t){return q(e,(n=>{if(!n.empty)return Y(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)}))}const ke=e=>ye(e,!1),we=e=>ye(e,!0);function Se(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0;if(n){for(let t of e.state.facet(o.EditorView.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(r=Math.max(null==n?void 0:n.top,r)),(null==n?void 0:n.bottom)&&(i=Math.max(null==n?void 0:n.bottom,i))}t=e.scrollDOM.clientHeight-r-i}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function ve(e,t){let n,r=Se(e),{state:i}=e,l=$(i.selection,(n=>n.empty?e.moveVertically(n,t,r.height):Y(n,t)));if(l.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),s=a.top+r.marginTop,c=a.bottom-r.marginBottom;t&&t.top>s&&t.bottom<c&&(n=o.EditorView.scrollIntoView(l.main.head,{y:"start",yMargin:t.top-s}))}return e.dispatch(j(i,l),{effects:n}),!0}const Ae=e=>ve(e,!1),Ce=e=>ve(e,!0);function Be(e,t,n){let o=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?o.to:o.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==o.from&&o.length){let n=/^\s*/.exec(e.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;n&&t.head!=o.from+n&&(i=r.EditorSelection.cursor(o.from+n))}return i}const Ee=e=>q(e,(t=>Be(e,t,!0))),De=e=>q(e,(t=>Be(e,t,!1))),xe=e=>q(e,(t=>Be(e,t,!X(e)))),Le=e=>q(e,(t=>Be(e,t,X(e)))),Me=e=>q(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).from,1))),Te=e=>q(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).to,-1)));function be(e,t,n){let o=!1,l=$(e.selection,(t=>{let l=(0,i.matchBrackets)(e,t.head,-1)||(0,i.matchBrackets)(e,t.head,1)||t.head>0&&(0,i.matchBrackets)(e,t.head-1,1)||t.head<e.doc.length&&(0,i.matchBrackets)(e,t.head+1,-1);if(!l||!l.end)return t;o=!0;let a=l.start.from==t.head?l.end.to:l.end.from;return n?r.EditorSelection.range(t.anchor,a):r.EditorSelection.cursor(a)}));return!!o&&(t(j(e,l)),!0)}const Oe=({state:e,dispatch:t})=>be(e,t,!1),Ie=({state:e,dispatch:t})=>be(e,t,!0);function Re(e,t){let n=$(e.state.selection,(e=>{let n=t(e);return r.EditorSelection.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(j(e.state,n)),!0)}function Ue(e,t){return Re(e,(n=>e.moveByChar(n,t)))}const Ve=e=>Ue(e,!X(e)),Ne=e=>Ue(e,X(e)),Je=e=>Ue(e,!0),Pe=e=>Ue(e,!1);function Ge(e,t){return Re(e,(n=>e.moveByGroup(n,t)))}const Fe=e=>Ge(e,!X(e)),He=e=>Ge(e,X(e)),ze=e=>Ge(e,!0),We=e=>Ge(e,!1);function _e(e,t){return Re(e,(n=>ce(e,n,t)))}const Ke=e=>_e(e,!0),$e=e=>_e(e,!1),je=e=>Re(e,(t=>me(e.state,t,!X(e)))),qe=e=>Re(e,(t=>me(e.state,t,X(e))));function Ye(e,t){return Re(e,(n=>e.moveVertically(n,t)))}const Qe=e=>Ye(e,!1),Xe=e=>Ye(e,!0);function Ze(e,t){return Re(e,(n=>e.moveVertically(n,t,Se(e).height)))}const et=e=>Ze(e,!1),tt=e=>Ze(e,!0),nt=e=>Re(e,(t=>Be(e,t,!0))),rt=e=>Re(e,(t=>Be(e,t,!1))),ot=e=>Re(e,(t=>Be(e,t,!X(e)))),it=e=>Re(e,(t=>Be(e,t,X(e)))),lt=e=>Re(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).from))),at=e=>Re(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).to))),st=({state:e,dispatch:t})=>(t(j(e,{anchor:0})),!0),ct=({state:e,dispatch:t})=>(t(j(e,{anchor:e.doc.length})),!0),ut=({state:e,dispatch:t})=>(t(j(e,{anchor:e.selection.main.anchor,head:0})),!0),dt=({state:e,dispatch:t})=>(t(j(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ft=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),ht=({state:e,dispatch:t})=>{let n=Ot(e).map((({from:t,to:n})=>r.EditorSelection.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:r.EditorSelection.create(n),userEvent:"select"})),!0},mt=({state:e,dispatch:t})=>{let n=$(e.selection,(t=>{var n;for(let o=(0,i.syntaxTree)(e).resolveStack(t.from,1);o;o=o.next){let{node:e}=o;if((e.from<t.from&&e.to>=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent))return r.EditorSelection.range(e.to,e.from)}return t}));return t(j(e,n)),!0},pt=({state:e,dispatch:t})=>{let n=e.selection,o=null;return n.ranges.length>1?o=r.EditorSelection.create([n.main]):n.main.empty||(o=r.EditorSelection.create([r.EditorSelection.cursor(n.main.head)])),!!o&&(t(j(e,o)),!0)};function gt(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,l=i.changeByRange((o=>{let{from:i,to:l}=o;if(i==l){let r=t(o);r<i?(n="delete.backward",r=yt(e,r,!1)):r>i&&(n="delete.forward",r=yt(e,r,!0)),i=Math.min(i,r),l=Math.max(l,r)}else i=yt(e,i,!1),l=yt(e,l,!0);return i==l?{range:o}:{changes:{from:i,to:l},range:r.EditorSelection.cursor(i,i<o.head?-1:1)}}));return!l.changes.empty&&(e.dispatch(i.update(l,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?o.EditorView.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function yt(e,t,n){if(e instanceof o.EditorView)for(let r of e.state.facet(o.EditorView.atomicRanges).map((t=>t(e))))r.between(t,t,((e,r)=>{e<t&&r>t&&(t=n?r:e)}));return t}const kt=(e,t,n)=>gt(e,(o=>{let l,a,s=o.from,{state:c}=e,u=c.doc.lineAt(s);if(n&&!t&&s>u.from&&s<u.from+200&&!/[^ \t]/.test(l=u.text.slice(0,s-u.from))){if("\t"==l[l.length-1])return s-1;let e=(0,r.countColumn)(l,c.tabSize)%(0,i.getIndentUnit)(c)||(0,i.getIndentUnit)(c);for(let t=0;t<e&&" "==l[l.length-1-t];t++)s--;a=s}else a=(0,r.findClusterBreak)(u.text,s-u.from,t,t)+u.from,a==s&&u.number!=(t?c.doc.lines:1)?a+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(u.text.slice(a-u.from,s-u.from))&&(a=(0,r.findClusterBreak)(u.text,a-u.from,!1,!1)+u.from);return a})),wt=e=>kt(e,!1,!0),St=e=>kt(e,!1,!1),vt=e=>kt(e,!0,!1),At=(e,t)=>gt(e,(n=>{let o=n.head,{state:i}=e,l=i.doc.lineAt(o),a=i.charCategorizer(o);for(let e=null;;){if(o==(t?l.to:l.from)){o==n.head&&l.number!=(t?i.doc.lines:1)&&(o+=t?1:-1);break}let s=(0,r.findClusterBreak)(l.text,o-l.from,t)+l.from,c=l.text.slice(Math.min(o,s)-l.from,Math.max(o,s)-l.from),u=a(c);if(null!=e&&u!=e)break;" "==c&&o==n.head||(e=u),o=s}return o})),Ct=e=>At(e,!1),Bt=e=>At(e,!0),Et=e=>gt(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})),Dt=e=>gt(e,(t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)})),xt=e=>gt(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)})),Lt=e=>gt(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})),Mt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let t=0,r="",o=e.doc.iter();;){if(o.next(),o.lineBreak||o.done){let e=r.search(/\s+$/);if(e>-1&&n.push({from:t-(r.length-e),to:t}),o.done)break;r=""}else r=o.value;t+=o.value.length}return!!n.length&&(t(e.update({changes:n,userEvent:"delete"})),!0)},Tt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:r.Text.of(["",""])},range:r.EditorSelection.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},bt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,o=e.doc.lineAt(n),i=n==o.from?n-1:(0,r.findClusterBreak)(o.text,n-o.from,!1)+o.from,l=n==o.to?n+1:(0,r.findClusterBreak)(o.text,n-o.from,!0)+o.from;return{changes:{from:i,to:l,insert:e.doc.slice(n,l).append(e.doc.slice(i,n))},range:r.EditorSelection.cursor(l)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Ot(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(r.empty||r.to!=i.from||(i=e.doc.lineAt(r.to-1)),n>=o.number){let e=t[t.length-1];e.to=i.to,e.ranges.push(r)}else t.push({from:o.from,to:i.to,ranges:[r]});n=i.number+1}return t}function It(e,t,n){if(e.readOnly)return!1;let o=[],i=[];for(let t of Ot(e)){if(n?t.to==e.doc.length:0==t.from)continue;let l=e.doc.lineAt(n?t.to+1:t.from-1),a=l.length+1;if(n){o.push({from:t.to,to:l.to},{from:t.from,insert:l.text+e.lineBreak});for(let n of t.ranges)i.push(r.EditorSelection.range(Math.min(e.doc.length,n.anchor+a),Math.min(e.doc.length,n.head+a)))}else{o.push({from:l.from,to:t.from},{from:t.to,insert:e.lineBreak+l.text});for(let e of t.ranges)i.push(r.EditorSelection.range(e.anchor-a,e.head-a))}}return!!o.length&&(t(e.update({changes:o,scrollIntoView:!0,selection:r.EditorSelection.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}const Rt=({state:e,dispatch:t})=>It(e,t,!1),Ut=({state:e,dispatch:t})=>It(e,t,!0);function Vt(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Ot(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Nt=({state:e,dispatch:t})=>Vt(e,t,!1),Jt=({state:e,dispatch:t})=>Vt(e,t,!0),Pt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Ot(t).map((({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n})))),r=$(t.selection,(t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),o=e.coordsAtPos(t.head,t.assoc||1);o&&(n=r.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)})).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0},Gt=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),Ft=({state:e,dispatch:t})=>(t(e.update(e.changeByRange((t=>{let n=/^\s*/.exec(e.doc.lineAt(t.from).text)[0];return{changes:{from:t.from,to:t.to,insert:e.lineBreak+n},range:r.EditorSelection.cursor(t.from+n.length+1)}})),{scrollIntoView:!0,userEvent:"input"})),!0),Ht=Wt(!1),zt=Wt(!0);function Wt(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let o=t.changeByRange((n=>{let{from:o,to:a}=n,s=t.doc.lineAt(o),c=!e&&o==a&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,r=(0,i.syntaxTree)(e).resolveInner(t),o=r.childBefore(t),a=r.childAfter(t);return o&&a&&o.to<=t&&a.from>=t&&(n=o.type.prop(l.NodeProp.closedBy))&&n.indexOf(a.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(o.to,a.from))?{from:o.to,to:a.from}:null}(t,o);e&&(o=a=(a<=s.to?s:t.doc.lineAt(a)).to);let u=new i.IndentContext(t,{simulateBreak:o,simulateDoubleBreak:!!c}),d=(0,i.getIndentation)(u,o);for(null==d&&(d=(0,r.countColumn)(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));a<s.to&&/\s/.test(s.text[a-s.from]);)a++;c?({from:o,to:a}=c):o>s.from&&o<s.from+100&&!/\S/.test(s.text.slice(0,o))&&(o=s.from);let f=["",(0,i.indentString)(t,d)];return c&&f.push((0,i.indentString)(t,u.lineIndent(s.from,-1))),{changes:{from:o,to:a,insert:r.Text.of(f)},range:r.EditorSelection.cursor(o+1+f[1].length)}}));return n(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0}}function _t(e,t){let n=-1;return e.changeByRange((o=>{let i=[];for(let r=o.from;r<=o.to;){let l=e.doc.lineAt(r);l.number>n&&(o.empty||o.to>l.from)&&(t(l,i,o),n=l.number),r=l.to+1}let l=e.changes(i);return{changes:i,range:r.EditorSelection.range(l.mapPos(o.anchor,1),l.mapPos(o.head,1))}}))}const Kt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new i.IndentContext(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),o=_t(e,((t,o,l)=>{let a=(0,i.getIndentation)(r,t.from);if(null==a)return;/\S/.test(t.text)||(a=0);let s=/^\s*/.exec(t.text)[0],c=(0,i.indentString)(e,a);(s!=c||l.from<t.from+s.length)&&(n[t.from]=a,o.push({from:t.from,to:t.from+s.length,insert:c}))}));return o.changes.empty||t(e.update(o,{userEvent:"indent"})),!0},$t=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(_t(e,((t,n)=>{n.push({from:t.from,insert:e.facet(i.indentUnit)})})),{userEvent:"input.indent"})),!0),jt=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(_t(e,((t,n)=>{let o=/^\s*/.exec(t.text)[0];if(!o)return;let l=(0,r.countColumn)(o,e.tabSize),a=0,s=(0,i.indentString)(e,Math.max(0,l-(0,i.getIndentUnit)(e)));for(;a<o.length&&a<s.length&&o.charCodeAt(a)==s.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+o.length,insert:s.slice(a)})})),{userEvent:"delete.dedent"})),!0),qt=({state:e,dispatch:t})=>e.selection.ranges.some((e=>!e.empty))?$t({state:e,dispatch:t}):(t(e.update(e.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0),Yt=[{key:"Ctrl-b",run:Z,shift:Ve,preventDefault:!0},{key:"Ctrl-f",run:ee,shift:Ne},{key:"Ctrl-p",run:ke,shift:Qe},{key:"Ctrl-n",run:we,shift:Xe},{key:"Ctrl-a",run:Me,shift:lt},{key:"Ctrl-e",run:Te,shift:at},{key:"Ctrl-d",run:vt},{key:"Ctrl-h",run:wt},{key:"Ctrl-k",run:Et},{key:"Ctrl-Alt-h",run:Ct},{key:"Ctrl-o",run:Tt},{key:"Ctrl-t",run:bt},{key:"Ctrl-v",run:Ce}],Qt=[{key:"ArrowLeft",run:Z,shift:Ve,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:oe,shift:Fe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:xe,shift:ot,preventDefault:!0},{key:"ArrowRight",run:ee,shift:Ne,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ie,shift:He,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Le,shift:it,preventDefault:!0},{key:"ArrowUp",run:ke,shift:Qe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:st,shift:ut},{mac:"Ctrl-ArrowUp",run:Ae,shift:et},{key:"ArrowDown",run:we,shift:Xe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ct,shift:dt},{mac:"Ctrl-ArrowDown",run:Ce,shift:tt},{key:"PageUp",run:Ae,shift:et},{key:"PageDown",run:Ce,shift:tt},{key:"Home",run:De,shift:rt,preventDefault:!0},{key:"Mod-Home",run:st,shift:ut},{key:"End",run:Ee,shift:nt,preventDefault:!0},{key:"Mod-End",run:ct,shift:dt},{key:"Enter",run:Ht},{key:"Mod-a",run:ft},{key:"Backspace",run:wt,shift:wt},{key:"Delete",run:vt},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Ct},{key:"Mod-Delete",mac:"Alt-Delete",run:Bt},{mac:"Mod-Backspace",run:xt},{mac:"Mod-Delete",run:Lt}].concat(Yt.map((e=>({mac:e.key,run:e.run,shift:e.shift})))),Xt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:pe,shift:je},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:ge,shift:qe},{key:"Alt-ArrowUp",run:Rt},{key:"Shift-Alt-ArrowUp",run:Nt},{key:"Alt-ArrowDown",run:Ut},{key:"Shift-Alt-ArrowDown",run:Jt},{key:"Escape",run:pt},{key:"Mod-Enter",run:zt},{key:"Alt-l",mac:"Ctrl-l",run:ht},{key:"Mod-i",run:mt,preventDefault:!0},{key:"Mod-[",run:jt},{key:"Mod-]",run:$t},{key:"Mod-Alt-\\",run:Kt},{key:"Shift-Mod-k",run:Pt},{key:"Shift-Mod-\\",run:Oe},{key:"Mod-/",run:a},{key:"Alt-A",run:f}].concat(Qt),Zt={key:"Tab",run:$t,shift:jt}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7450],{67450:(e,t,n)=>{n.r(t),n.d(t,{blockComment:()=>h,blockUncomment:()=>m,copyLineDown:()=>Ft,copyLineUp:()=>Nt,cursorCharBackward:()=>ne,cursorCharForward:()=>te,cursorCharLeft:()=>Z,cursorCharRight:()=>ee,cursorDocEnd:()=>ct,cursorDocStart:()=>st,cursorGroupBackward:()=>ae,cursorGroupForward:()=>le,cursorGroupLeft:()=>oe,cursorGroupRight:()=>ie,cursorLineBoundaryBackward:()=>De,cursorLineBoundaryForward:()=>Ee,cursorLineBoundaryLeft:()=>xe,cursorLineBoundaryRight:()=>Le,cursorLineDown:()=>Se,cursorLineEnd:()=>Te,cursorLineStart:()=>Me,cursorLineUp:()=>ke,cursorMatchingBracket:()=>Oe,cursorPageDown:()=>Ce,cursorPageUp:()=>Ae,cursorSubwordBackward:()=>fe,cursorSubwordForward:()=>de,cursorSyntaxLeft:()=>pe,cursorSyntaxRight:()=>ge,defaultKeymap:()=>en,deleteCharBackward:()=>St,deleteCharBackwardStrict:()=>wt,deleteCharForward:()=>vt,deleteGroupBackward:()=>Ct,deleteGroupForward:()=>Bt,deleteLine:()=>Jt,deleteLineBoundaryBackward:()=>xt,deleteLineBoundaryForward:()=>Lt,deleteToLineEnd:()=>Et,deleteToLineStart:()=>Dt,deleteTrailingWhitespace:()=>Mt,emacsStyleKeymap:()=>Xt,history:()=>E,historyField:()=>D,historyKeymap:()=>K,indentLess:()=>jt,indentMore:()=>$t,indentSelection:()=>Kt,indentWithTab:()=>tn,insertBlankLine:()=>zt,insertNewline:()=>Pt,insertNewlineAndIndent:()=>Ht,insertNewlineKeepIndent:()=>Gt,insertTab:()=>Qt,invertedEffects:()=>A,isolateHistory:()=>v,lineComment:()=>u,lineUncomment:()=>d,moveLineDown:()=>Ut,moveLineUp:()=>Rt,redo:()=>M,redoDepth:()=>R,redoSelection:()=>b,selectAll:()=>ft,selectCharBackward:()=>Je,selectCharForward:()=>Fe,selectCharLeft:()=>Ve,selectCharRight:()=>Ne,selectDocEnd:()=>dt,selectDocStart:()=>ut,selectGroupBackward:()=>We,selectGroupForward:()=>ze,selectGroupLeft:()=>Ge,selectGroupRight:()=>He,selectLine:()=>ht,selectLineBoundaryBackward:()=>rt,selectLineBoundaryForward:()=>nt,selectLineBoundaryLeft:()=>ot,selectLineBoundaryRight:()=>it,selectLineDown:()=>Xe,selectLineEnd:()=>at,selectLineStart:()=>lt,selectLineUp:()=>Qe,selectMatchingBracket:()=>Ie,selectPageDown:()=>tt,selectPageUp:()=>et,selectParentSyntax:()=>mt,selectSubwordBackward:()=>$e,selectSubwordForward:()=>Ke,selectSyntaxLeft:()=>je,selectSyntaxRight:()=>qe,simplifySelection:()=>pt,splitLine:()=>Tt,standardKeymap:()=>Zt,temporarilySetTabFocusMode:()=>Yt,toggleBlockComment:()=>f,toggleBlockCommentByLine:()=>p,toggleComment:()=>a,toggleLineComment:()=>c,toggleTabFocusMode:()=>qt,transposeChars:()=>bt,undo:()=>L,undoDepth:()=>I,undoSelection:()=>T});var r=n(89843),o=n(63720),i=n(17592),l=n(79352);const a=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=g(e.state,n.from);return r.line?c(e):!!r.block&&p(e)};function s(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);return!!o&&(r(n.update(o)),!0)}}const c=s(S,0),u=s(S,1),d=s(S,2),f=s(k,0),h=s(k,1),m=s(k,2),p=s(((e,t)=>k(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to),i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=o.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}(t))),0);function g(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const y=50;function k(e,t,n=t.selection.ranges){let r=n.map((e=>g(t,e.from).block));if(!r.every((e=>e)))return null;let o=n.map(((e,n)=>function(e,{open:t,close:n},r,o){let i,l,a=e.sliceDoc(r-y,r),s=e.sliceDoc(o,o+y),c=/\s*$/.exec(a)[0].length,u=/^\s*/.exec(s)[0].length,d=a.length-c;if(a.slice(d-t.length,d)==t&&s.slice(u,u+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:o+u,margin:u&&1}};o-r<=2*y?i=l=e.sliceDoc(r,o):(i=e.sliceDoc(r,r+y),l=e.sliceDoc(o-y,o));let f=/^\s*/.exec(i)[0].length,h=/\s*$/.exec(l)[0].length,m=l.length-h-n.length;return i.slice(f,f+t.length)==t&&l.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:/\s/.test(i.charAt(f+t.length))?1:0},close:{pos:o-h-n.length,margin:/\s/.test(l.charAt(m-1))?1:0}}:null}(t,r[n],e.from,e.to)));if(2!=e&&!o.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>o[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}])))};if(1!=e&&o.some((e=>e))){let e=[];for(let t,n=0;n<o.length;n++)if(t=o[n]){let o=r[n],{open:i,close:l}=t;e.push({from:i.pos-o.open.length,to:i.pos+i.margin},{from:l.pos-l.margin,to:l.pos+o.close.length})}return{changes:e}}return null}function S(e,t,n=t.selection.ranges){let r=[],o=-1;for(let{from:e,to:i}of n){let n=r.length,l=1e9,a=g(t,e).line;if(a){for(let n=e;n<=i;){let s=t.doc.lineAt(n);if(s.from>o&&(e==i||i>s.from)){o=s.from;let e=/^\s*/.exec(s.text)[0].length,t=e==s.length,n=s.text.slice(e,e+a.length)==a?e:-1;e<s.text.length&&e<l&&(l=e),r.push({line:s,comment:n,token:a,indent:e,empty:t,single:!1})}n=s.to+1}if(l<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=l);r.length==n+1&&(r[n].single=!0)}}if(2!=e&&r.some((e=>e.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:o,empty:i,single:l}of r)!l&&i||e.push({from:t.from+o,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:o}of r)if(n>=0){let r=t.from+n,i=r+o.length;" "==t.text[i-t.from]&&i++,e.push({from:r,to:i})}return{changes:e}}return null}const w=r.Annotation.define(),v=r.Annotation.define(),A=r.Facet.define(),C=r.Facet.define({combine:e=>(0,r.combineConfig)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),B=r.StateField.define({create:()=>_.empty,update(e,t){let n=t.state.facet(C),o=t.annotation(w);if(o){let r=U.fromTransaction(t,o.selection),i=o.side,l=0==i?e.undone:e.done;return l=r?V(l,l.length,n.minDepth,r):P(l,t.startState.selection),new _(0==i?o.rest:l,0==i?l:o.rest)}let i=t.annotation(v);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(r.Transaction.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let l=U.fromTransaction(t),a=t.annotation(r.Transaction.time),s=t.annotation(r.Transaction.userEvent);return l?e=e.addChanges(l,a,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,a,s,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON:e=>({done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}),fromJSON:e=>new _(e.done.map(U.fromJSON),e.undone.map(U.fromJSON))});function E(e={}){return[B,C.of(e),o.EditorView.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?L:"historyRedo"==e.inputType?M:null;return!!n&&(e.preventDefault(),n(t))}})]}const D=B;function x(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(B,!1);if(!o)return!1;let i=o.pop(e,n,t);return!!i&&(r(i),!0)}}const L=x(0,!1),M=x(1,!1),T=x(0,!0),b=x(1,!0);function O(e){return function(t){let n=t.field(B,!1);if(!n)return 0;let r=0==e?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const I=O(0),R=O(1);class U{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new U(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new U(e.changes&&r.ChangeSet.fromJSON(e.changes),[],e.mapped&&r.ChangeDesc.fromJSON(e.mapped),e.startSelection&&r.EditorSelection.fromJSON(e.startSelection),e.selectionsAfter.map(r.EditorSelection.fromJSON))}static fromTransaction(e,t){let n=F;for(let t of e.startState.facet(A)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new U(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,F)}static selection(e){return new U(void 0,F,void 0,void 0,e)}}function V(e,t,n,r){let o=t+1>n+20?t-n-1:0,i=e.slice(o,t);return i.push(r),i}function N(e,t){return e.length?t.length?e.concat(t):e:t}const F=[],J=200;function P(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-J));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),V(e,e.length-1,1e9,n.setSelAfter(r)))}return[U.selection([t])]}function G(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function H(e,t){if(!e.length)return e;let n=e.length,r=F;for(;n;){let o=z(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let t=e.slice(0,n);return t[n-1]=o,t}t=o.mapped,n--,r=o.selectionsAfter}return r.length?[U.selection(r)]:F}function z(e,t,n){let o=N(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):F,n);if(!e.changes)return U.selection(o);let i=e.changes.map(t),l=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(l):l;return new U(i,r.StateEffect.mapEffects(e.effects,t),a,e.startSelection.map(l),o)}const W=/^(input\.type|delete)($|\.)/;class _{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new _(this.done,this.undone):this}addChanges(e,t,n,r,o){let i=this.done,l=i[i.length-1];return i=l&&l.changes&&!l.changes.empty&&e.changes&&(!n||W.test(n))&&(!l.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,function(e,t){let n=[],r=!1;return e.iterChangedRanges(((e,t)=>n.push(e,t))),t.iterChangedRanges(((e,t,o,i)=>{for(let e=0;e<n.length;){let t=n[e++],l=n[e++];i>=t&&o<=l&&(r=!0)}})),r}(l.changes,e.changes))||"input.type.compose"==n)?V(i,i.length-1,r.minDepth,new U(e.changes.compose(l.changes),N(e.effects,l.effects),l.mapped,l.startSelection,F)):V(i,i.length,r.minDepth,e),new _(i,F,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:F;return o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=o[o.length-1],l=e,i.ranges.length==l.ranges.length&&0===i.ranges.filter(((e,t)=>e.empty!=l.ranges[t].empty)).length)?this:new _(P(this.done,e),this.undone,t,n);var i,l}addMapping(e){return new _(H(this.done,e),H(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let o=r[r.length-1],i=o.selectionsAfter[0]||t.selection;if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:w.of({side:e,rest:G(r),selection:i}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let n=1==r.length?F:r.slice(0,r.length-1);return o.mapped&&(n=H(n,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:w.of({side:e,rest:n,selection:i}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}_.empty=new _(F,F);const K=[{key:"Mod-z",run:L,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:M,preventDefault:!0},{linux:"Ctrl-Shift-z",run:M,preventDefault:!0},{key:"Mod-u",run:T,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:b,preventDefault:!0}];function $(e,t){return r.EditorSelection.create(e.ranges.map(t),e.mainIndex)}function j(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function q({state:e,dispatch:t},n){let r=$(e.selection,n);return!r.eq(e.selection,!0)&&(t(j(e,r)),!0)}function Y(e,t){return r.EditorSelection.cursor(t?e.to:e.from)}function Q(e,t){return q(e,(n=>n.empty?e.moveByChar(n,t):Y(n,t)))}function X(e){return e.textDirectionAt(e.state.selection.main.head)==o.Direction.LTR}const Z=e=>Q(e,!X(e)),ee=e=>Q(e,X(e)),te=e=>Q(e,!0),ne=e=>Q(e,!1);function re(e,t){return q(e,(n=>n.empty?e.moveByGroup(n,t):Y(n,t)))}const oe=e=>re(e,!X(e)),ie=e=>re(e,X(e)),le=e=>re(e,!0),ae=e=>re(e,!1),se="undefined"!=typeof Intl&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ce(e,t,n){let o=e.state.charCategorizer(t.from),i=r.CharCategory.Space,l=t.from,a=0,s=!1,c=!1,u=!1,d=t=>{if(s)return!1;l+=n?t.length:-t.length;let d,f=o(t);if(f==r.CharCategory.Word&&t.charCodeAt(0)<128&&/[\W_]/.test(t)&&(f=-1),i==r.CharCategory.Space&&(i=f),i!=f)return!1;if(i==r.CharCategory.Word)if(t.toLowerCase()==t){if(!n&&c)return!1;u=!0}else if(u){if(n)return!1;s=!0}else{if(c&&n&&o(d=e.state.sliceDoc(l,l+1))==r.CharCategory.Word&&d.toLowerCase()==d)return!1;c=!0}return a++,!0},f=e.moveByChar(t,n,(e=>(d(e),d)));if(se&&i==r.CharCategory.Word&&f.from==t.from+a*(n?1:-1)){let o=Math.min(t.head,f.head),i=Math.max(t.head,f.head),l=e.state.sliceDoc(o,i);if(l.length>1&&/[\u4E00-\uffff]/.test(l)){let e=Array.from(se.segment(l));if(e.length>1)return n?r.EditorSelection.cursor(t.head+e[1].index,-1):r.EditorSelection.cursor(f.head+e[e.length-1].index,1)}}return f}function ue(e,t){return q(e,(n=>n.empty?ce(e,n,t):Y(n,t)))}const de=e=>ue(e,!0),fe=e=>ue(e,!1);function he(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function me(e,t,n){let o,a,s=(0,i.syntaxTree)(e).resolveInner(t.head),c=n?l.NodeProp.closedBy:l.NodeProp.openedBy;for(let r=t.head;;){let t=n?s.childAfter(r):s.childBefore(r);if(!t)break;he(e,t,c)?s=t:r=n?t.to:t.from}return a=s.type.prop(c)&&(o=n?(0,i.matchBrackets)(e,s.from,1):(0,i.matchBrackets)(e,s.to,-1))&&o.matched?n?o.end.to:o.end.from:n?s.to:s.from,r.EditorSelection.cursor(a,n?-1:1)}const pe=e=>q(e,(t=>me(e.state,t,!X(e)))),ge=e=>q(e,(t=>me(e.state,t,X(e))));function ye(e,t){return q(e,(n=>{if(!n.empty)return Y(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)}))}const ke=e=>ye(e,!1),Se=e=>ye(e,!0);function we(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0;if(n){for(let t of e.state.facet(o.EditorView.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(r=Math.max(null==n?void 0:n.top,r)),(null==n?void 0:n.bottom)&&(i=Math.max(null==n?void 0:n.bottom,i))}t=e.scrollDOM.clientHeight-r-i}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function ve(e,t){let n,r=we(e),{state:i}=e,l=$(i.selection,(n=>n.empty?e.moveVertically(n,t,r.height):Y(n,t)));if(l.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),s=a.top+r.marginTop,c=a.bottom-r.marginBottom;t&&t.top>s&&t.bottom<c&&(n=o.EditorView.scrollIntoView(l.main.head,{y:"start",yMargin:t.top-s}))}return e.dispatch(j(i,l),{effects:n}),!0}const Ae=e=>ve(e,!1),Ce=e=>ve(e,!0);function Be(e,t,n){let o=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?o.to:o.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==o.from&&o.length){let n=/^\s*/.exec(e.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;n&&t.head!=o.from+n&&(i=r.EditorSelection.cursor(o.from+n))}return i}const Ee=e=>q(e,(t=>Be(e,t,!0))),De=e=>q(e,(t=>Be(e,t,!1))),xe=e=>q(e,(t=>Be(e,t,!X(e)))),Le=e=>q(e,(t=>Be(e,t,X(e)))),Me=e=>q(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).from,1))),Te=e=>q(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).to,-1)));function be(e,t,n){let o=!1,l=$(e.selection,(t=>{let l=(0,i.matchBrackets)(e,t.head,-1)||(0,i.matchBrackets)(e,t.head,1)||t.head>0&&(0,i.matchBrackets)(e,t.head-1,1)||t.head<e.doc.length&&(0,i.matchBrackets)(e,t.head+1,-1);if(!l||!l.end)return t;o=!0;let a=l.start.from==t.head?l.end.to:l.end.from;return n?r.EditorSelection.range(t.anchor,a):r.EditorSelection.cursor(a)}));return!!o&&(t(j(e,l)),!0)}const Oe=({state:e,dispatch:t})=>be(e,t,!1),Ie=({state:e,dispatch:t})=>be(e,t,!0);function Re(e,t){let n=$(e.state.selection,(e=>{let n=t(e);return r.EditorSelection.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(j(e.state,n)),!0)}function Ue(e,t){return Re(e,(n=>e.moveByChar(n,t)))}const Ve=e=>Ue(e,!X(e)),Ne=e=>Ue(e,X(e)),Fe=e=>Ue(e,!0),Je=e=>Ue(e,!1);function Pe(e,t){return Re(e,(n=>e.moveByGroup(n,t)))}const Ge=e=>Pe(e,!X(e)),He=e=>Pe(e,X(e)),ze=e=>Pe(e,!0),We=e=>Pe(e,!1);function _e(e,t){return Re(e,(n=>ce(e,n,t)))}const Ke=e=>_e(e,!0),$e=e=>_e(e,!1),je=e=>Re(e,(t=>me(e.state,t,!X(e)))),qe=e=>Re(e,(t=>me(e.state,t,X(e))));function Ye(e,t){return Re(e,(n=>e.moveVertically(n,t)))}const Qe=e=>Ye(e,!1),Xe=e=>Ye(e,!0);function Ze(e,t){return Re(e,(n=>e.moveVertically(n,t,we(e).height)))}const et=e=>Ze(e,!1),tt=e=>Ze(e,!0),nt=e=>Re(e,(t=>Be(e,t,!0))),rt=e=>Re(e,(t=>Be(e,t,!1))),ot=e=>Re(e,(t=>Be(e,t,!X(e)))),it=e=>Re(e,(t=>Be(e,t,X(e)))),lt=e=>Re(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).from))),at=e=>Re(e,(t=>r.EditorSelection.cursor(e.lineBlockAt(t.head).to))),st=({state:e,dispatch:t})=>(t(j(e,{anchor:0})),!0),ct=({state:e,dispatch:t})=>(t(j(e,{anchor:e.doc.length})),!0),ut=({state:e,dispatch:t})=>(t(j(e,{anchor:e.selection.main.anchor,head:0})),!0),dt=({state:e,dispatch:t})=>(t(j(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ft=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),ht=({state:e,dispatch:t})=>{let n=Ot(e).map((({from:t,to:n})=>r.EditorSelection.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:r.EditorSelection.create(n),userEvent:"select"})),!0},mt=({state:e,dispatch:t})=>{let n=$(e.selection,(t=>{var n;for(let o=(0,i.syntaxTree)(e).resolveStack(t.from,1);o;o=o.next){let{node:e}=o;if((e.from<t.from&&e.to>=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent))return r.EditorSelection.range(e.to,e.from)}return t}));return t(j(e,n)),!0},pt=({state:e,dispatch:t})=>{let n=e.selection,o=null;return n.ranges.length>1?o=r.EditorSelection.create([n.main]):n.main.empty||(o=r.EditorSelection.create([r.EditorSelection.cursor(n.main.head)])),!!o&&(t(j(e,o)),!0)};function gt(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,l=i.changeByRange((o=>{let{from:i,to:l}=o;if(i==l){let r=t(o);r<i?(n="delete.backward",r=yt(e,r,!1)):r>i&&(n="delete.forward",r=yt(e,r,!0)),i=Math.min(i,r),l=Math.max(l,r)}else i=yt(e,i,!1),l=yt(e,l,!0);return i==l?{range:o}:{changes:{from:i,to:l},range:r.EditorSelection.cursor(i,i<o.head?-1:1)}}));return!l.changes.empty&&(e.dispatch(i.update(l,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?o.EditorView.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function yt(e,t,n){if(e instanceof o.EditorView)for(let r of e.state.facet(o.EditorView.atomicRanges).map((t=>t(e))))r.between(t,t,((e,r)=>{e<t&&r>t&&(t=n?r:e)}));return t}const kt=(e,t,n)=>gt(e,(o=>{let l,a,s=o.from,{state:c}=e,u=c.doc.lineAt(s);if(n&&!t&&s>u.from&&s<u.from+200&&!/[^ \t]/.test(l=u.text.slice(0,s-u.from))){if("\t"==l[l.length-1])return s-1;let e=(0,r.countColumn)(l,c.tabSize)%(0,i.getIndentUnit)(c)||(0,i.getIndentUnit)(c);for(let t=0;t<e&&" "==l[l.length-1-t];t++)s--;a=s}else a=(0,r.findClusterBreak)(u.text,s-u.from,t,t)+u.from,a==s&&u.number!=(t?c.doc.lines:1)?a+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(u.text.slice(a-u.from,s-u.from))&&(a=(0,r.findClusterBreak)(u.text,a-u.from,!1,!1)+u.from);return a})),St=e=>kt(e,!1,!0),wt=e=>kt(e,!1,!1),vt=e=>kt(e,!0,!1),At=(e,t)=>gt(e,(n=>{let o=n.head,{state:i}=e,l=i.doc.lineAt(o),a=i.charCategorizer(o);for(let e=null;;){if(o==(t?l.to:l.from)){o==n.head&&l.number!=(t?i.doc.lines:1)&&(o+=t?1:-1);break}let s=(0,r.findClusterBreak)(l.text,o-l.from,t)+l.from,c=l.text.slice(Math.min(o,s)-l.from,Math.max(o,s)-l.from),u=a(c);if(null!=e&&u!=e)break;" "==c&&o==n.head||(e=u),o=s}return o})),Ct=e=>At(e,!1),Bt=e=>At(e,!0),Et=e=>gt(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})),Dt=e=>gt(e,(t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)})),xt=e=>gt(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)})),Lt=e=>gt(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})),Mt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let t=0,r="",o=e.doc.iter();;){if(o.next(),o.lineBreak||o.done){let e=r.search(/\s+$/);if(e>-1&&n.push({from:t-(r.length-e),to:t}),o.done)break;r=""}else r=o.value;t+=o.value.length}return!!n.length&&(t(e.update({changes:n,userEvent:"delete"})),!0)},Tt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:r.Text.of(["",""])},range:r.EditorSelection.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},bt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,o=e.doc.lineAt(n),i=n==o.from?n-1:(0,r.findClusterBreak)(o.text,n-o.from,!1)+o.from,l=n==o.to?n+1:(0,r.findClusterBreak)(o.text,n-o.from,!0)+o.from;return{changes:{from:i,to:l,insert:e.doc.slice(n,l).append(e.doc.slice(i,n))},range:r.EditorSelection.cursor(l)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Ot(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(r.empty||r.to!=i.from||(i=e.doc.lineAt(r.to-1)),n>=o.number){let e=t[t.length-1];e.to=i.to,e.ranges.push(r)}else t.push({from:o.from,to:i.to,ranges:[r]});n=i.number+1}return t}function It(e,t,n){if(e.readOnly)return!1;let o=[],i=[];for(let t of Ot(e)){if(n?t.to==e.doc.length:0==t.from)continue;let l=e.doc.lineAt(n?t.to+1:t.from-1),a=l.length+1;if(n){o.push({from:t.to,to:l.to},{from:t.from,insert:l.text+e.lineBreak});for(let n of t.ranges)i.push(r.EditorSelection.range(Math.min(e.doc.length,n.anchor+a),Math.min(e.doc.length,n.head+a)))}else{o.push({from:l.from,to:t.from},{from:t.to,insert:e.lineBreak+l.text});for(let e of t.ranges)i.push(r.EditorSelection.range(e.anchor-a,e.head-a))}}return!!o.length&&(t(e.update({changes:o,scrollIntoView:!0,selection:r.EditorSelection.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}const Rt=({state:e,dispatch:t})=>It(e,t,!1),Ut=({state:e,dispatch:t})=>It(e,t,!0);function Vt(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Ot(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Nt=({state:e,dispatch:t})=>Vt(e,t,!1),Ft=({state:e,dispatch:t})=>Vt(e,t,!0),Jt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Ot(t).map((({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n})))),r=$(t.selection,(t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),o=e.coordsAtPos(t.head,t.assoc||1);o&&(n=r.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)})).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0},Pt=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),Gt=({state:e,dispatch:t})=>(t(e.update(e.changeByRange((t=>{let n=/^\s*/.exec(e.doc.lineAt(t.from).text)[0];return{changes:{from:t.from,to:t.to,insert:e.lineBreak+n},range:r.EditorSelection.cursor(t.from+n.length+1)}})),{scrollIntoView:!0,userEvent:"input"})),!0),Ht=Wt(!1),zt=Wt(!0);function Wt(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let o=t.changeByRange((n=>{let{from:o,to:a}=n,s=t.doc.lineAt(o),c=!e&&o==a&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,r=(0,i.syntaxTree)(e).resolveInner(t),o=r.childBefore(t),a=r.childAfter(t);return o&&a&&o.to<=t&&a.from>=t&&(n=o.type.prop(l.NodeProp.closedBy))&&n.indexOf(a.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(o.to,a.from))?{from:o.to,to:a.from}:null}(t,o);e&&(o=a=(a<=s.to?s:t.doc.lineAt(a)).to);let u=new i.IndentContext(t,{simulateBreak:o,simulateDoubleBreak:!!c}),d=(0,i.getIndentation)(u,o);for(null==d&&(d=(0,r.countColumn)(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));a<s.to&&/\s/.test(s.text[a-s.from]);)a++;c?({from:o,to:a}=c):o>s.from&&o<s.from+100&&!/\S/.test(s.text.slice(0,o))&&(o=s.from);let f=["",(0,i.indentString)(t,d)];return c&&f.push((0,i.indentString)(t,u.lineIndent(s.from,-1))),{changes:{from:o,to:a,insert:r.Text.of(f)},range:r.EditorSelection.cursor(o+1+f[1].length)}}));return n(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0}}function _t(e,t){let n=-1;return e.changeByRange((o=>{let i=[];for(let r=o.from;r<=o.to;){let l=e.doc.lineAt(r);l.number>n&&(o.empty||o.to>l.from)&&(t(l,i,o),n=l.number),r=l.to+1}let l=e.changes(i);return{changes:i,range:r.EditorSelection.range(l.mapPos(o.anchor,1),l.mapPos(o.head,1))}}))}const Kt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new i.IndentContext(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),o=_t(e,((t,o,l)=>{let a=(0,i.getIndentation)(r,t.from);if(null==a)return;/\S/.test(t.text)||(a=0);let s=/^\s*/.exec(t.text)[0],c=(0,i.indentString)(e,a);(s!=c||l.from<t.from+s.length)&&(n[t.from]=a,o.push({from:t.from,to:t.from+s.length,insert:c}))}));return o.changes.empty||t(e.update(o,{userEvent:"indent"})),!0},$t=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(_t(e,((t,n)=>{n.push({from:t.from,insert:e.facet(i.indentUnit)})})),{userEvent:"input.indent"})),!0),jt=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(_t(e,((t,n)=>{let o=/^\s*/.exec(t.text)[0];if(!o)return;let l=(0,r.countColumn)(o,e.tabSize),a=0,s=(0,i.indentString)(e,Math.max(0,l-(0,i.getIndentUnit)(e)));for(;a<o.length&&a<s.length&&o.charCodeAt(a)==s.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+o.length,insert:s.slice(a)})})),{userEvent:"delete.dedent"})),!0),qt=e=>(e.setTabFocusMode(),!0),Yt=e=>(e.setTabFocusMode(2e3),!0),Qt=({state:e,dispatch:t})=>e.selection.ranges.some((e=>!e.empty))?$t({state:e,dispatch:t}):(t(e.update(e.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0),Xt=[{key:"Ctrl-b",run:Z,shift:Ve,preventDefault:!0},{key:"Ctrl-f",run:ee,shift:Ne},{key:"Ctrl-p",run:ke,shift:Qe},{key:"Ctrl-n",run:Se,shift:Xe},{key:"Ctrl-a",run:Me,shift:lt},{key:"Ctrl-e",run:Te,shift:at},{key:"Ctrl-d",run:vt},{key:"Ctrl-h",run:St},{key:"Ctrl-k",run:Et},{key:"Ctrl-Alt-h",run:Ct},{key:"Ctrl-o",run:Tt},{key:"Ctrl-t",run:bt},{key:"Ctrl-v",run:Ce}],Zt=[{key:"ArrowLeft",run:Z,shift:Ve,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:oe,shift:Ge,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:xe,shift:ot,preventDefault:!0},{key:"ArrowRight",run:ee,shift:Ne,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ie,shift:He,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Le,shift:it,preventDefault:!0},{key:"ArrowUp",run:ke,shift:Qe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:st,shift:ut},{mac:"Ctrl-ArrowUp",run:Ae,shift:et},{key:"ArrowDown",run:Se,shift:Xe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ct,shift:dt},{mac:"Ctrl-ArrowDown",run:Ce,shift:tt},{key:"PageUp",run:Ae,shift:et},{key:"PageDown",run:Ce,shift:tt},{key:"Home",run:De,shift:rt,preventDefault:!0},{key:"Mod-Home",run:st,shift:ut},{key:"End",run:Ee,shift:nt,preventDefault:!0},{key:"Mod-End",run:ct,shift:dt},{key:"Enter",run:Ht},{key:"Mod-a",run:ft},{key:"Backspace",run:St,shift:St},{key:"Delete",run:vt},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Ct},{key:"Mod-Delete",mac:"Alt-Delete",run:Bt},{mac:"Mod-Backspace",run:xt},{mac:"Mod-Delete",run:Lt}].concat(Xt.map((e=>({mac:e.key,run:e.run,shift:e.shift})))),en=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:pe,shift:je},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:ge,shift:qe},{key:"Alt-ArrowUp",run:Rt},{key:"Shift-Alt-ArrowUp",run:Nt},{key:"Alt-ArrowDown",run:Ut},{key:"Shift-Alt-ArrowDown",run:Ft},{key:"Escape",run:pt},{key:"Mod-Enter",run:zt},{key:"Alt-l",mac:"Ctrl-l",run:ht},{key:"Mod-i",run:mt,preventDefault:!0},{key:"Mod-[",run:jt},{key:"Mod-]",run:$t},{key:"Mod-Alt-\\",run:Kt},{key:"Shift-Mod-k",run:Jt},{key:"Shift-Mod-\\",run:Oe},{key:"Mod-/",run:a},{key:"Alt-A",run:f},{key:"Ctrl-m",mac:"Shift-Alt-m",run:qt}].concat(Zt),tn={key:"Tab",run:$t,shift:jt}}}]);
|
notebook/static/7543.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7543],{37543:(e,t,s)=>{s.r(t),s.d(t,{DocumentManager:()=>M,DocumentWidgetManager:()=>x,IDocumentManager:()=>A,IDocumentWidgetOpener:()=>E,IRecentsManager:()=>I,PathStatus:()=>F,RecentsManager:()=>N,SaveHandler:()=>f,SavingStatus:()=>W,isValidFileName:()=>d,renameDialog:()=>c,renameFile:()=>l,shouldOverwrite:()=>h});var n,i=s(72703),a=s(65848),o=s(70858),r=s(63485);function c(e,t,s){const n=(s=s||o.nullTranslator).load("jupyterlab"),a=t.localPath.split("/").pop()||t.localPath;return(0,i.showDialog)({title:n.__("Rename File"),body:new g(a),focusNodeSelector:"input",buttons:[i.Dialog.cancelButton(),i.Dialog.okButton({label:n.__("Rename"),ariaLabel:n.__("Rename File")})]}).then((e=>e.value?d(e.value)?t.rename(e.value):((0,i.showErrorMessage)(n.__("Rename Error"),Error(n.__('"%1" is not a valid name for a file. Names must have nonzero length, and cannot include "/", "\\", or ":"',e.value))),null):null))}function l(e,t,s){return e.rename(t,s).catch((n=>{if(409!==n.response.status)throw n;return h(s).then((n=>n?e.overwrite(t,s):Promise.reject("File not renamed")))}))}function h(e,t){const s=(t=t||o.nullTranslator).load("jupyterlab"),n={title:s.__("Overwrite file?"),body:s.__('"%1" already exists, overwrite?',e),buttons:[i.Dialog.cancelButton(),i.Dialog.warnButton({label:s.__("Overwrite"),ariaLabel:s.__("Overwrite Existing File")})]};return(0,i.showDialog)(n).then((e=>Promise.resolve(e.button.accept)))}function d(e){return e.length>0&&!/[\/\\:]/.test(e)}class g extends r.Widget{constructor(e){super({node:n.createRenameNode(e)}),this.addClass("jp-FileDialog");const t=a.PathExt.extname(e),s=this.inputNode.value=a.PathExt.basename(e);this.inputNode.setSelectionRange(0,s.length-t.length)}get inputNode(){return this.node.getElementsByTagName("input")[0]}getValue(){return this.inputNode.value}}!function(e){e.createRenameNode=function(e,t){const s=(t=t||o.nullTranslator).load("jupyterlab"),n=document.createElement("div"),i=document.createElement("label");i.textContent=s.__("File Path");const a=document.createElement("span");a.textContent=e;const r=document.createElement("label");r.textContent=s.__("New Name"),r.className="jp-new-name-title";const c=document.createElement("input");return n.appendChild(i),n.appendChild(a),n.appendChild(r),n.appendChild(c),n}}(n||(n={}));var _=s(89945),u=s(33625),m=s(20998),p=s(14421),v=s(81997);class f{constructor(e){this._autosaveTimer=-1,this._minInterval=-1,this._interval=-1,this._isActive=!1,this._inDialog=!1,this._isDisposed=!1,this._multiplier=10,this._context=e.context,this._isConnectedCallback=e.isConnectedCallback||(()=>!0);const t=e.saveInterval||120;this._minInterval=1e3*t,this._interval=this._minInterval,this._context.fileChanged.connect(this._setTimer,this),this._context.disposed.connect(this.dispose,this)}get saveInterval(){return this._interval/1e3}set saveInterval(e){this._minInterval=this._interval=1e3*e,this._isActive&&this._setTimer()}get isActive(){return this._isActive}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,clearTimeout(this._autosaveTimer),v.Signal.clearData(this))}start(){this._isActive=!0,this._setTimer()}stop(){this._isActive=!1,clearTimeout(this._autosaveTimer)}_setTimer(){clearTimeout(this._autosaveTimer),this._isActive&&(this._autosaveTimer=window.setTimeout((()=>{this._isConnectedCallback()&&this._save()}),this._interval))}_save(){const e=this._context;if(this._setTimer(),!e)return;if(!e.contentsModel||!e.contentsModel.writable||!e.model.dirty||this._inDialog)return;const t=(new Date).getTime();e.save().then((()=>{if(this.isDisposed)return;const e=(new Date).getTime()-t;this._interval=Math.max(this._multiplier*e,this._minInterval),this._setTimer()})).catch((e=>{const{name:t}=e;"ModalCancelError"!==t&&"ModalDuplicateError"!==t&&console.error("Error in Auto-Save",e.message)}))}}var w,y,C=s(2549),D=s(49503);class x{constructor(e){this._activateRequested=new v.Signal(this),this._confirmClosingTab=!1,this._isDisposed=!1,this._stateChanged=new v.Signal(this),this._registry=e.registry,this.translator=e.translator||o.nullTranslator,this._recentsManager=e.recentsManager||null}get activateRequested(){return this._activateRequested}get confirmClosingDocument(){return this._confirmClosingTab}set confirmClosingDocument(e){if(this._confirmClosingTab!==e){const t=this._confirmClosingTab;this._confirmClosingTab=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.disconnectReceiver(this))}createWidget(e,t){const s=e.createNew(t);return this._initializeWidget(s,e,t),s}_initializeWidget(e,t,s){w.factoryProperty.set(e,t);const n=new C.DisposableSet;for(const i of this._registry.widgetExtensions(t.name)){const t=i.createNew(e,s);t&&n.add(t)}w.disposablesProperty.set(e,n),e.disposed.connect(this._onWidgetDisposed,this),this.adoptWidget(s,e),s.fileChanged.connect(this._onFileChanged,this),s.pathChanged.connect(this._onPathChanged,this),s.ready.then((()=>{this.setCaption(e)}))}adoptWidget(e,t){w.widgetsProperty.get(e).push(t),D.MessageLoop.installMessageHook(t,this),t.addClass("jp-Document"),t.title.closable=!0,t.disposed.connect(this._widgetDisposed,this),w.contextProperty.set(t,e)}findWidget(e,t){const s=w.widgetsProperty.get(e);if(s)return(0,u.find)(s,(e=>{const s=w.factoryProperty.get(e);return!!s&&s.name===t}))}contextForWidget(e){return w.contextProperty.get(e)}cloneWidget(e){const t=w.contextProperty.get(e);if(!t)return;const s=w.factoryProperty.get(e);if(!s)return;const n=s.createNew(t,e);return this._initializeWidget(n,s,t),n}closeWidgets(e){const t=w.widgetsProperty.get(e);return Promise.all(t.map((e=>this.onClose(e)))).then((()=>{}))}deleteWidgets(e){const t=w.widgetsProperty.get(e);return Promise.all(t.map((e=>this.onDelete(e)))).then((()=>{}))}messageHook(e,t){switch(t.type){case"close-request":return this.onClose(e),!1;case"activate-request":{const t=e,s=this.contextForWidget(t);s&&(s.ready.then((()=>{this._recordAsRecentlyOpened(t,s.contentsModel)})).catch((()=>{console.warn("Could not record the recents status for",s)})),this._activateRequested.emit(s.path));break}}return!0}async setCaption(e){const t=this.translator.load("jupyterlab"),s=w.contextProperty.get(e);if(!s)return;const n=s.contentsModel;if(n)return s.listCheckpoints().then((i=>{if(e.isDisposed)return;const o=i[i.length-1],r=o?a.Time.format(o.last_modified):"None";let c=t.__("Name: %1\nPath: %2\n",n.name,n.path);s.model.readOnly?c+=t.__("Read-only"):c+=t.__("Last Saved: %1\n",a.Time.format(n.last_modified))+t.__("Last Checkpoint: %1",r),e.title.caption=c}));e.title.caption=""}async onClose(e){var t;const[s,n]=await this._maybeClose(e,this.translator);if(e.isDisposed)return!0;if(s){const s=w.contextProperty.get(e);if(!n){if(!s)return!0;(null===(t=s.contentsModel)||void 0===t?void 0:t.writable)?await s.save():await s.saveAs()}if(s&&("timeout"===await Promise.race([s.ready,new Promise((e=>setTimeout(e,3e3,"timeout")))])?console.warn("Could not record the widget as recently closed because the context did not become ready in 3 seconds"):this._recordAsRecentlyClosed(e,s.contentsModel)),e.isDisposed)return!0;e.dispose()}return s}onDelete(e){return e.dispose(),Promise.resolve(void 0)}_recordAsRecentlyOpened(e,t){var s;const n=this._recentsManager;if(!n)return;const i=t.path,a=this._registry.getFileTypeForModel(t).contentType,o=null===(s=w.factoryProperty.get(e))||void 0===s?void 0:s.name;if(n.addRecent({path:i,contentType:a,factory:o},"opened"),"directory"!==a){const e=i.lastIndexOf("/")>0?i.slice(0,i.lastIndexOf("/")):"";n.addRecent({path:e,contentType:"directory"},"opened")}}_recordAsRecentlyClosed(e,t){var s;const n=this._recentsManager;if(!n)return;const i=t.path,a=this._registry.getFileTypeForModel(t).contentType,o=null===(s=w.factoryProperty.get(e))||void 0===s?void 0:s.name;n.addRecent({path:i,contentType:a,factory:o},"closed")}async _maybeClose(e,t){var s,n;const a=(t=t||o.nullTranslator).load("jupyterlab"),r=w.contextProperty.get(e);if(!r)return Promise.resolve([!0,!0]);let c=w.widgetsProperty.get(r);if(!c)return Promise.resolve([!0,!0]);c=c.filter((e=>{const t=w.factoryProperty.get(e);return!!t&&!1===t.readOnly}));const l=e.title.label,h=w.factoryProperty.get(e),d=r.model.dirty&&c.length<=1&&!(null===(s=null==h?void 0:h.readOnly)||void 0===s||s);if(this.confirmClosingDocument){const e=[i.Dialog.cancelButton(),i.Dialog.okButton({label:d?a.__("Close and save"):a.__("Close"),ariaLabel:d?a.__("Close and save Document"):a.__("Close Document")})];d&&e.splice(1,0,i.Dialog.warnButton({label:a.__("Close without saving"),ariaLabel:a.__("Close Document without saving")}));const t=await(0,i.showDialog)({title:a.__("Confirmation"),body:a.__('Please confirm you want to close "%1".',l),checkbox:d?null:{label:a.__("Do not ask me again."),caption:a.__("If checked, no confirmation to close a document will be asked in the future.")},buttons:e});return t.isChecked&&(this.confirmClosingDocument=!1),Promise.resolve([t.button.accept,!d||"warn"===t.button.displayType])}{if(!d)return Promise.resolve([!0,!0]);const e=(null===(n=r.contentsModel)||void 0===n?void 0:n.writable)?a.__("Save"):a.__("Save as"),t=await(0,i.showDialog)({title:a.__("Save your work"),body:a.__('Save changes in "%1" before closing?',l),buttons:[i.Dialog.cancelButton(),i.Dialog.warnButton({label:a.__("Discard"),ariaLabel:a.__("Discard changes to file")}),i.Dialog.okButton({label:e})]});return[t.button.accept,"warn"===t.button.displayType]}}_widgetDisposed(e){const t=w.contextProperty.get(e);if(!t)return;const s=w.widgetsProperty.get(t);s&&(u.ArrayExt.removeFirstOf(s,e),s.length||t.dispose())}_onWidgetDisposed(e){w.disposablesProperty.get(e).dispose()}_onFileChanged(e){const t=w.widgetsProperty.get(e);for(const e of t)this.setCaption(e)}_onPathChanged(e){const t=w.widgetsProperty.get(e);for(const e of t)this.setCaption(e)}}!function(e){e.contextProperty=new p.AttachedProperty({name:"context",create:()=>{}}),e.factoryProperty=new p.AttachedProperty({name:"factory",create:()=>{}}),e.widgetsProperty=new p.AttachedProperty({name:"widgets",create:()=>[]}),e.disposablesProperty=new p.AttachedProperty({name:"disposables",create:()=>new C.DisposableSet})}(w||(w={}));class M{constructor(e){var t;this._activateRequested=new v.Signal(this),this._contexts=[],this._isDisposed=!1,this._autosave=!0,this._autosaveInterval=120,this._lastModifiedCheckMargin=500,this._renameUntitledFileOnSave=!0,this._stateChanged=new v.Signal(this),this.translator=e.translator||o.nullTranslator,this.registry=e.registry,this.services=e.manager,this._dialogs=null!==(t=e.sessionDialogs)&&void 0!==t?t:new i.SessionContextDialogs({translator:e.translator}),this._isConnectedCallback=e.isConnectedCallback||(()=>!0),this._opener=e.opener,this._when=e.when||e.manager.ready;const s=new x({registry:this.registry,translator:this.translator,recentsManager:e.recentsManager});s.activateRequested.connect(this._onActivateRequested,this),s.stateChanged.connect(this._onWidgetStateChanged,this),this._widgetManager=s,this._setBusy=e.setBusy}get activateRequested(){return this._activateRequested}get autosave(){return this._autosave}set autosave(e){if(this._autosave!==e){const t=this._autosave;this._autosave=e,this._contexts.forEach((t=>{const s=y.saveHandlerProperty.get(t);s&&(!0!==e||s.isActive?!1===e&&s.isActive&&s.stop():s.start())})),this._stateChanged.emit({name:"autosave",oldValue:t,newValue:e})}}get autosaveInterval(){return this._autosaveInterval}set autosaveInterval(e){if(this._autosaveInterval!==e){const t=this._autosaveInterval;this._autosaveInterval=e,this._contexts.forEach((t=>{const s=y.saveHandlerProperty.get(t);s&&(s.saveInterval=e||120)})),this._stateChanged.emit({name:"autosaveInterval",oldValue:t,newValue:e})}}get confirmClosingDocument(){return this._widgetManager.confirmClosingDocument}set confirmClosingDocument(e){if(this._widgetManager.confirmClosingDocument!==e){const t=this._widgetManager.confirmClosingDocument;this._widgetManager.confirmClosingDocument=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get lastModifiedCheckMargin(){return this._lastModifiedCheckMargin}set lastModifiedCheckMargin(e){if(this._lastModifiedCheckMargin!==e){const t=this._lastModifiedCheckMargin;this._lastModifiedCheckMargin=e,this._contexts.forEach((t=>{t.lastModifiedCheckMargin=e})),this._stateChanged.emit({name:"lastModifiedCheckMargin",oldValue:t,newValue:e})}}get renameUntitledFileOnSave(){return this._renameUntitledFileOnSave}set renameUntitledFileOnSave(e){if(this._renameUntitledFileOnSave!==e){const t=this._renameUntitledFileOnSave;this._renameUntitledFileOnSave=e,this._stateChanged.emit({name:"renameUntitledFileOnSave",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.clearData(this),this._contexts.forEach((e=>this._widgetManager.closeWidgets(e))),this._widgetManager.dispose(),this._contexts.length=0)}cloneWidget(e){return this._widgetManager.cloneWidget(e)}closeAll(){return Promise.all(this._contexts.map((e=>this._widgetManager.closeWidgets(e)))).then((()=>{}))}closeFile(e){const t=this._contextsForPath(e).map((e=>this._widgetManager.closeWidgets(e)));return Promise.all(t).then((e=>{}))}contextForWidget(e){return this._widgetManager.contextForWidget(e)}copy(e,t){return this.services.contents.copy(e,t)}createNew(e,t="default",s){return this._createOrOpenDocument("create",e,t,s)}deleteFile(e){return this.services.sessions.stopIfNeeded(e).then((()=>this.services.contents.delete(e))).then((()=>(this._contextsForPath(e).forEach((e=>this._widgetManager.deleteWidgets(e))),Promise.resolve(void 0))))}duplicate(e){const t=a.PathExt.dirname(e);return this.services.contents.copy(e,t)}findWidget(e,t="default"){const s=a.PathExt.normalize(e);let n=[t];if("default"===t){const e=this.registry.defaultWidgetFactory(s);if(!e)return;n=[e.name]}else null===t&&(n=this.registry.preferredWidgetFactories(s).map((e=>e.name)));for(const e of this._contextsForPath(s))for(const t of n)if(null!==t){const s=this._widgetManager.findWidget(e,t);if(s)return s}}newUntitled(e){return"file"===e.type&&(e.ext=e.ext||".txt"),this.services.contents.newUntitled(e)}open(e,t="default",s,n){return this._createOrOpenDocument("open",e,t,s,n)}openOrReveal(e,t="default",s,n){const i=this.findWidget(e,t);return i?(this._opener.open(i,{type:t,...n}),i):this.open(e,t,s,null!=n?n:{})}overwrite(e,t){const s=`${t}.${m.UUID.uuid4()}`,n=()=>this.rename(s,t);return this.rename(e,s).then((()=>this.deleteFile(t))).then(n,n)}rename(e,t){return this.services.contents.rename(e,t)}_findContext(e,t){const s=this.services.contents.normalize(e);return(0,u.find)(this._contexts,(e=>e.path===s&&e.factoryName===t))}_contextsForPath(e){const t=this.services.contents.normalize(e);return this._contexts.filter((e=>e.path===t))}_createContext(e,t,s){const n=new _.Context({opener:(e,t)=>{this._widgetManager.adoptWidget(n,e),this._opener.open(e,t)},manager:this.services,factory:t,path:e,kernelPreference:s,setBusy:this._setBusy,sessionDialogs:this._dialogs,lastModifiedCheckMargin:this._lastModifiedCheckMargin,translator:this.translator}),i=new f({context:n,isConnectedCallback:this._isConnectedCallback,saveInterval:this.autosaveInterval});return y.saveHandlerProperty.set(n,i),n.ready.then((()=>{this.autosave&&i.start()})),n.disposed.connect(this._onContextDisposed,this),this._contexts.push(n),n}_onContextDisposed(e){u.ArrayExt.removeFirstOf(this._contexts,e)}_widgetFactoryFor(e,t){const{registry:s}=this;if("default"===t){const n=s.defaultWidgetFactory(e);if(!n)return;t=n.name}return s.getWidgetFactory(t)}_createOrOpenDocument(e,t,s="default",n,i){const a=this._widgetFactoryFor(t,s);if(!a)return;const o=a.modelName||"text",r=this.registry.getModelFactory(o);if(!r)return;const c=this.registry.getKernelPreference(t,a.name,n);let l,h=Promise.resolve(void 0);if("open"===e)l=this._findContext(t,r.name)||null,l||(l=this._createContext(t,r,c),h=this._when.then((()=>l.initialize(!1))));else{if("create"!==e)throw new Error(`Invalid argument 'which': ${e}`);l=this._createContext(t,r,c),h=this._when.then((()=>l.initialize(!0)))}const d=this._widgetManager.createWidget(a,l);return this._opener.open(d,{type:a.name,...i}),h.catch((e=>{console.error(`Failed to initialize the context with '${r.name}' for ${t}`,e),d.close()})),d}_onActivateRequested(e,t){this._activateRequested.emit(t)}_onWidgetStateChanged(e,t){"confirmClosingDocument"===t.name&&this._stateChanged.emit(t)}}!function(e){e.saveHandlerProperty=new p.AttachedProperty({name:"saveHandler",create:()=>{}})}(y||(y={}));var P=s(58515),b=s(95291),R=s(78156),S=s.n(R);function T(e){return S().createElement(P.TextItem,{source:e.name,title:e.fullPath})}class F extends b.VDomRenderer{constructor(e){super(new F.Model(e.docManager)),this.node.title=this.model.path}render(){return S().createElement(T,{fullPath:this.model.path,name:this.model.name})}}function k(e){return S().createElement(P.TextItem,{source:e.fileStatus})}!function(e){class t extends b.VDomModel{constructor(e){super(),this._onTitleChange=e=>{const t=this._getAllState();this._name=e.label,this._triggerChange(t,this._getAllState())},this._onPathChange=(e,t)=>{const s=this._getAllState();this._path=t,this._name=a.PathExt.basename(t),this._triggerChange(s,this._getAllState())},this._path="",this._name="",this._widget=null,this._docManager=e}get path(){return this._path}get name(){return this._name}get widget(){return this._widget}set widget(e){const t=this._widget;if(null!==t){const e=this._docManager.contextForWidget(t);e?e.pathChanged.disconnect(this._onPathChange):t.title.changed.disconnect(this._onTitleChange)}const s=this._getAllState();if(this._widget=e,null===this._widget)this._path="",this._name="";else{const e=this._docManager.contextForWidget(this._widget);e?(this._path=e.path,this._name=a.PathExt.basename(e.path),e.pathChanged.connect(this._onPathChange)):(this._path="",this._name=this._widget.title.label,this._widget.title.changed.connect(this._onTitleChange))}this._triggerChange(s,this._getAllState())}_getAllState(){return[this._path,this._name]}_triggerChange(e,t){e[0]===t[0]&&e[1]===t[1]||this.stateChanged.emit(void 0)}}e.Model=t}(F||(F={}));class W extends b.VDomRenderer{constructor(e){super(new W.Model(e.docManager));const t=(e.translator||o.nullTranslator).load("jupyterlab");this._statusMap={completed:t.__("Saving completed"),started:t.__("Saving started"),failed:t.__("Saving failed")}}render(){return null===this.model||null===this.model.status?null:S().createElement(k,{fileStatus:this._statusMap[this.model.status]})}}!function(e){class t extends b.VDomModel{constructor(e){super(),this._onStatusChange=(e,t)=>{this._status=t,"completed"===this._status?(setTimeout((()=>{this._status=null,this.stateChanged.emit(void 0)}),2e3),this.stateChanged.emit(void 0)):this.stateChanged.emit(void 0)},this._status=null,this._widget=null,this._status=null,this.widget=null,this._docManager=e}get status(){return this._status}get widget(){return this._widget}set widget(e){var t,s;const n=this._widget;if(null!==n){const e=this._docManager.contextForWidget(n);e?e.saveState.disconnect(this._onStatusChange):(null===(t=this._widget.content)||void 0===t?void 0:t.saveStateChanged)&&this._widget.content.saveStateChanged.disconnect(this._onStatusChange)}if(this._widget=e,null===this._widget)this._status=null;else{const e=this._docManager.contextForWidget(this._widget);e?e.saveState.connect(this._onStatusChange):(null===(s=this._widget.content)||void 0===s?void 0:s.saveStateChanged)&&this._widget.content.saveStateChanged.connect(this._onStatusChange)}}}e.Model=t}(W||(W={}));const A=new m.Token("@jupyterlab/docmanager:IDocumentManager","A service for the manager for all\n documents used by the application. Use this if you want to open and close documents,\n create and delete files, and otherwise interact with the file system."),E=new m.Token("@jupyterlab/docmanager:IDocumentWidgetOpener","A service to open a widget."),I=new m.Token("@jupyterlab/docmanager:IRecentsManager","A service providing information about recently opened and closed documents");var O,B=s(97934);class N{constructor(e){this._recentsChanged=new v.Signal(this),this._recents={opened:[],closed:[]},this._isDisposed=!1,this._maxRecentsLength=10,this._saveDebouncer=new B.Debouncer(this._save.bind(this),500),this._stateDB=e.stateDB,this._contentsManager=e.contents,this.updateRootDir(),this._loadRecents().catch((e=>{console.error(`Failed to load recent list from state:\n${e}`)}))}get isDisposed(){return this._isDisposed}get recentlyOpened(){return(this._recents.opened||[]).filter((e=>e.root===this._serverRoot))}get recentlyClosed(){return(this._recents.closed||[]).filter((e=>e.root===this._serverRoot))}get changed(){return this._recentsChanged}get maximalRecentsLength(){return this._maxRecentsLength}set maximalRecentsLength(e){this._maxRecentsLength=Math.round(Math.max(1,e));let t=!1;for(const e of["opened","closed"])this._recents[e].length>this._maxRecentsLength&&(this._recents[e].length=this._maxRecentsLength,t=!0);t&&this._recentsChanged.emit(void 0)}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.clearData(this),this._saveDebouncer.dispose())}addRecent(e,t){const s={...e,root:this._serverRoot},n=this._recents[t],i=n.findIndex((t=>t.path===e.path));i>=0&&n.splice(i,1),n.unshift(s),this._setRecents(n,t),this._recentsChanged.emit(void 0)}clearRecents(){this._setRecents([],"opened"),this._setRecents([],"closed"),this._recentsChanged.emit(void 0)}removeRecent(e,t){this._removeRecent(e.path,[t])}async validate(e){const t=await this._isValid(e);return t||this._removeRecent(e.path),t}updateRootDir(){this._serverRoot=a.PageConfig.getOption("serverRoot")}_removeRecent(e,t=["opened","closed"]){let s=!1;for(const n of t){const t=this._recents[n],i=t.filter((t=>e!==t.path));t.length!==i.length&&(this._setRecents(i,n),s=!0)}s&&this._recentsChanged.emit(void 0)}async _isValid(e){var t;try{await this._contentsManager.get(e.path,{content:!1})}catch(e){if(404===(null===(t=e.response)||void 0===t?void 0:t.status))return!1}return!0}_setRecents(e,t){this._recents[t]=e.slice(0,this.maximalRecentsLength).sort(((e,t)=>e.root===t.root?0:e.root!==this._serverRoot?1:-1)),this._saveDebouncer.invoke().catch(console.warn)}async _loadRecents(){const e=await this._stateDB.fetch(O.stateDBKey)||{opened:[],closed:[]},t=[...e.opened,...e.closed],s=new Set(await this._getInvalidPaths(t));for(const t of["opened","closed"])this._setRecents(e[t].filter((e=>!s.has(e.path))),t);this._recentsChanged.emit(void 0)}async _getInvalidPaths(e){return(await Promise.all(e.map((async e=>await this._isValid(e)?null:e.path)))).filter((e=>"string"==typeof e))}async _save(){try{await this._stateDB.save(O.stateDBKey,this._recents)}catch(e){console.log("Saving recents failed",e)}}}!function(e){e.stateDBKey="docmanager:recents"}(O||(O={}))}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7543],{37543:(e,t,s)=>{s.r(t),s.d(t,{DocumentManager:()=>M,DocumentWidgetManager:()=>x,IDocumentManager:()=>A,IDocumentWidgetOpener:()=>E,IRecentsManager:()=>I,PathStatus:()=>F,RecentsManager:()=>N,SaveHandler:()=>f,SavingStatus:()=>W,isValidFileName:()=>d,renameDialog:()=>c,renameFile:()=>l,shouldOverwrite:()=>h});var n,i=s(53876),a=s(20754),o=s(93050),r=s(2260);function c(e,t,s){const n=(s=s||o.nullTranslator).load("jupyterlab"),a=t.localPath.split("/").pop()||t.localPath;return(0,i.showDialog)({title:n.__("Rename File"),body:new g(a),focusNodeSelector:"input",buttons:[i.Dialog.cancelButton(),i.Dialog.okButton({label:n.__("Rename"),ariaLabel:n.__("Rename File")})]}).then((e=>e.value?d(e.value)?t.rename(e.value):((0,i.showErrorMessage)(n.__("Rename Error"),Error(n.__('"%1" is not a valid name for a file. Names must have nonzero length, and cannot include "/", "\\", or ":"',e.value))),null):null))}function l(e,t,s){return e.rename(t,s).catch((n=>{if(409!==n.response.status)throw n;return h(s).then((n=>n?e.overwrite(t,s):Promise.reject("File not renamed")))}))}function h(e,t){const s=(t=t||o.nullTranslator).load("jupyterlab"),n={title:s.__("Overwrite file?"),body:s.__('"%1" already exists, overwrite?',e),buttons:[i.Dialog.cancelButton(),i.Dialog.warnButton({label:s.__("Overwrite"),ariaLabel:s.__("Overwrite Existing File")})]};return(0,i.showDialog)(n).then((e=>Promise.resolve(e.button.accept)))}function d(e){return e.length>0&&!/[\/\\:]/.test(e)}class g extends r.Widget{constructor(e){super({node:n.createRenameNode(e)}),this.addClass("jp-FileDialog");const t=a.PathExt.extname(e),s=this.inputNode.value=a.PathExt.basename(e);this.inputNode.setSelectionRange(0,s.length-t.length)}get inputNode(){return this.node.getElementsByTagName("input")[0]}getValue(){return this.inputNode.value}}!function(e){e.createRenameNode=function(e,t){const s=(t=t||o.nullTranslator).load("jupyterlab"),n=document.createElement("div"),i=document.createElement("label");i.textContent=s.__("File Path");const a=document.createElement("span");a.textContent=e;const r=document.createElement("label");r.textContent=s.__("New Name"),r.className="jp-new-name-title";const c=document.createElement("input");return n.appendChild(i),n.appendChild(a),n.appendChild(r),n.appendChild(c),n}}(n||(n={}));var _=s(23764),u=s(14931),m=s(21961),p=s(80480),v=s(2159);class f{constructor(e){this._autosaveTimer=-1,this._minInterval=-1,this._interval=-1,this._isActive=!1,this._inDialog=!1,this._isDisposed=!1,this._multiplier=10,this._context=e.context,this._isConnectedCallback=e.isConnectedCallback||(()=>!0);const t=e.saveInterval||120;this._minInterval=1e3*t,this._interval=this._minInterval,this._context.fileChanged.connect(this._setTimer,this),this._context.disposed.connect(this.dispose,this)}get saveInterval(){return this._interval/1e3}set saveInterval(e){this._minInterval=this._interval=1e3*e,this._isActive&&this._setTimer()}get isActive(){return this._isActive}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,clearTimeout(this._autosaveTimer),v.Signal.clearData(this))}start(){this._isActive=!0,this._setTimer()}stop(){this._isActive=!1,clearTimeout(this._autosaveTimer)}_setTimer(){clearTimeout(this._autosaveTimer),this._isActive&&(this._autosaveTimer=window.setTimeout((()=>{this._isConnectedCallback()&&this._save()}),this._interval))}_save(){const e=this._context;if(this._setTimer(),!e)return;if(!e.contentsModel||!e.contentsModel.writable||!e.model.dirty||this._inDialog)return;const t=(new Date).getTime();e.save().then((()=>{if(this.isDisposed)return;const e=(new Date).getTime()-t;this._interval=Math.max(this._multiplier*e,this._minInterval),this._setTimer()})).catch((e=>{const{name:t}=e;"ModalCancelError"!==t&&"ModalDuplicateError"!==t&&console.error("Error in Auto-Save",e.message)}))}}var w,y,C=s(49901),D=s(62633);class x{constructor(e){this._activateRequested=new v.Signal(this),this._confirmClosingTab=!1,this._isDisposed=!1,this._stateChanged=new v.Signal(this),this._registry=e.registry,this.translator=e.translator||o.nullTranslator,this._recentsManager=e.recentsManager||null}get activateRequested(){return this._activateRequested}get confirmClosingDocument(){return this._confirmClosingTab}set confirmClosingDocument(e){if(this._confirmClosingTab!==e){const t=this._confirmClosingTab;this._confirmClosingTab=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.disconnectReceiver(this))}createWidget(e,t){const s=e.createNew(t);return this._initializeWidget(s,e,t),s}_initializeWidget(e,t,s){w.factoryProperty.set(e,t);const n=new C.DisposableSet;for(const i of this._registry.widgetExtensions(t.name)){const t=i.createNew(e,s);t&&n.add(t)}w.disposablesProperty.set(e,n),e.disposed.connect(this._onWidgetDisposed,this),this.adoptWidget(s,e),s.fileChanged.connect(this._onFileChanged,this),s.pathChanged.connect(this._onPathChanged,this),s.ready.then((()=>{this.setCaption(e)}))}adoptWidget(e,t){w.widgetsProperty.get(e).push(t),D.MessageLoop.installMessageHook(t,this),t.addClass("jp-Document"),t.title.closable=!0,t.disposed.connect(this._widgetDisposed,this),w.contextProperty.set(t,e)}findWidget(e,t){const s=w.widgetsProperty.get(e);if(s)return(0,u.find)(s,(e=>{const s=w.factoryProperty.get(e);return!!s&&s.name===t}))}contextForWidget(e){return w.contextProperty.get(e)}cloneWidget(e){const t=w.contextProperty.get(e);if(!t)return;const s=w.factoryProperty.get(e);if(!s)return;const n=s.createNew(t,e);return this._initializeWidget(n,s,t),n}closeWidgets(e){const t=w.widgetsProperty.get(e);return Promise.all(t.map((e=>this.onClose(e)))).then((()=>{}))}deleteWidgets(e){const t=w.widgetsProperty.get(e);return Promise.all(t.map((e=>this.onDelete(e)))).then((()=>{}))}messageHook(e,t){switch(t.type){case"close-request":return this.onClose(e),!1;case"activate-request":{const t=e,s=this.contextForWidget(t);s&&(s.ready.then((()=>{this._recordAsRecentlyOpened(t,s.contentsModel)})).catch((()=>{console.warn("Could not record the recents status for",s)})),this._activateRequested.emit(s.path));break}}return!0}async setCaption(e){const t=this.translator.load("jupyterlab"),s=w.contextProperty.get(e);if(!s)return;const n=s.contentsModel;if(n)return s.listCheckpoints().then((i=>{if(e.isDisposed)return;const o=i[i.length-1],r=o?a.Time.format(o.last_modified):"None";let c=t.__("Name: %1\nPath: %2\n",n.name,n.path);s.model.readOnly?c+=t.__("Read-only"):c+=t.__("Last Saved: %1\n",a.Time.format(n.last_modified))+t.__("Last Checkpoint: %1",r),e.title.caption=c}));e.title.caption=""}async onClose(e){var t;const[s,n]=await this._maybeClose(e,this.translator);if(e.isDisposed)return!0;if(s){const s=w.contextProperty.get(e);if(!n){if(!s)return!0;(null===(t=s.contentsModel)||void 0===t?void 0:t.writable)?await s.save():await s.saveAs()}if(s&&("timeout"===await Promise.race([s.ready,new Promise((e=>setTimeout(e,3e3,"timeout")))])?console.warn("Could not record the widget as recently closed because the context did not become ready in 3 seconds"):this._recordAsRecentlyClosed(e,s.contentsModel)),e.isDisposed)return!0;e.dispose()}return s}onDelete(e){return e.dispose(),Promise.resolve(void 0)}_recordAsRecentlyOpened(e,t){var s;const n=this._recentsManager;if(!n)return;const i=t.path,a=this._registry.getFileTypeForModel(t).contentType,o=null===(s=w.factoryProperty.get(e))||void 0===s?void 0:s.name;if(n.addRecent({path:i,contentType:a,factory:o},"opened"),"directory"!==a){const e=i.lastIndexOf("/")>0?i.slice(0,i.lastIndexOf("/")):"";n.addRecent({path:e,contentType:"directory"},"opened")}}_recordAsRecentlyClosed(e,t){var s;const n=this._recentsManager;if(!n)return;const i=t.path,a=this._registry.getFileTypeForModel(t).contentType,o=null===(s=w.factoryProperty.get(e))||void 0===s?void 0:s.name;n.addRecent({path:i,contentType:a,factory:o},"closed")}async _maybeClose(e,t){var s,n;const a=(t=t||o.nullTranslator).load("jupyterlab"),r=w.contextProperty.get(e);if(!r)return Promise.resolve([!0,!0]);let c=w.widgetsProperty.get(r);if(!c)return Promise.resolve([!0,!0]);c=c.filter((e=>{const t=w.factoryProperty.get(e);return!!t&&!1===t.readOnly}));const l=e.title.label,h=w.factoryProperty.get(e),d=r.model.dirty&&c.length<=1&&!(null===(s=null==h?void 0:h.readOnly)||void 0===s||s);if(this.confirmClosingDocument){const e=[i.Dialog.cancelButton(),i.Dialog.okButton({label:d?a.__("Close and save"):a.__("Close"),ariaLabel:d?a.__("Close and save Document"):a.__("Close Document")})];d&&e.splice(1,0,i.Dialog.warnButton({label:a.__("Close without saving"),ariaLabel:a.__("Close Document without saving")}));const t=await(0,i.showDialog)({title:a.__("Confirmation"),body:a.__('Please confirm you want to close "%1".',l),checkbox:d?null:{label:a.__("Do not ask me again."),caption:a.__("If checked, no confirmation to close a document will be asked in the future.")},buttons:e});return t.isChecked&&(this.confirmClosingDocument=!1),Promise.resolve([t.button.accept,!d||"warn"===t.button.displayType])}{if(!d)return Promise.resolve([!0,!0]);const e=(null===(n=r.contentsModel)||void 0===n?void 0:n.writable)?a.__("Save"):a.__("Save as"),t=await(0,i.showDialog)({title:a.__("Save your work"),body:a.__('Save changes in "%1" before closing?',l),buttons:[i.Dialog.cancelButton(),i.Dialog.warnButton({label:a.__("Discard"),ariaLabel:a.__("Discard changes to file")}),i.Dialog.okButton({label:e})]});return[t.button.accept,"warn"===t.button.displayType]}}_widgetDisposed(e){const t=w.contextProperty.get(e);if(!t)return;const s=w.widgetsProperty.get(t);s&&(u.ArrayExt.removeFirstOf(s,e),s.length||t.dispose())}_onWidgetDisposed(e){w.disposablesProperty.get(e).dispose()}_onFileChanged(e){const t=w.widgetsProperty.get(e);for(const e of t)this.setCaption(e)}_onPathChanged(e){const t=w.widgetsProperty.get(e);for(const e of t)this.setCaption(e)}}!function(e){e.contextProperty=new p.AttachedProperty({name:"context",create:()=>{}}),e.factoryProperty=new p.AttachedProperty({name:"factory",create:()=>{}}),e.widgetsProperty=new p.AttachedProperty({name:"widgets",create:()=>[]}),e.disposablesProperty=new p.AttachedProperty({name:"disposables",create:()=>new C.DisposableSet})}(w||(w={}));class M{constructor(e){var t;this._activateRequested=new v.Signal(this),this._contexts=[],this._isDisposed=!1,this._autosave=!0,this._autosaveInterval=120,this._lastModifiedCheckMargin=500,this._renameUntitledFileOnSave=!0,this._stateChanged=new v.Signal(this),this.translator=e.translator||o.nullTranslator,this.registry=e.registry,this.services=e.manager,this._dialogs=null!==(t=e.sessionDialogs)&&void 0!==t?t:new i.SessionContextDialogs({translator:e.translator}),this._isConnectedCallback=e.isConnectedCallback||(()=>!0),this._opener=e.opener,this._when=e.when||e.manager.ready;const s=new x({registry:this.registry,translator:this.translator,recentsManager:e.recentsManager});s.activateRequested.connect(this._onActivateRequested,this),s.stateChanged.connect(this._onWidgetStateChanged,this),this._widgetManager=s,this._setBusy=e.setBusy}get activateRequested(){return this._activateRequested}get autosave(){return this._autosave}set autosave(e){if(this._autosave!==e){const t=this._autosave;this._autosave=e,this._contexts.forEach((t=>{const s=y.saveHandlerProperty.get(t);s&&(!0!==e||s.isActive?!1===e&&s.isActive&&s.stop():s.start())})),this._stateChanged.emit({name:"autosave",oldValue:t,newValue:e})}}get autosaveInterval(){return this._autosaveInterval}set autosaveInterval(e){if(this._autosaveInterval!==e){const t=this._autosaveInterval;this._autosaveInterval=e,this._contexts.forEach((t=>{const s=y.saveHandlerProperty.get(t);s&&(s.saveInterval=e||120)})),this._stateChanged.emit({name:"autosaveInterval",oldValue:t,newValue:e})}}get confirmClosingDocument(){return this._widgetManager.confirmClosingDocument}set confirmClosingDocument(e){if(this._widgetManager.confirmClosingDocument!==e){const t=this._widgetManager.confirmClosingDocument;this._widgetManager.confirmClosingDocument=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get lastModifiedCheckMargin(){return this._lastModifiedCheckMargin}set lastModifiedCheckMargin(e){if(this._lastModifiedCheckMargin!==e){const t=this._lastModifiedCheckMargin;this._lastModifiedCheckMargin=e,this._contexts.forEach((t=>{t.lastModifiedCheckMargin=e})),this._stateChanged.emit({name:"lastModifiedCheckMargin",oldValue:t,newValue:e})}}get renameUntitledFileOnSave(){return this._renameUntitledFileOnSave}set renameUntitledFileOnSave(e){if(this._renameUntitledFileOnSave!==e){const t=this._renameUntitledFileOnSave;this._renameUntitledFileOnSave=e,this._stateChanged.emit({name:"renameUntitledFileOnSave",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.clearData(this),this._contexts.forEach((e=>this._widgetManager.closeWidgets(e))),this._widgetManager.dispose(),this._contexts.length=0)}cloneWidget(e){return this._widgetManager.cloneWidget(e)}closeAll(){return Promise.all(this._contexts.map((e=>this._widgetManager.closeWidgets(e)))).then((()=>{}))}closeFile(e){const t=this._contextsForPath(e).map((e=>this._widgetManager.closeWidgets(e)));return Promise.all(t).then((e=>{}))}contextForWidget(e){return this._widgetManager.contextForWidget(e)}copy(e,t){return this.services.contents.copy(e,t)}createNew(e,t="default",s){return this._createOrOpenDocument("create",e,t,s)}deleteFile(e){return this.services.sessions.stopIfNeeded(e).then((()=>this.services.contents.delete(e))).then((()=>(this._contextsForPath(e).forEach((e=>this._widgetManager.deleteWidgets(e))),Promise.resolve(void 0))))}duplicate(e){const t=a.PathExt.dirname(e);return this.services.contents.copy(e,t)}findWidget(e,t="default"){const s=a.PathExt.normalize(e);let n=[t];if("default"===t){const e=this.registry.defaultWidgetFactory(s);if(!e)return;n=[e.name]}else null===t&&(n=this.registry.preferredWidgetFactories(s).map((e=>e.name)));for(const e of this._contextsForPath(s))for(const t of n)if(null!==t){const s=this._widgetManager.findWidget(e,t);if(s)return s}}newUntitled(e){return"file"===e.type&&(e.ext=e.ext||".txt"),this.services.contents.newUntitled(e)}open(e,t="default",s,n){return this._createOrOpenDocument("open",e,t,s,n)}openOrReveal(e,t="default",s,n){const i=this.findWidget(e,t);return i?(this._opener.open(i,{type:t,...n}),i):this.open(e,t,s,null!=n?n:{})}overwrite(e,t){const s=`${t}.${m.UUID.uuid4()}`,n=()=>this.rename(s,t);return this.rename(e,s).then((()=>this.deleteFile(t))).then(n,n)}rename(e,t){return this.services.contents.rename(e,t)}_findContext(e,t){const s=this.services.contents.normalize(e);return(0,u.find)(this._contexts,(e=>e.path===s&&e.factoryName===t))}_contextsForPath(e){const t=this.services.contents.normalize(e);return this._contexts.filter((e=>e.path===t))}_createContext(e,t,s){const n=new _.Context({opener:(e,t)=>{this._widgetManager.adoptWidget(n,e),this._opener.open(e,t)},manager:this.services,factory:t,path:e,kernelPreference:s,setBusy:this._setBusy,sessionDialogs:this._dialogs,lastModifiedCheckMargin:this._lastModifiedCheckMargin,translator:this.translator}),i=new f({context:n,isConnectedCallback:this._isConnectedCallback,saveInterval:this.autosaveInterval});return y.saveHandlerProperty.set(n,i),n.ready.then((()=>{this.autosave&&i.start()})),n.disposed.connect(this._onContextDisposed,this),this._contexts.push(n),n}_onContextDisposed(e){u.ArrayExt.removeFirstOf(this._contexts,e)}_widgetFactoryFor(e,t){const{registry:s}=this;if("default"===t){const n=s.defaultWidgetFactory(e);if(!n)return;t=n.name}return s.getWidgetFactory(t)}_createOrOpenDocument(e,t,s="default",n,i){const a=this._widgetFactoryFor(t,s);if(!a)return;const o=a.modelName||"text",r=this.registry.getModelFactory(o);if(!r)return;const c=this.registry.getKernelPreference(t,a.name,n);let l,h=Promise.resolve(void 0);if("open"===e)l=this._findContext(t,r.name)||null,l||(l=this._createContext(t,r,c),h=this._when.then((()=>l.initialize(!1))));else{if("create"!==e)throw new Error(`Invalid argument 'which': ${e}`);l=this._createContext(t,r,c),h=this._when.then((()=>l.initialize(!0)))}const d=this._widgetManager.createWidget(a,l);return this._opener.open(d,{type:a.name,...i}),h.catch((e=>{console.error(`Failed to initialize the context with '${r.name}' for ${t}`,e),d.close()})),d}_onActivateRequested(e,t){this._activateRequested.emit(t)}_onWidgetStateChanged(e,t){"confirmClosingDocument"===t.name&&this._stateChanged.emit(t)}}!function(e){e.saveHandlerProperty=new p.AttachedProperty({name:"saveHandler",create:()=>{}})}(y||(y={}));var P=s(33441),b=s(76878),R=s(78156),S=s.n(R);function T(e){return S().createElement(P.TextItem,{source:e.name,title:e.fullPath})}class F extends b.VDomRenderer{constructor(e){super(new F.Model(e.docManager)),this.node.title=this.model.path}render(){return S().createElement(T,{fullPath:this.model.path,name:this.model.name})}}function k(e){return S().createElement(P.TextItem,{source:e.fileStatus})}!function(e){class t extends b.VDomModel{constructor(e){super(),this._onTitleChange=e=>{const t=this._getAllState();this._name=e.label,this._triggerChange(t,this._getAllState())},this._onPathChange=(e,t)=>{const s=this._getAllState();this._path=t,this._name=a.PathExt.basename(t),this._triggerChange(s,this._getAllState())},this._path="",this._name="",this._widget=null,this._docManager=e}get path(){return this._path}get name(){return this._name}get widget(){return this._widget}set widget(e){const t=this._widget;if(null!==t){const e=this._docManager.contextForWidget(t);e?e.pathChanged.disconnect(this._onPathChange):t.title.changed.disconnect(this._onTitleChange)}const s=this._getAllState();if(this._widget=e,null===this._widget)this._path="",this._name="";else{const e=this._docManager.contextForWidget(this._widget);e?(this._path=e.path,this._name=a.PathExt.basename(e.path),e.pathChanged.connect(this._onPathChange)):(this._path="",this._name=this._widget.title.label,this._widget.title.changed.connect(this._onTitleChange))}this._triggerChange(s,this._getAllState())}_getAllState(){return[this._path,this._name]}_triggerChange(e,t){e[0]===t[0]&&e[1]===t[1]||this.stateChanged.emit(void 0)}}e.Model=t}(F||(F={}));class W extends b.VDomRenderer{constructor(e){super(new W.Model(e.docManager));const t=(e.translator||o.nullTranslator).load("jupyterlab");this._statusMap={completed:t.__("Saving completed"),started:t.__("Saving started"),failed:t.__("Saving failed")}}render(){return null===this.model||null===this.model.status?null:S().createElement(k,{fileStatus:this._statusMap[this.model.status]})}}!function(e){class t extends b.VDomModel{constructor(e){super(),this._onStatusChange=(e,t)=>{this._status=t,"completed"===this._status?(setTimeout((()=>{this._status=null,this.stateChanged.emit(void 0)}),2e3),this.stateChanged.emit(void 0)):this.stateChanged.emit(void 0)},this._status=null,this._widget=null,this._status=null,this.widget=null,this._docManager=e}get status(){return this._status}get widget(){return this._widget}set widget(e){var t,s;const n=this._widget;if(null!==n){const e=this._docManager.contextForWidget(n);e?e.saveState.disconnect(this._onStatusChange):(null===(t=this._widget.content)||void 0===t?void 0:t.saveStateChanged)&&this._widget.content.saveStateChanged.disconnect(this._onStatusChange)}if(this._widget=e,null===this._widget)this._status=null;else{const e=this._docManager.contextForWidget(this._widget);e?e.saveState.connect(this._onStatusChange):(null===(s=this._widget.content)||void 0===s?void 0:s.saveStateChanged)&&this._widget.content.saveStateChanged.connect(this._onStatusChange)}}}e.Model=t}(W||(W={}));const A=new m.Token("@jupyterlab/docmanager:IDocumentManager","A service for the manager for all\n documents used by the application. Use this if you want to open and close documents,\n create and delete files, and otherwise interact with the file system."),E=new m.Token("@jupyterlab/docmanager:IDocumentWidgetOpener","A service to open a widget."),I=new m.Token("@jupyterlab/docmanager:IRecentsManager","A service providing information about recently opened and closed documents");var O,B=s(32406);class N{constructor(e){this._recentsChanged=new v.Signal(this),this._recents={opened:[],closed:[]},this._isDisposed=!1,this._maxRecentsLength=10,this._saveDebouncer=new B.Debouncer(this._save.bind(this),500),this._stateDB=e.stateDB,this._contentsManager=e.contents,this.updateRootDir(),this._loadRecents().catch((e=>{console.error(`Failed to load recent list from state:\n${e}`)}))}get isDisposed(){return this._isDisposed}get recentlyOpened(){return(this._recents.opened||[]).filter((e=>e.root===this._serverRoot))}get recentlyClosed(){return(this._recents.closed||[]).filter((e=>e.root===this._serverRoot))}get changed(){return this._recentsChanged}get maximalRecentsLength(){return this._maxRecentsLength}set maximalRecentsLength(e){this._maxRecentsLength=Math.round(Math.max(1,e));let t=!1;for(const e of["opened","closed"])this._recents[e].length>this._maxRecentsLength&&(this._recents[e].length=this._maxRecentsLength,t=!0);t&&this._recentsChanged.emit(void 0)}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.clearData(this),this._saveDebouncer.dispose())}addRecent(e,t){const s={...e,root:this._serverRoot},n=this._recents[t],i=n.findIndex((t=>t.path===e.path));i>=0&&n.splice(i,1),n.unshift(s),this._setRecents(n,t),this._recentsChanged.emit(void 0)}clearRecents(){this._setRecents([],"opened"),this._setRecents([],"closed"),this._recentsChanged.emit(void 0)}removeRecent(e,t){this._removeRecent(e.path,[t])}async validate(e){const t=await this._isValid(e);return t||this._removeRecent(e.path),t}updateRootDir(){this._serverRoot=a.PageConfig.getOption("serverRoot")}_removeRecent(e,t=["opened","closed"]){let s=!1;for(const n of t){const t=this._recents[n],i=t.filter((t=>e!==t.path));t.length!==i.length&&(this._setRecents(i,n),s=!0)}s&&this._recentsChanged.emit(void 0)}async _isValid(e){var t;try{await this._contentsManager.get(e.path,{content:!1})}catch(e){if(404===(null===(t=e.response)||void 0===t?void 0:t.status))return!1}return!0}_setRecents(e,t){this._recents[t]=e.slice(0,this.maximalRecentsLength).sort(((e,t)=>e.root===t.root?0:e.root!==this._serverRoot?1:-1)),this._saveDebouncer.invoke().catch(console.warn)}async _loadRecents(){const e=await this._stateDB.fetch(O.stateDBKey)||{opened:[],closed:[]},t=[...e.opened,...e.closed],s=new Set(await this._getInvalidPaths(t));for(const t of["opened","closed"])this._setRecents(e[t].filter((e=>!s.has(e.path))),t);this._recentsChanged.emit(void 0)}async _getInvalidPaths(e){return(await Promise.all(e.map((async e=>await this._isValid(e)?null:e.path)))).filter((e=>"string"==typeof e))}async _save(){try{await this._stateDB.save(O.stateDBKey,this._recents)}catch(e){console.log("Saving recents failed",e)}}}!function(e){e.stateDBKey="docmanager:recents"}(O||(O={}))}}]);
|
notebook/static/755.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[755],{82545:(t,r,e)=>{var o=e(81822)(e(77400),"DataView");t.exports=o},96586:(t,r,e)=>{var o=e(57753),n=e(82452),a=e(22115),s=e(38256),i=e(67426);function u(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var o=t[r];this.set(o[0],o[1])}}u.prototype.clear=o,u.prototype.delete=n,u.prototype.get=a,u.prototype.has=s,u.prototype.set=i,t.exports=u},36301:(t,r,e)=>{var o=e(69417),n=e(72470),a=e(66165),s=e(71873),i=e(52556);function u(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var o=t[r];this.set(o[0],o[1])}}u.prototype.clear=o,u.prototype.delete=n,u.prototype.get=a,u.prototype.has=s,u.prototype.set=i,t.exports=u},44538:(t,r,e)=>{var o=e(81822)(e(77400),"Map");t.exports=o},74554:(t,r,e)=>{var o=e(39448),n=e(7738),a=e(66575),s=e(7238),i=e(38738);function u(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var o=t[r];this.set(o[0],o[1])}}u.prototype.clear=o,u.prototype.delete=n,u.prototype.get=a,u.prototype.has=s,u.prototype.set=i,t.exports=u},64825:(t,r,e)=>{var o=e(81822)(e(77400),"Promise");t.exports=o},46151:(t,r,e)=>{var o=e(81822)(e(77400),"Set");t.exports=o},23694:(t,r,e)=>{var o=e(36301),n=e(7354),a=e(5863),s=e(12367),i=e(90748),u=e(97569);function c(t){var r=this.__data__=new o(t);this.size=r.size}c.prototype.clear=n,c.prototype.delete=a,c.prototype.get=s,c.prototype.has=i,c.prototype.set=u,t.exports=c},96539:(t,r,e)=>{var o=e(77400).Symbol;t.exports=o},59942:(t,r,e)=>{var o=e(77400).Uint8Array;t.exports=o},66902:(t,r,e)=>{var o=e(81822)(e(77400),"WeakMap");t.exports=o},10263:t=>{t.exports=function(t,r){for(var e=-1,o=null==t?0:t.length,n=0,a=[];++e<o;){var s=t[e];r(s,e,t)&&(a[n++]=s)}return a}},98213:(t,r,e)=>{var o=e(24701),n=e(2900),a=e(19785),s=e(43854),i=e(42383),u=e(48519),c=Object.prototype.hasOwnProperty;t.exports=function(t,r){var e=a(t),p=!e&&n(t),f=!e&&!p&&s(t),l=!e&&!p&&!f&&u(t),v=e||p||f||l,h=v?o(t.length,String):[],_=h.length;for(var y in t)!r&&!c.call(t,y)||v&&("length"==y||f&&("offset"==y||"parent"==y)||l&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||i(y,_))||h.push(y);return h}},66070:t=>{t.exports=function(t,r){for(var e=-1,o=null==t?0:t.length,n=Array(o);++e<o;)n[e]=r(t[e],e,t);return n}},97141:t=>{t.exports=function(t,r){for(var e=-1,o=r.length,n=t.length;++e<o;)t[n+e]=r[e];return t}},65041:(t,r,e)=>{var o=e(85638);t.exports=function(t,r){for(var e=t.length;e--;)if(o(t[e][0],r))return e;return-1}},79867:(t,r,e)=>{var o=e(76747),n=e(37948);t.exports=function(t,r){for(var e=0,a=(r=o(r,t)).length;null!=t&&e<a;)t=t[n(r[e++])];return e&&e==a?t:void 0}},11324:(t,r,e)=>{var o=e(97141),n=e(19785);t.exports=function(t,r,e){var a=r(t);return n(t)?a:o(a,e(t))}},99736:(t,r,e)=>{var o=e(96539),n=e(34840),a=e(21258),s=o?o.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?n(t):a(t)}},55829:(t,r,e)=>{var o=e(99736),n=e(92360);t.exports=function(t){return n(t)&&"[object Arguments]"==o(t)}},46729:(t,r,e)=>{var o=e(28338),n=e(99678),a=e(11611),s=e(76532),i=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,p=u.toString,f=c.hasOwnProperty,l=RegExp("^"+p.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!a(t)||n(t))&&(o(t)?l:i).test(s(t))}},26972:(t,r,e)=>{var o=e(99736),n=e(84194),a=e(92360),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return a(t)&&n(t.length)&&!!s[o(t)]}},20186:(t,r,e)=>{var o=e(56016),n=e(50962),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!o(t))return n(t);var r=[];for(var e in Object(t))a.call(t,e)&&"constructor"!=e&&r.push(e);return r}},24701:t=>{t.exports=function(t,r){for(var e=-1,o=Array(t);++e<t;)o[e]=r(e);return o}},34282:(t,r,e)=>{var o=e(96539),n=e(66070),a=e(19785),s=e(55193),i=o?o.prototype:void 0,u=i?i.toString:void 0;t.exports=function t(r){if("string"==typeof r)return r;if(a(r))return n(r,t)+"";if(s(r))return u?u.call(r):"";var e=r+"";return"0"==e&&1/r==-1/0?"-0":e}},39334:t=>{t.exports=function(t){return function(r){return t(r)}}},76747:(t,r,e)=>{var o=e(19785),n=e(40318),a=e(23419),s=e(65567);t.exports=function(t,r){return o(t)?t:n(t,r)?[t]:a(s(t))}},64937:(t,r,e)=>{var o=e(77400)["__core-js_shared__"];t.exports=o},39120:(t,r,e)=>{var o="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=o},51385:(t,r,e)=>{var o=e(11324),n=e(83080),a=e(50098);t.exports=function(t){return o(t,a,n)}},95899:(t,r,e)=>{var o=e(54479);t.exports=function(t,r){var e=t.__data__;return o(r)?e["string"==typeof r?"string":"hash"]:e.map}},81822:(t,r,e)=>{var o=e(46729),n=e(15371);t.exports=function(t,r){var e=n(t,r);return o(e)?e:void 0}},34840:(t,r,e)=>{var o=e(96539),n=Object.prototype,a=n.hasOwnProperty,s=n.toString,i=o?o.toStringTag:void 0;t.exports=function(t){var r=a.call(t,i),e=t[i];try{t[i]=void 0;var o=!0}catch(t){}var n=s.call(t);return o&&(r?t[i]=e:delete t[i]),n}},83080:(t,r,e)=>{var o=e(10263),n=e(15937),a=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,i=s?function(t){return null==t?[]:(t=Object(t),o(s(t),(function(r){return a.call(t,r)})))}:n;t.exports=i},3533:(t,r,e)=>{var o=e(82545),n=e(44538),a=e(64825),s=e(46151),i=e(66902),u=e(99736),c=e(76532),p="[object Map]",f="[object Promise]",l="[object Set]",v="[object WeakMap]",h="[object DataView]",_=c(o),y=c(n),x=c(a),b=c(s),d=c(i),j=u;(o&&j(new o(new ArrayBuffer(1)))!=h||n&&j(new n)!=p||a&&j(a.resolve())!=f||s&&j(new s)!=l||i&&j(new i)!=v)&&(j=function(t){var r=u(t),e="[object Object]"==r?t.constructor:void 0,o=e?c(e):"";if(o)switch(o){case _:return h;case y:return p;case x:return f;case b:return l;case d:return v}return r}),t.exports=j},15371:t=>{t.exports=function(t,r){return null==t?void 0:t[r]}},57753:(t,r,e)=>{var o=e(35718);t.exports=function(){this.__data__=o?o(null):{},this.size=0}},82452:t=>{t.exports=function(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}},22115:(t,r,e)=>{var o=e(35718),n=Object.prototype.hasOwnProperty;t.exports=function(t){var r=this.__data__;if(o){var e=r[t];return"__lodash_hash_undefined__"===e?void 0:e}return n.call(r,t)?r[t]:void 0}},38256:(t,r,e)=>{var o=e(35718),n=Object.prototype.hasOwnProperty;t.exports=function(t){var r=this.__data__;return o?void 0!==r[t]:n.call(r,t)}},67426:(t,r,e)=>{var o=e(35718);t.exports=function(t,r){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=o&&void 0===r?"__lodash_hash_undefined__":r,this}},42383:t=>{var r=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var o=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==o||"symbol"!=o&&r.test(t))&&t>-1&&t%1==0&&t<e}},40318:(t,r,e)=>{var o=e(19785),n=e(55193),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;t.exports=function(t,r){if(o(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!n(t))||s.test(t)||!a.test(t)||null!=r&&t in Object(r)}},54479:t=>{t.exports=function(t){var r=typeof t;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t}},99678:(t,r,e)=>{var o,n=e(64937),a=(o=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"";t.exports=function(t){return!!a&&a in t}},56016:t=>{var r=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}},69417:t=>{t.exports=function(){this.__data__=[],this.size=0}},72470:(t,r,e)=>{var o=e(65041),n=Array.prototype.splice;t.exports=function(t){var r=this.__data__,e=o(r,t);return!(e<0||(e==r.length-1?r.pop():n.call(r,e,1),--this.size,0))}},66165:(t,r,e)=>{var o=e(65041);t.exports=function(t){var r=this.__data__,e=o(r,t);return e<0?void 0:r[e][1]}},71873:(t,r,e)=>{var o=e(65041);t.exports=function(t){return o(this.__data__,t)>-1}},52556:(t,r,e)=>{var o=e(65041);t.exports=function(t,r){var e=this.__data__,n=o(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this}},39448:(t,r,e)=>{var o=e(96586),n=e(36301),a=e(44538);t.exports=function(){this.size=0,this.__data__={hash:new o,map:new(a||n),string:new o}}},7738:(t,r,e)=>{var o=e(95899);t.exports=function(t){var r=o(this,t).delete(t);return this.size-=r?1:0,r}},66575:(t,r,e)=>{var o=e(95899);t.exports=function(t){return o(this,t).get(t)}},7238:(t,r,e)=>{var o=e(95899);t.exports=function(t){return o(this,t).has(t)}},38738:(t,r,e)=>{var o=e(95899);t.exports=function(t,r){var e=o(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this}},2941:(t,r,e)=>{var o=e(16651);t.exports=function(t){var r=o(t,(function(t){return 500===e.size&&e.clear(),t})),e=r.cache;return r}},35718:(t,r,e)=>{var o=e(81822)(Object,"create");t.exports=o},50962:(t,r,e)=>{var o=e(58023)(Object.keys,Object);t.exports=o},18125:(t,r,e)=>{t=e.nmd(t);var o=e(39120),n=r&&!r.nodeType&&r,a=n&&t&&!t.nodeType&&t,s=a&&a.exports===n&&o.process,i=function(){try{return a&&a.require&&a.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=i},21258:t=>{var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}},58023:t=>{t.exports=function(t,r){return function(e){return t(r(e))}}},77400:(t,r,e)=>{var o=e(39120),n="object"==typeof self&&self&&self.Object===Object&&self,a=o||n||Function("return this")();t.exports=a},7354:(t,r,e)=>{var o=e(36301);t.exports=function(){this.__data__=new o,this.size=0}},5863:t=>{t.exports=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e}},12367:t=>{t.exports=function(t){return this.__data__.get(t)}},90748:t=>{t.exports=function(t){return this.__data__.has(t)}},97569:(t,r,e)=>{var o=e(36301),n=e(44538),a=e(74554);t.exports=function(t,r){var e=this.__data__;if(e instanceof o){var s=e.__data__;if(!n||s.length<199)return s.push([t,r]),this.size=++e.size,this;e=this.__data__=new a(s)}return e.set(t,r),this.size=e.size,this}},23419:(t,r,e)=>{var o=e(2941),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,s=o((function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(n,(function(t,e,o,n){r.push(o?n.replace(a,"$1"):e||t)})),r}));t.exports=s},37948:(t,r,e)=>{var o=e(55193);t.exports=function(t){if("string"==typeof t||o(t))return t;var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},76532:t=>{var r=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return r.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},85638:t=>{t.exports=function(t,r){return t===r||t!=t&&r!=r}},99729:(t,r,e)=>{var o=e(79867);t.exports=function(t,r,e){var n=null==t?void 0:o(t,r);return void 0===n?e:n}},2900:(t,r,e)=>{var o=e(55829),n=e(92360),a=Object.prototype,s=a.hasOwnProperty,i=a.propertyIsEnumerable,u=o(function(){return arguments}())?o:function(t){return n(t)&&s.call(t,"callee")&&!i.call(t,"callee")};t.exports=u},19785:t=>{var r=Array.isArray;t.exports=r},80068:(t,r,e)=>{var o=e(28338),n=e(84194);t.exports=function(t){return null!=t&&n(t.length)&&!o(t)}},43854:(t,r,e)=>{t=e.nmd(t);var o=e(77400),n=e(57714),a=r&&!r.nodeType&&r,s=a&&t&&!t.nodeType&&t,i=s&&s.exports===a?o.Buffer:void 0,u=(i?i.isBuffer:void 0)||n;t.exports=u},28338:(t,r,e)=>{var o=e(99736),n=e(11611);t.exports=function(t){if(!n(t))return!1;var r=o(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}},84194:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},11611:t=>{t.exports=function(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}},92360:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},55193:(t,r,e)=>{var o=e(99736),n=e(92360);t.exports=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==o(t)}},48519:(t,r,e)=>{var o=e(26972),n=e(39334),a=e(18125),s=a&&a.isTypedArray,i=s?n(s):o;t.exports=i},50098:(t,r,e)=>{var o=e(98213),n=e(20186),a=e(80068);t.exports=function(t){return a(t)?o(t):n(t)}},16651:(t,r,e)=>{var o=e(74554);function n(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var e=function(){var o=arguments,n=r?r.apply(this,o):o[0],a=e.cache;if(a.has(n))return a.get(n);var s=t.apply(this,o);return e.cache=a.set(n,s)||a,s};return e.cache=new(n.Cache||o),e}n.Cache=o,t.exports=n},15937:t=>{t.exports=function(){return[]}},57714:t=>{t.exports=function(){return!1}},65567:(t,r,e)=>{var o=e(34282);t.exports=function(t){return null==t?"":o(t)}}}]);
|
|
1
|
+
(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[755],{82545:(t,r,e)=>{var o=e(81822)(e(77400),"DataView");t.exports=o},96586:(t,r,e)=>{var o=e(57753),n=e(82452),a=e(22115),s=e(38256),i=e(67426);function u(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var o=t[r];this.set(o[0],o[1])}}u.prototype.clear=o,u.prototype.delete=n,u.prototype.get=a,u.prototype.has=s,u.prototype.set=i,t.exports=u},36301:(t,r,e)=>{var o=e(69417),n=e(72470),a=e(66165),s=e(71873),i=e(52556);function u(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var o=t[r];this.set(o[0],o[1])}}u.prototype.clear=o,u.prototype.delete=n,u.prototype.get=a,u.prototype.has=s,u.prototype.set=i,t.exports=u},44538:(t,r,e)=>{var o=e(81822)(e(77400),"Map");t.exports=o},74554:(t,r,e)=>{var o=e(39448),n=e(7738),a=e(66575),s=e(7238),i=e(38738);function u(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var o=t[r];this.set(o[0],o[1])}}u.prototype.clear=o,u.prototype.delete=n,u.prototype.get=a,u.prototype.has=s,u.prototype.set=i,t.exports=u},64825:(t,r,e)=>{var o=e(81822)(e(77400),"Promise");t.exports=o},46151:(t,r,e)=>{var o=e(81822)(e(77400),"Set");t.exports=o},23694:(t,r,e)=>{var o=e(36301),n=e(7354),a=e(5863),s=e(12367),i=e(90748),u=e(97569);function c(t){var r=this.__data__=new o(t);this.size=r.size}c.prototype.clear=n,c.prototype.delete=a,c.prototype.get=s,c.prototype.has=i,c.prototype.set=u,t.exports=c},96539:(t,r,e)=>{var o=e(77400).Symbol;t.exports=o},59942:(t,r,e)=>{var o=e(77400).Uint8Array;t.exports=o},66902:(t,r,e)=>{var o=e(81822)(e(77400),"WeakMap");t.exports=o},10263:t=>{t.exports=function(t,r){for(var e=-1,o=null==t?0:t.length,n=0,a=[];++e<o;){var s=t[e];r(s,e,t)&&(a[n++]=s)}return a}},98213:(t,r,e)=>{var o=e(24701),n=e(2900),a=e(19785),s=e(43854),i=e(42383),u=e(48519),c=Object.prototype.hasOwnProperty;t.exports=function(t,r){var e=a(t),p=!e&&n(t),f=!e&&!p&&s(t),l=!e&&!p&&!f&&u(t),v=e||p||f||l,h=v?o(t.length,String):[],_=h.length;for(var y in t)!r&&!c.call(t,y)||v&&("length"==y||f&&("offset"==y||"parent"==y)||l&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||i(y,_))||h.push(y);return h}},66070:t=>{t.exports=function(t,r){for(var e=-1,o=null==t?0:t.length,n=Array(o);++e<o;)n[e]=r(t[e],e,t);return n}},97141:t=>{t.exports=function(t,r){for(var e=-1,o=r.length,n=t.length;++e<o;)t[n+e]=r[e];return t}},93382:(t,r,e)=>{var o=e(85638);t.exports=function(t,r){for(var e=t.length;e--;)if(o(t[e][0],r))return e;return-1}},79867:(t,r,e)=>{var o=e(76747),n=e(37948);t.exports=function(t,r){for(var e=0,a=(r=o(r,t)).length;null!=t&&e<a;)t=t[n(r[e++])];return e&&e==a?t:void 0}},11324:(t,r,e)=>{var o=e(97141),n=e(19785);t.exports=function(t,r,e){var a=r(t);return n(t)?a:o(a,e(t))}},99736:(t,r,e)=>{var o=e(96539),n=e(34840),a=e(21258),s=o?o.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?n(t):a(t)}},55829:(t,r,e)=>{var o=e(99736),n=e(92360);t.exports=function(t){return n(t)&&"[object Arguments]"==o(t)}},46729:(t,r,e)=>{var o=e(28338),n=e(99678),a=e(11611),s=e(76532),i=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,p=u.toString,f=c.hasOwnProperty,l=RegExp("^"+p.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!a(t)||n(t))&&(o(t)?l:i).test(s(t))}},26972:(t,r,e)=>{var o=e(99736),n=e(84194),a=e(92360),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return a(t)&&n(t.length)&&!!s[o(t)]}},20186:(t,r,e)=>{var o=e(56016),n=e(50962),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!o(t))return n(t);var r=[];for(var e in Object(t))a.call(t,e)&&"constructor"!=e&&r.push(e);return r}},24701:t=>{t.exports=function(t,r){for(var e=-1,o=Array(t);++e<t;)o[e]=r(e);return o}},34282:(t,r,e)=>{var o=e(96539),n=e(66070),a=e(19785),s=e(55193),i=o?o.prototype:void 0,u=i?i.toString:void 0;t.exports=function t(r){if("string"==typeof r)return r;if(a(r))return n(r,t)+"";if(s(r))return u?u.call(r):"";var e=r+"";return"0"==e&&1/r==-1/0?"-0":e}},39334:t=>{t.exports=function(t){return function(r){return t(r)}}},76747:(t,r,e)=>{var o=e(19785),n=e(40318),a=e(23419),s=e(65567);t.exports=function(t,r){return o(t)?t:n(t,r)?[t]:a(s(t))}},64937:(t,r,e)=>{var o=e(77400)["__core-js_shared__"];t.exports=o},39120:(t,r,e)=>{var o="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=o},51385:(t,r,e)=>{var o=e(11324),n=e(83080),a=e(50098);t.exports=function(t){return o(t,a,n)}},95899:(t,r,e)=>{var o=e(54479);t.exports=function(t,r){var e=t.__data__;return o(r)?e["string"==typeof r?"string":"hash"]:e.map}},81822:(t,r,e)=>{var o=e(46729),n=e(15371);t.exports=function(t,r){var e=n(t,r);return o(e)?e:void 0}},34840:(t,r,e)=>{var o=e(96539),n=Object.prototype,a=n.hasOwnProperty,s=n.toString,i=o?o.toStringTag:void 0;t.exports=function(t){var r=a.call(t,i),e=t[i];try{t[i]=void 0;var o=!0}catch(t){}var n=s.call(t);return o&&(r?t[i]=e:delete t[i]),n}},83080:(t,r,e)=>{var o=e(10263),n=e(15937),a=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,i=s?function(t){return null==t?[]:(t=Object(t),o(s(t),(function(r){return a.call(t,r)})))}:n;t.exports=i},3533:(t,r,e)=>{var o=e(82545),n=e(44538),a=e(64825),s=e(46151),i=e(66902),u=e(99736),c=e(76532),p="[object Map]",f="[object Promise]",l="[object Set]",v="[object WeakMap]",h="[object DataView]",_=c(o),y=c(n),x=c(a),b=c(s),d=c(i),j=u;(o&&j(new o(new ArrayBuffer(1)))!=h||n&&j(new n)!=p||a&&j(a.resolve())!=f||s&&j(new s)!=l||i&&j(new i)!=v)&&(j=function(t){var r=u(t),e="[object Object]"==r?t.constructor:void 0,o=e?c(e):"";if(o)switch(o){case _:return h;case y:return p;case x:return f;case b:return l;case d:return v}return r}),t.exports=j},15371:t=>{t.exports=function(t,r){return null==t?void 0:t[r]}},57753:(t,r,e)=>{var o=e(35718);t.exports=function(){this.__data__=o?o(null):{},this.size=0}},82452:t=>{t.exports=function(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}},22115:(t,r,e)=>{var o=e(35718),n=Object.prototype.hasOwnProperty;t.exports=function(t){var r=this.__data__;if(o){var e=r[t];return"__lodash_hash_undefined__"===e?void 0:e}return n.call(r,t)?r[t]:void 0}},38256:(t,r,e)=>{var o=e(35718),n=Object.prototype.hasOwnProperty;t.exports=function(t){var r=this.__data__;return o?void 0!==r[t]:n.call(r,t)}},67426:(t,r,e)=>{var o=e(35718);t.exports=function(t,r){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=o&&void 0===r?"__lodash_hash_undefined__":r,this}},42383:t=>{var r=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var o=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==o||"symbol"!=o&&r.test(t))&&t>-1&&t%1==0&&t<e}},40318:(t,r,e)=>{var o=e(19785),n=e(55193),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;t.exports=function(t,r){if(o(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!n(t))||s.test(t)||!a.test(t)||null!=r&&t in Object(r)}},54479:t=>{t.exports=function(t){var r=typeof t;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t}},99678:(t,r,e)=>{var o,n=e(64937),a=(o=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"";t.exports=function(t){return!!a&&a in t}},56016:t=>{var r=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}},69417:t=>{t.exports=function(){this.__data__=[],this.size=0}},72470:(t,r,e)=>{var o=e(93382),n=Array.prototype.splice;t.exports=function(t){var r=this.__data__,e=o(r,t);return!(e<0||(e==r.length-1?r.pop():n.call(r,e,1),--this.size,0))}},66165:(t,r,e)=>{var o=e(93382);t.exports=function(t){var r=this.__data__,e=o(r,t);return e<0?void 0:r[e][1]}},71873:(t,r,e)=>{var o=e(93382);t.exports=function(t){return o(this.__data__,t)>-1}},52556:(t,r,e)=>{var o=e(93382);t.exports=function(t,r){var e=this.__data__,n=o(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this}},39448:(t,r,e)=>{var o=e(96586),n=e(36301),a=e(44538);t.exports=function(){this.size=0,this.__data__={hash:new o,map:new(a||n),string:new o}}},7738:(t,r,e)=>{var o=e(95899);t.exports=function(t){var r=o(this,t).delete(t);return this.size-=r?1:0,r}},66575:(t,r,e)=>{var o=e(95899);t.exports=function(t){return o(this,t).get(t)}},7238:(t,r,e)=>{var o=e(95899);t.exports=function(t){return o(this,t).has(t)}},38738:(t,r,e)=>{var o=e(95899);t.exports=function(t,r){var e=o(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this}},2941:(t,r,e)=>{var o=e(16651);t.exports=function(t){var r=o(t,(function(t){return 500===e.size&&e.clear(),t})),e=r.cache;return r}},35718:(t,r,e)=>{var o=e(81822)(Object,"create");t.exports=o},50962:(t,r,e)=>{var o=e(58023)(Object.keys,Object);t.exports=o},18125:(t,r,e)=>{t=e.nmd(t);var o=e(39120),n=r&&!r.nodeType&&r,a=n&&t&&!t.nodeType&&t,s=a&&a.exports===n&&o.process,i=function(){try{return a&&a.require&&a.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=i},21258:t=>{var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}},58023:t=>{t.exports=function(t,r){return function(e){return t(r(e))}}},77400:(t,r,e)=>{var o=e(39120),n="object"==typeof self&&self&&self.Object===Object&&self,a=o||n||Function("return this")();t.exports=a},7354:(t,r,e)=>{var o=e(36301);t.exports=function(){this.__data__=new o,this.size=0}},5863:t=>{t.exports=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e}},12367:t=>{t.exports=function(t){return this.__data__.get(t)}},90748:t=>{t.exports=function(t){return this.__data__.has(t)}},97569:(t,r,e)=>{var o=e(36301),n=e(44538),a=e(74554);t.exports=function(t,r){var e=this.__data__;if(e instanceof o){var s=e.__data__;if(!n||s.length<199)return s.push([t,r]),this.size=++e.size,this;e=this.__data__=new a(s)}return e.set(t,r),this.size=e.size,this}},23419:(t,r,e)=>{var o=e(2941),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,s=o((function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(n,(function(t,e,o,n){r.push(o?n.replace(a,"$1"):e||t)})),r}));t.exports=s},37948:(t,r,e)=>{var o=e(55193);t.exports=function(t){if("string"==typeof t||o(t))return t;var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},76532:t=>{var r=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return r.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},85638:t=>{t.exports=function(t,r){return t===r||t!=t&&r!=r}},99729:(t,r,e)=>{var o=e(79867);t.exports=function(t,r,e){var n=null==t?void 0:o(t,r);return void 0===n?e:n}},2900:(t,r,e)=>{var o=e(55829),n=e(92360),a=Object.prototype,s=a.hasOwnProperty,i=a.propertyIsEnumerable,u=o(function(){return arguments}())?o:function(t){return n(t)&&s.call(t,"callee")&&!i.call(t,"callee")};t.exports=u},19785:t=>{var r=Array.isArray;t.exports=r},80068:(t,r,e)=>{var o=e(28338),n=e(84194);t.exports=function(t){return null!=t&&n(t.length)&&!o(t)}},43854:(t,r,e)=>{t=e.nmd(t);var o=e(77400),n=e(57714),a=r&&!r.nodeType&&r,s=a&&t&&!t.nodeType&&t,i=s&&s.exports===a?o.Buffer:void 0,u=(i?i.isBuffer:void 0)||n;t.exports=u},28338:(t,r,e)=>{var o=e(99736),n=e(11611);t.exports=function(t){if(!n(t))return!1;var r=o(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}},84194:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},11611:t=>{t.exports=function(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}},92360:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},55193:(t,r,e)=>{var o=e(99736),n=e(92360);t.exports=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==o(t)}},48519:(t,r,e)=>{var o=e(26972),n=e(39334),a=e(18125),s=a&&a.isTypedArray,i=s?n(s):o;t.exports=i},50098:(t,r,e)=>{var o=e(98213),n=e(20186),a=e(80068);t.exports=function(t){return a(t)?o(t):n(t)}},16651:(t,r,e)=>{var o=e(74554);function n(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var e=function(){var o=arguments,n=r?r.apply(this,o):o[0],a=e.cache;if(a.has(n))return a.get(n);var s=t.apply(this,o);return e.cache=a.set(n,s)||a,s};return e.cache=new(n.Cache||o),e}n.Cache=o,t.exports=n},15937:t=>{t.exports=function(){return[]}},57714:t=>{t.exports=function(){return!1}},65567:(t,r,e)=>{var o=e(34282);t.exports=function(t){return null==t?"":o(t)}}}]);
|
notebook/static/7603.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7603],{97603:(e,t,n)=>{n.r(t),n.d(t,{Commands:()=>S,default:()=>R,tabSpaceStatus:()=>L});var o=n(94535),r=n(72703),a=n(63242),i=n(44033),d=n(47019),c=n(50225),l=n(54509),s=n(37383),u=n(6859),m=n(98726),g=n(41030),p=n(99246),f=n(89150),v=n(58515),h=n(85996),C=n(70858),b=n(95291),y=n(33625),w=n(48363),_=n(24636),x=n(65848);const k="notebook:toggle-autoclosing-brackets",T="console:toggle-autoclosing-brackets";var E;!function(e){e.createNew="fileeditor:create-new",e.createNewMarkdown="fileeditor:create-new-markdown-file",e.changeFontSize="fileeditor:change-font-size",e.lineNumbers="fileeditor:toggle-line-numbers",e.currentLineNumbers="fileeditor:toggle-current-line-numbers",e.lineWrap="fileeditor:toggle-line-wrap",e.currentLineWrap="fileeditor:toggle-current-line-wrap",e.changeTabs="fileeditor:change-tabs",e.matchBrackets="fileeditor:toggle-match-brackets",e.currentMatchBrackets="fileeditor:toggle-current-match-brackets",e.autoClosingBrackets="fileeditor:toggle-autoclosing-brackets",e.autoClosingBracketsUniversal="fileeditor:toggle-autoclosing-brackets-universal",e.createConsole="fileeditor:create-console",e.replaceSelection="fileeditor:replace-selection",e.restartConsole="fileeditor:restart-console",e.runCode="fileeditor:run-code",e.runAllCode="fileeditor:run-all",e.markdownPreview="fileeditor:markdown-preview",e.undo="fileeditor:undo",e.redo="fileeditor:redo",e.cut="fileeditor:cut",e.copy="fileeditor:copy",e.paste="fileeditor:paste",e.selectAll="fileeditor:select-all",e.invokeCompleter="completer:invoke-file",e.selectCompleter="completer:select-file",e.openCodeViewer="code-viewer:open",e.changeTheme="fileeditor:change-theme",e.changeLanguage="fileeditor:change-language",e.find="fileeditor:find",e.goToLine="fileeditor:go-to-line"}(E||(E={}));const I="Editor";var S;!function(e){let t={},n=!0;function o(e){e.editor.setOptions({...t,scrollPastEnd:n})}function i(e){const t=e.getSelection(),{start:n,end:o}=t;return n.column!==o.column||n.line!==o.line}function d(e){const t=e.getSelection(),n=e.getOffsetAt(t.start),o=e.getOffsetAt(t.end);return e.model.sharedModel.getSource().substring(n,o)}async function c(e,t,n="txt"){const o=await e.execute("docmanager:new-untitled",{path:t,type:"file",ext:n});if(null!=o){const t=await e.execute("docmanager:open",{path:o.path,factory:I});return t.isUntitled=!0,t}}function l(e,t){e.add({command:E.createNew,category:t.__("Other"),rank:1})}function s(e,t){e.add({command:E.createNewMarkdown,category:t.__("Other"),rank:2})}function u(e,t){const n=t.__("Text Editor"),o=E.changeTabs;e.addItem({command:o,args:{size:4},category:n});for(const t of[1,2,4,8]){const r={size:t};e.addItem({command:o,args:r,category:n})}}function m(e,t){const n=t.__("Text Editor");e.addItem({command:E.createNew,args:{isPalette:!0},category:n})}function g(e,t){const n=t.__("Text Editor");e.addItem({command:E.createNewMarkdown,args:{isPalette:!0},category:n})}function p(e,t){const n=t.__("Text Editor"),o=E.changeFontSize;let r={delta:1};e.addItem({command:o,args:r,category:n}),r={delta:-1},e.addItem({command:o,args:r,category:n})}function f(e,t,n){const o=e=>n()&&e.context&&!!t.find((t=>{var n;return(null===(n=t.sessionContext.session)||void 0===n?void 0:n.path)===e.context.path}));e.runMenu.codeRunners.restart.add({id:E.restartConsole,isEnabled:o}),e.runMenu.codeRunners.run.add({id:E.runCode,isEnabled:o}),e.runMenu.codeRunners.runAll.add({id:E.runAllCode,isEnabled:o})}e.updateSettings=function(e,o){var r;t=null!==(r=e.get("editorConfig").composite)&&void 0!==r?r:{},n=e.get("scrollPasteEnd").composite,o.notifyCommandChanged(E.lineNumbers),o.notifyCommandChanged(E.currentLineNumbers),o.notifyCommandChanged(E.lineWrap),o.notifyCommandChanged(E.currentLineWrap),o.notifyCommandChanged(E.changeTabs),o.notifyCommandChanged(E.matchBrackets),o.notifyCommandChanged(E.currentMatchBrackets),o.notifyCommandChanged(E.autoClosingBrackets),o.notifyCommandChanged(E.changeLanguage)},e.updateTracker=function(e){e.forEach((e=>{o(e.content)}))},e.updateWidget=o,e.addCommands=function(e,n,o,l,s,u,m,g,p,f,v,h){var C;e.addCommand(E.changeFontSize,{execute:e=>{var o;const r=Number(e.delta);if(Number.isNaN(r))return void console.error(`${E.changeFontSize}: delta arg must be a number`);const a=window.getComputedStyle(document.documentElement),i=parseInt(a.getPropertyValue("--jp-code-font-size"),10);t.customStyles||(t.customStyles={});const d=(null!==(o=t.customStyles.fontSize)&&void 0!==o?o:g.baseConfiguration.customStyles.fontSize)||i;return t.customStyles.fontSize=d+r,n.set(l,"editorConfig",t).catch((e=>{console.error(`Failed to set ${l}: ${e.message}`)}))},label:e=>{const t=Number(e.delta);return Number.isNaN(t)&&console.error(`${E.changeFontSize}: delta arg must be a number`),t>0?e.isMenu?o.__("Increase Text Editor Font Size"):o.__("Increase Font Size"):e.isMenu?o.__("Decrease Text Editor Font Size"):o.__("Decrease Font Size")}}),e.addCommand(E.lineNumbers,{execute:async()=>{var e;t.lineNumbers=!(null!==(e=t.lineNumbers)&&void 0!==e?e:g.baseConfiguration.lineNumbers);try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isEnabled:s,isToggled:()=>{var e;return null!==(e=t.lineNumbers)&&void 0!==e?e:g.baseConfiguration.lineNumbers},label:o.__("Show Line Numbers")}),e.addCommand(E.currentLineNumbers,{label:o.__("Show Line Numbers"),caption:o.__("Show the line numbers for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=!e.content.editor.getOption("lineNumbers");e.content.editor.setOption("lineNumbers",t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("lineNumbers"))&&void 0!==e&&e}}),e.addCommand(E.lineWrap,{execute:async e=>{var o;t.lineWrap=null!==(o=e.mode)&&void 0!==o&&o;try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isEnabled:s,isToggled:e=>{var n,o;return(null!==(n=e.mode)&&void 0!==n&&n)===(null!==(o=t.lineWrap)&&void 0!==o?o:g.baseConfiguration.lineWrap)},label:o.__("Word Wrap")}),e.addCommand(E.currentLineWrap,{label:o.__("Wrap Words"),caption:o.__("Wrap words for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=e.content.editor.getOption("lineWrap");e.content.editor.setOption("lineWrap",!t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("lineWrap"))&&void 0!==e&&e}}),e.addCommand(E.changeTabs,{label:e=>{var t;return e.size?o._p("v4","Spaces: %1",null!==(t=e.size)&&void 0!==t?t:""):o.__("Indent with Tab")},execute:async e=>{var o;t.indentUnit=void 0!==e.size?(null!==(o=e.size)&&void 0!==o?o:"4").toString():"Tab";try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isToggled:e=>{var n;const o=null!==(n=t.indentUnit)&&void 0!==n?n:g.baseConfiguration.indentUnit;return e.size?e.size===o:"Tab"==o}}),e.addCommand(E.matchBrackets,{execute:async()=>{var e;t.matchBrackets=!(null!==(e=t.matchBrackets)&&void 0!==e?e:g.baseConfiguration.matchBrackets);try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},label:o.__("Match Brackets"),isEnabled:s,isToggled:()=>{var e;return null!==(e=t.matchBrackets)&&void 0!==e?e:g.baseConfiguration.matchBrackets}}),e.addCommand(E.currentMatchBrackets,{label:o.__("Match Brackets"),caption:o.__("Change match brackets for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=!e.content.editor.getOption("matchBrackets");e.content.editor.setOption("matchBrackets",t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("matchBrackets"))&&void 0!==e&&e}}),e.addCommand(E.autoClosingBrackets,{execute:async e=>{var o,r;t.autoClosingBrackets=!!(null!==(o=e.force)&&void 0!==o?o:!(null!==(r=t.autoClosingBrackets)&&void 0!==r?r:g.baseConfiguration.autoClosingBrackets));try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},label:o.__("Auto Close Brackets in Text Editor"),isToggled:()=>{var e;return null!==(e=t.autoClosingBrackets)&&void 0!==e?e:g.baseConfiguration.autoClosingBrackets}}),e.addCommand(E.autoClosingBracketsUniversal,{execute:()=>{e.isToggled(E.autoClosingBrackets)||e.isToggled(k)||e.isToggled(T)?(e.execute(E.autoClosingBrackets,{force:!1}),e.execute(k,{force:!1}),e.execute(T,{force:!1})):(e.execute(E.autoClosingBrackets,{force:!0}),e.execute(k,{force:!0}),e.execute(T,{force:!0}))},label:o.__("Auto Close Brackets"),isToggled:()=>e.isToggled(E.autoClosingBrackets)||e.isToggled(k)||e.isToggled(T)}),e.addCommand(E.changeTheme,{label:e=>{var n,r,a,i;return null!==(i=null!==(a=null!==(r=null!==(n=e.displayName)&&void 0!==n?n:e.theme)&&void 0!==r?r:t.theme)&&void 0!==a?a:g.baseConfiguration.theme)&&void 0!==i?i:o.__("Editor Theme")},execute:async e=>{var o;t.theme=null!==(o=e.theme)&&void 0!==o?o:t.theme;try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set theme - ${e.message}`)}},isToggled:e=>{var n;return e.theme===(null!==(n=t.theme)&&void 0!==n?n:g.baseConfiguration.theme)}}),e.addCommand(E.find,{label:o.__("Find…"),execute:()=>{const e=u.currentWidget;e&&e.content.editor.execCommand(_.findNext)},isEnabled:s}),e.addCommand(E.goToLine,{label:o.__("Go to Line…"),execute:e=>{const t=u.currentWidget;if(!t)return;const n=t.content.editor,o=e.line,r=e.column;void 0!==o||void 0!==r?n.setCursorPosition({line:(null!=o?o:1)-1,column:(null!=r?r:1)-1}):n.execCommand(_.gotoLine)},isEnabled:s}),e.addCommand(E.changeLanguage,{label:e=>{var t,n;return null!==(n=null!==(t=e.displayName)&&void 0!==t?t:e.name)&&void 0!==n?n:o.__("Change editor language.")},execute:e=>{var t;const n=e.name,o=u.currentWidget;if(n&&o){const e=p.findByName(n);e&&(Array.isArray(e.mime)?o.content.model.mimeType=null!==(t=e.mime[0])&&void 0!==t?t:a.IEditorMimeTypeService.defaultMimeType:o.content.model.mimeType=e.mime)}},isEnabled:s,isToggled:e=>{const t=u.currentWidget;if(!t)return!1;const n=t.content.model.mimeType,o=p.findByMIME(n),r=o&&o.name;return e.name===r}}),e.addCommand(E.replaceSelection,{execute:e=>{var t,n;const o=e.text||"",r=u.currentWidget;r&&(null===(n=(t=r.content.editor).replaceSelection)||void 0===n||n.call(t,o))},isEnabled:s,label:o.__("Replace Selection in Editor")}),e.addCommand(E.createConsole,{execute:t=>{const n=u.currentWidget;if(n)return function(e,t){return async function(n,o){var r,a,i;const d=o||{},c=await e.execute("console:create",{activate:d.activate,name:null===(r=n.context.contentsModel)||void 0===r?void 0:r.name,path:n.context.path,preferredLanguage:n.context.model.defaultKernelLanguage||(null!==(i=null===(a=t.findByFileName(n.context.path))||void 0===a?void 0:a.name)&&void 0!==i?i:""),ref:n.id,insertMode:"split-bottom"});n.context.pathChanged.connect(((e,t)=>{var o;c.session.setPath(t),c.session.setName(null===(o=n.context.contentsModel)||void 0===o?void 0:o.name)}))}}(e,p)(n,t)},isEnabled:s,icon:b.consoleIcon,label:o.__("Create Console for Editor")}),e.addCommand(E.restartConsole,{execute:async()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t||null===f)return;const n=f.find((e=>{var n;return(null===(n=e.sessionContext.session)||void 0===n?void 0:n.path)===t.context.path}));return n?v.restart(n.sessionContext):void 0},label:o.__("Restart Kernel"),isEnabled:()=>null!==f&&s()}),e.addCommand(E.runCode,{execute:()=>{var t;const n=null===(t=u.currentWidget)||void 0===t?void 0:t.content;if(!n)return;let o="";const r=n.editor,a=n.context.path,i=x.PathExt.extname(a),d=r.getSelection(),{start:c,end:l}=d;let s=c.column!==l.column||c.line!==l.line;if(s){const e=r.getOffsetAt(d.start),t=r.getOffsetAt(d.end);o=r.model.sharedModel.getSource().substring(e,t)}else if(x.MarkdownCodeBlocks.isMarkdown(i)){const e=r.model.sharedModel.getSource(),t=x.MarkdownCodeBlocks.findMarkdownCodeBlocks(e);for(const e of t)if(e.startLine<=c.line&&c.line<=e.endLine){o=e.code,s=!0;break}}if(!s){o=r.getLine(d.start.line);const e=r.getCursorPosition();if(e.line+1===r.lineCount){const e=r.model.sharedModel.getSource();r.model.sharedModel.setSource(e+"\n")}r.setCursorPosition({line:e.line+1,column:e.column})}return o?e.execute("console:inject",{activate:!1,code:o,path:a}):Promise.resolve(void 0)},isEnabled:s,label:o.__("Run Selected Code")}),e.addCommand(E.runAllCode,{execute:()=>{var t;const n=null===(t=u.currentWidget)||void 0===t?void 0:t.content;if(!n)return;let o="";const r=n.editor.model.sharedModel.getSource(),a=n.context.path,i=x.PathExt.extname(a);if(x.MarkdownCodeBlocks.isMarkdown(i)){const e=x.MarkdownCodeBlocks.findMarkdownCodeBlocks(r);for(const t of e)o+=t.code}else o=r;return o?e.execute("console:inject",{activate:!1,code:o,path:a}):Promise.resolve(void 0)},isEnabled:s,label:o.__("Run All Code")}),e.addCommand(E.markdownPreview,{execute:()=>{const t=u.currentWidget;if(!t)return;const n=t.context.path;return e.execute("markdownviewer:open",{path:n,options:{mode:"split-right"}})},isVisible:()=>{const e=u.currentWidget;return e&&".md"===x.PathExt.extname(e.context.path)||!1},icon:b.markdownIcon,label:o.__("Show Markdown Preview")}),e.addCommand(E.createNew,{label:e=>{var t,n;return e.isPalette?null!==(t=e.paletteLabel)&&void 0!==t?t:o.__("New Text File"):null!==(n=e.launcherLabel)&&void 0!==n?n:o.__("Text File")},caption:e=>{var t;return null!==(t=e.caption)&&void 0!==t?t:o.__("Create a new text file")},icon:e=>{var t;return e.isPalette?void 0:b.LabIcon.resolve({icon:null!==(t=e.iconName)&&void 0!==t?t:b.textEditorIcon})},execute:t=>{var n;const o=t.cwd||m.model.path;return c(e,o,null!==(n=t.fileExt)&&void 0!==n?n:"txt")}}),e.addCommand(E.createNewMarkdown,{label:e=>e.isPalette?o.__("New Markdown File"):o.__("Markdown File"),caption:o.__("Create a new markdown file"),icon:e=>e.isPalette?void 0:b.markdownIcon,execute:t=>{const n=t.cwd||m.model.path;return c(e,n,"md")}}),e.addCommand(E.undo,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.undo()},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&t.editor.model.sharedModel.canUndo()},icon:b.undoIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Undo")}),e.addCommand(E.redo,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.redo()},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&t.editor.model.sharedModel.canRedo()},icon:b.redoIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Redo")}),e.addCommand(E.cut,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=t.editor,o=d(n);r.Clipboard.copyToSystem(o),n.replaceSelection&&n.replaceSelection("")},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&i(t.editor)},icon:b.cutIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Cut")}),e.addCommand(E.copy,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=d(t.editor);r.Clipboard.copyToSystem(n)},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&i(t.editor)},icon:b.copyIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Copy")}),e.addCommand(E.paste,{execute:async()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=t.editor,o=window.navigator.clipboard,r=await o.readText();r&&n.replaceSelection&&n.replaceSelection(r)},isEnabled:()=>{var e;return Boolean(s()&&(null===(e=u.currentWidget)||void 0===e?void 0:e.content))},icon:b.pasteIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Paste")}),e.addCommand(E.selectAll,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.execCommand(w.selectAll)},isEnabled:()=>{var e;return Boolean(s()&&(null===(e=u.currentWidget)||void 0===e?void 0:e.content))},label:o.__("Select All")});const y=[E.lineNumbers,E.currentLineNumbers,E.lineWrap,E.currentLineWrap,E.matchBrackets,E.currentMatchBrackets,E.find,E.goToLine,E.changeLanguage,E.replaceSelection,E.createConsole,E.restartConsole,E.runCode,E.runAllCode,E.undo,E.redo,E.cut,E.copy,E.paste,E.selectAll,E.createConsole],I=()=>{y.forEach((t=>e.notifyCommandChanged(t)))};u.currentChanged.connect(I),null===(C=h.currentChanged)||void 0===C||C.connect(I)},e.addCompleterCommands=function(e,t,n,o){const r=(null!=o?o:C.nullTranslator).load("jupyterlab");e.addCommand(E.invokeCompleter,{label:r.__("Display the completion helper."),execute:()=>{const e=t.currentWidget&&t.currentWidget.id;if(e)return n.invoke(e)}}),e.addCommand(E.selectCompleter,{label:r.__("Select the completion suggestion."),execute:()=>{const e=t.currentWidget&&t.currentWidget.id;if(e)return n.select(e)}}),e.addKeyBinding({command:E.selectCompleter,keys:["Enter"],selector:".jp-FileEditor .jp-mod-completer-active"})},e.addLauncherItems=function(e,t){l(e,t),s(e,t)},e.addCreateNewToLauncher=l,e.addCreateNewMarkdownToLauncher=s,e.addKernelLanguageLauncherItems=function(e,t,n){for(let o of n)e.add({command:E.createNew,category:t.__("Other"),rank:3,args:o})},e.addPaletteItems=function(e,t){u(e,t),m(e,t),g(e,t),p(e,t)},e.addChangeTabsCommandsToPalette=u,e.addCreateNewCommandToPalette=m,e.addCreateNewMarkdownCommandToPalette=g,e.addChangeFontSizeCommandsToPalette=p,e.addKernelLanguagePaletteItems=function(e,t,n){const o=t.__("Text Editor");for(let t of n)e.addItem({command:E.createNew,args:{...t,isPalette:!0},category:o})},e.addMenuItems=function(e,t,n,o){e.editMenu.undoers.redo.add({id:E.redo,isEnabled:o}),e.editMenu.undoers.undo.add({id:E.undo,isEnabled:o}),e.viewMenu.editorViewers.toggleLineNumbers.add({id:E.currentLineNumbers,isEnabled:o}),e.viewMenu.editorViewers.toggleMatchBrackets.add({id:E.currentMatchBrackets,isEnabled:o}),e.viewMenu.editorViewers.toggleWordWrap.add({id:E.currentLineWrap,isEnabled:o}),e.fileMenu.consoleCreators.add({id:E.createConsole,isEnabled:o}),n&&f(e,n,o)},e.addKernelLanguageMenuItems=function(e,t){for(let n of t)e.fileMenu.newMenu.addItem({command:E.createNew,args:n,rank:31})},e.addCodeRunnersToRunMenu=f,e.addOpenCodeViewerCommand=function(e,t,n,o){e.commands.addCommand(E.openCodeViewer,{label:o.__("Open Code Viewer"),execute:i=>(async i=>{var d;const c=t.factoryService.newDocumentEditor;let l=i.mimeType;!l&&i.extension&&(l=t.mimeTypeService.getMimeTypeByFilePath(`temp.${i.extension.replace(/\\.$/,"")}`));const s=a.CodeViewerWidget.createCodeViewer({factory:e=>c(e),content:i.content,mimeType:l});s.title.label=i.label||o.__("Code Viewer"),s.title.caption=s.title.label;const u=(0,y.find)(e.docRegistry.fileTypes(),(e=>!!l&&e.mimeTypes.includes(l)));s.title.icon=null!==(d=null==u?void 0:u.icon)&&void 0!==d?d:b.textEditorIcon,i.widgetId&&(s.id=i.widgetId);const m=new r.MainAreaWidget({content:s});return await n.add(m),e.shell.add(m,"main"),s})(i)})}}(S||(S={}));const M={id:"@jupyterlab/fileeditor-extension:editor-syntax-status",description:"Adds a file editor syntax status widget.",autoStart:!0,requires:[u.IEditorTracker,i.IEditorLanguageRegistry,o.ILabShell,C.ITranslator],optional:[v.IStatusBar],activate:(e,t,n,o,r,a)=>{if(!a)return;const i=new u.EditorSyntaxStatus({commands:e.commands,languages:n,translator:r});o.currentChanged.connect((()=>{const e=o.currentWidget;e&&t.has(e)&&i.model&&(i.model.editor=e.content.editor)})),a.registerStatusItem(M.id,{item:i,align:"left",rank:0,isActive:()=>!!o.currentWidget&&!!t.currentWidget&&o.currentWidget===t.currentWidget})}},W={activate:function(e,t,n,o,a,i,d,c,l,s,m,g,p,f,v,h,b){const y=W.id,w=null!=h?h:C.nullTranslator,_=null!=p?p:new r.SessionContextDialogs({translator:w}),x=w.load("jupyterlab");let k;v&&(k=(0,r.createToolbarFactory)(v,d,I,y,w));const T=new u.FileEditorFactory({editorServices:t,factoryOptions:{name:I,label:x.__("Editor"),fileTypes:["markdown","*"],defaultFor:["markdown","*"],toolbarFactory:k,translator:w}}),{commands:M,restored:L,shell:N}=e,P=new r.WidgetTracker({namespace:"editor"}),B=()=>null!==P.currentWidget&&P.currentWidget===N.currentWidget,F=new Map([["python",[{fileExt:"py",iconName:"ui-components:python",launcherLabel:x.__("Python File"),paletteLabel:x.__("New Python File"),caption:x.__("Create a new Python file")}]],["julia",[{fileExt:"jl",iconName:"ui-components:julia",launcherLabel:x.__("Julia File"),paletteLabel:x.__("New Julia File"),caption:x.__("Create a new Julia file")}]],["R",[{fileExt:"r",iconName:"ui-components:r-kernel",launcherLabel:x.__("R File"),paletteLabel:x.__("New R File"),caption:x.__("Create a new R file")}]]]);if(g&&g.restore(P,{command:"docmanager:open",args:e=>({path:e.context.path,factory:I}),name:e=>e.context.path}),Promise.all([d.load(y),L]).then((([e])=>{var t,n,r;if(m){const e=null===(t=m.viewMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-view-codemirror-language"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===t?void 0:t.submenu;e&&o.getLanguages().sort(((e,t)=>{const n=e.name,o=t.name;return n.localeCompare(o)})).forEach((t=>{0!==t.name.toLowerCase().indexOf("brainf")&&e.addItem({command:E.changeLanguage,args:{...t}})}));const i=null===(n=m.settingsMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-settings-codemirror-theme"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===n?void 0:n.submenu;if(i)for(const e of a.themes)i.addItem({command:E.changeTheme,args:{theme:e.name,displayName:null!==(r=e.displayName)&&void 0!==r?r:e.name}});m.editMenu.goToLiners.add({id:E.goToLine,isEnabled:e=>null!==P.currentWidget&&P.has(e)})}S.updateSettings(e,M),S.updateTracker(P),e.changed.connect((()=>{S.updateSettings(e,M),S.updateTracker(P)}))})).catch((e=>{console.error(e.message),S.updateTracker(P)})),b){const e=b.getRenderer("@jupyterlab/codemirror-extension:plugin.defaultConfig");e&&b.addRenderer("@jupyterlab/fileeditor-extension:plugin.editorConfig",e)}T.widgetCreated.connect(((e,t)=>{t.context.pathChanged.connect((()=>{P.save(t)})),P.add(t),S.updateWidget(t.content)})),e.docRegistry.addWidgetFactory(T),P.widgetAdded.connect(((e,t)=>{S.updateWidget(t.content)})),S.addCommands(e.commands,d,x,y,B,P,i,n,o,c,_,e.shell);const R=new r.WidgetTracker({namespace:"codeviewer"});return g&&g.restore(R,{command:E.openCodeViewer,args:e=>({content:e.content.content,label:e.content.title.label,mimeType:e.content.mimeType,widgetId:e.content.id}),name:e=>e.content.id}),S.addOpenCodeViewerCommand(e,t,R,x),s&&S.addLauncherItems(s,x),l&&S.addPaletteItems(l,x),m&&S.addMenuItems(m,P,c,B),(async()=>{var t,n;const o=e.serviceManager.kernelspecs;await o.ready;let r=new Set;const a=null!==(n=null===(t=o.specs)||void 0===t?void 0:t.kernelspecs)&&void 0!==n?n:{};return Object.keys(a).forEach((e=>{const t=a[e];if(t){const e=F.get(t.language);null==e||e.forEach((e=>r.add(e)))}})),r})().then((e=>{s&&S.addKernelLanguageLauncherItems(s,x,e),l&&S.addKernelLanguagePaletteItems(l,x,e),m&&S.addKernelLanguageMenuItems(m,e)})).catch((e=>{console.error(e.message)})),f&&(f.add(new u.LaTeXTableOfContentsFactory(P)),f.add(new u.MarkdownTableOfContentsFactory(P)),f.add(new u.PythonTableOfContentsFactory(P))),P},id:"@jupyterlab/fileeditor-extension:plugin",description:"Provides the file editor widget tracker.",requires:[a.IEditorServices,i.IEditorExtensionRegistry,i.IEditorLanguageRegistry,i.IEditorThemeRegistry,s.IDefaultFileBrowser,f.ISettingRegistry],optional:[c.IConsoleTracker,r.ICommandPalette,m.ILauncher,p.IMainMenu,o.ILayoutRestorer,r.ISessionContextDialogs,h.ITableOfContentsRegistry,r.IToolbarWidgetRegistry,C.ITranslator,b.IFormRendererRegistry],provides:u.IEditorTracker,autoStart:!0},L={id:"@jupyterlab/fileeditor-extension:tab-space-status",description:"Adds a file editor indentation status widget.",autoStart:!0,requires:[u.IEditorTracker,i.IEditorExtensionRegistry,f.ISettingRegistry,C.ITranslator],optional:[v.IStatusBar],activate:(e,t,n,o,r,a)=>{const i=r.load("jupyterlab");if(!a)return;const d=new b.MenuSvg({commands:e.commands}),c="fileeditor:change-tabs",{shell:l}=e,s={name:i.__("Indent with Tab")};d.addItem({command:c,args:s});for(const e of["1","2","4","8"]){const t={size:e,name:i._p("v4","Spaces: %1",e)};d.addItem({command:c,args:t})}const m=new u.TabSpaceStatus({menu:d,translator:r}),g=e=>{var t,o,r;m.model.indentUnit=null!==(r=null!==(o=null===(t=e.get("editorConfig").composite)||void 0===t?void 0:t.indentUnit)&&void 0!==o?o:n.baseConfiguration.indentUnit)&&void 0!==r?r:null};Promise.all([o.load("@jupyterlab/fileeditor-extension:plugin"),e.restored]).then((([e])=>{g(e),e.changed.connect(g)})),a.registerStatusItem("@jupyterlab/fileeditor-extension:tab-space-status",{item:m,align:"right",rank:1,isActive:()=>!!l.currentWidget&&t.has(l.currentWidget)})}},N={id:"@jupyterlab/fileeditor-extension:cursor-position",description:"Adds a file editor cursor position status widget.",activate:(e,t,n)=>{n.addEditorProvider((e=>Promise.resolve(e&&t.has(e)?e.content.editor:null)))},requires:[u.IEditorTracker,a.IPositionModel],autoStart:!0},P={id:"@jupyterlab/fileeditor-extension:completer",description:"Adds the completer capability to the file editor.",requires:[u.IEditorTracker],optional:[d.ICompletionProviderManager,C.ITranslator,r.ISanitizer],activate:function(e,t,n,o,a){if(!n)return;S.addCompleterCommands(e.commands,t,n,o);const i=e.serviceManager.sessions,d=null!=a?a:new r.Sanitizer,c=new Map,l=async(e,t)=>{const o={editor:t.content.editor,widget:t};await n.updateCompleter(o);const r=(e,o)=>{const r=c.get(t.id),a=(0,y.find)(o,(e=>e.path===t.context.path));if(a){if(r&&r.id===a.id)return;r&&(c.delete(t.id),r.dispose());const e=i.connectTo({model:a}),o={editor:t.content.editor,widget:t,session:e,sanitizer:d};n.updateCompleter(o).catch(console.error),c.set(t.id,e)}else r&&(c.delete(t.id),r.dispose())};r(0,Array.from(i.running())),i.runningChanged.connect(r),t.disposed.connect((()=>{i.runningChanged.disconnect(r);const e=c.get(t.id);e&&(c.delete(t.id),e.dispose())}))};t.widgetAdded.connect(l),n.activeProvidersChanged.connect((()=>{t.forEach((e=>{l(0,e).catch(console.error)}))}))},autoStart:!0},B={id:"@jupyterlab/fileeditor-extension:search",description:"Adds search capability to the file editor.",requires:[l.ISearchProviderRegistry],autoStart:!0,activate:(e,t)=>{t.add("jp-fileeditorSearchProvider",u.FileEditorSearchProvider)}},F={id:"@jupyterlab/fileeditor-extension:language-server",description:"Adds Language Server capability to the file editor.",requires:[u.IEditorTracker,g.ILSPDocumentConnectionManager,g.ILSPFeatureManager,g.ILSPCodeExtractorsManager,g.IWidgetLSPAdapterTracker],activate:function(e,t,n,o,r,a){t.widgetAdded.connect((async(t,i)=>{const d=new u.FileEditorAdapter(i,{connectionManager:n,featureManager:o,foreignCodeExtractorsManager:r,docRegistry:e.docRegistry});a.add(d)}))},autoStart:!0},R=[W,N,P,F,B,M,L]}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7603],{97603:(e,t,n)=>{n.r(t),n.d(t,{Commands:()=>S,default:()=>R,tabSpaceStatus:()=>L});var o=n(73852),r=n(53876),a=n(983),i=n(3984),d=n(87856),c=n(26177),l=n(95514),s=n(58427),u=n(2522),m=n(70782),g=n(37497),p=n(70607),f=n(3012),v=n(33441),h=n(10035),C=n(93050),b=n(76878),y=n(14931),w=n(48363),_=n(24636),x=n(20754);const k="notebook:toggle-autoclosing-brackets",T="console:toggle-autoclosing-brackets";var E;!function(e){e.createNew="fileeditor:create-new",e.createNewMarkdown="fileeditor:create-new-markdown-file",e.changeFontSize="fileeditor:change-font-size",e.lineNumbers="fileeditor:toggle-line-numbers",e.currentLineNumbers="fileeditor:toggle-current-line-numbers",e.lineWrap="fileeditor:toggle-line-wrap",e.currentLineWrap="fileeditor:toggle-current-line-wrap",e.changeTabs="fileeditor:change-tabs",e.matchBrackets="fileeditor:toggle-match-brackets",e.currentMatchBrackets="fileeditor:toggle-current-match-brackets",e.autoClosingBrackets="fileeditor:toggle-autoclosing-brackets",e.autoClosingBracketsUniversal="fileeditor:toggle-autoclosing-brackets-universal",e.createConsole="fileeditor:create-console",e.replaceSelection="fileeditor:replace-selection",e.restartConsole="fileeditor:restart-console",e.runCode="fileeditor:run-code",e.runAllCode="fileeditor:run-all",e.markdownPreview="fileeditor:markdown-preview",e.undo="fileeditor:undo",e.redo="fileeditor:redo",e.cut="fileeditor:cut",e.copy="fileeditor:copy",e.paste="fileeditor:paste",e.selectAll="fileeditor:select-all",e.invokeCompleter="completer:invoke-file",e.selectCompleter="completer:select-file",e.openCodeViewer="code-viewer:open",e.changeTheme="fileeditor:change-theme",e.changeLanguage="fileeditor:change-language",e.find="fileeditor:find",e.goToLine="fileeditor:go-to-line"}(E||(E={}));const I="Editor";var S;!function(e){let t={},n=!0;function o(e){e.editor.setOptions({...t,scrollPastEnd:n})}function i(e){const t=e.getSelection(),{start:n,end:o}=t;return n.column!==o.column||n.line!==o.line}function d(e){const t=e.getSelection(),n=e.getOffsetAt(t.start),o=e.getOffsetAt(t.end);return e.model.sharedModel.getSource().substring(n,o)}async function c(e,t,n="txt"){const o=await e.execute("docmanager:new-untitled",{path:t,type:"file",ext:n});if(null!=o){const t=await e.execute("docmanager:open",{path:o.path,factory:I});return t.isUntitled=!0,t}}function l(e,t){e.add({command:E.createNew,category:t.__("Other"),rank:1})}function s(e,t){e.add({command:E.createNewMarkdown,category:t.__("Other"),rank:2})}function u(e,t){const n=t.__("Text Editor"),o=E.changeTabs;e.addItem({command:o,args:{size:4},category:n});for(const t of[1,2,4,8]){const r={size:t};e.addItem({command:o,args:r,category:n})}}function m(e,t){const n=t.__("Text Editor");e.addItem({command:E.createNew,args:{isPalette:!0},category:n})}function g(e,t){const n=t.__("Text Editor");e.addItem({command:E.createNewMarkdown,args:{isPalette:!0},category:n})}function p(e,t){const n=t.__("Text Editor"),o=E.changeFontSize;let r={delta:1};e.addItem({command:o,args:r,category:n}),r={delta:-1},e.addItem({command:o,args:r,category:n})}function f(e,t,n){const o=e=>n()&&e.context&&!!t.find((t=>{var n;return(null===(n=t.sessionContext.session)||void 0===n?void 0:n.path)===e.context.path}));e.runMenu.codeRunners.restart.add({id:E.restartConsole,isEnabled:o}),e.runMenu.codeRunners.run.add({id:E.runCode,isEnabled:o}),e.runMenu.codeRunners.runAll.add({id:E.runAllCode,isEnabled:o})}e.updateSettings=function(e,o){var r;t=null!==(r=e.get("editorConfig").composite)&&void 0!==r?r:{},n=e.get("scrollPasteEnd").composite,o.notifyCommandChanged(E.lineNumbers),o.notifyCommandChanged(E.currentLineNumbers),o.notifyCommandChanged(E.lineWrap),o.notifyCommandChanged(E.currentLineWrap),o.notifyCommandChanged(E.changeTabs),o.notifyCommandChanged(E.matchBrackets),o.notifyCommandChanged(E.currentMatchBrackets),o.notifyCommandChanged(E.autoClosingBrackets),o.notifyCommandChanged(E.changeLanguage)},e.updateTracker=function(e){e.forEach((e=>{o(e.content)}))},e.updateWidget=o,e.addCommands=function(e,n,o,l,s,u,m,g,p,f,v,h){var C;e.addCommand(E.changeFontSize,{execute:e=>{var o;const r=Number(e.delta);if(Number.isNaN(r))return void console.error(`${E.changeFontSize}: delta arg must be a number`);const a=window.getComputedStyle(document.documentElement),i=parseInt(a.getPropertyValue("--jp-code-font-size"),10);t.customStyles||(t.customStyles={});const d=(null!==(o=t.customStyles.fontSize)&&void 0!==o?o:g.baseConfiguration.customStyles.fontSize)||i;return t.customStyles.fontSize=d+r,n.set(l,"editorConfig",t).catch((e=>{console.error(`Failed to set ${l}: ${e.message}`)}))},label:e=>{const t=Number(e.delta);return Number.isNaN(t)&&console.error(`${E.changeFontSize}: delta arg must be a number`),t>0?e.isMenu?o.__("Increase Text Editor Font Size"):o.__("Increase Font Size"):e.isMenu?o.__("Decrease Text Editor Font Size"):o.__("Decrease Font Size")}}),e.addCommand(E.lineNumbers,{execute:async()=>{var e;t.lineNumbers=!(null!==(e=t.lineNumbers)&&void 0!==e?e:g.baseConfiguration.lineNumbers);try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isEnabled:s,isToggled:()=>{var e;return null!==(e=t.lineNumbers)&&void 0!==e?e:g.baseConfiguration.lineNumbers},label:o.__("Show Line Numbers")}),e.addCommand(E.currentLineNumbers,{label:o.__("Show Line Numbers"),caption:o.__("Show the line numbers for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=!e.content.editor.getOption("lineNumbers");e.content.editor.setOption("lineNumbers",t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("lineNumbers"))&&void 0!==e&&e}}),e.addCommand(E.lineWrap,{execute:async e=>{var o;t.lineWrap=null!==(o=e.mode)&&void 0!==o&&o;try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isEnabled:s,isToggled:e=>{var n,o;return(null!==(n=e.mode)&&void 0!==n&&n)===(null!==(o=t.lineWrap)&&void 0!==o?o:g.baseConfiguration.lineWrap)},label:o.__("Word Wrap")}),e.addCommand(E.currentLineWrap,{label:o.__("Wrap Words"),caption:o.__("Wrap words for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=e.content.editor.getOption("lineWrap");e.content.editor.setOption("lineWrap",!t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("lineWrap"))&&void 0!==e&&e}}),e.addCommand(E.changeTabs,{label:e=>{var t;return e.size?o._p("v4","Spaces: %1",null!==(t=e.size)&&void 0!==t?t:""):o.__("Indent with Tab")},execute:async e=>{var o;t.indentUnit=void 0!==e.size?(null!==(o=e.size)&&void 0!==o?o:"4").toString():"Tab";try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isToggled:e=>{var n;const o=null!==(n=t.indentUnit)&&void 0!==n?n:g.baseConfiguration.indentUnit;return e.size?e.size===o:"Tab"==o}}),e.addCommand(E.matchBrackets,{execute:async()=>{var e;t.matchBrackets=!(null!==(e=t.matchBrackets)&&void 0!==e?e:g.baseConfiguration.matchBrackets);try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},label:o.__("Match Brackets"),isEnabled:s,isToggled:()=>{var e;return null!==(e=t.matchBrackets)&&void 0!==e?e:g.baseConfiguration.matchBrackets}}),e.addCommand(E.currentMatchBrackets,{label:o.__("Match Brackets"),caption:o.__("Change match brackets for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=!e.content.editor.getOption("matchBrackets");e.content.editor.setOption("matchBrackets",t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("matchBrackets"))&&void 0!==e&&e}}),e.addCommand(E.autoClosingBrackets,{execute:async e=>{var o,r;t.autoClosingBrackets=!!(null!==(o=e.force)&&void 0!==o?o:!(null!==(r=t.autoClosingBrackets)&&void 0!==r?r:g.baseConfiguration.autoClosingBrackets));try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},label:o.__("Auto Close Brackets in Text Editor"),isToggled:()=>{var e;return null!==(e=t.autoClosingBrackets)&&void 0!==e?e:g.baseConfiguration.autoClosingBrackets}}),e.addCommand(E.autoClosingBracketsUniversal,{execute:()=>{e.isToggled(E.autoClosingBrackets)||e.isToggled(k)||e.isToggled(T)?(e.execute(E.autoClosingBrackets,{force:!1}),e.execute(k,{force:!1}),e.execute(T,{force:!1})):(e.execute(E.autoClosingBrackets,{force:!0}),e.execute(k,{force:!0}),e.execute(T,{force:!0}))},label:o.__("Auto Close Brackets"),isToggled:()=>e.isToggled(E.autoClosingBrackets)||e.isToggled(k)||e.isToggled(T)}),e.addCommand(E.changeTheme,{label:e=>{var n,r,a,i;return null!==(i=null!==(a=null!==(r=null!==(n=e.displayName)&&void 0!==n?n:e.theme)&&void 0!==r?r:t.theme)&&void 0!==a?a:g.baseConfiguration.theme)&&void 0!==i?i:o.__("Editor Theme")},execute:async e=>{var o;t.theme=null!==(o=e.theme)&&void 0!==o?o:t.theme;try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set theme - ${e.message}`)}},isToggled:e=>{var n;return e.theme===(null!==(n=t.theme)&&void 0!==n?n:g.baseConfiguration.theme)}}),e.addCommand(E.find,{label:o.__("Find…"),execute:()=>{const e=u.currentWidget;e&&e.content.editor.execCommand(_.findNext)},isEnabled:s}),e.addCommand(E.goToLine,{label:o.__("Go to Line…"),execute:e=>{const t=u.currentWidget;if(!t)return;const n=t.content.editor,o=e.line,r=e.column;void 0!==o||void 0!==r?n.setCursorPosition({line:(null!=o?o:1)-1,column:(null!=r?r:1)-1}):n.execCommand(_.gotoLine)},isEnabled:s}),e.addCommand(E.changeLanguage,{label:e=>{var t,n;return null!==(n=null!==(t=e.displayName)&&void 0!==t?t:e.name)&&void 0!==n?n:o.__("Change editor language.")},execute:e=>{var t;const n=e.name,o=u.currentWidget;if(n&&o){const e=p.findByName(n);e&&(Array.isArray(e.mime)?o.content.model.mimeType=null!==(t=e.mime[0])&&void 0!==t?t:a.IEditorMimeTypeService.defaultMimeType:o.content.model.mimeType=e.mime)}},isEnabled:s,isToggled:e=>{const t=u.currentWidget;if(!t)return!1;const n=t.content.model.mimeType,o=p.findByMIME(n),r=o&&o.name;return e.name===r}}),e.addCommand(E.replaceSelection,{execute:e=>{var t,n;const o=e.text||"",r=u.currentWidget;r&&(null===(n=(t=r.content.editor).replaceSelection)||void 0===n||n.call(t,o))},isEnabled:s,label:o.__("Replace Selection in Editor")}),e.addCommand(E.createConsole,{execute:t=>{const n=u.currentWidget;if(n)return function(e,t){return async function(n,o){var r,a,i;const d=o||{},c=await e.execute("console:create",{activate:d.activate,name:null===(r=n.context.contentsModel)||void 0===r?void 0:r.name,path:n.context.path,preferredLanguage:n.context.model.defaultKernelLanguage||(null!==(i=null===(a=t.findByFileName(n.context.path))||void 0===a?void 0:a.name)&&void 0!==i?i:""),ref:n.id,insertMode:"split-bottom"});n.context.pathChanged.connect(((e,t)=>{var o;c.session.setPath(t),c.session.setName(null===(o=n.context.contentsModel)||void 0===o?void 0:o.name)}))}}(e,p)(n,t)},isEnabled:s,icon:b.consoleIcon,label:o.__("Create Console for Editor")}),e.addCommand(E.restartConsole,{execute:async()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t||null===f)return;const n=f.find((e=>{var n;return(null===(n=e.sessionContext.session)||void 0===n?void 0:n.path)===t.context.path}));return n?v.restart(n.sessionContext):void 0},label:o.__("Restart Kernel"),isEnabled:()=>null!==f&&s()}),e.addCommand(E.runCode,{execute:()=>{var t;const n=null===(t=u.currentWidget)||void 0===t?void 0:t.content;if(!n)return;let o="";const r=n.editor,a=n.context.path,i=x.PathExt.extname(a),d=r.getSelection(),{start:c,end:l}=d;let s=c.column!==l.column||c.line!==l.line;if(s){const e=r.getOffsetAt(d.start),t=r.getOffsetAt(d.end);o=r.model.sharedModel.getSource().substring(e,t)}else if(x.MarkdownCodeBlocks.isMarkdown(i)){const e=r.model.sharedModel.getSource(),t=x.MarkdownCodeBlocks.findMarkdownCodeBlocks(e);for(const e of t)if(e.startLine<=c.line&&c.line<=e.endLine){o=e.code,s=!0;break}}if(!s){o=r.getLine(d.start.line);const e=r.getCursorPosition();if(e.line+1===r.lineCount){const e=r.model.sharedModel.getSource();r.model.sharedModel.setSource(e+"\n")}r.setCursorPosition({line:e.line+1,column:e.column})}return o?e.execute("console:inject",{activate:!1,code:o,path:a}):Promise.resolve(void 0)},isEnabled:s,label:o.__("Run Selected Code")}),e.addCommand(E.runAllCode,{execute:()=>{var t;const n=null===(t=u.currentWidget)||void 0===t?void 0:t.content;if(!n)return;let o="";const r=n.editor.model.sharedModel.getSource(),a=n.context.path,i=x.PathExt.extname(a);if(x.MarkdownCodeBlocks.isMarkdown(i)){const e=x.MarkdownCodeBlocks.findMarkdownCodeBlocks(r);for(const t of e)o+=t.code}else o=r;return o?e.execute("console:inject",{activate:!1,code:o,path:a}):Promise.resolve(void 0)},isEnabled:s,label:o.__("Run All Code")}),e.addCommand(E.markdownPreview,{execute:()=>{const t=u.currentWidget;if(!t)return;const n=t.context.path;return e.execute("markdownviewer:open",{path:n,options:{mode:"split-right"}})},isVisible:()=>{const e=u.currentWidget;return e&&".md"===x.PathExt.extname(e.context.path)||!1},icon:b.markdownIcon,label:o.__("Show Markdown Preview")}),e.addCommand(E.createNew,{label:e=>{var t,n;return e.isPalette?null!==(t=e.paletteLabel)&&void 0!==t?t:o.__("New Text File"):null!==(n=e.launcherLabel)&&void 0!==n?n:o.__("Text File")},caption:e=>{var t;return null!==(t=e.caption)&&void 0!==t?t:o.__("Create a new text file")},icon:e=>{var t;return e.isPalette?void 0:b.LabIcon.resolve({icon:null!==(t=e.iconName)&&void 0!==t?t:b.textEditorIcon})},execute:t=>{var n;const o=t.cwd||m.model.path;return c(e,o,null!==(n=t.fileExt)&&void 0!==n?n:"txt")}}),e.addCommand(E.createNewMarkdown,{label:e=>e.isPalette?o.__("New Markdown File"):o.__("Markdown File"),caption:o.__("Create a new markdown file"),icon:e=>e.isPalette?void 0:b.markdownIcon,execute:t=>{const n=t.cwd||m.model.path;return c(e,n,"md")}}),e.addCommand(E.undo,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.undo()},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&t.editor.model.sharedModel.canUndo()},icon:b.undoIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Undo")}),e.addCommand(E.redo,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.redo()},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&t.editor.model.sharedModel.canRedo()},icon:b.redoIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Redo")}),e.addCommand(E.cut,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=t.editor,o=d(n);r.Clipboard.copyToSystem(o),n.replaceSelection&&n.replaceSelection("")},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&i(t.editor)},icon:b.cutIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Cut")}),e.addCommand(E.copy,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=d(t.editor);r.Clipboard.copyToSystem(n)},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&i(t.editor)},icon:b.copyIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Copy")}),e.addCommand(E.paste,{execute:async()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=t.editor,o=window.navigator.clipboard,r=await o.readText();r&&n.replaceSelection&&n.replaceSelection(r)},isEnabled:()=>{var e;return Boolean(s()&&(null===(e=u.currentWidget)||void 0===e?void 0:e.content))},icon:b.pasteIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Paste")}),e.addCommand(E.selectAll,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.execCommand(w.selectAll)},isEnabled:()=>{var e;return Boolean(s()&&(null===(e=u.currentWidget)||void 0===e?void 0:e.content))},label:o.__("Select All")});const y=[E.lineNumbers,E.currentLineNumbers,E.lineWrap,E.currentLineWrap,E.matchBrackets,E.currentMatchBrackets,E.find,E.goToLine,E.changeLanguage,E.replaceSelection,E.createConsole,E.restartConsole,E.runCode,E.runAllCode,E.undo,E.redo,E.cut,E.copy,E.paste,E.selectAll,E.createConsole],I=()=>{y.forEach((t=>e.notifyCommandChanged(t)))};u.currentChanged.connect(I),null===(C=h.currentChanged)||void 0===C||C.connect(I)},e.addCompleterCommands=function(e,t,n,o){const r=(null!=o?o:C.nullTranslator).load("jupyterlab");e.addCommand(E.invokeCompleter,{label:r.__("Display the completion helper."),execute:()=>{const e=t.currentWidget&&t.currentWidget.id;if(e)return n.invoke(e)}}),e.addCommand(E.selectCompleter,{label:r.__("Select the completion suggestion."),execute:()=>{const e=t.currentWidget&&t.currentWidget.id;if(e)return n.select(e)}}),e.addKeyBinding({command:E.selectCompleter,keys:["Enter"],selector:".jp-FileEditor .jp-mod-completer-active"})},e.addLauncherItems=function(e,t){l(e,t),s(e,t)},e.addCreateNewToLauncher=l,e.addCreateNewMarkdownToLauncher=s,e.addKernelLanguageLauncherItems=function(e,t,n){for(let o of n)e.add({command:E.createNew,category:t.__("Other"),rank:3,args:o})},e.addPaletteItems=function(e,t){u(e,t),m(e,t),g(e,t),p(e,t)},e.addChangeTabsCommandsToPalette=u,e.addCreateNewCommandToPalette=m,e.addCreateNewMarkdownCommandToPalette=g,e.addChangeFontSizeCommandsToPalette=p,e.addKernelLanguagePaletteItems=function(e,t,n){const o=t.__("Text Editor");for(let t of n)e.addItem({command:E.createNew,args:{...t,isPalette:!0},category:o})},e.addMenuItems=function(e,t,n,o){e.editMenu.undoers.redo.add({id:E.redo,isEnabled:o}),e.editMenu.undoers.undo.add({id:E.undo,isEnabled:o}),e.viewMenu.editorViewers.toggleLineNumbers.add({id:E.currentLineNumbers,isEnabled:o}),e.viewMenu.editorViewers.toggleMatchBrackets.add({id:E.currentMatchBrackets,isEnabled:o}),e.viewMenu.editorViewers.toggleWordWrap.add({id:E.currentLineWrap,isEnabled:o}),e.fileMenu.consoleCreators.add({id:E.createConsole,isEnabled:o}),n&&f(e,n,o)},e.addKernelLanguageMenuItems=function(e,t){for(let n of t)e.fileMenu.newMenu.addItem({command:E.createNew,args:n,rank:31})},e.addCodeRunnersToRunMenu=f,e.addOpenCodeViewerCommand=function(e,t,n,o){e.commands.addCommand(E.openCodeViewer,{label:o.__("Open Code Viewer"),execute:i=>(async i=>{var d;const c=t.factoryService.newDocumentEditor;let l=i.mimeType;!l&&i.extension&&(l=t.mimeTypeService.getMimeTypeByFilePath(`temp.${i.extension.replace(/\\.$/,"")}`));const s=a.CodeViewerWidget.createCodeViewer({factory:e=>c(e),content:i.content,mimeType:l});s.title.label=i.label||o.__("Code Viewer"),s.title.caption=s.title.label;const u=(0,y.find)(e.docRegistry.fileTypes(),(e=>!!l&&e.mimeTypes.includes(l)));s.title.icon=null!==(d=null==u?void 0:u.icon)&&void 0!==d?d:b.textEditorIcon,i.widgetId&&(s.id=i.widgetId);const m=new r.MainAreaWidget({content:s});return await n.add(m),e.shell.add(m,"main"),s})(i)})}}(S||(S={}));const M={id:"@jupyterlab/fileeditor-extension:editor-syntax-status",description:"Adds a file editor syntax status widget.",autoStart:!0,requires:[u.IEditorTracker,i.IEditorLanguageRegistry,o.ILabShell,C.ITranslator],optional:[v.IStatusBar],activate:(e,t,n,o,r,a)=>{if(!a)return;const i=new u.EditorSyntaxStatus({commands:e.commands,languages:n,translator:r});o.currentChanged.connect((()=>{const e=o.currentWidget;e&&t.has(e)&&i.model&&(i.model.editor=e.content.editor)})),a.registerStatusItem(M.id,{item:i,align:"left",rank:0,isActive:()=>!!o.currentWidget&&!!t.currentWidget&&o.currentWidget===t.currentWidget})}},W={activate:function(e,t,n,o,a,i,d,c,l,s,m,g,p,f,v,h,b){const y=W.id,w=null!=h?h:C.nullTranslator,_=null!=p?p:new r.SessionContextDialogs({translator:w}),x=w.load("jupyterlab");let k;v&&(k=(0,r.createToolbarFactory)(v,d,I,y,w));const T=new u.FileEditorFactory({editorServices:t,factoryOptions:{name:I,label:x.__("Editor"),fileTypes:["markdown","*"],defaultFor:["markdown","*"],toolbarFactory:k,translator:w}}),{commands:M,restored:L,shell:N}=e,P=new r.WidgetTracker({namespace:"editor"}),B=()=>null!==P.currentWidget&&P.currentWidget===N.currentWidget,F=new Map([["python",[{fileExt:"py",iconName:"ui-components:python",launcherLabel:x.__("Python File"),paletteLabel:x.__("New Python File"),caption:x.__("Create a new Python file")}]],["julia",[{fileExt:"jl",iconName:"ui-components:julia",launcherLabel:x.__("Julia File"),paletteLabel:x.__("New Julia File"),caption:x.__("Create a new Julia file")}]],["R",[{fileExt:"r",iconName:"ui-components:r-kernel",launcherLabel:x.__("R File"),paletteLabel:x.__("New R File"),caption:x.__("Create a new R file")}]]]);if(g&&g.restore(P,{command:"docmanager:open",args:e=>({path:e.context.path,factory:I}),name:e=>e.context.path}),Promise.all([d.load(y),L]).then((([e])=>{var t,n,r;if(m){const e=null===(t=m.viewMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-view-codemirror-language"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===t?void 0:t.submenu;e&&o.getLanguages().sort(((e,t)=>{const n=e.name,o=t.name;return n.localeCompare(o)})).forEach((t=>{0!==t.name.toLowerCase().indexOf("brainf")&&e.addItem({command:E.changeLanguage,args:{...t}})}));const i=null===(n=m.settingsMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-settings-codemirror-theme"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===n?void 0:n.submenu;if(i)for(const e of a.themes)i.addItem({command:E.changeTheme,args:{theme:e.name,displayName:null!==(r=e.displayName)&&void 0!==r?r:e.name}});m.editMenu.goToLiners.add({id:E.goToLine,isEnabled:e=>null!==P.currentWidget&&P.has(e)})}S.updateSettings(e,M),S.updateTracker(P),e.changed.connect((()=>{S.updateSettings(e,M),S.updateTracker(P)}))})).catch((e=>{console.error(e.message),S.updateTracker(P)})),b){const e=b.getRenderer("@jupyterlab/codemirror-extension:plugin.defaultConfig");e&&b.addRenderer("@jupyterlab/fileeditor-extension:plugin.editorConfig",e)}T.widgetCreated.connect(((e,t)=>{t.context.pathChanged.connect((()=>{P.save(t)})),P.add(t),S.updateWidget(t.content)})),e.docRegistry.addWidgetFactory(T),P.widgetAdded.connect(((e,t)=>{S.updateWidget(t.content)})),S.addCommands(e.commands,d,x,y,B,P,i,n,o,c,_,e.shell);const R=new r.WidgetTracker({namespace:"codeviewer"});return g&&g.restore(R,{command:E.openCodeViewer,args:e=>({content:e.content.content,label:e.content.title.label,mimeType:e.content.mimeType,widgetId:e.content.id}),name:e=>e.content.id}),S.addOpenCodeViewerCommand(e,t,R,x),s&&S.addLauncherItems(s,x),l&&S.addPaletteItems(l,x),m&&S.addMenuItems(m,P,c,B),(async()=>{var t,n;const o=e.serviceManager.kernelspecs;await o.ready;let r=new Set;const a=null!==(n=null===(t=o.specs)||void 0===t?void 0:t.kernelspecs)&&void 0!==n?n:{};return Object.keys(a).forEach((e=>{const t=a[e];if(t){const e=F.get(t.language);null==e||e.forEach((e=>r.add(e)))}})),r})().then((e=>{s&&S.addKernelLanguageLauncherItems(s,x,e),l&&S.addKernelLanguagePaletteItems(l,x,e),m&&S.addKernelLanguageMenuItems(m,e)})).catch((e=>{console.error(e.message)})),f&&(f.add(new u.LaTeXTableOfContentsFactory(P)),f.add(new u.MarkdownTableOfContentsFactory(P)),f.add(new u.PythonTableOfContentsFactory(P))),P},id:"@jupyterlab/fileeditor-extension:plugin",description:"Provides the file editor widget tracker.",requires:[a.IEditorServices,i.IEditorExtensionRegistry,i.IEditorLanguageRegistry,i.IEditorThemeRegistry,s.IDefaultFileBrowser,f.ISettingRegistry],optional:[c.IConsoleTracker,r.ICommandPalette,m.ILauncher,p.IMainMenu,o.ILayoutRestorer,r.ISessionContextDialogs,h.ITableOfContentsRegistry,r.IToolbarWidgetRegistry,C.ITranslator,b.IFormRendererRegistry],provides:u.IEditorTracker,autoStart:!0},L={id:"@jupyterlab/fileeditor-extension:tab-space-status",description:"Adds a file editor indentation status widget.",autoStart:!0,requires:[u.IEditorTracker,i.IEditorExtensionRegistry,f.ISettingRegistry,C.ITranslator],optional:[v.IStatusBar],activate:(e,t,n,o,r,a)=>{const i=r.load("jupyterlab");if(!a)return;const d=new b.MenuSvg({commands:e.commands}),c="fileeditor:change-tabs",{shell:l}=e,s={name:i.__("Indent with Tab")};d.addItem({command:c,args:s});for(const e of["1","2","4","8"]){const t={size:e,name:i._p("v4","Spaces: %1",e)};d.addItem({command:c,args:t})}const m=new u.TabSpaceStatus({menu:d,translator:r}),g=e=>{var t,o,r;m.model.indentUnit=null!==(r=null!==(o=null===(t=e.get("editorConfig").composite)||void 0===t?void 0:t.indentUnit)&&void 0!==o?o:n.baseConfiguration.indentUnit)&&void 0!==r?r:null};Promise.all([o.load("@jupyterlab/fileeditor-extension:plugin"),e.restored]).then((([e])=>{g(e),e.changed.connect(g)})),a.registerStatusItem("@jupyterlab/fileeditor-extension:tab-space-status",{item:m,align:"right",rank:1,isActive:()=>!!l.currentWidget&&t.has(l.currentWidget)})}},N={id:"@jupyterlab/fileeditor-extension:cursor-position",description:"Adds a file editor cursor position status widget.",activate:(e,t,n)=>{n.addEditorProvider((e=>Promise.resolve(e&&t.has(e)?e.content.editor:null)))},requires:[u.IEditorTracker,a.IPositionModel],autoStart:!0},P={id:"@jupyterlab/fileeditor-extension:completer",description:"Adds the completer capability to the file editor.",requires:[u.IEditorTracker],optional:[d.ICompletionProviderManager,C.ITranslator,r.ISanitizer],activate:function(e,t,n,o,a){if(!n)return;S.addCompleterCommands(e.commands,t,n,o);const i=e.serviceManager.sessions,d=null!=a?a:new r.Sanitizer,c=new Map,l=async(e,t)=>{const o={editor:t.content.editor,widget:t};await n.updateCompleter(o);const r=(e,o)=>{const r=c.get(t.id),a=(0,y.find)(o,(e=>e.path===t.context.path));if(a){if(r&&r.id===a.id)return;r&&(c.delete(t.id),r.dispose());const e=i.connectTo({model:a}),o={editor:t.content.editor,widget:t,session:e,sanitizer:d};n.updateCompleter(o).catch(console.error),c.set(t.id,e)}else r&&(c.delete(t.id),r.dispose())};r(0,Array.from(i.running())),i.runningChanged.connect(r),t.disposed.connect((()=>{i.runningChanged.disconnect(r);const e=c.get(t.id);e&&(c.delete(t.id),e.dispose())}))};t.widgetAdded.connect(l),n.activeProvidersChanged.connect((()=>{t.forEach((e=>{l(0,e).catch(console.error)}))}))},autoStart:!0},B={id:"@jupyterlab/fileeditor-extension:search",description:"Adds search capability to the file editor.",requires:[l.ISearchProviderRegistry],autoStart:!0,activate:(e,t)=>{t.add("jp-fileeditorSearchProvider",u.FileEditorSearchProvider)}},F={id:"@jupyterlab/fileeditor-extension:language-server",description:"Adds Language Server capability to the file editor.",requires:[u.IEditorTracker,g.ILSPDocumentConnectionManager,g.ILSPFeatureManager,g.ILSPCodeExtractorsManager,g.IWidgetLSPAdapterTracker],activate:function(e,t,n,o,r,a){t.widgetAdded.connect((async(t,i)=>{const d=new u.FileEditorAdapter(i,{connectionManager:n,featureManager:o,foreignCodeExtractorsManager:r,docRegistry:e.docRegistry});a.add(d)}))},autoStart:!0},R=[W,N,P,F,B,M,L]}}]);
|
notebook/static/7639.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7639,3680],{53680:(e,t,s)=>{s.r(t),s.d(t,{GroupItem:()=>r,IStatusBar:()=>f,Popup:()=>h,ProgressBar:()=>l,ProgressCircle:()=>m,StatusBar:()=>v,TextItem:()=>u,showPopup:()=>d});var i=s(78156),a=s.n(i);function r(e){const{spacing:t,children:s,className:a,...r}=e,n=i.Children.count(s);return i.createElement("div",{className:`jp-StatusBar-GroupItem ${a||""}`,...r},i.Children.map(s,((e,s)=>0===s?i.createElement("div",{style:{marginRight:`${t}px`}},e):s===n-1?i.createElement("div",{style:{marginLeft:`${t}px`}},e):i.createElement("div",{style:{margin:`0px ${t}px`}},e))))}var n=s(
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7639,3680],{53680:(e,t,s)=>{s.r(t),s.d(t,{GroupItem:()=>r,IStatusBar:()=>f,Popup:()=>h,ProgressBar:()=>l,ProgressCircle:()=>m,StatusBar:()=>v,TextItem:()=>u,showPopup:()=>d});var i=s(78156),a=s.n(i);function r(e){const{spacing:t,children:s,className:a,...r}=e,n=i.Children.count(s);return i.createElement("div",{className:`jp-StatusBar-GroupItem ${a||""}`,...r},i.Children.map(s,((e,s)=>0===s?i.createElement("div",{style:{marginRight:`${t}px`}},e):s===n-1?i.createElement("div",{style:{marginLeft:`${t}px`}},e):i.createElement("div",{style:{margin:`0px ${t}px`}},e))))}var n=s(76878),o=s(2260);function d(e){const t=new h(e);return e.startHidden||t.launch(),t}class h extends o.Widget{constructor(e){super(),this.addClass("jp-ThemedContainer"),this._body=e.body,this._body.addClass("jp-StatusBar-HoverItem"),this._anchor=e.anchor,this._align=e.align,e.hasDynamicSize&&(this._observer=new ResizeObserver((()=>{this.update()}))),(this.layout=new o.PanelLayout).addWidget(e.body),this._body.node.addEventListener("resize",(()=>{this.update()}))}launch(){this._setGeometry(),o.Widget.attach(this,document.body),this.update(),this._anchor.addClass("jp-mod-clicked"),this._anchor.removeClass("jp-mod-highlight")}onUpdateRequest(e){this._setGeometry(),super.onUpdateRequest(e)}onAfterAttach(e){var t;document.addEventListener("click",this,!1),this.node.addEventListener("keydown",this,!1),window.addEventListener("resize",this,!1),null===(t=this._observer)||void 0===t||t.observe(this._body.node)}onBeforeDetach(e){var t;null===(t=this._observer)||void 0===t||t.disconnect(),document.removeEventListener("click",this,!1),this.node.removeEventListener("keydown",this,!1),window.removeEventListener("resize",this,!1)}onResize(){this.update()}dispose(){var e;null===(e=this._observer)||void 0===e||e.disconnect(),super.dispose(),this._anchor.removeClass("jp-mod-clicked"),this._anchor.addClass("jp-mod-highlight")}handleEvent(e){switch(e.type){case"keydown":this._evtKeydown(e);break;case"click":this._evtClick(e);break;case"resize":this.onResize()}}_evtClick(e){!e.target||this._body.node.contains(e.target)||this._anchor.node.contains(e.target)||this.dispose()}_evtKeydown(e){27===e.keyCode&&(e.stopPropagation(),e.preventDefault(),this.dispose())}_setGeometry(){let e=0;const t=this._anchor.node.getBoundingClientRect(),s=this._body.node.getBoundingClientRect();"right"===this._align&&(e=-(s.width-t.width));const i=window.getComputedStyle(this._body.node);n.HoverBox.setGeometry({anchor:t,host:document.body,maxHeight:500,minHeight:20,node:this._body.node,offset:{horizontal:e},privilege:"forceAbove",style:i})}}function l(e){const{width:t,percentage:s,...a}=e;return i.createElement("div",{className:"jp-Statusbar-ProgressBar-progress-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s},i.createElement(c,{percentage:s,...a,contentWidth:t}))}function c(e){return i.createElement("div",{style:{width:`${e.percentage}%`}},i.createElement("p",null,e.content))}function u(e){const{title:t,source:s,className:a,...r}=e;return i.createElement("span",{className:`jp-StatusBar-TextItem ${a}`,title:t,...r},s)}function m(e){return a().createElement("div",{className:"jp-Statusbar-ProgressCircle",role:"progressbar","aria-label":e.label||"Unlabelled progress circle","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.progress},a().createElement("svg",{viewBox:"0 0 250 250"},a().createElement("circle",{cx:"125",cy:"125",r:"104",stroke:"var(--jp-inverse-layout-color3)",strokeWidth:"20",fill:"none"}),a().createElement("path",{className:"jp-Statusbar-ProgressCirclePath",transform:"translate(125,125) scale(.9)",d:(e=>{const t=Math.max(3.6*e,.1),s=t*Math.PI/180,i=104*Math.sin(s),a=-104*Math.cos(s);return"M 0 0 v -104 A 104 104 1 "+(t<180?1:0)+" 0 "+i.toFixed(4)+" "+a.toFixed(4)+" z"})(e.progress),fill:"var(--jp-inverse-layout-color3)"})))}var p,g=s(14931),_=s(49901);class v extends o.Widget{constructor(){super(),this._isWindowNarrow=()=>window.innerWidth<=630,this._leftRankItems=[],this._rightRankItems=[],this._statusItems={},this._disposables=new _.DisposableSet,this.addClass("jp-StatusBar-Widget");const e=this.layout=new o.PanelLayout,t=this._leftSide=new o.Panel,s=this._middlePanel=new o.Panel,i=this._rightSide=new o.Panel;t.addClass("jp-StatusBar-Left"),s.addClass("jp-StatusBar-Middle"),i.addClass("jp-StatusBar-Right"),e.addWidget(t),e.addWidget(s),e.addWidget(i)}registerStatusItem(e,t){if(e in this._statusItems)throw new Error(`Status item ${e} already registered.`);const s={...p.statusItemDefaults,...t},{align:i,item:a,rank:r,priority:n}=s,o=()=>{this._refreshItem(e)};s.activeStateChanged&&s.activeStateChanged.connect(o);const d={id:e,rank:r,priority:n};if(s.item.addClass("jp-StatusBar-Item"),this._statusItems[e]=s,"left"===i){const e=this._findInsertIndex(this._leftRankItems,d);-1===e?(this._leftSide.addWidget(a),this._leftRankItems.push(d)):(g.ArrayExt.insert(this._leftRankItems,e,d),this._leftSide.insertWidget(e,a))}else if("right"===i){const e=this._findInsertIndex(this._rightRankItems,d);-1===e?(this._rightSide.addWidget(a),this._rightRankItems.push(d)):(g.ArrayExt.insert(this._rightRankItems,e,d),this._rightSide.insertWidget(e,a))}else this._middlePanel.addWidget(a);this._refreshItem(e);const h=new _.DisposableDelegate((()=>{delete this._statusItems[e],s.activeStateChanged&&s.activeStateChanged.disconnect(o),a.parent=null,a.dispose()}));return this._disposables.add(h),h}dispose(){this._leftRankItems.length=0,this._rightRankItems.length=0,this._disposables.dispose(),super.dispose()}onUpdateRequest(e){this._refreshAll(),super.onUpdateRequest(e)}_findInsertIndex(e,t){return g.ArrayExt.findFirstIndex(e,(e=>e.rank>t.rank))}_refreshItem(e){const t=this._statusItems[e];!t.isActive()||0===t.priority&&this._isWindowNarrow()?t.item.hide():(t.item.show(),t.item.update())}_refreshAll(){Object.keys(this._statusItems).forEach((e=>{this._refreshItem(e)}))}}!function(e){e.statusItemDefaults={align:"left",rank:0,priority:0,isActive:()=>!0,activeStateChanged:void 0}}(p||(p={}));const f=new(s(21961).Token)("@jupyterlab/statusbar:IStatusBar","A service for the status bar on the application. Use this if you want to add new status bar items.")}}]);
|